From owner-dev-commits-src-all@freebsd.org Mon Sep 20 00:31:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5503F67472B; Mon, 20 Sep 2021 00:31: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 4HCQV21YD7z3l3D; Mon, 20 Sep 2021 00:31: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 158B326D11; Mon, 20 Sep 2021 00:31: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 18K0Vcsp034786; Mon, 20 Sep 2021 00:31:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18K0VcPi034785; Mon, 20 Sep 2021 00:31:38 GMT (envelope-from git) Date: Mon, 20 Sep 2021 00:31:38 GMT Message-Id: <202109200031.18K0VcPi034785@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: a2e4c22a0e1a - stable/13 - bsd.lib.mk: add conditions for building _pie.a archives MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a2e4c22a0e1abf2983b86fdc6c214da84618ca75 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 00:31:38 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=a2e4c22a0e1abf2983b86fdc6c214da84618ca75 commit a2e4c22a0e1abf2983b86fdc6c214da84618ca75 Author: Ed Maste AuthorDate: 2021-09-12 16:45:50 +0000 Commit: Ed Maste CommitDate: 2021-09-20 00:29:53 +0000 bsd.lib.mk: add conditions for building _pie.a archives As with other .a targets, build _pie.a archives only if LIB is set. At present we build _pie.a only for INTERNALLIBs, and none of them include bsd.lib.mk without setting LIB. However, we might want to build _pie.a for non-INTERNALLIBs in the future. Reviewed by: arichardson MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31920 (cherry picked from commit 7c0226cad3f36a05832f9c5216dfa3dadb91c92d) --- share/mk/bsd.lib.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index db54055b7ae0..bbeaee82883b 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -380,7 +380,7 @@ lib${LIB_PRIVATE}${LIB}_nossp_pic.a: ${NOSSPSOBJS} .endif # !defined(INTERNALLIB) -.if defined(INTERNALLIB) && ${MK_PIE} != "no" +.if defined(INTERNALLIB) && ${MK_PIE} != "no" && defined(LIB) && !empty(LIB) PIEOBJS+= ${OBJS:.o=.pieo} DEPENDOBJS+= ${PIEOBJS} CLEANFILES+= ${PIEOBJS} From owner-dev-commits-src-all@freebsd.org Mon Sep 20 00:32:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8DABC674792; Mon, 20 Sep 2021 00:32:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCQW83H7Lz3lSw; Mon, 20 Sep 2021 00:32: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 5093226F01; Mon, 20 Sep 2021 00:32: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 18K0Wa8c034981; Mon, 20 Sep 2021 00:32:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18K0Wasn034980; Mon, 20 Sep 2021 00:32:36 GMT (envelope-from git) Date: Mon, 20 Sep 2021 00:32:36 GMT Message-Id: <202109200032.18K0Wasn034980@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 95ea87898f23 - stable/12 - bsd.lib.mk: add conditions for building _pie.a archives MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 95ea87898f2365015e1a8473e5c50e5126844648 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 00:32:36 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=95ea87898f2365015e1a8473e5c50e5126844648 commit 95ea87898f2365015e1a8473e5c50e5126844648 Author: Ed Maste AuthorDate: 2021-09-12 16:45:50 +0000 Commit: Ed Maste CommitDate: 2021-09-20 00:31:35 +0000 bsd.lib.mk: add conditions for building _pie.a archives As with other .a targets, build _pie.a archives only if LIB is set. At present we build _pie.a only for INTERNALLIBs, and none of them include bsd.lib.mk without setting LIB. However, we might want to build _pie.a for non-INTERNALLIBs in the future. Reviewed by: arichardson MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31920 (cherry picked from commit 7c0226cad3f36a05832f9c5216dfa3dadb91c92d) --- share/mk/bsd.lib.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 3d7fe4a13343..1b98ad36280e 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -358,7 +358,7 @@ lib${LIB_PRIVATE}${LIB}_nossp_pic.a: ${NOSSPSOBJS} .endif # !defined(INTERNALLIB) -.if defined(INTERNALLIB) && ${MK_PIE} != "no" +.if defined(INTERNALLIB) && ${MK_PIE} != "no" && defined(LIB) && !empty(LIB) PIEOBJS+= ${OBJS:.o=.pieo} DEPENDOBJS+= ${PIEOBJS} CLEANFILES+= ${PIEOBJS} From owner-dev-commits-src-all@freebsd.org Mon Sep 20 00:48:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD67E6748AF; Mon, 20 Sep 2021 00:48:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCQsJ5qZfz3q8s; Mon, 20 Sep 2021 00:48:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3DF726B59; Mon, 20 Sep 2021 00:48:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18K0mKxB048405; Mon, 20 Sep 2021 00:48:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18K0mKXd048404; Mon, 20 Sep 2021 00:48:20 GMT (envelope-from git) Date: Mon, 20 Sep 2021 00:48:20 GMT Message-Id: <202109200048.18K0mKXd048404@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: ecab307389ee - stable/13 - amd64: do not touch low memory in acpi_wakeup_ap() if booted by UEFI 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: ecab307389eed81c7c3dd803954aa97a2bf04305 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 00:48:20 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ecab307389eed81c7c3dd803954aa97a2bf04305 commit ecab307389eed81c7c3dd803954aa97a2bf04305 Author: Konstantin Belousov AuthorDate: 2021-09-11 18:19:27 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-20 00:47:20 +0000 amd64: do not touch low memory in acpi_wakeup_ap() if booted by UEFI (cherry picked from commit e99255c8a6cae324aeede7f5013d080a2d361e3f) --- sys/x86/acpica/acpi_wakeup.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/sys/x86/acpica/acpi_wakeup.c b/sys/x86/acpica/acpi_wakeup.c index b4bbe660bea4..ef52ccc3aef6 100644 --- a/sys/x86/acpica/acpi_wakeup.c +++ b/sys/x86/acpica/acpi_wakeup.c @@ -164,16 +164,22 @@ acpi_wakeup_cpus(struct acpi_softc *sc) int cpu; u_char mpbiosreason; - /* save the current value of the warm-start vector */ - mpbioswarmvec = *((uint32_t *)WARMBOOT_OFF); - outb(CMOS_REG, BIOS_RESET); - mpbiosreason = inb(CMOS_DATA); - - /* setup a vector to our boot code */ - *((volatile u_short *)WARMBOOT_OFF) = WARMBOOT_TARGET; - *((volatile u_short *)WARMBOOT_SEG) = sc->acpi_wakephys >> 4; - outb(CMOS_REG, BIOS_RESET); - outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */ +#ifdef __amd64__ + if (!efi_boot) { +#endif + /* save the current value of the warm-start vector */ + mpbioswarmvec = *((uint32_t *)WARMBOOT_OFF); + outb(CMOS_REG, BIOS_RESET); + mpbiosreason = inb(CMOS_DATA); + + /* setup a vector to our boot code */ + *((volatile u_short *)WARMBOOT_OFF) = WARMBOOT_TARGET; + *((volatile u_short *)WARMBOOT_SEG) = sc->acpi_wakephys >> 4; + outb(CMOS_REG, BIOS_RESET); + outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */ +#ifdef __amd64__ + } +#endif /* Wake up each AP. */ for (cpu = 1; cpu < mp_ncpus; cpu++) { @@ -197,11 +203,17 @@ acpi_wakeup_cpus(struct acpi_softc *sc) pmap_remap_lowptdi(false); #endif - /* restore the warmstart vector */ - *(uint32_t *)WARMBOOT_OFF = mpbioswarmvec; +#ifdef __amd64__ + if (!efi_boot) { +#endif + /* restore the warmstart vector */ + *(uint32_t *)WARMBOOT_OFF = mpbioswarmvec; - outb(CMOS_REG, BIOS_RESET); - outb(CMOS_DATA, mpbiosreason); + outb(CMOS_REG, BIOS_RESET); + outb(CMOS_DATA, mpbiosreason); +#ifdef __amd64__ + } +#endif } #endif From owner-dev-commits-src-all@freebsd.org Mon Sep 20 00:48:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 486636748B0; Mon, 20 Sep 2021 00:48: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 4HCQsM0nk2z3q8x; Mon, 20 Sep 2021 00:48: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 D080426F53; Mon, 20 Sep 2021 00:48: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 18K0mMqp048453; Mon, 20 Sep 2021 00:48:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18K0mM99048452; Mon, 20 Sep 2021 00:48:22 GMT (envelope-from git) Date: Mon, 20 Sep 2021 00:48:22 GMT Message-Id: <202109200048.18K0mM99048452@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: 1a377b8415fa - stable/13 - amd64 acpi_wakeup: map 1:1 whole low 4G for the trampoline page table 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: 1a377b8415faae300cc325f870148ed112422ce6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 00:48:23 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1a377b8415faae300cc325f870148ed112422ce6 commit 1a377b8415faae300cc325f870148ed112422ce6 Author: Konstantin Belousov AuthorDate: 2021-09-11 18:36:38 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-20 00:47:20 +0000 amd64 acpi_wakeup: map 1:1 whole low 4G for the trampoline page table PR: 258432 (cherry picked from commit db2ba218d9fe6a541a4f537a641cce95f952fd98) --- sys/x86/acpica/acpi_wakeup.c | 77 +++++++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 29 deletions(-) diff --git a/sys/x86/acpica/acpi_wakeup.c b/sys/x86/acpica/acpi_wakeup.c index 17946ede45d0..68e0892a31e6 100644 --- a/sys/x86/acpica/acpi_wakeup.c +++ b/sys/x86/acpica/acpi_wakeup.c @@ -99,7 +99,7 @@ static void acpi_wakeup_cpus(struct acpi_softc *); #endif #ifdef __amd64__ -#define ACPI_WAKEPAGES 5 +#define ACPI_WAKEPAGES 8 #else #define ACPI_WAKEPAGES 1 #endif @@ -426,8 +426,8 @@ acpi_install_wakeup_handler(struct acpi_softc *sc) static void *wakeaddr; void *wakepages[ACPI_WAKEPAGES]; #ifdef __amd64__ - uint64_t *pt5, *pt4, *pt3, *pt2; - vm_paddr_t pt5pa, pt4pa, pt3pa, pt2pa; + uint64_t *pt5, *pt4, *pt3, *pt2_0, *pt2_1, *pt2_2, *pt2_3; + vm_paddr_t pt5pa, pt4pa, pt3pa, pt2_0pa, pt2_1pa, pt2_2pa, pt2_3pa; int i; #endif @@ -443,15 +443,21 @@ acpi_install_wakeup_handler(struct acpi_softc *sc) #ifdef __amd64__ if (la57) { - pt5 = wakepages[4]; + pt5 = wakepages[7]; pt5pa = vtophys(pt5); } pt4 = wakepages[1]; pt3 = wakepages[2]; - pt2 = wakepages[3]; + pt2_0 = wakepages[3]; + pt2_1 = wakepages[4]; + pt2_2 = wakepages[5]; + pt2_3 = wakepages[6]; pt4pa = vtophys(pt4); pt3pa = vtophys(pt3); - pt2pa = vtophys(pt2); + pt2_0pa = vtophys(pt2_0); + pt2_1pa = vtophys(pt2_1); + pt2_2pa = vtophys(pt2_2); + pt2_3pa = vtophys(pt2_3); #endif bcopy(wakecode, (void *)sc->acpi_wakeaddr, sizeof(wakecode)); @@ -473,31 +479,44 @@ acpi_install_wakeup_handler(struct acpi_softc *sc) #ifndef __amd64__ WAKECODE_FIXUP(wakeup_cr3, register_t, pmap_get_kcr3()); #else /* __amd64__ */ - /* Create the initial 1GB replicated page tables */ - for (i = 0; i < NPTEPG; i++) { - if (la57) { - pt5[i] = (uint64_t)pt4pa; - pt5[i] |= PG_V | PG_RW | PG_U; - } - - /* - * Each slot of the level 4 pages points - * to the same level 3 page - */ - pt4[i] = (uint64_t)pt3pa; - pt4[i] |= PG_V | PG_RW | PG_U; - - /* - * Each slot of the level 3 pages points - * to the same level 2 page - */ - pt3[i] = (uint64_t)pt2pa; - pt3[i] |= PG_V | PG_RW | PG_U; + /* Create 1:1 mapping for the low 4G */ + if (la57) { + bcopy(kernel_pmap->pm_pmltop, pt5, PAGE_SIZE); + pt5[0] = (uint64_t)pt4pa; + pt5[0] |= PG_V | PG_RW | PG_U; + } else { + bcopy(kernel_pmap->pm_pmltop, pt4, PAGE_SIZE); + } - /* The level 2 page slots are mapped with 2MB pages for 1GB. */ - pt2[i] = i * NBPDR; - pt2[i] |= PG_V | PG_RW | PG_PS | PG_U; + pt4[0] = (uint64_t)pt3pa; + pt4[0] |= PG_V | PG_RW | PG_U; + + pt3[0] = (uint64_t)pt2_0pa; + pt3[0] |= PG_V | PG_RW | PG_U; + pt3[1] = (uint64_t)pt2_1pa; + pt3[1] |= PG_V | PG_RW | PG_U; + pt3[2] = (uint64_t)pt2_2pa; + pt3[2] |= PG_V | PG_RW | PG_U; + pt3[3] = (uint64_t)pt2_3pa; + pt3[3] |= PG_V | PG_RW | PG_U; + + for (i = 0; i < NPDEPG; i++) { + pt2_0[i] = (pd_entry_t)i * NBPDR; + pt2_0[i] |= PG_V | PG_RW | PG_PS | PG_U; + } + for (i = 0; i < NPDEPG; i++) { + pt2_1[i] = (pd_entry_t)NBPDP + i * NBPDR; + pt2_1[i] |= PG_V | PG_RW | PG_PS | PG_U; } + for (i = 0; i < NPDEPG; i++) { + pt2_2[i] = (pd_entry_t)2 * NBPDP + i * NBPDR; + pt2_2[i] |= PG_V | PG_RW | PG_PS | PG_U; + } + for (i = 0; i < NPDEPG; i++) { + pt2_3[i] = (pd_entry_t)3 * NBPDP + i * NBPDR; + pt2_3[i] |= PG_V | PG_RW | PG_PS | PG_U; + } + #endif /* !__amd64__ */ if (bootverbose) From owner-dev-commits-src-all@freebsd.org Mon Sep 20 00:48:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4A41674B8A; Mon, 20 Sep 2021 00:48: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 4HCQsK63ddz3q4g; Mon, 20 Sep 2021 00:48: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 B0CFF270B6; Mon, 20 Sep 2021 00:48: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 18K0mLRq048429; Mon, 20 Sep 2021 00:48:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18K0mLx0048428; Mon, 20 Sep 2021 00:48:21 GMT (envelope-from git) Date: Mon, 20 Sep 2021 00:48:21 GMT Message-Id: <202109200048.18K0mLx0048428@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: 70f86bbf09a1 - stable/13 - x86 acpi_install_wakeup_handler(): style 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: 70f86bbf09a171bba2616dd6e1cabae83655d5ff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 00:48:22 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=70f86bbf09a171bba2616dd6e1cabae83655d5ff commit 70f86bbf09a171bba2616dd6e1cabae83655d5ff Author: Konstantin Belousov AuthorDate: 2021-09-11 18:26:51 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-20 00:47:20 +0000 x86 acpi_install_wakeup_handler(): style (cherry picked from commit ceca8ac1ce47e1f87ba09463aa84eb1c879c37d9) --- sys/x86/acpica/acpi_wakeup.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/x86/acpica/acpi_wakeup.c b/sys/x86/acpica/acpi_wakeup.c index ef52ccc3aef6..17946ede45d0 100644 --- a/sys/x86/acpica/acpi_wakeup.c +++ b/sys/x86/acpica/acpi_wakeup.c @@ -423,12 +423,12 @@ freepages: void acpi_install_wakeup_handler(struct acpi_softc *sc) { - static void *wakeaddr; - void *wakepages[ACPI_WAKEPAGES]; + static void *wakeaddr; + void *wakepages[ACPI_WAKEPAGES]; #ifdef __amd64__ - uint64_t *pt5, *pt4, *pt3, *pt2; - vm_paddr_t pt5pa, pt4pa, pt3pa, pt2pa; - int i; + uint64_t *pt5, *pt4, *pt3, *pt2; + vm_paddr_t pt5pa, pt4pa, pt3pa, pt2pa; + int i; #endif if (wakeaddr != NULL) From owner-dev-commits-src-all@freebsd.org Mon Sep 20 00:48:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5CBDF674B7D; Mon, 20 Sep 2021 00:48: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 4HCQsN0dCYz3q90; Mon, 20 Sep 2021 00:48:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1EBE26B5A; Mon, 20 Sep 2021 00:48: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 18K0mNOQ048477; Mon, 20 Sep 2021 00:48:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18K0mNvo048476; Mon, 20 Sep 2021 00:48:23 GMT (envelope-from git) Date: Mon, 20 Sep 2021 00:48:23 GMT Message-Id: <202109200048.18K0mNvo048476@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: de1aeb942830 - stable/13 - x86: duplicate acpi_wakeup.c per i386 and amd64 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: de1aeb9428301529d58d03fdde9d32afc81533b8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 00:48:24 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=de1aeb9428301529d58d03fdde9d32afc81533b8 commit de1aeb9428301529d58d03fdde9d32afc81533b8 Author: Konstantin Belousov AuthorDate: 2021-09-12 19:24:33 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-20 00:47:21 +0000 x86: duplicate acpi_wakeup.c per i386 and amd64 (cherry picked from commit 2b6eec531a1b52621223316f7c2940ed1e293886) --- sys/{x86 => amd64}/acpica/acpi_wakeup.c | 87 +------ sys/conf/files.amd64 | 1 + sys/conf/files.i386 | 1 + sys/conf/files.x86 | 1 - sys/i386/acpica/acpi_wakeup.c | 391 ++++++++++++++++++++++++++++++++ 5 files changed, 394 insertions(+), 87 deletions(-) diff --git a/sys/x86/acpica/acpi_wakeup.c b/sys/amd64/acpica/acpi_wakeup.c similarity index 86% rename from sys/x86/acpica/acpi_wakeup.c rename to sys/amd64/acpica/acpi_wakeup.c index 68e0892a31e6..fba9532e9a64 100644 --- a/sys/x86/acpica/acpi_wakeup.c +++ b/sys/amd64/acpica/acpi_wakeup.c @@ -32,12 +32,6 @@ #include __FBSDID("$FreeBSD$"); -#if defined(__amd64__) -#define DEV_APIC -#else -#include "opt_apic.h" -#endif - #include #include #include @@ -60,10 +54,8 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef DEV_APIC #include #include -#endif #ifdef SMP #include #include @@ -98,11 +90,7 @@ static int acpi_wakeup_ap(struct acpi_softc *, int); static void acpi_wakeup_cpus(struct acpi_softc *); #endif -#ifdef __amd64__ #define ACPI_WAKEPAGES 8 -#else -#define ACPI_WAKEPAGES 1 -#endif #define WAKECODE_FIXUP(offset, type, val) do { \ type *addr; \ @@ -144,13 +132,8 @@ acpi_wakeup_ap(struct acpi_softc *sc, int cpu) } #define WARMBOOT_TARGET 0 -#ifdef __amd64__ #define WARMBOOT_OFF (KERNBASE + 0x0467) #define WARMBOOT_SEG (KERNBASE + 0x0469) -#else /* __i386__ */ -#define WARMBOOT_OFF (PMAP_MAP_LOW + 0x0467) -#define WARMBOOT_SEG (PMAP_MAP_LOW + 0x0469) -#endif #define CMOS_REG (0x70) #define CMOS_DATA (0x71) @@ -164,9 +147,7 @@ acpi_wakeup_cpus(struct acpi_softc *sc) int cpu; u_char mpbiosreason; -#ifdef __amd64__ if (!efi_boot) { -#endif /* save the current value of the warm-start vector */ mpbioswarmvec = *((uint32_t *)WARMBOOT_OFF); outb(CMOS_REG, BIOS_RESET); @@ -177,9 +158,7 @@ acpi_wakeup_cpus(struct acpi_softc *sc) *((volatile u_short *)WARMBOOT_SEG) = sc->acpi_wakephys >> 4; outb(CMOS_REG, BIOS_RESET); outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */ -#ifdef __amd64__ } -#endif /* Wake up each AP. */ for (cpu = 1; cpu < mp_ncpus; cpu++) { @@ -193,27 +172,13 @@ acpi_wakeup_cpus(struct acpi_softc *sc) } } -#ifdef __i386__ - /* - * Remove the identity mapping of low memory for all CPUs and sync - * the TLB for the BSP. The APs are now spinning in - * cpususpend_handler() and we will release them soon. Then each - * will invalidate its TLB. - */ - pmap_remap_lowptdi(false); -#endif - -#ifdef __amd64__ if (!efi_boot) { -#endif /* restore the warmstart vector */ *(uint32_t *)WARMBOOT_OFF = mpbioswarmvec; outb(CMOS_REG, BIOS_RESET); outb(CMOS_DATA, mpbiosreason); -#ifdef __amd64__ } -#endif } #endif @@ -222,10 +187,8 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) { ACPI_STATUS status; struct pcb *pcb; -#ifdef __amd64__ struct pcpu *pc; int i; -#endif if (sc->acpi_wakeaddr == 0ul) return (-1); /* couldn't alloc wake memory */ @@ -244,18 +207,13 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) pcb = &susppcbs[0]->sp_pcb; if (savectx(pcb)) { -#ifdef __amd64__ fpususpend(susppcbs[0]->sp_fpususpend); -#else - npxsuspend(susppcbs[0]->sp_fpususpend); -#endif #ifdef SMP if (!CPU_EMPTY(&suspcpus) && suspend_cpus(suspcpus) == 0) { device_printf(sc->acpi_dev, "Failed to suspend APs\n"); return (0); /* couldn't sleep */ } #endif -#ifdef __amd64__ hw_ibrs_ibpb_active = 0; hw_ssb_active = 0; cpu_stdext_feature3 = 0; @@ -263,36 +221,16 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) pc = pcpu_find(i); pc->pc_ibpb_set = 0; } -#endif WAKECODE_FIXUP(resume_beep, uint8_t, (acpi_resume_beep != 0)); WAKECODE_FIXUP(reset_video, uint8_t, (acpi_reset_video != 0)); -#ifdef __amd64__ WAKECODE_FIXUP(wakeup_efer, uint64_t, rdmsr(MSR_EFER) & ~(EFER_LMA)); -#else - if ((amd_feature & AMDID_NX) != 0) - WAKECODE_FIXUP(wakeup_efer, uint64_t, rdmsr(MSR_EFER)); - WAKECODE_FIXUP(wakeup_cr4, register_t, pcb->pcb_cr4); -#endif WAKECODE_FIXUP(wakeup_pcb, struct pcb *, pcb); WAKECODE_FIXUP(wakeup_gdt, uint16_t, pcb->pcb_gdt.rd_limit); WAKECODE_FIXUP(wakeup_gdt + 2, uint64_t, pcb->pcb_gdt.rd_base); -#ifdef __i386__ - /* - * Map some low memory with virt == phys for ACPI wakecode - * to use to jump to high memory after enabling paging. This - * is the same as for similar jump in locore, except the - * jump is a single instruction, and we know its address - * more precisely so only need a single PTD, and we have to - * be careful to use the kernel map (PTD[0] is for curthread - * which may be a user thread in deprecated APIs). - */ - pmap_remap_lowptdi(true); -#endif - /* Call ACPICA to enter the desired sleep state */ if (state == ACPI_STATE_S4 && sc->acpi_s4bios) status = AcpiEnterSleepStateS4bios(); @@ -317,11 +255,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) * this point. */ cnresume(); -#ifdef __amd64__ fpuresume(susppcbs[0]->sp_fpususpend); -#else - npxresume(susppcbs[0]->sp_fpususpend); -#endif } return (1); /* wakeup successfully */ @@ -343,9 +277,7 @@ acpi_wakeup_machdep(struct acpi_softc *sc, int state, int sleep_result, initializecpu(); PCPU_SET(switchtime, 0); PCPU_SET(switchticks, ticks); -#ifdef DEV_APIC lapic_xapic_mode(); -#endif #ifdef SMP if (!CPU_EMPTY(&suspcpus)) acpi_wakeup_cpus(sc); @@ -357,10 +289,8 @@ acpi_wakeup_machdep(struct acpi_softc *sc, int state, int sleep_result, resume_cpus(suspcpus); #endif mca_resume(); -#ifdef __amd64__ if (vmm_resume_p != NULL) vmm_resume_p(); -#endif intr_resume(/*suspend_cancelled*/false); AcpiSetFirmwareWakingVector(0, 0); @@ -390,11 +320,7 @@ acpi_alloc_wakeup_handler(void *wakepages[ACPI_WAKEPAGES]) */ for (i = 0; i < ACPI_WAKEPAGES; i++) { wakepages[i] = contigmalloc(PAGE_SIZE, M_DEVBUF, - M_NOWAIT -#ifdef __i386__ - | M_EXEC -#endif - , 0x500, 0xa0000, PAGE_SIZE, 0ul); + M_NOWAIT, 0x500, 0xa0000, PAGE_SIZE, 0ul); if (wakepages[i] == NULL) { printf("%s: can't alloc wake memory\n", __func__); goto freepages; @@ -425,11 +351,9 @@ acpi_install_wakeup_handler(struct acpi_softc *sc) { static void *wakeaddr; void *wakepages[ACPI_WAKEPAGES]; -#ifdef __amd64__ uint64_t *pt5, *pt4, *pt3, *pt2_0, *pt2_1, *pt2_2, *pt2_3; vm_paddr_t pt5pa, pt4pa, pt3pa, pt2_0pa, pt2_1pa, pt2_2pa, pt2_3pa; int i; -#endif if (wakeaddr != NULL) return; @@ -441,7 +365,6 @@ acpi_install_wakeup_handler(struct acpi_softc *sc) sc->acpi_wakeaddr = (vm_offset_t)wakeaddr; sc->acpi_wakephys = vtophys(wakeaddr); -#ifdef __amd64__ if (la57) { pt5 = wakepages[7]; pt5pa = vtophys(pt5); @@ -458,7 +381,6 @@ acpi_install_wakeup_handler(struct acpi_softc *sc) pt2_1pa = vtophys(pt2_1); pt2_2pa = vtophys(pt2_2); pt2_3pa = vtophys(pt2_3); -#endif bcopy(wakecode, (void *)sc->acpi_wakeaddr, sizeof(wakecode)); @@ -467,18 +389,13 @@ acpi_install_wakeup_handler(struct acpi_softc *sc) sc->acpi_wakephys + bootgdt); WAKECODE_FIXUP((wakeup_sw32 + 2), uint32_t, sc->acpi_wakephys + wakeup_32); -#ifdef __amd64__ WAKECODE_FIXUP((wakeup_sw64 + 1), uint32_t, sc->acpi_wakephys + wakeup_64); WAKECODE_FIXUP(wakeup_pagetables, uint32_t, la57 ? (pt5pa | 0x1) : pt4pa); -#endif /* Save pointers to some global data. */ WAKECODE_FIXUP(wakeup_ret, void *, resumectx); -#ifndef __amd64__ - WAKECODE_FIXUP(wakeup_cr3, register_t, pmap_get_kcr3()); -#else /* __amd64__ */ /* Create 1:1 mapping for the low 4G */ if (la57) { bcopy(kernel_pmap->pm_pmltop, pt5, PAGE_SIZE); @@ -517,8 +434,6 @@ acpi_install_wakeup_handler(struct acpi_softc *sc) pt2_3[i] |= PG_V | PG_RW | PG_PS | PG_U; } -#endif /* !__amd64__ */ - if (bootverbose) device_printf(sc->acpi_dev, "wakeup code va %#jx pa %#jx\n", (uintmax_t)sc->acpi_wakeaddr, (uintmax_t)sc->acpi_wakephys); diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index b1593006e110..55456b2d1b90 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -73,6 +73,7 @@ ia32_assym.h standard \ clean "ia32_assym.h" # amd64/acpica/acpi_machdep.c optional acpi +amd64/acpica/acpi_wakeup.c optional acpi acpi_wakecode.o optional acpi \ dependency "$S/amd64/acpica/acpi_wakecode.S assym.inc" \ compile-with "${NORMAL_S}" \ diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 926451976372..5c65ad53cea4 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -132,6 +132,7 @@ dev/vmd/vmd.c optional vmd dev/acpi_support/acpi_wmi_if.m standard dev/wbwd/wbwd.c optional wbwd i386/acpica/acpi_machdep.c optional acpi +i386/acpica/acpi_wakeup.c optional acpi acpi_wakecode.o optional acpi \ dependency "$S/i386/acpica/acpi_wakecode.S assym.inc" \ compile-with "${NORMAL_S}" \ diff --git a/sys/conf/files.x86 b/sys/conf/files.x86 index 7df289375cd3..fba4cb1eb863 100644 --- a/sys/conf/files.x86 +++ b/sys/conf/files.x86 @@ -301,7 +301,6 @@ libkern/x86/crc32_sse42.c standard # x86/acpica/OsdEnvironment.c optional acpi x86/acpica/acpi_apm.c optional acpi -x86/acpica/acpi_wakeup.c optional acpi x86/acpica/srat.c optional acpi x86/bios/smbios.c optional smbios x86/bios/vpd.c optional vpd diff --git a/sys/i386/acpica/acpi_wakeup.c b/sys/i386/acpica/acpi_wakeup.c new file mode 100644 index 000000000000..682e9613962f --- /dev/null +++ b/sys/i386/acpica/acpi_wakeup.c @@ -0,0 +1,391 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2001 Takanori Watanabe + * Copyright (c) 2001-2012 Mitsuru IWASAKI + * Copyright (c) 2003 Peter Wemm + * Copyright (c) 2008-2012 Jung-uk Kim + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_apic.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef DEV_APIC +#include +#include +#endif +#ifdef SMP +#include +#include +#endif + +#include + +#include + +#include "acpi_wakecode.h" +#include "acpi_wakedata.h" + +/* Make sure the code is less than a page and leave room for the stack. */ +CTASSERT(sizeof(wakecode) < PAGE_SIZE - 1024); + +extern int acpi_resume_beep; +extern int acpi_reset_video; +extern int acpi_susp_bounce; + +#ifdef SMP +extern struct susppcb **susppcbs; +static cpuset_t suspcpus; +#else +static struct susppcb **susppcbs; +#endif + +static void *acpi_alloc_wakeup_handler(void **); +static void acpi_stop_beep(void *); + +#ifdef SMP +static int acpi_wakeup_ap(struct acpi_softc *, int); +static void acpi_wakeup_cpus(struct acpi_softc *); +#endif + +#define ACPI_WAKEPAGES 1 + +#define WAKECODE_FIXUP(offset, type, val) do { \ + type *addr; \ + addr = (type *)(sc->acpi_wakeaddr + (offset)); \ + *addr = val; \ +} while (0) + +static void +acpi_stop_beep(void *arg) +{ + + if (acpi_resume_beep != 0) + timer_spkr_release(); +} + +#ifdef SMP +static int +acpi_wakeup_ap(struct acpi_softc *sc, int cpu) +{ + struct pcb *pcb; + int vector = (sc->acpi_wakephys >> 12) & 0xff; + int apic_id = cpu_apic_ids[cpu]; + int ms; + + pcb = &susppcbs[cpu]->sp_pcb; + WAKECODE_FIXUP(wakeup_pcb, struct pcb *, pcb); + WAKECODE_FIXUP(wakeup_gdt, uint16_t, pcb->pcb_gdt.rd_limit); + WAKECODE_FIXUP(wakeup_gdt + 2, uint64_t, pcb->pcb_gdt.rd_base); + + ipi_startup(apic_id, vector); + + /* Wait up to 5 seconds for it to resume. */ + for (ms = 0; ms < 5000; ms++) { + if (!CPU_ISSET(cpu, &suspended_cpus)) + return (1); /* return SUCCESS */ + DELAY(1000); + } + return (0); /* return FAILURE */ +} + +#define WARMBOOT_TARGET 0 +#define WARMBOOT_OFF (PMAP_MAP_LOW + 0x0467) +#define WARMBOOT_SEG (PMAP_MAP_LOW + 0x0469) + +#define CMOS_REG (0x70) +#define CMOS_DATA (0x71) +#define BIOS_RESET (0x0f) +#define BIOS_WARM (0x0a) + +static void +acpi_wakeup_cpus(struct acpi_softc *sc) +{ + uint32_t mpbioswarmvec; + int cpu; + u_char mpbiosreason; + + /* save the current value of the warm-start vector */ + mpbioswarmvec = *((uint32_t *)WARMBOOT_OFF); + outb(CMOS_REG, BIOS_RESET); + mpbiosreason = inb(CMOS_DATA); + + /* setup a vector to our boot code */ + *((volatile u_short *)WARMBOOT_OFF) = WARMBOOT_TARGET; + *((volatile u_short *)WARMBOOT_SEG) = sc->acpi_wakephys >> 4; + outb(CMOS_REG, BIOS_RESET); + outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */ + + /* Wake up each AP. */ + for (cpu = 1; cpu < mp_ncpus; cpu++) { + if (!CPU_ISSET(cpu, &suspcpus)) + continue; + if (acpi_wakeup_ap(sc, cpu) == 0) { + /* restore the warmstart vector */ + *(uint32_t *)WARMBOOT_OFF = mpbioswarmvec; + panic("acpi_wakeup: failed to resume AP #%d (PHY #%d)", + cpu, cpu_apic_ids[cpu]); + } + } + + /* + * Remove the identity mapping of low memory for all CPUs and sync + * the TLB for the BSP. The APs are now spinning in + * cpususpend_handler() and we will release them soon. Then each + * will invalidate its TLB. + */ + pmap_remap_lowptdi(false); + + /* restore the warmstart vector */ + *(uint32_t *)WARMBOOT_OFF = mpbioswarmvec; + + outb(CMOS_REG, BIOS_RESET); + outb(CMOS_DATA, mpbiosreason); +} +#endif + +int +acpi_sleep_machdep(struct acpi_softc *sc, int state) +{ + ACPI_STATUS status; + struct pcb *pcb; + + if (sc->acpi_wakeaddr == 0ul) + return (-1); /* couldn't alloc wake memory */ + +#ifdef SMP + suspcpus = all_cpus; + CPU_CLR(PCPU_GET(cpuid), &suspcpus); +#endif + + if (acpi_resume_beep != 0) + timer_spkr_acquire(); + + AcpiSetFirmwareWakingVector(sc->acpi_wakephys, 0); + + intr_suspend(); + + pcb = &susppcbs[0]->sp_pcb; + if (savectx(pcb)) { + npxsuspend(susppcbs[0]->sp_fpususpend); +#ifdef SMP + if (!CPU_EMPTY(&suspcpus) && suspend_cpus(suspcpus) == 0) { + device_printf(sc->acpi_dev, "Failed to suspend APs\n"); + return (0); /* couldn't sleep */ + } +#endif + + WAKECODE_FIXUP(resume_beep, uint8_t, (acpi_resume_beep != 0)); + WAKECODE_FIXUP(reset_video, uint8_t, (acpi_reset_video != 0)); + + if ((amd_feature & AMDID_NX) != 0) + WAKECODE_FIXUP(wakeup_efer, uint64_t, rdmsr(MSR_EFER)); + WAKECODE_FIXUP(wakeup_cr4, register_t, pcb->pcb_cr4); + WAKECODE_FIXUP(wakeup_pcb, struct pcb *, pcb); + WAKECODE_FIXUP(wakeup_gdt, uint16_t, pcb->pcb_gdt.rd_limit); + WAKECODE_FIXUP(wakeup_gdt + 2, uint64_t, pcb->pcb_gdt.rd_base); + + /* + * Map some low memory with virt == phys for ACPI wakecode + * to use to jump to high memory after enabling paging. This + * is the same as for similar jump in locore, except the + * jump is a single instruction, and we know its address + * more precisely so only need a single PTD, and we have to + * be careful to use the kernel map (PTD[0] is for curthread + * which may be a user thread in deprecated APIs). + */ + pmap_remap_lowptdi(true); + + /* Call ACPICA to enter the desired sleep state */ + if (state == ACPI_STATE_S4 && sc->acpi_s4bios) + status = AcpiEnterSleepStateS4bios(); + else + status = AcpiEnterSleepState(state); + if (ACPI_FAILURE(status)) { + device_printf(sc->acpi_dev, + "AcpiEnterSleepState failed - %s\n", + AcpiFormatException(status)); + return (0); /* couldn't sleep */ + } + + if (acpi_susp_bounce) + resumectx(pcb); + + for (;;) + ia32_pause(); + } else { + /* + * Re-initialize console hardware as soon as possibe. + * No console output (e.g. printf) is allowed before + * this point. + */ + cnresume(); + npxresume(susppcbs[0]->sp_fpususpend); + } + + return (1); /* wakeup successfully */ +} + +int +acpi_wakeup_machdep(struct acpi_softc *sc, int state, int sleep_result, + int intr_enabled) +{ + + if (sleep_result == -1) + return (sleep_result); + + if (!intr_enabled) { + /* Wakeup MD procedures in interrupt disabled context */ + if (sleep_result == 1) { + ucode_reload(); + pmap_init_pat(); + initializecpu(); + PCPU_SET(switchtime, 0); + PCPU_SET(switchticks, ticks); +#ifdef DEV_APIC + lapic_xapic_mode(); +#endif +#ifdef SMP + if (!CPU_EMPTY(&suspcpus)) + acpi_wakeup_cpus(sc); +#endif + } + +#ifdef SMP + if (!CPU_EMPTY(&suspcpus)) + resume_cpus(suspcpus); +#endif + mca_resume(); + intr_resume(/*suspend_cancelled*/false); + + AcpiSetFirmwareWakingVector(0, 0); + } else { + /* Wakeup MD procedures in interrupt enabled context */ + if (sleep_result == 1 && mem_range_softc.mr_op != NULL && + mem_range_softc.mr_op->reinit != NULL) + mem_range_softc.mr_op->reinit(&mem_range_softc); + } + + return (sleep_result); +} + +static void * +acpi_alloc_wakeup_handler(void *wakepages[ACPI_WAKEPAGES]) +{ + int i; + + memset(wakepages, 0, ACPI_WAKEPAGES * sizeof(*wakepages)); + + /* + * Specify the region for our wakeup code. We want it in the low 1 MB + * region, excluding real mode IVT (0-0x3ff), BDA (0x400-0x4ff), EBDA + * (less than 128KB, below 0xa0000, must be excluded by SMAP and DSDT), + * and ROM area (0xa0000 and above). The temporary page tables must be + * page-aligned. + */ + for (i = 0; i < ACPI_WAKEPAGES; i++) { + wakepages[i] = contigmalloc(PAGE_SIZE, M_DEVBUF, + M_NOWAIT | M_EXEC, 0x500, 0xa0000, PAGE_SIZE, 0ul); + if (wakepages[i] == NULL) { + printf("%s: can't alloc wake memory\n", __func__); + goto freepages; + } + } + if (EVENTHANDLER_REGISTER(power_resume, acpi_stop_beep, NULL, + EVENTHANDLER_PRI_LAST) == NULL) { + printf("%s: can't register event handler\n", __func__); + goto freepages; + } + susppcbs = malloc(mp_ncpus * sizeof(*susppcbs), M_DEVBUF, M_WAITOK); + for (i = 0; i < mp_ncpus; i++) { + susppcbs[i] = malloc(sizeof(**susppcbs), M_DEVBUF, M_WAITOK); + susppcbs[i]->sp_fpususpend = alloc_fpusave(M_WAITOK); + } + + return (wakepages); + +freepages: + for (i = 0; i < ACPI_WAKEPAGES; i++) + if (wakepages[i] != NULL) + contigfree(wakepages[i], PAGE_SIZE, M_DEVBUF); + return (NULL); +} + +void +acpi_install_wakeup_handler(struct acpi_softc *sc) +{ + static void *wakeaddr; + void *wakepages[ACPI_WAKEPAGES]; + + if (wakeaddr != NULL) + return; + + if (acpi_alloc_wakeup_handler(wakepages) == NULL) + return; + + wakeaddr = wakepages[0]; + sc->acpi_wakeaddr = (vm_offset_t)wakeaddr; + sc->acpi_wakephys = vtophys(wakeaddr); + + bcopy(wakecode, (void *)sc->acpi_wakeaddr, sizeof(wakecode)); + + /* Patch GDT base address, ljmp targets. */ + WAKECODE_FIXUP((bootgdtdesc + 2), uint32_t, + sc->acpi_wakephys + bootgdt); + WAKECODE_FIXUP((wakeup_sw32 + 2), uint32_t, + sc->acpi_wakephys + wakeup_32); + + /* Save pointers to some global data. */ + WAKECODE_FIXUP(wakeup_ret, void *, resumectx); + WAKECODE_FIXUP(wakeup_cr3, register_t, pmap_get_kcr3()); + + if (bootverbose) + device_printf(sc->acpi_dev, "wakeup code va %#jx pa %#jx\n", + (uintmax_t)sc->acpi_wakeaddr, (uintmax_t)sc->acpi_wakephys); +} From owner-dev-commits-src-all@freebsd.org Mon Sep 20 00:48:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 727DD674B8D; Mon, 20 Sep 2021 00:48:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCQsP1wBDz3qBt; Mon, 20 Sep 2021 00:48: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 110EC26B5B; Mon, 20 Sep 2021 00:48:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18K0mOhO048508; Mon, 20 Sep 2021 00:48:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18K0mOfG048507; Mon, 20 Sep 2021 00:48:24 GMT (envelope-from git) Date: Mon, 20 Sep 2021 00:48:24 GMT Message-Id: <202109200048.18K0mOfG048507@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: f604ea06307b - stable/13 - amd64 wakeup: rework trampoline page allocation 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: f604ea06307b84e71c5a4710cec0166aaa060b4b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 00:48:25 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f604ea06307b84e71c5a4710cec0166aaa060b4b commit f604ea06307b84e71c5a4710cec0166aaa060b4b Author: Konstantin Belousov AuthorDate: 2021-09-12 19:41:51 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-20 00:47:21 +0000 amd64 wakeup: rework trampoline page allocation (cherry picked from commit 1c56781cc915d1d2957e5b53717513193476d777) --- sys/amd64/acpica/acpi_wakeup.c | 79 +++++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 35 deletions(-) diff --git a/sys/amd64/acpica/acpi_wakeup.c b/sys/amd64/acpica/acpi_wakeup.c index fba9532e9a64..0f04ccb6f2fc 100644 --- a/sys/amd64/acpica/acpi_wakeup.c +++ b/sys/amd64/acpica/acpi_wakeup.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -82,7 +83,6 @@ static cpuset_t suspcpus; static struct susppcb **susppcbs; #endif -static void *acpi_alloc_wakeup_handler(void **); static void acpi_stop_beep(void *); #ifdef SMP @@ -90,7 +90,7 @@ static int acpi_wakeup_ap(struct acpi_softc *, int); static void acpi_wakeup_cpus(struct acpi_softc *); #endif -#define ACPI_WAKEPAGES 8 +#define ACPI_WAKEPT_PAGES 7 #define WAKECODE_FIXUP(offset, type, val) do { \ type *addr; \ @@ -304,27 +304,35 @@ acpi_wakeup_machdep(struct acpi_softc *sc, int state, int sleep_result, return (sleep_result); } -static void * -acpi_alloc_wakeup_handler(void *wakepages[ACPI_WAKEPAGES]) +static void +acpi_alloc_wakeup_handler(void **wakeaddr, + void *wakept_pages[ACPI_WAKEPT_PAGES]) { - int i; + vm_page_t wakept_m[ACPI_WAKEPT_PAGES]; + int i; - memset(wakepages, 0, ACPI_WAKEPAGES * sizeof(*wakepages)); + *wakeaddr = NULL; + memset(wakept_pages, 0, ACPI_WAKEPT_PAGES * sizeof(*wakept_pages)); + memset(wakept_m, 0, ACPI_WAKEPT_PAGES * sizeof(*wakept_m)); /* - * Specify the region for our wakeup code. We want it in the low 1 MB - * region, excluding real mode IVT (0-0x3ff), BDA (0x400-0x4ff), EBDA - * (less than 128KB, below 0xa0000, must be excluded by SMAP and DSDT), - * and ROM area (0xa0000 and above). The temporary page tables must be - * page-aligned. + * Specify the region for our wakeup code. We want it in the + * low 1 MB region, excluding real mode IVT (0-0x3ff), BDA + * (0x400-0x4ff), EBDA (less than 128KB, below 0xa0000, must + * be excluded by SMAP and DSDT), and ROM area (0xa0000 and + * above). */ - for (i = 0; i < ACPI_WAKEPAGES; i++) { - wakepages[i] = contigmalloc(PAGE_SIZE, M_DEVBUF, - M_NOWAIT, 0x500, 0xa0000, PAGE_SIZE, 0ul); - if (wakepages[i] == NULL) { - printf("%s: can't alloc wake memory\n", __func__); - goto freepages; - } + *wakeaddr = contigmalloc(PAGE_SIZE, M_DEVBUF, + M_NOWAIT, 0x500, 0xa0000, PAGE_SIZE, 0ul); + if (*wakeaddr == NULL) { + printf("%s: can't alloc wake memory\n", __func__); + goto freepages; + } + + for (i = 0; i < ACPI_WAKEPT_PAGES - (la57 ? 0 : 1); i++) { + wakept_m[i] = pmap_page_alloc_below_4g(true); + wakept_pages[i] = (void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS( + wakept_m[i])); } if (EVENTHANDLER_REGISTER(power_resume, acpi_stop_beep, NULL, EVENTHANDLER_PRI_LAST) == NULL) { @@ -336,45 +344,46 @@ acpi_alloc_wakeup_handler(void *wakepages[ACPI_WAKEPAGES]) susppcbs[i] = malloc(sizeof(**susppcbs), M_DEVBUF, M_WAITOK); susppcbs[i]->sp_fpususpend = alloc_fpusave(M_WAITOK); } - - return (wakepages); + return; freepages: - for (i = 0; i < ACPI_WAKEPAGES; i++) - if (wakepages[i] != NULL) - contigfree(wakepages[i], PAGE_SIZE, M_DEVBUF); - return (NULL); + if (*wakeaddr != NULL) + contigfree(*wakeaddr, PAGE_SIZE, M_DEVBUF); + for (i = 0; i < ACPI_WAKEPT_PAGES; i++) { + if (wakept_m[i] != NULL) + vm_page_free(wakept_m[i]); + } + *wakeaddr = NULL; } void acpi_install_wakeup_handler(struct acpi_softc *sc) { static void *wakeaddr; - void *wakepages[ACPI_WAKEPAGES]; + void *wakept_pages[ACPI_WAKEPT_PAGES]; uint64_t *pt5, *pt4, *pt3, *pt2_0, *pt2_1, *pt2_2, *pt2_3; vm_paddr_t pt5pa, pt4pa, pt3pa, pt2_0pa, pt2_1pa, pt2_2pa, pt2_3pa; int i; if (wakeaddr != NULL) return; - - if (acpi_alloc_wakeup_handler(wakepages) == NULL) + acpi_alloc_wakeup_handler(&wakeaddr, wakept_pages); + if (wakeaddr == NULL) return; - wakeaddr = wakepages[0]; sc->acpi_wakeaddr = (vm_offset_t)wakeaddr; sc->acpi_wakephys = vtophys(wakeaddr); if (la57) { - pt5 = wakepages[7]; + pt5 = wakept_pages[6]; pt5pa = vtophys(pt5); } - pt4 = wakepages[1]; - pt3 = wakepages[2]; - pt2_0 = wakepages[3]; - pt2_1 = wakepages[4]; - pt2_2 = wakepages[5]; - pt2_3 = wakepages[6]; + pt4 = wakept_pages[0]; + pt3 = wakept_pages[1]; + pt2_0 = wakept_pages[2]; + pt2_1 = wakept_pages[3]; + pt2_2 = wakept_pages[4]; + pt2_3 = wakept_pages[5]; pt4pa = vtophys(pt4); pt3pa = vtophys(pt3); pt2_0pa = vtophys(pt2_0); From owner-dev-commits-src-all@freebsd.org Mon Sep 20 00:57:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CBFD4674D2B; Mon, 20 Sep 2021 00: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 4HCR3h5NHLz3s1P; Mon, 20 Sep 2021 00: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 97C242730D; Mon, 20 Sep 2021 00: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 18K0vKOq061430; Mon, 20 Sep 2021 00: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 18K0vKpK061429; Mon, 20 Sep 2021 00:57:20 GMT (envelope-from git) Date: Mon, 20 Sep 2021 00:57:20 GMT Message-Id: <202109200057.18K0vKpK061429@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: 9b8da0026ba3 - stable/13 - targ(4): Remove D_NEEDGIANT. 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: 9b8da0026ba398c892c087296030a4cae2d5a338 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 00:57:20 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=9b8da0026ba398c892c087296030a4cae2d5a338 commit 9b8da0026ba398c892c087296030a4cae2d5a338 Author: Alexander Motin AuthorDate: 2021-08-21 15:20:54 +0000 Commit: Alexander Motin CommitDate: 2021-09-20 00:57:17 +0000 targ(4): Remove D_NEEDGIANT. I don't believe this code needs Giant, if ever needed. MFC after: 1 month (cherry picked from commit f3dcedd3de27b1a8f493c8256103e8a7fb93f5a4) --- sys/cam/scsi/scsi_target.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c index b2874f49f13f..dd06ca7d64ba 100644 --- a/sys/cam/scsi/scsi_target.c +++ b/sys/cam/scsi/scsi_target.c @@ -115,7 +115,6 @@ static struct filterops targread_filtops = { static struct cdevsw targ_cdevsw = { .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, .d_open = targopen, .d_read = targread, .d_write = targwrite, From owner-dev-commits-src-all@freebsd.org Mon Sep 20 01:29:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9DC1D6752A9; Mon, 20 Sep 2021 01:29: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 4HCRmw3xRqz4WNv; Mon, 20 Sep 2021 01:29: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 67192272E7; Mon, 20 Sep 2021 01:29: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 18K1Taaf001756; Mon, 20 Sep 2021 01:29:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18K1Ta0W001755; Mon, 20 Sep 2021 01:29:36 GMT (envelope-from git) Date: Mon, 20 Sep 2021 01:29:36 GMT Message-Id: <202109200129.18K1Ta0W001755@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: f8c4000ca683 - stable/13 - libprocstat: extend zfs_defs hack for .pieo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f8c4000ca683e3f4762be683e041519f1398777d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 01:29:36 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=f8c4000ca683e3f4762be683e041519f1398777d commit f8c4000ca683e3f4762be683e041519f1398777d Author: Ed Maste AuthorDate: 2021-09-12 23:04:31 +0000 Commit: Ed Maste CommitDate: 2021-09-20 01:28:26 +0000 libprocstat: extend zfs_defs hack for .pieo By default _pie.a archives are built only for INTERNALLIBs, so there is usually no need for zfs_defs.pieo to exist. However, some experimental work builds _pie.a archives for everything. Extend the existing set of zfs_defs hacks to build zfs_defs.pieo as well. Reviewed by: arichardson MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31924 (cherry picked from commit b9df18d6e8917a9bfb62babb7cf9efeca23aa2fc) --- lib/libprocstat/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libprocstat/Makefile b/lib/libprocstat/Makefile index 2e60a7b0dc4d..e8ca072066d5 100644 --- a/lib/libprocstat/Makefile +++ b/lib/libprocstat/Makefile @@ -64,6 +64,8 @@ zfs/zfs_defs.o: .PHONY @cd ${.CURDIR}/zfs && ${MAKE} zfs_defs.o zfs/zfs_defs.pico: .PHONY @cd ${.CURDIR}/zfs && ${MAKE} zfs_defs.pico +zfs/zfs_defs.pieo: .PHONY + @cd ${.CURDIR}/zfs && ${MAKE} zfs_defs.pieo zfs/zfs_defs.po: .PHONY @cd ${.CURDIR}/zfs && ${MAKE} zfs_defs.po .endif From owner-dev-commits-src-all@freebsd.org Mon Sep 20 04:37:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AAD5F677820; Mon, 20 Sep 2021 04:37: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 4HCWxR4Bsmz3Phl; Mon, 20 Sep 2021 04:37: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 6C3AE1CB8; Mon, 20 Sep 2021 04:37: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 18K4bFWg054950; Mon, 20 Sep 2021 04:37:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18K4bFeH054949; Mon, 20 Sep 2021 04:37:15 GMT (envelope-from git) Date: Mon, 20 Sep 2021 04:37:15 GMT Message-Id: <202109200437.18K4bFeH054949@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marko Zec Subject: git: 2ac039f7be62 - main - [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/main X-Git-Reftype: branch X-Git-Commit: 2ac039f7be620f692a3a086f35a51f1a0b6b03d2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 04:37:15 -0000 The branch main has been updated by zec: URL: https://cgit.FreeBSD.org/src/commit/?id=2ac039f7be620f692a3a086f35a51f1a0b6b03d2 commit 2ac039f7be620f692a3a086f35a51f1a0b6b03d2 Author: Marko Zec AuthorDate: 2021-09-20 04:30:45 +0000 Commit: Marko Zec CommitDate: 2021-09-20 04:30:45 +0000 [fib_algo][dxr] Merge adjacent empty range table chunks. MFC after: 3 days --- sys/netinet/in_fib_dxr.c | 60 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/sys/netinet/in_fib_dxr.c b/sys/netinet/in_fib_dxr.c index 3aa357cadedc..c4f42abdda27 100644 --- a/sys/netinet/in_fib_dxr.c +++ b/sys/netinet/in_fib_dxr.c @@ -418,14 +418,15 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk) fdesc->base = cdp->cd_base; da->rtbl_top -= size; da->unused_chunks_cnt--; - if (cdp->cd_max_size > size + 1) { + if (cdp->cd_max_size > size) { /* Split the range in two, need a new descriptor */ empty_cdp = uma_zalloc(chunk_zone, M_NOWAIT); if (empty_cdp == NULL) return (1); + empty_cdp->cd_cur_size = 0; empty_cdp->cd_max_size = cdp->cd_max_size - size; empty_cdp->cd_base = cdp->cd_base + size; - LIST_INSERT_AFTER(cdp, empty_cdp, cd_all_le); + LIST_INSERT_BEFORE(cdp, empty_cdp, cd_all_le); LIST_INSERT_AFTER(cdp, empty_cdp, cd_hash_le); da->all_chunks_cnt++; da->unused_chunks_cnt++; @@ -433,7 +434,7 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk) } LIST_REMOVE(cdp, cd_hash_le); } else { - /* Alloc a new descriptor */ + /* Alloc a new descriptor at the top of the heap*/ cdp = uma_zalloc(chunk_zone, M_NOWAIT); if (cdp == NULL) return (1); @@ -441,6 +442,8 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk) cdp->cd_base = fdesc->base; LIST_INSERT_HEAD(&da->all_chunks, cdp, cd_all_le); da->all_chunks_cnt++; + KASSERT(cdp->cd_base + cdp->cd_max_size == da->rtbl_top, + ("dxr: %s %d", __FUNCTION__, __LINE__)); } cdp->cd_hash = hash; @@ -473,12 +476,12 @@ static void chunk_unref(struct dxr_aux *da, uint32_t chunk) { struct direct_entry *fdesc = &da->direct_tbl[chunk]; - struct chunk_desc *cdp; + struct chunk_desc *cdp, *cdp2; uint32_t base = fdesc->base; uint32_t size = chunk_size(da, fdesc); uint32_t hash = chunk_hash(da, fdesc); - /* Find an existing descriptor */ + /* Find the corresponding descriptor */ LIST_FOREACH(cdp, &da->chunk_hashtbl[hash & CHUNK_HASH_MASK], cd_hash_le) if (cdp->cd_hash == hash && cdp->cd_cur_size == size && @@ -492,23 +495,50 @@ chunk_unref(struct dxr_aux *da, uint32_t chunk) LIST_REMOVE(cdp, cd_hash_le); da->unused_chunks_cnt++; - if (cdp->cd_base + cdp->cd_max_size != da->rtbl_top) { - LIST_INSERT_HEAD(&da->unused_chunks, cdp, cd_hash_le); - return; + cdp->cd_cur_size = 0; + + /* Attempt to merge with the preceding chunk, if empty */ + cdp2 = LIST_NEXT(cdp, cd_all_le); + if (cdp2 != NULL && cdp2->cd_cur_size == 0) { + KASSERT(cdp2->cd_base + cdp2->cd_max_size == cdp->cd_base, + ("dxr: %s %d", __FUNCTION__, __LINE__)); + LIST_REMOVE(cdp, cd_all_le); + da->all_chunks_cnt--; + LIST_REMOVE(cdp2, cd_hash_le); + da->unused_chunks_cnt--; + cdp2->cd_max_size += cdp->cd_max_size; + uma_zfree(chunk_zone, cdp); + cdp = cdp2; } - do { + /* Attempt to merge with the subsequent chunk, if empty */ + cdp2 = LIST_PREV(cdp, &da->all_chunks, chunk_desc, cd_all_le); + if (cdp2 != NULL && cdp2->cd_cur_size == 0) { + KASSERT(cdp->cd_base + cdp->cd_max_size == cdp2->cd_base, + ("dxr: %s %d", __FUNCTION__, __LINE__)); + LIST_REMOVE(cdp, cd_all_le); + da->all_chunks_cnt--; + LIST_REMOVE(cdp2, cd_hash_le); + da->unused_chunks_cnt--; + cdp2->cd_max_size += cdp->cd_max_size; + cdp2->cd_base = cdp->cd_base; + uma_zfree(chunk_zone, cdp); + cdp = cdp2; + } + + if (cdp->cd_base + cdp->cd_max_size == da->rtbl_top) { + /* Free the chunk on the top of the range heap, trim the heap */ + KASSERT(cdp == LIST_FIRST(&da->all_chunks), + ("dxr: %s %d", __FUNCTION__, __LINE__)); da->all_chunks_cnt--; da->unused_chunks_cnt--; da->rtbl_top -= cdp->cd_max_size; LIST_REMOVE(cdp, cd_all_le); uma_zfree(chunk_zone, cdp); - LIST_FOREACH(cdp, &da->unused_chunks, cd_hash_le) - if (cdp->cd_base + cdp->cd_max_size == da->rtbl_top) { - LIST_REMOVE(cdp, cd_hash_le); - break; - } - } while (cdp != NULL); + return; + } + + LIST_INSERT_HEAD(&da->unused_chunks, cdp, cd_hash_le); } #ifdef DXR2 From owner-dev-commits-src-all@freebsd.org Mon Sep 20 05:26:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED247678658; Mon, 20 Sep 2021 05:26: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 4HCY1w63LYz3sL4; Mon, 20 Sep 2021 05:26: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 B05102AC4; Mon, 20 Sep 2021 05:26: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 18K5QC6H021731; Mon, 20 Sep 2021 05:26:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18K5QCtn021730; Mon, 20 Sep 2021 05:26:12 GMT (envelope-from git) Date: Mon, 20 Sep 2021 05:26:12 GMT Message-Id: <202109200526.18K5QCtn021730@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: 6f62e3a719bd - main - The linux rc.d script mounts several filesystems related to Linux ABI compatibility layer. When /compat is located on a ZFS other than /, mount would fail because they were not mounted. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6f62e3a719bdaba2a1ccdafe4e3a810217aea817 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 05:26:13 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=6f62e3a719bdaba2a1ccdafe4e3a810217aea817 commit 6f62e3a719bdaba2a1ccdafe4e3a810217aea817 Author: Xin LI AuthorDate: 2021-09-20 05:25:23 +0000 Commit: Xin LI CommitDate: 2021-09-20 05:25:26 +0000 The linux rc.d script mounts several filesystems related to Linux ABI compatibility layer. When /compat is located on a ZFS other than /, mount would fail because they were not mounted. Solve this by moving `linux` to depend on `zfs` which mounts all ZFS filesystems. Differential Revision: https://reviews.freebsd.org/D31848 MFC after: 2 weeks --- libexec/rc/rc.d/linux | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/linux b/libexec/rc/rc.d/linux index 23cb5acc6f99..fd3e3d902709 100755 --- a/libexec/rc/rc.d/linux +++ b/libexec/rc/rc.d/linux @@ -4,7 +4,7 @@ # # PROVIDE: linux -# REQUIRE: kldxref +# REQUIRE: kldxref zfs # KEYWORD: nojail . /etc/rc.subr From owner-dev-commits-src-all@freebsd.org Mon Sep 20 05:26:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B155678521; Mon, 20 Sep 2021 05:26: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 4HCY2M2YK3z3sVl; Mon, 20 Sep 2021 05:26: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 37D0828AE; Mon, 20 Sep 2021 05:26: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 18K5QZuB021870; Mon, 20 Sep 2021 05:26:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18K5QZOL021869; Mon, 20 Sep 2021 05:26:35 GMT (envelope-from git) Date: Mon, 20 Sep 2021 05:26:35 GMT Message-Id: <202109200526.18K5QZOL021869@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: 7ba7bf48d5bd - main - Update leap-seconds to leap-seconds.3676924800. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7ba7bf48d5bd6ca89f4e81579456b74ee7aa9e4f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 05:26:35 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=7ba7bf48d5bd6ca89f4e81579456b74ee7aa9e4f commit 7ba7bf48d5bd6ca89f4e81579456b74ee7aa9e4f Author: Xin LI AuthorDate: 2021-09-20 05:26:22 +0000 Commit: Xin LI CommitDate: 2021-09-20 05:26:22 +0000 Update leap-seconds to leap-seconds.3676924800. Obtained from: ftp://ftp.nist.gov/pub/time/leap-seconds.3676924800. MFC after: 3 days --- usr.sbin/ntp/ntpd/leap-seconds | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.sbin/ntp/ntpd/leap-seconds b/usr.sbin/ntp/ntpd/leap-seconds index e897a867e164..cfda3e885e64 100644 --- a/usr.sbin/ntp/ntpd/leap-seconds +++ b/usr.sbin/ntp/ntpd/leap-seconds @@ -204,10 +204,10 @@ # current -- the update time stamp, the data and the name of the file # will not change. # -# Updated through IERS Bulletin C60 -# File expires on: 28 June 2021 +# Updated through IERS Bulletin C62 +# File expires on: 28 June 2022 # -#@ 3833827200 +#@ 3865363200 # 2272060800 10 # 1 Jan 1972 2287785600 11 # 1 Jul 1972 @@ -252,4 +252,4 @@ # the hash line is also ignored in the # computation. # -#h 064356a8 39268b92 76e4d5ef 3e22fae1 0cca529c +#h 599d45bf accd4b4f 8b60e46 49b623 7d13b825 From owner-dev-commits-src-all@freebsd.org Mon Sep 20 07:39:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 21FF167A28E; Mon, 20 Sep 2021 07:39:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCbzM0Bytz3F2g; Mon, 20 Sep 2021 07:39:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBC4848EC; Mon, 20 Sep 2021 07:39: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 18K7dAKQ094420; Mon, 20 Sep 2021 07:39:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18K7dAPS094419; Mon, 20 Sep 2021 07:39:10 GMT (envelope-from git) Date: Mon, 20 Sep 2021 07:39:10 GMT Message-Id: <202109200739.18K7dAPS094419@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 9ac518adf03e - main - stress2: Update test to ensure propper cleanup of fifo files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9ac518adf03e371aa3e8499f84d995663bd4e0c1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 07:39:11 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=9ac518adf03e371aa3e8499f84d995663bd4e0c1 commit 9ac518adf03e371aa3e8499f84d995663bd4e0c1 Author: Peter Holm AuthorDate: 2021-09-20 07:36:27 +0000 Commit: Peter Holm CommitDate: 2021-09-20 07:36:27 +0000 stress2: Update test to ensure propper cleanup of fifo files --- tools/test/stress2/testcases/mkfifo/mkfifo.c | 67 +++++++++++----------------- 1 file changed, 25 insertions(+), 42 deletions(-) diff --git a/tools/test/stress2/testcases/mkfifo/mkfifo.c b/tools/test/stress2/testcases/mkfifo/mkfifo.c index caeb5e45310b..fd4a68b7e0f2 100644 --- a/tools/test/stress2/testcases/mkfifo/mkfifo.c +++ b/tools/test/stress2/testcases/mkfifo/mkfifo.c @@ -26,82 +26,63 @@ */ #include -#include #include -#include +#include + +#include #include -#include -#include #include -#include +#include +#include #include -#include +#include #include "stress.h" static char path[MAXPATHLEN+1]; -#define NB (1 * 1024 * 1024) - -static int bufsize; -static int freespace; - -static void -handler2(int i __unused) -{ - _exit(0); -} +static int bufsize, freespace; static void reader(void) { - int fd; - int i, n, *buf; + fd_set set; + struct timeval tv; + int *buf, fd, n; setproctitle("reader"); - signal(SIGALRM, handler2); - alarm(60); - if ((fd = open(path, O_RDWR, 0600)) < 0) { - unlink(path); + if ((fd = open(path, O_RDONLY | O_NONBLOCK)) < 0) err(1, "open(%s)", path); - } if ((buf = malloc(bufsize)) == NULL) err(1, "malloc(%d), %s:%d", bufsize, __FILE__, __LINE__); - for (i = 0; i < NB; i+= bufsize) { + n = 0; + FD_ZERO(&set); + FD_SET(fd, &set); + tv.tv_sec = 10; + tv.tv_usec = 0; + if (select(fd + 1, &set, NULL, NULL, &tv) == 1) { if ((n = read(fd, buf, bufsize)) < 0) err(1, "read(), %s:%d", __FILE__, __LINE__); - if (n == 0) break; } close(fd); free(buf); - return; } static void writer(void) { - int i, *buf; - int fd; - - signal(SIGALRM, handler2); - alarm(60); + int *buf, fd; setproctitle("writer"); - if ((fd = open(path, O_RDWR, 0600)) < 0) { + if ((fd = open(path, O_WRONLY)) < 0) { unlink(path); err(1, "open(%s)", path); } if ((buf = malloc(bufsize)) == NULL) err(1, "malloc(%d), %s:%d", bufsize, __FILE__, __LINE__); - for (i = 0; i < bufsize / (int)sizeof(int); i++) - buf[i] = i; - - for (i = 0; i < NB; i+= bufsize) { - if (write(fd, buf, bufsize) < 0) { - err(1, "write(%d), %s:%d", fd, - __FILE__, __LINE__); - } - } + memset(buf, 0, bufsize); + + if (write(fd, buf, bufsize) < 0) + err(1, "write(%d), %s:%d", fd, __FILE__, __LINE__); close(fd); free(buf); - return; } int @@ -134,6 +115,7 @@ setup(int nb) if (!freespace) _exit(0); bufsize = 2 << random_int(2, 12); + return (0); } @@ -179,5 +161,6 @@ test(void) err(1, "fork(), %s:%d", __FILE__, __LINE__); unlink(path); + return (0); } From owner-dev-commits-src-all@freebsd.org Mon Sep 20 08:50:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30A2A67B2E5; Mon, 20 Sep 2021 08:50:49 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCdZ00r9Fz3ndx; Mon, 20 Sep 2021 08:50:48 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-ed1-f45.google.com with SMTP id c21so58005327edj.0; Mon, 20 Sep 2021 01:50:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+DFwDS4jml9xq16eCBzFV9n/VrCkyr1oass1Wl+BCBs=; b=PFiZt+BN02VTTup7VN5MUr28A0ATUiRCxBucl9Dg3vQFsCU9CAX0K16v31a9O33TYN 26tlGmfxeU2fEQMt6UWbCZZEE7eX7gLzLtJVY7QwzJ7FXR0nEZb2az9IHx+/CLQ1Okf3 rVxFAEnIAjRvc2D/jmq1GkCPaBvO0XOYloyGvOQLtfk+yG5WIwRN+2M30dn9dllJg2th slbJqAWNZaYbAoQSR+Af59l4iRvt2IA23Tzl/72n7Oy7vssnMBktUUcOZabGTFEEHVmo xrixr5VXcBSl/4kWyjaBPqDXetgdAeXmca8ebW7AziBGaRcqA0+6hZXJfudtkYq1DYLg yCvg== X-Gm-Message-State: AOAM5329ClY9LVluyXf1S8AKxMGIRw5tEwlsHPg3iS9KXfThvN5QZrsd HgQ856f2ix9GFDVr0I0L2Jef6aiblA6Ulg== X-Google-Smtp-Source: ABdhPJy9oCSfe6bjQXgS6t0mVSrnFQ1EhdnMI2AB4hNKG5TILNwH74EwoCpOMCJvTWXfQo0GOWMHTg== X-Received: by 2002:a05:6402:3c2:: with SMTP id t2mr27391637edw.261.1632127839177; Mon, 20 Sep 2021 01:50:39 -0700 (PDT) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com. [209.85.221.48]) by smtp.gmail.com with ESMTPSA id n10sm5793315ejk.86.2021.09.20.01.50.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Sep 2021 01:50:38 -0700 (PDT) Received: by mail-wr1-f48.google.com with SMTP id u18so25742608wrg.5; Mon, 20 Sep 2021 01:50:38 -0700 (PDT) X-Received: by 2002:a5d:510b:: with SMTP id s11mr26374585wrt.79.1632127838471; Mon, 20 Sep 2021 01:50:38 -0700 (PDT) MIME-Version: 1.0 References: <202109060924.1869O2Dk045877@gitrepo.freebsd.org> <87sfy1rmj7.wl-herbert@gojira.at> In-Reply-To: <87sfy1rmj7.wl-herbert@gojira.at> From: Alexander Richardson Date: Mon, 20 Sep 2021 09:50:27 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 021385aba562 - main - Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain To: "Herbert J. Skuhra" Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4HCdZ00r9Fz3ndx X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of arichardsonkde@gmail.com designates 209.85.208.45 as permitted sender) smtp.mailfrom=arichardsonkde@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[209.85.208.45:from,209.85.221.48:received]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FORGED_SENDER(0.30)[arichardson@freebsd.org,arichardsonkde@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.208.45:from]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[arichardson@freebsd.org,arichardsonkde@gmail.com]; TAGGED_FROM(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 08:50:49 -0000 On Sun, 19 Sept 2021 at 09:37, Herbert J. Skuhra wrote: > > On Mon, 06 Sep 2021 11:24:02 +0200, Alex Richardson wrote: > > > > The branch main has been updated by arichardson: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=021385aba56279febcfdcc64d23673a0106ae45d > > > > commit 021385aba56279febcfdcc64d23673a0106ae45d > > Author: Alex Richardson > > AuthorDate: 2021-09-06 08:49:49 +0000 > > Commit: Alex Richardson > > CommitDate: 2021-09-06 08:49:49 +0000 > > > > Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain > > > > When WITH_LLVM_BINUTILS is set, we will install the LLVM binutils as > > ar/ranlib/nm/objcopy/etc. instead of the elftoolchain ones. > > Having the LLVM binutils instead of the elftoolchain ones allows us to use > > features such as LTO that depend on binutils that understand LLVM IR. > > Another benefit will be an improved user-experience when compiling with > > AddressSanitizer, since ASAN does not symbolize backtraces correctly if > > addr2line is elftoolchain addr2line instead of llvm-symbolizer. > > See https://lists.freebsd.org/archives/freebsd-toolchain/2021-July/000062.html > > for more details. > > > > This is currently off by default but will be turned on by default at some > > point in the near future. > > > > Reviewed By: emaste > > > > Differential Revision: https://reviews.freebsd.org/D31060 > > --- > > Makefile.inc1 | 4 +++- > > lib/Makefile | 5 ++++- > > lib/clang/Makefile | 4 +++- > > lib/clang/libllvm/Makefile | 6 +++--- > > share/mk/src.opts.mk | 8 ++++++++ > > tools/build/options/WITH_LLVM_BINUTILS | 2 ++ > > usr.bin/Makefile | 16 +++++++++++----- > > usr.bin/clang/Makefile | 13 +++++++++---- > > usr.bin/clang/llvm-ar/Makefile | 7 +++++++ > > usr.bin/clang/llvm-nm/Makefile | 7 +++++++ > > usr.bin/clang/llvm-objcopy/Makefile | 7 +++++++ > > usr.bin/clang/llvm-objdump/Makefile | 7 +++++++ > > usr.bin/clang/llvm-size/Makefile | 7 +++++++ > > usr.bin/clang/llvm-symbolizer/Makefile | 7 +++++++ > > 14 files changed, 85 insertions(+), 15 deletions(-) > > > > diff --git a/Makefile.inc1 b/Makefile.inc1 > > index b59c1913f8ce..478824675382 100644 > > --- a/Makefile.inc1 > > +++ b/Makefile.inc1 > > @@ -771,6 +771,7 @@ XMAKE= ${BMAKE} \ > > TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ > > MK_CLANG_IS_CC=${MK_CLANG_BOOTSTRAP} \ > > MK_LLDB=no \ > > + MK_LLVM_BINUTILS=no \ > > MK_TESTS=no > > > > # kernel-tools stage > > @@ -2339,9 +2340,10 @@ _gensnmptree= usr.sbin/bsnmpd/gensnmptree > > > > # We need to build tblgen when we're building clang or lld, either as > > # bootstrap tools, or as the part of the normal build. > > +# llvm-tblgen is also needed for various llvm binutils (e.g. objcopy). > > .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" || \ > > ${MK_LLD_BOOTSTRAP} != "no" || ${MK_LLD} != "no" || \ > > - ${MK_LLDB} != "no" > > + ${MK_LLDB} != "no" || ${MK_LLVM_BINUTILS} != "no" > > _clang_tblgen= \ > > lib/clang/libllvmminimal \ > > usr.bin/clang/llvm-tblgen > > diff --git a/lib/Makefile b/lib/Makefile > > index 674368a19ffd..1e375bb456e6 100644 > > --- a/lib/Makefile > > +++ b/lib/Makefile > > @@ -157,7 +157,10 @@ SUBDIR.${MK_BLUETOOTH}+=libbluetooth libsdp > > SUBDIR.${MK_BSNMP}+= libbsnmp > > > > .if !defined(COMPAT_32BIT) && !defined(COMPAT_SOFTFP) > > -SUBDIR.${MK_CLANG}+= clang > > +.if ${MK_CLANG} != "no" || ${MK_LLD} != "no" || \ > > + ${MK_LLDB} != "no" || ${MK_LLVM_BINUTILS} != "no" > > +SUBDIR+= clang > > +.endif > > .endif > > > > SUBDIR.${MK_CUSE}+= libcuse > > diff --git a/lib/clang/Makefile b/lib/clang/Makefile > > index bc09ea62dc67..df4aa01a2653 100644 > > --- a/lib/clang/Makefile > > +++ b/lib/clang/Makefile > > @@ -4,10 +4,12 @@ > > > > # These have to be built in order. > > SUBDIR= libllvm > > +.if ${MK_CLANG} != "no" > > SUBDIR+= libclang > > +SUBDIR+= headers > > +.endif > > .if ${MK_LLDB} != "no" > > SUBDIR+= liblldb > > .endif > > -SUBDIR+= headers > > > > .include > > diff --git a/lib/clang/libllvm/Makefile b/lib/clang/libllvm/Makefile > > index 09d6336c01d9..7eaedf65dcb3 100644 > > --- a/lib/clang/libllvm/Makefile > > +++ b/lib/clang/libllvm/Makefile > > @@ -830,7 +830,7 @@ SRCS_MIN+= Object/IRObjectFile.cpp > > SRCS_MIN+= Object/IRSymtab.cpp > > SRCS_MIN+= Object/MachOObjectFile.cpp > > SRCS_MIW+= Object/MachOUniversal.cpp > > -SRCS_EXT+= Object/MachOUniversalWriter.cpp > > +SRCS_MIW+= Object/MachOUniversalWriter.cpp > > SRCS_MIW+= Object/Minidump.cpp > > SRCS_MIN+= Object/ModuleSymbolTable.cpp > > SRCS_EXT+= Object/Object.cpp > > @@ -920,7 +920,7 @@ SRCS_MIN+= Support/Errno.cpp > > SRCS_MIN+= Support/Error.cpp > > SRCS_MIN+= Support/ErrorHandling.cpp > > SRCS_MIN+= Support/FileCollector.cpp > > -SRCS_EXL+= Support/FileOutputBuffer.cpp > > +SRCS_MIW+= Support/FileOutputBuffer.cpp > > SRCS_MIN+= Support/FileUtilities.cpp > > SRCS_MIN+= Support/FoldingSet.cpp > > SRCS_MIN+= Support/FormatVariadic.cpp > > @@ -945,7 +945,7 @@ SRCS_MIN+= Support/MD5.cpp > > SRCS_MIN+= Support/ManagedStatic.cpp > > SRCS_MIN+= Support/MathExtras.cpp > > SRCS_MIN+= Support/MemAlloc.cpp > > -SRCS_XDL+= Support/Memory.cpp > > +SRCS_MIW+= Support/Memory.cpp > > SRCS_MIN+= Support/MemoryBuffer.cpp > > SRCS_MIN+= Support/MemoryBufferRef.cpp > > SRCS_MIN+= Support/NativeFormatting.cpp > > diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk > > index 32346e31a752..5363cb6e78f9 100644 > > --- a/share/mk/src.opts.mk > > +++ b/share/mk/src.opts.mk > > @@ -203,6 +203,7 @@ __DEFAULT_NO_OPTIONS = \ > > LOADER_FIREWIRE \ > > LOADER_VERBOSE \ > > LOADER_VERIEXEC_PASS_MANIFEST \ > > + LLVM_BINUTILS \ > > MALLOC_PRODUCTION \ > > OFED_EXTRA \ > > OPENLDAP \ > > @@ -459,6 +460,7 @@ MK_CLANG:= no > > MK_INCLUDES:= no > > MK_LLD:= no > > MK_LLDB:= no > > +MK_LLVM_BINUTILS:= no > > .endif > > > > .if ${MK_CLANG} == "no" > > @@ -468,6 +470,12 @@ MK_CLANG_FULL:= no > > MK_LLVM_COV:= no > > .endif > > > > +.if ${MK_LLVM_BINUTILS} == "yes" > > +# MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be > > +# enabled if MK_LLVM_BINUTILS is set. > > +MK_LLVM_CXXFILT:= yes > > +.endif > > + > > .if ${MK_LOADER_VERIEXEC} == "no" > > MK_LOADER_VERIEXEC_PASS_MANIFEST := no > > .endif > > diff --git a/tools/build/options/WITH_LLVM_BINUTILS b/tools/build/options/WITH_LLVM_BINUTILS > > new file mode 100644 > > index 000000000000..8fa2c55f31a9 > > --- /dev/null > > +++ b/tools/build/options/WITH_LLVM_BINUTILS > > @@ -0,0 +1,2 @@ > > +.\" $FreeBSD$ > > +Install LLVM's binutils (ar, addr2line, nm, etc.) instead of ELF Tool Chain's. > > diff --git a/usr.bin/Makefile b/usr.bin/Makefile > > index f1b07a7007be..e8be161db01a 100644 > > --- a/usr.bin/Makefile > > +++ b/usr.bin/Makefile > > @@ -195,7 +195,10 @@ SUBDIR.${MK_ATM}+= atm > > SUBDIR.${MK_BLUETOOTH}+= bluetooth > > SUBDIR.${MK_BSD_CPIO}+= cpio > > SUBDIR.${MK_CALENDAR}+= calendar > > -SUBDIR.${MK_CLANG}+= clang > > +.if ${MK_CLANG} != "no" || ${MK_LLVM_BINUTILS} != "no" || \ > > + ${MK_LLD} != "no" || ${MK_LLDB} != "no" > > +SUBDIR+= clang > > +.endif > > SUBDIR.${MK_DIALOG}+= dpv > > SUBDIR.${MK_EE}+= ee > > SUBDIR.${MK_FILE}+= file > > @@ -251,25 +254,28 @@ SUBDIR.${MK_TESTS_SUPPORT}.${MK_CXX}+= kyua > > SUBDIR.${MK_TESTS}+= tests > > SUBDIR.${MK_TEXTPROC}+= ul > > SUBDIR.${MK_TFTP}+= tftp > > +.if ${MK_LLVM_BINUTILS} == "no" > > +# Only build the elftoolchain tools if we aren't using the LLVM ones. > > SUBDIR.${MK_TOOLCHAIN}+= addr2line > > SUBDIR.${MK_TOOLCHAIN}+= ar > > +SUBDIR.${MK_TOOLCHAIN}+= nm > > +SUBDIR.${MK_TOOLCHAIN}+= objcopy > > +SUBDIR.${MK_TOOLCHAIN}+= readelf > > +SUBDIR.${MK_TOOLCHAIN}+= size > > +.endif > > SUBDIR.${MK_TOOLCHAIN}+= c89 > > SUBDIR.${MK_TOOLCHAIN}+= c99 > > SUBDIR.${MK_TOOLCHAIN}+= ctags > > .if ${MK_LLVM_CXXFILT} == "no" > > SUBDIR.${MK_TOOLCHAIN}+= cxxfilt > > .endif > > -SUBDIR.${MK_TOOLCHAIN}+= objcopy > > SUBDIR.${MK_TOOLCHAIN}+= file2c > > SUBDIR.${MK_TOOLCHAIN}+= gprof > > SUBDIR.${MK_TOOLCHAIN}+= indent > > SUBDIR.${MK_TOOLCHAIN}+= lex > > SUBDIR.${MK_TOOLCHAIN}+= mkstr > > -SUBDIR.${MK_TOOLCHAIN}+= nm > > -SUBDIR.${MK_TOOLCHAIN}+= readelf > > SUBDIR.${MK_TOOLCHAIN}+= rpcgen > > SUBDIR.${MK_TOOLCHAIN}+= unifdef > > -SUBDIR.${MK_TOOLCHAIN}+= size > > SUBDIR.${MK_TOOLCHAIN}+= xstr > > SUBDIR.${MK_TOOLCHAIN}+= yacc > > SUBDIR.${MK_VI}+= vi > > diff --git a/usr.bin/clang/Makefile b/usr.bin/clang/Makefile > > index 1c53e94965f7..7fc31e8df194 100644 > > --- a/usr.bin/clang/Makefile > > +++ b/usr.bin/clang/Makefile > > @@ -7,12 +7,20 @@ SUBDIR+= clang > > .endif > > > > .if !defined(TOOLS_PREFIX) > > +# LLVM binutils are needed to support features such as LTO, so we build them > > +# by default if clang is enabled. If MK_LLVM_BINUTILS is set, we also use them > > +# as the default binutils (ar,nm,addr2line, etc.). > > +.if ${MK_CLANG} != "no" || ${MK_LLVM_BINUTILS} != "no" > > SUBDIR+= llvm-ar > > SUBDIR+= llvm-nm > > +SUBDIR+= llvm-objcopy > > SUBDIR+= llvm-objdump > > +SUBDIR+= llvm-size > > +SUBDIR+= llvm-strings > > SUBDIR+= llvm-symbolizer > > +.endif > > Update tools/build/mk/OptionalObsoleteFiles.inc? > > # make delete-old > >>> Removing old files (only deletes safe to delete libs) > remove /usr/bin/llvm-objcopy? n > remove /usr/bin/llvm-size? n > remove /usr/bin/llvm-strings? n > remove /usr/share/man/man1/llvm-objcopy.1.gz? n > remove /usr/share/man/man1/llvm-size.1.gz? n > remove /usr/share/man/man1/llvm-strings.1.gz? n > > -- > Herbert Hi Herbert, Sorry about that, I've posted https://reviews.freebsd.org/D32022 which should hopefully fix the issue? Thanks, Alex From owner-dev-commits-src-all@freebsd.org Mon Sep 20 09:01:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7063C67B6B5; Mon, 20 Sep 2021 09:01: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 4HCdp92mVNz3q7Y; Mon, 20 Sep 2021 09:01: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 3F1625964; Mon, 20 Sep 2021 09:01: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 18K91LTH014189; Mon, 20 Sep 2021 09:01:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18K91LjC014188; Mon, 20 Sep 2021 09:01:21 GMT (envelope-from git) Date: Mon, 20 Sep 2021 09:01:21 GMT Message-Id: <202109200901.18K91LjC014188@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: b831f9ce7079 - main - if_mvneta: Build the driver as a kernel module MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b831f9ce7079b040b5f319b9c0f60daba4c6151a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 09:01:21 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=b831f9ce7079b040b5f319b9c0f60daba4c6151a commit b831f9ce7079b040b5f319b9c0f60daba4c6151a Author: Hubert Mazur AuthorDate: 2021-09-13 09:44:31 +0000 Commit: Wojciech Macek CommitDate: 2021-09-20 08:58:58 +0000 if_mvneta: Build the driver as a kernel module Fix device detach and attach routine. Add required Makefile to build as a module. Remove entry from GENERIC, since now it can be loaded automatically. Tested on EspressoBin. Obtained from: Semihalf Reviewed by: manu Differential revision: https://reviews.freebsd.org/D31581 --- sys/dev/neta/if_mvneta.c | 81 +++++++++++++++++++++++++++-------------------- sys/modules/Makefile | 2 ++ sys/modules/neta/Makefile | 10 ++++++ 3 files changed, 59 insertions(+), 34 deletions(-) diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c index debb4a922cbc..71552bf2c515 100644 --- a/sys/dev/neta/if_mvneta.c +++ b/sys/dev/neta/if_mvneta.c @@ -222,6 +222,11 @@ static device_method_t mvneta_methods[] = { DEVMETHOD_END }; +static struct ofw_compat_data compat_data[] = { + { "marvell,armada-3700-neta", true }, + { NULL, false } +}; + DEFINE_CLASS_0(mvneta, mvneta_driver, mvneta_methods, sizeof(struct mvneta_softc)); DRIVER_MODULE(miibus, mvneta, miibus_driver, miibus_devclass, 0, 0); @@ -229,7 +234,7 @@ DRIVER_MODULE(mdio, mvneta, mdio_driver, mdio_devclass, 0, 0); MODULE_DEPEND(mvneta, mdio, 1, 1, 1); MODULE_DEPEND(mvneta, ether, 1, 1, 1); MODULE_DEPEND(mvneta, miibus, 1, 1, 1); -MODULE_DEPEND(mvneta, mvxpbm, 1, 1, 1); +SIMPLEBUS_PNP_INFO(compat_data); /* * List of MIB register and names @@ -609,6 +614,16 @@ mvneta_attach(device_t self) } #endif + error = bus_setup_intr(self, sc->res[1], + INTR_TYPE_NET | INTR_MPSAFE, NULL, mvneta_intrs[0].handler, sc, + &sc->ih_cookie[0]); + if (error) { + device_printf(self, "could not setup %s\n", + mvneta_intrs[0].description); + mvneta_detach(self); + return (error); + } + /* * MAC address */ @@ -704,8 +719,6 @@ mvneta_attach(device_t self) } } - ether_ifattach(ifp, sc->enaddr); - /* * Enable DMA engines and Initialize Device Registers. */ @@ -835,20 +848,11 @@ mvneta_attach(device_t self) mvneta_update_media(sc, ifm_target); } - sysctl_mvneta_init(sc); + ether_ifattach(ifp, sc->enaddr); callout_reset(&sc->tick_ch, 0, mvneta_tick, sc); - error = bus_setup_intr(self, sc->res[1], - INTR_TYPE_NET | INTR_MPSAFE, NULL, mvneta_intrs[0].handler, sc, - &sc->ih_cookie[0]); - if (error) { - device_printf(self, "could not setup %s\n", - mvneta_intrs[0].description); - ether_ifdetach(sc->ifp); - mvneta_detach(self); - return (error); - } + sysctl_mvneta_init(sc); return (0); } @@ -857,20 +861,28 @@ STATIC int mvneta_detach(device_t dev) { struct mvneta_softc *sc; + struct ifnet *ifp; int q; sc = device_get_softc(dev); + ifp = sc->ifp; - mvneta_stop(sc); - /* Detach network interface */ - if (sc->ifp) - if_free(sc->ifp); + if (device_is_attached(dev)) { + mvneta_stop(sc); + callout_drain(&sc->tick_ch); + ether_ifdetach(sc->ifp); + } for (q = 0; q < MVNETA_RX_QNUM_MAX; q++) mvneta_ring_dealloc_rx_queue(sc, q); for (q = 0; q < MVNETA_TX_QNUM_MAX; q++) mvneta_ring_dealloc_tx_queue(sc, q); + device_delete_children(dev); + + if (sc->ih_cookie[0] != NULL) + bus_teardown_intr(dev, sc->res[1], sc->ih_cookie[0]); + if (sc->tx_dtag != NULL) bus_dma_tag_destroy(sc->tx_dtag); if (sc->rx_dtag != NULL) @@ -881,6 +893,13 @@ mvneta_detach(device_t dev) bus_dma_tag_destroy(sc->rxbuf_dtag); bus_release_resources(dev, res_spec, sc->res); + + if (sc->ifp) + if_free(sc->ifp); + + if (mtx_initialized(&sc->mtx)) + mtx_destroy(&sc->mtx); + return (0); } @@ -1254,6 +1273,9 @@ mvneta_ring_alloc_rx_queue(struct mvneta_softc *sc, int q) return (0); fail: + mvneta_rx_lockq(sc, q); + mvneta_ring_flush_rx_queue(sc, q); + mvneta_rx_unlockq(sc, q); mvneta_ring_dealloc_rx_queue(sc, q); device_printf(sc->dev, "DMA Ring buffer allocation failure.\n"); return (error); @@ -1295,6 +1317,9 @@ mvneta_ring_alloc_tx_queue(struct mvneta_softc *sc, int q) return (0); fail: + mvneta_tx_lockq(sc, q); + mvneta_ring_flush_tx_queue(sc, q); + mvneta_tx_unlockq(sc, q); mvneta_ring_dealloc_tx_queue(sc, q); device_printf(sc->dev, "DMA Ring buffer allocation failure.\n"); return (error); @@ -1324,16 +1349,6 @@ mvneta_ring_dealloc_tx_queue(struct mvneta_softc *sc, int q) #endif if (sc->txmbuf_dtag != NULL) { - if (mtx_name(&tx->ring_mtx) != NULL) { - /* - * It is assumed that maps are being loaded after mutex - * is initialized. Therefore we can skip unloading maps - * when mutex is empty. - */ - mvneta_tx_lockq(sc, q); - mvneta_ring_flush_tx_queue(sc, q); - mvneta_tx_unlockq(sc, q); - } for (i = 0; i < MVNETA_TX_RING_CNT; i++) { txbuf = &tx->txbuf[i]; if (txbuf->dmap != NULL) { @@ -1372,8 +1387,6 @@ mvneta_ring_dealloc_rx_queue(struct mvneta_softc *sc, int q) rx = MVNETA_RX_RING(sc, q); - mvneta_ring_flush_rx_queue(sc, q); - if (rx->desc_pa != 0) bus_dmamap_unload(sc->rx_dtag, rx->desc_map); @@ -2574,8 +2587,8 @@ mvneta_link_isr(struct mvneta_softc *sc) mvneta_linkdown(sc); #ifdef DEBUG - log(LOG_DEBUG, - "%s: link %s\n", device_xname(sc->dev), linkup ? "up" : "down"); + device_printf(sc->dev, + "%s: link %s\n", sc->ifp->if_xname, linkup ? "up" : "down"); #endif } @@ -2591,8 +2604,8 @@ mvneta_linkupdate(struct mvneta_softc *sc, boolean_t linkup) mvneta_linkdown(sc); #ifdef DEBUG - log(LOG_DEBUG, - "%s: link %s\n", device_xname(sc->dev), linkup ? "up" : "down"); + device_printf(sc->dev, + "%s: link %s\n", sc->ifp->if_xname, linkup ? "up" : "down"); #endif } diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 7ed2169445e4..b1063ad003d8 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -264,6 +264,7 @@ SUBDIR= \ mxge \ my \ ${_nctgpio} \ + ${_neta} \ ${_netgraph} \ ${_nfe} \ nfscl \ @@ -626,6 +627,7 @@ _rockchip= rockchip .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" _sdhci_fdt= sdhci_fdt _e6000sw= e6000sw +_neta= neta .endif .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" diff --git a/sys/modules/neta/Makefile b/sys/modules/neta/Makefile new file mode 100644 index 000000000000..8845e181efaa --- /dev/null +++ b/sys/modules/neta/Makefile @@ -0,0 +1,10 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/neta + +CFLAGS+= -DFDT + +KMOD= if_mvneta +SRCS= if_mvneta.c if_mvneta_fdt.c if_mvnetavar.h +SRCS+= bus_if.h device_if.h mdio_if.h miibus_if.h ofw_bus_if.h opt_platform.h +.include From owner-dev-commits-src-all@freebsd.org Mon Sep 20 09:43:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFAB267C1C9; Mon, 20 Sep 2021 09:43:11 +0000 (UTC) (envelope-from herbert@gojira.at) Received: from mail.bsd4all.net (mail.bsd4all.net [IPv6:2a01:4f8:13b:240c::25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail.bsd4all.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCfkR3skWz4VxH; Mon, 20 Sep 2021 09:43:11 +0000 (UTC) (envelope-from herbert@gojira.at) Date: Mon, 20 Sep 2021 11:43:03 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=gojira.at; s=mail202005; t=1632130983; bh=OwzbF0KvrUn8IzhPgS8ZLtf6mjppjUv+YHpfSxRC/zQ=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type; b=SsCroeUs4r7al4ezv7NOltO3vPLOlnOEQk+CKLHfc0QIdjzw1SdlxFn5ejxKcSCT4 92nC98aCrunFeXUToTzqFtbP6fWBU5vtRJ0wD8L2m0zIhUHEWSC2nCO7Y5JTOlDIwf xr1fAhWLJp3MVHmwK1aVSt6HeEy1b1C7Xn51O0F7HxFLw5PAFh/M7pHJ/QYbStiEyV LRxkoeOrEkW5anmeQ9cL9AbCmANmxRaV9IVsEYePJMkLG4tmHALfhL2fPlsdTJbag8 1aZOmRNOjJd4+CHf9L7/gbXWVoAX+DRUdsw4FXGfh9Szp/TJbk+M/0s/H8o69h3D10 5xZWpF3dtJBFw== From: "Herbert J. Skuhra" To: Alexander Richardson Cc: src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 021385aba562 - main - Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain Message-ID: References: <202109060924.1869O2Dk045877@gitrepo.freebsd.org> <87sfy1rmj7.wl-herbert@gojira.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4HCfkR3skWz4VxH X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 09:43:11 -0000 On Mon, Sep 20, 2021 at 09:50:27AM +0100, Alexander Richardson wrote: > On Sun, 19 Sept 2021 at 09:37, Herbert J. Skuhra wrote: > > > > On Mon, 06 Sep 2021 11:24:02 +0200, Alex Richardson wrote: > > > > > > The branch main has been updated by arichardson: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=021385aba56279febcfdcc64d23673a0106ae45d > > > > > > commit 021385aba56279febcfdcc64d23673a0106ae45d > > > Author: Alex Richardson > > > AuthorDate: 2021-09-06 08:49:49 +0000 > > > Commit: Alex Richardson > > > CommitDate: 2021-09-06 08:49:49 +0000 > > > > > > Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain > > > > > > When WITH_LLVM_BINUTILS is set, we will install the LLVM binutils as > > > ar/ranlib/nm/objcopy/etc. instead of the elftoolchain ones. > > > Having the LLVM binutils instead of the elftoolchain ones allows us to use > > > features such as LTO that depend on binutils that understand LLVM IR. > > > Another benefit will be an improved user-experience when compiling with > > > AddressSanitizer, since ASAN does not symbolize backtraces correctly if > > > addr2line is elftoolchain addr2line instead of llvm-symbolizer. > > > See https://lists.freebsd.org/archives/freebsd-toolchain/2021-July/000062.html > > > for more details. > > > > > > This is currently off by default but will be turned on by default at some > > > point in the near future. > > > > > > Reviewed By: emaste > > > > > > Differential Revision: https://reviews.freebsd.org/D31060 > > > --- > > > Makefile.inc1 | 4 +++- > > > lib/Makefile | 5 ++++- > > > lib/clang/Makefile | 4 +++- > > > lib/clang/libllvm/Makefile | 6 +++--- > > > share/mk/src.opts.mk | 8 ++++++++ > > > tools/build/options/WITH_LLVM_BINUTILS | 2 ++ > > > usr.bin/Makefile | 16 +++++++++++----- > > > usr.bin/clang/Makefile | 13 +++++++++---- > > > usr.bin/clang/llvm-ar/Makefile | 7 +++++++ > > > usr.bin/clang/llvm-nm/Makefile | 7 +++++++ > > > usr.bin/clang/llvm-objcopy/Makefile | 7 +++++++ > > > usr.bin/clang/llvm-objdump/Makefile | 7 +++++++ > > > usr.bin/clang/llvm-size/Makefile | 7 +++++++ > > > usr.bin/clang/llvm-symbolizer/Makefile | 7 +++++++ > > > 14 files changed, 85 insertions(+), 15 deletions(-) > > > > > > diff --git a/Makefile.inc1 b/Makefile.inc1 > > > index b59c1913f8ce..478824675382 100644 > > > --- a/Makefile.inc1 > > > +++ b/Makefile.inc1 > > > @@ -771,6 +771,7 @@ XMAKE= ${BMAKE} \ > > > TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ > > > MK_CLANG_IS_CC=${MK_CLANG_BOOTSTRAP} \ > > > MK_LLDB=no \ > > > + MK_LLVM_BINUTILS=no \ > > > MK_TESTS=no > > > > > > # kernel-tools stage > > > @@ -2339,9 +2340,10 @@ _gensnmptree= usr.sbin/bsnmpd/gensnmptree > > > > > > # We need to build tblgen when we're building clang or lld, either as > > > # bootstrap tools, or as the part of the normal build. > > > +# llvm-tblgen is also needed for various llvm binutils (e.g. objcopy). > > > .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" || \ > > > ${MK_LLD_BOOTSTRAP} != "no" || ${MK_LLD} != "no" || \ > > > - ${MK_LLDB} != "no" > > > + ${MK_LLDB} != "no" || ${MK_LLVM_BINUTILS} != "no" > > > _clang_tblgen= \ > > > lib/clang/libllvmminimal \ > > > usr.bin/clang/llvm-tblgen > > > diff --git a/lib/Makefile b/lib/Makefile > > > index 674368a19ffd..1e375bb456e6 100644 > > > --- a/lib/Makefile > > > +++ b/lib/Makefile > > > @@ -157,7 +157,10 @@ SUBDIR.${MK_BLUETOOTH}+=libbluetooth libsdp > > > SUBDIR.${MK_BSNMP}+= libbsnmp > > > > > > .if !defined(COMPAT_32BIT) && !defined(COMPAT_SOFTFP) > > > -SUBDIR.${MK_CLANG}+= clang > > > +.if ${MK_CLANG} != "no" || ${MK_LLD} != "no" || \ > > > + ${MK_LLDB} != "no" || ${MK_LLVM_BINUTILS} != "no" > > > +SUBDIR+= clang > > > +.endif > > > .endif > > > > > > SUBDIR.${MK_CUSE}+= libcuse > > > diff --git a/lib/clang/Makefile b/lib/clang/Makefile > > > index bc09ea62dc67..df4aa01a2653 100644 > > > --- a/lib/clang/Makefile > > > +++ b/lib/clang/Makefile > > > @@ -4,10 +4,12 @@ > > > > > > # These have to be built in order. > > > SUBDIR= libllvm > > > +.if ${MK_CLANG} != "no" > > > SUBDIR+= libclang > > > +SUBDIR+= headers > > > +.endif > > > .if ${MK_LLDB} != "no" > > > SUBDIR+= liblldb > > > .endif > > > -SUBDIR+= headers > > > > > > .include > > > diff --git a/lib/clang/libllvm/Makefile b/lib/clang/libllvm/Makefile > > > index 09d6336c01d9..7eaedf65dcb3 100644 > > > --- a/lib/clang/libllvm/Makefile > > > +++ b/lib/clang/libllvm/Makefile > > > @@ -830,7 +830,7 @@ SRCS_MIN+= Object/IRObjectFile.cpp > > > SRCS_MIN+= Object/IRSymtab.cpp > > > SRCS_MIN+= Object/MachOObjectFile.cpp > > > SRCS_MIW+= Object/MachOUniversal.cpp > > > -SRCS_EXT+= Object/MachOUniversalWriter.cpp > > > +SRCS_MIW+= Object/MachOUniversalWriter.cpp > > > SRCS_MIW+= Object/Minidump.cpp > > > SRCS_MIN+= Object/ModuleSymbolTable.cpp > > > SRCS_EXT+= Object/Object.cpp > > > @@ -920,7 +920,7 @@ SRCS_MIN+= Support/Errno.cpp > > > SRCS_MIN+= Support/Error.cpp > > > SRCS_MIN+= Support/ErrorHandling.cpp > > > SRCS_MIN+= Support/FileCollector.cpp > > > -SRCS_EXL+= Support/FileOutputBuffer.cpp > > > +SRCS_MIW+= Support/FileOutputBuffer.cpp > > > SRCS_MIN+= Support/FileUtilities.cpp > > > SRCS_MIN+= Support/FoldingSet.cpp > > > SRCS_MIN+= Support/FormatVariadic.cpp > > > @@ -945,7 +945,7 @@ SRCS_MIN+= Support/MD5.cpp > > > SRCS_MIN+= Support/ManagedStatic.cpp > > > SRCS_MIN+= Support/MathExtras.cpp > > > SRCS_MIN+= Support/MemAlloc.cpp > > > -SRCS_XDL+= Support/Memory.cpp > > > +SRCS_MIW+= Support/Memory.cpp > > > SRCS_MIN+= Support/MemoryBuffer.cpp > > > SRCS_MIN+= Support/MemoryBufferRef.cpp > > > SRCS_MIN+= Support/NativeFormatting.cpp > > > diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk > > > index 32346e31a752..5363cb6e78f9 100644 > > > --- a/share/mk/src.opts.mk > > > +++ b/share/mk/src.opts.mk > > > @@ -203,6 +203,7 @@ __DEFAULT_NO_OPTIONS = \ > > > LOADER_FIREWIRE \ > > > LOADER_VERBOSE \ > > > LOADER_VERIEXEC_PASS_MANIFEST \ > > > + LLVM_BINUTILS \ > > > MALLOC_PRODUCTION \ > > > OFED_EXTRA \ > > > OPENLDAP \ > > > @@ -459,6 +460,7 @@ MK_CLANG:= no > > > MK_INCLUDES:= no > > > MK_LLD:= no > > > MK_LLDB:= no > > > +MK_LLVM_BINUTILS:= no > > > .endif > > > > > > .if ${MK_CLANG} == "no" > > > @@ -468,6 +470,12 @@ MK_CLANG_FULL:= no > > > MK_LLVM_COV:= no > > > .endif > > > > > > +.if ${MK_LLVM_BINUTILS} == "yes" > > > +# MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be > > > +# enabled if MK_LLVM_BINUTILS is set. > > > +MK_LLVM_CXXFILT:= yes > > > +.endif > > > + > > > .if ${MK_LOADER_VERIEXEC} == "no" > > > MK_LOADER_VERIEXEC_PASS_MANIFEST := no > > > .endif > > > diff --git a/tools/build/options/WITH_LLVM_BINUTILS b/tools/build/options/WITH_LLVM_BINUTILS > > > new file mode 100644 > > > index 000000000000..8fa2c55f31a9 > > > --- /dev/null > > > +++ b/tools/build/options/WITH_LLVM_BINUTILS > > > @@ -0,0 +1,2 @@ > > > +.\" $FreeBSD$ > > > +Install LLVM's binutils (ar, addr2line, nm, etc.) instead of ELF Tool Chain's. > > > diff --git a/usr.bin/Makefile b/usr.bin/Makefile > > > index f1b07a7007be..e8be161db01a 100644 > > > --- a/usr.bin/Makefile > > > +++ b/usr.bin/Makefile > > > @@ -195,7 +195,10 @@ SUBDIR.${MK_ATM}+= atm > > > SUBDIR.${MK_BLUETOOTH}+= bluetooth > > > SUBDIR.${MK_BSD_CPIO}+= cpio > > > SUBDIR.${MK_CALENDAR}+= calendar > > > -SUBDIR.${MK_CLANG}+= clang > > > +.if ${MK_CLANG} != "no" || ${MK_LLVM_BINUTILS} != "no" || \ > > > + ${MK_LLD} != "no" || ${MK_LLDB} != "no" > > > +SUBDIR+= clang > > > +.endif > > > SUBDIR.${MK_DIALOG}+= dpv > > > SUBDIR.${MK_EE}+= ee > > > SUBDIR.${MK_FILE}+= file > > > @@ -251,25 +254,28 @@ SUBDIR.${MK_TESTS_SUPPORT}.${MK_CXX}+= kyua > > > SUBDIR.${MK_TESTS}+= tests > > > SUBDIR.${MK_TEXTPROC}+= ul > > > SUBDIR.${MK_TFTP}+= tftp > > > +.if ${MK_LLVM_BINUTILS} == "no" > > > +# Only build the elftoolchain tools if we aren't using the LLVM ones. > > > SUBDIR.${MK_TOOLCHAIN}+= addr2line > > > SUBDIR.${MK_TOOLCHAIN}+= ar > > > +SUBDIR.${MK_TOOLCHAIN}+= nm > > > +SUBDIR.${MK_TOOLCHAIN}+= objcopy > > > +SUBDIR.${MK_TOOLCHAIN}+= readelf > > > +SUBDIR.${MK_TOOLCHAIN}+= size > > > +.endif > > > SUBDIR.${MK_TOOLCHAIN}+= c89 > > > SUBDIR.${MK_TOOLCHAIN}+= c99 > > > SUBDIR.${MK_TOOLCHAIN}+= ctags > > > .if ${MK_LLVM_CXXFILT} == "no" > > > SUBDIR.${MK_TOOLCHAIN}+= cxxfilt > > > .endif > > > -SUBDIR.${MK_TOOLCHAIN}+= objcopy > > > SUBDIR.${MK_TOOLCHAIN}+= file2c > > > SUBDIR.${MK_TOOLCHAIN}+= gprof > > > SUBDIR.${MK_TOOLCHAIN}+= indent > > > SUBDIR.${MK_TOOLCHAIN}+= lex > > > SUBDIR.${MK_TOOLCHAIN}+= mkstr > > > -SUBDIR.${MK_TOOLCHAIN}+= nm > > > -SUBDIR.${MK_TOOLCHAIN}+= readelf > > > SUBDIR.${MK_TOOLCHAIN}+= rpcgen > > > SUBDIR.${MK_TOOLCHAIN}+= unifdef > > > -SUBDIR.${MK_TOOLCHAIN}+= size > > > SUBDIR.${MK_TOOLCHAIN}+= xstr > > > SUBDIR.${MK_TOOLCHAIN}+= yacc > > > SUBDIR.${MK_VI}+= vi > > > diff --git a/usr.bin/clang/Makefile b/usr.bin/clang/Makefile > > > index 1c53e94965f7..7fc31e8df194 100644 > > > --- a/usr.bin/clang/Makefile > > > +++ b/usr.bin/clang/Makefile > > > @@ -7,12 +7,20 @@ SUBDIR+= clang > > > .endif > > > > > > .if !defined(TOOLS_PREFIX) > > > +# LLVM binutils are needed to support features such as LTO, so we build them > > > +# by default if clang is enabled. If MK_LLVM_BINUTILS is set, we also use them > > > +# as the default binutils (ar,nm,addr2line, etc.). > > > +.if ${MK_CLANG} != "no" || ${MK_LLVM_BINUTILS} != "no" > > > SUBDIR+= llvm-ar > > > SUBDIR+= llvm-nm > > > +SUBDIR+= llvm-objcopy > > > SUBDIR+= llvm-objdump > > > +SUBDIR+= llvm-size > > > +SUBDIR+= llvm-strings > > > SUBDIR+= llvm-symbolizer > > > +.endif > > > > Update tools/build/mk/OptionalObsoleteFiles.inc? > > > > # make delete-old > > >>> Removing old files (only deletes safe to delete libs) > > remove /usr/bin/llvm-objcopy? n > > remove /usr/bin/llvm-size? n > > remove /usr/bin/llvm-strings? n > > remove /usr/share/man/man1/llvm-objcopy.1.gz? n > > remove /usr/share/man/man1/llvm-size.1.gz? n > > remove /usr/share/man/man1/llvm-strings.1.gz? n > > > > -- > > Herbert > > Hi Herbert, > > Sorry about that, I've posted https://reviews.freebsd.org/D32022 which > should hopefully fix the issue? Thanks. 'make delete-old' still prompts to delete the man pages: >>> Removing old files (only deletes safe to delete libs) remove /usr/share/man/man1/llvm-objcopy.1.gz? n remove /usr/share/man/man1/llvm-size.1.gz? n remove /usr/share/man/man1/llvm-strings.1.gz? n -- Herbert From owner-dev-commits-src-all@freebsd.org Mon Sep 20 10:58:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C18E867CF02; Mon, 20 Sep 2021 10:58:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HChPC4XCNz4sbZ; Mon, 20 Sep 2021 10:58:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C066751F; Mon, 20 Sep 2021 10:58: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 18KAwNcZ061008; Mon, 20 Sep 2021 10:58:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KAwNqh061007; Mon, 20 Sep 2021 10:58:23 GMT (envelope-from git) Date: Mon, 20 Sep 2021 10:58:23 GMT Message-Id: <202109201058.18KAwNqh061007@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: b94d360e4aa6 - main - Add ELF macros found in the aaelf64 spec MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b94d360e4aa66d626ad5a0acde683ae9a9c71729 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 10:58:23 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=b94d360e4aa66d626ad5a0acde683ae9a9c71729 commit b94d360e4aa66d626ad5a0acde683ae9a9c71729 Author: Andrew Turner AuthorDate: 2021-09-20 08:55:44 +0000 Commit: Andrew Turner CommitDate: 2021-09-20 10:34:04 +0000 Add ELF macros found in the aaelf64 spec The arm64 aaelf64 spec [0] has DT_AARCH64_ that could be used with dynamic linking. It also adds GNU_PROPERTY_AARCH64_FEATURE_1_AND used to tell the kernel which CPU features the binary is compatible with, but does not require to execute correctly. Add these values so the kernel and elf tools can make use of them. [0] https://github.com/ARM-software/abi-aa/blob/2021Q1/aaelf64/aaelf64.rst Sponsored by: The FreeBSD Foundation --- sys/sys/elf_common.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/sys/elf_common.h b/sys/sys/elf_common.h index d362f51ed833..4df2751b07cf 100644 --- a/sys/sys/elf_common.h +++ b/sys/sys/elf_common.h @@ -678,6 +678,10 @@ typedef struct { #define DT_LOPROC 0x70000000 /* First processor-specific type. */ +#define DT_AARCH64_BTI_PLT 0x70000001 +#define DT_AARCH64_PAC_PLT 0x70000003 +#define DT_AARCH64_VARIANT_PCS 0x70000005 + #define DT_ARM_SYMTABSZ 0x70000001 #define DT_ARM_PREEMPTMAP 0x70000002 @@ -829,6 +833,11 @@ typedef struct { #define GNU_PROPERTY_LOPROC 0xc0000000 #define GNU_PROPERTY_HIPROC 0xdfffffff +#define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000 + +#define GNU_PROPERTY_AARCH64_FEATURE_1_BTI 0x00000001 +#define GNU_PROPERTY_AARCH64_FEATURE_1_PAC 0x00000002 + #define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002 #define GNU_PROPERTY_X86_FEATURE_1_IBT 0x00000001 From owner-dev-commits-src-all@freebsd.org Mon Sep 20 13:55:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E59D767E642; Mon, 20 Sep 2021 13:55: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 4HCmKj5ykcz4lVv; Mon, 20 Sep 2021 13:55: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 A993F11A57; Mon, 20 Sep 2021 13:55: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 18KDtbTM099982; Mon, 20 Sep 2021 13:55:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KDtb4r099981; Mon, 20 Sep 2021 13:55:37 GMT (envelope-from git) Date: Mon, 20 Sep 2021 13:55:37 GMT Message-Id: <202109201355.18KDtb4r099981@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 34b1efcea19d - main - sctp: use a valid outstream when adding it to the scheduler MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 34b1efcea19dd4324eecd19d2de313d039fd9656 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 13:55:38 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=34b1efcea19dd4324eecd19d2de313d039fd9656 commit 34b1efcea19dd4324eecd19d2de313d039fd9656 Author: Michael Tuexen AuthorDate: 2021-09-20 13:52:10 +0000 Commit: Michael Tuexen CommitDate: 2021-09-20 13:52:10 +0000 sctp: use a valid outstream when adding it to the scheduler Without holding the stcb send lock, the outstreams might get reallocated if the number of streams are increased. Reported by: syzbot+4a5431d7caa666f2c19c@syzkaller.appspotmail.com Reported by: syzbot+aa2e3b013a48870e193d@syzkaller.appspotmail.com Reported by: syzbot+e4368c3bde07cd2fb29f@syzkaller.appspotmail.com Reported by: syzbot+fe2f110e34811ea91690@syzkaller.appspotmail.com Reported by: syzbot+ed6e8de942351d0309f4@syzkaller.appspotmail.com MFC after: 1 week --- sys/netinet/sctp_output.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 35a834438895..434ab7e1f8dc 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -6337,7 +6337,6 @@ sctp_msg_append(struct sctp_tcb *stcb, error = EINVAL; goto out_now; } - strm = &stcb->asoc.strmout[srcv->sinfo_stream]; /* Now can we send this? */ if ((SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_SENT) || (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_ACK_SENT) || @@ -6396,6 +6395,7 @@ sctp_msg_append(struct sctp_tcb *stcb, if (hold_stcb_lock == 0) { SCTP_TCB_SEND_LOCK(stcb); } + strm = &stcb->asoc.strmout[srcv->sinfo_stream]; sctp_snd_sb_alloc(stcb, sp->length); atomic_add_int(&stcb->asoc.stream_queue_cnt, 1); TAILQ_INSERT_TAIL(&strm->outqueue, sp, next); @@ -13137,6 +13137,8 @@ skip_preblock: goto out; } SCTP_TCB_SEND_LOCK(stcb); + /* The out streams might be reallocated. */ + strm = &stcb->asoc.strmout[srcv->sinfo_stream]; if (sp->msg_is_complete) { strm->last_msg_incomplete = 0; asoc->stream_locked = 0; From owner-dev-commits-src-all@freebsd.org Mon Sep 20 15:18:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5FA636A8310; Mon, 20 Sep 2021 15:18:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCp961z8hz3PTk; Mon, 20 Sep 2021 15:18: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 1FEF812BCF; Mon, 20 Sep 2021 15:18: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 18KFIHOw007404; Mon, 20 Sep 2021 15:18:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KFIHGd007403; Mon, 20 Sep 2021 15:18:17 GMT (envelope-from git) Date: Mon, 20 Sep 2021 15:18:17 GMT Message-Id: <202109201518.18KFIHGd007403@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: b91fc6c43a81 - main - acpica: add ACPI_GET_PROPERTY to access Device Specific Data (DSD) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b91fc6c43a81d3b760fb570c8439a922e536d7e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 15:18:18 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=b91fc6c43a81d3b760fb570c8439a922e536d7e6 commit b91fc6c43a81d3b760fb570c8439a922e536d7e6 Author: Bartlomiej Grzesik AuthorDate: 2021-07-27 12:39:31 +0000 Commit: Marcin Wojtas CommitDate: 2021-09-20 14:31:08 +0000 acpica: add ACPI_GET_PROPERTY to access Device Specific Data (DSD) Add lazy acquiring of DSD package, which allows accessing Device Specific Data. Reviewed by: manu, mw Sponsored by: Semihalf Differential revision: https://reviews.freebsd.org/D31596 --- sys/dev/acpica/acpi.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++++ sys/dev/acpica/acpi_if.m | 21 ++++++++++ sys/dev/acpica/acpivar.h | 12 ++++++ 3 files changed, 132 insertions(+) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 02358d407c66..40b928f9cdd6 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #if defined(__i386__) || defined(__amd64__) #include @@ -147,10 +148,13 @@ static int acpi_device_id_probe(device_t bus, device_t dev, char **ids, char **m static ACPI_STATUS acpi_device_eval_obj(device_t bus, device_t dev, ACPI_STRING pathname, ACPI_OBJECT_LIST *parameters, ACPI_BUFFER *ret); +static ACPI_STATUS acpi_device_get_prop(device_t bus, device_t dev, + ACPI_STRING propname, const ACPI_OBJECT **value); static ACPI_STATUS acpi_device_scan_cb(ACPI_HANDLE h, UINT32 level, void *context, void **retval); static ACPI_STATUS acpi_device_scan_children(device_t bus, device_t dev, int max_depth, acpi_scan_cb_t user_fn, void *arg); +static ACPI_STATUS acpi_find_dsd(device_t bus, device_t dev); static int acpi_isa_pnp_probe(device_t bus, device_t child, struct isa_pnp_id *ids); static void acpi_platform_osc(device_t dev); @@ -223,6 +227,7 @@ static device_method_t acpi_methods[] = { /* ACPI bus */ DEVMETHOD(acpi_id_probe, acpi_device_id_probe), DEVMETHOD(acpi_evaluate_object, acpi_device_eval_obj), + DEVMETHOD(acpi_get_property, acpi_device_get_prop), DEVMETHOD(acpi_pwr_for_sleep, acpi_device_pwr_for_sleep), DEVMETHOD(acpi_scan_children, acpi_device_scan_children), @@ -296,6 +301,15 @@ int acpi_susp_bounce; SYSCTL_INT(_debug_acpi, OID_AUTO, suspend_bounce, CTLFLAG_RW, &acpi_susp_bounce, 0, "Don't actually suspend, just test devices."); +/* + * ACPI standard UUID for Device Specific Data Package + * "Device Properties UUID for _DSD" Rev. 2.0 + */ +static const struct uuid acpi_dsd_uuid = { + 0xdaffd814, 0x6eba, 0x4d8c, 0x8a, 0x91, + { 0xbc, 0x9b, 0xbf, 0x4a, 0xa3, 0x01 } +}; + /* * ACPI can only be loaded as a module by the loader; activating it after * system bootstrap time is not useful, and can be fatal to the system. @@ -1727,6 +1741,82 @@ acpi_device_eval_obj(device_t bus, device_t dev, ACPI_STRING pathname, return (AcpiEvaluateObject(h, pathname, parameters, ret)); } +static ACPI_STATUS +acpi_device_get_prop(device_t bus, device_t dev, ACPI_STRING propname, + const ACPI_OBJECT **value) +{ + const ACPI_OBJECT *pkg, *name, *val; + struct acpi_device *ad; + ACPI_STATUS status; + int i; + + ad = device_get_ivars(dev); + + if (ad == NULL || propname == NULL) + return (AE_BAD_PARAMETER); + if (ad->dsd_pkg == NULL) { + if (ad->dsd.Pointer == NULL) { + status = acpi_find_dsd(bus, dev); + if (ACPI_FAILURE(status)) + return (status); + } else { + return (AE_NOT_FOUND); + } + } + + for (i = 0; i < ad->dsd_pkg->Package.Count; i ++) { + pkg = &ad->dsd_pkg->Package.Elements[i]; + if (pkg->Type != ACPI_TYPE_PACKAGE || pkg->Package.Count != 2) + continue; + + name = &pkg->Package.Elements[0]; + val = &pkg->Package.Elements[1]; + if (name->Type != ACPI_TYPE_STRING) + continue; + if (strncmp(propname, name->String.Pointer, name->String.Length) == 0) { + if (value != NULL) + *value = val; + + return (AE_OK); + } + } + + return (AE_NOT_FOUND); +} + +static ACPI_STATUS +acpi_find_dsd(device_t bus, device_t dev) +{ + const ACPI_OBJECT *dsd, *guid, *pkg; + struct acpi_device *ad; + ACPI_STATUS status; + + ad = device_get_ivars(dev); + ad->dsd.Length = ACPI_ALLOCATE_BUFFER; + ad->dsd.Pointer = NULL; + ad->dsd_pkg = NULL; + + status = ACPI_EVALUATE_OBJECT(bus, dev, "_DSD", NULL, &ad->dsd); + if (ACPI_FAILURE(status)) + return (status); + + dsd = ad->dsd.Pointer; + guid = &dsd->Package.Elements[0]; + pkg = &dsd->Package.Elements[1]; + + if (guid->Type != ACPI_TYPE_BUFFER || pkg->Type != ACPI_TYPE_PACKAGE || + guid->Buffer.Length != sizeof(acpi_dsd_uuid)) + return (AE_NOT_FOUND); + if (memcmp(guid->Buffer.Pointer, &acpi_dsd_uuid, + sizeof(acpi_dsd_uuid)) == 0) { + + ad->dsd_pkg = pkg; + return (AE_OK); + } + + return (AE_NOT_FOUND); +} + int acpi_device_pwr_for_sleep(device_t bus, device_t dev, int *dstate) { @@ -2399,6 +2489,15 @@ acpi_GetHandleInScope(ACPI_HANDLE parent, char *path, ACPI_HANDLE *result) } } +ACPI_STATUS +acpi_GetProperty(device_t dev, ACPI_STRING propname, + const ACPI_OBJECT **value) +{ + device_t bus = device_get_parent(dev); + + return (ACPI_GET_PROPERTY(bus, dev, propname, value)); +} + /* * Allocate a buffer with a preset data size. */ diff --git a/sys/dev/acpica/acpi_if.m b/sys/dev/acpica/acpi_if.m index 6e36f398411e..e0ed4d72e899 100644 --- a/sys/dev/acpica/acpi_if.m +++ b/sys/dev/acpica/acpi_if.m @@ -121,6 +121,27 @@ METHOD ACPI_STATUS evaluate_object { ACPI_BUFFER *ret; }; +# +# Get property value from Device Specific Data +# +# device_t bus: parent bus for the device +# +# device_t dev: find property for this device's handle. +# +# const ACPI_STRING propname: name of the property +# +# const ACPI_OBJECT **value: property value output +# Specify NULL if ignored +# +# Returns: AE_OK or an error value +# +METHOD ACPI_STATUS get_property { + device_t bus; + device_t dev; + ACPI_STRING propname; + const ACPI_OBJECT **value; +}; + # # Get the highest power state (D0-D3) that is usable for a device when # suspending/resuming. If a bus calls this when suspending a device, it diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h index 1f64b479d414..e276193aebc0 100644 --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -90,6 +90,9 @@ struct acpi_device { int ad_flags; int ad_cls_class; + ACPI_BUFFER dsd; /* Device Specific Data */ + const ACPI_OBJECT *dsd_pkg; + /* Resources */ struct resource_list ad_rl; }; @@ -350,6 +353,8 @@ BOOLEAN acpi_DeviceIsPresent(device_t dev); BOOLEAN acpi_BatteryIsPresent(device_t dev); ACPI_STATUS acpi_GetHandleInScope(ACPI_HANDLE parent, char *path, ACPI_HANDLE *result); +ACPI_STATUS acpi_GetProperty(device_t dev, ACPI_STRING propname, + const ACPI_OBJECT **value); ACPI_BUFFER *acpi_AllocBuffer(int size); ACPI_STATUS acpi_ConvertBufferToInteger(ACPI_BUFFER *bufp, UINT32 *number); @@ -396,6 +401,13 @@ int acpi_MatchHid(ACPI_HANDLE h, const char *hid); #define ACPI_MATCHHID_HID 1 #define ACPI_MATCHHID_CID 2 +static __inline bool +acpi_HasProperty(device_t dev, ACPI_STRING propname) +{ + + return ACPI_SUCCESS(acpi_GetProperty(dev, propname, NULL)); +} + struct acpi_parse_resource_set { void (*set_init)(device_t dev, void *arg, void **context); void (*set_done)(device_t dev, void *context); From owner-dev-commits-src-all@freebsd.org Mon Sep 20 15:18:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 702B96A8311; Mon, 20 Sep 2021 15:18:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCp972dspz3Phv; Mon, 20 Sep 2021 15:18: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 3C62212DAB; Mon, 20 Sep 2021 15:18:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18KFIJ2i007428; Mon, 20 Sep 2021 15:18:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KFIJa5007427; Mon, 20 Sep 2021 15:18:19 GMT (envelope-from git) Date: Mon, 20 Sep 2021 15:18:19 GMT Message-Id: <202109201518.18KFIJa5007427@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 3f9a00e3b577 - main - device: add device_get_property and device_has_property MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3f9a00e3b577dcca57e331842e0baf2dbdf9325f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 15:18:19 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=3f9a00e3b577dcca57e331842e0baf2dbdf9325f commit 3f9a00e3b577dcca57e331842e0baf2dbdf9325f Author: Bartlomiej Grzesik AuthorDate: 2021-07-30 08:57:06 +0000 Commit: Marcin Wojtas CommitDate: 2021-09-20 15:17:57 +0000 device: add device_get_property and device_has_property Generialize bus specific property accessors. Those functions allow driver code to access device specific information. Currently there is only support for FDT and ACPI buses. Reviewed by: manu, mw Sponsored by: Semihalf Differential revision: https://reviews.freebsd.org/D31597 --- share/man/man9/BUS_GET_PROPERTY.9 | 65 ++++++++++++++++++++++++++++++++++ share/man/man9/Makefile | 2 ++ share/man/man9/device_get_property.9 | 67 ++++++++++++++++++++++++++++++++++++ sys/dev/acpica/acpi.c | 37 ++++++++++++++++++++ sys/dev/fdt/simplebus.c | 16 +++++++++ sys/kern/bus_if.m | 31 +++++++++++++++++ sys/kern/subr_bus.c | 14 ++++++++ sys/sys/bus.h | 2 ++ 8 files changed, 234 insertions(+) diff --git a/share/man/man9/BUS_GET_PROPERTY.9 b/share/man/man9/BUS_GET_PROPERTY.9 new file mode 100644 index 000000000000..89edbd95b68c --- /dev/null +++ b/share/man/man9/BUS_GET_PROPERTY.9 @@ -0,0 +1,65 @@ +.\" - +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2021 Semihalf +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd August 19, 2021 +.Dt BUS_GET_PROPERTY 9 +.Os +.Sh NAME +.Nm BUS_GET_PROPERTY +.Nd get child's specific property +.Sh SYNOPSIS +.In sys/param.h +.In sys/bus.h +.Ft ssize_t +.Fn BUS_GET_PROPERTY "device_t dev" "device_t child" "const char *propname" \ + "void *propvalue" "size_t size" +.Sh DESCRIPTION +The +.Fn BUS_GET_PROPERTY +method +is called from driver code which wants to access child's specific data stored +on the bus. +Property consits of its name and value. +Implementation shall copy to +.Fa propvalue +at most +.Fa size +bytes. +.Sh NOTES +If +.Fa propvalue +is NULL or +.Fa size +is zero, then implementation shall only return size of the property. +.Sh RETURN VALUES +Property's size if successful, otherwise -1. +.Sh SEE ALSO +.Xr device 9 , +.Xr device_get_property 9 +.Sh AUTHORS +This manual page was written by +.An Bartlomiej Grzesik . diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 4764db983f8a..30632e0a6cb6 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -47,6 +47,7 @@ MAN= accept_filter.9 \ bus_generic_read_ivar.9 \ bus_generic_shutdown.9 \ BUS_GET_CPUS.9 \ + BUS_GET_PROPERTY.9 \ bus_get_resource.9 \ bus_map_resource.9 \ BUS_NEW_PASS.9 \ @@ -108,6 +109,7 @@ MAN= accept_filter.9 \ device_get_ivars.9 \ device_get_name.9 \ device_get_parent.9 \ + device_get_property.9 \ device_get_softc.9 \ device_get_state.9 \ device_get_sysctl.9 \ diff --git a/share/man/man9/device_get_property.9 b/share/man/man9/device_get_property.9 new file mode 100644 index 000000000000..1d9bd5058b1a --- /dev/null +++ b/share/man/man9/device_get_property.9 @@ -0,0 +1,67 @@ +.\" - +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2021 Semihalf +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd August 19, 2021 +.Dt DEVICE_GET_PROPERTY 9 +.Os +.Sh NAME +.Nm device_get_property , +.Nm device_has_property +.Nd access device specific data +.Sh SYNOPSIS +.In sys/param.h +.In sys/bus.h +.Ft ssize_t +.Fn device_get_property "device_t dev" "const char *prop" "void *val" "size_t sz" +.Ft bool +.Fn device_has_property "device_t dev" "const char *prop" +.Sh DESCRIPTION +Access device specific data provided by the parent bus. +Drivers can use these properties to obtain device capabilities and set +necessary quirks. +.Sh NOTES +You can pass NULL as pointer to property's value when calling +.Fn device_get_property +to obtain its size. +.Pp +Currently this interface is implemented by +.Xr simplebus 4 +and +.Xr acpi 4 . +.Sh RETURN VALUES +.Fn device_get_property +if successful returns property's size, otherwise returns -1. +.Pp +.Fn device_has_property +returns true if given property was found. +.Sh SEE ALSO +.Xr acpi 4 , +.Xr simplebus 4 , +.Xr device 9 +.Sh AUTHORS +This manual page was written by +.An Bartlomiej Grzesik . diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 40b928f9cdd6..5d2b895bbe88 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -144,6 +144,8 @@ static void acpi_delete_resource(device_t bus, device_t child, int type, int rid); static uint32_t acpi_isa_get_logicalid(device_t dev); static int acpi_isa_get_compatid(device_t dev, uint32_t *cids, int count); +static ssize_t acpi_bus_get_prop(device_t bus, device_t child, const char *propname, + void *propvalue, size_t size); static int acpi_device_id_probe(device_t bus, device_t dev, char **ids, char **match); static ACPI_STATUS acpi_device_eval_obj(device_t bus, device_t dev, ACPI_STRING pathname, ACPI_OBJECT_LIST *parameters, @@ -223,6 +225,7 @@ static device_method_t acpi_methods[] = { DEVMETHOD(bus_hint_device_unit, acpi_hint_device_unit), DEVMETHOD(bus_get_cpus, acpi_get_cpus), DEVMETHOD(bus_get_domain, acpi_get_domain), + DEVMETHOD(bus_get_property, acpi_bus_get_prop), /* ACPI bus */ DEVMETHOD(acpi_id_probe, acpi_device_id_probe), @@ -1817,6 +1820,40 @@ acpi_find_dsd(device_t bus, device_t dev) return (AE_NOT_FOUND); } +static ssize_t +acpi_bus_get_prop(device_t bus, device_t child, const char *propname, + void *propvalue, size_t size) +{ + ACPI_STATUS status; + const ACPI_OBJECT *obj; + + status = acpi_device_get_prop(bus, child, __DECONST(char *, propname), + &obj); + if (ACPI_FAILURE(status)) + return (-1); + + switch (obj->Type) { + case ACPI_TYPE_INTEGER: + if (propvalue != NULL && size >= sizeof(uint64_t)) + *((uint64_t *) propvalue) = obj->Integer.Value; + return (sizeof(uint64_t)); + + case ACPI_TYPE_STRING: + if (propvalue != NULL && size > 0) + memcpy(propvalue, obj->String.Pointer, + MIN(size, obj->String.Length)); + return (obj->String.Length); + + case ACPI_TYPE_BUFFER: + if (propvalue != NULL && size > 0) + memcpy(propvalue, obj->Buffer.Pointer, + MIN(size, obj->Buffer.Length)); + return (obj->Buffer.Length); + } + + return (-1); +} + int acpi_device_pwr_for_sleep(device_t bus, device_t dev, int *dstate) { diff --git a/sys/dev/fdt/simplebus.c b/sys/dev/fdt/simplebus.c index 76814ed40b04..4d58f9b3ea69 100644 --- a/sys/dev/fdt/simplebus.c +++ b/sys/dev/fdt/simplebus.c @@ -54,6 +54,9 @@ static device_t simplebus_add_child(device_t dev, u_int order, const char *name, int unit); static struct resource_list *simplebus_get_resource_list(device_t bus, device_t child); + +static ssize_t simplebus_get_property(device_t bus, device_t child, + const char *propname, void *propvalue, size_t size); /* * ofw_bus interface */ @@ -89,6 +92,7 @@ static device_method_t simplebus_methods[] = { DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo), DEVMETHOD(bus_get_resource_list, simplebus_get_resource_list), + DEVMETHOD(bus_get_property, simplebus_get_property), /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_devinfo, simplebus_get_devinfo), @@ -350,6 +354,18 @@ simplebus_get_resource_list(device_t bus __unused, device_t child) return (&ndi->rl); } +static ssize_t +simplebus_get_property(device_t bus, device_t child, const char *propname, + void *propvalue, size_t size) +{ + phandle_t node = ofw_bus_get_node(child); + + if (propvalue == NULL || size == 0) + return (OF_getproplen(node, propname)); + + return (OF_getencprop(node, propname, propvalue, size)); +} + static struct resource * simplebus_alloc_resource(device_t bus, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m index 71d83954ef4d..0bd7056019ab 100644 --- a/sys/kern/bus_if.m +++ b/sys/kern/bus_if.m @@ -88,6 +88,13 @@ CODE { *newstart = start; return (0); } + + static ssize_t + null_get_property(device_t dev, device_t child, const char *propname, + void *propvalue, size_t size) + { + return (-1); + } }; /** @@ -924,3 +931,27 @@ METHOD int reset_child { device_t _child; int _flags; }; + +/** + * @brief Gets child's specific property + * + * The bus_get_property can be used to access device + * specific properties stored on the bus. If _propvalue + * is NULL or _size is 0, then method only returns size + * of the property. + * + * @param _dev the bus device + * @param _child the child device + * @param _propname property name + * @param _propvalue property value destination + * @param _size property value size + * + * @returns size of property if successful otherwise -1 + */ +METHOD ssize_t get_property { + device_t _dev; + device_t _child; + const char *_propname; + void *_propvalue; + size_t _size; +} DEFAULT null_get_property; diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 77b4c4c66c4b..1f580f455dc0 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -2708,6 +2708,20 @@ device_verbose(device_t dev) dev->flags &= ~DF_QUIET; } +ssize_t +device_get_property(device_t dev, const char *prop, void *val, size_t sz) +{ + device_t bus = device_get_parent(dev); + + return (BUS_GET_PROPERTY(bus, dev, prop, val, sz)); +} + +bool +device_has_property(device_t dev, const char *prop) +{ + return (device_get_property(dev, prop, NULL, 0) >= 0); +} + /** * @brief Return non-zero if the DF_QUIET_CHIDLREN flag is set on the device */ diff --git a/sys/sys/bus.h b/sys/sys/bus.h index c9ac84020ba5..ff86cbcf457f 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -631,6 +631,8 @@ int device_set_unit(device_t dev, int unit); /* XXX DONT USE XXX */ int device_shutdown(device_t dev); void device_unbusy(device_t dev); void device_verbose(device_t dev); +ssize_t device_get_property(device_t dev, const char *prop, void *val, size_t sz); +bool device_has_property(device_t dev, const char *prop); /* * Access functions for devclass. From owner-dev-commits-src-all@freebsd.org Mon Sep 20 15:18:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8F726A8480; Mon, 20 Sep 2021 15:18: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 4HCp984kgTz3Phx; Mon, 20 Sep 2021 15:18: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 647F812CF6; Mon, 20 Sep 2021 15:18: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 18KFIK6v007452; Mon, 20 Sep 2021 15:18:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KFIKnL007451; Mon, 20 Sep 2021 15:18:20 GMT (envelope-from git) Date: Mon, 20 Sep 2021 15:18:20 GMT Message-Id: <202109201518.18KFIKnL007451@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 8a8166e5bcfb - main - mmc: switch mmc_helper to device_ api MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8a8166e5bcfb50e2b7280581b600d098fa6c9fc7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 15:18:20 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=8a8166e5bcfb50e2b7280581b600d098fa6c9fc7 commit 8a8166e5bcfb50e2b7280581b600d098fa6c9fc7 Author: Bartlomiej Grzesik AuthorDate: 2021-08-02 14:27:23 +0000 Commit: Marcin Wojtas CommitDate: 2021-09-20 15:18:02 +0000 mmc: switch mmc_helper to device_ api Add generic mmc_helper which uses newly introduced device_*_property api. Thanks to this change the sd/mmc drivers will be capable of parsing both DT and ACPI description. Ensure backward compatibility for all mmc_fdt_helper users. Reviewed by: manu, mw Sponsored by: Semihalf Differential revision: https://reviews.freebsd.org/D31598 --- sys/arm/allwinner/aw_mmc.c | 2 +- sys/arm/broadcom/bcm2835/bcm2835_sdhci.c | 2 +- sys/conf/files | 1 + sys/dev/mmc/host/dwmmc_var.h | 2 +- sys/dev/mmc/mmc_fdt_helpers.c | 116 ++++---------------------- sys/dev/mmc/mmc_fdt_helpers.h | 42 ++-------- sys/dev/mmc/mmc_helpers.c | 134 +++++++++++++++++++++++++++++++ sys/dev/mmc/mmc_helpers.h | 70 ++++++++++++++++ sys/dev/sdhci/sdhci_fsl_fdt.c | 2 +- sys/dev/sdhci/sdhci_xenon.c | 2 +- 10 files changed, 234 insertions(+), 139 deletions(-) diff --git a/sys/arm/allwinner/aw_mmc.c b/sys/arm/allwinner/aw_mmc.c index 9f215399e62b..3271090f19e3 100644 --- a/sys/arm/allwinner/aw_mmc.c +++ b/sys/arm/allwinner/aw_mmc.c @@ -130,7 +130,7 @@ struct aw_mmc_softc { int aw_timeout; struct callout aw_timeoutc; struct mmc_host aw_host; - struct mmc_fdt_helper mmc_helper; + struct mmc_helper mmc_helper; #ifdef MMCCAM union ccb * ccb; struct mmc_sim mmc_sim; diff --git a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c index cd9b60743be3..38617dcd38eb 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c @@ -156,7 +156,7 @@ struct bcm_sdhci_softc { void * sc_intrhand; struct mmc_request * sc_req; struct sdhci_slot sc_slot; - struct mmc_fdt_helper sc_mmc_helper; + struct mmc_helper sc_mmc_helper; int sc_dma_ch; bus_dma_tag_t sc_dma_tag; bus_dmamap_t sc_dma_map; diff --git a/sys/conf/files b/sys/conf/files index bf1c680093d1..1d3a36ac6bc7 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -2483,6 +2483,7 @@ dev/mmc/mmcbr_if.m standard dev/mmc/mmcbus_if.m standard dev/mmc/mmcsd.c optional mmcsd !mmccam dev/mmc/mmc_fdt_helpers.c optional ext_resources mmc fdt | ext_resources mmccam fdt +dev/mmc/mmc_helpers.c optional ext_resources mmc | ext_resources mmccam dev/mmc/mmc_pwrseq.c optional ext_resources mmc fdt | ext_resources mmccam fdt dev/mmc/mmc_pwrseq_if.m optional ext_resources mmc fdt | ext_resources mmccam fdt dev/mmcnull/mmcnull.c optional mmcnull diff --git a/sys/dev/mmc/host/dwmmc_var.h b/sys/dev/mmc/host/dwmmc_var.h index ef7c91fa628e..a3f20278ad2a 100644 --- a/sys/dev/mmc/host/dwmmc_var.h +++ b/sys/dev/mmc/host/dwmmc_var.h @@ -56,7 +56,7 @@ struct dwmmc_softc { device_t dev; void *intr_cookie; struct mmc_host host; - struct mmc_fdt_helper mmc_helper; + struct mmc_helper mmc_helper; struct mtx sc_mtx; #ifdef MMCCAM union ccb * ccb; diff --git a/sys/dev/mmc/mmc_fdt_helpers.c b/sys/dev/mmc/mmc_fdt_helpers.c index 291a4bc72ff2..249a430311fa 100644 --- a/sys/dev/mmc/mmc_fdt_helpers.c +++ b/sys/dev/mmc/mmc_fdt_helpers.c @@ -45,105 +45,21 @@ __FBSDID("$FreeBSD$"); #include #endif -#include "mmc_pwrseq_if.h" - -static inline void -mmc_fdt_parse_sd_speed(phandle_t node, struct mmc_host *host) -{ - bool no_18v = false; - - /* - * Parse SD supported modes - * All UHS-I modes requires 1.8V signaling. - */ - if (OF_hasprop(node, "no-1-8-v")) - no_18v = true; - if (OF_hasprop(node, "cap-sd-highspeed")) - host->caps |= MMC_CAP_HSPEED; - if (OF_hasprop(node, "sd-uhs-sdr12") && no_18v == false) - host->caps |= MMC_CAP_UHS_SDR12 | MMC_CAP_SIGNALING_180; - if (OF_hasprop(node, "sd-uhs-sdr25") && no_18v == false) - host->caps |= MMC_CAP_UHS_SDR25 | MMC_CAP_SIGNALING_180; - if (OF_hasprop(node, "sd-uhs-sdr50") && no_18v == false) - host->caps |= MMC_CAP_UHS_SDR50 | MMC_CAP_SIGNALING_180; - if (OF_hasprop(node, "sd-uhs-sdr104") && no_18v == false) - host->caps |= MMC_CAP_UHS_SDR104 | MMC_CAP_SIGNALING_180; - if (OF_hasprop(node, "sd-uhs-ddr50") && no_18v == false) - host->caps |= MMC_CAP_UHS_DDR50 | MMC_CAP_SIGNALING_180; -} +#include -static inline void -mmc_fdt_parse_mmc_speed(phandle_t node, struct mmc_host *host) -{ - - /* Parse eMMC supported modes */ - if (OF_hasprop(node, "cap-mmc-highspeed")) - host->caps |= MMC_CAP_HSPEED; - if (OF_hasprop(node, "mmc-ddr-1_2v")) - host->caps |= MMC_CAP_MMC_DDR52_120 | MMC_CAP_SIGNALING_120; - if (OF_hasprop(node, "mmc-ddr-1_8v")) - host->caps |= MMC_CAP_MMC_DDR52_180 | MMC_CAP_SIGNALING_180; - if (OF_hasprop(node, "mmc-ddr-3_3v")) - host->caps |= MMC_CAP_SIGNALING_330; - if (OF_hasprop(node, "mmc-hs200-1_2v")) - host->caps |= MMC_CAP_MMC_HS200_120 | MMC_CAP_SIGNALING_120; - if (OF_hasprop(node, "mmc-hs200-1_8v")) - host->caps |= MMC_CAP_MMC_HS200_180 | MMC_CAP_SIGNALING_180; - if (OF_hasprop(node, "mmc-hs400-1_2v")) - host->caps |= MMC_CAP_MMC_HS400_120 | MMC_CAP_SIGNALING_120; - if (OF_hasprop(node, "mmc-hs400-1_8v")) - host->caps |= MMC_CAP_MMC_HS400_180 | MMC_CAP_SIGNALING_180; - if (OF_hasprop(node, "mmc-hs400-enhanced-strobe")) - host->caps |= MMC_CAP_MMC_ENH_STROBE; -} +#include "mmc_pwrseq_if.h" int -mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_fdt_helper *helper, +mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_helper *helper, struct mmc_host *host) { - uint32_t bus_width; + struct mmc_helper mmc_helper; phandle_t pwrseq_xref; - if (node <= 0) - node = ofw_bus_get_node(dev); - if (node <= 0) - return (ENXIO); - - if (OF_getencprop(node, "bus-width", &bus_width, sizeof(uint32_t)) <= 0) - bus_width = 1; - - if (bus_width >= 4) - host->caps |= MMC_CAP_4_BIT_DATA; - if (bus_width >= 8) - host->caps |= MMC_CAP_8_BIT_DATA; + memset(&mmc_helper, 0, sizeof(mmc_helper)); + mmc_parse(dev, &mmc_helper, host); - /* - * max-frequency is optional, drivers should tweak this value - * if it's not present based on the clock that the mmc controller - * operates on - */ - OF_getencprop(node, "max-frequency", &host->f_max, sizeof(uint32_t)); - - if (OF_hasprop(node, "broken-cd")) - helper->props |= MMC_PROP_BROKEN_CD; - if (OF_hasprop(node, "non-removable")) - helper->props |= MMC_PROP_NON_REMOVABLE; - if (OF_hasprop(node, "wp-inverted")) - helper->props |= MMC_PROP_WP_INVERTED; - if (OF_hasprop(node, "cd-inverted")) - helper->props |= MMC_PROP_CD_INVERTED; - if (OF_hasprop(node, "no-sdio")) - helper->props |= MMC_PROP_NO_SDIO; - if (OF_hasprop(node, "no-sd")) - helper->props |= MMC_PROP_NO_SD; - if (OF_hasprop(node, "no-mmc")) - helper->props |= MMC_PROP_NO_MMC; - - if (!(helper->props & MMC_PROP_NO_SD)) - mmc_fdt_parse_sd_speed(node, host); - - if (!(helper->props & MMC_PROP_NO_MMC)) - mmc_fdt_parse_mmc_speed(node, host); + helper->props = mmc_helper.props; #ifdef EXT_RESOURCES /* @@ -200,7 +116,7 @@ mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_fdt_helper *helper, static void cd_intr(void *arg) { - struct mmc_fdt_helper *helper = arg; + struct mmc_helper *helper = arg; taskqueue_enqueue_timeout(taskqueue_swi_giant, &helper->cd_delayed_task, -(hz / 2)); @@ -209,7 +125,7 @@ cd_intr(void *arg) static void cd_card_task(void *arg, int pending __unused) { - struct mmc_fdt_helper *helper = arg; + struct mmc_helper *helper = arg; bool cd_present; cd_present = mmc_fdt_gpio_get_present(helper); @@ -228,7 +144,7 @@ cd_card_task(void *arg, int pending __unused) * Card detect setup. */ static void -cd_setup(struct mmc_fdt_helper *helper, phandle_t node) +cd_setup(struct mmc_helper *helper, phandle_t node) { int pincaps; device_t dev; @@ -330,7 +246,7 @@ without_interrupts: * Write protect setup. */ static void -wp_setup(struct mmc_fdt_helper *helper, phandle_t node) +wp_setup(struct mmc_helper *helper, phandle_t node) { device_t dev; @@ -352,7 +268,7 @@ wp_setup(struct mmc_fdt_helper *helper, phandle_t node) } int -mmc_fdt_gpio_setup(device_t dev, phandle_t node, struct mmc_fdt_helper *helper, +mmc_fdt_gpio_setup(device_t dev, phandle_t node, struct mmc_helper *helper, mmc_fdt_cd_handler handler) { @@ -377,7 +293,7 @@ mmc_fdt_gpio_setup(device_t dev, phandle_t node, struct mmc_fdt_helper *helper, } void -mmc_fdt_gpio_teardown(struct mmc_fdt_helper *helper) +mmc_fdt_gpio_teardown(struct mmc_helper *helper) { if (helper == NULL) @@ -396,7 +312,7 @@ mmc_fdt_gpio_teardown(struct mmc_fdt_helper *helper) } bool -mmc_fdt_gpio_get_present(struct mmc_fdt_helper *helper) +mmc_fdt_gpio_get_present(struct mmc_helper *helper) { bool pinstate; @@ -411,7 +327,7 @@ mmc_fdt_gpio_get_present(struct mmc_fdt_helper *helper) } bool -mmc_fdt_gpio_get_readonly(struct mmc_fdt_helper *helper) +mmc_fdt_gpio_get_readonly(struct mmc_helper *helper) { bool pinstate; @@ -427,7 +343,7 @@ mmc_fdt_gpio_get_readonly(struct mmc_fdt_helper *helper) } void -mmc_fdt_set_power(struct mmc_fdt_helper *helper, enum mmc_power_mode power_mode) +mmc_fdt_set_power(struct mmc_helper *helper, enum mmc_power_mode power_mode) { int reg_status; int rv; diff --git a/sys/dev/mmc/mmc_fdt_helpers.h b/sys/dev/mmc/mmc_fdt_helpers.h index e6d6f3fbfd84..f07ca1684440 100644 --- a/sys/dev/mmc/mmc_fdt_helpers.h +++ b/sys/dev/mmc/mmc_fdt_helpers.h @@ -37,43 +37,17 @@ #include #endif -struct mmc_fdt_helper { - device_t dev; - gpio_pin_t wp_pin; - gpio_pin_t cd_pin; - void * cd_ihandler; - struct resource * cd_ires; - int cd_irid; - void (*cd_handler)(device_t, bool); - struct timeout_task cd_delayed_task; - bool cd_disabled; - bool wp_disabled; - bool cd_present; - uint32_t props; -#define MMC_PROP_BROKEN_CD (1 << 0) -#define MMC_PROP_NON_REMOVABLE (1 << 1) -#define MMC_PROP_WP_INVERTED (1 << 2) -#define MMC_PROP_CD_INVERTED (1 << 3) -#define MMC_PROP_DISABLE_WP (1 << 4) -#define MMC_PROP_NO_SDIO (1 << 5) -#define MMC_PROP_NO_SD (1 << 6) -#define MMC_PROP_NO_MMC (1 << 7) +#include -#ifdef EXT_RESOURCES - regulator_t vmmc_supply; - regulator_t vqmmc_supply; -#endif - - device_t mmc_pwrseq; -}; +#define mmc_fdt_helper mmc_helper /* For backwards compatibility */ typedef void (*mmc_fdt_cd_handler)(device_t dev, bool present); -int mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_fdt_helper *helper, struct mmc_host *host); -int mmc_fdt_gpio_setup(device_t dev, phandle_t node, struct mmc_fdt_helper *helper, mmc_fdt_cd_handler handler); -void mmc_fdt_gpio_teardown(struct mmc_fdt_helper *helper); -bool mmc_fdt_gpio_get_present(struct mmc_fdt_helper *helper); -bool mmc_fdt_gpio_get_readonly(struct mmc_fdt_helper *helper); -void mmc_fdt_set_power(struct mmc_fdt_helper *helper, enum mmc_power_mode power_mode); +int mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_helper *helper, struct mmc_host *host); +int mmc_fdt_gpio_setup(device_t dev, phandle_t node, struct mmc_helper *helper, mmc_fdt_cd_handler handler); +void mmc_fdt_gpio_teardown(struct mmc_helper *helper); +bool mmc_fdt_gpio_get_present(struct mmc_helper *helper); +bool mmc_fdt_gpio_get_readonly(struct mmc_helper *helper); +void mmc_fdt_set_power(struct mmc_helper *helper, enum mmc_power_mode power_mode); #endif diff --git a/sys/dev/mmc/mmc_helpers.c b/sys/dev/mmc/mmc_helpers.c new file mode 100644 index 000000000000..0e1e16666367 --- /dev/null +++ b/sys/dev/mmc/mmc_helpers.c @@ -0,0 +1,134 @@ +/* + * Copyright 2019 Emmanuel Vadot + * Copyright (c) 2017 Ian Lepore All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include + +static inline void +mmc_parse_sd_speed(device_t dev, struct mmc_host *host) +{ + bool no_18v = false; + + /* + * Parse SD supported modes + * All UHS-I modes requires 1.8V signaling. + */ + if (device_has_property(dev, "no-1-8-v")) + no_18v = true; + if (device_has_property(dev, "cap-sd-highspeed")) + host->caps |= MMC_CAP_HSPEED; + if (device_has_property(dev, "sd-uhs-sdr12") && !no_18v) + host->caps |= MMC_CAP_UHS_SDR12 | MMC_CAP_SIGNALING_180; + if (device_has_property(dev, "sd-uhs-sdr25") && !no_18v) + host->caps |= MMC_CAP_UHS_SDR25 | MMC_CAP_SIGNALING_180; + if (device_has_property(dev, "sd-uhs-sdr50") && !no_18v) + host->caps |= MMC_CAP_UHS_SDR50 | MMC_CAP_SIGNALING_180; + if (device_has_property(dev, "sd-uhs-sdr104") && !no_18v) + host->caps |= MMC_CAP_UHS_SDR104 | MMC_CAP_SIGNALING_180; + if (device_has_property(dev, "sd-uhs-ddr50") && !no_18v) + host->caps |= MMC_CAP_UHS_DDR50 | MMC_CAP_SIGNALING_180; +} + +static inline void +mmc_parse_mmc_speed(device_t dev, struct mmc_host *host) +{ + /* Parse eMMC supported modes */ + if (device_has_property(dev, "cap-mmc-highspeed")) + host->caps |= MMC_CAP_HSPEED; + if (device_has_property(dev, "mmc-ddr-1_2v")) + host->caps |= MMC_CAP_MMC_DDR52_120 | MMC_CAP_SIGNALING_120; + if (device_has_property(dev, "mmc-ddr-1_8v")) + host->caps |= MMC_CAP_MMC_DDR52_180 | MMC_CAP_SIGNALING_180; + if (device_has_property(dev, "mmc-ddr-3_3v")) + host->caps |= MMC_CAP_SIGNALING_330; + if (device_has_property(dev, "mmc-hs200-1_2v")) + host->caps |= MMC_CAP_MMC_HS200_120 | MMC_CAP_SIGNALING_120; + if (device_has_property(dev, "mmc-hs200-1_8v")) + host->caps |= MMC_CAP_MMC_HS200_180 | MMC_CAP_SIGNALING_180; + if (device_has_property(dev, "mmc-hs400-1_2v")) + host->caps |= MMC_CAP_MMC_HS400_120 | MMC_CAP_SIGNALING_120; + if (device_has_property(dev, "mmc-hs400-1_8v")) + host->caps |= MMC_CAP_MMC_HS400_180 | MMC_CAP_SIGNALING_180; + if (device_has_property(dev, "mmc-hs400-enhanced-strobe")) + host->caps |= MMC_CAP_MMC_ENH_STROBE; +} + +int +mmc_parse(device_t dev, struct mmc_helper *helper, struct mmc_host *host) +{ + uint64_t bus_width, max_freq; + + bus_width = 0; + if (device_get_property(dev, "bus-width", &bus_width, sizeof(uint64_t)) <= 0) + bus_width = 1; + + if (bus_width >= 4) + host->caps |= MMC_CAP_4_BIT_DATA; + if (bus_width >= 8) + host->caps |= MMC_CAP_8_BIT_DATA; + + /* + * max-frequency is optional, drivers should tweak this value + * if it's not present based on the clock that the mmc controller + * operates on + */ + max_freq = 0; + device_get_property(dev, "max-frequency", &max_freq, sizeof(uint64_t)); + host->f_max = max_freq; + + if (device_has_property(dev, "broken-cd")) + helper->props |= MMC_PROP_BROKEN_CD; + if (device_has_property(dev, "non-removable")) + helper->props |= MMC_PROP_NON_REMOVABLE; + if (device_has_property(dev, "wp-inverted")) + helper->props |= MMC_PROP_WP_INVERTED; + if (device_has_property(dev, "cd-inverted")) + helper->props |= MMC_PROP_CD_INVERTED; + if (device_has_property(dev, "no-sdio")) + helper->props |= MMC_PROP_NO_SDIO; + if (device_has_property(dev, "no-sd")) + helper->props |= MMC_PROP_NO_SD; + if (device_has_property(dev, "no-mmc")) + helper->props |= MMC_PROP_NO_MMC; + + if (!(helper->props & MMC_PROP_NO_SD)) + mmc_parse_sd_speed(dev, host); + + if (!(helper->props & MMC_PROP_NO_MMC)) + mmc_parse_mmc_speed(dev, host); + + return (0); +} diff --git a/sys/dev/mmc/mmc_helpers.h b/sys/dev/mmc/mmc_helpers.h new file mode 100644 index 000000000000..e402e587a159 --- /dev/null +++ b/sys/dev/mmc/mmc_helpers.h @@ -0,0 +1,70 @@ +/* + * Copyright 2019 Emmanuel Vadot + * Copyright (c) 2017 Ian Lepore All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MMC_HELPERS_H_ +#define _MMC_HELPERS_H_ + +#include + +#ifdef EXT_RESOURCES +#include +#endif + +struct mmc_helper { + device_t dev; + gpio_pin_t wp_pin; + gpio_pin_t cd_pin; + void * cd_ihandler; + struct resource * cd_ires; + int cd_irid; + void (*cd_handler)(device_t, bool); + struct timeout_task cd_delayed_task; + bool cd_disabled; + bool wp_disabled; + bool cd_present; + uint32_t props; +#define MMC_PROP_BROKEN_CD (1 << 0) +#define MMC_PROP_NON_REMOVABLE (1 << 1) +#define MMC_PROP_WP_INVERTED (1 << 2) +#define MMC_PROP_CD_INVERTED (1 << 3) +#define MMC_PROP_DISABLE_WP (1 << 4) +#define MMC_PROP_NO_SDIO (1 << 5) +#define MMC_PROP_NO_SD (1 << 6) +#define MMC_PROP_NO_MMC (1 << 7) + +#ifdef EXT_RESOURCES + regulator_t vmmc_supply; + regulator_t vqmmc_supply; +#endif + + device_t mmc_pwrseq; +}; + +int mmc_parse(device_t dev, struct mmc_helper *helper, + struct mmc_host *host); + +#endif diff --git a/sys/dev/sdhci/sdhci_fsl_fdt.c b/sys/dev/sdhci/sdhci_fsl_fdt.c index 91d926c343cc..5aec394b9192 100644 --- a/sys/dev/sdhci/sdhci_fsl_fdt.c +++ b/sys/dev/sdhci/sdhci_fsl_fdt.c @@ -106,7 +106,7 @@ struct sdhci_fsl_fdt_softc { bool slot_init_done; uint32_t cmd_and_mode; uint16_t sdclk_bits; - struct mmc_fdt_helper fdt_helper; + struct mmc_helper fdt_helper; uint32_t (* read)(struct sdhci_fsl_fdt_softc *, bus_size_t); void (* write)(struct sdhci_fsl_fdt_softc *, bus_size_t, uint32_t); diff --git a/sys/dev/sdhci/sdhci_xenon.c b/sys/dev/sdhci/sdhci_xenon.c index b6f7513245eb..d88514d8fd8f 100644 --- a/sys/dev/sdhci/sdhci_xenon.c +++ b/sys/dev/sdhci/sdhci_xenon.c @@ -94,7 +94,7 @@ struct sdhci_xenon_softc { uint8_t zpr; /* PHY ZPR */ bool slow_mode; /* PHY slow mode */ - struct mmc_fdt_helper mmc_helper; /* MMC helper for parsing FDT */ + struct mmc_helper mmc_helper; /* MMC helper for parsing FDT */ }; static uint8_t From owner-dev-commits-src-all@freebsd.org Mon Sep 20 16:26:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB4A46A96AE; Mon, 20 Sep 2021 16:26:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCqgM4CgWz4SSb; Mon, 20 Sep 2021 16:26:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C6DD13AE2; Mon, 20 Sep 2021 16:26:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18KGQ7VL000931; Mon, 20 Sep 2021 16:26:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KGQ7cU000930; Mon, 20 Sep 2021 16:26:07 GMT (envelope-from git) Date: Mon, 20 Sep 2021 16:26:07 GMT Message-Id: <202109201626.18KGQ7cU000930@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 9e0c051249e3 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 9e0c051249e3832e0f6a0067058ff9735677f3d5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 16:26:07 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9e0c051249e3832e0f6a0067058ff9735677f3d5 commit 9e0c051249e3832e0f6a0067058ff9735677f3d5 Author: Mark Johnston AuthorDate: 2021-09-20 16:07:29 +0000 Commit: Mark Johnston CommitDate: 2021-09-20 16:07:29 +0000 opencrypto: Allow kern.crypto.allow_soft to be specified as a tunable MFC after: 1 week Sponsored by: The FreeBSD Foundation --- 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 9a992100f222..ef8422d5f32c 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -189,11 +189,11 @@ SYSCTL_INT(_kern, OID_AUTO, crypto_workers_num, CTLFLAG_RDTUN, static uma_zone_t cryptop_zone; int crypto_devallowsoft = 0; -SYSCTL_INT(_kern_crypto, OID_AUTO, allow_soft, CTLFLAG_RW, +SYSCTL_INT(_kern_crypto, OID_AUTO, allow_soft, CTLFLAG_RWTUN, &crypto_devallowsoft, 0, "Enable use of software crypto by /dev/crypto"); #ifdef COMPAT_FREEBSD12 -SYSCTL_INT(_kern, OID_AUTO, cryptodevallowsoft, CTLFLAG_RW, +SYSCTL_INT(_kern, OID_AUTO, cryptodevallowsoft, CTLFLAG_RWTUN, &crypto_devallowsoft, 0, "Enable/disable use of software crypto by /dev/crypto"); #endif From owner-dev-commits-src-all@freebsd.org Mon Sep 20 18:07:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B344D6AACD2; Mon, 20 Sep 2021 18:07: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 4HCswT4Vfnz4gps; Mon, 20 Sep 2021 18:07: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 7B56D150D4; Mon, 20 Sep 2021 18:07: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 18KI7btS034187; Mon, 20 Sep 2021 18:07:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KI7bbK034186; Mon, 20 Sep 2021 18:07:37 GMT (envelope-from git) Date: Mon, 20 Sep 2021 18:07:37 GMT Message-Id: <202109201807.18KI7bbK034186@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: c937a405bdce - main - vt: call driver's postswitch when panicking on ttyv0 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/main X-Git-Reftype: branch X-Git-Commit: c937a405bdce2fd12c534446a8cc9e5548dd27eb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 18:07:37 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=c937a405bdce2fd12c534446a8cc9e5548dd27eb commit c937a405bdce2fd12c534446a8cc9e5548dd27eb Author: Greg V AuthorDate: 2021-04-24 11:53:34 +0000 Commit: Toomas Soome CommitDate: 2021-09-20 17:29:37 +0000 vt: call driver's postswitch when panicking on ttyv0 In vt_kms, the postswitch callback restores fbdev mode when panicking or entering the debugger. This ensures that even when a graphical applicatino was running on the first tty, simple framebuffer mode would be restored and the panic would be visible instead of the frozen GUI. But vt wouldn't call the postswitch callback when we're already on the first tty, so running a GUI on it would prevent you from reading any panics. Reviewed by: tsoome MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29961 --- sys/dev/vt/vt_core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 2693c32d45be..fac1ad898db9 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -594,7 +594,13 @@ vt_window_switch(struct vt_window *vw) VT_LOCK(vd); if (curvw == vw) { - /* Nothing to do. */ + /* + * Nothing to do, except ensure the driver has the opportunity to + * switch to console mode when panicking, making sure the panic + * is readable (even when a GUI was using ttyv0). + */ + if ((kdb_active || panicstr) && vd->vd_driver->vd_postswitch) + vd->vd_driver->vd_postswitch(vd); VT_UNLOCK(vd); return (0); } From owner-dev-commits-src-all@freebsd.org Mon Sep 20 19:46:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C68DF6AC4C4; Mon, 20 Sep 2021 19:46:19 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (cross.sbone.de [195.201.62.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCw6L3GHDz4rMy; Mon, 20 Sep 2021 19:46:18 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id BBBD78D4A213; Mon, 20 Sep 2021 19:46:10 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 39040E708BC; Mon, 20 Sep 2021 19:46:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id p011RmGc1enj; Mon, 20 Sep 2021 19:46:08 +0000 (UTC) Received: from nv.sbone.de (nv.sbone.de [IPv6:fde9:577b:c1a9:31::2013:138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 86A25E708BA; Mon, 20 Sep 2021 19:46:08 +0000 (UTC) Date: Mon, 20 Sep 2021 19:46:07 +0000 (UTC) From: "Bjoern A. Zeeb" To: Toomas Soome cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: b4cb3fe0e39a - main - loader: implement mount/unmount rootfs In-Reply-To: <202109081249.188CncXF065953@gitrepo.freebsd.org> Message-ID: References: <202109081249.188CncXF065953@gitrepo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Rspamd-Queue-Id: 4HCw6L3GHDz4rMy X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of bzeeb-lists@lists.zabbadoz.net designates 195.201.62.131 as permitted sender) smtp.mailfrom=bzeeb-lists@lists.zabbadoz.net X-Spamd-Result: default: False [-3.30 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+ip4:195.201.62.131]; DMARC_NA(0.00)[zabbadoz.net]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:195.201.0.0/16, country:DE]; RCVD_TLS_LAST(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 19:46:19 -0000 On Wed, 8 Sep 2021, Toomas Soome wrote: > The branch main has been updated by tsoome: > > URL: https://cgit.FreeBSD.org/src/commit/?id=b4cb3fe0e39a31e60292018dc9fb7510b3de92bf > > commit b4cb3fe0e39a31e60292018dc9fb7510b3de92bf > Author: Toomas Soome > AuthorDate: 2021-08-12 05:45:52 +0000 > Commit: Toomas Soome > CommitDate: 2021-09-08 01:01:20 +0000 > > loader: implement mount/unmount rootfs > > We want to keep our root file system open to preserve bcache segment > between file accesses, thus reducing physical disk IO. > > Reviewed by: imp, allanjude, kevans (previous version) > Differential Revision: https://reviews.freebsd.org/D30848 > MFC after: 1 month This makes netbooting on at least one of my arm64 impossible: ------------------------------------------------------------------------ Consoles: serial port Reading loader env vars from /efi/freebsd/loader.env FreeBSD/arm64 EFI loader, Revision 1.1 (Mon Sep 20 13:12:35 UTC 2021 root@localhost) Command line arguments: loader.efi Image base: 0xeb7e9000 EFI version: 2.70 EFI Firmware: EDK II (rev 1.00) Console: comconsole (0) Load Path: Load Device: MAC(xxxxxxxxxxxx,0x1)/IPv4(0.0.0.0) BootCurrent: 0004 BootOrder: 0000 0001 0002 0003 0008 0004[*] 0005 0006 0007 BootInfo Path: MAC(xxxxxxxxxxxx,0x1)/IPv4(0.0.0.0) Ignoring Boot0004: Only one DP found Setting currdev to net0: Synchronous Exception at 0x00000000EB8217A8 ------------------------------------------------------------------------ I've backed out this change and rebuild and things boot fine again. Any idea what I could try? /bz -- Bjoern A. Zeeb r15:7 From owner-dev-commits-src-all@freebsd.org Mon Sep 20 20:22:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B0A16AD290; Mon, 20 Sep 2021 20:22: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 4HCwwL43PFz3ByK; Mon, 20 Sep 2021 20:22: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 612E61719A; Mon, 20 Sep 2021 20:22: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 18KKMgmN021799; Mon, 20 Sep 2021 20:22:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KKMg8V021798; Mon, 20 Sep 2021 20:22:42 GMT (envelope-from git) Date: Mon, 20 Sep 2021 20:22:42 GMT Message-Id: <202109202022.18KKMg8V021798@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 0f28c893a8b7 - stable/12 - Remove unnecessary WITNESS check in x86 bus_dma MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0f28c893a8b7b24e778e849acf699ac35c5117d0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 20:22:42 -0000 The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=0f28c893a8b7b24e778e849acf699ac35c5117d0 commit 0f28c893a8b7b24e778e849acf699ac35c5117d0 Author: Jason A. Harmening AuthorDate: 2020-06-03 00:16:36 +0000 Commit: Mateusz Guzik CommitDate: 2021-09-20 20:22:29 +0000 Remove unnecessary WITNESS check in x86 bus_dma When I did some bus_dma cleanup in r320528, I brought forward some sketchy WITNESS checks from the prior x86 busdma wrappers, instead of recognizing them as technical debt and just dropping them. Two of these were removed in r346351 and r346851, but one remains in bounce_bus_dmamem_alloc(). This check could be constrained to only apply in the BUS_DMA_NOWAIT case, but it's cleaner to simply remove it and rely on the checks already present in the sleepable allocation paths used by this function. While here, remove another unnecessary witness check in bus_dma_tag_create (the tag is always allocated with M_NOWAIT), and fix a couple of typos. Reported by: cem Reviewed by: kib, cem MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25107 (cherry picked from commit 1dccf71b4b6dca1a912f3085918239559498c508) --- sys/x86/x86/busdma_bounce.c | 4 +--- sys/x86/x86/busdma_machdep.c | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/sys/x86/x86/busdma_bounce.c b/sys/x86/x86/busdma_bounce.c index d25f29ff8e38..462ab66888e2 100644 --- a/sys/x86/x86/busdma_bounce.c +++ b/sys/x86/x86/busdma_bounce.c @@ -406,8 +406,6 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void **vaddr, int flags, vm_memattr_t attr; int mflags; - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s", __func__); - if (flags & BUS_DMA_NOWAIT) mflags = M_NOWAIT; else @@ -491,7 +489,7 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void **vaddr, int flags, } /* - * Free a piece of memory and it's allociated dmamap, that was allocated + * Free a piece of memory and its associated dmamap, that was allocated * via bus_dmamem_alloc. Make the same choice for free/contigfree. */ static void diff --git a/sys/x86/x86/busdma_machdep.c b/sys/x86/x86/busdma_machdep.c index 152fec591417..e0286c9d6f96 100644 --- a/sys/x86/x86/busdma_machdep.c +++ b/sys/x86/x86/busdma_machdep.c @@ -223,8 +223,6 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, struct bus_dma_tag_common *tc; int error; - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s", __func__); - if (parent == NULL) { error = bus_dma_bounce_impl.tag_create(parent, alignment, boundary, lowaddr, highaddr, filter, filterarg, maxsize, From owner-dev-commits-src-all@freebsd.org Mon Sep 20 20:27:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B74C6AD392; Mon, 20 Sep 2021 20:27:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCx243LsQz3C2y; Mon, 20 Sep 2021 20:27:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52E1B168E2; Mon, 20 Sep 2021 20:27:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18KKRejb022258; Mon, 20 Sep 2021 20:27:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KKReeQ022257; Mon, 20 Sep 2021 20:27:40 GMT (envelope-from git) Date: Mon, 20 Sep 2021 20:27:40 GMT Message-Id: <202109202027.18KKReeQ022257@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 922bee44e400 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 922bee44e400321ac98b3b371cde3f0ff6137dd0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 20:27:40 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=922bee44e400321ac98b3b371cde3f0ff6137dd0 commit 922bee44e400321ac98b3b371cde3f0ff6137dd0 Author: Konstantin Belousov AuthorDate: 2021-09-20 09:30:54 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-20 18:39:46 +0000 aio_fsync_vnode: use for(;;) loop instead of label Reviewed by: jhb, tmunro Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32023 --- 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 2da1a81d41bc..66792ccc1b92 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -724,24 +724,29 @@ static int aio_fsync_vnode(struct thread *td, struct vnode *vp, int op) { struct mount *mp; + vm_object_t obj; int error; - if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) - goto drop; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - if (vp->v_object != NULL) { - VM_OBJECT_WLOCK(vp->v_object); - vm_object_page_clean(vp->v_object, 0, 0, 0); - VM_OBJECT_WUNLOCK(vp->v_object); - } - if (op == LIO_DSYNC) - error = VOP_FDATASYNC(vp, td); - else - error = VOP_FSYNC(vp, MNT_WAIT, td); + for (;;) { + error = vn_start_write(vp, &mp, V_WAIT | PCATCH); + if (error != 0) + break; + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + obj = vp->v_object; + if (obj != NULL) { + VM_OBJECT_WLOCK(obj); + vm_object_page_clean(obj, 0, 0, 0); + VM_OBJECT_WUNLOCK(obj); + } + if (op == LIO_DSYNC) + error = VOP_FDATASYNC(vp, td); + else + error = VOP_FSYNC(vp, MNT_WAIT, td); - VOP_UNLOCK(vp); - vn_finished_write(mp); -drop: + VOP_UNLOCK(vp); + vn_finished_write(mp); + break; + } return (error); } From owner-dev-commits-src-all@freebsd.org Mon Sep 20 20:27:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF0FE6AD0FD; Mon, 20 Sep 2021 20:27:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCx254GVZz4vwq; Mon, 20 Sep 2021 20:27:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73B44171A2; Mon, 20 Sep 2021 20:27:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18KKRfk8022282; Mon, 20 Sep 2021 20:27:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KKRfUU022281; Mon, 20 Sep 2021 20:27:41 GMT (envelope-from git) Date: Mon, 20 Sep 2021 20:27:41 GMT Message-Id: <202109202027.18KKRfUU022281@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 2933a7ca03f1 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 2933a7ca03f16ba7b048a9bd2b3df1fc3cf9c344 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 20:27:41 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2933a7ca03f16ba7b048a9bd2b3df1fc3cf9c344 commit 2933a7ca03f16ba7b048a9bd2b3df1fc3cf9c344 Author: Konstantin Belousov AuthorDate: 2021-09-20 09:32:28 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-20 18:40:17 +0000 aio_fsync_vnode: handle ERELOOKUP after VOP_FSYNC() Reported by: tmunro Reviewed by: jhb, tmunro Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32023 --- 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 66792ccc1b92..87c45bf2c078 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -745,7 +745,8 @@ aio_fsync_vnode(struct thread *td, struct vnode *vp, int op) VOP_UNLOCK(vp); vn_finished_write(mp); - break; + if (error != ERELOOKUP) + break; } return (error); } From owner-dev-commits-src-all@freebsd.org Mon Sep 20 20:50:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6F426AD85C; Mon, 20 Sep 2021 20:50: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 4HCxXd3Nwjz3D6w; Mon, 20 Sep 2021 20:50: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 5612517786; Mon, 20 Sep 2021 20:50: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 18KKoff2057410; Mon, 20 Sep 2021 20:50:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KKofB9057409; Mon, 20 Sep 2021 20:50:41 GMT (envelope-from git) Date: Mon, 20 Sep 2021 20:50:41 GMT Message-Id: <202109202050.18KKofB9057409@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 6583e845436e - stable/13 - ixl(4): Add tunable to override Flow Control settings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6583e845436e45024316b4fdaa47d6a0d25fb37a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 20:50:41 -0000 The branch stable/13 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=6583e845436e45024316b4fdaa47d6a0d25fb37a commit 6583e845436e45024316b4fdaa47d6a0d25fb37a Author: Krzysztof Galazka AuthorDate: 2021-04-05 18:08:33 +0000 Commit: Eric Joyner CommitDate: 2021-09-20 20:42:13 +0000 ixl(4): Add tunable to override Flow Control settings Add flow_control to hw.ixl tunables tree to let override initial flow control configuration for all interfaces. Keep using configuration set by NVM by default. Reviewed by: erj@, gallatin@ Tested by: gowtham.kumar.ks_intel.com Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D29338 (cherry picked from commit 20a52706c814ccfd91c65586404abd2a1563a330) --- sys/dev/ixl/if_ixl.c | 19 +++++++++++++++++++ sys/dev/ixl/ixl_pf_iflib.c | 2 +- sys/dev/ixl/ixl_pf_main.c | 40 +++++++++++++++++++++++----------------- 3 files changed, 43 insertions(+), 18 deletions(-) diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index c700af889cf1..3b49da5d76b9 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -304,6 +304,10 @@ TUNABLE_INT("hw.ixl.tx_itr", &ixl_tx_itr); SYSCTL_INT(_hw_ixl, OID_AUTO, tx_itr, CTLFLAG_RDTUN, &ixl_tx_itr, 0, "TX Interrupt Rate"); +static int ixl_flow_control = -1; +SYSCTL_INT(_hw_ixl, OID_AUTO, flow_control, CTLFLAG_RDTUN, + &ixl_flow_control, 0, "Initial Flow Control setting"); + #ifdef IXL_IW int ixl_enable_iwarp = 0; TUNABLE_INT("hw.ixl.enable_iwarp", &ixl_enable_iwarp); @@ -1892,5 +1896,20 @@ ixl_save_pf_tunables(struct ixl_pf *pf) pf->rx_itr = IXL_ITR_8K; } else pf->rx_itr = ixl_rx_itr; + + pf->fc = -1; + if (ixl_flow_control != -1) { + if (ixl_flow_control < 0 || ixl_flow_control > 3) { + device_printf(dev, + "Invalid flow_control value of %d set!\n", + ixl_flow_control); + device_printf(dev, + "flow_control must be between %d and %d, " + "inclusive\n", 0, 3); + device_printf(dev, + "Using default configuration instead\n"); + } else + pf->fc = ixl_flow_control; + } } diff --git a/sys/dev/ixl/ixl_pf_iflib.c b/sys/dev/ixl/ixl_pf_iflib.c index 23d9f30299a9..68a174889c41 100644 --- a/sys/dev/ixl/ixl_pf_iflib.c +++ b/sys/dev/ixl/ixl_pf_iflib.c @@ -1094,7 +1094,7 @@ ixl_sysctl_set_flowcntl(SYSCTL_HANDLER_ARGS) aq_error = i40e_set_fc(hw, &fc_aq_err, TRUE); if (aq_error) { device_printf(dev, - "%s: Error setting new fc mode %d; fc_err %#x\n", + "%s: Error setting Flow Control mode %d; fc_err %#x\n", __func__, aq_error, fc_aq_err); return (EIO); } diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index b546701608f1..896da955843a 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -3169,27 +3169,28 @@ ixl_set_link(struct ixl_pf *pf, bool enable) config.phy_type = 0; config.phy_type_ext = 0; + config.abilities &= ~(I40E_AQ_PHY_FLAG_PAUSE_TX | + I40E_AQ_PHY_FLAG_PAUSE_RX); + + switch (pf->fc) { + case I40E_FC_FULL: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX | + I40E_AQ_PHY_FLAG_PAUSE_RX; + break; + case I40E_FC_RX_PAUSE: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_RX; + break; + case I40E_FC_TX_PAUSE: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX; + break; + default: + break; + } + if (enable) { config.phy_type = phy_type; config.phy_type_ext = phy_type_ext; - config.abilities &= ~(I40E_AQ_PHY_FLAG_PAUSE_TX | - I40E_AQ_PHY_FLAG_PAUSE_RX); - - switch (pf->fc) { - case I40E_FC_FULL: - config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX | - I40E_AQ_PHY_FLAG_PAUSE_RX; - break; - case I40E_FC_RX_PAUSE: - config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_RX; - break; - case I40E_FC_TX_PAUSE: - config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX; - break; - default: - break; - } } aq_error = i40e_aq_set_phy_config(hw, &config, NULL); @@ -4594,6 +4595,11 @@ ixl_attach_get_link_status(struct ixl_pf *pf) /* Determine link state */ hw->phy.get_link_info = TRUE; i40e_get_link_status(hw, &pf->link_up); + + /* Flow Control mode not set by user, read current FW settings */ + if (pf->fc == -1) + pf->fc = hw->fc.current_mode; + return (0); } From owner-dev-commits-src-all@freebsd.org Mon Sep 20 20:50:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A888C6AD7B1; Mon, 20 Sep 2021 20:50: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 4HCxXf4QGTz3D6x; Mon, 20 Sep 2021 20:50: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 78BB2174B4; Mon, 20 Sep 2021 20:50: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 18KKog8c057434; Mon, 20 Sep 2021 20:50:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KKogVo057433; Mon, 20 Sep 2021 20:50:42 GMT (envelope-from git) Date: Mon, 20 Sep 2021 20:50:42 GMT Message-Id: <202109202050.18KKogVo057433@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 6f6013102be0 - stable/13 - ixl(4): Fix reporting of unqualified transceivers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6f6013102be03f914bd2471236ff098c961c9717 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 20:50:42 -0000 The branch stable/13 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=6f6013102be03f914bd2471236ff098c961c9717 commit 6f6013102be03f914bd2471236ff098c961c9717 Author: Krzysztof Galazka AuthorDate: 2021-08-20 21:12:28 +0000 Commit: Eric Joyner CommitDate: 2021-09-20 20:42:55 +0000 ixl(4): Fix reporting of unqualified transceivers When link_active_on_if_down flag is disabled and link is brought down with ifconfig, FW reports a false positive link event about an unqualified transceiver. The condition used in the driver to filter out those false positive events was incorrect and caused that unqualified module event to also not be reported when the event was valid. Change the condition to rely on IFF_UP flag instead of link_active_on_if_down and bump driver version to 2.3.1-k. Signed-off-by: Krzysztof Galazka Signed-off-by: Eric Joyner Reviewed by: stallamr@netapp.com, erj@ Tested by: gowtham.kumar.ks@intel.com Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D30733 (cherry picked from commit c4622b01d2f12b889b57ff7d0b03a38dfcb00fd8) --- sys/dev/ixl/if_ixl.c | 2 +- sys/dev/ixl/ixl_pf_iflib.c | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index 3b49da5d76b9..f620771e93b1 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -49,7 +49,7 @@ *********************************************************************/ #define IXL_DRIVER_VERSION_MAJOR 2 #define IXL_DRIVER_VERSION_MINOR 3 -#define IXL_DRIVER_VERSION_BUILD 0 +#define IXL_DRIVER_VERSION_BUILD 1 #define IXL_DRIVER_VERSION_STRING \ __XSTRING(IXL_DRIVER_VERSION_MAJOR) "." \ diff --git a/sys/dev/ixl/ixl_pf_iflib.c b/sys/dev/ixl/ixl_pf_iflib.c index 68a174889c41..6ea20389c547 100644 --- a/sys/dev/ixl/ixl_pf_iflib.c +++ b/sys/dev/ixl/ixl_pf_iflib.c @@ -403,20 +403,23 @@ ixl_link_event(struct ixl_pf *pf, struct i40e_arq_event_info *e) { struct i40e_hw *hw = &pf->hw; device_t dev = iflib_get_dev(pf->vsi.ctx); - struct i40e_aqc_get_link_status *status = - (struct i40e_aqc_get_link_status *)&e->desc.params.raw; - - /* Request link status from adapter */ + struct i40e_link_status *link_info = &hw->phy.link_info; + + /* Driver needs to re-enable delivering of link status events + * by FW after each event reception. Call i40e_get_link_status + * to do that. To not lose information about link state changes, + * which happened between receiving an event and the call, + * do not rely on status from event but use most recent + * status information retrieved by the call. */ hw->phy.get_link_info = TRUE; i40e_get_link_status(hw, &pf->link_up); /* Print out message if an unqualified module is found */ - if ((status->link_info & I40E_AQ_MEDIA_AVAILABLE) && + if ((link_info->link_info & I40E_AQ_MEDIA_AVAILABLE) && (pf->advertised_speed) && - (atomic_load_32(&pf->state) & - IXL_PF_STATE_LINK_ACTIVE_ON_DOWN) != 0 && - (!(status->an_info & I40E_AQ_QUALIFIED_MODULE)) && - (!(status->link_info & I40E_AQ_LINK_UP))) + (if_getflags(pf->vsi.ifp) & IFF_UP) && + (!(link_info->an_info & I40E_AQ_QUALIFIED_MODULE)) && + (!(link_info->link_info & I40E_AQ_LINK_UP))) device_printf(dev, "Link failed because " "an unqualified module was detected!\n"); From owner-dev-commits-src-all@freebsd.org Mon Sep 20 20:50:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C4A526AD3D4; Mon, 20 Sep 2021 20:50: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 4HCxXg57Xfz3D74; Mon, 20 Sep 2021 20:50: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 89BC21770A; Mon, 20 Sep 2021 20:50: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 18KKoh1N057458; Mon, 20 Sep 2021 20:50:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KKoh1H057457; Mon, 20 Sep 2021 20:50:43 GMT (envelope-from git) Date: Mon, 20 Sep 2021 20:50:43 GMT Message-Id: <202109202050.18KKoh1H057457@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 3917b3c7e5e1 - stable/13 - ixl(4): Fix 2.5 and 5G speeds reporting and update shared code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3917b3c7e5e18cccd3216bc3925efb0bc1e8affe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 20:50:43 -0000 The branch stable/13 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=3917b3c7e5e18cccd3216bc3925efb0bc1e8affe commit 3917b3c7e5e18cccd3216bc3925efb0bc1e8affe Author: Krzysztof Galazka AuthorDate: 2021-09-13 20:39:59 +0000 Commit: Eric Joyner CommitDate: 2021-09-20 20:43:29 +0000 ixl(4): Fix 2.5 and 5G speeds reporting and update shared code Fix 2.5 and 5G speeds reporting and update shared code with recent changes: - Update expected FW API versions for X710 and X722 adapters - Define pointers related to Preservation Rules Module - Add definitions for Shadow RAM pointers to new modules: 5th and 6th FPA, and Preservation Rules Module. - Add I40E_RX_PTYPE_PARSER_ABORTED definition, so the driver will know opcode for parser aborted packets. - Add the new filter types needed for custom cloud filters. - Add support for Minimum Rollback Revision - Fix RX_ONLY mode for unicast promiscuous on VLAN - Add EEE LPI status check for X722 adapters - Fix PHY type identifiers for 2.5G and 5G adapters - Fix update link data for X722 - Increase the timeout value for PF reset to give PF more time to finish reset if it is loaded with filters. - Added support for Min Rollback Revision for 4 more X722 modules - Fix reporting of Active Optical Cable media type - Add flags and fields for double VLAN processing - Fix potentially uninitialized variables in NVM code Reviewed by: kbowling@, mike.jakubik@gmail.com Tested by: gowtham.kumar.ks@intel.com Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D31565 (cherry picked from commit abf774528d7e497460510b0026db85e30f054142) --- sys/dev/ixl/i40e_adminq.c | 6 +- sys/dev/ixl/i40e_adminq_cmd.h | 71 +++++++++++++-- sys/dev/ixl/i40e_common.c | 206 ++++++++++++++++++++++++++---------------- sys/dev/ixl/i40e_dcb.c | 10 +- sys/dev/ixl/i40e_lan_hmc.c | 2 +- sys/dev/ixl/i40e_nvm.c | 13 ++- sys/dev/ixl/i40e_prototype.h | 10 +- sys/dev/ixl/i40e_register.h | 3 + sys/dev/ixl/i40e_type.h | 17 ++-- sys/dev/ixl/if_ixl.c | 4 +- 10 files changed, 234 insertions(+), 108 deletions(-) diff --git a/sys/dev/ixl/i40e_adminq.c b/sys/dev/ixl/i40e_adminq.c index d25798d23bd1..efca7f1e61ff 100644 --- a/sys/dev/ixl/i40e_adminq.c +++ b/sys/dev/ixl/i40e_adminq.c @@ -646,8 +646,10 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw) { struct i40e_adminq_info *aq = &hw->aq; enum i40e_status_code ret_code; - u16 cfg_ptr, oem_hi, oem_lo; - u16 eetrack_lo, eetrack_hi; + u16 oem_hi = 0, oem_lo = 0; + u16 eetrack_hi = 0; + u16 eetrack_lo = 0; + u16 cfg_ptr = 0; int retry = 0; /* verify input for valid configuration */ diff --git a/sys/dev/ixl/i40e_adminq_cmd.h b/sys/dev/ixl/i40e_adminq_cmd.h index 6161805a7cf0..564a076761d0 100644 --- a/sys/dev/ixl/i40e_adminq_cmd.h +++ b/sys/dev/ixl/i40e_adminq_cmd.h @@ -43,8 +43,8 @@ #define I40E_FW_API_VERSION_MAJOR 0x0001 -#define I40E_FW_API_VERSION_MINOR_X722 0x000A -#define I40E_FW_API_VERSION_MINOR_X710 0x000A +#define I40E_FW_API_VERSION_MINOR_X722 0x000C +#define I40E_FW_API_VERSION_MINOR_X710 0x000E #define I40E_FW_MINOR_VERSION(_h) ((_h)->mac.type == I40E_MAC_XL710 ? \ I40E_FW_API_VERSION_MINOR_X710 : \ @@ -267,7 +267,8 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_nvm_update = 0x0703, i40e_aqc_opc_nvm_config_read = 0x0704, i40e_aqc_opc_nvm_config_write = 0x0705, - i40e_aqc_opc_nvm_progress = 0x0706, + i40e_aqc_opc_nvm_update_in_process = 0x0706, + i40e_aqc_opc_rollback_revision_update = 0x0707, i40e_aqc_opc_oem_post_update = 0x0720, i40e_aqc_opc_thermal_sensor = 0x0721, @@ -467,6 +468,7 @@ struct i40e_aqc_list_capabilities_element_resp { #define I40E_AQ_CAP_ID_SDP 0x0062 #define I40E_AQ_CAP_ID_MDIO 0x0063 #define I40E_AQ_CAP_ID_WSR_PROT 0x0064 +#define I40E_AQ_CAP_ID_DIS_UNUSED_PORTS 0x0067 #define I40E_AQ_CAP_ID_NVM_MGMT 0x0080 #define I40E_AQ_CAP_ID_FLEX10 0x00F1 #define I40E_AQ_CAP_ID_CEM 0x00F2 @@ -793,6 +795,7 @@ struct i40e_aqc_set_switch_config { #define I40E_AQ_SET_SWITCH_CFG_PROMISC 0x0001 #define I40E_AQ_SET_SWITCH_CFG_L2_FILTER 0x0002 #define I40E_AQ_SET_SWITCH_CFG_HW_ATR_EVICT 0x0004 +#define I40E_AQ_SET_SWITCH_CFG_OUTER_VLAN 0x0008 __le16 valid_flags; /* The ethertype in switch_tag is dropped on ingress and used * internally by the switch. Set this to zero for the default @@ -929,7 +932,7 @@ struct i40e_aqc_vsi_properties_data { u8 sec_reserved; /* VLAN section */ __le16 pvid; /* VLANS include priority bits */ - __le16 fcoe_pvid; + __le16 outer_vlan; u8 port_vlan_flags; #define I40E_AQ_VSI_PVLAN_MODE_SHIFT 0x00 #define I40E_AQ_VSI_PVLAN_MODE_MASK (0x03 << \ @@ -945,7 +948,24 @@ struct i40e_aqc_vsi_properties_data { #define I40E_AQ_VSI_PVLAN_EMOD_STR_UP 0x08 #define I40E_AQ_VSI_PVLAN_EMOD_STR 0x10 #define I40E_AQ_VSI_PVLAN_EMOD_NOTHING 0x18 - u8 pvlan_reserved[3]; + u8 outer_vlan_flags; +#define I40E_AQ_VSI_OVLAN_MODE_SHIFT 0x00 +#define I40E_AQ_VSI_OVLAN_MODE_MASK (0x03 << \ + I40E_AQ_VSI_OVLAN_MODE_SHIFT) +#define I40E_AQ_VSI_OVLAN_MODE_UNTAGGED 0x01 +#define I40E_AQ_VSI_OVLAN_MODE_TAGGED 0x02 +#define I40E_AQ_VSI_OVLAN_MODE_ALL 0x03 +#define I40E_AQ_VSI_OVLAN_INSERT_PVID 0x04 +#define I40E_AQ_VSI_OVLAN_EMOD_SHIFT 0x03 +#define I40E_AQ_VSI_OVLAN_EMOD_MASK (0x03 <<\ + I40E_AQ_VSI_OVLAN_EMOD_SHIFT) +#define I40E_AQ_VSI_OVLAN_EMOD_SHOW_ALL 0x00 +#define I40E_AQ_VSI_OVLAN_EMOD_SHOW_UP 0x01 +#define I40E_AQ_VSI_OVLAN_EMOD_HIDE_ALL 0x02 +#define I40E_AQ_VSI_OVLAN_EMOD_NOTHING 0x03 +#define I40E_AQ_VSI_OVLAN_CTRL_ENA 0x04 + + u8 pvlan_reserved[2]; /* ingress egress up sections */ __le32 ingress_table; /* bitmap, 3 bits per up */ #define I40E_AQ_VSI_UP_TABLE_UP0_SHIFT 0 @@ -1247,7 +1267,7 @@ struct i40e_aqc_set_vsi_promiscuous_modes { #define I40E_AQC_SET_VSI_PROMISC_BROADCAST 0x04 #define I40E_AQC_SET_VSI_DEFAULT 0x08 #define I40E_AQC_SET_VSI_PROMISC_VLAN 0x10 -#define I40E_AQC_SET_VSI_PROMISC_TX 0x8000 +#define I40E_AQC_SET_VSI_PROMISC_RX_ONLY 0x8000 __le16 seid; #define I40E_AQC_VSI_PROM_CMD_SEID_MASK 0x3FF __le16 vlan_tag; @@ -1433,6 +1453,8 @@ struct i40e_aqc_cloud_filters_element_data { #define I40E_AQC_ADD_CLOUD_FILTER_IMAC 0x000A #define I40E_AQC_ADD_CLOUD_FILTER_OMAC_TEN_ID_IMAC 0x000B #define I40E_AQC_ADD_CLOUD_FILTER_IIP 0x000C +#define I40E_AQC_ADD_CLOUD_FILTER_OIP1 0x0010 +#define I40E_AQC_ADD_CLOUD_FILTER_OIP2 0x0012 /* 0x000D reserved */ /* 0x000E reserved */ /* 0x000F reserved */ @@ -1940,8 +1962,10 @@ enum i40e_aq_phy_type { I40E_PHY_TYPE_25GBASE_LR = 0x22, I40E_PHY_TYPE_25GBASE_AOC = 0x23, I40E_PHY_TYPE_25GBASE_ACC = 0x24, - I40E_PHY_TYPE_2_5GBASE_T = 0x30, - I40E_PHY_TYPE_5GBASE_T = 0x31, + I40E_PHY_TYPE_2_5GBASE_T = 0x26, + I40E_PHY_TYPE_5GBASE_T = 0x27, + I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS = 0x30, + I40E_PHY_TYPE_5GBASE_T_LINK_STATUS = 0x31, I40E_PHY_TYPE_MAX, I40E_PHY_TYPE_NOT_SUPPORTED_HIGH_TEMP = 0xFD, I40E_PHY_TYPE_EMPTY = 0xFE, @@ -2411,6 +2435,16 @@ struct i40e_aqc_nvm_config_data_feature { I40E_CHECK_STRUCT_LEN(0x6, i40e_aqc_nvm_config_data_feature); +/* NVM Update in Process (direct 0x0706) */ +struct i40e_aqc_nvm_update_in_process { + u8 command; +#define I40E_AQ_UPDATE_FLOW_END 0x0 +#define I40E_AQ_UPDATE_FLOW_START 0x1 + u8 reserved[15]; +}; + +I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_update_in_process); + struct i40e_aqc_nvm_config_data_immediate_field { __le32 field_id; __le32 field_value; @@ -2420,6 +2454,27 @@ struct i40e_aqc_nvm_config_data_immediate_field { I40E_CHECK_STRUCT_LEN(0xc, i40e_aqc_nvm_config_data_immediate_field); +/* Minimal Rollback Revision Update (direct 0x0707) */ +struct i40e_aqc_rollback_revision_update { + u8 optin_mode; /* bool */ +#define I40E_AQ_RREV_OPTIN_MODE 0x01 + u8 module_selected; +#define I40E_AQ_RREV_MODULE_PCIE_ANALOG 0 +#define I40E_AQ_RREV_MODULE_PHY_ANALOG 1 +#define I40E_AQ_RREV_MODULE_OPTION_ROM 2 +#define I40E_AQ_RREV_MODULE_EMP_IMAGE 3 +#define I40E_AQ_RREV_MODULE_PE_IMAGE 4 +#define I40E_AQ_RREV_MODULE_PHY_PLL_O_CONFIGURATION 5 +#define I40E_AQ_RREV_MODULE_PHY_0_CONFIGURATION 6 +#define I40E_AQ_RREV_MODULE_PHY_PLL_1_CONFIGURATION 7 +#define I40E_AQ_RREV_MODULE_PHY_1_CONFIGURATION 8 + u8 reserved1[2]; + u32 min_rrev; + u8 reserved2[8]; +}; + +I40E_CHECK_CMD_LENGTH(i40e_aqc_rollback_revision_update); + /* OEM Post Update (indirect 0x0720) * no command data struct used */ diff --git a/sys/dev/ixl/i40e_common.c b/sys/dev/ixl/i40e_common.c index 4325901c0920..332893938c19 100644 --- a/sys/dev/ixl/i40e_common.c +++ b/sys/dev/ixl/i40e_common.c @@ -1251,12 +1251,15 @@ static enum i40e_media_type i40e_get_media_type(struct i40e_hw *hw) case I40E_PHY_TYPE_40GBASE_LR4: case I40E_PHY_TYPE_25GBASE_LR: case I40E_PHY_TYPE_25GBASE_SR: + case I40E_PHY_TYPE_10GBASE_AOC: + case I40E_PHY_TYPE_25GBASE_AOC: + case I40E_PHY_TYPE_40GBASE_AOC: media = I40E_MEDIA_TYPE_FIBER; break; case I40E_PHY_TYPE_100BASE_TX: case I40E_PHY_TYPE_1000BASE_T: - case I40E_PHY_TYPE_2_5GBASE_T: - case I40E_PHY_TYPE_5GBASE_T: + case I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS: + case I40E_PHY_TYPE_5GBASE_T_LINK_STATUS: case I40E_PHY_TYPE_10GBASE_T: media = I40E_MEDIA_TYPE_BASET; break; @@ -1265,10 +1268,7 @@ static enum i40e_media_type i40e_get_media_type(struct i40e_hw *hw) case I40E_PHY_TYPE_10GBASE_CR1: case I40E_PHY_TYPE_40GBASE_CR4: case I40E_PHY_TYPE_10GBASE_SFPP_CU: - case I40E_PHY_TYPE_40GBASE_AOC: - case I40E_PHY_TYPE_10GBASE_AOC: case I40E_PHY_TYPE_25GBASE_CR: - case I40E_PHY_TYPE_25GBASE_AOC: case I40E_PHY_TYPE_25GBASE_ACC: media = I40E_MEDIA_TYPE_DA; break; @@ -1316,7 +1316,7 @@ static enum i40e_status_code i40e_poll_globr(struct i40e_hw *hw, return I40E_ERR_RESET_FAILED; } -#define I40E_PF_RESET_WAIT_COUNT 200 +#define I40E_PF_RESET_WAIT_COUNT 1000 /** * i40e_pf_reset - Reset the PF * @hw: pointer to the hardware structure @@ -1563,7 +1563,6 @@ static u32 i40e_led_is_mine(struct i40e_hw *hw, int idx) **/ u32 i40e_led_get(struct i40e_hw *hw) { - u32 current_mode = 0; u32 mode = 0; int i; @@ -1576,20 +1575,6 @@ u32 i40e_led_get(struct i40e_hw *hw) if (!gpio_val) continue; - /* ignore gpio LED src mode entries related to the activity - * LEDs - */ - current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) - >> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT); - switch (current_mode) { - case I40E_COMBINED_ACTIVITY: - case I40E_FILTER_ACTIVITY: - case I40E_MAC_ACTIVITY: - case I40E_LINK_ACTIVITY: - continue; - default: - break; - } mode = (gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) >> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT; @@ -1610,7 +1595,6 @@ u32 i40e_led_get(struct i40e_hw *hw) **/ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink) { - u32 current_mode = 0; int i; if (mode & ~I40E_LED_MODE_VALID) { @@ -1627,20 +1611,6 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink) if (!gpio_val) continue; - /* ignore gpio LED src mode entries related to the activity - * LEDs - */ - current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) - >> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT); - switch (current_mode) { - case I40E_COMBINED_ACTIVITY: - case I40E_FILTER_ACTIVITY: - case I40E_MAC_ACTIVITY: - case I40E_LINK_ACTIVITY: - continue; - default: - break; - } if (I40E_IS_X710TL_DEVICE(hw->device_id)) { u32 pin_func = 0; @@ -2053,6 +2023,9 @@ enum i40e_status_code i40e_aq_get_link_info(struct i40e_hw *hw, hw->aq.fw_min_ver < 40)) && hw_link_info->phy_type == 0xE) hw_link_info->phy_type = I40E_PHY_TYPE_10GBASE_SFPP_CU; + /* 'Get Link Status' response data structure from X722 FW has + * different format and does not contain this information + */ if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE && hw->mac.type != I40E_MAC_X722) { __le32 tmp; @@ -2251,6 +2224,22 @@ enum i40e_status_code i40e_aq_set_phy_debug(struct i40e_hw *hw, u8 cmd_flags, return status; } +/** + * i40e_hw_ver_ge + * @hw: pointer to the hw struct + * @maj: api major value + * @min: api minor value + * + * Assert whether current HW api version is greater/equal than provided. + **/ +static bool i40e_hw_ver_ge(struct i40e_hw *hw, u16 maj, u16 min) +{ + if (hw->aq.api_maj_ver > maj || + (hw->aq.api_maj_ver == maj && hw->aq.api_min_ver >= min)) + return TRUE; + return FALSE; +} + /** * i40e_aq_add_vsi * @hw: pointer to the hw struct @@ -2376,18 +2365,16 @@ enum i40e_status_code i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw, if (set) { flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST; - if (rx_only_promisc && - (((hw->aq.api_maj_ver == 1) && (hw->aq.api_min_ver >= 5)) || - (hw->aq.api_maj_ver > 1))) - flags |= I40E_AQC_SET_VSI_PROMISC_TX; + if (rx_only_promisc && i40e_hw_ver_ge(hw, 1, 5)) + flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY; } cmd->promiscuous_flags = CPU_TO_LE16(flags); cmd->valid_flags = CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_UNICAST); - if (((hw->aq.api_maj_ver >= 1) && (hw->aq.api_min_ver >= 5)) || - (hw->aq.api_maj_ver > 1)) - cmd->valid_flags |= CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_TX); + if (i40e_hw_ver_ge(hw, 1, 5)) + cmd->valid_flags |= + CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY); cmd->seid = CPU_TO_LE16(seid); status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); @@ -2519,11 +2506,17 @@ enum i40e_status_code i40e_aq_set_vsi_uc_promisc_on_vlan(struct i40e_hw *hw, i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_set_vsi_promiscuous_modes); - if (enable) + if (enable) { flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST; + if (i40e_hw_ver_ge(hw, 1, 5)) + flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY; + } cmd->promiscuous_flags = CPU_TO_LE16(flags); cmd->valid_flags = CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_UNICAST); + if (i40e_hw_ver_ge(hw, 1, 5)) + cmd->valid_flags |= + CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY); cmd->seid = CPU_TO_LE16(seid); cmd->vlan_tag = CPU_TO_LE16(vid | I40E_AQC_SET_VSI_VLAN_VALID); @@ -2633,7 +2626,7 @@ enum i40e_status_code i40e_aq_set_vsi_vlan_promisc(struct i40e_hw *hw, } /** - * i40e_get_vsi_params - get VSI configuration info + * i40e_aq_get_vsi_params - get VSI configuration info * @hw: pointer to the hw struct * @vsi_ctx: pointer to a vsi context struct * @cmd_details: pointer to command details structure or NULL @@ -2893,7 +2886,7 @@ enum i40e_status_code i40e_get_link_status(struct i40e_hw *hw, bool *link_up) } /** - * i40e_updatelink_status - update status of the HW network link + * i40e_update_link_info - update status of the HW network link * @hw: pointer to the hw struct **/ enum i40e_status_code i40e_update_link_info(struct i40e_hw *hw) @@ -2906,10 +2899,13 @@ enum i40e_status_code i40e_update_link_info(struct i40e_hw *hw) return status; /* extra checking needed to ensure link info to user is timely */ - if ((hw->phy.link_info.link_info & I40E_AQ_MEDIA_AVAILABLE) && - ((hw->phy.link_info.link_info & I40E_AQ_LINK_UP) || - !(hw->phy.link_info_old.link_info & I40E_AQ_LINK_UP))) { - status = i40e_aq_get_phy_capabilities(hw, FALSE, false, + if (((hw->phy.link_info.link_info & I40E_AQ_MEDIA_AVAILABLE) && + ((hw->phy.link_info.link_info & I40E_AQ_LINK_UP) || + !(hw->phy.link_info_old.link_info & I40E_AQ_LINK_UP))) || + hw->mac.type == I40E_MAC_X722) { + status = i40e_aq_get_phy_capabilities(hw, FALSE, + hw->mac.type == + I40E_MAC_X722, &abilities, NULL); if (status) return status; @@ -3666,6 +3662,64 @@ enum i40e_status_code i40e_aq_write_nvm_config(struct i40e_hw *hw, return status; } +/** + * i40e_aq_nvm_update_in_process + * @hw: pointer to the hw struct + * @update_flow_state: True indicates that update flow starts, FALSE that ends + * @cmd_details: pointer to command details structure or NULL + * + * Indicate NVM update in process. + **/ +enum i40e_status_code i40e_aq_nvm_update_in_process(struct i40e_hw *hw, + bool update_flow_state, + struct i40e_asq_cmd_details *cmd_details) +{ + struct i40e_aq_desc desc; + struct i40e_aqc_nvm_update_in_process *cmd = + (struct i40e_aqc_nvm_update_in_process *)&desc.params.raw; + enum i40e_status_code status; + + i40e_fill_default_direct_cmd_desc(&desc, + i40e_aqc_opc_nvm_update_in_process); + + cmd->command = I40E_AQ_UPDATE_FLOW_END; + + if (update_flow_state) + cmd->command |= I40E_AQ_UPDATE_FLOW_START; + + status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); + + return status; +} + +/** + * i40e_aq_min_rollback_rev_update - triggers an ow after update + * @hw: pointer to the hw struct + * @mode: opt-in mode, 1b for single module update, 0b for bulk update + * @module: module to be updated. Ignored if mode is 0b + * @min_rrev: value of the new minimal version. Ignored if mode is 0b + * @cmd_details: pointer to command details structure or NULL + **/ +enum i40e_status_code +i40e_aq_min_rollback_rev_update(struct i40e_hw *hw, u8 mode, u8 module, + u32 min_rrev, + struct i40e_asq_cmd_details *cmd_details) +{ + struct i40e_aq_desc desc; + struct i40e_aqc_rollback_revision_update *cmd = + (struct i40e_aqc_rollback_revision_update *)&desc.params.raw; + enum i40e_status_code status; + + i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_rollback_revision_update); + cmd->optin_mode = mode; + cmd->module_selected = module; + cmd->min_rrev = min_rrev; + + status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); + + return status; +} + /** * i40e_aq_oem_post_update - triggers an OEM specific flow after update * @hw: pointer to the hw struct @@ -3998,7 +4052,13 @@ static void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff, p->wr_csr_prot |= (u64)logical_id << 32; i40e_debug(hw, I40E_DEBUG_INIT, "HW Capability: wr_csr_prot = 0x%llX\n\n", - (p->wr_csr_prot & 0xffff)); + (unsigned long long)(p->wr_csr_prot & 0xffff)); + break; + case I40E_AQ_CAP_ID_DIS_UNUSED_PORTS: + p->dis_unused_ports = (bool)number; + i40e_debug(hw, I40E_DEBUG_INIT, + "HW Capability: dis_unused_ports = %d\n\n", + p->dis_unused_ports); break; case I40E_AQ_CAP_ID_NVM_MGMT: if (number & I40E_NVM_MGMT_SEC_REV_DISABLED) @@ -4193,28 +4253,6 @@ i40e_aq_update_nvm_exit: return status; } -/** - * i40e_aq_nvm_progress - * @hw: pointer to the hw struct - * @progress: pointer to progress returned from AQ - * @cmd_details: pointer to command details structure or NULL - * - * Gets progress of flash rearrangement process - **/ -enum i40e_status_code i40e_aq_nvm_progress(struct i40e_hw *hw, u8 *progress, - struct i40e_asq_cmd_details *cmd_details) -{ - enum i40e_status_code status; - struct i40e_aq_desc desc; - - DEBUGFUNC("i40e_aq_nvm_progress"); - - i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_nvm_progress); - status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); - *progress = desc.params.raw[0]; - return status; -} - /** * i40e_aq_get_lldp_mib * @hw: pointer to the hw struct @@ -4593,7 +4631,7 @@ enum i40e_status_code i40e_aq_del_udp_tunnel(struct i40e_hw *hw, u8 index, } /** - * i40e_aq_get_switch_resource_alloc (0x0204) + * i40e_aq_get_switch_resource_alloc - command (0x0204) to get allocations * @hw: pointer to the hw struct * @num_entries: pointer to u8 to store the number of resource entries returned * @buf: pointer to a user supplied buffer. This buffer must be large enough @@ -6705,7 +6743,7 @@ u8 i40e_get_phy_address(struct i40e_hw *hw, u8 dev_num) } /** - * i40e_blink_phy_led + * i40e_blink_phy_link_led * @hw: pointer to the HW structure * @time: time how long led will blinks in secs * @interval: gap between LED on and off in msecs @@ -6942,15 +6980,23 @@ enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw, struct i40e_hw_port_stats *stat) { enum i40e_status_code ret = I40E_SUCCESS; + bool eee_mrvl_phy; + bool eee_bcm_phy; u32 val; stat->rx_lpi_status = 0; stat->tx_lpi_status = 0; - if ((hw->device_id == I40E_DEV_ID_10G_BASE_T_BC || - hw->device_id == I40E_DEV_ID_5G_BASE_T_BC) && - (hw->phy.link_info.link_speed == I40E_LINK_SPEED_2_5GB || - hw->phy.link_info.link_speed == I40E_LINK_SPEED_5GB)) { + eee_bcm_phy = + (hw->device_id == I40E_DEV_ID_10G_BASE_T_BC || + hw->device_id == I40E_DEV_ID_5G_BASE_T_BC) && + (hw->phy.link_info.link_speed == I40E_LINK_SPEED_2_5GB || + hw->phy.link_info.link_speed == I40E_LINK_SPEED_5GB); + eee_mrvl_phy = + hw->device_id == I40E_DEV_ID_1G_BASE_T_X722; + + if (eee_bcm_phy || eee_mrvl_phy) { + // read Clause 45 PCS Status 1 register ret = i40e_aq_get_phy_register(hw, I40E_AQ_PHY_REG_ACCESS_EXTERNAL, I40E_BCM_PHY_PCS_STATUS1_PAGE, @@ -7542,7 +7588,7 @@ enum i40e_status_code i40e_aq_set_arp_proxy_config(struct i40e_hw *hw, } /** - * i40e_aq_opc_set_ns_proxy_table_entry + * i40e_aq_set_ns_proxy_table_entry * @hw: pointer to the HW structure * @ns_proxy_table_entry: pointer to NS table entry command struct * @cmd_details: pointer to command details diff --git a/sys/dev/ixl/i40e_dcb.c b/sys/dev/ixl/i40e_dcb.c index b2f0b5c0acad..a02cbc80d361 100644 --- a/sys/dev/ixl/i40e_dcb.c +++ b/sys/dev/ixl/i40e_dcb.c @@ -265,7 +265,7 @@ static void i40e_parse_ieee_app_tlv(struct i40e_lldp_org_tlv *tlv, } /** - * i40e_parse_ieee_etsrec_tlv + * i40e_parse_ieee_tlv * @tlv: IEEE 802.1Qaz TLV * @dcbcfg: Local store to update ETS REC data * @@ -345,9 +345,15 @@ static void i40e_parse_cee_pgcfg_tlv(struct i40e_cee_feat_tlv *tlv, * |pg0|pg1|pg2|pg3|pg4|pg5|pg6|pg7| * --------------------------------- */ - for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) + for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) { etscfg->tcbwtable[i] = buf[offset++]; + if (etscfg->prioritytable[i] == I40E_CEE_PGID_STRICT) + dcbcfg->etscfg.tsatable[i] = I40E_IEEE_TSA_STRICT; + else + dcbcfg->etscfg.tsatable[i] = I40E_IEEE_TSA_ETS; + } + /* Number of TCs supported (1 octet) */ etscfg->maxtcs = buf[offset]; } diff --git a/sys/dev/ixl/i40e_lan_hmc.c b/sys/dev/ixl/i40e_lan_hmc.c index c280393ef1c8..eb2c44c92067 100644 --- a/sys/dev/ixl/i40e_lan_hmc.c +++ b/sys/dev/ixl/i40e_lan_hmc.c @@ -546,7 +546,7 @@ configure_lan_hmc_out: } /** - * i40e_delete_hmc_object - remove hmc objects + * i40e_delete_lan_hmc_object - remove hmc objects * @hw: pointer to the HW structure * @info: pointer to i40e_hmc_delete_obj_info struct * diff --git a/sys/dev/ixl/i40e_nvm.c b/sys/dev/ixl/i40e_nvm.c index 20ba63a05b4e..58e5c1a0cdd9 100644 --- a/sys/dev/ixl/i40e_nvm.c +++ b/sys/dev/ixl/i40e_nvm.c @@ -35,7 +35,7 @@ #include "i40e_prototype.h" /** - * i40e_init_nvm_ops - Initialize NVM function pointers + * i40e_init_nvm - Initialize NVM function pointers * @hw: pointer to the HW structure * * Setup the function pointers and the NVM info structure. Should be called @@ -108,7 +108,8 @@ enum i40e_status_code i40e_acquire_nvm(struct i40e_hw *hw, if (ret_code) i40e_debug(hw, I40E_DEBUG_NVM, "NVM acquire type %d failed time_left=%llu ret=%d aq_err=%d\n", - access, time_left, ret_code, hw->aq.asq_last_status); + access, (unsigned long long)time_left, ret_code, + hw->aq.asq_last_status); if (ret_code && time_left) { /* Poll until the current NVM owner timeouts */ @@ -130,7 +131,8 @@ enum i40e_status_code i40e_acquire_nvm(struct i40e_hw *hw, hw->nvm.hw_semaphore_timeout = 0; i40e_debug(hw, I40E_DEBUG_NVM, "NVM acquire timed out, wait %llu ms before trying again. status=%d aq_err=%d\n", - time_left, ret_code, hw->aq.asq_last_status); + (unsigned long long)time_left, ret_code, + hw->aq.asq_last_status); } } @@ -782,10 +784,11 @@ enum i40e_status_code i40e_update_nvm_checksum(struct i40e_hw *hw) DEBUGFUNC("i40e_update_nvm_checksum"); ret_code = i40e_calc_nvm_checksum(hw, &checksum); - le_sum = CPU_TO_LE16(checksum); - if (ret_code == I40E_SUCCESS) + if (ret_code == I40E_SUCCESS) { + le_sum = CPU_TO_LE16(checksum); ret_code = i40e_write_nvm_aq(hw, 0x00, I40E_SR_SW_CHECKSUM_WORD, 1, &le_sum, TRUE); + } return ret_code; } diff --git a/sys/dev/ixl/i40e_prototype.h b/sys/dev/ixl/i40e_prototype.h index 23ce2edb22a3..2febf9d6662d 100644 --- a/sys/dev/ixl/i40e_prototype.h +++ b/sys/dev/ixl/i40e_prototype.h @@ -268,6 +268,10 @@ enum i40e_status_code i40e_aq_write_nvm_config(struct i40e_hw *hw, u8 cmd_flags, void *data, u16 buf_size, u16 element_count, struct i40e_asq_cmd_details *cmd_details); +enum i40e_status_code +i40e_aq_min_rollback_rev_update(struct i40e_hw *hw, u8 mode, u8 module, + u32 min_rrev, + struct i40e_asq_cmd_details *cmd_details); enum i40e_status_code i40e_aq_oem_post_update(struct i40e_hw *hw, void *buff, u16 buff_size, struct i40e_asq_cmd_details *cmd_details); @@ -279,7 +283,11 @@ enum i40e_status_code i40e_aq_update_nvm(struct i40e_hw *hw, u8 module_pointer, u32 offset, u16 length, void *data, bool last_command, u8 preservation_flags, struct i40e_asq_cmd_details *cmd_details); -enum i40e_status_code i40e_aq_nvm_progress(struct i40e_hw *hw, u8 *progress, +enum i40e_status_code i40e_aq_rearrange_nvm(struct i40e_hw *hw, + u8 rearrange_nvm, + struct i40e_asq_cmd_details *cmd_details); +enum i40e_status_code i40e_aq_nvm_update_in_process(struct i40e_hw *hw, + bool update_flow_state, struct i40e_asq_cmd_details *cmd_details); enum i40e_status_code i40e_aq_get_lldp_mib(struct i40e_hw *hw, u8 bridge_type, u8 mib_type, void *buff, u16 buff_size, diff --git a/sys/dev/ixl/i40e_register.h b/sys/dev/ixl/i40e_register.h index 6c57d0a25f7e..ffc6a7e506a6 100644 --- a/sys/dev/ixl/i40e_register.h +++ b/sys/dev/ixl/i40e_register.h @@ -232,6 +232,9 @@ #define I40E_VFCM_PE_ERRINFO1_RLU_ERROR_CNT_MASK I40E_MASK(0xFF, I40E_VFCM_PE_ERRINFO1_RLU_ERROR_CNT_SHIFT) #define I40E_VFCM_PE_ERRINFO1_RLS_ERROR_CNT_SHIFT 24 #define I40E_VFCM_PE_ERRINFO1_RLS_ERROR_CNT_MASK I40E_MASK(0xFF, I40E_VFCM_PE_ERRINFO1_RLS_ERROR_CNT_SHIFT) +#define I40E_PRT_SWR_PM_THR 0x0026CD00 /* Reset: CORER */ +#define I40E_PRT_SWR_PM_THR_THRESHOLD_SHIFT 0 +#define I40E_PRT_SWR_PM_THR_THRESHOLD_MASK I40E_MASK(0xFF, I40E_PRT_SWR_PM_THR_THRESHOLD_SHIFT) #define I40E_GLDCB_GENC 0x00083044 /* Reset: CORER */ #define I40E_GLDCB_GENC_PCIRTT_SHIFT 0 #define I40E_GLDCB_GENC_PCIRTT_MASK I40E_MASK(0xFFFF, I40E_GLDCB_GENC_PCIRTT_SHIFT) diff --git a/sys/dev/ixl/i40e_type.h b/sys/dev/ixl/i40e_type.h index 699576ff5b43..f34002d7dc35 100644 --- a/sys/dev/ixl/i40e_type.h +++ b/sys/dev/ixl/i40e_type.h @@ -347,12 +347,8 @@ struct i40e_phy_info { I40E_PHY_TYPE_OFFSET) #define I40E_CAP_PHY_TYPE_25GBASE_ACC BIT_ULL(I40E_PHY_TYPE_25GBASE_ACC + \ I40E_PHY_TYPE_OFFSET) -/* Offset for 2.5G/5G PHY Types value to bit number conversion */ -#define I40E_PHY_TYPE_OFFSET2 (-10) -#define I40E_CAP_PHY_TYPE_2_5GBASE_T BIT_ULL(I40E_PHY_TYPE_2_5GBASE_T + \ - I40E_PHY_TYPE_OFFSET2) -#define I40E_CAP_PHY_TYPE_5GBASE_T BIT_ULL(I40E_PHY_TYPE_5GBASE_T + \ - I40E_PHY_TYPE_OFFSET2) +#define I40E_CAP_PHY_TYPE_2_5GBASE_T BIT_ULL(I40E_PHY_TYPE_2_5GBASE_T) +#define I40E_CAP_PHY_TYPE_5GBASE_T BIT_ULL(I40E_PHY_TYPE_5GBASE_T) #define I40E_HW_CAP_MAX_GPIO 30 #define I40E_HW_CAP_MDIO_PORT_MODE_MDIO 0 #define I40E_HW_CAP_MDIO_PORT_MODE_I2C 1 @@ -443,6 +439,7 @@ struct i40e_hw_capabilities { u32 enabled_tcmap; u32 maxtc; u64 wr_csr_prot; + bool dis_unused_ports; bool apm_wol_support; enum i40e_acpi_programming_method acpi_prog_method; bool proxy_support; @@ -975,7 +972,8 @@ enum i40e_rx_l2_ptype { I40E_RX_PTYPE_GRENAT4_MAC_PAY3 = 58, I40E_RX_PTYPE_GRENAT4_MACVLAN_IPV6_ICMP_PAY4 = 87, I40E_RX_PTYPE_GRENAT6_MAC_PAY3 = 124, - I40E_RX_PTYPE_GRENAT6_MACVLAN_IPV6_ICMP_PAY4 = 153 + I40E_RX_PTYPE_GRENAT6_MACVLAN_IPV6_ICMP_PAY4 = 153, + I40E_RX_PTYPE_PARSER_ABORTED = 255 }; struct i40e_rx_ptype_decoded { @@ -1551,6 +1549,9 @@ struct i40e_hw_port_stats { #define I40E_SR_CONFIGURATION_METADATA_PTR 0x4D #define I40E_SR_IMMEDIATE_VALUES_PTR 0x4E #define I40E_SR_5TH_FREE_PROVISION_AREA_PTR 0x50 +#define I40E_SR_PRESERVATION_RULES_PTR 0x70 +#define I40E_FPK_SR_5TH_FREE_PROVISION_AREA_PTR 0x71 +#define I40E_SR_6TH_FREE_PROVISION_AREA_PTR 0x71 /* Auxiliary field, mask and shift definition for Shadow RAM and NVM Flash */ #define I40E_SR_VPD_MODULE_MAX_SIZE 1024 @@ -1720,6 +1721,8 @@ struct i40e_lldp_variables { #define I40E_L4_DST_MASK (0x1ULL << I40E_L4_DST_SHIFT) #define I40E_VERIFY_TAG_SHIFT 31 #define I40E_VERIFY_TAG_MASK (0x3ULL << I40E_VERIFY_TAG_SHIFT) +#define I40E_VLAN_SRC_SHIFT 55 +#define I40E_VLAN_SRC_MASK (0x1ULL << I40E_VLAN_SRC_SHIFT) #define I40E_FLEX_50_SHIFT 13 #define I40E_FLEX_50_MASK (0x1ULL << I40E_FLEX_50_SHIFT) diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index f620771e93b1..e7e6e31a7fca 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -1514,11 +1514,11 @@ ixl_if_media_status(if_ctx_t ctx, struct ifmediareq *ifmr) ifmr->ifm_active |= IFM_1000_T; break; /* 2.5 G */ - case I40E_PHY_TYPE_2_5GBASE_T: + case I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS: ifmr->ifm_active |= IFM_2500_T; break; /* 5 G */ - case I40E_PHY_TYPE_5GBASE_T: + case I40E_PHY_TYPE_5GBASE_T_LINK_STATUS: ifmr->ifm_active |= IFM_5000_T; break; /* 10 G */ From owner-dev-commits-src-all@freebsd.org Mon Sep 20 22:39:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6428E6AEE3B; Mon, 20 Sep 2021 22:39: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 4HCzyF23PVz3N7G; Mon, 20 Sep 2021 22:39: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 17CEB18D07; Mon, 20 Sep 2021 22:39: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 18KMdX9v095569; Mon, 20 Sep 2021 22:39:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KMdWRF095568; Mon, 20 Sep 2021 22:39:32 GMT (envelope-from git) Date: Mon, 20 Sep 2021 22:39:32 GMT Message-Id: <202109202239.18KMdWRF095568@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: da73926566da - main - libcam: Define depop structures and introduce scsi_wrap MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: da73926566da6f708ce3f17ff29fe867f1ad33cd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 22:39:33 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=da73926566da6f708ce3f17ff29fe867f1ad33cd commit da73926566da6f708ce3f17ff29fe867f1ad33cd Author: Warner Losh AuthorDate: 2021-09-17 22:29:22 +0000 Commit: Warner Losh CommitDate: 2021-09-20 22:27:59 +0000 libcam: Define depop structures and introduce scsi_wrap Define structures related to the depop set of commands (GET PHYSICAL ELEMENT STATUS, REMOVE ELEMENT AND TRUNCATE, and RESTORE ELEMENT AND REBUILD) as well as the CDB construction routines. Also create scsi_wrap.c. This will have convenience routines that will do all the elements of allocating the ccb, generating the CDB, sending the command (looping as necessary for cases where data is returned, but it's size isn't known up front), etc. As this functionality is fleshed out, calling many camcontrol commands programatically gets much easier. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29017 --- lib/libcam/Makefile | 4 +- lib/libcam/scsi_wrap.c | 181 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/libcam/scsi_wrap.h | 38 ++++++++++ sys/cam/scsi/scsi_all.c | 82 ++++++++++++++++++++++ sys/cam/scsi/scsi_all.h | 87 +++++++++++++++++++++++ 5 files changed, 390 insertions(+), 2 deletions(-) diff --git a/lib/libcam/Makefile b/lib/libcam/Makefile index 2a5d13ba4f34..e0f8869f89ce 100644 --- a/lib/libcam/Makefile +++ b/lib/libcam/Makefile @@ -5,8 +5,8 @@ PACKAGE= runtime LIB= cam SHLIBDIR?= /lib SRCS= camlib.c scsi_cmdparse.c scsi_all.c scsi_da.c scsi_sa.c cam.c \ - ata_all.c nvme_all.c smp_all.c -INCS= camlib.h + ata_all.c nvme_all.c smp_all.c scsi_wrap.c +INCS= camlib.h scsi_wrap.h LIBADD= sbuf diff --git a/lib/libcam/scsi_wrap.c b/lib/libcam/scsi_wrap.c new file mode 100644 index 000000000000..524d36955c17 --- /dev/null +++ b/lib/libcam/scsi_wrap.c @@ -0,0 +1,181 @@ +/*- + * Copyright (c) 2021 Netflix, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Wrapper functions to make requests and get answers w/o managing the + * details. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include "camlib.h" +#include "scsi_wrap.h" + +void * +scsi_wrap_get_physical_element_status(struct cam_device *device, int task_attr, int retry_count, + int timeout, uint8_t report_type, uint32_t start_element) +{ + uint32_t allocation_length; + union ccb *ccb = NULL; + struct scsi_get_physical_element_hdr *hdr = NULL; + uint32_t dtors; + uint32_t reported; + + ccb = cam_getccb(device); + if (ccb == NULL) { + warnx("Can't allocate ccb"); + return (NULL); + } + + /* + * Do the request up to twice. Once to get the length and once to get + * the data. We'll guess that 4096 is enough to almost always long + * enough since that's 127 entries and most drives have < 20 heads. If + * by chance it's not, then we'll loop once as we'll then know the + * proper length. + */ + allocation_length = MAX(sizeof(*hdr), 4096); +again: + free(hdr); + hdr = calloc(allocation_length, 1); + if (hdr == NULL) { + warnx("Can't allocate memory for physical element list"); + return (NULL); + } + + scsi_get_physical_element_status(&ccb->csio, + retry_count, + NULL, + task_attr, + (uint8_t *)hdr, + allocation_length, + report_type, + start_element, + SSD_FULL_SIZE, + timeout); + + /* Disable freezing the device queue */ + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; + + if (cam_send_ccb(device, ccb) < 0) { + warn("error sending GET PHYSICAL ELEMENT STATUS command"); + goto errout; + } + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + goto errout; + } + + dtors = scsi_4btoul(hdr->num_descriptors); + reported = scsi_4btoul(hdr->num_returned); + if (dtors != 0 && dtors != reported) { + /* + * Get all the data... in the future we may need to step through + * a long list, but so far all drives I've found fit into one + * response. A 4k transfer can do 128 heads and current designs + * have 16. + */ + allocation_length = dtors * sizeof(struct scsi_get_physical_element_descriptor) + + sizeof(*hdr); + goto again; + } + cam_freeccb(ccb); + return (hdr); +errout: + cam_freeccb(ccb); + free(hdr); + return (NULL); +} + +void * +scsi_wrap_inquiry(struct cam_device *device, uint32_t page, uint32_t length) +{ + union ccb *ccb; + uint8_t *buf; + + ccb = cam_getccb(device); + + if (ccb == NULL) + return (NULL); + + buf = malloc(length); + + if (buf == NULL) { + cam_freeccb(ccb); + return (NULL); + } + + scsi_inquiry(&ccb->csio, + /*retries*/ 0, + /*cbfcnp*/ NULL, + /* tag_action */ MSG_SIMPLE_Q_TAG, + /* inq_buf */ (u_int8_t *)buf, + /* inq_len */ length, + /* evpd */ 1, + /* page_code */ page, + /* sense_len */ SSD_FULL_SIZE, + /* timeout */ 5000); + + /* Disable freezing the device queue */ + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; + // ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; + + if (cam_send_ccb(device, ccb) < 0) { + warn("error sending INQUIRY command"); + cam_freeccb(ccb); + free(buf); + return (NULL); + } + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + free(buf); + buf = NULL; + } + cam_freeccb(ccb); + return (buf); +} + +struct scsi_vpd_block_device_characteristics * +scsi_wrap_vpd_block_device_characteristics(struct cam_device *device) +{ + + return ((struct scsi_vpd_block_device_characteristics *)scsi_wrap_inquiry( + device, SVPD_BDC, sizeof(struct scsi_vpd_block_device_characteristics))); +} diff --git a/lib/libcam/scsi_wrap.h b/lib/libcam/scsi_wrap.h new file mode 100644 index 000000000000..ff201538d527 --- /dev/null +++ b/lib/libcam/scsi_wrap.h @@ -0,0 +1,38 @@ +/*- + * Copyright (c) 2021 Netflix, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _CAM_SCSI_WRAP_H +#define _CAM_SCSI_WRAP_H + +void *scsi_wrap_get_physical_element_status(struct cam_device *device, + int task_attr, int retry_count, int timeout, uint8_t report_type, + uint32_t start_element); +void *scsi_wrap_inquiry(struct cam_device *device, uint32_t page, uint32_t length); +struct scsi_vpd_block_device_characteristics *scsi_wrap_vpd_block_device_characteristics( + struct cam_device *device); + +#endif /* _CAM_SCSI_WRAP_H */ diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c index 729a2a06e616..dc249dac8000 100644 --- a/sys/cam/scsi/scsi_all.c +++ b/sys/cam/scsi/scsi_all.c @@ -8751,6 +8751,88 @@ scsi_send_diagnostic(struct ccb_scsiio *csio, u_int32_t retries, timeout); } +void +scsi_get_physical_element_status(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, uint8_t *data_ptr, + uint16_t allocation_length, uint8_t report_type, + uint32_t starting_element, + uint8_t sense_len, uint32_t timeout) +{ + struct scsi_get_physical_element_status *scsi_cmd; + + scsi_cmd = (struct scsi_get_physical_element_status *)&csio->cdb_io.cdb_bytes; + memset(scsi_cmd, 0, sizeof(*scsi_cmd)); + scsi_cmd->opcode = SERVICE_ACTION_IN; + scsi_cmd->service_action = GET_PHYSICAL_ELEMENT_STATUS; + scsi_ulto4b(starting_element, scsi_cmd->starting_element); + scsi_ulto4b(allocation_length, scsi_cmd->allocation_length); + + cam_fill_csio(csio, + retries, + cbfcnp, + /*flags*/ CAM_DIR_IN, + tag_action, + data_ptr, + allocation_length, + sense_len, + sizeof(*scsi_cmd), + timeout); +} + +void +scsi_remove_element_and_truncate(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, + uint64_t requested_capacity, uint32_t element_id, + uint8_t sense_len, uint32_t timeout) +{ + struct scsi_remove_element_and_truncate *scsi_cmd; + + scsi_cmd = (struct scsi_remove_element_and_truncate *)&csio->cdb_io.cdb_bytes; + memset(scsi_cmd, 0, sizeof(*scsi_cmd)); + scsi_cmd->opcode = SERVICE_ACTION_IN; + scsi_cmd->service_action = REMOVE_ELEMENT_AND_TRUNCATE; + scsi_u64to8b(requested_capacity, scsi_cmd->requested_capacity); + scsi_ulto4b(element_id, scsi_cmd->element_identifier); + + cam_fill_csio(csio, + retries, + cbfcnp, + /*flags*/ CAM_DIR_OUT, + tag_action, + NULL, + 0, + sense_len, + sizeof(*scsi_cmd), + timeout); +} + +void +scsi_restore_elements_and_rebuild(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, + uint8_t sense_len, uint32_t timeout) +{ + struct scsi_service_action_in *scsi_cmd; + + scsi_cmd = (struct scsi_service_action_in *)&csio->cdb_io.cdb_bytes; + memset(scsi_cmd, 0, sizeof(*scsi_cmd)); + scsi_cmd->opcode = SERVICE_ACTION_IN; + scsi_cmd->service_action = RESTORE_ELEMENTS_AND_REBUILD; + + cam_fill_csio(csio, + retries, + cbfcnp, + /*flags*/ CAM_DIR_OUT, + tag_action, + NULL, + 0, + sense_len, + sizeof(*scsi_cmd), + timeout); +} + void scsi_read_buffer(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*), diff --git a/sys/cam/scsi/scsi_all.h b/sys/cam/scsi/scsi_all.h index 597d5fd68447..3272f23b172e 100644 --- a/sys/cam/scsi/scsi_all.h +++ b/sys/cam/scsi/scsi_all.h @@ -2158,6 +2158,9 @@ struct ata_pass_32 { #define REPORT_PRIORITY 0x0E #define REPORT_TIMESTAMP 0x0F #define MANAGEMENT_PROTOCOL_IN 0x10 +#define GET_PHYSICAL_ELEMENT_STATUS 0x17 +#define REMOVE_ELEMENT_AND_TRUNCATE 0x18 +#define RESTORE_ELEMENTS_AND_REBUILD 0x19 /* Maintenance Out Service Action Codes */ #define SET_IDENTIFY_INFORMATION 0x06 #define SET_TARGET_PORT_GROUPS 0x0A @@ -2847,6 +2850,8 @@ struct scsi_vpd_block_device_characteristics uint8_t depopulation_time[4]; uint8_t reserved2[48]; }; +_Static_assert(sizeof(struct scsi_vpd_block_device_characteristics) == 64, + "scsi_vpd_block_characteristics wrong size"); #define SBDC_IS_PRESENT(bdc, length, field) \ ((length >= offsetof(struct scsi_vpd_block_device_characteristics, \ @@ -3064,6 +3069,70 @@ struct scsi_report_luns_data { struct scsi_report_luns_lundata luns[0]; }; +/* + * GET PHYSICAL ELEMENT STATUS (GPES) from SBC-4 (r21 or later) + * REMOVE ELEMENT AND TRUNCATE (RET) from SBC-4 (r21 or later) + * RESTORE ELEMENT AND REBUILD (RER) from SBC-4 (r21 or later) + * + * Queries drives that support it for the status of feach of their physical + * storage elements (which typically map to heads, but aren't required to). + * These elements can be selective removed (at a reduced capacity) or restored + * to service. + */ +struct scsi_get_physical_element_status +{ + uint8_t opcode; + uint8_t service_action; + uint8_t rsvd[4]; + uint8_t starting_element[4]; + uint8_t allocation_length[4]; + uint8_t report_type; +#define SCSI_GPES_FILTER_ALL 0x00 +#define SCSI_GPES_FILTER_EXEPTION 0x40 +#define SCSI_GPES_REPORT_TYPE_PHYS 0x00 +#define SCSI_GEPS_REPORT_TYPE_STORAGE 0x01 + uint8_t control; +}; +_Static_assert(sizeof(struct scsi_get_physical_element_status) == 16, + "scsi_get_physical_element_status wrong size"); + +struct scsi_get_physical_element_hdr +{ + uint8_t num_descriptors[4]; + uint8_t num_returned[4]; + uint8_t id_depop[4]; + uint8_t rsvd[20]; +}; +_Static_assert(sizeof(struct scsi_get_physical_element_hdr) == 32, + "scsi_get_physical_element_hdr wrong size"); + +struct scsi_get_physical_element_descriptor +{ + uint8_t rsvd1[4]; + uint8_t element_identifier[4]; + uint8_t rsvd2[5]; + uint8_t ralwd; + uint8_t physical_element_type; +#define GPED_TYPE_STORAGE 0x1 + uint8_t physical_element_health; + uint8_t capacity[8]; + uint8_t rsvd3[8]; +}; +_Static_assert(sizeof(struct scsi_get_physical_element_descriptor) == 32, + "scsi_get_physical_element_descriptor wrong size"); + +struct scsi_remove_element_and_truncate +{ + uint8_t opcode; + uint8_t service_action; + uint8_t requested_capacity[8]; + uint8_t element_identifier[4]; + uint8_t rsvd; + uint8_t control; +}; +_Static_assert(sizeof(struct scsi_remove_element_and_truncate) == 16, + "scsi_remove_element_and_truncate wrong size"); + struct scsi_target_group { uint8_t opcode; @@ -4160,6 +4229,24 @@ void scsi_send_diagnostic(struct ccb_scsiio *csio, u_int32_t retries, uint16_t param_list_length, uint8_t sense_len, uint32_t timeout); +void scsi_get_physical_element_status(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, uint8_t *data_ptr, + uint16_t allocation_length, uint8_t report_type, + uint32_t starting_element, + uint8_t sense_len, uint32_t timeout); + +void scsi_remove_element_and_truncate(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, + uint64_t requested_capacity, uint32_t element_id, + uint8_t sense_len, uint32_t timeout); + +void scsi_restore_elements_and_rebuild(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, + uint8_t sense_len, uint32_t timeout); + void scsi_read_buffer(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*), uint8_t tag_action, int mode, From owner-dev-commits-src-all@freebsd.org Mon Sep 20 22:39:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 868546AE53B; Mon, 20 Sep 2021 22:39: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 4HCzyG2q12z3NGV; Mon, 20 Sep 2021 22:39: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 28DA718960; Mon, 20 Sep 2021 22:39: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 18KMdYCo095593; Mon, 20 Sep 2021 22:39:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KMdYA6095592; Mon, 20 Sep 2021 22:39:34 GMT (envelope-from git) Date: Mon, 20 Sep 2021 22:39:34 GMT Message-Id: <202109202239.18KMdYA6095592@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 53cce2e744c1 - main - camcontrol: depop command MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 53cce2e744c1086bd5c6aa18bff4daac42468538 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 22:39:34 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=53cce2e744c1086bd5c6aa18bff4daac42468538 commit 53cce2e744c1086bd5c6aa18bff4daac42468538 Author: Warner Losh AuthorDate: 2021-09-17 22:30:06 +0000 Commit: Warner Losh CommitDate: 2021-09-20 22:27:59 +0000 camcontrol: depop command Implement and document the new depop command. This command manages drive elements for drives that support it. Storage elements are typically heads. Element status can be discovered. Elements may be removed or restored. And the status of any current depop operation can be assessed. depop -d elm will remove element elm and truncate available capacity. depop -l will list the current drive elements and their current status. depop -r elm will try to restore all retired elements and rebuild capacity. Changing storage elements may reinitialize the drive. This operation will lose data and may take hours to complete. Use the drive provided timeout for operations by default. Reviewed by: gbe (manpages) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29018 --- sbin/camcontrol/Makefile | 2 +- sbin/camcontrol/camcontrol.8 | 61 +++++++++ sbin/camcontrol/camcontrol.c | 15 +++ sbin/camcontrol/camcontrol.h | 3 + sbin/camcontrol/depop.c | 297 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 377 insertions(+), 1 deletion(-) diff --git a/sbin/camcontrol/Makefile b/sbin/camcontrol/Makefile index 3ed8b92372f8..958f37714662 100644 --- a/sbin/camcontrol/Makefile +++ b/sbin/camcontrol/Makefile @@ -5,7 +5,7 @@ PACKAGE=runtime PROG= camcontrol SRCS= camcontrol.c util.c -SRCS+= attrib.c epc.c fwdownload.c modeedit.c persist.c progress.c timestamp.c zone.c +SRCS+= attrib.c depop.c epc.c fwdownload.c modeedit.c persist.c progress.c timestamp.c zone.c .if ${MK_NVME} != "no" .PATH: ${SRCTOP}/sbin/nvmecontrol CFLAGS+= -I${SRCTOP}/sbin/nvmecontrol -DWITH_NVME diff --git a/sbin/camcontrol/camcontrol.8 b/sbin/camcontrol/camcontrol.8 index 9c128131d817..7790d047a255 100644 --- a/sbin/camcontrol/camcontrol.8 +++ b/sbin/camcontrol/camcontrol.8 @@ -366,6 +366,13 @@ .Ic devtype .Op device id .Nm +.Ic depop +.Op device id +.Op generic args +.Ao Fl l | Fl d | Fl r Ac +.Op Fl e Ar elem +.Op Fl c Ar capacity +.Nm .Ic help .Sh DESCRIPTION The @@ -2594,6 +2601,60 @@ Device type is unknown .It illegal A programming error occurred .El +.It Ic depop +Commands necessary to support the depopulation (depop) of defective elements of a device +(typically heads for hard drives) or setting capacity point (typically used on +flash drives). +Issues either GET PHYSICAL ELEMENT STATUS, REMOVE ELEMENT AND TRUNCATE, or RESTORE +ELEMENT AND REBUILD command to manage storage elements of a drive. +Removal or restoration of elements may take up to a day to complete. +One of the +.Fl d , +.Fl l , +or +.Fl r +options must be specified. +These options are mutually exclusive. +Only SCSI drives are supported. +Changing the storage elements of a storage drive may result in the loss of all +data on that storage drive. +The drive may need to reinitialize after +.Fl d +or +.Fl r +commands. +The data on the drive is inaccessible until one of these commands complete. +Once one of these commands start, the drive is format corrupt until the +operation successfully completes. +While format corrupt, no read or write I/O is possible to the drive. +If the drive power cycles, it will remain format corrupt and the operation +must be restarted. +TEST UNIT READY or +.Dq camcontrol tur +can monitor an in-progress depop operation. +.Bl -tag -width 6n +.It Fl c Ar capacity +Specify the desired capacity point for the drive. +Valid only for the +.Fl d +flag. +.It Fl d +Remove the physical element from service or set the capacity point specified by the +.Fl e +or +.Fl c +flags. +The drive's capacity may be reduced by this operation. +.It Fl e Ar element +Specify the physical element to remove from service. +Valid only for the +.Fl d +flag. +.It Fl l +Report the current status of the physical elements of a drive. +.It Fl r +Restore all the eligible physical elements to service. +.El .It Ic help Print out verbose usage information. .El diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index 69939715898e..e560eb349f79 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -111,6 +111,7 @@ typedef enum { CAM_CMD_POWER_MODE, CAM_CMD_DEVTYPE, CAM_CMD_AMA, + CAM_CMD_DEPOP, } cam_cmd; typedef enum { @@ -228,6 +229,7 @@ static struct camcontrol_opts option_table[] = { {"zone", CAM_CMD_ZONE, CAM_ARG_NONE, "ac:l:No:P:"}, {"epc", CAM_CMD_EPC, CAM_ARG_NONE, "c:dDeHp:Pr:sS:T:"}, {"timestamp", CAM_CMD_TIMESTAMP, CAM_ARG_NONE, "f:mrsUT:"}, + {"depop", CAM_CMD_DEPOP, CAM_ARG_NONE, "ac:de:ls"}, {"help", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, {"-?", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, {"-h", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, @@ -9946,6 +9948,7 @@ usage(int printlong) " camcontrol timestamp [dev_id][generic_args] <-r [-f format|-m|-U]>|\n" " <-s <-f format -T time | -U >>\n" " camcontrol devtype [dev_id]\n" +" camcontrol depop [dev_id] [-d | -l | -r] [-e element] [-c capacity]\n" " camcontrol mmcsdcmd [dev_id] [[-c mmc_opcode] [-a mmc_arg]\n" " [-f mmc_flags] [-l data_len]\n" " [-W [-b data_byte]]] |\n" @@ -9999,6 +10002,7 @@ usage(int printlong) "epc send ATA Extended Power Conditions commands\n" "timestamp report or set the device's timestamp\n" "devtype report the type of device\n" +"depop manage drive storage elements\n" "mmcsdcmd send the given MMC command, needs -c and -a as well\n" "help this message\n" "Device Identifiers:\n" @@ -10208,6 +10212,12 @@ usage(int printlong) "-f format the format of the time string passed into strptime(3)\n" "-T time the time value passed into strptime(3)\n" "-U set the timestamp of the device to UTC time\n" +"depop arguments:\n" +"-d remove an element from service\n" +"-l list status of all elements of drive\n" +"-r restore all elements to service\n" +"-e elm element to remove\n" +"-c capacity requested new capacity\n" "mmcsdcmd arguments:\n" "-c mmc_cmd MMC command to send to the card\n" "-a mmc_arg Argument for the MMC command\n" @@ -10631,6 +10641,11 @@ main(int argc, char **argv) task_attr, retry_count, timeout, arglist & CAM_ARG_VERBOSE); break; + case CAM_CMD_DEPOP: + error = depop(cam_dev, argc, argv, combinedopt, + task_attr, retry_count, timeout, + arglist & CAM_ARG_VERBOSE); + break; case CAM_CMD_USAGE: usage(1); break; diff --git a/sbin/camcontrol/camcontrol.h b/sbin/camcontrol/camcontrol.h index 85f2e8658fe8..b84587df7a3e 100644 --- a/sbin/camcontrol/camcontrol.h +++ b/sbin/camcontrol/camcontrol.h @@ -88,6 +88,9 @@ int epc(struct cam_device *device, int argc, char **argv, char *combinedopt, int timestamp(struct cam_device *device, int argc, char **argv, char *combinedopt, int task_attr, int retry_count, int timeout, int verbosemode); +int depop(struct cam_device *device, int argc, char **argv, + char *combinedopt, int task_attr, int retry_count, int timeout, + int verbosemode); void mode_sense(struct cam_device *device, int *cdb_len, int dbd, int llbaa, int pc, int page, int subpage, int task_attr, int retry_count, int timeout, uint8_t *data, int datalen); diff --git a/sbin/camcontrol/depop.c b/sbin/camcontrol/depop.c new file mode 100644 index 000000000000..3dbd2ba5358d --- /dev/null +++ b/sbin/camcontrol/depop.c @@ -0,0 +1,297 @@ +/*- + * Copyright (c) 2021 Netflix, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + */ +/* + * SCSI disk depop (head depopulation) support + * + * The standard defines 'storage elements' as the generic way of referring to a + * disk drive head. Each storage element has an identifier and an active status. + * The health of an element can be querried. Active elements may be removed from + * service with a REMOVE ELEMENT AND TRUNCATE (RET) command. Inactive element + * may be returned to service with a RESTORE ELEMENTS AND REBUILD (RER) + * command. GET PHYSICAL ELEMENT STATUS (GPES) will return a list of elements, + * their health, whether they are in service, how much capacity the element is + * used for, etc. + * + * When a depop operation starts, the drive becomes format corrupt. No normal + * I/O can be done to the drive and a limited number of CDBs will + * succeed. Status can be obtained by either a TEST UNIT READY or a GPES + * command. A drive reset will not stop a depop operation, but a power cycle + * will. A failed depop operation will be reported when the next TEST UNIT READY + * is sent to the drive. Drives that are format corrupt after an interrupted + * operation need to have that operation repeated. + * + * 'depop' provides a wrapper around all these functions. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include "camcontrol.h" + +enum depop_action { + DEPOP_NONE, + DEPOP_LIST, + DEPOP_RESTORE, + DEPOP_REMOVE, +}; + +static int +depop_list(struct cam_device *device, int task_attr, int retry_count, + int timeout, int verbosemode __unused) +{ + int error = 0; + uint32_t dtors; + struct scsi_get_physical_element_hdr *hdr; + struct scsi_get_physical_element_descriptor *dtor_ptr; + + hdr = scsi_wrap_get_physical_element_status(device, task_attr, retry_count, timeout, + SCSI_GPES_FILTER_ALL | SCSI_GPES_REPORT_TYPE_PHYS, 1); + if (hdr == NULL) + errx(1, "scsi_wrap_get_physical_element_status returned an error"); + + /* + * OK, we have the data, not report it out. + */ + dtor_ptr = (struct scsi_get_physical_element_descriptor *)(hdr + 1); + dtors = scsi_4btoul(hdr->num_descriptors); + printf("Elem ID * Health Capacity\n"); + for (uint32_t i = 0; i < dtors; i++) { + uint32_t id = scsi_4btoul(dtor_ptr[i].element_identifier); + uint8_t ralwd = dtor_ptr[i].ralwd; + uint8_t type = dtor_ptr[i].physical_element_type; + uint8_t health = dtor_ptr[i].physical_element_health; + uint64_t cap = scsi_8btou64(dtor_ptr[i].capacity); + if (type != GPED_TYPE_STORAGE) + printf("0x%08x -- type unknown %d\n", id, type); + else + printf("0x%08x %c 0x%02x %jd\n", id, ralwd ? '*' : ' ', health, cap); + } + printf("* -- Element can be restored\n"); + + free(hdr); + return (error); +} + +static int +depop_remove(struct cam_device *device, int task_attr, int retry_count, + int timeout, int verbosemode __unused, uint32_t elem, uint64_t capacity) +{ + union ccb *ccb; + int error = 0; + + ccb = cam_getccb(device); + if (ccb == NULL) { + warnx("Can't allocate ccb"); + return (1); + } + scsi_remove_element_and_truncate(&ccb->csio, + retry_count, + NULL, + task_attr, + capacity, + elem, + SSD_FULL_SIZE, + timeout); + /* Disable freezing the device queue */ + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; + if (cam_send_ccb(device, ccb) < 0) { + warn("error sending GET PHYSICAL ELEMENT STATUS command"); + error = 1; + goto out; + } + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + error = 1; + } + +out: + cam_freeccb(ccb); + return (error); +} + +static int +depop_restore(struct cam_device *device, int task_attr, int retry_count, + int timeout, int verbosemode __unused) +{ + union ccb *ccb; + int error = 0; + + ccb = cam_getccb(device); + if (ccb == NULL) { + warnx("Can't allocate ccb"); + return (1); + } + scsi_restore_elements_and_rebuild(&ccb->csio, + retry_count, + NULL, + task_attr, + SSD_FULL_SIZE, + timeout); + + /* Disable freezing the device queue */ + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; + if (cam_send_ccb(device, ccb) < 0) { + warn("error sending GET PHYSICAL ELEMENT STATUS command"); + error = 1; + goto out; + } + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + error = 1; + } + +out: + cam_freeccb(ccb); + return (error); +} + +#define MUST_BE_NONE() \ + if (action != DEPOP_NONE) { \ + warnx("Use only one of -d, -l, or -r"); \ + error = 1; \ + goto bailout; \ + } + +int +depop(struct cam_device *device, int argc, char **argv, char *combinedopt, + int task_attr, int retry_count, int timeout, int verbosemode) +{ + int c; + int action = DEPOP_NONE; + char *endptr; + int error = 0; + uint32_t elem = 0; + uint64_t capacity = 0; + + while ((c = getopt(argc, argv, combinedopt)) != -1) { + switch (c) { + case 'c': + capacity = strtoumax(optarg, &endptr, 0); + if (*endptr != '\0') { + warnx("Invalid capacity: %s", optarg); + error = 1; + goto bailout; + } + break; + case 'e': + elem = strtoul(optarg, &endptr, 0); + if (*endptr != '\0') { + warnx("Invalid element: %s", optarg); + error = 1; + goto bailout; + } + break; + case 'd': + MUST_BE_NONE(); + action = DEPOP_REMOVE; + break; + case 'l': + MUST_BE_NONE(); + action = DEPOP_LIST; + break; + case 'r': + MUST_BE_NONE(); + action = DEPOP_RESTORE; + break; + default: + break; + } + } + + /* + * Compute a sane timeout if none given. 5 seconds for the list command + * and whatever the block device characteristics VPD says for other + * depop commands. If there's no value in that field, default to 1 + * day. Experience has shown that these operations take the better part + * of a day to complete, so a 1 day timeout default seems appropriate. + */ + if (timeout == 0 && action != DEPOP_NONE) { + if (action == DEPOP_LIST) { + timeout = 5 * 1000; + } else { + struct scsi_vpd_block_device_characteristics *bdc; + + timeout = 24 * 60 * 60 * 1000; /* 1 day */ + bdc = scsi_wrap_vpd_block_device_characteristics(device); + if (bdc != NULL) { + timeout = scsi_4btoul(bdc->depopulation_time); + } + free(bdc); + } + } + + switch (action) { + case DEPOP_NONE: + warnx("Must specify one of -d, -l, or -r"); + error = 1; + break; + case DEPOP_REMOVE: + if (elem == 0 && capacity == 0) { + warnx("Must specify at least one of -e and/or -c"); + error = 1; + break; + } + error = depop_remove(device, task_attr, retry_count, timeout, + verbosemode, elem, capacity); + break; + case DEPOP_RESTORE: + error = depop_restore(device, task_attr, retry_count, timeout, + verbosemode); + break; + case DEPOP_LIST: + error = depop_list(device, task_attr, retry_count, timeout, + verbosemode); + break; + } + +bailout: + + return (error); +} From owner-dev-commits-src-all@freebsd.org Mon Sep 20 23:22:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65A7B6AF415; Mon, 20 Sep 2021 23:22: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 4HD0vn2Lhbz3jsX; Mon, 20 Sep 2021 23:22: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 30DCA1970B; Mon, 20 Sep 2021 23:22: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 18KNMTue061351; Mon, 20 Sep 2021 23:22:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KNMTsu061350; Mon, 20 Sep 2021 23:22:29 GMT (envelope-from git) Date: Mon, 20 Sep 2021 23:22:29 GMT Message-Id: <202109202322.18KNMTsu061350@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 643f587c95dd - stable/12 - ixl(4): Add ability to control link state on ifconfig down MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 643f587c95ddc07dd5dc32ff5a2bdb0bd72e8df9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 23:22:29 -0000 The branch stable/12 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=643f587c95ddc07dd5dc32ff5a2bdb0bd72e8df9 commit 643f587c95ddc07dd5dc32ff5a2bdb0bd72e8df9 Author: Krzysztof Galazka AuthorDate: 2021-03-03 01:38:51 +0000 Commit: Eric Joyner CommitDate: 2021-09-20 21:30:13 +0000 ixl(4): Add ability to control link state on ifconfig down Add sysctl link_active_on_if_down, which allows user to control if interface is kept in active state when it is brought down with ifconfig. Set it to enabled by default to preserve backwards compatibility. Reviewed by: erj Tested by: gowtham.kumar.ks@intel.com Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D28028 (cherry picked from commit 21802a127d83e8a8c721d69b697e7ddb223d7797) --- sys/dev/ixl/if_ixl.c | 18 +++++++ sys/dev/ixl/ixl_pf.h | 7 +++ sys/dev/ixl/ixl_pf_iflib.c | 2 + sys/dev/ixl/ixl_pf_main.c | 131 ++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 156 insertions(+), 2 deletions(-) diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index e988ab1ddc22..09107dbaf2a5 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -771,6 +771,12 @@ ixl_if_attach_post(if_ctx_t ctx) ixl_update_stats_counters(pf); ixl_add_hw_stats(pf); + /* + * Driver may have been reloaded. Ensure that the link state + * is consistent with current settings. + */ + ixl_set_link(pf, (pf->state & IXL_PF_STATE_LINK_ACTIVE_ON_DOWN) != 0); + hw->phy.get_link_info = true; i40e_get_link_status(hw, &pf->link_up); ixl_update_link_status(pf); @@ -959,6 +965,8 @@ ixl_if_init(if_ctx_t ctx) return; } + ixl_set_link(pf, true); + /* Reconfigure multicast filters in HW */ ixl_if_multi_set(ctx); @@ -1001,6 +1009,7 @@ void ixl_if_stop(if_ctx_t ctx) { struct ixl_pf *pf = iflib_get_softc(ctx); + struct ifnet *ifp = iflib_get_ifp(ctx); struct ixl_vsi *vsi = &pf->vsi; INIT_DEBUGOUT("ixl_if_stop: begin\n"); @@ -1017,6 +1026,15 @@ ixl_if_stop(if_ctx_t ctx) ixl_disable_rings_intr(vsi); ixl_disable_rings(pf, vsi, &pf->qtag); + + /* + * Don't set link state if only reconfiguring + * e.g. on MTU change. + */ + if ((if_getflags(ifp) & IFF_UP) == 0 && + (atomic_load_acq_32(&pf->state) & + IXL_PF_STATE_LINK_ACTIVE_ON_DOWN) == 0) + ixl_set_link(pf, false); } static int diff --git a/sys/dev/ixl/ixl_pf.h b/sys/dev/ixl/ixl_pf.h index 0521ae5a4bc5..cfae026e9eb7 100644 --- a/sys/dev/ixl/ixl_pf.h +++ b/sys/dev/ixl/ixl_pf.h @@ -88,6 +88,7 @@ enum ixl_pf_state { IXL_PF_STATE_EMP_RESET_REQ = (1 << 8), IXL_PF_STATE_FW_LLDP_DISABLED = (1 << 9), IXL_PF_STATE_EEE_ENABLED = (1 << 10), + IXL_PF_STATE_LINK_ACTIVE_ON_DOWN = (1 << 11), }; #define IXL_PF_IN_RECOVERY_MODE(pf) \ @@ -227,6 +228,11 @@ struct ixl_pf { "\t0 - disable\n" \ "\t1 - enable\n" +#define IXL_SYSCTL_HELP_SET_LINK_ACTIVE \ +"\nKeep link active after setting interface down:\n" \ +"\t0 - disable\n" \ +"\t1 - enable\n" + #define IXL_SYSCTL_HELP_READ_I2C \ "\nRead a byte from I2C bus\n" \ "Input: 32-bit value\n" \ @@ -351,6 +357,7 @@ void ixl_pf_reset_stats(struct ixl_pf *); void ixl_get_bus_info(struct ixl_pf *pf); int ixl_aq_get_link_status(struct ixl_pf *, struct i40e_aqc_get_link_status *); +void ixl_set_link(struct ixl_pf *, bool); int ixl_handle_nvmupd_cmd(struct ixl_pf *, struct ifdrv *); int ixl_handle_i2c_eeprom_read_cmd(struct ixl_pf *, struct ifreq *ifr); diff --git a/sys/dev/ixl/ixl_pf_iflib.c b/sys/dev/ixl/ixl_pf_iflib.c index 4351f65ee5ab..6d80bb472b72 100644 --- a/sys/dev/ixl/ixl_pf_iflib.c +++ b/sys/dev/ixl/ixl_pf_iflib.c @@ -413,6 +413,8 @@ ixl_link_event(struct ixl_pf *pf, struct i40e_arq_event_info *e) /* Print out message if an unqualified module is found */ if ((status->link_info & I40E_AQ_MEDIA_AVAILABLE) && (pf->advertised_speed) && + (atomic_load_32(&pf->state) & + IXL_PF_STATE_LINK_ACTIVE_ON_DOWN) != 0 && (!(status->an_info & I40E_AQ_QUALIFIED_MODULE)) && (!(status->link_info & I40E_AQ_LINK_UP))) device_printf(dev, "Link failed because " diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index c563eca63605..7fd4d78ef40e 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -60,6 +60,7 @@ static int ixl_sysctl_pf_tx_itr(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_pf_rx_itr(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_eee_enable(SYSCTL_HANDLER_ARGS); +static int ixl_sysctl_set_link_active(SYSCTL_HANDLER_ARGS); /* Debug Sysctls */ static int ixl_sysctl_link_status(SYSCTL_HANDLER_ARGS); @@ -383,6 +384,9 @@ retry: break; } + /* Keep link active by default */ + atomic_set_32(&pf->state, IXL_PF_STATE_LINK_ACTIVE_ON_DOWN); + /* Print a subset of the capability information. */ device_printf(dev, "PF-ID[%d]: VFs %d, MSI-X %d, VF MSI-X %d, QPs %d, %s\n", @@ -2283,6 +2287,12 @@ ixl_add_device_sysctls(struct ixl_pf *pf) CTLFLAG_RD | CTLFLAG_MPSAFE, &pf->stats.rx_lpi_count, "RX LPI count"); + SYSCTL_ADD_PROC(ctx, ctx_list, OID_AUTO, + "link_active_on_if_down", + CTLTYPE_INT | CTLFLAG_RWTUN, + pf, 0, ixl_sysctl_set_link_active, "I", + IXL_SYSCTL_HELP_SET_LINK_ACTIVE); + /* Add sysctls meant to print debug information, but don't list them * in "sysctl -a" output. */ debug_node = SYSCTL_ADD_NODE(ctx, ctx_list, @@ -2302,7 +2312,13 @@ ixl_add_device_sysctls(struct ixl_pf *pf) pf, 0, ixl_sysctl_link_status, "A", IXL_SYSCTL_HELP_LINK_STATUS); SYSCTL_ADD_PROC(ctx, debug_list, - OID_AUTO, "phy_abilities", CTLTYPE_STRING | CTLFLAG_RD, + OID_AUTO, "phy_abilities_init", + CTLTYPE_STRING | CTLFLAG_RD, + pf, 1, ixl_sysctl_phy_abilities, "A", "Initial PHY Abilities"); + + SYSCTL_ADD_PROC(ctx, debug_list, + OID_AUTO, "phy_abilities", + CTLTYPE_STRING | CTLFLAG_RD, pf, 0, ixl_sysctl_phy_abilities, "A", "PHY Abilities"); SYSCTL_ADD_PROC(ctx, debug_list, @@ -2872,6 +2888,95 @@ ixl_find_i2c_interface(struct ixl_pf *pf) return (-1); } +void +ixl_set_link(struct ixl_pf *pf, bool enable) +{ + struct i40e_hw *hw = &pf->hw; + device_t dev = pf->dev; + struct i40e_aq_get_phy_abilities_resp abilities; + struct i40e_aq_set_phy_config config; + enum i40e_status_code aq_error = 0; + u32 phy_type, phy_type_ext; + + /* Get initial capability information */ + aq_error = i40e_aq_get_phy_capabilities(hw, + FALSE, TRUE, &abilities, NULL); + if (aq_error) { + device_printf(dev, + "%s: Error getting phy capabilities %d," + " aq error: %d\n", __func__, aq_error, + hw->aq.asq_last_status); + return; + } + + phy_type = abilities.phy_type; + phy_type_ext = abilities.phy_type_ext; + + /* Get current capability information */ + aq_error = i40e_aq_get_phy_capabilities(hw, + FALSE, FALSE, &abilities, NULL); + if (aq_error) { + device_printf(dev, + "%s: Error getting phy capabilities %d," + " aq error: %d\n", __func__, aq_error, + hw->aq.asq_last_status); + return; + } + + /* Prepare new config */ + memset(&config, 0, sizeof(config)); + config.link_speed = abilities.link_speed; + config.abilities = abilities.abilities; + config.eee_capability = abilities.eee_capability; + config.eeer = abilities.eeer_val; + config.low_power_ctrl = abilities.d3_lpan; + config.fec_config = abilities.fec_cfg_curr_mod_ext_info + & I40E_AQ_PHY_FEC_CONFIG_MASK; + config.phy_type = 0; + config.phy_type_ext = 0; + + if (enable) { + config.phy_type = phy_type; + config.phy_type_ext = phy_type_ext; + + config.abilities &= ~(I40E_AQ_PHY_FLAG_PAUSE_TX | + I40E_AQ_PHY_FLAG_PAUSE_RX); + + switch (pf->fc) { + case I40E_FC_FULL: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX | + I40E_AQ_PHY_FLAG_PAUSE_RX; + break; + case I40E_FC_RX_PAUSE: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_RX; + break; + case I40E_FC_TX_PAUSE: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX; + break; + default: + break; + } + } + + aq_error = i40e_aq_set_phy_config(hw, &config, NULL); + if (aq_error) { + device_printf(dev, + "%s: Error setting new phy config %d," + " aq error: %d\n", __func__, aq_error, + hw->aq.asq_last_status); + return; + } + + aq_error = i40e_aq_set_link_restart_an(hw, enable, NULL); + if (aq_error) { + device_printf(dev, + "%s: Error set link config %d," + " aq error: %d\n", __func__, aq_error, + hw->aq.asq_last_status); + return; + } +} + static char * ixl_phy_type_string(u32 bit_pos, bool ext) { @@ -3030,7 +3135,7 @@ ixl_sysctl_phy_abilities(SYSCTL_HANDLER_ARGS) } status = i40e_aq_get_phy_capabilities(hw, - FALSE, FALSE, &abilities, NULL); + FALSE, arg2 != 0, &abilities, NULL); if (status) { device_printf(dev, "%s: i40e_aq_get_phy_capabilities() status %s, aq error %s\n", @@ -4215,6 +4320,28 @@ ixl_sysctl_eee_enable(SYSCTL_HANDLER_ARGS) return (0); } +static int +ixl_sysctl_set_link_active(SYSCTL_HANDLER_ARGS) +{ + struct ixl_pf *pf = (struct ixl_pf *)arg1; + int error, state; + + state = !!(atomic_load_acq_32(&pf->state) & + IXL_PF_STATE_LINK_ACTIVE_ON_DOWN); + + error = sysctl_handle_int(oidp, &state, 0, req); + if ((error) || (req->newptr == NULL)) + return (error); + + if (state == 0) + atomic_clear_32(&pf->state, IXL_PF_STATE_LINK_ACTIVE_ON_DOWN); + else + atomic_set_32(&pf->state, IXL_PF_STATE_LINK_ACTIVE_ON_DOWN); + + return (0); +} + + int ixl_attach_get_link_status(struct ixl_pf *pf) { From owner-dev-commits-src-all@freebsd.org Mon Sep 20 23:22:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB25C6AF711; Mon, 20 Sep 2021 23:22:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HD0vp3kjdz3jf3; Mon, 20 Sep 2021 23:22:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 539851970C; Mon, 20 Sep 2021 23:22: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 18KNMUDN061375; Mon, 20 Sep 2021 23:22:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KNMUe5061374; Mon, 20 Sep 2021 23:22:30 GMT (envelope-from git) Date: Mon, 20 Sep 2021 23:22:30 GMT Message-Id: <202109202322.18KNMUe5061374@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 9fb4d2769549 - stable/12 - ixl(4): Report RX errors as sum of all RX error counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 9fb4d27695499501572335700418ca40b20cb6b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 23:22:30 -0000 The branch stable/12 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=9fb4d27695499501572335700418ca40b20cb6b1 commit 9fb4d27695499501572335700418ca40b20cb6b1 Author: Krzysztof Galazka AuthorDate: 2021-03-03 01:33:11 +0000 Commit: Eric Joyner CommitDate: 2021-09-20 21:31:03 +0000 ixl(4): Report RX errors as sum of all RX error counters HW keeps track of RX errors using several counters, each for specific type of errors. Report RX errors to OS as sum of all those counters: CRC errors, illegal bytes, checksum, length, undersize, fragment, oversize and jabber errors. There is no HW counter for frames with invalid L3/L4 checksums so add a SW one. Also add a "rx_errors" sysctl with a copy of netstat IERRORS counter value to make it easier accessible from scripts. Reviewed By: erj Tested By: gowtham.kumar.ks@intel.com Sponsored By: Intel Corporation Differential Revision: https://reviews.freebsd.org/D27639 (cherry picked from commit 9f99061ef9c95b171fc92d34026222bb5e052337) --- sys/dev/ixl/ixl.h | 1 + sys/dev/ixl/ixl_pf_main.c | 15 +++++++++++++-- sys/dev/ixl/ixl_txrx.c | 16 +++++++++------- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/sys/dev/ixl/ixl.h b/sys/dev/ixl/ixl.h index 65e92c470a6c..b3052b52eadd 100644 --- a/sys/dev/ixl/ixl.h +++ b/sys/dev/ixl/ixl.h @@ -387,6 +387,7 @@ struct rx_ring { u64 rx_packets; u64 rx_bytes; u64 desc_errs; + u64 csum_errs; }; /* diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index 7fd4d78ef40e..782d51ac696d 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -780,6 +780,11 @@ ixl_vsi_add_sysctls(struct ixl_vsi * vsi, const char * sysctl_name, bool queues_ vsi_list = SYSCTL_CHILDREN(vsi->vsi_node); ixl_add_sysctls_eth_stats(&vsi->sysctl_ctx, vsi_list, &vsi->eth_stats); + /* Copy of netstat RX errors counter for validation purposes */ + SYSCTL_ADD_UQUAD(&vsi->sysctl_ctx, vsi_list, OID_AUTO, "rx_errors", + CTLFLAG_RD, &vsi->ierrors, + "RX packet errors"); + if (queues_sysctls) ixl_vsi_add_queues_stats(vsi, &vsi->sysctl_ctx); } @@ -1998,7 +2003,7 @@ ixl_update_vsi_stats(struct ixl_vsi *vsi) struct ixl_pf *pf; struct ifnet *ifp; struct i40e_eth_stats *es; - u64 tx_discards; + u64 tx_discards, csum_errs; struct i40e_hw_port_stats *nsd; @@ -2011,6 +2016,11 @@ ixl_update_vsi_stats(struct ixl_vsi *vsi) tx_discards = es->tx_discards + nsd->tx_dropped_link_down; + csum_errs = 0; + for (int i = 0; i < vsi->num_rx_queues; i++) + csum_errs += vsi->rx_queues[i].rxr.csum_errs; + nsd->checksum_error = csum_errs; + /* Update ifnet stats */ IXL_SET_IPACKETS(vsi, es->rx_unicast + es->rx_multicast + @@ -2024,7 +2034,8 @@ ixl_update_vsi_stats(struct ixl_vsi *vsi) IXL_SET_OMCASTS(vsi, es->tx_multicast); IXL_SET_IERRORS(vsi, nsd->crc_errors + nsd->illegal_bytes + - nsd->rx_undersize + nsd->rx_oversize + nsd->rx_fragments + + nsd->checksum_error + nsd->rx_length_errors + + nsd->rx_undersize + nsd->rx_fragments + nsd->rx_oversize + nsd->rx_jabber); IXL_SET_OERRORS(vsi, es->tx_errors); IXL_SET_IQDROPS(vsi, es->rx_discards + nsd->eth.rx_discards); diff --git a/sys/dev/ixl/ixl_txrx.c b/sys/dev/ixl/ixl_txrx.c index 7f092d47aec3..15204b7996e5 100644 --- a/sys/dev/ixl/ixl_txrx.c +++ b/sys/dev/ixl/ixl_txrx.c @@ -51,7 +51,7 @@ #endif /* Local Prototypes */ -static void ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype); +static u8 ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype); static int ixl_isc_txd_encap(void *arg, if_pkt_info_t pi); static void ixl_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx); @@ -720,7 +720,7 @@ ixl_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) rxr->rx_packets++; if ((if_getcapenable(vsi->ifp) & IFCAP_RXCSUM) != 0) - ixl_rx_checksum(ri, status, error, ptype); + rxr->csum_errs += ixl_rx_checksum(ri, status, error, ptype); ri->iri_flowid = le32toh(cur->wb.qword0.hi_dword.rss); ri->iri_rsstype = ixl_ptype_to_hash(ptype); ri->iri_vtag = vtag; @@ -737,7 +737,7 @@ ixl_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) * doesn't spend time verifying the checksum. * *********************************************************************/ -static void +static u8 ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype) { struct i40e_rx_ptype_decoded decoded; @@ -746,7 +746,7 @@ ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype) /* No L3 or L4 checksum was calculated */ if (!(status & (1 << I40E_RX_DESC_STATUS_L3L4P_SHIFT))) - return; + return (0); decoded = decode_rx_desc_ptype(ptype); @@ -756,7 +756,7 @@ ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype) if (status & (1 << I40E_RX_DESC_STATUS_IPV6EXADD_SHIFT)) { ri->iri_csum_flags = 0; - return; + return (1); } } @@ -764,17 +764,19 @@ ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype) /* IPv4 checksum error */ if (error & (1 << I40E_RX_DESC_ERROR_IPE_SHIFT)) - return; + return (1); ri->iri_csum_flags |= CSUM_L3_VALID; ri->iri_csum_flags |= CSUM_L4_CALC; /* L4 checksum error */ if (error & (1 << I40E_RX_DESC_ERROR_L4E_SHIFT)) - return; + return (1); ri->iri_csum_flags |= CSUM_L4_VALID; ri->iri_csum_data |= htons(0xffff); + + return (0); } /* Set Report Status queue fields to 0 */ From owner-dev-commits-src-all@freebsd.org Mon Sep 20 23:22:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC3D06AF3A7; Mon, 20 Sep 2021 23:22: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 4HD0vq4MnZz3jsb; Mon, 20 Sep 2021 23:22: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 7730319786; Mon, 20 Sep 2021 23:22: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 18KNMVwX061399; Mon, 20 Sep 2021 23:22:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KNMVfl061398; Mon, 20 Sep 2021 23:22:31 GMT (envelope-from git) Date: Mon, 20 Sep 2021 23:22:31 GMT Message-Id: <202109202322.18KNMVfl061398@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 5574b12aac2b - stable/12 - ix(4): Report RX errors as sum of all RX error counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5574b12aac2bdfe66ec1d9564f932eeec9ac213c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 23:22:31 -0000 The branch stable/12 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=5574b12aac2bdfe66ec1d9564f932eeec9ac213c commit 5574b12aac2bdfe66ec1d9564f932eeec9ac213c Author: Piotr Pietruszewski AuthorDate: 2021-03-03 01:21:58 +0000 Commit: Eric Joyner CommitDate: 2021-09-20 21:31:33 +0000 ix(4): Report RX errors as sum of all RX error counters HW keeps track of RX errors using several counters, each for specific type of errors. Report RX errors to OS as sum of all those counters: CRC errors, illegal bytes, checksum, length, undersize, fragment, oversize and jabber errors. Also, add new "rx_errs" sysctl in the dev.ix.N.mac_stats tree. This is to provide an another way to display the sum of RX errors. Signed-off-by: Piotr Pietruszewski Reviewed By: erj Tested By: gowtham.kumar.ks@intel.com Sponsored By: Intel Corporation Differential Revision: https://reviews.freebsd.org/D27191 (cherry picked from commit afb1aa4e6df245d38fd2ba683fa521d5dabe8392) --- sys/dev/ixgbe/if_ix.c | 19 ++++++++++++++++++- sys/dev/ixgbe/ixgbe.h | 12 ++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 655f9a0b52b4..362bb7fe0cbc 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -1535,7 +1535,22 @@ ixgbe_update_stats_counters(struct adapter *adapter) IXGBE_SET_OMCASTS(adapter, stats->mptc); IXGBE_SET_COLLISIONS(adapter, 0); IXGBE_SET_IQDROPS(adapter, total_missed_rx); - IXGBE_SET_IERRORS(adapter, stats->crcerrs + stats->rlec); + + /* + * Aggregate following types of errors as RX errors: + * - CRC error count, + * - illegal byte error count, + * - checksum error count, + * - missed packets count, + * - length error count, + * - undersized packets count, + * - fragmented packets count, + * - oversized packets count, + * - jabber count. + */ + IXGBE_SET_IERRORS(adapter, stats->crcerrs + stats->illerrc + stats->xec + + stats->mpc[0] + stats->rlec + stats->ruc + stats->rfc + stats->roc + + stats->rjc); } /* ixgbe_update_stats_counters */ /************************************************************************ @@ -1625,6 +1640,8 @@ ixgbe_add_hw_stats(struct adapter *adapter) CTLFLAG_RD, NULL, "MAC Statistics"); stat_list = SYSCTL_CHILDREN(stat_node); + SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "rx_errs", + CTLFLAG_RD, &adapter->ierrors, IXGBE_SYSCTL_DESC_RX_ERRS); SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "crc_errs", CTLFLAG_RD, &stats->crcerrs, "CRC Errors"); SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "ill_errs", diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h index 63aa2047cc1e..3403e0ba6ed2 100644 --- a/sys/dev/ixgbe/ixgbe.h +++ b/sys/dev/ixgbe/ixgbe.h @@ -538,6 +538,18 @@ struct adapter { "\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 From owner-dev-commits-src-all@freebsd.org Mon Sep 20 23:22:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 335946AF54C; Mon, 20 Sep 2021 23:22: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 4HD0vr6KqZz3jWH; Mon, 20 Sep 2021 23:22: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 A9E5919787; Mon, 20 Sep 2021 23:22: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 18KNMWki061423; Mon, 20 Sep 2021 23:22:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KNMW3m061422; Mon, 20 Sep 2021 23:22:32 GMT (envelope-from git) Date: Mon, 20 Sep 2021 23:22:32 GMT Message-Id: <202109202322.18KNMW3m061422@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 52323cdab724 - stable/12 - ice_ddp: Update package file to 1.3.19.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 52323cdab7242ae651357bb51b9658e2b5193795 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 23:22:33 -0000 The branch stable/12 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=52323cdab7242ae651357bb51b9658e2b5193795 commit 52323cdab7242ae651357bb51b9658e2b5193795 Author: Eric Joyner AuthorDate: 2021-02-23 01:43:54 +0000 Commit: Eric Joyner CommitDate: 2021-09-20 22:08:16 +0000 ice_ddp: Update package file to 1.3.19.0 This package is intended to be used with ice(4) version 0.28.1-k. That update will happen in a forthcoming commit. Signed-off-by: Eric Joyner Sponsored by: Intel Corporation (cherry picked from commit a7ac518bff64d48cf262c60c4dc57eef34e74a07) --- sys/conf/files.amd64 | 8 ++++---- sys/conf/files.arm64 | 12 ++++++------ sys/contrib/dev/ice/LICENSE | 2 +- .../dev/ice/{ice-1.3.16.0.pkg => ice-1.3.19.0.pkg} | Bin 659716 -> 614660 bytes sys/modules/ice_ddp/Makefile | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index c49728bff1aa..abcf387a10eb 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -288,8 +288,8 @@ dev/ice/ice_sriov.c optional ice pci \ dev/ice/ice_switch.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" ice_ddp.c optional ice_ddp \ - compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031000 -mice_ddp -c${.TARGET}" \ - no-implicit-rule before-depend local \ + compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031300 -mice_ddp -c${.TARGET}" \ + no-ctfconvert no-implicit-rule before-depend local \ clean "ice_ddp.c" ice_ddp.fwo optional ice_ddp \ dependency "ice_ddp.fw" \ @@ -297,8 +297,8 @@ ice_ddp.fwo optional ice_ddp \ no-implicit-rule \ clean "ice_ddp.fwo" ice_ddp.fw optional ice_ddp \ - dependency "$S/contrib/dev/ice/ice-1.3.16.0.pkg" \ - compile-with "${CP} $S/contrib/dev/ice/ice-1.3.16.0.pkg ice_ddp.fw" \ + dependency "$S/contrib/dev/ice/ice-1.3.19.0.pkg" \ + compile-with "${CP} $S/contrib/dev/ice/ice-1.3.19.0.pkg ice_ddp.fw" \ no-obj no-implicit-rule \ clean "ice_ddp.fw" dev/ioat/ioat.c optional ioat pci diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index ea1fdaf59e8c..d082b032fe69 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -258,18 +258,18 @@ dev/ice/ice_sriov.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" dev/ice/ice_switch.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" -ice_ddp.c optional ice_ddp \ - compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031000 -mice_ddp -c${.TARGET}" \ - no-implicit-rule before-depend local \ +ice_ddp.c optional ice_ddp \ + compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031300 -mice_ddp -c${.TARGET}" \ + no-ctfconvert no-implicit-rule before-depend local \ clean "ice_ddp.c" ice_ddp.fwo optional ice_ddp \ dependency "ice_ddp.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "ice_ddp.fwo" -ice_ddp.fw optional ice_ddp \ - dependency "$S/contrib/dev/ice/ice-1.3.16.0.pkg" \ - compile-with "${CP} $S/contrib/dev/ice/ice-1.3.16.0.pkg ice_ddp.fw" \ +ice_ddp.fw optional ice_ddp \ + dependency "$S/contrib/dev/ice/ice-1.3.19.0.pkg" \ + compile-with "${CP} $S/contrib/dev/ice/ice-1.3.19.0.pkg ice_ddp.fw" \ no-obj no-implicit-rule \ clean "ice_ddp.fw" dev/iicbus/sy8106a.c optional sy8106a fdt diff --git a/sys/contrib/dev/ice/LICENSE b/sys/contrib/dev/ice/LICENSE index 7daf627fc7a0..7faadfc55aac 100644 --- a/sys/contrib/dev/ice/LICENSE +++ b/sys/contrib/dev/ice/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2006-2018, Intel Corporation. +Copyright (c) 2006-2021, Intel Corporation. All rights reserved. Redistribution. Redistribution and use in binary form, without diff --git a/sys/contrib/dev/ice/ice-1.3.16.0.pkg b/sys/contrib/dev/ice/ice-1.3.19.0.pkg similarity index 79% rename from sys/contrib/dev/ice/ice-1.3.16.0.pkg rename to sys/contrib/dev/ice/ice-1.3.19.0.pkg index ec5caecb3a72..32e2603bc131 100644 Binary files a/sys/contrib/dev/ice/ice-1.3.16.0.pkg and b/sys/contrib/dev/ice/ice-1.3.19.0.pkg differ diff --git a/sys/modules/ice_ddp/Makefile b/sys/modules/ice_ddp/Makefile index e6f45ae3820b..38337a106368 100644 --- a/sys/modules/ice_ddp/Makefile +++ b/sys/modules/ice_ddp/Makefile @@ -1,6 +1,6 @@ # $FreeBSD$ KMOD= ice_ddp -FIRMWS= ${SRCTOP}/sys/contrib/dev/ice/ice-1.3.16.0.pkg:ice_ddp:0x01031000 +FIRMWS= ${SRCTOP}/sys/contrib/dev/ice/ice-1.3.19.0.pkg:ice_ddp:0x01031300 .include From owner-dev-commits-src-all@freebsd.org Mon Sep 20 23:22:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 333606AF58F; Mon, 20 Sep 2021 23:22: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 4HD0vs71qjz3jWL; Mon, 20 Sep 2021 23:22: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 D0AD219788; Mon, 20 Sep 2021 23:22: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 18KNMXl9061447; Mon, 20 Sep 2021 23:22:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KNMXAO061446; Mon, 20 Sep 2021 23:22:33 GMT (envelope-from git) Date: Mon, 20 Sep 2021 23:22:33 GMT Message-Id: <202109202322.18KNMXAO061446@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 5d38d78f3550 - stable/12 - ice(4): Update to version 0.28.1-k MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5d38d78f355013eba79eee3addf15a7ad59707c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 23:22:34 -0000 The branch stable/12 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=5d38d78f355013eba79eee3addf15a7ad59707c9 commit 5d38d78f355013eba79eee3addf15a7ad59707c9 Author: Eric Joyner AuthorDate: 2021-02-23 01:45:09 +0000 Commit: Eric Joyner CommitDate: 2021-09-20 22:09:29 +0000 ice(4): Update to version 0.28.1-k This updates the driver to align with the version included in the "Intel Ethernet Adapter Complete Driver Pack", version 25.6. There are no major functional changes; this mostly contains bug fixes and changes to prepare for new features. This version of the driver uses the previously committed ice_ddp package 1.3.19.0. Signed-off-by: Eric Joyner Tested by: jeffrey.e.pieper@intel.com Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D28640 (cherry picked from commit d08b8680e12ad692736c84238dcf45c70c228914) --- sys/conf/files.amd64 | 2 + sys/conf/files.arm64 | 2 + sys/dev/ice/ice_adminq_cmd.h | 107 ++-- sys/dev/ice/ice_alloc.h | 2 +- sys/dev/ice/ice_bitops.h | 4 +- sys/dev/ice/ice_common.c | 135 ++--- sys/dev/ice/ice_common.h | 17 +- sys/dev/ice/ice_common_sysctls.h | 2 +- sys/dev/ice/ice_common_txrx.h | 2 +- sys/dev/ice/ice_controlq.c | 2 +- sys/dev/ice/ice_controlq.h | 6 +- sys/dev/ice/ice_dcb.c | 40 +- sys/dev/ice/ice_dcb.h | 2 +- sys/dev/ice/ice_devids.h | 2 +- sys/dev/ice/ice_drv_info.h | 27 +- sys/dev/ice/ice_features.h | 2 +- sys/dev/ice/ice_flex_pipe.c | 57 +- sys/dev/ice/ice_flex_pipe.h | 2 +- sys/dev/ice/ice_flex_type.h | 11 +- sys/dev/ice/ice_flow.c | 243 +++++---- sys/dev/ice/ice_flow.h | 36 +- sys/dev/ice/ice_hw_autogen.h | 2 +- sys/dev/ice/ice_iflib.h | 2 +- sys/dev/ice/ice_iflib_recovery_txrx.c | 2 +- sys/dev/ice/ice_iflib_sysctls.h | 2 +- sys/dev/ice/ice_iflib_txrx.c | 2 +- sys/dev/ice/ice_lan_tx_rx.h | 2 +- sys/dev/ice/ice_lib.c | 56 +- sys/dev/ice/ice_lib.h | 2 +- sys/dev/ice/ice_nvm.c | 954 +++++++++++++++++++++++++++++----- sys/dev/ice/ice_nvm.h | 24 +- sys/dev/ice/ice_opts.h | 2 +- sys/dev/ice/ice_osdep.c | 2 +- sys/dev/ice/ice_osdep.h | 2 +- sys/dev/ice/ice_protocol_type.h | 27 +- sys/dev/ice/ice_resmgr.c | 2 +- sys/dev/ice/ice_resmgr.h | 2 +- sys/dev/ice/ice_rss.h | 2 +- sys/dev/ice/ice_sbq_cmd.h | 2 +- sys/dev/ice/ice_sched.c | 562 ++++++++++++-------- sys/dev/ice/ice_sched.h | 31 +- sys/dev/ice/ice_sriov.c | 407 ++++++++++++++- sys/dev/ice/ice_sriov.h | 23 +- sys/dev/ice/ice_status.h | 2 +- sys/dev/ice/ice_strings.c | 2 +- sys/dev/ice/ice_switch.c | 70 ++- sys/dev/ice/ice_switch.h | 4 +- sys/dev/ice/ice_type.h | 266 ++++++++-- sys/dev/ice/ice_vlan_mode.c | 72 +++ sys/dev/ice/ice_vlan_mode.h | 60 +++ sys/dev/ice/if_ice_iflib.c | 2 +- sys/dev/ice/virtchnl.h | 287 +++++++++- sys/dev/ice/virtchnl_inline_ipsec.h | 16 +- sys/modules/ice/Makefile | 2 +- 54 files changed, 2881 insertions(+), 717 deletions(-) diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index abcf387a10eb..ee7d8fc2f072 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -287,6 +287,8 @@ dev/ice/ice_sriov.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" dev/ice/ice_switch.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" +dev/ice/ice_vlan_mode.c optional ice pci \ + compile-with "${NORMAL_C} -I$S/dev/ice" ice_ddp.c optional ice_ddp \ compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031300 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index d082b032fe69..1eaf553973e5 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -258,6 +258,8 @@ dev/ice/ice_sriov.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" dev/ice/ice_switch.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" +dev/ice/ice_vlan_mode.c optional ice pci \ + compile-with "${NORMAL_C} -I$S/dev/ice" ice_ddp.c optional ice_ddp \ compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031300 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ diff --git a/sys/dev/ice/ice_adminq_cmd.h b/sys/dev/ice/ice_adminq_cmd.h index 8d8c025fdd37..9179b0ce1226 100644 --- a/sys/dev/ice/ice_adminq_cmd.h +++ b/sys/dev/ice/ice_adminq_cmd.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -166,6 +166,7 @@ struct ice_aqc_list_caps_elem { #define ICE_AQC_CAPS_LOGI_TO_PHYSI_PORT_MAP 0x0073 #define ICE_AQC_CAPS_SKU 0x0074 #define ICE_AQC_CAPS_PORT_MAP 0x0075 +#define ICE_AQC_CAPS_PCIE_RESET_AVOIDANCE 0x0076 #define ICE_AQC_CAPS_NVM_MGMT 0x0080 u8 major_ver; @@ -1449,6 +1450,7 @@ struct ice_aqc_get_link_status_data { #define ICE_AQ_LINK_ACT_PORT_OPT_INVAL BIT(2) #define ICE_AQ_LINK_FEAT_ID_OR_CONFIG_ID_INVAL BIT(3) #define ICE_AQ_LINK_TOPO_CRITICAL_SDP_ERR BIT(4) +#define ICE_AQ_LINK_MODULE_POWER_UNSUPPORTED BIT(5) u8 link_info; #define ICE_AQ_LINK_UP BIT(0) /* Link Status */ #define ICE_AQ_LINK_FAULT BIT(1) @@ -1496,7 +1498,7 @@ struct ice_aqc_get_link_status_data { #define ICE_AQ_CFG_PACING_TYPE_FIXED ICE_AQ_CFG_PACING_TYPE_M /* External Device Power Ability */ u8 power_desc; -#define ICE_AQ_PWR_CLASS_M 0x3 +#define ICE_AQ_PWR_CLASS_M 0x3F #define ICE_AQ_LINK_PWR_BASET_LOW_HIGH 0 #define ICE_AQ_LINK_PWR_BASET_HIGH 1 #define ICE_AQ_LINK_PWR_QSFP_CLASS_1 0 @@ -1860,7 +1862,9 @@ struct ice_aqc_mdio { #define ICE_AQC_MDIO_DEV_M (0x1F << ICE_AQC_MDIO_DEV_S) #define ICE_AQC_MDIO_CLAUSE_22 BIT(5) #define ICE_AQC_MDIO_CLAUSE_45 BIT(6) - u8 rsvd; + u8 mdio_bus_address; +#define ICE_AQC_MDIO_BUS_ADDR_S 0 +#define ICE_AQC_MDIO_BUS_ADDR_M (0x1F << ICE_AQC_MDIO_BUS_ADDR_S) __le16 offset; __le16 data; /* Input in write cmd, output in read cmd. */ u8 rsvd1[4]; @@ -2001,6 +2005,22 @@ struct ice_aqc_sff_eeprom { __le32 addr_low; }; +/* SW Set GPIO command (indirect 0x6EF) + * SW Get GPIO command (indirect 0x6F0) + */ +struct ice_aqc_sw_gpio { + __le16 gpio_ctrl_handle; +#define ICE_AQC_SW_GPIO_CONTROLLER_HANDLE_S 0 +#define ICE_AQC_SW_GPIO_CONTROLLER_HANDLE_M (0x3FF << ICE_AQC_SW_GPIO_CONTROLLER_HANDLE_S) + u8 gpio_num; +#define ICE_AQC_SW_GPIO_NUMBER_S 0 +#define ICE_AQC_SW_GPIO_NUMBER_M (0x1F << ICE_AQC_SW_GPIO_NUMBER_S) + u8 gpio_params; +#define ICE_AQC_SW_GPIO_PARAMS_DIRECTION BIT(1) +#define ICE_AQC_SW_GPIO_PARAMS_VALUE BIT(0) + u8 rsvd[12]; +}; + /* NVM Read command (indirect 0x0701) * NVM Erase commands (direct 0x0702) * NVM Write commands (indirect 0x0703) @@ -2027,6 +2047,9 @@ struct ice_aqc_nvm { #define ICE_AQC_NVM_REVERT_LAST_ACTIV BIT(6) /* Write Activate only */ #define ICE_AQC_NVM_ACTIV_SEL_MASK MAKEMASK(0x7, 3) #define ICE_AQC_NVM_FLASH_ONLY BIT(7) +#define ICE_AQC_NVM_POR_FLAG 0 /* Used by NVM Write completion on ARQ */ +#define ICE_AQC_NVM_PERST_FLAG 1 +#define ICE_AQC_NVM_EMPR_FLAG 2 __le16 module_typeid; __le16 length; #define ICE_AQC_NVM_ERASE_LEN 0xFFFF @@ -2056,32 +2079,22 @@ struct ice_aqc_nvm { #define ICE_AQC_NVM_LLDP_STATUS_M_LEN 4 /* In Bits */ #define ICE_AQC_NVM_LLDP_STATUS_RD_LEN 4 /* In Bytes */ -/* The result of netlist NVM read comes in a TLV format. The actual data - * (netlist header) starts from word offset 1 (byte 2). The FW strips - * out the type field from the TLV header so all the netlist fields - * should adjust their offset value by 1 word (2 bytes) in order to map - * their correct location. +#define ICE_AQC_NVM_MINSREV_MOD_ID 0x130 + +/* Used for reading and writing MinSRev using 0x0701 and 0x0703. Note that the + * type field is excluded from the section when reading and writing from + * a module using the module_typeid field with these AQ commands. */ -#define ICE_AQC_NVM_LINK_TOPO_NETLIST_MOD_ID 0x11B -#define ICE_AQC_NVM_LINK_TOPO_NETLIST_LEN_OFFSET 1 -#define ICE_AQC_NVM_LINK_TOPO_NETLIST_LEN 2 /* In bytes */ -#define ICE_AQC_NVM_NETLIST_NODE_COUNT_OFFSET 2 -#define ICE_AQC_NVM_NETLIST_NODE_COUNT_LEN 2 /* In bytes */ -#define ICE_AQC_NVM_NETLIST_NODE_COUNT_M MAKEMASK(0x3FF, 0) -#define ICE_AQC_NVM_NETLIST_ID_BLK_START_OFFSET 5 -#define ICE_AQC_NVM_NETLIST_ID_BLK_LEN 0x30 /* In words */ - -/* netlist ID block field offsets (word offsets) */ -#define ICE_AQC_NVM_NETLIST_ID_BLK_MAJOR_VER_LOW 2 -#define ICE_AQC_NVM_NETLIST_ID_BLK_MAJOR_VER_HIGH 3 -#define ICE_AQC_NVM_NETLIST_ID_BLK_MINOR_VER_LOW 4 -#define ICE_AQC_NVM_NETLIST_ID_BLK_MINOR_VER_HIGH 5 -#define ICE_AQC_NVM_NETLIST_ID_BLK_TYPE_LOW 6 -#define ICE_AQC_NVM_NETLIST_ID_BLK_TYPE_HIGH 7 -#define ICE_AQC_NVM_NETLIST_ID_BLK_REV_LOW 8 -#define ICE_AQC_NVM_NETLIST_ID_BLK_REV_HIGH 9 -#define ICE_AQC_NVM_NETLIST_ID_BLK_SHA_HASH 0xA -#define ICE_AQC_NVM_NETLIST_ID_BLK_CUST_VER 0x2F +struct ice_aqc_nvm_minsrev { + __le16 length; + __le16 validity; +#define ICE_AQC_NVM_MINSREV_NVM_VALID BIT(0) +#define ICE_AQC_NVM_MINSREV_OROM_VALID BIT(1) + __le16 nvm_minsrev_l; + __le16 nvm_minsrev_h; + __le16 orom_minsrev_l; + __le16 orom_minsrev_h; +}; /* Used for 0x0704 as well as for 0x0705 commands */ struct ice_aqc_nvm_cfg { @@ -2114,7 +2127,7 @@ struct ice_aqc_nvm_checksum { u8 rsvd2[12]; }; -/** +/* * Send to PF command (indirect 0x0801) ID is only used by PF * * Send to VF command (indirect 0x0802) ID is only used by PF @@ -2541,6 +2554,7 @@ struct ice_pkg_ver { }; #define ICE_PKG_NAME_SIZE 32 +#define ICE_SEG_ID_SIZE 28 #define ICE_SEG_NAME_SIZE 28 struct ice_aqc_get_pkg_info { @@ -2589,6 +2603,35 @@ struct ice_aqc_set_health_status_config { u8 reserved[15]; }; +#define ICE_AQC_HEALTH_STATUS_ERR_UNKNOWN_MOD_STRICT 0x101 +#define ICE_AQC_HEALTH_STATUS_ERR_MOD_TYPE 0x102 +#define ICE_AQC_HEALTH_STATUS_ERR_MOD_QUAL 0x103 +#define ICE_AQC_HEALTH_STATUS_ERR_MOD_COMM 0x104 +#define ICE_AQC_HEALTH_STATUS_ERR_MOD_CONFLICT 0x105 +#define ICE_AQC_HEALTH_STATUS_ERR_MOD_NOT_PRESENT 0x106 +#define ICE_AQC_HEALTH_STATUS_INFO_MOD_UNDERUTILIZED 0x107 +#define ICE_AQC_HEALTH_STATUS_ERR_UNKNOWN_MOD_LENIENT 0x108 +#define ICE_AQC_HEALTH_STATUS_ERR_INVALID_LINK_CFG 0x10B +#define ICE_AQC_HEALTH_STATUS_ERR_PORT_ACCESS 0x10C +#define ICE_AQC_HEALTH_STATUS_ERR_PORT_UNREACHABLE 0x10D +#define ICE_AQC_HEALTH_STATUS_INFO_PORT_SPEED_MOD_LIMITED 0x10F +#define ICE_AQC_HEALTH_STATUS_ERR_PARALLEL_FAULT 0x110 +#define ICE_AQC_HEALTH_STATUS_INFO_PORT_SPEED_PHY_LIMITED 0x111 +#define ICE_AQC_HEALTH_STATUS_ERR_NETLIST_TOPO 0x112 +#define ICE_AQC_HEALTH_STATUS_ERR_NETLIST 0x113 +#define ICE_AQC_HEALTH_STATUS_ERR_TOPO_CONFLICT 0x114 +#define ICE_AQC_HEALTH_STATUS_ERR_LINK_HW_ACCESS 0x115 +#define ICE_AQC_HEALTH_STATUS_ERR_LINK_RUNTIME 0x116 +#define ICE_AQC_HEALTH_STATUS_ERR_DNL_INIT 0x117 +#define ICE_AQC_HEALTH_STATUS_INFO_RECOVERY 0x500 +#define ICE_AQC_HEALTH_STATUS_ERR_FLASH_ACCESS 0x501 +#define ICE_AQC_HEALTH_STATUS_ERR_NVM_AUTH 0x502 +#define ICE_AQC_HEALTH_STATUS_ERR_OROM_AUTH 0x503 +#define ICE_AQC_HEALTH_STATUS_ERR_DDP_AUTH 0x504 +#define ICE_AQC_HEALTH_STATUS_ERR_NVM_COMPAT 0x505 +#define ICE_AQC_HEALTH_STATUS_ERR_OROM_COMPAT 0x506 +#define ICE_AQC_HEALTH_STATUS_ERR_DCB_MIB 0x509 + /* Get Health Status codes (indirect 0xFF21) */ struct ice_aqc_get_supported_health_status_codes { __le16 health_code_count; @@ -2630,8 +2673,8 @@ struct ice_aqc_clear_health_status { * @opcode: AQ command opcode * @datalen: length in bytes of indirect/external data buffer * @retval: return value from firmware - * @cookie_h: opaque data high-half - * @cookie_l: opaque data low-half + * @cookie_high: opaque data high-half + * @cookie_low: opaque data low-half * @params: command-specific parameters * * Descriptor format for commands the driver posts on the Admin Transmit Queue @@ -2920,6 +2963,8 @@ enum ice_adminq_opc { ice_aqc_opc_set_gpio = 0x06EC, ice_aqc_opc_get_gpio = 0x06ED, ice_aqc_opc_sff_eeprom = 0x06EE, + ice_aqc_opc_sw_set_gpio = 0x06EF, + ice_aqc_opc_sw_get_gpio = 0x06F0, /* NVM commands */ ice_aqc_opc_nvm_read = 0x0701, diff --git a/sys/dev/ice/ice_alloc.h b/sys/dev/ice/ice_alloc.h index 1d9b9169eb02..b281958be793 100644 --- a/sys/dev/ice/ice_alloc.h +++ b/sys/dev/ice/ice_alloc.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_bitops.h b/sys/dev/ice/ice_bitops.h index 7c8cf6cb90f5..a7f729060b78 100644 --- a/sys/dev/ice/ice_bitops.h +++ b/sys/dev/ice/ice_bitops.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -423,7 +423,7 @@ ice_bitmap_set(ice_bitmap_t *dst, u16 pos, u16 num_bits) { u16 i; - for (i = pos; i < num_bits; i++) + for (i = pos; i < pos + num_bits; i++) ice_set_bit(i, dst); } diff --git a/sys/dev/ice/ice_common.c b/sys/dev/ice/ice_common.c index 20689f4893d4..5e2e4340c75c 100644 --- a/sys/dev/ice/ice_common.c +++ b/sys/dev/ice/ice_common.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -265,7 +265,7 @@ ice_aq_get_link_topo_handle(struct ice_port_info *pi, u8 node_type, return ice_aq_send_cmd(pi->hw, &desc, NULL, 0, cd); } -/* +/** * ice_is_media_cage_present * @pi: port information structure * @@ -704,13 +704,14 @@ static void ice_get_itr_intrl_gran(struct ice_hw *hw) void ice_print_rollback_msg(struct ice_hw *hw) { char nvm_str[ICE_NVM_VER_LEN] = { 0 }; - struct ice_nvm_info *nvm = &hw->nvm; struct ice_orom_info *orom; + struct ice_nvm_info *nvm; - orom = &nvm->orom; + orom = &hw->flash.orom; + nvm = &hw->flash.nvm; SNPRINTF(nvm_str, sizeof(nvm_str), "%x.%02x 0x%x %d.%d.%d", - nvm->major_ver, nvm->minor_ver, nvm->eetrack, orom->major, + nvm->major, nvm->minor, nvm->eetrack, orom->major, orom->build, orom->patch); ice_warn(hw, "Firmware rollback mode detected. Current version is NVM: %s, FW: %d.%d. Device may exhibit limited functionality. Refer to the Intel(R) Ethernet Adapters and Devices User Guide for details on firmware rollback mode\n", @@ -805,8 +806,7 @@ enum ice_status ice_init_hw(struct ice_hw *hw) ICE_AQC_REPORT_TOPO_CAP, pcaps, NULL); ice_free(hw, pcaps); if (status) - ice_debug(hw, ICE_DBG_PHY, "%s: Get PHY capabilities failed, continuing anyway\n", - __func__); + ice_debug(hw, ICE_DBG_PHY, "Get PHY capabilities failed, continuing anyway\n"); /* Initialize port_info struct with link information */ status = ice_aq_get_link_info(hw->port_info, false, NULL, NULL); @@ -850,6 +850,9 @@ enum ice_status ice_init_hw(struct ice_hw *hw) if (status) goto err_unroll_fltr_mgmt_struct; ice_init_lock(&hw->tnl_lock); + + ice_init_vlan_mode_ops(hw); + return ICE_SUCCESS; err_unroll_fltr_mgmt_struct: @@ -1701,7 +1704,7 @@ ice_aq_alloc_free_res(struct ice_hw *hw, u16 num_entries, if (!buf) return ICE_ERR_PARAM; - if (buf_size < (num_entries * sizeof(buf->elem[0]))) + if (buf_size < FLEX_ARRAY_SIZE(buf, elem, num_entries)) return ICE_ERR_PARAM; ice_fill_dflt_direct_cmd_desc(&desc, opc); @@ -1982,6 +1985,16 @@ ice_parse_common_caps(struct ice_hw *hw, struct ice_hw_common_caps *caps, case ICE_AQC_CAPS_NVM_VER: break; case ICE_AQC_CAPS_NVM_MGMT: + caps->sec_rev_disabled = + (number & ICE_NVM_MGMT_SEC_REV_DISABLED) ? + true : false; + ice_debug(hw, ICE_DBG_INIT, "%s: sec_rev_disabled = %d\n", prefix, + caps->sec_rev_disabled); + caps->update_disabled = + (number & ICE_NVM_MGMT_UPDATE_DISABLED) ? + true : false; + ice_debug(hw, ICE_DBG_INIT, "%s: update_disabled = %d\n", prefix, + caps->update_disabled); caps->nvm_unified_update = (number & ICE_NVM_MGMT_UNIFIED_UPD_SUPPORT) ? true : false; @@ -2389,26 +2402,25 @@ void ice_set_safe_mode_caps(struct ice_hw *hw) { struct ice_hw_func_caps *func_caps = &hw->func_caps; struct ice_hw_dev_caps *dev_caps = &hw->dev_caps; - u32 valid_func, rxq_first_id, txq_first_id; - u32 msix_vector_first_id, max_mtu; + struct ice_hw_common_caps cached_caps; u32 num_funcs; /* cache some func_caps values that should be restored after memset */ - valid_func = func_caps->common_cap.valid_functions; - txq_first_id = func_caps->common_cap.txq_first_id; - rxq_first_id = func_caps->common_cap.rxq_first_id; - msix_vector_first_id = func_caps->common_cap.msix_vector_first_id; - max_mtu = func_caps->common_cap.max_mtu; + cached_caps = func_caps->common_cap; /* unset func capabilities */ memset(func_caps, 0, sizeof(*func_caps)); +#define ICE_RESTORE_FUNC_CAP(name) \ + func_caps->common_cap.name = cached_caps.name + /* restore cached values */ - func_caps->common_cap.valid_functions = valid_func; - func_caps->common_cap.txq_first_id = txq_first_id; - func_caps->common_cap.rxq_first_id = rxq_first_id; - func_caps->common_cap.msix_vector_first_id = msix_vector_first_id; - func_caps->common_cap.max_mtu = max_mtu; + ICE_RESTORE_FUNC_CAP(valid_functions); + ICE_RESTORE_FUNC_CAP(txq_first_id); + ICE_RESTORE_FUNC_CAP(rxq_first_id); + ICE_RESTORE_FUNC_CAP(msix_vector_first_id); + ICE_RESTORE_FUNC_CAP(max_mtu); + ICE_RESTORE_FUNC_CAP(nvm_unified_update); /* one Tx and one Rx queue in safe mode */ func_caps->common_cap.num_rxq = 1; @@ -2419,22 +2431,22 @@ void ice_set_safe_mode_caps(struct ice_hw *hw) func_caps->guar_num_vsi = 1; /* cache some dev_caps values that should be restored after memset */ - valid_func = dev_caps->common_cap.valid_functions; - txq_first_id = dev_caps->common_cap.txq_first_id; - rxq_first_id = dev_caps->common_cap.rxq_first_id; - msix_vector_first_id = dev_caps->common_cap.msix_vector_first_id; - max_mtu = dev_caps->common_cap.max_mtu; + cached_caps = dev_caps->common_cap; num_funcs = dev_caps->num_funcs; /* unset dev capabilities */ memset(dev_caps, 0, sizeof(*dev_caps)); +#define ICE_RESTORE_DEV_CAP(name) \ + dev_caps->common_cap.name = cached_caps.name + /* restore cached values */ - dev_caps->common_cap.valid_functions = valid_func; - dev_caps->common_cap.txq_first_id = txq_first_id; - dev_caps->common_cap.rxq_first_id = rxq_first_id; - dev_caps->common_cap.msix_vector_first_id = msix_vector_first_id; - dev_caps->common_cap.max_mtu = max_mtu; + ICE_RESTORE_DEV_CAP(valid_functions); + ICE_RESTORE_DEV_CAP(txq_first_id); + ICE_RESTORE_DEV_CAP(rxq_first_id); + ICE_RESTORE_DEV_CAP(msix_vector_first_id); + ICE_RESTORE_DEV_CAP(max_mtu); + ICE_RESTORE_DEV_CAP(nvm_unified_update); dev_caps->num_funcs = num_funcs; /* one Tx and one Rx queue per function in safe mode */ @@ -2480,7 +2492,7 @@ ice_aq_manage_mac_write(struct ice_hw *hw, const u8 *mac_addr, u8 flags, ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_manage_mac_write); cmd->flags = flags; - ice_memcpy(cmd->mac_addr, mac_addr, ETH_ALEN, ICE_NONDMA_TO_DMA); + ice_memcpy(cmd->mac_addr, mac_addr, ETH_ALEN, ICE_NONDMA_TO_NONDMA); return ice_aq_send_cmd(hw, &desc, NULL, 0, cd); } @@ -2816,6 +2828,11 @@ enum ice_status ice_update_link_info(struct ice_port_info *pi) status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP, pcaps, NULL); + if (status == ICE_SUCCESS) + ice_memcpy(li->module_type, &pcaps->module_type, + sizeof(li->module_type), + ICE_NONDMA_TO_NONDMA); + ice_free(hw, pcaps); } @@ -3379,7 +3396,7 @@ ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr, ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_sff_eeprom); cmd = &desc.params.read_write_sff_param; - desc.flags = CPU_TO_LE16(ICE_AQ_FLAG_RD | ICE_AQ_FLAG_BUF); + desc.flags = CPU_TO_LE16(ICE_AQ_FLAG_RD); cmd->lport_num = (u8)(lport & 0xff); cmd->lport_num_valid = (u8)((lport >> 8) & 0x01); cmd->i2c_bus_addr = CPU_TO_LE16(((bus_addr >> 1) & @@ -3399,23 +3416,33 @@ ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr, /** * __ice_aq_get_set_rss_lut * @hw: pointer to the hardware structure - * @vsi_id: VSI FW index - * @lut_type: LUT table type - * @lut: pointer to the LUT buffer provided by the caller - * @lut_size: size of the LUT buffer - * @glob_lut_idx: global LUT index + * @params: RSS LUT parameters * @set: set true to set the table, false to get the table * * Internal function to get (0x0B05) or set (0x0B03) RSS look up table */ static enum ice_status -__ice_aq_get_set_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut, - u16 lut_size, u8 glob_lut_idx, bool set) +__ice_aq_get_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *params, bool set) { + u16 flags = 0, vsi_id, lut_type, lut_size, glob_lut_idx, vsi_handle; struct ice_aqc_get_set_rss_lut *cmd_resp; struct ice_aq_desc desc; enum ice_status status; - u16 flags = 0; + u8 *lut; + + if (!params) + return ICE_ERR_PARAM; + + vsi_handle = params->vsi_handle; + lut = params->lut; + + if (!ice_is_vsi_valid(hw, vsi_handle) || !lut) + return ICE_ERR_PARAM; + + lut_size = params->lut_size; + lut_type = params->lut_type; + glob_lut_idx = params->global_lut_id; + vsi_id = ice_get_hw_vsi_num(hw, vsi_handle); cmd_resp = &desc.params.get_set_rss_lut; @@ -3492,43 +3519,27 @@ ice_aq_get_set_rss_lut_exit: /** * ice_aq_get_rss_lut * @hw: pointer to the hardware structure - * @vsi_handle: software VSI handle - * @lut_type: LUT table type - * @lut: pointer to the LUT buffer provided by the caller - * @lut_size: size of the LUT buffer + * @get_params: RSS LUT parameters used to specify which RSS LUT to get * * get the RSS lookup table, PF or VSI type */ enum ice_status -ice_aq_get_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, - u8 *lut, u16 lut_size) +ice_aq_get_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *get_params) { - if (!ice_is_vsi_valid(hw, vsi_handle) || !lut) - return ICE_ERR_PARAM; - - return __ice_aq_get_set_rss_lut(hw, ice_get_hw_vsi_num(hw, vsi_handle), - lut_type, lut, lut_size, 0, false); + return __ice_aq_get_set_rss_lut(hw, get_params, false); } /** * ice_aq_set_rss_lut * @hw: pointer to the hardware structure - * @vsi_handle: software VSI handle - * @lut_type: LUT table type - * @lut: pointer to the LUT buffer provided by the caller - * @lut_size: size of the LUT buffer + * @set_params: RSS LUT parameters used to specify how to set the RSS LUT * * set the RSS lookup table, PF or VSI type */ enum ice_status -ice_aq_set_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, - u8 *lut, u16 lut_size) +ice_aq_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *set_params) { - if (!ice_is_vsi_valid(hw, vsi_handle) || !lut) - return ICE_ERR_PARAM; - - return __ice_aq_get_set_rss_lut(hw, ice_get_hw_vsi_num(hw, vsi_handle), - lut_type, lut, lut_size, 0, true); + return __ice_aq_get_set_rss_lut(hw, set_params, true); } /** diff --git a/sys/dev/ice/ice_common.h b/sys/dev/ice/ice_common.h index 84a39b7e9b8a..3a28816fb131 100644 --- a/sys/dev/ice/ice_common.h +++ b/sys/dev/ice/ice_common.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -117,11 +117,9 @@ ice_write_tx_drbell_q_ctx(struct ice_hw *hw, u32 tx_drbell_q_index); enum ice_status -ice_aq_get_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, u8 *lut, - u16 lut_size); +ice_aq_get_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *get_params); enum ice_status -ice_aq_set_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, u8 *lut, - u16 lut_size); +ice_aq_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *set_params); enum ice_status ice_aq_get_rss_key(struct ice_hw *hw, u16 vsi_handle, struct ice_aqc_get_set_rss_keys *keys); @@ -240,13 +238,6 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 q_handle, struct ice_sq_cd *cd); enum ice_status ice_replay_vsi(struct ice_hw *hw, u16 vsi_handle); void ice_replay_post(struct ice_hw *hw); -void ice_sched_replay_agg_vsi_preinit(struct ice_hw *hw); -void ice_sched_replay_agg(struct ice_hw *hw); -enum ice_status ice_sched_replay_tc_node_bw(struct ice_port_info *pi); -enum ice_status ice_replay_vsi_agg(struct ice_hw *hw, u16 vsi_handle); -enum ice_status ice_sched_replay_root_node_bw(struct ice_port_info *pi); -enum ice_status -ice_sched_replay_q_bw(struct ice_port_info *pi, struct ice_q_ctx *q_ctx); struct ice_q_ctx * ice_get_lan_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 q_handle); void @@ -277,7 +268,7 @@ enum ice_status ice_get_cur_lldp_persist_status(struct ice_hw *hw, u32 *lldp_status); enum ice_status ice_get_dflt_lldp_persist_status(struct ice_hw *hw, u32 *lldp_status); -enum ice_status ice_get_netlist_ver_info(struct ice_hw *hw); +enum ice_status ice_get_netlist_ver_info(struct ice_hw *hw, struct ice_netlist_info *netlist); enum ice_status ice_aq_set_lldp_mib(struct ice_hw *hw, u8 mib_type, void *buf, u16 buf_size, struct ice_sq_cd *cd); diff --git a/sys/dev/ice/ice_common_sysctls.h b/sys/dev/ice/ice_common_sysctls.h index 82ead3fcfecc..17c2fce72ee7 100644 --- a/sys/dev/ice/ice_common_sysctls.h +++ b/sys/dev/ice/ice_common_sysctls.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_common_txrx.h b/sys/dev/ice/ice_common_txrx.h index 8fb3d49288d8..d5e6182c2212 100644 --- a/sys/dev/ice/ice_common_txrx.h +++ b/sys/dev/ice/ice_common_txrx.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_controlq.c b/sys/dev/ice/ice_controlq.c index 3caab15e0e41..ee8d7f5c3e8f 100644 --- a/sys/dev/ice/ice_controlq.c +++ b/sys/dev/ice/ice_controlq.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_controlq.h b/sys/dev/ice/ice_controlq.h index 0da6b025fc8c..947f1d6d1767 100644 --- a/sys/dev/ice/ice_controlq.h +++ b/sys/dev/ice/ice_controlq.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -60,8 +60,8 @@ enum ice_ctl_q { ICE_CTL_Q_MAILBOX, }; -/* Control Queue timeout settings - max delay 250ms */ -#define ICE_CTL_Q_SQ_CMD_TIMEOUT 2500 /* Count 2500 times */ +/* Control Queue timeout settings - max delay 1s */ +#define ICE_CTL_Q_SQ_CMD_TIMEOUT 10000 /* Count 10000 times */ #define ICE_CTL_Q_SQ_CMD_USEC 100 /* Check every 100usec */ #define ICE_CTL_Q_ADMIN_INIT_TIMEOUT 10 /* Count 10 times */ #define ICE_CTL_Q_ADMIN_INIT_MSEC 100 /* Check every 100msec */ diff --git a/sys/dev/ice/ice_dcb.c b/sys/dev/ice/ice_dcb.c index b6275c5d07e8..abe0237eb88f 100644 --- a/sys/dev/ice/ice_dcb.c +++ b/sys/dev/ice/ice_dcb.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -994,22 +994,27 @@ ice_aq_set_dcb_parameters(struct ice_hw *hw, bool dcb_enable, /** * ice_cee_to_dcb_cfg * @cee_cfg: pointer to CEE configuration struct - * @dcbcfg: DCB configuration struct + * @pi: port information structure * * Convert CEE configuration from firmware to DCB configuration */ static void ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, - struct ice_dcbx_cfg *dcbcfg) + struct ice_port_info *pi) { u32 status, tlv_status = LE32_TO_CPU(cee_cfg->tlv_status); u32 ice_aqc_cee_status_mask, ice_aqc_cee_status_shift; + u8 i, j, err, sync, oper, app_index, ice_app_sel_type; u16 app_prio = LE16_TO_CPU(cee_cfg->oper_app_prio); - u8 i, err, sync, oper, app_index, ice_app_sel_type; u16 ice_aqc_cee_app_mask, ice_aqc_cee_app_shift; + struct ice_dcbx_cfg *cmp_dcbcfg, *dcbcfg; u16 ice_app_prot_id_type; - /* CEE PG data to ETS config */ + dcbcfg = &pi->qos_cfg.local_dcbx_cfg; + dcbcfg->dcbx_mode = ICE_DCBX_MODE_CEE; + dcbcfg->tlv_status = tlv_status; + + /* CEE PG data */ dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc; /* Note that the FW creates the oper_prio_tc nibbles reversed @@ -1036,10 +1041,16 @@ ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, } } - /* CEE PFC data to ETS config */ + /* CEE PFC data */ dcbcfg->pfc.pfcena = cee_cfg->oper_pfc_en; dcbcfg->pfc.pfccap = ICE_MAX_TRAFFIC_CLASS; + /* CEE APP TLV data */ + if (dcbcfg->app_mode == ICE_DCBX_APPS_NON_WILLING) + cmp_dcbcfg = &pi->qos_cfg.desired_dcbx_cfg; + else + cmp_dcbcfg = &pi->qos_cfg.remote_dcbx_cfg; + app_index = 0; for (i = 0; i < 3; i++) { if (i == 0) { @@ -1058,6 +1069,18 @@ ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, ice_aqc_cee_app_shift = ICE_AQC_CEE_APP_ISCSI_S; ice_app_sel_type = ICE_APP_SEL_TCPIP; ice_app_prot_id_type = ICE_APP_PROT_ID_ISCSI; + + for (j = 0; j < cmp_dcbcfg->numapps; j++) { + u16 prot_id = cmp_dcbcfg->app[j].prot_id; + u8 sel = cmp_dcbcfg->app[j].selector; + + if (sel == ICE_APP_SEL_TCPIP && + (prot_id == ICE_APP_PROT_ID_ISCSI || + prot_id == ICE_APP_PROT_ID_ISCSI_860)) { + ice_app_prot_id_type = prot_id; + break; + } + } } else { /* FIP APP */ ice_aqc_cee_status_mask = ICE_AQC_CEE_FIP_STATUS_M; @@ -1148,11 +1171,8 @@ enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi) ret = ice_aq_get_cee_dcb_cfg(pi->hw, &cee_cfg, NULL); if (ret == ICE_SUCCESS) { /* CEE mode */ - dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; - dcbx_cfg->dcbx_mode = ICE_DCBX_MODE_CEE; - dcbx_cfg->tlv_status = LE32_TO_CPU(cee_cfg.tlv_status); - ice_cee_to_dcb_cfg(&cee_cfg, dcbx_cfg); ret = ice_get_ieee_or_cee_dcb_cfg(pi, ICE_DCBX_MODE_CEE); + ice_cee_to_dcb_cfg(&cee_cfg, pi); } else if (pi->hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT) { /* CEE mode not enabled try querying IEEE data */ dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; diff --git a/sys/dev/ice/ice_dcb.h b/sys/dev/ice/ice_dcb.h index 88c49c89fbd2..85d6b399cf11 100644 --- a/sys/dev/ice/ice_dcb.h +++ b/sys/dev/ice/ice_dcb.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_devids.h b/sys/dev/ice/ice_devids.h index a110133823df..8611fc170816 100644 --- a/sys/dev/ice/ice_devids.h +++ b/sys/dev/ice/ice_devids.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_drv_info.h b/sys/dev/ice/ice_drv_info.h index 9ed3e3e2fb0e..340d53e4a671 100644 --- a/sys/dev/ice/ice_drv_info.h +++ b/sys/dev/ice/ice_drv_info.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,16 +63,16 @@ * @var ice_rc_version * @brief driver release candidate version number */ -const char ice_driver_version[] = "0.26.16-k"; +const char ice_driver_version[] = "0.28.1-k"; const uint8_t ice_major_version = 0; -const uint8_t ice_minor_version = 26; -const uint8_t ice_patch_version = 16; +const uint8_t ice_minor_version = 28; +const uint8_t ice_patch_version = 1; const uint8_t ice_rc_version = 0; #define PVIDV(vendor, devid, name) \ - PVID(vendor, devid, name " - 0.26.16-k") + PVID(vendor, devid, name " - 0.28.1-k") #define PVIDV_OEM(vendor, devid, svid, sdevid, revid, name) \ - PVID_OEM(vendor, devid, svid, sdevid, revid, name " - 0.26.16-k") + PVID_OEM(vendor, devid, svid, sdevid, revid, name " - 0.28.1-k") /** * @var ice_vendor_info_array @@ -113,20 +113,11 @@ static pci_vendor_info_t ice_vendor_info_array[] = { PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_QSFP, ICE_INTEL_VENDOR_ID, 0x0008, 0, "Intel(R) Ethernet Network Adapter E810-C-Q2 for OCP3.0"), + PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_QSFP, + ICE_INTEL_VENDOR_ID, 0x000D, 0, + "Intel(R) Ethernet Network Adapter E810-L-Q2 for OCP3.0"), PVIDV(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_QSFP, "Intel(R) Ethernet Controller E810-C for QSFP"), - PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_SFP, - ICE_INTEL_VENDOR_ID, 0x0001, 0, - "Intel(R) Ethernet Network Adapter E810-L-1"), - PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_SFP, - ICE_INTEL_VENDOR_ID, 0x0002, 0, - "Intel(R) Ethernet Network Adapter E810-L-2"), - PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_SFP, - ICE_INTEL_VENDOR_ID, 0x0003, 0, - "Intel(R) Ethernet Network Adapter E810-L-1"), - PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_SFP, - ICE_INTEL_VENDOR_ID, 0x0004, 0, - "Intel(R) Ethernet Network Adapter E810-L-2"), PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_SFP, ICE_INTEL_VENDOR_ID, 0x0005, 0, "Intel(R) Ethernet Network Adapter E810-XXV-4"), diff --git a/sys/dev/ice/ice_features.h b/sys/dev/ice/ice_features.h index f5ea542d8626..dcb096509f73 100644 --- a/sys/dev/ice/ice_features.h +++ b/sys/dev/ice/ice_features.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_flex_pipe.c b/sys/dev/ice/ice_flex_pipe.c index 6a02239eca5c..e8e4403a23fe 100644 --- a/sys/dev/ice/ice_flex_pipe.c +++ b/sys/dev/ice/ice_flex_pipe.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1057,6 +1057,13 @@ ice_dwnld_cfg_bufs(struct ice_hw *hw, struct ice_buf *bufs, u32 count) break; } + if (!status) { + status = ice_set_vlan_mode(hw); + if (status) + ice_debug(hw, ICE_DBG_PKG, "Failed to set VLAN mode: err %d\n", + status); + } + ice_release_global_cfg_lock(hw); return status; @@ -1126,34 +1133,40 @@ ice_download_pkg(struct ice_hw *hw, struct ice_seg *ice_seg) static enum ice_status ice_init_pkg_info(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr) { - struct ice_global_metadata_seg *meta_seg; struct ice_generic_seg_hdr *seg_hdr; ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__); if (!pkg_hdr) return ICE_ERR_PARAM; - meta_seg = (struct ice_global_metadata_seg *) - ice_find_seg_in_pkg(hw, SEGMENT_TYPE_METADATA, pkg_hdr); - if (meta_seg) { - hw->pkg_ver = meta_seg->pkg_ver; - ice_memcpy(hw->pkg_name, meta_seg->pkg_name, - sizeof(hw->pkg_name), ICE_NONDMA_TO_NONDMA); + seg_hdr = (struct ice_generic_seg_hdr *) + ice_find_seg_in_pkg(hw, SEGMENT_TYPE_ICE, pkg_hdr); + if (seg_hdr) { + struct ice_meta_sect *meta; + struct ice_pkg_enum state; + + ice_memset(&state, 0, sizeof(state), ICE_NONDMA_MEM); + + /* Get package information from the Metadata Section */ + meta = (struct ice_meta_sect *) + ice_pkg_enum_section((struct ice_seg *)seg_hdr, &state, + ICE_SID_METADATA); + if (!meta) { + ice_debug(hw, ICE_DBG_INIT, "Did not find ice metadata section in package\n"); + return ICE_ERR_CFG; + } + + hw->pkg_ver = meta->ver; + ice_memcpy(hw->pkg_name, meta->name, sizeof(meta->name), + ICE_NONDMA_TO_NONDMA); ice_debug(hw, ICE_DBG_PKG, "Pkg: %d.%d.%d.%d, %s\n", - meta_seg->pkg_ver.major, meta_seg->pkg_ver.minor, - meta_seg->pkg_ver.update, meta_seg->pkg_ver.draft, - meta_seg->pkg_name); - } else { - ice_debug(hw, ICE_DBG_INIT, "Did not find metadata segment in driver package\n"); - return ICE_ERR_CFG; - } + meta->ver.major, meta->ver.minor, meta->ver.update, + meta->ver.draft, meta->name); - seg_hdr = ice_find_seg_in_pkg(hw, SEGMENT_TYPE_ICE, pkg_hdr); - if (seg_hdr) { - hw->ice_pkg_ver = seg_hdr->seg_format_ver; - ice_memcpy(hw->ice_pkg_name, seg_hdr->seg_id, - sizeof(hw->ice_pkg_name), ICE_NONDMA_TO_NONDMA); + hw->ice_seg_fmt_ver = seg_hdr->seg_format_ver; + ice_memcpy(hw->ice_seg_id, seg_hdr->seg_id, + sizeof(hw->ice_seg_id), ICE_NONDMA_TO_NONDMA); *** 4744 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Mon Sep 20 23:22:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3FA376AF263; Mon, 20 Sep 2021 23:22: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 4HD0vv0vWFz3jrk; Mon, 20 Sep 2021 23:22: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 EA31C19789; Mon, 20 Sep 2021 23:22: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 18KNMYXA061478; Mon, 20 Sep 2021 23:22:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KNMYco061477; Mon, 20 Sep 2021 23:22:34 GMT (envelope-from git) Date: Mon, 20 Sep 2021 23:22:34 GMT Message-Id: <202109202322.18KNMYco061477@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: a89887d57b96 - stable/12 - ixl(4): Add tunable to override Flow Control settings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a89887d57b965e7749e05488f8e8dae7911b3fc3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 23:22:35 -0000 The branch stable/12 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=a89887d57b965e7749e05488f8e8dae7911b3fc3 commit a89887d57b965e7749e05488f8e8dae7911b3fc3 Author: Krzysztof Galazka AuthorDate: 2021-04-05 18:08:33 +0000 Commit: Eric Joyner CommitDate: 2021-09-20 22:11:14 +0000 ixl(4): Add tunable to override Flow Control settings Add flow_control to hw.ixl tunables tree to let override initial flow control configuration for all interfaces. Keep using configuration set by NVM by default. Reviewed by: erj@, gallatin@ Tested by: gowtham.kumar.ks_intel.com Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D29338 (cherry picked from commit 20a52706c814ccfd91c65586404abd2a1563a330) --- sys/dev/ixl/if_ixl.c | 19 +++++++++++++++++++ sys/dev/ixl/ixl_pf_iflib.c | 2 +- sys/dev/ixl/ixl_pf_main.c | 40 +++++++++++++++++++++++----------------- 3 files changed, 43 insertions(+), 18 deletions(-) diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index 09107dbaf2a5..0da7679ee6b3 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -305,6 +305,10 @@ TUNABLE_INT("hw.ixl.tx_itr", &ixl_tx_itr); SYSCTL_INT(_hw_ixl, OID_AUTO, tx_itr, CTLFLAG_RDTUN, &ixl_tx_itr, 0, "TX Interrupt Rate"); +static int ixl_flow_control = -1; +SYSCTL_INT(_hw_ixl, OID_AUTO, flow_control, CTLFLAG_RDTUN, + &ixl_flow_control, 0, "Initial Flow Control setting"); + #ifdef IXL_IW int ixl_enable_iwarp = 0; TUNABLE_INT("hw.ixl.enable_iwarp", &ixl_enable_iwarp); @@ -1881,5 +1885,20 @@ ixl_save_pf_tunables(struct ixl_pf *pf) pf->rx_itr = IXL_ITR_8K; } else pf->rx_itr = ixl_rx_itr; + + pf->fc = -1; + if (ixl_flow_control != -1) { + if (ixl_flow_control < 0 || ixl_flow_control > 3) { + device_printf(dev, + "Invalid flow_control value of %d set!\n", + ixl_flow_control); + device_printf(dev, + "flow_control must be between %d and %d, " + "inclusive\n", 0, 3); + device_printf(dev, + "Using default configuration instead\n"); + } else + pf->fc = ixl_flow_control; + } } diff --git a/sys/dev/ixl/ixl_pf_iflib.c b/sys/dev/ixl/ixl_pf_iflib.c index 6d80bb472b72..bf3527bce4ba 100644 --- a/sys/dev/ixl/ixl_pf_iflib.c +++ b/sys/dev/ixl/ixl_pf_iflib.c @@ -1129,7 +1129,7 @@ ixl_sysctl_set_flowcntl(SYSCTL_HANDLER_ARGS) aq_error = i40e_set_fc(hw, &fc_aq_err, TRUE); if (aq_error) { device_printf(dev, - "%s: Error setting new fc mode %d; fc_err %#x\n", + "%s: Error setting Flow Control mode %d; fc_err %#x\n", __func__, aq_error, fc_aq_err); return (EIO); } diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index 782d51ac696d..00ab9a84ce97 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -2946,27 +2946,28 @@ ixl_set_link(struct ixl_pf *pf, bool enable) config.phy_type = 0; config.phy_type_ext = 0; + config.abilities &= ~(I40E_AQ_PHY_FLAG_PAUSE_TX | + I40E_AQ_PHY_FLAG_PAUSE_RX); + + switch (pf->fc) { + case I40E_FC_FULL: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX | + I40E_AQ_PHY_FLAG_PAUSE_RX; + break; + case I40E_FC_RX_PAUSE: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_RX; + break; + case I40E_FC_TX_PAUSE: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX; + break; + default: + break; + } + if (enable) { config.phy_type = phy_type; config.phy_type_ext = phy_type_ext; - config.abilities &= ~(I40E_AQ_PHY_FLAG_PAUSE_TX | - I40E_AQ_PHY_FLAG_PAUSE_RX); - - switch (pf->fc) { - case I40E_FC_FULL: - config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX | - I40E_AQ_PHY_FLAG_PAUSE_RX; - break; - case I40E_FC_RX_PAUSE: - config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_RX; - break; - case I40E_FC_TX_PAUSE: - config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX; - break; - default: - break; - } } aq_error = i40e_aq_set_phy_config(hw, &config, NULL); @@ -4374,6 +4375,11 @@ ixl_attach_get_link_status(struct ixl_pf *pf) /* Determine link state */ hw->phy.get_link_info = TRUE; i40e_get_link_status(hw, &pf->link_up); + + /* Flow Control mode not set by user, read current FW settings */ + if (pf->fc == -1) + pf->fc = hw->fc.current_mode; + return (0); } From owner-dev-commits-src-all@freebsd.org Mon Sep 20 23:22:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65C396AF55C; Mon, 20 Sep 2021 23:22: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 4HD0vw27Fcz3jrr; Mon, 20 Sep 2021 23:22: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 1BA101970E; Mon, 20 Sep 2021 23:22: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 18KNMaoB061502; Mon, 20 Sep 2021 23:22:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KNMZg7061501; Mon, 20 Sep 2021 23:22:35 GMT (envelope-from git) Date: Mon, 20 Sep 2021 23:22:35 GMT Message-Id: <202109202322.18KNMZg7061501@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 6310681f67ef - stable/12 - ixl(4): Fix reporting of unqualified transceivers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6310681f67ef80908d6401fb150648073834360d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 23:22:36 -0000 The branch stable/12 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=6310681f67ef80908d6401fb150648073834360d commit 6310681f67ef80908d6401fb150648073834360d Author: Krzysztof Galazka AuthorDate: 2021-08-20 21:12:28 +0000 Commit: Eric Joyner CommitDate: 2021-09-20 22:12:05 +0000 ixl(4): Fix reporting of unqualified transceivers When link_active_on_if_down flag is disabled and link is brought down with ifconfig, FW reports a false positive link event about an unqualified transceiver. The condition used in the driver to filter out those false positive events was incorrect and caused that unqualified module event to also not be reported when the event was valid. Change the condition to rely on IFF_UP flag instead of link_active_on_if_down and bump driver version to 2.3.1-k. Signed-off-by: Krzysztof Galazka Signed-off-by: Eric Joyner Reviewed by: stallamr@netapp.com, erj@ Tested by: gowtham.kumar.ks@intel.com Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D30733 (cherry picked from commit c4622b01d2f12b889b57ff7d0b03a38dfcb00fd8) --- sys/dev/ixl/if_ixl.c | 2 +- sys/dev/ixl/ixl_pf_iflib.c | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index 0da7679ee6b3..1c6ad5315047 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -49,7 +49,7 @@ *********************************************************************/ #define IXL_DRIVER_VERSION_MAJOR 2 #define IXL_DRIVER_VERSION_MINOR 3 -#define IXL_DRIVER_VERSION_BUILD 0 +#define IXL_DRIVER_VERSION_BUILD 1 #define IXL_DRIVER_VERSION_STRING \ __XSTRING(IXL_DRIVER_VERSION_MAJOR) "." \ diff --git a/sys/dev/ixl/ixl_pf_iflib.c b/sys/dev/ixl/ixl_pf_iflib.c index bf3527bce4ba..abf3a633e6cc 100644 --- a/sys/dev/ixl/ixl_pf_iflib.c +++ b/sys/dev/ixl/ixl_pf_iflib.c @@ -403,20 +403,23 @@ ixl_link_event(struct ixl_pf *pf, struct i40e_arq_event_info *e) { struct i40e_hw *hw = &pf->hw; device_t dev = iflib_get_dev(pf->vsi.ctx); - struct i40e_aqc_get_link_status *status = - (struct i40e_aqc_get_link_status *)&e->desc.params.raw; - - /* Request link status from adapter */ + struct i40e_link_status *link_info = &hw->phy.link_info; + + /* Driver needs to re-enable delivering of link status events + * by FW after each event reception. Call i40e_get_link_status + * to do that. To not lose information about link state changes, + * which happened between receiving an event and the call, + * do not rely on status from event but use most recent + * status information retrieved by the call. */ hw->phy.get_link_info = TRUE; i40e_get_link_status(hw, &pf->link_up); /* Print out message if an unqualified module is found */ - if ((status->link_info & I40E_AQ_MEDIA_AVAILABLE) && + if ((link_info->link_info & I40E_AQ_MEDIA_AVAILABLE) && (pf->advertised_speed) && - (atomic_load_32(&pf->state) & - IXL_PF_STATE_LINK_ACTIVE_ON_DOWN) != 0 && - (!(status->an_info & I40E_AQ_QUALIFIED_MODULE)) && - (!(status->link_info & I40E_AQ_LINK_UP))) + (if_getflags(pf->vsi.ifp) & IFF_UP) && + (!(link_info->an_info & I40E_AQ_QUALIFIED_MODULE)) && + (!(link_info->link_info & I40E_AQ_LINK_UP))) device_printf(dev, "Link failed because " "an unqualified module was detected!\n"); From owner-dev-commits-src-all@freebsd.org Mon Sep 20 23:22:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B17386AF719; Mon, 20 Sep 2021 23:22: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 4HD0vx2yvwz3jrw; Mon, 20 Sep 2021 23:22: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 36C66192E7; Mon, 20 Sep 2021 23:22: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 18KNMbTW061526; Mon, 20 Sep 2021 23:22:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KNMbNY061525; Mon, 20 Sep 2021 23:22:37 GMT (envelope-from git) Date: Mon, 20 Sep 2021 23:22:37 GMT Message-Id: <202109202322.18KNMbNY061525@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: bc2fa5ace223 - stable/12 - ixl(4): Fix 2.5 and 5G speeds reporting and update shared code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: bc2fa5ace223691874c5246b2f00b4e60922b463 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 23:22:37 -0000 The branch stable/12 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=bc2fa5ace223691874c5246b2f00b4e60922b463 commit bc2fa5ace223691874c5246b2f00b4e60922b463 Author: Krzysztof Galazka AuthorDate: 2021-09-13 20:39:59 +0000 Commit: Eric Joyner CommitDate: 2021-09-20 22:12:32 +0000 ixl(4): Fix 2.5 and 5G speeds reporting and update shared code Fix 2.5 and 5G speeds reporting and update shared code with recent changes: - Update expected FW API versions for X710 and X722 adapters - Define pointers related to Preservation Rules Module - Add definitions for Shadow RAM pointers to new modules: 5th and 6th FPA, and Preservation Rules Module. - Add I40E_RX_PTYPE_PARSER_ABORTED definition, so the driver will know opcode for parser aborted packets. - Add the new filter types needed for custom cloud filters. - Add support for Minimum Rollback Revision - Fix RX_ONLY mode for unicast promiscuous on VLAN - Add EEE LPI status check for X722 adapters - Fix PHY type identifiers for 2.5G and 5G adapters - Fix update link data for X722 - Increase the timeout value for PF reset to give PF more time to finish reset if it is loaded with filters. - Added support for Min Rollback Revision for 4 more X722 modules - Fix reporting of Active Optical Cable media type - Add flags and fields for double VLAN processing - Fix potentially uninitialized variables in NVM code Reviewed by: kbowling@, mike.jakubik@gmail.com Tested by: gowtham.kumar.ks@intel.com Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D31565 (cherry picked from commit abf774528d7e497460510b0026db85e30f054142) --- sys/dev/ixl/i40e_adminq.c | 6 +- sys/dev/ixl/i40e_adminq_cmd.h | 71 +++++++++++++-- sys/dev/ixl/i40e_common.c | 206 ++++++++++++++++++++++++++---------------- sys/dev/ixl/i40e_dcb.c | 10 +- sys/dev/ixl/i40e_lan_hmc.c | 2 +- sys/dev/ixl/i40e_nvm.c | 13 ++- sys/dev/ixl/i40e_prototype.h | 10 +- sys/dev/ixl/i40e_register.h | 3 + sys/dev/ixl/i40e_type.h | 17 ++-- sys/dev/ixl/if_ixl.c | 4 +- 10 files changed, 234 insertions(+), 108 deletions(-) diff --git a/sys/dev/ixl/i40e_adminq.c b/sys/dev/ixl/i40e_adminq.c index d25798d23bd1..efca7f1e61ff 100644 --- a/sys/dev/ixl/i40e_adminq.c +++ b/sys/dev/ixl/i40e_adminq.c @@ -646,8 +646,10 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw) { struct i40e_adminq_info *aq = &hw->aq; enum i40e_status_code ret_code; - u16 cfg_ptr, oem_hi, oem_lo; - u16 eetrack_lo, eetrack_hi; + u16 oem_hi = 0, oem_lo = 0; + u16 eetrack_hi = 0; + u16 eetrack_lo = 0; + u16 cfg_ptr = 0; int retry = 0; /* verify input for valid configuration */ diff --git a/sys/dev/ixl/i40e_adminq_cmd.h b/sys/dev/ixl/i40e_adminq_cmd.h index 6161805a7cf0..564a076761d0 100644 --- a/sys/dev/ixl/i40e_adminq_cmd.h +++ b/sys/dev/ixl/i40e_adminq_cmd.h @@ -43,8 +43,8 @@ #define I40E_FW_API_VERSION_MAJOR 0x0001 -#define I40E_FW_API_VERSION_MINOR_X722 0x000A -#define I40E_FW_API_VERSION_MINOR_X710 0x000A +#define I40E_FW_API_VERSION_MINOR_X722 0x000C +#define I40E_FW_API_VERSION_MINOR_X710 0x000E #define I40E_FW_MINOR_VERSION(_h) ((_h)->mac.type == I40E_MAC_XL710 ? \ I40E_FW_API_VERSION_MINOR_X710 : \ @@ -267,7 +267,8 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_nvm_update = 0x0703, i40e_aqc_opc_nvm_config_read = 0x0704, i40e_aqc_opc_nvm_config_write = 0x0705, - i40e_aqc_opc_nvm_progress = 0x0706, + i40e_aqc_opc_nvm_update_in_process = 0x0706, + i40e_aqc_opc_rollback_revision_update = 0x0707, i40e_aqc_opc_oem_post_update = 0x0720, i40e_aqc_opc_thermal_sensor = 0x0721, @@ -467,6 +468,7 @@ struct i40e_aqc_list_capabilities_element_resp { #define I40E_AQ_CAP_ID_SDP 0x0062 #define I40E_AQ_CAP_ID_MDIO 0x0063 #define I40E_AQ_CAP_ID_WSR_PROT 0x0064 +#define I40E_AQ_CAP_ID_DIS_UNUSED_PORTS 0x0067 #define I40E_AQ_CAP_ID_NVM_MGMT 0x0080 #define I40E_AQ_CAP_ID_FLEX10 0x00F1 #define I40E_AQ_CAP_ID_CEM 0x00F2 @@ -793,6 +795,7 @@ struct i40e_aqc_set_switch_config { #define I40E_AQ_SET_SWITCH_CFG_PROMISC 0x0001 #define I40E_AQ_SET_SWITCH_CFG_L2_FILTER 0x0002 #define I40E_AQ_SET_SWITCH_CFG_HW_ATR_EVICT 0x0004 +#define I40E_AQ_SET_SWITCH_CFG_OUTER_VLAN 0x0008 __le16 valid_flags; /* The ethertype in switch_tag is dropped on ingress and used * internally by the switch. Set this to zero for the default @@ -929,7 +932,7 @@ struct i40e_aqc_vsi_properties_data { u8 sec_reserved; /* VLAN section */ __le16 pvid; /* VLANS include priority bits */ - __le16 fcoe_pvid; + __le16 outer_vlan; u8 port_vlan_flags; #define I40E_AQ_VSI_PVLAN_MODE_SHIFT 0x00 #define I40E_AQ_VSI_PVLAN_MODE_MASK (0x03 << \ @@ -945,7 +948,24 @@ struct i40e_aqc_vsi_properties_data { #define I40E_AQ_VSI_PVLAN_EMOD_STR_UP 0x08 #define I40E_AQ_VSI_PVLAN_EMOD_STR 0x10 #define I40E_AQ_VSI_PVLAN_EMOD_NOTHING 0x18 - u8 pvlan_reserved[3]; + u8 outer_vlan_flags; +#define I40E_AQ_VSI_OVLAN_MODE_SHIFT 0x00 +#define I40E_AQ_VSI_OVLAN_MODE_MASK (0x03 << \ + I40E_AQ_VSI_OVLAN_MODE_SHIFT) +#define I40E_AQ_VSI_OVLAN_MODE_UNTAGGED 0x01 +#define I40E_AQ_VSI_OVLAN_MODE_TAGGED 0x02 +#define I40E_AQ_VSI_OVLAN_MODE_ALL 0x03 +#define I40E_AQ_VSI_OVLAN_INSERT_PVID 0x04 +#define I40E_AQ_VSI_OVLAN_EMOD_SHIFT 0x03 +#define I40E_AQ_VSI_OVLAN_EMOD_MASK (0x03 <<\ + I40E_AQ_VSI_OVLAN_EMOD_SHIFT) +#define I40E_AQ_VSI_OVLAN_EMOD_SHOW_ALL 0x00 +#define I40E_AQ_VSI_OVLAN_EMOD_SHOW_UP 0x01 +#define I40E_AQ_VSI_OVLAN_EMOD_HIDE_ALL 0x02 +#define I40E_AQ_VSI_OVLAN_EMOD_NOTHING 0x03 +#define I40E_AQ_VSI_OVLAN_CTRL_ENA 0x04 + + u8 pvlan_reserved[2]; /* ingress egress up sections */ __le32 ingress_table; /* bitmap, 3 bits per up */ #define I40E_AQ_VSI_UP_TABLE_UP0_SHIFT 0 @@ -1247,7 +1267,7 @@ struct i40e_aqc_set_vsi_promiscuous_modes { #define I40E_AQC_SET_VSI_PROMISC_BROADCAST 0x04 #define I40E_AQC_SET_VSI_DEFAULT 0x08 #define I40E_AQC_SET_VSI_PROMISC_VLAN 0x10 -#define I40E_AQC_SET_VSI_PROMISC_TX 0x8000 +#define I40E_AQC_SET_VSI_PROMISC_RX_ONLY 0x8000 __le16 seid; #define I40E_AQC_VSI_PROM_CMD_SEID_MASK 0x3FF __le16 vlan_tag; @@ -1433,6 +1453,8 @@ struct i40e_aqc_cloud_filters_element_data { #define I40E_AQC_ADD_CLOUD_FILTER_IMAC 0x000A #define I40E_AQC_ADD_CLOUD_FILTER_OMAC_TEN_ID_IMAC 0x000B #define I40E_AQC_ADD_CLOUD_FILTER_IIP 0x000C +#define I40E_AQC_ADD_CLOUD_FILTER_OIP1 0x0010 +#define I40E_AQC_ADD_CLOUD_FILTER_OIP2 0x0012 /* 0x000D reserved */ /* 0x000E reserved */ /* 0x000F reserved */ @@ -1940,8 +1962,10 @@ enum i40e_aq_phy_type { I40E_PHY_TYPE_25GBASE_LR = 0x22, I40E_PHY_TYPE_25GBASE_AOC = 0x23, I40E_PHY_TYPE_25GBASE_ACC = 0x24, - I40E_PHY_TYPE_2_5GBASE_T = 0x30, - I40E_PHY_TYPE_5GBASE_T = 0x31, + I40E_PHY_TYPE_2_5GBASE_T = 0x26, + I40E_PHY_TYPE_5GBASE_T = 0x27, + I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS = 0x30, + I40E_PHY_TYPE_5GBASE_T_LINK_STATUS = 0x31, I40E_PHY_TYPE_MAX, I40E_PHY_TYPE_NOT_SUPPORTED_HIGH_TEMP = 0xFD, I40E_PHY_TYPE_EMPTY = 0xFE, @@ -2411,6 +2435,16 @@ struct i40e_aqc_nvm_config_data_feature { I40E_CHECK_STRUCT_LEN(0x6, i40e_aqc_nvm_config_data_feature); +/* NVM Update in Process (direct 0x0706) */ +struct i40e_aqc_nvm_update_in_process { + u8 command; +#define I40E_AQ_UPDATE_FLOW_END 0x0 +#define I40E_AQ_UPDATE_FLOW_START 0x1 + u8 reserved[15]; +}; + +I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_update_in_process); + struct i40e_aqc_nvm_config_data_immediate_field { __le32 field_id; __le32 field_value; @@ -2420,6 +2454,27 @@ struct i40e_aqc_nvm_config_data_immediate_field { I40E_CHECK_STRUCT_LEN(0xc, i40e_aqc_nvm_config_data_immediate_field); +/* Minimal Rollback Revision Update (direct 0x0707) */ +struct i40e_aqc_rollback_revision_update { + u8 optin_mode; /* bool */ +#define I40E_AQ_RREV_OPTIN_MODE 0x01 + u8 module_selected; +#define I40E_AQ_RREV_MODULE_PCIE_ANALOG 0 +#define I40E_AQ_RREV_MODULE_PHY_ANALOG 1 +#define I40E_AQ_RREV_MODULE_OPTION_ROM 2 +#define I40E_AQ_RREV_MODULE_EMP_IMAGE 3 +#define I40E_AQ_RREV_MODULE_PE_IMAGE 4 +#define I40E_AQ_RREV_MODULE_PHY_PLL_O_CONFIGURATION 5 +#define I40E_AQ_RREV_MODULE_PHY_0_CONFIGURATION 6 +#define I40E_AQ_RREV_MODULE_PHY_PLL_1_CONFIGURATION 7 +#define I40E_AQ_RREV_MODULE_PHY_1_CONFIGURATION 8 + u8 reserved1[2]; + u32 min_rrev; + u8 reserved2[8]; +}; + +I40E_CHECK_CMD_LENGTH(i40e_aqc_rollback_revision_update); + /* OEM Post Update (indirect 0x0720) * no command data struct used */ diff --git a/sys/dev/ixl/i40e_common.c b/sys/dev/ixl/i40e_common.c index 4325901c0920..332893938c19 100644 --- a/sys/dev/ixl/i40e_common.c +++ b/sys/dev/ixl/i40e_common.c @@ -1251,12 +1251,15 @@ static enum i40e_media_type i40e_get_media_type(struct i40e_hw *hw) case I40E_PHY_TYPE_40GBASE_LR4: case I40E_PHY_TYPE_25GBASE_LR: case I40E_PHY_TYPE_25GBASE_SR: + case I40E_PHY_TYPE_10GBASE_AOC: + case I40E_PHY_TYPE_25GBASE_AOC: + case I40E_PHY_TYPE_40GBASE_AOC: media = I40E_MEDIA_TYPE_FIBER; break; case I40E_PHY_TYPE_100BASE_TX: case I40E_PHY_TYPE_1000BASE_T: - case I40E_PHY_TYPE_2_5GBASE_T: - case I40E_PHY_TYPE_5GBASE_T: + case I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS: + case I40E_PHY_TYPE_5GBASE_T_LINK_STATUS: case I40E_PHY_TYPE_10GBASE_T: media = I40E_MEDIA_TYPE_BASET; break; @@ -1265,10 +1268,7 @@ static enum i40e_media_type i40e_get_media_type(struct i40e_hw *hw) case I40E_PHY_TYPE_10GBASE_CR1: case I40E_PHY_TYPE_40GBASE_CR4: case I40E_PHY_TYPE_10GBASE_SFPP_CU: - case I40E_PHY_TYPE_40GBASE_AOC: - case I40E_PHY_TYPE_10GBASE_AOC: case I40E_PHY_TYPE_25GBASE_CR: - case I40E_PHY_TYPE_25GBASE_AOC: case I40E_PHY_TYPE_25GBASE_ACC: media = I40E_MEDIA_TYPE_DA; break; @@ -1316,7 +1316,7 @@ static enum i40e_status_code i40e_poll_globr(struct i40e_hw *hw, return I40E_ERR_RESET_FAILED; } -#define I40E_PF_RESET_WAIT_COUNT 200 +#define I40E_PF_RESET_WAIT_COUNT 1000 /** * i40e_pf_reset - Reset the PF * @hw: pointer to the hardware structure @@ -1563,7 +1563,6 @@ static u32 i40e_led_is_mine(struct i40e_hw *hw, int idx) **/ u32 i40e_led_get(struct i40e_hw *hw) { - u32 current_mode = 0; u32 mode = 0; int i; @@ -1576,20 +1575,6 @@ u32 i40e_led_get(struct i40e_hw *hw) if (!gpio_val) continue; - /* ignore gpio LED src mode entries related to the activity - * LEDs - */ - current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) - >> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT); - switch (current_mode) { - case I40E_COMBINED_ACTIVITY: - case I40E_FILTER_ACTIVITY: - case I40E_MAC_ACTIVITY: - case I40E_LINK_ACTIVITY: - continue; - default: - break; - } mode = (gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) >> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT; @@ -1610,7 +1595,6 @@ u32 i40e_led_get(struct i40e_hw *hw) **/ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink) { - u32 current_mode = 0; int i; if (mode & ~I40E_LED_MODE_VALID) { @@ -1627,20 +1611,6 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink) if (!gpio_val) continue; - /* ignore gpio LED src mode entries related to the activity - * LEDs - */ - current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) - >> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT); - switch (current_mode) { - case I40E_COMBINED_ACTIVITY: - case I40E_FILTER_ACTIVITY: - case I40E_MAC_ACTIVITY: - case I40E_LINK_ACTIVITY: - continue; - default: - break; - } if (I40E_IS_X710TL_DEVICE(hw->device_id)) { u32 pin_func = 0; @@ -2053,6 +2023,9 @@ enum i40e_status_code i40e_aq_get_link_info(struct i40e_hw *hw, hw->aq.fw_min_ver < 40)) && hw_link_info->phy_type == 0xE) hw_link_info->phy_type = I40E_PHY_TYPE_10GBASE_SFPP_CU; + /* 'Get Link Status' response data structure from X722 FW has + * different format and does not contain this information + */ if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE && hw->mac.type != I40E_MAC_X722) { __le32 tmp; @@ -2251,6 +2224,22 @@ enum i40e_status_code i40e_aq_set_phy_debug(struct i40e_hw *hw, u8 cmd_flags, return status; } +/** + * i40e_hw_ver_ge + * @hw: pointer to the hw struct + * @maj: api major value + * @min: api minor value + * + * Assert whether current HW api version is greater/equal than provided. + **/ +static bool i40e_hw_ver_ge(struct i40e_hw *hw, u16 maj, u16 min) +{ + if (hw->aq.api_maj_ver > maj || + (hw->aq.api_maj_ver == maj && hw->aq.api_min_ver >= min)) + return TRUE; + return FALSE; +} + /** * i40e_aq_add_vsi * @hw: pointer to the hw struct @@ -2376,18 +2365,16 @@ enum i40e_status_code i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw, if (set) { flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST; - if (rx_only_promisc && - (((hw->aq.api_maj_ver == 1) && (hw->aq.api_min_ver >= 5)) || - (hw->aq.api_maj_ver > 1))) - flags |= I40E_AQC_SET_VSI_PROMISC_TX; + if (rx_only_promisc && i40e_hw_ver_ge(hw, 1, 5)) + flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY; } cmd->promiscuous_flags = CPU_TO_LE16(flags); cmd->valid_flags = CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_UNICAST); - if (((hw->aq.api_maj_ver >= 1) && (hw->aq.api_min_ver >= 5)) || - (hw->aq.api_maj_ver > 1)) - cmd->valid_flags |= CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_TX); + if (i40e_hw_ver_ge(hw, 1, 5)) + cmd->valid_flags |= + CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY); cmd->seid = CPU_TO_LE16(seid); status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); @@ -2519,11 +2506,17 @@ enum i40e_status_code i40e_aq_set_vsi_uc_promisc_on_vlan(struct i40e_hw *hw, i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_set_vsi_promiscuous_modes); - if (enable) + if (enable) { flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST; + if (i40e_hw_ver_ge(hw, 1, 5)) + flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY; + } cmd->promiscuous_flags = CPU_TO_LE16(flags); cmd->valid_flags = CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_UNICAST); + if (i40e_hw_ver_ge(hw, 1, 5)) + cmd->valid_flags |= + CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY); cmd->seid = CPU_TO_LE16(seid); cmd->vlan_tag = CPU_TO_LE16(vid | I40E_AQC_SET_VSI_VLAN_VALID); @@ -2633,7 +2626,7 @@ enum i40e_status_code i40e_aq_set_vsi_vlan_promisc(struct i40e_hw *hw, } /** - * i40e_get_vsi_params - get VSI configuration info + * i40e_aq_get_vsi_params - get VSI configuration info * @hw: pointer to the hw struct * @vsi_ctx: pointer to a vsi context struct * @cmd_details: pointer to command details structure or NULL @@ -2893,7 +2886,7 @@ enum i40e_status_code i40e_get_link_status(struct i40e_hw *hw, bool *link_up) } /** - * i40e_updatelink_status - update status of the HW network link + * i40e_update_link_info - update status of the HW network link * @hw: pointer to the hw struct **/ enum i40e_status_code i40e_update_link_info(struct i40e_hw *hw) @@ -2906,10 +2899,13 @@ enum i40e_status_code i40e_update_link_info(struct i40e_hw *hw) return status; /* extra checking needed to ensure link info to user is timely */ - if ((hw->phy.link_info.link_info & I40E_AQ_MEDIA_AVAILABLE) && - ((hw->phy.link_info.link_info & I40E_AQ_LINK_UP) || - !(hw->phy.link_info_old.link_info & I40E_AQ_LINK_UP))) { - status = i40e_aq_get_phy_capabilities(hw, FALSE, false, + if (((hw->phy.link_info.link_info & I40E_AQ_MEDIA_AVAILABLE) && + ((hw->phy.link_info.link_info & I40E_AQ_LINK_UP) || + !(hw->phy.link_info_old.link_info & I40E_AQ_LINK_UP))) || + hw->mac.type == I40E_MAC_X722) { + status = i40e_aq_get_phy_capabilities(hw, FALSE, + hw->mac.type == + I40E_MAC_X722, &abilities, NULL); if (status) return status; @@ -3666,6 +3662,64 @@ enum i40e_status_code i40e_aq_write_nvm_config(struct i40e_hw *hw, return status; } +/** + * i40e_aq_nvm_update_in_process + * @hw: pointer to the hw struct + * @update_flow_state: True indicates that update flow starts, FALSE that ends + * @cmd_details: pointer to command details structure or NULL + * + * Indicate NVM update in process. + **/ +enum i40e_status_code i40e_aq_nvm_update_in_process(struct i40e_hw *hw, + bool update_flow_state, + struct i40e_asq_cmd_details *cmd_details) +{ + struct i40e_aq_desc desc; + struct i40e_aqc_nvm_update_in_process *cmd = + (struct i40e_aqc_nvm_update_in_process *)&desc.params.raw; + enum i40e_status_code status; + + i40e_fill_default_direct_cmd_desc(&desc, + i40e_aqc_opc_nvm_update_in_process); + + cmd->command = I40E_AQ_UPDATE_FLOW_END; + + if (update_flow_state) + cmd->command |= I40E_AQ_UPDATE_FLOW_START; + + status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); + + return status; +} + +/** + * i40e_aq_min_rollback_rev_update - triggers an ow after update + * @hw: pointer to the hw struct + * @mode: opt-in mode, 1b for single module update, 0b for bulk update + * @module: module to be updated. Ignored if mode is 0b + * @min_rrev: value of the new minimal version. Ignored if mode is 0b + * @cmd_details: pointer to command details structure or NULL + **/ +enum i40e_status_code +i40e_aq_min_rollback_rev_update(struct i40e_hw *hw, u8 mode, u8 module, + u32 min_rrev, + struct i40e_asq_cmd_details *cmd_details) +{ + struct i40e_aq_desc desc; + struct i40e_aqc_rollback_revision_update *cmd = + (struct i40e_aqc_rollback_revision_update *)&desc.params.raw; + enum i40e_status_code status; + + i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_rollback_revision_update); + cmd->optin_mode = mode; + cmd->module_selected = module; + cmd->min_rrev = min_rrev; + + status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); + + return status; +} + /** * i40e_aq_oem_post_update - triggers an OEM specific flow after update * @hw: pointer to the hw struct @@ -3998,7 +4052,13 @@ static void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff, p->wr_csr_prot |= (u64)logical_id << 32; i40e_debug(hw, I40E_DEBUG_INIT, "HW Capability: wr_csr_prot = 0x%llX\n\n", - (p->wr_csr_prot & 0xffff)); + (unsigned long long)(p->wr_csr_prot & 0xffff)); + break; + case I40E_AQ_CAP_ID_DIS_UNUSED_PORTS: + p->dis_unused_ports = (bool)number; + i40e_debug(hw, I40E_DEBUG_INIT, + "HW Capability: dis_unused_ports = %d\n\n", + p->dis_unused_ports); break; case I40E_AQ_CAP_ID_NVM_MGMT: if (number & I40E_NVM_MGMT_SEC_REV_DISABLED) @@ -4193,28 +4253,6 @@ i40e_aq_update_nvm_exit: return status; } -/** - * i40e_aq_nvm_progress - * @hw: pointer to the hw struct - * @progress: pointer to progress returned from AQ - * @cmd_details: pointer to command details structure or NULL - * - * Gets progress of flash rearrangement process - **/ -enum i40e_status_code i40e_aq_nvm_progress(struct i40e_hw *hw, u8 *progress, - struct i40e_asq_cmd_details *cmd_details) -{ - enum i40e_status_code status; - struct i40e_aq_desc desc; - - DEBUGFUNC("i40e_aq_nvm_progress"); - - i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_nvm_progress); - status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); - *progress = desc.params.raw[0]; - return status; -} - /** * i40e_aq_get_lldp_mib * @hw: pointer to the hw struct @@ -4593,7 +4631,7 @@ enum i40e_status_code i40e_aq_del_udp_tunnel(struct i40e_hw *hw, u8 index, } /** - * i40e_aq_get_switch_resource_alloc (0x0204) + * i40e_aq_get_switch_resource_alloc - command (0x0204) to get allocations * @hw: pointer to the hw struct * @num_entries: pointer to u8 to store the number of resource entries returned * @buf: pointer to a user supplied buffer. This buffer must be large enough @@ -6705,7 +6743,7 @@ u8 i40e_get_phy_address(struct i40e_hw *hw, u8 dev_num) } /** - * i40e_blink_phy_led + * i40e_blink_phy_link_led * @hw: pointer to the HW structure * @time: time how long led will blinks in secs * @interval: gap between LED on and off in msecs @@ -6942,15 +6980,23 @@ enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw, struct i40e_hw_port_stats *stat) { enum i40e_status_code ret = I40E_SUCCESS; + bool eee_mrvl_phy; + bool eee_bcm_phy; u32 val; stat->rx_lpi_status = 0; stat->tx_lpi_status = 0; - if ((hw->device_id == I40E_DEV_ID_10G_BASE_T_BC || - hw->device_id == I40E_DEV_ID_5G_BASE_T_BC) && - (hw->phy.link_info.link_speed == I40E_LINK_SPEED_2_5GB || - hw->phy.link_info.link_speed == I40E_LINK_SPEED_5GB)) { + eee_bcm_phy = + (hw->device_id == I40E_DEV_ID_10G_BASE_T_BC || + hw->device_id == I40E_DEV_ID_5G_BASE_T_BC) && + (hw->phy.link_info.link_speed == I40E_LINK_SPEED_2_5GB || + hw->phy.link_info.link_speed == I40E_LINK_SPEED_5GB); + eee_mrvl_phy = + hw->device_id == I40E_DEV_ID_1G_BASE_T_X722; + + if (eee_bcm_phy || eee_mrvl_phy) { + // read Clause 45 PCS Status 1 register ret = i40e_aq_get_phy_register(hw, I40E_AQ_PHY_REG_ACCESS_EXTERNAL, I40E_BCM_PHY_PCS_STATUS1_PAGE, @@ -7542,7 +7588,7 @@ enum i40e_status_code i40e_aq_set_arp_proxy_config(struct i40e_hw *hw, } /** - * i40e_aq_opc_set_ns_proxy_table_entry + * i40e_aq_set_ns_proxy_table_entry * @hw: pointer to the HW structure * @ns_proxy_table_entry: pointer to NS table entry command struct * @cmd_details: pointer to command details diff --git a/sys/dev/ixl/i40e_dcb.c b/sys/dev/ixl/i40e_dcb.c index b2f0b5c0acad..a02cbc80d361 100644 --- a/sys/dev/ixl/i40e_dcb.c +++ b/sys/dev/ixl/i40e_dcb.c @@ -265,7 +265,7 @@ static void i40e_parse_ieee_app_tlv(struct i40e_lldp_org_tlv *tlv, } /** - * i40e_parse_ieee_etsrec_tlv + * i40e_parse_ieee_tlv * @tlv: IEEE 802.1Qaz TLV * @dcbcfg: Local store to update ETS REC data * @@ -345,9 +345,15 @@ static void i40e_parse_cee_pgcfg_tlv(struct i40e_cee_feat_tlv *tlv, * |pg0|pg1|pg2|pg3|pg4|pg5|pg6|pg7| * --------------------------------- */ - for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) + for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) { etscfg->tcbwtable[i] = buf[offset++]; + if (etscfg->prioritytable[i] == I40E_CEE_PGID_STRICT) + dcbcfg->etscfg.tsatable[i] = I40E_IEEE_TSA_STRICT; + else + dcbcfg->etscfg.tsatable[i] = I40E_IEEE_TSA_ETS; + } + /* Number of TCs supported (1 octet) */ etscfg->maxtcs = buf[offset]; } diff --git a/sys/dev/ixl/i40e_lan_hmc.c b/sys/dev/ixl/i40e_lan_hmc.c index c280393ef1c8..eb2c44c92067 100644 --- a/sys/dev/ixl/i40e_lan_hmc.c +++ b/sys/dev/ixl/i40e_lan_hmc.c @@ -546,7 +546,7 @@ configure_lan_hmc_out: } /** - * i40e_delete_hmc_object - remove hmc objects + * i40e_delete_lan_hmc_object - remove hmc objects * @hw: pointer to the HW structure * @info: pointer to i40e_hmc_delete_obj_info struct * diff --git a/sys/dev/ixl/i40e_nvm.c b/sys/dev/ixl/i40e_nvm.c index 20ba63a05b4e..58e5c1a0cdd9 100644 --- a/sys/dev/ixl/i40e_nvm.c +++ b/sys/dev/ixl/i40e_nvm.c @@ -35,7 +35,7 @@ #include "i40e_prototype.h" /** - * i40e_init_nvm_ops - Initialize NVM function pointers + * i40e_init_nvm - Initialize NVM function pointers * @hw: pointer to the HW structure * * Setup the function pointers and the NVM info structure. Should be called @@ -108,7 +108,8 @@ enum i40e_status_code i40e_acquire_nvm(struct i40e_hw *hw, if (ret_code) i40e_debug(hw, I40E_DEBUG_NVM, "NVM acquire type %d failed time_left=%llu ret=%d aq_err=%d\n", - access, time_left, ret_code, hw->aq.asq_last_status); + access, (unsigned long long)time_left, ret_code, + hw->aq.asq_last_status); if (ret_code && time_left) { /* Poll until the current NVM owner timeouts */ @@ -130,7 +131,8 @@ enum i40e_status_code i40e_acquire_nvm(struct i40e_hw *hw, hw->nvm.hw_semaphore_timeout = 0; i40e_debug(hw, I40E_DEBUG_NVM, "NVM acquire timed out, wait %llu ms before trying again. status=%d aq_err=%d\n", - time_left, ret_code, hw->aq.asq_last_status); + (unsigned long long)time_left, ret_code, + hw->aq.asq_last_status); } } @@ -782,10 +784,11 @@ enum i40e_status_code i40e_update_nvm_checksum(struct i40e_hw *hw) DEBUGFUNC("i40e_update_nvm_checksum"); ret_code = i40e_calc_nvm_checksum(hw, &checksum); - le_sum = CPU_TO_LE16(checksum); - if (ret_code == I40E_SUCCESS) + if (ret_code == I40E_SUCCESS) { + le_sum = CPU_TO_LE16(checksum); ret_code = i40e_write_nvm_aq(hw, 0x00, I40E_SR_SW_CHECKSUM_WORD, 1, &le_sum, TRUE); + } return ret_code; } diff --git a/sys/dev/ixl/i40e_prototype.h b/sys/dev/ixl/i40e_prototype.h index 23ce2edb22a3..2febf9d6662d 100644 --- a/sys/dev/ixl/i40e_prototype.h +++ b/sys/dev/ixl/i40e_prototype.h @@ -268,6 +268,10 @@ enum i40e_status_code i40e_aq_write_nvm_config(struct i40e_hw *hw, u8 cmd_flags, void *data, u16 buf_size, u16 element_count, struct i40e_asq_cmd_details *cmd_details); +enum i40e_status_code +i40e_aq_min_rollback_rev_update(struct i40e_hw *hw, u8 mode, u8 module, + u32 min_rrev, + struct i40e_asq_cmd_details *cmd_details); enum i40e_status_code i40e_aq_oem_post_update(struct i40e_hw *hw, void *buff, u16 buff_size, struct i40e_asq_cmd_details *cmd_details); @@ -279,7 +283,11 @@ enum i40e_status_code i40e_aq_update_nvm(struct i40e_hw *hw, u8 module_pointer, u32 offset, u16 length, void *data, bool last_command, u8 preservation_flags, struct i40e_asq_cmd_details *cmd_details); -enum i40e_status_code i40e_aq_nvm_progress(struct i40e_hw *hw, u8 *progress, +enum i40e_status_code i40e_aq_rearrange_nvm(struct i40e_hw *hw, + u8 rearrange_nvm, + struct i40e_asq_cmd_details *cmd_details); +enum i40e_status_code i40e_aq_nvm_update_in_process(struct i40e_hw *hw, + bool update_flow_state, struct i40e_asq_cmd_details *cmd_details); enum i40e_status_code i40e_aq_get_lldp_mib(struct i40e_hw *hw, u8 bridge_type, u8 mib_type, void *buff, u16 buff_size, diff --git a/sys/dev/ixl/i40e_register.h b/sys/dev/ixl/i40e_register.h index 6c57d0a25f7e..ffc6a7e506a6 100644 --- a/sys/dev/ixl/i40e_register.h +++ b/sys/dev/ixl/i40e_register.h @@ -232,6 +232,9 @@ #define I40E_VFCM_PE_ERRINFO1_RLU_ERROR_CNT_MASK I40E_MASK(0xFF, I40E_VFCM_PE_ERRINFO1_RLU_ERROR_CNT_SHIFT) #define I40E_VFCM_PE_ERRINFO1_RLS_ERROR_CNT_SHIFT 24 #define I40E_VFCM_PE_ERRINFO1_RLS_ERROR_CNT_MASK I40E_MASK(0xFF, I40E_VFCM_PE_ERRINFO1_RLS_ERROR_CNT_SHIFT) +#define I40E_PRT_SWR_PM_THR 0x0026CD00 /* Reset: CORER */ +#define I40E_PRT_SWR_PM_THR_THRESHOLD_SHIFT 0 +#define I40E_PRT_SWR_PM_THR_THRESHOLD_MASK I40E_MASK(0xFF, I40E_PRT_SWR_PM_THR_THRESHOLD_SHIFT) #define I40E_GLDCB_GENC 0x00083044 /* Reset: CORER */ #define I40E_GLDCB_GENC_PCIRTT_SHIFT 0 #define I40E_GLDCB_GENC_PCIRTT_MASK I40E_MASK(0xFFFF, I40E_GLDCB_GENC_PCIRTT_SHIFT) diff --git a/sys/dev/ixl/i40e_type.h b/sys/dev/ixl/i40e_type.h index 699576ff5b43..f34002d7dc35 100644 --- a/sys/dev/ixl/i40e_type.h +++ b/sys/dev/ixl/i40e_type.h @@ -347,12 +347,8 @@ struct i40e_phy_info { I40E_PHY_TYPE_OFFSET) #define I40E_CAP_PHY_TYPE_25GBASE_ACC BIT_ULL(I40E_PHY_TYPE_25GBASE_ACC + \ I40E_PHY_TYPE_OFFSET) -/* Offset for 2.5G/5G PHY Types value to bit number conversion */ -#define I40E_PHY_TYPE_OFFSET2 (-10) -#define I40E_CAP_PHY_TYPE_2_5GBASE_T BIT_ULL(I40E_PHY_TYPE_2_5GBASE_T + \ - I40E_PHY_TYPE_OFFSET2) -#define I40E_CAP_PHY_TYPE_5GBASE_T BIT_ULL(I40E_PHY_TYPE_5GBASE_T + \ - I40E_PHY_TYPE_OFFSET2) +#define I40E_CAP_PHY_TYPE_2_5GBASE_T BIT_ULL(I40E_PHY_TYPE_2_5GBASE_T) +#define I40E_CAP_PHY_TYPE_5GBASE_T BIT_ULL(I40E_PHY_TYPE_5GBASE_T) #define I40E_HW_CAP_MAX_GPIO 30 #define I40E_HW_CAP_MDIO_PORT_MODE_MDIO 0 #define I40E_HW_CAP_MDIO_PORT_MODE_I2C 1 @@ -443,6 +439,7 @@ struct i40e_hw_capabilities { u32 enabled_tcmap; u32 maxtc; u64 wr_csr_prot; + bool dis_unused_ports; bool apm_wol_support; enum i40e_acpi_programming_method acpi_prog_method; bool proxy_support; @@ -975,7 +972,8 @@ enum i40e_rx_l2_ptype { I40E_RX_PTYPE_GRENAT4_MAC_PAY3 = 58, I40E_RX_PTYPE_GRENAT4_MACVLAN_IPV6_ICMP_PAY4 = 87, I40E_RX_PTYPE_GRENAT6_MAC_PAY3 = 124, - I40E_RX_PTYPE_GRENAT6_MACVLAN_IPV6_ICMP_PAY4 = 153 + I40E_RX_PTYPE_GRENAT6_MACVLAN_IPV6_ICMP_PAY4 = 153, + I40E_RX_PTYPE_PARSER_ABORTED = 255 }; struct i40e_rx_ptype_decoded { @@ -1551,6 +1549,9 @@ struct i40e_hw_port_stats { #define I40E_SR_CONFIGURATION_METADATA_PTR 0x4D #define I40E_SR_IMMEDIATE_VALUES_PTR 0x4E #define I40E_SR_5TH_FREE_PROVISION_AREA_PTR 0x50 +#define I40E_SR_PRESERVATION_RULES_PTR 0x70 +#define I40E_FPK_SR_5TH_FREE_PROVISION_AREA_PTR 0x71 +#define I40E_SR_6TH_FREE_PROVISION_AREA_PTR 0x71 /* Auxiliary field, mask and shift definition for Shadow RAM and NVM Flash */ #define I40E_SR_VPD_MODULE_MAX_SIZE 1024 @@ -1720,6 +1721,8 @@ struct i40e_lldp_variables { #define I40E_L4_DST_MASK (0x1ULL << I40E_L4_DST_SHIFT) #define I40E_VERIFY_TAG_SHIFT 31 #define I40E_VERIFY_TAG_MASK (0x3ULL << I40E_VERIFY_TAG_SHIFT) +#define I40E_VLAN_SRC_SHIFT 55 +#define I40E_VLAN_SRC_MASK (0x1ULL << I40E_VLAN_SRC_SHIFT) #define I40E_FLEX_50_SHIFT 13 #define I40E_FLEX_50_MASK (0x1ULL << I40E_FLEX_50_SHIFT) diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index 1c6ad5315047..8741eb06ac18 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -1525,11 +1525,11 @@ ixl_if_media_status(if_ctx_t ctx, struct ifmediareq *ifmr) ifmr->ifm_active |= IFM_1000_T; break; /* 2.5 G */ - case I40E_PHY_TYPE_2_5GBASE_T: + case I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS: ifmr->ifm_active |= IFM_2500_T; break; /* 5 G */ - case I40E_PHY_TYPE_5GBASE_T: + case I40E_PHY_TYPE_5GBASE_T_LINK_STATUS: ifmr->ifm_active |= IFM_5000_T; break; /* 10 G */ From owner-dev-commits-src-all@freebsd.org Tue Sep 21 04:09:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D24B6B5776; Tue, 21 Sep 2021 04:09: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 4HD7GQ6lNdz4ng8; Tue, 21 Sep 2021 04: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 C8B171D692; Tue, 21 Sep 2021 04: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 18L492Fm062763; Tue, 21 Sep 2021 04: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 18L492SV062762; Tue, 21 Sep 2021 04:09:02 GMT (envelope-from git) Date: Tue, 21 Sep 2021 04:09:02 GMT Message-Id: <202109210409.18L492SV062762@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 44fb3c695f5e - main - endian.h: Use the __bswap* versions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 44fb3c695f5e672ec00bdef0fa0f13793e6269a1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 04:09:03 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=44fb3c695f5e672ec00bdef0fa0f13793e6269a1 commit 44fb3c695f5e672ec00bdef0fa0f13793e6269a1 Author: Warner Losh AuthorDate: 2021-09-21 04:02:35 +0000 Commit: Warner Losh CommitDate: 2021-09-21 04:02:35 +0000 endian.h: Use the __bswap* versions Make it possible to have all these macros work without bswap* being defined. bswap* is part of the application namespace and applications are free to redefine those functions. Reviewed by: emaste,jhb,markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31964 --- sys/sys/endian.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/sys/endian.h b/sys/sys/endian.h index d070d09ad9f7..faac0458ae2c 100644 --- a/sys/sys/endian.h +++ b/sys/sys/endian.h @@ -67,16 +67,16 @@ typedef __uint64_t uint64_t; * endian to host byte order functions as detailed in byteorder(9). */ #if _BYTE_ORDER == _LITTLE_ENDIAN -#define htobe16(x) bswap16((x)) -#define htobe32(x) bswap32((x)) -#define htobe64(x) bswap64((x)) +#define htobe16(x) __bswap16((x)) +#define htobe32(x) __bswap32((x)) +#define htobe64(x) __bswap64((x)) #define htole16(x) ((uint16_t)(x)) #define htole32(x) ((uint32_t)(x)) #define htole64(x) ((uint64_t)(x)) -#define be16toh(x) bswap16((x)) -#define be32toh(x) bswap32((x)) -#define be64toh(x) bswap64((x)) +#define be16toh(x) __bswap16((x)) +#define be32toh(x) __bswap32((x)) +#define be64toh(x) __bswap64((x)) #define le16toh(x) ((uint16_t)(x)) #define le32toh(x) ((uint32_t)(x)) #define le64toh(x) ((uint64_t)(x)) @@ -84,16 +84,16 @@ typedef __uint64_t uint64_t; #define htobe16(x) ((uint16_t)(x)) #define htobe32(x) ((uint32_t)(x)) #define htobe64(x) ((uint64_t)(x)) -#define htole16(x) bswap16((x)) -#define htole32(x) bswap32((x)) -#define htole64(x) bswap64((x)) +#define htole16(x) __bswap16((x)) +#define htole32(x) __bswap32((x)) +#define htole64(x) __bswap64((x)) #define be16toh(x) ((uint16_t)(x)) #define be32toh(x) ((uint32_t)(x)) #define be64toh(x) ((uint64_t)(x)) -#define le16toh(x) bswap16((x)) -#define le32toh(x) bswap32((x)) -#define le64toh(x) bswap64((x)) +#define le16toh(x) __bswap16((x)) +#define le32toh(x) __bswap32((x)) +#define le64toh(x) __bswap64((x)) #endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ /* Alignment-agnostic encode/decode bytestream to/from little/big endian. */ From owner-dev-commits-src-all@freebsd.org Tue Sep 21 07:39:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B8AD66D820; Tue, 21 Sep 2021 07:39:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDCwh2pBxz3Pby; Tue, 21 Sep 2021 07:39: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 4008E20195; Tue, 21 Sep 2021 07:39: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 18L7d0Y3040537; Tue, 21 Sep 2021 07:39:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18L7d05N040536; Tue, 21 Sep 2021 07:39:00 GMT (envelope-from git) Date: Tue, 21 Sep 2021 07:39:00 GMT Message-Id: <202109210739.18L7d05N040536@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 5572fda3a2f3 - main - mvneta: split to FDT and generic part MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5572fda3a2f305fc4fb4c853d8d578c13d59c1a5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 07:39:00 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=5572fda3a2f305fc4fb4c853d8d578c13d59c1a5 commit 5572fda3a2f305fc4fb4c853d8d578c13d59c1a5 Author: Wojciech Macek AuthorDate: 2021-09-14 07:11:15 +0000 Commit: Wojciech Macek CommitDate: 2021-09-21 07:38:38 +0000 mvneta: split to FDT and generic part Split some missing routines. Obtained from: Semihalf --- sys/dev/neta/if_mvneta.c | 45 +++++--------------------------------------- sys/dev/neta/if_mvneta_fdt.c | 44 +++++++++++++++++++++++++++++++++++++++++++ sys/dev/neta/if_mvnetavar.h | 1 + 3 files changed, 50 insertions(+), 40 deletions(-) diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c index 71552bf2c515..fe86f4a5effe 100644 --- a/sys/dev/neta/if_mvneta.c +++ b/sys/dev/neta/if_mvneta.c @@ -68,10 +68,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include - #include #include @@ -222,11 +218,6 @@ static device_method_t mvneta_methods[] = { DEVMETHOD_END }; -static struct ofw_compat_data compat_data[] = { - { "marvell,armada-3700-neta", true }, - { NULL, false } -}; - DEFINE_CLASS_0(mvneta, mvneta_driver, mvneta_methods, sizeof(struct mvneta_softc)); DRIVER_MODULE(miibus, mvneta, miibus_driver, miibus_devclass, 0, 0); @@ -234,7 +225,7 @@ DRIVER_MODULE(mdio, mvneta, mdio_driver, mdio_devclass, 0, 0); MODULE_DEPEND(mvneta, mdio, 1, 1, 1); MODULE_DEPEND(mvneta, ether, 1, 1, 1); MODULE_DEPEND(mvneta, miibus, 1, 1, 1); -SIMPLEBUS_PNP_INFO(compat_data); +MODULE_DEPEND(mvneta, mvxpbm, 1, 1, 1); /* * List of MIB register and names @@ -418,40 +409,14 @@ mvneta_get_mac_address(struct mvneta_softc *sc, uint8_t *addr) return (0); } -STATIC boolean_t -mvneta_find_ethernet_prop_switch(phandle_t ethernet, phandle_t node) -{ - boolean_t ret; - phandle_t child, switch_eth_handle, switch_eth; - - for (child = OF_child(node); child != 0; child = OF_peer(child)) { - if (OF_getencprop(child, "ethernet", (void*)&switch_eth_handle, - sizeof(switch_eth_handle)) > 0) { - if (switch_eth_handle > 0) { - switch_eth = OF_node_from_xref( - switch_eth_handle); - - if (switch_eth == ethernet) - return (true); - } - } - - ret = mvneta_find_ethernet_prop_switch(ethernet, child); - if (ret != 0) - return (ret); - } - - return (false); -} - STATIC boolean_t mvneta_has_switch(device_t self) { - phandle_t node; - - node = ofw_bus_get_node(self); +#ifdef FDT + return (mvneta_has_switch_fdt(self)); +#endif - return mvneta_find_ethernet_prop_switch(node, OF_finddevice("/")); + return (false); } STATIC int diff --git a/sys/dev/neta/if_mvneta_fdt.c b/sys/dev/neta/if_mvneta_fdt.c index df7840845fcd..bedf4b253a45 100644 --- a/sys/dev/neta/if_mvneta_fdt.c +++ b/sys/dev/neta/if_mvneta_fdt.c @@ -58,6 +58,12 @@ __FBSDID("$FreeBSD$"); #include "if_mvnetareg.h" #include "if_mvnetavar.h" +#ifdef MVNETA_DEBUG +#define STATIC /* nothing */ +#else +#define STATIC static +#endif + #define PHY_MODE_MAXLEN 10 #define INBAND_STATUS_MAXLEN 16 @@ -89,6 +95,8 @@ static struct ofw_compat_data compat_data[] = { {NULL, false} }; +SIMPLEBUS_PNP_INFO(compat_data); + static int mvneta_fdt_probe(device_t dev) { @@ -250,3 +258,39 @@ mvneta_fdt_mac_address(struct mvneta_softc *sc, uint8_t *addr) return (0); } + +STATIC boolean_t +mvneta_find_ethernet_prop_switch(phandle_t ethernet, phandle_t node) +{ + boolean_t ret; + phandle_t child, switch_eth_handle, switch_eth; + + for (child = OF_child(node); child != 0; child = OF_peer(child)) { + if (OF_getencprop(child, "ethernet", (void*)&switch_eth_handle, + sizeof(switch_eth_handle)) > 0) { + if (switch_eth_handle > 0) { + switch_eth = OF_node_from_xref( + switch_eth_handle); + + if (switch_eth == ethernet) + return (true); + } + } + + ret = mvneta_find_ethernet_prop_switch(ethernet, child); + if (ret != 0) + return (ret); + } + + return (false); +} + +boolean_t +mvneta_has_switch_fdt(device_t self) +{ + phandle_t node; + + node = ofw_bus_get_node(self); + + return mvneta_find_ethernet_prop_switch(node, OF_finddevice("/")); +} diff --git a/sys/dev/neta/if_mvnetavar.h b/sys/dev/neta/if_mvnetavar.h index 00bfd1f0848c..0e6cf7829197 100644 --- a/sys/dev/neta/if_mvnetavar.h +++ b/sys/dev/neta/if_mvnetavar.h @@ -321,6 +321,7 @@ struct mvneta_softc { int mvneta_attach(device_t); #ifdef FDT +boolean_t mvneta_has_switch_fdt(device_t); int mvneta_fdt_mac_address(struct mvneta_softc *, uint8_t *); #endif From owner-dev-commits-src-all@freebsd.org Tue Sep 21 10:01:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A234966F5AA; Tue, 21 Sep 2021 10:01:55 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mail.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDH5b0kD2z3tNr; Tue, 21 Sep 2021 10:01:54 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1632218512; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eS6A0qiwIivnLoyBpp4cqImqR7TeXA7BbKSeOwOqHp0=; b=FZqfP9ybtJs1oDOrxsCjpGkjfwUa0wxZ5kgmPSeIaLCIGHBlgpCYBPqGDEhikIfneT16UB Xv0ByvDiqXkNRjpYGC83F0zju2pq70b14mZtX+jQ2Gnrp1U8/mZgHhrlyFaXB495rMBq0t WKBR+EPcZEbmFE9EOJCJryahXetBD9U= Received: from amy (lfbn-idf2-1-644-191.w86-247.abo.wanadoo.fr [86.247.100.191]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 5ef177d3 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 21 Sep 2021 10:01:52 +0000 (UTC) Date: Tue, 21 Sep 2021 12:01:52 +0200 From: Emmanuel Vadot To: "Bjoern A. Zeeb" Cc: Toomas Soome , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: b4cb3fe0e39a - main - loader: implement mount/unmount rootfs Message-Id: <20210921120152.a76525d0849640320b2b156e@bidouilliste.com> In-Reply-To: References: <202109081249.188CncXF065953@gitrepo.freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HDH5b0kD2z3tNr X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 10:01:55 -0000 On Mon, 20 Sep 2021 19:46:07 +0000 (UTC) "Bjoern A. Zeeb" wrote: > On Wed, 8 Sep 2021, Toomas Soome wrote: > > > The branch main has been updated by tsoome: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=b4cb3fe0e39a31e60292018dc9fb7510b3de92bf > > > > commit b4cb3fe0e39a31e60292018dc9fb7510b3de92bf > > Author: Toomas Soome > > AuthorDate: 2021-08-12 05:45:52 +0000 > > Commit: Toomas Soome > > CommitDate: 2021-09-08 01:01:20 +0000 > > > > loader: implement mount/unmount rootfs > > > > We want to keep our root file system open to preserve bcache segment > > between file accesses, thus reducing physical disk IO. > > > > Reviewed by: imp, allanjude, kevans (previous version) > > Differential Revision: https://reviews.freebsd.org/D30848 > > MFC after: 1 month > > > This makes netbooting on at least one of my arm64 impossible: > > ------------------------------------------------------------------------ > Consoles: serial port > Reading loader env vars from /efi/freebsd/loader.env > FreeBSD/arm64 EFI loader, Revision 1.1 > (Mon Sep 20 13:12:35 UTC 2021 root@localhost) > > Command line arguments: loader.efi > Image base: 0xeb7e9000 > EFI version: 2.70 > EFI Firmware: EDK II (rev 1.00) > Console: comconsole (0) > Load Path: > Load Device: MAC(xxxxxxxxxxxx,0x1)/IPv4(0.0.0.0) > BootCurrent: 0004 > BootOrder: 0000 0001 0002 0003 0008 0004[*] 0005 0006 0007 > BootInfo Path: MAC(xxxxxxxxxxxx,0x1)/IPv4(0.0.0.0) > Ignoring Boot0004: Only one DP found > Setting currdev to net0: > > > Synchronous Exception at 0x00000000EB8217A8 > > ------------------------------------------------------------------------ > > I've backed out this change and rebuild and things boot fine again. > > Any idea what I could try? > > > /bz > > -- > Bjoern A. Zeeb r15:7 Same thing for me on u-boot based systems : Consoles: EFI console Reading loader env vars from /efi/freebsd/loader.env FreeBSD/arm64 EFI loader, Revision 1.1 Command line arguments: loader.efi Image base: 0xfbde0000 EFI version: 2.80 EFI Firmware: Das U-Boot (rev 8225.1792) Console: comconsole (0) Load Path: /aarch64\loader.efi Load Device: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MAC(86e0c0eafaa9,1) Setting currdev to net0: Speed: 1000, full duplex net0: cannot set rx. filters (status=3) "Synchronous Abort" handler, esr 0x96000004 elr: fffffffffd0f1b9c lr : fffffffffd0effb4 (reloc) elr: 00000000fbe37b9c lr : 00000000fbe35fb4 x0 : fbee447500000000 x1 : 0000000000000020 x2 : 0000000000000001 x3 : 00000000fbee4452 x4 : 0000000000000073 x5 : 0000000000000050 x6 : 00000000fbe357a4 x7 : 0000000000000000 x8 : fbee447500000000 x9 : fbee447500000000 x10: 0000000000000000 x11: 00000000fbee3b86 x12: 0000000000000000 x13: 0000000000000000 x14: 0000000000000000 x15: 0000000000000000 x16: 0000000000000000 x17: 0000000000000000 x18: 0000000000000000 x19: 0000000000000020 x20: 00000000fbf05df8 x21: 0000000000000000 x22: 0000000000000000 x23: fbee447500000000 x24: 0000000000000000 x25: 00000000fbf079b0 x26: 00000000fbee4453 x27: 00000000fbf079b0 x28: 00000000fbee79ee x29: 00000000fbf05d50 Code: 8b090100 d65f03c0 927df009 aa0903e8 (f840850b) UEFI image [0x00000000fbde0000:0x00000000fbf14e9f] pc=0x57b9c '/aarch64\loader.efi' Resetting CPU ... -- Emmanuel Vadot From owner-dev-commits-src-all@freebsd.org Tue Sep 21 10:03:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1796166F91B for ; Tue, 21 Sep 2021 10:03:35 +0000 (UTC) (envelope-from tsoome@me.com) Received: from pv50p00im-zteg10021301.me.com (pv50p00im-zteg10021301.me.com [17.58.6.46]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDH7V6cYXz3t7p for ; Tue, 21 Sep 2021 10:03:34 +0000 (UTC) (envelope-from tsoome@me.com) Received: from smtpclient.apple (unknown [91.209.240.229]) by pv50p00im-zteg10021301.me.com (Postfix) with ESMTPSA id 4B859CC04B9; Tue, 21 Sep 2021 10:03:26 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: b4cb3fe0e39a - main - loader: implement mount/unmount rootfs From: Toomas Soome In-Reply-To: <20210921120152.a76525d0849640320b2b156e@bidouilliste.com> Date: Tue, 21 Sep 2021 13:03:22 +0300 Cc: "Bjoern A. Zeeb" , Toomas Soome , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202109081249.188CncXF065953@gitrepo.freebsd.org> <20210921120152.a76525d0849640320b2b156e@bidouilliste.com> To: Emmanuel Vadot X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-09-21_01:2021-09-20, 2021-09-21 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2009150000 definitions=main-2109210064 X-Rspamd-Queue-Id: 4HDH7V6cYXz3t7p X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 10:03:35 -0000 > On 21. Sep 2021, at 13:01, Emmanuel Vadot = wrote: >=20 > On Mon, 20 Sep 2021 19:46:07 +0000 (UTC) > "Bjoern A. Zeeb" wrote: >=20 >> On Wed, 8 Sep 2021, Toomas Soome wrote: >>=20 >>> The branch main has been updated by tsoome: >>>=20 >>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Db4cb3fe0e39a31e60292018dc9fb7510= b3de92bf >>>=20 >>> commit b4cb3fe0e39a31e60292018dc9fb7510b3de92bf >>> Author: Toomas Soome >>> AuthorDate: 2021-08-12 05:45:52 +0000 >>> Commit: Toomas Soome >>> CommitDate: 2021-09-08 01:01:20 +0000 >>>=20 >>> loader: implement mount/unmount rootfs >>>=20 >>> We want to keep our root file system open to preserve bcache = segment >>> between file accesses, thus reducing physical disk IO. >>>=20 >>> Reviewed by: imp, allanjude, kevans (previous version) >>> Differential Revision: https://reviews.freebsd.org/D30848 >>> MFC after: 1 month >>=20 >>=20 >> This makes netbooting on at least one of my arm64 impossible: >>=20 >> = ------------------------------------------------------------------------ >> Consoles: serial port >> Reading loader env vars from /efi/freebsd/loader.env >> FreeBSD/arm64 EFI loader, Revision 1.1 >> (Mon Sep 20 13:12:35 UTC 2021 root@localhost) >>=20 >> Command line arguments: loader.efi >> Image base: 0xeb7e9000 >> EFI version: 2.70 >> EFI Firmware: EDK II (rev 1.00) >> Console: comconsole (0) >> Load Path: >> Load Device: MAC(xxxxxxxxxxxx,0x1)/IPv4(0.0.0.0) >> BootCurrent: 0004 >> BootOrder: 0000 0001 0002 0003 0008 0004[*] 0005 0006 0007 >> BootInfo Path: MAC(xxxxxxxxxxxx,0x1)/IPv4(0.0.0.0) >> Ignoring Boot0004: Only one DP found >> Setting currdev to net0: >>=20 >>=20 >> Synchronous Exception at 0x00000000EB8217A8 >>=20 >> = ------------------------------------------------------------------------ >>=20 >> I've backed out this change and rebuild and things boot fine again. >>=20 >> Any idea what I could try? >>=20 >>=20 >> /bz >>=20 >> --=20 >> Bjoern A. Zeeb = r15:7 >=20 > Same thing for me on u-boot based systems : Ye, it seems to be the same issue, UEFI netboot is broken, = investigating. sorry, toomas >=20 > Consoles: EFI > console Reading loader env vars > from /efi/freebsd/loader.env FreeBSD/arm64 EFI loader, Revision > 1.1=20 > Command line arguments: > loader.efi Image base: > 0xfbde0000 EFI version: > 2.80 EFI Firmware: Das U-Boot (rev > 8225.1792) Console: comconsole > (0) Load > Path: /aarch64\loader.efi Load > Device: = /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MAC(86e0c0eafaa9,1) > Setting currdev to net0: Speed: 1000, full > duplex net0: cannot set rx. filters > (status=3D3) "Synchronous Abort" handler, esr > 0x96000004 elr: fffffffffd0f1b9c lr : fffffffffd0effb4 > (reloc) elr: 00000000fbe37b9c lr : > 00000000fbe35fb4 x0 : fbee447500000000 x1 : > 0000000000000020 x2 : 0000000000000001 x3 : > 00000000fbee4452 x4 : 0000000000000073 x5 : > 0000000000000050 x6 : 00000000fbe357a4 x7 : > 0000000000000000 x8 : fbee447500000000 x9 : > fbee447500000000 x10: 0000000000000000 x11: > 00000000fbee3b86 x12: 0000000000000000 x13: > 0000000000000000 x14: 0000000000000000 x15: > 0000000000000000 x16: 0000000000000000 x17: > 0000000000000000 x18: 0000000000000000 x19: > 0000000000000020 x20: 00000000fbf05df8 x21: > 0000000000000000 x22: 0000000000000000 x23: > fbee447500000000 x24: 0000000000000000 x25: > 00000000fbf079b0 x26: 00000000fbee4453 x27: > 00000000fbf079b0 x28: 00000000fbee79ee x29: > 00000000fbf05d50=20 > Code: 8b090100 d65f03c0 927df009 aa0903e8 > (f840850b) UEFI image [0x00000000fbde0000:0x00000000fbf14e9f] > pc=3D0x57b9c '/aarch64\loader.efi' Resetting CPU ... >=20 > --=20 > Emmanuel Vadot From owner-dev-commits-src-all@freebsd.org Tue Sep 21 12:02:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D46B8671393; Tue, 21 Sep 2021 12:02: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 4HDKmL5bfHz4YK9; Tue, 21 Sep 2021 12:02: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 A06A323B9E; Tue, 21 Sep 2021 12:02: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 18LC2A2O096914; Tue, 21 Sep 2021 12:02:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LC2Api096913; Tue, 21 Sep 2021 12:02:10 GMT (envelope-from git) Date: Tue, 21 Sep 2021 12:02:10 GMT Message-Id: <202109211202.18LC2Api096913@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 0b79a76f8487 - main - sctp: improve consistency when calling stream scheduler MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0b79a76f848768068d409edcb36f2a58cdd17e61 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 12:02:10 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=0b79a76f848768068d409edcb36f2a58cdd17e61 commit 0b79a76f848768068d409edcb36f2a58cdd17e61 Author: Michael Tuexen AuthorDate: 2021-09-20 22:54:13 +0000 Commit: Michael Tuexen CommitDate: 2021-09-20 22:54:13 +0000 sctp: improve consistency when calling stream scheduler Hold always the stcb send lock when calling sctp_ss_init() and sctp_ss_remove_from_stream(). MFC after: 1 week --- sys/netinet/sctp_output.c | 8 ++++---- sys/netinet/sctp_timer.c | 17 +++++++++-------- sys/netinet/sctputil.c | 4 +++- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 434ab7e1f8dc..27ad92527454 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -7207,13 +7207,13 @@ one_more_time: sp->put_last_out, send_lock_up); } - if ((TAILQ_NEXT(sp, next) == NULL) && (send_lock_up == 0)) { + if (send_lock_up == 0) { SCTP_TCB_SEND_LOCK(stcb); send_lock_up = 1; } atomic_subtract_int(&asoc->stream_queue_cnt, 1); TAILQ_REMOVE(&strq->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp, send_lock_up); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp, 1); if ((strq->state == SCTP_STREAM_RESET_PENDING) && (strq->chunks_on_queues == 0) && TAILQ_EMPTY(&strq->outqueue)) { @@ -7638,13 +7638,13 @@ dont_do_it: sp->put_last_out, send_lock_up); } - if ((send_lock_up == 0) && (TAILQ_NEXT(sp, next) == NULL)) { + if (send_lock_up == 0) { SCTP_TCB_SEND_LOCK(stcb); send_lock_up = 1; } atomic_subtract_int(&asoc->stream_queue_cnt, 1); TAILQ_REMOVE(&strq->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp, send_lock_up); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp, 1); if ((strq->state == SCTP_STREAM_RESET_PENDING) && (strq->chunks_on_queues == 0) && TAILQ_EMPTY(&strq->outqueue)) { diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c index e657bc280ccc..72a0a2c32c88 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -1344,18 +1344,18 @@ sctp_shutdownack_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } static void -sctp_audit_stream_queues_for_size(struct sctp_inpcb *inp, - struct sctp_tcb *stcb) +sctp_audit_stream_queues_for_size(struct sctp_inpcb *inp, struct sctp_tcb *stcb) { struct sctp_stream_queue_pending *sp; unsigned int i, chks_in_queue = 0; int being_filled = 0; - /* - * This function is ONLY called when the send/sent queues are empty. - */ - if ((stcb == NULL) || (inp == NULL)) - return; + KASSERT(inp != NULL, ("inp is NULL")); + KASSERT(stcb != NULL, ("stcb is NULL")); + + SCTP_TCB_SEND_LOCK(stcb); + KASSERT(TAILQ_EMPTY(&stcb->asoc.send_queue), ("send_queue not empty")); + KASSERT(TAILQ_EMPTY(&stcb->asoc.sent_queue), ("sent_queue not empty")); if (stcb->asoc.sent_queue_retran_cnt) { SCTP_PRINTF("Hmm, sent_queue_retran_cnt is non-zero %d\n", @@ -1364,7 +1364,7 @@ sctp_audit_stream_queues_for_size(struct sctp_inpcb *inp, } if (stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, &stcb->asoc)) { /* No stream scheduler information, initialize scheduler */ - stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 0); + stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1); if (!stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, &stcb->asoc)) { /* yep, we lost a stream or two */ SCTP_PRINTF("Found additional streams NOT managed by scheduler, corrected\n"); @@ -1406,6 +1406,7 @@ sctp_audit_stream_queues_for_size(struct sctp_inpcb *inp, (u_long)stcb->asoc.total_output_queue_size); stcb->asoc.total_output_queue_size = 0; } + SCTP_TCB_SEND_UNLOCK(stcb); } int diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index c6cdd3315704..a7eb50716cc9 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1288,6 +1288,7 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ENOMEM); return (ENOMEM); } + SCTP_TCB_SEND_LOCK(stcb); for (i = 0; i < asoc->streamoutcnt; i++) { /* * inbound side must be set to 0xffff, also NOTE when we get @@ -1315,7 +1316,8 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, asoc->strmout[i].last_msg_incomplete = 0; asoc->strmout[i].state = SCTP_STREAM_OPENING; } - asoc->ss_functions.sctp_ss_init(stcb, asoc, 0); + asoc->ss_functions.sctp_ss_init(stcb, asoc, 1); + SCTP_TCB_SEND_UNLOCK(stcb); /* Now the mapping array */ asoc->mapping_array_size = SCTP_INITIAL_MAPPING_ARRAY; From owner-dev-commits-src-all@freebsd.org Tue Sep 21 13:09:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 78035672F28; Tue, 21 Sep 2021 13:09:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDMGT2yBNz4fms; Tue, 21 Sep 2021 13:09:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45C88246D4; Tue, 21 Sep 2021 13:09:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LD9rOi082710; Tue, 21 Sep 2021 13:09:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LD9rIR082709; Tue, 21 Sep 2021 13:09:53 GMT (envelope-from git) Date: Tue, 21 Sep 2021 13:09:53 GMT Message-Id: <202109211309.18LD9rIR082709@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 806ebc9eba2a - main - 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/main X-Git-Reftype: branch X-Git-Commit: 806ebc9eba2a45638d63ae8a2ed20e6fb44dd06e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 13:09:53 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=806ebc9eba2a45638d63ae8a2ed20e6fb44dd06e commit 806ebc9eba2a45638d63ae8a2ed20e6fb44dd06e Author: Mitchell Horne AuthorDate: 2021-09-09 18:07:06 +0000 Commit: Mitchell Horne CommitDate: 2021-09-21 13:08:39 +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 --- 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 38617dcd38eb..c8725b6067f6 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -762,6 +763,13 @@ bcm_sdhci_will_handle_transfer(device_t dev, struct sdhci_slot *slot) struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); #endif + /* + * We don't want to perform DMA in this context -- interrupts are + * disabled, and a transaction may already be in progress. + */ + if (dumping) + return (0); + /* * This indicates that we somehow let a data interrupt slip by into the * SDHCI framework, when it should not have. This really needs to be From owner-dev-commits-src-all@freebsd.org Tue Sep 21 13:32:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5788673892; Tue, 21 Sep 2021 13:32: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 4HDMmX5BFfz4jV9; Tue, 21 Sep 2021 13:32: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 9265024BC1; Tue, 21 Sep 2021 13:32: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 18LDWSYN021858; Tue, 21 Sep 2021 13:32:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LDWSjg021857; Tue, 21 Sep 2021 13:32:28 GMT (envelope-from git) Date: Tue, 21 Sep 2021 13:32:28 GMT Message-Id: <202109211332.18LDWSjg021857@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: 62faf669ac4b - stable/13 - vm_phys: do not ignore phys_avail[] segments that do not fit completely into vm_phys segments 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: 62faf669ac4b779d7444e72ad97ebfefbfaaaf63 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 13:32:28 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=62faf669ac4b779d7444e72ad97ebfefbfaaaf63 commit 62faf669ac4b779d7444e72ad97ebfefbfaaaf63 Author: Konstantin Belousov AuthorDate: 2021-09-14 12:25:37 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 13:31:27 +0000 vm_phys: do not ignore phys_avail[] segments that do not fit completely into vm_phys segments (cherry picked from commit 181bfb42fd01bfa9f4636e803ccb3eeed8ac8ba4) --- sys/vm/vm_page.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index aae45513a44c..dc56ca9bae05 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -552,11 +552,12 @@ vm_offset_t vm_page_startup(vm_offset_t vaddr) { struct vm_phys_seg *seg; + struct vm_domain *vmd; vm_page_t m; char *list, *listend; vm_paddr_t end, high_avail, low_avail, new_end, size; vm_paddr_t page_range __unused; - vm_paddr_t last_pa, pa; + vm_paddr_t last_pa, pa, startp, endp; u_long pagecount; #if MINIDUMP_PAGE_TRACKING u_long vm_page_dump_size; @@ -770,21 +771,20 @@ vm_page_startup(vm_offset_t vaddr) vm_page_init_page(m, pa, segind); /* - * Add the segment to the free lists only if it is covered by - * one of the ranges in phys_avail. Because we've added the - * ranges to the vm_phys_segs array, we can assume that each - * segment is either entirely contained in one of the ranges, - * or doesn't overlap any of them. + * Add the segment's pages that are covered by one of + * phys_avail's ranges to the free lists. */ for (i = 0; phys_avail[i + 1] != 0; i += 2) { - struct vm_domain *vmd; - - if (seg->start < phys_avail[i] || - seg->end > phys_avail[i + 1]) + if (seg->end < phys_avail[i] || + seg->start >= phys_avail[i + 1]) continue; - m = seg->first_page; - pagecount = (u_long)atop(seg->end - seg->start); + startp = MAX(seg->start, phys_avail[i]); + m = seg->first_page + atop(seg->start - startp); + endp = MIN(seg->end, phys_avail[i + 1]); + pagecount = (u_long)atop(endp - startp); + if (pagecount == 0) + continue; vmd = VM_DOMAIN(seg->domain); vm_domain_free_lock(vmd); @@ -796,7 +796,6 @@ vm_page_startup(vm_offset_t vaddr) vmd = VM_DOMAIN(seg->domain); vmd->vmd_page_count += (u_int)pagecount; vmd->vmd_segs |= 1UL << m->segind; - break; } } From owner-dev-commits-src-all@freebsd.org Tue Sep 21 13:32:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D618673278; Tue, 21 Sep 2021 13:32:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDMmY75NZz4jXt; Tue, 21 Sep 2021 13:32:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B42EF24E16; Tue, 21 Sep 2021 13:32:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LDWT7Z021882; Tue, 21 Sep 2021 13:32:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LDWTUG021881; Tue, 21 Sep 2021 13:32:29 GMT (envelope-from git) Date: Tue, 21 Sep 2021 13:32:29 GMT Message-Id: <202109211332.18LDWTUG021881@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: 6a9e83fec125 - stable/13 - vm_page_startup: correct calculation of the starting page 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: 6a9e83fec1256fe3378d78ccf1964bc087111101 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 13:32:30 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6a9e83fec1256fe3378d78ccf1964bc087111101 commit 6a9e83fec1256fe3378d78ccf1964bc087111101 Author: Konstantin Belousov AuthorDate: 2021-09-17 18:48:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 13:31:27 +0000 vm_page_startup: correct calculation of the starting page (cherry picked from commit bd3a668087efb02e8e84315f7cc29d3813270dff) --- sys/vm/vm_page.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index dc56ca9bae05..9ca18129f415 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -775,27 +775,25 @@ vm_page_startup(vm_offset_t vaddr) * phys_avail's ranges to the free lists. */ for (i = 0; phys_avail[i + 1] != 0; i += 2) { - if (seg->end < phys_avail[i] || + if (seg->end <= phys_avail[i] || seg->start >= phys_avail[i + 1]) continue; startp = MAX(seg->start, phys_avail[i]); - m = seg->first_page + atop(seg->start - startp); endp = MIN(seg->end, phys_avail[i + 1]); pagecount = (u_long)atop(endp - startp); if (pagecount == 0) continue; + m = seg->first_page + atop(startp - seg->start); vmd = VM_DOMAIN(seg->domain); vm_domain_free_lock(vmd); vm_phys_enqueue_contig(m, pagecount); vm_domain_free_unlock(vmd); vm_domain_freecnt_inc(vmd, pagecount); vm_cnt.v_page_count += (u_int)pagecount; - - vmd = VM_DOMAIN(seg->domain); vmd->vmd_page_count += (u_int)pagecount; - vmd->vmd_segs |= 1UL << m->segind; + vmd->vmd_segs |= 1UL << segind; } } From owner-dev-commits-src-all@freebsd.org Tue Sep 21 13:48:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F44C673C29; Tue, 21 Sep 2021 13:48:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDN6z0rt5z4kRG; Tue, 21 Sep 2021 13:48: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 F20D4249DD; Tue, 21 Sep 2021 13:48: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 18LDmQxq035545; Tue, 21 Sep 2021 13:48:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LDmQ7n035544; Tue, 21 Sep 2021 13:48:26 GMT (envelope-from git) Date: Tue, 21 Sep 2021 13:48:26 GMT Message-Id: <202109211348.18LDmQ7n035544@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: fefff1bac5e2 - stable/13 - socket: De-duplicate SBLOCKWAIT() definitions 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: fefff1bac5e20aea79a8acdf1536a34dd58e3fa4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 13:48:27 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fefff1bac5e20aea79a8acdf1536a34dd58e3fa4 commit fefff1bac5e20aea79a8acdf1536a34dd58e3fa4 Author: Mark Johnston AuthorDate: 2021-09-14 13:01:32 +0000 Commit: Mark Johnston CommitDate: 2021-09-21 13:37:21 +0000 socket: De-duplicate SBLOCKWAIT() definitions Sponsored by: The FreeBSD Foundation (cherry picked from commit fa0463c384b652e1e962d5e8e70396e6a876f01b) --- sys/dev/hyperv/hvsock/hv_sock.c | 1 - sys/kern/uipc_socket.c | 2 -- sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c | 2 -- sys/sys/socketvar.h | 2 ++ 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/sys/dev/hyperv/hvsock/hv_sock.c b/sys/dev/hyperv/hvsock/hv_sock.c index 00e296fcd335..bdc8974afdbd 100644 --- a/sys/dev/hyperv/hvsock/hv_sock.c +++ b/sys/dev/hyperv/hvsock/hv_sock.c @@ -626,7 +626,6 @@ hvs_trans_disconnect(struct socket *so) return (0); } -#define SBLOCKWAIT(f) (((f) & MSG_DONTWAIT) ? 0 : SBL_WAIT) struct hvs_callback_arg { struct uio *uio; struct sockbuf *sb; diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 9f4e2fc64e98..dc7407808535 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1370,8 +1370,6 @@ sodisconnect(struct socket *so) return (error); } -#define SBLOCKWAIT(f) (((f) & MSG_DONTWAIT) ? 0 : SBL_WAIT) - int sosend_dgram(struct socket *so, struct sockaddr *addr, struct uio *uio, struct mbuf *top, struct mbuf *control, int flags, struct thread *td) diff --git a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c index a38bdfcbed59..62e12f3b477c 100644 --- a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c +++ b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c @@ -1047,8 +1047,6 @@ out: return (error); } -#define SBLOCKWAIT(f) (((f) & MSG_DONTWAIT) ? 0 : SBL_WAIT) - /* * Send on a socket. If send must go all at once and message is larger than * send buffering, then hard error. Lock against other senders. If must go diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index 47033fdabbfa..6452716d36de 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -255,6 +255,8 @@ struct socket { #define SBL_NOINTR 0x00000002 /* Force non-interruptible sleep. */ #define SBL_VALID (SBL_WAIT | SBL_NOINTR) +#define SBLOCKWAIT(f) (((f) & MSG_DONTWAIT) ? 0 : SBL_WAIT) + /* * Do we need to notify the other side when I/O is possible? */ From owner-dev-commits-src-all@freebsd.org Tue Sep 21 13:48:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C5A0673767; Tue, 21 Sep 2021 13:48:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDN701zNkz4kZV; Tue, 21 Sep 2021 13:48: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 20282250B3; Tue, 21 Sep 2021 13:48:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LDmSGQ035569; Tue, 21 Sep 2021 13:48:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LDmStX035568; Tue, 21 Sep 2021 13:48:28 GMT (envelope-from git) Date: Tue, 21 Sep 2021 13:48:28 GMT Message-Id: <202109211348.18LDmStX035568@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: 3c9c3ab05c56 - stable/13 - ip6mrouter: Make the expiration callout MPSAFE 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: 3c9c3ab05c5655322515f71e8dcfa535db381ab3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 13:48:28 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3c9c3ab05c5655322515f71e8dcfa535db381ab3 commit 3c9c3ab05c5655322515f71e8dcfa535db381ab3 Author: Mark Johnston AuthorDate: 2021-09-07 15:15:49 +0000 Commit: Mark Johnston CommitDate: 2021-09-21 13:37:32 +0000 ip6mrouter: Make the expiration callout MPSAFE - Protect the `expire_upcalls` callout with the MFC6 mutex. The callout handler needs this mutex anyway. - Convert the MROUTER6 mutex to a sleepable sx lock. It is only used when configuring the global v6 multicast routing socket, so is only used in system call paths where sleeping is safe. This lets us drain the callout without having to drop the lock. - For all locking macros in the file, convert to using a _LOCKPTR macro. Reported by: mav Sponsored by: The FreeBSD Foundation (cherry picked from commit 353783964c605e9cd71f359444c1230226d5782f) --- sys/netinet6/ip6_mroute.c | 56 +++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index 503c83490940..087e0c5059fd 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -167,16 +167,13 @@ SYSCTL_STRUCT(_net_inet6_ip6, OID_AUTO, mrt6stat, CTLFLAG_RW, #define NO_RTE_FOUND 0x1 #define RTE_FOUND 0x2 -static struct mtx mrouter6_mtx; -#define MROUTER6_LOCK() mtx_lock(&mrouter6_mtx) -#define MROUTER6_UNLOCK() mtx_unlock(&mrouter6_mtx) -#define MROUTER6_LOCK_ASSERT() do { \ - mtx_assert(&mrouter6_mtx, MA_OWNED); \ - NET_ASSERT_GIANT(); \ -} while (0) -#define MROUTER6_LOCK_INIT() \ - mtx_init(&mrouter6_mtx, "IPv6 multicast forwarding", NULL, MTX_DEF) -#define MROUTER6_LOCK_DESTROY() mtx_destroy(&mrouter6_mtx) +static struct sx mrouter6_mtx; +#define MROUTER6_LOCKPTR() (&mrouter6_mtx) +#define MROUTER6_LOCK() sx_xlock(MROUTER6_LOCKPTR()) +#define MROUTER6_UNLOCK() sx_xunlock(MROUTER6_LOCKPTR()) +#define MROUTER6_LOCK_ASSERT() sx_assert(MROUTER6_LOCKPTR(), SA_XLOCKED +#define MROUTER6_LOCK_INIT() sx_init(MROUTER6_LOCKPTR(), "mrouter6") +#define MROUTER6_LOCK_DESTROY() sx_destroy(MROUTER6_LOCKPTR()) static struct mf6c *mf6ctable[MF6CTBLSIZ]; SYSCTL_OPAQUE(_net_inet6_ip6, OID_AUTO, mf6ctable, CTLFLAG_RD, @@ -185,15 +182,14 @@ SYSCTL_OPAQUE(_net_inet6_ip6, OID_AUTO, mf6ctable, CTLFLAG_RD, "netinet6/ip6_mroute.h)"); static struct mtx mfc6_mtx; -#define MFC6_LOCK() mtx_lock(&mfc6_mtx) -#define MFC6_UNLOCK() mtx_unlock(&mfc6_mtx) -#define MFC6_LOCK_ASSERT() do { \ - mtx_assert(&mfc6_mtx, MA_OWNED); \ - NET_ASSERT_GIANT(); \ -} while (0) -#define MFC6_LOCK_INIT() \ - mtx_init(&mfc6_mtx, "IPv6 multicast forwarding cache", NULL, MTX_DEF) -#define MFC6_LOCK_DESTROY() mtx_destroy(&mfc6_mtx) +#define MFC6_LOCKPTR() (&mfc6_mtx) +#define MFC6_LOCK() mtx_lock(MFC6_LOCKPTR()) +#define MFC6_UNLOCK() mtx_unlock(MFC6_LOCKPTR()) +#define MFC6_LOCK_ASSERT() mtx_assert(MFC6_LOCKPTR(), MA_OWNED) +#define MFC6_LOCK_INIT() mtx_init(MFC6_LOCKPTR(), \ + "IPv6 multicast forwarding cache", \ + NULL, MTX_DEF) +#define MFC6_LOCK_DESTROY() mtx_destroy(MFC6_LOCKPTR()) static u_char n6expire[MF6CTBLSIZ]; @@ -230,12 +226,13 @@ SYSCTL_PROC(_net_inet6_ip6, OID_AUTO, mif6table, "netinet6/ip6_mroute.h)"); static struct mtx mif6_mtx; -#define MIF6_LOCK() mtx_lock(&mif6_mtx) -#define MIF6_UNLOCK() mtx_unlock(&mif6_mtx) -#define MIF6_LOCK_ASSERT() mtx_assert(&mif6_mtx, MA_OWNED) +#define MIF6_LOCKPTR() (&mif6_mtx) +#define MIF6_LOCK() mtx_lock(MIF6_LOCKPTR()) +#define MIF6_UNLOCK() mtx_unlock(MIF6_LOCKPTR()) +#define MIF6_LOCK_ASSERT() mtx_assert(MIF6_LOCKPTR(), MA_OWNED) #define MIF6_LOCK_INIT() \ - mtx_init(&mif6_mtx, "IPv6 multicast interfaces", NULL, MTX_DEF) -#define MIF6_LOCK_DESTROY() mtx_destroy(&mif6_mtx) + mtx_init(MIF6_LOCKPTR(), "IPv6 multicast interfaces", NULL, MTX_DEF) +#define MIF6_LOCK_DESTROY() mtx_destroy(MIF6_LOCKPTR()) #ifdef MRT6DEBUG VNET_DEFINE_STATIC(u_int, mrt6debug) = 0; /* debug level */ @@ -583,11 +580,12 @@ ip6_mrouter_init(struct socket *so, int v, int cmd) V_pim6 = 0;/* used for stubbing out/in pim stuff */ - callout_init(&expire_upcalls_ch, 0); + callout_init_mtx(&expire_upcalls_ch, MFC6_LOCKPTR(), 0); callout_reset(&expire_upcalls_ch, EXPIRE_TIMEOUT, expire_upcalls, NULL); MROUTER6_UNLOCK(); + MRT6_DLOG(DEBUG_ANY, "finished"); return (0); @@ -626,8 +624,6 @@ X_ip6_mrouter_done(void) V_pim6 = 0; /* used to stub out/in pim specific code */ - callout_stop(&expire_upcalls_ch); - /* * Free all multicast forwarding cache entries. */ @@ -652,6 +648,8 @@ X_ip6_mrouter_done(void) bzero((caddr_t)mf6ctable, sizeof(mf6ctable)); MFC6_UNLOCK(); + callout_drain(&expire_upcalls_ch); + /* * Reset register interface */ @@ -1315,7 +1313,8 @@ expire_upcalls(void *unused) struct mf6c *mfc, **nptr; u_long i; - MFC6_LOCK(); + MFC6_LOCK_ASSERT(); + for (i = 0; i < MF6CTBLSIZ; i++) { if (n6expire[i] == 0) continue; @@ -1353,7 +1352,6 @@ expire_upcalls(void *unused) } } } - MFC6_UNLOCK(); callout_reset(&expire_upcalls_ch, EXPIRE_TIMEOUT, expire_upcalls, NULL); } From owner-dev-commits-src-all@freebsd.org Tue Sep 21 13:48:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8946E6735F4; Tue, 21 Sep 2021 13:48:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDN712vk9z4khy; Tue, 21 Sep 2021 13:48:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B80B250B4; Tue, 21 Sep 2021 13:48:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LDmTFS035593; Tue, 21 Sep 2021 13:48:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LDmTg6035592; Tue, 21 Sep 2021 13:48:29 GMT (envelope-from git) Date: Tue, 21 Sep 2021 13:48:29 GMT Message-Id: <202109211348.18LDmTg6035592@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: 76985729102c - stable/13 - debugnet: Include some required headers 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: 76985729102cf137b81ca57b1b0dbe61ee41e66d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 13:48:29 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=76985729102cf137b81ca57b1b0dbe61ee41e66d commit 76985729102cf137b81ca57b1b0dbe61ee41e66d Author: Mark Johnston AuthorDate: 2021-09-14 14:53:15 +0000 Commit: Mark Johnston CommitDate: 2021-09-21 13:37:42 +0000 debugnet: Include some required headers Don't depend on pollution from net/vnet.h. PR: 258496 Sponsored by: The FreeBSD Foundation (cherry picked from commit b1746faad6d690e43ac78ba3a9bca96c767ea729) --- sys/net/debugnet.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/net/debugnet.c b/sys/net/debugnet.c index 8652597c55db..7a2c98ace65d 100644 --- a/sys/net/debugnet.c +++ b/sys/net/debugnet.c @@ -39,6 +39,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include +#include #include #include @@ -53,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include From owner-dev-commits-src-all@freebsd.org Tue Sep 21 13:48:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E162A673AE8; Tue, 21 Sep 2021 13:48:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDN724rmyz4kFj; Tue, 21 Sep 2021 13:48:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 674D6250B5; Tue, 21 Sep 2021 13:48: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 18LDmUus035617; Tue, 21 Sep 2021 13:48:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LDmUrA035616; Tue, 21 Sep 2021 13:48:30 GMT (envelope-from git) Date: Tue, 21 Sep 2021 13:48:30 GMT Message-Id: <202109211348.18LDmUrA035616@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: bcc7e68fcf2c - stable/13 - nd6: Make the DAD callout MPSAFE 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: bcc7e68fcf2c34b5f090f55923adc4debc7cc91d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 13:48:31 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bcc7e68fcf2c34b5f090f55923adc4debc7cc91d commit bcc7e68fcf2c34b5f090f55923adc4debc7cc91d Author: Mark Johnston AuthorDate: 2021-09-07 13:49:47 +0000 Commit: Mark Johnston CommitDate: 2021-09-21 13:37:52 +0000 nd6: Make the DAD callout MPSAFE Interface addresses with pending duplicate address detection (DAD) live in a global queue. In this case, a callout is associated with each entry. The callout transmits neighbour solicitations until the system decides the address is no longer tentative, or until a duplicate address is discovered. At this point the entry is dequeued and freed. DAD may be manually stopped as well. The callout currently runs (and potentially transmits packets) with Giant held. Reorganize DAD queue locking to interlock properly with the callout: - Configure the callout to acquire the DAD queue lock before running. The lock is dropped before transmitting any packets. Stop protecting the callout with Giant. - When looking up DAD queue entries for an incoming NS or NA, don't bother fiddling with the DAD queue entry reference count. - Split nd6_dad_starttimer() so that the caller is responsible to transmitting a NS if it so desires. - Remove the DAD entry from the queue before stopping the timer. Use a temporary reference to make sure that the entry doesn't get freed by the callout while we're draining. Reported by: mav Reviewed by: bz, hrs Sponsored by: The FreeBSD Foundation (cherry picked from commit 9a94097cd0f46aacf688973d15b3b462c79f0008) --- sys/netinet6/nd6_nbr.c | 116 +++++++++++++++++++++++++++---------------------- 1 file changed, 65 insertions(+), 51 deletions(-) diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 30d73f9d71a9..2100700733ad 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -84,9 +84,9 @@ static struct dadq *nd6_dad_find(struct ifaddr *, struct nd_opt_nonce *); static void nd6_dad_add(struct dadq *dp); static void nd6_dad_del(struct dadq *dp); static void nd6_dad_rele(struct dadq *); -static void nd6_dad_starttimer(struct dadq *, int, int); +static void nd6_dad_starttimer(struct dadq *, int); static void nd6_dad_stoptimer(struct dadq *); -static void nd6_dad_timer(struct dadq *); +static void nd6_dad_timer(void *); static void nd6_dad_duplicated(struct ifaddr *, struct dadq *); static void nd6_dad_ns_output(struct dadq *); static void nd6_dad_ns_input(struct ifaddr *, struct nd_opt_nonce *); @@ -1135,26 +1135,31 @@ VNET_DEFINE_STATIC(struct rwlock, dad_rwlock); #define V_dadq VNET(dadq) #define V_dad_rwlock VNET(dad_rwlock) -#define DADQ_RLOCK() rw_rlock(&V_dad_rwlock) -#define DADQ_RUNLOCK() rw_runlock(&V_dad_rwlock) -#define DADQ_WLOCK() rw_wlock(&V_dad_rwlock) -#define DADQ_WUNLOCK() rw_wunlock(&V_dad_rwlock) +#define DADQ_LOCKPTR() (&V_dad_rwlock) +#define DADQ_LOCK_INIT() rw_init(DADQ_LOCKPTR(), "nd6 DAD queue") +#define DADQ_RLOCK() rw_rlock(DADQ_LOCKPTR()) +#define DADQ_RUNLOCK() rw_runlock(DADQ_LOCKPTR()) +#define DADQ_WLOCK() rw_wlock(DADQ_LOCKPTR()) +#define DADQ_WUNLOCK() rw_wunlock(DADQ_LOCKPTR()) + +#define DADQ_LOCK_ASSERT() rw_assert(DADQ_LOCKPTR(), RA_LOCKED); +#define DADQ_RLOCK_ASSERT() rw_assert(DADQ_LOCKPTR(), RA_RLOCKED); +#define DADQ_WLOCK_ASSERT() rw_assert(DADQ_LOCKPTR(), RA_WLOCKED); static void nd6_dad_add(struct dadq *dp) { + DADQ_WLOCK_ASSERT(); - DADQ_WLOCK(); TAILQ_INSERT_TAIL(&V_dadq, dp, dad_list); dp->dad_ondadq = true; - DADQ_WUNLOCK(); } static void nd6_dad_del(struct dadq *dp) { + DADQ_WLOCK_ASSERT(); - DADQ_WLOCK(); if (dp->dad_ondadq) { /* * Remove dp from the dadq and release the dadq's @@ -1162,10 +1167,8 @@ nd6_dad_del(struct dadq *dp) */ TAILQ_REMOVE(&V_dadq, dp, dad_list); dp->dad_ondadq = false; - DADQ_WUNLOCK(); nd6_dad_rele(dp); - } else - DADQ_WUNLOCK(); + } } static struct dadq * @@ -1173,10 +1176,12 @@ nd6_dad_find(struct ifaddr *ifa, struct nd_opt_nonce *n) { struct dadq *dp; - DADQ_RLOCK(); + DADQ_LOCK_ASSERT(); + TAILQ_FOREACH(dp, &V_dadq, dad_list) { if (dp->dad_ifa != ifa) continue; + /* * Skip if the nonce matches the received one. * +2 in the length is required because of type and @@ -1185,42 +1190,35 @@ nd6_dad_find(struct ifaddr *ifa, struct nd_opt_nonce *n) if (n != NULL && n->nd_opt_nonce_len == (ND_OPT_NONCE_LEN + 2) / 8 && memcmp(&n->nd_opt_nonce[0], &dp->dad_nonce[0], - ND_OPT_NONCE_LEN) == 0) { + ND_OPT_NONCE_LEN) == 0) { dp->dad_ns_lcount++; continue; } - refcount_acquire(&dp->dad_refcnt); break; } - DADQ_RUNLOCK(); return (dp); } static void -nd6_dad_starttimer(struct dadq *dp, int ticks, int send_ns) +nd6_dad_starttimer(struct dadq *dp, int ticks) { + DADQ_WLOCK_ASSERT(); - NET_EPOCH_ASSERT(); - - if (send_ns != 0) - nd6_dad_ns_output(dp); - callout_reset(&dp->dad_timer_ch, ticks, - (void (*)(void *))nd6_dad_timer, (void *)dp); + callout_reset(&dp->dad_timer_ch, ticks, nd6_dad_timer, dp); } static void nd6_dad_stoptimer(struct dadq *dp) { - callout_drain(&dp->dad_timer_ch); } static void nd6_dad_rele(struct dadq *dp) { - if (refcount_release(&dp->dad_refcnt)) { + KASSERT(!dp->dad_ondadq, ("dp %p still on DAD queue", dp)); ifa_free(dp->dad_ifa); free(dp, M_IP6NDP); } @@ -1229,8 +1227,7 @@ nd6_dad_rele(struct dadq *dp) void nd6_dad_init(void) { - - rw_init(&V_dad_rwlock, "nd6 DAD queue"); + DADQ_LOCK_INIT(); TAILQ_INIT(&V_dadq); } @@ -1243,7 +1240,6 @@ nd6_dad_start(struct ifaddr *ifa, int delay) struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; struct dadq *dp; char ip6buf[INET6_ADDRSTRLEN]; - struct epoch_tracker et; KASSERT((ia->ia6_flags & IN6_IFF_TENTATIVE) != 0, ("starting DAD on non-tentative address %p", ifa)); @@ -1265,12 +1261,13 @@ nd6_dad_start(struct ifaddr *ifa, int delay) (ND_IFINFO(ifa->ifa_ifp)->flags & ND6_IFF_IFDISABLED) != 0) return; + DADQ_WLOCK(); if ((dp = nd6_dad_find(ifa, NULL)) != NULL) { /* * DAD is already in progress. Let the existing entry * finish it. */ - nd6_dad_rele(dp); + DADQ_WUNLOCK(); return; } @@ -1282,7 +1279,8 @@ nd6_dad_start(struct ifaddr *ifa, int delay) ifa->ifa_ifp ? if_name(ifa->ifa_ifp) : "???"); return; } - callout_init(&dp->dad_timer_ch, 0); + callout_init_rw(&dp->dad_timer_ch, DADQ_LOCKPTR(), + CALLOUT_RETURNUNLOCKED); #ifdef VIMAGE dp->dad_vnet = curvnet; #endif @@ -1305,9 +1303,8 @@ nd6_dad_start(struct ifaddr *ifa, int delay) /* Add this to the dadq and add a reference for the dadq. */ refcount_init(&dp->dad_refcnt, 1); nd6_dad_add(dp); - NET_EPOCH_ENTER(et); - nd6_dad_starttimer(dp, delay, 0); - NET_EPOCH_EXIT(et); + nd6_dad_starttimer(dp, delay); + DADQ_WUNLOCK(); } /* @@ -1318,29 +1315,36 @@ nd6_dad_stop(struct ifaddr *ifa) { struct dadq *dp; + DADQ_WLOCK(); dp = nd6_dad_find(ifa, NULL); - if (!dp) { + if (dp == NULL) { + DADQ_WUNLOCK(); /* DAD wasn't started yet */ return; } - nd6_dad_stoptimer(dp); + /* + * Acquire a temporary reference so that we can safely stop the callout. + */ + (void)refcount_acquire(&dp->dad_refcnt); nd6_dad_del(dp); + DADQ_WUNLOCK(); - /* Release this function's reference, acquired by nd6_dad_find(). */ + nd6_dad_stoptimer(dp); nd6_dad_rele(dp); } static void -nd6_dad_timer(struct dadq *dp) +nd6_dad_timer(void *arg) { - CURVNET_SET(dp->dad_vnet); + struct dadq *dp = arg; struct ifaddr *ifa = dp->dad_ifa; struct ifnet *ifp = dp->dad_ifa->ifa_ifp; struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; char ip6buf[INET6_ADDRSTRLEN]; struct epoch_tracker et; + CURVNET_SET(dp->dad_vnet); KASSERT(ia != NULL, ("DAD entry %p with no address", dp)); NET_EPOCH_ENTER(et); @@ -1381,17 +1385,18 @@ nd6_dad_timer(struct dadq *dp) * We have more NS to go. Send NS packet for DAD. */ nd6_dad_starttimer(dp, - (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000, 1); + (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000); + nd6_dad_ns_output(dp); goto done; } else { /* * We have transmitted sufficient number of DAD packets. * See what we've got. */ - if (dp->dad_ns_icount > 0 || dp->dad_na_icount > 0) + if (dp->dad_ns_icount > 0 || dp->dad_na_icount > 0) { /* We've seen NS or NA, means DAD has failed. */ nd6_dad_duplicated(ifa, dp); - else if (V_dad_enhanced != 0 && + } else if (V_dad_enhanced != 0 && dp->dad_ns_lcount > 0 && dp->dad_ns_lcount > dp->dad_loopbackprobe) { /* @@ -1412,8 +1417,8 @@ nd6_dad_timer(struct dadq *dp) dp->dad_count = dp->dad_ns_ocount + V_nd6_mmaxtries - 1; nd6_dad_starttimer(dp, - (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000, - 1); + (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000); + nd6_dad_ns_output(dp); goto done; } else { /* @@ -1439,6 +1444,7 @@ nd6_dad_timer(struct dadq *dp) } err: nd6_dad_del(dp); + DADQ_WUNLOCK(); done: NET_EPOCH_EXIT(et); CURVNET_RESTORE(); @@ -1498,6 +1504,10 @@ nd6_dad_duplicated(struct ifaddr *ifa, struct dadq *dp) } } +/* + * Transmit a neighbour solicitation for the purpose of DAD. Returns with the + * DAD queue unlocked. + */ static void nd6_dad_ns_output(struct dadq *dp) { @@ -1505,11 +1515,15 @@ nd6_dad_ns_output(struct dadq *dp) struct ifnet *ifp = dp->dad_ifa->ifa_ifp; int i; + DADQ_WLOCK_ASSERT(); + dp->dad_ns_tcount++; if ((ifp->if_flags & IFF_UP) == 0) { + DADQ_WUNLOCK(); return; } if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + DADQ_WUNLOCK(); return; } @@ -1526,6 +1540,7 @@ nd6_dad_ns_output(struct dadq *dp) * should work well in almost all cases. */ } + DADQ_WUNLOCK(); nd6_ns_output(ifp, NULL, NULL, &ia->ia_addr.sin6_addr, (uint8_t *)&dp->dad_nonce[0]); } @@ -1541,12 +1556,11 @@ nd6_dad_ns_input(struct ifaddr *ifa, struct nd_opt_nonce *ndopt_nonce) /* Ignore Nonce option when Enhanced DAD is disabled. */ if (V_dad_enhanced == 0) ndopt_nonce = NULL; + DADQ_RLOCK(); dp = nd6_dad_find(ifa, ndopt_nonce); - if (dp == NULL) - return; - - dp->dad_ns_icount++; - nd6_dad_rele(dp); + if (dp != NULL) + dp->dad_ns_icount++; + DADQ_RUNLOCK(); } static void @@ -1557,9 +1571,9 @@ nd6_dad_na_input(struct ifaddr *ifa) if (ifa == NULL) panic("ifa == NULL in nd6_dad_na_input"); + DADQ_RLOCK(); dp = nd6_dad_find(ifa, NULL); - if (dp != NULL) { + if (dp != NULL) dp->dad_na_icount++; - nd6_dad_rele(dp); - } + DADQ_RUNLOCK(); } From owner-dev-commits-src-all@freebsd.org Tue Sep 21 13:48:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DD3E673AE9; Tue, 21 Sep 2021 13:48: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 4HDN736D0nz4kj6; Tue, 21 Sep 2021 13:48: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 9247F24BEC; Tue, 21 Sep 2021 13:48: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 18LDmVxr035641; Tue, 21 Sep 2021 13:48:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LDmV5u035640; Tue, 21 Sep 2021 13:48:31 GMT (envelope-from git) Date: Tue, 21 Sep 2021 13:48:31 GMT Message-Id: <202109211348.18LDmV5u035640@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: ca85fb7e0bac - stable/13 - swap_pager: Handle large swap_pager_reserve() requests 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: ca85fb7e0bac9ef5f50c79520e3fd8a6e8a26b72 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 13:48:32 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ca85fb7e0bac9ef5f50c79520e3fd8a6e8a26b72 commit ca85fb7e0bac9ef5f50c79520e3fd8a6e8a26b72 Author: Mark Johnston AuthorDate: 2021-09-07 18:03:52 +0000 Commit: Mark Johnston CommitDate: 2021-09-21 13:38:03 +0000 swap_pager: Handle large swap_pager_reserve() requests This interface is used solely by md(4) when the MD_RESERVE flag is specified, as in `mdconfig -a -t swap -s 1G -o reserve`. It pre-allocates swap blocks for the entire object. The number of blocks to be reserved is specified as a vm_size_t, but swp_pager_getswapspace() can allocate at most INT_MAX blocks. vm_size_t also seems like the incorrect type to use here it refers only to the size of the VM object, not the size of a mapping. So: - change the type of "size" in swap_pager_reserve() to vm_pindex_t, and - clamp the requested number of blocks for a single swp_pager_getswapspace() call to INT_MAX. Reported by: syzkaller Reviewed by: dougm, alc, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit 686aa9287c6b3658daa2ca0ef1917f2e70a6c07e) --- sys/vm/swap_pager.c | 8 +++++--- sys/vm/swap_pager.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 63f0d22ed705..6d64ff883966 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -977,15 +978,16 @@ swap_pager_freespace(vm_object_t object, vm_pindex_t start, vm_size_t size) * Returns 0 on success, -1 on failure. */ int -swap_pager_reserve(vm_object_t object, vm_pindex_t start, vm_size_t size) +swap_pager_reserve(vm_object_t object, vm_pindex_t start, vm_pindex_t size) { daddr_t addr, blk, n_free, s_free; - int i, j, n; + vm_pindex_t i, j; + int n; swp_pager_init_freerange(&s_free, &n_free); VM_OBJECT_WLOCK(object); for (i = 0; i < size; i += n) { - n = size - i; + n = MIN(size - i, INT_MAX); blk = swp_pager_getswapspace(&n); if (blk == SWAPBLK_NONE) { swp_pager_meta_free(object, start, i); diff --git a/sys/vm/swap_pager.h b/sys/vm/swap_pager.h index 20ff70acc3d8..6761d4f99ee4 100644 --- a/sys/vm/swap_pager.h +++ b/sys/vm/swap_pager.h @@ -78,7 +78,7 @@ void swap_pager_copy(vm_object_t, vm_object_t, vm_pindex_t, int); vm_pindex_t swap_pager_find_least(vm_object_t object, vm_pindex_t pindex); void swap_pager_swap_init(void); int swap_pager_nswapdev(void); -int swap_pager_reserve(vm_object_t, vm_pindex_t, vm_size_t); +int swap_pager_reserve(vm_object_t, vm_pindex_t, vm_pindex_t); void swap_pager_status(int *total, int *used); u_long swap_pager_swapped_pages(vm_object_t object); void swapoff_all(void); From owner-dev-commits-src-all@freebsd.org Tue Sep 21 13:48:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B35F673D0B; Tue, 21 Sep 2021 13:48: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 4HDN750PKxz4kb1; Tue, 21 Sep 2021 13:48: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 AD70424D6F; Tue, 21 Sep 2021 13:48: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 18LDmWoA035672; Tue, 21 Sep 2021 13:48:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LDmWcH035671; Tue, 21 Sep 2021 13:48:32 GMT (envelope-from git) Date: Tue, 21 Sep 2021 13:48:32 GMT Message-Id: <202109211348.18LDmWcH035671@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: 32f1d05f783d - stable/13 - sctp: Allow blocking on I/O locks even with non-blocking sockets 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: 32f1d05f783de24f97ec56aca454e52c7d1071bf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 13:48:33 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=32f1d05f783de24f97ec56aca454e52c7d1071bf commit 32f1d05f783de24f97ec56aca454e52c7d1071bf Author: Mark Johnston AuthorDate: 2021-09-14 13:02:05 +0000 Commit: Mark Johnston CommitDate: 2021-09-21 13:38:39 +0000 sctp: Allow blocking on I/O locks even with non-blocking sockets There are two flags to request a non-blocking receive on a socket: MSG_NBIO and MSG_DONTWAIT. They are handled a bit differently in that soreceive_generic() and soreceive_stream() will block on the socket I/O lock when MSG_NBIO is set, but not if MSG_DONTWAIT is set. In general, MSG_NBIO seems to mean, "don't block if there is no data to receive" and MSG_DONTWAIT means "don't go to sleep for any reason". SCTP's soreceive implementation did not allow blocking on the I/O lock if either flag is set, but this violates an assumption in aio_process_sb(), which specifies MSG_NBIO but nonetheless expects to make progress if data is available to read. Change sctp_sorecvmsg() to block on the I/O lock only if MSG_DONTWAIT is not set. Reported by: syzbot+c7d22dbbb9aef509421d@syzkaller.appspotmail.com Reviewed by: tuexen Sponsored by: The FreeBSD Foundation (cherry picked from commit e6c19aa94da4a799472f8b82f196ffc42d0dbdaf) --- sys/netinet/sctputil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index ad4409f666df..b01ace4d1fb9 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -5586,7 +5586,7 @@ sctp_sorecvmsg(struct socket *so, rwnd_req, block_allowed, so->so_rcv.sb_cc, (uint32_t)uio->uio_resid); } - error = sblock(&so->so_rcv, (block_allowed ? SBL_WAIT : 0)); + error = sblock(&so->so_rcv, SBLOCKWAIT(in_flags)); if (error) { goto release_unlocked; } From owner-dev-commits-src-all@freebsd.org Tue Sep 21 13:52:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07CD1674124; Tue, 21 Sep 2021 13:52: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 4HDNCm6ldDz4lrG; Tue, 21 Sep 2021 13:52: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 C81D225241; Tue, 21 Sep 2021 13:52: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 18LDqaId048375; Tue, 21 Sep 2021 13:52:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LDqalq048374; Tue, 21 Sep 2021 13:52:36 GMT (envelope-from git) Date: Tue, 21 Sep 2021 13:52:36 GMT Message-Id: <202109211352.18LDqalq048374@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 5a619ca07a2d - main - Fix the arm64 L2_BLOCK_MASK definition MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a619ca07a2d6614b7b4ecbb7078d0949702dcd2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 13:52:37 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=5a619ca07a2d6614b7b4ecbb7078d0949702dcd2 commit 5a619ca07a2d6614b7b4ecbb7078d0949702dcd2 Author: Andrew Turner AuthorDate: 2021-09-21 13:46:10 +0000 Commit: Andrew Turner CommitDate: 2021-09-21 13:47:34 +0000 Fix the arm64 L2_BLOCK_MASK definition It was missing the top 16 bits. Sponsored by: The FreeBSD Foundation --- sys/arm64/include/pte.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/include/pte.h b/sys/arm64/include/pte.h index 5d4412d2c141..b3bec720e9f9 100644 --- a/sys/arm64/include/pte.h +++ b/sys/arm64/include/pte.h @@ -125,7 +125,7 @@ typedef uint64_t pt_entry_t; /* page table entry */ #define L2_BLOCK L1_BLOCK #define L2_TABLE L1_TABLE -#define L2_BLOCK_MASK UINT64_C(0xffffffe00000) +#define L2_BLOCK_MASK UINT64_C(0xffffffffffe00000) /* Level 3 table, 4KiB per entry */ #define L3_SHIFT 12 From owner-dev-commits-src-all@freebsd.org Tue Sep 21 13:53:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB7406743A0; Tue, 21 Sep 2021 13:53: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 4HDNDg4wzZz4llG; Tue, 21 Sep 2021 13:53: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 8954224CE1; Tue, 21 Sep 2021 13:53: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 18LDrNNg048562; Tue, 21 Sep 2021 13:53:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LDrNKW048561; Tue, 21 Sep 2021 13:53:23 GMT (envelope-from git) Date: Tue, 21 Sep 2021 13:53:23 GMT Message-Id: <202109211353.18LDrNKW048561@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Houchard Subject: git: 273405015492 - main - arm64: Handle 32bits breakpoint exception. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2734050154927eaa63d3b65de5d46d05569b3a5b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 13:53:23 -0000 The branch main has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=2734050154927eaa63d3b65de5d46d05569b3a5b commit 2734050154927eaa63d3b65de5d46d05569b3a5b Author: Olivier Houchard AuthorDate: 2021-09-21 13:49:45 +0000 Commit: Olivier Houchard CommitDate: 2021-09-21 13:52:42 +0000 arm64: Handle 32bits breakpoint exception. A different exception is raised when we hit a 32bits breakpoint, rather than a 64bits one, so handle those as well when COMPAT_FREEBSD32 is defined. This should fix SIGBUS at least when using breakpoints with thumb2 code. PR: 256468 MFC After: 1 week --- sys/arm64/arm64/trap.c | 3 +++ sys/arm64/include/armreg.h | 1 + 2 files changed, 4 insertions(+) diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 40bad51e8513..af17a6a2951e 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -555,6 +555,9 @@ do_el0_sync(struct thread *td, struct trapframe *frame) break; case EXCP_BRKPT_EL0: case EXCP_BRK: +#ifdef COMPAT_FREEBSD32 + case EXCP_BRKPT_32: +#endif /* COMPAT_FREEBSD32 */ call_trapsignal(td, SIGTRAP, TRAP_BRKPT, (void *)frame->tf_elr, exception); userret(td, frame); diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index bc6d34cb3c1a..bcbe9d13863d 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -238,6 +238,7 @@ #define EXCP_SOFTSTP_EL1 0x33 /* Software Step, from same EL */ #define EXCP_WATCHPT_EL0 0x34 /* Watchpoint, from lower EL */ #define EXCP_WATCHPT_EL1 0x35 /* Watchpoint, from same EL */ +#define EXCP_BRKPT_32 0x38 /* 32bits breakpoint */ #define EXCP_BRK 0x3c /* Breakpoint */ /* ICC_CTLR_EL1 */ From owner-dev-commits-src-all@freebsd.org Tue Sep 21 14:46:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B1446674C19; Tue, 21 Sep 2021 14:46: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 4HDPPv4bp7z4s9J; Tue, 21 Sep 2021 14:46: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 7E6EF25DA0; Tue, 21 Sep 2021 14:46: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 18LEkR7M015177; Tue, 21 Sep 2021 14:46:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LEkRhm015176; Tue, 21 Sep 2021 14:46:27 GMT (envelope-from git) Date: Tue, 21 Sep 2021 14:46:27 GMT Message-Id: <202109211446.18LEkRhm015176@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Robert Wing Subject: git: 78a7d255e45d - stable/13 - ffs: remove unused thread argument from ffs_reload() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 78a7d255e45dc04a389d4d2cc6697828a18245ae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 14:46:27 -0000 The branch stable/13 has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=78a7d255e45dc04a389d4d2cc6697828a18245ae commit 78a7d255e45dc04a389d4d2cc6697828a18245ae Author: Robert Wing AuthorDate: 2021-09-04 20:25:10 +0000 Commit: Robert Wing CommitDate: 2021-09-21 14:38:38 +0000 ffs: remove unused thread argument from ffs_reload() Reviewed by: imp, kib Differential Revision: https://reviews.freebsd.org/D31127 (cherry picked from commit 440320b620a29fdc4033a2b9b67eb4401cb903bb) --- sys/ufs/ffs/ffs_extern.h | 2 +- sys/ufs/ffs/ffs_suspend.c | 2 +- sys/ufs/ffs/ffs_vfsops.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index 2ea828861b42..c835239986ba 100644 --- a/sys/ufs/ffs/ffs_extern.h +++ b/sys/ufs/ffs/ffs_extern.h @@ -89,7 +89,7 @@ int ffs_own_mount(const struct mount *mp); int ffs_reallocblks(struct vop_reallocblks_args *); int ffs_realloccg(struct inode *, ufs2_daddr_t, ufs2_daddr_t, ufs2_daddr_t, int, int, int, struct ucred *, struct buf **); -int ffs_reload(struct mount *, struct thread *, int); +int ffs_reload(struct mount *, int); int ffs_sbget(void *, struct fs **, off_t, struct malloc_type *, int (*)(void *, off_t, void **, int)); int ffs_sbput(void *, struct fs *, off_t, int (*)(void *, off_t, void *, diff --git a/sys/ufs/ffs/ffs_suspend.c b/sys/ufs/ffs/ffs_suspend.c index a7fef099cd70..d13097109758 100644 --- a/sys/ufs/ffs/ffs_suspend.c +++ b/sys/ufs/ffs/ffs_suspend.c @@ -265,7 +265,7 @@ ffs_susp_dtor(void *data) KASSERT((mp->mnt_kern_flag & MNTK_SUSPEND) != 0, ("MNTK_SUSPEND not set")); - error = ffs_reload(mp, curthread, FFSR_FORCE | FFSR_UNSUSPEND); + error = ffs_reload(mp, FFSR_FORCE | FFSR_UNSUSPEND); if (error != 0) panic("failed to unsuspend writes on %s", fs->fs_fsmnt); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 047c6f58a8a9..d5f20690793d 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -565,7 +565,7 @@ ffs_mount(struct mount *mp) vfs_write_resume(mp, 0); } if ((mp->mnt_flag & MNT_RELOAD) && - (error = ffs_reload(mp, td, 0)) != 0) + (error = ffs_reload(mp, 0)) != 0) return (error); if (fs->fs_ronly && !vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) { @@ -876,7 +876,7 @@ ffs_cmount(struct mntarg *ma, void *data, uint64_t flags) * 7) re-read inode data for all active vnodes. */ int -ffs_reload(struct mount *mp, struct thread *td, int flags) +ffs_reload(struct mount *mp, int flags) { struct vnode *vp, *mvp, *devvp; struct inode *ip; From owner-dev-commits-src-all@freebsd.org Tue Sep 21 16:02:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B46256761A9; Tue, 21 Sep 2021 16:02: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 4HDR6C4b00z3GNk; Tue, 21 Sep 2021 16:02: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 7D2AB26EA0; Tue, 21 Sep 2021 16:02: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 18LG2xaP022239; Tue, 21 Sep 2021 16:02:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LG2xtt022238; Tue, 21 Sep 2021 16:02:59 GMT (envelope-from git) Date: Tue, 21 Sep 2021 16:02:59 GMT Message-Id: <202109211602.18LG2xtt022238@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 762ae0ec8d83 - main - sctp: Simplify stream scheduler usage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 762ae0ec8d83ed0e3c084e19174b4bd809a7ef2d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 16:02:59 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=762ae0ec8d83ed0e3c084e19174b4bd809a7ef2d commit 762ae0ec8d83ed0e3c084e19174b4bd809a7ef2d Author: Michael Tuexen AuthorDate: 2021-09-21 15:13:57 +0000 Commit: Michael Tuexen CommitDate: 2021-09-21 15:13:57 +0000 sctp: Simplify stream scheduler usage Callers are getting the stcb send lock, so just KASSERT that. No need to signal this when calling stream scheduler functions. No functional change intended. MFC after: 1 week --- sys/netinet/sctp_input.c | 4 +- sys/netinet/sctp_lock_bsd.h | 5 ++ sys/netinet/sctp_output.c | 12 +-- sys/netinet/sctp_pcb.c | 2 +- sys/netinet/sctp_ss_functions.c | 171 ++++++++++++---------------------------- sys/netinet/sctp_structs.h | 9 +-- sys/netinet/sctp_timer.c | 2 +- sys/netinet/sctp_usrreq.c | 8 +- sys/netinet/sctputil.c | 4 +- 9 files changed, 76 insertions(+), 141 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index e2cd2cf87ac9..c0a976b84184 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -213,7 +213,7 @@ sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked) } atomic_subtract_int(&stcb->asoc.stream_queue_cnt, 1); TAILQ_REMOVE(&stcb->asoc.strmout[i].outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, &asoc->strmout[i], sp, 1); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, &asoc->strmout[i], sp); if (sp->net) { sctp_free_remote_addr(sp->net); sp->net = NULL; @@ -302,7 +302,7 @@ sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb) TAILQ_FOREACH_SAFE(sp, &outs->outqueue, next, nsp) { atomic_subtract_int(&stcb->asoc.stream_queue_cnt, 1); TAILQ_REMOVE(&outs->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp, 1); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp); sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb, 0, sp, SCTP_SO_NOT_LOCKED); if (sp->data) { diff --git a/sys/netinet/sctp_lock_bsd.h b/sys/netinet/sctp_lock_bsd.h index e7cf8b3221b9..cd20a730e5b8 100644 --- a/sys/netinet/sctp_lock_bsd.h +++ b/sys/netinet/sctp_lock_bsd.h @@ -354,6 +354,11 @@ __FBSDID("$FreeBSD$"); mtx_unlock(&(_tcb)->tcb_send_mtx); \ } while (0) +#define SCTP_TCB_SEND_LOCK_ASSERT(_tcb) do { \ + KASSERT(mtx_owned(&(_tcb)->tcb_send_mtx), \ + ("Don't own TCB send lock")); \ +} while (0) + /* * For the majority of things (once we have found the association) we will * lock the actual association mutex. This will protect all the assoiciation diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 27ad92527454..36339ac0f2b1 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -6399,7 +6399,7 @@ sctp_msg_append(struct sctp_tcb *stcb, sctp_snd_sb_alloc(stcb, sp->length); atomic_add_int(&stcb->asoc.stream_queue_cnt, 1); TAILQ_INSERT_TAIL(&strm->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, &stcb->asoc, strm, sp, 1); + stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, &stcb->asoc, strm, sp); m = NULL; if (hold_stcb_lock == 0) { SCTP_TCB_SEND_UNLOCK(stcb); @@ -7213,7 +7213,7 @@ one_more_time: } atomic_subtract_int(&asoc->stream_queue_cnt, 1); TAILQ_REMOVE(&strq->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp, 1); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp); if ((strq->state == SCTP_STREAM_RESET_PENDING) && (strq->chunks_on_queues == 0) && TAILQ_EMPTY(&strq->outqueue)) { @@ -7644,7 +7644,7 @@ dont_do_it: } atomic_subtract_int(&asoc->stream_queue_cnt, 1); TAILQ_REMOVE(&strq->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp, 1); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp); if ((strq->state == SCTP_STREAM_RESET_PENDING) && (strq->chunks_on_queues == 0) && TAILQ_EMPTY(&strq->outqueue)) { @@ -12176,7 +12176,7 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb, * initializing the new stuff. */ SCTP_TCB_SEND_LOCK(stcb); - stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 0, 1); + stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 0); for (i = 0; i < stcb->asoc.streamoutcnt; i++) { TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); /* FIX ME FIX ME */ @@ -12207,7 +12207,7 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb, } } /* now the new streams */ - stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1); + stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc); for (i = stcb->asoc.streamoutcnt; i < (stcb->asoc.streamoutcnt + adding_o); i++) { TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); stcb->asoc.strmout[i].chunks_on_queues = 0; @@ -13161,7 +13161,7 @@ skip_preblock: } sp->processing = 1; TAILQ_INSERT_TAIL(&strm->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, asoc, strm, sp, 1); + stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, asoc, strm, sp); } else { sp = TAILQ_LAST(&strm->outqueue, sctp_streamhead); if (sp == NULL) { diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index fabe19c1444d..563a167b782f 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -4923,7 +4923,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre TAILQ_FOREACH_SAFE(sp, &outs->outqueue, next, nsp) { atomic_subtract_int(&asoc->stream_queue_cnt, 1); TAILQ_REMOVE(&outs->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp, 1); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp); sctp_free_spbufspace(stcb, asoc, sp); if (sp->data) { if (so) { diff --git a/sys/netinet/sctp_ss_functions.c b/sys/netinet/sctp_ss_functions.c index 0a5a788428bc..9d877568bcf1 100644 --- a/sys/netinet/sctp_ss_functions.c +++ b/sys/netinet/sctp_ss_functions.c @@ -41,22 +41,19 @@ __FBSDID("$FreeBSD$"); static void sctp_ss_default_add(struct sctp_tcb *, struct sctp_association *, struct sctp_stream_out *, - struct sctp_stream_queue_pending *, int); + struct sctp_stream_queue_pending *); static void sctp_ss_default_remove(struct sctp_tcb *, struct sctp_association *, struct sctp_stream_out *, - struct sctp_stream_queue_pending *, int); + struct sctp_stream_queue_pending *); static void -sctp_ss_default_init(struct sctp_tcb *stcb, struct sctp_association *asoc, - int holds_lock) +sctp_ss_default_init(struct sctp_tcb *stcb, struct sctp_association *asoc) { uint16_t i; - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); asoc->ss_data.locked_on_sending = NULL; asoc->ss_data.last_out_stream = NULL; TAILQ_INIT(&asoc->ss_data.out.wheel); @@ -68,21 +65,17 @@ sctp_ss_default_init(struct sctp_tcb *stcb, struct sctp_association *asoc, for (i = 0; i < stcb->asoc.streamoutcnt; i++) { stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, &stcb->asoc, &stcb->asoc.strmout[i], - NULL, 1); - } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); + NULL); } return; } static void sctp_ss_default_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values SCTP_UNUSED, int holds_lock) + int clear_values SCTP_UNUSED) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + while (!TAILQ_EMPTY(&asoc->ss_data.out.wheel)) { struct sctp_stream_out *strq; @@ -92,9 +85,6 @@ sctp_ss_default_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, strq->ss_params.rr.next_spoke.tqe_prev = NULL; } asoc->ss_data.last_out_stream = NULL; - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -117,11 +107,10 @@ sctp_ss_default_init_stream(struct sctp_tcb *stcb, struct sctp_stream_out *strq, static void sctp_ss_default_add(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq, - struct sctp_stream_queue_pending *sp SCTP_UNUSED, int holds_lock) + struct sctp_stream_queue_pending *sp SCTP_UNUSED) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + /* Add to wheel if not already on it and stream queue not empty */ if (!TAILQ_EMPTY(&strq->outqueue) && (strq->ss_params.rr.next_spoke.tqe_next == NULL) && @@ -129,9 +118,6 @@ sctp_ss_default_add(struct sctp_tcb *stcb, struct sctp_association *asoc, TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, strq, ss_params.rr.next_spoke); } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -148,11 +134,10 @@ sctp_ss_default_is_empty(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_associat static void sctp_ss_default_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq, - struct sctp_stream_queue_pending *sp SCTP_UNUSED, int holds_lock) + struct sctp_stream_queue_pending *sp SCTP_UNUSED) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + /* * Remove from wheel if stream queue is empty and actually is on the * wheel @@ -176,9 +161,6 @@ sctp_ss_default_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, strq->ss_params.rr.next_spoke.tqe_next = NULL; strq->ss_params.rr.next_spoke.tqe_prev = NULL; } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -302,13 +284,12 @@ sctp_ss_default_is_user_msgs_incomplete(struct sctp_tcb *stcb SCTP_UNUSED, struc static void sctp_ss_rr_add(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq, - struct sctp_stream_queue_pending *sp SCTP_UNUSED, int holds_lock) + struct sctp_stream_queue_pending *sp SCTP_UNUSED) { struct sctp_stream_out *strqt; - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + if (!TAILQ_EMPTY(&strq->outqueue) && (strq->ss_params.rr.next_spoke.tqe_next == NULL) && (strq->ss_params.rr.next_spoke.tqe_prev == NULL)) { @@ -326,9 +307,6 @@ sctp_ss_rr_add(struct sctp_tcb *stcb, struct sctp_association *asoc, } } } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -394,11 +372,10 @@ rrp_again: */ static void sctp_ss_prio_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values, int holds_lock) + int clear_values) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + while (!TAILQ_EMPTY(&asoc->ss_data.out.wheel)) { struct sctp_stream_out *strq; @@ -411,9 +388,6 @@ sctp_ss_prio_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, strq->ss_params.prio.next_spoke.tqe_prev = NULL; } asoc->ss_data.last_out_stream = NULL; - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -440,14 +414,12 @@ sctp_ss_prio_init_stream(struct sctp_tcb *stcb, struct sctp_stream_out *strq, st static void sctp_ss_prio_add(struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp SCTP_UNUSED, - int holds_lock) + struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp SCTP_UNUSED) { struct sctp_stream_out *strqt; - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + /* Add to wheel if not already on it and stream queue not empty */ if (!TAILQ_EMPTY(&strq->outqueue) && (strq->ss_params.prio.next_spoke.tqe_next == NULL) && @@ -466,20 +438,15 @@ sctp_ss_prio_add(struct sctp_tcb *stcb, struct sctp_association *asoc, } } } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } static void sctp_ss_prio_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp SCTP_UNUSED, - int holds_lock) + struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp SCTP_UNUSED) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + /* * Remove from wheel if stream queue is empty and actually is on the * wheel @@ -502,9 +469,6 @@ sctp_ss_prio_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, strq->ss_params.prio.next_spoke.tqe_next = NULL; strq->ss_params.prio.next_spoke.tqe_prev = NULL; } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -576,8 +540,8 @@ sctp_ss_prio_set_value(struct sctp_tcb *stcb, struct sctp_association *asoc, return (-1); } strq->ss_params.prio.priority = value; - sctp_ss_prio_remove(stcb, asoc, strq, NULL, 1); - sctp_ss_prio_add(stcb, asoc, strq, NULL, 1); + sctp_ss_prio_remove(stcb, asoc, strq, NULL); + sctp_ss_prio_add(stcb, asoc, strq, NULL); return (1); } @@ -587,11 +551,10 @@ sctp_ss_prio_set_value(struct sctp_tcb *stcb, struct sctp_association *asoc, */ static void sctp_ss_fb_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values, int holds_lock) + int clear_values) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + while (!TAILQ_EMPTY(&asoc->ss_data.out.wheel)) { struct sctp_stream_out *strq; @@ -604,9 +567,6 @@ sctp_ss_fb_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, strq->ss_params.fb.next_spoke.tqe_prev = NULL; } asoc->ss_data.last_out_stream = NULL; - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -633,12 +593,10 @@ sctp_ss_fb_init_stream(struct sctp_tcb *stcb, struct sctp_stream_out *strq, stru static void sctp_ss_fb_add(struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp SCTP_UNUSED, - int holds_lock) + struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp SCTP_UNUSED) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + if (!TAILQ_EMPTY(&strq->outqueue) && (strq->ss_params.fb.next_spoke.tqe_next == NULL) && (strq->ss_params.fb.next_spoke.tqe_prev == NULL)) { @@ -646,20 +604,15 @@ sctp_ss_fb_add(struct sctp_tcb *stcb, struct sctp_association *asoc, strq->ss_params.fb.rounds = TAILQ_FIRST(&strq->outqueue)->length; TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, strq, ss_params.fb.next_spoke); } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } static void sctp_ss_fb_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp SCTP_UNUSED, - int holds_lock) + struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp SCTP_UNUSED) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + /* * Remove from wheel if stream queue is empty and actually is on the * wheel @@ -682,9 +635,6 @@ sctp_ss_fb_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, strq->ss_params.fb.next_spoke.tqe_next = NULL; strq->ss_params.fb.next_spoke.tqe_prev = NULL; } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -765,19 +715,17 @@ sctp_ss_fb_scheduled(struct sctp_tcb *stcb, struct sctp_nets *net SCTP_UNUSED, static void sctp_ss_fcfs_add(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq SCTP_UNUSED, - struct sctp_stream_queue_pending *sp, int holds_lock); + struct sctp_stream_queue_pending *sp); static void -sctp_ss_fcfs_init(struct sctp_tcb *stcb, struct sctp_association *asoc, - int holds_lock) +sctp_ss_fcfs_init(struct sctp_tcb *stcb, struct sctp_association *asoc) { uint32_t x, n = 0, add_more = 1; struct sctp_stream_queue_pending *sp; uint16_t i; - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + TAILQ_INIT(&asoc->ss_data.out.list); /* * If there is data in the stream queues already, the scheduler of @@ -795,27 +743,23 @@ sctp_ss_fcfs_init(struct sctp_tcb *stcb, struct sctp_association *asoc, x++; } if (sp != NULL) { - sctp_ss_fcfs_add(stcb, &stcb->asoc, &stcb->asoc.strmout[i], sp, 1); + sctp_ss_fcfs_add(stcb, &stcb->asoc, &stcb->asoc.strmout[i], sp); add_more = 1; } } n++; } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } static void sctp_ss_fcfs_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values SCTP_UNUSED, int holds_lock) + int clear_values SCTP_UNUSED) { struct sctp_stream_queue_pending *sp; - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + while (!TAILQ_EMPTY(&asoc->ss_data.out.list)) { sp = TAILQ_FIRST(&asoc->ss_data.out.list); TAILQ_REMOVE(&asoc->ss_data.out.list, sp, ss_next); @@ -823,9 +767,6 @@ sctp_ss_fcfs_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, sp->ss_next.tqe_prev = NULL; } asoc->ss_data.last_out_stream = NULL; - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -847,19 +788,14 @@ sctp_ss_fcfs_init_stream(struct sctp_tcb *stcb, struct sctp_stream_out *strq, st static void sctp_ss_fcfs_add(struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_out *strq SCTP_UNUSED, struct sctp_stream_queue_pending *sp, - int holds_lock) + struct sctp_stream_out *strq SCTP_UNUSED, struct sctp_stream_queue_pending *sp) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + if (sp && (sp->ss_next.tqe_next == NULL) && (sp->ss_next.tqe_prev == NULL)) { TAILQ_INSERT_TAIL(&asoc->ss_data.out.list, sp, ss_next); } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -875,12 +811,10 @@ sctp_ss_fcfs_is_empty(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_association static void sctp_ss_fcfs_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_out *strq SCTP_UNUSED, struct sctp_stream_queue_pending *sp, - int holds_lock) + struct sctp_stream_out *strq SCTP_UNUSED, struct sctp_stream_queue_pending *sp) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + if (sp && ((sp->ss_next.tqe_next != NULL) || (sp->ss_next.tqe_prev != NULL))) { @@ -888,9 +822,6 @@ sctp_ss_fcfs_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, sp->ss_next.tqe_next = NULL; sp->ss_next.tqe_prev = NULL; } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } diff --git a/sys/netinet/sctp_structs.h b/sys/netinet/sctp_structs.h index a22dac047971..2f0ae4c45b24 100644 --- a/sys/netinet/sctp_structs.h +++ b/sys/netinet/sctp_structs.h @@ -729,16 +729,15 @@ struct sctp_cc_functions { * for stream scheduling. */ struct sctp_ss_functions { - void (*sctp_ss_init) (struct sctp_tcb *stcb, struct sctp_association *asoc, - int holds_lock); + void (*sctp_ss_init) (struct sctp_tcb *stcb, struct sctp_association *asoc); void (*sctp_ss_clear) (struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values, int holds_lock); + int clear_values); void (*sctp_ss_init_stream) (struct sctp_tcb *stcb, struct sctp_stream_out *strq, struct sctp_stream_out *with_strq); void (*sctp_ss_add_to_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp, int holds_lock); + struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp); int (*sctp_ss_is_empty) (struct sctp_tcb *stcb, struct sctp_association *asoc); void (*sctp_ss_remove_from_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp, int holds_lock); + struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp); struct sctp_stream_out *(*sctp_ss_select_stream) (struct sctp_tcb *stcb, struct sctp_nets *net, struct sctp_association *asoc); void (*sctp_ss_scheduled) (struct sctp_tcb *stcb, struct sctp_nets *net, diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c index 72a0a2c32c88..c994b90b8353 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -1364,7 +1364,7 @@ sctp_audit_stream_queues_for_size(struct sctp_inpcb *inp, struct sctp_tcb *stcb) } if (stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, &stcb->asoc)) { /* No stream scheduler information, initialize scheduler */ - stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1); + stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc); if (!stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, &stcb->asoc)) { /* yep, we lost a stream or two */ SCTP_PRINTF("Found additional streams NOT managed by scheduler, corrected\n"); diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 690cdf3a3978..65037f0734ea 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -4043,10 +4043,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, SCTP_FIND_STCB(inp, stcb, av->assoc_id); if (stcb) { SCTP_TCB_SEND_LOCK(stcb); - stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 1, 1); + stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 1); stcb->asoc.ss_functions = sctp_ss_functions[av->assoc_value]; stcb->asoc.stream_scheduling_module = av->assoc_value; - stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1); + stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc); SCTP_TCB_SEND_UNLOCK(stcb); SCTP_TCB_UNLOCK(stcb); } else { @@ -4066,10 +4066,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { SCTP_TCB_LOCK(stcb); SCTP_TCB_SEND_LOCK(stcb); - stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 1, 1); + stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 1); stcb->asoc.ss_functions = sctp_ss_functions[av->assoc_value]; stcb->asoc.stream_scheduling_module = av->assoc_value; - stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1); + stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc); SCTP_TCB_SEND_UNLOCK(stcb); SCTP_TCB_UNLOCK(stcb); } diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index a7eb50716cc9..cff22394dda3 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1316,7 +1316,7 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, asoc->strmout[i].last_msg_incomplete = 0; asoc->strmout[i].state = SCTP_STREAM_OPENING; } - asoc->ss_functions.sctp_ss_init(stcb, asoc, 1); + asoc->ss_functions.sctp_ss_init(stcb, asoc); SCTP_TCB_SEND_UNLOCK(stcb); /* Now the mapping array */ @@ -4325,7 +4325,7 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int so_locked) TAILQ_FOREACH_SAFE(sp, &outs->outqueue, next, nsp) { atomic_subtract_int(&asoc->stream_queue_cnt, 1); TAILQ_REMOVE(&outs->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp, 1); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp); sctp_free_spbufspace(stcb, asoc, sp); if (sp->data) { sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb, From owner-dev-commits-src-all@freebsd.org Tue Sep 21 16:09:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 932EA675D51; Tue, 21 Sep 2021 16:09: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 4HDRFW3Z1rz3H85; Tue, 21 Sep 2021 16:09: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 56B0726E19; Tue, 21 Sep 2021 16:09: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 18LG9JCX022761; Tue, 21 Sep 2021 16:09:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LG9JwO022760; Tue, 21 Sep 2021 16:09:19 GMT (envelope-from git) Date: Tue, 21 Sep 2021 16:09:19 GMT Message-Id: <202109211609.18LG9JwO022760@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 867814012729 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 8678140127296c15894094087b81f71fe79a21d9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 16:09:19 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8678140127296c15894094087b81f71fe79a21d9 commit 8678140127296c15894094087b81f71fe79a21d9 Author: Felix Guest AuthorDate: 2021-09-21 15:29:39 +0000 Commit: Mark Johnston CommitDate: 2021-09-21 16:07:39 +0000 syslog.conf.5: Fix the message priority order PR: 219942 MFC after: 1 week --- usr.sbin/syslogd/syslog.conf.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/syslogd/syslog.conf.5 b/usr.sbin/syslogd/syslog.conf.5 index 48f5c88048cb..7afd6b94cdf7 100644 --- a/usr.sbin/syslogd/syslog.conf.5 +++ b/usr.sbin/syslogd/syslog.conf.5 @@ -144,7 +144,7 @@ The .Em level describes the severity of the message, and is a keyword from the following ordered list (higher to lower): -.Cm emerg , crit , alert , err , warning , notice , info +.Cm emerg , alert , crit , err , warning , notice , info and .Cm debug . These keywords correspond to From owner-dev-commits-src-all@freebsd.org Tue Sep 21 16:09:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA7BE675D53; Tue, 21 Sep 2021 16:09: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 4HDRFX491cz3GyB; Tue, 21 Sep 2021 16:09: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 705BE26CA8; Tue, 21 Sep 2021 16:09: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 18LG9KK7022792; Tue, 21 Sep 2021 16:09:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LG9K4P022791; Tue, 21 Sep 2021 16:09:20 GMT (envelope-from git) Date: Tue, 21 Sep 2021 16:09:20 GMT Message-Id: <202109211609.18LG9K4P022791@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: dfd3bde5775e - main - bitset(9): Introduce BIT_FOREACH_ISSET and BIT_FOREACH_ISCLR MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dfd3bde5775ecf88851d5dffd6a8ed6076b53566 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 16:09:20 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=dfd3bde5775ecf88851d5dffd6a8ed6076b53566 commit dfd3bde5775ecf88851d5dffd6a8ed6076b53566 Author: Mark Johnston AuthorDate: 2021-09-21 15:32:23 +0000 Commit: Mark Johnston CommitDate: 2021-09-21 16:07:39 +0000 bitset(9): Introduce BIT_FOREACH_ISSET and BIT_FOREACH_ISCLR These allow one to non-destructively iterate over the set or clear bits in a bitset. The motivation is that we have several code fragments which iterate over a CPU set like this: while ((cpu = CPU_FFS(&cpus)) != 0) { cpu--; CPU_CLR(cpu, &cpus); ; } This is slow since CPU_FFS begins the search at the beginning of the bitset each time. On amd64 and arm64, CPU sets have size 256, so there are four limbs in the bitset and we do a lot of unnecessary scanning. A second problem is that this is destructive, so code which needs to preserve the original set has to make a copy. In particular, we have quite a few functions which take a cpuset_t parameter by value, meaning that each call has to copy the 32 byte cpuset_t. The new macros address both problems. Reviewed by: cem, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32028 --- share/man/man9/Makefile | 2 ++ share/man/man9/bitset.9 | 34 ++++++++++++++++++++++++++++++++-- sys/sys/bitset.h | 10 ++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 30632e0a6cb6..49601b9b7f48 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -623,6 +623,8 @@ MLINKS+=bitset.9 BITSET_DEFINE.9 \ bitset.9 BIT_FFS.9 \ bitset.9 BIT_FFS_AT.9 \ bitset.9 BIT_FLS.9 \ + bitset.9 BIT_FOREACH_ISSET.9 \ + bitset.9 BIT_FOREACH_ISCLR.9 \ bitset.9 BIT_COUNT.9 \ bitset.9 BIT_SUBSET.9 \ bitset.9 BIT_OVERLAP.9 \ diff --git a/share/man/man9/bitset.9 b/share/man/man9/bitset.9 index 1e080f515788..5788f09f2465 100644 --- a/share/man/man9/bitset.9 +++ b/share/man/man9/bitset.9 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 31, 2020 +.Dd September 20, 2021 .Dt BITSET 9 .Os .Sh NAME @@ -45,6 +45,8 @@ .Nm BIT_FFS , .Nm BIT_FFS_AT , .Nm BIT_FLS , +.Nm BIT_FOREACH_ISSET , +.Nm BIT_FOREACH_ISCLR , .Nm BIT_COUNT , .Nm BIT_SUBSET , .Nm BIT_OVERLAP , @@ -92,9 +94,18 @@ .Fn BIT_FFS_AT "const SETSIZE" "struct STRUCTNAME *bitset" "long start" .Ft long .Fn BIT_FLS "const SETSIZE" "struct STRUCTNAME *bitset" +.Fo BIT_FOREACH_ISSET +.Fa "const SETSIZE" +.Fa "size_t bit" +.Fa "const struct STRUCTNAME *bitset" +.Fc +.Fo BIT_FOREACH_ISCLR +.Fa "const SETSIZE" +.Fa "size_t bit" +.Fa "const struct STRUCTNAME *bitset" +.Fc .Ft long .Fn BIT_COUNT "const SETSIZE" "struct STRUCTNAME *bitset" -.\" .Ft bool .Fo BIT_SUBSET .Fa "const SETSIZE" "struct STRUCTNAME *haystack" "struct STRUCTNAME *needle" @@ -329,6 +340,25 @@ index parameter to any other macro, you must subtract one from the result. .Pp The +.Fn BIT_FOREACH_ISSET +macro can be used to iterate over all set bits in +.Fa bitset . +The index variable +.Fa bit +must have been declared with type +.Ft int , +and upon each iteration +.Fa bit +is set to the index of successive set bits. +The value of +.Fa bit +after the loop terminates is undefined. +Similarly, +.Fn BIT_FOREACH_ISCLR +iterates over all clear bits in +.Fa bitset . +.Pp +The .Fn BIT_COUNT macro returns the total number of set bits in .Fa bitset . diff --git a/sys/sys/bitset.h b/sys/sys/bitset.h index 2b5df78a8193..ab6eaf85b8df 100644 --- a/sys/sys/bitset.h +++ b/sys/sys/bitset.h @@ -271,6 +271,16 @@ __count; \ }) +/* Non-destructively loop over all set or clear bits in the set. */ +#define _BIT_FOREACH(_s, i, p, op) \ + for (__size_t __i = 0; __i < __bitset_words(_s); __i++) \ + for (long __j = op((p)->__bits[__i]), __b = ffsl(__j); \ + (i = (__b - 1) + __i * _BITSET_BITS), __j != 0; \ + __j &= ~(1l << i), __b = ffsl(__j)) + +#define BIT_FOREACH_ISSET(_s, i, p) _BIT_FOREACH(_s, i, p, ) +#define BIT_FOREACH_ISCLR(_s, i, p) _BIT_FOREACH(_s, i, p, ~) + #define BITSET_T_INITIALIZER(x) \ { .__bits = { x } } From owner-dev-commits-src-all@freebsd.org Tue Sep 21 16:09:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 076AF676306; Tue, 21 Sep 2021 16:09: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 4HDRFY5hCkz3H4R; Tue, 21 Sep 2021 16:09: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 94DE026EA2; Tue, 21 Sep 2021 16:09: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 18LG9LJB022816; Tue, 21 Sep 2021 16:09:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LG9L1h022815; Tue, 21 Sep 2021 16:09:21 GMT (envelope-from git) Date: Tue, 21 Sep 2021 16:09:21 GMT Message-Id: <202109211609.18LG9L1h022815@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 9068f6ea697b - main - cpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use it MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9068f6ea697b1b28ad1326a4c7a9ba86f08b985e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 16:09:22 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9068f6ea697b1b28ad1326a4c7a9ba86f08b985e commit 9068f6ea697b1b28ad1326a4c7a9ba86f08b985e Author: Mark Johnston AuthorDate: 2021-09-21 15:36:55 +0000 Commit: Mark Johnston CommitDate: 2021-09-21 16:07:47 +0000 cpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use it This implementation is faster and doesn't modify the cpuset, so it lets us avoid some unnecessary copying as well. No functional change intended. Reviewed by: cem, kib, jhb MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32029 --- sys/amd64/amd64/mp_machdep.c | 11 +++-------- sys/amd64/vmm/io/vlapic.c | 13 +++---------- sys/amd64/vmm/vmm_lapic.c | 4 +--- sys/i386/i386/mp_machdep.c | 4 +--- sys/sys/cpuset.h | 2 ++ sys/x86/x86/mp_x86.c | 4 +--- 6 files changed, 11 insertions(+), 27 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 6c66bd622855..16ec277e9c34 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -618,7 +618,7 @@ static void smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1, vm_offset_t addr2, smp_invl_cb_t curcpu_cb, enum invl_op_codes op) { - cpuset_t other_cpus, mask1; + cpuset_t other_cpus; uint32_t generation, *p_cpudone; int cpu; bool is_all; @@ -662,10 +662,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1, /* Fence between filling smp_tlb fields and clearing scoreboard. */ atomic_thread_fence_rel(); - mask1 = mask; - while ((cpu = CPU_FFS(&mask1)) != 0) { - cpu--; - CPU_CLR(cpu, &mask1); + CPU_FOREACH_ISSET(cpu, &mask) { KASSERT(*invl_scoreboard_slot(cpu) != 0, ("IPI scoreboard is zero, initiator %d target %d", PCPU_GET(cpuid), cpu)); @@ -686,9 +683,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1, ipi_selected(mask, IPI_INVLOP); } curcpu_cb(pmap, addr1, addr2); - while ((cpu = CPU_FFS(&other_cpus)) != 0) { - cpu--; - CPU_CLR(cpu, &other_cpus); + CPU_FOREACH_ISSET(cpu, &other_cpus) { p_cpudone = invl_scoreboard_slot(cpu); while (atomic_load_int(p_cpudone) != generation) ia32_pause(); diff --git a/sys/amd64/vmm/io/vlapic.c b/sys/amd64/vmm/io/vlapic.c index 06df1c1a87e5..4e7ddbafd447 100644 --- a/sys/amd64/vmm/io/vlapic.c +++ b/sys/amd64/vmm/io/vlapic.c @@ -860,10 +860,7 @@ vlapic_calcdest(struct vm *vm, cpuset_t *dmask, uint32_t dest, bool phys, */ CPU_ZERO(dmask); amask = vm_active_cpus(vm); - while ((vcpuid = CPU_FFS(&amask)) != 0) { - vcpuid--; - CPU_CLR(vcpuid, &amask); - + CPU_FOREACH_ISSET(vcpuid, &amask) { vlapic = vm_lapic(vm, vcpuid); dfr = vlapic->apic_page->dfr; ldr = vlapic->apic_page->ldr; @@ -1003,9 +1000,7 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool *retu) break; } - while ((i = CPU_FFS(&dmask)) != 0) { - i--; - CPU_CLR(i, &dmask); + CPU_FOREACH_ISSET(i, &dmask) { if (mode == APIC_DELMODE_FIXED) { lapic_intr_edge(vlapic->vm, i, vec); vmm_stat_array_incr(vlapic->vm, vlapic->vcpuid, @@ -1554,9 +1549,7 @@ vlapic_deliver_intr(struct vm *vm, bool level, uint32_t dest, bool phys, */ vlapic_calcdest(vm, &dmask, dest, phys, lowprio, false); - while ((vcpuid = CPU_FFS(&dmask)) != 0) { - vcpuid--; - CPU_CLR(vcpuid, &dmask); + CPU_FOREACH_ISSET(vcpuid, &dmask) { if (delmode == IOART_DELEXINT) { vm_inject_extint(vm, vcpuid); } else { diff --git a/sys/amd64/vmm/vmm_lapic.c b/sys/amd64/vmm/vmm_lapic.c index 89a1ebc8eff9..8191da758100 100644 --- a/sys/amd64/vmm/vmm_lapic.c +++ b/sys/amd64/vmm/vmm_lapic.c @@ -87,9 +87,7 @@ lapic_set_local_intr(struct vm *vm, int cpu, int vector) else CPU_SETOF(cpu, &dmask); error = 0; - while ((cpu = CPU_FFS(&dmask)) != 0) { - cpu--; - CPU_CLR(cpu, &dmask); + CPU_FOREACH_ISSET(cpu, &dmask) { vlapic = vm_lapic(vm, cpu); error = vlapic_trigger_lvt(vlapic, vector); if (error) diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index 156702118c45..777aefa021b3 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -598,9 +598,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector, pmap_t pmap, ipi_selected(mask, vector); } curcpu_cb(pmap, addr1, addr2); - while ((cpu = CPU_FFS(&other_cpus)) != 0) { - cpu--; - CPU_CLR(cpu, &other_cpus); + CPU_FOREACH_ISSET(cpu, &other_cpus) { p_cpudone = &cpuid_to_pcpu[cpu]->pc_smp_tlb_done; while (*p_cpudone != generation) ia32_pause(); diff --git a/sys/sys/cpuset.h b/sys/sys/cpuset.h index 1a96bb4766ce..9ef1a65f4506 100644 --- a/sys/sys/cpuset.h +++ b/sys/sys/cpuset.h @@ -66,6 +66,8 @@ #define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t) #define CPU_FFS(p) BIT_FFS(CPU_SETSIZE, p) #define CPU_FLS(p) BIT_FLS(CPU_SETSIZE, p) +#define CPU_FOREACH_ISSET(i, p) BIT_FOREACH_ISSET(CPU_SETSIZE, i, p) +#define CPU_FOREACH_ISCLR(i, p) BIT_FOREACH_ISCLR(CPU_SETSIZE, i, p) #define CPU_COUNT(p) ((int)BIT_COUNT(CPU_SETSIZE, p)) #define CPUSET_FSET BITSET_FSET(_NCPUWORDS) #define CPUSET_T_INITIALIZER BITSET_T_INITIALIZER diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index 5e9a9735b09a..09d05d3f6de4 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -1290,9 +1290,7 @@ ipi_selected(cpuset_t cpus, u_int ipi) if (ipi == IPI_STOP_HARD) CPU_OR_ATOMIC(&ipi_stop_nmi_pending, &cpus); - while ((cpu = CPU_FFS(&cpus)) != 0) { - cpu--; - CPU_CLR(cpu, &cpus); + CPU_FOREACH_ISSET(cpu, &cpus) { CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); ipi_send_cpu(cpu, ipi); } From owner-dev-commits-src-all@freebsd.org Tue Sep 21 16:09:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 195F2675AD3; Tue, 21 Sep 2021 16:09: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 4HDRFZ671Lz3H89; Tue, 21 Sep 2021 16:09: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 AF34326CA9; Tue, 21 Sep 2021 16:09: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 18LG9MwJ022840; Tue, 21 Sep 2021 16:09:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LG9MME022839; Tue, 21 Sep 2021 16:09:22 GMT (envelope-from git) Date: Tue, 21 Sep 2021 16:09:22 GMT Message-Id: <202109211609.18LG9MME022839@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: a3e3d90863f3 - main - clang-format: Add bitset loop macros MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a3e3d90863f3af81bca485468814a787206a235d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 16:09:23 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a3e3d90863f3af81bca485468814a787206a235d commit a3e3d90863f3af81bca485468814a787206a235d Author: Mark Johnston AuthorDate: 2021-09-21 15:39:49 +0000 Commit: Mark Johnston CommitDate: 2021-09-21 16:08:01 +0000 clang-format: Add bitset loop macros MFC after: 2 weeks Sponsored by: The FreeBSD Foundation --- .clang-format | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.clang-format b/.clang-format index 06709b762ec1..34ed52f7db51 100644 --- a/.clang-format +++ b/.clang-format @@ -52,7 +52,11 @@ ForEachMacros: - ARB_FOREACH_REVERSE - ARB_FOREACH_REVERSE_FROM - ARB_FOREACH_REVERSE_SAFE + - BIT_FOREACH_ISCLR + - BIT_FOREACH_ISSET - CPU_FOREACH + - CPU_FOREACH_ISCLR + - CPU_FOREACH_ISSET - FOREACH_THREAD_IN_PROC - FOREACH_PROC_IN_SYSTEM - FOREACH_PRISON_CHILD From owner-dev-commits-src-all@freebsd.org Tue Sep 21 16:11:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 608EF676454; Tue, 21 Sep 2021 16:11: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 4HDRHW2F8rz3Ht0; Tue, 21 Sep 2021 16:11: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 2DAAD26CB6; Tue, 21 Sep 2021 16:11: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 18LGB30i032258; Tue, 21 Sep 2021 16:11:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LGB3cO032257; Tue, 21 Sep 2021 16:11:03 GMT (envelope-from git) Date: Tue, 21 Sep 2021 16:11:03 GMT Message-Id: <202109211611.18LGB3cO032257@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 0e3ce6d082b3 - main - efi loader: Typo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0e3ce6d082b34154e41e220757c03d66d881a47b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 16:11:03 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0e3ce6d082b34154e41e220757c03d66d881a47b commit 0e3ce6d082b34154e41e220757c03d66d881a47b Author: Mark Johnston AuthorDate: 2021-09-21 16:09:55 +0000 Commit: Mark Johnston CommitDate: 2021-09-21 16:09:55 +0000 efi loader: Typo MFC after: 3 days --- stand/efi/loader/arch/amd64/elf64_freebsd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/efi/loader/arch/amd64/elf64_freebsd.c b/stand/efi/loader/arch/amd64/elf64_freebsd.c index d0c8ef96eeea..4bdf675cd5a3 100644 --- a/stand/efi/loader/arch/amd64/elf64_freebsd.c +++ b/stand/efi/loader/arch/amd64/elf64_freebsd.c @@ -269,7 +269,7 @@ elf64_exec(struct preloaded_file *fp) } } - printf("staging %#lx (%scoping) tramp %p PT4 %p\n", + printf("staging %#lx (%scopying) tramp %p PT4 %p\n", staging, copy_staging == COPY_STAGING_ENABLE ? "" : "not ", trampoline, PT4); printf("Start @ 0x%lx ...\n", ehdr->e_entry); From owner-dev-commits-src-all@freebsd.org Tue Sep 21 16:17:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E12B067698E; Tue, 21 Sep 2021 16:17: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 4HDRRC635Dz3J6V; Tue, 21 Sep 2021 16:17: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 A51F027029; Tue, 21 Sep 2021 16:17: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 18LGHhVd036065; Tue, 21 Sep 2021 16:17:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LGHhCQ036064; Tue, 21 Sep 2021 16:17:43 GMT (envelope-from git) Date: Tue, 21 Sep 2021 16:17:43 GMT Message-Id: <202109211617.18LGHhCQ036064@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: af32e2cc32b2 - main - dwmmc: Properly implement power_off/power_up MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: af32e2cc32b2516826e301d5f857ff7343b1210e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 16:17:43 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=af32e2cc32b2516826e301d5f857ff7343b1210e commit af32e2cc32b2516826e301d5f857ff7343b1210e Author: Emmanuel Vadot AuthorDate: 2021-09-21 14:10:11 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-21 16:17:20 +0000 dwmmc: Properly implement power_off/power_up Write to the PWREN register should be done in update_ios based on the power_mode value in the ios struct. Also none of the manual (RockChip and Altera) and Linux talks about the needed for an inverted PWREN value so just remove this. This fixes eMMC (and possibly SD) when u-boot didn't setup the controller. Reported by: avg Tested-on: Rock64, RockPro64 --- sys/dev/mmc/host/dwmmc.c | 20 +++++++++++--------- sys/dev/mmc/host/dwmmc_rockchip.c | 2 -- sys/dev/mmc/host/dwmmc_var.h | 1 - 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/sys/dev/mmc/host/dwmmc.c b/sys/dev/mmc/host/dwmmc.c index dce684ed8c7b..df7ac374a265 100644 --- a/sys/dev/mmc/host/dwmmc.c +++ b/sys/dev/mmc/host/dwmmc.c @@ -670,7 +670,6 @@ dwmmc_attach(device_t dev) { struct dwmmc_softc *sc; int error; - int slot; sc = device_get_softc(dev); @@ -703,14 +702,6 @@ dwmmc_attach(device_t dev) device_printf(dev, "Hardware version ID is %04x\n", READ4(sc, SDMMC_VERID) & 0xffff); - /* XXX: we support operation for slot index 0 only */ - slot = 0; - if (sc->pwren_inverted) { - WRITE4(sc, SDMMC_PWREN, (0 << slot)); - } else { - WRITE4(sc, SDMMC_PWREN, (1 << slot)); - } - /* Reset all */ if (dwmmc_ctrl_reset(sc, (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET | @@ -892,6 +883,17 @@ dwmmc_update_ios(device_t brdev, device_t reqdev) dprintf("Setting up clk %u bus_width %d, timming: %d\n", ios->clock, ios->bus_width, ios->timing); + switch (ios->power_mode) { + case power_on: + break; + case power_off: + WRITE4(sc, SDMMC_PWREN, 0); + break; + case power_up: + WRITE4(sc, SDMMC_PWREN, 1); + break; + } + mmc_fdt_set_power(&sc->mmc_helper, ios->power_mode); if (ios->bus_width == bus_width_8) diff --git a/sys/dev/mmc/host/dwmmc_rockchip.c b/sys/dev/mmc/host/dwmmc_rockchip.c index 25baffb267e3..c025e531e27b 100644 --- a/sys/dev/mmc/host/dwmmc_rockchip.c +++ b/sys/dev/mmc/host/dwmmc_rockchip.c @@ -94,8 +94,6 @@ rockchip_dwmmc_attach(device_t dev) break; } - sc->pwren_inverted = 1; - #ifdef EXT_RESOURCES sc->update_ios = &dwmmc_rockchip_update_ios; #endif diff --git a/sys/dev/mmc/host/dwmmc_var.h b/sys/dev/mmc/host/dwmmc_var.h index a3f20278ad2a..33210f547dff 100644 --- a/sys/dev/mmc/host/dwmmc_var.h +++ b/sys/dev/mmc/host/dwmmc_var.h @@ -69,7 +69,6 @@ struct dwmmc_softc { uint32_t hwtype; uint32_t use_auto_stop; uint32_t use_pio; - uint32_t pwren_inverted; device_t child; struct task card_task; /* Card presence check task */ struct timeout_task card_delayed_task;/* Card insert delayed task */ From owner-dev-commits-src-all@freebsd.org Tue Sep 21 16:17:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D46A676990; Tue, 21 Sep 2021 16:17: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 4HDRRD6xB8z3J6W; Tue, 21 Sep 2021 16:17: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 CFBA826FB0; Tue, 21 Sep 2021 16:17: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 18LGHi1O036089; Tue, 21 Sep 2021 16:17:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LGHiLu036088; Tue, 21 Sep 2021 16:17:44 GMT (envelope-from git) Date: Tue, 21 Sep 2021 16:17:44 GMT Message-Id: <202109211617.18LGHiLu036088@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 559f60214b74 - main - dwmmc: Remove dwmmc_setup_bus call from start_cmd MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 559f60214b7498ac068c5aa1f2bdecc1610bab53 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 16:17:45 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=559f60214b7498ac068c5aa1f2bdecc1610bab53 commit 559f60214b7498ac068c5aa1f2bdecc1610bab53 Author: Emmanuel Vadot AuthorDate: 2021-09-21 15:52:38 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-21 16:17:20 +0000 dwmmc: Remove dwmmc_setup_bus call from start_cmd There is no need to re-setup the bus before each commands. Tested-on: Rock64, RockPro64 Reported by: avg --- sys/dev/mmc/host/dwmmc.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sys/dev/mmc/host/dwmmc.c b/sys/dev/mmc/host/dwmmc.c index df7ac374a265..77c8e42a6150 100644 --- a/sys/dev/mmc/host/dwmmc.c +++ b/sys/dev/mmc/host/dwmmc.c @@ -1102,9 +1102,6 @@ dwmmc_start_cmd(struct dwmmc_softc *sc, struct mmc_command *cmd) sc->curcmd = cmd; data = cmd->data; - if ((sc->hwtype & HWTYPE_MASK) == HWTYPE_ROCKCHIP) - dwmmc_setup_bus(sc, sc->host.ios.clock); - #ifndef MMCCAM /* XXX Upper layers don't always set this */ cmd->mrq = sc->req; From owner-dev-commits-src-all@freebsd.org Tue Sep 21 17:03:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBBA66773A5; Tue, 21 Sep 2021 17:03: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 4HDSS85Y38z3McL; Tue, 21 Sep 2021 17:03: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 9E2DB276D7; Tue, 21 Sep 2021 17:03: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 18LH3aN8002817; Tue, 21 Sep 2021 17:03:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LH3a5u002816; Tue, 21 Sep 2021 17:03:36 GMT (envelope-from git) Date: Tue, 21 Sep 2021 17:03:36 GMT Message-Id: <202109211703.18LH3a5u002816@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 590d0715b348 - main - ipsec: enter epoch before calling into ipsec_run_hhooks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 590d0715b348d0d8da0c0355cebd9dff18e39831 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 17:03:36 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=590d0715b348d0d8da0c0355cebd9dff18e39831 commit 590d0715b348d0d8da0c0355cebd9dff18e39831 Author: Mateusz Guzik AuthorDate: 2021-09-17 12:00:20 +0000 Commit: Mateusz Guzik CommitDate: 2021-09-21 17:02:41 +0000 ipsec: enter epoch before calling into ipsec_run_hhooks pfil_run_hooks which eventually can get called asserts on it. Reviewed by: ae Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32007 --- sys/netipsec/ipsec_input.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/sys/netipsec/ipsec_input.c b/sys/netipsec/ipsec_input.c index 73202cbb528b..ce8f1f02b8be 100644 --- a/sys/netipsec/ipsec_input.c +++ b/sys/netipsec/ipsec_input.c @@ -347,7 +347,7 @@ ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, buf, sizeof(buf)), (u_long) ntohl(sav->spi))); IPSEC_ISTAT(sproto, hdrops); error = ENOBUFS; - goto bad; + goto bad_noepoch; } ip = mtod(m, struct ip *); @@ -367,6 +367,11 @@ ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, (prot == IPPROTO_UDP || prot == IPPROTO_TCP)) udp_ipsec_adjust_cksum(m, sav, prot, skip); + /* + * Needed for ipsec_run_hooks and netisr_queue_src + */ + NET_EPOCH_ENTER(et); + IPSEC_INIT_CTX(&ctx, &m, NULL, sav, AF_INET, IPSEC_ENC_BEFORE); if ((error = ipsec_run_hhooks(&ctx, HHOOK_TYPE_IPSEC_IN)) != 0) goto bad; @@ -466,18 +471,19 @@ ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, if (saidx->mode == IPSEC_MODE_TUNNEL) error = ipsec_if_input(m, sav, af); if (error == 0) { - NET_EPOCH_ENTER(et); error = netisr_queue_src(isr_prot, (uintptr_t)sav->spi, m); - NET_EPOCH_EXIT(et); if (error) { IPSEC_ISTAT(sproto, qfull); DPRINTF(("%s: queue full; proto %u packet dropped\n", __func__, sproto)); } } + NET_EPOCH_EXIT(et); key_freesav(&sav); return (error); bad: + NET_EPOCH_EXIT(et); +bad_noepoch: key_freesav(&sav); if (m != NULL) m_freem(m); @@ -560,6 +566,8 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, sproto == IPPROTO_IPCOMP, ("unexpected security protocol %u", sproto)); + NET_EPOCH_ENTER(et); + /* Fix IPv6 header */ if (m->m_len < sizeof(struct ip6_hdr) && (m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) { @@ -671,16 +679,15 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, if (saidx->mode == IPSEC_MODE_TUNNEL) error = ipsec_if_input(m, sav, af); if (error == 0) { - NET_EPOCH_ENTER(et); error = netisr_queue_src(isr_prot, (uintptr_t)sav->spi, m); - NET_EPOCH_EXIT(et); if (error) { IPSEC_ISTAT(sproto, qfull); DPRINTF(("%s: queue full; proto %u packet" " dropped\n", __func__, sproto)); } } + NET_EPOCH_EXIT(et); key_freesav(&sav); return (error); } @@ -690,12 +697,11 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, */ nest = 0; nxt = nxt8; - NET_EPOCH_ENTER(et); while (nxt != IPPROTO_DONE) { if (V_ip6_hdrnestlimit && (++nest > V_ip6_hdrnestlimit)) { IP6STAT_INC(ip6s_toomanyhdr); error = EINVAL; - goto bad_epoch; + goto bad; } /* @@ -706,7 +712,7 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, IP6STAT_INC(ip6s_tooshort); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); error = EINVAL; - goto bad_epoch; + goto bad; } /* * Enforce IPsec policy checking if we are seeing last header. @@ -716,16 +722,15 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, if ((inet6sw[ip6_protox[nxt]].pr_flags & PR_LASTHDR) != 0 && ipsec6_in_reject(m, NULL)) { error = EINVAL; - goto bad_epoch; + goto bad; } nxt = (*inet6sw[ip6_protox[nxt]].pr_input)(&m, &skip, nxt); } NET_EPOCH_EXIT(et); key_freesav(&sav); return (0); -bad_epoch: - NET_EPOCH_EXIT(et); bad: + NET_EPOCH_EXIT(et); key_freesav(&sav); if (m) m_freem(m); From owner-dev-commits-src-all@freebsd.org Tue Sep 21 17:21:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A683C677789; Tue, 21 Sep 2021 17:21:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDSrR3mdrz3NhJ; Tue, 21 Sep 2021 17:21:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 537F527E79; Tue, 21 Sep 2021 17:21:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LHLBBP028826; Tue, 21 Sep 2021 17:21:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LHLB4w028825; Tue, 21 Sep 2021 17:21:11 GMT (envelope-from git) Date: Tue, 21 Sep 2021 17:21:11 GMT Message-Id: <202109211721.18LHLB4w028825@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: a42d362bb54a - main - amd64: centralize definitions of CS_SECURE and EFL_SECURE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a42d362bb54af91d8b82dca086fa656f4624bae2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 17:21:11 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a42d362bb54af91d8b82dca086fa656f4624bae2 commit a42d362bb54af91d8b82dca086fa656f4624bae2 Author: Konstantin Belousov AuthorDate: 2021-09-14 16:07:31 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 17:20:14 +0000 amd64: centralize definitions of CS_SECURE and EFL_SECURE Requested by markj Reviewed by: jhb, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31954 --- sys/amd64/amd64/machdep.c | 3 --- sys/amd64/ia32/ia32_reg.c | 3 --- sys/amd64/ia32/ia32_signal.c | 3 --- sys/amd64/include/frame.h | 5 +++++ sys/amd64/linux/linux_sysvec.c | 5 +---- sys/amd64/linux32/linux32_sysvec.c | 8 ++------ 6 files changed, 8 insertions(+), 19 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 864caa144f0d..55d52a28b576 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -166,9 +166,6 @@ CTASSERT(PC_PTI_STACK_SZ * sizeof(register_t) >= 2 * sizeof(struct pti_frame) - extern u_int64_t hammer_time(u_int64_t, u_int64_t); -#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) -#define EFL_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) - static void cpu_startup(void *); static void get_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpusave, size_t xfpusave_len); diff --git a/sys/amd64/ia32/ia32_reg.c b/sys/amd64/ia32/ia32_reg.c index ae041a325cba..343d1564e1ff 100644 --- a/sys/amd64/ia32/ia32_reg.c +++ b/sys/amd64/ia32/ia32_reg.c @@ -73,9 +73,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) -#define EFL_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) - int fill_regs32(struct thread *td, struct reg32 *regs) { diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c index c114cf1d240a..49b5797d68fd 100644 --- a/sys/amd64/ia32/ia32_signal.c +++ b/sys/amd64/ia32/ia32_signal.c @@ -85,9 +85,6 @@ __FBSDID("$FreeBSD$"); static void freebsd4_ia32_sendsig(sig_t, ksiginfo_t *, sigset_t *); #endif -#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) -#define EFL_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) - static void ia32_get_fpcontext(struct thread *td, struct ia32_mcontext *mcp, char *xfpusave, size_t xfpusave_len) diff --git a/sys/amd64/include/frame.h b/sys/amd64/include/frame.h index fef5ab2b3765..5eb96d03b981 100644 --- a/sys/amd64/include/frame.h +++ b/sys/amd64/include/frame.h @@ -46,4 +46,9 @@ struct pti_frame { register_t pti_ss; }; +#ifdef _KERNEL +#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) +#define EFL_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) +#endif + #endif diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index 6f3f78639588..d6f2ec2ab832 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -555,9 +555,7 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) * Corruption of the PSL_RF bit at worst causes one more or * one less debugger trap, so allowing it is fairly harmless. */ - -#define RFLAG_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) - if (!RFLAG_SECURE(rflags & ~PSL_RF, regs->tf_rflags & ~PSL_RF)) { + if (!EFL_SECURE(rflags & ~PSL_RF, regs->tf_rflags & ~PSL_RF)) { printf("linux_rt_sigreturn: rflags = 0x%lx\n", rflags); return (EINVAL); } @@ -567,7 +565,6 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) * hardware check for invalid selectors, excess privilege in * other selectors, invalid %eip's and invalid %esp's. */ -#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) if (!CS_SECURE(context->sc_cs)) { printf("linux_rt_sigreturn: cs = 0x%x\n", context->sc_cs); ksiginfo_init_trap(&ksi); diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index f45413cca1c8..b9d2d7aaf7cd 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -519,9 +519,8 @@ linux_sigreturn(struct thread *td, struct linux_sigreturn_args *args) return (EFAULT); /* Check for security violations. */ -#define EFLAGS_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) eflags = frame.sf_sc.sc_eflags; - if (!EFLAGS_SECURE(eflags, regs->tf_rflags)) + if (!EFL_SECURE(eflags, regs->tf_rflags)) return(EINVAL); /* @@ -529,7 +528,6 @@ linux_sigreturn(struct thread *td, struct linux_sigreturn_args *args) * hardware check for invalid selectors, excess privilege in * other selectors, invalid %eip's and invalid %esp's. */ -#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) if (!CS_SECURE(frame.sf_sc.sc_cs)) { ksiginfo_init_trap(&ksi); ksi.ksi_signo = SIGBUS; @@ -602,9 +600,8 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) context = &uc.uc_mcontext; /* Check for security violations. */ -#define EFLAGS_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) eflags = context->sc_eflags; - if (!EFLAGS_SECURE(eflags, regs->tf_rflags)) + if (!EFL_SECURE(eflags, regs->tf_rflags)) return(EINVAL); /* @@ -612,7 +609,6 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) * hardware check for invalid selectors, excess privilege in * other selectors, invalid %eip's and invalid %esp's. */ -#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) if (!CS_SECURE(context->sc_cs)) { ksiginfo_init_trap(&ksi); ksi.ksi_signo = SIGBUS; From owner-dev-commits-src-all@freebsd.org Tue Sep 21 17:21:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0F9D67737C; Tue, 21 Sep 2021 17:21:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDSrS4W9wz3NbF; Tue, 21 Sep 2021 17:21:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6CB5527D38; Tue, 21 Sep 2021 17:21:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LHLCNv028850; Tue, 21 Sep 2021 17:21:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LHLCdF028849; Tue, 21 Sep 2021 17:21:12 GMT (envelope-from git) Date: Tue, 21 Sep 2021 17:21:12 GMT Message-Id: <202109211721.18LHLCdF028849@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 12ca33f44fc7 - main - amd64: move signal handling and register structures manipulations into exec_machdep.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 12ca33f44fc76890336f517ace402b47b9afb134 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 17:21:13 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=12ca33f44fc76890336f517ace402b47b9afb134 commit 12ca33f44fc76890336f517ace402b47b9afb134 Author: Konstantin Belousov AuthorDate: 2021-09-13 20:33:37 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 17:20:15 +0000 amd64: move signal handling and register structures manipulations into exec_machdep.c from machdep.c which is too large pile of unrelated things. Some ptrace functions are moved from machdep.c to ptrace_machdep.c. Now machdep.c contains code mostly related to the low level initialization and regular low level operation of the architecture, while signal MD code and registers handling is placed in exec_machdep.c. Reviewed by: jhb, markj Discussed with: jrtc27 Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31954 --- sys/amd64/amd64/exec_machdep.c | 987 +++++++++++++++++++++++++++++++++++++++ sys/amd64/amd64/machdep.c | 924 ------------------------------------ sys/amd64/amd64/ptrace_machdep.c | 33 ++ sys/conf/files.amd64 | 1 + 4 files changed, 1021 insertions(+), 924 deletions(-) diff --git a/sys/amd64/amd64/exec_machdep.c b/sys/amd64/amd64/exec_machdep.c new file mode 100644 index 000000000000..5cd905e1051b --- /dev/null +++ b/sys/amd64/amd64/exec_machdep.c @@ -0,0 +1,987 @@ +/*- + * SPDX-License-Identifier: BSD-4-Clause + * + * Copyright (c) 2003 Peter Wemm. + * Copyright (c) 1992 Terrence R. Lambert. + * Copyright (c) 1982, 1987, 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_cpu.h" +#include "opt_ddb.h" +#include "opt_kstack_pages.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef SMP +#include +#endif +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#ifdef DDB +#ifndef KDB +#error KDB must be enabled in order for DDB to work! +#endif +#include +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +static void get_fpcontext(struct thread *td, mcontext_t *mcp, + char *xfpusave, size_t xfpusave_len); +static int set_fpcontext(struct thread *td, mcontext_t *mcp, + char *xfpustate, size_t xfpustate_len); + +/* + * Send an interrupt to process. + * + * Stack is set up to allow sigcode stored at top to call routine, + * followed by call to sigreturn routine below. After sigreturn + * resets the signal mask, the stack, and the frame pointer, it + * returns to the user specified pc, psl. + */ +void +sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) +{ + struct sigframe sf, *sfp; + struct pcb *pcb; + struct proc *p; + struct thread *td; + struct sigacts *psp; + char *sp; + struct trapframe *regs; + char *xfpusave; + size_t xfpusave_len; + int sig; + int oonstack; + + td = curthread; + pcb = td->td_pcb; + p = td->td_proc; + PROC_LOCK_ASSERT(p, MA_OWNED); + sig = ksi->ksi_signo; + psp = p->p_sigacts; + mtx_assert(&psp->ps_mtx, MA_OWNED); + regs = td->td_frame; + oonstack = sigonstack(regs->tf_rsp); + + if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { + xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); + xfpusave = __builtin_alloca(xfpusave_len); + } else { + xfpusave_len = 0; + xfpusave = NULL; + } + + /* Save user context. */ + bzero(&sf, sizeof(sf)); + sf.sf_uc.uc_sigmask = *mask; + sf.sf_uc.uc_stack = td->td_sigstk; + sf.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) + ? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE; + sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0; + bcopy(regs, &sf.sf_uc.uc_mcontext.mc_rdi, sizeof(*regs)); + sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ + get_fpcontext(td, &sf.sf_uc.uc_mcontext, xfpusave, xfpusave_len); + fpstate_drop(td); + update_pcb_bases(pcb); + sf.sf_uc.uc_mcontext.mc_fsbase = pcb->pcb_fsbase; + sf.sf_uc.uc_mcontext.mc_gsbase = pcb->pcb_gsbase; + bzero(sf.sf_uc.uc_mcontext.mc_spare, + sizeof(sf.sf_uc.uc_mcontext.mc_spare)); + + /* Allocate space for the signal handler context. */ + if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && + SIGISMEMBER(psp->ps_sigonstack, sig)) { + sp = (char *)td->td_sigstk.ss_sp + td->td_sigstk.ss_size; +#if defined(COMPAT_43) + td->td_sigstk.ss_flags |= SS_ONSTACK; +#endif + } else + sp = (char *)regs->tf_rsp - 128; + if (xfpusave != NULL) { + sp -= xfpusave_len; + sp = (char *)((unsigned long)sp & ~0x3Ful); + sf.sf_uc.uc_mcontext.mc_xfpustate = (register_t)sp; + } + sp -= sizeof(struct sigframe); + /* Align to 16 bytes. */ + sfp = (struct sigframe *)((unsigned long)sp & ~0xFul); + + /* Build the argument list for the signal handler. */ + regs->tf_rdi = sig; /* arg 1 in %rdi */ + regs->tf_rdx = (register_t)&sfp->sf_uc; /* arg 3 in %rdx */ + bzero(&sf.sf_si, sizeof(sf.sf_si)); + if (SIGISMEMBER(psp->ps_siginfo, sig)) { + /* Signal handler installed with SA_SIGINFO. */ + regs->tf_rsi = (register_t)&sfp->sf_si; /* arg 2 in %rsi */ + sf.sf_ahu.sf_action = (__siginfohandler_t *)catcher; + + /* Fill in POSIX parts */ + sf.sf_si = ksi->ksi_info; + sf.sf_si.si_signo = sig; /* maybe a translated signal */ + regs->tf_rcx = (register_t)ksi->ksi_addr; /* arg 4 in %rcx */ + } else { + /* Old FreeBSD-style arguments. */ + regs->tf_rsi = ksi->ksi_code; /* arg 2 in %rsi */ + regs->tf_rcx = (register_t)ksi->ksi_addr; /* arg 4 in %rcx */ + sf.sf_ahu.sf_handler = catcher; + } + mtx_unlock(&psp->ps_mtx); + PROC_UNLOCK(p); + + /* + * Copy the sigframe out to the user's stack. + */ + if (copyout(&sf, sfp, sizeof(*sfp)) != 0 || + (xfpusave != NULL && copyout(xfpusave, + (void *)sf.sf_uc.uc_mcontext.mc_xfpustate, xfpusave_len) + != 0)) { +#ifdef DEBUG + printf("process %ld has trashed its stack\n", (long)p->p_pid); +#endif + PROC_LOCK(p); + sigexit(td, SIGILL); + } + + regs->tf_rsp = (long)sfp; + regs->tf_rip = p->p_sysent->sv_sigcode_base; + regs->tf_rflags &= ~(PSL_T | PSL_D); + regs->tf_cs = _ucodesel; + regs->tf_ds = _udatasel; + regs->tf_ss = _udatasel; + regs->tf_es = _udatasel; + regs->tf_fs = _ufssel; + regs->tf_gs = _ugssel; + regs->tf_flags = TF_HASSEGS; + PROC_LOCK(p); + mtx_lock(&psp->ps_mtx); +} + +/* + * System call to cleanup state after a signal + * has been taken. Reset signal mask and + * stack state from context left by sendsig (above). + * Return to previous pc and psl as specified by + * context left by sendsig. Check carefully to + * make sure that the user has not modified the + * state to gain improper privileges. + */ +int +sys_sigreturn(td, uap) + struct thread *td; + struct sigreturn_args /* { + const struct __ucontext *sigcntxp; + } */ *uap; +{ + ucontext_t uc; + struct pcb *pcb; + struct proc *p; + struct trapframe *regs; + ucontext_t *ucp; + char *xfpustate; + size_t xfpustate_len; + long rflags; + int cs, error, ret; + ksiginfo_t ksi; + + pcb = td->td_pcb; + p = td->td_proc; + + error = copyin(uap->sigcntxp, &uc, sizeof(uc)); + if (error != 0) { + uprintf("pid %d (%s): sigreturn copyin failed\n", + p->p_pid, td->td_name); + return (error); + } + ucp = &uc; + if ((ucp->uc_mcontext.mc_flags & ~_MC_FLAG_MASK) != 0) { + uprintf("pid %d (%s): sigreturn mc_flags %x\n", p->p_pid, + td->td_name, ucp->uc_mcontext.mc_flags); + return (EINVAL); + } + regs = td->td_frame; + rflags = ucp->uc_mcontext.mc_rflags; + /* + * Don't allow users to change privileged or reserved flags. + */ + if (!EFL_SECURE(rflags, regs->tf_rflags)) { + uprintf("pid %d (%s): sigreturn rflags = 0x%lx\n", p->p_pid, + td->td_name, rflags); + return (EINVAL); + } + + /* + * Don't allow users to load a valid privileged %cs. Let the + * hardware check for invalid selectors, excess privilege in + * other selectors, invalid %eip's and invalid %esp's. + */ + cs = ucp->uc_mcontext.mc_cs; + if (!CS_SECURE(cs)) { + uprintf("pid %d (%s): sigreturn cs = 0x%x\n", p->p_pid, + td->td_name, cs); + ksiginfo_init_trap(&ksi); + ksi.ksi_signo = SIGBUS; + ksi.ksi_code = BUS_OBJERR; + ksi.ksi_trapno = T_PROTFLT; + ksi.ksi_addr = (void *)regs->tf_rip; + trapsignal(td, &ksi); + return (EINVAL); + } + + if ((uc.uc_mcontext.mc_flags & _MC_HASFPXSTATE) != 0) { + xfpustate_len = uc.uc_mcontext.mc_xfpustate_len; + if (xfpustate_len > cpu_max_ext_state_size - + sizeof(struct savefpu)) { + uprintf("pid %d (%s): sigreturn xfpusave_len = 0x%zx\n", + p->p_pid, td->td_name, xfpustate_len); + return (EINVAL); + } + xfpustate = __builtin_alloca(xfpustate_len); + error = copyin((const void *)uc.uc_mcontext.mc_xfpustate, + xfpustate, xfpustate_len); + if (error != 0) { + uprintf( + "pid %d (%s): sigreturn copying xfpustate failed\n", + p->p_pid, td->td_name); + return (error); + } + } else { + xfpustate = NULL; + xfpustate_len = 0; + } + ret = set_fpcontext(td, &ucp->uc_mcontext, xfpustate, xfpustate_len); + if (ret != 0) { + uprintf("pid %d (%s): sigreturn set_fpcontext err %d\n", + p->p_pid, td->td_name, ret); + return (ret); + } + bcopy(&ucp->uc_mcontext.mc_rdi, regs, sizeof(*regs)); + update_pcb_bases(pcb); + pcb->pcb_fsbase = ucp->uc_mcontext.mc_fsbase; + pcb->pcb_gsbase = ucp->uc_mcontext.mc_gsbase; + +#if defined(COMPAT_43) + if (ucp->uc_mcontext.mc_onstack & 1) + td->td_sigstk.ss_flags |= SS_ONSTACK; + else + td->td_sigstk.ss_flags &= ~SS_ONSTACK; +#endif + + kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0); + return (EJUSTRETURN); +} + +#ifdef COMPAT_FREEBSD4 +int +freebsd4_sigreturn(struct thread *td, struct freebsd4_sigreturn_args *uap) +{ + + return sys_sigreturn(td, (struct sigreturn_args *)uap); +} +#endif + +/* + * Reset the hardware debug registers if they were in use. + * They won't have any meaning for the newly exec'd process. + */ +void +x86_clear_dbregs(struct pcb *pcb) +{ + if ((pcb->pcb_flags & PCB_DBREGS) == 0) + return; + + pcb->pcb_dr0 = 0; + pcb->pcb_dr1 = 0; + pcb->pcb_dr2 = 0; + pcb->pcb_dr3 = 0; + pcb->pcb_dr6 = 0; + pcb->pcb_dr7 = 0; + + if (pcb == curpcb) { + /* + * Clear the debug registers on the running CPU, + * otherwise they will end up affecting the next + * process we switch to. + */ + reset_dbregs(); + } + clear_pcb_flags(pcb, PCB_DBREGS); +} + +/* + * Reset registers to default values on exec. + */ +void +exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) +{ + struct trapframe *regs; + struct pcb *pcb; + register_t saved_rflags; + + regs = td->td_frame; + pcb = td->td_pcb; + + if (td->td_proc->p_md.md_ldt != NULL) + user_ldt_free(td); + + update_pcb_bases(pcb); + pcb->pcb_fsbase = 0; + pcb->pcb_gsbase = 0; + clear_pcb_flags(pcb, PCB_32BIT); + pcb->pcb_initial_fpucw = __INITIAL_FPUCW__; + + saved_rflags = regs->tf_rflags & PSL_T; + bzero((char *)regs, sizeof(struct trapframe)); + regs->tf_rip = imgp->entry_addr; + regs->tf_rsp = ((stack - 8) & ~0xFul) + 8; + regs->tf_rdi = stack; /* argv */ + regs->tf_rflags = PSL_USER | saved_rflags; + regs->tf_ss = _udatasel; + regs->tf_cs = _ucodesel; + regs->tf_ds = _udatasel; + regs->tf_es = _udatasel; + regs->tf_fs = _ufssel; + regs->tf_gs = _ugssel; + regs->tf_flags = TF_HASSEGS; + + x86_clear_dbregs(pcb); + + /* + * Drop the FP state if we hold it, so that the process gets a + * clean FP state if it uses the FPU again. + */ + fpstate_drop(td); +} + +int +fill_regs(struct thread *td, struct reg *regs) +{ + struct trapframe *tp; + + tp = td->td_frame; + return (fill_frame_regs(tp, regs)); +} + +int +fill_frame_regs(struct trapframe *tp, struct reg *regs) +{ + + regs->r_r15 = tp->tf_r15; + regs->r_r14 = tp->tf_r14; + regs->r_r13 = tp->tf_r13; + regs->r_r12 = tp->tf_r12; + regs->r_r11 = tp->tf_r11; + regs->r_r10 = tp->tf_r10; + regs->r_r9 = tp->tf_r9; + regs->r_r8 = tp->tf_r8; + regs->r_rdi = tp->tf_rdi; + regs->r_rsi = tp->tf_rsi; + regs->r_rbp = tp->tf_rbp; + regs->r_rbx = tp->tf_rbx; + regs->r_rdx = tp->tf_rdx; + regs->r_rcx = tp->tf_rcx; + regs->r_rax = tp->tf_rax; + regs->r_rip = tp->tf_rip; + regs->r_cs = tp->tf_cs; + regs->r_rflags = tp->tf_rflags; + regs->r_rsp = tp->tf_rsp; + regs->r_ss = tp->tf_ss; + if (tp->tf_flags & TF_HASSEGS) { + regs->r_ds = tp->tf_ds; + regs->r_es = tp->tf_es; + regs->r_fs = tp->tf_fs; + regs->r_gs = tp->tf_gs; + } else { + regs->r_ds = 0; + regs->r_es = 0; + regs->r_fs = 0; + regs->r_gs = 0; + } + regs->r_err = 0; + regs->r_trapno = 0; + return (0); +} + +int +set_regs(struct thread *td, struct reg *regs) +{ + struct trapframe *tp; + register_t rflags; + + tp = td->td_frame; + rflags = regs->r_rflags & 0xffffffff; + if (!EFL_SECURE(rflags, tp->tf_rflags) || !CS_SECURE(regs->r_cs)) + return (EINVAL); + tp->tf_r15 = regs->r_r15; + tp->tf_r14 = regs->r_r14; + tp->tf_r13 = regs->r_r13; + tp->tf_r12 = regs->r_r12; + tp->tf_r11 = regs->r_r11; + tp->tf_r10 = regs->r_r10; + tp->tf_r9 = regs->r_r9; + tp->tf_r8 = regs->r_r8; + tp->tf_rdi = regs->r_rdi; + tp->tf_rsi = regs->r_rsi; + tp->tf_rbp = regs->r_rbp; + tp->tf_rbx = regs->r_rbx; + tp->tf_rdx = regs->r_rdx; + tp->tf_rcx = regs->r_rcx; + tp->tf_rax = regs->r_rax; + tp->tf_rip = regs->r_rip; + tp->tf_cs = regs->r_cs; + tp->tf_rflags = rflags; + tp->tf_rsp = regs->r_rsp; + tp->tf_ss = regs->r_ss; + if (0) { /* XXXKIB */ + tp->tf_ds = regs->r_ds; + tp->tf_es = regs->r_es; + tp->tf_fs = regs->r_fs; + tp->tf_gs = regs->r_gs; + tp->tf_flags = TF_HASSEGS; + } + set_pcb_flags(td->td_pcb, PCB_FULL_IRET); + return (0); +} + +/* XXX check all this stuff! */ +/* externalize from sv_xmm */ +static void +fill_fpregs_xmm(struct savefpu *sv_xmm, struct fpreg *fpregs) +{ + struct envxmm *penv_fpreg = (struct envxmm *)&fpregs->fpr_env; + struct envxmm *penv_xmm = &sv_xmm->sv_env; + int i; + + /* pcb -> fpregs */ + bzero(fpregs, sizeof(*fpregs)); + + /* FPU control/status */ + penv_fpreg->en_cw = penv_xmm->en_cw; + penv_fpreg->en_sw = penv_xmm->en_sw; + penv_fpreg->en_tw = penv_xmm->en_tw; + penv_fpreg->en_opcode = penv_xmm->en_opcode; + penv_fpreg->en_rip = penv_xmm->en_rip; + penv_fpreg->en_rdp = penv_xmm->en_rdp; + penv_fpreg->en_mxcsr = penv_xmm->en_mxcsr; + penv_fpreg->en_mxcsr_mask = penv_xmm->en_mxcsr_mask; + + /* FPU registers */ + for (i = 0; i < 8; ++i) + bcopy(sv_xmm->sv_fp[i].fp_acc.fp_bytes, fpregs->fpr_acc[i], 10); + + /* SSE registers */ + for (i = 0; i < 16; ++i) + bcopy(sv_xmm->sv_xmm[i].xmm_bytes, fpregs->fpr_xacc[i], 16); +} + +/* internalize from fpregs into sv_xmm */ +static void +set_fpregs_xmm(struct fpreg *fpregs, struct savefpu *sv_xmm) +{ + struct envxmm *penv_xmm = &sv_xmm->sv_env; + struct envxmm *penv_fpreg = (struct envxmm *)&fpregs->fpr_env; + int i; + + /* fpregs -> pcb */ + /* FPU control/status */ + penv_xmm->en_cw = penv_fpreg->en_cw; + penv_xmm->en_sw = penv_fpreg->en_sw; + penv_xmm->en_tw = penv_fpreg->en_tw; + penv_xmm->en_opcode = penv_fpreg->en_opcode; + penv_xmm->en_rip = penv_fpreg->en_rip; + penv_xmm->en_rdp = penv_fpreg->en_rdp; + penv_xmm->en_mxcsr = penv_fpreg->en_mxcsr; + penv_xmm->en_mxcsr_mask = penv_fpreg->en_mxcsr_mask & cpu_mxcsr_mask; + + /* FPU registers */ + for (i = 0; i < 8; ++i) + bcopy(fpregs->fpr_acc[i], sv_xmm->sv_fp[i].fp_acc.fp_bytes, 10); + + /* SSE registers */ + for (i = 0; i < 16; ++i) + bcopy(fpregs->fpr_xacc[i], sv_xmm->sv_xmm[i].xmm_bytes, 16); +} + +/* externalize from td->pcb */ +int +fill_fpregs(struct thread *td, struct fpreg *fpregs) +{ + + KASSERT(td == curthread || TD_IS_SUSPENDED(td) || + P_SHOULDSTOP(td->td_proc), + ("not suspended thread %p", td)); + fpugetregs(td); + fill_fpregs_xmm(get_pcb_user_save_td(td), fpregs); + return (0); +} + +/* internalize to td->pcb */ +int +set_fpregs(struct thread *td, struct fpreg *fpregs) +{ + + critical_enter(); + set_fpregs_xmm(fpregs, get_pcb_user_save_td(td)); + fpuuserinited(td); + critical_exit(); + return (0); +} + +/* + * Get machine context. + */ +int +get_mcontext(struct thread *td, mcontext_t *mcp, int flags) +{ + struct pcb *pcb; + struct trapframe *tp; + + pcb = td->td_pcb; + tp = td->td_frame; + PROC_LOCK(curthread->td_proc); + mcp->mc_onstack = sigonstack(tp->tf_rsp); + PROC_UNLOCK(curthread->td_proc); + mcp->mc_r15 = tp->tf_r15; + mcp->mc_r14 = tp->tf_r14; + mcp->mc_r13 = tp->tf_r13; + mcp->mc_r12 = tp->tf_r12; + mcp->mc_r11 = tp->tf_r11; + mcp->mc_r10 = tp->tf_r10; + mcp->mc_r9 = tp->tf_r9; + mcp->mc_r8 = tp->tf_r8; + mcp->mc_rdi = tp->tf_rdi; + mcp->mc_rsi = tp->tf_rsi; + mcp->mc_rbp = tp->tf_rbp; + mcp->mc_rbx = tp->tf_rbx; + mcp->mc_rcx = tp->tf_rcx; + mcp->mc_rflags = tp->tf_rflags; + if (flags & GET_MC_CLEAR_RET) { + mcp->mc_rax = 0; + mcp->mc_rdx = 0; + mcp->mc_rflags &= ~PSL_C; + } else { + mcp->mc_rax = tp->tf_rax; + mcp->mc_rdx = tp->tf_rdx; + } + mcp->mc_rip = tp->tf_rip; + mcp->mc_cs = tp->tf_cs; + mcp->mc_rsp = tp->tf_rsp; + mcp->mc_ss = tp->tf_ss; + mcp->mc_ds = tp->tf_ds; + mcp->mc_es = tp->tf_es; + mcp->mc_fs = tp->tf_fs; + mcp->mc_gs = tp->tf_gs; + mcp->mc_flags = tp->tf_flags; + mcp->mc_len = sizeof(*mcp); + get_fpcontext(td, mcp, NULL, 0); + update_pcb_bases(pcb); + mcp->mc_fsbase = pcb->pcb_fsbase; + mcp->mc_gsbase = pcb->pcb_gsbase; + mcp->mc_xfpustate = 0; + mcp->mc_xfpustate_len = 0; + bzero(mcp->mc_spare, sizeof(mcp->mc_spare)); + return (0); +} + +/* + * Set machine context. + * + * However, we don't set any but the user modifiable flags, and we won't + * touch the cs selector. + */ +int +set_mcontext(struct thread *td, mcontext_t *mcp) +{ + struct pcb *pcb; + struct trapframe *tp; + char *xfpustate; + long rflags; + int ret; + + pcb = td->td_pcb; + tp = td->td_frame; + if (mcp->mc_len != sizeof(*mcp) || + (mcp->mc_flags & ~_MC_FLAG_MASK) != 0) + return (EINVAL); + rflags = (mcp->mc_rflags & PSL_USERCHANGE) | + (tp->tf_rflags & ~PSL_USERCHANGE); + if (mcp->mc_flags & _MC_HASFPXSTATE) { + if (mcp->mc_xfpustate_len > cpu_max_ext_state_size - + sizeof(struct savefpu)) + return (EINVAL); + xfpustate = __builtin_alloca(mcp->mc_xfpustate_len); + ret = copyin((void *)mcp->mc_xfpustate, xfpustate, + mcp->mc_xfpustate_len); + if (ret != 0) + return (ret); + } else + xfpustate = NULL; + ret = set_fpcontext(td, mcp, xfpustate, mcp->mc_xfpustate_len); + if (ret != 0) + return (ret); + tp->tf_r15 = mcp->mc_r15; + tp->tf_r14 = mcp->mc_r14; + tp->tf_r13 = mcp->mc_r13; + tp->tf_r12 = mcp->mc_r12; + tp->tf_r11 = mcp->mc_r11; + tp->tf_r10 = mcp->mc_r10; + tp->tf_r9 = mcp->mc_r9; + tp->tf_r8 = mcp->mc_r8; + tp->tf_rdi = mcp->mc_rdi; + tp->tf_rsi = mcp->mc_rsi; + tp->tf_rbp = mcp->mc_rbp; + tp->tf_rbx = mcp->mc_rbx; + tp->tf_rdx = mcp->mc_rdx; + tp->tf_rcx = mcp->mc_rcx; + tp->tf_rax = mcp->mc_rax; + tp->tf_rip = mcp->mc_rip; + tp->tf_rflags = rflags; + tp->tf_rsp = mcp->mc_rsp; + tp->tf_ss = mcp->mc_ss; + tp->tf_flags = mcp->mc_flags; + if (tp->tf_flags & TF_HASSEGS) { + tp->tf_ds = mcp->mc_ds; + tp->tf_es = mcp->mc_es; + tp->tf_fs = mcp->mc_fs; + tp->tf_gs = mcp->mc_gs; + } + set_pcb_flags(pcb, PCB_FULL_IRET); + if (mcp->mc_flags & _MC_HASBASES) { + pcb->pcb_fsbase = mcp->mc_fsbase; + pcb->pcb_gsbase = mcp->mc_gsbase; + } + return (0); +} + +static void +get_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpusave, + size_t xfpusave_len) +{ + size_t max_len, len; + + mcp->mc_ownedfp = fpugetregs(td); + bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], + sizeof(mcp->mc_fpstate)); + mcp->mc_fpformat = fpuformat(); + if (!use_xsave || xfpusave_len == 0) + return; + max_len = cpu_max_ext_state_size - sizeof(struct savefpu); + len = xfpusave_len; + if (len > max_len) { + len = max_len; + bzero(xfpusave + max_len, len - max_len); + } + mcp->mc_flags |= _MC_HASFPXSTATE; + mcp->mc_xfpustate_len = len; + bcopy(get_pcb_user_save_td(td) + 1, xfpusave, len); +} + +static int +set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate, + size_t xfpustate_len) +{ + int error; + + if (mcp->mc_fpformat == _MC_FPFMT_NODEV) + return (0); + else if (mcp->mc_fpformat != _MC_FPFMT_XMM) + return (EINVAL); + else if (mcp->mc_ownedfp == _MC_FPOWNED_NONE) { + /* We don't care what state is left in the FPU or PCB. */ + fpstate_drop(td); + error = 0; + } else if (mcp->mc_ownedfp == _MC_FPOWNED_FPU || + mcp->mc_ownedfp == _MC_FPOWNED_PCB) { + error = fpusetregs(td, (struct savefpu *)&mcp->mc_fpstate, + xfpustate, xfpustate_len); + } else + return (EINVAL); + return (error); +} + +void +fpstate_drop(struct thread *td) +{ + + KASSERT(PCB_USER_FPU(td->td_pcb), ("fpstate_drop: kernel-owned fpu")); + critical_enter(); + if (PCPU_GET(fpcurthread) == td) + fpudrop(); + /* + * XXX force a full drop of the fpu. The above only drops it if we + * owned it. + * + * XXX I don't much like fpugetuserregs()'s semantics of doing a full + * drop. Dropping only to the pcb matches fnsave's behaviour. + * We only need to drop to !PCB_INITDONE in sendsig(). But + * sendsig() is the only caller of fpugetuserregs()... perhaps we just + * have too many layers. + */ + clear_pcb_flags(curthread->td_pcb, + PCB_FPUINITDONE | PCB_USERFPUINITDONE); + critical_exit(); +} + +int +fill_dbregs(struct thread *td, struct dbreg *dbregs) +{ + struct pcb *pcb; + + if (td == NULL) { + dbregs->dr[0] = rdr0(); + dbregs->dr[1] = rdr1(); + dbregs->dr[2] = rdr2(); + dbregs->dr[3] = rdr3(); + dbregs->dr[6] = rdr6(); + dbregs->dr[7] = rdr7(); + } else { + pcb = td->td_pcb; + dbregs->dr[0] = pcb->pcb_dr0; + dbregs->dr[1] = pcb->pcb_dr1; + dbregs->dr[2] = pcb->pcb_dr2; + dbregs->dr[3] = pcb->pcb_dr3; + dbregs->dr[6] = pcb->pcb_dr6; + dbregs->dr[7] = pcb->pcb_dr7; + } + dbregs->dr[4] = 0; + dbregs->dr[5] = 0; + dbregs->dr[8] = 0; + dbregs->dr[9] = 0; + dbregs->dr[10] = 0; + dbregs->dr[11] = 0; + dbregs->dr[12] = 0; + dbregs->dr[13] = 0; + dbregs->dr[14] = 0; + dbregs->dr[15] = 0; + return (0); +} + +int +set_dbregs(struct thread *td, struct dbreg *dbregs) +{ + struct pcb *pcb; + int i; + + if (td == NULL) { + load_dr0(dbregs->dr[0]); + load_dr1(dbregs->dr[1]); + load_dr2(dbregs->dr[2]); + load_dr3(dbregs->dr[3]); + load_dr6(dbregs->dr[6]); + load_dr7(dbregs->dr[7]); + } else { + /* + * Don't let an illegal value for dr7 get set. Specifically, + * check for undefined settings. Setting these bit patterns + * result in undefined behaviour and can lead to an unexpected + * TRCTRAP or a general protection fault right here. + * Upper bits of dr6 and dr7 must not be set + */ + for (i = 0; i < 4; i++) { + if (DBREG_DR7_ACCESS(dbregs->dr[7], i) == 0x02) + return (EINVAL); + if (td->td_frame->tf_cs == _ucode32sel && + DBREG_DR7_LEN(dbregs->dr[7], i) == DBREG_DR7_LEN_8) + return (EINVAL); + } + if ((dbregs->dr[6] & 0xffffffff00000000ul) != 0 || + (dbregs->dr[7] & 0xffffffff00000000ul) != 0) + return (EINVAL); + + pcb = td->td_pcb; + + /* + * Don't let a process set a breakpoint that is not within the + * process's address space. If a process could do this, it + * could halt the system by setting a breakpoint in the kernel + * (if ddb was enabled). Thus, we need to check to make sure + * that no breakpoints are being enabled for addresses outside + * process's address space. + * + * XXX - what about when the watched area of the user's + * address space is written into from within the kernel + * ... wouldn't that still cause a breakpoint to be generated + * from within kernel mode? + */ + + if (DBREG_DR7_ENABLED(dbregs->dr[7], 0)) { + /* dr0 is enabled */ + if (dbregs->dr[0] >= VM_MAXUSER_ADDRESS) + return (EINVAL); + } + if (DBREG_DR7_ENABLED(dbregs->dr[7], 1)) { + /* dr1 is enabled */ + if (dbregs->dr[1] >= VM_MAXUSER_ADDRESS) + return (EINVAL); + } + if (DBREG_DR7_ENABLED(dbregs->dr[7], 2)) { + /* dr2 is enabled */ + if (dbregs->dr[2] >= VM_MAXUSER_ADDRESS) + return (EINVAL); + } + if (DBREG_DR7_ENABLED(dbregs->dr[7], 3)) { + /* dr3 is enabled */ + if (dbregs->dr[3] >= VM_MAXUSER_ADDRESS) + return (EINVAL); + } + + pcb->pcb_dr0 = dbregs->dr[0]; + pcb->pcb_dr1 = dbregs->dr[1]; + pcb->pcb_dr2 = dbregs->dr[2]; + pcb->pcb_dr3 = dbregs->dr[3]; + pcb->pcb_dr6 = dbregs->dr[6]; + pcb->pcb_dr7 = dbregs->dr[7]; + + set_pcb_flags(pcb, PCB_DBREGS); + } + + return (0); +} + +void +reset_dbregs(void) +{ + + load_dr7(0); /* Turn off the control bits first */ + load_dr0(0); + load_dr1(0); + load_dr2(0); + load_dr3(0); + load_dr6(0); +} + +/* + * Return > 0 if a hardware breakpoint has been hit, and the + * breakpoint was in user space. Return 0, otherwise. + */ +int +user_dbreg_trap(register_t dr6) +{ + u_int64_t dr7; + u_int64_t bp; /* breakpoint bits extracted from dr6 */ + int nbp; /* number of breakpoints that triggered */ + caddr_t addr[4]; /* breakpoint addresses */ + int i; + + bp = dr6 & DBREG_DR6_BMASK; + if (bp == 0) { + /* + * None of the breakpoint bits are set meaning this + * trap was not caused by any of the debug registers + */ + return 0; + } + + dr7 = rdr7(); + if ((dr7 & 0x000000ff) == 0) { + /* + * all GE and LE bits in the dr7 register are zero, + * thus the trap couldn't have been caused by the + * hardware debug registers *** 1048 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Sep 21 17:21:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B67D677798; Tue, 21 Sep 2021 17:21: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 4HDSrV1rJSz3NvJ; Tue, 21 Sep 2021 17:21:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FC7227CE6; Tue, 21 Sep 2021 17:21:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LHLD9W028874; Tue, 21 Sep 2021 17:21:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LHLDke028873; Tue, 21 Sep 2021 17:21:13 GMT (envelope-from git) Date: Tue, 21 Sep 2021 17:21:13 GMT Message-Id: <202109211721.18LHLDke028873@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9151abe32303 - main - exec_machdep.c: some style, use ANSI C definition for sys_sigreturn() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9151abe323034275014dcfffb4a793bc5032bf87 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 17:21:15 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9151abe323034275014dcfffb4a793bc5032bf87 commit 9151abe323034275014dcfffb4a793bc5032bf87 Author: Konstantin Belousov AuthorDate: 2021-09-13 20:37:26 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 17:20:15 +0000 exec_machdep.c: some style, use ANSI C definition for sys_sigreturn() Reviewed by: jhb, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31954 --- sys/amd64/amd64/exec_machdep.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/sys/amd64/amd64/exec_machdep.c b/sys/amd64/amd64/exec_machdep.c index 5cd905e1051b..1297117638d6 100644 --- a/sys/amd64/amd64/exec_machdep.c +++ b/sys/amd64/amd64/exec_machdep.c @@ -97,7 +97,7 @@ __FBSDID("$FreeBSD$"); static void get_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpusave, size_t xfpusave_len); -static int set_fpcontext(struct thread *td, mcontext_t *mcp, +static int set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate, size_t xfpustate_len); /* @@ -236,11 +236,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) * state to gain improper privileges. */ int -sys_sigreturn(td, uap) - struct thread *td; - struct sigreturn_args /* { - const struct __ucontext *sigcntxp; - } */ *uap; +sys_sigreturn(struct thread *td, struct sigreturn_args *uap) { ucontext_t uc; struct pcb *pcb; @@ -938,7 +934,7 @@ user_dbreg_trap(register_t dr6) * None of the breakpoint bits are set meaning this * trap was not caused by any of the debug registers */ - return 0; + return (0); } dr7 = rdr7(); @@ -948,7 +944,7 @@ user_dbreg_trap(register_t dr6) * thus the trap couldn't have been caused by the * hardware debug registers */ - return 0; + return (0); } nbp = 0; @@ -976,12 +972,12 @@ user_dbreg_trap(register_t dr6) /* * addr[i] is in user space */ - return nbp; + return (nbp); } } /* * None of the breakpoints are in user space. */ - return 0; + return (0); } From owner-dev-commits-src-all@freebsd.org Tue Sep 21 17:21:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3B36467770D; Tue, 21 Sep 2021 17:21:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDSrW00ZBz3Ns2; Tue, 21 Sep 2021 17:21:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8DE127E94; Tue, 21 Sep 2021 17:21:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LHLE26028898; Tue, 21 Sep 2021 17:21:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LHLEBt028897; Tue, 21 Sep 2021 17:21:14 GMT (envelope-from git) Date: Tue, 21 Sep 2021 17:21:14 GMT Message-Id: <202109211721.18LHLEBt028897@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 0f6829488ef3 - main - linux32: add a hack to avoid redefining the type of the savefpu tag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0f6829488ef32142b9ea1c0806fb5ecfe0872c02 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 17:21:16 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0f6829488ef32142b9ea1c0806fb5ecfe0872c02 commit 0f6829488ef32142b9ea1c0806fb5ecfe0872c02 Author: Konstantin Belousov AuthorDate: 2021-09-13 21:40:02 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 17:20:15 +0000 linux32: add a hack to avoid redefining the type of the savefpu tag when compiling in amd64 kernel environment with -m32. This is a temporal workaround for some future proper (but unclear) fix. Reviewed by: jhb, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31954 --- sys/modules/linux/Makefile | 2 +- sys/x86/include/fpu.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/modules/linux/Makefile b/sys/modules/linux/Makefile index 373ec3dcae91..6c95a548bffb 100644 --- a/sys/modules/linux/Makefile +++ b/sys/modules/linux/Makefile @@ -60,7 +60,7 @@ linux${SFX}_assym.h: linux${SFX}_genassym.o sh ${SYSDIR}/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET} .if ${MACHINE_CPUARCH} == "amd64" -VDSOFLAGS=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 -m32 +VDSOFLAGS=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 -D__M32_BROKEN_MODULE_HACK__ -m32 .else VDSOFLAGS=-mregparm=0 .endif diff --git a/sys/x86/include/fpu.h b/sys/x86/include/fpu.h index 313a03ea55c9..bb8533d599dd 100644 --- a/sys/x86/include/fpu.h +++ b/sys/x86/include/fpu.h @@ -123,10 +123,12 @@ struct savexmm { } __aligned(16); #ifdef __i386__ +#ifndef __M32_BROKEN_MODULE_HACK__ union savefpu { struct save87 sv_87; struct savexmm sv_xmm; }; +#endif /* __M32_BROKEN_MODULE_HACK__ */ #else /* Floating point context. (amd64 fxsave/fxrstor) */ struct savefpu { From owner-dev-commits-src-all@freebsd.org Tue Sep 21 17:21:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E5336777E1; Tue, 21 Sep 2021 17:21:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDSrZ4t81z3NsD; Tue, 21 Sep 2021 17:21: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 157AA27E95; Tue, 21 Sep 2021 17:21:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LHLHON028977; Tue, 21 Sep 2021 17:21:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LHLHdK028976; Tue, 21 Sep 2021 17:21:17 GMT (envelope-from git) Date: Tue, 21 Sep 2021 17:21:17 GMT Message-Id: <202109211721.18LHLHdK028976@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 2e79a216329f - main - amd64: consistently use uprintf() to report weird situations in sigreturn MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2e79a216329f62a78dbbc72256e782353e220968 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 17:21:21 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2e79a216329f62a78dbbc72256e782353e220968 commit 2e79a216329f62a78dbbc72256e782353e220968 Author: Konstantin Belousov AuthorDate: 2021-09-16 13:48:27 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 17:20:15 +0000 amd64: consistently use uprintf() to report weird situations in sigreturn Reviewed by: jhb Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31954 --- sys/amd64/amd64/exec_machdep.c | 5 ++--- sys/amd64/linux/linux_sysvec.c | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/amd64/amd64/exec_machdep.c b/sys/amd64/amd64/exec_machdep.c index 168c24cbb65b..d605f080871a 100644 --- a/sys/amd64/amd64/exec_machdep.c +++ b/sys/amd64/amd64/exec_machdep.c @@ -197,9 +197,8 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) (xfpusave != NULL && copyout(xfpusave, (void *)sf.sf_uc.uc_mcontext.mc_xfpustate, xfpusave_len) != 0)) { -#ifdef DEBUG - printf("process %ld has trashed its stack\n", (long)p->p_pid); -#endif + uprintf("pid %d comm %s has trashed its stack, killing\n", + p->p_pid, p->p_comm); PROC_LOCK(p); sigexit(td, SIGILL); } diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index d6f2ec2ab832..b7aedff23536 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -556,7 +556,8 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) * one less debugger trap, so allowing it is fairly harmless. */ if (!EFL_SECURE(rflags & ~PSL_RF, regs->tf_rflags & ~PSL_RF)) { - printf("linux_rt_sigreturn: rflags = 0x%lx\n", rflags); + uprintf("pid %d comm %s linux mangled rflags %#lx\n", + p->p_pid, p->p_comm, rflags); return (EINVAL); } @@ -566,7 +567,8 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) * other selectors, invalid %eip's and invalid %esp's. */ if (!CS_SECURE(context->sc_cs)) { - printf("linux_rt_sigreturn: cs = 0x%x\n", context->sc_cs); + uprintf("pid %d comm %s linux mangled cs %#x\n", + p->p_pid, p->p_comm, context->sc_cs); ksiginfo_init_trap(&ksi); ksi.ksi_signo = SIGBUS; ksi.ksi_code = BUS_OBJERR; From owner-dev-commits-src-all@freebsd.org Tue Sep 21 17:21:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0CFB2677A01; Tue, 21 Sep 2021 17:21:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDSrX1XPxz3Nmt; Tue, 21 Sep 2021 17:21:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF01E27AFB; Tue, 21 Sep 2021 17:21:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LHLFK4028928; Tue, 21 Sep 2021 17:21:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LHLFWM028927; Tue, 21 Sep 2021 17:21:15 GMT (envelope-from git) Date: Tue, 21 Sep 2021 17:21:15 GMT Message-Id: <202109211721.18LHLFWM028927@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: df8dd6025af8 - main - amd64: stop using top of the thread' kernel stack for FPU user save area MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: df8dd6025af88a99d34f549fa9591a9b8f9b75b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 17:21:18 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=df8dd6025af88a99d34f549fa9591a9b8f9b75b1 commit df8dd6025af88a99d34f549fa9591a9b8f9b75b1 Author: Konstantin Belousov AuthorDate: 2021-09-13 21:05:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 17:20:15 +0000 amd64: stop using top of the thread' kernel stack for FPU user save area Instead do one more allocation at the thread creation time. This frees a lot of space on the stack. Also do not use alloca() for temporal storage in signal delivery sendsig() function and signal return syscall sys_sigreturn(). This saves equal amount of space, again by the cost of one more allocation at the thread creation time. A useful experiment now would be to reduce KSTACK_PAGES. Reviewed by: jhb, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31954 --- sys/amd64/amd64/exec_machdep.c | 4 ++-- sys/amd64/amd64/fpu.c | 2 ++ sys/amd64/amd64/machdep.c | 14 -------------- sys/amd64/amd64/vm_machdep.c | 22 +++++++++++++--------- sys/amd64/ia32/ia32_signal.c | 6 +++--- sys/amd64/include/proc.h | 2 ++ sys/kern/kern_thread.c | 2 +- 7 files changed, 23 insertions(+), 29 deletions(-) diff --git a/sys/amd64/amd64/exec_machdep.c b/sys/amd64/amd64/exec_machdep.c index 1297117638d6..48bda05f9685 100644 --- a/sys/amd64/amd64/exec_machdep.c +++ b/sys/amd64/amd64/exec_machdep.c @@ -135,7 +135,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); - xfpusave = __builtin_alloca(xfpusave_len); + xfpusave = (char *)td->td_md.md_fpu_scratch; } else { xfpusave_len = 0; xfpusave = NULL; @@ -674,7 +674,7 @@ set_mcontext(struct thread *td, mcontext_t *mcp) if (mcp->mc_xfpustate_len > cpu_max_ext_state_size - sizeof(struct savefpu)) return (EINVAL); - xfpustate = __builtin_alloca(mcp->mc_xfpustate_len); + xfpustate = (char *)td->td_md.md_fpu_scratch; ret = copyin((void *)mcp->mc_xfpustate, xfpustate, mcp->mc_xfpustate_len); if (ret != 0) diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index d7936b3b1922..24986958d4ca 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -448,6 +448,8 @@ fpuinitstate(void *arg __unused) xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO); } + cpu_thread_alloc(&thread0); + saveintr = intr_disable(); stop_emulating(); diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index d4e2356a9ae1..5c9b64526609 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1258,7 +1258,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) caddr_t kmdp; int gsel_tss, x; struct pcpu *pc; - struct xstate_hdr *xhdr; uint64_t cr3, rsp0; pml4_entry_t *pml4e; pdp_entry_t *pdpe; @@ -1564,19 +1563,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) msgbufinit(msgbufp, msgbufsize); fpuinit(); - /* - * Reinitialize thread0's stack base now that the xsave area size is - * known. Set up thread0's pcb save area after fpuinit calculated fpu - * save area size. Zero out the extended state header in fpu save area. - */ - set_top_of_stack_td(&thread0); - thread0.td_pcb->pcb_save = get_pcb_user_save_td(&thread0); - bzero(thread0.td_pcb->pcb_save, cpu_max_ext_state_size); - if (use_xsave) { - xhdr = (struct xstate_hdr *)(get_pcb_user_save_td(&thread0) + - 1); - xhdr->xstate_bv = xsave_mask; - } /* make an initial tss so cpu can get interrupt stack on syscall! */ rsp0 = thread0.td_md.md_stack_base; /* Ensure the stack is aligned to 16 bytes */ diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 4567e6e0eb5d..e42d16d61b3a 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -90,19 +90,17 @@ void set_top_of_stack_td(struct thread *td) { td->td_md.md_stack_base = td->td_kstack + - td->td_kstack_pages * PAGE_SIZE - - roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN); + td->td_kstack_pages * PAGE_SIZE; } struct savefpu * get_pcb_user_save_td(struct thread *td) { - vm_offset_t p; - - p = td->td_md.md_stack_base; - KASSERT((p % XSAVE_AREA_ALIGN) == 0, - ("Unaligned pcb_user_save area ptr %#lx td %p", p, td)); - return ((struct savefpu *)p); + KASSERT(((vm_offset_t)td->td_md.md_usr_fpu_save % + XSAVE_AREA_ALIGN) == 0, + ("Unaligned pcb_user_save area ptr %p td %p", + td->td_md.md_usr_fpu_save, td)); + return (td->td_md.md_usr_fpu_save); } struct pcb * @@ -393,6 +391,8 @@ cpu_thread_alloc(struct thread *td) set_top_of_stack_td(td); td->td_pcb = pcb = get_pcb_td(td); td->td_frame = (struct trapframe *)td->td_md.md_stack_base - 1; + td->td_md.md_usr_fpu_save = fpu_save_area_alloc(); + td->td_md.md_fpu_scratch = fpu_save_area_alloc(); pcb->pcb_save = get_pcb_user_save_pcb(pcb); if (use_xsave) { xhdr = (struct xstate_hdr *)(pcb->pcb_save + 1); @@ -404,8 +404,12 @@ cpu_thread_alloc(struct thread *td) void cpu_thread_free(struct thread *td) { - cpu_thread_clean(td); + + fpu_save_area_free(td->td_md.md_usr_fpu_save); + td->td_md.md_usr_fpu_save = NULL; + fpu_save_area_free(td->td_md.md_fpu_scratch); + td->td_md.md_fpu_scratch = NULL; } bool diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c index 49b5797d68fd..9b67c7001a87 100644 --- a/sys/amd64/ia32/ia32_signal.c +++ b/sys/amd64/ia32/ia32_signal.c @@ -210,7 +210,7 @@ ia32_set_mcontext(struct thread *td, struct ia32_mcontext *mcp) if (mcp->mc_xfpustate_len > cpu_max_ext_state_size - sizeof(struct savefpu)) return (EINVAL); - xfpustate = __builtin_alloca(mcp->mc_xfpustate_len); + xfpustate = (char *)td->td_md.md_fpu_scratch; ret = copyin(PTRIN(mcp->mc_xfpustate), xfpustate, mcp->mc_xfpustate_len); if (ret != 0) @@ -579,7 +579,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); - xfpusave = __builtin_alloca(xfpusave_len); + xfpusave = (char *)td->td_md.md_fpu_scratch; } else { xfpusave_len = 0; xfpusave = NULL; @@ -882,7 +882,7 @@ freebsd32_sigreturn(td, uap) td->td_proc->p_pid, td->td_name, xfpustate_len); return (EINVAL); } - xfpustate = __builtin_alloca(xfpustate_len); + xfpustate = (char *)td->td_md.md_fpu_scratch; error = copyin(PTRIN(ucp->uc_mcontext.mc_xfpustate), xfpustate, xfpustate_len); if (error != 0) { diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h index 0f8cf50e326d..bd07f70f8d44 100644 --- a/sys/amd64/include/proc.h +++ b/sys/amd64/include/proc.h @@ -75,6 +75,8 @@ struct mdthread { int md_efirt_dis_pf; /* (k) */ struct pcb md_pcb; vm_offset_t md_stack_base; + struct savefpu *md_usr_fpu_save; + struct savefpu *md_fpu_scratch; }; struct mdproc { diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 65c5cc65c87e..62f939406374 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -91,7 +91,7 @@ _Static_assert(offsetof(struct thread, td_pflags) == 0x110, "struct thread KBI td_pflags"); _Static_assert(offsetof(struct thread, td_frame) == 0x4a8, "struct thread KBI td_frame"); -_Static_assert(offsetof(struct thread, td_emuldata) == 0x6b0, +_Static_assert(offsetof(struct thread, td_emuldata) == 0x6c0, "struct thread KBI td_emuldata"); _Static_assert(offsetof(struct proc, p_flag) == 0xb8, "struct proc KBI p_flag"); From owner-dev-commits-src-all@freebsd.org Tue Sep 21 17:21:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07C5F677820; Tue, 21 Sep 2021 17:21:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDSrY1ZRpz3Npy; Tue, 21 Sep 2021 17:21:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED7E627D3A; Tue, 21 Sep 2021 17:21:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LHLGEC028953; Tue, 21 Sep 2021 17:21:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LHLGn6028952; Tue, 21 Sep 2021 17:21:16 GMT (envelope-from git) Date: Tue, 21 Sep 2021 17:21:16 GMT Message-Id: <202109211721.18LHLGn6028952@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: bd9e0f5df681 - main - amd64: eliminate td_md.md_fpu_scratch MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd9e0f5df681da8b5ef05a587b4b5b07572d3fc2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 17:21:21 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bd9e0f5df681da8b5ef05a587b4b5b07572d3fc2 commit bd9e0f5df681da8b5ef05a587b4b5b07572d3fc2 Author: Konstantin Belousov AuthorDate: 2021-09-15 18:37:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 17:20:15 +0000 amd64: eliminate td_md.md_fpu_scratch For signal send, copyout from the user FPU save area directly. For sigreturn, we are in sleepable context and can do temporal allocation of the transient save area. We cannot copying from userspace directly to user save area because XSAVE state needs to be validated, also partial copyins can corrupt it. Requested by: jhb Reviewed by: jhb, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31954 --- sys/amd64/amd64/exec_machdep.c | 47 +++++++++++++++++++----------------------- sys/amd64/amd64/vm_machdep.c | 3 --- sys/amd64/ia32/ia32_signal.c | 43 ++++++++++++++++---------------------- sys/amd64/include/proc.h | 1 - sys/kern/kern_thread.c | 2 +- 5 files changed, 40 insertions(+), 56 deletions(-) diff --git a/sys/amd64/amd64/exec_machdep.c b/sys/amd64/amd64/exec_machdep.c index 48bda05f9685..168c24cbb65b 100644 --- a/sys/amd64/amd64/exec_machdep.c +++ b/sys/amd64/amd64/exec_machdep.c @@ -96,7 +96,7 @@ __FBSDID("$FreeBSD$"); #include static void get_fpcontext(struct thread *td, mcontext_t *mcp, - char *xfpusave, size_t xfpusave_len); + char **xfpusave, size_t *xfpusave_len); static int set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate, size_t xfpustate_len); @@ -133,14 +133,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) regs = td->td_frame; oonstack = sigonstack(regs->tf_rsp); - if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { - xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); - xfpusave = (char *)td->td_md.md_fpu_scratch; - } else { - xfpusave_len = 0; - xfpusave = NULL; - } - /* Save user context. */ bzero(&sf, sizeof(sf)); sf.sf_uc.uc_sigmask = *mask; @@ -150,7 +142,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0; bcopy(regs, &sf.sf_uc.uc_mcontext.mc_rdi, sizeof(*regs)); sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ - get_fpcontext(td, &sf.sf_uc.uc_mcontext, xfpusave, xfpusave_len); + get_fpcontext(td, &sf.sf_uc.uc_mcontext, &xfpusave, &xfpusave_len); fpstate_drop(td); update_pcb_bases(pcb); sf.sf_uc.uc_mcontext.mc_fsbase = pcb->pcb_fsbase; @@ -301,10 +293,11 @@ sys_sigreturn(struct thread *td, struct sigreturn_args *uap) p->p_pid, td->td_name, xfpustate_len); return (EINVAL); } - xfpustate = __builtin_alloca(xfpustate_len); + xfpustate = (char *)fpu_save_area_alloc(); error = copyin((const void *)uc.uc_mcontext.mc_xfpustate, xfpustate, xfpustate_len); if (error != 0) { + fpu_save_area_free((struct savefpu *)xfpustate); uprintf( "pid %d (%s): sigreturn copying xfpustate failed\n", p->p_pid, td->td_name); @@ -315,6 +308,7 @@ sys_sigreturn(struct thread *td, struct sigreturn_args *uap) xfpustate_len = 0; } ret = set_fpcontext(td, &ucp->uc_mcontext, xfpustate, xfpustate_len); + fpu_save_area_free((struct savefpu *)xfpustate); if (ret != 0) { uprintf("pid %d (%s): sigreturn set_fpcontext err %d\n", p->p_pid, td->td_name, ret); @@ -674,14 +668,17 @@ set_mcontext(struct thread *td, mcontext_t *mcp) if (mcp->mc_xfpustate_len > cpu_max_ext_state_size - sizeof(struct savefpu)) return (EINVAL); - xfpustate = (char *)td->td_md.md_fpu_scratch; + xfpustate = (char *)fpu_save_area_alloc(); ret = copyin((void *)mcp->mc_xfpustate, xfpustate, mcp->mc_xfpustate_len); - if (ret != 0) + if (ret != 0) { + fpu_save_area_free((struct savefpu *)xfpustate); return (ret); + } } else xfpustate = NULL; ret = set_fpcontext(td, mcp, xfpustate, mcp->mc_xfpustate_len); + fpu_save_area_free((struct savefpu *)xfpustate); if (ret != 0) return (ret); tp->tf_r15 = mcp->mc_r15; @@ -719,26 +716,24 @@ set_mcontext(struct thread *td, mcontext_t *mcp) } static void -get_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpusave, - size_t xfpusave_len) +get_fpcontext(struct thread *td, mcontext_t *mcp, char **xfpusave, + size_t *xfpusave_len) { - size_t max_len, len; - mcp->mc_ownedfp = fpugetregs(td); bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], sizeof(mcp->mc_fpstate)); mcp->mc_fpformat = fpuformat(); - if (!use_xsave || xfpusave_len == 0) + if (xfpusave == NULL) return; - max_len = cpu_max_ext_state_size - sizeof(struct savefpu); - len = xfpusave_len; - if (len > max_len) { - len = max_len; - bzero(xfpusave + max_len, len - max_len); + if (!use_xsave || cpu_max_ext_state_size <= sizeof(struct savefpu)) { + *xfpusave_len = 0; + *xfpusave = NULL; + } else { + mcp->mc_flags |= _MC_HASFPXSTATE; + *xfpusave_len = mcp->mc_xfpustate_len = + cpu_max_ext_state_size - sizeof(struct savefpu); + *xfpusave = (char *)(get_pcb_user_save_td(td) + 1); } - mcp->mc_flags |= _MC_HASFPXSTATE; - mcp->mc_xfpustate_len = len; - bcopy(get_pcb_user_save_td(td) + 1, xfpusave, len); } static int diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index e42d16d61b3a..0bfcd03d6655 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -392,7 +392,6 @@ cpu_thread_alloc(struct thread *td) td->td_pcb = pcb = get_pcb_td(td); td->td_frame = (struct trapframe *)td->td_md.md_stack_base - 1; td->td_md.md_usr_fpu_save = fpu_save_area_alloc(); - td->td_md.md_fpu_scratch = fpu_save_area_alloc(); pcb->pcb_save = get_pcb_user_save_pcb(pcb); if (use_xsave) { xhdr = (struct xstate_hdr *)(pcb->pcb_save + 1); @@ -408,8 +407,6 @@ cpu_thread_free(struct thread *td) fpu_save_area_free(td->td_md.md_usr_fpu_save); td->td_md.md_usr_fpu_save = NULL; - fpu_save_area_free(td->td_md.md_fpu_scratch); - td->td_md.md_fpu_scratch = NULL; } bool diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c index 9b67c7001a87..1ca19072a1dc 100644 --- a/sys/amd64/ia32/ia32_signal.c +++ b/sys/amd64/ia32/ia32_signal.c @@ -87,10 +87,8 @@ static void freebsd4_ia32_sendsig(sig_t, ksiginfo_t *, sigset_t *); static void ia32_get_fpcontext(struct thread *td, struct ia32_mcontext *mcp, - char *xfpusave, size_t xfpusave_len) + char **xfpusave, size_t *xfpusave_len) { - size_t max_len, len; - /* * XXX Format of 64bit and 32bit FXSAVE areas differs. FXSAVE * in 32bit mode saves %cs and %ds, while on 64bit it saves @@ -101,17 +99,15 @@ ia32_get_fpcontext(struct thread *td, struct ia32_mcontext *mcp, bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], sizeof(mcp->mc_fpstate)); mcp->mc_fpformat = fpuformat(); - if (!use_xsave || xfpusave_len == 0) - return; - max_len = cpu_max_ext_state_size - sizeof(struct savefpu); - len = xfpusave_len; - if (len > max_len) { - len = max_len; - bzero(xfpusave + max_len, len - max_len); + if (!use_xsave || cpu_max_ext_state_size <= sizeof(struct savefpu)) { + *xfpusave_len = 0; + *xfpusave = NULL; + } else { + mcp->mc_flags |= _MC_IA32_HASFPXSTATE; + *xfpusave_len = mcp->mc_xfpustate_len = + cpu_max_ext_state_size - sizeof(struct savefpu); + *xfpusave = (char *)(get_pcb_user_save_td(td) + 1); } - mcp->mc_flags |= _MC_IA32_HASFPXSTATE; - mcp->mc_xfpustate_len = len; - bcopy(get_pcb_user_save_td(td) + 1, xfpusave, len); } static int @@ -210,14 +206,17 @@ ia32_set_mcontext(struct thread *td, struct ia32_mcontext *mcp) if (mcp->mc_xfpustate_len > cpu_max_ext_state_size - sizeof(struct savefpu)) return (EINVAL); - xfpustate = (char *)td->td_md.md_fpu_scratch; + xfpustate = (char *)fpu_save_area_alloc(); ret = copyin(PTRIN(mcp->mc_xfpustate), xfpustate, mcp->mc_xfpustate_len); - if (ret != 0) + if (ret != 0) { + fpu_save_area_free((struct savefpu *)xfpustate); return (ret); + } } else xfpustate = NULL; ret = ia32_set_fpcontext(td, mcp, xfpustate, mcp->mc_xfpustate_len); + fpu_save_area_free((struct savefpu *)xfpustate); if (ret != 0) return (ret); tp->tf_gs = mcp->mc_gs; @@ -577,14 +576,6 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) regs = td->td_frame; oonstack = sigonstack(regs->tf_rsp); - if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { - xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); - xfpusave = (char *)td->td_md.md_fpu_scratch; - } else { - xfpusave_len = 0; - xfpusave = NULL; - } - /* Save user context. */ bzero(&sf, sizeof(sf)); sf.sf_uc.uc_sigmask = *mask; @@ -613,7 +604,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) sf.sf_uc.uc_mcontext.mc_fs = regs->tf_fs; sf.sf_uc.uc_mcontext.mc_gs = regs->tf_gs; sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ - ia32_get_fpcontext(td, &sf.sf_uc.uc_mcontext, xfpusave, xfpusave_len); + ia32_get_fpcontext(td, &sf.sf_uc.uc_mcontext, &xfpusave, &xfpusave_len); fpstate_drop(td); sf.sf_uc.uc_mcontext.mc_fsbase = td->td_pcb->pcb_fsbase; sf.sf_uc.uc_mcontext.mc_gsbase = td->td_pcb->pcb_gsbase; @@ -882,10 +873,11 @@ freebsd32_sigreturn(td, uap) td->td_proc->p_pid, td->td_name, xfpustate_len); return (EINVAL); } - xfpustate = (char *)td->td_md.md_fpu_scratch; + xfpustate = (char *)fpu_save_area_alloc(); error = copyin(PTRIN(ucp->uc_mcontext.mc_xfpustate), xfpustate, xfpustate_len); if (error != 0) { + fpu_save_area_free((struct savefpu *)xfpustate); uprintf( "pid %d (%s): sigreturn copying xfpustate failed\n", td->td_proc->p_pid, td->td_name); @@ -897,6 +889,7 @@ freebsd32_sigreturn(td, uap) } ret = ia32_set_fpcontext(td, &ucp->uc_mcontext, xfpustate, xfpustate_len); + fpu_save_area_free((struct savefpu *)xfpustate); if (ret != 0) { uprintf("pid %d (%s): sigreturn set_fpcontext err %d\n", td->td_proc->p_pid, td->td_name, ret); diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h index bd07f70f8d44..94ac69d31e65 100644 --- a/sys/amd64/include/proc.h +++ b/sys/amd64/include/proc.h @@ -76,7 +76,6 @@ struct mdthread { struct pcb md_pcb; vm_offset_t md_stack_base; struct savefpu *md_usr_fpu_save; - struct savefpu *md_fpu_scratch; }; struct mdproc { diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 62f939406374..65c5cc65c87e 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -91,7 +91,7 @@ _Static_assert(offsetof(struct thread, td_pflags) == 0x110, "struct thread KBI td_pflags"); _Static_assert(offsetof(struct thread, td_frame) == 0x4a8, "struct thread KBI td_frame"); -_Static_assert(offsetof(struct thread, td_emuldata) == 0x6c0, +_Static_assert(offsetof(struct thread, td_emuldata) == 0x6b0, "struct thread KBI td_emuldata"); _Static_assert(offsetof(struct proc, p_flag) == 0xb8, "struct proc KBI p_flag"); From owner-dev-commits-src-all@freebsd.org Tue Sep 21 17:52:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 605EE67832B; Tue, 21 Sep 2021 17:52: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 4HDTXj2GwPz3jrN; Tue, 21 Sep 2021 17:52: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 2430569A; Tue, 21 Sep 2021 17:52: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 18LHqbLG069785; Tue, 21 Sep 2021 17:52:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LHqbM3069784; Tue, 21 Sep 2021 17:52:37 GMT (envelope-from git) Date: Tue, 21 Sep 2021 17:52:37 GMT Message-Id: <202109211752.18LHqbM3069784@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: bcdc599dc2a1 - main - Revert "cpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use it" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bcdc599dc2a187052cb13e18f22d3f0c655f95e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 17:52:37 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bcdc599dc2a187052cb13e18f22d3f0c655f95e6 commit bcdc599dc2a187052cb13e18f22d3f0c655f95e6 Author: Mark Johnston AuthorDate: 2021-09-21 17:51:42 +0000 Commit: Mark Johnston CommitDate: 2021-09-21 17:51:42 +0000 Revert "cpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use it" This reverts commit 9068f6ea697b1b28ad1326a4c7a9ba86f08b985e. The underlying macro needs to be reworked to avoid problems with control flow statements. Reported by: rlibby --- sys/amd64/amd64/mp_machdep.c | 11 ++++++++--- sys/amd64/vmm/io/vlapic.c | 13 ++++++++++--- sys/amd64/vmm/vmm_lapic.c | 4 +++- sys/i386/i386/mp_machdep.c | 4 +++- sys/sys/cpuset.h | 2 -- sys/x86/x86/mp_x86.c | 4 +++- 6 files changed, 27 insertions(+), 11 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 16ec277e9c34..6c66bd622855 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -618,7 +618,7 @@ static void smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1, vm_offset_t addr2, smp_invl_cb_t curcpu_cb, enum invl_op_codes op) { - cpuset_t other_cpus; + cpuset_t other_cpus, mask1; uint32_t generation, *p_cpudone; int cpu; bool is_all; @@ -662,7 +662,10 @@ smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1, /* Fence between filling smp_tlb fields and clearing scoreboard. */ atomic_thread_fence_rel(); - CPU_FOREACH_ISSET(cpu, &mask) { + mask1 = mask; + while ((cpu = CPU_FFS(&mask1)) != 0) { + cpu--; + CPU_CLR(cpu, &mask1); KASSERT(*invl_scoreboard_slot(cpu) != 0, ("IPI scoreboard is zero, initiator %d target %d", PCPU_GET(cpuid), cpu)); @@ -683,7 +686,9 @@ smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1, ipi_selected(mask, IPI_INVLOP); } curcpu_cb(pmap, addr1, addr2); - CPU_FOREACH_ISSET(cpu, &other_cpus) { + while ((cpu = CPU_FFS(&other_cpus)) != 0) { + cpu--; + CPU_CLR(cpu, &other_cpus); p_cpudone = invl_scoreboard_slot(cpu); while (atomic_load_int(p_cpudone) != generation) ia32_pause(); diff --git a/sys/amd64/vmm/io/vlapic.c b/sys/amd64/vmm/io/vlapic.c index 4e7ddbafd447..06df1c1a87e5 100644 --- a/sys/amd64/vmm/io/vlapic.c +++ b/sys/amd64/vmm/io/vlapic.c @@ -860,7 +860,10 @@ vlapic_calcdest(struct vm *vm, cpuset_t *dmask, uint32_t dest, bool phys, */ CPU_ZERO(dmask); amask = vm_active_cpus(vm); - CPU_FOREACH_ISSET(vcpuid, &amask) { + while ((vcpuid = CPU_FFS(&amask)) != 0) { + vcpuid--; + CPU_CLR(vcpuid, &amask); + vlapic = vm_lapic(vm, vcpuid); dfr = vlapic->apic_page->dfr; ldr = vlapic->apic_page->ldr; @@ -1000,7 +1003,9 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool *retu) break; } - CPU_FOREACH_ISSET(i, &dmask) { + while ((i = CPU_FFS(&dmask)) != 0) { + i--; + CPU_CLR(i, &dmask); if (mode == APIC_DELMODE_FIXED) { lapic_intr_edge(vlapic->vm, i, vec); vmm_stat_array_incr(vlapic->vm, vlapic->vcpuid, @@ -1549,7 +1554,9 @@ vlapic_deliver_intr(struct vm *vm, bool level, uint32_t dest, bool phys, */ vlapic_calcdest(vm, &dmask, dest, phys, lowprio, false); - CPU_FOREACH_ISSET(vcpuid, &dmask) { + while ((vcpuid = CPU_FFS(&dmask)) != 0) { + vcpuid--; + CPU_CLR(vcpuid, &dmask); if (delmode == IOART_DELEXINT) { vm_inject_extint(vm, vcpuid); } else { diff --git a/sys/amd64/vmm/vmm_lapic.c b/sys/amd64/vmm/vmm_lapic.c index 8191da758100..89a1ebc8eff9 100644 --- a/sys/amd64/vmm/vmm_lapic.c +++ b/sys/amd64/vmm/vmm_lapic.c @@ -87,7 +87,9 @@ lapic_set_local_intr(struct vm *vm, int cpu, int vector) else CPU_SETOF(cpu, &dmask); error = 0; - CPU_FOREACH_ISSET(cpu, &dmask) { + while ((cpu = CPU_FFS(&dmask)) != 0) { + cpu--; + CPU_CLR(cpu, &dmask); vlapic = vm_lapic(vm, cpu); error = vlapic_trigger_lvt(vlapic, vector); if (error) diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index 777aefa021b3..156702118c45 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -598,7 +598,9 @@ smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector, pmap_t pmap, ipi_selected(mask, vector); } curcpu_cb(pmap, addr1, addr2); - CPU_FOREACH_ISSET(cpu, &other_cpus) { + while ((cpu = CPU_FFS(&other_cpus)) != 0) { + cpu--; + CPU_CLR(cpu, &other_cpus); p_cpudone = &cpuid_to_pcpu[cpu]->pc_smp_tlb_done; while (*p_cpudone != generation) ia32_pause(); diff --git a/sys/sys/cpuset.h b/sys/sys/cpuset.h index 9ef1a65f4506..1a96bb4766ce 100644 --- a/sys/sys/cpuset.h +++ b/sys/sys/cpuset.h @@ -66,8 +66,6 @@ #define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t) #define CPU_FFS(p) BIT_FFS(CPU_SETSIZE, p) #define CPU_FLS(p) BIT_FLS(CPU_SETSIZE, p) -#define CPU_FOREACH_ISSET(i, p) BIT_FOREACH_ISSET(CPU_SETSIZE, i, p) -#define CPU_FOREACH_ISCLR(i, p) BIT_FOREACH_ISCLR(CPU_SETSIZE, i, p) #define CPU_COUNT(p) ((int)BIT_COUNT(CPU_SETSIZE, p)) #define CPUSET_FSET BITSET_FSET(_NCPUWORDS) #define CPUSET_T_INITIALIZER BITSET_T_INITIALIZER diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index 09d05d3f6de4..5e9a9735b09a 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -1290,7 +1290,9 @@ ipi_selected(cpuset_t cpus, u_int ipi) if (ipi == IPI_STOP_HARD) CPU_OR_ATOMIC(&ipi_stop_nmi_pending, &cpus); - CPU_FOREACH_ISSET(cpu, &cpus) { + while ((cpu = CPU_FFS(&cpus)) != 0) { + cpu--; + CPU_CLR(cpu, &cpus); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); ipi_send_cpu(cpu, ipi); } From owner-dev-commits-src-all@freebsd.org Tue Sep 21 18:18:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 991266787B8; Tue, 21 Sep 2021 18:18: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 4HDV6W3sPFz3ml3; Tue, 21 Sep 2021 18:18: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 65641C31; Tue, 21 Sep 2021 18:18: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 18LIIRqe098064; Tue, 21 Sep 2021 18:18:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LIIRxw098063; Tue, 21 Sep 2021 18:18:27 GMT (envelope-from git) Date: Tue, 21 Sep 2021 18:18:27 GMT Message-Id: <202109211818.18LIIRxw098063@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: b2cfac207d60 - stable/13 - compiler-rt: add aarch64 init function for LSE atomics MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b2cfac207d60904b3a4738224361b8bf157724bb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 18:18:27 -0000 The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=b2cfac207d60904b3a4738224361b8bf157724bb commit b2cfac207d60904b3a4738224361b8bf157724bb Author: Dimitry Andric AuthorDate: 2021-09-06 19:23:10 +0000 Commit: Dimitry Andric CommitDate: 2021-09-21 18:17:05 +0000 compiler-rt: add aarch64 init function for LSE atomics As reported by Ronald, adding the out-of-line LSE atomics helpers for aarch64 to compiler-rt was not sufficient to link programs using these, as they also require a __aarch64_have_lse_atomics global. This is initialized in compiler-rt's lib/builtins/cpu_model.c, roughly similar to the x86 CPU model and feature detection in that file. Since upstream does not yet have a FreeBSD specific implementation for getting the required information, add a simple one that should work for now, while I try to get it sorted with the LLVM people. Reported by: Ronald Klop Fixes: cc55ee8009a5 PR: 257392 (cherry picked from commit efe67f33c322265eb303ec0ab40275100795b22a) --- contrib/llvm-project/compiler-rt/lib/builtins/cpu_model.c | 6 ++++++ lib/libcompiler_rt/Makefile.inc | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model.c b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model.c index 51bedd98c3d3..13cfeb05dcb8 100644 --- a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model.c +++ b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model.c @@ -775,8 +775,14 @@ _Bool __aarch64_have_lse_atomics #define HWCAP_ATOMICS (1 << 8) #endif static void CONSTRUCTOR_ATTRIBUTE init_have_lse_atomics(void) { +#if defined(__FreeBSD__) + unsigned long hwcap; + int result = elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap); + __aarch64_have_lse_atomics = result == 0 && (hwcap & HWCAP_ATOMICS) != 0; +#else unsigned long hwcap = getauxval(AT_HWCAP); __aarch64_have_lse_atomics = (hwcap & HWCAP_ATOMICS) != 0; +#endif } #endif // defined(__has_include) #endif // __has_include() diff --git a/lib/libcompiler_rt/Makefile.inc b/lib/libcompiler_rt/Makefile.inc index aa0a6a6c9e69..06d662e38d82 100644 --- a/lib/libcompiler_rt/Makefile.inc +++ b/lib/libcompiler_rt/Makefile.inc @@ -146,8 +146,9 @@ SRCF+= floatundisf SRCF+= floatundixf .endif -# __cpu_model support, only used on x86 -.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" +# __cpu_model support, only used on aarch64 and x86 +.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ + ${MACHINE_CPUARCH} == "i386" SRCF+= cpu_model .endif From owner-dev-commits-src-all@freebsd.org Tue Sep 21 20:01:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5D2967A30A; Tue, 21 Sep 2021 20:01: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 4HDXPG4K6kz4RPW; Tue, 21 Sep 2021 20:01: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 7610022FE; Tue, 21 Sep 2021 20:01: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 18LK1MQQ041927; Tue, 21 Sep 2021 20:01:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LK1MmF041926; Tue, 21 Sep 2021 20:01:22 GMT (envelope-from git) Date: Tue, 21 Sep 2021 20:01:22 GMT Message-Id: <202109212001.18LK1MmF041926@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 4f917847c903 - main - fusefs: don't panic if FUSE_GETATTR fails durint VOP_GETPAGES MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4f917847c9037d9b76de188c03e13b81224431b2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 20:01:22 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=4f917847c9037d9b76de188c03e13b81224431b2 commit 4f917847c9037d9b76de188c03e13b81224431b2 Author: Alan Somers AuthorDate: 2021-09-16 19:19:21 +0000 Commit: Alan Somers CommitDate: 2021-09-21 20:01:06 +0000 fusefs: don't panic if FUSE_GETATTR fails durint VOP_GETPAGES During VOP_GETPAGES, fusefs needs to determine the file's length, which could require a FUSE_GETATTR operation. If that fails, it's better to SIGBUS than panic. MFC after: 1 week Sponsored by: Axcient Reviewed by: markj, kib Differential Revision: https://reviews.freebsd.org/D31994 --- sys/fs/fuse/fuse_vnops.c | 20 +++--- tests/sys/fs/fusefs/read.cc | 156 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 165 insertions(+), 11 deletions(-) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index 1216c1252f2b..4c8c8c1d4461 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -2199,25 +2199,23 @@ fuse_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) } static int -fuse_gbp_getblksz(struct vnode *vp, daddr_t lbn, long *sz) +fuse_gbp_getblksz(struct vnode *vp, daddr_t lbn, long *blksz) { off_t filesize; - int blksz, err; + int err; const int biosize = fuse_iosize(vp); err = fuse_vnode_size(vp, &filesize, NULL, NULL); - KASSERT(err == 0, ("vfs_bio_getpages can't handle errors here")); - if (err) - return biosize; - - if ((off_t)lbn * biosize >= filesize) { - blksz = 0; + if (err) { + /* This will turn into a SIGBUS */ + return (EIO); + } else if ((off_t)lbn * biosize >= filesize) { + *blksz = 0; } else if ((off_t)(lbn + 1) * biosize > filesize) { - blksz = filesize - (off_t)lbn *biosize; + *blksz = filesize - (off_t)lbn *biosize; } else { - blksz = biosize; + *blksz = biosize; } - *sz = blksz; return (0); } diff --git a/tests/sys/fs/fusefs/read.cc b/tests/sys/fs/fusefs/read.cc index 22a26c2701fd..cb82d0a43b06 100644 --- a/tests/sys/fs/fusefs/read.cc +++ b/tests/sys/fs/fusefs/read.cc @@ -40,6 +40,8 @@ extern "C" { #include #include #include +#include +#include #include } @@ -103,6 +105,33 @@ class ReadAhead: public Read, } }; +class ReadSigbus: public Read +{ +public: +static jmp_buf s_jmpbuf; +static sig_atomic_t s_si_addr; + +void TearDown() { + struct sigaction sa; + + bzero(&sa, sizeof(sa)); + sa.sa_handler = SIG_DFL; + sigaction(SIGBUS, &sa, NULL); + + FuseTest::TearDown(); +} + +}; + +static void +handle_sigbus(int signo __unused, siginfo_t *info, void *uap __unused) { + ReadSigbus::s_si_addr = (sig_atomic_t)info->si_addr; + longjmp(ReadSigbus::s_jmpbuf, 1); +} + +jmp_buf ReadSigbus::s_jmpbuf; +sig_atomic_t ReadSigbus::s_si_addr; + /* AIO reads need to set the header's pid field correctly */ /* https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236379 */ TEST_F(AioRead, aio_read) @@ -584,6 +613,56 @@ TEST_F(Read, mmap) leak(fd); } +/* Read of an mmap()ed file fails */ +TEST_F(ReadSigbus, mmap_eio) +{ + const char FULLPATH[] = "mountpoint/some_file.txt"; + const char RELPATH[] = "some_file.txt"; + const char *CONTENTS = "abcdefgh"; + struct sigaction sa; + uint64_t ino = 42; + int fd; + ssize_t len; + size_t bufsize = strlen(CONTENTS); + void *p; + + len = getpagesize(); + + expect_lookup(RELPATH, ino, bufsize); + expect_open(ino, 0, 1); + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_READ && + in.header.nodeid == ino && + in.body.read.fh == Read::FH); + }, Eq(true)), + _) + ).WillRepeatedly(Invoke(ReturnErrno(EIO))); + + fd = open(FULLPATH, O_RDONLY); + ASSERT_LE(0, fd) << strerror(errno); + + p = mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0); + ASSERT_NE(MAP_FAILED, p) << strerror(errno); + + /* Accessing the mapped page should return SIGBUS. */ + + bzero(&sa, sizeof(sa)); + sa.sa_handler = SIG_DFL; + sa.sa_sigaction = handle_sigbus; + sa.sa_flags = SA_RESETHAND | SA_SIGINFO; + ASSERT_EQ(0, sigaction(SIGBUS, &sa, NULL)) << strerror(errno); + if (setjmp(ReadSigbus::s_jmpbuf) == 0) { + atomic_signal_fence(std::memory_order::memory_order_seq_cst); + volatile char x __unused = *(volatile char*)p; + FAIL() << "shouldn't get here"; + } + + ASSERT_EQ(p, (void*)ReadSigbus::s_si_addr); + ASSERT_EQ(0, munmap(p, len)) << strerror(errno); + leak(fd); +} + /* * A read via mmap comes up short, indicating that the file was truncated * server-side. @@ -634,6 +713,83 @@ TEST_F(Read, mmap_eof) leak(fd); } +/* + * During VOP_GETPAGES, the FUSE server fails a FUSE_GETATTR operation. This + * almost certainly indicates a buggy FUSE server, and our goal should be not + * to panic. Instead, generate SIGBUS. + */ +TEST_F(ReadSigbus, mmap_getblksz_fail) +{ + const char FULLPATH[] = "mountpoint/some_file.txt"; + const char RELPATH[] = "some_file.txt"; + const char *CONTENTS = "abcdefgh"; + struct sigaction sa; + Sequence seq; + uint64_t ino = 42; + int fd; + ssize_t len; + size_t bufsize = strlen(CONTENTS); + mode_t mode = S_IFREG | 0644; + void *p; + + len = getpagesize(); + + FuseTest::expect_lookup(RELPATH, ino, mode, bufsize, 1, 0); + /* Expect two GETATTR calls that succeed, followed by one that fail. */ + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_GETATTR && + in.header.nodeid == ino); + }, Eq(true)), + _) + ).Times(2) + .InSequence(seq) + .WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto& out) { + SET_OUT_HEADER_LEN(out, attr); + out.body.attr.attr.ino = ino; + out.body.attr.attr.mode = mode; + out.body.attr.attr.size = bufsize; + out.body.attr.attr_valid = 0; + }))); + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_GETATTR && + in.header.nodeid == ino); + }, Eq(true)), + _) + ).InSequence(seq) + .WillRepeatedly(Invoke(ReturnErrno(EIO))); + expect_open(ino, 0, 1); + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_READ); + }, Eq(true)), + _) + ).Times(0); + + fd = open(FULLPATH, O_RDONLY); + ASSERT_LE(0, fd) << strerror(errno); + + p = mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0); + ASSERT_NE(MAP_FAILED, p) << strerror(errno); + + /* Accessing the mapped page should return SIGBUS. */ + bzero(&sa, sizeof(sa)); + sa.sa_handler = SIG_DFL; + sa.sa_sigaction = handle_sigbus; + sa.sa_flags = SA_RESETHAND | SA_SIGINFO; + ASSERT_EQ(0, sigaction(SIGBUS, &sa, NULL)) << strerror(errno); + if (setjmp(ReadSigbus::s_jmpbuf) == 0) { + atomic_signal_fence(std::memory_order::memory_order_seq_cst); + volatile char x __unused = *(volatile char*)p; + FAIL() << "shouldn't get here"; + } + + ASSERT_EQ(p, (void*)ReadSigbus::s_si_addr); + ASSERT_EQ(0, munmap(p, len)) << strerror(errno); + leak(fd); +} + /* * Just as when FOPEN_DIRECT_IO is used, reads with O_DIRECT should bypass * cache and to straight to the daemon From owner-dev-commits-src-all@freebsd.org Tue Sep 21 20:03:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A22B67A247; Tue, 21 Sep 2021 20:03: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 4HDXRw6rS9z4RvL; Tue, 21 Sep 2021 20:03: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 CA7A82345; Tue, 21 Sep 2021 20:03: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 18LK3e4S047027; Tue, 21 Sep 2021 20:03:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LK3eWu047026; Tue, 21 Sep 2021 20:03:40 GMT (envelope-from git) Date: Tue, 21 Sep 2021 20:03:40 GMT Message-Id: <202109212003.18LK3eWu047026@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: bd84094a51c4 - main - sched_ule(4): Fix interactive threads stealing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd84094a51c4648a7c97ececdaccfb30bc832096 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 20:03:41 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=bd84094a51c4648a7c97ececdaccfb30bc832096 commit bd84094a51c4648a7c97ececdaccfb30bc832096 Author: Alexander Motin AuthorDate: 2021-09-21 19:56:49 +0000 Commit: Alexander Motin CommitDate: 2021-09-21 20:03:32 +0000 sched_ule(4): Fix interactive threads stealing. In scenarios when first thread in the queue can migrate to specified CPU, but later ones can't runq_steal_from() incorrectly returned NULL. MFC after: 2 weeks --- sys/kern/sched_ule.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 9bcc2a64e2b8..90f294bb0d4d 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -1110,10 +1110,12 @@ again: continue; rqh = &rq->rq_queues[bit + (i << RQB_L2BPW)]; TAILQ_FOREACH(td, rqh, td_runq) { - if (first && THREAD_CAN_MIGRATE(td) && - THREAD_CAN_SCHED(td, cpu)) - return (td); - first = td; + if (first) { + if (THREAD_CAN_MIGRATE(td) && + THREAD_CAN_SCHED(td, cpu)) + return (td); + } else + first = td; } } } From owner-dev-commits-src-all@freebsd.org Tue Sep 21 20:29:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9359867ACAF; Tue, 21 Sep 2021 20:29: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 4HDY1p3rNgz4VS5; Tue, 21 Sep 2021 20:29: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 644762A1A; Tue, 21 Sep 2021 20:29: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 18LKTYLp074542; Tue, 21 Sep 2021 20:29:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LKTYXg074541; Tue, 21 Sep 2021 20:29:34 GMT (envelope-from git) Date: Tue, 21 Sep 2021 20:29:34 GMT Message-Id: <202109212029.18LKTYXg074541@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Leandro Lupori Subject: git: 680ca739458b - main - powerpc64: fix loader regression 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/main X-Git-Reftype: branch X-Git-Commit: 680ca739458ba8cba221ea74794c2cd9771c77f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 20:29:34 -0000 The branch main has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=680ca739458ba8cba221ea74794c2cd9771c77f8 commit 680ca739458ba8cba221ea74794c2cd9771c77f8 Author: Leandro Lupori AuthorDate: 2021-09-21 20:22:42 +0000 Commit: Leandro Lupori CommitDate: 2021-09-21 20:22:42 +0000 powerpc64: fix loader regression After b4cb3fe0e39a, loader started crashing on PowerPC64, with a Program Exception (700) error. The problem was that archsw was used before being initialized, with the new mount feature. This change fixes the issue by initializing archsw earlier, before setting currdev, that triggers the mount. Reviewed by: tsoome MFC after: 1 month X-MFC-With: b4cb3fe0e39a Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D32027 --- stand/powerpc/ofw/main.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/stand/powerpc/ofw/main.c b/stand/powerpc/ofw/main.c index e705871796b1..7b1ec384b6bd 100644 --- a/stand/powerpc/ofw/main.c +++ b/stand/powerpc/ofw/main.c @@ -137,6 +137,17 @@ main(int (*openfirm)(void *)) */ cons_probe(); + archsw.arch_getdev = ofw_getdev; + archsw.arch_copyin = ofw_copyin; + archsw.arch_copyout = ofw_copyout; + archsw.arch_readin = ofw_readin; +#ifdef CAS + setenv("cas", "1", 0); + archsw.arch_autoload = ppc64_autoload; +#else + archsw.arch_autoload = ofw_autoload; +#endif + /* Set up currdev variable to have hooks in place. */ env_setenv("currdev", EV_VOLATILE, "", ofw_setcurrdev, env_nounset); @@ -183,17 +194,6 @@ main(int (*openfirm)(void *)) if (!(mfmsr() & PSL_DR)) setenv("usefdt", "1", 1); - archsw.arch_getdev = ofw_getdev; - archsw.arch_copyin = ofw_copyin; - archsw.arch_copyout = ofw_copyout; - archsw.arch_readin = ofw_readin; -#ifdef CAS - setenv("cas", "1", 0); - archsw.arch_autoload = ppc64_autoload; -#else - archsw.arch_autoload = ofw_autoload; -#endif - interact(); /* doesn't return */ OF_exit(); From owner-dev-commits-src-all@freebsd.org Tue Sep 21 20:53:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7545567B403; Tue, 21 Sep 2021 20:53:24 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDYYJ29FMz4Yl2; Tue, 21 Sep 2021 20:53:24 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4003a.ext.cloudfilter.net ([10.228.9.183]) by cmsmtp with ESMTP id SgMUmY37HczbLSmlSmFCcI; Tue, 21 Sep 2021 20:53:18 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id SmlQmh1WpcHSBSmlRmLzbG; Tue, 21 Sep 2021 20:53:18 +0000 X-Authority-Analysis: v=2.4 cv=I4EG+Psg c=1 sm=1 tr=0 ts=614a463e a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=7QKq2e-ADPsA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=WaiMuAdy-9gZHEPFDb0A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id A86DE27B; Tue, 21 Sep 2021 13:53:14 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 18LKrErT005572; Tue, 21 Sep 2021 13:53:14 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202109212053.18LKrErT005572@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Konstantin Belousov cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: bd9e0f5df681 - main - amd64: eliminate td_md.md_fpu_scratch In-reply-to: <202109211721.18LHLGn6028952@gitrepo.freebsd.org> References: <202109211721.18LHLGn6028952@gitrepo.freebsd.org> Comments: In-reply-to Konstantin Belousov message dated "Tue, 21 Sep 2021 17:21:16 +0000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 21 Sep 2021 13:53:14 -0700 X-CMAE-Envelope: MS4xfA/nyqwnApZXKS61WWlTM62cSFVIf9mV2+a/XBnu5mqVetsske+oCNzyEMEaWGGImPmqqvG80pR7C2v/WIN+6pvD2XZnhgdRV7UMeW+6N264Pp1H9YOY zblUH2ykMdckIaxN0h3PxsB57vKT45Qhd17BWsO+ZAcdEayGq0QKZevTJtQ4c1a/9LBEXQskDg/pSfKo1vDYdx5ybD0aZLW5HwI4d7FPc47PXkR91kcWoad+ TBHbm9i4U7c0HgAAqq7+HNu14gsST876Urs4qSFiNKvLZb+aELKcCUBlb4H7ZDufRR5H1QkgIkwK3gVBIBFNgXH2J8gEAGAFJM53jSVvzUc= X-Rspamd-Queue-Id: 4HDYYJ29FMz4Yl2 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 20:53:24 -0000 In message <202109211721.18LHLGn6028952@gitrepo.freebsd.org>, Konstantin Belous ov writes: > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=bd9e0f5df681da8b5ef05a587b4b5b07 > 572d3fc2 > > commit bd9e0f5df681da8b5ef05a587b4b5b07572d3fc2 > Author: Konstantin Belousov > AuthorDate: 2021-09-15 18:37:47 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-09-21 17:20:15 +0000 > > amd64: eliminate td_md.md_fpu_scratch > > For signal send, copyout from the user FPU save area directly. > > For sigreturn, we are in sleepable context and can do temporal > allocation of the transient save area. We cannot copying from userspace > directly to user save area because XSAVE state needs to be validated, > also partial copyins can corrupt it. > > Requested by: jhb > Reviewed by: jhb, markj > Tested by: pho > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D31954 > --- > sys/amd64/amd64/exec_machdep.c | 47 +++++++++++++++++++--------------------- > -- > sys/amd64/amd64/vm_machdep.c | 3 --- > sys/amd64/ia32/ia32_signal.c | 43 ++++++++++++++++---------------------- > sys/amd64/include/proc.h | 1 - > sys/kern/kern_thread.c | 2 +- > 5 files changed, 40 insertions(+), 56 deletions(-) > > diff --git a/sys/amd64/amd64/exec_machdep.c b/sys/amd64/amd64/exec_machdep.c > index 48bda05f9685..168c24cbb65b 100644 > --- a/sys/amd64/amd64/exec_machdep.c > +++ b/sys/amd64/amd64/exec_machdep.c > @@ -96,7 +96,7 @@ __FBSDID("$FreeBSD$"); > #include > > static void get_fpcontext(struct thread *td, mcontext_t *mcp, > - char *xfpusave, size_t xfpusave_len); > + char **xfpusave, size_t *xfpusave_len); > static int set_fpcontext(struct thread *td, mcontext_t *mcp, > char *xfpustate, size_t xfpustate_len); > > @@ -133,14 +133,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) > regs = td->td_frame; > oonstack = sigonstack(regs->tf_rsp); > > - if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { > - xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); > - xfpusave = (char *)td->td_md.md_fpu_scratch; > - } else { > - xfpusave_len = 0; > - xfpusave = NULL; > - } > - > /* Save user context. */ > bzero(&sf, sizeof(sf)); > sf.sf_uc.uc_sigmask = *mask; > @@ -150,7 +142,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) > sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0; > bcopy(regs, &sf.sf_uc.uc_mcontext.mc_rdi, sizeof(*regs)); > sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ > - get_fpcontext(td, &sf.sf_uc.uc_mcontext, xfpusave, xfpusave_len); > + get_fpcontext(td, &sf.sf_uc.uc_mcontext, &xfpusave, &xfpusave_len); > fpstate_drop(td); > update_pcb_bases(pcb); > sf.sf_uc.uc_mcontext.mc_fsbase = pcb->pcb_fsbase; > @@ -301,10 +293,11 @@ sys_sigreturn(struct thread *td, struct sigreturn_args > *uap) > p->p_pid, td->td_name, xfpustate_len); > return (EINVAL); > } > - xfpustate = __builtin_alloca(xfpustate_len); > + xfpustate = (char *)fpu_save_area_alloc(); > error = copyin((const void *)uc.uc_mcontext.mc_xfpustate, > xfpustate, xfpustate_len); > if (error != 0) { > + fpu_save_area_free((struct savefpu *)xfpustate); > uprintf( > "pid %d (%s): sigreturn copying xfpustate failed\n", > p->p_pid, td->td_name); > @@ -315,6 +308,7 @@ sys_sigreturn(struct thread *td, struct sigreturn_args *u > ap) > xfpustate_len = 0; > } > ret = set_fpcontext(td, &ucp->uc_mcontext, xfpustate, xfpustate_len); > + fpu_save_area_free((struct savefpu *)xfpustate); > if (ret != 0) { > uprintf("pid %d (%s): sigreturn set_fpcontext err %d\n", > p->p_pid, td->td_name, ret); > @@ -674,14 +668,17 @@ set_mcontext(struct thread *td, mcontext_t *mcp) > if (mcp->mc_xfpustate_len > cpu_max_ext_state_size - > sizeof(struct savefpu)) > return (EINVAL); > - xfpustate = (char *)td->td_md.md_fpu_scratch; > + xfpustate = (char *)fpu_save_area_alloc(); > ret = copyin((void *)mcp->mc_xfpustate, xfpustate, > mcp->mc_xfpustate_len); > - if (ret != 0) > + if (ret != 0) { > + fpu_save_area_free((struct savefpu *)xfpustate); > return (ret); > + } > } else > xfpustate = NULL; > ret = set_fpcontext(td, mcp, xfpustate, mcp->mc_xfpustate_len); > + fpu_save_area_free((struct savefpu *)xfpustate); > if (ret != 0) > return (ret); > tp->tf_r15 = mcp->mc_r15; > @@ -719,26 +716,24 @@ set_mcontext(struct thread *td, mcontext_t *mcp) > } > > static void > -get_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpusave, > - size_t xfpusave_len) > +get_fpcontext(struct thread *td, mcontext_t *mcp, char **xfpusave, > + size_t *xfpusave_len) > { > - size_t max_len, len; > - > mcp->mc_ownedfp = fpugetregs(td); > bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], > sizeof(mcp->mc_fpstate)); > mcp->mc_fpformat = fpuformat(); > - if (!use_xsave || xfpusave_len == 0) > + if (xfpusave == NULL) > return; > - max_len = cpu_max_ext_state_size - sizeof(struct savefpu); > - len = xfpusave_len; > - if (len > max_len) { > - len = max_len; > - bzero(xfpusave + max_len, len - max_len); > + if (!use_xsave || cpu_max_ext_state_size <= sizeof(struct savefpu)) { > + *xfpusave_len = 0; > + *xfpusave = NULL; > + } else { > + mcp->mc_flags |= _MC_HASFPXSTATE; > + *xfpusave_len = mcp->mc_xfpustate_len = > + cpu_max_ext_state_size - sizeof(struct savefpu); > + *xfpusave = (char *)(get_pcb_user_save_td(td) + 1); > } > - mcp->mc_flags |= _MC_HASFPXSTATE; > - mcp->mc_xfpustate_len = len; > - bcopy(get_pcb_user_save_td(td) + 1, xfpusave, len); > } > > static int > diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c > index e42d16d61b3a..0bfcd03d6655 100644 > --- a/sys/amd64/amd64/vm_machdep.c > +++ b/sys/amd64/amd64/vm_machdep.c > @@ -392,7 +392,6 @@ cpu_thread_alloc(struct thread *td) > td->td_pcb = pcb = get_pcb_td(td); > td->td_frame = (struct trapframe *)td->td_md.md_stack_base - 1; > td->td_md.md_usr_fpu_save = fpu_save_area_alloc(); > - td->td_md.md_fpu_scratch = fpu_save_area_alloc(); > pcb->pcb_save = get_pcb_user_save_pcb(pcb); > if (use_xsave) { > xhdr = (struct xstate_hdr *)(pcb->pcb_save + 1); > @@ -408,8 +407,6 @@ cpu_thread_free(struct thread *td) > > fpu_save_area_free(td->td_md.md_usr_fpu_save); > td->td_md.md_usr_fpu_save = NULL; > - fpu_save_area_free(td->td_md.md_fpu_scratch); > - td->td_md.md_fpu_scratch = NULL; > } > > bool > diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c > index 9b67c7001a87..1ca19072a1dc 100644 > --- a/sys/amd64/ia32/ia32_signal.c > +++ b/sys/amd64/ia32/ia32_signal.c > @@ -87,10 +87,8 @@ static void freebsd4_ia32_sendsig(sig_t, ksiginfo_t *, sig > set_t *); > > static void > ia32_get_fpcontext(struct thread *td, struct ia32_mcontext *mcp, > - char *xfpusave, size_t xfpusave_len) > + char **xfpusave, size_t *xfpusave_len) > { > - size_t max_len, len; > - > /* > * XXX Format of 64bit and 32bit FXSAVE areas differs. FXSAVE > * in 32bit mode saves %cs and %ds, while on 64bit it saves > @@ -101,17 +99,15 @@ ia32_get_fpcontext(struct thread *td, struct ia32_mconte > xt *mcp, > bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], > sizeof(mcp->mc_fpstate)); > mcp->mc_fpformat = fpuformat(); > - if (!use_xsave || xfpusave_len == 0) > - return; > - max_len = cpu_max_ext_state_size - sizeof(struct savefpu); > - len = xfpusave_len; > - if (len > max_len) { > - len = max_len; > - bzero(xfpusave + max_len, len - max_len); > + if (!use_xsave || cpu_max_ext_state_size <= sizeof(struct savefpu)) { > + *xfpusave_len = 0; > + *xfpusave = NULL; > + } else { > + mcp->mc_flags |= _MC_IA32_HASFPXSTATE; > + *xfpusave_len = mcp->mc_xfpustate_len = This commit causes a panic running and i386 poudriere on an amd64. Notice the ud2 machine instruction at line 107 in the disassemble portion of this reply. Unread portion of the kernel message buffer: interrupt enabled, resume, IOPL = 0 current process = 5200 (cc) trap number = 1 panic: privileged instruction fault cpuid = 3 time = 1632253591 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00e52377d0 vpanic() at vpanic+0x187/frame 0xfffffe00e5237830 panic() at panic+0x43/frame 0xfffffe00e5237890 trap_fatal() at trap_fatal+0x387/frame 0xfffffe00e52378f0 trap() at trap+0x8b/frame 0xfffffe00e5237a00 calltrap() at calltrap+0x8/frame 0xfffffe00e5237a00 --- trap 0x1, rip = 0xffffffff80a5fef1, rsp = 0xfffffe00e5237ad0, rbp = 0xfffffe00e5237af0 --- ia32_get_mcontext() at ia32_get_mcontext+0x181/frame 0xfffffe00e5237af0 freebsd32_getcontext() at freebsd32_getcontext+0x52/frame 0xfffffe00e5237df0 ia32_syscall() at ia32_syscall+0x126/frame 0xfffffe00e5237f30 int0x80_syscall_common() at int0x80_syscall_common+0x9c/frame 0xffffca38 Uptime: 8m48s Dumping 526 out of 8161 MB: (CTRL-C to abort) ..4%..13%..22%..31%..43%..52%. .61%..73%..83%..92% __curthread () at /opt/src/git-src/sys/amd64/include/pcpu_aux.h:55 55 __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (offsetof(struct pcpu, (kgdb) bt #0 __curthread () at /opt/src/git-src/sys/amd64/include/pcpu_aux.h:55 #1 doadump (textdump=textdump@entry=1) at /opt/src/git-src/sys/kern/kern_shutdown.c:399 #2 0xffffffff806d417b in kern_reboot (howto=260) at /opt/src/git-src/sys/kern/kern_shutdown.c:486 #3 0xffffffff806d45f6 in vpanic (fmt=0xffffffff80a9b26c "%s", ap=) at /opt/src/git-src/sys/kern/kern_shutdown.c:919 #4 0xffffffff806d43f3 in panic (fmt=) at /opt/src/git-src/sys/kern/kern_shutdown.c:843 #5 0xffffffff80a3a587 in trap_fatal (frame=0xfffffe00e5237a10, eva=0) at /opt/src/git-src/sys/amd64/amd64/trap.c:946 #6 0xffffffff80a39a7b in trap (frame=0xfffffe00e5237a10) at /opt/src/git-src/sys/amd64/amd64/trap.c:251 #7 #8 0xffffffff80a5fef1 in ia32_get_fpcontext (td=0xfffffe00e468f3a0, mcp=0xfffffe00e5237b10, xfpusave=0x0, xfpusave_len=0x0) at /opt/src/git-src/sys/amd64/ia32/ia32_signal.c:107 #9 ia32_get_mcontext (td=td@entry=0xfffffe00e468f3a0, mcp=mcp@entry=0xfffffe00e5237b10, flags=1) at /opt/src/git-src/sys/amd64/ia32/ia32_signal.c:177 #10 0xffffffff80a5fca2 in freebsd32_getcontext (td=0xfffffe00e468f3a0, uap=0xfffffe00e468f790) at /opt/src/git-src/sys/amd64/ia32/ia32_signal.c:260 #11 0xffffffff80a61a16 in syscallenter (td=0xfffffe00e468f3a0) at /opt/src/git-src/sys/amd64/ia32/../../kern/subr_syscall.c:189 #12 ia32_syscall (frame=0xfffffe00e5237f40) at /opt/src/git-src/sys/amd64/ia32/ia32_syscall.c:218 #13 0xffffffff80a12bcf in int0x80_syscall_common () at /opt/src/git-src/sys/amd64/ia32/ia32_exception.S:77 #14 0x00000000ffffc710 in ?? () #15 0x00000000ffffc9d0 in ?? () #16 0x000000002540b9ad in ?? () #17 0x000000002526104f in ?? () #18 0x0000000000000000 in ?? () (kgdb) frame 8 #8 0xffffffff80a5fef1 in ia32_get_fpcontext (td=0xfffffe00e468f3a0, mcp=0xfffffe00e5237b10, xfpusave=0x0, xfpusave_len=0x0) at /opt/src/git-src/sys/amd64/ia32/ia32_signal.c:107 107 *xfpusave_len = mcp->mc_xfpustate_len = (kgdb) l 102 if (!use_xsave || cpu_max_ext_state_size <= sizeof(struct savefpu)) { 103 *xfpusave_len = 0; 104 *xfpusave = NULL; 105 } else { 106 mcp->mc_flags |= _MC_IA32_HASFPXSTATE; 107 *xfpusave_len = mcp->mc_xfpustate_len = 108 cpu_max_ext_state_size - sizeof(struct savefpu); 109 *xfpusave = (char *)(get_pcb_user_save_td(td) + 1); 110 } 111 } (kgdb) disassemble /m Dump of assembler code for function ia32_get_mcontext: 98 mcp->mc_ownedfp = fpugetregs(td); 0xffffffff80a5fe9d <+301>: mov %r14,%rdi 0xffffffff80a5fea0 <+304>: call 0xffffffff80a16ca0 0xffffffff80a5fea5 <+309>: mov %eax,0x58(%rbx) 99 bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], 0xffffffff80a5fea8 <+312>: lea 0x60(%rbx),%r15 0xffffffff80a5feac <+316>: mov %r14,%rdi 0xffffffff80a5feaf <+319>: call 0xffffffff80a3bbc0 0xffffffff80a5feb4 <+324>: mov $0x200,%edx 0xffffffff80a5feb9 <+329>: mov %r15,%rdi 0xffffffff80a5febc <+332>: mov %rax,%rsi 0xffffffff80a5febf <+335>: call 0xffffffff80a35d20 100 sizeof(mcp->mc_fpstate)); 101 mcp->mc_fpformat = fpuformat(); 0xffffffff80a5fec4 <+340>: call 0xffffffff80a169e0 0xffffffff80a5fec9 <+345>: mov %eax,0x54(%rbx) 102 if (!use_xsave || cpu_max_ext_state_size <= sizeof(struct savefpu)) { 0xffffffff80a5fecc <+348>: cmpl $0x0,0x53c73d(%rip) # 0xffffffff80f9c610 0xffffffff80a5fed3 <+355>: je 0xffffffff80a5fef1 0xffffffff80a5fed5 <+357>: mov 0x5274bd(%rip),%eax # 0xffffffff80f87398 0xffffffff80a5fedb <+363>: cmp $0x200,%eax 0xffffffff80a5fee0 <+368>: jbe 0xffffffff80a5fef1 103 *xfpusave_len = 0; 104 *xfpusave = NULL; 105 } else { 106 mcp->mc_flags |= _MC_IA32_HASFPXSTATE; 0xffffffff80a5fee2 <+370>: orb $0x4,0x5c(%rbx) 107 *xfpusave_len = mcp->mc_xfpustate_len = 0xffffffff80a5feeb <+379>: mov %eax,0x26c(%rbx) => 0xffffffff80a5fef1 <+385>: ud2 0xffffffff80a5fef3 <+387>: xor %eax,%eax 0xffffffff80a5fef5 <+389>: mov $0x140,%edi 108 cpu_max_ext_state_size - sizeof(struct savefpu); 0xffffffff80a5fee6 <+374>: add $0xfffffe00,%eax 109 *xfpusave = (char *)(get_pcb_user_save_td(td) + 1); 110 } 111 } 112 113 static int --Type for more, q to quit, c to continue without paging--q > + cpu_max_ext_state_size - sizeof(struct savefpu); > + *xfpusave = (char *)(get_pcb_user_save_td(td) + 1); > } > - mcp->mc_flags |= _MC_IA32_HASFPXSTATE; > - mcp->mc_xfpustate_len = len; > - bcopy(get_pcb_user_save_td(td) + 1, xfpusave, len); > } > > static int > @@ -210,14 +206,17 @@ ia32_set_mcontext(struct thread *td, struct ia32_mconte > xt *mcp) > if (mcp->mc_xfpustate_len > cpu_max_ext_state_size - > sizeof(struct savefpu)) > return (EINVAL); > - xfpustate = (char *)td->td_md.md_fpu_scratch; > + xfpustate = (char *)fpu_save_area_alloc(); > ret = copyin(PTRIN(mcp->mc_xfpustate), xfpustate, > mcp->mc_xfpustate_len); > - if (ret != 0) > + if (ret != 0) { > + fpu_save_area_free((struct savefpu *)xfpustate); > return (ret); > + } > } else > xfpustate = NULL; > ret = ia32_set_fpcontext(td, mcp, xfpustate, mcp->mc_xfpustate_len); > + fpu_save_area_free((struct savefpu *)xfpustate); > if (ret != 0) > return (ret); > tp->tf_gs = mcp->mc_gs; > @@ -577,14 +576,6 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *m > ask) > regs = td->td_frame; > oonstack = sigonstack(regs->tf_rsp); > > - if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { > - xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); > - xfpusave = (char *)td->td_md.md_fpu_scratch; > - } else { > - xfpusave_len = 0; > - xfpusave = NULL; > - } > - > /* Save user context. */ > bzero(&sf, sizeof(sf)); > sf.sf_uc.uc_sigmask = *mask; > @@ -613,7 +604,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *ma > sk) > sf.sf_uc.uc_mcontext.mc_fs = regs->tf_fs; > sf.sf_uc.uc_mcontext.mc_gs = regs->tf_gs; > sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ > - ia32_get_fpcontext(td, &sf.sf_uc.uc_mcontext, xfpusave, xfpusave_len); > + ia32_get_fpcontext(td, &sf.sf_uc.uc_mcontext, &xfpusave, &xfpusave_len) > ; > fpstate_drop(td); > sf.sf_uc.uc_mcontext.mc_fsbase = td->td_pcb->pcb_fsbase; > sf.sf_uc.uc_mcontext.mc_gsbase = td->td_pcb->pcb_gsbase; > @@ -882,10 +873,11 @@ freebsd32_sigreturn(td, uap) > td->td_proc->p_pid, td->td_name, xfpustate_len); > return (EINVAL); > } > - xfpustate = (char *)td->td_md.md_fpu_scratch; > + xfpustate = (char *)fpu_save_area_alloc(); > error = copyin(PTRIN(ucp->uc_mcontext.mc_xfpustate), > xfpustate, xfpustate_len); > if (error != 0) { > + fpu_save_area_free((struct savefpu *)xfpustate); > uprintf( > "pid %d (%s): sigreturn copying xfpustate failed\n", > td->td_proc->p_pid, td->td_name); > @@ -897,6 +889,7 @@ freebsd32_sigreturn(td, uap) > } > ret = ia32_set_fpcontext(td, &ucp->uc_mcontext, xfpustate, > xfpustate_len); > + fpu_save_area_free((struct savefpu *)xfpustate); > if (ret != 0) { > uprintf("pid %d (%s): sigreturn set_fpcontext err %d\n", > td->td_proc->p_pid, td->td_name, ret); > diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h > index bd07f70f8d44..94ac69d31e65 100644 > --- a/sys/amd64/include/proc.h > +++ b/sys/amd64/include/proc.h > @@ -76,7 +76,6 @@ struct mdthread { > struct pcb md_pcb; > vm_offset_t md_stack_base; > struct savefpu *md_usr_fpu_save; > - struct savefpu *md_fpu_scratch; > }; > > struct mdproc { > diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c > index 62f939406374..65c5cc65c87e 100644 > --- a/sys/kern/kern_thread.c > +++ b/sys/kern/kern_thread.c > @@ -91,7 +91,7 @@ _Static_assert(offsetof(struct thread, td_pflags) == 0x110, > "struct thread KBI td_pflags"); > _Static_assert(offsetof(struct thread, td_frame) == 0x4a8, > "struct thread KBI td_frame"); > -_Static_assert(offsetof(struct thread, td_emuldata) == 0x6c0, > +_Static_assert(offsetof(struct thread, td_emuldata) == 0x6b0, > "struct thread KBI td_emuldata"); > _Static_assert(offsetof(struct proc, p_flag) == 0xb8, > "struct proc KBI p_flag"); > -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-all@freebsd.org Tue Sep 21 21:16:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 98B8E67B430; Tue, 21 Sep 2021 21:16:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDZ3Y3r2cz4b72; Tue, 21 Sep 2021 21:16: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 6377533EE; Tue, 21 Sep 2021 21:16: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 18LLG9k9041133; Tue, 21 Sep 2021 21:16:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LLG9xe041132; Tue, 21 Sep 2021 21:16:09 GMT (envelope-from git) Date: Tue, 21 Sep 2021 21:16:09 GMT Message-Id: <202109212116.18LLG9xe041132@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: ae5a522cae7e - main - nvmecontrol: Display Metadata and Sanitize capabilities of the device MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ae5a522cae7e95790e84274c4ba23bbd1e4f3033 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 21:16:09 -0000 The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=ae5a522cae7e95790e84274c4ba23bbd1e4f3033 commit ae5a522cae7e95790e84274c4ba23bbd1e4f3033 Author: Allan Jude AuthorDate: 2021-09-21 21:14:20 +0000 Commit: Allan Jude CommitDate: 2021-09-21 21:15:55 +0000 nvmecontrol: Display Metadata and Sanitize capabilities of the device Determine if a device supports "Extended" or "Separate" metadata, and what the current metadata setting is (None, Extended, Separate) Also determine if the device supports: - Sanitize Crypto Erase - Sanitize Block Erase - Sanitize Overwrite Reviewed by: chuck Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. X-NetApp-PR: #49 Differential Revision: https://reviews.freebsd.org/D31067 --- sbin/nvmecontrol/identify.c | 12 +++++++++++- sbin/nvmecontrol/identify_ext.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/identify.c b/sbin/nvmecontrol/identify.c index 6cd7ad0fdc2d..0d4d8003e5d2 100644 --- a/sbin/nvmecontrol/identify.c +++ b/sbin/nvmecontrol/identify.c @@ -84,7 +84,17 @@ print_namespace(struct nvme_namespace_data *nsdata) printf("Thin Provisioning: %s\n", thin_prov ? "Supported" : "Not Supported"); printf("Number of LBA Formats: %d\n", nsdata->nlbaf+1); - printf("Current LBA Format: LBA Format #%02d\n", flbas_fmt); + printf("Current LBA Format: LBA Format #%02d", flbas_fmt); + if (nsdata->lbaf[flbas_fmt] >> NVME_NS_DATA_LBAF_MS_SHIFT & NVME_NS_DATA_LBAF_MS_MASK) + printf(" %s metadata\n", nsdata->flbas >> NVME_NS_DATA_FLBAS_EXTENDED_SHIFT & + NVME_NS_DATA_FLBAS_EXTENDED_MASK ? "Extended" : "Separate"); + else + printf("\n"); + printf("Metadata Capabilities\n"); + printf(" Extended: %s\n", + nsdata->mc >> NVME_NS_DATA_MC_EXTENDED_SHIFT & NVME_NS_DATA_MC_EXTENDED_MASK ? "Supported" : "Not Supported"); + printf(" Separate: %s\n", + nsdata->mc >> NVME_NS_DATA_MC_POINTER_SHIFT & NVME_NS_DATA_MC_POINTER_MASK ? "Supported" : "Not Supported"); printf("Data Protection Caps: %s%s%s%s%s%s\n", (nsdata->dpc == 0) ? "Not Supported" : "", ((nsdata->dpc >> NVME_NS_DATA_DPC_MD_END_SHIFT) & diff --git a/sbin/nvmecontrol/identify_ext.c b/sbin/nvmecontrol/identify_ext.c index 311c8cba09a9..50b8901b799e 100644 --- a/sbin/nvmecontrol/identify_ext.c +++ b/sbin/nvmecontrol/identify_ext.c @@ -124,6 +124,38 @@ nvme_print_controller(struct nvme_controller_data *cdata) printf("Unlimited\n"); else printf("%ld bytes\n", PAGE_SIZE * (1L << cdata->mdts)); + printf("Sanitize Crypto Erase: %s\n", + ((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_CES_SHIFT) & + NVME_CTRLR_DATA_SANICAP_CES_MASK) ? + "Supported" : "Not Supported"); + printf("Sanitize Block Erase: %s\n", + ((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_BES_SHIFT) & + NVME_CTRLR_DATA_SANICAP_BES_MASK) ? + "Supported" : "Not Supported"); + printf("Sanitize Overwrite: %s\n", + ((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_OWS_SHIFT) & + NVME_CTRLR_DATA_SANICAP_OWS_MASK) ? + "Supported" : "Not Supported"); + printf("Sanitize NDI: %s\n", + ((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_NDI_SHIFT) & + NVME_CTRLR_DATA_SANICAP_NDI_MASK) ? + "Supported" : "Not Supported"); + printf("Sanitize NODMMAS: "); + switch (((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_NODMMAS_SHIFT) & + NVME_CTRLR_DATA_SANICAP_NODMMAS_MASK)) { + case NVME_CTRLR_DATA_SANICAP_NODMMAS_UNDEF: + printf("Undefined\n"); + break; + case NVME_CTRLR_DATA_SANICAP_NODMMAS_NO: + printf("No\n"); + break; + case NVME_CTRLR_DATA_SANICAP_NODMMAS_YES: + printf("Yes\n"); + break; + default: + printf("Unknown\n"); + break; + } printf("Controller ID: 0x%04x\n", cdata->ctrlr_id); printf("Version: %d.%d.%d\n", (cdata->ver >> 16) & 0xffff, (cdata->ver >> 8) & 0xff, From owner-dev-commits-src-all@freebsd.org Tue Sep 21 21:17:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B8F967B7BB; Tue, 21 Sep 2021 21:17: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 4HDZ4m26v8z4bDC; Tue, 21 Sep 2021 21:17: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 2897532D6; Tue, 21 Sep 2021 21:17: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 18LLHCNd041359; Tue, 21 Sep 2021 21:17:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LLHCVp041358; Tue, 21 Sep 2021 21:17:12 GMT (envelope-from git) Date: Tue, 21 Sep 2021 21:17:12 GMT Message-Id: <202109212117.18LLHCVp041358@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: c2ee4dfd0497 - main - ia32_get_fpcontext(): xfpusave can be legitimately NULL MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c2ee4dfd04970f1597eea58bb30eb93e1ed5a491 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 21:17:12 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c2ee4dfd04970f1597eea58bb30eb93e1ed5a491 commit c2ee4dfd04970f1597eea58bb30eb93e1ed5a491 Author: Konstantin Belousov AuthorDate: 2021-09-21 21:09:34 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 21:17:06 +0000 ia32_get_fpcontext(): xfpusave can be legitimately NULL Reported by: cy Sponsored by: The FreeBSD Foundation MFC after: 1 week Fixes: bd9e0f5df681da8b5ef05 --- sys/amd64/ia32/ia32_signal.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c index 1ca19072a1dc..ab7100f5b9fb 100644 --- a/sys/amd64/ia32/ia32_signal.c +++ b/sys/amd64/ia32/ia32_signal.c @@ -99,6 +99,8 @@ ia32_get_fpcontext(struct thread *td, struct ia32_mcontext *mcp, bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], sizeof(mcp->mc_fpstate)); mcp->mc_fpformat = fpuformat(); + if (xfpusave == NULL) + return; if (!use_xsave || cpu_max_ext_state_size <= sizeof(struct savefpu)) { *xfpusave_len = 0; *xfpusave = NULL; From owner-dev-commits-src-all@freebsd.org Tue Sep 21 21:18:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A002367B54A; Tue, 21 Sep 2021 21:18:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDZ5n27jKz4bCG; Tue, 21 Sep 2021 21:18:05 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 18LLHhaw086263 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 22 Sep 2021 00:17:46 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 18LLHhaw086263 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 18LLHhmv086261; Wed, 22 Sep 2021 00:17:43 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 22 Sep 2021 00:17:43 +0300 From: Konstantin Belousov To: Cy Schubert Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: bd9e0f5df681 - main - amd64: eliminate td_md.md_fpu_scratch Message-ID: References: <202109211721.18LHLGn6028952@gitrepo.freebsd.org> <202109212053.18LKrErT005572@slippy.cwsent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202109212053.18LKrErT005572@slippy.cwsent.com> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4HDZ5n27jKz4bCG X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all:c]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 21:18:06 -0000 On Tue, Sep 21, 2021 at 01:53:14PM -0700, Cy Schubert wrote: > In message <202109211721.18LHLGn6028952@gitrepo.freebsd.org>, Konstantin > Belous > ov writes: > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=bd9e0f5df681da8b5ef05a587b4b5b07 > > 572d3fc2 > > > > commit bd9e0f5df681da8b5ef05a587b4b5b07572d3fc2 > > Author: Konstantin Belousov > > AuthorDate: 2021-09-15 18:37:47 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2021-09-21 17:20:15 +0000 > > > > amd64: eliminate td_md.md_fpu_scratch > > This commit causes a panic running and i386 poudriere on an amd64. Notice > the ud2 machine instruction at line 107 in the disassemble portion of this > reply. > > Unread portion of the kernel message buffer: > interrupt enabled, resume, IOPL = 0 > current process = 5200 (cc) > trap number = 1 > panic: privileged instruction fault > cpuid = 3 > time = 1632253591 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame > 0xfffffe00e52377d0 > vpanic() at vpanic+0x187/frame 0xfffffe00e5237830 > panic() at panic+0x43/frame 0xfffffe00e5237890 > trap_fatal() at trap_fatal+0x387/frame 0xfffffe00e52378f0 > trap() at trap+0x8b/frame 0xfffffe00e5237a00 > calltrap() at calltrap+0x8/frame 0xfffffe00e5237a00 > --- trap 0x1, rip = 0xffffffff80a5fef1, rsp = 0xfffffe00e5237ad0, rbp = > 0xfffffe00e5237af0 --- > ia32_get_mcontext() at ia32_get_mcontext+0x181/frame 0xfffffe00e5237af0 > freebsd32_getcontext() at freebsd32_getcontext+0x52/frame 0xfffffe00e5237df0 > ia32_syscall() at ia32_syscall+0x126/frame 0xfffffe00e5237f30 > int0x80_syscall_common() at int0x80_syscall_common+0x9c/frame 0xffffca38 Should be fixed by c2ee4dfd0497. I converted get_fpcontext(), but forgot about same change for ia32_get_fpcontext(), sorry. Thank you for the report. From owner-dev-commits-src-all@freebsd.org Tue Sep 21 21:19:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D01267B987; Tue, 21 Sep 2021 21:19:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDZ7d1C7Bz4bFF; Tue, 21 Sep 2021 21:19:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 08BCD30F3; Tue, 21 Sep 2021 21:19:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LLJeb3041664; Tue, 21 Sep 2021 21:19:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LLJeEh041663; Tue, 21 Sep 2021 21:19:40 GMT (envelope-from git) Date: Tue, 21 Sep 2021 21:19:40 GMT Message-Id: <202109212119.18LLJeEh041663@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: cf0ee8738e31 - main - Drop cloudabi MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cf0ee8738e31aa9e6fbf4dca4dac56d89226a71a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 21:19:41 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=cf0ee8738e31aa9e6fbf4dca4dac56d89226a71a commit cf0ee8738e31aa9e6fbf4dca4dac56d89226a71a Author: Konstantin Belousov AuthorDate: 2021-09-12 22:50:39 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 21:18:44 +0000 Drop cloudabi According to https://github.com/NuxiNL/cloudlibc: CloudABI is no longer being maintained. It was an awesome experiment, but it never got enough traction to be sustainable. There is no reason to keep it in FreeBSD. Approved by: ed (private mail) Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D31923 --- Makefile.inc1 | 2 - ObsoleteFiles.inc | 3 + lib/libsysdecode/errno.c | 97 -- lib/libsysdecode/syscallnames.c | 13 - lib/libsysdecode/sysdecode.h | 2 - share/man/man4/Makefile | 3 - share/man/man4/cloudabi.4 | 123 -- sys/amd64/cloudabi32/cloudabi32_sysvec.c | 239 ---- sys/amd64/cloudabi64/cloudabi64_sysvec.c | 226 --- sys/amd64/conf/NOTES | 6 - sys/arm/cloudabi32/cloudabi32_sysvec.c | 199 --- sys/arm64/cloudabi32/cloudabi32_sysvec.c | 207 --- sys/arm64/cloudabi64/cloudabi64_sysvec.c | 191 --- sys/compat/cloudabi/cloudabi_clock.c | 135 -- sys/compat/cloudabi/cloudabi_errno.c | 123 -- sys/compat/cloudabi/cloudabi_fd.c | 475 ------- sys/compat/cloudabi/cloudabi_file.c | 763 ---------- sys/compat/cloudabi/cloudabi_futex.c | 1165 ---------------- sys/compat/cloudabi/cloudabi_mem.c | 167 --- sys/compat/cloudabi/cloudabi_proc.c | 148 -- sys/compat/cloudabi/cloudabi_proto.h | 36 - sys/compat/cloudabi/cloudabi_random.c | 53 - sys/compat/cloudabi/cloudabi_sock.c | 186 --- sys/compat/cloudabi/cloudabi_thread.c | 66 - sys/compat/cloudabi/cloudabi_util.h | 87 -- sys/compat/cloudabi/cloudabi_vdso.c | 90 -- sys/compat/cloudabi/cloudabi_vdso.lds | 51 - sys/compat/cloudabi32/Makefile | 6 - sys/compat/cloudabi32/cloudabi32_fd.c | 145 -- sys/compat/cloudabi32/cloudabi32_module.c | 184 --- sys/compat/cloudabi32/cloudabi32_poll.c | 340 ----- sys/compat/cloudabi32/cloudabi32_proto.h | 420 ------ sys/compat/cloudabi32/cloudabi32_sock.c | 128 -- sys/compat/cloudabi32/cloudabi32_syscall.h | 57 - sys/compat/cloudabi32/cloudabi32_syscalls.c | 58 - sys/compat/cloudabi32/cloudabi32_sysent.c | 66 - sys/compat/cloudabi32/cloudabi32_systrace_args.c | 1458 -------------------- sys/compat/cloudabi32/cloudabi32_thread.c | 77 -- sys/compat/cloudabi32/cloudabi32_util.h | 51 - sys/compat/cloudabi32/syscalls.conf | 15 - sys/compat/cloudabi64/Makefile | 6 - sys/compat/cloudabi64/cloudabi64_fd.c | 145 -- sys/compat/cloudabi64/cloudabi64_module.c | 184 --- sys/compat/cloudabi64/cloudabi64_poll.c | 340 ----- sys/compat/cloudabi64/cloudabi64_proto.h | 420 ------ sys/compat/cloudabi64/cloudabi64_sock.c | 128 -- sys/compat/cloudabi64/cloudabi64_syscall.h | 57 - sys/compat/cloudabi64/cloudabi64_syscalls.c | 58 - sys/compat/cloudabi64/cloudabi64_sysent.c | 66 - sys/compat/cloudabi64/cloudabi64_systrace_args.c | 1458 -------------------- sys/compat/cloudabi64/cloudabi64_thread.c | 77 -- sys/compat/cloudabi64/cloudabi64_util.h | 51 - sys/compat/cloudabi64/syscalls.conf | 15 - sys/conf/files | 25 - sys/conf/files.amd64 | 26 - sys/conf/files.arm | 15 - sys/conf/files.arm64 | 25 - sys/conf/files.i386 | 12 - sys/conf/options | 2 - sys/contrib/cloudabi/cloudabi32_types.h | 189 --- sys/contrib/cloudabi/cloudabi64_types.h | 189 --- sys/contrib/cloudabi/cloudabi_types_common.h | 428 ------ sys/contrib/cloudabi/cloudabi_vdso_aarch64.S | 431 ------ sys/contrib/cloudabi/cloudabi_vdso_armv6.S | 396 ------ .../cloudabi/cloudabi_vdso_armv6_on_64bit.S | 732 ---------- sys/contrib/cloudabi/cloudabi_vdso_i686.S | 419 ------ sys/contrib/cloudabi/cloudabi_vdso_i686_on_64bit.S | 1058 -------------- sys/contrib/cloudabi/cloudabi_vdso_x86_64.S | 449 ------ sys/contrib/cloudabi/syscalls32.master | 274 ---- sys/contrib/cloudabi/syscalls64.master | 274 ---- sys/i386/cloudabi32/cloudabi32_sysvec.c | 209 --- sys/i386/conf/NOTES | 3 - sys/kern/kern_sig.c | 19 - sys/modules/Makefile | 11 - sys/modules/cloudabi/Makefile | 10 - sys/modules/cloudabi32/Makefile | 46 - sys/modules/cloudabi64/Makefile | 38 - sys/sys/sysent.h | 1 - sys/tools/makesyscalls.lua | 6 +- usr.bin/kdump/kdump.c | 5 - usr.bin/truss/setup.c | 18 - usr.bin/truss/syscall.h | 20 - usr.bin/truss/syscalls.c | 259 +--- 83 files changed, 6 insertions(+), 16449 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 8134bb93df03..ff5911edc384 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1519,8 +1519,6 @@ makeman: .PHONY _sysent_PATH= ${TMPPATH}:/usr/libexec _sysent_dirs= sys/kern _sysent_dirs+= sys/compat/freebsd32 -_sysent_dirs+= sys/compat/cloudabi32 \ - sys/compat/cloudabi64 _sysent_dirs+= sys/amd64/linux \ sys/amd64/linux32 \ sys/arm/linux \ diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 5879ddfc3185..1a5d235624eb 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -40,6 +40,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20210921: remove couldabi +OLD_FILES+=usr/share/man/man4/cloudabi.4.gz + # 20210906: stop installing {llvm,clang,lldb}-tblgen OLD_FILES+=usr/bin/llvm-tblgen OLD_FILES+=usr/bin/clang-tblgen diff --git a/lib/libsysdecode/errno.c b/lib/libsysdecode/errno.c index d66493ad739d..b235e3abf4ed 100644 --- a/lib/libsysdecode/errno.c +++ b/lib/libsysdecode/errno.c @@ -40,87 +40,6 @@ __FBSDID("$FreeBSD$"); #include #endif -#include - -static const int cloudabi_errno_table[] = { - [CLOUDABI_E2BIG] = E2BIG, - [CLOUDABI_EACCES] = EACCES, - [CLOUDABI_EADDRINUSE] = EADDRINUSE, - [CLOUDABI_EADDRNOTAVAIL] = EADDRNOTAVAIL, - [CLOUDABI_EAFNOSUPPORT] = EAFNOSUPPORT, - [CLOUDABI_EAGAIN] = EAGAIN, - [CLOUDABI_EALREADY] = EALREADY, - [CLOUDABI_EBADF] = EBADF, - [CLOUDABI_EBADMSG] = EBADMSG, - [CLOUDABI_EBUSY] = EBUSY, - [CLOUDABI_ECANCELED] = ECANCELED, - [CLOUDABI_ECHILD] = ECHILD, - [CLOUDABI_ECONNABORTED] = ECONNABORTED, - [CLOUDABI_ECONNREFUSED] = ECONNREFUSED, - [CLOUDABI_ECONNRESET] = ECONNRESET, - [CLOUDABI_EDEADLK] = EDEADLK, - [CLOUDABI_EDESTADDRREQ] = EDESTADDRREQ, - [CLOUDABI_EDOM] = EDOM, - [CLOUDABI_EDQUOT] = EDQUOT, - [CLOUDABI_EEXIST] = EEXIST, - [CLOUDABI_EFAULT] = EFAULT, - [CLOUDABI_EFBIG] = EFBIG, - [CLOUDABI_EHOSTUNREACH] = EHOSTUNREACH, - [CLOUDABI_EIDRM] = EIDRM, - [CLOUDABI_EILSEQ] = EILSEQ, - [CLOUDABI_EINPROGRESS] = EINPROGRESS, - [CLOUDABI_EINTR] = EINTR, - [CLOUDABI_EINVAL] = EINVAL, - [CLOUDABI_EIO] = EIO, - [CLOUDABI_EISCONN] = EISCONN, - [CLOUDABI_EISDIR] = EISDIR, - [CLOUDABI_ELOOP] = ELOOP, - [CLOUDABI_EMFILE] = EMFILE, - [CLOUDABI_EMLINK] = EMLINK, - [CLOUDABI_EMSGSIZE] = EMSGSIZE, - [CLOUDABI_EMULTIHOP] = EMULTIHOP, - [CLOUDABI_ENAMETOOLONG] = ENAMETOOLONG, - [CLOUDABI_ENETDOWN] = ENETDOWN, - [CLOUDABI_ENETRESET] = ENETRESET, - [CLOUDABI_ENETUNREACH] = ENETUNREACH, - [CLOUDABI_ENFILE] = ENFILE, - [CLOUDABI_ENOBUFS] = ENOBUFS, - [CLOUDABI_ENODEV] = ENODEV, - [CLOUDABI_ENOENT] = ENOENT, - [CLOUDABI_ENOEXEC] = ENOEXEC, - [CLOUDABI_ENOLCK] = ENOLCK, - [CLOUDABI_ENOLINK] = ENOLINK, - [CLOUDABI_ENOMEM] = ENOMEM, - [CLOUDABI_ENOMSG] = ENOMSG, - [CLOUDABI_ENOPROTOOPT] = ENOPROTOOPT, - [CLOUDABI_ENOSPC] = ENOSPC, - [CLOUDABI_ENOSYS] = ENOSYS, - [CLOUDABI_ENOTCONN] = ENOTCONN, - [CLOUDABI_ENOTDIR] = ENOTDIR, - [CLOUDABI_ENOTEMPTY] = ENOTEMPTY, - [CLOUDABI_ENOTRECOVERABLE] = ENOTRECOVERABLE, - [CLOUDABI_ENOTSOCK] = ENOTSOCK, - [CLOUDABI_ENOTSUP] = ENOTSUP, - [CLOUDABI_ENOTTY] = ENOTTY, - [CLOUDABI_ENXIO] = ENXIO, - [CLOUDABI_EOVERFLOW] = EOVERFLOW, - [CLOUDABI_EOWNERDEAD] = EOWNERDEAD, - [CLOUDABI_EPERM] = EPERM, - [CLOUDABI_EPIPE] = EPIPE, - [CLOUDABI_EPROTO] = EPROTO, - [CLOUDABI_EPROTONOSUPPORT] = EPROTONOSUPPORT, - [CLOUDABI_EPROTOTYPE] = EPROTOTYPE, - [CLOUDABI_ERANGE] = ERANGE, - [CLOUDABI_EROFS] = EROFS, - [CLOUDABI_ESPIPE] = ESPIPE, - [CLOUDABI_ESRCH] = ESRCH, - [CLOUDABI_ESTALE] = ESTALE, - [CLOUDABI_ETIMEDOUT] = ETIMEDOUT, - [CLOUDABI_ETXTBSY] = ETXTBSY, - [CLOUDABI_EXDEV] = EXDEV, - [CLOUDABI_ENOTCAPABLE] = ENOTCAPABLE, -}; - int sysdecode_abi_to_freebsd_errno(enum sysdecode_abi abi, int error) { @@ -145,12 +64,6 @@ sysdecode_abi_to_freebsd_errno(enum sysdecode_abi abi, int error) break; } #endif - case SYSDECODE_ABI_CLOUDABI32: - case SYSDECODE_ABI_CLOUDABI64: - if (error >= 0 && - (unsigned int)error < nitems(cloudabi_errno_table)) - return (cloudabi_errno_table[error]); - break; default: break; } @@ -172,16 +85,6 @@ sysdecode_freebsd_to_abi_errno(enum sysdecode_abi abi, int error) return (linux_errtbl[error]); break; #endif - case SYSDECODE_ABI_CLOUDABI32: - case SYSDECODE_ABI_CLOUDABI64: { - unsigned int i; - - for (i = 0; i < nitems(cloudabi_errno_table); i++) { - if (error == cloudabi_errno_table[i]) - return (i); - } - break; - } default: break; } diff --git a/lib/libsysdecode/syscallnames.c b/lib/libsysdecode/syscallnames.c index 897f7e0fa53b..4638438964fd 100644 --- a/lib/libsysdecode/syscallnames.c +++ b/lib/libsysdecode/syscallnames.c @@ -64,11 +64,6 @@ static #include #endif -static -#include -static -#include - const char * sysdecode_syscallname(enum sysdecode_abi abi, unsigned int code) { @@ -96,14 +91,6 @@ sysdecode_syscallname(enum sysdecode_abi abi, unsigned int code) return (linux32_syscallnames[code]); break; #endif - case SYSDECODE_ABI_CLOUDABI32: - if (code < nitems(cloudabi32_syscallnames)) - return (cloudabi32_syscallnames[code]); - break; - case SYSDECODE_ABI_CLOUDABI64: - if (code < nitems(cloudabi64_syscallnames)) - return (cloudabi64_syscallnames[code]); - break; default: break; } diff --git a/lib/libsysdecode/sysdecode.h b/lib/libsysdecode/sysdecode.h index cdb9205f3da1..1a35d0c9d685 100644 --- a/lib/libsysdecode/sysdecode.h +++ b/lib/libsysdecode/sysdecode.h @@ -34,8 +34,6 @@ enum sysdecode_abi { SYSDECODE_ABI_FREEBSD32, SYSDECODE_ABI_LINUX, SYSDECODE_ABI_LINUX32, - SYSDECODE_ABI_CLOUDABI64, - SYSDECODE_ABI_CLOUDABI32 }; int sysdecode_abi_to_freebsd_errno(enum sysdecode_abi _abi, int _error); diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 7146cfe7ac8f..d83f4d03d9db 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -110,7 +110,6 @@ MAN= aac.4 \ chromebook_platform.4 \ ${_chvgpio.4} \ ciss.4 \ - cloudabi.4 \ ${_coretemp.4} \ cp2112.4 \ ${_cpuctl.4} \ @@ -631,8 +630,6 @@ MLINKS+=${_bxe.4} ${_if_bxe.4} MLINKS+=cas.4 if_cas.4 MLINKS+=cdce.4 if_cdce.4 MLINKS+=cfi.4 cfid.4 -MLINKS+=cloudabi.4 cloudabi32.4 \ - cloudabi.4 cloudabi64.4 MLINKS+=crypto.4 cryptodev.4 MLINKS+=cue.4 if_cue.4 MLINKS+=cxgb.4 if_cxgb.4 diff --git a/share/man/man4/cloudabi.4 b/share/man/man4/cloudabi.4 deleted file mode 100644 index 3e3f988da4d0..000000000000 --- a/share/man/man4/cloudabi.4 +++ /dev/null @@ -1,123 +0,0 @@ -.\" Copyright (c) 2015-2017 Nuxi, https://nuxi.nl/ -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.Dd November 30, 2017 -.Dt CLOUDABI 4 -.Os -.Sh NAME -.Nm cloudabi , -.Nm cloudabi32 , -.Nm cloudabi64 -.Nd CloudABI support -.Sh SYNOPSIS -Support for 32-bit CloudABI executables can be compiled into the kernel -by adding this line to the kernel configuration file: -.Bd -ragged -offset indent -.Cd "options COMPAT_CLOUDABI32" -.Ed -.Pp -Similarly, -support for 64-bit CloudABI executables can be enabled by adding this -line: -.Bd -ragged -offset indent -.Cd "options COMPAT_CLOUDABI64" -.Ed -.Pp -CloudABI support can also be loaded at boot time from -.Xr loader.conf 5 : -.Bd -literal -offset indent -cloudabi_load="YES" -cloudabi32_load="YES" -cloudabi64_load="YES" -.Ed -.Sh DESCRIPTION -CloudABI is a POSIX-like pure capability-based runtime environment, -similar to -.Xr capsicum 4 . -It can be used to develop applications that are cross-platform, -easier to test, -and hardened against security exploits. -.Pp -Support for CloudABI on -.Fx -consists of three separate kernel modules. -The -.Nm cloudabi -kernel module implements all of the system calls that do not depend on -data structures that differ between hardware architectures. -.Pp -The -.Nm cloudabi32 -and -.Nm cloudabi64 -kernel modules provide implementations of all of the machine-dependent -system calls, -assuming that pointers stored in data structures are either 32 bits or -64 bits in size. -These modules also provide the image activators that load and start ELF -executables. -.Pp -Though the -.Nm cloudabi -module can be loaded on any architecture supported by -.Fx , -the -.Nm cloudabi32 -module is only available on amd64, arm64, armv6, armv7 and i386. -The same holds for the -.Nm cloudabi64 -module, -which is only available for amd64 and arm64. -.Pp -A full cross compilation toolchain for CloudABI is available in the -.Pa devel/cloudabi-toolchain -port. -.Pp -The -.Pa sysutils/cloudabi-utils -port provides the -.Xr cloudabi-run 1 -utility. -.Xr cloudabi-run 1 -can be used to safely execute CloudABI processes with access to a -restricted set of resources. -.Sh SEE ALSO -.Xr cloudabi-run 1 , -.Xr capsicum 4 , -.Xr linux 4 , -.Xr elf 5 -.Pp -CloudABI for FreeBSD: -.Pa https://nuxi.nl/cloudabi/freebsd/ . -.Pp -cloudlibc on GitHub: -.Pa https://github.com/NuxiNL/cloudlibc . -.Pp -The CloudABI Ports Collection on GitHub: -.Pa https://github.com/NuxiNL/cloudabi-ports . -.Sh HISTORY -CloudABI support first appeared in -.Fx 11.0 . -.Sh AUTHORS -.An Nuxi : Pa https://nuxi.nl/ . diff --git a/sys/amd64/cloudabi32/cloudabi32_sysvec.c b/sys/amd64/cloudabi32/cloudabi32_sysvec.c deleted file mode 100644 index 5bb4803ac715..000000000000 --- a/sys/amd64/cloudabi32/cloudabi32_sysvec.c +++ /dev/null @@ -1,239 +0,0 @@ -/*- - * Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/ - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include - -#include -#include - -#include -#include - -extern const char *cloudabi32_syscallnames[]; -extern struct sysent cloudabi32_sysent[]; - -extern unsigned long ia32_maxssiz; - -static int -cloudabi32_fixup_tcb(uintptr_t *stack_base, struct image_params *imgp) -{ - int error; - uint32_t args[2]; - - /* Place auxiliary vector and TCB on the stack. */ - error = cloudabi32_fixup(stack_base, imgp); - if (error != 0) - return (error); - - /* - * On i386, the TCB is referred to by %gs:0. Reuse the empty - * space normally used by the return address (args[0]) to store - * a single element array, containing a pointer to the TCB. %gs - * base will point to this. - * - * Also let the first argument of the entry point (args[1]) - * refer to the auxiliary vector, which is stored right after - * the TCB. - */ - args[0] = *stack_base; - args[1] = *stack_base + - roundup(sizeof(cloudabi32_tcb_t), sizeof(register_t)); - *stack_base -= roundup2(sizeof(args), sizeof(register_t)); - return (copyout(args, (void *)*stack_base, sizeof(args))); -} - -static void -cloudabi32_proc_setregs(struct thread *td, struct image_params *imgp, - uintptr_t stack) -{ - - ia32_setregs(td, imgp, stack); - (void)cpu_set_user_tls(td, TO_PTR(stack)); -} - -static int -cloudabi32_fetch_syscall_args(struct thread *td) -{ - struct trapframe *frame; - struct syscall_args *sa; - int error; - - frame = td->td_frame; - sa = &td->td_sa; - - /* Obtain system call number. */ - sa->code = frame->tf_rax; - sa->original_code = sa->code; - if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) - return (ENOSYS); - sa->callp = &cloudabi32_sysent[sa->code]; - - /* - * Fetch system call arguments. - * - * The vDSO has already made sure that the arguments are - * eight-byte aligned. Pointers and size_t parameters are - * zero-extended. This makes it possible to copy in the - * arguments directly. As long as the call doesn't use 32-bit - * data structures, we can just invoke the same system call - * implementation used by 64-bit processes. - */ - error = copyin((void *)frame->tf_rcx, sa->args, - sa->callp->sy_narg * sizeof(sa->args[0])); - if (error != 0) - return (error); - - /* Default system call return values. */ - td->td_retval[0] = 0; - td->td_retval[1] = 0; - return (0); -} - -static void -cloudabi32_set_syscall_retval(struct thread *td, int error) -{ - struct trapframe *frame = td->td_frame; - - switch (error) { - case 0: - /* - * System call succeeded. - * - * Simply copy out the 64-bit return values into the - * same buffer provided for system call arguments. The - * vDSO will copy them to the right spot, truncating - * pointers and size_t values to 32 bits. - */ - frame->tf_rax = copyout(td->td_retval, (void *)frame->tf_rcx, - sizeof(td->td_retval)) == 0 ? 0 : CLOUDABI_EFAULT; - break; - case ERESTART: - /* Restart system call. */ - frame->tf_rip -= frame->tf_err; - frame->tf_r10 = frame->tf_rcx; - set_pcb_flags(td->td_pcb, PCB_FULL_IRET); - break; - case EJUSTRETURN: - break; - default: - /* System call returned an error. */ - frame->tf_rax = cloudabi_convert_errno(error); - break; - } -} - -static void -cloudabi32_schedtail(struct thread *td) -{ - struct trapframe *frame = td->td_frame; - register_t retval[2]; - - /* Return values for processes returning from fork. */ - if ((td->td_pflags & TDP_FORKING) != 0) { - retval[0] = CLOUDABI_PROCESS_CHILD; - retval[1] = td->td_tid; - copyout(retval, (void *)frame->tf_rcx, sizeof(retval)); - } -} - -int -cloudabi32_thread_setregs(struct thread *td, - const cloudabi32_threadattr_t *attr, uint32_t tcb) -{ - stack_t stack; - uint32_t args[3]; - void *frameptr; - int error; - - /* Perform standard register initialization. */ - stack.ss_sp = TO_PTR(attr->stack); - stack.ss_size = attr->stack_len - sizeof(args); - cpu_set_upcall(td, TO_PTR(attr->entry_point), NULL, &stack); - - /* - * Copy the arguments for the thread entry point onto the stack - * (args[1] and args[2]). Similar to process startup, use the - * otherwise unused return address (args[0]) for TLS. - */ - args[0] = tcb; - args[1] = td->td_tid; - args[2] = attr->argument; - frameptr = (void *)td->td_frame->tf_rsp; - error = copyout(args, frameptr, sizeof(args)); - if (error != 0) - return (error); - - return (cpu_set_user_tls(td, frameptr)); -} - -static struct sysentvec cloudabi32_elf_sysvec = { - .sv_size = CLOUDABI32_SYS_MAXSYSCALL, - .sv_table = cloudabi32_sysent, - .sv_fixup = cloudabi32_fixup_tcb, - .sv_name = "CloudABI ELF32", - .sv_coredump = elf32_coredump, - .sv_elf_core_osabi = ELFOSABI_FREEBSD, - .sv_elf_core_abi_vendor = FREEBSD_ABI_VENDOR, - .sv_elf_core_prepare_notes = elf32_prepare_notes, - .sv_minuser = FREEBSD32_MINUSER, - .sv_maxuser = FREEBSD32_MAXUSER, - .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, - .sv_copyout_strings = cloudabi32_copyout_strings, - .sv_setregs = cloudabi32_proc_setregs, - .sv_fixlimit = ia32_fixlimit, - .sv_maxssiz = &ia32_maxssiz, - .sv_flags = SV_ABI_CLOUDABI | SV_CAPSICUM | SV_IA32 | SV_ILP32, - .sv_set_syscall_retval = cloudabi32_set_syscall_retval, - .sv_fetch_syscall_args = cloudabi32_fetch_syscall_args, - .sv_syscallnames = cloudabi32_syscallnames, - .sv_schedtail = cloudabi32_schedtail, - .sv_set_fork_retval = x86_set_fork_retval, -}; - -INIT_SYSENTVEC(elf_sysvec, &cloudabi32_elf_sysvec); - -Elf32_Brandinfo cloudabi32_brand = { - .brand = ELFOSABI_CLOUDABI, - .machine = EM_386, - .sysvec = &cloudabi32_elf_sysvec, - .flags = BI_BRAND_ONLY_STATIC, -}; diff --git a/sys/amd64/cloudabi64/cloudabi64_sysvec.c b/sys/amd64/cloudabi64/cloudabi64_sysvec.c deleted file mode 100644 index 82c971212087..000000000000 --- a/sys/amd64/cloudabi64/cloudabi64_sysvec.c +++ /dev/null @@ -1,226 +0,0 @@ -/*- - * Copyright (c) 2015 Nuxi, https://nuxi.nl/ - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include - -#include -#include - -extern const char *cloudabi64_syscallnames[]; -extern struct sysent cloudabi64_sysent[]; - -static int -cloudabi64_fixup_tcb(uintptr_t *stack_base, struct image_params *imgp) -{ - int error; - register_t tcbptr; - - /* Place auxiliary vector and TCB on the stack. */ - error = cloudabi64_fixup(stack_base, imgp); - if (error != 0) - return (error); - - /* - * On x86-64, the TCB is referred to by %fs:0. Take some space - * from the top of the stack to store a single element array, - * containing a pointer to the TCB. %fs base will point to this. - */ - tcbptr = (register_t)*stack_base; - *stack_base -= sizeof(tcbptr); - return (copyout(&tcbptr, (void *)*stack_base, sizeof(tcbptr))); -} - -static void -cloudabi64_proc_setregs(struct thread *td, struct image_params *imgp, - uintptr_t stack) -{ - struct trapframe *regs; - - exec_setregs(td, imgp, stack); - - /* - * The stack now contains a pointer to the TCB, the TCB itself, - * and the auxiliary vector. Let %rdx point to the auxiliary - * vector, and set %fs base to the address of the TCB. - */ - regs = td->td_frame; - regs->tf_rdi = stack + sizeof(register_t) + - roundup(sizeof(cloudabi64_tcb_t), sizeof(register_t)); - (void)cpu_set_user_tls(td, TO_PTR(stack)); -} - -static int -cloudabi64_fetch_syscall_args(struct thread *td) -{ - struct trapframe *frame; - struct syscall_args *sa; - - frame = td->td_frame; - sa = &td->td_sa; - - /* Obtain system call number. */ - sa->code = frame->tf_rax; - sa->original_code = sa->code; - if (sa->code >= CLOUDABI64_SYS_MAXSYSCALL) - return (ENOSYS); - sa->callp = &cloudabi64_sysent[sa->code]; - - /* Fetch system call arguments. */ - sa->args[0] = frame->tf_rdi; - sa->args[1] = frame->tf_rsi; - sa->args[2] = frame->tf_rdx; - sa->args[3] = frame->tf_rcx; /* Actually %r10. */ - sa->args[4] = frame->tf_r8; - sa->args[5] = frame->tf_r9; - - /* Default system call return values. */ - td->td_retval[0] = 0; - td->td_retval[1] = frame->tf_rdx; - return (0); -} - -static void -cloudabi64_set_syscall_retval(struct thread *td, int error) -{ - struct trapframe *frame = td->td_frame; - - switch (error) { - case 0: - /* System call succeeded. */ - frame->tf_rax = td->td_retval[0]; - frame->tf_rdx = td->td_retval[1]; - frame->tf_rflags &= ~PSL_C; - break; - case ERESTART: - /* Restart system call. */ - frame->tf_rip -= frame->tf_err; - frame->tf_r10 = frame->tf_rcx; - set_pcb_flags(td->td_pcb, PCB_FULL_IRET); - break; - case EJUSTRETURN: - break; - default: - /* System call returned an error. */ - frame->tf_rax = cloudabi_convert_errno(error); - frame->tf_rflags |= PSL_C; - break; - } -} - -static void -cloudabi64_schedtail(struct thread *td) -{ - struct trapframe *frame = td->td_frame; - - /* Initial register values for processes returning from fork. */ - frame->tf_rax = CLOUDABI_PROCESS_CHILD; - frame->tf_rdx = td->td_tid; -} - -int -cloudabi64_thread_setregs(struct thread *td, - const cloudabi64_threadattr_t *attr, uint64_t tcb) -{ - struct trapframe *frame; - stack_t stack; - uint64_t tcbptr; - int error; - - /* - * On x86-64, the TCB is referred to by %fs:0. Take some space - * from the top of the stack to store a single element array, - * containing a pointer to the TCB. %fs base will point to this. - */ - tcbptr = rounddown(attr->stack + attr->stack_len - sizeof(tcbptr), - _Alignof(tcbptr)); - error = copyout(&tcb, (void *)tcbptr, sizeof(tcb)); - if (error != 0) - return (error); - - /* Perform standard register initialization. */ - stack.ss_sp = TO_PTR(attr->stack); - stack.ss_size = tcbptr - attr->stack; - cpu_set_upcall(td, TO_PTR(attr->entry_point), NULL, &stack); - - /* - * Pass in the thread ID of the new thread and the argument - * pointer provided by the parent thread in as arguments to the - * entry point. - */ - frame = td->td_frame; - frame->tf_rdi = td->td_tid; - frame->tf_rsi = attr->argument; - - return (cpu_set_user_tls(td, TO_PTR(tcbptr))); -} - -static struct sysentvec cloudabi64_elf_sysvec = { - .sv_size = CLOUDABI64_SYS_MAXSYSCALL, - .sv_table = cloudabi64_sysent, - .sv_fixup = cloudabi64_fixup_tcb, - .sv_name = "CloudABI ELF64", - .sv_coredump = elf64_coredump, - .sv_elf_core_osabi = ELFOSABI_FREEBSD, - .sv_elf_core_abi_vendor = FREEBSD_ABI_VENDOR, - .sv_elf_core_prepare_notes = elf64_prepare_notes, - .sv_minuser = VM_MIN_ADDRESS, - /* Keep top page reserved to work around AMD Ryzen stability issues. */ - .sv_maxuser = VM_MAXUSER_ADDRESS - PAGE_SIZE, - .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, - .sv_copyout_strings = cloudabi64_copyout_strings, - .sv_setregs = cloudabi64_proc_setregs, - .sv_flags = SV_ABI_CLOUDABI | SV_CAPSICUM | SV_LP64, - .sv_set_syscall_retval = cloudabi64_set_syscall_retval, - .sv_fetch_syscall_args = cloudabi64_fetch_syscall_args, - .sv_syscallnames = cloudabi64_syscallnames, - .sv_schedtail = cloudabi64_schedtail, - .sv_set_fork_retval = x86_set_fork_retval, -}; - -INIT_SYSENTVEC(elf_sysvec, &cloudabi64_elf_sysvec); - -Elf64_Brandinfo cloudabi64_brand = { - .brand = ELFOSABI_CLOUDABI, - .machine = EM_X86_64, - .sysvec = &cloudabi64_elf_sysvec, - .flags = BI_CAN_EXEC_DYN | BI_BRAND_ONLY_STATIC, -}; diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES index ce0a5ed3c975..ce1cf6bb76ce 100644 --- a/sys/amd64/conf/NOTES +++ b/sys/amd64/conf/NOTES @@ -626,12 +626,6 @@ options COMPAT_FREEBSD32 # Enable (32-bit) a.out binary support options COMPAT_AOUT -# Enable 32-bit runtime support for CloudABI binaries. -options COMPAT_CLOUDABI32 - -# Enable 64-bit runtime support for CloudABI binaries. -options COMPAT_CLOUDABI64 - ##################################################################### # ZFS support diff --git a/sys/arm/cloudabi32/cloudabi32_sysvec.c b/sys/arm/cloudabi32/cloudabi32_sysvec.c deleted file mode 100644 index 4df57b22e13d..000000000000 --- a/sys/arm/cloudabi32/cloudabi32_sysvec.c +++ /dev/null @@ -1,199 +0,0 @@ -/*- - * Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/ - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include -#include *** 16294 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Sep 21 21:19:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B5D667B564; Tue, 21 Sep 2021 21:19:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDZ7f28DYz4bFG; Tue, 21 Sep 2021 21:19: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 2B7D12E58; Tue, 21 Sep 2021 21:19:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LLJgiv041688; Tue, 21 Sep 2021 21:19:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LLJgqC041687; Tue, 21 Sep 2021 21:19:42 GMT (envelope-from git) Date: Tue, 21 Sep 2021 21:19:42 GMT Message-Id: <202109212119.18LLJgqC041687@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 397f188936c8 - main - Remove SV_CAPSICUM MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 397f188936c8a29b6a2d4d13f0cf5681b4bcb9a3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 21:19:42 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=397f188936c8a29b6a2d4d13f0cf5681b4bcb9a3 commit 397f188936c8a29b6a2d4d13f0cf5681b4bcb9a3 Author: Konstantin Belousov AuthorDate: 2021-09-13 09:49:13 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 21:18:44 +0000 Remove SV_CAPSICUM It was only needed for cloudabi Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D31923 --- sys/kern/kern_exec.c | 4 ---- sys/sys/sysent.h | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index b6959dc18f50..cbe0152a8001 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -681,10 +681,6 @@ interpret: goto exec_fail_dealloc; } - /* ABI enforces the use of Capsicum. Switch into capabilities mode. */ - if (SV_PROC_FLAG(p, SV_CAPSICUM)) - sys_cap_enter(td, NULL); - /* * Copy out strings (args and env) and initialize stack base. */ diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 36d5e473142e..ad50bf56e87d 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -165,7 +165,7 @@ struct sysentvec { #define SV_IA32 0x004000 /* Intel 32-bit executable. */ #define SV_AOUT 0x008000 /* a.out executable. */ #define SV_SHP 0x010000 /* Shared page. */ -#define SV_CAPSICUM 0x020000 /* Force cap_enter() on startup. */ +#define SV_AVAIL1 0x020000 /* Unused */ #define SV_TIMEKEEP 0x040000 /* Shared page timehands. */ #define SV_ASLR 0x080000 /* ASLR allowed. */ #define SV_RNG_SEED_VER 0x100000 /* random(4) reseed generation. */ From owner-dev-commits-src-all@freebsd.org Tue Sep 21 21:21:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1C7567B85C; Tue, 21 Sep 2021 21:21:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDZ9K5d2xz4bTP; Tue, 21 Sep 2021 21:21: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 A1AC12FED; Tue, 21 Sep 2021 21:21:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LLL93B053366; Tue, 21 Sep 2021 21:21:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LLL9kF053365; Tue, 21 Sep 2021 21:21:09 GMT (envelope-from git) Date: Tue, 21 Sep 2021 21:21:09 GMT Message-Id: <202109212121.18LLL9kF053365@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Houchard Subject: git: 2191473724fb - main - arm64: Handle thumb2 thread entry point. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2191473724fbac4a7ca6da24bdc23164126ee904 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 21:21:09 -0000 The branch main has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=2191473724fbac4a7ca6da24bdc23164126ee904 commit 2191473724fbac4a7ca6da24bdc23164126ee904 Author: Olivier Houchard AuthorDate: 2021-09-21 21:17:53 +0000 Commit: Olivier Houchard CommitDate: 2021-09-21 21:20:27 +0000 arm64: Handle thumb2 thread entry point. In cpu_set_upcall(), if the thread startup routine is a thumb routine, make sure to set PSR_T, so that the CPU will run in thumb mode. MFC After: 1 week --- sys/arm64/arm64/vm_machdep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index bf7641074317..dfc2f8cb267f 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -200,9 +200,11 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *), void *arg, struct trapframe *tf = td->td_frame; /* 32bits processes use r13 for sp */ - if (td->td_frame->tf_spsr & PSR_M_32) + if (td->td_frame->tf_spsr & PSR_M_32) { tf->tf_x[13] = STACKALIGN((uintptr_t)stack->ss_sp + stack->ss_size); - else + if ((register_t)entry & 1) + tf->tf_spsr |= PSR_T; + } else tf->tf_sp = STACKALIGN((uintptr_t)stack->ss_sp + stack->ss_size); tf->tf_elr = (register_t)entry; tf->tf_x[0] = (register_t)arg; From owner-dev-commits-src-all@freebsd.org Tue Sep 21 21:21:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 09D0767B8E7; Tue, 21 Sep 2021 21:21:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDZ9L6HtBz4bR7; Tue, 21 Sep 2021 21:21:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B936F2FEF; Tue, 21 Sep 2021 21:21: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 18LLLAw6053397; Tue, 21 Sep 2021 21:21:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LLLAvB053396; Tue, 21 Sep 2021 21:21:10 GMT (envelope-from git) Date: Tue, 21 Sep 2021 21:21:10 GMT Message-Id: <202109212121.18LLLAvB053396@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Houchard Subject: git: a342ecd326ee - main - arm: Handle thumb2 thread entry point. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a342ecd326ee9e021b0a4d6dc8aca1a297c606f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 21:21:11 -0000 The branch main has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=a342ecd326ee9e021b0a4d6dc8aca1a297c606f8 commit a342ecd326ee9e021b0a4d6dc8aca1a297c606f8 Author: Olivier Houchard AuthorDate: 2021-09-21 21:19:46 +0000 Commit: Olivier Houchard CommitDate: 2021-09-21 21:20:27 +0000 arm: Handle thumb2 thread entry point. In cpu_set_upcall(), if the thread startup routine is a thumb routine, make sure to set PSR_T, so that the CPU will run in thumb mode. MFC After: 1 week --- sys/arm/arm/vm_machdep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/arm/arm/vm_machdep.c b/sys/arm/arm/vm_machdep.c index 03bbf75ebf71..ba44aa162e8b 100644 --- a/sys/arm/arm/vm_machdep.c +++ b/sys/arm/arm/vm_machdep.c @@ -235,6 +235,8 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *), void *arg, tf->tf_pc = (int)entry; tf->tf_r0 = (int)arg; tf->tf_spsr = PSR_USR32_MODE; + if ((register_t)entry & 1) + tf->tf_spsr |= PSR_T; } int From owner-dev-commits-src-all@freebsd.org Tue Sep 21 22:19:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06C7467C1E7; Tue, 21 Sep 2021 22:19: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 4HDbSX6P2Yz4gxc; Tue, 21 Sep 2021 22:19:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB32C43C4; Tue, 21 Sep 2021 22:19:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LMJOaQ023246; Tue, 21 Sep 2021 22:19:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LMJOtb023245; Tue, 21 Sep 2021 22:19:24 GMT (envelope-from git) Date: Tue, 21 Sep 2021 22:19:24 GMT Message-Id: <202109212219.18LMJOtb023245@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: e745d729be60 - main - sched_ule(4): Improve long-term load balancer. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e745d729be60a47b49eb19c02a6864a747fb2744 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 22:19:25 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=e745d729be60a47b49eb19c02a6864a747fb2744 commit e745d729be60a47b49eb19c02a6864a747fb2744 Author: Alexander Motin AuthorDate: 2021-09-21 22:14:22 +0000 Commit: Alexander Motin CommitDate: 2021-09-21 22:19:20 +0000 sched_ule(4): Improve long-term load balancer. Before this change long-term load balancer was unable to migrate running threads, only ones waiting on run queues. But with growing number of CPU cores it is quite typical now for system to not have many waiting threads. But same time if due to some coincidence two long-running CPU-bound threads ended up sharing same physical CPU core, they could suffer from the SMT penalty indefinitely, and the load balancer couldn't help. Improve that by teaching the load balancer to hint running threads to migrate by marking them with TDF_NEEDRESCHED and new TDF_PICKCPU flag, making sched_pickcpu() to search for better CPU later, when it is convenient. Fix CPU search logic when balancing to limit round-robin migrations in case of almost equal load to the group of physical cores. The previous code bounced threads across all the system, that should be pretty bad for caches and NUMA affinity, while additional fairness was almost invisible, diminishing with number of cores in the group. MFC after: 1 month --- sys/kern/sched_ule.c | 119 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 93 insertions(+), 26 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 90f294bb0d4d..711119c84383 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -196,6 +196,7 @@ _Static_assert(sizeof(struct thread) + sizeof(struct td_sched) <= #define SCHED_SLICE_MIN_DIVISOR 6 /* DEFAULT/MIN = ~16 ms. */ /* Flags kept in td_flags. */ +#define TDF_PICKCPU TDF_SCHED0 /* Thread should pick new CPU. */ #define TDF_SLICEEND TDF_SCHED2 /* Thread time slice is over. */ /* @@ -633,15 +634,16 @@ sched_random(void) } struct cpu_search { - cpuset_t *cs_mask; - u_int cs_prefer; + cpuset_t *cs_mask; /* The mask of allowed CPUs to choose from. */ + int cs_prefer; /* Prefer this CPU and groups including it. */ + int cs_running; /* The thread is now running at cs_prefer. */ int cs_pri; /* Min priority for low. */ int cs_limit; /* Max load for low, min load for high. */ }; struct cpu_search_res { - int cs_cpu; - int cs_load; + int cs_cpu; /* The best CPU found. */ + int cs_load; /* The load of cs_cpu. */ }; /* @@ -657,7 +659,7 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, { struct cpu_search_res lr; struct tdq *tdq; - int c, bload, l, load, total; + int c, bload, l, load, p, total; total = 0; bload = INT_MAX; @@ -668,6 +670,17 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, for (c = cg->cg_children - 1; c >= 0; c--) { load = cpu_search_lowest(&cg->cg_child[c], s, &lr); total += load; + + /* + * When balancing do not prefer SMT groups with load >1. + * It allows round-robin between SMT groups with equal + * load within parent group for more fair scheduling. + */ + if (__predict_false(s->cs_running) && + (cg->cg_child[c].cg_flags & CG_FLAG_THREAD) && + load >= 128 && (load & 128) != 0) + load += 128; + if (lr.cs_cpu >= 0 && (load < bload || (load == bload && lr.cs_load < r->cs_load))) { bload = load; @@ -684,20 +697,40 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, continue; tdq = TDQ_CPU(c); l = tdq->tdq_load; + if (c == s->cs_prefer) { + if (__predict_false(s->cs_running)) + l--; + p = 128; + } else + p = 0; load = l * 256; - if (c == s->cs_prefer) - load -= 128; - total += load; - if (l > s->cs_limit || tdq->tdq_lowpri <= s->cs_pri || + total += load - p; + + /* + * Check this CPU is acceptable. + * If the threads is already on the CPU, don't look on the TDQ + * priority, since it can be the priority of the thread itself. + */ + if (l > s->cs_limit || (tdq->tdq_lowpri <= s->cs_pri && + (!s->cs_running || c != s->cs_prefer)) || !CPU_ISSET(c, s->cs_mask)) continue; + + /* + * When balancing do not prefer CPUs with load > 1. + * It allows round-robin between CPUs with equal load + * within the CPU group for more fair scheduling. + */ + if (__predict_false(s->cs_running) && l > 0) + p = 0; + load -= sched_random() % 128; - if (load < bload) { - bload = load; + if (bload > load - p) { + bload = load - p; r->cs_cpu = c; + r->cs_load = load; } } - r->cs_load = bload; return (total); } @@ -736,9 +769,17 @@ cpu_search_highest(const struct cpu_group *cg, const struct cpu_search *s, l = tdq->tdq_load; load = l * 256; total += load; - if (l < s->cs_limit || !tdq->tdq_transferable || + + /* + * Check this CPU is acceptable. + * If requested minimum load is 1, then caller must know how + * to handle running threads, not counted in tdq_transferable. + */ + if (l < s->cs_limit || (tdq->tdq_transferable == 0 && + (s->cs_limit > 1 || l > 1)) || !CPU_ISSET(c, s->cs_mask)) continue; + load -= sched_random() % 256; if (load > bload) { bload = load; @@ -756,12 +797,13 @@ cpu_search_highest(const struct cpu_group *cg, const struct cpu_search *s, */ static inline int sched_lowest(const struct cpu_group *cg, cpuset_t *mask, int pri, int maxload, - int prefer) + int prefer, int running) { struct cpu_search s; struct cpu_search_res r; s.cs_prefer = prefer; + s.cs_running = running; s.cs_mask = mask; s.cs_pri = pri; s.cs_limit = maxload; @@ -788,12 +830,13 @@ static void sched_balance_group(struct cpu_group *cg) { struct tdq *tdq; + struct thread *td; cpuset_t hmask, lmask; int high, low, anylow; CPU_FILL(&hmask); for (;;) { - high = sched_highest(cg, &hmask, 2); + high = sched_highest(cg, &hmask, 1); /* Stop if there is no more CPU with transferrable threads. */ if (high == -1) break; @@ -802,10 +845,28 @@ sched_balance_group(struct cpu_group *cg) /* Stop if there is no more CPU left for low. */ if (CPU_EMPTY(&lmask)) break; - anylow = 1; tdq = TDQ_CPU(high); + if (tdq->tdq_load == 1) { + /* + * There is only one running thread. We can't move + * it from here, so tell it to pick new CPU by itself. + */ + TDQ_LOCK(tdq); + td = pcpu_find(high)->pc_curthread; + if ((td->td_flags & TDF_IDLETD) == 0 && + THREAD_CAN_MIGRATE(td)) { + td->td_flags |= TDF_NEEDRESCHED | TDF_PICKCPU; + if (high != curcpu) + ipi_cpu(high, IPI_AST); + } + TDQ_UNLOCK(tdq); + break; + } + anylow = 1; nextlow: - low = sched_lowest(cg, &lmask, -1, tdq->tdq_load - 1, high); + if (tdq->tdq_transferable == 0) + continue; + low = sched_lowest(cg, &lmask, -1, tdq->tdq_load - 1, high, 1); /* Stop if we looked well and found no less loaded CPU. */ if (anylow && low == -1) break; @@ -1227,7 +1288,7 @@ sched_pickcpu(struct thread *td, int flags) struct td_sched *ts; struct tdq *tdq; cpuset_t *mask; - int cpu, pri, self, intr; + int cpu, pri, r, self, intr; self = PCPU_GET(cpuid); ts = td_get_sched(td); @@ -1305,32 +1366,33 @@ llc: cpu = -1; mask = &td->td_cpuset->cs_mask; pri = td->td_priority; + r = TD_IS_RUNNING(td); /* * Try hard to keep interrupts within found LLC. Search the LLC for * the least loaded CPU we can run now. For NUMA systems it should * be within target domain, and it also reduces scheduling overhead. */ if (ccg != NULL && intr) { - cpu = sched_lowest(ccg, mask, pri, INT_MAX, ts->ts_cpu); + cpu = sched_lowest(ccg, mask, pri, INT_MAX, ts->ts_cpu, r); if (cpu >= 0) SCHED_STAT_INC(pickcpu_intrbind); } else /* Search the LLC for the least loaded idle CPU we can run now. */ if (ccg != NULL) { cpu = sched_lowest(ccg, mask, max(pri, PRI_MAX_TIMESHARE), - INT_MAX, ts->ts_cpu); + INT_MAX, ts->ts_cpu, r); if (cpu >= 0) SCHED_STAT_INC(pickcpu_affinity); } /* Search globally for the least loaded CPU we can run now. */ if (cpu < 0) { - cpu = sched_lowest(cpu_top, mask, pri, INT_MAX, ts->ts_cpu); + cpu = sched_lowest(cpu_top, mask, pri, INT_MAX, ts->ts_cpu, r); if (cpu >= 0) SCHED_STAT_INC(pickcpu_lowest); } /* Search globally for the least loaded CPU. */ if (cpu < 0) { - cpu = sched_lowest(cpu_top, mask, -1, INT_MAX, ts->ts_cpu); + cpu = sched_lowest(cpu_top, mask, -1, INT_MAX, ts->ts_cpu, r); if (cpu >= 0) SCHED_STAT_INC(pickcpu_lowest); } @@ -2056,7 +2118,7 @@ sched_switch(struct thread *td, int flags) struct td_sched *ts; struct mtx *mtx; int srqflag; - int cpuid, preempted; + int cpuid, pickcpu, preempted; THREAD_LOCK_ASSERT(td, MA_OWNED); @@ -2064,11 +2126,15 @@ sched_switch(struct thread *td, int flags) tdq = TDQ_SELF(); ts = td_get_sched(td); sched_pctcpu_update(ts, 1); - ts->ts_rltick = ticks; + pickcpu = (td->td_flags & TDF_PICKCPU) != 0; + if (pickcpu) + ts->ts_rltick = ticks - affinity * MAX_CACHE_LEVELS; + else + ts->ts_rltick = ticks; td->td_lastcpu = td->td_oncpu; preempted = (td->td_flags & TDF_SLICEEND) == 0 && (flags & SW_PREEMPT) != 0; - td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); + td->td_flags &= ~(TDF_NEEDRESCHED | TDF_PICKCPU | TDF_SLICEEND); td->td_owepreempt = 0; tdq->tdq_owepreempt = 0; if (!TD_IS_IDLETHREAD(td)) @@ -2088,7 +2154,8 @@ sched_switch(struct thread *td, int flags) SRQ_OURSELF|SRQ_YIELDING|SRQ_PREEMPTED : SRQ_OURSELF|SRQ_YIELDING; #ifdef SMP - if (THREAD_CAN_MIGRATE(td) && !THREAD_CAN_SCHED(td, ts->ts_cpu)) + if (THREAD_CAN_MIGRATE(td) && (!THREAD_CAN_SCHED(td, ts->ts_cpu) + || pickcpu)) ts->ts_cpu = sched_pickcpu(td, 0); #endif if (ts->ts_cpu == cpuid) From owner-dev-commits-src-all@freebsd.org Tue Sep 21 23:43:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E881B67F1C9; Tue, 21 Sep 2021 23:43: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 4HDdKj61ckz4qQQ; Tue, 21 Sep 2021 23:43: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 AE6A65732; Tue, 21 Sep 2021 23:43: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 18LNhb7L047863; Tue, 21 Sep 2021 23:43:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LNhbdl047862; Tue, 21 Sep 2021 23:43:37 GMT (envelope-from git) Date: Tue, 21 Sep 2021 23:43:37 GMT Message-Id: <202109212343.18LNhbdl047862@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 395660129266 - stable/13 - hmt(4): Adapt to recent KPI changes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3956601292662dc8cab6e6956a822a6a95823796 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 23:43:38 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=3956601292662dc8cab6e6956a822a6a95823796 commit 3956601292662dc8cab6e6956a822a6a95823796 Author: Vladimir Kondratyev AuthorDate: 2021-09-02 19:25:27 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-21 23:35:58 +0000 hmt(4): Adapt to recent KPI changes (cherry picked from commit 9d8ebe5ea1bedee50856aea7537310bc860bfede) --- sys/dev/hid/hmt.c | 133 +++++++++++++++++++++++------------------------------- 1 file changed, 57 insertions(+), 76 deletions(-) diff --git a/sys/dev/hid/hmt.c b/sys/dev/hid/hmt.c index d04db6954d00..d1b36c424ba8 100644 --- a/sys/dev/hid/hmt.c +++ b/sys/dev/hid/hmt.c @@ -78,105 +78,101 @@ enum hmt_type { }; enum { - HMT_TIP_SWITCH, -#define HMT_SLOT HMT_TIP_SWITCH - HMT_WIDTH, -#define HMT_MAJOR HMT_WIDTH - HMT_HEIGHT, -#define HMT_MINOR HMT_HEIGHT - HMT_ORIENTATION, - HMT_X, - HMT_Y, - HMT_CONTACTID, - HMT_PRESSURE, - HMT_IN_RANGE, - HMT_CONFIDENCE, - HMT_TOOL_X, - HMT_TOOL_Y, - HMT_N_USAGES, + HMT_TIP_SWITCH = ABS_MT_INDEX(ABS_MT_TOOL_TYPE), + HMT_WIDTH = ABS_MT_INDEX(ABS_MT_TOUCH_MAJOR), + HMT_HEIGHT = ABS_MT_INDEX(ABS_MT_TOUCH_MINOR), + HMT_ORIENTATION = ABS_MT_INDEX(ABS_MT_ORIENTATION), + HMT_X = ABS_MT_INDEX(ABS_MT_POSITION_X), + HMT_Y = ABS_MT_INDEX(ABS_MT_POSITION_Y), + HMT_CONTACTID = ABS_MT_INDEX(ABS_MT_TRACKING_ID), + HMT_PRESSURE = ABS_MT_INDEX(ABS_MT_PRESSURE), + HMT_IN_RANGE = ABS_MT_INDEX(ABS_MT_DISTANCE), + HMT_CONFIDENCE = ABS_MT_INDEX(ABS_MT_BLOB_ID), + HMT_TOOL_X = ABS_MT_INDEX(ABS_MT_TOOL_X), + HMT_TOOL_Y = ABS_MT_INDEX(ABS_MT_TOOL_Y), }; -#define HMT_NO_CODE (ABS_MAX + 10) +#define HMT_N_USAGES MT_CNT #define HMT_NO_USAGE -1 struct hmt_hid_map_item { char name[5]; int32_t usage; /* HID usage */ - uint32_t code; /* Evdev event code */ + bool reported; /* Item value is passed to evdev */ bool required; /* Required for MT Digitizers */ }; static const struct hmt_hid_map_item hmt_hid_map[HMT_N_USAGES] = { - [HMT_TIP_SWITCH] = { /* HMT_SLOT */ + [HMT_TIP_SWITCH] = { .name = "TIP", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_TIP_SWITCH), - .code = ABS_MT_SLOT, + .reported = false, .required = true, }, - [HMT_WIDTH] = { /* HMT_MAJOR */ + [HMT_WIDTH] = { .name = "WDTH", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_WIDTH), - .code = ABS_MT_TOUCH_MAJOR, + .reported = true, .required = false, }, - [HMT_HEIGHT] = { /* HMT_MINOR */ + [HMT_HEIGHT] = { .name = "HGHT", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_HEIGHT), - .code = ABS_MT_TOUCH_MINOR, + .reported = true, .required = false, }, [HMT_ORIENTATION] = { .name = "ORIE", .usage = HMT_NO_USAGE, - .code = ABS_MT_ORIENTATION, + .reported = true, .required = false, }, [HMT_X] = { .name = "X", .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), - .code = ABS_MT_POSITION_X, + .reported = true, .required = true, }, [HMT_Y] = { .name = "Y", .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), - .code = ABS_MT_POSITION_Y, + .reported = true, .required = true, }, [HMT_CONTACTID] = { .name = "C_ID", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_CONTACTID), - .code = ABS_MT_TRACKING_ID, + .reported = true, .required = true, }, [HMT_PRESSURE] = { .name = "PRES", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_TIP_PRESSURE), - .code = ABS_MT_PRESSURE, + .reported = true, .required = false, }, [HMT_IN_RANGE] = { .name = "RANG", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_IN_RANGE), - .code = ABS_MT_DISTANCE, + .reported = true, .required = false, }, [HMT_CONFIDENCE] = { .name = "CONF", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_CONFIDENCE), - .code = HMT_NO_CODE, + .reported = false, .required = false, }, - [HMT_TOOL_X] = { /* Shares HID usage with HMT_X */ + [HMT_TOOL_X] = { /* Shares HID usage with POS_X */ .name = "TL_X", .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), - .code = ABS_MT_TOOL_X, + .reported = true, .required = false, }, - [HMT_TOOL_Y] = { /* Shares HID usage with HMT_Y */ + [HMT_TOOL_Y] = { /* Shares HID usage with POS_Y */ .name = "TL_Y", .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), - .code = ABS_MT_TOOL_Y, + .reported = true, .required = false, }, }; @@ -200,7 +196,7 @@ struct hmt_softc { struct evdev_dev *evdev; - uint32_t slot_data[HMT_N_USAGES]; + union evdev_mt_slot slot_data; uint8_t caps[howmany(HMT_N_USAGES, 8)]; uint8_t buttons[howmany(HMT_BTN_MAX, 8)]; uint32_t nconts_per_report; @@ -375,13 +371,6 @@ hmt_attach(device_t dev) sc->cont_count_max = MAX_MT_SLOTS; } - /* Set number of MT protocol type B slots */ - sc->ai[HMT_SLOT] = (struct hid_absinfo) { - .min = 0, - .max = sc->cont_count_max - 1, - .res = 0, - }; - if (hid_test_quirk(hw, HQ_MT_TIMESTAMP) || hmt_timestamps) sc->do_timestamps = true; #ifdef IICHID_SAMPLING @@ -434,9 +423,11 @@ hmt_attach(device_t dev) } } } + evdev_support_abs(sc->evdev, + ABS_MT_SLOT, 0, sc->cont_count_max - 1, 0, 0, 0); HMT_FOREACH_USAGE(sc->caps, i) { - if (hmt_hid_map[i].code != HMT_NO_CODE) - evdev_support_abs(sc->evdev, hmt_hid_map[i].code, + if (hmt_hid_map[i].reported) + evdev_support_abs(sc->evdev, ABS_MT_FIRST + i, sc->ai[i].min, sc->ai[i].max, 0, 0, sc->ai[i].res); } @@ -480,14 +471,14 @@ hmt_intr(void *context, void *buf, hid_size_t len) { struct hmt_softc *sc = context; size_t usage; - uint32_t *slot_data = sc->slot_data; + union evdev_mt_slot *slot_data; uint32_t cont, btn; uint32_t cont_count; uint32_t width; uint32_t height; uint32_t int_btn = 0; uint32_t left_btn = 0; - int32_t slot; + int slot; uint32_t scan_time; int32_t delta; uint8_t id; @@ -502,10 +493,7 @@ hmt_intr(void *context, void *buf, hid_size_t len) if (sc->iichid_sampling && len == 0) { sc->prev_touch = false; sc->timestamp = 0; - for (slot = 0; slot <= sc->ai[HMT_SLOT].max; slot++) { - evdev_push_abs(sc->evdev, ABS_MT_SLOT, slot); - evdev_push_abs(sc->evdev, ABS_MT_TRACKING_ID, -1); - } + /* EVDEV_FLAG_MT_AUTOREL releases all touches for us */ evdev_sync(sc->evdev); return; } @@ -567,56 +555,49 @@ hmt_intr(void *context, void *buf, hid_size_t len) /* Use protocol Type B for reporting events */ for (cont = 0; cont < cont_count; cont++) { + slot_data = &sc->slot_data; bzero(slot_data, sizeof(sc->slot_data)); HMT_FOREACH_USAGE(sc->caps, usage) { if (sc->locs[cont][usage].size > 0) - slot_data[usage] = hid_get_udata( + slot_data->val[usage] = hid_get_udata( buf, len, &sc->locs[cont][usage]); } - slot = evdev_get_mt_slot_by_tracking_id(sc->evdev, - slot_data[HMT_CONTACTID]); + slot = evdev_mt_id_to_slot(sc->evdev, slot_data->id); #ifdef HID_DEBUG DPRINTFN(6, "cont%01x: data = ", cont); if (hmt_debug >= 6) { HMT_FOREACH_USAGE(sc->caps, usage) { if (hmt_hid_map[usage].usage != HMT_NO_USAGE) - printf("%04x ", slot_data[usage]); + printf("%04x ", slot_data->val[usage]); } - printf("slot = %d\n", (int)slot); + printf("slot = %d\n", slot); } #endif if (slot == -1) { DPRINTF("Slot overflow for contact_id %u\n", - (unsigned)slot_data[HMT_CONTACTID]); + (unsigned)slot_data->id); continue; } - if (slot_data[HMT_TIP_SWITCH] != 0 && + if (slot_data->val[HMT_TIP_SWITCH] != 0 && !(isset(sc->caps, HMT_CONFIDENCE) && - slot_data[HMT_CONFIDENCE] == 0)) { + slot_data->val[HMT_CONFIDENCE] == 0)) { /* This finger is in proximity of the sensor */ sc->touch = true; - slot_data[HMT_SLOT] = slot; - slot_data[HMT_IN_RANGE] = !slot_data[HMT_IN_RANGE]; + slot_data->dist = !slot_data->val[HMT_IN_RANGE]; /* Divided by two to match visual scale of touch */ - width = slot_data[HMT_WIDTH] >> 1; - height = slot_data[HMT_HEIGHT] >> 1; - slot_data[HMT_ORIENTATION] = width > height; - slot_data[HMT_MAJOR] = MAX(width, height); - slot_data[HMT_MINOR] = MIN(width, height); - - HMT_FOREACH_USAGE(sc->caps, usage) - if (hmt_hid_map[usage].code != HMT_NO_CODE) - evdev_push_abs(sc->evdev, - hmt_hid_map[usage].code, - slot_data[usage]); - } else { - evdev_push_abs(sc->evdev, ABS_MT_SLOT, slot); - evdev_push_abs(sc->evdev, ABS_MT_TRACKING_ID, -1); - } + width = slot_data->val[HMT_WIDTH] >> 1; + height = slot_data->val[HMT_HEIGHT] >> 1; + slot_data->ori = width > height; + slot_data->maj = MAX(width, height); + slot_data->min = MIN(width, height); + } else + slot_data = NULL; + + evdev_mt_push_slot(sc->evdev, slot, slot_data); } sc->nconts_todo -= cont_count; From owner-dev-commits-src-all@freebsd.org Tue Sep 21 23:43:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5947F67F49D; Tue, 21 Sep 2021 23:43: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 4HDdKm0mvTz4qN7; Tue, 21 Sep 2021 23:43: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 E8D56580D; Tue, 21 Sep 2021 23:43: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 18LNhd3e047918; Tue, 21 Sep 2021 23:43:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LNhdaD047917; Tue, 21 Sep 2021 23:43:39 GMT (envelope-from git) Date: Tue, 21 Sep 2021 23:43:39 GMT Message-Id: <202109212343.18LNhdaD047917@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: d5ed374c401a - stable/13 - cyapa(4): Adapt to recent evdev KPI changes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d5ed374c401ad6b7b35f2621f7ab7565b5583e2d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 23:43:40 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=d5ed374c401ad6b7b35f2621f7ab7565b5583e2d commit d5ed374c401ad6b7b35f2621f7ab7565b5583e2d Author: Vladimir Kondratyev AuthorDate: 2021-09-02 19:28:05 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-21 23:36:40 +0000 cyapa(4): Adapt to recent evdev KPI changes (cherry picked from commit 4836af0d42cf9d299ba9203a835bdcfa797a74c2) --- sys/dev/cyapa/cyapa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/cyapa/cyapa.c b/sys/dev/cyapa/cyapa.c index 517ce8d1bab7..39f3349d5217 100644 --- a/sys/dev/cyapa/cyapa.c +++ b/sys/dev/cyapa/cyapa.c @@ -1377,7 +1377,7 @@ cyapa_raw_input(struct cyapa_softc *sc, struct cyapa_regs *regs, int freq) #ifdef EVDEV_SUPPORT if (evdev_rcpt_mask & EVDEV_RCPT_HW_MOUSE) { for (i = 0; i < nfingers; ++i) { - int32_t slot = evdev_get_mt_slot_by_tracking_id( + int slot = evdev_mt_id_to_slot( sc->evdev, regs->touch[i].id); if (slot == -1) { if (cyapa_debug) From owner-dev-commits-src-all@freebsd.org Tue Sep 21 23:43:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 156CF67F5ED; Tue, 21 Sep 2021 23:43: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 4HDdKk6kwVz4qFL; Tue, 21 Sep 2021 23:43: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 C917F5536; Tue, 21 Sep 2021 23:43: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 18LNhcRo047888; Tue, 21 Sep 2021 23:43:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LNhc51047886; Tue, 21 Sep 2021 23:43:38 GMT (envelope-from git) Date: Tue, 21 Sep 2021 23:43:38 GMT Message-Id: <202109212343.18LNhc51047886@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 3f03cc9a8e20 - stable/13 - wmt(4): Adapt to recent KPI changes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3f03cc9a8e209b5906d8d35491faaf6df28aa8f0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 23:43:39 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=3f03cc9a8e209b5906d8d35491faaf6df28aa8f0 commit 3f03cc9a8e209b5906d8d35491faaf6df28aa8f0 Author: Vladimir Kondratyev AuthorDate: 2021-09-02 19:27:02 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-21 23:36:18 +0000 wmt(4): Adapt to recent KPI changes (cherry picked from commit 527b6d60f86953a40136abcf2f38cc4e70118954) --- sys/dev/usb/input/wmt.c | 136 ++++++++++++++++++++++-------------------------- 1 file changed, 61 insertions(+), 75 deletions(-) diff --git a/sys/dev/usb/input/wmt.c b/sys/dev/usb/input/wmt.c index 8191c6ff9369..661fa622433f 100644 --- a/sys/dev/usb/input/wmt.c +++ b/sys/dev/usb/input/wmt.c @@ -94,105 +94,101 @@ enum wmt_input_mode { }; enum { - WMT_TIP_SWITCH, -#define WMT_SLOT WMT_TIP_SWITCH - WMT_WIDTH, -#define WMT_MAJOR WMT_WIDTH - WMT_HEIGHT, -#define WMT_MINOR WMT_HEIGHT - WMT_ORIENTATION, - WMT_X, - WMT_Y, - WMT_CONTACTID, - WMT_PRESSURE, - WMT_IN_RANGE, - WMT_CONFIDENCE, - WMT_TOOL_X, - WMT_TOOL_Y, - WMT_N_USAGES, + WMT_TIP_SWITCH = ABS_MT_INDEX(ABS_MT_TOOL_TYPE), + WMT_WIDTH = ABS_MT_INDEX(ABS_MT_TOUCH_MAJOR), + WMT_HEIGHT = ABS_MT_INDEX(ABS_MT_TOUCH_MINOR), + WMT_ORIENTATION = ABS_MT_INDEX(ABS_MT_ORIENTATION), + WMT_X = ABS_MT_INDEX(ABS_MT_POSITION_X), + WMT_Y = ABS_MT_INDEX(ABS_MT_POSITION_Y), + WMT_CONTACTID = ABS_MT_INDEX(ABS_MT_TRACKING_ID), + WMT_PRESSURE = ABS_MT_INDEX(ABS_MT_PRESSURE), + WMT_IN_RANGE = ABS_MT_INDEX(ABS_MT_DISTANCE), + WMT_CONFIDENCE = ABS_MT_INDEX(ABS_MT_BLOB_ID), + WMT_TOOL_X = ABS_MT_INDEX(ABS_MT_TOOL_X), + WMT_TOOL_Y = ABS_MT_INDEX(ABS_MT_TOOL_Y), }; -#define WMT_NO_CODE (ABS_MAX + 10) +#define WMT_N_USAGES MT_CNT #define WMT_NO_USAGE -1 struct wmt_hid_map_item { char name[5]; int32_t usage; /* HID usage */ - uint32_t code; /* Evdev event code */ + bool reported; /* Item value is passed to evdev */ bool required; /* Required for MT Digitizers */ }; static const struct wmt_hid_map_item wmt_hid_map[WMT_N_USAGES] = { - [WMT_TIP_SWITCH] = { /* WMT_SLOT */ + [WMT_TIP_SWITCH] = { .name = "TIP", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_TIP_SWITCH), - .code = ABS_MT_SLOT, + .reported = false, .required = true, }, - [WMT_WIDTH] = { /* WMT_MAJOR */ + [WMT_WIDTH] = { .name = "WDTH", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_WIDTH), - .code = ABS_MT_TOUCH_MAJOR, + .reported = true, .required = false, }, - [WMT_HEIGHT] = { /* WMT_MINOR */ + [WMT_HEIGHT] = { .name = "HGHT", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_HEIGHT), - .code = ABS_MT_TOUCH_MINOR, + .reported = true, .required = false, }, [WMT_ORIENTATION] = { .name = "ORIE", .usage = WMT_NO_USAGE, - .code = ABS_MT_ORIENTATION, + .reported = true, .required = false, }, [WMT_X] = { .name = "X", .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), - .code = ABS_MT_POSITION_X, + .reported = true, .required = true, }, [WMT_Y] = { .name = "Y", .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), - .code = ABS_MT_POSITION_Y, + .reported = true, .required = true, }, [WMT_CONTACTID] = { .name = "C_ID", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_CONTACTID), - .code = ABS_MT_TRACKING_ID, + .reported = true, .required = true, }, [WMT_PRESSURE] = { .name = "PRES", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_TIP_PRESSURE), - .code = ABS_MT_PRESSURE, + .reported = true, .required = false, }, [WMT_IN_RANGE] = { .name = "RANG", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_IN_RANGE), - .code = ABS_MT_DISTANCE, + .reported = true, .required = false, }, [WMT_CONFIDENCE] = { .name = "CONF", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_CONFIDENCE), - .code = WMT_NO_CODE, + .reported = false, .required = false, }, [WMT_TOOL_X] = { /* Shares HID usage with WMT_X */ .name = "TL_X", .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), - .code = ABS_MT_TOOL_X, + .reported = true, .required = false, }, [WMT_TOOL_Y] = { /* Shares HID usage with WMT_Y */ .name = "TL_Y", .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), - .code = ABS_MT_TOOL_Y, + .reported = true, .required = false, }, }; @@ -207,6 +203,7 @@ struct wmt_softc { device_t dev; enum wmt_type type; + int32_t cont_count_max; struct mtx mtx; struct wmt_absinfo ai[WMT_N_USAGES]; struct hid_location locs[MAX_MT_SLOTS][WMT_N_USAGES]; @@ -223,7 +220,7 @@ struct wmt_softc { struct usb_xfer *xfer[WMT_N_TRANSFER]; struct evdev_dev *evdev; - uint32_t slot_data[WMT_N_USAGES]; + union evdev_mt_slot slot_data; uint8_t caps[howmany(WMT_N_USAGES, 8)]; uint8_t buttons[howmany(WMT_BTN_MAX, 8)]; uint32_t isize; @@ -361,7 +358,7 @@ wmt_attach(device_t dev) * 'Contact Count Maximum' */ if (cont_count_max > 0) - sc->ai[WMT_SLOT].max = cont_count_max - 1; + sc->cont_count_max = cont_count_max; } else DPRINTF("usbd_req_get_report error=(%s)\n", usbd_errstr(err)); @@ -400,10 +397,10 @@ wmt_attach(device_t dev) } /* Cap contact count maximum to MAX_MT_SLOTS */ - if (sc->ai[WMT_SLOT].max >= MAX_MT_SLOTS) { + if (sc->cont_count_max > MAX_MT_SLOTS) { DPRINTF("Hardware reported %d contacts while only %d is " - "supported\n", (int)sc->ai[WMT_SLOT].max+1, MAX_MT_SLOTS); - sc->ai[WMT_SLOT].max = MAX_MT_SLOTS - 1; + "supported\n", (int)sc->cont_count_max, MAX_MT_SLOTS); + sc->cont_count_max = MAX_MT_SLOTS; } if (/*usb_test_quirk(hw, UQ_MT_TIMESTAMP) ||*/ wmt_timestamps) @@ -456,9 +453,11 @@ wmt_attach(device_t dev) } } } + evdev_support_abs(sc->evdev, + ABS_MT_SLOT, 0, sc->cont_count_max - 1, 0, 0, 0); WMT_FOREACH_USAGE(sc->caps, i) { - if (wmt_hid_map[i].code != WMT_NO_CODE) - evdev_support_abs(sc->evdev, wmt_hid_map[i].code, + if (wmt_hid_map[i].reported) + evdev_support_abs(sc->evdev, ABS_MT_FIRST + i, sc->ai[i].min, sc->ai[i].max, 0, 0, sc->ai[i].res); } @@ -473,7 +472,7 @@ wmt_attach(device_t dev) sc->is_clickpad ? ", click-pad" : ""); device_printf(sc->dev, "%d contacts and [%s%s%s%s%s]. Report range [%d:%d] - [%d:%d]\n", - (int)sc->ai[WMT_SLOT].max + 1, + (int)sc->cont_count_max, isset(sc->caps, WMT_IN_RANGE) ? "R" : "", isset(sc->caps, WMT_CONFIDENCE) ? "C" : "", isset(sc->caps, WMT_WIDTH) ? "W" : "", @@ -504,14 +503,14 @@ static void wmt_process_report(struct wmt_softc *sc, uint8_t *buf, int len) { size_t usage; - uint32_t *slot_data = sc->slot_data; + union evdev_mt_slot *slot_data; uint32_t cont, btn; uint32_t cont_count; uint32_t width; uint32_t height; uint32_t int_btn = 0; uint32_t left_btn = 0; - int32_t slot; + int slot; uint32_t scan_time; int32_t delta; @@ -558,56 +557,49 @@ wmt_process_report(struct wmt_softc *sc, uint8_t *buf, int len) /* Use protocol Type B for reporting events */ for (cont = 0; cont < cont_count; cont++) { + slot_data = &sc->slot_data; bzero(slot_data, sizeof(sc->slot_data)); WMT_FOREACH_USAGE(sc->caps, usage) { if (sc->locs[cont][usage].size > 0) - slot_data[usage] = hid_get_udata( + slot_data->val[usage] = hid_get_udata( buf, len, &sc->locs[cont][usage]); } - slot = evdev_get_mt_slot_by_tracking_id(sc->evdev, - slot_data[WMT_CONTACTID]); + slot = evdev_mt_id_to_slot(sc->evdev, slot_data->id); #ifdef USB_DEBUG DPRINTFN(6, "cont%01x: data = ", cont); if (wmt_debug >= 6) { WMT_FOREACH_USAGE(sc->caps, usage) { if (wmt_hid_map[usage].usage != WMT_NO_USAGE) - printf("%04x ", slot_data[usage]); + printf("%04x ", slot_data->val[usage]); } - printf("slot = %d\n", (int)slot); + printf("slot = %d\n", slot); } #endif if (slot == -1) { DPRINTF("Slot overflow for contact_id %u\n", - (unsigned)slot_data[WMT_CONTACTID]); + (unsigned)slot_data->id); continue; } - if (slot_data[WMT_TIP_SWITCH] != 0 && + if (slot_data->val[WMT_TIP_SWITCH] != 0 && !(isset(sc->caps, WMT_CONFIDENCE) && - slot_data[WMT_CONFIDENCE] == 0)) { + slot_data->val[WMT_CONFIDENCE] == 0)) { /* This finger is in proximity of the sensor */ sc->touch = true; - slot_data[WMT_SLOT] = slot; - slot_data[WMT_IN_RANGE] = !slot_data[WMT_IN_RANGE]; + slot_data->dist = !slot_data->val[WMT_IN_RANGE]; /* Divided by two to match visual scale of touch */ - width = slot_data[WMT_WIDTH] >> 1; - height = slot_data[WMT_HEIGHT] >> 1; - slot_data[WMT_ORIENTATION] = width > height; - slot_data[WMT_MAJOR] = MAX(width, height); - slot_data[WMT_MINOR] = MIN(width, height); - - WMT_FOREACH_USAGE(sc->caps, usage) - if (wmt_hid_map[usage].code != WMT_NO_CODE) - evdev_push_abs(sc->evdev, - wmt_hid_map[usage].code, - slot_data[usage]); - } else { - evdev_push_abs(sc->evdev, ABS_MT_SLOT, slot); - evdev_push_abs(sc->evdev, ABS_MT_TRACKING_ID, -1); - } + width = slot_data->val[WMT_WIDTH] >> 1; + height = slot_data->val[WMT_HEIGHT] >> 1; + slot_data->ori = width > height; + slot_data->maj = MAX(width, height); + slot_data->min = MIN(width, height); + } else + slot_data = NULL; + + evdev_mt_push_slot(sc->evdev, slot, slot_data); } sc->nconts_todo -= cont_count; @@ -948,13 +940,6 @@ wmt_hid_parse(struct wmt_softc *sc, const void *d_ptr, uint16_t d_len) if (cont_count_max < 1) cont_count_max = cont; - /* Set number of MT protocol type B slots */ - sc->ai[WMT_SLOT] = (struct wmt_absinfo) { - .min = 0, - .max = cont_count_max - 1, - .res = 0, - }; - /* Report touch orientation if both width and height are supported */ if (isset(sc->caps, WMT_WIDTH) && isset(sc->caps, WMT_HEIGHT)) { setbit(sc->caps, WMT_ORIENTATION); @@ -976,6 +961,7 @@ wmt_hid_parse(struct wmt_softc *sc, const void *d_ptr, uint16_t d_len) sc->report_id = report_id; sc->nconts_per_report = cont; sc->has_int_button = has_int_button; + sc->cont_count_max = cont_count_max; return (type); } From owner-dev-commits-src-all@freebsd.org Tue Sep 21 23:43:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E77F67EF47; Tue, 21 Sep 2021 23:43: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 4HDdKp2sz2z4qSn; Tue, 21 Sep 2021 23:43: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 4214355A9; Tue, 21 Sep 2021 23:43: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 18LNhgBY047966; Tue, 21 Sep 2021 23:43:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LNhgJi047965; Tue, 21 Sep 2021 23:43:42 GMT (envelope-from git) Date: Tue, 21 Sep 2021 23:43:42 GMT Message-Id: <202109212343.18LNhgJi047965@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 2cc53be8897b - stable/13 - psm: Use evdev autorelease feature for Synaptics and Elantech drivers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2cc53be8897bb4ba3e559bb42de0e593966f1cf3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 23:43:42 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=2cc53be8897bb4ba3e559bb42de0e593966f1cf3 commit 2cc53be8897bb4ba3e559bb42de0e593966f1cf3 Author: Vladimir Kondratyev AuthorDate: 2021-09-02 19:30:29 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-21 23:39:20 +0000 psm: Use evdev autorelease feature for Synaptics and Elantech drivers (cherry picked from commit 744fcd5ad2a3e572585615df259eb3e2f0b624ef) --- sys/dev/atkbdc/psm.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index 78955bf1b228..f27a49f82a71 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -1730,14 +1730,6 @@ psm_push_st_finger(struct psm_softc *sc, const finger_t *f) evdev_push_abs(sc->evdev_a, ABS_TOOL_WIDTH, f->w); } -static void -psm_release_mt_slot(struct evdev_dev *evdev, int32_t slot) -{ - - evdev_push_abs(evdev, ABS_MT_SLOT, slot); - evdev_push_abs(evdev, ABS_MT_TRACKING_ID, -1); -} - static int psm_register(device_t dev, int model_code) { @@ -1845,6 +1837,8 @@ psm_register_synaptics(device_t dev) evdev_set_id(evdev_a, BUS_I8042, PS2_MOUSE_VENDOR, PS2_MOUSE_SYNAPTICS_PRODUCT, 0); evdev_set_methods(evdev_a, sc, &psm_ev_methods_a); + if (sc->synhw.capAdvancedGestures || sc->synhw.capReportsV) + evdev_set_flag(evdev_a, EVDEV_FLAG_MT_AUTOREL); if (sc->synhw.capReportsV) evdev_set_flag(evdev_a, EVDEV_FLAG_MT_TRACK); @@ -1923,6 +1917,7 @@ psm_register_elantech(device_t dev) evdev_set_id(evdev_a, BUS_I8042, PS2_MOUSE_VENDOR, PS2_MOUSE_ELANTECH_PRODUCT, 0); evdev_set_methods(evdev_a, sc, &psm_ev_methods_a); + evdev_set_flag(evdev_a, EVDEV_FLAG_MT_AUTOREL); evdev_support_event(evdev_a, EV_SYN); evdev_support_event(evdev_a, EV_KEY); @@ -3597,12 +3592,9 @@ proc_synaptics(struct psm_softc *sc, packetbuf_t *pb, mousestatus_t *ms, #ifdef EVDEV_SUPPORT if (evdev_rcpt_mask & EVDEV_RCPT_HW_MOUSE) { - for (id = 0; id < PSM_FINGERS; id++) { + for (id = 0; id < PSM_FINGERS; id++) if (PSM_FINGER_IS_SET(f[id])) psm_push_mt_finger(sc, id, &f[id]); - else - psm_release_mt_slot(sc->evdev_a, id); - } evdev_push_key(sc->evdev_a, BTN_TOUCH, nfingers > 0); evdev_push_nfingers(sc->evdev_a, nfingers); if (nfingers > 0) @@ -4772,9 +4764,6 @@ proc_elantech(struct psm_softc *sc, packetbuf_t *pb, mousestatus_t *ms, evdev_push_abs(sc->evdev_a, ABS_MT_TOUCH_MAJOR, f[id].w * sc->elanhw.dptracex); } - if (sc->elanaction.mask & (1 << id) && - !(mask & (1 << id))) - psm_release_mt_slot(sc->evdev_a, id); } evdev_push_key(sc->evdev_a, BTN_TOUCH, nfingers > 0); evdev_push_nfingers(sc->evdev_a, nfingers); From owner-dev-commits-src-all@freebsd.org Tue Sep 21 23:43:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5765D67F1CC; Tue, 21 Sep 2021 23:43: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 4HDdKn1dJJz4qFZ; Tue, 21 Sep 2021 23:43: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 15A13579F; Tue, 21 Sep 2021 23:43: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 18LNhfCB047942; Tue, 21 Sep 2021 23:43:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LNhfTZ047941; Tue, 21 Sep 2021 23:43:41 GMT (envelope-from git) Date: Tue, 21 Sep 2021 23:43:41 GMT Message-Id: <202109212343.18LNhfTZ047941@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: b966556125c8 - stable/13 - psm: Enable touch-tracking for late Synaptics PS/2 touchpads. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b966556125c8dec3f680cfa62dd8746e71fad955 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 23:43:41 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=b966556125c8dec3f680cfa62dd8746e71fad955 commit b966556125c8dec3f680cfa62dd8746e71fad955 Author: Vladimir Kondratyev AuthorDate: 2021-09-02 19:29:49 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-21 23:38:55 +0000 psm: Enable touch-tracking for late Synaptics PS/2 touchpads. They are true multitouch internally but Synaptics PS/2 protocol limitations do not all allow to export touch identificators. (cherry picked from commit c21171af687e20173b6b39e33db55999ba8d715e) --- sys/dev/atkbdc/psm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index f6276ae847aa..78955bf1b228 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -1845,6 +1845,8 @@ psm_register_synaptics(device_t dev) evdev_set_id(evdev_a, BUS_I8042, PS2_MOUSE_VENDOR, PS2_MOUSE_SYNAPTICS_PRODUCT, 0); evdev_set_methods(evdev_a, sc, &psm_ev_methods_a); + if (sc->synhw.capReportsV) + evdev_set_flag(evdev_a, EVDEV_FLAG_MT_TRACK); evdev_support_event(evdev_a, EV_SYN); evdev_support_event(evdev_a, EV_KEY); From owner-dev-commits-src-all@freebsd.org Tue Sep 21 23:43:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3606567EC5A; Tue, 21 Sep 2021 23:43: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 4HDdKr5XWjz4q74; Tue, 21 Sep 2021 23:43: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 8C74057A0; Tue, 21 Sep 2021 23:43: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 18LNhiGk048014; Tue, 21 Sep 2021 23:43:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LNhiBQ048013; Tue, 21 Sep 2021 23:43:44 GMT (envelope-from git) Date: Tue, 21 Sep 2021 23:43:44 GMT Message-Id: <202109212343.18LNhiBQ048013@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 1a918f430d0d - stable/13 - hidmap: Implement forbidden flag for hidmap item. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1a918f430d0d82fd25eebccb4b47f13d6f9715e3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 23:43:45 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=1a918f430d0d82fd25eebccb4b47f13d6f9715e3 commit 1a918f430d0d82fd25eebccb4b47f13d6f9715e3 Author: Vladimir Kondratyev AuthorDate: 2021-09-02 19:31:51 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-21 23:40:18 +0000 hidmap: Implement forbidden flag for hidmap item. If HID usage is mapped to evdev event by hidmap item marked with this flag than entire driver attachment is blocked. (cherry picked from commit cded1fdb3763ba1f0f3663e605a5e63089dc8e22) --- sys/dev/hid/hidmap.c | 5 ++++- sys/dev/hid/hidmap.h | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/hid/hidmap.c b/sys/dev/hid/hidmap.c index 46e789fa7cec..c46930214323 100644 --- a/sys/dev/hid/hidmap.c +++ b/sys/dev/hid/hidmap.c @@ -481,7 +481,10 @@ hidmap_probe_hid_descr(void *d_ptr, hid_size_t d_len, uint8_t tlc_index, /* Check that all mandatory usages are present in report descriptor */ if (items != 0) { for (i = 0; i < nitems_map; i++) { - if (map[i].required && isclr(caps, i)) { + KASSERT(!(map[i].required && map[i].forbidden), + ("both required & forbidden item flags are set")); + if ((map[i].required && isclr(caps, i)) || + (map[i].forbidden && isset(caps, i))) { items = 0; break; } diff --git a/sys/dev/hid/hidmap.h b/sys/dev/hid/hidmap.h index 6ac23b3dc4ee..f5ce10069e1a 100644 --- a/sys/dev/hid/hidmap.h +++ b/sys/dev/hid/hidmap.h @@ -98,7 +98,8 @@ struct hidmap_item { bool has_cb:1; bool final_cb:1; bool invert_value:1; - u_int reserved:10; + bool forbidden:1; /* Forbidden by driver */ + u_int reserved:9; }; #define HIDMAP_ANY(_page, _usage, _type, _code) \ From owner-dev-commits-src-all@freebsd.org Tue Sep 21 23:43:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B686267F5F7; Tue, 21 Sep 2021 23:43: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 4HDdKq4GJMz4q6t; Tue, 21 Sep 2021 23:43: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 6A8BB580E; Tue, 21 Sep 2021 23:43: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 18LNhh1T047990; Tue, 21 Sep 2021 23:43:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LNhhS0047989; Tue, 21 Sep 2021 23:43:43 GMT (envelope-from git) Date: Tue, 21 Sep 2021 23:43:43 GMT Message-Id: <202109212343.18LNhhS0047989@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 12061cf60579 - stable/13 - hmt(4): Add support for serial packet reporting mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 12061cf605795036a43d9d72be4aef4650b425d9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 23:43:43 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=12061cf605795036a43d9d72be4aef4650b425d9 commit 12061cf605795036a43d9d72be4aef4650b425d9 Author: Vladimir Kondratyev AuthorDate: 2021-09-02 19:31:17 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-21 23:39:58 +0000 hmt(4): Add support for serial packet reporting mode In Serial mode, each packet contains information that describes a single physical contact point. Multiple contacts are streamed serially. In this mode, devices report all contact information in a series of packets. The device sends a separate packet for each concurrent contact. Serial packet reporting mode is used by post-2014 eGalax touchscreens. Tested by: Mark Kane (cherry picked from commit 0075742d1834d52b5e24a606aca63ad7e67e81f3) --- sys/dev/hid/hmt.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/sys/dev/hid/hmt.c b/sys/dev/hid/hmt.c index d1b36c424ba8..cb7afe7290d0 100644 --- a/sys/dev/hid/hmt.c +++ b/sys/dev/hid/hmt.c @@ -204,6 +204,8 @@ struct hmt_softc { uint8_t report_id; uint32_t max_button; bool has_int_button; + bool has_cont_count; + bool has_scan_time; bool is_clickpad; bool do_timestamps; #ifdef IICHID_SAMPLING @@ -371,7 +373,8 @@ hmt_attach(device_t dev) sc->cont_count_max = MAX_MT_SLOTS; } - if (hid_test_quirk(hw, HQ_MT_TIMESTAMP) || hmt_timestamps) + if (sc->has_scan_time && + (hid_test_quirk(hw, HQ_MT_TIMESTAMP) || hmt_timestamps)) sc->do_timestamps = true; #ifdef IICHID_SAMPLING if (hid_test_quirk(hw, HQ_IICHID_SAMPLING)) @@ -438,13 +441,14 @@ hmt_attach(device_t dev) } /* Announce information about the touch device */ - device_printf(sc->dev, "Multitouch %s with %d external button%s%s\n", + device_printf(sc->dev, "%s %s with %d external button%s%s\n", + sc->cont_count_max > 1 ? "Multitouch" : "Singletouch", sc->type == HMT_TYPE_TOUCHSCREEN ? "touchscreen" : "touchpad", nbuttons, nbuttons != 1 ? "s" : "", sc->is_clickpad ? ", click-pad" : ""); device_printf(sc->dev, - "%d contacts with [%s%s%s%s%s] properties. Report range [%d:%d] - [%d:%d]\n", - (int)sc->cont_count_max, + "%d contact%s with [%s%s%s%s%s] properties. Report range [%d:%d] - [%d:%d]\n", + (int)sc->cont_count_max, sc->cont_count_max != 1 ? "s" : "", isset(sc->caps, HMT_IN_RANGE) ? "R" : "", isset(sc->caps, HMT_CONFIDENCE) ? "C" : "", isset(sc->caps, HMT_WIDTH) ? "W" : "", @@ -513,6 +517,12 @@ hmt_intr(void *context, void *buf, hid_size_t len) } /* + * "In Serial mode, each packet contains information that describes a + * single physical contact point. Multiple contacts are streamed + * serially. In this mode, devices report all contact information in a + * series of packets. The device sends a separate packet for each + * concurrent contact." + * * "In Parallel mode, devices report all contact information in a * single packet. Each physical contact is represented by a logical * collection that is embedded in the top-level collection." @@ -521,7 +531,10 @@ hmt_intr(void *context, void *buf, hid_size_t len) * report with contactid=0 but contactids are zero-based, find * contactcount first. */ - cont_count = hid_get_udata(buf, len, &sc->cont_count_loc); + if (sc->has_cont_count) + cont_count = hid_get_udata(buf, len, &sc->cont_count_loc); + else + cont_count = 1; /* * "In Hybrid mode, the number of contacts that can be reported in one * report is less than the maximum number of contacts that the device @@ -753,7 +766,6 @@ hmt_hid_parse(struct hmt_softc *sc, const void *d_ptr, hid_size_t d_len, sc->cont_count_loc = hi.loc; break; } - /* Scan time is required but clobbered by evdev */ if (hi.collevel == 1 && hi.usage == HID_USAGE2(HUP_DIGITIZERS, HUD_SCAN_TIME)) { scan_time_found = true; @@ -804,7 +816,7 @@ hmt_hid_parse(struct hmt_softc *sc, const void *d_ptr, hid_size_t d_len, hid_end_parse(hd); /* Check for required HID Usages */ - if (!cont_count_found || !scan_time_found || cont == 0) + if ((!cont_count_found && cont != 1) || cont == 0) return (HMT_TYPE_UNSUPPORTED); for (i = 0; i < HMT_N_USAGES; i++) { if (hmt_hid_map[i].required && isclr(sc->caps, i)) @@ -842,6 +854,8 @@ hmt_hid_parse(struct hmt_softc *sc, const void *d_ptr, hid_size_t d_len, sc->cont_count_max = cont_count_max; sc->nconts_per_report = cont; sc->has_int_button = has_int_button; + sc->has_cont_count = cont_count_found; + sc->has_scan_time = scan_time_found; return (type); } From owner-dev-commits-src-all@freebsd.org Tue Sep 21 23:43:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7908667EF4E; Tue, 21 Sep 2021 23:43:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDdKy0BWpz4qT7; Tue, 21 Sep 2021 23: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 29A9C5733; Tue, 21 Sep 2021 23: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 18LNhn4M048116; Tue, 21 Sep 2021 23: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 18LNhnaw048115; Tue, 21 Sep 2021 23:43:49 GMT (envelope-from git) Date: Tue, 21 Sep 2021 23:43:49 GMT Message-Id: <202109212343.18LNhnaw048115@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 470478ff012f - stable/13 - hmt(4): Add support for touchpads with no "button type" or MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 470478ff012fd8a2c083fead60574ec6c798376f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 23:43:50 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=470478ff012fd8a2c083fead60574ec6c798376f commit 470478ff012fd8a2c083fead60574ec6c798376f Author: Vladimir Kondratyev AuthorDate: 2021-09-02 19:33:51 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-21 23:41:40 +0000 hmt(4): Add support for touchpads with no "button type" or "maximum number of contacts" usages. Assume touchpad to be a clickpad if it has only internal button. Set number of contacts to 5 for touchpads and to 10 for touchscreens. Check for fetched report length to avoid reading of stalled data. Fixes Dell Precision 7550 laptop. Tested by: Shawn Webb PR: 257992 (cherry picked from commit 9d04336b615d16faa631da2824ee719683540276) --- sys/dev/hid/hmt.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/sys/dev/hid/hmt.c b/sys/dev/hid/hmt.c index cb7afe7290d0..dcf360bcffba 100644 --- a/sys/dev/hid/hmt.c +++ b/sys/dev/hid/hmt.c @@ -300,7 +300,7 @@ hmt_attach(device_t dev) const struct hid_device_info *hw = hid_get_device_info(dev); void *d_ptr; uint8_t *fbuf = NULL; - hid_size_t d_len, fsize; + hid_size_t d_len, fsize, rsize; uint32_t cont_count_max; int nbuttons, btn; size_t i; @@ -321,9 +321,10 @@ hmt_attach(device_t dev) /* Fetch and parse "Contact count maximum" feature report */ if (sc->cont_max_rlen > 1) { - err = hid_get_report(dev, fbuf, sc->cont_max_rlen, NULL, + err = hid_get_report(dev, fbuf, sc->cont_max_rlen, &rsize, HID_FEATURE_REPORT, sc->cont_max_rid); - if (err == 0) { + if (err == 0 && (rsize - 1) * 8 >= + sc->cont_max_loc.pos + sc->cont_max_loc.size) { cont_count_max = hid_get_udata(fbuf + 1, sc->cont_max_rlen - 1, &sc->cont_max_loc); /* @@ -334,23 +335,24 @@ hmt_attach(device_t dev) sc->cont_count_max = cont_count_max; } else DPRINTF("hid_get_report error=%d\n", err); - } else - DPRINTF("Feature report %hhu size invalid: %u\n", - sc->cont_max_rid, sc->cont_max_rlen); + } + if (sc->cont_count_max == 0) + sc->cont_count_max = sc->type == HMT_TYPE_TOUCHSCREEN ? 10 : 5; /* Fetch and parse "Button type" feature report */ if (sc->btn_type_rlen > 1 && sc->btn_type_rid != sc->cont_max_rid) { bzero(fbuf, fsize); - err = hid_get_report(dev, fbuf, sc->btn_type_rlen, NULL, + err = hid_get_report(dev, fbuf, sc->btn_type_rlen, &rsize, HID_FEATURE_REPORT, sc->btn_type_rid); - } - if (sc->btn_type_rlen > 1) { - if (err == 0) - sc->is_clickpad = hid_get_udata(fbuf + 1, - sc->btn_type_rlen - 1, &sc->btn_type_loc) == 0; - else + if (err != 0) DPRINTF("hid_get_report error=%d\n", err); } + if (sc->btn_type_rlen > 1 && err == 0 && (rsize - 1) * 8 >= + sc->btn_type_loc.pos + sc->btn_type_loc.size) + sc->is_clickpad = hid_get_udata(fbuf + 1, sc->btn_type_rlen - 1, + &sc->btn_type_loc) == 0; + else + sc->is_clickpad = sc->max_button == 0 && sc->has_int_button; /* Fetch THQA certificate to enable some devices like WaveShare */ if (sc->thqa_cert_rlen > 1 && sc->thqa_cert_rid != sc->cont_max_rid) From owner-dev-commits-src-all@freebsd.org Tue Sep 21 23:43:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 351F167EC64; Tue, 21 Sep 2021 23:43: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 4HDdKs6Tngz4qCx; Tue, 21 Sep 2021 23:43: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 A0F2457A1; Tue, 21 Sep 2021 23:43: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 18LNhjME048044; Tue, 21 Sep 2021 23:43:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LNhjAJ048043; Tue, 21 Sep 2021 23:43:45 GMT (envelope-from git) Date: Tue, 21 Sep 2021 23:43:45 GMT Message-Id: <202109212343.18LNhjAJ048043@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 116adffd0f6a - stable/13 - hidmap: Do not forget to initialize bitmap items to unset state MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 116adffd0f6ae5c33cab921a338152e01f2ced5a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 23:43:46 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=116adffd0f6ae5c33cab921a338152e01f2ced5a commit 116adffd0f6ae5c33cab921a338152e01f2ced5a Author: Vladimir Kondratyev AuthorDate: 2021-09-02 19:32:14 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-21 23:40:37 +0000 hidmap: Do not forget to initialize bitmap items to unset state (cherry picked from commit bbed4b41c9f193996f704b3262126e59810b30c9) --- sys/dev/hid/hidmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/hid/hidmap.c b/sys/dev/hid/hidmap.c index c46930214323..d787b298b41d 100644 --- a/sys/dev/hid/hidmap.c +++ b/sys/dev/hid/hidmap.c @@ -451,7 +451,8 @@ hidmap_probe_hid_descr(void *d_ptr, hid_size_t d_len, uint8_t tlc_index, bool do_free = false; if (caps == NULL) { - caps = malloc(HIDMAP_CAPS_SZ(nitems_map), M_DEVBUF, M_WAITOK); + caps = malloc(HIDMAP_CAPS_SZ(nitems_map), M_DEVBUF, + M_WAITOK | M_ZERO); do_free = true; } else bzero (caps, HIDMAP_CAPS_SZ(nitems_map)); From owner-dev-commits-src-all@freebsd.org Tue Sep 21 23:43:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B82A67F627; Tue, 21 Sep 2021 23:43:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDdKv1kBNz4qD4; Tue, 21 Sep 2021 23:43:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF4C6580F; Tue, 21 Sep 2021 23:43: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 18LNhkD2048068; Tue, 21 Sep 2021 23:43:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LNhkXs048067; Tue, 21 Sep 2021 23:43:46 GMT (envelope-from git) Date: Tue, 21 Sep 2021 23:43:46 GMT Message-Id: <202109212343.18LNhkXs048067@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 29bcf5e7d7a7 - stable/13 - hidbus(4): Add routine to check presence of collection of given usage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 29bcf5e7d7a7eb15a692ec1fa2a0e3a3290a4c8e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 23:43:47 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=29bcf5e7d7a7eb15a692ec1fa2a0e3a3290a4c8e commit 29bcf5e7d7a7eb15a692ec1fa2a0e3a3290a4c8e Author: Vladimir Kondratyev AuthorDate: 2021-09-02 19:32:57 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-21 23:40:53 +0000 hidbus(4): Add routine to check presence of collection of given usage (cherry picked from commit d51e437669e4ac35ac4be366241ae6ba4a16c378) --- sys/dev/hid/hidbus.c | 19 +++++++++++++++++++ sys/dev/hid/hidbus.h | 1 + 2 files changed, 20 insertions(+) diff --git a/sys/dev/hid/hidbus.c b/sys/dev/hid/hidbus.c index 3064f9999f2f..0de0a9bc1114 100644 --- a/sys/dev/hid/hidbus.c +++ b/sys/dev/hid/hidbus.c @@ -171,6 +171,25 @@ hidbus_locate(const void *desc, hid_size_t size, int32_t u, enum hid_kind k, return (0); } +bool +hidbus_is_collection(const void *desc, hid_size_t size, int32_t usage, + uint8_t tlc_index) +{ + struct hid_data *d; + struct hid_item h; + bool ret = false; + + d = hid_start_parse(desc, size, 0); + HIDBUS_FOREACH_ITEM(d, &h, tlc_index) { + if (h.kind == hid_collection && h.usage == usage) { + ret = true; + break; + } + } + hid_end_parse(d); + return (ret); +} + static device_t hidbus_add_child(device_t dev, u_int order, const char *name, int unit) { diff --git a/sys/dev/hid/hidbus.h b/sys/dev/hid/hidbus.h index 05911fff5732..d4324a2dc394 100644 --- a/sys/dev/hid/hidbus.h +++ b/sys/dev/hid/hidbus.h @@ -152,6 +152,7 @@ int hidbus_locate(const void *desc, hid_size_t size, int32_t u, enum hid_kind k, uint8_t tlc_index, uint8_t index, struct hid_location *loc, uint32_t *flags, uint8_t *id, struct hid_absinfo *ai); +bool hidbus_is_collection(const void *, hid_size_t, int32_t, uint8_t); const struct hid_device_id *hidbus_lookup_id(device_t, const struct hid_device_id *, int); From owner-dev-commits-src-all@freebsd.org Tue Sep 21 23:43:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4EA1C67F177; Tue, 21 Sep 2021 23: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 4HDdKw1HMSz4qSw; Tue, 21 Sep 2021 23: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 EC3CF5810; Tue, 21 Sep 2021 23:43:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LNhlB9048092; Tue, 21 Sep 2021 23:43:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LNhlw0048091; Tue, 21 Sep 2021 23:43:47 GMT (envelope-from git) Date: Tue, 21 Sep 2021 23:43:47 GMT Message-Id: <202109212343.18LNhlw0048091@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: d4a977ce186c - stable/13 - hpen(4): Add support for legacy MS-compatible single touch protocol MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d4a977ce186c7cc22b5317bbeb7ee87608fbc920 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 23:43:48 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=d4a977ce186c7cc22b5317bbeb7ee87608fbc920 commit d4a977ce186c7cc22b5317bbeb7ee87608fbc920 Author: Vladimir Kondratyev AuthorDate: 2021-09-02 19:33:24 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-21 23:41:16 +0000 hpen(4): Add support for legacy MS-compatible single touch protocol It is used by many pre- and post- 2014 eGalax touchscreens. Tested by: Mark Kane (cherry picked from commit a36bdfc2b6525e814388f38c6862cf4b24dc6bee) --- sys/dev/hid/hidmap.h | 2 ++ sys/dev/hid/hpen.c | 89 ++++++++++++++++++++++++++++------------------------ 2 files changed, 50 insertions(+), 41 deletions(-) diff --git a/sys/dev/hid/hidmap.h b/sys/dev/hid/hidmap.h index f5ce10069e1a..628881092639 100644 --- a/sys/dev/hid/hidmap.h +++ b/sys/dev/hid/hidmap.h @@ -62,6 +62,8 @@ typedef int hidmap_cb_t(HIDMAP_CB_ARGS); /* These helpers can be used at any stage of any callbacks */ #define HIDMAP_CB_GET_STATE(...) \ ((hm == NULL) ? HIDMAP_CB_IS_PROBING : hm->cb_state) +#define HIDMAP_CB_GET_DEV(...) \ + (hm == NULL ? NULL : hm->dev) #define HIDMAP_CB_GET_SOFTC(...) \ (hm == NULL ? NULL : device_get_softc(hm->dev)) #define HIDMAP_CB_GET_EVDEV(...) \ diff --git a/sys/dev/hid/hpen.c b/sys/dev/hid/hpen.c index 1d505e14089f..8a86b95b1020 100644 --- a/sys/dev/hid/hpen.c +++ b/sys/dev/hid/hpen.c @@ -72,44 +72,43 @@ static hidmap_cb_t hpen_final_pen_cb; HIDMAP_ABS_CB(HUP_DIGITIZERS, HUD_##usage, &cb) /* Generic map digitizer page map according to hut1_12v2.pdf */ -static const struct hidmap_item hpen_map_digi[] = { +static const struct hidmap_item hpen_map_pen[] = { { HPEN_MAP_ABS_GD(X, ABS_X), .required = true }, { HPEN_MAP_ABS_GD(Y, ABS_Y), .required = true }, { HPEN_MAP_ABS( TIP_PRESSURE, ABS_PRESSURE) }, { HPEN_MAP_ABS( X_TILT, ABS_TILT_X) }, { HPEN_MAP_ABS( Y_TILT, ABS_TILT_Y) }, + { HPEN_MAP_ABS( CONTACTID, 0), .forbidden = true }, + { HPEN_MAP_ABS( CONTACTCOUNT, 0), .forbidden = true }, { HPEN_MAP_ABS_CB(BATTERY_STRENGTH, hpen_battery_strenght_cb) }, { HPEN_MAP_BUT( TOUCH, BTN_TOUCH) }, { HPEN_MAP_BUT( TIP_SWITCH, BTN_TOUCH) }, { HPEN_MAP_BUT( SEC_TIP_SWITCH, BTN_TOUCH) }, - { HPEN_MAP_BUT( IN_RANGE, BTN_TOOL_PEN) }, { HPEN_MAP_BUT( BARREL_SWITCH, BTN_STYLUS) }, { HPEN_MAP_BUT( INVERT, BTN_TOOL_RUBBER) }, { HPEN_MAP_BUT( ERASER, BTN_TOUCH) }, { HPEN_MAP_BUT( TABLET_PICK, BTN_STYLUS2) }, { HPEN_MAP_BUT( SEC_BARREL_SWITCH,BTN_STYLUS2) }, - { HIDMAP_FINAL_CB( &hpen_final_digi_cb) }, + { HIDMAP_FINAL_CB( &hpen_final_pen_cb) }, }; -/* Microsoft-standardized pen support */ -static const struct hidmap_item hpen_map_pen[] = { - { HPEN_MAP_ABS_GD(X, ABS_X), .required = true }, - { HPEN_MAP_ABS_GD(Y, ABS_Y), .required = true }, - { HPEN_MAP_ABS( TIP_PRESSURE, ABS_PRESSURE), .required = true }, - { HPEN_MAP_ABS( X_TILT, ABS_TILT_X) }, - { HPEN_MAP_ABS( Y_TILT, ABS_TILT_Y) }, - { HPEN_MAP_ABS_CB(BATTERY_STRENGTH, hpen_battery_strenght_cb) }, - { HPEN_MAP_BUT( TIP_SWITCH, BTN_TOUCH), .required = true }, - { HPEN_MAP_BUT( IN_RANGE, BTN_TOOL_PEN), .required = true }, - { HPEN_MAP_BUT( BARREL_SWITCH, BTN_STYLUS) }, - { HPEN_MAP_BUT( INVERT, BTN_TOOL_RUBBER), .required = true }, - { HPEN_MAP_BUT( ERASER, BTN_TOUCH), .required = true }, - { HIDMAP_FINAL_CB( &hpen_final_pen_cb) }, +static const struct hidmap_item hpen_map_stylus[] = { + { HPEN_MAP_BUT( IN_RANGE, BTN_TOOL_PEN) }, +}; +static const struct hidmap_item hpen_map_finger[] = { + { HPEN_MAP_BUT( IN_RANGE, BTN_TOOL_FINGER) }, }; static const struct hid_device_id hpen_devs[] = { { HID_TLC(HUP_DIGITIZERS, HUD_DIGITIZER) }, { HID_TLC(HUP_DIGITIZERS, HUD_PEN) }, + { HID_TLC(HUP_DIGITIZERS, HUD_TOUCHSCREEN), + HID_BVP(BUS_USB, USB_VENDOR_EGALAX, USB_PRODUCT_EGALAX_TPANEL) }, +}; + +/* Do not autoload legacy pen driver for all touchscreen */ +static const struct hid_device_id hpen_devs_no_load[] = { + { HID_TLC(HUP_DIGITIZERS, HUD_TOUCHSCREEN) }, }; static int @@ -134,25 +133,18 @@ hpen_battery_strenght_cb(HIDMAP_CB_ARGS) return (0); } -static int -hpen_final_digi_cb(HIDMAP_CB_ARGS) -{ - struct evdev_dev *evdev = HIDMAP_CB_GET_EVDEV(); - - if (HIDMAP_CB_GET_STATE() == HIDMAP_CB_IS_ATTACHING) - evdev_support_prop(evdev, INPUT_PROP_POINTER); - - /* Do not execute callback at interrupt handler and detach */ - return (ENOSYS); -} - static int hpen_final_pen_cb(HIDMAP_CB_ARGS) { struct evdev_dev *evdev = HIDMAP_CB_GET_EVDEV(); - if (HIDMAP_CB_GET_STATE() == HIDMAP_CB_IS_ATTACHING) - evdev_support_prop(evdev, INPUT_PROP_DIRECT); + if (HIDMAP_CB_GET_STATE() == HIDMAP_CB_IS_ATTACHING) { + if (hidbus_get_usage(HIDMAP_CB_GET_DEV()) == + HID_USAGE2(HUP_DIGITIZERS, HUD_DIGITIZER)) + evdev_support_prop(evdev, INPUT_PROP_POINTER); + else + evdev_support_prop(evdev, INPUT_PROP_DIRECT); + } /* Do not execute callback at interrupt handler and detach */ return (ENOSYS); @@ -185,24 +177,39 @@ static int hpen_probe(device_t dev) { struct hidmap *hm = device_get_softc(dev); + const char *desc; + void *d_ptr; + hid_size_t d_len; int error; - bool is_pen; - error = HIDBUS_LOOKUP_DRIVER_INFO(dev, hpen_devs); - if (error != 0) - return (error); + if (HIDBUS_LOOKUP_DRIVER_INFO(dev, hpen_devs_no_load) != 0) { + error = HIDBUS_LOOKUP_DRIVER_INFO(dev, hpen_devs); + if (error != 0) + return (error); + } hidmap_set_dev(hm, dev); - /* Check if report descriptor belongs to a HID tablet device */ - is_pen = hidbus_get_usage(dev) == HID_USAGE2(HUP_DIGITIZERS, HUD_PEN); - error = is_pen - ? HIDMAP_ADD_MAP(hm, hpen_map_pen, NULL) - : HIDMAP_ADD_MAP(hm, hpen_map_digi, NULL); + /* Check if report descriptor belongs to a HID pen device */ + error = HIDMAP_ADD_MAP(hm, hpen_map_pen, NULL); if (error != 0) return (error); - hidbus_set_desc(dev, is_pen ? "Pen" : "Digitizer"); + if (hid_get_report_descr(dev, &d_ptr, &d_len) != 0) + return (ENXIO); + + if (hidbus_is_collection(d_ptr, d_len, + HID_USAGE2(HUP_DIGITIZERS, HUD_FINGER), hidbus_get_index(dev))) { + HIDMAP_ADD_MAP(hm, hpen_map_finger, NULL); + desc = "TouchScreen"; + } else { + HIDMAP_ADD_MAP(hm, hpen_map_stylus, NULL); + desc = "Pen"; + } + if (hidbus_get_usage(dev) == HID_USAGE2(HUP_DIGITIZERS, HUD_DIGITIZER)) + desc = "Digitizer"; + + hidbus_set_desc(dev, desc); return (BUS_PROBE_DEFAULT); } From owner-dev-commits-src-all@freebsd.org Wed Sep 22 02:14:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDB686A9682; Wed, 22 Sep 2021 02:14:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDhgZ5h5wz3JN5; Wed, 22 Sep 2021 02:14: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 A2E397701; Wed, 22 Sep 2021 02:14: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 18M2EI9T047079; Wed, 22 Sep 2021 02:14:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18M2EIJk047078; Wed, 22 Sep 2021 02:14:18 GMT (envelope-from git) Date: Wed, 22 Sep 2021 02:14:18 GMT Message-Id: <202109220214.18M2EIJk047078@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 8db1669959ce - main - Fix build without SMP. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8db1669959ceebdc60a7d402830663953bf32818 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 02:14:18 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=8db1669959ceebdc60a7d402830663953bf32818 commit 8db1669959ceebdc60a7d402830663953bf32818 Author: Alexander Motin AuthorDate: 2021-09-22 02:13:33 +0000 Commit: Alexander Motin CommitDate: 2021-09-22 02:13:33 +0000 Fix build without SMP. MFC after: 1 month --- sys/kern/sched_ule.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 711119c84383..d1e4010d2ebe 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -2118,7 +2118,10 @@ sched_switch(struct thread *td, int flags) struct td_sched *ts; struct mtx *mtx; int srqflag; - int cpuid, pickcpu, preempted; + int cpuid, preempted; +#ifdef SMP + int pickcpu; +#endif THREAD_LOCK_ASSERT(td, MA_OWNED); @@ -2126,11 +2129,13 @@ sched_switch(struct thread *td, int flags) tdq = TDQ_SELF(); ts = td_get_sched(td); sched_pctcpu_update(ts, 1); +#ifdef SMP pickcpu = (td->td_flags & TDF_PICKCPU) != 0; if (pickcpu) ts->ts_rltick = ticks - affinity * MAX_CACHE_LEVELS; else ts->ts_rltick = ticks; +#endif td->td_lastcpu = td->td_oncpu; preempted = (td->td_flags & TDF_SLICEEND) == 0 && (flags & SW_PREEMPT) != 0; From owner-dev-commits-src-all@freebsd.org Wed Sep 22 07:37:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D313F6AD595; Wed, 22 Sep 2021 07:37: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 4HDqrv5Wszz4VwQ; Wed, 22 Sep 2021 07:37: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 99F0213B63; Wed, 22 Sep 2021 07:37:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18M7bpgZ072130; Wed, 22 Sep 2021 07:37:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18M7bp8J072129; Wed, 22 Sep 2021 07:37:51 GMT (envelope-from git) Date: Wed, 22 Sep 2021 07:37:51 GMT Message-Id: <202109220737.18M7bp8J072129@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 00582fa66051 - main - pci_vendors: update to 2021.09.19 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 00582fa66051cbdf263a6ce0f10c64ea17a0e9a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 07:37:51 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=00582fa66051cbdf263a6ce0f10c64ea17a0e9a8 commit 00582fa66051cbdf263a6ce0f10c64ea17a0e9a8 Author: Baptiste Daroussin AuthorDate: 2021-09-22 07:36:43 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 07:36:43 +0000 pci_vendors: update to 2021.09.19 --- share/misc/pci_vendors | 166 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 151 insertions(+), 15 deletions(-) diff --git a/share/misc/pci_vendors b/share/misc/pci_vendors index 3e17bc47bf5f..79866ff1cd29 100644 --- a/share/misc/pci_vendors +++ b/share/misc/pci_vendors @@ -1,8 +1,8 @@ # # List of PCI ID's # -# Version: 2021.07.25 -# Date: 2021-07-25 03:15:02 +# Version: 2021.09.19 +# Date: 2021-09-19 03:15:02 # # Maintained by Albert Pool, Martin Mares, and other volunteers from # the PCI ID Project at https://pci-ids.ucw.cz/. @@ -693,10 +693,10 @@ 1000 4660 eHBA 9600-24i Tri-Mode Storage Adapter 1000 4670 eHBA 9600-16i Tri-Mode Storage Adapter 1000 4680 eHBA 9600-16e Tri-Mode Storage Adapter - 1000 4690 eHBA 9620-16i Tri-Mode Storage Adapter + 1000 4690 MegaRAID 9620-16i Tri-Mode Storage Adapter 1000 46a0 MegaRAID 9660-24i Tri-Mode Storage Adapter - 1000 46b0 MegaRAID 9665W-16i Tri-Mode Storage Adapter - 1000 46c0 MegaRAID 9680W-16e Tri-Mode Storage Adapter + 1000 46c0 eHBA 9680W-16e Tri-Mode Storage Adapter + 1000 46d0 eHBA 9600-8i8e Tri-Mode Storage Adapter 1028 2114 PERC H965 Adapter 1028 2115 PERC H965 Front 1028 2117 PERC H965 MX @@ -925,11 +925,7 @@ 1028 1ae2 PERC H755N Front 1028 1ae3 PERC H755 MX 1028 2171 PERC H750 Mini - 1028 2172 PERC H355 Adapter - 1028 2173 PERC H355 Front - 1028 2174 PERC H350 Mini 1028 2176 PERC H750 Adapter - 1028 2177 PERC H350 Adapter 1d49 060a ThinkSystem RAID 940-8i 4GB Flash PCIe Gen4 12Gb Adapter 1d49 060b ThinkSystem RAID 940-8i 8GB Flash PCIe Gen4 12Gb Adapter 1d49 060c ThinkSystem RAID 940-16i 8GB Flash PCIe Gen4 12Gb Adapter @@ -947,6 +943,10 @@ 10e4 MegaRAID 12GSAS/PCIe Unsupported SAS38xx 10e5 MegaRAID 12GSAS/PCIe SAS38xx 10e6 MegaRAID 12GSAS/PCIe Secure SAS38xx + 1028 2172 PERC H355 Adapter + 1028 2173 PERC H355 Front + 1028 2174 PERC H350 Mini + 1028 2177 PERC H350 Adapter 1d49 0505 ThinkSystem RAID 540-8i PCIe Gen4 12Gb Adapter 1d49 0506 ThinkSystem RAID 540-16i PCIe Gen4 12Gb Adapter 10e7 MegaRAID 12GSAS/PCIe Unsupported SAS38xx @@ -3700,6 +3700,7 @@ 7312 Navi 10 [Radeon Pro W5700] 7314 Navi 10 USB 731f Navi 10 [Radeon RX 5600 OEM/5600 XT / 5700/5700 XT] + 1002 0b36 Reference RX 5700 XT 1458 2313 Radeon RX 5700 XT Gaming OC 1682 5701 RX 5700 XT RAW II 1849 5120 Radeon RX 5600 XT @@ -3713,16 +3714,20 @@ 7388 Arcturus GL-XL 738c Arcturus GL-XL [AMD Instinct MI100] 738e Arcturus GL-XL - 73a3 Navi 21 [Radeon PRO W6800] + 73a2 Navi 21 Pro-XTA [Radeon Pro W6900X] + 73a3 Navi 21 GL-XL [Radeon PRO W6800] 73a4 Navi 21 USB + 73ab Navi 21 Pro-XLA [Radeon Pro W6800X/Radeon Pro W6800X Duo] 73af Navi 21 [Radeon RX 6900 XT] 73bf Navi 21 [Radeon RX 6800/6800 XT / 6900 XT] + 1002 0e3a Radeon RX 6900 XT 1eae 6701 XFX Speedster MERC 319 AMD Radeon RX 6800 XT Black 73c3 Navi 22 73c4 Navi 22 USB 73df Navi 22 [Radeon RX 6700/6700 XT / 6800M] 73e0 Navi 23 - 73e1 Navi 23 + 73e1 Navi 23 WKS-XM [Radeon PRO W6600M] + 73e3 Navi 23 WKS-XL [Radeon PRO W6600] 73e4 Navi 23 USB 73ff Navi 23 [Radeon RX 6600/6600 XT/6600M] 7408 Aldebaran @@ -12250,6 +12255,7 @@ 1eae TU104M 1eb0 TU104GL [Quadro RTX 5000] 1eb1 TU104GL [Quadro RTX 4000] + 1eb4 TU104GL [T4G] 1eb5 TU104GLM [Quadro RTX 5000 Mobile / Max-Q] 1eb6 TU104GLM [Quadro RTX 4000 Mobile / Max-Q] 1eb8 TU104GL [Tesla T4] @@ -12314,8 +12320,10 @@ 20b5 GA100 [A100 PCIe 80GB] 20b6 GA100GL [PG506-232] 20b7 GA100GL [A30 PCIe] + 20bb GA100 [DRIVE A100 PROD] 20be GA100 [GRID A100A] 20bf GA100 [GRID A100B] + 20c2 GA100 [CMP 170HX] 20f1 GA100 [A100 PCIe 40GB] 2182 TU116 [GeForce GTX 1660 Ti] 2183 TU116 @@ -12332,7 +12340,7 @@ 21d1 TU116BM [GeForce GTX 1660 Ti Mobile] 2200 GA102 2204 GA102 [GeForce RTX 3090] - 2205 GA102 [GeForce RTX 3080 20GB] + 2205 GA102 [GeForce RTX 3080 Ti 20GB] 2206 GA102 [GeForce RTX 3080] 10de 1467 GA102 [GeForce RTX 3080] 10de 146d GA102 [GeForce RTX 3080 20GB] @@ -12358,6 +12366,7 @@ 10de 146b GA104 [GeForce RTX 3070] 10de 14ae GA104 [GeForce RTX 3070 16GB] 2486 GA104 [GeForce RTX 3060 Ti] + 2487 GA104 [GeForce RTX 3060] 2488 GA104 [GeForce RTX 3070 Lite Hash Rate] 2489 GA104 [GeForce RTX 3060 Ti Lite Hash Rate] 248a GA104 [CMP 70HX] @@ -12621,6 +12630,7 @@ 1028 06dc Latitude E7470 1028 06e4 XPS 15 9550 1028 06e6 Latitude 11 5175 2-in-1 + 1028 09be Latitude 7410 17aa 224f ThinkPad X1 Carbon 5th Gen 5260 RTS5260 PCI Express Card Reader 5286 RTS5286 PCI Express Card Reader @@ -12807,6 +12817,7 @@ 8812 RTL8812AE 802.11ac PCIe Wireless Network Adapter 8813 RTL8813AE 802.11ac PCIe Wireless Network Adapter 8821 RTL8821AE 802.11ac PCIe Wireless Network Adapter + 8852 RTL8852AE 802.11ax PCIe Wireless Network Adapter b723 RTL8723BE PCIe Wireless Network Adapter 10ec 8739 Dell Wireless 1801 17aa b736 Z50-75 @@ -18728,6 +18739,7 @@ 144d a801 SM963 2.5" NVMe PCIe SSD a808 NVMe SSD Controller SM981/PM981/PM983 1d49 403b Thinksystem U.2 PM983 NVMe SSD + a809 NVMe SSD Controller 980 a80a NVMe SSD Controller PM9A1/PM9A3/980PRO 0128 215a DC NVMe PM9A3 RI U.2 960GB 0128 215b DC NVMe PM9A3 RI U.2 1.92TB @@ -18737,6 +18749,7 @@ 0128 2167 DC NVMe PM9A3 RI 110M.2 1.92TB 0128 2168 DC NVMe PM9A3 RI 80M.2 480GB 0128 2169 DC NVMe PM9A3 RI 80M.2 960GB + 144d a813 General DC NVMe PM9A3 a820 NVMe SSD Controller 171X 1028 1f95 Express Flash NVMe XS1715 SSD 400GB 1028 1f96 Express Flash NVMe XS1715 SSD 800GB @@ -18829,6 +18842,7 @@ 1456 Advanced Hardware Architectures 1457 Nuera Communications Inc 1458 Gigabyte Technology Co., Ltd + 22e8 Ellesmere [Radeon RX 480] 3483 USB 3.0 Controller (VIA VL80x-based xHCI Controller) 1459 DOOIN Electronics 145a Escalate Networks Inc @@ -19813,6 +19827,7 @@ 441f BCM4361 802.11ac Dual-Band Wireless Network Controller 4420 BCM4361 802.11ac 2.4 GHz Wireless Network Controller 4421 BCM4361 802.11ac 5 GHz Wireless Network Controller + 4425 BRCM4378 Wireless Network Adapter 4430 BCM44xx CardBus iLine32 HomePNA 2.0 4432 BCM4432 CardBus 10/100BaseT 4464 BCM4364 802.11ac Wireless Network Adapter @@ -21095,7 +21110,7 @@ 0002 SiByte BCM1125H/1250 System-on-a-Chip HyperTransport 0012 SiByte BCM1280/BCM1480 System-on-a-Chip PCI-X 0014 Sibyte BCM1280/BCM1480 System-on-a-Chip HyperTransport -1677 Bernecker + Rainer +1677 B&R Industrial Automation GmbH 104e 5LS172.6 B&R Dual CAN Interface Card 12d7 5LS172.61 B&R Dual CAN Interface Card 20ad 5ACPCI.MFIO-K01 Profibus DP / K-Feldbus / COM @@ -21996,6 +22011,8 @@ 6013 R6013 ISA Bridge 6020 R6020 North Bridge 6021 R6021 Host Bridge +# Integrated in the Vortex86DX2 SoC + 6022 R6022 Host Bridge # Found in the Vortex86DX3 SoC 6023 R6023 Host Bridge # Found in the Vortex86EX SoC @@ -22947,6 +22964,7 @@ 1a22 Ambric Inc. 1a29 Fortinet, Inc. 4338 CP8 Content Processor ASIC + 43a0 CP9 Content Processor ASIC 4e36 NP6 Network Processor 4e37 NP7 Network Processor 1a2b Ascom AG @@ -23576,6 +23594,14 @@ 243b PE6110 NVMe Solid State Drive 1c5c 0100 PE6110 NVMe Solid State Drive 2839 PE8000 Series NVMe Solid State Drive + 1028 2143 DC NVMe SED PE8010 RI U.2 960GB + 1028 2144 DC NVMe PE8010 RI U.2 960GB + 1028 2145 DC NVMe SED PE8010 RI U.2 1.92TB + 1028 2146 DC NVMe PE8010 RI U.2 1.92TB + 1028 2147 DC NVMe SED PE8010 RI U.2 3.84TB + 1028 2148 DC NVMe PE8010 RI U.2 3.84TB + 1028 2149 DC NVMe SED PE8010 RI U.2 7.68TB + 1028 214a DC NVMe PE8010 RI U.2 7.68TB 1c5c 0100 PE8000 Series NVMe Solid State Drive 1c5f Beijing Memblaze Technology Co. Ltd. 000d PBlaze5 520/526 @@ -23628,6 +23654,16 @@ 1cc1 ADATA Technology Co., Ltd. 8201 XPG SX8200 Pro PCIe Gen3x4 M.2 2280 Solid State Drive 1cc4 Union Memory (Shenzhen) + 1203 NVMe SSD Controller UHXXXa series + 1cc4 a121 NVMe SSD UHXXXa series U.2 960GB + 1cc4 a122 NVMe SSD UHXXXa series U.2 1920GB + 1cc4 a123 NVMe SSD UHXXXa series U.2 3840GB + 1cc4 a124 NVMe SSD UHXXXa series U.2 7680GB + 1cc4 a125 NVMe SSD UHXXXa series U.2 15360GB + 1cc4 a211 NVMe SSD UHXXXa series U.2 800GB + 1cc4 a212 NVMe SSD UHXXXa series U.2 1600GB + 1cc4 a213 NVMe SSD UHXXXa series U.2 3200GB + 1cc4 a214 NVMe SSD UHXXXa series U.2 6400GB 17ab NVMe 256G SSD device 1cc5 Embedded Intelligence, Inc. 0100 CAN-PCIe-02 @@ -23670,6 +23706,7 @@ 0100 ExaDISK FX1 1cf0 Akitio 1cf7 Subspace Dynamics +1cfa Corsair Memory, Inc 1d00 Pure Storage 1d05 Tongfang Hongkong Limited 1d0f Amazon.com, Inc. @@ -23816,6 +23853,7 @@ 101b AR-ARK-SRIOV-FX1 [Arkville 64B Primary Physical Function] 101c AR-ARK-SRIOV-VF [Arkville Virtual Function] 101d AR-ARK-NIC [Arkville ArkNIC Kernel Path Device] + 101e AR-ARKA-FX1 [Arkville 64B DPDK Data Mover for Agilex R-Tile] 4200 A5PL-E1-10GETI [10 GbE Ethernet Traffic Instrument] 1d72 Xiaomi 1d78 DERA Storage @@ -23844,6 +23882,8 @@ 0100 RK3399 PCI Express Root Port 1808 RK1808 Neural Network Processor Card 3566 RK3568 Remote Signal Processor +1d89 YEESTOR Microelectronics Co., Ltd + 0280 PCIe NVMe SSD 1d8f Enyx 1d92 Abaco Systems Inc. 1d93 YADRO @@ -23894,15 +23934,40 @@ 1000 HL-2000 AI Training Accelerator [Gaudi] # PCIe accelerator card for Deep Learning training tasks with secured firmware 1010 HL-2000 AI Training Accelerator [Gaudi secured] +1dad Fungible 1db2 ATP ELECTRONICS INC +1db7 Phytium Technology Co., Ltd. + dc20 [X100 Series] + dc21 VPU Controller [X100 Series] + dc22 DC Controller [X100 Series] + dc23 I2S/DMA Controller [X100 Series] + dc26 SATA Controller [X100 Series] + dc27 USB Controller [X100 Series] + dc29 NANDFLASH Controller [X100 Series] + dc2b I2S Controller [X100 Series] + dc2c SPIM Controller [X100 Series] + dc2d CAN Controller [X100 Series] + dc2e UART Controller [X100 Series] + dc2f PWM Controller [X100 Series] + dc30 MIO Controller [X100 Series] + dc31 GPIO Controller [X100 Series] + dc32 SMBUS Controller [X100 Series] + dc34 PS2 Controller [X100 Series] + dc35 LPC Controller [X100 Series] + dc36 LDMA Controller [X100 Series] + dc38 LSD_CFG Controller [X100 Series] + dc3a SWITCH Controller [X100 Series] + dc3c GPU_DMA Controller [X100 Series] 1dbb NGD Systems, Inc. 1dbf Guizhou Huaxintong Semiconductor Technology Co., Ltd 0401 StarDragon4800 PCI Express Root Port 1dc5 FADU Inc. 1dcd Liqid Inc. +1dcf Beijing Sinead Technology Co., Ltd. 1dd8 Pensando Systems 0002 DSC2 Elba Upstream Port 1dd8 5001 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card + 1dd8 5003 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card 1000 DSC Capri Upstream Port 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB @@ -23926,6 +23991,7 @@ 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1dd8 4014 DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 5001 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card + 1dd8 5003 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card 1002 DSC Ethernet Controller 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB @@ -23938,6 +24004,7 @@ 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1dd8 4014 DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 5001 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card + 1dd8 5003 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card 1003 DSC Ethernet Controller VF 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB @@ -23950,6 +24017,7 @@ 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1dd8 4014 DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 5001 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card + 1dd8 5003 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card 1004 DSC Management Controller 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB @@ -23962,6 +24030,7 @@ 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1dd8 4014 DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 5001 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card + 1dd8 5003 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card 1007 DSC Storage Accelerator 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB @@ -23974,6 +24043,8 @@ 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1dd8 4014 DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 5001 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card + 1dd8 5003 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card +1ddd Thorlabs 1de0 Groq # rename due to conflict with a term in use by another company for an entirely different product. 0000 TSP100 Tensor Streaming Processor @@ -24108,6 +24179,10 @@ 0001 T10 [CloudBlazer] 0002 T11 [CloudBlazer] 0003 T10(QSFP-DD) [CloudBlazer] + 0021 T20(32GB) [CloudBlazer] + 0022 T20(64GB) [CloudBlazer] + 0023 T21(32GB) [CloudBlazer] + 0024 T21(64GB) [CloudBlazer] 8011 I10 [CloudBlazer] 8012 I10L [CloudBlazer] # nee Thinci, Inc @@ -24174,6 +24249,16 @@ 1e7c Brainchip Inc bca1 AKD1000 Neural Network Coprocessor [Akida] 1e81 Ramaxel Technology(Shenzhen) Limited + 1203 NVMe SSD Controller UHXXXa series + 1e81 a121 NVMe SSD UHXXXa series U.2 960GB + 1e81 a122 NVMe SSD UHXXXa series U.2 1920GB + 1e81 a123 NVMe SSD UHXXXa series U.2 3840GB  + 1e81 a124 NVMe SSD UHXXXa series U.2 7680GB  + 1e81 a125 NVMe SSD UHXXXa series U.2 15360GB + 1e81 a211 NVMe SSD UHXXXa series U.2 800GB  + 1e81 a212 NVMe SSD UHXXXa series U.2 1600GB  + 1e81 a213 NVMe SSD UHXXXa series U.2 3200GB  + 1e81 a214 NVMe SSD UHXXXa series U.2 6400GB  1e85 Heitec AG 1e89 ID Quantique SA 0002 Quantis-PCIe-40M @@ -24185,6 +24270,7 @@ 2a16 Cloud Intelligent Inference Controller 1ea7 Intelliprop, Inc 223a Typhon+ PCIe to Gen-Z Bridge + 224a IPA-PE224A CXL to Gen-Z Bridge [Sphinx] 1eab Hefei DATANG Storage Technology Co.,LTD. 300a NVMe SSD Controller 300A 300b NVMe SSD Controller 300B @@ -24209,6 +24295,7 @@ 5220 IG5220-Based NVMe SSD 5236 IG5236-Based NVMe SSD 5636 IG5636-Based NVMe SSD +1fab Unifabrix Ltd. # nee Tumsan Oy 1fc0 Ascom (Finland) Oy 0300 E2200 Dual E1/Rawpipe Card @@ -24685,7 +24772,9 @@ 0010 [mvHYPERION-16R16/-32R16] 16 Video Channel PCI Express x4 Frame Grabber 0020 [mvHYPERION-HD-SDI] HD-SDI PCI Express x4 Frame Grabber 0030 [mvHYPERION-HD-SDI-Merger] HD-SDI PCI Express x4 Frame Grabber + 7012 [mvBlueNAOS BVS CA-BN] PCIe Gen1 x2 Camera 7014 [mvBlueNAOS BVS CA-BN] PCIe Gen1 x4 Camera + 7022 [mvBlueNAOS BVS CA-BN] PCIe Gen2 x2 Camera 7024 [mvBlueNAOS BVS CA-BN] PCIe Gen2 x4 Camera 4ddc ILC Data Device Corp 0100 DD-42924I5-300 (ARINC 429 Data Bus) @@ -25130,8 +25219,11 @@ 0176 3rd Gen Core processor Graphics Controller 0201 Arctic Sound 0284 Comet Lake PCH-LP LPC Premium Controller/eSPI Controller + 1028 09be Latitude 7410 02a3 Comet Lake PCH-LP SMBus Host Controller + 1028 09be Latitude 7410 02a4 Comet Lake SPI (flash) Controller + 1028 09be Latitude 7410 02a6 Comet Lake North Peak 02b0 Comet Lake PCI Express Root Port #9 02b1 Comet Lake PCI Express Root Port #10 @@ -25140,14 +25232,21 @@ 02b8 Comet Lake PCI Express Root Port #1 02bc Comet Lake PCI Express Root Port #5 02c5 Comet Lake Serial IO I2C Host Controller + 1028 09be Latitude 7410 02c8 Comet Lake PCH-LP cAVS + 1028 09be Latitude 7410 02d3 Comet Lake SATA AHCI Controller 02e0 Comet Lake Management Engine Interface + 1028 09be Latitude 7410 02e8 Serial IO I2C Host Controller + 1028 09be Latitude 7410 02e9 Comet Lake Serial IO I2C Host Controller + 1028 09be Latitude 7410 02ea Comet Lake PCH-LP LPSS: I2C Controller #2 02ed Comet Lake PCH-LP USB 3.1 xHCI Host Controller + 1028 09be Latitude 7410 02ef Comet Lake PCH-LP Shared SRAM + 1028 09be Latitude 7410 02f0 Comet Lake PCH-LP CNVi WiFi 8086 0034 Wireless-AC 9560 160MHz 8086 0070 Wi-Fi 6 AX201 160MHz @@ -25155,7 +25254,9 @@ 8086 4070 Wi-Fi 6 AX201 160MHz 02f5 Comet Lake PCH-LP SCS3 02f9 Comet Lake Thermal Subsytem + 1028 09be Latitude 7410 02fc Comet Lake Integrated Sensor Solution + 1028 09be Latitude 7410 0309 80303 I/O Processor PCI-to-PCI Bridge 030d 80312 I/O Companion Chip PCI-to-PCI Bridge 0326 6700/6702PXH I/OxAPIC Interrupt Controller A @@ -25270,7 +25371,8 @@ 0703 CE Media Processor Media Control Unit 1 0704 CE Media Processor Video Capture Interface 0707 CE Media Processor SPI Slave - 0708 CE Media Processor 4100 + 0708 Atom Processor CE 4100 + 0709 Atom Processor CE 4200 0800 Moorestown SPI Ctrl 0 0801 Moorestown SPI Ctrl 1 0802 Moorestown I2C 0 @@ -25556,6 +25658,7 @@ 8086 8370 Dual Band Wireless AC 3160 # PowerVR SGX 545 08cf Atom Processor Z2760 Integrated Graphics Controller + 0931 Atom Processor CE 2600 [Puma 6] 0934 Quark SoC X1000 I2C Controller and GPIO Controller 0935 Quark SoC X1000 SPI Controller 0936 Quark SoC X1000 HS-UART @@ -25796,6 +25899,7 @@ 103c 1998 EliteDesk 800 G1 17aa 220e ThinkPad T440p 17aa 309f ThinkCentre M83 + 0c40 Atom Processor CE 5300 0c46 Atom Processor S1200 PCI Express Root Port 1 0c47 Atom Processor S1200 PCI Express Root Port 2 0c48 Atom Processor S1200 PCI Express Root Port 3 @@ -26027,7 +26131,7 @@ 0f0a Atom Processor Z36xxx/Z37xxx Series LPIO1 HSUART Controller #1 0f0c Atom Processor Z36xxx/Z37xxx Series LPIO1 HSUART Controller #2 0f0e Atom Processor Z36xxx/Z37xxx Series LPIO1 SPI Controller - 0f12 Atom Processor E3800 Series SMBus Controller + 0f12 Atom Processor E3800/CE2700 Series SMBus Controller 0f14 Atom Processor Z36xxx/Z37xxx Series SDIO Controller 0f15 Atom Processor Z36xxx/Z37xxx Series SDIO Controller 0f16 Atom Processor Z36xxx/Z37xxx Series SDIO Controller @@ -26534,6 +26638,7 @@ 103c 2159 Ethernet 10Gb 2-port 562i Adapter 108e 7b11 Ethernet Server Adapter X520-2 1170 004c 82599 DP 10G Mezzanine Adapter + 1374 1a08 PE310G4SPI9/PE310G4SPI9L/PE310G4SPI9LA Quad Port Fiber 10 Gigabit Ethernet PCI Express Server Adapter 15d9 0611 AOC-STGN-i2S 1734 11a9 10 Gigabit Dual Port Network Connection 17aa 1071 ThinkServer X520-2 AnyFabric @@ -27299,7 +27404,9 @@ 15e9 JHL7540 Thunderbolt 3 USB Controller [Titan Ridge 2C 2018] 15ea JHL7540 Thunderbolt 3 Bridge [Titan Ridge 4C 2018] 15eb JHL7540 Thunderbolt 3 NHI [Titan Ridge 4C 2018] + 1028 09be Latitude 7410 15ec JHL7540 Thunderbolt 3 USB Controller [Titan Ridge 4C 2018] + 1028 09be Latitude 7410 15ef JHL7540 Thunderbolt 3 Bridge [Titan Ridge DD 2018] 15f0 JHL7540 Thunderbolt 3 USB Controller [Titan Ridge DD 2018] 15f2 Ethernet Controller I225-LM @@ -27396,6 +27503,7 @@ 1028 06dc Latitude E7470 1028 06e4 XPS 15 9550 1028 06e6 Latitude 11 5175 2-in-1 + 1028 09be Latitude 7410 103c 825b OMEN-17-w001nv 17aa 225d ThinkPad T480 1904 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers @@ -27418,6 +27526,7 @@ 103c 825b OMEN-17-w001nv 1911 Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th/8th Gen Core Processor Gaussian Mixture Model 1028 0869 Vostro 3470 + 1028 09be Latitude 7410 1462 7a72 H270 PC MATE 17aa 2247 ThinkPad T570 17aa 224f ThinkPad X1 Carbon 5th Gen @@ -30434,6 +30543,13 @@ 2b66 Xeon Processor E7 Product Family SMI Physical Port 1: Misc control/status 2b68 Xeon Processor E7 Product Family Last Level Cache Coherence Engine 8 2b6c Xeon Processor E7 Product Family Last Level Cache Coherence Engine 9 + 2b80 Atom CE2700 Series [Puma 7] + 2b98 Puma 7 Trusted Execution Engine + 2bb5 Puma 7 xHCI Controller +# Synopsys DesignWare Core SuperSpeed USB 3.0 Controller + 2bb7 Puma 7 USB Device Controller (OTG) + 2bdc Puma 7 Thermal + 2be2 Puma 7 Security Processor 2c01 Xeon 5500/Core i7 QuickPath Architecture System Address Decoder 2c10 Xeon 5500/Core i7 QPI Link 0 2c11 Xeon 5500/Core i7 QPI Physical 0 @@ -30604,6 +30720,7 @@ 2e61 CE Media Processor Video Display Controller 2e62 CE Media Processor Video Processing Unit 2e63 CE Media Processor HDMI Tx Interface + 2e64 Atom CE2600/3100/4100/4200/5300 Security Processor 2e65 CE Media Processor Expansion Bus Interface 2e66 CE Media Processor UART 2e67 CE Media Processor General Purpose I/Os @@ -31722,6 +31839,7 @@ 4905 DG1 [Iris Xe MAX Graphics] 4906 DG1 [Iris Xe Pod] 4907 SG1 [Server GPU SG-18M] + 193d 4000 UN-GPU-XG310-32GB-FHFL 4908 DG1 [Iris Xe Graphics] 4c3d Volume Management Device NVMe RAID Controller 4c8a RocketLake-S GT1 [UHD Graphics 750] @@ -32512,10 +32630,12 @@ 9a68 TigerLake-H GT1 [UHD Graphics] 9b41 CometLake-U GT2 [UHD Graphics] 1028 09bd Latitude 7310 + 1028 09be Latitude 7410 9b44 10th Gen Core Processor Host Bridge/DRAM Registers 9b53 Comet Lake-S 6c Host Bridge/DRAM Controller 9b54 10th Gen Core Processor Host Bridge/DRAM Registers 9b61 Comet Lake-U v1 4c Host Bridge/DRAM Controller + 1028 09be Latitude 7410 9b63 10th Gen Core Processor Host Bridge/DRAM Registers 9b64 10th Gen Core Processor Host Bridge/DRAM Registers 9bc4 CometLake-H GT2 [UHD Graphics] @@ -33592,6 +33712,8 @@ 152d 8a24 QS-8236-16i 152d 8a36 QS-8240-24i 152d 8a37 QS-8242-24i + 1590 0294 SR932i-p Gen10+ + 1590 02dc SR416i-a Gen10+ 193d 1104 RAID P2404-Mf-4i-2GB 193d 1105 RAID P4408-Mf-8i-2GB 193d 1106 RAID P2404-Mf-4i-1GB @@ -33648,6 +33770,20 @@ 9005 1302 SmartHBA 2100-8i8e 9005 1303 SmartHBA 2100-24i 9005 1380 SmartRAID 3154-16i + 9005 1400 SmartRAID Ultra 3258p-16i /e + 9005 1402 HBA Ultra 1200p-16i + 9005 1410 HBA Ultra 1200-16e + 9005 1430 SmartRAID Ultra 3254-16e /e + 9005 1441 HBA Ultra 1200p-32i + 9005 1450 SmartRAID Ultra 3258p-32i /e + 9005 1462 HBA 1200-8i + 9005 1471 SmartRAID 3254-16i /e + 9005 1472 SmartRAID 3258-16i /e + 9005 14a0 SmartRAID 3254-8i + 9005 14a1 SmartRAID 3204-8i + 9005 14a2 SmartRAID 3252-8i + 9005 14c0 SmartHBA 2200-16i + 9005 14c1 HBA 1200-16i 0410 AIC-9410W SAS (Razor HBA RAID) 9005 0410 ASC-48300(Spirit RAID) 9005 0411 ASC-58300 (Oakmont RAID) From owner-dev-commits-src-all@freebsd.org Wed Sep 22 08:12:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1C606ADD52 for ; Wed, 22 Sep 2021 08:12: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 4HDrdR5fdpz4Z91; Wed, 22 Sep 2021 08:12: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 9A564145A2; Wed, 22 Sep 2021 08:12: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 18M8Cxex025781; Wed, 22 Sep 2021 08:12:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18M8Cx7Y025780; Wed, 22 Sep 2021 08:12:59 GMT (envelope-from git) Date: Wed, 22 Sep 2021 08:12:59 GMT Message-Id: <202109220812.18M8Cx7Y025780@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Baptiste Daroussin Subject: git: 31595a7c3a4a..30f4a9aee1c1 - vendor/NetBSD/libedit - vendor branch updated MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/vendor/NetBSD/libedit X-Git-Reftype: branch X-Git-Commit: 30f4a9aee1c1a55babc9a2f60d3eb0e695d064ae X-Git-Oldrev: 31595a7c3a4afa330555de5f58b1a23ad88a8bc5 X-Git-Newrev: 30f4a9aee1c1a55babc9a2f60d3eb0e695d064ae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 08:12:59 -0000 The branch vendor/NetBSD/libedit has been updated by bapt: URL: https://cgit.FreeBSD.org/src/log/?id=31595a7c3a4a..30f4a9aee1c1 30f4a9aee1c1 libedit: import version snapshot 2021-09-10 From owner-dev-commits-src-all@freebsd.org Wed Sep 22 08:19:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6450F6AE1B6 for ; Wed, 22 Sep 2021 08:19: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 4HDrmZ2N4gz4ZYG; Wed, 22 Sep 2021 08:19: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 3268A14612; Wed, 22 Sep 2021 08:19: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 18M8JAGe026575; Wed, 22 Sep 2021 08:19:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18M8JASa026574; Wed, 22 Sep 2021 08:19:10 GMT (envelope-from git) Date: Wed, 22 Sep 2021 08:19:10 GMT Message-Id: <202109220819.18M8JASa026574@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Baptiste Daroussin Subject: git: 38d64e2fdad4 - Create tag vendor/NetBSD/libedit/2021-09-10 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/tags/vendor/NetBSD/libedit/2021-09-10 X-Git-Reftype: annotated tag X-Git-Commit: 38d64e2fdad409ca32ace78c09d9cb5c27c35f4a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 08:19:10 -0000 The annotated tag vendor/NetBSD/libedit/2021-09-10 has been created by bapt: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/NetBSD/libedit/2021-09-10 tag vendor/NetBSD/libedit/2021-09-10 Tagger: Baptiste Daroussin TaggerDate: 2021-09-22 08:18:17 +0000 Tag vendor import of libedit 2021-09-10 commit 30f4a9aee1c1a55babc9a2f60d3eb0e695d064ae Author: Baptiste Daroussin AuthorDate: 2021-09-22 08:11:18 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 08:11:18 +0000 libedit: import version snapshot 2021-09-10 From owner-dev-commits-src-all@freebsd.org Wed Sep 22 08:22:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2EA8B6AE31C; Wed, 22 Sep 2021 08:22:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDrrp0rmgz4b4P; Wed, 22 Sep 2021 08:22:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1CF51481D; Wed, 22 Sep 2021 08:22: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 18M8MnxU039724; Wed, 22 Sep 2021 08:22:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18M8Mn4C039723; Wed, 22 Sep 2021 08:22:49 GMT (envelope-from git) Date: Wed, 22 Sep 2021 08:22:49 GMT Message-Id: <202109220822.18M8Mn4C039723@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 91f764172e19 - main - libedit: import snapshot 2021-09-10 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 91f764172e197c82efa97a66cfbc13d2c744b02b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 08:22:50 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=91f764172e197c82efa97a66cfbc13d2c744b02b commit 91f764172e197c82efa97a66cfbc13d2c744b02b Merge: 00582fa66051 30f4a9aee1c1 Author: Baptiste Daroussin AuthorDate: 2021-09-22 08:19:43 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 08:19:43 +0000 libedit: import snapshot 2021-09-10 contrib/libedit/ChangeLog | 6 + contrib/libedit/TEST/fuzz1.c | 63 +++++++ contrib/libedit/editline.3 | 18 +- contrib/libedit/el.c | 17 +- contrib/libedit/el.h | 15 +- contrib/libedit/eln.c | 6 +- contrib/libedit/filecomplete.c | 7 +- contrib/libedit/histedit.h | 3 +- contrib/libedit/map.c | 8 +- contrib/libedit/read.c | 6 +- contrib/libedit/readline.c | 366 ++++++++++++++++++++++-------------- contrib/libedit/readline/readline.h | 19 +- contrib/libedit/refresh.c | 20 +- contrib/libedit/terminal.c | 7 +- contrib/libedit/tty.c | 12 +- contrib/libedit/tty.h | 4 +- contrib/libedit/vi.c | 9 +- 17 files changed, 396 insertions(+), 190 deletions(-) diff --cc contrib/libedit/ChangeLog index 000000000000,35c9205a43d8..35c9205a43d8 mode 000000,100644..100644 --- a/contrib/libedit/ChangeLog +++ b/contrib/libedit/ChangeLog diff --cc contrib/libedit/TEST/fuzz1.c index 000000000000,e31d26538885..e31d26538885 mode 000000,100644..100644 --- a/contrib/libedit/TEST/fuzz1.c +++ b/contrib/libedit/TEST/fuzz1.c From owner-dev-commits-src-all@freebsd.org Wed Sep 22 08:27:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C712D6AE3C8; Wed, 22 Sep 2021 08:27:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDryf510wz4ZpG; Wed, 22 Sep 2021 08:27:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BD4B14642; Wed, 22 Sep 2021 08:27: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 18M8Rsmm040182; Wed, 22 Sep 2021 08:27:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18M8RsVJ040181; Wed, 22 Sep 2021 08:27:54 GMT (envelope-from git) Date: Wed, 22 Sep 2021 08:27:54 GMT Message-Id: <202109220827.18M8RsVJ040181@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 908b8e32f9de - main - sh: remove emacs improvements that are now defaults in libedit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 908b8e32f9deb55441fac75b8d1e3865e3d5302f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 08:27:54 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=908b8e32f9deb55441fac75b8d1e3865e3d5302f commit 908b8e32f9deb55441fac75b8d1e3865e3d5302f Author: Baptiste Daroussin AuthorDate: 2021-09-22 08:27:10 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 08:27:10 +0000 sh: remove emacs improvements that are now defaults in libedit --- bin/sh/histedit.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 1a1e11e6f885..938df284a06c 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -203,8 +203,6 @@ bad: el_set(el, EL_EDITOR, "vi"); else if (Eflag) { el_set(el, EL_EDITOR, "emacs"); - el_set(el, EL_BIND, "^R", "em-inc-search-prev", NULL); - el_set(el, EL_BIND, "^W", "ed-delete-prev-word", NULL); } el_set(el, EL_BIND, "^I", "sh-complete", NULL); el_source(el, NULL); From owner-dev-commits-src-all@freebsd.org Wed Sep 22 08:54:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF1516AE949 for ; Wed, 22 Sep 2021 08:54: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 4HDsYV4GZcz4fDK; Wed, 22 Sep 2021 08:54: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 6908814D17; Wed, 22 Sep 2021 08:54: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 18M8scsG079613; Wed, 22 Sep 2021 08:54:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18M8scsY079612; Wed, 22 Sep 2021 08:54:38 GMT (envelope-from git) Date: Wed, 22 Sep 2021 08:54:38 GMT Message-Id: <202109220854.18M8scsY079612@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Baptiste Daroussin Subject: git: 598ad972718c..16a84834c279 - vendor/dma - vendor branch updated MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/vendor/dma X-Git-Reftype: branch X-Git-Commit: 16a84834c2798d54c29d4794ef87472c9afd943e X-Git-Oldrev: 598ad972718c41f5438bf7654286bbce15c9cea1 X-Git-Newrev: 16a84834c2798d54c29d4794ef87472c9afd943e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 08:54:38 -0000 The branch vendor/dma has been updated by bapt: URL: https://cgit.FreeBSD.org/src/log/?id=598ad972718c..16a84834c279 16a84834c279 dma: import git snapshot 2021-07-10 From owner-dev-commits-src-all@freebsd.org Wed Sep 22 08:54:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B37A36AE83E for ; Wed, 22 Sep 2021 08:54: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 4HDsYV4lJbz4f4x; Wed, 22 Sep 2021 08:54: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 7EE1A14E51; Wed, 22 Sep 2021 08:54: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 18M8sc0Z079637; Wed, 22 Sep 2021 08:54:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18M8scrx079636; Wed, 22 Sep 2021 08:54:38 GMT (envelope-from git) Date: Wed, 22 Sep 2021 08:54:38 GMT Message-Id: <202109220854.18M8scrx079636@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Baptiste Daroussin Subject: git: 9e3ce122aa5c - Create tag vendor/dma/2021-07-10 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/tags/vendor/dma/2021-07-10 X-Git-Reftype: annotated tag X-Git-Commit: 9e3ce122aa5ceb4c26e18b3fd1b39c241cc69f31 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 08:54:38 -0000 The annotated tag vendor/dma/2021-07-10 has been created by bapt: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/dma/2021-07-10 tag vendor/dma/2021-07-10 Tagger: Baptiste Daroussin TaggerDate: 2021-09-22 08:54:16 +0000 dma: tag import for version 2021-07-10 commit 16a84834c2798d54c29d4794ef87472c9afd943e Author: Baptiste Daroussin AuthorDate: 2021-09-22 08:52:34 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 08:52:34 +0000 dma: import git snapshot 2021-07-10 From owner-dev-commits-src-all@freebsd.org Wed Sep 22 09:01:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E63846AEB35; Wed, 22 Sep 2021 09:01:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDsjy62h6z4g6y; Wed, 22 Sep 2021 09:01: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 AF492148EA; Wed, 22 Sep 2021 09:01: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 18M91wqt092503; Wed, 22 Sep 2021 09:01:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18M91waT092502; Wed, 22 Sep 2021 09:01:58 GMT (envelope-from git) Date: Wed, 22 Sep 2021 09:01:58 GMT Message-Id: <202109220901.18M91waT092502@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 9413dfd331e7 - main - sh: reset sh bindings on bind -e, bind -v MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9413dfd331e705a1d7909fe41f06a30e43c442f7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 09:01:59 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=9413dfd331e705a1d7909fe41f06a30e43c442f7 commit 9413dfd331e705a1d7909fe41f06a30e43c442f7 Author: Piotr Pawel Stefaniak AuthorDate: 2021-09-19 20:17:01 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-22 08:54:51 +0000 sh: reset sh bindings on bind -e, bind -v Until this change, any bindings set in histedit() were lost on calls to bindcmd(). Only bind -e and bind -v call libedit's keymacro_reset(). Currently you cannot fool libedit/map.c:map_bind() by trying something like bind -le as when p[0] == '-', it does a switch statement on p[1]. --- bin/sh/histedit.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 938df284a06c..37b62cef5746 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -559,6 +559,13 @@ bindcmd(int argc, char **argv) fclose(out); + if (argc > 1 && argv[1][0] == '-' && + memchr("ve", argv[1][1], 2) != NULL) { + Vflag = argv[1][1] == 'v'; + Eflag = !Vflag; + histedit(); + } + INTON; return ret; From owner-dev-commits-src-all@freebsd.org Wed Sep 22 09:11:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A2626AEB63; Wed, 22 Sep 2021 09:11: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 4HDswh07Ktz4gTb; Wed, 22 Sep 2021 09:11: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 D97CF15118; Wed, 22 Sep 2021 09:11: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 18M9BFOn002450; Wed, 22 Sep 2021 09:11:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18M9BFjB002449; Wed, 22 Sep 2021 09:11:15 GMT (envelope-from git) Date: Wed, 22 Sep 2021 09:11:15 GMT Message-Id: <202109220911.18M9BFjB002449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: fbe95b885f34 - main - dma: import snapshot 2021-07-10 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fbe95b885f3431b1d8003545b32e8ffa88f2d16b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 09:11:16 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=fbe95b885f3431b1d8003545b32e8ffa88f2d16b commit fbe95b885f3431b1d8003545b32e8ffa88f2d16b Merge: 9413dfd331e7 16a84834c279 Author: Baptiste Daroussin AuthorDate: 2021-09-22 09:09:27 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 09:10:58 +0000 dma: import snapshot 2021-07-10 contrib/dma/Makefile | 2 +- contrib/dma/VERSION | 2 +- contrib/dma/conf.c | 20 +++- contrib/dma/crypto.c | 43 ++++++- contrib/dma/dfcompat.c | 6 +- contrib/dma/dma.8 | 17 ++- contrib/dma/dma.c | 38 +++--- contrib/dma/dma.conf | 6 +- contrib/dma/dma.h | 17 ++- contrib/dma/dns.c | 5 - contrib/dma/get-version.sh | 0 contrib/dma/local.c | 5 +- contrib/dma/mail.c | 40 +++++-- contrib/dma/net.c | 284 ++++++++++++++++++++++++++++++++------------- contrib/dma/spool.c | 2 + contrib/dma/util.c | 20 ++++ 16 files changed, 378 insertions(+), 129 deletions(-) diff --cc contrib/dma/Makefile index aed2ef7246cf,000000000000..8cae5b28f98b mode 100644,000000..100644 --- a/contrib/dma/Makefile +++ b/contrib/dma/Makefile @@@ -1,111 -1,0 +1,111 @@@ +# +# Depending on your operating system, you might want to influence +# the conditional inclusion of some helper functions: +# +# Define HAVE_* (in caps) if your system already provides: +# reallocf +# strlcpy +# getprogname +# + +SH?= sh + +version= $(shell ${SH} get-version.sh) +debversion= $(shell ${SH} get-version.sh | sed -Ee 's/^v//;s/[.]([[:digit:]]+)[.](g[[:xdigit:]]+)$$/+\1+\2/') + +CC?= gcc +CFLAGS?= -O -pipe +LDADD?= -lssl -lcrypto -lresolv + - CFLAGS+= -Wall -DDMA_VERSION='"${version}"' -DLIBEXEC_PATH='"${LIBEXEC}"' -DCONF_PATH='"${CONFDIR}"' ++CFLAGS+= -Wall -Wno-format-truncation -DDMA_VERSION='"${version}"' -DLIBEXEC_PATH='"${LIBEXEC}"' -DCONF_PATH='"${CONFDIR}"' + +INSTALL?= install -p +CHGRP?= chgrp +CHMOD?= chmod + +PREFIX?= /usr/local +SBIN?= ${PREFIX}/sbin +LIBEXEC?= ${PREFIX}/lib +CONFDIR?= /etc/dma +MAN?= ${PREFIX}/share/man +VAR?= /var +DMASPOOL?= ${VAR}/spool/dma +VARMAIL?= ${VAR}/mail +SYMLINK?= -s # or empty to create hard link + +YACC?= yacc +LEX?= lex +LN?= ln + +OBJS= aliases_parse.o aliases_scan.o base64.o conf.o crypto.o +OBJS+= dma.o dns.o local.o mail.o net.o spool.o util.o +OBJS+= dfcompat.o + +all: dma dma-mbox-create + +clean: + -rm -f .depend dma dma-mbox-create *.[do] + -rm -f aliases_parse.[ch] aliases_scan.c + +install: all + ${INSTALL} -d ${DESTDIR}${SBIN} + ${INSTALL} -d ${DESTDIR}${MAN}/man8 ${DESTDIR}${LIBEXEC} + ${INSTALL} -m 2755 -o root -g mail dma ${DESTDIR}${SBIN} + ${INSTALL} -m 4754 -o root -g mail dma-mbox-create ${DESTDIR}${LIBEXEC} + ${INSTALL} -m 0644 dma.8 ${DESTDIR}${MAN}/man8/ + +sendmail-link: + cd ${DESTDIR}${SBIN} && ${LN} ${SYMLINK} dma sendmail + +mailq-link: + cd ${DESTDIR}${SBIN} && ${LN} ${SYMLINK} dma mailq + +install-spool-dirs: + ${INSTALL} -d -m 2775 -o root -g mail ${DESTDIR}${DMASPOOL} + ${INSTALL} -d -m 2775 -o root -g mail ${DESTDIR}${VARMAIL} + +permissions: + -${CHGRP} mail ${DESTDIR}${VARMAIL}/* + -${CHMOD} g+w ${DESTDIR}${VARMAIL}/* + -${CHMOD} 660 ${DESTDIR}${DMASPOOL}/flush + +install-etc: + ${INSTALL} -d ${DESTDIR}${CONFDIR} + @if [ -e ${DESTDIR}${CONFDIR}/dma.conf ]; then \ + echo "Not overwriting ${DESTDIR}${CONFDIR}/dma.conf."; \ + else \ + echo ${INSTALL} -m 644 -o root -g mail dma.conf ${DESTDIR}${CONFDIR}; \ + ${INSTALL} -m 644 -o root -g mail dma.conf ${DESTDIR}${CONFDIR}; \ + fi + @if [ -e ${DESTDIR}${CONFDIR}/auth.conf ]; then \ + echo "Not overwriting ${DESTDIR}${CONFDIR}/auth.conf."; \ + else \ + echo ${INSTALL} -m 640 -o root -g mail auth.conf ${DESTDIR}${CONFDIR}; \ + ${INSTALL} -m 640 -o root -g mail auth.conf ${DESTDIR}${CONFDIR}; \ + fi + +aliases_parse.c: aliases_parse.y + ${YACC} -d -o aliases_parse.c aliases_parse.y + +aliases_scan.c: aliases_scan.l + ${LEX} -t aliases_scan.l > aliases_scan.c + +.SUFFIXES: .c .o + +.c.o: + ${CC} ${CFLAGS} ${CPPFLAGS} -include dfcompat.h -o $@ -c $< + +dma: ${OBJS} + ${CC} ${LDFLAGS} -o $@ ${OBJS} ${LDADD} + + +dch: + dch --release-heuristic changelog -v ${debversion} + + +ppa: + @if [ -z '${DEB_DIST}' ]; then echo "please set DEB_DIST to build"; exit 1; fi + dch -v "${debversion}~${DEB_DIST}" -D ${DEB_DIST} "${DEB_DIST} build" -b + debuild -S -sa + ver=$$(dpkg-parsechangelog -n1 | awk '$$1 == "Version:" { print $$2 }'); \ + dput ppa:corecode/dma ../dma_$${ver}_source.changes diff --cc contrib/dma/conf.c index b8a6a2e2cbd7,000000000000..13cfac7a6de4 mode 100644,000000..100644 --- a/contrib/dma/conf.c +++ b/contrib/dma/conf.c @@@ -1,245 -1,0 +1,261 @@@ +/* + * Copyright (c) 2008 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthias Schmidt , University of Marburg, + * Germany. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDERS 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 +#include +#include +#include +#include +#include +#include + +#include "dma.h" + +#define DP ": \t" +#define EQS " \t" + + +/* + * Remove trailing \n's + */ +void +trim_line(char *line) +{ + size_t linelen; + char *p; + + if ((p = strchr(line, '\n'))) + *p = (char)0; + + /* Escape leading dot in every case */ + linelen = strlen(line); + if (line[0] == '.') { + if ((linelen + 2) > 1000) { + syslog(LOG_CRIT, "Cannot escape leading dot. Buffer overflow"); + exit(EX_DATAERR); + } + memmove((line + 1), line, (linelen + 1)); + line[0] = '.'; + } +} + +static void +chomp(char *str) +{ + size_t len = strlen(str); + + if (len == 0) + return; + if (str[len - 1] == '\n') + str[len - 1] = 0; +} + +/* + * Read the SMTP authentication config file + * + * file format is: + * user|host:password + * + * A line starting with # is treated as comment and ignored. + */ +void +parse_authfile(const char *path) +{ + char line[2048]; + struct authuser *au; + FILE *a; + char *data; + int lineno = 0; + + a = fopen(path, "r"); + if (a == NULL) { + errlog(EX_NOINPUT, "can not open auth file `%s'", path); + /* NOTREACHED */ + } + + while (!feof(a)) { + if (fgets(line, sizeof(line), a) == NULL) + break; + lineno++; + + chomp(line); + + /* We hit a comment */ + if (*line == '#') + continue; + /* Ignore empty lines */ + if (*line == 0) + continue; + + au = calloc(1, sizeof(*au)); + if (au == NULL) + errlog(EX_OSERR, "calloc()"); + + data = strdup(line); + au->login = strsep(&data, "|"); + au->host = strsep(&data, DP); + au->password = data; + + if (au->login == NULL || + au->host == NULL || + au->password == NULL) { + errlogx(EX_CONFIG, "syntax error in authfile %s:%d", path, lineno); + /* NOTREACHED */ + } + + SLIST_INSERT_HEAD(&authusers, au, next); + } + + fclose(a); +} + +/* + * XXX TODO + * Check for bad things[TM] + */ +void +parse_conf(const char *config_path) +{ + char *word; + char *data; + FILE *conf; + char line[2048]; + int lineno = 0; + + conf = fopen(config_path, "r"); + if (conf == NULL) { + /* Don't treat a non-existing config file as error */ + if (errno == ENOENT) + return; + errlog(EX_NOINPUT, "can not open config `%s'", config_path); + /* NOTREACHED */ + } + + while (!feof(conf)) { + if (fgets(line, sizeof(line), conf) == NULL) + break; + lineno++; + + chomp(line); + + /* We hit a comment */ + if (strchr(line, '#')) + *strchr(line, '#') = 0; + + data = line; + word = strsep(&data, EQS); + + /* Ignore empty lines */ + if (word == NULL || *word == 0) + continue; + + if (data != NULL && *data != 0) + data = strdup(data); + else + data = NULL; + + if (strcmp(word, "SMARTHOST") == 0 && data != NULL) + config.smarthost = data; + else if (strcmp(word, "PORT") == 0 && data != NULL) + config.port = atoi(data); + else if (strcmp(word, "ALIASES") == 0 && data != NULL) + config.aliases = data; + else if (strcmp(word, "SPOOLDIR") == 0 && data != NULL) + config.spooldir = data; + else if (strcmp(word, "AUTHPATH") == 0 && data != NULL) + config.authpath= data; + else if (strcmp(word, "CERTFILE") == 0 && data != NULL) + config.certfile = data; + else if (strcmp(word, "MAILNAME") == 0 && data != NULL) + config.mailname = data; + else if (strcmp(word, "MASQUERADE") == 0 && data != NULL) { + char *user = NULL, *host = NULL; + if (strrchr(data, '@')) { + host = strrchr(data, '@'); + *host = 0; + host++; + user = data; + } else { + host = data; + } + if (host && *host == 0) + host = NULL; + if (user && *user == 0) + user = NULL; + config.masquerade_host = host; + config.masquerade_user = user; + } else if (strcmp(word, "STARTTLS") == 0 && data == NULL) + config.features |= STARTTLS; - else if (strcmp(word, "OPPORTUNISTIC_TLS") == 0 && data == NULL) ++ else if (strcmp(word, "FINGERPRINT") == 0) { ++ if (strlen(data) != SHA256_DIGEST_LENGTH * 2) { ++ errlogx(EX_CONFIG, "invalid sha256 fingerprint length"); ++ } ++ unsigned char *fingerprint = malloc(SHA256_DIGEST_LENGTH); ++ if (fingerprint == NULL) { ++ errlogx(EX_CONFIG, "fingerprint allocation failed"); ++ } ++ unsigned int i; ++ for (i = 0; i < SHA256_DIGEST_LENGTH; i++) { ++ if(sscanf(data + 2 * i, "%02hhx", &fingerprint[i]) != 1) { ++ errlogx(EX_CONFIG, "failed to read fingerprint"); ++ } ++ } ++ free(data); ++ config.fingerprint = fingerprint; ++ } else if (strcmp(word, "OPPORTUNISTIC_TLS") == 0 && data == NULL) + config.features |= TLS_OPP; + else if (strcmp(word, "SECURETRANSFER") == 0 && data == NULL) - config.features |= SECURETRANS; ++ config.features |= SECURETRANSFER; + else if (strcmp(word, "DEFER") == 0 && data == NULL) + config.features |= DEFER; + else if (strcmp(word, "INSECURE") == 0 && data == NULL) + config.features |= INSECURE; + else if (strcmp(word, "FULLBOUNCE") == 0 && data == NULL) + config.features |= FULLBOUNCE; + else if (strcmp(word, "NULLCLIENT") == 0 && data == NULL) + config.features |= NULLCLIENT; + else { + errlogx(EX_CONFIG, "syntax error in %s:%d", config_path, lineno); + /* NOTREACHED */ + } + } + + if ((config.features & NULLCLIENT) && config.smarthost == NULL) { + errlogx(EX_CONFIG, "%s: NULLCLIENT requires SMARTHOST", config_path); + /* NOTREACHED */ + } + + fclose(conf); +} diff --cc contrib/dma/dma.8 index cadf899e50fc,a906f75447f2..e0f5e79ff47d --- a/contrib/dma/dma.8 +++ b/contrib/dma/dma.8 @@@ -305,10 -313,10 +313,11 @@@ will send all mails a setting it to .Ql percolator will send all mails as -.Ql Sm off Va username @percolator . +.Sm off +.Ql Va username @percolator . .Sm on .It Ic NULLCLIENT Xo + (boolean, default=commented) .Xc Bypass aliases and local delivery, and instead forward all mails to the defined diff --cc contrib/dma/dma.c index b553c0fa0eef,ae0018a243d2..72115ae2b55e --- a/contrib/dma/dma.c +++ b/contrib/dma/dma.c @@@ -596,8 -595,11 +595,11 @@@ skipopts if (read_aliases() != 0) errlog(EX_SOFTWARE, "could not parse aliases file `%s'", config.aliases); + if (newaliases) + return(0); + if ((sender = set_from(&queue, sender)) == NULL) - errlog(EX_SOFTWARE, NULL); + errlog(EX_SOFTWARE, "set_from()"); if (newspoolf(&queue) != 0) errlog(EX_CANTCREAT, "can not create temp file in `%s'", config.spooldir); diff --cc contrib/dma/get-version.sh index d9691ac37c95,d9691ac37c95..d9691ac37c95 mode 100755,100644..100644 --- a/contrib/dma/get-version.sh +++ b/contrib/dma/get-version.sh diff --cc contrib/dma/mail.c index ad928272e1a1,000000000000..48c8ee6d4dd2 mode 100644,000000..100644 --- a/contrib/dma/mail.c +++ b/contrib/dma/mail.c @@@ -1,492 -1,0 +1,518 @@@ +/* + * Copyright (c) 2008-2014, Simon Schubert <2@0x2c.org>. + * Copyright (c) 2008 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Simon Schubert <2@0x2c.org>. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDERS 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 +#include +#include ++#include +#include +#include +#include + +#include "dma.h" + +#define MAX_LINE_RFC822 1000 + +void +bounce(struct qitem *it, const char *reason) +{ + struct queue bounceq; + char line[1000]; + size_t pos; + int error; + + /* Don't bounce bounced mails */ + if (it->sender[0] == 0) { + syslog(LOG_INFO, "can not bounce a bounce message, discarding"); + exit(EX_SOFTWARE); + } + + bzero(&bounceq, sizeof(bounceq)); + LIST_INIT(&bounceq.queue); + bounceq.sender = ""; + if (add_recp(&bounceq, it->sender, EXPAND_WILDCARD) != 0) + goto fail; + + if (newspoolf(&bounceq) != 0) + goto fail; + + syslog(LOG_ERR, "delivery failed, bouncing as %s", bounceq.id); + setlogident("%s", bounceq.id); + + error = fprintf(bounceq.mailf, + "Received: from MAILER-DAEMON\n" + "\tid %s\n" - "\tby %s (%s);\n" ++ "\tby %s (%s on %s);\n" + "\t%s\n" + "X-Original-To: <%s>\n" + "From: MAILER-DAEMON <>\n" + "To: %s\n" + "Subject: Mail delivery failed\n" + "Message-Id: <%s@%s>\n" + "Date: %s\n" + "\n" + "This is the %s at %s.\n" + "\n" + "There was an error delivering your mail to <%s>.\n" + "\n" + "%s\n" + "\n" + "%s\n" + "\n", + bounceq.id, - hostname(), VERSION, ++ hostname(), VERSION, systemhostname(), + rfc822date(), + it->addr, + it->sender, + bounceq.id, hostname(), + rfc822date(), + VERSION, hostname(), + it->addr, + reason, + config.features & FULLBOUNCE ? + "Original message follows." : + "Message headers follow."); + if (error < 0) + goto fail; + + if (fseek(it->mailf, 0, SEEK_SET) != 0) + goto fail; + if (config.features & FULLBOUNCE) { + while ((pos = fread(line, 1, sizeof(line), it->mailf)) > 0) { + if (fwrite(line, 1, pos, bounceq.mailf) != pos) + goto fail; + } + } else { + while (!feof(it->mailf)) { + if (fgets(line, sizeof(line), it->mailf) == NULL) + break; + if (line[0] == '\n') + break; + if (fwrite(line, strlen(line), 1, bounceq.mailf) != 1) + goto fail; + } + } + + if (linkspool(&bounceq) != 0) + goto fail; + /* bounce is safe */ + + delqueue(it); + + run_queue(&bounceq); + /* NOTREACHED */ + +fail: + syslog(LOG_CRIT, "error creating bounce: %m"); + delqueue(it); + exit(EX_IOERR); +} + +struct parse_state { + char addr[1000]; + int pos; + + enum { + NONE = 0, + START, + MAIN, + EOL, + QUIT + } state; + int comment; + int quote; + int brackets; + int esc; +}; + +/* + * Simplified RFC2822 header/address parsing. + * We copy escapes and quoted strings directly, since + * we have to pass them like this to the mail server anyways. + * XXX local addresses will need treatment + */ +static int +parse_addrs(struct parse_state *ps, char *s, struct queue *queue) +{ + char *addr; + +again: + switch (ps->state) { + case NONE: + return (-1); + + case START: + /* init our data */ + bzero(ps, sizeof(*ps)); + + /* skip over header name */ + while (*s != ':') + s++; + s++; + ps->state = MAIN; + break; + + case MAIN: + /* all fine */ + break; + + case EOL: + switch (*s) { + case ' ': + case '\t': - s++; - /* continue */ ++ ps->state = MAIN; + break; + + default: + ps->state = QUIT; + if (ps->pos != 0) + goto newaddr; + return (0); + } ++ break; + + case QUIT: + return (0); + } + + for (; *s != 0; s++) { + if (ps->esc) { + ps->esc = 0; + + switch (*s) { + case '\r': + case '\n': + goto err; + + default: + goto copy; + } + } + + if (ps->quote) { + switch (*s) { + case '"': + ps->quote = 0; + goto copy; + + case '\\': + ps->esc = 1; + goto copy; + + case '\r': + case '\n': + goto eol; + + default: + goto copy; + } + } + + switch (*s) { + case '(': + ps->comment++; + break; + + case ')': + if (ps->comment) + ps->comment--; + else + goto err; + goto skip; + + case '"': + ps->quote = 1; + goto copy; + + case '\\': + ps->esc = 1; + goto copy; + + case '\r': + case '\n': + goto eol; + } + + if (ps->comment) + goto skip; + + switch (*s) { + case ' ': + case '\t': + /* ignore whitespace */ + goto skip; + + case '<': + /* this is the real address now */ + ps->brackets = 1; + ps->pos = 0; + goto skip; + + case '>': + if (!ps->brackets) + goto err; + ps->brackets = 0; + + s++; + goto newaddr; + + case ':': + /* group - ignore */ + ps->pos = 0; + goto skip; + + case ',': + case ';': + /* + * Next address, copy previous one. + * However, we might be directly after + * a
, or have two consecutive + * commas. + * Skip the comma unless there is + * really something to copy. + */ + if (ps->pos == 0) + goto skip; + s++; + goto newaddr; + + default: + goto copy; + } + +copy: + if (ps->comment) + goto skip; + + if (ps->pos + 1 == sizeof(ps->addr)) + goto err; + ps->addr[ps->pos++] = *s; + +skip: + ; + } + +eol: + ps->state = EOL; + return (0); + +err: + ps->state = QUIT; + return (-1); + +newaddr: + ps->addr[ps->pos] = 0; + ps->pos = 0; + addr = strdup(ps->addr); + if (addr == NULL) + errlog(EX_SOFTWARE, "strdup"); + + if (add_recp(queue, addr, EXPAND_WILDCARD) != 0) + errlogx(EX_DATAERR, "invalid recipient `%s'", addr); + + goto again; +} + +static int +writeline(struct queue *queue, const char *line, ssize_t linelen) +{ + ssize_t len; + + while (linelen > 0) { + len = linelen; + if (linelen > MAX_LINE_RFC822) { + len = MAX_LINE_RFC822 - 10; + } + + if (fwrite(line, len, 1, queue->mailf) != 1) + return (-1); + + if (linelen <= MAX_LINE_RFC822) + break; + + if (fwrite("\n", 1, 1, queue->mailf) != 1) + return (-1); + + line += MAX_LINE_RFC822 - 10; + linelen = strlen(line); + } + return (0); +} + +int +readmail(struct queue *queue, int nodot, int recp_from_header) +{ + struct parse_state parse_state; + char *line = NULL; + ssize_t linelen; + size_t linecap = 0; + char newline[MAX_LINE_RFC822]; + size_t error; + int had_headers = 0; + int had_from = 0; + int had_messagid = 0; + int had_date = 0; ++ int had_first_line = 0; ++ int had_last_line = 0; + int nocopy = 0; + int ret = -1; + + parse_state.state = NONE; + + error = fprintf(queue->mailf, + "Received: from %s (uid %d)\n" + "\t(envelope-from %s)\n" + "\tid %s\n" - "\tby %s (%s);\n" ++ "\tby %s (%s on %s);\n" + "\t%s\n", + username, useruid, + queue->sender, + queue->id, - hostname(), VERSION, ++ hostname(), VERSION, systemhostname(), + rfc822date()); + if ((ssize_t)error < 0) + return (-1); + + while (!feof(stdin)) { + newline[0] = '\0'; + if ((linelen = getline(&line, &linecap, stdin)) <= 0) + break; - ++ if (had_last_line) ++ errlogx(EX_DATAERR, "bad mail input format:" ++ " from %s (uid %d) (envelope-from %s)", ++ username, useruid, queue->sender); ++ linelen = strlen(line); ++ if (linelen == 0 || line[linelen - 1] != '\n') { ++ /* ++ * This line did not end with a newline character. ++ * If we fix it, it better be the last line of ++ * the file. ++ */ ++ line[linelen] = '\n'; ++ line[linelen + 1] = 0; ++ had_last_line = 1; ++ } ++ if (!had_first_line) { ++ /* ++ * Ignore a leading RFC-976 From_ or >From_ line mistakenly ++ * inserted by some programs. ++ */ ++ if (strprefixcmp(line, "From ") == 0 || strprefixcmp(line, ">From ") == 0) ++ continue; ++ had_first_line = 1; ++ } + if (!had_headers) { + if (linelen > MAX_LINE_RFC822) { + /* XXX also split headers */ + errlogx(EX_DATAERR, "bad mail input format:" + " from %s (uid %d) (envelope-from %s)", + username, useruid, queue->sender); + } + /* + * Unless this is a continuation, switch of + * the Bcc: nocopy flag. + */ + if (!(line[0] == ' ' || line[0] == '\t')) + nocopy = 0; + + if (strprefixcmp(line, "Date:") == 0) + had_date = 1; + else if (strprefixcmp(line, "Message-Id:") == 0) + had_messagid = 1; + else if (strprefixcmp(line, "From:") == 0) + had_from = 1; + else if (strprefixcmp(line, "Bcc:") == 0) + nocopy = 1; + + if (parse_state.state != NONE) { + if (parse_addrs(&parse_state, line, queue) < 0) { + errlogx(EX_DATAERR, "invalid address in header\n"); + /* NOTREACHED */ + } + } + + if (recp_from_header && ( + strprefixcmp(line, "To:") == 0 || + strprefixcmp(line, "Cc:") == 0 || + strprefixcmp(line, "Bcc:") == 0)) { + parse_state.state = START; + if (parse_addrs(&parse_state, line, queue) < 0) { + errlogx(EX_DATAERR, "invalid address in header\n"); + /* NOTREACHED */ + } + } + } + + if (strcmp(line, "\n") == 0 && !had_headers) { + had_headers = 1; + while (!had_date || !had_messagid || !had_from) { + if (!had_date) { + had_date = 1; + snprintf(newline, sizeof(newline), "Date: %s\n", rfc822date()); + } else if (!had_messagid) { + /* XXX msgid, assign earlier and log? */ + had_messagid = 1; + snprintf(newline, sizeof(newline), "Message-Id: <%"PRIxMAX".%s.%"PRIxMAX"@%s>\n", + (uintmax_t)time(NULL), + queue->id, + (uintmax_t)random(), + hostname()); + } else if (!had_from) { + had_from = 1; + snprintf(newline, sizeof(newline), "From: <%s>\n", queue->sender); + } + if (fwrite(newline, strlen(newline), 1, queue->mailf) != 1) + goto fail; + } + strlcpy(newline, "\n", sizeof(newline)); + } + if (!nodot && linelen == 2 && line[0] == '.') + break; + if (!nocopy) { + if (newline[0]) { + if (fwrite(newline, strlen(newline), 1, queue->mailf) != 1) + goto fail; + } else { + if (writeline(queue, line, linelen) != 0) + goto fail; + } + } + } + + ret = 0; +fail: + free(line); + return (ret); *** 1 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Sep 22 09:12:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4853D6AF015; Wed, 22 Sep 2021 09:12: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 4HDsxn1fh0z4gtn; Wed, 22 Sep 2021 09:12: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 1847F1512D; Wed, 22 Sep 2021 09:12: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 18M9CDdK004307; Wed, 22 Sep 2021 09:12:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18M9CD32004306; Wed, 22 Sep 2021 09:12:13 GMT (envelope-from git) Date: Wed, 22 Sep 2021 09:12:13 GMT Message-Id: <202109220912.18M9CD32004306@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: c96da1994587 - main - dma: make the version exposed reflect the new version MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c96da19945877319c36731391a9c067c48539194 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 09:12:13 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=c96da19945877319c36731391a9c067c48539194 commit c96da19945877319c36731391a9c067c48539194 Author: Baptiste Daroussin AuthorDate: 2021-09-22 09:12:04 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 09:12:04 +0000 dma: make the version exposed reflect the new version --- libexec/dma/Makefile.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/dma/Makefile.inc b/libexec/dma/Makefile.inc index 8e88f832ee99..5e953921259d 100644 --- a/libexec/dma/Makefile.inc +++ b/libexec/dma/Makefile.inc @@ -7,7 +7,7 @@ DMA_SOURCES= ${SRCTOP}/contrib/dma CFLAGS+= -I${DMA_SOURCES} \ -DHAVE_REALLOCF -DHAVE_STRLCPY -DHAVE_GETPROGNAME \ -DCONF_PATH='"/etc/dma"' \ - -DLIBEXEC_PATH='"/usr/libexec"' -DDMA_VERSION='"v0.11+"' \ + -DLIBEXEC_PATH='"/usr/libexec"' -DDMA_VERSION='"v0.13+"' \ -DDMA_ROOT_USER='"mailnull"' \ -DDMA_GROUP='"mail"' BINGRP= mail From owner-dev-commits-src-all@freebsd.org Wed Sep 22 10:02:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D81DC6AF1B0; Wed, 22 Sep 2021 10:02: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 4HDv3F5cSMz4pfy; Wed, 22 Sep 2021 10:02: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 A060E157ED; Wed, 22 Sep 2021 10:02: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 18MA21BA068792; Wed, 22 Sep 2021 10:02:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MA21Gs068791; Wed, 22 Sep 2021 10:02:01 GMT (envelope-from git) Date: Wed, 22 Sep 2021 10:02:01 GMT Message-Id: <202109221002.18MA21Gs068791@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: cae17ea3688a - stable/13 - ports.7: catchup with the package extension name since pkg 1.17 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cae17ea3688ad47271cc2dd1af03100f006ee647 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 10:02:01 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=cae17ea3688ad47271cc2dd1af03100f006ee647 commit cae17ea3688ad47271cc2dd1af03100f006ee647 Author: Baptiste Daroussin AuthorDate: 2021-07-22 08:49:45 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 09:53:04 +0000 ports.7: catchup with the package extension name since pkg 1.17 (cherry picked from commit d6ed0d3d310633ecf9294bc332e93f2766b24ded) --- share/man/man7/ports.7 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man7/ports.7 b/share/man/man7/ports.7 index 797fed0d3ec6..771d2ea239a5 100644 --- a/share/man/man7/ports.7 +++ b/share/man/man7/ports.7 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 17, 2021 +.Dd July 22, 2021 .Dt PORTS 7 .Os .Sh NAME @@ -284,7 +284,7 @@ from the system. Make a binary package for the port. The port will be installed if it has not already been. The package is a -.Pa .tbz +.Pa .pkg file that you can use to install the port on other machines with .Xr pkg-add 8 . From owner-dev-commits-src-all@freebsd.org Wed Sep 22 10:02:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 031666AF49F; Wed, 22 Sep 2021 10:02: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 4HDv3G6YrFz4q2Z; Wed, 22 Sep 2021 10:02: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 BF8921595D; Wed, 22 Sep 2021 10:02: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 18MA22ch069404; Wed, 22 Sep 2021 10:02:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MA22G2069393; Wed, 22 Sep 2021 10:02:02 GMT (envelope-from git) Date: Wed, 22 Sep 2021 10:02:02 GMT Message-Id: <202109221002.18MA22G2069393@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 037c2f4fe3d0 - stable/13 - libfetch: use more portable getline() interface MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 037c2f4fe3d0198d5794ed10f6f4086355b8f20c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 10:02:03 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=037c2f4fe3d0198d5794ed10f6f4086355b8f20c commit 037c2f4fe3d0198d5794ed10f6f4086355b8f20c Author: Daniel Kolesa AuthorDate: 2021-08-17 14:01:46 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 09:57:35 +0000 libfetch: use more portable getline() interface this is for better portability in order to avoid using a function which is BSD-only or available via libbsd (cherry picked from commit ee3ca711a898cf41330c320826ea1e0e6e451f1d) (cherry picked from commit 635eb7ac7990a2bb29e1992b739617a9db012bf2) --- lib/libfetch/http.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index e61e23b1425a..bcb089dc0fc4 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -1526,12 +1526,13 @@ http_get_proxy(struct url * url, const char *flags) static void http_print_html(FILE *out, FILE *in) { - size_t len; - char *line, *p, *q; + ssize_t len = 0; + size_t cap; + char *line = NULL, *p, *q; int comment, tag; comment = tag = 0; - while ((line = fgetln(in, &len)) != NULL) { + while ((len = getline(&line, &cap, in)) >= 0) { while (len && isspace((unsigned char)line[len - 1])) --len; for (p = q = line; q < line + len; ++q) { @@ -1559,6 +1560,8 @@ http_print_html(FILE *out, FILE *in) fwrite(p, q - p, 1, out); fputc('\n', out); } + + free(line); } From owner-dev-commits-src-all@freebsd.org Wed Sep 22 10:06:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB9776AF8B5; Wed, 22 Sep 2021 10:06: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 4HDv8J4ktmz4q9P; Wed, 22 Sep 2021 10:06:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E0D615969; Wed, 22 Sep 2021 10:06: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 18MA6OPx073819; Wed, 22 Sep 2021 10:06:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MA6OKT073817; Wed, 22 Sep 2021 10:06:24 GMT (envelope-from git) Date: Wed, 22 Sep 2021 10:06:24 GMT Message-Id: <202109221006.18MA6OKT073817@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 869e821404ae - stable/13 - pci_vendors: update to 2021.09.19 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 869e821404ae986ad311a5c5439504224ff378ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 10:06:24 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=869e821404ae986ad311a5c5439504224ff378ea commit 869e821404ae986ad311a5c5439504224ff378ea Author: Baptiste Daroussin AuthorDate: 2021-07-27 16:56:39 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 10:05:56 +0000 pci_vendors: update to 2021.09.19 (cherry picked from commit 00582fa66051cbdf263a6ce0f10c64ea17a0e9a8) (cherry picked from commit dcd882f30236fdac6ce7f42129462d72a64daf0c) --- share/misc/pci_vendors | 577 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 537 insertions(+), 40 deletions(-) diff --git a/share/misc/pci_vendors b/share/misc/pci_vendors index 9deb7293e596..79866ff1cd29 100644 --- a/share/misc/pci_vendors +++ b/share/misc/pci_vendors @@ -1,8 +1,8 @@ # # List of PCI ID's # -# Version: 2021.05.04 -# Date: 2021-05-04 03:15:01 +# Version: 2021.09.19 +# Date: 2021-09-19 03:15:02 # # Maintained by Albert Pool, Martin Mares, and other volunteers from # the PCI ID Project at https://pci-ids.ucw.cz/. @@ -683,6 +683,32 @@ 1bd4 0026 12G SAS3008IT RACK 1bd4 0027 12G SAS3008IMR RACK 1bd4 0028 12G SAS3008IR RACK + 00a5 Fusion-MPT 24GSAS/PCIe SAS40xx + 1000 4600 MegaRAID 9670W-16i Tri-Mode Storage Adapter + 1000 4610 MegaRAID 9670-24i Tri-Mode Storage Adapter + 1000 4620 MegaRAID 9660-16i Tri-Mode Storage Adapter + 1000 4630 MegaRAID 9660-8i8e Tri-Mode Storage Adapter + 1000 4640 eHBA 9600W-16i Tri-Mode Storage Adapter + 1000 4650 eHBA 9600W-16e Tri-Mode Storage Adapter + 1000 4660 eHBA 9600-24i Tri-Mode Storage Adapter + 1000 4670 eHBA 9600-16i Tri-Mode Storage Adapter + 1000 4680 eHBA 9600-16e Tri-Mode Storage Adapter + 1000 4690 MegaRAID 9620-16i Tri-Mode Storage Adapter + 1000 46a0 MegaRAID 9660-24i Tri-Mode Storage Adapter + 1000 46c0 eHBA 9680W-16e Tri-Mode Storage Adapter + 1000 46d0 eHBA 9600-8i8e Tri-Mode Storage Adapter + 1028 2114 PERC H965 Adapter + 1028 2115 PERC H965 Front + 1028 2117 PERC H965 MX + 1028 213a PERC H965e Adapter + 1028 213b PERC H765 Adapter + 1028 213c PERC H765 Front + 1028 213d PERC H765N Front + 1028 213e PERC H765 MX + 1028 213f PERC H365 Adapter + 1028 2140 PERC H365 Front + 1028 2141 PERC H360 MX + 1028 2142 HBA 465e Adapter 00ab SAS3516 Fusion-MPT Tri-Mode RAID On Chip (ROC) # 8 Internal and 8 External port channel 9400 HBA 1000 3040 HBA 9400-8i8e @@ -715,12 +741,18 @@ 00c2 SAS3324 PCI-Express Fusion-MPT SAS-3 00c3 SAS3324 PCI-Express Fusion-MPT SAS-3 00c4 SAS3224 PCI-Express Fusion-MPT SAS-3 +# SAS 9305 16 internal port HBA + 1000 3190 SAS9305-16i +# SAS 9305 24 internal port HBA + 1000 31a0 SAS9305-24i 1170 0002 SAS3224 PCI Express to 12Gb HBA MEZZ CARD 00c5 SAS3316 PCI-Express Fusion-MPT SAS-3 00c6 SAS3316 PCI-Express Fusion-MPT SAS-3 00c7 SAS3316 PCI-Express Fusion-MPT SAS-3 00c8 SAS3316 PCI-Express Fusion-MPT SAS-3 00c9 SAS3216 PCI-Express Fusion-MPT SAS-3 +# 9305 16 external port SAS HBA + 1000 3180 SAS9305-16e 00ce MegaRAID SAS-3 3316 [Intruder] 1000 9371 MegaRAID SAS 9361-16i 1000 9390 MegaRAID SAS 9380-8i8e @@ -771,8 +803,14 @@ 1028 200c HBA355i Front 1028 200d HBA355e Adapter 1028 200e HBA350i MX + 1028 2175 HBA350i Adapter 1d49 0205 ThinkSystem 440-16i SAS/SATA PCIe Gen4 12Gb Internal HBA 1d49 0206 ThinkSystem 440-16e SAS/SATA PCIe Gen4 12Gb HBA + 1d49 0207 ThinkSystem 440-8i SAS/SATA PCIe Gen4 12Gb HBA + 1d49 0208 ThinkSystem 440-16i SAS/SATA PCIe Gen4 12Gb HBA + 1d49 0209 ThinkSystem 440-8e SAS/SATA PCIe Gen4 12Gb HBA + 8086 4050 Storage Controller RS3P4QF160F + 8086 4070 Storage Controller RS3P4GF016F 00e7 Fusion-MPT 12GSAS/PCIe Unsupported SAS38xx # Tampered part 1028 200b HBA355i Adapter Tampered @@ -886,12 +924,17 @@ 1028 1ae1 PERC H755 Front 1028 1ae2 PERC H755N Front 1028 1ae3 PERC H755 MX + 1028 2171 PERC H750 Mini + 1028 2176 PERC H750 Adapter 1d49 060a ThinkSystem RAID 940-8i 4GB Flash PCIe Gen4 12Gb Adapter 1d49 060b ThinkSystem RAID 940-8i 8GB Flash PCIe Gen4 12Gb Adapter 1d49 060c ThinkSystem RAID 940-16i 8GB Flash PCIe Gen4 12Gb Adapter 1d49 060d ThinkSystem RAID 940-16i 8GB Flash PCIe Gen4 12Gb Internal Adapter 1d49 060e ThinkSystem RAID 940-32i 8GB Flash PCIe Gen4 12Gb Adapter 1d49 060f ThinkSystem RAID 940-8e 4GB Flash PCIe Gen4 12Gb Adapter + 1d49 0610 ThinkSystem RAID 940-16i 4GB Flash PCIe Gen4 12Gb Adapter + 8086 4000 RAID Controller RS3P4TF160F + 8086 4020 RAID Controller RS3P4MF088F 10e3 MegaRAID 12GSAS/PCIe Unsupported SAS39xx 1028 1ae0 PERC H755 Adapter - Tampered Device 1028 1ae1 PERC H755 Front - Tampered Device @@ -900,6 +943,12 @@ 10e4 MegaRAID 12GSAS/PCIe Unsupported SAS38xx 10e5 MegaRAID 12GSAS/PCIe SAS38xx 10e6 MegaRAID 12GSAS/PCIe Secure SAS38xx + 1028 2172 PERC H355 Adapter + 1028 2173 PERC H355 Front + 1028 2174 PERC H350 Mini + 1028 2177 PERC H350 Adapter + 1d49 0505 ThinkSystem RAID 540-8i PCIe Gen4 12Gb Adapter + 1d49 0506 ThinkSystem RAID 540-16i PCIe Gen4 12Gb Adapter 10e7 MegaRAID 12GSAS/PCIe Unsupported SAS38xx 1960 MegaRAID 1000 0518 MegaRAID 518 SCSI 320-2 Controller @@ -959,6 +1008,7 @@ 131c Kaveri [Radeon R7 Graphics] 131d Kaveri [Radeon R6 Graphics] 13e9 Ariel + 13fe Cyan Skillfish 1478 Navi 10 XL Upstream Port of PCI Express Switch 1479 Navi 10 XL Downstream Port of PCI Express Switch 154c Kryptos [Radeon RX 350] @@ -985,13 +1035,16 @@ 15df Raven/Raven2/Fenghuang/Renoir Cryptographic Coprocessor 103c 8615 Pavilion Laptop 15-cw1xxx ea50 ce19 mCOM10-L1900 + 15e7 Barcelo 15ff Fenghuang [Zhongshan Subor Z+] 1607 Arden 1636 Renoir + 1637 Renoir Radeon High Definition Audio Controller 1638 Cezanne 163f VanGogh 164c Lucienne 164d Rembrandt + 1681 Rembrandt 1714 BeaverCreek HDMI Audio [Radeon HD 6500D and 6400G-6600G series] 103c 168b ProBook 4535s 3150 RV380/M24 [Mobility Radeon X600] @@ -3474,6 +3527,7 @@ 174b e308 Radeon R9 380X Nitro 4G D5 17af 2006 Radeon R9 380X 6939 Tonga PRO [Radeon R9 285/380] + 1462 2015 Radeon R9 380 Gaming 4G 148c 9380 Radeon R9 380 # Make naming scheme consistent 174b e308 Radeon R9 380 Nitro 4G D5 @@ -3487,6 +3541,7 @@ 6985 Lexa XT [Radeon PRO WX 3100] 6986 Polaris12 6987 Lexa [Radeon 540X/550X/630 / RX 640 / E9171 MCM] + 698f Lexa XT [Radeon PRO WX 3100 / Barco MXRT 4700] 6995 Lexa XT [Radeon PRO WX 2100] 699f Lexa PRO [Radeon 540/540X/550/550X / RX 540X/550/550X] 1028 1720 Radeon RX 550X @@ -3645,6 +3700,7 @@ 7312 Navi 10 [Radeon Pro W5700] 7314 Navi 10 USB 731f Navi 10 [Radeon RX 5600 OEM/5600 XT / 5700/5700 XT] + 1002 0b36 Reference RX 5700 XT 1458 2313 Radeon RX 5700 XT Gaming OC 1682 5701 RX 5700 XT RAW II 1849 5120 Radeon RX 5600 XT @@ -3658,17 +3714,25 @@ 7388 Arcturus GL-XL 738c Arcturus GL-XL [AMD Instinct MI100] 738e Arcturus GL-XL + 73a2 Navi 21 Pro-XTA [Radeon Pro W6900X] + 73a3 Navi 21 GL-XL [Radeon PRO W6800] 73a4 Navi 21 USB + 73ab Navi 21 Pro-XLA [Radeon Pro W6800X/Radeon Pro W6800X Duo] 73af Navi 21 [Radeon RX 6900 XT] 73bf Navi 21 [Radeon RX 6800/6800 XT / 6900 XT] + 1002 0e3a Radeon RX 6900 XT 1eae 6701 XFX Speedster MERC 319 AMD Radeon RX 6800 XT Black 73c3 Navi 22 73c4 Navi 22 USB 73df Navi 22 [Radeon RX 6700/6700 XT / 6800M] 73e0 Navi 23 - 73e1 Navi 23 + 73e1 Navi 23 WKS-XM [Radeon PRO W6600M] + 73e3 Navi 23 WKS-XL [Radeon PRO W6600] 73e4 Navi 23 USB 73ff Navi 23 [Radeon RX 6600/6600 XT/6600M] + 7408 Aldebaran + 740c Aldebaran + 740f Aldebaran 7833 RS350 Host Bridge 7834 RS350 [Radeon 9100 PRO/XT IGP] 7835 RS350M [Mobility Radeon 9000 IGP] @@ -3828,7 +3892,7 @@ 17aa 21bb Mobility Radeon HD 545v 9555 RV710/M92 [Mobility Radeon HD 4350/4550] 103c 1411 ProBook 4720s GPU (Mobility Radeon HD 4350) - 9557 RV711 GL [FirePro RG220] + 9557 RV711/M93 GL [FirePro RG220] 955f RV710/M92 [Mobility Radeon HD 4330] 9580 RV630 [Radeon HD 2600 PRO] 9581 RV630/M76 [Mobility Radeon HD 2600] @@ -4832,12 +4896,14 @@ 15d0 Raven/Raven2 Root Complex 103c 8615 Pavilion Laptop 15-cw1xxx 1043 876b PRIME B450M-A Motherboard + ea50 ce19 mCOM10-L1900 15d1 Raven/Raven2 IOMMU 103c 8615 Pavilion Laptop 15-cw1xxx 1043 876b PRIME B450M-A Motherboard ea50 ce19 mCOM10-L1900 15d2 Raven/Raven2 PCIe Dummy Host Bridge 15d3 Raven/Raven2 PCIe GPP Bridge [6:0] + ea50 ce19 mCOM10-L1900 15d4 FireFlight USB 3.1 15d5 FireFlight USB 3.1 15da Raven/Raven2 PCIe Dummy Host Bridge @@ -4862,14 +4928,17 @@ ea50 ce19 mCOM10-L1900 15e2 Raven/Raven2/FireFlight/Renoir Audio Processor 17aa 5124 ThinkPad E595 + ea50 ce19 mCOM10-L1900 15e3 Family 17h (Models 10h-1fh) HD Audio Controller 103c 8615 Pavilion Laptop 15-cw1xxx 1043 86c7 PRIME B450M-A Motherboard 17aa 5124 ThinkPad E595 15e4 Raven/Raven2/Renoir Sensor Fusion Hub 15e5 Raven2 USB 3.1 + ea50 ce19 mCOM10-L1900 15e6 Raven/Raven2/Renoir Non-Sensor Fusion Hub KMDF driver 1022 15e4 Raven/Raven2/Renoir Sensor Fusion Hub + ea50 ce19 mCOM10-L1900 15e8 Raven/Raven2 Device 24: Function 0 15e9 Raven/Raven2 Device 24: Function 1 15ea Raven/Raven2 Device 24: Function 2 @@ -4921,14 +4990,19 @@ 1629 Arden PCIe GPP Bridge 162a Arden Internal PCIe GPP Bridge 0 to bus X 162b Arden PCIe Non-Transparent Bridge - 1630 Renoir Root Complex - 1631 Renoir IOMMU + 1630 Renoir/Cezanne Root Complex + 1631 Renoir/Cezanne IOMMU 1632 Renoir PCIe Dummy Host Bridge 1633 Renoir PCIe GPP Bridge - 1634 Renoir PCIe GPP Bridge + 1634 Renoir/Cezanne PCIe GPP Bridge 1635 Renoir Internal PCIe GPP Bridge to Bus 1637 Renoir HD Audio Controller - 1639 Renoir USB 3.1 + 1639 Renoir/Cezanne USB 3.1 + 163a VanGogh USB0 + 163b VanGogh USB1 + 163c VanGogh SecUSB + 163d VanGogh SecureFunction + 163e VanGogh HSP 1641 Renoir 10GbE Controller Port 0 (XGBE0/1) 1642 Renoir WLAN 1643 Renoir BT @@ -5827,7 +5901,7 @@ 0325 315PRO PCI/AGP VGA Display Adapter 0330 330 [Xabre] PCI/AGP VGA Display Adapter 0406 85C501/2 - 0496 85C496 + 0496 SiS85C496 PCI & CPU Memory Controller (PCM) 0530 530 Host 0540 540 Host 0550 550 Host @@ -8646,13 +8720,18 @@ 8717 PEX 8717 16-lane, 8-Port PCI Express Gen 3 (8.0 GT/s) Switch with DMA 8718 PEX 8718 16-Lane, 5-Port PCI Express Gen 3 (8.0 GT/s) Switch 8724 PEX 8724 24-Lane, 6-Port PCI Express Gen 3 (8 GT/s) Switch, 19 x 19mm FCBGA + 8725 PEX 8725 24-Lane, 10-Port PCI Express Gen 3 (8.0 GT/s) Multi-Root Switch with DMA 8732 PEX 8732 32-lane, 8-Port PCI Express Gen 3 (8.0 GT/s) Switch 8734 PEX 8734 32-lane, 8-Port PCI Express Gen 3 (8.0GT/s) Switch 8747 PEX 8747 48-Lane, 5-Port PCI Express Gen 3 (8.0 GT/s) Switch 8748 PEX 8748 48-Lane, 12-Port PCI Express Gen 3 (8 GT/s) Switch, 27 x 27mm FCBGA -# This is the Non-Transparent-Bridge Virtualized Port as presented by the PLX PEX 8732 chip, the physical bridges show up at 10b5:8732 - 87b0 PEX 8732 32-lane, 8-Port PCI Express Gen 3 (8.0 GT/s) Switch + 8749 PEX 8749 48-Lane, 18-Port PCI Express Gen 3 (8.0 GT/s) Multi-Root Switch with DMA + 87a0 PEX PCI Express Switch NT0 Port Link Interface + 87a1 PEX PCI Express Switch NT1 Port Link Interface + 87b0 PEX PCI Express Switch NT0 Port Virtual Interface 1093 7761 PXIe-8830mc + 87b1 PEX PCI Express Switch NT1 Port Virtual Interface + 87d0 PEX PCI Express Switch DMA interface 9016 PLX 9016 8-port serial controller 9030 PCI9030 32-bit 33MHz PCI <-> IOBus Bridge 10b5 2695 Hilscher CIF50-PB/DPS Profibus @@ -8999,7 +9078,7 @@ 1449 M1449 1451 M1451 1461 M1461 - 1489 M1489 + 1489 M1489 Cache-Memory PCI Controller (CMP) [FinALi 486] CPU to PCI bridge 1511 M1511 [Aladdin] 1512 M1512 [Aladdin] 1513 M1513 [Aladdin] @@ -11993,6 +12072,10 @@ 10de 1141 VCA 6000 17f1 GM200GL [Quadro M6000 24GB] 17fd GM200GL [Tesla M40] + 1ad0 Tegra PCIe x8 Endpoint + 1ad1 Tegra PCIe x4/x8 Endpoint/Root Complex + 1ad2 Tegra PCIe x1 Root Complex + 1ad3 Xavier SATA Controller 1ad6 TU102 USB 3.1 Host Controller 1ad7 TU102 USB Type-C UCSI Controller 1ad8 TU104 USB 3.1 Host Controller @@ -12142,7 +12225,7 @@ 1e04 TU102 [GeForce RTX 2080 Ti] 1e07 TU102 [GeForce RTX 2080 Ti Rev. A] 1462 3715 RTX 2080 Ti GAMING X TRIO - 1e09 CMP 50HX + 1e09 TU102 [CMP 50HX] 1e2d TU102 [GeForce RTX 2080 Ti Engineering Sample] 1e2e TU102 [GeForce RTX 2080 Ti 12GB Engineering Sample] 1e30 TU102GL [Quadro RTX 6000/8000] @@ -12172,6 +12255,7 @@ 1eae TU104M 1eb0 TU104GL [Quadro RTX 5000] 1eb1 TU104GL [Quadro RTX 4000] + 1eb4 TU104GL [T4G] 1eb5 TU104GLM [Quadro RTX 5000 Mobile / Max-Q] 1eb6 TU104GLM [Quadro RTX 4000 Mobile / Max-Q] 1eb8 TU104GL [Tesla T4] @@ -12220,10 +12304,11 @@ 1f9d TU117M [GeForce GTX 1650 Mobile / Max-Q] 1fae TU117GL 1fb0 TU117GLM [Quadro T1000 Mobile] - 1fb1 TU117GLM [Quadro T600 Mobile] + 1fb1 TU117GL [T600] 1fb2 TU117GLM [Quadro T400 Mobile] 1fb8 TU117GLM [Quadro T2000 Mobile / Max-Q] 1fb9 TU117GLM [Quadro T1000 Mobile] + 1fba TU117GLM [T600 Mobile] 1fbb TU117GLM [Quadro T500 Mobile] 1fbf TU117GL 1fd9 TU117BM [GeForce GTX 1650 Mobile Refresh] @@ -12232,10 +12317,13 @@ 20b0 GA100 [A100 SXM4 40GB] 20b1 GA100 [A100 PCIe 40GB] 20b2 GA100 [A100 SXM4 80GB] + 20b5 GA100 [A100 PCIe 80GB] 20b6 GA100GL [PG506-232] 20b7 GA100GL [A30 PCIe] + 20bb GA100 [DRIVE A100 PROD] 20be GA100 [GRID A100A] 20bf GA100 [GRID A100B] + 20c2 GA100 [CMP 170HX] 20f1 GA100 [A100 PCIe 40GB] 2182 TU116 [GeForce GTX 1660 Ti] 2183 TU116 @@ -12252,13 +12340,14 @@ 21d1 TU116BM [GeForce GTX 1660 Ti Mobile] 2200 GA102 2204 GA102 [GeForce RTX 3090] - 2205 GA102 [GeForce RTX 3080 20GB] + 2205 GA102 [GeForce RTX 3080 Ti 20GB] 2206 GA102 [GeForce RTX 3080] 10de 1467 GA102 [GeForce RTX 3080] 10de 146d GA102 [GeForce RTX 3080 20GB] 1462 3892 RTX 3080 10GB GAMING X TRIO 2208 GA102 [GeForce RTX 3080 Ti] - 220d GA102 + 220d GA102 [CMP 90HX] + 2216 GA102 [GeForce RTX 3080 Lite Hash Rate] 222b GA102 [GeForce RTX 3090 Engineering Sample] 222f GA102 [GeForce RTX 3080 11GB / 12GB Engineering Sample] 2230 GA102GL [RTX A6000] @@ -12268,6 +12357,7 @@ 2237 GA102GL [A10G] 223f GA102GL 228b GA104 High Definition Audio Controller + 2296 Tegra PCIe Endpoint Virtual Network 2302 GA103 2321 GA103 2482 GA104 [GeForce RTX 3070 Ti] @@ -12276,6 +12366,10 @@ 10de 146b GA104 [GeForce RTX 3070] 10de 14ae GA104 [GeForce RTX 3070 16GB] 2486 GA104 [GeForce RTX 3060 Ti] + 2487 GA104 [GeForce RTX 3060] + 2488 GA104 [GeForce RTX 3070 Lite Hash Rate] + 2489 GA104 [GeForce RTX 3060 Ti Lite Hash Rate] + 248a GA104 [CMP 70HX] 249c GA104M [GeForce RTX 3080 Mobile / Max-Q 8GB/16GB] 249d GA104M [GeForce RTX 3070 Mobile / Max-Q] 249f GA104M @@ -12294,18 +12388,21 @@ 2504 GA106 [GeForce RTX 3060 Lite Hash Rate] 2505 GA106 2520 GA106M [GeForce RTX 3060 Mobile / Max-Q] + 2523 GA106M [GeForce RTX 3050 Ti Mobile / Max-Q] 252f GA106 [GeForce RTX 3060 Engineering Sample] 2560 GA106M [GeForce RTX 3060 Mobile / Max-Q] + 2563 GA106M [GeForce RTX 3050 Ti Mobile / Max-Q] 2583 GA107 [GeForce RTX 3050] 25a0 GA107M [GeForce RTX 3050 Ti Mobile] 25a2 GA107M [GeForce RTX 3050 Mobile] 25a4 GA107 - 25a5 GA107M + 25a5 GA107M [GeForce RTX 3050 Mobile] 25af GA107 [GeForce RTX 3050 Engineering Sample] 25b5 GA107GLM [RTX A4 Mobile] 25b8 GA107GLM [RTX A2000 Mobile] - 25e0 GA107BM - 25e2 GA107BM + 25e0 GA107BM [GeForce RTX 3050 Ti Mobile] + 25e2 GA107BM [GeForce RTX 3050 Mobile] + 25e5 GA107BM [GeForce RTX 3050 Mobile] 10df Emulex Corporation 0720 OneConnect NIC (Skyhawk) 103c 1934 FlexFabric 20Gb 2-port 650M Adapter @@ -12533,6 +12630,7 @@ 1028 06dc Latitude E7470 1028 06e4 XPS 15 9550 1028 06e6 Latitude 11 5175 2-in-1 + 1028 09be Latitude 7410 17aa 224f ThinkPad X1 Carbon 5th Gen 5260 RTS5260 PCI Express Card Reader 5286 RTS5286 PCI Express Card Reader @@ -12690,6 +12788,7 @@ ea50 ce19 mCOM10-L1900 816d RTL811x EHCI host controller ea50 ce19 mCOM10-L1900 + 816e Realtek RealManage BMC 8171 RTL8191SEvA Wireless LAN Controller 8172 RTL8191SEvB Wireless LAN Controller 8173 RTL8192SE Wireless LAN Controller @@ -12718,6 +12817,7 @@ 8812 RTL8812AE 802.11ac PCIe Wireless Network Adapter 8813 RTL8813AE 802.11ac PCIe Wireless Network Adapter 8821 RTL8821AE 802.11ac PCIe Wireless Network Adapter + 8852 RTL8852AE 802.11ax PCIe Wireless Network Adapter b723 RTL8723BE PCIe Wireless Network Adapter 10ec 8739 Dell Wireless 1801 17aa b736 Z50-75 @@ -14790,6 +14890,9 @@ 117c 00bc Celerity FC-321P 117c 00bd Celerity FC-322P 117c 00be Celerity FC-324P + 00c5 ExpressNVM PCIe Gen4 Switch + 117c 00c6 ExpressNVM S48F PCIe Gen4 + 117c 00c7 ExpressNVM S468 PCIe Gen4 00e6 ExpressSAS GT 12Gb/s SAS/SATA HBA 117c 00c0 ExpressSAS H1280 GT 117c 00c1 ExpressSAS H1208 GT @@ -15084,6 +15187,7 @@ # Nee Galileo Technology, Inc. 11ab Marvell Technology Group Ltd. 0100 88F3700 [Armada 3700 Family] ARM SoC + 0110 88F8040 PCI Express controller 0146 GT-64010/64010A System Controller 0f53 88E6318 Link Street network controller 11ab MV88SE614x SATA II PCI-E controller @@ -15632,7 +15736,12 @@ 8071 PM8071 Tachyon SPCve 12G eight-port SAS/SATA controller 8072 PM8072 Tachyon SPCv 12G 16-port SAS/SATA controller 8073 PM8073 Tachyon SPCve 12G 16-port SAS/SATA controller - 8531 PM8531 PFX 24xG3 Fanout PCIe Switches + 8531 PM8531 PFX 24xG3 PCIe Fanout Switch + 8532 PM8532 PFX 32xG3 PCIe Fanout Switch + 8533 PM8533 PFX 48xG3 PCIe Fanout Switch + 8534 PM8534 PFX 64xG3 PCIe Fanout Switch + 8535 PM8535 PFX 80xG3 PCIe Fanout Switch + 8536 PM8536 PFX 96xG3 PCIe Fanout Switch 8546 PM8546 B-FEIP PSX 96xG3 PCIe Storage Switch 8562 PM8562 Switchtec PFX-L 32xG3 Fanout-Lite PCIe Gen3 Switch 11f9 I-Cube Inc @@ -15640,7 +15749,8 @@ 11fb Datel Inc 11fc Silicon Magic 11fd High Street Consultants -11fe Pepperl+Fuchs Comtrol, Inc. +# nee Comtrol, Inc. +11fe Pepperl+Fuchs 0001 RocketPort PCI 32-port w/external I/F 0002 RocketPort PCI 8-port w/external I/F 0003 RocketPort PCI 16-port w/external I/F @@ -16135,7 +16245,7 @@ 1268 Tektronix 1269 Thomson-CSF/TTM # MBIM on top of MHI - 00b4 5G Data Card [Cinterion MV31-W] + 00b3 5G Data Card [Cinterion MV31-W] 126a Lexmark International, Inc. 126b Adax, Inc. 126c Northern Telecom @@ -17723,10 +17833,151 @@ 9513 OX16PCI954 (Quad 16950 UART) function 1 (parallel port) 9521 OX16PCI952 (Dual 16950 UART) 9523 OX16PCI952 Integrated Parallel Port - c158 OXPCIe952 Dual 16C950 UART +# Multifunction device with 3 function bits in ID + c000 OXPCIe840 Parallel Port + c004 OXPCIe840 Parallel Port + c006 OXPCIe840 GPIO +# Multifunction device with reset straps and function bits in ID + c100 OXPCIe952 Parallel Port + c101 OXPCIe952 Legacy 950 UART + c104 OXPCIe952 Parallel Port + c105 OXPCIe952 Legacy 950 UART + c106 OXPCIe952 GPIO + c108 OXPCIe952 Parallel Port + c109 OXPCIe952 Legacy 950 UART + c10c OXPCIe952 Parallel Port + c10d OXPCIe952 Legacy 950 UART + c10e OXPCIe952 GPIO + c110 OXPCIe952 Parallel Port + c114 OXPCIe952 Parallel Port + c118 OXPCIe952 Parallel Port + c11b OXPCIe952 Native 950 UART + c11c OXPCIe952 Parallel Port + c11e OXPCIe952 GPIO + c11f OXPCIe952 Native 950 UART + c120 OXPCIe952 Legacy 950 UART + c124 OXPCIe952 Legacy 950 UART + c126 OXPCIe952 GPIO + c128 OXPCIe952 Legacy 950 UART + c12c OXPCIe952 Legacy 950 UART + c12e OXPCIe952 GPIO + c134 OXPCIe952 GPIO + c138 OXPCIe952 Native 950 UART + c13c OXPCIe952 GPIO + c13d OXPCIe952 Native 950 UART + c140 OXPCIe952 Legacy 950 UART #1 + c141 OXPCIe952 Legacy 950 UART #2 + c144 OXPCIe952 Legacy 950 UART #1 + c145 OXPCIe952 Legacy 950 UART #2 + c146 OXPCIe952 GPIO + c148 OXPCIe952 Legacy 950 UART #1 + c149 OXPCIe952 Legacy 950 UART #2 + c14c OXPCIe952 Legacy 950 UART #1 + c14d OXPCIe952 Legacy 950 UART #2 + c14e OXPCIe952 GPIO + c154 OXPCIe952 GPIO + c158 OXPCIe952 Dual Native 950 UART e4bf c504 CP4-SCAT Wireless Technologies Carrier Board e4bf d551 DU1-MUSTANG Dual-Port RS-485 Interface - c308 EX-44016 16-port serial + c15c OXPCIe952 GPIO + c15d OXPCIe952 Dual Native 950 UART +# Multifunction device with 4 function bits in ID + c204 OXPCIe954 GPIO + c208 OXPCIe954 Quad Native 950 UART + c20c OXPCIe954 GPIO + c20d OXPCIe954 Quad Native 950 UART +# Multifunction device with 4 function bits in ID + c304 OXPCIe958 GPIO + c308 OXPCIe958 Quad Native 950 UART + c30c OXPCIe958 GPIO + c30d OXPCIe958 Quad Native 950 UART +# Multifunction device with 8 function bits in ID + c530 OXPCIe200 Dual OHCI USB Controller (ULPI/R-ULPI) + c531 OXPCIe200 Dual EHCI USB Controller (ULPI/R-ULPI) + c534 OXPCIe200 Dual OHCI USB Controller (ULPI/R-ULPI) + c535 OXPCIe200 Dual EHCI USB Controller (ULPI/R-ULPI) + c536 OXPCIe200 GPIO + c538 OXPCIe200 Dual OHCI USB Controller (ULPI/R-ULPI) + c539 OXPCIe200 Dual EHCI USB Controller (ULPI/R-ULPI) + c53b OXPCIe200 Native 950 UART + c53c OXPCIe200 Dual OHCI USB Controller (ULPI/R-ULPI) + c53d OXPCIe200 Dual EHCI USB Controller (ULPI/R-ULPI) + c53e OXPCIe200 GPIO + c53f OXPCIe200 Native 950 UART + c540 OXPCIe200 Dual OHCI USB Controller (R-ULPI) + c541 OXPCIe200 Dual EHCI USB Controller (R-ULPI) + c544 OXPCIe200 Dual OHCI USB Controller (R-ULPI) + c545 OXPCIe200 Dual EHCI USB Controller (R-ULPI) + c546 OXPCIe200 GPIO + c548 OXPCIe200 Dual OHCI USB Controller (R-ULPI) + c549 OXPCIe200 Dual EHCI USB Controller (R-ULPI) + c54b OXPCIe200 Native 950 UART + c54c OXPCIe200 Dual OHCI USB Controller (R-ULPI) + c54d OXPCIe200 Dual EHCI USB Controller (R-ULPI) + c54e OXPCIe200 Dual GPIO + c54f OXPCIe200 Native 950 UART + c560 OXPCIe200 Dual OHCI USB Controller (ULPI/analog) + c561 OXPCIe200 EHCI USB Controller (ULPI) + c564 OXPCIe200 Dual OHCI USB Controller (ULPI/analog) + c565 OXPCIe200 EHCI USB Controller (ULPI) + c566 OXPCIe200 GPIO + c568 OXPCIe200 Dual OHCI USB Controller (ULPI/analog) + c569 OXPCIe200 EHCI USB Controller (ULPI) + c56b OXPCIe200 Native 950 UART + c56c OXPCIe200 Dual OHCI USB Controller (ULPI/analog) + c56d OXPCIe200 EHCI USB Controller (ULPI) + c56e OXPCIe200 GPIO + c56f OXPCIe200 Native 950 UART + c570 OXPCIe200 Dual OHCI USB Controller (R-ULPI/analog) + c571 OXPCIe200 EHCI USB Controller (R-ULPI) + c574 OXPCIe200 Dual OHCI USB Controller (R-ULPI/analog) + c575 OXPCIe200 EHCI USB Controller (R-ULPI) + c576 OXPCIe200 GPIO + c578 OXPCIe200 Dual OHCI USB Controller (R-ULPI/analog) + c579 OXPCIe200 EHCI USB Controller (R-ULPI) + c57b OXPCIe200 Native 950 UART + c57c OXPCIe200 Dual OHCI USB Controller (R-ULPI/analog) + c57d OXPCIe200 EHCI USB Controller (R-ULPI) + c57e OXPCIe200 GPIO + c57f OXPCIe200 Native 950 UART + c5a0 OXPCIe200 OHCI USB Controller (ULPI) + c5a1 OXPCIe200 EHCI USB Controller (ULPI) + c5a2 OXPCIe200 Programmable Memory Interface + c5a4 OXPCIe200 OHCI USB Controller (ULPI) + c5a5 OXPCIe200 EHCI USB Controller (ULPI) + c5a6 OXPCIe200 Programmable Memory Interface & GPIO + c5a8 OXPCIe200 OHCI USB Controller (ULPI) + c5a9 OXPCIe200 EHCI USB Controller (ULPI) + c5aa OXPCIe200 Programmable Memory Interface + c5ab OXPCIe200 Native 950 UART + c5ac OXPCIe200 OHCI USB Controller (ULPI) + c5ad OXPCIe200 EHCI USB Controller (ULPI) + c5ae OXPCIe200 Programmable Memory Interface & GPIO + c5af OXPCIe200 Native 950 UART + c5b0 OXPCIe200 OHCI USB Controller (R-ULPI) + c5b1 OXPCIe200 EHCI USB Controller (R-ULPI) + c5b2 OXPCIe200 Programmable Memory Interface + c5b4 OXPCIe200 OHCI USB Controller (R-ULPI) + c5b5 OXPCIe200 EHCI USB Controller (R-ULPI) + c5b6 OXPCIe200 Programmable Memory Interface & GPIO + c5b8 OXPCIe200 OHCI USB Controller (R-ULPI) + c5b9 OXPCIe200 EHCI USB Controller (R-ULPI) + c5ba OXPCIe200 Programmable Memory Interface + c5bb OXPCIe200 Native 950 UART + c5bc OXPCIe200 OHCI USB Controller (R-ULPI) + c5bd OXPCIe200 EHCI USB Controller (R-ULPI) + c5be OXPCIe200 Programmable Memory Interface & GPIO + c5bf OXPCIe200 Native 950 UART + c5c0 OXPCIe200 OHCI USB Controller (analog) + c5c2 OXPCIe200 Programmable Memory Interface + c5c4 OXPCIe200 OHCI USB Controller (analog) + c5c6 OXPCIe200 Programmable Memory Interface & GPIO + c5c8 OXPCIe200 OHCI USB Controller (analog) + c5ca OXPCIe200 Programmable Memory Interface + c5cb OXPCIe200 Native 950 UART + c5cc OXPCIe200 OHCI USB Controller (analog) + c5ce OXPCIe200 Programmable Memory Interface & GPIO + c5cf OXPCIe200 Native 950 UART 1416 Multiwave Innovation pte Ltd 1417 Convergenet Technologies Inc 1418 Kyushu electronics systems Inc @@ -18488,7 +18739,17 @@ 144d a801 SM963 2.5" NVMe PCIe SSD a808 NVMe SSD Controller SM981/PM981/PM983 1d49 403b Thinksystem U.2 PM983 NVMe SSD - a80a NVMe SSD Controller PM9A1/980PRO + a809 NVMe SSD Controller 980 + a80a NVMe SSD Controller PM9A1/PM9A3/980PRO + 0128 215a DC NVMe PM9A3 RI U.2 960GB + 0128 215b DC NVMe PM9A3 RI U.2 1.92TB + 0128 215c DC NVMe PM9A3 RI U.2 3.84TB + 0128 215d DC NVMe PM9A3 RI U.2 7.68TB + 0128 2166 DC NVMe PM9A3 RI 110M.2 960GB + 0128 2167 DC NVMe PM9A3 RI 110M.2 1.92TB + 0128 2168 DC NVMe PM9A3 RI 80M.2 480GB + 0128 2169 DC NVMe PM9A3 RI 80M.2 960GB + 144d a813 General DC NVMe PM9A3 a820 NVMe SSD Controller 171X 1028 1f95 Express Flash NVMe XS1715 SSD 400GB 1028 1f96 Express Flash NVMe XS1715 SSD 800GB @@ -18568,6 +18829,8 @@ 1028 2131 Ent NVMe v2 AGN RI U.2 7.68TB 1028 2132 Ent NVMe v2 AGN FIPS RI U.2 15.36TB 1028 2133 Ent NVMe v2 AGN RI U.2 15.36TB + a825 NVMe SSD Controller PM173Xa + a826 NVMe SSD Controller PM174X ecec Exynos 8895 PCIe Root Complex 144e OLITEC 144f Askey Computer Corp. @@ -18579,6 +18842,7 @@ 1456 Advanced Hardware Architectures 1457 Nuera Communications Inc 1458 Gigabyte Technology Co., Ltd + 22e8 Ellesmere [Radeon RX 480] 3483 USB 3.0 Controller (VIA VL80x-based xHCI Controller) 1459 DOOIN Electronics 145a Escalate Networks Inc @@ -18598,6 +18862,7 @@ 1462 Micro-Star International Co., Ltd. [MSI] # VIA Driver-inf 3483 MSI USB 3.0 (VIA VL80x-based xHCI USB Controller) + 7c56 Realtek Ethernet controller RTL8111H aaf0 Radeon RX 580 Gaming X 8G 1463 Fast Corporation 1464 Interactive Circuits & Systems Ltd @@ -18693,7 +18958,8 @@ 14a8 FEATRON Technologies Corporation 14a9 HIVERTEC Inc 14aa Advanced MOS Technology Inc -14ab Mentor Graphics Corp. +# nee Mentor Graphics Corp. +14ab Siemens Industry Software Inc. 14ac Novaweb Technologies Inc 14ad Time Space Radio AB 14ae CTI, Inc @@ -19270,9 +19536,12 @@ 14e4 1402 BCM957414A4142CC 10Gb/25Gb Ethernet PCIe 14e4 1404 BCM957414M4142C OCP 2x25G Type1 wRoCE 14e4 4140 NetXtreme E-Series Advanced Dual-port 25Gb SFP28 Network Daughter Card +# BCM957414M4143C + 14e4 4143 NetXtreme-E Single-port 40Gb/50Gb Ethernet OCP 2.0 Adapter (BCM957414M4143C) 14e4 4146 NetXtreme-E Dual-port 25G SFP28 Ethernet OCP 3.0 Adapter (BCM957414N4140C) 1590 020e Ethernet 25Gb 2-port 631SFP28 Adapter 1590 0211 Ethernet 25Gb 2-port 631FLR-SFP28 Adapter + 1eec 0101 VSE250231S Dual-port 10Gb/25Gb Ethernet PCIe 16d8 BCM57416 NetXtreme-E Dual-Media 10G RDMA Ethernet Controller 1028 1feb NetXtreme-E 10Gb SFP+ Adapter 14e4 4163 NetXtreme-E Dual-port 10GBASE-T Ethernet OCP 2.0 Adapter (BCM957416M4163C) @@ -19331,6 +19600,7 @@ 14e4 d124 NetXtreme-E P2100D BCM57508 2x100G QSFP PCIE 14e4 df24 BCM57508 NetXtreme-E NGM2100D 2x100G KR Mezz Ethernet 1751 BCM57504 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb/200Gb Ethernet + 1028 09d4 PowerEdge XR11/XR12 LOM 14e4 5045 NetXtreme-E BCM57504 4x25G OCP3.0 14e4 5250 NetXtreme-E BCM57504 4x25G KR Mezz 14e4 d142 NetXtreme-E P425D BCM57504 4x25G SFP28 PCIE @@ -19341,7 +19611,7 @@ 14e4 df24 BCM57508 NetXtreme-E NGM2100D 2x100G KR Mezz Ethernet Partition 1803 BCM57502 NetXtreme-E RDMA Partition 1804 BCM57504 NetXtreme-E RDMA Partition - 1805 BCM57508 NetXtreme-E NGM2100D 2x100G KR Mezz RDMA Partition + 1805 BCM57508 NetXtreme-E RDMA Partition 14e4 df24 NetXtreme-E NGM2100D BCM57508 2x100G KR Mezz RDMA Partition 1806 BCM5750X NetXtreme-E Ethernet Virtual Function 14e4 df24 BCM57508 NetXtreme-E NGM2100D 2x100G KR Mezz Ethernet Virtual Function @@ -19557,6 +19827,7 @@ 441f BCM4361 802.11ac Dual-Band Wireless Network Controller 4420 BCM4361 802.11ac 2.4 GHz Wireless Network Controller 4421 BCM4361 802.11ac 5 GHz Wireless Network Controller + 4425 BRCM4378 Wireless Network Adapter 4430 BCM44xx CardBus iLine32 HomePNA 2.0 4432 BCM4432 CardBus 10/100BaseT 4464 BCM4364 802.11ac Wireless Network Adapter @@ -19635,6 +19906,7 @@ b960 Broadcom BCM56960 Switch ASIC # Tomahawk4 b990 BCM56990 Switch ASIC + c909 BCM78909 Switch ASIC d802 BCM58802 Stingray 50Gb Ethernet SoC 14e4 8021 Stingray Dual-Port 25Gb Ethernet PCIe SmartNIC w16GB DRAM (Part No BCM958802A8046C) 14e4 8023 PS410T-H04 NetXtreme-S 4x10G 10GBaseT PCIe SmartNIC @@ -20331,13 +20603,16 @@ 0252 Amos chiplet 0253 Amos GearBox Manager 0254 Spectrum-4, Flash recovery mode - 0255 Spectrum-4, Secure Flash recovery mode - 0256 Ofek chiplet + 0255 Spectrum-4 RMA + 0256 Abir GearBox 0257 Quantum-2 in Flash Recovery Mode + 0258 Quantum-2 RMA 0262 MT27710 [ConnectX-4 Lx Programmable] EN 0263 MT27710 [ConnectX-4 Lx Programmable Virtual Function] EN 0264 Innova-2 Flex Burn image 0281 NPS-600 Flash Recovery + 0357 Abir GearBox in Flash Recovery Mode + 0358 Abir GearBox in RMA 1002 MT25400 Family [ConnectX-2 Virtual Function] 1003 MT27500 Family [ConnectX-3] 1014 04b5 PCIe3 40GbE RoCE Converged Host Bus Adapter for Power @@ -20835,7 +21110,7 @@ 0002 SiByte BCM1125H/1250 System-on-a-Chip HyperTransport 0012 SiByte BCM1280/BCM1480 System-on-a-Chip PCI-X 0014 Sibyte BCM1280/BCM1480 System-on-a-Chip HyperTransport -1677 Bernecker + Rainer +1677 B&R Industrial Automation GmbH 104e 5LS172.6 B&R Dual CAN Interface Card 12d7 5LS172.61 B&R Dual CAN Interface Card 20ad 5ACPCI.MFIO-K01 Profibus DP / K-Feldbus / COM @@ -21249,6 +21524,7 @@ 7029 AP342 14-bit, 12-Channel Isolated Simultaneous Conversion Analog Input Module 702a AP226 12-Bit, 8-Channel Isolated Analog Output Module 702b AP236 16-Bit, 8-Channel Isolated Analog Output Module + 702c AP560A Module 4 Independent isolated CAN bus channels 7031 AP441-1: 32-Channel Isolated Digital Input Module 7032 AP441-2: 32-Channel Isolated Digital Input Module 7033 AP441-3: 32-Channel Isolated Digital Input Module @@ -21259,6 +21535,7 @@ 7052 APA7-502 Reconfigurable Artix-7 52,160 Cell FPGA module 24 RS485 channels 7053 APA7-503 Reconfigurable Artix-7 52,160 Cell FPGA module 24 TTL & 12 RS485 channels 7054 APA7-504 Reconfigurable Artix-7 52,160 Cell FPGA module 24 LVDS channels + 7073 AP730 Multi-function I/O Module 16 Digital I/O 8 Differential Analog In 4 Analog Out 16da Advantech Co., Ltd. 0011 INES GPIB-PCI 16df PIKA Technologies Inc. @@ -21371,7 +21648,9 @@ 0004 Octeon (and older) FIPS 0005 Octeon CN38XX Network Processor Pass 3.x 0006 RoHS - 0010 Nitrox XL NPX + 0010 CN15XX/CN16XX [Nitrox PX] + 0011 CNN35XX [Nitrox III] + 0012 CNN55XX [Nitrox V] 0020 Octeon CN31XX Network Processor 0030 Octeon CN30XX Network Processor 0040 Octeon CN58XX Network Processor @@ -21732,6 +22011,8 @@ 6013 R6013 ISA Bridge 6020 R6020 North Bridge 6021 R6021 Host Bridge +# Integrated in the Vortex86DX2 SoC + 6022 R6022 Host Bridge # Found in the Vortex86DX3 SoC 6023 R6023 Host Bridge # Found in the Vortex86EX SoC @@ -22022,6 +22303,7 @@ 18ec 4200 Flexible FlowMon (szedata2) 1x10G 18ec ff00 Testing design 18ec ff01 Boot design + c400 COMBO-400G1 18ee Chenming Mold Ind. Corp. 18f1 Spectrum GmbH 18f4 Napatech A/S @@ -22485,6 +22767,7 @@ 5012 E12 NVMe Controller 5013 PS5013 E13 NVMe Controller 5016 E16 PCIe4 NVMe Controller + 5018 E18 PCIe4 NVMe Controller 1989 Montilio Inc. 0001 RapidFile Bridge 8001 RapidFile @@ -22681,6 +22964,7 @@ 1a22 Ambric Inc. 1a29 Fortinet, Inc. 4338 CP8 Content Processor ASIC + 43a0 CP9 Content Processor ASIC 4e36 NP6 Network Processor 4e37 NP7 Network Processor 1a2b Ascom AG @@ -22799,7 +23083,8 @@ 1ae3 SANBlaze Technology, Inc. 1ae7 First Wise Media GmbH 0520 HFC-S PCI A [X-TENSIONS XC-520] -1ae8 Silicon Software GmbH +# nee Silicon Software GmbH +1ae8 Basler AG # CameraLink frame grabber for Visual Applets 0751 mE5 marathon VCL # CameraLink HS frame grabber @@ -22848,6 +23133,12 @@ 0b61 mE6 Abacus 4TG # CoaXpress frame grabber 0b63 CXP-12 Interface Card 1C +# CoaXpress frame grabber + 0b64 CXP-12 Interface Card 4C +# CoaXpress frame grabber + 0b65 CXP-12 Interface Card 2C +# CoaXpress Thunderbolt frame grabber + 0b66 CXP-12 LightBridge 2C # GigE Vision frame grabber 0e42 microEnable IV AQ4-GE # GigE Vision frame grabber for Visual Applets @@ -22946,6 +23237,7 @@ 1343 ASM1143 USB 3.1 Host Controller 2142 ASM2142 USB 3.1 Host Controller 1462 7a72 H270 PC MATE + 2824 ASM2824 PCIe Gen3 Packet Switch 3242 ASM3242 USB 3.2 Host Controller 1b26 Netcope Technologies, a.s. c132 COMBO-LXT155 @@ -23295,13 +23587,21 @@ 1283 PC300 NVMe Solid State Drive 256GB 1284 PC300 NVMe Solid State Drive 512GB 1285 PC300 NVMe Solid State Drive 1TB - 1327 BC501 NVMe Solid State Drive 512GB + 1327 BC501 NVMe Solid State Drive 1339 BC511 1504 SC300 512GB M.2 2280 SATA Solid State Drive 1527 PC401 NVMe Solid State Drive 256GB 243b PE6110 NVMe Solid State Drive 1c5c 0100 PE6110 NVMe Solid State Drive 2839 PE8000 Series NVMe Solid State Drive + 1028 2143 DC NVMe SED PE8010 RI U.2 960GB + 1028 2144 DC NVMe PE8010 RI U.2 960GB + 1028 2145 DC NVMe SED PE8010 RI U.2 1.92TB + 1028 2146 DC NVMe PE8010 RI U.2 1.92TB + 1028 2147 DC NVMe SED PE8010 RI U.2 3.84TB + 1028 2148 DC NVMe PE8010 RI U.2 3.84TB + 1028 2149 DC NVMe SED PE8010 RI U.2 7.68TB + 1028 214a DC NVMe PE8010 RI U.2 7.68TB 1c5c 0100 PE8000 Series NVMe Solid State Drive 1c5f Beijing Memblaze Technology Co. Ltd. 000d PBlaze5 520/526 @@ -23354,6 +23654,16 @@ 1cc1 ADATA Technology Co., Ltd. 8201 XPG SX8200 Pro PCIe Gen3x4 M.2 2280 Solid State Drive 1cc4 Union Memory (Shenzhen) + 1203 NVMe SSD Controller UHXXXa series + 1cc4 a121 NVMe SSD UHXXXa series U.2 960GB + 1cc4 a122 NVMe SSD UHXXXa series U.2 1920GB + 1cc4 a123 NVMe SSD UHXXXa series U.2 3840GB + 1cc4 a124 NVMe SSD UHXXXa series U.2 7680GB + 1cc4 a125 NVMe SSD UHXXXa series U.2 15360GB + 1cc4 a211 NVMe SSD UHXXXa series U.2 800GB + 1cc4 a212 NVMe SSD UHXXXa series U.2 1600GB + 1cc4 a213 NVMe SSD UHXXXa series U.2 3200GB + 1cc4 a214 NVMe SSD UHXXXa series U.2 6400GB 17ab NVMe 256G SSD device 1cc5 Embedded Intelligence, Inc. 0100 CAN-PCIe-02 @@ -23396,6 +23706,7 @@ 0100 ExaDISK FX1 1cf0 Akitio 1cf7 Subspace Dynamics +1cfa Corsair Memory, Inc 1d00 Pure Storage 1d05 Tongfang Hongkong Limited 1d0f Amazon.com, Inc. @@ -23473,6 +23784,8 @@ 1d21 Allo 1d22 Baidu Technology 1380 Cloud Storage Device + 3684 Kunlun AI Accelerator + 3685 Kunlun2 AI Accelerator [VF] 1d26 Kalray Inc. 0040 Turbocard2 Accelerator 0080 Open Network Interface Card 80G @@ -23494,6 +23807,9 @@ 1d62 Nebbiolo Technologies 1d65 Imagine Communications Corp. 04de Taurus/McKinley +1d69 Celeno Communications + 2432 CL2432 + 2440 CL2440 1d6a Aquantia Corp. 0001 AQC107 NBase-T/IEEE 802.3bz Ethernet Controller [AQtion] 00b1 AQC100 10G Ethernet MAC controller [AQtion] @@ -23533,6 +23849,11 @@ 1017 AR-ARK-FX1 [Arkville 64B Multi-Homed Primary Endpoint] 1018 AR-ARK-FX1 [Arkville 64B Multi-Homed Secondary Endpoint] 1019 AR-ARK-FX1 [Arkville 64B Multi-Homed Tertiary Endpoint] + 101a AR-ARK-SRIOV-FX0 [Arkville 32B Primary Physical Function] + 101b AR-ARK-SRIOV-FX1 [Arkville 64B Primary Physical Function] + 101c AR-ARK-SRIOV-VF [Arkville Virtual Function] + 101d AR-ARK-NIC [Arkville ArkNIC Kernel Path Device] + 101e AR-ARKA-FX1 [Arkville 64B DPDK Data Mover for Agilex R-Tile] 4200 A5PL-E1-10GETI [10 GbE Ethernet Traffic Instrument] 1d72 Xiaomi 1d78 DERA Storage @@ -23561,7 +23882,10 @@ 0100 RK3399 PCI Express Root Port 1808 RK1808 Neural Network Processor Card 3566 RK3568 Remote Signal Processor +1d89 YEESTOR Microelectronics Co., Ltd + 0280 PCIe NVMe SSD 1d8f Enyx +1d92 Abaco Systems Inc. 1d93 YADRO 1d94 Chengdu Haiguang IC Design Co., Ltd. 1450 Root Complex @@ -23597,6 +23921,7 @@ 0001 Colossus GC2 [C2] 0002 Colossus GC1 [S1] 1d97 Shenzhen Longsys Electronics Co., Ltd. + 2263 SM2263EN/SM2263XT-based OEM SSD 1d9b Facebook, Inc. 0010 Networking DOM Engine 0011 IO Bridge @@ -23607,13 +23932,42 @@ 0001 HL-1000 AI Inference Accelerator [Goya] # PCIe accelerator card for Deep Learning training tasks 1000 HL-2000 AI Training Accelerator [Gaudi] +# PCIe accelerator card for Deep Learning training tasks with secured firmware + 1010 HL-2000 AI Training Accelerator [Gaudi secured] +1dad Fungible 1db2 ATP ELECTRONICS INC +1db7 Phytium Technology Co., Ltd. + dc20 [X100 Series] + dc21 VPU Controller [X100 Series] + dc22 DC Controller [X100 Series] + dc23 I2S/DMA Controller [X100 Series] *** 560 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Sep 22 10:31:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 455066AF85A; Wed, 22 Sep 2021 10:31: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 4HDvhj0knGz4tCF; Wed, 22 Sep 2021 10:31: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 ED85A15C3B; Wed, 22 Sep 2021 10:31: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 18MAV0QY009164; Wed, 22 Sep 2021 10:31:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MAV0r9009163; Wed, 22 Sep 2021 10:31:00 GMT (envelope-from git) Date: Wed, 22 Sep 2021 10:31:00 GMT Message-Id: <202109221031.18MAV0r9009163@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 96526cc9edcb - stable/12 - vi.1: Fix a typo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 96526cc9edcb4d3f4b91cbaec2708cb16d45dae4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 10:31:01 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=96526cc9edcb4d3f4b91cbaec2708cb16d45dae4 commit 96526cc9edcb4d3f4b91cbaec2708cb16d45dae4 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2019-12-09 17:58:22 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 10:21:39 +0000 vi.1: Fix a typo Reviewed by: bcr Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D22734 (cherry picked from commit 2486d00026666397c4f9b42187af6ecf9765bf4b) --- contrib/nvi/docs/man/vi.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/nvi/docs/man/vi.1 b/contrib/nvi/docs/man/vi.1 index 73ebdbdb7e13..a06c9242f8d6 100644 --- a/contrib/nvi/docs/man/vi.1 +++ b/contrib/nvi/docs/man/vi.1 @@ -14,7 +14,7 @@ .\" .\" $Id: vi.1,v 9.0 2013/11/02 12:11:56 zy Exp $ .\" -.Dd November 2, 2013 +.Dd December 9, 2019 .Dt VI 1 .Os .Sh NAME @@ -981,7 +981,7 @@ command. .Cm ;\& .Xc Repeat the last character find -.Pq i.e., the last .Cm F , f , T No or Cm t No command +.Pq i.e., the last Cm F , f , T No or Cm t No command .Ar count times. .Pp From owner-dev-commits-src-all@freebsd.org Wed Sep 22 10:31:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 811236AF9C8; Wed, 22 Sep 2021 10:31: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 4HDvhk2ZNLz4sxw; Wed, 22 Sep 2021 10:31: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 24EC215DE0; Wed, 22 Sep 2021 10:31: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 18MAV2g8009188; Wed, 22 Sep 2021 10:31:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MAV29W009187; Wed, 22 Sep 2021 10:31:02 GMT (envelope-from git) Date: Wed, 22 Sep 2021 10:31:02 GMT Message-Id: <202109221031.18MAV29W009187@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: b4a70dd2a25c - stable/12 - Update nvi to 2.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b4a70dd2a25c8be82bf01048ff068ebe748a32e1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 10:31:02 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=b4a70dd2a25c8be82bf01048ff068ebe748a32e1 commit b4a70dd2a25c8be82bf01048ff068ebe748a32e1 Author: Baptiste Daroussin AuthorDate: 2020-09-09 08:38:47 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 10:25:30 +0000 Update nvi to 2.2.0 Main changes: * Vim-style expandtab option * Provides Turkish translation * Backspace now deletes \ rather than being escaped * T during motion commands is now VI-compatible * Encoding related fixes, such as UTF-8 detection * Fixed a number of memory management issues (cherry picked from commit 110d525ec6188f3c9dc4f54c4bc1cced2f7184cd) --- contrib/nvi/.gitignore | 9 + contrib/nvi/CMakeLists.txt | 190 +++++++++++++++++++ contrib/nvi/LICENSE | 4 - contrib/nvi/README | 10 +- contrib/nvi/catalog/Makefile | 9 +- contrib/nvi/catalog/README | 2 - contrib/nvi/catalog/dump.c | 5 +- contrib/nvi/catalog/tr_TR.ISO8859-9.base | 304 ++++++++++++++++++++++++++++++ contrib/nvi/catalog/tr_TR.ISO8859-9.owner | 1 + contrib/nvi/catalog/tr_TR.UTF-8.base | 304 ++++++++++++++++++++++++++++++ contrib/nvi/catalog/tr_TR.UTF-8.owner | 1 + contrib/nvi/cl/README.signal | 2 - contrib/nvi/cl/cl.h | 2 - contrib/nvi/cl/cl_funcs.c | 4 - contrib/nvi/cl/cl_main.c | 65 ++----- contrib/nvi/cl/cl_read.c | 4 - contrib/nvi/cl/cl_screen.c | 62 +++--- contrib/nvi/cl/cl_term.c | 25 ++- contrib/nvi/common/args.h | 2 - contrib/nvi/common/common.h | 11 +- contrib/nvi/common/conv.c | 13 +- contrib/nvi/common/conv.h | 2 - contrib/nvi/common/cut.c | 34 +--- contrib/nvi/common/cut.h | 2 - contrib/nvi/common/delete.c | 28 ++- contrib/nvi/common/encoding.c | 4 - contrib/nvi/common/exf.c | 106 +++-------- contrib/nvi/common/exf.h | 2 - contrib/nvi/common/extern.h | 1 - contrib/nvi/common/gs.h | 4 - contrib/nvi/common/key.c | 61 ++---- contrib/nvi/common/key.h | 12 +- contrib/nvi/common/line.c | 60 ++---- contrib/nvi/common/log.c | 61 ++---- contrib/nvi/common/log.h | 2 - contrib/nvi/common/main.c | 76 +++----- contrib/nvi/common/mark.c | 35 +--- contrib/nvi/common/mark.h | 2 - contrib/nvi/common/mem.h | 51 ++--- contrib/nvi/common/msg.c | 55 ++---- contrib/nvi/common/msg.h | 2 - contrib/nvi/common/multibyte.h | 36 +++- contrib/nvi/common/options.c | 66 ++----- contrib/nvi/common/options.h | 2 - contrib/nvi/common/options_def.h | 137 +++++++------- contrib/nvi/common/options_f.c | 94 ++------- contrib/nvi/common/put.c | 12 +- contrib/nvi/common/recover.c | 68 ++----- contrib/nvi/common/screen.c | 28 +-- contrib/nvi/common/screen.h | 2 - contrib/nvi/common/search.c | 41 +--- contrib/nvi/common/seq.c | 65 ++----- contrib/nvi/common/seq.h | 2 - contrib/nvi/common/util.c | 76 ++------ contrib/nvi/common/util.h | 2 - contrib/nvi/docs/man/Makefile | 16 -- contrib/nvi/ex/ex.c | 11 +- contrib/nvi/ex/ex.h | 2 - contrib/nvi/ex/ex_abbrev.c | 4 - contrib/nvi/ex/ex_append.c | 4 - contrib/nvi/ex/ex_args.c | 9 +- contrib/nvi/ex/ex_argv.c | 8 +- contrib/nvi/ex/ex_at.c | 10 +- contrib/nvi/ex/ex_bang.c | 11 +- contrib/nvi/ex/ex_cd.c | 4 - contrib/nvi/ex/ex_cmd.c | 4 - contrib/nvi/ex/ex_cscope.c | 63 +++---- contrib/nvi/ex/ex_delete.c | 4 - contrib/nvi/ex/ex_display.c | 4 - contrib/nvi/ex/ex_edit.c | 4 - contrib/nvi/ex/ex_equal.c | 4 - contrib/nvi/ex/ex_file.c | 4 - contrib/nvi/ex/ex_filter.c | 5 +- contrib/nvi/ex/ex_global.c | 14 +- contrib/nvi/ex/ex_init.c | 17 +- contrib/nvi/ex/ex_join.c | 4 - contrib/nvi/ex/ex_map.c | 4 - contrib/nvi/ex/ex_mark.c | 4 - contrib/nvi/ex/ex_mkexrc.c | 4 - contrib/nvi/ex/ex_move.c | 4 - contrib/nvi/ex/ex_open.c | 4 - contrib/nvi/ex/ex_preserve.c | 4 - contrib/nvi/ex/ex_print.c | 6 +- contrib/nvi/ex/ex_put.c | 4 - contrib/nvi/ex/ex_quit.c | 4 - contrib/nvi/ex/ex_read.c | 7 +- contrib/nvi/ex/ex_screen.c | 4 - contrib/nvi/ex/ex_script.c | 11 +- contrib/nvi/ex/ex_set.c | 4 - contrib/nvi/ex/ex_shell.c | 4 - contrib/nvi/ex/ex_shift.c | 33 +++- contrib/nvi/ex/ex_source.c | 9 +- contrib/nvi/ex/ex_stop.c | 4 - contrib/nvi/ex/ex_subst.c | 28 +-- contrib/nvi/ex/ex_tag.c | 41 ++-- contrib/nvi/ex/ex_txt.c | 12 +- contrib/nvi/ex/ex_undo.c | 4 - contrib/nvi/ex/ex_usage.c | 7 +- contrib/nvi/ex/ex_util.c | 4 - contrib/nvi/ex/ex_version.c | 4 - contrib/nvi/ex/ex_visual.c | 4 - contrib/nvi/ex/ex_write.c | 4 - contrib/nvi/ex/ex_yank.c | 4 - contrib/nvi/ex/ex_z.c | 4 - contrib/nvi/ex/extern.h | 1 + contrib/nvi/ex/script.h | 2 - contrib/nvi/ex/tag.h | 2 - contrib/nvi/ex/version.h | 2 +- contrib/nvi/files/config.h.in | 17 ++ contrib/nvi/files/pathnames.h.in | 26 +++ contrib/nvi/files/recover.in | 53 ++++++ contrib/nvi/{docs => }/man/vi.1 | 53 ++++-- contrib/nvi/vi/getc.c | 4 - contrib/nvi/vi/v_at.c | 4 - contrib/nvi/vi/v_ch.c | 13 +- contrib/nvi/vi/v_cmd.c | 4 - contrib/nvi/vi/v_delete.c | 4 - contrib/nvi/vi/v_ex.c | 4 - contrib/nvi/vi/v_increment.c | 4 - contrib/nvi/vi/v_init.c | 25 +-- contrib/nvi/vi/v_itxt.c | 4 - contrib/nvi/vi/v_left.c | 4 - contrib/nvi/vi/v_mark.c | 4 - contrib/nvi/vi/v_match.c | 9 +- contrib/nvi/vi/v_paragraph.c | 9 +- contrib/nvi/vi/v_put.c | 4 - contrib/nvi/vi/v_redraw.c | 4 - contrib/nvi/vi/v_replace.c | 4 - contrib/nvi/vi/v_right.c | 4 - contrib/nvi/vi/v_screen.c | 4 - contrib/nvi/vi/v_scroll.c | 8 +- contrib/nvi/vi/v_search.c | 4 - contrib/nvi/vi/v_section.c | 4 - contrib/nvi/vi/v_sentence.c | 6 +- contrib/nvi/vi/v_status.c | 4 - contrib/nvi/vi/v_txt.c | 97 ++++------ contrib/nvi/vi/v_ulcase.c | 4 - contrib/nvi/vi/v_undo.c | 4 - contrib/nvi/vi/v_util.c | 4 - contrib/nvi/vi/v_word.c | 4 - contrib/nvi/vi/v_xchar.c | 4 - contrib/nvi/vi/v_yank.c | 4 - contrib/nvi/vi/v_z.c | 4 - contrib/nvi/vi/v_zexit.c | 4 - contrib/nvi/vi/vi.c | 12 +- contrib/nvi/vi/vi.h | 4 +- contrib/nvi/vi/vs_line.c | 4 - contrib/nvi/vi/vs_msg.c | 17 +- contrib/nvi/vi/vs_refresh.c | 11 +- contrib/nvi/vi/vs_relative.c | 4 - contrib/nvi/vi/vs_smap.c | 4 - contrib/nvi/vi/vs_split.c | 10 +- usr.bin/vi/Makefile | 5 +- usr.bin/vi/catalog/Makefile | 2 +- usr.bin/vi/config.h | 8 +- usr.bin/vi/pathnames.h | 1 - 156 files changed, 1569 insertions(+), 1632 deletions(-) diff --git a/contrib/nvi/.gitignore b/contrib/nvi/.gitignore new file mode 100644 index 000000000000..aac7860d7299 --- /dev/null +++ b/contrib/nvi/.gitignore @@ -0,0 +1,9 @@ +*.swp +*~ +*.orig +*.core +extern.h +*_def.h +version.h +tags +build/ diff --git a/contrib/nvi/CMakeLists.txt b/contrib/nvi/CMakeLists.txt new file mode 100644 index 000000000000..00f43283f022 --- /dev/null +++ b/contrib/nvi/CMakeLists.txt @@ -0,0 +1,190 @@ +cmake_minimum_required(VERSION 3.9) + +get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(is_multi_config) + set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING + "Semicolon separated list of supported configuration types") + mark_as_advanced(CMAKE_CONFIGURATION_TYPES) +elseif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS) + message(WARNING "No CMAKE_BUILD_TYPE is selected") +endif() + +project(nvi2 C) + +include(CheckIncludeFiles) +include(CheckFunctionExists) +include(CheckCSourceCompiles) + +mark_as_advanced(CMAKE_INSTALL_PREFIX) + +option(USE_WIDECHAR "Enable wide character support" ON) +option(USE_ICONV "Enable iconv support" ON) + +add_compile_options(-fcolor-diagnostics) +add_compile_options($<$:-Wall>) +add_compile_options($<$:-Wno-parentheses>) +add_compile_options($<$:-Wno-uninitialized>) +add_compile_options($<$:-Wmissing-prototypes>) +add_compile_options($<$:-Wsystem-headers>) +add_compile_options($<$:-Wuninitialized>) +add_compile_options($<$:-Wno-dangling-else>) +add_compile_options(-Wstack-protector -fstack-protector) +add_compile_options(-Wstrict-aliasing -fstrict-aliasing) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +set(MAIN_PROTOS + cl/extern.h common/extern.h ex/extern.h vi/extern.h + common/options_def.h ex/ex_def.h ex/version.h) + +set(CL_SRCS + cl/cl_funcs.c cl/cl_main.c cl/cl_read.c cl/cl_screen.c cl/cl_term.c) + +set(COMMON_SRCS + common/conv.c common/cut.c common/delete.c common/encoding.c common/exf.c + common/key.c common/line.c common/log.c common/main.c common/mark.c + common/msg.c common/options.c common/options_f.c common/put.c + common/recover.c common/screen.c common/search.c common/seq.c + common/util.c) + +set(EX_SRCS + ex/ex.c ex/ex_abbrev.c ex/ex_append.c ex/ex_args.c ex/ex_argv.c ex/ex_at.c + ex/ex_bang.c ex/ex_cd.c ex/ex_cmd.c ex/ex_cscope.c ex/ex_delete.c + ex/ex_display.c ex/ex_edit.c ex/ex_equal.c ex/ex_file.c ex/ex_filter.c + ex/ex_global.c ex/ex_init.c ex/ex_join.c ex/ex_map.c ex/ex_mark.c + ex/ex_mkexrc.c ex/ex_move.c ex/ex_open.c ex/ex_preserve.c ex/ex_print.c + ex/ex_put.c ex/ex_quit.c ex/ex_read.c ex/ex_screen.c ex/ex_script.c + ex/ex_set.c ex/ex_shell.c ex/ex_shift.c ex/ex_source.c ex/ex_stop.c + ex/ex_subst.c ex/ex_tag.c ex/ex_txt.c ex/ex_undo.c ex/ex_usage.c + ex/ex_util.c ex/ex_version.c ex/ex_visual.c ex/ex_write.c ex/ex_yank.c + ex/ex_z.c) + +set(VI_SRCS + vi/getc.c vi/v_at.c vi/v_ch.c vi/v_cmd.c vi/v_delete.c vi/v_ex.c + vi/v_increment.c vi/v_init.c vi/v_itxt.c vi/v_left.c vi/v_mark.c + vi/v_match.c vi/v_paragraph.c vi/v_put.c vi/v_redraw.c vi/v_replace.c + vi/v_right.c vi/v_screen.c vi/v_scroll.c vi/v_search.c vi/v_section.c + vi/v_sentence.c vi/v_status.c vi/v_txt.c vi/v_ulcase.c vi/v_undo.c + vi/v_util.c vi/v_word.c vi/v_xchar.c vi/v_yank.c vi/v_z.c vi/v_zexit.c + vi/vi.c vi/vs_line.c vi/vs_msg.c vi/vs_refresh.c vi/vs_relative.c + vi/vs_smap.c vi/vs_split.c) + +set(REGEX_SRCS + regex/regcomp.c regex/regerror.c regex/regexec.c regex/regfree.c) + +# commands to generate the public headers +set(extract_protos sed -n 's/^ \\* PUBLIC: \\\(.*\\\)/\\1/p') +set(extract_version sed -n + 's/^.*version \\\([^\)]*\)\\\).*/\#define VI_VERSION \\\"\\1\\\"/p') + +add_custom_command(OUTPUT cl/extern.h + COMMAND ${extract_protos} ${CL_SRCS} > cl/extern.h + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${CL_SRCS}) +add_custom_command(OUTPUT common/extern.h + COMMAND ${extract_protos} ${COMMON_SRCS} > common/extern.h + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${COMMON_SRCS}) +add_custom_command(OUTPUT ex/extern.h + COMMAND ${extract_protos} ${EX_SRCS} > ex/extern.h + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${EX_SRCS}) +add_custom_command(OUTPUT vi/extern.h + COMMAND ${extract_protos} ${VI_SRCS} > vi/extern.h + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${VI_SRCS}) +add_custom_command(OUTPUT common/options_def.h + COMMAND awk -f common/options.awk + common/options.c > common/options_def.h + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS common/options.c) +add_custom_command(OUTPUT ex/ex_def.h + COMMAND awk -f ex/ex.awk ex/ex_cmd.c > ex/ex_def.h + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ex/ex_cmd.c) +add_custom_command(OUTPUT ex/version.h + COMMAND ${extract_version} README > ex/version.h + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS README) + +add_executable(nvi) +target_sources(nvi PRIVATE ${MAIN_PROTOS} ${CL_SRCS} ${COMMON_SRCS} + ${EX_SRCS} ${VI_SRCS}) +target_compile_definitions(nvi PRIVATE $<$:DEBUG> + $<$:COMLOG>) + +check_function_exists(openpty UTIL_IN_LIBC) +if(NOT UTIL_IN_LIBC) + find_library(UTIL_LIBRARY util) + target_link_libraries(nvi PRIVATE ${UTIL_LIBRARY}) +endif() + +check_function_exists(__b64_ntop RESOLV_IN_LIBC) +if(NOT RESOLV_IN_LIBC) + find_library(RESOLV_LIBRARY resolv) + target_link_libraries(nvi PRIVATE ${RESOLV_LIBRARY}) +endif() + +if(USE_WIDECHAR) + find_library(CURSES_LIBRARY NAMES ncursesw cursesw curses HINTS /usr/lib) + + # link to the wchar_t awared BSD libregex.a + add_library(regex STATIC) + target_sources(regex PRIVATE ${REGEX_SRCS}) + target_include_directories(regex PUBLIC regex) + target_compile_definitions(regex PUBLIC __REGEX_PRIVATE) + target_link_libraries(nvi PRIVATE regex) +else() + find_library(CURSES_LIBRARY NAMES ncurses curses HINTS /usr/lib) + target_compile_options(nvi PRIVATE -Wno-pointer-sign) +endif() + +target_link_libraries(nvi PRIVATE ${CURSES_LIBRARY}) + +if(USE_ICONV) + check_function_exists(__iconv ICONV_IN_LIBC) + if(NOT ICONV_IN_LIBC) + find_path(ICONV_INCLUDE_DIR iconv.h) + find_library(ICONV_LIBRARY iconv) + endif() + + # detect the prototype of iconv(3) + set(CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") + set(CMAKE_REQUIRED_INCLUDES "${ICONV_INCLUDE_DIR}") + set(CMAKE_REQUIRED_LIBRARIES "${ICONV_LIBRARY}") + check_c_source_compiles(" + #include + int main() { + iconv_t conv = 0; + char* in = 0; + size_t ilen = 0; + char* out = 0; + size_t olen = 0; + iconv(conv, &in, &ilen, &out, &olen); + return 0; + } + " ICONV_TRADITIONAL) + set(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_LIBRARIES) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}") + + target_include_directories(nvi PRIVATE ${ICONV_INCLUDE_DIR}) + target_link_libraries(nvi PRIVATE ${ICONV_LIBRARY}) +endif() + +check_include_files(libutil.h HAVE_LIBUTIL_H) +check_include_files(ncurses.h HAVE_NCURSES_H) +check_include_files(term.h HAVE_TERM_H) + +configure_file(files/config.h.in config.h) + +set(vi_cv_path_preserve /var/tmp/vi.recover/) +if(APPLE) + set(vi_cv_path_msgcat /usr/local/share/vi/catalog/) +else() + set(vi_cv_path_msgcat /usr/share/vi/catalog/) +endif() + +configure_file(files/pathnames.h.in pathnames.h) +configure_file(files/recover.in recover @ONLY) diff --git a/contrib/nvi/LICENSE b/contrib/nvi/LICENSE index c79151197da6..f9238465b7c9 100644 --- a/contrib/nvi/LICENSE +++ b/contrib/nvi/LICENSE @@ -1,7 +1,3 @@ -/*- - * $Id: LICENSE,v 8.18 2011/07/10 11:58:35 zy Exp $ - */ - The following are the copyrights and redistribution conditions that apply to this copy of the Vi software. diff --git a/contrib/nvi/README b/contrib/nvi/README index 26fcc167fc6f..8f61a97144be 100644 --- a/contrib/nvi/README +++ b/contrib/nvi/README @@ -1,6 +1,4 @@ -# $Id: README,v 9.2 2015/04/08 17:18:56 zy Exp $ - -This is version 2.1.3 (2015-04-08) of nex/nvi, a reimplementation of the ex/vi +This is version 2.2.0 (2020-08-01) of nex/nvi, a reimplementation of the ex/vi text editors originally distributed as part of the Fourth Berkeley Software Distribution (4BSD), by the University of California, Berkeley. @@ -8,12 +6,12 @@ The directory layout is as follows: LICENSE ....... Copyright, use and redistribution information. README ........ This file. - build ......... Build directory. catalog ....... Message catalogs; see catalog/README. cl ............ Vi interface to the curses(3) library. common ........ Code shared by ex and vi. - docs .......... Ex/vi documentation, both current and historic. ex ............ Ex source code. + files ......... Template files. + man ........... Ex/vi documentation. regex ......... Modified regex library with wide character support. vi ............ Vi source code. @@ -29,7 +27,7 @@ o Nvi was written by Keith Bostic, and the last version is 1.79. After that, The following acknowledgments were written by Keith Bostic: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -o This software is several years old and is the product of many folks' work. +o This software is several years old and is the product of many folks' work. This software was originally derived from software contributed to the University of California, Berkeley by Steve Kirkendall, the diff --git a/contrib/nvi/catalog/Makefile b/contrib/nvi/catalog/Makefile index 11e71cce6d7b..d9f7cc91456d 100644 --- a/contrib/nvi/catalog/Makefile +++ b/contrib/nvi/catalog/Makefile @@ -1,7 +1,5 @@ -# $Id: Makefile,v 9.0 2012/10/19 15:13:11 zy Exp $ - -CAT= dutch english french german polish ru_RU.KOI8-R spanish swedish \ - uk_UA.KOI8-U zh_CN.GB2312 +CAT= dutch english french german polish ru_RU.KOI8-R spanish \ + swedish tr_TR.ISO8859-9 tr_TR.UTF-8 uk_UA.KOI8-U zh_CN.GB2312 FILES= ../cl/*.c ../common/*.c ../ex/*.c ../vi/*.c all: dump ${CAT} @@ -33,7 +31,8 @@ ${CAT}: english.base CHK= dutch.check english.check french.check german.check \ polish.check ru_RU.KOI8-R.check spanish.check swedish.check \ - uk_UA.KOI8-U.check zh_CN.GB2312.check + tr_TR.ISO8859-9.check tr_TR.UTF-8.check uk_UA.KOI8-U.check \ + zh_CN.GB2312.check check: ${CHK} ${CHK}: ${CAT} @echo "... $@"; \ diff --git a/contrib/nvi/catalog/README b/contrib/nvi/catalog/README index 42a728afbe2e..14337c7c5981 100644 --- a/contrib/nvi/catalog/README +++ b/contrib/nvi/catalog/README @@ -1,5 +1,3 @@ -# $Id: README,v 9.0 2012/10/19 17:06:15 zy Exp $ - Generally, all non-system error and informational messages in nvi are catalog messages, i.e. they can be tailored to a specific langauge. Command strings, usage strings, system errors and other 'known text' diff --git a/contrib/nvi/catalog/dump.c b/contrib/nvi/catalog/dump.c index b87b29c1af78..74ab53b2f12c 100644 --- a/contrib/nvi/catalog/dump.c +++ b/contrib/nvi/catalog/dump.c @@ -27,10 +27,7 @@ * SUCH DAMAGE. */ -#ifndef lint -static char sccsid[] = "@(#)dump.c 8.1 (Berkeley) 8/31/94"; -#endif /* not lint */ - +#include #include #include diff --git a/contrib/nvi/catalog/tr_TR.ISO8859-9.base b/contrib/nvi/catalog/tr_TR.ISO8859-9.base new file mode 100644 index 000000000000..a591974e34d8 --- /dev/null +++ b/contrib/nvi/catalog/tr_TR.ISO8859-9.base @@ -0,0 +1,304 @@ +002 "Satýr uzunluðu taþýmý" +003 "%lu numaralý satýr silinemiyor" +004 "%lu numaralý satýra iliþtirilemiyor" +005 "%lu numaralý satýrda ekleme yapýlamýyor" +006 "%lu numaralý satýr kaydedilemiyor" +007 "Son satýr alýnamýyor" +008 "Hata: %lu numaralý satýr okunamýyor" +009 "Günlük dosyasý" +010 "Günlükleme gerçekleþtirilmiyor, geri alma olanaklý deðil" +011 "Geri alýnacak bir deðiþiklik yok" +012 "Günlükleme gerçekleþtirilmiyor, geri alma olanaklý deðil" +013 "Günlükleme gerçekleþtirilmiyor, ileri sarma olanaklý deðil" +014 "Yinelenecek bir deðiþiklik yok" +015 "%s/%d: Günlük kayýt hatasý" +016 "Vi'nin standart girdisi ve çýktýsý bir uçbirim olmalý" +017 "Ým %s: Ayarlanmamýþ" +018 "Ým %s: Satýr silinmiþ" +019 "Ým %s: Ýmleç konumu artýk yok" +020 "Hata: " +021 "yeni dosya +022 "adý deðiþti" +023 "deðiþtirildi" +024 "deðiþtirilmedi" +025 "KÝLÝDÝ AÇILDI" +026 "saltokunur" +027 "satýr %lu/%lu [%ld%%]" +028 "boþ dosya" +029 "%lu. satýr" +030 "%s dosyasý bir ileti kataloðu deðil" +031 "Öntanýmlý %s seçeneði ayarlanamadý" +032 "Kullaným: %s" +033 "set: %s seçeneði yok: 'set all' tüm seçenek deðerlerini verir" +034 "set: [no]%s seçeneði bir deðer almaz" +035 "set: %s seçeneði bir Boole deðeri deðil" +036 "set: %s seçeneði: %s" +037 "set: %s seçeneði: %s: Deðer taþýmý" +038 "set: %s seçeneði: %s izin verilmeyen bir sayý" +039 "set: %s seçeneði bir Boole deðeri deðil" +040 "Ekran sütun sayýsý çok küçük, þundan daha az: %d" +041 "Ekran sütun sayýsý çok büyük, þundan daha çok: %d" +042 "Ekran satýr sayýsý çok küçük, þundan daha az: %d" +043 "Ekran satýr sayýsý çok büyük, þundan daha çok: %d" +044 "Lisp seçeneði eklenmemiþ" +045 "Ýletiler kapatýlmamýþ: %s" +046 "Ýletiler açýlmamýþ: %s" +047 "%s seçeneði iki karakterli öbekler biçiminde olmalý" +053 "Baþlangýç arabelleði boþ" +054 "%s arabelleði boþ" +056 "Oturum baþarýsýz olursa deðiþiklikler kurtarýlamaz" +057 "Dosya, kurtarma için kopyalanýyor..." +058 "Koruma baþarýsýz oldu: %s" +059 "Oturum baþarýsýz olursa deðiþiklikler kurtarýlamaz" +060 "Dosya yedeklemesi baþarýsýz oldu: %s" +061 "Dosya, kurtarma için kopyalanýyor..." +062 "%u kullanýcýsý üzerine bilgi bulunamadý" +063 "Kurtarma dosyasý kilitlenemiyor" +065 "Kurtarma dosyasý" +066 "%s: Hatalý oluþturulmuþ kurtarma dosyasý" +067 "%s: Hatalý oluþturulmuþ kurtarma dosyasý" +068 "Kurtarýlacak %s adýnda sizce okunabilir bir dosya yok" +069 "Bu dosyanýn kurtarabileceðiniz eski sürümleri var" +070 "Kurtarabileceðiniz baþka dosyalar var" +071 "E-posta gönderilmedi: %s" +072 "Dosya boþ, aranacak bir þey yok" +073 "Dizgi bulunamadan dosyanýn sonuna eriþildi" +074 "Arama dizgisi yok" +075 "Dizgi bulunamadý" +076 "Dizgi bulunamadan dosyanýn baþýna eriþildi" +077 "Arama tamamlandý" +078 "Aranýyor..." +079 "Yazdýrýlamaz karakter bulunmadý" +080 "Bilinmeyen komut adý" +082 "%s: Komut ex kipinde kullanýlamaz" +083 "Sayým sýfýr olmayabilir" +084 "%s: Hatalý satýr belirtimi" +085 "Ýç sözdizim tablo hatasý (%s: %s)" +086 "Kullaným: %s" +087 "%s: Geçici arabellek salýverilmedi" +088 "Bayrak göreli konumu birinci satýrdan önceye" +089 "Bayrak göreli konumu dosya sonunu geçiyor" +090 "Erimli @, dosya/ekran deðiþtiðinde çalýþýr" +091 "Global/v komutu dosya/ekran deðiþtiðinde çalýþýr" +092 "Ex komutu baþarýsýz: Sýradaki komutlar çýkarýldý" +093 "Ex komutu baþarýsýz: Eþlemlenen düðmeler çýkarýldý" +094 "Ýkinci adres ilkinden daha küçük" +095 "Bir im adý saðlanmadý" +096 "\\ sonrasýnda / veya ? gelmiyor" +097 "Bir satýr numarasýna yapýlan baþvuru sayýsý sýfýrdan az" +098 "Bilinmeyen komut: %s" +099 "Adres deðeri taþýmý" +100 "Adres deðeri alttaþýmý" +101 "Ýzin verilmeyen adres birleþimi" +102 "Ýzin verilmeyen adres: Dosyada yalnýzca %lu satýr var" +103 "Ýzin verilmeyen adres: Dosya boþ" +104 "%s komutu bir 0 adresine izin vermiyor" +105 "Görüntülenecek kýsaltma yok" +106 "Kýsaltmalar bir \"sözcük\" karakteri ile bitmelidir" +107 "Kýsaltmalar sekme veya boþluk içeremez" +108 "Kýsaltmalar sonu dýþýnda sözcük/sözcük olmayan karakterleri karýþtýramaz" +109 "\"%s\" bir kýsaltma deðil" +110 "Vi komutu baþarýsýz: Eþlemlenen düðmeler çýkarýldý" +111 "Düzenlenecek baþka dosya yok" +112 "Öncesinde düzenlenecek baþka dosya yok" +113 "Öncesinde geri sarýlacak dosyalar yok" +114 "Görüntülenecek dosya yok" +115 "Öncesinde \"!\" ögesinin yerine geçecek bir komut yok" +116 "%% yerine geçecek bir dosya adý yok" +117 "# yerine geçecek bir dosya adý yok" +118 "Hata: execl: %s" +119 "Girdi/Çýktý hatasý: %s" +120 "Dosya son tam yazýmdan bu yana deðiþtirilmiþ; yazýn veya yok saymak için ! kullanýn" +121 "Ev dizini konumu bulunamýyor" +122 "Yeni þimdiki dizin: %s" +123 "Görüntülenecek kesilmiþ arabellek yok" +124 "%s komutu bir global veya v komutunun parçasý olarak kullanýlamaz" +128 "%s: kaynak alýnmýyor: Ýyesi siz veya kök deðil" +129 "%s: kaynak alýnmýyor: Ýyesi siz deðilsiniz" +130 "%s: kaynak alýnmýyor: Ýyesi dýþýnda baþka bir kullanýcý tarafýndan yazýlabilir" +131 "Uç uca eklenecek bir satýr yok" +132 "Girdi eþlem girdisi yok" +133 "Komut eþlem girdisi yok" +134 "%s yeniden eþlemlenemeyebilir" +135 "\"%s\" þu anda eþlemlenmemiþ" +136 "Ým adlarý tek bir karakter olmalýdýr" +137 "%s mevcut, yazýlmamýþ; yok saymak için ! kullanýn" +138 "Yeni exrc dosyasý: %s" +139 "Hedef satýrý taþýma erimi içinde" +140 "'open' komutu 'open' seçeneðinin ayarlý olmasýný gerektirir" +141 "'open' komutu henüz eklenmemiþ" +142 "Bu dosyanýn korunmasý olanaklý deðil" +143 "Dosya korundu" +144 "%s: Çok fazla dosya adýna geniþletilmiþ" +145 "Yalnýzca sýradan dosyalar ve adlandýrýlmýþ veri yollarý okunabilir" +146 "%s: Okuma kilidi kullanýlabilir deðildi" +147 "Okunuyor..." +148 "%s: %lu satýr, %lu karakter" +149 "Görüntülenecek arkaplan ekraný yok" +150 "'script' komutu yalnýzca vi kipinde kullanýlabilir" +151 "Çalýþtýrýlacak komut yok" +152 "'shiftwidth' seçeneði 0 olarak ayarlanmýþ" +153 "Sayým taþýmý" +154 "Sayým alttaþýmý" +155 "Düzenli ifade belirtilmiþ; r bayraðý anlamsýz" +156 "#, l ve p bayraklarý vi kipinde c bayraðý ile birlikte kullanýlamaz" +157 "Eþleþme bulunamadý" +158 "Önceden bir etiket girilmemiþ" +159 "Etiket yýðýnýnda %s sayýsýndan az girdi; :display t[ags] kullanýn" +160 "Etiket yýðýnýnda dönülecek bir %s dosyasý yok; :display t[ags] kullanýn" +161 "Sürdürmek için Enter'a basýn:" +162 "%s: Etiket bulunamadý" +163 "%s: %s içinde hasar görmüþ etiket" +164 "%s: Etiketin satýr numarasý dosya sonunu geçmiþ" +165 "Etiket yýðýný boþ" +166 "%s: Arama dizgisi bulunamadý" +167 "%d dosya daha düzenlenecek" +168 "%s arabelleði boþ" +169 "Deðiþikliði onayla? [n]" +170 "Yarýda kesildi" +171 "Öncesinde çalýþtýrýlacak arabellek yok" +172 "Öncesinde düzenli ifade yok" +173 "%s komutu bir dosyanýn halihazýrda okunmuþ olmasýný gerektirir" +174 "Kullaným: %s" +175 "'visual' komutu 'open' seçeneðinin ayarlanmýþ olmasýný gerektirir" +177 "Boþ dosya" +178 "Öncesinde F, f, T veya t aramasý yok" +179 "%s bulunamadý" +180 "Düzenlenecek dosya yok" +181 "Ýmleç bir sayýda deðil" +182 "Ortaya çýkan sayý çok büyük" +183 "Ortaya çýkan sayý çok küçük" +184 "Bu satýrda eþleþen karakter yok" +185 "Eþleþen karakter bulunamadý" +186 "Deðiþtirilecek karakter yok" +187 "Geçilecek baþka ekran yok" +188 "Arama dizgisinden, satýr ofsetinden ve/veya 'z' komutundan sonraki karakterler" +189 "Öncesinde arama dizgisi yok" +190 "Arama baþlanan konumda tamamlandý" +191 "Kýsaltma geniþleme sýnýrýný aþtý: Karakterler çýkarýldý" +192 "Ýzin verilmeyen karakter; giriþ için týrnak içine alýn" +193 "Halihazýrda eklemenin baþýnda" +194 "Silinecek baþka karakter yok" +195 "Hareket dosya sonunu geçti" +196 "Hareket satýr sonunu geçti" +197 "Ýmleç hareket ettirilmedi" +198 "Halihazýrda dosyanýn baþýnda" +199 "Hareket dosyanýn baþýný geçti" +200 "Halihazýrda ilk sütunda" +201 "Arabellekler komuttan önce belirtilmeli" +202 "Halihazýrda dosya sonunda" +203 "Halihazýrda satýr sonunda" +204 "%s bir vi komutu deðil" +205 "Kullaným: %s" +206 "Silinecek karakter yok" +207 "Q komutu ex uçbirim arabirimini gerektirir" +208 "Yinelenecek komut yok" +209 "Dosya boþ" +210 "%s bir hareket komutu olarak kullanýlamaz" +211 "Halihazýrda komut kipi içinde" +212 "Ýmleç bir sözcükte deðil" +214 "'windows' seçeneði deðeri çok büyük, en çok %u olabilir" +215 "Ýliþtir" +216 "Deðiþiklik yap" +217 "Komut" +218 "Ekle" +219 "Deðiþtir" +220 "Hareket ekran sonunu geçti" +221 "Hareket ekran baþýný geçti" +222 "Ekran bölünebilmesi için %d satýrdan daha geniþ olmalýdýr" +223 "Arkaplan ekraný yok" +224 "Arkaplanda %s dosyasýný düzenleyen bir ekran yok" +225 "Açýk olan tek ekranýnýzý arkaplana alamazsýnýz" +226 "Ekran yalnýzca %d satýra küçültülebilir" +227 "Ekran küçülemez" +228 "Ekran büyüyemez" +230 "Bu ekran askýya alýnamaz" +231 "Yarýda kesildi: Eþlemlenen düðmeler çýkarýldý" +232 "vi: Geçici arabellek salýverilmedi" +233 "Bu uçbirimde %s düðmesi yok" +234 "Yalnýzca bir arabellek belirtilebilir" +235 "Sayý þundan daha büyük: %lu" +236 "Yarýda kesildi" +237 "Geçici dosya oluþturulamýyor" +238 "Uyarý: %s sýradan bir dosya deðil" +239 "%s halihazýrda kilitlenmiþ, oturum saltokunur" +240 "%s: Kaldýr" +241 "%s: Kapat" +242 "%s: Kaldýr" +243 "%s: Kaldýr" +244 "Saltokunur dosya, yazýlmadý; yok saymak için ! kullanýn" +245 "Saltokunur dosya, yazýlmadý" +246 "%s mevcut, yazýlmadý; yok saymak için ! kullanýn" +247 "%s mevcut, yazýlmadý" +248 "Kýsmi dosya, yazýlmadý; yok saymak için ! kullanýn" +249 "Kýsmi dosya, yazýlmadý" +250 "%s: Dosya bu kopyadan daha önce deðiþtirilmiþ; yok saymak için ! kullanýn" +251 "%s: Dosya bu kopyadan daha önce deðiþtirilmiþ" +252 "%s: Yazým korumasý kullanýlabilir deðildi" +253 "Yazýlýyor..." +254 "%s: UYARI: DOSYA KIRPILMIÞ" +255 "Halihazýrda bu grubun ilk etiketinde" +256 "%s: Yeni dosya: %lu satýr, %lu karakter" +257 "%s: %lu satýr, %lu karakter" +258 "%s çok fazla dosya adýna geniþletilmiþ" +259 "%s: Sýradan bir dosya deðil" +260 "%s: Ýyesi siz deðilsiniz" +261 "%s: Ýyesi dýþýnda baþka bir kullanýcý tarafýndan da eriþilebilir" +262 "Dosya son tam yazýmdan bu yana deðiþtirilmiþ; yazýn veya yok saymak için ! kullanýn" +263 "Dosya son tam yazýmdan bu yana deðiþtirilmiþ; yazýn veya yok saymak için :edit! kullanýn" +264 "Dosya son tam yazýmdan bu yana deðiþtirilmiþ; yazýn veya yok saymak için ! kullanýn" +265 "Dosya geçici; çýkarsanýz deðiþiklikler atýlacaktýr" +266 "Dosya saltokunur, deðiþiklikler kendiliðinden yazýlmaz" +267 "Günlük yeniden baþlatýldý" +268 "Onayla? [ynq]" +269 "Sürdürmek için herhangi bir düðmeye basýn: " +270 "Sürdürmek için herhangi bir düðmeye basýn [ex komutu girmek için :]: " +271 "Sürdürmek için herhangi bir düðmeye basýn [çýkýþ için q]: " +272 "Bu biçim %s ex uçbirim arabirimini gerektirir" +273 "ex girdisi kipine giriliyor" +274 "Komut baþarýsýz, henüz bir dosya okunmadý." +275 " sürdür?" +276 "Beklenmedik karakter olayý" +277 "Beklenmedik dosya sonu olayý" +278 "Sorgu eþleþmesi bulunamadý" +279 "Beklenmedik yarýda kesme olayý" +281 "Beklenmedik yeniden boyama olayý" +282 "Halihazýrda bu grubun son etiketinde" +283 "%s komutu ex uçbirim arabirimini gerektirir" +284 "Bu biçim %s 'secure edit' seçeneði ayarlandýðýnda desteklenmez" +285 "Beklenmedik dizi olayý" +286 "Beklenmedik zaman aþýmý olayý" +288 "Bölünebilmesi için ekran %d sütundan daha geniþ olmalýdýr" +289 "Kabuk geniþletmeleri 'secure edit' seçeneði ayarlandýðýnda desteklenmez" +290 "%s komutu 'secure edit' seçeneði ayarlandýðýnda desteklenmez" +291 "set: %s seçeneði kapatýlamaz" +292 "Ekran çok küçük." +293 "eklendi" +294 "deðiþtirildi" +295 "silindi" +296 "uç uca eklendi" +297 "taþýndý" +298 "kaydýrýldý" +299 "kopyalandý" +300 "satýr" +301 "satýr" +303 "Dosya son yazýmdan bu yana deðiþtirilmiþ." +304 "Kabuk geniþletmesi baþarýsýz" +305 "Bir '%s' düzenleme seçeneði belirtilmedi" +307 "Çalýþtýrýlacak ex komutu yok" +308 "Bir komut çalýþtýrmak için , çýkmak için :q girin" +309 "Yardým için \"cscope help\" kullanýn" +310 "Çalýþan bir cscope baðlantýsý yok" +311 "%s: Bilinmeyen arama türü: Þunlardan bir tanesini kullanýn: %s" +312 "%d: Böyle bir cscope oturumu yok" +313 "set: %s seçeneði hiçbir zaman açýlamaz" +314 "set: %s seçeneði hiçbir zaman 0 olarak ayarlanamaz" +315 "%s: Ýliþtirildi: %lu satýr, %lu karakter" +316 "Beklenmedik yeniden boyutlandýrma olayý" +317 "Düzenlenecek %d dosya var" +319 "%d ekran arkaplana alýndý; onlarý listelemek için :display kullanýn" +320 "Bilinmeyen imleç konumu" +321 "Dosya kodlama dönüþtürmesi desteklenmiyor" +322 "Girdi kodlama dönüþtürmesi desteklenmiyor" +323 "Geçersiz girdi. Kýrpýldý." +324 "%d numaralý satýrda dönüþtürme hatasý" diff --git a/contrib/nvi/catalog/tr_TR.ISO8859-9.owner b/contrib/nvi/catalog/tr_TR.ISO8859-9.owner new file mode 100644 index 000000000000..2739e5bbfd61 --- /dev/null +++ b/contrib/nvi/catalog/tr_TR.ISO8859-9.owner @@ -0,0 +1 @@ +Emir SARI diff --git a/contrib/nvi/catalog/tr_TR.UTF-8.base b/contrib/nvi/catalog/tr_TR.UTF-8.base new file mode 100644 index 000000000000..9c27d4eb7423 --- /dev/null +++ b/contrib/nvi/catalog/tr_TR.UTF-8.base @@ -0,0 +1,304 @@ +002 "Satır uzunluÄŸu taşımı" +003 "%lu numaralı satır silinemiyor" +004 "%lu numaralı satıra iliÅŸtirilemiyor" +005 "%lu numaralı satırda ekleme yapılamıyor" +006 "%lu numaralı satır kaydedilemiyor" +007 "Son satır alınamıyor" +008 "Hata: %lu numaralı satır okunamıyor" +009 "Günlük dosyası" +010 "Günlükleme gerçekleÅŸtirilmiyor, geri alma olanaklı deÄŸil" +011 "Geri alınacak bir deÄŸiÅŸiklik yok" +012 "Günlükleme gerçekleÅŸtirilmiyor, geri alma olanaklı deÄŸil" +013 "Günlükleme gerçekleÅŸtirilmiyor, ileri sarma olanaklı deÄŸil" +014 "Yinelenecek bir deÄŸiÅŸiklik yok" +015 "%s/%d: Günlük kayıt hatası" +016 "Vi'nin standart girdisi ve çıktısı bir uçbirim olmalı" +017 "Ä°m %s: Ayarlanmamış" +018 "Ä°m %s: Satır silinmiÅŸ" +019 "Ä°m %s: Ä°mleç konumu artık yok" +020 "Hata: " +021 "yeni dosya +022 "adı deÄŸiÅŸti" +023 "deÄŸiÅŸtirildi" +024 "deÄŸiÅŸtirilmedi" +025 "KÄ°LÄ°DÄ° AÇILDI" +026 "saltokunur" +027 "satır %lu/%lu [%ld%%]" +028 "boÅŸ dosya" +029 "%lu. satır" +030 "%s dosyası bir ileti kataloÄŸu deÄŸil" +031 "Öntanımlı %s seçeneÄŸi ayarlanamadı" +032 "Kullanım: %s" +033 "set: %s seçeneÄŸi yok: 'set all' tüm seçenek deÄŸerlerini verir" +034 "set: [no]%s seçeneÄŸi bir deÄŸer almaz" +035 "set: %s seçeneÄŸi bir Boole deÄŸeri deÄŸil" +036 "set: %s seçeneÄŸi: %s" +037 "set: %s seçeneÄŸi: %s: DeÄŸer taşımı" +038 "set: %s seçeneÄŸi: %s izin verilmeyen bir sayı" +039 "set: %s seçeneÄŸi bir Boole deÄŸeri deÄŸil" +040 "Ekran sütun sayısı çok küçük, ÅŸundan daha az: %d" +041 "Ekran sütun sayısı çok büyük, ÅŸundan daha çok: %d" +042 "Ekran satır sayısı çok küçük, ÅŸundan daha az: %d" +043 "Ekran satır sayısı çok büyük, ÅŸundan daha çok: %d" +044 "Lisp seçeneÄŸi eklenmemiÅŸ" +045 "Ä°letiler kapatılmamış: %s" +046 "Ä°letiler açılmamış: %s" +047 "%s seçeneÄŸi iki karakterli öbekler biçiminde olmalı" +053 "BaÅŸlangıç arabelleÄŸi boÅŸ" +054 "%s arabelleÄŸi boÅŸ" +056 "Oturum baÅŸarısız olursa deÄŸiÅŸiklikler kurtarılamaz" +057 "Dosya, kurtarma için kopyalanıyor..." +058 "Koruma baÅŸarısız oldu: %s" +059 "Oturum baÅŸarısız olursa deÄŸiÅŸiklikler kurtarılamaz" +060 "Dosya yedeklemesi baÅŸarısız oldu: %s" +061 "Dosya, kurtarma için kopyalanıyor..." +062 "%u kullanıcısı üzerine bilgi bulunamadı" +063 "Kurtarma dosyası kilitlenemiyor" +065 "Kurtarma dosyası" +066 "%s: Hatalı oluÅŸturulmuÅŸ kurtarma dosyası" +067 "%s: Hatalı oluÅŸturulmuÅŸ kurtarma dosyası" +068 "Kurtarılacak %s adında sizce okunabilir bir dosya yok" +069 "Bu dosyanın kurtarabileceÄŸiniz eski sürümleri var" +070 "KurtarabileceÄŸiniz baÅŸka dosyalar var" +071 "E-posta gönderilmedi: %s" +072 "Dosya boÅŸ, aranacak bir ÅŸey yok" +073 "Dizgi bulunamadan dosyanın sonuna eriÅŸildi" +074 "Arama dizgisi yok" +075 "Dizgi bulunamadı" +076 "Dizgi bulunamadan dosyanın başına eriÅŸildi" +077 "Arama tamamlandı" +078 "Aranıyor..." +079 "Yazdırılamaz karakter bulunmadı" +080 "Bilinmeyen komut adı" +082 "%s: Komut ex kipinde kullanılamaz" +083 "Sayım sıfır olmayabilir" +084 "%s: Hatalı satır belirtimi" +085 "İç sözdizim tablo hatası (%s: %s)" +086 "Kullanım: %s" +087 "%s: Geçici arabellek salıverilmedi" +088 "Bayrak göreli konumu birinci satırdan önceye" +089 "Bayrak göreli konumu dosya sonunu geçiyor" +090 "Erimli @, dosya/ekran deÄŸiÅŸtiÄŸinde çalışır" +091 "Global/v komutu dosya/ekran deÄŸiÅŸtiÄŸinde çalışır" +092 "Ex komutu baÅŸarısız: Sıradaki komutlar çıkarıldı" +093 "Ex komutu baÅŸarısız: EÅŸlemlenen düğmeler çıkarıldı" +094 "Ä°kinci adres ilkinden daha küçük" +095 "Bir im adı saÄŸlanmadı" +096 "\\ sonrasında / veya ? gelmiyor" +097 "Bir satır numarasına yapılan baÅŸvuru sayısı sıfırdan az" +098 "Bilinmeyen komut: %s" +099 "Adres deÄŸeri taşımı" +100 "Adres deÄŸeri alttaşımı" +101 "Ä°zin verilmeyen adres birleÅŸimi" +102 "Ä°zin verilmeyen adres: Dosyada yalnızca %lu satır var" +103 "Ä°zin verilmeyen adres: Dosya boÅŸ" +104 "%s komutu bir 0 adresine izin vermiyor" +105 "Görüntülenecek kısaltma yok" +106 "Kısaltmalar bir \"sözcük\" karakteri ile bitmelidir" +107 "Kısaltmalar sekme veya boÅŸluk içeremez" +108 "Kısaltmalar sonu dışında sözcük/sözcük olmayan karakterleri karıştıramaz" +109 "\"%s\" bir kısaltma deÄŸil" +110 "Vi komutu baÅŸarısız: EÅŸlemlenen düğmeler çıkarıldı" +111 "Düzenlenecek baÅŸka dosya yok" +112 "Öncesinde düzenlenecek baÅŸka dosya yok" +113 "Öncesinde geri sarılacak dosyalar yok" +114 "Görüntülenecek dosya yok" +115 "Öncesinde \"!\" ögesinin yerine geçecek bir komut yok" +116 "%% yerine geçecek bir dosya adı yok" +117 "# yerine geçecek bir dosya adı yok" +118 "Hata: execl: %s" +119 "Girdi/Çıktı hatası: %s" +120 "Dosya son tam yazımdan bu yana deÄŸiÅŸtirilmiÅŸ; yazın veya yok saymak için ! kullanın" +121 "Ev dizini konumu bulunamıyor" +122 "Yeni ÅŸimdiki dizin: %s" +123 "Görüntülenecek kesilmiÅŸ arabellek yok" +124 "%s komutu bir global veya v komutunun parçası olarak kullanılamaz" +128 "%s: kaynak alınmıyor: Ä°yesi siz veya kök deÄŸil" +129 "%s: kaynak alınmıyor: Ä°yesi siz deÄŸilsiniz" +130 "%s: kaynak alınmıyor: Ä°yesi dışında baÅŸka bir kullanıcı tarafından yazılabilir" +131 "Uç uca eklenecek bir satır yok" +132 "Girdi eÅŸlem girdisi yok" +133 "Komut eÅŸlem girdisi yok" +134 "%s yeniden eÅŸlemlenemeyebilir" +135 "\"%s\" ÅŸu anda eÅŸlemlenmemiÅŸ" +136 "Ä°m adları tek bir karakter olmalıdır" +137 "%s mevcut, yazılmamış; yok saymak için ! kullanın" +138 "Yeni exrc dosyası: %s" +139 "Hedef satırı taşıma erimi içinde" +140 "'open' komutu 'open' seçeneÄŸinin ayarlı olmasını gerektirir" +141 "'open' komutu henüz eklenmemiÅŸ" +142 "Bu dosyanın korunması olanaklı deÄŸil" +143 "Dosya korundu" +144 "%s: Çok fazla dosya adına geniÅŸletilmiÅŸ" +145 "Yalnızca sıradan dosyalar ve adlandırılmış veri yolları okunabilir" +146 "%s: Okuma kilidi kullanılabilir deÄŸildi" +147 "Okunuyor..." +148 "%s: %lu satır, %lu karakter" +149 "Görüntülenecek arkaplan ekranı yok" +150 "'script' komutu yalnızca vi kipinde kullanılabilir" +151 "Çalıştırılacak komut yok" +152 "'shiftwidth' seçeneÄŸi 0 olarak ayarlanmış" +153 "Sayım taşımı" +154 "Sayım alttaşımı" +155 "Düzenli ifade belirtilmiÅŸ; r bayrağı anlamsız" +156 "#, l ve p bayrakları vi kipinde c bayrağı ile birlikte kullanılamaz" +157 "EÅŸleÅŸme bulunamadı" +158 "Önceden bir etiket girilmemiÅŸ" +159 "Etiket yığınında %s sayısından az girdi; :display t[ags] kullanın" +160 "Etiket yığınında dönülecek bir %s dosyası yok; :display t[ags] kullanın" +161 "Sürdürmek için Enter'a basın:" +162 "%s: Etiket bulunamadı" +163 "%s: %s içinde hasar görmüş etiket" +164 "%s: Etiketin satır numarası dosya sonunu geçmiÅŸ" +165 "Etiket yığını boÅŸ" +166 "%s: Arama dizgisi bulunamadı" +167 "%d dosya daha düzenlenecek" +168 "%s arabelleÄŸi boÅŸ" +169 "DeÄŸiÅŸikliÄŸi onayla? [n]" +170 "Yarıda kesildi" +171 "Öncesinde çalıştırılacak arabellek yok" +172 "Öncesinde düzenli ifade yok" +173 "%s komutu bir dosyanın halihazırda okunmuÅŸ olmasını gerektirir" +174 "Kullanım: %s" +175 "'visual' komutu 'open' seçeneÄŸinin ayarlanmış olmasını gerektirir" +177 "BoÅŸ dosya" +178 "Öncesinde F, f, T veya t araması yok" +179 "%s bulunamadı" +180 "Düzenlenecek dosya yok" +181 "Ä°mleç bir sayıda deÄŸil" +182 "Ortaya çıkan sayı çok büyük" +183 "Ortaya çıkan sayı çok küçük" +184 "Bu satırda eÅŸleÅŸen karakter yok" +185 "EÅŸleÅŸen karakter bulunamadı" +186 "DeÄŸiÅŸtirilecek karakter yok" +187 "Geçilecek baÅŸka ekran yok" +188 "Arama dizgisinden, satır ofsetinden ve/veya 'z' komutundan sonraki karakterler" *** 6370 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Sep 22 10:31:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A387B6AFB22; Wed, 22 Sep 2021 10:31:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDvhm3BLZz4tKQ; Wed, 22 Sep 2021 10:31:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44FA915BE6; Wed, 22 Sep 2021 10:31: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 18MAV3dq009212; Wed, 22 Sep 2021 10:31:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MAV3Km009211; Wed, 22 Sep 2021 10:31:03 GMT (envelope-from git) Date: Wed, 22 Sep 2021 10:31:03 GMT Message-Id: <202109221031.18MAV3Km009211@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 4380eb895aef - stable/12 - Fix vi build on Linux/macOS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4380eb895aef2730bebee95cd6431e1e744f2cb7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 10:31:04 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=4380eb895aef2730bebee95cd6431e1e744f2cb7 commit 4380eb895aef2730bebee95cd6431e1e744f2cb7 Author: Alex Richardson AuthorDate: 2020-09-21 09:03:42 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 10:27:39 +0000 Fix vi build on Linux/macOS This absolute include causes a build failure on Linux for me: .../cheri/freebsd/contrib/nvi/cl/../common/common.h:10:10: fatal error: '/usr/include/db.h' file not found This change patches the file to use #include instead until a solution has been found upstream. See also https://github.com/lichray/nvi2/issues/69 Reviewed By: bapt Differential Revision: https://reviews.freebsd.org/D26480 (cherry picked from commit 2bd2b113353d79cc7bdd315c3c76e0fc13218219) --- contrib/nvi/common/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/nvi/common/common.h b/contrib/nvi/common/common.h index ad559a5a2267..256fe6a0029a 100644 --- a/contrib/nvi/common/common.h +++ b/contrib/nvi/common/common.h @@ -7,7 +7,7 @@ * See the LICENSE file for redistribution information. */ -#include "/usr/include/db.h" /* Only include db1. */ +#include /* Only include db1. */ #include /* May refer to the bundled regex. */ /* From owner-dev-commits-src-all@freebsd.org Wed Sep 22 10:31:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED8906AFCE0; Wed, 22 Sep 2021 10:31:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDvhp1S49z4tKW; Wed, 22 Sep 2021 10:31:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 613CF15FB3; Wed, 22 Sep 2021 10:31:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18MAV4GN009236; Wed, 22 Sep 2021 10:31:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MAV4vW009235; Wed, 22 Sep 2021 10:31:04 GMT (envelope-from git) Date: Wed, 22 Sep 2021 10:31:04 GMT Message-Id: <202109221031.18MAV4vW009235@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: ee3ebf390811 - stable/12 - vi(1): Add URL to the vi/ex reference manual in the man page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ee3ebf390811f23f3215770dea037c1e2264a981 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 10:31:07 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=ee3ebf390811f23f3215770dea037c1e2264a981 commit ee3ebf390811f23f3215770dea037c1e2264a981 Author: Fernando Apesteguía AuthorDate: 2020-09-25 10:20:12 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 10:27:46 +0000 vi(1): Add URL to the vi/ex reference manual in the man page Reported in PR 241985 The manual page references the "vi/ex reference manual" but there is no information about where to find that document. Add a reference to the manual in the SEE ALSO section since the Project hosts a copy of it[1]. Change sent upstream[2] If D26158 gets reviewed and committed, we could close that PR. [1] https://docs.freebsd.org/44doc/usd/13.viref/paper.pdf). [2] https://github.com/lichray/nvi2/pull/85 Submitted by: freebsd@tim.thechases.com Approved by: manpages (gbe@) Differential Revision: https://reviews.freebsd.org/D26163 (cherry picked from commit f1cba2b70cd1f705d7b878e7b8d9f99fe389dc7a) --- contrib/nvi/man/vi.1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/nvi/man/vi.1 b/contrib/nvi/man/vi.1 index fcbc1531d9ac..8c75e9e66a33 100644 --- a/contrib/nvi/man/vi.1 +++ b/contrib/nvi/man/vi.1 @@ -12,7 +12,7 @@ .\" that you would have purchased it, or if any company wishes to .\" redistribute it, contributions to the authors would be appreciated. .\" -.Dd November 2, 2013 +.Dd September 25, 2020 .Dt VI 1 .Os .Sh NAME @@ -2743,6 +2743,10 @@ and \*(Gt0 if an error occurs. .Xr ctags 1 , .Xr iconv 1 , .Xr re_format 7 +.Rs +.%T vi/ex reference manual +.%U https://docs.freebsd.org/44doc/usd/13.viref/paper.pdf +.Re .Sh STANDARDS .Nm nex Ns / Ns Nm nvi is close to From owner-dev-commits-src-all@freebsd.org Wed Sep 22 10:31:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 19C5E6AF864; Wed, 22 Sep 2021 10:31:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDvhr1LDpz4tF1; Wed, 22 Sep 2021 10:31: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 853C116015; Wed, 22 Sep 2021 10:31:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18MAV5YD009267; Wed, 22 Sep 2021 10:31:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MAV53V009266; Wed, 22 Sep 2021 10:31:05 GMT (envelope-from git) Date: Wed, 22 Sep 2021 10:31:05 GMT Message-Id: <202109221031.18MAV53V009266@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 4365415046a3 - stable/12 - Update nvi to 2.2.0-05ed8b9 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4365415046a352c2b93553502ed3a3758da93197 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 10:31:09 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=4365415046a352c2b93553502ed3a3758da93197 commit 4365415046a352c2b93553502ed3a3758da93197 Author: Baptiste Daroussin AuthorDate: 2020-10-01 04:46:23 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 10:28:14 +0000 Update nvi to 2.2.0-05ed8b9 This version incorporates many fixes in particular a fix for vi -w Another approach was proposed to merge those fixes (see review), I find it easier to track changes if we keep importing snapshot on regular basis PR: 241985 Reported by: fernape Differential Revision: https://reviews.freebsd.org/D26158 (cherry picked from commit 755cc40c21ca63388c6a67ba848a908b429e9391) --- contrib/nvi/CMakeLists.txt | 24 ++++++++++++++-- contrib/nvi/catalog/dump.c | 12 ++++---- contrib/nvi/cl/cl.h | 4 ++- contrib/nvi/cl/cl_read.c | 1 + contrib/nvi/cl/cl_term.c | 6 ++-- contrib/nvi/common/common.h | 10 ++++++- contrib/nvi/common/cut.h | 4 +-- contrib/nvi/common/exf.c | 17 +++++++----- contrib/nvi/common/key.c | 4 +-- contrib/nvi/common/log.c | 4 +-- contrib/nvi/common/main.c | 11 ++++---- contrib/nvi/common/mark.c | 3 +- contrib/nvi/common/mem.h | 60 ++++++++++++++++++++-------------------- contrib/nvi/common/msg.c | 4 +++ contrib/nvi/common/options.c | 20 ++++++++++---- contrib/nvi/common/put.c | 3 +- contrib/nvi/common/recover.c | 9 +++--- contrib/nvi/common/util.c | 10 +++++-- contrib/nvi/ex/ex.c | 9 ++++-- contrib/nvi/ex/ex.h | 8 +++--- contrib/nvi/ex/ex_argv.c | 8 ++++++ contrib/nvi/ex/ex_bang.c | 3 +- contrib/nvi/ex/ex_cscope.c | 10 ++++--- contrib/nvi/ex/ex_filter.c | 3 +- contrib/nvi/ex/ex_global.c | 3 +- contrib/nvi/ex/ex_script.c | 2 ++ contrib/nvi/ex/ex_shell.c | 3 +- contrib/nvi/ex/ex_subst.c | 27 +++++++++--------- contrib/nvi/files/config.h.in | 9 ++++++ contrib/nvi/files/pathnames.h.in | 5 ++-- contrib/nvi/regex/engine.c | 2 +- contrib/nvi/regex/regexec.c | 6 ++-- contrib/nvi/vi/v_itxt.c | 4 +-- contrib/nvi/vi/v_paragraph.c | 10 ++++--- contrib/nvi/vi/v_section.c | 3 +- contrib/nvi/vi/v_sentence.c | 3 +- contrib/nvi/vi/v_txt.c | 11 ++++---- contrib/nvi/vi/vi.c | 4 +-- contrib/nvi/vi/vs_line.c | 10 ++++--- contrib/nvi/vi/vs_msg.c | 13 +++++---- contrib/nvi/vi/vs_refresh.c | 9 ++++-- contrib/nvi/vi/vs_relative.c | 7 +++-- contrib/nvi/vi/vs_smap.c | 4 +-- usr.bin/vi/catalog/Makefile | 3 +- usr.bin/vi/pathnames.h | 5 ++-- 45 files changed, 243 insertions(+), 147 deletions(-) diff --git a/contrib/nvi/CMakeLists.txt b/contrib/nvi/CMakeLists.txt index 00f43283f022..996e0e72de99 100644 --- a/contrib/nvi/CMakeLists.txt +++ b/contrib/nvi/CMakeLists.txt @@ -13,6 +13,7 @@ project(nvi2 C) include(CheckIncludeFiles) include(CheckFunctionExists) +include(CheckStructHasMember) include(CheckCSourceCompiles) mark_as_advanced(CMAKE_INSTALL_PREFIX) @@ -127,6 +128,7 @@ endif() if(USE_WIDECHAR) find_library(CURSES_LIBRARY NAMES ncursesw cursesw curses HINTS /usr/lib) + find_library(TERMINFO_LIBRARY NAMES tinfow terminfo HINTS /usr/lib) # link to the wchar_t awared BSD libregex.a add_library(regex STATIC) @@ -136,13 +138,14 @@ if(USE_WIDECHAR) target_link_libraries(nvi PRIVATE regex) else() find_library(CURSES_LIBRARY NAMES ncurses curses HINTS /usr/lib) + find_library(TERMINFO_LIBRARY NAMES tinfo terminfo HINTS /usr/lib) target_compile_options(nvi PRIVATE -Wno-pointer-sign) endif() -target_link_libraries(nvi PRIVATE ${CURSES_LIBRARY}) +target_link_libraries(nvi PRIVATE ${CURSES_LIBRARY} ${TERMINFO_LIBRARY}) if(USE_ICONV) - check_function_exists(__iconv ICONV_IN_LIBC) + check_function_exists(iconv ICONV_IN_LIBC) if(NOT ICONV_IN_LIBC) find_path(ICONV_INCLUDE_DIR iconv.h) find_library(ICONV_LIBRARY iconv) @@ -173,9 +176,26 @@ if(USE_ICONV) target_link_libraries(nvi PRIVATE ${ICONV_LIBRARY}) endif() +check_function_exists(getprogname GETPROGNAME_IN_LIBC) +check_function_exists(strlcpy STRLCPY_IN_LIBC) +if(NOT GETPROGNAME_IN_LIBC OR NOT STRLCPY_IN_LIBC) + find_package(PkgConfig REQUIRED) + pkg_check_modules(LIBBSD libbsd-overlay) + add_definitions(${LIBBSD_CFLAGS}) + target_link_libraries(nvi PRIVATE ${LIBBSD_LIBRARIES}) +endif() + +check_function_exists(dbopen DBOPEN_IN_LIBC) +if(NOT DBOPEN_IN_LIBC) + target_link_libraries(nvi PRIVATE db1) +endif() + check_include_files(libutil.h HAVE_LIBUTIL_H) check_include_files(ncurses.h HAVE_NCURSES_H) +check_include_files(ncursesw/ncurses.h HAVE_NCURSESW_NCURSES_H) +check_include_files(pty.h HAVE_PTY_H) check_include_files(term.h HAVE_TERM_H) +check_struct_has_member("struct dirent" d_namlen dirent.h HAVE_DIRENT_D_NAMLEN LANGUAGE C) configure_file(files/config.h.in config.h) diff --git a/contrib/nvi/catalog/dump.c b/contrib/nvi/catalog/dump.c index 74ab53b2f12c..8390e5022841 100644 --- a/contrib/nvi/catalog/dump.c +++ b/contrib/nvi/catalog/dump.c @@ -36,24 +36,24 @@ parse(FILE *fp) { int ch, s1, s2, s3; -#define TESTD(s) { \ +#define TESTD(s) do { \ if ((s = getc(fp)) == EOF) \ return; \ if (!isdigit(s)) \ continue; \ -} -#define TESTP { \ +} while (0) +#define TESTP do { \ if ((ch = getc(fp)) == EOF) \ return; \ if (ch != '|') \ continue; \ -} -#define MOVEC(t) { \ +} while (0) +#define MOVEC(t) do { \ do { \ if ((ch = getc(fp)) == EOF) \ return; \ } while (ch != (t)); \ -} +} while (0) for (;;) { MOVEC('"'); TESTD(s1); diff --git a/contrib/nvi/cl/cl.h b/contrib/nvi/cl/cl.h index 894e5ede7fa9..d230a55a56d7 100644 --- a/contrib/nvi/cl/cl.h +++ b/contrib/nvi/cl/cl.h @@ -10,7 +10,9 @@ #ifdef USE_WIDECHAR #define _XOPEN_SOURCE_EXTENDED #endif -#ifdef HAVE_NCURSES_H +#ifdef HAVE_NCURSESW_NCURSES_H +#include +#elif defined HAVE_NCURSES_H #include #else #include diff --git a/contrib/nvi/cl/cl_read.c b/contrib/nvi/cl/cl_read.c index f5f18fd616f1..ddf3acc1918c 100644 --- a/contrib/nvi/cl/cl_read.c +++ b/contrib/nvi/cl/cl_read.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include diff --git a/contrib/nvi/cl/cl_term.c b/contrib/nvi/cl/cl_term.c index 601460585530..106f37149565 100644 --- a/contrib/nvi/cl/cl_term.c +++ b/contrib/nvi/cl/cl_term.c @@ -424,16 +424,18 @@ cl_ssize(SCR *sp, int sigwinch, size_t *rowp, size_t *colp, int *changedp) if (row == 0 || col == 0) { if ((p = getenv("TERM")) == NULL) goto noterm; - if (row == 0) + if (row == 0) { if ((rval = tigetnum("lines")) < 0) msgq(sp, M_SYSERR, "tigetnum: lines"); else row = rval; - if (col == 0) + } + if (col == 0) { if ((rval = tigetnum("cols")) < 0) msgq(sp, M_SYSERR, "tigetnum: cols"); else col = rval; + } } /* If nothing else, well, it's probably a VT100. */ diff --git a/contrib/nvi/common/common.h b/contrib/nvi/common/common.h index 256fe6a0029a..dc4155610225 100644 --- a/contrib/nvi/common/common.h +++ b/contrib/nvi/common/common.h @@ -7,7 +7,15 @@ * See the LICENSE file for redistribution information. */ -#include /* Only include db1. */ +#ifndef TCSASOFT +#define TCSASOFT 0 +#endif + +#ifdef __linux__ +#include "/usr/include/db1/db.h" /* Only include db1. */ +#else +#include "/usr/include/db.h" /* Only include db1. */ +#endif #include /* May refer to the bundled regex. */ /* diff --git a/contrib/nvi/common/cut.h b/contrib/nvi/common/cut.h index d220cd8cc69c..a94c3f9ce58d 100644 --- a/contrib/nvi/common/cut.h +++ b/contrib/nvi/common/cut.h @@ -63,13 +63,13 @@ struct _text { /* Text: a linked list of lines. */ * Get named buffer 'name'. * Translate upper-case buffer names to lower-case buffer names. */ -#define CBNAME(sp, cbp, nch) { \ +#define CBNAME(sp, cbp, nch) do { \ CHAR_T L__name; \ L__name = isupper(nch) ? tolower(nch) : (nch); \ SLIST_FOREACH(cbp, sp->gp->cutq, q) \ if (cbp->name == L__name) \ break; \ -} +} while (0) /* Flags to the cut() routine. */ #define CUT_LINEMODE 0x01 /* Cut in line mode. */ diff --git a/contrib/nvi/common/exf.c b/contrib/nvi/common/exf.c index ccfa66ef4089..f9eb2150276d 100644 --- a/contrib/nvi/common/exf.c +++ b/contrib/nvi/common/exf.c @@ -199,7 +199,7 @@ file_init(SCR *sp, FREF *frp, char *rcv_name, int flags) if (!LF_ISSET(FS_OPENERR)) F_SET(frp, FR_NEWFILE); - ep->mtim = sb.st_mtimespec; + ep->mtim = sb.st_mtim; } else { /* * XXX @@ -218,7 +218,7 @@ file_init(SCR *sp, FREF *frp, char *rcv_name, int flags) ep->mdev = sb.st_dev; ep->minode = sb.st_ino; - ep->mtim = sb.st_mtimespec; + ep->mtim = sb.st_mtim; if (!S_ISREG(sb.st_mode)) msgq_str(sp, M_ERR, oname, @@ -796,7 +796,7 @@ file_write(SCR *sp, MARK *fm, MARK *tm, char *name, int flags) if (noname && !LF_ISSET(FS_FORCE | FS_APPEND) && ((F_ISSET(ep, F_DEVSET) && (sb.st_dev != ep->mdev || sb.st_ino != ep->minode)) || - timespeccmp(&sb.st_mtimespec, &ep->mtim, !=))) { + timespeccmp(&sb.st_mtim, &ep->mtim, !=))) { msgq_str(sp, M_ERR, name, LF_ISSET(FS_POSSIBLE) ? "250|%s: file modified more recently than this copy; use ! to override" : "251|%s: file modified more recently than this copy"); @@ -887,7 +887,7 @@ success_open: * we re-init the time. That way the user can clean up the disk * and rewrite without having to force it. */ - if (noname) + if (noname) { if (stat(name, &sb)) timepoint_system(&ep->mtim); else { @@ -895,8 +895,9 @@ success_open: ep->mdev = sb.st_dev; ep->minode = sb.st_ino; - ep->mtim = sb.st_mtimespec; + ep->mtim = sb.st_mtim; } + } /* * If the write failed, complain loudly. ex_writefp() has already @@ -925,11 +926,12 @@ success_open: */ if (LF_ISSET(FS_ALL) && !LF_ISSET(FS_APPEND)) { F_CLR(ep, F_MODIFIED); - if (F_ISSET(frp, FR_TMPFILE)) + if (F_ISSET(frp, FR_TMPFILE)) { if (noname) F_SET(frp, FR_TMPEXIT); else F_CLR(frp, FR_TMPEXIT); + } } p = msg_print(sp, name, &nf); @@ -1290,7 +1292,7 @@ file_m1(SCR *sp, int force, int flags) * unless force is also set. Otherwise, we fail unless forced or * there's another open screen on this file. */ - if (F_ISSET(ep, F_MODIFIED)) + if (F_ISSET(ep, F_MODIFIED)) { if (O_ISSET(sp, O_AUTOWRITE)) { if (!force && file_aw(sp, flags)) return (1); @@ -1300,6 +1302,7 @@ file_m1(SCR *sp, int force, int flags) "263|File modified since last complete write; write or use :edit! to override"); return (1); } + } return (file_m3(sp, force)); } diff --git a/contrib/nvi/common/key.c b/contrib/nvi/common/key.c index 23da0498a757..e71396893fd4 100644 --- a/contrib/nvi/common/key.c +++ b/contrib/nvi/common/key.c @@ -424,12 +424,12 @@ v_event_append(SCR *sp, EVENT *argp) } /* Remove events from the queue. */ -#define QREM(len) { \ +#define QREM(len) do { \ if ((gp->i_cnt -= len) == 0) \ gp->i_next = 0; \ else \ gp->i_next += len; \ -} +} while (0) /* * v_event_get -- diff --git a/contrib/nvi/common/log.c b/contrib/nvi/common/log.c index 5dcd9a2945fc..96b246efad02 100644 --- a/contrib/nvi/common/log.c +++ b/contrib/nvi/common/log.c @@ -69,10 +69,10 @@ static int apply_with(int (*)(SCR *, recno_t, CHAR_T *, size_t), SCR *, recno_t, u_char *, size_t); /* Try and restart the log on failure, i.e. if we run out of memory. */ -#define LOG_ERR { \ +#define LOG_ERR do { \ log_err(sp, __FILE__, __LINE__); \ return (1); \ -} +} while (0) /* offset of CHAR_T string in log needs to be aligned on some systems * because it is passed to db_set as a string diff --git a/contrib/nvi/common/main.c b/contrib/nvi/common/main.c index c0b81960bd55..a7e60f1af806 100644 --- a/contrib/nvi/common/main.c +++ b/contrib/nvi/common/main.c @@ -48,8 +48,8 @@ editor(GS *gp, int argc, char *argv[]) size_t len; u_int flags; int ch, flagchk, lflag, secure, startup, readonly, rval, silent; - char *tag_f, *wsizearg, path[256]; - CHAR_T *w; + char *tag_f, *wsizearg; + CHAR_T *w, path[256]; size_t wlen; /* Initialize the busy routine, if not defined by the screen. */ @@ -242,9 +242,9 @@ editor(GS *gp, int argc, char *argv[]) } if (wsizearg != NULL) { ARGS *av[2], a, b; - (void)snprintf(path, sizeof(path), "window=%s", wsizearg); + (void)SPRINTF(path, SIZE(path), L("window=%s"), wsizearg); a.bp = (CHAR_T *)path; - a.len = strlen(path); + a.len = SIZE(path); b.bp = NULL; b.len = 0; av[0] = &a; @@ -533,7 +533,7 @@ v_obsolete(char *argv[]) argv[0][1] = 'c'; (void)strlcpy(argv[0] + 2, p + 1, len); } - } else if (argv[0][0] == '-') + } else if (argv[0][0] == '-') { if (argv[0][1] == '\0') { argv[0] = strdup("-s"); if (argv[0] == NULL) { @@ -545,6 +545,7 @@ nomem: warn(NULL); argv[0][1] == 't' || argv[0][1] == 'w') && argv[0][2] == '\0') ++argv; + } return (0); } diff --git a/contrib/nvi/common/mark.c b/contrib/nvi/common/mark.c index 9af4612cb22a..86e3cb8ea6d9 100644 --- a/contrib/nvi/common/mark.c +++ b/contrib/nvi/common/mark.c @@ -216,12 +216,13 @@ mark_insdel(SCR *sp, lnop_t op, recno_t lno) abort(); case LINE_DELETE: SLIST_FOREACH(lmp, sp->ep->marks, q) - if (lmp->lno >= lno) + if (lmp->lno >= lno) { if (lmp->lno == lno) { F_SET(lmp, MARK_DELETED); (void)log_mark(sp, lmp); } else --lmp->lno; + } break; case LINE_INSERT: /* diff --git a/contrib/nvi/common/mem.h b/contrib/nvi/common/mem.h index 1e26a6ea6549..d24ec0b50b09 100644 --- a/contrib/nvi/common/mem.h +++ b/contrib/nvi/common/mem.h @@ -17,7 +17,7 @@ /* Increase the size of a malloc'd buffer. Two versions, one that * returns, one that jumps to an error label. */ -#define BINC_GOTO(sp, type, lp, llen, nlen) { \ +#define BINC_GOTO(sp, type, lp, llen, nlen) do { \ CHECK_TYPE(type *, lp) \ void *L__bincp; \ if ((nlen) > llen) { \ @@ -29,12 +29,12 @@ */ \ lp = L__bincp; \ } \ -} +} while (0) #define BINC_GOTOC(sp, lp, llen, nlen) \ BINC_GOTO(sp, char, lp, llen, nlen) #define BINC_GOTOW(sp, lp, llen, nlen) \ BINC_GOTO(sp, CHAR_T, lp, llen, (nlen) * sizeof(CHAR_T)) -#define BINC_RET(sp, type, lp, llen, nlen) { \ +#define BINC_RET(sp, type, lp, llen, nlen) do { \ CHECK_TYPE(type *, lp) \ void *L__bincp; \ if ((nlen) > llen) { \ @@ -46,7 +46,7 @@ */ \ lp = L__bincp; \ } \ -} +} while (0) #define BINC_RETC(sp, lp, llen, nlen) \ BINC_RET(sp, char, lp, llen, nlen) #define BINC_RETW(sp, lp, llen, nlen) \ @@ -57,7 +57,7 @@ * from a malloc'd buffer otherwise. Two versions, one that returns, one * that jumps to an error label. */ -#define GET_SPACE_GOTO(sp, type, bp, blen, nlen) { \ +#define GET_SPACE_GOTO(sp, type, bp, blen, nlen) do { \ CHECK_TYPE(type *, bp) \ GS *L__gp = (sp) == NULL ? NULL : (sp)->gp; \ if (L__gp == NULL || F_ISSET(L__gp, G_TMP_INUSE)) { \ @@ -70,12 +70,12 @@ blen = L__gp->tmp_blen; \ F_SET(L__gp, G_TMP_INUSE); \ } \ -} +} while (0) #define GET_SPACE_GOTOC(sp, bp, blen, nlen) \ GET_SPACE_GOTO(sp, char, bp, blen, nlen) #define GET_SPACE_GOTOW(sp, bp, blen, nlen) \ GET_SPACE_GOTO(sp, CHAR_T, bp, blen, (nlen) * sizeof(CHAR_T)) -#define GET_SPACE_RET(sp, type, bp, blen, nlen) { \ +#define GET_SPACE_RET(sp, type, bp, blen, nlen) do { \ CHECK_TYPE(type *, bp) \ GS *L__gp = (sp) == NULL ? NULL : (sp)->gp; \ if (L__gp == NULL || F_ISSET(L__gp, G_TMP_INUSE)) { \ @@ -88,7 +88,7 @@ blen = L__gp->tmp_blen; \ F_SET(L__gp, G_TMP_INUSE); \ } \ -} +} while (0) #define GET_SPACE_RETC(sp, bp, blen, nlen) \ GET_SPACE_RET(sp, char, bp, blen, nlen) #define GET_SPACE_RETW(sp, bp, blen, nlen) \ @@ -98,7 +98,7 @@ * Add space to a GET_SPACE returned buffer. Two versions, one that * returns, one that jumps to an error label. */ -#define ADD_SPACE_GOTO(sp, type, bp, blen, nlen) { \ +#define ADD_SPACE_GOTO(sp, type, bp, blen, nlen) do { \ CHECK_TYPE(type *, bp) \ GS *L__gp = (sp) == NULL ? NULL : (sp)->gp; \ if (L__gp == NULL || bp == (type *)L__gp->tmp_bp) { \ @@ -109,12 +109,12 @@ F_SET(L__gp, G_TMP_INUSE); \ } else \ BINC_GOTO(sp, type, bp, blen, nlen); \ -} +} while (0) #define ADD_SPACE_GOTOC(sp, bp, blen, nlen) \ ADD_SPACE_GOTO(sp, char, bp, blen, nlen) #define ADD_SPACE_GOTOW(sp, bp, blen, nlen) \ ADD_SPACE_GOTO(sp, CHAR_T, bp, blen, (nlen) * sizeof(CHAR_T)) -#define ADD_SPACE_RET(sp, type, bp, blen, nlen) { \ +#define ADD_SPACE_RET(sp, type, bp, blen, nlen) do { \ CHECK_TYPE(type *, bp) \ GS *L__gp = (sp) == NULL ? NULL : (sp)->gp; \ if (L__gp == NULL || bp == (type *)L__gp->tmp_bp) { \ @@ -125,70 +125,70 @@ F_SET(L__gp, G_TMP_INUSE); \ } else \ BINC_RET(sp, type, bp, blen, nlen); \ -} +} while (0) #define ADD_SPACE_RETC(sp, bp, blen, nlen) \ ADD_SPACE_RET(sp, char, bp, blen, nlen) #define ADD_SPACE_RETW(sp, bp, blen, nlen) \ ADD_SPACE_RET(sp, CHAR_T, bp, blen, (nlen) * sizeof(CHAR_T)) /* Free a GET_SPACE returned buffer. */ -#define FREE_SPACE(sp, bp, blen) { \ +#define FREE_SPACE(sp, bp, blen) do { \ GS *L__gp = (sp) == NULL ? NULL : (sp)->gp; \ if (L__gp != NULL && bp == L__gp->tmp_bp) \ F_CLR(L__gp, G_TMP_INUSE); \ else \ free(bp); \ -} -#define FREE_SPACEW(sp, bp, blen) { \ +} while (0) +#define FREE_SPACEW(sp, bp, blen) do { \ CHECK_TYPE(CHAR_T *, bp) \ FREE_SPACE(sp, (char *)bp, blen); \ -} +} while (0) /* * Malloc a buffer, casting the return pointer. Various versions. */ -#define CALLOC(sp, p, nmemb, size) { \ +#define CALLOC(sp, p, nmemb, size) do { \ if ((p = calloc(nmemb, size)) == NULL) \ msgq(sp, M_SYSERR, NULL); \ -} -#define CALLOC_GOTO(sp, p, nmemb, size) { \ +} while (0) +#define CALLOC_GOTO(sp, p, nmemb, size) do { \ if ((p = calloc(nmemb, size)) == NULL) \ goto alloc_err; \ -} -#define CALLOC_RET(sp, p, nmemb, size) { \ +} while (0) +#define CALLOC_RET(sp, p, nmemb, size) do { \ if ((p = calloc(nmemb, size)) == NULL) { \ msgq(sp, M_SYSERR, NULL); \ return (1); \ } \ -} +} while (0) -#define MALLOC(sp, p, size) { \ +#define MALLOC(sp, p, size) do { \ if ((p = malloc(size)) == NULL) \ msgq(sp, M_SYSERR, NULL); \ -} -#define MALLOC_GOTO(sp, p, size) { \ +} while (0) +#define MALLOC_GOTO(sp, p, size) do { \ if ((p = malloc(size)) == NULL) \ goto alloc_err; \ -} -#define MALLOC_RET(sp, p, size) { \ +} while (0) +#define MALLOC_RET(sp, p, size) do { \ if ((p = malloc(size)) == NULL) { \ msgq(sp, M_SYSERR, NULL); \ return (1); \ } \ -} +} while (0) /* * Resize a buffer, free any already held memory if we can't get more. * FreeBSD's reallocf(3) does the same thing, but it's not portable yet. */ -#define REALLOC(sp, p, cast, size) { \ +#define REALLOC(sp, p, cast, size) do { \ cast newp; \ if ((newp = realloc(p, size)) == NULL) { \ free(p); \ msgq(sp, M_SYSERR, NULL); \ } \ p = newp; \ -} +} while (0) /* * p2roundup -- diff --git a/contrib/nvi/common/msg.c b/contrib/nvi/common/msg.c index d2463a3ecccd..7499f451be59 100644 --- a/contrib/nvi/common/msg.c +++ b/contrib/nvi/common/msg.c @@ -731,7 +731,11 @@ msg_open(SCR *sp, char *file) * corrupt catalog file. Errno == 0 is not rare; add * EFTYPE, which is seen on FreeBSD, for a good measure. */ +#ifdef EFTYPE if (errno == 0 || errno == EFTYPE) +#else + if (errno == 0) +#endif msgq_str(sp, M_ERR, p, "030|The file %s is not a message catalog"); else diff --git a/contrib/nvi/common/options.c b/contrib/nvi/common/options.c index 25b10fe67012..d5c039f97228 100644 --- a/contrib/nvi/common/options.c +++ b/contrib/nvi/common/options.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "common.h" @@ -312,7 +313,7 @@ opts_init(SCR *sp, int *oargs) argv[1] = &b; /* Set numeric and string default values. */ -#define OI(indx, str) { \ +#define OI(indx, str) do { \ a.len = STRLEN(str); \ if ((CHAR_T*)str != b2) /* GCC puts strings in text-space. */ \ (void)MEMCPY(b2, str, a.len+1); \ @@ -320,7 +321,7 @@ opts_init(SCR *sp, int *oargs) optindx = indx; \ goto err; \ } \ -} +} while (0) /* * Indirect global options to global space. Specifically, set up * terminal, lines, columns first, they're used by other options. @@ -366,7 +367,7 @@ opts_init(SCR *sp, int *oargs) OI(O_PARAGRAPHS, L("paragraphs=IPLPPPQPP LIpplpipbp")); (void)SPRINTF(b2, SIZE(b2), L("path=%s"), ""); OI(O_PATH, b2); - (void)SPRINTF(b2, SIZE(b2), L("recdir=%s"), _PATH_PRESERVE); + (void)SPRINTF(b2, SIZE(b2), L("recdir=%s"), NVI_PATH_PRESERVE); OI(O_RECDIR, b2); OI(O_SECTIONS, L("sections=NHSHH HUnhsh")); (void)SPRINTF(b2, SIZE(b2), @@ -573,13 +574,14 @@ opts_set(SCR *sp, ARGS *argv[], char *usage) * functions can be expensive. */ isset = !turnoff; - if (!F_ISSET(op, OPT_ALWAYS)) + if (!F_ISSET(op, OPT_ALWAYS)) { if (isset) { if (O_ISSET(sp, offset)) break; } else if (!O_ISSET(sp, offset)) break; + } /* Report to subsystems. */ if ((op->func != NULL && @@ -945,6 +947,7 @@ static int opts_print(SCR *sp, OPTLIST const *op) { int curlen, offset; + const char *p; curlen = 0; offset = op - optlist; @@ -958,8 +961,13 @@ opts_print(SCR *sp, OPTLIST const *op) curlen += ex_printf(sp, WS"=%ld", op->name, O_VAL(sp, offset)); break; case OPT_STR: - curlen += ex_printf(sp, WS"=\"%s\"", op->name, - O_STR(sp, offset) == NULL ? "" : O_STR(sp, offset)); + curlen += ex_printf(sp, WS"=\"", op->name); + p = O_STR(sp, offset); + /* Keep correct count for unprintable character sequences */ + if (p != NULL) + for (; *p != '\0'; ++p) + curlen += ex_puts(sp, unctrl(*p)); + curlen += ex_puts(sp, "\""); break; } return (curlen); diff --git a/contrib/nvi/common/put.c b/contrib/nvi/common/put.c index 26a67ac8711c..f39948808e7d 100644 --- a/contrib/nvi/common/put.c +++ b/contrib/nvi/common/put.c @@ -39,7 +39,7 @@ put(SCR *sp, CB *cbp, CHAR_T *namep, MARK *cp, MARK *rp, int append) CHAR_T *bp, *t; CHAR_T *p; - if (cbp == NULL) + if (cbp == NULL) { if (namep == NULL) { cbp = sp->gp->dcbp; if (cbp == NULL) { @@ -56,6 +56,7 @@ put(SCR *sp, CB *cbp, CHAR_T *namep, MARK *cp, MARK *rp, int append) return (1); } } + } tp = TAILQ_FIRST(cbp->textq); /* diff --git a/contrib/nvi/common/recover.c b/contrib/nvi/common/recover.c index 89f25a4146e9..120cf4f60b19 100644 --- a/contrib/nvi/common/recover.c +++ b/contrib/nvi/common/recover.c @@ -421,7 +421,7 @@ rcv_mailfile(SCR *sp, int issync, char *cp_path) getprogname(), " -r ", qt); free(qt); free(host); - if (buf == NULL) { + if (len == -1) { msgq(sp, M_SYSERR, NULL); goto err; } @@ -701,7 +701,7 @@ rcv_read(SCR *sp, FREF *frp) /* If we've found more than one, take the most recent. */ (void)fstat(fileno(fp), &sb); if (recp == NULL || - timespeccmp(&rec_mtim, &sb.st_mtimespec, <)) { + timespeccmp(&rec_mtim, &sb.st_mtim, <)) { p = recp; t = pathp; recp = recpath; @@ -710,7 +710,7 @@ rcv_read(SCR *sp, FREF *frp) free(p); free(t); } - rec_mtim = sb.st_mtimespec; + rec_mtim = sb.st_mtim; if (sv_fd != -1) (void)close(sv_fd); sv_fd = dup(fileno(fp)); @@ -813,8 +813,7 @@ rcv_email(SCR *sp, char *fname) { char *buf; - (void)asprintf(&buf, _PATH_SENDMAIL " -odb -t < %s", fname); - if (buf == NULL) { + if (asprintf(&buf, _PATH_SENDMAIL " -odb -t < %s", fname) == -1) { msgq_str(sp, M_ERR, strerror(errno), "071|not sending email: %s"); return; diff --git a/contrib/nvi/common/util.c b/contrib/nvi/common/util.c index 1e87c6293550..8046ce373016 100644 --- a/contrib/nvi/common/util.c +++ b/contrib/nvi/common/util.c @@ -111,8 +111,9 @@ join(char *path1, char *path2) if (path1[0] == '\0' || path2[0] == '/') return strdup(path2); - (void)asprintf(&p, path1[strlen(path1)-1] == '/' ? - "%s%s" : "%s/%s", path1, path2); + if (asprintf(&p, path1[strlen(path1)-1] == '/' ? + "%s%s" : "%s/%s", path1, path2) == -1) + return NULL; return p; } @@ -140,8 +141,13 @@ expanduser(char *str) continue; if (t == p) { /* ~ */ +#ifdef __GLIBC__ + extern char *secure_getenv(const char *); + if ((h = secure_getenv("HOME")) == NULL) { +#else if (issetugid() != 0 || (h = getenv("HOME")) == NULL) { +#endif if (((h = getlogin()) != NULL && (pwd = getpwnam(h)) != NULL) || (pwd = getpwuid(getuid())) != NULL) diff --git a/contrib/nvi/ex/ex.c b/contrib/nvi/ex/ex.c index c93d49717b22..343131537afa 100644 --- a/contrib/nvi/ex/ex.c +++ b/contrib/nvi/ex/ex.c @@ -811,13 +811,14 @@ skip_srch: if (ecp->cmd == &cmds[C_VISUAL_EX] && F_ISSET(sp, SC_VI)) * this isn't a particularly complex trap, and if backslashes were * legal in set commands, this would have to be much more complicated. */ - if (ecp->cmd == &cmds[C_SET]) + if (ecp->cmd == &cmds[C_SET]) { for (p = ecp->cp, len = ecp->clen; len > 0; --len, ++p) if (IS_ESCAPE(sp, ecp, *p) && len > 1) { --len; ++p; } else if (*p == '\\') *p = CH_LITERAL; + } /* * Set the default addresses. It's an error to specify an address for @@ -1254,7 +1255,7 @@ addr_verify: ex_badaddr(sp, ecp->cmd, A_ZERO, NUM_OK); goto err; } - } else if (!db_exist(sp, ecp->addr2.lno)) + } else if (!db_exist(sp, ecp->addr2.lno)) { if (FL_ISSET(ecp->iflags, E_C_COUNT)) { if (db_last(sp, &lno)) goto err; @@ -1263,6 +1264,7 @@ addr_verify: ex_badaddr(sp, NULL, A_EOF, NUM_OK); goto err; } + } /* FALLTHROUGH */ case 1: if (ecp->addr1.lno == 0) { @@ -2117,7 +2119,7 @@ ex_load(SCR *sp) /* If it's a global/v command, fix up the last line. */ if (FL_ISSET(ecp->agv_flags, - AGV_GLOBAL | AGV_V) && ecp->range_lno != OOBLNO) + AGV_GLOBAL | AGV_V) && ecp->range_lno != OOBLNO) { if (db_exist(sp, ecp->range_lno)) sp->lno = ecp->range_lno; else { @@ -2126,6 +2128,7 @@ ex_load(SCR *sp) if (sp->lno == 0) sp->lno = 1; } + } free(ecp->o_cp); } diff --git a/contrib/nvi/ex/ex.h b/contrib/nvi/ex/ex.h index 5ccf7c6c362b..b2d8ad0f4fef 100644 --- a/contrib/nvi/ex/ex.h +++ b/contrib/nvi/ex/ex.h @@ -55,12 +55,12 @@ extern EXCMDLIST const cmds[]; /* Table of ex commands. */ * at any time, and most of them won't work well if a file hasn't yet been read * in. Historic vi generally took the easy way out and dropped core. */ -#define NEEDFILE(sp, cmdp) { \ +#define NEEDFILE(sp, cmdp) do { \ if ((sp)->ep == NULL) { \ ex_wemsg(sp, (cmdp)->cmd->name, EXM_NOFILEYET); \ return (1); \ } \ -} +} while (0) /* Range structures for global and @ commands. */ typedef struct _range RANGE; @@ -102,12 +102,12 @@ struct _excmd { u_int8_t agv_flags; /* Clear the structure before each ex command. */ -#define CLEAR_EX_CMD(cmdp) { \ +#define CLEAR_EX_CMD(cmdp) do { \ u_int32_t L__f = F_ISSET(cmdp, E_PRESERVE); \ memset(&((cmdp)->buffer), 0, ((char *)&(cmdp)->flags - \ (char *)&((cmdp)->buffer)) + sizeof((cmdp)->flags)); \ F_SET(cmdp, L__f); \ -} +} while (0) CHAR_T buffer; /* Command: named buffer. */ recno_t lineno; /* Command: line number. */ diff --git a/contrib/nvi/ex/ex_argv.c b/contrib/nvi/ex/ex_argv.c index d6f9a8bb8aa5..8b1fd7858fb1 100644 --- a/contrib/nvi/ex/ex_argv.c +++ b/contrib/nvi/ex/ex_argv.c @@ -611,9 +611,17 @@ argv_flt_path(SCR *sp, EXCMD *excp, CHAR_T *path, size_t plen) if (nlen == 0) { if (dp->d_name[0] == '.') continue; +#ifdef HAVE_DIRENT_D_NAMLEN len = dp->d_namlen; +#else + len = strlen(dp->d_name); +#endif } else { +#ifdef HAVE_DIRENT_D_NAMLEN len = dp->d_namlen; +#else + len = strlen(dp->d_name); +#endif if (len < nlen || memcmp(dp->d_name, name, nlen)) continue; } diff --git a/contrib/nvi/ex/ex_bang.c b/contrib/nvi/ex/ex_bang.c index ff2b39bbff9a..c5744708664a 100644 --- a/contrib/nvi/ex/ex_bang.c +++ b/contrib/nvi/ex/ex_bang.c @@ -96,7 +96,7 @@ ex_bang(SCR *sp, EXCMD *cmdp) */ if (cmdp->addrcnt == 0) { msg = NULL; - if (sp->ep != NULL && F_ISSET(sp->ep, F_MODIFIED)) + if (sp->ep != NULL && F_ISSET(sp->ep, F_MODIFIED)) { if (O_ISSET(sp, O_AUTOWRITE)) { if (file_aw(sp, FS_ALL)) return (0); @@ -105,6 +105,7 @@ ex_bang(SCR *sp, EXCMD *cmdp) msg = msg_cat(sp, "303|File modified since last write.", NULL); + } /* If we're still in a vi screen, move out explicitly. */ INT2CHAR(sp, ap->bp, ap->len+1, np, nlen); diff --git a/contrib/nvi/ex/ex_cscope.c b/contrib/nvi/ex/ex_cscope.c index 629861d55680..74d7f8af95be 100644 --- a/contrib/nvi/ex/ex_cscope.c +++ b/contrib/nvi/ex/ex_cscope.c @@ -261,7 +261,7 @@ cscope_add(SCR *sp, EXCMD *cmdp, CHAR_T *dname) csc->dname = csc->buf; csc->dlen = len; memcpy(csc->dname, np, len); - csc->mtim = sb.st_mtimespec; + csc->mtim = sb.st_mtim; /* Get the search paths for the cscope. */ if (get_paths(sp, csc)) @@ -411,7 +411,8 @@ err: if (to_cs[0] != -1) free(dn); goto nomem; } - (void)asprintf(&cmd, CSCOPE_CMD_FMT, dn, dbn); + if (asprintf(&cmd, CSCOPE_CMD_FMT, dn, dbn) == -1) + cmd = NULL; free(dbn); free(dn); if (cmd == NULL) { @@ -812,7 +813,7 @@ csc_file(SCR *sp, CSC *csc, char *name, char **dirp, size_t *dlenp, int *isolder *dirp = *pp; *dlenp = strlen(*pp); *isolderp = timespeccmp( - &sb.st_mtimespec, &csc->mtim, <); + &sb.st_mtim, &csc->mtim, <); return; } free(buf); @@ -843,7 +844,7 @@ csc_help(SCR *sp, char *cmd) { CC const *ccp; - if (cmd != NULL && *cmd != '\0') + if (cmd != NULL && *cmd != '\0') { if ((ccp = lookup_ccmd(cmd)) == NULL) { ex_printf(sp, "%s doesn't match any cscope command\n", cmd); @@ -854,6 +855,7 @@ csc_help(SCR *sp, char *cmd) *** 675 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Sep 22 10:31:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C88916AF8F9; Wed, 22 Sep 2021 10:31:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDvhs3WT3z4t8m; Wed, 22 Sep 2021 10:31: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 A8A9615BE8; Wed, 22 Sep 2021 10:31:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18MAV6uW009291; Wed, 22 Sep 2021 10:31:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MAV6kY009290; Wed, 22 Sep 2021 10:31:06 GMT (envelope-from git) Date: Wed, 22 Sep 2021 10:31:06 GMT Message-Id: <202109221031.18MAV6kY009290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: f7419feda999 - stable/12 - Fix buildworld on Linux/macOS after nvi update MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f7419feda99979db61a7d24d61c2cfe4ed89e206 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 10:31:10 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=f7419feda99979db61a7d24d61c2cfe4ed89e206 commit f7419feda99979db61a7d24d61c2cfe4ed89e206 Author: Alex Richardson AuthorDate: 2020-10-12 10:42:24 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 10:28:54 +0000 Fix buildworld on Linux/macOS after nvi update This re-applies r365941 which was lost in the nvi update. (cherry picked from commit 5ce117c698bce69808f214781fe03a2c0f451d9f) --- contrib/nvi/common/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/nvi/common/common.h b/contrib/nvi/common/common.h index dc4155610225..f2cb42fa9b9c 100644 --- a/contrib/nvi/common/common.h +++ b/contrib/nvi/common/common.h @@ -14,7 +14,7 @@ #ifdef __linux__ #include "/usr/include/db1/db.h" /* Only include db1. */ #else -#include "/usr/include/db.h" /* Only include db1. */ +#include /* Only include db1. */ #endif #include /* May refer to the bundled regex. */ From owner-dev-commits-src-all@freebsd.org Wed Sep 22 10:31:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B06F56AFCEA; Wed, 22 Sep 2021 10:31: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 4HDvht3mVgz4t7D; Wed, 22 Sep 2021 10:31: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 CB31F15E36; Wed, 22 Sep 2021 10:31: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 18MAV7A4009315; Wed, 22 Sep 2021 10:31:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MAV7Pw009314; Wed, 22 Sep 2021 10:31:07 GMT (envelope-from git) Date: Wed, 22 Sep 2021 10:31:07 GMT Message-Id: <202109221031.18MAV7Pw009314@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 9fce0d7cec50 - stable/12 - nvi: fix catalog generation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 9fce0d7cec501ece2839ae1ef2198e8ae13f8a08 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 10:31:11 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=9fce0d7cec501ece2839ae1ef2198e8ae13f8a08 commit 9fce0d7cec501ece2839ae1ef2198e8ae13f8a08 Author: dankm AuthorDate: 2021-02-26 15:32:01 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 10:29:09 +0000 nvi: fix catalog generation Upstream broke catalog generation with some over-eagre style cleanups. This brings in my pull request. Obtained from: https://github.com/lichray/nvi2/pull/88 Differential Revision: https://reviews.freebsd.org/D28594 (cherry picked from commit 888ae5725257c251319f14f31c2e941717b675f2) --- contrib/nvi/catalog/dump.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/nvi/catalog/dump.c b/contrib/nvi/catalog/dump.c index 8390e5022841..74ab53b2f12c 100644 --- a/contrib/nvi/catalog/dump.c +++ b/contrib/nvi/catalog/dump.c @@ -36,24 +36,24 @@ parse(FILE *fp) { int ch, s1, s2, s3; -#define TESTD(s) do { \ +#define TESTD(s) { \ if ((s = getc(fp)) == EOF) \ return; \ if (!isdigit(s)) \ continue; \ -} while (0) -#define TESTP do { \ +} +#define TESTP { \ if ((ch = getc(fp)) == EOF) \ return; \ if (ch != '|') \ continue; \ -} while (0) -#define MOVEC(t) do { \ +} +#define MOVEC(t) { \ do { \ if ((ch = getc(fp)) == EOF) \ return; \ } while (ch != (t)); \ -} while (0) +} for (;;) { MOVEC('"'); TESTD(s1); From owner-dev-commits-src-all@freebsd.org Wed Sep 22 10:31:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2ACC6AFF0B; Wed, 22 Sep 2021 10:31: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 4HDvhv3jGVz4tKn; Wed, 22 Sep 2021 10:31: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 E741F1619A; Wed, 22 Sep 2021 10:31: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 18MAV8Xh009341; Wed, 22 Sep 2021 10:31:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MAV8OE009340; Wed, 22 Sep 2021 10:31:08 GMT (envelope-from git) Date: Wed, 22 Sep 2021 10:31:08 GMT Message-Id: <202109221031.18MAV8OE009340@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 4581de213ef4 - stable/12 - import nvi 2.2.0-3bbdfe4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4581de213ef452b0e593a7d87b930d48d64aa71d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 10:31:13 -0000 The branch stable/12 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=4581de213ef452b0e593a7d87b930d48d64aa71d commit 4581de213ef452b0e593a7d87b930d48d64aa71d Author: Baptiste Daroussin AuthorDate: 2021-05-21 20:50:50 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 10:29:20 +0000 import nvi 2.2.0-3bbdfe4 (cherry picked from commit 6680e5a52f8abf059bbbd3e0be66d9dce476cdf9) --- contrib/nvi/.gitignore | 5 + contrib/nvi/CMakeLists.txt | 38 +- contrib/nvi/cl/cl.h | 3 - contrib/nvi/cl/cl_read.c | 4 +- contrib/nvi/cl/extern.h | 31 -- contrib/nvi/common/common.h | 6 +- contrib/nvi/common/conv.h | 2 +- contrib/nvi/common/exf.c | 27 ++ contrib/nvi/common/extern.h | 131 ------- contrib/nvi/common/key.h | 6 +- contrib/nvi/common/options.h | 4 + contrib/nvi/common/recover.c | 12 + contrib/nvi/ex/ex.c | 3 +- contrib/nvi/ex/ex_cscope.c | 14 + contrib/nvi/ex/extern.h | 131 ------- contrib/nvi/man/vi.1 | 50 ++- contrib/nvi/vi/extern.h | 145 -------- contrib/nvi/vi/v_increment.c | 4 +- contrib/nvi/vi/vs_line.c | 2 +- usr.bin/vi/Makefile | 5 +- usr.bin/vi/config.h | 9 + {contrib/nvi => usr.bin/vi}/ex/version.h | 2 + {contrib/nvi/ex => usr.bin/vi}/ex_def.h | 0 usr.bin/vi/extern.h | 444 +++++++++++++++++++++++ {contrib/nvi/common => usr.bin/vi}/options_def.h | 0 25 files changed, 607 insertions(+), 471 deletions(-) diff --git a/contrib/nvi/.gitignore b/contrib/nvi/.gitignore index aac7860d7299..2b79229e57e0 100644 --- a/contrib/nvi/.gitignore +++ b/contrib/nvi/.gitignore @@ -7,3 +7,8 @@ extern.h version.h tags build/ + +# Ignore files by the GNU Global source code tagging system. +/GPATH +/GRTAGS +/GTAGS diff --git a/contrib/nvi/CMakeLists.txt b/contrib/nvi/CMakeLists.txt index 996e0e72de99..66d3ca2aafb0 100644 --- a/contrib/nvi/CMakeLists.txt +++ b/contrib/nvi/CMakeLists.txt @@ -13,20 +13,28 @@ project(nvi2 C) include(CheckIncludeFiles) include(CheckFunctionExists) +include(CheckSymbolExists) include(CheckStructHasMember) include(CheckCSourceCompiles) +include(CheckCCompilerFlag) mark_as_advanced(CMAKE_INSTALL_PREFIX) option(USE_WIDECHAR "Enable wide character support" ON) option(USE_ICONV "Enable iconv support" ON) -add_compile_options(-fcolor-diagnostics) +check_c_compiler_flag(-fcolor-diagnostics USE_FCOLOR_DIAGNOSTICS) +if(USE_FCOLOR_DIAGNOSTICS) + add_compile_options(-fcolor-diagnostics) +endif() + add_compile_options($<$:-Wall>) add_compile_options($<$:-Wno-parentheses>) add_compile_options($<$:-Wno-uninitialized>) add_compile_options($<$:-Wmissing-prototypes>) -add_compile_options($<$:-Wsystem-headers>) +if (NOT APPLE) + add_compile_options($<$:-Wsystem-headers>) +endif() add_compile_options($<$:-Wuninitialized>) add_compile_options($<$:-Wno-dangling-else>) add_compile_options(-Wstack-protector -fstack-protector) @@ -126,6 +134,11 @@ if(NOT RESOLV_IN_LIBC) target_link_libraries(nvi PRIVATE ${RESOLV_LIBRARY}) endif() +check_symbol_exists(asprintf "stdio.h" ASPRINTF_IN_STDIO_H) +if(NOT ASPRINTF_IN_STDIO_H) + target_compile_definitions(nvi PRIVATE _GNU_SOURCE) +endif() + if(USE_WIDECHAR) find_library(CURSES_LIBRARY NAMES ncursesw cursesw curses HINTS /usr/lib) find_library(TERMINFO_LIBRARY NAMES tinfow terminfo HINTS /usr/lib) @@ -142,7 +155,10 @@ else() target_compile_options(nvi PRIVATE -Wno-pointer-sign) endif() -target_link_libraries(nvi PRIVATE ${CURSES_LIBRARY} ${TERMINFO_LIBRARY}) +target_link_libraries(nvi PRIVATE ${CURSES_LIBRARY}) +if(TERMINFO_LIBRARY) + target_link_libraries(nvi PRIVATE ${TERMINFO_LIBRARY}) +endif() if(USE_ICONV) check_function_exists(iconv ICONV_IN_LIBC) @@ -189,6 +205,18 @@ check_function_exists(dbopen DBOPEN_IN_LIBC) if(NOT DBOPEN_IN_LIBC) target_link_libraries(nvi PRIVATE db1) endif() +if (APPLE) + # Avoid using an incompatible db.h installed to /usr/local (since this is + # part of the default search path on macOS) + set(DB_H_GUESS "${CMAKE_OSX_SYSROOT}/usr/include/db.h") + if (NOT EXISTS ${DB_H_GUESS}) + message(FATAL_ERROR "Could not find db.h at the expected path (${DB_H_GUESS}).") + endif() + add_definitions("-DDB_H_ABS_PATH=<${DB_H_GUESS}>") +else() + find_path(DB_INCLUDE_DIR db.h PATH_SUFFIXES db1) + target_include_directories(nvi PRIVATE ${DB_INCLUDE_DIR}) +endif() check_include_files(libutil.h HAVE_LIBUTIL_H) check_include_files(ncurses.h HAVE_NCURSES_H) @@ -196,6 +224,10 @@ check_include_files(ncursesw/ncurses.h HAVE_NCURSESW_NCURSES_H) check_include_files(pty.h HAVE_PTY_H) check_include_files(term.h HAVE_TERM_H) check_struct_has_member("struct dirent" d_namlen dirent.h HAVE_DIRENT_D_NAMLEN LANGUAGE C) +check_struct_has_member("struct stat" st_mtimespec + "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIMESPEC LANGUAGE C) +check_struct_has_member("struct stat" st_mtim + "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM LANGUAGE C) configure_file(files/config.h.in config.h) diff --git a/contrib/nvi/cl/cl.h b/contrib/nvi/cl/cl.h index d230a55a56d7..a04c9e9f1b0d 100644 --- a/contrib/nvi/cl/cl.h +++ b/contrib/nvi/cl/cl.h @@ -7,9 +7,6 @@ * See the LICENSE file for redistribution information. */ -#ifdef USE_WIDECHAR -#define _XOPEN_SOURCE_EXTENDED -#endif #ifdef HAVE_NCURSESW_NCURSES_H #include #elif defined HAVE_NCURSES_H diff --git a/contrib/nvi/cl/cl_read.c b/contrib/nvi/cl/cl_read.c index ddf3acc1918c..8dc1d3cbebc9 100644 --- a/contrib/nvi/cl/cl_read.c +++ b/contrib/nvi/cl/cl_read.c @@ -317,10 +317,10 @@ cl_resize(SCR *sp, size_t lines, size_t columns) argv[0] = &a; argv[1] = &b; - a.len = SPRINTF(b1, sizeof(b1), L("lines=%lu"), (u_long)lines); + a.len = SPRINTF(b1, SIZE(b1), L("lines=%lu"), (u_long)lines); if (opts_set(sp, argv, NULL)) return (1); - a.len = SPRINTF(b1, sizeof(b1), L("columns=%lu"), (u_long)columns); + a.len = SPRINTF(b1, SIZE(b1), L("columns=%lu"), (u_long)columns); if (opts_set(sp, argv, NULL)) return (1); return (0); diff --git a/contrib/nvi/cl/extern.h b/contrib/nvi/cl/extern.h deleted file mode 100644 index 7b01ccd3f8cf..000000000000 --- a/contrib/nvi/cl/extern.h +++ /dev/null @@ -1,31 +0,0 @@ -int cl_waddstr(SCR *, const CHAR_T *, size_t); -int cl_addstr(SCR *, const char *, size_t); -int cl_attr(SCR *, scr_attr_t, int); -int cl_baud(SCR *, u_long *); -int cl_bell(SCR *); -int cl_clrtoeol(SCR *); -int cl_cursor(SCR *, size_t *, size_t *); -int cl_deleteln(SCR *); -int cl_discard(SCR *, SCR **); -int cl_ex_adjust(SCR *, exadj_t); -int cl_insertln(SCR *); -int cl_keyval(SCR *, scr_keyval_t, CHAR_T *, int *); -int cl_move(SCR *, size_t, size_t); -int cl_refresh(SCR *, int); -int cl_rename(SCR *, char *, int); -void cl_setname(GS *, char *); -int cl_split(SCR *, SCR *); -int cl_suspend(SCR *, int *); -void cl_usage(void); -int sig_init(GS *, SCR *); -int cl_event(SCR *, EVENT *, u_int32_t, int); -int cl_screen(SCR *, u_int32_t); -int cl_quit(GS *); -int cl_getcap(SCR *, char *, char **); -int cl_term_init(SCR *); -int cl_term_end(GS *); -int cl_fmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t); -int cl_optchange(SCR *, int, char *, u_long *); -int cl_omesg(SCR *, CL_PRIVATE *, int); -int cl_ssize(SCR *, int, size_t *, size_t *, int *); -int cl_putchar(int); diff --git a/contrib/nvi/common/common.h b/contrib/nvi/common/common.h index f2cb42fa9b9c..45f22fb49d1b 100644 --- a/contrib/nvi/common/common.h +++ b/contrib/nvi/common/common.h @@ -11,10 +11,10 @@ #define TCSASOFT 0 #endif -#ifdef __linux__ -#include "/usr/include/db1/db.h" /* Only include db1. */ +#ifdef DB_H_ABS_PATH +#include DB_H_ABS_PATH #else -#include /* Only include db1. */ +#include #endif #include /* May refer to the bundled regex. */ diff --git a/contrib/nvi/common/conv.h b/contrib/nvi/common/conv.h index ee3efb5a8308..4daa8221ff8f 100644 --- a/contrib/nvi/common/conv.h +++ b/contrib/nvi/common/conv.h @@ -28,7 +28,7 @@ typedef int iconv_t; #define KEY_NEEDSWIDE(sp, ch) \ (INTISWIDE(ch) && KEY_LEN(sp, ch) <= 4) #define KEY_COL(sp, ch) \ - (KEY_NEEDSWIDE(sp, ch) ? CHAR_WIDTH(sp, ch) : KEY_LEN(sp, ch)) + (KEY_NEEDSWIDE(sp, ch) ? XCHAR_WIDTH(sp, ch) : KEY_LEN(sp, ch)) enum { IC_FE_CHAR2INT, IC_FE_INT2CHAR, IC_IE_CHAR2INT, IC_IE_TO_UTF16 }; diff --git a/contrib/nvi/common/exf.c b/contrib/nvi/common/exf.c index f9eb2150276d..49e39c242648 100644 --- a/contrib/nvi/common/exf.c +++ b/contrib/nvi/common/exf.c @@ -199,7 +199,14 @@ file_init(SCR *sp, FREF *frp, char *rcv_name, int flags) if (!LF_ISSET(FS_OPENERR)) F_SET(frp, FR_NEWFILE); +#if defined HAVE_STRUCT_STAT_ST_MTIMESPEC + ep->mtim = sb.st_mtimespec; +#elif defined HAVE_STRUCT_STAT_ST_MTIM ep->mtim = sb.st_mtim; +#else + ep->mtim.tv_sec = sb.st_mtime; + ep->mtim.tv_nsec = 0; +#endif } else { /* * XXX @@ -218,7 +225,14 @@ file_init(SCR *sp, FREF *frp, char *rcv_name, int flags) ep->mdev = sb.st_dev; ep->minode = sb.st_ino; +#if defined HAVE_STRUCT_STAT_ST_MTIMESPEC + ep->mtim = sb.st_mtimespec; +#elif defined HAVE_STRUCT_STAT_ST_MTIM ep->mtim = sb.st_mtim; +#else + ep->mtim.tv_sec = sb.st_mtime; + ep->mtim.tv_nsec = 0; +#endif if (!S_ISREG(sb.st_mode)) msgq_str(sp, M_ERR, oname, @@ -796,7 +810,13 @@ file_write(SCR *sp, MARK *fm, MARK *tm, char *name, int flags) if (noname && !LF_ISSET(FS_FORCE | FS_APPEND) && ((F_ISSET(ep, F_DEVSET) && (sb.st_dev != ep->mdev || sb.st_ino != ep->minode)) || +#if defined HAVE_STRUCT_STAT_ST_MTIMESPEC + timespeccmp(&sb.st_mtimespec, &ep->mtim, !=))) { +#elif defined HAVE_STRUCT_STAT_ST_MTIM timespeccmp(&sb.st_mtim, &ep->mtim, !=))) { +#else + sb.st_mtime != ep->mtim.tv_sec)) { +#endif msgq_str(sp, M_ERR, name, LF_ISSET(FS_POSSIBLE) ? "250|%s: file modified more recently than this copy; use ! to override" : "251|%s: file modified more recently than this copy"); @@ -895,7 +915,14 @@ success_open: ep->mdev = sb.st_dev; ep->minode = sb.st_ino; +#if defined HAVE_STRUCT_STAT_ST_MTIMESPEC + ep->mtim = sb.st_mtimespec; +#elif defined HAVE_STRUCT_STAT_ST_MTIM ep->mtim = sb.st_mtim; +#else + ep->mtim.tv_sec = sb.st_mtime; + ep->mtim.tv_nsec = 0; +#endif } } diff --git a/contrib/nvi/common/extern.h b/contrib/nvi/common/extern.h deleted file mode 100644 index c887696080de..000000000000 --- a/contrib/nvi/common/extern.h +++ /dev/null @@ -1,131 +0,0 @@ -char * codeset(void); -void conv_init(SCR *, SCR *); -int conv_enc(SCR *, int, char *); -void conv_end(SCR *); -int cut(SCR *, CHAR_T *, MARK *, MARK *, int); -int cut_line(SCR *, recno_t, size_t, size_t, CB *); -void cut_close(GS *); -TEXT *text_init(SCR *, const CHAR_T *, size_t, size_t); -void text_lfree(TEXTH *); -void text_free(TEXT *); -int del(SCR *, MARK *, MARK *, int); -int looks_utf8(const char *, size_t); -int looks_utf16(const char *, size_t); -int decode_utf8(const char *); -int decode_utf16(const char *, int); -FREF *file_add(SCR *, char *); -int file_init(SCR *, FREF *, char *, int); -int file_end(SCR *, EXF *, int); -int file_write(SCR *, MARK *, MARK *, char *, int); -int file_m1(SCR *, int, int); -int file_m2(SCR *, int); -int file_m3(SCR *, int); -int file_aw(SCR *, int); -void set_alt_name(SCR *, char *); -lockr_t file_lock(SCR *, char *, int, int); -int v_key_init(SCR *); -void v_key_ilookup(SCR *); -size_t v_key_len(SCR *, ARG_CHAR_T); -char *v_key_name(SCR *, ARG_CHAR_T); -e_key_t v_key_val(SCR *, ARG_CHAR_T); -int v_event_push(SCR *, EVENT *, CHAR_T *, size_t, u_int); -int v_event_get(SCR *, EVENT *, int, u_int32_t); -void v_event_err(SCR *, EVENT *); -int v_event_flush(SCR *, u_int); -int db_eget(SCR *, recno_t, CHAR_T **, size_t *, int *); -int db_get(SCR *, recno_t, u_int32_t, CHAR_T **, size_t *); -int db_delete(SCR *, recno_t); -int db_append(SCR *, int, recno_t, CHAR_T *, size_t); -int db_insert(SCR *, recno_t, CHAR_T *, size_t); -int db_set(SCR *, recno_t, CHAR_T *, size_t); -int db_exist(SCR *, recno_t); -int db_last(SCR *, recno_t *); -int db_rget(SCR *, recno_t, char **, size_t *); -int db_rset(SCR *, recno_t, char *, size_t); -void db_err(SCR *, recno_t); -int log_init(SCR *, EXF *); -int log_end(SCR *, EXF *); -int log_cursor(SCR *); -int log_line(SCR *, recno_t, u_int); -int log_mark(SCR *, LMARK *); -int log_backward(SCR *, MARK *); -int log_setline(SCR *); -int log_forward(SCR *, MARK *); -int editor(GS *, int, char *[]); -void v_end(GS *); -int mark_init(SCR *, EXF *); -int mark_end(SCR *, EXF *); -int mark_get(SCR *, ARG_CHAR_T, MARK *, mtype_t); -int mark_set(SCR *, ARG_CHAR_T, MARK *, int); -int mark_insdel(SCR *, lnop_t, recno_t); -void msgq(SCR *, mtype_t, const char *, ...); -void msgq_wstr(SCR *, mtype_t, const CHAR_T *, const char *); -void msgq_str(SCR *, mtype_t, const char *, const char *); -void mod_rpt(SCR *); -void msgq_status(SCR *, recno_t, u_int); -int msg_open(SCR *, char *); -void msg_close(GS *); -const char *msg_cmsg(SCR *, cmsg_t, size_t *); -const char *msg_cat(SCR *, const char *, size_t *); -char *msg_print(SCR *, const char *, int *); -int opts_init(SCR *, int *); -int opts_set(SCR *, ARGS *[], char *); -int o_set(SCR *, int, u_int, char *, u_long); -int opts_empty(SCR *, int, int); -void opts_dump(SCR *, enum optdisp); -int opts_save(SCR *, FILE *); -OPTLIST const *opts_search(CHAR_T *); -void opts_nomatch(SCR *, CHAR_T *); -int opts_copy(SCR *, SCR *); -void opts_free(SCR *); -int f_altwerase(SCR *, OPTION *, char *, u_long *); -int f_columns(SCR *, OPTION *, char *, u_long *); -int f_lines(SCR *, OPTION *, char *, u_long *); -int f_lisp(SCR *, OPTION *, char *, u_long *); -int f_msgcat(SCR *, OPTION *, char *, u_long *); -int f_print(SCR *, OPTION *, char *, u_long *); -int f_readonly(SCR *, OPTION *, char *, u_long *); -int f_recompile(SCR *, OPTION *, char *, u_long *); -int f_reformat(SCR *, OPTION *, char *, u_long *); -int f_ttywerase(SCR *, OPTION *, char *, u_long *); -int f_w300(SCR *, OPTION *, char *, u_long *); -int f_w1200(SCR *, OPTION *, char *, u_long *); -int f_w9600(SCR *, OPTION *, char *, u_long *); -int f_window(SCR *, OPTION *, char *, u_long *); -int f_encoding(SCR *, OPTION *, char *, u_long *); -int put(SCR *, CB *, CHAR_T *, MARK *, MARK *, int); -int rcv_tmp(SCR *, EXF *, char *); -int rcv_init(SCR *); -int rcv_sync(SCR *, u_int); -int rcv_list(SCR *); -int rcv_read(SCR *, FREF *); -int screen_init(GS *, SCR *, SCR **); -int screen_end(SCR *); -SCR *screen_next(SCR *); -int f_search(SCR *, - MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int); -int b_search(SCR *, - MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int); -void search_busy(SCR *, busy_t); -int seq_set(SCR *, CHAR_T *, - size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int); -int seq_delete(SCR *, CHAR_T *, size_t, seq_t); -int seq_free(SEQ *); -SEQ *seq_find - (SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *); -void seq_close(GS *); -int seq_dump(SCR *, seq_t, int); -int seq_save(SCR *, FILE *, char *, seq_t); -int e_memcmp(CHAR_T *, EVENT *, size_t); -void *binc(SCR *, void *, size_t *, size_t); -int nonblank(SCR *, recno_t, size_t *); -char *join(char *, char *); -char *expanduser(char *); -char *quote(char *); -char *v_strdup(SCR *, const char *, size_t); -CHAR_T *v_wstrdup(SCR *, const CHAR_T *, size_t); -enum nresult nget_uslong(u_long *, const CHAR_T *, CHAR_T **, int); -enum nresult nget_slong(long *, const CHAR_T *, CHAR_T **, int); -void timepoint_steady(struct timespec *); -void timepoint_system(struct timespec *); -void TRACE(SCR *, const char *, ...); diff --git a/contrib/nvi/common/key.h b/contrib/nvi/common/key.h index 3e55d3044129..ae0ba92d1ce5 100644 --- a/contrib/nvi/common/key.h +++ b/contrib/nvi/common/key.h @@ -22,8 +22,8 @@ sp->conv.input2int(sp, n, nlen, &(cw), &wlen, &w) #define CONST #define INTISWIDE(c) (wctob(c) == EOF) -#define CHAR_WIDTH(sp, ch) wcwidth(ch) -#define CAN_PRINT(sp, ch) (CHAR_WIDTH(sp, ch) > 0) +#define XCHAR_WIDTH(sp, ch) wcwidth(ch) +#define CAN_PRINT(sp, ch) (XCHAR_WIDTH(sp, ch) > 0) #else #define FILE2INT5(sp,buf,n,nlen,w,wlen) \ (w = n, wlen = nlen, 0) @@ -37,7 +37,7 @@ (w = n, wlen = nlen, 0) #define CONST const #define INTISWIDE(c) 0 -#define CHAR_WIDTH(sp, ch) 1 +#define XCHAR_WIDTH(sp, ch) 1 #define CAN_PRINT(sp, ch) isprint(ch) #endif #define FILE2INT(sp,n,nlen,w,wlen) \ diff --git a/contrib/nvi/common/options.h b/contrib/nvi/common/options.h index 5ed12d39c342..d723a51217bc 100644 --- a/contrib/nvi/common/options.h +++ b/contrib/nvi/common/options.h @@ -97,4 +97,8 @@ enum optdisp { NO_DISPLAY, ALL_DISPLAY, CHANGED_DISPLAY, SELECT_DISPLAY }; /* Options array. */ extern OPTLIST const optlist[]; +#ifdef O_PATH +#undef O_PATH /* bits/fcntl-linux.h may have defined O_PATH. */ +#endif + #include "options_def.h" diff --git a/contrib/nvi/common/recover.c b/contrib/nvi/common/recover.c index 120cf4f60b19..cf222bfb5200 100644 --- a/contrib/nvi/common/recover.c +++ b/contrib/nvi/common/recover.c @@ -701,7 +701,13 @@ rcv_read(SCR *sp, FREF *frp) /* If we've found more than one, take the most recent. */ (void)fstat(fileno(fp), &sb); if (recp == NULL || +#if defined HAVE_STRUCT_STAT_ST_MTIMESPEC + timespeccmp(&rec_mtim, &sb.st_mtimespec, <)) { +#elif defined HAVE_STRUCT_STAT_ST_MTIM timespeccmp(&rec_mtim, &sb.st_mtim, <)) { +#else + rec_mtim.tv_sec < sb.st_mtime) { +#endif p = recp; t = pathp; recp = recpath; @@ -710,7 +716,13 @@ rcv_read(SCR *sp, FREF *frp) free(p); free(t); } +#if defined HAVE_STRUCT_STAT_ST_MTIMESPEC + rec_mtim = sb.st_mtimespec; +#elif defined HAVE_STRUCT_STAT_ST_MTIM rec_mtim = sb.st_mtim; +#else + rec_mtim.tv_sec = sb.st_mtime; +#endif if (sv_fd != -1) (void)close(sv_fd); sv_fd = dup(fileno(fp)); diff --git a/contrib/nvi/ex/ex.c b/contrib/nvi/ex/ex.c index 343131537afa..fd920a8df9a1 100644 --- a/contrib/nvi/ex/ex.c +++ b/contrib/nvi/ex/ex.c @@ -2266,7 +2266,8 @@ ex_comm_search(CHAR_T *name, size_t len) return (NULL); if (cp->name[0] != name[0]) continue; - if (!MEMCMP(name, cp->name, len)) + if (STRLEN(cp->name) >= len && + !MEMCMP(name, cp->name, len)) return (cp); } return (NULL); diff --git a/contrib/nvi/ex/ex_cscope.c b/contrib/nvi/ex/ex_cscope.c index 74d7f8af95be..e07aa64df802 100644 --- a/contrib/nvi/ex/ex_cscope.c +++ b/contrib/nvi/ex/ex_cscope.c @@ -261,7 +261,14 @@ cscope_add(SCR *sp, EXCMD *cmdp, CHAR_T *dname) csc->dname = csc->buf; csc->dlen = len; memcpy(csc->dname, np, len); +#if defined HAVE_STRUCT_STAT_ST_MTIMESPEC + csc->mtim = sb.st_mtimespec; +#elif defined HAVE_STRUCT_STAT_ST_MTIM csc->mtim = sb.st_mtim; +#else + csc->mtim.tv_sec = sb.st_mtime; + csc->mtim.tv_nsec = 0; +#endif /* Get the search paths for the cscope. */ if (get_paths(sp, csc)) @@ -812,8 +819,15 @@ csc_file(SCR *sp, CSC *csc, char *name, char **dirp, size_t *dlenp, int *isolder free(buf); *dirp = *pp; *dlenp = strlen(*pp); +#if defined HAVE_STRUCT_STAT_ST_MTIMESPEC + *isolderp = timespeccmp( + &sb.st_mtimespec, &csc->mtim, <); +#elif defined HAVE_STRUCT_STAT_ST_MTIM *isolderp = timespeccmp( &sb.st_mtim, &csc->mtim, <); +#else + *isolderp = sb.st_mtime < csc->mtim.tv_sec; +#endif return; } free(buf); diff --git a/contrib/nvi/ex/extern.h b/contrib/nvi/ex/extern.h deleted file mode 100644 index 9d7b1d674c3c..000000000000 --- a/contrib/nvi/ex/extern.h +++ /dev/null @@ -1,131 +0,0 @@ -int ex(SCR **); -int ex_cmd(SCR *); -int ex_range(SCR *, EXCMD *, int *); -int ex_is_abbrev(CHAR_T *, size_t); -int ex_is_unmap(CHAR_T *, size_t); -void ex_badaddr - (SCR *, EXCMDLIST const *, enum badaddr, enum nresult); -int ex_abbr(SCR *, EXCMD *); -int ex_unabbr(SCR *, EXCMD *); -int ex_append(SCR *, EXCMD *); -int ex_change(SCR *, EXCMD *); -int ex_insert(SCR *, EXCMD *); -int ex_next(SCR *, EXCMD *); -int ex_prev(SCR *, EXCMD *); -int ex_rew(SCR *, EXCMD *); -int ex_args(SCR *, EXCMD *); -char **ex_buildargv(SCR *, EXCMD *, char *); -int argv_init(SCR *, EXCMD *); -int argv_exp0(SCR *, EXCMD *, CHAR_T *, size_t); -int argv_exp1(SCR *, EXCMD *, CHAR_T *, size_t, int); -int argv_exp2(SCR *, EXCMD *, CHAR_T *, size_t); -int argv_exp3(SCR *, EXCMD *, CHAR_T *, size_t); -int argv_flt_ex(SCR *, EXCMD *, CHAR_T *, size_t); -int argv_free(SCR *); -int argv_flt_path(SCR *, EXCMD *, CHAR_T *, size_t); -CHAR_T *argv_esc(SCR *, EXCMD *, CHAR_T *, size_t); -CHAR_T *argv_uesc(SCR *, EXCMD *, CHAR_T *, size_t); -int ex_at(SCR *, EXCMD *); -int ex_bang(SCR *, EXCMD *); -int ex_cd(SCR *, EXCMD *); -int ex_cscope(SCR *, EXCMD *); -int cscope_end(SCR *); -int cscope_display(SCR *); -int cscope_search(SCR *, TAGQ *, TAG *); -int ex_delete(SCR *, EXCMD *); -int ex_display(SCR *, EXCMD *); -int ex_edit(SCR *, EXCMD *); -int ex_equal(SCR *, EXCMD *); -int ex_file(SCR *, EXCMD *); -int ex_filter(SCR *, - EXCMD *, MARK *, MARK *, MARK *, CHAR_T *, enum filtertype); -int ex_global(SCR *, EXCMD *); -int ex_v(SCR *, EXCMD *); -int ex_g_insdel(SCR *, lnop_t, recno_t); -int ex_screen_copy(SCR *, SCR *); -int ex_screen_end(SCR *); -int ex_optchange(SCR *, int, char *, u_long *); -int ex_exrc(SCR *); -int ex_run_str(SCR *, char *, CHAR_T *, size_t, int, int); -int ex_join(SCR *, EXCMD *); -int ex_map(SCR *, EXCMD *); -int ex_unmap(SCR *, EXCMD *); -int ex_mark(SCR *, EXCMD *); -int ex_mkexrc(SCR *, EXCMD *); -int ex_copy(SCR *, EXCMD *); -int ex_move(SCR *, EXCMD *); -int ex_open(SCR *, EXCMD *); -int ex_preserve(SCR *, EXCMD *); -int ex_recover(SCR *, EXCMD *); -int ex_list(SCR *, EXCMD *); -int ex_number(SCR *, EXCMD *); -int ex_pr(SCR *, EXCMD *); -int ex_print(SCR *, EXCMD *, MARK *, MARK *, u_int32_t); -int ex_ldisplay(SCR *, const CHAR_T *, size_t, size_t, u_int); -int ex_scprint(SCR *, MARK *, MARK *); -int ex_printf(SCR *, const char *, ...); -int ex_puts(SCR *, const char *); -int ex_fflush(SCR *sp); -int ex_put(SCR *, EXCMD *); -int ex_quit(SCR *, EXCMD *); -int ex_read(SCR *, EXCMD *); -int ex_readfp(SCR *, char *, FILE *, MARK *, recno_t *, int); -int ex_bg(SCR *, EXCMD *); -int ex_fg(SCR *, EXCMD *); -int ex_resize(SCR *, EXCMD *); -int ex_sdisplay(SCR *); -int ex_script(SCR *, EXCMD *); -int sscr_exec(SCR *, recno_t); -int sscr_input(SCR *); -int sscr_end(SCR *); -int ex_set(SCR *, EXCMD *); -int ex_shell(SCR *, EXCMD *); -int ex_exec_proc(SCR *, EXCMD *, char *, const char *, int); -int proc_wait(SCR *, long, const char *, int, int); -int ex_shiftl(SCR *, EXCMD *); -int ex_shiftr(SCR *, EXCMD *); -int ex_retab(SCR *, EXCMD *); -int ex_source(SCR *, EXCMD *); -int ex_stop(SCR *, EXCMD *); -int ex_s(SCR *, EXCMD *); -int ex_subagain(SCR *, EXCMD *); -int ex_subtilde(SCR *, EXCMD *); -int re_compile(SCR *, - CHAR_T *, size_t, CHAR_T **, size_t *, regex_t *, u_int); -void re_error(SCR *, int, regex_t *); -int ex_tag_first(SCR *, CHAR_T *); -int ex_tag_push(SCR *, EXCMD *); -int ex_tag_next(SCR *, EXCMD *); -int ex_tag_prev(SCR *, EXCMD *); -int ex_tag_nswitch(SCR *, TAG *, int); -int ex_tag_Nswitch(SCR *, TAG *, int); -int ex_tag_pop(SCR *, EXCMD *); -int ex_tag_top(SCR *, EXCMD *); -int ex_tag_display(SCR *); -int ex_tag_copy(SCR *, SCR *); -int tagq_free(SCR *, TAGQ *); -int tagq_push(SCR*, TAGQ*, int, int ); -void tag_msg(SCR *, tagmsg_t, char *); -int ex_tagf_alloc(SCR *, char *); -int ex_tag_free(SCR *); -int ex_txt(SCR *, TEXTH *, ARG_CHAR_T, u_int32_t); -int ex_undo(SCR *, EXCMD *); -int ex_help(SCR *, EXCMD *); -int ex_usage(SCR *, EXCMD *); -int ex_viusage(SCR *, EXCMD *); -void ex_cinit(SCR *, EXCMD *, int, int, recno_t, recno_t, int); -int ex_getline(SCR *, FILE *, size_t *); -int ex_ncheck(SCR *, int); -int ex_init(SCR *); -void ex_wemsg(SCR *, CHAR_T *, exm_t); -void ex_emsg(SCR *, char *, exm_t); -int ex_version(SCR *, EXCMD *); -int ex_visual(SCR *, EXCMD *); -int ex_wn(SCR *, EXCMD *); -int ex_wq(SCR *, EXCMD *); -int ex_write(SCR *, EXCMD *); -int ex_xit(SCR *, EXCMD *); -int ex_writefp(SCR *, - char *, FILE *, MARK *, MARK *, u_long *, u_long *, int); -int ex_yank(SCR *, EXCMD *); -int ex_z(SCR *, EXCMD *); diff --git a/contrib/nvi/man/vi.1 b/contrib/nvi/man/vi.1 index 8c75e9e66a33..b6eaf6964bbd 100644 --- a/contrib/nvi/man/vi.1 +++ b/contrib/nvi/man/vi.1 @@ -1809,7 +1809,8 @@ Display buffers, Cscope connections, screens or tags. .Op Ar +cmd .Op Ar file .Xc -Edit a different file. +Edit a different file. The capitalized command opens a new screen below the +current screen. .Pp .It Xo .Cm exu Ns Op Cm sage @@ -1832,7 +1833,8 @@ Display and optionally change the file name. .Xc .Nm vi mode only. -Foreground the specified screen. +Foreground the specified screen. The capitalized command opens a new screen +below the current screen. .Pp .It Xo .Op Ar range @@ -1919,7 +1921,8 @@ Write the abbreviations, editor options and maps to the specified .Op Cm !\& .Op Ar .Xc -Edit the next file from the argument list. +Edit the next file from the argument list. The capitalized command opens a +new screen below the current screen. .\" .Pp .\" .It Xo .\" .Op Ar line @@ -1940,7 +1943,8 @@ option. .Cm rev Ns Op Cm ious Ns .Op Cm !\& .Xc -Edit the previous file from the argument list. +Edit the previous file from the argument list. The capitalized command opens +a new screen below the current screen. .Pp .It Xo .Op Ar range @@ -2103,7 +2107,8 @@ character is usually .Op Cm !\& .Ar tagstring .Xc -Edit the file containing the specified tag. +Edit the file containing the specified tag. The capitalized command opens a +new screen below the current screen. .Pp .It Xo .Cm tagn Ns Op Cm ext Ns @@ -2166,15 +2171,15 @@ Enter .Nm vi . .Pp .It Xo -.Op Cm Vi Ns -.Cm i Ns Op Cm sual Ns +.Cm Vi Ns +.Op Cm sual Ns .Op Cm !\& .Op Ar +cmd .Op Ar file .Xc .Nm vi -mode only. -Edit a new file. +mode only. Edit a different file by opening a new screen below the current +screen. .Pp .It Xo .Cm viu Ns Op Cm sage @@ -2185,6 +2190,14 @@ Display usage for a command. .Pp .It Xo +.Cm vs Ns Op Cm plit +.Op Ar +cmd +.Op Ar file +.Xc +Edit a different file by opening a new screen to the right of the current +screen. +.Pp +.It Xo .Op Ar range .Cm w Ns Op Cm rite Ns .Op Cm !\& @@ -2194,8 +2207,7 @@ command. .It Xo .Op Ar range .Cm w Ns Op Cm rite -.Op Cm !\& -.Op Ar file +.Cm !\& Ns Ar shell-command .Xc .It Xo .Op Ar range @@ -2209,7 +2221,21 @@ command. .Op >> .Op Ar file .Xc -Write the file. +Write the entire file, or +.Ar range . +.Sq !\& +overwrites a different, preexisting file. +.Sq >> +appends to a file that may preexist. Whitespace followed by +.Sq !\& +pipes the file to +.Ar shell-command . +.Cm wn +moves to the next file if writing succeeds. +.Cm wq +exits the editor if writing succeeds, unless there are more files to edit; +.Sq !\& +exits regardless. .Pp .It Xo .Op Ar range diff --git a/contrib/nvi/vi/extern.h b/contrib/nvi/vi/extern.h deleted file mode 100644 index 8e145c6318ef..000000000000 --- a/contrib/nvi/vi/extern.h +++ /dev/null @@ -1,145 +0,0 @@ -int cs_init(SCR *, VCS *); -int cs_next(SCR *, VCS *); -int cs_fspace(SCR *, VCS *); -int cs_fblank(SCR *, VCS *); -int cs_prev(SCR *, VCS *); -int cs_bblank(SCR *, VCS *); -int v_at(SCR *, VICMD *); -int v_chrepeat(SCR *, VICMD *); -int v_chrrepeat(SCR *, VICMD *); -int v_cht(SCR *, VICMD *); -int v_chf(SCR *, VICMD *); -int v_chT(SCR *, VICMD *); -int v_chF(SCR *, VICMD *); -int v_delete(SCR *, VICMD *); -int v_again(SCR *, VICMD *); -int v_exmode(SCR *, VICMD *); -int v_join(SCR *, VICMD *); -int v_shiftl(SCR *, VICMD *); -int v_shiftr(SCR *, VICMD *); -int v_suspend(SCR *, VICMD *); -int v_switch(SCR *, VICMD *); -int v_tagpush(SCR *, VICMD *); -int v_tagpop(SCR *, VICMD *); -int v_filter(SCR *, VICMD *); -int v_ex(SCR *, VICMD *); -int v_ecl_exec(SCR *); -int v_increment(SCR *, VICMD *); -int v_screen_copy(SCR *, SCR *); -int v_screen_end(SCR *); -int v_optchange(SCR *, int, char *, u_long *); -int v_iA(SCR *, VICMD *); -int v_ia(SCR *, VICMD *); -int v_iI(SCR *, VICMD *); -int v_ii(SCR *, VICMD *); -int v_iO(SCR *, VICMD *); -int v_io(SCR *, VICMD *); -int v_change(SCR *, VICMD *); -int v_Replace(SCR *, VICMD *); -int v_subst(SCR *, VICMD *); -int v_left(SCR *, VICMD *); -int v_cfirst(SCR *, VICMD *); -int v_first(SCR *, VICMD *); -int v_ncol(SCR *, VICMD *); -int v_zero(SCR *, VICMD *); -int v_mark(SCR *, VICMD *); -int v_bmark(SCR *, VICMD *); -int v_fmark(SCR *, VICMD *); -int v_emark(SCR *, VICMD *); -int v_match(SCR *, VICMD *); -int v_buildmcs(SCR *, char *); -int v_paragraphf(SCR *, VICMD *); -int v_paragraphb(SCR *, VICMD *); -int v_buildps(SCR *, char *, char *); -int v_Put(SCR *, VICMD *); -int v_put(SCR *, VICMD *); -int v_redraw(SCR *, VICMD *); -int v_replace(SCR *, VICMD *); -int v_right(SCR *, VICMD *); -int v_dollar(SCR *, VICMD *); -int v_screen(SCR *, VICMD *); -int v_lgoto(SCR *, VICMD *); -int v_home(SCR *, VICMD *); -int v_middle(SCR *, VICMD *); -int v_bottom(SCR *, VICMD *); -int v_up(SCR *, VICMD *); -int v_cr(SCR *, VICMD *); -int v_down(SCR *, VICMD *); -int v_hpageup(SCR *, VICMD *); -int v_hpagedown(SCR *, VICMD *); -int v_pagedown(SCR *, VICMD *); -int v_pageup(SCR *, VICMD *); -int v_lineup(SCR *, VICMD *); -int v_linedown(SCR *, VICMD *); -int v_searchb(SCR *, VICMD *); -int v_searchf(SCR *, VICMD *); -int v_searchN(SCR *, VICMD *); -int v_searchn(SCR *, VICMD *); -int v_searchw(SCR *, VICMD *); -int v_correct(SCR *, VICMD *, int); -int v_sectionf(SCR *, VICMD *); -int v_sectionb(SCR *, VICMD *); -int v_sentencef(SCR *, VICMD *); -int v_sentenceb(SCR *, VICMD *); -int v_status(SCR *, VICMD *); -int v_tcmd(SCR *, VICMD *, ARG_CHAR_T, u_int); -int v_txt(SCR *, VICMD *, MARK *, - const CHAR_T *, size_t, ARG_CHAR_T, recno_t, u_long, u_int32_t); -int v_txt_auto(SCR *, recno_t, TEXT *, size_t, TEXT *); -int v_ulcase(SCR *, VICMD *); -int v_mulcase(SCR *, VICMD *); -int v_Undo(SCR *, VICMD *); -int v_undo(SCR *, VICMD *); -void v_eof(SCR *, MARK *); -void v_eol(SCR *, MARK *); -void v_nomove(SCR *); -void v_sof(SCR *, MARK *); -void v_sol(SCR *); -int v_isempty(CHAR_T *, size_t); -void v_emsg(SCR *, char *, vim_t); -int v_wordW(SCR *, VICMD *); -int v_wordw(SCR *, VICMD *); -int v_wordE(SCR *, VICMD *); -int v_worde(SCR *, VICMD *); -int v_wordB(SCR *, VICMD *); -int v_wordb(SCR *, VICMD *); -int v_xchar(SCR *, VICMD *); -int v_Xchar(SCR *, VICMD *); -int v_yank(SCR *, VICMD *); -int v_z(SCR *, VICMD *); -int vs_crel(SCR *, long); -int v_zexit(SCR *, VICMD *); -int vi(SCR **); -int v_curword(SCR *); -int vs_line(SCR *, SMAP *, size_t *, size_t *); -int vs_number(SCR *); -void vs_busy(SCR *, const char *, busy_t); -void vs_home(SCR *); -void vs_update(SCR *, const char *, const CHAR_T *); -void vs_msg(SCR *, mtype_t, char *, size_t); -int vs_ex_resolve(SCR *, int *); -int vs_resolve(SCR *, SCR *, int); -int vs_repaint(SCR *, EVENT *); -int vs_refresh(SCR *, int); -int vs_column(SCR *, size_t *); -size_t vs_screens(SCR *, recno_t, size_t *); -size_t vs_columns(SCR *, CHAR_T *, recno_t, size_t *, size_t *); -size_t vs_rcm(SCR *, recno_t, int); -size_t vs_colpos(SCR *, recno_t, size_t); -int vs_change(SCR *, recno_t, lnop_t); -int vs_sm_fill(SCR *, recno_t, pos_t); -int vs_sm_scroll(SCR *, MARK *, recno_t, scroll_t); -int vs_sm_1up(SCR *); -int vs_sm_1down(SCR *); -int vs_sm_next(SCR *, SMAP *, SMAP *); -int vs_sm_prev(SCR *, SMAP *, SMAP *); -int vs_sm_cursor(SCR *, SMAP **); -int vs_sm_position(SCR *, MARK *, u_long, pos_t); -recno_t vs_sm_nlines(SCR *, SMAP *, recno_t, size_t); -int vs_split(SCR *, SCR *, int); -int vs_vsplit(SCR *, SCR *); -int vs_discard(SCR *, SCR **); -int vs_fg(SCR *, SCR **, CHAR_T *, int); -int vs_bg(SCR *); -int vs_swap(SCR *, SCR **, char *); -int vs_resize(SCR *, long, adj_t); diff --git a/contrib/nvi/vi/v_increment.c b/contrib/nvi/vi/v_increment.c index 6c59836cab7e..2583d9704579 100644 --- a/contrib/nvi/vi/v_increment.c +++ b/contrib/nvi/vi/v_increment.c @@ -198,7 +198,7 @@ nonum: msgq(sp, M_ERR, "181|Cursor not in a number"); /* If we cross 0, signed numbers lose their sign. */ if (lval == 0 && ntype == fmt[SDEC]) ntype = fmt[DEC]; - nlen = SPRINTF(nbuf, sizeof(nbuf), ntype, lval); + nlen = SPRINTF(nbuf, SIZE(nbuf), ntype, lval); } else { if ((nret = nget_uslong(&ulval, t, NULL, base)) != NUM_OK) goto err; @@ -220,7 +220,7 @@ nonum: msgq(sp, M_ERR, "181|Cursor not in a number"); if (base == 16) wlen -= 2; *** 529 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Sep 22 12:08:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF59A669B8A; Wed, 22 Sep 2021 12:08: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 4HDxrz4ZGLz52xY; Wed, 22 Sep 2021 12:08: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 78AD316FF5; Wed, 22 Sep 2021 12:08: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 18MC8JYO033337; Wed, 22 Sep 2021 12:08:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MC8J5a033335; Wed, 22 Sep 2021 12:08:19 GMT (envelope-from git) Date: Wed, 22 Sep 2021 12:08:19 GMT Message-Id: <202109221208.18MC8J5a033335@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Stefan E=C3=9Fer?= Subject: git: cd9254a7d330 - main - ObsoleteFiles.inc: Add sponge(1) command and man-page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cd9254a7d330758f0322b967709b09f7b43cf843 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 12:08:19 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=cd9254a7d330758f0322b967709b09f7b43cf843 commit cd9254a7d330758f0322b967709b09f7b43cf843 Author: Stefan Eßer AuthorDate: 2021-09-22 11:59:01 +0000 Commit: Stefan Eßer CommitDate: 2021-09-22 12:08:04 +0000 ObsoleteFiles.inc: Add sponge(1) command and man-page The sponge command has been imported on 2017-12-05 but the import has been reverted the next day. A script failed and I found that it was due to the left-over broken sponge binary in base being prefered over the port version. To prevent a known non-working binary to persist in /usr/bin, I'm adding sponge to the obsolete files list even though it could only be installed on a single day in 2017. I do not plan to MFC this change since the issue will only exist on systems installed from -CURRENT sources in 2017, and I do assume that such systems are not running -STABLE today --- ObsoleteFiles.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 1a5d235624eb..111fced8ce20 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -7595,6 +7595,9 @@ OLD_FILES+=tests/sys/geom/class/eli/onetime_d_test.sh OLD_DIRS+=etc/skel # 20171208: Remove basename_r(3) OLD_FILES+=usr/share/man/man3/basename_r.3.gz +# 20171206: Remove sponge(1) +OLD_FILES+=usr/bin/sponge +OLD_FILES+=usr/share/man/man1/sponge.1.gz # 20171204: Move fdformat man page from volume 1 to volume 8. OLD_FILES+=usr/share/man/man1/fdformat.1.gz # 20171203: libproc version bump From owner-dev-commits-src-all@freebsd.org Wed Sep 22 12:44:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E5ADF66A29E; Wed, 22 Sep 2021 12:44: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 4HDyg54wdcz56gX; Wed, 22 Sep 2021 12:44: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 898001777C; Wed, 22 Sep 2021 12:44: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 18MCins0085372; Wed, 22 Sep 2021 12:44:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MCinjK085371; Wed, 22 Sep 2021 12:44:49 GMT (envelope-from git) Date: Wed, 22 Sep 2021 12:44:49 GMT Message-Id: <202109221244.18MCinjK085371@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 884f38590c3c - main - 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/main X-Git-Reftype: branch X-Git-Commit: 884f38590c3cc0b1a2c00904c1f1f6c791376308 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 12:44:50 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=884f38590c3cc0b1a2c00904c1f1f6c791376308 commit 884f38590c3cc0b1a2c00904c1f1f6c791376308 Author: Alexander Motin AuthorDate: 2021-09-22 12:42:36 +0000 Commit: Alexander Motin CommitDate: 2021-09-22 12:44:39 +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 --- 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 1f580f455dc0..5e1b561155bb 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -3145,6 +3145,8 @@ device_set_unit(device_t dev, int unit) devclass_t dc; int err; + if (unit == dev->unit) + return (0); dc = device_get_devclass(dev); if (unit < dc->maxunit && dc->devices[unit]) return (EBUSY); From owner-dev-commits-src-all@freebsd.org Wed Sep 22 13:02:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB3AF66AA02; Wed, 22 Sep 2021 13:02: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 4HDz3W3BKjz3DG1; Wed, 22 Sep 2021 13:02: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 32FB717AEE; Wed, 22 Sep 2021 13:02: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 18MD2Vxj013030; Wed, 22 Sep 2021 13:02:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MD2VeT013029; Wed, 22 Sep 2021 13:02:31 GMT (envelope-from git) Date: Wed, 22 Sep 2021 13:02:31 GMT Message-Id: <202109221302.18MD2VeT013029@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 929e8e5605e0 - stable/13 - mlx5/mlx4: Bump driver version to 3.7 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 929e8e5605e02e5181b0708cf78abde72411e9cd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 13:02:32 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=929e8e5605e02e5181b0708cf78abde72411e9cd commit 929e8e5605e02e5181b0708cf78abde72411e9cd Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:02:03 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-22 12:59:31 +0000 mlx5/mlx4: Bump driver version to 3.7 While at it only output driver version to dmesg(8) when hardware is present. Differential Revision: https://reviews.freebsd.org/D29100 MFC after: 1 week Reviewed by: kib and markj Sponsored by: NVIDIA Networking (cherry picked from commit d2cbfbc57b20700d6eb04dbfc4d636ce6c92997c) --- sys/dev/mlx4/mlx4_core/mlx4.h | 4 ++-- sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c | 4 ++-- sys/dev/mlx5/mlx5_core/mlx5_core.h | 4 ++-- sys/dev/mlx5/mlx5_core/mlx5_main.c | 7 ++++--- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 16 ---------------- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 18 ------------------ 6 files changed, 10 insertions(+), 43 deletions(-) diff --git a/sys/dev/mlx4/mlx4_core/mlx4.h b/sys/dev/mlx4/mlx4_core/mlx4.h index 8b1afc2838e6..f2cae9c5f38e 100644 --- a/sys/dev/mlx4/mlx4_core/mlx4.h +++ b/sys/dev/mlx4/mlx4_core/mlx4.h @@ -54,9 +54,9 @@ #define DRV_NAME "mlx4_core" #define PFX DRV_NAME ": " #ifndef DRV_VERSION -#define DRV_VERSION "3.6.0" +#define DRV_VERSION "3.7.0" #endif -#define DRV_RELDATE "December 2020" +#define DRV_RELDATE "July 2021" #define MLX4_FS_UDP_UC_EN (1 << 1) #define MLX4_FS_TCP_UC_EN (1 << 2) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c index e992400820c0..635040e723e2 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c @@ -63,9 +63,9 @@ #define DRV_NAME MLX4_IB_DRV_NAME #ifndef DRV_VERSION -#define DRV_VERSION "3.6.0" +#define DRV_VERSION "3.7.0" #endif -#define DRV_RELDATE "December 2020" +#define DRV_RELDATE "July 2021" #define MLX4_IB_FLOW_MAX_PRIO 0xFFF #define MLX4_IB_FLOW_QPN_MASK 0xFFFFFF diff --git a/sys/dev/mlx5/mlx5_core/mlx5_core.h b/sys/dev/mlx5/mlx5_core/mlx5_core.h index a7ce1b31641c..f30f307b04a8 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_core.h +++ b/sys/dev/mlx5/mlx5_core/mlx5_core.h @@ -36,9 +36,9 @@ #define DRIVER_NAME "mlx5_core" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.6.0" +#define DRIVER_VERSION "3.7.0" #endif -#define DRIVER_RELDATE "December 2020" +#define DRIVER_RELDATE "July 2021" extern int mlx5_core_debug_mask; diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index 7527af524456..5830d4510d7b 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2020, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2021, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -55,8 +55,7 @@ static const char mlx5_version[] = "Mellanox Core driver " DRIVER_VERSION " (" DRIVER_RELDATE ")"; -MODULE_AUTHOR("Eli Cohen "); -MODULE_DESCRIPTION("Mellanox Connect-IB, ConnectX-4 core driver"); +MODULE_DESCRIPTION("Mellanox ConnectX-4 and onwards core driver"); MODULE_LICENSE("Dual BSD/GPL"); MODULE_DEPEND(mlx5, linuxkpi, 1, 1, 1); MODULE_DEPEND(mlx5, mlxfw, 1, 1, 1); @@ -1317,6 +1316,8 @@ static int init_one(struct pci_dev *pdev, struct sysctl_oid *current_cap_sysctl_node; struct sysctl_oid *max_cap_sysctl_node; + printk_once("mlx5: %s", mlx5_version); + numa_node = dev_to_node(&pdev->dev); dev = kzalloc_node(sizeof(*dev), GFP_KERNEL, numa_node); diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 170fb03be968..cebba31b36e1 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -35,14 +35,6 @@ #include -#ifndef ETH_DRIVER_VERSION -#define ETH_DRIVER_VERSION "3.6.0" -#endif -#define DRIVER_RELDATE "December 2020" - -static const char mlx5e_version[] = "mlx5en: Mellanox Ethernet driver " - ETH_DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; - static int mlx5e_get_wqe_sz(struct mlx5e_priv *priv, u32 *wqe_sz, u32 *nsegs); struct mlx5e_channel_param { @@ -4910,14 +4902,6 @@ mlx5e_cleanup(void) mlx5_unregister_interface(&mlx5e_interface); } -static void -mlx5e_show_version(void __unused *arg) -{ - - printf("%s", mlx5e_version); -} -SYSINIT(mlx5e_show_version, SI_SUB_DRIVERS, SI_ORDER_ANY, mlx5e_show_version, NULL); - module_init_order(mlx5e_init, SI_ORDER_SIXTH); module_exit_order(mlx5e_cleanup, SI_ORDER_SIXTH); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index d614ec048f60..fd4c0b1acb05 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -50,12 +50,6 @@ #include #include "mlx5_ib.h" -#define DRIVER_NAME "mlx5ib" -#ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.6.0" -#endif -#define DRIVER_RELDATE "December 2020" - MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); MODULE_LICENSE("Dual BSD/GPL"); MODULE_DEPEND(mlx5ib, linuxkpi, 1, 1, 1); @@ -63,10 +57,6 @@ MODULE_DEPEND(mlx5ib, mlx5, 1, 1, 1); MODULE_DEPEND(mlx5ib, ibcore, 1, 1, 1); MODULE_VERSION(mlx5ib, 1); -static const char mlx5_version[] = - DRIVER_NAME ": Mellanox Connect-IB Infiniband driver " - DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; - enum { MLX5_ATOMIC_SIZE_QP_8BYTES = 1 << 3, }; @@ -3576,13 +3566,5 @@ static void __exit mlx5_ib_cleanup(void) mlx5_ib_odp_cleanup(); } -static void -mlx5_ib_show_version(void __unused *arg) -{ - - printf("%s", mlx5_version); -} -SYSINIT(mlx5_ib_show_version, SI_SUB_DRIVERS, SI_ORDER_ANY, mlx5_ib_show_version, NULL); - module_init_order(mlx5_ib_init, SI_ORDER_SEVENTH); module_exit_order(mlx5_ib_cleanup, SI_ORDER_SEVENTH); From owner-dev-commits-src-all@freebsd.org Wed Sep 22 13:02:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 13A3366A59E; Wed, 22 Sep 2021 13:02: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 4HDz3X3fLHz3DRD; Wed, 22 Sep 2021 13:02: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 4E58F181CB; Wed, 22 Sep 2021 13:02: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 18MD2WAp013054; Wed, 22 Sep 2021 13:02:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MD2W88013053; Wed, 22 Sep 2021 13:02:32 GMT (envelope-from git) Date: Wed, 22 Sep 2021 13:02:32 GMT Message-Id: <202109221302.18MD2W88013053@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: c203dfe17bc8 - stable/13 - Update the mlx5en(4) manual page. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c203dfe17bc868bb0dbf01c9d99b1ca4b7a51282 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 13:02:33 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c203dfe17bc868bb0dbf01c9d99b1ca4b7a51282 commit c203dfe17bc868bb0dbf01c9d99b1ca4b7a51282 Author: Hans Petter Selasky AuthorDate: 2021-07-20 16:00:13 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-22 12:59:31 +0000 Update the mlx5en(4) manual page. Differential Revision: https://reviews.freebsd.org/D31228 Reviewed by: kib@ MFC after: 1 week Sponsored by: NVIDIA Networking (cherry picked from commit 575945f10b9e11be0f217117c86dd480de6c5f30) --- share/man/man4/mlx5en.4 | 98 ++++++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 50 deletions(-) diff --git a/share/man/man4/mlx5en.4 b/share/man/man4/mlx5en.4 index f05b74adb0b3..31dcdb4657d4 100644 --- a/share/man/man4/mlx5en.4 +++ b/share/man/man4/mlx5en.4 @@ -1,4 +1,5 @@ .\" Copyright (c) 2015 Mellanox Technologies +.\" Copyright (c) 2021 NVIDIA corporation & affiliates .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,12 +25,12 @@ .\" .\" $FreeBSD$ .\" -.Dd May 8, 2019 +.Dd July 20, 2021 .Dt MLX5EN 4 .Os .Sh NAME .Nm mlx5en -.Nd "Mellanox ConnectX-4, ConnectX-4 LX and ConnectX-5 based 100Gb, 50Gb, 40Gb, 25Gb and 10Gb Ethernet adapter driver" +.Nd "NVIDIA Mellanox ConnectX-4/5/6 [Dx/Ex/Lx] based 200Gb, 100Gb, 50Gb, 40Gb, 25Gb and 10Gb ethernet adapter driver" .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -37,6 +38,7 @@ kernel configuration file: .Bd -ragged -offset indent .Cd "options COMPAT_LINUXKPI" .Cd "options RATELIMIT" +.Cd "options KERN_TLS" .Cd "device xz" .Cd "device mlxfw" .Cd "device firmware" @@ -60,67 +62,63 @@ mlx5en_load="YES" The .Nm driver provides support for PCI Express Ethernet adapters based on -ConnectX-4, ConnectX-4 LX and ConnectX-5. -The driver supports Jumbo Frames, Transmit/Receive checksum offload, +ConnectX-4/5/6 [Dx, Ex and Lx variants]. +The driver supports Jumbo Frames, Transmit and Receive checksum offload, TCP segmentation offload (TSO), Large Receive Offload (LRO), -HW Large Receive Offload (HW LRO), VLAN tag insertion/extraction, -VLAN checksum offload, VLAN TSO, hardware rate limiting (TXRTLMT) -and Receive Side Steering (RSS). -.br -The network interface is named mce. -.br -For further hardware information and questions related to hardware -requirements, see -.Pa http://www.mellanox.com/ . +HW Large Receive Offload (HW LRO), VLAN tag insertion and extraction, +VLAN checksum offload, VLAN TSO, hardware rate limiting (TXRTLMT), +stateless VxLAN hardware offload for receive and transmit, +HW TLS offload for transmit, Receive Side Steering (RSS) and +.Xr NUMA 4 +awareness. +.Pp +The network interface name is +.Dv mce +which corresponds to a PCI function, +.Dv mlx_core , +where +.Dv +is a number starting at zero. +There is at most one network interface per PCI function. .Pp -For more information on configuring this device, see -.Xr ifconfig 8 . +For further information and questions related to hardware +requirements, see +.Pa https://www.mellanox.com . .Sh HARDWARE The .Nm -driver supports 100Gb, 50Gb, 40Gb, 25Gb and 10Gb Ethernet adapters. -ConnectX-5 supports:10/20/25/40/50/56/100Gb/s speeds. -ConnectX-4 supports:10/20/25/40/50/56/100Gb/s speeds. -ConnectX-4 LX supports:10/25/40/50Gb/s speeds (and reduced power consumption) : -.Pp +driver supports 200Gb, 100Gb, 50Gb, 40Gb, 25Gb and 10Gb ethernet adapters. .Bl -bullet -compact +.Pp .It -Mellanox MCX455A-ECAT -.It -Mellanox MCX456A-ECAT -.It -Mellanox MCX415A-CCAT -.It -Mellanox MCX416A-CCAT -.It -Mellanox MCX455A-FCAT -.It -Mellanox MCX456A-FCAT -.It -Mellanox MCX415A-BCAT -.It -Mellanox MCX416A-BCAT -.It -Mellanox MCX4131A-GCAT -.It -Mellanox MCX4131A-BCAT -.It -Mellanox MCX4121A-ACAT +ConnectX-6 supports 10/20/25/40/50/56/100Gb/200Gb/s speeds. .It -Mellanox MCX4111A-ACAT +ConnectX-5 supports 10/20/25/40/50/56/100Gb/s speeds. .It -Mellanox MCX4121A-XCAT +ConnectX-4 supports 10/20/25/40/50/56/100Gb/s speeds. .It -Mellanox MCX4111A-XCAT +ConnectX-4 LX supports 10/25/40/50Gb/s speeds and reduced power consumption. .El +.Sh CONFIGURATION +The +.Nm +network interface is configured using +.Xr ifconfig 8 +and the +.Xr sysctl 8 +tree at +.Dv dev.mce. . +All configurable entries are also tunables, and can be put directly into the +.Xr loader.conf 5 +for persistent configuration. .Sh SUPPORT For general information and support, -go to the Mellanox support website at: -.Pa http://www.mellanox.com/ . +go to the NVIDIA Mellanox networking support website at: +.Pa https://www.mellanox.com . .Pp -If an issue is identified with this driver with a supported adapter, -email all the specific information related to the issue to -.Aq Mt freebsd-drivers@mellanox.com . +If an issue is identified with this driver using a supported adapter, +e-mail all the specific information related to the issue to +.Aq Mt nbu-freebsd-drivers@nvidia.com . .Sh SEE ALSO .Xr ifconfig 8 .Sh HISTORY @@ -133,4 +131,4 @@ device driver first appeared in The .Nm driver was written by -.An Mellanox Technologies . +.An NVIDIA Mellanox networking . From owner-dev-commits-src-all@freebsd.org Wed Sep 22 13:02:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2368366A9E9; Wed, 22 Sep 2021 13:02: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 4HDz3Y5LVgz3DTg; Wed, 22 Sep 2021 13:02: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 78BFA1831F; Wed, 22 Sep 2021 13:02: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 18MD2XQG013078; Wed, 22 Sep 2021 13:02:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MD2Xws013077; Wed, 22 Sep 2021 13:02:33 GMT (envelope-from git) Date: Wed, 22 Sep 2021 13:02:33 GMT Message-Id: <202109221302.18MD2Xws013077@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 5c4a6f277a92 - stable/13 - sound(4): Fix typos. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5c4a6f277a92aa827c13bccdef1a2ad6949d6160 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 13:02:34 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=5c4a6f277a92aa827c13bccdef1a2ad6949d6160 commit 5c4a6f277a92aa827c13bccdef1a2ad6949d6160 Author: Hans Petter Selasky AuthorDate: 2021-07-28 11:25:01 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-22 12:59:31 +0000 sound(4): Fix typos. Submitted by: Christos Margiolis Differential Revision: https://reviews.freebsd.org/D31320 MFC after: 1 week Sponsored by: NVIDIA Networking (cherry picked from commit 132fca6335939b308f230d4942ba15ba2b56ceb7) --- sys/dev/sound/pcm/sound.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index 299e4937f8e4..e03529f00b78 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -1020,7 +1020,7 @@ pcm_sysinit(device_t dev) { struct snddev_info *d = device_get_softc(dev); - /* XXX: an user should be able to set this with a control tool, the + /* XXX: a user should be able to set this with a control tool, the sysadmin then needs min+max sysctls for this */ SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), @@ -1133,7 +1133,7 @@ pcm_register(device_t dev, void *devinfo, int numplay, int numrec) sysctl_ctx_init(&d->rec_sysctl_ctx); d->rec_sysctl_tree = SYSCTL_ADD_NODE(&d->rec_sysctl_ctx, SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "rec", - CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "record channels node"); + CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "recording channels node"); if (numplay > 0 || numrec > 0) d->flags |= SD_F_AUTOVCHAN; From owner-dev-commits-src-all@freebsd.org Wed Sep 22 13:02:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30D5266A833; Wed, 22 Sep 2021 13:02: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 4HDz3c30nNz3DK0; Wed, 22 Sep 2021 13:02: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 C154C1814C; Wed, 22 Sep 2021 13:02: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 18MD2ZrG013133; Wed, 22 Sep 2021 13:02:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MD2ZaC013132; Wed, 22 Sep 2021 13:02:35 GMT (envelope-from git) Date: Wed, 22 Sep 2021 13:02:35 GMT Message-Id: <202109221302.18MD2ZaC013132@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 1483b121d028 - stable/13 - sound(4): Implement playback and recording mode sysctl(8). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1483b121d0285bda728833e9690570ec6dbe3982 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 13:02:37 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=1483b121d0285bda728833e9690570ec6dbe3982 commit 1483b121d0285bda728833e9690570ec6dbe3982 Author: Hans Petter Selasky AuthorDate: 2021-07-28 11:22:52 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-22 12:59:31 +0000 sound(4): Implement playback and recording mode sysctl(8). The dev.pcm..mode sysctl(8) gives information if a sound device supports hardware mixing, playback or recording. Submitted by: Christos Margiolis Differential Revision: https://reviews.freebsd.org/D31320 MFC after: 1 week Sponsored by: NVIDIA Networking (cherry picked from commit ed2196e5df0c8b5b81563d2fffdcb32bb7ebe966) --- sys/dev/sound/pcm/sound.c | 23 +++++++++++++++++++++++ sys/dev/sound/pcm/sound.h | 4 ++++ 2 files changed, 27 insertions(+) diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index e03529f00b78..663ec84f93b6 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -1015,10 +1015,28 @@ SYSCTL_PROC(_hw_snd, OID_AUTO, clone_gc, "global clone garbage collector"); #endif +static u_int8_t +pcm_mode_init(struct snddev_info *d) +{ + u_int8_t mode = 0; + + if (d->playcount > 0) + mode |= PCM_MODE_PLAY; + if (d->reccount > 0) + mode |= PCM_MODE_REC; + if (d->mixer_dev != NULL) + mode |= PCM_MODE_MIXER; + + return (mode); +} + static void pcm_sysinit(device_t dev) { struct snddev_info *d = device_get_softc(dev); + u_int8_t mode; + + mode = pcm_mode_init(d); /* XXX: a user should be able to set this with a control tool, the sysadmin then needs min+max sysctls for this */ @@ -1030,6 +1048,11 @@ pcm_sysinit(device_t dev) "bitperfect", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, d, sizeof(d), sysctl_dev_pcm_bitperfect, "I", "bit-perfect playback/recording (0=disable, 1=enable)"); + SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "mode", CTLFLAG_RD, NULL, mode, + "mode (1=mixer, 2=play, 4=rec. The values are OR'ed if more than one" + "mode is supported)"); #ifdef SND_DEBUG SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index cdae5e837cdc..62787a3e689c 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -411,6 +411,10 @@ struct snddev_info { void sound_oss_sysinfo(oss_sysinfo *); int sound_oss_card_info(oss_card_info *); +#define PCM_MODE_MIXER 0x01 +#define PCM_MODE_PLAY 0x02 +#define PCM_MODE_REC 0x04 + #define PCM_LOCKOWNED(d) mtx_owned((d)->lock) #define PCM_LOCK(d) mtx_lock((d)->lock) #define PCM_UNLOCK(d) mtx_unlock((d)->lock) From owner-dev-commits-src-all@freebsd.org Wed Sep 22 13:02:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F12B766A7AD; Wed, 22 Sep 2021 13:02: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 4HDz3b1Npfz3DTn; Wed, 22 Sep 2021 13:02: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 9C70C17FB0; Wed, 22 Sep 2021 13:02: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 18MD2YXw013102; Wed, 22 Sep 2021 13:02:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MD2Ymq013101; Wed, 22 Sep 2021 13:02:34 GMT (envelope-from git) Date: Wed, 22 Sep 2021 13:02:34 GMT Message-Id: <202109221302.18MD2Ymq013101@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 66e91a9ee19f - stable/13 - Implement the SOUND_MIXER_WRITE_MUTE and SOUND_MIXER_READ_MUTE ioctl(9)s. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 66e91a9ee19fe09125e5cf535c440c80faf77fa6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 13:02:36 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=66e91a9ee19fe09125e5cf535c440c80faf77fa6 commit 66e91a9ee19fe09125e5cf535c440c80faf77fa6 Author: Hans Petter Selasky AuthorDate: 2021-07-20 17:02:41 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-22 12:59:31 +0000 Implement the SOUND_MIXER_WRITE_MUTE and SOUND_MIXER_READ_MUTE ioctl(9)s. These two ioctls are not part of the current version of OSS and were considered obsolete. However, their behaviour is not the same as their old one, so this implementation is specific to FreeBSD. Older OSS versions had the MUTE ioctls take and return an integer with a value of 0 or 1, which meant that the _whole_ mixer is unmuted or muted respectively. In my implementation, the ioctl takes and returns a bitmask that tells us which devices are muted. This allows us to mute and unmute only the devices we want, instead of the whole mixer. The bitmask works the same way as in DEVMASK, RECMASK and RECSRC. Integrated the hardware volume feature with the new mute system. Submitted by: Christos Margiolis Differential Revision: https://reviews.freebsd.org/D31130 MFC after: 1 week Sponsored by: NVIDIA Networking (cherry picked from commit 0f8dafb45859569aa36b63ca2bb4a1c35c970d1e) --- sys/dev/sound/pcm/mixer.c | 122 +++++++++++++++++++++++++++++++--------------- sys/dev/sound/pcm/mixer.h | 2 + 2 files changed, 84 insertions(+), 40 deletions(-) diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 09b0bb8ab148..89e78b036e94 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -51,16 +51,16 @@ struct snd_mixer { KOBJ_FIELDS; void *devinfo; int busy; - int hwvol_muted; int hwvol_mixer; int hwvol_step; int type; device_t dev; - u_int32_t hwvol_mute_level; u_int32_t devs; + u_int32_t mutedevs; u_int32_t recdevs; u_int32_t recsrc; u_int16_t level[32]; + u_int16_t level_muted[32]; u_int8_t parent[32]; u_int32_t child[32]; u_int8_t realdev[32]; @@ -244,7 +244,7 @@ mixer_set_eq(struct snd_mixer *m, struct snddev_info *d, } static int -mixer_set(struct snd_mixer *m, u_int dev, u_int lev) +mixer_set(struct snd_mixer *m, u_int dev, u_int32_t muted, u_int lev) { struct snddev_info *d; u_int l, r, tl, tr; @@ -254,7 +254,7 @@ mixer_set(struct snd_mixer *m, u_int dev, u_int lev) if (m == NULL || dev >= SOUND_MIXER_NRDEVICES || (0 == (m->devs & (1 << dev)))) - return -1; + return (-1); l = min((lev & 0x00ff), 100); r = min(((lev & 0xff00) >> 8), 100); @@ -262,7 +262,7 @@ mixer_set(struct snd_mixer *m, u_int dev, u_int lev) d = device_get_softc(m->dev); if (d == NULL) - return -1; + return (-1); /* It is safe to drop this mutex due to Giant. */ if (!(d->flags & SD_F_MPSAFE) && mtx_owned(m->lock) != 0) @@ -270,6 +270,11 @@ mixer_set(struct snd_mixer *m, u_int dev, u_int lev) else dropmtx = 0; + /* Allow the volume to be "changed" while muted. */ + if (muted & (1 << dev)) { + m->level_muted[dev] = l | (r << 8); + return (0); + } MIXER_SET_UNLOCK(m, dropmtx); /* TODO: recursive handling */ @@ -287,7 +292,7 @@ mixer_set(struct snd_mixer *m, u_int dev, u_int lev) else if (realdev != SOUND_MIXER_NONE && MIXER_SET(m, realdev, tl, tr) < 0) { MIXER_SET_LOCK(m, dropmtx); - return -1; + return (-1); } } else if (child != 0) { for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { @@ -305,8 +310,8 @@ mixer_set(struct snd_mixer *m, u_int dev, u_int lev) realdev = m->realdev[dev]; if (realdev != SOUND_MIXER_NONE && MIXER_SET(m, realdev, l, r) < 0) { - MIXER_SET_LOCK(m, dropmtx); - return -1; + MIXER_SET_LOCK(m, dropmtx); + return (-1); } } else { if (dev == SOUND_MIXER_PCM && (d->flags & SD_F_SOFTPCMVOL)) @@ -317,7 +322,7 @@ mixer_set(struct snd_mixer *m, u_int dev, u_int lev) else if (realdev != SOUND_MIXER_NONE && MIXER_SET(m, realdev, l, r) < 0) { MIXER_SET_LOCK(m, dropmtx); - return -1; + return (-1); } } @@ -326,16 +331,42 @@ mixer_set(struct snd_mixer *m, u_int dev, u_int lev) m->level[dev] = l | (r << 8); m->modify_counter++; - return 0; + return (0); } static int mixer_get(struct snd_mixer *mixer, int dev) { - if ((dev < SOUND_MIXER_NRDEVICES) && (mixer->devs & (1 << dev))) - return mixer->level[dev]; - else - return -1; + if ((dev < SOUND_MIXER_NRDEVICES) && (mixer->devs & (1 << dev))) { + if (mixer->mutedevs & (1 << dev)) + return (mixer->level_muted[dev]); + else + return (mixer->level[dev]); + } else { + return (-1); + } +} + +void +mix_setmutedevs(struct snd_mixer *mixer, u_int32_t mutedevs) +{ + u_int32_t delta; + + /* Filter out invalid values. */ + mutedevs &= mixer->devs; + delta = (mixer->mutedevs ^ mutedevs) & mixer->devs; + mixer->mutedevs = mutedevs; + + for (int i = 0; i < SOUND_MIXER_NRDEVICES; i++) { + if (!(delta & (1 << i))) + continue; + if (mutedevs & (1 << i)) { + mixer->level_muted[i] = mixer->level[i]; + mixer_set(mixer, i, 0, 0); + } else { + mixer_set(mixer, i, 0, mixer->level_muted[i]); + } + } } static int @@ -598,6 +629,12 @@ mix_getdevs(struct snd_mixer *m) return m->devs; } +u_int32_t +mix_getmutedevs(struct snd_mixer *m) +{ + return m->mutedevs; +} + u_int32_t mix_getrecdevs(struct snd_mixer *m) { @@ -721,7 +758,7 @@ mixer_init(device_t dev, kobj_class_t cls, void *devinfo) } } - mixer_set(m, i, v | (v << 8)); + mixer_set(m, i, 0, v | (v << 8)); } mixer_setrecsrc(m, 0); /* Set default input. */ @@ -799,7 +836,7 @@ mixer_uninit(device_t dev) snd_mtxlock(m->lock); for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) - mixer_set(m, i, 0); + mixer_set(m, i, 0, 0); mixer_setrecsrc(m, SOUND_MASK_MIC); @@ -836,8 +873,12 @@ mixer_reinit(device_t dev) return i; } - for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) - mixer_set(m, i, m->level[i]); + for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { + if (m->mutedevs & (1 << i)) + mixer_set(m, i, 0, 0); + else + mixer_set(m, i, 0, m->level[i]); + } mixer_setrecsrc(m, m->recsrc); snd_mtxunlock(m->lock); @@ -863,10 +904,8 @@ sysctl_hw_snd_hwvol_mixer(SYSCTL_HANDLER_ARGS) if (dev == -1) { snd_mtxunlock(m->lock); return EINVAL; - } - else if (dev != m->hwvol_mixer) { + } else { m->hwvol_mixer = dev; - m->hwvol_muted = 0; } } snd_mtxunlock(m->lock); @@ -897,14 +936,7 @@ mixer_hwvol_init(device_t dev) void mixer_hwvol_mute_locked(struct snd_mixer *m) { - if (m->hwvol_muted) { - m->hwvol_muted = 0; - mixer_set(m, m->hwvol_mixer, m->hwvol_mute_level); - } else { - m->hwvol_muted++; - m->hwvol_mute_level = mixer_get(m, m->hwvol_mixer); - mixer_set(m, m->hwvol_mixer, 0); - } + mix_setmutedevs(m, m->mutedevs ^ (1 << m->hwvol_mixer)); } void @@ -925,11 +957,8 @@ mixer_hwvol_step_locked(struct snd_mixer *m, int left_step, int right_step) { int level, left, right; - if (m->hwvol_muted) { - m->hwvol_muted = 0; - level = m->hwvol_mute_level; - } else - level = mixer_get(m, m->hwvol_mixer); + level = mixer_get(m, m->hwvol_mixer); + if (level != -1) { left = level & 0xff; right = (level >> 8) & 0xff; @@ -943,7 +972,8 @@ mixer_hwvol_step_locked(struct snd_mixer *m, int left_step, int right_step) right = 0; else if (right > 100) right = 100; - mixer_set(m, m->hwvol_mixer, left | right << 8); + + mixer_set(m, m->hwvol_mixer, m->mutedevs, left | right << 8); } } @@ -976,7 +1006,7 @@ mix_set(struct snd_mixer *m, u_int dev, u_int left, u_int right) KASSERT(m != NULL, ("NULL snd_mixer")); snd_mtxlock(m->lock); - ret = mixer_set(m, dev, left | (right << 8)); + ret = mixer_set(m, dev, m->mutedevs, left | (right << 8)); snd_mtxunlock(m->lock); return ((ret != 0) ? ENXIO : 0); @@ -1304,10 +1334,18 @@ mixer_ioctl_cmd(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, goto done; } if ((cmd & ~0xff) == MIXER_WRITE(0)) { - if (j == SOUND_MIXER_RECSRC) + switch (j) { + case SOUND_MIXER_RECSRC: ret = mixer_setrecsrc(m, *arg_i); - else - ret = mixer_set(m, j, *arg_i); + break; + case SOUND_MIXER_MUTE: + mix_setmutedevs(m, *arg_i); + ret = 0; + break; + default: + ret = mixer_set(m, j, m->mutedevs, *arg_i); + break; + } snd_mtxunlock(m->lock); return ((ret == 0) ? 0 : ENXIO); } @@ -1318,6 +1356,9 @@ mixer_ioctl_cmd(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, case SOUND_MIXER_STEREODEVS: v = mix_getdevs(m); break; + case SOUND_MIXER_MUTE: + v = mix_getmutedevs(m); + break; case SOUND_MIXER_RECMASK: v = mix_getrecdevs(m); break; @@ -1326,6 +1367,7 @@ mixer_ioctl_cmd(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, break; default: v = mixer_get(m, j); + break; } *arg_i = v; snd_mtxunlock(m->lock); @@ -1554,5 +1596,5 @@ mix_set_locked(struct snd_mixer *m, u_int dev, int left, int right) level = (left & 0xFF) | ((right & 0xFF) << 8); - return (mixer_set(m, dev, level)); + return (mixer_set(m, dev, m->mutedevs, level)); } diff --git a/sys/dev/sound/pcm/mixer.h b/sys/dev/sound/pcm/mixer.h index 8e11d553a3e4..7857609b2895 100644 --- a/sys/dev/sound/pcm/mixer.h +++ b/sys/dev/sound/pcm/mixer.h @@ -60,8 +60,10 @@ device_t mix_get_dev(struct snd_mixer *m); void mix_setdevs(struct snd_mixer *m, u_int32_t v); void mix_setrecdevs(struct snd_mixer *m, u_int32_t v); +void mix_setmutedevs(struct snd_mixer *m, u_int32_t v); u_int32_t mix_getdevs(struct snd_mixer *m); u_int32_t mix_getrecdevs(struct snd_mixer *m); +u_int32_t mix_getmutedevs(struct snd_mixer *m); void mix_setparentchild(struct snd_mixer *m, u_int32_t parent, u_int32_t childs); void mix_setrealdev(struct snd_mixer *m, u_int32_t dev, u_int32_t realdev); u_int32_t mix_getparent(struct snd_mixer *m, u_int32_t dev); From owner-dev-commits-src-all@freebsd.org Wed Sep 22 13:02:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D14C66A566; Wed, 22 Sep 2021 13:02: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 4HDz3d31cDz3DRZ; Wed, 22 Sep 2021 13:02: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 D582418320; Wed, 22 Sep 2021 13:02: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 18MD2aMC013157; Wed, 22 Sep 2021 13:02:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MD2ah1013156; Wed, 22 Sep 2021 13:02:36 GMT (envelope-from git) Date: Wed, 22 Sep 2021 13:02:36 GMT Message-Id: <202109221302.18MD2ah1013156@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: e4cbb47700bc - stable/13 - Cleanup unused USB enums. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e4cbb47700bc91538b69b78c0b5009dfae69176b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 13:02:38 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=e4cbb47700bc91538b69b78c0b5009dfae69176b commit e4cbb47700bc91538b69b78c0b5009dfae69176b Author: Hans Petter Selasky AuthorDate: 2021-07-15 10:38:16 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-22 12:59:31 +0000 Cleanup unused USB enums. MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/usb_transfer.h | 117 +++------------------------------------------ 1 file changed, 7 insertions(+), 110 deletions(-) diff --git a/sys/dev/usb/usb_transfer.h b/sys/dev/usb/usb_transfer.h index c6b97e1ab3c5..0dd750c33c0d 100644 --- a/sys/dev/usb/usb_transfer.h +++ b/sys/dev/usb/usb_transfer.h @@ -30,119 +30,16 @@ #define _USB_TRANSFER_H_ /* - * Definition of internal USB transfer states: - * =========================================== + * A few words about USB transfer states: + * ====================================== * - * The main reason there are many USB states is that we are allowed to - * cancel USB transfers, then start the USB transfer again and that - * this state transaction cannot always be done in a single atomic - * operation without blocking the calling thread. One reason for this - * is that the USB hardware sometimes needs to wait for DMA - * controllers to finish which is done asynchronously and grows the - * statemachine. - * - * When extending the following statemachine there are basically two - * things you should think about: Which states should be executed or - * modified in case of USB transfer stop and which states should be - * executed or modified in case of USB transfer start. Also respect - * the "can_cancel_immed" flag which basically tells if you can go - * directly from a wait state to the cancelling states. + * USB transfers can have multiple states, because they can be + * cancelled and started again and this cannot always be done + * atomically under a mutex. One reason for this is that the USB + * hardware sometimes needs to wait for DMA controllers to finish + * which is done asynchronously and grows the statemachine. */ -enum { - /* XFER start execute state */ - - /* USB_ST_SETUP = 0 (already defined) */ - - /* XFER transferred execute state */ - - /* USB_ST_TRANSFERRED = 1 (already defined) */ - - /* XFER error execute state */ - - /* USB_ST_ERROR = 2 (already defined) */ - - /* XFER restart after error execute state */ - - USB_ST_RESTART = 8, - - /* XFER transfer idle state */ - - USB_ST_WAIT_SETUP, - - /* Other XFER execute states */ - - USB_ST_PIPE_OPEN = 16, - USB_ST_PIPE_OPEN_ERROR, - USB_ST_PIPE_OPEN_RESTART, - - USB_ST_BDMA_LOAD, - USB_ST_BDMA_LOAD_ERROR, - USB_ST_BDMA_LOAD_RESTART, - - USB_ST_IVAL_DLY, - USB_ST_IVAL_DLY_ERROR, - USB_ST_IVAL_DLY_RESTART, - - USB_ST_PIPE_STALL, - USB_ST_PIPE_STALL_ERROR, - USB_ST_PIPE_STALL_RESTART, - - USB_ST_ENTER, - USB_ST_ENTER_ERROR, - USB_ST_ENTER_RESTART, - - USB_ST_START, - USB_ST_START_ERROR, - USB_ST_START_RESTART, - - USB_ST_PIPE_CLOSE, - USB_ST_PIPE_CLOSE_ERROR, - USB_ST_PIPE_CLOSE_RESTART, - - USB_ST_BDMA_DLY, - USB_ST_BDMA_DLY_ERROR, - USB_ST_BDMA_DLY_RESTART, - - /* XFER transfer wait states */ - - USB_ST_WAIT_PIPE_OPEN = 64, - USB_ST_WAIT_PIPE_OPEN_ERROR, - USB_ST_WAIT_PIPE_OPEN_RESTART, - - USB_ST_WAIT_BDMA_LOAD, - USB_ST_WAIT_BDMA_LOAD_ERROR, - USB_ST_WAIT_BDMA_LOAD_RESTART, - - USB_ST_WAIT_IVAL_DLY, - USB_ST_WAIT_IVAL_DLY_ERROR, - USB_ST_WAIT_IVAL_DLY_RESTART, - - USB_ST_WAIT_PIPE_STALL, - USB_ST_WAIT_PIPE_STALL_ERROR, - USB_ST_WAIT_PIPE_STALL_RESTART, - - USB_ST_WAIT_ENTER, - USB_ST_WAIT_ENTER_ERROR, - USB_ST_WAIT_ENTER_RESTART, - - USB_ST_WAIT_START, - USB_ST_WAIT_START_ERROR, - USB_ST_WAIT_START_RESTART, - - USB_ST_WAIT_PIPE_CLOSE, - USB_ST_WAIT_PIPE_CLOSE_ERROR, - USB_ST_WAIT_PIPE_CLOSE_RESTART, - - USB_ST_WAIT_BDMA_DLY, - USB_ST_WAIT_BDMA_DLY_ERROR, - USB_ST_WAIT_BDMA_DLY_RESTART, - - USB_ST_WAIT_TRANSFERRED, - USB_ST_WAIT_TRANSFERRED_ERROR, - USB_ST_WAIT_TRANSFERRED_RESTART, -}; - /* * The following structure defines the messages that is used to signal * the "done_p" USB process. From owner-dev-commits-src-all@freebsd.org Wed Sep 22 14:06:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82C3466B753; Wed, 22 Sep 2021 14:06: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 4HF0Sq328Wz3QLx; Wed, 22 Sep 2021 14:06: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 47A6318CE1; Wed, 22 Sep 2021 14:06: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 18ME63wO093331; Wed, 22 Sep 2021 14:06:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ME63M0093330; Wed, 22 Sep 2021 14:06:03 GMT (envelope-from git) Date: Wed, 22 Sep 2021 14:06:03 GMT Message-Id: <202109221406.18ME63M0093330@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: c91cdb006e6c - stable/13 - grep: fix combination of quiet and count flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c91cdb006e6c83edab702b784c120e51c410e051 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 14:06:03 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=c91cdb006e6c83edab702b784c120e51c410e051 commit c91cdb006e6c83edab702b784c120e51c410e051 Author: Mariusz Zaborski AuthorDate: 2021-07-09 12:09:14 +0000 Commit: Ed Maste CommitDate: 2021-09-22 14:05:39 +0000 grep: fix combination of quiet and count flag When the quiet (-q) flag is provided, we don't expect any output. Currently, the behavior is broken: $ grep -cq flag util.c 1 $ grep -cs flag util.c 55 First of all, we print a number to stdout. Secondly, it just returns 0 or 1 (which is unexpected). GNU grep with c and q flags doesn't print anything. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D31108 (cherry picked from commit 24c681a7f6d6c777221fdbd289da64ff65ad8785) --- usr.bin/grep/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c index a2520e24de8e..698e347c192e 100644 --- a/usr.bin/grep/util.c +++ b/usr.bin/grep/util.c @@ -388,7 +388,7 @@ procfile(const char *fn) clearqueue(); grep_close(f); - if (cflag) { + if (cflag && !qflag) { if (!hflag) printf("%s:", pc.ln.file); printf("%u\n", lines); From owner-dev-commits-src-all@freebsd.org Wed Sep 22 14:07:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C77EB66BC96; Wed, 22 Sep 2021 14:07: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 4HF0Ty5KBFz3QTm; Wed, 22 Sep 2021 14:07: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 9781119002; Wed, 22 Sep 2021 14:07: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 18ME72Nl093505; Wed, 22 Sep 2021 14:07:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ME72sJ093504; Wed, 22 Sep 2021 14:07:02 GMT (envelope-from git) Date: Wed, 22 Sep 2021 14:07:02 GMT Message-Id: <202109221407.18ME72sJ093504@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 42368c6b5f92 - stable/12 - grep: fix combination of quiet and count flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 42368c6b5f920cda954621c3c541bfdb754ab0c8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 14:07:02 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=42368c6b5f920cda954621c3c541bfdb754ab0c8 commit 42368c6b5f920cda954621c3c541bfdb754ab0c8 Author: Mariusz Zaborski AuthorDate: 2021-07-09 12:09:14 +0000 Commit: Ed Maste CommitDate: 2021-09-22 14:06:39 +0000 grep: fix combination of quiet and count flag When the quiet (-q) flag is provided, we don't expect any output. Currently, the behavior is broken: $ grep -cq flag util.c 1 $ grep -cs flag util.c 55 First of all, we print a number to stdout. Secondly, it just returns 0 or 1 (which is unexpected). GNU grep with c and q flags doesn't print anything. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D31108 (cherry picked from commit 24c681a7f6d6c777221fdbd289da64ff65ad8785) --- usr.bin/grep/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c index 220ffaef7dab..5c7659fd0f28 100644 --- a/usr.bin/grep/util.c +++ b/usr.bin/grep/util.c @@ -386,7 +386,7 @@ procfile(const char *fn) clearqueue(); grep_close(f); - if (cflag) { + if (cflag && !qflag) { if (!hflag) printf("%s:", pc.ln.file); printf("%u\n", lines); From owner-dev-commits-src-all@freebsd.org Wed Sep 22 14:30:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E16F66BFB5; Wed, 22 Sep 2021 14:30: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 4HF11L2Gz2z3jhh; Wed, 22 Sep 2021 14:30: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 2F0D4195FB; Wed, 22 Sep 2021 14:30: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 18MEUkS2027988; Wed, 22 Sep 2021 14:30:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MEUkQJ027987; Wed, 22 Sep 2021 14:30:46 GMT (envelope-from git) Date: Wed, 22 Sep 2021 14:30:46 GMT Message-Id: <202109221430.18MEUkQJ027987@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: 7716178c0b38 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 7716178c0b389bdea83e8cab31c188ba1151bbfc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 14:30:46 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7716178c0b389bdea83e8cab31c188ba1151bbfc commit 7716178c0b389bdea83e8cab31c188ba1151bbfc Author: Warner Losh AuthorDate: 2021-09-01 19:37:27 +0000 Commit: Warner Losh CommitDate: 2021-09-22 14:29:58 +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 6a90f5729971..723db73412f8 100644 --- a/sys/dev/ppbus/ppbconf.h +++ b/sys/dev/ppbus/ppbconf.h @@ -259,6 +259,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 cf0c1a1c2f07..897ae1b78bd7 100644 --- a/sys/dev/ppbus/pps.c +++ b/sys/dev/ppbus/pps.c @@ -141,9 +141,11 @@ ppsattach(device_t dev) UID_ROOT, GID_WHEEL, 0600, PPS_NAME "%d", unit); sc->devs[0] = d; sc->pps[0].ppscap = PPS_CAPTUREASSERT | PPS_ECHOASSERT; + sc->pps[0].driver_abi = PPS_ABI_VERSION; + sc->pps[0].driver_mtx = ppb_get_lock(ppbus); d->si_drv1 = sc; d->si_drv2 = (void*)0; - pps_init(&sc->pps[0]); + pps_init_abi(&sc->pps[0]); ppb_lock(ppbus); if (ppb_request_bus(ppbus, dev, PPB_DONTWAIT)) { @@ -193,9 +195,11 @@ ppsattach(device_t dev) UID_ROOT, GID_WHEEL, 0600, PPS_NAME "%db%d", unit, i - 1); sc->devs[i] = d; sc->pps[i].ppscap = PPS_CAPTUREASSERT | PPS_CAPTURECLEAR; + sc->pps[i].driver_abi = PPS_ABI_VERSION; + sc->pps[i].driver_mtx = ppb_get_lock(ppbus); d->si_drv1 = sc; d->si_drv2 = (void *)(intptr_t)i; - pps_init(&sc->pps[i]); + pps_init_abi(&sc->pps[i]); } ppb_lock(ppbus); } while (0); From owner-dev-commits-src-all@freebsd.org Wed Sep 22 14:30:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B085766C0C3; Wed, 22 Sep 2021 14:30: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 4HF11M4GBLz3jft; Wed, 22 Sep 2021 14:30: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 5E66D193B7; Wed, 22 Sep 2021 14:30: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 18MEUlP9028012; Wed, 22 Sep 2021 14:30:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MEUl7m028011; Wed, 22 Sep 2021 14:30:47 GMT (envelope-from git) Date: Wed, 22 Sep 2021 14:30:47 GMT Message-Id: <202109221430.18MEUl7m028011@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: a9d18746f016 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: a9d18746f016c4acbaba2dec86a32cee5e9c9aa5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 14:30:47 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a9d18746f016c4acbaba2dec86a32cee5e9c9aa5 commit a9d18746f016c4acbaba2dec86a32cee5e9c9aa5 Author: Warner Losh AuthorDate: 2021-09-07 15:34:02 +0000 Commit: Warner Losh CommitDate: 2021-09-22 14:29:58 +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 85e9ea227150..30c462f6549b 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -97,16 +97,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 #define __GNUCLIKE_BUILTIN_NEXT_ARG 1 #define __GNUCLIKE_MATH_BUILTIN_RELOPS From owner-dev-commits-src-all@freebsd.org Wed Sep 22 14:30:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C92F566C0C4; Wed, 22 Sep 2021 14:30: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 4HF11N560lz3jfx; Wed, 22 Sep 2021 14:30: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 7DFF219492; Wed, 22 Sep 2021 14:30: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 18MEUmS2028036; Wed, 22 Sep 2021 14:30:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MEUmdk028035; Wed, 22 Sep 2021 14:30:48 GMT (envelope-from git) Date: Wed, 22 Sep 2021 14:30:48 GMT Message-Id: <202109221430.18MEUmdk028035@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: 5d8f8ab1eb40 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 5d8f8ab1eb4026446883bd0a353d14d8e1175939 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 14:30:49 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5d8f8ab1eb4026446883bd0a353d14d8e1175939 commit 5d8f8ab1eb4026446883bd0a353d14d8e1175939 Author: Warner Losh AuthorDate: 2021-09-07 16:08:51 +0000 Commit: Warner Losh CommitDate: 2021-09-22 14:29:59 +0000 genoffset.sh: Use 10 X's instead of 5 for pick mkdtemp implementations Linux fails to build now because the mkdtemp in the bootstrapped environment wants 6 or more X's. Use 10 out of an abundance of caution. Sponsored by: Netflix Reviewed by: arichards Differential Revision: https://reviews.freebsd.org/D31863 (cherry picked from commit ecfbb2e30241ee460617ad4e0c0be16d9930945a) --- sys/kern/genoffset.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/genoffset.sh b/sys/kern/genoffset.sh index f7185e7ae396..aedccfd84c6e 100644 --- a/sys/kern/genoffset.sh +++ b/sys/kern/genoffset.sh @@ -42,7 +42,7 @@ work() echo "#define _OFFSET_INC_" echo "#if !defined(GENOFFSET) && (!defined(KLD_MODULE) || defined(KLD_TIED))" last= - temp=$(mktemp -d genoffset.XXXXX) + temp=$(mktemp -d genoffset.XXXXXXXXXX) trap "rm -rf ${temp}" EXIT # Note: we need to print symbol values in decimal so the numeric sort works ${NM:='nm'} ${NMFLAGS} -t d "$1" | grep __assym_offset__ | sed -e 's/__/ /g' | sort -k 4 -k 1 -n | From owner-dev-commits-src-all@freebsd.org Wed Sep 22 15:00:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBA1766CBC7; Wed, 22 Sep 2021 15:00: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 4HF1h15r4cz3lyw; Wed, 22 Sep 2021 15:00: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 A81D919A29; Wed, 22 Sep 2021 15:00: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 18MF0n5b068534; Wed, 22 Sep 2021 15:00:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MF0nKM068533; Wed, 22 Sep 2021 15:00:49 GMT (envelope-from git) Date: Wed, 22 Sep 2021 15:00:49 GMT Message-Id: <202109221500.18MF0nKM068533@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: 0437d10e359e - stable/13 - direct commit: fix KBI for pci_dev MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0437d10e359ea1cbefff8d17cd18ca491dbbd5d7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 15:00:49 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0437d10e359ea1cbefff8d17cd18ca491dbbd5d7 commit 0437d10e359ea1cbefff8d17cd18ca491dbbd5d7 Author: Warner Losh AuthorDate: 2021-09-22 14:47:12 +0000 Commit: Warner Losh CommitDate: 2021-09-22 15:00:16 +0000 direct commit: fix KBI for pci_dev Move all the new elemenets to the end of the structure for 13. We allocate this inside the linuxkpi code, so the size isn't enccoded in client modules. However, the offsets to the different fields are encoded. Tihs modifies 04456f711853, 40a215e38a4d, and 3a606aadf2e7 and will likely create merge conflicts there (and that's a good thing since the elements need to be moved to the end of the structure when merging). Tweak irq_ent to be binary compatible. Since this is inlined into the clients, all clients have to agree on the irq_ent offsets. Restore visibility to linux_kmem_cache_free_rcu linux_kmem_cache_free_rcu was made static in 10235ad0567f, however client drivers depended on calling it directly. Make it visible again to restore the 13.0-Release KBI for linuxkpi. Bump FreeBSD_version to 1300515 for restoration of 13.0 KBI. Since this commmit changes the linuxkpi KBI (this time back to 13.0 release to restore the status quo of), you'll need to recompile everything that uses it (you needed to earlier as well, but those were silent recompilation events). The plus side is that our packages (built using 13.0) for drm-kmod 5.4 work again on -stable systems. Reviewed by: bz, wulf Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31363 --- sys/compat/linuxkpi/common/include/linux/interrupt.h | 4 +++- sys/compat/linuxkpi/common/include/linux/pci.h | 16 ++++++++++------ sys/compat/linuxkpi/common/include/linux/slab.h | 2 ++ sys/compat/linuxkpi/common/src/linux_slab.c | 8 ++++---- sys/sys/param.h | 2 +- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/interrupt.h b/sys/compat/linuxkpi/common/include/linux/interrupt.h index 6770adad2293..066157f9b559 100644 --- a/sys/compat/linuxkpi/common/include/linux/interrupt.h +++ b/sys/compat/linuxkpi/common/include/linux/interrupt.h @@ -52,9 +52,11 @@ struct irq_ent { struct resource *res; void *arg; irqreturn_t (*handler)(int, void *); - irqreturn_t (*thread_handler)(int, void *); void *tag; unsigned int irq; + + /* XXX All new entries must be after this in stable/13 */ + irqreturn_t (*thread_handler)(int, void *); }; void linux_irq_handler(void *); diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 4784799d82b5..1ec7fe75388d 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -237,7 +237,6 @@ struct pci_dev { struct list_head links; struct pci_driver *pdrv; struct pci_bus *bus; - struct pci_dev *root; uint16_t device; uint16_t vendor; uint16_t subsystem_vendor; @@ -246,16 +245,21 @@ struct pci_dev { unsigned int devfn; uint32_t class; uint8_t revision; - bool managed; /* devres "pcim_*(). */ - bool want_iomap_res; bool msi_enabled; - bool msix_enabled; - phys_addr_t rom; - size_t romlen; TAILQ_HEAD(, pci_mmio_region) mmio; + + /* Add all new items at the end of the list in 13 */ + struct pci_dev *root; + phys_addr_t rom; + size_t romlen; + bool managed; /* devres "pcim_*(). */ + bool want_iomap_res; + bool msix_enabled; }; +/* XXX add kassert here on the mmio offset */ + /* We need some meta-struct to keep track of these for devres. */ struct pci_devres { bool enable_io; diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h b/sys/compat/linuxkpi/common/include/linux/slab.h index ecd39d711eb4..23ba8b9c8ae7 100644 --- a/sys/compat/linuxkpi/common/include/linux/slab.h +++ b/sys/compat/linuxkpi/common/include/linux/slab.h @@ -210,5 +210,7 @@ extern void *lkpi_kmem_cache_zalloc(struct linux_kmem_cache *, gfp_t); extern void lkpi_kmem_cache_free(struct linux_kmem_cache *, void *); extern void linux_kmem_cache_destroy(struct linux_kmem_cache *); void linux_kfree_async(void *); +void linux_kmem_cache_free_rcu_callback(struct rcu_head *head); +void linux_kmem_cache_free_rcu(struct linux_kmem_cache *, void *); #endif /* _LINUX_SLAB_H_ */ diff --git a/sys/compat/linuxkpi/common/src/linux_slab.c b/sys/compat/linuxkpi/common/src/linux_slab.c index 5dbd87b66d1a..35a88fd7cf42 100644 --- a/sys/compat/linuxkpi/common/src/linux_slab.c +++ b/sys/compat/linuxkpi/common/src/linux_slab.c @@ -96,7 +96,7 @@ linux_kmem_ctor(void *mem, int size, void *arg, int flags) return (0); } -static void +void linux_kmem_cache_free_rcu_callback(struct rcu_head *head) { struct linux_kmem_rcu *rcu = @@ -145,8 +145,8 @@ linux_kmem_cache_create(const char *name, size_t size, size_t align, return (c); } -static inline void -lkpi_kmem_cache_free_rcu(struct linux_kmem_cache *c, void *m) +void +linux_kmem_cache_free_rcu(struct linux_kmem_cache *c, void *m) { struct linux_kmem_rcu *rcu = LINUX_KMEM_TO_RCU(c, m); @@ -183,7 +183,7 @@ void lkpi_kmem_cache_free(struct linux_kmem_cache *c, void *m) { if (unlikely(c->cache_flags & SLAB_TYPESAFE_BY_RCU)) - lkpi_kmem_cache_free_rcu(c, m); + linux_kmem_cache_free_rcu(c, m); else if (unlikely(curthread->td_critnest != 0)) lkpi_kmem_cache_free_async(c, m); else diff --git a/sys/sys/param.h b/sys/sys/param.h index ef5eb4206706..c1066baa59f2 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 1300514 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300515 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-all@freebsd.org Wed Sep 22 16:22:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96C8766D79B; Wed, 22 Sep 2021 16:22:39 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HF3VQ3QMfz4V7j; Wed, 22 Sep 2021 16:22:38 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf1-x12f.google.com with SMTP id z24so14334928lfu.13; Wed, 22 Sep 2021 09:22:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=aowu8g3Cl4FEk0wT7lIKGyg1V7ZbWqkQrGXDIgbuisw=; b=pvQoQPawzJneitkwYr3FrlXgCO7BpXhKDufToTRJsDuXYCZAYcJdhXXYzivGQi2Gpb NZy+tjB9vAdeM5VZlEvw1Vy0li1XviaUFNETR+8qqhqckWnFS1kjmRvai04FBpVzp0w6 /F8JTKd+3cCvXs1sdrAvqEWhl3AAD2skgg/kkfAZpqknfg0GF8I+893wRFKdNaJ9hT5u DKF1gx0mjSeigjYz77ng2btaGBxsBYptw0Eg8/3mnJfX0/y8y7sNUOzplnAh780Qq1oH CfsY4MtQiel95OT3YktecbNi+ANddF1vPCqzO8OdMfiJbPR+YCNXMbnZ9OAzdI/1buZc eZwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=aowu8g3Cl4FEk0wT7lIKGyg1V7ZbWqkQrGXDIgbuisw=; b=eFNJlIF62QA7gx5Obm9/abe6mx3ygDFT0Wg0/0YwYoJQNXlj8aNqN821udx/ZjGQAv ko01powwB8eLzcV+DfBVeGHoBSq8U1xXcWaQIt3kalwwseuSUFIBEEQ34j3O0xmrgVS3 H2oT1DklMr0MP/CnL1b8VRh798rf+UvPWZa9Oz9kak/pH3UgpzfTAwPt3AjEXDtH3v1X AO6gZihZeJ6w/kpIz1xMhpa7G/7ZZzoN56nXWHE1iyn9UDPlowqxEET3eWq6c1EZ5dPf hkNibVNCUbS+NFRbkw5SGUpZnjSg/84RMhsJhRPHnHTLTBIBKvyYuad6zkg2tqmy3uJe GIrw== X-Gm-Message-State: AOAM533Qmvgf3wbsn94VPxSnwLBp45SoNX1vWSpT+NVHRKZRqLCQsN4u mclUVBtNrVOvEBisQWXaTuK2rYEORbWWwG2vMVXXn0La X-Google-Smtp-Source: ABdhPJxCbsocIHbUCUaNTabp6jiPTGhddgyh1JPAvneDl5Z6gvBiM9KIXWcVEJ/NcEjd6eLwN/WgoyF0tS4rpYyPkJ4= X-Received: by 2002:a2e:a231:: with SMTP id i17mr63151ljm.233.1632327712671; Wed, 22 Sep 2021 09:21:52 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:2f18:0:0:0:0:0 with HTTP; Wed, 22 Sep 2021 09:21:51 -0700 (PDT) In-Reply-To: <202109130801.18D81odG012720@gitrepo.freebsd.org> References: <202109130801.18D81odG012720@gitrepo.freebsd.org> From: Mateusz Guzik Date: Wed, 22 Sep 2021 18:21:51 +0200 Message-ID: Subject: Re: git: d00c1f7f2f4a - main - sdhci: add sysctls to dump sdhci registers and capabilites To: Wojciech Macek Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4HF3VQ3QMfz4V7j X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=pvQoQPaw; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::12f as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; TO_DN_SOME(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::12f:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 16:22:39 -0000 This crashes the kernel when called from sdhci_timeout: panic: malloc(M_WAITOK) with sleeping prohibited panic() at panic+0x1b3/frame 0xfffffe0063a6c8a0 malloc_dbg() at malloc_dbg+0x3df/frame 0xfffffe0063a6c8f0 malloc() at malloc+0xab/frame 0xfffffe0063a6c9c0 sbuf_new() at sbuf_new+0x769/frame 0xfffffe0063a6ca70 sdhci_timeout() at sdhci_timeout+0xec/frame 0xfffffe0063a6cb00 softclock_call_cc() at softclock_call_cc+0x9b5/frame 0xfffffe0063a6ccb0 softclock() at softclock+0x338/frame 0xfffffe0063a6cd50 ithread_loop() at ithread_loop+0x6d4/frame 0xfffffe0063a6cea0 fork_exit() at fork_exit+0x1c9/frame 0xfffffe0063a6cf30 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe0063a6cf30 --- trap 0x800001, rip = 0xa5ee00000000000, rsp = 0, rbp = 0xfffffe0000000000 --- Previous iteraton of the code was using printf which avoids memory alloc to begin with. On 9/13/21, Wojciech Macek wrote: > The branch main has been updated by wma: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=d00c1f7f2f4a811d5c756cbb0d585c56661839f7 > > commit d00c1f7f2f4a811d5c756cbb0d585c56661839f7 > Author: Bartlomiej Grzesik > AuthorDate: 2021-09-13 08:00:25 +0000 > Commit: Wojciech Macek > CommitDate: 2021-09-13 08:00:25 +0000 > > sdhci: add sysctls to dump sdhci registers and capabilites > > Add sysctls dev.sdhci.X.slotY.dumpregs and dev.sdhci.X.slotY.dumpcaps > which dumps sdhci registers or capabilities. > > Obtained from: Semihalf > Reviewed by: mw > Differential revision: https://reviews.freebsd.org/D31406 > --- > sys/dev/sdhci/sdhci.c | 223 > +++++++++++++++++++++++++++++++++++++------------- > 1 file changed, 165 insertions(+), 58 deletions(-) > > diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c > index 573e6949b57e..09df5e972ab6 100644 > --- a/sys/dev/sdhci/sdhci.c > +++ b/sys/dev/sdhci/sdhci.c > @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > > #include > #include > @@ -134,11 +135,18 @@ static int sdhci_cam_update_ios(struct sdhci_slot > *slot); > /* helper routines */ > static int sdhci_dma_alloc(struct sdhci_slot *slot, uint32_t caps); > static void sdhci_dma_free(struct sdhci_slot *slot); > +static void sdhci_dumpcaps(struct sdhci_slot *slot); > +static void sdhci_dumpcaps_buf(struct sdhci_slot *slot, struct sbuf *s); > static void sdhci_dumpregs(struct sdhci_slot *slot); > +static void sdhci_dumpregs_buf(struct sdhci_slot *slot, struct sbuf *s); > +static int sdhci_syctl_dumpcaps(SYSCTL_HANDLER_ARGS); > +static int sdhci_syctl_dumpregs(SYSCTL_HANDLER_ARGS); > static void sdhci_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, > int error); > static int slot_printf(const struct sdhci_slot *slot, const char * fmt, > ...) > __printflike(2, 3); > +static int slot_sprintf(const struct sdhci_slot *slot, struct sbuf *s, > + const char * fmt, ...) __printflike(3, 4); > static uint32_t sdhci_tuning_intmask(const struct sdhci_slot *slot); > > #define SDHCI_LOCK(_slot) mtx_lock(&(_slot)->mtx) > @@ -202,40 +210,156 @@ slot_printf(const struct sdhci_slot *slot, const char > * fmt, ...) > return (retval); > } > > -static void > -sdhci_dumpregs(struct sdhci_slot *slot) > +static int > +slot_sprintf(const struct sdhci_slot *slot, struct sbuf *s, > + const char * fmt, ...) > { > + va_list ap; > + int retval; > > - slot_printf(slot, > - "============== REGISTER DUMP ==============\n"); > + retval = sbuf_printf(s, "%s-slot%d: ", device_get_nameunit(slot->bus), > slot->num); > > - slot_printf(slot, "Sys addr: 0x%08x | Version: 0x%08x\n", > + va_start(ap, fmt); > + retval += sbuf_vprintf(s, fmt, ap); > + va_end(ap); > + > + return (retval); > +} > + > +static void > +sdhci_dumpregs_buf(struct sdhci_slot *slot, struct sbuf *s) > +{ > + slot_sprintf(slot, s, "============== REGISTER DUMP ==============\n"); > + > + slot_sprintf(slot, s, "Sys addr: 0x%08x | Version: 0x%08x\n", > RD4(slot, SDHCI_DMA_ADDRESS), RD2(slot, SDHCI_HOST_VERSION)); > - slot_printf(slot, "Blk size: 0x%08x | Blk cnt: 0x%08x\n", > + slot_sprintf(slot, s, "Blk size: 0x%08x | Blk cnt: 0x%08x\n", > RD2(slot, SDHCI_BLOCK_SIZE), RD2(slot, SDHCI_BLOCK_COUNT)); > - slot_printf(slot, "Argument: 0x%08x | Trn mode: 0x%08x\n", > + slot_sprintf(slot, s, "Argument: 0x%08x | Trn mode: 0x%08x\n", > RD4(slot, SDHCI_ARGUMENT), RD2(slot, SDHCI_TRANSFER_MODE)); > - slot_printf(slot, "Present: 0x%08x | Host ctl: 0x%08x\n", > + slot_sprintf(slot, s, "Present: 0x%08x | Host ctl: 0x%08x\n", > RD4(slot, SDHCI_PRESENT_STATE), RD1(slot, SDHCI_HOST_CONTROL)); > - slot_printf(slot, "Power: 0x%08x | Blk gap: 0x%08x\n", > + slot_sprintf(slot, s, "Power: 0x%08x | Blk gap: 0x%08x\n", > RD1(slot, SDHCI_POWER_CONTROL), RD1(slot, SDHCI_BLOCK_GAP_CONTROL)); > - slot_printf(slot, "Wake-up: 0x%08x | Clock: 0x%08x\n", > + slot_sprintf(slot, s, "Wake-up: 0x%08x | Clock: 0x%08x\n", > RD1(slot, SDHCI_WAKE_UP_CONTROL), RD2(slot, SDHCI_CLOCK_CONTROL)); > - slot_printf(slot, "Timeout: 0x%08x | Int stat: 0x%08x\n", > + slot_sprintf(slot, s, "Timeout: 0x%08x | Int stat: 0x%08x\n", > RD1(slot, SDHCI_TIMEOUT_CONTROL), RD4(slot, SDHCI_INT_STATUS)); > - slot_printf(slot, "Int enab: 0x%08x | Sig enab: 0x%08x\n", > + slot_sprintf(slot, s, "Int enab: 0x%08x | Sig enab: 0x%08x\n", > RD4(slot, SDHCI_INT_ENABLE), RD4(slot, SDHCI_SIGNAL_ENABLE)); > - slot_printf(slot, "AC12 err: 0x%08x | Host ctl2:0x%08x\n", > + slot_sprintf(slot, s, "AC12 err: 0x%08x | Host ctl2:0x%08x\n", > RD2(slot, SDHCI_ACMD12_ERR), RD2(slot, SDHCI_HOST_CONTROL2)); > - slot_printf(slot, "Caps: 0x%08x | Caps2: 0x%08x\n", > + slot_sprintf(slot, s, "Caps: 0x%08x | Caps2: 0x%08x\n", > RD4(slot, SDHCI_CAPABILITIES), RD4(slot, SDHCI_CAPABILITIES2)); > - slot_printf(slot, "Max curr: 0x%08x | ADMA err: 0x%08x\n", > + slot_sprintf(slot, s, "Max curr: 0x%08x | ADMA err: 0x%08x\n", > RD4(slot, SDHCI_MAX_CURRENT), RD1(slot, SDHCI_ADMA_ERR)); > - slot_printf(slot, "ADMA addr:0x%08x | Slot int: 0x%08x\n", > + slot_sprintf(slot, s, "ADMA addr:0x%08x | Slot int: 0x%08x\n", > RD4(slot, SDHCI_ADMA_ADDRESS_LO), RD2(slot, SDHCI_SLOT_INT_STATUS)); > > - slot_printf(slot, > - "===========================================\n"); > + slot_sprintf(slot, s, "===========================================\n"); > +} > + > +static void > +sdhci_dumpregs(struct sdhci_slot *slot) > +{ > + struct sbuf s; > + > + sbuf_new(&s, NULL, 1024, SBUF_AUTOEXTEND); > + sbuf_set_drain(&s, &sbuf_printf_drain, NULL); > + sdhci_dumpregs_buf(slot, &s); > + sbuf_finish(&s); > + sbuf_delete(&s); > +} > + > +static int > +sdhci_syctl_dumpregs(SYSCTL_HANDLER_ARGS) > +{ > + struct sdhci_slot *slot = arg1; > + struct sbuf s; > + > + sbuf_new_for_sysctl(&s, NULL, 1024, req); > + sbuf_putc(&s, '\n'); > + sdhci_dumpregs_buf(slot, &s); > + sbuf_finish(&s); > + sbuf_delete(&s); > + > + return (0); > +} > + > +static void > +sdhci_dumpcaps_buf(struct sdhci_slot *slot, struct sbuf *s) > +{ > + int host_caps = slot->host.caps; > + int caps = slot->caps; > + > + slot_sprintf(slot, s, > + "%uMHz%s %s VDD:%s%s%s VCCQ: 3.3V%s%s DRV: B%s%s%s %s %s\n", > + slot->max_clk / 1000000, > + (caps & SDHCI_CAN_DO_HISPD) ? " HS" : "", > + (host_caps & MMC_CAP_8_BIT_DATA) ? "8bits" : > + ((host_caps & MMC_CAP_4_BIT_DATA) ? "4bits" : "1bit"), > + (caps & SDHCI_CAN_VDD_330) ? " 3.3V" : "", > + (caps & SDHCI_CAN_VDD_300) ? " 3.0V" : "", > + ((caps & SDHCI_CAN_VDD_180) && > + (slot->opt & SDHCI_SLOT_EMBEDDED)) ? " 1.8V" : "", > + (host_caps & MMC_CAP_SIGNALING_180) ? " 1.8V" : "", > + (host_caps & MMC_CAP_SIGNALING_120) ? " 1.2V" : "", > + (host_caps & MMC_CAP_DRIVER_TYPE_A) ? "A" : "", > + (host_caps & MMC_CAP_DRIVER_TYPE_C) ? "C" : "", > + (host_caps & MMC_CAP_DRIVER_TYPE_D) ? "D" : "", > + (slot->opt & SDHCI_HAVE_DMA) ? "DMA" : "PIO", > + (slot->opt & SDHCI_SLOT_EMBEDDED) ? "embedded" : > + (slot->opt & SDHCI_NON_REMOVABLE) ? "non-removable" : > + "removable"); > + if (host_caps & (MMC_CAP_MMC_DDR52 | MMC_CAP_MMC_HS200 | > + MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) > + slot_sprintf(slot, s, "eMMC:%s%s%s%s\n", > + (host_caps & MMC_CAP_MMC_DDR52) ? " DDR52" : "", > + (host_caps & MMC_CAP_MMC_HS200) ? " HS200" : "", > + (host_caps & MMC_CAP_MMC_HS400) ? " HS400" : "", > + ((host_caps & > + (MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) == > + (MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) ? > + " HS400ES" : ""); > + if (host_caps & (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | > + MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104)) > + slot_sprintf(slot, s, "UHS-I:%s%s%s%s%s\n", > + (host_caps & MMC_CAP_UHS_SDR12) ? " SDR12" : "", > + (host_caps & MMC_CAP_UHS_SDR25) ? " SDR25" : "", > + (host_caps & MMC_CAP_UHS_SDR50) ? " SDR50" : "", > + (host_caps & MMC_CAP_UHS_SDR104) ? " SDR104" : "", > + (host_caps & MMC_CAP_UHS_DDR50) ? " DDR50" : ""); > + if (slot->opt & SDHCI_TUNING_SUPPORTED) > + slot_sprintf(slot, s, > + "Re-tuning count %d secs, mode %d\n", > + slot->retune_count, slot->retune_mode + 1); > +} > + > +static void > +sdhci_dumpcaps(struct sdhci_slot *slot) > +{ > + struct sbuf s; > + > + sbuf_new(&s, NULL, 1024, SBUF_AUTOEXTEND); > + sbuf_set_drain(&s, &sbuf_printf_drain, NULL); > + sdhci_dumpcaps_buf(slot, &s); > + sbuf_finish(&s); > + sbuf_delete(&s); > +} > + > +static int > +sdhci_syctl_dumpcaps(SYSCTL_HANDLER_ARGS) > +{ > + struct sdhci_slot *slot = arg1; > + struct sbuf s; > + > + sbuf_new_for_sysctl(&s, NULL, 1024, req); > + sbuf_putc(&s, '\n'); > + sdhci_dumpcaps_buf(slot, &s); > + sbuf_finish(&s); > + sbuf_delete(&s); > + > + return (0); > } > > static void > @@ -799,6 +923,8 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, > int num) > kobj_method_t *kobj_method; > uint32_t caps, caps2, freq, host_caps; > int err; > + char node_name[8]; > + struct sysctl_oid *node_oid; > > SDHCI_LOCK_INIT(slot); > > @@ -1047,46 +1173,7 @@ no_tuning: > } > > if (bootverbose || sdhci_debug) { > - slot_printf(slot, > - "%uMHz%s %s VDD:%s%s%s VCCQ: 3.3V%s%s DRV: B%s%s%s %s %s\n", > - slot->max_clk / 1000000, > - (caps & SDHCI_CAN_DO_HISPD) ? " HS" : "", > - (host_caps & MMC_CAP_8_BIT_DATA) ? "8bits" : > - ((host_caps & MMC_CAP_4_BIT_DATA) ? "4bits" : "1bit"), > - (caps & SDHCI_CAN_VDD_330) ? " 3.3V" : "", > - (caps & SDHCI_CAN_VDD_300) ? " 3.0V" : "", > - ((caps & SDHCI_CAN_VDD_180) && > - (slot->opt & SDHCI_SLOT_EMBEDDED)) ? " 1.8V" : "", > - (host_caps & MMC_CAP_SIGNALING_180) ? " 1.8V" : "", > - (host_caps & MMC_CAP_SIGNALING_120) ? " 1.2V" : "", > - (host_caps & MMC_CAP_DRIVER_TYPE_A) ? "A" : "", > - (host_caps & MMC_CAP_DRIVER_TYPE_C) ? "C" : "", > - (host_caps & MMC_CAP_DRIVER_TYPE_D) ? "D" : "", > - (slot->opt & SDHCI_HAVE_DMA) ? "DMA" : "PIO", > - (slot->opt & SDHCI_SLOT_EMBEDDED) ? "embedded" : > - (slot->opt & SDHCI_NON_REMOVABLE) ? "non-removable" : > - "removable"); > - if (host_caps & (MMC_CAP_MMC_DDR52 | MMC_CAP_MMC_HS200 | > - MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) > - slot_printf(slot, "eMMC:%s%s%s%s\n", > - (host_caps & MMC_CAP_MMC_DDR52) ? " DDR52" : "", > - (host_caps & MMC_CAP_MMC_HS200) ? " HS200" : "", > - (host_caps & MMC_CAP_MMC_HS400) ? " HS400" : "", > - ((host_caps & > - (MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) == > - (MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) ? > - " HS400ES" : ""); > - if (host_caps & (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | > - MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104)) > - slot_printf(slot, "UHS-I:%s%s%s%s%s\n", > - (host_caps & MMC_CAP_UHS_SDR12) ? " SDR12" : "", > - (host_caps & MMC_CAP_UHS_SDR25) ? " SDR25" : "", > - (host_caps & MMC_CAP_UHS_SDR50) ? " SDR50" : "", > - (host_caps & MMC_CAP_UHS_SDR104) ? " SDR104" : "", > - (host_caps & MMC_CAP_UHS_DDR50) ? " DDR50" : ""); > - if (slot->opt & SDHCI_TUNING_SUPPORTED) > - slot_printf(slot, "Re-tuning count %d secs, mode %d\n", > - slot->retune_count, slot->retune_mode + 1); > + sdhci_dumpcaps(slot); > sdhci_dumpregs(slot); > } > > @@ -1110,6 +1197,26 @@ no_tuning: > > sdhci_init(slot); > > + snprintf(node_name, sizeof(node_name), "slot%d", slot->num); > + > + node_oid = SYSCTL_ADD_NODE(device_get_sysctl_ctx(dev), > + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), > + OID_AUTO, node_name, CTLFLAG_RW, 0, "slot specific node"); > + > + node_oid = SYSCTL_ADD_NODE(device_get_sysctl_ctx(dev), > + SYSCTL_CHILDREN(node_oid), OID_AUTO, "debug", CTLFLAG_RW, 0, > + "Debugging node"); > + > + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(node_oid), > + OID_AUTO, "dumpregs", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, > + slot, 0, &sdhci_syctl_dumpregs, > + "A", "Dump SDHCI registers"); > + > + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(node_oid), > + OID_AUTO, "dumpcaps", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, > + slot, 0, &sdhci_syctl_dumpcaps, > + "A", "Dump SDHCI capabilites"); > + > return (0); > } > > -- Mateusz Guzik From owner-dev-commits-src-all@freebsd.org Wed Sep 22 18:03:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4753866F427; Wed, 22 Sep 2021 18:03: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 4HF5l31MHvz4ngq; Wed, 22 Sep 2021 18:03: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 0E7DE1BF64; Wed, 22 Sep 2021 18:03: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 18MI3hIO013392; Wed, 22 Sep 2021 18:03:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MI3gdA013391; Wed, 22 Sep 2021 18:03:42 GMT (envelope-from git) Date: Wed, 22 Sep 2021 18:03:42 GMT Message-Id: <202109221803.18MI3gdA013391@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 903873ce1560 - main - Implement and use new mixer(3) library for FreeBSD. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 903873ce15600fc02a0ea42cbf888cff232b411d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 18:03:43 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=903873ce15600fc02a0ea42cbf888cff232b411d commit 903873ce15600fc02a0ea42cbf888cff232b411d Author: Hans Petter Selasky AuthorDate: 2021-09-22 13:42:51 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-22 17:43:56 +0000 Implement and use new mixer(3) library for FreeBSD. Wiki article: https://wiki.freebsd.org/SummerOfCode2021Projects/SoundMixerImprovements This project was part of Google Summer of Code 2021. Submitted by: christos@ Differential Revision: https://reviews.freebsd.org/D31636 Sponsored by: NVIDIA Networking --- lib/Makefile | 1 + lib/libmixer/Makefile | 8 + lib/libmixer/mixer.3 | 540 +++++++++++++++++++++++++++ lib/libmixer/mixer.c | 493 +++++++++++++++++++++++++ lib/libmixer/mixer.h | 123 +++++++ usr.sbin/mixer/Makefile | 9 +- usr.sbin/mixer/mixer.8 | 306 +++++++++------- usr.sbin/mixer/mixer.c | 723 ++++++++++++++++++++++--------------- usr.sbin/mixer/tests/Makefile | 5 - usr.sbin/mixer/tests/mixer_test.sh | 123 ------- 10 files changed, 1787 insertions(+), 544 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index 1e375bb456e6..038763bfcba8 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -69,6 +69,7 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \ liblzma \ libmemstat \ libmd \ + libmixer \ libmt \ lib80211 \ libnetbsd \ diff --git a/lib/libmixer/Makefile b/lib/libmixer/Makefile new file mode 100644 index 000000000000..12081ee3835b --- /dev/null +++ b/lib/libmixer/Makefile @@ -0,0 +1,8 @@ +# $FreeBSD$ + +LIB= mixer +SRCS= ${LIB}.c +INCS= ${LIB}.h +MAN= ${LIB}.3 + +.include diff --git a/lib/libmixer/mixer.3 b/lib/libmixer/mixer.3 new file mode 100644 index 000000000000..f97a88bb79a0 --- /dev/null +++ b/lib/libmixer/mixer.3 @@ -0,0 +1,540 @@ +.\"- +.\" Copyright (c) 2021 Christos Margiolis +.\" +.\" Permission is hereby granted, free of charge, to any person obtaining a copy +.\" of this software and associated documentation files (the "Software"), to deal +.\" in the Software without restriction, including without limitation the rights +.\" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +.\" copies of the Software, and to permit persons to whom the Software is +.\" furnished to do so, subject to the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be included in +.\" all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +.\" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +.\" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +.\" THE SOFTWARE. +.\" +.\" $FreeBSD$ +.\" + +.Dd June 30, 2021 +.Dt mixer 3 +.Os +.Sh NAME +.Nm mixer_open , +.Nm mixer_close , +.Nm mixer_get_dev , +.Nm mixer_get_dev_byname , +.Nm mixer_add_ctl , +.Nm mixer_add_ctl_s , +.Nm mixer_remove_ctl , +.Nm mixer_get_ctl , +.Nm mixer_get_ctl_byname , +.Nm mixer_set_vol , +.Nm mixer_set_mute , +.Nm mixer_mod_recsrc , +.Nm mixer_get_dunit , +.Nm mixer_set_dunit , +.Nm mixer_get_mode, +.Nm mixer_get_nmixers , +.Nm MIX_ISDEV , +.Nm MIX_ISMUTE , +.Nm MIX_ISREC , +.Nm MIX_ISRECSRC , +.Nm MIX_VOLNORM , +.Nm MIX_VOLDENORM +.Nd interface to OSS mixers +.Sh LIBRARY +Mixer library (libmixer, -lmixer) +.Sh SYNOPSIS +.In mixer.h +.Ft struct mixer * +.Fn mixer_open "const char *name" +.Ft int +.Fn mixer_close "struct mixer *m" +.Ft struct mix_dev * +.Fn mixer_get_dev "struct mixer *m" "int devno" +.Ft struct mix_dev * +.Fn mixer_get_dev_byname "struct mixer *m" "name" +.Ft int +.Fn mixer_add_ctl "struct mix_dev *parent" "int id" "const char *name" \ + "int (*mod)(struct mix_dev *d, void *p)" \ + "int (*print)(struct mix_dev *d, void *p) +.Ft int +.Fn mixer_add_ctl_s "mix_ctl_t *ctl" +.Ft int +.Fn mixer_remove_ctl "mix_ctl_t *ctl" +.Ft mix_ctl_t * +.Fn mixer_get_ctl "struct mix_dev *d" "int id" +.Ft mix_ctl_t * +.Fn mixer_get_ctl_byname "struct mix_dev *d" "const char *name" +.Ft int +.Fn mixer_set_vol "struct mixer *m" "mix_volume_t vol" +.Ft int +.Fn mixer_set_mute "struct mixer *m" "int opt" +.Ft int +.Fn mixer_mod_recsrc "struct mixer *m" "int opt" +.Ft int +.Fn mixer_get_dunit "void" +.Ft int +.Fn mixer_set_dunit "struct mixer *m" "int unit" +.Ft int +.Fn mixer_get_mode "int unit" +.Ft int +.Fn mixer_get_nmixers "void" +.Ft int +.Fn MIX_ISDEV "struct mixer *m" "int devno" +.Ft int +.Fn MIX_ISMUTE "struct mixer *m" "int devno" +.Ft int +.Fn MIX_ISREC "struct mixer *m" "int devno" +.Ft int +.Fn MIX_ISRECSRC "struct mixer *m" "int devno" +.Ft float +.Fn MIX_VOLNORM "int v" +.Ft int +.Fn MIX_VOLDENORM "float v" +.Sh DESCRIPTION +The +.Nm mixer +library allows userspace programs to access and manipulate OSS sound mixers in +a simple way. +.Ss Mixer +.Pp +A mixer is described by the following structure: +.Bd -literal +struct mixer { + TAILQ_HEAD(, mix_dev) devs; /* device list */ + struct mix_dev *dev; /* selected device */ + oss_mixerinfo mi; /* mixer info */ + oss_card_info ci; /* audio card info */ + char name[NAME_MAX]; /* mixer name (e.g /dev/mixer0) */ + int fd; /* file descriptor */ + int unit; /* audio card unit */ + int ndev; /* number of devices */ + int devmask; /* supported devices */ +#define MIX_MUTE 0x01 +#define MIX_UNMUTE 0x02 +#define MIX_TOGGLEMUTE 0x04 + int mutemask; /* muted devices */ + int recmask; /* recording devices */ +#define MIX_ADDRECSRC 0x01 +#define MIX_REMOVERECSRC 0x02 +#define MIX_SETRECSRC 0x04 +#define MIX_TOGGLERECSRC 0x08 + int recsrc; /* recording sources */ +#define MIX_MODE_MIXER 0x01 +#define MIX_MODE_PLAY 0x02 +#define MIX_MODE_REC 0x04 + int mode; /* dev.pcm.X.mode sysctl */ + int f_default; /* default mixer flag */ +}; +.Ed +.Pp +The fields are follows: +.Bl -tag -width "f_default" +.It Fa devs +A tail queue structure containing all supported mixer devices. +.It Fa dev +A pointer to the currently selected device. The device is one of the elements in +.Ar devs . +.It Fa mi +OSS information about the mixer. Look at the definition of the +.Ft oss_mixerinfo +structure in +.In sys/soundcard.h +to see its fields. +.It Fa ci +OSS audio card information. This structure is also defined in +.In sys/soundcard.h . +.It Fa name +Path to the mixer (e.g /dev/mixer0). +.It Fa fd +File descriptor returned when the mixer is opened in +.Fn mixer_open . +.It Fa unit +Audio card unit. Since each mixer device maps to a pcmX device, +.Ar unit +is always equal to the number of that pcmX device. For example, if the audio +device's number is 0 (i.e pcm0), then +.Ar unit +is 0 as well. This number is useful when checking if the mixer's audio +card is the default one. +.It Fa ndev +Number of devices in +.Ar devs . +.It Fa devmask +Bit mask containing all supported devices for the mixer. For example +if device 10 is supported, then the 10th bit in the mask will be set. By default, +.Fn mixer_open +stores only the supported devices in devs, so it's very unlikely this mask will +be needed. +.It Fa mutemask +Bit mask containing all muted devices. The logic is the same as with +.Ar devmask . +.It Fa recmask +Bit mask containing all recording devices. Again, same logic as with the +other masks. +.It Fa recsrc +Bit mask containing all recording sources. Yes, same logic again. +.It Fa mode +Bit mask containing the supported modes for this audio device. It holds the value +of the +.Ar dev.pcm.X.mode +sysctl. +.It Fa f_default +Flag which tells whether the mixer's audio card is the default one. +.El +.Ss Mixer device +.Pp +Each mixer device stored in a mixer is described as follows: +.Bd -literal +struct mix_dev { + struct mixer *parent_mixer; /* parent mixer */ + char name[NAME_MAX]; /* device name (e.g "vol") */ + int devno; /* device number */ + struct mix_volume { +#define MIX_VOLMIN 0.0f +#define MIX_VOLMAX 1.0f +#define MIX_VOLNORM(v) ((v) / 100.0f) +#define MIX_VOLDENORM(v) ((int)((v) * 100.0f + 0.5f)) + float left; /* left volume */ + float right; /* right volume */ + } vol; + int nctl; /* number of controls */ + TAILQ_HEAD(, mix_ctl) ctls; /* control list */ + TAILQ_ENTRY(mix_dev) devs; +}; +.Ed +.Pp +The fields are follows: +.Bl -tag -width "parent_mixer" +.It Fa parent_mixer +Pointer to the mixer the device is attached to. +.It Fa name +Device name given by the OSS API. Devices can have one of the following names: +.Bd -ragged +vol, bass, treble, synth, pcm, speaker, line, mic, cd, mix, +pcm2, rec, igain, ogain, line1, line2, line3, dig1, dig2, dig3, +phin, phout, video, radio, and monitor. +.Ed +.It Fa devno +Device's index in the SOUND_MIXER_NRDEVICES macro defined in +.In sys/soundcard.h . +This number is used to check against the masks defined in the +.Ar mixer +structure. +.It Fa left, right +Left and right-ear volumes. Although the OSS API stores volumes in integers from +0-100, we normalize them to 32-bit floating point numbers. However, the volumes +can be denormalized using the +.Ar MIX_VOLDENORM +macro if needed. +.It Fa nctl +Number of user-defined mixer controls associated with the device. +.It Fa ctls +A tail queue containing user-defined mixer controls. +.El +.Ss User-defined mixer controls +.Pp +Each mixer device can have user-defined controls. The control structure +is defined as follows: +.Bd -literal +struct mix_ctl { + struct mix_dev *parent_dev; /* parent device */ + int id; /* control id */ + char name[NAME_MAX]; /* control name */ + int (*mod)(struct mix_dev *, void *); /* modify control values */ + int (*print)(struct mix_dev *, void *); /* print control */ + TAILQ_ENTRY(mix_ctl) ctls; +}; +.Ed +.Pp +The fields are follows: +.Bl -tag -width "parent_dev" +.It Fa parent_dev +Pointer to the device the control is attached to. +.It Fa id +Control ID assigned by the caller. Even though the library will +report it, care has to be taken to not give a control the same ID in case +the caller has to choose controls using their ID. +.It Fa name +Control name. As with +.Ar id , +the caller has to make sure the same name is not used more than once. +.It Fa mod +Function pointer to a control modification function. As in +.Xr mixer 8 , +each mixer control's values can be modified. For example, if we have a +volume control, the +.Ar mod +function will be responsible for handling volume changes. +.It Fa print +Function pointer to a control print function. +.El +.Ss Opening and closing the mixer +.Pp +The application must first call the +.Fn mixer_open +function to obtain a handle to the device, which is used as an argument +in most other functions and macros. The parameter +.Ar name +specifies the path to the mixer. OSS mixers are stored under +.Ar /dev/mixerN +where +.Ar N +is the number of the mixer device. Each device maps to an actual +.Ar pcm +audio card, so +.Ar /dev/mixer0 +is the mixer for +.Ar pcm0 , +and so on. If +.Ar name +is +.Ar NULL +or +.Ar /dev/mixer , +.Fn mixer_open +opens the default mixer (hw.snd.defaul_unit). +.Pp +The +.Fn mixer_close +function frees resources and closes the mixer device. It's a good practice to +always call it when the application is done using the mixer. +.Ss Manipulating the mixer +.Pp +The +.Fn mixer_get_dev +and +.Fn mixer_get_dev_byname +functions select a mixer device, either by its number or by its name +respectively. The mixer structure keeps a list of all the devices, but only +one can be manipulated at a time. Each time a new device is to be manipulated, +one of the two functions has to be called. +.Pp +The +.Fn mixer_set_vol +function changes the volume of the selected mixer device. The +.Ar vol +parameter is a structure that stores the left and right volumes of a given +device. The allowed volume values are between MIX_VOLMIN (0.0) and +MIX_VOLMAX (1.0). +.Pp +The +.Fn mixer_set_mute +function modifies the mute of a selected device. The +.Ar opt +parameter has to be one of the following options: +.Bl -tag -width MIX_TOGGLEMUTE -offset indent +.It Dv MIX_MUTE +Mute the device. +.It Dv MIX_UNMUTE +Unmute the device. +.It Dv MIX_TOGGLEMUTE +Toggle the device's mute (e.g mute if unmuted and unmute if muted). +.El +.Pp +The +.Fn mixer_mod_recsrc +function modifies a recording device. The selected device has to be +a recording device, otherwise the function will fail. The +.Ar opt +parameter has to be one of the following options: +.Bl -tag -width MIX_REMOVERECSRC -offset indent +.It Dv MIX_ADDRECSRC +Add device to the recording sources. +.It Dv MIX_REMOVERECSRC +Remove device from the recording sources. +.It Dv MIX_SETRECSRC +Set device as the only recording source. +.It Dv MIX_TOGGLERECSRC +Toggle device from the recording sources. +.El +.Pp +The +.Fn mixer_get_dunit +and +.Fn mixer_set_dunit +functions get and set the default audio card in the system. Although this is +not really a mixer feature, it's useful to have instead of having to use +the +.Xr sysctl 3 +controls. +.Pp +The +.Fn mixer_get_mode +function returns the playback/recording mode of the audio device the mixer +belongs to. The available values are the following: +.Bl -tag -width "MIX_STATUS_PLAY | MIX_STATUS_REC" -offset indent +.It Dv MIX_STATUS_NONE +Neither playback nor recording. +.It Dv MIX_STATUS_PLAY +Playback. +.It Dv MIX_STATUS_REC +Recording. +.It Dv MIX_STATUS_PLAY | MIX_STATUS_REC +Playback and recording. +.El +.Pp +The +.Fn mixer_get_nmixers +function returns the total number of mixer devices in the system. +.Pp +The +.Fn MIX_ISDEV +macro checks if a device is actually a valid device for a given mixer. It's very +unlikely that this macro will ever be needed since the library stores only +valid devices by default. +.Pp +The +.Fn MIX_ISMUTE +macro checks if a device is muted. +.Pp +The +.Fn MIX_ISREC +macro checks if a device is a recording device. +.Pp +The +.Fn MIX_ISRECSRC +macro checks if a device is a recording source. +.Pp +The +.Fn MIX_VOLNORM +macro normalizes a value to 32-bit floating point number. It's used +to normalize the volumes read from the OSS API. +.Pp +The +.Fn MIX_VOLDENORM +macro denormalizes the left and right volumes stores in the +.Ft mix_dev +structure. +.Ss Defining and using mixer controls +.Pp +The +.Fn mix_add_ctl +function creates a control and attaches it to the device specified in the +.Ar parent +argument. +.Pp +The +.Fn mix_add_ctl_s +function does the same thing as with +.Fn mix_add_ctl +but the caller passes a +.Ft mix_ctl_t * +structure instead of each field as a seperate argument. +.Pp +The +.Fn mixer_remove_ctl +functions removes a control from the device its attached to. +.Pp +The +.Fn mixer_get_ctl +function searches for a control in the device specified in the +.Ar d +argument and returns a pointer to it. The search is done using the control's ID. +.Pp +The +.Fn mixer_get_ctl_byname +function is the same as with +.Fn mixer_get_ctl +but the search is done using the control's name. +.Sh RETURN VALUES +.Pp +The +.Fn mixer_open +function returns the newly created handle on success and NULL on failure. +.Pp +The +.Fn mixer_close , +.Fn mixer_set_vol , +.Fn mixer_set_mute , +.Fn mixer_mod_recsrc , +.Fn mixer_get_dunut , +.Fn mixer_set_dunit +and +.Fn mixer_get_nmixers +functions return 0 or positive values on success and -1 on failure. +.Pp +The +.Fn mixer_get_dev +and +.Fn mixer_get_dev_byname +functions return the selected device on success and NULL on failure. +.Pp +All functions set the value of +.Ar errno +on failure. +.Sh EXAMPLES +.Ss Change the volume of a device +.Bd -literal +struct mixer *m; +mix_volume_t vol; +char *mix_name, *dev_name; + +mix_name = ...; +if ((m = mixer_open(mix_name)) == NULL) + err(1, "mixer_open: %s", mix_name); + +dev_name = ...; +if ((m->dev = mixer_get_dev_byname(m, dev_name)) < 0) + err(1, "unknown device: %s", dev_name); + +vol.left = ...; +vol.right = ....; +if (mixer_set_vol(m, vol) < 0) + warn("cannot change volume"); + +(void)mixer_close(m); +.Ed +.Ss Mute all unmuted devices +.Bd -literal +struct mixer *m; +struct mix_dev *dp; + +if ((m = mixer_open(NULL)) == NULL) /* Open the default mixer. */ + err(1, "mixer_open"); +TAILQ_FOREACH(dp, &m->devs, devs) { + m->dev = dp; /* Select device. */ + if (M_ISMUTE(m, dp->devno)) + continue; + if (mixer_set_mute(m, MIX_MUTE) < 0) + warn("cannot mute device: %s", dp->name); +} + +(void)mixer_close(m); +.Ed +.Ss Print all recording sources' names and volumes +.Bd -literal +struct mixer *m; +struct mix_dev *dp; + +char *mix_name, *dev_name; + +mix_name = ...; +if ((m = mixer_open(mix_name)) == NULL) + err(1, "mixer_open: %s", mix_name); + +TAILQ_FOREACH(dp, &m->devs, devs) { + if (M_ISRECSRC(m, dp->devno)) + printf("%s\\t%.2f:%.2f\\n", + dp->name, dp->vol.left, dp->vol.right); +} + +(void)mixer_close(m); +.Ed +.Sh SEE ALSO +.Xr mixer 8 , +.Xr sound 4 , +.Xr sysctl 3 , +.Xr queue 3 +and +.Xr errno 2 +.Sh AUTHORS +.An Christos Margiolis Aq Mt christos@margiolis.net diff --git a/lib/libmixer/mixer.c b/lib/libmixer/mixer.c new file mode 100644 index 000000000000..b10d5c6607cf --- /dev/null +++ b/lib/libmixer/mixer.c @@ -0,0 +1,493 @@ +/*- + * Copyright (c) 2021 Christos Margiolis + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * $FreeBSD$ + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "mixer.h" + +#define BASEPATH "/dev/mixer" + +static int _mixer_readvol(struct mixer *, struct mix_dev *); + +/* + * Fetch volume from the device. + */ +static int +_mixer_readvol(struct mixer *m, struct mix_dev *dev) +{ + int v; + + if (ioctl(m->fd, MIXER_READ(dev->devno), &v) < 0) + return (-1); + dev->vol.left = MIX_VOLNORM(v & 0x00ff); + dev->vol.right = MIX_VOLNORM((v >> 8) & 0x00ff); + + return (0); +} + +/* + * Open a mixer device in `/dev/mixerN`, where N is the number of the mixer. + * Each device maps to an actual pcm audio card, so `/dev/mixer0` is the + * mixer for pcm0, and so on. + * + * @param name path to mixer device. NULL or "/dev/mixer" for the + * the default mixer (i.e `hw.snd.default_unit`). + */ +struct mixer * +mixer_open(const char *name) +{ + struct mixer *m = NULL; + struct mix_dev *dp; + const char *names[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES; + int i; + + if ((m = calloc(1, sizeof(struct mixer))) == NULL) + goto fail; + + if (name != NULL) { + /* `name` does not start with "/dev/mixer". */ + if (strncmp(name, BASEPATH, strlen(BASEPATH)) != 0) { + errno = EINVAL; + goto fail; + } + /* `name` is "/dev/mixer" so, we'll use the default unit. */ + if (strncmp(name, BASEPATH, strlen(name)) == 0) + goto dunit; + m->unit = strtol(name + strlen(BASEPATH), NULL, 10); + (void)strlcpy(m->name, name, sizeof(m->name)); + } else { +dunit: + if ((m->unit = mixer_get_dunit()) < 0) + goto fail; + (void)snprintf(m->name, sizeof(m->name), "/dev/mixer%d", m->unit); + } + + if ((m->fd = open(m->name, O_RDWR)) < 0) + goto fail; + + m->devmask = m->recmask = m->recsrc = 0; + m->f_default = m->unit == mixer_get_dunit(); + m->mode = mixer_get_mode(m->unit); + /* The unit number _must_ be set before the ioctl. */ + m->mi.dev = m->unit; + m->ci.card = m->unit; + if (ioctl(m->fd, SNDCTL_MIXERINFO, &m->mi) < 0 || + ioctl(m->fd, SNDCTL_CARDINFO, &m->ci) < 0 || + ioctl(m->fd, SOUND_MIXER_READ_DEVMASK, &m->devmask) < 0 || + ioctl(m->fd, SOUND_MIXER_READ_MUTE, &m->mutemask) < 0 || + ioctl(m->fd, SOUND_MIXER_READ_RECMASK, &m->recmask) < 0 || + ioctl(m->fd, SOUND_MIXER_READ_RECSRC, &m->recsrc) < 0) + goto fail; + + TAILQ_INIT(&m->devs); + for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { + if (!MIX_ISDEV(m, i)) + continue; + if ((dp = calloc(1, sizeof(struct mix_dev))) == NULL) + goto fail; + dp->parent_mixer = m; + dp->devno = i; + dp->nctl = 0; + if (_mixer_readvol(m, dp) < 0) + goto fail; + (void)strlcpy(dp->name, names[i], sizeof(dp->name)); + TAILQ_INIT(&dp->ctls); + TAILQ_INSERT_TAIL(&m->devs, dp, devs); + m->ndev++; + } + + /* The default device is always "vol". */ + m->dev = TAILQ_FIRST(&m->devs); + + return (m); +fail: + if (m != NULL) + (void)mixer_close(m); + + return (NULL); +} + +/* + * Free resources and close the mixer. + */ +int +mixer_close(struct mixer *m) +{ + struct mix_dev *dp; + int r; + + r = close(m->fd); + while (!TAILQ_EMPTY(&m->devs)) { + dp = TAILQ_FIRST(&m->devs); + TAILQ_REMOVE(&m->devs, dp, devs); + while (!TAILQ_EMPTY(&dp->ctls)) + (void)mixer_remove_ctl(TAILQ_FIRST(&dp->ctls)); + free(dp); + } + free(m); + + return (r); +} + +/* + * Select a mixer device. The mixer structure keeps a list of all the devices + * the mixer has, but only one can be manipulated at a time -- this is what + * the `dev` in the mixer structure field is for. Each time a device is to be + * manipulated, `dev` has to point to it first. + * + * The caller must manually assign the return value to `m->dev`. + */ +struct mix_dev * +mixer_get_dev(struct mixer *m, int dev) +{ + struct mix_dev *dp; + + if (dev < 0 || dev >= m->ndev) { + errno = ERANGE; + return (NULL); + } + TAILQ_FOREACH(dp, &m->devs, devs) { + if (dp->devno == dev) + return (dp); + } + errno = EINVAL; + + return (NULL); +} + +/* + * Select a device by name. + * + * @param name device name (e.g vol, pcm, ...) + */ +struct mix_dev * +mixer_get_dev_byname(struct mixer *m, const char *name) +{ + struct mix_dev *dp; + + TAILQ_FOREACH(dp, &m->devs, devs) { + if (!strncmp(dp->name, name, sizeof(dp->name))) + return (dp); + } + errno = EINVAL; + + return (NULL); +} + +/* + * Add a mixer control to a device. + */ +int +mixer_add_ctl(struct mix_dev *parent_dev, int id, const char *name, + int (*mod)(struct mix_dev *, void *), + int (*print)(struct mix_dev *, void *)) +{ + struct mix_dev *dp; + mix_ctl_t *ctl, *cp; + + /* XXX: should we accept NULL name? */ + if (parent_dev == NULL) { + errno = EINVAL; + return (-1); + } + if ((ctl = calloc(1, sizeof(mix_ctl_t))) == NULL) + return (-1); + ctl->parent_dev = parent_dev; + ctl->id = id; + if (name != NULL) + (void)strlcpy(ctl->name, name, sizeof(ctl->name)); + ctl->mod = mod; + ctl->print = print; + dp = ctl->parent_dev; + /* Make sure the same ID or name doesn't exist already. */ + TAILQ_FOREACH(cp, &dp->ctls, ctls) { + if (!strncmp(cp->name, name, sizeof(cp->name)) || cp->id == id) { + errno = EINVAL; + return (-1); + } + } + TAILQ_INSERT_TAIL(&dp->ctls, ctl, ctls); + dp->nctl++; + + return (0); +} + +/* + * Same as `mixer_add_ctl`. + */ +int +mixer_add_ctl_s(mix_ctl_t *ctl) +{ + if (ctl == NULL) + return (-1); + + return (mixer_add_ctl(ctl->parent_dev, ctl->id, ctl->name, + ctl->mod, ctl->print)); +} + +/* + * Remove a mixer control from a device. + */ +int +mixer_remove_ctl(mix_ctl_t *ctl) +{ + struct mix_dev *p; + + if (ctl == NULL) { + errno = EINVAL; + return (-1); + } + p = ctl->parent_dev; + if (!TAILQ_EMPTY(&p->ctls)) { + TAILQ_REMOVE(&p->ctls, ctl, ctls); + free(ctl); + } + + return (0); +} + +/* + * Get a mixer control by id. + */ +mix_ctl_t * +mixer_get_ctl(struct mix_dev *d, int id) +{ + mix_ctl_t *cp; + + TAILQ_FOREACH(cp, &d->ctls, ctls) { + if (cp->id == id) + return (cp); + } + errno = EINVAL; + + return (NULL); +} + +/* + * Get a mixer control by name. + */ +mix_ctl_t * +mixer_get_ctl_byname(struct mix_dev *d, const char *name) +{ + mix_ctl_t *cp; + + TAILQ_FOREACH(cp, &d->ctls, ctls) { + if (!strncmp(cp->name, name, sizeof(cp->name))) + return (cp); + } + errno = EINVAL; + + return (NULL); +} + +/* + * Change the mixer's left and right volume. The allowed volume values are + * between MIX_VOLMIN and MIX_VOLMAX. The `ioctl` for volume change requires + * an integer value between 0 and 100 stored as `lvol | rvol << 8` -- for + * that reason, we de-normalize the 32-bit float volume value, before + * we pass it to the `ioctl`. + * + * Volume clumping should be done by the caller. + */ +int +mixer_set_vol(struct mixer *m, mix_volume_t vol) +{ + int v; + + if (vol.left < MIX_VOLMIN || vol.left > MIX_VOLMAX || + vol.right < MIX_VOLMIN || vol.right > MIX_VOLMAX) { + errno = ERANGE; + return (-1); + } + v = MIX_VOLDENORM(vol.left) | MIX_VOLDENORM(vol.right) << 8; + if (ioctl(m->fd, MIXER_WRITE(m->dev->devno), &v) < 0) + return (-1); + if (_mixer_readvol(m, m->dev) < 0) + return (-1); + + return (0); +} + +/* + * Manipulate a device's mute. + * + * @param opt MIX_MUTE mute device + * MIX_UNMUTE unmute device + * MIX_TOGGLEMUTE toggle device's mute + */ +int +mixer_set_mute(struct mixer *m, int opt) +{ + switch (opt) { + case MIX_MUTE: + m->mutemask |= (1 << m->dev->devno); + break; + case MIX_UNMUTE: + m->mutemask &= ~(1 << m->dev->devno); + break; + case MIX_TOGGLEMUTE: + m->mutemask ^= (1 << m->dev->devno); + break; + default: + errno = EINVAL; + return (-1); + } + if (ioctl(m->fd, SOUND_MIXER_WRITE_MUTE, &m->mutemask) < 0) + return (-1); + if (ioctl(m->fd, SOUND_MIXER_READ_MUTE, &m->mutemask) < 0) + return (-1); + + return 0; +} + +/* + * Modify a recording device. The selected device has to be a recording device, + * otherwise the function will fail. + * + * @param opt MIX_ADDRECSRC add device to recording sources + * MIX_REMOVERECSRC remove device from recording sources *** 1550 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Sep 22 18:03:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82A3166F42A; Wed, 22 Sep 2021 18:03: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 4HF5l42Kpdz4njQ; Wed, 22 Sep 2021 18:03: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 316FC1C20F; Wed, 22 Sep 2021 18:03: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 18MI3iR7013420; Wed, 22 Sep 2021 18:03:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MI3iFZ013419; Wed, 22 Sep 2021 18:03:44 GMT (envelope-from git) Date: Wed, 22 Sep 2021 18:03:44 GMT Message-Id: <202109221803.18MI3iFZ013419@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 0e94a3069138 - main - UPDATING: Add new entry about mixer(8) usage. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0e94a30691385595ef03cc6861f0b67371ff90ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 18:03:44 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=0e94a30691385595ef03cc6861f0b67371ff90ef commit 0e94a30691385595ef03cc6861f0b67371ff90ef Author: Hans Petter Selasky AuthorDate: 2021-09-22 14:47:25 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-22 17:44:43 +0000 UPDATING: Add new entry about mixer(8) usage. Differential Revision: https://reviews.freebsd.org/D31636 Sponsored by: NVIDIA Networking --- UPDATING | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UPDATING b/UPDATING index 3993b4a681bb..d6eae6c23ede 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +202010922: + As of commit 903873ce1560, the mixer(8) utility has got a slightly + new syntax. Please confirm to the mixer(8) manual page for more + information. + 20210911: As of commit 55089ef4f8bb, the global variable nfs_maxcopyrange has been deleted from the nfscommon.ko. As such, nfsd.ko must be built From owner-dev-commits-src-all@freebsd.org Wed Sep 22 18:59:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 33E2F66FF8B; Wed, 22 Sep 2021 18:59: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 4HF6zm0zhbz4s6Y; Wed, 22 Sep 2021 18:59: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 01E6C1CC38; Wed, 22 Sep 2021 18:59: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 18MIxl1I079215; Wed, 22 Sep 2021 18:59:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MIxl06079214; Wed, 22 Sep 2021 18:59:47 GMT (envelope-from git) Date: Wed, 22 Sep 2021 18:59:47 GMT Message-Id: <202109221859.18MIxl06079214@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 8fc722a572b8 - main - mixer(8): Compile fix for when the "char" type is unsigned. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8fc722a572b8af5afde4a4515a7ff3784360e471 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 18:59:48 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=8fc722a572b8af5afde4a4515a7ff3784360e471 commit 8fc722a572b8af5afde4a4515a7ff3784360e471 Author: Hans Petter Selasky AuthorDate: 2021-09-22 18:56:34 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-22 18:58:47 +0000 mixer(8): Compile fix for when the "char" type is unsigned. Differential Revision: https://reviews.freebsd.org/D31636 Sponsored by: NVIDIA Networking --- usr.sbin/mixer/mixer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/mixer/mixer.c b/usr.sbin/mixer/mixer.c index 3bbb8eebf93f..c32b87fdb7f0 100644 --- a/usr.sbin/mixer/mixer.c +++ b/usr.sbin/mixer/mixer.c @@ -63,7 +63,7 @@ main(int argc, char *argv[]) char *p, *bufp, *devstr, *ctlstr, *valstr = NULL; int dunit, i, n, pall = 1; int aflag = 0, dflag = 0, oflag = 0, sflag = 0; - char ch; + int ch; while ((ch = getopt(argc, argv, "ad:f:os")) != -1) { switch (ch) { From owner-dev-commits-src-all@freebsd.org Wed Sep 22 20:02:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DAC50670DD2; Wed, 22 Sep 2021 20:02: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 4HF8Ms5lgDz3FPt; Wed, 22 Sep 2021 20:02: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 A60631D94C; Wed, 22 Sep 2021 20:02:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18MK2HW6072195; Wed, 22 Sep 2021 20:02:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MK2HsQ072194; Wed, 22 Sep 2021 20:02:17 GMT (envelope-from git) Date: Wed, 22 Sep 2021 20:02:17 GMT Message-Id: <202109222002.18MK2HsQ072194@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: db6ba1e0c585 - main - mixer(3) and mixer(8): Update manual pages. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: db6ba1e0c585d37469c3bc74238b7fc4ea249274 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 20:02:17 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=db6ba1e0c585d37469c3bc74238b7fc4ea249274 commit db6ba1e0c585d37469c3bc74238b7fc4ea249274 Author: Hans Petter Selasky AuthorDate: 2021-09-22 20:01:12 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-22 20:01:40 +0000 mixer(3) and mixer(8): Update manual pages. - Use correct e-mail address. - Set FreeBSD 14.0 as introduction for the updated mixer(8) utility. Submitted by: christos@ Differential Revision: https://reviews.freebsd.org/D31636 Sponsored by: NVIDIA Networking --- lib/libmixer/mixer.3 | 4 ++-- usr.sbin/mixer/mixer.8 | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libmixer/mixer.3 b/lib/libmixer/mixer.3 index f97a88bb79a0..b541c94af779 100644 --- a/lib/libmixer/mixer.3 +++ b/lib/libmixer/mixer.3 @@ -22,7 +22,7 @@ .\" $FreeBSD$ .\" -.Dd June 30, 2021 +.Dd September 22, 2021 .Dt mixer 3 .Os .Sh NAME @@ -537,4 +537,4 @@ TAILQ_FOREACH(dp, &m->devs, devs) { and .Xr errno 2 .Sh AUTHORS -.An Christos Margiolis Aq Mt christos@margiolis.net +.An Christos Margiolis Aq Mt christos@FreeBSD.org diff --git a/usr.sbin/mixer/mixer.8 b/usr.sbin/mixer/mixer.8 index 39b30b53d529..3a0a70932ba9 100644 --- a/usr.sbin/mixer/mixer.8 +++ b/usr.sbin/mixer/mixer.8 @@ -22,7 +22,7 @@ .\" $FreeBSD$ .\" -.Dd June 30, 2021 +.Dd September 22, 2021 .Dt mixer 8 .Os .Sh NAME @@ -240,6 +240,6 @@ information to a file and retrieve back later The .Nm utility first appeared in FreeBSD 2.0.5 and was rewritten completely in -FreeBSD 12.2. \" FIXME: replace 12.2 with proper version. +FreeBSD 14.0. .Sh AUTHORS -.An Christos Margiolis Aq Mt christos@margiolis.net +.An Christos Margiolis Aq Mt christos@FreeBSD.org From owner-dev-commits-src-all@freebsd.org Wed Sep 22 20:10:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 326E9670E76; Wed, 22 Sep 2021 20:10: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 4HF8Y00gSzz3Gvk; Wed, 22 Sep 2021 20:10: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 E73A71DD9D; Wed, 22 Sep 2021 20:10:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18MKABmS076463; Wed, 22 Sep 2021 20:10:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MKABhW076456; Wed, 22 Sep 2021 20:10:11 GMT (envelope-from git) Date: Wed, 22 Sep 2021 20:10:11 GMT Message-Id: <202109222010.18MKABhW076456@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 624a34b87b27 - main - rc.d/mixer: Use -o flag instead of -s flag to get current mixer state. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 624a34b87b2757cb33b33a5b40821990c8bce673 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 20:10:12 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=624a34b87b2757cb33b33a5b40821990c8bce673 commit 624a34b87b2757cb33b33a5b40821990c8bce673 Author: Hans Petter Selasky AuthorDate: 2021-09-22 20:09:23 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-22 20:09:36 +0000 rc.d/mixer: Use -o flag instead of -s flag to get current mixer state. Submitted by: christos@ Differential Revision: https://reviews.freebsd.org/D31636 Sponsored by: NVIDIA Networking --- libexec/rc/rc.d/mixer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/mixer b/libexec/rc/rc.d/mixer index d815fb75425e..c8cd544779cd 100755 --- a/libexec/rc/rc.d/mixer +++ b/libexec/rc/rc.d/mixer @@ -58,7 +58,7 @@ mixer_save() dev="/dev/${1}" if [ -r ${dev} ]; then - /usr/sbin/mixer -f ${dev} -s > /var/db/${1}-state 2>/dev/null + /usr/sbin/mixer -f ${dev} -o > /var/db/${1}-state 2>/dev/null fi } From owner-dev-commits-src-all@freebsd.org Wed Sep 22 20:19:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6CF91671506; Wed, 22 Sep 2021 20:19: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 4HF8lp2Wrfz3HGj; Wed, 22 Sep 2021 20:19:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 369C31DFFB; Wed, 22 Sep 2021 20:19: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 18MKJYhT085756; Wed, 22 Sep 2021 20:19:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MKJYCu085755; Wed, 22 Sep 2021 20:19:34 GMT (envelope-from git) Date: Wed, 22 Sep 2021 20:19:34 GMT Message-Id: <202109222019.18MKJYCu085755@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: e36d0e86e328 - main - Revert "linux32: add a hack to avoid redefining the type of the savefpu tag" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e36d0e86e3282cde5a12b6a623e6deefaabfd0c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 20:19:34 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e36d0e86e3282cde5a12b6a623e6deefaabfd0c4 commit e36d0e86e3282cde5a12b6a623e6deefaabfd0c4 Author: Konstantin Belousov AuthorDate: 2021-09-22 18:54:39 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-22 20:17:47 +0000 Revert "linux32: add a hack to avoid redefining the type of the savefpu tag" This reverts commit 0f6829488ef32142b9ea1c0806fb5ecfe0872c02. Also it changes the type of md_usr_fpu_save struct mdthread member to void *, which is what uncovered this trouble. Now the save area is untyped, but since it is hidden behind accessors, it is not too significant. Since apparently there are consumers affected outside the tree, this hack is better than one from the reverted revision. PR: 258678 Reported by: cy Reviewed by: cy, kevans, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32060 --- sys/amd64/include/proc.h | 2 +- sys/modules/linux/Makefile | 2 +- sys/x86/include/fpu.h | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h index 94ac69d31e65..6b0d0e66d0ee 100644 --- a/sys/amd64/include/proc.h +++ b/sys/amd64/include/proc.h @@ -75,7 +75,7 @@ struct mdthread { int md_efirt_dis_pf; /* (k) */ struct pcb md_pcb; vm_offset_t md_stack_base; - struct savefpu *md_usr_fpu_save; + void *md_usr_fpu_save; }; struct mdproc { diff --git a/sys/modules/linux/Makefile b/sys/modules/linux/Makefile index 6c95a548bffb..373ec3dcae91 100644 --- a/sys/modules/linux/Makefile +++ b/sys/modules/linux/Makefile @@ -60,7 +60,7 @@ linux${SFX}_assym.h: linux${SFX}_genassym.o sh ${SYSDIR}/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET} .if ${MACHINE_CPUARCH} == "amd64" -VDSOFLAGS=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 -D__M32_BROKEN_MODULE_HACK__ -m32 +VDSOFLAGS=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 -m32 .else VDSOFLAGS=-mregparm=0 .endif diff --git a/sys/x86/include/fpu.h b/sys/x86/include/fpu.h index bb8533d599dd..313a03ea55c9 100644 --- a/sys/x86/include/fpu.h +++ b/sys/x86/include/fpu.h @@ -123,12 +123,10 @@ struct savexmm { } __aligned(16); #ifdef __i386__ -#ifndef __M32_BROKEN_MODULE_HACK__ union savefpu { struct save87 sv_87; struct savexmm sv_xmm; }; -#endif /* __M32_BROKEN_MODULE_HACK__ */ #else /* Floating point context. (amd64 fxsave/fxrstor) */ struct savefpu { From owner-dev-commits-src-all@freebsd.org Wed Sep 22 20:25:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 771DA671348; Wed, 22 Sep 2021 20:25: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 4HF8tr2cpxz3HsD; Wed, 22 Sep 2021 20:25: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 361311DE38; Wed, 22 Sep 2021 20:25: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 18MKPeWA098593; Wed, 22 Sep 2021 20:25:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MKPe1i098592; Wed, 22 Sep 2021 20:25:40 GMT (envelope-from git) Date: Wed, 22 Sep 2021 20:25:40 GMT Message-Id: <202109222025.18MKPe1i098592@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: c866d0c798a2 - main - sh: improve command completion MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c866d0c798a20b8f0a92df524f4ddd0d81511c88 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 20:25:40 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=c866d0c798a20b8f0a92df524f4ddd0d81511c88 commit c866d0c798a20b8f0a92df524f4ddd0d81511c88 Author: Piotr Pawel Stefaniak AuthorDate: 2021-09-22 16:23:29 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-22 20:23:32 +0000 sh: improve command completion When there are many matches, find the longest common substring starting from the beginning of each command and use that to replace input. As an example: on my system, llv will be autocompleted to llvm- and another will print all matching llvm commands. --- bin/sh/histedit.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 37b62cef5746..4e82f7497850 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -596,7 +596,7 @@ static char const char *dirname; char **matches = NULL; size_t i = 0, size = 16, uniq; - size_t curpos = end - start; + size_t curpos = end - start, lcstring = -1; if (start > 0 || memchr("/.~", text[0], 3) != NULL) return (NULL); @@ -652,11 +652,20 @@ out: if (i > 1) { qsort_s(matches + 1, i, sizeof(matches[0]), comparator, (void *)(intptr_t)curpos); - for (size_t k = 2; k <= i; k++) - if (strcmp(matches[uniq] + curpos, matches[k] + curpos) == 0) + for (size_t k = 2; k <= i; k++) { + const char *l = matches[uniq] + curpos; + const char *r = matches[k] + curpos; + size_t common = 0; + + while (*l != '\0' && *r != '\0' && *l == *r) + (void)l++, r++, common++; + if (common < lcstring) + lcstring = common; + if (*l == *r) free(matches[k]); else matches[++uniq] = matches[k]; + } } matches[uniq + 1] = NULL; /* @@ -668,7 +677,12 @@ out: * string in matches[0] which is the reason to copy the full name of the * only match. */ - matches[0] = strdup(uniq == 1 ? matches[1] : text); + if (uniq == 1) + matches[0] = strdup(matches[1]); + else if (lcstring != (size_t)-1) + matches[0] = strndup(matches[1], curpos + lcstring); + else + matches[0] = strdup(text); if (matches[0] == NULL) { for (size_t k = 1; k <= uniq; k++) free(matches[k]); From owner-dev-commits-src-all@freebsd.org Wed Sep 22 20:25:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 847D8671792; Wed, 22 Sep 2021 20:25: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 4HF8ts3Cppz3J7Y; Wed, 22 Sep 2021 20:25: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 4FE5B1E204; Wed, 22 Sep 2021 20:25: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 18MKPfZx098617; Wed, 22 Sep 2021 20:25:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MKPfLc098616; Wed, 22 Sep 2021 20:25:41 GMT (envelope-from git) Date: Wed, 22 Sep 2021 20:25:41 GMT Message-Id: <202109222025.18MKPfLc098616@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 1f82fb383410 - main - sh: try to avoid overwriting HISTFILE produced by other shells MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1f82fb3834105fd8f1186b1c6d719d8a24738180 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 20:25:41 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=1f82fb3834105fd8f1186b1c6d719d8a24738180 commit 1f82fb3834105fd8f1186b1c6d719d8a24738180 Author: Piotr Pawel Stefaniak AuthorDate: 2021-09-22 16:42:41 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-22 20:23:32 +0000 sh: try to avoid overwriting HISTFILE produced by other shells If an attempt to load history from an existing history file was unsuccessful, do not try to save command history to that file on exit. --- bin/sh/histedit.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 4e82f7497850..96511b87b451 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -70,6 +71,7 @@ __FBSDID("$FreeBSD$"); History *hist; /* history cookie */ EditLine *el; /* editline cookie */ int displayhist; +static int savehist; static FILE *el_in, *el_out; static char *fc_replace(const char *, char *, char *); @@ -103,7 +105,7 @@ histsave(void) int fd; FILE *f; - if ((histfile = get_histfile()) == NULL) + if (!savehist || (histfile = get_histfile()) == NULL) return; INTOFF; asprintf(&histtmpname, "%s.XXXXXXXXXX", histfile); @@ -134,7 +136,9 @@ histload(void) if ((histfile = get_histfile()) == NULL) return; - history(hist, &he, H_LOAD, histfile); + errno = 0; + if (history(hist, &he, H_LOAD, histfile) != -1 || errno == ENOENT) + savehist = 1; } /* From owner-dev-commits-src-all@freebsd.org Wed Sep 22 22:25:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52B6E672AE8; Wed, 22 Sep 2021 22:25: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 4HFCYM1cRzz3jsh; Wed, 22 Sep 2021 22:25: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 140C11F93B; Wed, 22 Sep 2021 22:25: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 18MMPgH7059414; Wed, 22 Sep 2021 22:25:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MMPgSr059413; Wed, 22 Sep 2021 22:25:42 GMT (envelope-from git) Date: Wed, 22 Sep 2021 22:25:42 GMT Message-Id: <202109222225.18MMPgSr059413@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Houchard Subject: git: 9bab18b8616b - main - libsysdecode: Decode FreeBSD32 syscalls on arm64. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9bab18b8616bad4fa0adcd0e291903c55263640e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 22:25:43 -0000 The branch main has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=9bab18b8616bad4fa0adcd0e291903c55263640e commit 9bab18b8616bad4fa0adcd0e291903c55263640e Author: Olivier Houchard AuthorDate: 2021-09-22 22:22:30 +0000 Commit: Olivier Houchard CommitDate: 2021-09-22 22:24:50 +0000 libsysdecode: Decode FreeBSD32 syscalls on arm64. Add aarch64 to the list of architectures that can run 32bits FreeBSD binaries, so that truss works correctly with an arm32 binary. The same should probably be done with mips. MFC After: 1 week --- lib/libsysdecode/syscallnames.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libsysdecode/syscallnames.c b/lib/libsysdecode/syscallnames.c index 4638438964fd..fcc14886f39f 100644 --- a/lib/libsysdecode/syscallnames.c +++ b/lib/libsysdecode/syscallnames.c @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); static #include -#if defined(__amd64__) || defined(__powerpc64__) +#if defined(__amd64__) || defined(__powerpc64__) || defined(__aarch64__) static #include #endif @@ -73,7 +73,7 @@ sysdecode_syscallname(enum sysdecode_abi abi, unsigned int code) if (code < nitems(syscallnames)) return (syscallnames[code]); break; -#if defined(__amd64__) || defined(__powerpc64__) +#if defined(__amd64__) || defined(__powerpc64__) || defined(__aarch64__) case SYSDECODE_ABI_FREEBSD32: if (code < nitems(freebsd32_syscallnames)) return (freebsd32_syscallnames[code]); From owner-dev-commits-src-all@freebsd.org Wed Sep 22 23:05:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F655674016; Wed, 22 Sep 2021 23:05: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 4HFDRc2Smvz3ltH; Wed, 22 Sep 2021 23:05: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 341681FFD8; Wed, 22 Sep 2021 23:05: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 18MN5mhm013140; Wed, 22 Sep 2021 23:05:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MN5mxe013139; Wed, 22 Sep 2021 23:05:48 GMT (envelope-from git) Date: Wed, 22 Sep 2021 23:05:48 GMT Message-Id: <202109222305.18MN5mxe013139@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Houchard Subject: git: ebbc3140ca0d - main - truss: Decode correctly 64bits arguments on 32bits arm. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ebbc3140ca0d7eee154f7a67ccdae7d3d88d13fd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 23:05:48 -0000 The branch main has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=ebbc3140ca0d7eee154f7a67ccdae7d3d88d13fd commit ebbc3140ca0d7eee154f7a67ccdae7d3d88d13fd Author: Olivier Houchard AuthorDate: 2021-09-22 22:45:42 +0000 Commit: Olivier Houchard CommitDate: 2021-09-22 23:04:16 +0000 truss: Decode correctly 64bits arguments on 32bits arm. When decoding 32bits arm syscall, make sure we account for the padding when decoding 64bits args. Do it too when using a 64bits truss on a 32bits binary. MFC After: 1 week PR: 256199 --- usr.bin/truss/syscalls.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index f7657f30b583..9cd53e71cc9b 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -792,11 +792,14 @@ print_mask_arg32(bool (*decoder)(FILE *, uint32_t, uint32_t *), FILE *fp, * decoding arguments. */ static void -quad_fixup(struct syscall_decode *sc) +quad_fixup(struct procabi *abi, struct syscall_decode *sc) { int offset, prev; u_int i; +#ifndef __aarch64__ + (void)abi; +#endif offset = 0; prev = -1; for (i = 0; i < sc->nargs; i++) { @@ -810,17 +813,20 @@ quad_fixup(struct syscall_decode *sc) switch (sc->args[i].type & ARG_MASK) { case Quad: case QuadHex: -#ifdef __powerpc__ +#if defined(__powerpc__) || defined(__arm__) || defined(__aarch64__) /* - * 64-bit arguments on 32-bit powerpc must be + * 64-bit arguments on 32-bit powerpc and arm must be * 64-bit aligned. If the current offset is * not aligned, the calling convention inserts * a 32-bit pad argument that should be skipped. */ - if (sc->args[i].offset % 2 == 1) { - sc->args[i].offset++; - offset++; - } +#ifdef __aarch64__ + if (abi->pointer_size == sizeof(uint32_t)) +#endif + if (sc->args[i].offset % 2 == 1) { + sc->args[i].offset++; + offset++; + } #endif offset++; default: @@ -854,7 +860,7 @@ add_syscall(struct procabi *abi, u_int number, struct syscall *sc) * procabi instead. */ if (abi->pointer_size == 4) - quad_fixup(&sc->decode); + quad_fixup(abi, &sc->decode); if (number < nitems(abi->syscalls)) { assert(abi->syscalls[number] == NULL); From owner-dev-commits-src-all@freebsd.org Wed Sep 22 23:14:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2553D673C5B for ; Wed, 22 Sep 2021 23:14:29 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFDdc6jdkz3mpF for ; Wed, 22 Sep 2021 23:14:28 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f54.google.com with SMTP id w29so11574933wra.8 for ; Wed, 22 Sep 2021 16:14:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=tDBx0p+5weOTWVbCd/zRsgUMEklRVtaxcLO5zjkGz+w=; b=0maba2MjJNwAOEPTQ3kJAi7cJ0TiJkNv4IUavi3i2ZPXjRR1sCYeyxGIW4XYBOjDAp jQO9PNJ8NVmPo+xvTboLRywwRwOfNo7oqtiHZCg03TkjsRmLTEPNw57ydrUo4vnITUIO 6T9xwEvk6qqKFt779eyZEpizleTWV3xGUy8c7qBrGzqugao0eBf7XLZcoFSqG2UabCWp 0o0GZXi2MvMDq7fxH85EnZHkf9LvvCPe4s/qDvGhBz8lsD0Sjfuy2cXP9lDOJjmbvQg1 KKjlzdZQcgjrXX9YoGi9ez7Jto6BsPBLM8H4Wn7o3nFBAAZA2jhpNY4qLoELZ/TOdzBD n8tg== X-Gm-Message-State: AOAM532XdaSyoiBmXT7fAFFo35NcheoDz+/Y7IBNCLghSqafF+VChxZv NC12O5yYXuecH510NUm4J0ShVg== X-Google-Smtp-Source: ABdhPJz7HyQl094o3sWrWAoTSGjFCg2Uct0vGhgpeCmRJ7CHS7Nsx3vbf563hkhoIjwgYmbsPobbNw== X-Received: by 2002:a5d:440d:: with SMTP id z13mr1545340wrq.433.1632352461991; Wed, 22 Sep 2021 16:14:21 -0700 (PDT) Received: from smtpclient.apple (global-5-143.nat-2.net.cam.ac.uk. [131.111.5.143]) by smtp.gmail.com with ESMTPSA id i27sm7385868wmb.40.2021.09.22.16.14.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Sep 2021 16:14:21 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: ebbc3140ca0d - main - truss: Decode correctly 64bits arguments on 32bits arm. From: Jessica Clarke In-Reply-To: <202109222305.18MN5mxe013139@gitrepo.freebsd.org> Date: Thu, 23 Sep 2021 00:14:21 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <06FE486C-5D06-43FD-B64F-EFF902040BD3@freebsd.org> References: <202109222305.18MN5mxe013139@gitrepo.freebsd.org> To: Olivier Houchard X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4HFDdc6jdkz3mpF X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 23:14:29 -0000 On 23 Sep 2021, at 00:05, Olivier Houchard wrote: >=20 > The branch main has been updated by cognet: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Debbc3140ca0d7eee154f7a67ccdae7d3= d88d13fd >=20 > commit ebbc3140ca0d7eee154f7a67ccdae7d3d88d13fd > Author: Olivier Houchard > AuthorDate: 2021-09-22 22:45:42 +0000 > Commit: Olivier Houchard > CommitDate: 2021-09-22 23:04:16 +0000 >=20 > truss: Decode correctly 64bits arguments on 32bits arm. >=20 > When decoding 32bits arm syscall, make sure we account for the = padding when > decoding 64bits args. Do it too when using a 64bits truss on a = 32bits binary. >=20 > MFC After: 1 week > PR: 256199 > --- > usr.bin/truss/syscalls.c | 22 ++++++++++++++-------- > 1 file changed, 14 insertions(+), 8 deletions(-) >=20 > diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c > index f7657f30b583..9cd53e71cc9b 100644 > --- a/usr.bin/truss/syscalls.c > +++ b/usr.bin/truss/syscalls.c > @@ -792,11 +792,14 @@ print_mask_arg32(bool (*decoder)(FILE *, = uint32_t, uint32_t *), FILE *fp, > * decoding arguments. > */ > static void > -quad_fixup(struct syscall_decode *sc) > +quad_fixup(struct procabi *abi, struct syscall_decode *sc) > { > int offset, prev; > u_int i; >=20 > +#ifndef __aarch64__ > + (void)abi; > +#endif > offset =3D 0; > prev =3D -1; > for (i =3D 0; i < sc->nargs; i++) { > @@ -810,17 +813,20 @@ quad_fixup(struct syscall_decode *sc) > switch (sc->args[i].type & ARG_MASK) { > case Quad: > case QuadHex: > -#ifdef __powerpc__ > +#if defined(__powerpc__) || defined(__arm__) || defined(__aarch64__) > /* > - * 64-bit arguments on 32-bit powerpc must be > + * 64-bit arguments on 32-bit powerpc and arm = must be > * 64-bit aligned. If the current offset is > * not aligned, the calling convention inserts > * a 32-bit pad argument that should be skipped. > */ > - if (sc->args[i].offset % 2 =3D=3D 1) { > - sc->args[i].offset++; > - offset++; > - } > +#ifdef __aarch64__ > + if (abi->pointer_size =3D=3D sizeof(uint32_t)) Why? The caller already checks this, it doesn=E2=80=99t need to be = checked again. You even had to update that caller to pass the ABI and the patch clearly shows the check there. Also, please put changes like this up for review in future, arichardson@ did a bunch of work getting non-native ABI support into truss with input from myself, so if you find you need anything other than things like adding to ifdefs then that=E2=80=99s news to us because = we=E2=80=99ve tested it with freebsd32, and downstream in CheriBSD with our added freebsd64 ABI (which is what you think of as normal 64-bit, but we add a new ABI for memory safety that is the native ABI, so we exercise even more weird cases than upstream can). Please revert everything other than adding to the existing ifdef and updating the comment. Jess > +#endif > + if (sc->args[i].offset % 2 =3D=3D 1) { > + sc->args[i].offset++; > + offset++; > + } > #endif > offset++; > default: > @@ -854,7 +860,7 @@ add_syscall(struct procabi *abi, u_int number, = struct syscall *sc) > * procabi instead. > */ > if (abi->pointer_size =3D=3D 4) > - quad_fixup(&sc->decode); > + quad_fixup(abi, &sc->decode); >=20 > if (number < nitems(abi->syscalls)) { > assert(abi->syscalls[number] =3D=3D NULL); From owner-dev-commits-src-all@freebsd.org Wed Sep 22 23:16:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A2FB4673F7A; Wed, 22 Sep 2021 23:16: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 4HFDgg46hNz3n2R; Wed, 22 Sep 2021 23:16: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 69524203CF; Wed, 22 Sep 2021 23:16: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 18MNGFVM026245; Wed, 22 Sep 2021 23:16:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MNGFS0026244; Wed, 22 Sep 2021 23:16:15 GMT (envelope-from git) Date: Wed, 22 Sep 2021 23:16:15 GMT Message-Id: <202109222316.18MNGFS0026244@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 59a0ec578693 - stable/11 - Update OptionalObsoleteFiles.inc with NTP docs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 59a0ec578693887386ed787d2ee34d37f346eb80 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 23:16:15 -0000 The branch stable/11 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=59a0ec578693887386ed787d2ee34d37f346eb80 commit 59a0ec578693887386ed787d2ee34d37f346eb80 Author: Ed Maste AuthorDate: 2017-09-15 00:54:37 +0000 Commit: Ed Maste CommitDate: 2021-09-22 23:11:09 +0000 Update OptionalObsoleteFiles.inc with NTP docs The list of files for MK_NTP was incomplete. PR: 218193 Submitted by: brnrd MFC after: 1 week (cherry picked from commit 4154e70ea8dc0ac0d1639374ea3bc7b6c9744b9f) --- tools/build/mk/OptionalObsoleteFiles.inc | 203 +++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index fd0b3586f051..916f0a0703d5 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -6961,16 +6961,26 @@ OLD_FILES+=usr/sbin/ntpdate OLD_FILES+=usr/sbin/ntpdc OLD_FILES+=usr/sbin/ntptime OLD_FILES+=usr/sbin/sntp +OLD_FILES+=usr/share/doc/ntp/access.html OLD_FILES+=usr/share/doc/ntp/accopt.html OLD_FILES+=usr/share/doc/ntp/assoc.html OLD_FILES+=usr/share/doc/ntp/audio.html +OLD_FILES+=usr/share/doc/ntp/authentic.html OLD_FILES+=usr/share/doc/ntp/authopt.html +OLD_FILES+=usr/share/doc/ntp/autokey.html +OLD_FILES+=usr/share/doc/ntp/bugs.html OLD_FILES+=usr/share/doc/ntp/build.html +OLD_FILES+=usr/share/doc/ntp/clock.html OLD_FILES+=usr/share/doc/ntp/clockopt.html +OLD_FILES+=usr/share/doc/ntp/cluster.html +OLD_FILES+=usr/share/doc/ntp/comdex.html OLD_FILES+=usr/share/doc/ntp/config.html OLD_FILES+=usr/share/doc/ntp/confopt.html OLD_FILES+=usr/share/doc/ntp/copyright.html OLD_FILES+=usr/share/doc/ntp/debug.html +OLD_FILES+=usr/share/doc/ntp/decode.html +OLD_FILES+=usr/share/doc/ntp/discipline.html +OLD_FILES+=usr/share/doc/ntp/discover.html OLD_FILES+=usr/share/doc/ntp/driver1.html OLD_FILES+=usr/share/doc/ntp/driver10.html OLD_FILES+=usr/share/doc/ntp/driver11.html @@ -6999,34 +7009,227 @@ OLD_FILES+=usr/share/doc/ntp/driver6.html OLD_FILES+=usr/share/doc/ntp/driver7.html OLD_FILES+=usr/share/doc/ntp/driver8.html OLD_FILES+=usr/share/doc/ntp/driver9.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver1.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver10.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver11.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver12.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver16.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver18.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver19.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver20.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver22.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver26.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver27.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver28.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver29.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver3.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver30.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver31.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver32.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver33.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver34.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver35.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver36.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver37.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver38.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver39.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver4.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver40.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver42.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver43.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver44.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver45.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver46.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver5.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver6.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver7.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver8.html +OLD_FILES+=usr/share/doc/ntp/drivers/driver9.html +OLD_FILES+=usr/share/doc/ntp/drivers/icons/home.gif +OLD_FILES+=usr/share/doc/ntp/drivers/icons/mail2.gif +OLD_FILES+=usr/share/doc/ntp/drivers/mx4200data.html +OLD_FILES+=usr/share/doc/ntp/drivers/oncore-shmem.html +OLD_FILES+=usr/share/doc/ntp/drivers/scripts/footer.txt +OLD_FILES+=usr/share/doc/ntp/drivers/scripts/style.css +OLD_FILES+=usr/share/doc/ntp/drivers/tf582_4.html OLD_FILES+=usr/share/doc/ntp/extern.html +OLD_FILES+=usr/share/doc/ntp/filter.html OLD_FILES+=usr/share/doc/ntp/hints.html +OLD_FILES+=usr/share/doc/ntp/hints/a-ux +OLD_FILES+=usr/share/doc/ntp/hints/aix +OLD_FILES+=usr/share/doc/ntp/hints/bsdi +OLD_FILES+=usr/share/doc/ntp/hints/changes +OLD_FILES+=usr/share/doc/ntp/hints/decosf1 +OLD_FILES+=usr/share/doc/ntp/hints/decosf2 +OLD_FILES+=usr/share/doc/ntp/hints/freebsd +OLD_FILES+=usr/share/doc/ntp/hints/hpux +OLD_FILES+=usr/share/doc/ntp/hints/linux +OLD_FILES+=usr/share/doc/ntp/hints/mpeix +OLD_FILES+=usr/share/doc/ntp/hints/notes-xntp-v3 +OLD_FILES+=usr/share/doc/ntp/hints/parse +OLD_FILES+=usr/share/doc/ntp/hints/refclocks +OLD_FILES+=usr/share/doc/ntp/hints/rs6000 +OLD_FILES+=usr/share/doc/ntp/hints/sco.html +OLD_FILES+=usr/share/doc/ntp/hints/sgi +OLD_FILES+=usr/share/doc/ntp/hints/solaris-dosynctodr.html +OLD_FILES+=usr/share/doc/ntp/hints/solaris.html +OLD_FILES+=usr/share/doc/ntp/hints/solaris.xtra.4023118 +OLD_FILES+=usr/share/doc/ntp/hints/solaris.xtra.4095849 +OLD_FILES+=usr/share/doc/ntp/hints/solaris.xtra.S99ntpd +OLD_FILES+=usr/share/doc/ntp/hints/solaris.xtra.patchfreq +OLD_FILES+=usr/share/doc/ntp/hints/sun4 +OLD_FILES+=usr/share/doc/ntp/hints/svr4-dell +OLD_FILES+=usr/share/doc/ntp/hints/svr4_package +OLD_FILES+=usr/share/doc/ntp/hints/todo +OLD_FILES+=usr/share/doc/ntp/hints/vxworks.html +OLD_FILES+=usr/share/doc/ntp/hints/winnt.html +OLD_FILES+=usr/share/doc/ntp/history.html OLD_FILES+=usr/share/doc/ntp/howto.html +OLD_FILES+=usr/share/doc/ntp/huffpuff.html +OLD_FILES+=usr/share/doc/ntp/icons/home.gif +OLD_FILES+=usr/share/doc/ntp/icons/mail2.gif +OLD_FILES+=usr/share/doc/ntp/icons/sitemap.png OLD_FILES+=usr/share/doc/ntp/index.html OLD_FILES+=usr/share/doc/ntp/kern.html +OLD_FILES+=usr/share/doc/ntp/kernpps.html +OLD_FILES+=usr/share/doc/ntp/keygen.html OLD_FILES+=usr/share/doc/ntp/ldisc.html +OLD_FILES+=usr/share/doc/ntp/leap.html OLD_FILES+=usr/share/doc/ntp/measure.html OLD_FILES+=usr/share/doc/ntp/miscopt.html OLD_FILES+=usr/share/doc/ntp/monopt.html +OLD_FILES+=usr/share/doc/ntp/msyslog.html OLD_FILES+=usr/share/doc/ntp/mx4200data.html OLD_FILES+=usr/share/doc/ntp/notes.html +OLD_FILES+=usr/share/doc/ntp/ntp-keygen.html +OLD_FILES+=usr/share/doc/ntp/ntp-wait.html +OLD_FILES+=usr/share/doc/ntp/ntp.conf.html +OLD_FILES+=usr/share/doc/ntp/ntp.keys.html +OLD_FILES+=usr/share/doc/ntp/ntp_conf.html OLD_FILES+=usr/share/doc/ntp/ntpd.html OLD_FILES+=usr/share/doc/ntp/ntpdate.html OLD_FILES+=usr/share/doc/ntp/ntpdc.html +OLD_FILES+=usr/share/doc/ntp/ntpdsim.html +OLD_FILES+=usr/share/doc/ntp/ntpdsim_new.html OLD_FILES+=usr/share/doc/ntp/ntpq.html +OLD_FILES+=usr/share/doc/ntp/ntpsnmpd.html OLD_FILES+=usr/share/doc/ntp/ntptime.html OLD_FILES+=usr/share/doc/ntp/ntptrace.html +OLD_FILES+=usr/share/doc/ntp/orphan.html OLD_FILES+=usr/share/doc/ntp/parsedata.html OLD_FILES+=usr/share/doc/ntp/parsenew.html OLD_FILES+=usr/share/doc/ntp/patches.html +OLD_FILES+=usr/share/doc/ntp/pic/9400n.jpg +OLD_FILES+=usr/share/doc/ntp/pic/alice11.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice13.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice15.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice23.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice31.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice32.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice35.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice38.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice44.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice47.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice51.gif +OLD_FILES+=usr/share/doc/ntp/pic/alice61.gif +OLD_FILES+=usr/share/doc/ntp/pic/barnstable.gif +OLD_FILES+=usr/share/doc/ntp/pic/beaver.gif +OLD_FILES+=usr/share/doc/ntp/pic/boom3.gif +OLD_FILES+=usr/share/doc/ntp/pic/boom3a.gif +OLD_FILES+=usr/share/doc/ntp/pic/boom4.gif +OLD_FILES+=usr/share/doc/ntp/pic/broad.gif +OLD_FILES+=usr/share/doc/ntp/pic/bustardfly.gif +OLD_FILES+=usr/share/doc/ntp/pic/c51.jpg +OLD_FILES+=usr/share/doc/ntp/pic/description.jpg +OLD_FILES+=usr/share/doc/ntp/pic/discipline.gif +OLD_FILES+=usr/share/doc/ntp/pic/dogsnake.gif +OLD_FILES+=usr/share/doc/ntp/pic/driver29.gif +OLD_FILES+=usr/share/doc/ntp/pic/driver43_1.gif +OLD_FILES+=usr/share/doc/ntp/pic/driver43_2.jpg +OLD_FILES+=usr/share/doc/ntp/pic/fg6021.gif +OLD_FILES+=usr/share/doc/ntp/pic/fg6039.jpg +OLD_FILES+=usr/share/doc/ntp/pic/fig_3_1.gif +OLD_FILES+=usr/share/doc/ntp/pic/flatheads.gif +OLD_FILES+=usr/share/doc/ntp/pic/flt1.gif +OLD_FILES+=usr/share/doc/ntp/pic/flt2.gif +OLD_FILES+=usr/share/doc/ntp/pic/flt3.gif +OLD_FILES+=usr/share/doc/ntp/pic/flt4.gif +OLD_FILES+=usr/share/doc/ntp/pic/flt5.gif +OLD_FILES+=usr/share/doc/ntp/pic/flt6.gif +OLD_FILES+=usr/share/doc/ntp/pic/flt7.gif +OLD_FILES+=usr/share/doc/ntp/pic/flt8.gif +OLD_FILES+=usr/share/doc/ntp/pic/flt9.gif +OLD_FILES+=usr/share/doc/ntp/pic/freq1211.gif +OLD_FILES+=usr/share/doc/ntp/pic/gadget.jpg +OLD_FILES+=usr/share/doc/ntp/pic/gps167.jpg +OLD_FILES+=usr/share/doc/ntp/pic/group.gif +OLD_FILES+=usr/share/doc/ntp/pic/hornraba.gif +OLD_FILES+=usr/share/doc/ntp/pic/igclock.gif +OLD_FILES+=usr/share/doc/ntp/pic/neoclock4x.gif +OLD_FILES+=usr/share/doc/ntp/pic/offset1211.gif +OLD_FILES+=usr/share/doc/ntp/pic/oncore_evalbig.gif +OLD_FILES+=usr/share/doc/ntp/pic/oncore_remoteant.jpg +OLD_FILES+=usr/share/doc/ntp/pic/oncore_utplusbig.gif +OLD_FILES+=usr/share/doc/ntp/pic/oz2.gif +OLD_FILES+=usr/share/doc/ntp/pic/panda.gif +OLD_FILES+=usr/share/doc/ntp/pic/pd_om006.gif +OLD_FILES+=usr/share/doc/ntp/pic/pd_om011.gif +OLD_FILES+=usr/share/doc/ntp/pic/peer.gif +OLD_FILES+=usr/share/doc/ntp/pic/pogo.gif +OLD_FILES+=usr/share/doc/ntp/pic/pogo1a.gif +OLD_FILES+=usr/share/doc/ntp/pic/pogo3a.gif +OLD_FILES+=usr/share/doc/ntp/pic/pogo4.gif +OLD_FILES+=usr/share/doc/ntp/pic/pogo5.gif +OLD_FILES+=usr/share/doc/ntp/pic/pogo6.gif +OLD_FILES+=usr/share/doc/ntp/pic/pogo7.gif +OLD_FILES+=usr/share/doc/ntp/pic/pogo8.gif +OLD_FILES+=usr/share/doc/ntp/pic/pzf509.jpg +OLD_FILES+=usr/share/doc/ntp/pic/pzf511.jpg +OLD_FILES+=usr/share/doc/ntp/pic/rabbit.gif +OLD_FILES+=usr/share/doc/ntp/pic/radio2.jpg +OLD_FILES+=usr/share/doc/ntp/pic/sheepb.jpg +OLD_FILES+=usr/share/doc/ntp/pic/stack1a.jpg +OLD_FILES+=usr/share/doc/ntp/pic/stats.gif +OLD_FILES+=usr/share/doc/ntp/pic/sx5.gif +OLD_FILES+=usr/share/doc/ntp/pic/thunderbolt.jpg +OLD_FILES+=usr/share/doc/ntp/pic/time1.gif +OLD_FILES+=usr/share/doc/ntp/pic/tonea.gif +OLD_FILES+=usr/share/doc/ntp/pic/tribeb.gif +OLD_FILES+=usr/share/doc/ntp/pic/wingdorothy.gif +OLD_FILES+=usr/share/doc/ntp/poll.html OLD_FILES+=usr/share/doc/ntp/porting.html OLD_FILES+=usr/share/doc/ntp/pps.html OLD_FILES+=usr/share/doc/ntp/prefer.html OLD_FILES+=usr/share/doc/ntp/quick.html +OLD_FILES+=usr/share/doc/ntp/rate.html OLD_FILES+=usr/share/doc/ntp/rdebug.html OLD_FILES+=usr/share/doc/ntp/refclock.html OLD_FILES+=usr/share/doc/ntp/release.html +OLD_FILES+=usr/share/doc/ntp/scripts/accopt.txt +OLD_FILES+=usr/share/doc/ntp/scripts/audio.txt +OLD_FILES+=usr/share/doc/ntp/scripts/authopt.txt +OLD_FILES+=usr/share/doc/ntp/scripts/clockopt.txt +OLD_FILES+=usr/share/doc/ntp/scripts/command.txt +OLD_FILES+=usr/share/doc/ntp/scripts/config.txt +OLD_FILES+=usr/share/doc/ntp/scripts/confopt.txt +OLD_FILES+=usr/share/doc/ntp/scripts/external.txt +OLD_FILES+=usr/share/doc/ntp/scripts/footer.txt +OLD_FILES+=usr/share/doc/ntp/scripts/hand.txt +OLD_FILES+=usr/share/doc/ntp/scripts/install.txt +OLD_FILES+=usr/share/doc/ntp/scripts/manual.txt +OLD_FILES+=usr/share/doc/ntp/scripts/misc.txt +OLD_FILES+=usr/share/doc/ntp/scripts/miscopt.txt +OLD_FILES+=usr/share/doc/ntp/scripts/monopt.txt +OLD_FILES+=usr/share/doc/ntp/scripts/refclock.txt +OLD_FILES+=usr/share/doc/ntp/scripts/special.txt +OLD_FILES+=usr/share/doc/ntp/scripts/style.css +OLD_FILES+=usr/share/doc/ntp/select.html +OLD_FILES+=usr/share/doc/ntp/sitemap.html +OLD_FILES+=usr/share/doc/ntp/sntp.html +OLD_FILES+=usr/share/doc/ntp/stats.html OLD_FILES+=usr/share/doc/ntp/tickadj.html +OLD_FILES+=usr/share/doc/ntp/warp.html +OLD_FILES+=usr/share/doc/ntp/xleave.html OLD_DIRS+=usr/share/doc/ntp OLD_FILES+=usr/share/examples/etc/ntp.conf OLD_FILES+=usr/share/man/man1/sntp.1.gz From owner-dev-commits-src-all@freebsd.org Wed Sep 22 23:20:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B0C2674614; Wed, 22 Sep 2021 23:20:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFDn56y3mz3nH8; Wed, 22 Sep 2021 23: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 CE87C1FFFA; Wed, 22 Sep 2021 23:20: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 18MNKvwG035119; Wed, 22 Sep 2021 23: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 18MNKvK9035118; Wed, 22 Sep 2021 23:20:57 GMT (envelope-from git) Date: Wed, 22 Sep 2021 23:20:57 GMT Message-Id: <202109222320.18MNKvK9035118@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: b31c5a253213 - main - 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/main X-Git-Reftype: branch X-Git-Commit: b31c5a25321363ab95c1642dffc6e92319dc42ce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 23:20:58 -0000 The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=b31c5a25321363ab95c1642dffc6e92319dc42ce commit b31c5a25321363ab95c1642dffc6e92319dc42ce Author: Kirk McKusick AuthorDate: 2021-09-22 23:16:39 +0000 Commit: Kirk McKusick CommitDate: 2021-09-22 23:20:19 +0000 Eliminate an unnecessary rerun request in fsck_ffs. When fsck_ffs is running in preen mode and finds a zero-length directory, it deletes that directory. In doing this operation, it unnecessary set its internal flag saying that fsck_ffs needed to be rerun. This patch deletes the rerun request for this case. Reported by: Mark Johnson PR: 246962 MFC after: 1 week Sponsored by: Netflix --- sbin/fsck_ffs/dir.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c index e806f113ff16..42ecf4112253 100644 --- a/sbin/fsck_ffs/dir.c +++ b/sbin/fsck_ffs/dir.c @@ -132,7 +132,6 @@ dirscan(struct inodesc *idesc) (size_t)dsize); dirty(bp); sbdirty(); - rerun = 1; } if (n & STOP) return (n); From owner-dev-commits-src-all@freebsd.org Wed Sep 22 23:27:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29842674B9B; Wed, 22 Sep 2021 23:27:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFDx00Vc5z3pmc; Wed, 22 Sep 2021 23:27:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E53762042C; Wed, 22 Sep 2021 23:27:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18MNRlGr040306; Wed, 22 Sep 2021 23:27:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MNRlAi040305; Wed, 22 Sep 2021 23:27:47 GMT (envelope-from git) Date: Wed, 22 Sep 2021 23:27:47 GMT Message-Id: <202109222327.18MNRlAi040305@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Houchard Subject: git: f4b7018af11a - main - truss: Decode correctly 64bits arguments on 32bits arm. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f4b7018af11a1ab3edfcce8bc0bfa521364cdeb0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 23:27:48 -0000 The branch main has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=f4b7018af11a1ab3edfcce8bc0bfa521364cdeb0 commit f4b7018af11a1ab3edfcce8bc0bfa521364cdeb0 Author: Olivier Houchard AuthorDate: 2021-09-22 23:23:07 +0000 Commit: Olivier Houchard CommitDate: 2021-09-22 23:26:42 +0000 truss: Decode correctly 64bits arguments on 32bits arm. Mostly revert ebbc3140ca0d7eee154f7a67ccdae7d3d88d13fd. We don't need to special-case anything for arm64, the check for the pointer size is already done for us, just keep the bits about having arm and arm64 having to add padding for 32bits binaries. MFC after: 1 week --- usr.bin/truss/syscalls.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index 9cd53e71cc9b..128ae624cf5f 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -792,14 +792,11 @@ print_mask_arg32(bool (*decoder)(FILE *, uint32_t, uint32_t *), FILE *fp, * decoding arguments. */ static void -quad_fixup(struct procabi *abi, struct syscall_decode *sc) +quad_fixup(struct syscall_decode *sc) { int offset, prev; u_int i; -#ifndef __aarch64__ - (void)abi; -#endif offset = 0; prev = -1; for (i = 0; i < sc->nargs; i++) { @@ -820,13 +817,10 @@ quad_fixup(struct procabi *abi, struct syscall_decode *sc) * not aligned, the calling convention inserts * a 32-bit pad argument that should be skipped. */ -#ifdef __aarch64__ - if (abi->pointer_size == sizeof(uint32_t)) -#endif - if (sc->args[i].offset % 2 == 1) { - sc->args[i].offset++; - offset++; - } + if (sc->args[i].offset % 2 == 1) { + sc->args[i].offset++; + offset++; + } #endif offset++; default: @@ -860,7 +854,7 @@ add_syscall(struct procabi *abi, u_int number, struct syscall *sc) * procabi instead. */ if (abi->pointer_size == 4) - quad_fixup(abi, &sc->decode); + quad_fixup(&sc->decode); if (number < nitems(abi->syscalls)) { assert(abi->syscalls[number] == NULL); From owner-dev-commits-src-all@freebsd.org Wed Sep 22 23:28:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC28E674B18; Wed, 22 Sep 2021 23:28:56 +0000 (UTC) (envelope-from cognet@ci0.org) Received: from kanar.ci0.org (kanar.ci0.org [IPv6:2001:bc8:35e6::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "sd-143795", Issuer "sd-143795" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFDyJ4867z3q6b; Wed, 22 Sep 2021 23:28:56 +0000 (UTC) (envelope-from cognet@ci0.org) Received: from kanar.ci0.org (localhost [127.0.0.1]) by kanar.ci0.org (8.16.1/8.16.1) with ESMTPS id 18MNRR2I067003 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 23 Sep 2021 01:27:27 +0200 (CEST) (envelope-from cognet@ci0.org) Received: (from doginou@localhost) by kanar.ci0.org (8.16.1/8.16.1/Submit) id 18MNRRQk067002; Thu, 23 Sep 2021 01:27:27 +0200 (CEST) (envelope-from cognet@ci0.org) X-Authentication-Warning: kanar.ci0.org: doginou set sender to cognet@ci0.org using -f Date: Thu, 23 Sep 2021 01:27:27 +0200 From: Olivier Houchard To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: ebbc3140ca0d - main - truss: Decode correctly 64bits arguments on 32bits arm. Message-ID: References: <202109222305.18MN5mxe013139@gitrepo.freebsd.org> <06FE486C-5D06-43FD-B64F-EFF902040BD3@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <06FE486C-5D06-43FD-B64F-EFF902040BD3@freebsd.org> X-Rspamd-Queue-Id: 4HFDyJ4867z3q6b X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 23:28:56 -0000 On Thu, Sep 23, 2021 at 12:14:21AM +0100, Jessica Clarke wrote: > On 23 Sep 2021, at 00:05, Olivier Houchard wrote: > > > > The branch main has been updated by cognet: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=ebbc3140ca0d7eee154f7a67ccdae7d3d88d13fd > > > > commit ebbc3140ca0d7eee154f7a67ccdae7d3d88d13fd > > Author: Olivier Houchard > > AuthorDate: 2021-09-22 22:45:42 +0000 > > Commit: Olivier Houchard > > CommitDate: 2021-09-22 23:04:16 +0000 > > > > truss: Decode correctly 64bits arguments on 32bits arm. > > > > When decoding 32bits arm syscall, make sure we account for the padding when > > decoding 64bits args. Do it too when using a 64bits truss on a 32bits binary. > > > > MFC After: 1 week > > PR: 256199 > > --- > > usr.bin/truss/syscalls.c | 22 ++++++++++++++-------- > > 1 file changed, 14 insertions(+), 8 deletions(-) > > > > diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c > > index f7657f30b583..9cd53e71cc9b 100644 > > --- a/usr.bin/truss/syscalls.c > > +++ b/usr.bin/truss/syscalls.c > > @@ -792,11 +792,14 @@ print_mask_arg32(bool (*decoder)(FILE *, uint32_t, uint32_t *), FILE *fp, > > * decoding arguments. > > */ > > static void > > -quad_fixup(struct syscall_decode *sc) > > +quad_fixup(struct procabi *abi, struct syscall_decode *sc) > > { > > int offset, prev; > > u_int i; > > > > +#ifndef __aarch64__ > > + (void)abi; > > +#endif > > offset = 0; > > prev = -1; > > for (i = 0; i < sc->nargs; i++) { > > @@ -810,17 +813,20 @@ quad_fixup(struct syscall_decode *sc) > > switch (sc->args[i].type & ARG_MASK) { > > case Quad: > > case QuadHex: > > -#ifdef __powerpc__ > > +#if defined(__powerpc__) || defined(__arm__) || defined(__aarch64__) > > /* > > - * 64-bit arguments on 32-bit powerpc must be > > + * 64-bit arguments on 32-bit powerpc and arm must be > > * 64-bit aligned. If the current offset is > > * not aligned, the calling convention inserts > > * a 32-bit pad argument that should be skipped. > > */ > > - if (sc->args[i].offset % 2 == 1) { > > - sc->args[i].offset++; > > - offset++; > > - } > > +#ifdef __aarch64__ > > + if (abi->pointer_size == sizeof(uint32_t)) > > Why? The caller already checks this, it doesn???t need to be checked > again. You even had to update that caller to pass the ABI and the patch > clearly shows the check there. > > Also, please put changes like this up for review in future, > arichardson@ did a bunch of work getting non-native ABI support into > truss with input from myself, so if you find you need anything other > than things like adding to ifdefs then that???s news to us because we???ve > tested it with freebsd32, and downstream in CheriBSD with our added > freebsd64 ABI (which is what you think of as normal 64-bit, but we add > a new ABI for memory safety that is the native ABI, so we exercise even > more weird cases than upstream can). > > Please revert everything other than adding to the existing ifdef and > updating the comment. > Oops, apologizes, it's just that I am an idiot. It is now reverted to a hopefully more sane state. Olivier From owner-dev-commits-src-all@freebsd.org Thu Sep 23 00:03:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6421675563; Thu, 23 Sep 2021 00:03: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 4HFFjj60DSz3s2j; Thu, 23 Sep 2021 00:03: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 ADD6C20E2E; Thu, 23 Sep 2021 00:03: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 18N035ht093530; Thu, 23 Sep 2021 00:03:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N0350X093529; Thu, 23 Sep 2021 00:03:05 GMT (envelope-from git) Date: Thu, 23 Sep 2021 00:03:05 GMT Message-Id: <202109230003.18N0350X093529@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: b5f90655ea37 - main - sysdecode.3: Remove documentation of CloudABI ABIs. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b5f90655ea37dc01e48002f83f85c6e3fc7565d8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 00:03:06 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b5f90655ea37dc01e48002f83f85c6e3fc7565d8 commit b5f90655ea37dc01e48002f83f85c6e3fc7565d8 Author: John Baldwin AuthorDate: 2021-09-23 00:02:17 +0000 Commit: John Baldwin CommitDate: 2021-09-23 00:02:17 +0000 sysdecode.3: Remove documentation of CloudABI ABIs. Fixes: cf0ee8738e31 Drop cloudabi --- lib/libsysdecode/sysdecode.3 | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/libsysdecode/sysdecode.3 b/lib/libsysdecode/sysdecode.3 index 41faca95e7e1..f5437e9b1c84 100644 --- a/lib/libsysdecode/sysdecode.3 +++ b/lib/libsysdecode/sysdecode.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 26, 2018 +.Dd September 22, 2021 .Dt SYSDECODE 3 .Os .Sh NAME @@ -47,7 +47,7 @@ The supported ABIs are named by the .Vt enum sysdecode_abi enumeration. .Pp -.Bl -tag -width "Li SYSDECODE_ABI_CLOUDABI64" -compact +.Bl -tag -width "Li SYSDECODE_ABI_FREEBSD32" -compact .It Li SYSDECODE_ABI_FREEBSD Native FreeBSD binaries. Supported on all platforms. @@ -60,12 +60,6 @@ Supported on amd64, i386, and arm64. .It Li SYSDECODE_ABI_LINUX32 32-bit Linux binaries. Supported on amd64. -.It Li SYSDECODE_ABI_CLOUDABI32 -32-bit CloudABI binaries. -Supported on all platforms. -.It Li SYSDECODE_ABI_CLOUDABI64 -64-bit CloudABI binaries. -Supported on all platforms. .It Li SYSDECODE_ABI_UNKNOWN A placeholder for use when the ABI is not known. .El From owner-dev-commits-src-all@freebsd.org Thu Sep 23 00:51:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 37EE5676329; Thu, 23 Sep 2021 00:51: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 4HFGnj18sjz3vyJ; Thu, 23 Sep 2021 00:51: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 08FB2216B8; Thu, 23 Sep 2021 00:51: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 18N0pa17058787; Thu, 23 Sep 2021 00:51:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N0paPH058786; Thu, 23 Sep 2021 00:51:36 GMT (envelope-from git) Date: Thu, 23 Sep 2021 00:51:36 GMT Message-Id: <202109230051.18N0paPH058786@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 3fcbde5e883a - main - tests/sys/fs/fusefs/read.cc: fix build on powerpc64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3fcbde5e883a253f631082b128dcdf77c840d4c0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 00:51:37 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3fcbde5e883a253f631082b128dcdf77c840d4c0 commit 3fcbde5e883a253f631082b128dcdf77c840d4c0 Author: Konstantin Belousov AuthorDate: 2021-09-22 22:47:10 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-23 00:51:10 +0000 tests/sys/fs/fusefs/read.cc: fix build on powerpc64 There sig_atomic_t is shorter than void *. As result, it cannot keep pointer. Assigning to void * is actually safe for us in a signal handler. Reviewed by: asomers Sponsored by: The FreeBSD Foundation MFC after: 1 week Fixes: 4f917847c9037d Differential revision: https://reviews.freebsd.org/D32064 --- tests/sys/fs/fusefs/read.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/sys/fs/fusefs/read.cc b/tests/sys/fs/fusefs/read.cc index cb82d0a43b06..3cba564affcf 100644 --- a/tests/sys/fs/fusefs/read.cc +++ b/tests/sys/fs/fusefs/read.cc @@ -109,7 +109,7 @@ class ReadSigbus: public Read { public: static jmp_buf s_jmpbuf; -static sig_atomic_t s_si_addr; +static void *s_si_addr; void TearDown() { struct sigaction sa; @@ -125,12 +125,12 @@ void TearDown() { static void handle_sigbus(int signo __unused, siginfo_t *info, void *uap __unused) { - ReadSigbus::s_si_addr = (sig_atomic_t)info->si_addr; + ReadSigbus::s_si_addr = info->si_addr; longjmp(ReadSigbus::s_jmpbuf, 1); } jmp_buf ReadSigbus::s_jmpbuf; -sig_atomic_t ReadSigbus::s_si_addr; +void *ReadSigbus::s_si_addr; /* AIO reads need to set the header's pid field correctly */ /* https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236379 */ @@ -658,7 +658,7 @@ TEST_F(ReadSigbus, mmap_eio) FAIL() << "shouldn't get here"; } - ASSERT_EQ(p, (void*)ReadSigbus::s_si_addr); + ASSERT_EQ(p, ReadSigbus::s_si_addr); ASSERT_EQ(0, munmap(p, len)) << strerror(errno); leak(fd); } @@ -785,7 +785,7 @@ TEST_F(ReadSigbus, mmap_getblksz_fail) FAIL() << "shouldn't get here"; } - ASSERT_EQ(p, (void*)ReadSigbus::s_si_addr); + ASSERT_EQ(p, ReadSigbus::s_si_addr); ASSERT_EQ(0, munmap(p, len)) << strerror(errno); leak(fd); } From owner-dev-commits-src-all@freebsd.org Thu Sep 23 01:03:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C0146767C4; Thu, 23 Sep 2021 01:03:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFH3w305Jz3wLm; Thu, 23 Sep 2021 01:03:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 401EF219E9; Thu, 23 Sep 2021 01:03:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18N13uHr073837; Thu, 23 Sep 2021 01:03:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N13uI4073836; Thu, 23 Sep 2021 01:03:56 GMT (envelope-from git) Date: Thu, 23 Sep 2021 01:03:56 GMT Message-Id: <202109230103.18N13uI4073836@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 89edde19d3fe - stable/13 - psm(4): Disable KVM switch "jitter" clamping for absolute touchpads. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 89edde19d3fe13dd6596d9278542d27b42767e26 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 01:03:56 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=89edde19d3fe13dd6596d9278542d27b42767e26 commit 89edde19d3fe13dd6596d9278542d27b42767e26 Author: Vladimir Kondratyev AuthorDate: 2021-09-09 21:37:40 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-23 00:57:08 +0000 psm(4): Disable KVM switch "jitter" clamping for absolute touchpads. r123442 introduced solution for clamping of PS/2 mice jitter when using a KVM. Solution is to buffer mouse packets for 0.050ms if mouse activity has not been seen for more than 0.5 seconds. Then flush that data to driver if no validation errors found or drop the entire queue otherwise. While it works well with relative devices it has issues with absolute ones Depending on history buffering may results in delaying of the touch front edge for 0.050ms that affects gesture processing (tap detection). As absolute touchpads usually are built-in devices we can safely disable bufferization and KVM jitter clamping to avoid such a delays. (cherry picked from commit bedf31ad7e15c7d3e3ff9e5295bfd5454fbb42fa) --- sys/dev/atkbdc/psm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index f27a49f82a71..9b47a7a6b0c5 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -3134,8 +3134,12 @@ next: /* * If we've filled the queue then call the softintr ourselves, * otherwise schedule the interrupt for later. + * Do not postpone interrupts for absolute devices as it + * affects tap detection timings. */ - if (!timeelapsed(&sc->lastsoftintr, psmsecs, psmusecs, &now) || + if (sc->hw.model == MOUSE_MODEL_SYNAPTICS || + sc->hw.model == MOUSE_MODEL_ELANTECH || + !timeelapsed(&sc->lastsoftintr, psmsecs, psmusecs, &now) || (sc->pqueue_end == sc->pqueue_start)) { if ((sc->state & PSM_SOFTARMED) != 0) { sc->state &= ~PSM_SOFTARMED; From owner-dev-commits-src-all@freebsd.org Thu Sep 23 01:03:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5DA367643A; Thu, 23 Sep 2021 01: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 4HFH3x3Xvwz3wNg; Thu, 23 Sep 2021 01: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 5990C21957; Thu, 23 Sep 2021 01: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 18N13v4C073861; Thu, 23 Sep 2021 01: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 18N13vdE073860; Thu, 23 Sep 2021 01:03:57 GMT (envelope-from git) Date: Thu, 23 Sep 2021 01:03:57 GMT Message-Id: <202109230103.18N13vdE073860@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 7683f19cbf40 - stable/13 - hkbd(4): Reduce diff with ukbd(4) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7683f19cbf40cd757bf514617a9dcbe938f2989a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 01:03:57 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=7683f19cbf40cd757bf514617a9dcbe938f2989a commit 7683f19cbf40cd757bf514617a9dcbe938f2989a Author: Vladimir Kondratyev AuthorDate: 2021-09-09 21:39:05 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-23 00:57:34 +0000 hkbd(4): Reduce diff with ukbd(4) (cherry picked from commit 3ef9023f935ff721f72ed44cf26911b9af72dba1) --- sys/dev/hid/hkbd.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c index 55eba6d321ea..729602b12f3a 100644 --- a/sys/dev/hid/hkbd.c +++ b/sys/dev/hid/hkbd.c @@ -657,7 +657,6 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) uint32_t i; uint8_t id = 0; uint8_t modifiers; - int offset; HKBD_LOCK_ASSERT(sc); @@ -709,13 +708,15 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) } else if (id != sc->sc_id_loc_key[i]) { continue; /* invalid HID ID */ } else if (i == 0) { - offset = sc->sc_loc_key[0].count; - if (offset < 0 || offset > len) - offset = len; - while (offset--) { + struct hid_location tmp_loc = sc->sc_loc_key[0]; + /* range check array size */ + if (tmp_loc.count > HKBD_NKEYCODE) + tmp_loc.count = HKBD_NKEYCODE; + while (tmp_loc.count--) { uint32_t key = - hid_get_data(buf + offset, len - offset, - &sc->sc_loc_key[i]); + hid_get_udata(buf, len, &tmp_loc); + /* advance to next location */ + tmp_loc.pos += tmp_loc.size; if (key == KEY_ERROR) { DPRINTF("KEY_ERROR\n"); sc->sc_ndata = sc->sc_odata; From owner-dev-commits-src-all@freebsd.org Thu Sep 23 01:04:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2A2E67680C; Thu, 23 Sep 2021 01:04:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFH405zJPz4Qst; Thu, 23 Sep 2021 01:04: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 AC329219EA; Thu, 23 Sep 2021 01:04: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 18N140x8073939; Thu, 23 Sep 2021 01:04:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N140IF073938; Thu, 23 Sep 2021 01:04:00 GMT (envelope-from git) Date: Thu, 23 Sep 2021 01:04:00 GMT Message-Id: <202109230104.18N140IF073938@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 9faebc1e664d - stable/13 - hkbd(4): Fix build on 32bit platforms MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9faebc1e664d675d2f1f6dc54e9735c39aa8b0e7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 01:04:01 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=9faebc1e664d675d2f1f6dc54e9735c39aa8b0e7 commit 9faebc1e664d675d2f1f6dc54e9735c39aa8b0e7 Author: Vladimir Kondratyev AuthorDate: 2021-09-09 22:49:26 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-23 00:59:37 +0000 hkbd(4): Fix build on 32bit platforms (cherry picked from commit 38d2e9314b127b3466e8ae4120e21fe1ad076dfc) --- sys/dev/hid/hkbd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c index bfd8e12df746..ad9b3dde3d37 100644 --- a/sys/dev/hid/hkbd.c +++ b/sys/dev/hid/hkbd.c @@ -301,8 +301,8 @@ static void hkbd_timeout(void *); static int hkbd_set_leds(struct hkbd_softc *, uint8_t); static int hkbd_set_typematic(keyboard_t *, int); #ifdef HKBD_EMULATE_ATSCANCODE -static uint32_t hkbd_atkeycode(int, const uint64_t *); -static int hkbd_key2scan(struct hkbd_softc *, int, const uint64_t *, int); +static uint32_t hkbd_atkeycode(int, const bitstr_t *); +static int hkbd_key2scan(struct hkbd_softc *, int, const bitstr_t *, int); #endif static uint32_t hkbd_read_char(keyboard_t *, int); static void hkbd_clear_state(keyboard_t *); From owner-dev-commits-src-all@freebsd.org Thu Sep 23 01:03:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3B2967635C; Thu, 23 Sep 2021 01:03:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFH3y4Khdz4Qtn; Thu, 23 Sep 2021 01:03:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74BFD21A57; Thu, 23 Sep 2021 01:03:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18N13w4S073887; Thu, 23 Sep 2021 01:03:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N13wHx073886; Thu, 23 Sep 2021 01:03:58 GMT (envelope-from git) Date: Thu, 23 Sep 2021 01:03:58 GMT Message-Id: <202109230103.18N13wHx073886@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 1dec30a65a31 - stable/13 - hkbd(4): Use bitstring(3) KPI for key bitmaps processing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1dec30a65a3125ed02f1c83f9b1d22cfd11dbc86 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 01:03:58 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=1dec30a65a3125ed02f1c83f9b1d22cfd11dbc86 commit 1dec30a65a3125ed02f1c83f9b1d22cfd11dbc86 Author: Vladimir Kondratyev AuthorDate: 2021-09-09 21:39:46 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-23 00:57:57 +0000 hkbd(4): Use bitstring(3) KPI for key bitmaps processing. No functional changes intended. (cherry picked from commit 04918395f18dfb115dc0fe2865780dc607c5dc71) --- sys/dev/hid/hkbd.c | 160 ++++++++++++++++++++--------------------------------- 1 file changed, 61 insertions(+), 99 deletions(-) diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c index 729602b12f3a..65e8b9446e9d 100644 --- a/sys/dev/hid/hkbd.c +++ b/sys/dev/hid/hkbd.c @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -116,7 +117,7 @@ SYSCTL_INT(_hw_hid_hkbd, OID_AUTO, no_leds, CTLFLAG_RWTUN, #define HKBD_BUFFER_SIZE 64 /* bytes */ #define HKBD_KEY_PRESSED(map, key) ({ \ CTASSERT((key) >= 0 && (key) < HKBD_NKEYCODE); \ - ((map)[(key) / 64] & (1ULL << ((key) % 64))); \ + bit_test(map, key); \ }) #define MOD_EJECT 0x01 @@ -125,10 +126,6 @@ SYSCTL_INT(_hw_hid_hkbd, OID_AUTO, no_leds, CTLFLAG_RWTUN, #define MOD_MIN 0xe0 #define MOD_MAX 0xe7 -struct hkbd_data { - uint64_t bitmap[howmany(HKBD_NKEYCODE, 64)]; -}; - struct hkbd_softc { device_t sc_dev; @@ -136,7 +133,7 @@ struct hkbd_softc { keymap_t sc_keymap; accentmap_t sc_accmap; fkeytab_t sc_fkeymap[HKBD_NFKEY]; - uint64_t sc_loc_key_valid[howmany(HKBD_NKEYCODE, 64)]; + bitstr_t bit_decl(sc_loc_key_valid, HKBD_NKEYCODE); struct hid_location sc_loc_apple_eject; struct hid_location sc_loc_apple_fn; struct hid_location sc_loc_key[HKBD_NKEYCODE]; @@ -146,8 +143,8 @@ struct hkbd_softc { struct mtx sc_mtx; struct task sc_task; struct callout sc_callout; - struct hkbd_data sc_ndata; - struct hkbd_data sc_odata; + bitstr_t bit_decl(sc_ndata, HKBD_NKEYCODE); + bitstr_t bit_decl(sc_odata, HKBD_NKEYCODE); struct thread *sc_poll_thread; #ifdef EVDEV_SUPPORT @@ -328,23 +325,19 @@ static const struct evdev_methods hkbd_evdev_methods = { static bool hkbd_any_key_pressed(struct hkbd_softc *sc) { - bool ret = false; - unsigned i; + int result; - for (i = 0; i != howmany(HKBD_NKEYCODE, 64); i++) - ret |= (sc->sc_odata.bitmap[i] != 0); - return (ret); + bit_ffs(sc->sc_odata, HKBD_NKEYCODE, &result); + return (result != -1); } static bool hkbd_any_key_valid(struct hkbd_softc *sc) { - bool ret = false; - unsigned i; + int result; - for (i = 0; i != howmany(HKBD_NKEYCODE, 64); i++) - ret |= (sc->sc_loc_key_valid[i] != 0); - return (ret); + bit_ffs(sc->sc_loc_key_valid, HKBD_NKEYCODE, &result); + return (result != -1); } static bool @@ -487,65 +480,47 @@ hkbd_interrupt(struct hkbd_softc *sc) HKBD_LOCK_ASSERT(sc); - /* Check for key changes, the order is: - * 1. Modifier keys down - * 2. Regular keys up/down - * 3. Modifier keys up + /* + * Check for key changes, the order is: + * 1. Regular keys up + * 2. Modifier keys up + * 3. Modifier keys down + * 4. Regular keys down * * This allows devices which send events changing the state of * both a modifier key and a regular key, to be correctly * translated. */ - for (key = MOD_MIN; key <= MOD_MAX; key++) { - const uint64_t mask = 1ULL << (key % 64); + bit_foreach(sc->sc_odata, HKBD_NKEYCODE, key) { + if (hkbd_is_modifier_key(key) || bit_test(sc->sc_ndata, key)) + continue; + hkbd_put_key(sc, key | KEY_RELEASE); - if (!(sc->sc_odata.bitmap[key / 64] & mask) && - (sc->sc_ndata.bitmap[key / 64] & mask)) { - hkbd_put_key(sc, key | KEY_PRESS); - } + /* clear repeating key, if any */ + if (sc->sc_repeat_key == key) + sc->sc_repeat_key = 0; } - for (key = 0; key != HKBD_NKEYCODE; key++) { - const uint64_t mask = 1ULL << (key % 64); - const uint64_t delta = - sc->sc_odata.bitmap[key / 64] ^ - sc->sc_ndata.bitmap[key / 64]; - - if (hkbd_is_modifier_key(key)) + bit_foreach_at(sc->sc_odata, MOD_MIN, MOD_MAX + 1, key) + if (!bit_test(sc->sc_ndata, key)) + hkbd_put_key(sc, key | KEY_RELEASE); + bit_foreach_at(sc->sc_ndata, MOD_MIN, MOD_MAX + 1, key) + if (!bit_test(sc->sc_odata, key)) + hkbd_put_key(sc, key | KEY_PRESS); + bit_foreach(sc->sc_ndata, HKBD_NKEYCODE, key) { + if (hkbd_is_modifier_key(key) || bit_test(sc->sc_odata, key)) continue; + hkbd_put_key(sc, key | KEY_PRESS); - if (mask == 1 && delta == 0) { - key += 63; - continue; /* skip empty areas */ - } else if (delta & mask) { - if (sc->sc_odata.bitmap[key / 64] & mask) { - hkbd_put_key(sc, key | KEY_RELEASE); - - /* clear repeating key, if any */ - if (sc->sc_repeat_key == key) - sc->sc_repeat_key = 0; - } else { - hkbd_put_key(sc, key | KEY_PRESS); - - sc->sc_co_basetime = sbinuptime(); - sc->sc_delay = sc->sc_kbd.kb_delay1; - hkbd_start_timer(sc); - - /* set repeat time for last key */ - sc->sc_repeat_time = now + sc->sc_kbd.kb_delay1; - sc->sc_repeat_key = key; - } - } - } - for (key = MOD_MIN; key <= MOD_MAX; key++) { - const uint64_t mask = 1ULL << (key % 64); + sc->sc_co_basetime = sbinuptime(); + sc->sc_delay = sc->sc_kbd.kb_delay1; + hkbd_start_timer(sc); - if ((sc->sc_odata.bitmap[key / 64] & mask) && - !(sc->sc_ndata.bitmap[key / 64] & mask)) { - hkbd_put_key(sc, key | KEY_RELEASE); - } + /* set repeat time for last key */ + sc->sc_repeat_time = now + sc->sc_kbd.kb_delay1; + sc->sc_repeat_key = key; } /* synchronize old data with new data */ - sc->sc_odata = sc->sc_ndata; + memcpy(sc->sc_odata, sc->sc_ndata, bitstr_size(HKBD_NKEYCODE)); /* check if last key is still pressed */ if (sc->sc_repeat_key != 0) { @@ -679,7 +654,7 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) } /* clear temporary storage */ - memset(&sc->sc_ndata, 0, sizeof(sc->sc_ndata)); + memset(&sc->sc_ndata, 0, bitstr_size(HKBD_NKEYCODE)); /* clear modifiers */ modifiers = 0; @@ -696,16 +671,8 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) modifiers |= MOD_FN; } - for (i = 0; i != HKBD_NKEYCODE; i++) { - const uint64_t valid = sc->sc_loc_key_valid[i / 64]; - const uint64_t mask = 1ULL << (i % 64); - - if (mask == 1 && valid == 0) { - i += 63; - continue; /* skip empty areas */ - } else if (~valid & mask) { - continue; /* location is not valid */ - } else if (id != sc->sc_id_loc_key[i]) { + bit_foreach(sc->sc_loc_key_valid, HKBD_NKEYCODE, i) { + if (id != sc->sc_id_loc_key[i]) { continue; /* invalid HID ID */ } else if (i == 0) { struct hid_location tmp_loc = sc->sc_loc_key[0]; @@ -719,7 +686,8 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) tmp_loc.pos += tmp_loc.size; if (key == KEY_ERROR) { DPRINTF("KEY_ERROR\n"); - sc->sc_ndata = sc->sc_odata; + memcpy(sc->sc_ndata, sc->sc_odata, + bitstr_size(HKBD_NKEYCODE)); return; /* ignore */ } if (modifiers & MOD_FN) @@ -729,7 +697,7 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) if (key == KEY_NONE || key >= HKBD_NKEYCODE) continue; /* set key in bitmap */ - sc->sc_ndata.bitmap[key / 64] |= 1ULL << (key % 64); + bit_set(sc->sc_ndata, key); } } else if (hid_get_data(buf, len, &sc->sc_loc_key[i])) { uint32_t key = i; @@ -741,18 +709,13 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) if (key == KEY_NONE || key == KEY_ERROR || key >= HKBD_NKEYCODE) continue; /* set key in bitmap */ - sc->sc_ndata.bitmap[key / 64] |= 1ULL << (key % 64); + bit_set(sc->sc_ndata, key); } } #ifdef HID_DEBUG DPRINTF("modifiers = 0x%04x\n", modifiers); - for (i = 0; i != HKBD_NKEYCODE; i++) { - const uint64_t valid = sc->sc_ndata.bitmap[i / 64]; - const uint64_t mask = 1ULL << (i % 64); - - if (valid & mask) - DPRINTF("Key 0x%02x pressed\n", i); - } + bit_foreach(sc->sc_ndata, HKBD_NKEYCODE, i) + DPRINTF("Key 0x%02x pressed\n", i); #endif hkbd_interrupt(sc); } @@ -795,7 +758,7 @@ hkbd_parse_hid(struct hkbd_softc *sc, const uint8_t *ptr, uint32_t len, sc->sc_flags &= ~HKBD_FLAG_HID_MASK; /* reset detected keys */ - memset(sc->sc_loc_key_valid, 0, sizeof(sc->sc_loc_key_valid)); + memset(sc->sc_loc_key_valid, 0, bitstr_size(HKBD_NKEYCODE)); /* check if there is an ID byte */ sc->sc_kbd_size = hid_report_size_max(ptr, len, @@ -828,7 +791,7 @@ hkbd_parse_hid(struct hkbd_softc *sc, const uint8_t *ptr, uint32_t len, if (flags & HIO_VARIABLE) { DPRINTFN(1, "Ignoring keyboard event control\n"); } else { - sc->sc_loc_key_valid[0] |= 1; + bit_set(sc->sc_loc_key_valid, 0); DPRINTFN(1, "Found keyboard event array\n"); } } @@ -840,8 +803,7 @@ hkbd_parse_hid(struct hkbd_softc *sc, const uint8_t *ptr, uint32_t len, hid_input, tlc_index, 0, &sc->sc_loc_key[key], &flags, &sc->sc_id_loc_key[key], NULL)) { if (flags & HIO_VARIABLE) { - sc->sc_loc_key_valid[key / 64] |= - 1ULL << (key % 64); + bit_set(sc->sc_loc_key_valid, key); DPRINTFN(1, "Found key 0x%02x\n", key); } } @@ -1057,7 +1019,7 @@ hkbd_detach(device_t dev) hidbus_intr_stop(dev); /* release all leftover keys, if any */ - memset(&sc->sc_ndata, 0, sizeof(sc->sc_ndata)); + memset(&sc->sc_ndata, 0, bitstr_size(HKBD_NKEYCODE)); /* process releasing of all keys */ HKBD_LOCK(sc); @@ -1305,11 +1267,11 @@ hkbd_read(keyboard_t *kbd, int wait) ++(kbd->kb_count); #ifdef HKBD_EMULATE_ATSCANCODE - keycode = hkbd_atkeycode(usbcode, sc->sc_ndata.bitmap); + keycode = hkbd_atkeycode(usbcode, sc->sc_ndata); if (keycode == NN) { return -1; } - return (hkbd_key2scan(sc, keycode, sc->sc_ndata.bitmap, + return (hkbd_key2scan(sc, keycode, sc->sc_ndata, (usbcode & KEY_RELEASE))); #else /* !HKBD_EMULATE_ATSCANCODE */ return (usbcode); @@ -1375,13 +1337,13 @@ next_code: #ifdef HKBD_EMULATE_ATSCANCODE /* USB key index -> key code -> AT scan code */ - keycode = hkbd_atkeycode(usbcode, sc->sc_ndata.bitmap); + keycode = hkbd_atkeycode(usbcode, sc->sc_ndata); if (keycode == NN) { return (NOKEY); } /* return an AT scan code for the K_RAW mode */ if (sc->sc_mode == K_RAW) { - return (hkbd_key2scan(sc, keycode, sc->sc_ndata.bitmap, + return (hkbd_key2scan(sc, keycode, sc->sc_ndata, (usbcode & KEY_RELEASE))); } #else /* !HKBD_EMULATE_ATSCANCODE */ @@ -1720,8 +1682,8 @@ hkbd_clear_state(keyboard_t *kbd) sc->sc_buffered_char[0] = 0; sc->sc_buffered_char[1] = 0; #endif - memset(&sc->sc_ndata, 0, sizeof(sc->sc_ndata)); - memset(&sc->sc_odata, 0, sizeof(sc->sc_odata)); + memset(&sc->sc_ndata, 0, bitstr_size(HKBD_NKEYCODE)); + memset(&sc->sc_odata, 0, bitstr_size(HKBD_NKEYCODE)); sc->sc_repeat_time = 0; sc->sc_repeat_key = 0; } @@ -1865,7 +1827,7 @@ hkbd_set_typematic(keyboard_t *kbd, int code) #ifdef HKBD_EMULATE_ATSCANCODE static uint32_t -hkbd_atkeycode(int usbcode, const uint64_t *bitmap) +hkbd_atkeycode(int usbcode, const bitstr_t *bitmap) { uint32_t keycode; @@ -1892,7 +1854,7 @@ hkbd_atkeycode(int usbcode, const uint64_t *bitmap) } static int -hkbd_key2scan(struct hkbd_softc *sc, int code, const uint64_t *bitmap, int up) +hkbd_key2scan(struct hkbd_softc *sc, int code, const bitstr_t *bitmap, int up) { static const int scan[] = { /* 89 */ From owner-dev-commits-src-all@freebsd.org Thu Sep 23 01:04:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F273D6762F4; Thu, 23 Sep 2021 01:03:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFH3z5JyTz3wLv; Thu, 23 Sep 2021 01:03:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 825A7218D1; Thu, 23 Sep 2021 01:03:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18N13xk1073915; Thu, 23 Sep 2021 01:03:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N13xOp073914; Thu, 23 Sep 2021 01:03:59 GMT (envelope-from git) Date: Thu, 23 Sep 2021 01:03:59 GMT Message-Id: <202109230103.18N13xOp073914@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 510b003ff412 - stable/13 - hkbd(4): Fix key repeats on multireport keyboards MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 510b003ff41291599cab3e45d463f3a3bf77d6eb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 01:04:00 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=510b003ff41291599cab3e45d463f3a3bf77d6eb commit 510b003ff41291599cab3e45d463f3a3bf77d6eb Author: Vladimir Kondratyev AuthorDate: 2021-09-09 21:40:13 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-23 00:58:58 +0000 hkbd(4): Fix key repeats on multireport keyboards Currently hkbd counts all key states to be "Up" at the start of interrupt callback. That results in generation of "Key Up" event for each key that has been downed before but is not listed in current report while is still downed. Fix that with clearing of temporary key data storage bits only for keys contained in processed report. Reported by: Greg V Obtained from: sysutils/iichid (cherry picked from commit 598f0580f6822e2492231d055f49465a5b55d270) --- sys/dev/hid/hkbd.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c index 65e8b9446e9d..bfd8e12df746 100644 --- a/sys/dev/hid/hkbd.c +++ b/sys/dev/hid/hkbd.c @@ -143,8 +143,12 @@ struct hkbd_softc { struct mtx sc_mtx; struct task sc_task; struct callout sc_callout; + /* All reported keycodes */ bitstr_t bit_decl(sc_ndata, HKBD_NKEYCODE); bitstr_t bit_decl(sc_odata, HKBD_NKEYCODE); + /* Keycodes reported in array fields only */ + bitstr_t bit_decl(sc_ndata0, HKBD_NKEYCODE); + bitstr_t bit_decl(sc_odata0, HKBD_NKEYCODE); struct thread *sc_poll_thread; #ifdef EVDEV_SUPPORT @@ -520,6 +524,7 @@ hkbd_interrupt(struct hkbd_softc *sc) } /* synchronize old data with new data */ + memcpy(sc->sc_odata0, sc->sc_ndata0, bitstr_size(HKBD_NKEYCODE)); memcpy(sc->sc_odata, sc->sc_ndata, bitstr_size(HKBD_NKEYCODE)); /* check if last key is still pressed */ @@ -654,7 +659,14 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) } /* clear temporary storage */ - memset(&sc->sc_ndata, 0, bitstr_size(HKBD_NKEYCODE)); + if (bit_test(sc->sc_loc_key_valid, 0) && id == sc->sc_id_loc_key[0]) { + bit_foreach(sc->sc_ndata0, HKBD_NKEYCODE, i) + bit_clear(sc->sc_ndata, i); + memset(&sc->sc_ndata0, 0, bitstr_size(HKBD_NKEYCODE)); + } + bit_foreach(sc->sc_ndata, HKBD_NKEYCODE, i) + if (id == sc->sc_id_loc_key[i]) + bit_clear(sc->sc_ndata, i); /* clear modifiers */ modifiers = 0; @@ -686,6 +698,8 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) tmp_loc.pos += tmp_loc.size; if (key == KEY_ERROR) { DPRINTF("KEY_ERROR\n"); + memcpy(sc->sc_ndata0, sc->sc_odata0, + bitstr_size(HKBD_NKEYCODE)); memcpy(sc->sc_ndata, sc->sc_odata, bitstr_size(HKBD_NKEYCODE)); return; /* ignore */ @@ -698,6 +712,7 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) continue; /* set key in bitmap */ bit_set(sc->sc_ndata, key); + bit_set(sc->sc_ndata0, key); } } else if (hid_get_data(buf, len, &sc->sc_loc_key[i])) { uint32_t key = i; @@ -1684,6 +1699,8 @@ hkbd_clear_state(keyboard_t *kbd) #endif memset(&sc->sc_ndata, 0, bitstr_size(HKBD_NKEYCODE)); memset(&sc->sc_odata, 0, bitstr_size(HKBD_NKEYCODE)); + memset(&sc->sc_ndata0, 0, bitstr_size(HKBD_NKEYCODE)); + memset(&sc->sc_odata0, 0, bitstr_size(HKBD_NKEYCODE)); sc->sc_repeat_time = 0; sc->sc_repeat_key = 0; } From owner-dev-commits-src-all@freebsd.org Thu Sep 23 02:50:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A1DF6775D6; Thu, 23 Sep 2021 02:50: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 4HFKQJ088Mz4b7d; Thu, 23 Sep 2021 02:50: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 D7FEB23045; Thu, 23 Sep 2021 02:49: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 18N2nxvp006713; Thu, 23 Sep 2021 02:49:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N2nxtA006712; Thu, 23 Sep 2021 02:49:59 GMT (envelope-from git) Date: Thu, 23 Sep 2021 02:49:59 GMT Message-Id: <202109230249.18N2nxtA006712@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 88741a40c8fb - main - check-links.sh: treat PIE executable as elf files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 88741a40c8fb515489b3ef61eba221fd7c8bef1b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 02:50:00 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=88741a40c8fb515489b3ef61eba221fd7c8bef1b commit 88741a40c8fb515489b3ef61eba221fd7c8bef1b Author: Baptiste Daroussin AuthorDate: 2021-09-23 02:48:50 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-23 02:49:57 +0000 check-links.sh: treat PIE executable as elf files --- tools/build/check-links.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build/check-links.sh b/tools/build/check-links.sh index 06aa8d31d28e..7dc96fa5f082 100755 --- a/tools/build/check-links.sh +++ b/tools/build/check-links.sh @@ -49,7 +49,7 @@ fi mime=$(file -L --mime-type $1) isbin=0 case $mime in -*application/x-executable) isbin=1 ;; +*application/x-executable|*application/x-pie-executable) isbin=1 ;; *application/x-sharedlib);; *) echo "Not an elf file" >&2 ; exit 1;; esac From owner-dev-commits-src-all@freebsd.org Thu Sep 23 04:14:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2ADDE678736; Thu, 23 Sep 2021 04:14: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 4HFMHg0TWPz4kVB; Thu, 23 Sep 2021 04:14: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 E45F524167; Thu, 23 Sep 2021 04:14: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 18N4EMos027401; Thu, 23 Sep 2021 04:14:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N4EMe4027400; Thu, 23 Sep 2021 04:14:22 GMT (envelope-from git) Date: Thu, 23 Sep 2021 04:14:22 GMT Message-Id: <202109230414.18N4EMe4027400@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 319b15000300 - main - pmc: intr pmc.soft(3) update MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 319b150003001fa09cb4a97452c57340ce42db35 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 04:14:23 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=319b150003001fa09cb4a97452c57340ce42db35 commit 319b150003001fa09cb4a97452c57340ce42db35 Author: Wojciech Macek AuthorDate: 2021-09-22 07:52:42 +0000 Commit: Wojciech Macek CommitDate: 2021-09-23 04:13:58 +0000 pmc: intr pmc.soft(3) update Obtained from: Semihalf Sponsored by: Stormshield Reviewed by: mhorne Differential revision: https://reviews.freebsd.org/D32055 --- lib/libpmc/pmc.soft.3 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/libpmc/pmc.soft.3 b/lib/libpmc/pmc.soft.3 index a3cd4f01e607..68dd4f36b0d0 100644 --- a/lib/libpmc/pmc.soft.3 +++ b/lib/libpmc/pmc.soft.3 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 26, 2013 +.Dd September 23, 2021 .Dt PMC.SOFT 3 .Os .Sh NAME @@ -63,6 +63,18 @@ Hard clock ticks. Stat clock ticks. .It Li CLOCK.PROF Profiling clock ticks. +.It Li INTR.ALL +Interrupt filter executed +.It Li INTR.FILTER +Interrupt filter returned FILTER_HANDLED. +.It Li INTR.ITHREAD +Interrupt filter returned FILTER_SCHEDULE_ITHREAD. +.It Li INTR.SCHEDULE +Ithread scheduled. +.It Li INTR.STRAY +Interrupt filter returned FILTER_STRAY. +.It Li INTR.WAITING +Ithread not scheduled, already active. .It Li LOCK.FAILED Lock acquisition failed. .It Li PAGE_FAULT.ALL From owner-dev-commits-src-all@freebsd.org Thu Sep 23 05:17:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23D42679422; Thu, 23 Sep 2021 05:17:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFNhV0VC1z4rFT; Thu, 23 Sep 2021 05:17:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4A21251E9; Thu, 23 Sep 2021 05:17: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 18N5HTuk006760; Thu, 23 Sep 2021 05:17:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N5HTH7006759; Thu, 23 Sep 2021 05:17:29 GMT (envelope-from git) Date: Thu, 23 Sep 2021 05:17:29 GMT Message-Id: <202109230517.18N5HTH7006759@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 7bc13692a2d6 - main - hwpmc: fix performance issues MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7bc13692a2d6b33b4e80bb9ad70d5eede6b148af Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 05:17:30 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=7bc13692a2d6b33b4e80bb9ad70d5eede6b148af commit 7bc13692a2d6b33b4e80bb9ad70d5eede6b148af Author: Wojciech Macek AuthorDate: 2021-09-20 11:08:32 +0000 Commit: Wojciech Macek CommitDate: 2021-09-23 05:15:42 +0000 hwpmc: fix performance issues Differential revision: https://reviews.freebsd.org/D32025 Avoid using atomics as it_wait is guarded by td_lock. Report threshold calculation is done only if at least one PMC hook is installed Fixes: * avoid unnecessary branching (if frame != null ...) by having PMC_HOOK_INSTALLED_ANY condition on the top of them, which should hint the core not to execute speculatively anything which us underneath; * access intr_hwpmc_waiting_report_threshold cacheline only if at least one hook is loaded; --- sys/kern/kern_intr.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index 19401877dfbd..4e6e575a9fc9 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -107,6 +107,7 @@ static int intr_hwpmc_waiting_report_threshold = 1; SYSCTL_INT(_hw, OID_AUTO, intr_hwpmc_waiting_report_threshold, CTLFLAG_RWTUN, &intr_hwpmc_waiting_report_threshold, 1, "Threshold for reporting number of events in a workq"); +#define PMC_HOOK_INSTALLED_ANY() __predict_false(pmc_hook != NULL) #endif static TAILQ_HEAD(, intr_event) event_list = TAILQ_HEAD_INITIALIZER(event_list); @@ -131,6 +132,14 @@ PMC_SOFT_DEFINE( , , intr, filter); PMC_SOFT_DEFINE( , , intr, stray); PMC_SOFT_DEFINE( , , intr, schedule); PMC_SOFT_DEFINE( , , intr, waiting); + +#define PMC_SOFT_CALL_INTR_HLPR(event, frame) \ +do { \ + if (frame != NULL) \ + PMC_SOFT_CALL_TF( , , intr, event, frame); \ + else \ + PMC_SOFT_CALL( , , intr, event); \ +} while (0) #endif /* Map an interrupt type to an ithread priority. */ @@ -1005,11 +1014,9 @@ intr_event_schedule_thread(struct intr_event *ie, struct trapframe *frame) thread_lock(td); if (TD_AWAITING_INTR(td)) { #ifdef HWPMC_HOOKS - atomic_set_int(&it->it_waiting, 0); - if (frame != NULL) - PMC_SOFT_CALL_TF( , , intr, schedule, frame); - else - PMC_SOFT_CALL( , , intr, schedule); + it->it_waiting = 0; + if (PMC_HOOK_INSTALLED_ANY()) + PMC_SOFT_CALL_INTR_HLPR(schedule, frame); #endif CTR3(KTR_INTR, "%s: schedule pid %d (%s)", __func__, td->td_proc->p_pid, td->td_name); @@ -1017,14 +1024,10 @@ intr_event_schedule_thread(struct intr_event *ie, struct trapframe *frame) sched_add(td, SRQ_INTR); } else { #ifdef HWPMC_HOOKS - atomic_add_int(&it->it_waiting, 1); - - if (atomic_load_int(&it->it_waiting) >= intr_hwpmc_waiting_report_threshold) { - if (frame != NULL) - PMC_SOFT_CALL_TF( , , intr, waiting, frame); - else - PMC_SOFT_CALL( , , intr, waiting); - } + it->it_waiting++; + if (PMC_HOOK_INSTALLED_ANY() && + (it->it_waiting >= intr_hwpmc_waiting_report_threshold)) + PMC_SOFT_CALL_INTR_HLPR(waiting, frame); #endif CTR5(KTR_INTR, "%s: pid %d (%s): it_need %d, state %d", __func__, td->td_proc->p_pid, td->td_name, it->it_need, TD_GET_STATE(td)); From owner-dev-commits-src-all@freebsd.org Thu Sep 23 06:03:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 167A4679768; Thu, 23 Sep 2021 06:03: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 4HFPjc066Fz4v44; Thu, 23 Sep 2021 06:03: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 D7B1A25D17; Thu, 23 Sep 2021 06:03: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 18N63VV8073466; Thu, 23 Sep 2021 06:03:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N63VTu073465; Thu, 23 Sep 2021 06:03:31 GMT (envelope-from git) Date: Thu, 23 Sep 2021 06:03:31 GMT Message-Id: <202109230603.18N63VTu073465@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 6895cade9421 - main - kern: random: drop read_rate and associated functionality MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6895cade9421238abf541f24fb9327ebd19e94ff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 06:03:32 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=6895cade9421238abf541f24fb9327ebd19e94ff commit 6895cade9421238abf541f24fb9327ebd19e94ff Author: Kyle Evans AuthorDate: 2021-09-20 04:59:09 +0000 Commit: Kyle Evans CommitDate: 2021-09-23 06:03:01 +0000 kern: random: drop read_rate and associated functionality Refer to discussion in PR 230808 for a less incomplete discussion, but the gist of this change is that we currently collect orders of magnitude more entropy than we need. The excess comes from bytes being read out of /dev/*random. The default rate at which we collect entropy without the read_rate increase is already more than we need to recover from a compromise of an internal state. Reviewed by: #csprng (cem, delphij, markm) Differential Revision: https://reviews.freebsd.org/D32021 --- sys/dev/random/random_harvestq.c | 18 ++---------------- sys/dev/random/random_harvestq.h | 2 -- sys/dev/random/randomdev.c | 2 -- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c index 6838cf23fb2e..74a75aa20e3f 100644 --- a/sys/dev/random/random_harvestq.c +++ b/sys/dev/random/random_harvestq.c @@ -75,8 +75,6 @@ __FBSDID("$FreeBSD$"); static void random_kthread(void); static void random_sources_feed(void); -static u_int read_rate; - /* * Random must initialize much earlier than epoch, but we can initialize the * epoch code before SMP starts. Prior to SMP, we can safely bypass @@ -231,7 +229,7 @@ random_sources_feed(void) uint32_t entropy[HARVESTSIZE]; struct epoch_tracker et; struct random_sources *rrs; - u_int i, n, local_read_rate; + u_int i, n; bool rse_warm; rse_warm = epoch_inited; @@ -240,15 +238,10 @@ random_sources_feed(void) * Step over all of live entropy sources, and feed their output * to the system-wide RNG. */ - local_read_rate = atomic_readandclear_32(&read_rate); - /* Perform at least one read per round */ - local_read_rate = MAX(local_read_rate, 1); - /* But not exceeding RANDOM_KEYSIZE_WORDS */ - local_read_rate = MIN(local_read_rate, RANDOM_KEYSIZE_WORDS); if (rse_warm) epoch_enter_preempt(rs_epoch, &et); CK_LIST_FOREACH(rrs, &source_list, rrs_entries) { - for (i = 0; i < p_random_alg_context->ra_poolcount*local_read_rate; i++) { + for (i = 0; i < p_random_alg_context->ra_poolcount; i++) { n = rrs->rrs_source->rs_read(entropy, sizeof(entropy)); KASSERT((n <= sizeof(entropy)), ("%s: rs_read returned too much data (%u > %zu)", __func__, n, sizeof(entropy))); /* @@ -272,13 +265,6 @@ random_sources_feed(void) explicit_bzero(entropy, sizeof(entropy)); } -void -read_rate_increment(u_int chunk) -{ - - atomic_add_32(&read_rate, chunk); -} - /* ARGSUSED */ static int random_check_uint_harvestmask(SYSCTL_HANDLER_ARGS) diff --git a/sys/dev/random/random_harvestq.h b/sys/dev/random/random_harvestq.h index c7005cde4f22..a6a69889412a 100644 --- a/sys/dev/random/random_harvestq.h +++ b/sys/dev/random/random_harvestq.h @@ -42,8 +42,6 @@ struct harvest_event { uint8_t he_source; /* origin of the entropy */ }; -void read_rate_increment(u_int); - #define RANDOM_HARVEST_INIT_LOCK(x) mtx_init(&harvest_context.hc_mtx, "entropy harvest mutex", NULL, MTX_SPIN) #define RANDOM_HARVEST_LOCK(x) mtx_lock_spin(&harvest_context.hc_mtx) #define RANDOM_HARVEST_UNLOCK(x) mtx_unlock_spin(&harvest_context.hc_mtx) diff --git a/sys/dev/random/randomdev.c b/sys/dev/random/randomdev.c index 114246415aa6..4b032cd3feb9 100644 --- a/sys/dev/random/randomdev.c +++ b/sys/dev/random/randomdev.c @@ -187,7 +187,6 @@ int if (error != 0) return (error); - read_rate_increment(howmany(uio->uio_resid + 1, sizeof(uint32_t))); total_read = 0; /* Easy to deal with the trivial 0 byte case. */ @@ -286,7 +285,6 @@ void (void)randomdev_wait_until_seeded(SEEDWAIT_UNINTERRUPTIBLE); } - read_rate_increment(roundup2(len, sizeof(uint32_t))); p_random_alg_context->ra_read(random_buf, len); } From owner-dev-commits-src-all@freebsd.org Thu Sep 23 06:03:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D8D867A062; Thu, 23 Sep 2021 06:03: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 4HFPjd1FDWz4tn7; Thu, 23 Sep 2021 06:03: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 0C3DD25C4F; Thu, 23 Sep 2021 06:03: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 18N63Wxn073490; Thu, 23 Sep 2021 06:03:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N63WMY073489; Thu, 23 Sep 2021 06:03:32 GMT (envelope-from git) Date: Thu, 23 Sep 2021 06:03:32 GMT Message-Id: <202109230603.18N63WMY073489@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 5e79bba562bc - main - kern: random: collect ~16x less from fast-entropy sources MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5e79bba562bc303eed669dbd0d391b6c6a9c289b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 06:03:33 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=5e79bba562bc303eed669dbd0d391b6c6a9c289b commit 5e79bba562bc303eed669dbd0d391b6c6a9c289b Author: Kyle Evans AuthorDate: 2021-09-20 05:46:21 +0000 Commit: Kyle Evans CommitDate: 2021-09-23 06:03:02 +0000 kern: random: collect ~16x less from fast-entropy sources Previously, we were collecting at a base rate of: 64 bits x 32 pools x 10 Hz = 2.5 kB/s This change drops it to closer to 64-ish bits per pool per second, to work a little better with entropy providers in virtualized environments without compromising the security goals of Fortuna. Reviewed by: #csprng (cem, delphij, markm) Differential Revision: https://reviews.freebsd.org/D32021 --- sys/dev/random/random_harvestq.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c index 74a75aa20e3f..46c069126949 100644 --- a/sys/dev/random/random_harvestq.c +++ b/sys/dev/random/random_harvestq.c @@ -72,6 +72,13 @@ __FBSDID("$FreeBSD$"); #define _RANDOM_HARVEST_UMA_OFF (1u << RANDOM_UMA) #endif +/* + * Note that random_sources_feed() will also use this to try and split up + * entropy into a subset of pools per iteration with the goal of feeding + * HARVESTSIZE into every pool at least once per second. + */ +#define RANDOM_KTHREAD_HZ 10 + static void random_kthread(void); static void random_sources_feed(void); @@ -199,7 +206,8 @@ random_kthread(void) } } /* XXX: FIX!! This is a *great* place to pass hardware/live entropy to random(9) */ - tsleep_sbt(&harvest_context.hc_kthread_proc, 0, "-", SBT_1S/10, 0, C_PREL(1)); + tsleep_sbt(&harvest_context.hc_kthread_proc, 0, "-", + SBT_1S/RANDOM_KTHREAD_HZ, 0, C_PREL(1)); } random_kthread_control = -1; wakeup(&harvest_context.hc_kthread_proc); @@ -229,11 +237,23 @@ random_sources_feed(void) uint32_t entropy[HARVESTSIZE]; struct epoch_tracker et; struct random_sources *rrs; - u_int i, n; + u_int i, n, npools; bool rse_warm; rse_warm = epoch_inited; + /* + * Evenly-ish distribute pool population across the second based on how + * frequently random_kthread iterates. + * + * For Fortuna, the math currently works out as such: + * + * 64 bits * 4 pools = 256 bits per iteration + * 256 bits * 10 Hz = 2560 bits per second, 320 B/s + * + */ + npools = howmany(p_random_alg_context->ra_poolcount, RANDOM_KTHREAD_HZ); + /* * Step over all of live entropy sources, and feed their output * to the system-wide RNG. @@ -241,7 +261,7 @@ random_sources_feed(void) if (rse_warm) epoch_enter_preempt(rs_epoch, &et); CK_LIST_FOREACH(rrs, &source_list, rrs_entries) { - for (i = 0; i < p_random_alg_context->ra_poolcount; i++) { + for (i = 0; i < npools; i++) { n = rrs->rrs_source->rs_read(entropy, sizeof(entropy)); KASSERT((n <= sizeof(entropy)), ("%s: rs_read returned too much data (%u > %zu)", __func__, n, sizeof(entropy))); /* From owner-dev-commits-src-all@freebsd.org Thu Sep 23 07:50:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B824467ADB3; Thu, 23 Sep 2021 07:50: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 4HFS4w2rsSz3M6l; Thu, 23 Sep 2021 07:50:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CA082718E; Thu, 23 Sep 2021 07:50: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 18N7oO6P015513; Thu, 23 Sep 2021 07:50:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N7oODN015512; Thu, 23 Sep 2021 07:50:24 GMT (envelope-from git) Date: Thu, 23 Sep 2021 07:50:24 GMT Message-Id: <202109230750.18N7oODN015512@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 90f6610b1975 - main - UPDATING: Fix spelling. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 90f6610b197550d841bcc13b7c2a90be627443b5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 07:50:24 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=90f6610b197550d841bcc13b7c2a90be627443b5 commit 90f6610b197550d841bcc13b7c2a90be627443b5 Author: Hans Petter Selasky AuthorDate: 2021-09-23 07:49:01 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-23 07:49:45 +0000 UPDATING: Fix spelling. Submitted by: gljennjohn@gmail.com Differential Revision: https://reviews.freebsd.org/D31636 Sponsored by: NVIDIA Networking --- UPDATING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index d6eae6c23ede..4b41612dfbc3 100644 --- a/UPDATING +++ b/UPDATING @@ -29,7 +29,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: 202010922: As of commit 903873ce1560, the mixer(8) utility has got a slightly - new syntax. Please confirm to the mixer(8) manual page for more + new syntax. Please refer to the mixer(8) manual page for more information. 20210911: From owner-dev-commits-src-all@freebsd.org Thu Sep 23 08:43:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E0CC67BE11; Thu, 23 Sep 2021 08:43: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 4HFTG82Rrkz3jww; Thu, 23 Sep 2021 08:43: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 34AFC27B66; Thu, 23 Sep 2021 08:43: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 18N8hSAt085867; Thu, 23 Sep 2021 08:43:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N8hS2w085866; Thu, 23 Sep 2021 08:43:28 GMT (envelope-from git) Date: Thu, 23 Sep 2021 08:43:28 GMT Message-Id: <202109230843.18N8hS2w085866@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: d2c233176f44 - main - sh: Add -o verify to use O_VERIFY when sourcing scripts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d2c233176f44944ef3ed941a60010839340c06a7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 08:43:28 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=d2c233176f44944ef3ed941a60010839340c06a7 commit d2c233176f44944ef3ed941a60010839340c06a7 Author: Stephane Rochoy AuthorDate: 2021-09-23 08:40:59 +0000 Commit: Wojciech Macek CommitDate: 2021-09-23 08:43:09 +0000 sh: Add -o verify to use O_VERIFY when sourcing scripts Add -o verify to sh to make it use O_VERIFY when sourcing scripts and reading profiles. Useful in conjunction with mac_veriexec to help protect at least some parts of the boot sequence, e.g., /etc/rc*. Differential revision: https://reviews.freebsd.org/D30464 Reviewed by: jilles, sjg Obtained from: Stormshield --- bin/sh/exec.c | 2 +- bin/sh/histedit.c | 2 +- bin/sh/input.c | 12 ++++++++++-- bin/sh/input.h | 2 +- bin/sh/main.c | 12 ++++++++---- bin/sh/main.h | 2 +- bin/sh/options.c | 2 +- bin/sh/options.h | 4 +++- bin/sh/sh.1 | 5 +++++ 9 files changed, 31 insertions(+), 12 deletions(-) diff --git a/bin/sh/exec.c b/bin/sh/exec.c index e3779b097e1d..43095a252a35 100644 --- a/bin/sh/exec.c +++ b/bin/sh/exec.c @@ -418,7 +418,7 @@ find_command(const char *name, struct cmdentry *entry, int act, if (!S_ISREG(statb.st_mode)) continue; if (opt) { /* this is a %func directory */ - readcmdfile(fullname); + readcmdfile(fullname, -1 /* verify */); if ((cmdp = cmdlookup(name, 0)) == NULL || cmdp->cmdtype != CMDFUNCTION) error("%s not defined in %s", name, fullname); stunalloc(fullname); diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 96511b87b451..3c113333f4c8 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -447,7 +447,7 @@ histcmd(int argc, char **argv __unused) editcmd = stalloc(strlen(editor) + strlen(editfile) + 2); sprintf(editcmd, "%s %s", editor, editfile); evalstring(editcmd, 0); /* XXX - should use no JC command */ - readcmdfile(editfile); /* XXX - should read back - quick tst */ + readcmdfile(editfile, 0 /* verify */); /* XXX - should read back - quick tst */ unlink(editfile); } diff --git a/bin/sh/input.c b/bin/sh/input.c index a8d048fc4890..3933287524a4 100644 --- a/bin/sh/input.c +++ b/bin/sh/input.c @@ -352,17 +352,25 @@ popstring(void) /* * Set the input to take input from a file. If push is set, push the * old input onto the stack first. + * About verify: + * -1: Obey verifyflag + * 0: Do not verify + * 1: Do verify */ void -setinputfile(const char *fname, int push) +setinputfile(const char *fname, int push, int verify) { int e; int fd; int fd2; + int oflags = O_RDONLY | O_CLOEXEC; + + if (verify == 1 || (verify == -1 && verifyflag)) + oflags |= O_VERIFY; INTOFF; - if ((fd = open(fname, O_RDONLY | O_CLOEXEC)) < 0) { + if ((fd = open(fname, oflags)) < 0) { e = errno; errorwithstatus(e == ENOENT || e == ENOTDIR ? 127 : 126, "cannot open %s: %s", fname, strerror(e)); diff --git a/bin/sh/input.h b/bin/sh/input.h index 71046b9731c3..edb622b6ec2e 100644 --- a/bin/sh/input.h +++ b/bin/sh/input.h @@ -53,7 +53,7 @@ int preadbuffer(void); int preadateof(void); void pungetc(void); void pushstring(const char *, int, struct alias *); -void setinputfile(const char *, int); +void setinputfile(const char *, int, int); void setinputfd(int, int); void setinputstring(const char *, int); void popfile(void); diff --git a/bin/sh/main.c b/bin/sh/main.c index b0a5fac6fd4e..bc87440807b2 100644 --- a/bin/sh/main.c +++ b/bin/sh/main.c @@ -253,12 +253,16 @@ read_profile(const char *name) { int fd; const char *expandedname; + int oflags = O_RDONLY | O_CLOEXEC; + + if (verifyflag) + oflags |= O_VERIFY; expandedname = expandstr(name); if (expandedname == NULL) return; INTOFF; - if ((fd = open(expandedname, O_RDONLY | O_CLOEXEC)) >= 0) + if ((fd = open(expandedname, oflags)) >= 0) setinputfd(fd, 1); INTON; if (fd < 0) @@ -274,9 +278,9 @@ read_profile(const char *name) */ void -readcmdfile(const char *name) +readcmdfile(const char *name, int verify) { - setinputfile(name, 1); + setinputfile(name, 1, verify); cmdloop(0); popfile(); } @@ -331,7 +335,7 @@ dotcmd(int argc, char **argv) filename = argc > 2 && strcmp(argv[1], "--") == 0 ? argv[2] : argv[1]; fullname = find_dot_file(filename); - setinputfile(fullname, 1); + setinputfile(fullname, 1, -1 /* verify */); commandname = fullname; cmdloop(0); popfile(); diff --git a/bin/sh/main.h b/bin/sh/main.h index ff0a1c61fa22..d12c7ab77fed 100644 --- a/bin/sh/main.h +++ b/bin/sh/main.h @@ -39,4 +39,4 @@ extern int rootpid; /* pid of main shell */ extern int rootshell; /* true if we aren't a child of the main shell */ extern struct jmploc main_handler; /* top level exception handler */ -void readcmdfile(const char *); +void readcmdfile(const char *, int); diff --git a/bin/sh/options.c b/bin/sh/options.c index 73d79ca9a74f..97171d32bff1 100644 --- a/bin/sh/options.c +++ b/bin/sh/options.c @@ -112,7 +112,7 @@ procargs(int argc, char **argv) arg0 = argv[0]; if (sflag == 0 && minusc == NULL) { scriptname = *argptr++; - setinputfile(scriptname, 0); + setinputfile(scriptname, 0, -1 /* verify */); commandname = arg0 = scriptname; } /* POSIX 1003.2: first arg after -c cmd is $0, remainder $1... */ diff --git a/bin/sh/options.h b/bin/sh/options.h index 500d4ad5a903..7c9c4513aa33 100644 --- a/bin/sh/options.h +++ b/bin/sh/options.h @@ -68,9 +68,10 @@ struct shparam { #define hflag optval[18] #define nologflag optval[19] #define pipefailflag optval[20] +#define verifyflag optval[21] #define NSHORTOPTS 19 -#define NOPTS 21 +#define NOPTS 22 extern char optval[NOPTS]; extern const char optletter[NSHORTOPTS]; @@ -99,6 +100,7 @@ static const unsigned char optname[] = "\010trackall" "\005nolog" "\010pipefail" + "\006verify" ; #endif diff --git a/bin/sh/sh.1 b/bin/sh/sh.1 index ca3faeff13af..c49230133f9f 100644 --- a/bin/sh/sh.1 +++ b/bin/sh/sh.1 @@ -355,6 +355,11 @@ if a command such as in the pipeline terminates with status 0 without reading its input completely. This option only has a long name. +.It Li verify +Set +.Dv O_VERIFY +when sourcing files or loading profiles. See also +.Xr mac_veriexec 4 . .El .Pp The From owner-dev-commits-src-all@freebsd.org Thu Sep 23 08:55:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 92D4167B77C; Thu, 23 Sep 2021 08:55:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFTWd3X07z3lsW; Thu, 23 Sep 2021 08:55: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 59EB728197; Thu, 23 Sep 2021 08:55: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 18N8t9NM099693; Thu, 23 Sep 2021 08:55:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N8t9k5099692; Thu, 23 Sep 2021 08:55:09 GMT (envelope-from git) Date: Thu, 23 Sep 2021 08:55:09 GMT Message-Id: <202109230855.18N8t9k5099692@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 492bf4fdad4d - main - veriexec: Fix veriexec -i's confusion between loaded and locked states MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 492bf4fdad4dbb96b82d88e12918e61042f71661 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 08:55:09 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=492bf4fdad4dbb96b82d88e12918e61042f71661 commit 492bf4fdad4dbb96b82d88e12918e61042f71661 Author: Stephane Rochoy AuthorDate: 2021-09-23 08:53:56 +0000 Commit: Wojciech Macek CommitDate: 2021-09-23 08:53:56 +0000 veriexec: Fix veriexec -i's confusion between loaded and locked states Calling veriexec -i locked return the state of loaded and vice-versa. Differential revision: https://reviews.freebsd.org/D30952 Reviewed by: sjg,imp Obtained from: Stromshield --- sbin/veriexec/veriexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/veriexec/veriexec.c b/sbin/veriexec/veriexec.c index c1facbd4a9fa..1eb7a9af7d6f 100644 --- a/sbin/veriexec/veriexec.c +++ b/sbin/veriexec/veriexec.c @@ -91,7 +91,7 @@ main(int argc, char *argv[]) ctl = VERIEXEC_STATE_ENFORCE; break; case 'l': /* loaded/locked */ - ctl = (strncmp(optarg, "lock", 4)) ? + ctl = (strncmp(optarg, "lock", 4) == 0) ? VERIEXEC_STATE_LOCKED : VERIEXEC_STATE_LOADED; break; From owner-dev-commits-src-all@freebsd.org Thu Sep 23 08:58:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D24E767BFA8; Thu, 23 Sep 2021 08:58: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 4HFTbC5SyRz3nNT; Thu, 23 Sep 2021 08:58: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 98FAC28198; Thu, 23 Sep 2021 08:58: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 18N8wF7g000120; Thu, 23 Sep 2021 08:58:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N8wFBQ000119; Thu, 23 Sep 2021 08:58:15 GMT (envelope-from git) Date: Thu, 23 Sep 2021 08:58:15 GMT Message-Id: <202109230858.18N8wFBQ000119@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 0b92a7fe47a5 - main - LACP: Do not wait response for marker messages not sent MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0b92a7fe47a5f7148a494514bfa530ddc6b496bf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 08:58:15 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=0b92a7fe47a5f7148a494514bfa530ddc6b496bf commit 0b92a7fe47a5f7148a494514bfa530ddc6b496bf Author: Arnaud Ysmal AuthorDate: 2021-09-23 08:57:11 +0000 Commit: Wojciech Macek CommitDate: 2021-09-23 08:57:11 +0000 LACP: Do not wait response for marker messages not sent The error returned when a marker message can not be emitted on a port is not handled. This cause the lacp to block all emissions until the timeout of 3 seconds is reached. To fix this issue, I just clear the LACP_PORT_MARK flag when the packet could not be emitted. Differential revision: https://reviews.freebsd.org/D30467 Obtained from: Stormshield --- sys/net/ieee8023ad_lacp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/net/ieee8023ad_lacp.c b/sys/net/ieee8023ad_lacp.c index bdc6113ce2a0..cf07890e051f 100644 --- a/sys/net/ieee8023ad_lacp.c +++ b/sys/net/ieee8023ad_lacp.c @@ -919,7 +919,8 @@ lacp_suppress_distributing(struct lacp_softc *lsc, struct lacp_aggregator *la) /* send a marker frame down each port to verify the queues are empty */ LIST_FOREACH(lp, &lsc->lsc_ports, lp_next) { lp->lp_flags |= LACP_PORT_MARK; - lacp_xmit_marker(lp); + if (lacp_xmit_marker(lp) != 0) + lp->lp_flags &= ~LACP_PORT_MARK; } /* set a timeout for the marker frames */ From owner-dev-commits-src-all@freebsd.org Thu Sep 23 12:17:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B86AD67E5F5; Thu, 23 Sep 2021 12:17: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 4HFZ1g4c4hz4YtQ; Thu, 23 Sep 2021 12:17: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 7D9F62AAB3; Thu, 23 Sep 2021 12:17: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 18NCHxbA065509; Thu, 23 Sep 2021 12:17:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18NCHxcI065508; Thu, 23 Sep 2021 12:17:59 GMT (envelope-from git) Date: Thu, 23 Sep 2021 12:17:59 GMT Message-Id: <202109231217.18NCHxcI065508@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 414499b3f911 - main - sctp: Cleanup stream schedulers. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 414499b3f911812d49a8c9af05102c0dc37ff878 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 12:17:59 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=414499b3f911812d49a8c9af05102c0dc37ff878 commit 414499b3f911812d49a8c9af05102c0dc37ff878 Author: Michael Tuexen AuthorDate: 2021-09-23 12:16:56 +0000 Commit: Michael Tuexen CommitDate: 2021-09-23 12:16:56 +0000 sctp: Cleanup stream schedulers. No functional change intended. MFC after: 1 week --- sys/netinet/sctp_output.c | 2 +- sys/netinet/sctp_ss_functions.c | 208 +++++++++++++++++----------------------- sys/netinet/sctp_structs.h | 21 ++-- sys/netinet/sctp_usrreq.c | 4 +- 4 files changed, 106 insertions(+), 129 deletions(-) diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 36339ac0f2b1..cad15be7a57b 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -12176,7 +12176,7 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb, * initializing the new stuff. */ SCTP_TCB_SEND_LOCK(stcb); - stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 0); + stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, false); for (i = 0; i < stcb->asoc.streamoutcnt; i++) { TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); /* FIX ME FIX ME */ diff --git a/sys/netinet/sctp_ss_functions.c b/sys/netinet/sctp_ss_functions.c index 9d877568bcf1..ff108eb0eb33 100644 --- a/sys/netinet/sctp_ss_functions.c +++ b/sys/netinet/sctp_ss_functions.c @@ -54,6 +54,7 @@ sctp_ss_default_init(struct sctp_tcb *stcb, struct sctp_association *asoc) uint16_t i; SCTP_TCB_SEND_LOCK_ASSERT(stcb); + asoc->ss_data.locked_on_sending = NULL; asoc->ss_data.last_out_stream = NULL; TAILQ_INIT(&asoc->ss_data.out.wheel); @@ -72,7 +73,7 @@ sctp_ss_default_init(struct sctp_tcb *stcb, struct sctp_association *asoc) static void sctp_ss_default_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values SCTP_UNUSED) + bool clear_values SCTP_UNUSED) { SCTP_TCB_SEND_LOCK_ASSERT(stcb); @@ -80,9 +81,8 @@ sctp_ss_default_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq; strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); - TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.rr.next_spoke); - strq->ss_params.rr.next_spoke.tqe_next = NULL; - strq->ss_params.rr.next_spoke.tqe_prev = NULL; + TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.rr.next_spoke); + strq->ss_params.scheduled = false; } asoc->ss_data.last_out_stream = NULL; return; @@ -99,8 +99,7 @@ sctp_ss_default_init_stream(struct sctp_tcb *stcb, struct sctp_stream_out *strq, stcb->asoc.ss_data.last_out_stream = strq; } } - strq->ss_params.rr.next_spoke.tqe_next = NULL; - strq->ss_params.rr.next_spoke.tqe_prev = NULL; + strq->ss_params.scheduled = false; return; } @@ -112,23 +111,18 @@ sctp_ss_default_add(struct sctp_tcb *stcb, struct sctp_association *asoc, SCTP_TCB_SEND_LOCK_ASSERT(stcb); /* Add to wheel if not already on it and stream queue not empty */ - if (!TAILQ_EMPTY(&strq->outqueue) && - (strq->ss_params.rr.next_spoke.tqe_next == NULL) && - (strq->ss_params.rr.next_spoke.tqe_prev == NULL)) { + if (!TAILQ_EMPTY(&strq->outqueue) && !strq->ss_params.scheduled) { TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, - strq, ss_params.rr.next_spoke); + strq, ss_params.ss.rr.next_spoke); + strq->ss_params.scheduled = true; } return; } -static int +static bool sctp_ss_default_is_empty(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_association *asoc) { - if (TAILQ_EMPTY(&asoc->ss_data.out.wheel)) { - return (1); - } else { - return (0); - } + return (TAILQ_EMPTY(&asoc->ss_data.out.wheel)); } static void @@ -142,13 +136,11 @@ sctp_ss_default_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, * Remove from wheel if stream queue is empty and actually is on the * wheel */ - if (TAILQ_EMPTY(&strq->outqueue) && - (strq->ss_params.rr.next_spoke.tqe_next != NULL || - strq->ss_params.rr.next_spoke.tqe_prev != NULL)) { + if (TAILQ_EMPTY(&strq->outqueue) && strq->ss_params.scheduled) { if (asoc->ss_data.last_out_stream == strq) { asoc->ss_data.last_out_stream = TAILQ_PREV(asoc->ss_data.last_out_stream, sctpwheel_listhead, - ss_params.rr.next_spoke); + ss_params.ss.rr.next_spoke); if (asoc->ss_data.last_out_stream == NULL) { asoc->ss_data.last_out_stream = TAILQ_LAST(&asoc->ss_data.out.wheel, sctpwheel_listhead); @@ -157,9 +149,8 @@ sctp_ss_default_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, asoc->ss_data.last_out_stream = NULL; } } - TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.rr.next_spoke); - strq->ss_params.rr.next_spoke.tqe_next = NULL; - strq->ss_params.rr.next_spoke.tqe_prev = NULL; + TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.rr.next_spoke); + strq->ss_params.scheduled = false; } return; } @@ -179,7 +170,7 @@ default_again: if (strqt == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } else { - strq = TAILQ_NEXT(strqt, ss_params.rr.next_spoke); + strq = TAILQ_NEXT(strqt, ss_params.ss.rr.next_spoke); if (strq == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } @@ -257,24 +248,24 @@ sctp_ss_default_set_value(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_associa return (-1); } -static int +static bool sctp_ss_default_is_user_msgs_incomplete(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_association *asoc) { struct sctp_stream_out *strq; struct sctp_stream_queue_pending *sp; if (asoc->stream_queue_cnt != 1) { - return (0); + return (false); } strq = asoc->ss_data.locked_on_sending; if (strq == NULL) { - return (0); + return (false); } sp = TAILQ_FIRST(&strq->outqueue); if (sp == NULL) { - return (0); + return (false); } - return (!sp->msg_is_complete); + return (sp->msg_is_complete == 0); } /* @@ -290,22 +281,21 @@ sctp_ss_rr_add(struct sctp_tcb *stcb, struct sctp_association *asoc, SCTP_TCB_SEND_LOCK_ASSERT(stcb); - if (!TAILQ_EMPTY(&strq->outqueue) && - (strq->ss_params.rr.next_spoke.tqe_next == NULL) && - (strq->ss_params.rr.next_spoke.tqe_prev == NULL)) { + if (!TAILQ_EMPTY(&strq->outqueue) && !strq->ss_params.scheduled) { if (TAILQ_EMPTY(&asoc->ss_data.out.wheel)) { - TAILQ_INSERT_HEAD(&asoc->ss_data.out.wheel, strq, ss_params.rr.next_spoke); + TAILQ_INSERT_HEAD(&asoc->ss_data.out.wheel, strq, ss_params.ss.rr.next_spoke); } else { strqt = TAILQ_FIRST(&asoc->ss_data.out.wheel); while (strqt != NULL && (strqt->sid < strq->sid)) { - strqt = TAILQ_NEXT(strqt, ss_params.rr.next_spoke); + strqt = TAILQ_NEXT(strqt, ss_params.ss.rr.next_spoke); } if (strqt != NULL) { - TAILQ_INSERT_BEFORE(strqt, strq, ss_params.rr.next_spoke); + TAILQ_INSERT_BEFORE(strqt, strq, ss_params.ss.rr.next_spoke); } else { - TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, strq, ss_params.rr.next_spoke); + TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, strq, ss_params.ss.rr.next_spoke); } } + strq->ss_params.scheduled = true; } return; } @@ -334,7 +324,7 @@ rrp_again: if (strqt == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } else { - strq = TAILQ_NEXT(strqt, ss_params.rr.next_spoke); + strq = TAILQ_NEXT(strqt, ss_params.ss.rr.next_spoke); if (strq == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } @@ -372,7 +362,7 @@ rrp_again: */ static void sctp_ss_prio_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values) + bool clear_values) { SCTP_TCB_SEND_LOCK_ASSERT(stcb); @@ -381,11 +371,10 @@ sctp_ss_prio_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); if (clear_values) { - strq->ss_params.prio.priority = 0; + strq->ss_params.ss.prio.priority = 0; } - TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.prio.next_spoke); - strq->ss_params.prio.next_spoke.tqe_next = NULL; - strq->ss_params.prio.next_spoke.tqe_prev = NULL; + TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.prio.next_spoke); + strq->ss_params.scheduled = false; } asoc->ss_data.last_out_stream = NULL; return; @@ -402,12 +391,11 @@ sctp_ss_prio_init_stream(struct sctp_tcb *stcb, struct sctp_stream_out *strq, st stcb->asoc.ss_data.last_out_stream = strq; } } - strq->ss_params.prio.next_spoke.tqe_next = NULL; - strq->ss_params.prio.next_spoke.tqe_prev = NULL; + strq->ss_params.scheduled = false; if (with_strq != NULL) { - strq->ss_params.prio.priority = with_strq->ss_params.prio.priority; + strq->ss_params.ss.prio.priority = with_strq->ss_params.ss.prio.priority; } else { - strq->ss_params.prio.priority = 0; + strq->ss_params.ss.prio.priority = 0; } return; } @@ -421,22 +409,21 @@ sctp_ss_prio_add(struct sctp_tcb *stcb, struct sctp_association *asoc, SCTP_TCB_SEND_LOCK_ASSERT(stcb); /* Add to wheel if not already on it and stream queue not empty */ - if (!TAILQ_EMPTY(&strq->outqueue) && - (strq->ss_params.prio.next_spoke.tqe_next == NULL) && - (strq->ss_params.prio.next_spoke.tqe_prev == NULL)) { + if (!TAILQ_EMPTY(&strq->outqueue) && !strq->ss_params.scheduled) { if (TAILQ_EMPTY(&asoc->ss_data.out.wheel)) { - TAILQ_INSERT_HEAD(&asoc->ss_data.out.wheel, strq, ss_params.prio.next_spoke); + TAILQ_INSERT_HEAD(&asoc->ss_data.out.wheel, strq, ss_params.ss.prio.next_spoke); } else { strqt = TAILQ_FIRST(&asoc->ss_data.out.wheel); - while (strqt != NULL && strqt->ss_params.prio.priority < strq->ss_params.prio.priority) { - strqt = TAILQ_NEXT(strqt, ss_params.prio.next_spoke); + while (strqt != NULL && strqt->ss_params.ss.prio.priority < strq->ss_params.ss.prio.priority) { + strqt = TAILQ_NEXT(strqt, ss_params.ss.prio.next_spoke); } if (strqt != NULL) { - TAILQ_INSERT_BEFORE(strqt, strq, ss_params.prio.next_spoke); + TAILQ_INSERT_BEFORE(strqt, strq, ss_params.ss.prio.next_spoke); } else { - TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, strq, ss_params.prio.next_spoke); + TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, strq, ss_params.ss.prio.next_spoke); } } + strq->ss_params.scheduled = true; } return; } @@ -451,12 +438,11 @@ sctp_ss_prio_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, * Remove from wheel if stream queue is empty and actually is on the * wheel */ - if (TAILQ_EMPTY(&strq->outqueue) && - (strq->ss_params.prio.next_spoke.tqe_next != NULL || - strq->ss_params.prio.next_spoke.tqe_prev != NULL)) { + if (TAILQ_EMPTY(&strq->outqueue) && strq->ss_params.scheduled) { if (asoc->ss_data.last_out_stream == strq) { - asoc->ss_data.last_out_stream = TAILQ_PREV(asoc->ss_data.last_out_stream, sctpwheel_listhead, - ss_params.prio.next_spoke); + asoc->ss_data.last_out_stream = TAILQ_PREV(asoc->ss_data.last_out_stream, + sctpwheel_listhead, + ss_params.ss.prio.next_spoke); if (asoc->ss_data.last_out_stream == NULL) { asoc->ss_data.last_out_stream = TAILQ_LAST(&asoc->ss_data.out.wheel, sctpwheel_listhead); @@ -465,9 +451,8 @@ sctp_ss_prio_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, asoc->ss_data.last_out_stream = NULL; } } - TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.prio.next_spoke); - strq->ss_params.prio.next_spoke.tqe_next = NULL; - strq->ss_params.prio.next_spoke.tqe_prev = NULL; + TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.prio.next_spoke); + strq->ss_params.scheduled = false; } return; } @@ -487,9 +472,9 @@ prio_again: if (strqt == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } else { - strqn = TAILQ_NEXT(strqt, ss_params.prio.next_spoke); + strqn = TAILQ_NEXT(strqt, ss_params.ss.prio.next_spoke); if (strqn != NULL && - strqn->ss_params.prio.priority == strqt->ss_params.prio.priority) { + strqn->ss_params.ss.prio.priority == strqt->ss_params.ss.prio.priority) { strq = strqn; } else { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); @@ -528,7 +513,7 @@ sctp_ss_prio_get_value(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_associatio if (strq == NULL) { return (-1); } - *value = strq->ss_params.prio.priority; + *value = strq->ss_params.ss.prio.priority; return (1); } @@ -539,7 +524,7 @@ sctp_ss_prio_set_value(struct sctp_tcb *stcb, struct sctp_association *asoc, if (strq == NULL) { return (-1); } - strq->ss_params.prio.priority = value; + strq->ss_params.ss.prio.priority = value; sctp_ss_prio_remove(stcb, asoc, strq, NULL); sctp_ss_prio_add(stcb, asoc, strq, NULL); return (1); @@ -551,7 +536,7 @@ sctp_ss_prio_set_value(struct sctp_tcb *stcb, struct sctp_association *asoc, */ static void sctp_ss_fb_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values) + bool clear_values) { SCTP_TCB_SEND_LOCK_ASSERT(stcb); @@ -560,11 +545,10 @@ sctp_ss_fb_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); if (clear_values) { - strq->ss_params.fb.rounds = -1; + strq->ss_params.ss.fb.rounds = -1; } - TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.fb.next_spoke); - strq->ss_params.fb.next_spoke.tqe_next = NULL; - strq->ss_params.fb.next_spoke.tqe_prev = NULL; + TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.fb.next_spoke); + strq->ss_params.scheduled = false; } asoc->ss_data.last_out_stream = NULL; return; @@ -581,12 +565,11 @@ sctp_ss_fb_init_stream(struct sctp_tcb *stcb, struct sctp_stream_out *strq, stru stcb->asoc.ss_data.last_out_stream = strq; } } - strq->ss_params.fb.next_spoke.tqe_next = NULL; - strq->ss_params.fb.next_spoke.tqe_prev = NULL; + strq->ss_params.scheduled = false; if (with_strq != NULL) { - strq->ss_params.fb.rounds = with_strq->ss_params.fb.rounds; + strq->ss_params.ss.fb.rounds = with_strq->ss_params.ss.fb.rounds; } else { - strq->ss_params.fb.rounds = -1; + strq->ss_params.ss.fb.rounds = -1; } return; } @@ -597,12 +580,11 @@ sctp_ss_fb_add(struct sctp_tcb *stcb, struct sctp_association *asoc, { SCTP_TCB_SEND_LOCK_ASSERT(stcb); - if (!TAILQ_EMPTY(&strq->outqueue) && - (strq->ss_params.fb.next_spoke.tqe_next == NULL) && - (strq->ss_params.fb.next_spoke.tqe_prev == NULL)) { - if (strq->ss_params.fb.rounds < 0) - strq->ss_params.fb.rounds = TAILQ_FIRST(&strq->outqueue)->length; - TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, strq, ss_params.fb.next_spoke); + if (!TAILQ_EMPTY(&strq->outqueue) && !strq->ss_params.scheduled) { + if (strq->ss_params.ss.fb.rounds < 0) + strq->ss_params.ss.fb.rounds = TAILQ_FIRST(&strq->outqueue)->length; + TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, strq, ss_params.ss.fb.next_spoke); + strq->ss_params.scheduled = true; } return; } @@ -617,12 +599,11 @@ sctp_ss_fb_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, * Remove from wheel if stream queue is empty and actually is on the * wheel */ - if (TAILQ_EMPTY(&strq->outqueue) && - (strq->ss_params.fb.next_spoke.tqe_next != NULL || - strq->ss_params.fb.next_spoke.tqe_prev != NULL)) { + if (TAILQ_EMPTY(&strq->outqueue) && strq->ss_params.scheduled) { if (asoc->ss_data.last_out_stream == strq) { - asoc->ss_data.last_out_stream = TAILQ_PREV(asoc->ss_data.last_out_stream, sctpwheel_listhead, - ss_params.fb.next_spoke); + asoc->ss_data.last_out_stream = TAILQ_PREV(asoc->ss_data.last_out_stream, + sctpwheel_listhead, + ss_params.ss.fb.next_spoke); if (asoc->ss_data.last_out_stream == NULL) { asoc->ss_data.last_out_stream = TAILQ_LAST(&asoc->ss_data.out.wheel, sctpwheel_listhead); @@ -631,9 +612,8 @@ sctp_ss_fb_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, asoc->ss_data.last_out_stream = NULL; } } - TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.fb.next_spoke); - strq->ss_params.fb.next_spoke.tqe_next = NULL; - strq->ss_params.fb.next_spoke.tqe_prev = NULL; + TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.fb.next_spoke); + strq->ss_params.scheduled = false; } return; } @@ -651,7 +631,7 @@ sctp_ss_fb_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net, TAILQ_FIRST(&asoc->ss_data.out.wheel) == TAILQ_LAST(&asoc->ss_data.out.wheel, sctpwheel_listhead)) { strqt = TAILQ_FIRST(&asoc->ss_data.out.wheel); } else { - strqt = TAILQ_NEXT(asoc->ss_data.last_out_stream, ss_params.fb.next_spoke); + strqt = TAILQ_NEXT(asoc->ss_data.last_out_stream, ss_params.ss.fb.next_spoke); } do { if ((strqt != NULL) && @@ -660,13 +640,14 @@ sctp_ss_fb_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net, (net == NULL || (TAILQ_FIRST(&strqt->outqueue) && TAILQ_FIRST(&strqt->outqueue)->net == NULL) || (net != NULL && TAILQ_FIRST(&strqt->outqueue) && TAILQ_FIRST(&strqt->outqueue)->net != NULL && TAILQ_FIRST(&strqt->outqueue)->net == net))))) { - if ((strqt->ss_params.fb.rounds >= 0) && (strq == NULL || - strqt->ss_params.fb.rounds < strq->ss_params.fb.rounds)) { + if ((strqt->ss_params.ss.fb.rounds >= 0) && + ((strq == NULL) || + (strqt->ss_params.ss.fb.rounds < strq->ss_params.ss.fb.rounds))) { strq = strqt; } } if (strqt != NULL) { - strqt = TAILQ_NEXT(strqt, ss_params.fb.next_spoke); + strqt = TAILQ_NEXT(strqt, ss_params.ss.fb.next_spoke); } else { strqt = TAILQ_FIRST(&asoc->ss_data.out.wheel); } @@ -693,16 +674,16 @@ sctp_ss_fb_scheduled(struct sctp_tcb *stcb, struct sctp_nets *net SCTP_UNUSED, } else { stcb->asoc.ss_data.locked_on_sending = NULL; } - subtract = strq->ss_params.fb.rounds; - TAILQ_FOREACH(strqt, &asoc->ss_data.out.wheel, ss_params.fb.next_spoke) { - strqt->ss_params.fb.rounds -= subtract; - if (strqt->ss_params.fb.rounds < 0) - strqt->ss_params.fb.rounds = 0; + subtract = strq->ss_params.ss.fb.rounds; + TAILQ_FOREACH(strqt, &asoc->ss_data.out.wheel, ss_params.ss.fb.next_spoke) { + strqt->ss_params.ss.fb.rounds -= subtract; + if (strqt->ss_params.ss.fb.rounds < 0) + strqt->ss_params.ss.fb.rounds = 0; } if (TAILQ_FIRST(&strq->outqueue)) { - strq->ss_params.fb.rounds = TAILQ_FIRST(&strq->outqueue)->length; + strq->ss_params.ss.fb.rounds = TAILQ_FIRST(&strq->outqueue)->length; } else { - strq->ss_params.fb.rounds = -1; + strq->ss_params.ss.fb.rounds = -1; } asoc->ss_data.last_out_stream = strq; return; @@ -754,7 +735,7 @@ sctp_ss_fcfs_init(struct sctp_tcb *stcb, struct sctp_association *asoc) static void sctp_ss_fcfs_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values SCTP_UNUSED) + bool clear_values SCTP_UNUSED) { struct sctp_stream_queue_pending *sp; @@ -763,8 +744,7 @@ sctp_ss_fcfs_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, while (!TAILQ_EMPTY(&asoc->ss_data.out.list)) { sp = TAILQ_FIRST(&asoc->ss_data.out.list); TAILQ_REMOVE(&asoc->ss_data.out.list, sp, ss_next); - sp->ss_next.tqe_next = NULL; - sp->ss_next.tqe_prev = NULL; + sp->scheduled = false; } asoc->ss_data.last_out_stream = NULL; return; @@ -781,8 +761,7 @@ sctp_ss_fcfs_init_stream(struct sctp_tcb *stcb, struct sctp_stream_out *strq, st stcb->asoc.ss_data.last_out_stream = strq; } } - strq->ss_params.fb.next_spoke.tqe_next = NULL; - strq->ss_params.fb.next_spoke.tqe_prev = NULL; + strq->ss_params.scheduled = false; return; } @@ -792,21 +771,17 @@ sctp_ss_fcfs_add(struct sctp_tcb *stcb, struct sctp_association *asoc, { SCTP_TCB_SEND_LOCK_ASSERT(stcb); - if (sp && (sp->ss_next.tqe_next == NULL) && - (sp->ss_next.tqe_prev == NULL)) { + if (!sp->scheduled) { TAILQ_INSERT_TAIL(&asoc->ss_data.out.list, sp, ss_next); + sp->scheduled = true; } return; } -static int +static bool sctp_ss_fcfs_is_empty(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_association *asoc) { - if (TAILQ_EMPTY(&asoc->ss_data.out.list)) { - return (1); - } else { - return (0); - } + return (TAILQ_EMPTY(&asoc->ss_data.out.list)); } static void @@ -815,12 +790,9 @@ sctp_ss_fcfs_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, { SCTP_TCB_SEND_LOCK_ASSERT(stcb); - if (sp && - ((sp->ss_next.tqe_next != NULL) || - (sp->ss_next.tqe_prev != NULL))) { + if (sp->scheduled) { TAILQ_REMOVE(&asoc->ss_data.out.list, sp, ss_next); - sp->ss_next.tqe_next = NULL; - sp->ss_next.tqe_prev = NULL; + sp->scheduled = false; } return; } diff --git a/sys/netinet/sctp_structs.h b/sys/netinet/sctp_structs.h index 2f0ae4c45b24..026e3319dd23 100644 --- a/sys/netinet/sctp_structs.h +++ b/sys/netinet/sctp_structs.h @@ -505,6 +505,7 @@ struct sctp_queued_to_read { /* sinfo structure Pluse more */ * the user is in the explict MSG_EOR mode * and wrote some data, but has not completed * sending. + * ss_next and scheduled are only used by the FCFS stream scheduler. */ struct sctp_stream_queue_pending { struct mbuf *data; @@ -529,6 +530,7 @@ struct sctp_stream_queue_pending { uint8_t put_last_out; uint8_t discard_rest; uint8_t processing; + bool scheduled; }; /* @@ -588,10 +590,13 @@ struct ss_fb { * This union holds all parameters per stream * necessary for different stream schedulers. */ -union scheduling_parameters { - struct ss_rr rr; - struct ss_prio prio; - struct ss_fb fb; +struct scheduling_parameters { + union { + struct ss_rr rr; + struct ss_prio prio; + struct ss_fb fb; + } ss; + bool scheduled; }; /* States for outgoing streams */ @@ -604,7 +609,7 @@ union scheduling_parameters { /* This struct is used to track the traffic on outbound streams */ struct sctp_stream_out { struct sctp_streamhead outqueue; - union scheduling_parameters ss_params; + struct scheduling_parameters ss_params; uint32_t chunks_on_queues; /* send queue and sent queue */ #if defined(SCTP_DETAILED_STR_STATS) uint32_t abandoned_unsent[SCTP_PR_SCTP_MAX + 1]; @@ -731,11 +736,11 @@ struct sctp_cc_functions { struct sctp_ss_functions { void (*sctp_ss_init) (struct sctp_tcb *stcb, struct sctp_association *asoc); void (*sctp_ss_clear) (struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values); + bool clear_values); void (*sctp_ss_init_stream) (struct sctp_tcb *stcb, struct sctp_stream_out *strq, struct sctp_stream_out *with_strq); void (*sctp_ss_add_to_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp); - int (*sctp_ss_is_empty) (struct sctp_tcb *stcb, struct sctp_association *asoc); + bool (*sctp_ss_is_empty) (struct sctp_tcb *stcb, struct sctp_association *asoc); void (*sctp_ss_remove_from_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp); struct sctp_stream_out *(*sctp_ss_select_stream) (struct sctp_tcb *stcb, @@ -748,7 +753,7 @@ struct sctp_stream_out *(*sctp_ss_select_stream) (struct sctp_tcb *stcb, struct sctp_stream_out *strq, uint16_t *value); int (*sctp_ss_set_value) (struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq, uint16_t value); - int (*sctp_ss_is_user_msgs_incomplete) (struct sctp_tcb *stcb, struct sctp_association *asoc); + bool (*sctp_ss_is_user_msgs_incomplete) (struct sctp_tcb *stcb, struct sctp_association *asoc); }; /* used to save ASCONF chunks for retransmission */ diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 65037f0734ea..b2d23bffb9fd 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -4043,7 +4043,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, SCTP_FIND_STCB(inp, stcb, av->assoc_id); if (stcb) { SCTP_TCB_SEND_LOCK(stcb); - stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 1); + stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, true); stcb->asoc.ss_functions = sctp_ss_functions[av->assoc_value]; stcb->asoc.stream_scheduling_module = av->assoc_value; stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc); @@ -4066,7 +4066,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { SCTP_TCB_LOCK(stcb); SCTP_TCB_SEND_LOCK(stcb); - stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 1); + stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, true); stcb->asoc.ss_functions = sctp_ss_functions[av->assoc_value]; stcb->asoc.stream_scheduling_module = av->assoc_value; stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc); From owner-dev-commits-src-all@freebsd.org Thu Sep 23 13:51:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C07CB67F2FC; Thu, 23 Sep 2021 13:51:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFc5y4vWJz4hjS; Thu, 23 Sep 2021 13:51:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7DF382C2F9; Thu, 23 Sep 2021 13:51:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18NDpoPV096780; Thu, 23 Sep 2021 13:51:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18NDpo6a096779; Thu, 23 Sep 2021 13:51:50 GMT (envelope-from git) Date: Thu, 23 Sep 2021 13:51:50 GMT Message-Id: <202109231351.18NDpo6a096779@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: dbc7ca594515 - main - vt: bound buffer access in redraw optimization MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dbc7ca59451561a179f9852642e13ef024169d84 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 13:51:50 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=dbc7ca59451561a179f9852642e13ef024169d84 commit dbc7ca59451561a179f9852642e13ef024169d84 Author: Ed Maste AuthorDate: 2021-09-22 18:41:00 +0000 Commit: Ed Maste CommitDate: 2021-09-23 13:51:36 +0000 vt: bound buffer access in redraw optimization PR: 248628 Reported by: oleg Reviewed by: cem, oleg (both earlier) Fixes: ee97b2336aa4 ("Speed up vt(4) by keeping...") MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32059 --- sys/dev/vt/hw/fb/vt_fb.c | 6 ++++++ sys/dev/vt/hw/vga/vt_vga.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/sys/dev/vt/hw/fb/vt_fb.c b/sys/dev/vt/hw/fb/vt_fb.c index bdf2bbfcc7ce..2f6c4c3939d5 100644 --- a/sys/dev/vt/hw/fb/vt_fb.c +++ b/sys/dev/vt/hw/fb/vt_fb.c @@ -354,6 +354,9 @@ vt_fb_bitblt_text(struct vt_device *vd, const struct vt_window *vw, VTBUF_ISCURSOR(&vw->vw_buf, row, col), &fg, &bg); z = row * PIXEL_WIDTH(VT_FB_MAX_WIDTH) + col; + if (z >= PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * + PIXEL_WIDTH(VT_FB_MAX_WIDTH)) + continue; if (vd->vd_drawn && (vd->vd_drawn[z] == c) && vd->vd_drawnfg && (vd->vd_drawnfg[z] == fg) && vd->vd_drawnbg && (vd->vd_drawnbg[z] == bg)) @@ -404,6 +407,9 @@ vt_fb_invalidate_text(struct vt_device *vd, const term_rect_t *area) for (col = area->tr_begin.tp_col; col < area->tr_end.tp_col; ++col) { z = row * PIXEL_WIDTH(VT_FB_MAX_WIDTH) + col; + if (z >= PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * + PIXEL_WIDTH(VT_FB_MAX_WIDTH)) + continue; if (vd->vd_drawn) vd->vd_drawn[z] = 0; if (vd->vd_drawnfg) diff --git a/sys/dev/vt/hw/vga/vt_vga.c b/sys/dev/vt/hw/vga/vt_vga.c index 88a9b1c47338..563867399e53 100644 --- a/sys/dev/vt/hw/vga/vt_vga.c +++ b/sys/dev/vt/hw/vga/vt_vga.c @@ -888,6 +888,9 @@ vga_bitblt_text_txtmode(struct vt_device *vd, const struct vt_window *vw, &fg, &bg); z = row * PIXEL_WIDTH(VT_FB_MAX_WIDTH) + col; + if (z >= PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * + PIXEL_WIDTH(VT_FB_MAX_WIDTH)) + continue; if (vd->vd_drawn && (vd->vd_drawn[z] == c) && vd->vd_drawnfg && (vd->vd_drawnfg[z] == fg) && vd->vd_drawnbg && (vd->vd_drawnbg[z] == bg)) @@ -941,6 +944,9 @@ vga_invalidate_text(struct vt_device *vd, const term_rect_t *area) col < area->tr_end.tp_col; ++col) { z = row * PIXEL_WIDTH(VT_FB_MAX_WIDTH) + col; + if (z >= PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * + PIXEL_WIDTH(VT_FB_MAX_WIDTH)) + continue; if (vd->vd_drawn) vd->vd_drawn[z] = 0; if (vd->vd_drawnfg) From owner-dev-commits-src-all@freebsd.org Thu Sep 23 14:57:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8C0C6A889A; Thu, 23 Sep 2021 14:57: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 4HFdZD4c6Nz4rHL; Thu, 23 Sep 2021 14:57: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 79ACA2CEA8; Thu, 23 Sep 2021 14:57: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 18NEvuux077702; Thu, 23 Sep 2021 14:57:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18NEvuYN077701; Thu, 23 Sep 2021 14:57:56 GMT (envelope-from git) Date: Thu, 23 Sep 2021 14:57:56 GMT Message-Id: <202109231457.18NEvuYN077701@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: fd69939e79a6 - main - tcp: Two bugs in rack one of which can lead to a panic. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fd69939e79a65d0dea766ac05e4d8b7335819ae1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 14:57:56 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=fd69939e79a65d0dea766ac05e4d8b7335819ae1 commit fd69939e79a65d0dea766ac05e4d8b7335819ae1 Author: Randall Stewart AuthorDate: 2021-09-23 14:54:23 +0000 Commit: Randall Stewart CommitDate: 2021-09-23 14:54:23 +0000 tcp: Two bugs in rack one of which can lead to a panic. In extensive testing in NF we have found two issues inside the rack stack. 1) An incorrect offset is being generated by the fast send path when a fast send is initiated on the end of the socket buffer and before the fast send runs, the sb_compress macro adds data to the trailing socket. This fools the fast send code into thinking the sb offset changed and it miscalculates a "updated offset". It should only do that when the mbuf in question got smaller.. i.e. an ack was processed. This can lead to a panic deref'ing a NULL mbuf if that packet is ever retransmitted. At the best case it leads to invalid data being sent to the client which usually terminates the connection. The fix is to have the proper logic (that is in the rsm fast path) to make sure we only update the offset when the mbuf shrinks. 2) The other issue is more bothersome. The timestamp check in rack needs to use the msec timestamp when comparing the timestamp echo to now. It was using a microsecond timestamp which ends up giving error prone results but causes only small harm in trying to identify which send to use in RTT calculations if its a retransmit. Reviewed by: tuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D32062 --- sys/netinet/tcp_stacks/rack.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 947f9f619929..23b1ff1fc584 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -9176,6 +9176,7 @@ more: if ((rsm->r_flags & RACK_TO_REXT) && (tp->t_flags & TF_RCVD_TSTMP) && (to->to_flags & TOF_TS) && + (to->to_tsecr != 0) && (tp->t_flags & TF_PREVVALID)) { /* * We can use the timestamp to see @@ -13321,7 +13322,7 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb struct timespec ts; struct tcp_rack *rack; struct tcp_ackent *ae; - uint32_t tiwin, us_cts, cts, acked, acked_amount, high_seq, win_seq, the_win, win_upd_ack; + uint32_t tiwin, ms_cts, cts, acked, acked_amount, high_seq, win_seq, the_win, win_upd_ack; int cnt, i, did_out, ourfinisacked = 0; int win_up_req = 0; struct tcpopt to_holder, *to = NULL; @@ -13381,13 +13382,14 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb the_win = tp->snd_wnd; win_seq = tp->snd_wl1; win_upd_ack = tp->snd_wl2; - cts = us_cts = tcp_tv_to_usectick(tv); + cts = tcp_tv_to_usectick(tv); + ms_cts = tcp_tv_to_mssectick(tv); segsiz = ctf_fixed_maxseg(tp); if ((rack->rc_gp_dyn_mul) && (rack->use_fixed_rate == 0) && (rack->rc_always_pace)) { /* Check in on probertt */ - rack_check_probe_rtt(rack, us_cts); + rack_check_probe_rtt(rack, cts); } for (i = 0; i < cnt; i++) { #ifdef TCP_ACCOUNTING @@ -13424,8 +13426,8 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb * non RFC1323 RTT calculation. Normalize timestamp if syncookies * were used when this connection was established. */ - if (TSTMP_GT(ae->ts_echo, cts)) - ae->ts_echo = 0; + if (TSTMP_GT(ae->ts_echo, ms_cts)) + to->to_tsecr = 0; if (tp->ts_recent && TSTMP_LT(ae->ts_value, tp->ts_recent)) { if (ctf_ts_check_ac(tp, (ae->flags & 0xff))) { @@ -13524,7 +13526,6 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb the_win = tiwin; } else { /* Case A */ - if (SEQ_GT(ae->ack, tp->snd_max)) { /* * We just send an ack since the incoming @@ -13564,7 +13565,7 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb } rack_process_to_cumack(tp, rack, ae->ack, cts, to); if (rack->rc_dsack_round_seen) { - /* Is the dsack roound over? */ + /* Is the dsack round over? */ if (SEQ_GEQ(ae->ack, rack->r_ctl.dsack_round_end)) { /* Yes it is */ rack->rc_dsack_round_seen = 0; @@ -13687,7 +13688,7 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb rack_ack_received(tp, rack, high_seq, nsegs, CC_ACK, recovery); SOCKBUF_LOCK(&so->so_snd); - mfree = sbcut_locked(&so->so_snd, acked); + mfree = sbcut_locked(&so->so_snd, acked_amount); tp->snd_una = high_seq; /* Note we want to hold the sb lock through the sendmap adjust */ rack_adjust_sendmap(rack, &so->so_snd, tp->snd_una); @@ -13962,7 +13963,12 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, #endif int32_t thflags, retval, did_out = 0; int32_t way_out = 0; - uint32_t cts; + /* + * cts - is the current time from tv (caller gets ts) in microseconds. + * ms_cts - is the current time from tv in milliseconds. + * us_cts - is the time that LRO or hardware actually got the packet in microseconds. + */ + uint32_t cts, us_cts, ms_cts; uint32_t tiwin; struct timespec ts; struct tcpopt to; @@ -13973,19 +13979,19 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, int ack_val_set = 0xf; #endif int nsegs; - uint32_t us_cts; /* * tv passed from common code is from either M_TSTMP_LRO or * tcp_get_usecs() if no LRO m_pkthdr timestamp is present. */ rack = (struct tcp_rack *)tp->t_fb_ptr; - cts = tcp_tv_to_usectick(tv); if (m->m_flags & M_ACKCMP) { return (rack_do_compressed_ack_processing(tp, so, m, nxt_pkt, tv)); } if (m->m_flags & M_ACKCMP) { panic("Impossible reach m has ackcmp? m:%p tp:%p", m, tp); } + cts = tcp_tv_to_usectick(tv); + ms_cts = tcp_tv_to_mssectick(tv); nsegs = m->m_pkthdr.lro_nsegs; counter_u64_add(rack_proc_non_comp_ack, 1); thflags = th->th_flags; @@ -14238,7 +14244,7 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, */ if ((to.to_flags & TOF_TS) && (to.to_tsecr != 0)) { to.to_tsecr -= tp->ts_offset; - if (TSTMP_GT(to.to_tsecr, cts)) + if (TSTMP_GT(to.to_tsecr, ms_cts)) to.to_tsecr = 0; } @@ -15571,7 +15577,7 @@ rack_fo_m_copym(struct tcp_rack *rack, int32_t *plen, soff = rack->r_ctl.fsb.off; m = rack->r_ctl.fsb.m; - if (rack->r_ctl.fsb.o_m_len != m->m_len) { + if (rack->r_ctl.fsb.o_m_len > m->m_len) { /* * The mbuf had the front of it chopped off by an ack * we need to adjust the soff/off by that difference. @@ -15580,6 +15586,12 @@ rack_fo_m_copym(struct tcp_rack *rack, int32_t *plen, delta = rack->r_ctl.fsb.o_m_len - m->m_len; soff -= delta; + } else if (rack->r_ctl.fsb.o_m_len < m->m_len) { + /* + * The mbuf was expanded probably by + * a m_compress. Just update o_m_len. + */ + rack->r_ctl.fsb.o_m_len = m->m_len; } KASSERT(soff >= 0, ("%s, negative off %d", __FUNCTION__, soff)); KASSERT(*plen >= 0, ("%s, negative len %d", __FUNCTION__, *plen)); From owner-dev-commits-src-all@freebsd.org Thu Sep 23 15:44:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C1E316A8B6C; Thu, 23 Sep 2021 15:44:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFfcQ4jNfz4vnw; Thu, 23 Sep 2021 15:44:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 813C32DB00; Thu, 23 Sep 2021 15:44: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 18NFissU043837; Thu, 23 Sep 2021 15:44:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18NFis4A043836; Thu, 23 Sep 2021 15:44:54 GMT (envelope-from git) Date: Thu, 23 Sep 2021 15:44:54 GMT Message-Id: <202109231544.18NFis4A043836@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 1ca931a540cb - main - tcp: Rack compressed ack path updates the recv window too easily MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ca931a540cbb1891f535832ee6ef40ae3ed3910 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 15:44:54 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=1ca931a540cbb1891f535832ee6ef40ae3ed3910 commit 1ca931a540cbb1891f535832ee6ef40ae3ed3910 Author: Randall Stewart AuthorDate: 2021-09-23 15:43:29 +0000 Commit: Randall Stewart CommitDate: 2021-09-23 15:43:29 +0000 tcp: Rack compressed ack path updates the recv window too easily The compressed ack path of rack is not following proper procedures in updating the peers window. It should be checking the seq and ack values before updating and instead it is blindly updating the values. This could in theory get the wrong window in the connection for some length of time. Reviewed by: tuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D32082 --- sys/netinet/tcp_stacks/rack.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 23b1ff1fc584..2369a1c368bf 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -13116,10 +13116,28 @@ rack_timer_audit(struct tcpcb *tp, struct tcp_rack *rack, struct sockbuf *sb) static void rack_do_win_updates(struct tcpcb *tp, struct tcp_rack *rack, uint32_t tiwin, uint32_t seq, uint32_t ack, uint32_t cts, uint32_t high_seq) { - tp->snd_wnd = tiwin; - rack_validate_fo_sendwin_up(tp, rack); - tp->snd_wl1 = seq; - tp->snd_wl2 = ack; + if ((SEQ_LT(tp->snd_wl1, seq) || + (tp->snd_wl1 == seq && (SEQ_LT(tp->snd_wl2, ack) || + (tp->snd_wl2 == ack && tiwin > tp->snd_wnd))))) { + /* keep track of pure window updates */ + if ((tp->snd_wl2 == ack) && (tiwin > tp->snd_wnd)) + KMOD_TCPSTAT_INC(tcps_rcvwinupd); + tp->snd_wnd = tiwin; + rack_validate_fo_sendwin_up(tp, rack); + tp->snd_wl1 = seq; + tp->snd_wl2 = ack; + if (tp->snd_wnd > tp->max_sndwnd) + tp->max_sndwnd = tp->snd_wnd; + rack->r_wanted_output = 1; + } else if ((tp->snd_wl2 == ack) && (tiwin < tp->snd_wnd)) { + tp->snd_wnd = tiwin; + rack_validate_fo_sendwin_up(tp, rack); + tp->snd_wl1 = seq; + tp->snd_wl2 = ack; + } else { + /* Not a valid win update */ + return; + } if (tp->snd_wnd > tp->max_sndwnd) tp->max_sndwnd = tp->snd_wnd; if (tp->snd_wnd < (tp->snd_max - high_seq)) { @@ -13324,8 +13342,8 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb struct tcp_ackent *ae; uint32_t tiwin, ms_cts, cts, acked, acked_amount, high_seq, win_seq, the_win, win_upd_ack; int cnt, i, did_out, ourfinisacked = 0; - int win_up_req = 0; struct tcpopt to_holder, *to = NULL; + int win_up_req = 0; int nsegs = 0; int under_pacing = 1; int recovery = 0; @@ -13519,11 +13537,11 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb rack_strike_dupack(rack); } else if (ae->ack_val_set == ACK_RWND) { /* Case C */ - win_up_req = 1; win_upd_ack = ae->ack; win_seq = ae->seq; the_win = tiwin; + rack_do_win_updates(tp, rack, the_win, win_seq, win_upd_ack, cts, high_seq); } else { /* Case A */ if (SEQ_GT(ae->ack, tp->snd_max)) { @@ -13540,10 +13558,10 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb nsegs++; /* If the window changed setup to update */ if (tiwin != tp->snd_wnd) { - win_up_req = 1; win_upd_ack = ae->ack; win_seq = ae->seq; the_win = tiwin; + rack_do_win_updates(tp, rack, the_win, win_seq, win_upd_ack, cts, high_seq); } #ifdef TCP_ACCOUNTING /* Account for the acks */ @@ -13592,9 +13610,6 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb ts_val = get_cyclecount(); #endif acked_amount = acked = (high_seq - tp->snd_una); - if (win_up_req) { - rack_do_win_updates(tp, rack, the_win, win_seq, win_upd_ack, cts, high_seq); - } if (acked) { if (rack->sack_attack_disable == 0) rack_do_decay(rack); From owner-dev-commits-src-all@freebsd.org Thu Sep 23 16:23:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9DC826A96B5; Thu, 23 Sep 2021 16:23:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFgSz3rxsz3DYZ; Thu, 23 Sep 2021 16:23:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1632414211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=adDkN9Wk999uM39cPvLm51S9v8FTl+cs+gLZt9n0KY4=; b=g5xVnOqzBFFAV1lEVLpU79uQnHVl2Po3IEe1y0sD6FwpZyarWqf0d7yFxkLnwYad+c1oJv h19K48Utk8TvwELx1io7j0owgjEj4NNqq3+UjEeDId8RjAXb/7fbGI883LDZ7LLCkDpcmj kKrHY0tezO+PEBgzoDBJK/CKGH850t9CORldoHisyXBUO1DKtsU3uq0M2CoLaStt6XB8Uw GyiftUVyJhVOgl5kztev1iQiFWFJrU35cAgT6nfqIlSC3jshhIWHeo+mPnyDXiMwH1inp2 B2FiA+jwKxfufy765M9zD4lxFy3QGJF/1IZPow1kgq0IIJdt+HkpnII1ij6pQQ== Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 5D67116A5F; Thu, 23 Sep 2021 16:23:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 4B9C620F44; Thu, 23 Sep 2021 09:23:30 -0700 (PDT) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id JNy0BPu-xFZu; Thu, 23 Sep 2021 09:23:27 -0700 (PDT) Subject: Re: git: 1f82fb383410 - main - sh: try to avoid overwriting HISTFILE produced by other shells DKIM-Filter: OpenDKIM Filter v2.10.3 mail.xzibition.com 8A89520F37 To: Piotr Pawel Stefaniak , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202109222025.18MKPfLc098616@gitrepo.freebsd.org> From: Bryan Drewery Organization: FreeBSD Message-ID: <64a1af40-882e-fc3e-5210-80984eed8d88@FreeBSD.org> Date: Thu, 23 Sep 2021 09:23:25 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <202109222025.18MKPfLc098616@gitrepo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="KkhpetGmvybu6qMllpWx93cspjkPYHnaJ" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1632414211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=adDkN9Wk999uM39cPvLm51S9v8FTl+cs+gLZt9n0KY4=; b=m1GDQp5wjVNrm1H9MaDicCURrZ5PHqnovpSgAEfOYyOsrBhPc8aoMhlqigNQyokbbFCWK6 /A3840elUzMi/0pVMeOmsAGC/yJlwSuWQygE0SEiLwuDCxScRnx+WceXmQtSYhYKH15Hc1 nCQtcvMtipPIZikqjMcKOl7VZReAF2tovEkgoxMVYVvo0k1Y5x1uKcdHnU8CqMunHio933 vpJ/givBPCKqnFAE0WCqBqidg+KJmUwuGmxxOP6KS5u+/LOdZXlBOqVLKvtA3JS8+BTcaD Lj15Ln9fQNqFr872/UhiZV5/kw0engf9ee3GY7WfUIu6NCAYL/WvKc7qn7+daw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1632414211; a=rsa-sha256; cv=none; b=w3/7wt81gf5P5+mA3iqyyw7l5R9G/6CoEqrsRXqB5J3Osx6l90kS6hIWZAkfvTziitk1Ri dXg+We3f/4iVwrEVmM2ZR1KwRZgSkqktMU3S7S6Sp4Wy05/9rpC846Suw35kPH2xG9PTmx p+I7FWlZ9VoljmSj2R9qsikBU1WUAJg70fZ47mtdNVGdsnyGD2ckcsjaTKjMSHy+d3dNRi Or1fvzmZWPaqOV+HuFk2EhstnpLJbTquIf8R0Jdr+SLHuQHw01V+MxuGalRAsuGcJbfE4m oHybl8lLhWATcTWh0nUUTiUAMxe0Muh0KR/LXtM6/jlgNlz5Wp8BYIN7stMYLA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 16:23:31 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --KkhpetGmvybu6qMllpWx93cspjkPYHnaJ Content-Type: multipart/mixed; boundary="aG7ZQ8lpv1tF6tNFM9whhjPKbKeaj3LQs"; protected-headers="v1" From: Bryan Drewery To: Piotr Pawel Stefaniak , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Message-ID: <64a1af40-882e-fc3e-5210-80984eed8d88@FreeBSD.org> Subject: Re: git: 1f82fb383410 - main - sh: try to avoid overwriting HISTFILE produced by other shells References: <202109222025.18MKPfLc098616@gitrepo.freebsd.org> In-Reply-To: <202109222025.18MKPfLc098616@gitrepo.freebsd.org> --aG7ZQ8lpv1tF6tNFM9whhjPKbKeaj3LQs Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 9/22/2021 1:25 PM, Piotr Pawel Stefaniak wrote: > The branch main has been updated by pstef: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D1f82fb3834105fd8f1186b1c= 6d719d8a24738180 >=20 > commit 1f82fb3834105fd8f1186b1c6d719d8a24738180 > Author: Piotr Pawel Stefaniak > AuthorDate: 2021-09-22 16:42:41 +0000 > Commit: Piotr Pawel Stefaniak > CommitDate: 2021-09-22 20:23:32 +0000 >=20 > sh: try to avoid overwriting HISTFILE produced by other shells > =20 > If an attempt to load history from an existing history file was > unsuccessful, do not try to save command history to that file on ex= it. Thank you! --=20 Bryan Drewery --aG7ZQ8lpv1tF6tNFM9whhjPKbKeaj3LQs-- --KkhpetGmvybu6qMllpWx93cspjkPYHnaJ Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEE+Rc8ssOq6npcih8JNddxu25Gl88FAmFMqf0FAwAAAAAACgkQNddxu25Gl8+c FAgAolePJJ69Du7/IxU2Bz7pA5WMDGbe95BzTSSQ/sgucLMFo8i3tFpghq9x5vcBbnG7a3ZRyI+J vrOAZzLBbQw4161+WdJNul6zqLbySgK56CSsItgbEncwyVz4wx/txQTbx7eQfXxiVIh3+KWuO4AP l7Bku/xUx5vgQ9Cbv0Qd7s/c7g4txoXTWGt4OhnABYSNLXwef7wOjlukiIZ6VLWH9GOiVpUPG0ds Qp6IkwJUon7Nvua9h1MI1WhwZWVrk06MSx4+8bv1JohedTtvUzLDIg6RpObBLH8FsZston5GXSWO ffFmxMfzl/zRJIHX0kC+51THdY3iPSHu2PeTW6eWtQ== =a5U/ -----END PGP SIGNATURE----- --KkhpetGmvybu6qMllpWx93cspjkPYHnaJ-- From owner-dev-commits-src-all@freebsd.org Thu Sep 23 18:31:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1FB856AB196; Thu, 23 Sep 2021 18:31: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 4HFkJz05Swz3p8B; Thu, 23 Sep 2021 18:31: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 D80382FF81; Thu, 23 Sep 2021 18:31: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 18NIVkrH069672; Thu, 23 Sep 2021 18:31:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18NIVkt8069671; Thu, 23 Sep 2021 18:31:46 GMT (envelope-from git) Date: Thu, 23 Sep 2021 18:31:46 GMT Message-Id: <202109231831.18NIVkt8069671@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: ef50d5fbc39f - main - x86: Add NUMA nodes into CPU topology. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ef50d5fbc39fc39970eab1234222b5ac1d9ba74c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 18:31:47 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=ef50d5fbc39fc39970eab1234222b5ac1d9ba74c commit ef50d5fbc39fc39970eab1234222b5ac1d9ba74c Author: Alexander Motin AuthorDate: 2021-09-23 17:41:02 +0000 Commit: Alexander Motin CommitDate: 2021-09-23 18:31:38 +0000 x86: Add NUMA nodes into CPU topology. Depending on hardware, NUMA nodes may match last level caches, or they may be above them (AMD Zen 2/3) or below (Intel Xeon w/ SNC). This information is provided by ACPI instead of CPUID, and it is provided for each CPU individually instead of mask widths, but this code should be able to properly handle all the above cases. This change should immediately allow idle stealing in sched_ule(4) to prefer load from NUMA-local CPUs to remote ones when the node does not match LLC. Later we may think of how to better handle it on sched_pickcpu() side. MFC after: 1 month --- sys/kern/sched_ule.c | 2 ++ sys/sys/smp.h | 1 + sys/x86/x86/mp_x86.c | 82 +++++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 72 insertions(+), 13 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index d1e4010d2ebe..49199b6f319f 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -3098,6 +3098,8 @@ sysctl_kern_sched_topology_spec_internal(struct sbuf *sb, struct cpu_group *cg, sbuf_printf(sb, "THREAD group"); if ((cg->cg_flags & CG_FLAG_SMT) != 0) sbuf_printf(sb, "SMT group"); + if ((cg->cg_flags & CG_FLAG_NODE) != 0) + sbuf_printf(sb, "NUMA node"); sbuf_printf(sb, "\n"); } diff --git a/sys/sys/smp.h b/sys/sys/smp.h index cee1199015a7..1da557212ae2 100644 --- a/sys/sys/smp.h +++ b/sys/sys/smp.h @@ -107,6 +107,7 @@ typedef struct cpu_group *cpu_group_t; #define CG_FLAG_HTT 0x01 /* Schedule the alternate core last. */ #define CG_FLAG_SMT 0x02 /* New age htt, less crippled. */ #define CG_FLAG_THREAD (CG_FLAG_HTT | CG_FLAG_SMT) /* Any threading. */ +#define CG_FLAG_NODE 0x04 /* NUMA node. */ /* * Convenience routines for building and traversing topologies. diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index 5e9a9735b09a..54ca82a2c90d 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -27,6 +27,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_acpi.h" #ifdef __i386__ #include "opt_apic.h" #endif @@ -83,6 +84,11 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef DEV_ACPI +#include +#include +#endif + static MALLOC_DEFINE(M_CPUS, "cpus", "CPU items"); /* lock region used by kernel profiling */ @@ -502,13 +508,16 @@ topo_probe(void) int type; int subtype; int id_shift; - } topo_layers[MAX_CACHE_LEVELS + 4]; + } topo_layers[MAX_CACHE_LEVELS + 5]; struct topo_node *parent; struct topo_node *node; int layer; int nlayers; int node_id; int i; +#if defined(DEV_ACPI) && MAXMEMDOM > 1 + int d, domain; +#endif if (cpu_topo_probed) return; @@ -583,6 +592,31 @@ topo_probe(void) topo_layers[nlayers].id_shift = 0; nlayers++; +#if defined(DEV_ACPI) && MAXMEMDOM > 1 + if (vm_ndomains > 1) { + for (layer = 0; layer < nlayers; ++layer) { + for (i = 0; i <= max_apic_id; ++i) { + if ((i & ((1 << topo_layers[layer].id_shift) - 1)) == 0) + domain = -1; + if (!cpu_info[i].cpu_present) + continue; + d = acpi_pxm_get_cpu_locality(i); + if (domain >= 0 && domain != d) + break; + domain = d; + } + if (i > max_apic_id) + break; + } + KASSERT(layer < nlayers, ("NUMA domain smaller than PU")); + memmove(&topo_layers[layer+1], &topo_layers[layer], + sizeof(*topo_layers) * (nlayers - layer)); + topo_layers[layer].type = TOPO_TYPE_NODE; + topo_layers[layer].subtype = CG_SHARE_NONE; + nlayers++; + } +#endif + topo_init_root(&topo_root); for (i = 0; i <= max_apic_id; ++i) { if (!cpu_info[i].cpu_present) @@ -590,7 +624,12 @@ topo_probe(void) parent = &topo_root; for (layer = 0; layer < nlayers; ++layer) { - node_id = i >> topo_layers[layer].id_shift; +#if defined(DEV_ACPI) && MAXMEMDOM > 1 + if (topo_layers[layer].type == TOPO_TYPE_NODE) { + node_id = acpi_pxm_get_cpu_locality(i); + } else +#endif + node_id = i >> topo_layers[layer].id_shift; parent = topo_add_node_by_hwid(parent, node_id, topo_layers[layer].type, topo_layers[layer].subtype); @@ -599,7 +638,12 @@ topo_probe(void) parent = &topo_root; for (layer = 0; layer < nlayers; ++layer) { - node_id = boot_cpu_id >> topo_layers[layer].id_shift; +#if defined(DEV_ACPI) && MAXMEMDOM > 1 + if (topo_layers[layer].type == TOPO_TYPE_NODE) + node_id = acpi_pxm_get_cpu_locality(boot_cpu_id); + else +#endif + node_id = boot_cpu_id >> topo_layers[layer].id_shift; node = topo_find_node_by_hwid(parent, node_id, topo_layers[layer].type, topo_layers[layer].subtype); @@ -774,14 +818,18 @@ x86topo_add_sched_group(struct topo_node *root, struct cpu_group *cg_root) int i; KASSERT(root->type == TOPO_TYPE_SYSTEM || root->type == TOPO_TYPE_CACHE || - root->type == TOPO_TYPE_GROUP, + root->type == TOPO_TYPE_NODE || root->type == TOPO_TYPE_GROUP, ("x86topo_add_sched_group: bad type: %u", root->type)); CPU_COPY(&root->cpuset, &cg_root->cg_mask); cg_root->cg_count = root->cpu_count; - if (root->type == TOPO_TYPE_SYSTEM) + if (root->type == TOPO_TYPE_CACHE) + cg_root->cg_level = root->subtype; + else cg_root->cg_level = CG_SHARE_NONE; + if (root->type == TOPO_TYPE_NODE) + cg_root->cg_flags = CG_FLAG_NODE; else - cg_root->cg_level = root->subtype; + cg_root->cg_flags = 0; /* * Check how many core nodes we have under the given root node. @@ -802,7 +850,7 @@ x86topo_add_sched_group(struct topo_node *root, struct cpu_group *cg_root) if (cg_root->cg_level != CG_SHARE_NONE && root->cpu_count > 1 && ncores < 2) - cg_root->cg_flags = CG_FLAG_SMT; + cg_root->cg_flags |= CG_FLAG_SMT; /* * Find out how many cache nodes we have under the given root node. @@ -814,10 +862,18 @@ x86topo_add_sched_group(struct topo_node *root, struct cpu_group *cg_root) nchildren = 0; node = root; while (node != NULL) { - if ((node->type != TOPO_TYPE_GROUP && - node->type != TOPO_TYPE_CACHE) || - (root->type != TOPO_TYPE_SYSTEM && - CPU_CMP(&node->cpuset, &root->cpuset) == 0)) { + if (CPU_CMP(&node->cpuset, &root->cpuset) == 0) { + if (node->type == TOPO_TYPE_CACHE && + cg_root->cg_level < node->subtype) + cg_root->cg_level = node->subtype; + if (node->type == TOPO_TYPE_NODE) + cg_root->cg_flags |= CG_FLAG_NODE; + node = topo_next_node(root, node); + continue; + } + if (node->type != TOPO_TYPE_GROUP && + node->type != TOPO_TYPE_NODE && + node->type != TOPO_TYPE_CACHE) { node = topo_next_node(root, node); continue; } @@ -842,9 +898,9 @@ x86topo_add_sched_group(struct topo_node *root, struct cpu_group *cg_root) i = 0; while (node != NULL) { if ((node->type != TOPO_TYPE_GROUP && + node->type != TOPO_TYPE_NODE && node->type != TOPO_TYPE_CACHE) || - (root->type != TOPO_TYPE_SYSTEM && - CPU_CMP(&node->cpuset, &root->cpuset) == 0)) { + CPU_CMP(&node->cpuset, &root->cpuset) == 0) { node = topo_next_node(root, node); continue; } From owner-dev-commits-src-all@freebsd.org Thu Sep 23 19:14:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61F506ABE44; Thu, 23 Sep 2021 19:14: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 4HFlG5277Yz3sVm; Thu, 23 Sep 2021 19:14: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 2888E770; Thu, 23 Sep 2021 19:14: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 18NJELok023087; Thu, 23 Sep 2021 19:14:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18NJELZU023086; Thu, 23 Sep 2021 19:14:21 GMT (envelope-from git) Date: Thu, 23 Sep 2021 19:14:21 GMT Message-Id: <202109231914.18NJELZU023086@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: f555b39e6bb7 - main - 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/main X-Git-Reftype: branch X-Git-Commit: f555b39e6bb7cbfbe1905e90f64c4dfc4456fabb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 19:14:21 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=f555b39e6bb7cbfbe1905e90f64c4dfc4456fabb commit f555b39e6bb7cbfbe1905e90f64c4dfc4456fabb Author: Kyle Evans AuthorDate: 2021-09-22 19:58:19 +0000 Commit: Kyle Evans CommitDate: 2021-09-23 19:13:34 +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. Differential Revision: https://reviews.freebsd.org/D32063 --- usr.bin/man/man.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh index f31c464fcc8f..084f4a06829b 100755 --- a/usr.bin/man/man.sh +++ b/usr.bin/man/man.sh @@ -243,6 +243,7 @@ is_newer() { manpath_parse_args() { local cmd_arg + OPTIND=1 while getopts 'Ldq' cmd_arg; do case "${cmd_arg}" in L) Lflag=Lflag ;; @@ -426,6 +427,7 @@ man_display_page_groff() { if [ -n "$MANROFFSEQ" ]; then set -- -$MANROFFSEQ + OPTIND=1 while getopts 'egprtv' preproc_arg; do case "${preproc_arg}" in e) pipeline="$pipeline | $EQN" ;; @@ -545,6 +547,7 @@ man_find_and_display() { man_parse_args() { local IFS cmd_arg + OPTIND=1 while getopts 'M:P:S:adfhkm:op:tw' cmd_arg; do case "${cmd_arg}" in M) MANPATH=$OPTARG ;; @@ -933,6 +936,7 @@ trim() { # Parse commandline args for whatis and apropos. whatis_parse_args() { local cmd_arg + OPTIND=1 while getopts 'd' cmd_arg; do case "${cmd_arg}" in d) debug=$(( $debug + 1 )) ;; From owner-dev-commits-src-all@freebsd.org Thu Sep 23 19:42:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27FC06AC177; Thu, 23 Sep 2021 19:42: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 4HFlt00Mv4z4Rbx; Thu, 23 Sep 2021 19:42: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 E2391F1F; Thu, 23 Sep 2021 19:41: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 18NJfxUL062033; Thu, 23 Sep 2021 19:41:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18NJfxOJ062032; Thu, 23 Sep 2021 19:41:59 GMT (envelope-from git) Date: Thu, 23 Sep 2021 19:41:59 GMT Message-Id: <202109231941.18NJfxOJ062032@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: d5ad2f2a67df - main - 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/main X-Git-Reftype: branch X-Git-Commit: d5ad2f2a67df54ac40148cca21e726bc61a48982 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 19:42:00 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d5ad2f2a67df54ac40148cca21e726bc61a48982 commit d5ad2f2a67df54ac40148cca21e726bc61a48982 Author: Wenzhuo Lu AuthorDate: 2015-10-16 02:51:09 +0000 Commit: Kevin Bowling CommitDate: 2021-09-23 19:41:37 +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 --- sys/dev/e1000/e1000_ich8lan.c | 45 ++++++++++++++++++++++++++++++++++++++++++- sys/dev/e1000/e1000_ich8lan.h | 1 + sys/dev/e1000/e1000_phy.h | 7 +++++++ 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 4209595a911c..3f3e2307f83f 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -1728,7 +1728,6 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) if (ret_val) return ret_val; } - /* Clear link partner's EEE ability */ hw->dev_spec.ich8lan.eee_lp_ability = 0; @@ -1749,6 +1748,9 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) fextnvm6 &= ~E1000_FEXTNVM6_K1_OFF_ENABLE; E1000_WRITE_REG(hw, E1000_FEXTNVM6, fextnvm6); + + /* Configure K0s minimum time */ + e1000_configure_k0s_lpt(hw, K1_ENTRY_LATENCY, K1_MIN_TIME); } if (!link) @@ -6144,3 +6146,44 @@ release: } } +/** + * e1000_configure_k0s_lpt - Configure K0s power state + * @hw: pointer to the HW structure + * @entry_latency: Tx idle period for entering K0s - valid values are 0 to 3. + * 0 corresponds to 128ns, each value over 0 doubles the duration. + * @min_time: Minimum Tx idle period allowed - valid values are 0 to 4. + * 0 corresponds to 128ns, each value over 0 doubles the duration. + * + * Configure the K1 power state based on the provided parameter. + * Assumes semaphore already acquired. + * + * Success returns 0, Failure returns: + * -E1000_ERR_PHY (-2) in case of access error + * -E1000_ERR_PARAM (-4) in case of parameters error + **/ +s32 e1000_configure_k0s_lpt(struct e1000_hw *hw, u8 entry_latency, u8 min_time) +{ + s32 ret_val; + u16 kmrn_reg = 0; + + DEBUGFUNC("e1000_configure_k0s_lpt"); + + if (entry_latency > 3 || min_time > 4) + return -E1000_ERR_PARAM; + + ret_val = e1000_read_kmrn_reg_locked(hw, E1000_KMRNCTRLSTA_K0S_CTRL, + &kmrn_reg); + if (ret_val) + return ret_val; + + /* for now don't touch the latency */ + kmrn_reg &= ~(E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_MASK); + kmrn_reg |= ((min_time << E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_SHIFT)); + + ret_val = e1000_write_kmrn_reg_locked(hw, E1000_KMRNCTRLSTA_K0S_CTRL, + kmrn_reg); + if (ret_val) + return ret_val; + + return E1000_SUCCESS; +} diff --git a/sys/dev/e1000/e1000_ich8lan.h b/sys/dev/e1000/e1000_ich8lan.h index caff11cbb899..dfa7684f27b7 100644 --- a/sys/dev/e1000/e1000_ich8lan.h +++ b/sys/dev/e1000/e1000_ich8lan.h @@ -337,6 +337,7 @@ void e1000_gig_downshift_workaround_ich8lan(struct e1000_hw *hw); void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw); u32 e1000_resume_workarounds_pchlan(struct e1000_hw *hw); s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable); +s32 e1000_configure_k0s_lpt(struct e1000_hw *hw, u8 entry_latency, u8 min_time); void e1000_copy_rx_addrs_to_phy_ich8lan(struct e1000_hw *hw); s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable); s32 e1000_read_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 *data); diff --git a/sys/dev/e1000/e1000_phy.h b/sys/dev/e1000/e1000_phy.h index 38c8f9b466ce..3a5b231b8bce 100644 --- a/sys/dev/e1000/e1000_phy.h +++ b/sys/dev/e1000/e1000_phy.h @@ -281,6 +281,13 @@ s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, #define E1000_KMRNCTRLSTA_K1_CONFIG 0x7 #define E1000_KMRNCTRLSTA_K1_ENABLE 0x0002 /* enable K1 */ #define E1000_KMRNCTRLSTA_HD_CTRL 0x10 /* Kumeran HD Control */ +#define E1000_KMRNCTRLSTA_K0S_CTRL 0x1E /* Kumeran K0s Control */ +#define E1000_KMRNCTRLSTA_K0S_CTRL_ENTRY_LTNCY_SHIFT 0 +#define E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_SHIFT 4 +#define E1000_KMRNCTRLSTA_K0S_CTRL_ENTRY_LTNCY_MASK \ + (3 << E1000_KMRNCTRLSTA_K0S_CTRL_ENTRY_LTNCY_SHIFT) +#define E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_MASK \ + (7 << E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_SHIFT) #define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10 #define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY Special Ctrl */ From owner-dev-commits-src-all@freebsd.org Thu Sep 23 19:49:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C00416ACAB1; Thu, 23 Sep 2021 19:49:50 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFm321gbTz4SRj; Thu, 23 Sep 2021 19:49:50 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf1-x129.google.com with SMTP id b20so30756974lfv.3; Thu, 23 Sep 2021 12:49:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=XiJw4+GFywfOxX/Q6qdOST9xQ20TtUjHiJ6sfqNR+6M=; b=NQA51JuU3Fr83LF+0Drfm25eW6G2EeRxjqPvcUHx85MQJZ48DUVj7n+/cRU9r57mh7 IOunsRbBWsCvcU3b2kHe8GwhRY0ZHs6Ezuoix4RZggoeh/kEocMMkIO9oIochcbSC2J8 RC6SLNo4T5NwAJIfnJk+IkC0IvpmeSKf+7qXG12YepGpclqTFHPN114MVBhZhBW1Y3b2 ePnzjjPk7wcrPDFbgdRsKcrI+0Hw+YLVr9ORZxaikrJFXs06gG9UJH4BfYJGKeIuMnHL AhAeXf/H+huoKmLchM0H6oAfgg6gz87q6cY2fNi9lxh9wLMsFuO409/bWa+wHj4rfZ7j oAEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=XiJw4+GFywfOxX/Q6qdOST9xQ20TtUjHiJ6sfqNR+6M=; b=BXyozgW2qsJFH/Ch9X5JnEDHYUYIiB3j7XSCBhh4dScaVlu+2fZNh9fn5qikDOakXs X6WrH+ZUhL22Y6uhEzJH4Z1hcaHPeEOFiDBVmqa21KNiE+43uJvQqhddU+O9PVrKUeGR yp2DLEA1DL3EDJlBxsXdLiIBiPVvsqEkSa563y5dzMGBtPrUg2HNhi+ff3kWDJJVwQp4 WqIUY4OZA9FT6kYMIAVH8Kei8DMcgf553fHA8NbRV8JkOvEAitbze6RjsZkkpNC3LUhf VUczbgZZNVFhF38+7FYMtL47HSV453btPgoCOCSfXmUBj97p7gijPifR9sJAFijOwtKg wc/g== X-Gm-Message-State: AOAM533YhuKLp05d2XxvhTPqwSQMGW6obE3Bw2TZ5jmTK+tnrxiR6M23 pGlXa5mTYeXBkE5RwFJvLPiWZFScCFm6Hy8qeMpuyANx X-Google-Smtp-Source: ABdhPJzOYWzRZfYArTxw4NQWtwu1WUKu2qm0zTb90/s4/rlzci9i+oNIE24q4hgfuRfwIxlfgRVttVRu971H+l8RvtM= X-Received: by 2002:a19:ee12:: with SMTP id g18mr5692456lfb.300.1632426588797; Thu, 23 Sep 2021 12:49:48 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:2f18:0:0:0:0:0 with HTTP; Thu, 23 Sep 2021 12:49:47 -0700 (PDT) In-Reply-To: <202109211721.18LHLFWM028927@gitrepo.freebsd.org> References: <202109211721.18LHLFWM028927@gitrepo.freebsd.org> From: Mateusz Guzik Date: Thu, 23 Sep 2021 21:49:47 +0200 Message-ID: Subject: Re: git: df8dd6025af8 - main - amd64: stop using top of the thread' kernel stack for FPU user save area To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4HFm321gbTz4SRj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=NQA51JuU; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::129 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000]; TO_DN_SOME(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::129:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 19:49:50 -0000 On 9/21/21, Konstantin Belousov wrote: > The branch main has been updated by kib: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=df8dd6025af88a99d34f549fa9591a9b8f9b75b1 > > commit df8dd6025af88a99d34f549fa9591a9b8f9b75b1 > Author: Konstantin Belousov > AuthorDate: 2021-09-13 21:05:47 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-09-21 17:20:15 +0000 > > amd64: stop using top of the thread' kernel stack for FPU user save > area > This causes KASAN to crash on boot: panic: ASan: Invalid access, 192-byte read at 0xffffffff84105f40, UseAfterScope(f8) cpuid = 0 time = 1 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0xa5/frame 0xffffffff841056f0 kdb_backtrace() at kdb_backtrace+0xc9/frame 0xffffffff84105850 vpanic() at vpanic+0x248/frame 0xffffffff84105930 panic() at panic+0xb5/frame 0xffffffff841059f0 kasan_memmove() at kasan_memmove+0x313/frame 0xffffffff84105ac0 cpu_fork() at cpu_fork+0x19b/frame 0xffffffff84105b30 vm_forkproc() at vm_forkproc+0x18f/frame 0xffffffff84105b90 fork1() at fork1+0x1ff4/frame 0xffffffff84105d10 kproc_create() at kproc_create+0x166/frame 0xffffffff84105eb0 audit_worker_init() at audit_worker_init+0x41/frame 0xffffffff84105ed0 mi_startup() at mi_startup+0x340/frame 0xffffffff84105ff0 btext() at btext+0x22 > Instead do one more allocation at the thread creation time. This frees > a lot of space on the stack. > > Also do not use alloca() for temporal storage in signal delivery > sendsig() > function and signal return syscall sys_sigreturn(). This saves equal > amount of space, again by the cost of one more allocation at the thread > creation time. > > A useful experiment now would be to reduce KSTACK_PAGES. > > Reviewed by: jhb, markj > Tested by: pho > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D31954 > --- > sys/amd64/amd64/exec_machdep.c | 4 ++-- > sys/amd64/amd64/fpu.c | 2 ++ > sys/amd64/amd64/machdep.c | 14 -------------- > sys/amd64/amd64/vm_machdep.c | 22 +++++++++++++--------- > sys/amd64/ia32/ia32_signal.c | 6 +++--- > sys/amd64/include/proc.h | 2 ++ > sys/kern/kern_thread.c | 2 +- > 7 files changed, 23 insertions(+), 29 deletions(-) > > diff --git a/sys/amd64/amd64/exec_machdep.c > b/sys/amd64/amd64/exec_machdep.c > index 1297117638d6..48bda05f9685 100644 > --- a/sys/amd64/amd64/exec_machdep.c > +++ b/sys/amd64/amd64/exec_machdep.c > @@ -135,7 +135,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) > > if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { > xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); > - xfpusave = __builtin_alloca(xfpusave_len); > + xfpusave = (char *)td->td_md.md_fpu_scratch; > } else { > xfpusave_len = 0; > xfpusave = NULL; > @@ -674,7 +674,7 @@ set_mcontext(struct thread *td, mcontext_t *mcp) > if (mcp->mc_xfpustate_len > cpu_max_ext_state_size - > sizeof(struct savefpu)) > return (EINVAL); > - xfpustate = __builtin_alloca(mcp->mc_xfpustate_len); > + xfpustate = (char *)td->td_md.md_fpu_scratch; > ret = copyin((void *)mcp->mc_xfpustate, xfpustate, > mcp->mc_xfpustate_len); > if (ret != 0) > diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c > index d7936b3b1922..24986958d4ca 100644 > --- a/sys/amd64/amd64/fpu.c > +++ b/sys/amd64/amd64/fpu.c > @@ -448,6 +448,8 @@ fpuinitstate(void *arg __unused) > xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO); > } > > + cpu_thread_alloc(&thread0); > + > saveintr = intr_disable(); > stop_emulating(); > > diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c > index d4e2356a9ae1..5c9b64526609 100644 > --- a/sys/amd64/amd64/machdep.c > +++ b/sys/amd64/amd64/machdep.c > @@ -1258,7 +1258,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) > caddr_t kmdp; > int gsel_tss, x; > struct pcpu *pc; > - struct xstate_hdr *xhdr; > uint64_t cr3, rsp0; > pml4_entry_t *pml4e; > pdp_entry_t *pdpe; > @@ -1564,19 +1563,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) > msgbufinit(msgbufp, msgbufsize); > fpuinit(); > > - /* > - * Reinitialize thread0's stack base now that the xsave area size is > - * known. Set up thread0's pcb save area after fpuinit calculated fpu > - * save area size. Zero out the extended state header in fpu save area. > - */ > - set_top_of_stack_td(&thread0); > - thread0.td_pcb->pcb_save = get_pcb_user_save_td(&thread0); > - bzero(thread0.td_pcb->pcb_save, cpu_max_ext_state_size); > - if (use_xsave) { > - xhdr = (struct xstate_hdr *)(get_pcb_user_save_td(&thread0) + > - 1); > - xhdr->xstate_bv = xsave_mask; > - } > /* make an initial tss so cpu can get interrupt stack on syscall! */ > rsp0 = thread0.td_md.md_stack_base; > /* Ensure the stack is aligned to 16 bytes */ > diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c > index 4567e6e0eb5d..e42d16d61b3a 100644 > --- a/sys/amd64/amd64/vm_machdep.c > +++ b/sys/amd64/amd64/vm_machdep.c > @@ -90,19 +90,17 @@ void > set_top_of_stack_td(struct thread *td) > { > td->td_md.md_stack_base = td->td_kstack + > - td->td_kstack_pages * PAGE_SIZE - > - roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN); > + td->td_kstack_pages * PAGE_SIZE; > } > > struct savefpu * > get_pcb_user_save_td(struct thread *td) > { > - vm_offset_t p; > - > - p = td->td_md.md_stack_base; > - KASSERT((p % XSAVE_AREA_ALIGN) == 0, > - ("Unaligned pcb_user_save area ptr %#lx td %p", p, td)); > - return ((struct savefpu *)p); > + KASSERT(((vm_offset_t)td->td_md.md_usr_fpu_save % > + XSAVE_AREA_ALIGN) == 0, > + ("Unaligned pcb_user_save area ptr %p td %p", > + td->td_md.md_usr_fpu_save, td)); > + return (td->td_md.md_usr_fpu_save); > } > > struct pcb * > @@ -393,6 +391,8 @@ cpu_thread_alloc(struct thread *td) > set_top_of_stack_td(td); > td->td_pcb = pcb = get_pcb_td(td); > td->td_frame = (struct trapframe *)td->td_md.md_stack_base - 1; > + td->td_md.md_usr_fpu_save = fpu_save_area_alloc(); > + td->td_md.md_fpu_scratch = fpu_save_area_alloc(); > pcb->pcb_save = get_pcb_user_save_pcb(pcb); > if (use_xsave) { > xhdr = (struct xstate_hdr *)(pcb->pcb_save + 1); > @@ -404,8 +404,12 @@ cpu_thread_alloc(struct thread *td) > void > cpu_thread_free(struct thread *td) > { > - > cpu_thread_clean(td); > + > + fpu_save_area_free(td->td_md.md_usr_fpu_save); > + td->td_md.md_usr_fpu_save = NULL; > + fpu_save_area_free(td->td_md.md_fpu_scratch); > + td->td_md.md_fpu_scratch = NULL; > } > > bool > diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c > index 49b5797d68fd..9b67c7001a87 100644 > --- a/sys/amd64/ia32/ia32_signal.c > +++ b/sys/amd64/ia32/ia32_signal.c > @@ -210,7 +210,7 @@ ia32_set_mcontext(struct thread *td, struct > ia32_mcontext *mcp) > if (mcp->mc_xfpustate_len > cpu_max_ext_state_size - > sizeof(struct savefpu)) > return (EINVAL); > - xfpustate = __builtin_alloca(mcp->mc_xfpustate_len); > + xfpustate = (char *)td->td_md.md_fpu_scratch; > ret = copyin(PTRIN(mcp->mc_xfpustate), xfpustate, > mcp->mc_xfpustate_len); > if (ret != 0) > @@ -579,7 +579,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t > *mask) > > if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { > xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); > - xfpusave = __builtin_alloca(xfpusave_len); > + xfpusave = (char *)td->td_md.md_fpu_scratch; > } else { > xfpusave_len = 0; > xfpusave = NULL; > @@ -882,7 +882,7 @@ freebsd32_sigreturn(td, uap) > td->td_proc->p_pid, td->td_name, xfpustate_len); > return (EINVAL); > } > - xfpustate = __builtin_alloca(xfpustate_len); > + xfpustate = (char *)td->td_md.md_fpu_scratch; > error = copyin(PTRIN(ucp->uc_mcontext.mc_xfpustate), > xfpustate, xfpustate_len); > if (error != 0) { > diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h > index 0f8cf50e326d..bd07f70f8d44 100644 > --- a/sys/amd64/include/proc.h > +++ b/sys/amd64/include/proc.h > @@ -75,6 +75,8 @@ struct mdthread { > int md_efirt_dis_pf; /* (k) */ > struct pcb md_pcb; > vm_offset_t md_stack_base; > + struct savefpu *md_usr_fpu_save; > + struct savefpu *md_fpu_scratch; > }; > > struct mdproc { > diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c > index 65c5cc65c87e..62f939406374 100644 > --- a/sys/kern/kern_thread.c > +++ b/sys/kern/kern_thread.c > @@ -91,7 +91,7 @@ _Static_assert(offsetof(struct thread, td_pflags) == > 0x110, > "struct thread KBI td_pflags"); > _Static_assert(offsetof(struct thread, td_frame) == 0x4a8, > "struct thread KBI td_frame"); > -_Static_assert(offsetof(struct thread, td_emuldata) == 0x6b0, > +_Static_assert(offsetof(struct thread, td_emuldata) == 0x6c0, > "struct thread KBI td_emuldata"); > _Static_assert(offsetof(struct proc, p_flag) == 0xb8, > "struct proc KBI p_flag"); > -- Mateusz Guzik From owner-dev-commits-src-all@freebsd.org Thu Sep 23 19:56:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8695F6AC9ED; Thu, 23 Sep 2021 19:56:28 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFmBh3DHxz4SkZ; Thu, 23 Sep 2021 19:56:28 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x735.google.com with SMTP id f130so25317482qke.6; Thu, 23 Sep 2021 12:56:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Pl2I8+3Ws+8/ONyGOYuOszrFjYUxcpQIOF1aFxlQIO8=; b=VIY6B4OoaBFUFERugOrXnJX32ErUXG0kPNO/n87th65XeJSSqoFajX8V6+7w5CbgXu mcPBOhvdnSiYXQ1FjK2Qn9rszNz9ioyJNR/bbXBVe1p84Un+5fErF98MtV8lcpxjEHEl sWforFCMuc41FwX3ZWj6I+c6Gbqh406rCKIeVg3jOvduTBcKne1efoyMKUGcW9P7b0rw cIlK2QS/a6e4OGzdptHwMwPhV6/CFoGEPidjCurTVnx5k8qK1fOeogzAqmb56iXcXSWn OihZjX8sGtZ7WwQnII82Ej/UJ7o5k+aN2FOVblCD/zv8T1N/Iik7z6Jv5Uo62b964BOn 9iLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=Pl2I8+3Ws+8/ONyGOYuOszrFjYUxcpQIOF1aFxlQIO8=; b=xDPA59dasQ9fyk70xTJGRJqPe9k/s7VynZkaMVD7R7Skeo0a7LcJhgQeExLVmOy6Vv ldKr3pvObjEt7Ihq7kVPrc82X2dGkaJXfG9PVA6CtGeROgzvcR+r5Ds57/Ba/MGOlWfU lT8S2r3KGBU53fC473f8qeP6qdRw7CbcRc4eeMcWpATE3qGK/28UZU1aHR1PPFfs59gH puJqfbAyhXkSi5MQx/lHSBPoDfIsz3HGi1fqKX7aVgxhvIgjKjSpbVYCANSFBGLf9aiL YRX8dXnjsDdU+diCMYn8WqtkOXNiivpJklpkVQWmUMdq0rkbEQtErMHgCzGmsS+SHabt /XOg== X-Gm-Message-State: AOAM5326ucFPGgTeY+EZTNVXC7pz5ovh8tn/ws3j6IYoxKPbfD+X55lY r3JzWfs2pXd+KKEvWloTW2sXIDfhtPqtBw== X-Google-Smtp-Source: ABdhPJwJ+enNRNO2PT39zOO5Jz9mEYkwcubcMHiS26tP0oS+S8h83Fhi+eEyAJ7ueQN+3mh5YT0Fnw== X-Received: by 2002:a37:bb07:: with SMTP id l7mr6806984qkf.123.1632426982510; Thu, 23 Sep 2021 12:56:22 -0700 (PDT) Received: from nuc ([142.126.175.192]) by smtp.gmail.com with ESMTPSA id d17sm4140983qte.0.2021.09.23.12.56.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Sep 2021 12:56:21 -0700 (PDT) Sender: Mark Johnston Date: Thu, 23 Sep 2021 15:56:22 -0400 From: Mark Johnston To: Mateusz Guzik Cc: Konstantin Belousov , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: df8dd6025af8 - main - amd64: stop using top of the thread' kernel stack for FPU user save area Message-ID: References: <202109211721.18LHLFWM028927@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4HFmBh3DHxz4SkZ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 19:56:28 -0000 On Thu, Sep 23, 2021 at 09:49:47PM +0200, Mateusz Guzik wrote: > On 9/21/21, Konstantin Belousov wrote: > > The branch main has been updated by kib: > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=df8dd6025af88a99d34f549fa9591a9b8f9b75b1 > > > > commit df8dd6025af88a99d34f549fa9591a9b8f9b75b1 > > Author: Konstantin Belousov > > AuthorDate: 2021-09-13 21:05:47 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2021-09-21 17:20:15 +0000 > > > > amd64: stop using top of the thread' kernel stack for FPU user save > > area > > > > This causes KASAN to crash on boot: > > panic: ASan: Invalid access, 192-byte read at 0xffffffff84105f40, Try grabbing https://reviews.freebsd.org/D32057 From owner-dev-commits-src-all@freebsd.org Thu Sep 23 19:57:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 742D26AC8EC; Thu, 23 Sep 2021 19: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 4HFmCx2Knpz4SjH; Thu, 23 Sep 2021 19: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 2FCD9C46; Thu, 23 Sep 2021 19: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 18NJvXR6077416; Thu, 23 Sep 2021 19: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 18NJvXeC077415; Thu, 23 Sep 2021 19:57:33 GMT (envelope-from git) Date: Thu, 23 Sep 2021 19:57:33 GMT Message-Id: <202109231957.18NJvXeC077415@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: cb13059663e4 - main - 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/main X-Git-Reftype: branch X-Git-Commit: cb13059663e455b3fc69c293dadec53c164490dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 19:57:33 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=cb13059663e455b3fc69c293dadec53c164490dc commit cb13059663e455b3fc69c293dadec53c164490dc Author: Kristof Provost AuthorDate: 2021-09-23 08:39:49 +0000 Commit: Kristof Provost CommitDate: 2021-09-23 19:56:59 +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 --- 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 e7e37d5a6d5a..3242c51a2c66 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -5006,11 +5006,14 @@ pf_getstatus(struct pfioc_nv *nv) else if (nv->size < nv->len) ERROUT(ENOSPC); + PF_RULES_RUNLOCK(); error = copyout(nvlpacked, nv->data, nv->len); + goto done; #undef ERROUT errout: PF_RULES_RUNLOCK(); +done: free(nvlpacked, M_NVLIST); nvlist_destroy(nvc); nvlist_destroy(nvl); From owner-dev-commits-src-all@freebsd.org Thu Sep 23 20:06:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BF6ED6AD151; Thu, 23 Sep 2021 20:06:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFmQ14hwsz4VNf; Thu, 23 Sep 2021 20:06:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1632427577; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JDhCGMB56RKOy0VkTd7niwAG2so4Oh2gyzMFBtwkkeQ=; b=NvhARjB+dAeha2gG4xrRMKUuBaercq646dUNHD0LxovgEQk1lQyg5Sq8iC1Aodn87X4H2E fPyE8zOZQuxumUHA9Y/0wowlVzEb0Fkkwt/tYtPWNGaKNdXpzqQiseMlgNLm6D+tv+RZJv KF3KtiJ+EsYTdTGM0NdGY+3VczKku1EscWAqqBPJwjCA4nbWAgZdm9yKlM4hjOrQ1DRHms gkrx7633R7303SW97+sO0HJHzB6UoitBMEnWv/fcJFY/KR2ebZr5s+dh2Lz6z2SSdGs9mg LJSOFK9zqr4vASHajK1DOPPLhy4Sa6nhKEblUwpA3Ww0FglObPtuusk6NXOx7Q== Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 6221717A01; Thu, 23 Sep 2021 20:06:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 7836D214B8; Thu, 23 Sep 2021 13:06:16 -0700 (PDT) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id kyAA-_PZ1_Bh; Thu, 23 Sep 2021 13:06:13 -0700 (PDT) Subject: Re: git: f555b39e6bb7 - main - man: reset OPTIND before parsing args DKIM-Filter: OpenDKIM Filter v2.10.3 mail.xzibition.com 3C4E7214AC To: Kyle Evans , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202109231914.18NJELZU023086@gitrepo.freebsd.org> From: Bryan Drewery Organization: FreeBSD Message-ID: <33438d0b-1925-8d44-83bb-62054b141635@FreeBSD.org> Date: Thu, 23 Sep 2021 13:06:12 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <202109231914.18NJELZU023086@gitrepo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XInPtLUnSy9zfyorvKeTTNAg8D5LojOC5" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1632427577; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JDhCGMB56RKOy0VkTd7niwAG2so4Oh2gyzMFBtwkkeQ=; b=JbmvAB6qK3K4C9uQ+a4gn+V1Ch1HGMe3IKLjA7Mx3XWfaFGV2vp82VchXnLsIA4I3M5is/ OJzs+kBV654jAljcDt6gqR5k9feEYokTiIw2wEIFPioo7bu06eAv8BqpQLG2cmtxrv3/Ku iwjuRlvGHdFQVeGkFEl/uCpA4cTlHajdmoOqFzSu4p3cojY3RHCy49IRWP3xa6nIKBjSM5 GNdjenj5mOZnPBzhi8apK7QdnlJvyJ47NHXp52YmL2EqRkOApEfOc74u//WvJtTQOSZeIZ CWh4xc1zKzYqGM8cxSIHXVl5fTWAxUDyMeKnYGMMShhwedRCjVLHFKl8cRWQYw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1632427577; a=rsa-sha256; cv=none; b=o7GG0zYAmW/BPNfL9ztHnVfSptBDRLADcxA+L0Y0fQAoBiP5e0nKxjUyu6Zx9gxl/Q9tnu 1KJR3OnML1U0xrEVBy/VGoJS/uoprfcHHLxem8BQe2px8+2UU6XDSivGif1eeFxuCeIZ1v Fe1Y2EP3Y8bd0YPwomPmJ+4A1lw5u7Eba8ipps74RQqdocbIBkmh+Jly29BQ63aaY3hgDQ m8d1IocR0MUCqTFpkryYfBzutD2aAMleYKhq3vj1dI7/WPAgCJEZiJbEA/s/9JXc4oboal PhCtNAJPdWMma+lozSks5Gzy/pwxAfxkH4rhr0UTK4/DG1E7vqzbTo+wMq3MMA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 20:06:17 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --XInPtLUnSy9zfyorvKeTTNAg8D5LojOC5 Content-Type: multipart/mixed; boundary="mCNiFLnztWUqqQQdqoZG1wz328xTcPbXV"; protected-headers="v1" From: Bryan Drewery To: Kyle Evans , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Message-ID: <33438d0b-1925-8d44-83bb-62054b141635@FreeBSD.org> Subject: Re: git: f555b39e6bb7 - main - man: reset OPTIND before parsing args References: <202109231914.18NJELZU023086@gitrepo.freebsd.org> In-Reply-To: <202109231914.18NJELZU023086@gitrepo.freebsd.org> --mCNiFLnztWUqqQQdqoZG1wz328xTcPbXV Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 9/23/2021 12:14 PM, Kyle Evans wrote: > The branch main has been updated by kevans: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3Df555b39e6bb7cbfbe1905e90= f64c4dfc4456fabb >=20 > commit f555b39e6bb7cbfbe1905e90f64c4dfc4456fabb > Author: Kyle Evans > AuthorDate: 2021-09-22 19:58:19 +0000 > Commit: Kyle Evans > CommitDate: 2021-09-23 19:13:34 +0000 >=20 > man: reset OPTIND before parsing args > =20 > From jilles: POSIX requires that a script set `OPTIND=3D1` before u= sing > different sets of parameters with `getopts`, or the results will be= > unspecified. > =20 > 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 th= e > 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. > =20 > Input from: jilles > Reviewed by: allanjude, bapt, imp > Sponsored by: Klara, Inc. > Differential Revision: https://reviews.freebsd.org/D32063 > --- > usr.bin/man/man.sh | 4 ++++ > 1 file changed, 4 insertions(+) >=20 > 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 > =20 > + OPTIND=3D1 > while getopts 'Ldq' cmd_arg; do > case "${cmd_arg}" in > L) Lflag=3DLflag ;; Not that it matters much but since this script makes use of 'local', OPTIND and OPTARG might as well be in the list as well. --=20 Bryan Drewery --mCNiFLnztWUqqQQdqoZG1wz328xTcPbXV-- --XInPtLUnSy9zfyorvKeTTNAg8D5LojOC5 Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEE+Rc8ssOq6npcih8JNddxu25Gl88FAmFM3jQFAwAAAAAACgkQNddxu25Gl8// fAf+O3YXbK0GFvjhmxxzbVODUS2kQAq/UlrYfcNxWsxd0xGlqSbdu+N2Ky5bsnDqVJ4f8kUlnDwa OSlDhox/c4STZBBnTHZPTrS6wHnon2QQbQpdFyEKgInRtSf3TfvChbHU2kkQIiPcr5uWEgSg4TwV GnzvAKhccr/iEy8Vo7x/mIuqoJKyVwNamSNzQcy15hwDue4/PkG4Bu5QKRtMJidBJ3w0Wi84GQ6I GAGb8leIiCSvuanNucPXMso5OwaJcCU+Qb/uIIwTok4x2Bm+mibmzu+bOGap6Jl1Uase/F19+tho hY4YVViWEQyMgB3NPe9vTi8cV0nTtMjS8z108Jyr3g== =X6MU -----END PGP SIGNATURE----- --XInPtLUnSy9zfyorvKeTTNAg8D5LojOC5-- From owner-dev-commits-src-all@freebsd.org Thu Sep 23 20:06:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 844C46AD15D; Thu, 23 Sep 2021 20:06:51 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFmQg36chz4VKk; Thu, 23 Sep 2021 20:06:51 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf1-x130.google.com with SMTP id b20so30948775lfv.3; Thu, 23 Sep 2021 13:06:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=CcihJp2kvRcbsJ6/bvBwLyanDY/36LBwphRYaZT3tUA=; b=K6OyHf0QjAwY+LZoI3BWRw5AnDl8Mua9Tb9dVKLeYtxgc0sy9CKPAFV/lT8QVF/f8g LHFyyGDHzUlU+uHYAoN8ekBY4c7XvZoJkduDanZOLYMlT7xVgga6i32ecce6gbxeuR7M 1jIuXiccZlrBLIk5u1hJFGUXGeBbGa9/NSwTYmpetYd0MGzeJ6rAKHFjeQ8TTsqhpalX ZFD8PakWFUL7Q+OKiVmuG+iC/AjlPZu6glvO2hv0Z05zuG5LMSo8Il/RNe/52gLVc3Mz 0O7A6xewKJkOqPLPSmRNcaZTqXUR6yuwAvKaoGWK7/rC7W2rxuIoi9PpUCG6z6WmUKsz k74A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=CcihJp2kvRcbsJ6/bvBwLyanDY/36LBwphRYaZT3tUA=; b=6N0N0lmYOjodTTvP5mqvoEXumAc0YRZQiGzRc4ft21B4JWmmCb637N6GdwK06eQqpV MtzY+5rn3xi0vtjIwzsM8B7Tnsq3lc/LaFqMRDIzubqMDdsXf+inpnWzpCXHKeOePWl4 wsUyK4bEThwL/MTjP2KGPwTCSk3FOoqvp0RkirfV4LOxbVOQ+zP8qEfRbiwKaND/BooS cRW0Z+RBJiUbr0CO0ovfRj9kiy8+wR8jVqwJOSqZ/kaKrHsXxdfuzk6S7pvFNmk6ohSZ 3KcK1VT0nW/i/SrtY/6uGBeWX+lXA4J6sfSD1cnDB44uIWhBffP5nDQMfmq8Nie+c9Aa p3NA== X-Gm-Message-State: AOAM531QcoQDtjA6idi86pbIhqZnMEKPKqUNp2omVoIUCxD9ghNP2W7C AQEp8yuv/WDbquwLT9GQNrBy+rwS5rj1kJS3+QPOUoAQ X-Google-Smtp-Source: ABdhPJyIwzauJnbVmBFnbx9D/xNQiXTMUj1mD3gFP7MHffHgknQoM7wlsTZeI9f5omrhEqAk64tin9rn5Hx8zdPqaXs= X-Received: by 2002:a2e:a231:: with SMTP id i17mr7092597ljm.233.1632427610226; Thu, 23 Sep 2021 13:06:50 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:2f18:0:0:0:0:0 with HTTP; Thu, 23 Sep 2021 13:06:49 -0700 (PDT) In-Reply-To: References: <202109211721.18LHLFWM028927@gitrepo.freebsd.org> From: Mateusz Guzik Date: Thu, 23 Sep 2021 22:06:49 +0200 Message-ID: Subject: Re: git: df8dd6025af8 - main - amd64: stop using top of the thread' kernel stack for FPU user save area To: Mark Johnston Cc: Konstantin Belousov , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4HFmQg36chz4VKk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 20:06:51 -0000 On 9/23/21, Mark Johnston wrote: > On Thu, Sep 23, 2021 at 09:49:47PM +0200, Mateusz Guzik wrote: >> On 9/21/21, Konstantin Belousov wrote: >> > The branch main has been updated by kib: >> > >> > URL: >> > https://cgit.FreeBSD.org/src/commit/?id=df8dd6025af88a99d34f549fa9591a9b8f9b75b1 >> > >> > commit df8dd6025af88a99d34f549fa9591a9b8f9b75b1 >> > Author: Konstantin Belousov >> > AuthorDate: 2021-09-13 21:05:47 +0000 >> > Commit: Konstantin Belousov >> > CommitDate: 2021-09-21 17:20:15 +0000 >> > >> > amd64: stop using top of the thread' kernel stack for FPU user save >> > area >> > >> >> This causes KASAN to crash on boot: >> >> panic: ASan: Invalid access, 192-byte read at 0xffffffff84105f40, > > Try grabbing https://reviews.freebsd.org/D32057 > This indeed takes care of it, thanks. -- Mateusz Guzik From owner-dev-commits-src-all@freebsd.org Fri Sep 24 00:08:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07EC56AF94B; Fri, 24 Sep 2021 00: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 4HFsnh6pP9z4vBY; Fri, 24 Sep 2021 00:08: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 C588446BA; Fri, 24 Sep 2021 00: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 18O08eCp009437; Fri, 24 Sep 2021 00: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 18O08e6K009436; Fri, 24 Sep 2021 00:08:40 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:08:40 GMT Message-Id: <202109240008.18O08e6K009436@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: ed03973908e5 - stable/13 - VOP_COPY_FILE_RANGE: Add a COPY_FILE_RANGE_TIMEO1SEC flag 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: ed03973908e5b9cfe41a156f8b78445c332fc864 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:08:41 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=ed03973908e5b9cfe41a156f8b78445c332fc864 commit ed03973908e5b9cfe41a156f8b78445c332fc864 Author: Rick Macklem AuthorDate: 2021-09-08 00:35:26 +0000 Commit: Rick Macklem CommitDate: 2021-09-24 00:04:29 +0000 VOP_COPY_FILE_RANGE: Add a COPY_FILE_RANGE_TIMEO1SEC flag Although it is not specified in the RFCs, the concept that the NFSv4 server should reply to an RPC request within a reasonable time is accepted practice within the NFSv4 community. Without this patch, the NFSv4.2 server attempts to reply to a Copy operation within 1second by limiting the copy to vfs.nfs.maxcopyrange bytes (default 10Mbytes). This is crude at best, given the large variation in I/O subsystem performance. This patch adds a kernel only flag COPY_FILE_RANGE_TIMEO1SEC that the NFSv4.2 can specify, which tells VOP_COPY_FILE_RANGE() to return after approximately 1 second with a partial result and implements this in vn_generic_copy_file_range(), used by vop_stdcopyfilerange(). Modifying the NFSv4.2 server to set this flag will be done in a separate patch. Also under consideration is exposing the COPY_FILE_RANGE_TIMEO1SEC to userland for use on the FreeBSD copy_file_range(2) syscall. Although this technically does change the VFS/VOP KAPI, I do not think the MFC will cause problems. (cherry picked from commit c5128c48df3c2f3828432aff2ea536bb9c887e14) --- sys/kern/vfs_vnops.c | 31 +++++++++++++++++++++++++++++-- sys/sys/vnode.h | 4 ++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 8f5442bf3429..8ff78b9d6319 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -3142,6 +3142,7 @@ vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp, size_t copylen, len, rem, savlen; char *dat; long holein, holeout; + struct timespec curts, endts; holein = holeout = 0; savlen = len = *lenp; @@ -3238,7 +3239,15 @@ vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp, * in the inner loop where the data copying is done. * Note that some file systems such as NFSv3, NFSv4.0 and NFSv4.1 may * support holes on the server, but do not support FIOSEEKHOLE. + * The kernel flag COPY_FILE_RANGE_TIMEO1SEC is used to indicate + * that this function should return after 1second with a partial + * completion. */ + if ((flags & COPY_FILE_RANGE_TIMEO1SEC) != 0) { + getnanouptime(&endts); + endts.tv_sec++; + } else + timespecclear(&endts); holetoeof = eof = false; while (len > 0 && error == 0 && !eof && interrupted == 0) { endoff = 0; /* To shut up compilers. */ @@ -3307,8 +3316,17 @@ vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp, *inoffp += xfer; *outoffp += xfer; len -= xfer; - if (len < savlen) + if (len < savlen) { interrupted = sig_intr(); + if (timespecisset(&endts) && + interrupted == 0) { + getnanouptime(&curts); + if (timespeccmp(&curts, + &endts, >=)) + interrupted = + EINTR; + } + } } } copylen = MIN(len, endoff - startoff); @@ -3371,8 +3389,17 @@ vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp, *outoffp += xfer; copylen -= xfer; len -= xfer; - if (len < savlen) + if (len < savlen) { interrupted = sig_intr(); + if (timespecisset(&endts) && + interrupted == 0) { + getnanouptime(&curts); + if (timespeccmp(&curts, + &endts, >=)) + interrupted = + EINTR; + } + } } } xfer = blksize; diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 8336fd859781..4a2581cb3db3 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -613,6 +613,10 @@ typedef void vop_getpages_iodone_t(void *, vm_page_t *, int, int); #define VN_OPEN_NAMECACHE 0x00000004 #define VN_OPEN_INVFS 0x00000008 +/* copy_file_range kernel flags */ +#define COPY_FILE_RANGE_KFLAGS 0xff000000 +#define COPY_FILE_RANGE_TIMEO1SEC 0x01000000 /* Return after 1sec. */ + /* * Public vnode manipulation functions. */ From owner-dev-commits-src-all@freebsd.org Fri Sep 24 00:15:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 32FE26AFBEE; Fri, 24 Sep 2021 00:15:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFsx50xDMz3BnF; Fri, 24 Sep 2021 00:15:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0040D42F6; Fri, 24 Sep 2021 00:15: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 18O0F4L0022163; Fri, 24 Sep 2021 00:15:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0F4BS022162; Fri, 24 Sep 2021 00:15:04 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:15:04 GMT Message-Id: <202109240015.18O0F4BS022162@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 502dc84a8b67 - main - nvme: Use shared timeout rather than timeout per transaction MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 502dc84a8b6703e7c0626739179a3cdffdd22d81 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:15:05 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=502dc84a8b6703e7c0626739179a3cdffdd22d81 commit 502dc84a8b6703e7c0626739179a3cdffdd22d81 Author: Warner Losh AuthorDate: 2021-09-23 22:31:32 +0000 Commit: Warner Losh CommitDate: 2021-09-23 22:42:08 +0000 nvme: Use shared timeout rather than timeout per transaction Keep track of the approximate time commands are 'due' and the next deadline for a command. twice a second, wake up to see if any commands have entered timeout. If so, quiessce and then enter a recovery mode half the timeout further in the future to allow the ISR to complete. Once we exit recovery mode, we go back to operations as normal. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D28583 --- sys/dev/nvme/nvme_ctrlr.c | 8 +- sys/dev/nvme/nvme_private.h | 16 +++- sys/dev/nvme/nvme_qpair.c | 173 ++++++++++++++++++++++++++++---------------- 3 files changed, 131 insertions(+), 66 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 833bf328584a..39cde3f065dd 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -232,7 +232,8 @@ nvme_ctrlr_post_failed_request(struct nvme_controller *ctrlr, mtx_lock(&ctrlr->lock); STAILQ_INSERT_TAIL(&ctrlr->fail_req, req, stailq); mtx_unlock(&ctrlr->lock); - taskqueue_enqueue(ctrlr->taskqueue, &ctrlr->fail_req_task); + if (!ctrlr->is_dying) + taskqueue_enqueue(ctrlr->taskqueue, &ctrlr->fail_req_task); } static void @@ -435,7 +436,8 @@ nvme_ctrlr_reset(struct nvme_controller *ctrlr) */ return; - taskqueue_enqueue(ctrlr->taskqueue, &ctrlr->reset_task); + if (!ctrlr->is_dying) + taskqueue_enqueue(ctrlr->taskqueue, &ctrlr->reset_task); } static int @@ -1481,6 +1483,8 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev) { int gone, i; + ctrlr->is_dying = true; + if (ctrlr->resource == NULL) goto nores; if (!mtx_initialized(&ctrlr->adminq.lock)) diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index fba1b406e9ce..02cecaf03a97 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -151,7 +151,7 @@ struct nvme_tracker { TAILQ_ENTRY(nvme_tracker) tailq; struct nvme_request *req; struct nvme_qpair *qpair; - struct callout timer; + sbintime_t deadline; bus_dmamap_t payload_dma_map; uint16_t cid; @@ -159,6 +159,12 @@ struct nvme_tracker { bus_addr_t prp_bus_addr; }; +enum nvme_recovery { + RECOVERY_NONE = 0, /* Normal operations */ + RECOVERY_START, /* Deadline has passed, start recovering */ + RECOVERY_RESET, /* This pass, initiate reset of controller */ + RECOVERY_WAITING, /* waiting for the reset to complete */ +}; struct nvme_qpair { struct nvme_controller *ctrlr; uint32_t id; @@ -170,6 +176,11 @@ struct nvme_qpair { struct resource *res; void *tag; + struct callout timer; + sbintime_t deadline; + bool timer_armed; + enum nvme_recovery recovery_state; + uint32_t num_entries; uint32_t num_trackers; uint32_t sq_tdbl_off; @@ -201,8 +212,6 @@ struct nvme_qpair { struct nvme_tracker **act_tr; - bool is_enabled; - struct mtx lock __aligned(CACHE_LINE_SIZE); } __aligned(CACHE_LINE_SIZE); @@ -305,6 +314,7 @@ struct nvme_controller { uint32_t notification_sent; bool is_failed; + bool is_dying; STAILQ_HEAD(, nvme_request) fail_req; /* Host Memory Buffer */ diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 71718acff66f..7a17a057f319 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -452,7 +452,6 @@ nvme_qpair_complete_tracker(struct nvme_tracker *tr, } mtx_lock(&qpair->lock); - callout_stop(&tr->timer); if (retry) { req->retries++; @@ -544,7 +543,7 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair) * progress. Ignore the interrupt - any I/O that was associated with * this interrupt will get retried when the reset is complete. */ - if (!qpair->is_enabled) + if (qpair->recovery_state != RECOVERY_NONE) return (false); bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, @@ -739,6 +738,10 @@ nvme_qpair_construct(struct nvme_qpair *qpair, qpair->cpl_bus_addr = queuemem_phys + cmdsz; prpmem_phys = queuemem_phys + cmdsz + cplsz; + callout_init(&qpair->timer, 1); + qpair->timer_armed = false; + qpair->recovery_state = RECOVERY_NONE; + /* * Calcuate the stride of the doorbell register. Many emulators set this * value to correspond to a cache line. However, some hardware has set @@ -776,7 +779,6 @@ nvme_qpair_construct(struct nvme_qpair *qpair, DOMAINSET_PREF(qpair->domain), M_ZERO | M_WAITOK); bus_dmamap_create(qpair->dma_tag_payload, 0, &tr->payload_dma_map); - callout_init(&tr->timer, 1); tr->cid = i; tr->qpair = qpair; tr->prp = (uint64_t *)prp_list; @@ -835,6 +837,8 @@ nvme_qpair_destroy(struct nvme_qpair *qpair) { struct nvme_tracker *tr; + callout_drain(&qpair->timer); + if (qpair->tag) { bus_teardown_intr(qpair->ctrlr->dev, qpair->res, qpair->tag); qpair->tag = NULL; @@ -914,65 +918,101 @@ nvme_io_qpair_destroy(struct nvme_qpair *qpair) } static void -nvme_abort_complete(void *arg, const struct nvme_completion *status) +nvme_qpair_timeout(void *arg) { - struct nvme_tracker *tr = arg; + struct nvme_qpair *qpair = arg; + struct nvme_controller *ctrlr = qpair->ctrlr; + struct nvme_tracker *tr; + struct nvme_tracker *tr_temp; + sbintime_t now; + bool idle; + uint32_t csts; + uint8_t cfs; - /* - * If cdw0 == 1, the controller was not able to abort the command - * we requested. We still need to check the active tracker array, - * to cover race where I/O timed out at same time controller was - * completing the I/O. - */ - if (status->cdw0 == 1 && tr->qpair->act_tr[tr->cid] != NULL) { + mtx_lock(&qpair->lock); + idle = TAILQ_EMPTY(&qpair->outstanding_tr); +again: + switch (qpair->recovery_state) { + case RECOVERY_NONE: + if (idle) + break; + now = getsbinuptime(); + TAILQ_FOREACH_SAFE(tr, &qpair->outstanding_tr, tailq, tr_temp) { + if (now > tr->deadline && tr->deadline != 0) { + /* + * We're now passed our earliest deadline. We + * need to do expensive things to cope, but next + * time. Flag that and close the door to any + * further processing. + */ + qpair->recovery_state = RECOVERY_START; + nvme_printf(ctrlr, "RECOVERY_START %jd vs %jd\n", + (uintmax_t)now, (uintmax_t)tr->deadline); + break; + } + } + break; + case RECOVERY_START: /* - * An I/O has timed out, and the controller was unable to - * abort it for some reason. Construct a fake completion - * status, and then complete the I/O's tracker manually. + * Read csts to get value of cfs - controller fatal status. + * If no fatal status, try to call the completion routine, and + * if completes transactions, report a missed interrupt and + * return (this may need to be rate limited). Otherwise, if + * aborts are enabled and the controller is not reporting + * fatal status, abort the command. Otherwise, just reset the + * controller and hope for the best. */ - nvme_printf(tr->qpair->ctrlr, - "abort command failed, aborting command manually\n"); - nvme_qpair_manual_complete_tracker(tr, - NVME_SCT_GENERIC, NVME_SC_ABORTED_BY_REQUEST, 0, ERROR_PRINT_ALL); + csts = nvme_mmio_read_4(ctrlr, csts); + cfs = (csts >> NVME_CSTS_REG_CFS_SHIFT) & NVME_CSTS_REG_CFS_MASK; + if (cfs) { + nvme_printf(ctrlr, "Controller in fatal status, resetting\n"); + qpair->recovery_state = RECOVERY_RESET; + goto again; + } + mtx_unlock(&qpair->lock); + if (nvme_qpair_process_completions(qpair)) { + nvme_printf(ctrlr, "Completions present in output without an interrupt\n"); + qpair->recovery_state = RECOVERY_NONE; + } else { + nvme_printf(ctrlr, "timeout with nothing complete, resetting\n"); + qpair->recovery_state = RECOVERY_RESET; + mtx_lock(&qpair->lock); + goto again; + } + mtx_lock(&qpair->lock); + break; + case RECOVERY_RESET: + /* + * If we get here due to a possible surprise hot-unplug event, + * then we let nvme_ctrlr_reset confirm and fail the + * controller. + */ + nvme_printf(ctrlr, "Resetting controller due to a timeout%s.\n", + cfs ? " and fatal error status" : ""); + nvme_printf(ctrlr, "RECOVERY_WAITING\n"); + qpair->recovery_state = RECOVERY_WAITING; + nvme_ctrlr_reset(ctrlr); + break; + case RECOVERY_WAITING: + nvme_printf(ctrlr, "waiting\n"); + break; } -} - -static void -nvme_timeout(void *arg) -{ - struct nvme_tracker *tr = arg; - struct nvme_qpair *qpair = tr->qpair; - struct nvme_controller *ctrlr = qpair->ctrlr; - uint32_t csts; - uint8_t cfs; /* - * Read csts to get value of cfs - controller fatal status. - * If no fatal status, try to call the completion routine, and - * if completes transactions, report a missed interrupt and - * return (this may need to be rate limited). Otherwise, if - * aborts are enabled and the controller is not reporting - * fatal status, abort the command. Otherwise, just reset the - * controller and hope for the best. + * Rearm the timeout. */ - csts = nvme_mmio_read_4(ctrlr, csts); - cfs = (csts >> NVME_CSTS_REG_CFS_SHIFT) & NVME_CSTS_REG_CFS_MASK; - if (cfs == 0 && nvme_qpair_process_completions(qpair)) { - nvme_printf(ctrlr, "Missing interrupt\n"); - return; - } - if (ctrlr->enable_aborts && cfs == 0) { - nvme_printf(ctrlr, "Aborting command due to a timeout.\n"); - nvme_ctrlr_cmd_abort(ctrlr, tr->cid, qpair->id, - nvme_abort_complete, tr); + if (!idle) { + callout_schedule(&qpair->timer, hz / 2); } else { - nvme_printf(ctrlr, "Resetting controller due to a timeout%s.\n", - (csts == NVME_GONE) ? " and possible hot unplug" : - (cfs ? " and fatal error status" : "")); - nvme_ctrlr_reset(ctrlr); + qpair->timer_armed = false; } + mtx_unlock(&qpair->lock); } +/* + * Submit the tracker to the hardware. Must already be in the + * outstanding queue when called. + */ void nvme_qpair_submit_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr) { @@ -989,12 +1029,17 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr) if (req->timeout) { if (req->cb_fn == nvme_completion_poll_cb) - timeout = hz; + timeout = 1; else - timeout = ctrlr->timeout_period * hz; - callout_reset_on(&tr->timer, timeout, nvme_timeout, tr, - qpair->cpu); - } + timeout = ctrlr->timeout_period; + tr->deadline = getsbinuptime() + timeout * SBT_1S; + if (!qpair->timer_armed) { + qpair->timer_armed = true; + callout_reset_on(&qpair->timer, hz / 2, + nvme_qpair_timeout, qpair, qpair->cpu); + } + } else + tr->deadline = SBT_MAX; /* Copy the command from the tracker to the submission queue. */ memcpy(&qpair->cmd[qpair->sq_tail], &req->cmd, sizeof(req->cmd)); @@ -1069,7 +1114,7 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req) tr = TAILQ_FIRST(&qpair->free_tr); req->qpair = qpair; - if (tr == NULL || !qpair->is_enabled) { + if (tr == NULL || qpair->recovery_state != RECOVERY_NONE) { /* * No tracker is available, or the qpair is disabled due to * an in-progress controller-level reset or controller @@ -1096,6 +1141,8 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req) TAILQ_REMOVE(&qpair->free_tr, tr, tailq); TAILQ_INSERT_TAIL(&qpair->outstanding_tr, tr, tailq); + if (!qpair->timer_armed) + tr->deadline = SBT_MAX; tr->req = req; switch (req->type) { @@ -1164,8 +1211,9 @@ nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req) static void nvme_qpair_enable(struct nvme_qpair *qpair) { + mtx_assert(&qpair->lock, MA_OWNED); - qpair->is_enabled = true; + qpair->recovery_state = RECOVERY_NONE; } void @@ -1208,7 +1256,9 @@ nvme_admin_qpair_enable(struct nvme_qpair *qpair) NVME_SC_ABORTED_BY_REQUEST, DO_NOT_RETRY, ERROR_PRINT_ALL); } + mtx_lock(&qpair->lock); nvme_qpair_enable(qpair); + mtx_unlock(&qpair->lock); } void @@ -1251,12 +1301,13 @@ nvme_io_qpair_enable(struct nvme_qpair *qpair) static void nvme_qpair_disable(struct nvme_qpair *qpair) { - struct nvme_tracker *tr; + struct nvme_tracker *tr, *tr_temp; - qpair->is_enabled = false; mtx_lock(&qpair->lock); - TAILQ_FOREACH(tr, &qpair->outstanding_tr, tailq) - callout_stop(&tr->timer); + qpair->recovery_state = RECOVERY_WAITING; + TAILQ_FOREACH_SAFE(tr, &qpair->outstanding_tr, tailq, tr_temp) { + tr->deadline = SBT_MAX; + } mtx_unlock(&qpair->lock); } From owner-dev-commits-src-all@freebsd.org Fri Sep 24 00:18:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFF596B0013; Fri, 24 Sep 2021 00:18: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 4HFt1G49MDz3Byv; Fri, 24 Sep 2021 00:18: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 6AFDD4C87; Fri, 24 Sep 2021 00:18: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 18O0Ig8s022551; Fri, 24 Sep 2021 00:18:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0Ig0s022550; Fri, 24 Sep 2021 00:18:42 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:18:42 GMT Message-Id: <202109240018.18O0Ig0s022550@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 45c2c7c484de - main - 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/main X-Git-Reftype: branch X-Git-Commit: 45c2c7c484de7747014492b17ff89e323ee66496 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:18:42 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=45c2c7c484de7747014492b17ff89e323ee66496 commit 45c2c7c484de7747014492b17ff89e323ee66496 Author: Konstantin Belousov AuthorDate: 2021-09-24 00:14:56 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-24 00:18:34 +0000 aio_aqueue(): avoid ucred leak on failure path PR: 258698 Submitted by: sigsys@gmail.com MFC after: 1 week --- 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 87c45bf2c078..d06b18140e71 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -1713,7 +1713,7 @@ no_kqueue: else error = fo_aio_queue(fp, job); if (error) - goto err3; + goto err4; AIO_LOCK(ki); job->jobflags &= ~KAIOCB_QUEUEING; @@ -1734,6 +1734,8 @@ no_kqueue: AIO_UNLOCK(ki); return (0); +err4: + crfree(job->cred); err3: if (fp) fdrop(fp, td); From owner-dev-commits-src-all@freebsd.org Fri Sep 24 00:32:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95B176AFD66; Fri, 24 Sep 2021 00:32: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 4HFtKF3mKPz3Dm3; Fri, 24 Sep 2021 00:32: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 612034EBD; Fri, 24 Sep 2021 00:32: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 18O0WXci048082; Fri, 24 Sep 2021 00:32:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0WXS2048081; Fri, 24 Sep 2021 00:32:33 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:32:33 GMT Message-Id: <202109240032.18O0WXS2048081@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 701a99939fbf - main - libsysdecode: Permit _ in VM_PROT_(.*) names. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 701a99939fbf2007f1df03cb9f67be88455d31cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:32:33 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=701a99939fbf2007f1df03cb9f67be88455d31cc commit 701a99939fbf2007f1df03cb9f67be88455d31cc Author: Nathaniel Wesley Filardo AuthorDate: 2021-09-24 00:31:39 +0000 Commit: John Baldwin CommitDate: 2021-09-24 00:31:39 +0000 libsysdecode: Permit _ in VM_PROT_(.*) names. CheriBSD defines additional protection flags which use underscores such as VM_PROT_READ_CAP and VM_PROT_WRITE_CAP. Obtained from: CheriBSD Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D30017 --- lib/libsysdecode/mktables | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables index 3d152a3a2646..cb5a763ddece 100644 --- a/lib/libsysdecode/mktables +++ b/lib/libsysdecode/mktables @@ -147,7 +147,7 @@ gen_table "socktype" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "sys/ gen_table "thrcreateflags" "THR_[A-Z]+[[:space:]]+0x[0-9]+" "sys/thr.h" gen_table "umtxop" "UMTX_OP_[[:alnum:]][[:alnum:]_]*[[:space:]]+[0-9]+" "sys/umtx.h" gen_table "umtxopflags" "UMTX_OP__[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/umtx.h" -gen_table "vmprot" "VM_PROT_[A-Z]+[[:space:]]+\(\(vm_prot_t\)[[:space:]]+0x[0-9]+\)" "vm/vm.h" +gen_table "vmprot" "VM_PROT_[A-Z_]+[[:space:]]+\(\(vm_prot_t\)[[:space:]]+0x[0-9]+\)" "vm/vm.h" gen_table "vmresult" "KERN_[A-Z_]+[[:space:]]+[0-9]+" "vm/vm_param.h" gen_table "wait6opt" "W[A-Z]+[[:space:]]+[0-9]+" "sys/wait.h" gen_table "seekwhence" "SEEK_[A-Z]+[[:space:]]+[0-9]+" "sys/unistd.h" From owner-dev-commits-src-all@freebsd.org Fri Sep 24 00:32:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D09676B029E; Fri, 24 Sep 2021 00:32:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFtKG4g09z3F0d; Fri, 24 Sep 2021 00:32: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 7C13C4A7F; Fri, 24 Sep 2021 00:32: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 18O0WYtJ048108; Fri, 24 Sep 2021 00:32:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0WYKM048107; Fri, 24 Sep 2021 00:32:34 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:32:34 GMT Message-Id: <202109240032.18O0WYKM048107@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 0321a7990b27 - main - kqueue: Add EV_KEEPUDATA flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0321a7990b277702fa0b4f8366121bf53d03cb64 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:32:35 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0321a7990b277702fa0b4f8366121bf53d03cb64 commit 0321a7990b277702fa0b4f8366121bf53d03cb64 Author: Nathaniel Wesley Filardo AuthorDate: 2021-09-24 00:31:39 +0000 Commit: John Baldwin CommitDate: 2021-09-24 00:31:39 +0000 kqueue: Add EV_KEEPUDATA flag When this flag is set, operations that update an existing kevent will not change the udata field. This can be used to NOTE_TRIGGER or EV_{EN,DIS}ABLE events without overwriting the stashed pointer. Reviewed by: Domagoj Stolfa Obtained from: CheriBSD Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D30286 --- lib/libc/sys/kqueue.2 | 17 ++++++++++- sys/kern/kern_event.c | 10 ++++++- sys/sys/event.h | 1 + tests/sys/kqueue/libkqueue/user.c | 60 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+), 2 deletions(-) diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2 index ed737c626ef8..3ded4ae3d8f7 100644 --- a/lib/libc/sys/kqueue.2 +++ b/lib/libc/sys/kqueue.2 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 7, 2021 +.Dd September 23, 2021 .Dt KQUEUE 2 .Os .Sh NAME @@ -262,6 +262,21 @@ Filters may set this flag to indicate filter-specific EOF condition. See .Sx RETURN VALUES below. +.It Dv EV_KEEPUDATA +Causes +.Fn kevent +to leave unchanged any +.Fa udata +associated with an existing event. This allows other aspects of the +event to be modified without requiring the caller to know the +.Fa udata +value presently associated. +This is especially useful with +.Dv NOTE_TRIGGER +or flags like +.Dv EV_ENABLE. +This flag may not be used with +.Dv EV_ADD. .El .Pp The predefined system filters are listed below. diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index db505b234268..5fa5bf9cad06 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1496,6 +1496,13 @@ kqueue_register(struct kqueue *kq, struct kevent *kev, struct thread *td, return EINVAL; if (kev->flags & EV_ADD) { + /* Reject an invalid flag pair early */ + if (kev->flags & EV_KEEPUDATA) { + tkn = NULL; + error = EINVAL; + goto done; + } + /* * Prevent waiting with locks. Non-sleepable * allocation failures are handled in the loop, only @@ -1684,7 +1691,8 @@ findkn: kn_enter_flux(kn); KQ_UNLOCK(kq); knl = kn_list_lock(kn); - kn->kn_kevent.udata = kev->udata; + if ((kev->flags & EV_KEEPUDATA) == 0) + kn->kn_kevent.udata = kev->udata; if (!fops->f_isfd && fops->f_touch != NULL) { fops->f_touch(kn, kev, EVENT_REGISTER); } else { diff --git a/sys/sys/event.h b/sys/sys/event.h index 80ed1268c8a1..f1bdc7e2a80e 100644 --- a/sys/sys/event.h +++ b/sys/sys/event.h @@ -138,6 +138,7 @@ struct kevent32_freebsd11 { #define EV_ENABLE 0x0004 /* enable event */ #define EV_DISABLE 0x0008 /* disable event (not reported) */ #define EV_FORCEONESHOT 0x0100 /* enable _ONESHOT and force trigger */ +#define EV_KEEPUDATA 0x0200 /* do not update the udata field */ /* flags */ #define EV_ONESHOT 0x0010 /* only report one occurrence */ diff --git a/tests/sys/kqueue/libkqueue/user.c b/tests/sys/kqueue/libkqueue/user.c index 3844251ff4ba..1f66234c4cda 100644 --- a/tests/sys/kqueue/libkqueue/user.c +++ b/tests/sys/kqueue/libkqueue/user.c @@ -60,6 +60,32 @@ event_wait(void) success(); } +static void +event_wait_keepudata(void) +{ + const char *test_id = "kevent(EVFILT_USER, wait w/ EV_KEEPUDATA)"; + struct kevent kev; + + test_begin(test_id); + + test_no_kevents(); + + kevent_add(kqfd, &kev, 1, EVFILT_USER, EV_ADD | EV_CLEAR, 0, 0, &kev); + kevent_add(kqfd, &kev, 1, EVFILT_USER, EV_KEEPUDATA, NOTE_TRIGGER, 0, + NULL); + + kev.fflags &= ~NOTE_FFCTRLMASK; + kev.fflags &= ~NOTE_TRIGGER; + kev.flags = EV_CLEAR; + kev.udata = &kev; + kevent_cmp(&kev, kevent_get(kqfd)); + + test_no_kevents(); + + success(); +} + + static void disable_and_enable(void) { @@ -88,6 +114,38 @@ disable_and_enable(void) success(); } +static void +disable_and_enable_keepudata(void) +{ + const char *test_id = + "kevent(EVFILT_USER, EV_DISABLE and EV_ENABLE w/ EV_KEEPUDATA)"; + struct kevent kev; + + test_begin(test_id); + + test_no_kevents(); + + kevent_add(kqfd, &kev, 1, EVFILT_USER, EV_ADD, 0, 0, &kev); + kevent_add(kqfd, &kev, 1, EVFILT_USER, EV_DISABLE | EV_KEEPUDATA, 0, 0, + NULL); + + /* Trigger the event, but since it is disabled, nothing will happen. */ + kevent_add(kqfd, &kev, 1, EVFILT_USER, EV_KEEPUDATA, NOTE_TRIGGER, 0, NULL); + test_no_kevents(); + + kevent_add(kqfd, &kev, 1, EVFILT_USER, EV_ENABLE | EV_KEEPUDATA, 0, 0, + NULL); + kevent_add(kqfd, &kev, 1, EVFILT_USER, EV_KEEPUDATA, NOTE_TRIGGER, 0, NULL); + + kev.flags = EV_CLEAR; + kev.fflags &= ~NOTE_FFCTRLMASK; + kev.fflags &= ~NOTE_TRIGGER; + kev.udata = &kev; + kevent_cmp(&kev, kevent_get(kqfd)); + + success(); +} + static void oneshot(void) { @@ -120,7 +178,9 @@ test_evfilt_user(void) add_and_delete(); event_wait(); + event_wait_keepudata(); disable_and_enable(); + disable_and_enable_keepudata(); oneshot(); /* TODO: try different fflags operations */ From owner-dev-commits-src-all@freebsd.org Fri Sep 24 00:40:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F6BD6AFCFF; Fri, 24 Sep 2021 00:40: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 4HFtTt2PLPz3FDc; Fri, 24 Sep 2021 00:40: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 32EF85102; Fri, 24 Sep 2021 00:40: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 18O0e21s050558; Fri, 24 Sep 2021 00:40:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0e2DJ050553; Fri, 24 Sep 2021 00:40:02 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:40:02 GMT Message-Id: <202109240040.18O0e2DJ050553@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: fc58a6f8e6b4 - stable/13 - buffer pager: allow get_blksize method to return error 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: fc58a6f8e6b4781ff1c6fd770ab96f9215a3d104 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:40:02 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fc58a6f8e6b4781ff1c6fd770ab96f9215a3d104 commit fc58a6f8e6b4781ff1c6fd770ab96f9215a3d104 Author: Konstantin Belousov AuthorDate: 2021-09-16 23:53:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-24 00:26:59 +0000 buffer pager: allow get_blksize method to return error (cherry picked from commit 197a4f29f39e6ae6215a6dbd28ef449d305e6d49) --- sys/fs/cd9660/cd9660_vnops.c | 5 +++-- sys/fs/fuse/fuse_vnops.c | 5 +++-- sys/fs/msdosfs/msdosfs_vnops.c | 5 +++-- sys/fs/nfsclient/nfs_clbio.c | 5 +++-- sys/kern/vfs_bio.c | 16 ++++++++++------ sys/sys/buf.h | 2 +- sys/ufs/ffs/ffs_vnops.c | 5 +++-- 7 files changed, 26 insertions(+), 17 deletions(-) diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c index 500ff79716be..0ddf73548e3f 100644 --- a/sys/fs/cd9660/cd9660_vnops.c +++ b/sys/fs/cd9660/cd9660_vnops.c @@ -858,12 +858,13 @@ cd9660_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) } static int -cd9660_gbp_getblksz(struct vnode *vp, daddr_t lbn) +cd9660_gbp_getblksz(struct vnode *vp, daddr_t lbn, long *sz) { struct iso_node *ip; ip = VTOI(vp); - return (blksize(ip->i_mnt, ip, lbn)); + *sz = blksize(ip->i_mnt, ip, lbn); + return (0); } static int diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index adb297b6aacb..1216c1252f2b 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -2199,7 +2199,7 @@ fuse_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) } static int -fuse_gbp_getblksz(struct vnode *vp, daddr_t lbn) +fuse_gbp_getblksz(struct vnode *vp, daddr_t lbn, long *sz) { off_t filesize; int blksz, err; @@ -2217,7 +2217,8 @@ fuse_gbp_getblksz(struct vnode *vp, daddr_t lbn) } else { blksz = biosize; } - return (blksz); + *sz = blksz; + return (0); } /* diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index 421afc3ec290..dda45ddda2a4 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1861,10 +1861,11 @@ msdosfs_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) } static int -msdosfs_gbp_getblksz(struct vnode *vp, daddr_t lbn) +msdosfs_gbp_getblksz(struct vnode *vp, daddr_t lbn, long *sz) { - return (VTODE(vp)->de_pmp->pm_bpcluster); + *sz = VTODE(vp)->de_pmp->pm_bpcluster; + return (0); } static int diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c index ff9f446ff1ef..10a76f0a4b83 100644 --- a/sys/fs/nfsclient/nfs_clbio.c +++ b/sys/fs/nfsclient/nfs_clbio.c @@ -94,7 +94,7 @@ ncl_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) } static int -ncl_gbp_getblksz(struct vnode *vp, daddr_t lbn) +ncl_gbp_getblksz(struct vnode *vp, daddr_t lbn, long *sz) { struct nfsnode *np; u_quad_t nsize; @@ -111,7 +111,8 @@ ncl_gbp_getblksz(struct vnode *vp, daddr_t lbn) bcount = 0; else if ((off_t)(lbn + 1) * biosize > nsize) bcount = nsize - (off_t)lbn * biosize; - return (bcount); + *sz = bcount; + return (0); } int diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 8519afe96633..74dc2feb9ea6 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -5177,8 +5177,8 @@ vfs_bio_getpages(struct vnode *vp, vm_page_t *ma, int count, struct mount *mp; daddr_t lbn, lbnp; vm_ooffset_t la, lb, poff, poffe; - long bsize; - int bo_bs, br_flags, error, i, pgsin, pgsin_a, pgsin_b; + long bo_bs, bsize; + int br_flags, error, i, pgsin, pgsin_a, pgsin_b; bool redo, lpart; object = vp->v_object; @@ -5195,7 +5195,10 @@ vfs_bio_getpages(struct vnode *vp, vm_page_t *ma, int count, */ la += PAGE_SIZE; lpart = la > object->un_pager.vnp.vnp_size; - bo_bs = get_blksize(vp, get_lblkno(vp, IDX_TO_OFF(ma[0]->pindex))); + error = get_blksize(vp, get_lblkno(vp, IDX_TO_OFF(ma[0]->pindex)), + &bo_bs); + if (error != 0) + return (VM_PAGER_ERROR); /* * Calculate read-ahead, behind and total pages. @@ -5251,9 +5254,10 @@ again: goto next_page; lbnp = lbn; - bsize = get_blksize(vp, lbn); - error = bread_gb(vp, lbn, bsize, curthread->td_ucred, - br_flags, &bp); + error = get_blksize(vp, lbn, &bsize); + if (error == 0) + error = bread_gb(vp, lbn, bsize, + curthread->td_ucred, br_flags, &bp); if (error != 0) goto end_pages; if (bp->b_rcred == curthread->td_ucred) { diff --git a/sys/sys/buf.h b/sys/sys/buf.h index 2997560b9ab3..86f5fbef7c92 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -595,7 +595,7 @@ void bwait(struct buf *, u_char, const char *); void bdone(struct buf *); typedef daddr_t (vbg_get_lblkno_t)(struct vnode *, vm_ooffset_t); -typedef int (vbg_get_blksize_t)(struct vnode *, daddr_t); +typedef int (vbg_get_blksize_t)(struct vnode *, daddr_t, long *); int vfs_bio_getpages(struct vnode *vp, struct vm_page **ma, int count, int *rbehind, int *rahead, vbg_get_lblkno_t get_lblkno, vbg_get_blksize_t get_blksize); diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index e834a6b4f50a..7b2c70af54c9 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1935,10 +1935,11 @@ ffs_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) } static int -ffs_gbp_getblksz(struct vnode *vp, daddr_t lbn) +ffs_gbp_getblksz(struct vnode *vp, daddr_t lbn, long *sz) { - return (blksize(VFSTOUFS(vp->v_mount)->um_fs, VTOI(vp), lbn)); + *sz = blksize(VFSTOUFS(vp->v_mount)->um_fs, VTOI(vp), lbn); + return (0); } static int From owner-dev-commits-src-all@freebsd.org Fri Sep 24 00:40:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E8406AFFF7; Fri, 24 Sep 2021 00:40: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 4HFtTv3Q8sz3FBh; Fri, 24 Sep 2021 00:40: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 544474EBF; Fri, 24 Sep 2021 00:40: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 18O0e3X6050770; Fri, 24 Sep 2021 00:40:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0e3vv050767; Fri, 24 Sep 2021 00:40:03 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:40:03 GMT Message-Id: <202109240040.18O0e3vv050767@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: e79a18dadf83 - stable/13 - procctl(2): add PROC_NO_NEW_PRIVS_CTL, PROC_NO_NEW_PRIVS_STATUS 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: e79a18dadf83b7bdcab1c2ba8b43b9a508810d22 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:40:03 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e79a18dadf83b7bdcab1c2ba8b43b9a508810d22 commit e79a18dadf83b7bdcab1c2ba8b43b9a508810d22 Author: Edward Tomasz Napierala AuthorDate: 2021-07-01 08:11:11 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-24 00:26:59 +0000 procctl(2): add PROC_NO_NEW_PRIVS_CTL, PROC_NO_NEW_PRIVS_STATUS (cherry picked from commit db8d680ebe9b12c7d9e0eb8bf9940fcef709f5ec) --- lib/libc/sys/procctl.2 | 27 ++++++++++++++++++++++++++- sys/compat/freebsd32/freebsd32_misc.c | 3 +++ sys/kern/kern_exec.c | 5 +++-- sys/kern/kern_fork.c | 2 +- sys/kern/kern_procctl.c | 32 ++++++++++++++++++++++++++++++++ sys/sys/proc.h | 1 + sys/sys/procctl.h | 5 +++++ 7 files changed, 71 insertions(+), 4 deletions(-) diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2 index f85825d8cc6f..432ed5919a81 100644 --- a/lib/libc/sys/procctl.2 +++ b/lib/libc/sys/procctl.2 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 13, 2020 +.Dd July 1, 2021 .Dt PROCCTL 2 .Os .Sh NAME @@ -564,6 +564,31 @@ Stack gaps are enabled in the process after Stack gaps are disabled in the process after .Xr execve 2 . .El +.It Dv PROC_NO_NEW_PRIVS_CTL +Allows one to ignore the SUID and SGID bits on the program +images activated by +.Xr execve 2 +in the specified process and its future descendants. +The +.Fa data +parameter must point to the integer variable holding the following +value: +.Bl -tag -width PROC_NO_NEW_PRIVS_ENABLE +.It Dv PROC_NO_NEW_PRIVS_ENABLE +Request SUID and SGID bits to be ignored. +.El +.Pp +It is not possible to disable it once it has been enabled. +.It Dv PROC_NO_NEW_PRIVS_STATUS +Returns the current status of SUID/SGID enablement for the target process. +The +.Fa data +parameter must point to the integer variable, where one of the +following values is written: +.Bl -tag -width PROC_NO_NEW_PRIVS_DISABLE +.It Dv PROC_NO_NEW_PRIVS_ENABLE +.It Dv PROC_NO_NEW_PRIVS_DISABLE +.El .El .Sh x86 MACHINE-SPECIFIC REQUESTS .Bl -tag -width PROC_KPTI_STATUS diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index d258afa2352d..cefae53b69df 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -3631,6 +3631,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_procctl_args *uap) case PROC_STACKGAP_CTL: case PROC_TRACE_CTL: case PROC_TRAPCAP_CTL: + case PROC_NO_NEW_PRIVS_CTL: error = copyin(PTRIN(uap->data), &flags, sizeof(flags)); if (error != 0) return (error); @@ -3664,6 +3665,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_procctl_args *uap) case PROC_STACKGAP_STATUS: case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: + case PROC_NO_NEW_PRIVS_STATUS: data = &flags; break; case PROC_PDEATHSIG_CTL: @@ -3695,6 +3697,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_procctl_args *uap) case PROC_STACKGAP_STATUS: case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: + case PROC_NO_NEW_PRIVS_STATUS: if (error == 0) error = copyout(&flags, uap->data, sizeof(flags)); break; diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 491e5332c834..0611eedcec73 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -776,8 +776,9 @@ interpret: signotify(td); } - if (imgp->sysent->sv_setid_allowed != NULL && - !(*imgp->sysent->sv_setid_allowed)(td, imgp)) + if ((imgp->sysent->sv_setid_allowed != NULL && + !(*imgp->sysent->sv_setid_allowed)(td, imgp)) || + (p->p_flag2 & P2_NO_NEW_PRIVS) != 0) execve_nosetid(imgp); /* diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 0d0659b432fe..7a80f7de85d8 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -492,7 +492,7 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread * p2->p_flag2 = p1->p_flag2 & (P2_ASLR_DISABLE | P2_ASLR_ENABLE | P2_ASLR_IGNSTART | P2_NOTRACE | P2_NOTRACE_EXEC | P2_PROTMAX_ENABLE | P2_PROTMAX_DISABLE | P2_TRAPCAP | - P2_STKGAP_DISABLE | P2_STKGAP_DISABLE_EXEC); + P2_STKGAP_DISABLE | P2_STKGAP_DISABLE_EXEC | P2_NO_NEW_PRIVS); p2->p_swtick = ticks; if (p1->p_flag & P_PROFIL) startprofclock(p2); diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index b2694fd0c32c..68fa4bc0c3ac 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -419,6 +419,27 @@ trapcap_status(struct thread *td, struct proc *p, int *data) return (0); } +static int +no_new_privs_ctl(struct thread *td, struct proc *p, int state) +{ + + PROC_LOCK_ASSERT(p, MA_OWNED); + + if (state != PROC_NO_NEW_PRIVS_ENABLE) + return (EINVAL); + p->p_flag2 |= P2_NO_NEW_PRIVS; + return (0); +} + +static int +no_new_privs_status(struct thread *td, struct proc *p, int *data) +{ + + *data = (p->p_flag2 & P2_NO_NEW_PRIVS) != 0 ? + PROC_NO_NEW_PRIVS_ENABLE : PROC_NO_NEW_PRIVS_DISABLE; + return (0); +} + static int protmax_ctl(struct thread *td, struct proc *p, int state) { @@ -601,6 +622,7 @@ sys_procctl(struct thread *td, struct procctl_args *uap) case PROC_STACKGAP_CTL: case PROC_TRACE_CTL: case PROC_TRAPCAP_CTL: + case PROC_NO_NEW_PRIVS_CTL: error = copyin(uap->data, &flags, sizeof(flags)); if (error != 0) return (error); @@ -632,6 +654,7 @@ sys_procctl(struct thread *td, struct procctl_args *uap) case PROC_STACKGAP_STATUS: case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: + case PROC_NO_NEW_PRIVS_STATUS: data = &flags; break; case PROC_PDEATHSIG_CTL: @@ -662,6 +685,7 @@ sys_procctl(struct thread *td, struct procctl_args *uap) case PROC_STACKGAP_STATUS: case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: + case PROC_NO_NEW_PRIVS_STATUS: if (error == 0) error = copyout(&flags, uap->data, sizeof(flags)); break; @@ -711,6 +735,10 @@ kern_procctl_single(struct thread *td, struct proc *p, int com, void *data) return (trapcap_ctl(td, p, *(int *)data)); case PROC_TRAPCAP_STATUS: return (trapcap_status(td, p, data)); + case PROC_NO_NEW_PRIVS_CTL: + return (no_new_privs_ctl(td, p, *(int *)data)); + case PROC_NO_NEW_PRIVS_STATUS: + return (no_new_privs_status(td, p, data)); default: return (EINVAL); } @@ -741,6 +769,8 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) case PROC_TRAPCAP_STATUS: case PROC_PDEATHSIG_CTL: case PROC_PDEATHSIG_STATUS: + case PROC_NO_NEW_PRIVS_CTL: + case PROC_NO_NEW_PRIVS_STATUS: if (idtype != P_PID) return (EINVAL); } @@ -773,6 +803,7 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) case PROC_REAP_KILL: case PROC_TRACE_CTL: case PROC_TRAPCAP_CTL: + case PROC_NO_NEW_PRIVS_CTL: sx_slock(&proctree_lock); tree_locked = true; break; @@ -789,6 +820,7 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) case PROC_STACKGAP_STATUS: case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: + case PROC_NO_NEW_PRIVS_STATUS: tree_locked = false; break; default: diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 138e763f2f11..15e175bf5aad 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -824,6 +824,7 @@ struct proc { after exec */ #define P2_ITSTOPPED 0x00002000 #define P2_PTRACEREQ 0x00004000 /* Active ptrace req */ +#define P2_NO_NEW_PRIVS 0x00008000 /* Ignore setuid */ /* Flags protected by proctree_lock, kept in p_treeflags. */ #define P_TREE_ORPHANED 0x00000001 /* Reparented, on orphan list */ diff --git a/sys/sys/procctl.h b/sys/sys/procctl.h index 90fb149830dc..cc0279fb0d08 100644 --- a/sys/sys/procctl.h +++ b/sys/sys/procctl.h @@ -63,6 +63,8 @@ #define PROC_PROTMAX_STATUS 16 /* query implicit PROT_MAX status */ #define PROC_STACKGAP_CTL 17 /* en/dis stack gap on MAP_STACK */ #define PROC_STACKGAP_STATUS 18 /* query stack gap */ +#define PROC_NO_NEW_PRIVS_CTL 19 /* disable setuid/setgid */ +#define PROC_NO_NEW_PRIVS_STATUS 20 /* query suid/sgid disabled status */ /* Operations for PROC_SPROTECT (passed in integer arg). */ #define PPROT_OP(x) ((x) & 0xf) @@ -141,6 +143,9 @@ struct procctl_reaper_kill { #define PROC_STACKGAP_ENABLE_EXEC 0x0004 #define PROC_STACKGAP_DISABLE_EXEC 0x0008 +#define PROC_NO_NEW_PRIVS_ENABLE 1 +#define PROC_NO_NEW_PRIVS_DISABLE 2 + #ifndef _KERNEL __BEGIN_DECLS int procctl(idtype_t, id_t, int, void *); From owner-dev-commits-src-all@freebsd.org Fri Sep 24 00:40:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6A656AFFF8; Fri, 24 Sep 2021 00:40: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 4HFtTw5TJPz3FMh; Fri, 24 Sep 2021 00:40: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 6144D4F9A; Fri, 24 Sep 2021 00:40: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 18O0e4WC050985; Fri, 24 Sep 2021 00:40:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0e4Db050982; Fri, 24 Sep 2021 00:40:04 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:40:04 GMT Message-Id: <202109240040.18O0e4Db050982@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: 425641290023 - stable/13 - proccontrol(1): implement 'nonewprivs' 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: 42564129002352e1ff622125edc5d038aa15d4c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:40:05 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=42564129002352e1ff622125edc5d038aa15d4c4 commit 42564129002352e1ff622125edc5d038aa15d4c4 Author: Edward Tomasz Napierala AuthorDate: 2021-07-02 07:49:20 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-24 00:26:59 +0000 proccontrol(1): implement 'nonewprivs' (cherry picked from commit acb1f1269c6f4ff89a0d28ba742f6687e9ef779d) --- usr.bin/proccontrol/proccontrol.1 | 5 ++++- usr.bin/proccontrol/proccontrol.c | 23 ++++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/usr.bin/proccontrol/proccontrol.1 b/usr.bin/proccontrol/proccontrol.1 index 4445bb5f9f8e..b4ed6c268a6a 100644 --- a/usr.bin/proccontrol/proccontrol.1 +++ b/usr.bin/proccontrol/proccontrol.1 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 28, 2019 +.Dd July 2, 2021 .Dt PROCCONTROL 1 .Os .Sh NAME @@ -69,6 +69,9 @@ Controls the signalling of capability mode access violations. .It Ar protmax Controls the implicit PROT_MAX application for .Xr mmap 2 . +.It Ar nonewprivs +Controls disabling the setuid and sgid bits for +.Xr execve 2 . .It Ar kpti Controls the KPTI enable, AMD64 only. .It Ar la48 diff --git a/usr.bin/proccontrol/proccontrol.c b/usr.bin/proccontrol/proccontrol.c index edcc23a3cb34..9f185de025c1 100644 --- a/usr.bin/proccontrol/proccontrol.c +++ b/usr.bin/proccontrol/proccontrol.c @@ -45,6 +45,7 @@ enum { MODE_TRAPCAP, MODE_PROTMAX, MODE_STACKGAP, + MODE_NO_NEW_PRIVS, #ifdef PROC_KPTI_CTL MODE_KPTI, #endif @@ -84,7 +85,7 @@ usage(void) { fprintf(stderr, "Usage: proccontrol -m (aslr|protmax|trace|trapcap|" - "stackgap"KPTI_USAGE LA_USAGE") [-q] " + "stackgap|nonewprivs"KPTI_USAGE LA_USAGE") [-q] " "[-s (enable|disable)] [-p pid | command]\n"); exit(1); } @@ -113,6 +114,8 @@ main(int argc, char *argv[]) mode = MODE_TRAPCAP; else if (strcmp(optarg, "stackgap") == 0) mode = MODE_STACKGAP; + else if (strcmp(optarg, "nonewprivs") == 0) + mode = MODE_NO_NEW_PRIVS; #ifdef PROC_KPTI_CTL else if (strcmp(optarg, "kpti") == 0) mode = MODE_KPTI; @@ -174,6 +177,9 @@ main(int argc, char *argv[]) case MODE_STACKGAP: error = procctl(P_PID, pid, PROC_STACKGAP_STATUS, &arg); break; + case MODE_NO_NEW_PRIVS: + error = procctl(P_PID, pid, PROC_NO_NEW_PRIVS_STATUS, &arg); + break; #ifdef PROC_KPTI_CTL case MODE_KPTI: error = procctl(P_PID, pid, PROC_KPTI_STATUS, &arg); @@ -264,6 +270,16 @@ main(int argc, char *argv[]) break; } break; + case MODE_NO_NEW_PRIVS: + switch (arg) { + case PROC_NO_NEW_PRIVS_ENABLE: + printf("enabled\n"); + break; + case PROC_NO_NEW_PRIVS_DISABLE: + printf("disabled\n"); + break; + } + break; #ifdef PROC_KPTI_CTL case MODE_KPTI: switch (arg & ~PROC_KPTI_STATUS_ACTIVE) { @@ -330,6 +346,11 @@ main(int argc, char *argv[]) PROC_STACKGAP_DISABLE_EXEC); error = procctl(P_PID, pid, PROC_STACKGAP_CTL, &arg); break; + case MODE_NO_NEW_PRIVS: + arg = enable ? PROC_NO_NEW_PRIVS_ENABLE : + PROC_NO_NEW_PRIVS_DISABLE; + error = procctl(P_PID, pid, PROC_NO_NEW_PRIVS_CTL, &arg); + break; #ifdef PROC_KPTI_CTL case MODE_KPTI: arg = enable ? PROC_KPTI_CTL_ENABLE_ON_EXEC : From owner-dev-commits-src-all@freebsd.org Fri Sep 24 00:40:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 485F06B060B; Fri, 24 Sep 2021 00:40: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 4HFtV001Byz3Dvw; Fri, 24 Sep 2021 00:40: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 A6F654F27; Fri, 24 Sep 2021 00:40: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 18O0e7PI051627; Fri, 24 Sep 2021 00:40:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0e7ST051624; Fri, 24 Sep 2021 00:40:07 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:40:07 GMT Message-Id: <202109240040.18O0e7ST051624@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: 492a76bcd6d5 - stable/13 - proccontrol(1): Add wxmap control 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: 492a76bcd6d50ae8fea4ed770af53cbc7d1c82b3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:40:08 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=492a76bcd6d50ae8fea4ed770af53cbc7d1c82b3 commit 492a76bcd6d50ae8fea4ed770af53cbc7d1c82b3 Author: Konstantin Belousov AuthorDate: 2021-09-01 23:27:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-24 00:26:59 +0000 proccontrol(1): Add wxmap control (cherry picked from commit ac8af1938085dae0df32db3229c9d5cb659b90a4) --- usr.bin/proccontrol/proccontrol.1 | 4 +++- usr.bin/proccontrol/proccontrol.c | 24 +++++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/usr.bin/proccontrol/proccontrol.1 b/usr.bin/proccontrol/proccontrol.1 index b4ed6c268a6a..09ec49431293 100644 --- a/usr.bin/proccontrol/proccontrol.1 +++ b/usr.bin/proccontrol/proccontrol.1 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 2, 2021 +.Dd September 2, 2021 .Dt PROCCONTROL 1 .Os .Sh NAME @@ -72,6 +72,8 @@ Controls the implicit PROT_MAX application for .It Ar nonewprivs Controls disabling the setuid and sgid bits for .Xr execve 2 . +.It Ar wxmap +Controls the write exclusive execute mode for mappings. .It Ar kpti Controls the KPTI enable, AMD64 only. .It Ar la48 diff --git a/usr.bin/proccontrol/proccontrol.c b/usr.bin/proccontrol/proccontrol.c index 8b34ecbb06d4..d9237c4c6b33 100644 --- a/usr.bin/proccontrol/proccontrol.c +++ b/usr.bin/proccontrol/proccontrol.c @@ -46,6 +46,7 @@ enum { MODE_PROTMAX, MODE_STACKGAP, MODE_NO_NEW_PRIVS, + MODE_WXMAP, #ifdef PROC_KPTI_CTL MODE_KPTI, #endif @@ -85,7 +86,7 @@ usage(void) { fprintf(stderr, "Usage: proccontrol -m (aslr|protmax|trace|trapcap|" - "stackgap|nonewprivs"KPTI_USAGE LA_USAGE") [-q] " + "stackgap|nonewprivs|wxmap"KPTI_USAGE LA_USAGE") [-q] " "[-s (enable|disable)] [-p pid | command]\n"); exit(1); } @@ -116,6 +117,8 @@ main(int argc, char *argv[]) mode = MODE_STACKGAP; else if (strcmp(optarg, "nonewprivs") == 0) mode = MODE_NO_NEW_PRIVS; + else if (strcmp(optarg, "wxmap") == 0) + mode = MODE_WXMAP; #ifdef PROC_KPTI_CTL else if (strcmp(optarg, "kpti") == 0) mode = MODE_KPTI; @@ -181,6 +184,9 @@ main(int argc, char *argv[]) error = procctl(P_PID, pid, PROC_NO_NEW_PRIVS_STATUS, &arg); break; + case MODE_WXMAP: + error = procctl(P_PID, pid, PROC_WXMAP_STATUS, &arg); + break; #ifdef PROC_KPTI_CTL case MODE_KPTI: error = procctl(P_PID, pid, PROC_KPTI_STATUS, &arg); @@ -281,6 +287,17 @@ main(int argc, char *argv[]) break; } break; + case MODE_WXMAP: + if ((arg & PROC_WX_MAPPINGS_PERMIT) != 0) + printf("enabled"); + else + printf("disabled"); + if ((arg & PROC_WX_MAPPINGS_DISALLOW_EXEC) != 0) + printf(", disabled on exec"); + if ((arg & PROC_WXORX_ENFORCE) != 0) + printf(", wxorx enforced"); + printf("\n"); + break; #ifdef PROC_KPTI_CTL case MODE_KPTI: switch (arg & ~PROC_KPTI_STATUS_ACTIVE) { @@ -353,6 +370,11 @@ main(int argc, char *argv[]) error = procctl(P_PID, pid, PROC_NO_NEW_PRIVS_CTL, &arg); break; + case MODE_WXMAP: + arg = enable ? PROC_WX_MAPPINGS_PERMIT : + PROC_WX_MAPPINGS_DISALLOW_EXEC; + error = procctl(P_PID, pid, PROC_WXMAP_CTL, &arg); + break; #ifdef PROC_KPTI_CTL case MODE_KPTI: arg = enable ? PROC_KPTI_CTL_ENABLE_ON_EXEC : From owner-dev-commits-src-all@freebsd.org Fri Sep 24 00:40:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FB486B0522; Fri, 24 Sep 2021 00:40: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 4HFtTy5SgMz3FKX; Fri, 24 Sep 2021 00:40:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E51C4E2E; Fri, 24 Sep 2021 00:40:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18O0e6wG051412; Fri, 24 Sep 2021 00:40:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0e6Bu051408; Fri, 24 Sep 2021 00:40:06 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:40:06 GMT Message-Id: <202109240040.18O0e6Bu051408@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: d4a478c2703d - stable/13 - procctl(2): Add PROC_WXMAP_CTL/STATUS 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: d4a478c2703d71b7cbbfc4e7d281b96dde2497d6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:40:07 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d4a478c2703d71b7cbbfc4e7d281b96dde2497d6 commit d4a478c2703d71b7cbbfc4e7d281b96dde2497d6 Author: Konstantin Belousov AuthorDate: 2021-09-02 00:59:10 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-24 00:26:59 +0000 procctl(2): Add PROC_WXMAP_CTL/STATUS (cherry picked from commit 796a8e1ad1ae3f7b8e4c9f97bebbef5d7d5a2c16) --- lib/libc/sys/procctl.2 | 64 ++++++++++++++++++++++++++++- sys/compat/freebsd32/freebsd32_misc.c | 3 ++ sys/kern/imgact_elf.c | 7 +++- sys/kern/kern_fork.c | 3 +- sys/kern/kern_procctl.c | 76 +++++++++++++++++++++++++++++++++++ sys/sys/proc.h | 2 + sys/sys/procctl.h | 6 +++ 7 files changed, 157 insertions(+), 4 deletions(-) diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2 index 432ed5919a81..4308520b8974 100644 --- a/lib/libc/sys/procctl.2 +++ b/lib/libc/sys/procctl.2 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 1, 2021 +.Dd September 2, 2021 .Dt PROCCTL 2 .Os .Sh NAME @@ -589,6 +589,62 @@ following values is written: .It Dv PROC_NO_NEW_PRIVS_ENABLE .It Dv PROC_NO_NEW_PRIVS_DISABLE .El +.It Dv PROC_WXMAP_CTL +Controls the 'write exclusive against execution' permissions for the +mappings in the process address space. +It overrides the global settings established by the +.Dv kern.elf{32/64}.allow_wx +sysctl, +and the corresponding bit in the ELF control note, see +.Xr elfctl 1 . +.Pp +The +.Fa data +parameter must point to the integer variable holding one of the +following values: +.Bl -tag -width PROC_WX_MAPPINGS_DISALLOW_EXEC +.It Dv PROC_WX_MAPPINGS_PERMIT +Enable creation of mappings that have both write and execute +protection attributes, in the specified process' address space. +.It Dv PROC_WX_MAPPINGS_DISALLOW_EXEC +In the new address space created by +.Xr execve 2 , +disallow creation of mappings that have both write and execute +permissions. +.El +.Pp +Once creation of writeable and executable mappings is allowed, +it is impossible (and pointless) to disallow it. +The only way to ensure the absence of such mappings after they +were enabled in a given process, is to set the +.Dv PROC_WX_MAPPINGS_DISALLOW_EXEC +flag and +.Xr execve 2 +an image. +.It Dv PROC_WXMAP_STATUS +Returns the current status of the 'write exclusive against execution' +enforcement for the specified process. +The +.Dv data +parameter must point to the integer variable, where one of the +following values is written: +.Bl -tag -width PROC_WX_MAPPINGS_DISALLOW_EXEC +.It Dv PROC_WX_MAPPINGS_PERMIT +Creation of simultaneously writable and executable mapping is permitted, +otherwise the process cannot create such mappings. +.It Dv PROC_WX_MAPPINGS_DISALLOW_EXEC +After +.Xr execve 2 , +the new address space should disallow creation of simultaneously +writable and executable mappings. +.El +.Pp +Additionally, if the address space of the process disallows +creation of simultaneously writable and executable mappings and +it is guaranteed that no such mapping was created since address space +creation, the +.Dv PROC_WXORX_ENFORCE +flag is set in the returned value. .El .Sh x86 MACHINE-SPECIFIC REQUESTS .Bl -tag -width PROC_KPTI_STATUS @@ -638,6 +694,12 @@ feature, as it is bypassable both by the kernel and privileged processes, and via other system mechanisms. As such, it should not be utilized to reliably protect cryptographic keying material or other confidential data. +.Pp +Note that processes can trivially bypass the 'no simultaneously +writable and executable mappings' policy by first marking some mapping +as writeable and write code to it, then removing write and adding +execute permission. +This may be legitimately required by some programs, such as JIT compilers. .Sh RETURN VALUES If an error occurs, a value of -1 is returned and .Va errno diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index cefae53b69df..c5bf67a72afd 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -3632,6 +3632,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_procctl_args *uap) case PROC_TRACE_CTL: case PROC_TRAPCAP_CTL: case PROC_NO_NEW_PRIVS_CTL: + case PROC_WXMAP_CTL: error = copyin(PTRIN(uap->data), &flags, sizeof(flags)); if (error != 0) return (error); @@ -3666,6 +3667,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_procctl_args *uap) case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: case PROC_NO_NEW_PRIVS_STATUS: + case PROC_WXMAP_STATUS: data = &flags; break; case PROC_PDEATHSIG_CTL: @@ -3698,6 +3700,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_procctl_args *uap) case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: case PROC_NO_NEW_PRIVS_STATUS: + case PROC_WXMAP_STATUS: if (error == 0) error = copyout(&flags, uap->data, sizeof(flags)); break; diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 9d039b914fb5..057c583324bb 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -1219,7 +1219,8 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) */ if (imgp->credential_setid) { PROC_LOCK(imgp->proc); - imgp->proc->p_flag2 &= ~(P2_ASLR_ENABLE | P2_ASLR_DISABLE); + imgp->proc->p_flag2 &= ~(P2_ASLR_ENABLE | P2_ASLR_DISABLE | + P2_WXORX_DISABLE | P2_WXORX_ENABLE_EXEC); PROC_UNLOCK(imgp->proc); } if ((sv->sv_flags & SV_ASLR) == 0 || @@ -1242,7 +1243,9 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) imgp->map_flags |= MAP_ASLR_IGNSTART; } - if (!__elfN(allow_wx) && (fctl0 & NT_FREEBSD_FCTL_WXNEEDED) == 0) + if ((!__elfN(allow_wx) && (fctl0 & NT_FREEBSD_FCTL_WXNEEDED) == 0 && + (imgp->proc->p_flag2 & P2_WXORX_DISABLE) == 0) || + (imgp->proc->p_flag2 & P2_WXORX_ENABLE_EXEC) != 0) imgp->map_flags |= MAP_WXORX; error = exec_new_vmspace(imgp, sv); diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 7a80f7de85d8..b2d58e804123 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -492,7 +492,8 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread * p2->p_flag2 = p1->p_flag2 & (P2_ASLR_DISABLE | P2_ASLR_ENABLE | P2_ASLR_IGNSTART | P2_NOTRACE | P2_NOTRACE_EXEC | P2_PROTMAX_ENABLE | P2_PROTMAX_DISABLE | P2_TRAPCAP | - P2_STKGAP_DISABLE | P2_STKGAP_DISABLE_EXEC | P2_NO_NEW_PRIVS); + P2_STKGAP_DISABLE | P2_STKGAP_DISABLE_EXEC | P2_NO_NEW_PRIVS | + P2_WXORX_DISABLE | P2_WXORX_ENABLE_EXEC); p2->p_swtick = ticks; if (p1->p_flag & P_PROFIL) startprofclock(p2); diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 68fa4bc0c3ac..53626caa0fd9 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -591,6 +591,71 @@ stackgap_status(struct thread *td, struct proc *p, int *data) return (0); } +static int +wxmap_ctl(struct thread *td, struct proc *p, int state) +{ + struct vmspace *vm; + vm_map_t map; + + PROC_LOCK_ASSERT(p, MA_OWNED); + if ((p->p_flag & P_WEXIT) != 0) + return (ESRCH); + + switch (state) { + case PROC_WX_MAPPINGS_PERMIT: + p->p_flag2 |= P2_WXORX_DISABLE; + _PHOLD(p); + PROC_UNLOCK(p); + vm = vmspace_acquire_ref(p); + if (vm != NULL) { + map = &vm->vm_map; + vm_map_lock(map); + map->flags &= ~MAP_WXORX; + vm_map_unlock(map); + vmspace_free(vm); + } + PROC_LOCK(p); + _PRELE(p); + break; + case PROC_WX_MAPPINGS_DISALLOW_EXEC: + p->p_flag2 |= P2_WXORX_ENABLE_EXEC; + break; + default: + return (EINVAL); + } + + return (0); +} + +static int +wxmap_status(struct thread *td, struct proc *p, int *data) +{ + struct vmspace *vm; + int d; + + PROC_LOCK_ASSERT(p, MA_OWNED); + if ((p->p_flag & P_WEXIT) != 0) + return (ESRCH); + + d = 0; + if ((p->p_flag2 & P2_WXORX_DISABLE) != 0) + d |= PROC_WX_MAPPINGS_PERMIT; + if ((p->p_flag2 & P2_WXORX_ENABLE_EXEC) != 0) + d |= PROC_WX_MAPPINGS_DISALLOW_EXEC; + _PHOLD(p); + PROC_UNLOCK(p); + vm = vmspace_acquire_ref(p); + if (vm != NULL) { + if ((vm->vm_map.flags & MAP_WXORX) != 0) + d |= PROC_WXORX_ENFORCE; + vmspace_free(vm); + } + PROC_LOCK(p); + _PRELE(p); + *data = d; + return (0); +} + #ifndef _SYS_SYSPROTO_H_ struct procctl_args { idtype_t idtype; @@ -623,6 +688,7 @@ sys_procctl(struct thread *td, struct procctl_args *uap) case PROC_TRACE_CTL: case PROC_TRAPCAP_CTL: case PROC_NO_NEW_PRIVS_CTL: + case PROC_WXMAP_CTL: error = copyin(uap->data, &flags, sizeof(flags)); if (error != 0) return (error); @@ -655,6 +721,7 @@ sys_procctl(struct thread *td, struct procctl_args *uap) case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: case PROC_NO_NEW_PRIVS_STATUS: + case PROC_WXMAP_STATUS: data = &flags; break; case PROC_PDEATHSIG_CTL: @@ -686,6 +753,7 @@ sys_procctl(struct thread *td, struct procctl_args *uap) case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: case PROC_NO_NEW_PRIVS_STATUS: + case PROC_WXMAP_STATUS: if (error == 0) error = copyout(&flags, uap->data, sizeof(flags)); break; @@ -739,6 +807,10 @@ kern_procctl_single(struct thread *td, struct proc *p, int com, void *data) return (no_new_privs_ctl(td, p, *(int *)data)); case PROC_NO_NEW_PRIVS_STATUS: return (no_new_privs_status(td, p, data)); + case PROC_WXMAP_CTL: + return (wxmap_ctl(td, p, *(int *)data)); + case PROC_WXMAP_STATUS: + return (wxmap_status(td, p, data)); default: return (EINVAL); } @@ -771,6 +843,8 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) case PROC_PDEATHSIG_STATUS: case PROC_NO_NEW_PRIVS_CTL: case PROC_NO_NEW_PRIVS_STATUS: + case PROC_WXMAP_CTL: + case PROC_WXMAP_STATUS: if (idtype != P_PID) return (EINVAL); } @@ -821,6 +895,8 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: case PROC_NO_NEW_PRIVS_STATUS: + case PROC_WXMAP_CTL: + case PROC_WXMAP_STATUS: tree_locked = false; break; default: diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 15e175bf5aad..ffb723576e2e 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -825,6 +825,8 @@ struct proc { #define P2_ITSTOPPED 0x00002000 #define P2_PTRACEREQ 0x00004000 /* Active ptrace req */ #define P2_NO_NEW_PRIVS 0x00008000 /* Ignore setuid */ +#define P2_WXORX_DISABLE 0x00010000 /* WX mappings enabled */ +#define P2_WXORX_ENABLE_EXEC 0x00020000 /* WXORX enabled after exec */ /* Flags protected by proctree_lock, kept in p_treeflags. */ #define P_TREE_ORPHANED 0x00000001 /* Reparented, on orphan list */ diff --git a/sys/sys/procctl.h b/sys/sys/procctl.h index cc0279fb0d08..0fcb62e94bb9 100644 --- a/sys/sys/procctl.h +++ b/sys/sys/procctl.h @@ -65,6 +65,8 @@ #define PROC_STACKGAP_STATUS 18 /* query stack gap */ #define PROC_NO_NEW_PRIVS_CTL 19 /* disable setuid/setgid */ #define PROC_NO_NEW_PRIVS_STATUS 20 /* query suid/sgid disabled status */ +#define PROC_WXMAP_CTL 21 /* control W^X */ +#define PROC_WXMAP_STATUS 22 /* query W^X */ /* Operations for PROC_SPROTECT (passed in integer arg). */ #define PPROT_OP(x) ((x) & 0xf) @@ -146,6 +148,10 @@ struct procctl_reaper_kill { #define PROC_NO_NEW_PRIVS_ENABLE 1 #define PROC_NO_NEW_PRIVS_DISABLE 2 +#define PROC_WX_MAPPINGS_PERMIT 0x0001 +#define PROC_WX_MAPPINGS_DISALLOW_EXEC 0x0002 +#define PROC_WXORX_ENFORCE 0x80000000 + #ifndef _KERNEL __BEGIN_DECLS int procctl(idtype_t, id_t, int, void *); From owner-dev-commits-src-all@freebsd.org Fri Sep 24 00:40:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C1A046B014A; Fri, 24 Sep 2021 00:40: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 4HFtTx4HHqz3Dy5; Fri, 24 Sep 2021 00:40: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 740554EC0; Fri, 24 Sep 2021 00:40: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 18O0e5Ou051196; Fri, 24 Sep 2021 00:40:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0e5l0051194; Fri, 24 Sep 2021 00:40:05 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:40:05 GMT Message-Id: <202109240040.18O0e5l0051194@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: 9ebc7d49be17 - stable/13 - Style 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: 9ebc7d49be1754d8a8dd815b38579349bfcf1b0b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:40:05 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9ebc7d49be1754d8a8dd815b38579349bfcf1b0b commit 9ebc7d49be1754d8a8dd815b38579349bfcf1b0b Author: Konstantin Belousov AuthorDate: 2021-09-01 23:23:02 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-24 00:26:59 +0000 Style (cherry picked from commit 1349891a0eed79625faafa5ad354d65ff9ea6012) --- usr.bin/proccontrol/proccontrol.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.bin/proccontrol/proccontrol.c b/usr.bin/proccontrol/proccontrol.c index 9f185de025c1..8b34ecbb06d4 100644 --- a/usr.bin/proccontrol/proccontrol.c +++ b/usr.bin/proccontrol/proccontrol.c @@ -178,7 +178,8 @@ main(int argc, char *argv[]) error = procctl(P_PID, pid, PROC_STACKGAP_STATUS, &arg); break; case MODE_NO_NEW_PRIVS: - error = procctl(P_PID, pid, PROC_NO_NEW_PRIVS_STATUS, &arg); + error = procctl(P_PID, pid, PROC_NO_NEW_PRIVS_STATUS, + &arg); break; #ifdef PROC_KPTI_CTL case MODE_KPTI: @@ -349,7 +350,8 @@ main(int argc, char *argv[]) case MODE_NO_NEW_PRIVS: arg = enable ? PROC_NO_NEW_PRIVS_ENABLE : PROC_NO_NEW_PRIVS_DISABLE; - error = procctl(P_PID, pid, PROC_NO_NEW_PRIVS_CTL, &arg); + error = procctl(P_PID, pid, PROC_NO_NEW_PRIVS_CTL, + &arg); break; #ifdef PROC_KPTI_CTL case MODE_KPTI: From owner-dev-commits-src-all@freebsd.org Fri Sep 24 00:46:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A27B6B066A; Fri, 24 Sep 2021 00:46:39 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFtdT4rbfz3FnY; Fri, 24 Sep 2021 00:46:37 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 18O0kUpI054491 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 24 Sep 2021 03:46:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 18O0kUpI054491 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 18O0kUpE054490; Fri, 24 Sep 2021 03:46:30 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 24 Sep 2021 03:46:30 +0300 From: Konstantin Belousov To: Hans Petter Selasky Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 903873ce1560 - main - Implement and use new mixer(3) library for FreeBSD. Message-ID: References: <202109221803.18MI3gdA013391@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202109221803.18MI3gdA013391@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4HFtdT4rbfz3FnY X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-1.42 / 15.00]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_SPF_SOFTFAIL(0.00)[~all:c]; NEURAL_SPAM_SHORT(0.57)[0.569]; TO_DN_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.985]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:46:39 -0000 On Wed, Sep 22, 2021 at 06:03:42PM +0000, Hans Petter Selasky wrote: > The branch main has been updated by hselasky: > > URL: https://cgit.FreeBSD.org/src/commit/?id=903873ce15600fc02a0ea42cbf888cff232b411d > > commit 903873ce15600fc02a0ea42cbf888cff232b411d > Author: Hans Petter Selasky > AuthorDate: 2021-09-22 13:42:51 +0000 > Commit: Hans Petter Selasky > CommitDate: 2021-09-22 17:43:56 +0000 > > Implement and use new mixer(3) library for FreeBSD. > > Wiki article: https://wiki.freebsd.org/SummerOfCode2021Projects/SoundMixerImprovements > This project was part of Google Summer of Code 2021. > > Submitted by: christos@ > Differential Revision: https://reviews.freebsd.org/D31636 > Sponsored by: NVIDIA Networking This library is supposed to be used by user' applications, right? If yes, it is highly desirable to provide symbol versioning from the start. From owner-dev-commits-src-all@freebsd.org Fri Sep 24 00:57:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B5FC6B083C; Fri, 24 Sep 2021 00:57: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 4HFtsr6w7tz3FbZ; Fri, 24 Sep 2021 00: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 C97D0527E; Fri, 24 Sep 2021 00: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 18O0vKP4075355; Fri, 24 Sep 2021 00: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 18O0vKcV075354; Fri, 24 Sep 2021 00:57:20 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:57:20 GMT Message-Id: <202109240057.18O0vKcV075354@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: ac8994cf5bc5 - stable/13 - readelf: include notes (-n) and unwind (-u) in --all/-a MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ac8994cf5bc56c5b865302f79a0efb3b580ef70b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:57:21 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ac8994cf5bc56c5b865302f79a0efb3b580ef70b commit ac8994cf5bc56c5b865302f79a0efb3b580ef70b Author: Ed Maste AuthorDate: 2021-09-17 12:06:27 +0000 Commit: Ed Maste CommitDate: 2021-09-24 00:57:10 +0000 readelf: include notes (-n) and unwind (-u) in --all/-a This matches the GNU and LLVM versions of readelf. As markj noted in the review -u is not actually implemented yet and has no effect. The option is accepted and just ignored. Reported by: andrew Reviewed by: andrew, markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32003 (cherry picked from commit f161abf9f2cd7fdd28543f9774de82c89675477c) --- contrib/elftoolchain/readelf/readelf.1 | 4 +++- contrib/elftoolchain/readelf/readelf.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/elftoolchain/readelf/readelf.1 b/contrib/elftoolchain/readelf/readelf.1 index 67344d5359b4..108b62775712 100644 --- a/contrib/elftoolchain/readelf/readelf.1 +++ b/contrib/elftoolchain/readelf/readelf.1 @@ -24,7 +24,7 @@ .\" .\" $Id: readelf.1 3753 2019-06-28 01:13:13Z emaste $ .\" -.Dd October 31, 2020 +.Dd September 17, 2021 .Dt READELF 1 .Os .Sh NAME @@ -76,8 +76,10 @@ Turn on the following flags: .Fl h , .Fl I , .Fl l , +.Fl n , .Fl r , .Fl s , +.Fl u , .Fl A , .Fl S and diff --git a/contrib/elftoolchain/readelf/readelf.c b/contrib/elftoolchain/readelf/readelf.c index 81e6897cf3cd..d5f9205e354d 100644 --- a/contrib/elftoolchain/readelf/readelf.c +++ b/contrib/elftoolchain/readelf/readelf.c @@ -7788,7 +7788,7 @@ main(int argc, char **argv) break; case 'a': re->options |= RE_AA | RE_D | RE_G | RE_H | RE_II | - RE_L | RE_R | RE_SS | RE_S | RE_VV; + RE_L | RE_N | RE_R | RE_SS | RE_S | RE_U | RE_VV; break; case 'c': re->options |= RE_C; From owner-dev-commits-src-all@freebsd.org Fri Sep 24 00:57:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 471D16B0936; Fri, 24 Sep 2021 00:57: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 4HFtst0fT2z3FxZ; Fri, 24 Sep 2021 00:57: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 E27C04C68; Fri, 24 Sep 2021 00:57: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 18O0vL3o075379; Fri, 24 Sep 2021 00:57:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0vLAP075378; Fri, 24 Sep 2021 00:57:21 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:57:21 GMT Message-Id: <202109240057.18O0vLAP075378@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 04676c953a90 - stable/13 - readelf: document that -u / --unwind is not yet implemented MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 04676c953a902e3fb6d6afa490784136b1cc694b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:57:22 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=04676c953a902e3fb6d6afa490784136b1cc694b commit 04676c953a902e3fb6d6afa490784136b1cc694b Author: Ed Maste AuthorDate: 2021-09-17 13:59:41 +0000 Commit: Ed Maste CommitDate: 2021-09-24 00:57:10 +0000 readelf: document that -u / --unwind is not yet implemented ELF tool chain readelf accepts -u / --unwind but just ignores the option. This was previously undocumented, which could be confusing for someone encountering `readelf -u` (in a script or GNU readelf example). Reported by: markj (in D32003) MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit deef4b8ce8ba7292fe5088bf9f6d4e2e35662fe8) --- contrib/elftoolchain/readelf/readelf.1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/elftoolchain/readelf/readelf.1 b/contrib/elftoolchain/readelf/readelf.1 index 108b62775712..c4f3408e814a 100644 --- a/contrib/elftoolchain/readelf/readelf.1 +++ b/contrib/elftoolchain/readelf/readelf.1 @@ -43,6 +43,7 @@ .Op Fl p Ar section | Fl -string-dump Ns = Ns Ar section .Op Fl r | Fl -relocs .Op Fl t | Fl -section-details +.Op Fl u | Fl -unwind .Op Fl v | Fl -version .Oo .Fl w Ns Oo Ns Ar afilmoprsFLR Ns Oc | @@ -118,6 +119,8 @@ Print additional information about sections, such as the flags fields in section headers. Implies .Fl S . +.It Fl u | Fl -unwind +Not yet implemented (option accepted but ignored). .It Fl v | Fl -version Prints a version identifier for .Nm From owner-dev-commits-src-all@freebsd.org Fri Sep 24 00:58:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96BE36B0AA8; Fri, 24 Sep 2021 00:58: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 4HFtv93qHbz3GFX; Fri, 24 Sep 2021 00:58: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 62D03540B; Fri, 24 Sep 2021 00:58: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 18O0wT31075586; Fri, 24 Sep 2021 00:58:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0wTak075585; Fri, 24 Sep 2021 00:58:29 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:58:29 GMT Message-Id: <202109240058.18O0wTak075585@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: cd6569d47ce5 - stable/12 - readelf: include notes (-n) and unwind (-u) in --all/-a MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: cd6569d47ce58726aba476598790df7cbb8c1826 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:58:29 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=cd6569d47ce58726aba476598790df7cbb8c1826 commit cd6569d47ce58726aba476598790df7cbb8c1826 Author: Ed Maste AuthorDate: 2021-09-17 12:06:27 +0000 Commit: Ed Maste CommitDate: 2021-09-24 00:58:14 +0000 readelf: include notes (-n) and unwind (-u) in --all/-a This matches the GNU and LLVM versions of readelf. As markj noted in the review -u is not actually implemented yet and has no effect. The option is accepted and just ignored. Reported by: andrew Reviewed by: andrew, markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32003 (cherry picked from commit f161abf9f2cd7fdd28543f9774de82c89675477c) --- contrib/elftoolchain/readelf/readelf.1 | 4 +++- contrib/elftoolchain/readelf/readelf.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/elftoolchain/readelf/readelf.1 b/contrib/elftoolchain/readelf/readelf.1 index 67344d5359b4..108b62775712 100644 --- a/contrib/elftoolchain/readelf/readelf.1 +++ b/contrib/elftoolchain/readelf/readelf.1 @@ -24,7 +24,7 @@ .\" .\" $Id: readelf.1 3753 2019-06-28 01:13:13Z emaste $ .\" -.Dd October 31, 2020 +.Dd September 17, 2021 .Dt READELF 1 .Os .Sh NAME @@ -76,8 +76,10 @@ Turn on the following flags: .Fl h , .Fl I , .Fl l , +.Fl n , .Fl r , .Fl s , +.Fl u , .Fl A , .Fl S and diff --git a/contrib/elftoolchain/readelf/readelf.c b/contrib/elftoolchain/readelf/readelf.c index a3b7e7a6bcac..a647f2e7961d 100644 --- a/contrib/elftoolchain/readelf/readelf.c +++ b/contrib/elftoolchain/readelf/readelf.c @@ -7778,7 +7778,7 @@ main(int argc, char **argv) break; case 'a': re->options |= RE_AA | RE_D | RE_G | RE_H | RE_II | - RE_L | RE_R | RE_SS | RE_S | RE_VV; + RE_L | RE_N | RE_R | RE_SS | RE_S | RE_U | RE_VV; break; case 'c': re->options |= RE_C; From owner-dev-commits-src-all@freebsd.org Fri Sep 24 00:58:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC53C6B0AA9; Fri, 24 Sep 2021 00:58:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFtvB4xrzz3GPg; Fri, 24 Sep 2021 00:58:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 86CF54C69; Fri, 24 Sep 2021 00:58: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 18O0wUBJ075610; Fri, 24 Sep 2021 00:58:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0wUkA075609; Fri, 24 Sep 2021 00:58:30 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:58:30 GMT Message-Id: <202109240058.18O0wUkA075609@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 8c495a9f4998 - stable/12 - readelf: document that -u / --unwind is not yet implemented MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8c495a9f4998e0a995705cab3446aa4f303a302d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:58:31 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=8c495a9f4998e0a995705cab3446aa4f303a302d commit 8c495a9f4998e0a995705cab3446aa4f303a302d Author: Ed Maste AuthorDate: 2021-09-17 13:59:41 +0000 Commit: Ed Maste CommitDate: 2021-09-24 00:58:14 +0000 readelf: document that -u / --unwind is not yet implemented ELF tool chain readelf accepts -u / --unwind but just ignores the option. This was previously undocumented, which could be confusing for someone encountering `readelf -u` (in a script or GNU readelf example). Reported by: markj (in D32003) MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit deef4b8ce8ba7292fe5088bf9f6d4e2e35662fe8) --- contrib/elftoolchain/readelf/readelf.1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/elftoolchain/readelf/readelf.1 b/contrib/elftoolchain/readelf/readelf.1 index 108b62775712..c4f3408e814a 100644 --- a/contrib/elftoolchain/readelf/readelf.1 +++ b/contrib/elftoolchain/readelf/readelf.1 @@ -43,6 +43,7 @@ .Op Fl p Ar section | Fl -string-dump Ns = Ns Ar section .Op Fl r | Fl -relocs .Op Fl t | Fl -section-details +.Op Fl u | Fl -unwind .Op Fl v | Fl -version .Oo .Fl w Ns Oo Ns Ar afilmoprsFLR Ns Oc | @@ -118,6 +119,8 @@ Print additional information about sections, such as the flags fields in section headers. Implies .Fl S . +.It Fl u | Fl -unwind +Not yet implemented (option accepted but ignored). .It Fl v | Fl -version Prints a version identifier for .Nm From owner-dev-commits-src-all@freebsd.org Fri Sep 24 00:59:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E58836B0CCF; Fri, 24 Sep 2021 00:59: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 4HFtw969dtz3GPF; Fri, 24 Sep 2021 00:59: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 B44715481; Fri, 24 Sep 2021 00:59: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 18O0xLnt075801; Fri, 24 Sep 2021 00:59:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0xLWn075800; Fri, 24 Sep 2021 00:59:21 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:59:21 GMT Message-Id: <202109240059.18O0xLWn075800@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 9d29bc0f475e - stable/12 - usr.bin/grep: Fix Address OOB read error MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 9d29bc0f475e878490f8c57b72beb4b7e0c38e02 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:59:22 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=9d29bc0f475e878490f8c57b72beb4b7e0c38e02 commit 9d29bc0f475e878490f8c57b72beb4b7e0c38e02 Author: Alex Richardson AuthorDate: 2021-01-19 11:35:07 +0000 Commit: Ed Maste CommitDate: 2021-09-24 00:58:14 +0000 usr.bin/grep: Fix Address OOB read error I found this when compiling all the bootstrap tools with -fsanitize=addres: ==65590==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62d000008400 at pc 0x000000473053 bp 0x7ffc1c7dd910 sp 0x7ffc1c7dd0b8 READ of size 32769 at 0x62d000008400 thread T0 #0 0x473052 in regexec (/local/scratch/alr48/cheri/build/freebsd-amd64-build/local/scratch/alr48/cheri/freebsd/amd64.amd64/tmp/legacy/bin/grep+0x473052) #1 0x4c9cf3 in procline /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c:539:8 #2 0x4c8687 in procfile /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c:379:18 #3 0x4c6596 in main /local/scratch/alr48/cheri/freebsd/usr.bin/grep/grep.c:714:8 0x62d000008400 is located 0 bytes to the right of 32768-byte region [0x62d000000400,0x62d000008400) allocated by thread T0 here: #0 0x493d5d in malloc (/local/scratch/alr48/cheri/build/freebsd-amd64-build/local/scratch/alr48/cheri/freebsd/amd64.amd64/tmp/legacy/bin/grep+0x493d5d) #1 0x4cad75 in grep_malloc /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c:656:13 #2 0x4c8129 in procfile /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c #3 0x4c6596 in main /local/scratch/alr48/cheri/freebsd/usr.bin/grep/grep.c:714:8 SUMMARY: AddressSanitizer: heap-buffer-overflow (/local/scratch/alr48/cheri/build/freebsd-amd64-build/local/scratch/alr48/cheri/freebsd/amd64.amd64/tmp/legacy/bin/grep+0x473052) in regexec Reviewed By: kevans MFC after: 1 week (cherry picked from commit 81c3f64110bb76e24d6062eafd7206c10f676d6f) --- usr.bin/grep/file.c | 11 +++++++---- usr.bin/grep/queue.c | 4 +++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/usr.bin/grep/file.c b/usr.bin/grep/file.c index ebcbd706b828..e390af9cc800 100644 --- a/usr.bin/grep/file.c +++ b/usr.bin/grep/file.c @@ -98,7 +98,6 @@ char * grep_fgetln(struct file *f, struct parsec *pc) { unsigned char *p; - char *ret; size_t len; size_t off; ptrdiff_t diff; @@ -116,12 +115,15 @@ grep_fgetln(struct file *f, struct parsec *pc) /* Look for a newline in the remaining part of the buffer */ if ((p = memchr(bufpos, fileeol, bufrem)) != NULL) { ++p; /* advance over newline */ - ret = bufpos; len = p - bufpos; + if (grep_lnbufgrow(len + 1)) + goto error; + memcpy(lnbuf, bufpos, len); bufrem -= len; bufpos = p; pc->ln.len = len; - return (ret); + lnbuf[len] = '\0'; + return (lnbuf); } /* We have to copy the current buffered data to the line buffer */ @@ -148,7 +150,7 @@ grep_fgetln(struct file *f, struct parsec *pc) ++p; diff = p - bufpos; len += diff; - if (grep_lnbufgrow(len)) + if (grep_lnbufgrow(len + 1)) goto error; memcpy(lnbuf + off, bufpos, diff); bufrem -= diff; @@ -156,6 +158,7 @@ grep_fgetln(struct file *f, struct parsec *pc) break; } pc->ln.len = len; + lnbuf[len] = '\0'; return (lnbuf); error: diff --git a/usr.bin/grep/queue.c b/usr.bin/grep/queue.c index ac15185f0694..9babdbf74af8 100644 --- a/usr.bin/grep/queue.c +++ b/usr.bin/grep/queue.c @@ -95,12 +95,14 @@ enqueue(struct str *x) rotated = true; free(item->dat); } - item->dat = grep_malloc(sizeof(char) * x->len); + /* len + 1 for NUL-terminator */ + item->dat = grep_malloc(sizeof(char) * x->len + 1); item->len = x->len; item->line_no = x->line_no; item->boff = x->boff; item->off = x->off; memcpy(item->dat, x->dat, x->len); + item->dat[x->len] = '\0'; item->file = x->file; return (rotated); From owner-dev-commits-src-all@freebsd.org Fri Sep 24 00:59:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 139156B0D8B; Fri, 24 Sep 2021 00:59: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 4HFtwB6qTjz3GQ8; Fri, 24 Sep 2021 00:59: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 C8DB35482; Fri, 24 Sep 2021 00:59: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 18O0xMDB075832; Fri, 24 Sep 2021 00:59:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0xMp5075831; Fri, 24 Sep 2021 00:59:22 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:59:22 GMT Message-Id: <202109240059.18O0xMp5075831@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: be94e7783975 - stable/12 - Fix -Wpointer-sign warnings in usr.bin/grep MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: be94e77839751408d87f53e5e371a0d06b17072f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:59:23 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=be94e77839751408d87f53e5e371a0d06b17072f commit be94e77839751408d87f53e5e371a0d06b17072f Author: Alex Richardson AuthorDate: 2020-09-21 09:03:37 +0000 Commit: Ed Maste CommitDate: 2021-09-24 00:58:14 +0000 Fix -Wpointer-sign warnings in usr.bin/grep Reviewed By: kevans Differential Revision: https://reviews.freebsd.org/D26479 (cherry picked from commit 86ce5365215ab252e0d1904b410381c96cfc4076) --- usr.bin/grep/file.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.bin/grep/file.c b/usr.bin/grep/file.c index e390af9cc800..8577572c2887 100644 --- a/usr.bin/grep/file.c +++ b/usr.bin/grep/file.c @@ -55,12 +55,12 @@ __FBSDID("$FreeBSD$"); #define MAXBUFSIZ (32 * 1024) #define LNBUFBUMP 80 -static unsigned char *buffer; -static unsigned char *bufpos; +static char *buffer; +static char *bufpos; static size_t bufrem; static size_t fsiz; -static unsigned char *lnbuf; +static char *lnbuf; static size_t lnbuflen; static inline int @@ -97,7 +97,7 @@ grep_lnbufgrow(size_t newlen) char * grep_fgetln(struct file *f, struct parsec *pc) { - unsigned char *p; + char *p; size_t len; size_t off; ptrdiff_t diff; From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:02:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E99B46B0976; Fri, 24 Sep 2021 01:02: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 4HFtzM6FMnz3GZk; Fri, 24 Sep 2021 01:02: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 B6B935692; Fri, 24 Sep 2021 01:02: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 18O127sp088297; Fri, 24 Sep 2021 01:02:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O127vj088296; Fri, 24 Sep 2021 01:02:07 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:02:07 GMT Message-Id: <202109240102.18O127vj088296@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 217324224472 - stable/11 - readelf: include notes (-n) and unwind (-u) in --all/-a MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 2173242244729494c1a0f9a4b0b667ada7e5abeb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:02:08 -0000 The branch stable/11 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=2173242244729494c1a0f9a4b0b667ada7e5abeb commit 2173242244729494c1a0f9a4b0b667ada7e5abeb Author: Ed Maste AuthorDate: 2021-09-17 12:06:27 +0000 Commit: Ed Maste CommitDate: 2021-09-24 01:00:55 +0000 readelf: include notes (-n) and unwind (-u) in --all/-a This matches the GNU and LLVM versions of readelf. As markj noted in the review -u is not actually implemented yet and has no effect. The option is accepted and just ignored. Reported by: andrew Reviewed by: andrew, markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32003 (cherry picked from commit f161abf9f2cd7fdd28543f9774de82c89675477c) --- contrib/elftoolchain/readelf/readelf.1 | 4 +++- contrib/elftoolchain/readelf/readelf.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/elftoolchain/readelf/readelf.1 b/contrib/elftoolchain/readelf/readelf.1 index 67344d5359b4..108b62775712 100644 --- a/contrib/elftoolchain/readelf/readelf.1 +++ b/contrib/elftoolchain/readelf/readelf.1 @@ -24,7 +24,7 @@ .\" .\" $Id: readelf.1 3753 2019-06-28 01:13:13Z emaste $ .\" -.Dd October 31, 2020 +.Dd September 17, 2021 .Dt READELF 1 .Os .Sh NAME @@ -76,8 +76,10 @@ Turn on the following flags: .Fl h , .Fl I , .Fl l , +.Fl n , .Fl r , .Fl s , +.Fl u , .Fl A , .Fl S and diff --git a/contrib/elftoolchain/readelf/readelf.c b/contrib/elftoolchain/readelf/readelf.c index 078800e74ae4..dfeab20b70b3 100644 --- a/contrib/elftoolchain/readelf/readelf.c +++ b/contrib/elftoolchain/readelf/readelf.c @@ -7775,7 +7775,7 @@ main(int argc, char **argv) break; case 'a': re->options |= RE_AA | RE_D | RE_G | RE_H | RE_II | - RE_L | RE_R | RE_SS | RE_S | RE_VV; + RE_L | RE_N | RE_R | RE_SS | RE_S | RE_U | RE_VV; break; case 'c': re->options |= RE_C; From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:02:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2EDA76B0E2A; Fri, 24 Sep 2021 01:02:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFtzP0J7fz3Gfp; Fri, 24 Sep 2021 01:02: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 DF98552C6; Fri, 24 Sep 2021 01:02: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 18O128Rx088321; Fri, 24 Sep 2021 01:02:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O128VR088320; Fri, 24 Sep 2021 01:02:08 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:02:08 GMT Message-Id: <202109240102.18O128VR088320@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 1f9c81f259f3 - stable/11 - readelf: document that -u / --unwind is not yet implemented MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 1f9c81f259f35b8b751e5b79752990858fa26799 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:02:09 -0000 The branch stable/11 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=1f9c81f259f35b8b751e5b79752990858fa26799 commit 1f9c81f259f35b8b751e5b79752990858fa26799 Author: Ed Maste AuthorDate: 2021-09-17 13:59:41 +0000 Commit: Ed Maste CommitDate: 2021-09-24 01:01:17 +0000 readelf: document that -u / --unwind is not yet implemented ELF tool chain readelf accepts -u / --unwind but just ignores the option. This was previously undocumented, which could be confusing for someone encountering `readelf -u` (in a script or GNU readelf example). Reported by: markj (in D32003) MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit deef4b8ce8ba7292fe5088bf9f6d4e2e35662fe8) --- contrib/elftoolchain/readelf/readelf.1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/elftoolchain/readelf/readelf.1 b/contrib/elftoolchain/readelf/readelf.1 index 108b62775712..c4f3408e814a 100644 --- a/contrib/elftoolchain/readelf/readelf.1 +++ b/contrib/elftoolchain/readelf/readelf.1 @@ -43,6 +43,7 @@ .Op Fl p Ar section | Fl -string-dump Ns = Ns Ar section .Op Fl r | Fl -relocs .Op Fl t | Fl -section-details +.Op Fl u | Fl -unwind .Op Fl v | Fl -version .Oo .Fl w Ns Oo Ns Ar afilmoprsFLR Ns Oc | @@ -118,6 +119,8 @@ Print additional information about sections, such as the flags fields in section headers. Implies .Fl S . +.It Fl u | Fl -unwind +Not yet implemented (option accepted but ignored). .It Fl v | Fl -version Prints a version identifier for .Nm From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B26B6B140E; Fri, 24 Sep 2021 01:35: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 4HFvjN2b8dz3JLc; Fri, 24 Sep 2021 01:35: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 3599D586F; Fri, 24 Sep 2021 01:35: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 18O1Z4fL029059; Fri, 24 Sep 2021 01:35:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1Z4Zl029058; Fri, 24 Sep 2021 01:35:04 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:04 GMT Message-Id: <202109240135.18O1Z4Zl029058@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: fd225bef9f18 - stable/13 - e1000: Update copyrights and readme 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: fd225bef9f18ef281018375463a46eff3bfd7cc1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:04 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=fd225bef9f18ef281018375463a46eff3bfd7cc1 commit fd225bef9f18ef281018375463a46eff3bfd7cc1 Author: Kevin Bowling AuthorDate: 2021-09-16 11:35:45 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:19:09 +0000 e1000: Update copyrights and readme Copyrights in sync with "cid-gigabit.2020.06.05.tar.gz released by ND" (from DPDK). README from the latest em-7.7.8 on intel.com Approved by: imp MFC after: 1 week (cherry picked from commit 702cac6c6bf20ca43db26c38185f65fc9ed1935e) --- sys/dev/e1000/LICENSE | 41 ++- sys/dev/e1000/README | 547 ++++++++++++++++++++------------------ sys/dev/e1000/e1000_80003es2lan.c | 40 +-- sys/dev/e1000/e1000_80003es2lan.h | 40 +-- sys/dev/e1000/e1000_82540.c | 40 +-- sys/dev/e1000/e1000_82541.c | 40 +-- sys/dev/e1000/e1000_82541.h | 40 +-- sys/dev/e1000/e1000_82542.c | 40 +-- sys/dev/e1000/e1000_82543.c | 40 +-- sys/dev/e1000/e1000_82543.h | 40 +-- sys/dev/e1000/e1000_82571.c | 40 +-- sys/dev/e1000/e1000_82571.h | 40 +-- sys/dev/e1000/e1000_82575.c | 40 +-- sys/dev/e1000/e1000_82575.h | 40 +-- sys/dev/e1000/e1000_api.c | 40 +-- sys/dev/e1000/e1000_api.h | 40 +-- sys/dev/e1000/e1000_defines.h | 40 +-- sys/dev/e1000/e1000_hw.h | 40 +-- sys/dev/e1000/e1000_i210.c | 40 +-- sys/dev/e1000/e1000_i210.h | 40 +-- sys/dev/e1000/e1000_ich8lan.c | 40 +-- sys/dev/e1000/e1000_ich8lan.h | 40 +-- sys/dev/e1000/e1000_mac.c | 40 +-- sys/dev/e1000/e1000_mac.h | 40 +-- sys/dev/e1000/e1000_manage.c | 40 +-- sys/dev/e1000/e1000_manage.h | 40 +-- sys/dev/e1000/e1000_mbx.c | 40 +-- sys/dev/e1000/e1000_mbx.h | 40 +-- sys/dev/e1000/e1000_nvm.c | 40 +-- sys/dev/e1000/e1000_nvm.h | 40 +-- sys/dev/e1000/e1000_osdep.c | 40 +-- sys/dev/e1000/e1000_osdep.h | 40 +-- sys/dev/e1000/e1000_phy.c | 40 +-- sys/dev/e1000/e1000_phy.h | 40 +-- sys/dev/e1000/e1000_regs.h | 40 +-- sys/dev/e1000/e1000_vf.c | 40 +-- sys/dev/e1000/e1000_vf.h | 40 +-- 37 files changed, 1007 insertions(+), 981 deletions(-) diff --git a/sys/dev/e1000/LICENSE b/sys/dev/e1000/LICENSE index f70a7cbd4a1d..51a32a819633 100644 --- a/sys/dev/e1000/LICENSE +++ b/sys/dev/e1000/LICENSE @@ -1,31 +1,30 @@ $FreeBSD$ - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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) + 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 COPYRIGHT OWNER 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. - diff --git a/sys/dev/e1000/README b/sys/dev/e1000/README index c0abeacccf4a..d734be75e758 100644 --- a/sys/dev/e1000/README +++ b/sys/dev/e1000/README @@ -1,9 +1,8 @@ $FreeBSD$ -FreeBSD* Driver for Intel Network Connection -============================================= - -May 30, 2007 +FreeBSD* Driver for Intel(R) Ethernet +===================================== +August 7, 2019 Contents ======== @@ -11,396 +10,424 @@ Contents - Overview - Identifying Your Adapter - Building and Installation -- Speed and Duplex Configuration -- Additional Configurations -- Known Limitations +- Additional Features and Configurations +- Known Issues/Troubleshooting - Support - License Overview ======== - -This file describes the FreeBSD* driver for Intel Network Connection. -This driver has been developed for use with FreeBSD, Release 7.x. +This file describes the FreeBSD* driver for Intel(R) Ethernet. This driver has +been developed for use with all community-supported versions of FreeBSD. For questions related to hardware requirements, refer to the documentation -supplied with your Gigabit adapter. All hardware requirements listed +supplied with your Intel Ethernet Adapter. All hardware requirements listed apply to use with FreeBSD. Identifying Your Adapter ======================== +This release includes two gigabit FreeBSD base Drivers for Intel(R) Ethernet. +These drivers are em and igb. -For information on how to identify your adapter, go to the Adapter & -Driver ID Guide at: - -http://support.intel.com/support/network/sb/cs-012904.htm - - -For the latest Intel network drivers for FreeBSD, see: +- The igb driver supports all 82575 and 82576-based gigabit network connections. +- The em driver supports all other gigabit network connections. +- Gigabit devices base on the Intel(R) Ethernet Controller X722 are supported by + the ixl driver. -http://downloadfinder.intel.com/scripts-df-external/support_intel.aspx - - -NOTE: Mobile adapters are not fully supported. NOTE: The Intel(R) 82562v 10/100 Network Connection only provides 10/100 support. +For information on how to identify your adapter, and for the latest Intel +network drivers, refer to the Intel Support website: +http://www.intel.com/support + + Building and Installation ========================= +NOTE: This driver package is to be used only as a standalone archive and the +user should not attempt to incorporate it into the kernel source tree. -NOTE: The driver can be installed as a dynamic loadable kernel module or - compiled into the kernel. You must have kernel sources installed in - order to compile the driver module. - -In the instructions below, x.x.x is the driver version as indicated in the -name of the driver tar file. +In the instructions below, x.x.x is the driver version as indicated in the name +of the driver tar file. 1. Move the base driver tar file to the directory of your choice. For example, use /home/username/em or /usr/local/src/em. 2. Untar/unzip the archive: - tar xzvf em-x.x.x.tar.gz - - This will create an em-x.x.x directory. - -3. To create a loadable module, perform the following steps. - NOTE: To compile the driver into the kernel, go directly to step 4. - - a. To compile the module - - cd em-x.x.x - make - - b. To install the compiled module to the system directory: - - make install - - c. If you want the driver to load automatically when the system is booted: + # tar xzf em-x.x.x.tar.gz - 1. Edit /boot/loader.conf, and add the following line: +This will create the em-x.x.x directory. - if_em_load="YES" +3. To install man page: -4. To compile the driver into the kernel, enter: + # cd em-x.x.x + # gzip -c em.4 > /usr/share/man/man4/em.4.gz - cd em-x.x.x/src - cp *.[ch] /usr/src/sys/dev/em +4. To load the driver onto a running system: - Edit the kernel configuration file (i.e., GENERIC or MYKERNEL) in - /usr/src/sys/i386/conf, and ensure the following line is present: - - device em - - Compile and install the kernel. The system must be rebooted for the - kernel updates to take effect. For additional information on compiling - the kernel, consult the FreeBSD operating system documentation. + # cd em-x.x.x/src + # make + # kldload ./if_em.ko 5. To assign an IP address to the interface, enter the following: - ifconfig em + # ifconfig em 6. Verify that the interface works. Enter the following, where is the IP address for another machine on the same subnet as the interface that is being tested: - ping - -7. To configure the IP address to remain after reboot, edit /etc/rc.conf, - and create the appropriate ifconfig_ementry: - - ifconfig_em="" + # ping - Example usage: +7. If you want the driver to load automatically when the system is booted: - ifconfig_em0="inet 192.168.10.1 netmask 255.255.255.0" + # cd em-x.x.x/src + # make + # make install - NOTE: For assistance, see the ifconfig man page. +Edit /boot/loader.conf, and add the following line: + if_em_load="YES" +Edit /etc/rc.conf, and create the appropriate ifconfig_em entry: -Speed and Duplex Configuration -============================== - -By default, the adapter auto-negotiates the speed and duplex of the -connection. If there is a specific need, the ifconfig utility can be used to -configure the speed and duplex settings on the adapter. Example usage: + ifconfig_em="" - ifconfig em media 100baseTX mediaopt - full-duplex +Example usage: + ifconfig_em0="inet 192.168.10.1 netmask 255.255.255.0" - NOTE: Only use mediaopt to set the driver to full-duplex. If mediaopt is - not specified and you are not running at gigabit speed, the driver - defaults to half-duplex. + NOTE: For assistance, see the ifconfig man page. -If the interface is currently forced to 100 full duplex, in order to change -to half duplex you must use this command: - ifconfig em media 100baseTX -mediaopt - full-duplex +Additional Features and Configurations +====================================== +Speed and Duplex Configuration +------------------------------ +In addressing speed and duplex configuration issues, you need to distinguish +between copper-based adapters and fiber-based adapters. -This driver supports the following media type options: +In the default mode, an Intel(R) Ethernet Network Adapter using copper +connections will attempt to auto-negotiate with its link partner to determine +the best setting. If the adapter cannot establish link with the link partner +using auto-negotiation, you may need to manually configure the adapter and link +partner to identical settings to establish link and pass packets. This should +only be needed when attempting to link with an older switch that does not +support auto-negotiation or one that has been forced to a specific speed or +duplex mode. Your link partner must match the setting you choose. 1 Gbps speeds +and higher cannot be forced. Use the autonegotiation advertising setting to +manually set devices for 1 Gbps and higher. - autoselect - Enables auto-negotiation for speed and duplex. +Caution: Only experienced network administrators should force speed and duplex +or change autonegotiation advertising manually. The settings at the switch must +always match the adapter settings. Adapter performance may suffer or your +adapter may not operate if you configure the adapter differently from your +switch. - 10baseT/UTP - Sets speed to 10 Mbps. Use the ifconfig mediaopt - option to select full-duplex mode. +An Intel(R) Ethernet Network Adapter using fiber-based connections, however, +will not attempt to auto-negotiate with its link partner since those adapters +operate only in full duplex and only at their native speed. - 100baseTX - Sets speed to 100 Mbps. Use the ifconfig mediaopt - option to select full-duplex mode. +By default, the adapter auto-negotiates the speed and duplex of the connection. +If there is a specific need, the ifconfig utility can be used to configure the +speed and duplex settings on the adapter. - 1000baseTX - Sets speed to 1000 Mbps. In this case, the driver - supports only full-duplex mode. +Example usage: - 1000baseSX - Sets speed to 1000 Mbps. In this case, the driver - supports only full-duplex mode. +# ifconfig emX media 100baseTX mediaopt full-duplex -For more information on the ifconfig utility, see the ifconfig man page. +NOTE: Only use mediaopt to set the driver to full-duplex. If mediaopt is not +specified and you are not running at gigabit speed, the driver defaults to +half-duplex. +If the interface is currently forced to 100 full duplex, you must use this +command to change to half duplex: -Additional Configurations -========================= +# ifconfig emX media 100baseTX -mediaopt full-duplex -The driver supports Transmit/Receive Checksum Offload and Jumbo Frames on -all but the 82542-based adapters. For specific adapters, refer to the -Identifying Your Adapter section. +This driver supports the following media type options: - Jumbo Frames - ------------ - To enable Jumbo Frames, use the ifconfig utility to set the Maximum - Transport Unit (MTU) frame size above its default of 1500 bytes. +Media Type Description +---------- ----------- +autoselect Enables auto-negotiation for speed and duplex. +10baseT/UTP Sets speed to 10 Mbps. Use the ifconfig mediaopt + option to select full-duplex mode. +100baseTX Sets speed to 100 Mbps. Use the ifconfig mediaopt + option to select full-duplex mode. +1000baseTX Sets speed to 1000 Mbps. In this case, the driver + supports only full-duplex mode. +1000baseSX Sets speed to 1000 Mbps. In this case, the driver + supports only full-duplex mode. - The Jumbo Frames MTU range for Intel Adapters is 1500 to 16110. To modify - the setting, enter the following: +For more information on the ifconfig utility, see the ifconfig man page. - ifconfig em mtu 9000 +Jumbo Frames +------------ +Jumbo Frames support is enabled by changing the Maximum Transmission Unit (MTU) +to a value larger than the default value of 1500. + +Use the ifconfig command to increase the MTU size. For example, enter the +following where X is the interface number: + +# ifconfig emX mtu 9000 + +To confirm an interface's MTU value, use the ifconfig command. + +To confirm the MTU used between two specific devices, use: + +# route get + +NOTE: The maximum MTU setting for Jumbo Frames is 16110. This value coincides +with the maximum Jumbo Frames size of 16132 bytes. + +NOTE: Using Jumbo frames at 10 or 100 Mbps is not supported and may result in +poor performance or loss of link. + +NOTE: Packet loss may have a greater impact on throughput when you use jumbo +frames. If you observe a drop in performance after enabling jumbo frames, +enabling flow control may mitigate the issue. + +NOTE: Some Intel gigabit adapters that support Jumbo Frames have a frame size +limit of 9238 bytes, with a corresponding MTU size limit of 9216 bytes. The +adapters with this limitation are based on the Intel(R) 82571EB, 82572EI, +82573L, 82566, 82562, and 80003ES2LAN controller. These correspond to the +following product names: + Intel(R) PRO/1000 PT Server Adapter + Intel(R) PRO/1000 PT Desktop Adapter + Intel(R) PRO/1000 PT Network Connection + Intel(R) PRO/1000 PT Dual Port Server Adapter + Intel(R) PRO/1000 PT Dual Port Network Connection + Intel(R) PRO/1000 PT Quad Port Server Adapter + Intel(R) PRO/1000 PF Quad Port Server Adapter + Intel(R) PRO/1000 PF Server Adapter + Intel(R) PRO/1000 PF Network Connection + Intel(R) PRO/1000 PF Dual Port Server Adapter + Intel(R) PRO/1000 PB Server Connection + Intel(R) PRO/1000 PL Network Connection + Intel(R) PRO/1000 EB Network Connection with I/O Acceleration + Intel(R) PRO/1000 EB Backplane Connection with I/O Acceleration + Intel(R) 82566DM-2 Gigabit Network Connection + Intel(R) 82574L Gigabit Network Connection + Intel(R) Gigabit CT Desktop Adapter + Intel(R) 82567LM-4 Gigabit Network Connection + Intel(R) 82567LM-3 Gigabit Network Connection + Intel(R) 82567LF-3 Gigabit Network Connection - To confirm the MTU used between two specific devices, use: +NOTE: The following adapters limit Jumbo Frames sized packets to a maximum of +4088 bytes: + - Intel(R) 82578DM Gigabit Network Connection + - Intel(R) 82577LM Gigabit Network Connection +- The following adapters do not support Jumbo Frames: + - Intel(R) PRO/1000 Gigabit Server Adapter + - Intel(R) PRO/1000 PM Network Connection + - Intel(R) 82562G 10/100 Network Connection + - Intel(R) 82562G-2 10/100 Network Connection + - Intel(R) 82562GT 10/100 Network Connection + - Intel(R) 82562GT-2 10/100 Network Connection + - Intel(R) 82562V 10/100 Network Connection + - Intel(R) 82562V-2 10/100 Network Connection + - Intel(R) 82566DC Gigabit Network Connection + - Intel(R) 82566DC-2 Gigabit Network Connection + - Intel(R) 82566DM Gigabit Network Connection + - Intel(R) 82566MC Gigabit Network Connection + - Intel(R) 82566MM Gigabit Network Connection + - Intel(R) 82567V-3 Gigabit Network Connection + - Intel(R) 82577LC Gigabit Network Connection + - Intel(R) 82578DC Gigabit Network Connection +- Jumbo Frames cannot be configured on an 82579-based Network device if + MACSec is enabled on the system. - route get - Notes: +VLANS +----- +To create a new VLAN interface: - - Only enable Jumbo Frames if your network infrastructure supports them. +# ifconfig create - - To enable Jumbo Frames, increase the MTU size on the interface beyond - 1500. +To associate the VLAN interface with a physical interface and assign a VLAN ID, +IP address, and netmask: - - The Jumbo Frames setting on the switch must be set to at least 22 bytes - larger than that of the MTU. +# ifconfig netmask vlan +vlandev - - The maximum MTU setting for Jumbo Frames is 16110. This value coincides - with the maximum Jumbo Frames size of 16128. +Example: - - Some Intel gigabit adapters that support Jumbo Frames have a frame size - limit of 9238 bytes, with a corresponding MTU size limit of 9216 bytes. - The adapters with this limitation are based on the Intel(R) 82571EB, - 82572EI, 82573L, 82566, 82562, and 80003ES2LAN controller. These - correspond to the following product names: - Intel(R) PRO/1000 PT Server Adapter - Intel(R) PRO/1000 PT Desktop Adapter - Intel(R) PRO/1000 PT Network Connection - Intel(R) PRO/1000 PT Dual Port Server Adapter - Intel(R) PRO/1000 PT Dual Port Network Connection - Intel(R) PRO/1000 PT Quad Port Server Adapter - Intel(R) PRO/1000 PF Quad Port Server Adapter - Intel(R) PRO/1000 PF Server Adapter - Intel(R) PRO/1000 PF Network Connection - Intel(R) PRO/1000 PF Dual Port Server Adapter - Intel(R) PRO/1000 PB Server Connection - Intel(R) PRO/1000 PL Network Connection - Intel(R) PRO/1000 EB Network Connection with I/O Acceleration - Intel(R) PRO/1000 EB Backplane Connection with I/O Acceleration - Intel(R) 82566DM-2 Gigabit Network Connection +# ifconfig vlan10 10.0.0.1 netmask 255.255.255.0 vlan 10 vlandev em0 - - Adapters based on the Intel(R) 82542 and 82573V/E controller do not - support Jumbo Frames. These correspond to the following product names: - Intel(R) PRO/1000 Gigabit Server Adapter - Intel(R) PRO/1000 PM Network Connection +In this example, all packets will be marked on egress with 802.1Q VLAN tags, +specifying a VLAN ID of 10. - - Using Jumbo Frames at 10 or 100 Mbps may result in poor performance or - loss of link. +To remove a VLAN interface: - - The following adapters do not support Jumbo Frames: - Intel(R) 82562V 10/100 Network Connection - Intel(R) 82566DM Gigabit Network Connection - Intel(R) 82566DC Gigabit Network Connection - Intel(R) 82566MM Gigabit Network Connection - Intel(R) 82566MC Gigabit Network Connection - Intel(R) 82562GT 10/100 Network Connection - Intel(R) 82562G 10/100 Network Connection - Intel(R) 82566DC-2 Gigabit Network Connection - Intel(R) 82562V-2 10/100 Network Connection - Intel(R) 82562G-2 10/100 Network Connection - Intel(R) 82562GT-2 10/100 Network Connection +# ifconfig destroy - VLANs - ----- - To create a new VLAN interface: - ifconfig create +Polling +------- +NOTES: +- Device Polling is only valid for non-SMP kernels. +- The driver has to be built into the kernel for Device Polling to be + enabled in the driver. - To associate the VLAN interface with a physical interface and - assign a VLAN ID, IP address, and netmask: +To enable polling in the driver, add the following options to the kernel +configuration, and then recompile the kernel: - ifconfig netmask vlan - vlandev + options DEVICE_POLLING + options HZ=1000 - Example: +At runtime use: + ifconfig emX polling (to turn polling on) +and: + ifconfig emX -polling (to turn it off) - ifconfig vlan10 10.0.0.1 netmask 255.255.255.0 vlan 10 vlandev em0 - In this example, all packets will be marked on egress with 802.1Q VLAN - tags, specifying a VLAN ID of 10. +Checksum Offload +---------------- +Checksum offloading is not supported on 82542 Gigabit adapters. - To remove a VLAN interface: +Checksum offloading supports both TCP and UDP packets and is supported for both +transmit and receive. - Intel Network Connection ifconfig destroy +Checksum offloading can be enabled or disabled using ifconfig. Both transmit +and receive offloading will be either enabled or disabled together. You cannot +enable/disable one without the other. +To enable checksum offloading: - Polling - ------- +# ifconfig emX rxcsum - To enable polling in the driver, add the following options to the kernel - configuration, and then recompile the kernel: +To disable checksum offloading: - options DEVICE_POLLING - options HZ=1000 +# ifconfig emX -rxcsum - At runtime use: - ifconfig emX polling (to turn polling on) - and: - ifconfig emX -polling (to turn it off) +To confirm the current setting: +# ifconfig emX - Checksum Offload - ---------------- - Checksum offloading is not supported on 82542 Gigabit adapters. +Look for the presence or absence of the following line: + options=3 - Checksum offloading supports both TCP and UDP packets and is - supported for both transmit and receive. +See the ifconfig man page for further information. - Checksum offloading can be enabled or disabled using ifconfig. - Both transmit and receive offloading will be either enabled or - disabled together. You cannot enable/disable one without the other. - To enable checksum offloading: +TSO +--- +TSO (TCP Segmentation Offload) supports both IPv4 and IPv6. TSO can be disabled +and enabled using the ifconfig utility or sysctl. - ifconfig rxcsum +NOTE: TSO requires Tx checksum, if Tx checksum is disabled, TSO will also be +disabled. - To disable checksum offloading: +NOTE: By default only PCI-Express adapters are ENABLED to do TSO. Others can be +enabled by the user at their own risk. TSO is not supported on 82547 or +82544-based adapters, as well as older adapters. - ifconfig -rxcsum +To enable/disable TSO in the stack: - To confirm the current setting: +# sysctl net.inet.tcp.tso=0 (or 1 to enable it) - ifconfig +Doing this disables/enables TSO in the stack and affects all installed adapters. - Look for the presence or absence of the following line: +To disable BOTH TSO IPv4 and IPv6: - options=3 +# ifconfig em -tso - See the ifconfig man page for further information. +To enable BOTH TSO IPv4 and IPv6: +# ifconfig em tso - TSO - --- - The FreeBSD driver offers support for TSO (TCP Segmentation Offload). +You can also enable/disable IPv4 TSO or IPv6 TSO individually. Simply replace +tso|-tso in the above command with tso4 or tso6. For example, to disable +TSO IPv4: - You can enable/disable it in two ways/places: +# ifconfig em -tso4 - - sysctl net.inet.tcp.tso=0 (or 1 to enable it) +To disable TSO IPv6: - Doing this disables TSO in the stack and will affect all adapters. +# ifconfig em -tso6 - - ifconfig emX -tso - Doing this will disable TSO only for this adapter. +MSI-X +----- +MSI or MSI-X can be turned off by an entry in /etc/sysctl.conf - To enable: + hw.em.enable_msi=0 - - ifconfig emX tso +Unload and reload the driver. - NOTES: By default only PCI-Express adapters are ENABLED to do TSO. Others - can be enabled by the user at their own risk - TSO is not supported on 82547 and 82544-based adapters, as well as older adapters. +Known Issues/Troubleshooting +============================ -Known Limitations -================= +Detected Tx Unit Hang in Quad Port Adapters +------------------------------------------- +In some cases ports 3 and 4 don't pass traffic and report 'Detected Tx Unit +Hang' followed by 'NETDEV WATCHDOG: emX: transmit timed out' errors. Ports 1 +and 2 do not show any errors and will pass traffic. - Detected Tx Unit Hang in Quad Port Adapters - ------------------------------------------- +This issue may be resolved by updating to the latest kernel and BIOS. You +should use an OS that fully supports Message Signaled Interrupts (MSI) and make +sure that MSI is enabled in your system's BIOS. - In some cases ports 3 and 4 wont pass traffic. Ports 1 and 2 don't show - any errors and will pass traffic. - This issue MAY be resolved by updating to the latest BIOS. You can - check your system's BIOS by downloading the Linux Firmware Developer Kit - that can be obtained at http://www.linuxfirmwarekit.org/ +There are known performance issues with this driver when running UDP traffic +with Jumbo Frames. +---------------------------------------------------------------------------- - There are known performance issues with this driver when running UDP traffic - with Jumbo Frames. - ---------------------------------------------------------------------------- +82541/82547 can't link or is slow to link with some link partners +----------------------------------------------------------------- +There is a known compatibility issue where time to link is slow or link is not +established between 82541/82547 controllers and some switches. Known switches +include: + Planex FXG-08TE + I-O Data ETG-SH8 - 82541/82547 can't link or is slow to link with some link partners - ----------------------------------------------------------------- +The driver can be compiled with the following changes: - There is a known compatibility issue where time to link is slow or link is not - established between 82541/82547 controllers and some switches. Known switches - include: - Planex FXG-08TE - I-O Data ETG-SH8 - Netgear GS105v3 + Edit ./em.x.x.x/src/if_em.h to change the #define EM_MASTER_SLAVE - The driver can be compiled with the following changes: +For example, change from: - Edit ./em.x.x.x/src/if_em.h to change the #define EM_MASTER_SLAVE - For example, change from: + #define EM_MASTER_SLAVE e1000_ms_hw_default - #define EM_MASTER_SLAVE e1000_ms_hw_default - to: - #define EM_MASTER_SLAVE 2 +to: - Use one of the following options: - 1 = Master mode - 2 = Slave mode - 3 = Auto master/slave - Setting 2 is recommended. + #define EM_MASTER_SLAVE 2 - Recompile the module: - a. To compile the module - cd em-x.x.x - make clean - make +Use one of the following options: + 1 = Master mode + 2 = Slave mode + 3 = Auto master/slave +Setting 2 is recommended. - b. To install the compiled module in system directory: - make install +Recompile the module: + a. To compile the module + cd em-x.x.x + make clean + make + b. To install the compiled module in system directory: + make install Support ======= +For general information, go to the Intel support website at: +http://www.intel.com/support/ -For general information and support, go to the Intel support website at: +If an issue is identified with the released source code on a supported kernel +with a supported adapter, email the specific information related to the issue +to freebsd@intel.com - http://support.intel.com -If an issue is identified, support is through email only at: -freebsd@intel.com +Copyright(c) 1999-2019 Intel Corporation. -License -======= - -This software program is released under the terms of a license agreement -between you ('Licensee') and Intel. Do not use or load this software or any -associated materials (collectively, the 'Software') until you have carefully -read the full terms and conditions of the LICENSE located in this software -package. By loading or using the Software, you agree to the terms of this -Agreement. If you do not agree with the terms of this Agreement, do not -install or use the Software. +Trademarks +========== +Intel is a trademark or registered trademark of Intel Corporation or its +subsidiaries in the United States and/or other countries. * Other names and brands may be claimed as the property of others. diff --git a/sys/dev/e1000/e1000_80003es2lan.c b/sys/dev/e1000/e1000_80003es2lan.c index 5c0220adfc6f..50fdfab54685 100644 --- a/sys/dev/e1000/e1000_80003es2lan.c +++ b/sys/dev/e1000/e1000_80003es2lan.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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) + 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 COPYRIGHT OWNER 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. diff --git a/sys/dev/e1000/e1000_80003es2lan.h b/sys/dev/e1000/e1000_80003es2lan.h index cbf0eafa9407..9e6de14757d7 100644 --- a/sys/dev/e1000/e1000_80003es2lan.h +++ b/sys/dev/e1000/e1000_80003es2lan.h @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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) + 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 COPYRIGHT OWNER 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. diff --git a/sys/dev/e1000/e1000_82540.c b/sys/dev/e1000/e1000_82540.c index adc944a8ebb4..720798260f8a 100644 --- a/sys/dev/e1000/e1000_82540.c +++ b/sys/dev/e1000/e1000_82540.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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) + 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 COPYRIGHT OWNER 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. diff --git a/sys/dev/e1000/e1000_82541.c b/sys/dev/e1000/e1000_82541.c *** 1823 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C5B06B11DC; Fri, 24 Sep 2021 01: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 4HFvjP3dj7z3JTm; Fri, 24 Sep 2021 01: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 57F4A5A52; Fri, 24 Sep 2021 01: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 18O1Z56x029085; Fri, 24 Sep 2021 01: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 18O1Z5uc029084; Fri, 24 Sep 2021 01:35:05 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:05 GMT Message-Id: <202109240135.18O1Z5uc029084@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: 8788094ab129 - stable/13 - e1000: support flashless i211 PBA 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: 8788094ab129dc5efc99214b918ec7e9f5120dbe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:05 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=8788094ab129dc5efc99214b918ec7e9f5120dbe commit 8788094ab129dc5efc99214b918ec7e9f5120dbe Author: Guinan Sun AuthorDate: 2020-07-06 08:11:59 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:19:25 +0000 e1000: support flashless i211 PBA Add support to print PBA when using flashless. Signed-off-by: Todd Fujinaka Signed-off-by: Sasha Neftin Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (d3c41d90dfd5b39dec14c74cf53086f4e6634aed) MFC after: 1 week (cherry picked from commit de0ae5d1cb896dbc04c5334ef0b864b3c841c3ce) --- sys/dev/e1000/e1000_82575.c | 2 +- sys/dev/e1000/e1000_nvm.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index d588539ca8e8..27e564d7841b 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -461,7 +461,7 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) if ((mac->type == e1000_i210) || (mac->type == e1000_i211)) mac->ops.init_hw = e1000_init_hw_i210; else - mac->ops.init_hw = e1000_init_hw_82575; + mac->ops.init_hw = e1000_init_hw_82575; /* link setup */ mac->ops.setup_link = e1000_setup_link_generic; /* physical interface link setup */ diff --git a/sys/dev/e1000/e1000_nvm.c b/sys/dev/e1000/e1000_nvm.c index ecc7b013febb..f46444cf38b9 100644 --- a/sys/dev/e1000/e1000_nvm.c +++ b/sys/dev/e1000/e1000_nvm.c @@ -776,8 +776,9 @@ s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num, DEBUGFUNC("e1000_read_pba_string_generic"); - if ((hw->mac.type >= e1000_i210) && - !e1000_get_flash_presence_i210(hw)) { + if ((hw->mac.type == e1000_i210 || + hw->mac.type == e1000_i211) && + !e1000_get_flash_presence_i210(hw)) { DEBUGOUT("Flashless no PBA string\n"); return -E1000_ERR_NVM_PBA_SECTION; } From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0451F6B1055; Fri, 24 Sep 2021 01:35: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 4HFvjQ6MCqz3JR9; Fri, 24 Sep 2021 01:35:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 812155757; Fri, 24 Sep 2021 01:35:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18O1Z6I2029109; Fri, 24 Sep 2021 01:35:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1Z6ol029108; Fri, 24 Sep 2021 01:35:06 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:06 GMT Message-Id: <202109240135.18O1Z6ol029108@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: 3d3c15f6b962 - stable/13 - e1000: add missing device ID 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: 3d3c15f6b962ed04418da8dadefe67b706252071 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:07 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=3d3c15f6b962ed04418da8dadefe67b706252071 commit 3d3c15f6b962ed04418da8dadefe67b706252071 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:10 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:19:38 +0000 e1000: add missing device ID Adding Intel(R) I210 Gigabit Network Connection 15F6 device ID for SGMII flashless automotive device. Signed-off-by: Kamil Bednarczyk Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (586d770bfefc01d4af97c0ddf17c960c3e49ec22) MFC after: 1 week (cherry picked from commit 82a9d0c2c1ef75703d16e49e96d1e7b0bf046882) --- sys/dev/e1000/e1000_api.c | 1 + sys/dev/e1000/e1000_hw.h | 1 + sys/dev/e1000/if_em.c | 1 + 3 files changed, 3 insertions(+) diff --git a/sys/dev/e1000/e1000_api.c b/sys/dev/e1000/e1000_api.c index a36b228e075f..6e0f51ab7ffa 100644 --- a/sys/dev/e1000/e1000_api.c +++ b/sys/dev/e1000/e1000_api.c @@ -383,6 +383,7 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) break; case E1000_DEV_ID_I210_COPPER_FLASHLESS: case E1000_DEV_ID_I210_SERDES_FLASHLESS: + case E1000_DEV_ID_I210_SGMII_FLASHLESS: case E1000_DEV_ID_I210_COPPER: case E1000_DEV_ID_I210_COPPER_OEM1: case E1000_DEV_ID_I210_COPPER_IT: diff --git a/sys/dev/e1000/e1000_hw.h b/sys/dev/e1000/e1000_hw.h index a08630618662..95973e29dbf0 100644 --- a/sys/dev/e1000/e1000_hw.h +++ b/sys/dev/e1000/e1000_hw.h @@ -209,6 +209,7 @@ struct e1000_hw; #define E1000_DEV_ID_I210_SGMII 0x1538 #define E1000_DEV_ID_I210_COPPER_FLASHLESS 0x157B #define E1000_DEV_ID_I210_SERDES_FLASHLESS 0x157C +#define E1000_DEV_ID_I210_SGMII_FLASHLESS 0x15F6 #define E1000_DEV_ID_I211_COPPER 0x1539 #define E1000_DEV_ID_I354_BACKPLANE_1GBPS 0x1F40 #define E1000_DEV_ID_I354_SGMII 0x1F41 diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 79361174311d..f09e8dd79b0c 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -233,6 +233,7 @@ static pci_vendor_info_t igb_vendor_info_array[] = PVID(0x8086, E1000_DEV_ID_I210_COPPER_OEM1, "Intel(R) I210 (OEM)"), PVID(0x8086, E1000_DEV_ID_I210_COPPER_FLASHLESS, "Intel(R) I210 Flashless (Copper)"), PVID(0x8086, E1000_DEV_ID_I210_SERDES_FLASHLESS, "Intel(R) I210 Flashless (SERDES)"), + PVID(0x8086, E1000_DEV_ID_I210_SGMII_FLASHLESS, "Intel(R) I210 Flashless (SGMII)"), PVID(0x8086, E1000_DEV_ID_I210_FIBER, "Intel(R) I210 (Fiber)"), PVID(0x8086, E1000_DEV_ID_I210_SERDES, "Intel(R) I210 (SERDES)"), PVID(0x8086, E1000_DEV_ID_I210_SGMII, "Intel(R) I210 (SGMII)"), From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE7B76B1058; Fri, 24 Sep 2021 01:35: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 4HFvjR5b1tz3JX8; Fri, 24 Sep 2021 01:35: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 9EB405758; Fri, 24 Sep 2021 01:35: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 18O1Z75v029133; Fri, 24 Sep 2021 01:35:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1Z7A3029132; Fri, 24 Sep 2021 01:35:07 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:07 GMT Message-Id: <202109240135.18O1Z7A3029132@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: f72caa3ea943 - stable/13 - e1000: expose xMDIO methods 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: f72caa3ea943bdb54bfc8112c8c7b6e6a59dd97d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:08 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=f72caa3ea943bdb54bfc8112c8c7b6e6a59dd97d commit f72caa3ea943bdb54bfc8112c8c7b6e6a59dd97d Author: Guinan Sun AuthorDate: 2020-07-06 08:12:00 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:19:54 +0000 e1000: expose xMDIO methods Move read and write xmdio methods to e1000_phy. Signed-off-by: Sasha Neftin Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (b14d20f1b2bb0e6d95f19963c5d7f55374e0ead9) MFC after: 1 week (cherry picked from commit da24467c7a162691a14f2f74d90ff8dedb816cfc) --- sys/dev/e1000/e1000_i210.c | 71 --------------------------------------------- sys/dev/e1000/e1000_i210.h | 4 --- sys/dev/e1000/e1000_phy.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++ sys/dev/e1000/e1000_phy.h | 5 ++++ 4 files changed, 77 insertions(+), 75 deletions(-) diff --git a/sys/dev/e1000/e1000_i210.c b/sys/dev/e1000/e1000_i210.c index 88806891566f..c0055aa0df71 100644 --- a/sys/dev/e1000/e1000_i210.c +++ b/sys/dev/e1000/e1000_i210.c @@ -600,77 +600,6 @@ out: return ret_val; } -/** - * __e1000_access_xmdio_reg - Read/write XMDIO register - * @hw: pointer to the HW structure - * @address: XMDIO address to program - * @dev_addr: device address to program - * @data: pointer to value to read/write from/to the XMDIO address - * @read: boolean flag to indicate read or write - **/ -static s32 __e1000_access_xmdio_reg(struct e1000_hw *hw, u16 address, - u8 dev_addr, u16 *data, bool read) -{ - s32 ret_val; - - DEBUGFUNC("__e1000_access_xmdio_reg"); - - ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, dev_addr); - if (ret_val) - return ret_val; - - ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAAD, address); - if (ret_val) - return ret_val; - - ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, E1000_MMDAC_FUNC_DATA | - dev_addr); - if (ret_val) - return ret_val; - - if (read) - ret_val = hw->phy.ops.read_reg(hw, E1000_MMDAAD, data); - else - ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAAD, *data); - if (ret_val) - return ret_val; - - /* Recalibrate the device back to 0 */ - ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, 0); - if (ret_val) - return ret_val; - - return ret_val; -} - -/** - * e1000_read_xmdio_reg - Read XMDIO register - * @hw: pointer to the HW structure - * @addr: XMDIO address to program - * @dev_addr: device address to program - * @data: value to be read from the EMI address - **/ -s32 e1000_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 *data) -{ - DEBUGFUNC("e1000_read_xmdio_reg"); - - return __e1000_access_xmdio_reg(hw, addr, dev_addr, data, TRUE); -} - -/** - * e1000_write_xmdio_reg - Write XMDIO register - * @hw: pointer to the HW structure - * @addr: XMDIO address to program - * @dev_addr: device address to program - * @data: value to be written to the XMDIO address - **/ -s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 data) -{ - DEBUGFUNC("e1000_read_xmdio_reg"); - - return __e1000_access_xmdio_reg(hw, addr, dev_addr, &data, FALSE); -} - /** * e1000_pll_workaround_i210 * @hw: pointer to the HW structure diff --git a/sys/dev/e1000/e1000_i210.h b/sys/dev/e1000/e1000_i210.h index d1ef4edf6261..9ad9e28c363b 100644 --- a/sys/dev/e1000/e1000_i210.h +++ b/sys/dev/e1000/e1000_i210.h @@ -44,10 +44,6 @@ s32 e1000_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); s32 e1000_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); -s32 e1000_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, - u16 *data); -s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, - u16 data); s32 e1000_init_hw_i210(struct e1000_hw *hw); #define E1000_STM_OPCODE 0xDB00 diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index 3215ed33d115..d22bcb7149c1 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -4251,3 +4251,75 @@ bool e1000_is_mphy_ready(struct e1000_hw *hw) return ready; } + +/** + * __e1000_access_xmdio_reg - Read/write XMDIO register + * @hw: pointer to the HW structure + * @address: XMDIO address to program + * @dev_addr: device address to program + * @data: pointer to value to read/write from/to the XMDIO address + * @read: boolean flag to indicate read or write + **/ +static s32 __e1000_access_xmdio_reg(struct e1000_hw *hw, u16 address, + u8 dev_addr, u16 *data, bool read) +{ + s32 ret_val; + + DEBUGFUNC("__e1000_access_xmdio_reg"); + + ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, dev_addr); + if (ret_val) + return ret_val; + + ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAAD, address); + if (ret_val) + return ret_val; + + ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, E1000_MMDAC_FUNC_DATA | + dev_addr); + if (ret_val) + return ret_val; + + if (read) + ret_val = hw->phy.ops.read_reg(hw, E1000_MMDAAD, data); + else + ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAAD, *data); + if (ret_val) + return ret_val; + + /* Recalibrate the device back to 0 */ + ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, 0); + if (ret_val) + return ret_val; + + return ret_val; +} + +/** + * e1000_read_xmdio_reg - Read XMDIO register + * @hw: pointer to the HW structure + * @addr: XMDIO address to program + * @dev_addr: device address to program + * @data: value to be read from the EMI address + **/ +s32 e1000_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 *data) +{ + DEBUGFUNC("e1000_read_xmdio_reg"); + + return __e1000_access_xmdio_reg(hw, addr, dev_addr, data, true); +} + +/** + * e1000_write_xmdio_reg - Write XMDIO register + * @hw: pointer to the HW structure + * @addr: XMDIO address to program + * @dev_addr: device address to program + * @data: value to be written to the XMDIO address + **/ +s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 data) +{ + DEBUGFUNC("e1000_write_xmdio_reg"); + + return __e1000_access_xmdio_reg(hw, addr, dev_addr, &data, + false); +} diff --git a/sys/dev/e1000/e1000_phy.h b/sys/dev/e1000/e1000_phy.h index a13413e98638..38c8f9b466ce 100644 --- a/sys/dev/e1000/e1000_phy.h +++ b/sys/dev/e1000/e1000_phy.h @@ -122,6 +122,11 @@ s32 e1000_write_phy_reg_mphy(struct e1000_hw *hw, u32 address, u32 data, bool line_override); bool e1000_is_mphy_ready(struct e1000_hw *hw); +s32 e1000_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, + u16 *data); +s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, + u16 data); + #define E1000_MAX_PHY_ADDR 8 /* IGP01E1000 Specific Registers */ From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 420A46B168A; Fri, 24 Sep 2021 01:35:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFvjT12yBz3JP1; Fri, 24 Sep 2021 01:35:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B51E55A53; Fri, 24 Sep 2021 01:35:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18O1Z8Rx029163; Fri, 24 Sep 2021 01:35:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1Z8TU029162; Fri, 24 Sep 2021 01:35:08 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:08 GMT Message-Id: <202109240135.18O1Z8TU029162@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: b67aeb0b070d - stable/13 - e1000: add function parameter descriptions 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: b67aeb0b070d6559e7d1c060494958c640916e44 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:09 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=b67aeb0b070d6559e7d1c060494958c640916e44 commit b67aeb0b070d6559e7d1c060494958c640916e44 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:02 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:20:16 +0000 e1000: add function parameter descriptions Add function parameter descriptions to address gcc 7 warnings. Signed-off-by: Todd Fujinaka Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (1bf35d435c9764e83be76042fa6489dd127b6c40) MFC after: 1 week (cherry picked from commit 5b426b3e8cbd5abdb3a57ff49cd27c36cac03427) --- sys/dev/e1000/e1000_82575.c | 11 +++++------ sys/dev/e1000/e1000_mac.c | 8 ++++++++ sys/dev/e1000/e1000_mbx.c | 4 ++++ sys/dev/e1000/e1000_nvm.c | 7 +++++++ sys/dev/e1000/e1000_phy.c | 6 ++++++ 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index 27e564d7841b..296a72542914 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -2702,7 +2702,7 @@ out: /** * __e1000_access_emi_reg - Read/write EMI register * @hw: pointer to the HW structure - * @addr: EMI address to program + * @address: EMI address to program * @data: pointer to value to read/write from/to the EMI address * @read: boolean flag to indicate read or write **/ @@ -2929,8 +2929,8 @@ out: /** * e1000_set_eee_i350 - Enable/disable EEE support * @hw: pointer to the HW structure - * @adv1g: boolean flag enabling 1G EEE advertisement - * @adv100m: boolean flag enabling 100M EEE advertisement + * @adv1G: boolean flag enabling 1G EEE advertisement + * @adv100M: boolean flag enabling 100M EEE advertisement * * Enable/disable EEE based on setting in dev_spec structure. * @@ -2984,8 +2984,8 @@ out: /** * e1000_set_eee_i354 - Enable/disable EEE support * @hw: pointer to the HW structure - * @adv1g: boolean flag enabling 1G EEE advertisement - * @adv100m: boolean flag enabling 100M EEE advertisement + * @adv1G: boolean flag enabling 1G EEE advertisement + * @adv100M: boolean flag enabling 100M EEE advertisement * * Enable/disable EEE legacy mode based on setting in dev_spec structure. * @@ -3641,7 +3641,6 @@ static s32 e1000_set_i2c_data(struct e1000_hw *hw, u32 *i2cctl, bool data) /** * e1000_get_i2c_data - Reads the I2C SDA data bit - * @hw: pointer to hardware structure * @i2cctl: Current value of I2CCTL register * * Returns the I2C data bit value diff --git a/sys/dev/e1000/e1000_mac.c b/sys/dev/e1000/e1000_mac.c index 11fbcb62142f..bda2ad65e3dc 100644 --- a/sys/dev/e1000/e1000_mac.c +++ b/sys/dev/e1000/e1000_mac.c @@ -105,6 +105,8 @@ void e1000_null_mac_generic(struct e1000_hw E1000_UNUSEDARG *hw) /** * e1000_null_link_info - No-op function, return 0 * @hw: pointer to the HW structure + * @s: dummy variable + * @d: dummy variable **/ s32 e1000_null_link_info(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG *s, u16 E1000_UNUSEDARG *d) @@ -126,6 +128,8 @@ bool e1000_null_mng_mode(struct e1000_hw E1000_UNUSEDARG *hw) /** * e1000_null_update_mc - No-op function, return void * @hw: pointer to the HW structure + * @h: dummy variable + * @a: dummy variable **/ void e1000_null_update_mc(struct e1000_hw E1000_UNUSEDARG *hw, u8 E1000_UNUSEDARG *h, u32 E1000_UNUSEDARG a) @@ -137,6 +141,8 @@ void e1000_null_update_mc(struct e1000_hw E1000_UNUSEDARG *hw, /** * e1000_null_write_vfta - No-op function, return void * @hw: pointer to the HW structure + * @a: dummy variable + * @b: dummy variable **/ void e1000_null_write_vfta(struct e1000_hw E1000_UNUSEDARG *hw, u32 E1000_UNUSEDARG a, u32 E1000_UNUSEDARG b) @@ -148,6 +154,8 @@ void e1000_null_write_vfta(struct e1000_hw E1000_UNUSEDARG *hw, /** * e1000_null_rar_set - No-op function, return 0 * @hw: pointer to the HW structure + * @h: dummy variable + * @a: dummy variable **/ int e1000_null_rar_set(struct e1000_hw E1000_UNUSEDARG *hw, u8 E1000_UNUSEDARG *h, u32 E1000_UNUSEDARG a) diff --git a/sys/dev/e1000/e1000_mbx.c b/sys/dev/e1000/e1000_mbx.c index da31185c3476..3fc3811757f7 100644 --- a/sys/dev/e1000/e1000_mbx.c +++ b/sys/dev/e1000/e1000_mbx.c @@ -38,6 +38,7 @@ /** * e1000_null_mbx_check_for_flag - No-op function, return 0 * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to read **/ static s32 e1000_null_mbx_check_for_flag(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG mbx_id) @@ -50,6 +51,9 @@ static s32 e1000_null_mbx_check_for_flag(struct e1000_hw E1000_UNUSEDARG *hw, /** * e1000_null_mbx_transact - No-op function, return 0 * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @mbx_id: id of mailbox to read **/ static s32 e1000_null_mbx_transact(struct e1000_hw E1000_UNUSEDARG *hw, u32 E1000_UNUSEDARG *msg, diff --git a/sys/dev/e1000/e1000_nvm.c b/sys/dev/e1000/e1000_nvm.c index f46444cf38b9..46c00e1d64b3 100644 --- a/sys/dev/e1000/e1000_nvm.c +++ b/sys/dev/e1000/e1000_nvm.c @@ -63,6 +63,9 @@ void e1000_init_nvm_ops_generic(struct e1000_hw *hw) /** * e1000_null_nvm_read - No-op function, return 0 * @hw: pointer to the HW structure + * @a: dummy variable + * @b: dummy variable + * @c: dummy variable **/ s32 e1000_null_read_nvm(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG a, u16 E1000_UNUSEDARG b, @@ -85,6 +88,7 @@ void e1000_null_nvm_generic(struct e1000_hw E1000_UNUSEDARG *hw) /** * e1000_null_led_default - No-op function, return 0 * @hw: pointer to the HW structure + * @data: dummy variable **/ s32 e1000_null_led_default(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG *data) @@ -96,6 +100,9 @@ s32 e1000_null_led_default(struct e1000_hw E1000_UNUSEDARG *hw, /** * e1000_null_write_nvm - No-op function, return 0 * @hw: pointer to the HW structure + * @a: dummy variable + * @b: dummy variable + * @c: dummy variable **/ s32 e1000_null_write_nvm(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG a, u16 E1000_UNUSEDARG b, diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index d22bcb7149c1..d73e3a10ae13 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -104,6 +104,7 @@ void e1000_init_phy_ops_generic(struct e1000_hw *hw) /** * e1000_null_set_page - No-op function, return 0 * @hw: pointer to the HW structure + * @data: dummy variable **/ s32 e1000_null_set_page(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG data) @@ -115,6 +116,8 @@ s32 e1000_null_set_page(struct e1000_hw E1000_UNUSEDARG *hw, /** * e1000_null_read_reg - No-op function, return 0 * @hw: pointer to the HW structure + * @offset: dummy variable + * @data: dummy variable **/ s32 e1000_null_read_reg(struct e1000_hw E1000_UNUSEDARG *hw, u32 E1000_UNUSEDARG offset, u16 E1000_UNUSEDARG *data) @@ -136,6 +139,7 @@ void e1000_null_phy_generic(struct e1000_hw E1000_UNUSEDARG *hw) /** * e1000_null_lplu_state - No-op function, return 0 * @hw: pointer to the HW structure + * @active: dummy variable **/ s32 e1000_null_lplu_state(struct e1000_hw E1000_UNUSEDARG *hw, bool E1000_UNUSEDARG active) @@ -147,6 +151,8 @@ s32 e1000_null_lplu_state(struct e1000_hw E1000_UNUSEDARG *hw, /** * e1000_null_write_reg - No-op function, return 0 * @hw: pointer to the HW structure + * @offset: dummy variable + * @data: dummy variable **/ s32 e1000_null_write_reg(struct e1000_hw E1000_UNUSEDARG *hw, u32 E1000_UNUSEDARG offset, u16 E1000_UNUSEDARG data) From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6FCBB6B141A; Fri, 24 Sep 2021 01:35: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 4HFvjX24Ckz3JM7; Fri, 24 Sep 2021 01:35: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 23F6456EC; Fri, 24 Sep 2021 01:35: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 18O1ZCMW029238; Fri, 24 Sep 2021 01:35:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1ZCZ6029237; Fri, 24 Sep 2021 01:35:12 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:12 GMT Message-Id: <202109240135.18O1ZCZ6029237@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: e4a16771e8f3 - stable/13 - e1000: remove duplicated phy codes 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: e4a16771e8f3307effe78ec64db35a09319b655a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:12 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e4a16771e8f3307effe78ec64db35a09319b655a commit e4a16771e8f3307effe78ec64db35a09319b655a Author: Guinan Sun AuthorDate: 2020-07-06 08:12:05 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:21:34 +0000 e1000: remove duplicated phy codes Add two files base.c and base.h to reduce the redundancy in the silicon family code. Remove the code duplication from e1000_82575 files. Clean family specific functions from base. Fix up a stray and duplicate function declaration. Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Neftin Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (44dddd14059f151f39f7e075b887decfc9a10f11) MFC after: 1 week (cherry picked from commit 6b9d35fac12bf657cd1df8f1521c70704ff62b61) --- sys/conf/files | 2 + sys/dev/e1000/e1000_82575.c | 471 ++++++++++++++---------------------------- sys/dev/e1000/e1000_82575.h | 93 +-------- sys/dev/e1000/e1000_api.h | 1 - sys/dev/e1000/e1000_base.c | 221 ++++++++++++++++++++ sys/dev/e1000/e1000_base.h | 158 ++++++++++++++ sys/dev/e1000/e1000_defines.h | 14 +- sys/dev/e1000/e1000_hw.h | 1 + sys/dev/e1000/e1000_i210.c | 2 +- sys/dev/e1000/e1000_regs.h | 23 ++- sys/dev/e1000/if_em.c | 2 +- sys/dev/e1000/igb_txrx.c | 4 +- sys/modules/em/Makefile | 6 +- 13 files changed, 578 insertions(+), 420 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 5f6ec9a5c546..21239c31e83f 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1677,6 +1677,8 @@ dev/e1000/e1000_i210.c optional em \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_api.c optional em \ compile-with "${NORMAL_C} -I$S/dev/e1000" +dev/e1000/e1000_base.c optional em \ + compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_mac.c optional em \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_manage.c optional em \ diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index b252a4c7ff1d..172e99b02d5c 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -48,8 +48,6 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw); static s32 e1000_init_mac_params_82575(struct e1000_hw *hw); -static s32 e1000_acquire_phy_82575(struct e1000_hw *hw); -static void e1000_release_phy_82575(struct e1000_hw *hw); static s32 e1000_acquire_nvm_82575(struct e1000_hw *hw); static void e1000_release_nvm_82575(struct e1000_hw *hw); static s32 e1000_check_for_link_82575(struct e1000_hw *hw); @@ -61,6 +59,7 @@ static s32 e1000_phy_hw_reset_sgmii_82575(struct e1000_hw *hw); static s32 e1000_read_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset, u16 *data); static s32 e1000_reset_hw_82575(struct e1000_hw *hw); +static s32 e1000_init_hw_82575(struct e1000_hw *hw); static s32 e1000_reset_hw_82580(struct e1000_hw *hw); static s32 e1000_read_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 *data); @@ -84,10 +83,8 @@ static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, u16 *speed, u16 *duplex); static s32 e1000_get_phy_id_82575(struct e1000_hw *hw); static bool e1000_sgmii_active_82575(struct e1000_hw *hw); -static s32 e1000_reset_init_script_82575(struct e1000_hw *hw); static s32 e1000_read_mac_addr_82575(struct e1000_hw *hw); static void e1000_config_collision_dist_82575(struct e1000_hw *hw); -static void e1000_power_down_phy_copper_82575(struct e1000_hw *hw); static void e1000_shutdown_serdes_link_82575(struct e1000_hw *hw); static void e1000_power_up_serdes_link_82575(struct e1000_hw *hw); static s32 e1000_set_pcie_completion_timeout(struct e1000_hw *hw); @@ -156,8 +153,8 @@ static bool e1000_sgmii_uses_mdio_82575(struct e1000_hw *hw) } /** - * e1000_init_phy_params_82575 - Init PHY func ptrs. - * @hw: pointer to the HW structure + * e1000_init_phy_params_82575 - Initialize PHY function ptrs + * @hw: pointer to the HW structure **/ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) { @@ -175,17 +172,17 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) goto out; } - phy->ops.power_up = e1000_power_up_phy_copper; - phy->ops.power_down = e1000_power_down_phy_copper_82575; + phy->ops.power_up = e1000_power_up_phy_copper; + phy->ops.power_down = e1000_power_down_phy_copper_base; phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; phy->reset_delay_us = 100; - phy->ops.acquire = e1000_acquire_phy_82575; + phy->ops.acquire = e1000_acquire_phy_base; phy->ops.check_reset_block = e1000_check_reset_block_generic; phy->ops.commit = e1000_phy_sw_reset_generic; phy->ops.get_cfg_done = e1000_get_cfg_done_82575; - phy->ops.release = e1000_release_phy_82575; + phy->ops.release = e1000_release_phy_base; ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); @@ -232,76 +229,39 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) case I347AT4_E_PHY_ID: case M88E1112_E_PHY_ID: case M88E1340M_E_PHY_ID: + phy->type = e1000_phy_m88; + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.get_info = e1000_get_phy_info_m88; + phy->ops.get_cable_length = e1000_get_cable_length_m88_gen2; + phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; + break; case M88E1111_I_PHY_ID: phy->type = e1000_phy_m88; phy->ops.check_polarity = e1000_check_polarity_m88; phy->ops.get_info = e1000_get_phy_info_m88; - if (phy->id == I347AT4_E_PHY_ID || - phy->id == M88E1112_E_PHY_ID || - phy->id == M88E1340M_E_PHY_ID) - phy->ops.get_cable_length = - e1000_get_cable_length_m88_gen2; - else if (phy->id == M88E1543_E_PHY_ID || - phy->id == M88E1512_E_PHY_ID) - phy->ops.get_cable_length = - e1000_get_cable_length_m88_gen2; - else - phy->ops.get_cable_length = e1000_get_cable_length_m88; + phy->ops.get_cable_length = e1000_get_cable_length_m88; phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; - /* Check if this PHY is confgured for media swap. */ - if (phy->id == M88E1112_E_PHY_ID) { - u16 data; - - ret_val = phy->ops.write_reg(hw, - E1000_M88E1112_PAGE_ADDR, - 2); - if (ret_val) - goto out; - - ret_val = phy->ops.read_reg(hw, - E1000_M88E1112_MAC_CTRL_1, - &data); - if (ret_val) - goto out; - - data = (data & E1000_M88E1112_MAC_CTRL_1_MODE_MASK) >> - E1000_M88E1112_MAC_CTRL_1_MODE_SHIFT; - if (data == E1000_M88E1112_AUTO_COPPER_SGMII || - data == E1000_M88E1112_AUTO_COPPER_BASEX) - hw->mac.ops.check_for_link = - e1000_check_for_link_media_swap; - } - if (phy->id == M88E1512_E_PHY_ID) { - ret_val = e1000_initialize_M88E1512_phy(hw); - if (ret_val) - goto out; - } - if (phy->id == M88E1543_E_PHY_ID) { - ret_val = e1000_initialize_M88E1543_phy(hw); - if (ret_val) - goto out; - } break; case IGP03E1000_E_PHY_ID: case IGP04E1000_E_PHY_ID: - phy->type = e1000_phy_igp_3; - phy->ops.check_polarity = e1000_check_polarity_igp; - phy->ops.get_info = e1000_get_phy_info_igp; + phy->type = e1000_phy_igp_3; + phy->ops.check_polarity = e1000_check_polarity_igp; + phy->ops.get_info = e1000_get_phy_info_igp; phy->ops.get_cable_length = e1000_get_cable_length_igp_2; - phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_igp; phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82575; phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; + phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_igp; break; case I82580_I_PHY_ID: case I350_I_PHY_ID: - phy->type = e1000_phy_82580; - phy->ops.check_polarity = e1000_check_polarity_82577; - phy->ops.force_speed_duplex = - e1000_phy_force_speed_duplex_82577; + phy->type = e1000_phy_82580; + phy->ops.check_polarity = e1000_check_polarity_82577; + phy->ops.get_info = e1000_get_phy_info_82577; phy->ops.get_cable_length = e1000_get_cable_length_82577; - phy->ops.get_info = e1000_get_phy_info_82577; phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82580; phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_82580; + phy->ops.force_speed_duplex = + e1000_phy_force_speed_duplex_82577; break; case I210_I_PHY_ID: phy->type = e1000_phy_i210; @@ -317,98 +277,49 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) goto out; } -out: - return ret_val; -} - -/** - * e1000_init_nvm_params_82575 - Init NVM func ptrs. - * @hw: pointer to the HW structure - **/ -s32 e1000_init_nvm_params_82575(struct e1000_hw *hw) -{ - struct e1000_nvm_info *nvm = &hw->nvm; - u32 eecd = E1000_READ_REG(hw, E1000_EECD); - u16 size; - - DEBUGFUNC("e1000_init_nvm_params_82575"); - - size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> - E1000_EECD_SIZE_EX_SHIFT); - /* - * Added to a constant, "size" becomes the left-shift value - * for setting word_size. - */ - size += NVM_WORD_SIZE_BASE_SHIFT; - - /* Just in case size is out of range, cap it to the largest - * EEPROM size supported - */ - if (size > 15) - size = 15; - - nvm->word_size = 1 << size; - if (hw->mac.type < e1000_i210) { - nvm->opcode_bits = 8; - nvm->delay_usec = 1; + /* Check if this PHY is configured for media swap. */ + switch (phy->id) { + case M88E1112_E_PHY_ID: + { + u16 data; - switch (nvm->override) { - case e1000_nvm_override_spi_large: - nvm->page_size = 32; - nvm->address_bits = 16; - break; - case e1000_nvm_override_spi_small: - nvm->page_size = 8; - nvm->address_bits = 8; - break; - default: - nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; - nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? - 16 : 8; - break; - } - if (nvm->word_size == (1 << 15)) - nvm->page_size = 128; + ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 2); + if (ret_val) + goto out; + ret_val = phy->ops.read_reg(hw, E1000_M88E1112_MAC_CTRL_1, + &data); + if (ret_val) + goto out; - nvm->type = e1000_nvm_eeprom_spi; - } else { - nvm->type = e1000_nvm_flash_hw; + data = (data & E1000_M88E1112_MAC_CTRL_1_MODE_MASK) >> + E1000_M88E1112_MAC_CTRL_1_MODE_SHIFT; + if (data == E1000_M88E1112_AUTO_COPPER_SGMII || + data == E1000_M88E1112_AUTO_COPPER_BASEX) + hw->mac.ops.check_for_link = + e1000_check_for_link_media_swap; + break; } - - /* Function Pointers */ - nvm->ops.acquire = e1000_acquire_nvm_82575; - nvm->ops.release = e1000_release_nvm_82575; - if (nvm->word_size < (1 << 15)) - nvm->ops.read = e1000_read_nvm_eerd; - else - nvm->ops.read = e1000_read_nvm_spi; - - nvm->ops.write = e1000_write_nvm_spi; - nvm->ops.validate = e1000_validate_nvm_checksum_generic; - nvm->ops.update = e1000_update_nvm_checksum_generic; - nvm->ops.valid_led_default = e1000_valid_led_default_82575; - - /* override generic family function pointers for specific descendants */ - switch (hw->mac.type) { - case e1000_82580: - nvm->ops.validate = e1000_validate_nvm_checksum_82580; - nvm->ops.update = e1000_update_nvm_checksum_82580; + case M88E1512_E_PHY_ID: + { + ret_val = e1000_initialize_M88E1512_phy(hw); break; - case e1000_i350: - case e1000_i354: - nvm->ops.validate = e1000_validate_nvm_checksum_i350; - nvm->ops.update = e1000_update_nvm_checksum_i350; + } + case M88E1543_E_PHY_ID: + { + ret_val = e1000_initialize_M88E1543_phy(hw); break; + } default: - break; + goto out; } - return E1000_SUCCESS; +out: + return ret_val; } /** - * e1000_init_mac_params_82575 - Init MAC func ptrs. - * @hw: pointer to the HW structure + * e1000_init_mac_params_82575 - Init MAC func ptrs. + * @hw: pointer to the HW structure **/ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) { @@ -417,13 +328,16 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) DEBUGFUNC("e1000_init_mac_params_82575"); + /* Initialize function pointer */ + e1000_init_mac_ops_generic(hw); + /* Derives media type */ e1000_get_media_type_82575(hw); - /* Set mta register count */ + /* Set MTA register count */ mac->mta_reg_count = 128; - /* Set uta register count */ + /* Set UTA register count */ mac->uta_reg_count = (hw->mac.type == e1000_82575) ? 0 : 128; - /* Set rar entry count */ + /* Set RAR entry count */ mac->rar_entry_count = E1000_RAR_ENTRIES_82575; if (mac->type == e1000_82576) mac->rar_entry_count = E1000_RAR_ENTRIES_82576; @@ -456,8 +370,8 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) if (mac->type >= e1000_82580) mac->ops.reset_hw = e1000_reset_hw_82580; else - mac->ops.reset_hw = e1000_reset_hw_82575; - /* hw initialization */ + mac->ops.reset_hw = e1000_reset_hw_82575; + /* HW initialization */ if ((mac->type == e1000_i210) || (mac->type == e1000_i211)) mac->ops.init_hw = e1000_init_hw_i210; else @@ -493,7 +407,7 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) } if (hw->mac.type >= e1000_82580) mac->ops.validate_mdi_setting = - e1000_validate_mdi_setting_crossover_generic; + e1000_validate_mdi_setting_crossover_generic; /* ID LED init */ mac->ops.id_led_init = e1000_id_led_init_generic; /* blink LED */ @@ -511,6 +425,7 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) mac->ops.get_link_up_info = e1000_get_link_up_info_82575; /* acquire SW_FW sync */ mac->ops.acquire_swfw_sync = e1000_acquire_swfw_sync; + /* release SW_FW sync */ mac->ops.release_swfw_sync = e1000_release_swfw_sync; /* set lan id for port to determine which phy lock to use */ @@ -520,63 +435,102 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) } /** - * e1000_init_function_pointers_82575 - Init func ptrs. - * @hw: pointer to the HW structure - * - * Called to initialize all function pointers and parameters. + * e1000_init_nvm_params_82575 - Initialize NVM function ptrs + * @hw: pointer to the HW structure **/ -void e1000_init_function_pointers_82575(struct e1000_hw *hw) +s32 e1000_init_nvm_params_82575(struct e1000_hw *hw) { - DEBUGFUNC("e1000_init_function_pointers_82575"); + struct e1000_nvm_info *nvm = &hw->nvm; + u32 eecd = E1000_READ_REG(hw, E1000_EECD); + u16 size; - hw->mac.ops.init_params = e1000_init_mac_params_82575; - hw->nvm.ops.init_params = e1000_init_nvm_params_82575; - hw->phy.ops.init_params = e1000_init_phy_params_82575; - hw->mbx.ops.init_params = e1000_init_mbx_params_pf; -} + DEBUGFUNC("e1000_init_nvm_params_82575"); -/** - * e1000_acquire_phy_82575 - Acquire rights to access PHY - * @hw: pointer to the HW structure - * - * Acquire access rights to the correct PHY. - **/ -static s32 e1000_acquire_phy_82575(struct e1000_hw *hw) -{ - u16 mask = E1000_SWFW_PHY0_SM; + size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> + E1000_EECD_SIZE_EX_SHIFT); + /* Added to a constant, "size" becomes the left-shift value + * for setting word_size. + */ + size += NVM_WORD_SIZE_BASE_SHIFT; - DEBUGFUNC("e1000_acquire_phy_82575"); + /* Just in case size is out of range, cap it to the largest + * EEPROM size supported + */ + if (size > 15) + size = 15; - if (hw->bus.func == E1000_FUNC_1) - mask = E1000_SWFW_PHY1_SM; - else if (hw->bus.func == E1000_FUNC_2) - mask = E1000_SWFW_PHY2_SM; - else if (hw->bus.func == E1000_FUNC_3) - mask = E1000_SWFW_PHY3_SM; + nvm->word_size = 1 << size; + if (hw->mac.type < e1000_i210) { + nvm->opcode_bits = 8; + nvm->delay_usec = 1; + + switch (nvm->override) { + case e1000_nvm_override_spi_large: + nvm->page_size = 32; + nvm->address_bits = 16; + break; + case e1000_nvm_override_spi_small: + nvm->page_size = 8; + nvm->address_bits = 8; + break; + default: + nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; + nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? + 16 : 8; + break; + } + if (nvm->word_size == (1 << 15)) + nvm->page_size = 128; + + nvm->type = e1000_nvm_eeprom_spi; + } else { + nvm->type = e1000_nvm_flash_hw; + } + + /* Function Pointers */ + nvm->ops.acquire = e1000_acquire_nvm_82575; + nvm->ops.release = e1000_release_nvm_82575; + if (nvm->word_size < (1 << 15)) + nvm->ops.read = e1000_read_nvm_eerd; + else + nvm->ops.read = e1000_read_nvm_spi; + + nvm->ops.write = e1000_write_nvm_spi; + nvm->ops.validate = e1000_validate_nvm_checksum_generic; + nvm->ops.update = e1000_update_nvm_checksum_generic; + nvm->ops.valid_led_default = e1000_valid_led_default_82575; + + /* override generic family function pointers for specific descendants */ + switch (hw->mac.type) { + case e1000_82580: + nvm->ops.validate = e1000_validate_nvm_checksum_82580; + nvm->ops.update = e1000_update_nvm_checksum_82580; + break; + case e1000_i350: + nvm->ops.validate = e1000_validate_nvm_checksum_i350; + nvm->ops.update = e1000_update_nvm_checksum_i350; + break; + default: + break; + } - return hw->mac.ops.acquire_swfw_sync(hw, mask); + return E1000_SUCCESS; } /** - * e1000_release_phy_82575 - Release rights to access PHY + * e1000_init_function_pointers_82575 - Init func ptrs. * @hw: pointer to the HW structure * - * A wrapper to release access rights to the correct PHY. + * Called to initialize all function pointers and parameters. **/ -static void e1000_release_phy_82575(struct e1000_hw *hw) +void e1000_init_function_pointers_82575(struct e1000_hw *hw) { - u16 mask = E1000_SWFW_PHY0_SM; - - DEBUGFUNC("e1000_release_phy_82575"); - - if (hw->bus.func == E1000_FUNC_1) - mask = E1000_SWFW_PHY1_SM; - else if (hw->bus.func == E1000_FUNC_2) - mask = E1000_SWFW_PHY2_SM; - else if (hw->bus.func == E1000_FUNC_3) - mask = E1000_SWFW_PHY3_SM; + DEBUGFUNC("e1000_init_function_pointers_82575"); - hw->mac.ops.release_swfw_sync(hw, mask); + hw->mac.ops.init_params = e1000_init_mac_params_82575; + hw->nvm.ops.init_params = e1000_init_nvm_params_82575; + hw->phy.ops.init_params = e1000_init_phy_params_82575; + hw->mbx.ops.init_params = e1000_init_mbx_params_pf; } /** @@ -1401,16 +1355,15 @@ static s32 e1000_reset_hw_82575(struct e1000_hw *hw) } /** - * e1000_init_hw_82575 - Initialize hardware - * @hw: pointer to the HW structure + * e1000_init_hw_82575 - Initialize hardware + * @hw: pointer to the HW structure * - * This inits the hardware readying it for operation. + * This inits the hardware readying it for operation. **/ -s32 e1000_init_hw_82575(struct e1000_hw *hw) +STATIC s32 e1000_init_hw_82575(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; s32 ret_val; - u16 i, rar_count = mac->rar_entry_count; DEBUGFUNC("e1000_init_hw_82575"); @@ -1425,27 +1378,12 @@ s32 e1000_init_hw_82575(struct e1000_hw *hw) DEBUGOUT("Initializing the IEEE VLAN\n"); mac->ops.clear_vfta(hw); - /* Setup the receive address */ - e1000_init_rx_addrs_generic(hw, rar_count); - - /* Zero out the Multicast HASH table */ - DEBUGOUT("Zeroing the MTA\n"); - for (i = 0; i < mac->mta_reg_count; i++) - E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); - - /* Zero out the Unicast HASH table */ - DEBUGOUT("Zeroing the UTA\n"); - for (i = 0; i < mac->uta_reg_count; i++) - E1000_WRITE_REG_ARRAY(hw, E1000_UTA, i, 0); - - /* Setup link and flow control */ - ret_val = mac->ops.setup_link(hw); + ret_val = e1000_init_hw_base(hw); /* Set the default MTU size */ hw->dev_spec._82575.mtu = 1500; - /* - * Clear all of the statistics registers (clear on read). It is + /* Clear all of the statistics registers (clear on read). It is * important that we do this after we have tried to establish link * because the symbol error count will increment wildly if there * is no link. @@ -1454,7 +1392,6 @@ s32 e1000_init_hw_82575(struct e1000_hw *hw) return ret_val; } - /** * e1000_setup_copper_link_82575 - Configure copper link settings * @hw: pointer to the HW structure @@ -1465,9 +1402,9 @@ s32 e1000_init_hw_82575(struct e1000_hw *hw) **/ static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw) { + u32 phpm_reg; u32 ctrl; s32 ret_val; - u32 phpm_reg; DEBUGFUNC("e1000_setup_copper_link_82575"); @@ -1889,7 +1826,7 @@ static bool e1000_sgmii_active_82575(struct e1000_hw *hw) * Inits recommended HW defaults after a reset when there is no EEPROM * detected. This is only for the 82575. **/ -static s32 e1000_reset_init_script_82575(struct e1000_hw *hw) +s32 e1000_reset_init_script_82575(struct e1000_hw *hw) { DEBUGFUNC("e1000_reset_init_script_82575"); @@ -1967,27 +1904,6 @@ static void e1000_config_collision_dist_82575(struct e1000_hw *hw) E1000_WRITE_FLUSH(hw); } -/** - * e1000_power_down_phy_copper_82575 - Remove link during PHY power down - * @hw: pointer to the HW structure - * - * In the case of a PHY power down to save power, or to turn off link during a - * driver unload, or wake on lan is not enabled, remove the link. - **/ -static void e1000_power_down_phy_copper_82575(struct e1000_hw *hw) -{ - struct e1000_phy_info *phy = &hw->phy; - - if (!(phy->ops.check_reset_block)) - return; - - /* If the management interface is not enabled, then power down */ - if (!(e1000_enable_mng_pass_thru(hw) || phy->ops.check_reset_block(hw))) - e1000_power_down_phy_copper(hw); - - return; -} - /** * e1000_clear_hw_cntrs_82575 - Clear device specific hardware counters * @hw: pointer to the HW structure @@ -2053,85 +1969,6 @@ static void e1000_clear_hw_cntrs_82575(struct e1000_hw *hw) E1000_READ_REG(hw, E1000_SCVPC); } -/** - * e1000_rx_fifo_flush_82575 - Clean rx fifo after Rx enable - * @hw: pointer to the HW structure - * - * After Rx enable, if manageability is enabled then there is likely some - * bad data at the start of the fifo and possibly in the DMA fifo. This - * function clears the fifos and flushes any packets that came in as rx was - * being enabled. - **/ -void e1000_rx_fifo_flush_82575(struct e1000_hw *hw) -{ - u32 rctl, rlpml, rxdctl[4], rfctl, temp_rctl, rx_enabled; - int i, ms_wait; - - DEBUGFUNC("e1000_rx_fifo_flush_82575"); - - /* disable IPv6 options as per hardware errata */ - rfctl = E1000_READ_REG(hw, E1000_RFCTL); - rfctl |= E1000_RFCTL_IPV6_EX_DIS; - E1000_WRITE_REG(hw, E1000_RFCTL, rfctl); - - if (hw->mac.type != e1000_82575 || - !(E1000_READ_REG(hw, E1000_MANC) & E1000_MANC_RCV_TCO_EN)) - return; - - /* Disable all Rx queues */ - for (i = 0; i < 4; i++) { - rxdctl[i] = E1000_READ_REG(hw, E1000_RXDCTL(i)); - E1000_WRITE_REG(hw, E1000_RXDCTL(i), - rxdctl[i] & ~E1000_RXDCTL_QUEUE_ENABLE); - } - /* Poll all queues to verify they have shut down */ - for (ms_wait = 0; ms_wait < 10; ms_wait++) { - msec_delay(1); - rx_enabled = 0; - for (i = 0; i < 4; i++) - rx_enabled |= E1000_READ_REG(hw, E1000_RXDCTL(i)); - if (!(rx_enabled & E1000_RXDCTL_QUEUE_ENABLE)) - break; - } - - if (ms_wait == 10) - DEBUGOUT("Queue disable timed out after 10ms\n"); - - /* Clear RLPML, RCTL.SBP, RFCTL.LEF, and set RCTL.LPE so that all - * incoming packets are rejected. Set enable and wait 2ms so that - * any packet that was coming in as RCTL.EN was set is flushed - */ - E1000_WRITE_REG(hw, E1000_RFCTL, rfctl & ~E1000_RFCTL_LEF); - - rlpml = E1000_READ_REG(hw, E1000_RLPML); - E1000_WRITE_REG(hw, E1000_RLPML, 0); - - rctl = E1000_READ_REG(hw, E1000_RCTL); - temp_rctl = rctl & ~(E1000_RCTL_EN | E1000_RCTL_SBP); - temp_rctl |= E1000_RCTL_LPE; - - E1000_WRITE_REG(hw, E1000_RCTL, temp_rctl); - E1000_WRITE_REG(hw, E1000_RCTL, temp_rctl | E1000_RCTL_EN); - E1000_WRITE_FLUSH(hw); - msec_delay(2); - - /* Enable Rx queues that were previously enabled and restore our - * previous state - */ - for (i = 0; i < 4; i++) - E1000_WRITE_REG(hw, E1000_RXDCTL(i), rxdctl[i]); - E1000_WRITE_REG(hw, E1000_RCTL, rctl); - E1000_WRITE_FLUSH(hw); - - E1000_WRITE_REG(hw, E1000_RLPML, rlpml); - E1000_WRITE_REG(hw, E1000_RFCTL, rfctl); - - /* Flush receive errors generated by workaround */ - E1000_READ_REG(hw, E1000_ROC); - E1000_READ_REG(hw, E1000_RNBC); - E1000_READ_REG(hw, E1000_MPC); -} - /** * e1000_set_pcie_completion_timeout - set pci-e completion timeout * @hw: pointer to the HW structure diff --git a/sys/dev/e1000/e1000_82575.h b/sys/dev/e1000/e1000_82575.h index 22c2f8c4a2f5..d6665bfe64dd 100644 --- a/sys/dev/e1000/e1000_82575.h +++ b/sys/dev/e1000/e1000_82575.h @@ -56,9 +56,7 @@ #define E1000_RAR_ENTRIES_I350 32 #define E1000_SW_SYNCH_MB 0x00000100 #define E1000_STAT_DEV_RST_SET 0x00100000 -#define E1000_CTRL_DEV_RST 0x20000000 -#ifdef E1000_BIT_FIELDS struct e1000_adv_data_desc { __le64 buffer_addr; /* Address of the descriptor's data buffer */ union { @@ -121,7 +119,6 @@ struct e1000_adv_context_desc { } fields; } l4_setup; }; -#endif /* SRRCTL bit definitions */ #define E1000_SRRCTL_BSIZEPKT_SHIFT 10 /* Shift _right_ */ @@ -181,46 +178,12 @@ struct e1000_adv_context_desc { /* Immediate Interrupt Rx (A.K.A. Low Latency Interrupt) */ #define E1000_IMIR_PORT_IM_EN 0x00010000 /* TCP port enable */ #define E1000_IMIR_PORT_BP 0x00020000 /* TCP port check bypass */ -#define E1000_IMIREXT_SIZE_BP 0x00001000 /* Packet size bypass */ #define E1000_IMIREXT_CTRL_URG 0x00002000 /* Check URG bit in header */ #define E1000_IMIREXT_CTRL_ACK 0x00004000 /* Check ACK bit in header */ #define E1000_IMIREXT_CTRL_PSH 0x00008000 /* Check PSH bit in header */ #define E1000_IMIREXT_CTRL_RST 0x00010000 /* Check RST bit in header */ #define E1000_IMIREXT_CTRL_SYN 0x00020000 /* Check SYN bit in header */ #define E1000_IMIREXT_CTRL_FIN 0x00040000 /* Check FIN bit in header */ -#define E1000_IMIREXT_CTRL_BP 0x00080000 /* Bypass check of ctrl bits */ - -/* Receive Descriptor - Advanced */ -union e1000_adv_rx_desc { - struct { - __le64 pkt_addr; /* Packet buffer address */ - __le64 hdr_addr; /* Header buffer address */ - } read; - struct { - struct { - union { - __le32 data; - struct { - __le16 pkt_info; /*RSS type, Pkt type*/ - /* Split Header, header buffer len */ - __le16 hdr_info; - } hs_rss; - } lo_dword; - union { - __le32 rss; /* RSS Hash */ - struct { - __le16 ip_id; /* IP id */ - __le16 csum; /* Packet Checksum */ - } csum_ip; - } hi_dword; - } lower; - struct { - __le32 status_error; /* ext status/error */ - __le16 length; /* Packet length */ - __le16 vlan; /* VLAN tag */ - } upper; - } wb; /* writeback */ -}; #define E1000_RXDADV_RSSTYPE_MASK 0x0000000F #define E1000_RXDADV_RSSTYPE_SHIFT 12 @@ -229,7 +192,6 @@ union e1000_adv_rx_desc { #define E1000_RXDADV_SPLITHEADER_EN 0x00001000 #define E1000_RXDADV_SPH 0x8000 #define E1000_RXDADV_STAT_TS 0x10000 /* Pkt was time stamped */ -#define E1000_RXDADV_STAT_TSIP 0x08000 /* timestamp in packet */ #define E1000_RXDADV_ERR_HBO 0x00800000 /* RSS Hash results */ @@ -278,20 +240,6 @@ union e1000_adv_rx_desc { #define E1000_RXDADV_IPSEC_ERROR_INVALID_LENGTH 0x10000000 #define E1000_RXDADV_IPSEC_ERROR_AUTHENTICATION_FAILED 0x18000000 -/* Transmit Descriptor - Advanced */ -union e1000_adv_tx_desc { - struct { - __le64 buffer_addr; /* Address of descriptor's data buf */ - __le32 cmd_type_len; - __le32 olinfo_status; - } read; - struct { - __le64 rsvd; /* Reserved */ - __le32 nxtseq_seed; - __le32 status; - } wb; -}; - /* Adv Transmit Descriptor Config Masks */ #define E1000_ADVTXD_DTYP_CTXT 0x00200000 /* Advanced Context Descriptor */ #define E1000_ADVTXD_DTYP_DATA 0x00300000 /* Advanced Data Descriptor */ @@ -314,33 +262,6 @@ union e1000_adv_tx_desc { #define E1000_ADVTXD_POPTS_IPSEC 0x00000400 /* IPSec offload request */ #define E1000_ADVTXD_PAYLEN_SHIFT 14 /* Adv desc PAYLEN shift */ -/* Context descriptors */ -struct e1000_adv_tx_context_desc { - __le32 vlan_macip_lens; - __le32 seqnum_seed; - __le32 type_tucmd_mlhl; - __le32 mss_l4len_idx; -}; - -#define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */ -#define E1000_ADVTXD_VLAN_SHIFT 16 /* Adv ctxt vlan tag shift */ -#define E1000_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type: 1=IPv4 */ -#define E1000_ADVTXD_TUCMD_IPV6 0x00000000 /* IP Packet Type: 0=IPv6 */ -#define E1000_ADVTXD_TUCMD_L4T_UDP 0x00000000 /* L4 Packet TYPE of UDP */ -#define E1000_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */ -#define E1000_ADVTXD_TUCMD_L4T_SCTP 0x00001000 /* L4 Packet TYPE of SCTP */ -#define E1000_ADVTXD_TUCMD_IPSEC_TYPE_ESP 0x00002000 /* IPSec Type ESP */ -/* IPSec Encrypt Enable for ESP */ -#define E1000_ADVTXD_TUCMD_IPSEC_ENCRYPT_EN 0x00004000 -/* Req requires Markers and CRC */ -#define E1000_ADVTXD_TUCMD_MKRREQ 0x00002000 -#define E1000_ADVTXD_L4LEN_SHIFT 8 /* Adv ctxt L4LEN shift */ -#define E1000_ADVTXD_MSS_SHIFT 16 /* Adv ctxt MSS shift */ -/* Adv ctxt IPSec SA IDX mask */ -#define E1000_ADVTXD_IPSEC_SA_INDEX_MASK 0x000000FF -/* Adv ctxt IPSec ESP len mask */ -#define E1000_ADVTXD_IPSEC_ESP_LEN_MASK 0x000000FF - /* Additional Transmit Descriptor Control definitions */ #define E1000_TXDCTL_QUEUE_ENABLE 0x02000000 /* Ena specific Tx Queue */ #define E1000_TXDCTL_SWFLSH 0x04000000 /* Tx Desc. wbk flushing */ @@ -380,11 +301,6 @@ struct e1000_adv_tx_context_desc { #define E1000_IMS_LSECPNS E1000_ICR_LSECPNS /* PN threshold - server */ #define E1000_ICS_LSECPNS E1000_ICR_LSECPNS /* PN threshold - server */ -/* ETQF register bit definitions */ -#define E1000_ETQF_FILTER_ENABLE (1 << 26) -#define E1000_ETQF_IMM_INT (1 << 29) -#define E1000_ETQF_1588 (1 << 30) -#define E1000_ETQF_QUEUE_ENABLE (1U << 31) /* * ETQF filter list: one static filter per filter consumer. This is * to avoid filter collisions later. Add new filters @@ -395,10 +311,6 @@ struct e1000_adv_tx_context_desc { */ #define E1000_ETQF_FILTER_EAPOL 0 -#define E1000_FTQF_VF_BP 0x00008000 -#define E1000_FTQF_1588_TIME_STAMP 0x08000000 -#define E1000_FTQF_MASK 0xF0000000 -#define E1000_FTQF_MASK_PROTO_BP 0x10000000 #define E1000_FTQF_MASK_SOURCE_ADDR_BP 0x20000000 #define E1000_FTQF_MASK_DEST_ADDR_BP 0x40000000 #define E1000_FTQF_MASK_SOURCE_PORT_BP 0x80000000 @@ -474,13 +386,14 @@ struct e1000_adv_tx_context_desc { #define ALL_QUEUES 0xFFFF +s32 e1000_reset_init_script_82575(struct e1000_hw *hw); +s32 e1000_init_nvm_params_82575(struct e1000_hw *hw); + /* Rx packet buffer size defines */ #define E1000_RXPBS_SIZE_MASK_82576 0x0000007F void e1000_vmdq_set_loopback_pf(struct e1000_hw *hw, bool enable); void e1000_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf); void e1000_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable); -s32 e1000_init_nvm_params_82575(struct e1000_hw *hw); -s32 e1000_init_hw_82575(struct e1000_hw *hw); enum e1000_promisc_type { e1000_promisc_disabled = 0, /* all promisc modes disabled */ diff --git a/sys/dev/e1000/e1000_api.h b/sys/dev/e1000/e1000_api.h index 7e052910e7d0..db4caac37e97 100644 --- a/sys/dev/e1000/e1000_api.h +++ b/sys/dev/e1000/e1000_api.h @@ -46,7 +46,6 @@ extern void e1000_init_function_pointers_82541(struct e1000_hw *hw); extern void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw); extern void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw); extern void e1000_init_function_pointers_82575(struct e1000_hw *hw); -extern void e1000_rx_fifo_flush_82575(struct e1000_hw *hw); extern void e1000_init_function_pointers_vf(struct e1000_hw *hw); extern void e1000_power_up_fiber_serdes_link(struct e1000_hw *hw); extern void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw); diff --git a/sys/dev/e1000/e1000_base.c b/sys/dev/e1000/e1000_base.c new file mode 100644 index 000000000000..e12a5fbecf25 --- /dev/null +++ b/sys/dev/e1000/e1000_base.c @@ -0,0 +1,221 @@ +/****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause + + Copyright (c) 2001-2020, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. + +******************************************************************************/ +/*$FreeBSD$*/ + +#include "e1000_hw.h" +#include "e1000_82575.h" +#include "e1000_mac.h" +#include "e1000_base.h" +#include "e1000_manage.h" + +/** + * e1000_acquire_phy_base - Acquire rights to access PHY + * @hw: pointer to the HW structure + * + * Acquire access rights to the correct PHY. + **/ +s32 e1000_acquire_phy_base(struct e1000_hw *hw) +{ + u16 mask = E1000_SWFW_PHY0_SM; + + DEBUGFUNC("e1000_acquire_phy_base"); + + if (hw->bus.func == E1000_FUNC_1) + mask = E1000_SWFW_PHY1_SM; + else if (hw->bus.func == E1000_FUNC_2) + mask = E1000_SWFW_PHY2_SM; + else if (hw->bus.func == E1000_FUNC_3) + mask = E1000_SWFW_PHY3_SM; + + return hw->mac.ops.acquire_swfw_sync(hw, mask); +} + +/** + * e1000_release_phy_base - Release rights to access PHY *** 510 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A0246B136A; Fri, 24 Sep 2021 01:35: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 4HFvjV0ds5z3JZX; Fri, 24 Sep 2021 01:35: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 D8B625A54; Fri, 24 Sep 2021 01:35: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 18O1Z9Qu029190; Fri, 24 Sep 2021 01:35:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1Z976029189; Fri, 24 Sep 2021 01:35:09 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:09 GMT Message-Id: <202109240135.18O1Z976029189@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: 1704007555f9 - stable/13 - e1000: fix minor issues and improve code style 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: 1704007555f9be9e70af5d46979915330f153d62 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:10 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=1704007555f9be9e70af5d46979915330f153d62 commit 1704007555f9be9e70af5d46979915330f153d62 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:03 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:20:43 +0000 e1000: fix minor issues and improve code style Fix typo in piece of code of NVM access for SPT. And cleans up the remaining instances in the shared code where it was not adhering to the Linux code standard. Wrong description was found in the mentioned file, so fix them. Remove shadowing variable declarations. Relating to operands in bitwise operations having different sizes. Unreachable code since *clock_in_i2c_* always return success. Don't return unused s32 and don't check for constants. Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Neftin Signed-off-by: Vitaly Lifshits Signed-off-by: Robert Konklewski Signed-off-by: Doug Dziggel Signed-off-by: Todd Fujinaka Signed-off-by: Jacob Keller Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (b8592c89c8fbc871d22313dcac0b86c89a7d5a62) MFC after: 1 week (cherry picked from commit 6c59e1866ca7a48d84f1d298bb3e6a07d2e6f756) --- sys/dev/e1000/e1000_80003es2lan.c | 1 - sys/dev/e1000/e1000_82575.c | 16 +++++----------- sys/dev/e1000/e1000_i210.c | 8 +++----- sys/dev/e1000/e1000_ich8lan.c | 40 ++++++++++++++++++++------------------- sys/dev/e1000/e1000_mac.c | 2 +- sys/dev/e1000/e1000_nvm.c | 2 +- sys/dev/e1000/e1000_phy.c | 5 ++++- 7 files changed, 35 insertions(+), 39 deletions(-) diff --git a/sys/dev/e1000/e1000_80003es2lan.c b/sys/dev/e1000/e1000_80003es2lan.c index 50fdfab54685..db6f1aeb65fb 100644 --- a/sys/dev/e1000/e1000_80003es2lan.c +++ b/sys/dev/e1000/e1000_80003es2lan.c @@ -1168,7 +1168,6 @@ static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw) /** * e1000_cfg_on_link_up_80003es2lan - es2 link configuration after link-up * @hw: pointer to the HW structure - * @duplex: current duplex setting * * Configure the KMRN interface by applying last minute quirks for * 10/100 operation. diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index 296a72542914..b252a4c7ff1d 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -104,10 +104,10 @@ static void e1000_clear_vfta_i350(struct e1000_hw *hw); static void e1000_i2c_start(struct e1000_hw *hw); static void e1000_i2c_stop(struct e1000_hw *hw); -static s32 e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data); +static void e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data); static s32 e1000_clock_out_i2c_byte(struct e1000_hw *hw, u8 data); static s32 e1000_get_i2c_ack(struct e1000_hw *hw); -static s32 e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data); +static void e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data); static s32 e1000_clock_out_i2c_bit(struct e1000_hw *hw, bool data); static void e1000_raise_i2c_clk(struct e1000_hw *hw, u32 *i2cctl); static void e1000_lower_i2c_clk(struct e1000_hw *hw, u32 *i2cctl); @@ -3238,9 +3238,7 @@ s32 e1000_read_i2c_byte_generic(struct e1000_hw *hw, u8 byte_offset, if (status != E1000_SUCCESS) goto fail; - status = e1000_clock_in_i2c_byte(hw, data); - if (status != E1000_SUCCESS) - goto fail; + e1000_clock_in_i2c_byte(hw, data); status = e1000_clock_out_i2c_bit(hw, nack); if (status != E1000_SUCCESS) @@ -3404,7 +3402,7 @@ static void e1000_i2c_stop(struct e1000_hw *hw) * * Clocks in one byte data via I2C data/clock **/ -static s32 e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data) +static void e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data) { s32 i; bool bit = 0; @@ -3416,8 +3414,6 @@ static s32 e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data) e1000_clock_in_i2c_bit(hw, &bit); *data |= bit << i; } - - return E1000_SUCCESS; } /** @@ -3506,7 +3502,7 @@ static s32 e1000_get_i2c_ack(struct e1000_hw *hw) * * Clocks in one bit via I2C data/clock **/ -static s32 e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data) +static void e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data) { u32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); @@ -3524,8 +3520,6 @@ static s32 e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data) /* Minimum low period of clock is 4.7 us */ usec_delay(E1000_I2C_T_LOW); - - return E1000_SUCCESS; } /** diff --git a/sys/dev/e1000/e1000_i210.c b/sys/dev/e1000/e1000_i210.c index c0055aa0df71..c6ca38f0f917 100644 --- a/sys/dev/e1000/e1000_i210.c +++ b/sys/dev/e1000/e1000_i210.c @@ -195,7 +195,7 @@ static s32 e1000_write_nvm_srwr(struct e1000_hw *hw, u16 offset, u16 words, } for (i = 0; i < words; i++) { - eewr = ((offset+i) << E1000_NVM_RW_ADDR_SHIFT) | + eewr = ((offset + i) << E1000_NVM_RW_ADDR_SHIFT) | (data[i] << E1000_NVM_RW_REG_DATA) | E1000_NVM_RW_REG_START; @@ -281,9 +281,9 @@ static s32 e1000_read_invm_i210(struct e1000_hw *hw, u16 offset, switch (offset) { case NVM_MAC_ADDR: ret_val = e1000_read_invm_word_i210(hw, (u8)offset, &data[0]); - ret_val |= e1000_read_invm_word_i210(hw, (u8)offset+1, + ret_val |= e1000_read_invm_word_i210(hw, (u8)offset + 1, &data[1]); - ret_val |= e1000_read_invm_word_i210(hw, (u8)offset+2, + ret_val |= e1000_read_invm_word_i210(hw, (u8)offset + 2, &data[2]); if (ret_val != E1000_SUCCESS) DEBUGOUT("MAC Addr not found in iNVM\n"); @@ -561,8 +561,6 @@ void e1000_init_function_pointers_i210(struct e1000_hw *hw) { e1000_init_function_pointers_82575(hw); hw->nvm.ops.init_params = e1000_init_nvm_params_i210; - - return; } /** diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 39e5ad518617..3a912dc3870e 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -841,7 +841,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) /** * __e1000_access_emi_reg_locked - Read/write EMI register * @hw: pointer to the HW structure - * @addr: EMI address to program + * @address: EMI address to program * @data: pointer to value to read/write from/to the EMI address * @read: boolean flag to indicate read or write * @@ -1619,8 +1619,6 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) if (hw->mac.type >= e1000_pch_lpt) { - u16 phy_reg; - hw->phy.ops.read_reg_locked(hw, I217_PLL_CLOCK_GATE_REG, &phy_reg); phy_reg &= ~I217_PLL_CLOCK_GATE_MASK; @@ -2474,7 +2472,7 @@ release: /** * e1000_configure_k1_ich8lan - Configure K1 power state * @hw: pointer to the HW structure - * @enable: K1 state to configure + * @k1_enable: K1 state to configure * * Configure the K1 power state based on the provided parameter. * Assumes semaphore already acquired. @@ -2622,6 +2620,7 @@ static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw) /** * e1000_hv_phy_workarounds_ich8lan - A series of Phy workarounds to be * done after every PHY reset. + * @hw: pointer to the HW structure **/ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) { @@ -2943,6 +2942,7 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable) /** * e1000_lv_phy_workarounds_ich8lan - A series of Phy workarounds to be * done after every PHY reset. + * @hw: pointer to the HW structure **/ static s32 e1000_lv_phy_workarounds_ich8lan(struct e1000_hw *hw) { @@ -3550,8 +3550,9 @@ static s32 e1000_read_nvm_spt(struct e1000_hw *hw, u16 offset, u16 words, for (i = 0; i < words; i += 2) { if (words - i == 1) { - if (dev_spec->shadow_ram[offset+i].modified) { - data[i] = dev_spec->shadow_ram[offset+i].value; + if (dev_spec->shadow_ram[offset + i].modified) { + data[i] = + dev_spec->shadow_ram[offset + i].value; } else { offset_to_read = act_offset + i - ((act_offset + i) % 2); @@ -3568,8 +3569,8 @@ static s32 e1000_read_nvm_spt(struct e1000_hw *hw, u16 offset, u16 words, } } else { offset_to_read = act_offset + i; - if (!(dev_spec->shadow_ram[offset+i].modified) || - !(dev_spec->shadow_ram[offset+i+1].modified)) { + if (!(dev_spec->shadow_ram[offset + i].modified) || + !(dev_spec->shadow_ram[offset + i + 1].modified)) { ret_val = e1000_read_flash_dword_ich8lan(hw, offset_to_read, @@ -3577,15 +3578,16 @@ static s32 e1000_read_nvm_spt(struct e1000_hw *hw, u16 offset, u16 words, if (ret_val) break; } - if (dev_spec->shadow_ram[offset+i].modified) - data[i] = dev_spec->shadow_ram[offset+i].value; + if (dev_spec->shadow_ram[offset + i].modified) + data[i] = + dev_spec->shadow_ram[offset + i].value; else - data[i] = (u16) (dword & 0xFFFF); - if (dev_spec->shadow_ram[offset+i].modified) - data[i+1] = - dev_spec->shadow_ram[offset+i+1].value; + data[i] = (u16)(dword & 0xFFFF); + if (dev_spec->shadow_ram[offset + i + 1].modified) + data[i + 1] = + dev_spec->shadow_ram[offset + i + 1].value; else - data[i+1] = (u16) (dword >> 16 & 0xFFFF); + data[i + 1] = (u16)(dword >> 16 & 0xFFFF); } } @@ -3639,8 +3641,8 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, ret_val = E1000_SUCCESS; for (i = 0; i < words; i++) { - if (dev_spec->shadow_ram[offset+i].modified) { - data[i] = dev_spec->shadow_ram[offset+i].value; + if (dev_spec->shadow_ram[offset + i].modified) { + data[i] = dev_spec->shadow_ram[offset + i].value; } else { ret_val = e1000_read_flash_word_ich8lan(hw, act_offset + i, @@ -4045,8 +4047,8 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, nvm->ops.acquire(hw); for (i = 0; i < words; i++) { - dev_spec->shadow_ram[offset+i].modified = TRUE; - dev_spec->shadow_ram[offset+i].value = data[i]; + dev_spec->shadow_ram[offset + i].modified = TRUE; + dev_spec->shadow_ram[offset + i].value = data[i]; } nvm->ops.release(hw); diff --git a/sys/dev/e1000/e1000_mac.c b/sys/dev/e1000/e1000_mac.c index bda2ad65e3dc..e0d078d924f9 100644 --- a/sys/dev/e1000/e1000_mac.c +++ b/sys/dev/e1000/e1000_mac.c @@ -2362,7 +2362,7 @@ e1000_release_swfw_sync(struct e1000_hw *hw, u16 mask) ; /* Empty */ swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); - swfw_sync &= ~mask; + swfw_sync &= (u32)~mask; E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); e1000_put_hw_semaphore(hw); diff --git a/sys/dev/e1000/e1000_nvm.c b/sys/dev/e1000/e1000_nvm.c index 46c00e1d64b3..86a1e772fb13 100644 --- a/sys/dev/e1000/e1000_nvm.c +++ b/sys/dev/e1000/e1000_nvm.c @@ -578,7 +578,7 @@ s32 e1000_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) } for (i = 0; i < words; i++) { - eerd = ((offset+i) << E1000_NVM_RW_ADDR_SHIFT) + + eerd = ((offset + i) << E1000_NVM_RW_ADDR_SHIFT) + E1000_NVM_RW_REG_START; E1000_WRITE_REG(hw, E1000_EERD, eerd); diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index d73e3a10ae13..d84b6120dd31 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -621,7 +621,7 @@ s32 e1000_write_sfp_data_byte(struct e1000_hw *hw, u16 offset, u8 data) * lane and update whole word */ data_local = i2ccmd & 0xFF00; - data_local |= data; + data_local |= (u32)data; i2ccmd = ((offset << E1000_I2CCMD_REG_ADDR_SHIFT) | E1000_I2CCMD_OPCODE_WRITE | data_local); @@ -3094,6 +3094,7 @@ s32 e1000_determine_phy_address(struct e1000_hw *hw) /** * e1000_get_phy_addr_for_bm_page - Retrieve PHY page address * @page: page to access + * @reg: register to access * * Returns the phy address for the page requested. **/ @@ -3531,6 +3532,7 @@ void e1000_power_down_phy_copper(struct e1000_hw *hw) * @offset: register offset to be read * @data: pointer to the read data * @locked: semaphore has already been acquired or not + * @page_set: BM_WUC_PAGE already set and access enabled * * Acquires semaphore, if necessary, then reads the PHY register at offset * and stores the retrieved information in data. Release any acquired @@ -3641,6 +3643,7 @@ s32 e1000_read_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 *data) * @offset: register offset to write to * @data: data to write at register offset * @locked: semaphore has already been acquired or not + * @page_set: BM_WUC_PAGE already set and access enabled * * Acquires semaphore, if necessary, then writes the data to PHY register * at the offset. Release any acquired semaphores before exiting. From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE0AC6B1076; Fri, 24 Sep 2021 01:35: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 4HFvjb5fJwz3JVh; Fri, 24 Sep 2021 01:35: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 83DDA59E0; Fri, 24 Sep 2021 01:35: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 18O1ZF3h029314; Fri, 24 Sep 2021 01:35:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1ZFBQ029313; Fri, 24 Sep 2021 01:35:15 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:15 GMT Message-Id: <202109240135.18O1ZFBQ029313@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: 7a3d9ce718f9 - stable/13 - e1000: add PCIm function state 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: 7a3d9ce718f9658b69cbecfbd5935f80a58f00fa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:16 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=7a3d9ce718f9658b69cbecfbd5935f80a58f00fa commit 7a3d9ce718f9658b69cbecfbd5935f80a58f00fa Author: Guinan Sun AuthorDate: 2020-07-06 08:12:07 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:26:35 +0000 e1000: add PCIm function state Added define to pcim function state. Signed-off-by: Vitaly Lifshits Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (7ee1a3b273c7f321b50e6ba17c3d9537b1b08347) MFC after: 1 week (cherry picked from commit a6f0cc373f0afc24c9c27bbba45a6a7a3ac268d1) --- sys/dev/e1000/e1000_defines.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/e1000/e1000_defines.h b/sys/dev/e1000/e1000_defines.h index 4bd575a81671..5b77bd43af1a 100644 --- a/sys/dev/e1000/e1000_defines.h +++ b/sys/dev/e1000/e1000_defines.h @@ -346,6 +346,7 @@ #define E1000_STATUS_PCIX_SPEED_66 0x00000000 /* PCI-X bus spd 50-66MHz */ #define E1000_STATUS_PCIX_SPEED_100 0x00004000 /* PCI-X bus spd 66-100MHz */ #define E1000_STATUS_PCIX_SPEED_133 0x00008000 /* PCI-X bus spd 100-133MHz*/ +#define E1000_STATUS_PCIM_STATE 0x40000000 /* PCIm function state */ #define SPEED_10 10 #define SPEED_100 100 From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CAB066B107A; Fri, 24 Sep 2021 01:35:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFvjf23zrz3JXp; Fri, 24 Sep 2021 01:35: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 C9DC25ACA; Fri, 24 Sep 2021 01:35:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18O1ZHLa029364; Fri, 24 Sep 2021 01:35:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1ZHKd029363; Fri, 24 Sep 2021 01:35:17 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:17 GMT Message-Id: <202109240135.18O1ZHKd029363@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: 5bff1c805840 - stable/13 - e1000: increase timeout for ME ULP exit 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: 5bff1c8058404bb3c806aa812560b518e51ef49c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:19 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=5bff1c8058404bb3c806aa812560b518e51ef49c commit 5bff1c8058404bb3c806aa812560b518e51ef49c Author: Guinan Sun AuthorDate: 2020-07-06 08:12:09 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:29:39 +0000 e1000: increase timeout for ME ULP exit Due timing issues in WHL and since recovery by host is not always supported, increased timeout for Manageability Engine(ME) to finish Ultra Low Power(ULP) exit flow for Nahum before timer expiration. Signed-off-by: Nir Efrati Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (cf1f3ca45d33e793ca581200b4000c39a798113e) MFC after: 1 week (cherry picked from commit e8e3171d992f3255cc8e5a0f59912d07679cc94c) --- sys/dev/e1000/e1000_ich8lan.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 1d15881f047d..8ca0fb392805 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -1413,6 +1413,7 @@ out: s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force) { s32 ret_val = E1000_SUCCESS; + u8 ulp_exit_timeout = 30; u32 mac_reg; u16 phy_reg; int i = 0; @@ -1434,10 +1435,12 @@ s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force) E1000_WRITE_REG(hw, E1000_H2ME, mac_reg); } - /* Poll up to 300msec for ME to clear ULP_CFG_DONE. */ + if (hw->mac.type == e1000_pch_cnp) + ulp_exit_timeout = 100; + while (E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_ULP_CFG_DONE) { - if (i++ == 30) { + if (i++ == ulp_exit_timeout) { ret_val = -E1000_ERR_PHY; goto out; } From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95F926B11E7; Fri, 24 Sep 2021 01:35: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 4HFvjW2gymz3JZd; Fri, 24 Sep 2021 01:35: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 F364F59DF; Fri, 24 Sep 2021 01:35: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 18O1ZANr029214; Fri, 24 Sep 2021 01:35:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1ZAGf029213; Fri, 24 Sep 2021 01:35:10 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:10 GMT Message-Id: <202109240135.18O1ZAGf029213@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: 412d4675bbad - stable/13 - e1000: modify HW level time sync mechanisms 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: 412d4675bbadb36135373272a298fd67d9c75df2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:11 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=412d4675bbadb36135373272a298fd67d9c75df2 commit 412d4675bbadb36135373272a298fd67d9c75df2 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:04 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:21:03 +0000 e1000: modify HW level time sync mechanisms Add additional configuration space access to allow HW level time sync mechanism. Signed-off-by: Evgeny Efimov Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (d53391f1fe2e0eba8818517fdf285f893d95dcc8) MFC after: 1 week (cherry picked from commit d50f362b505e9026fbd33d00dc43e09cac26a209) --- sys/dev/e1000/e1000_ich8lan.c | 18 ++++++++++++++++++ sys/dev/e1000/e1000_ich8lan.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 3a912dc3870e..1d15881f047d 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -4963,6 +4963,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) u16 kum_cfg; u32 ctrl, reg; s32 ret_val; + u16 pci_cfg; DEBUGFUNC("e1000_reset_hw_ich8lan"); @@ -5023,11 +5024,28 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) e1000_gate_hw_phy_config_ich8lan(hw, TRUE); } ret_val = e1000_acquire_swflag_ich8lan(hw); + + /* Read from EXTCNF_CTRL in e1000_acquire_swflag_ich8lan function + * may occur during global reset and cause system hang. + * Configuration space access creates the needed delay. + * Write to E1000_STRAP RO register E1000_PCI_VENDOR_ID_REGISTER value + * insures configuration space read is done before global reset. + */ + e1000_read_pci_cfg(hw, E1000_PCI_VENDOR_ID_REGISTER, &pci_cfg); + E1000_WRITE_REG(hw, E1000_STRAP, pci_cfg); DEBUGOUT("Issuing a global reset to ich8lan\n"); E1000_WRITE_REG(hw, E1000_CTRL, (ctrl | E1000_CTRL_RST)); /* cannot issue a flush here because it hangs the hardware */ msec_delay(20); + /* Configuration space access improve HW level time sync mechanism. + * Write to E1000_STRAP RO register E1000_PCI_VENDOR_ID_REGISTER + * value to insure configuration space read is done + * before any access to mac register. + */ + e1000_read_pci_cfg(hw, E1000_PCI_VENDOR_ID_REGISTER, &pci_cfg); + E1000_WRITE_REG(hw, E1000_STRAP, pci_cfg); + /* Set Phy Config Counter to 50msec */ if (hw->mac.type == e1000_pch2lan) { reg = E1000_READ_REG(hw, E1000_FEXTNVM3); diff --git a/sys/dev/e1000/e1000_ich8lan.h b/sys/dev/e1000/e1000_ich8lan.h index a467e647636f..12f912ebc6e0 100644 --- a/sys/dev/e1000/e1000_ich8lan.h +++ b/sys/dev/e1000/e1000_ich8lan.h @@ -327,6 +327,8 @@ #define E1000_SVCR_OFF_TIMER_SHIFT 16 #define E1000_SVT_OFF_HWM_MASK 0x0000001F +#define E1000_PCI_VENDOR_ID_REGISTER 0x00 + void e1000_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw, bool state); void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw); From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E23F6B13FA; Fri, 24 Sep 2021 01:35:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFvjr1z8qz3Jbc; Fri, 24 Sep 2021 01: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 1AA0859E4; Fri, 24 Sep 2021 01: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 18O1ZSPt029596; Fri, 24 Sep 2021 01: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 18O1ZS0M029595; Fri, 24 Sep 2021 01:35:28 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:28 GMT Message-Id: <202109240135.18O1ZS0M029595@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: 3f45d625bd22 - stable/13 - e1000: Catch up commit with DPDK 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: 3f45d625bd22964c5e7d6605d08f57d6de5a4942 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:29 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=3f45d625bd22964c5e7d6605d08f57d6de5a4942 commit 3f45d625bd22964c5e7d6605d08f57d6de5a4942 Author: Kevin Bowling AuthorDate: 2021-09-17 02:30:49 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:33:32 +0000 e1000: Catch up commit with DPDK Various syncs with the e1000 shared code from DPDK: "cid-gigabit.2020.06.05.tar.gz released by ND" Approved by: imp Obtained from: DPDK MFC after: 1 week (cherry picked from commit 984d1616be883bc2c351aff9aa69b1abd7d1214c) --- sys/dev/e1000/e1000_82571.c | 2 +- sys/dev/e1000/e1000_82575.c | 2 +- sys/dev/e1000/e1000_api.c | 15 +++++ sys/dev/e1000/e1000_api.h | 1 + sys/dev/e1000/e1000_defines.h | 33 ++++++++++ sys/dev/e1000/e1000_hw.h | 2 +- sys/dev/e1000/e1000_i210.c | 100 ++++++++++++++++++++++++++++ sys/dev/e1000/e1000_i210.h | 2 + sys/dev/e1000/e1000_nvm.c | 147 ++++++++++++++++++++++++++++++++++++++++++ sys/dev/e1000/e1000_nvm.h | 19 ++++++ sys/dev/e1000/e1000_regs.h | 3 +- 11 files changed, 322 insertions(+), 4 deletions(-) diff --git a/sys/dev/e1000/e1000_82571.c b/sys/dev/e1000/e1000_82571.c index 6fefcc774cbb..8db1fcb921a9 100644 --- a/sys/dev/e1000/e1000_82571.c +++ b/sys/dev/e1000/e1000_82571.c @@ -515,7 +515,7 @@ e1000_get_hw_semaphore_82574(struct e1000_hw *hw) u32 extcnf_ctrl; s32 i = 0; /* XXX assert that mutex is held */ - DEBUGFUNC("e1000_get_hw_semaphore_82573"); + DEBUGFUNC("e1000_get_hw_semaphore_82574"); ASSERT_CTX_LOCK_HELD(hw); extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index 172e99b02d5c..29805270f8dc 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -1360,7 +1360,7 @@ static s32 e1000_reset_hw_82575(struct e1000_hw *hw) * * This inits the hardware readying it for operation. **/ -STATIC s32 e1000_init_hw_82575(struct e1000_hw *hw) +static s32 e1000_init_hw_82575(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; s32 ret_val; diff --git a/sys/dev/e1000/e1000_api.c b/sys/dev/e1000/e1000_api.c index 6e0f51ab7ffa..b28ab77f3794 100644 --- a/sys/dev/e1000/e1000_api.c +++ b/sys/dev/e1000/e1000_api.c @@ -1269,6 +1269,21 @@ s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size) return e1000_read_pba_length_generic(hw, pba_num_size); } +/** + * e1000_read_pba_num - Read device part number + * @hw: pointer to the HW structure + * @pba_num: pointer to device part number + * + * Reads the product board assembly (PBA) number from the EEPROM and stores + * the value in pba_num. + * Currently no func pointer exists and all implementations are handled in the + * generic version of this function. + **/ +s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *pba_num) +{ + return e1000_read_pba_num_generic(hw, pba_num); +} + /** * e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum * @hw: pointer to the HW structure diff --git a/sys/dev/e1000/e1000_api.h b/sys/dev/e1000/e1000_api.h index db4caac37e97..c96030b567db 100644 --- a/sys/dev/e1000/e1000_api.h +++ b/sys/dev/e1000/e1000_api.h @@ -97,6 +97,7 @@ s32 e1000_phy_commit(struct e1000_hw *hw); void e1000_power_up_phy(struct e1000_hw *hw); void e1000_power_down_phy(struct e1000_hw *hw); s32 e1000_read_mac_addr(struct e1000_hw *hw); +s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *part_num); s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size); s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size); void e1000_reload_nvm(struct e1000_hw *hw); diff --git a/sys/dev/e1000/e1000_defines.h b/sys/dev/e1000/e1000_defines.h index e5435eb56dcd..44281a0fadf6 100644 --- a/sys/dev/e1000/e1000_defines.h +++ b/sys/dev/e1000/e1000_defines.h @@ -1083,11 +1083,44 @@ /* NVM Word Offsets */ #define NVM_COMPAT 0x0003 #define NVM_ID_LED_SETTINGS 0x0004 +#define NVM_VERSION 0x0005 #define NVM_SERDES_AMPLITUDE 0x0006 /* SERDES output amplitude */ #define NVM_PHY_CLASS_WORD 0x0007 #define E1000_I210_NVM_FW_MODULE_PTR 0x0010 #define E1000_I350_NVM_FW_MODULE_PTR 0x0051 #define NVM_FUTURE_INIT_WORD1 0x0019 +#define NVM_ETRACK_WORD 0x0042 +#define NVM_ETRACK_HIWORD 0x0043 +#define NVM_COMB_VER_OFF 0x0083 +#define NVM_COMB_VER_PTR 0x003d + +/* NVM version defines */ +#define NVM_MAJOR_MASK 0xF000 +#define NVM_MINOR_MASK 0x0FF0 +#define NVM_IMAGE_ID_MASK 0x000F +#define NVM_COMB_VER_MASK 0x00FF +#define NVM_MAJOR_SHIFT 12 +#define NVM_MINOR_SHIFT 4 +#define NVM_COMB_VER_SHFT 8 +#define NVM_VER_INVALID 0xFFFF +#define NVM_ETRACK_SHIFT 16 +#define NVM_ETRACK_VALID 0x8000 +#define NVM_NEW_DEC_MASK 0x0F00 +#define NVM_HEX_CONV 16 +#define NVM_HEX_TENS 10 + +/* FW version defines */ +/* Offset of "Loader patch ptr" in Firmware Header */ +#define E1000_I350_NVM_FW_LOADER_PATCH_PTR_OFFSET 0x01 +/* Patch generation hour & minutes */ +#define E1000_I350_NVM_FW_VER_WORD1_OFFSET 0x04 +/* Patch generation month & day */ +#define E1000_I350_NVM_FW_VER_WORD2_OFFSET 0x05 +/* Patch generation year */ +#define E1000_I350_NVM_FW_VER_WORD3_OFFSET 0x06 +/* Patch major & minor numbers */ +#define E1000_I350_NVM_FW_VER_WORD4_OFFSET 0x07 + #define NVM_MAC_ADDR 0x0000 #define NVM_SUB_DEV_ID 0x000B #define NVM_SUB_VEN_ID 0x000C diff --git a/sys/dev/e1000/e1000_hw.h b/sys/dev/e1000/e1000_hw.h index 59e51e5c322f..90bc652861b5 100644 --- a/sys/dev/e1000/e1000_hw.h +++ b/sys/dev/e1000/e1000_hw.h @@ -998,7 +998,7 @@ struct e1000_dev_spec_ich8lan { enum e1000_ulp_state ulp_state; bool ulp_capability_disabled; bool during_suspend_flow; - bool during_dpg_exit; + bool smbus_disable; }; struct e1000_dev_spec_82575 { diff --git a/sys/dev/e1000/e1000_i210.c b/sys/dev/e1000/e1000_i210.c index d3692db11245..0d810fecf3bd 100644 --- a/sys/dev/e1000/e1000_i210.c +++ b/sys/dev/e1000/e1000_i210.c @@ -345,6 +345,105 @@ static s32 e1000_read_invm_i210(struct e1000_hw *hw, u16 offset, return ret_val; } +/** + * e1000_read_invm_version - Reads iNVM version and image type + * @hw: pointer to the HW structure + * @invm_ver: version structure for the version read + * + * Reads iNVM version and image type. + **/ +s32 e1000_read_invm_version(struct e1000_hw *hw, + struct e1000_fw_version *invm_ver) +{ + u32 *record = NULL; + u32 *next_record = NULL; + u32 i = 0; + u32 invm_dword = 0; + u32 invm_blocks = E1000_INVM_SIZE - (E1000_INVM_ULT_BYTES_SIZE / + E1000_INVM_RECORD_SIZE_IN_BYTES); + u32 buffer[E1000_INVM_SIZE]; + s32 status = -E1000_ERR_INVM_VALUE_NOT_FOUND; + u16 version = 0; + + DEBUGFUNC("e1000_read_invm_version"); + + /* Read iNVM memory */ + for (i = 0; i < E1000_INVM_SIZE; i++) { + invm_dword = E1000_READ_REG(hw, E1000_INVM_DATA_REG(i)); + buffer[i] = invm_dword; + } + + /* Read version number */ + for (i = 1; i < invm_blocks; i++) { + record = &buffer[invm_blocks - i]; + next_record = &buffer[invm_blocks - i + 1]; + + /* Check if we have first version location used */ + if ((i == 1) && ((*record & E1000_INVM_VER_FIELD_ONE) == 0)) { + version = 0; + status = E1000_SUCCESS; + break; + } + /* Check if we have second version location used */ + else if ((i == 1) && + ((*record & E1000_INVM_VER_FIELD_TWO) == 0)) { + version = (*record & E1000_INVM_VER_FIELD_ONE) >> 3; + status = E1000_SUCCESS; + break; + } + /* + * Check if we have odd version location + * used and it is the last one used + */ + else if ((((*record & E1000_INVM_VER_FIELD_ONE) == 0) && + ((*record & 0x3) == 0)) || (((*record & 0x3) != 0) && + (i != 1))) { + version = (*next_record & E1000_INVM_VER_FIELD_TWO) + >> 13; + status = E1000_SUCCESS; + break; + } + /* + * Check if we have even version location + * used and it is the last one used + */ + else if (((*record & E1000_INVM_VER_FIELD_TWO) == 0) && + ((*record & 0x3) == 0)) { + version = (*record & E1000_INVM_VER_FIELD_ONE) >> 3; + status = E1000_SUCCESS; + break; + } + } + + if (status == E1000_SUCCESS) { + invm_ver->invm_major = (version & E1000_INVM_MAJOR_MASK) + >> E1000_INVM_MAJOR_SHIFT; + invm_ver->invm_minor = version & E1000_INVM_MINOR_MASK; + } + /* Read Image Type */ + for (i = 1; i < invm_blocks; i++) { + record = &buffer[invm_blocks - i]; + next_record = &buffer[invm_blocks - i + 1]; + + /* Check if we have image type in first location used */ + if ((i == 1) && ((*record & E1000_INVM_IMGTYPE_FIELD) == 0)) { + invm_ver->invm_img_type = 0; + status = E1000_SUCCESS; + break; + } + /* Check if we have image type in first location used */ + else if ((((*record & 0x3) == 0) && + ((*record & E1000_INVM_IMGTYPE_FIELD) == 0)) || + ((((*record & 0x3) != 0) && (i != 1)))) { + invm_ver->invm_img_type = + (*next_record & E1000_INVM_IMGTYPE_FIELD) >> 23; + status = E1000_SUCCESS; + break; + } + } + return status; +} + /** * e1000_validate_nvm_checksum_i210 - Validate EEPROM checksum * @hw: pointer to the HW structure @@ -628,6 +727,7 @@ static s32 e1000_pll_workaround_i210(struct e1000_hw *hw) if (ret_val != E1000_SUCCESS) nvm_word = E1000_INVM_DEFAULT_AL; tmp_nvm = nvm_word | E1000_INVM_PLL_WO_VAL; + phy_word = E1000_PHY_PLL_UNCONF; for (i = 0; i < E1000_MAX_PLL_TRIES; i++) { /* check current state directly from internal PHY */ e1000_write_phy_reg_mdic(hw, GS40G_PAGE_SELECT, 0xFC); diff --git a/sys/dev/e1000/e1000_i210.h b/sys/dev/e1000/e1000_i210.h index 9ad9e28c363b..77414b851a76 100644 --- a/sys/dev/e1000/e1000_i210.h +++ b/sys/dev/e1000/e1000_i210.h @@ -44,6 +44,8 @@ s32 e1000_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); s32 e1000_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); +s32 e1000_read_invm_version(struct e1000_hw *hw, + struct e1000_fw_version *invm_ver); s32 e1000_init_hw_i210(struct e1000_hw *hw); #define E1000_STM_OPCODE 0xDB00 diff --git a/sys/dev/e1000/e1000_nvm.c b/sys/dev/e1000/e1000_nvm.c index 86a1e772fb13..31bbfcc6981d 100644 --- a/sys/dev/e1000/e1000_nvm.c +++ b/sys/dev/e1000/e1000_nvm.c @@ -939,6 +939,41 @@ s32 e1000_read_pba_length_generic(struct e1000_hw *hw, u32 *pba_num_size) return E1000_SUCCESS; } +/** + * e1000_read_pba_num_generic - Read device part number + * @hw: pointer to the HW structure + * @pba_num: pointer to device part number + * + * Reads the product board assembly (PBA) number from the EEPROM and stores + * the value in pba_num. + **/ +s32 e1000_read_pba_num_generic(struct e1000_hw *hw, u32 *pba_num) +{ + s32 ret_val; + u16 nvm_data; + + DEBUGFUNC("e1000_read_pba_num_generic"); + + ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_0, 1, &nvm_data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + return ret_val; + } else if (nvm_data == NVM_PBA_PTR_GUARD) { + DEBUGOUT("NVM Not Supported\n"); + return -E1000_NOT_IMPLEMENTED; + } + *pba_num = (u32)(nvm_data << 16); + + ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_1, 1, &nvm_data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + return ret_val; + } + *pba_num |= nvm_data; + + return E1000_SUCCESS; +} + /** * e1000_read_pba_raw @@ -1241,4 +1276,116 @@ static void e1000_reload_nvm_generic(struct e1000_hw *hw) E1000_WRITE_FLUSH(hw); } +/** + * e1000_get_fw_version - Get firmware version information + * @hw: pointer to the HW structure + * @fw_vers: pointer to output version structure + * + * unsupported/not present features return 0 in version structure + **/ +void e1000_get_fw_version(struct e1000_hw *hw, struct e1000_fw_version *fw_vers) +{ + u16 eeprom_verh, eeprom_verl, etrack_test, fw_version; + u8 q, hval, rem, result; + u16 comb_verh, comb_verl, comb_offset; + + memset(fw_vers, 0, sizeof(struct e1000_fw_version)); + + /* basic eeprom version numbers, bits used vary by part and by tool + * used to create the nvm images */ + /* Check which data format we have */ + switch (hw->mac.type) { + case e1000_i211: + e1000_read_invm_version(hw, fw_vers); + return; + case e1000_82575: + case e1000_82576: + case e1000_82580: + case e1000_i354: + hw->nvm.ops.read(hw, NVM_ETRACK_HIWORD, 1, &etrack_test); + /* Use this format, unless EETRACK ID exists, + * then use alternate format + */ + if ((etrack_test & NVM_MAJOR_MASK) != NVM_ETRACK_VALID) { + hw->nvm.ops.read(hw, NVM_VERSION, 1, &fw_version); + fw_vers->eep_major = (fw_version & NVM_MAJOR_MASK) + >> NVM_MAJOR_SHIFT; + fw_vers->eep_minor = (fw_version & NVM_MINOR_MASK) + >> NVM_MINOR_SHIFT; + fw_vers->eep_build = (fw_version & NVM_IMAGE_ID_MASK); + goto etrack_id; + } + break; + case e1000_i210: + if (!(e1000_get_flash_presence_i210(hw))) { + e1000_read_invm_version(hw, fw_vers); + return; + } + /* fall through */ + case e1000_i350: + hw->nvm.ops.read(hw, NVM_ETRACK_HIWORD, 1, &etrack_test); + /* find combo image version */ + hw->nvm.ops.read(hw, NVM_COMB_VER_PTR, 1, &comb_offset); + if ((comb_offset != 0x0) && + (comb_offset != NVM_VER_INVALID)) { + + hw->nvm.ops.read(hw, (NVM_COMB_VER_OFF + comb_offset + + 1), 1, &comb_verh); + hw->nvm.ops.read(hw, (NVM_COMB_VER_OFF + comb_offset), + 1, &comb_verl); + + /* get Option Rom version if it exists and is valid */ + if ((comb_verh && comb_verl) && + ((comb_verh != NVM_VER_INVALID) && + (comb_verl != NVM_VER_INVALID))) { + + fw_vers->or_valid = true; + fw_vers->or_major = + comb_verl >> NVM_COMB_VER_SHFT; + fw_vers->or_build = + (comb_verl << NVM_COMB_VER_SHFT) + | (comb_verh >> NVM_COMB_VER_SHFT); + fw_vers->or_patch = + comb_verh & NVM_COMB_VER_MASK; + } + } + break; + default: + hw->nvm.ops.read(hw, NVM_ETRACK_HIWORD, 1, &etrack_test); + return; + } + hw->nvm.ops.read(hw, NVM_VERSION, 1, &fw_version); + fw_vers->eep_major = (fw_version & NVM_MAJOR_MASK) + >> NVM_MAJOR_SHIFT; + + /* check for old style version format in newer images*/ + if ((fw_version & NVM_NEW_DEC_MASK) == 0x0) { + eeprom_verl = (fw_version & NVM_COMB_VER_MASK); + } else { + eeprom_verl = (fw_version & NVM_MINOR_MASK) + >> NVM_MINOR_SHIFT; + } + /* Convert minor value to hex before assigning to output struct + * Val to be converted will not be higher than 99, per tool output + */ + q = eeprom_verl / NVM_HEX_CONV; + hval = q * NVM_HEX_TENS; + rem = eeprom_verl % NVM_HEX_CONV; + result = hval + rem; + fw_vers->eep_minor = result; + +etrack_id: + if ((etrack_test & NVM_MAJOR_MASK) == NVM_ETRACK_VALID) { + hw->nvm.ops.read(hw, NVM_ETRACK_WORD, 1, &eeprom_verl); + hw->nvm.ops.read(hw, (NVM_ETRACK_WORD + 1), 1, &eeprom_verh); + fw_vers->etrack_id = (eeprom_verh << NVM_ETRACK_SHIFT) + | eeprom_verl; + } else if ((etrack_test & NVM_ETRACK_VALID) == 0) { + hw->nvm.ops.read(hw, NVM_ETRACK_WORD, 1, &eeprom_verh); + hw->nvm.ops.read(hw, (NVM_ETRACK_WORD + 1), 1, &eeprom_verl); + fw_vers->etrack_id = (eeprom_verh << NVM_ETRACK_SHIFT) | + eeprom_verl; + } +} + diff --git a/sys/dev/e1000/e1000_nvm.h b/sys/dev/e1000/e1000_nvm.h index fc7ceab17e32..86fd5d1e892f 100644 --- a/sys/dev/e1000/e1000_nvm.h +++ b/sys/dev/e1000/e1000_nvm.h @@ -41,6 +41,22 @@ struct e1000_pba { u16 *pba_block; }; +struct e1000_fw_version { + u32 etrack_id; + u16 eep_major; + u16 eep_minor; + u16 eep_build; + + u8 invm_major; + u8 invm_minor; + u8 invm_img_type; + + bool or_valid; + u16 or_major; + u16 or_build; + u16 or_patch; +}; + void e1000_init_nvm_ops_generic(struct e1000_hw *hw); s32 e1000_null_read_nvm(struct e1000_hw *hw, u16 a, u16 b, u16 *c); @@ -51,6 +67,7 @@ s32 e1000_acquire_nvm_generic(struct e1000_hw *hw); s32 e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg); s32 e1000_read_mac_addr_generic(struct e1000_hw *hw); +s32 e1000_read_pba_num_generic(struct e1000_hw *hw, u32 *pba_num); s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size); s32 e1000_read_pba_length_generic(struct e1000_hw *hw, u32 *pba_num_size); @@ -75,6 +92,8 @@ s32 e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, s32 e1000_update_nvm_checksum_generic(struct e1000_hw *hw); void e1000_stop_nvm(struct e1000_hw *hw); void e1000_release_nvm_generic(struct e1000_hw *hw); +void e1000_get_fw_version(struct e1000_hw *hw, + struct e1000_fw_version *fw_vers); #define E1000_STM_OPCODE 0xDB00 diff --git a/sys/dev/e1000/e1000_regs.h b/sys/dev/e1000/e1000_regs.h index c09856e55275..b3fb854f8adc 100644 --- a/sys/dev/e1000/e1000_regs.h +++ b/sys/dev/e1000/e1000_regs.h @@ -64,6 +64,7 @@ #define E1000_FEXTNVM 0x00028 /* Future Extended NVM - RW */ #define E1000_FEXTNVM3 0x0003C /* Future Extended NVM 3 - RW */ #define E1000_FEXTNVM4 0x00024 /* Future Extended NVM 4 - RW */ +#define E1000_FEXTNVM5 0x00014 /* Future Extended NVM 5 - RW */ #define E1000_FEXTNVM6 0x00010 /* Future Extended NVM 6 - RW */ #define E1000_FEXTNVM7 0x000E4 /* Future Extended NVM 7 - RW */ #define E1000_FEXTNVM8 0x5BB0 /* Future Extended NVM 8 - RW */ @@ -634,7 +635,7 @@ /* ETQF register bit definitions */ #define E1000_ETQF_FILTER_ENABLE (1 << 26) #define E1000_ETQF_IMM_INT (1 << 29) -#define E1000_ETQF_QUEUE_ENABLE (1 << 31) +#define E1000_ETQF_QUEUE_ENABLE (1U << 31) #define E1000_ETQF_QUEUE_SHIFT 16 #define E1000_ETQF_QUEUE_MASK 0x00070000 #define E1000_ETQF_ETYPE_MASK 0x0000FFFF From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E28D26B170B; Fri, 24 Sep 2021 01:35: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 4HFvjb4zKzz3JXT; Fri, 24 Sep 2021 01:35: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 61D395AC9; Fri, 24 Sep 2021 01:35: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 18O1ZE2b029286; Fri, 24 Sep 2021 01:35:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1ZEK8029285; Fri, 24 Sep 2021 01:35:14 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:14 GMT Message-Id: <202109240135.18O1ZEK8029285@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: 3e1476024181 - stable/13 - e1000: expose MAC functions 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: 3e1476024181e2e9fbea8a8d428b9188a8a2d581 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:16 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=3e1476024181e2e9fbea8a8d428b9188a8a2d581 commit 3e1476024181e2e9fbea8a8d428b9188a8a2d581 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:06 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:26:21 +0000 e1000: expose MAC functions Now the functions are being accessed outside of the file, we need to properly expose them for silicon families to use. Signed-off-by: Jeff Kirsher Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (df01c0ee277d51f81d7d72501dba97550d3b6c4a) MFC after: 1 week (cherry picked from commit d1c37752e2afb51dfb2e08afe714a799788b6ede) --- sys/dev/e1000/e1000_mac.c | 3 +-- sys/dev/e1000/e1000_mac.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/e1000/e1000_mac.c b/sys/dev/e1000/e1000_mac.c index e0d078d924f9..a13572d8dc18 100644 --- a/sys/dev/e1000/e1000_mac.c +++ b/sys/dev/e1000/e1000_mac.c @@ -38,7 +38,6 @@ static s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw); static void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw); static void e1000_config_collision_dist_generic(struct e1000_hw *hw); -static int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index); /** * e1000_init_mac_ops_generic - Initialize MAC function pointers @@ -484,7 +483,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw) * Sets the receive address array register at index to the address passed * in by addr. **/ -static int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index) +int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index) { u32 rar_low, rar_high; diff --git a/sys/dev/e1000/e1000_mac.h b/sys/dev/e1000/e1000_mac.h index 1f472d42421e..370f7f9d8a1a 100644 --- a/sys/dev/e1000/e1000_mac.h +++ b/sys/dev/e1000/e1000_mac.h @@ -70,6 +70,7 @@ s32 e1000_led_on_generic(struct e1000_hw *hw); s32 e1000_led_off_generic(struct e1000_hw *hw); void e1000_update_mc_addr_list_generic(struct e1000_hw *hw, u8 *mc_addr_list, u32 mc_addr_count); +int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index); s32 e1000_set_default_fc_generic(struct e1000_hw *hw); s32 e1000_set_fc_watermarks_generic(struct e1000_hw *hw); s32 e1000_setup_fiber_serdes_link_generic(struct e1000_hw *hw); From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 120926B1077; Fri, 24 Sep 2021 01:35: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 4HFvjc5wjWz3JRT; Fri, 24 Sep 2021 01:35: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 9B9A45A55; Fri, 24 Sep 2021 01:35: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 18O1ZGAP029340; Fri, 24 Sep 2021 01:35:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1ZGtN029339; Fri, 24 Sep 2021 01:35:16 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:16 GMT Message-Id: <202109240135.18O1ZGtN029339@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: 41ff2b03ae8a - stable/13 - e1000: add missing register defines 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: 41ff2b03ae8afaab81500336217a9949eb7ef4ad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:17 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=41ff2b03ae8afaab81500336217a9949eb7ef4ad commit 41ff2b03ae8afaab81500336217a9949eb7ef4ad Author: Guinan Sun AuthorDate: 2020-07-06 08:12:08 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:29:25 +0000 e1000: add missing register defines Added defines for the EEC, SHADOWINF and FLFWUPDATE registers needed for the nvmupd_validate_offset function to correctly validate the NVM update offset. Signed-off-by: Jeff Kirsher Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (2c7fe65ab9a31e6ebf438dad7ccc59bcde83a89f) MFC after: 1 week (cherry picked from commit 09888d4bc1a2c45d121046f79be5c01e4889a67e) --- sys/dev/e1000/e1000_regs.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/e1000/e1000_regs.h b/sys/dev/e1000/e1000_regs.h index 2b7696ddea62..fe9834405359 100644 --- a/sys/dev/e1000/e1000_regs.h +++ b/sys/dev/e1000/e1000_regs.h @@ -169,6 +169,8 @@ #define E1000_EMIDATA 0x11 /* Extended Memory Indirect Data */ /* Shadow Ram Write Register - RW */ #define E1000_SRWR 0x12018 +#define E1000_EEC_REG 0x12010 + #define E1000_I210_FLMNGCTL 0x12038 #define E1000_I210_FLMNGDATA 0x1203C #define E1000_I210_FLMNGCNT 0x12040 @@ -179,6 +181,9 @@ #define E1000_I210_FLA 0x1201C +#define E1000_SHADOWINF 0x12068 +#define E1000_FLFWUPDATE 0x12108 + #define E1000_INVM_DATA_REG(_n) (0x12120 + 4*(_n)) #define E1000_INVM_SIZE 64 /* Number of INVM Data Registers */ From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA7376B10D5; Fri, 24 Sep 2021 01:35: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 4HFvjY3B7cz3JZx; Fri, 24 Sep 2021 01:35: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 414865AC8; Fri, 24 Sep 2021 01:35: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 18O1ZD8V029262; Fri, 24 Sep 2021 01:35:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1ZDEu029261; Fri, 24 Sep 2021 01:35:13 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:13 GMT Message-Id: <202109240135.18O1ZDEu029261@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: b06245701c17 - stable/13 - e1000: update for i210 slow system clock 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: b06245701c17eac47a8cd8675f70e82f889ec6e8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:14 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=b06245701c17eac47a8cd8675f70e82f889ec6e8 commit b06245701c17eac47a8cd8675f70e82f889ec6e8 Author: Guinan Sun AuthorDate: 2020-07-06 08:11:56 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:23:06 +0000 e1000: update for i210 slow system clock This code is required for the update for system clock. Signed-off-by: Todd Fujinaka Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (3f0188c8f29847038bc9f306b2570ace57e3811c) MFC after: 1 week (cherry picked from commit 1883a6ff3b2ebaf108c45717c8eb94e0a76bb0b9) --- sys/dev/e1000/e1000_i210.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/dev/e1000/e1000_i210.c b/sys/dev/e1000/e1000_i210.c index 0bdad37e56d3..cd85a8c3172a 100644 --- a/sys/dev/e1000/e1000_i210.c +++ b/sys/dev/e1000/e1000_i210.c @@ -612,6 +612,8 @@ static s32 e1000_pll_workaround_i210(struct e1000_hw *hw) u16 nvm_word, phy_word, pci_word, tmp_nvm; int i; + /* Get PHY semaphore */ + hw->phy.ops.acquire(hw); /* Get and set needed register values */ wuc = E1000_READ_REG(hw, E1000_WUC); mdicnfg = E1000_READ_REG(hw, E1000_MDICNFG); @@ -626,8 +628,11 @@ static s32 e1000_pll_workaround_i210(struct e1000_hw *hw) tmp_nvm = nvm_word | E1000_INVM_PLL_WO_VAL; for (i = 0; i < E1000_MAX_PLL_TRIES; i++) { /* check current state directly from internal PHY */ - e1000_read_phy_reg_gs40g(hw, (E1000_PHY_PLL_FREQ_PAGE | - E1000_PHY_PLL_FREQ_REG), &phy_word); + e1000_write_phy_reg_mdic(hw, GS40G_PAGE_SELECT, 0xFC); + usec_delay(20); + e1000_read_phy_reg_mdic(hw, E1000_PHY_PLL_FREQ_REG, &phy_word); + usec_delay(20); + e1000_write_phy_reg_mdic(hw, GS40G_PAGE_SELECT, 0); if ((phy_word & E1000_PHY_PLL_UNCONF) != E1000_PHY_PLL_UNCONF) { ret_val = E1000_SUCCESS; @@ -661,6 +666,8 @@ static s32 e1000_pll_workaround_i210(struct e1000_hw *hw) } /* restore MDICNFG setting */ E1000_WRITE_REG(hw, E1000_MDICNFG, mdicnfg); + /* Release PHY semaphore */ + hw->phy.ops.release(hw); return ret_val; } From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52BD06B107E; Fri, 24 Sep 2021 01:35: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 4HFvjj5FtDz3JbK; Fri, 24 Sep 2021 01:35: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 2EFFD5BD4; Fri, 24 Sep 2021 01:35: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 18O1ZLJq029440; Fri, 24 Sep 2021 01:35:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1ZLCn029439; Fri, 24 Sep 2021 01:35:21 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:21 GMT Message-Id: <202109240135.18O1ZLCn029439@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: 86b4f2f60efc - stable/13 - e1000: introduce DPGFR register 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: 86b4f2f60efc10b1cb5b2bc97a93ebddb543dea1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:22 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=86b4f2f60efc10b1cb5b2bc97a93ebddb543dea1 commit 86b4f2f60efc10b1cb5b2bc97a93ebddb543dea1 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:19 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:31:07 +0000 e1000: introduce DPGFR register Defined DPGFR, Dynamic Power Gate Force Control Register. Signed-off-by: Vitaly Lifshits Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (1469e5aceffbdcebe834292aadb40b1bd1602867) MFC after: 1 week (cherry picked from commit 7fb2111413c799414c86d7bfdcc72bc1c6302726) --- sys/dev/e1000/e1000_regs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/e1000/e1000_regs.h b/sys/dev/e1000/e1000_regs.h index 01009d969620..27c456a432e8 100644 --- a/sys/dev/e1000/e1000_regs.h +++ b/sys/dev/e1000/e1000_regs.h @@ -71,6 +71,7 @@ #define E1000_FEXTNVM11 0x5BBC /* Future Extended NVM 11 - RW */ #define E1000_FEXTNVM12 0x5BC0 /* Future Extended NVM 12 - RW */ #define E1000_PCIEANACFG 0x00F18 /* PCIE Analog Config */ +#define E1000_DPGFR 0x00FAC /* Dynamic Power Gate Force Control Register */ #define E1000_FCT 0x00030 /* Flow Control Type - RW */ #define E1000_CONNSW 0x00034 /* Copper/Fiber switch control - RW */ #define E1000_VET 0x00038 /* VLAN Ether Type - RW */ From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FB356B178D; Fri, 24 Sep 2021 01:35:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFvjp4C58z3JPq; Fri, 24 Sep 2021 01:35: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 CB66859E2; Fri, 24 Sep 2021 01:35: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 18O1ZPw1029542; Fri, 24 Sep 2021 01:35:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1ZPZP029541; Fri, 24 Sep 2021 01:35:25 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:25 GMT Message-Id: <202109240135.18O1ZPZP029541@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: b9fadaa3757f - stable/13 - e1000: clean LTO warnings 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: b9fadaa3757fc47c19b7a6b994f34fd8a1dada5e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:27 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=b9fadaa3757fc47c19b7a6b994f34fd8a1dada5e commit b9fadaa3757fc47c19b7a6b994f34fd8a1dada5e Author: Andrzej Ostruszka AuthorDate: 2019-11-07 15:03:15 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:32:52 +0000 e1000: clean LTO warnings During LTO build compiler reports some 'false positive' warnings about variables being possibly used uninitialized. This patch silences these warnings. Exemplary compiler warning to suppress (with LTO enabled): error: 'link' may be used uninitialized in this function [-Werror=maybe-uninitialized] if (link) { Signed-off-by: Andrzej Ostruszka Approved by: imp Obtained from: DPDK (46136031f19107f4e9b6b3a952cb7f57877a7f0f) MFC after: 1 week (cherry picked from commit 089cdb3990f47be3cd34d1a57567a2e89c917929) --- sys/dev/e1000/e1000_82543.c | 2 +- sys/dev/e1000/e1000_ich8lan.c | 2 +- sys/dev/e1000/e1000_phy.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/e1000/e1000_82543.c b/sys/dev/e1000/e1000_82543.c index 42c4726fa8c7..49049b8646cd 100644 --- a/sys/dev/e1000/e1000_82543.c +++ b/sys/dev/e1000/e1000_82543.c @@ -1062,7 +1062,7 @@ static s32 e1000_setup_copper_link_82543(struct e1000_hw *hw) { u32 ctrl; s32 ret_val; - bool link; + bool link = true; DEBUGFUNC("e1000_setup_copper_link_82543"); diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 8ca0fb392805..635be03f2900 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -5620,7 +5620,7 @@ void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw) void e1000_gig_downshift_workaround_ich8lan(struct e1000_hw *hw) { s32 ret_val; - u16 reg_data; + u16 reg_data = 0; DEBUGFUNC("e1000_gig_downshift_workaround_ich8lan"); diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index d84b6120dd31..2eae3acbe500 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -1695,7 +1695,7 @@ s32 e1000_copper_link_autoneg(struct e1000_hw *hw) s32 e1000_setup_copper_link_generic(struct e1000_hw *hw) { s32 ret_val; - bool link; + bool link = true; DEBUGFUNC("e1000_setup_copper_link_generic"); From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E5256B13D9; Fri, 24 Sep 2021 01:35: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 4HFvjh1cbsz3JPW; Fri, 24 Sep 2021 01:35: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 0722156ED; Fri, 24 Sep 2021 01:35: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 18O1ZJLD029414; Fri, 24 Sep 2021 01:35:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1ZJKs029413; Fri, 24 Sep 2021 01:35:19 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:19 GMT Message-Id: <202109240135.18O1ZJKs029413@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: 270d34d745b1 - stable/13 - e1000: expose FEXTNVM registers and masks 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: 270d34d745b1a2d4a5f2e485caf32d446bbd715c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:21 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=270d34d745b1a2d4a5f2e485caf32d446bbd715c commit 270d34d745b1a2d4a5f2e485caf32d446bbd715c Author: Guinan Sun AuthorDate: 2020-07-06 08:12:16 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:30:29 +0000 e1000: expose FEXTNVM registers and masks Adding defines for FEXTNVM8 and FEXTNVM12 registers with new masks for future use. Signed-off-by: Nir Efrati Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (6d208ec099cd870a73c6b444b350a82c7a26c5e4) MFC after: 1 week (cherry picked from commit de965d042fa4d341cec3fa7cacac0f30f224bde4) --- sys/dev/e1000/e1000_ich8lan.h | 3 ++- sys/dev/e1000/e1000_regs.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/e1000/e1000_ich8lan.h b/sys/dev/e1000/e1000_ich8lan.h index 12f912ebc6e0..caff11cbb899 100644 --- a/sys/dev/e1000/e1000_ich8lan.h +++ b/sys/dev/e1000/e1000_ich8lan.h @@ -113,11 +113,12 @@ #define E1000_FEXTNVM7_DISABLE_PB_READ 0x00040000 #define E1000_FEXTNVM7_SIDE_CLK_UNGATE 0x00000004 #define E1000_FEXTNVM7_DISABLE_SMB_PERST 0x00000020 +#define E1000_FEXTNVM8_UNBIND_DPG_FROM_MPHY 0x00000400 #define E1000_FEXTNVM9_IOSFSB_CLKGATE_DIS 0x00000800 #define E1000_FEXTNVM9_IOSFSB_CLKREQ_DIS 0x00001000 #define E1000_FEXTNVM11_DISABLE_PB_READ 0x00000200 #define E1000_FEXTNVM11_DISABLE_MULR_FIX 0x00002000 - +#define E1000_FEXTNVM12_DONT_WAK_DPG_CLKREQ 0x00001000 /* bit24: RXDCTL thresholds granularity: 0 - cache lines, 1 - descriptors */ #define E1000_RXDCTL_THRESH_UNIT_DESC 0x01000000 diff --git a/sys/dev/e1000/e1000_regs.h b/sys/dev/e1000/e1000_regs.h index fe9834405359..01009d969620 100644 --- a/sys/dev/e1000/e1000_regs.h +++ b/sys/dev/e1000/e1000_regs.h @@ -66,8 +66,10 @@ #define E1000_FEXTNVM4 0x00024 /* Future Extended NVM 4 - RW */ #define E1000_FEXTNVM6 0x00010 /* Future Extended NVM 6 - RW */ #define E1000_FEXTNVM7 0x000E4 /* Future Extended NVM 7 - RW */ +#define E1000_FEXTNVM8 0x5BB0 /* Future Extended NVM 8 - RW */ #define E1000_FEXTNVM9 0x5BB4 /* Future Extended NVM 9 - RW */ #define E1000_FEXTNVM11 0x5BBC /* Future Extended NVM 11 - RW */ +#define E1000_FEXTNVM12 0x5BC0 /* Future Extended NVM 12 - RW */ #define E1000_PCIEANACFG 0x00F18 /* PCIE Analog Config */ #define E1000_FCT 0x00030 /* Flow Control Type - RW */ #define E1000_CONNSW 0x00034 /* Copper/Fiber switch control - RW */ From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 677A36B1881; Fri, 24 Sep 2021 01:35: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 4HFvjm19Jcz3JbR; Fri, 24 Sep 2021 01:35: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 6F4375ACC; Fri, 24 Sep 2021 01:35: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 18O1ZNSL029492; Fri, 24 Sep 2021 01:35:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1ZN91029491; Fri, 24 Sep 2021 01:35:23 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:23 GMT Message-Id: <202109240135.18O1ZN91029491@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: a026f3294083 - stable/13 - e1000: fix timeout for shadow RAM write 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: a026f3294083b585bef81c8a01253fdbae50e72a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:24 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a026f3294083b585bef81c8a01253fdbae50e72a commit a026f3294083b585bef81c8a01253fdbae50e72a Author: Chengwen Feng AuthorDate: 2021-04-21 09:15:35 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:31:53 +0000 e1000: fix timeout for shadow RAM write This fixes the timed out for shadow RAM write EEWR can't be detected. Fixes: 5a32a257f957 ("e1000: more NICs in base driver") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Min Hu (Connor) Acked-by: Haiyue Wang Approved by: imp Obtained from: DPDK (4a8ab48ec47b3616272e50620b8e1a9599358ea6) MFC after: 1 week (cherry picked from commit f6517a7e69c10c6057d6c990a9f3ea22a2b62398) --- sys/dev/e1000/e1000_i210.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/e1000/e1000_i210.c b/sys/dev/e1000/e1000_i210.c index cd85a8c3172a..d3692db11245 100644 --- a/sys/dev/e1000/e1000_i210.c +++ b/sys/dev/e1000/e1000_i210.c @@ -195,6 +195,8 @@ static s32 e1000_write_nvm_srwr(struct e1000_hw *hw, u16 offset, u16 words, } for (i = 0; i < words; i++) { + ret_val = -E1000_ERR_NVM; + eewr = ((offset + i) << E1000_NVM_RW_ADDR_SHIFT) | (data[i] << E1000_NVM_RW_REG_DATA) | E1000_NVM_RW_REG_START; From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D9976B11FA; Fri, 24 Sep 2021 01:35: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 4HFvjg1kfJz3Jfq; Fri, 24 Sep 2021 01:35: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 E6BDF5A56; Fri, 24 Sep 2021 01:35: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 18O1ZIZt029390; Fri, 24 Sep 2021 01:35:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1ZIYp029388; Fri, 24 Sep 2021 01:35:18 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:18 GMT Message-Id: <202109240135.18O1ZIYp029388@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: b81b96fee23b - stable/13 - e1000: add missed define for VFTA 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: b81b96fee23b622be5e901543c97d50e68aae6c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:19 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=b81b96fee23b622be5e901543c97d50e68aae6c4 commit b81b96fee23b622be5e901543c97d50e68aae6c4 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:13 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:30:12 +0000 e1000: add missed define for VFTA VLAN filtering using the VFTA (VLAN Filter Table Array) and should be initialized prior to setting rx mode. Signed-off-by: Sasha Neftin Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (fc9933953c90e99970aa867c38f9c6e6c5d0488d) MFC after: 1 week (cherry picked from commit a8bb4ab7cfb84195ef8af3c788fecdc8830fc960) --- sys/dev/e1000/e1000_defines.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/e1000/e1000_defines.h b/sys/dev/e1000/e1000_defines.h index 5b77bd43af1a..e5435eb56dcd 100644 --- a/sys/dev/e1000/e1000_defines.h +++ b/sys/dev/e1000/e1000_defines.h @@ -1386,6 +1386,7 @@ #define E1000_MDIC_ERROR 0x40000000 #define E1000_MDIC_DEST 0x80000000 +#define E1000_VFTA_BLOCK_SIZE 8 /* SerDes Control */ #define E1000_GEN_CTL_READY 0x80000000 #define E1000_GEN_CTL_ADDRESS_SHIFT 8 From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3FBC6B171D; Fri, 24 Sep 2021 01:35: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 4HFvjm5v47z3JdJ; Fri, 24 Sep 2021 01:35:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9EBD859E1; Fri, 24 Sep 2021 01:35: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 18O1ZOMs029518; Fri, 24 Sep 2021 01:35:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1ZORb029517; Fri, 24 Sep 2021 01:35:24 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:24 GMT Message-Id: <202109240135.18O1ZORb029517@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: 713e66e37d99 - stable/13 - e1000: fix multicast setting in VF 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: 713e66e37d990e417170c73ae65024557b8f9071 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:25 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=713e66e37d990e417170c73ae65024557b8f9071 commit 713e66e37d990e417170c73ae65024557b8f9071 Author: Yong Wang AuthorDate: 2017-02-21 09:33:23 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:32:35 +0000 e1000: fix multicast setting in VF In function e1000_update_mc_addr_list_vf(), "msgbuf[0]" is used prior to initialization at "msgbuf[0] |= E1000_VF_SET_MULTICAST_OVERFLOW". And "msgbuf[0]" is overwritten at "msgbuf[0] = E1000_VF_SET_MULTICAST". Fix it by moving the second line prior to the first one that mentioned above. Fixes: dffbaf7880a8 ("e1000: revert fix for multicast in VF") Cc: stable@dpdk.org Signed-off-by: Yong Wang Acked-by: Wenzhuo Lu Approved by: imp Obtained from: DPDK (f58ca2f9ef6) MFC after: 1 week (cherry picked from commit ecf2a89a997ad4a14339b6a2f544e44b422620a0) --- sys/dev/e1000/e1000_vf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/e1000/e1000_vf.c b/sys/dev/e1000/e1000_vf.c index 653ba322a185..4b73bb9709c1 100644 --- a/sys/dev/e1000/e1000_vf.c +++ b/sys/dev/e1000/e1000_vf.c @@ -419,12 +419,13 @@ void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, DEBUGOUT1("MC Addr Count = %d\n", mc_addr_count); + msgbuf[0] = E1000_VF_SET_MULTICAST; + if (mc_addr_count > 30) { msgbuf[0] |= E1000_VF_SET_MULTICAST_OVERFLOW; mc_addr_count = 30; } - msgbuf[0] = E1000_VF_SET_MULTICAST; msgbuf[0] |= mc_addr_count << E1000_VT_MSGINFO_SHIFT; for (i = 0; i < mc_addr_count; i++) { From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 33FB66B1720; Fri, 24 Sep 2021 01: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 4HFvjq5QBYz3JjQ; Fri, 24 Sep 2021 01:35:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7B0A59E3; Fri, 24 Sep 2021 01:35:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18O1ZQWB029568; Fri, 24 Sep 2021 01:35:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1ZQDf029567; Fri, 24 Sep 2021 01:35:26 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:26 GMT Message-Id: <202109240135.18O1ZQDf029567@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: 9e44dd372efa - stable/13 - e1000: prevent ULP flow if cable connected 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: 9e44dd372efaedacbb7b0e2780ae3b56b5a074b5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:28 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=9e44dd372efaedacbb7b0e2780ae3b56b5a074b5 commit 9e44dd372efaedacbb7b0e2780ae3b56b5a074b5 Author: Wenzhuo Lu AuthorDate: 2015-10-16 02:51:03 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:33:10 +0000 e1000: prevent ULP flow if cable connected Enabling ulp on link down when cable is connect caused an infinite loop of linkup/down indications in the NDIS driver. After discussed, correct flow is to enable ULP only when cable is disconnected. Signed-off-by: Wenzhuo Lu Approved by: imp Obtained from: DPDK (4bff263d54d299269966365f9697941eecaa241b) MFC after: 1 week (cherry picked from commit 40fa6e53f53cde84f6f5c7330f89e4ae373d7d93) --- sys/dev/e1000/e1000_ich8lan.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 635be03f2900..dd4e85d64aff 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -1307,6 +1307,10 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx) (E1000_READ_REG(hw, E1000_FEXT) & E1000_FEXT_PHY_CABLE_DISCONNECTED) ? "" : "not", i * 50); + if (!(E1000_READ_REG(hw, E1000_FEXT) & + E1000_FEXT_PHY_CABLE_DISCONNECTED)) + return 0; + } ret_val = hw->phy.ops.acquire(hw); From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:35:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 573F06B13E8; Fri, 24 Sep 2021 01:35: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 4HFvjk6jb0z3JdD; Fri, 24 Sep 2021 01:35: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 4B68B5ACB; Fri, 24 Sep 2021 01:35: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 18O1ZMl5029468; Fri, 24 Sep 2021 01:35:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1ZM4S029467; Fri, 24 Sep 2021 01:35:22 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:35:22 GMT Message-Id: <202109240135.18O1ZM4S029467@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: f2f50e5e2789 - stable/13 - e1000: cleanup pre-processor tags 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: f2f50e5e27894c0f464022f301b2208753cc1764 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:35:24 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=f2f50e5e27894c0f464022f301b2208753cc1764 commit f2f50e5e27894c0f464022f301b2208753cc1764 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:20 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:31:34 +0000 e1000: cleanup pre-processor tags The codes has been exposed correctly, so remove pre-processor tags. Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (a50e998a0fd94e5db508710868a3417b1846425c) MFC after: 1 week (cherry picked from commit 9c4a0fabc8b88af0d9fd3f0d67bd080714d1ee4b) --- sys/dev/e1000/e1000_manage.c | 5 +++-- sys/dev/e1000/e1000_regs.h | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/e1000/e1000_manage.c b/sys/dev/e1000/e1000_manage.c index 120431d58b0b..b5ad5815d5ee 100644 --- a/sys/dev/e1000/e1000_manage.c +++ b/sys/dev/e1000/e1000_manage.c @@ -34,6 +34,8 @@ /*$FreeBSD$*/ #include "e1000_api.h" +#include "e1000_manage.h" + /** * e1000_calculate_checksum - Calculate checksum for buffer * @buffer: pointer to EEPROM @@ -455,6 +457,7 @@ s32 e1000_host_interface_command(struct e1000_hw *hw, u8 *buffer, u32 length) return E1000_SUCCESS; } + /** * e1000_load_firmware - Writes proxy FW code buffer to host interface * and execute. @@ -573,5 +576,3 @@ s32 e1000_load_firmware(struct e1000_hw *hw, u8 *buffer, u32 length) return E1000_SUCCESS; } - - diff --git a/sys/dev/e1000/e1000_regs.h b/sys/dev/e1000/e1000_regs.h index 27c456a432e8..c09856e55275 100644 --- a/sys/dev/e1000/e1000_regs.h +++ b/sys/dev/e1000/e1000_regs.h @@ -381,6 +381,7 @@ #define E1000_TSCTC 0x040F8 /* TCP Segmentation Context Tx - R/clr */ #define E1000_TSCTFC 0x040FC /* TCP Segmentation Context Tx Fail - R/clr */ #define E1000_IAC 0x04100 /* Interrupt Assertion Count */ +/* Interrupt Cause */ #define E1000_ICRXPTC 0x04104 /* Interrupt Cause Rx Pkt Timer Expire Count */ #define E1000_ICRXATC 0x04108 /* Interrupt Cause Rx Abs Timer Expire Count */ #define E1000_ICTXPTC 0x0410C /* Interrupt Cause Tx Pkt Timer Expire Count */ @@ -503,12 +504,14 @@ #define E1000_WUC 0x05800 /* Wakeup Control - RW */ #define E1000_WUFC 0x05808 /* Wakeup Filter Control - RW */ #define E1000_WUS 0x05810 /* Wakeup Status - RO */ +/* Management registers */ #define E1000_MANC 0x05820 /* Management Control - RW */ #define E1000_IPAV 0x05838 /* IP Address Valid - RW */ #define E1000_IP4AT 0x05840 /* IPv4 Address Table - RW Array */ #define E1000_IP6AT 0x05880 /* IPv6 Address Table - RW Array */ #define E1000_WUPL 0x05900 /* Wakeup Packet Length - RW */ #define E1000_WUPM 0x05A00 /* Wakeup Packet Memory - RO A */ +/* MSI-X Table Register Descriptions */ #define E1000_PBACL 0x05B68 /* MSIx PBA Clear - Read/Write 1's to clear */ #define E1000_FFLT 0x05F00 /* Flexible Filter Length Table - RW Array */ #define E1000_HOST_IF 0x08800 /* Host Interface */ From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47F3E6B1E60; Fri, 24 Sep 2021 01:41: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 4HFvrm1S8cz3KZH; Fri, 24 Sep 2021 01:41: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 113BE5A68; Fri, 24 Sep 2021 01:41: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 18O1fS9L039210; Fri, 24 Sep 2021 01:41:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1fRnh039209; Fri, 24 Sep 2021 01:41:27 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:27 GMT Message-Id: <202109240141.18O1fRnh039209@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: 0ab1c22db802 - stable/12 - e1000: Update copyrights and readme 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: 0ab1c22db802388f63883e3095a7b3afb86db029 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:28 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0ab1c22db802388f63883e3095a7b3afb86db029 commit 0ab1c22db802388f63883e3095a7b3afb86db029 Author: Kevin Bowling AuthorDate: 2021-09-16 11:35:45 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:38:07 +0000 e1000: Update copyrights and readme Copyrights in sync with "cid-gigabit.2020.06.05.tar.gz released by ND" (from DPDK). README from the latest em-7.7.8 on intel.com Approved by: imp MFC after: 1 week (cherry picked from commit 702cac6c6bf20ca43db26c38185f65fc9ed1935e) --- sys/dev/e1000/LICENSE | 41 ++- sys/dev/e1000/README | 547 ++++++++++++++++++++------------------ sys/dev/e1000/e1000_80003es2lan.c | 40 +-- sys/dev/e1000/e1000_80003es2lan.h | 40 +-- sys/dev/e1000/e1000_82540.c | 40 +-- sys/dev/e1000/e1000_82541.c | 40 +-- sys/dev/e1000/e1000_82541.h | 40 +-- sys/dev/e1000/e1000_82542.c | 40 +-- sys/dev/e1000/e1000_82543.c | 40 +-- sys/dev/e1000/e1000_82543.h | 40 +-- sys/dev/e1000/e1000_82571.c | 40 +-- sys/dev/e1000/e1000_82571.h | 40 +-- sys/dev/e1000/e1000_82575.c | 40 +-- sys/dev/e1000/e1000_82575.h | 40 +-- sys/dev/e1000/e1000_api.c | 40 +-- sys/dev/e1000/e1000_api.h | 40 +-- sys/dev/e1000/e1000_defines.h | 40 +-- sys/dev/e1000/e1000_hw.h | 40 +-- sys/dev/e1000/e1000_i210.c | 40 +-- sys/dev/e1000/e1000_i210.h | 40 +-- sys/dev/e1000/e1000_ich8lan.c | 40 +-- sys/dev/e1000/e1000_ich8lan.h | 40 +-- sys/dev/e1000/e1000_mac.c | 40 +-- sys/dev/e1000/e1000_mac.h | 40 +-- sys/dev/e1000/e1000_manage.c | 40 +-- sys/dev/e1000/e1000_manage.h | 40 +-- sys/dev/e1000/e1000_mbx.c | 40 +-- sys/dev/e1000/e1000_mbx.h | 40 +-- sys/dev/e1000/e1000_nvm.c | 40 +-- sys/dev/e1000/e1000_nvm.h | 40 +-- sys/dev/e1000/e1000_osdep.c | 40 +-- sys/dev/e1000/e1000_osdep.h | 40 +-- sys/dev/e1000/e1000_phy.c | 40 +-- sys/dev/e1000/e1000_phy.h | 40 +-- sys/dev/e1000/e1000_regs.h | 40 +-- sys/dev/e1000/e1000_vf.c | 40 +-- sys/dev/e1000/e1000_vf.h | 40 +-- 37 files changed, 1007 insertions(+), 981 deletions(-) diff --git a/sys/dev/e1000/LICENSE b/sys/dev/e1000/LICENSE index f70a7cbd4a1d..51a32a819633 100644 --- a/sys/dev/e1000/LICENSE +++ b/sys/dev/e1000/LICENSE @@ -1,31 +1,30 @@ $FreeBSD$ - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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) + 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 COPYRIGHT OWNER 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. - diff --git a/sys/dev/e1000/README b/sys/dev/e1000/README index c0abeacccf4a..d734be75e758 100644 --- a/sys/dev/e1000/README +++ b/sys/dev/e1000/README @@ -1,9 +1,8 @@ $FreeBSD$ -FreeBSD* Driver for Intel Network Connection -============================================= - -May 30, 2007 +FreeBSD* Driver for Intel(R) Ethernet +===================================== +August 7, 2019 Contents ======== @@ -11,396 +10,424 @@ Contents - Overview - Identifying Your Adapter - Building and Installation -- Speed and Duplex Configuration -- Additional Configurations -- Known Limitations +- Additional Features and Configurations +- Known Issues/Troubleshooting - Support - License Overview ======== - -This file describes the FreeBSD* driver for Intel Network Connection. -This driver has been developed for use with FreeBSD, Release 7.x. +This file describes the FreeBSD* driver for Intel(R) Ethernet. This driver has +been developed for use with all community-supported versions of FreeBSD. For questions related to hardware requirements, refer to the documentation -supplied with your Gigabit adapter. All hardware requirements listed +supplied with your Intel Ethernet Adapter. All hardware requirements listed apply to use with FreeBSD. Identifying Your Adapter ======================== +This release includes two gigabit FreeBSD base Drivers for Intel(R) Ethernet. +These drivers are em and igb. -For information on how to identify your adapter, go to the Adapter & -Driver ID Guide at: - -http://support.intel.com/support/network/sb/cs-012904.htm - - -For the latest Intel network drivers for FreeBSD, see: +- The igb driver supports all 82575 and 82576-based gigabit network connections. +- The em driver supports all other gigabit network connections. +- Gigabit devices base on the Intel(R) Ethernet Controller X722 are supported by + the ixl driver. -http://downloadfinder.intel.com/scripts-df-external/support_intel.aspx - - -NOTE: Mobile adapters are not fully supported. NOTE: The Intel(R) 82562v 10/100 Network Connection only provides 10/100 support. +For information on how to identify your adapter, and for the latest Intel +network drivers, refer to the Intel Support website: +http://www.intel.com/support + + Building and Installation ========================= +NOTE: This driver package is to be used only as a standalone archive and the +user should not attempt to incorporate it into the kernel source tree. -NOTE: The driver can be installed as a dynamic loadable kernel module or - compiled into the kernel. You must have kernel sources installed in - order to compile the driver module. - -In the instructions below, x.x.x is the driver version as indicated in the -name of the driver tar file. +In the instructions below, x.x.x is the driver version as indicated in the name +of the driver tar file. 1. Move the base driver tar file to the directory of your choice. For example, use /home/username/em or /usr/local/src/em. 2. Untar/unzip the archive: - tar xzvf em-x.x.x.tar.gz - - This will create an em-x.x.x directory. - -3. To create a loadable module, perform the following steps. - NOTE: To compile the driver into the kernel, go directly to step 4. - - a. To compile the module - - cd em-x.x.x - make - - b. To install the compiled module to the system directory: - - make install - - c. If you want the driver to load automatically when the system is booted: + # tar xzf em-x.x.x.tar.gz - 1. Edit /boot/loader.conf, and add the following line: +This will create the em-x.x.x directory. - if_em_load="YES" +3. To install man page: -4. To compile the driver into the kernel, enter: + # cd em-x.x.x + # gzip -c em.4 > /usr/share/man/man4/em.4.gz - cd em-x.x.x/src - cp *.[ch] /usr/src/sys/dev/em +4. To load the driver onto a running system: - Edit the kernel configuration file (i.e., GENERIC or MYKERNEL) in - /usr/src/sys/i386/conf, and ensure the following line is present: - - device em - - Compile and install the kernel. The system must be rebooted for the - kernel updates to take effect. For additional information on compiling - the kernel, consult the FreeBSD operating system documentation. + # cd em-x.x.x/src + # make + # kldload ./if_em.ko 5. To assign an IP address to the interface, enter the following: - ifconfig em + # ifconfig em 6. Verify that the interface works. Enter the following, where is the IP address for another machine on the same subnet as the interface that is being tested: - ping - -7. To configure the IP address to remain after reboot, edit /etc/rc.conf, - and create the appropriate ifconfig_ementry: - - ifconfig_em="" + # ping - Example usage: +7. If you want the driver to load automatically when the system is booted: - ifconfig_em0="inet 192.168.10.1 netmask 255.255.255.0" + # cd em-x.x.x/src + # make + # make install - NOTE: For assistance, see the ifconfig man page. +Edit /boot/loader.conf, and add the following line: + if_em_load="YES" +Edit /etc/rc.conf, and create the appropriate ifconfig_em entry: -Speed and Duplex Configuration -============================== - -By default, the adapter auto-negotiates the speed and duplex of the -connection. If there is a specific need, the ifconfig utility can be used to -configure the speed and duplex settings on the adapter. Example usage: + ifconfig_em="" - ifconfig em media 100baseTX mediaopt - full-duplex +Example usage: + ifconfig_em0="inet 192.168.10.1 netmask 255.255.255.0" - NOTE: Only use mediaopt to set the driver to full-duplex. If mediaopt is - not specified and you are not running at gigabit speed, the driver - defaults to half-duplex. + NOTE: For assistance, see the ifconfig man page. -If the interface is currently forced to 100 full duplex, in order to change -to half duplex you must use this command: - ifconfig em media 100baseTX -mediaopt - full-duplex +Additional Features and Configurations +====================================== +Speed and Duplex Configuration +------------------------------ +In addressing speed and duplex configuration issues, you need to distinguish +between copper-based adapters and fiber-based adapters. -This driver supports the following media type options: +In the default mode, an Intel(R) Ethernet Network Adapter using copper +connections will attempt to auto-negotiate with its link partner to determine +the best setting. If the adapter cannot establish link with the link partner +using auto-negotiation, you may need to manually configure the adapter and link +partner to identical settings to establish link and pass packets. This should +only be needed when attempting to link with an older switch that does not +support auto-negotiation or one that has been forced to a specific speed or +duplex mode. Your link partner must match the setting you choose. 1 Gbps speeds +and higher cannot be forced. Use the autonegotiation advertising setting to +manually set devices for 1 Gbps and higher. - autoselect - Enables auto-negotiation for speed and duplex. +Caution: Only experienced network administrators should force speed and duplex +or change autonegotiation advertising manually. The settings at the switch must +always match the adapter settings. Adapter performance may suffer or your +adapter may not operate if you configure the adapter differently from your +switch. - 10baseT/UTP - Sets speed to 10 Mbps. Use the ifconfig mediaopt - option to select full-duplex mode. +An Intel(R) Ethernet Network Adapter using fiber-based connections, however, +will not attempt to auto-negotiate with its link partner since those adapters +operate only in full duplex and only at their native speed. - 100baseTX - Sets speed to 100 Mbps. Use the ifconfig mediaopt - option to select full-duplex mode. +By default, the adapter auto-negotiates the speed and duplex of the connection. +If there is a specific need, the ifconfig utility can be used to configure the +speed and duplex settings on the adapter. - 1000baseTX - Sets speed to 1000 Mbps. In this case, the driver - supports only full-duplex mode. +Example usage: - 1000baseSX - Sets speed to 1000 Mbps. In this case, the driver - supports only full-duplex mode. +# ifconfig emX media 100baseTX mediaopt full-duplex -For more information on the ifconfig utility, see the ifconfig man page. +NOTE: Only use mediaopt to set the driver to full-duplex. If mediaopt is not +specified and you are not running at gigabit speed, the driver defaults to +half-duplex. +If the interface is currently forced to 100 full duplex, you must use this +command to change to half duplex: -Additional Configurations -========================= +# ifconfig emX media 100baseTX -mediaopt full-duplex -The driver supports Transmit/Receive Checksum Offload and Jumbo Frames on -all but the 82542-based adapters. For specific adapters, refer to the -Identifying Your Adapter section. +This driver supports the following media type options: - Jumbo Frames - ------------ - To enable Jumbo Frames, use the ifconfig utility to set the Maximum - Transport Unit (MTU) frame size above its default of 1500 bytes. +Media Type Description +---------- ----------- +autoselect Enables auto-negotiation for speed and duplex. +10baseT/UTP Sets speed to 10 Mbps. Use the ifconfig mediaopt + option to select full-duplex mode. +100baseTX Sets speed to 100 Mbps. Use the ifconfig mediaopt + option to select full-duplex mode. +1000baseTX Sets speed to 1000 Mbps. In this case, the driver + supports only full-duplex mode. +1000baseSX Sets speed to 1000 Mbps. In this case, the driver + supports only full-duplex mode. - The Jumbo Frames MTU range for Intel Adapters is 1500 to 16110. To modify - the setting, enter the following: +For more information on the ifconfig utility, see the ifconfig man page. - ifconfig em mtu 9000 +Jumbo Frames +------------ +Jumbo Frames support is enabled by changing the Maximum Transmission Unit (MTU) +to a value larger than the default value of 1500. + +Use the ifconfig command to increase the MTU size. For example, enter the +following where X is the interface number: + +# ifconfig emX mtu 9000 + +To confirm an interface's MTU value, use the ifconfig command. + +To confirm the MTU used between two specific devices, use: + +# route get + +NOTE: The maximum MTU setting for Jumbo Frames is 16110. This value coincides +with the maximum Jumbo Frames size of 16132 bytes. + +NOTE: Using Jumbo frames at 10 or 100 Mbps is not supported and may result in +poor performance or loss of link. + +NOTE: Packet loss may have a greater impact on throughput when you use jumbo +frames. If you observe a drop in performance after enabling jumbo frames, +enabling flow control may mitigate the issue. + +NOTE: Some Intel gigabit adapters that support Jumbo Frames have a frame size +limit of 9238 bytes, with a corresponding MTU size limit of 9216 bytes. The +adapters with this limitation are based on the Intel(R) 82571EB, 82572EI, +82573L, 82566, 82562, and 80003ES2LAN controller. These correspond to the +following product names: + Intel(R) PRO/1000 PT Server Adapter + Intel(R) PRO/1000 PT Desktop Adapter + Intel(R) PRO/1000 PT Network Connection + Intel(R) PRO/1000 PT Dual Port Server Adapter + Intel(R) PRO/1000 PT Dual Port Network Connection + Intel(R) PRO/1000 PT Quad Port Server Adapter + Intel(R) PRO/1000 PF Quad Port Server Adapter + Intel(R) PRO/1000 PF Server Adapter + Intel(R) PRO/1000 PF Network Connection + Intel(R) PRO/1000 PF Dual Port Server Adapter + Intel(R) PRO/1000 PB Server Connection + Intel(R) PRO/1000 PL Network Connection + Intel(R) PRO/1000 EB Network Connection with I/O Acceleration + Intel(R) PRO/1000 EB Backplane Connection with I/O Acceleration + Intel(R) 82566DM-2 Gigabit Network Connection + Intel(R) 82574L Gigabit Network Connection + Intel(R) Gigabit CT Desktop Adapter + Intel(R) 82567LM-4 Gigabit Network Connection + Intel(R) 82567LM-3 Gigabit Network Connection + Intel(R) 82567LF-3 Gigabit Network Connection - To confirm the MTU used between two specific devices, use: +NOTE: The following adapters limit Jumbo Frames sized packets to a maximum of +4088 bytes: + - Intel(R) 82578DM Gigabit Network Connection + - Intel(R) 82577LM Gigabit Network Connection +- The following adapters do not support Jumbo Frames: + - Intel(R) PRO/1000 Gigabit Server Adapter + - Intel(R) PRO/1000 PM Network Connection + - Intel(R) 82562G 10/100 Network Connection + - Intel(R) 82562G-2 10/100 Network Connection + - Intel(R) 82562GT 10/100 Network Connection + - Intel(R) 82562GT-2 10/100 Network Connection + - Intel(R) 82562V 10/100 Network Connection + - Intel(R) 82562V-2 10/100 Network Connection + - Intel(R) 82566DC Gigabit Network Connection + - Intel(R) 82566DC-2 Gigabit Network Connection + - Intel(R) 82566DM Gigabit Network Connection + - Intel(R) 82566MC Gigabit Network Connection + - Intel(R) 82566MM Gigabit Network Connection + - Intel(R) 82567V-3 Gigabit Network Connection + - Intel(R) 82577LC Gigabit Network Connection + - Intel(R) 82578DC Gigabit Network Connection +- Jumbo Frames cannot be configured on an 82579-based Network device if + MACSec is enabled on the system. - route get - Notes: +VLANS +----- +To create a new VLAN interface: - - Only enable Jumbo Frames if your network infrastructure supports them. +# ifconfig create - - To enable Jumbo Frames, increase the MTU size on the interface beyond - 1500. +To associate the VLAN interface with a physical interface and assign a VLAN ID, +IP address, and netmask: - - The Jumbo Frames setting on the switch must be set to at least 22 bytes - larger than that of the MTU. +# ifconfig netmask vlan +vlandev - - The maximum MTU setting for Jumbo Frames is 16110. This value coincides - with the maximum Jumbo Frames size of 16128. +Example: - - Some Intel gigabit adapters that support Jumbo Frames have a frame size - limit of 9238 bytes, with a corresponding MTU size limit of 9216 bytes. - The adapters with this limitation are based on the Intel(R) 82571EB, - 82572EI, 82573L, 82566, 82562, and 80003ES2LAN controller. These - correspond to the following product names: - Intel(R) PRO/1000 PT Server Adapter - Intel(R) PRO/1000 PT Desktop Adapter - Intel(R) PRO/1000 PT Network Connection - Intel(R) PRO/1000 PT Dual Port Server Adapter - Intel(R) PRO/1000 PT Dual Port Network Connection - Intel(R) PRO/1000 PT Quad Port Server Adapter - Intel(R) PRO/1000 PF Quad Port Server Adapter - Intel(R) PRO/1000 PF Server Adapter - Intel(R) PRO/1000 PF Network Connection - Intel(R) PRO/1000 PF Dual Port Server Adapter - Intel(R) PRO/1000 PB Server Connection - Intel(R) PRO/1000 PL Network Connection - Intel(R) PRO/1000 EB Network Connection with I/O Acceleration - Intel(R) PRO/1000 EB Backplane Connection with I/O Acceleration - Intel(R) 82566DM-2 Gigabit Network Connection +# ifconfig vlan10 10.0.0.1 netmask 255.255.255.0 vlan 10 vlandev em0 - - Adapters based on the Intel(R) 82542 and 82573V/E controller do not - support Jumbo Frames. These correspond to the following product names: - Intel(R) PRO/1000 Gigabit Server Adapter - Intel(R) PRO/1000 PM Network Connection +In this example, all packets will be marked on egress with 802.1Q VLAN tags, +specifying a VLAN ID of 10. - - Using Jumbo Frames at 10 or 100 Mbps may result in poor performance or - loss of link. +To remove a VLAN interface: - - The following adapters do not support Jumbo Frames: - Intel(R) 82562V 10/100 Network Connection - Intel(R) 82566DM Gigabit Network Connection - Intel(R) 82566DC Gigabit Network Connection - Intel(R) 82566MM Gigabit Network Connection - Intel(R) 82566MC Gigabit Network Connection - Intel(R) 82562GT 10/100 Network Connection - Intel(R) 82562G 10/100 Network Connection - Intel(R) 82566DC-2 Gigabit Network Connection - Intel(R) 82562V-2 10/100 Network Connection - Intel(R) 82562G-2 10/100 Network Connection - Intel(R) 82562GT-2 10/100 Network Connection +# ifconfig destroy - VLANs - ----- - To create a new VLAN interface: - ifconfig create +Polling +------- +NOTES: +- Device Polling is only valid for non-SMP kernels. +- The driver has to be built into the kernel for Device Polling to be + enabled in the driver. - To associate the VLAN interface with a physical interface and - assign a VLAN ID, IP address, and netmask: +To enable polling in the driver, add the following options to the kernel +configuration, and then recompile the kernel: - ifconfig netmask vlan - vlandev + options DEVICE_POLLING + options HZ=1000 - Example: +At runtime use: + ifconfig emX polling (to turn polling on) +and: + ifconfig emX -polling (to turn it off) - ifconfig vlan10 10.0.0.1 netmask 255.255.255.0 vlan 10 vlandev em0 - In this example, all packets will be marked on egress with 802.1Q VLAN - tags, specifying a VLAN ID of 10. +Checksum Offload +---------------- +Checksum offloading is not supported on 82542 Gigabit adapters. - To remove a VLAN interface: +Checksum offloading supports both TCP and UDP packets and is supported for both +transmit and receive. - Intel Network Connection ifconfig destroy +Checksum offloading can be enabled or disabled using ifconfig. Both transmit +and receive offloading will be either enabled or disabled together. You cannot +enable/disable one without the other. +To enable checksum offloading: - Polling - ------- +# ifconfig emX rxcsum - To enable polling in the driver, add the following options to the kernel - configuration, and then recompile the kernel: +To disable checksum offloading: - options DEVICE_POLLING - options HZ=1000 +# ifconfig emX -rxcsum - At runtime use: - ifconfig emX polling (to turn polling on) - and: - ifconfig emX -polling (to turn it off) +To confirm the current setting: +# ifconfig emX - Checksum Offload - ---------------- - Checksum offloading is not supported on 82542 Gigabit adapters. +Look for the presence or absence of the following line: + options=3 - Checksum offloading supports both TCP and UDP packets and is - supported for both transmit and receive. +See the ifconfig man page for further information. - Checksum offloading can be enabled or disabled using ifconfig. - Both transmit and receive offloading will be either enabled or - disabled together. You cannot enable/disable one without the other. - To enable checksum offloading: +TSO +--- +TSO (TCP Segmentation Offload) supports both IPv4 and IPv6. TSO can be disabled +and enabled using the ifconfig utility or sysctl. - ifconfig rxcsum +NOTE: TSO requires Tx checksum, if Tx checksum is disabled, TSO will also be +disabled. - To disable checksum offloading: +NOTE: By default only PCI-Express adapters are ENABLED to do TSO. Others can be +enabled by the user at their own risk. TSO is not supported on 82547 or +82544-based adapters, as well as older adapters. - ifconfig -rxcsum +To enable/disable TSO in the stack: - To confirm the current setting: +# sysctl net.inet.tcp.tso=0 (or 1 to enable it) - ifconfig +Doing this disables/enables TSO in the stack and affects all installed adapters. - Look for the presence or absence of the following line: +To disable BOTH TSO IPv4 and IPv6: - options=3 +# ifconfig em -tso - See the ifconfig man page for further information. +To enable BOTH TSO IPv4 and IPv6: +# ifconfig em tso - TSO - --- - The FreeBSD driver offers support for TSO (TCP Segmentation Offload). +You can also enable/disable IPv4 TSO or IPv6 TSO individually. Simply replace +tso|-tso in the above command with tso4 or tso6. For example, to disable +TSO IPv4: - You can enable/disable it in two ways/places: +# ifconfig em -tso4 - - sysctl net.inet.tcp.tso=0 (or 1 to enable it) +To disable TSO IPv6: - Doing this disables TSO in the stack and will affect all adapters. +# ifconfig em -tso6 - - ifconfig emX -tso - Doing this will disable TSO only for this adapter. +MSI-X +----- +MSI or MSI-X can be turned off by an entry in /etc/sysctl.conf - To enable: + hw.em.enable_msi=0 - - ifconfig emX tso +Unload and reload the driver. - NOTES: By default only PCI-Express adapters are ENABLED to do TSO. Others - can be enabled by the user at their own risk - TSO is not supported on 82547 and 82544-based adapters, as well as older adapters. +Known Issues/Troubleshooting +============================ -Known Limitations -================= +Detected Tx Unit Hang in Quad Port Adapters +------------------------------------------- +In some cases ports 3 and 4 don't pass traffic and report 'Detected Tx Unit +Hang' followed by 'NETDEV WATCHDOG: emX: transmit timed out' errors. Ports 1 +and 2 do not show any errors and will pass traffic. - Detected Tx Unit Hang in Quad Port Adapters - ------------------------------------------- +This issue may be resolved by updating to the latest kernel and BIOS. You +should use an OS that fully supports Message Signaled Interrupts (MSI) and make +sure that MSI is enabled in your system's BIOS. - In some cases ports 3 and 4 wont pass traffic. Ports 1 and 2 don't show - any errors and will pass traffic. - This issue MAY be resolved by updating to the latest BIOS. You can - check your system's BIOS by downloading the Linux Firmware Developer Kit - that can be obtained at http://www.linuxfirmwarekit.org/ +There are known performance issues with this driver when running UDP traffic +with Jumbo Frames. +---------------------------------------------------------------------------- - There are known performance issues with this driver when running UDP traffic - with Jumbo Frames. - ---------------------------------------------------------------------------- +82541/82547 can't link or is slow to link with some link partners +----------------------------------------------------------------- +There is a known compatibility issue where time to link is slow or link is not +established between 82541/82547 controllers and some switches. Known switches +include: + Planex FXG-08TE + I-O Data ETG-SH8 - 82541/82547 can't link or is slow to link with some link partners - ----------------------------------------------------------------- +The driver can be compiled with the following changes: - There is a known compatibility issue where time to link is slow or link is not - established between 82541/82547 controllers and some switches. Known switches - include: - Planex FXG-08TE - I-O Data ETG-SH8 - Netgear GS105v3 + Edit ./em.x.x.x/src/if_em.h to change the #define EM_MASTER_SLAVE - The driver can be compiled with the following changes: +For example, change from: - Edit ./em.x.x.x/src/if_em.h to change the #define EM_MASTER_SLAVE - For example, change from: + #define EM_MASTER_SLAVE e1000_ms_hw_default - #define EM_MASTER_SLAVE e1000_ms_hw_default - to: - #define EM_MASTER_SLAVE 2 +to: - Use one of the following options: - 1 = Master mode - 2 = Slave mode - 3 = Auto master/slave - Setting 2 is recommended. + #define EM_MASTER_SLAVE 2 - Recompile the module: - a. To compile the module - cd em-x.x.x - make clean - make +Use one of the following options: + 1 = Master mode + 2 = Slave mode + 3 = Auto master/slave +Setting 2 is recommended. - b. To install the compiled module in system directory: - make install +Recompile the module: + a. To compile the module + cd em-x.x.x + make clean + make + b. To install the compiled module in system directory: + make install Support ======= +For general information, go to the Intel support website at: +http://www.intel.com/support/ -For general information and support, go to the Intel support website at: +If an issue is identified with the released source code on a supported kernel +with a supported adapter, email the specific information related to the issue +to freebsd@intel.com - http://support.intel.com -If an issue is identified, support is through email only at: -freebsd@intel.com +Copyright(c) 1999-2019 Intel Corporation. -License -======= - -This software program is released under the terms of a license agreement -between you ('Licensee') and Intel. Do not use or load this software or any -associated materials (collectively, the 'Software') until you have carefully -read the full terms and conditions of the LICENSE located in this software -package. By loading or using the Software, you agree to the terms of this -Agreement. If you do not agree with the terms of this Agreement, do not -install or use the Software. +Trademarks +========== +Intel is a trademark or registered trademark of Intel Corporation or its +subsidiaries in the United States and/or other countries. * Other names and brands may be claimed as the property of others. diff --git a/sys/dev/e1000/e1000_80003es2lan.c b/sys/dev/e1000/e1000_80003es2lan.c index 5c0220adfc6f..50fdfab54685 100644 --- a/sys/dev/e1000/e1000_80003es2lan.c +++ b/sys/dev/e1000/e1000_80003es2lan.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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) + 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 COPYRIGHT OWNER 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. diff --git a/sys/dev/e1000/e1000_80003es2lan.h b/sys/dev/e1000/e1000_80003es2lan.h index cbf0eafa9407..9e6de14757d7 100644 --- a/sys/dev/e1000/e1000_80003es2lan.h +++ b/sys/dev/e1000/e1000_80003es2lan.h @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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) + 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 COPYRIGHT OWNER 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. diff --git a/sys/dev/e1000/e1000_82540.c b/sys/dev/e1000/e1000_82540.c index d90c8f9b73f1..0296397ee013 100644 --- a/sys/dev/e1000/e1000_82540.c +++ b/sys/dev/e1000/e1000_82540.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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) + 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 COPYRIGHT OWNER 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. diff --git a/sys/dev/e1000/e1000_82541.c b/sys/dev/e1000/e1000_82541.c *** 1823 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF0DE6B2020; Fri, 24 Sep 2021 01:41: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 4HFvrn3QWTz3KcH; Fri, 24 Sep 2021 01:41: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 37F095BE1; Fri, 24 Sep 2021 01:41: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 18O1fT7w039235; Fri, 24 Sep 2021 01:41:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1fTEb039234; Fri, 24 Sep 2021 01:41:29 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:29 GMT Message-Id: <202109240141.18O1fTEb039234@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: 676f29c1333d - stable/12 - e1000: support flashless i211 PBA 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: 676f29c1333dd0f141335e5f0ce8fa416734c921 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:29 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=676f29c1333dd0f141335e5f0ce8fa416734c921 commit 676f29c1333dd0f141335e5f0ce8fa416734c921 Author: Guinan Sun AuthorDate: 2020-07-06 08:11:59 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:38:38 +0000 e1000: support flashless i211 PBA Add support to print PBA when using flashless. Signed-off-by: Todd Fujinaka Signed-off-by: Sasha Neftin Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (d3c41d90dfd5b39dec14c74cf53086f4e6634aed) MFC after: 1 week (cherry picked from commit de0ae5d1cb896dbc04c5334ef0b864b3c841c3ce) --- sys/dev/e1000/e1000_82575.c | 2 +- sys/dev/e1000/e1000_nvm.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index d588539ca8e8..27e564d7841b 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -461,7 +461,7 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) if ((mac->type == e1000_i210) || (mac->type == e1000_i211)) mac->ops.init_hw = e1000_init_hw_i210; else - mac->ops.init_hw = e1000_init_hw_82575; + mac->ops.init_hw = e1000_init_hw_82575; /* link setup */ mac->ops.setup_link = e1000_setup_link_generic; /* physical interface link setup */ diff --git a/sys/dev/e1000/e1000_nvm.c b/sys/dev/e1000/e1000_nvm.c index 360c95aa8c69..d96ea3bf760a 100644 --- a/sys/dev/e1000/e1000_nvm.c +++ b/sys/dev/e1000/e1000_nvm.c @@ -776,8 +776,9 @@ s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num, DEBUGFUNC("e1000_read_pba_string_generic"); - if ((hw->mac.type >= e1000_i210) && - !e1000_get_flash_presence_i210(hw)) { + if ((hw->mac.type == e1000_i210 || + hw->mac.type == e1000_i211) && + !e1000_get_flash_presence_i210(hw)) { DEBUGOUT("Flashless no PBA string\n"); return -E1000_ERR_NVM_PBA_SECTION; } From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B0FA36B1DDB; Fri, 24 Sep 2021 01:41:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFvrp3hRQz3KfW; Fri, 24 Sep 2021 01:41:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52BC15879; Fri, 24 Sep 2021 01:41: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 18O1fUd7039259; Fri, 24 Sep 2021 01:41:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1fUJt039258; Fri, 24 Sep 2021 01:41:30 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:30 GMT Message-Id: <202109240141.18O1fUJt039258@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: 307419416b53 - stable/12 - e1000: add missing device ID 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: 307419416b53f3f4e904656bb6b74ff8393b062c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:31 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=307419416b53f3f4e904656bb6b74ff8393b062c commit 307419416b53f3f4e904656bb6b74ff8393b062c Author: Guinan Sun AuthorDate: 2020-07-06 08:12:10 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:38:43 +0000 e1000: add missing device ID Adding Intel(R) I210 Gigabit Network Connection 15F6 device ID for SGMII flashless automotive device. Signed-off-by: Kamil Bednarczyk Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (586d770bfefc01d4af97c0ddf17c960c3e49ec22) MFC after: 1 week (cherry picked from commit 82a9d0c2c1ef75703d16e49e96d1e7b0bf046882) --- sys/dev/e1000/e1000_api.c | 1 + sys/dev/e1000/e1000_hw.h | 1 + sys/dev/e1000/if_em.c | 1 + 3 files changed, 3 insertions(+) diff --git a/sys/dev/e1000/e1000_api.c b/sys/dev/e1000/e1000_api.c index a36b228e075f..6e0f51ab7ffa 100644 --- a/sys/dev/e1000/e1000_api.c +++ b/sys/dev/e1000/e1000_api.c @@ -383,6 +383,7 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) break; case E1000_DEV_ID_I210_COPPER_FLASHLESS: case E1000_DEV_ID_I210_SERDES_FLASHLESS: + case E1000_DEV_ID_I210_SGMII_FLASHLESS: case E1000_DEV_ID_I210_COPPER: case E1000_DEV_ID_I210_COPPER_OEM1: case E1000_DEV_ID_I210_COPPER_IT: diff --git a/sys/dev/e1000/e1000_hw.h b/sys/dev/e1000/e1000_hw.h index 28bf22394842..a6df2323eb60 100644 --- a/sys/dev/e1000/e1000_hw.h +++ b/sys/dev/e1000/e1000_hw.h @@ -209,6 +209,7 @@ struct e1000_hw; #define E1000_DEV_ID_I210_SGMII 0x1538 #define E1000_DEV_ID_I210_COPPER_FLASHLESS 0x157B #define E1000_DEV_ID_I210_SERDES_FLASHLESS 0x157C +#define E1000_DEV_ID_I210_SGMII_FLASHLESS 0x15F6 #define E1000_DEV_ID_I211_COPPER 0x1539 #define E1000_DEV_ID_I354_BACKPLANE_1GBPS 0x1F40 #define E1000_DEV_ID_I354_SGMII 0x1F41 diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 519c666436d6..b89747f9ab46 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -233,6 +233,7 @@ static pci_vendor_info_t igb_vendor_info_array[] = PVID(0x8086, E1000_DEV_ID_I210_COPPER_OEM1, "Intel(R) I210 (OEM)"), PVID(0x8086, E1000_DEV_ID_I210_COPPER_FLASHLESS, "Intel(R) I210 Flashless (Copper)"), PVID(0x8086, E1000_DEV_ID_I210_SERDES_FLASHLESS, "Intel(R) I210 Flashless (SERDES)"), + PVID(0x8086, E1000_DEV_ID_I210_SGMII_FLASHLESS, "Intel(R) I210 Flashless (SGMII)"), PVID(0x8086, E1000_DEV_ID_I210_FIBER, "Intel(R) I210 (Fiber)"), PVID(0x8086, E1000_DEV_ID_I210_SERDES, "Intel(R) I210 (SERDES)"), PVID(0x8086, E1000_DEV_ID_I210_SGMII, "Intel(R) I210 (SGMII)"), From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D02BD6B1FCA; Fri, 24 Sep 2021 01:41: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 4HFvrq4g7bz3KZR; Fri, 24 Sep 2021 01:41: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 7D7315A6A; Fri, 24 Sep 2021 01:41: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 18O1fVtF039283; Fri, 24 Sep 2021 01:41:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1fVhU039282; Fri, 24 Sep 2021 01:41:31 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:31 GMT Message-Id: <202109240141.18O1fVhU039282@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: 5b6342de13a7 - stable/12 - e1000: expose xMDIO methods 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: 5b6342de13a7409aeff122fce64551fa6ef6b2c6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:31 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=5b6342de13a7409aeff122fce64551fa6ef6b2c6 commit 5b6342de13a7409aeff122fce64551fa6ef6b2c6 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:00 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:38:48 +0000 e1000: expose xMDIO methods Move read and write xmdio methods to e1000_phy. Signed-off-by: Sasha Neftin Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (b14d20f1b2bb0e6d95f19963c5d7f55374e0ead9) MFC after: 1 week (cherry picked from commit da24467c7a162691a14f2f74d90ff8dedb816cfc) --- sys/dev/e1000/e1000_i210.c | 71 --------------------------------------------- sys/dev/e1000/e1000_i210.h | 4 --- sys/dev/e1000/e1000_phy.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++ sys/dev/e1000/e1000_phy.h | 5 ++++ 4 files changed, 77 insertions(+), 75 deletions(-) diff --git a/sys/dev/e1000/e1000_i210.c b/sys/dev/e1000/e1000_i210.c index 88806891566f..c0055aa0df71 100644 --- a/sys/dev/e1000/e1000_i210.c +++ b/sys/dev/e1000/e1000_i210.c @@ -600,77 +600,6 @@ out: return ret_val; } -/** - * __e1000_access_xmdio_reg - Read/write XMDIO register - * @hw: pointer to the HW structure - * @address: XMDIO address to program - * @dev_addr: device address to program - * @data: pointer to value to read/write from/to the XMDIO address - * @read: boolean flag to indicate read or write - **/ -static s32 __e1000_access_xmdio_reg(struct e1000_hw *hw, u16 address, - u8 dev_addr, u16 *data, bool read) -{ - s32 ret_val; - - DEBUGFUNC("__e1000_access_xmdio_reg"); - - ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, dev_addr); - if (ret_val) - return ret_val; - - ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAAD, address); - if (ret_val) - return ret_val; - - ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, E1000_MMDAC_FUNC_DATA | - dev_addr); - if (ret_val) - return ret_val; - - if (read) - ret_val = hw->phy.ops.read_reg(hw, E1000_MMDAAD, data); - else - ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAAD, *data); - if (ret_val) - return ret_val; - - /* Recalibrate the device back to 0 */ - ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, 0); - if (ret_val) - return ret_val; - - return ret_val; -} - -/** - * e1000_read_xmdio_reg - Read XMDIO register - * @hw: pointer to the HW structure - * @addr: XMDIO address to program - * @dev_addr: device address to program - * @data: value to be read from the EMI address - **/ -s32 e1000_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 *data) -{ - DEBUGFUNC("e1000_read_xmdio_reg"); - - return __e1000_access_xmdio_reg(hw, addr, dev_addr, data, TRUE); -} - -/** - * e1000_write_xmdio_reg - Write XMDIO register - * @hw: pointer to the HW structure - * @addr: XMDIO address to program - * @dev_addr: device address to program - * @data: value to be written to the XMDIO address - **/ -s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 data) -{ - DEBUGFUNC("e1000_read_xmdio_reg"); - - return __e1000_access_xmdio_reg(hw, addr, dev_addr, &data, FALSE); -} - /** * e1000_pll_workaround_i210 * @hw: pointer to the HW structure diff --git a/sys/dev/e1000/e1000_i210.h b/sys/dev/e1000/e1000_i210.h index d1ef4edf6261..9ad9e28c363b 100644 --- a/sys/dev/e1000/e1000_i210.h +++ b/sys/dev/e1000/e1000_i210.h @@ -44,10 +44,6 @@ s32 e1000_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); s32 e1000_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); -s32 e1000_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, - u16 *data); -s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, - u16 data); s32 e1000_init_hw_i210(struct e1000_hw *hw); #define E1000_STM_OPCODE 0xDB00 diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index 3215ed33d115..d22bcb7149c1 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -4251,3 +4251,75 @@ bool e1000_is_mphy_ready(struct e1000_hw *hw) return ready; } + +/** + * __e1000_access_xmdio_reg - Read/write XMDIO register + * @hw: pointer to the HW structure + * @address: XMDIO address to program + * @dev_addr: device address to program + * @data: pointer to value to read/write from/to the XMDIO address + * @read: boolean flag to indicate read or write + **/ +static s32 __e1000_access_xmdio_reg(struct e1000_hw *hw, u16 address, + u8 dev_addr, u16 *data, bool read) +{ + s32 ret_val; + + DEBUGFUNC("__e1000_access_xmdio_reg"); + + ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, dev_addr); + if (ret_val) + return ret_val; + + ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAAD, address); + if (ret_val) + return ret_val; + + ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, E1000_MMDAC_FUNC_DATA | + dev_addr); + if (ret_val) + return ret_val; + + if (read) + ret_val = hw->phy.ops.read_reg(hw, E1000_MMDAAD, data); + else + ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAAD, *data); + if (ret_val) + return ret_val; + + /* Recalibrate the device back to 0 */ + ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, 0); + if (ret_val) + return ret_val; + + return ret_val; +} + +/** + * e1000_read_xmdio_reg - Read XMDIO register + * @hw: pointer to the HW structure + * @addr: XMDIO address to program + * @dev_addr: device address to program + * @data: value to be read from the EMI address + **/ +s32 e1000_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 *data) +{ + DEBUGFUNC("e1000_read_xmdio_reg"); + + return __e1000_access_xmdio_reg(hw, addr, dev_addr, data, true); +} + +/** + * e1000_write_xmdio_reg - Write XMDIO register + * @hw: pointer to the HW structure + * @addr: XMDIO address to program + * @dev_addr: device address to program + * @data: value to be written to the XMDIO address + **/ +s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 data) +{ + DEBUGFUNC("e1000_write_xmdio_reg"); + + return __e1000_access_xmdio_reg(hw, addr, dev_addr, &data, + false); +} diff --git a/sys/dev/e1000/e1000_phy.h b/sys/dev/e1000/e1000_phy.h index a13413e98638..38c8f9b466ce 100644 --- a/sys/dev/e1000/e1000_phy.h +++ b/sys/dev/e1000/e1000_phy.h @@ -122,6 +122,11 @@ s32 e1000_write_phy_reg_mphy(struct e1000_hw *hw, u32 address, u32 data, bool line_override); bool e1000_is_mphy_ready(struct e1000_hw *hw); +s32 e1000_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, + u16 *data); +s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, + u16 data); + #define E1000_MAX_PHY_ADDR 8 /* IGP01E1000 Specific Registers */ From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 111226B2105; Fri, 24 Sep 2021 01:41: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 4HFvrs6cLvz3KjJ; Fri, 24 Sep 2021 01:41: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 C2F5A587A; Fri, 24 Sep 2021 01:41: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 18O1fXqw039334; Fri, 24 Sep 2021 01:41:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1fXZI039332; Fri, 24 Sep 2021 01:41:33 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:33 GMT Message-Id: <202109240141.18O1fXZI039332@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: e50c8885a492 - stable/12 - e1000: fix minor issues and improve code style 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: e50c8885a49294effa63f487108a94c4c1ba8160 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:34 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e50c8885a49294effa63f487108a94c4c1ba8160 commit e50c8885a49294effa63f487108a94c4c1ba8160 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:03 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:38:59 +0000 e1000: fix minor issues and improve code style Fix typo in piece of code of NVM access for SPT. And cleans up the remaining instances in the shared code where it was not adhering to the Linux code standard. Wrong description was found in the mentioned file, so fix them. Remove shadowing variable declarations. Relating to operands in bitwise operations having different sizes. Unreachable code since *clock_in_i2c_* always return success. Don't return unused s32 and don't check for constants. Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Neftin Signed-off-by: Vitaly Lifshits Signed-off-by: Robert Konklewski Signed-off-by: Doug Dziggel Signed-off-by: Todd Fujinaka Signed-off-by: Jacob Keller Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (b8592c89c8fbc871d22313dcac0b86c89a7d5a62) MFC after: 1 week (cherry picked from commit 6c59e1866ca7a48d84f1d298bb3e6a07d2e6f756) --- sys/dev/e1000/e1000_80003es2lan.c | 1 - sys/dev/e1000/e1000_82575.c | 16 +++++----------- sys/dev/e1000/e1000_i210.c | 8 +++----- sys/dev/e1000/e1000_ich8lan.c | 40 ++++++++++++++++++++------------------- sys/dev/e1000/e1000_mac.c | 2 +- sys/dev/e1000/e1000_nvm.c | 2 +- sys/dev/e1000/e1000_phy.c | 5 ++++- 7 files changed, 35 insertions(+), 39 deletions(-) diff --git a/sys/dev/e1000/e1000_80003es2lan.c b/sys/dev/e1000/e1000_80003es2lan.c index 50fdfab54685..db6f1aeb65fb 100644 --- a/sys/dev/e1000/e1000_80003es2lan.c +++ b/sys/dev/e1000/e1000_80003es2lan.c @@ -1168,7 +1168,6 @@ static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw) /** * e1000_cfg_on_link_up_80003es2lan - es2 link configuration after link-up * @hw: pointer to the HW structure - * @duplex: current duplex setting * * Configure the KMRN interface by applying last minute quirks for * 10/100 operation. diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index 296a72542914..b252a4c7ff1d 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -104,10 +104,10 @@ static void e1000_clear_vfta_i350(struct e1000_hw *hw); static void e1000_i2c_start(struct e1000_hw *hw); static void e1000_i2c_stop(struct e1000_hw *hw); -static s32 e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data); +static void e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data); static s32 e1000_clock_out_i2c_byte(struct e1000_hw *hw, u8 data); static s32 e1000_get_i2c_ack(struct e1000_hw *hw); -static s32 e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data); +static void e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data); static s32 e1000_clock_out_i2c_bit(struct e1000_hw *hw, bool data); static void e1000_raise_i2c_clk(struct e1000_hw *hw, u32 *i2cctl); static void e1000_lower_i2c_clk(struct e1000_hw *hw, u32 *i2cctl); @@ -3238,9 +3238,7 @@ s32 e1000_read_i2c_byte_generic(struct e1000_hw *hw, u8 byte_offset, if (status != E1000_SUCCESS) goto fail; - status = e1000_clock_in_i2c_byte(hw, data); - if (status != E1000_SUCCESS) - goto fail; + e1000_clock_in_i2c_byte(hw, data); status = e1000_clock_out_i2c_bit(hw, nack); if (status != E1000_SUCCESS) @@ -3404,7 +3402,7 @@ static void e1000_i2c_stop(struct e1000_hw *hw) * * Clocks in one byte data via I2C data/clock **/ -static s32 e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data) +static void e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data) { s32 i; bool bit = 0; @@ -3416,8 +3414,6 @@ static s32 e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data) e1000_clock_in_i2c_bit(hw, &bit); *data |= bit << i; } - - return E1000_SUCCESS; } /** @@ -3506,7 +3502,7 @@ static s32 e1000_get_i2c_ack(struct e1000_hw *hw) * * Clocks in one bit via I2C data/clock **/ -static s32 e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data) +static void e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data) { u32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); @@ -3524,8 +3520,6 @@ static s32 e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data) /* Minimum low period of clock is 4.7 us */ usec_delay(E1000_I2C_T_LOW); - - return E1000_SUCCESS; } /** diff --git a/sys/dev/e1000/e1000_i210.c b/sys/dev/e1000/e1000_i210.c index c0055aa0df71..c6ca38f0f917 100644 --- a/sys/dev/e1000/e1000_i210.c +++ b/sys/dev/e1000/e1000_i210.c @@ -195,7 +195,7 @@ static s32 e1000_write_nvm_srwr(struct e1000_hw *hw, u16 offset, u16 words, } for (i = 0; i < words; i++) { - eewr = ((offset+i) << E1000_NVM_RW_ADDR_SHIFT) | + eewr = ((offset + i) << E1000_NVM_RW_ADDR_SHIFT) | (data[i] << E1000_NVM_RW_REG_DATA) | E1000_NVM_RW_REG_START; @@ -281,9 +281,9 @@ static s32 e1000_read_invm_i210(struct e1000_hw *hw, u16 offset, switch (offset) { case NVM_MAC_ADDR: ret_val = e1000_read_invm_word_i210(hw, (u8)offset, &data[0]); - ret_val |= e1000_read_invm_word_i210(hw, (u8)offset+1, + ret_val |= e1000_read_invm_word_i210(hw, (u8)offset + 1, &data[1]); - ret_val |= e1000_read_invm_word_i210(hw, (u8)offset+2, + ret_val |= e1000_read_invm_word_i210(hw, (u8)offset + 2, &data[2]); if (ret_val != E1000_SUCCESS) DEBUGOUT("MAC Addr not found in iNVM\n"); @@ -561,8 +561,6 @@ void e1000_init_function_pointers_i210(struct e1000_hw *hw) { e1000_init_function_pointers_82575(hw); hw->nvm.ops.init_params = e1000_init_nvm_params_i210; - - return; } /** diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index bc5b57394708..4af7c73a0b0c 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -841,7 +841,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) /** * __e1000_access_emi_reg_locked - Read/write EMI register * @hw: pointer to the HW structure - * @addr: EMI address to program + * @address: EMI address to program * @data: pointer to value to read/write from/to the EMI address * @read: boolean flag to indicate read or write * @@ -1619,8 +1619,6 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) if (hw->mac.type >= e1000_pch_lpt) { - u16 phy_reg; - hw->phy.ops.read_reg_locked(hw, I217_PLL_CLOCK_GATE_REG, &phy_reg); phy_reg &= ~I217_PLL_CLOCK_GATE_MASK; @@ -2474,7 +2472,7 @@ release: /** * e1000_configure_k1_ich8lan - Configure K1 power state * @hw: pointer to the HW structure - * @enable: K1 state to configure + * @k1_enable: K1 state to configure * * Configure the K1 power state based on the provided parameter. * Assumes semaphore already acquired. @@ -2622,6 +2620,7 @@ static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw) /** * e1000_hv_phy_workarounds_ich8lan - A series of Phy workarounds to be * done after every PHY reset. + * @hw: pointer to the HW structure **/ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) { @@ -2943,6 +2942,7 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable) /** * e1000_lv_phy_workarounds_ich8lan - A series of Phy workarounds to be * done after every PHY reset. + * @hw: pointer to the HW structure **/ static s32 e1000_lv_phy_workarounds_ich8lan(struct e1000_hw *hw) { @@ -3550,8 +3550,9 @@ static s32 e1000_read_nvm_spt(struct e1000_hw *hw, u16 offset, u16 words, for (i = 0; i < words; i += 2) { if (words - i == 1) { - if (dev_spec->shadow_ram[offset+i].modified) { - data[i] = dev_spec->shadow_ram[offset+i].value; + if (dev_spec->shadow_ram[offset + i].modified) { + data[i] = + dev_spec->shadow_ram[offset + i].value; } else { offset_to_read = act_offset + i - ((act_offset + i) % 2); @@ -3568,8 +3569,8 @@ static s32 e1000_read_nvm_spt(struct e1000_hw *hw, u16 offset, u16 words, } } else { offset_to_read = act_offset + i; - if (!(dev_spec->shadow_ram[offset+i].modified) || - !(dev_spec->shadow_ram[offset+i+1].modified)) { + if (!(dev_spec->shadow_ram[offset + i].modified) || + !(dev_spec->shadow_ram[offset + i + 1].modified)) { ret_val = e1000_read_flash_dword_ich8lan(hw, offset_to_read, @@ -3577,15 +3578,16 @@ static s32 e1000_read_nvm_spt(struct e1000_hw *hw, u16 offset, u16 words, if (ret_val) break; } - if (dev_spec->shadow_ram[offset+i].modified) - data[i] = dev_spec->shadow_ram[offset+i].value; + if (dev_spec->shadow_ram[offset + i].modified) + data[i] = + dev_spec->shadow_ram[offset + i].value; else - data[i] = (u16) (dword & 0xFFFF); - if (dev_spec->shadow_ram[offset+i].modified) - data[i+1] = - dev_spec->shadow_ram[offset+i+1].value; + data[i] = (u16)(dword & 0xFFFF); + if (dev_spec->shadow_ram[offset + i + 1].modified) + data[i + 1] = + dev_spec->shadow_ram[offset + i + 1].value; else - data[i+1] = (u16) (dword >> 16 & 0xFFFF); + data[i + 1] = (u16)(dword >> 16 & 0xFFFF); } } @@ -3639,8 +3641,8 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, ret_val = E1000_SUCCESS; for (i = 0; i < words; i++) { - if (dev_spec->shadow_ram[offset+i].modified) { - data[i] = dev_spec->shadow_ram[offset+i].value; + if (dev_spec->shadow_ram[offset + i].modified) { + data[i] = dev_spec->shadow_ram[offset + i].value; } else { ret_val = e1000_read_flash_word_ich8lan(hw, act_offset + i, @@ -4045,8 +4047,8 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, nvm->ops.acquire(hw); for (i = 0; i < words; i++) { - dev_spec->shadow_ram[offset+i].modified = TRUE; - dev_spec->shadow_ram[offset+i].value = data[i]; + dev_spec->shadow_ram[offset + i].modified = TRUE; + dev_spec->shadow_ram[offset + i].value = data[i]; } nvm->ops.release(hw); diff --git a/sys/dev/e1000/e1000_mac.c b/sys/dev/e1000/e1000_mac.c index b9754293d454..f5b4ae0f5135 100644 --- a/sys/dev/e1000/e1000_mac.c +++ b/sys/dev/e1000/e1000_mac.c @@ -2362,7 +2362,7 @@ e1000_release_swfw_sync(struct e1000_hw *hw, u16 mask) ; /* Empty */ swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); - swfw_sync &= ~mask; + swfw_sync &= (u32)~mask; E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); e1000_put_hw_semaphore(hw); diff --git a/sys/dev/e1000/e1000_nvm.c b/sys/dev/e1000/e1000_nvm.c index 7bda1213dde4..95f00e4d681f 100644 --- a/sys/dev/e1000/e1000_nvm.c +++ b/sys/dev/e1000/e1000_nvm.c @@ -578,7 +578,7 @@ s32 e1000_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) } for (i = 0; i < words; i++) { - eerd = ((offset+i) << E1000_NVM_RW_ADDR_SHIFT) + + eerd = ((offset + i) << E1000_NVM_RW_ADDR_SHIFT) + E1000_NVM_RW_REG_START; E1000_WRITE_REG(hw, E1000_EERD, eerd); diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index d73e3a10ae13..d84b6120dd31 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -621,7 +621,7 @@ s32 e1000_write_sfp_data_byte(struct e1000_hw *hw, u16 offset, u8 data) * lane and update whole word */ data_local = i2ccmd & 0xFF00; - data_local |= data; + data_local |= (u32)data; i2ccmd = ((offset << E1000_I2CCMD_REG_ADDR_SHIFT) | E1000_I2CCMD_OPCODE_WRITE | data_local); @@ -3094,6 +3094,7 @@ s32 e1000_determine_phy_address(struct e1000_hw *hw) /** * e1000_get_phy_addr_for_bm_page - Retrieve PHY page address * @page: page to access + * @reg: register to access * * Returns the phy address for the page requested. **/ @@ -3531,6 +3532,7 @@ void e1000_power_down_phy_copper(struct e1000_hw *hw) * @offset: register offset to be read * @data: pointer to the read data * @locked: semaphore has already been acquired or not + * @page_set: BM_WUC_PAGE already set and access enabled * * Acquires semaphore, if necessary, then reads the PHY register at offset * and stores the retrieved information in data. Release any acquired @@ -3641,6 +3643,7 @@ s32 e1000_read_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 *data) * @offset: register offset to write to * @data: data to write at register offset * @locked: semaphore has already been acquired or not + * @page_set: BM_WUC_PAGE already set and access enabled * * Acquires semaphore, if necessary, then writes the data to PHY register * at the offset. Release any acquired semaphores before exiting. From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B22CC6B1DE7; Fri, 24 Sep 2021 01:41: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 4HFvrx3DDkz3Kvp; Fri, 24 Sep 2021 01:41: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 35F915BE3; Fri, 24 Sep 2021 01:41: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 18O1fbCH039409; Fri, 24 Sep 2021 01:41:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1fbQG039408; Fri, 24 Sep 2021 01:41:37 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:37 GMT Message-Id: <202109240141.18O1fbQG039408@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: a93454518e3c - stable/12 - e1000: update for i210 slow system clock 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: a93454518e3c72ea255be72c09133c1a1f648bfb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:37 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a93454518e3c72ea255be72c09133c1a1f648bfb commit a93454518e3c72ea255be72c09133c1a1f648bfb Author: Guinan Sun AuthorDate: 2020-07-06 08:11:56 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:39:19 +0000 e1000: update for i210 slow system clock This code is required for the update for system clock. Signed-off-by: Todd Fujinaka Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (3f0188c8f29847038bc9f306b2570ace57e3811c) MFC after: 1 week (cherry picked from commit 1883a6ff3b2ebaf108c45717c8eb94e0a76bb0b9) --- sys/dev/e1000/e1000_i210.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/dev/e1000/e1000_i210.c b/sys/dev/e1000/e1000_i210.c index 0bdad37e56d3..cd85a8c3172a 100644 --- a/sys/dev/e1000/e1000_i210.c +++ b/sys/dev/e1000/e1000_i210.c @@ -612,6 +612,8 @@ static s32 e1000_pll_workaround_i210(struct e1000_hw *hw) u16 nvm_word, phy_word, pci_word, tmp_nvm; int i; + /* Get PHY semaphore */ + hw->phy.ops.acquire(hw); /* Get and set needed register values */ wuc = E1000_READ_REG(hw, E1000_WUC); mdicnfg = E1000_READ_REG(hw, E1000_MDICNFG); @@ -626,8 +628,11 @@ static s32 e1000_pll_workaround_i210(struct e1000_hw *hw) tmp_nvm = nvm_word | E1000_INVM_PLL_WO_VAL; for (i = 0; i < E1000_MAX_PLL_TRIES; i++) { /* check current state directly from internal PHY */ - e1000_read_phy_reg_gs40g(hw, (E1000_PHY_PLL_FREQ_PAGE | - E1000_PHY_PLL_FREQ_REG), &phy_word); + e1000_write_phy_reg_mdic(hw, GS40G_PAGE_SELECT, 0xFC); + usec_delay(20); + e1000_read_phy_reg_mdic(hw, E1000_PHY_PLL_FREQ_REG, &phy_word); + usec_delay(20); + e1000_write_phy_reg_mdic(hw, GS40G_PAGE_SELECT, 0); if ((phy_word & E1000_PHY_PLL_UNCONF) != E1000_PHY_PLL_UNCONF) { ret_val = E1000_SUCCESS; @@ -661,6 +666,8 @@ static s32 e1000_pll_workaround_i210(struct e1000_hw *hw) } /* restore MDICNFG setting */ E1000_WRITE_REG(hw, E1000_MDICNFG, mdicnfg); + /* Release PHY semaphore */ + hw->phy.ops.release(hw); return ret_val; } From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 905966B210F; Fri, 24 Sep 2021 01:41: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 4HFvrw2Whkz3Kcl; Fri, 24 Sep 2021 01:41: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 1648C5A6D; Fri, 24 Sep 2021 01:41: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 18O1faNj039385; Fri, 24 Sep 2021 01:41:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1fZwv039384; Fri, 24 Sep 2021 01:41:35 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:35 GMT Message-Id: <202109240141.18O1fZwv039384@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: 1d9da96e0f48 - stable/12 - e1000: remove duplicated phy codes 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: 1d9da96e0f48a92b4201082c18ab2f31d71d8bd8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:36 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=1d9da96e0f48a92b4201082c18ab2f31d71d8bd8 commit 1d9da96e0f48a92b4201082c18ab2f31d71d8bd8 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:05 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:39:09 +0000 e1000: remove duplicated phy codes Add two files base.c and base.h to reduce the redundancy in the silicon family code. Remove the code duplication from e1000_82575 files. Clean family specific functions from base. Fix up a stray and duplicate function declaration. Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Neftin Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (44dddd14059f151f39f7e075b887decfc9a10f11) MFC after: 1 week (cherry picked from commit 6b9d35fac12bf657cd1df8f1521c70704ff62b61) --- sys/conf/files | 2 + sys/dev/e1000/e1000_82575.c | 471 ++++++++++++++---------------------------- sys/dev/e1000/e1000_82575.h | 93 +-------- sys/dev/e1000/e1000_api.h | 1 - sys/dev/e1000/e1000_base.c | 221 ++++++++++++++++++++ sys/dev/e1000/e1000_base.h | 158 ++++++++++++++ sys/dev/e1000/e1000_defines.h | 14 +- sys/dev/e1000/e1000_hw.h | 1 + sys/dev/e1000/e1000_i210.c | 2 +- sys/dev/e1000/e1000_regs.h | 23 ++- sys/dev/e1000/if_em.c | 2 +- sys/dev/e1000/igb_txrx.c | 4 +- sys/modules/em/Makefile | 6 +- 13 files changed, 578 insertions(+), 420 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index b014c51127a7..ec54a06e84f1 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1691,6 +1691,8 @@ dev/e1000/e1000_i210.c optional em \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_api.c optional em \ compile-with "${NORMAL_C} -I$S/dev/e1000" +dev/e1000/e1000_base.c optional em \ + compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_mac.c optional em \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_manage.c optional em \ diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index b252a4c7ff1d..172e99b02d5c 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -48,8 +48,6 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw); static s32 e1000_init_mac_params_82575(struct e1000_hw *hw); -static s32 e1000_acquire_phy_82575(struct e1000_hw *hw); -static void e1000_release_phy_82575(struct e1000_hw *hw); static s32 e1000_acquire_nvm_82575(struct e1000_hw *hw); static void e1000_release_nvm_82575(struct e1000_hw *hw); static s32 e1000_check_for_link_82575(struct e1000_hw *hw); @@ -61,6 +59,7 @@ static s32 e1000_phy_hw_reset_sgmii_82575(struct e1000_hw *hw); static s32 e1000_read_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset, u16 *data); static s32 e1000_reset_hw_82575(struct e1000_hw *hw); +static s32 e1000_init_hw_82575(struct e1000_hw *hw); static s32 e1000_reset_hw_82580(struct e1000_hw *hw); static s32 e1000_read_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 *data); @@ -84,10 +83,8 @@ static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, u16 *speed, u16 *duplex); static s32 e1000_get_phy_id_82575(struct e1000_hw *hw); static bool e1000_sgmii_active_82575(struct e1000_hw *hw); -static s32 e1000_reset_init_script_82575(struct e1000_hw *hw); static s32 e1000_read_mac_addr_82575(struct e1000_hw *hw); static void e1000_config_collision_dist_82575(struct e1000_hw *hw); -static void e1000_power_down_phy_copper_82575(struct e1000_hw *hw); static void e1000_shutdown_serdes_link_82575(struct e1000_hw *hw); static void e1000_power_up_serdes_link_82575(struct e1000_hw *hw); static s32 e1000_set_pcie_completion_timeout(struct e1000_hw *hw); @@ -156,8 +153,8 @@ static bool e1000_sgmii_uses_mdio_82575(struct e1000_hw *hw) } /** - * e1000_init_phy_params_82575 - Init PHY func ptrs. - * @hw: pointer to the HW structure + * e1000_init_phy_params_82575 - Initialize PHY function ptrs + * @hw: pointer to the HW structure **/ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) { @@ -175,17 +172,17 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) goto out; } - phy->ops.power_up = e1000_power_up_phy_copper; - phy->ops.power_down = e1000_power_down_phy_copper_82575; + phy->ops.power_up = e1000_power_up_phy_copper; + phy->ops.power_down = e1000_power_down_phy_copper_base; phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; phy->reset_delay_us = 100; - phy->ops.acquire = e1000_acquire_phy_82575; + phy->ops.acquire = e1000_acquire_phy_base; phy->ops.check_reset_block = e1000_check_reset_block_generic; phy->ops.commit = e1000_phy_sw_reset_generic; phy->ops.get_cfg_done = e1000_get_cfg_done_82575; - phy->ops.release = e1000_release_phy_82575; + phy->ops.release = e1000_release_phy_base; ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); @@ -232,76 +229,39 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) case I347AT4_E_PHY_ID: case M88E1112_E_PHY_ID: case M88E1340M_E_PHY_ID: + phy->type = e1000_phy_m88; + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.get_info = e1000_get_phy_info_m88; + phy->ops.get_cable_length = e1000_get_cable_length_m88_gen2; + phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; + break; case M88E1111_I_PHY_ID: phy->type = e1000_phy_m88; phy->ops.check_polarity = e1000_check_polarity_m88; phy->ops.get_info = e1000_get_phy_info_m88; - if (phy->id == I347AT4_E_PHY_ID || - phy->id == M88E1112_E_PHY_ID || - phy->id == M88E1340M_E_PHY_ID) - phy->ops.get_cable_length = - e1000_get_cable_length_m88_gen2; - else if (phy->id == M88E1543_E_PHY_ID || - phy->id == M88E1512_E_PHY_ID) - phy->ops.get_cable_length = - e1000_get_cable_length_m88_gen2; - else - phy->ops.get_cable_length = e1000_get_cable_length_m88; + phy->ops.get_cable_length = e1000_get_cable_length_m88; phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; - /* Check if this PHY is confgured for media swap. */ - if (phy->id == M88E1112_E_PHY_ID) { - u16 data; - - ret_val = phy->ops.write_reg(hw, - E1000_M88E1112_PAGE_ADDR, - 2); - if (ret_val) - goto out; - - ret_val = phy->ops.read_reg(hw, - E1000_M88E1112_MAC_CTRL_1, - &data); - if (ret_val) - goto out; - - data = (data & E1000_M88E1112_MAC_CTRL_1_MODE_MASK) >> - E1000_M88E1112_MAC_CTRL_1_MODE_SHIFT; - if (data == E1000_M88E1112_AUTO_COPPER_SGMII || - data == E1000_M88E1112_AUTO_COPPER_BASEX) - hw->mac.ops.check_for_link = - e1000_check_for_link_media_swap; - } - if (phy->id == M88E1512_E_PHY_ID) { - ret_val = e1000_initialize_M88E1512_phy(hw); - if (ret_val) - goto out; - } - if (phy->id == M88E1543_E_PHY_ID) { - ret_val = e1000_initialize_M88E1543_phy(hw); - if (ret_val) - goto out; - } break; case IGP03E1000_E_PHY_ID: case IGP04E1000_E_PHY_ID: - phy->type = e1000_phy_igp_3; - phy->ops.check_polarity = e1000_check_polarity_igp; - phy->ops.get_info = e1000_get_phy_info_igp; + phy->type = e1000_phy_igp_3; + phy->ops.check_polarity = e1000_check_polarity_igp; + phy->ops.get_info = e1000_get_phy_info_igp; phy->ops.get_cable_length = e1000_get_cable_length_igp_2; - phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_igp; phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82575; phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; + phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_igp; break; case I82580_I_PHY_ID: case I350_I_PHY_ID: - phy->type = e1000_phy_82580; - phy->ops.check_polarity = e1000_check_polarity_82577; - phy->ops.force_speed_duplex = - e1000_phy_force_speed_duplex_82577; + phy->type = e1000_phy_82580; + phy->ops.check_polarity = e1000_check_polarity_82577; + phy->ops.get_info = e1000_get_phy_info_82577; phy->ops.get_cable_length = e1000_get_cable_length_82577; - phy->ops.get_info = e1000_get_phy_info_82577; phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82580; phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_82580; + phy->ops.force_speed_duplex = + e1000_phy_force_speed_duplex_82577; break; case I210_I_PHY_ID: phy->type = e1000_phy_i210; @@ -317,98 +277,49 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) goto out; } -out: - return ret_val; -} - -/** - * e1000_init_nvm_params_82575 - Init NVM func ptrs. - * @hw: pointer to the HW structure - **/ -s32 e1000_init_nvm_params_82575(struct e1000_hw *hw) -{ - struct e1000_nvm_info *nvm = &hw->nvm; - u32 eecd = E1000_READ_REG(hw, E1000_EECD); - u16 size; - - DEBUGFUNC("e1000_init_nvm_params_82575"); - - size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> - E1000_EECD_SIZE_EX_SHIFT); - /* - * Added to a constant, "size" becomes the left-shift value - * for setting word_size. - */ - size += NVM_WORD_SIZE_BASE_SHIFT; - - /* Just in case size is out of range, cap it to the largest - * EEPROM size supported - */ - if (size > 15) - size = 15; - - nvm->word_size = 1 << size; - if (hw->mac.type < e1000_i210) { - nvm->opcode_bits = 8; - nvm->delay_usec = 1; + /* Check if this PHY is configured for media swap. */ + switch (phy->id) { + case M88E1112_E_PHY_ID: + { + u16 data; - switch (nvm->override) { - case e1000_nvm_override_spi_large: - nvm->page_size = 32; - nvm->address_bits = 16; - break; - case e1000_nvm_override_spi_small: - nvm->page_size = 8; - nvm->address_bits = 8; - break; - default: - nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; - nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? - 16 : 8; - break; - } - if (nvm->word_size == (1 << 15)) - nvm->page_size = 128; + ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 2); + if (ret_val) + goto out; + ret_val = phy->ops.read_reg(hw, E1000_M88E1112_MAC_CTRL_1, + &data); + if (ret_val) + goto out; - nvm->type = e1000_nvm_eeprom_spi; - } else { - nvm->type = e1000_nvm_flash_hw; + data = (data & E1000_M88E1112_MAC_CTRL_1_MODE_MASK) >> + E1000_M88E1112_MAC_CTRL_1_MODE_SHIFT; + if (data == E1000_M88E1112_AUTO_COPPER_SGMII || + data == E1000_M88E1112_AUTO_COPPER_BASEX) + hw->mac.ops.check_for_link = + e1000_check_for_link_media_swap; + break; } - - /* Function Pointers */ - nvm->ops.acquire = e1000_acquire_nvm_82575; - nvm->ops.release = e1000_release_nvm_82575; - if (nvm->word_size < (1 << 15)) - nvm->ops.read = e1000_read_nvm_eerd; - else - nvm->ops.read = e1000_read_nvm_spi; - - nvm->ops.write = e1000_write_nvm_spi; - nvm->ops.validate = e1000_validate_nvm_checksum_generic; - nvm->ops.update = e1000_update_nvm_checksum_generic; - nvm->ops.valid_led_default = e1000_valid_led_default_82575; - - /* override generic family function pointers for specific descendants */ - switch (hw->mac.type) { - case e1000_82580: - nvm->ops.validate = e1000_validate_nvm_checksum_82580; - nvm->ops.update = e1000_update_nvm_checksum_82580; + case M88E1512_E_PHY_ID: + { + ret_val = e1000_initialize_M88E1512_phy(hw); break; - case e1000_i350: - case e1000_i354: - nvm->ops.validate = e1000_validate_nvm_checksum_i350; - nvm->ops.update = e1000_update_nvm_checksum_i350; + } + case M88E1543_E_PHY_ID: + { + ret_val = e1000_initialize_M88E1543_phy(hw); break; + } default: - break; + goto out; } - return E1000_SUCCESS; +out: + return ret_val; } /** - * e1000_init_mac_params_82575 - Init MAC func ptrs. - * @hw: pointer to the HW structure + * e1000_init_mac_params_82575 - Init MAC func ptrs. + * @hw: pointer to the HW structure **/ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) { @@ -417,13 +328,16 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) DEBUGFUNC("e1000_init_mac_params_82575"); + /* Initialize function pointer */ + e1000_init_mac_ops_generic(hw); + /* Derives media type */ e1000_get_media_type_82575(hw); - /* Set mta register count */ + /* Set MTA register count */ mac->mta_reg_count = 128; - /* Set uta register count */ + /* Set UTA register count */ mac->uta_reg_count = (hw->mac.type == e1000_82575) ? 0 : 128; - /* Set rar entry count */ + /* Set RAR entry count */ mac->rar_entry_count = E1000_RAR_ENTRIES_82575; if (mac->type == e1000_82576) mac->rar_entry_count = E1000_RAR_ENTRIES_82576; @@ -456,8 +370,8 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) if (mac->type >= e1000_82580) mac->ops.reset_hw = e1000_reset_hw_82580; else - mac->ops.reset_hw = e1000_reset_hw_82575; - /* hw initialization */ + mac->ops.reset_hw = e1000_reset_hw_82575; + /* HW initialization */ if ((mac->type == e1000_i210) || (mac->type == e1000_i211)) mac->ops.init_hw = e1000_init_hw_i210; else @@ -493,7 +407,7 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) } if (hw->mac.type >= e1000_82580) mac->ops.validate_mdi_setting = - e1000_validate_mdi_setting_crossover_generic; + e1000_validate_mdi_setting_crossover_generic; /* ID LED init */ mac->ops.id_led_init = e1000_id_led_init_generic; /* blink LED */ @@ -511,6 +425,7 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) mac->ops.get_link_up_info = e1000_get_link_up_info_82575; /* acquire SW_FW sync */ mac->ops.acquire_swfw_sync = e1000_acquire_swfw_sync; + /* release SW_FW sync */ mac->ops.release_swfw_sync = e1000_release_swfw_sync; /* set lan id for port to determine which phy lock to use */ @@ -520,63 +435,102 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) } /** - * e1000_init_function_pointers_82575 - Init func ptrs. - * @hw: pointer to the HW structure - * - * Called to initialize all function pointers and parameters. + * e1000_init_nvm_params_82575 - Initialize NVM function ptrs + * @hw: pointer to the HW structure **/ -void e1000_init_function_pointers_82575(struct e1000_hw *hw) +s32 e1000_init_nvm_params_82575(struct e1000_hw *hw) { - DEBUGFUNC("e1000_init_function_pointers_82575"); + struct e1000_nvm_info *nvm = &hw->nvm; + u32 eecd = E1000_READ_REG(hw, E1000_EECD); + u16 size; - hw->mac.ops.init_params = e1000_init_mac_params_82575; - hw->nvm.ops.init_params = e1000_init_nvm_params_82575; - hw->phy.ops.init_params = e1000_init_phy_params_82575; - hw->mbx.ops.init_params = e1000_init_mbx_params_pf; -} + DEBUGFUNC("e1000_init_nvm_params_82575"); -/** - * e1000_acquire_phy_82575 - Acquire rights to access PHY - * @hw: pointer to the HW structure - * - * Acquire access rights to the correct PHY. - **/ -static s32 e1000_acquire_phy_82575(struct e1000_hw *hw) -{ - u16 mask = E1000_SWFW_PHY0_SM; + size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> + E1000_EECD_SIZE_EX_SHIFT); + /* Added to a constant, "size" becomes the left-shift value + * for setting word_size. + */ + size += NVM_WORD_SIZE_BASE_SHIFT; - DEBUGFUNC("e1000_acquire_phy_82575"); + /* Just in case size is out of range, cap it to the largest + * EEPROM size supported + */ + if (size > 15) + size = 15; - if (hw->bus.func == E1000_FUNC_1) - mask = E1000_SWFW_PHY1_SM; - else if (hw->bus.func == E1000_FUNC_2) - mask = E1000_SWFW_PHY2_SM; - else if (hw->bus.func == E1000_FUNC_3) - mask = E1000_SWFW_PHY3_SM; + nvm->word_size = 1 << size; + if (hw->mac.type < e1000_i210) { + nvm->opcode_bits = 8; + nvm->delay_usec = 1; + + switch (nvm->override) { + case e1000_nvm_override_spi_large: + nvm->page_size = 32; + nvm->address_bits = 16; + break; + case e1000_nvm_override_spi_small: + nvm->page_size = 8; + nvm->address_bits = 8; + break; + default: + nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; + nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? + 16 : 8; + break; + } + if (nvm->word_size == (1 << 15)) + nvm->page_size = 128; + + nvm->type = e1000_nvm_eeprom_spi; + } else { + nvm->type = e1000_nvm_flash_hw; + } + + /* Function Pointers */ + nvm->ops.acquire = e1000_acquire_nvm_82575; + nvm->ops.release = e1000_release_nvm_82575; + if (nvm->word_size < (1 << 15)) + nvm->ops.read = e1000_read_nvm_eerd; + else + nvm->ops.read = e1000_read_nvm_spi; + + nvm->ops.write = e1000_write_nvm_spi; + nvm->ops.validate = e1000_validate_nvm_checksum_generic; + nvm->ops.update = e1000_update_nvm_checksum_generic; + nvm->ops.valid_led_default = e1000_valid_led_default_82575; + + /* override generic family function pointers for specific descendants */ + switch (hw->mac.type) { + case e1000_82580: + nvm->ops.validate = e1000_validate_nvm_checksum_82580; + nvm->ops.update = e1000_update_nvm_checksum_82580; + break; + case e1000_i350: + nvm->ops.validate = e1000_validate_nvm_checksum_i350; + nvm->ops.update = e1000_update_nvm_checksum_i350; + break; + default: + break; + } - return hw->mac.ops.acquire_swfw_sync(hw, mask); + return E1000_SUCCESS; } /** - * e1000_release_phy_82575 - Release rights to access PHY + * e1000_init_function_pointers_82575 - Init func ptrs. * @hw: pointer to the HW structure * - * A wrapper to release access rights to the correct PHY. + * Called to initialize all function pointers and parameters. **/ -static void e1000_release_phy_82575(struct e1000_hw *hw) +void e1000_init_function_pointers_82575(struct e1000_hw *hw) { - u16 mask = E1000_SWFW_PHY0_SM; - - DEBUGFUNC("e1000_release_phy_82575"); - - if (hw->bus.func == E1000_FUNC_1) - mask = E1000_SWFW_PHY1_SM; - else if (hw->bus.func == E1000_FUNC_2) - mask = E1000_SWFW_PHY2_SM; - else if (hw->bus.func == E1000_FUNC_3) - mask = E1000_SWFW_PHY3_SM; + DEBUGFUNC("e1000_init_function_pointers_82575"); - hw->mac.ops.release_swfw_sync(hw, mask); + hw->mac.ops.init_params = e1000_init_mac_params_82575; + hw->nvm.ops.init_params = e1000_init_nvm_params_82575; + hw->phy.ops.init_params = e1000_init_phy_params_82575; + hw->mbx.ops.init_params = e1000_init_mbx_params_pf; } /** @@ -1401,16 +1355,15 @@ static s32 e1000_reset_hw_82575(struct e1000_hw *hw) } /** - * e1000_init_hw_82575 - Initialize hardware - * @hw: pointer to the HW structure + * e1000_init_hw_82575 - Initialize hardware + * @hw: pointer to the HW structure * - * This inits the hardware readying it for operation. + * This inits the hardware readying it for operation. **/ -s32 e1000_init_hw_82575(struct e1000_hw *hw) +STATIC s32 e1000_init_hw_82575(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; s32 ret_val; - u16 i, rar_count = mac->rar_entry_count; DEBUGFUNC("e1000_init_hw_82575"); @@ -1425,27 +1378,12 @@ s32 e1000_init_hw_82575(struct e1000_hw *hw) DEBUGOUT("Initializing the IEEE VLAN\n"); mac->ops.clear_vfta(hw); - /* Setup the receive address */ - e1000_init_rx_addrs_generic(hw, rar_count); - - /* Zero out the Multicast HASH table */ - DEBUGOUT("Zeroing the MTA\n"); - for (i = 0; i < mac->mta_reg_count; i++) - E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); - - /* Zero out the Unicast HASH table */ - DEBUGOUT("Zeroing the UTA\n"); - for (i = 0; i < mac->uta_reg_count; i++) - E1000_WRITE_REG_ARRAY(hw, E1000_UTA, i, 0); - - /* Setup link and flow control */ - ret_val = mac->ops.setup_link(hw); + ret_val = e1000_init_hw_base(hw); /* Set the default MTU size */ hw->dev_spec._82575.mtu = 1500; - /* - * Clear all of the statistics registers (clear on read). It is + /* Clear all of the statistics registers (clear on read). It is * important that we do this after we have tried to establish link * because the symbol error count will increment wildly if there * is no link. @@ -1454,7 +1392,6 @@ s32 e1000_init_hw_82575(struct e1000_hw *hw) return ret_val; } - /** * e1000_setup_copper_link_82575 - Configure copper link settings * @hw: pointer to the HW structure @@ -1465,9 +1402,9 @@ s32 e1000_init_hw_82575(struct e1000_hw *hw) **/ static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw) { + u32 phpm_reg; u32 ctrl; s32 ret_val; - u32 phpm_reg; DEBUGFUNC("e1000_setup_copper_link_82575"); @@ -1889,7 +1826,7 @@ static bool e1000_sgmii_active_82575(struct e1000_hw *hw) * Inits recommended HW defaults after a reset when there is no EEPROM * detected. This is only for the 82575. **/ -static s32 e1000_reset_init_script_82575(struct e1000_hw *hw) +s32 e1000_reset_init_script_82575(struct e1000_hw *hw) { DEBUGFUNC("e1000_reset_init_script_82575"); @@ -1967,27 +1904,6 @@ static void e1000_config_collision_dist_82575(struct e1000_hw *hw) E1000_WRITE_FLUSH(hw); } -/** - * e1000_power_down_phy_copper_82575 - Remove link during PHY power down - * @hw: pointer to the HW structure - * - * In the case of a PHY power down to save power, or to turn off link during a - * driver unload, or wake on lan is not enabled, remove the link. - **/ -static void e1000_power_down_phy_copper_82575(struct e1000_hw *hw) -{ - struct e1000_phy_info *phy = &hw->phy; - - if (!(phy->ops.check_reset_block)) - return; - - /* If the management interface is not enabled, then power down */ - if (!(e1000_enable_mng_pass_thru(hw) || phy->ops.check_reset_block(hw))) - e1000_power_down_phy_copper(hw); - - return; -} - /** * e1000_clear_hw_cntrs_82575 - Clear device specific hardware counters * @hw: pointer to the HW structure @@ -2053,85 +1969,6 @@ static void e1000_clear_hw_cntrs_82575(struct e1000_hw *hw) E1000_READ_REG(hw, E1000_SCVPC); } -/** - * e1000_rx_fifo_flush_82575 - Clean rx fifo after Rx enable - * @hw: pointer to the HW structure - * - * After Rx enable, if manageability is enabled then there is likely some - * bad data at the start of the fifo and possibly in the DMA fifo. This - * function clears the fifos and flushes any packets that came in as rx was - * being enabled. - **/ -void e1000_rx_fifo_flush_82575(struct e1000_hw *hw) -{ - u32 rctl, rlpml, rxdctl[4], rfctl, temp_rctl, rx_enabled; - int i, ms_wait; - - DEBUGFUNC("e1000_rx_fifo_flush_82575"); - - /* disable IPv6 options as per hardware errata */ - rfctl = E1000_READ_REG(hw, E1000_RFCTL); - rfctl |= E1000_RFCTL_IPV6_EX_DIS; - E1000_WRITE_REG(hw, E1000_RFCTL, rfctl); - - if (hw->mac.type != e1000_82575 || - !(E1000_READ_REG(hw, E1000_MANC) & E1000_MANC_RCV_TCO_EN)) - return; - - /* Disable all Rx queues */ - for (i = 0; i < 4; i++) { - rxdctl[i] = E1000_READ_REG(hw, E1000_RXDCTL(i)); - E1000_WRITE_REG(hw, E1000_RXDCTL(i), - rxdctl[i] & ~E1000_RXDCTL_QUEUE_ENABLE); - } - /* Poll all queues to verify they have shut down */ - for (ms_wait = 0; ms_wait < 10; ms_wait++) { - msec_delay(1); - rx_enabled = 0; - for (i = 0; i < 4; i++) - rx_enabled |= E1000_READ_REG(hw, E1000_RXDCTL(i)); - if (!(rx_enabled & E1000_RXDCTL_QUEUE_ENABLE)) - break; - } - - if (ms_wait == 10) - DEBUGOUT("Queue disable timed out after 10ms\n"); - - /* Clear RLPML, RCTL.SBP, RFCTL.LEF, and set RCTL.LPE so that all - * incoming packets are rejected. Set enable and wait 2ms so that - * any packet that was coming in as RCTL.EN was set is flushed - */ - E1000_WRITE_REG(hw, E1000_RFCTL, rfctl & ~E1000_RFCTL_LEF); - - rlpml = E1000_READ_REG(hw, E1000_RLPML); - E1000_WRITE_REG(hw, E1000_RLPML, 0); - - rctl = E1000_READ_REG(hw, E1000_RCTL); - temp_rctl = rctl & ~(E1000_RCTL_EN | E1000_RCTL_SBP); - temp_rctl |= E1000_RCTL_LPE; - - E1000_WRITE_REG(hw, E1000_RCTL, temp_rctl); - E1000_WRITE_REG(hw, E1000_RCTL, temp_rctl | E1000_RCTL_EN); - E1000_WRITE_FLUSH(hw); - msec_delay(2); - - /* Enable Rx queues that were previously enabled and restore our - * previous state - */ - for (i = 0; i < 4; i++) - E1000_WRITE_REG(hw, E1000_RXDCTL(i), rxdctl[i]); - E1000_WRITE_REG(hw, E1000_RCTL, rctl); - E1000_WRITE_FLUSH(hw); - - E1000_WRITE_REG(hw, E1000_RLPML, rlpml); - E1000_WRITE_REG(hw, E1000_RFCTL, rfctl); - - /* Flush receive errors generated by workaround */ - E1000_READ_REG(hw, E1000_ROC); - E1000_READ_REG(hw, E1000_RNBC); - E1000_READ_REG(hw, E1000_MPC); -} - /** * e1000_set_pcie_completion_timeout - set pci-e completion timeout * @hw: pointer to the HW structure diff --git a/sys/dev/e1000/e1000_82575.h b/sys/dev/e1000/e1000_82575.h index 22c2f8c4a2f5..d6665bfe64dd 100644 --- a/sys/dev/e1000/e1000_82575.h +++ b/sys/dev/e1000/e1000_82575.h @@ -56,9 +56,7 @@ #define E1000_RAR_ENTRIES_I350 32 #define E1000_SW_SYNCH_MB 0x00000100 #define E1000_STAT_DEV_RST_SET 0x00100000 -#define E1000_CTRL_DEV_RST 0x20000000 -#ifdef E1000_BIT_FIELDS struct e1000_adv_data_desc { __le64 buffer_addr; /* Address of the descriptor's data buffer */ union { @@ -121,7 +119,6 @@ struct e1000_adv_context_desc { } fields; } l4_setup; }; -#endif /* SRRCTL bit definitions */ #define E1000_SRRCTL_BSIZEPKT_SHIFT 10 /* Shift _right_ */ @@ -181,46 +178,12 @@ struct e1000_adv_context_desc { /* Immediate Interrupt Rx (A.K.A. Low Latency Interrupt) */ #define E1000_IMIR_PORT_IM_EN 0x00010000 /* TCP port enable */ #define E1000_IMIR_PORT_BP 0x00020000 /* TCP port check bypass */ -#define E1000_IMIREXT_SIZE_BP 0x00001000 /* Packet size bypass */ #define E1000_IMIREXT_CTRL_URG 0x00002000 /* Check URG bit in header */ #define E1000_IMIREXT_CTRL_ACK 0x00004000 /* Check ACK bit in header */ #define E1000_IMIREXT_CTRL_PSH 0x00008000 /* Check PSH bit in header */ #define E1000_IMIREXT_CTRL_RST 0x00010000 /* Check RST bit in header */ #define E1000_IMIREXT_CTRL_SYN 0x00020000 /* Check SYN bit in header */ #define E1000_IMIREXT_CTRL_FIN 0x00040000 /* Check FIN bit in header */ -#define E1000_IMIREXT_CTRL_BP 0x00080000 /* Bypass check of ctrl bits */ - -/* Receive Descriptor - Advanced */ -union e1000_adv_rx_desc { - struct { - __le64 pkt_addr; /* Packet buffer address */ - __le64 hdr_addr; /* Header buffer address */ - } read; - struct { - struct { - union { - __le32 data; - struct { - __le16 pkt_info; /*RSS type, Pkt type*/ - /* Split Header, header buffer len */ - __le16 hdr_info; - } hs_rss; - } lo_dword; - union { - __le32 rss; /* RSS Hash */ - struct { - __le16 ip_id; /* IP id */ - __le16 csum; /* Packet Checksum */ - } csum_ip; - } hi_dword; - } lower; - struct { - __le32 status_error; /* ext status/error */ - __le16 length; /* Packet length */ - __le16 vlan; /* VLAN tag */ - } upper; - } wb; /* writeback */ -}; #define E1000_RXDADV_RSSTYPE_MASK 0x0000000F #define E1000_RXDADV_RSSTYPE_SHIFT 12 @@ -229,7 +192,6 @@ union e1000_adv_rx_desc { #define E1000_RXDADV_SPLITHEADER_EN 0x00001000 #define E1000_RXDADV_SPH 0x8000 #define E1000_RXDADV_STAT_TS 0x10000 /* Pkt was time stamped */ -#define E1000_RXDADV_STAT_TSIP 0x08000 /* timestamp in packet */ #define E1000_RXDADV_ERR_HBO 0x00800000 /* RSS Hash results */ @@ -278,20 +240,6 @@ union e1000_adv_rx_desc { #define E1000_RXDADV_IPSEC_ERROR_INVALID_LENGTH 0x10000000 #define E1000_RXDADV_IPSEC_ERROR_AUTHENTICATION_FAILED 0x18000000 -/* Transmit Descriptor - Advanced */ -union e1000_adv_tx_desc { - struct { - __le64 buffer_addr; /* Address of descriptor's data buf */ - __le32 cmd_type_len; - __le32 olinfo_status; - } read; - struct { - __le64 rsvd; /* Reserved */ - __le32 nxtseq_seed; - __le32 status; - } wb; -}; - /* Adv Transmit Descriptor Config Masks */ #define E1000_ADVTXD_DTYP_CTXT 0x00200000 /* Advanced Context Descriptor */ #define E1000_ADVTXD_DTYP_DATA 0x00300000 /* Advanced Data Descriptor */ @@ -314,33 +262,6 @@ union e1000_adv_tx_desc { #define E1000_ADVTXD_POPTS_IPSEC 0x00000400 /* IPSec offload request */ #define E1000_ADVTXD_PAYLEN_SHIFT 14 /* Adv desc PAYLEN shift */ -/* Context descriptors */ -struct e1000_adv_tx_context_desc { - __le32 vlan_macip_lens; - __le32 seqnum_seed; - __le32 type_tucmd_mlhl; - __le32 mss_l4len_idx; -}; - -#define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */ -#define E1000_ADVTXD_VLAN_SHIFT 16 /* Adv ctxt vlan tag shift */ -#define E1000_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type: 1=IPv4 */ -#define E1000_ADVTXD_TUCMD_IPV6 0x00000000 /* IP Packet Type: 0=IPv6 */ -#define E1000_ADVTXD_TUCMD_L4T_UDP 0x00000000 /* L4 Packet TYPE of UDP */ -#define E1000_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */ -#define E1000_ADVTXD_TUCMD_L4T_SCTP 0x00001000 /* L4 Packet TYPE of SCTP */ -#define E1000_ADVTXD_TUCMD_IPSEC_TYPE_ESP 0x00002000 /* IPSec Type ESP */ -/* IPSec Encrypt Enable for ESP */ -#define E1000_ADVTXD_TUCMD_IPSEC_ENCRYPT_EN 0x00004000 -/* Req requires Markers and CRC */ -#define E1000_ADVTXD_TUCMD_MKRREQ 0x00002000 -#define E1000_ADVTXD_L4LEN_SHIFT 8 /* Adv ctxt L4LEN shift */ -#define E1000_ADVTXD_MSS_SHIFT 16 /* Adv ctxt MSS shift */ -/* Adv ctxt IPSec SA IDX mask */ -#define E1000_ADVTXD_IPSEC_SA_INDEX_MASK 0x000000FF -/* Adv ctxt IPSec ESP len mask */ -#define E1000_ADVTXD_IPSEC_ESP_LEN_MASK 0x000000FF - /* Additional Transmit Descriptor Control definitions */ #define E1000_TXDCTL_QUEUE_ENABLE 0x02000000 /* Ena specific Tx Queue */ #define E1000_TXDCTL_SWFLSH 0x04000000 /* Tx Desc. wbk flushing */ @@ -380,11 +301,6 @@ struct e1000_adv_tx_context_desc { #define E1000_IMS_LSECPNS E1000_ICR_LSECPNS /* PN threshold - server */ #define E1000_ICS_LSECPNS E1000_ICR_LSECPNS /* PN threshold - server */ -/* ETQF register bit definitions */ -#define E1000_ETQF_FILTER_ENABLE (1 << 26) -#define E1000_ETQF_IMM_INT (1 << 29) -#define E1000_ETQF_1588 (1 << 30) -#define E1000_ETQF_QUEUE_ENABLE (1U << 31) /* * ETQF filter list: one static filter per filter consumer. This is * to avoid filter collisions later. Add new filters @@ -395,10 +311,6 @@ struct e1000_adv_tx_context_desc { */ #define E1000_ETQF_FILTER_EAPOL 0 -#define E1000_FTQF_VF_BP 0x00008000 -#define E1000_FTQF_1588_TIME_STAMP 0x08000000 -#define E1000_FTQF_MASK 0xF0000000 -#define E1000_FTQF_MASK_PROTO_BP 0x10000000 #define E1000_FTQF_MASK_SOURCE_ADDR_BP 0x20000000 #define E1000_FTQF_MASK_DEST_ADDR_BP 0x40000000 #define E1000_FTQF_MASK_SOURCE_PORT_BP 0x80000000 @@ -474,13 +386,14 @@ struct e1000_adv_tx_context_desc { #define ALL_QUEUES 0xFFFF +s32 e1000_reset_init_script_82575(struct e1000_hw *hw); +s32 e1000_init_nvm_params_82575(struct e1000_hw *hw); + /* Rx packet buffer size defines */ #define E1000_RXPBS_SIZE_MASK_82576 0x0000007F void e1000_vmdq_set_loopback_pf(struct e1000_hw *hw, bool enable); void e1000_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf); void e1000_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable); -s32 e1000_init_nvm_params_82575(struct e1000_hw *hw); -s32 e1000_init_hw_82575(struct e1000_hw *hw); enum e1000_promisc_type { e1000_promisc_disabled = 0, /* all promisc modes disabled */ diff --git a/sys/dev/e1000/e1000_api.h b/sys/dev/e1000/e1000_api.h index 7e052910e7d0..db4caac37e97 100644 --- a/sys/dev/e1000/e1000_api.h +++ b/sys/dev/e1000/e1000_api.h @@ -46,7 +46,6 @@ extern void e1000_init_function_pointers_82541(struct e1000_hw *hw); extern void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw); extern void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw); extern void e1000_init_function_pointers_82575(struct e1000_hw *hw); -extern void e1000_rx_fifo_flush_82575(struct e1000_hw *hw); extern void e1000_init_function_pointers_vf(struct e1000_hw *hw); extern void e1000_power_up_fiber_serdes_link(struct e1000_hw *hw); extern void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw); diff --git a/sys/dev/e1000/e1000_base.c b/sys/dev/e1000/e1000_base.c new file mode 100644 index 000000000000..e12a5fbecf25 --- /dev/null +++ b/sys/dev/e1000/e1000_base.c @@ -0,0 +1,221 @@ +/****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause + + Copyright (c) 2001-2020, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. + +******************************************************************************/ +/*$FreeBSD$*/ + +#include "e1000_hw.h" +#include "e1000_82575.h" +#include "e1000_mac.h" +#include "e1000_base.h" +#include "e1000_manage.h" + +/** + * e1000_acquire_phy_base - Acquire rights to access PHY + * @hw: pointer to the HW structure + * + * Acquire access rights to the correct PHY. + **/ +s32 e1000_acquire_phy_base(struct e1000_hw *hw) +{ + u16 mask = E1000_SWFW_PHY0_SM; + + DEBUGFUNC("e1000_acquire_phy_base"); + + if (hw->bus.func == E1000_FUNC_1) + mask = E1000_SWFW_PHY1_SM; + else if (hw->bus.func == E1000_FUNC_2) + mask = E1000_SWFW_PHY2_SM; + else if (hw->bus.func == E1000_FUNC_3) + mask = E1000_SWFW_PHY3_SM; + + return hw->mac.ops.acquire_swfw_sync(hw, mask); +} + +/** + * e1000_release_phy_base - Release rights to access PHY *** 510 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD57C6B2098; Fri, 24 Sep 2021 01:41: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 4HFvrv34Njz3KZk; Fri, 24 Sep 2021 01:41: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 E03055AE8; Fri, 24 Sep 2021 01:41: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 18O1fYIF039361; Fri, 24 Sep 2021 01:41:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1fYU6039360; Fri, 24 Sep 2021 01:41:34 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:34 GMT Message-Id: <202109240141.18O1fYU6039360@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: 666848af5fb1 - stable/12 - e1000: modify HW level time sync mechanisms 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: 666848af5fb13cbcacc596738cc2f2524f0a47ec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:36 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=666848af5fb13cbcacc596738cc2f2524f0a47ec commit 666848af5fb13cbcacc596738cc2f2524f0a47ec Author: Guinan Sun AuthorDate: 2020-07-06 08:12:04 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:39:03 +0000 e1000: modify HW level time sync mechanisms Add additional configuration space access to allow HW level time sync mechanism. Signed-off-by: Evgeny Efimov Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (d53391f1fe2e0eba8818517fdf285f893d95dcc8) MFC after: 1 week (cherry picked from commit d50f362b505e9026fbd33d00dc43e09cac26a209) --- sys/dev/e1000/e1000_ich8lan.c | 18 ++++++++++++++++++ sys/dev/e1000/e1000_ich8lan.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 4af7c73a0b0c..4074eb68198c 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -4963,6 +4963,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) u16 kum_cfg; u32 ctrl, reg; s32 ret_val; + u16 pci_cfg; DEBUGFUNC("e1000_reset_hw_ich8lan"); @@ -5023,11 +5024,28 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) e1000_gate_hw_phy_config_ich8lan(hw, TRUE); } ret_val = e1000_acquire_swflag_ich8lan(hw); + + /* Read from EXTCNF_CTRL in e1000_acquire_swflag_ich8lan function + * may occur during global reset and cause system hang. + * Configuration space access creates the needed delay. + * Write to E1000_STRAP RO register E1000_PCI_VENDOR_ID_REGISTER value + * insures configuration space read is done before global reset. + */ + e1000_read_pci_cfg(hw, E1000_PCI_VENDOR_ID_REGISTER, &pci_cfg); + E1000_WRITE_REG(hw, E1000_STRAP, pci_cfg); DEBUGOUT("Issuing a global reset to ich8lan\n"); E1000_WRITE_REG(hw, E1000_CTRL, (ctrl | E1000_CTRL_RST)); /* cannot issue a flush here because it hangs the hardware */ msec_delay(20); + /* Configuration space access improve HW level time sync mechanism. + * Write to E1000_STRAP RO register E1000_PCI_VENDOR_ID_REGISTER + * value to insure configuration space read is done + * before any access to mac register. + */ + e1000_read_pci_cfg(hw, E1000_PCI_VENDOR_ID_REGISTER, &pci_cfg); + E1000_WRITE_REG(hw, E1000_STRAP, pci_cfg); + /* Set Phy Config Counter to 50msec */ if (hw->mac.type == e1000_pch2lan) { reg = E1000_READ_REG(hw, E1000_FEXTNVM3); diff --git a/sys/dev/e1000/e1000_ich8lan.h b/sys/dev/e1000/e1000_ich8lan.h index a467e647636f..12f912ebc6e0 100644 --- a/sys/dev/e1000/e1000_ich8lan.h +++ b/sys/dev/e1000/e1000_ich8lan.h @@ -327,6 +327,8 @@ #define E1000_SVCR_OFF_TIMER_SHIFT 16 #define E1000_SVT_OFF_HWM_MASK 0x0000001F +#define E1000_PCI_VENDOR_ID_REGISTER 0x00 + void e1000_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw, bool state); void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw); From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B05F6B1F70; Fri, 24 Sep 2021 01:41: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 4HFvrz5qNWz3Kjn; Fri, 24 Sep 2021 01:41:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F4615A71; Fri, 24 Sep 2021 01:41:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18O1fdUi039457; Fri, 24 Sep 2021 01:41:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1fdlh039456; Fri, 24 Sep 2021 01:41:39 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:39 GMT Message-Id: <202109240141.18O1fdlh039456@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: 8ee52cd01975 - stable/12 - e1000: add PCIm function state 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: 8ee52cd01975207265eafb19189918d71d86f255 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:40 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=8ee52cd01975207265eafb19189918d71d86f255 commit 8ee52cd01975207265eafb19189918d71d86f255 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:07 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:39:29 +0000 e1000: add PCIm function state Added define to pcim function state. Signed-off-by: Vitaly Lifshits Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (7ee1a3b273c7f321b50e6ba17c3d9537b1b08347) MFC after: 1 week (cherry picked from commit a6f0cc373f0afc24c9c27bbba45a6a7a3ac268d1) --- sys/dev/e1000/e1000_defines.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/e1000/e1000_defines.h b/sys/dev/e1000/e1000_defines.h index 512e0da52904..d3aba827c3b5 100644 --- a/sys/dev/e1000/e1000_defines.h +++ b/sys/dev/e1000/e1000_defines.h @@ -346,6 +346,7 @@ #define E1000_STATUS_PCIX_SPEED_66 0x00000000 /* PCI-X bus spd 50-66MHz */ #define E1000_STATUS_PCIX_SPEED_100 0x00004000 /* PCI-X bus spd 66-100MHz */ #define E1000_STATUS_PCIX_SPEED_133 0x00008000 /* PCI-X bus spd 100-133MHz*/ +#define E1000_STATUS_PCIM_STATE 0x40000000 /* PCIm function state */ #define SPEED_10 10 #define SPEED_100 100 From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 513626B202A; Fri, 24 Sep 2021 01:41: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 4HFvrr5wfxz3KjB; Fri, 24 Sep 2021 01:41: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 9F9235AE5; Fri, 24 Sep 2021 01:41: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 18O1fWmg039307; Fri, 24 Sep 2021 01:41:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1fWGI039306; Fri, 24 Sep 2021 01:41:32 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:32 GMT Message-Id: <202109240141.18O1fWGI039306@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: bb436434ee0d - stable/12 - e1000: add function parameter descriptions 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: bb436434ee0d8643a061cc2f03c7d2e893be7aad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:33 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=bb436434ee0d8643a061cc2f03c7d2e893be7aad commit bb436434ee0d8643a061cc2f03c7d2e893be7aad Author: Guinan Sun AuthorDate: 2020-07-06 08:12:02 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:38:54 +0000 e1000: add function parameter descriptions Add function parameter descriptions to address gcc 7 warnings. Signed-off-by: Todd Fujinaka Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (1bf35d435c9764e83be76042fa6489dd127b6c40) MFC after: 1 week (cherry picked from commit 5b426b3e8cbd5abdb3a57ff49cd27c36cac03427) --- sys/dev/e1000/e1000_82575.c | 11 +++++------ sys/dev/e1000/e1000_mac.c | 8 ++++++++ sys/dev/e1000/e1000_mbx.c | 4 ++++ sys/dev/e1000/e1000_nvm.c | 7 +++++++ sys/dev/e1000/e1000_phy.c | 6 ++++++ 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index 27e564d7841b..296a72542914 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -2702,7 +2702,7 @@ out: /** * __e1000_access_emi_reg - Read/write EMI register * @hw: pointer to the HW structure - * @addr: EMI address to program + * @address: EMI address to program * @data: pointer to value to read/write from/to the EMI address * @read: boolean flag to indicate read or write **/ @@ -2929,8 +2929,8 @@ out: /** * e1000_set_eee_i350 - Enable/disable EEE support * @hw: pointer to the HW structure - * @adv1g: boolean flag enabling 1G EEE advertisement - * @adv100m: boolean flag enabling 100M EEE advertisement + * @adv1G: boolean flag enabling 1G EEE advertisement + * @adv100M: boolean flag enabling 100M EEE advertisement * * Enable/disable EEE based on setting in dev_spec structure. * @@ -2984,8 +2984,8 @@ out: /** * e1000_set_eee_i354 - Enable/disable EEE support * @hw: pointer to the HW structure - * @adv1g: boolean flag enabling 1G EEE advertisement - * @adv100m: boolean flag enabling 100M EEE advertisement + * @adv1G: boolean flag enabling 1G EEE advertisement + * @adv100M: boolean flag enabling 100M EEE advertisement * * Enable/disable EEE legacy mode based on setting in dev_spec structure. * @@ -3641,7 +3641,6 @@ static s32 e1000_set_i2c_data(struct e1000_hw *hw, u32 *i2cctl, bool data) /** * e1000_get_i2c_data - Reads the I2C SDA data bit - * @hw: pointer to hardware structure * @i2cctl: Current value of I2CCTL register * * Returns the I2C data bit value diff --git a/sys/dev/e1000/e1000_mac.c b/sys/dev/e1000/e1000_mac.c index eeb9da727534..b9754293d454 100644 --- a/sys/dev/e1000/e1000_mac.c +++ b/sys/dev/e1000/e1000_mac.c @@ -105,6 +105,8 @@ void e1000_null_mac_generic(struct e1000_hw E1000_UNUSEDARG *hw) /** * e1000_null_link_info - No-op function, return 0 * @hw: pointer to the HW structure + * @s: dummy variable + * @d: dummy variable **/ s32 e1000_null_link_info(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG *s, u16 E1000_UNUSEDARG *d) @@ -126,6 +128,8 @@ bool e1000_null_mng_mode(struct e1000_hw E1000_UNUSEDARG *hw) /** * e1000_null_update_mc - No-op function, return void * @hw: pointer to the HW structure + * @h: dummy variable + * @a: dummy variable **/ void e1000_null_update_mc(struct e1000_hw E1000_UNUSEDARG *hw, u8 E1000_UNUSEDARG *h, u32 E1000_UNUSEDARG a) @@ -137,6 +141,8 @@ void e1000_null_update_mc(struct e1000_hw E1000_UNUSEDARG *hw, /** * e1000_null_write_vfta - No-op function, return void * @hw: pointer to the HW structure + * @a: dummy variable + * @b: dummy variable **/ void e1000_null_write_vfta(struct e1000_hw E1000_UNUSEDARG *hw, u32 E1000_UNUSEDARG a, u32 E1000_UNUSEDARG b) @@ -148,6 +154,8 @@ void e1000_null_write_vfta(struct e1000_hw E1000_UNUSEDARG *hw, /** * e1000_null_rar_set - No-op function, return 0 * @hw: pointer to the HW structure + * @h: dummy variable + * @a: dummy variable **/ int e1000_null_rar_set(struct e1000_hw E1000_UNUSEDARG *hw, u8 E1000_UNUSEDARG *h, u32 E1000_UNUSEDARG a) diff --git a/sys/dev/e1000/e1000_mbx.c b/sys/dev/e1000/e1000_mbx.c index da31185c3476..3fc3811757f7 100644 --- a/sys/dev/e1000/e1000_mbx.c +++ b/sys/dev/e1000/e1000_mbx.c @@ -38,6 +38,7 @@ /** * e1000_null_mbx_check_for_flag - No-op function, return 0 * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to read **/ static s32 e1000_null_mbx_check_for_flag(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG mbx_id) @@ -50,6 +51,9 @@ static s32 e1000_null_mbx_check_for_flag(struct e1000_hw E1000_UNUSEDARG *hw, /** * e1000_null_mbx_transact - No-op function, return 0 * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @mbx_id: id of mailbox to read **/ static s32 e1000_null_mbx_transact(struct e1000_hw E1000_UNUSEDARG *hw, u32 E1000_UNUSEDARG *msg, diff --git a/sys/dev/e1000/e1000_nvm.c b/sys/dev/e1000/e1000_nvm.c index d96ea3bf760a..7bda1213dde4 100644 --- a/sys/dev/e1000/e1000_nvm.c +++ b/sys/dev/e1000/e1000_nvm.c @@ -63,6 +63,9 @@ void e1000_init_nvm_ops_generic(struct e1000_hw *hw) /** * e1000_null_nvm_read - No-op function, return 0 * @hw: pointer to the HW structure + * @a: dummy variable + * @b: dummy variable + * @c: dummy variable **/ s32 e1000_null_read_nvm(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG a, u16 E1000_UNUSEDARG b, @@ -85,6 +88,7 @@ void e1000_null_nvm_generic(struct e1000_hw E1000_UNUSEDARG *hw) /** * e1000_null_led_default - No-op function, return 0 * @hw: pointer to the HW structure + * @data: dummy variable **/ s32 e1000_null_led_default(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG *data) @@ -96,6 +100,9 @@ s32 e1000_null_led_default(struct e1000_hw E1000_UNUSEDARG *hw, /** * e1000_null_write_nvm - No-op function, return 0 * @hw: pointer to the HW structure + * @a: dummy variable + * @b: dummy variable + * @c: dummy variable **/ s32 e1000_null_write_nvm(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG a, u16 E1000_UNUSEDARG b, diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index d22bcb7149c1..d73e3a10ae13 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -104,6 +104,7 @@ void e1000_init_phy_ops_generic(struct e1000_hw *hw) /** * e1000_null_set_page - No-op function, return 0 * @hw: pointer to the HW structure + * @data: dummy variable **/ s32 e1000_null_set_page(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG data) @@ -115,6 +116,8 @@ s32 e1000_null_set_page(struct e1000_hw E1000_UNUSEDARG *hw, /** * e1000_null_read_reg - No-op function, return 0 * @hw: pointer to the HW structure + * @offset: dummy variable + * @data: dummy variable **/ s32 e1000_null_read_reg(struct e1000_hw E1000_UNUSEDARG *hw, u32 E1000_UNUSEDARG offset, u16 E1000_UNUSEDARG *data) @@ -136,6 +139,7 @@ void e1000_null_phy_generic(struct e1000_hw E1000_UNUSEDARG *hw) /** * e1000_null_lplu_state - No-op function, return 0 * @hw: pointer to the HW structure + * @active: dummy variable **/ s32 e1000_null_lplu_state(struct e1000_hw E1000_UNUSEDARG *hw, bool E1000_UNUSEDARG active) @@ -147,6 +151,8 @@ s32 e1000_null_lplu_state(struct e1000_hw E1000_UNUSEDARG *hw, /** * e1000_null_write_reg - No-op function, return 0 * @hw: pointer to the HW structure + * @offset: dummy variable + * @data: dummy variable **/ s32 e1000_null_write_reg(struct e1000_hw E1000_UNUSEDARG *hw, u32 E1000_UNUSEDARG offset, u16 E1000_UNUSEDARG data) From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED9C06B1F6F; Fri, 24 Sep 2021 01:41: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 4HFvry4vbnz3KPQ; Fri, 24 Sep 2021 01:41: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 4FD4F5A6F; Fri, 24 Sep 2021 01:41: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 18O1fcjS039433; Fri, 24 Sep 2021 01:41:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1fc7I039432; Fri, 24 Sep 2021 01:41:38 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:38 GMT Message-Id: <202109240141.18O1fc7I039432@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: 33753fa9b7ec - stable/12 - e1000: expose MAC functions 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: 33753fa9b7ec47ea50b121c1ee602d48332823e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:39 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=33753fa9b7ec47ea50b121c1ee602d48332823e6 commit 33753fa9b7ec47ea50b121c1ee602d48332823e6 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:06 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:39:24 +0000 e1000: expose MAC functions Now the functions are being accessed outside of the file, we need to properly expose them for silicon families to use. Signed-off-by: Jeff Kirsher Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (df01c0ee277d51f81d7d72501dba97550d3b6c4a) MFC after: 1 week (cherry picked from commit d1c37752e2afb51dfb2e08afe714a799788b6ede) --- sys/dev/e1000/e1000_mac.c | 3 +-- sys/dev/e1000/e1000_mac.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/e1000/e1000_mac.c b/sys/dev/e1000/e1000_mac.c index f5b4ae0f5135..f9fb2cbbfe3d 100644 --- a/sys/dev/e1000/e1000_mac.c +++ b/sys/dev/e1000/e1000_mac.c @@ -38,7 +38,6 @@ static s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw); static void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw); static void e1000_config_collision_dist_generic(struct e1000_hw *hw); -static int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index); /** * e1000_init_mac_ops_generic - Initialize MAC function pointers @@ -484,7 +483,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw) * Sets the receive address array register at index to the address passed * in by addr. **/ -static int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index) +int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index) { u32 rar_low, rar_high; diff --git a/sys/dev/e1000/e1000_mac.h b/sys/dev/e1000/e1000_mac.h index 1f472d42421e..370f7f9d8a1a 100644 --- a/sys/dev/e1000/e1000_mac.h +++ b/sys/dev/e1000/e1000_mac.h @@ -70,6 +70,7 @@ s32 e1000_led_on_generic(struct e1000_hw *hw); s32 e1000_led_off_generic(struct e1000_hw *hw); void e1000_update_mc_addr_list_generic(struct e1000_hw *hw, u8 *mc_addr_list, u32 mc_addr_count); +int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index); s32 e1000_set_default_fc_generic(struct e1000_hw *hw); s32 e1000_set_fc_watermarks_generic(struct e1000_hw *hw); s32 e1000_setup_fiber_serdes_link_generic(struct e1000_hw *hw); From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8FE66B1DEE; Fri, 24 Sep 2021 01:41: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 4HFvs32cHcz3KbB; Fri, 24 Sep 2021 01:41: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 D64E85D00; Fri, 24 Sep 2021 01:41: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 18O1fgiZ039535; Fri, 24 Sep 2021 01:41:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1fgi6039534; Fri, 24 Sep 2021 01:41:42 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:42 GMT Message-Id: <202109240141.18O1fgi6039534@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: bc167ad657cf - stable/12 - e1000: add missed define for VFTA 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: bc167ad657cf9a027ec7538e35fa4119d83d1bac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:43 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=bc167ad657cf9a027ec7538e35fa4119d83d1bac commit bc167ad657cf9a027ec7538e35fa4119d83d1bac Author: Guinan Sun AuthorDate: 2020-07-06 08:12:13 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:39:43 +0000 e1000: add missed define for VFTA VLAN filtering using the VFTA (VLAN Filter Table Array) and should be initialized prior to setting rx mode. Signed-off-by: Sasha Neftin Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (fc9933953c90e99970aa867c38f9c6e6c5d0488d) MFC after: 1 week (cherry picked from commit a8bb4ab7cfb84195ef8af3c788fecdc8830fc960) --- sys/dev/e1000/e1000_defines.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/e1000/e1000_defines.h b/sys/dev/e1000/e1000_defines.h index d3aba827c3b5..30629cce8ddc 100644 --- a/sys/dev/e1000/e1000_defines.h +++ b/sys/dev/e1000/e1000_defines.h @@ -1390,6 +1390,7 @@ #define E1000_MDIC_ERROR 0x40000000 #define E1000_MDIC_DEST 0x80000000 +#define E1000_VFTA_BLOCK_SIZE 8 /* SerDes Control */ #define E1000_GEN_CTL_READY 0x80000000 #define E1000_GEN_CTL_ADDRESS_SHIFT 8 From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D1416B1DF0; Fri, 24 Sep 2021 01:41: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 4HFvs41MNkz3KdC; Fri, 24 Sep 2021 01:41: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 013A25BE4; Fri, 24 Sep 2021 01:41: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 18O1fhh8039559; Fri, 24 Sep 2021 01:41:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1fhuN039558; Fri, 24 Sep 2021 01:41:43 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:43 GMT Message-Id: <202109240141.18O1fhuN039558@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: f0413f8ec9ba - stable/12 - e1000: expose FEXTNVM registers and masks 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: f0413f8ec9ba50c9f8d4299ecd6c442a5d810c5e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:44 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=f0413f8ec9ba50c9f8d4299ecd6c442a5d810c5e commit f0413f8ec9ba50c9f8d4299ecd6c442a5d810c5e Author: Guinan Sun AuthorDate: 2020-07-06 08:12:16 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:39:48 +0000 e1000: expose FEXTNVM registers and masks Adding defines for FEXTNVM8 and FEXTNVM12 registers with new masks for future use. Signed-off-by: Nir Efrati Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (6d208ec099cd870a73c6b444b350a82c7a26c5e4) MFC after: 1 week (cherry picked from commit de965d042fa4d341cec3fa7cacac0f30f224bde4) --- sys/dev/e1000/e1000_ich8lan.h | 3 ++- sys/dev/e1000/e1000_regs.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/e1000/e1000_ich8lan.h b/sys/dev/e1000/e1000_ich8lan.h index 12f912ebc6e0..caff11cbb899 100644 --- a/sys/dev/e1000/e1000_ich8lan.h +++ b/sys/dev/e1000/e1000_ich8lan.h @@ -113,11 +113,12 @@ #define E1000_FEXTNVM7_DISABLE_PB_READ 0x00040000 #define E1000_FEXTNVM7_SIDE_CLK_UNGATE 0x00000004 #define E1000_FEXTNVM7_DISABLE_SMB_PERST 0x00000020 +#define E1000_FEXTNVM8_UNBIND_DPG_FROM_MPHY 0x00000400 #define E1000_FEXTNVM9_IOSFSB_CLKGATE_DIS 0x00000800 #define E1000_FEXTNVM9_IOSFSB_CLKREQ_DIS 0x00001000 #define E1000_FEXTNVM11_DISABLE_PB_READ 0x00000200 #define E1000_FEXTNVM11_DISABLE_MULR_FIX 0x00002000 - +#define E1000_FEXTNVM12_DONT_WAK_DPG_CLKREQ 0x00001000 /* bit24: RXDCTL thresholds granularity: 0 - cache lines, 1 - descriptors */ #define E1000_RXDCTL_THRESH_UNIT_DESC 0x01000000 diff --git a/sys/dev/e1000/e1000_regs.h b/sys/dev/e1000/e1000_regs.h index fe9834405359..01009d969620 100644 --- a/sys/dev/e1000/e1000_regs.h +++ b/sys/dev/e1000/e1000_regs.h @@ -66,8 +66,10 @@ #define E1000_FEXTNVM4 0x00024 /* Future Extended NVM 4 - RW */ #define E1000_FEXTNVM6 0x00010 /* Future Extended NVM 6 - RW */ #define E1000_FEXTNVM7 0x000E4 /* Future Extended NVM 7 - RW */ +#define E1000_FEXTNVM8 0x5BB0 /* Future Extended NVM 8 - RW */ #define E1000_FEXTNVM9 0x5BB4 /* Future Extended NVM 9 - RW */ #define E1000_FEXTNVM11 0x5BBC /* Future Extended NVM 11 - RW */ +#define E1000_FEXTNVM12 0x5BC0 /* Future Extended NVM 12 - RW */ #define E1000_PCIEANACFG 0x00F18 /* PCIE Analog Config */ #define E1000_FCT 0x00030 /* Flow Control Type - RW */ #define E1000_CONNSW 0x00034 /* Copper/Fiber switch control - RW */ From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 310B46B2205; Fri, 24 Sep 2021 01:41: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 4HFvs5538Yz3Kmc; Fri, 24 Sep 2021 01:41: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 1A97F5D01; Fri, 24 Sep 2021 01:41: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 18O1fjl3039583; Fri, 24 Sep 2021 01:41:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1fjel039582; Fri, 24 Sep 2021 01:41:45 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:45 GMT Message-Id: <202109240141.18O1fjel039582@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: e68491e21d7d - stable/12 - e1000: introduce DPGFR register 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: e68491e21d7d7671dfc3ad1a322560bd46699dbc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:46 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e68491e21d7d7671dfc3ad1a322560bd46699dbc commit e68491e21d7d7671dfc3ad1a322560bd46699dbc Author: Guinan Sun AuthorDate: 2020-07-06 08:12:19 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:39:53 +0000 e1000: introduce DPGFR register Defined DPGFR, Dynamic Power Gate Force Control Register. Signed-off-by: Vitaly Lifshits Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (1469e5aceffbdcebe834292aadb40b1bd1602867) MFC after: 1 week (cherry picked from commit 7fb2111413c799414c86d7bfdcc72bc1c6302726) --- sys/dev/e1000/e1000_regs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/e1000/e1000_regs.h b/sys/dev/e1000/e1000_regs.h index 01009d969620..27c456a432e8 100644 --- a/sys/dev/e1000/e1000_regs.h +++ b/sys/dev/e1000/e1000_regs.h @@ -71,6 +71,7 @@ #define E1000_FEXTNVM11 0x5BBC /* Future Extended NVM 11 - RW */ #define E1000_FEXTNVM12 0x5BC0 /* Future Extended NVM 12 - RW */ #define E1000_PCIEANACFG 0x00F18 /* PCIE Analog Config */ +#define E1000_DPGFR 0x00FAC /* Dynamic Power Gate Force Control Register */ #define E1000_FCT 0x00030 /* Flow Control Type - RW */ #define E1000_CONNSW 0x00034 /* Copper/Fiber switch control - RW */ #define E1000_VET 0x00038 /* VLAN Ether Type - RW */ From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABF7A6B1DEA; Fri, 24 Sep 2021 01:41:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFvs12MhYz3Kw6; Fri, 24 Sep 2021 01:41: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 98098587B; Fri, 24 Sep 2021 01:41: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 18O1feUJ039487; Fri, 24 Sep 2021 01:41:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1feAc039486; Fri, 24 Sep 2021 01:41:40 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:40 GMT Message-Id: <202109240141.18O1feAc039486@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: 355177efed6c - stable/12 - e1000: add missing register defines 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: 355177efed6c745049ff22aac58f8dc8dca08cc7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:41 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=355177efed6c745049ff22aac58f8dc8dca08cc7 commit 355177efed6c745049ff22aac58f8dc8dca08cc7 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:08 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:39:34 +0000 e1000: add missing register defines Added defines for the EEC, SHADOWINF and FLFWUPDATE registers needed for the nvmupd_validate_offset function to correctly validate the NVM update offset. Signed-off-by: Jeff Kirsher Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (2c7fe65ab9a31e6ebf438dad7ccc59bcde83a89f) MFC after: 1 week (cherry picked from commit 09888d4bc1a2c45d121046f79be5c01e4889a67e) --- sys/dev/e1000/e1000_regs.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/e1000/e1000_regs.h b/sys/dev/e1000/e1000_regs.h index 2b7696ddea62..fe9834405359 100644 --- a/sys/dev/e1000/e1000_regs.h +++ b/sys/dev/e1000/e1000_regs.h @@ -169,6 +169,8 @@ #define E1000_EMIDATA 0x11 /* Extended Memory Indirect Data */ /* Shadow Ram Write Register - RW */ #define E1000_SRWR 0x12018 +#define E1000_EEC_REG 0x12010 + #define E1000_I210_FLMNGCTL 0x12038 #define E1000_I210_FLMNGDATA 0x1203C #define E1000_I210_FLMNGCNT 0x12040 @@ -179,6 +181,9 @@ #define E1000_I210_FLA 0x1201C +#define E1000_SHADOWINF 0x12068 +#define E1000_FLFWUPDATE 0x12108 + #define E1000_INVM_DATA_REG(_n) (0x12120 + 4*(_n)) #define E1000_INVM_SIZE 64 /* Number of INVM Data Registers */ From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6F866B2047; Fri, 24 Sep 2021 01:41: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 4HFvs21RRYz3Kg0; Fri, 24 Sep 2021 01:41: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 B328D5761; Fri, 24 Sep 2021 01:41:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18O1ffbH039511; Fri, 24 Sep 2021 01:41:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1ff7h039510; Fri, 24 Sep 2021 01:41:41 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:41 GMT Message-Id: <202109240141.18O1ff7h039510@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: c2e24a65659e - stable/12 - e1000: increase timeout for ME ULP exit 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: c2e24a65659ea09cafb093465f61f3708e237dbb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:42 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c2e24a65659ea09cafb093465f61f3708e237dbb commit c2e24a65659ea09cafb093465f61f3708e237dbb Author: Guinan Sun AuthorDate: 2020-07-06 08:12:09 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:39:38 +0000 e1000: increase timeout for ME ULP exit Due timing issues in WHL and since recovery by host is not always supported, increased timeout for Manageability Engine(ME) to finish Ultra Low Power(ULP) exit flow for Nahum before timer expiration. Signed-off-by: Nir Efrati Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (cf1f3ca45d33e793ca581200b4000c39a798113e) MFC after: 1 week (cherry picked from commit e8e3171d992f3255cc8e5a0f59912d07679cc94c) --- sys/dev/e1000/e1000_ich8lan.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 4074eb68198c..0311fdb3fef6 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -1413,6 +1413,7 @@ out: s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force) { s32 ret_val = E1000_SUCCESS; + u8 ulp_exit_timeout = 30; u32 mac_reg; u16 phy_reg; int i = 0; @@ -1434,10 +1435,12 @@ s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force) E1000_WRITE_REG(hw, E1000_H2ME, mac_reg); } - /* Poll up to 300msec for ME to clear ULP_CFG_DONE. */ + if (hw->mac.type == e1000_pch_cnp) + ulp_exit_timeout = 100; + while (E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_ULP_CFG_DONE) { - if (i++ == 30) { + if (i++ == ulp_exit_timeout) { ret_val = -E1000_ERR_PHY; goto out; } From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C6916B1DF1; Fri, 24 Sep 2021 01:41: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 4HFvs74Pbmz3KdS; Fri, 24 Sep 2021 01:41: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 4868E5762; Fri, 24 Sep 2021 01:41: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 18O1fk77039613; Fri, 24 Sep 2021 01:41:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1fkcx039612; Fri, 24 Sep 2021 01:41:46 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:46 GMT Message-Id: <202109240141.18O1fkcx039612@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: d71c915a636e - stable/12 - e1000: cleanup pre-processor tags 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: d71c915a636e39ab924c9bc89c5cce04467d18ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:48 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d71c915a636e39ab924c9bc89c5cce04467d18ef commit d71c915a636e39ab924c9bc89c5cce04467d18ef Author: Guinan Sun AuthorDate: 2020-07-06 08:12:20 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:39:58 +0000 e1000: cleanup pre-processor tags The codes has been exposed correctly, so remove pre-processor tags. Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (a50e998a0fd94e5db508710868a3417b1846425c) MFC after: 1 week (cherry picked from commit 9c4a0fabc8b88af0d9fd3f0d67bd080714d1ee4b) --- sys/dev/e1000/e1000_manage.c | 5 +++-- sys/dev/e1000/e1000_regs.h | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/e1000/e1000_manage.c b/sys/dev/e1000/e1000_manage.c index 120431d58b0b..b5ad5815d5ee 100644 --- a/sys/dev/e1000/e1000_manage.c +++ b/sys/dev/e1000/e1000_manage.c @@ -34,6 +34,8 @@ /*$FreeBSD$*/ #include "e1000_api.h" +#include "e1000_manage.h" + /** * e1000_calculate_checksum - Calculate checksum for buffer * @buffer: pointer to EEPROM @@ -455,6 +457,7 @@ s32 e1000_host_interface_command(struct e1000_hw *hw, u8 *buffer, u32 length) return E1000_SUCCESS; } + /** * e1000_load_firmware - Writes proxy FW code buffer to host interface * and execute. @@ -573,5 +576,3 @@ s32 e1000_load_firmware(struct e1000_hw *hw, u8 *buffer, u32 length) return E1000_SUCCESS; } - - diff --git a/sys/dev/e1000/e1000_regs.h b/sys/dev/e1000/e1000_regs.h index 27c456a432e8..c09856e55275 100644 --- a/sys/dev/e1000/e1000_regs.h +++ b/sys/dev/e1000/e1000_regs.h @@ -381,6 +381,7 @@ #define E1000_TSCTC 0x040F8 /* TCP Segmentation Context Tx - R/clr */ #define E1000_TSCTFC 0x040FC /* TCP Segmentation Context Tx Fail - R/clr */ #define E1000_IAC 0x04100 /* Interrupt Assertion Count */ +/* Interrupt Cause */ #define E1000_ICRXPTC 0x04104 /* Interrupt Cause Rx Pkt Timer Expire Count */ #define E1000_ICRXATC 0x04108 /* Interrupt Cause Rx Abs Timer Expire Count */ #define E1000_ICTXPTC 0x0410C /* Interrupt Cause Tx Pkt Timer Expire Count */ @@ -503,12 +504,14 @@ #define E1000_WUC 0x05800 /* Wakeup Control - RW */ #define E1000_WUFC 0x05808 /* Wakeup Filter Control - RW */ #define E1000_WUS 0x05810 /* Wakeup Status - RO */ +/* Management registers */ #define E1000_MANC 0x05820 /* Management Control - RW */ #define E1000_IPAV 0x05838 /* IP Address Valid - RW */ #define E1000_IP4AT 0x05840 /* IPv4 Address Table - RW Array */ #define E1000_IP6AT 0x05880 /* IPv6 Address Table - RW Array */ #define E1000_WUPL 0x05900 /* Wakeup Packet Length - RW */ #define E1000_WUPM 0x05A00 /* Wakeup Packet Memory - RO A */ +/* MSI-X Table Register Descriptions */ #define E1000_PBACL 0x05B68 /* MSIx PBA Clear - Read/Write 1's to clear */ #define E1000_FFLT 0x05F00 /* Flexible Filter Length Table - RW Array */ #define E1000_HOST_IF 0x08800 /* Host Interface */ From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E738A6B20BC; Fri, 24 Sep 2021 01:41:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFvsB21Rdz3KkV; Fri, 24 Sep 2021 01:41:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD6C75D04; Fri, 24 Sep 2021 01:41: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 18O1fnAo039685; Fri, 24 Sep 2021 01:41:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1fnX4039684; Fri, 24 Sep 2021 01:41:49 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:49 GMT Message-Id: <202109240141.18O1fnX4039684@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: f4d49d0a6cd0 - stable/12 - e1000: clean LTO warnings 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: f4d49d0a6cd01a2004dc83fce695270615c6fe74 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:51 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=f4d49d0a6cd01a2004dc83fce695270615c6fe74 commit f4d49d0a6cd01a2004dc83fce695270615c6fe74 Author: Andrzej Ostruszka AuthorDate: 2019-11-07 15:03:15 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:40:13 +0000 e1000: clean LTO warnings During LTO build compiler reports some 'false positive' warnings about variables being possibly used uninitialized. This patch silences these warnings. Exemplary compiler warning to suppress (with LTO enabled): error: 'link' may be used uninitialized in this function [-Werror=maybe-uninitialized] if (link) { Signed-off-by: Andrzej Ostruszka Approved by: imp Obtained from: DPDK (46136031f19107f4e9b6b3a952cb7f57877a7f0f) MFC after: 1 week (cherry picked from commit 089cdb3990f47be3cd34d1a57567a2e89c917929) --- sys/dev/e1000/e1000_82543.c | 2 +- sys/dev/e1000/e1000_ich8lan.c | 2 +- sys/dev/e1000/e1000_phy.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/e1000/e1000_82543.c b/sys/dev/e1000/e1000_82543.c index ac81cbd296f2..b9c6e439480a 100644 --- a/sys/dev/e1000/e1000_82543.c +++ b/sys/dev/e1000/e1000_82543.c @@ -1062,7 +1062,7 @@ static s32 e1000_setup_copper_link_82543(struct e1000_hw *hw) { u32 ctrl; s32 ret_val; - bool link; + bool link = true; DEBUGFUNC("e1000_setup_copper_link_82543"); diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 0311fdb3fef6..b29d53ea4b54 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -5620,7 +5620,7 @@ void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw) void e1000_gig_downshift_workaround_ich8lan(struct e1000_hw *hw) { s32 ret_val; - u16 reg_data; + u16 reg_data = 0; DEBUGFUNC("e1000_gig_downshift_workaround_ich8lan"); diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index d84b6120dd31..2eae3acbe500 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -1695,7 +1695,7 @@ s32 e1000_copper_link_autoneg(struct e1000_hw *hw) s32 e1000_setup_copper_link_generic(struct e1000_hw *hw) { s32 ret_val; - bool link; + bool link = true; DEBUGFUNC("e1000_setup_copper_link_generic"); From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 815C56B220F; Fri, 24 Sep 2021 01:41: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 4HFvs90WCJz3Kml; Fri, 24 Sep 2021 01:41: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 98324587F; Fri, 24 Sep 2021 01:41: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 18O1fmZW039661; Fri, 24 Sep 2021 01:41:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1fmlA039660; Fri, 24 Sep 2021 01:41:48 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:48 GMT Message-Id: <202109240141.18O1fmlA039660@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: df90074502a0 - stable/12 - e1000: fix multicast setting in VF 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: df90074502a0034fd54c84da48ce632d4fade6f1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:49 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=df90074502a0034fd54c84da48ce632d4fade6f1 commit df90074502a0034fd54c84da48ce632d4fade6f1 Author: Yong Wang AuthorDate: 2017-02-21 09:33:23 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:40:08 +0000 e1000: fix multicast setting in VF In function e1000_update_mc_addr_list_vf(), "msgbuf[0]" is used prior to initialization at "msgbuf[0] |= E1000_VF_SET_MULTICAST_OVERFLOW". And "msgbuf[0]" is overwritten at "msgbuf[0] = E1000_VF_SET_MULTICAST". Fix it by moving the second line prior to the first one that mentioned above. Fixes: dffbaf7880a8 ("e1000: revert fix for multicast in VF") Cc: stable@dpdk.org Signed-off-by: Yong Wang Acked-by: Wenzhuo Lu Approved by: imp Obtained from: DPDK (f58ca2f9ef6) MFC after: 1 week (cherry picked from commit ecf2a89a997ad4a14339b6a2f544e44b422620a0) --- sys/dev/e1000/e1000_vf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/e1000/e1000_vf.c b/sys/dev/e1000/e1000_vf.c index 2a52d7dbd814..b17df650265b 100644 --- a/sys/dev/e1000/e1000_vf.c +++ b/sys/dev/e1000/e1000_vf.c @@ -419,12 +419,13 @@ void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, DEBUGOUT1("MC Addr Count = %d\n", mc_addr_count); + msgbuf[0] = E1000_VF_SET_MULTICAST; + if (mc_addr_count > 30) { msgbuf[0] |= E1000_VF_SET_MULTICAST_OVERFLOW; mc_addr_count = 30; } - msgbuf[0] = E1000_VF_SET_MULTICAST; msgbuf[0] |= mc_addr_count << E1000_VT_MSGINFO_SHIFT; for (i = 0; i < mc_addr_count; i++) { From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A88A26B2286; Fri, 24 Sep 2021 01:41: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 4HFvs7723wz3KgL; Fri, 24 Sep 2021 01:41: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 6973656FD; Fri, 24 Sep 2021 01:41: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 18O1flpd039637; Fri, 24 Sep 2021 01:41:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1flbG039636; Fri, 24 Sep 2021 01:41:47 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:47 GMT Message-Id: <202109240141.18O1flbG039636@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: 0f843e051379 - stable/12 - e1000: fix timeout for shadow RAM write 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: 0f843e05137962827ec84216e6d3340b765c5497 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:48 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0f843e05137962827ec84216e6d3340b765c5497 commit 0f843e05137962827ec84216e6d3340b765c5497 Author: Chengwen Feng AuthorDate: 2021-04-21 09:15:35 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:40:03 +0000 e1000: fix timeout for shadow RAM write This fixes the timed out for shadow RAM write EEWR can't be detected. Fixes: 5a32a257f957 ("e1000: more NICs in base driver") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Min Hu (Connor) Acked-by: Haiyue Wang Approved by: imp Obtained from: DPDK (4a8ab48ec47b3616272e50620b8e1a9599358ea6) MFC after: 1 week (cherry picked from commit f6517a7e69c10c6057d6c990a9f3ea22a2b62398) --- sys/dev/e1000/e1000_i210.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/e1000/e1000_i210.c b/sys/dev/e1000/e1000_i210.c index cd85a8c3172a..d3692db11245 100644 --- a/sys/dev/e1000/e1000_i210.c +++ b/sys/dev/e1000/e1000_i210.c @@ -195,6 +195,8 @@ static s32 e1000_write_nvm_srwr(struct e1000_hw *hw, u16 offset, u16 words, } for (i = 0; i < words; i++) { + ret_val = -E1000_ERR_NVM; + eewr = ((offset + i) << E1000_NVM_RW_ADDR_SHIFT) | (data[i] << E1000_NVM_RW_REG_DATA) | E1000_NVM_RW_REG_START; From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2B6B6B2392; Fri, 24 Sep 2021 01:41:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFvsF41zPz3Kkd; Fri, 24 Sep 2021 01:41: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 19E945D81; Fri, 24 Sep 2021 01:41: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 18O1fqv8039739; Fri, 24 Sep 2021 01:41:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1fqUV039738; Fri, 24 Sep 2021 01:41:52 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:52 GMT Message-Id: <202109240141.18O1fqUV039738@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: 5c1c9f08d746 - stable/12 - e1000: Catch up commit with DPDK 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: 5c1c9f08d74612a141853b540ddc25212f99a34f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:54 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=5c1c9f08d74612a141853b540ddc25212f99a34f commit 5c1c9f08d74612a141853b540ddc25212f99a34f Author: Kevin Bowling AuthorDate: 2021-09-17 02:30:49 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:40:25 +0000 e1000: Catch up commit with DPDK Various syncs with the e1000 shared code from DPDK: "cid-gigabit.2020.06.05.tar.gz released by ND" Approved by: imp Obtained from: DPDK MFC after: 1 week (cherry picked from commit 984d1616be883bc2c351aff9aa69b1abd7d1214c) --- sys/dev/e1000/e1000_82571.c | 2 +- sys/dev/e1000/e1000_82575.c | 2 +- sys/dev/e1000/e1000_api.c | 15 +++++ sys/dev/e1000/e1000_api.h | 1 + sys/dev/e1000/e1000_defines.h | 33 ++++++++++ sys/dev/e1000/e1000_hw.h | 2 +- sys/dev/e1000/e1000_i210.c | 100 ++++++++++++++++++++++++++++ sys/dev/e1000/e1000_i210.h | 2 + sys/dev/e1000/e1000_nvm.c | 147 ++++++++++++++++++++++++++++++++++++++++++ sys/dev/e1000/e1000_nvm.h | 19 ++++++ sys/dev/e1000/e1000_regs.h | 3 +- 11 files changed, 322 insertions(+), 4 deletions(-) diff --git a/sys/dev/e1000/e1000_82571.c b/sys/dev/e1000/e1000_82571.c index 6fefcc774cbb..8db1fcb921a9 100644 --- a/sys/dev/e1000/e1000_82571.c +++ b/sys/dev/e1000/e1000_82571.c @@ -515,7 +515,7 @@ e1000_get_hw_semaphore_82574(struct e1000_hw *hw) u32 extcnf_ctrl; s32 i = 0; /* XXX assert that mutex is held */ - DEBUGFUNC("e1000_get_hw_semaphore_82573"); + DEBUGFUNC("e1000_get_hw_semaphore_82574"); ASSERT_CTX_LOCK_HELD(hw); extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index 172e99b02d5c..29805270f8dc 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -1360,7 +1360,7 @@ static s32 e1000_reset_hw_82575(struct e1000_hw *hw) * * This inits the hardware readying it for operation. **/ -STATIC s32 e1000_init_hw_82575(struct e1000_hw *hw) +static s32 e1000_init_hw_82575(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; s32 ret_val; diff --git a/sys/dev/e1000/e1000_api.c b/sys/dev/e1000/e1000_api.c index 6e0f51ab7ffa..b28ab77f3794 100644 --- a/sys/dev/e1000/e1000_api.c +++ b/sys/dev/e1000/e1000_api.c @@ -1269,6 +1269,21 @@ s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size) return e1000_read_pba_length_generic(hw, pba_num_size); } +/** + * e1000_read_pba_num - Read device part number + * @hw: pointer to the HW structure + * @pba_num: pointer to device part number + * + * Reads the product board assembly (PBA) number from the EEPROM and stores + * the value in pba_num. + * Currently no func pointer exists and all implementations are handled in the + * generic version of this function. + **/ +s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *pba_num) +{ + return e1000_read_pba_num_generic(hw, pba_num); +} + /** * e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum * @hw: pointer to the HW structure diff --git a/sys/dev/e1000/e1000_api.h b/sys/dev/e1000/e1000_api.h index db4caac37e97..c96030b567db 100644 --- a/sys/dev/e1000/e1000_api.h +++ b/sys/dev/e1000/e1000_api.h @@ -97,6 +97,7 @@ s32 e1000_phy_commit(struct e1000_hw *hw); void e1000_power_up_phy(struct e1000_hw *hw); void e1000_power_down_phy(struct e1000_hw *hw); s32 e1000_read_mac_addr(struct e1000_hw *hw); +s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *part_num); s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size); s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size); void e1000_reload_nvm(struct e1000_hw *hw); diff --git a/sys/dev/e1000/e1000_defines.h b/sys/dev/e1000/e1000_defines.h index 30629cce8ddc..18e905527a88 100644 --- a/sys/dev/e1000/e1000_defines.h +++ b/sys/dev/e1000/e1000_defines.h @@ -1083,11 +1083,44 @@ /* NVM Word Offsets */ #define NVM_COMPAT 0x0003 #define NVM_ID_LED_SETTINGS 0x0004 +#define NVM_VERSION 0x0005 #define NVM_SERDES_AMPLITUDE 0x0006 /* SERDES output amplitude */ #define NVM_PHY_CLASS_WORD 0x0007 #define E1000_I210_NVM_FW_MODULE_PTR 0x0010 #define E1000_I350_NVM_FW_MODULE_PTR 0x0051 #define NVM_FUTURE_INIT_WORD1 0x0019 +#define NVM_ETRACK_WORD 0x0042 +#define NVM_ETRACK_HIWORD 0x0043 +#define NVM_COMB_VER_OFF 0x0083 +#define NVM_COMB_VER_PTR 0x003d + +/* NVM version defines */ +#define NVM_MAJOR_MASK 0xF000 +#define NVM_MINOR_MASK 0x0FF0 +#define NVM_IMAGE_ID_MASK 0x000F +#define NVM_COMB_VER_MASK 0x00FF +#define NVM_MAJOR_SHIFT 12 +#define NVM_MINOR_SHIFT 4 +#define NVM_COMB_VER_SHFT 8 +#define NVM_VER_INVALID 0xFFFF +#define NVM_ETRACK_SHIFT 16 +#define NVM_ETRACK_VALID 0x8000 +#define NVM_NEW_DEC_MASK 0x0F00 +#define NVM_HEX_CONV 16 +#define NVM_HEX_TENS 10 + +/* FW version defines */ +/* Offset of "Loader patch ptr" in Firmware Header */ +#define E1000_I350_NVM_FW_LOADER_PATCH_PTR_OFFSET 0x01 +/* Patch generation hour & minutes */ +#define E1000_I350_NVM_FW_VER_WORD1_OFFSET 0x04 +/* Patch generation month & day */ +#define E1000_I350_NVM_FW_VER_WORD2_OFFSET 0x05 +/* Patch generation year */ +#define E1000_I350_NVM_FW_VER_WORD3_OFFSET 0x06 +/* Patch major & minor numbers */ +#define E1000_I350_NVM_FW_VER_WORD4_OFFSET 0x07 + #define NVM_MAC_ADDR 0x0000 #define NVM_SUB_DEV_ID 0x000B #define NVM_SUB_VEN_ID 0x000C diff --git a/sys/dev/e1000/e1000_hw.h b/sys/dev/e1000/e1000_hw.h index f3acfa5cfc79..42dbb2e0717e 100644 --- a/sys/dev/e1000/e1000_hw.h +++ b/sys/dev/e1000/e1000_hw.h @@ -998,7 +998,7 @@ struct e1000_dev_spec_ich8lan { enum e1000_ulp_state ulp_state; bool ulp_capability_disabled; bool during_suspend_flow; - bool during_dpg_exit; + bool smbus_disable; }; struct e1000_dev_spec_82575 { diff --git a/sys/dev/e1000/e1000_i210.c b/sys/dev/e1000/e1000_i210.c index d3692db11245..0d810fecf3bd 100644 --- a/sys/dev/e1000/e1000_i210.c +++ b/sys/dev/e1000/e1000_i210.c @@ -345,6 +345,105 @@ static s32 e1000_read_invm_i210(struct e1000_hw *hw, u16 offset, return ret_val; } +/** + * e1000_read_invm_version - Reads iNVM version and image type + * @hw: pointer to the HW structure + * @invm_ver: version structure for the version read + * + * Reads iNVM version and image type. + **/ +s32 e1000_read_invm_version(struct e1000_hw *hw, + struct e1000_fw_version *invm_ver) +{ + u32 *record = NULL; + u32 *next_record = NULL; + u32 i = 0; + u32 invm_dword = 0; + u32 invm_blocks = E1000_INVM_SIZE - (E1000_INVM_ULT_BYTES_SIZE / + E1000_INVM_RECORD_SIZE_IN_BYTES); + u32 buffer[E1000_INVM_SIZE]; + s32 status = -E1000_ERR_INVM_VALUE_NOT_FOUND; + u16 version = 0; + + DEBUGFUNC("e1000_read_invm_version"); + + /* Read iNVM memory */ + for (i = 0; i < E1000_INVM_SIZE; i++) { + invm_dword = E1000_READ_REG(hw, E1000_INVM_DATA_REG(i)); + buffer[i] = invm_dword; + } + + /* Read version number */ + for (i = 1; i < invm_blocks; i++) { + record = &buffer[invm_blocks - i]; + next_record = &buffer[invm_blocks - i + 1]; + + /* Check if we have first version location used */ + if ((i == 1) && ((*record & E1000_INVM_VER_FIELD_ONE) == 0)) { + version = 0; + status = E1000_SUCCESS; + break; + } + /* Check if we have second version location used */ + else if ((i == 1) && + ((*record & E1000_INVM_VER_FIELD_TWO) == 0)) { + version = (*record & E1000_INVM_VER_FIELD_ONE) >> 3; + status = E1000_SUCCESS; + break; + } + /* + * Check if we have odd version location + * used and it is the last one used + */ + else if ((((*record & E1000_INVM_VER_FIELD_ONE) == 0) && + ((*record & 0x3) == 0)) || (((*record & 0x3) != 0) && + (i != 1))) { + version = (*next_record & E1000_INVM_VER_FIELD_TWO) + >> 13; + status = E1000_SUCCESS; + break; + } + /* + * Check if we have even version location + * used and it is the last one used + */ + else if (((*record & E1000_INVM_VER_FIELD_TWO) == 0) && + ((*record & 0x3) == 0)) { + version = (*record & E1000_INVM_VER_FIELD_ONE) >> 3; + status = E1000_SUCCESS; + break; + } + } + + if (status == E1000_SUCCESS) { + invm_ver->invm_major = (version & E1000_INVM_MAJOR_MASK) + >> E1000_INVM_MAJOR_SHIFT; + invm_ver->invm_minor = version & E1000_INVM_MINOR_MASK; + } + /* Read Image Type */ + for (i = 1; i < invm_blocks; i++) { + record = &buffer[invm_blocks - i]; + next_record = &buffer[invm_blocks - i + 1]; + + /* Check if we have image type in first location used */ + if ((i == 1) && ((*record & E1000_INVM_IMGTYPE_FIELD) == 0)) { + invm_ver->invm_img_type = 0; + status = E1000_SUCCESS; + break; + } + /* Check if we have image type in first location used */ + else if ((((*record & 0x3) == 0) && + ((*record & E1000_INVM_IMGTYPE_FIELD) == 0)) || + ((((*record & 0x3) != 0) && (i != 1)))) { + invm_ver->invm_img_type = + (*next_record & E1000_INVM_IMGTYPE_FIELD) >> 23; + status = E1000_SUCCESS; + break; + } + } + return status; +} + /** * e1000_validate_nvm_checksum_i210 - Validate EEPROM checksum * @hw: pointer to the HW structure @@ -628,6 +727,7 @@ static s32 e1000_pll_workaround_i210(struct e1000_hw *hw) if (ret_val != E1000_SUCCESS) nvm_word = E1000_INVM_DEFAULT_AL; tmp_nvm = nvm_word | E1000_INVM_PLL_WO_VAL; + phy_word = E1000_PHY_PLL_UNCONF; for (i = 0; i < E1000_MAX_PLL_TRIES; i++) { /* check current state directly from internal PHY */ e1000_write_phy_reg_mdic(hw, GS40G_PAGE_SELECT, 0xFC); diff --git a/sys/dev/e1000/e1000_i210.h b/sys/dev/e1000/e1000_i210.h index 9ad9e28c363b..77414b851a76 100644 --- a/sys/dev/e1000/e1000_i210.h +++ b/sys/dev/e1000/e1000_i210.h @@ -44,6 +44,8 @@ s32 e1000_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); s32 e1000_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); +s32 e1000_read_invm_version(struct e1000_hw *hw, + struct e1000_fw_version *invm_ver); s32 e1000_init_hw_i210(struct e1000_hw *hw); #define E1000_STM_OPCODE 0xDB00 diff --git a/sys/dev/e1000/e1000_nvm.c b/sys/dev/e1000/e1000_nvm.c index 95f00e4d681f..ef6f31f30c18 100644 --- a/sys/dev/e1000/e1000_nvm.c +++ b/sys/dev/e1000/e1000_nvm.c @@ -939,6 +939,41 @@ s32 e1000_read_pba_length_generic(struct e1000_hw *hw, u32 *pba_num_size) return E1000_SUCCESS; } +/** + * e1000_read_pba_num_generic - Read device part number + * @hw: pointer to the HW structure + * @pba_num: pointer to device part number + * + * Reads the product board assembly (PBA) number from the EEPROM and stores + * the value in pba_num. + **/ +s32 e1000_read_pba_num_generic(struct e1000_hw *hw, u32 *pba_num) +{ + s32 ret_val; + u16 nvm_data; + + DEBUGFUNC("e1000_read_pba_num_generic"); + + ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_0, 1, &nvm_data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + return ret_val; + } else if (nvm_data == NVM_PBA_PTR_GUARD) { + DEBUGOUT("NVM Not Supported\n"); + return -E1000_NOT_IMPLEMENTED; + } + *pba_num = (u32)(nvm_data << 16); + + ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_1, 1, &nvm_data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + return ret_val; + } + *pba_num |= nvm_data; + + return E1000_SUCCESS; +} + /** * e1000_read_pba_raw @@ -1241,4 +1276,116 @@ static void e1000_reload_nvm_generic(struct e1000_hw *hw) E1000_WRITE_FLUSH(hw); } +/** + * e1000_get_fw_version - Get firmware version information + * @hw: pointer to the HW structure + * @fw_vers: pointer to output version structure + * + * unsupported/not present features return 0 in version structure + **/ +void e1000_get_fw_version(struct e1000_hw *hw, struct e1000_fw_version *fw_vers) +{ + u16 eeprom_verh, eeprom_verl, etrack_test, fw_version; + u8 q, hval, rem, result; + u16 comb_verh, comb_verl, comb_offset; + + memset(fw_vers, 0, sizeof(struct e1000_fw_version)); + + /* basic eeprom version numbers, bits used vary by part and by tool + * used to create the nvm images */ + /* Check which data format we have */ + switch (hw->mac.type) { + case e1000_i211: + e1000_read_invm_version(hw, fw_vers); + return; + case e1000_82575: + case e1000_82576: + case e1000_82580: + case e1000_i354: + hw->nvm.ops.read(hw, NVM_ETRACK_HIWORD, 1, &etrack_test); + /* Use this format, unless EETRACK ID exists, + * then use alternate format + */ + if ((etrack_test & NVM_MAJOR_MASK) != NVM_ETRACK_VALID) { + hw->nvm.ops.read(hw, NVM_VERSION, 1, &fw_version); + fw_vers->eep_major = (fw_version & NVM_MAJOR_MASK) + >> NVM_MAJOR_SHIFT; + fw_vers->eep_minor = (fw_version & NVM_MINOR_MASK) + >> NVM_MINOR_SHIFT; + fw_vers->eep_build = (fw_version & NVM_IMAGE_ID_MASK); + goto etrack_id; + } + break; + case e1000_i210: + if (!(e1000_get_flash_presence_i210(hw))) { + e1000_read_invm_version(hw, fw_vers); + return; + } + /* fall through */ + case e1000_i350: + hw->nvm.ops.read(hw, NVM_ETRACK_HIWORD, 1, &etrack_test); + /* find combo image version */ + hw->nvm.ops.read(hw, NVM_COMB_VER_PTR, 1, &comb_offset); + if ((comb_offset != 0x0) && + (comb_offset != NVM_VER_INVALID)) { + + hw->nvm.ops.read(hw, (NVM_COMB_VER_OFF + comb_offset + + 1), 1, &comb_verh); + hw->nvm.ops.read(hw, (NVM_COMB_VER_OFF + comb_offset), + 1, &comb_verl); + + /* get Option Rom version if it exists and is valid */ + if ((comb_verh && comb_verl) && + ((comb_verh != NVM_VER_INVALID) && + (comb_verl != NVM_VER_INVALID))) { + + fw_vers->or_valid = true; + fw_vers->or_major = + comb_verl >> NVM_COMB_VER_SHFT; + fw_vers->or_build = + (comb_verl << NVM_COMB_VER_SHFT) + | (comb_verh >> NVM_COMB_VER_SHFT); + fw_vers->or_patch = + comb_verh & NVM_COMB_VER_MASK; + } + } + break; + default: + hw->nvm.ops.read(hw, NVM_ETRACK_HIWORD, 1, &etrack_test); + return; + } + hw->nvm.ops.read(hw, NVM_VERSION, 1, &fw_version); + fw_vers->eep_major = (fw_version & NVM_MAJOR_MASK) + >> NVM_MAJOR_SHIFT; + + /* check for old style version format in newer images*/ + if ((fw_version & NVM_NEW_DEC_MASK) == 0x0) { + eeprom_verl = (fw_version & NVM_COMB_VER_MASK); + } else { + eeprom_verl = (fw_version & NVM_MINOR_MASK) + >> NVM_MINOR_SHIFT; + } + /* Convert minor value to hex before assigning to output struct + * Val to be converted will not be higher than 99, per tool output + */ + q = eeprom_verl / NVM_HEX_CONV; + hval = q * NVM_HEX_TENS; + rem = eeprom_verl % NVM_HEX_CONV; + result = hval + rem; + fw_vers->eep_minor = result; + +etrack_id: + if ((etrack_test & NVM_MAJOR_MASK) == NVM_ETRACK_VALID) { + hw->nvm.ops.read(hw, NVM_ETRACK_WORD, 1, &eeprom_verl); + hw->nvm.ops.read(hw, (NVM_ETRACK_WORD + 1), 1, &eeprom_verh); + fw_vers->etrack_id = (eeprom_verh << NVM_ETRACK_SHIFT) + | eeprom_verl; + } else if ((etrack_test & NVM_ETRACK_VALID) == 0) { + hw->nvm.ops.read(hw, NVM_ETRACK_WORD, 1, &eeprom_verh); + hw->nvm.ops.read(hw, (NVM_ETRACK_WORD + 1), 1, &eeprom_verl); + fw_vers->etrack_id = (eeprom_verh << NVM_ETRACK_SHIFT) | + eeprom_verl; + } +} + diff --git a/sys/dev/e1000/e1000_nvm.h b/sys/dev/e1000/e1000_nvm.h index fc7ceab17e32..86fd5d1e892f 100644 --- a/sys/dev/e1000/e1000_nvm.h +++ b/sys/dev/e1000/e1000_nvm.h @@ -41,6 +41,22 @@ struct e1000_pba { u16 *pba_block; }; +struct e1000_fw_version { + u32 etrack_id; + u16 eep_major; + u16 eep_minor; + u16 eep_build; + + u8 invm_major; + u8 invm_minor; + u8 invm_img_type; + + bool or_valid; + u16 or_major; + u16 or_build; + u16 or_patch; +}; + void e1000_init_nvm_ops_generic(struct e1000_hw *hw); s32 e1000_null_read_nvm(struct e1000_hw *hw, u16 a, u16 b, u16 *c); @@ -51,6 +67,7 @@ s32 e1000_acquire_nvm_generic(struct e1000_hw *hw); s32 e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg); s32 e1000_read_mac_addr_generic(struct e1000_hw *hw); +s32 e1000_read_pba_num_generic(struct e1000_hw *hw, u32 *pba_num); s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size); s32 e1000_read_pba_length_generic(struct e1000_hw *hw, u32 *pba_num_size); @@ -75,6 +92,8 @@ s32 e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, s32 e1000_update_nvm_checksum_generic(struct e1000_hw *hw); void e1000_stop_nvm(struct e1000_hw *hw); void e1000_release_nvm_generic(struct e1000_hw *hw); +void e1000_get_fw_version(struct e1000_hw *hw, + struct e1000_fw_version *fw_vers); #define E1000_STM_OPCODE 0xDB00 diff --git a/sys/dev/e1000/e1000_regs.h b/sys/dev/e1000/e1000_regs.h index c09856e55275..b3fb854f8adc 100644 --- a/sys/dev/e1000/e1000_regs.h +++ b/sys/dev/e1000/e1000_regs.h @@ -64,6 +64,7 @@ #define E1000_FEXTNVM 0x00028 /* Future Extended NVM - RW */ #define E1000_FEXTNVM3 0x0003C /* Future Extended NVM 3 - RW */ #define E1000_FEXTNVM4 0x00024 /* Future Extended NVM 4 - RW */ +#define E1000_FEXTNVM5 0x00014 /* Future Extended NVM 5 - RW */ #define E1000_FEXTNVM6 0x00010 /* Future Extended NVM 6 - RW */ #define E1000_FEXTNVM7 0x000E4 /* Future Extended NVM 7 - RW */ #define E1000_FEXTNVM8 0x5BB0 /* Future Extended NVM 8 - RW */ @@ -634,7 +635,7 @@ /* ETQF register bit definitions */ #define E1000_ETQF_FILTER_ENABLE (1 << 26) #define E1000_ETQF_IMM_INT (1 << 29) -#define E1000_ETQF_QUEUE_ENABLE (1 << 31) +#define E1000_ETQF_QUEUE_ENABLE (1U << 31) #define E1000_ETQF_QUEUE_SHIFT 16 #define E1000_ETQF_QUEUE_MASK 0x00070000 #define E1000_ETQF_ETYPE_MASK 0x0000FFFF From owner-dev-commits-src-all@freebsd.org Fri Sep 24 01:41:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E2AF66B1DF4; Fri, 24 Sep 2021 01:41: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 4HFvsC2NZMz3L1B; Fri, 24 Sep 2021 01:41: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 E7D9F5D05; Fri, 24 Sep 2021 01:41: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 18O1folu039709; Fri, 24 Sep 2021 01:41:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O1foVE039708; Fri, 24 Sep 2021 01:41:50 GMT (envelope-from git) Date: Fri, 24 Sep 2021 01:41:50 GMT Message-Id: <202109240141.18O1foVE039708@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: 410ec4c16ab4 - stable/12 - e1000: prevent ULP flow if cable connected 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: 410ec4c16ab4ac7e6dff266dd7a5a3659400b760 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 01:41:52 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=410ec4c16ab4ac7e6dff266dd7a5a3659400b760 commit 410ec4c16ab4ac7e6dff266dd7a5a3659400b760 Author: Wenzhuo Lu AuthorDate: 2015-10-16 02:51:03 +0000 Commit: Kevin Bowling CommitDate: 2021-09-24 01:40:19 +0000 e1000: prevent ULP flow if cable connected Enabling ulp on link down when cable is connect caused an infinite loop of linkup/down indications in the NDIS driver. After discussed, correct flow is to enable ULP only when cable is disconnected. Signed-off-by: Wenzhuo Lu Approved by: imp Obtained from: DPDK (4bff263d54d299269966365f9697941eecaa241b) MFC after: 1 week (cherry picked from commit 40fa6e53f53cde84f6f5c7330f89e4ae373d7d93) --- sys/dev/e1000/e1000_ich8lan.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index b29d53ea4b54..5d0c9fccf626 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -1307,6 +1307,10 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx) (E1000_READ_REG(hw, E1000_FEXT) & E1000_FEXT_PHY_CABLE_DISCONNECTED) ? "" : "not", i * 50); + if (!(E1000_READ_REG(hw, E1000_FEXT) & + E1000_FEXT_PHY_CABLE_DISCONNECTED)) + return 0; + } ret_val = hw->phy.ops.acquire(hw); From owner-dev-commits-src-all@freebsd.org Fri Sep 24 02:18:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A5B66B3C3B; Fri, 24 Sep 2021 02:18: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 4HFwgD1WSNz3N2M; Fri, 24 Sep 2021 02:18: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 004BE64C9; Fri, 24 Sep 2021 02:18: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 18O2IFPk083882; Fri, 24 Sep 2021 02:18:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O2IFWx083881; Fri, 24 Sep 2021 02:18:15 GMT (envelope-from git) Date: Fri, 24 Sep 2021 02:18:15 GMT Message-Id: <202109240218.18O2IFWx083881@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: f9e28f900353 - main - unionfs: lock newly-created vnodes before calling insmntque() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f9e28f900353ca8681fa1815afaebaca16ef254b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 02:18:16 -0000 The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=f9e28f900353ca8681fa1815afaebaca16ef254b commit f9e28f900353ca8681fa1815afaebaca16ef254b Author: Jason A. Harmening AuthorDate: 2021-09-12 05:43:57 +0000 Commit: Jason A. Harmening CommitDate: 2021-09-24 02:20:30 +0000 unionfs: lock newly-created vnodes before calling insmntque() This fixes an insta-panic when attempting to use unionfs with DEBUG_VFS_LOCKS. Note that unionfs still has a long way to go before it's generally stable or usable. Reviewed by: kib (prior version), markj Tested by: pho Differential Revision: https://reviews.freebsd.org/D31917 --- sys/fs/unionfs/union_subr.c | 86 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 68 insertions(+), 18 deletions(-) diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 5cb27dc94d55..dcdb41e55258 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -243,6 +243,49 @@ unionfs_rem_cached_vnode(struct unionfs_node *unp, struct vnode *dvp) VI_UNLOCK(dvp); } +/* + * Common cleanup handling for unionfs_nodeget + * Upper, lower, and parent directory vnodes are expected to be referenced by + * the caller. Upper and lower vnodes, if non-NULL, are also expected to be + * exclusively locked by the caller. + * This function will return with the caller's locks and references undone. + */ +static void +unionfs_nodeget_cleanup(struct vnode *vp, void *arg) +{ + struct unionfs_node *unp; + + /* + * Lock and reset the default vnode lock; vgone() expects a locked + * vnode, and we're going to reset the vnode ops. + */ + lockmgr(&vp->v_lock, LK_EXCLUSIVE, NULL); + + /* + * Clear out private data and reset the vnode ops to avoid use of + * unionfs vnode ops on a partially constructed vnode. + */ + VI_LOCK(vp); + vp->v_data = NULL; + vp->v_vnlock = &vp->v_lock; + vp->v_op = &dead_vnodeops; + VI_UNLOCK(vp); + vgone(vp); + vput(vp); + + unp = arg; + if (unp->un_dvp != NULLVP) + vrele(unp->un_dvp); + if (unp->un_uppervp != NULLVP) + vput(unp->un_uppervp); + if (unp->un_lowervp != NULLVP) + vput(unp->un_lowervp); + if (unp->un_hashtbl != NULL) + hashdestroy(unp->un_hashtbl, M_UNIONFSHASH, unp->un_hashmask); + free(unp->un_path, M_UNIONFSPATH); + free(unp, M_UNIONFSNODE); +} + /* * Make a new or get existing unionfs node. * @@ -263,6 +306,7 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, int lkflags; enum vtype vt; + error = 0; ump = MOUNTTOUNIONFSMOUNT(mp); lkflags = (cnp ? cnp->cn_lkflags : 0); path = (cnp ? cnp->cn_nameptr : NULL); @@ -301,11 +345,6 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, free(unp, M_UNIONFSNODE); return (error); } - error = insmntque(vp, mp); /* XXX: Too early for mpsafe fs */ - if (error != 0) { - free(unp, M_UNIONFSNODE); - return (error); - } if (dvp != NULLVP) vref(dvp); if (uppervp != NULLVP) @@ -340,24 +379,35 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, (lowervp != NULLVP && ump->um_lowervp == lowervp)) vp->v_vflag |= VV_ROOT; + vn_lock_pair(lowervp, false, uppervp, false); + error = insmntque1(vp, mp, unionfs_nodeget_cleanup, unp); + if (error != 0) + return (error); + if (lowervp != NULL && VN_IS_DOOMED(lowervp)) { + vput(lowervp); + unp->un_lowervp = NULL; + } + if (uppervp != NULL && VN_IS_DOOMED(uppervp)) { + vput(uppervp); + unp->un_uppervp = NULL; + } + if (unp->un_lowervp == NULL && unp->un_uppervp == NULL) { + unionfs_nodeget_cleanup(vp, unp); + return (ENOENT); + } if (path != NULL && dvp != NULLVP && vt == VDIR) *vpp = unionfs_ins_cached_vnode(unp, dvp, path); - if ((*vpp) != NULLVP) { - if (dvp != NULLVP) - vrele(dvp); - if (uppervp != NULLVP) - vrele(uppervp); - if (lowervp != NULLVP) - vrele(lowervp); - - unp->un_uppervp = NULLVP; - unp->un_lowervp = NULLVP; - unp->un_dvp = NULLVP; - vrele(vp); + if (*vpp != NULLVP) { + unionfs_nodeget_cleanup(vp, unp); vp = *vpp; vref(vp); - } else + } else { + if (uppervp != NULL) + VOP_UNLOCK(uppervp); + if (lowervp != NULL) + VOP_UNLOCK(lowervp); *vpp = vp; + } unionfs_nodeget_out: if (lkflags & LK_TYPE_MASK) From owner-dev-commits-src-all@freebsd.org Fri Sep 24 07:35:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5AFEE6B7A35; Fri, 24 Sep 2021 07:35:10 +0000 (UTC) (envelope-from hselasky@freebsd.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HG3ht1GRNz4RKX; Fri, 24 Sep 2021 07:35:10 +0000 (UTC) (envelope-from hselasky@freebsd.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 24CE3260196; Fri, 24 Sep 2021 09:35:09 +0200 (CEST) Subject: Re: git: 903873ce1560 - main - Implement and use new mixer(3) library for FreeBSD. To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202109221803.18MI3gdA013391@gitrepo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Fri, 24 Sep 2021 09:34:55 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HG3ht1GRNz4RKX X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 07:35:10 -0000 On 9/24/21 2:46 AM, Konstantin Belousov wrote: > On Wed, Sep 22, 2021 at 06:03:42PM +0000, Hans Petter Selasky wrote: >> The branch main has been updated by hselasky: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=903873ce15600fc02a0ea42cbf888cff232b411d >> >> commit 903873ce15600fc02a0ea42cbf888cff232b411d >> Author: Hans Petter Selasky >> AuthorDate: 2021-09-22 13:42:51 +0000 >> Commit: Hans Petter Selasky >> CommitDate: 2021-09-22 17:43:56 +0000 >> >> Implement and use new mixer(3) library for FreeBSD. >> >> Wiki article: https://wiki.freebsd.org/SummerOfCode2021Projects/SoundMixerImprovements >> This project was part of Google Summer of Code 2021. >> >> Submitted by: christos@ >> Differential Revision: https://reviews.freebsd.org/D31636 >> Sponsored by: NVIDIA Networking > > This library is supposed to be used by user' applications, right? > If yes, it is highly desirable to provide symbol versioning from the > start. Yes. --HPS From owner-dev-commits-src-all@freebsd.org Fri Sep 24 08:28:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F0E6668674; Fri, 24 Sep 2021 08:28: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 4HG4tQ71x3z4XLL; Fri, 24 Sep 2021 08:28:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD19F130EA; Fri, 24 Sep 2021 08:28: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 18O8SURU075242; Fri, 24 Sep 2021 08:28:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O8SU4l075240; Fri, 24 Sep 2021 08:28:30 GMT (envelope-from git) Date: Fri, 24 Sep 2021 08:28:30 GMT Message-Id: <202109240828.18O8SU4l075240@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 4f3376951d70 - main - ipsec: Add PMTUD support for IPsec IPv4 over IPv6 tunnel MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4f3376951d7024d1c3446af2260cef9e4d3404a6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 08:28:31 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=4f3376951d7024d1c3446af2260cef9e4d3404a6 commit 4f3376951d7024d1c3446af2260cef9e4d3404a6 Author: Bartlomiej Grzesik AuthorDate: 2021-09-24 08:17:11 +0000 Commit: Wojciech Macek CommitDate: 2021-09-24 08:17:11 +0000 ipsec: Add PMTUD support for IPsec IPv4 over IPv6 tunnel Add support for checking PMTU for IPv4 packets encapsulated in IPv6 tunnels. Differential revision: https://reviews.freebsd.org/D31769 Sponsored by: Stormshield Obtained from: Semihalf --- sys/netipsec/ipsec_output.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c index 2f8cc12c526b..50bbd72f0589 100644 --- a/sys/netipsec/ipsec_output.c +++ b/sys/netipsec/ipsec_output.c @@ -305,7 +305,6 @@ ipsec4_check_pmtu(struct mbuf *m, struct secpolicy *sp, int forwarding) uint32_t idx; int error; - /* Don't check PMTU if the frame won't have DF bit set. */ if (!V_ip4_ipsec_dfbit) return (0); @@ -335,15 +334,22 @@ setdf: } dst = &sav->sah->saidx.dst; - - /* Final header is not ipv4. */ - if (dst->sa.sa_family != AF_INET) { + memset(&inc, 0, sizeof(inc)); + switch (dst->sa.sa_family) { + case AF_INET: + inc.inc_faddr = satosin(&dst->sa)->sin_addr; + break; +#ifdef INET6 + case AF_INET6: + inc.inc6_faddr = satosin6(&dst->sa)->sin6_addr; + inc.inc_flags |= INC_ISIPV6; + break; +#endif + default: key_freesav(&sav); return (0); } - memset(&inc, 0, sizeof(inc)); - inc.inc_faddr = satosin(&dst->sa)->sin_addr; key_freesav(&sav); pmtu = tcp_hc_getmtu(&inc); /* No entry in hostcache. */ From owner-dev-commits-src-all@freebsd.org Fri Sep 24 08:28:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2ECAE66899C; Fri, 24 Sep 2021 08:28: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 4HG4tS0hwYz4XJT; Fri, 24 Sep 2021 08:28: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 E8D2D135BE; Fri, 24 Sep 2021 08:28: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 18O8SVQJ075268; Fri, 24 Sep 2021 08:28:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O8SVQY075267; Fri, 24 Sep 2021 08:28:31 GMT (envelope-from git) Date: Fri, 24 Sep 2021 08:28:31 GMT Message-Id: <202109240828.18O8SVQY075267@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: b4220bf387e6 - main - ipsec: If no PMTU in hostcache assume it's equal to link's MTU MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b4220bf387e62f59d73308f122f5eea887a59d58 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 08:28:32 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=b4220bf387e62f59d73308f122f5eea887a59d58 commit b4220bf387e62f59d73308f122f5eea887a59d58 Author: Bartlomiej Grzesik AuthorDate: 2021-09-24 08:25:53 +0000 Commit: Wojciech Macek CommitDate: 2021-09-24 08:25:53 +0000 ipsec: If no PMTU in hostcache assume it's equal to link's MTU If we fail to find to PMTU in hostcache, we assume it's equal to link's MTU. This patch prevents packets larger then link's MTU to be dropped silently if there is no PMTU in hostcache. Differential revision: https://reviews.freebsd.org/D31770 Obtained from: Semihalf Sponsored by: Stormshield --- sys/netipsec/ipsec_output.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c index 50bbd72f0589..c4e34665b8f5 100644 --- a/sys/netipsec/ipsec_output.c +++ b/sys/netipsec/ipsec_output.c @@ -352,15 +352,29 @@ setdf: key_freesav(&sav); pmtu = tcp_hc_getmtu(&inc); - /* No entry in hostcache. */ - if (pmtu == 0) - return (0); + /* No entry in hostcache. Use link MTU instead. */ + if (pmtu == 0) { + switch (dst->sa.sa_family) { + case AF_INET: + pmtu = tcp_maxmtu(&inc, NULL); + break; +#ifdef INET6 + case AF_INET6: + pmtu = tcp_maxmtu6(&inc, NULL); + break; +#endif + } + if (pmtu == 0) + return (0); + + tcp_hc_updatemtu(&inc, pmtu); + } hlen = ipsec_hdrsiz_internal(sp); if (m_length(m, NULL) + hlen > pmtu) { /* * If we're forwarding generate ICMP message here, - * so that it contains pmtu and not link mtu. + * so that it contains pmtu substraced by header size. * Set error to EINPROGRESS, in order for the frame * to be dropped silently. */ From owner-dev-commits-src-all@freebsd.org Fri Sep 24 08:28:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85BAE66899F; Fri, 24 Sep 2021 08:28: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 4HG4tT2FrQz4XX3; Fri, 24 Sep 2021 08:28: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 1121E134B3; Fri, 24 Sep 2021 08:28: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 18O8SWlB075292; Fri, 24 Sep 2021 08:28:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O8SWBZ075291; Fri, 24 Sep 2021 08:28:32 GMT (envelope-from git) Date: Fri, 24 Sep 2021 08:28:32 GMT Message-Id: <202109240828.18O8SWBZ075291@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 9dfc8606eb80 - main - ipsec: Add support for PMTUD for IPv6 tunnels MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9dfc8606eb80a49a0b071ff17dbbfa307d7248be Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 08:28:33 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=9dfc8606eb80a49a0b071ff17dbbfa307d7248be commit 9dfc8606eb80a49a0b071ff17dbbfa307d7248be Author: Bartlomiej Grzesik AuthorDate: 2021-09-24 08:27:21 +0000 Commit: Wojciech Macek CommitDate: 2021-09-24 08:27:21 +0000 ipsec: Add support for PMTUD for IPv6 tunnels Discard and send ICMPv6 Packet Too Big to sender when we try to encapsulate and forward a packet which total length exceeds the PMTU. Logic is based on the IPv4 implementation. Common code was moved to a separate function. Differential revision: https://reviews.freebsd.org/D31771 Obtained from: Semihalf Sponsored by: Stormshield --- sys/netipsec/ipsec6.h | 1 + sys/netipsec/ipsec_output.c | 166 +++++++++++++++++++++++++++++++++++--------- 2 files changed, 133 insertions(+), 34 deletions(-) diff --git a/sys/netipsec/ipsec6.h b/sys/netipsec/ipsec6.h index aaba405ce0db..f690102fae2b 100644 --- a/sys/netipsec/ipsec6.h +++ b/sys/netipsec/ipsec6.h @@ -74,6 +74,7 @@ int ipsec6_output(struct mbuf *, struct inpcb *); int ipsec6_capability(struct mbuf *, u_int); int ipsec6_common_input_cb(struct mbuf *, struct secasvar *, int, int); int ipsec6_ctlinput(int, struct sockaddr *, void *); +int ipsec6_check_pmtu(struct mbuf *, struct secpolicy *, int); int ipsec6_process_packet(struct mbuf *, struct secpolicy *, struct inpcb *); int ip6_ipsec_filtertunnel(struct mbuf *); diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c index c4e34665b8f5..9beb5c47444f 100644 --- a/sys/netipsec/ipsec_output.c +++ b/sys/netipsec/ipsec_output.c @@ -106,6 +106,7 @@ } while (0) static int ipsec_encap(struct mbuf **mp, struct secasindex *saidx); +static size_t ipsec_get_pmtu(struct secasvar *sav); #ifdef INET static struct secasvar * @@ -297,8 +298,6 @@ ipsec4_process_packet(struct mbuf *m, struct secpolicy *sp, int ipsec4_check_pmtu(struct mbuf *m, struct secpolicy *sp, int forwarding) { - union sockaddr_union *dst; - struct in_conninfo inc; struct secasvar *sav; struct ip *ip; size_t hlen, pmtu; @@ -333,44 +332,15 @@ setdf: return (error); } - dst = &sav->sah->saidx.dst; - memset(&inc, 0, sizeof(inc)); - switch (dst->sa.sa_family) { - case AF_INET: - inc.inc_faddr = satosin(&dst->sa)->sin_addr; - break; -#ifdef INET6 - case AF_INET6: - inc.inc6_faddr = satosin6(&dst->sa)->sin6_addr; - inc.inc_flags |= INC_ISIPV6; - break; -#endif - default: + pmtu = ipsec_get_pmtu(sav); + if (pmtu == 0) { key_freesav(&sav); return (0); } + hlen = ipsec_hdrsiz_internal(sp); key_freesav(&sav); - pmtu = tcp_hc_getmtu(&inc); - /* No entry in hostcache. Use link MTU instead. */ - if (pmtu == 0) { - switch (dst->sa.sa_family) { - case AF_INET: - pmtu = tcp_maxmtu(&inc, NULL); - break; -#ifdef INET6 - case AF_INET6: - pmtu = tcp_maxmtu6(&inc, NULL); - break; -#endif - } - if (pmtu == 0) - return (0); - - tcp_hc_updatemtu(&inc, pmtu); - } - hlen = ipsec_hdrsiz_internal(sp); if (m_length(m, NULL) + hlen > pmtu) { /* * If we're forwarding generate ICMP message here, @@ -720,6 +690,72 @@ ipsec6_process_packet(struct mbuf *m, struct secpolicy *sp, return (ipsec6_perform_request(m, sp, inp, 0)); } +/* + * IPv6 implementation is based on IPv4 implementation. + */ +int +ipsec6_check_pmtu(struct mbuf *m, struct secpolicy *sp, int forwarding) +{ + struct secasvar *sav; + size_t hlen, pmtu; + uint32_t idx; + int error; + + /* + * According to RFC8200 L3 fragmentation is supposed to be done only on + * locally generated packets. During L3 forwarding packets that are too + * big are always supposed to be dropped, with an ICMPv6 packet being + * sent back. + */ + if (!forwarding) + return (0); + + idx = sp->tcount - 1; + sav = ipsec6_allocsa(m, sp, &idx, &error); + if (sav == NULL) { + key_freesp(&sp); + /* + * No matching SA was found and SADB_ACQUIRE message was generated. + * Since we have matched a SP to this packet drop it silently. + */ + if (error == 0) + error = EINPROGRESS; + if (error != EJUSTRETURN) + m_freem(m); + + return (error); + } + + pmtu = ipsec_get_pmtu(sav); + if (pmtu == 0) { + key_freesav(&sav); + return (0); + } + + hlen = ipsec_hdrsiz_internal(sp); + key_freesav(&sav); + + if (m_length(m, NULL) + hlen > pmtu) { + /* + * If we're forwarding generate ICMPv6 message here, + * so that it contains pmtu substracted by header size. + * Set error to EINPROGRESS, in order for the frame + * to be dropped silently. + */ + if (forwarding) { + if (pmtu > hlen) + icmp6_error(m, ICMP6_PACKET_TOO_BIG, 0, pmtu - hlen); + else + m_freem(m); + + key_freesp(&sp); + return (EINPROGRESS); /* Pretend that we consumed it. */ + } + } + + return (0); +} + static int ipsec6_common_output(struct mbuf *m, struct inpcb *inp, int forwarding) { @@ -766,6 +802,15 @@ ipsec6_common_output(struct mbuf *m, struct inpcb *inp, int forwarding) } #endif } + + error = ipsec6_check_pmtu(m, sp, forwarding); + if (error != 0) { + if (error == EJUSTRETURN) + return (0); + + return (error); + } + /* NB: callee frees mbuf and releases reference to SP */ error = ipsec6_process_packet(m, sp, inp); if (error == EJUSTRETURN) { @@ -1001,6 +1046,59 @@ ipsec_prepend(struct mbuf *m, int len, int how) return (n); } +static size_t +ipsec_get_pmtu(struct secasvar *sav) +{ + union sockaddr_union *dst; + struct in_conninfo inc; + size_t pmtu; + + dst = &sav->sah->saidx.dst; + memset(&inc, 0, sizeof(inc)); + + switch (dst->sa.sa_family) { +#ifdef INET + case AF_INET: + inc.inc_faddr = satosin(&dst->sa)->sin_addr; + break; +#endif +#ifdef INET6 + case AF_INET6: + inc.inc6_faddr = satosin6(&dst->sa)->sin6_addr; + inc.inc_flags |= INC_ISIPV6; + break; +#endif + default: + return (0); + } + + pmtu = tcp_hc_getmtu(&inc); + if (pmtu != 0) + return (pmtu); + + /* No entry in hostcache. Assume that PMTU is equal to link's MTU */ + switch (dst->sa.sa_family) { +#ifdef INET + case AF_INET: + pmtu = tcp_maxmtu(&inc, NULL); + break; +#endif +#ifdef INET6 + case AF_INET6: + pmtu = tcp_maxmtu6(&inc, NULL); + break; +#endif + default: + return (0); + } + if (pmtu == 0) + return (0); + + tcp_hc_updatemtu(&inc, pmtu); + + return (pmtu); +} + static int ipsec_encap(struct mbuf **mp, struct secasindex *saidx) { From owner-dev-commits-src-all@freebsd.org Fri Sep 24 09:43:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3788C6697FB; Fri, 24 Sep 2021 09:43: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 4HG6YP18Xyz4crG; Fri, 24 Sep 2021 09:43: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 074F81482B; Fri, 24 Sep 2021 09:43: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 18O9hqiD081115; Fri, 24 Sep 2021 09:43:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O9hqfx081114; Fri, 24 Sep 2021 09:43:52 GMT (envelope-from git) Date: Fri, 24 Sep 2021 09:43:52 GMT Message-Id: <202109240943.18O9hqfx081114@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: cc1ce085b81f - main - man dummynet: point to dnctl instead of ipfw MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cc1ce085b81fbaec4ec0ddcafccc8793da032106 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 09:43:53 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=cc1ce085b81fbaec4ec0ddcafccc8793da032106 commit cc1ce085b81fbaec4ec0ddcafccc8793da032106 Author: Kristof Provost AuthorDate: 2021-09-10 09:50:55 +0000 Commit: Kristof Provost CommitDate: 2021-09-24 09:41:25 +0000 man dummynet: point to dnctl instead of ipfw Dummynet configuration is ideally done through dnctl now. While ipfw still works dnctl is preferred now that dummynet can also be used with pf. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31902 --- share/man/man4/dummynet.4 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/share/man/man4/dummynet.4 b/share/man/man4/dummynet.4 index 65571b3dde1f..34655f3a31d2 100644 --- a/share/man/man4/dummynet.4 +++ b/share/man/man4/dummynet.4 @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 28, 2002 +.Dd September 10, 2021 .Dt DUMMYNET 4 .Os .Sh NAME @@ -18,9 +18,9 @@ management policies, and emulating delays and losses. The user interface for .Nm is implemented by the -.Xr ipfw 8 +.Xr dnctl 8 utility, so please refer to the -.Xr ipfw 8 +.Xr dnctl 8 manpage for a complete description of the .Nm capabilities and how to use it. @@ -61,6 +61,7 @@ pipes. .Xr if_bridge 4 , .Xr ip 4 , .Xr ipfw 8 , +.Xr dnctl 8 , .Xr sysctl 8 .Sh HISTORY The From owner-dev-commits-src-all@freebsd.org Fri Sep 24 09:43:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A0B8669EAD; Fri, 24 Sep 2021 09:43:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HG6YQ2W8fz4d27; Fri, 24 Sep 2021 09:43:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29BEB1471F; Fri, 24 Sep 2021 09:43: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 18O9hsSv081139; Fri, 24 Sep 2021 09:43:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O9hsMS081138; Fri, 24 Sep 2021 09:43:54 GMT (envelope-from git) Date: Fri, 24 Sep 2021 09:43:54 GMT Message-Id: <202109240943.18O9hsMS081138@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 8160a0f62be6 - main - dummynet: Does not depend on ipfw MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8160a0f62be6dd778172520f253ba057971a8122 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 09:43:54 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8160a0f62be6dd778172520f253ba057971a8122 commit 8160a0f62be6dd778172520f253ba057971a8122 Author: Kristof Provost AuthorDate: 2021-05-13 13:56:50 +0000 Commit: Kristof Provost CommitDate: 2021-09-24 09:41:25 +0000 dummynet: Does not depend on ipfw Allow the dummynet module to be loaded without ipfw, as a first step towards making pf use it for packet scheduling. Reviewed by: donner Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31903 --- sys/netpfil/ipfw/ip_dummynet.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/netpfil/ipfw/ip_dummynet.c b/sys/netpfil/ipfw/ip_dummynet.c index d3242fd85817..a890507f7b31 100644 --- a/sys/netpfil/ipfw/ip_dummynet.c +++ b/sys/netpfil/ipfw/ip_dummynet.c @@ -2735,7 +2735,6 @@ static moduledata_t dummynet_mod = { #define DN_SI_SUB SI_SUB_PROTO_FIREWALL #define DN_MODEV_ORD (SI_ORDER_ANY - 128) /* after ipfw */ DECLARE_MODULE(dummynet, dummynet_mod, DN_SI_SUB, DN_MODEV_ORD); -MODULE_DEPEND(dummynet, ipfw, 3, 3, 3); MODULE_VERSION(dummynet, 3); /* From owner-dev-commits-src-all@freebsd.org Fri Sep 24 09:43:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CEEF3669BB6; Fri, 24 Sep 2021 09:43: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 4HG6YR2yFYz4clc; Fri, 24 Sep 2021 09:43: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 3D29614445; Fri, 24 Sep 2021 09:43: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 18O9htOA081163; Fri, 24 Sep 2021 09:43:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O9htUL081162; Fri, 24 Sep 2021 09:43:55 GMT (envelope-from git) Date: Fri, 24 Sep 2021 09:43:55 GMT Message-Id: <202109240943.18O9htUL081162@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 63b3c1c77036 - main - pf: support dummynet MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 63b3c1c77036814c85d36fe7a48c704db7c6fc9c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 09:43:55 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=63b3c1c77036814c85d36fe7a48c704db7c6fc9c commit 63b3c1c77036814c85d36fe7a48c704db7c6fc9c Author: Kristof Provost AuthorDate: 2021-05-15 11:49:22 +0000 Commit: Kristof Provost CommitDate: 2021-09-24 09:41:25 +0000 pf: support dummynet Allow pf to use dummynet pipes and queues. We re-use the currently unused IPFW_IS_DUMMYNET flag to allow dummynet to tell us that a packet is being re-injected after being delayed. This is needed to avoid endlessly looping the packet between pf and dummynet. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31904 --- lib/libpfctl/libpfctl.c | 6 ++ lib/libpfctl/libpfctl.h | 3 + sbin/pfctl/parse.y | 41 ++++++++++ sbin/pfctl/pfctl_parser.c | 9 +++ sys/net/pfvar.h | 10 +++ sys/netpfil/ipfw/ip_dn_io.c | 3 +- sys/netpfil/pf/pf.c | 182 +++++++++++++++++++++++++++++++++++++++++++- sys/netpfil/pf/pf_nv.c | 6 ++ 8 files changed, 256 insertions(+), 4 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 3d52502f9ba8..576b256155fb 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -480,6 +480,9 @@ pf_nvrule_to_rule(const nvlist_t *nvl, struct pfctl_rule *rule) nvlist_get_number(nvl, "max_src_conn_rate.seconds"); rule->qid = nvlist_get_number(nvl, "qid"); rule->pqid = nvlist_get_number(nvl, "pqid"); + rule->dnpipe = nvlist_get_number(nvl, "dnpipe"); + rule->dnrpipe = nvlist_get_number(nvl, "dnrpipe"); + rule->free_flags = nvlist_get_number(nvl, "dnflags"); rule->prob = nvlist_get_number(nvl, "prob"); rule->cuid = nvlist_get_number(nvl, "cuid"); rule->cpid = nvlist_get_number(nvl, "cpid"); @@ -584,6 +587,9 @@ pfctl_add_rule(int dev, const struct pfctl_rule *r, const char *anchor, r->max_src_conn_rate.limit); nvlist_add_number(nvlr, "max_src_conn_rate.seconds", r->max_src_conn_rate.seconds); + nvlist_add_number(nvlr, "dnpipe", r->dnpipe); + nvlist_add_number(nvlr, "dnrpipe", r->dnrpipe); + nvlist_add_number(nvlr, "dnflags", r->free_flags); nvlist_add_number(nvlr, "prob", r->prob); nvlist_add_number(nvlr, "cuid", r->cuid); nvlist_add_number(nvlr, "cpid", r->cpid); diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 70de7627f0a6..f57497b4a88a 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -114,6 +114,9 @@ struct pfctl_rule { } max_src_conn_rate; u_int32_t qid; u_int32_t pqid; + u_int16_t dnpipe; + u_int16_t dnrpipe; + u_int32_t free_flags; u_int32_t nr; u_int32_t prob; uid_t cuid; diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index dbfe299cf34f..6bcf5a0bc397 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -248,6 +248,9 @@ static struct filter_opts { char *tag; char *match_tag; u_int8_t match_tag_not; + u_int16_t dnpipe; + u_int16_t dnrpipe; + u_int32_t free_flags; u_int rtableid; u_int8_t prio; u_int8_t set_prio[2]; @@ -468,6 +471,7 @@ int parseport(char *, struct range *r, int); %token BITMASK RANDOM SOURCEHASH ROUNDROBIN STATICPORT PROBABILITY MAPEPORTSET %token ALTQ CBQ CODEL PRIQ HFSC FAIRQ BANDWIDTH TBRSIZE LINKSHARE REALTIME %token UPPERLIMIT QUEUE PRIORITY QLIMIT HOGS BUCKETS RTABLE TARGET INTERVAL +%token DNPIPE DNQUEUE %token LOAD RULESET_OPTIMIZATION PRIO %token STICKYADDRESS MAXSRCSTATES MAXSRCNODES SOURCETRACK GLOBAL RULE %token MAXSRCCONN MAXSRCCONNRATE OVERLOAD FLUSH SLOPPY @@ -2464,6 +2468,15 @@ pfrule : action dir logquick interface route af proto fromto } #endif + if ($9.dnpipe || $9.dnrpipe) { + r.dnpipe = $9.dnpipe; + r.dnrpipe = $9.dnrpipe; + if ($9.free_flags & PFRULE_DN_IS_PIPE) + r.free_flags |= PFRULE_DN_IS_PIPE; + else + r.free_flags |= PFRULE_DN_IS_QUEUE; + } + expand_rule(&r, $4, $5.host, $7, $8.src_os, $8.src.host, $8.src.port, $8.dst.host, $8.dst.port, $9.uid, $9.gid, $9.icmpspec, ""); @@ -2565,6 +2578,32 @@ filter_opt : USER uids { } filter_opts.queues = $1; } + | DNPIPE number { + filter_opts.dnpipe = $2; + filter_opts.free_flags |= PFRULE_DN_IS_PIPE; + } + | DNPIPE '(' number ')' { + filter_opts.dnpipe = $3; + filter_opts.free_flags |= PFRULE_DN_IS_PIPE; + } + | DNPIPE '(' number comma number ')' { + filter_opts.dnrpipe = $5; + filter_opts.dnpipe = $3; + filter_opts.free_flags |= PFRULE_DN_IS_PIPE; + } + | DNQUEUE number { + filter_opts.dnpipe = $2; + filter_opts.free_flags |= PFRULE_DN_IS_QUEUE; + } + | DNQUEUE '(' number comma number ')' { + filter_opts.dnrpipe = $5; + filter_opts.dnpipe = $3; + filter_opts.free_flags |= PFRULE_DN_IS_QUEUE; + } + | DNQUEUE '(' number ')' { + filter_opts.dnpipe = $3; + filter_opts.free_flags |= PFRULE_DN_IS_QUEUE; + } | TAG string { filter_opts.tag = $2; } @@ -5592,6 +5631,8 @@ lookup(char *s) { "debug", DEBUG}, { "divert-reply", DIVERTREPLY}, { "divert-to", DIVERTTO}, + { "dnpipe", DNPIPE}, + { "dnqueue", DNQUEUE}, { "drop", DROP}, { "drop-ovl", FRAGDROP}, { "dup-to", DUPTO}, diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 89c9bc349ca3..131ad22123e2 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1018,6 +1018,15 @@ print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numer i = 0; while (r->label[i][0]) printf(" label \"%s\"", r->label[i++]); + /* Only dnrpipe as we might do (0, 42) to only queue return traffic. */ + if (r->dnrpipe) + printf(" %s(%d, %d)", + r->free_flags & PFRULE_DN_IS_PIPE ? "dnpipe" : "dnqueue", + r->dnpipe, r->dnrpipe); + else if (r->dnpipe) + printf(" %s %d", + r->free_flags & PFRULE_DN_IS_PIPE ? "dnpipe" : "dnqueue", + r->dnpipe); if (r->qname[0] && r->pqname[0]) printf(" queue(%s, %s)", r->qname, r->pqname); else if (r->qname[0]) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 2c5c0037cb92..b2c177fba68c 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -563,6 +563,9 @@ struct pf_kpool { struct pf_rule_actions { uint16_t qid; uint16_t pqid; + uint16_t dnpipe; + uint16_t dnrpipe; /* Reverse direction pipe */ + uint32_t flags; }; union pf_krule_ptr { @@ -608,6 +611,9 @@ struct pf_krule { } max_src_conn_rate; u_int16_t qid; u_int16_t pqid; + u_int16_t dnpipe; + u_int16_t dnrpipe; + u_int32_t free_flags; u_int32_t nr; u_int32_t prob; uid_t cuid; @@ -755,6 +761,8 @@ struct pf_state_cmp { /* was PFSTATE_PFLOW 0x04 */ #define PFSTATE_NOSYNC 0x08 #define PFSTATE_ACK 0x10 +#define PFRULE_DN_IS_PIPE 0x40 +#define PFRULE_DN_IS_QUEUE 0x80 #define PFSTATE_SETPRIO 0x0200 #define PFSTATE_SETMASK (PFSTATE_SETPRIO) @@ -858,6 +866,8 @@ struct pf_kstate { u_int32_t pfsync_time; u_int16_t qid; u_int16_t pqid; + u_int16_t dnpipe; + u_int16_t dnrpipe; u_int16_t tag; u_int8_t log; }; diff --git a/sys/netpfil/ipfw/ip_dn_io.c b/sys/netpfil/ipfw/ip_dn_io.c index dad5cb087b39..11ad498505f4 100644 --- a/sys/netpfil/ipfw/ip_dn_io.c +++ b/sys/netpfil/ipfw/ip_dn_io.c @@ -841,7 +841,8 @@ tag_mbuf(struct mbuf *m, int dir, struct ip_fw_args *fwa) m_tag_prepend(m, mtag); /* Attach to mbuf chain. */ dt = (struct dn_pkt_tag *)(mtag + 1); dt->rule = fwa->rule; - dt->rule.info &= IPFW_ONEPASS; /* only keep this info */ + /* only keep this info */ + dt->rule.info &= (IPFW_ONEPASS | IPFW_IS_DUMMYNET); dt->dn_dir = dir; dt->ifp = fwa->flags & IPFW_ARGS_OUT ? fwa->ifp : NULL; /* dt->output tame is updated as we move through */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 1d492370953a..ac329a37f7bd 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -94,6 +94,13 @@ __FBSDID("$FreeBSD$"); #include #include +/* dummynet */ +#include +#include +#include +#include +#include + #ifdef INET6 #include #include @@ -3310,6 +3317,12 @@ pf_rule_to_actions(struct pf_krule *r, struct pf_rule_actions *a) a->qid = r->qid; if (r->pqid) a->pqid = r->pqid; + if (r->dnpipe) + a->dnpipe = r->dnpipe; + if (r->dnrpipe) + a->dnpipe = r->dnrpipe; + if (r->free_flags & PFRULE_DN_IS_PIPE) + a->flags |= PFRULE_DN_IS_PIPE; } int @@ -3982,6 +3995,9 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, s->sync_state = PFSYNC_S_NONE; s->qid = pd->act.qid; s->pqid = pd->act.pqid; + s->dnpipe = pd->act.dnpipe; + s->dnrpipe = pd->act.dnrpipe; + s->state_flags |= pd->act.flags; if (nr != NULL) s->log |= nr->log & PF_LOG_ALL; switch (pd->proto) { @@ -6226,6 +6242,64 @@ pf_check_proto_cksum(struct mbuf *m, int off, int len, u_int8_t p, sa_family_t a return (0); } +static bool +pf_pdesc_to_dnflow(int dir, const struct pf_pdesc *pd, + const struct pf_krule *r, const struct pf_kstate *s, + struct ip_fw_args *dnflow) +{ + int dndir = r->direction; + + if (s && dndir == PF_INOUT) + dndir = s->direction; + + memset(dnflow, 0, sizeof(*dnflow)); + + if (pd->dport != NULL) + dnflow->f_id.dst_port = ntohs(*pd->dport); + if (pd->sport != NULL) + dnflow->f_id.src_port = ntohs(*pd->sport); + + if (dir == PF_IN) + dnflow->flags |= IPFW_ARGS_IN; + else + dnflow->flags |= IPFW_ARGS_OUT; + + if (dir != dndir && pd->act.dnrpipe) { + dnflow->rule.info = pd->act.dnrpipe; + } + else if (dir == dndir) { + dnflow->rule.info = pd->act.dnpipe; + } + else { + return (false); + } + + dnflow->rule.info |= IPFW_IS_DUMMYNET; + if (r->free_flags & PFRULE_DN_IS_PIPE) + dnflow->rule.info |= IPFW_IS_PIPE; + + dnflow->f_id.proto = pd->proto; + dnflow->f_id.extra = dnflow->rule.info; + switch (pd->af) { + case AF_INET: + dnflow->f_id.addr_type = 4; + dnflow->f_id.src_ip = ntohl(pd->src->v4.s_addr); + dnflow->f_id.dst_ip = ntohl(pd->dst->v4.s_addr); + break; + case AF_INET6: + dnflow->flags |= IPFW_ARGS_IP6; + dnflow->f_id.addr_type = 6; + dnflow->f_id.src_ip6 = pd->src->v6; + dnflow->f_id.dst_ip6 = pd->dst->v6; + break; + default: + panic("Invalid AF"); + break; + } + + return (true); +} + #ifdef INET int pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb *inp) @@ -6267,10 +6341,11 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * PF_RULES_RLOCK(); - if (__predict_false(ip_divert_ptr != NULL) && + if ((__predict_false(ip_divert_ptr != NULL) || ip_dn_io_ptr != NULL) && ((ipfwtag = m_tag_locate(m, MTAG_IPFW_RULE, 0, NULL)) != NULL)) { struct ipfw_rule_ref *rr = (struct ipfw_rule_ref *)(ipfwtag+1); - if (rr->info & IPFW_IS_DIVERT && rr->rulenum == 0) { + if ((rr->info & IPFW_IS_DIVERT && rr->rulenum == 0) || + (rr->info & IPFW_IS_DUMMYNET)) { if (pd.pf_mtag == NULL && ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { action = PF_DROP; @@ -6405,6 +6480,8 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * log = action != PF_PASS; goto done; } + pd.sport = &pd.hdr.udp.uh_sport; + pd.dport = &pd.hdr.udp.uh_dport; if (pd.hdr.udp.uh_dport == 0 || ntohs(pd.hdr.udp.uh_ulen) > m->m_pkthdr.len - off || ntohs(pd.hdr.udp.uh_ulen) < sizeof(struct udphdr)) { @@ -6524,6 +6601,47 @@ done: } #endif /* ALTQ */ + if (s && (s->dnpipe || s->dnrpipe)) { + pd.act.dnpipe = s->dnpipe; + pd.act.dnrpipe = s->dnrpipe; + pd.act.flags = s->state_flags; + } else if (r->dnpipe || r->dnrpipe) { + pd.act.dnpipe = r->dnpipe; + pd.act.dnrpipe = r->dnrpipe; + pd.act.flags = r->free_flags; + } + if ((pd.act.dnpipe || pd.act.dnrpipe) && !PACKET_LOOPED(&pd)) { + if (ip_dn_io_ptr == NULL) { + action = PF_DROP; + REASON_SET(&reason, PFRES_MEMORY); + } else { + struct ip_fw_args dnflow; + + if (pd.pf_mtag == NULL && + ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { + action = PF_DROP; + REASON_SET(&reason, PFRES_MEMORY); + if (s) + PF_STATE_UNLOCK(s); + return (action); + } + + if (pf_pdesc_to_dnflow(dir, &pd, r, s, &dnflow)) { + ip_dn_io_ptr(m0, &dnflow); + + if (*m0 == NULL) { + if (s) + PF_STATE_UNLOCK(s); + return (action); + } else { + /* This is dummynet fast io processing */ + m_tag_delete(*m0, m_tag_first(*m0)); + pd.pf_mtag->flags &= ~PF_PACKET_LOOPED; + } + } + } + } + /* * connections redirected to loopback should not match sockets * bound specifically to loopback due to security implications, @@ -6684,6 +6802,7 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb u_short action, reason = 0, log = 0; struct mbuf *m = *m0, *n = NULL; struct m_tag *mtag; + struct m_tag *ipfwtag; struct ip6_hdr *h = NULL; struct pf_krule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; struct pf_kstate *s = NULL; @@ -6719,7 +6838,19 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb PF_RULES_RLOCK(); /* We do IP header normalization and packet reassembly here */ - if (pf_normalize_ip6(m0, dir, kif, &reason, &pd) != PF_PASS) { + if (ip_dn_io_ptr != NULL && + ((ipfwtag = m_tag_locate(m, MTAG_IPFW_RULE, 0, NULL)) != NULL)) { + struct ipfw_rule_ref *rr = (struct ipfw_rule_ref *)(ipfwtag+1); + if (rr->info & IPFW_IS_DUMMYNET) { + if (pd.pf_mtag == NULL && + ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { + action = PF_DROP; + goto done; + } + pd.pf_mtag->flags |= PF_PACKET_LOOPED; + m_tag_delete(m, ipfwtag); + } + } else if (pf_normalize_ip6(m0, dir, kif, &reason, &pd) != PF_PASS) { action = PF_DROP; goto done; } @@ -6828,6 +6959,8 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb goto done; } pd.p_len = pd.tot_len - off - (pd.hdr.tcp.th_off << 2); + pd.sport = &pd.hdr.tcp.th_sport; + pd.dport = &pd.hdr.tcp.th_dport; action = pf_normalize_tcp(dir, kif, m, 0, off, h, &pd); if (action == PF_DROP) goto done; @@ -6851,6 +6984,8 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb log = action != PF_PASS; goto done; } + pd.sport = &pd.hdr.udp.uh_sport; + pd.dport = &pd.hdr.udp.uh_dport; if (pd.hdr.udp.uh_dport == 0 || ntohs(pd.hdr.udp.uh_ulen) > m->m_pkthdr.len - off || ntohs(pd.hdr.udp.uh_ulen) < sizeof(struct udphdr)) { @@ -6974,6 +7109,47 @@ done: } #endif /* ALTQ */ + if (s && (s->dnpipe || s->dnrpipe)) { + pd.act.dnpipe = s->dnpipe; + pd.act.dnrpipe = s->dnrpipe; + pd.act.flags = s->state_flags; + } else { + pd.act.dnpipe = r->dnpipe; + pd.act.dnrpipe = r->dnrpipe; + pd.act.flags = r->free_flags; + } + if ((pd.act.dnpipe || pd.act.dnrpipe) && !PACKET_LOOPED(&pd)) { + if (ip_dn_io_ptr == NULL) { + action = PF_DROP; + REASON_SET(&reason, PFRES_MEMORY); + } else { + struct ip_fw_args dnflow; + + if (pd.pf_mtag == NULL && + ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { + action = PF_DROP; + REASON_SET(&reason, PFRES_MEMORY); + if (s) + PF_STATE_UNLOCK(s); + return (action); + } + + if (pf_pdesc_to_dnflow(dir, &pd, r, s, &dnflow)) { + ip_dn_io_ptr(m0, &dnflow); + + if (*m0 == NULL) { + if (s) + PF_STATE_UNLOCK(s); + return (action); + } else { + /* This is dummynet fast io processing */ + m_tag_delete(*m0, m_tag_first(*m0)); + pd.pf_mtag->flags &= ~PF_PACKET_LOOPED; + } + } + } + } + if (dir == PF_IN && action == PF_PASS && (pd.proto == IPPROTO_TCP || pd.proto == IPPROTO_UDP) && s != NULL && s->nat_rule.ptr != NULL && (s->nat_rule.ptr->action == PF_RDR || diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index d1eca90e0ee5..fb2bab77ad8f 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -527,6 +527,9 @@ pf_nvrule_to_krule(const nvlist_t *nvl, struct pf_krule *rule) sizeof(rule->pqname))); PFNV_CHK(pf_nvstring(nvl, "tagname", rule->tagname, sizeof(rule->tagname))); + PFNV_CHK(pf_nvuint16_opt(nvl, "dnpipe", &rule->dnpipe, 0)); + PFNV_CHK(pf_nvuint16_opt(nvl, "dnrpipe", &rule->dnrpipe, 0)); + PFNV_CHK(pf_nvuint32_opt(nvl, "dnflags", &rule->free_flags, 0)); PFNV_CHK(pf_nvstring(nvl, "match_tagname", rule->match_tagname, sizeof(rule->match_tagname))); PFNV_CHK(pf_nvstring(nvl, "overload_tblname", rule->overload_tblname, @@ -687,6 +690,9 @@ pf_krule_to_nvrule(struct pf_krule *rule) nvlist_add_string(nvl, "ifname", rule->ifname); nvlist_add_string(nvl, "qname", rule->qname); nvlist_add_string(nvl, "pqname", rule->pqname); + nvlist_add_number(nvl, "dnpipe", rule->dnpipe); + nvlist_add_number(nvl, "dnrpipe", rule->dnrpipe); + nvlist_add_number(nvl, "dnflags", rule->free_flags); nvlist_add_string(nvl, "tagname", rule->tagname); nvlist_add_string(nvl, "match_tagname", rule->match_tagname); nvlist_add_string(nvl, "overload_tblname", rule->overload_tblname); From owner-dev-commits-src-all@freebsd.org Fri Sep 24 09:43:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5B09669BB9; Fri, 24 Sep 2021 09:43: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 4HG6YS41hQz4d32; Fri, 24 Sep 2021 09:43: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 5DF7014899; Fri, 24 Sep 2021 09:43: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 18O9huhJ081194; Fri, 24 Sep 2021 09:43:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O9huvv081193; Fri, 24 Sep 2021 09:43:56 GMT (envelope-from git) Date: Fri, 24 Sep 2021 09:43:56 GMT Message-Id: <202109240943.18O9huvv081193@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: ab55fa11b38f - main - netpfil tests: extend dummynet tests to pf MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ab55fa11b38f1794f39c2a94595b088e4c191cfb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 09:43:56 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ab55fa11b38f1794f39c2a94595b088e4c191cfb commit ab55fa11b38f1794f39c2a94595b088e4c191cfb Author: Kristof Provost AuthorDate: 2021-09-06 15:13:19 +0000 Commit: Kristof Provost CommitDate: 2021-09-24 09:41:25 +0000 netpfil tests: extend dummynet tests to pf Now that pf can also use dummynet we should extend the existing dummynet tests to also test it when used with pf. Reviewed by: donner MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31905 --- tests/sys/netpfil/common/dummynet.sh | 32 +++++++++++++++++++++++--------- tests/sys/netpfil/common/utils.subr | 9 ++++++--- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/tests/sys/netpfil/common/dummynet.sh b/tests/sys/netpfil/common/dummynet.sh index 7ff9a1e18fdc..644b36516b5a 100644 --- a/tests/sys/netpfil/common/dummynet.sh +++ b/tests/sys/netpfil/common/dummynet.sh @@ -53,7 +53,9 @@ pipe_body() firewall_config alcatraz ${fw} \ "ipfw" \ - "ipfw add 1000 pipe 1 ip from any to any" + "ipfw add 1000 pipe 1 ip from any to any" \ + "pf" \ + "pass dnpipe 1" # single ping succeeds just fine atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 @@ -95,7 +97,9 @@ pipe_v6_body() firewall_config alcatraz ${fw} \ "ipfw" \ - "ipfw add 1000 pipe 1 ip6 from any to any" + "ipfw add 1000 pipe 1 ip6 from any to any" \ + "pf" \ + "pass dnpipe 1" # Single ping succeeds atf_check -s exit:0 -o ignore ping6 -c 1 2001:db8:42::2 @@ -149,7 +153,10 @@ queue_body() "ipfw" \ "ipfw add 1000 queue 100 tcp from 192.0.2.2 to any out" \ "ipfw add 1001 queue 200 icmp from 192.0.2.2 to any out" \ - "ipfw add 1002 allow ip from any to any" + "ipfw add 1002 allow ip from any to any" \ + "pf" \ + "pass in proto tcp dnqueue (0, 100)" \ + "pass in proto icmp dnqueue (0, 200)" # Single ping succeeds atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 @@ -188,7 +195,10 @@ queue_body() "ipfw" \ "ipfw add 1000 queue 200 tcp from 192.0.2.2 to any out" \ "ipfw add 1001 queue 100 icmp from 192.0.2.2 to any out" \ - "ipfw add 1002 allow ip from any to any" + "ipfw add 1002 allow ip from any to any" \ + "pf" \ + "pass in proto tcp dnqueue (0, 200)" \ + "pass in proto icmp dnqueue (0, 100)" jexec alcatraz ping -f -s 1300 192.0.2.1 & sleep 1 @@ -253,8 +263,8 @@ queue_v6_body() "ipfw add 1000 queue 200 ipv6-icmp from 2001:db8:42::2 to any out" \ "ipfw add 1002 allow ip6 from any to any" \ "pf" \ - "pass out proto tcp dnqueue 100" \ - "pass out proto icmp6 dnqueue 200" + "pass in proto tcp dnqueue (0, 100)" \ + "pass in proto icmp6 dnqueue (0, 200)" # Single ping succeeds atf_check -s exit:0 -o ignore ping6 -c 1 2001:db8:42::2 @@ -295,8 +305,8 @@ queue_v6_body() "ipfw add 1000 queue 100 ipv6-icmp from 2001:db8:42::2 to any out" \ "ipfw add 1002 allow ip6 from any to any" \ "pf" \ - "pass out proto tcp dnqueue 200" \ - "pass out proto icmp6 dnqueue 100" + "pass in proto tcp dnqueue (0, 200)" \ + "pass in proto icmp6 dnqueue (0, 100)" fails=0 for i in `seq 1 3` @@ -322,9 +332,13 @@ queue_v6_cleanup() setup_tests \ pipe \ ipfw \ + pf \ pipe_v6 \ ipfw \ + pf \ queue \ ipfw \ + pf \ queue_v6 \ - ipfw + ipfw \ + pf diff --git a/tests/sys/netpfil/common/utils.subr b/tests/sys/netpfil/common/utils.subr index 722271981af4..43cd856b2e87 100644 --- a/tests/sys/netpfil/common/utils.subr +++ b/tests/sys/netpfil/common/utils.subr @@ -111,11 +111,14 @@ dummynet_init() atf_skip "This test requires dummynet" fi - if [ ${firewall} == "ipfw" ]; then + case $firewall in + ipfw|pf) # Nothing. This is okay. - else + ;; + *) atf_skip "${firewall} does not support dummynet" - fi + ;; + esac } nat_init() From owner-dev-commits-src-all@freebsd.org Fri Sep 24 09:43:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2AB93669AF3; Fri, 24 Sep 2021 09:43:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HG6YT4Jvvz4cv4; Fri, 24 Sep 2021 09:43: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 728361482C; Fri, 24 Sep 2021 09:43: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 18O9hvWO081218; Fri, 24 Sep 2021 09:43:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O9hvYk081217; Fri, 24 Sep 2021 09:43:57 GMT (envelope-from git) Date: Fri, 24 Sep 2021 09:43:57 GMT Message-Id: <202109240943.18O9hvYk081217@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: c8607bf4e7c1 - main - man dummynet: dummynet can also be used with pf MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c8607bf4e7c1c94e42377792570c6324cc580c1c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 09:43:58 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c8607bf4e7c1c94e42377792570c6324cc580c1c commit c8607bf4e7c1c94e42377792570c6324cc580c1c Author: Kristof Provost AuthorDate: 2021-09-10 11:03:24 +0000 Commit: Kristof Provost CommitDate: 2021-09-24 09:41:26 +0000 man dummynet: dummynet can also be used with pf MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31906 --- share/man/man4/dummynet.4 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/share/man/man4/dummynet.4 b/share/man/man4/dummynet.4 index 34655f3a31d2..ca5d33c51b73 100644 --- a/share/man/man4/dummynet.4 +++ b/share/man/man4/dummynet.4 @@ -31,8 +31,9 @@ operation: .Pp .Bl -tag -width ".Dv IPFIREWALL_VERBOSE_LIMIT" -offset indent -compact .It Dv IPFIREWALL -enable ipfirewall (required for -.Nm ) +enable ipfirewall (if +.Nm +is to be used with ipfw) .It Dv IPFIREWALL_VERBOSE enable firewall output .It Dv IPFIREWALL_VERBOSE_LIMIT @@ -62,6 +63,7 @@ pipes. .Xr ip 4 , .Xr ipfw 8 , .Xr dnctl 8 , +.Xr pf.conf 5 , .Xr sysctl 8 .Sh HISTORY The From owner-dev-commits-src-all@freebsd.org Fri Sep 24 09:43:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 071FE669A65; Fri, 24 Sep 2021 09:43: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 4HG6YV5zmLz4cXb; Fri, 24 Sep 2021 09:43: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 9EAAE143F7; Fri, 24 Sep 2021 09:43: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 18O9hwwS081242; Fri, 24 Sep 2021 09:43:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O9hw8U081241; Fri, 24 Sep 2021 09:43:58 GMT (envelope-from git) Date: Fri, 24 Sep 2021 09:43:58 GMT Message-Id: <202109240943.18O9hw8U081241@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 00a7a05bde84 - main - pf.conf.5: document dummynet support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 00a7a05bde8481a58860253daf86661372ae3b72 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 09:43:59 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=00a7a05bde8481a58860253daf86661372ae3b72 commit 00a7a05bde8481a58860253daf86661372ae3b72 Author: Kristof Provost AuthorDate: 2021-09-10 12:42:44 +0000 Commit: Kristof Provost CommitDate: 2021-09-24 09:41:26 +0000 pf.conf.5: document dummynet support MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31907 --- share/man/man5/pf.conf.5 | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index 7b97657d7d1c..1bc7f147e830 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -28,7 +28,7 @@ .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd April 19, 2021 +.Dd September 10, 2021 .Dt PF.CONF 5 .Os .Sh NAME @@ -772,7 +772,7 @@ much in the same way as works in the packet filter (see below). This mechanism should be used when it is necessary to exclude specific packets from broader scrub rules. -.Sh QUEUEING +.Sh QUEUEING with ALTQ The ALTQ system is currently not available in the GENERIC kernel nor as loadable modules. In order to use the herein after called queueing options one has to use a @@ -1104,6 +1104,33 @@ pass out on dc0 inet proto tcp from any to any port 22 \e pass out on dc0 inet proto tcp from any to any port 25 \e queue mail .Ed +.Sh QUEUEING with dummynet +Queueing can also be done with +.Xr dummynet 4 . +Queues and pipes can be created with +.Xr dnctl 8 . +.Pp +Packets can be assigned to queues and pipes using +.Ar dnqueue +and +.Ar dnpipe +respectively. +.Pp +Both +.Ar dnqueue +and +.Ar dnpipe +take either a single pipe or queue number or two numbers as arguments. +The first pipe or queue number will be used to shape the traffic in the rule +direction, the second will be used to shape the traffic in the reverse +direction. +If the rule does not specify a direction the first packet to create state will +be shaped according to the first number, and the response traffic according to +the second. +.Pp +If the +.Xr dummynet 4 +module is not loaded any traffic sent into a queue or pipe will be dropped. .Sh TRANSLATION Translation rules modify either the source or destination address of the packets associated with a stateful connection. @@ -1324,7 +1351,9 @@ rules in that parameters are set every time a packet matches the rule, not only on the last matching rule. For the following parameters, this means that the parameter effectively becomes "sticky" until explicitly overridden: -.Ar queue +.Ar queue , +.Ar dnpipe , +.Ar dnqueue . .It Ar pass The packet is passed; @@ -2941,7 +2970,9 @@ filteropt = user | group | flags | icmp-type | icmp6-type | "tos" tos | "label" string | "tag" string | [ ! ] "tagged" string | "set prio" ( number | "(" number [ [ "," ] number ] ")" ) | "queue" ( string | "(" string [ [ "," ] string ] ")" ) | - "rtable" number | "probability" number"%" | "prio" number + "rtable" number | "probability" number"%" | "prio" number | + "dnpipe" ( number | "(" number "," number ")" ) | + "dnqueue" ( number | "(" number "," number ")" ) nat-rule = [ "no" ] "nat" [ "pass" [ "log" [ "(" logopts ")" ] ] ] [ "on" ifspec ] [ af ] From owner-dev-commits-src-all@freebsd.org Fri Sep 24 12:28:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3ABAE66CCA9; Fri, 24 Sep 2021 12:28: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 4HGBCf192nz4mnG; Fri, 24 Sep 2021 12:28: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 0816B1691D; Fri, 24 Sep 2021 12:28: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 18OCSj0V093804; Fri, 24 Sep 2021 12:28:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OCSjXK093803; Fri, 24 Sep 2021 12:28:45 GMT (envelope-from git) Date: Fri, 24 Sep 2021 12:28:45 GMT Message-Id: <202109241228.18OCSjXK093803@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: de2a0fafe6f9 - main - cxgbe: fix LINT-NOIP builds MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: de2a0fafe6f96b57619988824b9525c8a9905cfb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 12:28:46 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=de2a0fafe6f96b57619988824b9525c8a9905cfb commit de2a0fafe6f96b57619988824b9525c8a9905cfb Author: Kristof Provost AuthorDate: 2021-09-24 08:31:27 +0000 Commit: Kristof Provost CommitDate: 2021-09-24 12:21:18 +0000 cxgbe: fix LINT-NOIP builds The -NOIP builds fail because cxgbe_tls_tag_free() has no prototype (if neither INET nor INET6 are defined). The function isn't actually used in that case, so we can just remove the stub implementation. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/dev/cxgbe/crypto/t4_kern_tls.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sys/dev/cxgbe/crypto/t4_kern_tls.c b/sys/dev/cxgbe/crypto/t4_kern_tls.c index f8d5e54cc3b5..725d15e9cb35 100644 --- a/sys/dev/cxgbe/crypto/t4_kern_tls.c +++ b/sys/dev/cxgbe/crypto/t4_kern_tls.c @@ -2138,12 +2138,6 @@ t6_ktls_write_wr(struct sge_txq *txq, void *dst, struct mbuf *m, u_int nsegs, panic("can't happen"); } -void -cxgbe_tls_tag_free(struct m_snd_tag *mst) -{ - panic("can't happen"); -} - void t6_ktls_modload(void) { From owner-dev-commits-src-all@freebsd.org Fri Sep 24 12:28:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 71F7766CCB7; Fri, 24 Sep 2021 12:28: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 4HGBCg2MNyz4mnJ; Fri, 24 Sep 2021 12:28: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 2B4C11654B; Fri, 24 Sep 2021 12:28: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 18OCSlt1093830; Fri, 24 Sep 2021 12:28:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OCSltT093829; Fri, 24 Sep 2021 12:28:47 GMT (envelope-from git) Date: Fri, 24 Sep 2021 12:28:47 GMT Message-Id: <202109241228.18OCSltT093829@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 9cce0ef95a07 - main - UPDATING: new entry about dummynet MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9cce0ef95a07bab80e768d4dc6cf1aab8baaff70 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 12:28:47 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9cce0ef95a07bab80e768d4dc6cf1aab8baaff70 commit 9cce0ef95a07bab80e768d4dc6cf1aab8baaff70 Author: Kristof Provost AuthorDate: 2021-09-24 12:19:39 +0000 Commit: Kristof Provost CommitDate: 2021-09-24 12:21:25 +0000 UPDATING: new entry about dummynet Dummynet now no longer requires ipfw, so any users relying on this dependency to load ipfw will need to explicitly load ipfw. While here fix a typo in the date of the previous entry. Sponsored by: Rubicon Communications, LLC ("Netgate") --- UPDATING | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index 4b41612dfbc3..34f2a1ee145b 100644 --- a/UPDATING +++ b/UPDATING @@ -27,7 +27,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) -202010922: +20210923: + As of commit 8160a0f62be6, the dummynet module no longer depends on the + ipfw module. Dummynet can now be used by pf as well as ipfw. As such + users who relied on this dependency may need to include ipfw in the + list of modules to load on their systems. + +20210922: As of commit 903873ce1560, the mixer(8) utility has got a slightly new syntax. Please refer to the mixer(8) manual page for more information. From owner-dev-commits-src-all@freebsd.org Fri Sep 24 13:32:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0217866DA47; Fri, 24 Sep 2021 13:32: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 4HGCcl6YZ6z4qs4; Fri, 24 Sep 2021 13:32: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 C189317A4B; Fri, 24 Sep 2021 13:32: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 18ODW7s5086955; Fri, 24 Sep 2021 13:32:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ODW7DU086954; Fri, 24 Sep 2021 13:32:07 GMT (envelope-from git) Date: Fri, 24 Sep 2021 13:32:07 GMT Message-Id: <202109241332.18ODW7DU086954@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: bd4fbd4e1403 - stable/13 - efi loader: Typo 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: bd4fbd4e1403b8015691e991d65eb754c1617b96 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 13:32:08 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bd4fbd4e1403b8015691e991d65eb754c1617b96 commit bd4fbd4e1403b8015691e991d65eb754c1617b96 Author: Mark Johnston AuthorDate: 2021-09-21 16:09:55 +0000 Commit: Mark Johnston CommitDate: 2021-09-24 13:00:56 +0000 efi loader: Typo (cherry picked from commit 0e3ce6d082b34154e41e220757c03d66d881a47b) --- stand/efi/loader/arch/amd64/elf64_freebsd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/efi/loader/arch/amd64/elf64_freebsd.c b/stand/efi/loader/arch/amd64/elf64_freebsd.c index 8826cf76aa80..7aa5735e0cfc 100644 --- a/stand/efi/loader/arch/amd64/elf64_freebsd.c +++ b/stand/efi/loader/arch/amd64/elf64_freebsd.c @@ -263,7 +263,7 @@ elf64_exec(struct preloaded_file *fp) } } - printf("staging %#lx (%scoping) tramp %p PT4 %p\n", + printf("staging %#lx (%scopying) tramp %p PT4 %p\n", staging, copy_staging == COPY_STAGING_ENABLE ? "" : "not ", trampoline, PT4); printf("Start @ 0x%lx ...\n", ehdr->e_entry); From owner-dev-commits-src-all@freebsd.org Fri Sep 24 13:32:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D80266DE64; Fri, 24 Sep 2021 13:32: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 4HGCcp1Nysz4qs9; Fri, 24 Sep 2021 13:32: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 051A0176F4; Fri, 24 Sep 2021 13:32: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 18ODW9u5087006; Fri, 24 Sep 2021 13:32:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ODW9eX087005; Fri, 24 Sep 2021 13:32:09 GMT (envelope-from git) Date: Fri, 24 Sep 2021 13:32:09 GMT Message-Id: <202109241332.18ODW9eX087005@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: e68465ecbf73 - stable/13 - uma: Show the count of free slabs in each per-domain keg's sysctl tree 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: e68465ecbf7371efdab5a7d91838e33f4e5e177b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 13:32:10 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e68465ecbf7371efdab5a7d91838e33f4e5e177b commit e68465ecbf7371efdab5a7d91838e33f4e5e177b Author: Mark Johnston AuthorDate: 2021-09-17 16:13:47 +0000 Commit: Mark Johnston CommitDate: 2021-09-24 13:01:22 +0000 uma: Show the count of free slabs in each per-domain keg's sysctl tree This is useful for measuring the number of pages that could be freed from a NOFREE zone under memory pressure. Sponsored by: The FreeBSD Foundation (cherry picked from commit d6e77cda9be1509ea170142cca3ff0d3b9f12e35) --- sys/vm/uma_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 410d5bb6772b..5dfcd0c860e9 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -2526,7 +2526,10 @@ zone_alloc_sysctl(uma_zone_t zone, void *unused) "Total pages currently allocated from VM"); SYSCTL_ADD_U32(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "free_items", CTLFLAG_RD, &dom->ud_free_items, 0, - "items free in the slab layer"); + "Items free in the slab layer"); + SYSCTL_ADD_U32(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "free_slabs", CTLFLAG_RD, &dom->ud_free_slabs, 0, + "Unused slabs"); } } else SYSCTL_ADD_CONST_STRING(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, From owner-dev-commits-src-all@freebsd.org Fri Sep 24 13:32:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B2D166DF80; Fri, 24 Sep 2021 13:32: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 4HGCcr3CNFz4qc7; Fri, 24 Sep 2021 13:32:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34B71176F5; Fri, 24 Sep 2021 13:32:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18ODWC6k087054; Fri, 24 Sep 2021 13:32:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ODWCJF087053; Fri, 24 Sep 2021 13:32:12 GMT (envelope-from git) Date: Fri, 24 Sep 2021 13:32:12 GMT Message-Id: <202109241332.18ODWCJF087053@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: 5a9ecb0b1505 - stable/13 - socket: Add assertions around naked refcount decrements 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: 5a9ecb0b1505b4830c67b586164be7593ba32bf4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 13:32:13 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5a9ecb0b1505b4830c67b586164be7593ba32bf4 commit 5a9ecb0b1505b4830c67b586164be7593ba32bf4 Author: Mark Johnston AuthorDate: 2021-09-17 16:26:56 +0000 Commit: Mark Johnston CommitDate: 2021-09-24 13:03:04 +0000 socket: Add assertions around naked refcount decrements Sockets in a listen queue hold a reference to the parent listening socket. Several code paths release this reference manually when moving a child socket out of the queue. Replace comments about the expected post-decrement refcount value with assertions. Use refcount_load() instead of a plain load. No functional change intended. Sponsored by: The FreeBSD Foundation (cherry picked from commit 6b288408ca32e68c74f6ab12324448ab4862a045) --- sys/kern/uipc_socket.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 13482fce5980..77c23859cf33 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1073,11 +1073,12 @@ void sofree(struct socket *so) { struct protosw *pr = so->so_proto; + bool last __diagused; SOCK_LOCK_ASSERT(so); - if ((so->so_state & SS_NOFDREF) == 0 || so->so_count != 0 || - (so->so_state & SS_PROTOREF) || (so->so_qstate == SQ_COMP)) { + if ((so->so_state & (SS_NOFDREF | SS_PROTOREF)) != SS_NOFDREF || + refcount_load(&so->so_count) != 0 || so->so_qstate == SQ_COMP) { SOCK_UNLOCK(so); return; } @@ -1113,8 +1114,9 @@ sofree(struct socket *so) __func__, so, sol)); TAILQ_REMOVE(&sol->sol_incomp, so, so_list); sol->sol_incqlen--; - /* This is guarenteed not to be the last. */ - refcount_release(&sol->so_count); + last = refcount_release(&sol->so_count); + KASSERT(!last, ("%s: released last reference for %p", + __func__, sol)); so->so_qstate = SQ_NONE; so->so_listen = NULL; } else @@ -1122,7 +1124,7 @@ sofree(struct socket *so) ("%s: so %p not on (in)comp with so_listen", __func__, so)); sorele(sol); - KASSERT(so->so_count == 1, + KASSERT(refcount_load(&so->so_count) == 1, ("%s: so %p count %u", __func__, so, so->so_count)); so->so_count = 0; } @@ -1178,6 +1180,7 @@ soclose(struct socket *so) struct accept_queue lqueue; struct socket *sp, *tsp; int error = 0; + bool last __diagused; KASSERT(!(so->so_state & SS_NOFDREF), ("soclose: SS_NOFDREF on enter")); @@ -1224,8 +1227,9 @@ drop: sp->so_qstate = SQ_NONE; sp->so_listen = NULL; SOCK_UNLOCK(sp); - /* Guaranteed not to be the last. */ - refcount_release(&so->so_count); + last = refcount_release(&so->so_count); + KASSERT(!last, ("%s: released last reference for %p", + __func__, so)); } } KASSERT((so->so_state & SS_NOFDREF) == 0, ("soclose: NOFDREF")); @@ -1237,7 +1241,7 @@ drop: SOCK_UNLOCK(sp); soabort(sp); } else { - /* sp is now in sofree() */ + /* See the handling of queued sockets in sofree(). */ SOCK_UNLOCK(sp); } } @@ -3971,6 +3975,7 @@ soisconnecting(struct socket *so) void soisconnected(struct socket *so) { + bool last __diagused; SOCK_LOCK(so); so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING); @@ -4003,8 +4008,9 @@ soisconnected(struct socket *so) sorele(head); return; } - /* Not the last one, as so holds a ref. */ - refcount_release(&head->so_count); + last = refcount_release(&head->so_count); + KASSERT(!last, ("%s: released last reference for %p", + __func__, head)); } again: if ((so->so_options & SO_ACCEPTFILTER) == 0) { From owner-dev-commits-src-all@freebsd.org Fri Sep 24 13:32:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 119CA66D479; Fri, 24 Sep 2021 13:32:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGCcn009Sz4qnG; Fri, 24 Sep 2021 13:32: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 D4FF9173E3; Fri, 24 Sep 2021 13:32: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 18ODW8Hr086982; Fri, 24 Sep 2021 13:32:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ODW8Mu086981; Fri, 24 Sep 2021 13:32:08 GMT (envelope-from git) Date: Fri, 24 Sep 2021 13:32:08 GMT Message-Id: <202109241332.18ODW8Mu086981@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: cb7bb946f7ac - stable/13 - rpc: Convert an SOLISTENING check to an assertion 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: cb7bb946f7ac6e9c1a42e028981fa1333ada3664 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 13:32:09 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cb7bb946f7ac6e9c1a42e028981fa1333ada3664 commit cb7bb946f7ac6e9c1a42e028981fa1333ada3664 Author: Mark Johnston AuthorDate: 2021-09-17 16:13:02 +0000 Commit: Mark Johnston CommitDate: 2021-09-24 13:01:07 +0000 rpc: Convert an SOLISTENING check to an assertion Per the comment, this socket should always be a listening socket. Sponsored by: The FreeBSD Foundation (cherry picked from commit 7fabaac2211e7ed1cec9650e46f4e03428411dcf) --- sys/rpc/svc_vc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/rpc/svc_vc.c b/sys/rpc/svc_vc.c index d81c0b01d84d..77452d906594 100644 --- a/sys/rpc/svc_vc.c +++ b/sys/rpc/svc_vc.c @@ -328,11 +328,9 @@ svc_vc_accept(struct socket *head, struct socket **sop) int error = 0; short nbio; - /* XXXGL: shouldn't that be an assertion? */ - if (!SOLISTENING(head)) { - error = EINVAL; - goto done; - } + KASSERT(SOLISTENING(head), + ("%s: socket %p is not listening", __func__, head)); + #ifdef MAC error = mac_socket_check_accept(curthread->td_ucred, head); if (error != 0) From owner-dev-commits-src-all@freebsd.org Fri Sep 24 13:32:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 196B966DA4E; Fri, 24 Sep 2021 13:32:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGCcq2QBxz4qSD; Fri, 24 Sep 2021 13:32:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 206A617A4C; Fri, 24 Sep 2021 13:32:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18ODWBxX087030; Fri, 24 Sep 2021 13:32:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ODWB08087029; Fri, 24 Sep 2021 13:32:11 GMT (envelope-from git) Date: Fri, 24 Sep 2021 13:32:11 GMT Message-Id: <202109241332.18ODWB08087029@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: e9e4f8092c2e - stable/13 - socket: Fix a use-after-free in soclose() 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: e9e4f8092c2e0ccac922f930072cd14b22ee7c1c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 13:32:12 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e9e4f8092c2e0ccac922f930072cd14b22ee7c1c commit e9e4f8092c2e0ccac922f930072cd14b22ee7c1c Author: Mark Johnston AuthorDate: 2021-09-17 16:26:06 +0000 Commit: Mark Johnston CommitDate: 2021-09-24 13:01:51 +0000 socket: Fix a use-after-free in soclose() After releasing the fd reference to a socket "so", we should avoid testing SOLISTENING(so) since the socket may have been freed. Instead, directly test whether the list of unaccepted sockets is empty. Fixes: f4bb1869ddd2 ("Consistently use the SOLISTENING() macro") Pointy hat: markj Sponsored by: The FreeBSD Foundation (cherry picked from commit dfcef8771484271f2bccdb1dbc088a838441c5a7) --- sys/kern/uipc_socket.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index dc7407808535..13482fce5980 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1176,6 +1176,7 @@ int soclose(struct socket *so) { struct accept_queue lqueue; + struct socket *sp, *tsp; int error = 0; KASSERT(!(so->so_state & SS_NOFDREF), ("soclose: SS_NOFDREF on enter")); @@ -1210,11 +1211,9 @@ drop: if (so->so_proto->pr_usrreqs->pru_close != NULL) (*so->so_proto->pr_usrreqs->pru_close)(so); + TAILQ_INIT(&lqueue); SOCK_LOCK(so); if (SOLISTENING(so)) { - struct socket *sp; - - TAILQ_INIT(&lqueue); TAILQ_SWAP(&lqueue, &so->sol_incomp, socket, so_list); TAILQ_CONCAT(&lqueue, &so->sol_comp, so_list); @@ -1232,17 +1231,14 @@ drop: KASSERT((so->so_state & SS_NOFDREF) == 0, ("soclose: NOFDREF")); so->so_state |= SS_NOFDREF; sorele(so); - if (SOLISTENING(so)) { - struct socket *sp, *tsp; - - TAILQ_FOREACH_SAFE(sp, &lqueue, so_list, tsp) { - SOCK_LOCK(sp); - if (sp->so_count == 0) { - SOCK_UNLOCK(sp); - soabort(sp); - } else - /* sp is now in sofree() */ - SOCK_UNLOCK(sp); + TAILQ_FOREACH_SAFE(sp, &lqueue, so_list, tsp) { + SOCK_LOCK(sp); + if (refcount_load(&sp->so_count) == 0) { + SOCK_UNLOCK(sp); + soabort(sp); + } else { + /* sp is now in sofree() */ + SOCK_UNLOCK(sp); } } CURVNET_RESTORE(); From owner-dev-commits-src-all@freebsd.org Fri Sep 24 15:32:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2348566EBE7; Fri, 24 Sep 2021 15:32: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 4HGGH506LVz3FtK; Fri, 24 Sep 2021 15:32: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 D830F19488; Fri, 24 Sep 2021 15:32: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 18OFW0Is047714; Fri, 24 Sep 2021 15:32:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OFW0rb047713; Fri, 24 Sep 2021 15:32:00 GMT (envelope-from git) Date: Fri, 24 Sep 2021 15:32:00 GMT Message-Id: <202109241532.18OFW0rb047713@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: d7cf1b262f9f - main - 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/main X-Git-Reftype: branch X-Git-Commit: d7cf1b262f9ff5e799446f0cbbd007905ab4ae24 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 15:32:01 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d7cf1b262f9ff5e799446f0cbbd007905ab4ae24 commit d7cf1b262f9ff5e799446f0cbbd007905ab4ae24 Author: Mark Johnston AuthorDate: 2021-09-24 15:31:53 +0000 Commit: Mark Johnston CommitDate: 2021-09-24 15:31:53 +0000 tests/sys/sys: Raise WARNS MFC after: 1 week Sponsored by: The FreeBSD Foundation --- tests/sys/sys/Makefile | 2 -- tests/sys/sys/arb_test.c | 2 +- tests/sys/sys/rb_test.c | 2 +- tests/sys/sys/splay_test.c | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/sys/sys/Makefile b/tests/sys/sys/Makefile index eed87935e6e7..95739c127632 100644 --- a/tests/sys/sys/Makefile +++ b/tests/sys/sys/Makefile @@ -6,8 +6,6 @@ TESTSDIR= ${TESTSBASE}/sys/sys ATF_TESTS_C= arb_test bitstring_test qmath_test rb_test splay_test -WARNS?= 5 - .if ${COMPILER_TYPE} == "gcc" CFLAGS.bitstring_test= -fno-strict-overflow .endif diff --git a/tests/sys/sys/arb_test.c b/tests/sys/sys/arb_test.c index 9cf3f2052688..adbd7794e6f8 100644 --- a/tests/sys/sys/arb_test.c +++ b/tests/sys/sys/arb_test.c @@ -41,7 +41,7 @@ struct node { int key; }; -ARB32_HEAD(tree, node) *root; +static ARB32_HEAD(tree, node) *root; static int compare(const struct node *a, const struct node *b) diff --git a/tests/sys/sys/rb_test.c b/tests/sys/sys/rb_test.c index 287422ccf902..c558ad6098cf 100644 --- a/tests/sys/sys/rb_test.c +++ b/tests/sys/sys/rb_test.c @@ -39,7 +39,7 @@ struct node { int key; }; -RB_HEAD(tree, node) root; +static RB_HEAD(tree, node) root; static int compare(struct node *a, struct node *b) diff --git a/tests/sys/sys/splay_test.c b/tests/sys/sys/splay_test.c index 9b14c7c855cf..f0cf4ecd5eb6 100644 --- a/tests/sys/sys/splay_test.c +++ b/tests/sys/sys/splay_test.c @@ -39,7 +39,7 @@ struct node { int key; }; -SPLAY_HEAD(tree, node) root; +static SPLAY_HEAD(tree, node) root; static int compare(struct node *a, struct node *b) From owner-dev-commits-src-all@freebsd.org Fri Sep 24 16:53:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E43A670A1F; Fri, 24 Sep 2021 16:53: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 4HGJ4b6h5Jz3Ly0; Fri, 24 Sep 2021 16:53: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 C5F2D1A166; Fri, 24 Sep 2021 16:53: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 18OGr3Uv055545; Fri, 24 Sep 2021 16:53:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OGr3Ps055544; Fri, 24 Sep 2021 16:53:03 GMT (envelope-from git) Date: Fri, 24 Sep 2021 16:53:03 GMT Message-Id: <202109241653.18OGr3Ps055544@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 364790beafec - main - 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/main X-Git-Reftype: branch X-Git-Commit: 364790beafec707ca3e334683e4030684d829be2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 16:53:04 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=364790beafec707ca3e334683e4030684d829be2 commit 364790beafec707ca3e334683e4030684d829be2 Author: Konstantin Belousov AuthorDate: 2021-09-24 03:12:20 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-24 16:52:41 +0000 pidfile test: guarantee nul termination of the read pid string PR: 258701 Based on the submission by: sigsys@gmail.com MFC after: 1 week --- lib/libutil/tests/pidfile_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libutil/tests/pidfile_test.c b/lib/libutil/tests/pidfile_test.c index 9e516c35273c..9bfa6754ce54 100644 --- a/lib/libutil/tests/pidfile_test.c +++ b/lib/libutil/tests/pidfile_test.c @@ -286,7 +286,8 @@ test_pidfile_relative(void) fd = open(path, O_RDONLY); if (fd < 0) return (strerror(errno)); - if (read(fd, pid, sizeof(pid)) < 0) + memset(pid, 0, sizeof(pid)); + if (read(fd, pid, sizeof(pid) - 1) < 0) return (strerror(errno)); if (atoi(pid) != getpid()) return ("pid mismatch"); From owner-dev-commits-src-all@freebsd.org Fri Sep 24 17:37:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD00967151F; Fri, 24 Sep 2021 17:37:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGK4B52BLz3Q26; Fri, 24 Sep 2021 17:37:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 1E358F46; Fri, 24 Sep 2021 17:37:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: de2a0fafe6f9 - main - cxgbe: fix LINT-NOIP builds To: Kristof Provost , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202109241228.18OCSjXK093803@gitrepo.freebsd.org> From: John Baldwin Message-ID: Date: Fri, 24 Sep 2021 10:37:44 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <202109241228.18OCSjXK093803@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 17:37:46 -0000 On 9/24/21 5:28 AM, Kristof Provost wrote: > The branch main has been updated by kp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=de2a0fafe6f96b57619988824b9525c8a9905cfb > > commit de2a0fafe6f96b57619988824b9525c8a9905cfb > Author: Kristof Provost > AuthorDate: 2021-09-24 08:31:27 +0000 > Commit: Kristof Provost > CommitDate: 2021-09-24 12:21:18 +0000 > > cxgbe: fix LINT-NOIP builds > > The -NOIP builds fail because cxgbe_tls_tag_free() has no prototype (if > neither INET nor INET6 are defined). The function isn't actually used > in that case, so we can just remove the stub implementation. > > Sponsored by: Rubicon Communications, LLC ("Netgate") My fault, thanks for fixing. -- John Baldwin From owner-dev-commits-src-all@freebsd.org Fri Sep 24 18:15:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B635B671D9E; Fri, 24 Sep 2021 18:15: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 4HGKvv4mH1z3hJ1; Fri, 24 Sep 2021 18:15: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 83FC01B637; Fri, 24 Sep 2021 18:15: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 18OIFd7H064295; Fri, 24 Sep 2021 18:15:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OIFdA9064294; Fri, 24 Sep 2021 18:15:39 GMT (envelope-from git) Date: Fri, 24 Sep 2021 18:15:39 GMT Message-Id: <202109241815.18OIFdA9064294@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 0389e9be63c5 - main - bus: retire DF_REBID MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0389e9be63c5e24ecedbb366c5682ddc2ff4de60 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 18:15:39 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0389e9be63c5e24ecedbb366c5682ddc2ff4de60 commit 0389e9be63c5e24ecedbb366c5682ddc2ff4de60 Author: Warner Losh AuthorDate: 2021-09-24 18:10:18 +0000 Commit: Warner Losh CommitDate: 2021-09-24 18:15:34 +0000 bus: retire DF_REBID I did DF_REBID to allow for 'hoover' drivers that would attach to otherwise unattached devices in the tree. This notion didn't catch on as it was tricky to make work well and it was easier to just publish a /dev node of some flavor by the parent device. It's been nothing but dead weight for a long time. Reviewed by: mav Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D32056 --- sys/kern/subr_bus.c | 41 ++++++----------------------------------- sys/sys/bus.h | 1 - 2 files changed, 6 insertions(+), 36 deletions(-) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 5e1b561155bb..3f84b6e0c56d 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -2083,10 +2083,9 @@ device_probe_child(device_t dev, device_t child) panic("device_probe_child: parent device has no devclass"); /* - * If the state is already probed, then return. However, don't - * return if we can rebid this object. + * If the state is already probed, then return. */ - if (child->state == DS_ALIVE && (child->flags & DF_REBID) == 0) + if (child->state == DS_ALIVE) return (0); for (; dc; dc = dc->parent) { @@ -2188,29 +2187,7 @@ device_probe_child(device_t dev, device_t child) /* * If we found a driver, change state and initialise the devclass. */ - /* XXX What happens if we rebid and got no best? */ if (best) { - /* - * If this device was attached, and we were asked to - * rescan, and it is a different driver, then we have - * to detach the old driver and reattach this new one. - * Note, we don't have to check for DF_REBID here - * because if the state is > DS_ALIVE, we know it must - * be. - * - * This assumes that all DF_REBID drivers can have - * their probe routine called at any time and that - * they are idempotent as well as completely benign in - * normal operations. - * - * We also have to make sure that the detach - * succeeded, otherwise we fail the operation (or - * maybe it should just fail silently? I'm torn). - */ - if (child->state > DS_ALIVE && best->driver != child->driver) - if ((result = device_detach(dev)) != 0) - return (result); - /* Set the winning driver, devclass, and flags. */ if (!child->devclass) { result = device_set_devclass(child, best->driver->name); @@ -2229,11 +2206,7 @@ device_probe_child(device_t dev, device_t child) * sure that we have the right description. */ DEVICE_PROBE(child); -#if 0 - child->flags |= DF_REBID; -#endif - } else - child->flags &= ~DF_REBID; + } child->state = DS_ALIVE; bus_data_generation_update(); @@ -2921,7 +2894,7 @@ device_probe(device_t dev) GIANT_REQUIRED; - if (dev->state >= DS_ALIVE && (dev->flags & DF_REBID) == 0) + if (dev->state >= DS_ALIVE) return (-1); if (!(dev->flags & DF_ENABLED)) { @@ -4145,8 +4118,7 @@ bus_generic_driver_added(device_t dev, driver_t *driver) DEVICE_IDENTIFY(driver, dev); TAILQ_FOREACH(child, &dev->children, link) { - if (child->state == DS_NOTPRESENT || - (child->flags & DF_REBID)) + if (child->state == DS_NOTPRESENT) device_probe_and_attach(child); } } @@ -5334,7 +5306,6 @@ print_device_short(device_t dev, int indent) (dev->flags&DF_FIXEDCLASS? "fixed,":""), (dev->flags&DF_WILDCARD? "wildcard,":""), (dev->flags&DF_DESCMALLOCED? "descmalloced,":""), - (dev->flags&DF_REBID? "rebiddable,":""), (dev->flags&DF_SUSPENDED? "suspended,":""), (dev->ivars? "":"no "), (dev->softc? "":"no "), @@ -5736,7 +5707,7 @@ devctl2_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, /* Perform the requested operation. */ switch (cmd) { case DEV_ATTACH: - if (device_is_attached(dev) && (dev->flags & DF_REBID) == 0) + if (device_is_attached(dev)) error = EBUSY; else if (!device_is_enabled(dev)) error = ENXIO; diff --git a/sys/sys/bus.h b/sys/sys/bus.h index ff86cbcf457f..bf51bdbef387 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -90,7 +90,6 @@ struct u_device { #define DF_QUIET 0x10 /* don't print verbose attach message */ #define DF_DONENOMATCH 0x20 /* don't execute DEVICE_NOMATCH again */ #define DF_EXTERNALSOFTC 0x40 /* softc not allocated by us */ -#define DF_REBID 0x80 /* Can rebid after attach */ #define DF_SUSPENDED 0x100 /* Device is suspended. */ #define DF_QUIET_CHILDREN 0x200 /* Default to quiet for all my children */ #define DF_ATTACHED_ONCE 0x400 /* Has been attached at least once */ From owner-dev-commits-src-all@freebsd.org Fri Sep 24 18:35:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DAE7671FD8; Fri, 24 Sep 2021 18:35: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 4HGLLx04J5z3j2W; Fri, 24 Sep 2021 18:35: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 D3B781BB1A; Fri, 24 Sep 2021 18:35: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 18OIZa0s090752; Fri, 24 Sep 2021 18:35:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OIZaEk090751; Fri, 24 Sep 2021 18:35:36 GMT (envelope-from git) Date: Fri, 24 Sep 2021 18:35:36 GMT Message-Id: <202109241835.18OIZaEk090751@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Drewery Subject: git: e31fb97148f7 - main - read builtin: Empty variables on timeout MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdrewery X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e31fb97148f7a392aaf6cc84579a232f2969b9d1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 18:35:37 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=e31fb97148f7a392aaf6cc84579a232f2969b9d1 commit e31fb97148f7a392aaf6cc84579a232f2969b9d1 Author: Bryan Drewery AuthorDate: 2020-05-23 17:01:45 +0000 Commit: Bryan Drewery CommitDate: 2021-09-24 18:34:54 +0000 read builtin: Empty variables on timeout This matches how a non-timeout error is handled. Reviewed by: jilles MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31876 --- bin/sh/miscbltin.c | 2 ++ bin/sh/tests/builtins/Makefile | 2 ++ bin/sh/tests/builtins/read10.0 | 8 ++++++++ bin/sh/tests/builtins/read11.0 | 17 +++++++++++++++++ 4 files changed, 29 insertions(+) diff --git a/bin/sh/miscbltin.c b/bin/sh/miscbltin.c index faccfa92d221..79d7dc097b5c 100644 --- a/bin/sh/miscbltin.c +++ b/bin/sh/miscbltin.c @@ -231,6 +231,8 @@ readcmd(int argc __unused, char **argv __unused) * If there's nothing ready, return an error. */ if (status <= 0) { + while (*ap != NULL) + setvar(*ap++, "", 0); sig = pendingsig; return (128 + (sig != 0 ? sig : SIGALRM)); } diff --git a/bin/sh/tests/builtins/Makefile b/bin/sh/tests/builtins/Makefile index 197d735920e6..f9b464a6da4b 100644 --- a/bin/sh/tests/builtins/Makefile +++ b/bin/sh/tests/builtins/Makefile @@ -141,6 +141,8 @@ ${PACKAGE}FILES+= read6.0 ${PACKAGE}FILES+= read7.0 ${PACKAGE}FILES+= read8.0 ${PACKAGE}FILES+= read9.0 +${PACKAGE}FILES+= read10.0 +${PACKAGE}FILES+= read11.0 ${PACKAGE}FILES+= return1.0 ${PACKAGE}FILES+= return2.1 ${PACKAGE}FILES+= return3.1 diff --git a/bin/sh/tests/builtins/read10.0 b/bin/sh/tests/builtins/read10.0 new file mode 100644 index 000000000000..5fc19896390a --- /dev/null +++ b/bin/sh/tests/builtins/read10.0 @@ -0,0 +1,8 @@ + +set -e + +v=original_value +r=0 +read v < /dev/null || r=$? +[ "$r" -eq 1 ] +[ -z "$v" ] diff --git a/bin/sh/tests/builtins/read11.0 b/bin/sh/tests/builtins/read11.0 new file mode 100644 index 000000000000..c75ed9c92a83 --- /dev/null +++ b/bin/sh/tests/builtins/read11.0 @@ -0,0 +1,17 @@ + +set -e + +T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) +trap 'rm -rf "$T"' 0 +cd $T +mkfifo fifo1 +# Open fifo1 for writing and then read block on a dummy fifo +{ mkfifo fifo2; read dummy fifo1 & +# Wait for the child to open fifo1 for writing +exec 3 Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5178A671DFA; Fri, 24 Sep 2021 18:37: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 4HGLNy1rfVz3jb6; Fri, 24 Sep 2021 18:37: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 1F2DC1B7CA; Fri, 24 Sep 2021 18:37: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 18OIbM90090979; Fri, 24 Sep 2021 18:37:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OIbMdX090978; Fri, 24 Sep 2021 18:37:22 GMT (envelope-from git) Date: Fri, 24 Sep 2021 18:37:22 GMT Message-Id: <202109241837.18OIbMdX090978@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 14a634df53d2 - main - cxgbe: Mark received packets as initialized for KMSAN MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 14a634df53d2de65233e490d0bfa806a05baff7c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 18:37:22 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=14a634df53d2de65233e490d0bfa806a05baff7c commit 14a634df53d2de65233e490d0bfa806a05baff7c Author: Mark Johnston AuthorDate: 2021-09-24 18:35:38 +0000 Commit: Mark Johnston CommitDate: 2021-09-24 18:37:05 +0000 cxgbe: Mark received packets as initialized for KMSAN The KMSAN runtime needs to have its shadow maps updated when devices update host memory, otherwise it assumes that device-populated memory is uninitialized. For most drivers this is handled transparently by busdma, but cxgbe doesn't make use of dma maps for receive buffers and so requires special treatment. Reported by: mjg Tested by: mjg Reviewed by: np Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32102 --- sys/dev/cxgbe/t4_sge.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 8a502907d172..c2f2f0a13f5b 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1754,6 +1755,7 @@ get_scatter_segment(struct adapter *sc, struct sge_fl *fl, int fr_offset, return (NULL); } m->m_len = len; + kmsan_mark(payload, len, KMSAN_STATE_INITED); if (sc->sc_do_rxcopy && len < RX_COPY_THRESHOLD) { /* copy data to mbuf */ From owner-dev-commits-src-all@freebsd.org Fri Sep 24 18:41:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C64AE672494; Fri, 24 Sep 2021 18:41: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 4HGLTg5Cyfz3jlh; Fri, 24 Sep 2021 18:41: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 942EC1BA57; Fri, 24 Sep 2021 18:41: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 18OIfRaT002053; Fri, 24 Sep 2021 18:41:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OIfRL0002052; Fri, 24 Sep 2021 18:41:27 GMT (envelope-from git) Date: Fri, 24 Sep 2021 18:41:27 GMT Message-Id: <202109241841.18OIfRL0002052@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 73db3b64f167 - main - ipfilter: Avoid a null if-then-else blocks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 73db3b64f167972db3ee3f780cecb439b09492b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 18:41:27 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=73db3b64f167972db3ee3f780cecb439b09492b1 commit 73db3b64f167972db3ee3f780cecb439b09492b1 Author: Cy Schubert AuthorDate: 2021-09-22 04:58:08 +0000 Commit: Cy Schubert CommitDate: 2021-09-24 18:41:02 +0000 ipfilter: Avoid a null if-then-else blocks When WITHOUT_INET6 is selected we generate a null if-then-else blocks due to incorrect placment of #if statments. Move the #if statements reducing unnecessary runtime comparisons WITHOUT_INET6. MFC after: 1 week --- sys/contrib/ipfilter/netinet/ip_ftp_pxy.c | 18 +++++++----------- sys/contrib/ipfilter/netinet/ip_proxy.c | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c b/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c index 5d8f9f1f51f7..c4ee0ef593df 100644 --- a/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c +++ b/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c @@ -510,11 +510,10 @@ ipf_p_ftp_addport(softf, fin, ip, nat, ftp, dlen, nport, inc) fi.fin_src6 = nat->nat_ndst6; fi.fin_dst6 = nat->nat_nsrc6; - if (nat->nat_v[0] == 6) { #ifndef USE_INET6 + if (nat->nat_v[0] == 6) return APR_INC(inc); #endif - } /* * Add skeleton NAT entry for connection which will come back the @@ -582,15 +581,14 @@ ipf_p_ftp_addport(softf, fin, ip, nat, ftp, dlen, nport, inc) flags = SI_W_SPORT|NAT_SLAVE|IPN_TCP; MUTEX_ENTER(&softn->ipf_nat_new); - if (nat->nat_v[0] == 6) { #ifdef USE_INET6 + if (nat->nat_v[0] == 6) nat2 = ipf_nat6_add(&fi, ipn, &ftp->ftp_pendnat, flags, direction); + else #endif - } else { nat2 = ipf_nat_add(&fi, ipn, &ftp->ftp_pendnat, flags, direction); - } MUTEX_EXIT(&softn->ipf_nat_new); if (nat2 == NULL) { @@ -950,13 +948,12 @@ ipf_p_ftp_pasvreply(softf, fin, ip, nat, ftp, port, newmsg, s) MUTEX_EXIT(&nat2->nat_lock); fi.fin_ifp = NULL; if (nat->nat_dir == NAT_INBOUND) { - if (nat->nat_v[0] == 6) { #ifdef USE_INET6 + if (nat->nat_v[0] == 6) fi.fin_dst6 = nat->nat_ndst6; + else #endif - } else { fi.fin_daddr = nat->nat_ndstaddr; - } } if (ipf_state_add(softc, &fi, (ipstate_t **)&ftp->ftp_pendstate, SI_W_SPORT) != 0) @@ -979,15 +976,14 @@ ipf_p_ftp_pasvreply(softf, fin, ip, nat, ftp, port, newmsg, s) if (inc != 0) { fin->fin_plen += inc; fin->fin_dlen += inc; - if (nat->nat_v[0] == 6) { #ifdef USE_INET6 + if (nat->nat_v[0] == 6) { ip6 = (ip6_t *)fin->fin_ip; u_short len = ntohs(ip6->ip6_plen) + inc; ip6->ip6_plen = htons(len); + } else #endif - } else { ip->ip_len = htons(fin->fin_plen); - } } return APR_INC(inc); diff --git a/sys/contrib/ipfilter/netinet/ip_proxy.c b/sys/contrib/ipfilter/netinet/ip_proxy.c index 87051b6e6839..4399a9cde8e4 100644 --- a/sys/contrib/ipfilter/netinet/ip_proxy.c +++ b/sys/contrib/ipfilter/netinet/ip_proxy.c @@ -1354,8 +1354,8 @@ ipf_proxy_rule_rev(nat) if (ipn->in_v[0] == 4) { ipn->in_snip = ntohl(nat->nat_odstaddr); ipn->in_dnip = ntohl(nat->nat_nsrcaddr); - } else { #ifdef USE_INET6 + } else { ipn->in_snip6 = nat->nat_odst6; ipn->in_dnip6 = nat->nat_nsrc6; #endif From owner-dev-commits-src-all@freebsd.org Fri Sep 24 18:41:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F0E86725A7; Fri, 24 Sep 2021 18:41: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 4HGLTh6K8Vz3k2H; Fri, 24 Sep 2021 18:41: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 B6E561BC8F; Fri, 24 Sep 2021 18:41: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 18OIfSPn002077; Fri, 24 Sep 2021 18:41:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OIfSfb002076; Fri, 24 Sep 2021 18:41:28 GMT (envelope-from git) Date: Fri, 24 Sep 2021 18:41:28 GMT Message-Id: <202109241841.18OIfSfb002076@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 1605eaa6d23e - main - ipfilter: Locking sysctls here is not required MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1605eaa6d23ea5161b5ab8461e83ab32a591a4fc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 18:41:29 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=1605eaa6d23ea5161b5ab8461e83ab32a591a4fc commit 1605eaa6d23ea5161b5ab8461e83ab32a591a4fc Author: Cy Schubert AuthorDate: 2021-09-24 18:18:42 +0000 Commit: Cy Schubert CommitDate: 2021-09-24 18:41:02 +0000 ipfilter: Locking sysctls here is not required Locking of data structures touched by sysctls is more finely locked in ipflter therefore higher level locks are redundant. MFC after: 3 days --- sys/contrib/ipfilter/netinet/mlfk_ipl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/mlfk_ipl.c b/sys/contrib/ipfilter/netinet/mlfk_ipl.c index 64beb1448858..8d9cb780b9e8 100644 --- a/sys/contrib/ipfilter/netinet/mlfk_ipl.c +++ b/sys/contrib/ipfilter/netinet/mlfk_ipl.c @@ -349,7 +349,6 @@ sysctl_ipf_int ( SYSCTL_HANDLER_ARGS ) { int error = 0; - WRITE_ENTER(&V_ipfmain.ipf_mutex); if (arg1) error = SYSCTL_OUT(req, arg1, sizeof(int)); else @@ -368,7 +367,6 @@ sysctl_ipf_int ( SYSCTL_HANDLER_ARGS ) } sysctl_error: - RWLOCK_EXIT(&V_ipfmain.ipf_mutex); return (error); } From owner-dev-commits-src-all@freebsd.org Fri Sep 24 18:51:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34F64672896; Fri, 24 Sep 2021 18:51: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 4HGLhw0q4Xz3kWZ; Fri, 24 Sep 2021 18:51: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 F07CD1B7ED; Fri, 24 Sep 2021 18:51:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18OIpBE0012847; Fri, 24 Sep 2021 18:51:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OIpBY3012846; Fri, 24 Sep 2021 18:51:11 GMT (envelope-from git) Date: Fri, 24 Sep 2021 18:51:11 GMT Message-Id: <202109241851.18OIpBY3012846@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 1a25c51e38a7 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 1a25c51e38a7c9f46ec195836233636616741f06 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 18:51:12 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=1a25c51e38a7c9f46ec195836233636616741f06 commit 1a25c51e38a7c9f46ec195836233636616741f06 Author: Toomas Soome AuthorDate: 2021-09-24 14:07:20 +0000 Commit: Toomas Soome CommitDate: 2021-09-24 14:12:19 +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. MFC after: 1 week --- stand/common/dev_net.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/stand/common/dev_net.c b/stand/common/dev_net.c index 1fa955ac1cf1..db13e618e822 100644 --- a/stand/common/dev_net.c +++ b/stand/common/dev_net.c @@ -141,13 +141,14 @@ net_open(struct open_file *f, ...) if (netdev_sock < 0) { netdev_sock = netif_open(dev); if (netdev_sock < 0) { - printf("net_open: netif_open() failed\n"); + printf("%s: netif_open() failed\n", __func__); return (ENXIO); } netdev_name = strdup(devname); #ifdef NETIF_DEBUG if (debug) - printf("net_open: netif_open() succeeded\n"); + printf("%s: netif_open() succeeded\n", + __func__); #endif } /* @@ -202,7 +203,7 @@ net_close(struct open_file *f) #ifdef NETIF_DEBUG if (debug) - printf("net_close: opens=%d\n", netdev_opens); + printf("%s: opens=%d\n", __func__, netdev_opens); #endif f->f_devdata = NULL; @@ -217,7 +218,7 @@ net_cleanup(void) if (netdev_sock >= 0) { #ifdef NETIF_DEBUG if (debug) - printf("net_cleanup: calling netif_close()\n"); + printf("%s: calling netif_close()\n", __func__); #endif rootip.s_addr = 0; free(netdev_name); @@ -272,7 +273,7 @@ net_getparams(int sock) goto exit; #ifdef NETIF_DEBUG if (debug) - printf("net_open: BOOTP failed, trying RARP/RPC...\n"); + printf("%s: BOOTP failed, trying RARP/RPC...\n", __func__); #endif #endif @@ -281,19 +282,19 @@ net_getparams(int sock) * netmask to the "natural" default for our address. */ if (rarp_getipaddress(sock)) { - printf("net_open: RARP failed\n"); + printf("%s: RARP failed\n", __func__); return (EIO); } - printf("net_open: client addr: %s\n", inet_ntoa(myip)); + printf("%s: client addr: %s\n", __func__, inet_ntoa(myip)); /* Get our hostname, server IP address, gateway. */ if (bp_whoami(sock)) { - printf("net_open: bootparam/whoami RPC failed\n"); + printf("%s: bootparam/whoami RPC failed\n", __func__); return (EIO); } #ifdef NETIF_DEBUG if (debug) - printf("net_open: client name: %s\n", hostname); + printf("%s: client name: %s\n", __func__, hostname); #endif /* @@ -310,17 +311,18 @@ net_getparams(int sock) netmask = smask; #ifdef NETIF_DEBUG if (debug) - printf("net_open: subnet mask: %s\n", intoa(netmask)); + printf("%s: subnet mask: %s\n", __func__, + intoa(netmask)); #endif } #ifdef NETIF_DEBUG if (gateip.s_addr && debug) - printf("net_open: net gateway: %s\n", inet_ntoa(gateip)); + printf("%s: net gateway: %s\n", __func__, inet_ntoa(gateip)); #endif /* Get the root server and pathname. */ if (bp_getfile(sock, "root", &rootip, rootpath)) { - printf("net_open: bootparam/getfile RPC failed\n"); + printf("%s: bootparam/getfile RPC failed\n", __func__); return (EIO); } exit: @@ -329,8 +331,8 @@ exit: #ifdef NETIF_DEBUG if (debug) { - printf("net_open: server addr: %s\n", inet_ntoa(rootip)); - printf("net_open: server path: %s\n", rootpath); + printf("%s: server addr: %s\n", __func__, inet_ntoa(rootip)); + printf("%s: server path: %s\n", __func__, rootpath); } #endif From owner-dev-commits-src-all@freebsd.org Fri Sep 24 19:06:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED91C6729EB; Fri, 24 Sep 2021 19:06: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 4HGM2X5Cglz3kx7; Fri, 24 Sep 2021 19:06:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 933361BE3F; Fri, 24 Sep 2021 19:06:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18OJ6Sl2031695; Fri, 24 Sep 2021 19:06:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OJ6SX3031694; Fri, 24 Sep 2021 19:06:28 GMT (envelope-from git) Date: Fri, 24 Sep 2021 19:06:28 GMT Message-Id: <202109241906.18OJ6SX3031694@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 7c2f227a17de - main - 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/main X-Git-Reftype: branch X-Git-Commit: 7c2f227a17ded0934c5941c7911797edb7d770a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 19:06:29 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7c2f227a17ded0934c5941c7911797edb7d770a2 commit 7c2f227a17ded0934c5941c7911797edb7d770a2 Author: Mark Johnston AuthorDate: 2021-09-24 19:04:45 +0000 Commit: Mark Johnston CommitDate: 2021-09-24 19:04:45 +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 MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/529 Differential Revision: https://reviews.freebsd.org/D32124 --- 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 6bbcf977ac72..5d281f3157fa 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -889,7 +889,7 @@ cryptodev_op(struct csession *cse, const struct crypt_op *cop) dst += cse->ivsize; } - if (cop->mac != NULL && crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { + if (crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { error = copyin(cop->mac, cod->buf + crp->crp_digest_start, cse->hashsize); if (error) { From owner-dev-commits-src-all@freebsd.org Fri Sep 24 19:21:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F016673386; Fri, 24 Sep 2021 19:21: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 4HGMMs0S4gz3mR0; Fri, 24 Sep 2021 19:21:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E59081C62A; Fri, 24 Sep 2021 19:21: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 18OJLSDL054260; Fri, 24 Sep 2021 19:21:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OJLSkA054259; Fri, 24 Sep 2021 19:21:28 GMT (envelope-from git) Date: Fri, 24 Sep 2021 19:21:28 GMT Message-Id: <202109241921.18OJLSkA054259@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: bf27a2253f6b - main - ps: fix `ps -aa` MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bf27a2253f6ba6ee3086046b837b2fe40e22c72c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 19:21:29 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=bf27a2253f6ba6ee3086046b837b2fe40e22c72c commit bf27a2253f6ba6ee3086046b837b2fe40e22c72c Author: Math Ieu AuthorDate: 2021-09-24 06:58:40 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-24 19:19:52 +0000 ps: fix `ps -aa` Passing the -a flag multiple times made ps show no processes. Differential Revision: https://reviews.freebsd.org/D27215 --- bin/ps/ps.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/bin/ps/ps.c b/bin/ps/ps.c index d3cfc669d581..0c656d8a1544 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -253,11 +253,9 @@ main(int argc, char *argv[]) * added for compatibility with SUSv3, but for * now it will not be described in the man page. */ - nselectors++; all = xkeep = 1; break; case 'a': - nselectors++; all = 1; break; case 'C': @@ -473,7 +471,7 @@ main(int argc, char *argv[]) if (!_fmt) parsefmt(dfmt, 0); - if (nselectors == 0) { + if (!all && nselectors == 0) { uidlist.l.ptr = malloc(sizeof(uid_t)); if (uidlist.l.ptr == NULL) xo_errx(1, "malloc failed"); @@ -526,9 +524,6 @@ main(int argc, char *argv[]) what = KERN_PROC_UID | showthreads; flag = *uidlist.l.uids; nselectors = 0; - } else if (all) { - /* No need for this routine to select processes. */ - nselectors = 0; } } From owner-dev-commits-src-all@freebsd.org Fri Sep 24 20:05:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B2306735E4; Fri, 24 Sep 2021 20:05:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGNL900qJz3q49; Fri, 24 Sep 2021 20:05:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D402D1D00D; Fri, 24 Sep 2021 20:05: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 18OK54R6011016; Fri, 24 Sep 2021 20:05:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OK54AW011015; Fri, 24 Sep 2021 20:05:04 GMT (envelope-from git) Date: Fri, 24 Sep 2021 20:05:04 GMT Message-Id: <202109242005.18OK54AW011015@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 67a9e76da6e6 - main - bus: Fix LINT / BUS_DEBUG build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 67a9e76da6e69ceee94a3b9c0fd490ed2f781938 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 20:05:05 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=67a9e76da6e69ceee94a3b9c0fd490ed2f781938 commit 67a9e76da6e69ceee94a3b9c0fd490ed2f781938 Author: Warner Losh AuthorDate: 2021-09-24 20:03:10 +0000 Commit: Warner Losh CommitDate: 2021-09-24 20:04:39 +0000 bus: Fix LINT / BUS_DEBUG build Fix 0389e9be63c5e for LINT built. Removed an arg only from code under BUS_DEBUG w/o rebuilding LINT... Sponsored by: Netflix Fixes: 0389e9be63c5e24ecedbb366c5682ddc2ff4de60 --- sys/kern/subr_bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 3f84b6e0c56d..958e0aa413d4 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -5298,7 +5298,7 @@ print_device_short(device_t dev, int indent) if (!dev) return; - indentprintf(("device %d: <%s> %sparent,%schildren,%s%s%s%s%s%s,%sivars,%ssoftc,busy=%d\n", + indentprintf(("device %d: <%s> %sparent,%schildren,%s%s%s%s%s,%sivars,%ssoftc,busy=%d\n", dev->unit, dev->desc, (dev->parent? "":"no "), (TAILQ_EMPTY(&dev->children)? "no ":""), From owner-dev-commits-src-all@freebsd.org Fri Sep 24 21:09:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 609B7674C89; Fri, 24 Sep 2021 21:09: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 4HGPm9239Zz3tKZ; Fri, 24 Sep 2021 21:09: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 25C261DA7E; Fri, 24 Sep 2021 21:09: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 18OL9D2h091458; Fri, 24 Sep 2021 21:09:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OL9DJO091457; Fri, 24 Sep 2021 21:09:13 GMT (envelope-from git) Date: Fri, 24 Sep 2021 21:09:13 GMT Message-Id: <202109242109.18OL9DJO091457@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: e725ee7eb672 - main - mount: add libxo(3) support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e725ee7eb672a8501600552283d3d08a2f7b6847 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 21:09:13 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=e725ee7eb672a8501600552283d3d08a2f7b6847 commit e725ee7eb672a8501600552283d3d08a2f7b6847 Author: Cameron Katri AuthorDate: 2021-09-23 20:51:30 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-24 21:07:00 +0000 mount: add libxo(3) support Adds --libxo to mount(8). Differential Revision: https://reviews.freebsd.org/D30341 --- sbin/mount/Makefile | 2 +- sbin/mount/mount.8 | 14 ++++- sbin/mount/mount.c | 153 ++++++++++++++++++++++++++++++++++------------------ 3 files changed, 114 insertions(+), 55 deletions(-) diff --git a/sbin/mount/Makefile b/sbin/mount/Makefile index 68c7ee9819d8..34ba498a2a3f 100644 --- a/sbin/mount/Makefile +++ b/sbin/mount/Makefile @@ -7,6 +7,6 @@ SRCS= mount.c mount_fs.c getmntopts.c vfslist.c MAN= mount.8 # We do NOT install the getmntopts.3 man page. -LIBADD= util +LIBADD= util xo .include diff --git a/sbin/mount/mount.8 b/sbin/mount/mount.8 index 3aee1bb86151..59a0f6bb0329 100644 --- a/sbin/mount/mount.8 +++ b/sbin/mount/mount.8 @@ -28,7 +28,7 @@ .\" @(#)mount.8 8.8 (Berkeley) 6/16/94 .\" $FreeBSD$ .\" -.Dd August 28, 2019 +.Dd May 18, 2021 .Dt MOUNT 8 .Os .Sh NAME @@ -36,14 +36,17 @@ .Nd mount file systems .Sh SYNOPSIS .Nm +.Op Fl -libxo .Op Fl adflpruvw .Op Fl F Ar fstab .Op Fl o Ar options .Op Fl t Oo Cm no Oc Ns Cm Ar type Ns Op Cm , Ns Ar type ... .Nm +.Op Fl -libxo .Op Fl dfpruvw .Ar special | node .Nm +.Op Fl -libxo .Op Fl dfpruvw .Op Fl o Ar options .Op Fl t Oo Cm no Oc Ns Cm Ar type Ns Op Cm , Ns Ar type ... @@ -72,6 +75,13 @@ this list is printed. .Pp The options are as follows: .Bl -tag -width indent +.It Fl -libxo +Generate output via +.Xr libxo 3 +in a selection of different human and machine readable formats. +See +.Xr xo_parse_args 3 +for details on command line arguments. .It Fl a All the file systems described in .Xr fstab 5 @@ -552,6 +562,8 @@ support for a particular file system might be provided either on a static .Xr setfacl 1 , .Xr nmount 2 , .Xr acl 3 , +.Xr libxo 3 , +.Xr xo_parse_args 3 , .Xr mac 4 , .Xr cd9660 5 , .Xr devfs 5 , diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index fad999c97dc9..02242791a7a2 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -60,11 +60,18 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "extern.h" #include "mntopts.h" #include "pathnames.h" +#define EXIT(a) { \ + xo_close_container("mount"); \ + xo_finish(); \ + exit(a); \ + } + /* `meta' options */ #define MOUNT_META_OPTION_FSTAB "fstab" #define MOUNT_META_OPTION_CURRENT "current" @@ -146,21 +153,21 @@ exec_mountprog(const char *name, const char *execname, char *const argv[]) switch (pid = fork()) { case -1: /* Error. */ - warn("fork"); - exit (1); + xo_warn("fork"); + EXIT(1); case 0: /* Child. */ /* Go find an executable. */ execvP(execname, _PATH_SYSPATH, argv); if (errno == ENOENT) { - warn("exec %s not found", execname); + xo_warn("exec %s not found", execname); if (execname[0] != '/') { - warnx("in path: %s", _PATH_SYSPATH); + xo_warnx("in path: %s", _PATH_SYSPATH); } } - exit(1); + EXIT(1); default: /* Parent. */ if (waitpid(pid, &status, 0) < 0) { - warn("waitpid"); + xo_warn("waitpid"); return (1); } @@ -168,7 +175,7 @@ exec_mountprog(const char *name, const char *execname, char *const argv[]) if (WEXITSTATUS(status) != 0) return (WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) { - warnx("%s: %s", name, sys_siglist[WTERMSIG(status)]); + xo_warnx("%s: %s", name, sys_siglist[WTERMSIG(status)]); return (1); } break; @@ -185,7 +192,7 @@ specified_ro(const char *arg) optbuf = strdup(arg); if (optbuf == NULL) - err(1, NULL); + xo_err(1, NULL); for (opt = optbuf; (opt = strtok(opt, ",")) != NULL; opt = NULL) { if (strcmp(opt, "ro") == 0) { @@ -220,13 +227,13 @@ restart_mountd(void) * happened due to the bugs in pidfile(3). */ if (mountdpid <= 0) { - warnx("mountd pid %d, refusing to send SIGHUP", mountdpid); + xo_warnx("mountd pid %d, refusing to send SIGHUP", mountdpid); return; } /* We have mountd(8) PID in mountdpid varible, let's signal it. */ if (kill(mountdpid, SIGHUP) == -1) - err(1, "signal mountd"); + xo_err(1, "signal mountd"); } int @@ -244,6 +251,12 @@ main(int argc, char *argv[]) options = NULL; vfslist = NULL; vfstype = "ufs"; + + argc = xo_parse_args(argc, argv); + if (argc < 0) + exit(1); + xo_open_container("mount"); + while ((ch = getopt(argc, argv, "adF:fLlno:prt:uvw")) != -1) switch (ch) { case 'a': @@ -285,7 +298,7 @@ main(int argc, char *argv[]) break; case 't': if (vfslist != NULL) - errx(1, "only one -t option may be specified"); + xo_errx(1, "only one -t option may be specified"); vfslist = makevfslist(optarg); vfstype = optarg; break; @@ -318,7 +331,7 @@ main(int argc, char *argv[]) case 0: if ((mntsize = getmntinfo(&mntbuf, verbose ? MNT_WAIT : MNT_NOWAIT)) == 0) - err(1, "getmntinfo"); + xo_err(1, "getmntinfo"); if (all) { while ((fs = getfsent()) != NULL) { if (BADTYPE(fs->fs_type)) @@ -347,12 +360,17 @@ main(int argc, char *argv[]) rval = 1; } } else if (fstab_style) { + xo_open_list("fstab"); for (i = 0; i < mntsize; i++) { if (checkvfsname(mntbuf[i].f_fstypename, vfslist)) continue; + xo_open_instance("fstab"); putfsent(&mntbuf[i]); + xo_close_instance("fstab"); } + xo_close_list("fstab"); } else { + xo_open_list("mounted"); for (i = 0; i < mntsize; i++) { if (checkvfsname(mntbuf[i].f_fstypename, vfslist)) @@ -360,10 +378,13 @@ main(int argc, char *argv[]) if (!verbose && (mntbuf[i].f_flags & MNT_IGNORE) != 0) continue; + xo_open_instance("mounted"); prmount(&mntbuf[i]); + xo_close_instance("mounted"); } + xo_close_list("mounted"); } - exit(rval); + EXIT(rval); case 1: if (vfslist != NULL) usage(); @@ -373,7 +394,7 @@ main(int argc, char *argv[]) mntfromname = NULL; have_fstab = 0; if ((mntbuf = getmntpt(*argv)) == NULL) - errx(1, "not currently mounted %s", *argv); + xo_errx(1, "not currently mounted %s", *argv); /* * Only get the mntflags from fstab if both mntpoint * and mntspec are identical. Also handle the special @@ -411,10 +432,10 @@ main(int argc, char *argv[]) } if ((fs = getfsfile(*argv)) == NULL && (fs = getfsspec(*argv)) == NULL) - errx(1, "%s: unknown special file or file system", + xo_errx(1, "%s: unknown special file or file system", *argv); if (BADTYPE(fs->fs_type)) - errx(1, "%s has unknown file system type", + xo_errx(1, "%s has unknown file system type", *argv); rval = mountfs(fs->fs_vfstype, fs->fs_spec, fs->fs_file, init_flags, options, fs->fs_mntops); @@ -460,7 +481,7 @@ main(int argc, char *argv[]) if (rval == 0 && getuid() == 0) restart_mountd(); - exit(rval); + EXIT(rval); } int @@ -537,7 +558,7 @@ append_arg(struct cpa *sa, char *arg) sa->sz = sa->sz == 0 ? 8 : sa->sz * 2; sa->a = realloc(sa->a, sizeof(*sa->a) * sa->sz); if (sa->a == NULL) - errx(1, "realloc failed"); + xo_errx(1, "realloc failed"); } sa->a[++sa->c] = arg; } @@ -553,7 +574,7 @@ mountfs(const char *vfstype, const char *spec, const char *name, int flags, /* resolve the mountpoint with realpath(3) */ if (checkpath(name, mntpath) != 0) { - warn("%s", mntpath); + xo_warn("%s", mntpath); return (1); } name = mntpath; @@ -596,12 +617,12 @@ mountfs(const char *vfstype, const char *spec, const char *name, int flags, if (debug) { if (use_mountprog(vfstype)) - printf("exec: %s", execname); + xo_emit("{Lwc:exec}{:execname/%s}", execname); else - printf("mount -t %s", vfstype); + xo_emit("{:execname/mount}{P: }{l:opts/-t}{P: }{l:opts/%s}", vfstype); for (i = 1; i < mnt_argv.c; i++) - (void)printf(" %s", mnt_argv.a[i]); - (void)printf("\n"); + xo_emit("{P: }{l:opts}", mnt_argv.a[i]); + xo_emit("\n"); free(optbuf); free(mountprog); mountprog = NULL; @@ -620,13 +641,22 @@ mountfs(const char *vfstype, const char *spec, const char *name, int flags, if (verbose) { if (statfs(name, &sf) < 0) { - warn("statfs %s", name); + xo_warn("statfs %s", name); return (1); } - if (fstab_style) + if (fstab_style) { + xo_open_list("fstab"); + xo_open_instance("fstab"); putfsent(&sf); - else + xo_close_instance("fstab"); + xo_close_list("fstab"); + } else { + xo_open_list("mounted"); + xo_open_instance("mounted"); prmount(&sf); + xo_close_instance("mounted"); + xo_close_list("mounted"); + } } return (ret); @@ -639,14 +669,15 @@ prmount(struct statfs *sfp) unsigned int i; struct mntoptnames *o; struct passwd *pw; + char *fsidbuf; - (void)printf("%s on %s (%s", sfp->f_mntfromname, sfp->f_mntonname, - sfp->f_fstypename); + xo_emit("{:special}{L: on }{:node}{L: (}{:fstype}", sfp->f_mntfromname, + sfp->f_mntonname, sfp->f_fstypename); flags = sfp->f_flags & MNT_VISFLAGMASK; for (o = optnames; flags != 0 && o->o_opt != 0; o++) if (flags & o->o_opt) { - (void)printf(", %s", o->o_name); + xo_emit("{D:, }{l:opts}", o->o_name); flags &= ~o->o_opt; } /* @@ -654,28 +685,40 @@ prmount(struct statfs *sfp) * or privileged non-root user. */ if ((flags & MNT_USER) != 0 || sfp->f_owner != 0) { - (void)printf(", mounted by "); + xo_emit("{D:, }{L:mounted by }"); if ((pw = getpwuid(sfp->f_owner)) != NULL) - (void)printf("%s", pw->pw_name); + xo_emit("{:mounter}", pw->pw_name); else - (void)printf("%d", sfp->f_owner); + xo_emit("{:mounter}", sfp->f_owner); } if (verbose) { - if (sfp->f_syncwrites != 0 || sfp->f_asyncwrites != 0) - (void)printf(", writes: sync %ju async %ju", + if (sfp->f_syncwrites != 0 || sfp->f_asyncwrites != 0) { + xo_open_container("writes"); + xo_emit("{D:, }{Lwc:writes}{Lw:sync}{w:sync/%ju}{Lw:async}{:async/%ju}", (uintmax_t)sfp->f_syncwrites, (uintmax_t)sfp->f_asyncwrites); - if (sfp->f_syncreads != 0 || sfp->f_asyncreads != 0) - (void)printf(", reads: sync %ju async %ju", + xo_close_container("writes"); + } + if (sfp->f_syncreads != 0 || sfp->f_asyncreads != 0) { + xo_open_container("reads"); + xo_emit("{D:, }{Lwc:reads}{Lw:sync}{w:sync/%ju}{Lw:async}{:async/%ju}", (uintmax_t)sfp->f_syncreads, (uintmax_t)sfp->f_asyncreads); + xo_close_container("reads"); + } if (sfp->f_fsid.val[0] != 0 || sfp->f_fsid.val[1] != 0) { - (void)printf(", fsid "); + fsidbuf = malloc(sizeof(sfp->f_fsid) * 2 + 1); + if (fsidbuf == NULL) + xo_errx(1, "malloc failed"); for (i = 0; i < sizeof(sfp->f_fsid); i++) - (void)printf("%02x", ((u_char *)&sfp->f_fsid)[i]); + sprintf(&fsidbuf[i * 2], "%02x", + ((u_char *)&sfp->f_fsid)[i]); + fsidbuf[i * 2] = '\0'; + xo_emit("{D:, }{Lw:fsid}{:fsid}", fsidbuf); + free(fsidbuf); } } - (void)printf(")\n"); + xo_emit("{D:)}\n"); } struct statfs * @@ -703,7 +746,7 @@ catopt(char *s0, const char *s1) if (s0 && *s0) { if (asprintf(&cp, "%s,%s", s0, s1) == -1) - errx(1, "asprintf failed"); + xo_errx(1, "asprintf failed"); } else cp = strdup(s1); @@ -758,7 +801,7 @@ mangle(char *options, struct cpa *a) } if (mountprog == NULL) { - errx(1, "Need value for -o mountprog"); + xo_errx(1, "Need value for -o mountprog"); } continue; } else if (strcmp(p, "userquota") == 0) { @@ -824,7 +867,7 @@ update_options(char *opts, char *fstab, int curflags) newopt = NULL; for (p = expopt; (o = strsep(&p, ",")) != NULL;) { if ((tmpopt = malloc( strlen(o) + 2 + 1 )) == NULL) - errx(1, "malloc failed"); + xo_errx(1, "malloc failed"); strcpy(tmpopt, "no"); strcat(tmpopt, o); @@ -867,11 +910,11 @@ void usage(void) { - (void)fprintf(stderr, "%s\n%s\n%s\n", + xo_error("%s\n%s\n%s\n", "usage: mount [-adflpruvw] [-F fstab] [-o options] [-t ufs | external_type]", " mount [-dfpruvw] special | node", " mount [-dfpruvw] [-o options] [-t ufs | external_type] special node"); - exit(1); + EXIT(1); } void @@ -899,32 +942,36 @@ putfsent(struct statfs *ent) } l = strlen(ent->f_mntfromname); - printf("%s%s%s%s", ent->f_mntfromname, + xo_emit("{:device}{P:/%s}{P:/%s}{P:/%s}", + ent->f_mntfromname, l < 8 ? "\t" : "", l < 16 ? "\t" : "", l < 24 ? "\t" : " "); l = strlen(ent->f_mntonname); - printf("%s%s%s%s", ent->f_mntonname, + xo_emit("{:mntpoint}{P:/%s}{P:/%s}{P:/%s}", + ent->f_mntonname, l < 8 ? "\t" : "", l < 16 ? "\t" : "", l < 24 ? "\t" : " "); - printf("%s\t", ent->f_fstypename); + xo_emit("{:fstype}{P:\t}", ent->f_fstypename); l = strlen(opts); - printf("%s%s", opts, + xo_emit("{:opts}{P:/%s}", opts, l < 8 ? "\t" : " "); free(opts); if ((fst = getfsspec(ent->f_mntfromname))) - printf("\t%u %u\n", fst->fs_freq, fst->fs_passno); + xo_emit("{P:\t}{n:dump/%u}{P: }{n:pass/%u}\n", + fst->fs_freq, fst->fs_passno); else if ((fst = getfsfile(ent->f_mntonname))) - printf("\t%u %u\n", fst->fs_freq, fst->fs_passno); + xo_emit("{P:\t}{n:dump/%u}{P: }{n:pass/%u}\n", + fst->fs_freq, fst->fs_passno); else if (strcmp(ent->f_fstypename, "ufs") == 0) { if (strcmp(ent->f_mntonname, "/") == 0) - printf("\t1 1\n"); + xo_emit("{P:\t}{n:dump/1}{P: }{n:pass/1}\n"); else - printf("\t2 2\n"); + xo_emit("{P:\t}{n:dump/2}{P: }{n:pass/2}\n"); } else - printf("\t0 0\n"); + xo_emit("{P:\t}{n:dump/0}{P: }{n:pass/0}\n"); } From owner-dev-commits-src-all@freebsd.org Sat Sep 25 00:35:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67A6067762E; Sat, 25 Sep 2021 00:35: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 4HGVKg1Fclz4fJt; Sat, 25 Sep 2021 00:35: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 0C64F2091B; Sat, 25 Sep 2021 00:35: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 18P0Z2Tv069474; Sat, 25 Sep 2021 00:35:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P0Z2Go069473; Sat, 25 Sep 2021 00:35:02 GMT (envelope-from git) Date: Sat, 25 Sep 2021 00:35:02 GMT Message-Id: <202109250035.18P0Z2Go069473@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: f73c2bbf811b - main - bus: Cleanup device_probe_child() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f73c2bbf811ba77b2fe91b5bc0cbe19e9f7eb6c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 00:35:03 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=f73c2bbf811ba77b2fe91b5bc0cbe19e9f7eb6c4 commit f73c2bbf811ba77b2fe91b5bc0cbe19e9f7eb6c4 Author: Alexander Motin AuthorDate: 2021-09-25 00:27:10 +0000 Commit: Alexander Motin CommitDate: 2021-09-25 00:34:56 +0000 bus: Cleanup device_probe_child() When device driver probe method returns 0, i.e. absolute priority, do not remove its class from the device just to set it back few lines later, that may change the device unit number, etc. and after which we'd better call the probe again. If during search we found some driver with absolute priority, we do not need to set device driver and class since we haven't removed them before. It should not happen, but if second probe method call failed, remove the driver and possibly the class from the device as it was when we started. Reviewed by: imp, jhb Differential Revision: https://reviews.freebsd.org/D32125 --- sys/kern/subr_bus.c | 50 +++++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 958e0aa413d4..cdbaee9c203e 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -2074,6 +2074,7 @@ device_probe_child(device_t dev, device_t child) driverlink_t best = NULL; driverlink_t dl; int result, pri = 0; + /* We should preserve the devclass (or lack of) set by the bus. */ int hasclass = (child->devclass != NULL); GIANT_REQUIRED; @@ -2125,11 +2126,6 @@ device_probe_child(device_t dev, device_t child) result = DEVICE_PROBE(child); - /* Reset flags and devclass before the next probe. */ - child->devflags = 0; - if (!hasclass) - (void)device_set_devclass(child, NULL); - /* * If the driver returns SUCCESS, there can be * no higher match for this device. @@ -2140,6 +2136,11 @@ device_probe_child(device_t dev, device_t child) break; } + /* Reset flags and devclass before the next probe. */ + child->devflags = 0; + if (!hasclass) + (void)device_set_devclass(child, NULL); + /* * Reset DF_QUIET in case this driver doesn't * end up as the best driver. @@ -2184,36 +2185,43 @@ device_probe_child(device_t dev, device_t child) break; } + if (best == NULL) + return (ENXIO); + /* * If we found a driver, change state and initialise the devclass. */ - if (best) { + if (pri < 0) { /* Set the winning driver, devclass, and flags. */ + result = device_set_driver(child, best->driver); + if (result != 0) + return (result); if (!child->devclass) { result = device_set_devclass(child, best->driver->name); - if (result != 0) + if (result != 0) { + (void)device_set_driver(child, NULL); return (result); + } } - result = device_set_driver(child, best->driver); - if (result != 0) - return (result); resource_int_value(best->driver->name, child->unit, "flags", &child->devflags); - if (pri < 0) { - /* - * A bit bogus. Call the probe method again to make - * sure that we have the right description. - */ - DEVICE_PROBE(child); + /* + * A bit bogus. Call the probe method again to make sure + * that we have the right description. + */ + result = DEVICE_PROBE(child); + if (result > 0) { + if (!hasclass) + (void)device_set_devclass(child, NULL); + (void)device_set_driver(child, NULL); + return (result); } - child->state = DS_ALIVE; - - bus_data_generation_update(); - return (0); } - return (ENXIO); + child->state = DS_ALIVE; + bus_data_generation_update(); + return (0); } /** From owner-dev-commits-src-all@freebsd.org Sat Sep 25 00:41:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 987B9676F6E; Sat, 25 Sep 2021 00:41: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 4HGVTW3kFJz4fXh; Sat, 25 Sep 2021 00:41: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 6037420A9D; Sat, 25 Sep 2021 00:41:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18P0fp2s079112; Sat, 25 Sep 2021 00:41:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P0fpHY079111; Sat, 25 Sep 2021 00:41:51 GMT (envelope-from git) Date: Sat, 25 Sep 2021 00:41:51 GMT Message-Id: <202109250041.18P0fpHY079111@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: dc9260515449 - main - 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/main X-Git-Reftype: branch X-Git-Commit: dc9260515449cde9a4b26b5448f7386388c55bbd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 00:41:51 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=dc9260515449cde9a4b26b5448f7386388c55bbd commit dc9260515449cde9a4b26b5448f7386388c55bbd Author: Kevin Bowling AuthorDate: 2021-09-25 00:09:43 +0000 Commit: Kevin Bowling CommitDate: 2021-09-25 00:41:05 +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 --- 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); - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, adapter->link_mask); - } else if (adapter->hw.mac.type == e1000_82574) { *** 3445 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sat Sep 25 00:43:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85126677A84 for ; Sat, 25 Sep 2021 00:43:46 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGVWk2QpYz4fVv for ; Sat, 25 Sep 2021 00:43:46 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-yb1-xb33.google.com with SMTP id z5so9441179ybj.2 for ; Fri, 24 Sep 2021 17:43:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jJ3HDNC9Md5KjFZaE7ZwD3CEK0HwyxTIe7M9qExVOws=; b=GAxtLbPb1QT6hQ3slFapOJNyCU/PQTh6Y8eEkSlHUPol6/JDEStTMX7rWA5otQEWPQ TwICZOIeLHvcPu64+PRQk4Ta2TzysgE7K7gzGZP/BBJoT93jP3LK5UJR8rAsMccuADUL YL/zFIygQ0sQxwzbm/RnWufwsje6I3yYF+v5o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jJ3HDNC9Md5KjFZaE7ZwD3CEK0HwyxTIe7M9qExVOws=; b=7jIupOUzDaNg1KAAwtggVr6Q+hw3Ou/NSoLdjoRclDWqliLCtVAAolWZvvCKuQ5bhZ njq6o3aSjYvTb0eKonM7GNm226iLNRxbSOBC5x41pjo7646z5Y7wg1ejx1ehdd8IalbD d9ShwEHUCwoIwRjwI6vYkpWr9TQm5azT76l4wfVP6HFkxC0qpiQfd9liY7jUGPTKExxj WEb1yhjZT7fkf5cx4x7hYAORTEXQ/AivtYX/dRDTuT7TFiWpoHnLxu/UbaivZBo6fNrQ 5wFyeB+JOq/U+8zm7SE3apgdc0ftqrBc6JvPs4rf1/bDtv2Zh7RJIKEe1erx7w/Oa8f0 1fMw== X-Gm-Message-State: AOAM533xjlZjEJWPKM1RNsfdHxMMetgZnhDET9UhOiVf0boRrVqLOJGN VhS6ho1KRFg5tt71bFbu682kHwTbPWyMfWMa6wxsSA== X-Google-Smtp-Source: ABdhPJwBzTUwmNVLh7ob0w6g9aA6BUXriI+9KRJvUiHxN8Nz0hnI4KNfteKqFc7lfTJiSJqDV3Icsk476Us7xER8Ys4= X-Received: by 2002:a25:bb08:: with SMTP id z8mr16632387ybg.306.1632530625295; Fri, 24 Sep 2021 17:43:45 -0700 (PDT) MIME-Version: 1.0 References: <202109250041.18P0fpHY079111@gitrepo.freebsd.org> In-Reply-To: <202109250041.18P0fpHY079111@gitrepo.freebsd.org> From: Kevin Bowling Date: Fri, 24 Sep 2021 17:43:33 -0700 Message-ID: Subject: Re: git: dc9260515449 - main - e1000: Rename 'struct adapter' to 'struct e1000_sc' To: Kevin Bowling Cc: src-committers , "" , "dev-commits-src-main@FreeBSD.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4HGVWk2QpYz4fVv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 00:43:46 -0000 I didn't update the commit message, it was renamed to 'struct e1000_softc' per feedback from markj. On Fri, Sep 24, 2021 at 5:41 PM Kevin Bowling wrote: > > The branch main has been updated by kbowling (ports committer): > > URL: https://cgit.FreeBSD.org/src/commit/?id=dc9260515449cde9a4b26b5448f7386388c55bbd > > commit dc9260515449cde9a4b26b5448f7386388c55bbd > Author: Kevin Bowling > AuthorDate: 2021-09-25 00:09:43 +0000 > Commit: Kevin Bowling > CommitDate: 2021-09-25 00:41:05 +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 > --- > 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); > - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, adapter->link_mask); > - } else if (adapter->hw.mac.type == e1000_82574) { > *** 3445 LINES SKIPPED *** > _______________________________________________ > dev-commits-src-main@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main > To unsubscribe, send any mail to "dev-commits-src-main-unsubscribe@freebsd.org" From owner-dev-commits-src-all@freebsd.org Sat Sep 25 00:59:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 89E7A677C90; Sat, 25 Sep 2021 00:59:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGVst3Xkqz4gY9; Sat, 25 Sep 2021 00:59:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A57520975; Sat, 25 Sep 2021 00:59: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 18P0xUwd095944; Sat, 25 Sep 2021 00:59:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P0xUIF095943; Sat, 25 Sep 2021 00:59:30 GMT (envelope-from git) Date: Sat, 25 Sep 2021 00:59:30 GMT Message-Id: <202109250059.18P0xUIF095943@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: 6955c22001b1 - stable/13 - unix: Fix a use-after-free in unp_drop() 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: 6955c22001b13b0a3315be5f4c957c2a853ad43e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 00:59:30 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6955c22001b13b0a3315be5f4c957c2a853ad43e commit 6955c22001b13b0a3315be5f4c957c2a853ad43e Author: Mark Johnston AuthorDate: 2021-09-18 14:38:39 +0000 Commit: Mark Johnston CommitDate: 2021-09-25 00:59:20 +0000 unix: Fix a use-after-free in unp_drop() We need to load the socket pointer after locking the PCB, otherwise the socket may have been detached and freed by the time that unp_drop() sets so_error. This previously went unnoticed as the socket zone was _NOFREE. Reported by: pho (cherry picked from commit 50b07c1f7131fd535bbe1b53a3a2e4dfcdcc2e51) --- sys/kern/uipc_usrreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 3d7daac42001..5dca0714c400 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -1962,7 +1962,7 @@ unp_shutdown(struct unpcb *unp) static void unp_drop(struct unpcb *unp) { - struct socket *so = unp->unp_socket; + struct socket *so; struct unpcb *unp2; /* @@ -1972,6 +1972,7 @@ unp_drop(struct unpcb *unp) */ UNP_PCB_LOCK(unp); + so = unp->unp_socket; if (so) so->so_error = ECONNRESET; if ((unp2 = unp_pcb_lock_peer(unp)) != NULL) { From owner-dev-commits-src-all@freebsd.org Sat Sep 25 01:24:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 70C09677F69; Sat, 25 Sep 2021 01:24: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 4HGWQc2TPKz4kQK; Sat, 25 Sep 2021 01:24:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34E9F21590; Sat, 25 Sep 2021 01:24:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18P1OOLD035830; Sat, 25 Sep 2021 01:24:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P1OOP5035829; Sat, 25 Sep 2021 01:24:24 GMT (envelope-from git) Date: Sat, 25 Sep 2021 01:24:24 GMT Message-Id: <202109250124.18P1OOP5035829@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: c8077ccd70cf - main - acpi_cpu: Make device unit numbers match OS CPU IDs. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c8077ccd70cfcbcccb752e89b848f098abcb9309 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 01:24:24 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=c8077ccd70cfcbcccb752e89b848f098abcb9309 commit c8077ccd70cfcbcccb752e89b848f098abcb9309 Author: Alexander Motin AuthorDate: 2021-09-25 01:03:02 +0000 Commit: Alexander Motin CommitDate: 2021-09-25 01:24:19 +0000 acpi_cpu: Make device unit numbers match OS CPU IDs. There are already APIC ID, ACPI ID and OS ID for each CPU. In perfect world all of those may match, but at least for SuperMicro server boards none of them do. Plus none of them match the CPU devices listing order by ACPI. Previous code used the ACPI device listing order to number cpuX devices. It looked nice from NewBus perspective, but introduced 4th different set of IDs. Extremely confusing one, since in some places the device unit numbers were treated as OS CPU IDs (coretemp), but not in others (sysctl dev.cpu.X.%location). --- share/man/man4/acpi.4 | 7 +--- sys/dev/acpica/acpi_cpu.c | 83 ++++++++++++----------------------------------- 2 files changed, 22 insertions(+), 68 deletions(-) diff --git a/share/man/man4/acpi.4 b/share/man/man4/acpi.4 index bf3f5f4d4128..60d77843b340 100644 --- a/share/man/man4/acpi.4 +++ b/share/man/man4/acpi.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 9, 2015 +.Dd September 24, 2021 .Dt ACPI 4 .Os .Sh NAME @@ -210,11 +210,6 @@ entry for access after boot. Enables loading of a custom ACPI DSDT. .It Va acpi_dsdt_name Name of the DSDT table to load, if loading is enabled. -.It Va debug.acpi.cpu_unordered -Do not use the MADT to match ACPI Processor objects to CPUs. -This is needed on a few systems with a buggy BIOS that does not use -consistent processor IDs. -Default is 0 (disabled). .It Va debug.acpi.disabled Selectively disables portions of ACPI for debugging purposes. .It Va debug.acpi.interpreter_slack diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index 3c81d55436ca..ab4ffda7a02e 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -140,12 +140,6 @@ struct acpi_cpu_device { #define CPUDEV_DEVICE_ID "ACPI0007" -/* Allow users to ignore processor orders in MADT. */ -static int cpu_unordered; -SYSCTL_INT(_debug_acpi, OID_AUTO, cpu_unordered, CTLFLAG_RDTUN, - &cpu_unordered, 0, - "Do not use the MADT to match ACPI Processor objects to CPUs."); - /* Knob to disable acpi_cpu devices */ bool acpi_cpu_disabled = false; @@ -169,8 +163,8 @@ static int acpi_cpu_probe(device_t dev); static int acpi_cpu_attach(device_t dev); static int acpi_cpu_suspend(device_t dev); static int acpi_cpu_resume(device_t dev); -static int acpi_pcpu_get_id(device_t dev, uint32_t *acpi_id, - uint32_t *cpu_id); +static int acpi_pcpu_get_id(device_t dev, uint32_t acpi_id, + u_int *cpu_id); static struct resource_list *acpi_cpu_get_rlist(device_t dev, device_t child); static device_t acpi_cpu_add_child(device_t dev, u_int order, const char *name, int unit); @@ -291,19 +285,16 @@ acpi_cpu_probe(device_t dev) return (ENXIO); } } - if (acpi_pcpu_get_id(dev, &acpi_id, &cpu_id) != 0) + if (acpi_pcpu_get_id(dev, acpi_id, &cpu_id) != 0) { + if (bootverbose && (type != ACPI_TYPE_PROCESSOR || acpi_id != 255)) + printf("ACPI: Processor %s (ACPI ID %u) ignored\n", + acpi_name(acpi_get_handle(dev)), acpi_id); return (ENXIO); + } - /* - * Check if we already probed this processor. We scan the bus twice - * so it's possible we've already seen this one. - */ - if (cpu_softc[cpu_id] != NULL) + if (device_set_unit(dev, cpu_id) != 0) return (ENXIO); - /* Mark this processor as in-use and save our derived id for attach. */ - cpu_softc[cpu_id] = (void *)1; - acpi_set_private(dev, (void*)(intptr_t)cpu_id); device_set_desc(dev, "ACPI CPU"); if (!bootverbose && device_get_unit(dev) != 0) { @@ -339,7 +330,7 @@ acpi_cpu_attach(device_t dev) sc = device_get_softc(dev); sc->cpu_dev = dev; sc->cpu_handle = acpi_get_handle(dev); - cpu_id = (int)(intptr_t)acpi_get_private(dev); + cpu_id = device_get_unit(dev); cpu_softc[cpu_id] = sc; pcpu_data = pcpu_find(cpu_id); pcpu_data->pc_device = dev; @@ -546,66 +537,34 @@ acpi_cpu_resume(device_t dev) } /* - * Find the processor associated with a given ACPI ID. By default, - * use the MADT to map ACPI IDs to APIC IDs and use that to locate a - * processor. Some systems have inconsistent ASL and MADT however. - * For these systems the cpu_unordered tunable can be set in which - * case we assume that Processor objects are listed in the same order - * in both the MADT and ASL. + * Find the processor associated with a given ACPI ID. */ static int -acpi_pcpu_get_id(device_t dev, uint32_t *acpi_id, uint32_t *cpu_id) +acpi_pcpu_get_id(device_t dev, uint32_t acpi_id, u_int *cpu_id) { struct pcpu *pc; - uint32_t i, idx; + u_int i; - KASSERT(acpi_id != NULL, ("Null acpi_id")); - KASSERT(cpu_id != NULL, ("Null cpu_id")); - idx = device_get_unit(dev); + CPU_FOREACH(i) { + pc = pcpu_find(i); + if (pc->pc_acpi_id == acpi_id) { + *cpu_id = pc->pc_cpuid; + return (0); + } + } /* * If pc_acpi_id for CPU 0 is not initialized (e.g. a non-APIC * UP box) use the ACPI ID from the first processor we find. */ - if (idx == 0 && mp_ncpus == 1) { + if (mp_ncpus == 1) { pc = pcpu_find(0); if (pc->pc_acpi_id == 0xffffffff) - pc->pc_acpi_id = *acpi_id; + pc->pc_acpi_id = acpi_id; *cpu_id = 0; return (0); } - CPU_FOREACH(i) { - pc = pcpu_find(i); - KASSERT(pc != NULL, ("no pcpu data for %d", i)); - if (cpu_unordered) { - if (idx-- == 0) { - /* - * If pc_acpi_id doesn't match the ACPI ID from the - * ASL, prefer the MADT-derived value. - */ - if (pc->pc_acpi_id != *acpi_id) - *acpi_id = pc->pc_acpi_id; - *cpu_id = pc->pc_cpuid; - return (0); - } - } else { - if (pc->pc_acpi_id == *acpi_id) { - if (bootverbose) - device_printf(dev, - "Processor %s (ACPI ID %u) -> APIC ID %d\n", - acpi_name(acpi_get_handle(dev)), *acpi_id, - pc->pc_cpuid); - *cpu_id = pc->pc_cpuid; - return (0); - } - } - } - - if (bootverbose) - printf("ACPI: Processor %s (ACPI ID %u) ignored\n", - acpi_name(acpi_get_handle(dev)), *acpi_id); - return (ESRCH); } From owner-dev-commits-src-all@freebsd.org Sat Sep 25 01:59:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34F0967863B; Sat, 25 Sep 2021 01:59: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 4HGXBY0zmbz4mdR; Sat, 25 Sep 2021 01:59: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 F1DDF21C71; Sat, 25 Sep 2021 01:59: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 18P1x0CI075799; Sat, 25 Sep 2021 01:59:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P1x0fW075798; Sat, 25 Sep 2021 01:59:00 GMT (envelope-from git) Date: Sat, 25 Sep 2021 01:59:00 GMT Message-Id: <202109250159.18P1x0fW075798@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 340e009ecc00 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 340e009ecc00e5e74d58920ca909968dc7e88af1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 01:59:01 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=340e009ecc00e5e74d58920ca909968dc7e88af1 commit 340e009ecc00e5e74d58920ca909968dc7e88af1 Author: Kyle Evans AuthorDate: 2021-01-27 17:46:15 +0000 Commit: Kyle Evans CommitDate: 2021-09-25 01:50:39 +0000 makesyscalls: stop trying to remove . and .. in cleanup lfs.dir() will include these entries, but os.remove() cannot remove them for obvious reasons. --- 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 bedece17c162..811101305ec4 100644 --- a/sys/tools/makesyscalls.lua +++ b/sys/tools/makesyscalls.lua @@ -100,7 +100,9 @@ local function cleanup() if cleantmp then if lfs.dir(tmpspace) then for fname in lfs.dir(tmpspace) do - os.remove(tmpspace .. "/" .. fname) + if fname ~= "." and fname ~= ".." then + os.remove(tmpspace .. "/" .. fname)) + end end end From owner-dev-commits-src-all@freebsd.org Sat Sep 25 01:59:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A672678B25; Sat, 25 Sep 2021 01:59: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 4HGXBZ1YYRz4mm7; Sat, 25 Sep 2021 01:59: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 1695E21B19; Sat, 25 Sep 2021 01:59: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 18P1x1tM075823; Sat, 25 Sep 2021 01:59:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P1x1IQ075822; Sat, 25 Sep 2021 01:59:01 GMT (envelope-from git) Date: Sat, 25 Sep 2021 01:59:01 GMT Message-Id: <202109250159.18P1x1IQ075822@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: e12a0ffe2b01 - main - makesyscalls: rip out arbitrary command execution MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e12a0ffe2b01a653a213423435bfe0a696ca737e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 01:59:02 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=e12a0ffe2b01a653a213423435bfe0a696ca737e commit e12a0ffe2b01a653a213423435bfe0a696ca737e Author: Kyle Evans AuthorDate: 2021-09-24 01:04:36 +0000 Commit: Kyle Evans CommitDate: 2021-09-25 01:53:44 +0000 makesyscalls: rip out arbitrary command execution This was previously needed only for CloudABI, which used it to generate its capenabled from syscalls.master. CloudABI was removed in cf0ee8738e31, so we don't need to support this anymore. Others looking to do similar things should come up with a more integrated technique, such as a .conf flag or pattern/glob support. brooks suggests that it could be done in modern makesyscalls.lua by adding a config flag to specify always-on/initial flags (CAPENABLED). Reviewed by: brooks, imp MFC after: never Differential Revision: https://reviews.freebsd.org/D32095 --- sys/tools/makesyscalls.lua | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/sys/tools/makesyscalls.lua b/sys/tools/makesyscalls.lua index 811101305ec4..64b260eb65bf 100644 --- a/sys/tools/makesyscalls.lua +++ b/sys/tools/makesyscalls.lua @@ -195,19 +195,6 @@ local function trim(s, char) return s:gsub("^" .. char .. "+", ""):gsub(char .. "+$", "") end --- We have to io.popen it, making sure it's properly escaped, and grab the --- output from the handle returned. -local function exec(cmd) - cmd = cmd:gsub('"', '\\"') - - local shcmd = "/bin/sh -c \"" .. cmd .. "\"" - local fh = io.popen(shcmd) - local output = fh:read("a") - - fh:close() - return output -end - -- config looks like a shell script; in fact, the previous makesyscalls.sh -- script actually sourced it in. It had a pretty common format, so we should -- be fine to make various assumptions @@ -240,8 +227,9 @@ local function process_config(file) key = trim(key) value = trim(value) local delim = value:sub(1,1) - if delim == '`' or delim == '"' then + if delim == '"' then local trailing_context + -- Strip off the key/value part trailing_context = nextline:sub(kvp:len() + 1) -- Strip off any trailing comment @@ -253,26 +241,7 @@ local function process_config(file) print(trailing_context) abort(1, "Malformed line: " .. nextline) end - end - if delim == '`' then - -- Command substition may use $1 and $2 to mean - -- the syscall definition file and itself - -- respectively. We'll go ahead and replace - -- $[0-9] with respective arg in case we want to - -- expand this in the future easily... - value = trim(value, delim) - for capture in value:gmatch("$([0-9]+)") do - capture = tonumber(capture) - if capture > #arg then - abort(1, "Not enough args: " .. - value) - end - value = value:gsub("$" .. capture, - arg[capture]) - end - value = exec(value) - elseif delim == '"' then value = trim(value, delim) else -- Strip off potential comments From owner-dev-commits-src-all@freebsd.org Sat Sep 25 01:59:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88B10678B2D; Sat, 25 Sep 2021 01:59: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 4HGXBb3CSdz4mk7; Sat, 25 Sep 2021 01:59: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 3FACD21C72; Sat, 25 Sep 2021 01:59: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 18P1x3Cf075854; Sat, 25 Sep 2021 01:59:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P1x3vq075853; Sat, 25 Sep 2021 01:59:03 GMT (envelope-from git) Date: Sat, 25 Sep 2021 01:59:03 GMT Message-Id: <202109250159.18P1x3vq075853@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 6687410af7db - main - 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/main X-Git-Reftype: branch X-Git-Commit: 6687410af7dba54e19b773684a969e9c590999e4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 01:59:03 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=6687410af7dba54e19b773684a969e9c590999e4 commit 6687410af7dba54e19b773684a969e9c590999e4 Author: Kyle Evans AuthorDate: 2021-01-27 18:12:33 +0000 Commit: Kyle Evans CommitDate: 2021-09-25 01:55: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. --- 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 64b260eb65bf..7824a533e4d5 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 @@ -208,14 +210,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 @@ -262,7 +261,7 @@ local function process_config(file) end end - io.close(fh) + assert(io.close(fh)) return cfg end @@ -291,7 +290,7 @@ local function grab_capenabled(file, open_fail_ok) end end - io.close(fh) + assert(io.close(fh)) return capentries end @@ -369,8 +368,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) @@ -378,13 +377,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 @@ -505,7 +504,7 @@ local function process_sysfile(file) process_syscall_def(prevline) end - io.close(fh) + assert(io.close(fh)) return capentries end @@ -1108,7 +1107,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] @@ -1116,13 +1115,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 @@ -1150,17 +1143,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 @@ -1358,12 +1362,12 @@ write_line("systrace", read_file("systraceret")) for _, v in ipairs(output_files) do local target = config[v] if target ~= "/dev/null" then - local fh = io.open(target, "w+") + local fh = assert(io.open(target, "w+")) if fh == nil then abort(1, "Failed to open '" .. target .. "'") end - fh:write(read_file(v)) - fh:close() + assert(fh:write(read_file(v))) + assert(fh:close()) end end From owner-dev-commits-src-all@freebsd.org Sat Sep 25 03:23:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F02E66794EB; Sat, 25 Sep 2021 03:23: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 4HGZ4W6DSzz4tqL; Sat, 25 Sep 2021 03:23: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 B5A612302C; Sat, 25 Sep 2021 03:23: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 18P3Nt1Q096408; Sat, 25 Sep 2021 03:23:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P3Ntsc096407; Sat, 25 Sep 2021 03:23:55 GMT (envelope-from git) Date: Sat, 25 Sep 2021 03:23:55 GMT Message-Id: <202109250323.18P3Ntsc096407@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 242923eb848a - main - loader tslog: Don't use sprintf MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 242923eb848a94d657344c2ff45c4f15433cdf3c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 03:23:56 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=242923eb848a94d657344c2ff45c4f15433cdf3c commit 242923eb848a94d657344c2ff45c4f15433cdf3c Author: Colin Percival AuthorDate: 2021-09-25 03:19:38 +0000 Commit: Colin Percival CommitDate: 2021-09-25 03:23:37 +0000 loader tslog: Don't use sprintf Instead, append the log entry "manually". MFC after: 1 week Sponsored by: https://www.patreon.com/cperciva --- stand/libsa/tslog.c | 50 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/stand/libsa/tslog.c b/stand/libsa/tslog.c index c6164aab02a9..a2791f9dc9c4 100644 --- a/stand/libsa/tslog.c +++ b/stand/libsa/tslog.c @@ -42,6 +42,24 @@ static char * tslog_buf = NULL; static size_t tslog_buflen = 0; static size_t tslog_bufpos = 0; +static size_t +tsccat(char * buf, uint64_t tsc) +{ + size_t len; + + /* Handle upper digits. */ + if (tsc >= 10) + len = tsccat(buf, tsc / 10); + else + len = 0; + + /* Write the last digit. */ + buf[len] = "0123456789"[tsc % 10]; + + /* Return the length written. */ + return (len + 1); +} + void tslog_setbuf(void * buf, size_t len) { @@ -69,16 +87,34 @@ tslog(const char * type, const char * f, const char * s) #else uint64_t tsc = 0; #endif - int len; /* If we have no buffer, do nothing. */ if (tslog_buf == NULL) return; - /* Append to existing buffer, if we have enough space. */ - len = snprintf(&tslog_buf[tslog_bufpos], - tslog_buflen - tslog_bufpos, "0x0 %llu %s %s%s%s\n", - (unsigned long long)tsc, type, f, s ? " " : "", s ? s : ""); - if ((len > 0) && (tslog_bufpos + len <= tslog_buflen)) - tslog_bufpos += len; + /* Check that we have enough space. */ + if (tslog_buflen - tslog_bufpos < 32 + strlen(type) + strlen(f) + + (s ? strlen(s) : 0)) + return; + + /* Append to existing buffer. */ + strcpy(&tslog_buf[tslog_bufpos], "0x0 "); + tslog_bufpos += 4; + tslog_bufpos += tsccat(&tslog_buf[tslog_bufpos], tsc); + strcpy(&tslog_buf[tslog_bufpos], " "); + tslog_bufpos += 1; + strcpy(&tslog_buf[tslog_bufpos], type); + tslog_bufpos += strlen(type); + strcpy(&tslog_buf[tslog_bufpos], " "); + tslog_bufpos += 1; + strcpy(&tslog_buf[tslog_bufpos], f); + tslog_bufpos += strlen(f); + if (s != NULL) { + strcpy(&tslog_buf[tslog_bufpos], " "); + tslog_bufpos += 1; + strcpy(&tslog_buf[tslog_bufpos], s); + tslog_bufpos += strlen(s); + } + strcpy(&tslog_buf[tslog_bufpos], "\n"); + tslog_bufpos += 1; } From owner-dev-commits-src-all@freebsd.org Sat Sep 25 03:23:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2674567990E; Sat, 25 Sep 2021 03:23: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 4HGZ4X742Rz4tqN; Sat, 25 Sep 2021 03:23: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 D097322F6A; Sat, 25 Sep 2021 03:23: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 18P3NugO096432; Sat, 25 Sep 2021 03:23:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P3NuNA096431; Sat, 25 Sep 2021 03:23:56 GMT (envelope-from git) Date: Sat, 25 Sep 2021 03:23:56 GMT Message-Id: <202109250323.18P3NuNA096431@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 0a35c4b3cab5 - main - loader printf: Profile with TSLOG MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0a35c4b3cab563e3ab1bf5b7b49bf26e0bb7cb04 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 03:23:57 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=0a35c4b3cab563e3ab1bf5b7b49bf26e0bb7cb04 commit 0a35c4b3cab563e3ab1bf5b7b49bf26e0bb7cb04 Author: Colin Percival AuthorDate: 2021-09-25 03:20:33 +0000 Commit: Colin Percival CommitDate: 2021-09-25 03:23:49 +0000 loader printf: Profile with TSLOG Now that the loader tslog code doesn't call printf, we can profile printf using TSLOG. On an EC2 c5.xlarge instance, we spend roughly 45 ms here (out of roughly 500 ms), presumably due to the time spent writing output to the console. MFC after: 1 week Sponsored by: https://www.patreon.com/cperciva --- stand/libsa/printf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stand/libsa/printf.c b/stand/libsa/printf.c index 1602a2dc519d..4de547b644dd 100644 --- a/stand/libsa/printf.c +++ b/stand/libsa/printf.c @@ -271,6 +271,7 @@ kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap) char padc; int stop = 0, retval = 0; + TSENTER(); num = 0; if (!func) d = (char *) arg; @@ -287,8 +288,10 @@ kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap) padc = ' '; width = 0; while ((ch = (u_char)*fmt++) != '%' || stop) { - if (ch == '\0') + if (ch == '\0') { + TSEXIT(); return (retval); + } PCHAR(ch); } percent = fmt - 1; From owner-dev-commits-src-all@freebsd.org Sat Sep 25 03:32:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4394679264; Sat, 25 Sep 2021 03:32:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGZG14bbyz4vSx; Sat, 25 Sep 2021 03:32: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 7DC19230B1; Sat, 25 Sep 2021 03:32: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 18P3W9jI008784; Sat, 25 Sep 2021 03:32:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P3W9UM008783; Sat, 25 Sep 2021 03:32:09 GMT (envelope-from git) Date: Sat, 25 Sep 2021 03:32:09 GMT Message-Id: <202109250332.18P3W9UM008783@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: d3a8f98acbf5 - main - Make CPU children explicitly share parent unit numbers. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d3a8f98acbf51e728411f10c5f179a30b9ca683c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 03:32:09 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=d3a8f98acbf51e728411f10c5f179a30b9ca683c commit d3a8f98acbf51e728411f10c5f179a30b9ca683c Author: Alexander Motin AuthorDate: 2021-09-25 03:25:46 +0000 Commit: Alexander Motin CommitDate: 2021-09-25 03:31:51 +0000 Make CPU children explicitly share parent unit numbers. Before this device unit number match was coincidental and broke if I disabled some CPU device(s). Aside of cosmetics, for some drivers (may be considered broken) it caused talking to wrong CPUs. --- sys/dev/acpica/acpi_perf.c | 3 ++- sys/dev/acpica/acpi_throttle.c | 3 ++- sys/dev/amdtemp/amdtemp.c | 3 ++- sys/dev/coretemp/coretemp.c | 2 +- sys/dev/cpufreq/cpufreq_dt.c | 3 ++- sys/kern/kern_cpu.c | 2 +- sys/x86/cpufreq/est.c | 2 +- sys/x86/cpufreq/hwpstate_amd.c | 3 ++- sys/x86/cpufreq/hwpstate_intel.c | 8 +++----- sys/x86/cpufreq/p4tcc.c | 3 ++- sys/x86/cpufreq/powernow.c | 3 ++- sys/x86/cpufreq/smist.c | 3 ++- 12 files changed, 22 insertions(+), 16 deletions(-) diff --git a/sys/dev/acpica/acpi_perf.c b/sys/dev/acpica/acpi_perf.c index df0fa9a29b6e..5134bbaaa4dc 100644 --- a/sys/dev/acpica/acpi_perf.c +++ b/sys/dev/acpica/acpi_perf.c @@ -161,7 +161,8 @@ acpi_perf_identify(driver_t *driver, device_t parent) * We probe this child now so that other devices that depend * on it (i.e., for info about supported states) will see it. */ - if ((dev = BUS_ADD_CHILD(parent, 0, "acpi_perf", -1)) != NULL) + if ((dev = BUS_ADD_CHILD(parent, 0, "acpi_perf", + device_get_unit(parent))) != NULL) device_probe_and_attach(dev); else device_printf(parent, "add acpi_perf child failed\n"); diff --git a/sys/dev/acpica/acpi_throttle.c b/sys/dev/acpica/acpi_throttle.c index 883b5d34de09..a9cc2d77ecf9 100644 --- a/sys/dev/acpica/acpi_throttle.c +++ b/sys/dev/acpica/acpi_throttle.c @@ -157,7 +157,8 @@ acpi_throttle_identify(driver_t *driver, device_t parent) obj = (ACPI_OBJECT *)buf.Pointer; if ((obj->Processor.PblkAddress && obj->Processor.PblkLength >= 4) || ACPI_SUCCESS(AcpiEvaluateObject(handle, "_PTC", NULL, NULL))) { - if (BUS_ADD_CHILD(parent, 0, "acpi_throttle", -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, "acpi_throttle", + device_get_unit(parent)) == NULL) device_printf(parent, "add throttle child failed\n"); } AcpiOsFree(obj); diff --git a/sys/dev/amdtemp/amdtemp.c b/sys/dev/amdtemp/amdtemp.c index 21227a47c513..c1d696d070a5 100644 --- a/sys/dev/amdtemp/amdtemp.c +++ b/sys/dev/amdtemp/amdtemp.c @@ -263,7 +263,8 @@ amdtemp_identify(driver_t *driver, device_t parent) return; if (amdtemp_match(parent, NULL)) { - child = device_add_child(parent, "amdtemp", -1); + child = device_add_child(parent, "amdtemp", + device_get_unit(parent)); if (child == NULL) device_printf(parent, "add amdtemp child failed\n"); } diff --git a/sys/dev/coretemp/coretemp.c b/sys/dev/coretemp/coretemp.c index bdc71b284ac7..251fb08b4c11 100644 --- a/sys/dev/coretemp/coretemp.c +++ b/sys/dev/coretemp/coretemp.c @@ -133,7 +133,7 @@ coretemp_identify(driver_t *driver, device_t parent) * We add a child for each CPU since settings must be performed * on each CPU in the SMP case. */ - child = device_add_child(parent, "coretemp", -1); + child = device_add_child(parent, "coretemp", device_get_unit(parent)); if (child == NULL) device_printf(parent, "add coretemp child failed\n"); } diff --git a/sys/dev/cpufreq/cpufreq_dt.c b/sys/dev/cpufreq/cpufreq_dt.c index 3beffeb7063a..4ab021a97d31 100644 --- a/sys/dev/cpufreq/cpufreq_dt.c +++ b/sys/dev/cpufreq/cpufreq_dt.c @@ -309,7 +309,8 @@ cpufreq_dt_identify(driver_t *driver, device_t parent) if (device_find_child(parent, "cpufreq_dt", -1) != NULL) return; - if (BUS_ADD_CHILD(parent, 0, "cpufreq_dt", -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, "cpufreq_dt", device_get_unit(parent)) + == NULL) device_printf(parent, "add cpufreq_dt child failed\n"); } diff --git a/sys/kern/kern_cpu.c b/sys/kern/kern_cpu.c index 2f44405aef37..380849974a35 100644 --- a/sys/kern/kern_cpu.c +++ b/sys/kern/kern_cpu.c @@ -1103,7 +1103,7 @@ cpufreq_register(device_t dev) } /* Add the child device and possibly sysctls. */ - cf_dev = BUS_ADD_CHILD(cpu_dev, 0, "cpufreq", -1); + cf_dev = BUS_ADD_CHILD(cpu_dev, 0, "cpufreq", device_get_unit(cpu_dev)); if (cf_dev == NULL) return (ENOMEM); device_quiet(cf_dev); diff --git a/sys/x86/cpufreq/est.c b/sys/x86/cpufreq/est.c index 258a9c493d0f..cdca2fdfec5f 100644 --- a/sys/x86/cpufreq/est.c +++ b/sys/x86/cpufreq/est.c @@ -946,7 +946,7 @@ est_identify(driver_t *driver, device_t parent) * We add a child for each CPU since settings must be performed * on each CPU in the SMP case. */ - child = BUS_ADD_CHILD(parent, 10, "est", -1); + child = BUS_ADD_CHILD(parent, 10, "est", device_get_unit(parent)); if (child == NULL) device_printf(parent, "add est child failed\n"); } diff --git a/sys/x86/cpufreq/hwpstate_amd.c b/sys/x86/cpufreq/hwpstate_amd.c index ee67da43de53..3193cbd908cc 100644 --- a/sys/x86/cpufreq/hwpstate_amd.c +++ b/sys/x86/cpufreq/hwpstate_amd.c @@ -341,7 +341,8 @@ hwpstate_identify(driver_t *driver, device_t parent) if (resource_disabled("hwpstate", 0)) return; - if (BUS_ADD_CHILD(parent, 10, "hwpstate", -1) == NULL) + if (BUS_ADD_CHILD(parent, 10, "hwpstate", device_get_unit(parent)) + == NULL) device_printf(parent, "hwpstate: add child failed\n"); } diff --git a/sys/x86/cpufreq/hwpstate_intel.c b/sys/x86/cpufreq/hwpstate_intel.c index f6e63fdeb854..d4d94cadab28 100644 --- a/sys/x86/cpufreq/hwpstate_intel.c +++ b/sys/x86/cpufreq/hwpstate_intel.c @@ -351,11 +351,9 @@ intel_hwpstate_identify(driver_t *driver, device_t parent) if ((cpu_power_eax & CPUTPM1_HWP) == 0) return; - if (BUS_ADD_CHILD(parent, 10, "hwpstate_intel", -1) == NULL) - return; - - if (bootverbose) - device_printf(parent, "hwpstate registered\n"); + if (BUS_ADD_CHILD(parent, 10, "hwpstate_intel", device_get_unit(parent)) + == NULL) + device_printf(parent, "hwpstate_intel: add child failed\n"); } static int diff --git a/sys/x86/cpufreq/p4tcc.c b/sys/x86/cpufreq/p4tcc.c index 89bfef3f6930..4370da81cf06 100644 --- a/sys/x86/cpufreq/p4tcc.c +++ b/sys/x86/cpufreq/p4tcc.c @@ -135,7 +135,8 @@ p4tcc_identify(driver_t *driver, device_t parent) * of the IA32 Intel Architecture Software Developer's Manual, * Volume 3, for more info. */ - if (BUS_ADD_CHILD(parent, 10, "p4tcc", -1) == NULL) + if (BUS_ADD_CHILD(parent, 10, "p4tcc", device_get_unit(parent)) + == NULL) device_printf(parent, "add p4tcc child failed\n"); } diff --git a/sys/x86/cpufreq/powernow.c b/sys/x86/cpufreq/powernow.c index da5598557387..977798ab2f77 100644 --- a/sys/x86/cpufreq/powernow.c +++ b/sys/x86/cpufreq/powernow.c @@ -876,7 +876,8 @@ pn_identify(driver_t *driver, device_t parent) } if (device_find_child(parent, "powernow", -1) != NULL) return; - if (BUS_ADD_CHILD(parent, 10, "powernow", -1) == NULL) + if (BUS_ADD_CHILD(parent, 10, "powernow", device_get_unit(parent)) + == NULL) device_printf(parent, "powernow: add child failed\n"); } diff --git a/sys/x86/cpufreq/smist.c b/sys/x86/cpufreq/smist.c index f95939001ecb..fda7cb2f52bc 100644 --- a/sys/x86/cpufreq/smist.c +++ b/sys/x86/cpufreq/smist.c @@ -311,7 +311,8 @@ smist_identify(driver_t *driver, device_t parent) if (device_find_child(parent, "smist", -1) != NULL) return; - if (BUS_ADD_CHILD(parent, 30, "smist", -1) == NULL) + if (BUS_ADD_CHILD(parent, 30, "smist", device_get_unit(parent)) + == NULL) device_printf(parent, "smist: add child failed\n"); } From owner-dev-commits-src-all@freebsd.org Sat Sep 25 04:53:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B76067B241; Sat, 25 Sep 2021 04:53: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 4HGc3q18Y3z3JNh; Sat, 25 Sep 2021 04:53: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 08712242B2; Sat, 25 Sep 2021 04:53: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 18P4rQ0L016060; Sat, 25 Sep 2021 04:53:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P4rQ3G016059; Sat, 25 Sep 2021 04:53:26 GMT (envelope-from git) Date: Sat, 25 Sep 2021 04:53:26 GMT Message-Id: <202109250453.18P4rQ3G016059@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marko Zec Subject: git: 43880c511cef - main - [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/main X-Git-Reftype: branch X-Git-Commit: 43880c511cef68098a9ca5a797f28e2c4d29cfad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 04:53:27 -0000 The branch main has been updated by zec: URL: https://cgit.FreeBSD.org/src/commit/?id=43880c511cef68098a9ca5a797f28e2c4d29cfad commit 43880c511cef68098a9ca5a797f28e2c4d29cfad Author: Marko Zec AuthorDate: 2021-09-25 04:29:48 +0000 Commit: Marko Zec CommitDate: 2021-09-25 04:29:48 +0000 [fib_algo][dxr] Split unused range chunk list in multiple buckets Traversing a single list of unused range chunks in search for a block of optimal size was suboptimal. The experience with real-world BGP workloads has shown that on average unused range chunks are tiny, mostly in length from 1 to 4 or 5, when DXR is configured with K = 20 which is the current default (D16X4R). Therefore, introduce a limited amount of buckets to accomodate descriptors of empty blocks of fixed (small) size, so that those can be found in O(1) time. If no empty chunks of the requested size can be found in fixed-size buckets, the search continues in an unsorted list of empty chunks of variable lengths, which should only happen infrequently. This change should permit us to manage significantly more empty range chunks without sacrifying the speed of incremental range table updating. MFC after: 3 days --- sys/netinet/in_fib_dxr.c | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/sys/netinet/in_fib_dxr.c b/sys/netinet/in_fib_dxr.c index c4f42abdda27..6a9f414c3ab0 100644 --- a/sys/netinet/in_fib_dxr.c +++ b/sys/netinet/in_fib_dxr.c @@ -115,6 +115,8 @@ CTASSERT(DXR_TRIE_BITS >= 16 && DXR_TRIE_BITS <= 24); #define XTBL_SIZE_INCR (DIRECT_TBL_SIZE / 16) +#define UNUSED_BUCKETS 8 + /* Lookup structure elements */ struct direct_entry { @@ -181,7 +183,7 @@ struct dxr_aux { struct trie_desc *trietbl[D_TBL_SIZE]; LIST_HEAD(, chunk_desc) chunk_hashtbl[CHUNK_HASH_SIZE]; LIST_HEAD(, chunk_desc) all_chunks; - LIST_HEAD(, chunk_desc) unused_chunks; /* abuses hash link entry */ + LIST_HEAD(, chunk_desc) unused_chunks[UNUSED_BUCKETS]; LIST_HEAD(, trie_desc) trie_hashtbl[TRIE_HASH_SIZE]; LIST_HEAD(, trie_desc) all_trie; LIST_HEAD(, trie_desc) unused_trie; /* abuses hash link entry */ @@ -387,6 +389,7 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk) uint32_t base = fdesc->base; uint32_t size = chunk_size(da, fdesc); uint32_t hash = chunk_hash(da, fdesc); + int i; /* Find an existing descriptor */ LIST_FOREACH(cdp, &da->chunk_hashtbl[hash & CHUNK_HASH_MASK], @@ -401,15 +404,18 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk) return (0); } - /* No matching chunks found. Recycle an empty or allocate a new one */ - cdp = NULL; - LIST_FOREACH(empty_cdp, &da->unused_chunks, cd_hash_le) - if (empty_cdp->cd_max_size >= size && (cdp == NULL || - empty_cdp->cd_max_size < cdp->cd_max_size)) { - cdp = empty_cdp; - if (empty_cdp->cd_max_size == size) - break; - } + /* No matching chunks found. Find an empty one to recycle. */ + for (cdp = NULL, i = size; cdp == NULL && i < UNUSED_BUCKETS; i++) + cdp = LIST_FIRST(&da->unused_chunks[i]); + + if (cdp == NULL) + LIST_FOREACH(empty_cdp, &da->unused_chunks[0], cd_hash_le) + if (empty_cdp->cd_max_size >= size && (cdp == NULL || + empty_cdp->cd_max_size < cdp->cd_max_size)) { + cdp = empty_cdp; + if (empty_cdp->cd_max_size == size) + break; + } if (cdp != NULL) { /* Copy from heap into the recycled chunk */ @@ -423,11 +429,17 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk) empty_cdp = uma_zalloc(chunk_zone, M_NOWAIT); if (empty_cdp == NULL) return (1); + LIST_INSERT_BEFORE(cdp, empty_cdp, cd_all_le); + empty_cdp->cd_base = cdp->cd_base + size; empty_cdp->cd_cur_size = 0; empty_cdp->cd_max_size = cdp->cd_max_size - size; - empty_cdp->cd_base = cdp->cd_base + size; - LIST_INSERT_BEFORE(cdp, empty_cdp, cd_all_le); - LIST_INSERT_AFTER(cdp, empty_cdp, cd_hash_le); + + i = empty_cdp->cd_max_size; + if (i >= UNUSED_BUCKETS) + i = 0; + LIST_INSERT_HEAD(&da->unused_chunks[i], empty_cdp, + cd_hash_le); + da->all_chunks_cnt++; da->unused_chunks_cnt++; cdp->cd_max_size = size; @@ -480,6 +492,7 @@ chunk_unref(struct dxr_aux *da, uint32_t chunk) uint32_t base = fdesc->base; uint32_t size = chunk_size(da, fdesc); uint32_t hash = chunk_hash(da, fdesc); + int i; /* Find the corresponding descriptor */ LIST_FOREACH(cdp, &da->chunk_hashtbl[hash & CHUNK_HASH_MASK], @@ -538,7 +551,10 @@ chunk_unref(struct dxr_aux *da, uint32_t chunk) return; } - LIST_INSERT_HEAD(&da->unused_chunks, cdp, cd_hash_le); + i = cdp->cd_max_size; + if (i >= UNUSED_BUCKETS) + i = 0; + LIST_INSERT_HEAD(&da->unused_chunks[i], cdp, cd_hash_le); } #ifdef DXR2 @@ -891,7 +907,8 @@ dxr_build(struct dxr *dxr) LIST_REMOVE(cdp, cd_all_le); uma_zfree(chunk_zone, cdp); } - LIST_INIT(&da->unused_chunks); + for (i = 0; i < UNUSED_BUCKETS; i++) + LIST_INIT(&da->unused_chunks[i]); da->all_chunks_cnt = da->unused_chunks_cnt = 0; da->rtbl_top = 0; da->updates_low = 0; From owner-dev-commits-src-all@freebsd.org Sat Sep 25 05:04:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2783E67B604; Sat, 25 Sep 2021 05:04: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 4HGcK706Jdz3Jx9; Sat, 25 Sep 2021 05:04: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 CD62E2468E; Sat, 25 Sep 2021 05:04: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 18P54wdE030561; Sat, 25 Sep 2021 05:04:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P54waG030560; Sat, 25 Sep 2021 05:04:58 GMT (envelope-from git) Date: Sat, 25 Sep 2021 05:04:58 GMT Message-Id: <202109250504.18P54waG030560@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 33c1e7271ac2 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 33c1e7271ac21a626829289780b88071ae46ec65 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 05:04:59 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=33c1e7271ac21a626829289780b88071ae46ec65 commit 33c1e7271ac21a626829289780b88071ae46ec65 Author: Kyle Evans AuthorDate: 2021-09-25 05:00:31 +0000 Commit: Kyle Evans CommitDate: 2021-09-25 05:03:50 +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. --- bin/hostname/hostname.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/hostname/hostname.c b/bin/hostname/hostname.c index d5cc6b1cfff2..3dbafa9d3566 100644 --- a/bin/hostname/hostname.c +++ b/bin/hostname/hostname.c @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) { int ch, sflag, dflag; - char *p, hostname[MAXHOSTNAMELEN]; + char hostname[MAXHOSTNAMELEN], *hostp, *p; sflag = 0; dflag = 0; @@ -90,6 +90,7 @@ main(int argc, char *argv[]) if (sethostname(*argv, (int)strlen(*argv))) err(1, "sethostname"); } else { + hostp = hostname; if (gethostname(hostname, (int)sizeof(hostname))) err(1, "gethostname"); if (sflag) { @@ -99,9 +100,9 @@ main(int argc, char *argv[]) } else if (dflag) { p = strchr(hostname, '.'); if (p != NULL) - strcpy(hostname, ++p); + hostp = p + 1; } - (void)printf("%s\n", hostname); + (void)printf("%s\n", hostp); } exit(0); } From owner-dev-commits-src-all@freebsd.org Sat Sep 25 05:41:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C7BA67B83F; Sat, 25 Sep 2021 05:41: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 4HGd6k1TSsz3LLk; Sat, 25 Sep 2021 05:41: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 12BE824D1D; Sat, 25 Sep 2021 05:41: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 18P5f1hL078855; Sat, 25 Sep 2021 05:41:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P5f1uO078854; Sat, 25 Sep 2021 05:41:01 GMT (envelope-from git) Date: Sat, 25 Sep 2021 05:41:01 GMT Message-Id: <202109250541.18P5f1uO078854@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 08d4089f57d5 - stable/11 - Update leap-seconds to leap-seconds.3676924800. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 08d4089f57d584aaa0543216cb69a1750a1238d1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 05:41:02 -0000 The branch stable/11 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=08d4089f57d584aaa0543216cb69a1750a1238d1 commit 08d4089f57d584aaa0543216cb69a1750a1238d1 Author: Xin LI AuthorDate: 2021-09-20 05:26:22 +0000 Commit: Xin LI CommitDate: 2021-09-25 05:40:45 +0000 Update leap-seconds to leap-seconds.3676924800. Obtained from: ftp://ftp.nist.gov/pub/time/leap-seconds.3676924800. MFC after: 3 days (cherry picked from commit 7ba7bf48d5bd6ca89f4e81579456b74ee7aa9e4f) --- etc/ntp/leap-seconds | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/ntp/leap-seconds b/etc/ntp/leap-seconds index e897a867e164..cfda3e885e64 100644 --- a/etc/ntp/leap-seconds +++ b/etc/ntp/leap-seconds @@ -204,10 +204,10 @@ # current -- the update time stamp, the data and the name of the file # will not change. # -# Updated through IERS Bulletin C60 -# File expires on: 28 June 2021 +# Updated through IERS Bulletin C62 +# File expires on: 28 June 2022 # -#@ 3833827200 +#@ 3865363200 # 2272060800 10 # 1 Jan 1972 2287785600 11 # 1 Jul 1972 @@ -252,4 +252,4 @@ # the hash line is also ignored in the # computation. # -#h 064356a8 39268b92 76e4d5ef 3e22fae1 0cca529c +#h 599d45bf accd4b4f 8b60e46 49b623 7d13b825 From owner-dev-commits-src-all@freebsd.org Sat Sep 25 05:41:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5CA2C67BE01; Sat, 25 Sep 2021 05:41: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 4HGd7V21f3z3Lb6; Sat, 25 Sep 2021 05:41: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 254ED24AF4; Sat, 25 Sep 2021 05:41: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 18P5fgwQ079879; Sat, 25 Sep 2021 05:41:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P5fgtK079878; Sat, 25 Sep 2021 05:41:42 GMT (envelope-from git) Date: Sat, 25 Sep 2021 05:41:42 GMT Message-Id: <202109250541.18P5fgtK079878@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 7cbe2b56f84a - stable/12 - Update leap-seconds to leap-seconds.3676924800. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7cbe2b56f84a29e999588b20e70c0559daddad2e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 05:41:42 -0000 The branch stable/12 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=7cbe2b56f84a29e999588b20e70c0559daddad2e commit 7cbe2b56f84a29e999588b20e70c0559daddad2e Author: Xin LI AuthorDate: 2021-09-20 05:26:22 +0000 Commit: Xin LI CommitDate: 2021-09-25 05:41:33 +0000 Update leap-seconds to leap-seconds.3676924800. Obtained from: ftp://ftp.nist.gov/pub/time/leap-seconds.3676924800. MFC after: 3 days (cherry picked from commit 7ba7bf48d5bd6ca89f4e81579456b74ee7aa9e4f) --- usr.sbin/ntp/ntpd/leap-seconds | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.sbin/ntp/ntpd/leap-seconds b/usr.sbin/ntp/ntpd/leap-seconds index e897a867e164..cfda3e885e64 100644 --- a/usr.sbin/ntp/ntpd/leap-seconds +++ b/usr.sbin/ntp/ntpd/leap-seconds @@ -204,10 +204,10 @@ # current -- the update time stamp, the data and the name of the file # will not change. # -# Updated through IERS Bulletin C60 -# File expires on: 28 June 2021 +# Updated through IERS Bulletin C62 +# File expires on: 28 June 2022 # -#@ 3833827200 +#@ 3865363200 # 2272060800 10 # 1 Jan 1972 2287785600 11 # 1 Jul 1972 @@ -252,4 +252,4 @@ # the hash line is also ignored in the # computation. # -#h 064356a8 39268b92 76e4d5ef 3e22fae1 0cca529c +#h 599d45bf accd4b4f 8b60e46 49b623 7d13b825 From owner-dev-commits-src-all@freebsd.org Sat Sep 25 05:42:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 94A8467B77C; Sat, 25 Sep 2021 05:42: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 4HGd8L3ptmz3LSb; Sat, 25 Sep 2021 05:42: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 632BF24E29; Sat, 25 Sep 2021 05:42: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 18P5gQBd083050; Sat, 25 Sep 2021 05:42:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P5gQGw083049; Sat, 25 Sep 2021 05:42:26 GMT (envelope-from git) Date: Sat, 25 Sep 2021 05:42:26 GMT Message-Id: <202109250542.18P5gQGw083049@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 485a546a3a60 - stable/13 - Update leap-seconds to leap-seconds.3676924800. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 485a546a3a60aeb308005a916715e3a1b02352e0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 05:42:26 -0000 The branch stable/13 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=485a546a3a60aeb308005a916715e3a1b02352e0 commit 485a546a3a60aeb308005a916715e3a1b02352e0 Author: Xin LI AuthorDate: 2021-09-20 05:26:22 +0000 Commit: Xin LI CommitDate: 2021-09-25 05:42:21 +0000 Update leap-seconds to leap-seconds.3676924800. Obtained from: ftp://ftp.nist.gov/pub/time/leap-seconds.3676924800. MFC after: 3 days (cherry picked from commit 7ba7bf48d5bd6ca89f4e81579456b74ee7aa9e4f) --- usr.sbin/ntp/ntpd/leap-seconds | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.sbin/ntp/ntpd/leap-seconds b/usr.sbin/ntp/ntpd/leap-seconds index e897a867e164..cfda3e885e64 100644 --- a/usr.sbin/ntp/ntpd/leap-seconds +++ b/usr.sbin/ntp/ntpd/leap-seconds @@ -204,10 +204,10 @@ # current -- the update time stamp, the data and the name of the file # will not change. # -# Updated through IERS Bulletin C60 -# File expires on: 28 June 2021 +# Updated through IERS Bulletin C62 +# File expires on: 28 June 2022 # -#@ 3833827200 +#@ 3865363200 # 2272060800 10 # 1 Jan 1972 2287785600 11 # 1 Jul 1972 @@ -252,4 +252,4 @@ # the hash line is also ignored in the # computation. # -#h 064356a8 39268b92 76e4d5ef 3e22fae1 0cca529c +#h 599d45bf accd4b4f 8b60e46 49b623 7d13b825 From owner-dev-commits-src-all@freebsd.org Sat Sep 25 08:41:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4959E67DDAD; Sat, 25 Sep 2021 08:41: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 4HGj6q1Tz8z3m5B; Sat, 25 Sep 2021 08:41: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 1418C270D1; Sat, 25 Sep 2021 08:41: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 18P8fM2U017901; Sat, 25 Sep 2021 08:41:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P8fMRW017900; Sat, 25 Sep 2021 08:41:22 GMT (envelope-from git) Date: Sat, 25 Sep 2021 08:41:22 GMT Message-Id: <202109250841.18P8fMRW017900@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: a7ce2cf0ff40 - stable/13 - Update a sysctl name to nbuffers_pcpu in hwpmc.4 and pmcstat.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a7ce2cf0ff40fbd2bbbf4e0e00c32737998712fc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 08:41:23 -0000 The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=a7ce2cf0ff40fbd2bbbf4e0e00c32737998712fc commit a7ce2cf0ff40fbd2bbbf4e0e00c32737998712fc Author: Piotr Pawel Stefaniak AuthorDate: 2021-08-28 08:01:19 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-25 08:34:38 +0000 Update a sysctl name to nbuffers_pcpu in hwpmc.4 and pmcstat.c This change was missed in r333509 (e6b475e0af). (cherry picked from commit 0939f965d80d00e783b3319a57e7d71e0b3f202e) --- share/man/man4/hwpmc.4 | 2 +- sys/dev/hwpmc/hwpmc_logging.c | 2 +- usr.sbin/pmcstat/pmcstat.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man4/hwpmc.4 b/share/man/man4/hwpmc.4 index 5777cdd4264d..063313045137 100644 --- a/share/man/man4/hwpmc.4 +++ b/share/man/man4/hwpmc.4 @@ -426,7 +426,7 @@ The default buffer size is 4KB. .It Va kern.hwpmc.mtxpoolsize Pq integer, read-only The size of the spin mutex pool used by the PMC driver. The default is 32. -.It Va kern.hwpmc.nbuffers Pq integer, read-only +.It Va kern.hwpmc.nbuffers_pcpu Pq integer, read-only The number of log buffers used by .Nm for logging. diff --git a/sys/dev/hwpmc/hwpmc_logging.c b/sys/dev/hwpmc/hwpmc_logging.c index c13b87f4165f..c16adff8c842 100644 --- a/sys/dev/hwpmc/hwpmc_logging.c +++ b/sys/dev/hwpmc/hwpmc_logging.c @@ -86,7 +86,7 @@ SYSCTL_INT(_kern_hwpmc, OID_AUTO, logbuffersize, CTLFLAG_RDTUN, &pmclog_buffer_size, 0, "size of log buffers in kilobytes"); /* - * kern.hwpmc.nbuffer -- number of global log buffers + * kern.hwpmc.nbuffers_pcpu -- number of global log buffers */ static int pmc_nlogbuffers_pcpu = PMC_NLOGBUFFERS_PCPU; diff --git a/usr.sbin/pmcstat/pmcstat.c b/usr.sbin/pmcstat/pmcstat.c index 997005cec269..3e2d101ab113 100644 --- a/usr.sbin/pmcstat/pmcstat.c +++ b/usr.sbin/pmcstat/pmcstat.c @@ -1455,7 +1455,7 @@ main(int argc, char **argv) args.pa_verbosity > 0) warnx( "WARNING: at least %u event%s were discarded while running.\n" -"Please consider tuning the \"kern.hwpmc.nbuffers\" tunable.", +"Please consider tuning the \"kern.hwpmc.nbuffers_pcpu\" tunable.", ds_end.pm_buffer_requests_failed - ds_start.pm_buffer_requests_failed, ((ds_end.pm_buffer_requests_failed - From owner-dev-commits-src-all@freebsd.org Sat Sep 25 08:41:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F33F967DD58; Sat, 25 Sep 2021 08:41: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 4HGj6v5j1hz3lvZ; Sat, 25 Sep 2021 08:41: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 A122B27311; Sat, 25 Sep 2021 08:41: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 18P8fRaO018004; Sat, 25 Sep 2021 08:41:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P8fRD7018003; Sat, 25 Sep 2021 08:41:27 GMT (envelope-from git) Date: Sat, 25 Sep 2021 08:41:27 GMT Message-Id: <202109250841.18P8fRD7018003@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: ec5849afc86c - stable/13 - sh: improve command completion MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ec5849afc86ca6b2df9e7fad5e7d3a1ce92fe714 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 08:41:28 -0000 The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=ec5849afc86ca6b2df9e7fad5e7d3a1ce92fe714 commit ec5849afc86ca6b2df9e7fad5e7d3a1ce92fe714 Author: Piotr Pawel Stefaniak AuthorDate: 2021-09-22 16:23:29 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-25 08:34:38 +0000 sh: improve command completion When there are many matches, find the longest common substring starting from the beginning of each command and use that to replace input. As an example: on my system, llv will be autocompleted to llvm- and another will print all matching llvm commands. (cherry picked from commit c866d0c798a20b8f0a92df524f4ddd0d81511c88) --- bin/sh/histedit.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 7c366d252743..f3100221d6ad 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -538,7 +538,7 @@ static char const char *dirname; char **matches = NULL; size_t i = 0, size = 16, uniq; - size_t curpos = end - start; + size_t curpos = end - start, lcstring = -1; if (start > 0 || memchr("/.~", text[0], 3) != NULL) return (NULL); @@ -594,11 +594,20 @@ out: if (i > 1) { qsort_s(matches + 1, i, sizeof(matches[0]), comparator, (void *)(intptr_t)curpos); - for (size_t k = 2; k <= i; k++) - if (strcmp(matches[uniq] + curpos, matches[k] + curpos) == 0) + for (size_t k = 2; k <= i; k++) { + const char *l = matches[uniq] + curpos; + const char *r = matches[k] + curpos; + size_t common = 0; + + while (*l != '\0' && *r != '\0' && *l == *r) + (void)l++, r++, common++; + if (common < lcstring) + lcstring = common; + if (*l == *r) free(matches[k]); else matches[++uniq] = matches[k]; + } } matches[uniq + 1] = NULL; /* @@ -610,7 +619,12 @@ out: * string in matches[0] which is the reason to copy the full name of the * only match. */ - matches[0] = strdup(uniq == 1 ? matches[1] : text); + if (uniq == 1) + matches[0] = strdup(matches[1]); + else if (lcstring != (size_t)-1) + matches[0] = strndup(matches[1], curpos + lcstring); + else + matches[0] = strdup(text); if (matches[0] == NULL) { for (size_t k = 1; k <= uniq; k++) free(matches[k]); From owner-dev-commits-src-all@freebsd.org Sat Sep 25 08:41:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C623367DDB4; Sat, 25 Sep 2021 08:41: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 4HGj6s4YXHz3lph; Sat, 25 Sep 2021 08:41: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 605EF27396; Sat, 25 Sep 2021 08:41: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 18P8fPj5017949; Sat, 25 Sep 2021 08:41:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P8fPjX017948; Sat, 25 Sep 2021 08:41:25 GMT (envelope-from git) Date: Sat, 25 Sep 2021 08:41:25 GMT Message-Id: <202109250841.18P8fPjX017948@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: b2b7eb9e23dc - stable/13 - sh: improve command completion MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b2b7eb9e23dcb4381780590fb7393b17d19100f5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 08:41:26 -0000 The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=b2b7eb9e23dcb4381780590fb7393b17d19100f5 commit b2b7eb9e23dcb4381780590fb7393b17d19100f5 Author: Piotr Pawel Stefaniak AuthorDate: 2021-09-18 11:26:51 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-25 08:34:38 +0000 sh: improve command completion When multiple matches are found, we keep the provided string on the input line and print unique matches as suggestions. But the multiple matches might be the same command found in different directories, so we should deduplicate the matches first and then decide whether to autocomplete the command or not, based on the number of unique matches. (cherry picked from commit b8ff849cbddfee3404d6550cf98f53d6bb617707) --- bin/sh/histedit.c | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 8d9e9fc64db3..488a0b355f80 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -530,7 +530,7 @@ static char char *free_path = NULL, *path; const char *dirname; char **matches = NULL; - size_t i = 0, size = 16, j, k; + size_t i = 0, size = 16, uniq; size_t curpos = end - start; if (start > 0 || memchr("/.~", text[0], 3) != NULL) @@ -579,6 +579,21 @@ static char } out: free(free_path); + if (i == 0) { + free(matches); + return (NULL); + } + uniq = 1; + if (i > 1) { + qsort_s(matches + 1, i, sizeof(matches[0]), comparator, + (void *)(intptr_t)curpos); + for (size_t k = 2; k <= i; k++) + if (strcmp(matches[uniq] + curpos, matches[k] + curpos) == 0) + free(matches[k]); + else + matches[++uniq] = matches[k]; + } + matches[uniq + 1] = NULL; /* * matches[0] is special: it's not a real matching file name but a common * prefix for all matching names. It can't be null, unlike any other @@ -588,30 +603,13 @@ out: * string in matches[0] which is the reason to copy the full name of the * only match. */ - if (i == 0) { - free(matches); - return (NULL); - } else if (i == 1) { - matches[0] = strdup(matches[1]); - matches[2] = NULL; - if (matches[0] != NULL) - return (matches); - } else - matches[0] = strdup(text); + matches[0] = strdup(uniq == 1 ? matches[1] : text); if (matches[0] == NULL) { - for (j = 1; j <= i; j++) - free(matches[j]); + for (size_t k = 1; k <= uniq; k++) + free(matches[k]); free(matches); return (NULL); } - qsort_s(matches + 1, i, sizeof(matches[0]), comparator, - (void *)(intptr_t)curpos); - for (j = 1, k = 2; k <= i; k++) - if (strcmp(matches[j] + curpos, matches[k] + curpos) == 0) - free(matches[k]); - else - matches[++j] = matches[k]; - matches[j + 1] = NULL; return (matches); } From owner-dev-commits-src-all@freebsd.org Sat Sep 25 08:41:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CAB4467DC93; Sat, 25 Sep 2021 08:41: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 4HGj6t4bG9z3lP6; Sat, 25 Sep 2021 08:41: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 7C94127398; Sat, 25 Sep 2021 08:41: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 18P8fQ12017975; Sat, 25 Sep 2021 08:41:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P8fQWN017974; Sat, 25 Sep 2021 08:41:26 GMT (envelope-from git) Date: Sat, 25 Sep 2021 08:41:26 GMT Message-Id: <202109250841.18P8fQWN017974@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 14fb8056ceef - stable/13 - sh: reset sh bindings on bind -e, bind -v MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 14fb8056ceef592c6f392f0f678dc45d11b7417e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 08:41:26 -0000 The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=14fb8056ceef592c6f392f0f678dc45d11b7417e commit 14fb8056ceef592c6f392f0f678dc45d11b7417e Author: Piotr Pawel Stefaniak AuthorDate: 2021-09-19 20:17:01 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-25 08:34:38 +0000 sh: reset sh bindings on bind -e, bind -v Until this change, any bindings set in histedit() were lost on calls to bindcmd(). Only bind -e and bind -v call libedit's keymacro_reset(). Currently you cannot fool libedit/map.c:map_bind() by trying something like bind -le as when p[0] == '-', it does a switch statement on p[1]. (cherry picked from commit 9413dfd331e705a1d7909fe41f06a30e43c442f7) --- bin/sh/histedit.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 488a0b355f80..7c366d252743 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -501,6 +501,13 @@ bindcmd(int argc, char **argv) fclose(out); + if (argc > 1 && argv[1][0] == '-' && + memchr("ve", argv[1][1], 2) != NULL) { + Vflag = argv[1][1] == 'v'; + Eflag = !Vflag; + histedit(); + } + INTON; return ret; From owner-dev-commits-src-all@freebsd.org Sat Sep 25 08:41:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E036667DCAD; Sat, 25 Sep 2021 08:41:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGj6y0cDmz3lPH; Sat, 25 Sep 2021 08:41:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DFD65271B5; Sat, 25 Sep 2021 08:41: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 18P8fTUF018052; Sat, 25 Sep 2021 08:41:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P8fTiU018051; Sat, 25 Sep 2021 08:41:29 GMT (envelope-from git) Date: Sat, 25 Sep 2021 08:41:29 GMT Message-Id: <202109250841.18P8fTiU018051@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: bda949b6efdf - stable/13 - diff: read whole files to determine if they are ASCII text MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bda949b6efdf099846775d3dc595c36561df1cca Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 08:41:31 -0000 The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=bda949b6efdf099846775d3dc595c36561df1cca commit bda949b6efdf099846775d3dc595c36561df1cca Author: Piotr Pawel Stefaniak AuthorDate: 2021-08-22 19:57:13 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-25 08:34:39 +0000 diff: read whole files to determine if they are ASCII text Before this change, only the first BUFSIZE bytes were checked. (cherry picked from commit 3cbf98e2bee91db9ed9118ff557e02cdd449f49a) --- usr.bin/diff/diffreg.c | 59 +++++++++++++++++++++++++---------------- usr.bin/diff/tests/diff_test.sh | 14 ++++++++++ 2 files changed, 50 insertions(+), 23 deletions(-) diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 113b7b621256..e728441c2cb2 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -180,6 +180,8 @@ struct context_vec { int d; /* end line in new file */ }; +enum readhash { RH_BINARY, RH_OK, RH_EOF }; + #define MIN_PAD 1 static FILE *opentemp(const char *); static void output(char *, FILE *, char *, FILE *, int); @@ -188,7 +190,7 @@ static void range(int, int, const char *); static void uni_range(int, int); static void dump_context_vec(FILE *, FILE *, int); static void dump_unified_vec(FILE *, FILE *, int); -static void prepare(int, FILE *, size_t, int); +static bool prepare(int, FILE *, size_t, int); static void prune(void); static void equiv(struct line *, int, struct line *, int, int *); static void unravel(int); @@ -206,7 +208,7 @@ static int search(int *, int, int); static int skipline(FILE *); static int isqrt(int); static int stone(int *, int, int *, int *, int); -static int readhash(FILE *, int); +static enum readhash readhash(FILE *, int, unsigned *); static int files_differ(FILE *, FILE *, int); static char *match_function(const long *, int, FILE *); static char *preadline(int, size_t, off_t); @@ -380,14 +382,16 @@ diffreg(char *file1, char *file2, int flags, int capsicum) status |= 1; goto closem; } - if ((flags & D_FORCEASCII) == 0 && - (!asciifile(f1) || !asciifile(f2))) { + if ((flags & D_FORCEASCII) != 0) { + (void)prepare(0, f1, stb1.st_size, flags); + (void)prepare(1, f2, stb2.st_size, flags); + } else if (!asciifile(f1) || !asciifile(f2) || + !prepare(0, f1, stb1.st_size, flags) || + !prepare(1, f2, stb2.st_size, flags)) { rval = D_BINARY; status |= 1; goto closem; } - prepare(0, f1, stb1.st_size, flags); - prepare(1, f2, stb2.st_size, flags); prune(); sort(sfile[0], slen[0]); @@ -511,12 +515,13 @@ splice(char *dir, char *path) return (buf); } -static void +static bool prepare(int i, FILE *fd, size_t filesize, int flags) { struct line *p; - int h; - size_t sz, j; + unsigned h; + size_t sz, j = 0; + enum readhash r; rewind(fd); @@ -525,15 +530,23 @@ prepare(int i, FILE *fd, size_t filesize, int flags) sz = 100; p = xcalloc(sz + 3, sizeof(*p)); - for (j = 0; (h = readhash(fd, flags));) { - if (j == sz) { - sz = sz * 3 / 2; - p = xreallocarray(p, sz + 3, sizeof(*p)); + while ((r = readhash(fd, flags, &h)) != RH_EOF) + switch (r) { + case RH_EOF: /* otherwise clang complains */ + case RH_BINARY: + return (false); + case RH_OK: + if (j == sz) { + sz = sz * 3 / 2; + p = xreallocarray(p, sz + 3, sizeof(*p)); + } + p[++j].value = h; } - p[++j].value = h; - } + len[i] = j; file[i] = p; + + return (true); } static void @@ -1350,8 +1363,8 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) /* * Hash function taken from Robert Sedgewick, Algorithms in C, 3d ed., p 578. */ -static int -readhash(FILE *f, int flags) +static enum readhash +readhash(FILE *f, int flags, unsigned *hash) { int i, t, space; unsigned sum; @@ -1360,6 +1373,9 @@ readhash(FILE *f, int flags) space = 0; for (i = 0;;) { switch (t = getc(f)) { + case '\0': + if ((flags & D_FORCEASCII) == 0) + return (RH_BINARY); case '\r': if (flags & D_STRIPCR) { t = getc(f); @@ -1387,18 +1403,15 @@ readhash(FILE *f, int flags) continue; case EOF: if (i == 0) - return (0); + return (RH_EOF); /* FALLTHROUGH */ case '\n': break; } break; } - /* - * There is a remote possibility that we end up with a zero sum. - * Zero is used as an EOF marker, so return 1 instead. - */ - return (sum == 0 ? 1 : sum); + *hash = sum; + return (RH_OK); } static int diff --git a/usr.bin/diff/tests/diff_test.sh b/usr.bin/diff/tests/diff_test.sh index c311c3bf2fbc..d96dd8c2a33e 100755 --- a/usr.bin/diff/tests/diff_test.sh +++ b/usr.bin/diff/tests/diff_test.sh @@ -18,6 +18,7 @@ atf_test_case conflicting_format atf_test_case label atf_test_case report_identical atf_test_case non_regular_file +atf_test_case binary simple_body() { @@ -264,6 +265,18 @@ non_regular_file_body() diff --label A --label B -u A B } +binary_body() +{ + # the NUL byte has to be after at least BUFSIZ bytes to trick asciifile() + yes 012345678901234567890123456789012345678901234567890 | head -n 174 > A + cp A B + printf '\n\0\n' >> A + printf '\nx\n' >> B + + atf_check -o inline:"Binary files A and B differ\n" -s exit:1 diff A B + atf_check -o inline:"176c\nx\n.\n" -s exit:1 diff -ae A B +} + atf_init_test_cases() { atf_add_test_case simple @@ -284,4 +297,5 @@ atf_init_test_cases() atf_add_test_case label atf_add_test_case report_identical atf_add_test_case non_regular_file + atf_add_test_case binary } From owner-dev-commits-src-all@freebsd.org Sat Sep 25 08:41:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D6C967DDAF; Sat, 25 Sep 2021 08:41: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 4HGj6r2rZHz3llx; Sat, 25 Sep 2021 08:41:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36BA5270D3; Sat, 25 Sep 2021 08:41: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 18P8fOxL017925; Sat, 25 Sep 2021 08:41:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P8fOPW017924; Sat, 25 Sep 2021 08:41:24 GMT (envelope-from git) Date: Sat, 25 Sep 2021 08:41:24 GMT Message-Id: <202109250841.18P8fOPW017924@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 8acee856bfc8 - stable/13 - fstyp: bump WARNS to default and work around warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8acee856bfc8cf7ef0e2f622aeea5df830619db3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 08:41:24 -0000 The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=8acee856bfc8cf7ef0e2f622aeea5df830619db3 commit 8acee856bfc8cf7ef0e2f622aeea5df830619db3 Author: Piotr Pawel Stefaniak AuthorDate: 2021-08-17 15:46:08 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-25 08:34:38 +0000 fstyp: bump WARNS to default and work around warnings (cherry picked from commit da0c0e0121574a1d82f417cc7e245ecd5506325c) --- usr.sbin/fstyp/Makefile | 2 -- usr.sbin/fstyp/apfs.c | 2 ++ usr.sbin/fstyp/fstyp.c | 4 ++-- usr.sbin/fstyp/hammer.c | 3 +++ usr.sbin/fstyp/hfsplus.c | 2 ++ 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/usr.sbin/fstyp/Makefile b/usr.sbin/fstyp/Makefile index 384e2f7dee60..161cd0cf3764 100644 --- a/usr.sbin/fstyp/Makefile +++ b/usr.sbin/fstyp/Makefile @@ -12,8 +12,6 @@ SRCS += zfs.c MAN= fstyp.8 -WARNS?= 2 - .if ${MK_ICONV} == "yes" CFLAGS+= -DWITH_ICONV .endif diff --git a/usr.sbin/fstyp/apfs.c b/usr.sbin/fstyp/apfs.c index 049a9f862f2b..7f8543a5a108 100644 --- a/usr.sbin/fstyp/apfs.c +++ b/usr.sbin/fstyp/apfs.c @@ -100,6 +100,8 @@ fstyp_apfs(FILE *fp, char *label, size_t size) retval = 0; /* No label support yet. */ + (void)size; + (void)label; fail: free(csb); diff --git a/usr.sbin/fstyp/fstyp.c b/usr.sbin/fstyp/fstyp.c index b39277914aed..91c36d9d9191 100644 --- a/usr.sbin/fstyp/fstyp.c +++ b/usr.sbin/fstyp/fstyp.c @@ -61,7 +61,7 @@ static struct { const char *name; fstyp_function function; bool unmountable; - char *precache_encoding; + const char *precache_encoding; } fstypes[] = { { "apfs", &fstyp_apfs, true, NULL }, { "befs", &fstyp_befs, false, NULL }, @@ -206,7 +206,7 @@ main(int argc, char **argv) #ifdef WITH_ICONV /* Cache iconv conversion data before entering capability mode. */ if (show_label) { - for (i = 0; i < nitems(fstypes); i++) { + for (i = 0; i < (int)nitems(fstypes); i++) { iconv_t cd; if (fstypes[i].precache_encoding == NULL) diff --git a/usr.sbin/fstyp/hammer.c b/usr.sbin/fstyp/hammer.c index 6fdad1d642a4..777f5d312371 100644 --- a/usr.sbin/fstyp/hammer.c +++ b/usr.sbin/fstyp/hammer.c @@ -43,6 +43,9 @@ __FBSDID("$FreeBSD$"); #include "fstyp.h" +extern int fsvtyp_hammer(const char *blkdevs, char *label, size_t size); +extern int fsvtyp_hammer_partial(const char *blkdevs, char *label, size_t size); + static hammer_volume_ondisk_t read_ondisk(FILE *fp) { diff --git a/usr.sbin/fstyp/hfsplus.c b/usr.sbin/fstyp/hfsplus.c index 71287465e4ff..3a94faf7766f 100644 --- a/usr.sbin/fstyp/hfsplus.c +++ b/usr.sbin/fstyp/hfsplus.c @@ -118,6 +118,8 @@ fstyp_hfsp(FILE *fp, char *label, size_t size) retval = 0; /* No label support yet. */ + (void)size; + (void)label; fail: free(hdr); From owner-dev-commits-src-all@freebsd.org Sat Sep 25 08:41:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 872BB67DCB0; Sat, 25 Sep 2021 08:41: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 4HGj6z1cXFz3mBX; Sat, 25 Sep 2021 08:41: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 0D04427139; Sat, 25 Sep 2021 08:41: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 18P8fUKg018076; Sat, 25 Sep 2021 08:41:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P8fUvk018075; Sat, 25 Sep 2021 08:41:30 GMT (envelope-from git) Date: Sat, 25 Sep 2021 08:41:30 GMT Message-Id: <202109250841.18P8fUvk018075@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: cc81fdf42549 - stable/13 - Register /usr/tests/usr.bin/diff3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cc81fdf42549bfc7cf43c40003bb0426b6218607 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 08:41:31 -0000 The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=cc81fdf42549bfc7cf43c40003bb0426b6218607 commit cc81fdf42549bfc7cf43c40003bb0426b6218607 Author: Piotr Pawel Stefaniak AuthorDate: 2021-08-22 10:08:39 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-25 08:34:39 +0000 Register /usr/tests/usr.bin/diff3 I wasn't able to make check to run diff3 tests, but kevans figured out that I was missing diff3 in mtree. (cherry picked from commit f8e50dd2c67baea2bbd75f94218911d5a4d39597) --- etc/mtree/BSD.tests.dist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index f7965dac2884..b21256c8563c 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -996,6 +996,8 @@ .. diff .. + diff3 + .. dirname .. du From owner-dev-commits-src-all@freebsd.org Sat Sep 25 08:41:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0EDEB67DD67; Sat, 25 Sep 2021 08:41: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 4HGj714435z3lw2; Sat, 25 Sep 2021 08:41: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 5690126F50; Sat, 25 Sep 2021 08:41: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 18P8fXRk018130; Sat, 25 Sep 2021 08:41:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P8fXUl018129; Sat, 25 Sep 2021 08:41:33 GMT (envelope-from git) Date: Sat, 25 Sep 2021 08:41:33 GMT Message-Id: <202109250841.18P8fXUl018129@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 216bf478e247 - stable/13 - diff3: improve style MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 216bf478e24702ddfb310f27da0a51a81c822ed6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 08:41:34 -0000 The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=216bf478e24702ddfb310f27da0a51a81c822ed6 commit 216bf478e24702ddfb310f27da0a51a81c822ed6 Author: Piotr Pawel Stefaniak AuthorDate: 2021-08-20 21:50:20 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-25 08:34:39 +0000 diff3: improve style (cherry picked from commit 702dda4368dc2d07e8898fcfdddb12d730e6c174) --- usr.bin/diff3/diff3.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/usr.bin/diff3/diff3.c b/usr.bin/diff3/diff3.c index 80d4a202728f..18daa54b2360 100644 --- a/usr.bin/diff3/diff3.c +++ b/usr.bin/diff3/diff3.c @@ -126,7 +126,7 @@ static int cline[3]; /* # of the last-read line in each file (0-2) */ */ static int last[4]; static int Aflag, eflag, iflag, mflag, Tflag; -static int oflag; /* indicates whether to mark overlaps (-E or -X)*/ +static int oflag; /* indicates whether to mark overlaps (-E or -X) */ static int strip_cr; static char *f1mark, *f2mark, *f3mark; @@ -170,9 +170,9 @@ static struct option longopts[] = { static void usage(void) { - fprintf(stderr, "usage: diff3 [-3aAeEimTxX] [-L lable1] [-L label2] " - "[ -L label3] file1 file2 file3\n"); - exit (2); + fprintf(stderr, "usage: diff3 [-3aAeEimTxX] [-L label1] [-L label2] " + "[-L label3] file1 file2 file3\n"); + exit(2); } static int @@ -186,7 +186,7 @@ readin(int fd, struct diff **dd) f = fdopen(fd, "r"); if (f == NULL) err(2, "fdopen"); - for (i=0; (p = getchange(f)); i++) { + for (i = 0; (p = getchange(f)); i++) { if (i >= szchanges - 1) increase(); a = b = (int)strtoimax(p, &p, 10); @@ -196,7 +196,7 @@ readin(int fd, struct diff **dd) } kind = *p++; c = d = (int)strtoimax(p, &p, 10); - if (*p==',') { + if (*p == ',') { p++; d = (int)strtoimax(p, &p, 10); } @@ -212,8 +212,8 @@ readin(int fd, struct diff **dd) (*dd)[i].new.to = d; } if (i) { - (*dd)[i].old.from = (*dd)[i-1].old.to; - (*dd)[i].new.from = (*dd)[i-1].new.to; + (*dd)[i].old.from = (*dd)[i - 1].old.to; + (*dd)[i].new.from = (*dd)[i - 1].new.to; } fclose(f); return (i); @@ -222,9 +222,9 @@ readin(int fd, struct diff **dd) static int diffexec(const char *diffprog, char **diffargv, int fd[]) { - int pid, pd; + int pd; - switch (pid = pdfork(&pd, PD_CLOEXEC)) { + switch (pdfork(&pd, PD_CLOEXEC)) { case 0: close(fd[0]); if (dup2(fd[1], STDOUT_FILENO) == -1) @@ -396,7 +396,7 @@ prange(struct range *rold) printf("%da\n", rold->from - 1); else { printf("%d", rold->from); - if (rold->to > rold->from+1) + if (rold->to > rold->from + 1) printf(",%d", rold->to - 1); printf("c\n"); } @@ -433,7 +433,7 @@ skip(int i, int from, const char *pr) if ((line = get_line(fp[i], &j)) == NULL) errx(EXIT_FAILURE, "logic error"); if (pr != NULL) - printf("%s%s", Tflag == 1? "\t" : pr, line); + printf("%s%s", Tflag == 1 ? "\t" : pr, line); cline[i]++; } return ((int) n); @@ -455,13 +455,13 @@ duplicate(struct range *r1, struct range *r2) skip(0, r1->from, NULL); skip(1, r2->from, NULL); nchar = 0; - for (nline=0; nline < r1->to - r1->from; nline++) { + for (nline = 0; nline < r1->to - r1->from; nline++) { do { c = getc(fp[0]); d = getc(fp[1]); if (c == -1 && d == -1) break; - if (c == -1 || d== -1) + if (c == -1 || d == -1) errx(EXIT_FAILURE, "logic error"); nchar++; if (c != d) { @@ -482,6 +482,7 @@ repos(int nchar) for (i = 0; i < 2; i++) (void)fseek(fp[i], (long)-nchar, SEEK_CUR); } + /* * collect an editing script for later regurgitation */ @@ -514,7 +515,7 @@ edscript(int n) if (!oflag || !overlap[n]) { prange(&de[n].old); } else { - printf("%da\n", de[n].old.to -1); + printf("%da\n", de[n].old.to - 1); if (Aflag) { printf("%s\n", f2mark); fseek(fp[1], de[n].old.from, SEEK_SET); @@ -529,8 +530,9 @@ edscript(int n) printf("=======\n"); } fseek(fp[2], (long)de[n].new.from, SEEK_SET); - for (k = de[n].new.to - de[n].new.from; k > 0; k-= j) { + for (k = de[n].new.to - de[n].new.from; k > 0; k -= j) { size_t r; + j = k > BUFSIZ ? BUFSIZ : k; r = fread(block, 1, j, fp[2]); if (r == 0) { @@ -759,7 +761,7 @@ main(int argc, char **argv) for (i = 0; i < nke; i++) { status = e[i].data; if (WIFEXITED(status) && WEXITSTATUS(status) >= 2) - errx(2, "diff exited abormally"); + errx(2, "diff exited abnormally"); else if (WIFSIGNALED(status)) errx(2, "diff killed by signal %d", WTERMSIG(status)); From owner-dev-commits-src-all@freebsd.org Sat Sep 25 08:41:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3DA4667DD6C; Sat, 25 Sep 2021 08:41: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 4HGj736cxYz3lqJ; Sat, 25 Sep 2021 08:41: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 85DE126F51; Sat, 25 Sep 2021 08:41: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 18P8fZVh018178; Sat, 25 Sep 2021 08:41:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P8fZxB018177; Sat, 25 Sep 2021 08:41:35 GMT (envelope-from git) Date: Sat, 25 Sep 2021 08:41:35 GMT Message-Id: <202109250841.18P8fZxB018177@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: dbabfd7e2676 - stable/13 - diff3: implement --strip-trailing-cr MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dbabfd7e26763ac295ed0ee8bc77f3f3b58b6d03 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 08:41:36 -0000 The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=dbabfd7e26763ac295ed0ee8bc77f3f3b58b6d03 commit dbabfd7e26763ac295ed0ee8bc77f3f3b58b6d03 Author: Piotr Pawel Stefaniak AuthorDate: 2021-08-21 00:28:58 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-25 08:34:39 +0000 diff3: implement --strip-trailing-cr (cherry picked from commit 54a3415cb69e1ea0e6533ca3fc168deba64f249f) --- usr.bin/diff3/diff3.1 | 3 +++ usr.bin/diff3/diff3.c | 9 ++++++++- usr.bin/diff3/tests/1cr.txt | 6 ++++++ usr.bin/diff3/tests/Makefile | 1 + usr.bin/diff3/tests/diff3_test.sh | 3 +++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/usr.bin/diff3/diff3.1 b/usr.bin/diff3/diff3.1 index cc4bdf1c8836..22e04b6af5e8 100644 --- a/usr.bin/diff3/diff3.1 +++ b/usr.bin/diff3/diff3.1 @@ -40,6 +40,7 @@ .Nm diff3 .Op Fl 3aEeiXx .Op Fl Fl diff-program Ar program +.Op Fl Fl strip-trailing-cr .Op Fl L | Fl Fl label Ar label1 .Op Fl L | Fl Fl label Ar label2 .Op Fl L | Fl Fl label Ar label3 @@ -125,6 +126,8 @@ Use instead of the default .Xr diff 1 to compare files. +.It Fl Fl strip-trailing-cr +Strip trailing carriage return on input files. .El .Pp The diff --git a/usr.bin/diff3/diff3.c b/usr.bin/diff3/diff3.c index 18daa54b2360..122243a9448f 100644 --- a/usr.bin/diff3/diff3.c +++ b/usr.bin/diff3/diff3.c @@ -264,6 +264,12 @@ get_line(FILE *b, size_t *n) if ((len = getline(&buf, &bufsize, b)) < 0) return (NULL); + if (strip_cr && len >= 2 && strcmp("\r\n", &(buf[len - 2])) == 0) { + buf[len - 2] = '\n'; + buf[len - 1] = '\0'; + len--; + } + if (n != NULL) *n = len; @@ -599,7 +605,7 @@ main(int argc, char **argv) char *labels[] = { NULL, NULL, NULL }; const char *diffprog = DIFF_PATH; char *file1, *file2, *file3; - char *diffargv[6]; + char *diffargv[7]; int diffargc = 0; int fd13[2], fd23[2]; int pd13, pd23; @@ -657,6 +663,7 @@ main(int argc, char **argv) break; case STRIPCR_OPT: strip_cr = 1; + diffargv[diffargc++] = __DECONST(char *, "--strip-trailing-cr"); break; } } diff --git a/usr.bin/diff3/tests/1cr.txt b/usr.bin/diff3/tests/1cr.txt new file mode 100644 index 000000000000..c24bf241e68a --- /dev/null +++ b/usr.bin/diff3/tests/1cr.txt @@ -0,0 +1,6 @@ +This is a more complete test +which multiple lines +and a few typ0s to fix +also I plan to add few lines + and to remove +other lines diff --git a/usr.bin/diff3/tests/Makefile b/usr.bin/diff3/tests/Makefile index dd75be1ca02a..2ec7fbaab564 100644 --- a/usr.bin/diff3/tests/Makefile +++ b/usr.bin/diff3/tests/Makefile @@ -6,6 +6,7 @@ ATF_TESTS_SH= diff3_test ${PACKAGE}FILES+= \ 1.txt \ + 1cr.txt \ 2.txt \ 3.txt \ 1.out \ diff --git a/usr.bin/diff3/tests/diff3_test.sh b/usr.bin/diff3/tests/diff3_test.sh index 6c479de2e9c0..f4b5adf95700 100755 --- a/usr.bin/diff3/tests/diff3_test.sh +++ b/usr.bin/diff3/tests/diff3_test.sh @@ -8,6 +8,9 @@ diff3_body() atf_check -o file:$(atf_get_srcdir)/1.out \ diff3 $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt + atf_check -o file:$(atf_get_srcdir)/1.out \ + diff3 --strip-trailing-cr $(atf_get_srcdir)/1cr.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt + atf_check -o file:$(atf_get_srcdir)/2.out \ diff3 -e $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt From owner-dev-commits-src-all@freebsd.org Sat Sep 25 08:41:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 947A467DF59; Sat, 25 Sep 2021 08:41: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 4HGj750kF5z3m8S; Sat, 25 Sep 2021 08:41: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 A972F2739B; Sat, 25 Sep 2021 08:41: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 18P8faAj018202; Sat, 25 Sep 2021 08:41:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P8fafY018201; Sat, 25 Sep 2021 08:41:36 GMT (envelope-from git) Date: Sat, 25 Sep 2021 08:41:36 GMT Message-Id: <202109250841.18P8fafY018201@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: a8446d4124d0 - stable/13 - diff3: document and test -T MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a8446d4124d0639b0fe49e25642a18a51fde8666 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 08:41:37 -0000 The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=a8446d4124d0639b0fe49e25642a18a51fde8666 commit a8446d4124d0639b0fe49e25642a18a51fde8666 Author: Piotr Pawel Stefaniak AuthorDate: 2021-08-23 19:33:27 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-25 08:34:39 +0000 diff3: document and test -T (cherry picked from commit 9f7a81b133c715f649136dcd0ad004e4180c56c9) --- usr.bin/diff3/diff3.1 | 11 +++++++++-- usr.bin/diff3/tests/1t.out | 14 ++++++++++++++ usr.bin/diff3/tests/Makefile | 1 + usr.bin/diff3/tests/diff3_test.sh | 3 +++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/usr.bin/diff3/diff3.1 b/usr.bin/diff3/diff3.1 index 22e04b6af5e8..2cf1e57cb74e 100644 --- a/usr.bin/diff3/diff3.1 +++ b/usr.bin/diff3/diff3.1 @@ -30,7 +30,7 @@ .\" @(#)diff3.1 8.2 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd May 25, 2017 +.Dd August 23, 2021 .Dt DIFF3 1 .Os .Sh NAME @@ -38,7 +38,7 @@ .Nd 3-way differential file comparison .Sh SYNOPSIS .Nm diff3 -.Op Fl 3aEeiXx +.Op Fl 3aEeiTXx .Op Fl Fl diff-program Ar program .Op Fl Fl strip-trailing-cr .Op Fl L | Fl Fl label Ar label1 @@ -115,6 +115,13 @@ Defines labels to print instead of file names .Ar file2 and .Ar file3 . +.It Fl T, Fl Fl initial-tab +In the normal listing, +use a tab instead of two spaces +at the beginning of each line. +In modes that produce an +.Xr ed 1 +script, this option changes nothing. .It Fl x, Fl Fl overlap-only Produces an output script suitable for .Xr ed 1 diff --git a/usr.bin/diff3/tests/1t.out b/usr.bin/diff3/tests/1t.out new file mode 100644 index 000000000000..fc54ce50286f --- /dev/null +++ b/usr.bin/diff3/tests/1t.out @@ -0,0 +1,14 @@ +==== +1:2,3c + which multiple lines + and a few typ0s to fix +2:2,3c + which multiple lines + and a few typos to fix +3:2c + and a few typ0s to fix +====2 +1:4a +3:3a +2:5c + New line diff --git a/usr.bin/diff3/tests/Makefile b/usr.bin/diff3/tests/Makefile index 2ec7fbaab564..b8bea154944b 100644 --- a/usr.bin/diff3/tests/Makefile +++ b/usr.bin/diff3/tests/Makefile @@ -10,6 +10,7 @@ ${PACKAGE}FILES+= \ 2.txt \ 3.txt \ 1.out \ + 1t.out \ 2.out \ 3.out \ 4.out \ diff --git a/usr.bin/diff3/tests/diff3_test.sh b/usr.bin/diff3/tests/diff3_test.sh index f4b5adf95700..64031b023187 100755 --- a/usr.bin/diff3/tests/diff3_test.sh +++ b/usr.bin/diff3/tests/diff3_test.sh @@ -11,6 +11,9 @@ diff3_body() atf_check -o file:$(atf_get_srcdir)/1.out \ diff3 --strip-trailing-cr $(atf_get_srcdir)/1cr.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt + atf_check -o file:$(atf_get_srcdir)/1t.out \ + diff3 -T $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt + atf_check -o file:$(atf_get_srcdir)/2.out \ diff3 -e $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt From owner-dev-commits-src-all@freebsd.org Sat Sep 25 08:41:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D2D1D67DCA7; Sat, 25 Sep 2021 08:41: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 4HGj6x2Nztz3m5j; Sat, 25 Sep 2021 08:41: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 C230C268F5; Sat, 25 Sep 2021 08:41: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 18P8fSMr018028; Sat, 25 Sep 2021 08:41:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P8fS52018027; Sat, 25 Sep 2021 08:41:28 GMT (envelope-from git) Date: Sat, 25 Sep 2021 08:41:28 GMT Message-Id: <202109250841.18P8fS52018027@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: ece58f7ada40 - stable/13 - diff: don't output carriage returns that were stripped on input MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ece58f7ada409ac68e072cdddcc29e21127aafce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 08:41:30 -0000 The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=ece58f7ada409ac68e072cdddcc29e21127aafce commit ece58f7ada409ac68e072cdddcc29e21127aafce Author: Piotr Pawel Stefaniak AuthorDate: 2021-08-22 16:05:59 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-25 08:34:38 +0000 diff: don't output carriage returns that were stripped on input --strip-trailing-cr worked as intended for comparison between files, but the characters were still present in final output. (cherry picked from commit af2f0164318455433db95adce07af829285b78ad) --- usr.bin/diff/diffreg.c | 11 ++++++++++- usr.bin/diff/tests/Makefile | 3 ++- usr.bin/diff/tests/diff_test.sh | 10 ++++++++++ usr.bin/diff/tests/strip_o.out | 7 +++++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 651ec88df909..113b7b621256 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -1273,7 +1273,16 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) } col = 0; for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) { - if ((c = getc(lb)) == EOF) { + c = getc(lb); + if (flags & D_STRIPCR && c == '\r') { + if ((c = getc(lb)) == '\n') + j++; + else { + ungetc(c, lb); + c = '\r'; + } + } + if (c == EOF) { if (diff_format == D_EDIT || diff_format == D_REVERSE || diff_format == D_NREVERSE) diff --git a/usr.bin/diff/tests/Makefile b/usr.bin/diff/tests/Makefile index 78744d3bed8e..303a37911fbd 100644 --- a/usr.bin/diff/tests/Makefile +++ b/usr.bin/diff/tests/Makefile @@ -26,7 +26,8 @@ ${PACKAGE}FILES+= \ header.out \ header_ns.out \ ifdef.out \ - group-format.out + group-format.out \ + strip_o.out NETBSD_ATF_TESTS_SH+= netbsd_diff_test diff --git a/usr.bin/diff/tests/diff_test.sh b/usr.bin/diff/tests/diff_test.sh index b9d1698d982e..c311c3bf2fbc 100755 --- a/usr.bin/diff/tests/diff_test.sh +++ b/usr.bin/diff/tests/diff_test.sh @@ -9,6 +9,7 @@ atf_test_case group_format atf_test_case side_by_side atf_test_case brief_format atf_test_case b230049 +atf_test_case stripcr_o atf_test_case b252515 atf_test_case Bflag atf_test_case Nflag @@ -68,6 +69,14 @@ b230049_body() b230049_a.in b230049_b.in } +stripcr_o_body() +{ + printf 'a\nX\nc\n' > stripcr_o_X.in + printf 'a\r\nY\r\nc\r\n' > stripcr_o_Y.in + atf_check -o "file:$(atf_get_srcdir)/strip_o.out" -s eq:1 \ + diff -L1 -L2 -u --strip-trailing-cr stripcr_o_X.in stripcr_o_Y.in +} + b252515_body() { printf 'a b\n' > b252515_a.in @@ -266,6 +275,7 @@ atf_init_test_cases() atf_add_test_case side_by_side atf_add_test_case brief_format atf_add_test_case b230049 + atf_add_test_case stripcr_o atf_add_test_case b252515 atf_add_test_case Bflag atf_add_test_case Nflag diff --git a/usr.bin/diff/tests/strip_o.out b/usr.bin/diff/tests/strip_o.out new file mode 100644 index 000000000000..47bbfbd4e921 --- /dev/null +++ b/usr.bin/diff/tests/strip_o.out @@ -0,0 +1,7 @@ +--- 1 ++++ 2 +@@ -1,3 +1,3 @@ + a +-X ++Y + c From owner-dev-commits-src-all@freebsd.org Sat Sep 25 08:41:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E92167D66C; Sat, 25 Sep 2021 08:41: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 4HGj704cgQz3lvx; Sat, 25 Sep 2021 08:41: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 33D01271B6; Sat, 25 Sep 2021 08:41: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 18P8fWDY018100; Sat, 25 Sep 2021 08:41:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P8fWO3018099; Sat, 25 Sep 2021 08:41:32 GMT (envelope-from git) Date: Sat, 25 Sep 2021 08:41:32 GMT Message-Id: <202109250841.18P8fWO3018099@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 4bfbc5fbc93b - stable/13 - diff3: sync with upstream MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4bfbc5fbc93bec4f1098b7c7174411ec92404cb0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 08:41:34 -0000 The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=4bfbc5fbc93bec4f1098b7c7174411ec92404cb0 commit 4bfbc5fbc93bec4f1098b7c7174411ec92404cb0 Author: Piotr Pawel Stefaniak AuthorDate: 2021-08-20 21:35:24 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-25 08:34:39 +0000 diff3: sync with upstream * replace realloc calls with reallocarray calls * fix merging of files that lack newlines Obtained from: OpenBSD (cherry picked from commit 7f7b03f3897f0196e3cc7a3b71c7359cc206ba61) --- usr.bin/diff3/diff3.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/usr.bin/diff3/diff3.c b/usr.bin/diff3/diff3.c index 03cd24283a13..80d4a202728f 100644 --- a/usr.bin/diff3/diff3.c +++ b/usr.bin/diff3/diff3.c @@ -459,6 +459,8 @@ duplicate(struct range *r1, struct range *r2) do { c = getc(fp[0]); d = getc(fp[1]); + if (c == -1 && d == -1) + break; if (c == -1 || d== -1) errx(EXIT_FAILURE, "logic error"); nchar++; @@ -528,10 +530,17 @@ edscript(int n) } fseek(fp[2], (long)de[n].new.from, SEEK_SET); for (k = de[n].new.to - de[n].new.from; k > 0; k-= j) { + size_t r; j = k > BUFSIZ ? BUFSIZ : k; - if (fread(block, 1, j, fp[2]) != j) + r = fread(block, 1, j, fp[2]); + if (r == 0) { + if (feof(fp[2])) + break; errx(2, "logic error"); - fwrite(block, 1, j, stdout); + } + if (r != j) + j = r; + (void)fwrite(block, 1, j, stdout); } if (!oflag || !overlap[n]) printf(".\n"); @@ -557,22 +566,22 @@ increase(void) newsz = szchanges == 0 ? 64 : 2 * szchanges; incr = newsz - szchanges; - p = realloc(d13, newsz * sizeof(struct diff)); + p = reallocarray(d13, newsz, sizeof(struct diff)); if (p == NULL) err(1, NULL); memset(p + szchanges, 0, incr * sizeof(struct diff)); d13 = p; - p = realloc(d23, newsz * sizeof(struct diff)); + p = reallocarray(d23, newsz, sizeof(struct diff)); if (p == NULL) err(1, NULL); memset(p + szchanges, 0, incr * sizeof(struct diff)); d23 = p; - p = realloc(de, newsz * sizeof(struct diff)); + p = reallocarray(de, newsz, sizeof(struct diff)); if (p == NULL) err(1, NULL); memset(p + szchanges, 0, incr * sizeof(struct diff)); de = p; - q = realloc(overlap, newsz * sizeof(char)); + q = reallocarray(overlap, newsz, sizeof(char)); if (q == NULL) err(1, NULL); memset(q + szchanges, 0, incr * sizeof(char)); From owner-dev-commits-src-all@freebsd.org Sat Sep 25 08:41:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B22C667DF58; Sat, 25 Sep 2021 08:41: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 4HGj725Hg9z3mBp; Sat, 25 Sep 2021 08:41: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 648D3272F6; Sat, 25 Sep 2021 08:41: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 18P8fYnS018154; Sat, 25 Sep 2021 08:41:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P8fY4Q018153; Sat, 25 Sep 2021 08:41:34 GMT (envelope-from git) Date: Sat, 25 Sep 2021 08:41:34 GMT Message-Id: <202109250841.18P8fY4Q018153@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 000d03450ba0 - stable/13 - diff3.1: update manual page to match code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 000d03450ba0c5ac37f2a83335b6c09ada1dcca9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 08:41:36 -0000 The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=000d03450ba0c5ac37f2a83335b6c09ada1dcca9 commit 000d03450ba0c5ac37f2a83335b6c09ada1dcca9 Author: Piotr Pawel Stefaniak AuthorDate: 2021-08-20 22:50:05 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-25 08:34:39 +0000 diff3.1: update manual page to match code (cherry picked from commit e8ff95356ceaaa941251056e9d0a4211bf428e06) --- usr.bin/diff3/diff3.1 | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/usr.bin/diff3/diff3.1 b/usr.bin/diff3/diff3.1 index 84985632b8b8..cc4bdf1c8836 100644 --- a/usr.bin/diff3/diff3.1 +++ b/usr.bin/diff3/diff3.1 @@ -38,7 +38,11 @@ .Nd 3-way differential file comparison .Sh SYNOPSIS .Nm diff3 -.Op Fl 3aEeXx +.Op Fl 3aEeiXx +.Op Fl Fl diff-program Ar program +.Op Fl L | Fl Fl label Ar label1 +.Op Fl L | Fl Fl label Ar label2 +.Op Fl L | Fl Fl label Ar label3 .Ar file1 file2 file3 .Sh DESCRIPTION The @@ -60,15 +64,16 @@ new versions. .Pp The options are as follows: .Bl -tag -width "-E, -X" -.It Fl 3 +.It Fl 3 , Fl Fl easy-only Produces an output script suitable for .Xr ed 1 with changes specific only to .Ar file3 . -.It Fl a +.It Fl a , Fl Fl text Treat all files as ASCII. -.It Fl E , X +.It Fl E , Fl Fl show-overlap +.It Fl X Similar to .Fl e and @@ -77,7 +82,7 @@ respectively, but treat overlapping changes (i.e., changes that would be noted with ==== in the normal listing) differently. The overlapping lines from both files will be inserted by the edit script, bracketed by "<<<<<<" and ">>>>>>" lines. -.It Fl e +.It Fl e , Fl Fl ed Produces output in a form suitable as an input script for the .Xr ed 1 utility. @@ -99,11 +104,27 @@ and It is useful for backing out changes specific to .Ar file2 only. -.It Fl x +.It Fl i +Appends 'w' and 'q' +.Xr ed 1 +commands. +.It Fl L , Fl Fl label +Defines labels to print instead of file names +.Ar file1 , +.Ar file2 +and +.Ar file3 . +.It Fl x, Fl Fl overlap-only Produces an output script suitable for .Xr ed 1 with changes specific only to all three versions. +.It Fl Fl diff-program Ar program +Use +.Ar program +instead of the default +.Xr diff 1 +to compare files. .El .Pp The From owner-dev-commits-src-all@freebsd.org Sat Sep 25 09:48:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3E6D67EC3F; Sat, 25 Sep 2021 09:48: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 4HGkcY5RW9z3pyv; Sat, 25 Sep 2021 09:48: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 9A8831AD; Sat, 25 Sep 2021 09:48: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 18P9mj0g001654; Sat, 25 Sep 2021 09:48:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P9mj99001653; Sat, 25 Sep 2021 09:48:45 GMT (envelope-from git) Date: Sat, 25 Sep 2021 09:48:45 GMT Message-Id: <202109250948.18P9mj99001653@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 2aad906266d6 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 2aad906266d67eea6ad11d8e0c6fe9263077ee99 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 09:48:45 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2aad906266d67eea6ad11d8e0c6fe9263077ee99 commit 2aad906266d67eea6ad11d8e0c6fe9263077ee99 Author: Gordon Bergling AuthorDate: 2021-09-25 09:47:24 +0000 Commit: Gordon Bergling CommitDate: 2021-09-25 09:47:24 +0000 ubsan: Fix a typo in an error message - s/asumption/assumption/ Obtained from: NetBSD MFC after: 1 week --- sys/kern/kern_ubsan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_ubsan.c b/sys/kern/kern_ubsan.c index 93d39103929c..e1482f004d47 100644 --- a/sys/kern/kern_ubsan.c +++ b/sys/kern/kern_ubsan.c @@ -717,7 +717,7 @@ HandleAlignmentAssumption(bool isFatal, struct CAlignmentAssumptionData *pData, if (pData->mAssumptionLocation.mFilename != NULL) { DeserializeLocation(szAssumptionLocation, LOCATION_MAXLEN, &pData->mAssumptionLocation); - Report(isFatal, "UBSan: Undefined Behavior in %s, alignment assumption of %#lx for pointer %#lx (offset %#lx), asumption made in %s\n", + Report(isFatal, "UBSan: Undefined Behavior in %s, alignment assumption of %#lx for pointer %#lx (offset %#lx), assumption made in %s\n", szLocation, ulAlignment, ulRealPointer, ulOffset, szAssumptionLocation); } else { From owner-dev-commits-src-all@freebsd.org Sat Sep 25 11:58:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF0036A80B4; Sat, 25 Sep 2021 11:58:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGnV74JVjz4RLV; Sat, 25 Sep 2021 11:58:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 745D51C0E; Sat, 25 Sep 2021 11:58: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 18PBwNhf073622; Sat, 25 Sep 2021 11:58:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PBwNav073621; Sat, 25 Sep 2021 11:58:23 GMT (envelope-from git) Date: Sat, 25 Sep 2021 11:58:23 GMT Message-Id: <202109251158.18PBwNav073621@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 2ec4c3c7f3ef - main - net80211(4): Fix a few common typos 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/main X-Git-Reftype: branch X-Git-Commit: 2ec4c3c7f3ef7bae1d3efd314b64f493acd51642 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 11:58:23 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2ec4c3c7f3ef7bae1d3efd314b64f493acd51642 commit 2ec4c3c7f3ef7bae1d3efd314b64f493acd51642 Author: Gordon Bergling AuthorDate: 2021-09-25 11:57:41 +0000 Commit: Gordon Bergling CommitDate: 2021-09-25 11:57:41 +0000 net80211(4): Fix a few common typos in source code comments - s/annoucement/announcement/ - s/setings/settings/ MFC after: 1 week --- sys/net80211/ieee80211_hwmp.c | 2 +- sys/net80211/ieee80211_mesh.c | 2 +- sys/net80211/ieee80211_node.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/net80211/ieee80211_hwmp.c b/sys/net80211/ieee80211_hwmp.c index 37541b1c51f2..2e596513c791 100644 --- a/sys/net80211/ieee80211_hwmp.c +++ b/sys/net80211/ieee80211_hwmp.c @@ -1839,7 +1839,7 @@ hwmp_send_rann(struct ieee80211vap *vap, * [6] addr3 = sa * [1] action * [1] category - * [tlv] root annoucement + * [tlv] root announcement */ rann->rann_ie = IEEE80211_ELEMID_MESHRANN; rann->rann_len = IEEE80211_MESHRANN_BASE_SZ; diff --git a/sys/net80211/ieee80211_mesh.c b/sys/net80211/ieee80211_mesh.c index 7da344707a9b..b4326905a7a3 100644 --- a/sys/net80211/ieee80211_mesh.c +++ b/sys/net80211/ieee80211_mesh.c @@ -2959,7 +2959,7 @@ mesh_send_action_meshgate(struct ieee80211_node *ni, * mesh link metric * [1] category * [1] action - * [tlv] mesh gate annoucement + * [tlv] mesh gate announcement */ *frm++ = category; *frm++ = action; diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 5a9677836dbd..d71503d28179 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -149,7 +149,7 @@ ieee80211_node_vattach(struct ieee80211vap *vap) /* NB: driver can override */ vap->iv_max_aid = IEEE80211_AID_DEF; - /* default station inactivity timer setings */ + /* default station inactivity timer settings */ vap->iv_inact_init = IEEE80211_INACT_INIT; vap->iv_inact_auth = IEEE80211_INACT_AUTH; vap->iv_inact_run = IEEE80211_INACT_RUN; From owner-dev-commits-src-all@freebsd.org Sat Sep 25 13:11:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6A086A8F2D; Sat, 25 Sep 2021 13:11:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGq6V47w4z4X21; Sat, 25 Sep 2021 13:11:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E7AF2CA4; Sat, 25 Sep 2021 13:11: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 18PDBUOD077193; Sat, 25 Sep 2021 13:11:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PDBUtg077192; Sat, 25 Sep 2021 13:11:30 GMT (envelope-from git) Date: Sat, 25 Sep 2021 13:11:30 GMT Message-Id: <202109251311.18PDBUtg077192@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 71d31f1cf601 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 71d31f1cf6012b143fd676f099430818ae949c3f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 13:11:30 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=71d31f1cf6012b143fd676f099430818ae949c3f commit 71d31f1cf6012b143fd676f099430818ae949c3f Author: Konstantin Belousov AuthorDate: 2021-09-24 19:38:53 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-25 12:58:12 +0000 malloc_aligned(9): allow zero size and alignment For alignment we do not need to do anything to make it operational. For size, upgrade zero sized request to one byte so that we do not request insane amount of memory for placeholder. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32127 --- 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 0bdce47b37b4..b1c5909db2a4 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -797,7 +797,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, @@ -812,6 +812,8 @@ malloc_domainset_aligned(size_t size, size_t align, * align, since malloc zones provide alignment equal to their * size. */ + if (size == 0) + size = 1; asize = size <= align ? align : 1UL << flsl(size - 1); res = malloc_domainset(asize, mtp, ds, flags); From owner-dev-commits-src-all@freebsd.org Sat Sep 25 13:11:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F11B36A9146; Sat, 25 Sep 2021 13:11:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGq6W5Vsvz4Wrv; Sat, 25 Sep 2021 13:11:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CAF12CA5; Sat, 25 Sep 2021 13:11:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18PDBVTG077217; Sat, 25 Sep 2021 13:11:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PDBVqf077216; Sat, 25 Sep 2021 13:11:31 GMT (envelope-from git) Date: Sat, 25 Sep 2021 13:11:31 GMT Message-Id: <202109251311.18PDBVqf077216@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 24a3897c2c32 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 24a3897c2c3205c2ec0cf323c555c403d3171e2c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 13:11:32 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=24a3897c2c3205c2ec0cf323c555c403d3171e2c commit 24a3897c2c3205c2ec0cf323c555c403d3171e2c Author: Konstantin Belousov AuthorDate: 2021-09-24 17:46:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-25 12:58:12 +0000 x86 bounce_bus_dmamem_alloc(): use malloc_aligned() only when possible malloc_domainset_aligned() requires that alignment is less than page size. Fall back to other allocation methods, most likely kmem_alloc_contig(), when malloc_aligned() cannot fullfill the driver request. Reported by: Loic F Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32127 --- 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 53ec6a3cab96..5519888542d3 100644 --- a/sys/x86/x86/busdma_bounce.c +++ b/sys/x86/x86/busdma_bounce.c @@ -453,6 +453,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... @@ -467,6 +468,7 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void **vaddr, int flags, * Warn the user if malloc gets it wrong. */ if (dmat->common.maxsize <= PAGE_SIZE && + dmat->common.alignment <= PAGE_SIZE && dmat->common.lowaddr >= ptoa((vm_paddr_t)Maxmem) && attr == VM_MEMATTR_DEFAULT) { *vaddr = malloc_domainset_aligned(dmat->common.maxsize, From owner-dev-commits-src-all@freebsd.org Sat Sep 25 13:18:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B25A16A9348 for ; Sat, 25 Sep 2021 13:18:02 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGqG24BZkz4XDj for ; Sat, 25 Sep 2021 13:18:02 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qv1-xf2f.google.com with SMTP id jo30so8121227qvb.3 for ; Sat, 25 Sep 2021 06:18:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=mvU2yd8hPOHjGf0x2AvHQO1ph/Y3/NlfM7paYR7GMws=; b=b8Y8S8xdZTCzt+s/D2iRW4z2qTDvF8k7DwXc08Af0a/C0bhO5OnOOEv20t5qgrFF8D kQDtxLdyEzwneijq0FYuWScLPebwiJtJ1IhoMlOKyHYdvUF+7lqHO7REm3Qsr2O3zgWT vsZIUEQU2APTc+U3PbmN7UCODb6VtPaL59hn5JzWonmEKG144I2wqNjDN89M5/vmYJbf iJBNLcPQ8AMZVPJqX3cuydcgYXYfUer1m6htIHLUFkNPtaimMfWPEGJVz576h64+bsrU 0l0BhNT1lmutCcU2r4Fr8UJOwIwc/YZuqG9l+szUvGm0+8Dch8TfAuuyIBdrRz9lxNxE MzIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mvU2yd8hPOHjGf0x2AvHQO1ph/Y3/NlfM7paYR7GMws=; b=rp9Bxr4+OjI2IbIf7i+BRojOhOHTDTZrIcLFHrSoTHNUL6z92KY8/EQqGjOvyFpsVs ZsshT89HhJKxtaj6paBD/TvKCLd4NZP7neBKDCHfHVNIT64G3/v0/MBh8+R5kzkePksH +3m4B17xNpczohwTiJo815+ECet2kBCwf9vGMLGPvtMQTqCHKaHNWjrnWZ1lLfqzCcOy 6rFKgtQDWbWwyO5oF6yCEbiM5B4vJtr5j3FStvtnMFxq/bC2r4MGOTrMGA6VYNOA7Lhv XJ4SEEF1SUIY/NdLNN+uB/ZHRsursCQ2FCfirexIdwexanrBVgbfJ0oSzSh5ulF9LEM3 ysCg== X-Gm-Message-State: AOAM532EuxJTM2OjpfOoOjxhJEFgmKKNXUHEXtJ+vBfgk4ZhTv7aYNLB ju+TifI/jNCcHdL3femZY6kYdg== X-Google-Smtp-Source: ABdhPJyjMPB9FqEZXSRcFOlb/9il6eeOSu1WAgrtD0pVvCKTlBtnqWBSTqaW5yn4gJzC+0/S9joNjQ== X-Received: by 2002:a0c:816b:: with SMTP id 98mr15602829qvc.37.1632575882060; Sat, 25 Sep 2021 06:18:02 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id p201sm6155438qke.27.2021.09.25.06.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 06:18:01 -0700 (PDT) Date: Sat, 25 Sep 2021 09:18:01 -0400 From: Shawn Webb To: Konstantin Belousov Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 24a3897c2c32 - main - x86 bounce_bus_dmamem_alloc(): use malloc_aligned() only when possible Message-ID: <20210925131801.b4lyozg7b56646x4@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202109251311.18PDBVqf077216@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="z6scvdiowkqgtp6u" Content-Disposition: inline In-Reply-To: <202109251311.18PDBVqf077216@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4HGqG24BZkz4XDj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 13:18:02 -0000 --z6scvdiowkqgtp6u Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 25, 2021 at 01:11:31PM +0000, Konstantin Belousov wrote: > The branch main has been updated by kib: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D24a3897c2c3205c2ec0cf323c5= 55c403d3171e2c >=20 > commit 24a3897c2c3205c2ec0cf323c555c403d3171e2c > Author: Konstantin Belousov > AuthorDate: 2021-09-24 17:46:47 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-09-25 12:58:12 +0000 >=20 > x86 bounce_bus_dmamem_alloc(): use malloc_aligned() only when possible > =20 > malloc_domainset_aligned() requires that alignment is less than > page size. Fall back to other allocation methods, most likely > kmem_alloc_contig(), when malloc_aligned() cannot fullfill the driver > request. > =20 > Reported by: Loic F > Reviewed by: markj > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D32127 Wrong Differential revision URL? The patch in the URL doesn't match what was committed here. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --z6scvdiowkqgtp6u Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmFPIYEACgkQ/y5nonf4 4fp/5A/+MGW9Urd36WzmK6VZ1JA2GaV1PHDj2d32ooI7xSKtdwYt3nbo1ssWthRf LZQreBJmDAZp0YKkJgKbXOqT0KGe9pNpgmv9blZXJkWJxK18pDu2zrUCgpE8QXUf Ki3fwMEvhpuTfOkvPWikegoAFNbPF/DmrR6jHDeURIubHJ8LrSAkJPLcXGbY1g5c q5SIpH5JM4R0Yea377yqs3lPNCL5wdeskkbzwK7Aqp09kIGcK5KFTmnxtHHUKF+L hPHjvayR0poBms/LQihetS3k54VbF/6f16ZkLVfylGSBJVXfaVs6Ng84LnfATB8g y4qYPo1FTif5PPmcDwVlgRsUahr/cy4QTbeE1N+sjPFE4rYhf+si1VYGzhffODVm t/Wr7E+9hVnIHq8CgKqmNJqI8lt4MqgevKvKZzhYpu2ERIcseV5MV/uYLYXmXQJP TM8Mlm4/E2+DwWn4UMMFd6Kd/fjVJYE8jISJJbUazfImBWF0pRKSbc2bjLYa6bZ3 3USVht/sBkYrW4NFweJIBaSiGN60AooL/sqYibnxiSbU64v/jxZwTpgvGLs5S+CI vfTPdHF5AY/+PsFGYCd0ZEg5UIA3iKIaplj+kw9MMEhDZpI3W5XaVUwmOjGjR2Qi Ga3PSAP8vPNCFkXOUy+K/r5/I9nG4VWMaowEW73n23wpQzfCKQE= =LRdr -----END PGP SIGNATURE----- --z6scvdiowkqgtp6u-- From owner-dev-commits-src-all@freebsd.org Sat Sep 25 14:28:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 74D0F6AA2F9; Sat, 25 Sep 2021 14:28: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 4HGrpz2hHRz4cSb; Sat, 25 Sep 2021 14:28: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 38DFD3FA2; Sat, 25 Sep 2021 14:28:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18PESBBL073041; Sat, 25 Sep 2021 14:28:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PESBnB073040; Sat, 25 Sep 2021 14:28:11 GMT (envelope-from git) Date: Sat, 25 Sep 2021 14:28:11 GMT Message-Id: <202109251428.18PESBnB073040@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: ed8ef7ae8b05 - main - 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/main X-Git-Reftype: branch X-Git-Commit: ed8ef7ae8b05d9f73db2182b5e24b0b76b0783a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 14:28:11 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ed8ef7ae8b05d9f73db2182b5e24b0b76b0783a2 commit ed8ef7ae8b05d9f73db2182b5e24b0b76b0783a2 Author: Mark Johnston AuthorDate: 2021-09-25 14:13:56 +0000 Commit: Mark Johnston CommitDate: 2021-09-25 14:15:03 +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 MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32126 --- 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 6b5a04b174e1..e228f0967f0e 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -4627,7 +4627,7 @@ xpt_done(union ccb *done_ccb) STAILQ_INSERT_TAIL(&queue->cam_doneq, &done_ccb->ccb_h, sim_links.stqe); done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX; mtx_unlock(&queue->cam_doneq_mtx); - if (run) + if (run && !dumping) wakeup(&queue->cam_doneq); } From owner-dev-commits-src-all@freebsd.org Sat Sep 25 14:28:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D238E6A9AFC; Sat, 25 Sep 2021 14:28: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 4HGrq14m2Lz4cYk; Sat, 25 Sep 2021 14:28: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 6A21D3BEC; Sat, 25 Sep 2021 14:28: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 18PESD0i073093; Sat, 25 Sep 2021 14:28:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PESDG4073092; Sat, 25 Sep 2021 14:28:13 GMT (envelope-from git) Date: Sat, 25 Sep 2021 14:28:13 GMT Message-Id: <202109251428.18PESDG4073092@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f766826fe3b8 - main - amd64: Remove proc0_tf, the bootstrap trapframe MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f766826fe3b82462c6397ec849dc2243f4bdfeee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 14:28:14 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f766826fe3b82462c6397ec849dc2243f4bdfeee commit f766826fe3b82462c6397ec849dc2243f4bdfeee Author: Mark Johnston AuthorDate: 2021-09-25 14:18:52 +0000 Commit: Mark Johnston CommitDate: 2021-09-25 14:18:52 +0000 amd64: Remove proc0_tf, the bootstrap trapframe It no longer serves any purpose as thread0's td_frame field is now initialized during fpuinitstate(). No functional change intended. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32057 --- sys/amd64/amd64/machdep.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 5c9b64526609..c629db566528 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -202,7 +202,6 @@ long realmem = 0; struct kva_md_info kmi; -static struct trapframe proc0_tf; struct region_descriptor r_idt; struct pcpu *__pcpu; @@ -1584,7 +1583,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) /* setup proc 0's pcb */ thread0.td_pcb->pcb_flags = 0; - thread0.td_frame = &proc0_tf; env = kern_getenv("kernelname"); if (env != NULL) From owner-dev-commits-src-all@freebsd.org Sat Sep 25 14:28:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A1DE46AA2FB; Sat, 25 Sep 2021 14:28: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 4HGrq03CgFz4cgL; Sat, 25 Sep 2021 14:28: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 4F9E33DA9; Sat, 25 Sep 2021 14:28: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 18PESCpZ073065; Sat, 25 Sep 2021 14:28:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PESCKx073064; Sat, 25 Sep 2021 14:28:12 GMT (envelope-from git) Date: Sat, 25 Sep 2021 14:28:12 GMT Message-Id: <202109251428.18PESCKx073064@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: ca1e447b1048 - main - amd64: Avoid copying td_frame from kernel procs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ca1e447b1048b26b855d7f7fbcdad78309e4d741 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 14:28:12 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ca1e447b1048b26b855d7f7fbcdad78309e4d741 commit ca1e447b1048b26b855d7f7fbcdad78309e4d741 Author: Mark Johnston AuthorDate: 2021-09-25 14:15:31 +0000 Commit: Mark Johnston CommitDate: 2021-09-25 14:18:30 +0000 amd64: Avoid copying td_frame from kernel procs When creating a new thread, we unconditionally copy td_frame from the creating thread. For threads which never return to user mode, this is unnecessary since td_frame just points to the base of the stack or a random interrupt frame. If KASAN is configured this copying may also trigger false positives since the td_frame region may contain poisoned stack regions. It was not noticed before since thread0 used a dummy proc0_tf trapframe, and kernel procs are generally created by thread0. Since commit df8dd6025af88a99d34f549fa9591a9b8f9b75b1, though, we call cpu_thread_alloc(&thread0) when initializing FPU state, which reinitializes thread0.td_frame. Work around the problem by not copying the frame unless the copying thread came from user mode. While here, de-duplicate the copying and remove redundant re(initialization) of td_frame. Reported by: syzbot+2ec89312bffbf38d9aec@syzkaller.appspotmail.com Reviewed by: kib Fixes: df8dd6025af8 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32057 --- sys/amd64/amd64/vm_machdep.c | 48 +++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 0bfcd03d6655..c0456c1d958c 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -193,6 +193,24 @@ copy_thread(struct thread *td1, struct thread *td2) td2->td_md.md_spinlock_count = 1; td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; pmap_thread_init_invl_gen(td2); + + /* + * Copy the trap frame for the return to user mode as if from a syscall. + * This copies most of the user mode register values. Some of these + * registers are rewritten by cpu_set_upcall() and linux_set_upcall(). + */ + if ((td1->td_proc->p_flag & P_KPROC) == 0) { + bcopy(td1->td_frame, td2->td_frame, sizeof(struct trapframe)); + + /* + * If the current thread has the trap bit set (i.e. a debugger + * had single stepped the process to the system call), we need + * to clear the trap flag from the new frame. Otherwise, the new + * thread will receive a (likely unexpected) SIGTRAP when it + * executes the first instruction after returning to userland. + */ + td2->td_frame->tf_rflags &= ~PSL_T; + } } /* @@ -236,23 +254,9 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) mdp2 = &p2->p_md; bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); - /* - * Copy the trap frame for the return to user mode as if from a - * syscall. This copies most of the user mode register values. - */ - td2->td_frame = (struct trapframe *)td2->td_md.md_stack_base - 1; - bcopy(td1->td_frame, td2->td_frame, sizeof(struct trapframe)); - /* Set child return values. */ p2->p_sysent->sv_set_fork_retval(td2); - /* - * If the parent process has the trap bit set (i.e. a debugger - * had single stepped the process to the system call), we need - * to clear the trap flag from the new frame. - */ - td2->td_frame->tf_rflags &= ~PSL_T; - /* As on i386, do not copy io permission bitmap. */ pcb2->pcb_tssp = NULL; @@ -602,22 +606,6 @@ cpu_copy_thread(struct thread *td, struct thread *td0) { copy_thread(td0, td); - /* - * Copy user general-purpose registers. - * - * Some of these registers are rewritten by cpu_set_upcall() - * and linux_set_upcall(). - */ - bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); - - /* If the current thread has the trap bit set (i.e. a debugger had - * single stepped the process to the system call), we need to clear - * the trap flag from the new frame. Otherwise, the new thread will - * receive a (likely unexpected) SIGTRAP when it executes the first - * instruction after returning to userland. - */ - td->td_frame->tf_rflags &= ~PSL_T; - set_pcb_flags_raw(td->td_pcb, PCB_FULL_IRET); } From owner-dev-commits-src-all@freebsd.org Sat Sep 25 15:36:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E0FE6AB76E; Sat, 25 Sep 2021 15:36:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGtLL22h7z4hn7; Sat, 25 Sep 2021 15:36: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 2245A4E54; Sat, 25 Sep 2021 15:36: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 18PFawMj066063; Sat, 25 Sep 2021 15:36:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PFawjc066062; Sat, 25 Sep 2021 15:36:58 GMT (envelope-from git) Date: Sat, 25 Sep 2021 15:36:58 GMT Message-Id: <202109251536.18PFawjc066062@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: d71e1a883c92 - main - fifo: support flock MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d71e1a883c92b8b166eea59734850acd54048d72 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 15:36:58 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=d71e1a883c92b8b166eea59734850acd54048d72 commit d71e1a883c92b8b166eea59734850acd54048d72 Author: Mateusz Guzik AuthorDate: 2021-09-25 12:24:39 +0000 Commit: Mateusz Guzik CommitDate: 2021-09-25 14:58:31 +0000 fifo: support flock This evens it up with Linux. Original patch by: Greg V Differential Revision: https://reviews.freebsd.org/D24255#565302 --- sys/fs/fifofs/fifo_vnops.c | 4 +++- sys/kern/kern_descrip.c | 16 ++++++++++------ sys/kern/vfs_vnops.c | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index 861f1b40a744..1b941620b080 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -376,5 +376,7 @@ fifo_advlock(ap) } */ *ap; { - return (ap->a_flags & F_FLOCK ? EOPNOTSUPP : EINVAL); + if ((ap->a_flags & F_FLOCK) == 0) + return (EINVAL); + return (vop_stdadvlock(ap)); } diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index ed7fe83cf02f..58c2d1939dba 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -3560,11 +3560,15 @@ sys_flock(struct thread *td, struct flock_args *uap) error = fget(td, uap->fd, &cap_flock_rights, &fp); if (error != 0) return (error); - if (fp->f_type != DTYPE_VNODE || fp->f_ops == &path_fileops) { - fdrop(fp, td); - return (EOPNOTSUPP); + error = EOPNOTSUPP; + if (fp->f_type != DTYPE_VNODE && fp->f_type != DTYPE_FIFO) { + goto done; + } + if (fp->f_ops == &path_fileops) { + goto done; } + error = 0; vp = fp->f_vnode; lf.l_whence = SEEK_SET; lf.l_start = 0; @@ -3573,7 +3577,7 @@ sys_flock(struct thread *td, struct flock_args *uap) lf.l_type = F_UNLCK; atomic_clear_int(&fp->f_flag, FHASLOCK); error = VOP_ADVLOCK(vp, (caddr_t)fp, F_UNLCK, &lf, F_FLOCK); - goto done2; + goto done; } if (uap->how & LOCK_EX) lf.l_type = F_WRLCK; @@ -3581,12 +3585,12 @@ sys_flock(struct thread *td, struct flock_args *uap) lf.l_type = F_RDLCK; else { error = EBADF; - goto done2; + goto done; } atomic_set_int(&fp->f_flag, FHASLOCK); error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, (uap->how & LOCK_NB) ? F_FLOCK : F_FLOCK | F_WAIT); -done2: +done: fdrop(fp, td); return (error); } diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index d4229160f11e..aeeeee3e3a1d 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1829,7 +1829,7 @@ vn_closefile(struct file *fp, struct thread *td) vp = fp->f_vnode; fp->f_ops = &badfileops; - ref = (fp->f_flag & FHASLOCK) != 0 && fp->f_type == DTYPE_VNODE; + ref = (fp->f_flag & FHASLOCK) != 0; error = vn_close1(vp, fp->f_flag, fp->f_cred, td, ref); From owner-dev-commits-src-all@freebsd.org Sat Sep 25 15:36:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7EBC86AB3FA; Sat, 25 Sep 2021 15:36: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 4HGtLM2tjpz4hZ7; Sat, 25 Sep 2021 15:36: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 3FF204E55; Sat, 25 Sep 2021 15:36: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 18PFaxH5066087; Sat, 25 Sep 2021 15:36:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PFaxpu066086; Sat, 25 Sep 2021 15:36:59 GMT (envelope-from git) Date: Sat, 25 Sep 2021 15:36:59 GMT Message-Id: <202109251536.18PFaxpu066086@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 13c63ae08df4 - main - mmc: fix 1-byte reallocs (when it should have been sizeof device_t) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 13c63ae08df43d4e662b73ea3e05137fff88e639 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 15:36:59 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=13c63ae08df43d4e662b73ea3e05137fff88e639 commit 13c63ae08df43d4e662b73ea3e05137fff88e639 Author: Mateusz Guzik AuthorDate: 2021-09-25 12:49:43 +0000 Commit: Mateusz Guzik CommitDate: 2021-09-25 14:58:31 +0000 mmc: fix 1-byte reallocs (when it should have been sizeof device_t) Reported by KASAN: panic: ASan: Invalid access, 8-byte write at 0xfffffe00f0992610, RedZonePartial(1) panic() at panic+0xb5/frame 0xffffffff86a595b0 __asan_store8_noabort() at __asan_store8_noabort+0x376/frame 0xffffffff86a59670 mmc_go_discovery() at mmc_go_discovery+0x6c61/frame 0xffffffff86a5a790 mmc_delayed_attach() at mmc_delayed_attach+0x35/frame 0xffffffff86a5a7b0 [snip] Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/dev/mmc/mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mmc/mmc.c b/sys/dev/mmc/mmc.c index 74d0549ca491..071c238374df 100644 --- a/sys/dev/mmc/mmc.c +++ b/sys/dev/mmc/mmc.c @@ -1920,7 +1920,7 @@ child_common: if (child != NULL) { device_set_ivars(child, ivar); sc->child_list = realloc(sc->child_list, - sizeof(device_t) * sc->child_count + 1, + sizeof(device_t) * (sc->child_count + 1), M_DEVBUF, M_WAITOK); sc->child_list[sc->child_count++] = child; } else From owner-dev-commits-src-all@freebsd.org Sat Sep 25 15:55:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 17E726ABE5A; Sat, 25 Sep 2021 15:55:40 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGtlv6sf4z4jb8; Sat, 25 Sep 2021 15:55:39 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id C4844C4B2; Sat, 25 Sep 2021 15:55:39 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f171.google.com with SMTP id x9so12559630qtv.0; Sat, 25 Sep 2021 08:55:39 -0700 (PDT) X-Gm-Message-State: AOAM530G18uBMwte2ftWlULJsBiLkJKKNJH1uQVO23n+QJQpt8IvkiXs t/dK16TZU50beHy88pCNN3xbdlsK2jMHs2Y4gN8= X-Google-Smtp-Source: ABdhPJx3SA10mseFFhwtF8kQh4FFsDl5AwDi8c0OXocWBh7ZksbWbuowRtyVzlF6L0+NXBdUD9lfTXMZf7rbvGbH2os= X-Received: by 2002:ac8:7384:: with SMTP id t4mr10148360qtp.83.1632585339166; Sat, 25 Sep 2021 08:55:39 -0700 (PDT) MIME-Version: 1.0 References: <202109251311.18PDBVqf077216@gitrepo.freebsd.org> <20210925131801.b4lyozg7b56646x4@mutt-hbsd> In-Reply-To: <20210925131801.b4lyozg7b56646x4@mutt-hbsd> From: Kyle Evans Date: Sat, 25 Sep 2021 10:55:28 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 24a3897c2c32 - main - x86 bounce_bus_dmamem_alloc(): use malloc_aligned() only when possible To: Shawn Webb Cc: Konstantin Belousov , src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 15:55:40 -0000 On Sat, Sep 25, 2021 at 8:18 AM Shawn Webb wrote: > > On Sat, Sep 25, 2021 at 01:11:31PM +0000, Konstantin Belousov wrote: > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=24a3897c2c3205c2ec0cf323c555c403d3171e2c > > > > commit 24a3897c2c3205c2ec0cf323c555c403d3171e2c > > Author: Konstantin Belousov > > AuthorDate: 2021-09-24 17:46:47 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2021-09-25 12:58:12 +0000 > > > > x86 bounce_bus_dmamem_alloc(): use malloc_aligned() only when possible > > > > malloc_domainset_aligned() requires that alignment is less than > > page size. Fall back to other allocation methods, most likely > > kmem_alloc_contig(), when malloc_aligned() cannot fullfill the driver > > request. > > > > Reported by: Loic F > > Reviewed by: markj > > Sponsored by: The FreeBSD Foundation > > MFC after: 1 week > > Differential revision: https://reviews.freebsd.org/D32127 > > Wrong Differential revision URL? The patch in the URL doesn't match > what was committed here. > No; there were two patches included, and Phabricator always updates the diff to the first one that closed it. You can check the history on the diff to find the last one pre-commit. From owner-dev-commits-src-all@freebsd.org Sat Sep 25 16:23:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 13A5C6AC187; Sat, 25 Sep 2021 16:23: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 4HGvNQ6vVxz4lj0; Sat, 25 Sep 2021 16:23:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD1EB55E2; Sat, 25 Sep 2021 16:23: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 18PGNoWq032256; Sat, 25 Sep 2021 16:23:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PGNoXN032255; Sat, 25 Sep 2021 16:23:50 GMT (envelope-from git) Date: Sat, 25 Sep 2021 16:23:50 GMT Message-Id: <202109251623.18PGNoXN032255@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: c6bdb5d46872 - stable/13 - EC2: Allow AMI boot mode to be specified MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c6bdb5d46872386ce4eeab8c47937c73ab7be92e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 16:23:51 -0000 The branch stable/13 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=c6bdb5d46872386ce4eeab8c47937c73ab7be92e commit c6bdb5d46872386ce4eeab8c47937c73ab7be92e Author: Colin Percival AuthorDate: 2021-09-16 02:15:44 +0000 Commit: Colin Percival CommitDate: 2021-09-25 16:11:48 +0000 EC2: Allow AMI boot mode to be specified The default boot method for amd64 AMIs is BIOS, but at AMI creation time a flag can be set to specify that UEFI should be used instead. This commit adds a variable AMIBOOTMETHOD which, if set to "UEFI", causes the appropriate flag to be set during AMI creation. The only boot method supported by EC2 for arm64 is UEFI. The names of AMIs are also amended to include the boot method; they now look like "FreeBSD 14.0-CURRENT-amd64-20210915 UEFI". Sponsored by: https://www.patreon.com/cperciva (cherry picked from commit 0aa2a94ea6359fb2587af81841fbf8eb30ab36b0) --- release/Makefile.ec2 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/release/Makefile.ec2 b/release/Makefile.ec2 index 58042cba1f88..c82620ea5cd6 100644 --- a/release/Makefile.ec2 +++ b/release/Makefile.ec2 @@ -24,6 +24,16 @@ SSMOPTS= --ssm-name ${SSMPREFIX}/${TARGET_ARCH:S/aarch64/arm64/}/base/ufs/${REVI .if ${TARGET_ARCH} != "amd64" EC2ARCH= --${TARGET_ARCH:S/aarch64/arm64/} .endif +.if !defined(AMIBOOTMETHOD) +.if ${TARGET_ARCH} == "amd64" +AMIBOOTMETHOD= BIOS +.else +AMIBOOTMETHOD= UEFI +.endif +.endif +.if ${AMIBOOTMETHOD} == "UEFI" && ${TARGET_ARCH} == "amd64" +BOOTMODEOPT= --uefi +.endif CLEANFILES+= ec2ami @@ -65,9 +75,9 @@ ec2ami: cw-ec2 ${CW_EC2_PORTINSTALL} @false .endif /usr/local/bin/bsdec2-image-upload ${PUBLISH} ${PUBLICSNAP} \ - ${EC2ARCH} ${SSMOPTS} --sriov --ena \ + ${EC2ARCH} ${SSMOPTS} ${BOOTMODEOPT} --sriov --ena \ ${.OBJDIR}/ec2.raw \ - "${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX}" \ + "${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX} ${AMIBOOTMETHOD}" \ "${TYPE}/${TARGET} ${GITBRANCH}@${GITREV}" \ ${AWSREGION} ${AWSBUCKET} ${AWSKEYFILE} \ ${EC2SNSTOPIC} ${EC2SNSREL} ${EC2SNSVERS} From owner-dev-commits-src-all@freebsd.org Sat Sep 25 16:23:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 42E9B6ABEAC; Sat, 25 Sep 2021 16:23: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 4HGvNS11cKz4lcH; Sat, 25 Sep 2021 16:23: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 EEFF5594E; Sat, 25 Sep 2021 16:23:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18PGNpG2032281; Sat, 25 Sep 2021 16:23:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PGNp9O032280; Sat, 25 Sep 2021 16:23:51 GMT (envelope-from git) Date: Sat, 25 Sep 2021 16:23:51 GMT Message-Id: <202109251623.18PGNp9O032280@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: 65f22ccf8247 - stable/13 - EC2: Default to UEFI booting MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 65f22ccf824710cb633da9424961ee02fecd7591 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 16:23:52 -0000 The branch stable/13 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=65f22ccf824710cb633da9424961ee02fecd7591 commit 65f22ccf824710cb633da9424961ee02fecd7591 Author: Colin Percival AuthorDate: 2021-09-16 16:22:42 +0000 Commit: Colin Percival CommitDate: 2021-09-25 16:20:58 +0000 EC2: Default to UEFI booting This reduces the FreeBSD boot time by approximately 5 seconds, roughly equally divided betwenn two factors: * Disk I/O is faster in the EFI loader since it can perform larger I/Os. (The BIOS loader is limited due to the use of bounce buffers in sub-1M memory.) * The EFI console is much faster than the VGA console. Note however that not all EC2 instance types support UEFI; as a general rule the newer instances (based on Amazon's "Nitro" platform) support UEFI but the older instances (based on Xen) do not. Discussed with: re@, freebsd-cloud@, Amazon Relnotes: yes Sponsored by: https://www.patreon.com/cperciva (cherry picked from commit b43d7aa09b3c91fb6b652306db2ac13e1459c497) --- release/Makefile.ec2 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/release/Makefile.ec2 b/release/Makefile.ec2 index c82620ea5cd6..3a3f6232333d 100644 --- a/release/Makefile.ec2 +++ b/release/Makefile.ec2 @@ -25,12 +25,8 @@ SSMOPTS= --ssm-name ${SSMPREFIX}/${TARGET_ARCH:S/aarch64/arm64/}/base/ufs/${REVI EC2ARCH= --${TARGET_ARCH:S/aarch64/arm64/} .endif .if !defined(AMIBOOTMETHOD) -.if ${TARGET_ARCH} == "amd64" -AMIBOOTMETHOD= BIOS -.else AMIBOOTMETHOD= UEFI .endif -.endif .if ${AMIBOOTMETHOD} == "UEFI" && ${TARGET_ARCH} == "amd64" BOOTMODEOPT= --uefi .endif From owner-dev-commits-src-all@freebsd.org Sat Sep 25 16:24:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43D3F6AC497 for ; Sat, 25 Sep 2021 16:24:43 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGvPR12Twz4llv for ; Sat, 25 Sep 2021 16:24:43 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x736.google.com with SMTP id q81so28142328qke.5 for ; Sat, 25 Sep 2021 09:24:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=EplBykSmk+oej7mvVRy39XDlmh+Y3OAIsvYp3dSs8dA=; b=ASOGNgpIJedZhJ78p6KN0O9opZFaKBQ52QLbbHn5cfUgA1URx/zdsqIggOv7bSkIOO PmOHPb2oUKyHhJY0KTiugaAzq+B7FaUcRv2bMMVYlVDBStwA79R4lmycYAy6SmcR83Lr 7go6PGuwCOmiQgnu0mZ+GAuJV4Oxk33Gv184bY9Ev/+rxS0G7eezctxXk/Q5wUk3zFwH zKyMzZpILCigeQ7B98HJQo840VqSQj4k0mMFfKkoHe0nNRbExpTwuabECMCzpFmr1A4c WnN5Gx1oomro8BHS+2s6NqrDEdgt9QTqlruvY2MZUl2ANX+8Yl5AhQDQ3Gr21mU9/WhP PjIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=EplBykSmk+oej7mvVRy39XDlmh+Y3OAIsvYp3dSs8dA=; b=ltMyPCg2+zZKBtk9VD+rHDVoc8rCY8bX4RqvlGzoI2/Hmz/mGcrqR6yKi36SVjH+DK lPohi8QISJ7fI9qDotoprXMb8TZxWRd37Y7/nC6eB4TKPXPP7FpasKhf7hAY9g6joofl X6iZC3Q8BH7Bici8NklV/BlQmCMPjxOHTSnpXuG/eC0C+icXazhyjMdNxIfVNJwZQpre s2+pdOyvZtJS7aB67tzjxD4n8YhkMZeCylElYIHXuq9Z/TBqTzXAWRce0gGPuVhzwVmT 8o8aFSplgsLRhulHVYDbxqESbGxPqy3sSM8893GanCd5k1Ga69kTqiqV3fQJzWnMXWT8 +SxQ== X-Gm-Message-State: AOAM5318vjVWRMaU7pEcqLqcNbkRwGk68GjTAt95iZxxrsai/lyUqGM9 4ZWMk2ss+tzAZw9kSQKQIPROFDbbaWB3M8u7mvg= X-Google-Smtp-Source: ABdhPJxvUsU/pstCc1IId1o5QkTSxlVQ1UApV5GoVYSKmB3+4kq1JZ7jVQ/LIapf7okVYKS1lKKnag== X-Received: by 2002:a37:aa8d:: with SMTP id t135mr16192246qke.370.1632587082626; Sat, 25 Sep 2021 09:24:42 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id f5sm6350374qtp.44.2021.09.25.09.24.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 09:24:42 -0700 (PDT) Date: Sat, 25 Sep 2021 12:24:41 -0400 From: Shawn Webb To: Kyle Evans Cc: Konstantin Belousov , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 24a3897c2c32 - main - x86 bounce_bus_dmamem_alloc(): use malloc_aligned() only when possible Message-ID: <20210925162441.jidijkgso3x6udxm@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202109251311.18PDBVqf077216@gitrepo.freebsd.org> <20210925131801.b4lyozg7b56646x4@mutt-hbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6qgzcylfpocqbcmk" Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4HGvPR12Twz4llv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 16:24:43 -0000 --6qgzcylfpocqbcmk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 25, 2021 at 10:55:28AM -0500, Kyle Evans wrote: > On Sat, Sep 25, 2021 at 8:18 AM Shawn Webb w= rote: > > > > On Sat, Sep 25, 2021 at 01:11:31PM +0000, Konstantin Belousov wrote: > > > The branch main has been updated by kib: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D24a3897c2c3205c2ec0cf3= 23c555c403d3171e2c > > > > > > commit 24a3897c2c3205c2ec0cf323c555c403d3171e2c > > > Author: Konstantin Belousov > > > AuthorDate: 2021-09-24 17:46:47 +0000 > > > Commit: Konstantin Belousov > > > CommitDate: 2021-09-25 12:58:12 +0000 > > > > > > x86 bounce_bus_dmamem_alloc(): use malloc_aligned() only when pos= sible > > > > > > malloc_domainset_aligned() requires that alignment is less than > > > page size. Fall back to other allocation methods, most likely > > > kmem_alloc_contig(), when malloc_aligned() cannot fullfill the dr= iver > > > request. > > > > > > Reported by: Loic F > > > Reviewed by: markj > > > Sponsored by: The FreeBSD Foundation > > > MFC after: 1 week > > > Differential revision: https://reviews.freebsd.org/D32127 > > > > Wrong Differential revision URL? The patch in the URL doesn't match > > what was committed here. > > >=20 > No; there were two patches included, and Phabricator always updates > the diff to the first one that closed it. You can check the history on > the diff to find the last one pre-commit. Cool. Thanks for the clarification! --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --6qgzcylfpocqbcmk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmFPTUcACgkQ/y5nonf4 4fo++Q//bu+bYu+KfmnQA1P9EMSaP9rke530/rHUPZSob/K7Z8D0qhvF7hCrS0cP qk/Em5AL0+ATLiZccTsoLL2Hc4YZZgKeZXI+pUzDu654ZH7zcWtYH2Upt2KlxYqH 35nV9t9M87D4eO0x8T7T8TK29/YUAiHXiQ79S2JFTimJLKM6gkEGXszSJKph+Pas Q9gxn06l6+bbYkU3cQ+YCVV2SXe+9Tp6ibNR32PF3d867NAcW7nHubdW/2tMIONe Tfvc7CkY7kNd3ffPjS8mW0sAgGt2vRJTqplPoiYkYfkmXYnYvesjCiQB1HlsUVxQ wpxxqRyZ6hf9AW0EdGappfM93QLhE8xF27y3jZwWSo8VDjBB5nFjx9Mhrnzk4edB tqVNtU+C04b3CdX4rDLSyePBj0jA3Gi7bbtB4vPlTI/qYsJidcmAN+JBbesEtHWc tGYSXm4YawtigsS99EI6aAmUomnI2DaKx8qsbx8hOyFnBu4uacYhX9BzANBW0/lp ZP0Sufy7c3GGxwWLpyiDX/cUl/kMlu29Dr+gzNmPjf/QH8yTAmd86snAmHPJi0tj fnd9Md2HGUhY2DFmmnz+WJOCT37Xzpcx9bwzU6KZzCp7b5USIH/ATcCoj3LD+5Ph /I3goz+6ISiA05QRyBo49r+sCCm5nW1NZT+f7xfBrYfqimrqr8Q= =1Q2t -----END PGP SIGNATURE----- --6qgzcylfpocqbcmk-- From owner-dev-commits-src-all@freebsd.org Sat Sep 25 16:28:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 468066AC4B4; Sat, 25 Sep 2021 16:28: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 4HGvTs1Wncz4mcv; Sat, 25 Sep 2021 16:28: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 107E955E3; Sat, 25 Sep 2021 16:28: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 18PGSWuD032705; Sat, 25 Sep 2021 16:28:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PGSWTT032704; Sat, 25 Sep 2021 16:28:32 GMT (envelope-from git) Date: Sat, 25 Sep 2021 16:28:32 GMT Message-Id: <202109251628.18PGSWTT032704@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Yoshihiro Takahashi Subject: git: d653b188e89b - main - 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/main X-Git-Reftype: branch X-Git-Commit: d653b188e89b5e44b2708342c7d3b789398f9cde Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 16:28:33 -0000 The branch main has been updated by nyan: URL: https://cgit.FreeBSD.org/src/commit/?id=d653b188e89b5e44b2708342c7d3b789398f9cde commit d653b188e89b5e44b2708342c7d3b789398f9cde Author: Yoshihiro Takahashi AuthorDate: 2021-09-25 16:24:33 +0000 Commit: Yoshihiro Takahashi CommitDate: 2021-09-25 16:24:33 +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(). MFC after: 1 week --- sys/netgraph/ng_ether.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c index 5718de235c4c..40e06604b8bb 100644 --- a/sys/netgraph/ng_ether.c +++ b/sys/netgraph/ng_ether.c @@ -414,7 +414,9 @@ ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp) node_p node; /* Only ethernet interfaces are of interest. */ - if (ifp->if_type != IFT_ETHER && ifp->if_type != IFT_L2VLAN) + if (ifp->if_type != IFT_ETHER && + ifp->if_type != IFT_L2VLAN && + ifp->if_type != IFT_BRIDGE) return; /* @@ -868,8 +870,9 @@ vnet_ng_ether_init(const void *unused) /* Create nodes for any already-existing Ethernet interfaces. */ IFNET_RLOCK(); CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) { - if (ifp->if_type == IFT_ETHER - || ifp->if_type == IFT_L2VLAN) + if (ifp->if_type == IFT_ETHER || + ifp->if_type == IFT_L2VLAN || + ifp->if_type == IFT_BRIDGE) ng_ether_attach(ifp); } IFNET_RUNLOCK(); From owner-dev-commits-src-all@freebsd.org Sat Sep 25 16:30:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9EA986AC59B; Sat, 25 Sep 2021 16:30:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGvWb479Nz4mgR; Sat, 25 Sep 2021 16:30:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (unknown [IPv6:2601:648:8681:1cb0:e948:53aa:fce5:d12d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 009B9C3B4; Sat, 25 Sep 2021 16:30:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: c8077ccd70cf - main - acpi_cpu: Make device unit numbers match OS CPU IDs. To: Alexander Motin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202109250124.18P1OOP5035829@gitrepo.freebsd.org> From: John Baldwin Message-ID: <5d4a3f4f-0249-01b6-37ef-9a3dd9a8d7ad@FreeBSD.org> Date: Sat, 25 Sep 2021 09:30:01 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <202109250124.18P1OOP5035829@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 16:30:03 -0000 On 9/24/21 6:24 PM, Alexander Motin wrote: > The branch main has been updated by mav: > > URL: https://cgit.FreeBSD.org/src/commit/?id=c8077ccd70cfcbcccb752e89b848f098abcb9309 > > commit c8077ccd70cfcbcccb752e89b848f098abcb9309 > Author: Alexander Motin > AuthorDate: 2021-09-25 01:03:02 +0000 > Commit: Alexander Motin > CommitDate: 2021-09-25 01:24:19 +0000 > > acpi_cpu: Make device unit numbers match OS CPU IDs. > > There are already APIC ID, ACPI ID and OS ID for each CPU. In perfect > world all of those may match, but at least for SuperMicro server boards > none of them do. Plus none of them match the CPU devices listing order > by ACPI. Previous code used the ACPI device listing order to number > cpuX devices. It looked nice from NewBus perspective, but introduced > 4th different set of IDs. Extremely confusing one, since in some places > the device unit numbers were treated as OS CPU IDs (coretemp), but not > in others (sysctl dev.cpu.X.%location). FWIW, the "normal" way to force specific device unit numbers is via bus_hint_device_unit, but perhaps that is specific to when hints exits whereas this is specific to a bus property. Perhaps though this can't have the unit number assigned by the bus at the BUS_ADD_CHILD call? That would be the other way to handle this perhaps vs trying to change the unit in the probe routine. -- John Baldwin From owner-dev-commits-src-all@freebsd.org Sat Sep 25 16:39:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 190EE6AC3D2; Sat, 25 Sep 2021 16:39: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 4HGvjx5dS0z4pYl; Sat, 25 Sep 2021 16:39: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 9AB5A5D4F; Sat, 25 Sep 2021 16:39: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 18PGd1v7046338; Sat, 25 Sep 2021 16:39:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PGd1ka046337; Sat, 25 Sep 2021 16:39:01 GMT (envelope-from git) Date: Sat, 25 Sep 2021 16:39:01 GMT Message-Id: <202109251639.18PGd1ka046337@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Yoshihiro Takahashi Subject: git: a4724ff48108 - main - 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/main X-Git-Reftype: branch X-Git-Commit: a4724ff48108840416c83f10e15d666ac8d78937 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 16:39:02 -0000 The branch main has been updated by nyan: URL: https://cgit.FreeBSD.org/src/commit/?id=a4724ff48108840416c83f10e15d666ac8d78937 commit a4724ff48108840416c83f10e15d666ac8d78937 Author: Yoshihiro Takahashi AuthorDate: 2021-09-25 16:32:42 +0000 Commit: Yoshihiro Takahashi CommitDate: 2021-09-25 16:32:42 +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 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28892 --- usr.bin/unzip/unzip.1 | 10 ++++++-- usr.bin/unzip/unzip.c | 66 ++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 66 insertions(+), 10 deletions(-) diff --git a/usr.bin/unzip/unzip.1 b/usr.bin/unzip/unzip.1 index b7c2d858f012..bb43abf43a85 100644 --- a/usr.bin/unzip/unzip.1 +++ b/usr.bin/unzip/unzip.1 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 12, 2015 +.Dd September 25, 2021 .Dt UNZIP 1 .Os .Sh NAME @@ -35,6 +35,8 @@ .Nm .Op Fl aCcfjLlnopqtuvy .Op Fl d Ar dir +.Op Fl x Ar pattern +.Op Fl P Ar password .Ar zipfile .Sh DESCRIPTION .\" ... @@ -81,6 +83,10 @@ When extracting files from the zipfile, they are written to stdout. The normal output is suppressed as if .Fl q was specified. +.It Fl P Ar password +Extract encrypted files using a password. +Putting a password on the command line using this option can be +insecure. .It Fl q Quiet: print less information while extracting. .It Fl t @@ -172,7 +178,7 @@ utility is only able to process ZIP archives handled by .Xr libarchive 3 . Depending on the installed version of .Xr libarchive 3 , -this may or may not include self-extracting archives. +this may or may not include self-extracting or ZIPX archives. .Sh SEE ALSO .Xr libarchive 3 .Sh HISTORY diff --git a/usr.bin/unzip/unzip.c b/usr.bin/unzip/unzip.c index 937176111a02..e5ca1ff2c939 100644 --- a/usr.bin/unzip/unzip.c +++ b/usr.bin/unzip/unzip.c @@ -51,6 +51,7 @@ #include #include +#include /* command-line options */ static int a_opt; /* convert EOL */ @@ -63,6 +64,7 @@ static int L_opt; /* lowercase names */ static int n_opt; /* never overwrite */ static int o_opt; /* always overwrite */ static int p_opt; /* extract to stdout, quiet */ +static char *P_arg; /* passphrase */ static int q_opt; /* quiet */ static int t_opt; /* test */ static int u_opt; /* update */ @@ -95,6 +97,9 @@ static int tty; */ static int noeol; +/* for an interactive passphrase input */ +static char *passphrase_buf; + /* fatal error message + errno */ static void error(const char *fmt, ...) @@ -109,7 +114,7 @@ error(const char *fmt, ...) vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, ": %s\n", strerror(errno)); - exit(1); + exit(EXIT_FAILURE); } /* fatal error message, no errno */ @@ -126,7 +131,7 @@ errorx(const char *fmt, ...) vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, "\n"); - exit(1); + exit(EXIT_FAILURE); } /* non-fatal error message + errno */ @@ -854,6 +859,36 @@ test(struct archive *a, struct archive_entry *e) return error_count; } +/* + * Callback function for reading passphrase. + * Originally from cpio.c and passphrase.c, libarchive. + */ +#define PPBUFF_SIZE 1024 +static const char * +passphrase_callback(struct archive *a, void *_client_data) +{ + char *p; + + (void)a; /* UNUSED */ + (void)_client_data; /* UNUSED */ + + if (passphrase_buf == NULL) { + passphrase_buf = malloc(PPBUFF_SIZE); + if (passphrase_buf == NULL) { + errno = ENOMEM; + error("malloc()"); + } + } + + p = readpassphrase("\nEnter password: ", passphrase_buf, + PPBUFF_SIZE, RPP_ECHO_OFF); + + if (p == NULL && errno != EINTR) + error("Error reading password"); + + return p; +} + /* * Main loop: open the zipfile, iterate over its contents and decide what * to do with each entry. @@ -870,6 +905,13 @@ unzip(const char *fn) error("archive_read_new failed"); ac(archive_read_support_format_zip(a)); + + if (P_arg) + archive_read_add_passphrase(a, P_arg); + else + archive_read_set_passphrase_callback(a, NULL, + &passphrase_callback); + ac(archive_read_open_filename(a, fn, 8192)); if (!zipinfo_mode) { @@ -925,6 +967,11 @@ unzip(const char *fn) ac(archive_read_free(a)); + if (passphrase_buf != NULL) { + memset_s(passphrase_buf, PPBUFF_SIZE, 0, PPBUFF_SIZE); + free(passphrase_buf); + } + if (t_opt) { if (error_count > 0) { errorx("%ju checksum error(s) found.", error_count); @@ -940,9 +987,9 @@ static void usage(void) { - fprintf(stderr, "Usage: unzip [-aCcfjLlnopqtuvyZ1] [-d dir] [-x pattern] " - "zipfile\n"); - exit(1); + fprintf(stderr, "Usage: unzip [-aCcfjLlnopqtuvyZ1] [-d dir] " + "[-x pattern] [-P password] zipfile\n"); + exit(EXIT_FAILURE); } static int @@ -951,7 +998,7 @@ getopts(int argc, char *argv[]) int opt; optreset = optind = 1; - while ((opt = getopt(argc, argv, "aCcd:fjLlnopqtuvx:yZ1")) != -1) + while ((opt = getopt(argc, argv, "aCcd:fjLlnopP:qtuvx:yZ1")) != -1) switch (opt) { case '1': Z1_opt = 1; @@ -991,6 +1038,9 @@ getopts(int argc, char *argv[]) case 'p': p_opt = 1; break; + case 'P': + P_arg = optarg; + break; case 'q': q_opt = 1; break; @@ -1047,7 +1097,7 @@ main(int argc, char *argv[]) */ if (zipinfo_mode && !Z1_opt) { printf("Zipinfo mode needs additional options\n"); - exit(1); + exit(EXIT_FAILURE); } if (argc <= nopts) @@ -1068,5 +1118,5 @@ main(int argc, char *argv[]) unzip(zipfile); - exit(0); + exit(EXIT_SUCCESS); } From owner-dev-commits-src-all@freebsd.org Sat Sep 25 17:07:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96AE86AC96E; Sat, 25 Sep 2021 17:07: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 4HGwLx3g3Sz4sDP; Sat, 25 Sep 2021 17:07: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 5F2DC638D; Sat, 25 Sep 2021 17:07: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 18PH7btH086715; Sat, 25 Sep 2021 17:07:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PH7bru086714; Sat, 25 Sep 2021 17:07:37 GMT (envelope-from git) Date: Sat, 25 Sep 2021 17:07:37 GMT Message-Id: <202109251707.18PH7bru086714@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: b70b050ab5e9 - main - bhyve: Update the -G description in the SYNPOSIS. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b70b050ab5e9368e6748e78cee38c3ecc4662c87 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 17:07:37 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b70b050ab5e9368e6748e78cee38c3ecc4662c87 commit b70b050ab5e9368e6748e78cee38c3ecc4662c87 Author: John Baldwin AuthorDate: 2021-09-25 17:01:43 +0000 Commit: John Baldwin CommitDate: 2021-09-25 17:01:43 +0000 bhyve: Update the -G description in the SYNPOSIS. It was missing both the 'w' flag and 'bind_address'. --- usr.sbin/bhyve/bhyve.8 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index 8ebb8aea6210..09bba05a4f7a 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -45,7 +45,13 @@ .Op Cm ,threads= Ar n .Oc .Sm on -.Op Fl G Ar port +.Oo Fl G +.Sm off +.Oo Ar w Oc +.Oo Ar bind_address: Oc +.Ar port +.Sm on +.Oc .Op Fl k Ar file .Oo Fl l .Sm off From owner-dev-commits-src-all@freebsd.org Sat Sep 25 17:07:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD2676ACBF4; Sat, 25 Sep 2021 17:07: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 4HGwLy4v5Jz4s80; Sat, 25 Sep 2021 17:07: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 8917A5FF2; Sat, 25 Sep 2021 17:07: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 18PH7cAB086739; Sat, 25 Sep 2021 17:07:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PH7ck1086738; Sat, 25 Sep 2021 17:07:38 GMT (envelope-from git) Date: Sat, 25 Sep 2021 17:07:38 GMT Message-Id: <202109251707.18PH7ck1086738@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 48759c4ed7f2 - main - bhyve_config.5: Document gdb.address. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 48759c4ed7f258baccd791c603baf22c8ddb1bb4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 17:07:39 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=48759c4ed7f258baccd791c603baf22c8ddb1bb4 commit 48759c4ed7f258baccd791c603baf22c8ddb1bb4 Author: John Baldwin AuthorDate: 2021-09-25 17:07:18 +0000 Commit: John Baldwin CommitDate: 2021-09-25 17:07:18 +0000 bhyve_config.5: Document gdb.address. --- usr.sbin/bhyve/bhyve_config.5 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/bhyve_config.5 b/usr.sbin/bhyve/bhyve_config.5 index 25bd818d6148..941fc447535c 100644 --- a/usr.sbin/bhyve/bhyve_config.5 +++ b/usr.sbin/bhyve/bhyve_config.5 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 17, 2021 +.Dd September 25, 2021 .Dt BHYVE_CONFIG 5 .Os .Sh NAME @@ -124,6 +124,8 @@ Wire guest memory. Generate ACPI tables. .It Va destroy_on_poweroff Ta bool Ta false Ta Destroy the VM on guest-initiated power-off. +.It Va gdb.address Ta string Ta localhost Ta +Hostname, IP address, or IPv6 address for the debug server. .It Va gdb.port Ta integer Ta 0 Ta TCP port number for the debug server. If this is set to a non-zero value, a debug server From owner-dev-commits-src-all@freebsd.org Sat Sep 25 17:20:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 81A646ACF21; Sat, 25 Sep 2021 17:20:21 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGwdd2rqCz4srj; Sat, 25 Sep 2021 17:20:21 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-qt1-x836.google.com with SMTP id r1so12583210qta.12; Sat, 25 Sep 2021 10:20:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=vo4nL/uHZ67pRqjWuFleC8cgwln/rApcTx2ERfpHp+U=; b=Gn13z4e2L/qUKOVqYQVdNoBSlv9kizJx6F0bsPZwq/DLPM4i/MCUjt2Wk7fhJVI81n pWvVAaZHxye3uHP3Nu2IaLA6YCoVQ7vSQr6396XQ1b4YC21piF5tSVYIqY1V2ZB1ahdZ prS/wghw1R0EMwIH5dn3Gc4Vs4tFYtKG2/bdRLSF/Hf2Mg1rXV4pZXGW37LSdlGsvgUQ 9VfFwldbm8Q4A5DaoUG1wXu//srQ4KCwveRBSEheR5AvbKHwl0/gKUO1IimJo9Rdoh6t goFz1XSVm47GVZMAb1/3kDJcuH+fBik2y/joPTL6zuT3vfTfHxay2EEu243hsFq35TzL Vlyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=vo4nL/uHZ67pRqjWuFleC8cgwln/rApcTx2ERfpHp+U=; b=S1+pAaBz9Lj10+d5zzJA6dKixfONJ6IjtDAQjyRqFE4x1R7SUyLvJtFYTuFSfWGp/s CSwA/cXnqrn5vAyfZ3ZacYN9qhv9NAdkopC8QelEZijQ+hYQuqQFgCxPX0Qh9oNjv2+v XXuaJIO3dcPZgN/AujR07zJ4aUtpUIDZndnGpWHZazK0sAMCrfAEqyhndBDlLEDJe68L i9nbQ1YgYyedcJhyuU8mprpaalWIOqBqaICa+idRGotLuLgj66RY0Nfx/5Uvhw7Gay1Z WMV1c6u6MnbzyBVmz1GFRQk1H9EO+TlhJHB62ovcebFm7FRL1Xs8Hh0VWoAhMOj7E5h6 t5jw== X-Gm-Message-State: AOAM532yBU4SWLZAhOFbEw3+nQtbQEoptYqc20sw5QkgvEx8amGqUpEd u2wJoLlndQFrp9Fl9SAteFwlCHSMsUU= X-Google-Smtp-Source: ABdhPJz/6CUo7LWqUKIBKIgtftBIm+4P51bDZ92lxHHMztH75cHwDuy+jLKOjMhhXvGO8fEva5FlPQ== X-Received: by 2002:ac8:615a:: with SMTP id d26mr10514807qtm.318.1632590419874; Sat, 25 Sep 2021 10:20:19 -0700 (PDT) Received: from spectre.mavhome.dp.ua (104-55-12-234.lightspeed.knvltn.sbcglobal.net. [104.55.12.234]) by smtp.gmail.com with ESMTPSA id n20sm8947174qkk.135.2021.09.25.10.20.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Sep 2021 10:20:19 -0700 (PDT) Sender: Alexander Motin Subject: Re: git: c8077ccd70cf - main - acpi_cpu: Make device unit numbers match OS CPU IDs. To: John Baldwin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202109250124.18P1OOP5035829@gitrepo.freebsd.org> <5d4a3f4f-0249-01b6-37ef-9a3dd9a8d7ad@FreeBSD.org> From: Alexander Motin Message-ID: Date: Sat, 25 Sep 2021 13:20:18 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <5d4a3f4f-0249-01b6-37ef-9a3dd9a8d7ad@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4HGwdd2rqCz4srj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 17:20:21 -0000 On 25.09.2021 12:30, John Baldwin wrote: > On 9/24/21 6:24 PM, Alexander Motin wrote: >> The branch main has been updated by mav: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=c8077ccd70cfcbcccb752e89b848f098abcb9309 >> >> >> commit c8077ccd70cfcbcccb752e89b848f098abcb9309 >> Author:     Alexander Motin >> AuthorDate: 2021-09-25 01:03:02 +0000 >> Commit:     Alexander Motin >> CommitDate: 2021-09-25 01:24:19 +0000 >> >>      acpi_cpu: Make device unit numbers match OS CPU IDs. >>           There are already APIC ID, ACPI ID and OS ID for each CPU.  >> In perfect >>      world all of those may match, but at least for SuperMicro server >> boards >>      none of them do.  Plus none of them match the CPU devices listing >> order >>      by ACPI.  Previous code used the ACPI device listing order to number >>      cpuX devices.  It looked nice from NewBus perspective, but >> introduced >>      4th different set of IDs. Extremely confusing one, since in some >> places >>      the device unit numbers were treated as OS CPU IDs (coretemp), >> but not >>      in others (sysctl dev.cpu.X.%location). > > FWIW, the "normal" way to force specific device unit numbers is via > bus_hint_device_unit, but perhaps that is specific to when hints > exits whereas this is specific to a bus property.  Perhaps though this > can't have the unit number assigned by the bus at the BUS_ADD_CHILD > call?  That would be the other way to handle this perhaps vs trying to > change the unit in the probe routine. Doing it in any of proposed ways would require bus to know about the device specifics much more than it should. I've found it better done this way. Setting device unit number by the driver during the probe is not much worse than setting description, and definitely much better than during attach as done by xen/blkfront, which should probably be changed to probe way too. -- Alexander Motin From owner-dev-commits-src-all@freebsd.org Sat Sep 25 18:14:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B65FC6ADC30; Sat, 25 Sep 2021 18:14: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 4HGxr54mKZz3CW4; Sat, 25 Sep 2021 18:14: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 7900B71C0; Sat, 25 Sep 2021 18:14: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 18PIETkN079831; Sat, 25 Sep 2021 18:14:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PIETna079830; Sat, 25 Sep 2021 18:14:29 GMT (envelope-from git) Date: Sat, 25 Sep 2021 18:14:29 GMT Message-Id: <202109251814.18PIETna079830@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 9352de39c3dc - stable/13 - vt: bound buffer access in redraw optimization MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9352de39c3dcc94f2745f939e52388a8e1cc1c05 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 18:14:29 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=9352de39c3dcc94f2745f939e52388a8e1cc1c05 commit 9352de39c3dcc94f2745f939e52388a8e1cc1c05 Author: Ed Maste AuthorDate: 2021-09-22 18:41:00 +0000 Commit: Ed Maste CommitDate: 2021-09-25 18:14:12 +0000 vt: bound buffer access in redraw optimization PR: 248628 Reported by: oleg Reviewed by: cem, oleg (both earlier) Fixes: ee97b2336aa4 ("Speed up vt(4) by keeping...") MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32059 (cherry picked from commit dbc7ca59451561a179f9852642e13ef024169d84) --- sys/dev/vt/hw/fb/vt_fb.c | 6 ++++++ sys/dev/vt/hw/vga/vt_vga.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/sys/dev/vt/hw/fb/vt_fb.c b/sys/dev/vt/hw/fb/vt_fb.c index 01850f789d29..c535d1b753c9 100644 --- a/sys/dev/vt/hw/fb/vt_fb.c +++ b/sys/dev/vt/hw/fb/vt_fb.c @@ -355,6 +355,9 @@ vt_fb_bitblt_text(struct vt_device *vd, const struct vt_window *vw, VTBUF_ISCURSOR(&vw->vw_buf, row, col), &fg, &bg); z = row * PIXEL_WIDTH(VT_FB_MAX_WIDTH) + col; + if (z >= PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * + PIXEL_WIDTH(VT_FB_MAX_WIDTH)) + continue; if (vd->vd_drawn && (vd->vd_drawn[z] == c) && vd->vd_drawnfg && (vd->vd_drawnfg[z] == fg) && vd->vd_drawnbg && (vd->vd_drawnbg[z] == bg)) @@ -405,6 +408,9 @@ vt_fb_invalidate_text(struct vt_device *vd, const term_rect_t *area) for (col = area->tr_begin.tp_col; col < area->tr_end.tp_col; ++col) { z = row * PIXEL_WIDTH(VT_FB_MAX_WIDTH) + col; + if (z >= PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * + PIXEL_WIDTH(VT_FB_MAX_WIDTH)) + continue; if (vd->vd_drawn) vd->vd_drawn[z] = 0; if (vd->vd_drawnfg) diff --git a/sys/dev/vt/hw/vga/vt_vga.c b/sys/dev/vt/hw/vga/vt_vga.c index 88a9b1c47338..563867399e53 100644 --- a/sys/dev/vt/hw/vga/vt_vga.c +++ b/sys/dev/vt/hw/vga/vt_vga.c @@ -888,6 +888,9 @@ vga_bitblt_text_txtmode(struct vt_device *vd, const struct vt_window *vw, &fg, &bg); z = row * PIXEL_WIDTH(VT_FB_MAX_WIDTH) + col; + if (z >= PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * + PIXEL_WIDTH(VT_FB_MAX_WIDTH)) + continue; if (vd->vd_drawn && (vd->vd_drawn[z] == c) && vd->vd_drawnfg && (vd->vd_drawnfg[z] == fg) && vd->vd_drawnbg && (vd->vd_drawnbg[z] == bg)) @@ -941,6 +944,9 @@ vga_invalidate_text(struct vt_device *vd, const term_rect_t *area) col < area->tr_end.tp_col; ++col) { z = row * PIXEL_WIDTH(VT_FB_MAX_WIDTH) + col; + if (z >= PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * + PIXEL_WIDTH(VT_FB_MAX_WIDTH)) + continue; if (vd->vd_drawn) vd->vd_drawn[z] = 0; if (vd->vd_drawnfg) From owner-dev-commits-src-all@freebsd.org Sat Sep 25 18:14:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CEBE86ADDB0; Sat, 25 Sep 2021 18:14: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 4HGxrM33dTz3CTX; Sat, 25 Sep 2021 18:14: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 3F8AA721D; Sat, 25 Sep 2021 18:14: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 18PIEhfu079970; Sat, 25 Sep 2021 18:14:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PIEhol079969; Sat, 25 Sep 2021 18:14:43 GMT (envelope-from git) Date: Sat, 25 Sep 2021 18:14:43 GMT Message-Id: <202109251814.18PIEhol079969@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: e4fcff8ee124 - stable/12 - vt: bound buffer access in redraw optimization MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e4fcff8ee124f8faed2f1fcc1e15b7ae6906d4d7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 18:14:43 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=e4fcff8ee124f8faed2f1fcc1e15b7ae6906d4d7 commit e4fcff8ee124f8faed2f1fcc1e15b7ae6906d4d7 Author: Ed Maste AuthorDate: 2021-09-22 18:41:00 +0000 Commit: Ed Maste CommitDate: 2021-09-25 16:32:06 +0000 vt: bound buffer access in redraw optimization PR: 248628 Reported by: oleg Reviewed by: cem, oleg (both earlier) Fixes: ee97b2336aa4 ("Speed up vt(4) by keeping...") MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32059 (cherry picked from commit dbc7ca59451561a179f9852642e13ef024169d84) --- sys/dev/vt/hw/fb/vt_fb.c | 6 ++++++ sys/dev/vt/hw/vga/vt_vga.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/sys/dev/vt/hw/fb/vt_fb.c b/sys/dev/vt/hw/fb/vt_fb.c index 62a52dd9e017..5c14be1c15ba 100644 --- a/sys/dev/vt/hw/fb/vt_fb.c +++ b/sys/dev/vt/hw/fb/vt_fb.c @@ -354,6 +354,9 @@ vt_fb_bitblt_text(struct vt_device *vd, const struct vt_window *vw, VTBUF_ISCURSOR(&vw->vw_buf, row, col), &fg, &bg); z = row * PIXEL_WIDTH(VT_FB_MAX_WIDTH) + col; + if (z >= PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * + PIXEL_WIDTH(VT_FB_MAX_WIDTH)) + continue; if (vd->vd_drawn && (vd->vd_drawn[z] == c) && vd->vd_drawnfg && (vd->vd_drawnfg[z] == fg) && vd->vd_drawnbg && (vd->vd_drawnbg[z] == bg)) @@ -404,6 +407,9 @@ vt_fb_invalidate_text(struct vt_device *vd, const term_rect_t *area) for (col = area->tr_begin.tp_col; col < area->tr_end.tp_col; ++col) { z = row * PIXEL_WIDTH(VT_FB_MAX_WIDTH) + col; + if (z >= PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * + PIXEL_WIDTH(VT_FB_MAX_WIDTH)) + continue; if (vd->vd_drawn) vd->vd_drawn[z] = 0; if (vd->vd_drawnfg) diff --git a/sys/dev/vt/hw/vga/vt_vga.c b/sys/dev/vt/hw/vga/vt_vga.c index 88a9b1c47338..563867399e53 100644 --- a/sys/dev/vt/hw/vga/vt_vga.c +++ b/sys/dev/vt/hw/vga/vt_vga.c @@ -888,6 +888,9 @@ vga_bitblt_text_txtmode(struct vt_device *vd, const struct vt_window *vw, &fg, &bg); z = row * PIXEL_WIDTH(VT_FB_MAX_WIDTH) + col; + if (z >= PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * + PIXEL_WIDTH(VT_FB_MAX_WIDTH)) + continue; if (vd->vd_drawn && (vd->vd_drawn[z] == c) && vd->vd_drawnfg && (vd->vd_drawnfg[z] == fg) && vd->vd_drawnbg && (vd->vd_drawnbg[z] == bg)) @@ -941,6 +944,9 @@ vga_invalidate_text(struct vt_device *vd, const term_rect_t *area) col < area->tr_end.tp_col; ++col) { z = row * PIXEL_WIDTH(VT_FB_MAX_WIDTH) + col; + if (z >= PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * + PIXEL_WIDTH(VT_FB_MAX_WIDTH)) + continue; if (vd->vd_drawn) vd->vd_drawn[z] = 0; if (vd->vd_drawnfg) From owner-dev-commits-src-all@freebsd.org Sat Sep 25 18:30:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B10D26AE04D; Sat, 25 Sep 2021 18:30: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 4HGyBg4drjz3Fcc; Sat, 25 Sep 2021 18:30: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 8034B7236; Sat, 25 Sep 2021 18:30: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 18PIUZOu001755; Sat, 25 Sep 2021 18:30:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PIUZpF001739; Sat, 25 Sep 2021 18:30:35 GMT (envelope-from git) Date: Sat, 25 Sep 2021 18:30:35 GMT Message-Id: <202109251830.18PIUZpF001739@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: e72c7e2738ca - main - kernel: Disable errors for -Walloca-larger-than for GCC. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e72c7e2738ca9f5893ba5e5e9dc120dfc82fabfd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 18:30:35 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e72c7e2738ca9f5893ba5e5e9dc120dfc82fabfd commit e72c7e2738ca9f5893ba5e5e9dc120dfc82fabfd Author: John Baldwin AuthorDate: 2021-09-25 18:24:35 +0000 Commit: John Baldwin CommitDate: 2021-09-25 18:24:35 +0000 kernel: Disable errors for -Walloca-larger-than for GCC. GCC complains about the use of alloca() with variable sizes (for XSAVE state len) in sendsig() for i386. Modern XSAVE state is probably getting a bit large for the i386 kstack, but downgrade the error to a warning. Reviewed by: kib, emaste Differential Revision: https://reviews.freebsd.org/D31934 --- sys/conf/kern.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index f6767ba76a46..859719db0083 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -69,7 +69,8 @@ CWARNEXTRA+= -Wno-error=memset-elt-size CWARNEXTRA+= -Wno-error=packed-not-aligned .endif .if ${COMPILER_VERSION} >= 90100 -CWARNEXTRA+= -Wno-address-of-packed-member +CWARNEXTRA+= -Wno-address-of-packed-member \ + -Wno-error=alloca-larger-than= .endif .endif # gcc From owner-dev-commits-src-all@freebsd.org Sat Sep 25 18:30:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0A076ADC66; Sat, 25 Sep 2021 18:30: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 4HGyBh5TDYz3FTm; Sat, 25 Sep 2021 18:30: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 9AA757320; Sat, 25 Sep 2021 18:30: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 18PIUaY8002362; Sat, 25 Sep 2021 18:30:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PIUafd002361; Sat, 25 Sep 2021 18:30:36 GMT (envelope-from git) Date: Sat, 25 Sep 2021 18:30:36 GMT Message-Id: <202109251830.18PIUafd002361@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 7ecdfc823798 - main - bhyve: Add an empty case for event types in mevent_kq_fflags(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7ecdfc823798a8f7add245651b26d9d900bc9889 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 18:30:36 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7ecdfc823798a8f7add245651b26d9d900bc9889 commit 7ecdfc823798a8f7add245651b26d9d900bc9889 Author: John Baldwin AuthorDate: 2021-09-25 18:25:25 +0000 Commit: John Baldwin CommitDate: 2021-09-25 18:25:25 +0000 bhyve: Add an empty case for event types in mevent_kq_fflags(). This fixes a -Wswitch error raised by GCC 9. Differential Revision: https://reviews.freebsd.org/D31938 --- usr.sbin/bhyve/mevent.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr.sbin/bhyve/mevent.c b/usr.sbin/bhyve/mevent.c index 0c5351cd31a9..eb84dc15ad47 100644 --- a/usr.sbin/bhyve/mevent.c +++ b/usr.sbin/bhyve/mevent.c @@ -190,6 +190,11 @@ mevent_kq_fflags(struct mevent *mevp) if ((mevp->me_fflags & EVFF_ATTRIB) != 0) retval |= NOTE_ATTRIB; break; + case EVF_READ: + case EVF_WRITE: + case EVF_TIMER: + case EVF_SIGNAL: + break; } return (retval); From owner-dev-commits-src-all@freebsd.org Sat Sep 25 18:30:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 192F36AE2D8; Sat, 25 Sep 2021 18:30: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 4HGyBj7042z3FX1; Sat, 25 Sep 2021 18:30: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 C208D7590; Sat, 25 Sep 2021 18:30: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 18PIUbOb002388; Sat, 25 Sep 2021 18:30:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PIUbSJ002387; Sat, 25 Sep 2021 18:30:37 GMT (envelope-from git) Date: Sat, 25 Sep 2021 18:30:37 GMT Message-Id: <202109251830.18PIUbSJ002387@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 0def501d143a - main - mana: Cast an unused value to void to quiet a warning. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0def501d143a84714eed0a431d35c43d30546802 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 18:30:38 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0def501d143a84714eed0a431d35c43d30546802 commit 0def501d143a84714eed0a431d35c43d30546802 Author: John Baldwin AuthorDate: 2021-09-25 18:28:14 +0000 Commit: John Baldwin CommitDate: 2021-09-25 18:28:14 +0000 mana: Cast an unused value to void to quiet a warning. This appeases a -Wunused-value warning from GCC 9. Reviewed by: whu Differential Revision: https://reviews.freebsd.org/D31948 --- sys/dev/mana/mana_en.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mana/mana_en.c b/sys/dev/mana/mana_en.c index ffeee336f694..5b680f146476 100644 --- a/sys/dev/mana/mana_en.c +++ b/sys/dev/mana/mana_en.c @@ -576,7 +576,7 @@ mana_xmit(struct mana_txq *txq) next_to_use = (next_to_use + 1) % MAX_SEND_BUFFERS_PER_QUEUE; - atomic_inc_return(&txq->pending_sends); + (void)atomic_inc_return(&txq->pending_sends); drbr_advance(ndev, txq->txq_br); From owner-dev-commits-src-all@freebsd.org Sat Sep 25 18:52:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D39FD6AE4CA; Sat, 25 Sep 2021 18:52:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGygq5d4Kz3HyM; Sat, 25 Sep 2021 18:52:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D33B7AA5; Sat, 25 Sep 2021 18:52:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18PIqN5i032120; Sat, 25 Sep 2021 18:52:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PIqN8T032119; Sat, 25 Sep 2021 18:52:23 GMT (envelope-from git) Date: Sat, 25 Sep 2021 18:52:23 GMT Message-Id: <202109251852.18PIqN8T032119@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 9d324b5ffc8a - main - mount: Don't pass a NULL format string to xo_err(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9d324b5ffc8a783ceff2a78dea19602a1d8f045a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 18:52:23 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=9d324b5ffc8a783ceff2a78dea19602a1d8f045a commit 9d324b5ffc8a783ceff2a78dea19602a1d8f045a Author: John Baldwin AuthorDate: 2021-09-25 18:51:01 +0000 Commit: John Baldwin CommitDate: 2021-09-25 18:52:10 +0000 mount: Don't pass a NULL format string to xo_err(). This fixes a -Wformat error from GCC 9. Fixes: e725ee7eb672 mount: add libxo(3) support --- sbin/mount/mount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index 02242791a7a2..80eda100c66f 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -192,7 +192,7 @@ specified_ro(const char *arg) optbuf = strdup(arg); if (optbuf == NULL) - xo_err(1, NULL); + xo_err(1, "strdup failed"); for (opt = optbuf; (opt = strtok(opt, ",")) != NULL; opt = NULL) { if (strcmp(opt, "ro") == 0) { From owner-dev-commits-src-all@freebsd.org Sat Sep 25 18:57:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 32B146AE8FA; Sat, 25 Sep 2021 18:57:42 +0000 (UTC) (envelope-from pstef@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGyny0lQhz3JDb; Sat, 25 Sep 2021 18:57:42 +0000 (UTC) (envelope-from pstef@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1632596262; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WDUPXzq6gAzaHJLDWxdRIleDO65+fk3noBX1mSTSX0E=; b=ITHAco1QmV7T7+PQSMVc9uVp8NOwwvHbSpbdYSS1A27RRR57VpNB2IN3ok+IdCxXqyLiZF cNIRm2L8lyf9X0WFlcU3EZRDAMRtmrFSwRfY6hOBw852ZdLBCOM2Hdhopk8yAK1QeFlUqH WAtesnige8AwLqtSKZ8jF/8y61xqc/Kn+b3Ym6zvKS6DwI8lJgM2n+zKMdPrabU05yw1lK ZrXdYUveFNZFZEiT1tOvmviW76q0uFj6kdbw8klI/OALjHbbxLMrDJR5/0RV191YIHp3ZW 8xABCC4nJeno+XW+pES3QA+h3jyAxbOZQK1G9h+9iPtSme32pDRKu4MZMWfWAA== Received: by freefall.freebsd.org (Postfix, from userid 1403) id F3E761F9E3; Sat, 25 Sep 2021 18:57:41 +0000 (UTC) Date: Sat, 25 Sep 2021 18:57:41 +0000 From: "Piotr P. Stefaniak" To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 9d324b5ffc8a - main - mount: Don't pass a NULL format string to xo_err(). Message-ID: References: <202109251852.18PIqN8T032119@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <202109251852.18PIqN8T032119@gitrepo.freebsd.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1632596262; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WDUPXzq6gAzaHJLDWxdRIleDO65+fk3noBX1mSTSX0E=; b=eQiSzUg87Oh84aEAO11pkn/h+by0y+ozia53zzBdU/U5a/9qVh+l46VKv00YoShk1/GGna S3TRyXgq04WuO6Hz3cgYxnlZ4RKUQBxzMUC6N5eUivI+u5fmWU6VwTxMM7FPVbAzDMtEf1 gxNCbwU8WDPi3hqd3VBekilcD6cwwjoXg2GYePfycKKX8l4ZvZmjY7MA9NVy/eLVjRjEjs Gdl6jwxSWtYWU2YAq+iWCVdeduMmin9Ucq64H+8afREEmV0c3A2kwyIFHhvdSdOj7nOxBW L1sqk/4rUEsgs9V7vCY0WtFdSlrRbbID0js3c/ds2tCTb87gYc1ynRsX/8/uqQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1632596262; a=rsa-sha256; cv=none; b=dca/iKsk6L5kkulAx7MF2acc5VeFkWNZhHXB1u+JzV1fJoEFh5mxvplGi/e8SqIONitgHF 0Aup2l7UTKd+6AGrHfYp6e4oySeq/4p3n9carwzlhJVbZJsO/diBX6Wv+BsEguucXrMelN QhcyLN7iQoRF/Kwrq7rkncgNYD/limqk5OSxyZFSy2GsIqtcym+XiOrfhSS/TJmUcYobE1 HtClFJl0EXd9z29vgSZWPV6me8w5MTZP2PxUv5aFqLhXqUBDKplsAB6662VciABwV1aPFx twx+nqJQv0Qq9aUABoaSiX6HS3D+Vd6rXXRokDqJothLj3pjavQ81qkl4MWVew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 18:57:42 -0000 On 2021-09-25 18:52:23, John Baldwin wrote: >The branch main has been updated by jhb: > >URL: https://cgit.FreeBSD.org/src/commit/?id=9d324b5ffc8a783ceff2a78dea19602a1d8f045a > >commit 9d324b5ffc8a783ceff2a78dea19602a1d8f045a >Author: John Baldwin >AuthorDate: 2021-09-25 18:51:01 +0000 >Commit: John Baldwin >CommitDate: 2021-09-25 18:52:10 +0000 > > mount: Don't pass a NULL format string to xo_err(). > > This fixes a -Wformat error from GCC 9. > > Fixes: e725ee7eb672 mount: add libxo(3) support Sorry, I missed that. Thanks for fixing it! Piotr From owner-dev-commits-src-all@freebsd.org Sat Sep 25 19:10:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 062C36AEAA7; Sat, 25 Sep 2021 19:10: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 4HGz4f5GwBz3JXr; Sat, 25 Sep 2021 19:10: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 965B27C33; Sat, 25 Sep 2021 19:10: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 18PJAQG5055364; Sat, 25 Sep 2021 19:10:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PJAQLK055363; Sat, 25 Sep 2021 19:10:26 GMT (envelope-from git) Date: Sat, 25 Sep 2021 19:10:26 GMT Message-Id: <202109251910.18PJAQLK055363@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 19e4f2f289fb - main - efi loader: Call tslog_init from efi_main MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 19e4f2f289fb8d2b14576a65ca9e6f931dbb6a02 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 19:10:27 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=19e4f2f289fb8d2b14576a65ca9e6f931dbb6a02 commit 19e4f2f289fb8d2b14576a65ca9e6f931dbb6a02 Author: Colin Percival AuthorDate: 2021-09-25 19:04:06 +0000 Commit: Colin Percival CommitDate: 2021-09-25 19:06:07 +0000 efi loader: Call tslog_init from efi_main We were calling tslog_init from main; no reason to wait that long. Fixes: f49381ccb6bc efi/loader: Call tslog_init Sponsored by: https://www.patreon.com/cperciva --- stand/efi/loader/efi_main.c | 4 ++++ stand/efi/loader/main.c | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/stand/efi/loader/efi_main.c b/stand/efi/loader/efi_main.c index fa3c765c36ab..736c1aa56c99 100644 --- a/stand/efi/loader/efi_main.c +++ b/stand/efi/loader/efi_main.c @@ -27,6 +27,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -101,6 +102,9 @@ efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table) setheap((void *)(uintptr_t)heap, (void *)(uintptr_t)(heap + heapsize)); + /* Start tslog now that we have a heap.*/ + tslog_init(); + /* Use efi_exit() from here on... */ status = OpenProtocolByHandle(IH, &image_protocol, (void**)&img); diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index b687255181e3..d8b3b1d19b15 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -924,8 +924,6 @@ main(int argc, CHAR16 *argv[]) char buf[32]; bool uefi_boot_mgr; - tslog_init(); - archsw.arch_autoload = efi_autoload; archsw.arch_getdev = efi_getdev; archsw.arch_copyin = efi_copyin; From owner-dev-commits-src-all@freebsd.org Sat Sep 25 20:44:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 641AE668706; Sat, 25 Sep 2021 20:44: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 4HH18v28Ppz3R6P; Sat, 25 Sep 2021 20:44: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 2935C11496; Sat, 25 Sep 2021 20:44: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 18PKiFBu080641; Sat, 25 Sep 2021 20:44:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PKiF9A080640; Sat, 25 Sep 2021 20:44:15 GMT (envelope-from git) Date: Sat, 25 Sep 2021 20:44:15 GMT Message-Id: <202109252044.18PKiF9A080640@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: f3410f8798fe - stable/13 - nfsd: Use the COPY_FILE_RANGE_TIMEO1SEC flag 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: f3410f8798fe7c8ccb30a3baa303506d49726270 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 20:44:15 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=f3410f8798fe7c8ccb30a3baa303506d49726270 commit f3410f8798fe7c8ccb30a3baa303506d49726270 Author: Rick Macklem AuthorDate: 2021-09-08 21:29:20 +0000 Commit: Rick Macklem CommitDate: 2021-09-25 20:40:53 +0000 nfsd: Use the COPY_FILE_RANGE_TIMEO1SEC flag Although it is not specified in the RFCs, the concept that the NFSv4 server should reply to an RPC request within a reasonable time is accepted practice within the NFSv4 community. Without this patch, the NFSv4.2 server attempts to reply to a Copy operation within 1 second by limiting the copy to vfs.nfs.maxcopyrange bytes (default 10Mbytes). This is crude at best, given the large variation in I/O subsystem performance. This patch uses the COPY_FILE_RANGE_TIMEO1SEC flag added by commit c5128c48df3c to limit the reply time for a Copy operation to approximately 1 second. (cherry picked from commit 103b207536f976cb350558769f5f428e05ec61dc) --- sys/fs/nfsserver/nfs_nfsdserv.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index 12181d04f1fa..9bfa6dd3a99b 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -65,7 +65,6 @@ extern int nfsd_debuglevel; extern u_long sb_max_adj; extern int nfsrv_pnfsatime; extern int nfsrv_maxpnfsmirror; -extern int nfs_maxcopyrange; extern uint32_t nfs_srvmaxio; static int nfs_async = 0; @@ -5401,7 +5400,6 @@ nfsrvd_copy_file_range(struct nfsrv_descript *nd, __unused int isdgram, int cnt, error = 0, ret; off_t inoff, outoff; uint64_t len; - size_t xfer; struct nfsstate inst, outst, *instp = &inst, *outstp = &outst; struct nfslock inlo, outlo, *inlop = &inlo, *outlop = &outlo; nfsquad_t clientid; @@ -5576,21 +5574,10 @@ nfsrvd_copy_file_range(struct nfsrv_descript *nd, __unused int isdgram, nd->nd_repstat = error; } - /* - * Do the actual copy to an upper limit of vfs.nfs.maxcopyrange. - * This limit is applied to ensure that the RPC replies in a - * reasonable time. - */ - if (len > nfs_maxcopyrange) - xfer = nfs_maxcopyrange; - else - xfer = len; - if (nd->nd_repstat == 0) { + if (nd->nd_repstat == 0) nd->nd_repstat = vn_copy_file_range(vp, &inoff, tovp, &outoff, - &xfer, 0, nd->nd_cred, nd->nd_cred, NULL); - if (nd->nd_repstat == 0) - len = xfer; - } + &len, COPY_FILE_RANGE_TIMEO1SEC, nd->nd_cred, nd->nd_cred, + NULL); /* Unlock the ranges. */ if (rl_rcookie != NULL) From owner-dev-commits-src-all@freebsd.org Sat Sep 25 20:45:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69EAE66866A; Sat, 25 Sep 2021 20:45: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 4HH1BZ2NbLz3R0t; Sat, 25 Sep 2021 20:45: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 326CA11497; Sat, 25 Sep 2021 20:45: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 18PKjguB080854; Sat, 25 Sep 2021 20:45:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PKjgZ2080853; Sat, 25 Sep 2021 20:45:42 GMT (envelope-from git) Date: Sat, 25 Sep 2021 20:45:42 GMT Message-Id: <202109252045.18PKjgZ2080853@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: f72cdea25c29 - stable/13 - nfsd: Fix build after commit 103b207536f9 for 32bit arches 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: f72cdea25c291a88d1793e88202a847e7a62f74b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 20:45:42 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=f72cdea25c291a88d1793e88202a847e7a62f74b commit f72cdea25c291a88d1793e88202a847e7a62f74b Author: Rick Macklem AuthorDate: 2021-09-09 01:55:06 +0000 Commit: Rick Macklem CommitDate: 2021-09-25 20:42:26 +0000 nfsd: Fix build after commit 103b207536f9 for 32bit arches (cherry picked from commit f1c8811d2d250aac5a59bb2109d905139c119925) --- sys/fs/nfsserver/nfs_nfsdserv.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index 9bfa6dd3a99b..33af169f4e98 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -5400,6 +5400,7 @@ nfsrvd_copy_file_range(struct nfsrv_descript *nd, __unused int isdgram, int cnt, error = 0, ret; off_t inoff, outoff; uint64_t len; + size_t xfer; struct nfsstate inst, outst, *instp = &inst, *outstp = &outst; struct nfslock inlo, outlo, *inlop = &inlo, *outlop = &outlo; nfsquad_t clientid; @@ -5574,10 +5575,14 @@ nfsrvd_copy_file_range(struct nfsrv_descript *nd, __unused int isdgram, nd->nd_repstat = error; } - if (nd->nd_repstat == 0) + xfer = len; + if (nd->nd_repstat == 0) { nd->nd_repstat = vn_copy_file_range(vp, &inoff, tovp, &outoff, - &len, COPY_FILE_RANGE_TIMEO1SEC, nd->nd_cred, nd->nd_cred, + &xfer, COPY_FILE_RANGE_TIMEO1SEC, nd->nd_cred, nd->nd_cred, NULL); + if (nd->nd_repstat == 0) + len = xfer; + } /* Unlock the ranges. */ if (rl_rcookie != NULL) From owner-dev-commits-src-all@freebsd.org Sat Sep 25 21:01:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DEFB1668A91; Sat, 25 Sep 2021 21:01: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 4HH1Xr5rx9z3j07; Sat, 25 Sep 2021 21:01: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 A92291164B; Sat, 25 Sep 2021 21:01: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 18PL1WW7003366; Sat, 25 Sep 2021 21:01:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PL1W4I003365; Sat, 25 Sep 2021 21:01:32 GMT (envelope-from git) Date: Sat, 25 Sep 2021 21:01:32 GMT Message-Id: <202109252101.18PL1W4I003365@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 695323ae88c7 - main - acpi_cpu: Fix panic if some CPU devices are disabled. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 695323ae88c71776e131940ed7dedd25365e932f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 21:01:32 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=695323ae88c71776e131940ed7dedd25365e932f commit 695323ae88c71776e131940ed7dedd25365e932f Author: Alexander Motin AuthorDate: 2021-09-25 20:54:28 +0000 Commit: Alexander Motin CommitDate: 2021-09-25 21:01:28 +0000 acpi_cpu: Fix panic if some CPU devices are disabled. While there, remove couple unneeded global variables. --- sys/dev/acpica/acpi_cpu.c | 66 +++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index ab4ffda7a02e..0577b6eac8b7 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -154,8 +154,6 @@ static struct sysctl_oid *cpu_sysctl_tree; static int cpu_cx_generic; static int cpu_cx_lowest_lim; -static device_t *cpu_devices; -static int cpu_ndevices; static struct acpi_cpu_softc **cpu_softc; ACPI_SERIAL_DECL(cpu, "ACPI CPU"); @@ -443,26 +441,21 @@ acpi_cpu_attach(device_t dev) static void acpi_cpu_postattach(void *unused __unused) { - device_t *devices; - int err; - int i, n; - int attached; - - err = devclass_get_devices(acpi_cpu_devclass, &devices, &n); - if (err != 0) { - printf("devclass_get_devices(acpi_cpu_devclass) failed\n"); - return; + struct acpi_cpu_softc *sc; + int attached = 0, i; + + mtx_lock(&Giant); + CPU_FOREACH(i) { + if ((sc = cpu_softc[i]) != NULL) + bus_generic_probe(sc->cpu_dev); + } + CPU_FOREACH(i) { + if ((sc = cpu_softc[i]) != NULL) { + bus_generic_attach(sc->cpu_dev); + attached = 1; + } } - attached = 0; - for (i = 0; i < n; i++) - if (device_is_attached(devices[i]) && - device_get_driver(devices[i]) == &acpi_cpu_driver) - attached = 1; - for (i = 0; i < n; i++) - bus_generic_probe(devices[i]); - for (i = 0; i < n; i++) - bus_generic_attach(devices[i]); - free(devices, M_TEMP); + mtx_unlock(&Giant); if (attached) { #ifdef EARLY_AP_STARTUP @@ -937,9 +930,6 @@ acpi_cpu_startup(void *arg) struct acpi_cpu_softc *sc; int i; - /* Get set of CPU devices */ - devclass_get_devices(acpi_cpu_devclass, &cpu_devices, &cpu_ndevices); - /* * Setup any quirks that might necessary now that we have probed * all the CPUs @@ -951,9 +941,9 @@ acpi_cpu_startup(void *arg) * We are using generic Cx mode, probe for available Cx states * for all processors. */ - for (i = 0; i < cpu_ndevices; i++) { - sc = device_get_softc(cpu_devices[i]); - acpi_cpu_generic_cx_probe(sc); + CPU_FOREACH(i) { + if ((sc = cpu_softc[i]) != NULL) + acpi_cpu_generic_cx_probe(sc); } } else { /* @@ -961,8 +951,9 @@ acpi_cpu_startup(void *arg) * As we now know for sure that we will be using _CST mode * install our notify handler. */ - for (i = 0; i < cpu_ndevices; i++) { - sc = device_get_softc(cpu_devices[i]); + CPU_FOREACH(i) { + if ((sc = cpu_softc[i]) == NULL) + continue; if (cpu_quirks & CPU_QUIRK_NO_C3) { sc->cpu_cx_count = min(sc->cpu_cx_count, sc->cpu_non_c3 + 1); } @@ -972,9 +963,9 @@ acpi_cpu_startup(void *arg) } /* Perform Cx final initialization. */ - for (i = 0; i < cpu_ndevices; i++) { - sc = device_get_softc(cpu_devices[i]); - acpi_cpu_startup_cx(sc); + CPU_FOREACH(i) { + if ((sc = cpu_softc[i]) != NULL) + acpi_cpu_startup_cx(sc); } /* Add a sysctl handler to handle global Cx lowest setting */ @@ -985,9 +976,9 @@ acpi_cpu_startup(void *arg) /* Take over idling from cpu_idle_default(). */ cpu_cx_lowest_lim = 0; - for (i = 0; i < cpu_ndevices; i++) { - sc = device_get_softc(cpu_devices[i]); - enable_idle(sc); + CPU_FOREACH(i) { + if ((sc = cpu_softc[i]) != NULL) + enable_idle(sc); } #if defined(__i386__) || defined(__amd64__) cpu_idle_hook = acpi_cpu_idle; @@ -1517,8 +1508,9 @@ acpi_cpu_global_cx_lowest_sysctl(SYSCTL_HANDLER_ARGS) /* Update the new lowest useable Cx state for all CPUs. */ ACPI_SERIAL_BEGIN(cpu); cpu_cx_lowest_lim = val - 1; - for (i = 0; i < cpu_ndevices; i++) { - sc = device_get_softc(cpu_devices[i]); + CPU_FOREACH(i) { + if ((sc = cpu_softc[i]) == NULL) + continue; sc->cpu_cx_lowest_lim = cpu_cx_lowest_lim; acpi_cpu_set_cx_lowest(sc); } From owner-dev-commits-src-all@freebsd.org Sat Sep 25 22:24:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47EB0669F11; Sat, 25 Sep 2021 22:24: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 4HH3P31YGNz3nYd; Sat, 25 Sep 2021 22:24: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 157A5128BC; Sat, 25 Sep 2021 22:24: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 18PMOsDM013677; Sat, 25 Sep 2021 22:24:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PMOsWn013676; Sat, 25 Sep 2021 22:24:54 GMT (envelope-from git) Date: Sat, 25 Sep 2021 22:24:54 GMT Message-Id: <202109252224.18PMOsWn013676@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: fb640be4e944 - main - 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/main X-Git-Reftype: branch X-Git-Commit: fb640be4e9443f1890680c27b213825300bc65f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 22:24:55 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=fb640be4e9443f1890680c27b213825300bc65f4 commit fb640be4e9443f1890680c27b213825300bc65f4 Author: Sean Bruno AuthorDate: 2021-09-25 22:23:08 +0000 Commit: Kevin Bowling CommitDate: 2021-09-25 22:24: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 --- sys/dev/uart/uart_bus_pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/uart/uart_bus_pci.c b/sys/dev/uart/uart_bus_pci.c index f7e9bd6ac401..92046261f544 100644 --- a/sys/dev/uart/uart_bus_pci.c +++ b/sys/dev/uart/uart_bus_pci.c @@ -170,6 +170,8 @@ static const struct pci_id pci_ns8250_ids[] = { { 0x8086, 0x8c3d, 0xffff, 0, "Intel Lynx Point KT Controller", 0x10 }, { 0x8086, 0x8cbd, 0xffff, 0, "Intel Wildcat Point KT Controller", 0x10 }, { 0x8086, 0x9c3d, 0xffff, 0, "Intel Lynx Point-LP HECI KT", 0x10 }, +{ 0x8086, 0xa13d, 0xffff, 0, + "100 Series/C230 Series Chipset Family KT Redirection", 0x10 }, { 0x9710, 0x9820, 0x1000, 1, "NetMos NM9820 Serial Port", 0x10 }, { 0x9710, 0x9835, 0x1000, 1, "NetMos NM9835 Serial Port", 0x10 }, { 0x9710, 0x9865, 0xa000, 0x1000, "NetMos NM9865 Serial Port", 0x10 }, From owner-dev-commits-src-all@freebsd.org Sun Sep 26 01:49:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8943766C47D; Sun, 26 Sep 2021 01:49:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HH7wz3DRTz4Y9v; Sun, 26 Sep 2021 01:49:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (unknown [IPv6:2601:648:8681:1cb0:e948:53aa:fce5:d12d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id C92CC20D2B; Sun, 26 Sep 2021 01:49:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 9d324b5ffc8a - main - mount: Don't pass a NULL format string to xo_err(). To: "Piotr P. Stefaniak" Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202109251852.18PIqN8T032119@gitrepo.freebsd.org> From: John Baldwin Message-ID: Date: Sat, 25 Sep 2021 18:49:21 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 01:49:23 -0000 On 9/25/21 11:57 AM, Piotr P. Stefaniak wrote: > On 2021-09-25 18:52:23, John Baldwin wrote: >> The branch main has been updated by jhb: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=9d324b5ffc8a783ceff2a78dea19602a1d8f045a >> >> commit 9d324b5ffc8a783ceff2a78dea19602a1d8f045a >> Author: John Baldwin >> AuthorDate: 2021-09-25 18:51:01 +0000 >> Commit: John Baldwin >> CommitDate: 2021-09-25 18:52:10 +0000 >> >> mount: Don't pass a NULL format string to xo_err(). >> >> This fixes a -Wformat error from GCC 9. >> >> Fixes: e725ee7eb672 mount: add libxo(3) support > > Sorry, I missed that. Thanks for fixing it! No worries. I'm not sure why clang's -Wformat doesn't catch this. -- John Baldwin From owner-dev-commits-src-all@freebsd.org Sun Sep 26 06:34:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A9C2672847; Sun, 26 Sep 2021 06:34:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HHGG00RXdz3CFM; Sun, 26 Sep 2021 06:34: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 E396019050; Sun, 26 Sep 2021 06:34:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18Q6YVj2063932; Sun, 26 Sep 2021 06:34:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18Q6YVUI063931; Sun, 26 Sep 2021 06:34:31 GMT (envelope-from git) Date: Sun, 26 Sep 2021 06:34:31 GMT Message-Id: <202109260634.18Q6YVUI063931@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: cb17f4a6bdaf - main - kern_ctf: Use zlib's uncompress function for simpler code. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cb17f4a6bdaf133bdc658b8ed92ad2c62eff8a18 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 06:34:32 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=cb17f4a6bdaf133bdc658b8ed92ad2c62eff8a18 commit cb17f4a6bdaf133bdc658b8ed92ad2c62eff8a18 Author: Yoshihiro Ota AuthorDate: 2021-09-26 06:28:43 +0000 Commit: Xin LI CommitDate: 2021-09-26 06:33:00 +0000 kern_ctf: Use zlib's uncompress function for simpler code. Reviewed by: markj, delphij MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D21531 --- sys/kern/kern_ctf.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/sys/kern/kern_ctf.c b/sys/kern/kern_ctf.c index 6a6a08033137..ee7576ab6fb9 100644 --- a/sys/kern/kern_ctf.c +++ b/sys/kern/kern_ctf.c @@ -244,7 +244,7 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc) /* Check if decompression is required. */ if (raw != NULL) { - z_stream zs; + uLongf destlen; int ret; /* @@ -253,22 +253,12 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc) */ bcopy(ctf_hdr, ctftab, sizeof(ctf_hdr)); - /* Initialise the zlib structure. */ - bzero(&zs, sizeof(zs)); - - if (inflateInit(&zs) != Z_OK) { - error = EIO; - goto out; - } - - zs.avail_in = shdr[i].sh_size - sizeof(ctf_hdr); - zs.next_in = ((uint8_t *) raw) + sizeof(ctf_hdr); - zs.avail_out = sz - sizeof(ctf_hdr); - zs.next_out = ((uint8_t *) ctftab) + sizeof(ctf_hdr); - ret = inflate(&zs, Z_FINISH); - inflateEnd(&zs); - if (ret != Z_STREAM_END) { - printf("%s(%d): zlib inflate returned %d\n", __func__, __LINE__, ret); + destlen = sz - sizeof(ctf_hdr); + ret = uncompress(((uint8_t *) ctftab) + sizeof(ctf_hdr), + &destlen, ((uint8_t *) raw) + sizeof(ctf_hdr), + shdr[i].sh_size - sizeof(ctf_hdr)); + if (ret != Z_OK) { + printf("%s(%d): zlib uncompress returned %d\n", __func__, __LINE__, ret); error = EIO; goto out; } From owner-dev-commits-src-all@freebsd.org Sun Sep 26 06:41:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 77CC36721D5 for ; Sun, 26 Sep 2021 06:41: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 4HHGQY320bz3Clv; Sun, 26 Sep 2021 06:41: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 4828C1913C; Sun, 26 Sep 2021 06:41: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 18Q6fvRU076863; Sun, 26 Sep 2021 06:41:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18Q6fvMV076862; Sun, 26 Sep 2021 06:41:57 GMT (envelope-from git) Date: Sun, 26 Sep 2021 06:41:57 GMT Message-Id: <202109260641.18Q6fvMV076862@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Philip Paeps Subject: git: b35b1fecb54c - Create tag vendor/tzdata/tzdata2021b MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/tags/vendor/tzdata/tzdata2021b X-Git-Reftype: annotated tag X-Git-Commit: b35b1fecb54c26c1aa6e6d385c8e8f6f2c21656f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 06:41:57 -0000 The annotated tag vendor/tzdata/tzdata2021b has been created by philip: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/tzdata/tzdata2021b tag vendor/tzdata/tzdata2021b Tagger: Philip Paeps TaggerDate: 2021-09-26 06:36:07 +0000 Tag import of tzdata 2021b commit a5725262945a2971af3b808088217fe975e8364e Author: Philip Paeps AuthorDate: 2021-09-26 06:35:07 +0000 Commit: Philip Paeps CommitDate: 2021-09-26 06:35:07 +0000 Import tzdata 2021b From owner-dev-commits-src-all@freebsd.org Sun Sep 26 06:41:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DA55672148 for ; Sun, 26 Sep 2021 06:41: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 4HHGQY2kNsz3Clt; Sun, 26 Sep 2021 06:41: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 34C8B18FFA; Sun, 26 Sep 2021 06:41: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 18Q6fv4j076839; Sun, 26 Sep 2021 06:41:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18Q6fval076838; Sun, 26 Sep 2021 06:41:57 GMT (envelope-from git) Date: Sun, 26 Sep 2021 06:41:57 GMT Message-Id: <202109260641.18Q6fval076838@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Philip Paeps Subject: git: 4cd7e1071de1..a5725262945a - vendor/tzdata - vendor branch updated MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/vendor/tzdata X-Git-Reftype: branch X-Git-Commit: a5725262945a2971af3b808088217fe975e8364e X-Git-Oldrev: 4cd7e1071de16a7392b0e466287f13e9e6f2081a X-Git-Newrev: a5725262945a2971af3b808088217fe975e8364e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 06:41:57 -0000 The branch vendor/tzdata has been updated by philip: URL: https://cgit.FreeBSD.org/src/log/?id=4cd7e1071de1..a5725262945a a5725262945a Import tzdata 2021b From owner-dev-commits-src-all@freebsd.org Sun Sep 26 06:54:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A4F2672BE5; Sun, 26 Sep 2021 06:54: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 4HHGhy0N8Wz3DnK; Sun, 26 Sep 2021 06:54: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 E094A19426; Sun, 26 Sep 2021 06:54: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 18Q6sPTX090087; Sun, 26 Sep 2021 06:54:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18Q6sN6p090080; Sun, 26 Sep 2021 06:54:23 GMT (envelope-from git) Date: Sun, 26 Sep 2021 06:54:23 GMT Message-Id: <202109260654.18Q6sN6p090080@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Philip Paeps Subject: git: 94c2d487f14b - main - contrib/tzdata: import tzdata 2021b MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 94c2d487f14bc7143bbf3a9809f1f8f98db9f0ab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 06:54:26 -0000 The branch main has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=94c2d487f14bc7143bbf3a9809f1f8f98db9f0ab commit 94c2d487f14bc7143bbf3a9809f1f8f98db9f0ab Merge: cb17f4a6bdaf a5725262945a Author: Philip Paeps AuthorDate: 2021-09-26 06:45:39 +0000 Commit: Philip Paeps CommitDate: 2021-09-26 06:45:39 +0000 contrib/tzdata: import tzdata 2021b Merge commit 'a5725262945a2971af3b808088217fe975e8364e' Changes: https://github.com/eggert/tz/blob/2021b/NEWS MFC after: 3 days contrib/tzdata/CONTRIBUTING | 15 +- contrib/tzdata/Makefile | 43 ++-- contrib/tzdata/NEWS | 229 ++++++++++++++++++++- contrib/tzdata/africa | 135 +------------ contrib/tzdata/antarctica | 29 +-- contrib/tzdata/asia | 34 ++-- contrib/tzdata/australasia | 120 +++++++++-- contrib/tzdata/backward | 102 +++++++++- contrib/tzdata/backzone | 426 +++++++++++++++++++++++++++++++++++++-- contrib/tzdata/checktab.awk | 50 +++-- contrib/tzdata/europe | 44 ++-- contrib/tzdata/leap-seconds.list | 8 +- contrib/tzdata/leapseconds | 8 +- contrib/tzdata/northamerica | 244 ++++++---------------- contrib/tzdata/southamerica | 87 ++++---- contrib/tzdata/theory.html | 39 ++-- contrib/tzdata/version | 2 +- contrib/tzdata/ziguard.awk | 11 +- contrib/tzdata/zone.tab | 9 +- contrib/tzdata/zone1970.tab | 29 +-- 20 files changed, 1092 insertions(+), 572 deletions(-) diff --cc contrib/tzdata/Makefile index 1136af9298f1,000000000000..33f31684114b mode 100644,000000..100644 --- a/contrib/tzdata/Makefile +++ b/contrib/tzdata/Makefile @@@ -1,1130 -1,0 +1,1143 @@@ +# Make and install tzdb code and data. + +# This file is in the public domain, so clarified as of +# 2009-05-17 by Arthur David Olson. + +# Package name for the code distribution. +PACKAGE= tzcode + +# Version number for the distribution, overridden in the 'tarballs' rule below. +VERSION= unknown + +# Email address for bug reports. +BUGEMAIL= tz@iana.org + +# DATAFORM selects the data format. +# Available formats represent essentially the same data, albeit +# possibly with minor discrepancies that users are not likely to notice. +# To get new features and the best data right away, use: +# DATAFORM= vanguard +# To wait a while before using new features, to give downstream users +# time to upgrade zic (the default), use: +# DATAFORM= main +# To wait even longer for new features, use: +# DATAFORM= rearguard +# Rearguard users might also want "ZFLAGS = -b fat"; see below. +DATAFORM= main + +# Change the line below for your timezone (after finding the one you want in +# one of the $(TDATA) source files, or adding it to a source file). +# Alternatively, if you discover you've got the wrong timezone, you can just +# 'zic -l -' to remove it, or 'zic -l rightzone' to change it. +# Use the command +# make zonenames +# to get a list of the values you can use for LOCALTIME. + +LOCALTIME= GMT + +# The POSIXRULES macro controls interpretation of nonstandard and obsolete +# POSIX-like TZ settings like TZ='EET-2EEST' that lack DST transition rules. +# Such a setting uses the rules in a template file to determine +# "spring forward" and "fall back" days and times; the environment +# variable itself specifies UT offsets of standard and daylight saving time. +# +# If POSIXRULES is '-', no template is installed; this is the default. +# +# Any other value for POSIXRULES is obsolete and should not be relied on, as: +# * It does not work correctly in popular implementations such as GNU/Linux. - # * It does not work in the tzdb implementation for timestamps after 2037. - # * It is incompatible with 'zic -b slim' if POSIXRULES specifies transitions - # at standard time or UT rather than at local time. ++# * It does not work even in tzcode, except for historical timestamps ++# that precede the last explicit transition in the POSIXRULES file. ++# Hence it typically does not work for current and future timestamps. +# In short, software should avoid ruleless settings like TZ='EET-2EEST' +# and so should not depend on the value of POSIXRULES. +# +# If, despite the above, you want a template for handling these settings, +# you can change the line below (after finding the timezone you want in the +# one of the $(TDATA) source files, or adding it to a source file). +# Alternatively, if you discover you've got the wrong timezone, you can just +# 'zic -p -' to remove it, or 'zic -p rightzone' to change it. +# Use the command +# make zonenames +# to get a list of the values you can use for POSIXRULES. + +POSIXRULES= - + +# Also see TZDEFRULESTRING below, which takes effect only +# if the time zone files cannot be accessed. + + +# Installation locations. +# +# The defaults are suitable for Debian, except that if REDO is +# posix_right or right_posix then files that Debian puts under +# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead +# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps, +# respectively. Problems with the Debian approach are discussed in +# the commentary for the right_posix rule (below). + +# Destination directory, which can be used for staging. +# 'make DESTDIR=/stage install' installs under /stage (e.g., to +# /stage/etc/localtime instead of to /etc/localtime). Files under +# /stage are not intended to work as-is, but can be copied by hand to +# the root directory later. If DESTDIR is empty, 'make install' does +# not stage, but installs directly into production locations. +DESTDIR = + +# Everything is installed into subdirectories of TOPDIR, and used there. +# TOPDIR should be empty (meaning the root directory), +# or a directory name that does not end in "/". +# TOPDIR should be empty or an absolute name unless you're just testing. +TOPDIR = + +# The default local timezone is taken from the file TZDEFAULT. +TZDEFAULT = $(TOPDIR)/etc/localtime + +# The subdirectory containing installed program and data files, and +# likewise for installed files that can be shared among architectures. +# These should be relative file names. +USRDIR = usr +USRSHAREDIR = $(USRDIR)/share + +# "Compiled" timezone information is placed in the "TZDIR" directory +# (and subdirectories). +# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty. +TZDIR_BASENAME= zoneinfo +TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME) + +# The "tzselect" and (if you do "make INSTALL") "date" commands go in: +BINDIR = $(TOPDIR)/$(USRDIR)/bin + +# The "zdump" command goes in: +ZDUMPDIR = $(BINDIR) + +# The "zic" command goes in: +ZICDIR = $(TOPDIR)/$(USRDIR)/sbin + +# Manual pages go in subdirectories of. . . +MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man + +# Library functions are put in an archive in LIBDIR. +LIBDIR = $(TOPDIR)/$(USRDIR)/lib + + +# Types to try, as an alternative to time_t. +TIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL) - TIME_T_ALTERNATIVES_HEAD = int64_t - TIME_T_ALTERNATIVES_TAIL = int32_t uint32_t uint64_t ++TIME_T_ALTERNATIVES_HEAD = int_least64_t ++TIME_T_ALTERNATIVES_TAIL = int_least32_t uint_least32_t uint_least64_t + +# What kind of TZif data files to generate. (TZif is the binary time +# zone data format that zic generates; see Internet RFC 8536.) +# If you want only POSIX time, with time values interpreted as +# seconds since the epoch (not counting leap seconds), use +# REDO= posix_only +# below. If you want only "right" time, with values interpreted +# as seconds since the epoch (counting leap seconds), use +# REDO= right_only +# below. If you want both sets of data available, with leap seconds not +# counted normally, use +# REDO= posix_right +# below. If you want both sets of data available, with leap seconds counted +# normally, use +# REDO= right_posix +# below. POSIX mandates that leap seconds not be counted; for compatibility +# with it, use "posix_only" or "posix_right". Use POSIX time on systems with +# leap smearing; this can work better than unsmeared "right" time with +# applications that are not leap second aware, and is closer to unsmeared +# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error). + +REDO= posix_right + +# Whether to put an "Expires" line in the leapseconds file. +# Use EXPIRES_LINE=1 to put the line in, 0 to omit it. +# The EXPIRES_LINE value matters only if REDO's value contains "right". +# If you change EXPIRES_LINE, remove the leapseconds file before running "make". +# zic's support for the Expires line was introduced in tzdb 2020a, - # and EXPIRES_LINE defaults to 0 for now so that the leapseconds file - # can be given to older zic implementations. ++# and was modified in tzdb 2021b to generate version 4 TZif files. ++# EXPIRES_LINE defaults to 0 for now so that the leapseconds file ++# can be given to pre-2020a zic implementations and so that TZif files ++# built by newer zic implementations can be read by pre-2021b libraries. +EXPIRES_LINE= 0 + +# To install data in text form that has all the information of the TZif data, +# (optionally incorporating leap second information), use +# TZDATA_TEXT= tzdata.zi leapseconds +# To install text data without leap second information (e.g., because +# REDO='posix_only'), use +# TZDATA_TEXT= tzdata.zi +# To avoid installing text data, use +# TZDATA_TEXT= + +TZDATA_TEXT= leapseconds tzdata.zi + +# For backward-compatibility links for old zone names, use +# BACKWARD= backward +# To omit these links, use +# BACKWARD= + +BACKWARD= backward + +# If you want out-of-scope and often-wrong data from the file 'backzone', use +# PACKRATDATA= backzone +# To omit this data, use +# PACKRATDATA= + +PACKRATDATA= + +# The name of a locale using the UTF-8 encoding, used during self-tests. +# The tests are skipped if the name does not appear to work on this system. + +UTF8_LOCALE= en_US.utf8 + +# Non-default libraries needed to link. +LDLIBS= + +# Add the following to the end of the "CFLAGS=" line as needed to override +# defaults specified in the source code. "-DFOO" is equivalent to "-DFOO=1". +# -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime +# formats that generate only the last two digits of year numbers +# -DEPOCH_LOCAL if the 'time' function returns local time not UT +# -DEPOCH_OFFSET=N if the 'time' function returns a value N greater +# than what POSIX specifies, assuming local time is UT. +# For example, N is 252460800 on AmigaOS. +# -DHAVE_DECL_ASCTIME_R=0 if does not declare asctime_r +# -DHAVE_DECL_ENVIRON if declares 'environ' +# -DHAVE_DIRECT_H if mkdir needs (MS-Windows) +# -DHAVE_GENERIC=0 if _Generic does not work +# -DHAVE_GETTEXT if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris) +# -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares +# ctime_r and asctime_r incompatibly with the POSIX standard +# (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined). +# -DHAVE_INTTYPES_H if you have a non-C99 compiler with +# -DHAVE_LINK=0 if your system lacks a link function +# -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function +# -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz +# localtime_rz can make zdump significantly faster, but is nonstandard. ++# -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure. +# -DHAVE_POSIX_DECLS=0 if your system's include files do not declare +# functions like 'link' or variables like 'tzname' required by POSIX +# -DHAVE_SNPRINTF=0 if your system lacks the snprintf function +# -DHAVE_STDBOOL_H if you have a non-C99 compiler with +# -DHAVE_STDINT_H if you have a non-C99 compiler with +# -DHAVE_STRFTIME_L if declares locale_t and strftime_l +# -DHAVE_STRDUP=0 if your system lacks the strdup function +# -DHAVE_STRTOLL=0 if your system lacks the strtoll function +# -DHAVE_SYMLINK=0 if your system lacks the symlink function +# -DHAVE_SYS_STAT_H=0 if your compiler lacks a - # -DHAVE_SYS_WAIT_H=0 if your compiler lacks a +# -DHAVE_TZSET=0 if your system lacks a tzset function +# -DHAVE_UNISTD_H=0 if your compiler lacks a +# -Dlocale_t=XXX if your system uses XXX instead of locale_t +# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers +# with external linkage, e.g., applications cannot define 'localtime'. +# -Dssize_t=long on hosts like MS-Windows that lack ssize_t +# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has +# security implications and is not recommended for general use +# -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires; +# not needed by the main-program tz code, which is single-threaded. +# Append other compiler flags as needed, e.g., -pthread on GNU/Linux. +# -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t +# This is intended for internal use only; it mangles external names. +# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz" +# -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory; +# the default is system-supplied, typically "/usr/lib/locale" +# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified +# DST transitions if the time zone files cannot be accessed +# -DUNINIT_TRAP if reading uninitialized storage can cause problems +# other than simply getting garbage data +# -DUSE_LTZ=0 to build zdump with the system time zone library +# Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below. +# -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and +# similarly for "slim". Fat TZif files work around incompatibilities +# and bugs in some TZif readers, notably readers that mishandle 64-bit +# data in TZif files. Slim TZif files are more efficient and do not +# work around these incompatibilities and bugs. If not given, the +# default is "slim". +# -DZIC_MAX_ABBR_LEN_WO_WARN=3 +# (or some other number) to set the maximum time zone abbreviation length +# that zic will accept without a warning (the default is 6) +# $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking +# Select instrumentation via "make GCC_INSTRUMENT='whatever'". +GCC_INSTRUMENT = \ + -fsanitize=undefined -fsanitize-address-use-after-scope \ + -fsanitize-undefined-trap-on-error -fstack-protector ++# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow. +GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \ + $(GCC_INSTRUMENT) \ + -Wall -Wextra \ + -Walloc-size-larger-than=100000 -Warray-bounds=2 \ + -Wbad-function-cast -Wcast-align=strict -Wdate-time \ + -Wdeclaration-after-statement -Wdouble-promotion \ ++ -Wduplicated-branches -Wduplicated-cond \ + -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \ - -Winit-self -Wjump-misses-init -Wlogical-op \ ++ -Winit-self -Wlogical-op \ + -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ ++ -Wnull-dereference \ + -Wold-style-definition -Woverlength-strings -Wpointer-arith \ - -Wshadow -Wshift-overflow=2 -Wstrict-prototypes -Wstringop-overflow=4 \ ++ -Wshadow -Wshift-overflow=2 -Wstrict-overflow \ ++ -Wstrict-prototypes -Wstringop-overflow=4 \ + -Wstringop-truncation -Wsuggest-attribute=cold \ + -Wsuggest-attribute=const -Wsuggest-attribute=format \ + -Wsuggest-attribute=malloc \ + -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \ - -Wtrampolines -Wundef -Wuninitialized -Wunused \ ++ -Wtrampolines -Wundef -Wuninitialized -Wunused-macros \ + -Wvariadic-macros -Wvla -Wwrite-strings \ + -Wno-address -Wno-format-nonliteral -Wno-sign-compare \ + -Wno-type-limits -Wno-unused-parameter +# +# If your system has a "GMT offset" field in its "struct tm"s +# (or if you decide to add such a field in your system's "time.h" file), +# add the name to a define such as +# -DTM_GMTOFF=tm_gmtoff +# to the end of the "CFLAGS=" line. If not defined, the code attempts to +# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this. +# Similarly, if your system has a "zone abbreviation" field, define +# -DTM_ZONE=tm_zone +# and define NO_TM_ZONE to suppress any guessing. These two fields are not +# required by POSIX, but are widely available on GNU/Linux and BSD systems. +# +# The next batch of options control support for external variables +# exported by tzcode. In practice these variables are less useful +# than TM_GMTOFF and TM_ZONE. However, most of them are standardized. +# # +# # To omit or support the external variable "tzname", add one of: +# # -DHAVE_TZNAME=0 # do not support "tzname" +# # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library +# # -DHAVE_TZNAME=2 # support and define "tzname" +# # to the "CFLAGS=" line. "tzname" is required by POSIX 1988 and later. +# # If not defined, the code attempts to guess HAVE_TZNAME from other macros. +# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause +# # crashes when combined with some platforms' standard libraries, +# # presumably due to memory allocation issues. +# # +# # To omit or support the external variables "timezone" and "daylight", add +# # -DUSG_COMPAT=0 # do not support +# # -DUSG_COMPAT=1 # support, and variables are defined by system library +# # -DUSG_COMPAT=2 # support and define variables +# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by +# # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later. +# # If not defined, the code attempts to guess USG_COMPAT from other macros. +# # +# # To support the external variable "altzone", add +# # -DALTZONE=0 # do not support +# # -DALTZONE=1 # support "altzone", which is defined by system library +# # -DALTZONE=2 # support and define "altzone" +# # to the end of the "CFLAGS=" line; although "altzone" appeared in +# # System V Release 3.1 it has not been standardized. +# # If not defined, the code attempts to guess ALTZONE from other macros. +# +# If you want functions that were inspired by early versions of X3J11's work, +# add +# -DSTD_INSPIRED +# to the end of the "CFLAGS=" line. This arranges for the functions +# "offtime", "timelocal", "timegm", "timeoff", +# "posix2time", and "time2posix" to be added to the time conversion library. +# "offtime" is like "gmtime" except that it accepts a second (long) argument +# that gives an offset to add to the time_t when converting it. +# "timelocal" is equivalent to "mktime". +# "timegm" is like "timelocal" except that it turns a struct tm into +# a time_t using UT (rather than local time as "timelocal" does). +# "timeoff" is like "timegm" except that it accepts a second (long) argument +# that gives an offset to use when converting to a time_t. +# "posix2time" and "time2posix" are described in an included manual page. +# X3J11's work does not describe any of these functions. +# These functions may well disappear in future releases of the time +# conversion package. +# +# If you don't want functions that were inspired by NetBSD, add +# -DNETBSD_INSPIRED=0 +# to the end of the "CFLAGS=" line. Otherwise, the functions +# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the +# time library, and if STD_INSPIRED is also defined the functions +# "posix2time_z" and "time2posix_z" are added as well. +# The functions ending in "_z" (or "_rz") are like their unsuffixed +# (or suffixed-by-"_r") counterparts, except with an extra first +# argument of opaque type timezone_t that specifies the timezone. +# "tzalloc" allocates a timezone_t value, and "tzfree" frees it. +# +# If you want to allocate state structures in localtime, add +# -DALL_STATE +# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. +# +# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put +# out by the National Institute of Standards and Technology +# which claims to test C and Posix conformance. If you want to pass PCTS, add +# -DPCTS +# to the end of the "CFLAGS=" line. +# +# If you want strict compliance with XPG4 as of 1994-04-09, add +# -DXPG4_1994_04_09 +# to the end of the "CFLAGS=" line. This causes "strftime" to always return +# 53 as a week number (rather than 52 or 53) for January days before +# January's first Monday when a "%V" format is used and January 1 +# falls on a Friday, Saturday, or Sunday. + +CFLAGS= + +# Linker flags. Default to $(LFLAGS) for backwards compatibility +# to release 2012h and earlier. + +LDFLAGS= $(LFLAGS) + +# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in +# submake command lines. The default is no leap seconds. + +LEAPSECONDS= + +# The zic command and its arguments. + +zic= ./zic +ZIC= $(zic) $(ZFLAGS) + +# To shrink the size of installed TZif files, +# append "-r @N" to omit data before N-seconds-after-the-Epoch. +# To grow the files and work around older application bugs, append "-b fat"; +# see ZIC_BLOAT_DEFAULT above. +# See the zic man page for more about -b and -r. +ZFLAGS= + +# How to use zic to install TZif files. + +ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS) + +# The name of a Posix-compliant 'awk' on your system. +# Older 'mawk' versions, such as the 'mawk' in Ubuntu 16.04, might dump core; +# on Ubuntu you can work around this with +# AWK= gawk +AWK= awk + +# The full path name of a Posix-compliant shell, preferably one that supports +# the Korn shell's 'select' statement as an extension. +# These days, Bash is the most popular. +# It should be OK to set this to /bin/sh, on platforms where /bin/sh +# lacks 'select' or doesn't completely conform to Posix, but /bin/bash +# is typically nicer if it works. +KSHELL= /bin/bash + +# Name of curl , used for HTML validation. +CURL= curl + +# Name of GNU Privacy Guard , used to sign distributions. +GPG= gpg + +# This expensive test requires USE_LTZ. +# To suppress it, define this macro to be empty. +CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives + +# SAFE_CHAR is a regular expression that matches a safe character. +# Some parts of this distribution are limited to safe characters; +# others can use any UTF-8 character. +# For now, the safe characters are a safe subset of ASCII. +# The caller must set the shell variable 'sharp' to the character '#', +# since Makefile macros cannot contain '#'. +# TAB_CHAR is a single tab character, in single quotes. +TAB_CHAR= ' ' +SAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@' +SAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`' +SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' +SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) +SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' + +# These characters are Latin-1, and so are likely to be displayable +# even in editors with limited character sets. +UNUSUAL_OK_LATIN_1 = «°±»½¾× +# This IPA symbol is represented in Unicode as the composition of +# U+0075 and U+032F, and U+032F is not considered alphabetic by some +# grep implementations that do not grok composition. +UNUSUAL_OK_IPA = u̯ +# Non-ASCII non-letters that OK_CHAR allows, as these characters are +# useful in commentary. +UNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1)$(UNUSUAL_OK_IPA) + +# OK_CHAR matches any character allowed in the distributed files. +# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and +# multibyte letters are also allowed so that commentary can contain a +# few safe symbols and people's names and can quote non-English sources. +# Other non-letters are limited to ASCII renderings for the +# convenience of maintainers using XEmacs 21.5.34, which by default +# mishandles Unicode characters U+0100 and greater. +OK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]' + +# SAFE_LINE matches a line of safe characters. +# SAFE_SHARP_LINE is similar, except any OK character can follow '#'; +# this is so that comments can contain non-ASCII characters. +# OK_LINE matches a line of OK characters. +SAFE_LINE= '^'$(SAFE_CHAR)'*$$' +SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$' +OK_LINE= '^'$(OK_CHAR)'*$$' + +# Flags to give 'tar' when making a distribution. +# Try to use flags appropriate for GNU tar. +GNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w --sort=name +TARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \ + then echo $(GNUTARFLAGS); \ + else :; \ + fi` + +# Flags to give 'gzip' when making a distribution. +GZIPFLAGS= -9n + +############################################################################### + +#MAKE= make + +cc= cc +CC= $(cc) -DTZDIR='"$(TZDIR)"' + +AR= ar + +# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. +RANLIB= : + +TZCOBJS= zic.o +TZDOBJS= zdump.o localtime.o asctime.o strftime.o +DATEOBJS= date.o localtime.o strftime.o asctime.o +LIBSRCS= localtime.c asctime.c difftime.c strftime.c +LIBOBJS= localtime.o asctime.o difftime.o strftime.o +HEADERS= tzfile.h private.h +NONLIBSRCS= zic.c zdump.c +NEWUCBSRCS= date.c +SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ + tzselect.ksh workman.sh +MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ + tzfile.5 tzselect.8 zic.8 zdump.8 +MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \ + time2posix.3.txt \ + tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ + date.1.txt +COMMON= calendars CONTRIBUTING LICENSE Makefile \ + NEWS README theory.html version +WEB_PAGES= tz-art.html tz-how-to.html tz-link.html +CHECK_WEB_PAGES=check_theory.html check_tz-art.html \ + check_tz-how-to.html check_tz-link.html +DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) +PRIMARY_YDATA= africa antarctica asia australasia \ + europe northamerica southamerica +YDATA= $(PRIMARY_YDATA) etcetera +NDATA= factory +TDATA_TO_CHECK= $(YDATA) $(NDATA) backward +TDATA= $(YDATA) $(NDATA) $(BACKWARD) +ZONETABLES= zone1970.tab zone.tab +TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) +LEAP_DEPS= leapseconds.awk leap-seconds.list +TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) $(PACKRATDATA) +DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) +DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ + leapseconds $(ZONETABLES) +AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk \ + ziguard.awk zishrink.awk +MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl +TZS_YEAR= 2050 +TZS_CUTOFF_FLAG= -c $(TZS_YEAR) +TZS= to$(TZS_YEAR).tzs +TZS_NEW= to$(TZS_YEAR)new.tzs - TZS_DEPS= $(PRIMARY_YDATA) asctime.c localtime.c \ ++TZS_DEPS= $(YDATA) asctime.c localtime.c \ + private.h tzfile.h zdump.c zic.c +# EIGHT_YARDS is just a yard short of the whole ENCHILADA. +EIGHT_YARDS = $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) tzdata.zi +ENCHILADA = $(EIGHT_YARDS) $(TZS) + +# Consult these files when deciding whether to rebuild the 'version' file. +# This list is not the same as the output of 'git ls-files', since +# .gitignore is not distributed. +VERSION_DEPS= \ + calendars CONTRIBUTING LICENSE Makefile NEWS README \ + africa antarctica asctime.c asia australasia \ + backward backzone \ + checklinks.awk checktab.awk \ + date.1 date.c difftime.c \ + etcetera europe factory iso3166.tab \ + leap-seconds.list leapseconds.awk localtime.c \ + newctime.3 newstrftime.3 newtzset.3 northamerica \ + private.h southamerica strftime.c theory.html \ + time2posix.3 tz-art.html tz-how-to.html tz-link.html \ + tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ + workman.sh zdump.8 zdump.c zic.8 zic.c \ + ziguard.awk zishrink.awk \ + zone.tab zone1970.tab zoneinfo2tdf.pl + +# And for the benefit of csh users on systems that assume the user +# shell should be used to handle commands in Makefiles. . . + +SHELL= /bin/sh + +all: tzselect zic zdump libtz.a $(TABDATA) \ + vanguard.zi main.zi rearguard.zi + +ALL: all date $(ENCHILADA) + +install: all $(DATA) $(REDO) $(MANS) + mkdir -p '$(DESTDIR)$(BINDIR)' \ + '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ + '$(DESTDIR)$(LIBDIR)' \ + '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ + '$(DESTDIR)$(MANDIR)/man8' + $(ZIC_INSTALL) -l $(LOCALTIME) \ + `case '$(POSIXRULES)' in ?*) echo '-p';; esac \ + ` $(POSIXRULES) \ + -t '$(DESTDIR)$(TZDEFAULT)' + cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' + cp tzselect '$(DESTDIR)$(BINDIR)/.' + cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' + cp zic '$(DESTDIR)$(ZICDIR)/.' + cp libtz.a '$(DESTDIR)$(LIBDIR)/.' + $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' + cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' + cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' + cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' + +INSTALL: ALL install date.1 + mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' + cp date '$(DESTDIR)$(BINDIR)/.' + cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' + +# Calculate version number from git, if available. +# Otherwise, use $(VERSION) unless it is "unknown" and there is already +# a 'version' file, in which case reuse the existing 'version' contents +# and append "-dirty" if the contents do not already end in "-dirty". +version: $(VERSION_DEPS) + { (type git) >/dev/null 2>&1 && \ + V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ + --abbrev=7 --dirty` || \ + if test '$(VERSION)' = unknown && V=`cat $@`; then \ + case $$V in *-dirty);; *) V=$$V-dirty;; esac; \ + else \ + V='$(VERSION)'; \ + fi; } && \ + printf '%s\n' "$$V" >$@.out + mv $@.out $@ + +# These files can be tailored by setting BACKWARD and PACKRATDATA. +vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS) + $(AWK) -v DATAFORM=`expr $@ : '\(.*\).zi'` -f ziguard.awk \ + $(TDATA) $(PACKRATDATA) >$@.out + mv $@.out $@ +# This file has a version comment that attempts to capture any tailoring +# via BACKWARD, DATAFORM, PACKRATDATA, and REDO. +tzdata.zi: $(DATAFORM).zi version zishrink.awk + version=`sed 1q version` && \ + LC_ALL=C $(AWK) \ + -v dataform='$(DATAFORM)' \ + -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \ + -v redo='$(REDO)' \ + -v version="$$version" \ + -f zishrink.awk \ + $(DATAFORM).zi >$@.out + mv $@.out $@ + +version.h: version + VERSION=`cat version` && printf '%s\n' \ + 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ + "static char const TZVERSION[]=\"$$VERSION\";" \ + 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \ + >$@.out + mv $@.out $@ + +zdump: $(TZDOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) + +zic: $(TZCOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) + +leapseconds: $(LEAP_DEPS) + $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \ + -f leapseconds.awk leap-seconds.list >$@.out + mv $@.out $@ + +# Arguments to pass to submakes of install_data. +# They can be overridden by later submake arguments. +INSTALLARGS = \ + BACKWARD='$(BACKWARD)' \ + DESTDIR='$(DESTDIR)' \ + LEAPSECONDS='$(LEAPSECONDS)' \ + PACKRATDATA='$(PACKRATDATA)' \ + TZDEFAULT='$(TZDEFAULT)' \ + TZDIR='$(TZDIR)' \ + ZIC='$(ZIC)' + +INSTALL_DATA_DEPS = zic leapseconds tzdata.zi + +# 'make install_data' installs one set of TZif files. +install_data: $(INSTALL_DATA_DEPS) + $(ZIC_INSTALL) tzdata.zi + +posix_only: $(INSTALL_DATA_DEPS) + $(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data + +right_only: $(INSTALL_DATA_DEPS) + $(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \ + install_data + +# In earlier versions of this makefile, the other two directories were +# subdirectories of $(TZDIR). However, this led to configuration errors. +# For example, with posix_right under the earlier scheme, +# TZ='right/Australia/Adelaide' got you localtime with leap seconds, +# but gmtime without leap seconds, which led to problems with applications +# like sendmail that subtract gmtime from localtime. +# Therefore, the other two directories are now siblings of $(TZDIR). +# You must replace all of $(TZDIR) to switch from not using leap seconds +# to using them, or vice versa. +right_posix: right_only + rm -fr '$(DESTDIR)$(TZDIR)-leaps' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only + +posix_right: posix_only + rm -fr '$(DESTDIR)$(TZDIR)-posix' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only + +# This obsolescent rule is present for backwards compatibility with +# tz releases 2014g through 2015g. It should go away eventually. +posix_packrat: $(INSTALL_DATA_DEPS) + $(MAKE) $(INSTALLARGS) PACKRATDATA=backzone posix_only + +zones: $(REDO) + +# dummy.zd is not a real file; it is mentioned here only so that the +# top-level 'make' does not have a syntax error. +ZDS = dummy.zd +# Rule used only by submakes invoked by the $(TZS_NEW) rule. +# It is separate so that GNU 'make -j' can run instances in parallel. +$(ZDS): zdump + ./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \ + >$@ + +TZS_NEW_DEPS = tzdata.zi zdump zic +$(TZS_NEW): $(TZS_NEW_DEPS) + rm -fr tzs$(TZS_YEAR).dir + mkdir tzs$(TZS_YEAR).dir + $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi + $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \ + tzdata.zi | LC_ALL=C sort >$@.out + wd=`pwd` && \ + x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \ + tzdata.zi \ + | LC_ALL=C sort -t . -k 2,2` && \ + set x $$x && \ + shift && \ + ZDS=$$* && \ + $(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \ + ZDS="$$ZDS" $$ZDS && \ + sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out + rm -fr tzs$(TZS_YEAR).dir + mv $@.out $@ + +# If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the +# failed output and fix the inconsistency, perhaps by running 'make force_tzs'. +$(TZS): + touch $@ + +force_tzs: $(TZS_NEW) + cp $(TZS_NEW) $(TZS) + +libtz.a: $(LIBOBJS) + rm -f $@ + $(AR) -rc $@ $(LIBOBJS) + $(RANLIB) $@ + +date: $(DATEOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) + +tzselect: tzselect.ksh version + VERSION=`cat version` && sed \ + -e 's|#!/bin/bash|#!$(KSHELL)|g' \ + -e 's|AWK=[^}]*|AWK=$(AWK)|g' \ + -e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \ + -e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \ + -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \ + -e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \ + <$@.ksh >$@.out + chmod +x $@.out + mv $@.out $@ + +check: check_character_set check_white_space check_links \ + check_name_lengths check_sorted \ + check_tables check_web check_zishrink check_tzs + +check_character_set: $(ENCHILADA) + test ! '$(UTF8_LOCALE)' || \ + ! printf 'A\304\200B\n' | \ + LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \ + LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \ + sharp='#' && \ + ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ + $(MISC) $(SOURCES) $(WEB_PAGES) \ + CONTRIBUTING LICENSE README \ + version tzdata.zi && \ + ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \ + Makefile && \ + ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ + leapseconds zone.tab && \ + ! grep -Env $(OK_LINE) $(ENCHILADA); \ + } + touch $@ + +check_white_space: $(ENCHILADA) + patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ + ! grep -En "$$pat" \ + $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) + ! grep -n '[[:space:]]$$' \ + $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) + touch $@ + +PRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+ +FILE_NAME_COMPONENT_TOO_LONG = \ + $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15} + +check_name_lengths: $(TDATA_TO_CHECK) backzone + ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ + $(TDATA_TO_CHECK) backzone + touch $@ + +CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } + +check_sorted: backward backzone iso3166.tab zone.tab zone1970.tab + $(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu + $(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu + touch $@ + +check_links: checklinks.awk $(TDATA_TO_CHECK) tzdata.zi + $(AWK) -f checklinks.awk $(TDATA_TO_CHECK) + $(AWK) -f checklinks.awk tzdata.zi + touch $@ + - check_tables: checktab.awk $(PRIMARY_YDATA) $(ZONETABLES) ++check_tables: checktab.awk $(YDATA) backward $(ZONETABLES) + for tab in $(ZONETABLES); do \ - $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \ ++ test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \ ++ $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \ + || exit; \ + done + touch $@ + +check_tzs: $(TZS) $(TZS_NEW) + if test -s $(TZS); then \ + diff -u $(TZS) $(TZS_NEW); \ + else \ + cp $(TZS_NEW) $(TZS); \ + fi + touch $@ + +check_web: $(CHECK_WEB_PAGES) +check_theory.html: theory.html +check_tz-art.html: tz-art.html +check_tz-how-to.html: tz-how-to.html +check_tz-link.html: tz-link.html +check_theory.html check_tz-art.html check_tz-how-to.html check_tz-link.html: + $(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \ + -F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \ + test ! -s $@.out || { cat $@.out; exit 1; } + mv $@.out $@ + +# Check that zishrink.awk does not alter the data, and that ziguard.awk +# preserves main-format data. +check_zishrink: check_zishrink_posix check_zishrink_right +check_zishrink_posix check_zishrink_right: \ + zic leapseconds $(PACKRATDATA) $(TDATA) $(DATAFORM).zi tzdata.zi + rm -fr $@.dir $@-t.dir $@-shrunk.dir + mkdir $@.dir $@-t.dir $@-shrunk.dir + case $@ in \ + *_right) leap='-L leapseconds';; \ + *) leap=;; \ + esac && \ + $(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \ + $(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \ + case $(DATAFORM) in \ + main) \ + $(ZIC) $$leap -d $@-t.dir $(TDATA) && \ + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \ + diff -r $@.dir $@-t.dir;; \ + esac + diff -r $@.dir $@-shrunk.dir + rm -fr $@.dir $@-t.dir $@-shrunk.dir + touch $@ + +clean_misc: + rm -fr check_*.dir + rm -f *.o *.out $(TIME_T_ALTERNATIVES) \ + check_* core typecheck_* \ + date tzselect version.h zdump zic libtz.a +clean: clean_misc + rm -fr *.dir tzdb-*/ + rm -f *.zi $(TZS_NEW) + +maintainer-clean: clean + @echo 'This command is intended for maintainers to use; it' + @echo 'deletes files that may need special tools to rebuild.' + rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.* + +names: + @echo $(ENCHILADA) + +public: check check_public $(CHECK_TIME_T_ALTERNATIVES) \ + tarballs signatures + +date.1.txt: date.1 +newctime.3.txt: newctime.3 +newstrftime.3.txt: newstrftime.3 +newtzset.3.txt: newtzset.3 +time2posix.3.txt: time2posix.3 +tzfile.5.txt: tzfile.5 +tzselect.8.txt: tzselect.8 +zdump.8.txt: zdump.8 +zic.8.txt: zic.8 + +$(MANTXTS): workman.sh + LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out + mv $@.out $@ + +# Set file timestamps deterministically if possible, +# so that tarballs containing the timestamps are reproducible. +# +# '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the +# file DEST to the maximum of the timestamps of the files A B C ..., +# plus N if GNU ls and touch are available. +SET_TIMESTAMP_N = sh -c '\ + n=$$0 dest=$$1; shift; \ + touch -cmr `ls -t "$$@" | sed 1q` "$$dest" && \ + if test $$n != 0 && \ + lsout=`ls -n --time-style="+%s" "$$dest" 2>/dev/null`; then \ + set x $$lsout && \ + touch -cmd @`expr $$7 + $$n` "$$dest"; \ + else :; fi' +# If DEST depends on A B C ... in this Makefile, callers should use +# $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any +# downstream 'make' that considers equal timestamps to be out of date. +# POSIX allows this 'make' behavior, and HP-UX 'make' does it. +# If all that matters is that the timestamp be reproducible +# and plausible, use $(SET_TIMESTAMP). +SET_TIMESTAMP = $(SET_TIMESTAMP_N) 0 +SET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1 + +# Set the timestamps to those of the git repository, if available, +# and if the files have not changed since then. +# This uses GNU 'ls --time-style=+%s', which outputs the seconds count, +# and GNU 'touch -d@N FILE', where N is the number of seconds since 1970. +# If git or GNU is absent, don't bother to sync with git timestamps. +# Also, set the timestamp of each prebuilt file like 'leapseconds' +# to be the maximum of the files it depends on. +set-timestamps.out: $(EIGHT_YARDS) + rm -f $@ + if (type git) >/dev/null 2>&1 && \ + files=`git ls-files $(EIGHT_YARDS)` && \ + touch -md @1 test.out; then \ + rm -f test.out && \ + for file in $$files; do \ *** 218 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Sep 26 09:22:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 72ACB674B42; Sun, 26 Sep 2021 09:22:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HHKzL2XZwz3MqR; Sun, 26 Sep 2021 09:22:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 379471B1CB; Sun, 26 Sep 2021 09:22:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18Q9M6ch090261; Sun, 26 Sep 2021 09:22:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18Q9M6C3090260; Sun, 26 Sep 2021 09:22:06 GMT (envelope-from git) Date: Sun, 26 Sep 2021 09:22:06 GMT Message-Id: <202109260922.18Q9M6C3090260@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 513ee901eec6 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 513ee901eec639da45796d563168f0af966705e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 09:22:06 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=513ee901eec639da45796d563168f0af966705e6 commit 513ee901eec639da45796d563168f0af966705e6 Author: Gordon Bergling AuthorDate: 2021-09-26 09:21:16 +0000 Commit: Gordon Bergling CommitDate: 2021-09-26 09:21:16 +0000 pcm(4): Fix a common typo in source code comments - s/prefered/preferred/ MFC after: 3 days --- sys/dev/sound/pcm/feeder_chain.c | 4 ++-- sys/dev/sound/pcm/feeder_matrix.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/sound/pcm/feeder_chain.c b/sys/dev/sound/pcm/feeder_chain.c index b2d48abd71d1..fe114b727ffd 100644 --- a/sys/dev/sound/pcm/feeder_chain.c +++ b/sys/dev/sound/pcm/feeder_chain.c @@ -52,7 +52,7 @@ struct feeder_chain_desc { struct feeder_chain_state current; /* current state */ struct feeder_chain_state target; /* target state */ struct pcm_feederdesc desc; /* feeder descriptor */ - uint32_t afmt_ne; /* prefered native endian */ + uint32_t afmt_ne; /* preferred native endian */ int mode; /* chain mode */ int use_eq; /* need EQ? */ int use_matrix; /* need channel matrixing? */ @@ -77,7 +77,7 @@ struct feeder_chain_desc { #endif /* - * List of prefered formats that might be required during + * List of preferred formats that might be required during * processing. It will be decided through snd_fmtbest(). */ diff --git a/sys/dev/sound/pcm/feeder_matrix.c b/sys/dev/sound/pcm/feeder_matrix.c index c6a65113574a..d4925fe0d7e6 100644 --- a/sys/dev/sound/pcm/feeder_matrix.c +++ b/sys/dev/sound/pcm/feeder_matrix.c @@ -552,7 +552,7 @@ feeder_matrix_setup(struct pcm_feeder *f, struct pcmchan_matrix *m_in, /* * feeder_matrix_default_id(): For a given number of channels, return - * default prefered id (example: both 5.1 and + * default preferred id (example: both 5.1 and * 6.0 are simply 6 channels, but 5.1 is more * preferable). */ From owner-dev-commits-src-all@freebsd.org Sun Sep 26 11:16:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B9ED67660A for ; Sun, 26 Sep 2021 11:16: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 4HHNVy0G8Qz3lB4; Sun, 26 Sep 2021 11:16: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 DAE421CAC2; Sun, 26 Sep 2021 11:16: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 18QBG97S036596; Sun, 26 Sep 2021 11:16:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QBG9rj036595; Sun, 26 Sep 2021 11:16:09 GMT (envelope-from git) Date: Sun, 26 Sep 2021 11:16:09 GMT Message-Id: <202109261116.18QBG9rj036595@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Dimitry Andric Subject: git: a7b5fabd02d7 - Create tag vendor/llvm-project/llvmorg-13.0.0-rc4-0-gd7b669b3a303 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/tags/vendor/llvm-project/llvmorg-13.0.0-rc4-0-gd7b669b3a303 X-Git-Reftype: annotated tag X-Git-Commit: a7b5fabd02d7b919be9cf3dfabfde9ddeb2f22a7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 11:16:10 -0000 The annotated tag vendor/llvm-project/llvmorg-13.0.0-rc4-0-gd7b669b3a303 has been created by dim: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/llvm-project/llvmorg-13.0.0-rc4-0-gd7b669b3a303 tag vendor/llvm-project/llvmorg-13.0.0-rc4-0-gd7b669b3a303 Tagger: Dimitry Andric TaggerDate: 2021-09-26 11:15:15 +0000 Tag llvm-project branch release/13.x llvmorg-13.0.0-rc4-0-gd7b669b3a303. commit 3f25e997d96a3150a192777c3c389c258c5cf7ee Author: Dimitry Andric AuthorDate: 2021-09-26 11:14:34 +0000 Commit: Dimitry Andric CommitDate: 2021-09-26 11:14:34 +0000 Vendor import of llvm-project branch release/13.x llvmorg-13.0.0-rc4-0-gd7b669b3a303. From owner-dev-commits-src-all@freebsd.org Sun Sep 26 11:16:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0755567658F for ; Sun, 26 Sep 2021 11:16: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 4HHNVx6nRxz3kwk; Sun, 26 Sep 2021 11:16: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 BFAF51C676; Sun, 26 Sep 2021 11:16: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 18QBG9wq036572; Sun, 26 Sep 2021 11:16:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QBG9i0036571; Sun, 26 Sep 2021 11:16:09 GMT (envelope-from git) Date: Sun, 26 Sep 2021 11:16:09 GMT Message-Id: <202109261116.18QBG9i0036571@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Dimitry Andric Subject: git: 392ac508a058..3f25e997d96a - vendor/llvm-project/release-13.x - vendor branch updated MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/vendor/llvm-project/release-13.x X-Git-Reftype: branch X-Git-Commit: 3f25e997d96a3150a192777c3c389c258c5cf7ee X-Git-Oldrev: 392ac508a0589dec2c854a6466a07a8bfd694e25 X-Git-Newrev: 3f25e997d96a3150a192777c3c389c258c5cf7ee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 11:16:10 -0000 The branch vendor/llvm-project/release-13.x has been updated by dim: URL: https://cgit.FreeBSD.org/src/log/?id=392ac508a058..3f25e997d96a 3f25e997d96a Vendor import of llvm-project branch release/13.x llvmorg-13.0.0-rc4-0-gd7b669b3a303. From owner-dev-commits-src-all@freebsd.org Sun Sep 26 11:27:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D7E867663E; Sun, 26 Sep 2021 11:27: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 4HHNlc12QDz3lmK; Sun, 26 Sep 2021 11:27: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 F3B6A1CD22; Sun, 26 Sep 2021 11:27: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 18QBR7cq049883; Sun, 26 Sep 2021 11:27:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QBR7jO049882; Sun, 26 Sep 2021 11:27:07 GMT (envelope-from git) Date: Sun, 26 Sep 2021 11:27:07 GMT Message-Id: <202109261127.18QBR7jO049882@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 8c15a9ce53da - main - Spell cloudabi correctly in ObsoleteFiles.inc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8c15a9ce53da6dc05ba440aeb9b3e5c209ecad24 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 11:27:08 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=8c15a9ce53da6dc05ba440aeb9b3e5c209ecad24 commit 8c15a9ce53da6dc05ba440aeb9b3e5c209ecad24 Author: Dimitry Andric AuthorDate: 2021-09-26 11:26:42 +0000 Commit: Dimitry Andric CommitDate: 2021-09-26 11:26:42 +0000 Spell cloudabi correctly in ObsoleteFiles.inc Fixes: cf0ee8738e31 Drop cloudabi --- ObsoleteFiles.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 111fced8ce20..87a7f95b67a1 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -40,7 +40,7 @@ # xargs -n1 | sort | uniq -d; # done -# 20210921: remove couldabi +# 20210921: remove cloudabi OLD_FILES+=usr/share/man/man4/cloudabi.4.gz # 20210906: stop installing {llvm,clang,lldb}-tblgen From owner-dev-commits-src-all@freebsd.org Sun Sep 26 13:18:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F14C5678785; Sun, 26 Sep 2021 13:18: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 4HHRD86Hmgz3tyH; Sun, 26 Sep 2021 13:18: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 B8ED01E44A; Sun, 26 Sep 2021 13:18: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 18QDIWnv096332; Sun, 26 Sep 2021 13:18:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QDIWe3096331; Sun, 26 Sep 2021 13:18:32 GMT (envelope-from git) Date: Sun, 26 Sep 2021 13:18:32 GMT Message-Id: <202109261318.18QDIWe3096331@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: d2e616147db7 - main - 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/main X-Git-Reftype: branch X-Git-Commit: d2e616147db7b688f2b6fa8ec6d545bc4253de92 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 13:18:33 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d2e616147db7b688f2b6fa8ec6d545bc4253de92 commit d2e616147db7b688f2b6fa8ec6d545bc4253de92 Author: Gordon Bergling AuthorDate: 2021-09-26 13:15:39 +0000 Commit: Gordon Bergling CommitDate: 2021-09-26 13:15:39 +0000 sctp: Fix a typo in a comment - s/assue/assume/ MFC after: 3 days --- 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 c0a976b84184..03305b539ad2 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -510,7 +510,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, /* * Cancel the INIT timer, We do this first before queueing the - * cookie. We always cancel at the primary to assue that we are + * cookie. We always cancel at the primary to assume that we are * canceling the timer started by the INIT which always goes to the * primary. */ From owner-dev-commits-src-all@freebsd.org Sun Sep 26 13:18:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F682678707; Sun, 26 Sep 2021 13:18: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 4HHRDB0B90z3tyK; Sun, 26 Sep 2021 13:18: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 D93141DD63; Sun, 26 Sep 2021 13:18: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 18QDIXjV096356; Sun, 26 Sep 2021 13:18:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QDIXul096355; Sun, 26 Sep 2021 13:18:33 GMT (envelope-from git) Date: Sun, 26 Sep 2021 13:18:33 GMT Message-Id: <202109261318.18QDIXul096355@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 90d60ca8b7f2 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 90d60ca8b7f2483cdc162633f7ea4738dad8fa0e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 13:18:34 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=90d60ca8b7f2483cdc162633f7ea4738dad8fa0e commit 90d60ca8b7f2483cdc162633f7ea4738dad8fa0e Author: Gordon Bergling AuthorDate: 2021-09-26 13:17:00 +0000 Commit: Gordon Bergling CommitDate: 2021-09-26 13:17:00 +0000 nfsclient: Fix a typo in a comment - s/derefernce/dereference/ MFC after: 3 days --- sys/fs/nfsclient/nfs_clcomsubs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clcomsubs.c b/sys/fs/nfsclient/nfs_clcomsubs.c index 554f5e820f54..c6556d287b1e 100644 --- a/sys/fs/nfsclient/nfs_clcomsubs.c +++ b/sys/fs/nfsclient/nfs_clcomsubs.c @@ -476,7 +476,7 @@ nfscl_lockunlock(struct nfsv4lock *lckp) } /* - * Called to derefernce a lock on a stateid (delegation or open owner). + * Called to dereference a lock on a stateid (delegation or open owner). */ void nfscl_lockderef(struct nfsv4lock *lckp) From owner-dev-commits-src-all@freebsd.org Sun Sep 26 13:18:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5634E678373; Sun, 26 Sep 2021 13:18: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 4HHRDC1mmNz3tmS; Sun, 26 Sep 2021 13:18: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 0412D1E4D3; Sun, 26 Sep 2021 13:18: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 18QDIYgV096380; Sun, 26 Sep 2021 13:18:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QDIYa5096379; Sun, 26 Sep 2021 13:18:34 GMT (envelope-from git) Date: Sun, 26 Sep 2021 13:18:34 GMT Message-Id: <202109261318.18QDIYa5096379@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 8771ff75384d - main - 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/main X-Git-Reftype: branch X-Git-Commit: 8771ff75384dec8c9f95ce25b6ca9a639c4b208c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 13:18:35 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=8771ff75384dec8c9f95ce25b6ca9a639c4b208c commit 8771ff75384dec8c9f95ce25b6ca9a639c4b208c Author: Gordon Bergling AuthorDate: 2021-09-26 13:17:41 +0000 Commit: Gordon Bergling CommitDate: 2021-09-26 13:17:41 +0000 jail(9): Fix a typo in a comment - s/erorr/error/ MFC after: 3 days --- sys/kern/kern_jail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 9784f3bfc23b..c13aa73538a5 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -1304,7 +1304,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) #endif /* * Allocate a dedicated cpuset for each jail. - * Unlike other initial settings, this may return an erorr. + * Unlike other initial settings, this may return an error. */ error = cpuset_create_root(ppr, &pr->pr_cpuset); if (error) From owner-dev-commits-src-all@freebsd.org Sun Sep 26 13:48:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D1C767954C; Sun, 26 Sep 2021 13:48:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HHRtj0Df4z4RGV; Sun, 26 Sep 2021 13:48:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D917A1E958; Sun, 26 Sep 2021 13:48:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18QDmSgC035744; Sun, 26 Sep 2021 13:48:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QDmSgX035743; Sun, 26 Sep 2021 13:48:28 GMT (envelope-from git) Date: Sun, 26 Sep 2021 13:48:28 GMT Message-Id: <202109261348.18QDmSgX035743@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: f7cef43aa9a3 - main - nemtap: lb app: Validate ihl field when hashing packet MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f7cef43aa9a357582a703c75dafa4a44c1b2f28c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 13:48:29 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=f7cef43aa9a357582a703c75dafa4a44c1b2f28c commit f7cef43aa9a357582a703c75dafa4a44c1b2f28c Author: Vincenzo Maffione AuthorDate: 2021-09-26 13:44:51 +0000 Commit: Vincenzo Maffione CommitDate: 2021-09-26 13:48:21 +0000 nemtap: lb app: Validate ihl field when hashing packet MFC after: 1 week --- tools/tools/netmap/pkt_hash.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/tools/netmap/pkt_hash.c b/tools/tools/netmap/pkt_hash.c index 3071935e11ef..eb9704fd2058 100644 --- a/tools/tools/netmap/pkt_hash.c +++ b/tools/tools/netmap/pkt_hash.c @@ -150,7 +150,9 @@ decode_ip_n_hash(const struct ip *iph, uint8_t hash_split, uint8_t seed) { uint32_t rc = 0; - if (hash_split == 2) { + if (iph->ip_hl < 5 || iph->ip_hl * 4 > iph->ip_len) { + rc = 0; + } else if (hash_split == 2) { rc = sym_hash_fn(ntohl(iph->ip_src.s_addr), ntohl(iph->ip_dst.s_addr), ntohs(0xFFFD) + seed, From owner-dev-commits-src-all@freebsd.org Sun Sep 26 14:08:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D3DE679B55; Sun, 26 Sep 2021 14:08: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 4HHSKs6Wtdz4SKn; Sun, 26 Sep 2021 14:08: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 B1D121EF17; Sun, 26 Sep 2021 14:08: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 18QE8XQu063144; Sun, 26 Sep 2021 14:08:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QE8XeU063143; Sun, 26 Sep 2021 14:08:33 GMT (envelope-from git) Date: Sun, 26 Sep 2021 14:08:33 GMT Message-Id: <202109261408.18QE8XeU063143@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 6127ce9d91c8 - main - netmap: monitor: support offsets in copy mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6127ce9d91c81e3025aeb1d832750d827e28314f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 14:08:34 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=6127ce9d91c81e3025aeb1d832750d827e28314f commit 6127ce9d91c81e3025aeb1d832750d827e28314f Author: Vincenzo Maffione AuthorDate: 2021-09-26 13:52:16 +0000 Commit: Vincenzo Maffione CommitDate: 2021-09-26 13:52:16 +0000 netmap: monitor: support offsets in copy mode --- sys/dev/netmap/netmap_monitor.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/dev/netmap/netmap_monitor.c b/sys/dev/netmap/netmap_monitor.c index 4827c2a7585f..e05313c1f792 100644 --- a/sys/dev/netmap/netmap_monitor.c +++ b/sys/dev/netmap/netmap_monitor.c @@ -737,8 +737,7 @@ netmap_monitor_parent_sync(struct netmap_kring *kring, u_int first_new, int new_ int free_slots, busy, sent = 0, m; u_int lim = kring->nkr_num_slots - 1; struct netmap_ring *ring = kring->ring, *mring = mkring->ring; - u_int max_len = NETMAP_BUF_SIZE(mkring->na); - + u_int max_len; mlim = mkring->nkr_num_slots - 1; /* we need to lock the monitor receive ring, since it @@ -770,9 +769,10 @@ netmap_monitor_parent_sync(struct netmap_kring *kring, u_int first_new, int new_ struct netmap_slot *s = &ring->slot[beg]; struct netmap_slot *ms = &mring->slot[i]; u_int copy_len = s->len; - char *src = NMB(kring->na, s), - *dst = NMB(mkring->na, ms); + char *src = NMB_O(kring, s), + *dst = NMB_O(mkring, ms); + max_len = NETMAP_BUF_SIZE(mkring->na) - nm_get_offset(mkring, ms); if (unlikely(copy_len > max_len)) { nm_prlim(5, "%s->%s: truncating %d to %d", kring->name, mkring->name, copy_len, max_len); @@ -966,7 +966,9 @@ netmap_get_monitor_na(struct nmreq_header *hdr, struct netmap_adapter **na, pna->monitor_id++); /* the monitor supports the host rings iff the parent does */ - mna->up.na_flags |= (pna->na_flags & NAF_HOST_RINGS); + mna->up.na_flags |= (pna->na_flags & NAF_HOST_RINGS) & ~NAF_OFFSETS; + if (!zcopy) + mna->up.na_flags |= NAF_OFFSETS; /* a do-nothing txsync: monitors cannot be used to inject packets */ mna->up.nm_txsync = netmap_monitor_txsync; mna->up.nm_rxsync = netmap_monitor_rxsync; From owner-dev-commits-src-all@freebsd.org Sun Sep 26 14:08:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 015CB679643; Sun, 26 Sep 2021 14:08: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 4HHSKt6cF4z4SK0; Sun, 26 Sep 2021 14:08: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 C3C961EF18; Sun, 26 Sep 2021 14:08: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 18QE8Ye3063168; Sun, 26 Sep 2021 14:08:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QE8Ykc063167; Sun, 26 Sep 2021 14:08:34 GMT (envelope-from git) Date: Sun, 26 Sep 2021 14:08:34 GMT Message-Id: <202109261408.18QE8Ykc063167@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 3e3314a8b7e3 - main - netmap: fix uint32_t overflow in pool size calculation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3e3314a8b7e3dd8d19a209ee2988f724e138a0ae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 14:08:35 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=3e3314a8b7e3dd8d19a209ee2988f724e138a0ae commit 3e3314a8b7e3dd8d19a209ee2988f724e138a0ae Author: Vincenzo Maffione AuthorDate: 2021-09-26 13:56:33 +0000 Commit: Vincenzo Maffione CommitDate: 2021-09-26 13:56:33 +0000 netmap: fix uint32_t overflow in pool size calculation MFC after: 1 week --- sys/dev/netmap/netmap_mem2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/netmap/netmap_mem2.c b/sys/dev/netmap/netmap_mem2.c index a6be490e5b09..2b41af761c04 100644 --- a/sys/dev/netmap/netmap_mem2.c +++ b/sys/dev/netmap/netmap_mem2.c @@ -1702,7 +1702,7 @@ _netmap_mem_private_new(size_t size, struct netmap_obj_params *p, int grp_id, nm_blueprint.pools[i].name, d->name); if (checksz) { - uint64_t poolsz = p[i].num * p[i].size; + uint64_t poolsz = (uint64_t)p[i].num * p[i].size; if (memtotal < poolsz) { nm_prerr("%s: request too large", d->pools[i].name); err = ENOMEM; From owner-dev-commits-src-all@freebsd.org Sun Sep 26 14:10:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3096667965F; Sun, 26 Sep 2021 14:10: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 4HHSNL0yzhz4SLq; Sun, 26 Sep 2021 14:10: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 01F651F075; Sun, 26 Sep 2021 14:10: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 18QEAfmb072199; Sun, 26 Sep 2021 14:10:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QEAfsE072186; Sun, 26 Sep 2021 14:10:41 GMT (envelope-from git) Date: Sun, 26 Sep 2021 14:10:41 GMT Message-Id: <202109261410.18QEAfsE072186@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vincenzo Maffione Subject: git: d61f95996174 - stable/13 - netmap: monitor: add a flag to distinguish packet direction MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d61f95996174d3068357f176532d5fdc946269af Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 14:10:42 -0000 The branch stable/13 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=d61f95996174d3068357f176532d5fdc946269af commit d61f95996174d3068357f176532d5fdc946269af Author: Vincenzo Maffione AuthorDate: 2021-03-29 16:32:54 +0000 Commit: Vincenzo Maffione CommitDate: 2021-09-26 14:00:04 +0000 netmap: monitor: add a flag to distinguish packet direction The netmap monitor intercepts any TX/RX packets on the monitored port. However, before this change there was no way to tell whether an intercepted packet was being transmitted or received on the monitored port. A TXMON flag in the netmap slot has been added for this purpose. (cherry picked from commit 660a47cb991d5a7ca69cd8dd9c09a5288d49e405) --- sys/dev/netmap/netmap_monitor.c | 8 ++++++-- sys/net/netmap.h | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/sys/dev/netmap/netmap_monitor.c b/sys/dev/netmap/netmap_monitor.c index 1f5ff65b3b81..9e5d57f7ff0f 100644 --- a/sys/dev/netmap/netmap_monitor.c +++ b/sys/dev/netmap/netmap_monitor.c @@ -38,6 +38,8 @@ * the traffic transiting on both the tx and rx corresponding rings in the * monitored adapter. During registration, the user can choose if she wants * to intercept tx only, rx only, or both tx and rx traffic. + * The slots containing traffic intercepted in the tx direction will have + * the NS_TXMON flag set. * * If the monitor is not able to cope with the stream of frames, excess traffic * will be dropped. @@ -590,6 +592,7 @@ netmap_zmon_parent_sync(struct netmap_kring *kring, int flags, enum txrx tx) u_int beg, end, i; u_int lim = kring->nkr_num_slots - 1, mlim; // = mkring->nkr_num_slots - 1; + uint16_t txmon = kring->tx == NR_TX ? NS_TXMON : 0; if (mkring == NULL) { nm_prlim(5, "NULL monitor on %s", kring->name); @@ -659,7 +662,7 @@ netmap_zmon_parent_sync(struct netmap_kring *kring, int flags, enum txrx tx) ms->len = s->len; s->len = tmp; - ms->flags = s->flags; + ms->flags = (s->flags & ~NS_TXMON) | txmon; s->flags |= NS_BUF_CHANGED; beg = nm_next(beg, lim); @@ -726,6 +729,7 @@ static void netmap_monitor_parent_sync(struct netmap_kring *kring, u_int first_new, int new_slots) { u_int j; + uint16_t txmon = kring->tx == NR_TX ? NS_TXMON : 0; for (j = 0; j < kring->n_monitors; j++) { struct netmap_kring *mkring = kring->monitors[j]; @@ -777,7 +781,7 @@ netmap_monitor_parent_sync(struct netmap_kring *kring, u_int first_new, int new_ memcpy(dst, src, copy_len); ms->len = copy_len; - ms->flags = s->flags; + ms->flags = (s->flags & ~NS_TXMON) | txmon; sent++; beg = nm_next(beg, lim); diff --git a/sys/net/netmap.h b/sys/net/netmap.h index c040683651d0..4d091ccc635d 100644 --- a/sys/net/netmap.h +++ b/sys/net/netmap.h @@ -219,6 +219,11 @@ struct netmap_slot { * The 'len' field refers to the individual fragment. */ +#define NS_TXMON 0x0040 + /* (monitor ports only) the packet comes from the TX + * ring of the monitored port + */ + #define NS_PORT_SHIFT 8 #define NS_PORT_MASK (0xff << NS_PORT_SHIFT) /* From owner-dev-commits-src-all@freebsd.org Sun Sep 26 14:12:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15314679D2D; Sun, 26 Sep 2021 14:12: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 4HHSQH03gnz4SRt; Sun, 26 Sep 2021 14:12: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 D600C1F184; Sun, 26 Sep 2021 14:12: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 18QECMcN074984; Sun, 26 Sep 2021 14:12:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QECMgI074983; Sun, 26 Sep 2021 14:12:22 GMT (envelope-from git) Date: Sun, 26 Sep 2021 14:12:22 GMT Message-Id: <202109261412.18QECMgI074983@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vincenzo Maffione Subject: git: 5faf08808d63 - stable/13 - libnetmap: reset errno in nmreq_register_decode() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5faf08808d63ec6724ea7b1bd8a34e2d61095829 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 14:12:23 -0000 The branch stable/13 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=5faf08808d63ec6724ea7b1bd8a34e2d61095829 commit 5faf08808d63ec6724ea7b1bd8a34e2d61095829 Author: Vincenzo Maffione AuthorDate: 2021-04-02 14:31:57 +0000 Commit: Vincenzo Maffione CommitDate: 2021-09-26 14:11:59 +0000 libnetmap: reset errno in nmreq_register_decode() The reset is necessary at the beginning of the function, because of the errno logic in the error path (set errno to EINVAL if not set). If errno is already set when calling the function, and the function fails, the previous errno value will be inherited. (cherry picked from commit ab639bb2873034786cd2ec4d2d9c4489fbf6f424) --- lib/libnetmap/nmreq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libnetmap/nmreq.c b/lib/libnetmap/nmreq.c index 7f4b2703d22d..31ddea91f6a5 100644 --- a/lib/libnetmap/nmreq.c +++ b/lib/libnetmap/nmreq.c @@ -257,6 +257,8 @@ nmreq_register_decode(const char **pifname, struct nmreq_register *r, struct nmc uint16_t nr_ringid; uint64_t nr_flags; + errno = 0; + /* fill the request */ p_state = P_START; From owner-dev-commits-src-all@freebsd.org Sun Sep 26 15:55:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7288667B259; Sun, 26 Sep 2021 15:55: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 4HHVjW2WXqz4d9R; Sun, 26 Sep 2021 15:55: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 37874205B7; Sun, 26 Sep 2021 15:55: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 18QFthBt008652; Sun, 26 Sep 2021 15:55:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QFthKQ008651; Sun, 26 Sep 2021 15:55:43 GMT (envelope-from git) Date: Sun, 26 Sep 2021 15:55:43 GMT Message-Id: <202109261555.18QFthKQ008651@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: 8694d0b7448d - stable/13 - freebsd32: Provide an ANSI definition for freebsd32_recvmsg() 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: 8694d0b7448d53f54e8fbc3604308a1c319a30c6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 15:55:43 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8694d0b7448d53f54e8fbc3604308a1c319a30c6 commit 8694d0b7448d53f54e8fbc3604308a1c319a30c6 Author: Mark Johnston AuthorDate: 2021-09-19 17:41:43 +0000 Commit: Mark Johnston CommitDate: 2021-09-26 15:55:01 +0000 freebsd32: Provide an ANSI definition for freebsd32_recvmsg() Fix style in the freebsd32_sendmsg() definition. Sponsored by: The FreeBSD Foundation (cherry picked from commit 4bda16ff184bfca5ee4bf9709a06323d9cf5945b) --- sys/compat/freebsd32/freebsd32_misc.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index c5bf67a72afd..a4ae014dbe85 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -1400,13 +1400,7 @@ exit: } int -freebsd32_recvmsg(td, uap) - struct thread *td; - struct freebsd32_recvmsg_args /* { - int s; - struct msghdr32 *msg; - int flags; - } */ *uap; +freebsd32_recvmsg(struct thread *td, struct freebsd32_recvmsg_args *uap) { struct msghdr msg; struct msghdr32 m32; @@ -1551,8 +1545,7 @@ out: } int -freebsd32_sendmsg(struct thread *td, - struct freebsd32_sendmsg_args *uap) +freebsd32_sendmsg(struct thread *td, struct freebsd32_sendmsg_args *uap) { struct msghdr msg; struct msghdr32 m32; From owner-dev-commits-src-all@freebsd.org Sun Sep 26 15:55:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A528B67B5AC; Sun, 26 Sep 2021 15:55:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HHVjX49wdz4dCk; Sun, 26 Sep 2021 15:55:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 650EF2042D; Sun, 26 Sep 2021 15:55:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18QFtiw2008676; Sun, 26 Sep 2021 15:55:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QFtipl008675; Sun, 26 Sep 2021 15:55:44 GMT (envelope-from git) Date: Sun, 26 Sep 2021 15:55:44 GMT Message-Id: <202109261555.18QFtipl008675@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: bcff2fdf8ee4 - stable/13 - freebsd32: Fix a double copyin in sendmsg() and recvmsg() 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: bcff2fdf8ee4b5053a5c7a7221879d2caf046b2b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 15:55:44 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bcff2fdf8ee4b5053a5c7a7221879d2caf046b2b commit bcff2fdf8ee4b5053a5c7a7221879d2caf046b2b Author: Mark Johnston AuthorDate: 2021-09-19 17:45:09 +0000 Commit: Mark Johnston CommitDate: 2021-09-26 15:55:05 +0000 freebsd32: Fix a double copyin in sendmsg() and recvmsg() freebsd32_sendmsg() and freebsd32_recvmsg() both copyin the message header twice, once directly and once in freebsd32_copyinmsghdr(). The iovec length from the former is used when copying in msg_iov, but the rest of the kernel uses the iovec length from the latter. When kern_sendit() and kern_recvit() iterate over the iovec to compute the residual for I/O, they can therefore end up walking past the end of the copied in iovec, either resulting in a system call error, userspace memory corruption from uiomove() with invalid iovecs, or a kernel page fault if the copied-in iovec is followed by an unmapped KVA region. Reported by: syzbot+7cc64cd0c49605acd421@syzkaller.appspotmail.com Reviewed by: kib, emaste Sponsored by: The FreeBSD Foundation (cherry picked from commit fea1a98ead918b39280b586773a923e76194400b) --- sys/compat/freebsd32/freebsd32_misc.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index a4ae014dbe85..fd5ef9171982 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -1403,19 +1403,15 @@ int freebsd32_recvmsg(struct thread *td, struct freebsd32_recvmsg_args *uap) { struct msghdr msg; - struct msghdr32 m32; struct iovec *uiov, *iov; struct mbuf *control = NULL; struct mbuf **controlp; - int error; - error = copyin(uap->msg, &m32, sizeof(m32)); - if (error) - return (error); + error = freebsd32_copyinmsghdr(uap->msg, &msg); if (error) return (error); - error = freebsd32_copyiniov(PTRIN(m32.msg_iov), m32.msg_iovlen, &iov, + error = freebsd32_copyiniov((void *)msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE); if (error) return (error); @@ -1548,19 +1544,15 @@ int freebsd32_sendmsg(struct thread *td, struct freebsd32_sendmsg_args *uap) { struct msghdr msg; - struct msghdr32 m32; struct iovec *iov; struct mbuf *control = NULL; struct sockaddr *to = NULL; int error; - error = copyin(uap->msg, &m32, sizeof(m32)); - if (error) - return (error); error = freebsd32_copyinmsghdr(uap->msg, &msg); if (error) return (error); - error = freebsd32_copyiniov(PTRIN(m32.msg_iov), m32.msg_iovlen, &iov, + error = freebsd32_copyiniov((void *)msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE); if (error) return (error); From owner-dev-commits-src-all@freebsd.org Sun Sep 26 15:56:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF1AE67B53B; Sun, 26 Sep 2021 15:56: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 4HHVkM4Yx8z4dSq; Sun, 26 Sep 2021 15:56: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 7C7572042E; Sun, 26 Sep 2021 15:56: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 18QFuRtN008853; Sun, 26 Sep 2021 15:56:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QFuRxH008852; Sun, 26 Sep 2021 15:56:27 GMT (envelope-from git) Date: Sun, 26 Sep 2021 15:56:27 GMT Message-Id: <202109261556.18QFuRxH008852@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: b87459f1355d - stable/12 - freebsd32: Provide an ANSI definition for freebsd32_recvmsg() 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: b87459f1355d6381b102b768f64f559c06719553 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 15:56:27 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b87459f1355d6381b102b768f64f559c06719553 commit b87459f1355d6381b102b768f64f559c06719553 Author: Mark Johnston AuthorDate: 2021-09-19 17:41:43 +0000 Commit: Mark Johnston CommitDate: 2021-09-26 15:56:11 +0000 freebsd32: Provide an ANSI definition for freebsd32_recvmsg() Fix style in the freebsd32_sendmsg() definition. Sponsored by: The FreeBSD Foundation (cherry picked from commit 4bda16ff184bfca5ee4bf9709a06323d9cf5945b) --- sys/compat/freebsd32/freebsd32_misc.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 2643333c51c2..fea30190e672 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -1201,13 +1201,7 @@ exit: } int -freebsd32_recvmsg(td, uap) - struct thread *td; - struct freebsd32_recvmsg_args /* { - int s; - struct msghdr32 *msg; - int flags; - } */ *uap; +freebsd32_recvmsg(struct thread *td, struct freebsd32_recvmsg_args *uap) { struct msghdr msg; struct msghdr32 m32; @@ -1352,8 +1346,7 @@ out: } int -freebsd32_sendmsg(struct thread *td, - struct freebsd32_sendmsg_args *uap) +freebsd32_sendmsg(struct thread *td, struct freebsd32_sendmsg_args *uap) { struct msghdr msg; struct msghdr32 m32; From owner-dev-commits-src-all@freebsd.org Sun Sep 26 15:56:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30D5867B3E3; Sun, 26 Sep 2021 15:56: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 4HHVkP0Chwz4dSx; Sun, 26 Sep 2021 15:56: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 AEF02205B8; Sun, 26 Sep 2021 15:56: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 18QFuSQK008884; Sun, 26 Sep 2021 15:56:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QFuSuq008883; Sun, 26 Sep 2021 15:56:28 GMT (envelope-from git) Date: Sun, 26 Sep 2021 15:56:28 GMT Message-Id: <202109261556.18QFuSuq008883@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: 0d2b77383b02 - stable/12 - freebsd32: Fix a double copyin in sendmsg() and recvmsg() 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: 0d2b77383b021646b91b90a4c2a0816af5688553 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 15:56:29 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0d2b77383b021646b91b90a4c2a0816af5688553 commit 0d2b77383b021646b91b90a4c2a0816af5688553 Author: Mark Johnston AuthorDate: 2021-09-19 17:45:09 +0000 Commit: Mark Johnston CommitDate: 2021-09-26 15:56:11 +0000 freebsd32: Fix a double copyin in sendmsg() and recvmsg() freebsd32_sendmsg() and freebsd32_recvmsg() both copyin the message header twice, once directly and once in freebsd32_copyinmsghdr(). The iovec length from the former is used when copying in msg_iov, but the rest of the kernel uses the iovec length from the latter. When kern_sendit() and kern_recvit() iterate over the iovec to compute the residual for I/O, they can therefore end up walking past the end of the copied in iovec, either resulting in a system call error, userspace memory corruption from uiomove() with invalid iovecs, or a kernel page fault if the copied-in iovec is followed by an unmapped KVA region. Reported by: syzbot+7cc64cd0c49605acd421@syzkaller.appspotmail.com Reviewed by: kib, emaste Sponsored by: The FreeBSD Foundation (cherry picked from commit fea1a98ead918b39280b586773a923e76194400b) --- sys/compat/freebsd32/freebsd32_misc.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index fea30190e672..68a17f4fb004 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -1204,19 +1204,15 @@ int freebsd32_recvmsg(struct thread *td, struct freebsd32_recvmsg_args *uap) { struct msghdr msg; - struct msghdr32 m32; struct iovec *uiov, *iov; struct mbuf *control = NULL; struct mbuf **controlp; - int error; - error = copyin(uap->msg, &m32, sizeof(m32)); - if (error) - return (error); + error = freebsd32_copyinmsghdr(uap->msg, &msg); if (error) return (error); - error = freebsd32_copyiniov(PTRIN(m32.msg_iov), m32.msg_iovlen, &iov, + error = freebsd32_copyiniov((void *)msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE); if (error) return (error); @@ -1349,19 +1345,15 @@ int freebsd32_sendmsg(struct thread *td, struct freebsd32_sendmsg_args *uap) { struct msghdr msg; - struct msghdr32 m32; struct iovec *iov; struct mbuf *control = NULL; struct sockaddr *to = NULL; int error; - error = copyin(uap->msg, &m32, sizeof(m32)); - if (error) - return (error); error = freebsd32_copyinmsghdr(uap->msg, &msg); if (error) return (error); - error = freebsd32_copyiniov(PTRIN(m32.msg_iov), m32.msg_iovlen, &iov, + error = freebsd32_copyiniov((void *)msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE); if (error) return (error); From owner-dev-commits-src-all@freebsd.org Sun Sep 26 16:10:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB71D67BAB6; Sun, 26 Sep 2021 16:10: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 4HHW2t585Yz4fQ3; Sun, 26 Sep 2021 16:10: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 91B29207D5; Sun, 26 Sep 2021 16:10: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 18QGAkPW031250; Sun, 26 Sep 2021 16:10:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QGAkpq031249; Sun, 26 Sep 2021 16:10:46 GMT (envelope-from git) Date: Sun, 26 Sep 2021 16:10:46 GMT Message-Id: <202109261610.18QGAkpq031249@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 08063e9f98a3 - main - sched_ule(4): Fix hang with steal_thresh < 2. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 08063e9f98a33980a09e3bd465926719b3437122 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 16:10:46 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=08063e9f98a33980a09e3bd465926719b3437122 commit 08063e9f98a33980a09e3bd465926719b3437122 Author: Alexander Motin AuthorDate: 2021-09-26 16:03:05 +0000 Commit: Alexander Motin CommitDate: 2021-09-26 16:03:05 +0000 sched_ule(4): Fix hang with steal_thresh < 2. e745d729be60 caused infinite loop with interrupts disabled in load stealing code if steal_thresh set below 2. Such configuration should not generally be used, but appeared some people are using it to workaround some problems. To fix the problem explicitly pass to sched_highest() minimum number of transferrable threads, supported by the caller, instead of guessing. MFC after: 25 days --- sys/kern/sched_ule.c | 70 +++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 49199b6f319f..0f873a6a30b6 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -638,12 +638,13 @@ struct cpu_search { int cs_prefer; /* Prefer this CPU and groups including it. */ int cs_running; /* The thread is now running at cs_prefer. */ int cs_pri; /* Min priority for low. */ - int cs_limit; /* Max load for low, min load for high. */ + int cs_load; /* Max load for low, min load for high. */ + int cs_trans; /* Min transferable load for high. */ }; struct cpu_search_res { - int cs_cpu; /* The best CPU found. */ - int cs_load; /* The load of cs_cpu. */ + int csr_cpu; /* The best CPU found. */ + int csr_load; /* The load of cs_cpu. */ }; /* @@ -663,7 +664,7 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, total = 0; bload = INT_MAX; - r->cs_cpu = -1; + r->csr_cpu = -1; /* Loop through children CPU groups if there are any. */ if (cg->cg_children > 0) { @@ -681,11 +682,11 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, load >= 128 && (load & 128) != 0) load += 128; - if (lr.cs_cpu >= 0 && (load < bload || - (load == bload && lr.cs_load < r->cs_load))) { + if (lr.csr_cpu >= 0 && (load < bload || + (load == bload && lr.csr_load < r->csr_load))) { bload = load; - r->cs_cpu = lr.cs_cpu; - r->cs_load = lr.cs_load; + r->csr_cpu = lr.csr_cpu; + r->csr_load = lr.csr_load; } } return (total); @@ -711,7 +712,7 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, * If the threads is already on the CPU, don't look on the TDQ * priority, since it can be the priority of the thread itself. */ - if (l > s->cs_limit || (tdq->tdq_lowpri <= s->cs_pri && + if (l > s->cs_load || (tdq->tdq_lowpri <= s->cs_pri && (!s->cs_running || c != s->cs_prefer)) || !CPU_ISSET(c, s->cs_mask)) continue; @@ -727,8 +728,8 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, load -= sched_random() % 128; if (bload > load - p) { bload = load - p; - r->cs_cpu = c; - r->cs_load = load; + r->csr_cpu = c; + r->csr_load = load; } } return (total); @@ -744,18 +745,18 @@ cpu_search_highest(const struct cpu_group *cg, const struct cpu_search *s, total = 0; bload = INT_MIN; - r->cs_cpu = -1; + r->csr_cpu = -1; /* Loop through children CPU groups if there are any. */ if (cg->cg_children > 0) { for (c = cg->cg_children - 1; c >= 0; c--) { load = cpu_search_highest(&cg->cg_child[c], s, &lr); total += load; - if (lr.cs_cpu >= 0 && (load > bload || - (load == bload && lr.cs_load > r->cs_load))) { + if (lr.csr_cpu >= 0 && (load > bload || + (load == bload && lr.csr_load > r->csr_load))) { bload = load; - r->cs_cpu = lr.cs_cpu; - r->cs_load = lr.cs_load; + r->csr_cpu = lr.csr_cpu; + r->csr_load = lr.csr_load; } } return (total); @@ -772,21 +773,18 @@ cpu_search_highest(const struct cpu_group *cg, const struct cpu_search *s, /* * Check this CPU is acceptable. - * If requested minimum load is 1, then caller must know how - * to handle running threads, not counted in tdq_transferable. */ - if (l < s->cs_limit || (tdq->tdq_transferable == 0 && - (s->cs_limit > 1 || l > 1)) || + if (l < s->cs_load || (tdq->tdq_transferable < s->cs_trans) || !CPU_ISSET(c, s->cs_mask)) continue; load -= sched_random() % 256; if (load > bload) { bload = load; - r->cs_cpu = c; + r->csr_cpu = c; } } - r->cs_load = bload; + r->csr_load = bload; return (total); } @@ -806,24 +804,26 @@ sched_lowest(const struct cpu_group *cg, cpuset_t *mask, int pri, int maxload, s.cs_running = running; s.cs_mask = mask; s.cs_pri = pri; - s.cs_limit = maxload; + s.cs_load = maxload; cpu_search_lowest(cg, &s, &r); - return (r.cs_cpu); + return (r.csr_cpu); } /* * Find the cpu with the highest load via the highest loaded path. */ static inline int -sched_highest(const struct cpu_group *cg, cpuset_t *mask, int minload) +sched_highest(const struct cpu_group *cg, cpuset_t *mask, int minload, + int mintrans) { struct cpu_search s; struct cpu_search_res r; s.cs_mask = mask; - s.cs_limit = minload; + s.cs_load = minload; + s.cs_trans = mintrans; cpu_search_highest(cg, &s, &r); - return (r.cs_cpu); + return (r.csr_cpu); } static void @@ -836,7 +836,7 @@ sched_balance_group(struct cpu_group *cg) CPU_FILL(&hmask); for (;;) { - high = sched_highest(cg, &hmask, 1); + high = sched_highest(cg, &hmask, 1, 0); /* Stop if there is no more CPU with transferrable threads. */ if (high == -1) break; @@ -1008,7 +1008,7 @@ tdq_idled(struct tdq *tdq) restart: switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt; for (cg = tdq->tdq_cg, goup = 0; ; ) { - cpu = sched_highest(cg, &mask, steal_thresh); + cpu = sched_highest(cg, &mask, steal_thresh, 1); /* * We were assigned a thread but not preempted. Returning * 0 here will cause our caller to switch to it. @@ -1968,7 +1968,8 @@ tdq_trysteal(struct tdq *tdq) cpuset_t mask; int cpu, i, goup; - if (smp_started == 0 || trysteal_limit == 0 || tdq->tdq_cg == NULL) + if (smp_started == 0 || steal_idle == 0 || trysteal_limit == 0 || + tdq->tdq_cg == NULL) return; CPU_FILL(&mask); CPU_CLR(PCPU_GET(cpuid), &mask); @@ -1976,7 +1977,7 @@ tdq_trysteal(struct tdq *tdq) spinlock_enter(); TDQ_UNLOCK(tdq); for (i = 1, cg = tdq->tdq_cg, goup = 0; ; ) { - cpu = sched_highest(cg, &mask, steal_thresh); + cpu = sched_highest(cg, &mask, steal_thresh, 1); /* * If a thread was added while interrupts were disabled don't * steal one here. @@ -2019,7 +2020,9 @@ tdq_trysteal(struct tdq *tdq) steal = TDQ_CPU(cpu); /* * The data returned by sched_highest() is stale and - * the chosen CPU no longer has an eligible thread. + * the chosen CPU no longer has an eligible thread. + * At this point unconditonally exit the loop to bound + * the time spent in the critcal section. */ if (steal->tdq_load < steal_thresh || steal->tdq_transferable == 0) @@ -2028,8 +2031,7 @@ tdq_trysteal(struct tdq *tdq) * Try to lock both queues. If we are assigned a thread while * waited for the lock, switch to it now instead of stealing. * If we can't get the lock, then somebody likely got there - * first. At this point unconditonally exit the loop to - * bound the time spent in the critcal section. + * first. */ TDQ_LOCK(tdq); if (tdq->tdq_load > 0) From owner-dev-commits-src-all@freebsd.org Sun Sep 26 16:25:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8F7167C043; Sun, 26 Sep 2021 16:25: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 4HHWNM58vZz4gmM; Sun, 26 Sep 2021 16:25: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 8D02C209FF; Sun, 26 Sep 2021 16:25: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 18QGPtw7049487; Sun, 26 Sep 2021 16:25:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QGPtfX049486; Sun, 26 Sep 2021 16:25:55 GMT (envelope-from git) Date: Sun, 26 Sep 2021 16:25:55 GMT Message-Id: <202109261625.18QGPtfX049486@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 21ab8c75c940 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 21ab8c75c940dd15343b4af28b18a66f377e670a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 16:25:56 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=21ab8c75c940dd15343b4af28b18a66f377e670a commit 21ab8c75c940dd15343b4af28b18a66f377e670a Author: Kevin Bowling AuthorDate: 2021-09-26 16:24:53 +0000 Commit: Kevin Bowling CommitDate: 2021-09-26 16:24:53 +0000 e1000: Fix tabstop width in if_em.h Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D32145 --- sys/dev/e1000/if_em.h | 236 +++++++++++++++++++++++++------------------------- 1 file changed, 118 insertions(+), 118 deletions(-) diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h index 7f259abfd9a6..41deecb69bf3 100644 --- a/sys/dev/e1000/if_em.h +++ b/sys/dev/e1000/if_em.h @@ -111,11 +111,11 @@ * desscriptors should meet the following condition. * (num_tx_desc * sizeof(struct e1000_tx_desc)) % 128 == 0 */ -#define EM_MIN_TXD 128 -#define EM_MAX_TXD 4096 -#define EM_DEFAULT_TXD 1024 +#define EM_MIN_TXD 128 +#define EM_MAX_TXD 4096 +#define EM_DEFAULT_TXD 1024 #define EM_DEFAULT_MULTI_TXD 4096 -#define IGB_MAX_TXD 4096 +#define IGB_MAX_TXD 4096 /* * EM_MAX_RXD - Maximum number of receive Descriptors @@ -130,11 +130,11 @@ * desscriptors should meet the following condition. * (num_tx_desc * sizeof(struct e1000_tx_desc)) % 128 == 0 */ -#define EM_MIN_RXD 128 -#define EM_MAX_RXD 4096 -#define EM_DEFAULT_RXD 1024 +#define EM_MIN_RXD 128 +#define EM_MAX_RXD 4096 +#define EM_DEFAULT_RXD 1024 #define EM_DEFAULT_MULTI_RXD 4096 -#define IGB_MAX_RXD 4096 +#define IGB_MAX_RXD 4096 /* * EM_TIDV - Transmit Interrupt Delay Value @@ -201,7 +201,7 @@ * 0 - Disable autonegotiation * 1 - Enable autonegotiation */ -#define DO_AUTO_NEG 1 +#define DO_AUTO_NEG 1 /* * This parameter control whether or not the driver will wait for @@ -214,8 +214,8 @@ /* Tunables -- End */ #define AUTONEG_ADV_DEFAULT (ADVERTISE_10_HALF | ADVERTISE_10_FULL | \ - ADVERTISE_100_HALF | ADVERTISE_100_FULL | \ - ADVERTISE_1000_FULL) + ADVERTISE_100_HALF | ADVERTISE_100_FULL | \ + ADVERTISE_1000_FULL) #define AUTO_ALL_MODES 0 @@ -225,35 +225,35 @@ /* * Miscellaneous constants */ -#define EM_VENDOR_ID 0x8086 -#define EM_FLASH 0x0014 +#define EM_VENDOR_ID 0x8086 +#define EM_FLASH 0x0014 -#define EM_JUMBO_PBA 0x00000028 -#define EM_DEFAULT_PBA 0x00000030 +#define EM_JUMBO_PBA 0x00000028 +#define EM_DEFAULT_PBA 0x00000030 #define EM_SMARTSPEED_DOWNSHIFT 3 -#define EM_SMARTSPEED_MAX 15 -#define EM_MAX_LOOP 10 +#define EM_SMARTSPEED_MAX 15 +#define EM_MAX_LOOP 10 #define MAX_NUM_MULTICAST_ADDRESSES 128 -#define PCI_ANY_ID (~0U) -#define ETHER_ALIGN 2 -#define EM_FC_PAUSE_TIME 0x0680 -#define EM_EEPROM_APME 0x400; -#define EM_82544_APME 0x0004; +#define PCI_ANY_ID (~0U) +#define ETHER_ALIGN 2 +#define EM_FC_PAUSE_TIME 0x0680 +#define EM_EEPROM_APME 0x400; +#define EM_82544_APME 0x0004; /* Support AutoMediaDetect for Marvell M88 PHY in i354 */ -#define IGB_MEDIA_RESET (1 << 0) +#define IGB_MEDIA_RESET (1 << 0) /* Define the starting Interrupt rate per Queue */ -#define IGB_INTS_PER_SEC 8000 -#define IGB_DEFAULT_ITR ((1000000/IGB_INTS_PER_SEC) << 2) +#define IGB_INTS_PER_SEC 8000 +#define IGB_DEFAULT_ITR ((1000000/IGB_INTS_PER_SEC) << 2) -#define IGB_LINK_ITR 2000 -#define I210_LINK_DELAY 1000 +#define IGB_LINK_ITR 2000 +#define I210_LINK_DELAY 1000 -#define IGB_TXPBSIZE 20408 -#define IGB_HDR_BUF 128 -#define IGB_PKTTYPE_MASK 0x0000FFF0 +#define IGB_TXPBSIZE 20408 +#define IGB_HDR_BUF 128 +#define IGB_PKTTYPE_MASK 0x0000FFF0 #define IGB_DMCTLX_DCFLUSH_DIS 0x80000000 /* Disable DMA Coalesce Flush */ /* @@ -265,25 +265,25 @@ * and compare to TX_MAXTRIES. When counter > TX_MAXTRIES, * reset adapter. */ -#define EM_TX_IDLE 0x00000000 -#define EM_TX_BUSY 0x00000001 -#define EM_TX_HUNG 0x80000000 +#define EM_TX_IDLE 0x00000000 +#define EM_TX_BUSY 0x00000001 +#define EM_TX_HUNG 0x80000000 #define EM_TX_MAXTRIES 10 -#define PCICFG_DESC_RING_STATUS 0xe4 -#define FLUSH_DESC_REQUIRED 0x100 +#define PCICFG_DESC_RING_STATUS 0xe4 +#define FLUSH_DESC_REQUIRED 0x100 -#define IGB_RX_PTHRESH ((hw->mac.type == e1000_i354) ? 12 : \ - ((hw->mac.type <= e1000_82576) ? 16 : 8)) -#define IGB_RX_HTHRESH 8 -#define IGB_RX_WTHRESH ((hw->mac.type == e1000_82576 && \ - (sc->intr_type == IFLIB_INTR_MSIX)) ? 1 : 4) +#define IGB_RX_PTHRESH ((hw->mac.type == e1000_i354) ? 12 : \ + ((hw->mac.type <= e1000_82576) ? 16 : 8)) +#define IGB_RX_HTHRESH 8 +#define IGB_RX_WTHRESH ((hw->mac.type == e1000_82576 && \ + (sc->intr_type == IFLIB_INTR_MSIX)) ? 1 : 4) -#define IGB_TX_PTHRESH ((hw->mac.type == e1000_i354) ? 20 : 8) -#define IGB_TX_HTHRESH 1 -#define IGB_TX_WTHRESH ((hw->mac.type != e1000_82575 && \ - sc->intr_type == IFLIB_INTR_MSIX) ? 1 : 16) +#define IGB_TX_PTHRESH ((hw->mac.type == e1000_i354) ? 20 : 8) +#define IGB_TX_HTHRESH 1 +#define IGB_TX_WTHRESH ((hw->mac.type != e1000_82575 && \ + sc->intr_type == IFLIB_INTR_MSIX) ? 1 : 16) /* * TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be @@ -297,10 +297,10 @@ */ #define TARC_COMPENSATION_MODE (1 << 7) /* Compensation Mode */ #define TARC_SPEED_MODE_BIT (1 << 21) /* On PCI-E MACs only */ -#define TARC_MQ_FIX (1 << 23) | \ - (1 << 24) | \ - (1 << 25) /* Handle errata in MQ mode */ -#define TARC_ERRATA_BIT (1 << 26) /* Note from errata on 82574 */ +#define TARC_MQ_FIX (1 << 23) | \ + (1 << 24) | \ + (1 << 25) /* Handle errata in MQ mode */ +#define TARC_ERRATA_BIT (1 << 26) /* Note from errata on 82574 */ /* PCI Config defines */ #define EM_BAR_TYPE(v) ((v) & EM_BAR_TYPE_MASK) @@ -318,27 +318,27 @@ #define DEBUG_IOCTL 0 #define DEBUG_HW 0 -#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n") +#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n") #define INIT_DEBUGOUT1(S, A) if (DEBUG_INIT) printf(S "\n", A) #define INIT_DEBUGOUT2(S, A, B) if (DEBUG_INIT) printf(S "\n", A, B) -#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n") +#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n") #define IOCTL_DEBUGOUT1(S, A) if (DEBUG_IOCTL) printf(S "\n", A) #define IOCTL_DEBUGOUT2(S, A, B) if (DEBUG_IOCTL) printf(S "\n", A, B) -#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n") -#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) +#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n") +#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) #define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B) #define EM_MAX_SCATTER 40 #define EM_VFTA_SIZE 128 -#define EM_TSO_SIZE 65535 +#define EM_TSO_SIZE 65535 #define EM_TSO_SEG_SIZE 4096 /* Max dma segment size */ -#define ETH_ZLEN 60 +#define ETH_ZLEN 60 #define EM_CSUM_OFFLOAD (CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP) /* Offload bits in mbuf flag */ #define IGB_CSUM_OFFLOAD (CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP | \ - CSUM_IP_SCTP | CSUM_IP6_UDP | CSUM_IP6_TCP | \ - CSUM_IP6_SCTP) /* Offload bits in mbuf flag */ + CSUM_IP_SCTP | CSUM_IP6_UDP | CSUM_IP6_TCP | \ + CSUM_IP6_SCTP) /* Offload bits in mbuf flag */ -#define IGB_PKTTYPE_MASK 0x0000FFF0 +#define IGB_PKTTYPE_MASK 0x0000FFF0 #define IGB_DMCTLX_DCFLUSH_DIS 0x80000000 /* Disable DMA Coalesce Flush */ /* @@ -361,15 +361,15 @@ struct e1000_softc; struct em_int_delay_info { struct e1000_softc *sc; /* Back-pointer to the sc struct */ - int offset; /* Register offset to read/write */ - int value; /* Current value in usecs */ + int offset; /* Register offset to read/write */ + int value; /* Current value in usecs */ }; /* * The transmit ring, one per tx queue */ struct tx_ring { - struct e1000_softc *sc; + struct e1000_softc *sc; struct e1000_tx_desc *tx_base; uint64_t tx_paddr; qidx_t *tx_rsq; @@ -380,8 +380,8 @@ struct tx_ring { qidx_t tx_cidx_processed; /* Interrupt resources */ void *tag; - struct resource *res; - unsigned long tx_irq; + struct resource *res; + unsigned long tx_irq; /* Saved csum offloading context information */ int csum_flags; @@ -402,10 +402,10 @@ struct tx_ring { struct rx_ring { struct e1000_softc *sc; struct em_rx_queue *que; - u32 me; - u32 payload; + u32 me; + u32 payload; union e1000_rx_desc_extended *rx_base; - uint64_t rx_paddr; + uint64_t rx_paddr; /* Interrupt resources */ void *tag; @@ -421,36 +421,36 @@ struct rx_ring { struct em_tx_queue { struct e1000_softc *sc; - u32 msix; - u32 eims; /* This queue's EIMS bit */ - u32 me; + u32 msix; + u32 eims; /* This queue's EIMS bit */ + u32 me; struct tx_ring txr; }; struct em_rx_queue { struct e1000_softc *sc; - u32 me; - u32 msix; - u32 eims; + u32 me; + u32 msix; + u32 eims; struct rx_ring rxr; - u64 irqs; + u64 irqs; struct if_irq que_irq; }; /* Our softc structure */ struct e1000_softc { - struct ifnet *ifp; - struct e1000_hw hw; + struct ifnet *ifp; + struct e1000_hw hw; - if_softc_ctx_t shared; - if_ctx_t ctx; -#define tx_num_queues shared->isc_ntxqsets -#define rx_num_queues shared->isc_nrxqsets + if_softc_ctx_t shared; + if_ctx_t ctx; +#define tx_num_queues shared->isc_ntxqsets +#define rx_num_queues shared->isc_nrxqsets #define intr_type shared->isc_intr /* FreeBSD operating-system-specific structures. */ struct e1000_osdep osdep; - device_t dev; - struct cdev *led_dev; + device_t dev; + struct cdev *led_dev; struct em_tx_queue *tx_queues; struct em_rx_queue *rx_queues; @@ -461,35 +461,35 @@ struct e1000_softc { struct resource *ioport; struct resource *res; - void *tag; - u32 linkvec; - u32 ivars; - - struct ifmedia *media; - int msix; - int if_flags; - int em_insert_vlan_header; - u32 ims; + void *tag; + u32 linkvec; + u32 ivars; + + struct ifmedia *media; + int msix; + int if_flags; + int em_insert_vlan_header; + u32 ims; bool in_detach; - u32 flags; + u32 flags; /* Task for FAST handling */ struct grouptask link_task; - u16 num_vlans; - u32 txd_cmd; + u16 num_vlans; + u32 txd_cmd; - u32 tx_process_limit; - u32 rx_process_limit; - u32 rx_mbuf_sz; + u32 tx_process_limit; + u32 rx_process_limit; + u32 rx_mbuf_sz; /* Management and WOL features */ - u32 wol; - bool has_manage; - bool has_amt; + u32 wol; + bool has_manage; + bool has_amt; /* Multicast array memory */ - u8 *mta; + u8 *mta; /* ** Shadow VFTA table, this is needed because @@ -497,18 +497,18 @@ struct e1000_softc { ** a soft reset and the driver needs to be able ** to repopulate it. */ - u32 shadow_vfta[EM_VFTA_SIZE]; + u32 shadow_vfta[EM_VFTA_SIZE]; /* Info about the interface */ - u16 link_active; - u16 fc; - u16 link_speed; - u16 link_duplex; - u32 smartspeed; - u32 dmac; - int link_mask; + u16 link_active; + u16 fc; + u16 link_speed; + u16 link_duplex; + u32 smartspeed; + u32 dmac; + int link_mask; - u64 que_mask; + u64 que_mask; struct em_int_delay_info tx_int_delay; struct em_int_delay_info tx_abs_int_delay; @@ -517,13 +517,13 @@ struct e1000_softc { struct em_int_delay_info tx_itr; /* Misc stats maintained by the driver */ - unsigned long dropped_pkts; - unsigned long link_irq; - unsigned long rx_overruns; - unsigned long watchdog_events; + unsigned long dropped_pkts; + unsigned long link_irq; + unsigned long rx_overruns; + unsigned long watchdog_events; - struct e1000_hw_stats stats; - u16 vf_ifp; + struct e1000_hw_stats stats; + u16 vf_ifp; }; /******************************************************************************** @@ -544,8 +544,8 @@ typedef struct _em_vendor_info_t { void em_dump_rs(struct e1000_softc *); #define EM_RSSRK_SIZE 4 -#define EM_RSSRK_VAL(key, i) (key[(i) * EM_RSSRK_SIZE] | \ - key[(i) * EM_RSSRK_SIZE + 1] << 8 | \ - key[(i) * EM_RSSRK_SIZE + 2] << 16 | \ - key[(i) * EM_RSSRK_SIZE + 3] << 24) +#define EM_RSSRK_VAL(key, i) (key[(i) * EM_RSSRK_SIZE] | \ + key[(i) * EM_RSSRK_SIZE + 1] << 8 | \ + key[(i) * EM_RSSRK_SIZE + 2] << 16 | \ + key[(i) * EM_RSSRK_SIZE + 3] << 24) #endif /* _EM_H_DEFINED_ */ From owner-dev-commits-src-all@freebsd.org Sun Sep 26 18:18:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5DE8567D0CC; Sun, 26 Sep 2021 18:18: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 4HHYtl23X2z4q8q; Sun, 26 Sep 2021 18:18: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 2245422507; Sun, 26 Sep 2021 18:18: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 18QIItgp096012; Sun, 26 Sep 2021 18:18:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QIIs35096011; Sun, 26 Sep 2021 18:18:54 GMT (envelope-from git) Date: Sun, 26 Sep 2021 18:18:54 GMT Message-Id: <202109261818.18QIIs35096011@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: b1d5caf3c750 - main - 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/main X-Git-Reftype: branch X-Git-Commit: b1d5caf3c7504a1ece0498ec3f7360ac760577f7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 18:18:55 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=b1d5caf3c7504a1ece0498ec3f7360ac760577f7 commit b1d5caf3c7504a1ece0498ec3f7360ac760577f7 Author: Kevin Bowling AuthorDate: 2021-09-25 23:12:23 +0000 Commit: Kevin Bowling CommitDate: 2021-09-26 18:18:07 +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 --- 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); } else { @@ -574,7 +569,7 @@ ixgbe_initialize_rss_mapping(struct adapter *adapter) *** 5363 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Sep 26 18:32:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31BF267DCA9; Sun, 26 Sep 2021 18:32: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 4HHZB50rN2z4rLK; Sun, 26 Sep 2021 18:32: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 EEDC0225C9; Sun, 26 Sep 2021 18:32:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18QIWCCw021884; Sun, 26 Sep 2021 18:32:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QIWCMK021883; Sun, 26 Sep 2021 18:32:12 GMT (envelope-from git) Date: Sun, 26 Sep 2021 18:32:12 GMT Message-Id: <202109261832.18QIWCMK021883@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 15d077995bd2 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 15d077995bd2c56b7b1742ea2d4e9070ff7e9427 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 18:32:13 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=15d077995bd2c56b7b1742ea2d4e9070ff7e9427 commit 15d077995bd2c56b7b1742ea2d4e9070ff7e9427 Author: Kevin Bowling AuthorDate: 2021-09-26 18:29:00 +0000 Commit: Kevin Bowling CommitDate: 2021-09-26 18:29:02 +0000 ixgbe: whitespace cleanup pass Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32131 --- 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