From owner-dev-commits-src-main@freebsd.org Mon Jul 12 00:17:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E05164AC37; Mon, 12 Jul 2021 00:17: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 4GNPTp713hz4dvV; Mon, 12 Jul 2021 00:17: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 D3BCF24F57; Mon, 12 Jul 2021 00:17: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 16C0HIVa066135; Mon, 12 Jul 2021 00:17:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16C0HIL2066134; Mon, 12 Jul 2021 00:17:18 GMT (envelope-from git) Date: Mon, 12 Jul 2021 00:17:18 GMT Message-Id: <202107120017.16C0HIL2066134@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Grehan Subject: git: 517904de5cca - main - igc(4): Introduce new driver for the Intel I225 Ethernet controller. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: grehan X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 517904de5ccac643589c71ac0d2751797f89e4f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 00:17:19 -0000 The branch main has been updated by grehan: URL: https://cgit.FreeBSD.org/src/commit/?id=517904de5ccac643589c71ac0d2751797f89e4f9 commit 517904de5ccac643589c71ac0d2751797f89e4f9 Author: Peter Grehan AuthorDate: 2021-07-12 04:50:15 +0000 Commit: Peter Grehan CommitDate: 2021-07-12 04:57:18 +0000 igc(4): Introduce new driver for the Intel I225 Ethernet controller. This controller supports 2.5G/1G/100MB/10MB speeds, and allows tx/rx checksum offload, TSO, LRO, and multi-queue operation. The driver was derived from code contributed by Intel, and modified by Netgate to fit into the iflib framework. Thanks to Mike Karels for testing and feedback on the driver. Reviewed by: bcr (manpages), kbowling, scottl, erj MFC after: 1 month Relnotes: yes Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30668 --- share/man/man4/Makefile | 2 + share/man/man4/igc.4 | 167 +++ sys/amd64/conf/GENERIC | 1 + sys/amd64/conf/NOTES | 2 + sys/conf/files | 8 + sys/dev/igc/if_igc.c | 2984 +++++++++++++++++++++++++++++++++++++++++++++ sys/dev/igc/if_igc.h | 430 +++++++ sys/dev/igc/igc_api.c | 735 +++++++++++ sys/dev/igc/igc_api.h | 58 + sys/dev/igc/igc_base.c | 188 +++ sys/dev/igc/igc_base.h | 131 ++ sys/dev/igc/igc_defines.h | 1347 ++++++++++++++++++++ sys/dev/igc/igc_hw.h | 548 +++++++++ sys/dev/igc/igc_i225.c | 1232 +++++++++++++++++++ sys/dev/igc/igc_i225.h | 112 ++ sys/dev/igc/igc_mac.c | 1050 ++++++++++++++++ sys/dev/igc/igc_mac.h | 48 + sys/dev/igc/igc_nvm.c | 721 +++++++++++ sys/dev/igc/igc_nvm.h | 32 + sys/dev/igc/igc_osdep.h | 133 ++ sys/dev/igc/igc_phy.c | 1109 +++++++++++++++++ sys/dev/igc/igc_phy.h | 134 ++ sys/dev/igc/igc_regs.h | 424 +++++++ sys/dev/igc/igc_txrx.c | 580 +++++++++ sys/i386/conf/GENERIC | 1 + sys/i386/conf/NOTES | 2 + sys/modules/Makefile | 2 + sys/modules/igc/Makefile | 11 + 28 files changed, 12192 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 9027fe7df841..71a0d37631c5 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -224,6 +224,7 @@ MAN= aac.4 \ iicmux.4 \ iicsmb.4 \ iir.4 \ + ${_igc.4} \ ${_imcsmb.4} \ inet.4 \ inet6.4 \ @@ -814,6 +815,7 @@ _if_nfe.4= if_nfe.4 _if_urtw.4= if_urtw.4 _if_vmx.4= if_vmx.4 _if_wpi.4= if_wpi.4 +_igc.4= igc.4 _imcsmb.4= imcsmb.4 _ipmi.4= ipmi.4 _io.4= io.4 diff --git a/share/man/man4/igc.4 b/share/man/man4/igc.4 new file mode 100644 index 000000000000..bb79fbe5a8fa --- /dev/null +++ b/share/man/man4/igc.4 @@ -0,0 +1,167 @@ +.\"- +.\" Copyright 2021 Intel Corp +.\" Copyright 2021 Rubicon Communications, LLC (Netgate) +.\" SPDX-License-Identifier: BSD-3-Clause +.\" +.\" $FreeBSD$ +.\" +.Dd May 10, 2021 +.Dt IGC +.Os +.Sh NAME +.Nm igc +.Nd "Intel Ethernet Controller I225 driver" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device iflib" +.Cd "device igc" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_igc_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for any PCI Express adapter or LOM (LAN +On Motherboard) based on the Intel I225 Multi Gigabit Controller. +The driver supports Transmit/Receive checksum offload, Jumbo Frames, +MSI/MSI-X, TSO, and RSS. +.Pp +Support for Jumbo Frames is provided via the interface MTU setting. +Selecting an MTU larger than 1500 bytes with the +.Xr ifconfig 8 +utility +configures the adapter to receive and transmit Jumbo Frames. +The maximum MTU size for Jumbo Frames is 9216 bytes. +.Pp +This driver version supports VLAN hardware insertion / extraction, and +VLAN checksum offload. +For information on enabling VLANs, see +.Xr ifconfig 8 . +The +.Nm +driver supports the following media types: +.Bl -tag -width ".Cm 10baseT/UTP" +.It Cm autoselect +Enables auto-negotiation for speed and duplex. +.It Cm 10baseT/UTP +Sets 10Mbps operation. +Use the +.Cm mediaopt +option to select +.Cm half-duplex +mode. +.It Cm 100baseTX +Sets 100Mbps operation. +Use the +.Cm mediaopt +option to select +.Cm half-duplex +mode. +.It Cm 1000baseT +Sets 1000Mbps operation. +Only +.Cm full-duplex +mode is supported at this speed. +.It Cm 2500baseT +Sets 2500Mbps operation. +Only +.Cm full-duplex +mode is supported at this speed. +.El +.Pp +.Sh HARDWARE +The +.Nm +driver supports the following models: +.Pp +.Bl -bullet -compact +.It +I225-LM +.It +I225-V +.It +I225-IT +.It +I225-K +.El +.Sh LOADER TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel or stored in +.Xr loader.conf 5 . +.Bl -tag -width indent +.It Va hw.igc.igc_disable_crc_stripping +Disable or enable hardware stripping of CRC field. +This is mostly useful on BMC/IPMI shared interfaces where stripping the +CRC causes remote access over IPMI to fail. +Default 0 (enabled). +.It Va hw.igc.rx_int_delay +This value delays the generation of receive interrupts in units +of 1.024 microseconds. +The default value is 0, since adapters may hang with this feature being +enabled. +.It Va hw.igc.rx_abs_int_delay +If hw.igc.rx_int_delay is non-zero, this tunable limits the +maximum delay in which a receive interrupt is generated. +.It Va hw.igc.tx_int_delay +This value delays the generation of transmit interrupts in units +of 1.024 microseconds. +The default value is 64. +.It Va hw.igc.tx_abs_int_delay +If hw.igc.tx_int_delay is non-zero, this tunable limits the +maximum delay in which a transmit interrupt is generated. +.It Va hw.igc.sbp +Show bad packets when in promiscuous mode. +Default is false. +.It Va hw.igc.rx_process_limit +Maximum number of received packets to process at a time. +Default is 100. +A value of -1 means unlimited. +.It Va hw.igc.eee_setting +Disable or enable Energy Efficient Ethernet. +Default 1 (disabled). +.It Va hw.igc.max_interrupt_rate +Maximum device interrupts per second. +The default is 8000. +.El +.Sh DIAGNOSTICS +.Bl -diag +.It "igc%d: Hardware Initialization Failed" +A fatal initialization error has occurred. +.It "igc%d: Unable to allocate bus resource: memory" +A fatal initialization error has occurred. +.It "igc%d: Invalid MAC address" +The MAC address programmed into the EEPROM is either empty or a multicast/broadcast +address. +.El +.Sh SEE ALSO +.Xr altq 4 , +.Xr arp 4 , +.Xr iflib 4 , +.Xr netintro 4 , +.Xr ng_ether 4 , +.Xr vlan 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 14.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +was originally written by +.An Intel Corporation +and converted to the +.Xr iflib 4 +framework by +.An Netgate . diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index 2b49dd4726ec..7ea749e28e33 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -249,6 +249,7 @@ device puc # Multi I/O cards and multi-channel UARTs # PCI/PCI-X/PCIe Ethernet NICs that use iflib infrastructure device iflib device em # Intel PRO/1000 Gigabit Ethernet Family +device igc # Intel I225 2.5G Ethernet device ix # Intel PRO/10GbE PCIE PF Ethernet device ixv # Intel PRO/10GbE PCIE VF Ethernet device ixl # Intel 700 Series Physical Function diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES index 79c92a679414..f5bdf15ebb08 100644 --- a/sys/amd64/conf/NOTES +++ b/sys/amd64/conf/NOTES @@ -287,6 +287,7 @@ device cpufreq # adapters. # ice: Intel 800 Series Physical Function # Requires the ice_ddp module for full functionality +# igc: Intel I225 2.5Gb Ethernet adapter # ipw: Intel PRO/Wireless 2100 IEEE 802.11 adapter # Requires the ipw firmware module # iwi: Intel PRO/Wireless 2200BG/2225BG/2915ABG IEEE 802.11 adapters @@ -309,6 +310,7 @@ device bxe # Broadcom NetXtreme II BCM5771X/BCM578XX 10GbE options ED_3C503 options ED_HPP options ED_SIC +device igc # Intel I225 2.5G Ethernet device ipw # Intel 2100 wireless NICs. device iwi # Intel 2200BG/2225BG/2915ABG wireless NICs. device iwn # Intel 4965/1000/5000/6000 wireless NICs. diff --git a/sys/conf/files b/sys/conf/files index 22cf4db11695..33b57f98e199 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1885,6 +1885,14 @@ dev/iicbus/pmic/fan53555.c optional fan53555 ext_resources fdt dev/iir/iir.c optional iir dev/iir/iir_ctrl.c optional iir dev/iir/iir_pci.c optional iir pci +dev/igc/if_igc.c optional igc iflib pci +dev/igc/igc_api.c optional igc iflib pci +dev/igc/igc_base.c optional igc iflib pci +dev/igc/igc_i225.c optional igc iflib pci +dev/igc/igc_mac.c optional igc iflib pci +dev/igc/igc_nvm.c optional igc iflib pci +dev/igc/igc_phy.c optional igc iflib pci +dev/igc/igc_txrx.c optional igc iflib pci dev/intpm/intpm.c optional intpm pci # XXX Work around clang warning, until maintainer approves fix. dev/ips/ips.c optional ips \ diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c new file mode 100644 index 000000000000..6d94a7c223c7 --- /dev/null +++ b/sys/dev/igc/if_igc.c @@ -0,0 +1,2984 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2016 Nicole Graziano + * All rights reserved. + * Copyright (c) 2021 Rubicon Communications, LLC (Netgate) + * + * 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 "if_igc.h" +#include +#include + +#ifdef RSS +#include +#include +#endif + +/********************************************************************* + * PCI Device ID Table + * + * Used by probe to select devices to load on + * Last entry must be all 0s + * + * { Vendor ID, Device ID, String } + *********************************************************************/ + +static pci_vendor_info_t igc_vendor_info_array[] = +{ + /* Intel(R) PRO/1000 Network Connection - igc */ + PVID(0x8086, IGC_DEV_ID_I225_LM, "Intel(R) Ethernet Controller I225-LM"), + PVID(0x8086, IGC_DEV_ID_I225_V, "Intel(R) Ethernet Controller I225-V"), + PVID(0x8086, IGC_DEV_ID_I225_K, "Intel(R) Ethernet Controller I225-K"), + PVID(0x8086, IGC_DEV_ID_I225_I, "Intel(R) Ethernet Controller I225-I"), + PVID(0x8086, IGC_DEV_ID_I220_V, "Intel(R) Ethernet Controller I220-V"), + PVID(0x8086, IGC_DEV_ID_I225_K2, "Intel(R) Ethernet Controller I225-K(2)"), + PVID(0x8086, IGC_DEV_ID_I225_LMVP, "Intel(R) Ethernet Controller I225-LMvP(2)"), + PVID(0x8086, IGC_DEV_ID_I226_K, "Intel(R) Ethernet Controller I226-K"), + PVID(0x8086, IGC_DEV_ID_I225_IT, "Intel(R) Ethernet Controller I225-IT(2)"), + PVID(0x8086, IGC_DEV_ID_I226_LM, "Intel(R) Ethernet Controller I226-LM"), + PVID(0x8086, IGC_DEV_ID_I226_V, "Intel(R) Ethernet Controller I226-V"), + PVID(0x8086, IGC_DEV_ID_I226_IT, "Intel(R) Ethernet Controller I226-IT"), + PVID(0x8086, IGC_DEV_ID_I221_V, "Intel(R) Ethernet Controller I221-V"), + PVID(0x8086, IGC_DEV_ID_I226_BLANK_NVM, "Intel(R) Ethernet Controller I226(blankNVM)"), + PVID(0x8086, IGC_DEV_ID_I225_BLANK_NVM, "Intel(R) Ethernet Controller I225(blankNVM)"), + /* required last entry */ + PVID_END +}; + +/********************************************************************* + * Function prototypes + *********************************************************************/ +static void *igc_register(device_t dev); +static int igc_if_attach_pre(if_ctx_t ctx); +static int igc_if_attach_post(if_ctx_t ctx); +static int igc_if_detach(if_ctx_t ctx); +static int igc_if_shutdown(if_ctx_t ctx); +static int igc_if_suspend(if_ctx_t ctx); +static int igc_if_resume(if_ctx_t ctx); + +static int igc_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int ntxqs, int ntxqsets); +static int igc_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int nrxqs, int nrxqsets); +static void igc_if_queues_free(if_ctx_t ctx); + +static uint64_t igc_if_get_counter(if_ctx_t, ift_counter); +static void igc_if_init(if_ctx_t ctx); +static void igc_if_stop(if_ctx_t ctx); +static void igc_if_media_status(if_ctx_t, struct ifmediareq *); +static int igc_if_media_change(if_ctx_t ctx); +static int igc_if_mtu_set(if_ctx_t ctx, uint32_t mtu); +static void igc_if_timer(if_ctx_t ctx, uint16_t qid); +static void igc_if_vlan_register(if_ctx_t ctx, u16 vtag); +static void igc_if_vlan_unregister(if_ctx_t ctx, u16 vtag); +static void igc_if_watchdog_reset(if_ctx_t ctx); +static bool igc_if_needs_restart(if_ctx_t ctx, enum iflib_restart_event event); + +static void igc_identify_hardware(if_ctx_t ctx); +static int igc_allocate_pci_resources(if_ctx_t ctx); +static void igc_free_pci_resources(if_ctx_t ctx); +static void igc_reset(if_ctx_t ctx); +static int igc_setup_interface(if_ctx_t ctx); +static int igc_setup_msix(if_ctx_t ctx); + +static void igc_initialize_transmit_unit(if_ctx_t ctx); +static void igc_initialize_receive_unit(if_ctx_t ctx); + +static void igc_if_intr_enable(if_ctx_t ctx); +static void igc_if_intr_disable(if_ctx_t ctx); +static int igc_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t rxqid); +static int igc_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid); +static void igc_if_multi_set(if_ctx_t ctx); +static void igc_if_update_admin_status(if_ctx_t ctx); +static void igc_if_debug(if_ctx_t ctx); +static void igc_update_stats_counters(struct igc_adapter *); +static void igc_add_hw_stats(struct igc_adapter *adapter); +static int igc_if_set_promisc(if_ctx_t ctx, int flags); +static void igc_setup_vlan_hw_support(struct igc_adapter *); +static int igc_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); +static void igc_print_nvm_info(struct igc_adapter *); +static int igc_sysctl_debug_info(SYSCTL_HANDLER_ARGS); +static int igc_get_rs(SYSCTL_HANDLER_ARGS); +static void igc_print_debug_info(struct igc_adapter *); +static int igc_is_valid_ether_addr(u8 *); +static int igc_sysctl_int_delay(SYSCTL_HANDLER_ARGS); +static void igc_add_int_delay_sysctl(struct igc_adapter *, const char *, + const char *, struct igc_int_delay_info *, int, int); +/* Management and WOL Support */ +static void igc_get_hw_control(struct igc_adapter *); +static void igc_release_hw_control(struct igc_adapter *); +static void igc_get_wakeup(if_ctx_t ctx); +static void igc_enable_wakeup(if_ctx_t ctx); + +int igc_intr(void *arg); + +/* MSI-X handlers */ +static int igc_if_msix_intr_assign(if_ctx_t, int); +static int igc_msix_link(void *); +static void igc_handle_link(void *context); + +static int igc_set_flowcntl(SYSCTL_HANDLER_ARGS); +static int igc_sysctl_eee(SYSCTL_HANDLER_ARGS); + +static int igc_get_regs(SYSCTL_HANDLER_ARGS); + +static void igc_configure_queues(struct igc_adapter *adapter); + + +/********************************************************************* + * FreeBSD Device Interface Entry Points + *********************************************************************/ +static device_method_t igc_methods[] = { + /* Device interface */ + DEVMETHOD(device_register, igc_register), + DEVMETHOD(device_probe, iflib_device_probe), + DEVMETHOD(device_attach, iflib_device_attach), + DEVMETHOD(device_detach, iflib_device_detach), + DEVMETHOD(device_shutdown, iflib_device_shutdown), + DEVMETHOD(device_suspend, iflib_device_suspend), + DEVMETHOD(device_resume, iflib_device_resume), + DEVMETHOD_END +}; + +static driver_t igc_driver = { + "igc", igc_methods, sizeof(struct igc_adapter), +}; + +static devclass_t igc_devclass; +DRIVER_MODULE(igc, pci, igc_driver, igc_devclass, 0, 0); + +MODULE_DEPEND(igc, pci, 1, 1, 1); +MODULE_DEPEND(igc, ether, 1, 1, 1); +MODULE_DEPEND(igc, iflib, 1, 1, 1); + +IFLIB_PNP_INFO(pci, igc, igc_vendor_info_array); + +static device_method_t igc_if_methods[] = { + DEVMETHOD(ifdi_attach_pre, igc_if_attach_pre), + DEVMETHOD(ifdi_attach_post, igc_if_attach_post), + DEVMETHOD(ifdi_detach, igc_if_detach), + DEVMETHOD(ifdi_shutdown, igc_if_shutdown), + DEVMETHOD(ifdi_suspend, igc_if_suspend), + DEVMETHOD(ifdi_resume, igc_if_resume), + DEVMETHOD(ifdi_init, igc_if_init), + DEVMETHOD(ifdi_stop, igc_if_stop), + DEVMETHOD(ifdi_msix_intr_assign, igc_if_msix_intr_assign), + DEVMETHOD(ifdi_intr_enable, igc_if_intr_enable), + DEVMETHOD(ifdi_intr_disable, igc_if_intr_disable), + DEVMETHOD(ifdi_tx_queues_alloc, igc_if_tx_queues_alloc), + DEVMETHOD(ifdi_rx_queues_alloc, igc_if_rx_queues_alloc), + DEVMETHOD(ifdi_queues_free, igc_if_queues_free), + DEVMETHOD(ifdi_update_admin_status, igc_if_update_admin_status), + DEVMETHOD(ifdi_multi_set, igc_if_multi_set), + DEVMETHOD(ifdi_media_status, igc_if_media_status), + DEVMETHOD(ifdi_media_change, igc_if_media_change), + DEVMETHOD(ifdi_mtu_set, igc_if_mtu_set), + DEVMETHOD(ifdi_promisc_set, igc_if_set_promisc), + DEVMETHOD(ifdi_timer, igc_if_timer), + DEVMETHOD(ifdi_watchdog_reset, igc_if_watchdog_reset), + DEVMETHOD(ifdi_vlan_register, igc_if_vlan_register), + DEVMETHOD(ifdi_vlan_unregister, igc_if_vlan_unregister), + DEVMETHOD(ifdi_get_counter, igc_if_get_counter), + DEVMETHOD(ifdi_rx_queue_intr_enable, igc_if_rx_queue_intr_enable), + DEVMETHOD(ifdi_tx_queue_intr_enable, igc_if_tx_queue_intr_enable), + DEVMETHOD(ifdi_debug, igc_if_debug), + DEVMETHOD(ifdi_needs_restart, igc_if_needs_restart), + DEVMETHOD_END +}; + +static driver_t igc_if_driver = { + "igc_if", igc_if_methods, sizeof(struct igc_adapter) +}; + +/********************************************************************* + * Tunable default values. + *********************************************************************/ + +#define IGC_TICKS_TO_USECS(ticks) ((1024 * (ticks) + 500) / 1000) +#define IGC_USECS_TO_TICKS(usecs) ((1000 * (usecs) + 512) / 1024) + +#define MAX_INTS_PER_SEC 8000 +#define DEFAULT_ITR (1000000000/(MAX_INTS_PER_SEC * 256)) + +/* Allow common code without TSO */ +#ifndef CSUM_TSO +#define CSUM_TSO 0 +#endif + +static SYSCTL_NODE(_hw, OID_AUTO, igc, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "igc driver parameters"); + +static int igc_disable_crc_stripping = 0; +SYSCTL_INT(_hw_igc, OID_AUTO, disable_crc_stripping, CTLFLAG_RDTUN, + &igc_disable_crc_stripping, 0, "Disable CRC Stripping"); + +static int igc_tx_int_delay_dflt = IGC_TICKS_TO_USECS(IGC_TIDV_VAL); +static int igc_rx_int_delay_dflt = IGC_TICKS_TO_USECS(IGC_RDTR_VAL); +SYSCTL_INT(_hw_igc, OID_AUTO, tx_int_delay, CTLFLAG_RDTUN, &igc_tx_int_delay_dflt, + 0, "Default transmit interrupt delay in usecs"); +SYSCTL_INT(_hw_igc, OID_AUTO, rx_int_delay, CTLFLAG_RDTUN, &igc_rx_int_delay_dflt, + 0, "Default receive interrupt delay in usecs"); + +static int igc_tx_abs_int_delay_dflt = IGC_TICKS_TO_USECS(IGC_TADV_VAL); +static int igc_rx_abs_int_delay_dflt = IGC_TICKS_TO_USECS(IGC_RADV_VAL); +SYSCTL_INT(_hw_igc, OID_AUTO, tx_abs_int_delay, CTLFLAG_RDTUN, + &igc_tx_abs_int_delay_dflt, 0, + "Default transmit interrupt delay limit in usecs"); +SYSCTL_INT(_hw_igc, OID_AUTO, rx_abs_int_delay, CTLFLAG_RDTUN, + &igc_rx_abs_int_delay_dflt, 0, + "Default receive interrupt delay limit in usecs"); + +static int igc_smart_pwr_down = false; +SYSCTL_INT(_hw_igc, OID_AUTO, smart_pwr_down, CTLFLAG_RDTUN, &igc_smart_pwr_down, + 0, "Set to true to leave smart power down enabled on newer adapters"); + +/* Controls whether promiscuous also shows bad packets */ +static int igc_debug_sbp = true; +SYSCTL_INT(_hw_igc, OID_AUTO, sbp, CTLFLAG_RDTUN, &igc_debug_sbp, 0, + "Show bad packets in promiscuous mode"); + +/* How many packets rxeof tries to clean at a time */ +static int igc_rx_process_limit = 100; +SYSCTL_INT(_hw_igc, OID_AUTO, rx_process_limit, CTLFLAG_RDTUN, + &igc_rx_process_limit, 0, + "Maximum number of received packets to process " + "at a time, -1 means unlimited"); + +/* Energy efficient ethernet - default to OFF */ +static int igc_eee_setting = 1; +SYSCTL_INT(_hw_igc, OID_AUTO, eee_setting, CTLFLAG_RDTUN, &igc_eee_setting, 0, + "Enable Energy Efficient Ethernet"); + +/* +** Tuneable Interrupt rate +*/ +static int igc_max_interrupt_rate = 8000; +SYSCTL_INT(_hw_igc, OID_AUTO, max_interrupt_rate, CTLFLAG_RDTUN, + &igc_max_interrupt_rate, 0, "Maximum interrupts per second"); + +extern struct if_txrx igc_txrx; + +static struct if_shared_ctx igc_sctx_init = { + .isc_magic = IFLIB_MAGIC, + .isc_q_align = PAGE_SIZE, + .isc_tx_maxsize = IGC_TSO_SIZE + sizeof(struct ether_vlan_header), + .isc_tx_maxsegsize = PAGE_SIZE, + .isc_tso_maxsize = IGC_TSO_SIZE + sizeof(struct ether_vlan_header), + .isc_tso_maxsegsize = IGC_TSO_SEG_SIZE, + .isc_rx_maxsize = MAX_JUMBO_FRAME_SIZE, + .isc_rx_nsegments = 1, + .isc_rx_maxsegsize = MJUM9BYTES, + .isc_nfl = 1, + .isc_nrxqs = 1, + .isc_ntxqs = 1, + .isc_admin_intrcnt = 1, + .isc_vendor_info = igc_vendor_info_array, + .isc_driver_version = "1", + .isc_driver = &igc_if_driver, + .isc_flags = IFLIB_NEED_SCRATCH | IFLIB_TSO_INIT_IP | IFLIB_NEED_ZERO_CSUM, + + .isc_nrxd_min = {IGC_MIN_RXD}, + .isc_ntxd_min = {IGC_MIN_TXD}, + .isc_nrxd_max = {IGC_MAX_RXD}, + .isc_ntxd_max = {IGC_MAX_TXD}, + .isc_nrxd_default = {IGC_DEFAULT_RXD}, + .isc_ntxd_default = {IGC_DEFAULT_TXD}, +}; + +/***************************************************************** + * + * Dump Registers + * + ****************************************************************/ +#define IGC_REGS_LEN 739 + +static int igc_get_regs(SYSCTL_HANDLER_ARGS) +{ + struct igc_adapter *adapter = (struct igc_adapter *)arg1; + struct igc_hw *hw = &adapter->hw; + struct sbuf *sb; + u32 *regs_buff; + int rc; + + regs_buff = malloc(sizeof(u32) * IGC_REGS_LEN, M_DEVBUF, M_WAITOK); + memset(regs_buff, 0, IGC_REGS_LEN * sizeof(u32)); + + rc = sysctl_wire_old_buffer(req, 0); + MPASS(rc == 0); + if (rc != 0) { + free(regs_buff, M_DEVBUF); + return (rc); + } + + sb = sbuf_new_for_sysctl(NULL, NULL, 32*400, req); + MPASS(sb != NULL); + if (sb == NULL) { + free(regs_buff, M_DEVBUF); + return (ENOMEM); + } + + /* General Registers */ + regs_buff[0] = IGC_READ_REG(hw, IGC_CTRL); + regs_buff[1] = IGC_READ_REG(hw, IGC_STATUS); + regs_buff[2] = IGC_READ_REG(hw, IGC_CTRL_EXT); + regs_buff[3] = IGC_READ_REG(hw, IGC_ICR); + regs_buff[4] = IGC_READ_REG(hw, IGC_RCTL); + regs_buff[5] = IGC_READ_REG(hw, IGC_RDLEN(0)); + regs_buff[6] = IGC_READ_REG(hw, IGC_RDH(0)); + regs_buff[7] = IGC_READ_REG(hw, IGC_RDT(0)); + regs_buff[8] = IGC_READ_REG(hw, IGC_RXDCTL(0)); + regs_buff[9] = IGC_READ_REG(hw, IGC_RDBAL(0)); + regs_buff[10] = IGC_READ_REG(hw, IGC_RDBAH(0)); + regs_buff[11] = IGC_READ_REG(hw, IGC_TCTL); + regs_buff[12] = IGC_READ_REG(hw, IGC_TDBAL(0)); + regs_buff[13] = IGC_READ_REG(hw, IGC_TDBAH(0)); + regs_buff[14] = IGC_READ_REG(hw, IGC_TDLEN(0)); + regs_buff[15] = IGC_READ_REG(hw, IGC_TDH(0)); + regs_buff[16] = IGC_READ_REG(hw, IGC_TDT(0)); + regs_buff[17] = IGC_READ_REG(hw, IGC_TXDCTL(0)); + + sbuf_printf(sb, "General Registers\n"); + sbuf_printf(sb, "\tCTRL\t %08x\n", regs_buff[0]); + sbuf_printf(sb, "\tSTATUS\t %08x\n", regs_buff[1]); + sbuf_printf(sb, "\tCTRL_EXIT\t %08x\n\n", regs_buff[2]); + + sbuf_printf(sb, "Interrupt Registers\n"); + sbuf_printf(sb, "\tICR\t %08x\n\n", regs_buff[3]); + + sbuf_printf(sb, "RX Registers\n"); + sbuf_printf(sb, "\tRCTL\t %08x\n", regs_buff[4]); + sbuf_printf(sb, "\tRDLEN\t %08x\n", regs_buff[5]); + sbuf_printf(sb, "\tRDH\t %08x\n", regs_buff[6]); + sbuf_printf(sb, "\tRDT\t %08x\n", regs_buff[7]); + sbuf_printf(sb, "\tRXDCTL\t %08x\n", regs_buff[8]); + sbuf_printf(sb, "\tRDBAL\t %08x\n", regs_buff[9]); + sbuf_printf(sb, "\tRDBAH\t %08x\n\n", regs_buff[10]); + + sbuf_printf(sb, "TX Registers\n"); + sbuf_printf(sb, "\tTCTL\t %08x\n", regs_buff[11]); + sbuf_printf(sb, "\tTDBAL\t %08x\n", regs_buff[12]); + sbuf_printf(sb, "\tTDBAH\t %08x\n", regs_buff[13]); + sbuf_printf(sb, "\tTDLEN\t %08x\n", regs_buff[14]); + sbuf_printf(sb, "\tTDH\t %08x\n", regs_buff[15]); + sbuf_printf(sb, "\tTDT\t %08x\n", regs_buff[16]); + sbuf_printf(sb, "\tTXDCTL\t %08x\n", regs_buff[17]); + sbuf_printf(sb, "\tTDFH\t %08x\n", regs_buff[18]); + sbuf_printf(sb, "\tTDFT\t %08x\n", regs_buff[19]); + sbuf_printf(sb, "\tTDFHS\t %08x\n", regs_buff[20]); + sbuf_printf(sb, "\tTDFPC\t %08x\n\n", regs_buff[21]); + + free(regs_buff, M_DEVBUF); + +#ifdef DUMP_DESCS + { + if_softc_ctx_t scctx = adapter->shared; + struct rx_ring *rxr = &rx_que->rxr; + struct tx_ring *txr = &tx_que->txr; + int ntxd = scctx->isc_ntxd[0]; + int nrxd = scctx->isc_nrxd[0]; + int j; + + for (j = 0; j < nrxd; j++) { + u32 staterr = le32toh(rxr->rx_base[j].wb.upper.status_error); + u32 length = le32toh(rxr->rx_base[j].wb.upper.length); + sbuf_printf(sb, "\tReceive Descriptor Address %d: %08" PRIx64 " Error:%d Length:%d\n", j, rxr->rx_base[j].read.buffer_addr, staterr, length); + } + + for (j = 0; j < min(ntxd, 256); j++) { + unsigned int *ptr = (unsigned int *)&txr->tx_base[j]; + + sbuf_printf(sb, "\tTXD[%03d] [0]: %08x [1]: %08x [2]: %08x [3]: %08x eop: %d DD=%d\n", + j, ptr[0], ptr[1], ptr[2], ptr[3], buf->eop, + buf->eop != -1 ? txr->tx_base[buf->eop].upper.fields.status & IGC_TXD_STAT_DD : 0); + + } + } +#endif + + rc = sbuf_finish(sb); + sbuf_delete(sb); + return(rc); +} + +static void * +igc_register(device_t dev) +{ + return (&igc_sctx_init); +} + +static int +igc_set_num_queues(if_ctx_t ctx) +{ + int maxqueues; + + maxqueues = 4; + + return (maxqueues); +} + +#define IGC_CAPS \ + IFCAP_HWCSUM | IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | \ + IFCAP_VLAN_HWCSUM | IFCAP_WOL | IFCAP_VLAN_HWFILTER | IFCAP_TSO4 | \ + IFCAP_LRO | IFCAP_VLAN_HWTSO | IFCAP_JUMBO_MTU | IFCAP_HWCSUM_IPV6 |\ + IFCAP_TSO6 + +/********************************************************************* + * Device initialization routine + * + * The attach entry point is called when the driver is being loaded. + * This routine identifies the type of hardware, allocates all resources + * and initializes the hardware. + * + * return 0 on success, positive on failure + *********************************************************************/ +static int +igc_if_attach_pre(if_ctx_t ctx) +{ + struct igc_adapter *adapter; + if_softc_ctx_t scctx; + device_t dev; + struct igc_hw *hw; + int error = 0; + + INIT_DEBUGOUT("igc_if_attach_pre: begin"); + dev = iflib_get_dev(ctx); + adapter = 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; + + adapter->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, igc_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, igc_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, igc_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, + igc_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, + igc_get_rs, "I", "Dump RS indexes"); + + /* Determine hardware and mac info */ + igc_identify_hardware(ctx); + + scctx->isc_tx_nsegments = IGC_MAX_SCATTER; + scctx->isc_nrxqsets_max = scctx->isc_ntxqsets_max = igc_set_num_queues(ctx); + if (bootverbose) + device_printf(dev, "attach_pre capping queues at %d\n", + scctx->isc_ntxqsets_max); + + scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0] * sizeof(union igc_adv_tx_desc), IGC_DBA_ALIGN); + scctx->isc_rxqsizes[0] = roundup2(scctx->isc_nrxd[0] * sizeof(union igc_adv_rx_desc), IGC_DBA_ALIGN); + scctx->isc_txd_size[0] = sizeof(union igc_adv_tx_desc); + scctx->isc_rxd_size[0] = sizeof(union igc_adv_rx_desc); + scctx->isc_txrx = &igc_txrx; + scctx->isc_tx_tso_segments_max = IGC_MAX_SCATTER; + scctx->isc_tx_tso_size_max = IGC_TSO_SIZE; + scctx->isc_tx_tso_segsize_max = IGC_TSO_SEG_SIZE; + scctx->isc_capabilities = scctx->isc_capenable = IGC_CAPS; + scctx->isc_tx_csum_flags = CSUM_TCP | CSUM_UDP | CSUM_TSO | + CSUM_IP6_TCP | CSUM_IP6_UDP | CSUM_SCTP | CSUM_IP6_SCTP; + + /* + ** Some new devices, as with ixgbe, now may + ** use a different BAR, so we need to keep + ** track of which is used. + */ + scctx->isc_msix_bar = PCIR_BAR(IGC_MSIX_BAR); + if (pci_read_config(dev, scctx->isc_msix_bar, 4) == 0) + scctx->isc_msix_bar += 4; + + /* Setup PCI resources */ + if (igc_allocate_pci_resources(ctx)) { + device_printf(dev, "Allocation of PCI resources failed\n"); + error = ENXIO; + goto err_pci; + } + + /* Do Shared Code initialization */ + error = igc_setup_init_funcs(hw, true); + if (error) { + device_printf(dev, "Setup of Shared code failed, error %d\n", + error); + error = ENXIO; + goto err_pci; + } + + igc_setup_msix(ctx); + igc_get_bus_info(hw); + + /* Set up some sysctls for the tunable interrupt delays */ + igc_add_int_delay_sysctl(adapter, "rx_int_delay", + "receive interrupt delay in usecs", &adapter->rx_int_delay, + IGC_REGISTER(hw, IGC_RDTR), igc_rx_int_delay_dflt); + igc_add_int_delay_sysctl(adapter, "tx_int_delay", + "transmit interrupt delay in usecs", &adapter->tx_int_delay, + IGC_REGISTER(hw, IGC_TIDV), igc_tx_int_delay_dflt); + igc_add_int_delay_sysctl(adapter, "rx_abs_int_delay", + "receive interrupt delay limit in usecs", + &adapter->rx_abs_int_delay, + IGC_REGISTER(hw, IGC_RADV), + igc_rx_abs_int_delay_dflt); + igc_add_int_delay_sysctl(adapter, "tx_abs_int_delay", + "transmit interrupt delay limit in usecs", + &adapter->tx_abs_int_delay, + IGC_REGISTER(hw, IGC_TADV), + igc_tx_abs_int_delay_dflt); + igc_add_int_delay_sysctl(adapter, "itr", + "interrupt delay limit in usecs/4", + &adapter->tx_itr, + IGC_REGISTER(hw, IGC_ITR), + DEFAULT_ITR); + + hw->mac.autoneg = DO_AUTO_NEG; + hw->phy.autoneg_wait_to_complete = false; + hw->phy.autoneg_advertised = AUTONEG_ADV_DEFAULT; + + /* Copper options */ + if (hw->phy.media_type == igc_media_type_copper) { + hw->phy.mdix = AUTO_ALL_MODES; + } + + /* + * Set the frame limits assuming + * standard ethernet sized frames. + */ + scctx->isc_max_frame_size = adapter->hw.mac.max_frame_size = + ETHERMTU + ETHER_HDR_LEN + ETHERNET_FCS_SIZE; + + /* Allocate multicast array memory. */ + adapter->mta = malloc(sizeof(u8) * ETHER_ADDR_LEN * + MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); + if (adapter->mta == NULL) { + device_printf(dev, "Can not allocate multicast setup array\n"); + error = ENOMEM; + goto err_late; + } + + /* Check SOL/IDER usage */ + if (igc_check_reset_block(hw)) + device_printf(dev, "PHY reset is blocked" + " due to SOL/IDER session.\n"); + + /* Sysctl for setting Energy Efficient Ethernet */ + adapter->hw.dev_spec._i225.eee_disable = igc_eee_setting; + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "eee_control", + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, + adapter, 0, igc_sysctl_eee, "I", + "Disable Energy Efficient Ethernet"); + + /* + ** Start from a known state, this is + ** important in reading the nvm and + ** mac from that. + */ + igc_reset_hw(hw); + + /* Make sure we have a good EEPROM before we read from it */ + if (igc_validate_nvm_checksum(hw) < 0) { + /* + ** Some PCI-E parts fail the first check due to + ** the link being in sleep state, call it again, + ** if it fails a second time its a real issue. + */ + if (igc_validate_nvm_checksum(hw) < 0) { + device_printf(dev, + "The EEPROM Checksum Is Not Valid\n"); + error = EIO; + goto err_late; + } + } + + /* Copy the permanent MAC address out of the EEPROM */ + if (igc_read_mac_addr(hw) < 0) { + device_printf(dev, "EEPROM read error while reading MAC" + " address\n"); + error = EIO; + goto err_late; + } + + if (!igc_is_valid_ether_addr(hw->mac.addr)) { + device_printf(dev, "Invalid MAC address\n"); + error = EIO; + goto err_late; + } + + /* + * Get Wake-on-Lan and Management info for later use + */ + igc_get_wakeup(ctx); + + /* Enable only WOL MAGIC by default */ + scctx->isc_capenable &= ~IFCAP_WOL; + if (adapter->wol != 0) + scctx->isc_capenable |= IFCAP_WOL_MAGIC; + + iflib_set_mac(ctx, hw->mac.addr); + + return (0); + +err_late: + igc_release_hw_control(adapter); +err_pci: + igc_free_pci_resources(ctx); + free(adapter->mta, M_DEVBUF); + + return (error); +} + +static int +igc_if_attach_post(if_ctx_t ctx) +{ + struct igc_adapter *adapter = iflib_get_softc(ctx); + struct igc_hw *hw = &adapter->hw; + int error = 0; *** 11492 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Mon Jul 12 04:18:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E7EC64E783; Mon, 12 Jul 2021 04:18: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 4GNVrY18kxz3D10; Mon, 12 Jul 2021 04:18: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 0AAAF27F5F; Mon, 12 Jul 2021 04:18: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 16C4IqkR085614; Mon, 12 Jul 2021 04:18:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16C4IqPg085613; Mon, 12 Jul 2021 04:18:52 GMT (envelope-from git) Date: Mon, 12 Jul 2021 04:18:52 GMT Message-Id: <202107120418.16C4IqPg085613@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: 3251ad29f429 - main - libcasper(3): Correct some warnings found by mandoc 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: 3251ad29f4295ad73668a46727c5bbf7bbac0cf7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 04:18:53 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=3251ad29f4295ad73668a46727c5bbf7bbac0cf7 commit 3251ad29f4295ad73668a46727c5bbf7bbac0cf7 Author: Gordon Bergling AuthorDate: 2021-07-12 04:16:55 +0000 Commit: Gordon Bergling CommitDate: 2021-07-12 04:16:55 +0000 libcasper(3): Correct some warnings found by mandoc - inserting missing end of block: Sh breaks Bl - moving content out of list: Pp - missing comma before name: Nm cap_* - comma in function argument: cap_* - skipping paragraph macro: Pp after Sh - sections out of conventional order: Sh AUTHORS Reviewed by: bcr MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31144 --- lib/libcasper/libcasper/libcasper.3 | 3 ++- lib/libcasper/services/cap_dns/cap_dns.3 | 1 + lib/libcasper/services/cap_fileargs/cap_fileargs.3 | 5 +++-- lib/libcasper/services/cap_net/cap_net.3 | 5 ++--- lib/libcasper/services/cap_syslog/cap_syslog.3 | 10 +++++----- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/libcasper/libcasper/libcasper.3 b/lib/libcasper/libcasper/libcasper.3 index 149dd49eb1c9..bf678457abeb 100644 --- a/lib/libcasper/libcasper/libcasper.3 +++ b/lib/libcasper/libcasper/libcasper.3 @@ -200,8 +200,8 @@ obtained via the function. The function returns capability that provides access to opened service. Casper supports the following services in the base system: -.Bl -tag -width "system.random" -compact -offset indent .Pp +.Bl -tag -width "system.random" -compact -offset indent .It system.dns provides DNS libc compatible API .It system.grp @@ -222,6 +222,7 @@ compatible API provides .Xr syslog 3 compatible API +.El .Sh RETURN VALUES The .Fn cap_clone , diff --git a/lib/libcasper/services/cap_dns/cap_dns.3 b/lib/libcasper/services/cap_dns/cap_dns.3 index 104e37f53d86..faa994dc2a6f 100644 --- a/lib/libcasper/services/cap_dns/cap_dns.3 +++ b/lib/libcasper/services/cap_dns/cap_dns.3 @@ -158,6 +158,7 @@ The limits service to one of the address families (e.g. .Dv AF_INET , AF_INET6 , etc.). +.El .Sh EXAMPLES The following example first opens a capability to casper and then uses this capability to create the diff --git a/lib/libcasper/services/cap_fileargs/cap_fileargs.3 b/lib/libcasper/services/cap_fileargs/cap_fileargs.3 index acf51e4ed62b..a02f58d4b4fa 100644 --- a/lib/libcasper/services/cap_fileargs/cap_fileargs.3 +++ b/lib/libcasper/services/cap_fileargs/cap_fileargs.3 @@ -222,6 +222,7 @@ argument contains a list of the capability rights which file should be limited t Any number of .Dv NV_TYPE_NULL where the name of the element is name of the file which can be opened. +.El .Sh EXAMPLES The following example first parse some options and then create the .Nm system.fileargs @@ -279,6 +280,8 @@ The .Nm cap_fileargs service first appeared in .Fx 10.3 . +.Sh AUTHORS +.An Mariusz Zaborski Aq Mt oshogbo@FreeBSD.org .Sh BUGS The .Lb cap_fileargs @@ -287,5 +290,3 @@ included in is considered experimental, and should not be deployed in production environments without careful consideration of the risks associated with the use of experimental operating system features. -.Sh AUTHORS -.An Mariusz Zaborski Aq Mt oshogbo@FreeBSD.org diff --git a/lib/libcasper/services/cap_net/cap_net.3 b/lib/libcasper/services/cap_net/cap_net.3 index cd0b4450fdaf..e74f7dd70d67 100644 --- a/lib/libcasper/services/cap_net/cap_net.3 +++ b/lib/libcasper/services/cap_net/cap_net.3 @@ -83,10 +83,9 @@ .Ft "cap_net_limit_t *" .Fn cap_net_limit_bind "cap_net_limit_t *limit" "const struct sockaddr *sa" "socklen_t salen" .Sh DESCRIPTION -.Pp The functions -.Fn cap_bind, -.Fn cap_connect, +.Fn cap_bind , +.Fn cap_connect , .Fn cap_gethostbyname , .Fn cap_gethostbyname2 , .Fn cap_gethostbyaddr diff --git a/lib/libcasper/services/cap_syslog/cap_syslog.3 b/lib/libcasper/services/cap_syslog/cap_syslog.3 index 33ca6527204e..71c3e790fd97 100644 --- a/lib/libcasper/services/cap_syslog/cap_syslog.3 +++ b/lib/libcasper/services/cap_syslog/cap_syslog.3 @@ -28,10 +28,10 @@ .Dt CAP_SYSLOG 3 .Os .Sh NAME -.Nm cap_syslog -.Nm cap_vsyslog -.Nm cap_openlog -.Nm cap_closelog +.Nm cap_syslog , +.Nm cap_vsyslog , +.Nm cap_openlog , +.Nm cap_closelog , .Nm cap_setlogmask .Nd "library for syslog in capability mode" .Sh LIBRARY @@ -98,7 +98,7 @@ cap_syslog(capsyslog, LOG_NOTICE, "System logs from capability mode."); .Xr closelog 3 , .Xr err 3 , .Xr openlog 3 , -.Xr setlogmask 3 +.Xr setlogmask 3 , .Xr syslog 3 , .Xr vsyslog 3 , .Xr capsicum 4 , From owner-dev-commits-src-main@freebsd.org Mon Jul 12 04:29:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E5FE64E7D6; Mon, 12 Jul 2021 04:29: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 4GNW4b6wjGz3Dvg; Mon, 12 Jul 2021 04:29: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 D0499821; Mon, 12 Jul 2021 04:29: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 16C4TJcu098953; Mon, 12 Jul 2021 04:29:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16C4TJX5098952; Mon, 12 Jul 2021 04:29:19 GMT (envelope-from git) Date: Mon, 12 Jul 2021 04:29:19 GMT Message-Id: <202107120429.16C4TJX5098952@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: 0b1293252543 - main - pmc(3): mandoc clean ups 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: 0b1293252543802b809b5f13f554e5d6391d3445 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 04:29:20 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0b1293252543802b809b5f13f554e5d6391d3445 commit 0b1293252543802b809b5f13f554e5d6391d3445 Author: Gordon Bergling AuthorDate: 2021-07-12 04:28:03 +0000 Commit: Gordon Bergling CommitDate: 2021-07-12 04:28:03 +0000 pmc(3): mandoc clean ups - new sentence, new line - tab in filled text - unusual Xr order - skipping paragraph macro: Pp before Ss Reviewed by: bcr MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31143 --- lib/libpmc/pmc.corei7.3 | 488 +++++++++++++++++++++------------------ lib/libpmc/pmc.corei7uc.3 | 377 ++++++++++++++++-------------- lib/libpmc/pmc.haswell.3 | 132 +++++------ lib/libpmc/pmc.haswelluc.3 | 17 +- lib/libpmc/pmc.haswellxeon.3 | 138 +++++------ lib/libpmc/pmc.iaf.3 | 1 - lib/libpmc/pmc.ivybridge.3 | 88 +++---- lib/libpmc/pmc.ivybridgexeon.3 | 103 +++++---- lib/libpmc/pmc.sandybridge.3 | 25 +- lib/libpmc/pmc.sandybridgexeon.3 | 120 +++++----- lib/libpmc/pmc.westmere.3 | 4 +- lib/libpmc/pmc.westmereuc.3 | 441 ++++++++++++++++++----------------- 12 files changed, 1024 insertions(+), 910 deletions(-) diff --git a/lib/libpmc/pmc.corei7.3 b/lib/libpmc/pmc.corei7.3 index ec310548d08e..e9e2a6e61784 100644 --- a/lib/libpmc/pmc.corei7.3 +++ b/lib/libpmc/pmc.corei7.3 @@ -93,17 +93,17 @@ Configure the Off-core Response bits. .It Li DMND_DATA_RD Counts the number of demand and DCU prefetch data reads of full and partial cachelines as well as demand data page table entry -cacheline reads. Does not count L2 data read prefetches or -instruction fetches. +cacheline reads. +Does not count L2 data read prefetches or instruction fetches. .It Li DMND_RFO Counts the number of demand and DCU prefetch reads for ownership -(RFO) requests generated by a write to data cacheline. Does not -count L2 RFO. +(RFO) requests generated by a write to data cacheline. +Does not count L2 RFO. .It Li DMND_IFETCH Counts the number of demand and DCU prefetch instruction cacheline -reads. Does not count L2 code read prefetches. -WB -Counts the number of writeback (modified to exclusive) transactions. +reads. +Does not count L2 code read prefetches. +WB Counts the number of writeback (modified to exclusive) transactions. .It Li PF_DATA_RD Counts the number of data cacheline reads generated by L2 prefetchers. .It Li PF_RFO @@ -176,11 +176,11 @@ Core i7 and Xeon 5500 programmable PMCs support the following events: Counts the number of store buffer drains. .It Li STORE_BLOCKS.AT_RET .Pq Event 06H , Umask 04H -Counts number of loads delayed with at-Retirement block code. The following -loads need to be executed at retirement and wait for all senior stores on -the same thread to be drained: load splitting across 4K boundary (page -split), load accessing uncacheable (UC or USWC) memory, load lock, and load -with page table in UC or USWC memory region. +Counts number of loads delayed with at-Retirement block code. +The following loads need to be executed at retirement and wait for all +senior stores on the same thread to be drained: load splitting across +4K boundary (page split), load accessing uncacheable +(UC or USWC) memory, load lock, and load with page table in UC or USWC memory region. .It Li STORE_BLOCKS.L1D_BLOCK .Pq Event 06H , Umask 08H Cacheable loads delayed with L1D block code @@ -220,9 +220,10 @@ ld_lat facility. In conjunction with ld_lat facility .It Li MEM_STORE_RETIRED.DTLB_MISS .Pq Event 0CH , Umask 01H -The event counts the number of retired stores that missed the DTLB. The DTLB -miss is not counted if the store operation causes a fault. Does not counter -prefetches. Counts both primary and secondary misses to the TLB +The event counts the number of retired stores that missed the DTLB. +The DTLB miss is not counted if the store operation causes a fault. +Does not counter prefetches. +Counts both primary and secondary misses to the TLB .It Li UOPS_ISSUED.ANY .Pq Event 0EH , Umask 01H Counts the number of Uops issued by the Register Allocation Table to the @@ -250,18 +251,20 @@ hit modified data in a sibling core residing on the same socket. .It Li MEM_UNCORE_RETIRED.REMOTE_CACHE_LOCAL_HOME_HIT .Pq Event 0FH , Umask 08H Counts number of memory load instructions retired where the memory reference -missed the L1, L2 and L3 caches and HIT in a remote socket's cache. Only -counts locally homed lines. +missed the L1, L2 and L3 caches and HIT in a remote socket's cache. +Only counts locally homed lines. .It Li MEM_UNCORE_RETIRED.REMOTE_DRAM .Pq Event 0FH , Umask 10H Counts number of memory load instructions retired where the memory reference -missed the L1, L2 and L3 caches and was remotely homed. This includes both -DRAM access and HITM in a remote socket's cache for remotely homed lines. +missed the L1, L2 and L3 caches and was remotely homed. +This includes both DRAM access and HITM in a remote socket's cache +for remotely homed lines. .It Li MEM_UNCORE_RETIRED.LOCAL_DRAM .Pq Event 0FH , Umask 20H Counts number of memory load instructions retired where the memory reference missed the L1, L2 and L3 caches and required a local socket memory -reference. This includes locally homed cachelines that were in a modified +reference. +This includes locally homed cachelines that were in a modified state in another socket. .It Li MEM_UNCORE_RETIRED.UNCACHEABLE .Pq Event 0FH , Umask 80H @@ -270,10 +273,10 @@ missed the L1, L2 and L3 caches and to perform I/O. Available only for CPUID signature 06_2EH .It Li FP_COMP_OPS_EXE.X87 .Pq Event 10H , Umask 01H -Counts the number of FP Computational Uops Executed. The number of FADD, -FSUB, FCOM, FMULs, integer MULsand IMULs, FDIVs, FPREMs, FSQRTS, integer -DIVs, and IDIVs. This event does not distinguish an FADD used in the middle -of a transcendental flow from a separate FADD instruction. +Counts the number of FP Computational Uops Executed. +The number of FADD, FSUB, FCOM, FMULs, integer MULsand IMULs, FDIVs, FPREMs, FSQRTS, integer +DIVs, and IDIVs. +This event does not distinguish an FADD used in the middle of a transcendental flow from a separate FADD instruction. .It Li FP_COMP_OPS_EXE.MMX .Pq Event 10H , Umask 02H Counts number of MMX Uops executed. @@ -322,8 +325,8 @@ Counts number of loads dispatched from the Reservation Station that bypass the Memory Order Buffer. .It Li LOAD_DISPATCH.RS_DELAYED .Pq Event 13H , Umask 02H -Counts the number of delayed RS dispatches at the stage latch. If an RS -dispatch can not bypass to LB, it has another chance to dispatch from the +Counts the number of delayed RS dispatches at the stage latch. +If an RS dispatch can not bypass to LB, it has another chance to dispatch from the one-cycle delayed staging latch before it is written into the LB. .It Li LOAD_DISPATCH.MOB .Pq Event 13H , Umask 04H @@ -335,14 +338,15 @@ Counts all loads dispatched from the Reservation Station. .It Li ARITH.CYCLES_DIV_BUSY .Pq Event 14H , Umask 01H Counts the number of cycles the divider is busy executing divide or square -root operations. The divide can be integer, X87 or Streaming SIMD Extensions -(SSE). The square root operation can be either X87 or SSE. +root operations. +The divide can be integer, X87 or Streaming SIMD Extensions (SSE). +The square root operation can be either X87 or SSE. Set 'edge =1, invert=1, cmask=1' to count the number of divides. Count may be incorrect When SMT is on. .It Li ARITH.MUL .Pq Event 14H , Umask 02H -Counts the number of multiply operations executed. This includes integer as -well as floating point multiply operations but excludes DPPS mul and MPSAD. +Counts the number of multiply operations executed. +This includes integer as well as floating point multiply operations but excludes DPPS mul and MPSAD. Count may be incorrect When SMT is on .It Li INST_QUEUE_WRITES .Pq Event 17H , Umask 01H @@ -350,65 +354,68 @@ Counts the number of instructions written into the instruction queue every cycle. .It Li INST_DECODED.DEC0 .Pq Event 18H , Umask 01H -Counts number of instructions that require decoder 0 to be decoded. Usually, -this means that the instruction maps to more than 1 uop +Counts number of instructions that require decoder 0 to be decoded. +Usually, this means that the instruction maps to more than 1 uop .It Li TWO_UOP_INSTS_DECODED .Pq Event 19H , Umask 01H An instruction that generates two uops was decoded .It Li INST_QUEUE_WRITE_CYCLES .Pq Event 1EH , Umask 01H This event counts the number of cycles during which instructions are written -to the instruction queue. Dividing this counter by the number of -instructions written to the instruction queue (INST_QUEUE_WRITES) yields the -average number of instructions decoded each cycle. If this number is less -than four and the pipe stalls, this indicates that the decoder is failing to +to the instruction queue. +Dividing this counter by the number of instructions written to the +instruction queue (INST_QUEUE_WRITES) yields the average number of +instructions decoded each cycle. +If this number is less than four and the pipe stalls, this indicates that the decoder is failing to decode enough instructions per cycle to sustain the 4-wide pipeline. If SSE* instructions that are 6 bytes or longer arrive one after another, -then front end throughput may limit execution speed. In such case, +then front end throughput may limit execution speed. +In such case, .It Li LSD_OVERFLOW .Pq Event 20H , Umask 01H Counts number of loops that cant stream from the instruction queue. .It Li L2_RQSTS.LD_HIT .Pq Event 24H , Umask 01H -Counts number of loads that hit the L2 cache. L2 loads include both L1D -demand misses as well as L1D prefetches. L2 loads can be rejected for -various reasons. Only non rejected loads are counted. +Counts number of loads that hit the L2 cache. +L2 loads include both L1D demand misses as well as L1D prefetches. +L2 loads can be rejected for various reasons. +Only non rejected loads are counted. .It Li L2_RQSTS.LD_MISS .Pq Event 24H , Umask 02H -Counts the number of loads that miss the L2 cache. L2 loads include both L1D -demand misses as well as L1D prefetches. +Counts the number of loads that miss the L2 cache. +L2 loads include both L1D demand misses as well as L1D prefetches. .It Li L2_RQSTS.LOADS .Pq Event 24H , Umask 03H -Counts all L2 load requests. L2 loads include both L1D demand misses as well -as L1D prefetches. +Counts all L2 load requests. +L2 loads include both L1D demand misses as well as L1D prefetches. .It Li L2_RQSTS.RFO_HIT .Pq Event 24H , Umask 04H -Counts the number of store RFO requests that hit the L2 cache. L2 RFO -requests include both L1D demand RFO misses as well as L1D RFO prefetches. +Counts the number of store RFO requests that hit the L2 cache. +L2 RFO requests include both L1D demand RFO misses as well as L1D RFO prefetches. Count includes WC memory requests, where the data is not fetched but the permission to write the line is required. .It Li L2_RQSTS.RFO_MISS .Pq Event 24H , Umask 08H -Counts the number of store RFO requests that miss the L2 cache. L2 RFO -requests include both L1D demand RFO misses as well as L1D RFO prefetches. +Counts the number of store RFO requests that miss the L2 cache. +L2 RFO requests include both L1D demand RFO misses as well as L1D RFO prefetches. .It Li L2_RQSTS.RFOS .Pq Event 24H , Umask 0CH -Counts all L2 store RFO requests. L2 RFO requests include both L1D demand -RFO misses as well as L1D RFO prefetches. +Counts all L2 store RFO requests. +L2 RFO requests include both L1D demand RFO misses as well as L1D RFO prefetches. .It Li L2_RQSTS.IFETCH_HIT .Pq Event 24H , Umask 10H -Counts number of instruction fetches that hit the L2 cache. L2 instruction -fetches include both L1I demand misses as well as L1I instruction +Counts number of instruction fetches that hit the L2 cache. +L2 instruction fetches include both L1I demand misses as well as L1I instruction prefetches. .It Li L2_RQSTS.IFETCH_MISS .Pq Event 24H , Umask 20H -Counts number of instruction fetches that miss the L2 cache. L2 instruction -fetches include both L1I demand misses as well as L1I instruction +Counts number of instruction fetches that miss the L2 cache. +L2 instruction fetches include both L1I demand misses as well as L1I instruction prefetches. .It Li L2_RQSTS.IFETCHES .Pq Event 24H , Umask 30H -Counts all instruction fetches. L2 instruction fetches include both L1I -demand misses as well as L1I instruction prefetches. +Counts all instruction fetches. +L2 instruction fetches include both L1I demand misses as well as L1I instruction prefetches. .It Li L2_RQSTS.PREFETCH_HIT .Pq Event 24H , Umask 40H Counts L2 prefetch hits for both code and data. @@ -427,27 +434,27 @@ Counts all L2 requests for both code and data. .It Li L2_DATA_RQSTS.DEMAND.I_STATE .Pq Event 26H , Umask 01H Counts number of L2 data demand loads where the cache line to be loaded is -in the I (invalid) state, i.e. a cache miss. L2 demand loads are both L1D -demand misses and L1D prefetches. +in the I (invalid) state, i.e. a cache miss. +L2 demand loads are both L1D demand misses and L1D prefetches. .It Li L2_DATA_RQSTS.DEMAND.S_STATE .Pq Event 26H , Umask 02H Counts number of L2 data demand loads where the cache line to be loaded is -in the S (shared) state. L2 demand loads are both L1D demand misses and L1D -prefetches. +in the S (shared) state. +L2 demand loads are both L1D demand misses and L1D prefetches. .It Li L2_DATA_RQSTS.DEMAND.E_STATE .Pq Event 26H , Umask 04H Counts number of L2 data demand loads where the cache line to be loaded is -in the E (exclusive) state. L2 demand loads are both L1D demand misses and -L1D prefetches. +in the E (exclusive) state. +L2 demand loads are both L1D demand misses and L1D prefetches. .It Li L2_DATA_RQSTS.DEMAND.M_STATE .Pq Event 26H , Umask 08H Counts number of L2 data demand loads where the cache line to be loaded is -in the M (modified) state. L2 demand loads are both L1D demand misses and -L1D prefetches. +in the M (modified) state. +L2 demand loads are both L1D demand misses and L1D prefetches. .It Li L2_DATA_RQSTS.DEMAND.MESI .Pq Event 26H , Umask 0FH -Counts all L2 data demand requests. L2 demand loads are both L1D demand -misses and L1D prefetches. +Counts all L2 data demand requests. +L2 demand loads are both L1D demand misses and L1D prefetches. .It Li L2_DATA_RQSTS.PREFETCH.I_STATE .Pq Event 26H , Umask 10H Counts number of L2 prefetch data loads where the cache line to be loaded is @@ -455,8 +462,9 @@ in the I (invalid) state, i.e. a cache miss. .It Li L2_DATA_RQSTS.PREFETCH.S_STATE .Pq Event 26H , Umask 20H Counts number of L2 prefetch data loads where the cache line to be loaded is -in the S (shared) state. A prefetch RFO will miss on an S state line, while -a prefetch read will hit on an S state line. +in the S (shared) state. +A prefetch RFO will miss on an S state line, while a prefetch read will +hit on an S state line. .It Li L2_DATA_RQSTS.PREFETCH.E_STATE .Pq Event 26H , Umask 40H Counts number of L2 prefetch data loads where the cache line to be loaded is @@ -474,29 +482,31 @@ Counts all L2 data requests. .It Li L2_WRITE.RFO.I_STATE .Pq Event 27H , Umask 01H Counts number of L2 demand store RFO requests where the cache line to be -loaded is in the I (invalid) state, i.e, a cache miss. The L1D prefetcher -does not issue a RFO prefetch. +loaded is in the I (invalid) state, i.e, a cache miss. +The L1D prefetcher does not issue a RFO prefetch. This is a demand RFO request .It Li L2_WRITE.RFO.S_STATE .Pq Event 27H , Umask 02H Counts number of L2 store RFO requests where the cache line to be loaded is -in the S (shared) state. The L1D prefetcher does not issue a RFO prefetch,. +in the S (shared) state. +The L1D prefetcher does not issue a RFO prefetch. This is a demand RFO request .It Li L2_WRITE.RFO.M_STATE .Pq Event 27H , Umask 08H Counts number of L2 store RFO requests where the cache line to be loaded is -in the M (modified) state. The L1D prefetcher does not issue a RFO prefetch. +in the M (modified) state. +The L1D prefetcher does not issue a RFO prefetch. This is a demand RFO request .It Li L2_WRITE.RFO.HIT .Pq Event 27H , Umask 0EH Counts number of L2 store RFO requests where the cache line to be loaded is -in either the S, E or M states. The L1D prefetcher does not issue a RFO -prefetch. +in either the S, E or M states. +The L1D prefetcher does not issue a RFO prefetch. This is a demand RFO request .It Li L2_WRITE.RFO.MESI .Pq Event 27H , Umask 0FH -Counts all L2 store RFO requests.The L1D prefetcher does not issue a RFO -prefetch. +Counts all L2 store RFO requests. +The L1D prefetcher does not issue a RFO prefetch. This is a demand RFO request .It Li L2_WRITE.LOCK.I_STATE .Pq Event 27H , Umask 10H @@ -543,25 +553,26 @@ Counts all L1 writebacks to the L2. .It Li L3_LAT_CACHE.REFERENCE .Pq Event 2EH , Umask 4FH This event counts requests originating from the core that reference a cache -line in the last level cache. The event count includes speculative traffic -but excludes cache line fills due to a L2 hardware-prefetch. Because cache -hierarchy, cache sizes and other implementation-specific characteristics; -value comparison to estimate performance differences is not recommended. +line in the last level cache. +The event count includes speculative traffic but excludes cache line fills +due to a L2 hardware-prefetch. +Because cache hierarchy, cache sizes and other implementation-specific +characteristics; value comparison to estimate performance differences is not recommended. see Table A-1 .It Li L3_LAT_CACHE.MISS .Pq Event 2EH , Umask 41H This event counts each cache miss condition for references to the last level -cache. The event count may include speculative traffic but excludes cache -line fills due to L2 hardware-prefetches. Because cache hierarchy, cache -sizes and other implementation-specific characteristics; value comparison to -estimate performance differences is not recommended. +cache. +The event count may include speculative traffic but excludes cache +line fills due to L2 hardware-prefetches. +Because cache hierarchy, cache sizes and other implementation-specific +characteristics; value comparison to estimate performance differences is not recommended. see Table A-1 .It Li CPU_CLK_UNHALTED.THREAD_P .Pq Event 3CH , Umask 00H Counts the number of thread cycles while the thread is not in a halt state. -The thread enters the halt state when it is running the HLT instruction. The -core frequency may change from time to time due to power or thermal -throttling. +The thread enters the halt state when it is running the HLT instruction. +The core frequency may change from time to time due to power or thermal throttling. see Table A-1 .It Li CPU_CLK_UNHALTED.REF_P .Pq Event 3CH , Umask 01H @@ -609,10 +620,10 @@ Counter 0, 1 only .It Li L1D_CACHE_LOCK.HIT .Pq Event 42H , Umask 01H Counts retired load locks that hit in the L1 data cache or hit in an already -allocated fill buffer. The lock portion of the load lock transaction must -hit in the L1D. -The initial load will pull the lock into the L1 data cache. Counter 0, 1 -only +allocated fill buffer. +The lock portion of the load lock transaction must hit in the L1D. +The initial load will pull the lock into the L1 data cache. +Counter 0, 1 only .It Li L1D_CACHE_LOCK.S_STATE .Pq Event 42H , Umask 02H Counts L1 data cache retired load locks that hit the target cache line in @@ -631,10 +642,10 @@ Counter 0, 1 only .It Li L1D_ALL_REF.ANY .Pq Event 43H , Umask 01H Counts all references (uncached, speculated and retired) to the L1 data -cache, including all loads and stores with any memory types. The event -counts memory accesses only when they are actually performed. For example, a -load blocked by unknown store address and later performed is only counted -once. +cache, including all loads and stores with any memory types. +The event counts memory accesses only when they are actually performed. +For example, a load blocked by unknown store address and later performed +is only counted once. The event does not include non- memory accesses, such as I/O accesses. Counter 0, 1 only .It Li L1D_ALL_REF.CACHEABLE @@ -650,8 +661,8 @@ Counts the number of misses in the STLB which causes a page walk. Counts number of misses in the STLB which resulted in a completed page walk. .It Li DTLB_MISSES.STLB_HIT .Pq Event 49H , Umask 10H -Counts the number of DTLB first level misses that hit in the second level -TLB. This event is only relevant if the core contains multiple DTLB levels. +Counts the number of DTLB first level misses that hit in the second level TLB. +This event is only relevant if the core contains multiple DTLB levels. .It Li DTLB_MISSES.PDE_MISS .Pq Event 49H , Umask 20H Number of DTLB misses caused by low part of address, includes references to 2M pages because 2M pages do not use the PDE. @@ -669,17 +680,18 @@ Counts number of hardware prefetch requests dispatched out of the prefetch FIFO. .It Li L1D_PREFETCH.MISS .Pq Event 4EH , Umask 02H -Counts number of hardware prefetch requests that miss the L1D. There are two -prefetchers in the L1D. A streamer, which predicts lines sequentially after -this one should be fetched, and the IP prefetcher that remembers access -patterns for the current instruction. The streamer prefetcher stops on an -L1D hit, while the IP prefetcher does not. +Counts number of hardware prefetch requests that miss the L1D. +There are two prefetchers in the L1D. +A streamer, which predicts lines sequentially after this one should be fetched, +and the IP prefetcher that remembers access patterns for the current instruction. +The streamer prefetcher stops on an L1D hit, while the IP prefetcher does not. .It Li L1D_PREFETCH.TRIGGERS .Pq Event 4EH , Umask 04H Counts number of prefetch requests triggered by the Finite State Machine and -pushed into the prefetch FIFO. Some of the prefetch requests are dropped due -to overwrites or competition between the IP index prefetcher and streamer -prefetcher. The prefetch FIFO contains 4 entries. +pushed into the prefetch FIFO. +Some of the prefetch requests are dropped due to overwrites or competition between +the IP index prefetcher and streamer prefetcher. +The prefetch FIFO contains 4 entries. .It Li L1D.REPL .Pq Event 51H , Umask 01H Counts the number of lines brought into the L1 data cache. @@ -708,12 +720,13 @@ Counts the number of cacheable load lock speculated or retired instructions accepted into the fill buffer. .It Li CACHE_LOCK_CYCLES.L1D_L2 .Pq Event 63H , Umask 01H -Cycle count during which the L1D and L2 are locked. A lock is asserted when -there is a locked memory access, due to uncacheable memory, a locked +Cycle count during which the L1D and L2 are locked. +A lock is asserted when there is a locked memory access, due to uncacheable memory, a locked operation that spans two cache lines, or a page walk from an uncacheable page table. -Counter 0, 1 only. L1D and L2 locks have a very high performance penalty and -it is highly recommended to avoid such accesses. +Counter 0, 1 only. +L1D and L2 locks have a very high performance penalty and it is highly recommended to +avoid such accesses. .It Li CACHE_LOCK_CYCLES.L1D .Pq Event 63H , Umask 02H Counts the number of cycles that cacheline in the L1 data cache unit is @@ -727,10 +740,11 @@ Counts the number of completed I/O transactions. Counts all instruction fetches that hit the L1 instruction cache. .It Li L1I.MISSES .Pq Event 80H , Umask 02H -Counts all instruction fetches that miss the L1I cache. This includes -instruction cache misses, streaming buffer misses, victim cache misses and -uncacheable fetches. An instruction fetch miss is counted only once and not -once for every cycle it is outstanding. +Counts all instruction fetches that miss the L1I cache. +This includes instruction cache misses, streaming buffer misses, victim cache misses and +uncacheable fetches. +An instruction fetch miss is counted only once and not once for every cycle +it is outstanding. .It Li L1I.READS .Pq Event 80H , Umask 03H Counts all instruction fetches, including uncacheable fetches that bypass @@ -803,10 +817,10 @@ Counts all near call branches executed, but not necessarily retired. Counts taken near branches executed, but not necessarily retired. .It Li BR_INST_EXEC.ANY .Pq Event 88H , Umask 7FH -Counts all near executed branches (not necessarily retired). This includes -only instructions and not micro-op branches. Frequent branching is not -necessarily a major performance issue. However frequent branch -mispredictions may be a problem. +Counts all near executed branches (not necessarily retired). +This includes only instructions and not micro-op branches. +Frequent branching is not necessarily a major performance issue. +However frequent branch mispredictions may be a problem. .It Li BR_MISP_EXEC.COND .Pq Event 89H , Umask 01H Counts the number of mispredicted conditional near branch instructions @@ -847,10 +861,10 @@ Counts the number of mispredicted near branch instructions that were executed, but not necessarily retired. .It Li RESOURCE_STALLS.ANY .Pq Event A2H , Umask 01H -Counts the number of Allocator resource related stalls. Includes register -renaming buffer entries, memory buffer entries. In addition to resource -related stalls, this event counts some other events. Includes stalls arising -during branch misprediction recovery, such as if retirement of the +Counts the number of Allocator resource related stalls. +Includes register renaming buffer entries, memory buffer entries. +In addition to resource related stalls, this event counts some other events. +Includes stalls arising during branch misprediction recovery, such as if retirement of the mispredicted branch is delayed and stalls arising while store buffer is draining from synchronizing operations. Does not include stalls due to SuperQ (off core) queue full, too many cache @@ -861,8 +875,8 @@ Counts the cycles of stall due to lack of load buffer for load operation. .It Li RESOURCE_STALLS.RS_FULL .Pq Event A2H , Umask 04H This event counts the number of cycles when the number of instructions in -the pipeline waiting for execution reaches the limit the processor can -handle. A high count of this event indicates that there are long latency +the pipeline waiting for execution reaches the limit the processor can handle. +A high count of this event indicates that there are long latency operations in the pipe (possibly load and store operations that miss the L2 cache, or instructions dependent upon instructions further down the pipeline that have yet to retire. @@ -872,8 +886,8 @@ start execution. .Pq Event A2H , Umask 08H This event counts the number of cycles that a resource related stall will occur due to the number of store instructions reaching the limit of the -pipeline, (i.e. all store buffers are used). The stall ends when a store -instruction commits its data to the cache or memory. +pipeline, (i.e. all store buffers are used). +The stall ends when a store instruction commits its data to the cache or memory. .It Li RESOURCE_STALLS.ROB_FULL .Pq Event A2H , Umask 10H Counts the cycles of stall due to re- order buffer full. @@ -884,7 +898,8 @@ floating-point unit (FPU) control word. .It Li RESOURCE_STALLS.MXCSR .Pq Event A2H , Umask 40H Stalls due to the MXCSR register rename occurring to close to a previous -MXCSR rename. The MXCSR provides control and status for the MMX registers. +MXCSR rename. +The MXCSR provides control and status for the MMX registers. .It Li RESOURCE_STALLS.OTHER .Pq Event A2H , Umask 80H Counts the number of cycles while execution was stalled due to other @@ -895,14 +910,15 @@ Counts the number of instructions decoded that are macro-fused but not necessarily executed or retired. .It Li BACLEAR_FORCE_IQ .Pq Event A7H , Umask 01H -Counts number of times a BACLEAR was forced by the Instruction Queue. The IQ -is also responsible for providing conditional branch prediction direction +Counts number of times a BACLEAR was forced by the Instruction Queue. +The IQ is also responsible for providing conditional branch prediction direction based on a static scheme and dynamic data provided by the L2 Branch -Prediction Unit. If the conditional branch target is not found in the Target -Array and the IQ predicts that the branch is taken, then the IQ will force -the Branch Address Calculator to issue a BACLEAR. Each BACLEAR asserted by -the BAC generates approximately an 8 cycle bubble in the instruction fetch -pipeline. +Prediction Unit. +If the conditional branch target is not found in the Target Array and the IQ +predicts that the branch is taken, then the IQ will force +the Branch Address Calculator to issue a BACLEAR. +Each BACLEAR asserted by the BAC generates approximately an 8 cycle bubble +in the instruction fetch pipeline. .It Li LSD.UOPS .Pq Event A8H , Umask 01H Counts the number of micro-ops delivered by loop stream detector @@ -915,30 +931,32 @@ Counts the number of ITLB flushes Counts number of L1D writebacks to the uncore. .It Li UOPS_EXECUTED.PORT0 .Pq Event B1H , Umask 01H -Counts number of Uops executed that were issued on port 0. Port 0 handles -integer arithmetic, SIMD and FP add Uops. +Counts number of Uops executed that were issued on port 0. +Port 0 handles integer arithmetic, SIMD and FP add Uops. .It Li UOPS_EXECUTED.PORT1 .Pq Event B1H , Umask 02H -Counts number of Uops executed that were issued on port 1. Port 1 handles -integer arithmetic, SIMD, integer shift, FP multiply and FP divide Uops. +Counts number of Uops executed that were issued on port 1. +Port 1 handles integer arithmetic, SIMD, integer shift, FP multiply and FP divide Uops. .It Li UOPS_EXECUTED.PORT2_CORE .Pq Event B1H , Umask 04H -Counts number of Uops executed that were issued on port 2. Port 2 handles -the load Uops. This is a core count only and can not be collected per -thread. +Counts number of Uops executed that were issued on port 2. +Port 2 handles the load Uops. +This is a core count only and can not be collected per thread. .It Li UOPS_EXECUTED.PORT3_CORE .Pq Event B1H , Umask 08H -Counts number of Uops executed that were issued on port 3. Port 3 handles -store Uops. This is a core count only and can not be collected per thread. +Counts number of Uops executed that were issued on port 3. +Port 3 handles store Uops. +This is a core count only and can not be collected per thread. .It Li UOPS_EXECUTED.PORT4_CORE .Pq Event B1H , Umask 10H -Counts number of Uops executed that where issued on port 4. Port 4 handles -the value to be stored for the store Uops issued on port 3. This is a core -count only and can not be collected per thread. +Counts number of Uops executed that where issued on port 4. +Port 4 handles the value to be stored for the store Uops issued on port 3. +This is a core count only and can not be collected per thread. .It Li UOPS_EXECUTED.CORE_ACTIVE_CYCLES_NO_PORT5 .Pq Event B1H , Umask 1FH Counts cycles when the Uops executed were issued from any ports except port -5. Use Cmask=1 for active cycles; Cmask=0 for weighted cycles; Use CMask=1, +5. +Use Cmask=1 for active cycles; Cmask=0 for weighted cycles; Use CMask=1, Invert=1 to count P0-4 stalled cycles Use Cmask=1, Edge=1, Invert=1 to count P0-4 stalls. .It Li UOPS_EXECUTED.PORT5 @@ -946,8 +964,8 @@ P0-4 stalls. Counts number of Uops executed that where issued on port 5. .It Li UOPS_EXECUTED.CORE_ACTIVE_CYCLES .Pq Event B1H , Umask 3FH -Counts cycles when the Uops are executing. Use Cmask=1 for active cycles; -Cmask=0 for weighted cycles; Use CMask=1, Invert=1 to count P0-4 stalled +Counts cycles when the Uops are executing. +Use Cmask=1 for active cycles; Cmask=0 for weighted cycles; Use CMask=1, Invert=1 to count P0-4 stalled cycles Use Cmask=1, Edge=1, Invert=1 to count P0-4 stalls. .It Li UOPS_EXECUTED.PORT015 .Pq Event B1H , Umask 40H @@ -986,7 +1004,8 @@ Requires programming MSR 01A7H See Table A-1 Notes: INST_RETIRED.ANY is counted by a designated fixed counter. INST_RETIRED.ANY_P is counted by a programmable counter and is an -architectural performance event. Event is supported if CPUID.A.EBX[1] = 0. +architectural performance event. +Event is supported if CPUID.A.EBX[1] = 0. Counting: Faulting executions of GETSEC/VM entry/VM Exit/MWait will not count as retired instructions. .It Li INST_RETIRED.X87 @@ -1001,10 +1020,10 @@ instructions. .It Li UOPS_RETIRED.ANY .Pq Event C2H , Umask 01H Counts the number of micro-ops retired, (macro-fused=1, micro- fused=2, -others=1; maximum count of 8 per cycle). Most instructions are composed of -one or two micro-ops. Some instructions are decoded into longer sequences -such as repeat instructions, floating point transcendental instructions, and -assists. +others=1; maximum count of 8 per cycle). +Most instructions are composed of one or two micro-ops. +Some instructions are decoded into longer sequences such as repeat instructions, +floating point transcendental instructions, and assists. Use cmask=1 and invert to count active cycles or stalled cycles .It Li UOPS_RETIRED.RETIRE_SLOTS .Pq Event C2H , Umask 02H @@ -1022,7 +1041,8 @@ Counts the number of machine clears due to memory order conflicts. .Pq Event C3H , Umask 04H Counts the number of times that a program writes to a code section. Self-modifying code causes a sever penalty in all Intel 64 and IA-32 -processors. The modified cache line is written back to the L2 and L3caches. +processors. +The modified cache line is written back to the L2 and L3caches. .It Li BR_INST_RETIRED.ALL_BRANCHES .Pq Event C4H , Umask 00H See Table A-1 @@ -1072,24 +1092,25 @@ Counts number of retired loads that hit their own, unshared lines in the L3 cache. .It Li MEM_LOAD_RETIRED.OTHER_CORE_L2_HIT_HITM .Pq Event CBH , Umask 08H -Counts number of retired loads that hit in a sibling core's L2 (on die -core). Since the L3 is inclusive of all cores on the package, this is an L3 -hit. This counts both clean or modified hits. +Counts number of retired loads that hit in a sibling core's L2 (on die core). +Since the L3 is inclusive of all cores on the package, this is an L3 hit. +This counts both clean or modified hits. .It Li MEM_LOAD_RETIRED.L3_MISS .Pq Event CBH , Umask 10H -Counts number of retired loads that miss the L3 cache. The load was -satisfied by a remote socket, local memory or an IOH. +Counts number of retired loads that miss the L3 cache. +The load was satisfied by a remote socket, local memory or an IOH. .It Li MEM_LOAD_RETIRED.HIT_LFB .Pq Event CBH , Umask 40H Counts number of retired loads that miss the L1D and the address is located -in an allocated line fill buffer and will soon be committed to cache. This -is counting secondary L1D misses. +in an allocated line fill buffer and will soon be committed to cache. +This is counting secondary L1D misses. .It Li MEM_LOAD_RETIRED.DTLB_MISS .Pq Event CBH , Umask 80H -Counts the number of retired loads that missed the DTLB. The DTLB miss is -not counted if the load operation causes a fault. This event counts loads -from cacheable memory only. The event does not count loads by software -prefetches. Counts both primary and secondary misses to the TLB. +Counts the number of retired loads that missed the DTLB. +The DTLB miss is not counted if the load operation causes a fault. +This event counts loads from cacheable memory only. +The event does not count loads by software prefetches. +Counts both primary and secondary misses to the TLB. .It Li FP_MMX_TRANS.TO_FP .Pq Event CCH , Umask 01H Counts the first floating-point instruction following any MMX instruction. @@ -1097,29 +1118,30 @@ You can use this event to estimate the penalties for the transitions between floating-point and MMX technology states. .It Li FP_MMX_TRANS.TO_MMX .Pq Event CCH , Umask 02H -Counts the first MMX instruction following a floating-point instruction. You -can use this event to estimate the penalties for the transitions between +Counts the first MMX instruction following a floating-point instruction. +You can use this event to estimate the penalties for the transitions between floating-point and MMX technology states. .It Li FP_MMX_TRANS.ANY .Pq Event CCH , Umask 03H Counts all transitions from floating point to MMX instructions and from MMX -instructions to floating point instructions. You can use this event to -estimate the penalties for the transitions between floating-point and MMX -technology states. +instructions to floating point instructions. +You can use this event to estimate the penalties for the transitions between +floating-point and MMX technology states. .It Li MACRO_INSTS.DECODED .Pq Event D0H , Umask 01H Counts the number of instructions decoded, (but not necessarily executed or retired). .It Li UOPS_DECODED.MS .Pq Event D1H , Umask 02H -Counts the number of Uops decoded by the Microcode Sequencer, MS. The MS -delivers uops when the instruction is more than 4 uops long or a microcode +Counts the number of Uops decoded by the Microcode Sequencer, MS. +The MS delivers uops when the instruction is more than 4 uops long or a microcode assist is occurring. .It Li UOPS_DECODED.ESP_FOLDING .Pq Event D1H , Umask 04H Counts number of stack pointer (ESP) instructions decoded: push , pop , call -, ret, etc. ESP instructions do not generate a Uop to increment or decrement -ESP. Instead, they update an ESP_Offset register that keeps track of the +, ret, etc. +ESP instructions do not generate a Uop to increment or decrement ESP. +Instead, they update an ESP_Offset register that keeps track of the delta to the current value of the ESP register. .It Li UOPS_DECODED.ESP_SYNC .Pq Event D1H , Umask 08H @@ -1129,8 +1151,8 @@ value of the ESP register. .It Li RAT_STALLS.FLAGS .Pq Event D2H , Umask 01H Counts the number of cycles during which execution stalled due to several -reasons, one of which is a partial flag register stall. A partial register -stall may occur when two conditions are met: 1) an instruction modifies +reasons, one of which is a partial flag register stall. +A partial register stall may occur when two conditions are met: 1) an instruction modifies some, but not all, of the flags in the flag register and 2) the next instruction, which depends on flags, depends on flags that were not modified by this instruction. @@ -1142,30 +1164,33 @@ was partially written by previous instruction. .It Li RAT_STALLS.ROB_READ_PORT .Pq Event D2H , Umask 04H Counts the number of cycles when ROB read port stalls occurred, which did -not allow new micro-ops to enter the out-of-order pipeline. Note that, at -this stage in the pipeline, additional stalls may occur at the same cycle -and prevent the stalled micro-ops from entering the pipe. In such a case, -micro-ops retry entering the execution pipe in the next cycle and the -ROB-read port stall is counted again. +not allow new micro-ops to enter the out-of-order pipeline. +Note that, at this stage in the pipeline, additional stalls may occur at +the same cycle and prevent the stalled micro-ops from entering the pipe. +In such a case, micro-ops retry entering the execution pipe in the next +cycle and the ROB-read port stall is counted again. .It Li RAT_STALLS.SCOREBOARD .Pq Event D2H , Umask 08H Counts the cycles where we stall due to microarchitecturally required -serialization. Microcode scoreboarding stalls. +serialization. +Microcode scoreboarding stalls. .It Li RAT_STALLS.ANY .Pq Event D2H , Umask 0FH Counts all Register Allocation Table stall cycles due to: Cycles when ROB read port stalls occurred, which did not allow new micro-ops to enter the -execution pipe. Cycles when partial register stalls occurred Cycles when -flag stalls occurred Cycles floating-point unit (FPU) status word stalls -occurred. To count each of these conditions separately use the events: +execution pipe. +Cycles when partial register stalls occurred Cycles when flag stalls occurred +Cycles floating-point unit (FPU) status word stalls occurred. +To count each of these conditions separately use the events: RAT_STALLS.ROB_READ_PORT, RAT_STALLS.PARTIAL, RAT_STALLS.FLAGS, and RAT_STALLS.FPSW. .It Li SEG_RENAME_STALLS .Pq Event D4H , Umask 01H Counts the number of stall cycles due to the lack of renaming resources for -the ES, DS, FS, and GS segment registers. If a segment is renamed but not -retired and a second update to the same segment occurs, a stall occurs in -the front-end of the pipeline until the renamed segment retires. +the ES, DS, FS, and GS segment registers. +If a segment is renamed but not retired and a second update to the same +segment occurs, a stall occurs in the front-end of the pipeline until the +renamed segment retires. .It Li ES_REG_RENAMES .Pq Event D5H , Umask 01H Counts the number of times the ES segment register is renamed. @@ -1183,17 +1208,19 @@ or return branch. .Pq Event E6H , Umask 01H Counts the number of times the front end is resteered, mainly when the Branch Prediction Unit cannot provide a correct prediction and this is -corrected by the Branch Address Calculator at the front end. This can occur -if the code has many branches such that they cannot be consumed by the BPU. +corrected by the Branch Address Calculator at the front end. +This can occur if the code has many branches such that they cannot be +consumed by the BPU. Each BACLEAR asserted by the BAC generates approximately an 8 cycle bubble -in the instruction fetch pipeline. The effect on total execution time -depends on the surrounding code. +in the instruction fetch pipeline. +The effect on total execution time depends on the surrounding code. .It Li BACLEAR.BAD_TARGET .Pq Event E6H , Umask 02H Counts number of Branch Address Calculator clears (BACLEAR) asserted due to conditional branch instructions in which there was a target hit but the -direction was wrong. Each BACLEAR asserted by the BAC generates -approximately an 8 cycle bubble in the instruction fetch pipeline. +direction was wrong. +Each BACLEAR asserted by the BAC generates approximately an 8 cycle bubble in +the instruction fetch pipeline. .It Li BPU_CLEARS.EARLY .Pq Event E8H , Umask 01H Counts early (normal) Branch Prediction Unit clears: BPU predicted a taken @@ -1201,8 +1228,8 @@ branch after incorrectly assuming that it was not taken. The BPU clear leads to 2 cycle bubble in the Front End. .It Li BPU_CLEARS.LATE .Pq Event E8H , Umask 02H -Counts late Branch Prediction Unit clears due to Most Recently Used -conflicts. The PBU clear leads to a 3 cycle bubble in the Front End. +Counts late Branch Prediction Unit clears due to Most Recently Used conflicts. +The PBU clear leads to a 3 cycle bubble in the Front End. .It Li L2_TRANSACTIONS.LOAD .Pq Event F0H , Umask 01H Counts L2 load operations due to HW prefetch or demand loads. @@ -1259,12 +1286,13 @@ Counts all L2 cache lines evicted for any reason. Counts the number of SQ lock splits across a cache line. .It Li SQ_FULL_STALL_CYCLES .Pq Event F6H , Umask 01H -Counts cycles the Super Queue is full. Neither of the threads on this core -will be able to access the uncore. +Counts cycles the Super Queue is full. +Neither of the threads on this core will be able to access the uncore. .It Li FP_ASSIST.ALL .Pq Event F7H , Umask 01H Counts the number of floating point operations executed that required -micro-code assist intervention. Assists are required in the following cases: +micro-code assist intervention. +Assists are required in the following cases: SSE instructions, (Denormal input when the DAZ flag is off or Underflow result when the FTZ flag is off): x87 instructions, (NaN or denormal are loaded to a register or used as input from memory, Division by 0 or @@ -1361,8 +1389,8 @@ Number of cycles interrupts are pending and masked .It Li HW_INT.CYCLES_PENDING_AND_MASKED .Pq Event 04H , Umask 04H Counts number of L2 store RFO requests where the cache line to be loaded is -in the E (exclusive) state. The L1D prefetcher does not issue a RFO -prefetch. +in the E (exclusive) state. +The L1D prefetcher does not issue a RFO prefetch. This is a demand RFO request .It Li HW_INT.CYCLES_PENDING_AND_MASKED .Pq Event 27H , Umask 04H @@ -1403,34 +1431,34 @@ Counts number of SSE non temporal stores Counts store fence cycles .It Li EPT.EPDE_MISS .Pq Event 4FH , Umask 02H -Counts Extended Page Directory Entry misses. The Extended Page Directory -cache is used by Virtual Machine operating systems while the guest operating -systems use the standard TLB caches. +Counts Extended Page Directory Entry misses. +The Extended Page Directory cache is used by Virtual Machine operating +systems while the guest operating systems use the standard TLB caches. .It Li EPT.EPDPE_HIT .Pq Event 4FH , Umask 04H Counts Extended Page Directory Pointer Entry hits. .It Li EPT.EPDPE_MISS .Pq Event 4FH , Umask 08H -Counts Extended Page Directory Pointer Entry misses. T +Counts Extended Page Directory Pointer Entry misses. .It Li OFFCORE_REQUESTS_OUTSTANDING.DEMAND.READ_DATA .Pq Event 60H , Umask 01H -Counts weighted cycles of offcore demand data read requests. Does not -include L2 prefetch requests. +Counts weighted cycles of offcore demand data read requests. +Does not include L2 prefetch requests. counter 0 .It Li OFFCORE_REQUESTS_OUTSTANDING.DEMAND.READ_CODE .Pq Event 60H , Umask 02H -Counts weighted cycles of offcore demand code read requests. Does not -include L2 prefetch requests. +Counts weighted cycles of offcore demand code read requests. +Does not include L2 prefetch requests. counter 0 .It Li OFFCORE_REQUESTS_OUTSTANDING.DEMAND.RFO .Pq Event 60H , Umask 04H -Counts weighted cycles of offcore demand RFO requests. Does not include L2 -prefetch requests. +Counts weighted cycles of offcore demand RFO requests. +Does not include L2 prefetch requests. counter 0 .It Li OFFCORE_REQUESTS_OUTSTANDING.ANY.READ .Pq Event 60H , Umask 08H -Counts weighted cycles of offcore read requests of any kind. Include L2 -prefetch requests. +Counts weighted cycles of offcore read requests of any kind. +Include L2 prefetch requests. counter 0 .It Li IFU_IVC.FULL .Pq Event 81H , Umask 01H @@ -1463,22 +1491,24 @@ translation was missed. Counts number of completed large page walks due to misses in the STLB. .It Li ITLB_MISSES.LARGE_WALK_COMPLETED .Pq Event 01H , Umask 80H -Counts number of offcore demand data read requests. Does not count L2 -prefetch requests. +Counts number of offcore demand data read requests. +Does not count L2 prefetch requests. .It Li OFFCORE_REQUESTS.DEMAND.READ_CODE .Pq Event B0H , Umask 02H -Counts number of offcore demand code read requests. Does not count L2 -prefetch requests. +Counts number of offcore demand code read requests. +Does not count L2 prefetch requests. .It Li OFFCORE_REQUESTS.DEMAND.RFO .Pq Event B0H , Umask 04H -Counts number of offcore demand RFO requests. Does not count L2 prefetch -requests. +Counts number of offcore demand RFO requests. +Does not count L2 prefetch requests. .It Li OFFCORE_REQUESTS.ANY.READ .Pq Event B0H , Umask 08H -Counts number of offcore read requests. Includes L2 prefetch requests. +Counts number of offcore read requests. +Includes L2 prefetch requests. .It Li OFFCORE_REQUESTS.ANY.RFO .Pq Event B0H , Umask 10H -Counts number of offcore RFO requests. Includes L2 prefetch requests. +Counts number of offcore RFO requests. +Includes L2 prefetch requests. .It Li OFFCORE_REQUESTS.UNCACHED_MEM .Pq Event B0H , Umask 20H Counts number of offcore uncached memory requests. @@ -1487,23 +1517,23 @@ Counts number of offcore uncached memory requests. Counts all offcore requests. .It Li SNOOPQ_REQUESTS_OUTSTANDING.DATA .Pq Event B3H , Umask 01H -Counts weighted cycles of snoopq requests for data. Counter 0 only -Use cmask=1 to count cycles not empty. +Counts weighted cycles of snoopq requests for data. +Counter 0 only Use cmask=1 to count cycles not empty. .It Li SNOOPQ_REQUESTS_OUTSTANDING.INVALIDATE .Pq Event B3H , Umask 02H -Counts weighted cycles of snoopq invalidate requests. Counter 0 only -Use cmask=1 to count cycles not empty. +Counts weighted cycles of snoopq invalidate requests. +Counter 0 only Use cmask=1 to count cycles not empty. .It Li SNOOPQ_REQUESTS_OUTSTANDING.CODE .Pq Event B3H , Umask 04H -Counts weighted cycles of snoopq requests for code. Counter 0 only -Use cmask=1 to count cycles not empty. +Counts weighted cycles of snoopq requests for code. +Counter 0 only Use cmask=1 to count cycles not empty. .It Li SNOOPQ_REQUESTS_OUTSTANDING.CODE .Pq Event BAH , Umask 04H Counts number of TPR reads .It Li PIC_ACCESSES.TPR_WRITES .Pq Event BAH , Umask 02H -Counts number of TPR writes -one or two micro-ops. Some instructions are decoded into longer sequences +Counts number of TPR writes one or two micro-ops. +Some instructions are decoded into longer sequences .It Li MACHINE_CLEARS.FUSION_ASSIST .Pq Event C3H , Umask 10H Counts the number of macro-fusion assists diff --git a/lib/libpmc/pmc.corei7uc.3 b/lib/libpmc/pmc.corei7uc.3 index 3bcda1c7b499..1f49222ceda6 100644 --- a/lib/libpmc/pmc.corei7uc.3 +++ b/lib/libpmc/pmc.corei7uc.3 @@ -115,8 +115,8 @@ Uncore cycles Global Queue read tracker is full. Uncore cycles Global Queue write tracker is full. .It Li GQ_CYCLES_FULL.PEER_PROBE_TRACKER *** 2807 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Mon Jul 12 04:32:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4014064E576; Mon, 12 Jul 2021 04:32: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 4GNW8p0mvbz3FkC; Mon, 12 Jul 2021 04:32: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 01071A91; Mon, 12 Jul 2021 04:32: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 16C4WvHI012188; Mon, 12 Jul 2021 04:32:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16C4WvUD012187; Mon, 12 Jul 2021 04:32:57 GMT (envelope-from git) Date: Mon, 12 Jul 2021 04:32:57 GMT Message-Id: <202107120432.16C4WvUD012187@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: 4c87085d3521 - main - nfsd: Fix some issues found by mandoc 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: 4c87085d3521dd25009f597161734e085cd47570 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 04:32:58 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=4c87085d3521dd25009f597161734e085cd47570 commit 4c87085d3521dd25009f597161734e085cd47570 Author: Gordon Bergling AuthorDate: 2021-07-12 04:31:54 +0000 Commit: Gordon Bergling CommitDate: 2021-07-12 04:31:54 +0000 nfsd: Fix some issues found by mandoc - consider using OS macro: Fx Reviewed by: bcr MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31145 --- usr.sbin/nfsd/nfsv4.4 | 4 +++- usr.sbin/nfsd/pnfs.4 | 51 ++++++++++++++++++++++++++++++++++------------ usr.sbin/nfsd/pnfsserver.4 | 41 ++++++++++++++++++++++++++++--------- 3 files changed, 72 insertions(+), 24 deletions(-) diff --git a/usr.sbin/nfsd/nfsv4.4 b/usr.sbin/nfsd/nfsv4.4 index de40194cd1dd..8460ed174ea6 100644 --- a/usr.sbin/nfsd/nfsv4.4 +++ b/usr.sbin/nfsd/nfsv4.4 @@ -143,7 +143,9 @@ by default. However, this can normally be overridden by a command line option or configuration file for the daemon used to do the name<->number mapping. -Under FreeBSD, the mapping daemon is called +Under +.Fx , +the mapping daemon is called .Xr nfsuserd 8 and has a command line option that overrides the domain component of the machine's hostname. diff --git a/usr.sbin/nfsd/pnfs.4 b/usr.sbin/nfsd/pnfs.4 index c48357591f85..94fe02536ba1 100644 --- a/usr.sbin/nfsd/pnfs.4 +++ b/usr.sbin/nfsd/pnfs.4 @@ -54,10 +54,14 @@ the DS. The first is DeviceInfo, which is static information defining the DS server. The critical piece of information in DeviceInfo for the layout types -supported by FreeBSD is the IP address that is used to perform RPCs on the DS. +supported by +.Fx +is the IP address that is used to perform RPCs on the DS. It also indicates which version of NFS the DS supports, I/O size and other layout specific information. -In the DeviceInfo, there is a DeviceID which, for the FreeBSD server +In the DeviceInfo, there is a DeviceID which, for the +.Fx +server is unique to the DS configuration and changes whenever the .Xr nfsd @@ -66,35 +70,51 @@ daemon is restarted or the server is rebooted. The second is the layout, which is per file and references the DeviceInfo to use via the DeviceID. It is for a byte range of a file and is either Read or Read/Write. -For the FreeBSD server, a layout covers all bytes of a file. +For the +.Fx +server, a layout covers all bytes of a file. A layout may be recalled by the MDS using a LayoutRecall callback. When a client returns a layout via the LayoutReturn operation it can indicate that error(s) were encountered while doing I/O on the DS, at least for certain layout types such as the Flexible File Layout. .Pp -The FreeBSD client and server supports two layout types. +The +.Fx +client and server supports two layout types. .Pp The File Layout is described in RFC5661 and uses the NFSv4.1 or NFSv4.2 protocol to perform I/O on the DS. It does not support client aware DS mirroring and, as such, -the FreeBSD server only provides File Layout support for non-mirrored +the +.Fx +server only provides File Layout support for non-mirrored configurations. .Pp The Flexible File Layout allows the use of the NFSv3, NFSv4.0, NFSv4.1 or NFSv4.2 protocol to perform I/O on the DS and does support client aware mirroring. -As such, the FreeBSD server uses Flexible File Layout layouts for the +As such, the +.Fx +server uses Flexible File Layout layouts for the mirrored DS configurations. -The FreeBSD server supports the +The +.Fx +server supports the .Dq tightly coupled variant and all DSs allow use of the NFSv4.2 or NFSv4.1 protocol for I/O operations. Clients that support the Flexible File Layout will do writes and commits to all DS mirrors in the mirror set. .Pp -A FreeBSD pNFS service consists of a single MDS server plus one or more -DS servers, all of which are FreeBSD systems. -For a non-mirrored configuration, the FreeBSD server will issue File Layout +A +.Fx +pNFS service consists of a single MDS server plus one or more +DS servers, all of which are +.Fx +systems. +For a non-mirrored configuration, the +.Fx +server will issue File Layout layouts by default. However that default can be set to the Flexible File Layout by setting the .Xr sysctl 1 @@ -105,7 +125,8 @@ Mirrored server configurations will only issue Flexible File Layouts. .Tn pNFS clients mount the MDS as they would a single NFS server. .Pp -A FreeBSD +A +.Fx .Tn pNFS client must be running the .Xr nfscbd 8 @@ -165,7 +186,9 @@ as a mirror while the pNFS service continues to function. .Pp See .Xr pnfsserver 4 -for information on how to set up a FreeBSD pNFS service. +for information on how to set up a +.Fx +pNFS service. .Sh SEE ALSO .Xr nfsv4 4 , .Xr pnfsserver 4 , @@ -187,7 +210,9 @@ For Linux 4.17-rc2 kernels, I have not seen client crashes during testing, but it only supports the .Dq loosely coupled variant. -To make it work correctly when mounting the FreeBSD server, you must +To make it work correctly when mounting the +.Fx +server, you must set the sysctl .Dq vfs.nfsd.flexlinuxhack to one so that it works around diff --git a/usr.sbin/nfsd/pnfsserver.4 b/usr.sbin/nfsd/pnfsserver.4 index 22c2ecdb8696..f3cf2fa6acf9 100644 --- a/usr.sbin/nfsd/pnfsserver.4 +++ b/usr.sbin/nfsd/pnfsserver.4 @@ -30,14 +30,22 @@ .Nm pNFSserver .Nd NFS Version 4.1 and 4.2 Parallel NFS Protocol Server .Sh DESCRIPTION -A set of FreeBSD servers may be configured to provide a +A set of +.Fx +servers may be configured to provide a .Xr pnfs 4 service. -One FreeBSD system needs to be configured as a MetaData Server (MDS) and -at least one additional FreeBSD system needs to be configured as one or +One +.Fx +system needs to be configured as a MetaData Server (MDS) and +at least one additional +.Fx +system needs to be configured as one or more Data Servers (DS)s. .Pp -These FreeBSD systems are configured to be NFSv4.1 and NFSv4.2 +These +.Fx +systems are configured to be NFSv4.1 and NFSv4.2 servers, see .Xr nfsd 8 and @@ -85,7 +93,9 @@ not require the export option and this directory should be exported to them with the same options as used by the MDS to export file system(s) to the clients. .Pp -It is possible to have multiple DSs on the same FreeBSD system, but each +It is possible to have multiple DSs on the same +.Fx +system, but each of these DSs must have a separate top level exported directory used for storage of data files and each of these DSs must be mountable via a separate IP address. @@ -94,10 +104,15 @@ interface via .Xr ifconfig 8 to create these different IP addresses. Multiple DSs on the same server may be useful when data for different file systems -on the MDS are being stored on different file system volumes on the FreeBSD +on the MDS are being stored on different file system volumes on the +.Fx DS system. .Sh MDS server configuration -The MDS must be a separate FreeBSD system from the FreeBSD DS system(s) and +The MDS must be a separate +.Fx +system from the +.Fx +DS system(s) and NFS clients. It is configured as a NFSv4.1 and NFSv4.2 server with file system(s) exported to clients. @@ -189,7 +204,9 @@ nfs_server_flags="-u -t -n 128 -p nfsv4-data0:/data0#/export1,nfsv4-data1:/data1 This can be used by system administrators to control where data files are stored and might be useful for control of storage use. For this case, it may be convenient to co-locate more than one of the DSs -on the same FreeBSD server, using separate file systems on the DS system +on the same +.Fx +server, using separate file systems on the DS system for storage of the respective DS's data files. If mirroring is desired for this case, the .Dq -m @@ -211,7 +228,9 @@ For a service that will store a large number of files this sysctl should be set much larger, to avoid the number of entries in a subdirectory from getting too large. .Sh Client mounts -Once operational, NFSv4.1 or NFSv4.2 FreeBSD client mounts +Once operational, NFSv4.1 or NFSv4.2 +.Fx +client mounts done with the .Dq pnfs option should do I/O directly on the DSs. @@ -421,5 +440,7 @@ Since the MDS cannot be mirrored, it is a single point of failure just as a non .Tn pNFS server is. -For non-mirrored configurations, all FreeBSD systems used in the service +For non-mirrored configurations, all +.Fx +systems used in the service are single points of failure. From owner-dev-commits-src-main@freebsd.org Mon Jul 12 05:05:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C487650C86; Mon, 12 Jul 2021 05:05: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 4GNWtB2D1vz3Jpr; Mon, 12 Jul 2021 05:05: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 30DA6FA9; Mon, 12 Jul 2021 05:05: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 16C55MKA052605; Mon, 12 Jul 2021 05:05:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16C55MsG052604; Mon, 12 Jul 2021 05:05:22 GMT (envelope-from git) Date: Mon, 12 Jul 2021 05:05:22 GMT Message-Id: <202107120505.16C55MsG052604@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: 844aa31c6d87 - main - cache: add cache_enter_time_flags 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: 844aa31c6d8785e7256a84d8ee7e8ae2362f9367 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 05:05:22 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=844aa31c6d8785e7256a84d8ee7e8ae2362f9367 commit 844aa31c6d8785e7256a84d8ee7e8ae2362f9367 Author: Mateusz Guzik AuthorDate: 2021-07-08 07:56:27 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-12 05:03:14 +0000 cache: add cache_enter_time_flags --- sys/kern/vfs_cache.c | 24 ++++++++++++++++++++++++ sys/sys/vnode.h | 6 ++++++ 2 files changed, 30 insertions(+) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 5b978511db17..09f926d0cd31 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -2582,6 +2582,30 @@ out_unlock_free: return; } +/* + * A variant of the above accepting flags. + * + * - VFS_CACHE_DROPOLD -- if a conflicting entry is found, drop it. + * + * TODO: this routine is a hack. It blindly removes the old entry, even if it + * happens to match and it is doing it in an inefficient manner. It was added + * to accomodate NFS which runs into a case where the target for a given name + * may change from under it. Note this does nothing to solve the following + * race: 2 callers of cache_enter_time_flags pass a different target vnode for + * the same [dvp, cnp]. It may be argued that code doing this is broken. + */ +void +cache_enter_time_flags(struct vnode *dvp, struct vnode *vp, struct componentname *cnp, + struct timespec *tsp, struct timespec *dtsp, int flags) +{ + + MPASS((flags & ~(VFS_CACHE_DROPOLD)) == 0); + + if (flags & VFS_CACHE_DROPOLD) + cache_remove_cnp(dvp, cnp); + cache_enter_time(dvp, vp, cnp, tsp, dtsp); +} + static u_int cache_roundup_2(u_int val) { diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index ed5867b80754..64fb00c5845e 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -641,6 +641,12 @@ int bnoreuselist(struct bufv *bufv, struct bufobj *bo, daddr_t startn, daddr_t endn); /* cache_* may belong in namei.h. */ void cache_changesize(u_long newhashsize); + +#define VFS_CACHE_DROPOLD 0x1 + +void cache_enter_time_flags(struct vnode *dvp, struct vnode *vp, + struct componentname *cnp, struct timespec *tsp, + struct timespec *dtsp, int flags); #define cache_enter(dvp, vp, cnp) \ cache_enter_time(dvp, vp, cnp, NULL, NULL) void cache_enter_time(struct vnode *dvp, struct vnode *vp, From owner-dev-commits-src-main@freebsd.org Mon Jul 12 05:50:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4776165137F; Mon, 12 Jul 2021 05:50: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 4GNXsp1cy9z3PQ1; Mon, 12 Jul 2021 05:50: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 1A87A10CA; Mon, 12 Jul 2021 05:50: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 16C5o5go007840; Mon, 12 Jul 2021 05:50:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16C5o5Xd007837; Mon, 12 Jul 2021 05:50:05 GMT (envelope-from git) Date: Mon, 12 Jul 2021 05:50:05 GMT Message-Id: <202107120550.16C5o5Xd007837@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: c43bf3f59161 - main - snd_hda(4): Fix sound on headset jack for ThinkPad T51. 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: c43bf3f59161ac697a1c3a0a3f9326d4d15216c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 05:50:06 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=c43bf3f59161ac697a1c3a0a3f9326d4d15216c9 commit c43bf3f59161ac697a1c3a0a3f9326d4d15216c9 Author: Xin LI AuthorDate: 2021-07-12 05:43:56 +0000 Commit: Xin LI CommitDate: 2021-07-12 05:46:49 +0000 snd_hda(4): Fix sound on headset jack for ThinkPad T51. sys/dev/sound/pci/hda/hdaa_patches.c: match_pin_patches: Use HDA_DEV_MATCH instead of regular == sys/dev/sound/pci/hda/pin_patch_realtek.h: Add quirk for Lenovo laptops when ALC298 is used. --- sys/dev/sound/pci/hda/hdaa_patches.c | 2 +- sys/dev/sound/pci/hda/pin_patch_realtek.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/dev/sound/pci/hda/hdaa_patches.c b/sys/dev/sound/pci/hda/hdaa_patches.c index 69299ee4344f..dc404b9ba98e 100644 --- a/sys/dev/sound/pci/hda/hdaa_patches.c +++ b/sys/dev/sound/pci/hda/hdaa_patches.c @@ -157,7 +157,7 @@ match_pin_patches(int vendor_id, int vendor_subid) continue; for (struct model_pin_patch_t *pp = p->patches; pp->models; pp++) { for (struct pin_machine_model_t *model = pp->models; model->id != 0; model++) { - if (vendor_subid == model->id) + if (HDA_DEV_MATCH(model->id, vendor_subid)) return (pp->pin_patches); } } diff --git a/sys/dev/sound/pci/hda/pin_patch_realtek.h b/sys/dev/sound/pci/hda/pin_patch_realtek.h index ddaeeaef5345..804885659515 100644 --- a/sys/dev/sound/pci/hda/pin_patch_realtek.h +++ b/sys/dev/sound/pci/hda/pin_patch_realtek.h @@ -648,6 +648,17 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { { } }, .pin_patches = pin_patches_dell_xps_jack + }, + { + .models = (struct pin_machine_model_t[]){ + PIN_SUBVENDOR(LENOVO_ALL_SUBVENDOR), + { } + }, + .pin_patches = (struct pin_patch_t[]){ + PIN_PATCH_DOCK_LINE_OUT(23), + PIN_PATCH_HP_OUT(33), + { } + }, }, { } } }, { /**** CODEC: HDA_CODEC_ALC861 ****/ From owner-dev-commits-src-main@freebsd.org Mon Jul 12 06:13:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7BB86516B2; Mon, 12 Jul 2021 06:13: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 4GNYNG4Q2Vz3h64; Mon, 12 Jul 2021 06:13: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 7E75F1D68; Mon, 12 Jul 2021 06:13: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 16C6D2PM044617; Mon, 12 Jul 2021 06:13:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16C6D2Zr044616; Mon, 12 Jul 2021 06:13:02 GMT (envelope-from git) Date: Mon, 12 Jul 2021 06:13:02 GMT Message-Id: <202107120613.16C6D2Zr044616@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: 86d69de88d1c - main - Fix blankspace anomalies, no actual code change. 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: 86d69de88d1c7e8c7ed906590652008fc6f44d05 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 06:13:02 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=86d69de88d1c7e8c7ed906590652008fc6f44d05 commit 86d69de88d1c7e8c7ed906590652008fc6f44d05 Author: Xin LI AuthorDate: 2021-07-12 06:12:24 +0000 Commit: Xin LI CommitDate: 2021-07-12 06:12:24 +0000 Fix blankspace anomalies, no actual code change. --- sys/dev/sound/pci/hda/hda_reg.h | 26 +++++------ sys/dev/sound/pci/hda/hdaa.c | 50 ++++++++++----------- sys/dev/sound/pci/hda/hdaa.h | 4 +- sys/dev/sound/pci/hda/hdac.c | 8 ++-- sys/dev/sound/pci/hda/hdac.h | 2 +- sys/dev/sound/pci/hda/hdacc.c | 14 +++--- sys/dev/sound/pci/hda/pin_patch.h | 2 +- sys/dev/sound/pci/hda/pin_patch_realtek.h | 72 +++++++++++++++---------------- 8 files changed, 89 insertions(+), 89 deletions(-) diff --git a/sys/dev/sound/pci/hda/hda_reg.h b/sys/dev/sound/pci/hda/hda_reg.h index 91099caf083d..59fe92dd6d7e 100644 --- a/sys/dev/sound/pci/hda/hda_reg.h +++ b/sys/dev/sound/pci/hda/hda_reg.h @@ -668,7 +668,7 @@ /* Channel Count Control */ #define HDA_CMD_VERB_GET_CONV_CHAN_COUNT 0xf2d -#define HDA_CMD_VERB_SET_CONV_CHAN_COUNT 0x72d +#define HDA_CMD_VERB_SET_CONV_CHAN_COUNT 0x72d #define HDA_CMD_GET_CONV_CHAN_COUNT(cad, nid) \ (HDA_CMD_12BIT((cad), (nid), \ @@ -677,20 +677,20 @@ (HDA_CMD_12BIT((cad), (nid), \ HDA_CMD_VERB_SET_CONV_CHAN_COUNT, (payload))) -#define HDA_CMD_VERB_GET_HDMI_DIP_SIZE 0xf2e +#define HDA_CMD_VERB_GET_HDMI_DIP_SIZE 0xf2e #define HDA_CMD_GET_HDMI_DIP_SIZE(cad, nid, arg) \ (HDA_CMD_12BIT((cad), (nid), \ HDA_CMD_VERB_GET_HDMI_DIP_SIZE, (arg))) -#define HDA_CMD_VERB_GET_HDMI_ELDD 0xf2f +#define HDA_CMD_VERB_GET_HDMI_ELDD 0xf2f #define HDA_CMD_GET_HDMI_ELDD(cad, nid, off) \ (HDA_CMD_12BIT((cad), (nid), \ HDA_CMD_VERB_GET_HDMI_ELDD, (off))) -#define HDA_CMD_VERB_GET_HDMI_DIP_INDEX 0xf30 -#define HDA_CMD_VERB_SET_HDMI_DIP_INDEX 0x730 +#define HDA_CMD_VERB_GET_HDMI_DIP_INDEX 0xf30 +#define HDA_CMD_VERB_SET_HDMI_DIP_INDEX 0x730 #define HDA_CMD_GET_HDMI_DIP_INDEX(cad, nid) \ (HDA_CMD_12BIT((cad), (nid), \ @@ -699,8 +699,8 @@ (HDA_CMD_12BIT((cad), (nid), \ HDA_CMD_VERB_SET_HDMI_DIP_INDEX, (payload))) -#define HDA_CMD_VERB_GET_HDMI_DIP_DATA 0xf31 -#define HDA_CMD_VERB_SET_HDMI_DIP_DATA 0x731 +#define HDA_CMD_VERB_GET_HDMI_DIP_DATA 0xf31 +#define HDA_CMD_VERB_SET_HDMI_DIP_DATA 0x731 #define HDA_CMD_GET_HDMI_DIP_DATA(cad, nid) \ (HDA_CMD_12BIT((cad), (nid), \ @@ -709,8 +709,8 @@ (HDA_CMD_12BIT((cad), (nid), \ HDA_CMD_VERB_SET_HDMI_DIP_DATA, (payload))) -#define HDA_CMD_VERB_GET_HDMI_DIP_XMIT 0xf32 -#define HDA_CMD_VERB_SET_HDMI_DIP_XMIT 0x732 +#define HDA_CMD_VERB_GET_HDMI_DIP_XMIT 0xf32 +#define HDA_CMD_VERB_SET_HDMI_DIP_XMIT 0x732 #define HDA_CMD_GET_HDMI_DIP_XMIT(cad, nid) \ (HDA_CMD_12BIT((cad), (nid), \ @@ -719,11 +719,11 @@ (HDA_CMD_12BIT((cad), (nid), \ HDA_CMD_VERB_SET_HDMI_DIP_XMIT, (payload))) -#define HDA_CMD_VERB_GET_HDMI_CP_CTRL 0xf33 -#define HDA_CMD_VERB_SET_HDMI_CP_CTRL 0x733 +#define HDA_CMD_VERB_GET_HDMI_CP_CTRL 0xf33 +#define HDA_CMD_VERB_SET_HDMI_CP_CTRL 0x733 -#define HDA_CMD_VERB_GET_HDMI_CHAN_SLOT 0xf34 -#define HDA_CMD_VERB_SET_HDMI_CHAN_SLOT 0x734 +#define HDA_CMD_VERB_GET_HDMI_CHAN_SLOT 0xf34 +#define HDA_CMD_VERB_SET_HDMI_CHAN_SLOT 0x734 #define HDA_CMD_GET_HDMI_CHAN_SLOT(cad, nid) \ (HDA_CMD_12BIT((cad), (nid), \ diff --git a/sys/dev/sound/pci/hda/hdaa.c b/sys/dev/sound/pci/hda/hdaa.c index ae7d77d431b2..621361c5fa70 100644 --- a/sys/dev/sound/pci/hda/hdaa.c +++ b/sys/dev/sound/pci/hda/hdaa.c @@ -2712,7 +2712,7 @@ hdaa_audio_ctl_recsel_comm(struct hdaa_pcm_devinfo *pdevinfo, uint32_t src, nid_ if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_MIXER) { ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, HDAA_CTL_IN, i, 1); - if (ctl == NULL) + if (ctl == NULL) continue; /* If we have input control on this node mute them * according to requested sources. */ @@ -3080,7 +3080,7 @@ hdaa_audio_ctl_parse(struct hdaa_devinfo *devinfo) if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX || w->waspin) ctls[cnt].ndir = HDAA_CTL_IN; - else + else ctls[cnt].ndir = HDAA_CTL_OUT; ctls[cnt++].dir = HDAA_CTL_OUT; } @@ -3145,7 +3145,7 @@ hdaa_audio_ctl_parse(struct hdaa_devinfo *devinfo) if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) ctls[cnt].ndir = HDAA_CTL_OUT; - else + else ctls[cnt].ndir = HDAA_CTL_IN; ctls[cnt++].dir = HDAA_CTL_IN; break; @@ -4138,7 +4138,7 @@ hdaa_audio_disable_nonaudio(struct hdaa_devinfo *devinfo) w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_VOLUME_WIDGET) { w->enable = 0; HDA_BOOTHVERBOSE( - device_printf(devinfo->dev, + device_printf(devinfo->dev, " Disabling nid %d due to it's" " non-audio type.\n", w->nid); @@ -4165,7 +4165,7 @@ hdaa_audio_disable_useless(struct hdaa_devinfo *devinfo) HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_NONE) { w->enable = 0; HDA_BOOTHVERBOSE( - device_printf(devinfo->dev, + device_printf(devinfo->dev, " Disabling pin nid %d due" " to None connectivity.\n", w->nid); @@ -4174,7 +4174,7 @@ hdaa_audio_disable_useless(struct hdaa_devinfo *devinfo) HDA_CONFIG_DEFAULTCONF_ASSOCIATION_MASK) == 0) { w->enable = 0; HDA_BOOTHVERBOSE( - device_printf(devinfo->dev, + device_printf(devinfo->dev, " Disabling unassociated" " pin nid %d.\n", w->nid); @@ -4201,7 +4201,7 @@ hdaa_audio_disable_useless(struct hdaa_devinfo *devinfo) ctl->widget->connsenable[ctl->index] = 0; done = 0; HDA_BOOTHVERBOSE( - device_printf(devinfo->dev, + device_printf(devinfo->dev, " Disabling ctl %d nid %d cnid %d due" " to disabled widget.\n", i, ctl->widget->nid, @@ -4222,7 +4222,7 @@ hdaa_audio_disable_useless(struct hdaa_devinfo *devinfo) if (cw == NULL || cw->enable == 0) { w->connsenable[j] = 0; HDA_BOOTHVERBOSE( - device_printf(devinfo->dev, + device_printf(devinfo->dev, " Disabling nid %d connection %d due" " to disabled child widget.\n", i, j); @@ -4245,7 +4245,7 @@ hdaa_audio_disable_useless(struct hdaa_devinfo *devinfo) w->enable = 0; done = 0; HDA_BOOTHVERBOSE( - device_printf(devinfo->dev, + device_printf(devinfo->dev, " Disabling nid %d due to all it's" " inputs disabled.\n", w->nid); ); @@ -4270,7 +4270,7 @@ hdaa_audio_disable_useless(struct hdaa_devinfo *devinfo) w->enable = 0; done = 0; HDA_BOOTHVERBOSE( - device_printf(devinfo->dev, + device_printf(devinfo->dev, " Disabling nid %d due to all it's" " consumers disabled.\n", w->nid); ); @@ -4296,7 +4296,7 @@ hdaa_audio_disable_unas(struct hdaa_devinfo *devinfo) if (w->bindas == -1) { w->enable = 0; HDA_BOOTHVERBOSE( - device_printf(devinfo->dev, + device_printf(devinfo->dev, " Disabling unassociated nid %d.\n", w->nid); ); @@ -4318,7 +4318,7 @@ hdaa_audio_disable_unas(struct hdaa_devinfo *devinfo) continue; w->connsenable[j] = 0; HDA_BOOTHVERBOSE( - device_printf(devinfo->dev, + device_printf(devinfo->dev, " Disabling connection to input pin " "nid %d conn %d.\n", i, j); @@ -4351,7 +4351,7 @@ hdaa_audio_disable_unas(struct hdaa_devinfo *devinfo) if (cw->connsenable[j] && cw->conns[j] == i) { cw->connsenable[j] = 0; HDA_BOOTHVERBOSE( - device_printf(devinfo->dev, + device_printf(devinfo->dev, " Disabling connection from output pin " "nid %d conn %d cnid %d.\n", k, j, i); @@ -4400,7 +4400,7 @@ hdaa_audio_disable_notselected(struct hdaa_devinfo *devinfo) continue; w->connsenable[j] = 0; HDA_BOOTHVERBOSE( - device_printf(devinfo->dev, + device_printf(devinfo->dev, " Disabling unselected connection " "nid %d conn %d.\n", i, j); @@ -4455,7 +4455,7 @@ hdaa_audio_disable_crossas(struct hdaa_devinfo *devinfo) continue; w->connsenable[j] = 0; HDA_BOOTHVERBOSE( - device_printf(devinfo->dev, + device_printf(devinfo->dev, " Disabling crossassociatement connection " "nid %d conn %d cnid %d.\n", i, j, cw->nid); @@ -4497,7 +4497,7 @@ hdaa_audio_disable_crossas(struct hdaa_devinfo *devinfo) if (ctl->ndir == HDAA_CTL_IN) ctl->widget->connsenable[ctl->index] = 0; HDA_BOOTHVERBOSE( - device_printf(devinfo->dev, + device_printf(devinfo->dev, " Disabling crossassociatement connection " "ctl %d nid %d cnid %d.\n", i, ctl->widget->nid, @@ -4719,7 +4719,7 @@ hdaa_audio_assign_names(struct hdaa_devinfo *devinfo) int i, j; int type = -1, use, used = 0; static const int types[7][13] = { - { SOUND_MIXER_LINE, SOUND_MIXER_LINE1, SOUND_MIXER_LINE2, + { SOUND_MIXER_LINE, SOUND_MIXER_LINE1, SOUND_MIXER_LINE2, SOUND_MIXER_LINE3, -1 }, /* line */ { SOUND_MIXER_MONITOR, SOUND_MIXER_MIC, -1 }, /* int mic */ { SOUND_MIXER_MIC, SOUND_MIXER_MONITOR, -1 }, /* ext mic */ @@ -5034,10 +5034,10 @@ hdaa_audio_prepare_pin_ctrl(struct hdaa_devinfo *devinfo) /* Disable everything. */ if (devinfo->init_clear) { w->wclass.pin.ctrl &= ~( - HDA_CMD_SET_PIN_WIDGET_CTRL_HPHN_ENABLE | - HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE | - HDA_CMD_SET_PIN_WIDGET_CTRL_IN_ENABLE | - HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK); + HDA_CMD_SET_PIN_WIDGET_CTRL_HPHN_ENABLE | + HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE | + HDA_CMD_SET_PIN_WIDGET_CTRL_IN_ENABLE | + HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK); } if (w->enable == 0) { @@ -5917,7 +5917,7 @@ hdaa_dump_dst_nid(struct hdaa_pcm_devinfo *pdevinfo, nid_t nid, int depth) printf("\n"); return; } - printf(" [src: %s]", + printf(" [src: %s]", hdaa_audio_ctl_ossmixer_mask2allname( w->ossmask, buf, sizeof(buf))); if (w->ossdev >= 0) { @@ -6246,10 +6246,10 @@ hdaa_configure(device_t dev) printf(" "); printf(" ossmask=0x%08x\n", ctl->ossmask); - device_printf(dev, + device_printf(dev, " mute: %d step: %3d size: %3d off: %3d%s\n", ctl->mute, ctl->step, ctl->size, ctl->offset, - (ctl->enable == 0) ? " [DISABLED]" : + (ctl->enable == 0) ? " [DISABLED]" : ((ctl->ossmask == 0) ? " [UNUSED]" : "")); } device_printf(dev, "\n"); @@ -7043,7 +7043,7 @@ hdaa_pcm_attach(device_t dev) } else pdevinfo->chan_blkcnt = HDA_BDL_DEFAULT; - /* + /* * We don't register interrupt handler with snd_setup_intr * in pcm device. Mark pcm device as MPSAFE manually. */ diff --git a/sys/dev/sound/pci/hda/hdaa.h b/sys/dev/sound/pci/hda/hdaa.h index 4fdc3fcead26..15a3db5edd04 100644 --- a/sys/dev/sound/pci/hda/hdaa.h +++ b/sys/dev/sound/pci/hda/hdaa.h @@ -252,10 +252,10 @@ struct hdaa_chan { #define RANGEQDB(ctl) \ ((ctl)->step * ((ctl)->size + 1)) -#define VAL2QDB(ctl, val) \ +#define VAL2QDB(ctl, val) \ (((ctl)->size + 1) * ((int)(val) - (ctl)->offset)) -#define QDB2VAL(ctl, qdb) \ +#define QDB2VAL(ctl, qdb) \ imax(imin((((qdb) + (ctl)->size / 2 * ((qdb) > 0 ? 1 : -1)) / \ ((ctl)->size + 1) + (ctl)->offset), (ctl)->step), 0) diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c index b1fb193595fe..cad631f4ee5d 100644 --- a/sys/dev/sound/pci/hda/hdac.c +++ b/sys/dev/sound/pci/hda/hdac.c @@ -603,9 +603,9 @@ hdac_dma_alloc(struct hdac_softc *sc, struct hdac_dma *dma, bus_size_t size) BUS_SPACE_MAXADDR, /* highaddr */ NULL, /* filtfunc */ NULL, /* fistfuncarg */ - roundsz, /* maxsize */ + roundsz, /* maxsize */ 1, /* nsegments */ - roundsz, /* maxsegsz */ + roundsz, /* maxsegsz */ 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockfuncarg */ @@ -1313,9 +1313,9 @@ hdac_attach(device_t dev) BUS_SPACE_MAXADDR, /* highaddr */ NULL, /* filtfunc */ NULL, /* fistfuncarg */ - HDA_BUFSZ_MAX, /* maxsize */ + HDA_BUFSZ_MAX, /* maxsize */ 1, /* nsegments */ - HDA_BUFSZ_MAX, /* maxsegsz */ + HDA_BUFSZ_MAX, /* maxsegsz */ 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockfuncarg */ diff --git a/sys/dev/sound/pci/hda/hdac.h b/sys/dev/sound/pci/hda/hdac.h index 611cb98badd8..06ac0371df6b 100644 --- a/sys/dev/sound/pci/hda/hdac.h +++ b/sys/dev/sound/pci/hda/hdac.h @@ -90,7 +90,7 @@ #define HDA_INTEL_CNLK HDA_MODEL_CONSTRUCT(INTEL, 0x9dc8) #define HDA_INTEL_ICLK HDA_MODEL_CONSTRUCT(INTEL, 0x34c8) #define HDA_INTEL_CMLKLP HDA_MODEL_CONSTRUCT(INTEL, 0x02c8) -#define HDA_INTEL_CMLKH HDA_MODEL_CONSTRUCT(INTEL, 0x06c8) +#define HDA_INTEL_CMLKH HDA_MODEL_CONSTRUCT(INTEL, 0x06c8) #define HDA_INTEL_TGLK HDA_MODEL_CONSTRUCT(INTEL, 0xa0c8) #define INTEL_A100ID_SUBVENDOR HDA_MODEL_CONSTRUCT(INTEL, 0xa100) #define INTEL_D400ID_SUBVENDOR HDA_MODEL_CONSTRUCT(INTEL, 0xd400) diff --git a/sys/dev/sound/pci/hda/hdacc.c b/sys/dev/sound/pci/hda/hdacc.c index ff72498ecb9f..e663ffa3dbcf 100644 --- a/sys/dev/sound/pci/hda/hdacc.c +++ b/sys/dev/sound/pci/hda/hdacc.c @@ -196,19 +196,19 @@ static const struct { { HDA_CODEC_STAC9229D, 0, "Sigmatel STAC9229D" }, { HDA_CODEC_STAC9230X, 0, "Sigmatel STAC9230X" }, { HDA_CODEC_STAC9230D, 0, "Sigmatel STAC9230D" }, - { HDA_CODEC_STAC9250, 0, "Sigmatel STAC9250" }, - { HDA_CODEC_STAC9251, 0, "Sigmatel STAC9251" }, - { HDA_CODEC_STAC9255, 0, "Sigmatel STAC9255" }, - { HDA_CODEC_STAC9255D, 0, "Sigmatel STAC9255D" }, - { HDA_CODEC_STAC9254, 0, "Sigmatel STAC9254" }, - { HDA_CODEC_STAC9254D, 0, "Sigmatel STAC9254D" }, + { HDA_CODEC_STAC9250, 0, "Sigmatel STAC9250" }, + { HDA_CODEC_STAC9251, 0, "Sigmatel STAC9251" }, + { HDA_CODEC_STAC9255, 0, "Sigmatel STAC9255" }, + { HDA_CODEC_STAC9255D, 0, "Sigmatel STAC9255D" }, + { HDA_CODEC_STAC9254, 0, "Sigmatel STAC9254" }, + { HDA_CODEC_STAC9254D, 0, "Sigmatel STAC9254D" }, { HDA_CODEC_STAC9271X, 0, "Sigmatel STAC9271X" }, { HDA_CODEC_STAC9271D, 0, "Sigmatel STAC9271D" }, { HDA_CODEC_STAC9272X, 0, "Sigmatel STAC9272X" }, { HDA_CODEC_STAC9272D, 0, "Sigmatel STAC9272D" }, { HDA_CODEC_STAC9273X, 0, "Sigmatel STAC9273X" }, { HDA_CODEC_STAC9273D, 0, "Sigmatel STAC9273D" }, - { HDA_CODEC_STAC9274, 0, "Sigmatel STAC9274" }, + { HDA_CODEC_STAC9274, 0, "Sigmatel STAC9274" }, { HDA_CODEC_STAC9274D, 0, "Sigmatel STAC9274D" }, { HDA_CODEC_STAC9274X5NH, 0, "Sigmatel STAC9274X5NH" }, { HDA_CODEC_STAC9274D5NH, 0, "Sigmatel STAC9274D5NH" }, diff --git a/sys/dev/sound/pci/hda/pin_patch.h b/sys/dev/sound/pci/hda/pin_patch.h index 8e2c9875906f..ecf23bdb9603 100644 --- a/sys/dev/sound/pci/hda/pin_patch.h +++ b/sys/dev/sound/pci/hda/pin_patch.h @@ -109,7 +109,7 @@ struct pin_machine_model_t { struct model_pin_patch_t { struct pin_machine_model_t *models; /* list of machine models */ - struct pin_patch_t *pin_patches; /* hardcoded overrides */ + struct pin_patch_t *pin_patches; /* hardcoded overrides */ void (*fixup_func)(struct hdaa_widget *); /* for future use */ }; diff --git a/sys/dev/sound/pci/hda/pin_patch_realtek.h b/sys/dev/sound/pci/hda/pin_patch_realtek.h index 804885659515..dfa262e3610a 100644 --- a/sys/dev/sound/pci/hda/pin_patch_realtek.h +++ b/sys/dev/sound/pci/hda/pin_patch_realtek.h @@ -194,7 +194,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_JACK_WO_DETECT(25), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -204,7 +204,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_JACK_WO_DETECT(25), PIN_PATCH_HPMIC_WO_DETECT(26), - { } + { } } }, { } } @@ -219,7 +219,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_STRING(27, "seq=1 as=5 misc=1 ctype=Analog device=Speaker loc=Internal conn=Fixed"), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -235,7 +235,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_MIC_INTERNAL(19), PIN_PATCH_STRING(25, "as=2 misc=1 color=Black ctype=1/8 device=Mic loc=Right"), - { } + { } } }, { } } @@ -249,7 +249,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_STRING(16, "seq=15 device=Headphones"), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -258,7 +258,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_STRING(17, "as=1 misc=1 ctype=ATAPI device=Speaker loc=Internal conn=Fixed"), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -267,7 +267,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_STRING(15, "color=Green ctype=1/8 device=Headphones loc=Rear"), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -286,7 +286,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { PIN_PATCH_NOT_APPLICABLE(23), PIN_PATCH_NOT_APPLICABLE(24), PIN_PATCH_NOT_APPLICABLE(25), - { } + { } } }, { } } @@ -302,7 +302,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { PIN_PATCH_STRING(20, "as=1 misc=1 ctype=ATAPI device=Speaker loc=Onboard conn=Fixed"), PIN_PATCH_STRING(21, "seq=15 as=2 misc=4 color=Black ctype=1/8 device=Headphones loc=Front"), PIN_PATCH_STRING(22, "seq=15 as=1 misc=4 color=Black ctype=1/8 device=Headphones loc=Rear"), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -311,7 +311,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_STRING(21, "as=1 misc=1 ctype=Analog device=Speaker loc=Internal conn=Fixed"), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -320,7 +320,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_STRING(22, "as=2 misc=1 ctype=ATAPI device=Speaker loc=Onboard conn=Fixed"), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -329,7 +329,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_STRING(22, "as=15 misc=1 color=White ctype=ATAPI device=AUX loc=Onboard"), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -338,7 +338,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_STRING(22, "seq=1 as=2"), - { } + { } } }, { } } @@ -352,7 +352,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_STRING(20, "as=1 seq=15"), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -361,7 +361,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_STRING(30, "as=8 misc=1 color=Black ctype=Combo device=SPDIF-out loc=Rear"), - { } + { } } }, { } } @@ -375,7 +375,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_STRING(21, "as=1 seq=15"), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -389,7 +389,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_DOCK_MIC_IN(25), PIN_PATCH_DOCK_HP(27), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -398,7 +398,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_STRING(33, "as=1 seq=15"), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -407,7 +407,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_SUBWOOFER(23), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -417,7 +417,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_DOCK_LINE_OUT(26), PIN_PATCH_DOCK_MIC_IN(27), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -426,7 +426,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_HPMIC_WITH_DETECT(25), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -436,7 +436,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_STRING(33, "seq=15 as=2 color=Black ctype=1/8 device=Headphones loc=Front"), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -448,7 +448,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_JACK_WO_DETECT(25), PIN_PATCH_HPMIC_WO_DETECT(26), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -458,7 +458,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_JACK_WO_DETECT(25), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -467,7 +467,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_STRING(24, "seq=12 as=2 misc=8 color=Black ctype=1/8 device=Mic loc=Right"), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -480,7 +480,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { PIN_PATCH_STRING(24, "as=1 misc=1 ctype=ATAPI device=Speaker loc=Onboard conn=Fixed"), PIN_PATCH_STRING(30, "seq=14 as=1 color=Black ctype=Digital device=SPDIF-out loc=Left"), PIN_PATCH_STRING(33, "seq=15 as=1 color=Black ctype=1/8 device=Headphones loc=Left"), - { } + { } } }, { .models = (struct pin_machine_model_t[]){ @@ -490,7 +490,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_STRING(24, "seq=15 as=3 color=Black ctype=1/8 device=Line-in loc=Ext-Rear"), PIN_PATCH_STRING(27, "as=2 color=Black ctype=1/8 loc=Ext-Rear"), - { } + { } } }, { } } @@ -510,7 +510,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { PIN_PATCH_STRING(25, "as=2 misc=12 color=Pink ctype=1/8 device=Mic loc=Rear"), PIN_PATCH_STRING(27, "seq=15 as=2 misc=1 ctype=Analog device=Mic loc=Onboard conn=Fixed"), PIN_PATCH_HP_OUT(33), - { } + { } } }, { } } @@ -527,7 +527,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { PIN_PATCH_STRING(27, "as=2 color=Black ctype=1/8 loc=Ext-Rear"), PIN_PATCH_HPMIC_WITH_DETECT(26), PIN_PATCH_STRING(24, "seq=15 as=3 color=Black ctype=1/8 device=Line-in loc=Ext-Rear"), - { } + { } } }, { } } @@ -550,7 +550,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { PIN_PATCH_STRING(29, "seq=13 as=2 misc=11 color=Pink ctype=DIN device=Other conn=None"), PIN_PATCH_NOT_APPLICABLE(30), PIN_PATCH_STRING(33, "seq=15 as=1 color=Black ctype=1/8 device=Headphones loc=Left"), - { } + { } } }, { } } @@ -565,7 +565,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_JACK_WO_DETECT(25), - { } + { } } }, { } } @@ -596,7 +596,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { PIN_PATCH_STRING(21, "seq=15 as=1 color=Green ctype=1/8 device=Headphones loc=Front"), PIN_PATCH_STRING(23, "seq=2 as=1 misc=1 ctype=Analog device=Speaker loc=Internal conn=Fixed"), PIN_PATCH_JACK_WO_DETECT(26), - { } + { } } }, { } } @@ -610,7 +610,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_STRING(21, "as=1 seq=15"), - { } + { } } }, { } } @@ -635,7 +635,7 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_HPMIC_WO_DETECT(24), PIN_PATCH_JACK_WO_DETECT(26), - { } + { } } }, { } } @@ -993,11 +993,11 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = { }, .pin_patches = (struct pin_patch_t[]){ PIN_PATCH_STRING(27, "as=1 seq=15"), - { } + { } } }, { } } - } + } }; #endif /* PIN_PATCH_REALTEK_H */ From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D81965CBC0; Mon, 12 Jul 2021 12:00: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 4GNj570mRjz3GSl; Mon, 12 Jul 2021 12:00: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 02BC1678D; Mon, 12 Jul 2021 12:00: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 16CC0Qx8008261; Mon, 12 Jul 2021 12:00:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0QwG008260; Mon, 12 Jul 2021 12:00:26 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:26 GMT Message-Id: <202107121200.16CC0QwG008260@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: c8bdc78be19d - main - mlx5: cqe64: update the tunneled bit name with recent PRM 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: c8bdc78be19da5443c9186fa2fdb6e9427795565 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:27 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c8bdc78be19da5443c9186fa2fdb6e9427795565 commit c8bdc78be19da5443c9186fa2fdb6e9427795565 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:23:22 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:36 +0000 mlx5: cqe64: update the tunneled bit name with recent PRM Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/dev/mlx5/device.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/mlx5/device.h b/sys/dev/mlx5/device.h index 69057d5f2470..64d4ed87d58f 100644 --- a/sys/dev/mlx5/device.h +++ b/sys/dev/mlx5/device.h @@ -662,8 +662,9 @@ struct mlx5_err_cqe { }; struct mlx5_cqe64 { - u8 tunneled_etc; - u8 rsvd0[3]; + u8 tls_outer_l3_tunneled; + u8 rsvd0; + __be16 wqe_id; u8 lro_tcppsh_abort_dupack; u8 lro_min_ttl; __be16 lro_tcp_win; @@ -724,7 +725,7 @@ static inline bool cqe_has_vlan(struct mlx5_cqe64 *cqe) static inline bool cqe_is_tunneled(struct mlx5_cqe64 *cqe) { - return cqe->tunneled_etc & 0x1; + return cqe->tls_outer_l3_tunneled & 0x1; } enum { From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43E0965CE2E; Mon, 12 Jul 2021 12:00: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 4GNj581SLnz3GP0; Mon, 12 Jul 2021 12:00: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 1BBC86707; Mon, 12 Jul 2021 12:00: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 16CC0SGA008290; Mon, 12 Jul 2021 12:00:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0SGE008289; Mon, 12 Jul 2021 12:00:28 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:28 GMT Message-Id: <202107121200.16CC0SGE008289@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: bc56a8f9e7ab - main - mlx5: Flow steering tree: increase number of supported flow tables from 3 to 5 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: bc56a8f9e7abc20820757298cbb32c4aaa4fc0bc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:28 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bc56a8f9e7abc20820757298cbb32c4aaa4fc0bc commit bc56a8f9e7abc20820757298cbb32c4aaa4fc0bc Author: Konstantin Belousov AuthorDate: 2021-04-06 03:24:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:37 +0000 mlx5: Flow steering tree: increase number of supported flow tables from 3 to 5 Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c index e7951682e56d..55c7896e3d52 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c @@ -66,7 +66,7 @@ #define BYPASS_MAX_FT 5 #define BYPASS_PRIO_MAX_FT 1 -#define KERNEL_MAX_FT 3 +#define KERNEL_MAX_FT 5 #define LEFTOVER_MAX_FT 1 #define KENREL_MIN_LEVEL 3 #define LEFTOVER_MIN_LEVEL KENREL_MIN_LEVEL + 1 From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7841F65CE35; Mon, 12 Jul 2021 12:00: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 4GNj592tKYz3GWY; Mon, 12 Jul 2021 12:00: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 482396708; Mon, 12 Jul 2021 12:00: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 16CC0To9008314; Mon, 12 Jul 2021 12:00:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0T14008313; Mon, 12 Jul 2021 12:00:29 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:29 GMT Message-Id: <202107121200.16CC0T14008313@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: 8b8c71d7ac31 - main - mlx5en: increase the limit MLX5E_MAX_TX_HEADER 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: 8b8c71d7ac31140277ab0383d22e6cb5c2d779d4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:29 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8b8c71d7ac31140277ab0383d22e6cb5c2d779d4 commit 8b8c71d7ac31140277ab0383d22e6cb5c2d779d4 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:26:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:37 +0000 mlx5en: increase the limit MLX5E_MAX_TX_HEADER to accomodate for large inline headers for VxLAN TX Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/dev/mlx5/mlx5_en/en.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index 2ec47fa96a6d..86f44dda168c 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -125,7 +125,7 @@ #define MLX5E_SQ_TX_QUEUE_SIZE 4096 /* SQ drbr queue size */ #define MLX5E_MAX_TX_NUM_TC 8 /* units */ -#define MLX5E_MAX_TX_HEADER 128 /* bytes */ +#define MLX5E_MAX_TX_HEADER 192 /* bytes */ #define MLX5E_MAX_TX_PAYLOAD_SIZE 65536 /* bytes */ #define MLX5E_MAX_TX_MBUF_SIZE 65536 /* bytes */ #define MLX5E_MAX_TX_MBUF_FRAGS \ From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF60E65CE37; Mon, 12 Jul 2021 12:00: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 4GNj5B3wCZz3G4c; Mon, 12 Jul 2021 12:00: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 6ABF364B8; Mon, 12 Jul 2021 12:00: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 16CC0UTa008338; Mon, 12 Jul 2021 12:00:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0UNx008337; Mon, 12 Jul 2021 12:00:30 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:30 GMT Message-Id: <202107121200.16CC0UNx008337@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: 16816f968917 - main - mlx5en: style, remove redundant parentheses 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: 16816f968917f15ba69fe56faafe4564439c6d47 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:30 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=16816f968917f15ba69fe56faafe4564439c6d47 commit 16816f968917f15ba69fe56faafe4564439c6d47 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:29:22 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:37 +0000 mlx5en: style, remove redundant parentheses Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index c8dd21f6aadc..124d2afe414c 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -256,7 +256,7 @@ mlx5e_get_full_header_size(const struct mbuf *mb, const struct tcphdr **ppth) if (unlikely(mb->m_len < ETHER_HDR_LEN)) goto failure; if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { - if (unlikely(mb->m_len < (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN))) + if (unlikely(mb->m_len < ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN)) goto failure; eth_type = ntohs(eh->evl_proto); eth_hdr_len = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB52865CC62; Mon, 12 Jul 2021 12:00: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 4GNj5C58DXz3GNN; Mon, 12 Jul 2021 12:00: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 8CAD4678E; Mon, 12 Jul 2021 12:00: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 16CC0VfP008362; Mon, 12 Jul 2021 12:00:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0Vhp008361; Mon, 12 Jul 2021 12:00:31 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:31 GMT Message-Id: <202107121200.16CC0Vhp008361@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: 1b36b3869f3b - main - mlx5en: eliminate magic constant 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: 1b36b3869f3be722dd15760ddcb4598b6dfe7cf7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:32 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1b36b3869f3be722dd15760ddcb4598b6dfe7cf7 commit 1b36b3869f3be722dd15760ddcb4598b6dfe7cf7 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:30:09 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:37 +0000 mlx5en: eliminate magic constant Use sizeof(struct udphdr) where appropriate Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index 124d2afe414c..1ba47e44ae96 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -277,7 +277,7 @@ mlx5e_get_full_header_size(const struct mbuf *mb, const struct tcphdr **ppth) goto tcp_packet; case IPPROTO_UDP: ip_hlen = ip->ip_hl << 2; - eth_hdr_len += ip_hlen + 8; + eth_hdr_len += ip_hlen + sizeof(struct udphdr); th = NULL; goto udp_packet; default: @@ -293,7 +293,7 @@ mlx5e_get_full_header_size(const struct mbuf *mb, const struct tcphdr **ppth) eth_hdr_len += sizeof(*ip6); goto tcp_packet; case IPPROTO_UDP: - eth_hdr_len += sizeof(*ip6) + 8; + eth_hdr_len += sizeof(*ip6) + sizeof(struct udphdr); th = NULL; goto udp_packet; default: From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C24C65CE46; Mon, 12 Jul 2021 12:00: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 4GNj5D5s5Pz3GRc; Mon, 12 Jul 2021 12:00: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 A6DB26882; Mon, 12 Jul 2021 12:00: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 16CC0WbU008386; Mon, 12 Jul 2021 12:00:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0WpQ008385; Mon, 12 Jul 2021 12:00:32 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:32 GMT Message-Id: <202107121200.16CC0WpQ008385@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: 861a612d7bad - main - mlx5en: register vxlan start/stop handlers 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: 861a612d7bad4812630c9be55e7b59d8fe2cfa18 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:33 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=861a612d7bad4812630c9be55e7b59d8fe2cfa18 commit 861a612d7bad4812630c9be55e7b59d8fe2cfa18 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:38:59 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:37 +0000 mlx5en: register vxlan start/stop handlers Handlers maintain flow rules and inform hardware about non-standard VxLAN port in use. The database of the vxlan end points is maintained. Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/dev/mlx5/mlx5_en/en.h | 25 ++ sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 674 +++++++++++++++++++++++++++++- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 10 + 3 files changed, 701 insertions(+), 8 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index 86f44dda168c..ab30c7e2ca90 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -944,6 +944,18 @@ struct mlx5e_vlan_db { bool filter_disabled; }; +struct mlx5e_vxlan_db_el { + u_int refcount; + u_int proto; + u_int port; + struct mlx5_flow_rule *vxlan_ft_rule; + TAILQ_ENTRY(mlx5e_vxlan_db_el) link; +}; + +struct mlx5e_vxlan_db { + TAILQ_HEAD(, mlx5e_vxlan_db_el) head; +}; + struct mlx5e_flow_table { int num_groups; struct mlx5_flow_table *t; @@ -953,7 +965,11 @@ struct mlx5e_flow_table { struct mlx5e_flow_tables { struct mlx5_flow_namespace *ns; struct mlx5e_flow_table vlan; + struct mlx5e_flow_table vxlan; + struct mlx5_flow_rule *vxlan_catchall_ft_rule; struct mlx5e_flow_table main; + struct mlx5e_flow_table main_vxlan; + struct mlx5_flow_rule *main_vxlan_rule[MLX5E_NUM_TT]; struct mlx5e_flow_table inner_rss; }; @@ -1005,10 +1021,12 @@ struct mlx5e_priv { u32 tisn[MLX5E_MAX_TX_NUM_TC]; u32 rqtn; u32 tirn[MLX5E_NUM_TT]; + u32 tirn_inner_vxlan[MLX5E_NUM_TT]; struct mlx5e_flow_tables fts; struct mlx5e_eth_addr_db eth_addr; struct mlx5e_vlan_db vlan; + struct mlx5e_vxlan_db vxlan; struct mlx5e_params params; struct mlx5e_params_ethtool params_ethtool; @@ -1035,6 +1053,8 @@ struct mlx5e_priv { struct ifmedia media; int media_status_last; int media_active_last; + eventhandler_tag vxlan_start; + eventhandler_tag vxlan_stop; struct callout watchdog; @@ -1124,6 +1144,11 @@ void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv); int mlx5e_add_all_vlan_rules(struct mlx5e_priv *priv); void mlx5e_del_all_vlan_rules(struct mlx5e_priv *priv); +void mlx5e_vxlan_start(void *arg, struct ifnet *ifp, sa_family_t family, + u_int port); +void mlx5e_vxlan_stop(void *arg, struct ifnet *ifp, sa_family_t family, + u_int port); + static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq, u32 *wqe) { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index 20e81fe806a5..f4f9e494308e 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -450,6 +450,226 @@ add_eth_addr_rule_out: return (err); } +static void +mlx5e_del_main_vxlan_rules(struct mlx5e_priv *priv) +{ + struct mlx5_flow_rule **ra = priv->fts.main_vxlan_rule, **r; + + r = &ra[MLX5E_TT_IPV6_IPSEC_ESP]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV4_IPSEC_ESP]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV6_IPSEC_AH]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV4_IPSEC_AH]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV6_TCP]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV4_TCP]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV6_UDP]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV4_UDP]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV6]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV4]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_ANY]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } +} + +static int +mlx5e_add_main_vxlan_rules_sub(struct mlx5e_priv *priv, u32 *mc, u32 *mv) +{ + struct mlx5_flow_destination dest = {}; + u8 mc_enable = 0; + struct mlx5_flow_rule **rule_p; + struct mlx5_flow_table *ft = priv->fts.main_vxlan.t; + u32 *tirn = priv->tirn_inner_vxlan; + int err = 0; + + dest.type = MLX5_FLOW_DESTINATION_TYPE_TIR; + + mc_enable = MLX5_MATCH_INNER_HEADERS; + MLX5_SET_TO_ONES(fte_match_param, mc, inner_headers.ethertype); + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV4]; + dest.tir_num = tirn[MLX5E_TT_IPV4]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IP); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV6]; + dest.tir_num = tirn[MLX5E_TT_IPV6]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IPV6); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + MLX5_SET_TO_ONES(fte_match_param, mc, inner_headers.ip_protocol); + MLX5_SET(fte_match_param, mv, inner_headers.ip_protocol, IPPROTO_UDP); + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV4_UDP]; + dest.tir_num = tirn[MLX5E_TT_IPV4_UDP]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IP); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV6_UDP]; + dest.tir_num = tirn[MLX5E_TT_IPV6_UDP]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IPV6); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + MLX5_SET(fte_match_param, mv, inner_headers.ip_protocol, IPPROTO_TCP); + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV4_TCP]; + dest.tir_num = tirn[MLX5E_TT_IPV4_TCP]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IP); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV6_TCP]; + dest.tir_num = tirn[MLX5E_TT_IPV6_TCP]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IPV6); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + MLX5_SET(fte_match_param, mv, inner_headers.ip_protocol, IPPROTO_AH); + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV4_IPSEC_AH]; + dest.tir_num = tirn[MLX5E_TT_IPV4_IPSEC_AH]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IP); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV6_IPSEC_AH]; + dest.tir_num = tirn[MLX5E_TT_IPV6_IPSEC_AH]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IPV6); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + MLX5_SET(fte_match_param, mv, inner_headers.ip_protocol, IPPROTO_ESP); + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV4_IPSEC_ESP]; + dest.tir_num = tirn[MLX5E_TT_IPV4_IPSEC_ESP]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IP); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV6_IPSEC_ESP]; + dest.tir_num = tirn[MLX5E_TT_IPV6_IPSEC_ESP]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, + ETHERTYPE_IPV6); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + mc_enable = 0; + memset(mv, 0, MLX5_ST_SZ_BYTES(fte_match_param)); + memset(mc, 0, MLX5_ST_SZ_BYTES(fte_match_param)); + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_ANY]; + dest.tir_num = tirn[MLX5E_TT_ANY]; + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + return (0); + +err_del_ai: + err = PTR_ERR(*rule_p); + *rule_p = NULL; + mlx5e_del_main_vxlan_rules(priv); + + return (err); +} + +static int +mlx5e_add_main_vxlan_rules(struct mlx5e_priv *priv) +{ + u32 *match_criteria; + u32 *match_value; + int err = 0; + + match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + if (match_value == NULL || match_criteria == NULL) { + mlx5_en_err(priv->ifp, "alloc failed\n"); + err = -ENOMEM; + goto add_main_vxlan_rules_out; + } + err = mlx5e_add_main_vxlan_rules_sub(priv, match_criteria, match_value); + +add_main_vxlan_rules_out: + kvfree(match_criteria); + kvfree(match_value); + + return (err); +} + static int mlx5e_vport_context_update_vlans(struct mlx5e_priv *priv) { struct ifnet *ifp = priv->ifp; @@ -512,7 +732,7 @@ mlx5e_add_vlan_rule_sub(struct mlx5e_priv *priv, int err = 0; dest.type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; - dest.ft = priv->fts.main.t; + dest.ft = priv->fts.vxlan.t; mc_enable = MLX5_MATCH_OUTER_HEADERS; @@ -1267,14 +1487,87 @@ mlx5e_create_main_groups(struct mlx5e_flow_table *ft) return (err); } -static int mlx5e_create_main_flow_table(struct mlx5e_priv *priv) +#define MLX5E_MAIN_VXLAN_GROUP0_SIZE BIT(3) +#define MLX5E_MAIN_VXLAN_GROUP1_SIZE BIT(3) +#define MLX5E_MAIN_VXLAN_GROUP2_SIZE BIT(0) +static int +mlx5e_create_main_vxlan_groups_sub(struct mlx5e_flow_table *ft, u32 *in, + int inlen) +{ + u8 *mc = MLX5_ADDR_OF(create_flow_group_in, in, match_criteria); + int err; + int ix = 0; + + memset(in, 0, inlen); + MLX5_SET_CFG(in, match_criteria_enable, MLX5_MATCH_INNER_HEADERS); + MLX5_SET_TO_ONES(fte_match_param, mc, inner_headers.ethertype); + MLX5_SET_TO_ONES(fte_match_param, mc, inner_headers.ip_protocol); + MLX5_SET_CFG(in, start_flow_index, ix); + ix += MLX5E_MAIN_VXLAN_GROUP0_SIZE; + MLX5_SET_CFG(in, end_flow_index, ix - 1); + ft->g[ft->num_groups] = mlx5_create_flow_group(ft->t, in); + if (IS_ERR(ft->g[ft->num_groups])) + goto err_destory_groups; + ft->num_groups++; + + memset(in, 0, inlen); + MLX5_SET_CFG(in, match_criteria_enable, MLX5_MATCH_INNER_HEADERS); + MLX5_SET_TO_ONES(fte_match_param, mc, inner_headers.ethertype); + MLX5_SET_CFG(in, start_flow_index, ix); + ix += MLX5E_MAIN_VXLAN_GROUP1_SIZE; + MLX5_SET_CFG(in, end_flow_index, ix - 1); + ft->g[ft->num_groups] = mlx5_create_flow_group(ft->t, in); + if (IS_ERR(ft->g[ft->num_groups])) + goto err_destory_groups; + ft->num_groups++; + + memset(in, 0, inlen); + MLX5_SET_CFG(in, start_flow_index, ix); + ix += MLX5E_MAIN_VXLAN_GROUP2_SIZE; + MLX5_SET_CFG(in, end_flow_index, ix - 1); + ft->g[ft->num_groups] = mlx5_create_flow_group(ft->t, in); + if (IS_ERR(ft->g[ft->num_groups])) + goto err_destory_groups; + ft->num_groups++; + + return (0); + +err_destory_groups: + err = PTR_ERR(ft->g[ft->num_groups]); + ft->g[ft->num_groups] = NULL; + mlx5e_destroy_groups(ft); + + return (err); +} + +static int +mlx5e_create_main_vxlan_groups(struct mlx5e_flow_table *ft) +{ + u32 *in; + int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in); + int err; + + in = mlx5_vzalloc(inlen); + if (!in) + return (-ENOMEM); + + err = mlx5e_create_main_vxlan_groups_sub(ft, in, inlen); + + kvfree(in); + return (err); +} + + +static int +mlx5e_create_main_flow_table(struct mlx5e_priv *priv, bool inner_vxlan) { - struct mlx5e_flow_table *ft = &priv->fts.main; + struct mlx5e_flow_table *ft = inner_vxlan ? &priv->fts.main_vxlan : + &priv->fts.main; int err; ft->num_groups = 0; - ft->t = mlx5_create_flow_table(priv->fts.ns, 0, "main", - MLX5E_MAIN_TABLE_SIZE); + ft->t = mlx5_create_flow_table(priv->fts.ns, 0, + inner_vxlan ? "vxlan_main" : "main", MLX5E_MAIN_TABLE_SIZE); if (IS_ERR(ft->t)) { err = PTR_ERR(ft->t); @@ -1287,7 +1580,8 @@ static int mlx5e_create_main_flow_table(struct mlx5e_priv *priv) goto err_destroy_main_flow_table; } - err = mlx5e_create_main_groups(ft); + err = inner_vxlan ? mlx5e_create_main_vxlan_groups(ft) : + mlx5e_create_main_groups(ft); if (err) goto err_free_g; return (0); @@ -1307,6 +1601,11 @@ static void mlx5e_destroy_main_flow_table(struct mlx5e_priv *priv) mlx5e_destroy_flow_table(&priv->fts.main); } +static void mlx5e_destroy_main_vxlan_flow_table(struct mlx5e_priv *priv) +{ + mlx5e_destroy_flow_table(&priv->fts.main_vxlan); +} + #define MLX5E_NUM_VLAN_GROUPS 3 #define MLX5E_VLAN_GROUP0_SIZE BIT(12) #define MLX5E_VLAN_GROUP1_SIZE BIT(1) @@ -1428,6 +1727,333 @@ mlx5e_destroy_vlan_flow_table(struct mlx5e_priv *priv) mlx5e_destroy_flow_table(&priv->fts.vlan); } +static int +mlx5e_add_vxlan_rule_sub(struct mlx5e_priv *priv, u_int protocol, u_int port, + u32 *mc, u32 *mv, struct mlx5e_vxlan_db_el *el) +{ + struct mlx5_flow_table *ft = priv->fts.vxlan.t; + struct mlx5_flow_destination dest = {}; + u8 mc_enable; + struct mlx5_flow_rule **rule_p; + int err = 0; + + dest.type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; + dest.ft = priv->fts.main_vxlan.t; + + mc_enable = MLX5_MATCH_OUTER_HEADERS; + rule_p = &el->vxlan_ft_rule; + MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.ethertype); + MLX5_SET(fte_match_param, mv, outer_headers.ethertype, protocol); + MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.ip_protocol); + MLX5_SET(fte_match_param, mv, outer_headers.ip_protocol, IPPROTO_UDP); + MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.udp_dport); + MLX5_SET(fte_match_param, mv, outer_headers.udp_dport, port); + + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + + if (IS_ERR(*rule_p)) { + err = PTR_ERR(*rule_p); + *rule_p = NULL; + mlx5_en_err(priv->ifp, "add rule failed\n"); + } + + return (err); +} + +static struct mlx5e_vxlan_db_el * +mlx5e_vxlan_find_db_el(struct mlx5e_priv *priv, u_int proto, u_int port) +{ + struct mlx5e_vxlan_db_el *el; + + TAILQ_FOREACH(el, &priv->vxlan.head, link) { + if (el->proto == proto && el->port == port) + return (el); + } + return (NULL); +} + +static struct mlx5e_vxlan_db_el * +mlx5e_vxlan_alloc_db_el(struct mlx5e_priv *priv, u_int proto, u_int port) +{ + struct mlx5e_vxlan_db_el *el; + + el = mlx5_vzalloc(sizeof(*el)); + el->refcount = 1; + el->proto = proto; + el->port = port; + el->vxlan_ft_rule = NULL; + return (el); +} + +static int +mlx5e_vxlan_family_to_proto(sa_family_t family, u_int *proto) +{ + switch (family) { + case AF_INET: + *proto = ETHERTYPE_IP; + return (0); + case AF_INET6: + *proto = ETHERTYPE_IPV6; + return (0); + default: + return (-EINVAL); + } +} + +static int +mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) +{ + struct mlx5e_vxlan_db_el *el; + u32 *match_criteria; + u32 *match_value; + u_int proto; + int err; + + err = mlx5e_vxlan_family_to_proto(family, &proto); + if (err != 0) + return (err); + + el = mlx5e_vxlan_find_db_el(priv, proto, port); + if (el != NULL) { + el->refcount++; + return (0); + } + el = mlx5e_vxlan_alloc_db_el(priv, proto, port); + + match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + if (match_value == NULL || match_criteria == NULL) { + mlx5_en_err(priv->ifp, "alloc failed\n"); + err = -ENOMEM; + goto add_vxlan_rule_out; + } + + err = mlx5e_add_vxlan_rule_sub(priv, proto, port, match_criteria, + match_value, el); + if (err == 0) { + TAILQ_INSERT_TAIL(&priv->vxlan.head, el, link); + } else { + kvfree(el); + } + +add_vxlan_rule_out: + kvfree(match_criteria); + kvfree(match_value); + + return (err); +} + +static int +mlx5e_add_vxlan_catchall_rule_sub(struct mlx5e_priv *priv, u32 *mc, u32 *mv) +{ + struct mlx5_flow_table *ft = priv->fts.vxlan.t; + struct mlx5_flow_destination dest = {}; + u8 mc_enable = 0; + struct mlx5_flow_rule **rule_p; + int err = 0; + + dest.type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; + dest.ft = priv->fts.main.t; + + rule_p = &priv->fts.vxlan_catchall_ft_rule; + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + + if (IS_ERR(*rule_p)) { + err = PTR_ERR(*rule_p); + *rule_p = NULL; + mlx5_en_err(priv->ifp, "add rule failed\n"); + } + + return (err); +} + + +static int +mlx5e_add_vxlan_catchall_rule(struct mlx5e_priv *priv) +{ + u32 *match_criteria; + u32 *match_value; + int err; + + match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + if (match_value == NULL || match_criteria == NULL) { + mlx5_en_err(priv->ifp, "alloc failed\n"); + err = -ENOMEM; + goto add_vxlan_rule_out; + } + + err = mlx5e_add_vxlan_catchall_rule_sub(priv, match_criteria, + match_value); + +add_vxlan_rule_out: + kvfree(match_criteria); + kvfree(match_value); + + return (err); +} + +static int +mlx5e_del_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) +{ + struct mlx5e_vxlan_db_el *el; + u_int proto; + int err; + + err = mlx5e_vxlan_family_to_proto(family, &proto); + if (err != 0) + return (err); + + el = mlx5e_vxlan_find_db_el(priv, proto, port); + if (el == NULL) + return (0); + if (el->refcount > 1) { + el->refcount--; + return (0); + } + + mlx5_del_flow_rule(el->vxlan_ft_rule); + TAILQ_REMOVE(&priv->vxlan.head, el, link); + kvfree(el); + return (0); +} + +static void +mlx5e_del_vxlan_catchall_rule(struct mlx5e_priv *priv) +{ + mlx5_del_flow_rule(priv->fts.vxlan_catchall_ft_rule); +} + +void +mlx5e_vxlan_start(void *arg, struct ifnet *ifp __unused, sa_family_t family, + u_int port) +{ + struct mlx5e_priv *priv = arg; + int err; + + PRIV_LOCK(priv); + err = mlx5_vxlan_udp_port_add(priv->mdev, port); + if (err == 0 && test_bit(MLX5E_STATE_OPENED, &priv->state)) + mlx5e_add_vxlan_rule(priv, family, port); + PRIV_UNLOCK(priv); +} + +void +mlx5e_vxlan_stop(void *arg, struct ifnet *ifp __unused, sa_family_t family, + u_int port) +{ + struct mlx5e_priv *priv = arg; + + PRIV_LOCK(priv); + if (test_bit(MLX5E_STATE_OPENED, &priv->state)) + mlx5e_del_vxlan_rule(priv, family, port); + (void)mlx5_vxlan_udp_port_delete(priv->mdev, port); + PRIV_UNLOCK(priv); +} + +#define MLX5E_VXLAN_GROUP0_SIZE BIT(3) /* XXXKIB */ +#define MLX5E_VXLAN_GROUP1_SIZE BIT(0) +#define MLX5E_NUM_VXLAN_GROUPS BIT(1) +#define MLX5E_VXLAN_TABLE_SIZE \ + (MLX5E_VXLAN_GROUP0_SIZE + MLX5E_VXLAN_GROUP1_SIZE) + +static int +mlx5e_create_vxlan_groups_sub(struct mlx5e_flow_table *ft, u32 *in, + int inlen) +{ + int err; + int ix = 0; + u8 *mc = MLX5_ADDR_OF(create_flow_group_in, in, match_criteria); + + memset(in, 0, inlen); + MLX5_SET_CFG(in, match_criteria_enable, MLX5_MATCH_OUTER_HEADERS); + MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.ethertype); + MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.ip_protocol); + MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.udp_dport); + MLX5_SET_CFG(in, start_flow_index, ix); + ix += MLX5E_VXLAN_GROUP0_SIZE; + MLX5_SET_CFG(in, end_flow_index, ix - 1); + ft->g[ft->num_groups] = mlx5_create_flow_group(ft->t, in); + if (IS_ERR(ft->g[ft->num_groups])) + goto err_destory_groups; + ft->num_groups++; + + memset(in, 0, inlen); + MLX5_SET_CFG(in, start_flow_index, ix); + ix += MLX5E_VXLAN_GROUP1_SIZE; + MLX5_SET_CFG(in, end_flow_index, ix - 1); + ft->g[ft->num_groups] = mlx5_create_flow_group(ft->t, in); + if (IS_ERR(ft->g[ft->num_groups])) + goto err_destory_groups; + ft->num_groups++; + + return (0); + +err_destory_groups: + err = PTR_ERR(ft->g[ft->num_groups]); + ft->g[ft->num_groups] = NULL; + mlx5e_destroy_groups(ft); + + return (err); +} + +static int +mlx5e_create_vxlan_groups(struct mlx5e_flow_table *ft) +{ + u32 *in; + int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in); + int err; + + in = mlx5_vzalloc(inlen); + if (!in) + return (-ENOMEM); + + err = mlx5e_create_vxlan_groups_sub(ft, in, inlen); + + kvfree(in); + return (err); +} + +static int +mlx5e_create_vxlan_flow_table(struct mlx5e_priv *priv) +{ + struct mlx5e_flow_table *ft = &priv->fts.vxlan; + int err; + + ft->num_groups = 0; + ft->t = mlx5_create_flow_table(priv->fts.ns, 0, "vxlan", + MLX5E_VXLAN_TABLE_SIZE); + + if (IS_ERR(ft->t)) { + err = PTR_ERR(ft->t); + ft->t = NULL; + return (err); + } + ft->g = kcalloc(MLX5E_NUM_VXLAN_GROUPS, sizeof(*ft->g), GFP_KERNEL); + if (!ft->g) { + err = -ENOMEM; + goto err_destroy_vxlan_flow_table; + } + + err = mlx5e_create_vxlan_groups(ft); + if (err) + goto err_free_g; + + TAILQ_INIT(&priv->vxlan.head); + return (0); + +err_free_g: + kfree(ft->g); + +err_destroy_vxlan_flow_table: + mlx5_destroy_flow_table(ft->t); + ft->t = NULL; + + return (err); +} + #define MLX5E_NUM_INNER_RSS_GROUPS 3 #define MLX5E_INNER_RSS_GROUP0_SIZE BIT(3) #define MLX5E_INNER_RSS_GROUP1_SIZE BIT(1) @@ -1547,6 +2173,12 @@ static void mlx5e_destroy_inner_rss_flow_table(struct mlx5e_priv *priv) mlx5e_destroy_flow_table(&priv->fts.inner_rss); } +static void +mlx5e_destroy_vxlan_flow_table(struct mlx5e_priv *priv) +{ + mlx5e_destroy_flow_table(&priv->fts.vxlan); +} + int mlx5e_open_flow_table(struct mlx5e_priv *priv) { @@ -1559,18 +2191,40 @@ mlx5e_open_flow_table(struct mlx5e_priv *priv) if (err) return (err); - err = mlx5e_create_main_flow_table(priv); + err = mlx5e_create_vxlan_flow_table(priv); if (err) goto err_destroy_vlan_flow_table; - err = mlx5e_create_inner_rss_flow_table(priv); + err = mlx5e_create_main_flow_table(priv, false); + if (err) + goto err_destroy_vxlan_flow_table; + + err = mlx5e_create_main_flow_table(priv, true); if (err) goto err_destroy_main_flow_table; + err = mlx5e_create_inner_rss_flow_table(priv); + if (err) + goto err_destroy_main_vxlan_flow_table; + + err = mlx5e_add_vxlan_catchall_rule(priv); + if (err != 0) + goto err_destroy_inner_rss_flow_table; + + err = mlx5e_add_main_vxlan_rules(priv); + if (err != 0) + goto err_destroy_inner_rss_flow_table; + return (0); +err_destroy_inner_rss_flow_table: + mlx5e_destroy_inner_rss_flow_table(priv); +err_destroy_main_vxlan_flow_table: + mlx5e_destroy_main_vxlan_flow_table(priv); err_destroy_main_flow_table: mlx5e_destroy_main_flow_table(priv); +err_destroy_vxlan_flow_table: + mlx5e_destroy_vxlan_flow_table(priv); err_destroy_vlan_flow_table: mlx5e_destroy_vlan_flow_table(priv); @@ -1583,6 +2237,10 @@ mlx5e_close_flow_table(struct mlx5e_priv *priv) mlx5e_handle_ifp_addr(priv); mlx5e_destroy_inner_rss_flow_table(priv); + mlx5e_del_vxlan_catchall_rule(priv); + mlx5e_destroy_vxlan_flow_table(priv); + mlx5e_del_main_vxlan_rules(priv); mlx5e_destroy_main_flow_table(priv); + mlx5e_destroy_main_vxlan_flow_table(priv); mlx5e_destroy_vlan_flow_table(priv); } diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 296252875888..1adf83cf57f9 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -4558,6 +4558,12 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) priv->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig, mlx5e_vlan_rx_kill_vid, priv, EVENTHANDLER_PRI_FIRST); + /* Register for VxLAN events */ + priv->vxlan_start = EVENTHANDLER_REGISTER(vxlan_start, + mlx5e_vxlan_start, priv, EVENTHANDLER_PRI_ANY); + priv->vxlan_stop = EVENTHANDLER_REGISTER(vxlan_stop, + mlx5e_vxlan_stop, priv, EVENTHANDLER_PRI_ANY); + /* Link is down by default */ if_link_state_change(ifp, LINK_STATE_DOWN); @@ -4660,6 +4666,10 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vpriv) EVENTHANDLER_DEREGISTER(vlan_config, priv->vlan_attach); if (priv->vlan_detach != NULL) EVENTHANDLER_DEREGISTER(vlan_unconfig, priv->vlan_detach); + if (priv->vxlan_start != NULL) + EVENTHANDLER_DEREGISTER(vxlan_start, priv->vxlan_start); + if (priv->vxlan_stop != NULL) + EVENTHANDLER_DEREGISTER(vxlan_stop, priv->vxlan_stop); /* make sure device gets closed */ PRIV_LOCK(priv); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4CA0165CC6A; Mon, 12 Jul 2021 12:00: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 4GNj5H0bdrz3GSw; Mon, 12 Jul 2021 12:00: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 E6FE065E2; Mon, 12 Jul 2021 12:00: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 16CC0YWW008440; Mon, 12 Jul 2021 12:00:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0Y6W008439; Mon, 12 Jul 2021 12:00:34 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:34 GMT Message-Id: <202107121200.16CC0Y6W008439@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: fba6942f19f9 - main - mlx5en: build TIRs to handle inner RSS 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: fba6942f19f9cd6455f34658c8fff2ada1ee9691 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:35 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fba6942f19f9cd6455f34658c8fff2ada1ee9691 commit fba6942f19f9cd6455f34658c8fff2ada1ee9691 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:43:23 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:38 +0000 mlx5en: build TIRs to handle inner RSS Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 106 +++++++++++++++++++++--------------- 1 file changed, 62 insertions(+), 44 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 92a7fc97279f..b5de6b3903fd 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -2774,9 +2774,11 @@ mlx5e_get_rss_key(void *key_ptr) } static void -mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) +mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt, bool inner_vxlan) { void *hfso = MLX5_ADDR_OF(tirc, tirc, rx_hash_field_selector_outer); + void *hfsi = MLX5_ADDR_OF(tirc, tirc, rx_hash_field_selector_inner); + void *hfs = inner_vxlan ? hfsi : hfso; __be32 *hkey; MLX5_SET(tirc, tirc, transport_domain, priv->tdn); @@ -2808,6 +2810,11 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) lro_timer_supported_periods[2])); } + if (inner_vxlan && + (priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + MLX5_SET(tirc, tirc, tunneled_offload_en, 1); + } + /* setup parameters for hashing TIR type, if any */ switch (tt) { case MLX5E_TT_ANY: @@ -2842,104 +2849,104 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) switch (tt) { case MLX5E_TT_IPV4_TCP: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV4); - MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l4_prot_type, MLX5_L4_PROT_TYPE_TCP); #ifdef RSS if (!(rss_gethashconfig() & RSS_HASHTYPE_RSS_TCP_IPV4)) { - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP); } else #endif - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_ALL); break; case MLX5E_TT_IPV6_TCP: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV6); - MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l4_prot_type, MLX5_L4_PROT_TYPE_TCP); #ifdef RSS if (!(rss_gethashconfig() & RSS_HASHTYPE_RSS_TCP_IPV6)) { - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP); } else #endif - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_ALL); break; case MLX5E_TT_IPV4_UDP: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV4); - MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l4_prot_type, MLX5_L4_PROT_TYPE_UDP); #ifdef RSS if (!(rss_gethashconfig() & RSS_HASHTYPE_RSS_UDP_IPV4)) { - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP); } else #endif - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_ALL); break; case MLX5E_TT_IPV6_UDP: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV6); - MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l4_prot_type, MLX5_L4_PROT_TYPE_UDP); #ifdef RSS if (!(rss_gethashconfig() & RSS_HASHTYPE_RSS_UDP_IPV6)) { - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP); } else #endif - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_ALL); break; case MLX5E_TT_IPV4_IPSEC_AH: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV4); - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP_IPSEC_SPI); break; case MLX5E_TT_IPV6_IPSEC_AH: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV6); - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP_IPSEC_SPI); break; case MLX5E_TT_IPV4_IPSEC_ESP: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV4); - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP_IPSEC_SPI); break; case MLX5E_TT_IPV6_IPSEC_ESP: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV6); - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP_IPSEC_SPI); break; case MLX5E_TT_IPV4: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV4); - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP); break; case MLX5E_TT_IPV6: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV6); - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP); break; @@ -2949,7 +2956,7 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) } static int -mlx5e_open_tir(struct mlx5e_priv *priv, int tt) +mlx5e_open_tir(struct mlx5e_priv *priv, int tt, bool inner_vxlan) { struct mlx5_core_dev *mdev = priv->mdev; u32 *in; @@ -2963,9 +2970,10 @@ mlx5e_open_tir(struct mlx5e_priv *priv, int tt) return (-ENOMEM); tirc = MLX5_ADDR_OF(create_tir_in, in, tir_context); - mlx5e_build_tir_ctx(priv, tirc, tt); + mlx5e_build_tir_ctx(priv, tirc, tt, inner_vxlan); - err = mlx5_core_create_tir(mdev, in, inlen, &priv->tirn[tt]); + err = mlx5_core_create_tir(mdev, in, inlen, inner_vxlan ? + &priv->tirn_inner_vxlan[tt] : &priv->tirn[tt]); kvfree(in); @@ -2973,19 +2981,20 @@ mlx5e_open_tir(struct mlx5e_priv *priv, int tt) } static void -mlx5e_close_tir(struct mlx5e_priv *priv, int tt) +mlx5e_close_tir(struct mlx5e_priv *priv, int tt, bool inner_vxlan) { - mlx5_core_destroy_tir(priv->mdev, priv->tirn[tt]); + mlx5_core_destroy_tir(priv->mdev, inner_vxlan ? + priv->tirn_inner_vxlan[tt] : priv->tirn[tt]); } static int -mlx5e_open_tirs(struct mlx5e_priv *priv) +mlx5e_open_tirs(struct mlx5e_priv *priv, bool inner_vxlan) { int err; int i; for (i = 0; i < MLX5E_NUM_TT; i++) { - err = mlx5e_open_tir(priv, i); + err = mlx5e_open_tir(priv, i, inner_vxlan); if (err) goto err_close_tirs; } @@ -2994,18 +3003,18 @@ mlx5e_open_tirs(struct mlx5e_priv *priv) err_close_tirs: for (i--; i >= 0; i--) - mlx5e_close_tir(priv, i); + mlx5e_close_tir(priv, i, inner_vxlan); return (err); } static void -mlx5e_close_tirs(struct mlx5e_priv *priv) +mlx5e_close_tirs(struct mlx5e_priv *priv, bool inner_vxlan) { int i; for (i = 0; i < MLX5E_NUM_TT; i++) - mlx5e_close_tir(priv, i); + mlx5e_close_tir(priv, i, inner_vxlan); } /* @@ -3113,16 +3122,21 @@ mlx5e_open_locked(struct ifnet *ifp) mlx5_en_err(ifp, "mlx5e_open_rqt failed, %d\n", err); goto err_close_channels; } - err = mlx5e_open_tirs(priv); + err = mlx5e_open_tirs(priv, false); if (err) { - mlx5_en_err(ifp, "mlx5e_open_tir failed, %d\n", err); + mlx5_en_err(ifp, "mlx5e_open_tir(main) failed, %d\n", err); goto err_close_rqls; } + err = mlx5e_open_tirs(priv, true); + if (err) { + mlx5_en_err(ifp, "mlx5e_open_tir(inner) failed, %d\n", err); + goto err_close_tirs; + } err = mlx5e_open_flow_table(priv); if (err) { mlx5_en_err(ifp, "mlx5e_open_flow_table failed, %d\n", err); - goto err_close_tirs; + goto err_close_tirs_inner; } err = mlx5e_add_all_vlan_rules(priv); if (err) { @@ -3140,8 +3154,11 @@ mlx5e_open_locked(struct ifnet *ifp) err_close_flow_table: mlx5e_close_flow_table(priv); +err_close_tirs_inner: + mlx5e_close_tirs(priv, true); + err_close_tirs: - mlx5e_close_tirs(priv); + mlx5e_close_tirs(priv, false); err_close_rqls: mlx5e_close_rqt(priv); @@ -3189,7 +3206,8 @@ mlx5e_close_locked(struct ifnet *ifp) mlx5e_del_all_vlan_rules(priv); if_link_state_change(priv->ifp, LINK_STATE_DOWN); mlx5e_close_flow_table(priv); - mlx5e_close_tirs(priv); + mlx5e_close_tirs(priv, true); + mlx5e_close_tirs(priv, false); mlx5e_close_rqt(priv); mlx5e_close_channels(priv); mlx5_vport_dealloc_q_counter(priv->mdev, From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 468C465CE48; Mon, 12 Jul 2021 12:00: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 4GNj5G03Jqz3GX0; Mon, 12 Jul 2021 12:00: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 C11C86709; Mon, 12 Jul 2021 12:00: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 16CC0XYl008416; Mon, 12 Jul 2021 12:00:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0XUn008415; Mon, 12 Jul 2021 12:00:33 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:33 GMT Message-Id: <202107121200.16CC0XUn008415@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: 5e12b3bb43bc - main - mlx5en: allow software parser for created send queues 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: 5e12b3bb43bcc4aacc859242d7a653e64d6b339a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:34 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5e12b3bb43bcc4aacc859242d7a653e64d6b339a commit 5e12b3bb43bcc4aacc859242d7a653e64d6b339a Author: Konstantin Belousov AuthorDate: 2021-04-06 03:42:12 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:37 +0000 mlx5en: allow software parser for created send queues Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 1adf83cf57f9..92a7fc97279f 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1733,6 +1733,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, MLX5_SET(sqc, sqc, state, MLX5_SQC_STATE_RST); MLX5_SET(sqc, sqc, tis_lst_sz, 1); MLX5_SET(sqc, sqc, flush_in_error_en, 1); + MLX5_SET(sqc, sqc, allow_swp, 1); MLX5_SET(wq, wq, wq_type, MLX5_WQ_TYPE_CYCLIC); MLX5_SET(wq, wq, uar_page, sq->priv->bfreg.index); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7DB8665CDE4; Mon, 12 Jul 2021 12:00: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 4GNj5J1n5sz3GbZ; Mon, 12 Jul 2021 12:00: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 196366790; Mon, 12 Jul 2021 12:00: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 16CC0Zjl008464; Mon, 12 Jul 2021 12:00:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0Zn0008463; Mon, 12 Jul 2021 12:00:35 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:35 GMT Message-Id: <202107121200.16CC0Zn0008463@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: 149349e01ecd - main - mlx5en: handle offloaded Rx checksums calculated for tunneled packets 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: 149349e01ecd3a4655f7cbebe54973f6f0b0b371 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:36 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=149349e01ecd3a4655f7cbebe54973f6f0b0b371 commit 149349e01ecd3a4655f7cbebe54973f6f0b0b371 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:44:13 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:38 +0000 mlx5en: handle offloaded Rx checksums calculated for tunneled packets Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/dev/mlx5/mlx5_en/mlx5_en_rx.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c index 2bf189efc7e0..7cfd15b6aa5e 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c @@ -306,6 +306,10 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe, } #else M_HASHTYPE_SET(mb, M_HASHTYPE_OPAQUE_HASH); +#endif +#ifdef M_HASHTYPE_SETINNER + if (cqe_is_tunneled(cqe)) + M_HASHTYPE_SETINNER(mb); #endif } else { mb->m_pkthdr.flowid = rq->ix; @@ -313,7 +317,27 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe, } mb->m_pkthdr.rcvif = ifp; - if (likely(ifp->if_capenable & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) && + if (cqe_is_tunneled(cqe)) { + /* + * CQE can be tunneled only if TIR is configured to + * enable parsing of tunneled payload, so no need to + * check for capabilities. + */ + if (((cqe->hds_ip_ext & (CQE_L2_OK | CQE_L3_OK)) == + (CQE_L2_OK | CQE_L3_OK))) { + mb->m_pkthdr.csum_flags |= + CSUM_INNER_L3_CALC | CSUM_INNER_L3_VALID | + CSUM_IP_CHECKED | CSUM_IP_VALID | + CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + mb->m_pkthdr.csum_data = htons(0xffff); + } + if (((cqe->hds_ip_ext & (CQE_L2_OK | CQE_L3_OK | CQE_L4_OK)) == + (CQE_L2_OK | CQE_L3_OK | CQE_L4_OK))) { + mb->m_pkthdr.csum_flags |= + CSUM_INNER_L4_CALC | CSUM_INNER_L4_VALID; + } + } else if (likely((ifp->if_capenable & (IFCAP_RXCSUM | + IFCAP_RXCSUM_IPV6)) != 0) && ((cqe->hds_ip_ext & (CQE_L2_OK | CQE_L3_OK | CQE_L4_OK)) == (CQE_L2_OK | CQE_L3_OK | CQE_L4_OK))) { mb->m_pkthdr.csum_flags = From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E525665C9C9; Mon, 12 Jul 2021 12:00: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 4GNj5K5CL8z3GNf; Mon, 12 Jul 2021 12:00: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 353EB5CFE; Mon, 12 Jul 2021 12:00: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 16CC0b8d008488; Mon, 12 Jul 2021 12:00:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0b6f008487; Mon, 12 Jul 2021 12:00:37 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:37 GMT Message-Id: <202107121200.16CC0b6f008487@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: 7c9febf9f11b - main - mlx5en: handle checksum and TSO offloading for VxLAN packets on TX 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: 7c9febf9f11bec467ef79c6ff19d695ace7edb6b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:39 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7c9febf9f11bec467ef79c6ff19d695ace7edb6b commit 7c9febf9f11bec467ef79c6ff19d695ace7edb6b Author: Konstantin Belousov AuthorDate: 2021-04-06 03:45:20 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:38 +0000 mlx5en: handle checksum and TSO offloading for VxLAN packets on TX Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 289 +++++++++++++++++++++++++++++++++++++- 1 file changed, 287 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index 1ba47e44ae96..6bc0a91ca8ef 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -332,6 +332,221 @@ failure: return (0); } +/* + * Locate a pointer inside a mbuf chain. Returns NULL upon failure. + */ +static inline void * +mlx5e_parse_mbuf_chain(const struct mbuf **mb, int *poffset, int eth_hdr_len, + int min_len) +{ + if (unlikely(mb[0]->m_len == eth_hdr_len)) { + poffset[0] = eth_hdr_len; + if (unlikely((mb[0] = mb[0]->m_next) == NULL)) + return (NULL); + } + if (unlikely(mb[0]->m_len < eth_hdr_len - poffset[0] + min_len)) + return (NULL); + return (mb[0]->m_data + eth_hdr_len - poffset[0]); +} + +/* + * This function parse IPv4 and IPv6 packets looking for UDP, VXLAN + * and TCP headers. + * + * The return value indicates the number of bytes from the beginning + * of the packet until the first byte after the TCP header. If this + * function returns zero, the parsing failed. + */ +static int +mlx5e_get_vxlan_header_size(const struct mbuf *mb, struct mlx5e_tx_wqe *wqe, + uint8_t cs_mask, uint8_t opcode) +{ + const struct ether_vlan_header *eh; + struct ip *ip4; + struct ip6_hdr *ip6; + struct tcphdr *th; + struct udphdr *udp; + bool has_outer_vlan_tag; + uint16_t eth_type; + uint8_t ip_type; + int pkt_hdr_len; + int eth_hdr_len; + int tcp_hlen; + int ip_hlen; + int offset; + + pkt_hdr_len = mb->m_pkthdr.len; + has_outer_vlan_tag = (mb->m_flags & M_VLANTAG) != 0; + offset = 0; + + eh = mtod(mb, const struct ether_vlan_header *); + if (unlikely(mb->m_len < ETHER_HDR_LEN)) + return (0); + + if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { + if (unlikely(mb->m_len < ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN)) + return (0); + eth_type = eh->evl_proto; + eth_hdr_len = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; + } else { + eth_type = eh->evl_encap_proto; + eth_hdr_len = ETHER_HDR_LEN; + } + + switch (eth_type) { + case htons(ETHERTYPE_IP): + ip4 = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*ip4)); + if (unlikely(ip4 == NULL)) + return (0); + ip_type = ip4->ip_p; + if (unlikely(ip_type != IPPROTO_UDP)) + return (0); + wqe->eth.swp_outer_l3_offset = eth_hdr_len / 2; + wqe->eth.cs_flags = MLX5_ETH_WQE_L3_CSUM | MLX5_ETH_WQE_L4_CSUM; + ip_hlen = ip4->ip_hl << 2; + eth_hdr_len += ip_hlen; + udp = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*udp)); + if (unlikely(udp == NULL)) + return (0); + wqe->eth.swp_outer_l4_offset = eth_hdr_len / 2; + wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_OUTER_L4_TYPE; + eth_hdr_len += sizeof(*udp); + break; + case htons(ETHERTYPE_IPV6): + ip6 = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*ip6)); + if (unlikely(ip6 == NULL)) + return (0); + ip_type = ip6->ip6_nxt; + if (unlikely(ip_type != IPPROTO_UDP)) + return (0); + wqe->eth.swp_outer_l3_offset = eth_hdr_len / 2; + wqe->eth.cs_flags = MLX5_ETH_WQE_L3_CSUM | MLX5_ETH_WQE_L4_CSUM; + eth_hdr_len += sizeof(*ip6); + udp = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*udp)); + if (unlikely(udp == NULL)) + return (0); + wqe->eth.swp_outer_l4_offset = eth_hdr_len / 2; + wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_OUTER_L4_TYPE | + MLX5_ETH_WQE_SWP_OUTER_L3_TYPE; + eth_hdr_len += sizeof(*udp); + break; + default: + return (0); + } + + /* + * If the hardware is not computing inner IP checksum, then + * skip inlining the inner outer UDP and VXLAN header: + */ + if (unlikely((cs_mask & MLX5_ETH_WQE_L3_INNER_CSUM) == 0)) + goto done; + if (unlikely(mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + 8) == NULL)) + return (0); + eth_hdr_len += 8; + + /* Check for ethernet header again. */ + eh = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, ETHER_HDR_LEN); + if (unlikely(eh == NULL)) + return (0); + if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { + if (unlikely(mb->m_len < eth_hdr_len - offset + ETHER_HDR_LEN + + ETHER_VLAN_ENCAP_LEN)) + return (0); + eth_type = eh->evl_proto; + eth_hdr_len += ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; + } else { + eth_type = eh->evl_encap_proto; + eth_hdr_len += ETHER_HDR_LEN; + } + + /* Check for IP header again. */ + switch (eth_type) { + case htons(ETHERTYPE_IP): + ip4 = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*ip4)); + if (unlikely(ip4 == NULL)) + return (0); + wqe->eth.swp_inner_l3_offset = eth_hdr_len / 2; + wqe->eth.cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM; + ip_type = ip4->ip_p; + ip_hlen = ip4->ip_hl << 2; + eth_hdr_len += ip_hlen; + break; + case htons(ETHERTYPE_IPV6): + ip6 = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*ip6)); + if (unlikely(ip6 == NULL)) + return (0); + wqe->eth.swp_inner_l3_offset = eth_hdr_len / 2; + wqe->eth.cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM; + wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_INNER_L3_TYPE; + ip_type = ip6->ip6_nxt; + eth_hdr_len += sizeof(*ip6); + break; + default: + return (0); + } + + /* + * If the hardware is not computing inner UDP/TCP checksum, + * then skip inlining the inner UDP/TCP header: + */ + if (unlikely((cs_mask & MLX5_ETH_WQE_L4_INNER_CSUM) == 0)) + goto done; + + switch (ip_type) { + case IPPROTO_UDP: + udp = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*udp)); + if (unlikely(udp == NULL)) + return (0); + wqe->eth.swp_inner_l4_offset = (eth_hdr_len / 2); + wqe->eth.cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM; + wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_INNER_L4_TYPE; + eth_hdr_len += sizeof(*udp); + break; + case IPPROTO_TCP: + th = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*th)); + if (unlikely(th == NULL)) + return (0); + wqe->eth.swp_inner_l4_offset = eth_hdr_len / 2; + wqe->eth.cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM; + wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_INNER_L4_TYPE; + tcp_hlen = th->th_off << 2; + eth_hdr_len += tcp_hlen; + break; + default: + return (0); + } +done: + if (unlikely(pkt_hdr_len < eth_hdr_len)) + return (0); + + /* Account for software inserted VLAN tag, if any. */ + if (unlikely(has_outer_vlan_tag)) { + wqe->eth.swp_outer_l3_offset += ETHER_VLAN_ENCAP_LEN / 2; + wqe->eth.swp_outer_l4_offset += ETHER_VLAN_ENCAP_LEN / 2; + wqe->eth.swp_inner_l3_offset += ETHER_VLAN_ENCAP_LEN / 2; + wqe->eth.swp_inner_l4_offset += ETHER_VLAN_ENCAP_LEN / 2; + } + + /* + * When inner checksums are set, outer L4 checksum flag must + * be disabled. + */ + if (wqe->eth.cs_flags & (MLX5_ETH_WQE_L3_INNER_CSUM | + MLX5_ETH_WQE_L4_INNER_CSUM)) + wqe->eth.cs_flags &= ~MLX5_ETH_WQE_L4_CSUM; + + return (eth_hdr_len); +} + struct mlx5_wqe_dump_seg { struct mlx5_wqe_ctrl_seg ctrl; struct mlx5_wqe_data_seg data; @@ -574,8 +789,77 @@ top: num_pkts = DIV_ROUND_UP(payload_len, mss); sq->mbuf[pi].num_bytes = payload_len + (num_pkts * args.ihs); + sq->stats.tso_packets++; sq->stats.tso_bytes += payload_len; + } else if (mb->m_pkthdr.csum_flags & CSUM_ENCAP_VXLAN) { + /* check for inner TCP TSO first */ + if (mb->m_pkthdr.csum_flags & (CSUM_INNER_IP_TSO | + CSUM_INNER_IP6_TSO)) { + u32 payload_len; + u32 mss = mb->m_pkthdr.tso_segsz; + u32 num_pkts; + + wqe->eth.mss = cpu_to_be16(mss); + opcode = MLX5_OPCODE_LSO; + + if (likely(args.ihs == 0)) { + args.ihs = mlx5e_get_vxlan_header_size(mb, wqe, + MLX5_ETH_WQE_L3_INNER_CSUM | + MLX5_ETH_WQE_L4_INNER_CSUM | + MLX5_ETH_WQE_L4_CSUM | + MLX5_ETH_WQE_L3_CSUM, + opcode); + if (unlikely(args.ihs == 0)) { + err = EINVAL; + goto tx_drop; + } + } + + payload_len = mb->m_pkthdr.len - args.ihs; + if (payload_len == 0) + num_pkts = 1; + else + num_pkts = DIV_ROUND_UP(payload_len, mss); + sq->mbuf[pi].num_bytes = payload_len + + num_pkts * args.ihs; + + sq->stats.tso_packets++; + sq->stats.tso_bytes += payload_len; + } else { + opcode = MLX5_OPCODE_SEND; + + if (likely(args.ihs == 0)) { + uint8_t cs_mask; + + if (mb->m_pkthdr.csum_flags & + (CSUM_INNER_IP_TCP | CSUM_INNER_IP_UDP)) { + cs_mask = + MLX5_ETH_WQE_L3_INNER_CSUM | + MLX5_ETH_WQE_L4_INNER_CSUM | + MLX5_ETH_WQE_L4_CSUM | + MLX5_ETH_WQE_L3_CSUM; + } else if (mb->m_pkthdr.csum_flags & CSUM_INNER_IP) { + cs_mask = + MLX5_ETH_WQE_L3_INNER_CSUM | + MLX5_ETH_WQE_L4_CSUM | + MLX5_ETH_WQE_L3_CSUM; + } else { + cs_mask = + MLX5_ETH_WQE_L4_CSUM | + MLX5_ETH_WQE_L3_CSUM; + } + args.ihs = mlx5e_get_vxlan_header_size(mb, wqe, + cs_mask, opcode); + if (unlikely(args.ihs == 0)) { + err = EINVAL; + goto tx_drop; + } + } + + sq->mbuf[pi].num_bytes = max_t (unsigned int, + mb->m_pkthdr.len, ETHER_MIN_LEN - ETHER_CRC_LEN); + } } else { opcode = MLX5_OPCODE_SEND; @@ -622,7 +906,7 @@ top: /* Range checks */ if (unlikely(args.ihs > (sq->max_inline - ETHER_VLAN_ENCAP_LEN))) { - if (mb->m_pkthdr.csum_flags & CSUM_TSO) { + if (mb->m_pkthdr.csum_flags & (CSUM_TSO | CSUM_ENCAP_VXLAN)) { err = EINVAL; goto tx_drop; } @@ -646,7 +930,8 @@ top: } else { /* check if inline header size is too big */ if (unlikely(args.ihs > sq->max_inline)) { - if (unlikely(mb->m_pkthdr.csum_flags & CSUM_TSO)) { + if (unlikely(mb->m_pkthdr.csum_flags & (CSUM_TSO | + CSUM_ENCAP_VXLAN))) { err = EINVAL; goto tx_drop; } From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9783665CF02; Mon, 12 Jul 2021 12:00: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 4GNj5L6c6Pz3GNj; Mon, 12 Jul 2021 12:00: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 5C09A64BA; Mon, 12 Jul 2021 12:00: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 16CC0crw008512; Mon, 12 Jul 2021 12:00:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0c01008511; Mon, 12 Jul 2021 12:00:38 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:38 GMT Message-Id: <202107121200.16CC0c01008511@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: bf202a8d7afb - main - mlx5en: announce mce(4) capabilities for stateless VxLAN offloading 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: bf202a8d7afb2e024d3d29d4d90e24b3925e9f06 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:39 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bf202a8d7afb2e024d3d29d4d90e24b3925e9f06 commit bf202a8d7afb2e024d3d29d4d90e24b3925e9f06 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:46:12 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:38 +0000 mlx5en: announce mce(4) capabilities for stateless VxLAN offloading Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index b5de6b3903fd..26bd5e00d22d 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -3446,6 +3446,21 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data) ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; if (mask & IFCAP_WOL_MAGIC) ifp->if_capenable ^= IFCAP_WOL_MAGIC; + if (mask & IFCAP_VXLAN_HWCSUM) { + ifp->if_capenable ^= IFCAP_VXLAN_HWCSUM; + ifp->if_hwassist ^= CSUM_INNER_IP | CSUM_INNER_IP_UDP | + CSUM_INNER_IP_TCP | CSUM_INNER_IP6_UDP | + CSUM_INNER_IP6_TCP; + if (test_bit(MLX5E_STATE_OPENED, &priv->state)) { + mlx5e_close_locked(ifp); + mlx5e_open_locked(ifp); + } + } + if (mask & IFCAP_VXLAN_HWTSO) { + ifp->if_capenable ^= IFCAP_VXLAN_HWTSO; + ifp->if_hwassist ^= CSUM_INNER_IP_TSO | + CSUM_INNER_IP6_TSO; + } VLAN_CAPABILITIES(ifp); /* turn off LRO means also turn of HW LRO - if it's on */ @@ -4421,6 +4436,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) #ifdef RATELIMIT ifp->if_capabilities |= IFCAP_TXRTLMT | IFCAP_TXTLS_RTLMT; #endif + ifp->if_capabilities |= IFCAP_VXLAN_HWCSUM | IFCAP_VXLAN_HWTSO; ifp->if_snd_tag_alloc = mlx5e_snd_tag_alloc; ifp->if_snd_tag_free = mlx5e_snd_tag_free; ifp->if_snd_tag_modify = mlx5e_snd_tag_modify; @@ -4441,6 +4457,12 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP | CSUM_IP); if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) ifp->if_hwassist |= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6); + if (ifp->if_capabilities & IFCAP_VXLAN_HWCSUM) + ifp->if_hwassist |= CSUM_INNER_IP6_UDP | CSUM_INNER_IP6_TCP | + CSUM_INNER_IP | CSUM_INNER_IP_UDP | CSUM_INNER_IP_TCP | + CSUM_ENCAP_VXLAN; + if (ifp->if_capabilities & IFCAP_VXLAN_HWTSO) + ifp->if_hwassist |= CSUM_INNER_IP6_TSO | CSUM_INNER_IP_TSO; /* ifnet sysctl tree */ sysctl_ctx_init(&priv->sysctl_ctx); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5923865CDF8; Mon, 12 Jul 2021 12:00: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 4GNj5M6s1vz3Gbr; Mon, 12 Jul 2021 12:00: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 71CA45CFF; Mon, 12 Jul 2021 12:00: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 16CC0d1l008542; Mon, 12 Jul 2021 12:00:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0dSZ008541; Mon, 12 Jul 2021 12:00:39 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:39 GMT Message-Id: <202107121200.16CC0dSZ008541@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: 859e41e90165 - main - mlx5: fix typo, KENREL_MIN_LEVEL->KERNEL_MIN_LEVEL 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: 859e41e90165b00b99addf4c498b8ec031ba9df9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:40 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=859e41e90165b00b99addf4c498b8ec031ba9df9 commit 859e41e90165b00b99addf4c498b8ec031ba9df9 Author: Konstantin Belousov AuthorDate: 2021-04-07 14:08:43 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:38 +0000 mlx5: fix typo, KENREL_MIN_LEVEL->KERNEL_MIN_LEVEL Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c index 55c7896e3d52..320831b6e153 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c @@ -68,8 +68,8 @@ #define BYPASS_PRIO_MAX_FT 1 #define KERNEL_MAX_FT 5 #define LEFTOVER_MAX_FT 1 -#define KENREL_MIN_LEVEL 3 -#define LEFTOVER_MIN_LEVEL KENREL_MIN_LEVEL + 1 +#define KERNEL_MIN_LEVEL 3 +#define LEFTOVER_MIN_LEVEL KERNEL_MIN_LEVEL + 1 #define BYPASS_MIN_LEVEL MLX5_NUM_BYPASS_FTS + LEFTOVER_MIN_LEVEL struct node_caps { size_t arr_sz; @@ -113,7 +113,7 @@ struct init_tree_node { BYPASS_PRIO_MAX_FT), ADD_FT_PRIO("prio-mcast", 0, BYPASS_PRIO_MAX_FT))), - ADD_PRIO("kernel_prio", 0, KENREL_MIN_LEVEL, 0, {}, + ADD_PRIO("kernel_prio", 0, KERNEL_MIN_LEVEL, 0, {}, ADD_NS("kernel_ns", ADD_FT_PRIO("prio_kernel-0", 0, KERNEL_MAX_FT))), From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F81365CE54; Mon, 12 Jul 2021 12:00: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 4GNj5N5RyQz3GTC; Mon, 12 Jul 2021 12:00: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 91223680E; Mon, 12 Jul 2021 12:00: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 16CC0eF9008566; Mon, 12 Jul 2021 12:00:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0e05008565; Mon, 12 Jul 2021 12:00:40 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:40 GMT Message-Id: <202107121200.16CC0e05008565@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: e012189d0265 - main - mlx5en: remove unneeded protocol and port parameters from mlx5e_add_vxal_rule 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: e012189d0265851c631261bdcb175727ba715b34 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:41 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e012189d0265851c631261bdcb175727ba715b34 commit e012189d0265851c631261bdcb175727ba715b34 Author: Konstantin Belousov AuthorDate: 2021-04-14 07:03:46 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:38 +0000 mlx5en: remove unneeded protocol and port parameters from mlx5e_add_vxal_rule the values are already passed in the db element Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index f4f9e494308e..9e10a3728b1d 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -1728,8 +1728,8 @@ mlx5e_destroy_vlan_flow_table(struct mlx5e_priv *priv) } static int -mlx5e_add_vxlan_rule_sub(struct mlx5e_priv *priv, u_int protocol, u_int port, - u32 *mc, u32 *mv, struct mlx5e_vxlan_db_el *el) +mlx5e_add_vxlan_rule_sub(struct mlx5e_priv *priv, u32 *mc, u32 *mv, + struct mlx5e_vxlan_db_el *el) { struct mlx5_flow_table *ft = priv->fts.vxlan.t; struct mlx5_flow_destination dest = {}; @@ -1743,11 +1743,11 @@ mlx5e_add_vxlan_rule_sub(struct mlx5e_priv *priv, u_int protocol, u_int port, mc_enable = MLX5_MATCH_OUTER_HEADERS; rule_p = &el->vxlan_ft_rule; MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.ethertype); - MLX5_SET(fte_match_param, mv, outer_headers.ethertype, protocol); + MLX5_SET(fte_match_param, mv, outer_headers.ethertype, el->proto); MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.ip_protocol); MLX5_SET(fte_match_param, mv, outer_headers.ip_protocol, IPPROTO_UDP); MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.udp_dport); - MLX5_SET(fte_match_param, mv, outer_headers.udp_dport, port); + MLX5_SET(fte_match_param, mv, outer_headers.udp_dport, el->port); *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); @@ -1829,8 +1829,7 @@ mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) goto add_vxlan_rule_out; } - err = mlx5e_add_vxlan_rule_sub(priv, proto, port, match_criteria, - match_value, el); + err = mlx5e_add_vxlan_rule_sub(priv, match_criteria, match_value, el); if (err == 0) { TAILQ_INSERT_TAIL(&priv->vxlan.head, el, link); } else { From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7BEA65CF82; Mon, 12 Jul 2021 12:00: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 4GNj5Q1QZVz3GMj; Mon, 12 Jul 2021 12:00: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 C61436886; Mon, 12 Jul 2021 12:00: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 16CC0fek008590; Mon, 12 Jul 2021 12:00:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0fG3008589; Mon, 12 Jul 2021 12:00:41 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:41 GMT Message-Id: <202107121200.16CC0fG3008589@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: 559eaa44d91a - main - mlx5en: add mlx5e_add_vxlan_rule_from_db() helper 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: 559eaa44d91ad74973612843835a8248b3df7341 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:44 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=559eaa44d91ad74973612843835a8248b3df7341 commit 559eaa44d91ad74973612843835a8248b3df7341 Author: Konstantin Belousov AuthorDate: 2021-04-14 07:08:56 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:39 +0000 mlx5en: add mlx5e_add_vxlan_rule_from_db() helper Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 41 ++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index 9e10a3728b1d..648dc199157c 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -1802,11 +1802,34 @@ mlx5e_vxlan_family_to_proto(sa_family_t family, u_int *proto) } static int -mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) +mlx5e_add_vxlan_rule_from_db(struct mlx5e_priv *priv, + struct mlx5e_vxlan_db_el *el) { - struct mlx5e_vxlan_db_el *el; u32 *match_criteria; u32 *match_value; + int err; + + match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + if (match_value == NULL || match_criteria == NULL) { + mlx5_en_err(priv->ifp, "alloc failed\n"); + err = -ENOMEM; + goto add_vxlan_rule_out; + } + + err = mlx5e_add_vxlan_rule_sub(priv, match_criteria, match_value, el); + +add_vxlan_rule_out: + kvfree(match_criteria); + kvfree(match_value); + + return (err); +} + +static int +mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) +{ + struct mlx5e_vxlan_db_el *el; u_int proto; int err; @@ -1821,25 +1844,13 @@ mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) } el = mlx5e_vxlan_alloc_db_el(priv, proto, port); - match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); - match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); - if (match_value == NULL || match_criteria == NULL) { - mlx5_en_err(priv->ifp, "alloc failed\n"); - err = -ENOMEM; - goto add_vxlan_rule_out; - } - - err = mlx5e_add_vxlan_rule_sub(priv, match_criteria, match_value, el); + err = mlx5e_add_vxlan_rule_from_db(priv, el); if (err == 0) { TAILQ_INSERT_TAIL(&priv->vxlan.head, el, link); } else { kvfree(el); } -add_vxlan_rule_out: - kvfree(match_criteria); - kvfree(match_value); - return (err); } From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88A4D65CEBA; Mon, 12 Jul 2021 12:00: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 4GNj5T548zz3GP8; Mon, 12 Jul 2021 12:00: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 16C886887; Mon, 12 Jul 2021 12:00: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 16CC0ikM008668; Mon, 12 Jul 2021 12:00:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0iOE008667; Mon, 12 Jul 2021 12:00:44 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:44 GMT Message-Id: <202107121200.16CC0iOE008667@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: 1918b253d36a - main - mlx5en: Fix for IPv6 VxLAN checksum offload. 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: 1918b253d36a82ccc171df40d9abb75923f1ece5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:46 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1918b253d36a82ccc171df40d9abb75923f1ece5 commit 1918b253d36a82ccc171df40d9abb75923f1ece5 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:25 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:39 +0000 mlx5en: Fix for IPv6 VxLAN checksum offload. Add missing check for IPv6 mbuf offload flags and remove L3 WQE checksum flag for IPv6. MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index 6bc0a91ca8ef..437910ee7964 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -423,7 +423,7 @@ mlx5e_get_vxlan_header_size(const struct mbuf *mb, struct mlx5e_tx_wqe *wqe, if (unlikely(ip_type != IPPROTO_UDP)) return (0); wqe->eth.swp_outer_l3_offset = eth_hdr_len / 2; - wqe->eth.cs_flags = MLX5_ETH_WQE_L3_CSUM | MLX5_ETH_WQE_L4_CSUM; + wqe->eth.cs_flags = MLX5_ETH_WQE_L4_CSUM; eth_hdr_len += sizeof(*ip6); udp = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, sizeof(*udp)); @@ -483,7 +483,6 @@ mlx5e_get_vxlan_header_size(const struct mbuf *mb, struct mlx5e_tx_wqe *wqe, if (unlikely(ip6 == NULL)) return (0); wqe->eth.swp_inner_l3_offset = eth_hdr_len / 2; - wqe->eth.cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM; wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_INNER_L3_TYPE; ip_type = ip6->ip6_nxt; eth_hdr_len += sizeof(*ip6); @@ -833,7 +832,8 @@ top: uint8_t cs_mask; if (mb->m_pkthdr.csum_flags & - (CSUM_INNER_IP_TCP | CSUM_INNER_IP_UDP)) { + (CSUM_INNER_IP_TCP | CSUM_INNER_IP_UDP | + CSUM_INNER_IP6_TCP | CSUM_INNER_IP6_UDP)) { cs_mask = MLX5_ETH_WQE_L3_INNER_CSUM | MLX5_ETH_WQE_L4_INNER_CSUM | From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4597265CD4B; Mon, 12 Jul 2021 12:00: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 4GNj5S2pKpz3GXq; Mon, 12 Jul 2021 12:00: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 E037E6901; Mon, 12 Jul 2021 12:00: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 16CC0hrj008638; Mon, 12 Jul 2021 12:00:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0hhd008637; Mon, 12 Jul 2021 12:00:43 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:43 GMT Message-Id: <202107121200.16CC0hhd008637@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: 48acda2b2d6d - main - mlx5en: Honor IFCAP_VXLAN_HWCSUM 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: 48acda2b2d6d173a2231a3db153dd4709dcb5276 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:45 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=48acda2b2d6d173a2231a3db153dd4709dcb5276 commit 48acda2b2d6d173a2231a3db153dd4709dcb5276 Author: Konstantin Belousov AuthorDate: 2021-04-20 11:16:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:39 +0000 mlx5en: Honor IFCAP_VXLAN_HWCSUM In particular, avoid creating TIR or installing flow rules for VXLAN if the capability is disabled. Reported and reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 77 +++++++++++++++++++------------ sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 44 ++++++++++-------- 2 files changed, 74 insertions(+), 47 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index a493e530a4c8..6be95550c713 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -732,7 +732,8 @@ mlx5e_add_vlan_rule_sub(struct mlx5e_priv *priv, int err = 0; dest.type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; - dest.ft = priv->fts.vxlan.t; + dest.ft = ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) ? + priv->fts.vxlan.t : priv->fts.main.t; mc_enable = MLX5_MATCH_OUTER_HEADERS; @@ -1845,13 +1846,15 @@ mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) } el = mlx5e_vxlan_alloc_db_el(priv, proto, port); - err = mlx5e_add_vxlan_rule_from_db(priv, el); - if (err == 0) { + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_add_vxlan_rule_from_db(priv, el); + if (err == 0) + el->installed = true; + } + if (err == 0) TAILQ_INSERT_TAIL(&priv->vxlan.head, el, link); - el->installed = true; - } else { + else kvfree(el); - } return (err); } @@ -2235,40 +2238,53 @@ mlx5e_open_flow_table(struct mlx5e_priv *priv) if (err) return (err); - err = mlx5e_create_vxlan_flow_table(priv); - if (err) - goto err_destroy_vlan_flow_table; + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_create_vxlan_flow_table(priv); + if (err) + goto err_destroy_vlan_flow_table; + } err = mlx5e_create_main_flow_table(priv, false); if (err) goto err_destroy_vxlan_flow_table; - err = mlx5e_create_main_flow_table(priv, true); - if (err) - goto err_destroy_main_flow_table; + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_create_main_flow_table(priv, true); + if (err) + goto err_destroy_main_flow_table; + } - err = mlx5e_create_inner_rss_flow_table(priv); - if (err) - goto err_destroy_main_vxlan_flow_table; + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_create_inner_rss_flow_table(priv); + if (err) + goto err_destroy_main_vxlan_flow_table; + } - err = mlx5e_add_vxlan_catchall_rule(priv); - if (err != 0) - goto err_destroy_inner_rss_flow_table; + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_add_vxlan_catchall_rule(priv); + if (err != 0) + goto err_destroy_inner_rss_flow_table; + } - err = mlx5e_add_main_vxlan_rules(priv); - if (err != 0) - goto err_destroy_inner_rss_flow_table; + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_add_main_vxlan_rules(priv); + if (err != 0) + goto err_destroy_inner_rss_flow_table; + } return (0); err_destroy_inner_rss_flow_table: - mlx5e_destroy_inner_rss_flow_table(priv); + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_destroy_inner_rss_flow_table(priv); err_destroy_main_vxlan_flow_table: - mlx5e_destroy_main_vxlan_flow_table(priv); + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_destroy_main_vxlan_flow_table(priv); err_destroy_main_flow_table: mlx5e_destroy_main_flow_table(priv); err_destroy_vxlan_flow_table: - mlx5e_destroy_vxlan_flow_table(priv); + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_destroy_vxlan_flow_table(priv); err_destroy_vlan_flow_table: mlx5e_destroy_vlan_flow_table(priv); @@ -2280,11 +2296,14 @@ mlx5e_close_flow_table(struct mlx5e_priv *priv) { mlx5e_handle_ifp_addr(priv); - mlx5e_destroy_inner_rss_flow_table(priv); - mlx5e_del_vxlan_catchall_rule(priv); - mlx5e_destroy_vxlan_flow_table(priv); - mlx5e_del_main_vxlan_rules(priv); + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + mlx5e_destroy_inner_rss_flow_table(priv); + mlx5e_del_vxlan_catchall_rule(priv); + mlx5e_destroy_vxlan_flow_table(priv); + mlx5e_del_main_vxlan_rules(priv); + } mlx5e_destroy_main_flow_table(priv); - mlx5e_destroy_main_vxlan_flow_table(priv); + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_destroy_main_vxlan_flow_table(priv); mlx5e_destroy_vlan_flow_table(priv); } diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 9a01940ca90c..ab1d627c0fbc 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -2810,10 +2810,8 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt, bool inner_vxla lro_timer_supported_periods[2])); } - if (inner_vxlan && - (priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + if (inner_vxlan) MLX5_SET(tirc, tirc, tunneled_offload_en, 1); - } /* setup parameters for hashing TIR type, if any */ switch (tt) { @@ -3127,10 +3125,13 @@ mlx5e_open_locked(struct ifnet *ifp) mlx5_en_err(ifp, "mlx5e_open_tir(main) failed, %d\n", err); goto err_close_rqls; } - err = mlx5e_open_tirs(priv, true); - if (err) { - mlx5_en_err(ifp, "mlx5e_open_tir(inner) failed, %d\n", err); - goto err_close_tirs; + if ((ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_open_tirs(priv, true); + if (err) { + mlx5_en_err(ifp, "mlx5e_open_tir(inner) failed, %d\n", + err); + goto err_close_tirs; + } } err = mlx5e_open_flow_table(priv); if (err) { @@ -3144,11 +3145,13 @@ mlx5e_open_locked(struct ifnet *ifp) "mlx5e_add_all_vlan_rules failed, %d\n", err); goto err_close_flow_table; } - err = mlx5e_add_all_vxlan_rules(priv); - if (err) { - mlx5_en_err(ifp, - "mlx5e_add_all_vxlan_rules failed, %d\n", err); - goto err_del_vlan_rules; + if ((ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_add_all_vxlan_rules(priv); + if (err) { + mlx5_en_err(ifp, + "mlx5e_add_all_vxlan_rules failed, %d\n", err); + goto err_del_vlan_rules; + } } set_bit(MLX5E_STATE_OPENED, &priv->state); @@ -3164,7 +3167,8 @@ err_close_flow_table: mlx5e_close_flow_table(priv); err_close_tirs_inner: - mlx5e_close_tirs(priv, true); + if ((ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_close_tirs(priv, true); err_close_tirs: mlx5e_close_tirs(priv, false); @@ -3213,10 +3217,12 @@ mlx5e_close_locked(struct ifnet *ifp) mlx5e_set_rx_mode_core(priv); mlx5e_del_all_vlan_rules(priv); - mlx5e_del_all_vxlan_rules(priv); + if ((ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_del_all_vxlan_rules(priv); if_link_state_change(priv->ifp, LINK_STATE_DOWN); mlx5e_close_flow_table(priv); - mlx5e_close_tirs(priv, true); + if ((ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_close_tirs(priv, true); mlx5e_close_tirs(priv, false); mlx5e_close_rqt(priv); mlx5e_close_channels(priv); @@ -3457,14 +3463,16 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data) if (mask & IFCAP_WOL_MAGIC) ifp->if_capenable ^= IFCAP_WOL_MAGIC; if (mask & IFCAP_VXLAN_HWCSUM) { + int was_opened = test_bit(MLX5E_STATE_OPENED, + &priv->state); + if (was_opened) + mlx5e_close_locked(ifp); ifp->if_capenable ^= IFCAP_VXLAN_HWCSUM; ifp->if_hwassist ^= CSUM_INNER_IP | CSUM_INNER_IP_UDP | CSUM_INNER_IP_TCP | CSUM_INNER_IP6_UDP | CSUM_INNER_IP6_TCP; - if (test_bit(MLX5E_STATE_OPENED, &priv->state)) { - mlx5e_close_locked(ifp); + if (was_opened) mlx5e_open_locked(ifp); - } } if (mask & IFCAP_VXLAN_HWTSO) { ifp->if_capenable ^= IFCAP_VXLAN_HWTSO; From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3F4565CE60; Mon, 12 Jul 2021 12:00: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 4GNj5V6Hfsz3GhT; Mon, 12 Jul 2021 12:00: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 36BE664BD; Mon, 12 Jul 2021 12:00: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 16CC0kMp008692; Mon, 12 Jul 2021 12:00:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0kA4008691; Mon, 12 Jul 2021 12:00:46 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:46 GMT Message-Id: <202107121200.16CC0kA4008691@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: 2f7ce2326f94 - main - mlx5en: Add missing error case when creating VXLAN flow tables. 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: 2f7ce2326f9486e90cda2f0129331e1ab3694252 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:48 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2f7ce2326f9486e90cda2f0129331e1ab3694252 commit 2f7ce2326f9486e90cda2f0129331e1ab3694252 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:27 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:39 +0000 mlx5en: Add missing error case when creating VXLAN flow tables. While at it remove redundant checks for IFCAP_VXLAN_HWCSUM flag. MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index 6be95550c713..cdfe19d910d1 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -2252,34 +2252,28 @@ mlx5e_open_flow_table(struct mlx5e_priv *priv) err = mlx5e_create_main_flow_table(priv, true); if (err) goto err_destroy_main_flow_table; - } - if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { err = mlx5e_create_inner_rss_flow_table(priv); if (err) goto err_destroy_main_vxlan_flow_table; - } - if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { err = mlx5e_add_vxlan_catchall_rule(priv); if (err != 0) goto err_destroy_inner_rss_flow_table; - } - if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { err = mlx5e_add_main_vxlan_rules(priv); if (err != 0) - goto err_destroy_inner_rss_flow_table; + goto err_destroy_vxlan_catchall_rule; } return (0); +err_destroy_vxlan_catchall_rule: + mlx5e_del_vxlan_catchall_rule(priv); err_destroy_inner_rss_flow_table: - if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) - mlx5e_destroy_inner_rss_flow_table(priv); + mlx5e_destroy_inner_rss_flow_table(priv); err_destroy_main_vxlan_flow_table: - if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) - mlx5e_destroy_main_vxlan_flow_table(priv); + mlx5e_destroy_main_vxlan_flow_table(priv); err_destroy_main_flow_table: mlx5e_destroy_main_flow_table(priv); err_destroy_vxlan_flow_table: From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A3B765CEB5; Mon, 12 Jul 2021 12:00: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 4GNj5R3tTRz3G5G; Mon, 12 Jul 2021 12:00: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 BEA616810; Mon, 12 Jul 2021 12:00: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 16CC0gCe008614; Mon, 12 Jul 2021 12:00:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0gJv008613; Mon, 12 Jul 2021 12:00:42 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:42 GMT Message-Id: <202107121200.16CC0gJv008613@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: 0e4cb0d5a487 - main - mlx5en: remove all dynamic vxlan steering rules on close and reinstall on open 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: 0e4cb0d5a487339cc7f5e151c466e20aeac1e4d9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:44 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0e4cb0d5a487339cc7f5e151c466e20aeac1e4d9 commit 0e4cb0d5a487339cc7f5e151c466e20aeac1e4d9 Author: Konstantin Belousov AuthorDate: 2021-04-14 07:09:36 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:39 +0000 mlx5en: remove all dynamic vxlan steering rules on close and reinstall on open Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/dev/mlx5/mlx5_en/en.h | 4 ++++ sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 36 ++++++++++++++++++++++++++++++- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 10 +++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index ab30c7e2ca90..e4b66bea8f60 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -948,6 +948,7 @@ struct mlx5e_vxlan_db_el { u_int refcount; u_int proto; u_int port; + bool installed; struct mlx5_flow_rule *vxlan_ft_rule; TAILQ_ENTRY(mlx5e_vxlan_db_el) link; }; @@ -1149,6 +1150,9 @@ void mlx5e_vxlan_start(void *arg, struct ifnet *ifp, sa_family_t family, void mlx5e_vxlan_stop(void *arg, struct ifnet *ifp, sa_family_t family, u_int port); +int mlx5e_add_all_vxlan_rules(struct mlx5e_priv *priv); +void mlx5e_del_all_vxlan_rules(struct mlx5e_priv *priv); + static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq, u32 *wqe) { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index 648dc199157c..a493e530a4c8 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -1840,13 +1840,15 @@ mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) el = mlx5e_vxlan_find_db_el(priv, proto, port); if (el != NULL) { el->refcount++; - return (0); + if (el->installed) + return (0); } el = mlx5e_vxlan_alloc_db_el(priv, proto, port); err = mlx5e_add_vxlan_rule_from_db(priv, el); if (err == 0) { TAILQ_INSERT_TAIL(&priv->vxlan.head, el, link); + el->installed = true; } else { kvfree(el); } @@ -1905,6 +1907,25 @@ add_vxlan_rule_out: return (err); } +int +mlx5e_add_all_vxlan_rules(struct mlx5e_priv *priv) +{ + struct mlx5e_vxlan_db_el *el; + int err; + + err = 0; + TAILQ_FOREACH(el, &priv->vxlan.head, link) { + if (el->installed) + continue; + err = mlx5e_add_vxlan_rule_from_db(priv, el); + if (err != 0) + break; + el->installed = false; + } + + return (err); +} + static int mlx5e_del_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) { @@ -1930,6 +1951,19 @@ mlx5e_del_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) return (0); } +void +mlx5e_del_all_vxlan_rules(struct mlx5e_priv *priv) +{ + struct mlx5e_vxlan_db_el *el; + + TAILQ_FOREACH(el, &priv->vxlan.head, link) { + if (!el->installed) + continue; + mlx5_del_flow_rule(el->vxlan_ft_rule); + el->installed = false; + } +} + static void mlx5e_del_vxlan_catchall_rule(struct mlx5e_priv *priv) { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 26bd5e00d22d..9a01940ca90c 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -3144,6 +3144,12 @@ mlx5e_open_locked(struct ifnet *ifp) "mlx5e_add_all_vlan_rules failed, %d\n", err); goto err_close_flow_table; } + err = mlx5e_add_all_vxlan_rules(priv); + if (err) { + mlx5_en_err(ifp, + "mlx5e_add_all_vxlan_rules failed, %d\n", err); + goto err_del_vlan_rules; + } set_bit(MLX5E_STATE_OPENED, &priv->state); mlx5e_update_carrier(priv); @@ -3151,6 +3157,9 @@ mlx5e_open_locked(struct ifnet *ifp) return (0); +err_del_vlan_rules: + mlx5e_del_all_vlan_rules(priv); + err_close_flow_table: mlx5e_close_flow_table(priv); @@ -3204,6 +3213,7 @@ mlx5e_close_locked(struct ifnet *ifp) mlx5e_set_rx_mode_core(priv); mlx5e_del_all_vlan_rules(priv); + mlx5e_del_all_vxlan_rules(priv); if_link_state_change(priv->ifp, LINK_STATE_DOWN); mlx5e_close_flow_table(priv); mlx5e_close_tirs(priv, true); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0819265CF9A; Mon, 12 Jul 2021 12: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 4GNj5X0chqz3GTS; Mon, 12 Jul 2021 12:00: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 66A926813; Mon, 12 Jul 2021 12:00: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 16CC0lex008796; Mon, 12 Jul 2021 12:00:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0lkA008784; Mon, 12 Jul 2021 12:00:47 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:47 GMT Message-Id: <202107121200.16CC0lkA008784@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: b1277d42d718 - main - mlx5en: add ASCII art providing an overview of flow tables organization 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: b1277d42d718cd42d04d39fa2d61873655e909b3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:49 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b1277d42d718cd42d04d39fa2d61873655e909b3 commit b1277d42d718cd42d04d39fa2d61873655e909b3 Author: Konstantin Belousov AuthorDate: 2021-04-26 22:38:46 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:39 +0000 mlx5en: add ASCII art providing an overview of flow tables organization Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index cdfe19d910d1..54fbe8e057cc 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -31,6 +31,35 @@ #include #include +/* + * The flow tables with rules define the packet processing on receive. + * Currently, the following structure is set up to handle different offloads + * like VLAN decapsulation, packet classification, RSS hashing, VxLAN checksum + * offloading: + * + * + * +=========+ +=========+ +=================+ + * |VLAN ft: | |VxLAN | |VxLAN Main | + * |CTAG/STAG|------>| VNI|----->|Inner Proto Match|=====> Inner TIR n + * |VID/noVID|/ |Catch-all|\ | | + * +=========+ +=========+| +=================+ + * | + * | + * | + * v + * +=================+ + * |Main | + * |Outer Proto Match|=====> TIR n + * | | + * +=================+ + * + * The path through flow rules directs each packet into an appropriate TIR, + * according to the: + * - VLAN encapsulation + * - Outer protocol + * - Presence of inner protocol + */ + #define MLX5_SET_CFG(p, f, v) MLX5_SET(create_flow_group_in, p, f, v) enum { From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7304265D104; Mon, 12 Jul 2021 12:00: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 4GNj5Z5sL7z3GcW; Mon, 12 Jul 2021 12:00: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 7FAAD64BF; Mon, 12 Jul 2021 12: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 16CC0nkC009635; Mon, 12 Jul 2021 12: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 16CC0nu5009634; Mon, 12 Jul 2021 12:00:49 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:49 GMT Message-Id: <202107121200.16CC0nu5009634@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: 0fc0b62b0f7b - main - mlx5: Fix PBMC register mapping 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: 0fc0b62b0f7be49bcf4c5670a6c81386e333fb02 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:51 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0fc0b62b0f7be49bcf4c5670a6c81386e333fb02 commit 0fc0b62b0f7be49bcf4c5670a6c81386e333fb02 Author: Konstantin Belousov AuthorDate: 2021-04-26 11:39:11 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:40 +0000 mlx5: Fix PBMC register mapping Import Linux commit 534b1204ca4694db1093b15cf3e79a99fcb6a6da Add reserved mapping to cover all the register in order to avoid setting arbitrary values to newer FW which implements the reserved fields. Reviewed by: hselasky Sponsored by: Mellanox Technologies // NVIDIA Networking MFC after: 1 week --- sys/dev/mlx5/mlx5_ifc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index 81e91e180b8c..494180630500 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -8839,7 +8839,7 @@ struct mlx5_ifc_pbmc_reg_bits { struct mlx5_ifc_bufferx_reg_bits buffer[10]; - u8 reserved_at_2e0[0x40]; + u8 reserved_at_2e0[0x80]; }; struct mlx5_ifc_paos_reg_bits { From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDAB265CF9B; Mon, 12 Jul 2021 12: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 4GNj5X7435z3Ghh; Mon, 12 Jul 2021 12:00: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 6B4286795; Mon, 12 Jul 2021 12:00: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 16CC0mNg009611; Mon, 12 Jul 2021 12:00:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0m8e009610; Mon, 12 Jul 2021 12:00:48 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:48 GMT Message-Id: <202107121200.16CC0m8e009610@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: 06a3fd0e5c86 - main - mlx5: Fix PPLM register mapping 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: 06a3fd0e5c86ae4f00075c1571cf4e183e28b4c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:50 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=06a3fd0e5c86ae4f00075c1571cf4e183e28b4c4 commit 06a3fd0e5c86ae4f00075c1571cf4e183e28b4c4 Author: Konstantin Belousov AuthorDate: 2021-04-21 14:12:53 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:40 +0000 mlx5: Fix PPLM register mapping Import Linux commit ce28f0fd670ddffcd564ce7119bdefbaf08f02d3: Add reserved mapping to cover all the register in order to avoid setting arbitrary values to newer FW which implements the reserved fields. Taken from: https://patches.linaro.org/patch/417255/ Reviewed by: hselasky Sponsored by: Mellanox Technologies // NVIDIA Networking MFC after: 1 week --- sys/dev/mlx5/mlx5_ifc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index f748ec876ef4..81e91e180b8c 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -8139,7 +8139,7 @@ struct mlx5_ifc_pplm_reg_bits { u8 fec_override_admin_100g_2x[0x10]; u8 fec_override_admin_50g_1x[0x10]; - u8 reserved_at_140[0xC0]; + u8 reserved_at_140[0x140]; }; struct mlx5_ifc_ppll_reg_bits { From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C884965CD53; Mon, 12 Jul 2021 12:00: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 4GNj5b3nClz3Gl7; Mon, 12 Jul 2021 12:00: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 9EE426814; Mon, 12 Jul 2021 12:00: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 16CC0oix009663; Mon, 12 Jul 2021 12:00:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0oTr009662; Mon, 12 Jul 2021 12:00:50 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:50 GMT Message-Id: <202107121200.16CC0oTr009662@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: 8391db038df8 - main - mlx5: add a knob to administratively disable mlx5 fw dump setup 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: 8391db038df87e0fa5519617e3bb35a2cf78b41e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:53 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8391db038df87e0fa5519617e3bb35a2cf78b41e commit 8391db038df87e0fa5519617e3bb35a2cf78b41e Author: Konstantin Belousov AuthorDate: 2021-07-05 07:55:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:40 +0000 mlx5: add a knob to administratively disable mlx5 fw dump setup MFC after: 1 week Reviewed by: hselasky Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_fwdump.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c index 09e8f9f7660a..7bb563846144 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c @@ -59,6 +59,11 @@ mlx5_fwdump_destroy_dd(struct mlx5_core_dev *mdev) mdev->dump_data = NULL; } +static int mlx5_fw_dump_enable = 1; +SYSCTL_INT(_hw_mlx5, OID_AUTO, fw_dump_enable, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, + &mlx5_fw_dump_enable, 0, + "Enable fw dump setup and op"); + void mlx5_fwdump_prep(struct mlx5_core_dev *mdev) { @@ -68,6 +73,14 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) u32 addr, in, out, next_addr; mdev->dump_data = NULL; + + TUNABLE_INT_FETCH("hw.mlx5.fw_dump_enable", &mlx5_fw_dump_enable); + if (!mlx5_fw_dump_enable) { + mlx5_core_warn(mdev, + "Firmware dump administratively prohibited\n"); + return; + } + error = mlx5_vsc_find_cap(mdev); if (error != 0) { /* Inability to create a firmware dump is not fatal. */ From owner-dev-commits-src-main@freebsd.org Mon Jul 12 12:00:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F14465CF4D; Mon, 12 Jul 2021 12:00: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 4GNj5c70PTz3GNH; Mon, 12 Jul 2021 12:00: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 C0E166902; Mon, 12 Jul 2021 12:00: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 16CC0pVJ009689; Mon, 12 Jul 2021 12:00:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CC0pRt009688; Mon, 12 Jul 2021 12:00:51 GMT (envelope-from git) Date: Mon, 12 Jul 2021 12:00:51 GMT Message-Id: <202107121200.16CC0pRt009688@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: 78f5ebaed62e - main - mlx5: drop Giant around VSC lock and CRSPACE enumeration on attach 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: 78f5ebaed62e38caafc72f4ec1c0a7c2013e15c7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 12:00:54 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=78f5ebaed62e38caafc72f4ec1c0a7c2013e15c7 commit 78f5ebaed62e38caafc72f4ec1c0a7c2013e15c7 Author: Konstantin Belousov AuthorDate: 2021-07-05 09:24:00 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-12 09:34:40 +0000 mlx5: drop Giant around VSC lock and CRSPACE enumeration on attach This code practically has not sleeping points, so Giant is locked for very long time. Noted and reviewed by: hselasky MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_fwdump.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c index 7bb563846144..a23de943f4aa 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c @@ -81,17 +81,19 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) return; } + DROP_GIANT(); + error = mlx5_vsc_find_cap(mdev); if (error != 0) { /* Inability to create a firmware dump is not fatal. */ mlx5_core_warn(mdev, "Unable to find vendor-specific capability, error %d\n", error); - return; + goto pickup_g; } error = mlx5_vsc_lock(mdev); if (error != 0) - return; + goto pickup_g; error = mlx5_vsc_set_space(mdev, MLX5_VSC_DOMAIN_SCAN_CRSPACE); if (error != 0) { mlx5_core_warn(mdev, "VSC scan space is not supported\n"); @@ -180,6 +182,8 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) unlock_vsc: mlx5_vsc_unlock(mdev); +pickup_g: + PICKUP_GIANT(); } int From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 928B265EB73; Mon, 12 Jul 2021 13: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 4GNkcT3Yf9z3RBc; Mon, 12 Jul 2021 13: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 606CD7246; Mon, 12 Jul 2021 13: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 16CD9D44094494; Mon, 12 Jul 2021 13: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 16CD9DtI094493; Mon, 12 Jul 2021 13:09:13 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:13 GMT Message-Id: <202107121309.16CD9DtI094493@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: a888087fba37 - main - mlx5en: Add missing media types for 100GBit/s, 200Gbit/s and 400Gbit/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/main X-Git-Reftype: branch X-Git-Commit: a888087fba37da7c968058062b644f4a79b558c3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:13 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=a888087fba37da7c968058062b644f4a79b558c3 commit a888087fba37da7c968058062b644f4a79b558c3 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:28 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:29 +0000 mlx5en: Add missing media types for 100GBit/s, 200Gbit/s and 400Gbit/s. Make the mlx5e_mode_table[] array one dimensional, because there is only one entry, 10G ER/LR, which share the same protocol bit. This patch only adds support for basic sub-type distinguishing for the extended protocol bits. Use verbose ifconfig eeprom output to get actual media type. Remove write only "connector_type" variable while at it. MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_port.c | 15 ++ sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 421 +++++++++++++++++------------------- sys/dev/mlx5/port.h | 85 ++------ 3 files changed, 232 insertions(+), 289 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_port.c b/sys/dev/mlx5/mlx5_core/mlx5_port.c index b74efc5351ea..b303c7b07c7d 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_port.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_port.c @@ -1221,6 +1221,21 @@ int mlx5_query_pddr_range_info(struct mlx5_core_dev *mdev, u8 local_port, u8 *is } EXPORT_SYMBOL_GPL(mlx5_query_pddr_range_info); +int mlx5_query_pddr_cable_type(struct mlx5_core_dev *mdev, u8 local_port, u8 *cable_type) +{ + u32 pddr_reg[MLX5_ST_SZ_DW(pddr_reg)] = {}; + int error; + + error = mlx5_query_pddr(mdev, local_port, MLX5_PDDR_MODULE_INFO_PAGE, + pddr_reg, sizeof(pddr_reg)); + if (error != 0) + return (error); + + *cable_type = MLX5_GET(pddr_reg, pddr_reg, page_data.pddr_module_info.cable_type); + return (0); +} +EXPORT_SYMBOL_GPL(mlx5_query_pddr_cable_type); + int mlx5_query_pddr_troubleshooting_info(struct mlx5_core_dev *mdev, u16 *monitor_opcode, u8 *status_message, size_t sm_len) { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index ab1d627c0fbc..57da44e68de3 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2018 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2021 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -57,356 +57,301 @@ struct media { u64 baudrate; }; -static const struct media mlx5e_mode_table[MLX5E_LINK_SPEEDS_NUMBER][MLX5E_LINK_MODES_NUMBER] = { - - [MLX5E_1000BASE_CX_SGMII][MLX5E_SGMII] = { +static const struct media mlx5e_mode_table[MLX5E_LINK_SPEEDS_NUMBER] = +{ + [MLX5E_1000BASE_CX_SGMII] = { .subtype = IFM_1000_CX_SGMII, .baudrate = IF_Mbps(1000ULL), }, - [MLX5E_1000BASE_KX][MLX5E_KX] = { + [MLX5E_1000BASE_KX] = { .subtype = IFM_1000_KX, .baudrate = IF_Mbps(1000ULL), }, - [MLX5E_10GBASE_CX4][MLX5E_CX4] = { + [MLX5E_10GBASE_CX4] = { .subtype = IFM_10G_CX4, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_KX4][MLX5E_KX4] = { + [MLX5E_10GBASE_KX4] = { .subtype = IFM_10G_KX4, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_KR][MLX5E_KR] = { + [MLX5E_10GBASE_KR] = { .subtype = IFM_10G_KR, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_20GBASE_KR2][MLX5E_KR2] = { + [MLX5E_20GBASE_KR2] = { .subtype = IFM_20G_KR2, .baudrate = IF_Gbps(20ULL), }, - [MLX5E_40GBASE_CR4][MLX5E_CR4] = { + [MLX5E_40GBASE_CR4] = { .subtype = IFM_40G_CR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_KR4][MLX5E_KR4] = { + [MLX5E_40GBASE_KR4] = { .subtype = IFM_40G_KR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_56GBASE_R4][MLX5E_R] = { + [MLX5E_56GBASE_R4] = { .subtype = IFM_56G_R4, .baudrate = IF_Gbps(56ULL), }, - [MLX5E_10GBASE_CR][MLX5E_CR1] = { + [MLX5E_10GBASE_CR] = { .subtype = IFM_10G_CR1, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_SR][MLX5E_SR] = { + [MLX5E_10GBASE_SR] = { .subtype = IFM_10G_SR, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_ER_LR][MLX5E_ER] = { + [MLX5E_10GBASE_ER_LR] = { .subtype = IFM_10G_ER, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_ER_LR][MLX5E_LR] = { - .subtype = IFM_10G_LR, - .baudrate = IF_Gbps(10ULL), - }, - [MLX5E_40GBASE_SR4][MLX5E_SR4] = { + [MLX5E_40GBASE_SR4] = { .subtype = IFM_40G_SR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_LR4_ER4][MLX5E_LR4] = { + [MLX5E_40GBASE_LR4_ER4] = { .subtype = IFM_40G_LR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_LR4_ER4][MLX5E_ER4] = { - .subtype = IFM_40G_ER4, - .baudrate = IF_Gbps(40ULL), - }, - [MLX5E_100GBASE_CR4][MLX5E_CR4] = { + [MLX5E_100GBASE_CR4] = { .subtype = IFM_100G_CR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GBASE_SR4][MLX5E_SR4] = { + [MLX5E_100GBASE_SR4] = { .subtype = IFM_100G_SR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GBASE_KR4][MLX5E_KR4] = { + [MLX5E_100GBASE_KR4] = { .subtype = IFM_100G_KR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GBASE_LR4][MLX5E_LR4] = { + [MLX5E_100GBASE_LR4] = { .subtype = IFM_100G_LR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100BASE_TX][MLX5E_TX] = { + [MLX5E_100BASE_TX] = { .subtype = IFM_100_TX, .baudrate = IF_Mbps(100ULL), }, - [MLX5E_1000BASE_T][MLX5E_T] = { + [MLX5E_1000BASE_T] = { .subtype = IFM_1000_T, .baudrate = IF_Mbps(1000ULL), }, - [MLX5E_10GBASE_T][MLX5E_T] = { + [MLX5E_10GBASE_T] = { .subtype = IFM_10G_T, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_25GBASE_CR][MLX5E_CR] = { + [MLX5E_25GBASE_CR] = { .subtype = IFM_25G_CR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_25GBASE_KR][MLX5E_KR] = { + [MLX5E_25GBASE_KR] = { .subtype = IFM_25G_KR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_25GBASE_SR][MLX5E_SR] = { + [MLX5E_25GBASE_SR] = { .subtype = IFM_25G_SR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_50GBASE_CR2][MLX5E_CR2] = { + [MLX5E_50GBASE_CR2] = { .subtype = IFM_50G_CR2, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GBASE_KR2][MLX5E_KR2] = { + [MLX5E_50GBASE_KR2] = { .subtype = IFM_50G_KR2, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GBASE_KR4][MLX5E_KR4] = { + [MLX5E_50GBASE_KR4] = { .subtype = IFM_50G_KR4, .baudrate = IF_Gbps(50ULL), }, }; -static const struct media mlx5e_ext_mode_table[MLX5E_EXT_LINK_SPEEDS_NUMBER][MLX5E_LINK_MODES_NUMBER] = { - [MLX5E_SGMII_100M][MLX5E_SGMII] = { +static const struct media mlx5e_ext_mode_table[MLX5E_EXT_LINK_SPEEDS_NUMBER][MLX5E_CABLE_TYPE_NUMBER] = +{ + /**/ + [MLX5E_SGMII_100M][MLX5E_CABLE_TYPE_UNKNOWN] = { .subtype = IFM_100_SGMII, .baudrate = IF_Mbps(100), }, - [MLX5E_1000BASE_X_SGMII][MLX5E_KX] = { - .subtype = IFM_1000_KX, - .baudrate = IF_Mbps(1000), - }, - [MLX5E_1000BASE_X_SGMII][MLX5E_CX_SGMII] = { - .subtype = IFM_1000_CX_SGMII, - .baudrate = IF_Mbps(1000), - }, - [MLX5E_1000BASE_X_SGMII][MLX5E_CX] = { + + /**/ + [MLX5E_1000BASE_X_SGMII][MLX5E_CABLE_TYPE_UNKNOWN] = { .subtype = IFM_1000_CX, .baudrate = IF_Mbps(1000), }, - [MLX5E_1000BASE_X_SGMII][MLX5E_LX] = { - .subtype = IFM_1000_LX, - .baudrate = IF_Mbps(1000), - }, - [MLX5E_1000BASE_X_SGMII][MLX5E_SX] = { + [MLX5E_1000BASE_X_SGMII][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { .subtype = IFM_1000_SX, .baudrate = IF_Mbps(1000), }, - [MLX5E_1000BASE_X_SGMII][MLX5E_T] = { - .subtype = IFM_1000_T, - .baudrate = IF_Mbps(1000), - }, - [MLX5E_5GBASE_R][MLX5E_T] = { - .subtype = IFM_5000_T, - .baudrate = IF_Mbps(5000), - }, - [MLX5E_5GBASE_R][MLX5E_KR] = { + + /**/ + [MLX5E_5GBASE_R][MLX5E_CABLE_TYPE_UNKNOWN] = { .subtype = IFM_5000_KR, .baudrate = IF_Mbps(5000), }, - [MLX5E_5GBASE_R][MLX5E_KR1] = { - .subtype = IFM_5000_KR1, - .baudrate = IF_Mbps(5000), - }, - [MLX5E_5GBASE_R][MLX5E_KR_S] = { - .subtype = IFM_5000_KR_S, + [MLX5E_5GBASE_R][MLX5E_CABLE_TYPE_TWISTED_PAIR] = { + .subtype = IFM_5000_T, .baudrate = IF_Mbps(5000), }, - [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_ER] = { - .subtype = IFM_10G_ER, - .baudrate = IF_Gbps(10ULL), - }, - [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_KR] = { + + /**/ + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_CABLE_TYPE_UNKNOWN] = { .subtype = IFM_10G_KR, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_LR] = { - .subtype = IFM_10G_LR, + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { + .subtype = IFM_10G_CR1, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_SR] = { + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { .subtype = IFM_10G_SR, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_T] = { - .subtype = IFM_10G_T, - .baudrate = IF_Gbps(10ULL), - }, - [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_AOC] = { - .subtype = IFM_10G_AOC, - .baudrate = IF_Gbps(10ULL), - }, - [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_CR1] = { - .subtype = IFM_10G_CR1, - .baudrate = IF_Gbps(10ULL), - }, - [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_CR4] = { - .subtype = IFM_40G_CR4, - .baudrate = IF_Gbps(40ULL), - }, - [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_KR4] = { + + /**/ + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_CABLE_TYPE_UNKNOWN] = { .subtype = IFM_40G_KR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_LR4] = { - .subtype = IFM_40G_LR4, + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { + .subtype = IFM_40G_CR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_SR4] = { + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { .subtype = IFM_40G_SR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_ER4] = { - .subtype = IFM_40G_ER4, - .baudrate = IF_Gbps(40ULL), - }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CR] = { - .subtype = IFM_25G_CR, - .baudrate = IF_Gbps(25ULL), - }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_KR] = { + /**/ + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CABLE_TYPE_UNKNOWN] = { .subtype = IFM_25G_KR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_SR] = { - .subtype = IFM_25G_SR, - .baudrate = IF_Gbps(25ULL), - }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_ACC] = { - .subtype = IFM_25G_ACC, - .baudrate = IF_Gbps(25ULL), - }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_AOC] = { - .subtype = IFM_25G_AOC, - .baudrate = IF_Gbps(25ULL), - }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CR1] = { - .subtype = IFM_25G_CR1, - .baudrate = IF_Gbps(25ULL), - }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CR_S] = { - .subtype = IFM_25G_CR_S, - .baudrate = IF_Gbps(25ULL), - }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_KR1] = { - .subtype = IFM_5000_KR1, - .baudrate = IF_Gbps(25ULL), - }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_KR_S] = { - .subtype = IFM_25G_KR_S, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { + .subtype = IFM_25G_CR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_LR] = { - .subtype = IFM_25G_LR, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_25G_SR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_T] = { + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CABLE_TYPE_TWISTED_PAIR] = { .subtype = IFM_25G_T, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_CR2] = { - .subtype = IFM_50G_CR2, - .baudrate = IF_Gbps(50ULL), - }, - [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_KR2] = { + + /**/ + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_CABLE_TYPE_UNKNOWN] = { .subtype = IFM_50G_KR2, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_KR4] = { - .subtype = IFM_50G_KR4, + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { + .subtype = IFM_50G_CR2, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_SR2] = { + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { .subtype = IFM_50G_SR2, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_LR2] = { - .subtype = IFM_50G_LR2, - .baudrate = IF_Gbps(50ULL), - }, - [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_LR] = { - .subtype = IFM_50G_LR, - .baudrate = IF_Gbps(50ULL), - }, - [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_SR] = { - .subtype = IFM_50G_SR, + + /**/ + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_50G_KR_PAM4, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_CP] = { + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { .subtype = IFM_50G_CP, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_FR] = { - .subtype = IFM_50G_FR, + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_50G_SR, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_KR_PAM4] = { - .subtype = IFM_50G_KR_PAM4, - .baudrate = IF_Gbps(50ULL), + + /**/ + [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_100G_KR4, + .baudrate = IF_Gbps(100ULL), }, - [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_CR4] = { + [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { .subtype = IFM_100G_CR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_KR4] = { - .subtype = IFM_100G_KR4, + [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_100G_SR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_LR4] = { - .subtype = IFM_100G_LR4, + + /**/ + [MLX5E_100GAUI_1_100GBASE_CR_KR][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_100G_KR_PAM4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_SR4] = { - .subtype = IFM_100G_SR4, + [MLX5E_100GAUI_1_100GBASE_CR_KR][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { + .subtype = IFM_100G_CR_PAM4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_SR2] = { - .subtype = IFM_100G_SR2, + [MLX5E_100GAUI_1_100GBASE_CR_KR][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_100G_SR2, /* XXX */ .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_CP2] = { + + /**/ + [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_100G_KR4, + .baudrate = IF_Gbps(100ULL), + }, + [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { .subtype = IFM_100G_CP2, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_KR2_PAM4] = { - .subtype = IFM_100G_KR2_PAM4, + [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_100G_SR2, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_DR4] = { - .subtype = IFM_200G_DR4, + + /**/ + [MLX5E_200GAUI_2_200GBASE_CR2_KR2][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_200G_KR4_PAM4, /* XXX */ .baudrate = IF_Gbps(200ULL), }, - [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_LR4] = { - .subtype = IFM_200G_LR4, + [MLX5E_200GAUI_2_200GBASE_CR2_KR2][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { + .subtype = IFM_200G_CR4_PAM4, /* XXX */ .baudrate = IF_Gbps(200ULL), }, - [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_SR4] = { - .subtype = IFM_200G_SR4, + [MLX5E_200GAUI_2_200GBASE_CR2_KR2][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_200G_SR4, /* XXX */ .baudrate = IF_Gbps(200ULL), }, - [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_FR4] = { - .subtype = IFM_200G_FR4, + + /**/ + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_200G_KR4_PAM4, .baudrate = IF_Gbps(200ULL), }, - [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_CR4_PAM4] = { + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { .subtype = IFM_200G_CR4_PAM4, .baudrate = IF_Gbps(200ULL), }, - [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_KR4_PAM4] = { - .subtype = IFM_200G_KR4_PAM4, + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_200G_SR4, .baudrate = IF_Gbps(200ULL), }, + + /**/ + [MLX5E_400GAUI_8][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_400G_LR8, /* XXX */ + .baudrate = IF_Gbps(400ULL), + }, + + /**/ + [MLX5E_400GAUI_4_400GBASE_CR4_KR4][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_400G_LR8, /* XXX */ + .baudrate = IF_Gbps(400ULL), + }, }; DEBUGNET_DEFINE(mlx5_en); @@ -420,9 +365,10 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) u32 out[MLX5_ST_SZ_DW(ptys_reg)]; u32 eth_proto_oper; int error; + u8 i; + u8 cable_type; u8 port_state; u8 is_er_type; - u8 i, j; bool ext; struct media media_entry = {}; @@ -454,11 +400,23 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) i = ilog2(eth_proto_oper); - for (j = 0; j != MLX5E_LINK_MODES_NUMBER; j++) { - media_entry = ext ? mlx5e_ext_mode_table[i][j] : - mlx5e_mode_table[i][j]; - if (media_entry.baudrate != 0) - break; + if (ext) { + error = mlx5_query_pddr_cable_type(mdev, 1, &cable_type); + if (error != 0) { + /* use fallback entry */ + media_entry = mlx5e_ext_mode_table[i][MLX5E_CABLE_TYPE_UNKNOWN]; + + mlx5_en_err(priv->ifp, + "query port pddr failed: %d\n", error); + } else { + media_entry = mlx5e_ext_mode_table[i][cable_type]; + + /* check if we should use fallback entry */ + if (media_entry.subtype == 0) + media_entry = mlx5e_ext_mode_table[i][MLX5E_CABLE_TYPE_UNKNOWN]; + } + } else { + media_entry = mlx5e_mode_table[i]; } if (media_entry.subtype == 0) { @@ -508,36 +466,35 @@ mlx5e_media_status(struct ifnet *dev, struct ifmediareq *ifmr) static u32 mlx5e_find_link_mode(u32 subtype, bool ext) { - u32 i; - u32 j; u32 link_mode = 0; - u32 speeds_num = 0; - struct media media_entry = {}; switch (subtype) { + case 0: + goto done; case IFM_10G_LR: subtype = IFM_10G_ER; break; case IFM_40G_ER4: subtype = IFM_40G_LR4; break; + default: + break; } - speeds_num = ext ? MLX5E_EXT_LINK_SPEEDS_NUMBER : - MLX5E_LINK_SPEEDS_NUMBER; - - for (i = 0; i != speeds_num; i++) { - for (j = 0; j < MLX5E_LINK_MODES_NUMBER ; ++j) { - media_entry = ext ? mlx5e_ext_mode_table[i][j] : - mlx5e_mode_table[i][j]; - if (media_entry.baudrate == 0) - continue; - if (media_entry.subtype == subtype) { - link_mode |= MLX5E_PROT_MASK(i); + if (ext) { + for (unsigned i = 0; i != MLX5E_EXT_LINK_SPEEDS_NUMBER; i++) { + for (unsigned j = 0; j != MLX5E_CABLE_TYPE_NUMBER; j++) { + if (mlx5e_ext_mode_table[i][j].subtype == subtype) + link_mode |= MLX5E_PROT_MASK(i); } } + } else { + for (unsigned i = 0; i != MLX5E_LINK_SPEEDS_NUMBER; i++) { + if (mlx5e_mode_table[i].subtype == subtype) + link_mode |= MLX5E_PROT_MASK(i); + } } - +done: return (link_mode); } @@ -4393,17 +4350,14 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) struct ifnet *ifp; struct mlx5e_priv *priv; u8 dev_addr[ETHER_ADDR_LEN] __aligned(4); - u8 connector_type; struct sysctl_oid_list *child; int ncv = mdev->priv.eq_table.num_comp_vectors; char unit[16]; struct pfil_head_args pa; int err; - int i,j; u32 eth_proto_cap; u32 out[MLX5_ST_SZ_DW(ptys_reg)]; - bool ext = 0; - u32 speeds_num; + bool ext; struct media media_entry = {}; if (mlx5e_check_required_hca_cap(mdev)) { @@ -4572,16 +4526,13 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) mlx5e_setup_pauseframes(priv); /* Setup supported medias */ - //TODO: If we failed to query ptys is it ok to proceed?? if (!mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN, 1)) { ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); eth_proto_cap = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, eth_proto_capability); - if (MLX5_CAP_PCAM_FEATURE(mdev, ptys_connector_type)) - connector_type = MLX5_GET(ptys_reg, out, - connector_type); } else { + ext = false; eth_proto_cap = 0; mlx5_en_err(ifp, "Query port media capability failed, %d\n", err); } @@ -4589,15 +4540,47 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) ifmedia_init(&priv->media, IFM_IMASK, mlx5e_media_change, mlx5e_media_status); - speeds_num = ext ? MLX5E_EXT_LINK_SPEEDS_NUMBER : MLX5E_LINK_SPEEDS_NUMBER; - for (i = 0; i != speeds_num; i++) { - for (j = 0; j < MLX5E_LINK_MODES_NUMBER ; ++j) { - media_entry = ext ? mlx5e_ext_mode_table[i][j] : - mlx5e_mode_table[i][j]; - if (media_entry.baudrate == 0) + if (ext) { + for (unsigned i = 0; i != MLX5E_EXT_LINK_SPEEDS_NUMBER; i++) { + /* check if hardware has the right capability */ + if (MLX5E_PROT_MASK(i) & ~eth_proto_cap) continue; - if (MLX5E_PROT_MASK(i) & eth_proto_cap) + for (unsigned j = 0; j != MLX5E_CABLE_TYPE_NUMBER; j++) { + media_entry = mlx5e_ext_mode_table[i][j]; + if (media_entry.subtype == 0) + continue; + /* check if this subtype was already added */ + for (unsigned k = 0; k != i; k++) { + /* check if hardware has the right capability */ + if (MLX5E_PROT_MASK(k) & ~eth_proto_cap) + continue; + for (unsigned m = 0; m != MLX5E_CABLE_TYPE_NUMBER; m++) { + if (media_entry.subtype == mlx5e_ext_mode_table[k][m].subtype) + goto skip_ext_media; + } + } mlx5e_ifm_add(priv, media_entry.subtype); + skip_ext_media:; + } + } + } else { + for (unsigned i = 0; i != MLX5E_LINK_SPEEDS_NUMBER; i++) { + media_entry = mlx5e_mode_table[i]; + if (media_entry.subtype == 0) + continue; + if (MLX5E_PROT_MASK(i) & ~eth_proto_cap) + continue; + /* check if this subtype was already added */ + for (unsigned k = 0; k != i; k++) { + if (media_entry.subtype == mlx5e_mode_table[k].subtype) + goto skip_media; + } + mlx5e_ifm_add(priv, media_entry.subtype); + + /* NOTE: 10G ER and LR shares the same entry */ + if (media_entry.subtype == IFM_10G_ER) + mlx5e_ifm_add(priv, IFM_10G_LR); + skip_media:; } } diff --git a/sys/dev/mlx5/port.h b/sys/dev/mlx5/port.h index d46ae1303496..276ee12415d7 100644 --- a/sys/dev/mlx5/port.h +++ b/sys/dev/mlx5/port.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016-2018, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2016-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 @@ -108,7 +108,7 @@ enum mlx5e_link_speed { MLX5E_25GBASE_SR = 29, MLX5E_50GBASE_CR2 = 30, MLX5E_50GBASE_KR2 = 31, - MLX5E_LINK_SPEEDS_NUMBER, + MLX5E_LINK_SPEEDS_NUMBER = 32, }; enum mlx5e_ext_link_speed { @@ -122,78 +122,22 @@ enum mlx5e_ext_link_speed { MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR = 8, MLX5E_CAUI_4_100GBASE_CR4_KR4 = 9, MLX5E_100GAUI_2_100GBASE_CR2_KR2 = 10, + MLX5E_100GAUI_1_100GBASE_CR_KR = 11, MLX5E_200GAUI_4_200GBASE_CR4_KR4 = 12, + MLX5E_200GAUI_2_200GBASE_CR2_KR2 = 13, MLX5E_400GAUI_8 = 15, - MLX5E_EXT_LINK_SPEEDS_NUMBER, + MLX5E_400GAUI_4_400GBASE_CR4_KR4 = 16, + MLX5E_EXT_LINK_SPEEDS_NUMBER = 32, }; -enum mlx5e_link_mode { - MLX5E_ACC, - MLX5E_AOC, - MLX5E_AUI, - MLX5E_AUI_AC, - MLX5E_AUI2, - MLX5E_AUI2_AC, - MLX5E_AUI4, - MLX5E_AUI4_AC, - MLX5E_CAUI2, - MLX5E_CAUI2_AC, - MLX5E_CAUI4, - MLX5E_CAUI4_AC, - MLX5E_CP, - MLX5E_CP2, - MLX5E_CR, - MLX5E_CR_S, - MLX5E_CR1, - MLX5E_CR2, - MLX5E_CR4, - MLX5E_CR_PAM4, - MLX5E_CR4_PAM4, - MLX5E_CX4, - MLX5E_CX, - MLX5E_CX_SGMII, - MLX5E_DR, - MLX5E_DR4, - MLX5E_ER, - MLX5E_ER4, - MLX5E_FR, - MLX5E_FR4, - MLX5E_KR, - MLX5E_KR1, - MLX5E_KR_PAM4, - MLX5E_KR_S, - MLX5E_KR2, - MLX5E_KR2_PAM4, - MLX5E_KR4, - MLX5E_KR4_PAM4, - MLX5E_KX, - MLX5E_KX4, - MLX5E_LR, - MLX5E_LR2, - MLX5E_LR4, - MLX5E_LX, - MLX5E_R, - MLX5E_SGMII, - MLX5E_SR, - MLX5E_SR2, - MLX5E_SR4, - MLX5E_SX, - MLX5E_T, - MLX5E_TX, - MLX5E_LINK_MODES_NUMBER, -}; - -enum mlx5e_connector_type { - MLX5E_PORT_UNKNOWN = 0, - MLX5E_PORT_NONE = 1, - MLX5E_PORT_TP = 2, - MLX5E_PORT_AUI = 3, - MLX5E_PORT_BNC = 4, - MLX5E_PORT_MII = 5, - MLX5E_PORT_FIBRE = 6, - MLX5E_PORT_DA = 7, - MLX5E_PORT_OTHER = 8, - MLX5E_CONNECTOR_TYPE_NUMBER, +enum mlx5e_cable_type { + MLX5E_CABLE_TYPE_UNKNOWN = 0, + MLX5E_CABLE_TYPE_ACTIVE_CABLE = 1, + MLX5E_CABLE_TYPE_OPTICAL_MODULE = 2, + MLX5E_CABLE_TYPE_PASSIVE_COPPER = 3, + MLX5E_CABLE_TYPE_CABLE_UNPLUGGED = 4, + MLX5E_CABLE_TYPE_TWISTED_PAIR = 5, + MLX5E_CABLE_TYPE_NUMBER = 8, }; enum mlx5_qpts_trust_state { @@ -282,6 +226,7 @@ int mlx5_set_dscp2prio(struct mlx5_core_dev *mdev, const u8 *dscp2prio); int mlx5_query_dscp2prio(struct mlx5_core_dev *mdev, u8 *dscp2prio); int mlx5_query_pddr_range_info(struct mlx5_core_dev *mdev, u8 local_port, u8 *is_er_type); +int mlx5_query_pddr_cable_type(struct mlx5_core_dev *mdev, u8 local_port, u8 *cable_type); u32 mlx5e_port_ptys2speed(struct mlx5_core_dev *mdev, u32 eth_proto_oper); int mlx5e_port_linkspeed(struct mlx5_core_dev *mdev, u32 *speed); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DFB2465E879; Mon, 12 Jul 2021 13:09:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GNkcV5tJyz3R7X; Mon, 12 Jul 2021 13:09: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 94EA07557; Mon, 12 Jul 2021 13:09: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 16CD9E4r094520; Mon, 12 Jul 2021 13:09:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9ETL094519; Mon, 12 Jul 2021 13:09:14 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:14 GMT Message-Id: <202107121309.16CD9ETL094519@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: 626cb01d4439 - main - mlx5ib: Support RAW Ethernet when RoCE is disabled in mlx5ib(4) 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: 626cb01d4439b85eba9632a7738cddc64b6ad42d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:15 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=626cb01d4439b85eba9632a7738cddc64b6ad42d commit 626cb01d4439b85eba9632a7738cddc64b6ad42d Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:28 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:29 +0000 mlx5ib: Support RAW Ethernet when RoCE is disabled in mlx5ib(4) On some environments, such as certain SRIOV VF configurations, RoCE is not supported for mlx5 Ethernet ports. Currently, the driver will not open IB device on that port. This is problematic, since we do want user-space RAW Ethernet (RAW_PACKET QPs) functionality to remain in place. For that end, enhance the relevant driver flows such that we do create a device instance in that case. Linux commit: ca5b91d63192ceaa41a6145f8c923debb64c71fa MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index 68dddeb8f1f1..b97d40ca8b99 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -3018,6 +3018,8 @@ static int mlx5_port_immutable(struct ib_device *ibdev, u8 port_num, struct ib_port_immutable *immutable) { struct ib_port_attr attr; + struct mlx5_ib_dev *dev = to_mdev(ibdev); + enum rdma_link_layer ll = mlx5_ib_port_link_layer(ibdev, port_num); int err; err = mlx5_ib_query_port(ibdev, port_num, &attr); @@ -3027,7 +3029,8 @@ static int mlx5_port_immutable(struct ib_device *ibdev, u8 port_num, immutable->pkey_tbl_len = attr.pkey_tbl_len; immutable->gid_tbl_len = attr.gid_tbl_len; immutable->core_cap_flags = get_core_cap_flags(ibdev); - immutable->max_mad_size = IB_MGMT_MAD_SIZE; + if ((ll == IB_LINK_LAYER_INFINIBAND) || MLX5_CAP_GEN(dev->mdev, roce)) + immutable->max_mad_size = IB_MGMT_MAD_SIZE; return 0; } @@ -3089,9 +3092,11 @@ static int mlx5_enable_roce(struct mlx5_ib_dev *dev) return err; } - err = mlx5_nic_vport_enable_roce(dev->mdev); - if (err) - goto err_unregister_netdevice_notifier; + if (MLX5_CAP_GEN(dev->mdev, roce)) { + err = mlx5_nic_vport_enable_roce(dev->mdev); + if (err) + goto err_unregister_netdevice_notifier; + } err = mlx5_roce_lag_init(dev); if (err) @@ -3100,7 +3105,8 @@ static int mlx5_enable_roce(struct mlx5_ib_dev *dev) return 0; err_disable_roce: - mlx5_nic_vport_disable_roce(dev->mdev); + if (MLX5_CAP_GEN(dev->mdev, roce)) + mlx5_nic_vport_disable_roce(dev->mdev); err_unregister_netdevice_notifier: mlx5_remove_roce_notifier(dev); @@ -3110,7 +3116,8 @@ err_unregister_netdevice_notifier: static void mlx5_disable_roce(struct mlx5_ib_dev *dev) { mlx5_roce_lag_cleanup(dev); - mlx5_nic_vport_disable_roce(dev->mdev); + if (MLX5_CAP_GEN(dev->mdev, roce)) + mlx5_nic_vport_disable_roce(dev->mdev); } static void mlx5_ib_dealloc_q_port_counter(struct mlx5_ib_dev *dev, u8 port_num) @@ -3268,9 +3275,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) port_type_cap = MLX5_CAP_GEN(mdev, port_type); ll = mlx5_port_type_cap_to_rdma_ll(port_type_cap); - if ((ll == IB_LINK_LAYER_ETHERNET) && !MLX5_CAP_GEN(mdev, roce)) - return NULL; - dev = (struct mlx5_ib_dev *)ib_alloc_device(sizeof(*dev)); if (!dev) return NULL; From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 35E5165E93B; Mon, 12 Jul 2021 13:09: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 4GNkcW5t2zz3RJg; Mon, 12 Jul 2021 13:09: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 AB87072DA; Mon, 12 Jul 2021 13:09: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 16CD9Ffv094549; Mon, 12 Jul 2021 13:09:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9FxH094548; Mon, 12 Jul 2021 13:09:15 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:15 GMT Message-Id: <202107121309.16CD9FxH094548@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: 4f4739a77b0e - main - mlx5en: Add more error checks in the transmit path. 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: 4f4739a77b0e69dae57fd1687926d6e48a698fe4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:16 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=4f4739a77b0e69dae57fd1687926d6e48a698fe4 commit 4f4739a77b0e69dae57fd1687926d6e48a698fe4 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:29 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:29 +0000 mlx5en: Add more error checks in the transmit path. - Upon error more completion events than requested may be generated, particularly when using the completion event factor feature. - Count number of event errors in the transmit path. MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/device.h | 5 +++++ sys/dev/mlx5/mlx5_en/en.h | 1 + sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 26 ++++++++++++++++++++++---- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/sys/dev/mlx5/device.h b/sys/dev/mlx5/device.h index 64d4ed87d58f..e59fb6771d83 100644 --- a/sys/dev/mlx5/device.h +++ b/sys/dev/mlx5/device.h @@ -692,6 +692,11 @@ struct mlx5_cqe64 { #define MLX5_CQE_TSTMP_PTP (1ULL << 63) +static inline u8 get_cqe_opcode(struct mlx5_cqe64 *cqe) +{ + return (cqe->op_own >> 4); +} + static inline bool get_cqe_lro_timestamp_valid(struct mlx5_cqe64 *cqe) { return (cqe->lro_tcppsh_abort_dupack >> 7) & 1; diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index e4b66bea8f60..b249a82d30ef 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -627,6 +627,7 @@ struct mlx5e_rq_stats { m(+1, u64, defragged, "defragged", "Transmitted packets") \ m(+1, u64, dropped, "dropped", "Transmitted packets") \ m(+1, u64, enobuf, "enobuf", "Transmitted packets") \ + m(+1, u64, cqe_err, "cqe_err", "Transmit CQE errors") \ m(+1, u64, nop, "nop", "Transmitted packets") #define MLX5E_SQ_STATS_NUM (0 MLX5E_SQ_STATS(MLX5E_STATS_COUNT)) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index 437910ee7964..753b7ea20e5b 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -1038,6 +1038,9 @@ mlx5e_poll_tx_cq(struct mlx5e_sq *sq, int budget) while (budget > 0) { struct mlx5_cqe64 *cqe; struct mbuf *mb; + bool match; + u16 sqcc_this; + u16 delta; u16 x; u16 ci; @@ -1047,11 +1050,28 @@ mlx5e_poll_tx_cq(struct mlx5e_sq *sq, int budget) mlx5_cqwq_pop(&sq->cq.wq); + /* check if the completion event indicates an error */ + if (unlikely(get_cqe_opcode(cqe) != MLX5_CQE_REQ)) + sq->stats.cqe_err++; + + /* setup local variables */ + sqcc_this = be16toh(cqe->wqe_counter); + match = false; + /* update budget according to the event factor */ budget -= sq->cev_factor; - for (x = 0; x != sq->cev_factor; x++) { + for (x = 0;; x++) { + if (unlikely(match != false)) { + break; + } else if (unlikely(x == sq->cev_factor)) { + /* WQE counter match not found */ + sq->stats.cqe_err++; + break; + } ci = sqcc & sq->wq.sz_m1; + delta = sqcc_this - sqcc; + match = (delta < sq->mbuf[ci].num_wqebbs); mb = sq->mbuf[ci].mbuf; sq->mbuf[ci].mbuf = NULL; @@ -1061,10 +1081,8 @@ mlx5e_poll_tx_cq(struct mlx5e_sq *sq, int budget) } if (mb == NULL) { - if (sq->mbuf[ci].num_bytes == 0) { - /* NOP */ + if (unlikely(sq->mbuf[ci].num_bytes == 0)) sq->stats.nop++; - } } else { bus_dmamap_sync(sq->dma_tag, sq->mbuf[ci].dma_map, BUS_DMASYNC_POSTWRITE); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9BFFC65EC81; Mon, 12 Jul 2021 13:09: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 4GNkcY08nwz3Qxb; Mon, 12 Jul 2021 13:09: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 D00DD73B5; Mon, 12 Jul 2021 13:09: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 16CD9GUg094573; Mon, 12 Jul 2021 13:09:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9GeB094572; Mon, 12 Jul 2021 13:09:16 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:16 GMT Message-Id: <202107121309.16CD9GeB094572@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: 21bc3710a4b4 - main - mlx5ib: Simplify mlx5_ib_cont_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: 21bc3710a4b46655067cbad54d1f21952c871dd2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:17 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=21bc3710a4b46655067cbad54d1f21952c871dd2 commit 21bc3710a4b46655067cbad54d1f21952c871dd2 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:30 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:29 +0000 mlx5ib: Simplify mlx5_ib_cont_pages() The patch simplifies mlx5_ib_cont_pages and fixes the following issues in the original implementation: First issues is related to alignment of the PFNs. After the check base + p != PFN, the alignment of the PFN wasn't checked. So the PFN sequence 0, 1, 1, 2 would result in a page_shift of 13 even though the 3rd PFN is not 8KB aligned. This wasn't actually a bug because it was supported by all the existing mlx5 compatible device, but we don't want to require this support in all future devices. Another issue is because the inner loop didn't advance PFN so the test "if (base + p != pfn)" always failed for SGE with len > (1<page_size); - - /* With ODP we must always match OS page size. */ - if (umem->odp_data) { - *count = ib_umem_page_count(umem); - *shift = PAGE_SHIFT; - *ncont = *count; - if (order) - *order = ilog2(roundup_pow_of_two(*count)); - - return; - } - addr = addr >> page_shift; + addr = addr >> PAGE_SHIFT; tmp = (unsigned long)addr; m = find_first_bit(&tmp, BITS_PER_LONG); - skip = 1 << m; - mask = skip - 1; - i = 0; + for_each_sg(umem->sg_head.sgl, sg, umem->nmap, entry) { - len = sg_dma_len(sg) >> page_shift; - pfn = sg_dma_address(sg) >> page_shift; - for (k = 0; k < len; k++) { - if (!(i & mask)) { - tmp = (unsigned long)pfn; - m = min_t(unsigned long, m, find_first_bit(&tmp, BITS_PER_LONG)); - skip = 1 << m; - mask = skip - 1; - base = pfn; - p = 0; - } else { - if (base + p != pfn) { - tmp = (unsigned long)p; - m = find_first_bit(&tmp, BITS_PER_LONG); - skip = 1 << m; - mask = skip - 1; - base = pfn; - p = 0; - } - } - p++; - i++; + len = sg_dma_len(sg) >> PAGE_SHIFT; + pfn = sg_dma_address(sg) >> PAGE_SHIFT; + if (base + p != pfn) { + /* If either the offset or the new + * base are unaligned update m + */ + tmp = (unsigned long)(pfn | p); + if (!IS_ALIGNED(tmp, 1 << m)) + m = find_first_bit(&tmp, BITS_PER_LONG); + + base = pfn; + p = 0; } + + p += len; + i += len; } if (i) { @@ -111,7 +86,7 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, *ncont = 0; } - *shift = page_shift + m; + *shift = PAGE_SHIFT + m; *count = i; } From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D29C65E66B; Mon, 12 Jul 2021 13:09: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 4GNkcZ1XNtz3RJm; Mon, 12 Jul 2021 13:09: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 F012C7558; Mon, 12 Jul 2021 13:09: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 16CD9H3P094597; Mon, 12 Jul 2021 13:09:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9HQV094596; Mon, 12 Jul 2021 13:09:17 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:17 GMT Message-Id: <202107121309.16CD9HQV094596@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: 565cb4e8cc5e - main - mlx5ib: Limit mkey page size to 2GB 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: 565cb4e8cc5efb4c493efe5cf2cb2ec36f69a413 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:18 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=565cb4e8cc5efb4c493efe5cf2cb2ec36f69a413 commit 565cb4e8cc5efb4c493efe5cf2cb2ec36f69a413 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:31 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:29 +0000 mlx5ib: Limit mkey page size to 2GB The maximum page size in the mkey context is 2GB. Until today, we didn't enforce this requirement in the code, and therefore, if we got a page size larger than 2GB, we have passed zeros in the log_page_shift instead of the actual value and the registration failed. This patch limits the driver to use compound pages of 2GB for mkeys. Linux commit: 762f899ae7875554284af92b821be8c083227092 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 6 +++++- sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c | 4 ++-- sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c | 7 ++++++- sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c | 2 +- sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c | 4 ++-- sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c | 2 +- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index 0420b294de80..fcb1e584fcca 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -59,6 +59,8 @@ pr_warn("%s: WARN: %s:%d:(pid %d): " format, (dev)->ib_dev.name, __func__, \ #define MLX5_IB_DEFAULT_UIDX 0xffffff #define MLX5_USER_ASSIGNED_UIDX_MASK __mlx5_mask(qpc, user_index) +#define MLX5_MKEY_PAGE_SHIFT_MASK __mlx5_mask(mkc, log_page_size) + enum { MLX5_IB_MMAP_CMD_SHIFT = 8, MLX5_IB_MMAP_CMD_MASK = 0xff, @@ -909,7 +911,9 @@ int mlx5_ib_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr *props); int mlx5_ib_init_fmr(struct mlx5_ib_dev *dev); void mlx5_ib_cleanup_fmr(struct mlx5_ib_dev *dev); -void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, +void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, + unsigned long max_page_shift, + int *count, int *shift, int *ncont, int *order); void __mlx5_ib_populate_pas(struct mlx5_ib_dev *dev, struct ib_umem *umem, int page_shift, size_t offset, size_t num_pages, diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c index 15c33fdee440..3c37df82199f 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c @@ -781,7 +781,7 @@ static int create_cq_user(struct mlx5_ib_dev *dev, struct ib_udata *udata, if (err) goto err_umem; - mlx5_ib_cont_pages(cq->buf.umem, ucmd.buf_addr, &npages, &page_shift, + mlx5_ib_cont_pages(cq->buf.umem, ucmd.buf_addr, 0, &npages, &page_shift, &ncont, NULL); mlx5_ib_dbg(dev, "addr 0x%llx, size %u, npages %d, page_shift %d, ncont %d\n", (long long)ucmd.buf_addr, entries * ucmd.cqe_size, npages, page_shift, ncont); @@ -1148,7 +1148,7 @@ static int resize_user(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq, return err; } - mlx5_ib_cont_pages(umem, ucmd.buf_addr, &npages, page_shift, + mlx5_ib_cont_pages(umem, ucmd.buf_addr, 0, &npages, page_shift, npas, NULL); cq->resize_umem = umem; diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c index 97d9d33603d6..b780fd2f72fd 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c @@ -32,12 +32,15 @@ /* @umem: umem object to scan * @addr: ib virtual address requested by the user + * @max_page_shift: high limit for page_shift - 0 means no limit * @count: number of PAGE_SIZE pages covered by umem * @shift: page shift for the compound pages found in the region * @ncont: number of compund pages * @order: log2 of the number of compound pages */ -void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, +void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, + unsigned long max_page_shift, + int *count, int *shift, int *ncont, int *order) { unsigned long tmp; @@ -51,6 +54,8 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, addr = addr >> PAGE_SHIFT; tmp = (unsigned long)addr; m = find_first_bit(&tmp, BITS_PER_LONG); + if (max_page_shift) + m = min_t(unsigned long, max_page_shift - PAGE_SHIFT, m); for_each_sg(umem->sg_head.sgl, sg, umem->nmap, entry) { len = sg_dma_len(sg) >> PAGE_SHIFT; diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c index 5df7aed9dc1c..585e52d35d3b 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c @@ -637,7 +637,7 @@ static struct ib_umem *mr_umem_get(struct ib_pd *pd, u64 start, u64 length, return (void *)umem; } - mlx5_ib_cont_pages(umem, start, npages, page_shift, ncont, order); + mlx5_ib_cont_pages(umem, start, MLX5_MKEY_PAGE_SHIFT_MASK, npages, page_shift, ncont, order); if (!*npages) { mlx5_ib_warn(dev, "avoid zero region\n"); ib_umem_release(umem); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c index 94561d32acc1..bc17ee56c7d0 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c @@ -659,7 +659,7 @@ static int mlx5_ib_umem_get(struct mlx5_ib_dev *dev, return PTR_ERR(*umem); } - mlx5_ib_cont_pages(*umem, addr, npages, page_shift, ncont, NULL); + mlx5_ib_cont_pages(*umem, addr, 0, npages, page_shift, ncont, NULL); err = mlx5_ib_get_buf_offset(addr, *page_shift, offset); if (err) { @@ -712,7 +712,7 @@ static int create_user_rq(struct mlx5_ib_dev *dev, struct ib_pd *pd, return err; } - mlx5_ib_cont_pages(rwq->umem, ucmd->buf_addr, &npages, &page_shift, + mlx5_ib_cont_pages(rwq->umem, ucmd->buf_addr, 0, &npages, &page_shift, &ncont, NULL); err = mlx5_ib_get_buf_offset(ucmd->buf_addr, page_shift, &rwq->rq_page_offset); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c index 148b4c8f6d99..42e10f9a50de 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c @@ -113,7 +113,7 @@ static int create_srq_user(struct ib_pd *pd, struct mlx5_ib_srq *srq, return err; } - mlx5_ib_cont_pages(srq->umem, ucmd.buf_addr, &npages, + mlx5_ib_cont_pages(srq->umem, ucmd.buf_addr, 0, &npages, &page_shift, &ncont, NULL); err = mlx5_ib_get_buf_offset(ucmd.buf_addr, page_shift, &offset); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9866B65E66E; Mon, 12 Jul 2021 13: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 4GNkcb33Hbz3RBy; Mon, 12 Jul 2021 13: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 27D8B7559; Mon, 12 Jul 2021 13: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 16CD9JLY094621; Mon, 12 Jul 2021 13: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 16CD9JGH094620; Mon, 12 Jul 2021 13:09:19 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:19 GMT Message-Id: <202107121309.16CD9JGH094620@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: eafc89853835 - main - ipoib: Destroying a CQ should never fail. 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: eafc89853835147bcbd019a974ebfa9d3a8b00a7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:19 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=eafc89853835147bcbd019a974ebfa9d3a8b00a7 commit eafc89853835147bcbd019a974ebfa9d3a8b00a7 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:32 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:29 +0000 ipoib: Destroying a CQ should never fail. Remove not needed error handling when destroying a CQ. The function in question will later on be updated to return "void". MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c index c459b3fb55a7..35fd7875b77d 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c @@ -254,11 +254,9 @@ void ipoib_transport_dev_cleanup(struct ipoib_dev_priv *priv) clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); } - if (ib_destroy_cq(priv->send_cq)) - ipoib_warn(priv, "ib_cq_destroy (send) failed\n"); + ib_destroy_cq(priv->send_cq); - if (ib_destroy_cq(priv->recv_cq)) - ipoib_warn(priv, "ib_cq_destroy (recv) failed\n"); + ib_destroy_cq(priv->recv_cq); ipoib_cm_dev_cleanup(priv); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A16F465EC82; Mon, 12 Jul 2021 13: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 4GNkcc3BDwz3R6J; Mon, 12 Jul 2021 13: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 43E7E7689; Mon, 12 Jul 2021 13: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 16CD9KH5094645; Mon, 12 Jul 2021 13: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 16CD9KVR094644; Mon, 12 Jul 2021 13:09:20 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:20 GMT Message-Id: <202107121309.16CD9KVR094644@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: 315627b7191d - main - ibcore: Remove unused and erroneous msg sequence encoding. 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: 315627b7191dd4fe30a9293609feaf7eeb62e478 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:20 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=315627b7191dd4fe30a9293609feaf7eeb62e478 commit 315627b7191dd4fe30a9293609feaf7eeb62e478 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:33 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:29 +0000 ibcore: Remove unused and erroneous msg sequence encoding. In cm_form_tid(), a two bit message sequence number is OR'ed into bit 31-30 of the lower TID value. After Linux commit f06d26537559 ("IB/cm: Randomize starting comm ID"), the local_id is XOR'ed with a 32-bit random value. Hence, bit 31-30 in the lower TID now has an arbitrarily value and it makes no sense to OR in the message sequence number. Adding to that, the evolution in use of IDR routines in cm_alloc_id() has always had the possibility of returning a value with bit 30 set. In addition, said bits are never checked. Hence, remove the encoding and the corresponding enum. Linux commit: 87a37ce9e400e40daee537ff95343e3c94743c6d MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/cm_msgs.h | 7 ------- sys/ofed/drivers/infiniband/core/ib_cm.c | 14 ++++++-------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/cm_msgs.h b/sys/ofed/drivers/infiniband/core/cm_msgs.h index 9b8ef9a93d5b..fa88aa711aa3 100644 --- a/sys/ofed/drivers/infiniband/core/cm_msgs.h +++ b/sys/ofed/drivers/infiniband/core/cm_msgs.h @@ -49,13 +49,6 @@ #define IB_CM_CLASS_VERSION 2 /* IB specification 1.2 */ -enum cm_msg_sequence { - CM_MSG_SEQUENCE_REQ, - CM_MSG_SEQUENCE_LAP, - CM_MSG_SEQUENCE_DREQ, - CM_MSG_SEQUENCE_SIDR -}; - struct cm_req_msg { struct ib_mad_hdr hdr; diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 95b442eb0dd1..5d0229f57260 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -1130,14 +1130,12 @@ new_id: } EXPORT_SYMBOL(ib_cm_insert_listen); -static __be64 cm_form_tid(struct cm_id_private *cm_id_priv, - enum cm_msg_sequence msg_seq) +static __be64 cm_form_tid(struct cm_id_private *cm_id_priv) { u64 hi_tid, low_tid; hi_tid = ((u64) cm_id_priv->av.port->mad_agent->hi_tid) << 32; - low_tid = (u64) ((__force u32)cm_id_priv->id.local_id | - (msg_seq << 30)); + low_tid = (u64)cm_id_priv->id.local_id; return cpu_to_be64(hi_tid | low_tid); } @@ -1160,7 +1158,7 @@ static void cm_format_req(struct cm_req_msg *req_msg, struct ib_sa_path_rec *alt_path = param->alternate_path; cm_format_mad_hdr(&req_msg->hdr, CM_REQ_ATTR_ID, - cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_REQ)); + cm_form_tid(cm_id_priv)); req_msg->local_comm_id = cm_id_priv->id.local_id; req_msg->service_id = param->service_id; @@ -2171,7 +2169,7 @@ static void cm_format_dreq(struct cm_dreq_msg *dreq_msg, u8 private_data_len) { cm_format_mad_hdr(&dreq_msg->hdr, CM_DREQ_ATTR_ID, - cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_DREQ)); + cm_form_tid(cm_id_priv)); dreq_msg->local_comm_id = cm_id_priv->id.local_id; dreq_msg->remote_comm_id = cm_id_priv->id.remote_id; cm_dreq_set_remote_qpn(dreq_msg, cm_id_priv->remote_qpn); @@ -2775,7 +2773,7 @@ static void cm_format_lap(struct cm_lap_msg *lap_msg, u8 private_data_len) { cm_format_mad_hdr(&lap_msg->hdr, CM_LAP_ATTR_ID, - cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_LAP)); + cm_form_tid(cm_id_priv)); lap_msg->local_comm_id = cm_id_priv->id.local_id; lap_msg->remote_comm_id = cm_id_priv->id.remote_id; cm_lap_set_remote_qpn(lap_msg, cm_id_priv->remote_qpn); @@ -3110,7 +3108,7 @@ static void cm_format_sidr_req(struct cm_sidr_req_msg *sidr_req_msg, struct ib_cm_sidr_req_param *param) { cm_format_mad_hdr(&sidr_req_msg->hdr, CM_SIDR_REQ_ATTR_ID, - cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_SIDR)); + cm_form_tid(cm_id_priv)); sidr_req_msg->request_id = cm_id_priv->id.local_id; sidr_req_msg->pkey = param->path->pkey; sidr_req_msg->service_id = param->service_id; From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7F6B65E67F; Mon, 12 Jul 2021 13:09: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 4GNkcd51wFz3Qxm; Mon, 12 Jul 2021 13: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 6CC3D71CA; Mon, 12 Jul 2021 13: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 16CD9LQH094675; Mon, 12 Jul 2021 13: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 16CD9LKR094674; Mon, 12 Jul 2021 13:09:21 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:21 GMT Message-Id: <202107121309.16CD9LKR094674@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: cf88b86e4954 - main - mlx5ib: Fix XRC QP support after introducing extended atomic. 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: cf88b86e4954215eb447729042dab8dea722c044 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:21 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=cf88b86e4954215eb447729042dab8dea722c044 commit cf88b86e4954215eb447729042dab8dea722c044 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:33 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:30 +0000 mlx5ib: Fix XRC QP support after introducing extended atomic. Extended atomics are supported with RC and XRC QP types, but Linux commit a60109dc9a95 added an unneeded check to to_mlx5_access_flags(). This broke XRC QPs. The following ib_atomic_bw invocation over XRC reproduces the issue: ib_atomic_bw -d mlx5_1 --connection=XRC --atomic_type=FETCH_AND_ADD It is safe to remove such checks because the QP type was already checked in ib_modify_qp_is_ok(), which was previously called from mlx5_ib_modify_qp(). Linux commit: 13f8d9c16693afb908ead3d2a758adbe6a79eccd MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 2 + sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c | 85 ++++++++++++++++++++++++++++++++++----- 2 files changed, 78 insertions(+), 9 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index fcb1e584fcca..44a9aa307be7 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -207,6 +207,8 @@ struct mlx5_ib_flow_db { * creates the actual hardware QP. */ #define MLX5_IB_QPT_HW_GSI IB_QPT_RESERVED2 +#define MLX5_IB_QPT_DCI IB_QPT_RESERVED3 +#define MLX5_IB_QPT_DCT IB_QPT_RESERVED4 #define MLX5_IB_WR_UMR IB_WR_RESERVED1 /* Private QP creation flags to be passed in ib_qp_init_attr.create_flags. diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c index bc17ee56c7d0..8f05b32a3261 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c @@ -1504,6 +1504,53 @@ err: return err; } +static int atomic_size_to_mode(int size_mask) +{ + /* driver does not support atomic_size > 256B + * and does not know how to translate bigger sizes + */ + int supported_size_mask = size_mask & 0x1ff; + int log_max_size; + + if (!supported_size_mask) + return -EOPNOTSUPP; + + log_max_size = __fls(supported_size_mask); + + if (log_max_size > 3) + return log_max_size; + + return MLX5_ATOMIC_MODE_8B; +} + +static int get_atomic_mode(struct mlx5_ib_dev *dev, + enum ib_qp_type qp_type) +{ + u8 atomic_operations = MLX5_CAP_ATOMIC(dev->mdev, atomic_operations); + u8 atomic = MLX5_CAP_GEN(dev->mdev, atomic); + int atomic_mode = -EOPNOTSUPP; + int atomic_size_mask; + + if (!atomic) + return -EOPNOTSUPP; + + if (qp_type == MLX5_IB_QPT_DCT) + atomic_size_mask = MLX5_CAP_ATOMIC(dev->mdev, atomic_size_dc); + else + atomic_size_mask = MLX5_CAP_ATOMIC(dev->mdev, atomic_size_qp); + + if ((atomic_operations & MLX5_ATOMIC_OPS_MASKED_CMP_SWAP) || + (atomic_operations & MLX5_ATOMIC_OPS_MASKED_FETCH_ADD)) + atomic_mode = atomic_size_to_mode(atomic_size_mask); + + if (atomic_mode <= 0 && + (atomic_operations & MLX5_ATOMIC_OPS_CMP_SWAP && + atomic_operations & MLX5_ATOMIC_OPS_FETCH_ADD)) + atomic_mode = MLX5_ATOMIC_MODE_IB_COMP; + + return atomic_mode; +} + static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, struct ib_qp_init_attr *init_attr, struct ib_udata *udata, struct mlx5_ib_qp *qp) @@ -2119,12 +2166,14 @@ int mlx5_ib_destroy_qp(struct ib_qp *qp) return 0; } -static __be32 to_mlx5_access_flags(struct mlx5_ib_qp *qp, const struct ib_qp_attr *attr, - int attr_mask) +static int to_mlx5_access_flags(struct mlx5_ib_qp *qp, + const struct ib_qp_attr *attr, + int attr_mask, __be32 *hw_access_flags_be) { - u32 hw_access_flags = 0; u8 dest_rd_atomic; - u32 access_flags; + u32 access_flags, hw_access_flags = 0; + + struct mlx5_ib_dev *dev = to_mdev(qp->ibqp.device); if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC) dest_rd_atomic = attr->max_dest_rd_atomic; @@ -2141,12 +2190,23 @@ static __be32 to_mlx5_access_flags(struct mlx5_ib_qp *qp, const struct ib_qp_att if (access_flags & IB_ACCESS_REMOTE_READ) hw_access_flags |= MLX5_QP_BIT_RRE; - if (access_flags & IB_ACCESS_REMOTE_ATOMIC) - hw_access_flags |= (MLX5_QP_BIT_RAE | MLX5_ATOMIC_MODE_CX); + if (access_flags & IB_ACCESS_REMOTE_ATOMIC) { + int atomic_mode; + + atomic_mode = get_atomic_mode(dev, qp->ibqp.qp_type); + if (atomic_mode < 0) + return -EOPNOTSUPP; + + hw_access_flags |= MLX5_QP_BIT_RAE; + hw_access_flags |= atomic_mode << MLX5_ATOMIC_MODE_OFF; + } + if (access_flags & IB_ACCESS_REMOTE_WRITE) hw_access_flags |= MLX5_QP_BIT_RWE; - return cpu_to_be32(hw_access_flags); + *hw_access_flags_be = cpu_to_be32(hw_access_flags); + + return 0; } enum { @@ -2730,8 +2790,15 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp, cpu_to_be32(fls(attr->max_dest_rd_atomic - 1) << 21); } - if (attr_mask & (IB_QP_ACCESS_FLAGS | IB_QP_MAX_DEST_RD_ATOMIC)) - context->params2 |= to_mlx5_access_flags(qp, attr, attr_mask); + if (attr_mask & (IB_QP_ACCESS_FLAGS | IB_QP_MAX_DEST_RD_ATOMIC)) { + __be32 access_flags; + + err = to_mlx5_access_flags(qp, attr, attr_mask, &access_flags); + if (err) + goto out; + + context->params2 |= access_flags; + } if (attr_mask & IB_QP_MIN_RNR_TIMER) context->rnr_nextrecvpsn |= cpu_to_be32(attr->min_rnr_timer << 24); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E4E165ED27; Mon, 12 Jul 2021 13: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 4GNkcf5Y3Cz3RK8; Mon, 12 Jul 2021 13: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 907C271CB; Mon, 12 Jul 2021 13: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 16CD9M2Y094699; Mon, 12 Jul 2021 13: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 16CD9M92094698; Mon, 12 Jul 2021 13:09:22 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:22 GMT Message-Id: <202107121309.16CD9M92094698@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: e25bcf8d775c - main - ibcore: Add rdma_reject_msg() helper function. 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: e25bcf8d775c61e9bb67246545d2ee6717f4ca89 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:23 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=e25bcf8d775c61e9bb67246545d2ee6717f4ca89 commit e25bcf8d775c61e9bb67246545d2ee6717f4ca89 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:34 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:30 +0000 ibcore: Add rdma_reject_msg() helper function. rdma_reject_msg() returns a pointer to a string message associated with the transport reject reason codes. Linux commit: 77a5db13153906a7e00740b10b2730e53385c5a8 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_cm.c | 48 ++++++++++++++++++++++++++++++ sys/ofed/drivers/infiniband/core/ib_cma.c | 14 +++++++++ sys/ofed/drivers/infiniband/core/ib_iwcm.c | 21 +++++++++++++ sys/ofed/include/rdma/ib_cm.h | 6 ++++ sys/ofed/include/rdma/iw_cm.h | 6 ++++ sys/ofed/include/rdma/rdma_cm.h | 8 +++++ 6 files changed, 103 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 5d0229f57260..c0ee472c01a1 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -65,6 +65,54 @@ MODULE_AUTHOR("Sean Hefty"); MODULE_DESCRIPTION("InfiniBand CM"); MODULE_LICENSE("Dual BSD/GPL"); +static const char * const ibcm_rej_reason_strs[] = { + [IB_CM_REJ_NO_QP] = "no QP", + [IB_CM_REJ_NO_EEC] = "no EEC", + [IB_CM_REJ_NO_RESOURCES] = "no resources", + [IB_CM_REJ_TIMEOUT] = "timeout", + [IB_CM_REJ_UNSUPPORTED] = "unsupported", + [IB_CM_REJ_INVALID_COMM_ID] = "invalid comm ID", + [IB_CM_REJ_INVALID_COMM_INSTANCE] = "invalid comm instance", + [IB_CM_REJ_INVALID_SERVICE_ID] = "invalid service ID", + [IB_CM_REJ_INVALID_TRANSPORT_TYPE] = "invalid transport type", + [IB_CM_REJ_STALE_CONN] = "stale conn", + [IB_CM_REJ_RDC_NOT_EXIST] = "RDC not exist", + [IB_CM_REJ_INVALID_GID] = "invalid GID", + [IB_CM_REJ_INVALID_LID] = "invalid LID", + [IB_CM_REJ_INVALID_SL] = "invalid SL", + [IB_CM_REJ_INVALID_TRAFFIC_CLASS] = "invalid traffic class", + [IB_CM_REJ_INVALID_HOP_LIMIT] = "invalid hop limit", + [IB_CM_REJ_INVALID_PACKET_RATE] = "invalid packet rate", + [IB_CM_REJ_INVALID_ALT_GID] = "invalid alt GID", + [IB_CM_REJ_INVALID_ALT_LID] = "invalid alt LID", + [IB_CM_REJ_INVALID_ALT_SL] = "invalid alt SL", + [IB_CM_REJ_INVALID_ALT_TRAFFIC_CLASS] = "invalid alt traffic class", + [IB_CM_REJ_INVALID_ALT_HOP_LIMIT] = "invalid alt hop limit", + [IB_CM_REJ_INVALID_ALT_PACKET_RATE] = "invalid alt packet rate", + [IB_CM_REJ_PORT_CM_REDIRECT] = "port CM redirect", + [IB_CM_REJ_PORT_REDIRECT] = "port redirect", + [IB_CM_REJ_INVALID_MTU] = "invalid MTU", + [IB_CM_REJ_INSUFFICIENT_RESP_RESOURCES] = "insufficient resp resources", + [IB_CM_REJ_CONSUMER_DEFINED] = "consumer defined", + [IB_CM_REJ_INVALID_RNR_RETRY] = "invalid RNR retry", + [IB_CM_REJ_DUPLICATE_LOCAL_COMM_ID] = "duplicate local comm ID", + [IB_CM_REJ_INVALID_CLASS_VERSION] = "invalid class version", + [IB_CM_REJ_INVALID_FLOW_LABEL] = "invalid flow label", + [IB_CM_REJ_INVALID_ALT_FLOW_LABEL] = "invalid alt flow label", +}; + +const char *__attribute_const__ ibcm_reject_msg(int reason) +{ + size_t index = reason; + + if (index < ARRAY_SIZE(ibcm_rej_reason_strs) && + ibcm_rej_reason_strs[index]) + return ibcm_rej_reason_strs[index]; + else + return "unrecognized reason"; +} +EXPORT_SYMBOL(ibcm_reject_msg); + static void cm_add_one(struct ib_device *device); static void cm_remove_one(struct ib_device *device, void *client_data); diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c index 829d668dbd05..2639c61b94a4 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cma.c +++ b/sys/ofed/drivers/infiniband/core/ib_cma.c @@ -112,6 +112,20 @@ const char *__attribute_const__ rdma_event_msg(enum rdma_cm_event_type event) } EXPORT_SYMBOL(rdma_event_msg); +const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id, + int reason) +{ + if (rdma_ib_or_roce(id->device, id->port_num)) + return ibcm_reject_msg(reason); + + if (rdma_protocol_iwarp(id->device, id->port_num)) + return iwcm_reject_msg(reason); + + WARN_ON_ONCE(1); + return "unrecognized transport"; +} +EXPORT_SYMBOL(rdma_reject_msg); + static int cma_check_linklocal(struct rdma_dev_addr *, struct sockaddr *); static void cma_add_one(struct ib_device *device); static void cma_remove_one(struct ib_device *device, void *client_data); diff --git a/sys/ofed/drivers/infiniband/core/ib_iwcm.c b/sys/ofed/drivers/infiniband/core/ib_iwcm.c index a2abfec40668..6ac7b06569de 100644 --- a/sys/ofed/drivers/infiniband/core/ib_iwcm.c +++ b/sys/ofed/drivers/infiniband/core/ib_iwcm.c @@ -63,6 +63,27 @@ MODULE_AUTHOR("Tom Tucker"); MODULE_DESCRIPTION("iWARP CM"); MODULE_LICENSE("Dual BSD/GPL"); +static const char * const iwcm_rej_reason_strs[] = { + [ECONNRESET] = "reset by remote host", + [ECONNREFUSED] = "refused by remote application", + [ETIMEDOUT] = "setup timeout", +}; + +const char *__attribute_const__ iwcm_reject_msg(int reason) +{ + size_t index; + + /* iWARP uses negative errnos */ + index = -reason; + + if (index < ARRAY_SIZE(iwcm_rej_reason_strs) && + iwcm_rej_reason_strs[index]) + return iwcm_rej_reason_strs[index]; + else + return "unrecognized reason"; +} +EXPORT_SYMBOL(iwcm_reject_msg); + static struct workqueue_struct *iwcm_wq; struct iwcm_work { struct work_struct work; diff --git a/sys/ofed/include/rdma/ib_cm.h b/sys/ofed/include/rdma/ib_cm.h index 8806494766f6..8333b73f1f41 100644 --- a/sys/ofed/include/rdma/ib_cm.h +++ b/sys/ofed/include/rdma/ib_cm.h @@ -622,4 +622,10 @@ struct ib_cm_sidr_rep_param { int ib_send_cm_sidr_rep(struct ib_cm_id *cm_id, struct ib_cm_sidr_rep_param *param); +/** + * ibcm_reject_msg - return a pointer to a reject message string. + * @reason: Value returned in the REJECT event status field. + */ +const char *__attribute_const__ ibcm_reject_msg(int reason); + #endif /* IB_CM_H */ diff --git a/sys/ofed/include/rdma/iw_cm.h b/sys/ofed/include/rdma/iw_cm.h index ddb12dfd9256..e9e118c9dea5 100644 --- a/sys/ofed/include/rdma/iw_cm.h +++ b/sys/ofed/include/rdma/iw_cm.h @@ -257,4 +257,10 @@ int iw_cm_disconnect(struct iw_cm_id *cm_id, int abrupt); int iw_cm_init_qp_attr(struct iw_cm_id *cm_id, struct ib_qp_attr *qp_attr, int *qp_attr_mask); +/** + * iwcm_reject_msg - return a pointer to a reject message string. + * @reason: Value returned in the REJECT event status field. + */ +const char *__attribute_const__ iwcm_reject_msg(int reason); + #endif /* IW_CM_H */ diff --git a/sys/ofed/include/rdma/rdma_cm.h b/sys/ofed/include/rdma/rdma_cm.h index 09fa5c084e36..b5ed43426969 100644 --- a/sys/ofed/include/rdma/rdma_cm.h +++ b/sys/ofed/include/rdma/rdma_cm.h @@ -392,4 +392,12 @@ int rdma_set_afonly(struct rdma_cm_id *id, int afonly); */ __be64 rdma_get_service_id(struct rdma_cm_id *id, struct sockaddr *addr); +/** + * rdma_reject_msg - return a pointer to a reject message string. + * @id: Communication identifier that received the REJECT event. + * @reason: Value returned in the REJECT event status field. + */ +const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id, + int reason); + #endif /* RDMA_CM_H */ From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38A4765EA91; Mon, 12 Jul 2021 13:09: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 4GNkcj0H7Lz3RGx; Mon, 12 Jul 2021 13:09: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 CDDFF73B6; Mon, 12 Jul 2021 13:09: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 16CD9OwL094747; Mon, 12 Jul 2021 13:09:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9OLj094746; Mon, 12 Jul 2021 13:09:24 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:24 GMT Message-Id: <202107121309.16CD9OLj094746@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: 0f2e5b432dcd - main - ibcore: Block processing of alternate path handling in RoCE RX CM messages. 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: 0f2e5b432dcdd19955285169f1603473219ac130 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:25 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=0f2e5b432dcdd19955285169f1603473219ac130 commit 0f2e5b432dcdd19955285169f1603473219ac130 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:35 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:30 +0000 ibcore: Block processing of alternate path handling in RoCE RX CM messages. Due to the below reasons, it is better to not support alternate path receive messages for RoCE in near term. 1. Alternate path for RoCE is not supported at rdmacm layer. 2. It is not supported in uverbs/core layer for RoCE. 3. Alternate path for IPv6 for link local address cannot resolve route determinstically without a valid incoming interface ID whose usecase make sense only with dual port mode. 4. init_av_from_path while processing LAP messages for IB and RoCE can lead to adding duplicate entry of AV into the port list, leads to list corruption. 5. rdma-core userspace a well known userspace implementation has removed support of libucm which use ucm.ko module, which is the only module that can trigger alternate path related messages. 6. ucm kernel module is requested to be removed from the IB core in the following patch, https://patchwork.kernel.org/patch/10268503/ . Linux commit: 97c45c2c28cd291e06778d9d36a0f60ee74726bc MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_cm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index a0bfa1cd41b4..6a809b18d301 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -2957,6 +2957,13 @@ static int cm_lap_handler(struct cm_work *work) struct ib_mad_send_buf *msg = NULL; int ret; + /* Currently Alternate path messages are not supported for + * RoCE link layer. + */ + if (rdma_protocol_roce(work->port->cm_dev->ib_device, + work->port->port_num)) + return -EINVAL; + /* todo: verify LAP request and send reject APR if invalid. */ lap_msg = (struct cm_lap_msg *)work->mad_recv_wc->recv_buf.mad; cm_id_priv = cm_acquire_id(lap_msg->remote_comm_id, @@ -3102,6 +3109,13 @@ static int cm_apr_handler(struct cm_work *work) struct cm_apr_msg *apr_msg; int ret; + /* Currently Alternate path messages are not supported for + * RoCE link layer. + */ + if (rdma_protocol_roce(work->port->cm_dev->ib_device, + work->port->port_num)) + return -EINVAL; + apr_msg = (struct cm_apr_msg *)work->mad_recv_wc->recv_buf.mad; cm_id_priv = cm_acquire_id(apr_msg->remote_comm_id, apr_msg->local_comm_id); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F31B965E94A; Mon, 12 Jul 2021 13:09: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 4GNkck0t3xz3gxk; Mon, 12 Jul 2021 13:09: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 F0A27755A; Mon, 12 Jul 2021 13:09: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 16CD9PlX094771; Mon, 12 Jul 2021 13:09:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9PFV094770; Mon, 12 Jul 2021 13:09:25 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:25 GMT Message-Id: <202107121309.16CD9PFV094770@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: 8d04583de542 - main - ibcore: Fix memory leak in cm_add/remove_one. 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: 8d04583de542dcd087b401f6b830b8e6ab43d696 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:27 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=8d04583de542dcd087b401f6b830b8e6ab43d696 commit 8d04583de542dcd087b401f6b830b8e6ab43d696 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:36 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:30 +0000 ibcore: Fix memory leak in cm_add/remove_one. In the process of moving the debug counters sysfs entries, the commit mentioned below eliminated the cm_infiniband sysfs directory. This sysfs directory was tied to the cm_port object allocated in procedure cm_add_one(). Before the commit below, this cm_port object was freed via a call to kobject_put(port->kobj) in procedure cm_remove_port_fs(). Since port no longer uses its kobj, kobject_put(port->kobj) was eliminated. This, however, meant that kfree was never called for the cm_port buffers. Fix this by adding explicit kfree(port) calls to functions cm_add_one() and cm_remove_one(). Note that the kfree call in the first chunk below, in the cm_add_one error flow, fixes an old, undetected memory leak. Linux commit: 94635c36f3854934a46d9e812e028d4721bbb0e6 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_cm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 6a809b18d301..5fb37e3245e8 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -4132,6 +4132,7 @@ error2: error1: port_modify.set_port_cap_mask = 0; port_modify.clr_port_cap_mask = IB_PORT_CM_SUP; + kfree(port); while (--i) { if (!rdma_cap_ib_cm(ib_device, i)) continue; @@ -4140,6 +4141,7 @@ error1: ib_modify_port(ib_device, port->port_num, 0, &port_modify); ib_unregister_mad_agent(port->mad_agent); cm_remove_port_fs(port); + kfree(port); } free: device_unregister(cm_dev->device); @@ -4194,6 +4196,7 @@ static void cm_remove_one(struct ib_device *ib_device, void *client_data) spin_unlock_irq(&cm.state_lock); ib_unregister_mad_agent(cur_mad_agent); cm_remove_port_fs(port); + kfree(port); } device_unregister(cm_dev->device); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CAA5D65ED31; Mon, 12 Jul 2021 13:09: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 4GNkcg6pvNz3RKD; Mon, 12 Jul 2021 13:09: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 AEB5872DB; Mon, 12 Jul 2021 13:09: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 16CD9NQd094723; Mon, 12 Jul 2021 13:09:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9Nhk094722; Mon, 12 Jul 2021 13:09:23 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:23 GMT Message-Id: <202107121309.16CD9Nhk094722@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: bf5075e41e6a - main - ibcore: Store and restore ah_attr during LAP msg processing. 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: bf5075e41e6a29232a1c5aef07e69b9173494187 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:25 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=bf5075e41e6a29232a1c5aef07e69b9173494187 commit bf5075e41e6a29232a1c5aef07e69b9173494187 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:35 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:30 +0000 ibcore: Store and restore ah_attr during LAP msg processing. During CM LAP processing, ah_attr is reinitialized on receiving a LAP request. First likely during CM request processing. ah_attr might get zeroed out if LAP processing fails. Therefore, try to create a new ah_attr for the LAP message. If the initialization fails, continue with older ah_attr. If the initialization passes, consider the new ah_attr by overwriting the older one. Linux commit: 0e225dcb7681c0a8e52fb9dc68bd8ab973de4ca2 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_cm.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index c0ee472c01a1..a0bfa1cd41b4 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -460,6 +460,32 @@ static void cm_set_private_data(struct cm_id_private *cm_id_priv, cm_id_priv->private_data_len = private_data_len; } +static int cm_init_av_for_lap(struct cm_port *port, struct ib_wc *wc, + struct ib_grh *grh, struct cm_av *av) +{ + struct ib_ah_attr new_ah_attr; + int ret; + + av->port = port; + av->pkey_index = wc->pkey_index; + + /* + * av->ah_attr might be initialized based on past wc during incoming + * connect request or while sending out connect request. So initialize + * a new ah_attr on stack. If initialization fails, old ah_attr is + * used for sending any responses. If initialization is successful, + * than new ah_attr is used by overwriting old one. + */ + ret = ib_init_ah_from_wc(port->cm_dev->ib_device, + port->port_num, wc, + grh, &new_ah_attr); + if (ret) + return ret; + + memcpy(&av->ah_attr, &new_ah_attr, sizeof(new_ah_attr)); + return 0; +} + static int cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc, struct ib_grh *grh, struct cm_av *av) { @@ -3253,9 +3279,9 @@ static int cm_sidr_req_handler(struct cm_work *work) wc = work->mad_recv_wc->wc; cm_id_priv->av.dgid.global.subnet_prefix = cpu_to_be64(wc->slid); cm_id_priv->av.dgid.global.interface_id = 0; - ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc, - work->mad_recv_wc->recv_buf.grh, - &cm_id_priv->av); + ret = cm_init_av_for_lap(work->port, work->mad_recv_wc->wc, + work->mad_recv_wc->recv_buf.grh, + &cm_id_priv->av); if (ret) goto out; cm_id_priv->id.remote_id = sidr_req_msg->request_id; From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4F1965E955; Mon, 12 Jul 2021 13:09: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 4GNkcl1nVVz3R3j; Mon, 12 Jul 2021 13:09: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 223DE755B; Mon, 12 Jul 2021 13:09: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 16CD9Rvw094801; Mon, 12 Jul 2021 13:09:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9RLJ094800; Mon, 12 Jul 2021 13:09:27 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:27 GMT Message-Id: <202107121309.16CD9RLJ094800@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: f48e85dfe2ec - main - ibcore: Move debug counters to be under relevant IB device 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: f48e85dfe2ece188eaf44ee6cb626de1f7ae65e9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:28 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=f48e85dfe2ece188eaf44ee6cb626de1f7ae65e9 commit f48e85dfe2ece188eaf44ee6cb626de1f7ae65e9 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:37 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:30 +0000 ibcore: Move debug counters to be under relevant IB device The sysfs layout is created by CM incorrectly presented RDMA devices with InfiniBand link layer. Layout of such devices represents device tree of connections. By moving CM statistics to be under relevant port of IB device, we will fix the following issues: * Symlink name - It used device name instead of specific identifier. * Target location - It was supposed to point to PCI-ID/infiniband_cm/ instead of PCI-ID/infiniband/ * Target name - It created extra device file under already existing device folder, e.g. mlx5_0/mlx5_0 * Crash during boot with RDMA persistent naming patches. sysfs: cannot create duplicate filename '/class/infiniband_cm/mlx5_0' CPU: 29 PID: 433 Comm: modprobe Not tainted 5.0.0-rc5+ #178 Call Trace: dump_stack+0xcc/0x180 sysfs_warn_dup.cold.3+0x17/0x2d sysfs_do_create_link_sd.isra.2+0xd0/0xf0 device_add+0x7cb/0x1450 device_create_groups_vargs+0x1ae/0x220 device_create+0x93/0xc0 cm_add_one+0x38f/0xf60 [ib_cm] add_client_context+0x167/0x210 [ib_core] enable_device_and_get+0x230/0x3f0 [ib_core] ib_register_device+0x823/0xbf0 [ib_core] __mlx5_ib_add+0x45/0x150 [mlx5_ib] mlx5_ib_add+0x1b3/0x5e0 [mlx5_ib] mlx5_add_device+0x130/0x3a0 [mlx5_core] mlx5_register_interface+0x1a9/0x270 [mlx5_core] do_one_initcall+0x14f/0x5de do_init_module+0x247/0x7c0 load_module+0x4c2f/0x60d0 entry_SYSCALL_64_after_hwframe+0x49/0xbe After this change: [leonro@server ~]$ ls -al /sys/class/infiniband/ibp0s12f0/ports/1/ drwxr-xr-x 2 root root 0 Mar 11 11:17 cm_rx_duplicates drwxr-xr-x 2 root root 0 Mar 11 11:17 cm_rx_msgs drwxr-xr-x 2 root root 0 Mar 11 11:17 cm_tx_msgs drwxr-xr-x 2 root root 0 Mar 11 11:17 cm_tx_retries Linux commit: c87e65cfb97c7f325132a68288ed76ba7bdcd2c6 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/core_priv.h | 5 +++ sys/ofed/drivers/infiniband/core/ib_cm.c | 46 +++++----------------------- sys/ofed/drivers/infiniband/core/ib_sysfs.c | 45 +++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 38 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/core_priv.h b/sys/ofed/drivers/infiniband/core/core_priv.h index 62772fc2a6c5..7fa8d0cfe0bb 100644 --- a/sys/ofed/drivers/infiniband/core/core_priv.h +++ b/sys/ofed/drivers/infiniband/core/core_priv.h @@ -137,4 +137,9 @@ void ib_mad_cleanup(void); int ib_sa_init(void); void ib_sa_cleanup(void); +int ib_port_register_module_stat(struct ib_device *device, u8 port_num, + struct kobject *kobj, struct kobj_type *ktype, + const char *name); +void ib_port_unregister_module_stat(struct kobject *kobj); + #endif /* _CORE_PRIV_H */ diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 5fb37e3245e8..1f96a733b042 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include "cm_msgs.h" +#include "core_priv.h" MODULE_AUTHOR("Sean Hefty"); MODULE_DESCRIPTION("InfiniBand CM"); @@ -227,7 +228,6 @@ struct cm_port { struct cm_device { struct list_head list; struct ib_device *ib_device; - struct device *device; u8 ack_delay; int going_down; struct cm_port *port[0]; @@ -3978,18 +3978,6 @@ static struct kobj_type cm_counter_obj_type = { .default_attrs = cm_counter_default_attrs }; -static void cm_release_port_obj(struct kobject *obj) -{ - struct cm_port *cm_port; - - cm_port = container_of(obj, struct cm_port, port_obj); - kfree(cm_port); -} - -static struct kobj_type cm_port_obj_type = { - .release = cm_release_port_obj -}; - static char *cm_devnode(struct device *dev, umode_t *mode) { if (mode) @@ -4008,19 +3996,12 @@ static int cm_create_port_fs(struct cm_port *port) { int i, ret; - ret = kobject_init_and_add(&port->port_obj, &cm_port_obj_type, - &port->cm_dev->device->kobj, - "%d", port->port_num); - if (ret) { - kfree(port); - return ret; - } - for (i = 0; i < CM_COUNTER_GROUPS; i++) { - ret = kobject_init_and_add(&port->counter_group[i].obj, - &cm_counter_obj_type, - &port->port_obj, - "%s", counter_group_names[i]); + ret = ib_port_register_module_stat(port->cm_dev->ib_device, + port->port_num, + &port->counter_group[i].obj, + &cm_counter_obj_type, + counter_group_names[i]); if (ret) goto error; } @@ -4029,8 +4010,7 @@ static int cm_create_port_fs(struct cm_port *port) error: while (i--) - kobject_put(&port->counter_group[i].obj); - kobject_put(&port->port_obj); + ib_port_unregister_module_stat(&port->counter_group[i].obj); return ret; } @@ -4040,9 +4020,8 @@ static void cm_remove_port_fs(struct cm_port *port) int i; for (i = 0; i < CM_COUNTER_GROUPS; i++) - kobject_put(&port->counter_group[i].obj); + ib_port_unregister_module_stat(&port->counter_group[i].obj); - kobject_put(&port->port_obj); } static void cm_add_one(struct ib_device *ib_device) @@ -4069,13 +4048,6 @@ static void cm_add_one(struct ib_device *ib_device) cm_dev->ib_device = ib_device; cm_dev->ack_delay = ib_device->attrs.local_ca_ack_delay; cm_dev->going_down = 0; - cm_dev->device = device_create(&cm_class, &ib_device->dev, - MKDEV(0, 0), NULL, - "%s", ib_device->name); - if (IS_ERR(cm_dev->device)) { - kfree(cm_dev); - return; - } set_bit(IB_MGMT_METHOD_SEND, reg_req.method_mask); for (i = 1; i <= ib_device->phys_port_cnt; i++) { @@ -4144,7 +4116,6 @@ error1: kfree(port); } free: - device_unregister(cm_dev->device); kfree(cm_dev); } @@ -4199,7 +4170,6 @@ static void cm_remove_one(struct ib_device *ib_device, void *client_data) kfree(port); } - device_unregister(cm_dev->device); kfree(cm_dev); } diff --git a/sys/ofed/drivers/infiniband/core/ib_sysfs.c b/sys/ofed/drivers/infiniband/core/ib_sysfs.c index fb9884a7ea08..d12b5803e722 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sysfs.c +++ b/sys/ofed/drivers/infiniband/core/ib_sysfs.c @@ -1336,3 +1336,48 @@ void ib_device_unregister_sysfs(struct ib_device *device) device_unregister(&device->dev); } + +/** + * ib_port_register_module_stat - add module counters under relevant port + * of IB device. + * + * @device: IB device to add counters + * @port_num: valid port number + * @kobj: pointer to the kobject to initialize + * @ktype: pointer to the ktype for this kobject. + * @name: the name of the kobject + */ +int ib_port_register_module_stat(struct ib_device *device, u8 port_num, + struct kobject *kobj, struct kobj_type *ktype, + const char *name) +{ + struct kobject *p, *t; + int ret; + + list_for_each_entry_safe(p, t, &device->port_list, entry) { + struct ib_port *port = container_of(p, struct ib_port, kobj); + + if (port->port_num != port_num) + continue; + + ret = kobject_init_and_add(kobj, ktype, &port->kobj, "%s", + name); + if (ret) { + kobject_put(kobj); + return ret; + } + } + + return 0; +} +EXPORT_SYMBOL(ib_port_register_module_stat); + +/** + * ib_port_unregister_module_stat - release module counters + * @kobj: pointer to the kobject to release + */ +void ib_port_unregister_module_stat(struct kobject *kobj) +{ + kobject_put(kobj); +} +EXPORT_SYMBOL(ib_port_unregister_module_stat); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5155B65ECA1; Mon, 12 Jul 2021 13:09: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 4GNkcn6mWrz3RKc; Mon, 12 Jul 2021 13:09: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 6E5BC768A; Mon, 12 Jul 2021 13:09: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 16CD9T4J094849; Mon, 12 Jul 2021 13:09:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9TmC094848; Mon, 12 Jul 2021 13:09:29 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:29 GMT Message-Id: <202107121309.16CD9TmC094848@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: 12a913d207d2 - main - ibcore: Issue DREQ when receiving REQ/REP for stale QP. 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: 12a913d207d287733da75784b3aa35f5e48d0cef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:30 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=12a913d207d287733da75784b3aa35f5e48d0cef commit 12a913d207d287733da75784b3aa35f5e48d0cef Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:38 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:30 +0000 ibcore: Issue DREQ when receiving REQ/REP for stale QP. From "InfiBand Architecture Specifications Volume 1": A QP is said to have a stale connection when only one side has connection information. A stale connection may result if the remote CM had dropped the connection and sent a DREQ but the DREQ was never received by the local CM. Alternatively the remote CM may have lost all record of past connections because its node crashed and rebooted, while the local CM did not become aware of the remote node's reboot and therefore did not clean up stale connections. And: A local CM may receive a REQ/REP for a stale connection. It shall abort the connection issuing REJ to the REQ/REP. It shall then issue DREQ with "DREQ:remote QPN" set to the remote QPN from the REQ/REP. This patch solves a problem with reuse of QPN. Current codebase, that is IPoIB, relies on a REAP-mechanism to do cleanup of the structures in CM. A problem with this is the timeconstants governing this mechanism; they are up to 768 seconds and the interface may look inresponsive in that period. Issuing a DREQ (and receiving a DREP) does the necessary cleanup and the interface comes up. Linux commit: 9315bc9a133011fdb084f2626b86db3ebb64661f MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_cm.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 7dea2620cb60..376dcb420f5b 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -1679,6 +1679,7 @@ static struct cm_id_private * cm_match_req(struct cm_work *work, struct cm_id_private *listen_cm_id_priv, *cur_cm_id_priv; struct cm_timewait_info *timewait_info; struct cm_req_msg *req_msg; + struct ib_cm_id *cm_id; req_msg = (struct cm_req_msg *)work->mad_recv_wc->recv_buf.mad; @@ -1700,10 +1701,18 @@ static struct cm_id_private * cm_match_req(struct cm_work *work, timewait_info = cm_insert_remote_qpn(cm_id_priv->timewait_info); if (timewait_info) { cm_cleanup_timewait(cm_id_priv->timewait_info); + cur_cm_id_priv = cm_get_id(timewait_info->work.local_id, + timewait_info->work.remote_id); + spin_unlock_irq(&cm.lock); cm_issue_rej(work->port, work->mad_recv_wc, IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REQ, NULL, 0); + if (cur_cm_id_priv) { + cm_id = &cur_cm_id_priv->id; + ib_send_cm_dreq(cm_id, NULL, 0); + cm_deref_id(cur_cm_id_priv); + } return NULL; } @@ -2084,6 +2093,9 @@ static int cm_rep_handler(struct cm_work *work) struct cm_id_private *cm_id_priv; struct cm_rep_msg *rep_msg; int ret; + struct cm_id_private *cur_cm_id_priv; + struct ib_cm_id *cm_id; + struct cm_timewait_info *timewait_info; rep_msg = (struct cm_rep_msg *)work->mad_recv_wc->recv_buf.mad; cm_id_priv = cm_acquire_id(rep_msg->remote_comm_id, 0); @@ -2118,16 +2130,26 @@ static int cm_rep_handler(struct cm_work *work) goto error; } /* Check for a stale connection. */ - if (cm_insert_remote_qpn(cm_id_priv->timewait_info)) { + timewait_info = cm_insert_remote_qpn(cm_id_priv->timewait_info); + if (timewait_info) { rb_erase(&cm_id_priv->timewait_info->remote_id_node, &cm.remote_id_table); cm_id_priv->timewait_info->inserted_remote_id = 0; + cur_cm_id_priv = cm_get_id(timewait_info->work.local_id, + timewait_info->work.remote_id); + spin_unlock(&cm.lock); spin_unlock_irq(&cm_id_priv->lock); cm_issue_rej(work->port, work->mad_recv_wc, IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REP, NULL, 0); ret = -EINVAL; + if (cur_cm_id_priv) { + cm_id = &cur_cm_id_priv->id; + ib_send_cm_dreq(cm_id, NULL, 0); + cm_deref_id(cur_cm_id_priv); + } + goto error; } spin_unlock(&cm.lock); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B772D65EDA9; Mon, 12 Jul 2021 13:09: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 4GNkcm3fBWz3h1L; Mon, 12 Jul 2021 13:09: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 49EDE72DC; Mon, 12 Jul 2021 13:09: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 16CD9SuQ094825; Mon, 12 Jul 2021 13:09:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9S2e094824; Mon, 12 Jul 2021 13:09:28 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:28 GMT Message-Id: <202107121309.16CD9S2e094824@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: 2f0541874858 - main - ibcore: Fix memory leak in cm_req_handler error flows. 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: 2f05418748585dcbd5912f335040f652a8cc9703 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:28 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=2f05418748585dcbd5912f335040f652a8cc9703 commit 2f05418748585dcbd5912f335040f652a8cc9703 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:37 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:30 +0000 ibcore: Fix memory leak in cm_req_handler error flows. In the cm_req_handler() error flows, sometimes cm_id_priv->timewait_info isn't free'd. Linux commit: 8b00914654ef56ff5473f4fe1f1168254dbb8a17 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_cm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 1f96a733b042..7dea2620cb60 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -1790,8 +1790,7 @@ static int cm_req_handler(struct cm_work *work) listen_cm_id_priv = cm_match_req(work, cm_id_priv); if (!listen_cm_id_priv) { ret = -EINVAL; - kfree(cm_id_priv->timewait_info); - goto destroy; + goto free_timeinfo; } cm_id_priv->id.cm_handler = listen_cm_id_priv->id.cm_handler; @@ -1866,6 +1865,8 @@ static int cm_req_handler(struct cm_work *work) rejected: atomic_dec(&cm_id_priv->refcount); cm_deref_id(listen_cm_id_priv); +free_timeinfo: + kfree(cm_id_priv->timewait_info); destroy: ib_destroy_cm_id(cm_id); return ret; From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8F8365ED53; Mon, 12 Jul 2021 13:09: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 4GNkcp68Gnz3R8Z; Mon, 12 Jul 2021 13:09: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 8DC8273B7; Mon, 12 Jul 2021 13:09: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 16CD9U7k094873; Mon, 12 Jul 2021 13:09:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9U2d094872; Mon, 12 Jul 2021 13:09:30 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:30 GMT Message-Id: <202107121309.16CD9U2d094872@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: d7d833e20ba3 - main - ibcore: Fix unable to change lifespan entry for hw_counters. 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: d7d833e20ba33f5b9f3052a534af7ecdd602f152 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:32 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=d7d833e20ba33f5b9f3052a534af7ecdd602f152 commit d7d833e20ba33f5b9f3052a534af7ecdd602f152 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:39 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:30 +0000 ibcore: Fix unable to change lifespan entry for hw_counters. This patch fixes the case where 'lifespan' entry of the hw_counters is not writable. Currently write callback is not exposed for for the hw_counters sysfs operation. Due to this, modifying lifespan value results into permission denied error in below example. echo 10 > /sys/class/infiniband/mlx5_0/ports/1/hw_counters/lifespan -bash: /sys/class/infiniband/mlx5_0/ports/1/hw_counters/lifespan: Permission denied This patch adds the hook to modify any attribute which implements store() operation. Linux commit: 79c4d80b43b8e43684894574a508a871f0c196bf MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_sysfs.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_sysfs.c b/sys/ofed/drivers/infiniband/core/ib_sysfs.c index d12b5803e722..55e7b5395b8e 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sysfs.c +++ b/sys/ofed/drivers/infiniband/core/ib_sysfs.c @@ -114,8 +114,22 @@ static ssize_t port_attr_show(struct kobject *kobj, return port_attr->show(p, port_attr, buf); } +static ssize_t port_attr_store(struct kobject *kobj, + struct attribute *attr, + const char *buf, size_t count) +{ + struct port_attribute *port_attr = + container_of(attr, struct port_attribute, attr); + struct ib_port *p = container_of(kobj, struct ib_port, kobj); + + if (!port_attr->store) + return -EIO; + return port_attr->store(p, port_attr, buf, count); +} + static const struct sysfs_ops port_sysfs_ops = { - .show = port_attr_show + .show = port_attr_show, + .store = port_attr_store }; static ssize_t gid_attr_show(struct kobject *kobj, From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 12B5A65EAAF; Mon, 12 Jul 2021 13:09: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 4GNkcs2Bsqz3R3y; Mon, 12 Jul 2021 13:09: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 D300171CC; Mon, 12 Jul 2021 13:09: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 16CD9WiO094927; Mon, 12 Jul 2021 13:09:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9WYm094926; Mon, 12 Jul 2021 13:09:32 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:32 GMT Message-Id: <202107121309.16CD9WYm094926@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: ac4174e064f4 - main - ibcore: Do not expose unsupported counters. 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: ac4174e064f447ed3b19a8b395625b7d2b3739d1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:34 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=ac4174e064f447ed3b19a8b395625b7d2b3739d1 commit ac4174e064f447ed3b19a8b395625b7d2b3739d1 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:40 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:31 +0000 ibcore: Do not expose unsupported counters. If the provider driver (such as rdma_rxe) doesn't support PMA counters, avoid exposing its directory similar to optional hw_counters directory. If core fails to read the PMA counter, return an error so that user can retry later if needed. Linux commit: 0f6ef65d1c6ec8deb5d0f11f86631ec4cfe8f22e MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_sysfs.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_sysfs.c b/sys/ofed/drivers/infiniband/core/ib_sysfs.c index 64ef4c4aefdb..c393bb64a034 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sysfs.c +++ b/sys/ofed/drivers/infiniband/core/ib_sysfs.c @@ -520,7 +520,7 @@ static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr, ret = get_perf_mad(p->ibdev, p->port_num, tab_attr->attr_id, &data, 40 + offset / 8, sizeof(data)); if (ret < 0) - return sprintf(buf, "N/A (no PMA)\n"); + return ret; switch (width) { case 4: @@ -1043,10 +1043,12 @@ static int add_port(struct ib_device *device, int port_num, goto err_put; } - p->pma_table = get_counter_table(device, port_num); - ret = sysfs_create_group(&p->kobj, p->pma_table); - if (ret) - goto err_put_gid_attrs; + if (device->process_mad) { + p->pma_table = get_counter_table(device, port_num); + ret = sysfs_create_group(&p->kobj, p->pma_table); + if (ret) + goto err_put_gid_attrs; + } p->gid_group.name = "gids"; p->gid_group.attrs = alloc_group_attrs(show_port_gid, attr.gid_tbl_len); @@ -1158,7 +1160,8 @@ err_free_gid: p->gid_group.attrs = NULL; err_remove_pma: - sysfs_remove_group(&p->kobj, p->pma_table); + if (p->pma_table) + sysfs_remove_group(&p->kobj, p->pma_table); err_put_gid_attrs: kobject_put(&p->gid_attr_group->kobj); @@ -1270,7 +1273,9 @@ static void free_port_list_attributes(struct ib_device *device) kfree(port->hw_stats); free_hsag(&port->kobj, port->hw_stats_ag); } - sysfs_remove_group(p, port->pma_table); + + if (port->pma_table) + sysfs_remove_group(p, port->pma_table); sysfs_remove_group(p, &port->pkey_group); sysfs_remove_group(p, &port->gid_group); sysfs_remove_group(&port->gid_attr_group->kobj, From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B85C65EDC1; Mon, 12 Jul 2021 13:09: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 4GNkct6DqDz3gyB; Mon, 12 Jul 2021 13:09: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 0145972DE; Mon, 12 Jul 2021 13:09: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 16CD9Xoc094951; Mon, 12 Jul 2021 13:09:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9XS6094950; Mon, 12 Jul 2021 13:09:33 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:33 GMT Message-Id: <202107121309.16CD9XS6094950@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: d8cbfa101cbe - main - mlx5core: Make sure error code is propagated on error. 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: d8cbfa101cbe3a9ece41120af93884177aff728a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:35 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=d8cbfa101cbe3a9ece41120af93884177aff728a commit d8cbfa101cbe3a9ece41120af93884177aff728a Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:41 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:31 +0000 mlx5core: Make sure error code is propagated on error. If mlx5_init_once() fails, mlx5_load_one() should fail too, else the device instance remains attached causing problems at reboot. MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index 37a55f65683c..755e8844a892 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -1101,7 +1101,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, mlx5_start_health_poll(dev); - if (boot && mlx5_init_once(dev, priv)) { + if (boot && (err = mlx5_init_once(dev, priv))) { mlx5_core_err(dev, "sw objs init failed\n"); goto err_stop_poll; } From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B5EC365EE86; Mon, 12 Jul 2021 13:09: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 4GNkcr0ktKz3R8d; Mon, 12 Jul 2021 13:09: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 BD63772DD; Mon, 12 Jul 2021 13:09: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 16CD9VdS094897; Mon, 12 Jul 2021 13:09:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9VZH094896; Mon, 12 Jul 2021 13:09:31 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:31 GMT Message-Id: <202107121309.16CD9VZH094896@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: 4238b4a7a2cf - main - ibcore: Introduce ib_port_phys_state enum. 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: 4238b4a7a2cfe44e95f3553ff4a3f6f813fb81f5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:32 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=4238b4a7a2cfe44e95f3553ff4a3f6f813fb81f5 commit 4238b4a7a2cfe44e95f3553ff4a3f6f813fb81f5 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:39 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:31 +0000 ibcore: Introduce ib_port_phys_state enum. In order to improve readability, add ib_port_phys_state enum to replace the use of magic numbers. Linux commit: 72a7720fca37fec0daf295923f17ac5d88a613e1 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c | 3 ++- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 4 ++-- sys/ofed/drivers/infiniband/core/ib_sysfs.c | 30 +++++++++++++++++++---------- sys/ofed/include/rdma/ib_verbs.h | 10 ++++++++++ 4 files changed, 34 insertions(+), 13 deletions(-) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c index 62956607974b..ef23f182bc28 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c @@ -684,7 +684,8 @@ out: static u8 state_to_phys_state(enum ib_port_state state) { - return state == IB_PORT_ACTIVE ? 5 : 3; + return state == IB_PORT_ACTIVE ? + IB_PORT_PHYS_STATE_LINK_UP : IB_PORT_PHYS_STATE_DISABLED; } static int eth_link_query_port(struct ib_device *ibdev, u8 port, diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index b97d40ca8b99..d614ec048f60 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -319,7 +319,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, props->max_msg_sz = 1 << MLX5_CAP_GEN(dev->mdev, log_max_msg); props->pkey_tbl_len = 1; props->state = IB_PORT_DOWN; - props->phys_state = 3; + props->phys_state = IB_PORT_PHYS_STATE_DISABLED; mlx5_query_nic_vport_qkey_viol_cntr(dev->mdev, &qkey_viol_cntr); props->qkey_viol_cntr = qkey_viol_cntr; @@ -331,7 +331,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, if (ndev->if_drv_flags & IFF_DRV_RUNNING && ndev->if_link_state == LINK_STATE_UP) { props->state = IB_PORT_ACTIVE; - props->phys_state = 5; + props->phys_state = IB_PORT_PHYS_STATE_LINK_UP; } ndev_ib_mtu = iboe_get_mtu(ndev->if_mtu); diff --git a/sys/ofed/drivers/infiniband/core/ib_sysfs.c b/sys/ofed/drivers/infiniband/core/ib_sysfs.c index 55e7b5395b8e..64ef4c4aefdb 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sysfs.c +++ b/sys/ofed/drivers/infiniband/core/ib_sysfs.c @@ -293,6 +293,24 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused, ib_width_enum_to_int(attr.active_width), speed); } +static const char *phys_state_to_str(enum ib_port_phys_state phys_state) +{ + static const char * phys_state_str[] = { + "", + "Sleep", + "Polling", + "Disabled", + "PortConfigurationTraining", + "LinkUp", + "LinkErrorRecovery", + "Phy Test", + }; + + if (phys_state < ARRAY_SIZE(phys_state_str)) + return phys_state_str[phys_state]; + return ""; +} + static ssize_t phys_state_show(struct ib_port *p, struct port_attribute *unused, char *buf) { @@ -304,16 +322,8 @@ static ssize_t phys_state_show(struct ib_port *p, struct port_attribute *unused, if (ret) return ret; - switch (attr.phys_state) { - case 1: return sprintf(buf, "1: Sleep\n"); - case 2: return sprintf(buf, "2: Polling\n"); - case 3: return sprintf(buf, "3: Disabled\n"); - case 4: return sprintf(buf, "4: PortConfigurationTraining\n"); - case 5: return sprintf(buf, "5: LinkUp\n"); - case 6: return sprintf(buf, "6: LinkErrorRecovery\n"); - case 7: return sprintf(buf, "7: Phy Test\n"); - default: return sprintf(buf, "%d: \n", attr.phys_state); - } + return sprintf(buf, "%d: %s\n", attr.phys_state, + phys_state_to_str(attr.phys_state)); } static ssize_t link_layer_show(struct ib_port *p, struct port_attribute *unused, diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index 2450682ffa66..2399a3a53120 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -396,6 +396,16 @@ enum ib_port_cap_flags { IB_PORT_IP_BASED_GIDS = 1 << 26, }; +enum ib_port_phys_state { + IB_PORT_PHYS_STATE_SLEEP = 1, + IB_PORT_PHYS_STATE_POLLING = 2, + IB_PORT_PHYS_STATE_DISABLED = 3, + IB_PORT_PHYS_STATE_PORT_CONFIGURATION_TRAINING = 4, + IB_PORT_PHYS_STATE_LINK_UP = 5, + IB_PORT_PHYS_STATE_LINK_ERROR_RECOVERY = 6, + IB_PORT_PHYS_STATE_PHY_TEST = 7, +}; + enum ib_port_width { IB_WIDTH_1X = 1, IB_WIDTH_2X = 16, From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 947BA65ECBA; Mon, 12 Jul 2021 13:09: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 4GNkcw6ppdz3h48; Mon, 12 Jul 2021 13:09: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 43AF0755C; Mon, 12 Jul 2021 13:09: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 16CD9amC094999; Mon, 12 Jul 2021 13:09:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9adj094998; Mon, 12 Jul 2021 13:09:36 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:36 GMT Message-Id: <202107121309.16CD9adj094998@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: 31525faed8b4 - main - ibcore: Validate port number in query_pkey verb. 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: 31525faed8b43c579767cf3ac211f41764b2a46c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:37 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=31525faed8b43c579767cf3ac211f41764b2a46c commit 31525faed8b43c579767cf3ac211f41764b2a46c Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:42 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:31 +0000 ibcore: Validate port number in query_pkey verb. Before calling the driver's function let's make sure port is valid. Linux commit: 9af3f5cf9d64a056eca53bc643f6288ad28bbbb5 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_device.c b/sys/ofed/drivers/infiniband/core/ib_device.c index 8c6a2d9f1a8a..8ce1127db639 100644 --- a/sys/ofed/drivers/infiniband/core/ib_device.c +++ b/sys/ofed/drivers/infiniband/core/ib_device.c @@ -809,6 +809,9 @@ void ib_cache_gid_del_all_by_netdev(struct ifnet *ndev) int ib_query_pkey(struct ib_device *device, u8 port_num, u16 index, u16 *pkey) { + if (!rdma_is_port_valid(device, port_num)) + return -EINVAL; + return device->query_pkey(device, port_num, index, pkey); } EXPORT_SYMBOL(ib_query_pkey); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 647FA65EC5D; Mon, 12 Jul 2021 13:09: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 4GNkcy0MCkz3RHg; Mon, 12 Jul 2021 13:09: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 66DDA7365; Mon, 12 Jul 2021 13:09: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 16CD9bIV095023; Mon, 12 Jul 2021 13:09:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9bUo095022; Mon, 12 Jul 2021 13:09:37 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:37 GMT Message-Id: <202107121309.16CD9bUo095022@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: e2ae502d2860 - main - ibcore: Use inline function to validate port 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: e2ae502d28605db0ca2af6e6261513106fe2b57d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:39 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=e2ae502d28605db0ca2af6e6261513106fe2b57d commit e2ae502d28605db0ca2af6e6261513106fe2b57d Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:43 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:31 +0000 ibcore: Use inline function to validate port Linux commit: 24dc831b77eca9361cf835be59fa69ea0e471afc MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_cache.c | 22 +++++++++++----------- sys/ofed/drivers/infiniband/core/ib_cma.c | 6 ++---- sys/ofed/drivers/infiniband/core/ib_device.c | 4 ++-- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_cache.c b/sys/ofed/drivers/infiniband/core/ib_cache.c index 3680b97ad2bf..1f44841348fe 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cache.c +++ b/sys/ofed/drivers/infiniband/core/ib_cache.c @@ -518,8 +518,7 @@ int ib_find_cached_gid_by_port(struct ib_device *ib_dev, struct ib_gid_attr val = {.ndev = ndev, .gid_type = gid_type}; unsigned long flags; - if (port < rdma_start_port(ib_dev) || - port > rdma_end_port(ib_dev)) + if (!rdma_is_port_valid(ib_dev, port)) return -ENOENT; table = ports_table[port - rdma_start_port(ib_dev)]; @@ -579,9 +578,10 @@ static int ib_cache_gid_find_by_filter(struct ib_device *ib_dev, if (!ports_table) return -EOPNOTSUPP; - if (port < rdma_start_port(ib_dev) || - port > rdma_end_port(ib_dev) || - !rdma_protocol_roce(ib_dev, port)) + if (!rdma_is_port_valid(ib_dev, port)) + return -EINVAL; + + if (!rdma_protocol_roce(ib_dev, port)) return -EPROTONOSUPPORT; table = ports_table[port - rdma_start_port(ib_dev)]; @@ -885,7 +885,7 @@ int ib_get_cached_gid(struct ib_device *device, struct ib_gid_table **ports_table = device->cache.gid_cache; struct ib_gid_table *table = ports_table[port_num - rdma_start_port(device)]; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; read_lock_irqsave(&table->rwlock, flags); @@ -934,7 +934,7 @@ int ib_get_cached_pkey(struct ib_device *device, unsigned long flags; int ret = 0; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; read_lock_irqsave(&device->cache.lock, flags); @@ -963,7 +963,7 @@ int ib_find_cached_pkey(struct ib_device *device, int ret = -ENOENT; int partial_ix = -1; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; read_lock_irqsave(&device->cache.lock, flags); @@ -1003,7 +1003,7 @@ int ib_find_exact_cached_pkey(struct ib_device *device, int i; int ret = -ENOENT; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; read_lock_irqsave(&device->cache.lock, flags); @@ -1032,7 +1032,7 @@ int ib_get_cached_lmc(struct ib_device *device, unsigned long flags; int ret = 0; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; read_lock_irqsave(&device->cache.lock, flags); @@ -1059,7 +1059,7 @@ static void ib_cache_update(struct ib_device *device, bool use_roce_gid_table = rdma_cap_roce_gid_table(device, port); - if (port < rdma_start_port(device) || port > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port)) return; table = ports_table[port - rdma_start_port(device)]; diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c index 2639c61b94a4..bad4b311e112 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cma.c +++ b/sys/ofed/drivers/infiniband/core/ib_cma.c @@ -264,8 +264,7 @@ struct cma_device *cma_enum_devices_by_ibdev(cma_device_filter filter, int cma_get_default_gid_type(struct cma_device *cma_dev, unsigned int port) { - if (port < rdma_start_port(cma_dev->device) || - port > rdma_end_port(cma_dev->device)) + if (!rdma_is_port_valid(cma_dev->device, port)) return -EINVAL; return cma_dev->default_gid_type[port - rdma_start_port(cma_dev->device)]; @@ -277,8 +276,7 @@ int cma_set_default_gid_type(struct cma_device *cma_dev, { unsigned long supported_gids; - if (port < rdma_start_port(cma_dev->device) || - port > rdma_end_port(cma_dev->device)) + if (!rdma_is_port_valid(cma_dev->device, port)) return -EINVAL; supported_gids = roce_gid_type_mask_support(cma_dev->device, port); diff --git a/sys/ofed/drivers/infiniband/core/ib_device.c b/sys/ofed/drivers/infiniband/core/ib_device.c index 8ce1127db639..dc0e6a5866d2 100644 --- a/sys/ofed/drivers/infiniband/core/ib_device.c +++ b/sys/ofed/drivers/infiniband/core/ib_device.c @@ -664,7 +664,7 @@ int ib_query_port(struct ib_device *device, union ib_gid gid; int err; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; memset(port_attr, 0, sizeof(*port_attr)); @@ -855,7 +855,7 @@ int ib_modify_port(struct ib_device *device, if (!device->modify_port) return -ENOSYS; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; return device->modify_port(device, port_num, port_modify_mask, From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FD2465EDD1; Mon, 12 Jul 2021 13:09: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 4GNkcv47rsz3gyK; Mon, 12 Jul 2021 13:09: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 2235772DF; Mon, 12 Jul 2021 13:09: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 16CD9ZXY094975; Mon, 12 Jul 2021 13:09:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9ZsW094974; Mon, 12 Jul 2021 13:09:35 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:35 GMT Message-Id: <202107121309.16CD9ZsW094974@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: 912e98cedee2 - main - ibcore: Protect against concurrent access to hardware stats. 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: 912e98cedee2590748a9893d3152b11694de3379 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:37 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=912e98cedee2590748a9893d3152b11694de3379 commit 912e98cedee2590748a9893d3152b11694de3379 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:41 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:31 +0000 ibcore: Protect against concurrent access to hardware stats. Currently access to hardware stats buffer isn't protected, this can result in multiple writes and reads at the same time to the same memory location. This can lead to providing an incorrect value to the user. Add a mutex to protect against it. Linux commit: e945130b52bea65d15f9bdf54949d4cb7a88db7f MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_sysfs.c | 34 ++++++++++++++++++++++++----- sys/ofed/include/rdma/ib_verbs.h | 4 ++++ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_sysfs.c b/sys/ofed/drivers/infiniband/core/ib_sysfs.c index c393bb64a034..806f4aba6c76 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sysfs.c +++ b/sys/ofed/drivers/infiniband/core/ib_sysfs.c @@ -827,10 +827,15 @@ static ssize_t show_hw_stats(struct kobject *kobj, struct attribute *attr, dev = port->ibdev; stats = port->hw_stats; } + mutex_lock(&stats->lock); ret = update_hw_stats(dev, stats, hsa->port_num, hsa->index); if (ret) - return ret; - return print_hw_stat(stats, hsa->index, buf); + goto unlock; + ret = print_hw_stat(stats, hsa->index, buf); +unlock: + mutex_unlock(&stats->lock); + + return ret; } static ssize_t show_stats_lifespan(struct kobject *kobj, @@ -838,17 +843,25 @@ static ssize_t show_stats_lifespan(struct kobject *kobj, char *buf) { struct hw_stats_attribute *hsa; + struct rdma_hw_stats *stats; int msecs; hsa = container_of(attr, struct hw_stats_attribute, attr); if (!hsa->port_num) { struct ib_device *dev = container_of((struct device *)kobj, struct ib_device, dev); - msecs = jiffies_to_msecs(dev->hw_stats->lifespan); + + stats = dev->hw_stats; } else { struct ib_port *p = container_of(kobj, struct ib_port, kobj); - msecs = jiffies_to_msecs(p->hw_stats->lifespan); + + stats = p->hw_stats; } + + mutex_lock(&stats->lock); + msecs = jiffies_to_msecs(stats->lifespan); + mutex_unlock(&stats->lock); + return sprintf(buf, "%d\n", msecs); } @@ -857,6 +870,7 @@ static ssize_t set_stats_lifespan(struct kobject *kobj, const char *buf, size_t count) { struct hw_stats_attribute *hsa; + struct rdma_hw_stats *stats; int msecs; int jiffies; int ret; @@ -871,11 +885,18 @@ static ssize_t set_stats_lifespan(struct kobject *kobj, if (!hsa->port_num) { struct ib_device *dev = container_of((struct device *)kobj, struct ib_device, dev); - dev->hw_stats->lifespan = jiffies; + + stats = dev->hw_stats; } else { struct ib_port *p = container_of(kobj, struct ib_port, kobj); - p->hw_stats->lifespan = jiffies; + + stats = p->hw_stats; } + + mutex_lock(&stats->lock); + stats->lifespan = jiffies; + mutex_unlock(&stats->lock); + return count; } @@ -968,6 +989,7 @@ static void setup_hw_stats(struct ib_device *device, struct ib_port *port, sysfs_attr_init(hsag->attrs[i]); } + mutex_init(&stats->lock); /* treat an error here as non-fatal */ hsag->attrs[i] = alloc_hsa_lifespan("lifespan", port_num); if (hsag->attrs[i]) diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index 2399a3a53120..b18aa2855166 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -438,6 +438,9 @@ enum ib_port_speed { /** * struct rdma_hw_stats + * @lock - Mutex to protect parallel write access to lifespan and values + * of counters, which are 64bits and not guaranteeed to be written + * atomicaly on 32bits systems. * @timestamp - Used by the core code to track when the last update was * @lifespan - Used by the core code to determine how old the counters * should be before being updated again. Stored in jiffies, defaults @@ -453,6 +456,7 @@ enum ib_port_speed { * filled in by the drivers get_stats routine */ struct rdma_hw_stats { + struct mutex lock; /* Protect lifespan and values[] */ unsigned long timestamp; unsigned long lifespan; const char * const *names; From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F5EF65ED74; Mon, 12 Jul 2021 13:09: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 4GNkd157Vhz3h6J; Mon, 12 Jul 2021 13:09: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 B6F0872E0; Mon, 12 Jul 2021 13:09: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 16CD9dg9095077; Mon, 12 Jul 2021 13:09:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9dGc095076; Mon, 12 Jul 2021 13:09:39 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:39 GMT Message-Id: <202107121309.16CD9dGc095076@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: 468a6b5055f0 - main - ibcore: Fix use-after-free in IB mad completion handling. 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: 468a6b5055f0b6ea0bdb1ee8cbdf749204cb3b25 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:42 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=468a6b5055f0b6ea0bdb1ee8cbdf749204cb3b25 commit 468a6b5055f0b6ea0bdb1ee8cbdf749204cb3b25 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:44 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:31 +0000 ibcore: Fix use-after-free in IB mad completion handling. We encountered a use-after-free bug when unloading the driver: BUG: KASAN: use-after-free in ib_mad_post_receive_mads+0xddc/0xed0 [ib_core] Read of size 4 at addr ffff8882ca5aa868 by task kworker/u13:2/23862 Workqueue: ib-comp-unb-wq ib_cq_poll_work [ib_core] Call Trace: dump_stack+0x9a/0xeb print_address_description+0xe3/0x2e0 ib_mad_post_receive_mads+0xddc/0xed0 [ib_core] __kasan_report+0x15c/0x1df ib_mad_post_receive_mads+0xddc/0xed0 [ib_core] kasan_report+0xe/0x20 ib_mad_post_receive_mads+0xddc/0xed0 [ib_core] find_mad_agent+0xa00/0xa00 [ib_core] qlist_free_all+0x51/0xb0 mlx4_ib_sqp_comp_worker+0x1970/0x1970 [mlx4_ib] quarantine_reduce+0x1fa/0x270 kasan_unpoison_shadow+0x30/0x40 ib_mad_recv_done+0xdf6/0x3000 [ib_core] _raw_spin_unlock_irqrestore+0x46/0x70 ib_mad_send_done+0x1810/0x1810 [ib_core] mlx4_ib_destroy_cq+0x2a0/0x2a0 [mlx4_ib] _raw_spin_unlock_irqrestore+0x46/0x70 debug_object_deactivate+0x2b9/0x4a0 __ib_process_cq+0xe2/0x1d0 [ib_core] ib_cq_poll_work+0x45/0xf0 [ib_core] process_one_work+0x90c/0x1860 pwq_dec_nr_in_flight+0x320/0x320 worker_thread+0x87/0xbb0 __kthread_parkme+0xb6/0x180 process_one_work+0x1860/0x1860 kthread+0x320/0x3e0 kthread_park+0x120/0x120 ret_from_fork+0x24/0x30 ... Freed by task 31682: save_stack+0x19/0x80 __kasan_slab_free+0x11d/0x160 kfree+0xf5/0x2f0 ib_mad_port_close+0x200/0x380 [ib_core] ib_mad_remove_device+0xf0/0x230 [ib_core] remove_client_context+0xa6/0xe0 [ib_core] disable_device+0x14e/0x260 [ib_core] __ib_unregister_device+0x79/0x150 [ib_core] ib_unregister_device+0x21/0x30 [ib_core] mlx4_ib_remove+0x162/0x690 [mlx4_ib] mlx4_remove_device+0x204/0x2c0 [mlx4_core] mlx4_unregister_interface+0x49/0x1d0 [mlx4_core] mlx4_ib_cleanup+0xc/0x1d [mlx4_ib] __x64_sys_delete_module+0x2d2/0x400 do_syscall_64+0x95/0x470 entry_SYSCALL_64_after_hwframe+0x49/0xbe The problem was that the MAD PD was deallocated before the MAD CQ. There was completion work pending for the CQ when the PD got deallocated. When the mad completion handling reached procedure ib_mad_post_receive_mads(), we got a use-after-free bug in the following line of code in that procedure: sg_list.lkey = qp_info->port_priv->pd->local_dma_lkey; (the pd pointer in the above line is no longer valid, because the pd has been deallocated). We fix this by allocating the PD before the CQ in procedure ib_mad_port_open(), and deallocating the PD after freeing the CQ in procedure ib_mad_port_close(). Since the CQ completion work queue is flushed during ib_free_cq(), no completions will be pending for that CQ when the PD is later deallocated. Note that freeing the CQ before deallocating the PD is the practice in the ULPs. Linux commit: 770b7d96cfff6a8bf6c9f261ba6f135dc9edf484 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_mad.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_mad.c b/sys/ofed/drivers/infiniband/core/ib_mad.c index 2f14535688aa..b9f45ff5e41d 100644 --- a/sys/ofed/drivers/infiniband/core/ib_mad.c +++ b/sys/ofed/drivers/infiniband/core/ib_mad.c @@ -3146,10 +3146,8 @@ static int ib_mad_port_open(struct ib_device *device, /* Create new device info */ port_priv = kzalloc(sizeof *port_priv, GFP_KERNEL); - if (!port_priv) { - dev_err(&device->dev, "No memory for ib_mad_port_private\n"); + if (!port_priv) return -ENOMEM; - } port_priv->device = device; port_priv->port_num = port_num; @@ -3163,18 +3161,18 @@ static int ib_mad_port_open(struct ib_device *device, if (has_smi) cq_size *= 2; + port_priv->pd = ib_alloc_pd(device, 0); + if (IS_ERR(port_priv->pd)) { + dev_err(&device->dev, "Couldn't create ib_mad PD\n"); + ret = PTR_ERR(port_priv->pd); + goto error3; + } + port_priv->cq = ib_alloc_cq(port_priv->device, port_priv, cq_size, 0, IB_POLL_WORKQUEUE); if (IS_ERR(port_priv->cq)) { dev_err(&device->dev, "Couldn't create ib_mad CQ\n"); ret = PTR_ERR(port_priv->cq); - goto error3; - } - - port_priv->pd = ib_alloc_pd(device, 0); - if (IS_ERR(port_priv->pd)) { - dev_err(&device->dev, "Couldn't create ib_mad PD\n"); - ret = PTR_ERR(port_priv->pd); goto error4; } @@ -3217,11 +3215,11 @@ error8: error7: destroy_mad_qp(&port_priv->qp_info[0]); error6: - ib_dealloc_pd(port_priv->pd); -error4: ib_free_cq(port_priv->cq); cleanup_recv_queue(&port_priv->qp_info[1]); cleanup_recv_queue(&port_priv->qp_info[0]); +error4: + ib_dealloc_pd(port_priv->pd); error3: kfree(port_priv); @@ -3251,8 +3249,8 @@ static int ib_mad_port_close(struct ib_device *device, int port_num) destroy_workqueue(port_priv->wq); destroy_mad_qp(&port_priv->qp_info[1]); destroy_mad_qp(&port_priv->qp_info[0]); - ib_dealloc_pd(port_priv->pd); ib_free_cq(port_priv->cq); + ib_dealloc_pd(port_priv->pd); cleanup_recv_queue(&port_priv->qp_info[1]); cleanup_recv_queue(&port_priv->qp_info[0]); /* XXX: Handle deallocation of MAD registration tables */ From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 416F865E979; Mon, 12 Jul 2021 13:09: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 4GNkcy5h6qz3h1v; Mon, 12 Jul 2021 13:09: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 8C404768B; Mon, 12 Jul 2021 13:09: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 16CD9cTh095053; Mon, 12 Jul 2021 13:09:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9cYd095052; Mon, 12 Jul 2021 13:09:38 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:38 GMT Message-Id: <202107121309.16CD9cYd095052@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: 507389a35a41 - main - ibcore: Fail early if unsupported QP is provided. 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: 507389a35a41f5f15592d2156d34039e3ee1c3e5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:39 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=507389a35a41f5f15592d2156d34039e3ee1c3e5 commit 507389a35a41f5f15592d2156d34039e3ee1c3e5 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:44 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:31 +0000 ibcore: Fail early if unsupported QP is provided. When requested QP type is not supported for a {device, port}, return the error right away before validating all parameters during mad agent registration time. Linux commit: 798bba01b44b0ddf8cd6e542635b37cc9a9b739c MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_mad.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_mad.c b/sys/ofed/drivers/infiniband/core/ib_mad.c index 7bb6323a4c53..2f14535688aa 100644 --- a/sys/ofed/drivers/infiniband/core/ib_mad.c +++ b/sys/ofed/drivers/infiniband/core/ib_mad.c @@ -219,6 +219,10 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, unsigned long flags; u8 mgmt_class, vclass; + if ((qp_type == IB_QPT_SMI && !rdma_cap_ib_smi(device, port_num)) || + (qp_type == IB_QPT_GSI && !rdma_cap_ib_cm(device, port_num))) + return ERR_PTR(-EPROTONOSUPPORT); + /* Validate parameters */ qpn = get_spl_qp_index(qp_type); if (qpn == -1) { From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9657465ECD8; Mon, 12 Jul 2021 13:09: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 4GNkd22zDpz3h8g; Mon, 12 Jul 2021 13:09: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 015857653; Mon, 12 Jul 2021 13:09: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 16CD9f7H095125; Mon, 12 Jul 2021 13:09:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9fHQ095124; Mon, 12 Jul 2021 13:09:41 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:41 GMT Message-Id: <202107121309.16CD9fHQ095124@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: df1df0c742ec - main - ibcore: Do not overreact to SM LID change event. 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: df1df0c742ec22de6ee7656a91ea8773c05f3b81 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:43 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=df1df0c742ec22de6ee7656a91ea8773c05f3b81 commit df1df0c742ec22de6ee7656a91ea8773c05f3b81 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:46 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:32 +0000 ibcore: Do not overreact to SM LID change event. When IPoIB receives an SM LID change event, it reacts by flushing its path record cache and rejoining multicast groups. This is the same behavior it performs when it receives a reregistration event. This behavior is unnecessary as an SM may have database backup or synchronization mechanisms which permit the SM location or LID to change without loss of multicast membership and without impact to path records. Both opensm and the OPA FM issue reregistration events if a new SM is started (or restarted with a new config) or an SM event occurs which results in loss of multicast membership records by the SM (such as opensm failover) or the SM encounters new nodes with Active ports (such as after joining 2 fabrics by connecting switches via ISLs). Hence this event can be depended on as the trigger for IPoIB cache and multicast flushing. It appears that some drivers, such as qib, and hfi1 issue the IB_EVENT_SM_CHANGE but other drivers such as mlx4 and mlx5 do not. Empirical testing on Mellanox EDR using ibv_asyncwatch has confirmed that Mellanox EDR HCAs do not generate SM change events and that opensm does generate reregistration. An SM LID change event is generated by the mentioned drivers to reflect that sm_lid and/or sm_sl in the local port info has changed. The intent of this event is to permit applications and ULPs which have a local copy of this information (or an address handle using it) to update their information. The intent is that the reregistration event (caused by the SM via a bit in Set(PortInfo)) be used to inform nodes that they need to rejoin multicast groups, resubscribe for notices and potentially update path records. When an SM migrates or fails over, a SM LID change event can occur. In response IPoIB discards path records and multicast membership and loses connectivity until these records are restored via SA requests. In very large fabrics, it may take minutes for the SM to be ready and for the SA responses to be supplied. This can result in undesirable and unnecessary IPoIB connectivity impacts. It also can result in an unnecessary storm of SA queries from all nodes in a cluster potentially followed by yet another storm if the SM issues the reregistration request. The fact the Mellanox HCAs do not even generate this event, is further evidence that on modern IB fabrics there will be no ill side effects from the proposed changes below to reduce the reaction by 3 kernel components to this event. So these changes should be benign for Mellanox IB fabrics and will benefit OPA fabrics while also making ib_core and ULP behavor "correct" as intended by the IBTA spec and kernel RDMA event APIs. Address these issues by removing IB_EVENT_SM_CHANGE handling from ipoib. IPoIB does not locally store sm_lid nor sm_sl, so it does not need to do anything on SM LID change. IPoIB makes use of other ib_core components to issue SA requests for it and those components correctly track SM LID and SM LID changes. Also in ib_core multicast handling, remove the test for IB_EVENT_SM_CHANGE. This code is moving all multicast groups to the error state, which will trigger rejoins. This code is used by IPoIB as well as the connection manager and other clients of multicast groups. This kernel module centralizes group membership status and joins since a node can only join a given group once but multiple ULPs or applications may want to join the same group. It makes use of the sa_query.c component in ib_core, which correctly trackes SM LID and SL. This component does not track SM LID nor SL itself and hence need not react to their changes. Similarly in the ib_core cache code remove the handling for the IB_EVENT_SM_CHANGE. In this function. The ib_cache_update function which is ultimately called is updating local copies of the pkey table, gid table and lmc. It does not update nor retain sm_lid nor sm_sl. As such it does not need to be called on an SM LID change. It technically also does not need to be called on a reregistration. The LID_CHANGE, PKEY_CHANGE, GID_CHANGE and port state change events (PORT_ERR, PORT_ACTICE) should be sufficient triggers. It is worth noting that the alternative of simply having the hfi1 and qib drivers not generate the SM LID change event was explored. While this would duplicate what Mellanox drivers do now, it is not the correct behavior and removes the ability for an SM to migrate without requiring reregistration. Since both opensm and OPA SM have mechanisms to backup or synchronize registration information, it is desirable to let them perform SM migrations (with LID or SL changes) without requiring reregistration when they deem it appropriate. Linux commit: ba7d8117f3cca8eb70d579fde3f9ec8cd6a28f39 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_multicast.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_multicast.c b/sys/ofed/drivers/infiniband/core/ib_multicast.c index d81767bcd3a1..3784a3e5e290 100644 --- a/sys/ofed/drivers/infiniband/core/ib_multicast.c +++ b/sys/ofed/drivers/infiniband/core/ib_multicast.c @@ -800,7 +800,6 @@ static void mcast_event_handler(struct ib_event_handler *handler, switch (event->event) { case IB_EVENT_PORT_ERR: case IB_EVENT_LID_CHANGE: - case IB_EVENT_SM_CHANGE: case IB_EVENT_CLIENT_REREGISTER: mcast_groups_event(&dev->port[index], MCAST_GROUP_ERROR); break; From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A410A65EAC0; Mon, 12 Jul 2021 13:09: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 4GNkd14kW6z3RLB; Mon, 12 Jul 2021 13:09: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 DAAE3755D; Mon, 12 Jul 2021 13:09: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 16CD9eG0095101; Mon, 12 Jul 2021 13:09:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9eud095100; Mon, 12 Jul 2021 13:09:40 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:40 GMT Message-Id: <202107121309.16CD9eud095100@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: 26646ba5bcda - main - ibcore: Remove debug prints after allocation failure. 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: 26646ba5bcdadbd513dc4dfccc772952732aea5c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:43 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=26646ba5bcdadbd513dc4dfccc772952732aea5c commit 26646ba5bcdadbd513dc4dfccc772952732aea5c Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:45 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:31 +0000 ibcore: Remove debug prints after allocation failure. The prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway. Linux commit: 2716243212241855cd9070883779f6e58967dec5 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_mad.c | 40 ++++++------------------------- 1 file changed, 7 insertions(+), 33 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_mad.c b/sys/ofed/drivers/infiniband/core/ib_mad.c index b9f45ff5e41d..5b1297fe4cd3 100644 --- a/sys/ofed/drivers/infiniband/core/ib_mad.c +++ b/sys/ofed/drivers/infiniband/core/ib_mad.c @@ -827,7 +827,6 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, local = kmalloc(sizeof *local, GFP_ATOMIC); if (!local) { ret = -ENOMEM; - dev_err(&device->dev, "No memory for ib_mad_local_private\n"); goto out; } local->mad_priv = NULL; @@ -835,7 +834,6 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, mad_priv = alloc_mad_private(mad_size, GFP_ATOMIC); if (!mad_priv) { ret = -ENOMEM; - dev_err(&device->dev, "No memory for local response MAD\n"); kfree(local); goto out; } @@ -958,9 +956,6 @@ static int alloc_send_rmpp_list(struct ib_mad_send_wr_private *send_wr, for (left = send_buf->data_len + pad; left > 0; left -= seg_size) { seg = kmalloc(sizeof (*seg) + seg_size, gfp_mask); if (!seg) { - dev_err(&send_buf->mad_agent->device->dev, - "alloc_send_rmpp_segs: RMPP mem alloc failed for len %zd, gfp %#x\n", - sizeof (*seg) + seg_size, gfp_mask); free_send_rmpp_list(send_wr); return -ENOMEM; } @@ -1373,12 +1368,7 @@ static int allocate_method_table(struct ib_mad_mgmt_method_table **method) { /* Allocate management method table */ *method = kzalloc(sizeof **method, GFP_ATOMIC); - if (!*method) { - pr_err("No memory for ib_mad_mgmt_method_table\n"); - return -ENOMEM; - } - - return 0; + return (*method) ? 0 : (-ENOMEM); } /* @@ -1469,8 +1459,6 @@ static int add_nonoui_reg_req(struct ib_mad_reg_req *mad_reg_req, /* Allocate management class table for "new" class version */ *class = kzalloc(sizeof **class, GFP_ATOMIC); if (!*class) { - dev_err(&agent_priv->agent.device->dev, - "No memory for ib_mad_mgmt_class_table\n"); ret = -ENOMEM; goto error1; } @@ -1535,22 +1523,16 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req, if (!*vendor_table) { /* Allocate mgmt vendor class table for "new" class version */ vendor = kzalloc(sizeof *vendor, GFP_ATOMIC); - if (!vendor) { - dev_err(&agent_priv->agent.device->dev, - "No memory for ib_mad_mgmt_vendor_class_table\n"); + if (!vendor) goto error1; - } *vendor_table = vendor; } if (!(*vendor_table)->vendor_class[vclass]) { /* Allocate table for this management vendor class */ vendor_class = kzalloc(sizeof *vendor_class, GFP_ATOMIC); - if (!vendor_class) { - dev_err(&agent_priv->agent.device->dev, - "No memory for ib_mad_mgmt_vendor_class\n"); + if (!vendor_class) goto error2; - } (*vendor_table)->vendor_class[vclass] = vendor_class; } @@ -1560,7 +1542,8 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req, mad_reg_req->oui, 3)) { method = &(*vendor_table)->vendor_class[ vclass]->method_table[i]; - BUG_ON(!*method); + if (!*method) + goto error3; goto check_in_use; } } @@ -1570,7 +1553,6 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req, vclass]->oui[i])) { method = &(*vendor_table)->vendor_class[ vclass]->method_table[i]; - BUG_ON(*method); /* Allocate method table for this OUI */ if ((ret = allocate_method_table(method))) goto error3; @@ -2249,11 +2231,8 @@ static void ib_mad_recv_done(struct ib_cq *cq, struct ib_wc *wc) mad_size = recv->mad_size; response = alloc_mad_private(mad_size, GFP_KERNEL); - if (!response) { - dev_err(&port_priv->device->dev, - "%s: no memory for response buffer\n", __func__); + if (!response) goto out; - } if (rdma_cap_ib_switch(port_priv->device)) port_num = wc->port_num; @@ -2880,8 +2859,6 @@ static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info, mad_priv = alloc_mad_private(port_mad_size(qp_info->port_priv), GFP_ATOMIC); if (!mad_priv) { - dev_err(&qp_info->port_priv->device->dev, - "No memory for receive buffer\n"); ret = -ENOMEM; break; } @@ -2972,11 +2949,8 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv) u16 pkey_index; attr = kmalloc(sizeof *attr, GFP_KERNEL); - if (!attr) { - dev_err(&port_priv->device->dev, - "Couldn't kmalloc ib_qp_attr\n"); + if (!attr) return -ENOMEM; - } ret = ib_find_pkey(port_priv->device, port_priv->port_num, IB_DEFAULT_PKEY_FULL, &pkey_index); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED39265ECEC; Mon, 12 Jul 2021 13:09: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 4GNkd40178z3h6Q; Mon, 12 Jul 2021 13:09: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 1E625768C; Mon, 12 Jul 2021 13:09: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 16CD9hxS095149; Mon, 12 Jul 2021 13:09:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9hRw095148; Mon, 12 Jul 2021 13:09:43 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:43 GMT Message-Id: <202107121309.16CD9hRw095148@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: 20fea7ac6468 - main - ibcore: Define option to set ack timeout. 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: 20fea7ac64683b064ffe4cefa750e46ba20de4f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:45 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=20fea7ac64683b064ffe4cefa750e46ba20de4f9 commit 20fea7ac64683b064ffe4cefa750e46ba20de4f9 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:47 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:32 +0000 ibcore: Define option to set ack timeout. Define new option in 'rdma_set_option' to override calculated QP timeout when requested to provide QP attributes to modify a QP. At the same time, pack tos_set to be bitfield. Linux commit: 2c1619edef61a03cb516efaa81750784c3071d10 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_cma.c | 34 ++++++++++++++++++++++++++++++ sys/ofed/drivers/infiniband/core/ib_ucma.c | 7 ++++++ sys/ofed/include/rdma/rdma_cm.h | 1 + sys/ofed/include/uapi/rdma/rdma_user_cm.h | 4 ++++ 4 files changed, 46 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c index bad4b311e112..586524ac88bb 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cma.c +++ b/sys/ofed/drivers/infiniband/core/ib_cma.c @@ -336,8 +336,10 @@ struct rdma_id_private { u32 options; u8 srq; u8 tos; + u8 timeout_set:1; u8 reuseaddr; u8 afonly; + u8 timeout; enum ib_gid_type gid_type; }; @@ -775,6 +777,7 @@ struct rdma_cm_id *rdma_create_id(struct vnet *net, id_priv->id.event_handler = event_handler; id_priv->id.ps = ps; id_priv->id.qp_type = qp_type; + id_priv->timeout_set = false; spin_lock_init(&id_priv->lock); mutex_init(&id_priv->qp_mutex); init_completion(&id_priv->comp); @@ -1021,6 +1024,9 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr, } else ret = -ENOSYS; + if ((*qp_attr_mask & IB_QP_TIMEOUT) && id_priv->timeout_set) + qp_attr->timeout = id_priv->timeout; + return ret; } EXPORT_SYMBOL(rdma_init_qp_attr); @@ -2495,6 +2501,34 @@ void rdma_set_service_type(struct rdma_cm_id *id, int tos) } EXPORT_SYMBOL(rdma_set_service_type); +/** + * rdma_set_ack_timeout() - Set the ack timeout of QP associated + * with a connection identifier. + * @id: Communication identifier to associated with service type. + * @timeout: Ack timeout to set a QP, expressed as 4.096 * 2^(timeout) usec. + * + * This function should be called before rdma_connect() on active side, + * and on passive side before rdma_accept(). It is applicable to primary + * path only. The timeout will affect the local side of the QP, it is not + * negotiated with remote side and zero disables the timer. + * + * Return: 0 for success + */ +int rdma_set_ack_timeout(struct rdma_cm_id *id, u8 timeout) +{ + struct rdma_id_private *id_priv; + + if (id->qp_type != IB_QPT_RC) + return -EINVAL; + + id_priv = container_of(id, struct rdma_id_private, id); + id_priv->timeout = timeout; + id_priv->timeout_set = true; + + return 0; +} +EXPORT_SYMBOL(rdma_set_ack_timeout); + static void cma_query_handler(int status, struct ib_sa_path_rec *path_rec, void *context) { diff --git a/sys/ofed/drivers/infiniband/core/ib_ucma.c b/sys/ofed/drivers/infiniband/core/ib_ucma.c index 5ea2845c0fe5..19e4a17836ee 100644 --- a/sys/ofed/drivers/infiniband/core/ib_ucma.c +++ b/sys/ofed/drivers/infiniband/core/ib_ucma.c @@ -1204,6 +1204,13 @@ static int ucma_set_option_id(struct ucma_context *ctx, int optname, } ret = rdma_set_afonly(ctx->cm_id, *((int *) optval) ? 1 : 0); break; + case RDMA_OPTION_ID_ACK_TIMEOUT: + if (optlen != sizeof(u8)) { + ret = -EINVAL; + break; + } + ret = rdma_set_ack_timeout(ctx->cm_id, *((u8 *)optval)); + break; default: ret = -ENOSYS; } diff --git a/sys/ofed/include/rdma/rdma_cm.h b/sys/ofed/include/rdma/rdma_cm.h index b5ed43426969..8b9b38601325 100644 --- a/sys/ofed/include/rdma/rdma_cm.h +++ b/sys/ofed/include/rdma/rdma_cm.h @@ -385,6 +385,7 @@ int rdma_set_reuseaddr(struct rdma_cm_id *id, int reuse); */ int rdma_set_afonly(struct rdma_cm_id *id, int afonly); +int rdma_set_ack_timeout(struct rdma_cm_id *id, u8 timeout); /** * rdma_get_service_id - Return the IB service ID for a specified address. * @id: Communication identifier associated with the address. diff --git a/sys/ofed/include/uapi/rdma/rdma_user_cm.h b/sys/ofed/include/uapi/rdma/rdma_user_cm.h index 7c6ade294835..d93bc9abfe90 100644 --- a/sys/ofed/include/uapi/rdma/rdma_user_cm.h +++ b/sys/ofed/include/uapi/rdma/rdma_user_cm.h @@ -296,6 +296,10 @@ enum { RDMA_OPTION_ID_TOS = 0, RDMA_OPTION_ID_REUSEADDR = 1, RDMA_OPTION_ID_AFONLY = 2, + RDMA_OPTION_ID_ACK_TIMEOUT = 3 +}; + +enum { RDMA_OPTION_IB_PATH = 1 }; From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C24565EC7C; Mon, 12 Jul 2021 13:09: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 4GNkd46YmBz3h4c; Mon, 12 Jul 2021 13:09: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 4735F73B8; Mon, 12 Jul 2021 13:09: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 16CD9iK0095179; Mon, 12 Jul 2021 13:09:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9i7U095178; Mon, 12 Jul 2021 13:09:44 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:44 GMT Message-Id: <202107121309.16CD9i7U095178@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: c6ccb08686f3 - main - ibcore: Fix a use-after-free in ucma_resolve_ip(). 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: c6ccb08686f3b92c12778b4b903431b2ce71ec2c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:45 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c6ccb08686f3b92c12778b4b903431b2ce71ec2c commit c6ccb08686f3b92c12778b4b903431b2ce71ec2c Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:47 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:32 +0000 ibcore: Fix a use-after-free in ucma_resolve_ip(). There is a race condition between ucma_close() and ucma_resolve_ip(): CPU0 CPU1 ucma_resolve_ip(): ucma_close(): ctx = ucma_get_ctx(file, cmd.id); list_for_each_entry_safe(ctx, tmp, &file->ctx_list, list) { mutex_lock(&mut); idr_remove(&ctx_idr, ctx->id); mutex_unlock(&mut); ... mutex_lock(&mut); if (!ctx->closing) { mutex_unlock(&mut); rdma_destroy_id(ctx->cm_id); ... ucma_free_ctx(ctx); } ret = rdma_resolve_addr(); ucma_put_ctx(ctx); Before idr_remove(), ucma_get_ctx() could still find the ctx and after rdma_destroy_id(), rdma_resolve_addr() may still access id_priv pointer. Also, ucma_put_ctx() may use ctx after ucma_free_ctx() too. ucma_close() should call ucma_put_ctx() too which tests the refcnt and waits for the last one releasing it. The similar pattern is already used by ucma_destroy_id(). Linux commit: 5fe23f262e0548ca7f19fb79f89059a60d087d22 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_ucma.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_ucma.c b/sys/ofed/drivers/infiniband/core/ib_ucma.c index 19e4a17836ee..878e4d348234 100644 --- a/sys/ofed/drivers/infiniband/core/ib_ucma.c +++ b/sys/ofed/drivers/infiniband/core/ib_ucma.c @@ -1705,6 +1705,8 @@ static int ucma_close(struct inode *inode, struct file *filp) mutex_lock(&mut); if (!ctx->closing) { mutex_unlock(&mut); + ucma_put_ctx(ctx); + wait_for_completion(&ctx->comp); /* rdma_destroy_id ensures that no event handlers are * inflight for that id before releasing it. */ From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6989765EF2D; Mon, 12 Jul 2021 13:09: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 4GNkd75QM6z3gyy; Mon, 12 Jul 2021 13:09: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 8FACE755F; Mon, 12 Jul 2021 13:09: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 16CD9kmQ095227; Mon, 12 Jul 2021 13:09:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9kLM095226; Mon, 12 Jul 2021 13:09:46 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:46 GMT Message-Id: <202107121309.16CD9kLM095226@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: 3d2fb36a9ce7 - main - ibcore: Add new IB rates. 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: 3d2fb36a9ce72053e8865852caad30044dbd1059 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:48 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=3d2fb36a9ce72053e8865852caad30044dbd1059 commit 3d2fb36a9ce72053e8865852caad30044dbd1059 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:49 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:32 +0000 ibcore: Add new IB rates. Add the new rates that were added to Infiniband spec as part of HDR and 2x support. Linux commit: a5a5d1993696419e7d5357fc3128e53d219d382e MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_verbs.c | 48 +++++++++++++++++------------ 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_verbs.c b/sys/ofed/drivers/infiniband/core/ib_verbs.c index b397a65fdd9d..9e06d079af31 100644 --- a/sys/ofed/drivers/infiniband/core/ib_verbs.c +++ b/sys/ofed/drivers/infiniband/core/ib_verbs.c @@ -127,20 +127,28 @@ EXPORT_SYMBOL(ib_wc_status_msg); __attribute_const__ int ib_rate_to_mult(enum ib_rate rate) { switch (rate) { - case IB_RATE_2_5_GBPS: return 1; - case IB_RATE_5_GBPS: return 2; - case IB_RATE_10_GBPS: return 4; - case IB_RATE_20_GBPS: return 8; - case IB_RATE_30_GBPS: return 12; - case IB_RATE_40_GBPS: return 16; - case IB_RATE_60_GBPS: return 24; - case IB_RATE_80_GBPS: return 32; - case IB_RATE_120_GBPS: return 48; + case IB_RATE_2_5_GBPS: return 1; + case IB_RATE_5_GBPS: return 2; + case IB_RATE_10_GBPS: return 4; + case IB_RATE_20_GBPS: return 8; + case IB_RATE_30_GBPS: return 12; + case IB_RATE_40_GBPS: return 16; + case IB_RATE_60_GBPS: return 24; + case IB_RATE_80_GBPS: return 32; + case IB_RATE_120_GBPS: return 48; + case IB_RATE_14_GBPS: return 6; + case IB_RATE_56_GBPS: return 22; + case IB_RATE_112_GBPS: return 45; + case IB_RATE_168_GBPS: return 67; + case IB_RATE_25_GBPS: return 10; + case IB_RATE_100_GBPS: return 40; + case IB_RATE_200_GBPS: return 80; + case IB_RATE_300_GBPS: return 120; case IB_RATE_28_GBPS: return 11; case IB_RATE_50_GBPS: return 20; case IB_RATE_400_GBPS: return 160; case IB_RATE_600_GBPS: return 240; - default: return -1; + default: return -1; } } EXPORT_SYMBOL(ib_rate_to_mult); @@ -148,15 +156,15 @@ EXPORT_SYMBOL(ib_rate_to_mult); __attribute_const__ enum ib_rate mult_to_ib_rate(int mult) { switch (mult) { - case 1: return IB_RATE_2_5_GBPS; - case 2: return IB_RATE_5_GBPS; - case 4: return IB_RATE_10_GBPS; - case 8: return IB_RATE_20_GBPS; - case 12: return IB_RATE_30_GBPS; - case 16: return IB_RATE_40_GBPS; - case 24: return IB_RATE_60_GBPS; - case 32: return IB_RATE_80_GBPS; - case 48: return IB_RATE_120_GBPS; + case 1: return IB_RATE_2_5_GBPS; + case 2: return IB_RATE_5_GBPS; + case 4: return IB_RATE_10_GBPS; + case 8: return IB_RATE_20_GBPS; + case 12: return IB_RATE_30_GBPS; + case 16: return IB_RATE_40_GBPS; + case 24: return IB_RATE_60_GBPS; + case 32: return IB_RATE_80_GBPS; + case 48: return IB_RATE_120_GBPS; case 6: return IB_RATE_14_GBPS; case 22: return IB_RATE_56_GBPS; case 45: return IB_RATE_112_GBPS; @@ -169,7 +177,7 @@ __attribute_const__ enum ib_rate mult_to_ib_rate(int mult) case 20: return IB_RATE_50_GBPS; case 160: return IB_RATE_400_GBPS; case 240: return IB_RATE_600_GBPS; - default: return IB_RATE_PORT_CURRENT; + default: return IB_RATE_PORT_CURRENT; } } EXPORT_SYMBOL(mult_to_ib_rate); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22C7465ECF6; Mon, 12 Jul 2021 13:09: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 4GNkd64G7yz3RLH; Mon, 12 Jul 2021 13:09: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 6AC42755E; Mon, 12 Jul 2021 13:09: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 16CD9jHN095203; Mon, 12 Jul 2021 13:09:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9jCj095202; Mon, 12 Jul 2021 13:09:45 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:45 GMT Message-Id: <202107121309.16CD9jCj095202@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: 721b795b721b - main - ibcore: Don't allocate method table, if already present. 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: 721b795b721b349db5e6198f8681d5992447c775 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:47 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=721b795b721b349db5e6198f8681d5992447c775 commit 721b795b721b349db5e6198f8681d5992447c775 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:48 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:32 +0000 ibcore: Don't allocate method table, if already present. This commit aligns the code in question with upstream Linux. Linux commit: 2468b82d69e3a53d024f28d79ba0fdb8bf43dfbf MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_mad.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_mad.c b/sys/ofed/drivers/infiniband/core/ib_mad.c index 5b1297fe4cd3..82a3f19d92bb 100644 --- a/sys/ofed/drivers/infiniband/core/ib_mad.c +++ b/sys/ofed/drivers/infiniband/core/ib_mad.c @@ -1554,8 +1554,11 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req, method = &(*vendor_table)->vendor_class[ vclass]->method_table[i]; /* Allocate method table for this OUI */ - if ((ret = allocate_method_table(method))) - goto error3; + if (!*method) { + ret = allocate_method_table(method); + if (ret) + goto error3; + } memcpy((*vendor_table)->vendor_class[vclass]->oui[i], mad_reg_req->oui, 3); goto check_in_use; From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A62E565EDDF; Mon, 12 Jul 2021 13:09: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 4GNkd83z2hz3h4s; Mon, 12 Jul 2021 13:09: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 ADA0D768D; Mon, 12 Jul 2021 13:09: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 16CD9lkl095251; Mon, 12 Jul 2021 13:09:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9l5P095250; Mon, 12 Jul 2021 13:09:47 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:47 GMT Message-Id: <202107121309.16CD9l5P095250@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: 0c13880cccd7 - main - ibcore: Support rate limit for packet pacing 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: 0c13880cccd75655c878ce31e767bce04b1d6e85 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:49 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=0c13880cccd75655c878ce31e767bce04b1d6e85 commit 0c13880cccd75655c878ce31e767bce04b1d6e85 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:49 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:32 +0000 ibcore: Support rate limit for packet pacing Add new member rate_limit to ib_qp_attr which holds the packet pacing rate in kbps, 0 means unlimited. IB_QP_RATE_LIMIT is added to ib_attr_mask and could be used by RAW QPs when changing QP state from RTR to RTS, RTS to RTS. Linux commit: 528e5a1bd3f0e9b760cb3a1062fce7513712a15d MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_verbs.c | 2 ++ sys/ofed/include/rdma/ib_verbs.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_verbs.c b/sys/ofed/drivers/infiniband/core/ib_verbs.c index 9e06d079af31..aabb416ddc21 100644 --- a/sys/ofed/drivers/infiniband/core/ib_verbs.c +++ b/sys/ofed/drivers/infiniband/core/ib_verbs.c @@ -1016,6 +1016,7 @@ static const struct { IB_QP_QKEY), [IB_QPT_GSI] = (IB_QP_CUR_STATE | IB_QP_QKEY), + [IB_QPT_RAW_PACKET] = IB_QP_RATE_LIMIT, } } }, @@ -1049,6 +1050,7 @@ static const struct { IB_QP_QKEY), [IB_QPT_GSI] = (IB_QP_CUR_STATE | IB_QP_QKEY), + [IB_QPT_RAW_PACKET] = IB_QP_RATE_LIMIT, } }, [IB_QPS_SQD] = { diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index b18aa2855166..cdbf2f5ce260 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -1132,6 +1132,7 @@ enum ib_qp_attr_mask { IB_QP_RESERVED2 = (1<<22), IB_QP_RESERVED3 = (1<<23), IB_QP_RESERVED4 = (1<<24), + IB_QP_RATE_LIMIT = (1<<25), }; enum ib_qp_state { @@ -1182,6 +1183,7 @@ struct ib_qp_attr { u8 rnr_retry; u8 alt_port_num; u8 alt_timeout; + u32 rate_limit; }; enum ib_wr_opcode { From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EEA5365EDE1; Mon, 12 Jul 2021 13:09: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 4GNkdB0hdfz3h4x; Mon, 12 Jul 2021 13:09: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 E31AF73B9; Mon, 12 Jul 2021 13:09: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 16CD9m7J095275; Mon, 12 Jul 2021 13:09:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9mep095274; Mon, 12 Jul 2021 13:09:48 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:48 GMT Message-Id: <202107121309.16CD9mep095274@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: d92a9e5604d7 - main - ibcore: Simplify ib_modify_qp_is_ok(). 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: d92a9e5604d7302c349f77c0fde160256aec56ed Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:51 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=d92a9e5604d7302c349f77c0fde160256aec56ed commit d92a9e5604d7302c349f77c0fde160256aec56ed Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:50 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:32 +0000 ibcore: Simplify ib_modify_qp_is_ok(). All callers to ib_modify_qp_is_ok() provides enum ib_qp_state makes the checks of out-of-scope redundant. Let's remove them together with updating function signature to return boolean result. While at it remove unused "ll" parameter from ib_modify_qp_is_ok(). Linux commit: 19b1f54099b6ee334acbfbcfbdffd1d1f057216d d31131bba5a1630304c55ea775c48cc84912ab59 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c | 10 +--------- sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c | 8 +------- sys/dev/mthca/mthca_qp.c | 3 +-- sys/dev/qlnx/qlnxr/qlnxr_verbs.c | 18 ------------------ sys/ofed/drivers/infiniband/core/ib_verbs.c | 19 +++++++------------ sys/ofed/include/rdma/ib_verbs.h | 6 ++---- 6 files changed, 12 insertions(+), 52 deletions(-) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c index 3b81797b46b0..280ab6359dd1 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c @@ -2163,21 +2163,13 @@ static int _mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, struct mlx4_ib_qp *qp = to_mqp(ibqp); enum ib_qp_state cur_state, new_state; int err = -EINVAL; - int ll; mutex_lock(&qp->mutex); cur_state = attr_mask & IB_QP_CUR_STATE ? attr->cur_qp_state : qp->state; new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state; - if (cur_state == new_state && cur_state == IB_QPS_RESET) { - ll = IB_LINK_LAYER_UNSPECIFIED; - } else { - int port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port; - ll = rdma_port_get_link_layer(&dev->ib_dev, port); - } - if (!ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type, - attr_mask, ll)) { + attr_mask)) { pr_debug("qpn 0x%x: invalid attribute mask specified " "for transition %d to %d. qp_type %d," " attr_mask 0x%x\n", diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c index 8f05b32a3261..54a091548faf 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c @@ -2922,7 +2922,6 @@ int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, enum ib_qp_state cur_state, new_state; int err = -EINVAL; int port; - enum rdma_link_layer ll = IB_LINK_LAYER_UNSPECIFIED; if (ibqp->rwq_ind_tbl) return -ENOSYS; @@ -2938,13 +2937,8 @@ int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, cur_state = attr_mask & IB_QP_CUR_STATE ? attr->cur_qp_state : qp->state; new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state; - if (!(cur_state == new_state && cur_state == IB_QPS_RESET)) { - port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port; - ll = dev->ib_dev.get_link_layer(&dev->ib_dev, port); - } - if (qp_type != MLX5_IB_QPT_REG_UMR && - !ib_modify_qp_is_ok(cur_state, new_state, qp_type, attr_mask, ll)) { + !ib_modify_qp_is_ok(cur_state, new_state, qp_type, attr_mask)) { mlx5_ib_dbg(dev, "invalid QP state transition from %d to %d, qp_type %d, attr_mask 0x%x\n", cur_state, new_state, ibqp->qp_type, attr_mask); goto out; diff --git a/sys/dev/mthca/mthca_qp.c b/sys/dev/mthca/mthca_qp.c index 33d61d29bbe5..b726450ba4aa 100644 --- a/sys/dev/mthca/mthca_qp.c +++ b/sys/dev/mthca/mthca_qp.c @@ -860,8 +860,7 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state; - if (!ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type, attr_mask, - IB_LINK_LAYER_UNSPECIFIED)) { + if (!ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type, attr_mask)) { mthca_dbg(dev, "Bad QP transition (transport %d) " "%d->%d with attr 0x%08x\n", qp->transport, cur_state, new_state, diff --git a/sys/dev/qlnx/qlnxr/qlnxr_verbs.c b/sys/dev/qlnx/qlnxr/qlnxr_verbs.c index 9c0087c1b76d..861db52044f8 100644 --- a/sys/dev/qlnx/qlnxr/qlnxr_verbs.c +++ b/sys/dev/qlnx/qlnxr/qlnxr_verbs.c @@ -3543,22 +3543,6 @@ qlnxr_modify_qp(struct ib_qp *ibqp, new_qp_state = old_qp_state; if (QLNX_IS_ROCE(dev)) { -#if __FreeBSD_version >= 1100000 - if (!ib_modify_qp_is_ok(old_qp_state, - new_qp_state, - ibqp->qp_type, - attr_mask, - IB_LINK_LAYER_ETHERNET)) { - QL_DPRINT12(ha, - "invalid attribute mask=0x%x" - " specified for qpn=0x%x of type=0x%x \n" - " old_qp_state=0x%x, new_qp_state=0x%x\n", - attr_mask, qp->qp_id, ibqp->qp_type, - old_qp_state, new_qp_state); - rc = -EINVAL; - goto err; - } -#else if (!ib_modify_qp_is_ok(old_qp_state, new_qp_state, ibqp->qp_type, @@ -3572,8 +3556,6 @@ qlnxr_modify_qp(struct ib_qp *ibqp, rc = -EINVAL; goto err; } - -#endif /* #if __FreeBSD_version >= 1100000 */ } /* translate the masks... */ if (attr_mask & IB_QP_STATE) { diff --git a/sys/ofed/drivers/infiniband/core/ib_verbs.c b/sys/ofed/drivers/infiniband/core/ib_verbs.c index aabb416ddc21..32be78f118b5 100644 --- a/sys/ofed/drivers/infiniband/core/ib_verbs.c +++ b/sys/ofed/drivers/infiniband/core/ib_verbs.c @@ -1169,34 +1169,29 @@ static const struct { } }; -int ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state next_state, - enum ib_qp_type type, enum ib_qp_attr_mask mask, - enum rdma_link_layer ll) +bool ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state next_state, + enum ib_qp_type type, enum ib_qp_attr_mask mask) { enum ib_qp_attr_mask req_param, opt_param; - if (cur_state < 0 || cur_state > IB_QPS_ERR || - next_state < 0 || next_state > IB_QPS_ERR) - return 0; - if (mask & IB_QP_CUR_STATE && cur_state != IB_QPS_RTR && cur_state != IB_QPS_RTS && cur_state != IB_QPS_SQD && cur_state != IB_QPS_SQE) - return 0; + return false; if (!qp_state_table[cur_state][next_state].valid) - return 0; + return false; req_param = qp_state_table[cur_state][next_state].req_param[type]; opt_param = qp_state_table[cur_state][next_state].opt_param[type]; if ((mask & req_param) != req_param) - return 0; + return false; if (mask & ~(req_param | opt_param | IB_QP_STATE)) - return 0; + return false; - return 1; + return true; } EXPORT_SYMBOL(ib_modify_qp_is_ok); diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index cdbf2f5ce260..353181a8d790 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -2220,7 +2220,6 @@ static inline bool ib_is_udata_cleared(struct ib_udata *udata, * @next_state: Next QP state * @type: QP type * @mask: Mask of supplied QP attributes - * @ll : link layer of port * * This function is a helper function that a low-level driver's * modify_qp method can use to validate the consumer's input. It @@ -2228,9 +2227,8 @@ static inline bool ib_is_udata_cleared(struct ib_udata *udata, * transition from cur_state to next_state is allowed by the IB spec, * and that the attribute mask supplied is allowed for the transition. */ -int ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state next_state, - enum ib_qp_type type, enum ib_qp_attr_mask mask, - enum rdma_link_layer ll); +bool ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state next_state, + enum ib_qp_type type, enum ib_qp_attr_mask mask); int ib_register_event_handler (struct ib_event_handler *event_handler); int ib_unregister_event_handler(struct ib_event_handler *event_handler); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D5F5265EFA0; Mon, 12 Jul 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 4GNkdF31dVz3h2g; Mon, 12 Jul 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 2CAC7768E; Mon, 12 Jul 2021 13:09: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 16CD9pEa095329; Mon, 12 Jul 2021 13:09:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9pQh095328; Mon, 12 Jul 2021 13:09:51 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:51 GMT Message-Id: <202107121309.16CD9pQh095328@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: 79b817084ca8 - main - ibcore: Implement ib_uverbs_get_ucontext_file(). 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: 79b817084ca891e465fe1a868ef1d9f1a3f33a69 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:54 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=79b817084ca891e465fe1a868ef1d9f1a3f33a69 commit 79b817084ca891e465fe1a868ef1d9f1a3f33a69 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:51 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:33 +0000 ibcore: Implement ib_uverbs_get_ucontext_file(). Expose ib_ucontext from a given ib_uverbs_file. Drivers that use the ioctl(9) API may have the ib_uverbs_file and need a way to get the related ib_ucontext from it, this is enabled by this patch. Downstream patches from this series will use it. Linux commit: 7dc08dcfc8c86cb4457e383734ff6844ddaff876 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_uverbs_main.c | 24 +++++++++++++++++++++++ sys/ofed/include/rdma/ib_verbs.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c index dff566e71f99..38016681b819 100644 --- a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c +++ b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c @@ -146,6 +146,30 @@ static int (*uverbs_ex_cmd_table[])(struct ib_uverbs_file *file, static void ib_uverbs_add_one(struct ib_device *device); static void ib_uverbs_remove_one(struct ib_device *device, void *client_data); +/* + * Must be called with the ufile->device->disassociate_srcu held, and the lock + * must be held until use of the ucontext is finished. + */ +struct ib_ucontext *ib_uverbs_get_ucontext_file(struct ib_uverbs_file *ufile) +{ + /* + * We do not hold the hw_destroy_rwsem lock for this flow, instead + * srcu is used. It does not matter if someone races this with + * get_context, we get NULL or valid ucontext. + */ + struct ib_ucontext *ucontext = READ_ONCE(ufile->ucontext); + + if (!srcu_dereference(ufile->device->ib_dev, + &ufile->device->disassociate_srcu)) + return ERR_PTR(-EIO); + + if (!ucontext) + return ERR_PTR(-EINVAL); + + return ucontext; +} +EXPORT_SYMBOL(ib_uverbs_get_ucontext_file); + int uverbs_dealloc_mw(struct ib_mw *mw) { struct ib_pd *pd = mw->pd; diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index 353181a8d790..da17bc9f8250 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -67,6 +67,7 @@ struct ifla_vf_info; struct ifla_vf_stats; +struct ib_uverbs_file; extern struct workqueue_struct *ib_wq; extern struct workqueue_struct *ib_comp_wq; @@ -3390,6 +3391,8 @@ void ib_drain_rq(struct ib_qp *qp); void ib_drain_sq(struct ib_qp *qp); void ib_drain_qp(struct ib_qp *qp); +struct ib_ucontext *ib_uverbs_get_ucontext_file(struct ib_uverbs_file *ufile); + int ib_resolve_eth_dmac(struct ib_device *device, struct ib_ah_attr *ah_attr); #endif /* IB_VERBS_H */ From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA8E765F089; Mon, 12 Jul 2021 13:09: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 4GNkdC134nz3h08; Mon, 12 Jul 2021 13:09: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 03F857366; Mon, 12 Jul 2021 13:09: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 16CD9nrK095304; Mon, 12 Jul 2021 13:09:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9nRi095303; Mon, 12 Jul 2021 13:09:49 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:49 GMT Message-Id: <202107121309.16CD9nRi095303@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: 05f4691919d6 - main - ibcore: Clean up INIT_UDATA() and INIT_UDATA_BUF_OR_NULL() macro 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: 05f4691919d6d0219795a1ca8ad84dd82d87b1cf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:52 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=05f4691919d6d0219795a1ca8ad84dd82d87b1cf commit 05f4691919d6d0219795a1ca8ad84dd82d87b1cf Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:51 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:32 +0000 ibcore: Clean up INIT_UDATA() and INIT_UDATA_BUF_OR_NULL() macro usage. We get a harmless warning about the fact that we use the result of a multiplication as a condition in INIT_UDATA_BUF_OR_NULL(): uverbs_main.c: In function 'ib_uverbs_write': error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context] This avoids the problem by using an inline function in place of the macro. After changing INIT_UDATA_BUF_OR_NULL() to an inline function, do the same change to INIT_UDATA() for consistency. Using an inline function gives us better type safety here among other issues with macros. I'm using u64_to_user_ptr() to convert the user pointer to simplify the logic rather than adding lots of new type casts. Linux commit: 12f727721eee61b3d19dedb95cb893b2baa9fe41 40a203396cc1c239f2e71c47c66ed03097123d2c MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c | 63 ++++++++++++----------- sys/ofed/drivers/infiniband/core/ib_uverbs_main.c | 7 +-- sys/ofed/drivers/infiniband/core/uverbs.h | 37 +++++++------ 3 files changed, 57 insertions(+), 50 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c b/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c index 46edd7b28580..dcc73dc5848e 100644 --- a/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c +++ b/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c @@ -339,8 +339,8 @@ ssize_t ib_uverbs_get_context(struct ib_uverbs_file *file, goto err; } - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd, out_len - sizeof resp); ucontext = ib_dev->alloc_ucontext(ib_dev, &udata); @@ -560,8 +560,8 @@ ssize_t ib_uverbs_alloc_pd(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd, out_len - sizeof resp); uobj = kmalloc(sizeof *uobj, GFP_KERNEL); @@ -768,8 +768,8 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd, out_len - sizeof resp); mutex_lock(&file->device->xrcd_tree_mutex); @@ -978,8 +978,8 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd, out_len - sizeof resp); if ((cmd.start & ~PAGE_MASK) != (cmd.hca_va & ~PAGE_MASK)) @@ -1085,8 +1085,8 @@ ssize_t ib_uverbs_rereg_mr(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof(cmd))) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof(cmd), - (unsigned long) cmd.response + sizeof(resp), + ib_uverbs_init_udata(&udata, buf + sizeof(cmd), + u64_to_user_ptr(cmd.response + sizeof(resp)), in_len - sizeof(cmd), out_len - sizeof(resp)); if (cmd.flags & ~IB_MR_REREG_SUPPORTED || !cmd.flags) @@ -1225,8 +1225,8 @@ ssize_t ib_uverbs_alloc_mw(struct ib_uverbs_file *file, goto err_free; } - INIT_UDATA(&udata, buf + sizeof(cmd), - (unsigned long)cmd.response + sizeof(resp), + ib_uverbs_init_udata(&udata, buf + sizeof(cmd), + u64_to_user_ptr(cmd.response + sizeof(resp)), in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr), out_len - sizeof(resp)); @@ -1494,10 +1494,11 @@ ssize_t ib_uverbs_create_cq(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof(cmd))) return -EFAULT; - INIT_UDATA(&ucore, buf, (unsigned long)cmd.response, sizeof(cmd), sizeof(resp)); + ib_uverbs_init_udata(&ucore, buf, + u64_to_user_ptr(cmd.response), sizeof(cmd), sizeof(resp)); - INIT_UDATA(&uhw, buf + sizeof(cmd), - (unsigned long)cmd.response + sizeof(resp), + ib_uverbs_init_udata(&uhw, buf + sizeof(cmd), + u64_to_user_ptr(cmd.response + sizeof(resp)), in_len - sizeof(cmd), out_len - sizeof(resp)); memset(&cmd_ex, 0, sizeof(cmd_ex)); @@ -1579,8 +1580,8 @@ ssize_t ib_uverbs_resize_cq(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd, out_len - sizeof resp); cq = idr_read_cq(cmd.cq_handle, file->ucontext, 0); @@ -2050,10 +2051,10 @@ ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof(cmd))) return -EFAULT; - INIT_UDATA(&ucore, buf, (unsigned long)cmd.response, sizeof(cmd), - resp_size); - INIT_UDATA(&uhw, buf + sizeof(cmd), - (unsigned long)cmd.response + resp_size, + ib_uverbs_init_udata(&ucore, buf, + u64_to_user_ptr(cmd.response), sizeof(cmd), resp_size); + ib_uverbs_init_udata(&uhw, buf + sizeof(cmd), + u64_to_user_ptr(cmd.response + resp_size), in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr), out_len - resp_size); @@ -2150,8 +2151,8 @@ ssize_t ib_uverbs_open_qp(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd, out_len - sizeof resp); obj = kmalloc(sizeof *obj, GFP_KERNEL); @@ -2354,7 +2355,7 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd, out_len); attr = kmalloc(sizeof *attr, GFP_KERNEL); @@ -2919,8 +2920,8 @@ ssize_t ib_uverbs_create_ah(struct ib_uverbs_file *file, if (!rdma_is_port_valid(ib_dev, cmd.attr.port_num)) return -EINVAL; - INIT_UDATA(&udata, buf + sizeof(cmd), - (unsigned long)cmd.response + sizeof(resp), + ib_uverbs_init_udata(&udata, buf + sizeof(cmd), + u64_to_user_ptr(cmd.response + sizeof(resp)), in_len - sizeof(cmd), out_len - sizeof(resp)); uobj = kmalloc(sizeof *uobj, GFP_KERNEL); @@ -4045,8 +4046,8 @@ ssize_t ib_uverbs_create_srq(struct ib_uverbs_file *file, xcmd.max_sge = cmd.max_sge; xcmd.srq_limit = cmd.srq_limit; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd - sizeof(struct ib_uverbs_cmd_hdr), out_len - sizeof resp); @@ -4072,8 +4073,8 @@ ssize_t ib_uverbs_create_xsrq(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd - sizeof(struct ib_uverbs_cmd_hdr), out_len - sizeof resp); @@ -4098,7 +4099,7 @@ ssize_t ib_uverbs_modify_srq(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd, out_len); srq = idr_read_srq(cmd.srq_handle, file->ucontext); diff --git a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c index e1b560774fbc..dff566e71f99 100644 --- a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c +++ b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c @@ -868,12 +868,13 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf, } } - INIT_UDATA_BUF_OR_NULL(&ucore, buf, (unsigned long) ex_hdr.response, + ib_uverbs_init_udata_buf_or_null(&ucore, buf, + u64_to_user_ptr(ex_hdr.response), hdr.in_words * 8, hdr.out_words * 8); - INIT_UDATA_BUF_OR_NULL(&uhw, + ib_uverbs_init_udata_buf_or_null(&uhw, buf + ucore.inlen, - (unsigned long) ex_hdr.response + ucore.outlen, + u64_to_user_ptr(ex_hdr.response + ucore.outlen), ex_hdr.provider_in_words * 8, ex_hdr.provider_out_words * 8); diff --git a/sys/ofed/drivers/infiniband/core/uverbs.h b/sys/ofed/drivers/infiniband/core/uverbs.h index 0db0d47cc691..9f2a519fa259 100644 --- a/sys/ofed/drivers/infiniband/core/uverbs.h +++ b/sys/ofed/drivers/infiniband/core/uverbs.h @@ -54,23 +54,28 @@ #include #include -#define INIT_UDATA(udata, ibuf, obuf, ilen, olen) \ - do { \ - (udata)->inbuf = (const void __user *) (ibuf); \ - (udata)->outbuf = (void __user *) (obuf); \ - (udata)->inlen = (ilen); \ - (udata)->outlen = (olen); \ - } while (0) +static inline void +ib_uverbs_init_udata(struct ib_udata *udata, + const void __user *ibuf, + void __user *obuf, + size_t ilen, size_t olen) +{ + udata->inbuf = ibuf; + udata->outbuf = obuf; + udata->inlen = ilen; + udata->outlen = olen; +} -#define INIT_UDATA_BUF_OR_NULL(udata, ibuf, obuf, ilen, olen) \ - do { \ - (udata)->inbuf = ((ilen) != 0) ? \ - (const void __user *) (ibuf) : NULL; \ - (udata)->outbuf = ((olen) != 0) ? \ - (void __user *) (obuf) : NULL; \ - (udata)->inlen = (ilen); \ - (udata)->outlen = (olen); \ - } while (0) +static inline void +ib_uverbs_init_udata_buf_or_null(struct ib_udata *udata, + const void __user *ibuf, + void __user *obuf, + size_t ilen, size_t olen) +{ + ib_uverbs_init_udata(udata, + ilen ? ibuf : NULL, olen ? obuf : NULL, + ilen, olen); +} /* * Our lifetime rules for these structs are the following: From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 19CD865EADA; Mon, 12 Jul 2021 13:09: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 4GNkdG3XDQz3RFl; Mon, 12 Jul 2021 13:09: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 528AF72E1; Mon, 12 Jul 2021 13:09: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 16CD9qc1095353; Mon, 12 Jul 2021 13:09:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9qkN095352; Mon, 12 Jul 2021 13:09:52 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:52 GMT Message-Id: <202107121309.16CD9qkN095352@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: 915fc66cb59f - main - mlx5: Add new timestamp mode bits. 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: 915fc66cb59faa543b852083233729c270d5aa3b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:55 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=915fc66cb59faa543b852083233729c270d5aa3b commit 915fc66cb59faa543b852083233729c270d5aa3b Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:52 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:33 +0000 mlx5: Add new timestamp mode bits. These fields declare which timestamp mode is supported by the device per RQ/SQ/QP. In addition add the ts_format field to the select the mode for RQ/SQ/QP. Linux commit: a6a217dddcd544f6b75f0e2a60b6e84c1d494b7e MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_ifc.h | 56 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index 494180630500..ce8074fba3f1 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -914,13 +914,19 @@ enum { MLX5_ROCE_CAP_L3_TYPE_IPV6 = 0x4, }; +enum { + MLX5_QP_TIMESTAMP_FORMAT_CAP_FREE_RUNNING = 0x0, + MLX5_QP_TIMESTAMP_FORMAT_CAP_REAL_TIME = 0x1, + MLX5_QP_TIMESTAMP_FORMAT_CAP_FREE_RUNNING_AND_REAL_TIME = 0x2, +}; + struct mlx5_ifc_roce_cap_bits { u8 roce_apm[0x1]; u8 rts2rts_primary_eth_prio[0x1]; u8 roce_rx_allow_untagged[0x1]; u8 rts2rts_src_addr_index_for_vlan_valid_vlan_id[0x1]; - - u8 reserved_0[0x1c]; + u8 reserved_at_4[0x1a]; + u8 qp_ts_format[0x2]; u8 reserved_1[0x60]; @@ -1037,6 +1043,18 @@ enum { MLX5_CMD_HCA_CAP_CMDIF_CHECKSUM_ENABLED = 0x3, }; +enum { + MLX5_SQ_TIMESTAMP_FORMAT_CAP_FREE_RUNNING = 0x0, + MLX5_SQ_TIMESTAMP_FORMAT_CAP_REAL_TIME = 0x1, + MLX5_SQ_TIMESTAMP_FORMAT_CAP_FREE_RUNNING_AND_REAL_TIME = 0x2, +}; + +enum { + MLX5_RQ_TIMESTAMP_FORMAT_CAP_FREE_RUNNING = 0x0, + MLX5_RQ_TIMESTAMP_FORMAT_CAP_REAL_TIME = 0x1, + MLX5_RQ_TIMESTAMP_FORMAT_CAP_FREE_RUNNING_AND_REAL_TIME = 0x2, +}; + struct mlx5_ifc_cmd_hca_cap_bits { u8 reserved_0[0x80]; @@ -1274,7 +1292,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 general_obj_types[0x40]; - u8 reserved_at_440[0x8]; + u8 sq_ts_format[0x2]; + u8 rq_ts_format[0x2]; + u8 reserved_at_444[0x4]; u8 create_qp_start_hint[0x18]; u8 reserved_at_460[0x3]; @@ -1961,6 +1981,12 @@ enum { MLX5_QPC_CS_RES_UP_TO_64B = 0x2, }; +enum { + MLX5_QPC_TIMESTAMP_FORMAT_FREE_RUNNING = 0x0, + MLX5_QPC_TIMESTAMP_FORMAT_DEFAULT = 0x1, + MLX5_QPC_TIMESTAMP_FORMAT_REAL_TIME = 0x2, +}; + struct mlx5_ifc_qpc_bits { u8 state[0x4]; u8 lag_tx_port_affinity[0x4]; @@ -1987,7 +2013,9 @@ struct mlx5_ifc_qpc_bits { u8 log_rq_stride[0x3]; u8 no_sq[0x1]; u8 log_sq_size[0x4]; - u8 reserved_7[0x6]; + u8 reserved_at_55[0x3]; + u8 ts_format[0x2]; + u8 reserved_at_5a[0x1]; u8 rlky[0x1]; u8 ulp_stateless_offload_mode[0x4]; @@ -2376,6 +2404,12 @@ enum { MLX5_SQC_STATE_ERR = 0x3, }; +enum { + MLX5_SQC_TIMESTAMP_FORMAT_FREE_RUNNING = 0x0, + MLX5_SQC_TIMESTAMP_FORMAT_DEFAULT = 0x1, + MLX5_SQC_TIMESTAMP_FORMAT_REAL_TIME = 0x2, +}; + struct mlx5_ifc_sqc_bits { u8 rlkey[0x1]; u8 cd_master[0x1]; @@ -2386,7 +2420,9 @@ struct mlx5_ifc_sqc_bits { u8 state[0x4]; u8 reg_umr[0x1]; u8 allow_swp[0x1]; - u8 reserved_0[0x12]; + u8 reserved_at_e[0xc]; + u8 ts_format[0x2]; + u8 reserved_at_1c[0x4]; u8 reserved_1[0x8]; u8 user_index[0x18]; @@ -2492,6 +2528,12 @@ enum { MLX5_RQC_DROPLESS_MODE_ENABLE = 0x1, }; +enum { + MLX5_RQC_TIMESTAMP_FORMAT_FREE_RUNNING = 0x0, + MLX5_RQC_TIMESTAMP_FORMAT_DEFAULT = 0x1, + MLX5_RQC_TIMESTAMP_FORMAT_REAL_TIME = 0x2, +}; + struct mlx5_ifc_rqc_bits { u8 rlkey[0x1]; u8 delay_drop_en[0x1]; @@ -2501,7 +2543,9 @@ struct mlx5_ifc_rqc_bits { u8 state[0x4]; u8 reserved_1[0x1]; u8 flush_in_error_en[0x1]; - u8 reserved_2[0x12]; + u8 reserved_at_e[0xc]; + u8 ts_format[0x2]; + u8 reserved_at_1c[0x4]; u8 reserved_3[0x8]; u8 user_index[0x18]; From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C8E665EF44; Mon, 12 Jul 2021 13:09: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 4GNkdH41F9z3h5C; Mon, 12 Jul 2021 13:09: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 6E63B72E2; Mon, 12 Jul 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 16CD9ruj095377; Mon, 12 Jul 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 16CD9r1C095376; Mon, 12 Jul 2021 13:09:53 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:53 GMT Message-Id: <202107121309.16CD9r1C095376@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: 4fb0a74e0817 - main - mlx5: Set default timestamp format for mlx5en(4) and mlx5ib. 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: 4fb0a74e081772fc6fc2a43222ee072fd089bf5f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:56 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=4fb0a74e081772fc6fc2a43222ee072fd089bf5f commit 4fb0a74e081772fc6fc2a43222ee072fd089bf5f Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:53 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:33 +0000 mlx5: Set default timestamp format for mlx5en(4) and mlx5ib. MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/driver.h | 21 +++++++++++++++++++++ sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 7 ++++++- sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c | 14 +++++++++++++- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/driver.h b/sys/dev/mlx5/driver.h index 5d4f58d7e1fd..c36380505fbb 100644 --- a/sys/dev/mlx5/driver.h +++ b/sys/dev/mlx5/driver.h @@ -1202,4 +1202,25 @@ static inline bool mlx5_rl_is_supported(struct mlx5_core_dev *dev) void mlx5_disable_interrupts(struct mlx5_core_dev *); void mlx5_poll_interrupts(struct mlx5_core_dev *); +static inline int mlx5_get_qp_default_ts(struct mlx5_core_dev *dev) +{ + return !MLX5_CAP_ROCE(dev, qp_ts_format) ? + MLX5_QPC_TIMESTAMP_FORMAT_FREE_RUNNING : + MLX5_QPC_TIMESTAMP_FORMAT_DEFAULT; +} + +static inline int mlx5_get_rq_default_ts(struct mlx5_core_dev *dev) +{ + return !MLX5_CAP_GEN(dev, rq_ts_format) ? + MLX5_RQC_TIMESTAMP_FORMAT_FREE_RUNNING : + MLX5_RQC_TIMESTAMP_FORMAT_DEFAULT; +} + +static inline int mlx5_get_sq_default_ts(struct mlx5_core_dev *dev) +{ + return !MLX5_CAP_GEN(dev, sq_ts_format) ? + MLX5_SQC_TIMESTAMP_FORMAT_FREE_RUNNING : + MLX5_SQC_TIMESTAMP_FORMAT_DEFAULT; +} + #endif /* MLX5_DRIVER_H */ diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 57da44e68de3..fc9ffc01a0df 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1350,12 +1350,12 @@ mlx5e_enable_rq(struct mlx5e_rq *rq, struct mlx5e_rq_param *param) struct mlx5e_channel *c = rq->channel; struct mlx5e_priv *priv = c->priv; struct mlx5_core_dev *mdev = priv->mdev; - void *in; void *rqc; void *wq; int inlen; int err; + u8 ts_format; inlen = MLX5_ST_SZ_BYTES(create_rq_in) + sizeof(u64) * rq->wq_ctrl.buf.npages; @@ -1363,6 +1363,7 @@ mlx5e_enable_rq(struct mlx5e_rq *rq, struct mlx5e_rq_param *param) if (in == NULL) return (-ENOMEM); + ts_format = mlx5_get_rq_default_ts(mdev); rqc = MLX5_ADDR_OF(create_rq_in, in, ctx); wq = MLX5_ADDR_OF(rqc, rqc, wq); @@ -1370,6 +1371,7 @@ mlx5e_enable_rq(struct mlx5e_rq *rq, struct mlx5e_rq_param *param) MLX5_SET(rqc, rqc, cqn, c->rq.cq.mcq.cqn); MLX5_SET(rqc, rqc, state, MLX5_RQC_STATE_RST); + MLX5_SET(rqc, rqc, ts_format, ts_format); MLX5_SET(rqc, rqc, flush_in_error_en, 1); if (priv->counter_set_id >= 0) MLX5_SET(rqc, rqc, counter_set_id, priv->counter_set_id); @@ -1673,6 +1675,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, void *wq; int inlen; int err; + u8 ts_format; inlen = MLX5_ST_SZ_BYTES(create_sq_in) + sizeof(u64) * sq->wq_ctrl.buf.npages; @@ -1680,6 +1683,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, if (in == NULL) return (-ENOMEM); + ts_format = mlx5_get_sq_default_ts(sq->priv->mdev); sqc = MLX5_ADDR_OF(create_sq_in, in, ctx); wq = MLX5_ADDR_OF(sqc, sqc, wq); @@ -1688,6 +1692,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, MLX5_SET(sqc, sqc, tis_num_0, tis_num); MLX5_SET(sqc, sqc, cqn, sq->cq.mcq.cqn); MLX5_SET(sqc, sqc, state, MLX5_SQC_STATE_RST); + MLX5_SET(sqc, sqc, ts_format, ts_format); MLX5_SET(sqc, sqc, tis_lst_sz, 1); MLX5_SET(sqc, sqc, flush_in_error_en, 1); MLX5_SET(sqc, sqc, allow_swp, 1); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c index 54a091548faf..ec47b3e07b87 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2020, Mellanox Technologies. All rights reserved. + * Copyright (c) 2013-2021, Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -962,6 +962,7 @@ static int create_kernel_qp(struct mlx5_ib_dev *dev, qpc = MLX5_ADDR_OF(create_qp_in, *in, qpc); MLX5_SET(qpc, qpc, uar_page, uar_index); + MLX5_SET(qpc, qpc, ts_format, mlx5_get_qp_default_ts(dev->mdev)); MLX5_SET(qpc, qpc, log_page_size, qp->buf.page_shift - MLX5_ADAPTER_PAGE_SHIFT); /* Set "fast registration enabled" for all kernel QPs */ @@ -1075,6 +1076,9 @@ static int create_raw_packet_qp_sq(struct mlx5_ib_dev *dev, int npages; int ncont = 0; u32 offset = 0; + u8 ts_format; + + ts_format = mlx5_get_sq_default_ts(dev->mdev); err = mlx5_ib_umem_get(dev, pd, ubuffer->buf_addr, ubuffer->buf_size, &sq->ubuffer.umem, &npages, &page_shift, @@ -1092,6 +1096,7 @@ static int create_raw_packet_qp_sq(struct mlx5_ib_dev *dev, sqc = MLX5_ADDR_OF(create_sq_in, in, ctx); MLX5_SET(sqc, sqc, flush_in_error_en, 1); MLX5_SET(sqc, sqc, state, MLX5_SQC_STATE_RST); + MLX5_SET(sqc, sqc, ts_format, ts_format); MLX5_SET(sqc, sqc, user_index, MLX5_GET(qpc, qpc, user_index)); MLX5_SET(sqc, sqc, cqn, MLX5_GET(qpc, qpc, cqn_snd)); MLX5_SET(sqc, sqc, tis_lst_sz, 1); @@ -1161,6 +1166,9 @@ static int create_raw_packet_qp_rq(struct mlx5_ib_dev *dev, int inlen; int err; u32 rq_pas_size = get_rq_pas_size(qpc); + u8 ts_format; + + ts_format = mlx5_get_rq_default_ts(dev->mdev); inlen = MLX5_ST_SZ_BYTES(create_rq_in) + rq_pas_size; in = mlx5_vzalloc(inlen); @@ -1171,6 +1179,7 @@ static int create_raw_packet_qp_rq(struct mlx5_ib_dev *dev, MLX5_SET(rqc, rqc, vlan_strip_disable, 1); MLX5_SET(rqc, rqc, mem_rq_type, MLX5_RQC_RQ_TYPE_MEMORY_RQ_INLINE); MLX5_SET(rqc, rqc, state, MLX5_RQC_STATE_RST); + MLX5_SET(rqc, rqc, ts_format, ts_format); MLX5_SET(rqc, rqc, flush_in_error_en, 1); MLX5_SET(rqc, rqc, user_index, MLX5_GET(qpc, qpc, user_index)); MLX5_SET(rqc, rqc, cqn, MLX5_GET(qpc, qpc, cqn_rcv)); @@ -1754,6 +1763,9 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, MLX5_SET(qpc, qpc, log_rq_size, ilog2(qp->rq.wqe_cnt)); } + if (init_attr->qp_type != IB_QPT_RAW_PACKET) + MLX5_SET(qpc, qpc, ts_format, mlx5_get_qp_default_ts(dev->mdev)); + MLX5_SET(qpc, qpc, rq_type, get_rx_type(qp, init_attr)); if (qp->sq.wqe_cnt) From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 435A165EFAB; Mon, 12 Jul 2021 13:09: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 4GNkdJ3TcTz3hCS; Mon, 12 Jul 2021 13:09: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 975D27560; Mon, 12 Jul 2021 13:09: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 16CD9saB095401; Mon, 12 Jul 2021 13:09:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9sd9095400; Mon, 12 Jul 2021 13:09:54 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:54 GMT Message-Id: <202107121309.16CD9sd9095400@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: c3987b8ea793 - main - ibcore: Declare ib_post_send() and ib_post_recv() arguments const 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: c3987b8ea793c11f61fecb14ef93195a23e3522c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:57 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c3987b8ea793c11f61fecb14ef93195a23e3522c commit c3987b8ea793c11f61fecb14ef93195a23e3522c Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:54 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:33 +0000 ibcore: Declare ib_post_send() and ib_post_recv() arguments const Since neither ib_post_send() nor ib_post_recv() modify the data structure their second argument points at, declare that argument const. This change makes it necessary to declare the 'bad_wr' argument const too and also to modify all ULPs that call ib_post_send(), ib_post_recv() or ib_post_srq_recv(). This patch does not change any functionality but makes it possible for the compiler to verify whether the ib_post_(send|recv|srq_recv) really do not modify the posted work request. Linux commit: f696bf6d64b195b83ca1bdb7cd33c999c9dcf514 7bb1fafc2f163ad03a2007295bb2f57cfdbfb630 d34ac5cd3a73aacd11009c4fc3ba15d7ea62c411 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/contrib/rdma/krping/krping.c | 42 +++++++------- sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h | 8 +-- sys/dev/cxgbe/iw_cxgbe/qp.c | 28 +++++----- sys/dev/iser/iser_memory.c | 3 +- sys/dev/iser/iser_verbs.c | 13 +++-- sys/dev/mlx4/mlx4_ib/mlx4_ib.h | 12 ++-- sys/dev/mlx4/mlx4_ib/mlx4_ib_mad.c | 7 ++- sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c | 28 +++++----- sys/dev/mlx4/mlx4_ib/mlx4_ib_srq.c | 4 +- sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 22 ++++---- sys/dev/mlx5/mlx5_ib/mlx5_ib_gsi.c | 8 +-- sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c | 43 +++++++-------- sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c | 70 +++++++++++++----------- sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c | 4 +- sys/dev/mthca/mthca_dev.h | 24 ++++---- sys/dev/mthca/mthca_qp.c | 24 ++++---- sys/dev/mthca/mthca_srq.c | 8 +-- sys/dev/qlnx/qlnxr/qlnxr_cm.c | 12 ++-- sys/dev/qlnx/qlnxr/qlnxr_cm.h | 8 +-- sys/dev/qlnx/qlnxr/qlnxr_verbs.c | 34 ++++++------ sys/dev/qlnx/qlnxr/qlnxr_verbs.h | 12 ++-- sys/ofed/drivers/infiniband/core/ib_mad.c | 9 +-- sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c | 9 ++- sys/ofed/drivers/infiniband/core/ib_verbs.c | 5 +- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c | 4 +- sys/ofed/include/rdma/ib_verbs.h | 34 ++++++------ 26 files changed, 245 insertions(+), 230 deletions(-) diff --git a/sys/contrib/rdma/krping/krping.c b/sys/contrib/rdma/krping/krping.c index 75c874411bb3..da0a03af42cd 100644 --- a/sys/contrib/rdma/krping/krping.c +++ b/sys/contrib/rdma/krping/krping.c @@ -358,7 +358,7 @@ static void krping_cq_event_handler(struct ib_cq *cq, void *ctx) { struct krping_cb *cb = ctx; struct ib_wc wc; - struct ib_recv_wr *bad_wr; + const struct ib_recv_wr *bad_wr; int ret; BUG_ON(cb->cq != cq); @@ -705,7 +705,7 @@ err1: static u32 krping_rdma_rkey(struct krping_cb *cb, u64 buf, int post_inv) { u32 rkey; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; int ret; struct scatterlist sg = {0}; @@ -772,7 +772,8 @@ static void krping_format_send(struct krping_cb *cb, u64 buf) static void krping_test_server(struct krping_cb *cb) { - struct ib_send_wr *bad_wr, inv; + const struct ib_send_wr *bad_wr; + struct ib_send_wr inv; int ret; while (1) { @@ -913,7 +914,7 @@ static void rlat_test(struct krping_cb *cb) struct timeval start_tv, stop_tv; int ret; struct ib_wc wc; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; int ne; scnt = 0; @@ -1054,7 +1055,7 @@ static void wlat_test(struct krping_cb *cb) } if (scnt < iters) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; *buf = (char)scnt+1; if (scnt < cycle_iters) @@ -1187,7 +1188,7 @@ static void bw_test(struct krping_cb *cb) while (scnt < iters || ccnt < iters) { while (scnt < iters && scnt - ccnt < cb->txdepth) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; if (scnt < cycle_iters) post_cycles_start[scnt] = get_cycles(); @@ -1263,7 +1264,7 @@ done: static void krping_rlat_test_server(struct krping_cb *cb) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_wc wc; int ret; @@ -1296,7 +1297,7 @@ static void krping_rlat_test_server(struct krping_cb *cb) static void krping_wlat_test_server(struct krping_cb *cb) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_wc wc; int ret; @@ -1330,7 +1331,7 @@ static void krping_wlat_test_server(struct krping_cb *cb) static void krping_bw_test_server(struct krping_cb *cb) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_wc wc; int ret; @@ -1434,7 +1435,7 @@ static int krping_bind_server(struct krping_cb *cb) static void krping_run_server(struct krping_cb *cb) { - struct ib_recv_wr *bad_wr; + const struct ib_recv_wr *bad_wr; int ret; ret = krping_bind_server(cb); @@ -1485,7 +1486,7 @@ err0: static void krping_test_client(struct krping_cb *cb) { int ping, start, cc, i, ret; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; unsigned char c; start = 65; @@ -1558,7 +1559,7 @@ static void krping_test_client(struct krping_cb *cb) static void krping_rlat_test_client(struct krping_cb *cb) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_wc wc; int ret; @@ -1600,7 +1601,7 @@ static void krping_rlat_test_client(struct krping_cb *cb) suseconds_t usec; unsigned long long elapsed; struct ib_wc wc; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; int ne; cb->rdma_sq_wr.wr.opcode = IB_WR_RDMA_WRITE; @@ -1648,7 +1649,7 @@ static void krping_rlat_test_client(struct krping_cb *cb) static void krping_wlat_test_client(struct krping_cb *cb) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_wc wc; int ret; @@ -1687,7 +1688,7 @@ static void krping_wlat_test_client(struct krping_cb *cb) static void krping_bw_test_client(struct krping_cb *cb) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_wc wc; int ret; @@ -1729,8 +1730,10 @@ static void krping_bw_test_client(struct krping_cb *cb) */ static void flush_qp(struct krping_cb *cb) { - struct ib_send_wr wr = { 0 }, *bad; - struct ib_recv_wr recv_wr = { 0 }, *recv_bad; + struct ib_send_wr wr = { 0 }; + const struct ib_send_wr *bad; + struct ib_recv_wr recv_wr = { 0 }; + const struct ib_recv_wr *recv_bad; struct ib_wc wc; int ret; int flushed = 0; @@ -1773,7 +1776,8 @@ static void flush_qp(struct krping_cb *cb) static void krping_fr_test(struct krping_cb *cb) { - struct ib_send_wr inv, *bad; + struct ib_send_wr inv; + const struct ib_send_wr *bad; struct ib_reg_wr fr; struct ib_wc wc; u8 key = 0; @@ -1922,7 +1926,7 @@ static int krping_bind_client(struct krping_cb *cb) static void krping_run_client(struct krping_cb *cb) { - struct ib_recv_wr *bad_wr; + const struct ib_recv_wr *bad_wr; int ret; /* set type of service, if any */ diff --git a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h index 3664895200c1..59ca38a96004 100644 --- a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h +++ b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h @@ -926,10 +926,10 @@ void c4iw_release_dev_ucontext(struct c4iw_rdev *rdev, void c4iw_init_dev_ucontext(struct c4iw_rdev *rdev, struct c4iw_dev_ucontext *uctx); int c4iw_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc); -int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr); -int c4iw_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr); +int c4iw_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr); +int c4iw_post_receive(struct ib_qp *ibqp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr); int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param); int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog); int c4iw_destroy_listen(struct iw_cm_id *cm_id); diff --git a/sys/dev/cxgbe/iw_cxgbe/qp.c b/sys/dev/cxgbe/iw_cxgbe/qp.c index 8a7f7b9ba88b..c1006109762c 100644 --- a/sys/dev/cxgbe/iw_cxgbe/qp.c +++ b/sys/dev/cxgbe/iw_cxgbe/qp.c @@ -335,7 +335,7 @@ free_sq_qid: } static int build_immd(struct t4_sq *sq, struct fw_ri_immd *immdp, - struct ib_send_wr *wr, int max, u32 *plenp) + const struct ib_send_wr *wr, int max, u32 *plenp) { u8 *dstp, *srcp; u32 plen = 0; @@ -405,7 +405,7 @@ static int build_isgl(__be64 *queue_start, __be64 *queue_end, } static int build_rdma_send(struct t4_sq *sq, union t4_wr *wqe, - struct ib_send_wr *wr, u8 *len16) + const struct ib_send_wr *wr, u8 *len16) { u32 plen; int size; @@ -472,7 +472,7 @@ static int build_rdma_send(struct t4_sq *sq, union t4_wr *wqe, } static int build_rdma_write(struct t4_sq *sq, union t4_wr *wqe, - struct ib_send_wr *wr, u8 *len16) + const struct ib_send_wr *wr, u8 *len16) { u32 plen; int size; @@ -514,7 +514,7 @@ static int build_rdma_write(struct t4_sq *sq, union t4_wr *wqe, return 0; } -static int build_rdma_read(union t4_wr *wqe, struct ib_send_wr *wr, u8 *len16) +static int build_rdma_read(union t4_wr *wqe, const struct ib_send_wr *wr, u8 *len16) { if (wr->num_sge > 1) return -EINVAL; @@ -545,7 +545,7 @@ static int build_rdma_read(union t4_wr *wqe, struct ib_send_wr *wr, u8 *len16) } static int build_rdma_recv(struct c4iw_qp *qhp, union t4_recv_wr *wqe, - struct ib_recv_wr *wr, u8 *len16) + const struct ib_recv_wr *wr, u8 *len16) { int ret; @@ -559,7 +559,7 @@ static int build_rdma_recv(struct c4iw_qp *qhp, union t4_recv_wr *wqe, return 0; } -static int build_inv_stag(union t4_wr *wqe, struct ib_send_wr *wr, +static int build_inv_stag(union t4_wr *wqe, const struct ib_send_wr *wr, u8 *len16) { wqe->inv.stag_inv = cpu_to_be32(wr->ex.invalidate_rkey); @@ -609,7 +609,7 @@ void c4iw_qp_rem_ref(struct ib_qp *qp) kref_put(&to_c4iw_qp(qp)->kref, queue_qp_free); } -static void complete_sq_drain_wr(struct c4iw_qp *qhp, struct ib_send_wr *wr) +static void complete_sq_drain_wr(struct c4iw_qp *qhp, const struct ib_send_wr *wr) { struct t4_cqe cqe = {}; struct c4iw_cq *schp; @@ -639,7 +639,7 @@ static void complete_sq_drain_wr(struct c4iw_qp *qhp, struct ib_send_wr *wr) spin_unlock_irqrestore(&schp->comp_handler_lock, flag); } -static void complete_rq_drain_wr(struct c4iw_qp *qhp, struct ib_recv_wr *wr) +static void complete_rq_drain_wr(struct c4iw_qp *qhp, const struct ib_recv_wr *wr) { struct t4_cqe cqe = {}; struct c4iw_cq *rchp; @@ -670,7 +670,7 @@ static void complete_rq_drain_wr(struct c4iw_qp *qhp, struct ib_recv_wr *wr) } static int build_tpte_memreg(struct fw_ri_fr_nsmr_tpte_wr *fr, - struct ib_reg_wr *wr, struct c4iw_mr *mhp, u8 *len16) + const struct ib_reg_wr *wr, struct c4iw_mr *mhp, u8 *len16) { __be64 *p = (__be64 *)fr->pbl; @@ -705,7 +705,7 @@ static int build_tpte_memreg(struct fw_ri_fr_nsmr_tpte_wr *fr, } static int build_memreg(struct t4_sq *sq, union t4_wr *wqe, - struct ib_reg_wr *wr, struct c4iw_mr *mhp, u8 *len16, + const struct ib_reg_wr *wr, struct c4iw_mr *mhp, u8 *len16, bool dsgl_supported) { struct fw_ri_immd *imdp; @@ -772,8 +772,8 @@ static int build_memreg(struct t4_sq *sq, union t4_wr *wqe, return 0; } -int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr) +int c4iw_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr) { int err = 0; u8 len16 = 0; @@ -912,8 +912,8 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, return err; } -int c4iw_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr) +int c4iw_post_receive(struct ib_qp *ibqp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr) { int err = 0; struct c4iw_qp *qhp; diff --git a/sys/dev/iser/iser_memory.c b/sys/dev/iser/iser_memory.c index ca3b557866b1..9cf48248741c 100644 --- a/sys/dev/iser/iser_memory.c +++ b/sys/dev/iser/iser_memory.c @@ -159,7 +159,8 @@ iser_fast_reg_mr(struct icl_iser_pdu *iser_pdu, struct ib_mr *mr = rsc->mr; struct ib_reg_wr fastreg_wr; struct ib_send_wr inv_wr; - struct ib_send_wr *bad_wr, *wr = NULL; + const struct ib_send_wr *bad_wr; + struct ib_send_wr *wr = NULL; int ret, n; /* if there a single dma entry, dma mr suffices */ diff --git a/sys/dev/iser/iser_verbs.c b/sys/dev/iser/iser_verbs.c index c9d42da2657b..c613764bd952 100644 --- a/sys/dev/iser/iser_verbs.c +++ b/sys/dev/iser/iser_verbs.c @@ -614,8 +614,8 @@ int iser_conn_terminate(struct iser_conn *iser_conn) { struct ib_conn *ib_conn = &iser_conn->ib_conn; - struct ib_send_wr *bad_send_wr; - struct ib_recv_wr *bad_recv_wr; + const struct ib_send_wr *bad_send_wr; + const struct ib_recv_wr *bad_recv_wr; int err = 0; /* terminate the iser conn only if the conn state is UP */ @@ -860,7 +860,8 @@ iser_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) int iser_post_recvl(struct iser_conn *iser_conn) { - struct ib_recv_wr rx_wr, *rx_wr_failed; + const struct ib_recv_wr *rx_wr_failed; + struct ib_recv_wr rx_wr; struct ib_conn *ib_conn = &iser_conn->ib_conn; struct ib_sge sge; int ib_ret; @@ -887,7 +888,8 @@ iser_post_recvl(struct iser_conn *iser_conn) int iser_post_recvm(struct iser_conn *iser_conn, int count) { - struct ib_recv_wr *rx_wr, *rx_wr_failed; + const struct ib_recv_wr *rx_wr_failed; + struct ib_recv_wr *rx_wr; int i, ib_ret; struct ib_conn *ib_conn = &iser_conn->ib_conn; unsigned int my_rx_head = iser_conn->rx_desc_head; @@ -925,7 +927,8 @@ int iser_post_send(struct ib_conn *ib_conn, struct iser_tx_desc *tx_desc, bool signal) { int ib_ret; - struct ib_send_wr send_wr, *send_wr_failed; + const struct ib_send_wr *send_wr_failed; + struct ib_send_wr send_wr; ib_dma_sync_single_for_device(ib_conn->device->ib_device, tx_desc->dma_addr, ISER_HEADERS_LEN, diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib.h b/sys/dev/mlx4/mlx4_ib/mlx4_ib.h index 100a06b75af7..544ed1913419 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib.h +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib.h @@ -760,8 +760,8 @@ int mlx4_ib_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, int mlx4_ib_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr); int mlx4_ib_destroy_srq(struct ib_srq *srq); void mlx4_ib_free_srq_wqe(struct mlx4_ib_srq *srq, int wqe_index); -int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr); +int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr); struct ib_qp *mlx4_ib_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *init_attr, @@ -771,10 +771,10 @@ int mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, struct ib_udata *udata); int mlx4_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr); -int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr); -int mlx4_ib_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr); +int mlx4_ib_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr); +int mlx4_ib_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr); int mlx4_MAD_IFC(struct mlx4_ib_dev *dev, int mad_ifc_flags, int port, const struct ib_wc *in_wc, const struct ib_grh *in_grh, diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_mad.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_mad.c index 183ccecd2171..455b85f27942 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_mad.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_mad.c @@ -485,7 +485,7 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, { struct ib_sge list; struct ib_ud_wr wr; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct mlx4_ib_demux_pv_ctx *tun_ctx; struct mlx4_ib_demux_pv_qp *tun_qp; struct mlx4_rcv_tunnel_mad *tun_mad; @@ -1275,7 +1275,8 @@ static int mlx4_ib_post_pv_qp_buf(struct mlx4_ib_demux_pv_ctx *ctx, int index) { struct ib_sge sg_list; - struct ib_recv_wr recv_wr, *bad_recv_wr; + struct ib_recv_wr recv_wr; + const struct ib_recv_wr *bad_recv_wr; int size; size = (tun_qp->qp->qp_type == IB_QPT_UD) ? @@ -1326,7 +1327,7 @@ int mlx4_ib_send_to_wire(struct mlx4_ib_dev *dev, int slave, u8 port, { struct ib_sge list; struct ib_ud_wr wr; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct mlx4_ib_demux_pv_ctx *sqp_ctx; struct mlx4_ib_demux_pv_qp *sqp; struct mlx4_mad_snd_buf *sqp_mad; diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c index 280ab6359dd1..9eebbd6bb978 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c @@ -2287,7 +2287,7 @@ static int vf_get_qp0_qkey(struct mlx4_dev *dev, int qpn, u32 *qkey) } static int build_sriov_qp0_header(struct mlx4_ib_sqp *sqp, - struct ib_ud_wr *wr, + const struct ib_ud_wr *wr, void *wqe, unsigned *mlx_seg_len) { struct mlx4_ib_dev *mdev = to_mdev(sqp->qp.ibqp.device); @@ -2416,7 +2416,7 @@ static u8 sl_to_vl(struct mlx4_ib_dev *dev, u8 sl, int port_num) } #define MLX4_ROCEV2_QP1_SPORT 0xC000 -static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_ud_wr *wr, +static int build_mlx_header(struct mlx4_ib_sqp *sqp, const struct ib_ud_wr *wr, void *wqe, unsigned *mlx_seg_len) { struct ib_device *ib_dev = sqp->qp.ibqp.device; @@ -2707,7 +2707,7 @@ static __be32 convert_access(int acc) } static void set_reg_seg(struct mlx4_wqe_fmr_seg *fseg, - struct ib_reg_wr *wr) + const struct ib_reg_wr *wr) { struct mlx4_ib_mr *mr = to_mmr(wr->mr); @@ -2737,7 +2737,7 @@ static __always_inline void set_raddr_seg(struct mlx4_wqe_raddr_seg *rseg, } static void set_atomic_seg(struct mlx4_wqe_atomic_seg *aseg, - struct ib_atomic_wr *wr) + const struct ib_atomic_wr *wr) { if (wr->wr.opcode == IB_WR_ATOMIC_CMP_AND_SWP) { aseg->swap_add = cpu_to_be64(wr->swap); @@ -2753,7 +2753,7 @@ static void set_atomic_seg(struct mlx4_wqe_atomic_seg *aseg, } static void set_masked_atomic_seg(struct mlx4_wqe_masked_atomic_seg *aseg, - struct ib_atomic_wr *wr) + const struct ib_atomic_wr *wr) { aseg->swap_add = cpu_to_be64(wr->swap); aseg->swap_add_mask = cpu_to_be64(wr->swap_mask); @@ -2762,7 +2762,7 @@ static void set_masked_atomic_seg(struct mlx4_wqe_masked_atomic_seg *aseg, } static void set_datagram_seg(struct mlx4_wqe_datagram_seg *dseg, - struct ib_ud_wr *wr) + const struct ib_ud_wr *wr) { memcpy(dseg->av, &to_mah(wr->ah)->av, sizeof (struct mlx4_av)); dseg->dqpn = cpu_to_be32(wr->remote_qpn); @@ -2773,7 +2773,7 @@ static void set_datagram_seg(struct mlx4_wqe_datagram_seg *dseg, static void set_tunnel_datagram_seg(struct mlx4_ib_dev *dev, struct mlx4_wqe_datagram_seg *dseg, - struct ib_ud_wr *wr, + const struct ib_ud_wr *wr, enum mlx4_ib_qp_type qpt) { union mlx4_ext_av *av = &to_mah(wr->ah)->av; @@ -2795,7 +2795,7 @@ static void set_tunnel_datagram_seg(struct mlx4_ib_dev *dev, dseg->qkey = cpu_to_be32(IB_QP_SET_QKEY); } -static void build_tunnel_header(struct ib_ud_wr *wr, void *wqe, unsigned *mlx_seg_len) +static void build_tunnel_header(const struct ib_ud_wr *wr, void *wqe, unsigned *mlx_seg_len) { struct mlx4_wqe_inline_seg *inl = wqe; struct mlx4_ib_tunnel_header hdr; @@ -2878,7 +2878,7 @@ static void __set_data_seg(struct mlx4_wqe_data_seg *dseg, struct ib_sge *sg) dseg->addr = cpu_to_be64(sg->addr); } -static int build_lso_seg(struct mlx4_wqe_lso_seg *wqe, struct ib_ud_wr *wr, +static int build_lso_seg(struct mlx4_wqe_lso_seg *wqe, const struct ib_ud_wr *wr, struct mlx4_ib_qp *qp, unsigned *lso_seg_len, __be32 *lso_hdr_sz, __be32 *blh) { @@ -2898,7 +2898,7 @@ static int build_lso_seg(struct mlx4_wqe_lso_seg *wqe, struct ib_ud_wr *wr, return 0; } -static __be32 send_ieth(struct ib_send_wr *wr) +static __be32 send_ieth(const struct ib_send_wr *wr) { switch (wr->opcode) { case IB_WR_SEND_WITH_IMM: @@ -2920,8 +2920,8 @@ static void add_zero_len_inline(void *wqe) inl->byte_count = cpu_to_be32(1U << 31); } -int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr) +int mlx4_ib_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr) { struct mlx4_ib_qp *qp = to_mqp(ibqp); void *wqe; @@ -3255,8 +3255,8 @@ out: return err; } -int mlx4_ib_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr) +int mlx4_ib_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr) { struct mlx4_ib_qp *qp = to_mqp(ibqp); struct mlx4_wqe_data_seg *scat; diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_srq.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_srq.c index a2e55db37125..a040b673dae9 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_srq.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_srq.c @@ -311,8 +311,8 @@ void mlx4_ib_free_srq_wqe(struct mlx4_ib_srq *srq, int wqe_index) spin_unlock(&srq->lock); } -int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr) +int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr) { struct mlx4_ib_srq *srq = to_msrq(ibsrq); struct mlx4_wqe_srq_next_seg *next; diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index 44a9aa307be7..695b1ab14948 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -449,7 +449,7 @@ struct mlx5_umr_wr { u32 mkey; }; -static inline struct mlx5_umr_wr *umr_wr(struct ib_send_wr *wr) +static inline const struct mlx5_umr_wr *umr_wr(const struct ib_send_wr *wr) { return container_of(wr, struct mlx5_umr_wr, wr); } @@ -837,8 +837,8 @@ int mlx5_ib_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, enum ib_srq_attr_mask attr_mask, struct ib_udata *udata); int mlx5_ib_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *srq_attr); int mlx5_ib_destroy_srq(struct ib_srq *srq); -int mlx5_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr); +int mlx5_ib_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr); struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *init_attr, struct ib_udata *udata); @@ -847,10 +847,10 @@ int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int mlx5_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr); int mlx5_ib_destroy_qp(struct ib_qp *qp); -int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr); -int mlx5_ib_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr); +int mlx5_ib_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr); +int mlx5_ib_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr); void *mlx5_get_send_wqe(struct mlx5_ib_qp *qp, int n); int mlx5_ib_read_user_wqe(struct mlx5_ib_qp *qp, int send, int wqe_index, void *buffer, u32 length, @@ -994,10 +994,10 @@ int mlx5_ib_gsi_modify_qp(struct ib_qp *qp, struct ib_qp_attr *attr, int mlx5_ib_gsi_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr, int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr); -int mlx5_ib_gsi_post_send(struct ib_qp *qp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr); -int mlx5_ib_gsi_post_recv(struct ib_qp *qp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr); +int mlx5_ib_gsi_post_send(struct ib_qp *qp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr); +int mlx5_ib_gsi_post_recv(struct ib_qp *qp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr); void mlx5_ib_gsi_pkey_change(struct mlx5_ib_gsi_qp *gsi); int mlx5_ib_generate_wc(struct ib_cq *ibcq, struct ib_wc *wc); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_gsi.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_gsi.c index 6c0417851665..dc90b1348378 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_gsi.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_gsi.c @@ -472,8 +472,8 @@ static struct ib_qp *get_tx_qp(struct mlx5_ib_gsi_qp *gsi, struct ib_ud_wr *wr) return gsi->tx_qps[qp_index]; } -int mlx5_ib_gsi_post_send(struct ib_qp *qp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr) +int mlx5_ib_gsi_post_send(struct ib_qp *qp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr) { struct mlx5_ib_gsi_qp *gsi = gsi_qp(qp); struct ib_qp *tx_qp; @@ -517,8 +517,8 @@ err: return ret; } -int mlx5_ib_gsi_post_recv(struct ib_qp *qp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr) +int mlx5_ib_gsi_post_recv(struct ib_qp *qp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr) { struct mlx5_ib_gsi_qp *gsi = gsi_qp(qp); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c index 585e52d35d3b..145ec55d6757 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c @@ -573,41 +573,38 @@ static int dma_map_mr_pas(struct mlx5_ib_dev *dev, struct ib_umem *umem, return 0; } -static void prep_umr_wqe_common(struct ib_pd *pd, struct ib_send_wr *wr, +static void prep_umr_wqe_common(struct ib_pd *pd, struct mlx5_umr_wr *umrwr, struct ib_sge *sg, u64 dma, int n, u32 key, int page_shift) { struct mlx5_ib_dev *dev = to_mdev(pd->device); - struct mlx5_umr_wr *umrwr = umr_wr(wr); sg->addr = dma; sg->length = ALIGN(sizeof(u64) * n, 64); sg->lkey = dev->umrc.pd->local_dma_lkey; - wr->next = NULL; - wr->sg_list = sg; + umrwr->wr.next = NULL; + umrwr->wr.sg_list = sg; if (n) - wr->num_sge = 1; + umrwr->wr.num_sge = 1; else - wr->num_sge = 0; + umrwr->wr.num_sge = 0; - wr->opcode = MLX5_IB_WR_UMR; + umrwr->wr.opcode = MLX5_IB_WR_UMR; umrwr->npages = n; umrwr->page_shift = page_shift; umrwr->mkey = key; } -static void prep_umr_reg_wqe(struct ib_pd *pd, struct ib_send_wr *wr, +static void prep_umr_reg_wqe(struct ib_pd *pd, struct mlx5_umr_wr *umrwr, struct ib_sge *sg, u64 dma, int n, u32 key, int page_shift, u64 virt_addr, u64 len, int access_flags) { - struct mlx5_umr_wr *umrwr = umr_wr(wr); + prep_umr_wqe_common(pd, umrwr, sg, dma, n, key, page_shift); - prep_umr_wqe_common(pd, wr, sg, dma, n, key, page_shift); - - wr->send_flags = 0; + umrwr->wr.send_flags = 0; umrwr->target.virt_addr = virt_addr; umrwr->length = len; @@ -616,12 +613,10 @@ static void prep_umr_reg_wqe(struct ib_pd *pd, struct ib_send_wr *wr, } static void prep_umr_unreg_wqe(struct mlx5_ib_dev *dev, - struct ib_send_wr *wr, u32 key) + struct mlx5_umr_wr *umrwr, u32 key) { - struct mlx5_umr_wr *umrwr = umr_wr(wr); - - wr->send_flags = MLX5_IB_SEND_UMR_UNREG | MLX5_IB_SEND_UMR_FAIL_IF_FREE; - wr->opcode = MLX5_IB_WR_UMR; + umrwr->wr.send_flags = MLX5_IB_SEND_UMR_UNREG | MLX5_IB_SEND_UMR_FAIL_IF_FREE; + umrwr->wr.opcode = MLX5_IB_WR_UMR; umrwr->mkey = key; } @@ -675,7 +670,7 @@ static struct mlx5_ib_mr *reg_umr(struct ib_pd *pd, struct ib_umem *umem, struct umr_common *umrc = &dev->umrc; struct mlx5_ib_umr_context umr_context; struct mlx5_umr_wr umrwr = {}; - struct ib_send_wr *bad; + const struct ib_send_wr *bad; struct mlx5_ib_mr *mr; struct ib_sge sg; int size; @@ -707,7 +702,7 @@ static struct mlx5_ib_mr *reg_umr(struct ib_pd *pd, struct ib_umem *umem, mlx5_ib_init_umr_context(&umr_context); umrwr.wr.wr_cqe = &umr_context.cqe; - prep_umr_reg_wqe(pd, &umrwr.wr, &sg, dma, npages, mr->mmkey.key, + prep_umr_reg_wqe(pd, &umrwr, &sg, dma, npages, mr->mmkey.key, page_shift, virt_addr, len, access_flags); down(&umrc->sem); @@ -756,7 +751,7 @@ int mlx5_ib_update_mtt(struct mlx5_ib_mr *mr, u64 start_page_index, int npages, int size; __be64 *pas; dma_addr_t dma; - struct ib_send_wr *bad; + const struct ib_send_wr *bad; struct mlx5_umr_wr wr; struct ib_sge sg; int err = 0; @@ -1026,7 +1021,7 @@ static int unreg_umr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) struct umr_common *umrc = &dev->umrc; struct mlx5_ib_umr_context umr_context; struct mlx5_umr_wr umrwr = {}; - struct ib_send_wr *bad; + const struct ib_send_wr *bad; int err; if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) @@ -1035,7 +1030,7 @@ static int unreg_umr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) mlx5_ib_init_umr_context(&umr_context); umrwr.wr.wr_cqe = &umr_context.cqe; - prep_umr_unreg_wqe(dev, &umrwr.wr, mr->mmkey.key); + prep_umr_unreg_wqe(dev, &umrwr, mr->mmkey.key); down(&umrc->sem); err = ib_post_send(umrc->qp, &umrwr.wr, &bad); @@ -1065,7 +1060,7 @@ static int rereg_umr(struct ib_pd *pd, struct mlx5_ib_mr *mr, u64 virt_addr, struct mlx5_ib_dev *dev = to_mdev(pd->device); struct device *ddev = dev->ib_dev.dma_device; struct mlx5_ib_umr_context umr_context; - struct ib_send_wr *bad; + const struct ib_send_wr *bad; struct mlx5_umr_wr umrwr = {}; struct ib_sge sg; struct umr_common *umrc = &dev->umrc; @@ -1090,7 +1085,7 @@ static int rereg_umr(struct ib_pd *pd, struct mlx5_ib_mr *mr, u64 virt_addr, umrwr.wr.send_flags |= MLX5_IB_SEND_UMR_UPDATE_TRANSLATION; } - prep_umr_wqe_common(pd, &umrwr.wr, &sg, dma, npages, mr->mmkey.key, + prep_umr_wqe_common(pd, &umrwr, &sg, dma, npages, mr->mmkey.key, page_shift); if (flags & IB_MR_REREG_PD) { diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c index ec47b3e07b87..90c6d69e30c2 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c @@ -3028,7 +3028,7 @@ static __always_inline void set_raddr_seg(struct mlx5_wqe_raddr_seg *rseg, } static void *set_eth_seg(struct mlx5_wqe_eth_seg *eseg, - struct ib_send_wr *wr, void *qend, + const struct ib_send_wr *wr, void *qend, struct mlx5_ib_qp *qp, int *size) { void *seg = eseg; @@ -3081,7 +3081,7 @@ static void *set_eth_seg(struct mlx5_wqe_eth_seg *eseg, } static void set_datagram_seg(struct mlx5_wqe_datagram_seg *dseg, - struct ib_send_wr *wr) + const struct ib_send_wr *wr) { memcpy(&dseg->av, &to_mah(ud_wr(wr)->ah)->av, sizeof(struct mlx5_av)); dseg->av.dqp_dct = cpu_to_be32(ud_wr(wr)->remote_qpn | MLX5_EXTENDED_UD_AV); @@ -3240,9 +3240,9 @@ static __be64 get_umr_update_pd_mask(void) } static void set_reg_umr_segment(struct mlx5_wqe_umr_ctrl_seg *umr, - struct ib_send_wr *wr) + const struct ib_send_wr *wr) { - struct mlx5_umr_wr *umrwr = umr_wr(wr); + const struct mlx5_umr_wr *umrwr = umr_wr(wr); memset(umr, 0, sizeof(*umr)); @@ -3311,9 +3311,9 @@ static void set_linv_mkey_seg(struct mlx5_mkey_seg *seg) seg->status = MLX5_MKEY_STATUS_FREE; } -static void set_reg_mkey_segment(struct mlx5_mkey_seg *seg, struct ib_send_wr *wr) +static void set_reg_mkey_segment(struct mlx5_mkey_seg *seg, const struct ib_send_wr *wr) { - struct mlx5_umr_wr *umrwr = umr_wr(wr); + const struct mlx5_umr_wr *umrwr = umr_wr(wr); memset(seg, 0, sizeof(*seg)); if (wr->send_flags & MLX5_IB_SEND_UMR_UNREG) { @@ -3344,7 +3344,7 @@ static void set_reg_data_seg(struct mlx5_wqe_data_seg *dseg, dseg->lkey = cpu_to_be32(pd->ibpd.local_dma_lkey); } -static __be32 send_ieth(struct ib_send_wr *wr) +static __be32 send_ieth(const struct ib_send_wr *wr) { switch (wr->opcode) { case IB_WR_SEND_WITH_IMM: @@ -3376,7 +3376,7 @@ static u8 wq_sig(void *wqe) return calc_sig(wqe, (*((u8 *)wqe + 8) & 0x3f) << 4); } -static int set_data_inl_seg(struct mlx5_ib_qp *qp, struct ib_send_wr *wr, +static int set_data_inl_seg(struct mlx5_ib_qp *qp, const struct ib_send_wr *wr, void *wqe, int *sz) { struct mlx5_wqe_inline_seg *seg; @@ -3522,7 +3522,7 @@ static int mlx5_set_bsf(struct ib_mr *sig_mr, return 0; } -static int set_sig_data_segment(struct ib_sig_handover_wr *wr, +static int set_sig_data_segment(const struct ib_sig_handover_wr *wr, struct mlx5_ib_qp *qp, void **seg, int *size) { struct ib_sig_attrs *sig_attrs = wr->sig_attrs; @@ -3624,7 +3624,7 @@ static int set_sig_data_segment(struct ib_sig_handover_wr *wr, } static void set_sig_mkey_segment(struct mlx5_mkey_seg *seg, - struct ib_sig_handover_wr *wr, u32 nelements, + const struct ib_sig_handover_wr *wr, u32 nelements, u32 length, u32 pdn) { struct ib_mr *sig_mr = wr->sig_mr; @@ -3655,10 +3655,10 @@ static void set_sig_umr_segment(struct mlx5_wqe_umr_ctrl_seg *umr, } -static int set_sig_umr_wr(struct ib_send_wr *send_wr, struct mlx5_ib_qp *qp, +static int set_sig_umr_wr(const struct ib_send_wr *send_wr, struct mlx5_ib_qp *qp, void **seg, int *size) { - struct ib_sig_handover_wr *wr = sig_handover_wr(send_wr); + const struct ib_sig_handover_wr *wr = sig_handover_wr(send_wr); struct mlx5_ib_mr *sig_mr = to_mmr(wr->sig_mr); u32 pdn = get_pd(qp)->pdn; u32 klm_oct_size; @@ -3732,7 +3732,7 @@ static int set_psv_wr(struct ib_sig_domain *domain, } static int set_reg_wr(struct mlx5_ib_qp *qp, - struct ib_reg_wr *wr, + const struct ib_reg_wr *wr, void **seg, int *size) { struct mlx5_ib_mr *mr = to_mmr(wr->mr); @@ -3797,7 +3797,7 @@ static void dump_wqe(struct mlx5_ib_qp *qp, int idx, int size_16) } } -static u8 get_fence(u8 fence, struct ib_send_wr *wr) +static u8 get_fence(u8 fence, const struct ib_send_wr *wr) { if (unlikely(wr->opcode == IB_WR_LOCAL_INV && wr->send_flags & IB_SEND_FENCE)) @@ -3815,10 +3815,10 @@ static u8 get_fence(u8 fence, struct ib_send_wr *wr) return 0; } -static int begin_wqe(struct mlx5_ib_qp *qp, void **seg, - struct mlx5_wqe_ctrl_seg **ctrl, - struct ib_send_wr *wr, unsigned *idx, - int *size, int nreq) +static int __begin_wqe(struct mlx5_ib_qp *qp, void **seg, + struct mlx5_wqe_ctrl_seg **ctrl, + const struct ib_send_wr *wr, unsigned *idx, + int *size, int nreq, bool send_signaled, bool solicited) { if (unlikely(mlx5_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq))) return -ENOMEM; @@ -3829,10 +3829,8 @@ static int begin_wqe(struct mlx5_ib_qp *qp, void **seg, *(uint32_t *)(*seg + 8) = 0; (*ctrl)->imm = send_ieth(wr); (*ctrl)->fm_ce_se = qp->sq_signal_bits | - (wr->send_flags & IB_SEND_SIGNALED ? - MLX5_WQE_CTRL_CQ_UPDATE : 0) | - (wr->send_flags & IB_SEND_SOLICITED ? - MLX5_WQE_CTRL_SOLICITED : 0); + (send_signaled ? MLX5_WQE_CTRL_CQ_UPDATE : 0) | + (solicited ? MLX5_WQE_CTRL_SOLICITED : 0); *seg += sizeof(**ctrl); *size = sizeof(**ctrl) / 16; @@ -3840,6 +3838,16 @@ static int begin_wqe(struct mlx5_ib_qp *qp, void **seg, return 0; } +static int begin_wqe(struct mlx5_ib_qp *qp, void **seg, + struct mlx5_wqe_ctrl_seg **ctrl, + const struct ib_send_wr *wr, unsigned *idx, + int *size, int nreq) +{ + return __begin_wqe(qp, seg, ctrl, wr, idx, size, nreq, + wr->send_flags & IB_SEND_SIGNALED, + wr->send_flags & IB_SEND_SOLICITED); +} + static void finish_wqe(struct mlx5_ib_qp *qp, struct mlx5_wqe_ctrl_seg *ctrl, *** 654 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50A7365EAEA; Mon, 12 Jul 2021 13:09: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 4GNkdL34lfz3h35; Mon, 12 Jul 2021 13:09: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 DC7AF768F; Mon, 12 Jul 2021 13:09: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 16CD9u8s095455; Mon, 12 Jul 2021 13:09:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9uie095454; Mon, 12 Jul 2021 13:09:56 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:56 GMT Message-Id: <202107121309.16CD9uie095454@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: 42f719d61141 - main - mlx5ib: Extend parameter macros so that more arguments may be added. 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: 42f719d611413f3bf9c7914e008fe22c916e1ac5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:59 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=42f719d611413f3bf9c7914e008fe22c916e1ac5 commit 42f719d611413f3bf9c7914e008fe22c916e1ac5 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:55 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:33 +0000 mlx5ib: Extend parameter macros so that more arguments may be added. MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 62 +++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index 695b1ab14948..0ac5368ca3b2 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2020, 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 @@ -637,44 +637,44 @@ struct mlx5_roce { atomic_t next_port; }; -#define MLX5_IB_STATS_COUNT(a,b,c,d) a -#define MLX5_IB_STATS_VAR(a,b,c,d) b; -#define MLX5_IB_STATS_DESC(a,b,c,d) c, d, +#define MLX5_IB_STATS_COUNT(a,...) a +#define MLX5_IB_STATS_VAR(a,b,c,...) b c; +#define MLX5_IB_STATS_DESC(a,b,c,d,e,...) d, e, #define MLX5_IB_CONG_PARAMS(m) \ /* ECN RP */ \ - m(+1, u64 rp_clamp_tgt_rate, "rp_clamp_tgt_rate", "If set, whenever a CNP is processed, the target rate is updated to be the current rate") \ - m(+1, u64 rp_clamp_tgt_rate_ati, "rp_clamp_tgt_rate_ati", "If set, when receiving a CNP, the target rate should be updated if the transission rate was increased due to the timer, and not only due to the byte counter") \ - m(+1, u64 rp_time_reset, "rp_time_reset", "Time in microseconds between rate increases if no CNPs are received") \ - m(+1, u64 rp_byte_reset, "rp_byte_reset", "Transmitted data in bytes between rate increases if no CNP's are received. A value of zero means disabled.") \ - m(+1, u64 rp_threshold, "rp_threshold", "The number of times rpByteStage or rpTimeStage can count before the RP rate control state machine advances states") \ - m(+1, u64 rp_ai_rate, "rp_ai_rate", "The rate, in Mbits per second, used to increase rpTargetRate in the active increase state") \ - m(+1, u64 rp_hai_rate, "rp_hai_rate", "The rate, in Mbits per second, used to increase rpTargetRate in the hyper increase state") \ - m(+1, u64 rp_min_dec_fac, "rp_min_dec_fac", "The minimum factor by which the current transmit rate can be changed when processing a CNP. Value is given as a percentage, [1 .. 100]") \ - m(+1, u64 rp_min_rate, "rp_min_rate", "The minimum value, in Mbps per second, for rate to limit") \ - m(+1, u64 rp_rate_to_set_on_first_cnp, "rp_rate_to_set_on_first_cnp", "The rate that is set for the flow when a rate limiter is allocated to it upon first CNP received, in Mbps. A value of zero means use full port speed") \ - m(+1, u64 rp_dce_tcp_g, "rp_dce_tcp_g", "Used to update the congestion estimator, alpha, once every dce_tcp_rtt once every dce_tcp_rtt microseconds") \ - m(+1, u64 rp_dce_tcp_rtt, "rp_dce_tcp_rtt", "The time between updates of the aolpha value, in microseconds") \ - m(+1, u64 rp_rate_reduce_monitor_period, "rp_rate_reduce_monitor_period", "The minimum time between two consecutive rate reductions for a single flow") \ - m(+1, u64 rp_initial_alpha_value, "rp_initial_alpha_value", "The initial value of alpha to use when receiving the first CNP for a flow") \ - m(+1, u64 rp_gd, "rp_gd", "If a CNP is received, the flow rate is reduced at the beginning of the next rate_reduce_monitor_period interval") \ + m(+1, u64, rp_clamp_tgt_rate, "rp_clamp_tgt_rate", "If set, whenever a CNP is processed, the target rate is updated to be the current rate") \ + m(+1, u64, rp_clamp_tgt_rate_ati, "rp_clamp_tgt_rate_ati", "If set, when receiving a CNP, the target rate should be updated if the transission rate was increased due to the timer, and not only due to the byte counter") \ + m(+1, u64, rp_time_reset, "rp_time_reset", "Time in microseconds between rate increases if no CNPs are received") \ + m(+1, u64, rp_byte_reset, "rp_byte_reset", "Transmitted data in bytes between rate increases if no CNP's are received. A value of zero means disabled.") \ + m(+1, u64, rp_threshold, "rp_threshold", "The number of times rpByteStage or rpTimeStage can count before the RP rate control state machine advances states") \ + m(+1, u64, rp_ai_rate, "rp_ai_rate", "The rate, in Mbits per second, used to increase rpTargetRate in the active increase state") \ + m(+1, u64, rp_hai_rate, "rp_hai_rate", "The rate, in Mbits per second, used to increase rpTargetRate in the hyper increase state") \ + m(+1, u64, rp_min_dec_fac, "rp_min_dec_fac", "The minimum factor by which the current transmit rate can be changed when processing a CNP. Value is given as a percentage, [1 .. 100]") \ + m(+1, u64, rp_min_rate, "rp_min_rate", "The minimum value, in Mbps per second, for rate to limit") \ + m(+1, u64, rp_rate_to_set_on_first_cnp, "rp_rate_to_set_on_first_cnp", "The rate that is set for the flow when a rate limiter is allocated to it upon first CNP received, in Mbps. A value of zero means use full port speed") \ + m(+1, u64, rp_dce_tcp_g, "rp_dce_tcp_g", "Used to update the congestion estimator, alpha, once every dce_tcp_rtt once every dce_tcp_rtt microseconds") \ + m(+1, u64, rp_dce_tcp_rtt, "rp_dce_tcp_rtt", "The time between updates of the aolpha value, in microseconds") \ + m(+1, u64, rp_rate_reduce_monitor_period, "rp_rate_reduce_monitor_period", "The minimum time between two consecutive rate reductions for a single flow") \ + m(+1, u64, rp_initial_alpha_value, "rp_initial_alpha_value", "The initial value of alpha to use when receiving the first CNP for a flow") \ + m(+1, u64, rp_gd, "rp_gd", "If a CNP is received, the flow rate is reduced at the beginning of the next rate_reduce_monitor_period interval") \ /* ECN NP */ \ - m(+1, u64 np_cnp_dscp, "np_cnp_dscp", "The DiffServ Code Point of the generated CNP for this port") \ - m(+1, u64 np_cnp_prio_mode, "np_cnp_prio_mode", "The 802.1p priority value of the generated CNP for this port") \ - m(+1, u64 np_cnp_prio, "np_cnp_prio", "The 802.1p priority value of the generated CNP for this port") + m(+1, u64, np_cnp_dscp, "np_cnp_dscp", "The DiffServ Code Point of the generated CNP for this port") \ + m(+1, u64, np_cnp_prio_mode, "np_cnp_prio_mode", "The 802.1p priority value of the generated CNP for this port") \ + m(+1, u64, np_cnp_prio, "np_cnp_prio", "The 802.1p priority value of the generated CNP for this port") #define MLX5_IB_CONG_PARAMS_NUM (0 MLX5_IB_CONG_PARAMS(MLX5_IB_STATS_COUNT)) #define MLX5_IB_CONG_STATS(m) \ - m(+1, u64 syndrome, "syndrome", "Syndrome number") \ - m(+1, u64 rp_cur_flows, "rp_cur_flows", "Number of flows limited") \ - m(+1, u64 sum_flows, "sum_flows", "Sum of the number of flows limited over time") \ - m(+1, u64 rp_cnp_ignored, "rp_cnp_ignored", "Number of CNPs and CNMs ignored") \ - m(+1, u64 rp_cnp_handled, "rp_cnp_handled", "Number of CNPs and CNMs successfully handled") \ - m(+1, u64 time_stamp, "time_stamp", "Time stamp in microseconds") \ - m(+1, u64 accumulators_period, "accumulators_period", "The value of X variable for accumulating counters") \ - m(+1, u64 np_ecn_marked_roce_packets, "np_ecn_marked_roce_packets", "Number of ECN marked packets seen") \ - m(+1, u64 np_cnp_sent, "np_cnp_sent", "Number of CNPs sent") + m(+1, u64, syndrome, "syndrome", "Syndrome number") \ + m(+1, u64, rp_cur_flows, "rp_cur_flows", "Number of flows limited") \ + m(+1, u64, sum_flows, "sum_flows", "Sum of the number of flows limited over time") \ + m(+1, u64, rp_cnp_ignored, "rp_cnp_ignored", "Number of CNPs and CNMs ignored") \ + m(+1, u64, rp_cnp_handled, "rp_cnp_handled", "Number of CNPs and CNMs successfully handled") \ + m(+1, u64, time_stamp, "time_stamp", "Time stamp in microseconds") \ + m(+1, u64, accumulators_period, "accumulators_period", "The value of X variable for accumulating counters") \ + m(+1, u64, np_ecn_marked_roce_packets, "np_ecn_marked_roce_packets", "Number of ECN marked packets seen") \ + m(+1, u64, np_cnp_sent, "np_cnp_sent", "Number of CNPs sent") #define MLX5_IB_CONG_STATS_NUM (0 MLX5_IB_CONG_STATS(MLX5_IB_STATS_COUNT)) From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:09:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B3B265EAEB; Mon, 12 Jul 2021 13:09: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 4GNkdL0Wx5z3h5P; Mon, 12 Jul 2021 13:09: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 BCC8D73BA; Mon, 12 Jul 2021 13:09: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 16CD9tew095429; Mon, 12 Jul 2021 13:09:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9tdo095428; Mon, 12 Jul 2021 13:09:55 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:55 GMT Message-Id: <202107121309.16CD9tdo095428@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: e787b5acb1bd - main - mlx5core: Don't query the PCI config space for offline during a firmware command. 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: e787b5acb1bdf97fc04ec3ebebb7a8dd40d85199 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:09:59 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=e787b5acb1bdf97fc04ec3ebebb7a8dd40d85199 commit e787b5acb1bdf97fc04ec3ebebb7a8dd40d85199 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:54 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:33 +0000 mlx5core: Don't query the PCI config space for offline during a firmware command. Querying the PCI config space for offline for every firmware command blocks the PCI bus and affects performance. Especially for packet pacing and TLS when objects are frequently created and destroyed. MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_cmd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_cmd.c b/sys/dev/mlx5/mlx5_core/mlx5_cmd.c index 0bc5f92e3b02..c6cc3fee8c43 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_cmd.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_cmd.c @@ -1287,8 +1287,7 @@ static int cmd_exec_helper(struct mlx5_core_dev *dev, u8 status = 0; u32 drv_synd; - if (pci_channel_offline(dev->pdev) || - dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { + if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { u16 opcode = MLX5_GET(mbox_in, in, opcode); err = mlx5_internal_err_ret_value(dev, opcode, &drv_synd, &status); MLX5_SET(mbox_out, out, status, status); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:10:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 213C165F04F; Mon, 12 Jul 2021 13:10: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 4GNkdP4LCwz3h5v; Mon, 12 Jul 2021 13:10: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 25DFC7561; Mon, 12 Jul 2021 13:09: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 16CD9x7c095503; Mon, 12 Jul 2021 13:09:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9xGM095502; Mon, 12 Jul 2021 13:09:59 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:59 GMT Message-Id: <202107121309.16CD9xGM095502@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: 4692d9808e61 - main - mlx5en: Check for pci_channel_offline() when draining sendqueue. 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: 4692d9808e61958675d91ec595b5732c8d1fa700 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:10:02 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=4692d9808e61958675d91ec595b5732c8d1fa700 commit 4692d9808e61958675d91ec595b5732c8d1fa700 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:56 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:33 +0000 mlx5en: Check for pci_channel_offline() when draining sendqueue. This speeds up detach in hypervisor environments. MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index fc9ffc01a0df..97438de3bc2a 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1875,7 +1875,8 @@ mlx5e_drain_sq(struct mlx5e_sq *sq) mtx_lock(&sq->lock); while (sq->cc != sq->pc && (sq->priv->media_status_last & IFM_ACTIVE) != 0 && - mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) { + mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR && + pci_channel_offline(mdev->pdev) == 0) { mtx_unlock(&sq->lock); msleep(1); sq->cq.mcq.comp(&sq->cq.mcq, NULL); @@ -1893,7 +1894,8 @@ mlx5e_drain_sq(struct mlx5e_sq *sq) /* wait till SQ is empty */ mtx_lock(&sq->lock); while (sq->cc != sq->pc && - mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) { + mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR && + pci_channel_offline(mdev->pdev) == 0) { mtx_unlock(&sq->lock); msleep(1); sq->cq.mcq.comp(&sq->cq.mcq, NULL); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:10:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50FEE65F0BB; Mon, 12 Jul 2021 13:10: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 4GNkdQ2LX4z3h9X; Mon, 12 Jul 2021 13:10: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 570B97655; Mon, 12 Jul 2021 13:10: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 16CDA07G095722; Mon, 12 Jul 2021 13:10:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CDA0Ef095703; Mon, 12 Jul 2021 13:10:00 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:10:00 GMT Message-Id: <202107121310.16CDA0Ef095703@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: de2437f19950 - main - mlx5en: Configure relaxed PCI read and write ordering for ethernet. 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: de2437f19950f6758159abbde93200468d1327fa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:10:03 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=de2437f19950f6758159abbde93200468d1327fa commit de2437f19950f6758159abbde93200468d1327fa Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:57 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:34 +0000 mlx5en: Configure relaxed PCI read and write ordering for ethernet. This may improve performance in some configurations. MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 14 +++++++++++++- sys/dev/mlx5/mlx5_ifc.h | 12 ++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 97438de3bc2a..02417f5f931c 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -3707,6 +3707,18 @@ mlx5e_build_ifp_priv(struct mlx5_core_dev *mdev, return (0); } +static void +mlx5e_mkey_set_relaxed_ordering(struct mlx5_core_dev *mdev, void *mkc) +{ + bool ro_pci_enable = + pci_get_relaxed_ordering_enabled(mdev->pdev->dev.bsddev); + bool ro_write = MLX5_CAP_GEN(mdev, relaxed_ordering_write); + bool ro_read = MLX5_CAP_GEN(mdev, relaxed_ordering_read); + + MLX5_SET(mkc, mkc, relaxed_ordering_read, ro_pci_enable && ro_read); + MLX5_SET(mkc, mkc, relaxed_ordering_write, ro_pci_enable && ro_write); +} + static int mlx5e_create_mkey(struct mlx5e_priv *priv, u32 pdn, struct mlx5_core_mr *mkey) @@ -3729,7 +3741,7 @@ mlx5e_create_mkey(struct mlx5e_priv *priv, u32 pdn, MLX5_SET(mkc, mkc, umr_en, 1); /* used by HW TLS */ MLX5_SET(mkc, mkc, lw, 1); MLX5_SET(mkc, mkc, lr, 1); - + mlx5e_mkey_set_relaxed_ordering(mdev, mkc); MLX5_SET(mkc, mkc, pd, pdn); MLX5_SET(mkc, mkc, length64, 1); MLX5_SET(mkc, mkc, qpn, 0xffffff); diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index ce8074fba3f1..d44927236f74 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -1069,12 +1069,14 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 reserved_4[0x8]; u8 log_max_cq_sz[0x8]; - u8 reserved_5[0xb]; + u8 relaxed_ordering_write_umr[0x1]; + u8 relaxed_ordering_read_umr[0x1]; + u8 reserved_5[0x9]; u8 log_max_cq[0x5]; u8 log_max_eq_sz[0x8]; - u8 relaxed_ordering_write[1]; - u8 reserved_6[0x1]; + u8 relaxed_ordering_write[0x1]; + u8 relaxed_ordering_read[0x1]; u8 log_max_mkey[0x6]; u8 reserved_7[0xb]; u8 fast_teardown[0x1]; @@ -2685,7 +2687,9 @@ struct mlx5_ifc_mkc_bits { u8 translations_octword_size[0x20]; - u8 reserved_7[0x1b]; + u8 reserved_at_1c0[0x19]; + u8 relaxed_ordering_read[0x1]; + u8 reserved_at_1d9[0x1]; u8 log_page_size[0x5]; u8 reserved_8[0x20]; From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:10:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE97665F287; Mon, 12 Jul 2021 13:10: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 4GNkdN2Jbmz3h5j; Mon, 12 Jul 2021 13:10: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 0E15D7247; Mon, 12 Jul 2021 13:09: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 16CD9vcj095479; Mon, 12 Jul 2021 13:09:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CD9vsu095478; Mon, 12 Jul 2021 13:09:57 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:09:57 GMT Message-Id: <202107121309.16CD9vsu095478@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: 8abf5ac0e6dd - main - mlx5ib: Implement support for enabling and disabling RoCE ECN. 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: 8abf5ac0e6ddaeddf49cf39193bbe0c3ebf7209b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:10:01 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=8abf5ac0e6ddaeddf49cf39193bbe0c3ebf7209b commit 8abf5ac0e6ddaeddf49cf39193bbe0c3ebf7209b Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:56 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:33 +0000 mlx5ib: Implement support for enabling and disabling RoCE ECN. RoCE is short for Remote direct memory access over Converged Ethernet. ECN is short for Explicit Congestion Notification. MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/cmd.h | 4 ++ sys/dev/mlx5/mlx5_core/mlx5_cmd.c | 23 ++++++++++ sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 39 +++++++++++++++++ sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c | 84 +++++++++++++++++++++++++++++++++++++ 4 files changed, 150 insertions(+) diff --git a/sys/dev/mlx5/cmd.h b/sys/dev/mlx5/cmd.h index 674a8ab44acd..babcaac58ee3 100644 --- a/sys/dev/mlx5/cmd.h +++ b/sys/dev/mlx5/cmd.h @@ -50,4 +50,8 @@ int mlx5_cmd_query_cong_params(struct mlx5_core_dev *dev, int cong_point, void *out, int out_size); int mlx5_cmd_modify_cong_params(struct mlx5_core_dev *mdev, void *in, int in_size); +int mlx5_cmd_query_cong_status(struct mlx5_core_dev *dev, int cong_point, + int prio, void *out, int out_size); +int mlx5_cmd_modify_cong_status(struct mlx5_core_dev *mdev, + void *in, int in_size); #endif /* MLX5_CMD_H */ diff --git a/sys/dev/mlx5/mlx5_core/mlx5_cmd.c b/sys/dev/mlx5/mlx5_core/mlx5_cmd.c index c6cc3fee8c43..c4e8b32ffcd5 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_cmd.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_cmd.c @@ -1668,3 +1668,26 @@ int mlx5_cmd_modify_cong_params(struct mlx5_core_dev *dev, return mlx5_cmd_exec(dev, in, in_size, out, sizeof(out)); } EXPORT_SYMBOL(mlx5_cmd_modify_cong_params); + +int mlx5_cmd_query_cong_status(struct mlx5_core_dev *dev, int cong_point, + int prio, void *out, int out_size) +{ + u32 in[MLX5_ST_SZ_DW(query_cong_status_in)] = { }; + + MLX5_SET(query_cong_status_in, in, opcode, + MLX5_CMD_OP_QUERY_CONG_STATUS); + MLX5_SET(query_cong_status_in, in, priority, prio); + MLX5_SET(query_cong_status_in, in, cong_protocol, cong_point); + + return mlx5_cmd_exec(dev, in, sizeof(in), out, out_size); +} +EXPORT_SYMBOL(mlx5_cmd_query_cong_status); + +int mlx5_cmd_modify_cong_status(struct mlx5_core_dev *dev, + void *in, int in_size) +{ + u32 out[MLX5_ST_SZ_DW(modify_cong_status_out)] = { }; + + return mlx5_cmd_exec(dev, in, in_size, out, sizeof(out)); +} +EXPORT_SYMBOL(mlx5_cmd_modify_cong_status); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index 0ac5368ca3b2..49f6e87868ff 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -678,6 +678,44 @@ struct mlx5_roce { #define MLX5_IB_CONG_STATS_NUM (0 MLX5_IB_CONG_STATS(MLX5_IB_STATS_COUNT)) +#define MLX5_IB_CONG_STATUS(m) \ + /* ECN RP */ \ + m(+1, u64, rp_0_enable, "rp_0_enable", "Enable reaction point, priority 0", MLX5_IB_RROCE_ECN_RP, 0, enable) \ + m(+1, u64, rp_1_enable, "rp_1_enable", "Enable reaction point, priority 1", MLX5_IB_RROCE_ECN_RP, 1, enable) \ + m(+1, u64, rp_2_enable, "rp_2_enable", "Enable reaction point, priority 2", MLX5_IB_RROCE_ECN_RP, 2, enable) \ + m(+1, u64, rp_3_enable, "rp_3_enable", "Enable reaction point, priority 3", MLX5_IB_RROCE_ECN_RP, 3, enable) \ + m(+1, u64, rp_4_enable, "rp_4_enable", "Enable reaction point, priority 4", MLX5_IB_RROCE_ECN_RP, 4, enable) \ + m(+1, u64, rp_5_enable, "rp_5_enable", "Enable reaction point, priority 5", MLX5_IB_RROCE_ECN_RP, 5, enable) \ + m(+1, u64, rp_6_enable, "rp_6_enable", "Enable reaction point, priority 6", MLX5_IB_RROCE_ECN_RP, 6, enable) \ + m(+1, u64, rp_7_enable, "rp_7_enable", "Enable reaction point, priority 7", MLX5_IB_RROCE_ECN_RP, 7, enable) \ + m(+1, u64, rp_8_enable, "rp_8_enable", "Enable reaction point, priority 8", MLX5_IB_RROCE_ECN_RP, 8, enable) \ + m(+1, u64, rp_9_enable, "rp_9_enable", "Enable reaction point, priority 9", MLX5_IB_RROCE_ECN_RP, 9, enable) \ + m(+1, u64, rp_10_enable, "rp_10_enable", "Enable reaction point, priority 10", MLX5_IB_RROCE_ECN_RP, 10, enable) \ + m(+1, u64, rp_11_enable, "rp_11_enable", "Enable reaction point, priority 11", MLX5_IB_RROCE_ECN_RP, 11, enable) \ + m(+1, u64, rp_12_enable, "rp_12_enable", "Enable reaction point, priority 12", MLX5_IB_RROCE_ECN_RP, 12, enable) \ + m(+1, u64, rp_13_enable, "rp_13_enable", "Enable reaction point, priority 13", MLX5_IB_RROCE_ECN_RP, 13, enable) \ + m(+1, u64, rp_14_enable, "rp_14_enable", "Enable reaction point, priority 14", MLX5_IB_RROCE_ECN_RP, 14, enable) \ + m(+1, u64, rp_15_enable, "rp_15_enable", "Enable reaction point, priority 15", MLX5_IB_RROCE_ECN_RP, 15, enable) \ + /* ECN NP */ \ + m(+1, u64, np_0_enable, "np_0_enable", "Enable notification point, priority 0", MLX5_IB_RROCE_ECN_NP, 0, enable) \ + m(+1, u64, np_1_enable, "np_1_enable", "Enable notification point, priority 1", MLX5_IB_RROCE_ECN_NP, 1, enable) \ + m(+1, u64, np_2_enable, "np_2_enable", "Enable notification point, priority 2", MLX5_IB_RROCE_ECN_NP, 2, enable) \ + m(+1, u64, np_3_enable, "np_3_enable", "Enable notification point, priority 3", MLX5_IB_RROCE_ECN_NP, 3, enable) \ + m(+1, u64, np_4_enable, "np_4_enable", "Enable notification point, priority 4", MLX5_IB_RROCE_ECN_NP, 4, enable) \ + m(+1, u64, np_5_enable, "np_5_enable", "Enable notification point, priority 5", MLX5_IB_RROCE_ECN_NP, 5, enable) \ + m(+1, u64, np_6_enable, "np_6_enable", "Enable notification point, priority 6", MLX5_IB_RROCE_ECN_NP, 6, enable) \ + m(+1, u64, np_7_enable, "np_7_enable", "Enable notification point, priority 7", MLX5_IB_RROCE_ECN_NP, 7, enable) \ + m(+1, u64, np_8_enable, "np_8_enable", "Enable notification point, priority 8", MLX5_IB_RROCE_ECN_NP, 8, enable) \ + m(+1, u64, np_9_enable, "np_9_enable", "Enable notification point, priority 9", MLX5_IB_RROCE_ECN_NP, 9, enable) \ + m(+1, u64, np_10_enable, "np_10_enable", "Enable notification point, priority 10", MLX5_IB_RROCE_ECN_NP, 10, enable) \ + m(+1, u64, np_11_enable, "np_11_enable", "Enable notification point, priority 11", MLX5_IB_RROCE_ECN_NP, 11, enable) \ + m(+1, u64, np_12_enable, "np_12_enable", "Enable notification point, priority 12", MLX5_IB_RROCE_ECN_NP, 12, enable) \ + m(+1, u64, np_13_enable, "np_13_enable", "Enable notification point, priority 13", MLX5_IB_RROCE_ECN_NP, 13, enable) \ + m(+1, u64, np_14_enable, "np_14_enable", "Enable notification point, priority 14", MLX5_IB_RROCE_ECN_NP, 14, enable) \ + m(+1, u64, np_15_enable, "np_15_enable", "Enable notification point, priority 15", MLX5_IB_RROCE_ECN_NP, 15, enable) \ + +#define MLX5_IB_CONG_STATUS_NUM (0 MLX5_IB_CONG_STATUS(MLX5_IB_STATS_COUNT)) + struct mlx5_ib_congestion { struct sysctl_ctx_list ctx; struct sx lock; @@ -687,6 +725,7 @@ struct mlx5_ib_congestion { struct { MLX5_IB_CONG_PARAMS(MLX5_IB_STATS_VAR) MLX5_IB_CONG_STATS(MLX5_IB_STATS_VAR) + MLX5_IB_CONG_STATUS(MLX5_IB_STATS_VAR) }; }; }; diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c index 0fc6694bde82..85ba77362cca 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c @@ -33,6 +33,10 @@ static const char *mlx5_ib_cong_params_desc[] = { MLX5_IB_CONG_PARAMS(MLX5_IB_STATS_DESC) }; +static const char *mlx5_ib_cong_status_desc[] = { + MLX5_IB_CONG_STATUS(MLX5_IB_STATS_DESC) +}; + static const char *mlx5_ib_cong_stats_desc[] = { MLX5_IB_CONG_STATS(MLX5_IB_STATS_DESC) }; @@ -346,6 +350,72 @@ done: return (error); } +static int +mlx5_ib_get_all_cc_status(struct mlx5_ib_dev *dev) +{ + const int outlen = MLX5_ST_SZ_BYTES(query_cong_status_out); + uint32_t out[MLX5_ST_SZ_DW(query_cong_status_out)] = {}; + int error; + +#define MLX5_IB_CONG_STATUS_READ(a,b,c,d,e,node,prio,field) do { \ + error = mlx5_cmd_query_cong_status(dev->mdev, node, prio, out, outlen); \ + if (error) \ + goto done; \ + dev->congestion.c = MLX5_GET(query_cong_status_out, out, field); \ +} while (0); + + MLX5_IB_CONG_STATUS(MLX5_IB_CONG_STATUS_READ); +done: + return (error); +} + +static int +mlx5_ib_cong_status_handler(SYSCTL_HANDLER_ARGS) +{ + const int inlen = MLX5_ST_SZ_BYTES(modify_cong_status_in); + uint32_t in[MLX5_ST_SZ_DW(modify_cong_status_in)] = {}; + struct mlx5_ib_dev *dev = arg1; + u64 value; + int error; + + CONG_LOCK(dev); + value = dev->congestion.arg[arg2]; + if (req != NULL) { + error = sysctl_handle_64(oidp, &value, 0, req); + /* convert value into a boolean */ + value = value ? 1 : 0; + if (error || req->newptr == NULL || + value == dev->congestion.arg[arg2]) + goto done; + + /* assign new binary value */ + dev->congestion.arg[arg2] = value; + } else { + error = 0; + } + if (!MLX5_CAP_GEN(dev->mdev, cc_modify_allowed)) + error = EPERM; + else switch (arg2) { +#define MLX5_IB_CONG_STATUS_WRITE(a,b,c,d,e,node,prio,field) \ + case MLX5_IB_INDEX(c): \ + MLX5_SET(modify_cong_status_in, in, opcode, \ + MLX5_CMD_OP_MODIFY_CONG_STATUS); \ + MLX5_SET(modify_cong_status_in, in, priority, prio); \ + MLX5_SET(modify_cong_status_in, in, cong_protocol, node); \ + MLX5_SET(modify_cong_status_in, in, field, value); \ + error = -mlx5_cmd_modify_cong_status(dev->mdev, in, inlen); \ + break; + MLX5_IB_CONG_STATUS(MLX5_IB_CONG_STATUS_WRITE) + default: + error = EINVAL; + break; + } +done: + CONG_UNLOCK(dev); + + return (error); +} + #define MLX5_GET_UNALIGNED_64(t,p,f) \ (((u64)MLX5_GET(t,p,f##_high) << 32) | MLX5_GET(t,p,f##_low)) @@ -422,6 +492,10 @@ mlx5_ib_init_congestion(struct mlx5_ib_dev *dev) if (err) return (err); + err = mlx5_ib_get_all_cc_status(dev); + if (err) + return (err); + parent = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(dev->ib_dev.dev.kobj.oidp), OID_AUTO, "cong", CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, "Congestion control"); @@ -445,6 +519,16 @@ mlx5_ib_init_congestion(struct mlx5_ib_dev *dev) mlx5_ib_cong_params_desc[2 * x + 1]); } + for (x = 0; x != MLX5_IB_CONG_STATUS_NUM; x++) { + SYSCTL_ADD_PROC(ctx, + SYSCTL_CHILDREN(node), OID_AUTO, + mlx5_ib_cong_status_desc[2 * x], + CTLTYPE_U64 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + dev, x + MLX5_IB_CONG_PARAMS_NUM + MLX5_IB_CONG_STATS_NUM, + &mlx5_ib_cong_status_handler, "QU", + mlx5_ib_cong_status_desc[2 * x + 1]); + } + node = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(parent), OID_AUTO, "stats", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "Statistics"); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:10:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BAED65EF5D; Mon, 12 Jul 2021 13:10: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 4GNkdT281wz3h0p; Mon, 12 Jul 2021 13:10: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 9CB4D7563; Mon, 12 Jul 2021 13:10: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 16CDA42L097837; Mon, 12 Jul 2021 13:10:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CDA4aG097835; Mon, 12 Jul 2021 13:10:04 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:10:04 GMT Message-Id: <202107121310.16CDA4aG097835@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: f60da09dbb15 - main - ibcore: Add some functions and definitions for selecting and querying retryable ucontext cleanup. 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: f60da09dbb152d7c8ee1719197d98149a8b0c017 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:10:06 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=f60da09dbb152d7c8ee1719197d98149a8b0c017 commit f60da09dbb152d7c8ee1719197d98149a8b0c017 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:02:00 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:34 +0000 ibcore: Add some functions and definitions for selecting and querying retryable ucontext cleanup. Linux commit: 1c77483e4c50339b0306572167ccbff6b55d051b MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c | 1 + sys/ofed/include/rdma/ib_verbs.h | 56 ++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c b/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c index ab6e27d40d33..df3f8657755c 100644 --- a/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c +++ b/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c @@ -365,6 +365,7 @@ ssize_t ib_uverbs_get_context(struct ib_uverbs_file *file, ucontext->tgid = get_pid(task_pid_group_leader(current)); rcu_read_unlock(); ucontext->closing = 0; + ucontext->cleanup_retryable = false; #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING ucontext->umem_tree = RB_ROOT; diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index 45a25dc06c45..723db4a659cf 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -1364,6 +1364,20 @@ struct ib_fmr_attr { struct ib_umem; +enum rdma_remove_reason { + /* + * Userspace requested uobject deletion or initial try + * to remove uobject via cleanup. Call could fail + */ + RDMA_REMOVE_DESTROY, + /* Context deletion. This call should delete the actual object itself */ + RDMA_REMOVE_CLOSE, + /* Driver is being hot-unplugged. This call should delete the actual object itself */ + RDMA_REMOVE_DRIVER_REMOVE, + /* uobj is being cleaned-up before being committed */ + RDMA_REMOVE_ABORT, +}; + struct ib_ucontext { struct ib_device *device; struct list_head pd_list; @@ -1379,6 +1393,8 @@ struct ib_ucontext { struct list_head rwq_ind_tbl_list; int closing; + bool cleanup_retryable; + pid_t tgid; #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING struct rb_root umem_tree; @@ -2213,6 +2229,46 @@ static inline bool ib_is_udata_cleared(struct ib_udata *udata, return ret; } +/** + * ib_is_destroy_retryable - Check whether the uobject destruction + * is retryable. + * @ret: The initial destruction return code + * @why: remove reason + * @uobj: The uobject that is destroyed + * + * This function is a helper function that IB layer and low-level drivers + * can use to consider whether the destruction of the given uobject is + * retry-able. + * It checks the original return code, if it wasn't success the destruction + * is retryable according to the ucontext state (i.e. cleanup_retryable) and + * the remove reason. (i.e. why). + * Must be called with the object locked for destroy. + */ +static inline bool ib_is_destroy_retryable(int ret, enum rdma_remove_reason why, + struct ib_uobject *uobj) +{ + return ret && (why == RDMA_REMOVE_DESTROY || + uobj->context->cleanup_retryable); +} + +/** + * ib_destroy_usecnt - Called during destruction to check the usecnt + * @usecnt: The usecnt atomic + * @why: remove reason + * @uobj: The uobject that is destroyed + * + * Non-zero usecnts will block destruction unless destruction was triggered by + * a ucontext cleanup. + */ +static inline int ib_destroy_usecnt(atomic_t *usecnt, + enum rdma_remove_reason why, + struct ib_uobject *uobj) +{ + if (atomic_read(usecnt) && ib_is_destroy_retryable(-EBUSY, why, uobj)) + return -EBUSY; + return 0; +} + /** * ib_modify_qp_is_ok - Check that the supplied attribute mask * contains all required attributes and no attributes not allowed for From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:10:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A8A0D65EF5F; Mon, 12 Jul 2021 13:10: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 4GNkdV0tjcz3h9s; Mon, 12 Jul 2021 13:10: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 AC95B7564; Mon, 12 Jul 2021 13:10: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 16CDA5xE098053; Mon, 12 Jul 2021 13:10:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CDA56a098051; Mon, 12 Jul 2021 13:10:05 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:10:05 GMT Message-Id: <202107121310.16CDA56a098051@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: c8d16d1e084d - main - mlx5en: Allow binding channels to CPUs when RSS is not enabled. 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: c8d16d1e084dc14191491e95ce226d3ce8b39275 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:10:06 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c8d16d1e084dc14191491e95ce226d3ce8b39275 commit c8d16d1e084dc14191491e95ce226d3ce8b39275 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:02:02 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:34 +0000 mlx5en: Allow binding channels to CPUs when RSS is not enabled. MFC after: 1 week Submitted by: Netflix Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_en/en.h | 6 ++++-- sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c | 13 ++++++++++++- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 24 ++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index c84e2af237b2..8556a4364ddd 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2019 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2021 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -710,7 +710,9 @@ struct mlx5e_params { m(+1, u64, diag_general_enable, "diag_general_enable", "0: Disabled 1: Enabled") \ m(+1, u64, hw_mtu, "hw_mtu", "Current hardware MTU value") \ m(+1, u64, mc_local_lb, "mc_local_lb", "0: Local multicast loopback enabled 1: Disabled") \ - m(+1, u64, uc_local_lb, "uc_local_lb", "0: Local unicast loopback enabled 1: Disabled") + m(+1, u64, uc_local_lb, "uc_local_lb", "0: Local unicast loopback enabled 1: Disabled") \ + m(+1, s64, irq_cpu_base, "irq_cpu_base", "-1: Don't bind IRQ 0..NCPU-1: select this base CPU when binding IRQs") \ + m(+1, s64, irq_cpu_stride, "irq_cpu_stride", "0..NCPU-1: Distance between IRQ vectors when binding them") #define MLX5E_PARAMS_NUM (0 MLX5E_PARAMS(MLX5E_STATS_COUNT)) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c b/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c index 4070fe4331a1..f7228989ee04 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2019 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2021 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1250,6 +1250,15 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) } break; + case MLX5_PARAM_OFFSET(irq_cpu_base): + case MLX5_PARAM_OFFSET(irq_cpu_stride): + if (was_opened) { + /* network interface must toggled */ + mlx5e_close_locked(priv->ifp); + mlx5e_open_locked(priv->ifp); + } + break; + default: break; } @@ -1413,6 +1422,8 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) int i; /* set some defaults */ + priv->params_ethtool.irq_cpu_base = -1; /* disabled */ + priv->params_ethtool.irq_cpu_stride = 1; priv->params_ethtool.tx_queue_size_max = 1 << MLX5E_PARAMS_MAXIMUM_LOG_SQ_SIZE; priv->params_ethtool.rx_queue_size_max = 1 << MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE; priv->params_ethtool.tx_queue_size = 1 << priv->params.log_sq_size; diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index b67f382522e7..9345798006f2 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -2446,6 +2446,30 @@ mlx5e_open_channels(struct mlx5e_priv *priv) err = mlx5e_open_channel(priv, cparam, &priv->channel[i]); if (err) goto err_close_channels; + + /* Bind interrupt vectors, if any. */ + if (priv->params_ethtool.irq_cpu_base > -1) { + cpuset_t cpuset; + int cpu; + int irq; + int eqn; + int nirq; + + err = mlx5_vector2eqn(priv->mdev, i, + &eqn, &nirq); + + /* error here is non-fatal */ + if (err != 0) + continue; + + irq = priv->mdev->priv.msix_arr[nirq].vector; + cpu = (unsigned)(priv->params_ethtool.irq_cpu_base + + i * priv->params_ethtool.irq_cpu_stride) % (unsigned)mp_ncpus; + + CPU_ZERO(&cpuset); + CPU_SET(cpu, &cpuset); + intr_setaffinity(irq, CPU_WHICH_INTRHANDLER, &cpuset); + } } for (j = 0; j < priv->params.num_channels; j++) { From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:10:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE50C65F207; Mon, 12 Jul 2021 13:10: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 4GNkdR6LDhz3h3J; Mon, 12 Jul 2021 13:10: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 6F42B7367; Mon, 12 Jul 2021 13:10: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 16CDA25a097410; Mon, 12 Jul 2021 13:10:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CDA2AJ097408; Mon, 12 Jul 2021 13:10:02 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:10:02 GMT Message-Id: <202107121310.16CDA2AJ097408@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: 3a934ba7a308 - main - mlx5en: Wait for all TLS connections to terminate when unloading driver. 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: 3a934ba7a30831dda104e9faad9412f9743c9bae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:10:05 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=3a934ba7a30831dda104e9faad9412f9743c9bae commit 3a934ba7a30831dda104e9faad9412f9743c9bae Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:58 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:34 +0000 mlx5en: Wait for all TLS connections to terminate when unloading driver. The driver expects all TLS tags to be returned to the driver before it can free the UMA zone where the TLS tags reside. MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c | 2 +- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c b/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c index 3e63b9e660f1..1a92e5aa222a 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c @@ -288,7 +288,7 @@ mlx5e_tls_snd_tag_alloc(struct ifnet *ifp, priv = ifp->if_softc; - if (priv->tls.init == 0) + if (priv->gone != 0 || priv->tls.init == 0) return (EOPNOTSUPP); /* allocate new tag from zone, if any */ diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 02417f5f931c..d9860c24114b 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -4715,6 +4715,16 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vpriv) pause("W", hz); } #endif + +#ifdef KERN_TLS + /* wait for all TLS tags to get freed */ + while (priv->tls.init != 0 && + uma_zone_get_cur(priv->tls.zone) != 0) { + mlx5_en_err(priv->ifp, + "Waiting for all TLS connections to terminate\n"); + pause("W", hz); + } +#endif /* wait for all unlimited send tags to complete */ mlx5e_priv_wait_for_completion(priv, mdev->priv.eq_table.num_comp_vectors); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:10:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DA6065F0D3; Mon, 12 Jul 2021 13:10: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 4GNkdW6qx2z3h15; Mon, 12 Jul 2021 13:10: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 BEF9672E3; Mon, 12 Jul 2021 13:10: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 16CDA6T2098269; Mon, 12 Jul 2021 13:10:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CDA64x098266; Mon, 12 Jul 2021 13:10:06 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:10:06 GMT Message-Id: <202107121310.16CDA64x098266@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: c8301cbb0fa2 - main - mlx4: Map core_clock page to user space only when allowed 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: c8301cbb0fa25d03c1b6b2d056497d5a1580a8b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:10:08 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c8301cbb0fa25d03c1b6b2d056497d5a1580a8b4 commit c8301cbb0fa25d03c1b6b2d056497d5a1580a8b4 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:02:02 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:35 +0000 mlx4: Map core_clock page to user space only when allowed Currently when we map the hca_core_clock page to the user space, there are vulnerable registers, one of which is semaphore, on this page as well. If user read the wrong offset, it can modify the above semaphore and hang the device. Hence, mapping the hca_core_clock page to the user space only when user required it specifically. After this patch, mlx4 core_clock won't be mapped to user space by default. Oppose to current state, where mlx4 core_clock is always mapped to user space. MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx4/device.h | 1 + sys/dev/mlx4/mlx4_core/fw.h | 1 + sys/dev/mlx4/mlx4_core/mlx4_fw.c | 3 +++ sys/dev/mlx4/mlx4_core/mlx4_main.c | 6 ++++++ sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c | 5 +---- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/dev/mlx4/device.h b/sys/dev/mlx4/device.h index 0af8fce5e634..ce934838253f 100644 --- a/sys/dev/mlx4/device.h +++ b/sys/dev/mlx4/device.h @@ -624,6 +624,7 @@ struct mlx4_caps { u32 dmfs_high_rate_qpn_range; u32 vf_caps; struct mlx4_rate_limit_caps rl_caps; + bool map_clock_to_user; }; struct mlx4_buf_list { diff --git a/sys/dev/mlx4/mlx4_core/fw.h b/sys/dev/mlx4/mlx4_core/fw.h index c4c4883b4d06..48ba434e6078 100644 --- a/sys/dev/mlx4/mlx4_core/fw.h +++ b/sys/dev/mlx4/mlx4_core/fw.h @@ -129,6 +129,7 @@ struct mlx4_dev_cap { u32 dmfs_high_rate_qpn_range; struct mlx4_rate_limit_caps rl_caps; struct mlx4_port_cap port_cap[MLX4_MAX_PORTS + 1]; + bool map_clock_to_user; }; struct mlx4_func_cap { diff --git a/sys/dev/mlx4/mlx4_core/mlx4_fw.c b/sys/dev/mlx4/mlx4_core/mlx4_fw.c index 0ac45e1297b9..68aa7e76c79d 100644 --- a/sys/dev/mlx4/mlx4_core/mlx4_fw.c +++ b/sys/dev/mlx4/mlx4_core/mlx4_fw.c @@ -820,6 +820,7 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) #define QUERY_DEV_CAP_MAD_DEMUX_OFFSET 0xb0 #define QUERY_DEV_CAP_DMFS_HIGH_RATE_QPN_BASE_OFFSET 0xa8 #define QUERY_DEV_CAP_DMFS_HIGH_RATE_QPN_RANGE_OFFSET 0xac +#define QUERY_DEV_CAP_MAP_CLOCK_TO_USER 0xc1 #define QUERY_DEV_CAP_QP_RATE_LIMIT_NUM_OFFSET 0xcc #define QUERY_DEV_CAP_QP_RATE_LIMIT_MAX_OFFSET 0xd0 #define QUERY_DEV_CAP_QP_RATE_LIMIT_MIN_OFFSET 0xd2 @@ -838,6 +839,8 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) if (mlx4_is_mfunc(dev)) disable_unsupported_roce_caps(outbox); + MLX4_GET(field, outbox, QUERY_DEV_CAP_MAP_CLOCK_TO_USER); + dev_cap->map_clock_to_user = field & 0x80; MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_QP_OFFSET); dev_cap->reserved_qps = 1 << (field & 0xf); MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_QP_OFFSET); diff --git a/sys/dev/mlx4/mlx4_core/mlx4_main.c b/sys/dev/mlx4/mlx4_core/mlx4_main.c index 48cc2fc7d3f6..ca63d1d12ba6 100644 --- a/sys/dev/mlx4/mlx4_core/mlx4_main.c +++ b/sys/dev/mlx4/mlx4_core/mlx4_main.c @@ -386,6 +386,7 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) } } + dev->caps.map_clock_to_user = dev_cap->map_clock_to_user; dev->caps.uar_page_size = PAGE_SIZE; dev->caps.num_uars = dev_cap->uar_size / PAGE_SIZE; dev->caps.local_ca_ack_delay = dev_cap->local_ca_ack_delay; @@ -1872,6 +1873,11 @@ int mlx4_get_internal_clock_params(struct mlx4_dev *dev, if (mlx4_is_slave(dev)) return -ENOTSUPP; + if (!dev->caps.map_clock_to_user) { + mlx4_dbg(dev, "Map clock to user is not supported.\n"); + return -EOPNOTSUPP; + } + if (!params) return -EINVAL; diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c index ef23f182bc28..e992400820c0 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c @@ -560,12 +560,9 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, props->hca_core_clock = dev->dev->caps.hca_core_clock * 1000UL; props->timestamp_mask = 0xFFFFFFFFFFFFULL; - if (!mlx4_is_slave(dev->dev)) - err = mlx4_get_internal_clock_params(dev->dev, &clock_params); - if (uhw->outlen >= resp.response_length + sizeof(resp.hca_core_clock_offset)) { resp.response_length += sizeof(resp.hca_core_clock_offset); - if (!err && !mlx4_is_slave(dev->dev)) { + if (!mlx4_get_internal_clock_params(dev->dev, &clock_params)) { resp.comp_mask |= QUERY_DEVICE_RESP_MASK_TIMESTAMP; resp.hca_core_clock_offset = clock_params.offset % PAGE_SIZE; } From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:10:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E2AB165F206; Mon, 12 Jul 2021 13:10: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 4GNkdQ4jr0z3h64; Mon, 12 Jul 2021 13:10: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 59A577690; Mon, 12 Jul 2021 13:10: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 16CDA1CA097001; Mon, 12 Jul 2021 13:10:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CDA1a9096988; Mon, 12 Jul 2021 13:10:01 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:10:01 GMT Message-Id: <202107121310.16CDA1a9096988@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: 30416d4e8273 - main - mlx4ib and mlx5ib: Set slid to zero in Ethernet completion struct 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: 30416d4e827341be32c3e415f16c73f252a68d85 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:10:04 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=30416d4e827341be32c3e415f16c73f252a68d85 commit 30416d4e827341be32c3e415f16c73f252a68d85 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:58 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:34 +0000 mlx4ib and mlx5ib: Set slid to zero in Ethernet completion struct IB spec says that a lid should be ignored when link layer is Ethernet, for example when building or parsing a CM request message (CA17-34). However, since ib_lid_be16() and ib_lid_cpu16() validates the slid, not only when link layer is IB, we set the slid to zero to prevent false warnings in the kernel log. Linux commit: 65389322b28f81cc137b60a41044c2d958a7b950 MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c | 4 +++- sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c index d9f3a719e030..215c428e7af7 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c @@ -593,6 +593,7 @@ static void use_tunnel_data(struct mlx4_ib_qp *qp, struct mlx4_ib_cq *cq, struct wc->dlid_path_bits = 0; if (is_eth) { + wc->slid = 0; wc->vlan_id = be16_to_cpu(hdr->tun.sl_vid); memcpy(&(wc->smac[0]), (char *)&hdr->tun.mac_31_0, 4); memcpy(&(wc->smac[4]), (char *)&hdr->tun.slid_mac_47_32, 2); @@ -841,7 +842,6 @@ repoll: } } - wc->slid = be16_to_cpu(cqe->rlid); g_mlpath_rqpn = be32_to_cpu(cqe->g_mlpath_rqpn); wc->src_qp = g_mlpath_rqpn & 0xffffff; wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f; @@ -850,6 +850,7 @@ repoll: wc->wc_flags |= mlx4_ib_ipoib_csum_ok(cqe->status, cqe->checksum) ? IB_WC_IP_CSUM_OK : 0; if (is_eth) { + wc->slid = 0; wc->sl = be16_to_cpu(cqe->sl_vid) >> 13; if (be32_to_cpu(cqe->vlan_my_qpn) & MLX4_CQE_CVLAN_PRESENT_MASK) { @@ -861,6 +862,7 @@ repoll: memcpy(wc->smac, cqe->smac, ETH_ALEN); wc->wc_flags |= (IB_WC_WITH_VLAN | IB_WC_WITH_SMAC); } else { + wc->slid = be16_to_cpu(cqe->rlid); wc->sl = be16_to_cpu(cqe->sl_vid) >> 12; wc->vlan_id = 0xffff; } diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c index 3c37df82199f..495aabb01bfe 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c @@ -219,7 +219,6 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe, wc->ex.invalidate_rkey = be32_to_cpu(cqe->imm_inval_pkey); break; } - wc->slid = be16_to_cpu(cqe->slid); wc->src_qp = be32_to_cpu(cqe->flags_rqpn) & 0xffffff; wc->dlid_path_bits = cqe->ml_path; g = (be32_to_cpu(cqe->flags_rqpn) >> 28) & 3; @@ -234,10 +233,12 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe, } if (ll != IB_LINK_LAYER_ETHERNET) { + wc->slid = be16_to_cpu(cqe->slid); wc->sl = (be32_to_cpu(cqe->flags_rqpn) >> 24) & 0xf; return; } + wc->slid = 0; vlan_present = cqe_has_vlan(cqe); roce_packet_type = (be32_to_cpu(cqe->flags_rqpn) >> 24) & 0x3; if (vlan_present) { From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:10:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D073065F20D; Mon, 12 Jul 2021 13:10: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 4GNkdS5qmSz3hFp; Mon, 12 Jul 2021 13:10: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 80FB87248; Mon, 12 Jul 2021 13:10: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 16CDA33g097621; Mon, 12 Jul 2021 13:10:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CDA3mr097619; Mon, 12 Jul 2021 13:10:03 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:10:03 GMT Message-Id: <202107121310.16CDA3mr097619@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: 9dfa21486e1d - main - mlx5en: Allocate per-channel doorbells. 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: 9dfa21486e1db730305abd63df449bcc1e76127b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:10:06 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=9dfa21486e1db730305abd63df449bcc1e76127b commit 9dfa21486e1db730305abd63df449bcc1e76127b Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:59 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:22:34 +0000 mlx5en: Allocate per-channel doorbells. To avoid congestion on the same PCI memory register space when traffic consists mostly of small packets. MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_en/en.h | 6 ++-- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 61 ++++++++++++++++++++++++------------- sys/dev/mlx5/mlx5_en/mlx5_en_rl.c | 5 +-- 3 files changed, 44 insertions(+), 28 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index b249a82d30ef..c84e2af237b2 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -870,6 +870,7 @@ mlx5e_sq_queue_level(struct mlx5e_sq *sq) struct mlx5e_channel { struct mlx5e_rq rq; struct m_snd_tag tag; + struct mlx5_sq_bfreg bfreg; struct mlx5e_sq sq[MLX5E_MAX_TX_NUM_TC]; struct mlx5e_priv *priv; struct completion completion; @@ -1073,8 +1074,6 @@ struct mlx5e_priv { struct mlx5e_dcbx dcbx; bool sw_is_port_buf_owner; - struct mlx5_sq_bfreg bfreg; - struct pfil_head *pfil; struct mlx5e_channel channel[]; }; @@ -1201,7 +1200,8 @@ int mlx5e_open_cq(struct mlx5e_priv *, struct mlx5e_cq_param *, void mlx5e_close_cq(struct mlx5e_cq *); void mlx5e_free_sq_db(struct mlx5e_sq *); int mlx5e_alloc_sq_db(struct mlx5e_sq *); -int mlx5e_enable_sq(struct mlx5e_sq *, struct mlx5e_sq_param *, int tis_num); +int mlx5e_enable_sq(struct mlx5e_sq *, struct mlx5e_sq_param *, + const struct mlx5_sq_bfreg *, int tis_num); int mlx5e_modify_sq(struct mlx5e_sq *, int curr_state, int next_state); void mlx5e_disable_sq(struct mlx5e_sq *); void mlx5e_drain_sq(struct mlx5e_sq *); diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index d9860c24114b..b67f382522e7 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1619,8 +1619,6 @@ mlx5e_create_sq(struct mlx5e_channel *c, &sq->dma_tag))) goto done; - sq->uar_map = priv->bfreg.map; - err = mlx5_wq_cyc_create(mdev, ¶m->wq, sqc_wq, &sq->wq, &sq->wq_ctrl); if (err) @@ -1668,7 +1666,7 @@ mlx5e_destroy_sq(struct mlx5e_sq *sq) int mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, - int tis_num) + const struct mlx5_sq_bfreg *bfreg, int tis_num) { void *in; void *sqc; @@ -1683,6 +1681,8 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, if (in == NULL) return (-ENOMEM); + sq->uar_map = bfreg->map; + ts_format = mlx5_get_sq_default_ts(sq->priv->mdev); sqc = MLX5_ADDR_OF(create_sq_in, in, ctx); wq = MLX5_ADDR_OF(sqc, sqc, wq); @@ -1698,7 +1698,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, MLX5_SET(sqc, sqc, allow_swp, 1); MLX5_SET(wq, wq, wq_type, MLX5_WQ_TYPE_CYCLIC); - MLX5_SET(wq, wq, uar_page, sq->priv->bfreg.index); + MLX5_SET(wq, wq, uar_page, bfreg->index); MLX5_SET(wq, wq, log_wq_pg_sz, sq->wq_ctrl.buf.page_shift - PAGE_SHIFT); MLX5_SET64(wq, wq, dbr_addr, sq->wq_ctrl.db.dma); @@ -1764,7 +1764,7 @@ mlx5e_open_sq(struct mlx5e_channel *c, if (err) return (err); - err = mlx5e_enable_sq(sq, param, c->priv->tisn[tc]); + err = mlx5e_enable_sq(sq, param, &c->bfreg, c->priv->tisn[tc]); if (err) goto err_destroy_sq; @@ -3763,10 +3763,12 @@ static const char *mlx5e_pport_stats_desc[] = { MLX5E_PPORT_STATS(MLX5E_STATS_DESC) }; -static void -mlx5e_priv_static_init(struct mlx5e_priv *priv, const uint32_t channels) +static int +mlx5e_priv_static_init(struct mlx5e_priv *priv, struct mlx5_core_dev *mdev, + const uint32_t channels) { uint32_t x; + int err; mtx_init(&priv->async_events_mtx, "mlx5async", MTX_NETWORK_LOCK, MTX_DEF); sx_init(&priv->state_lock, "mlx5state"); @@ -3774,13 +3776,34 @@ mlx5e_priv_static_init(struct mlx5e_priv *priv, const uint32_t channels) MLX5_INIT_DOORBELL_LOCK(&priv->doorbell_lock); for (x = 0; x != channels; x++) mlx5e_chan_static_init(priv, &priv->channel[x], x); + + for (x = 0; x != channels; x++) { + err = mlx5_alloc_bfreg(mdev, &priv->channel[x].bfreg, false, false); + if (err) + goto err_alloc_bfreg; + } + return (0); + +err_alloc_bfreg: + while (x--) + mlx5_free_bfreg(mdev, &priv->channel[x].bfreg); + + for (x = 0; x != channels; x++) + mlx5e_chan_static_destroy(&priv->channel[x]); + callout_drain(&priv->watchdog); + mtx_destroy(&priv->async_events_mtx); + sx_destroy(&priv->state_lock); + return (err); } static void -mlx5e_priv_static_destroy(struct mlx5e_priv *priv, const uint32_t channels) +mlx5e_priv_static_destroy(struct mlx5e_priv *priv, struct mlx5_core_dev *mdev, + const uint32_t channels) { uint32_t x; + for (x = 0; x != channels; x++) + mlx5_free_bfreg(mdev, &priv->channel[x].bfreg); for (x = 0; x != channels; x++) mlx5e_chan_static_destroy(&priv->channel[x]); callout_drain(&priv->watchdog); @@ -4397,7 +4420,10 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) goto err_free_priv; } /* setup all static fields */ - mlx5e_priv_static_init(priv, mdev->priv.eq_table.num_comp_vectors); + if (mlx5e_priv_static_init(priv, mdev, mdev->priv.eq_table.num_comp_vectors)) { + mlx5_core_err(mdev, "mlx5e_priv_static_init() failed\n"); + goto err_free_ifp; + } ifp->if_softc = priv; if_initname(ifp, "mce", device_get_unit(mdev->pdev->dev.bsddev)); @@ -4508,11 +4534,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) mlx5_en_err(ifp, "mlx5e_create_mkey failed, %d\n", err); goto err_dealloc_transport_domain; } - err = mlx5_alloc_bfreg(mdev, &priv->bfreg, false, false); - if (err) { - mlx5_en_err(ifp, "alloc bfreg failed, %d\n", err); - goto err_create_mkey; - } mlx5_query_nic_vport_mac_address(priv->mdev, 0, dev_addr); /* check if we should generate a random MAC address */ @@ -4525,7 +4546,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) err = mlx5e_rl_init(priv); if (err) { mlx5_en_err(ifp, "mlx5e_rl_init failed, %d\n", err); - goto err_alloc_bfreg; + goto err_create_mkey; } err = mlx5e_tls_init(priv); @@ -4664,9 +4685,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) err_rl_init: mlx5e_rl_cleanup(priv); -err_alloc_bfreg: - mlx5_free_bfreg(mdev, &priv->bfreg); - err_create_mkey: mlx5_core_destroy_mkey(priv->mdev, &priv->mr); @@ -4683,7 +4701,9 @@ err_free_sysctl: sysctl_ctx_free(&priv->sysctl_ctx); if (priv->sysctl_debug) sysctl_ctx_free(&priv->stats.port_stats_debug.ctx); - mlx5e_priv_static_destroy(priv, mdev->priv.eq_table.num_comp_vectors); + mlx5e_priv_static_destroy(priv, mdev, mdev->priv.eq_table.num_comp_vectors); + +err_free_ifp: if_free(ifp); err_free_priv: @@ -4767,13 +4787,12 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vpriv) sysctl_ctx_free(&priv->stats.port_stats_debug.ctx); sysctl_ctx_free(&priv->sysctl_ctx); - mlx5_free_bfreg(priv->mdev, &priv->bfreg); mlx5_core_destroy_mkey(priv->mdev, &priv->mr); mlx5_dealloc_transport_domain(priv->mdev, priv->tdn); mlx5_core_dealloc_pd(priv->mdev, priv->pdn); mlx5e_disable_async_events(priv); flush_workqueue(priv->wq); - mlx5e_priv_static_destroy(priv, mdev->priv.eq_table.num_comp_vectors); + mlx5e_priv_static_destroy(priv, mdev, mdev->priv.eq_table.num_comp_vectors); if_free(ifp); free(priv, M_MLX5EN); } diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c b/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c index 33b93b1b5ced..bd66b8ecd725 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c @@ -116,9 +116,6 @@ mlx5e_rl_create_sq(struct mlx5e_priv *priv, struct mlx5e_sq *sq, &sq->dma_tag))) goto done; - /* use shared UAR */ - sq->uar_map = priv->bfreg.map; - err = mlx5_wq_cyc_create(mdev, ¶m->wq, sqc_wq, &sq->wq, &sq->wq_ctrl); if (err) @@ -165,7 +162,7 @@ mlx5e_rl_open_sq(struct mlx5e_priv *priv, struct mlx5e_sq *sq, if (err) return (err); - err = mlx5e_enable_sq(sq, param, priv->rl.tisn); + err = mlx5e_enable_sq(sq, param, &priv->channel[ix].bfreg, priv->rl.tisn); if (err) goto err_destroy_sq; From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:10:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D84C65F070; Mon, 12 Jul 2021 13:10: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 4GNkdd3QVpz3h87; Mon, 12 Jul 2021 13:10: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 0522471CD; Mon, 12 Jul 2021 13:10: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 16CDA8nr098700; Mon, 12 Jul 2021 13:10:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CDA8nx098697; Mon, 12 Jul 2021 13:10:08 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:10:08 GMT Message-Id: <202107121310.16CDA8nx098697@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: 7c3eff94bda8 - main - mlx5: Numa domain improvements. 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: 7c3eff94bda8bb746bfa7a5edc81b014e2dc97f6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:10:15 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=7c3eff94bda8bb746bfa7a5edc81b014e2dc97f6 commit 7c3eff94bda8bb746bfa7a5edc81b014e2dc97f6 Author: Hans Petter Selasky AuthorDate: 2021-06-21 13:42:20 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:52:45 +0000 mlx5: Numa domain improvements. Properly allocate all mlx5en(4) structures from correct numa domain. While at it cleanup unused numa domain integers deriving from the Linux version of mlx5en(4). MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/driver.h | 10 ++++++---- sys/dev/mlx5/mlx5_core/mlx5_alloc.c | 13 +++---------- sys/dev/mlx5/mlx5_core/mlx5_main.c | 16 +++++++++------- sys/dev/mlx5/mlx5_core/mlx5_wq.c | 21 +++++++++------------ sys/dev/mlx5/mlx5_core/wq.h | 2 -- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 28 ++++++++++++---------------- sys/dev/mlx5/mlx5_en/mlx5_en_rl.c | 10 ++++------ 7 files changed, 43 insertions(+), 57 deletions(-) diff --git a/sys/dev/mlx5/driver.h b/sys/dev/mlx5/driver.h index d21a4aa075c0..614a308e8e2f 100644 --- a/sys/dev/mlx5/driver.h +++ b/sys/dev/mlx5/driver.h @@ -985,8 +985,6 @@ void mlx5_drain_health_recovery(struct mlx5_core_dev *dev); void mlx5_trigger_health_work(struct mlx5_core_dev *dev); void mlx5_trigger_health_watchdog(struct mlx5_core_dev *dev); -#define mlx5_buf_alloc_node(dev, size, direct, buf, node) \ - mlx5_buf_alloc(dev, size, direct, buf) int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, int max_direct, struct mlx5_buf *buf); void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf); @@ -1072,10 +1070,14 @@ void mlx5_eq_debugfs_cleanup(struct mlx5_core_dev *dev); int mlx5_cq_debugfs_init(struct mlx5_core_dev *dev); void mlx5_cq_debugfs_cleanup(struct mlx5_core_dev *dev); int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db); -int mlx5_db_alloc_node(struct mlx5_core_dev *dev, struct mlx5_db *db, - int node); void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db); +static inline struct domainset * +mlx5_dev_domainset(struct mlx5_core_dev *mdev) +{ + return (linux_get_vm_domain_set(mdev->priv.numa_node)); +} + const char *mlx5_command_str(int command); int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev); void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev); diff --git a/sys/dev/mlx5/mlx5_core/mlx5_alloc.c b/sys/dev/mlx5/mlx5_core/mlx5_alloc.c index 1dabbd9f586f..99e39b80a4ec 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_alloc.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_alloc.c @@ -147,8 +147,7 @@ void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf) } EXPORT_SYMBOL_GPL(mlx5_buf_free); -static struct mlx5_db_pgdir *mlx5_alloc_db_pgdir(struct mlx5_core_dev *dev, - int node) +static struct mlx5_db_pgdir *mlx5_alloc_db_pgdir(struct mlx5_core_dev *dev) { struct mlx5_db_pgdir *pgdir; @@ -199,7 +198,7 @@ static int mlx5_alloc_db_from_pgdir(struct mlx5_db_pgdir *pgdir, return 0; } -int mlx5_db_alloc_node(struct mlx5_core_dev *dev, struct mlx5_db *db, int node) +int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db) { struct mlx5_db_pgdir *pgdir; int ret = 0; @@ -210,7 +209,7 @@ int mlx5_db_alloc_node(struct mlx5_core_dev *dev, struct mlx5_db *db, int node) if (!mlx5_alloc_db_from_pgdir(pgdir, db)) goto out; - pgdir = mlx5_alloc_db_pgdir(dev, node); + pgdir = mlx5_alloc_db_pgdir(dev); if (!pgdir) { ret = -ENOMEM; goto out; @@ -226,12 +225,6 @@ out: return ret; } -EXPORT_SYMBOL_GPL(mlx5_db_alloc_node); - -int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db) -{ - return mlx5_db_alloc_node(dev, db, dev->priv.numa_node); -} EXPORT_SYMBOL_GPL(mlx5_db_alloc); void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index 755e8844a892..7527af524456 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -82,8 +82,6 @@ SYSCTL_INT(_hw_mlx5, OID_AUTO, fast_unload_enabled, CTLFLAG_RWTUN, &mlx5_fast_unload_enabled, 0, "Set to enable fast unload. Clear to disable."); -#define NUMA_NO_NODE -1 - static LIST_HEAD(intf_list); static LIST_HEAD(dev_list); static DEFINE_MUTEX(intf_mutex); @@ -653,7 +651,7 @@ static int alloc_comp_eqs(struct mlx5_core_dev *dev) ncomp_vec = table->num_comp_vectors; nent = MLX5_COMP_EQ_SIZE; for (i = 0; i < ncomp_vec; i++) { - eq = kzalloc(sizeof(*eq), GFP_KERNEL); + eq = kzalloc_node(sizeof(*eq), GFP_KERNEL, dev->priv.numa_node); err = mlx5_create_map_eq(dev, eq, i + MLX5_EQ_VEC_COMP_BASE, nent, 0); @@ -715,7 +713,7 @@ static void mlx5_add_device(struct mlx5_interface *intf, struct mlx5_priv *priv) struct mlx5_device_context *dev_ctx; struct mlx5_core_dev *dev = container_of(priv, struct mlx5_core_dev, priv); - dev_ctx = kzalloc(sizeof(*dev_ctx), GFP_KERNEL); + dev_ctx = kzalloc_node(sizeof(*dev_ctx), GFP_KERNEL, priv->numa_node); if (!dev_ctx) return; @@ -869,8 +867,6 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, struct mlx5_priv *priv) INIT_LIST_HEAD(&priv->pgdir_list); spin_lock_init(&priv->mkey_lock); - priv->numa_node = NUMA_NO_NODE; - err = mlx5_pci_enable_device(dev); if (err) { mlx5_core_err(dev, "Cannot enable PCI device, aborting\n"); @@ -1314,14 +1310,20 @@ static int init_one(struct pci_dev *pdev, int num_vfs, sriov_pos; #endif int i,err; + int numa_node; struct sysctl_oid *pme_sysctl_node; struct sysctl_oid *pme_err_sysctl_node; struct sysctl_oid *cap_sysctl_node; struct sysctl_oid *current_cap_sysctl_node; struct sysctl_oid *max_cap_sysctl_node; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + numa_node = dev_to_node(&pdev->dev); + + dev = kzalloc_node(sizeof(*dev), GFP_KERNEL, numa_node); + priv = &dev->priv; + priv->numa_node = numa_node; + if (id) priv->pci_dev_data = id->driver_data; diff --git a/sys/dev/mlx5/mlx5_core/mlx5_wq.c b/sys/dev/mlx5/mlx5_core/mlx5_wq.c index 6cbb7c0000ae..131ed9bfce2a 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_wq.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_wq.c @@ -69,15 +69,14 @@ int mlx5_wq_cyc_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, wq->log_stride = MLX5_GET(wq, wqc, log_wq_stride); wq->sz_m1 = (1 << MLX5_GET(wq, wqc, log_wq_sz)) - 1; - err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node); + err = mlx5_db_alloc(mdev, &wq_ctrl->db); if (err) { mlx5_core_warn(mdev, "mlx5_db_alloc() failed, %d\n", err); return err; } - err = mlx5_buf_alloc_node(mdev, mlx5_wq_cyc_get_byte_size(wq), - max_direct, &wq_ctrl->buf, - param->buf_numa_node); + err = mlx5_buf_alloc(mdev, mlx5_wq_cyc_get_byte_size(wq), + max_direct, &wq_ctrl->buf); if (err) { mlx5_core_warn(mdev, "mlx5_buf_alloc() failed, %d\n", err); goto err_db_free; @@ -107,15 +106,14 @@ int mlx5_cqwq_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, wq->log_sz = MLX5_GET(cqc, cqc, log_cq_size); wq->sz_m1 = (1 << wq->log_sz) - 1; - err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node); + err = mlx5_db_alloc(mdev, &wq_ctrl->db); if (err) { mlx5_core_warn(mdev, "mlx5_db_alloc() failed, %d\n", err); return err; } - err = mlx5_buf_alloc_node(mdev, mlx5_cqwq_get_byte_size(wq), - max_direct, &wq_ctrl->buf, - param->buf_numa_node); + err = mlx5_buf_alloc(mdev, mlx5_cqwq_get_byte_size(wq), + max_direct, &wq_ctrl->buf); if (err) { mlx5_core_warn(mdev, "mlx5_buf_alloc() failed, %d\n", err); goto err_db_free; @@ -146,15 +144,14 @@ int mlx5_wq_ll_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, wq->log_stride = MLX5_GET(wq, wqc, log_wq_stride); wq->sz_m1 = (1 << MLX5_GET(wq, wqc, log_wq_sz)) - 1; - err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node); + err = mlx5_db_alloc(mdev, &wq_ctrl->db); if (err) { mlx5_core_warn(mdev, "mlx5_db_alloc() failed, %d\n", err); return err; } - err = mlx5_buf_alloc_node(mdev, mlx5_wq_ll_get_byte_size(wq), - max_direct, &wq_ctrl->buf, - param->buf_numa_node); + err = mlx5_buf_alloc(mdev, mlx5_wq_ll_get_byte_size(wq), + max_direct, &wq_ctrl->buf); if (err) { mlx5_core_warn(mdev, "mlx5_buf_alloc() failed, %d\n", err); goto err_db_free; diff --git a/sys/dev/mlx5/mlx5_core/wq.h b/sys/dev/mlx5/mlx5_core/wq.h index 13f26b0dd9a1..f513e4d7f6b4 100644 --- a/sys/dev/mlx5/mlx5_core/wq.h +++ b/sys/dev/mlx5/mlx5_core/wq.h @@ -32,8 +32,6 @@ struct mlx5_wq_param { int linear; - int buf_numa_node; - int db_numa_node; }; struct mlx5_wq_ctrl { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 9345798006f2..170fb03be968 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1261,7 +1261,8 @@ mlx5e_create_rq(struct mlx5e_channel *c, if (err) goto err_rq_wq_destroy; - rq->mbuf = malloc(wq_sz * sizeof(rq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO); + rq->mbuf = malloc_domainset(wq_sz * sizeof(rq->mbuf[0]), M_MLX5EN, + mlx5_dev_domainset(mdev), M_WAITOK | M_ZERO); for (i = 0; i != wq_sz; i++) { struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(&rq->wq, i); int j; @@ -1525,7 +1526,8 @@ mlx5e_alloc_sq_db(struct mlx5e_sq *sq) int err; int x; - sq->mbuf = malloc(wq_sz * sizeof(sq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO); + sq->mbuf = malloc_domainset(wq_sz * sizeof(sq->mbuf[0]), M_MLX5EN, + mlx5_dev_domainset(sq->priv->mdev), M_WAITOK | M_ZERO); /* Create DMA descriptor MAPs */ for (x = 0; x != wq_sz; x++) { @@ -1619,6 +1621,11 @@ mlx5e_create_sq(struct mlx5e_channel *c, &sq->dma_tag))) goto done; + sq->mkey_be = cpu_to_be32(priv->mr.key); + sq->ifp = priv->ifp; + sq->priv = priv; + sq->tc = tc; + err = mlx5_wq_cyc_create(mdev, ¶m->wq, sqc_wq, &sq->wq, &sq->wq_ctrl); if (err) @@ -1630,11 +1637,6 @@ mlx5e_create_sq(struct mlx5e_channel *c, if (err) goto err_sq_wq_destroy; - sq->mkey_be = cpu_to_be32(priv->mr.key); - sq->ifp = priv->ifp; - sq->priv = priv; - sq->tc = tc; - mlx5e_update_sq_inline(sq); snprintf(buffer, sizeof(buffer), "txstat%dtc%d", c->ix, tc); @@ -1927,9 +1929,6 @@ mlx5e_create_cq(struct mlx5e_priv *priv, int err; u32 i; - param->wq.buf_numa_node = 0; - param->wq.db_numa_node = 0; - err = mlx5_vector2eqn(mdev, eq_ix, &eqn_not_used, &irqn); if (err) return (err); @@ -2292,8 +2291,6 @@ mlx5e_build_rq_param(struct mlx5e_priv *priv, MLX5_SET(wq, wq, log_wq_sz, priv->params.log_rq_size); MLX5_SET(wq, wq, pd, priv->pdn); - param->wq.buf_numa_node = 0; - param->wq.db_numa_node = 0; param->wq.linear = 1; } @@ -2308,8 +2305,6 @@ mlx5e_build_sq_param(struct mlx5e_priv *priv, MLX5_SET(wq, wq, log_wq_stride, ilog2(MLX5_SEND_WQE_BB)); MLX5_SET(wq, wq, pd, priv->pdn); - param->wq.buf_numa_node = 0; - param->wq.db_numa_node = 0; param->wq.linear = 1; } @@ -4430,13 +4425,14 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) mlx5_core_dbg(mdev, "mlx5e_check_required_hca_cap() failed\n"); return (NULL); } + /* * Try to allocate the priv and make room for worst-case * number of channel structures: */ - priv = malloc(sizeof(*priv) + + priv = malloc_domainset(sizeof(*priv) + (sizeof(priv->channel[0]) * mdev->priv.eq_table.num_comp_vectors), - M_MLX5EN, M_WAITOK | M_ZERO); + M_MLX5EN, mlx5_dev_domainset(mdev), M_WAITOK | M_ZERO); ifp = priv->ifp = if_alloc_dev(IFT_ETHER, mdev->pdev->dev.bsddev); if (ifp == NULL) { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c b/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c index bd66b8ecd725..fa7b812fbdf1 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c @@ -51,8 +51,6 @@ mlx5e_rl_build_sq_param(struct mlx5e_rl_priv_data *rl, MLX5_SET(wq, wq, log_wq_stride, ilog2(MLX5_SEND_WQE_BB)); MLX5_SET(wq, wq, pd, rl->priv->pdn); - param->wq.buf_numa_node = 0; - param->wq.db_numa_node = 0; param->wq.linear = 1; } @@ -116,6 +114,10 @@ mlx5e_rl_create_sq(struct mlx5e_priv *priv, struct mlx5e_sq *sq, &sq->dma_tag))) goto done; + sq->mkey_be = cpu_to_be32(priv->mr.key); + sq->ifp = priv->ifp; + sq->priv = priv; + err = mlx5_wq_cyc_create(mdev, ¶m->wq, sqc_wq, &sq->wq, &sq->wq_ctrl); if (err) @@ -127,10 +129,6 @@ mlx5e_rl_create_sq(struct mlx5e_priv *priv, struct mlx5e_sq *sq, if (err) goto err_sq_wq_destroy; - sq->mkey_be = cpu_to_be32(priv->mr.key); - sq->ifp = priv->ifp; - sq->priv = priv; - mlx5e_update_sq_inline(sq); return (0); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:10:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EBB6765F302; Mon, 12 Jul 2021 13:10: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 4GNkdb17rRz3hPF; Mon, 12 Jul 2021 13:10: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 E0D2D7368; Mon, 12 Jul 2021 13:10: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 16CDA7kk098489; Mon, 12 Jul 2021 13:10:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CDA7Q3098485; Mon, 12 Jul 2021 13:10:07 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:10:07 GMT Message-Id: <202107121310.16CDA7Q3098485@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: cbf6911e10d7 - main - mlx5: Fix for uninitialized "uid" field. 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: cbf6911e10d7ed4e772affdd03cb4d439669acbd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:10:12 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=cbf6911e10d7ed4e772affdd03cb4d439669acbd commit cbf6911e10d7ed4e772affdd03cb4d439669acbd Author: Hans Petter Selasky AuthorDate: 2021-06-21 13:41:11 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 12:38:51 +0000 mlx5: Fix for uninitialized "uid" field. Make sure the "uid" field gets properly set when destroying DCT and QP objects by making a copy of the field when creating such objects. MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/driver.h | 1 + sys/dev/mlx5/mlx5_core/mlx5_qp.c | 90 +++++++++++++++++++++++++++++----------- sys/dev/mlx5/mlx5_ifc.h | 34 +++++++-------- sys/dev/mlx5/qp.h | 1 + 4 files changed, 84 insertions(+), 42 deletions(-) diff --git a/sys/dev/mlx5/driver.h b/sys/dev/mlx5/driver.h index c36380505fbb..d21a4aa075c0 100644 --- a/sys/dev/mlx5/driver.h +++ b/sys/dev/mlx5/driver.h @@ -805,6 +805,7 @@ struct mlx5_core_dct { struct completion drained; struct mlx5_rsc_debug *dbg; int pid; + u16 uid; }; enum { diff --git a/sys/dev/mlx5/mlx5_core/mlx5_qp.c b/sys/dev/mlx5/mlx5_core/mlx5_qp.c index c5fb95cc2d2b..441c005b9920 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_qp.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_qp.c @@ -133,6 +133,7 @@ int mlx5_core_create_qp(struct mlx5_core_dev *dev, if (err) return err; + qp->uid = MLX5_GET(create_qp_in, in, uid); qp->qpn = MLX5_GET(create_qp_out, out, qpn); mlx5_core_dbg(dev, "qpn = 0x%x\n", qp->qpn); @@ -145,8 +146,9 @@ int mlx5_core_create_qp(struct mlx5_core_dev *dev, return 0; err_cmd: - MLX5_SET(destroy_qp_in, in, opcode, MLX5_CMD_OP_DESTROY_QP); - MLX5_SET(destroy_qp_in, in, qpn, qp->qpn); + MLX5_SET(destroy_qp_in, din, opcode, MLX5_CMD_OP_DESTROY_QP); + MLX5_SET(destroy_qp_in, din, qpn, qp->qpn); + MLX5_SET(destroy_qp_in, din, uid, qp->uid); mlx5_cmd_exec(dev, din, sizeof(din), dout, sizeof(dout)); return err; } @@ -164,6 +166,7 @@ int mlx5_core_destroy_qp(struct mlx5_core_dev *dev, MLX5_SET(destroy_qp_in, in, opcode, MLX5_CMD_OP_DESTROY_QP); MLX5_SET(destroy_qp_in, in, qpn, qp->qpn); + MLX5_SET(destroy_qp_in, in, uid, qp->uid); err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); if (err) return err; @@ -203,33 +206,40 @@ static void mbox_free(struct mbox_info *mbox) static int modify_qp_mbox_alloc(struct mlx5_core_dev *dev, u16 opcode, int qpn, u32 opt_param_mask, void *qpc, - struct mbox_info *mbox) + struct mbox_info *mbox, u16 uid) { mbox->out = NULL; mbox->in = NULL; - #define MBOX_ALLOC(mbox, typ) \ - mbox_alloc(mbox, MLX5_ST_SZ_BYTES(typ##_in), MLX5_ST_SZ_BYTES(typ##_out)) +#define MBOX_ALLOC(mbox, typ) \ + mbox_alloc(mbox, MLX5_ST_SZ_BYTES(typ##_in), MLX5_ST_SZ_BYTES(typ##_out)) - #define MOD_QP_IN_SET(typ, in, _opcode, _qpn) \ - MLX5_SET(typ##_in, in, opcode, _opcode); \ - MLX5_SET(typ##_in, in, qpn, _qpn) - #define MOD_QP_IN_SET_QPC(typ, in, _opcode, _qpn, _opt_p, _qpc) \ - MOD_QP_IN_SET(typ, in, _opcode, _qpn); \ - MLX5_SET(typ##_in, in, opt_param_mask, _opt_p); \ - memcpy(MLX5_ADDR_OF(typ##_in, in, qpc), _qpc, MLX5_ST_SZ_BYTES(qpc)) +#define MOD_QP_IN_SET(typ, in, _opcode, _qpn, _uid) \ + do { \ + MLX5_SET(typ##_in, in, opcode, _opcode); \ + MLX5_SET(typ##_in, in, qpn, _qpn); \ + MLX5_SET(typ##_in, in, uid, _uid); \ + } while (0) + +#define MOD_QP_IN_SET_QPC(typ, in, _opcode, _qpn, _opt_p, _qpc, _uid) \ + do { \ + MOD_QP_IN_SET(typ, in, _opcode, _qpn, _uid); \ + MLX5_SET(typ##_in, in, opt_param_mask, _opt_p); \ + memcpy(MLX5_ADDR_OF(typ##_in, in, qpc), _qpc, \ + MLX5_ST_SZ_BYTES(qpc)); \ + } while (0) switch (opcode) { /* 2RST & 2ERR */ case MLX5_CMD_OP_2RST_QP: if (MBOX_ALLOC(mbox, qp_2rst)) return -ENOMEM; - MOD_QP_IN_SET(qp_2rst, mbox->in, opcode, qpn); + MOD_QP_IN_SET(qp_2rst, mbox->in, opcode, qpn, uid); break; case MLX5_CMD_OP_2ERR_QP: if (MBOX_ALLOC(mbox, qp_2err)) return -ENOMEM; - MOD_QP_IN_SET(qp_2err, mbox->in, opcode, qpn); + MOD_QP_IN_SET(qp_2err, mbox->in, opcode, qpn, uid); break; /* MODIFY with QPC */ @@ -237,37 +247,37 @@ static int modify_qp_mbox_alloc(struct mlx5_core_dev *dev, u16 opcode, int qpn, if (MBOX_ALLOC(mbox, rst2init_qp)) return -ENOMEM; MOD_QP_IN_SET_QPC(rst2init_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid); break; case MLX5_CMD_OP_INIT2RTR_QP: if (MBOX_ALLOC(mbox, init2rtr_qp)) return -ENOMEM; MOD_QP_IN_SET_QPC(init2rtr_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid); break; case MLX5_CMD_OP_RTR2RTS_QP: if (MBOX_ALLOC(mbox, rtr2rts_qp)) return -ENOMEM; MOD_QP_IN_SET_QPC(rtr2rts_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid); break; case MLX5_CMD_OP_RTS2RTS_QP: if (MBOX_ALLOC(mbox, rts2rts_qp)) return -ENOMEM; MOD_QP_IN_SET_QPC(rts2rts_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid); break; case MLX5_CMD_OP_SQERR2RTS_QP: if (MBOX_ALLOC(mbox, sqerr2rts_qp)) return -ENOMEM; MOD_QP_IN_SET_QPC(sqerr2rts_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid); break; case MLX5_CMD_OP_INIT2INIT_QP: if (MBOX_ALLOC(mbox, init2init_qp)) return -ENOMEM; MOD_QP_IN_SET_QPC(init2init_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid); break; default: mlx5_core_err(dev, "Unknown transition for modify QP: OP(0x%x) QPN(0x%x)\n", @@ -287,7 +297,7 @@ int mlx5_core_qp_modify(struct mlx5_core_dev *dev, u16 opcode, int err; err = modify_qp_mbox_alloc(dev, opcode, qp->qpn, - opt_param_mask, qpc, &mbox); + opt_param_mask, qpc, &mbox, qp->uid); if (err) return err; @@ -367,6 +377,7 @@ int mlx5_core_create_dct(struct mlx5_core_dev *dev, } dct->dctn = MLX5_GET(create_dct_out, out, dctn); + dct->uid = MLX5_GET(create_dct_in, in, uid); dct->common.res = MLX5_RES_DCT; spin_lock_irq(&table->lock); @@ -386,6 +397,7 @@ int mlx5_core_create_dct(struct mlx5_core_dev *dev, err_cmd: MLX5_SET(destroy_dct_in, din, opcode, MLX5_CMD_OP_DESTROY_DCT); MLX5_SET(destroy_dct_in, din, dctn, dct->dctn); + MLX5_SET(destroy_dct_in, din, uid, dct->uid); mlx5_cmd_exec(dev, &din, sizeof(din), dout, sizeof(dout)); return err; @@ -400,6 +412,7 @@ static int mlx5_core_drain_dct(struct mlx5_core_dev *dev, MLX5_SET(drain_dct_in, in, opcode, MLX5_CMD_OP_DRAIN_DCT); MLX5_SET(drain_dct_in, in, dctn, dct->dctn); + MLX5_SET(drain_dct_in, in, uid, dct->uid); return mlx5_cmd_exec(dev, (void *)&in, sizeof(in), (void *)&out, sizeof(out)); } @@ -437,6 +450,7 @@ free_dct: MLX5_SET(destroy_dct_in, in, opcode, MLX5_CMD_OP_DESTROY_DCT); MLX5_SET(destroy_dct_in, in, dctn, dct->dctn); + MLX5_SET(destroy_dct_in, in, uid, dct->uid); return mlx5_cmd_exec(dev, (void *)&in, sizeof(in), (void *)&out, sizeof(out)); @@ -469,6 +483,17 @@ int mlx5_core_arm_dct(struct mlx5_core_dev *dev, struct mlx5_core_dct *dct) } EXPORT_SYMBOL_GPL(mlx5_core_arm_dct); +static void destroy_rq_tracked(struct mlx5_core_dev *dev, u32 rqn, u16 uid) +{ + u32 in[MLX5_ST_SZ_DW(destroy_rq_in)] = {}; + u32 out[MLX5_ST_SZ_DW(destroy_rq_out)] = {}; + + MLX5_SET(destroy_rq_in, in, opcode, MLX5_CMD_OP_DESTROY_RQ); + MLX5_SET(destroy_rq_in, in, rqn, rqn); + MLX5_SET(destroy_rq_in, in, uid, uid); + mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); +} + int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen, struct mlx5_core_qp *rq) { @@ -478,9 +503,11 @@ int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen, if (err) return err; + rq->uid = MLX5_GET(create_rq_in, in, uid); + err = create_qprqsq_common(dev, rq, MLX5_RES_RQ); if (err) - mlx5_core_destroy_rq(dev, rq->qpn); + destroy_rq_tracked(dev, rq->qpn, rq->uid); return err; } @@ -490,10 +517,21 @@ void mlx5_core_destroy_rq_tracked(struct mlx5_core_dev *dev, struct mlx5_core_qp *rq) { destroy_qprqsq_common(dev, rq, MLX5_RES_RQ); - mlx5_core_destroy_rq(dev, rq->qpn); + destroy_rq_tracked(dev, rq->qpn, rq->uid); } EXPORT_SYMBOL(mlx5_core_destroy_rq_tracked); +static void destroy_sq_tracked(struct mlx5_core_dev *dev, u32 sqn, u16 uid) +{ + u32 in[MLX5_ST_SZ_DW(destroy_sq_in)] = {}; + u32 out[MLX5_ST_SZ_DW(destroy_sq_out)] = {}; + + MLX5_SET(destroy_sq_in, in, opcode, MLX5_CMD_OP_DESTROY_SQ); + MLX5_SET(destroy_sq_in, in, sqn, sqn); + MLX5_SET(destroy_sq_in, in, uid, uid); + mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); +} + int mlx5_core_create_sq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen, struct mlx5_core_qp *sq) { @@ -503,9 +541,11 @@ int mlx5_core_create_sq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen, if (err) return err; + sq->uid = MLX5_GET(create_sq_in, in, uid); + err = create_qprqsq_common(dev, sq, MLX5_RES_SQ); if (err) - mlx5_core_destroy_sq(dev, sq->qpn); + destroy_sq_tracked(dev, sq->qpn, sq->uid); return err; } @@ -515,6 +555,6 @@ void mlx5_core_destroy_sq_tracked(struct mlx5_core_dev *dev, struct mlx5_core_qp *sq) { destroy_qprqsq_common(dev, sq, MLX5_RES_SQ); - mlx5_core_destroy_sq(dev, sq->qpn); + destroy_sq_tracked(dev, sq->qpn, sq->uid); } EXPORT_SYMBOL(mlx5_core_destroy_sq_tracked); diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index d44927236f74..865548ed1981 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -3492,7 +3492,7 @@ struct mlx5_ifc_sqerr2rts_qp_out_bits { struct mlx5_ifc_sqerr2rts_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -3877,7 +3877,7 @@ struct mlx5_ifc_rts2rts_qp_out_bits { struct mlx5_ifc_rts2rts_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -3907,7 +3907,7 @@ struct mlx5_ifc_rtr2rts_qp_out_bits { struct mlx5_ifc_rtr2rts_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -3937,7 +3937,7 @@ struct mlx5_ifc_rst2init_qp_out_bits { struct mlx5_ifc_rst2init_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -5255,7 +5255,7 @@ struct mlx5_ifc_qp_2rst_out_bits { struct mlx5_ifc_qp_2rst_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -5277,7 +5277,7 @@ struct mlx5_ifc_qp_2err_out_bits { struct mlx5_ifc_qp_2err_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -5971,7 +5971,7 @@ struct mlx5_ifc_init2rtr_qp_out_bits { struct mlx5_ifc_init2rtr_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -6001,7 +6001,7 @@ struct mlx5_ifc_init2init_qp_out_bits { struct mlx5_ifc_init2init_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -6118,7 +6118,7 @@ struct mlx5_ifc_drain_dct_out_bits { struct mlx5_ifc_drain_dct_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -6274,7 +6274,7 @@ struct mlx5_ifc_destroy_sq_out_bits { struct mlx5_ifc_destroy_sq_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -6346,7 +6346,7 @@ struct mlx5_ifc_destroy_rq_out_bits { struct mlx5_ifc_destroy_rq_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -6390,7 +6390,7 @@ struct mlx5_ifc_destroy_qp_out_bits { struct mlx5_ifc_destroy_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -6587,7 +6587,7 @@ struct mlx5_ifc_destroy_dct_out_bits { struct mlx5_ifc_destroy_dct_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -7050,7 +7050,7 @@ struct mlx5_ifc_create_sq_out_bits { struct mlx5_ifc_create_sq_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -7132,7 +7132,7 @@ struct mlx5_ifc_create_rq_out_bits { struct mlx5_ifc_create_rq_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -7180,7 +7180,7 @@ struct mlx5_ifc_create_qp_out_bits { struct mlx5_ifc_create_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -7452,7 +7452,7 @@ struct mlx5_ifc_create_dct_out_bits { struct mlx5_ifc_create_dct_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; diff --git a/sys/dev/mlx5/qp.h b/sys/dev/mlx5/qp.h index aada3401f7e7..bf9fef73667d 100644 --- a/sys/dev/mlx5/qp.h +++ b/sys/dev/mlx5/qp.h @@ -466,6 +466,7 @@ struct mlx5_core_qp { int qpn; struct mlx5_rsc_debug *dbg; int pid; + u16 uid; }; struct mlx5_qp_path { From owner-dev-commits-src-main@freebsd.org Mon Jul 12 13:10:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5FAF465F0EE; Mon, 12 Jul 2021 13:10: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 4GNkdh0WZbz3hGT; Mon, 12 Jul 2021 13:10: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 080C87691; Mon, 12 Jul 2021 13:10: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 16CDA92b098914; Mon, 12 Jul 2021 13:10:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CDA9mQ098911; Mon, 12 Jul 2021 13:10:09 GMT (envelope-from git) Date: Mon, 12 Jul 2021 13:10:09 GMT Message-Id: <202107121310.16CDA9mQ098911@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: cd2c05d323d2 - main - ipoib: Fix for accessing uninitialized pointers and freed memory during attach and detach. 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: cd2c05d323d272163d04dd94caabe018ca2d4dc5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 13:10:17 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=cd2c05d323d272163d04dd94caabe018ca2d4dc5 commit cd2c05d323d272163d04dd94caabe018ca2d4dc5 Author: Hans Petter Selasky AuthorDate: 2021-07-12 13:01:19 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 13:01:19 +0000 ipoib: Fix for accessing uninitialized pointers and freed memory during attach and detach. Call infiniband_ifdetach() early to stop ifioctl(9) calls from user-space during device removal. Also make sure that ifioctl(9) calls are blocked from executing until the device is fully initialized. Ideally we would delay the infiniband_ifattach() call, but because part of the initialization is to update the link level address, that is not possible without more significant changes. MFC after: 1 week Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c | 34 +++++++++++++++++----- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c index b0f69842ac02..0982af9fb904 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -278,7 +278,13 @@ ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t data) int error = 0; /* check if detaching */ - if (priv == NULL || priv->gone != 0) + if (priv == NULL) + return (ENXIO); + /* wait for device to become ready, if any */ + while (priv->gone == 2) + pause("W", 1); + /* check for device gone */ + if (priv->gone != 0) return (ENXIO); switch (command) { @@ -822,7 +828,7 @@ out: } static void -ipoib_detach(struct ipoib_dev_priv *priv) +ipoib_ifdetach(struct ipoib_dev_priv *priv) { struct ifnet *dev; @@ -830,6 +836,16 @@ ipoib_detach(struct ipoib_dev_priv *priv) if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { priv->gone = 1; infiniband_ifdetach(dev); + } +} + +static void +ipoib_detach(struct ipoib_dev_priv *priv) +{ + struct ifnet *dev; + + dev = priv->dev; + if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { if_free(dev); free_unr(ipoib_unrhdr, priv->unit); } else @@ -845,6 +861,7 @@ ipoib_dev_cleanup(struct ipoib_dev_priv *priv) /* Delete any child interfaces first */ list_for_each_entry_safe(cpriv, tcpriv, &priv->child_intfs, list) { + ipoib_ifdetach(cpriv); ipoib_dev_cleanup(cpriv); ipoib_detach(cpriv); } @@ -897,6 +914,7 @@ ipoib_intf_alloc(const char *name) return NULL; } dev->if_softc = priv; + priv->gone = 2; /* initializing */ priv->unit = alloc_unr(ipoib_unrhdr); if (priv->unit == -1) { if_free(dev); @@ -906,7 +924,7 @@ ipoib_intf_alloc(const char *name) if_initname(dev, name, priv->unit); dev->if_flags = IFF_BROADCAST | IFF_MULTICAST; - infiniband_ifattach(dev, NULL, priv->broadcastaddr); + infiniband_ifattach(priv->dev, NULL, priv->broadcastaddr); dev->if_init = ipoib_init; dev->if_ioctl = ipoib_ioctl; @@ -915,7 +933,7 @@ ipoib_intf_alloc(const char *name) dev->if_snd.ifq_maxlen = ipoib_sendq_size * 2; priv->dev = dev; - if_link_state_change(dev, LINK_STATE_DOWN); + if_link_state_change(priv->dev, LINK_STATE_DOWN); return dev->if_softc; } @@ -1000,7 +1018,7 @@ ipoib_add_port(const char *format, struct ib_device *hca, u8 port) hca->name, port, result); goto device_init_failed; } - memcpy(IF_LLADDR(priv->dev) + 4, priv->local_gid.raw, sizeof (union ib_gid)); + memcpy(IF_LLADDR(priv->dev) + 4, priv->local_gid.raw, sizeof(union ib_gid)); result = ipoib_dev_init(priv, hca, port); if (result < 0) { @@ -1022,12 +1040,15 @@ ipoib_add_port(const char *format, struct ib_device *hca, u8 port) } if_printf(priv->dev, "Attached to %s port %d\n", hca->name, port); + priv->gone = 0; /* ready */ + return priv->dev; event_failed: ipoib_dev_cleanup(priv); device_init_failed: + ipoib_ifdetach(priv); ipoib_detach(priv); alloc_mem_failed: @@ -1088,12 +1109,11 @@ ipoib_remove_one(struct ib_device *device, void *client_data) if (rdma_port_get_link_layer(device, priv->port) != IB_LINK_LAYER_INFINIBAND) continue; + ipoib_ifdetach(priv); ipoib_stop(priv); ib_unregister_event_handler(&priv->event_handler); - /* dev_change_flags(priv->dev, priv->dev->flags & ~IFF_UP); */ - flush_workqueue(ipoib_workqueue); ipoib_dev_cleanup(priv); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 16:11:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 438AE662B6C; Mon, 12 Jul 2021 16:11: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 4GNpfZ1LtKz4fr4; Mon, 12 Jul 2021 16:11: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 183DC11C77; Mon, 12 Jul 2021 16:11: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 16CGBI0r049662; Mon, 12 Jul 2021 16:11:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CGBIPx049661; Mon, 12 Jul 2021 16:11:18 GMT (envelope-from git) Date: Mon, 12 Jul 2021 16:11:18 GMT Message-Id: <202107121611.16CGBIPx049661@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: 693ddf4dc4b9 - main - Fix LINT kernel build issues after c3987b8ea793c11f61fecb14ef93195a23e3522c . 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: 693ddf4dc4b9c1ffbe6373e186e1b121e3635f53 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 16:11:18 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=693ddf4dc4b9c1ffbe6373e186e1b121e3635f53 commit 693ddf4dc4b9c1ffbe6373e186e1b121e3635f53 Author: Hans Petter Selasky AuthorDate: 2021-07-12 15:47:15 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-12 16:00:30 +0000 Fix LINT kernel build issues after c3987b8ea793c11f61fecb14ef93195a23e3522c . Fixes the IPOIB_CM and SDP kernel options. Reported by: lwhsu @ MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c | 8 ++++---- sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c | 2 +- sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c index b61ebfd1495a..1e386a04d6d9 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c @@ -92,7 +92,7 @@ static void ipoib_cm_dma_unmap_rx(struct ipoib_dev_priv *priv, struct ipoib_cm_r static int ipoib_cm_post_receive_srq(struct ipoib_dev_priv *priv, int id) { - struct ib_recv_wr *bad_wr; + const struct ib_recv_wr *bad_wr; struct ipoib_rx_buf *rx_req; struct mbuf *m; int ret; @@ -124,7 +124,7 @@ static int ipoib_cm_post_receive_nonsrq(struct ipoib_dev_priv *priv, struct ib_sge *sge, int id) { struct ipoib_rx_buf *rx_req; - struct ib_recv_wr *bad_wr; + const struct ib_recv_wr *bad_wr; struct mbuf *m; int ret; int i; @@ -172,7 +172,7 @@ static void ipoib_cm_free_rx_ring(struct ipoib_dev_priv *priv, static void ipoib_cm_start_rx_drain(struct ipoib_dev_priv *priv) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ipoib_cm_rx *p; /* We only reserved 1 extra slot in CQ for drain WRs, so @@ -600,7 +600,7 @@ static inline int post_send(struct ipoib_dev_priv *priv, struct ipoib_cm_tx_buf *tx_req, unsigned int wr_id) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct mbuf *mb = tx_req->mb; u64 *mapping = tx_req->mapping; struct mbuf *m; diff --git a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c index bb56e1c4d7d1..e20602a8d87c 100644 --- a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c +++ b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c @@ -103,7 +103,7 @@ sdp_post_recv(struct sdp_sock *ssk) struct ib_recv_wr rx_wr = { NULL }; struct ib_sge ibsge[SDP_MAX_RECV_SGES]; struct ib_sge *sge = ibsge; - struct ib_recv_wr *bad_wr; + const struct ib_recv_wr *bad_wr; struct mbuf *mb, *m; struct sdp_bsdh *h; int id = ring_head(ssk->rx_ring); diff --git a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c index 0d35759e4b71..64f42ed8d569 100644 --- a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c +++ b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c @@ -69,7 +69,7 @@ sdp_post_send(struct sdp_sock *ssk, struct mbuf *mb) struct sdp_bsdh *h; unsigned long mseq; struct ib_device *dev; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_sge ibsge[SDP_MAX_SEND_SGES]; struct ib_sge *sge; struct ib_send_wr tx_wr = { NULL }; @@ -390,7 +390,8 @@ void sdp_post_keepalive(struct sdp_sock *ssk) { int rc; - struct ib_send_wr wr, *bad_wr; + struct ib_send_wr wr; + const struct ib_send_wr *bad_wr; sdp_dbg(ssk->socket, "%s\n", __func__); From owner-dev-commits-src-main@freebsd.org Mon Jul 12 18:31:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF74C6646CD; Mon, 12 Jul 2021 18:31: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 4GNsmv4Wnyz3H5J; Mon, 12 Jul 2021 18:31: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 8268013653; Mon, 12 Jul 2021 18:31: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 16CIVxEv037041; Mon, 12 Jul 2021 18:31:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CIVxQx037040; Mon, 12 Jul 2021 18:31:59 GMT (envelope-from git) Date: Mon, 12 Jul 2021 18:31:59 GMT Message-Id: <202107121831.16CIVxQx037040@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: 66c183f43f0c - main - mmc_cam_sim_default_action: do not touch the ccb after dispatching it MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 66c183f43f0c05ed9238ed9c1859c0c9df7b66dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 18:31:59 -0000 The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=66c183f43f0c05ed9238ed9c1859c0c9df7b66dd commit 66c183f43f0c05ed9238ed9c1859c0c9df7b66dd Author: Andriy Gapon AuthorDate: 2021-07-09 14:53:17 +0000 Commit: Andriy Gapon CommitDate: 2021-07-12 18:29:26 +0000 mmc_cam_sim_default_action: do not touch the ccb after dispatching it If MMC_SIM_CAM_REQUEST() is successful the ccb could be running or being completed as the method returns. Modifying the ccb status could override whatever status was already set by a MMC driver. I am not sure what was the purpose of setting the status to CAM_REQ_INVALID in the success path. I assume that it was to catch a possibility that the ccb could be completed without its status explicitly set. So, I am keeping the code, it's just moved to before the MMC_SIM_CAM_REQUEST call. Without this change I was getting random and phantom EIO errors on Rock64 running off an SD card (dwmmc driver) plus occasional panics like: Memory modified after free 0xffffa00003985800(2040) val=6 @ 0xffffa00003985854 panic: Most recently used by CAM CCB MFC after: 1 week --- sys/cam/mmc/mmc_sim.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/cam/mmc/mmc_sim.c b/sys/cam/mmc/mmc_sim.c index 0bb4c850f8eb..45d706f61d0a 100644 --- a/sys/cam/mmc/mmc_sim.c +++ b/sys/cam/mmc/mmc_sim.c @@ -172,11 +172,10 @@ mmc_cam_sim_default_action(struct cam_sim *sim, union ccb *ccb) break; case XPT_MMC_IO: { + ccb->ccb_h.status = CAM_REQ_INVALID; rv = MMC_SIM_CAM_REQUEST(mmc_sim->dev, ccb); if (rv != 0) ccb->ccb_h.status = CAM_SIM_QUEUED; - else - ccb->ccb_h.status = CAM_REQ_INVALID; return; /* NOTREACHED */ break; From owner-dev-commits-src-main@freebsd.org Mon Jul 12 19:52:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3730F666019; Mon, 12 Jul 2021 19:52: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 4GNvZH13tdz3kWZ; Mon, 12 Jul 2021 19:52: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 0D0DF1510E; Mon, 12 Jul 2021 19:52: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 16CJqssJ043660; Mon, 12 Jul 2021 19:52:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CJqsOR043659; Mon, 12 Jul 2021 19:52:54 GMT (envelope-from git) Date: Mon, 12 Jul 2021 19:52:54 GMT Message-Id: <202107121952.16CJqsOR043659@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: 6da773cb1ce4 - main - bsd.compiler.mk: Use CCACHE_PKG_PREFIX as ports now supports. 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: 6da773cb1ce4b5ce395266794e375b3b0f981e6a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 19:52:55 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=6da773cb1ce4b5ce395266794e375b3b0f981e6a commit 6da773cb1ce4b5ce395266794e375b3b0f981e6a Author: Bryan Drewery AuthorDate: 2021-07-12 19:51:41 +0000 Commit: Bryan Drewery CommitDate: 2021-07-12 19:52:52 +0000 bsd.compiler.mk: Use CCACHE_PKG_PREFIX as ports now supports. --- share/mk/bsd.compiler.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk index 97198f70d5b6..a52c3968fb09 100644 --- a/share/mk/bsd.compiler.mk +++ b/share/mk/bsd.compiler.mk @@ -64,8 +64,9 @@ CCACHE_BUILD_TYPE?= command # PATH since it is more clear that ccache is used and avoids wasting time # for mkdep/linking/asm builds. LOCALBASE?= /usr/local -CCACHE_WRAPPER_PATH?= ${LOCALBASE}/libexec/ccache -CCACHE_BIN?= ${LOCALBASE}/bin/ccache +CCACHE_PKG_PREFIX?= ${LOCALBASE} +CCACHE_WRAPPER_PATH?= ${CCACHE_PKG_PREFIX}/libexec/ccache +CCACHE_BIN?= ${CCACHE_PKG_PREFIX}/bin/ccache .if exists(${CCACHE_BIN}) # Export to ensure sub-makes can filter it out for mkdep/linking and # to chain down into kernel build which won't include this file. From owner-dev-commits-src-main@freebsd.org Mon Jul 12 19:55:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F05DF665DEC; Mon, 12 Jul 2021 19:55: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 4GNvd36Whkz3lHQ; Mon, 12 Jul 2021 19:55: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 B5C2C15193; Mon, 12 Jul 2021 19:55: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 16CJtJKv043944; Mon, 12 Jul 2021 19:55:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CJtJmY043943; Mon, 12 Jul 2021 19:55:19 GMT (envelope-from git) Date: Mon, 12 Jul 2021 19:55:19 GMT Message-Id: <202107121955.16CJtJmY043943@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 8b487b8292e4 - main - Fix bsd.subdir.mk-related issues after 0a0f7486413c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8b487b8292e4ab0b18998055b64235c4cc3ab771 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 19:55:20 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=8b487b8292e4ab0b18998055b64235c4cc3ab771 commit 8b487b8292e4ab0b18998055b64235c4cc3ab771 Author: Jessica Clarke AuthorDate: 2021-07-12 19:54:01 +0000 Commit: Jessica Clarke CommitDate: 2021-07-12 19:54:01 +0000 Fix bsd.subdir.mk-related issues after 0a0f7486413c Since bsd.prog.mk includes bsd.obj.mk, and thus bsd.subdir.mk, we must ensure all our bsd.subdir.mk-affecting variables are set before including bsd.prog.mk. Since sbin's various Makefile.arch files add to SUBDIR this results in those not taking effect, and presumably we also end up not having buildworld as parallel as it should be due to the fact that SUBDIR_PARALLEL was not being set before including bsd.prog.mk. MFC with: 0a0f7486413c147d56808b38055c40c64cff61f5 Reviewed by: olivier Differential Revision: https://reviews.freebsd.org/D31125 --- sbin/Makefile | 8 ++++---- usr.sbin/Makefile | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sbin/Makefile b/sbin/Makefile index f53e2f037ebe..6d6b647651ad 100644 --- a/sbin/Makefile +++ b/sbin/Makefile @@ -90,14 +90,14 @@ SUBDIR.${MK_ZFS}+= zfsbootcfg SUBDIR.${MK_TESTS}+= tests +.include + +SUBDIR_PARALLEL= + # Add architecture-specific manpages # to be included anyway MAN= sconfig/sconfig.8 .include -.include - -SUBDIR_PARALLEL= - .include diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index a5d2a476538f..f0614ba9b348 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -213,6 +213,8 @@ SUBDIR.${MK_TESTS}+= tests .include +SUBDIR_PARALLEL= + # Add architecture-specific manpages # to be included anyway MAN= apmd/apmd.8 \ @@ -220,6 +222,4 @@ MAN= apmd/apmd.8 \ .include -SUBDIR_PARALLEL= - .include From owner-dev-commits-src-main@freebsd.org Mon Jul 12 21:14:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A7356676D4; Mon, 12 Jul 2021 21:14: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 4GNxN76XCrz4Rjv; Mon, 12 Jul 2021 21:14: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 C6CA1162E7; Mon, 12 Jul 2021 21:14: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 16CLEFYU051251; Mon, 12 Jul 2021 21:14:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CLEFSr051250; Mon, 12 Jul 2021 21:14:15 GMT (envelope-from git) Date: Mon, 12 Jul 2021 21:14:15 GMT Message-Id: <202107122114.16CLEFSr051250@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: 71f6aea4150c - main - loader: update autoboot description and move to loader.conf.5 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: 71f6aea4150c66784cbad42c1e1ff908d909c2ec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 21:14:16 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=71f6aea4150c66784cbad42c1e1ff908d909c2ec commit 71f6aea4150c66784cbad42c1e1ff908d909c2ec Author: Daniel Gerzo AuthorDate: 2021-07-12 21:13:03 +0000 Commit: Warner Losh CommitDate: 2021-07-12 21:13:03 +0000 loader: update autoboot description and move to loader.conf.5 Document "NO" special value for the autoboot_delay and move the description to loader.conf.5. imp reworked some of the wording from danger's patch. Reviewed by: imp PR: 85128 Differential Revision: https://reviews.freebsd.org/D11887 --- stand/defaults/loader.conf.5 | 43 ++++++++++++++++++++++++++++++++++++++++++- stand/man/loader.8 | 31 ++----------------------------- 2 files changed, 44 insertions(+), 30 deletions(-) diff --git a/stand/defaults/loader.conf.5 b/stand/defaults/loader.conf.5 index 76ec32ef6bec..b4109371a1cf 100644 --- a/stand/defaults/loader.conf.5 +++ b/stand/defaults/loader.conf.5 @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd January 6, 2021 +.Dd July 10, 2021 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -77,6 +77,47 @@ may have any prefix; the prefix identifies a module. All such settings sharing a common prefix refer to the same module. .Bl -tag -width Ar +.It Ar autoboot_delay +Delay in seconds before automatically booting. +A user with console access will be able to interrupt the +.Ic autoboot +process and escape into the interactive mode by pressing a key on +the console during this delay. +.Pp +If set to +.Dq Li NO , +no +.Ic autoboot +is automatically attempted after processing +.Pa /boot/loader.rc , +though explicit +.Ic autoboot Ns 's +are processed normally, using a 10 second delay. +.Pp +If set to +.Dq Li 0 , +no delay is inserted, but any keys pressed while the kernel and modules are +loaded will enter interactive mode. +.Pp +If set to +.Dq Li -1 , +no delay will be inserted and +.Nm +starts interactive mode only if +.Ic autoboot +has failed. +In combination with the +.Va beastie_disable +option, this option prevents users with console access from being able +to interrupt the +.Ic autoboot +process and escape to the loader prompt. +To use the +.Va autoboot_delay +option in this manner, +.Va beastie_disable +must be set to +.Dq Li YES . .It Ar exec Immediately executes a .Xr loader 8 diff --git a/stand/man/loader.8 b/stand/man/loader.8 index 4555f99627c7..f6e550ae9862 100644 --- a/stand/man/loader.8 +++ b/stand/man/loader.8 @@ -354,35 +354,8 @@ Both types of builtin variables are described below. Number of seconds .Ic autoboot will wait before booting. -If this variable is not defined, -.Ic autoboot -will default to 10 seconds. -.Pp -If set to -.Dq Li NO , -no -.Ic autoboot -will be automatically attempted after processing -.Pa /boot/loader.rc , -though explicit -.Ic autoboot Ns 's -will be processed normally, defaulting to 10 seconds delay. -.Pp -If set to -.Dq Li 0 , -no delay will be inserted, but user still will be able to interrupt -.Ic autoboot -process and escape into the interactive mode by pressing some key -on the console while kernel and -modules are being loaded. -.Pp -If set to -.Dq Li -1 , -no delay will be inserted and -.Nm -will engage interactive mode only if -.Ic autoboot -has failed for some reason. +Configuration options are described in +.Xr loader.conf 5 . .It Va boot_askname Instructs the kernel to prompt the user for the name of the root device when the kernel is booted. From owner-dev-commits-src-main@freebsd.org Mon Jul 12 21:14:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A94766673D7; Mon, 12 Jul 2021 21:14: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 4GNxN91nYXz4S5D; Mon, 12 Jul 2021 21:14: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 099491603E; Mon, 12 Jul 2021 21:14: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 16CLEGrE051275; Mon, 12 Jul 2021 21:14:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CLEGqx051274; Mon, 12 Jul 2021 21:14:16 GMT (envelope-from git) Date: Mon, 12 Jul 2021 21:14:16 GMT Message-Id: <202107122114.16CLEGqx051274@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: dc5a0d6d6d0c - main - ddb(4): improve wording 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: dc5a0d6d6d0c4ad88d032762f036876fb64eb0d5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 21:14:17 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=dc5a0d6d6d0c4ad88d032762f036876fb64eb0d5 commit dc5a0d6d6d0c4ad88d032762f036876fb64eb0d5 Author: Warner Losh AuthorDate: 2021-07-12 21:13:13 +0000 Commit: Warner Losh CommitDate: 2021-07-12 21:13:13 +0000 ddb(4): improve wording Incorporate feedback overlooked in revew by wblock@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D4860 --- share/man/man4/ddb.4 | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/share/man/man4/ddb.4 b/share/man/man4/ddb.4 index 4f1614d8e006..bc46051c37ed 100644 --- a/share/man/man4/ddb.4 +++ b/share/man/man4/ddb.4 @@ -1538,41 +1538,39 @@ Embedded systems often use JTAG for debugging, but rarely use it in combination with .Nm . .Pp -For serial consoles, you can enter the debugger by sending a BREAK -condition on the serial line if +Serial consoles can break to the debugger by sending a BREAK +condition on the serial line. +This requires a kernel built with .Cd options BREAK_TO_DEBUGGER is specified in the kernel. Most terminal emulation programs can send a break sequence with a -special key sequence or via a menu item. -However, in some setups, sending the break can be difficult to arrange -or happens spuriously, so if the kernel contains +special key sequence or menu selection. +Sending the break can be difficult or even happen spuriously in some setups. +An alternative method is to build a kernel with .Cd options ALT_BREAK_TO_DEBUGGER then the sequence of CR TILDE CTRL-B enters the debugger; -CR TILDE CTRL-P causes a panic instead of entering the -debugger; and +CR TILDE CTRL-P causes a panic; and CR TILDE CTRL-R causes an immediate reboot. -In all the above sequences, CR is a Carriage Return and is usually -sent by hitting the Enter or Return key. +In all these sequences, CR represents Carriage Return and is usually +sent by pressing the Enter or Return key. TILDE is the ASCII tilde character (~). -CTRL-x is Control x created by hitting the control key and then x +CTRL-x is Control x, send by pressing the Control key, then x, then releasing both. and then releasing both. .Pp -The break to enter the debugger behavior may be enabled at run-time -by setting the +The break-to-debugger behavior can be enabled by setting .Xr sysctl 8 .Va debug.kdb.break_to_debugger to 1. -The alternate sequence to enter the debugger behavior may be enabled -at run-time by setting the +The alt-break-to-debugger behavior can be enabled by setting .Xr sysctl 8 .Va debug.kdb.alt_break_to_debugger to 1. -The debugger may be entered by setting the +The debugger can be entered by setting .Xr sysctl 8 .Va debug.kdb.enter to 1. .Pp -Output may be interrupted, paused, and resumed with the control +Output can be interrupted, paused, and resumed with the control characters CTRL-C, CTRL-S, and CTRL-Q. Because these control characters are received as in-band data from the console, there is an input buffer, and once that buffer fills From owner-dev-commits-src-main@freebsd.org Mon Jul 12 21:25:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 989A5667B50; Mon, 12 Jul 2021 21:25: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 4GNxcb3rs7z4TRh; Mon, 12 Jul 2021 21:25: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 68CE81650A; Mon, 12 Jul 2021 21:25: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 16CLP38h064412; Mon, 12 Jul 2021 21:25:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CLP3Uq064411; Mon, 12 Jul 2021 21:25:03 GMT (envelope-from git) Date: Mon, 12 Jul 2021 21:25:03 GMT Message-Id: <202107122125.16CLP3Uq064411@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: 5eb61f6c6549 - main - zfs: merge openzfs/zfs@07a4c76e9 (master) into main MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5eb61f6c6549f134a4f3bed4c164345d4f616bad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 21:25:03 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=5eb61f6c6549f134a4f3bed4c164345d4f616bad commit 5eb61f6c6549f134a4f3bed4c164345d4f616bad Merge: dc5a0d6d6d0c 07a4c76e9016 Author: Martin Matuska AuthorDate: 2021-07-12 21:23:38 +0000 Commit: Martin Matuska CommitDate: 2021-07-12 21:24:45 +0000 zfs: merge openzfs/zfs@07a4c76e9 (master) into main Notable upstream pull request merges: #12299 file reference counts can get corrupted #12320 FreeBSD: Use unmapped I/O for scattered/gang ABD buffers Obtained from: OpenZFS OpenZFS commit: 07a4c76e9016fad22f1ce2613ab5abc4b2652114 .../openzfs/.github/ISSUE_TEMPLATE/bug_report.md | 16 +-- sys/contrib/openzfs/include/sys/dbuf.h | 2 +- sys/contrib/openzfs/include/sys/dnode.h | 2 +- sys/contrib/openzfs/include/sys/fm/util.h | 5 +- sys/contrib/openzfs/include/sys/zfs_file.h | 6 +- sys/contrib/openzfs/include/sys/zfs_ioctl.h | 2 +- sys/contrib/openzfs/include/sys/zfs_onexit.h | 4 +- sys/contrib/openzfs/lib/libzfs/libzfs_pool.c | 4 +- sys/contrib/openzfs/lib/libzpool/kernel.c | 20 ++-- .../openzfs/module/os/freebsd/zfs/vdev_geom.c | 123 +++++++++++++++++++-- .../openzfs/module/os/freebsd/zfs/zfs_file_os.c | 19 +--- .../openzfs/module/os/linux/zfs/zfs_file_os.c | 28 ++--- sys/contrib/openzfs/module/zfs/fm.c | 20 ++-- sys/contrib/openzfs/module/zfs/zfs_ioctl.c | 71 ++++++------ sys/contrib/openzfs/module/zfs/zfs_onexit.c | 23 ++-- sys/modules/zfs/zfs_config.h | 4 +- 16 files changed, 220 insertions(+), 129 deletions(-) diff --cc sys/modules/zfs/zfs_config.h index ddb2527e56fd,000000000000..87b0ae33fb81 mode 100644,000000..100644 --- a/sys/modules/zfs/zfs_config.h +++ b/sys/modules/zfs/zfs_config.h @@@ -1,846 -1,0 +1,846 @@@ +/* + * $FreeBSD$ + */ + +/* zfs_config.h. Generated from zfs_config.h.in by configure. */ +/* zfs_config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +/* #undef ENABLE_NLS */ + +/* bio_end_io_t wants 1 arg */ +/* #undef HAVE_1ARG_BIO_END_IO_T */ + +/* lookup_bdev() wants 1 arg */ +/* #undef HAVE_1ARG_LOOKUP_BDEV */ + +/* submit_bio() wants 1 arg */ +/* #undef HAVE_1ARG_SUBMIT_BIO */ + +/* bdi_setup_and_register() wants 2 args */ +/* #undef HAVE_2ARGS_BDI_SETUP_AND_REGISTER */ + +/* vfs_getattr wants 2 args */ +/* #undef HAVE_2ARGS_VFS_GETATTR */ + +/* zlib_deflate_workspacesize() wants 2 args */ +/* #undef HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE */ + +/* bdi_setup_and_register() wants 3 args */ +/* #undef HAVE_3ARGS_BDI_SETUP_AND_REGISTER */ + +/* vfs_getattr wants 3 args */ +/* #undef HAVE_3ARGS_VFS_GETATTR */ + +/* vfs_getattr wants 4 args */ +/* #undef HAVE_4ARGS_VFS_GETATTR */ + +/* kernel has access_ok with 'type' parameter */ +/* #undef HAVE_ACCESS_OK_TYPE */ + +/* posix_acl has refcount_t */ +/* #undef HAVE_ACL_REFCOUNT */ + +/* Define if host toolchain supports AES */ +#define HAVE_AES 1 + +#ifdef __amd64__ +#ifndef RESCUE +/* Define if host toolchain supports AVX */ +#define HAVE_AVX 1 +#endif + +/* Define if host toolchain supports AVX2 */ +#define HAVE_AVX2 1 + +/* Define if host toolchain supports AVX512BW */ +#define HAVE_AVX512BW 1 + +/* Define if host toolchain supports AVX512CD */ +#define HAVE_AVX512CD 1 + +/* Define if host toolchain supports AVX512DQ */ +#define HAVE_AVX512DQ 1 + +/* Define if host toolchain supports AVX512ER */ +#define HAVE_AVX512ER 1 + +/* Define if host toolchain supports AVX512F */ +#define HAVE_AVX512F 1 + +/* Define if host toolchain supports AVX512IFMA */ +#define HAVE_AVX512IFMA 1 + +/* Define if host toolchain supports AVX512PF */ +#define HAVE_AVX512PF 1 + +/* Define if host toolchain supports AVX512VBMI */ +#define HAVE_AVX512VBMI 1 + +/* Define if host toolchain supports AVX512VL */ +#define HAVE_AVX512VL 1 +#endif + +/* bdev_check_media_change() exists */ +/* #undef HAVE_BDEV_CHECK_MEDIA_CHANGE */ + +/* bdev_whole() is available */ +/* #undef HAVE_BDEV_WHOLE */ + +/* bio->bi_bdev->bd_disk exists */ +/* #undef HAVE_BIO_BDEV_DISK */ + +/* bio->bi_opf is defined */ +/* #undef HAVE_BIO_BI_OPF */ + +/* bio->bi_status exists */ +/* #undef HAVE_BIO_BI_STATUS */ + +/* bio has bi_iter */ +/* #undef HAVE_BIO_BVEC_ITER */ + +/* bio_*_io_acct() available */ +/* #undef HAVE_BIO_IO_ACCT */ + +/* bio_max_segs() is implemented */ +/* #undef HAVE_BIO_MAX_SEGS */ + +/* bio_set_dev() is available */ +/* #undef HAVE_BIO_SET_DEV */ + +/* bio_set_dev() GPL-only */ +/* #undef HAVE_BIO_SET_DEV_GPL_ONLY */ + +/* bio_set_op_attrs is available */ +/* #undef HAVE_BIO_SET_OP_ATTRS */ + +/* blkdev_reread_part() exists */ +/* #undef HAVE_BLKDEV_REREAD_PART */ + +/* blkg_tryget() is available */ +/* #undef HAVE_BLKG_TRYGET */ + +/* blkg_tryget() GPL-only */ +/* #undef HAVE_BLKG_TRYGET_GPL_ONLY */ + +/* blk_alloc_queue() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN */ + +/* blk_alloc_queue_rh() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN_RH */ + +/* blk queue backing_dev_info is dynamic */ +/* #undef HAVE_BLK_QUEUE_BDI_DYNAMIC */ + +/* blk_queue_flag_clear() exists */ +/* #undef HAVE_BLK_QUEUE_FLAG_CLEAR */ + +/* blk_queue_flag_set() exists */ +/* #undef HAVE_BLK_QUEUE_FLAG_SET */ + +/* blk_queue_flush() is available */ +/* #undef HAVE_BLK_QUEUE_FLUSH */ + +/* blk_queue_flush() is GPL-only */ +/* #undef HAVE_BLK_QUEUE_FLUSH_GPL_ONLY */ + +/* blk_queue_secdiscard() is available */ +/* #undef HAVE_BLK_QUEUE_SECDISCARD */ + +/* blk_queue_secure_erase() is available */ +/* #undef HAVE_BLK_QUEUE_SECURE_ERASE */ + +/* blk_queue_write_cache() exists */ +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE */ + +/* blk_queue_write_cache() is GPL-only */ +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY */ + +/* Define if revalidate_disk() in block_device_operations */ +/* #undef HAVE_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK */ + +/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYCURRENT */ + +/* Define to 1 if you have the Mac OS X function + CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES */ + +/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ + +/* check_disk_change() exists */ +/* #undef HAVE_CHECK_DISK_CHANGE */ + +/* clear_inode() is available */ +/* #undef HAVE_CLEAR_INODE */ + +/* dentry uses const struct dentry_operations */ +/* #undef HAVE_CONST_DENTRY_OPERATIONS */ + +/* copy_from_iter() is available */ +/* #undef HAVE_COPY_FROM_ITER */ + +/* copy_to_iter() is available */ +/* #undef HAVE_COPY_TO_ITER */ + +/* yes */ +/* #undef HAVE_CPU_HOTPLUG */ + +/* current_time() exists */ +/* #undef HAVE_CURRENT_TIME */ + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +/* #undef HAVE_DCGETTEXT */ + +/* DECLARE_EVENT_CLASS() is available */ +/* #undef HAVE_DECLARE_EVENT_CLASS */ + +/* lookup_bdev() wants dev_t arg */ +/* #undef HAVE_DEVT_LOOKUP_BDEV */ + +/* sops->dirty_inode() wants flags */ +/* #undef HAVE_DIRTY_INODE_WITH_FLAGS */ + +/* disk_*_io_acct() available */ +/* #undef HAVE_DISK_IO_ACCT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* d_make_root() is available */ +/* #undef HAVE_D_MAKE_ROOT */ + +/* d_prune_aliases() is available */ +/* #undef HAVE_D_PRUNE_ALIASES */ + +/* dops->d_revalidate() operation takes nameidata */ +/* #undef HAVE_D_REVALIDATE_NAMEIDATA */ + +/* eops->encode_fh() wants child and parent inodes */ +/* #undef HAVE_ENCODE_FH_WITH_INODE */ + +/* sops->evict_inode() exists */ +/* #undef HAVE_EVICT_INODE */ + +/* fops->aio_fsync() exists */ +/* #undef HAVE_FILE_AIO_FSYNC */ + +/* file_dentry() is available */ +/* #undef HAVE_FILE_DENTRY */ + +/* file_inode() is available */ +/* #undef HAVE_FILE_INODE */ + +/* iops->follow_link() cookie */ +/* #undef HAVE_FOLLOW_LINK_COOKIE */ + +/* iops->follow_link() nameidata */ +/* #undef HAVE_FOLLOW_LINK_NAMEIDATA */ + +/* fops->fsync() with range */ +/* #undef HAVE_FSYNC_RANGE */ + +/* fops->fsync() without dentry */ +/* #undef HAVE_FSYNC_WITHOUT_DENTRY */ + +/* generic_fillattr requires struct user_namespace* */ +/* #undef HAVE_GENERIC_FILLATTR_USERNS */ + +/* generic_*_io_acct() 3 arg available */ +/* #undef HAVE_GENERIC_IO_ACCT_3ARG */ + +/* generic_*_io_acct() 4 arg available */ +/* #undef HAVE_GENERIC_IO_ACCT_4ARG */ + +/* generic_readlink is global */ +/* #undef HAVE_GENERIC_READLINK */ + +/* generic_setxattr() exists */ +/* #undef HAVE_GENERIC_SETXATTR */ + +/* generic_write_checks() takes kiocb */ +/* #undef HAVE_GENERIC_WRITE_CHECKS_KIOCB */ + +/* Define if the GNU gettext() function is already present or preinstalled. */ +/* #undef HAVE_GETTEXT */ + +/* iops->get_link() cookie */ +/* #undef HAVE_GET_LINK_COOKIE */ + +/* iops->get_link() delayed */ +/* #undef HAVE_GET_LINK_DELAYED */ + +/* group_info->gid exists */ +/* #undef HAVE_GROUP_INFO_GID */ + +/* has_capability() is available */ +/* #undef HAVE_HAS_CAPABILITY */ + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 1 + +/* yes */ +/* #undef HAVE_INODE_LOCK_SHARED */ + +/* inode_owner_or_capable() exists */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE */ + +/* inode_owner_or_capable() takes user_ns */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED */ + +/* inode_set_flags() exists */ +/* #undef HAVE_INODE_SET_FLAGS */ + +/* inode_set_iversion() exists */ +/* #undef HAVE_INODE_SET_IVERSION */ + +/* inode->i_*time's are timespec64 */ +/* #undef HAVE_INODE_TIMESPEC64_TIMES */ + +/* timestamp_truncate() exists */ +/* #undef HAVE_INODE_TIMESTAMP_TRUNCATE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* in_compat_syscall() is available */ +/* #undef HAVE_IN_COMPAT_SYSCALL */ + +/* iops->create() takes struct user_namespace* */ +/* #undef HAVE_IOPS_CREATE_USERNS */ + +/* iops->mkdir() takes struct user_namespace* */ +/* #undef HAVE_IOPS_MKDIR_USERNS */ + +/* iops->mknod() takes struct user_namespace* */ +/* #undef HAVE_IOPS_MKNOD_USERNS */ + +/* iops->rename() takes struct user_namespace* */ +/* #undef HAVE_IOPS_RENAME_USERNS */ + +/* iops->symlink() takes struct user_namespace* */ +/* #undef HAVE_IOPS_SYMLINK_USERNS */ + +/* iov_iter_advance() is available */ +/* #undef HAVE_IOV_ITER_ADVANCE */ + +/* iov_iter_count() is available */ +/* #undef HAVE_IOV_ITER_COUNT */ + +/* iov_iter_fault_in_readable() is available */ +/* #undef HAVE_IOV_ITER_FAULT_IN_READABLE */ + +/* iov_iter_revert() is available */ +/* #undef HAVE_IOV_ITER_REVERT */ + +/* iov_iter types are available */ +/* #undef HAVE_IOV_ITER_TYPES */ + +/* yes */ +/* #undef HAVE_IO_SCHEDULE_TIMEOUT */ + +/* Define to 1 if you have the `issetugid' function. */ +#define HAVE_ISSETUGID 1 + +/* kernel has kernel_fpu_* functions */ +/* #undef HAVE_KERNEL_FPU */ + +/* kernel has asm/fpu/api.h */ +/* #undef HAVE_KERNEL_FPU_API_HEADER */ + +/* kernel fpu internal */ +/* #undef HAVE_KERNEL_FPU_INTERNAL */ + +/* uncached_acl_sentinel() exists */ +/* #undef HAVE_KERNEL_GET_ACL_HANDLE_CACHE */ + +/* kernel does stack verification */ +/* #undef HAVE_KERNEL_OBJTOOL */ + +/* kernel has linux/objtool.h */ +/* #undef HAVE_KERNEL_OBJTOOL_HEADER */ + +/* kernel_read() take loff_t pointer */ +/* #undef HAVE_KERNEL_READ_PPOS */ + +/* timer_list.function gets a timer_list */ +/* #undef HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST */ + +/* struct timer_list has a flags member */ +/* #undef HAVE_KERNEL_TIMER_LIST_FLAGS */ + +/* timer_setup() is available */ +/* #undef HAVE_KERNEL_TIMER_SETUP */ + +/* kernel_write() take loff_t pointer */ +/* #undef HAVE_KERNEL_WRITE_PPOS */ + +/* kmem_cache_create_usercopy() exists */ +/* #undef HAVE_KMEM_CACHE_CREATE_USERCOPY */ + +/* kstrtoul() exists */ +/* #undef HAVE_KSTRTOUL */ + +/* ktime_get_coarse_real_ts64() exists */ +/* #undef HAVE_KTIME_GET_COARSE_REAL_TS64 */ + +/* ktime_get_raw_ts64() exists */ +/* #undef HAVE_KTIME_GET_RAW_TS64 */ + +/* kvmalloc exists */ +/* #undef HAVE_KVMALLOC */ + +/* kernel has large stacks */ +/* #undef HAVE_LARGE_STACKS */ + +/* Define if you have [aio] */ +/* #undef HAVE_LIBAIO */ + +/* Define if you have [blkid] */ +/* #undef HAVE_LIBBLKID */ + +/* Define if you have [crypto] */ +#define HAVE_LIBCRYPTO 1 + +/* Define if you have [tirpc] */ +/* #undef HAVE_LIBTIRPC */ + +/* Define if you have [udev] */ +/* #undef HAVE_LIBUDEV */ + +/* Define if you have [uuid] */ +/* #undef HAVE_LIBUUID */ + +/* lseek_execute() is available */ +/* #undef HAVE_LSEEK_EXECUTE */ + +/* makedev() is declared in sys/mkdev.h */ +/* #undef HAVE_MAKEDEV_IN_MKDEV */ + +/* makedev() is declared in sys/sysmacros.h */ +/* #undef HAVE_MAKEDEV_IN_SYSMACROS */ + +/* Noting that make_request_fn() returns blk_qc_t */ +/* #undef HAVE_MAKE_REQUEST_FN_RET_QC */ + +/* Noting that make_request_fn() returns void */ +/* #undef HAVE_MAKE_REQUEST_FN_RET_VOID */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* iops->mkdir() takes umode_t */ +/* #undef HAVE_MKDIR_UMODE_T */ + +/* Define to 1 if you have the `mlockall' function. */ +#define HAVE_MLOCKALL 1 + +/* lookup_bdev() wants mode arg */ +/* #undef HAVE_MODE_LOOKUP_BDEV */ + +/* Define if host toolchain supports MOVBE */ +#define HAVE_MOVBE 1 + +/* new_sync_read()/new_sync_write() are available */ +/* #undef HAVE_NEW_SYNC_READ */ + +/* iops->getattr() takes a path */ +/* #undef HAVE_PATH_IOPS_GETATTR */ + +/* Define if host toolchain supports PCLMULQDQ */ +#define HAVE_PCLMULQDQ 1 + +/* percpu_counter_add_batch() is defined */ +/* #undef HAVE_PERCPU_COUNTER_ADD_BATCH */ + +/* percpu_counter_init() wants gfp_t */ +/* #undef HAVE_PERCPU_COUNTER_INIT_WITH_GFP */ + +/* posix_acl_chmod() exists */ +/* #undef HAVE_POSIX_ACL_CHMOD */ + +/* posix_acl_from_xattr() needs user_ns */ +/* #undef HAVE_POSIX_ACL_FROM_XATTR_USERNS */ + +/* posix_acl_release() is available */ +/* #undef HAVE_POSIX_ACL_RELEASE */ + +/* posix_acl_release() is GPL-only */ +/* #undef HAVE_POSIX_ACL_RELEASE_GPL_ONLY */ + +/* posix_acl_valid() wants user namespace */ +/* #undef HAVE_POSIX_ACL_VALID_WITH_NS */ + +/* proc_ops structure exists */ +/* #undef HAVE_PROC_OPS_STRUCT */ + +/* iops->put_link() cookie */ +/* #undef HAVE_PUT_LINK_COOKIE */ + +/* iops->put_link() delayed */ +/* #undef HAVE_PUT_LINK_DELAYED */ + +/* iops->put_link() nameidata */ +/* #undef HAVE_PUT_LINK_NAMEIDATA */ + +/* If available, contains the Python version number currently in use. */ +#define HAVE_PYTHON "3.7" + +/* qat is enabled and existed */ +/* #undef HAVE_QAT */ + +/* iops->rename() wants flags */ +/* #undef HAVE_RENAME_WANTS_FLAGS */ + +/* REQ_DISCARD is defined */ +/* #undef HAVE_REQ_DISCARD */ + +/* REQ_FLUSH is defined */ +/* #undef HAVE_REQ_FLUSH */ + +/* REQ_OP_DISCARD is defined */ +/* #undef HAVE_REQ_OP_DISCARD */ + +/* REQ_OP_FLUSH is defined */ +/* #undef HAVE_REQ_OP_FLUSH */ + +/* REQ_OP_SECURE_ERASE is defined */ +/* #undef HAVE_REQ_OP_SECURE_ERASE */ + +/* REQ_PREFLUSH is defined */ +/* #undef HAVE_REQ_PREFLUSH */ + +/* revalidate_disk() is available */ +/* #undef HAVE_REVALIDATE_DISK */ + +/* revalidate_disk_size() is available */ +/* #undef HAVE_REVALIDATE_DISK_SIZE */ + +/* struct rw_semaphore has member activity */ +/* #undef HAVE_RWSEM_ACTIVITY */ + +/* struct rw_semaphore has atomic_long_t member count */ +/* #undef HAVE_RWSEM_ATOMIC_LONG_COUNT */ + +/* linux/sched/signal.h exists */ +/* #undef HAVE_SCHED_SIGNAL_HEADER */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SECURITY_PAM_MODULES_H 1 + +/* setattr_prepare() is available, doesn't accept user_namespace */ +/* #undef HAVE_SETATTR_PREPARE_NO_USERNS */ + +/* setattr_prepare() accepts user_namespace */ +/* #undef HAVE_SETATTR_PREPARE_USERNS */ + +/* iops->set_acl() exists, takes 3 args */ +/* #undef HAVE_SET_ACL */ + +/* iops->set_acl() takes 4 args */ +/* #undef HAVE_SET_ACL_USERNS */ + +/* set_cached_acl() is usable */ +/* #undef HAVE_SET_CACHED_ACL_USABLE */ + +/* set_special_state() exists */ +/* #undef HAVE_SET_SPECIAL_STATE */ + +/* struct shrink_control exists */ +/* #undef HAVE_SHRINK_CONTROL_STRUCT */ + +/* kernel_siginfo_t exists */ +/* #undef HAVE_SIGINFO */ + +/* signal_stop() exists */ +/* #undef HAVE_SIGNAL_STOP */ + +/* new shrinker callback wants 2 args */ +/* #undef HAVE_SINGLE_SHRINKER_CALLBACK */ + +/* ->count_objects exists */ +/* #undef HAVE_SPLIT_SHRINKER_CALLBACK */ + +#if defined(__amd64__) || defined(__i386__) +/* Define if host toolchain supports SSE */ +#define HAVE_SSE 1 + +/* Define if host toolchain supports SSE2 */ +#define HAVE_SSE2 1 + +/* Define if host toolchain supports SSE3 */ +#define HAVE_SSE3 1 + +/* Define if host toolchain supports SSE4.1 */ +#define HAVE_SSE4_1 1 + +/* Define if host toolchain supports SSE4.2 */ +#define HAVE_SSE4_2 1 + +/* Define if host toolchain supports SSSE3 */ +#define HAVE_SSSE3 1 +#endif + +/* STACK_FRAME_NON_STANDARD is defined */ +/* #undef HAVE_STACK_FRAME_NON_STANDARD */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcat' function. */ +#define HAVE_STRLCAT 1 + +/* Define to 1 if you have the `strlcpy' function. */ +#define HAVE_STRLCPY 1 + +/* submit_bio is member of struct block_device_operations */ +/* #undef HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS */ + +/* super_setup_bdi_name() exits */ +/* #undef HAVE_SUPER_SETUP_BDI_NAME */ + +/* super_block->s_user_ns exists */ +/* #undef HAVE_SUPER_USER_NS */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* i_op->tmpfile() exists */ +/* #undef HAVE_TMPFILE */ + +/* i_op->tmpfile() has userns */ +/* #undef HAVE_TMPFILE_USERNS */ + +/* totalhigh_pages() exists */ +/* #undef HAVE_TOTALHIGH_PAGES */ + +/* kernel has totalram_pages() */ +/* #undef HAVE_TOTALRAM_PAGES_FUNC */ + +/* Define to 1 if you have the `udev_device_get_is_initialized' function. */ +/* #undef HAVE_UDEV_DEVICE_GET_IS_INITIALIZED */ + +/* kernel has __kernel_fpu_* functions */ +/* #undef HAVE_UNDERSCORE_KERNEL_FPU */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* iops->getattr() takes struct user_namespace* */ +/* #undef HAVE_USERNS_IOPS_GETATTR */ + +/* iops->getattr() takes a vfsmount */ +/* #undef HAVE_VFSMOUNT_IOPS_GETATTR */ + +/* aops->direct_IO() uses iovec */ +/* #undef HAVE_VFS_DIRECT_IO_IOVEC */ + +/* aops->direct_IO() uses iov_iter without rw */ +/* #undef HAVE_VFS_DIRECT_IO_ITER */ + +/* aops->direct_IO() uses iov_iter with offset */ +/* #undef HAVE_VFS_DIRECT_IO_ITER_OFFSET */ + +/* aops->direct_IO() uses iov_iter with rw and offset */ +/* #undef HAVE_VFS_DIRECT_IO_ITER_RW_OFFSET */ + +/* All required iov_iter interfaces are available */ +/* #undef HAVE_VFS_IOV_ITER */ + +/* fops->iterate() is available */ +/* #undef HAVE_VFS_ITERATE */ + +/* fops->iterate_shared() is available */ +/* #undef HAVE_VFS_ITERATE_SHARED */ + +/* fops->readdir() is available */ +/* #undef HAVE_VFS_READDIR */ + +/* fops->read/write_iter() are available */ +/* #undef HAVE_VFS_RW_ITERATE */ + +/* __vmalloc page flags exists */ +/* #undef HAVE_VMALLOC_PAGE_KERNEL */ + +/* yes */ +/* #undef HAVE_WAIT_ON_BIT_ACTION */ + +/* wait_queue_entry_t exists */ +/* #undef HAVE_WAIT_QUEUE_ENTRY_T */ + +/* wq_head->head and wq_entry->entry exist */ +/* #undef HAVE_WAIT_QUEUE_HEAD_ENTRY */ + +/* xattr_handler->get() wants dentry */ +/* #undef HAVE_XATTR_GET_DENTRY */ + +/* xattr_handler->get() wants both dentry and inode */ +/* #undef HAVE_XATTR_GET_DENTRY_INODE */ + +/* xattr_handler->get() wants xattr_handler */ +/* #undef HAVE_XATTR_GET_HANDLER */ + +/* xattr_handler has name */ +/* #undef HAVE_XATTR_HANDLER_NAME */ + +/* xattr_handler->list() wants dentry */ +/* #undef HAVE_XATTR_LIST_DENTRY */ + +/* xattr_handler->list() wants xattr_handler */ +/* #undef HAVE_XATTR_LIST_HANDLER */ + +/* xattr_handler->list() wants simple */ +/* #undef HAVE_XATTR_LIST_SIMPLE */ + +/* xattr_handler->set() wants dentry */ +/* #undef HAVE_XATTR_SET_DENTRY */ + +/* xattr_handler->set() wants both dentry and inode */ +/* #undef HAVE_XATTR_SET_DENTRY_INODE */ + +/* xattr_handler->set() wants xattr_handler */ +/* #undef HAVE_XATTR_SET_HANDLER */ + +/* xattr_handler->set() takes user_namespace */ +/* #undef HAVE_XATTR_SET_USERNS */ + +/* Define if you have [z] */ +#define HAVE_ZLIB 1 + +/* __posix_acl_chmod() exists */ +/* #undef HAVE___POSIX_ACL_CHMOD */ + +/* kernel exports FPU functions */ +/* #undef KERNEL_EXPORTS_X86_FPU */ + +/* TBD: fetch(3) support */ +#if 0 +/* whether the chosen libfetch is to be loaded at run-time */ +#define LIBFETCH_DYNAMIC 1 + +/* libfetch is fetch(3) */ +#define LIBFETCH_IS_FETCH 1 + +/* libfetch is libcurl */ +#define LIBFETCH_IS_LIBCURL 0 + +/* soname of chosen libfetch */ +#define LIBFETCH_SONAME "libfetch.so.6" +#endif + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* make_request_fn() return type */ +/* #undef MAKE_REQUEST_FN_RET */ + +/* hardened module_param_call */ +/* #undef MODULE_PARAM_CALL_CONST */ + +/* struct shrink_control has nid */ +/* #undef SHRINK_CONTROL_HAS_NID */ + +/* Defined for legacy compatibility. */ +#define SPL_META_ALIAS ZFS_META_ALIAS + +/* Defined for legacy compatibility. */ +#define SPL_META_RELEASE ZFS_META_RELEASE + +/* Defined for legacy compatibility. */ +#define SPL_META_VERSION ZFS_META_VERSION + +/* True if ZFS is to be compiled for a FreeBSD system */ +#define SYSTEM_FREEBSD 1 + +/* True if ZFS is to be compiled for a Linux system */ +/* #undef SYSTEM_LINUX */ + +/* zfs debugging enabled */ +/* #undef ZFS_DEBUG */ + +/* /dev/zfs minor */ +/* #undef ZFS_DEVICE_MINOR */ + +/* enum node_stat_item contains NR_FILE_PAGES */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_FILE_PAGES */ + +/* enum node_stat_item contains NR_INACTIVE_ANON */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_ANON */ + +/* enum node_stat_item contains NR_INACTIVE_FILE */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_FILE */ + +/* enum zone_stat_item contains NR_FILE_PAGES */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_FILE_PAGES */ + +/* enum zone_stat_item contains NR_INACTIVE_ANON */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_INACTIVE_ANON */ + +/* enum zone_stat_item contains NR_INACTIVE_FILE */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_INACTIVE_FILE */ + +/* global_node_page_state() exists */ +/* #undef ZFS_GLOBAL_NODE_PAGE_STATE */ + +/* global_zone_page_state() exists */ +/* #undef ZFS_GLOBAL_ZONE_PAGE_STATE */ + +/* Define to 1 if GPL-only symbols can be used */ +/* #undef ZFS_IS_GPL_COMPATIBLE */ + +/* Define the project alias string. */ - #define ZFS_META_ALIAS "zfs-2.1.99-FreeBSD_gbdd11cbb9" ++#define ZFS_META_ALIAS "zfs-2.1.99-FreeBSD_g07a4c76e9" + +/* Define the project author. */ +#define ZFS_META_AUTHOR "OpenZFS" + +/* Define the project release date. */ +/* #undef ZFS_META_DATA */ + +/* Define the maximum compatible kernel version. */ +#define ZFS_META_KVER_MAX "5.13" + +/* Define the minimum compatible kernel version. */ +#define ZFS_META_KVER_MIN "3.10" + +/* Define the project license. */ +#define ZFS_META_LICENSE "CDDL" + +/* Define the libtool library 'age' version information. */ +/* #undef ZFS_META_LT_AGE */ + +/* Define the libtool library 'current' version information. */ +/* #undef ZFS_META_LT_CURRENT */ + +/* Define the libtool library 'revision' version information. */ +/* #undef ZFS_META_LT_REVISION */ + +/* Define the project name. */ +#define ZFS_META_NAME "zfs" + +/* Define the project release. */ - #define ZFS_META_RELEASE "FreeBSD_gbdd11cbb9" ++#define ZFS_META_RELEASE "FreeBSD_g07a4c76e9" + +/* Define the project version. */ +#define ZFS_META_VERSION "2.1.99" + +/* count is located in percpu_ref.data */ +/* #undef ZFS_PERCPU_REF_COUNT_IN_DATA */ + From owner-dev-commits-src-main@freebsd.org Mon Jul 12 21:30:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A938667D47; Mon, 12 Jul 2021 21: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 4GNxl21F8Rz4Ty8; Mon, 12 Jul 2021 21:30: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 1302916068; Mon, 12 Jul 2021 21:30: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 16CLUb1u073094; Mon, 12 Jul 2021 21: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 16CLUbJt073093; Mon, 12 Jul 2021 21:30:37 GMT (envelope-from git) Date: Mon, 12 Jul 2021 21:30:37 GMT Message-Id: <202107122130.16CLUbJt073093@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: 297e9f364b5a - main - loader: Don't reserve space for symbols twice. 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: 297e9f364b5aa243572ee52b1faef9b3542c1c9e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 21:30:38 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=297e9f364b5aa243572ee52b1faef9b3542c1c9e commit 297e9f364b5aa243572ee52b1faef9b3542c1c9e Author: Warner Losh AuthorDate: 2021-07-12 21:17:05 +0000 Commit: Warner Losh CommitDate: 2021-07-12 21:30:27 +0000 loader: Don't reserve space for symbols twice. The current code bumps lastaddr twice for the symbol table location. However, the first bump is bogus and results in wasted space. Remove it. PR: 110995 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31017 --- stand/common/load_elf_obj.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/stand/common/load_elf_obj.c b/stand/common/load_elf_obj.c index 78ece02433c6..f3c84cf31368 100644 --- a/stand/common/load_elf_obj.c +++ b/stand/common/load_elf_obj.c @@ -282,8 +282,6 @@ __elfN(obj_loadimage)(struct preloaded_file *fp, elf_file_t ef, uint64_t off) case SHT_SYMTAB: nsym++; ef->symtabindex = i; - shdr[i].sh_addr = (Elf_Addr)lastaddr; - lastaddr += shdr[i].sh_size; break; } } From owner-dev-commits-src-main@freebsd.org Tue Jul 13 04:29:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EBBB1651A0C; Tue, 13 Jul 2021 04:29: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 4GP72969c0z4VQJ; Tue, 13 Jul 2021 04:29: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 BC9611BF95; Tue, 13 Jul 2021 04:29: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 16D4TLxf024003; Tue, 13 Jul 2021 04:29:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16D4TLaZ024002; Tue, 13 Jul 2021 04:29:21 GMT (envelope-from git) Date: Tue, 13 Jul 2021 04:29:21 GMT Message-Id: <202107130429.16D4TLaZ024002@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 3c900106ea7a - main - cxgbe(4): Update firmwares to 1.26.0.0. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3c900106ea7aab69690945ad885b4df1095c1504 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 04:29:22 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=3c900106ea7aab69690945ad885b4df1095c1504 commit 3c900106ea7aab69690945ad885b4df1095c1504 Author: Navdeep Parhar AuthorDate: 2021-06-24 20:21:51 +0000 Commit: Navdeep Parhar CommitDate: 2021-07-13 04:25:36 +0000 cxgbe(4): Update firmwares to 1.26.0.0. Changes since 1.25.6.0 are listed here. This list comes from the Release Notes for "Chelsio Unified Wire 3.14.0.4 for Linux" dated 2021-07-08. Fixes ----- BASE: - Wait 5ms before and after the i2c command that clears the mod_select. This fixes incorrect port module type read from i2c. Obtained from: Chelsio Communications MFC after: 1 week Sponsored by: Chelsio Communications --- sys/conf/files | 6 +++--- .../{t4fw-1.25.6.0.bin => t4fw-1.26.0.0.bin} | Bin 570368 -> 570368 bytes sys/dev/cxgbe/firmware/t4fw_interface.h | 12 ++++++------ .../{t5fw-1.25.6.0.bin => t5fw-1.26.0.0.bin} | Bin 675840 -> 675840 bytes .../{t6fw-1.25.6.0.bin => t6fw-1.26.0.0.bin} | Bin 730112 -> 729088 bytes sys/modules/cxgbe/t4_firmware/Makefile | 2 +- sys/modules/cxgbe/t5_firmware/Makefile | 2 +- sys/modules/cxgbe/t6_firmware/Makefile | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 33b57f98e199..8b16621c69a7 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1519,7 +1519,7 @@ t4fw.fwo optional cxgbe \ no-implicit-rule \ clean "t4fw.fwo" t4fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t4fw-1.25.6.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t4fw-1.26.0.0.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t4fw.fw" @@ -1553,7 +1553,7 @@ t5fw.fwo optional cxgbe \ no-implicit-rule \ clean "t5fw.fwo" t5fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t5fw-1.25.6.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t5fw-1.26.0.0.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t5fw.fw" @@ -1587,7 +1587,7 @@ t6fw.fwo optional cxgbe \ no-implicit-rule \ clean "t6fw.fwo" t6fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t6fw-1.25.6.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t6fw-1.26.0.0.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t6fw.fw" diff --git a/sys/dev/cxgbe/firmware/t4fw-1.25.6.0.bin b/sys/dev/cxgbe/firmware/t4fw-1.26.0.0.bin similarity index 77% rename from sys/dev/cxgbe/firmware/t4fw-1.25.6.0.bin rename to sys/dev/cxgbe/firmware/t4fw-1.26.0.0.bin index 45e805198f59..04e96d16c57a 100644 Binary files a/sys/dev/cxgbe/firmware/t4fw-1.25.6.0.bin and b/sys/dev/cxgbe/firmware/t4fw-1.26.0.0.bin differ diff --git a/sys/dev/cxgbe/firmware/t4fw_interface.h b/sys/dev/cxgbe/firmware/t4fw_interface.h index 0f877cb5a045..acb7a6481d9c 100644 --- a/sys/dev/cxgbe/firmware/t4fw_interface.h +++ b/sys/dev/cxgbe/firmware/t4fw_interface.h @@ -9991,18 +9991,18 @@ enum fw_hdr_chip { enum { T4FW_VERSION_MAJOR = 1, - T4FW_VERSION_MINOR = 25, - T4FW_VERSION_MICRO = 6, + T4FW_VERSION_MINOR = 26, + T4FW_VERSION_MICRO = 0, T4FW_VERSION_BUILD = 0, T5FW_VERSION_MAJOR = 1, - T5FW_VERSION_MINOR = 25, - T5FW_VERSION_MICRO = 6, + T5FW_VERSION_MINOR = 26, + T5FW_VERSION_MICRO = 0, T5FW_VERSION_BUILD = 0, T6FW_VERSION_MAJOR = 1, - T6FW_VERSION_MINOR = 25, - T6FW_VERSION_MICRO = 6, + T6FW_VERSION_MINOR = 26, + T6FW_VERSION_MICRO = 0, T6FW_VERSION_BUILD = 0, }; diff --git a/sys/dev/cxgbe/firmware/t5fw-1.25.6.0.bin b/sys/dev/cxgbe/firmware/t5fw-1.26.0.0.bin similarity index 72% rename from sys/dev/cxgbe/firmware/t5fw-1.25.6.0.bin rename to sys/dev/cxgbe/firmware/t5fw-1.26.0.0.bin index 6c2d1374c87a..f72bd502ea1f 100644 Binary files a/sys/dev/cxgbe/firmware/t5fw-1.25.6.0.bin and b/sys/dev/cxgbe/firmware/t5fw-1.26.0.0.bin differ diff --git a/sys/dev/cxgbe/firmware/t6fw-1.25.6.0.bin b/sys/dev/cxgbe/firmware/t6fw-1.26.0.0.bin similarity index 61% rename from sys/dev/cxgbe/firmware/t6fw-1.25.6.0.bin rename to sys/dev/cxgbe/firmware/t6fw-1.26.0.0.bin index 1cf05565ffff..ee4341d5074f 100644 Binary files a/sys/dev/cxgbe/firmware/t6fw-1.25.6.0.bin and b/sys/dev/cxgbe/firmware/t6fw-1.26.0.0.bin differ diff --git a/sys/modules/cxgbe/t4_firmware/Makefile b/sys/modules/cxgbe/t4_firmware/Makefile index 48ac2766a560..a202c5d2a6a0 100644 --- a/sys/modules/cxgbe/t4_firmware/Makefile +++ b/sys/modules/cxgbe/t4_firmware/Makefile @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T4FW_VER= 1.25.6.0 +T4FW_VER= 1.26.0.0 FIRMWS+= t4fw-${T4FW_VER}.bin:t4fw:${T4FW_VER} .include diff --git a/sys/modules/cxgbe/t5_firmware/Makefile b/sys/modules/cxgbe/t5_firmware/Makefile index 3b54df8b222b..371df89f233b 100644 --- a/sys/modules/cxgbe/t5_firmware/Makefile +++ b/sys/modules/cxgbe/t5_firmware/Makefile @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T5FW_VER= 1.25.6.0 +T5FW_VER= 1.26.0.0 FIRMWS+= t5fw-${T5FW_VER}.bin:t5fw:${T5FW_VER} .include diff --git a/sys/modules/cxgbe/t6_firmware/Makefile b/sys/modules/cxgbe/t6_firmware/Makefile index e7b39839b5e4..074c3991bc37 100644 --- a/sys/modules/cxgbe/t6_firmware/Makefile +++ b/sys/modules/cxgbe/t6_firmware/Makefile @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T6FW_VER= 1.25.6.0 +T6FW_VER= 1.26.0.0 FIRMWS+= t6fw-${T6FW_VER}.bin:t6fw:${T6FW_VER} .include From owner-dev-commits-src-main@freebsd.org Tue Jul 13 09:59:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E296656C5A; Tue, 13 Jul 2021 09:59:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPGMB20Tkz3rF7; Tue, 13 Jul 2021 09:59:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A97E2054A; Tue, 13 Jul 2021 09:59: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 16D9xYf7070389; Tue, 13 Jul 2021 09:59:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16D9xYY7070388; Tue, 13 Jul 2021 09:59:34 GMT (envelope-from git) Date: Tue, 13 Jul 2021 09:59:34 GMT Message-Id: <202107130959.16D9xYY7070388@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 84a3963d5d94 - main - linux(4): remove unfinished vsyscall bits on arm64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 84a3963d5d94be05c913d04ea0cef4ac69a8bfc7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 09:59:34 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=84a3963d5d94be05c913d04ea0cef4ac69a8bfc7 commit 84a3963d5d94be05c913d04ea0cef4ac69a8bfc7 Author: Edward Tomasz Napierala AuthorDate: 2021-07-13 09:52:13 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-07-13 09:52:18 +0000 linux(4): remove unfinished vsyscall bits on arm64 The vsyscall mechanism is obsolete. Reviewed By: dchagin, emaste Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D31091 --- sys/arm64/linux/linux_sysvec.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index e1d3708b70e9..40f68a537985 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -86,7 +86,6 @@ static void linux_set_syscall_retval(struct thread *td, int error); static int linux_fetch_syscall_args(struct thread *td); static void linux_exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack); -static int linux_vsyscall(struct thread *td); /* DTrace init */ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); @@ -98,7 +97,6 @@ LIN_SDT_PROBE_DEFINE0(sysvec, linux_copyout_auxargs, todo); LIN_SDT_PROBE_DEFINE0(sysvec, linux_elf_fixup, todo); LIN_SDT_PROBE_DEFINE0(sysvec, linux_rt_sigreturn, todo); LIN_SDT_PROBE_DEFINE0(sysvec, linux_rt_sendsig, todo); -LIN_SDT_PROBE_DEFINE0(sysvec, linux_vsyscall, todo); LIN_SDT_PROBE_DEFINE0(sysvec, linux_vdso_install, todo); LIN_SDT_PROBE_DEFINE0(sysvec, linux_vdso_deinstall, todo); @@ -397,15 +395,6 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) LIN_SDT_PROBE0(sysvec, linux_rt_sendsig, todo); } -static int -linux_vsyscall(struct thread *td) -{ - - /* LINUXTODO: implement */ - LIN_SDT_PROBE0(sysvec, linux_vsyscall, todo); - return (EDOOFUS); -} - struct sysentvec elf_linux_sysvec = { .sv_size = LINUX_SYS_MAXSYSCALL, .sv_table = linux_sysent, @@ -440,7 +429,7 @@ struct sysentvec elf_linux_sysvec = { .sv_shared_page_len = PAGE_SIZE, .sv_schedtail = linux_schedtail, .sv_thread_detach = linux_thread_detach, - .sv_trap = linux_vsyscall, + .sv_trap = NULL, .sv_hwcap = &elf_hwcap, .sv_hwcap2 = &elf_hwcap2, .sv_onexec = linux_on_exec, From owner-dev-commits-src-main@freebsd.org Tue Jul 13 10:13:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F95565701D; Tue, 13 Jul 2021 10:13: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 4GPGg919ncz3t4k; Tue, 13 Jul 2021 10:13: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 1043420A8F; Tue, 13 Jul 2021 10:13: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 16DADOr5097641; Tue, 13 Jul 2021 10:13:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DADOix097639; Tue, 13 Jul 2021 10:13:24 GMT (envelope-from git) Date: Tue, 13 Jul 2021 10:13:24 GMT Message-Id: <202107131013.16DADOix097639@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 3eaf271d3c0e - main - linux(4): Improve comment about SA_RESTORER MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3eaf271d3c0e4fa18b74971a71c950fd43fa4189 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 10:13:25 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=3eaf271d3c0e4fa18b74971a71c950fd43fa4189 commit 3eaf271d3c0e4fa18b74971a71c950fd43fa4189 Author: Edward Tomasz Napierala AuthorDate: 2021-07-13 09:38:08 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-07-13 10:13:17 +0000 linux(4): Improve comment about SA_RESTORER No functional changes. Sponsored By: EPSRC --- sys/compat/linux/linux_signal.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c index d0f1bb1c3b32..43213301239c 100644 --- a/sys/compat/linux/linux_signal.c +++ b/sys/compat/linux/linux_signal.c @@ -96,7 +96,12 @@ linux_to_bsd_sigaction(l_sigaction_t *lsa, struct sigaction *bsa) } if (lsa->lsa_flags & LINUX_SA_RESTORER) { flags &= ~LINUX_SA_RESTORER; - /* XXX: We might want to handle it; see Linux sigreturn(2). */ + /* + * We ignore the lsa_restorer and always use our own signal + * trampoline instead. It looks like SA_RESTORER is obsolete + * in Linux too - it doesn't seem to be used at all on arm64. + * In any case: see Linux sigreturn(2). + */ } if (lsa->lsa_flags & LINUX_SA_ONSTACK) { flags &= ~LINUX_SA_ONSTACK; From owner-dev-commits-src-main@freebsd.org Tue Jul 13 11:30:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B6433659E49; Tue, 13 Jul 2021 11:30: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 4GPJN44m1Hz4Z8b; Tue, 13 Jul 2021 11:30: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 8C21721A82; Tue, 13 Jul 2021 11:30: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 16DBUSAg099336; Tue, 13 Jul 2021 11:30:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DBUSEd099335; Tue, 13 Jul 2021 11:30:28 GMT (envelope-from git) Date: Tue, 13 Jul 2021 11:30:28 GMT Message-Id: <202107131130.16DBUSEd099335@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: 3f240bdf3652 - main - tcpdump: decode packets on pfsync interfaces 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: 3f240bdf3652ea823af34b0f399e2c8be5a6320a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 11:30:28 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3f240bdf3652ea823af34b0f399e2c8be5a6320a commit 3f240bdf3652ea823af34b0f399e2c8be5a6320a Author: Luiz Otavio O Souza AuthorDate: 2021-07-12 17:15:15 +0000 Commit: Kristof Provost CommitDate: 2021-07-13 11:29:52 +0000 tcpdump: decode packets on pfsync interfaces Reviewed by: kp, scottl Obtained from: pfsense MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31153 --- contrib/tcpdump/netdissect.h | 1 + contrib/tcpdump/print-pfsync.c | 15 +++++++-------- contrib/tcpdump/print.c | 3 +++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/contrib/tcpdump/netdissect.h b/contrib/tcpdump/netdissect.h index 20b5ef63668c..8612e11c3c7e 100644 --- a/contrib/tcpdump/netdissect.h +++ b/contrib/tcpdump/netdissect.h @@ -571,6 +571,7 @@ extern int ospf_print_grace_lsa(netdissect_options *, const uint8_t *, u_int); extern int ospf_print_te_lsa(netdissect_options *, const uint8_t *, u_int); extern void otv_print(netdissect_options *, const u_char *, u_int); extern void pfsync_ip_print(netdissect_options *, const u_char *, u_int); +extern u_int pfsync_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); extern void pgm_print(netdissect_options *, const u_char *, u_int, const u_char *); extern void pim_print(netdissect_options *, const u_char *, u_int, const u_char *); extern void pimv1_print(netdissect_options *, const u_char *, u_int); diff --git a/contrib/tcpdump/print-pfsync.c b/contrib/tcpdump/print-pfsync.c index 62913337e527..dc1cd039f5b0 100644 --- a/contrib/tcpdump/print-pfsync.c +++ b/contrib/tcpdump/print-pfsync.c @@ -57,30 +57,29 @@ static void print_src_dst(netdissect_options *, const struct pfsync_state_peer *, uint8_t); static void print_state(netdissect_options *, struct pfsync_state *); -#ifdef notyet -void -pfsync_if_print(u_char *user, const struct pcap_pkthdr *h, +u_int +pfsync_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p) { u_int caplen = h->caplen; - ts_print(&h->ts); + ts_print(ndo, &h->ts); if (caplen < PFSYNC_HDRLEN) { ND_PRINT((ndo, "[|pfsync]")); goto out; } - pfsync_print((struct pfsync_header *)p, + pfsync_print(ndo, (struct pfsync_header *)p, p + sizeof(struct pfsync_header), caplen - sizeof(struct pfsync_header)); out: - if (xflag) { - default_print((const u_char *)p, caplen); + if (ndo->ndo_xflag) { + hex_print(ndo, "\n\t", p, caplen); } safeputchar(ndo, '\n'); + return (caplen); } -#endif /* notyet */ void pfsync_ip_print(netdissect_options *ndo , const u_char *bp, u_int len) diff --git a/contrib/tcpdump/print.c b/contrib/tcpdump/print.c index c76f34411778..e5436f4d738f 100644 --- a/contrib/tcpdump/print.c +++ b/contrib/tcpdump/print.c @@ -121,6 +121,9 @@ static const struct printer printers[] = { #endif #if defined(DLT_PFLOG) && defined(HAVE_NET_IF_PFLOG_H) { pflog_if_print, DLT_PFLOG }, +#endif +#if defined(DLT_PFSYNC) && defined(HAVE_NET_PFVAR_H) + { pfsync_if_print, DLT_PFSYNC}, #endif { token_if_print, DLT_IEEE802 }, { fddi_if_print, DLT_FDDI }, From owner-dev-commits-src-main@freebsd.org Tue Jul 13 13:17:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B557165D812; Tue, 13 Jul 2021 13:17: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 4GPLlM4c2Kz4pmR; Tue, 13 Jul 2021 13:17: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 86874230D4; Tue, 13 Jul 2021 13:17: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 16DDHJ9D037637; Tue, 13 Jul 2021 13:17:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DDHJ89037636; Tue, 13 Jul 2021 13:17:19 GMT (envelope-from git) Date: Tue, 13 Jul 2021 13:17:19 GMT Message-Id: <202107131317.16DDHJ89037636@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: 331d4f3c0779 - main - igc(4): Correct the man page section 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: 331d4f3c0779d250292cb2d4b999bf35e32ab9d0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 13:17:19 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=331d4f3c0779d250292cb2d4b999bf35e32ab9d0 commit 331d4f3c0779d250292cb2d4b999bf35e32ab9d0 Author: Trond Endrestol AuthorDate: 2021-07-13 13:14:24 +0000 Commit: Gordon Bergling CommitDate: 2021-07-13 13:14:24 +0000 igc(4): Correct the man page section When not specifying the man page section the man page is set to 'LOCAL' in the header of the page. PR: 257145 Reviewed by: gbe MFC after: 1 month (when the driver is MFC'ed) --- share/man/man4/igc.4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man4/igc.4 b/share/man/man4/igc.4 index bb79fbe5a8fa..db88aa4ca725 100644 --- a/share/man/man4/igc.4 +++ b/share/man/man4/igc.4 @@ -6,7 +6,7 @@ .\" $FreeBSD$ .\" .Dd May 10, 2021 -.Dt IGC +.Dt IGC 4 .Os .Sh NAME .Nm igc From owner-dev-commits-src-main@freebsd.org Tue Jul 13 14:39:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B91EB65F0A9; Tue, 13 Jul 2021 14:39: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 4GPNZH4mYBz3Jk7; Tue, 13 Jul 2021 14:39: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 893D124402; Tue, 13 Jul 2021 14:39: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 16DEdZj5043923; Tue, 13 Jul 2021 14:39:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DEdZeZ043922; Tue, 13 Jul 2021 14:39:35 GMT (envelope-from git) Date: Tue, 13 Jul 2021 14:39:35 GMT Message-Id: <202107131439.16DEdZeZ043922@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rajesh Kumar M A Subject: git: 0fd05b0173e2 - main - Fix to call callout_init with correct inputs from axp driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rajeshasp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0fd05b0173e2e9f20bec338474e3a3d15ff01993 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 14:39:35 -0000 The branch main has been updated by rajeshasp: URL: https://cgit.FreeBSD.org/src/commit/?id=0fd05b0173e2e9f20bec338474e3a3d15ff01993 commit 0fd05b0173e2e9f20bec338474e3a3d15ff01993 Author: Rajesh Kumar M A AuthorDate: 2021-07-13 14:36:01 +0000 Commit: Rajesh Kumar M A CommitDate: 2021-07-13 14:38:31 +0000 Fix to call callout_init with correct inputs from axp driver Approved by: vmaffione, gallatin Reviewed by: hselasky, vmaffione, gallatin Differential Revision: https://reviews.freebsd.org/D31104 MFC after: 1 week --- sys/dev/axgbe/if_axgbe_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/axgbe/if_axgbe_pci.c b/sys/dev/axgbe/if_axgbe_pci.c index fe42aaac6568..c7830de4c859 100644 --- a/sys/dev/axgbe/if_axgbe_pci.c +++ b/sys/dev/axgbe/if_axgbe_pci.c @@ -770,7 +770,7 @@ xgbe_service_timer(void *data) static void xgbe_init_timers(struct xgbe_prv_data *pdata) { - callout_init(&pdata->service_timer, 1*hz); + callout_init(&pdata->service_timer, 1); } static void From owner-dev-commits-src-main@freebsd.org Tue Jul 13 16:47:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D8206619A7; Tue, 13 Jul 2021 16:47: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 4GPRPX2yJlz3vZl; Tue, 13 Jul 2021 16:47: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 4E98A256F8; Tue, 13 Jul 2021 16:47: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 16DGlCwp016968; Tue, 13 Jul 2021 16:47:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DGlC3b016967; Tue, 13 Jul 2021 16:47:12 GMT (envelope-from git) Date: Tue, 13 Jul 2021 16:47:12 GMT Message-Id: <202107131647.16DGlC3b016967@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: ca1a7e1021a9 - main - tcp: TCP_LRO getting bad checksums and sending it in to TCP incorrectly. 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: ca1a7e1021a9d38cca0eb52dd9f018aad74b1960 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 16:47:12 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=ca1a7e1021a9d38cca0eb52dd9f018aad74b1960 commit ca1a7e1021a9d38cca0eb52dd9f018aad74b1960 Author: Randall Stewart AuthorDate: 2021-07-13 16:45:15 +0000 Commit: Randall Stewart CommitDate: 2021-07-13 16:45:15 +0000 tcp: TCP_LRO getting bad checksums and sending it in to TCP incorrectly. In reviewing tcp_lro.c we have a possibility that some drives may send a mbuf into LRO without making sure that the checksum passes. Some drivers actually are aware of this and do not call lro when the csum failed, others do not do this and thus could end up sending data up that we think has a checksum passing when it does not. This change will fix that situation by properly verifying that the mbuf has the correct markings (CSUM VALID bits as well as csum in mbuf header is set to 0xffff). Reviewed by: tuexen, hselasky, gallatin Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D31155 --- sys/netinet/tcp_lro.c | 30 ++++++++++++++++++++++++++---- sys/netinet/tcp_subr.c | 1 + sys/netinet/tcp_var.h | 1 + 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c index 4e1480f2c002..23e64b29b296 100644 --- a/sys/netinet/tcp_lro.c +++ b/sys/netinet/tcp_lro.c @@ -101,6 +101,7 @@ counter_u64_t tcp_extra_mbuf; counter_u64_t tcp_would_have_but; counter_u64_t tcp_comp_total; counter_u64_t tcp_uncomp_total; +counter_u64_t tcp_bad_csums; static unsigned tcp_lro_entries = TCP_LRO_ENTRIES; SYSCTL_UINT(_net_inet_tcp_lro, OID_AUTO, entries, @@ -128,6 +129,8 @@ SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, with_m_ackcmp, CTLFLAG_RD, &tcp_comp_total, "Number of mbufs queued with M_ACKCMP flags set"); SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, without_m_ackcmp, CTLFLAG_RD, &tcp_uncomp_total, "Number of mbufs queued without M_ACKCMP"); +SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, lro_badcsum, CTLFLAG_RD, + &tcp_bad_csums, "Number of packets that the common code saw with bad csums"); void tcp_lro_reg_mbufq(void) @@ -1740,7 +1743,17 @@ tcp_lro_rx_common(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum, bool use_h if (__predict_false(V_ip6_forwarding != 0)) return (TCP_LRO_CANNOT); #endif - + if (((m->m_pkthdr.csum_flags & (CSUM_DATA_VALID | CSUM_PSEUDO_HDR)) != + ((CSUM_DATA_VALID | CSUM_PSEUDO_HDR))) || + (m->m_pkthdr.csum_data != 0xffff)) { + /* + * The checksum either did not have hardware offload + * or it was a bad checksum. We can't LRO such + * a packet. + */ + counter_u64_add(tcp_bad_csums, 1); + return (TCP_LRO_CANNOT); + } /* We expect a contiguous header [eh, ip, tcp]. */ pa = tcp_lro_parser(m, &po, &pi, true); if (__predict_false(pa == NULL)) @@ -1858,9 +1871,19 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum) { int error; + if (((m->m_pkthdr.csum_flags & (CSUM_DATA_VALID | CSUM_PSEUDO_HDR)) != + ((CSUM_DATA_VALID | CSUM_PSEUDO_HDR))) || + (m->m_pkthdr.csum_data != 0xffff)) { + /* + * The checksum either did not have hardware offload + * or it was a bad checksum. We can't LRO such + * a packet. + */ + counter_u64_add(tcp_bad_csums, 1); + return (TCP_LRO_CANNOT); + } /* get current time */ binuptime(&lc->lro_last_queue_time); - CURVNET_SET(lc->ifp->if_vnet); error = tcp_lro_rx_common(lc, m, csum, true); CURVNET_RESTORE(); @@ -1880,8 +1903,7 @@ tcp_lro_queue_mbuf(struct lro_ctrl *lc, struct mbuf *mb) } /* check if packet is not LRO capable */ - if (__predict_false(mb->m_pkthdr.csum_flags == 0 || - (lc->ifp->if_capenable & IFCAP_LRO) == 0)) { + if (__predict_false((lc->ifp->if_capenable & IFCAP_LRO) == 0)) { /* input packet to network layer */ (*lc->ifp->if_input) (lc->ifp, mb); return; diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index fbd84e763c0f..697ae7d3270b 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1520,6 +1520,7 @@ tcp_init(void) tcp_would_have_but = counter_u64_alloc(M_WAITOK); tcp_comp_total = counter_u64_alloc(M_WAITOK); tcp_uncomp_total = counter_u64_alloc(M_WAITOK); + tcp_bad_csums = counter_u64_alloc(M_WAITOK); #ifdef TCPPCAP tcp_pcap_init(); #endif diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 3f72a821e71f..8cfd2c5417c2 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1022,6 +1022,7 @@ extern counter_u64_t tcp_extra_mbuf; extern counter_u64_t tcp_would_have_but; extern counter_u64_t tcp_comp_total; extern counter_u64_t tcp_uncomp_total; +extern counter_u64_t tcp_bad_csums; #ifdef NETFLIX_EXP_DETECTION /* Various SACK attack thresholds */ From owner-dev-commits-src-main@freebsd.org Tue Jul 13 17:55:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E458C6629F2; Tue, 13 Jul 2021 17:55: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 4GPSwQ4tRrz4c2c; Tue, 13 Jul 2021 17:55: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 8E11326D38; Tue, 13 Jul 2021 17:55: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 16DHtYlm010437; Tue, 13 Jul 2021 17:55:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DHtYvg010436; Tue, 13 Jul 2021 17:55:34 GMT (envelope-from git) Date: Tue, 13 Jul 2021 17:55:34 GMT Message-Id: <202107131755.16DHtYvg010436@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: b5c74dfd6434 - main - vmm: Fix AMD-vi using wrong rid range MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b5c74dfd6434b7f4dcc59dbd61b508acc5ec3ecf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 17:55:35 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=b5c74dfd6434b7f4dcc59dbd61b508acc5ec3ecf commit b5c74dfd6434b7f4dcc59dbd61b508acc5ec3ecf Author: Ka Ho Ng AuthorDate: 2021-07-13 17:53:10 +0000 Commit: Ka Ho Ng CommitDate: 2021-07-13 17:53:10 +0000 vmm: Fix AMD-vi using wrong rid range The ACPI parsing code around rid range was wrong on assuming there is only one pair of start/end device id range. Besides, ivhd_dev_parse() never work as supposed. The start/end rid info was always zero. Restructure the code to build dynamic-sized tables for each IOMMU softc holding device entries. The device entries are enumerated to find a suitable IOMMU unit. Operations on devices not governed (e.g. the IOMMU unit itself) are no-op from now on. There are also a minor fix on wrong %b formatting string usage. Tested on my EPYC 7282. Sponsored by: The FreeBSD Foundation Reviewed by: grehan Differential Revision: https://reviews.freebsd.org/D30827 --- sys/amd64/vmm/amd/amdvi_hw.c | 52 ++++++++++++++------------------ sys/amd64/vmm/amd/amdvi_priv.h | 13 ++++---- sys/amd64/vmm/amd/ivrs_drv.c | 68 +++++++++++++++++++++++++----------------- 3 files changed, 70 insertions(+), 63 deletions(-) diff --git a/sys/amd64/vmm/amd/amdvi_hw.c b/sys/amd64/vmm/amd/amdvi_hw.c index 3581b43ea4de..e488c5fd5f6a 100644 --- a/sys/amd64/vmm/amd/amdvi_hw.c +++ b/sys/amd64/vmm/amd/amdvi_hw.c @@ -809,11 +809,11 @@ amdvi_print_dev_cap(struct amdvi_softc *softc) cfg = softc->dev_cfg; for (i = 0; i < softc->dev_cfg_cnt; i++) { - device_printf(softc->dev, "device [0x%x - 0x%x]" + device_printf(softc->dev, "device [0x%x - 0x%x] " "config:%b%s\n", cfg->start_id, cfg->end_id, cfg->data, "\020\001INIT\002ExtInt\003NMI" - "\007LINT0\008LINT1", + "\007LINT0\010LINT1", cfg->enable_ats ? "ATS enabled" : ""); cfg++; } @@ -874,10 +874,6 @@ amdvi_add_sysctl(struct amdvi_softc *softc) &softc->total_cmd, "Command submitted count"); SYSCTL_ADD_U16(ctx, child, OID_AUTO, "pci_rid", CTLFLAG_RD, &softc->pci_rid, 0, "IOMMU RID"); - SYSCTL_ADD_U16(ctx, child, OID_AUTO, "start_dev_rid", CTLFLAG_RD, - &softc->start_dev_rid, 0, "Start of device under this IOMMU"); - SYSCTL_ADD_U16(ctx, child, OID_AUTO, "end_dev_rid", CTLFLAG_RD, - &softc->end_dev_rid, 0, "End of device under this IOMMU"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "command_head", CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_MPSAFE, softc, 0, amdvi_handle_sysctl, "IU", "Command head"); @@ -1204,22 +1200,17 @@ static struct amdvi_softc * amdvi_find_iommu(uint16_t devid) { struct amdvi_softc *softc; - int i; + int i, j; for (i = 0; i < ivhd_count; i++) { softc = device_get_softc(ivhd_devs[i]); - if ((devid >= softc->start_dev_rid) && - (devid <= softc->end_dev_rid)) - return (softc); + for (j = 0; j < softc->dev_cfg_cnt; j++) + if ((devid >= softc->dev_cfg[j].start_id) && + (devid <= softc->dev_cfg[j].end_id)) + return (softc); } - /* - * XXX: BIOS bug, device not in IVRS table, assume its from first IOMMU. - */ - printf("BIOS bug device(%d.%d.%d) doesn't have IVHD entry.\n", - RID2PCI_STR(devid)); - - return (device_get_softc(ivhd_devs[0])); + return (NULL); } /* @@ -1228,14 +1219,12 @@ amdvi_find_iommu(uint16_t devid) * be set concurrently, e.g. read and write bits. */ static void -amdvi_set_dte(struct amdvi_domain *domain, uint16_t devid, bool enable) +amdvi_set_dte(struct amdvi_domain *domain, struct amdvi_softc *softc, + uint16_t devid, bool enable) { - struct amdvi_softc *softc; struct amdvi_dte* temp; KASSERT(domain, ("domain is NULL for pci_rid:0x%x\n", devid)); - - softc = amdvi_find_iommu(devid); KASSERT(softc, ("softc is NULL for pci_rid:0x%x\n", devid)); temp = &amdvi_dte[devid]; @@ -1269,11 +1258,8 @@ amdvi_set_dte(struct amdvi_domain *domain, uint16_t devid, bool enable) } static void -amdvi_inv_device(uint16_t devid) +amdvi_inv_device(struct amdvi_softc *softc, uint16_t devid) { - struct amdvi_softc *softc; - - softc = amdvi_find_iommu(devid); KASSERT(softc, ("softc is NULL")); amdvi_cmd_inv_dte(softc, devid); @@ -1288,6 +1274,7 @@ static void amdvi_add_device(void *arg, uint16_t devid) { struct amdvi_domain *domain; + struct amdvi_softc *softc; domain = (struct amdvi_domain *)arg; KASSERT(domain != NULL, ("domain is NULL")); @@ -1295,22 +1282,29 @@ amdvi_add_device(void *arg, uint16_t devid) printf("Assigning device(%d.%d.%d) to domain:%d\n", RID2PCI_STR(devid), domain->id); #endif - amdvi_set_dte(domain, devid, true); - amdvi_inv_device(devid); + softc = amdvi_find_iommu(devid); + if (softc == NULL) + return; + amdvi_set_dte(domain, softc, devid, true); + amdvi_inv_device(softc, devid); } static void amdvi_remove_device(void *arg, uint16_t devid) { struct amdvi_domain *domain; + struct amdvi_softc *softc; domain = (struct amdvi_domain *)arg; #ifdef AMDVI_DEBUG_CMD printf("Remove device(0x%x) from domain:%d\n", devid, domain->id); #endif - amdvi_set_dte(domain, devid, false); - amdvi_inv_device(devid); + softc = amdvi_find_iommu(devid); + if (softc == NULL) + return; + amdvi_set_dte(domain, softc, devid, false); + amdvi_inv_device(softc, devid); } static void diff --git a/sys/amd64/vmm/amd/amdvi_priv.h b/sys/amd64/vmm/amd/amdvi_priv.h index 0eae7ca6ca4c..6960ef24d683 100644 --- a/sys/amd64/vmm/amd/amdvi_priv.h +++ b/sys/amd64/vmm/amd/amdvi_priv.h @@ -2,7 +2,10 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2016 Anish Gupta (anish@freebsd.org) - * All rights reserved. + * Copyright (c) 2021 The FreeBSD Foundation + * + * Portions of this software were developed by Ka Ho Ng + * under sponsorship from the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -392,13 +395,11 @@ struct amdvi_softc { uint8_t pci_cap; /* PCI capability. */ uint16_t pci_seg; /* IOMMU PCI domain/segment. */ uint16_t pci_rid; /* PCI BDF of IOMMU */ - /* Device range under this IOMMU. */ - uint16_t start_dev_rid; /* First device under this IOMMU. */ - uint16_t end_dev_rid; /* Last device under this IOMMU. */ - /* BIOS provided device configuration for end points. */ - struct ivhd_dev_cfg dev_cfg[10]; + /* ACPI device configuration for end points. */ + struct ivhd_dev_cfg *dev_cfg; int dev_cfg_cnt; + int dev_cfg_cap; /* Software statistics. */ uint64_t event_intr_cnt; /* Total event INTR count. */ diff --git a/sys/amd64/vmm/amd/ivrs_drv.c b/sys/amd64/vmm/amd/ivrs_drv.c index 0fb9ba381df6..68c31788e29d 100644 --- a/sys/amd64/vmm/amd/ivrs_drv.c +++ b/sys/amd64/vmm/amd/ivrs_drv.c @@ -184,9 +184,17 @@ ivhd_dev_add_entry(struct amdvi_softc *softc, uint32_t start_id, { struct ivhd_dev_cfg *dev_cfg; - /* If device doesn't have special data, don't add it. */ - if (!cfg) - return; + KASSERT(softc->dev_cfg_cap <= softc->dev_cfg_cnt, + ("Impossible case: number of dev_cfg exceeding capacity")); + if (softc->dev_cfg_cap == softc->dev_cfg_cnt) { + if (softc->dev_cfg_cap == 0) + softc->dev_cfg_cap = 1; + else + softc->dev_cfg_cap <<= 2; + softc->dev_cfg = realloc(softc->dev_cfg, + sizeof(*softc->dev_cfg) * softc->dev_cfg_cap, M_DEVBUF, + M_WAITOK); + } dev_cfg = &softc->dev_cfg[softc->dev_cfg_cnt++]; dev_cfg->start_id = start_id; @@ -203,14 +211,11 @@ ivhd_dev_parse(ACPI_IVRS_HARDWARE1 *ivhd, struct amdvi_softc *softc) { ACPI_IVRS_DE_HEADER *de; uint8_t *p, *end; - int range_start_id = 0, range_end_id = 0; + int range_start_id = -1, range_end_id = -1, i; uint32_t *extended; uint8_t all_data = 0, range_data = 0; bool range_enable_ats = false, enable_ats; - softc->start_dev_rid = ~0; - softc->end_dev_rid = 0; - switch (ivhd->Header.Type) { case IVRS_TYPE_HARDWARE_LEGACY: p = (uint8_t *)ivhd + sizeof(ACPI_IVRS_HARDWARE1); @@ -231,11 +236,11 @@ ivhd_dev_parse(ACPI_IVRS_HARDWARE1 *ivhd, struct amdvi_softc *softc) while (p < end) { de = (ACPI_IVRS_DE_HEADER *)p; - softc->start_dev_rid = MIN(softc->start_dev_rid, de->Id); - softc->end_dev_rid = MAX(softc->end_dev_rid, de->Id); switch (de->Type) { case ACPI_IVRS_TYPE_ALL: all_data = de->DataSetting; + for (i = 0; i < softc->dev_cfg_cnt; i++) + softc->dev_cfg[i].data |= all_data; break; case ACPI_IVRS_TYPE_SELECT: @@ -255,6 +260,11 @@ ivhd_dev_parse(ACPI_IVRS_HARDWARE1 *ivhd, struct amdvi_softc *softc) case ACPI_IVRS_TYPE_START: case ACPI_IVRS_TYPE_ALIAS_START: case ACPI_IVRS_TYPE_EXT_START: + if (range_start_id != -1) { + device_printf(softc->dev, + "Unexpected start-of-range device entry\n"); + return (EINVAL); + } range_start_id = de->Id; range_data = de->DataSetting; if (de->Type == ACPI_IVRS_TYPE_EXT_START) { @@ -266,10 +276,20 @@ ivhd_dev_parse(ACPI_IVRS_HARDWARE1 *ivhd, struct amdvi_softc *softc) break; case ACPI_IVRS_TYPE_END: + if (range_start_id == -1) { + device_printf(softc->dev, + "Unexpected end-of-range device entry\n"); + return (EINVAL); + } range_end_id = de->Id; + if (range_end_id < range_start_id) { + device_printf(softc->dev, + "Device entry range going backward\n"); + return (EINVAL); + } ivhd_dev_add_entry(softc, range_start_id, range_end_id, - range_data | all_data, range_enable_ats); - range_start_id = range_end_id = 0; + range_data | all_data, range_enable_ats); + range_start_id = range_end_id = -1; range_data = 0; all_data = 0; break; @@ -287,12 +307,6 @@ ivhd_dev_parse(ACPI_IVRS_HARDWARE1 *ivhd, struct amdvi_softc *softc) "Unknown dev entry:0x%x\n", de->Type); } - if (softc->dev_cfg_cnt > - (sizeof(softc->dev_cfg) / sizeof(softc->dev_cfg[0]))) { - device_printf(softc->dev, - "WARN Too many device entries.\n"); - return (EINVAL); - } if (de->Type < 0x40) p += sizeof(ACPI_IVRS_DEVICE4); else if (de->Type < 0x80) @@ -304,10 +318,6 @@ ivhd_dev_parse(ACPI_IVRS_HARDWARE1 *ivhd, struct amdvi_softc *softc) } } - KASSERT((softc->end_dev_rid >= softc->start_dev_rid), - ("Device end[0x%x] < start[0x%x.\n", - softc->end_dev_rid, softc->start_dev_rid)); - return (0); } @@ -619,9 +629,6 @@ ivhd_print_cap(struct amdvi_softc *softc, ACPI_IVRS_HARDWARE1 * ivhd) max_ptp_level, amdvi_ptp_level); } - device_printf(softc->dev, "device range: 0x%x - 0x%x\n", - softc->start_dev_rid, softc->end_dev_rid); - return (0); } @@ -679,21 +686,25 @@ ivhd_attach(device_t dev) if (status != 0) { device_printf(dev, "endpoint device parsing error=%d\n", status); + goto fail; } status = ivhd_print_cap(softc, ivhd); - if (status != 0) { - return (status); - } + if (status != 0) + goto fail; status = amdvi_setup_hw(softc); if (status != 0) { device_printf(dev, "couldn't be initialised, error=%d\n", status); - return (status); + goto fail; } return (0); + +fail: + free(softc->dev_cfg, M_DEVBUF); + return (status); } static int @@ -704,6 +715,7 @@ ivhd_detach(device_t dev) softc = device_get_softc(dev); amdvi_teardown_hw(softc); + free(softc->dev_cfg, M_DEVBUF); /* * XXX: delete the device. From owner-dev-commits-src-main@freebsd.org Tue Jul 13 20:13:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86CDF664874; Tue, 13 Jul 2021 20:13: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 4GPWzx39Z7z3Gr3; Tue, 13 Jul 2021 20:13: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 552E19A4; Tue, 13 Jul 2021 20:13: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 16DKDnMS098719; Tue, 13 Jul 2021 20:13:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DKDn1R098718; Tue, 13 Jul 2021 20:13:49 GMT (envelope-from git) Date: Tue, 13 Jul 2021 20:13:49 GMT Message-Id: <202107132013.16DKDn1R098718@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: 431ddd94360a - main - Fix potential NULL pointer dereference of device physical path 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: 431ddd94360a9e86c91294eaa2c7b859911984b7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 20:13:49 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=431ddd94360a9e86c91294eaa2c7b859911984b7 commit 431ddd94360a9e86c91294eaa2c7b859911984b7 Author: Young Xiao <92siuyang@gmail.com> AuthorDate: 2019-05-21 07:36:29 +0000 Commit: Warner Losh CommitDate: 2021-07-13 20:13:21 +0000 Fix potential NULL pointer dereference of device physical path In ata_dev_advinfo() and nvme_dev_advinfo(), if the physical path is being stored and there is a malloc failure (malloc(9) is called with M_NOWAIT), we could wind up in a situation where the device's physpath_len is set to the length the user provided, but the physpath itself is NULL. If another context then comes in to fetch the physical path value, we would wind up trying to memcpy a NULL pointer into the caller's buffer. So, set the physpath_len to 0 when we free the physpath on entry into the store case for the physical path. Reset the length to a non-zero value only after we've successfully malloced a buffer to hold it. This code mirrors scsi_xpt.c does already as well. Signed-off-by: Young Xiao <92siuyang@gmail.com> Reviewed by: imp PR: 238014 --- sys/cam/ata/ata_xpt.c | 7 +++++-- sys/cam/nvme/nvme_xpt.c | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c index 08ce945a0938..946763342160 100644 --- a/sys/cam/ata/ata_xpt.c +++ b/sys/cam/ata/ata_xpt.c @@ -1758,9 +1758,11 @@ ata_dev_advinfo(union ccb *start_ccb) break; case CDAI_TYPE_PHYS_PATH: if (cdai->flags & CDAI_FLAG_STORE) { - if (device->physpath != NULL) + if (device->physpath != NULL) { free(device->physpath, M_CAMXPT); - device->physpath_len = cdai->bufsiz; + device->physpath = NULL; + device->physpath_len = 0; + } /* Clear existing buffer if zero length */ if (cdai->bufsiz == 0) break; @@ -1769,6 +1771,7 @@ ata_dev_advinfo(union ccb *start_ccb) start_ccb->ccb_h.status = CAM_REQ_ABORTED; return; } + device->physpath_len = cdai->bufsiz; memcpy(device->physpath, cdai->buf, cdai->bufsiz); } else { cdai->provsiz = device->physpath_len; diff --git a/sys/cam/nvme/nvme_xpt.c b/sys/cam/nvme/nvme_xpt.c index 0fc359ecb042..22d984d02038 100644 --- a/sys/cam/nvme/nvme_xpt.c +++ b/sys/cam/nvme/nvme_xpt.c @@ -683,9 +683,11 @@ nvme_dev_advinfo(union ccb *start_ccb) break; case CDAI_TYPE_PHYS_PATH: if (cdai->flags & CDAI_FLAG_STORE) { - if (device->physpath != NULL) + if (device->physpath != NULL) { free(device->physpath, M_CAMXPT); - device->physpath_len = cdai->bufsiz; + device->physpath = NULL; + device->physpath_len = 0; + } /* Clear existing buffer if zero length */ if (cdai->bufsiz == 0) break; @@ -694,6 +696,7 @@ nvme_dev_advinfo(union ccb *start_ccb) start_ccb->ccb_h.status = CAM_REQ_ABORTED; return; } + device->physpath_len = cdai->bufsiz; memcpy(device->physpath, cdai->buf, cdai->bufsiz); } else { cdai->provsiz = device->physpath_len; From owner-dev-commits-src-main@freebsd.org Tue Jul 13 20:13:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3BFF6647EE; Tue, 13 Jul 2021 20:13: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 4GPWzy4CDpz3GZT; Tue, 13 Jul 2021 20:13: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 77704973; Tue, 13 Jul 2021 20:13: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 16DKDogf098743; Tue, 13 Jul 2021 20:13:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DKDoNd098742; Tue, 13 Jul 2021 20:13:50 GMT (envelope-from git) Date: Tue, 13 Jul 2021 20:13:50 GMT Message-Id: <202107132013.16DKDoNd098742@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: a065ccb2804f - main - cam_iosched: use tunable flag and make a bool really a bool 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: a065ccb2804fae834a7c66e29b726ea3dbbceace Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 20:13:50 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a065ccb2804fae834a7c66e29b726ea3dbbceace commit a065ccb2804fae834a7c66e29b726ea3dbbceace Author: Warner Losh AuthorDate: 2021-07-13 06:00:33 +0000 Commit: Warner Losh CommitDate: 2021-07-13 20:13:21 +0000 cam_iosched: use tunable flag and make a bool really a bool kern.cam.do_dynamic_iosched is really a bool, so change its type to bool. While I'm here, also use the CTLFLAG_TUN flag instead of a separate tunable line for it and kern.cam.iosched_alpha_bits. MFC After: 1 week Sponsored by: Netflix --- sys/cam/cam_iosched.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/cam/cam_iosched.c b/sys/cam/cam_iosched.c index d30eb34747e1..b293002fb2ca 100644 --- a/sys/cam/cam_iosched.c +++ b/sys/cam/cam_iosched.c @@ -70,9 +70,8 @@ static MALLOC_DEFINE(M_CAMSCHED, "CAM I/O Scheduler", #ifdef CAM_IOSCHED_DYNAMIC -static int do_dynamic_iosched = 1; -TUNABLE_INT("kern.cam.do_dynamic_iosched", &do_dynamic_iosched); -SYSCTL_INT(_kern_cam, OID_AUTO, do_dynamic_iosched, CTLFLAG_RD, +static bool do_dynamic_iosched = 1; +SYSCTL_BOOL(_kern_cam, OID_AUTO, do_dynamic_iosched, CTLFLAG_RD | CTLFLAG_TUN, &do_dynamic_iosched, 1, "Enable Dynamic I/O scheduler optimizations."); @@ -97,8 +96,7 @@ SYSCTL_INT(_kern_cam, OID_AUTO, do_dynamic_iosched, CTLFLAG_RD, * Note: See computation of EMA and EMVAR for acceptable ranges of alpha. */ static int alpha_bits = 9; -TUNABLE_INT("kern.cam.iosched_alpha_bits", &alpha_bits); -SYSCTL_INT(_kern_cam, OID_AUTO, iosched_alpha_bits, CTLFLAG_RW, +SYSCTL_INT(_kern_cam, OID_AUTO, iosched_alpha_bits, CTLFLAG_RW | CTLFLAG_TUN, &alpha_bits, 1, "Bits in EMA's alpha."); From owner-dev-commits-src-main@freebsd.org Tue Jul 13 21:41:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A1E8F666302; Tue, 13 Jul 2021 21:41: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 4GPYxc0nW6z3m4x; Tue, 13 Jul 2021 21:41: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 039771868; Tue, 13 Jul 2021 21:41: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 16DLftOe017614; Tue, 13 Jul 2021 21:41:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DLftDl017598; Tue, 13 Jul 2021 21:41:55 GMT (envelope-from git) Date: Tue, 13 Jul 2021 21:41:55 GMT Message-Id: <202107132141.16DLftDl017598@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: 0ca9f1d4a3b7 - main - Fix pmbr issues > 2TB 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: 0ca9f1d4a3b772036309fb1c14262ec77c674c5d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 21:41:56 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0ca9f1d4a3b772036309fb1c14262ec77c674c5d commit 0ca9f1d4a3b772036309fb1c14262ec77c674c5d Author: Emrion AuthorDate: 2021-07-13 20:37:59 +0000 Commit: Warner Losh CommitDate: 2021-07-13 21:40:44 +0000 Fix pmbr issues > 2TB These issues have low impact because they require precise circumstances to trigger one of them. The disk must be > 2 TiB in size and either: - The primary GPT header is dammaged. - The freebsd-boot partiton is located farther than the first 2 TiB of the disc and one of its sectors takes place at a lba value that makes the higher 32 bits of this very value change. Errors and corrections folow: - decl and incl don't affect CF, so replace with subl/addl $1 - repe uses %cx, so move size to it with movw - moving a 64-bit value with %cx of 2 (should be 4) so addresses > 2TB will work. PR: 233180 Reviewed by: imp@ (applied patch using description in bug) Differential Revision: https://reviews.freebsd.org/D31100 --- stand/i386/pmbr/pmbr.S | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/stand/i386/pmbr/pmbr.S b/stand/i386/pmbr/pmbr.S index 1a758812edd3..c394835757af 100644 --- a/stand/i386/pmbr/pmbr.S +++ b/stand/i386/pmbr/pmbr.S @@ -114,8 +114,9 @@ main.2b: cmpb $1,%dh # Reading primary? main.3: movb $0,%dh # %dh := 0 (reading backup) movw $DPBUF+DPBUF_SEC,%si # %si = last sector + 1 movw $lba,%di # %di = $lba -main.3a: decl (%si) # 0x0(%si) = last sec (0-31) - movw $2,%cx +main.3a: subl $1, (%si) # 0x0(%si) = last sec (0-31) + sbbl $0, 4(%si) + movw $4,%cx rep movsw # $lastsec--, copy it to $lba jmp main.2a # Read the next sector @@ -128,7 +129,7 @@ load_part: movw $GPT_ADDR+GPT_PART_LBA,%si call read scan: movw %bx,%si # Compare partition UUID movw $boot_uuid,%di # with FreeBSD boot UUID - movb $0x10,%cl + movw $0x10,%cx repe cmpsb jnz next_part # Didn't match, next partition # @@ -150,7 +151,7 @@ load_boot: push %si # Save %si jnz next_boot mov %bx,%es # Reset %es to zero jmp LOAD # Jump to boot code -next_boot: incl (%si) # Next LBA +next_boot: addl $1,(%si) # Next LBA adcl $0,4(%si) mov %es,%ax # Adjust segment for next addw $SECSIZE/16,%ax # sector @@ -171,7 +172,7 @@ next_part: decl GPT_ADDR+GPT_NPART # Was this the last partition? addw %ax,%bx # Next partition cmpw $PART_ADDR+0x200,%bx # Still in sector? jb scan - incl GPT_ADDR+GPT_PART_LBA # Next sector + addl $1, GPT_ADDR+GPT_PART_LBA # Next sector adcl $0,GPT_ADDR+GPT_PART_LBA+4 jmp load_part # From owner-dev-commits-src-main@freebsd.org Tue Jul 13 22:17:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 439C1666497; Tue, 13 Jul 2021 22:17:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPZkT1Hg7z3sM7; Tue, 13 Jul 2021 22:17:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 115AC2062; Tue, 13 Jul 2021 22:17: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 16DMHKUZ060731; Tue, 13 Jul 2021 22:17:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DMHKAF060730; Tue, 13 Jul 2021 22:17:20 GMT (envelope-from git) Date: Tue, 13 Jul 2021 22:17:20 GMT Message-Id: <202107132217.16DMHKAF060730@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: b9ca419a21d1 - main - fifo: Explicitly initialize generation numbers when opening 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: b9ca419a21d109948bf0fcea5c59725f1fe0cd7b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 22:17:21 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b9ca419a21d109948bf0fcea5c59725f1fe0cd7b commit b9ca419a21d109948bf0fcea5c59725f1fe0cd7b Author: Mark Johnston AuthorDate: 2021-07-13 21:45:49 +0000 Commit: Mark Johnston CommitDate: 2021-07-13 21:45:49 +0000 fifo: Explicitly initialize generation numbers when opening The fi_rgen and fi_wgen fields are generation numbers used when sleeping waiting for the other end of the fifo to be opened. The fields were not explicitly initialized after allocation, but this was harmless. To avoid false positives from KMSAN, though, ensure that they get initialized to zero. Reported by: KMSAN MFC after: 2 weeks Sponsored by: The FreeBSD Foundation --- sys/fs/fifofs/fifo_vnops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index 33c2c8ab2951..d2a51de84fba 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -154,9 +154,9 @@ fifo_open(ap) error = pipe_named_ctor(&fpipe, td); if (error != 0) return (error); - fip = malloc(sizeof(*fip), M_VNODE, M_WAITOK); + fip = malloc(sizeof(*fip), M_VNODE, M_WAITOK | M_ZERO); fip->fi_pipe = fpipe; - fpipe->pipe_wgen = fip->fi_readers = fip->fi_writers = 0; + fpipe->pipe_wgen = 0; KASSERT(vp->v_fifoinfo == NULL, ("fifo_open: v_fifoinfo race")); vp->v_fifoinfo = fip; } From owner-dev-commits-src-main@freebsd.org Tue Jul 13 22:17:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67B9E6667EB; Tue, 13 Jul 2021 22:17:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GPZkV20H0z3sMB; Tue, 13 Jul 2021 22:17:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20E6C2145; Tue, 13 Jul 2021 22:17:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16DMHMLE060755; Tue, 13 Jul 2021 22:17:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DMHMc8060754; Tue, 13 Jul 2021 22:17:22 GMT (envelope-from git) Date: Tue, 13 Jul 2021 22:17:22 GMT Message-Id: <202107132217.16DMHMc8060754@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: 7f053a44aef7 - main - gmirror: Zero the metadata block before writing 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: 7f053a44aef75eab395ce15a1c8a1399a2f89cad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 22:17:22 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7f053a44aef75eab395ce15a1c8a1399a2f89cad commit 7f053a44aef75eab395ce15a1c8a1399a2f89cad Author: Mark Johnston AuthorDate: 2021-07-13 21:45:57 +0000 Commit: Mark Johnston CommitDate: 2021-07-13 21:45:57 +0000 gmirror: Zero the metadata block before writing The mirror metadata fields contain string buffers and pad bytes, neither were being zeroed before metadata was written to disk. Also, the metadata structure is smaller than the sector size, and in one case gmirror was failing to zero-fill the full buffer before writing. Fix these problems by pre-zeroing the metadata structure and the sector buffer. Reported by: KMSAN MFC after: 2 weeks Sponsored by: The FreeBSD Foundation --- sys/geom/mirror/g_mirror.c | 9 +-------- sys/geom/mirror/g_mirror_ctl.c | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c index 51836b7eabb8..c0641d15673e 100644 --- a/sys/geom/mirror/g_mirror.c +++ b/sys/geom/mirror/g_mirror.c @@ -749,6 +749,7 @@ g_mirror_fill_metadata(struct g_mirror_softc *sc, struct g_mirror_disk *disk, struct g_mirror_metadata *md) { + bzero(md, sizeof(*md)); strlcpy(md->md_magic, G_MIRROR_MAGIC, sizeof(md->md_magic)); md->md_version = G_MIRROR_VERSION; strlcpy(md->md_name, sc->sc_name, sizeof(md->md_name)); @@ -760,14 +761,8 @@ g_mirror_fill_metadata(struct g_mirror_softc *sc, struct g_mirror_disk *disk, md->md_mediasize = sc->sc_mediasize; md->md_sectorsize = sc->sc_sectorsize; md->md_mflags = (sc->sc_flags & G_MIRROR_DEVICE_FLAG_MASK); - bzero(md->md_provider, sizeof(md->md_provider)); if (disk == NULL) { md->md_did = arc4random(); - md->md_priority = 0; - md->md_syncid = 0; - md->md_dflags = 0; - md->md_sync_offset = 0; - md->md_provsize = 0; } else { md->md_did = disk->d_id; md->md_priority = disk->d_priority; @@ -775,8 +770,6 @@ g_mirror_fill_metadata(struct g_mirror_softc *sc, struct g_mirror_disk *disk, md->md_dflags = (disk->d_flags & G_MIRROR_DISK_FLAG_MASK); if (disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING) md->md_sync_offset = disk->d_sync.ds_offset_done; - else - md->md_sync_offset = 0; if ((disk->d_flags & G_MIRROR_DISK_FLAG_HARDCODED) != 0) { strlcpy(md->md_provider, disk->d_consumer->provider->name, diff --git a/sys/geom/mirror/g_mirror_ctl.c b/sys/geom/mirror/g_mirror_ctl.c index 254841b6c04a..355504a6f90f 100644 --- a/sys/geom/mirror/g_mirror_ctl.c +++ b/sys/geom/mirror/g_mirror_ctl.c @@ -747,7 +747,7 @@ again: bzero(md.md_provider, sizeof(md.md_provider)); } md.md_provsize = pp->mediasize; - sector = g_malloc(pp->sectorsize, M_WAITOK); + sector = g_malloc(pp->sectorsize, M_WAITOK | M_ZERO); mirror_metadata_encode(&md, sector); error = g_write_data(disks[i].consumer, pp->mediasize - pp->sectorsize, sector, pp->sectorsize); From owner-dev-commits-src-main@freebsd.org Tue Jul 13 22:17:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E7BB6663B4; Tue, 13 Jul 2021 22:17: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 4GPZkW2x0tz3sD0; Tue, 13 Jul 2021 22:17: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 44B7E24B8; Tue, 13 Jul 2021 22:17: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 16DMHNrZ060779; Tue, 13 Jul 2021 22:17:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DMHNAH060778; Tue, 13 Jul 2021 22:17:23 GMT (envelope-from git) Date: Tue, 13 Jul 2021 22:17:23 GMT Message-Id: <202107132217.16DMHNAH060778@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: 0f09ab89cc44 - main - gconcat: Zero the metadata block before writing 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: 0f09ab89cc444e468837c23cd9855689114769d4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 22:17:23 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0f09ab89cc444e468837c23cd9855689114769d4 commit 0f09ab89cc444e468837c23cd9855689114769d4 Author: Mark Johnston AuthorDate: 2021-07-13 21:45:59 +0000 Commit: Mark Johnston CommitDate: 2021-07-13 21:45:59 +0000 gconcat: Zero the metadata block before writing Ensure that string buffers and pad bytes are zero-filled before writing gconcat metadata. Also make sure to zero the full block buffer before encoding the metadata and writing. Fix some style bugs in g_concat_write_metadata() while here. Reported by: KMSAN MFC after: 2 weeks Sponsored by: The FreeBSD Foundation --- sys/geom/concat/g_concat.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/geom/concat/g_concat.c b/sys/geom/concat/g_concat.c index 1bfca1585423..c4a5e0476edf 100644 --- a/sys/geom/concat/g_concat.c +++ b/sys/geom/concat/g_concat.c @@ -865,6 +865,7 @@ g_concat_ctl_create(struct gctl_req *req, struct g_class *mp) return; } + bzero(&md, sizeof(md)); strlcpy(md.md_magic, G_CONCAT_MAGIC, sizeof(md.md_magic)); md.md_version = G_CONCAT_VERSION; name = gctl_get_asciiparam(req, "arg0"); @@ -876,7 +877,6 @@ g_concat_ctl_create(struct gctl_req *req, struct g_class *mp) md.md_id = arc4random(); md.md_no = 0; md.md_all = *nargs - 1; - bzero(md.md_provider, sizeof(md.md_provider)); /* This field is not important here. */ md.md_provsize = 0; @@ -1017,6 +1017,7 @@ g_concat_write_metadata(struct gctl_req *req, struct g_concat_softc *sc) u_char *sector; int error; + bzero(&md, sizeof(md)); strlcpy(md.md_magic, G_CONCAT_MAGIC, sizeof(md.md_magic)); md.md_version = G_CONCAT_VERSION; strlcpy(md.md_name, sc->sc_name, sizeof(md.md_name)); @@ -1026,25 +1027,24 @@ g_concat_write_metadata(struct gctl_req *req, struct g_concat_softc *sc) pp = disk->d_consumer->provider; md.md_no = no; - bzero(md.md_provider, sizeof(md.md_provider)); - if (disk->d_hardcoded) { - strlcpy(md.md_provider, pp->name, sizeof(md.md_provider)); - } + if (disk->d_hardcoded) + strlcpy(md.md_provider, pp->name, + sizeof(md.md_provider)); md.md_provsize = disk->d_consumer->provider->mediasize; - sector = g_malloc(pp->sectorsize, M_WAITOK); - + sector = g_malloc(pp->sectorsize, M_WAITOK | M_ZERO); concat_metadata_encode(&md, sector); error = g_access(disk->d_consumer, 0, 1, 0); if (error == 0) { - error = g_write_data(disk->d_consumer, pp->mediasize - pp->sectorsize, - sector, pp->sectorsize); + error = g_write_data(disk->d_consumer, + pp->mediasize - pp->sectorsize, sector, + pp->sectorsize); (void)g_access(disk->d_consumer, 0, -1, 0); } g_free(sector); - if (error != 0) { - gctl_error(req, "Cannot store metadata on %s: %d", pp->name, error); - } + if (error != 0) + gctl_error(req, "Cannot store metadata on %s: %d", + pp->name, error); no++; } From owner-dev-commits-src-main@freebsd.org Tue Jul 13 22:17:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BDFD66690E; Tue, 13 Jul 2021 22:17: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 4GPZkX5QYSz3sJt; Tue, 13 Jul 2021 22:17: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 6DF8B2063; Tue, 13 Jul 2021 22:17: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 16DMHOhr060803; Tue, 13 Jul 2021 22:17:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DMHOqv060802; Tue, 13 Jul 2021 22:17:24 GMT (envelope-from git) Date: Tue, 13 Jul 2021 22:17:24 GMT Message-Id: <202107132217.16DMHOqv060802@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: 39552dff7bb5 - main - graid3: Zero the metadata block before writing 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: 39552dff7bb5463a74e5195d65a3252c583d9414 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 22:17:25 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=39552dff7bb5463a74e5195d65a3252c583d9414 commit 39552dff7bb5463a74e5195d65a3252c583d9414 Author: Mark Johnston AuthorDate: 2021-07-13 21:46:02 +0000 Commit: Mark Johnston CommitDate: 2021-07-13 21:46:02 +0000 graid3: Zero the metadata block before writing Ensure that string buffers and pad bytes are zero-filled before writing graid3 metadata. Reported by: KMSAN MFC after: 2 weeks Sponsored by: The FreeBSD Foundation --- sys/geom/raid3/g_raid3.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c index 5fe67c00068d..159eff990892 100644 --- a/sys/geom/raid3/g_raid3.c +++ b/sys/geom/raid3/g_raid3.c @@ -743,6 +743,7 @@ g_raid3_fill_metadata(struct g_raid3_disk *disk, struct g_raid3_metadata *md) struct g_raid3_softc *sc; struct g_provider *pp; + bzero(md, sizeof(*md)); sc = disk->d_softc; strlcpy(md->md_magic, G_RAID3_MAGIC, sizeof(md->md_magic)); md->md_version = G_RAID3_VERSION; @@ -756,9 +757,7 @@ g_raid3_fill_metadata(struct g_raid3_disk *disk, struct g_raid3_metadata *md) md->md_no = disk->d_no; md->md_syncid = disk->d_sync.ds_syncid; md->md_dflags = (disk->d_flags & G_RAID3_DISK_FLAG_MASK); - if (disk->d_state != G_RAID3_DISK_STATE_SYNCHRONIZING) - md->md_sync_offset = 0; - else { + if (disk->d_state == G_RAID3_DISK_STATE_SYNCHRONIZING) { md->md_sync_offset = disk->d_sync.ds_offset_done / (sc->sc_ndisks - 1); } @@ -768,12 +767,8 @@ g_raid3_fill_metadata(struct g_raid3_disk *disk, struct g_raid3_metadata *md) pp = NULL; if ((disk->d_flags & G_RAID3_DISK_FLAG_HARDCODED) != 0 && pp != NULL) strlcpy(md->md_provider, pp->name, sizeof(md->md_provider)); - else - bzero(md->md_provider, sizeof(md->md_provider)); if (pp != NULL) md->md_provsize = pp->mediasize; - else - md->md_provsize = 0; } void From owner-dev-commits-src-main@freebsd.org Tue Jul 13 22:17:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 919F1666885; Tue, 13 Jul 2021 22:17: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 4GPZkY6p4Cz3sPn; Tue, 13 Jul 2021 22:17: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 8B90126B5; Tue, 13 Jul 2021 22:17: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 16DMHPhh060833; Tue, 13 Jul 2021 22:17:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DMHP6d060832; Tue, 13 Jul 2021 22:17:25 GMT (envelope-from git) Date: Tue, 13 Jul 2021 22:17:25 GMT Message-Id: <202107132217.16DMHP6d060832@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: 45e2357113e6 - main - malloc: Pass the allocation size to malloc_large() by value 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: 45e2357113e65537feabb7c872053b5ea5f7a0f1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 22:17:26 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=45e2357113e65537feabb7c872053b5ea5f7a0f1 commit 45e2357113e65537feabb7c872053b5ea5f7a0f1 Author: Mark Johnston AuthorDate: 2021-07-13 21:47:02 +0000 Commit: Mark Johnston CommitDate: 2021-07-13 21:47:02 +0000 malloc: Pass the allocation size to malloc_large() by value Its callers do not make use the modified size that malloc_large() was returning, so there's no need to pass a pointer. No functional change intended. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation --- sys/kern/kern_malloc.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 75cbc2a0fd04..bd0f46ea5220 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -584,23 +584,21 @@ malloc_large_size(uma_slab_t slab) } static caddr_t __noinline -malloc_large(size_t *size, struct malloc_type *mtp, struct domainset *policy, +malloc_large(size_t size, struct malloc_type *mtp, struct domainset *policy, int flags DEBUG_REDZONE_ARG_DEF) { vm_offset_t kva; caddr_t va; - size_t sz; - sz = roundup(*size, PAGE_SIZE); - kva = kmem_malloc_domainset(policy, sz, flags); + size = roundup(size, PAGE_SIZE); + kva = kmem_malloc_domainset(policy, size, flags); if (kva != 0) { /* The low bit is unused for slab pointers. */ - vsetzoneslab(kva, NULL, (void *)((sz << 1) | 1)); - uma_total_inc(sz); - *size = sz; + vsetzoneslab(kva, NULL, (void *)((size << 1) | 1)); + uma_total_inc(size); } va = (caddr_t)kva; - malloc_type_allocated(mtp, va == NULL ? 0 : sz); + malloc_type_allocated(mtp, va == NULL ? 0 : size); if (__predict_false(va == NULL)) { KASSERT((flags & M_WAITOK) == 0, ("malloc(M_WAITOK) returned NULL")); @@ -608,7 +606,7 @@ malloc_large(size_t *size, struct malloc_type *mtp, struct domainset *policy, #ifdef DEBUG_REDZONE va = redzone_setup(va, osize); #endif - kasan_mark((void *)va, osize, sz, KASAN_MALLOC_REDZONE); + kasan_mark((void *)va, osize, size, KASAN_MALLOC_REDZONE); } return (va); } @@ -648,7 +646,7 @@ void * #endif if (__predict_false(size > kmem_zmax)) - return (malloc_large(&size, mtp, DOMAINSET_RR(), flags + return (malloc_large(size, mtp, DOMAINSET_RR(), flags DEBUG_REDZONE_ARG)); if (size & KMEM_ZMASK) @@ -718,7 +716,7 @@ malloc_domainset(size_t size, struct malloc_type *mtp, struct domainset *ds, #endif if (__predict_false(size > kmem_zmax)) - return (malloc_large(&size, mtp, DOMAINSET_RR(), flags + return (malloc_large(size, mtp, DOMAINSET_RR(), flags DEBUG_REDZONE_ARG)); vm_domainset_iter_policy_init(&di, ds, &domain, &flags); @@ -770,7 +768,7 @@ malloc_domainset_exec(size_t size, struct malloc_type *mtp, struct domainset *ds return (va); #endif - return (malloc_large(&size, mtp, ds, flags DEBUG_REDZONE_ARG)); + return (malloc_large(size, mtp, ds, flags DEBUG_REDZONE_ARG)); } void * From owner-dev-commits-src-main@freebsd.org Tue Jul 13 22:17:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1EEB566691A; Tue, 13 Jul 2021 22:17: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 4GPZkZ6YlVz3sK2; Tue, 13 Jul 2021 22:17: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 AEF1524B9; Tue, 13 Jul 2021 22:17: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 16DMHQG3060858; Tue, 13 Jul 2021 22:17:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DMHQk8060857; Tue, 13 Jul 2021 22:17:26 GMT (envelope-from git) Date: Tue, 13 Jul 2021 22:17:26 GMT Message-Id: <202107132217.16DMHQk8060857@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: 2783335caeae - main - blist: Correct the node count computed in blist_create() 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: 2783335caeae964bd8a1aa15726b523876613e45 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 22:17:27 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2783335caeae964bd8a1aa15726b523876613e45 commit 2783335caeae964bd8a1aa15726b523876613e45 Author: Mark Johnston AuthorDate: 2021-07-13 21:47:27 +0000 Commit: Mark Johnston CommitDate: 2021-07-13 21:47:27 +0000 blist: Correct the node count computed in blist_create() Commit bb4a27f927a1 added the ability to allocate a span of blocks crossing a meta node boundary. To ensure that blst_next_leaf_alloc() does not walk past the end of the tree, an extra all-zero meta node needs to be present at the end of the allocation, and blst_next_leaf_alloc() is implemented such that the presence of this node terminates the search. blist_create() computes the number of nodes required. It had two problems: 1. When the size of the blist is a power of BLIST_RADIX, we would unnecessarily allocate an extra level in the tree. 2. When the size of the blist is a multiple of BLIST_RADIX, we would fail to allocate a terminator node. In this case, blst_next_leaf_alloc() could scan beyond the bounds of the allocation. This was found using KASAN. Modify blist_create() to handle these cases correctly. Reported by: pho Reviewed by: dougm MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31158 --- sys/kern/subr_blist.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_blist.c b/sys/kern/subr_blist.c index 27b226fd8a18..ba13fb4efd80 100644 --- a/sys/kern/subr_blist.c +++ b/sys/kern/subr_blist.c @@ -244,8 +244,16 @@ blist_create(daddr_t blocks, int flags) * Calculate the radix and node count used for scanning. */ nodes = 1; - for (radix = 1; radix <= blocks / BLIST_RADIX; radix *= BLIST_RADIX) - nodes += 1 + (blocks - 1) / radix / BLIST_RADIX; + for (radix = 1; (blocks - 1) / BLIST_RADIX / radix > 0; + radix *= BLIST_RADIX) + nodes += 1 + (blocks - 1) / BLIST_RADIX / radix; + + /* + * Include a sentinel node to ensure that cross-leaf scans stay within + * the bounds of the allocation. + */ + if (blocks % BLIST_RADIX == 0) + nodes++; bl = malloc(offsetof(struct blist, bl_root[nodes]), M_SWAP, flags | M_ZERO); From owner-dev-commits-src-main@freebsd.org Tue Jul 13 22:17:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 13CD366698A; Tue, 13 Jul 2021 22:17: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 4GPZkc587Jz3sGg; Tue, 13 Jul 2021 22:17: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 D700A2064; Tue, 13 Jul 2021 22:17: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 16DMHRCR060882; Tue, 13 Jul 2021 22:17:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DMHROx060881; Tue, 13 Jul 2021 22:17:27 GMT (envelope-from git) Date: Tue, 13 Jul 2021 22:17:27 GMT Message-Id: <202107132217.16DMHROx060881@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: 4a9a41650c90 - main - uart: Fix an out-of-bounds read in ns8250_bus_probe() 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: 4a9a41650c909706bc0b9a3f29817c11b262b0a0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 22:17:29 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4a9a41650c909706bc0b9a3f29817c11b262b0a0 commit 4a9a41650c909706bc0b9a3f29817c11b262b0a0 Author: Mark Johnston AuthorDate: 2021-07-13 21:49:39 +0000 Commit: Mark Johnston CommitDate: 2021-07-13 21:49:39 +0000 uart: Fix an out-of-bounds read in ns8250_bus_probe() The problem is that ns8250_bus_probe() accesses a field from the ns8250_softc, which embeds the generic UART softc, but the ns8250_softc hasn't yet been allocated because we're still probing. This is a regression from commit 0aefb0a63c50. This fixed a problem where one of the upper four IER bits, which are usually reserved, needs to be set in order to get RX interrupts before the RX FIFO is full. At the same time, we avoid clearing those reserved bits (see commit 58957d87173, though other UART drivers I looked at do not bother with this). So, copy what ns8250_init() does to disable interrupts, since we don't know what the "right" mask is at this point. Reported by: syzbot+f256beefd0df9eb796e7@syzkaller.appspotmail.com Reviewed by: imp MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31124 --- sys/dev/uart/uart_dev_ns8250.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index 859fb352a194..3950941d92b9 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -792,13 +792,11 @@ ns8250_bus_param(struct uart_softc *sc, int baudrate, int databits, int ns8250_bus_probe(struct uart_softc *sc) { - struct ns8250_softc *ns8250; struct uart_bas *bas; int count, delay, error, limit; uint8_t lsr, mcr, ier; uint8_t val; - ns8250 = (struct ns8250_softc *)sc; bas = &sc->sc_bas; error = ns8250_probe(bas); @@ -893,7 +891,8 @@ ns8250_bus_probe(struct uart_softc *sc) --limit) DELAY(delay); if (limit == 0) { - ier = uart_getreg(bas, REG_IER) & ns8250->ier_mask; + /* See the comment in ns8250_init(). */ + ier = uart_getreg(bas, REG_IER) & 0xe0; uart_setreg(bas, REG_IER, ier); uart_setreg(bas, REG_MCR, mcr); val = 0; From owner-dev-commits-src-main@freebsd.org Tue Jul 13 22:35:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 801BD666BB3; Tue, 13 Jul 2021 22:35: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 4GPb7S3FDbz4SLg; Tue, 13 Jul 2021 22:35: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 458BF2A23; Tue, 13 Jul 2021 22:35: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 16DMZWWZ086645; Tue, 13 Jul 2021 22:35:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16DMZWxe086644; Tue, 13 Jul 2021 22:35:32 GMT (envelope-from git) Date: Tue, 13 Jul 2021 22:35:32 GMT Message-Id: <202107132235.16DMZWxe086644@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: d411b285bc29 - main - pmap: Micro-optimize pmap_remove_pages() on amd64 and arm64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d411b285bc293a37e062d8fb15b85212ce16abab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 22:35:32 -0000 The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=d411b285bc293a37e062d8fb15b85212ce16abab commit d411b285bc293a37e062d8fb15b85212ce16abab Author: Alan Cox AuthorDate: 2021-07-12 23:25:37 +0000 Commit: Alan Cox CommitDate: 2021-07-13 22:33:23 +0000 pmap: Micro-optimize pmap_remove_pages() on amd64 and arm64 Reduce the live ranges for three variables so that they do not span the call to PHYS_TO_VM_PAGE(). This enables the compiler to generate slightly smaller machine code. Reviewed by: kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31161 --- sys/amd64/amd64/pmap.c | 14 ++++++++++---- sys/arm64/arm64/pmap.c | 19 ++++++++++--------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index f8bd17dc6238..31681e255af1 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -8201,6 +8201,16 @@ pmap_remove_pages(pmap_t pmap) continue; } + /* Mark free */ + pc->pc_map[field] |= bitmask; + + /* + * Because this pmap is not active on other + * processors, the dirty bit cannot have + * changed state since we last loaded pte. + */ + pte_clear(pte); + if (superpage) pa = tpte & PG_PS_FRAME; else @@ -8217,8 +8227,6 @@ pmap_remove_pages(pmap_t pmap) ("pmap_remove_pages: bad tpte %#jx", (uintmax_t)tpte)); - pte_clear(pte); - /* * Update the vm_page_t clean/reference bits. */ @@ -8232,8 +8240,6 @@ pmap_remove_pages(pmap_t pmap) CHANGE_PV_LIST_LOCK_TO_VM_PAGE(&lock, m); - /* Mark free */ - pc->pc_map[field] |= bitmask; if (superpage) { pmap_resident_count_adj(pmap, -NBPDR / PAGE_SIZE); pvh = pa_to_pvh(tpte & PG_PS_FRAME); diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 7758a84d81d5..8ed1b86bd58c 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -4951,6 +4951,16 @@ pmap_remove_pages(pmap_t pmap) continue; } + /* Mark free */ + pc->pc_map[field] |= bitmask; + + /* + * Because this pmap is not active on other + * processors, the dirty bit cannot have + * changed state since we last loaded pte. + */ + pmap_clear(pte); + pa = tpte & ~ATTR_MASK; m = PHYS_TO_VM_PAGE(pa); @@ -4964,13 +4974,6 @@ pmap_remove_pages(pmap_t pmap) ("pmap_remove_pages: bad pte %#jx", (uintmax_t)tpte)); - /* - * Because this pmap is not active on other - * processors, the dirty bit cannot have - * changed state since we last loaded pte. - */ - pmap_clear(pte); - /* * Update the vm_page_t clean/reference bits. */ @@ -4988,8 +4991,6 @@ pmap_remove_pages(pmap_t pmap) CHANGE_PV_LIST_LOCK_TO_VM_PAGE(&lock, m); - /* Mark free */ - pc->pc_map[field] |= bitmask; switch (lvl) { case 1: pmap_resident_count_dec(pmap, From owner-dev-commits-src-main@freebsd.org Wed Jul 14 00:40:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2661D6691F1; Wed, 14 Jul 2021 00:40: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 4GPdvf0ZmLz4nG2; Wed, 14 Jul 2021 00:40: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 F04504557; Wed, 14 Jul 2021 00:40: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 16E0eTbA054780; Wed, 14 Jul 2021 00:40:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16E0eTNM054779; Wed, 14 Jul 2021 00:40:29 GMT (envelope-from git) Date: Wed, 14 Jul 2021 00:40:29 GMT Message-Id: <202107140040.16E0eTNM054779@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: f13920b39b8b - main - cxgbe(4): Skip a few more T5/T6 registers during a regdump. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f13920b39b8b500a17fc276629d70828f9f2d4b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 00:40:30 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=f13920b39b8b500a17fc276629d70828f9f2d4b1 commit f13920b39b8b500a17fc276629d70828f9f2d4b1 Author: Navdeep Parhar AuthorDate: 2021-07-13 23:38:55 +0000 Commit: Navdeep Parhar CommitDate: 2021-07-14 00:36:40 +0000 cxgbe(4): Skip a few more T5/T6 registers during a regdump. These registers have read side effects and a read at just the right (wrong?) time can trash some internal hw state. Obtained from: Chelsio Communications MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/common/t4_hw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c index bb08c55c87b2..f06b21120061 100644 --- a/sys/dev/cxgbe/common/t4_hw.c +++ b/sys/dev/cxgbe/common/t4_hw.c @@ -1373,7 +1373,8 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size) 0xdfc0, 0xdfe0, 0xe000, 0x1106c, 0x11074, 0x11088, - 0x1109c, 0x1117c, + 0x1109c, 0x11110, + 0x11118, 0x1117c, 0x11190, 0x11204, 0x19040, 0x1906c, 0x19078, 0x19080, @@ -2082,7 +2083,8 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size) 0x1190, 0x1194, 0x11a0, 0x11a4, 0x11b0, 0x11c4, - 0x11fc, 0x1274, + 0x11fc, 0x123c, + 0x1254, 0x1274, 0x1280, 0x133c, 0x1800, 0x18fc, 0x3000, 0x302c, From owner-dev-commits-src-main@freebsd.org Wed Jul 14 01:01:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7835B66991B; Wed, 14 Jul 2021 01:01: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 4GPfN62dbxz4rYV; Wed, 14 Jul 2021 01:01: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 42CDD4AB4; Wed, 14 Jul 2021 01:01: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 16E11g96086055; Wed, 14 Jul 2021 01:01:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16E11gah086053; Wed, 14 Jul 2021 01:01:42 GMT (envelope-from git) Date: Wed, 14 Jul 2021 01:01:42 GMT Message-Id: <202107140101.16E11gah086053@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 35e62b00c334 - main - cxgbetool(8): Update the register definitions used to decode regdump. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 35e62b00c3342cffee042093b72a52f3f19e5263 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 01:01:42 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=35e62b00c3342cffee042093b72a52f3f19e5263 commit 35e62b00c3342cffee042093b72a52f3f19e5263 Author: Navdeep Parhar AuthorDate: 2021-07-14 00:51:13 +0000 Commit: Navdeep Parhar CommitDate: 2021-07-14 00:55:55 +0000 cxgbetool(8): Update the register definitions used to decode regdump. Obtained from: Chelsio Communications MFC after: 1 week Sponsored by: Chelsio Communications --- usr.sbin/cxgbetool/reg_defs_t5.c | 304 +------------ usr.sbin/cxgbetool/reg_defs_t6.c | 955 +-------------------------------------- 2 files changed, 25 insertions(+), 1234 deletions(-) diff --git a/usr.sbin/cxgbetool/reg_defs_t5.c b/usr.sbin/cxgbetool/reg_defs_t5.c index ff84f00f297a..f5f64da7ebd2 100644 --- a/usr.sbin/cxgbetool/reg_defs_t5.c +++ b/usr.sbin/cxgbetool/reg_defs_t5.c @@ -1,6 +1,6 @@ /* This file is automatically generated --- changes will be lost */ -/* Generation Date : Mon Dec 7 19:40:45 IST 2015 */ -/* Directory name: t5_reg.txt, Changeset: 6934:86d3c0167c2c */ +/* Generation Date : Tue Jan 28 03:02:12 IST 2020 */ +/* Directory name: t5_reg.txt, Changeset: 6941:9063655afd44 */ __FBSDID("$FreeBSD$"); struct reg_info t5_sge_regs[] = { @@ -43607,21 +43607,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x30018, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x30028, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x30040, 0 }, { "MAC_PORT_TX_LINKB_TRANSMIT_CONFIGURATION_MODE", 0x33100, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -43748,21 +43733,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x30018, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x30028, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x30040, 0 }, { "MAC_PORT_TX_LINKC_TRANSMIT_CONFIGURATION_MODE", 0x33400, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -43889,21 +43859,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x30018, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x30028, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x30040, 0 }, { "MAC_PORT_TX_LINKD_TRANSMIT_CONFIGURATION_MODE", 0x33500, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -44030,21 +43985,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x30018, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x30028, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x30040, 0 }, { "MAC_PORT_TX_LINK_BCST_TRANSMIT_CONFIGURATION_MODE", 0x33900, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -44171,21 +44111,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x30018, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x30028, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x30040, 0 }, { "MAC_PORT_RX_LINKA_RECEIVER_CONFIGURATION_MODE", 0x33200, 0 }, { "T5_RX_LINKEN", 15, 1 }, { "T5_RX_LINKRST", 14, 1 }, @@ -47754,21 +47679,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x34000, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x34008, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x34010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x34018, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x34020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x34028, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x34030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x34038, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x34040, 0 }, { "MAC_PORT_TX_LINKB_TRANSMIT_CONFIGURATION_MODE", 0x37100, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -47895,21 +47805,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x34000, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x34008, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x34010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x34018, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x34020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x34028, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x34030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x34038, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x34040, 0 }, { "MAC_PORT_TX_LINKC_TRANSMIT_CONFIGURATION_MODE", 0x37400, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -48036,21 +47931,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x34000, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x34008, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x34010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x34018, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x34020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x34028, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x34030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x34038, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x34040, 0 }, { "MAC_PORT_TX_LINKD_TRANSMIT_CONFIGURATION_MODE", 0x37500, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -48177,21 +48057,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x34000, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x34008, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x34010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x34018, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x34020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x34028, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x34030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x34038, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x34040, 0 }, { "MAC_PORT_TX_LINK_BCST_TRANSMIT_CONFIGURATION_MODE", 0x37900, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -48318,21 +48183,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x34000, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x34008, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x34010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x34018, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x34020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x34028, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x34030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x34038, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x34040, 0 }, { "MAC_PORT_RX_LINKA_RECEIVER_CONFIGURATION_MODE", 0x37200, 0 }, { "T5_RX_LINKEN", 15, 1 }, { "T5_RX_LINKRST", 14, 1 }, @@ -51901,21 +51751,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x38000, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x38008, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x38010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x38018, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x38020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x38028, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x38030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x38038, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x38040, 0 }, { "MAC_PORT_TX_LINKB_TRANSMIT_CONFIGURATION_MODE", 0x3b100, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -52042,21 +51877,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x38000, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x38008, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x38010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x38018, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x38020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x38028, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x38030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x38038, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x38040, 0 }, { "MAC_PORT_TX_LINKC_TRANSMIT_CONFIGURATION_MODE", 0x3b400, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -52183,21 +52003,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x38000, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x38008, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x38010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x38018, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x38020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x38028, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x38030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x38038, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x38040, 0 }, { "MAC_PORT_TX_LINKD_TRANSMIT_CONFIGURATION_MODE", 0x3b500, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -52324,21 +52129,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x38000, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x38008, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x38010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x38018, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x38020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x38028, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x38030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x38038, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x38040, 0 }, { "MAC_PORT_TX_LINK_BCST_TRANSMIT_CONFIGURATION_MODE", 0x3b900, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -52465,21 +52255,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x38000, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x38008, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x38010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x38018, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x38020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x38028, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x38030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x38038, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x38040, 0 }, { "MAC_PORT_RX_LINKA_RECEIVER_CONFIGURATION_MODE", 0x3b200, 0 }, { "T5_RX_LINKEN", 15, 1 }, { "T5_RX_LINKRST", 14, 1 }, @@ -56048,21 +55823,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x3c000, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x3c008, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x3c010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x3c018, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x3c020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x3c028, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x3c030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x3c038, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x3c040, 0 }, { "MAC_PORT_TX_LINKB_TRANSMIT_CONFIGURATION_MODE", 0x3f100, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -56189,21 +55949,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x3c000, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x3c008, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x3c010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x3c018, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x3c020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x3c028, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x3c030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x3c038, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x3c040, 0 }, { "MAC_PORT_TX_LINKC_TRANSMIT_CONFIGURATION_MODE", 0x3f400, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -56330,21 +56075,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x3c000, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x3c008, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x3c010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x3c018, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x3c020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x3c028, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x3c030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x3c038, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x3c040, 0 }, { "MAC_PORT_TX_LINKD_TRANSMIT_CONFIGURATION_MODE", 0x3f500, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -56471,21 +56201,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x3c000, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x3c008, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x3c010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x3c018, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x3c020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x3c028, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x3c030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x3c038, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x3c040, 0 }, { "MAC_PORT_TX_LINK_BCST_TRANSMIT_CONFIGURATION_MODE", 0x3f900, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -56612,21 +56327,6 @@ struct reg_info t5_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_STEP_SIZE_EXTENDED", 0x3c000, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x3c008, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C0_LIMIT_EXTENDED", 0x3c010, 0 }, - { "C0MAX", 8, 5 }, - { "C0MIN", 0, 5 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C1_INIT_EXTENDED", 0x3c018, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C1_LIMIT_EXTENDED", 0x3c020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C2_INIT_EXTENDED", 0x3c028, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C2_LIMIT_EXTENDED", 0x3c030, 0 }, - { "C2MAX", 8, 6 }, - { "C2MIN", 0, 6 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_VM_LIMIT_EXTENDED", 0x3c038, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_V2_LIMIT_EXTENDED", 0x3c040, 0 }, { "MAC_PORT_RX_LINKA_RECEIVER_CONFIGURATION_MODE", 0x3f200, 0 }, { "T5_RX_LINKEN", 15, 1 }, { "T5_RX_LINKRST", 14, 1 }, diff --git a/usr.sbin/cxgbetool/reg_defs_t6.c b/usr.sbin/cxgbetool/reg_defs_t6.c index f8a353b446de..23a3d6d44a5a 100644 --- a/usr.sbin/cxgbetool/reg_defs_t6.c +++ b/usr.sbin/cxgbetool/reg_defs_t6.c @@ -1,6 +1,6 @@ /* This file is automatically generated --- changes will be lost */ -/* Generation Date : Wed Jan 27 10:58:12 IST 2016 */ -/* Directory name: t6_reg.txt, Changeset: 4191:ce3ccd95c109 */ +/* Generation Date : Tue Jan 28 03:02:08 IST 2020 */ +/* Directory name: t6_reg.txt, Changeset: 4272:a648ba4d5c0c */ __FBSDID("$FreeBSD$"); struct reg_info t6_sge_regs[] = { @@ -760,6 +760,21 @@ struct reg_info t6_sge_regs[] = { { "SGE_PC0_RSP_BIST_ERROR_CNT", 0x11a4, 0 }, { "SGE_PC1_RSP_BIST_CMD", 0x11b0, 0 }, { "SGE_PC1_RSP_BIST_ERROR_CNT", 0x11b4, 0 }, + { "SGE_DBQ_TIMER_THRESH0", 0x11b8, 0 }, + { "TxTimeTh3", 24, 6 }, + { "TxTimeTh2", 16, 6 }, + { "TxTimeTh1", 8, 6 }, + { "TxTimeTh0", 0, 6 }, + { "SGE_DBQ_TIMER_THRESH1", 0x11bc, 0 }, + { "TxTimeTh7", 24, 6 }, + { "TxTimeTh6", 16, 6 }, + { "TxTimeTh5", 8, 6 }, + { "TxTimeTh4", 0, 6 }, + { "SGE_DBQ_TIMER_CONFIG", 0x11c0, 0 }, + { "SGE_DBQ_TIMER_DBG", 0x11c4, 0 }, + { "dbq_timer_cmd", 31, 1 }, + { "dbq_timer_index", 24, 6 }, + { "dbq_timer_qcnt", 0, 17 }, { "SGE_CTXT_CMD", 0x11fc, 0 }, { "Busy", 31, 1 }, { "Opcode", 28, 2 }, @@ -39712,6 +39727,12 @@ struct reg_info t6_le_regs[] = { { "LE_DB_DBGI_RSP_DATA", 0x19dc0, 0 }, { "LE_DB_DBGI_RSP_DATA", 0x19dc4, 0 }, { "LE_DB_DBGI_RSP_DATA", 0x19dc8, 0 }, + { "LE_DB_DBGI_RSP_DATA", 0x19dcc, 0 }, + { "LE_DB_DBGI_RSP_DATA", 0x19dd0, 0 }, + { "LE_DB_DBGI_RSP_DATA", 0x19dd4, 0 }, + { "LE_DB_DBGI_RSP_DATA", 0x19dd8, 0 }, + { "LE_DB_DBGI_RSP_DATA", 0x19ddc, 0 }, + { "LE_DB_DBGI_RSP_DATA", 0x19de0, 0 }, { "LE_DB_TCAM_TID_BASE", 0x19df0, 0 }, { "LE_DB_CLCAM_TID_BASE", 0x19df4, 0 }, { "LE_DB_HASH_TID_BASE", 0x19df8, 0 }, @@ -42611,37 +42632,6 @@ struct reg_info t6_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "C0PRESET", 8, 7 }, - { "C0INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 7 }, - { "C0MIN", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C1_INIT_EXTENDED", 0x30018, 0 }, - { "C1PRESET", 8, 7 }, - { "C1INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C2_INIT_EXTENDED", 0x30028, 0 }, - { "C2PRESET", 8, 7 }, - { "C2INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 7 }, - { "C2MIN", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_V2_LIMIT_EXTENDED", 0x30040, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C3_INIT_EXTENDED", 0x30048, 0 }, - { "C3PRESET", 8, 7 }, - { "C3INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C3_LIMIT_EXTENDED", 0x30050, 0 }, - { "C3MAX", 8, 7 }, - { "C3MIN", 0, 7 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C0_INIT2_EXTENDED", 0x3005c, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C1_INIT2_EXTENDED", 0x30060, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C2_INIT2_EXTENDED", 0x30068, 0 }, - { "MAC_PORT_TX_LINKA_TRANSMIT_AE_C3_INIT2_EXTENDED", 0x30070, 0 }, { "MAC_PORT_TX_LINKB_TRANSMIT_CONFIGURATION_MODE", 0x33100, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -42820,37 +42810,6 @@ struct reg_info t6_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "C0PRESET", 8, 7 }, - { "C0INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 7 }, - { "C0MIN", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C1_INIT_EXTENDED", 0x30018, 0 }, - { "C1PRESET", 8, 7 }, - { "C1INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C2_INIT_EXTENDED", 0x30028, 0 }, - { "C2PRESET", 8, 7 }, - { "C2INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 7 }, - { "C2MIN", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_V2_LIMIT_EXTENDED", 0x30040, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C3_INIT_EXTENDED", 0x30048, 0 }, - { "C3PRESET", 8, 7 }, - { "C3INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C3_LIMIT_EXTENDED", 0x30050, 0 }, - { "C3MAX", 8, 7 }, - { "C3MIN", 0, 7 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C0_INIT2_EXTENDED", 0x3005c, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C1_INIT2_EXTENDED", 0x30060, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C2_INIT2_EXTENDED", 0x30068, 0 }, - { "MAC_PORT_TX_LINKB_TRANSMIT_AE_C3_INIT2_EXTENDED", 0x30070, 0 }, { "MAC_PORT_TX_LINKC_TRANSMIT_CONFIGURATION_MODE", 0x33400, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -43029,37 +42988,6 @@ struct reg_info t6_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "C0PRESET", 8, 7 }, - { "C0INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 7 }, - { "C0MIN", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C1_INIT_EXTENDED", 0x30018, 0 }, - { "C1PRESET", 8, 7 }, - { "C1INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C2_INIT_EXTENDED", 0x30028, 0 }, - { "C2PRESET", 8, 7 }, - { "C2INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 7 }, - { "C2MIN", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_V2_LIMIT_EXTENDED", 0x30040, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C3_INIT_EXTENDED", 0x30048, 0 }, - { "C3PRESET", 8, 7 }, - { "C3INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C3_LIMIT_EXTENDED", 0x30050, 0 }, - { "C3MAX", 8, 7 }, - { "C3MIN", 0, 7 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C0_INIT2_EXTENDED", 0x3005c, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C1_INIT2_EXTENDED", 0x30060, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C2_INIT2_EXTENDED", 0x30068, 0 }, - { "MAC_PORT_TX_LINKC_TRANSMIT_AE_C3_INIT2_EXTENDED", 0x30070, 0 }, { "MAC_PORT_TX_LINKD_TRANSMIT_CONFIGURATION_MODE", 0x33500, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -43238,37 +43166,6 @@ struct reg_info t6_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "C0PRESET", 8, 7 }, - { "C0INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 7 }, - { "C0MIN", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C1_INIT_EXTENDED", 0x30018, 0 }, - { "C1PRESET", 8, 7 }, - { "C1INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C2_INIT_EXTENDED", 0x30028, 0 }, - { "C2PRESET", 8, 7 }, - { "C2INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 7 }, - { "C2MIN", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_V2_LIMIT_EXTENDED", 0x30040, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C3_INIT_EXTENDED", 0x30048, 0 }, - { "C3PRESET", 8, 7 }, - { "C3INIT1", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C3_LIMIT_EXTENDED", 0x30050, 0 }, - { "C3MAX", 8, 7 }, - { "C3MIN", 0, 7 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C0_INIT2_EXTENDED", 0x3005c, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C1_INIT2_EXTENDED", 0x30060, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C2_INIT2_EXTENDED", 0x30068, 0 }, - { "MAC_PORT_TX_LINKD_TRANSMIT_AE_C3_INIT2_EXTENDED", 0x30070, 0 }, { "MAC_PORT_TX_LINK_BCST_TRANSMIT_CONFIGURATION_MODE", 0x33900, 0 }, { "T5_TX_LINKEN", 15, 1 }, { "T5_TX_LINKRST", 14, 1 }, @@ -43447,37 +43344,6 @@ struct reg_info t6_mac_regs[] = { { "JTAGTS", 2, 1 }, { "TS", 1, 1 }, { "OBS", 0, 1 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_STEP_SIZE_EXTENDED", 0x30000, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_802_3AP_C0_INIT_EXTENDED", 0x30008, 0 }, - { "C0PRESET", 8, 7 }, - { "C0INIT1", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C0_LIMIT_EXTENDED", 0x30010, 0 }, - { "C0MAX", 8, 7 }, - { "C0MIN", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C1_INIT_EXTENDED", 0x30018, 0 }, - { "C1PRESET", 8, 7 }, - { "C1INIT1", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C1_LIMIT_EXTENDED", 0x30020, 0 }, - { "C1MAX", 8, 7 }, - { "C1MIN", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C2_INIT_EXTENDED", 0x30028, 0 }, - { "C2PRESET", 8, 7 }, - { "C2INIT1", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C2_LIMIT_EXTENDED", 0x30030, 0 }, - { "C2MAX", 8, 7 }, - { "C2MIN", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_VM_LIMIT_EXTENDED", 0x30038, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_V2_LIMIT_EXTENDED", 0x30040, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C3_INIT_EXTENDED", 0x30048, 0 }, - { "C3PRESET", 8, 7 }, - { "C3INIT1", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C3_LIMIT_EXTENDED", 0x30050, 0 }, - { "C3MAX", 8, 7 }, - { "C3MIN", 0, 7 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C0_INIT2_EXTENDED", 0x3005c, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C1_INIT2_EXTENDED", 0x30060, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C2_INIT2_EXTENDED", 0x30068, 0 }, - { "MAC_PORT_TX_LINK_BCST_TRANSMIT_AE_C3_INIT2_EXTENDED", 0x30070, 0 }, { "MAC_PORT_RX_LINKA_RECEIVER_CONFIGURATION_MODE", 0x33200, 0 }, { "T5_RX_LINKEN", 15, 1 }, { "T5_RX_LINKRST", 14, 1 }, @@ -43801,68 +43667,6 @@ struct reg_info t6_mac_regs[] = { { "FPRBSOFF", 0, 1 }, { "MAC_PORT_RX_LINKA_DFE_TAP_CONTROL", 0x332c0, 0 }, { "MAC_PORT_RX_LINKA_DFE_TAP", 0x332c4, 0 }, - { "MAC_PORT_RX_LINKA_DFE_TAP_ENABLE", 0x32a00, 0 }, - { "INDEX", 1, 15 }, - { "MAC_PORT_RX_LINKA_DFE_H1", 0x32a04, 0 }, - { "H1OSN", 13, 3 }, - { "H1OMAG", 8, 5 }, - { "H1ESN", 6, 2 }, - { "H1EMAG", 0, 6 }, - { "MAC_PORT_RX_LINKA_DFE_H2", 0x32a08, 0 }, - { "H2OSN", 13, 2 }, - { "H2OMAG", 8, 5 }, - { "H2ESN", 5, 2 }, - { "H2EMAG", 0, 5 }, - { "MAC_PORT_RX_LINKA_DFE_H3", 0x32a0c, 0 }, - { "H3OSN", 12, 2 }, - { "H3OMAG", 8, 4 }, - { "H3ESN", 4, 2 }, - { "H3EMAG", 0, 4 }, - { "MAC_PORT_RX_LINKA_DFE_H4", 0x32a10, 0 }, - { "H4SN", 4, 2 }, - { "H4MAG", 0, 4 }, - { "MAC_PORT_RX_LINKA_DFE_H5", 0x32a14, 0 }, - { "H5GS", 6, 2 }, - { "H5SN", 4, 2 }, - { "H5MAG", 0, 4 }, - { "MAC_PORT_RX_LINKA_DFE_H6_AND_H7", 0x32a18, 0 }, - { "H7GS", 14, 2 }, - { "H7SN", 12, 2 }, - { "H7MAG", 8, 4 }, - { "H6GS", 6, 2 }, - { "H6SN", 4, 2 }, - { "H6MAG", 0, 4 }, - { "MAC_PORT_RX_LINKA_DFE_H8_AND_H9", 0x32a1c, 0 }, - { "H9GS", 14, 2 }, - { "H9SN", 12, 2 }, - { "H9MAG", 8, 4 }, - { "H8GS", 6, 2 }, - { "H8SN", 4, 2 }, - { "H8MAG", 0, 4 }, - { "MAC_PORT_RX_LINKA_DFE_H10_AND_H11", 0x32a20, 0 }, - { "H11GS", 14, 2 }, - { "H11SN", 12, 2 }, - { "H11MAG", 8, 4 }, - { "H10GS", 6, 2 }, - { "H10SN", 4, 2 }, - { "H10MAG", 0, 4 }, - { "MAC_PORT_RX_LINKA_DFE_H12_13", 0x32a24, 0 }, - { "H13GS", 13, 3 }, - { "H13SN", 10, 3 }, - { "H13MAG", 8, 2 }, - { "H12GS", 6, 2 }, - { "H12SN", 4, 2 }, - { "H12MAG", 0, 4 }, - { "MAC_PORT_RX_LINKA_DFE_H14_15", 0x32a28, 0 }, - { "H15GS", 13, 3 }, - { "H15SN", 10, 3 }, - { "H15MAG", 8, 2 }, - { "H14GS", 6, 2 }, - { "H14SN", 4, 2 }, - { "H14MAG", 0, 4 }, - { "MAC_PORT_RX_LINKA_DFE_H1ODD_DELTA_AND_H1EVEN_DELTA", 0x32a2c, 0 }, - { "H1ODELTA", 8, 5 }, - { "H1EDELTA", 0, 6 }, { "MAC_PORT_RX_LINKA_RECEIVER_INTERNAL_STATUS_2", 0x332e4, 0 }, { "STNDBYSTAT", 15, 1 }, { "CALSDONE", 14, 1 }, @@ -44245,68 +44049,6 @@ struct reg_info t6_mac_regs[] = { { "FPRBSOFF", 0, 1 }, { "MAC_PORT_RX_LINKB_DFE_TAP_CONTROL", 0x333c0, 0 }, { "MAC_PORT_RX_LINKB_DFE_TAP", 0x333c4, 0 }, - { "MAC_PORT_RX_LINKB_DFE_TAP_ENABLE", 0x32b00, 0 }, - { "INDEX", 1, 15 }, - { "MAC_PORT_RX_LINKB_DFE_H1", 0x32b04, 0 }, - { "H1OSN", 13, 3 }, - { "H1OMAG", 8, 5 }, - { "H1ESN", 6, 2 }, - { "H1EMAG", 0, 6 }, - { "MAC_PORT_RX_LINKB_DFE_H2", 0x32b08, 0 }, - { "H2OSN", 13, 2 }, - { "H2OMAG", 8, 5 }, - { "H2ESN", 5, 2 }, - { "H2EMAG", 0, 5 }, - { "MAC_PORT_RX_LINKB_DFE_H3", 0x32b0c, 0 }, - { "H3OSN", 12, 2 }, - { "H3OMAG", 8, 4 }, - { "H3ESN", 4, 2 }, - { "H3EMAG", 0, 4 }, - { "MAC_PORT_RX_LINKB_DFE_H4", 0x32b10, 0 }, - { "H4SN", 4, 2 }, - { "H4MAG", 0, 4 }, - { "MAC_PORT_RX_LINKB_DFE_H5", 0x32b14, 0 }, - { "H5GS", 6, 2 }, - { "H5SN", 4, 2 }, - { "H5MAG", 0, 4 }, - { "MAC_PORT_RX_LINKB_DFE_H6_AND_H7", 0x32b18, 0 }, - { "H7GS", 14, 2 }, - { "H7SN", 12, 2 }, - { "H7MAG", 8, 4 }, - { "H6GS", 6, 2 }, - { "H6SN", 4, 2 }, - { "H6MAG", 0, 4 }, - { "MAC_PORT_RX_LINKB_DFE_H8_AND_H9", 0x32b1c, 0 }, - { "H9GS", 14, 2 }, - { "H9SN", 12, 2 }, - { "H9MAG", 8, 4 }, - { "H8GS", 6, 2 }, - { "H8SN", 4, 2 }, - { "H8MAG", 0, 4 }, - { "MAC_PORT_RX_LINKB_DFE_H10_AND_H11", 0x32b20, 0 }, - { "H11GS", 14, 2 }, - { "H11SN", 12, 2 }, - { "H11MAG", 8, 4 }, - { "H10GS", 6, 2 }, - { "H10SN", 4, 2 }, - { "H10MAG", 0, 4 }, - { "MAC_PORT_RX_LINKB_DFE_H12_13", 0x32b24, 0 }, - { "H13GS", 13, 3 }, - { "H13SN", 10, 3 }, - { "H13MAG", 8, 2 }, - { "H12GS", 6, 2 }, - { "H12SN", 4, 2 }, - { "H12MAG", 0, 4 }, - { "MAC_PORT_RX_LINKB_DFE_H14_15", 0x32b28, 0 }, - { "H15GS", 13, 3 }, - { "H15SN", 10, 3 }, - { "H15MAG", 8, 2 }, - { "H14GS", 6, 2 }, - { "H14SN", 4, 2 }, - { "H14MAG", 0, 4 }, - { "MAC_PORT_RX_LINKB_DFE_H1ODD_DELTA_AND_H1EVEN_DELTA", 0x32b2c, 0 }, - { "H1ODELTA", 8, 5 }, - { "H1EDELTA", 0, 6 }, { "MAC_PORT_RX_LINKB_RECEIVER_INTERNAL_STATUS_2", 0x333e4, 0 }, { "STNDBYSTAT", 15, 1 }, { "CALSDONE", 14, 1 }, @@ -44689,68 +44431,6 @@ struct reg_info t6_mac_regs[] = { { "FPRBSOFF", 0, 1 }, { "MAC_PORT_RX_LINKC_DFE_TAP_CONTROL", 0x336c0, 0 }, { "MAC_PORT_RX_LINKC_DFE_TAP", 0x336c4, 0 }, - { "MAC_PORT_RX_LINKC_DFE_TAP_ENABLE", 0x32e00, 0 }, - { "INDEX", 1, 15 }, - { "MAC_PORT_RX_LINKC_DFE_H1", 0x32e04, 0 }, - { "H1OSN", 13, 3 }, - { "H1OMAG", 8, 5 }, - { "H1ESN", 6, 2 }, - { "H1EMAG", 0, 6 }, - { "MAC_PORT_RX_LINKC_DFE_H2", 0x32e08, 0 }, - { "H2OSN", 13, 2 }, - { "H2OMAG", 8, 5 }, - { "H2ESN", 5, 2 }, - { "H2EMAG", 0, 5 }, - { "MAC_PORT_RX_LINKC_DFE_H3", 0x32e0c, 0 }, - { "H3OSN", 12, 2 }, - { "H3OMAG", 8, 4 }, - { "H3ESN", 4, 2 }, - { "H3EMAG", 0, 4 }, - { "MAC_PORT_RX_LINKC_DFE_H4", 0x32e10, 0 }, - { "H4SN", 4, 2 }, - { "H4MAG", 0, 4 }, - { "MAC_PORT_RX_LINKC_DFE_H5", 0x32e14, 0 }, - { "H5GS", 6, 2 }, - { "H5SN", 4, 2 }, - { "H5MAG", 0, 4 }, - { "MAC_PORT_RX_LINKC_DFE_H6_AND_H7", 0x32e18, 0 }, - { "H7GS", 14, 2 }, - { "H7SN", 12, 2 }, - { "H7MAG", 8, 4 }, - { "H6GS", 6, 2 }, - { "H6SN", 4, 2 }, - { "H6MAG", 0, 4 }, - { "MAC_PORT_RX_LINKC_DFE_H8_AND_H9", 0x32e1c, 0 }, - { "H9GS", 14, 2 }, - { "H9SN", 12, 2 }, - { "H9MAG", 8, 4 }, - { "H8GS", 6, 2 }, - { "H8SN", 4, 2 }, - { "H8MAG", 0, 4 }, - { "MAC_PORT_RX_LINKC_DFE_H10_AND_H11", 0x32e20, 0 }, - { "H11GS", 14, 2 }, - { "H11SN", 12, 2 }, - { "H11MAG", 8, 4 }, - { "H10GS", 6, 2 }, - { "H10SN", 4, 2 }, - { "H10MAG", 0, 4 }, - { "MAC_PORT_RX_LINKC_DFE_H12_13", 0x32e24, 0 }, - { "H13GS", 13, 3 }, - { "H13SN", 10, 3 }, - { "H13MAG", 8, 2 }, - { "H12GS", 6, 2 }, - { "H12SN", 4, 2 }, - { "H12MAG", 0, 4 }, - { "MAC_PORT_RX_LINKC_DFE_H14_15", 0x32e28, 0 }, - { "H15GS", 13, 3 }, - { "H15SN", 10, 3 }, - { "H15MAG", 8, 2 }, - { "H14GS", 6, 2 }, - { "H14SN", 4, 2 }, - { "H14MAG", 0, 4 }, - { "MAC_PORT_RX_LINKC_DFE_H1ODD_DELTA_AND_H1EVEN_DELTA", 0x32e2c, 0 }, - { "H1ODELTA", 8, 5 }, - { "H1EDELTA", 0, 6 }, { "MAC_PORT_RX_LINKC_RECEIVER_INTERNAL_STATUS_2", 0x336e4, 0 }, { "STNDBYSTAT", 15, 1 }, { "CALSDONE", 14, 1 }, @@ -45133,68 +44813,6 @@ struct reg_info t6_mac_regs[] = { { "FPRBSOFF", 0, 1 }, { "MAC_PORT_RX_LINKD_DFE_TAP_CONTROL", 0x337c0, 0 }, { "MAC_PORT_RX_LINKD_DFE_TAP", 0x337c4, 0 }, - { "MAC_PORT_RX_LINKD_DFE_TAP_ENABLE", 0x32f00, 0 }, - { "INDEX", 1, 15 }, - { "MAC_PORT_RX_LINKD_DFE_H1", 0x32f04, 0 }, - { "H1OSN", 13, 3 }, - { "H1OMAG", 8, 5 }, - { "H1ESN", 6, 2 }, - { "H1EMAG", 0, 6 }, - { "MAC_PORT_RX_LINKD_DFE_H2", 0x32f08, 0 }, - { "H2OSN", 13, 2 }, - { "H2OMAG", 8, 5 }, - { "H2ESN", 5, 2 }, - { "H2EMAG", 0, 5 }, - { "MAC_PORT_RX_LINKD_DFE_H3", 0x32f0c, 0 }, - { "H3OSN", 12, 2 }, - { "H3OMAG", 8, 4 }, - { "H3ESN", 4, 2 }, - { "H3EMAG", 0, 4 }, - { "MAC_PORT_RX_LINKD_DFE_H4", 0x32f10, 0 }, - { "H4SN", 4, 2 }, - { "H4MAG", 0, 4 }, - { "MAC_PORT_RX_LINKD_DFE_H5", 0x32f14, 0 }, - { "H5GS", 6, 2 }, - { "H5SN", 4, 2 }, - { "H5MAG", 0, 4 }, - { "MAC_PORT_RX_LINKD_DFE_H6_AND_H7", 0x32f18, 0 }, - { "H7GS", 14, 2 }, - { "H7SN", 12, 2 }, - { "H7MAG", 8, 4 }, - { "H6GS", 6, 2 }, - { "H6SN", 4, 2 }, - { "H6MAG", 0, 4 }, - { "MAC_PORT_RX_LINKD_DFE_H8_AND_H9", 0x32f1c, 0 }, - { "H9GS", 14, 2 }, - { "H9SN", 12, 2 }, - { "H9MAG", 8, 4 }, - { "H8GS", 6, 2 }, - { "H8SN", 4, 2 }, - { "H8MAG", 0, 4 }, - { "MAC_PORT_RX_LINKD_DFE_H10_AND_H11", 0x32f20, 0 }, - { "H11GS", 14, 2 }, - { "H11SN", 12, 2 }, - { "H11MAG", 8, 4 }, - { "H10GS", 6, 2 }, - { "H10SN", 4, 2 }, - { "H10MAG", 0, 4 }, - { "MAC_PORT_RX_LINKD_DFE_H12_13", 0x32f24, 0 }, - { "H13GS", 13, 3 }, - { "H13SN", 10, 3 }, - { "H13MAG", 8, 2 }, - { "H12GS", 6, 2 }, - { "H12SN", 4, 2 }, - { "H12MAG", 0, 4 }, - { "MAC_PORT_RX_LINKD_DFE_H14_15", 0x32f28, 0 }, - { "H15GS", 13, 3 }, - { "H15SN", 10, 3 }, - { "H15MAG", 8, 2 }, - { "H14GS", 6, 2 }, - { "H14SN", 4, 2 }, - { "H14MAG", 0, 4 }, - { "MAC_PORT_RX_LINKD_DFE_H1ODD_DELTA_AND_H1EVEN_DELTA", 0x32f2c, 0 }, - { "H1ODELTA", 8, 5 }, - { "H1EDELTA", 0, 6 }, { "MAC_PORT_RX_LINKD_RECEIVER_INTERNAL_STATUS_2", 0x337e4, 0 }, { "STNDBYSTAT", 15, 1 }, { "CALSDONE", 14, 1 }, *** 604 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Wed Jul 14 02:39:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B66AC66A5CE; Wed, 14 Jul 2021 02:39: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 4GPhYK4Wvfz3PJd; Wed, 14 Jul 2021 02:39: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 7C2BA5D39; Wed, 14 Jul 2021 02:39: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 16E2dnUb006581; Wed, 14 Jul 2021 02:39:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16E2dn17006580; Wed, 14 Jul 2021 02:39:49 GMT (envelope-from git) Date: Wed, 14 Jul 2021 02:39:49 GMT Message-Id: <202107140239.16E2dn17006580@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: 27d997be9750 - main - cardbus: move card_if.m to sys/dev/cardbus 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: 27d997be9750242c789faed04b68afd6e83068a3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 02:39:49 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=27d997be9750242c789faed04b68afd6e83068a3 commit 27d997be9750242c789faed04b68afd6e83068a3 Author: Warner Losh AuthorDate: 2021-07-13 22:40:39 +0000 Commit: Warner Losh CommitDate: 2021-07-14 02:39:30 +0000 cardbus: move card_if.m to sys/dev/cardbus Move card_if.m to sys/dev/cardbus since pccard is disappearing. Sponsored by: Netflix --- sys/conf/files | 2 +- sys/dev/{pccard => cardbus}/card_if.m | 0 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/files b/sys/conf/files index 8b16621c69a7..245bbcb01374 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1405,6 +1405,7 @@ dev/bwn/if_bwn_phy_lp.c optional bwn bhnd dev/bwn/if_bwn_phy_n.c optional bwn bhnd dev/bwn/if_bwn_util.c optional bwn bhnd dev/cadence/if_cgem.c optional cgem fdt +dev/cardbus/card_if.m standard dev/cardbus/cardbus.c optional cardbus dev/cardbus/cardbus_cis.c optional cardbus dev/cardbus/cardbus_device.c optional cardbus @@ -2628,7 +2629,6 @@ dev/ow/own_if.m optional ow dev/ow/ow_temp.c optional ow_temp dev/ow/owc_gpiobus.c optional owc gpio dev/pbio/pbio.c optional pbio isa -dev/pccard/card_if.m standard dev/pccard/pccard.c optional pccard dev/pccard/pccard_cis.c optional pccard dev/pccard/pccard_cis_quirks.c optional pccard diff --git a/sys/dev/pccard/card_if.m b/sys/dev/cardbus/card_if.m similarity index 100% rename from sys/dev/pccard/card_if.m rename to sys/dev/cardbus/card_if.m From owner-dev-commits-src-main@freebsd.org Wed Jul 14 02:39:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4718166A461; Wed, 14 Jul 2021 02:39: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 4GPhYL5PD4z3PXH; Wed, 14 Jul 2021 02:39: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 944E56033; Wed, 14 Jul 2021 02:39: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 16E2doTn006605; Wed, 14 Jul 2021 02:39:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16E2dopr006604; Wed, 14 Jul 2021 02:39:50 GMT (envelope-from git) Date: Wed, 14 Jul 2021 02:39:50 GMT Message-Id: <202107140239.16E2dopr006604@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: 91f046d0591b - main - pccard: remove pccard module 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: 91f046d0591b58dea523a1d66b2af821fff85330 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 02:39:51 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=91f046d0591b58dea523a1d66b2af821fff85330 commit 91f046d0591b58dea523a1d66b2af821fff85330 Author: Warner Losh AuthorDate: 2021-07-13 22:44:34 +0000 Commit: Warner Losh CommitDate: 2021-07-14 02:39:31 +0000 pccard: remove pccard module There's no more pccard client drivers, so remove pccard driver. Sponsored by: Netflix --- sys/modules/Makefile | 3 --- sys/modules/pccard/Makefile | 9 --------- 2 files changed, 12 deletions(-) diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 91e3a54213ff..16f5ba061db6 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -282,7 +282,6 @@ SUBDIR= \ ow \ ${_padlock} \ ${_padlock_rng} \ - ${_pccard} \ ${_pchtherm} \ ${_pcfclock} \ ${_pf} \ @@ -646,7 +645,6 @@ _lio= lio _nctgpio= nctgpio _ntb= ntb _ocs_fc= ocs_fc -_pccard= pccard _qat= qat _qatfw= qatfw .if ${MK_OFED} != "no" || defined(ALL_MODULES) @@ -792,7 +790,6 @@ _exca= exca _ffec= ffec _nvd= nvd _nvme= nvme -_pccard= pccard .endif .if ${MACHINE_ARCH:Mpowerpc64*} != "" diff --git a/sys/modules/pccard/Makefile b/sys/modules/pccard/Makefile deleted file mode 100644 index f7822da784d7..000000000000 --- a/sys/modules/pccard/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD$ - -.PATH: ${SRCTOP}/sys/dev/pccard - -KMOD= pccard -SRCS= pccard.c pccard_cis.c pccard_cis_quirks.c pccard_device.c \ - device_if.h bus_if.h card_if.h power_if.h pccarddevs.h - -.include From owner-dev-commits-src-main@freebsd.org Wed Jul 14 02:39:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1A3F66AB29; Wed, 14 Jul 2021 02:39: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 4GPhYM6NRgz3PPd; Wed, 14 Jul 2021 02:39: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 BC1565DCE; Wed, 14 Jul 2021 02:39: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 16E2dpiW006631; Wed, 14 Jul 2021 02:39:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16E2dpBN006630; Wed, 14 Jul 2021 02:39:51 GMT (envelope-from git) Date: Wed, 14 Jul 2021 02:39:51 GMT Message-Id: <202107140239.16E2dpBN006630@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: c0c703342d20 - main - pccard: remove pccard device from all kernels 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: c0c703342d204f63ee4da4cf05eb90f3fcfe4e8b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 02:39:52 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c0c703342d204f63ee4da4cf05eb90f3fcfe4e8b commit c0c703342d204f63ee4da4cf05eb90f3fcfe4e8b Author: Warner Losh AuthorDate: 2021-07-13 22:46:55 +0000 Commit: Warner Losh CommitDate: 2021-07-14 02:39:31 +0000 pccard: remove pccard device from all kernels All the PC Card drivers have been removed from the tree. Remove the pccard drivers from all the kernels. Sponsored by: Netflix --- sys/amd64/conf/GENERIC | 1 - sys/conf/NOTES | 5 +---- sys/i386/conf/GENERIC | 1 - sys/mips/conf/OCTEON1 | 1 - 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index 7ea749e28e33..a28dc238af8d 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -231,7 +231,6 @@ device agp # support several AGP chipsets # PCCARD (PCMCIA) support # PCMCIA and cardbus bridge support device cbb # cardbus (yenta) bridge -device pccard # PC Card (16-bit) bus device cardbus # CardBus (32-bit) bus # Serial (COM) ports diff --git a/sys/conf/NOTES b/sys/conf/NOTES index a13882facce2..54e6dc45ac49 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -1456,7 +1456,7 @@ options PCI_IOV # PCI SR-IOV support # HARDWARE DEVICE CONFIGURATION # For ISA the required hints are listed. -# PCI, CardBus, SD/MMC and pccard are self identifying buses, so +# PCI, CardBus, and SD/MMC are self identifying buses, so # no hints are needed. # @@ -1678,7 +1678,6 @@ device ata # Modular ATA #device atacore # Core ATA functionality -#device atapccard # CARDBUS support #device ataisa # ISA bus support #device atapci # PCI bus support; only generic chipset support @@ -2171,10 +2170,8 @@ options SND_OLDSTEREO # PC Card/PCMCIA and Cardbus # # cbb: pci/cardbus bridge implementing YENTA interface -# pccard: pccard slots # cardbus: cardbus slots device cbb -device pccard device cardbus # diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC index 8f64c4b3327f..96d0803e1f2e 100644 --- a/sys/i386/conf/GENERIC +++ b/sys/i386/conf/GENERIC @@ -204,7 +204,6 @@ device agp # support several AGP chipsets # PCCARD (PCMCIA) support # PCMCIA and cardbus bridge support device cbb # cardbus (yenta) bridge -device pccard # PC Card (16-bit) bus device cardbus # CardBus (32-bit) bus # Serial (COM) ports diff --git a/sys/mips/conf/OCTEON1 b/sys/mips/conf/OCTEON1 index 7596a61a09da..2ad031583d7e 100644 --- a/sys/mips/conf/OCTEON1 +++ b/sys/mips/conf/OCTEON1 @@ -133,7 +133,6 @@ device ciss # Compaq Smart RAID 5* # PCCARD (PCMCIA) support # PCMCIA and cardbus bridge support device cbb # cardbus (yenta) bridge -device pccard # PC Card (16-bit) bus device cardbus # CardBus (32-bit) bus # Serial (COM) ports From owner-dev-commits-src-main@freebsd.org Wed Jul 14 03:57:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 00BC766B65C; Wed, 14 Jul 2021 03: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 4GPkGn59nwz3rGh; Wed, 14 Jul 2021 03:57: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 9A93C71E4; Wed, 14 Jul 2021 03: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 16E3vLi4013770; Wed, 14 Jul 2021 03: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 16E3vLou013769; Wed, 14 Jul 2021 03:57:21 GMT (envelope-from git) Date: Wed, 14 Jul 2021 03:57:21 GMT Message-Id: <202107140357.16E3vLou013769@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: b345b7e9e9c3 - main - Document my shiny new doc commit bit 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: b345b7e9e9c3415a562cf29dcf05b2f75d95ce1c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 03:57:22 -0000 The branch main has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=b345b7e9e9c3415a562cf29dcf05b2f75d95ce1c commit b345b7e9e9c3415a562cf29dcf05b2f75d95ce1c Author: Philip Paeps AuthorDate: 2021-07-14 03:55:16 +0000 Commit: Philip Paeps CommitDate: 2021-07-14 03:55:16 +0000 Document my shiny new doc commit bit --- share/misc/committers-doc.dot | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/misc/committers-doc.dot b/share/misc/committers-doc.dot index 4cb33ba7a875..a4297f2442db 100644 --- a/share/misc/committers-doc.dot +++ b/share/misc/committers-doc.dot @@ -87,6 +87,7 @@ marck [label="Dmitry Morozovsky\nmarck@FreeBSD.org\n2004/08/10"] maxim [label="Maxim Konovalov\nmaxim@FreeBSD.org\n2002/02/07"] miwi [label="Martin Wilke\nmiwi@FreeBSD.org\n2007/10/26"] pav [label="Pav Lucistnik\npav@FreeBSD.org\n2005/08/12"] +philip [label="Philip Paeps\nphilip@FreeBSD.org\n2021/07/13"] pluknet [label="Sergey Kandaurov\npluknet@FreeBSD.org\n2012/02/14"] remko [label="Remko Lodder\nremko@FreeBSD.org\n2004/10/16"] rene [label="Rene Ladan\nrene@FreeBSD.org\n2008/11/03"] @@ -157,6 +158,7 @@ gjb -> wblock gjb -> rene gjb -> dru gjb -> crees +gjb -> philip hrs -> ryusuke hrs -> dru From owner-dev-commits-src-main@freebsd.org Wed Jul 14 06:01:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5DBA666CA53; Wed, 14 Jul 2021 06:01: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 4GPn1W2DNXz4fBh; Wed, 14 Jul 2021 06:01: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 2AB2710C3B; Wed, 14 Jul 2021 06:01: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 16E613f9082627; Wed, 14 Jul 2021 06:01:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16E613Cv082626; Wed, 14 Jul 2021 06:01:03 GMT (envelope-from git) Date: Wed, 14 Jul 2021 06:01:03 GMT Message-Id: <202107140601.16E613Cv082626@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: 8616f8aff1f0 - main - stress2: Pass program exit code to shell script exit. Do not loop forever in test program 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: 8616f8aff1f0575f2895cf092aa013d38be274a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 06:01:03 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=8616f8aff1f0575f2895cf092aa013d38be274a9 commit 8616f8aff1f0575f2895cf092aa013d38be274a9 Author: Peter Holm AuthorDate: 2021-07-14 05:59:48 +0000 Commit: Peter Holm CommitDate: 2021-07-14 05:59:48 +0000 stress2: Pass program exit code to shell script exit. Do not loop forever in test program --- tools/test/stress2/misc/radix.sh | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/tools/test/stress2/misc/radix.sh b/tools/test/stress2/misc/radix.sh index 4bca761c08b9..9107f528deb9 100755 --- a/tools/test/stress2/misc/radix.sh +++ b/tools/test/stress2/misc/radix.sh @@ -31,10 +31,13 @@ # "panic: default pager with handle" seen with WiP kernel code. # https://people.freebsd.org/~pho/stress/log/kostik1243.txt +# "panic: ASan: Invalid access, 8-byte read at ..., MallocRedZone(fb)" seen + [ `sysctl vm.swap_total | sed 's/.* //'` -eq 0 ] && exit 0 . ../default.cfg +log=/tmp/radix.log dir=/tmp odir=`pwd` cd $dir @@ -49,8 +52,9 @@ usermem=`sysctl hw.usermem | sed 's/.* //'` pagesize=`pagesize` start=`date +%s` while true; do - /tmp/radix $parallel > /tmp/radix.log 2>&1 - used=`awk '{print $4}' < /tmp/radix.log` + /tmp/radix $parallel > $log; s=$? + [ $s -ne 0 ] && cat $log + used=`awk '{print $4}' < $log` [ -z "$used" ] && break [ $((`date +%s` - start)) -gt 300 ] && break [ $used -gt $((usermem / pagesize)) ] && break @@ -61,8 +65,8 @@ while true; do done cat /tmp/radix.log -rm -f /tmp/radix #/tmp/radix.log -exit +rm -f /tmp/radix $log +exit $s EOF /* @@ -169,7 +173,7 @@ handler(int s __unused) static void ihandler(int s __unused) { - _exit(0); + _exit(1); } static int @@ -191,7 +195,7 @@ test(void) { state_t state; off_t offset; - int fd; + int fd, i; signal(SIGHUP, ihandler); for (;;) { @@ -214,7 +218,7 @@ test(void) if (write(fds[1], &pgs, sizeof(pgs)) != sizeof(pgs)) err(1, "ewrite pipe"); kill(getppid(), SIGHUP); - for (;;) + for (i = 0; i < 180; i++) sleep(1); close(fd); @@ -233,6 +237,7 @@ main(int argc, char **argv) parallel = atoi(argv[1]); ps = getpagesize(); + signal(SIGALRM, ihandler); signal(SIGHUP, handler); unlink("rendezvous"); pids = malloc(parallel * sizeof(pid_t)); @@ -246,10 +251,10 @@ main(int argc, char **argv) if ((rfd = open("rendezvous", O_CREAT, 0644)) == -1) err(1, "open()"); close(rfd); - alarm(60); - while (s1 != parallel) + alarm(300); + while (s1 != parallel) { usleep(10000); - alarm(0); + } r2 = radix(); pages = 0; for (i = 0; i < parallel; i++) { @@ -258,7 +263,7 @@ main(int argc, char **argv) err(1, "read pipe"); pages += pgs; } - fprintf(stderr, "A total of %jd pages (%.1f MB) touched, %d" + fprintf(stdout, "A total of %jd pages (%.1f MB) touched, %d" " RADIX nodes used, p/r = %.1f, parallel = %d.\n", pages, pages * ps / 1024. / 1024, r2 - r1, pages / (r2 - r1 + 0.), parallel); From owner-dev-commits-src-main@freebsd.org Wed Jul 14 10:31:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C50266FEAC; Wed, 14 Jul 2021 10:31: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 4GPv1P6D19z4Tc2; Wed, 14 Jul 2021 10:31: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 BE288145B9; Wed, 14 Jul 2021 10:31: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 16EAVLsp043801; Wed, 14 Jul 2021 10:31:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EAVLtL043800; Wed, 14 Jul 2021 10:31:21 GMT (envelope-from git) Date: Wed, 14 Jul 2021 10:31:21 GMT Message-Id: <202107141031.16EAVLtL043800@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: f5998d20ed80 - main - psm(4): Probe Synaptics touchpad with active multiplexing mode enabled MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f5998d20ed80fdc1cb3ba0c245cae5f179e22fe2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 10:31:22 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=f5998d20ed80fdc1cb3ba0c245cae5f179e22fe2 commit f5998d20ed80fdc1cb3ba0c245cae5f179e22fe2 Author: Vladimir Kondratyev AuthorDate: 2021-07-14 10:30:26 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-14 10:30:26 +0000 psm(4): Probe Synaptics touchpad with active multiplexing mode enabled if it is only multiplexed device. Also enable syncbit checks for them. This fixes touchpad recognition on Panasonic Toughbook CF-MX4 laptop. Reported by: Tomasz "CeDeROM" CEDRO MFC after: 1 month PR: 253279 Differential revision: https://reviews.freebsd.org/D28502 --- sys/dev/atkbdc/psm.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index 43d19b5174d3..f6276ae847aa 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -466,6 +466,7 @@ struct psm_softc { /* Driver status information */ int muxtpbuttons; /* Touchpad button state */ int muxmsbuttons; /* Mouse (trackpoint) button state */ struct timeval muxmidtimeout; /* middle button supression timeout */ + int muxsinglesyna; /* Probe result of single Synaptics */ #ifdef EVDEV_SUPPORT struct evdev_dev *evdev_a; /* Absolute reporting device */ struct evdev_dev *evdev_r; /* Relative reporting device */ @@ -666,6 +667,7 @@ static probefunc_t enable_4dplus; static probefunc_t enable_mmanplus; static probefunc_t enable_synaptics; static probefunc_t enable_synaptics_mux; +static probefunc_t enable_single_synaptics_mux; static probefunc_t enable_trackpoint; static probefunc_t enable_versapad; static probefunc_t enable_elantech; @@ -686,8 +688,10 @@ static struct { * WARNING: the order of probe is very important. Don't mess it * unless you know what you are doing. */ - { MOUSE_MODEL_SYNAPTICS, /* Synaptics Touchpad on Active Mux */ + { MOUSE_MODEL_SYNAPTICS, /* Synaptics + mouse on Active Mux */ 0x00, MOUSE_PS2_PACKETSIZE, enable_synaptics_mux }, + { MOUSE_MODEL_SYNAPTICS, /* Single Synaptics on Active Mux */ + 0xc0, MOUSE_SYNAPTICS_PACKETSIZE, enable_single_synaptics_mux }, { MOUSE_MODEL_NET, /* Genius NetMouse */ 0x08, MOUSE_PS2INTELLI_PACKETSIZE, enable_gmouse }, { MOUSE_MODEL_NETSCROLL, /* Genius NetScroll */ @@ -6292,6 +6296,8 @@ enable_synaptics_mux(struct psm_softc *sc, enum probearg arg) int active_ports_count = 0; int active_ports_mask = 0; + sc->muxsinglesyna = FALSE; + if (mux_disabled == 1 || (mux_disabled == -1 && (kbdc->quirks & KBDC_QUIRK_DISABLE_MUX_PROBE) != 0)) return (FALSE); @@ -6315,18 +6321,16 @@ enable_synaptics_mux(struct psm_softc *sc, enum probearg arg) active_ports_count); /* psm has a special support for GenMouse + SynTouchpad combination */ - if (active_ports_count >= 2) { - for (port = 0; port < KBDC_AUX_MUX_NUM_PORTS; port++) { - if ((active_ports_mask & 1 << port) == 0) - continue; - VLOG(3, (LOG_DEBUG, "aux_mux: probe port %d\n", port)); - set_active_aux_mux_port(kbdc, port); - probe = enable_synaptics(sc, arg); - if (probe) { - if (arg == PROBE) - sc->muxport = port; - break; - } + for (port = 0; port < KBDC_AUX_MUX_NUM_PORTS; port++) { + if ((active_ports_mask & 1 << port) == 0) + continue; + VLOG(3, (LOG_DEBUG, "aux_mux: probe port %d\n", port)); + set_active_aux_mux_port(kbdc, port); + probe = enable_synaptics(sc, arg); + if (probe) { + if (arg == PROBE) + sc->muxport = port; + break; } } @@ -6348,7 +6352,17 @@ enable_synaptics_mux(struct psm_softc *sc, enum probearg arg) } empty_both_buffers(kbdc, 10); /* remove stray data if any */ - return (probe); + /* Don't disable syncbit checks if Synaptics is only device on MUX */ + if (active_ports_count == 1) + sc->muxsinglesyna = probe; + return (active_ports_count != 1 ? probe : FALSE); +} + +static int +enable_single_synaptics_mux(struct psm_softc *sc, enum probearg arg) +{ + /* Synaptics device is already initialized in enable_synaptics_mux */ + return (sc->muxsinglesyna); } static int From owner-dev-commits-src-main@freebsd.org Wed Jul 14 14:33:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A244164CFC0; Wed, 14 Jul 2021 14:33: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 4GQ0Nd3mnCz3p5w; Wed, 14 Jul 2021 14:33: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 6A8E517ABD; Wed, 14 Jul 2021 14:33: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 16EEXLRw071615; Wed, 14 Jul 2021 14:33:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EEXLn1071614; Wed, 14 Jul 2021 14:33:21 GMT (envelope-from git) Date: Wed, 14 Jul 2021 14:33:21 GMT Message-Id: <202107141433.16EEXLn1071614@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: 29c8295312dc - main - loader: small Makefile style change MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 29c8295312dc5eef8a0573bccdacd56167859cb2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 14:33:21 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=29c8295312dc5eef8a0573bccdacd56167859cb2 commit 29c8295312dc5eef8a0573bccdacd56167859cb2 Author: Warner Losh AuthorDate: 2021-07-14 13:54:44 +0000 Commit: Warner Losh CommitDate: 2021-07-14 14:33:01 +0000 loader: small Makefile style change Move to using M.${option} and M.yes to collecting man pages to install. Sponsored by: Netflix --- stand/man/Makefile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/stand/man/Makefile b/stand/man/Makefile index 5dbdc52183bd..d5e7ad791ffb 100644 --- a/stand/man/Makefile +++ b/stand/man/Makefile @@ -2,12 +2,10 @@ .include -.if ${MK_EFI} != "no" -MAN+= boot1.efi.8 -.endif -MAN+= loader.8 -.if ${MK_EFI} != "no" -MAN+= loader.efi.8 -.endif +M.${MK_EFI}+= boot1.efi.8 +M.yes+= loader.8 +M.${MK_EFI}+= loader.efi.8 + +MAN=${M.yes} .include From owner-dev-commits-src-main@freebsd.org Wed Jul 14 18:05:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C9E86653745; Wed, 14 Jul 2021 18:05: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 4GQ55K4vgmz3JLF; Wed, 14 Jul 2021 18:05: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 9079E1AC04; Wed, 14 Jul 2021 18:05: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 16EI5P1A060809; Wed, 14 Jul 2021 18:05:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EI5Pvh060808; Wed, 14 Jul 2021 18:05:25 GMT (envelope-from git) Date: Wed, 14 Jul 2021 18:05:25 GMT Message-Id: <202107141805.16EI5Pvh060808@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: d379886a4170 - main - Filter out LBA formats with LBA Data Size of 0. 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: d379886a4170fa3d95a5354612a5e2c15b104841 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 18:05:25 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=d379886a4170fa3d95a5354612a5e2c15b104841 commit d379886a4170fa3d95a5354612a5e2c15b104841 Author: Alexander Motin AuthorDate: 2021-07-14 18:01:22 +0000 Commit: Alexander Motin CommitDate: 2021-07-14 18:05:20 +0000 Filter out LBA formats with LBA Data Size of 0. According to the spec: "If the value reported is 0h, then LBA format is not supported / used or is not currently available". MFC after: 1 week --- sbin/nvmecontrol/identify.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sbin/nvmecontrol/identify.c b/sbin/nvmecontrol/identify.c index 86b7369883fb..6cd7ad0fdc2d 100644 --- a/sbin/nvmecontrol/identify.c +++ b/sbin/nvmecontrol/identify.c @@ -175,6 +175,8 @@ print_namespace(struct nvme_namespace_data *nsdata) lbaf = nsdata->lbaf[i]; lbads = (lbaf >> NVME_NS_DATA_LBAF_LBADS_SHIFT) & NVME_NS_DATA_LBAF_LBADS_MASK; + if (lbads == 0) + continue; ms = (lbaf >> NVME_NS_DATA_LBAF_MS_SHIFT) & NVME_NS_DATA_LBAF_MS_MASK; rp = (lbaf >> NVME_NS_DATA_LBAF_RP_SHIFT) & From owner-dev-commits-src-main@freebsd.org Wed Jul 14 18:07:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D378A653B0D; Wed, 14 Jul 2021 18:07: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 4GQ57k5Wvyz3JMP; Wed, 14 Jul 2021 18:07: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 A5B121A8CC; Wed, 14 Jul 2021 18:07: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 16EI7UDM061173; Wed, 14 Jul 2021 18:07:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EI7Uup061172; Wed, 14 Jul 2021 18:07:30 GMT (envelope-from git) Date: Wed, 14 Jul 2021 18:07:30 GMT Message-Id: <202107141807.16EI7Uup061172@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 325ff9327459 - main - Clear the accessed bit when copying a managed superpage mapping MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 325ff9327459bc7307130675fa19367ff8b02310 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 18:07:30 -0000 The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=325ff9327459bc7307130675fa19367ff8b02310 commit 325ff9327459bc7307130675fa19367ff8b02310 Author: Alan Cox AuthorDate: 2021-07-13 07:30:43 +0000 Commit: Alan Cox CommitDate: 2021-07-14 18:06:10 +0000 Clear the accessed bit when copying a managed superpage mapping pmap_copy() is used to speculatively create mappings, so those mappings should not have their access bit preset. Reviewed by: kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31162 --- sys/amd64/amd64/pmap.c | 17 ++++++++++++++++- sys/arm64/arm64/pmap.c | 18 ++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 31681e255af1..427fbdf44830 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -7775,6 +7775,9 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, continue; if (srcptepaddr & PG_PS) { + /* + * We can only virtual copy whole superpages. + */ if ((addr & PDRMASK) != 0 || addr + NBPDR > end_addr) continue; pde = pmap_alloc_pde(dst_pmap, addr, &dst_pdpg, NULL); @@ -7783,7 +7786,19 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, if (*pde == 0 && ((srcptepaddr & PG_MANAGED) == 0 || pmap_pv_insert_pde(dst_pmap, addr, srcptepaddr, PMAP_ENTER_NORECLAIM, &lock))) { - *pde = srcptepaddr & ~PG_W; + /* + * We leave the dirty bit unchanged because + * managed read/write superpage mappings are + * required to be dirty. However, managed + * superpage mappings are not required to + * have their accessed bit set, so we clear + * it because we don't know if this mapping + * will be used. + */ + srcptepaddr &= ~PG_W; + if ((srcptepaddr & PG_MANAGED) != 0) + srcptepaddr &= ~PG_A; + *pde = srcptepaddr; pmap_resident_count_adj(dst_pmap, NBPDR / PAGE_SIZE); counter_u64_add(pmap_pde_mappings, 1); diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 8ed1b86bd58c..678feae55c25 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -4557,6 +4557,9 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, if (srcptepaddr == 0) continue; if ((srcptepaddr & ATTR_DESCR_MASK) == L2_BLOCK) { + /* + * We can only virtual copy whole superpages. + */ if ((addr & L2_OFFSET) != 0 || addr + L2_SIZE > end_addr) continue; @@ -4567,8 +4570,19 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, ((srcptepaddr & ATTR_SW_MANAGED) == 0 || pmap_pv_insert_l2(dst_pmap, addr, srcptepaddr, PMAP_ENTER_NORECLAIM, &lock))) { - mask = ATTR_SW_WIRED; - pmap_store(l2, srcptepaddr & ~mask); + /* + * We leave the dirty bit unchanged because + * managed read/write superpage mappings are + * required to be dirty. However, managed + * superpage mappings are not required to + * have their accessed bit set, so we clear + * it because we don't know if this mapping + * will be used. + */ + srcptepaddr &= ~ATTR_SW_WIRED; + if ((srcptepaddr & ATTR_SW_MANAGED) != 0) + srcptepaddr &= ~ATTR_AF; + pmap_store(l2, srcptepaddr); pmap_resident_count_inc(dst_pmap, L2_SIZE / PAGE_SIZE); atomic_add_long(&pmap_l2_mappings, 1); From owner-dev-commits-src-main@freebsd.org Wed Jul 14 19:06:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A07E9654A81; Wed, 14 Jul 2021 19:06: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 4GQ6RG43hvz3jFc; Wed, 14 Jul 2021 19:06: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 730171B79C; Wed, 14 Jul 2021 19:06: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 16EJ62R4041003; Wed, 14 Jul 2021 19:06:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EJ62KZ041002; Wed, 14 Jul 2021 19:06:02 GMT (envelope-from git) Date: Wed, 14 Jul 2021 19:06:02 GMT Message-Id: <202107141906.16EJ62KZ041002@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: dbf1dce8d6d2 - main - For ns identify/delete allow nsid of 0xffffffff. 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: dbf1dce8d6d2d0eedac5402c1f137a80805179ca Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 19:06:02 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=dbf1dce8d6d2d0eedac5402c1f137a80805179ca commit dbf1dce8d6d2d0eedac5402c1f137a80805179ca Author: Alexander Motin AuthorDate: 2021-07-14 18:56:34 +0000 Commit: Alexander Motin CommitDate: 2021-07-14 19:05:56 +0000 For ns identify/delete allow nsid of 0xffffffff. The first should report common parameters, the second should delete all namespaces. MFC after: 1 week --- sbin/nvmecontrol/ns.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sbin/nvmecontrol/ns.c b/sbin/nvmecontrol/ns.c index dd20e4e47967..1da0cf01a69f 100644 --- a/sbin/nvmecontrol/ns.c +++ b/sbin/nvmecontrol/ns.c @@ -198,7 +198,7 @@ static struct delete_options { uint32_t nsid; const char *dev; } delete_opt = { - .nsid = NONE, + .nsid = NONE - 1, .dev = NULL, }; @@ -331,7 +331,7 @@ static struct identify_options { .hex = false, .verbose = false, .dev = NULL, - .nsid = NONE, + .nsid = NONE - 1, }; static const struct opts identify_opts[] = { @@ -639,12 +639,12 @@ nsdelete(const struct cmd *f, int argc, char *argv[]) if (nsid != 0) { close(fd); open_dev(path, &fd, 1, 1); - } else if (delete_opt.nsid == NONE) { + } else if (delete_opt.nsid == NONE - 1) { close(fd); fprintf(stderr, "No NSID specified"); arg_help(argc, argv, f); } - if (delete_opt.nsid != NONE) + if (delete_opt.nsid != NONE - 1) nsid = delete_opt.nsid; free(path); if (read_controller_data(fd, &cd)) @@ -912,12 +912,12 @@ nsidentify(const struct cmd *f, int argc, char *argv[]) if (nsid != 0) { close(fd); open_dev(path, &fd, 1, 1); - } else if (identify_opt.nsid == NONE) { + } else if (identify_opt.nsid == NONE - 1) { close(fd); fprintf(stderr, "No NSID specified"); arg_help(argc, argv, f); } - if (identify_opt.nsid != NONE) + if (identify_opt.nsid != NONE - 1) nsid = identify_opt.nsid; if (read_controller_data(fd, &cd)) errx(EX_IOERR, "Identify request failed"); From owner-dev-commits-src-main@freebsd.org Wed Jul 14 19:48:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F0226552F7; Wed, 14 Jul 2021 19:48: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 4GQ7My5958z3pyR; Wed, 14 Jul 2021 19:48:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9894D1BDC4; Wed, 14 Jul 2021 19:48:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16EJmEfD093838; Wed, 14 Jul 2021 19:48:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EJmEFV093837; Wed, 14 Jul 2021 19:48:14 GMT (envelope-from git) Date: Wed, 14 Jul 2021 19:48:14 GMT Message-Id: <202107141948.16EJmEFV093837@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: d1a0eab9fbc4 - main - Partially revert previous commit. 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: d1a0eab9fbc426ed8cbbddcd90720180c44ce36b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 19:48:15 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=d1a0eab9fbc426ed8cbbddcd90720180c44ce36b commit d1a0eab9fbc426ed8cbbddcd90720180c44ce36b Author: Alexander Motin AuthorDate: 2021-07-14 19:46:22 +0000 Commit: Alexander Motin CommitDate: 2021-07-14 19:46:22 +0000 Partially revert previous commit. ns identify does not allow nsid of 0xffffffff. Only general identify allows it. MFC after: 1 week --- sbin/nvmecontrol/ns.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/nvmecontrol/ns.c b/sbin/nvmecontrol/ns.c index 1da0cf01a69f..5ec6a305b8b9 100644 --- a/sbin/nvmecontrol/ns.c +++ b/sbin/nvmecontrol/ns.c @@ -331,7 +331,7 @@ static struct identify_options { .hex = false, .verbose = false, .dev = NULL, - .nsid = NONE - 1, + .nsid = NONE, }; static const struct opts identify_opts[] = { @@ -912,12 +912,12 @@ nsidentify(const struct cmd *f, int argc, char *argv[]) if (nsid != 0) { close(fd); open_dev(path, &fd, 1, 1); - } else if (identify_opt.nsid == NONE - 1) { + } else if (identify_opt.nsid == NONE) { close(fd); fprintf(stderr, "No NSID specified"); arg_help(argc, argv, f); } - if (identify_opt.nsid != NONE - 1) + if (identify_opt.nsid != NONE) nsid = identify_opt.nsid; if (read_controller_data(fd, &cd)) errx(EX_IOERR, "Identify request failed"); From owner-dev-commits-src-main@freebsd.org Wed Jul 14 20:36:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A379F655CC3; Wed, 14 Jul 2021 20:36: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 4GQ8Rr3Qzlz4RH5; Wed, 14 Jul 2021 20:36: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 5D9561C3C6; Wed, 14 Jul 2021 20:36: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 16EKaeno061048; Wed, 14 Jul 2021 20:36:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EKaeIR061047; Wed, 14 Jul 2021 20:36:40 GMT (envelope-from git) Date: Wed, 14 Jul 2021 20:36:40 GMT Message-Id: <202107142036.16EKaeIR061047@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 7f5508fe78d1 - main - nfscl: Avoid KASSERT() panic in cache_enter_time() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7f5508fe78d17af968fe67e00ffa7c975aa2c67d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 20:36:40 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=7f5508fe78d17af968fe67e00ffa7c975aa2c67d commit 7f5508fe78d17af968fe67e00ffa7c975aa2c67d Author: Rick Macklem AuthorDate: 2021-07-14 20:33:37 +0000 Commit: Rick Macklem CommitDate: 2021-07-14 20:33:37 +0000 nfscl: Avoid KASSERT() panic in cache_enter_time() Commit 844aa31c6d87 added cache_enter_time_flags(), specifically so that the NFS client could specify that cache enter replace any stale entry for the same name. Doing so avoids a KASSERT() panic() in cache_enter_time(), as reported by the PR. This patch uses cache_enter_time_flags() for Readdirplus, to avoid the panic(), since it is impossible for the NFS client to know if another client (or a local process on the NFS server) has replaced a file with another file of the same name. This patch only affects NFS mounts that use the "rdirplus" mount option. There may be other places in the NFS client where this needs to be done, but no panic() has been observed during testing. PR: 257043 MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clrpcops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 213399551097..acc4bc7b9f88 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -3762,11 +3762,11 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, ndp->ni_dvp != ndp->ni_vp && (newvp->v_type != VDIR || dctime.tv_sec != 0)) { - cache_enter_time(ndp->ni_dvp, + cache_enter_time_flags(ndp->ni_dvp, ndp->ni_vp, cnp, &nfsva.na_ctime, newvp->v_type != VDIR ? NULL : - &dctime); + &dctime, VFS_CACHE_DROPOLD); } if (unlocknewvp) vput(newvp); From owner-dev-commits-src-main@freebsd.org Wed Jul 14 22:12:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DA18657489; Wed, 14 Jul 2021 22:12: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 4GQBYv0NY4z4jM4; Wed, 14 Jul 2021 22:12: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 E86591DD31; Wed, 14 Jul 2021 22:12: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 16EMC2WG093196; Wed, 14 Jul 2021 22:12:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EMC28g093195; Wed, 14 Jul 2021 22:12:02 GMT (envelope-from git) Date: Wed, 14 Jul 2021 22:12:02 GMT Message-Id: <202107142212.16EMC28g093195@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: 56d33e86b74b - main - Remove incorrect __restricted labels from strcspn 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: 56d33e86b74b197a36f42255824b56715c96a596 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 22:12:03 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=56d33e86b74b197a36f42255824b56715c96a596 commit 56d33e86b74b197a36f42255824b56715c96a596 Author: Alfonso Gregory AuthorDate: 2021-07-14 21:48:35 +0000 Commit: Warner Losh CommitDate: 2021-07-14 22:11:38 +0000 Remove incorrect __restricted labels from strcspn strcspn should never have had the __restrict keywords. While both of these strings are const, it may have unindended side effects. While this is the kernel, the POSIX definition also omits restrict. Reviewed by: imp@ Pull Request: https://github.com/freebsd/freebsd-src/pull/497 --- sys/libkern/strcspn.c | 2 +- sys/sys/libkern.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/libkern/strcspn.c b/sys/libkern/strcspn.c index fce6d4b8b071..62bfcf78eeb7 100644 --- a/sys/libkern/strcspn.c +++ b/sys/libkern/strcspn.c @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); #define BIT(c) ((u_long)1 << ((u_char)(c) % LONG_BIT)) size_t -strcspn(const char * __restrict s, const char * __restrict charset) +strcspn(const char *s, const char *charset) { /* * NB: idx and bit are temporaries whose use causes gcc 3.4.2 to diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h index c5bd5a07a0b9..37838c99ba0c 100644 --- a/sys/sys/libkern.h +++ b/sys/sys/libkern.h @@ -174,8 +174,8 @@ char *strchr(const char *, int); char *strchrnul(const char *, int); int strcmp(const char *, const char *); char *strcpy(char * __restrict, const char * __restrict); -size_t strcspn(const char * __restrict, const char * __restrict) __pure; char *strdup_flags(const char *__restrict, struct malloc_type *, int); +size_t strcspn(const char *, const char *) __pure; char *strdup(const char *__restrict, struct malloc_type *); char *strncat(char *, const char *, size_t); char *strndup(const char *__restrict, size_t, struct malloc_type *); From owner-dev-commits-src-main@freebsd.org Wed Jul 14 22:36:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0FE16572C9; Wed, 14 Jul 2021 22:36:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQC6X5Nwyz4mry; Wed, 14 Jul 2021 22:36: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 9BF4D1E505; Wed, 14 Jul 2021 22:36: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 16EMaq7G020200; Wed, 14 Jul 2021 22:36:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EMaqdO020199; Wed, 14 Jul 2021 22:36:52 GMT (envelope-from git) Date: Wed, 14 Jul 2021 22:36:52 GMT Message-Id: <202107142236.16EMaqdO020199@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: 13c98cd06b80 - main - loader(8): fix path to be correct loader.4th. 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: 13c98cd06b80afd0d062211ee8f1bfeb8c6cb065 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 22:36:52 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=13c98cd06b80afd0d062211ee8f1bfeb8c6cb065 commit 13c98cd06b80afd0d062211ee8f1bfeb8c6cb065 Author: Warner Losh AuthorDate: 2021-07-14 22:34:43 +0000 Commit: Warner Losh CommitDate: 2021-07-14 22:34:43 +0000 loader(8): fix path to be correct loader.4th. boot.4th was a thing for only a few months around FreeBSD 3.1. The correct name has been loader.4th for a long time. MFC After: 2 days Sponsored by: Netflix --- stand/man/loader.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stand/man/loader.8 b/stand/man/loader.8 index f6e550ae9862..e658b41f8338 100644 --- a/stand/man/loader.8 +++ b/stand/man/loader.8 @@ -76,7 +76,7 @@ is set to 24. Next, .Tn FICL is initialized, the builtin words are added to its vocabulary, and -.Pa /boot/boot.4th +.Pa /boot/loader.4th is processed if it exists. No disk switching is possible while that file is being read. The inner interpreter @@ -982,7 +982,7 @@ Currently, MD is only supported in .It Pa /boot/loader .Nm itself. -.It Pa /boot/boot.4th +.It Pa /boot/loader.4th Additional .Tn FICL initialization. From owner-dev-commits-src-main@freebsd.org Wed Jul 14 23:01:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 856BB6574F9; Wed, 14 Jul 2021 23:01: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 4GQCfS2zB5z4rBx; Wed, 14 Jul 2021 23:01: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 4E4FB1E5BA; Wed, 14 Jul 2021 23:01: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 16EN14Le056787; Wed, 14 Jul 2021 23:01:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EN14Y9056786; Wed, 14 Jul 2021 23:01:04 GMT (envelope-from git) Date: Wed, 14 Jul 2021 23:01:04 GMT Message-Id: <202107142301.16EN14Y9056786@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: 9873c807dac1 - main - loader: Create loader_simp(8) to document simple version of loader 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: 9873c807dac1f8b83b9f7bc9a8d4e318ea295b55 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 23:01:04 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9873c807dac1f8b83b9f7bc9a8d4e318ea295b55 commit 9873c807dac1f8b83b9f7bc9a8d4e318ea295b55 Author: Warner Losh AuthorDate: 2021-07-14 22:43:25 +0000 Commit: Warner Losh CommitDate: 2021-07-14 22:59:51 +0000 loader: Create loader_simp(8) to document simple version of loader loader_simp is a much simplified version of loader that will process a linear sequence of commands from loader.rc. It has neither Forth nor Lua built in and is much smaller. Document it. This is largely copied from loader.8 since it implements those built-in commands. Future revisions will fix this duplication. Sponsored by: Netflix --- stand/man/Makefile | 1 + stand/man/loader_simp.8 | 762 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 763 insertions(+) diff --git a/stand/man/Makefile b/stand/man/Makefile index d5e7ad791ffb..5523908b6814 100644 --- a/stand/man/Makefile +++ b/stand/man/Makefile @@ -5,6 +5,7 @@ M.${MK_EFI}+= boot1.efi.8 M.yes+= loader.8 M.${MK_EFI}+= loader.efi.8 +M.yes+= loader_simp.8 MAN=${M.yes} diff --git a/stand/man/loader_simp.8 b/stand/man/loader_simp.8 new file mode 100644 index 000000000000..689996f244fd --- /dev/null +++ b/stand/man/loader_simp.8 @@ -0,0 +1,762 @@ +.\" Copyright (c) 1999 Daniel C. Sobral +.\" 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. +.\" +.\" $FreeBSD$ +.\" +.Dd July 14, 2021 +.Dt LOADER 8 +.Os +.Sh NAME +.Nm loader +.Nd kernel bootstrapping final stage +.Sh DESCRIPTION +The program called +.Nm +is the final stage of +.Fx Ns 's +kernel bootstrapping process. +On IA32 (i386) architectures, it is a +.Pa BTX +client. +It is linked statically to +.Xr libstand 3 +and usually located in the directory +.Pa /boot . +.Pp +It provides a scripting language that can be used to +automate tasks, do pre-configuration or assist in recovery +procedures. +This scripting language is roughly divided in +two main components. +The smaller one is a set of commands +designed for direct use by the casual user, called "builtin +commands" for historical reasons. +The main drive behind these commands is user-friendliness. +The bigger component is an +.Tn ANS +Forth compatible Forth interpreter based on FICL, by +.An John Sadler . +.Pp +During initialization, +.Nm +will probe for a console and set the +.Va console +variable, or set it to serial console +.Pq Dq Li comconsole +if the previous boot stage used that. +If multiple consoles are selected, they will be listed separated by spaces. +Then, devices are probed, +.Va currdev +and +.Va loaddev +are set, and +.Va LINES +is set to 24. +After that, +.Pa /boot/loader.rc +is processed if available. +These files are processed through the +.Ic include +command, which reads all of them into memory before processing them, +making disk changes possible. +.Pp +At this point, if an +.Ic autoboot +has not been tried, and if +.Va autoboot_delay +is not set to +.Dq Li NO +(not case sensitive), then an +.Ic autoboot +will be tried. +If the system gets past this point, +.Va prompt +will be set and +.Nm +will engage interactive mode. +Please note that historically even when +.Va autoboot_delay +is set to +.Dq Li 0 +user will be able to interrupt autoboot process by pressing some key +on the console while kernel and modules are being loaded. +In some +cases such behaviour may be undesirable, to prevent it set +.Va autoboot_delay +to +.Dq Li -1 , +in this case +.Nm +will engage interactive mode only if +.Ic autoboot +has failed. +.Sh BUILTIN COMMANDS +In +.Nm , +builtin commands take parameters from the command line. +Presently, +the only way to call them from a script is by using +.Pa evaluate +on a string. +If an error condition occurs, an exception will be generated, +which can be intercepted using +.Tn ANS +Forth exception handling +words. +If not intercepted, an error message will be displayed and +the interpreter's state will be reset, emptying the stack and restoring +interpreting mode. +.Pp +The builtin commands available are: +.Pp +.Bl -tag -width Ds -compact +.It Ic autoboot Op Ar seconds Op Ar prompt +Proceeds to bootstrap the system after a number of seconds, if not +interrupted by the user. +Displays a countdown prompt +warning the user the system is about to be booted, +unless interrupted by a key press. +The kernel will be loaded first if necessary. +Defaults to 10 seconds. +.Pp +.It Ic bcachestat +Displays statistics about disk cache usage. +For debugging only. +.Pp +.It Ic boot +.It Ic boot Ar kernelname Op Cm ... +.It Ic boot Fl flag Cm ... +Immediately proceeds to bootstrap the system, loading the kernel +if necessary. +Any flags or arguments are passed to the kernel, but they +must precede the kernel name, if a kernel name is provided. +.Pp +.It Ic echo Xo +.Op Fl n +.Op Aq message +.Xc +Displays text on the screen. +A new line will be printed unless +.Fl n +is specified. +.Pp +.It Ic heap +Displays memory usage statistics. +For debugging purposes only. +.Pp +.It Ic help Op topic Op subtopic +Shows help messages read from +.Pa /boot/loader.help . +The special topic +.Em index +will list the topics available. +.Pp +.It Ic include Ar file Op Ar +Process script files. +Each file, in turn, is completely read into memory, +and then each of its lines is passed to the command line interpreter. +If any error is returned by the interpreter, the include +command aborts immediately, without reading any other files, and +returns an error itself (see +.Sx ERRORS ) . +.Pp +.It Ic load Xo +.Op Fl t Ar type +.Ar file Cm ... +.Xc +Loads a kernel, kernel loadable module (kld), disk image, +or file of opaque contents tagged as being of the type +.Ar type . +Kernel and modules can be either in a.out or ELF format. +Any arguments passed after the name of the file to be loaded +will be passed as arguments to that file. +Use the +.Li md_image +type to make the kernel create a file-backed +.Xr md 4 +disk. +This is useful for booting from a temporary rootfs. +Currently, argument passing does not work for the kernel. +.Pp +.It Ic load_geli Xo +.Op Fl n Ar keyno +.Ar prov Ar file +.Xc +Loads a +.Xr geli 8 +encryption keyfile for the given provider name. +The key index can be specified via +.Ar keyno +or will default to zero. +.Pp +.It Ic ls Xo +.Op Fl l +.Op Ar path +.Xc +Displays a listing of files in the directory +.Ar path , +or the root directory if +.Ar path +is not specified. +If +.Fl l +is specified, file sizes will be shown too. +.Pp +.It Ic lsdev Op Fl v +Lists all of the devices from which it may be possible to load modules, +as well as ZFS pools. +If +.Fl v +is specified, more details are printed, including ZFS pool information +in a format that resembles +.Nm zpool Cm status +output. +.Pp +.It Ic lsmod Op Fl v +Displays loaded modules. +If +.Fl v +is specified, more details are shown. +.Pp +.It Ic lszfs Ar filesystem +A ZFS extended command that can be used to explore the ZFS filesystem +hierarchy in a pool. +Lists the immediate children of the +.Ar filesystem . +The filesystem hierarchy is rooted at a filesystem with the same name +as the pool. +.Pp +.It Ic more Ar file Op Ar +Display the files specified, with a pause at each +.Va LINES +displayed. +.Pp +.It Ic pnpscan Op Fl v +Scans for Plug-and-Play devices. +This is not functional at present. +.Pp +.It Ic read Xo +.Op Fl t Ar seconds +.Op Fl p Ar prompt +.Op Va variable +.Xc +Reads a line of input from the terminal, storing it in +.Va variable +if specified. +A timeout can be specified with +.Fl t , +though it will be canceled at the first key pressed. +A prompt may also be displayed through the +.Fl p +flag. +.Pp +.It Ic reboot +Immediately reboots the system. +.Pp +.It Ic set Ar variable +.It Ic set Ar variable Ns = Ns Ar value +Set loader's environment variables. +.Pp +.It Ic show Op Va variable +Displays the specified variable's value, or all variables and their +values if +.Va variable +is not specified. +.Pp +.It Ic unload +Remove all modules from memory. +.Pp +.It Ic unset Va variable +Removes +.Va variable +from the environment. +.Pp +.It Ic \&? +Lists available commands. +.El +.Ss BUILTIN ENVIRONMENT VARIABLES +The +.Nm +has actually two different kinds of +.Sq environment +variables. +There are ANS Forth's +.Em environmental queries , +and a separate space of environment variables used by builtins, which +are not directly available to Forth words. +It is the latter type that this section covers. +.Pp +Environment variables can be set and unset through the +.Ic set +and +.Ic unset +builtins, and can have their values interactively examined through the +use of the +.Ic show +builtin. +Their values can also be accessed as described in +.Sx BUILTIN PARSER . +.Pp +Notice that these environment variables are not inherited by any shell +after the system has been booted. +.Pp +A few variables are set automatically by +.Nm . +Others can affect the behavior of either +.Nm +or the kernel at boot. +Some options may require a value, +while others define behavior just by being set. +Both types of builtin variables are described below. +.Bl -tag -width bootfile +.It Va autoboot_delay +Number of seconds +.Ic autoboot +will wait before booting. +Configuration options are described in +.Xr loader.conf 5 . +.It Va boot_askname +Instructs the kernel to prompt the user for the name of the root device +when the kernel is booted. +.It Va boot_cdrom +Instructs the kernel to try to mount the root file system from CD-ROM. +.It Va boot_ddb +Instructs the kernel to start in the DDB debugger, rather than +proceeding to initialize when booted. +.It Va boot_dfltroot +Instructs the kernel to mount the statically compiled-in root file system. +.It Va boot_gdb +Selects gdb-remote mode for the kernel debugger by default. +.It Va boot_multicons +Enables multiple console support in the kernel early on boot. +In a running system, console configuration can be manipulated +by the +.Xr conscontrol 8 +utility. +.It Va boot_mute +All kernel console output is suppressed when console is muted. +In a running system, the state of console muting can be manipulated by the +.Xr conscontrol 8 +utility. +.It Va boot_pause +During the device probe, pause after each line is printed. +.It Va boot_serial +Force the use of a serial console even when an internal console +is present. +.It Va boot_single +Prevents the kernel from initiating a multi-user startup; instead, +a single-user mode will be entered when the kernel has finished +device probing. +.It Va boot_verbose +Setting this variable causes extra debugging information to be printed +by the kernel during the boot phase. +.It Va bootfile +List of semicolon-separated search path for bootable kernels. +The default is +.Dq Li kernel . +.It Va comconsole_speed +Defines the speed of the serial console (i386 and amd64 only). +If the previous boot stage indicated that a serial console is in use +then this variable is initialized to the current speed of the console +serial port. +Otherwise it is set to 9600 unless this was overridden using the +.Va BOOT_COMCONSOLE_SPEED +variable when +.Nm +was compiled. +Changes to the +.Va comconsole_speed +variable take effect immediately. +.It Va comconsole_port +Defines the base i/o port used to access console UART +(i386 and amd64 only). +If the variable is not set, its assumed value is 0x3F8, which +corresponds to PC port COM1, unless overridden by +.Va BOOT_COMCONSOLE_PORT +variable during the compilation of +.Nm . +Setting the +.Va comconsole_port +variable automatically set +.Va hw.uart.console +environment variable to provide a hint to kernel for location of the console. +Loader console is changed immediately after variable +.Va comconsole_port +is set. +.It Va comconsole_pcidev +Defines the location of a PCI device of the 'simple communication' +class to be used as the serial console UART (i386 and amd64 only). +The syntax of the variable is +.Li 'bus:device:function[:bar]' , +where all members must be numeric, with possible +.Li 0x +prefix to indicate a hexadecimal value. +The +.Va bar +member is optional and assumed to be 0x10 if omitted. +The bar must decode i/o space. +Setting the variable +.Va comconsole_pcidev +automatically sets the variable +.Va comconsole_port +to the base of the selected bar, and hint +.Va hw.uart.console . +Loader console is changed immediately after variable +.Va comconsole_pcidev +is set. +.It Va console +Defines the current console or consoles. +Multiple consoles may be specified. +In that case, the first listed console will become the default console for +userland output (e.g.\& from +.Xr init 8 ) . +.It Va currdev +Selects the default device to loader the kernel from. +The syntax is: +.Dl Ic loader_device: +or +.Dl Ic zfs:dataset: +Examples: +.Dl Ic disk0p2: +.Dl Ic zfs:zroot/ROOT/default: +.It Va dumpdev +Sets the device for kernel dumps. +This can be used to ensure that a device is configured before the corresponding +.Va dumpdev +directive from +.Xr rc.conf 5 +has been processed, allowing kernel panics that happen during the early stages +of boot to be captured. +.It Va init_chroot +See +.Xr init 8 . +.It Va init_exec +See +.Xr init 8 . +.It Va init_path +Sets the list of binaries which the kernel will try to run as the initial +process. +The first matching binary is used. +The default list is +.Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init . +.It Va init_script +See +.Xr init 8 . +.It Va init_shell +See +.Xr init 8 . +.It Va interpret +Has the value +.Dq Li OK +if the Forth's current state is interpreting. +.It Va LINES +Define the number of lines on the screen, to be used by the pager. +.It Va module_path +Sets the list of directories which will be searched for modules +named in a load command or implicitly required by a dependency. +The default value for this variable is +.Dq Li /boot/kernel;/boot/modules . +.It Va num_ide_disks +Sets the number of IDE disks as a workaround for some problems in +finding the root disk at boot. +This has been deprecated in favor of +.Va root_disk_unit . +.It Va prompt +Value of +.Nm Ns 's +prompt. +Defaults to +.Dq Li "${interpret}" . +If variable +.Va prompt +is unset, the default prompt is +.Ql > . +.It Va root_disk_unit +If the code which detects the disk unit number for the root disk is +confused, e.g.\& by a mix of SCSI and IDE disks, or IDE disks with +gaps in the sequence (e.g.\& no primary slave), the unit number can +be forced by setting this variable. +.It Va rootdev +By default the value of +.Va currdev +is used to set the root file system +when the kernel is booted. +This can be overridden by setting +.Va rootdev +explicitly. +.El +.Pp +Other variables are used to override kernel tunable parameters. +The following tunables are available: +.Bl -tag -width Va +.It Va efi.rt.disabled +Disable UEFI runtime services in the kernel, if applicable. +Runtime services are only available and used if the kernel is booted in a UEFI +environment. +.It Va hw.physmem +Limit the amount of physical memory the system will use. +By default the size is in bytes, but the +.Cm k , K , m , M , g +and +.Cm G +suffixes +are also accepted and indicate kilobytes, megabytes and gigabytes +respectively. +An invalid suffix will result in the variable being ignored by the +kernel. +.It Va hw.pci.host_start_mem , hw.acpi.host_start_mem +When not otherwise constrained, this limits the memory start +address. +The default is 0x80000000 and should be set to at least size of the +memory and not conflict with other resources. +Typically, only systems without PCI bridges need to set this variable +since PCI bridges typically constrain the memory starting address +(and the variable is only used when bridges do not constrain this +address). +.It Va hw.pci.enable_io_modes +Enable PCI resources which are left off by some BIOSes or are not +enabled correctly by the device driver. +Tunable value set to ON (1) by default, but this may cause problems +with some peripherals. +.It Va kern.maxusers +Set the size of a number of statically allocated system tables; see +.Xr tuning 7 +for a description of how to select an appropriate value for this +tunable. +When set, this tunable replaces the value declared in the kernel +compile-time configuration file. +.It Va kern.ipc.nmbclusters +Set the number of mbuf clusters to be allocated. +The value cannot be set below the default +determined when the kernel was compiled. +.It Va kern.ipc.nsfbufs +Set the number of +.Xr sendfile 2 +buffers to be allocated. +Overrides +.Dv NSFBUFS . +Not all architectures use such buffers; see +.Xr sendfile 2 +for details. +.It Va kern.maxswzone +Limits the amount of KVM to be used to hold swap +metadata, which directly governs the +maximum amount of swap the system can support, +at the rate of approximately 200 MB of swap space +per 1 MB of metadata. +This value is specified in bytes of KVA space. +If no value is provided, the system allocates +enough memory to handle an amount of swap +that corresponds to eight times the amount of +physical memory present in the system. +.Pp +Note that swap metadata can be fragmented, +which means that the system can run out of +space before it reaches the theoretical limit. +Therefore, care should be taken to not configure +more swap than approximately half of the +theoretical maximum. +.Pp +Running out of space for swap metadata can leave +the system in an unrecoverable state. +Therefore, you should only change +this parameter if you need to greatly extend the +KVM reservation for other resources such as the +buffer cache or +.Va kern.ipc.nmbclusters . +Modifies kernel option +.Dv VM_SWZONE_SIZE_MAX . +.It Va kern.maxbcache +Limits the amount of KVM reserved for use by the +buffer cache, specified in bytes. +The default maximum is 200MB on i386, +and 400MB on amd64. +This parameter is used to +prevent the buffer cache from eating too much +KVM in large-memory machine configurations. +Only mess around with this parameter if you need to +greatly extend the KVM reservation for other resources +such as the swap zone or +.Va kern.ipc.nmbclusters . +Note that +the NBUF parameter will override this limit. +Modifies +.Dv VM_BCACHE_SIZE_MAX . +.It Va kern.msgbufsize +Sets the size of the kernel message buffer. +The default limit of 96KB is usually sufficient unless +large amounts of trace data need to be collected +between opportunities to examine the buffer or +dump it to a file. +Overrides kernel option +.Dv MSGBUF_SIZE . +.It Va machdep.disable_mtrrs +Disable the use of i686 MTRRs (x86 only). +.It Va net.inet.tcp.tcbhashsize +Overrides the compile-time set value of +.Dv TCBHASHSIZE +or the preset default of 512. +Must be a power of 2. +.It Va twiddle_divisor +Throttles the output of the +.Sq twiddle +I/O progress indicator displayed while loading the kernel and modules. +This is useful on slow serial consoles where the time spent waiting for +these characters to be written can add up to many seconds. +The default is 1 (full speed); a value of 2 spins half as fast, and so on. +.It Va vm.kmem_size +Sets the size of kernel memory (bytes). +This overrides the value determined when the kernel was compiled. +Modifies +.Dv VM_KMEM_SIZE . +.It Va vm.kmem_size_min +.It Va vm.kmem_size_max +Sets the minimum and maximum (respectively) amount of kernel memory +that will be automatically allocated by the kernel. +These override the values determined when the kernel was compiled. +Modifies +.Dv VM_KMEM_SIZE_MIN +and +.Dv VM_KMEM_SIZE_MAX . +.El +.Ss ZFS FEATURES +.Nm +supports the following format for specifying ZFS filesystems which +can be used wherever +.Xr loader 8 +refers to a device specification: +.Pp +.Ar zfs:pool/filesystem: +.Pp +where +.Pa pool/filesystem +is a ZFS filesystem name as described in +.Xr zfs 8 . +.Pp +If +.Pa /etc/fstab +does not have an entry for the root filesystem and +.Va vfs.root.mountfrom +is not set, but +.Va currdev +refers to a ZFS filesystem, then +.Nm +will instruct kernel to use that filesystem as the root filesystem. +.Sh SECURITY +Access to the +.Nm +command line provides several ways of compromising system security, +including, but not limited to: +.Pp +.Bl -bullet +.It +Booting from removable storage. +.Pp +One can prevent unauthorized access +to the +.Nm +command line by booting unconditionally in +.Pa loader.rc . +In order for this to be effective, one should also configure the firmware +(BIOS or UEFI) to prevent booting from unauthorized devices. +.Sh FILES +.Bl -tag -width /boot/loader_simp -compact +.It Pa /boot/loader_simp +.Nm +itself. +.It Pa /boot/loader.rc +The script run by +.Nm +on startup. +.Sh EXAMPLES +Boot in single user mode: +.Pp +.Dl boot -s +.Pp +Load the kernel, a splash screen, and then autoboot in five seconds. +Notice that a kernel must be loaded before any other +.Ic load +command is attempted. +.Bd -literal -offset indent +load kernel +load splash_bmp +load -t splash_image_data /boot/chuckrulez.bmp +autoboot 5 +.Ed +.Pp +Set the disk unit of the root device to 2, and then boot. +This would be needed in a system with two IDE disks, +with the second IDE disk hardwired to ada2 instead of ada1. +.Bd -literal -offset indent +set root_disk_unit=2 +boot /boot/kernel/kernel +.Ed +.Pp +Set the default device used for loading a kernel from a ZFS filesystem: +.Bd -literal -offset indent +set currdev=zfs:tank/ROOT/knowngood: +.Ed +.Pp +.Sh ERRORS +The following values are thrown by +.Nm : +.Bl -tag -width XXXXX -offset indent +.It 100 +Any type of error in the processing of a builtin. +.It -1 +.Ic Abort +executed. +.It -2 +.Ic Abort" +executed. +.It -56 +.Ic Quit +executed. +.It -256 +Out of interpreting text. +.It -257 +Need more text to succeed -- will finish on next run. +.It -258 +.Ic Bye +executed. +.It -259 +Unspecified error. +.El +.Sh SEE ALSO +.Xr libstand 3 , +.Xr loader.conf 5 , +.Xr tuning 7 , +.Xr boot 8 , +.Xr btxld 8 +.Sh HISTORY +The +.Nm +first appeared in +.Fx 3.1 . +.Sh AUTHORS +.An -nosplit +The +.Nm +was written by +.An Michael Smith Aq msmith@FreeBSD.org . From owner-dev-commits-src-main@freebsd.org Thu Jul 15 00:03:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 474BE65A688; Thu, 15 Jul 2021 00:03: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 4GQF290HnYz3JxV; Thu, 15 Jul 2021 00:03: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 E345A1F790; Thu, 15 Jul 2021 00:03:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16F03COU039140; Thu, 15 Jul 2021 00:03:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16F03CFl039139; Thu, 15 Jul 2021 00:03:12 GMT (envelope-from git) Date: Thu, 15 Jul 2021 00:03:12 GMT Message-Id: <202107150003.16F03CFl039139@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: 0bdb2cbf9d7c - main - procctl(PROC_ASLR_STATUS): fix vmspace leak 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: 0bdb2cbf9d7c4366a0668b4563c8630538a50086 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 00:03:13 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0bdb2cbf9d7c4366a0668b4563c8630538a50086 commit 0bdb2cbf9d7c4366a0668b4563c8630538a50086 Author: Konstantin Belousov AuthorDate: 2021-07-14 23:40:04 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-15 00:02:50 +0000 procctl(PROC_ASLR_STATUS): fix vmspace leak Reported by: jhb Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/kern/kern_procctl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 4eb226c6b1b3..68fa4bc0c3ac 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -530,8 +530,9 @@ aslr_status(struct thread *td, struct proc *p, int *data) _PHOLD(p); PROC_UNLOCK(p); vm = vmspace_acquire_ref(p); - if (vm != NULL && (vm->vm_map.flags & MAP_ASLR) != 0) { - d |= PROC_ASLR_ACTIVE; + if (vm != NULL) { + if ((vm->vm_map.flags & MAP_ASLR) != 0) + d |= PROC_ASLR_ACTIVE; vmspace_free(vm); } PROC_LOCK(p); From owner-dev-commits-src-main@freebsd.org Thu Jul 15 00:55:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4CB3565B916; Thu, 15 Jul 2021 00:55: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 4GQGBK1khtz3k5C; Thu, 15 Jul 2021 00:55: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 24A1C201C4; Thu, 15 Jul 2021 00:55: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 16F0tLsW005770; Thu, 15 Jul 2021 00:55:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16F0tLud005769; Thu, 15 Jul 2021 00:55:21 GMT (envelope-from git) Date: Thu, 15 Jul 2021 00:55:21 GMT Message-Id: <202107150055.16F0tLud005769@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Neel Chauhan Subject: git: f39d9c913185 - main - libkern: import strnstr from libc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f39d9c91318569a1ab7507d46e15147f5fef659e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 00:55:21 -0000 The branch main has been updated by nc (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=f39d9c91318569a1ab7507d46e15147f5fef659e commit f39d9c91318569a1ab7507d46e15147f5fef659e Author: Greg V AuthorDate: 2021-07-15 00:52:32 +0000 Commit: Neel Chauhan CommitDate: 2021-07-15 00:55:08 +0000 libkern: import strnstr from libc Required for drm-kmod 5.6 (amdgpu). Reviewed by: bz, hselasky, nc Differential Revision: https://reviews.freebsd.org/D31131 --- sys/conf/files | 1 + sys/sys/libkern.h | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/conf/files b/sys/conf/files index 245bbcb01374..ee1e356d9f61 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4099,6 +4099,7 @@ libkern/strncat.c standard libkern/strncmp.c standard libkern/strncpy.c standard libkern/strnlen.c standard +libkern/strnstr.c standard libkern/strrchr.c standard libkern/strsep.c standard libkern/strspn.c standard diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h index 37838c99ba0c..d8d3dce1b705 100644 --- a/sys/sys/libkern.h +++ b/sys/sys/libkern.h @@ -186,6 +186,7 @@ int strncasecmp(const char *, const char *, size_t); int strncmp(const char *, const char *, size_t); char *strncpy(char * __restrict, const char * __restrict, size_t); size_t strnlen(const char *, size_t); +char *strnstr(const char *, const char *, size_t); char *strrchr(const char *, int); char *strsep(char **, const char *delim); size_t strspn(const char *, const char *); From owner-dev-commits-src-main@freebsd.org Thu Jul 15 00:56:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0450C65B556; Thu, 15 Jul 2021 00:56: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 4GQGCl6d0Wz3kG7; Thu, 15 Jul 2021 00:56: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 C8F5C1FF3A; Thu, 15 Jul 2021 00:56: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 16F0uZOp005962; Thu, 15 Jul 2021 00:56:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16F0uZC5005961; Thu, 15 Jul 2021 00:56:35 GMT (envelope-from git) Date: Thu, 15 Jul 2021 00:56:35 GMT Message-Id: <202107150056.16F0uZC5005961@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Neel Chauhan Subject: git: 4211457e40e0 - main - Add missing libkern/strnstr.c file MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4211457e40e07f6f820c4171c7db81f028fd23af Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 00:56:36 -0000 The branch main has been updated by nc (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=4211457e40e07f6f820c4171c7db81f028fd23af commit 4211457e40e07f6f820c4171c7db81f028fd23af Author: Greg V AuthorDate: 2021-07-15 00:56:03 +0000 Commit: Neel Chauhan CommitDate: 2021-07-15 00:56:03 +0000 Add missing libkern/strnstr.c file Apparently it wasn't picked up by git. Reviewed by: bz, hselasky, nc Differential Revision: https://reviews.freebsd.org/D31131 --- sys/libkern/strnstr.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/sys/libkern/strnstr.c b/sys/libkern/strnstr.c new file mode 100644 index 000000000000..9183e2a7017d --- /dev/null +++ b/sys/libkern/strnstr.c @@ -0,0 +1,64 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2001 Mike Barcroft + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * 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 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. + */ + +#include + +#include +#include + +/* + * Find the first occurrence of find in s, where the search is limited to the + * first slen characters of s. + */ +char * +strnstr(const char *s, const char *find, size_t slen) +{ + char c, sc; + size_t len; + + if ((c = *find++) != '\0') { + len = strlen(find); + do { + do { + if (slen-- < 1 || (sc = *s++) == '\0') + return (NULL); + } while (sc != c); + if (len > slen) + return (NULL); + } while (strncmp(s, find, len) != 0); + s--; + } + return (__DECONST(char *, s)); +} From owner-dev-commits-src-main@freebsd.org Thu Jul 15 01:58:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB29C65C29F; Thu, 15 Jul 2021 01:58:28 +0000 (UTC) (envelope-from danfe@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 4GQHb84G1Qz4RYY; Thu, 15 Jul 2021 01:58:28 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1626314308; 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=YZmk1O7a7ite2IOEbpP7l79iHH7AEcA0ijfBEQVHPf0=; b=WqO7gszthL9XQa4+hxjfq8tjDORh01Jhd3dolf46iw79o2uD+pnDa3cmfzETEYkvjxnXhJ NDDwWWJGzbwksWGfkms7VpG6AvLd6bwdmuqKyFieSiX9/ko7S93EKTu+pb54wzWuoKEaZm 4fg05eqbziuL7DqZ5Fm2vnhApBQLXCB58OqZFOt3Lu92KpWKYKznuXQEf9tzfe8ilEl3iW n5uHAzXAVeZ8eQ5dLrfwqO1VslyuK/8rTkB4gk+NjKIfgTJ8DJ0aN9FxvaLd75JXAbljFg 7iSgXwGlJi0JrZqSkBF1P3hCgIgyvL9Q0yUjBct07OE4qvmMMJk5mmxTonolLw== Received: by freefall.freebsd.org (Postfix, from userid 1033) id 7F4A075C; Thu, 15 Jul 2021 01:58:28 +0000 (UTC) Date: Thu, 15 Jul 2021 01:58:28 +0000 From: Alexey Dokuchaev To: Neel Chauhan Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 4211457e40e0 - main - Add missing libkern/strnstr.c file Message-ID: References: <202107150056.16F0uZC5005961@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202107150056.16F0uZC5005961@gitrepo.freebsd.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1626314308; 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=YZmk1O7a7ite2IOEbpP7l79iHH7AEcA0ijfBEQVHPf0=; b=w9MuIpZbIh83IuLBzba5d2GZ3oI7wrgm/TX/xJGevmfWHSldriMA/WhVv/WNcSvLzFj9mM lgPeSBlMSj/TI0qH/UEC1AEcZGSQ0Rhd2i/612cFNoJ5cxyCavdgoQUuqB8kUNjYLY8cXj 8bioJr3Dyu3zTQz1263qjpNt4wmj1UZDMZk+emqXZTjnVgPl6YV2lYMo+7y673W9VgSDGW SpD6hWUXHZsyCeEEOVvJTXr044jX5G0AuB18yozXUUVOmu2FHqqkPZvmtdgiWYOkIvUWUx G8v00y4sapXEeXZecufZOvO1pXB6jJtdeq6dm9VW14+CZTFnrPGh2MyZDZb/OA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1626314308; a=rsa-sha256; cv=none; b=OR4GPPjfpV5pqXBAawvXmmxuLnZE9ZPUmme3R4kqlBU4eUw3XTcO3QLkiUGBsk4mFrWceC Lo1ZLJCyADz0z97/uw9akzUZTlw0/CL6ZEj4T/PBPs6Vrk1BsKSyT51JvFbaGtrIu1j8SM ueqj/7NAEMeQZLefyxCZTEgQh7N3UpGh7+1TvUP4dsImGm2Uq+3acuyFQQTfkkfEbUyDsx jTCSmphKkDhNc0ylcVKZXpQu/7GSE3gG7d648QkNaonUODUXUiy8Wik3g0t4039e0U2Y2K VZMFgg6Ado9Md5nWDL5psZcmow/eRBV8UvHvMupNslyVUMksFzCWxtkzcOtzQg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 01:58:28 -0000 On Thu, Jul 15, 2021 at 12:56:35AM +0000, Neel Chauhan wrote: > commit 4211457e40e07f6f820c4171c7db81f028fd23af > > Add missing libkern/strnstr.c file > > Apparently it wasn't picked up by git. That's why you first commit, then "git show HEAD" to see that commit is correct, and only then "git push freebsd". ./danfe From owner-dev-commits-src-main@freebsd.org Thu Jul 15 03:07:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB89F65D4A0; Thu, 15 Jul 2021 03:07: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 4GQK6K3GJ8z4crl; Thu, 15 Jul 2021 03:07: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 5242821F86; Thu, 15 Jul 2021 03:07: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 16F375eK079111; Thu, 15 Jul 2021 03:07:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16F375L7079110; Thu, 15 Jul 2021 03:07:05 GMT (envelope-from git) Date: Thu, 15 Jul 2021 03:07:05 GMT Message-Id: <202107150307.16F375L7079110@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: 7a0c0ff7ee25 - main - loader: make sure CPUTYPE is ignored when building 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: 7a0c0ff7ee25ff1efa3dbedcb20d2c80178639cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 03:07:05 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7a0c0ff7ee25ff1efa3dbedcb20d2c80178639cc commit 7a0c0ff7ee25ff1efa3dbedcb20d2c80178639cc Author: Warner Losh AuthorDate: 2021-07-15 03:06:08 +0000 Commit: Warner Losh CommitDate: 2021-07-15 03:06:19 +0000 loader: make sure CPUTYPE is ignored when building CPUTYPE?=native causes -march=native to be added to the command line. When the host machine is haswell, this causes some versions of clang to generate code that can't execute in the efi boot loader environment. Set _CPUCFLAGS= to undo what's done bsd.cpu.mk. bsd.cpu.mk is included too early to control with NO_CPU_CFLAGS here. The only other option is to put that in all the Makefiles, and this is less tedious and error prone. PR: 194641 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31187 MFC After: 1 week --- stand/defs.mk | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/stand/defs.mk b/stand/defs.mk index 54b7a7250c48..d50c89879613 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -15,6 +15,14 @@ MAN= NO_PIC= INTERNALLIB= .endif +# Should be NO_CPU_FLAGS, but bsd.cpu.mk is included too early in bsd.init.mk +# via the early include of bsd.opts.mk. Moving Makefile.inc include earlier in +# that file causes weirdness, so this is the next best thing. We need to do this +# because the loader needs very specific flags to work right, and things like +# CPUTYPE?=native prevent that, and introduce an endless game of whack-a-mole +# to disable more and more features. Boot loader performance is never improved +# enough to make that hassle worth chasing. +_CPUCFLAGS= .include .include From owner-dev-commits-src-main@freebsd.org Thu Jul 15 09:22:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7CE4662A19; Thu, 15 Jul 2021 09: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 4GQTRW491gz3vjr; Thu, 15 Jul 2021 09: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 756B92712A; Thu, 15 Jul 2021 09: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 16F9MViO086257; Thu, 15 Jul 2021 09: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 16F9MVoT086256; Thu, 15 Jul 2021 09:22:31 GMT (envelope-from git) Date: Thu, 15 Jul 2021 09:22:31 GMT Message-Id: <202107150922.16F9MVoT086256@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: 3c1bfadaf93d - main - Update the arm64 HCR_EL2 registers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3c1bfadaf93da6ec0291a7dc7dc7690ef6611619 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 09:22:31 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=3c1bfadaf93da6ec0291a7dc7dc7690ef6611619 commit 3c1bfadaf93da6ec0291a7dc7dc7690ef6611619 Author: Andrew Turner AuthorDate: 2021-07-07 11:51:40 +0000 Commit: Andrew Turner CommitDate: 2021-07-14 19:28:16 +0000 Update the arm64 HCR_EL2 registers They are valid as of the ARMv8.7 XML. While here switch to use shifted values as they are easier to compare with values in the Arm Reference Manual. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31093 --- sys/arm64/include/hypervisor.h | 113 ++++++++++++++++++++++++----------------- 1 file changed, 66 insertions(+), 47 deletions(-) diff --git a/sys/arm64/include/hypervisor.h b/sys/arm64/include/hypervisor.h index eab43b29a89e..e8599cb30f3f 100644 --- a/sys/arm64/include/hypervisor.h +++ b/sys/arm64/include/hypervisor.h @@ -1,6 +1,9 @@ /*- * Copyright (c) 2013, 2014 Andrew Turner - * All rights reserved. + * Copyright (c) 2021 The FreeBSD Foundation + * + * Portions of this software were developed by Andrew Turner + * under sponsorship from the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -49,53 +52,69 @@ #define CPTR_TCPAC 0x80000000 /* HCR_EL2 - Hypervisor Config Register */ -#define HCR_VM 0x0000000000000001 -#define HCR_SWIO 0x0000000000000002 -#define HCR_PTW 0x0000000000000004 -#define HCR_FMO 0x0000000000000008 -#define HCR_IMO 0x0000000000000010 -#define HCR_AMO 0x0000000000000020 -#define HCR_VF 0x0000000000000040 -#define HCR_VI 0x0000000000000080 -#define HCR_VSE 0x0000000000000100 -#define HCR_FB 0x0000000000000200 -#define HCR_BSU_MASK 0x0000000000000c00 -#define HCR_BSU_IS 0x0000000000000400 -#define HCR_BSU_OS 0x0000000000000800 -#define HCR_BSU_FS 0x0000000000000c00 -#define HCR_DC 0x0000000000001000 -#define HCR_TWI 0x0000000000002000 -#define HCR_TWE 0x0000000000004000 -#define HCR_TID0 0x0000000000008000 -#define HCR_TID1 0x0000000000010000 -#define HCR_TID2 0x0000000000020000 -#define HCR_TID3 0x0000000000040000 -#define HCR_TSC 0x0000000000080000 -#define HCR_TIDCP 0x0000000000100000 -#define HCR_TACR 0x0000000000200000 -#define HCR_TSW 0x0000000000400000 -#define HCR_TPCP 0x0000000000800000 -#define HCR_TPU 0x0000000001000000 -#define HCR_TTLB 0x0000000002000000 -#define HCR_TVM 0x0000000004000000 -#define HCR_TGE 0x0000000008000000 -#define HCR_TDZ 0x0000000010000000 -#define HCR_HCD 0x0000000020000000 -#define HCR_TRVM 0x0000000040000000 -#define HCR_RW 0x0000000080000000 -#define HCR_CD 0x0000000100000000 -#define HCR_ID 0x0000000200000000 -#define HCR_E2H 0x0000000400000000 -#define HCR_TLOR 0x0000000800000000 -#define HCR_TERR 0x0000001000000000 -#define HCR_TEA 0x0000002000000000 -#define HCR_MIOCNCE 0x0000004000000000 +#define HCR_VM (UL(0x1) << 0) +#define HCR_SWIO (UL(0x1) << 1) +#define HCR_PTW (UL(0x1) << 2) +#define HCR_FMO (UL(0x1) << 3) +#define HCR_IMO (UL(0x1) << 4) +#define HCR_AMO (UL(0x1) << 5) +#define HCR_VF (UL(0x1) << 6) +#define HCR_VI (UL(0x1) << 7) +#define HCR_VSE (UL(0x1) << 8) +#define HCR_FB (UL(0x1) << 9) +#define HCR_BSU_MASK (UL(0x3) << 10) +#define HCR_BSU_IS (UL(0x1) << 10) +#define HCR_BSU_OS (UL(0x2) << 10) +#define HCR_BSU_FS (UL(0x3) << 10) +#define HCR_DC (UL(0x1) << 12) +#define HCR_TWI (UL(0x1) << 13) +#define HCR_TWE (UL(0x1) << 14) +#define HCR_TID0 (UL(0x1) << 15) +#define HCR_TID1 (UL(0x1) << 16) +#define HCR_TID2 (UL(0x1) << 17) +#define HCR_TID3 (UL(0x1) << 18) +#define HCR_TSC (UL(0x1) << 19) +#define HCR_TIDCP (UL(0x1) << 20) +#define HCR_TACR (UL(0x1) << 21) +#define HCR_TSW (UL(0x1) << 22) +#define HCR_TPCP (UL(0x1) << 23) +#define HCR_TPU (UL(0x1) << 24) +#define HCR_TTLB (UL(0x1) << 25) +#define HCR_TVM (UL(0x1) << 26) +#define HCR_TGE (UL(0x1) << 27) +#define HCR_TDZ (UL(0x1) << 28) +#define HCR_HCD (UL(0x1) << 29) +#define HCR_TRVM (UL(0x1) << 30) +#define HCR_RW (UL(0x1) << 31) +#define HCR_CD (UL(0x1) << 32) +#define HCR_ID (UL(0x1) << 33) +#define HCR_E2H (UL(0x1) << 34) +#define HCR_TLOR (UL(0x1) << 35) +#define HCR_TERR (UL(0x1) << 36) +#define HCR_TEA (UL(0x1) << 37) +#define HCR_MIOCNCE (UL(0x1) << 38) /* Bit 39 is reserved */ -#define HCR_APK 0x0000010000000000 -#define HCR_API 0x0000020000000000 -#define HCR_NV 0x0000040000000000 -#define HCR_NV1 0x0000080000000000 -#define HCR_AT 0x0000100000000000 +#define HCR_APK (UL(0x1) << 40) +#define HCR_API (UL(0x1) << 41) +#define HCR_NV (UL(0x1) << 42) +#define HCR_NV1 (UL(0x1) << 43) +#define HCR_AT (UL(0x1) << 44) +#define HCR_NV2 (UL(0x1) << 45) +#define HCR_FWB (UL(0x1) << 46) +#define HCR_FIEN (UL(0x1) << 47) +/* Bit 48 is reserved */ +#define HCR_TID4 (UL(0x1) << 49) +#define HCR_TICAB (UL(0x1) << 50) +#define HCR_AMVOFFEN (UL(0x1) << 51) +#define HCR_TOCU (UL(0x1) << 52) +#define HCR_EnSCXT (UL(0x1) << 53) +#define HCR_TTLBIS (UL(0x1) << 54) +#define HCR_TTLBOS (UL(0x1) << 55) +#define HCR_ATA (UL(0x1) << 56) +#define HCR_DCT (UL(0x1) << 57) +#define HCR_TID5 (UL(0x1) << 58) +#define HCR_TWEDEn (UL(0x1) << 59) +#define HCR_TWEDEL_MASK (UL(0xf) << 60) /* HPFAR_EL2 - Hypervisor IPA Fault Address Register */ #define HPFAR_EL2_FIPA_SHIFT 4 From owner-dev-commits-src-main@freebsd.org Thu Jul 15 09:22:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 585C36627B1; Thu, 15 Jul 2021 09: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 4GQTRX5wbGz3vK0; Thu, 15 Jul 2021 09: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 9817026D49; Thu, 15 Jul 2021 09: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 16F9MWOi086281; Thu, 15 Jul 2021 09: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 16F9MWdD086280; Thu, 15 Jul 2021 09:22:32 GMT (envelope-from git) Date: Thu, 15 Jul 2021 09:22:32 GMT Message-Id: <202107150922.16F9MWdD086280@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: 5484e6d9cc58 - main - Update the SCTLR_EL1 register definitions 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: 5484e6d9cc5801e02cba1bf4b9a03ff2e75fa587 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 09:22:33 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=5484e6d9cc5801e02cba1bf4b9a03ff2e75fa587 commit 5484e6d9cc5801e02cba1bf4b9a03ff2e75fa587 Author: Andrew Turner AuthorDate: 2021-07-08 12:14:56 +0000 Commit: Andrew Turner CommitDate: 2021-07-14 19:29:09 +0000 Update the SCTLR_EL1 register definitions They are valid as of the ARMv8.7 XML. While here remove SCTLR_RES0 as it's unused and depends on which CPU the kernel is running on and switch to shifted values as they are easier to compare with the documentation. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31120 --- sys/arm64/include/armreg.h | 87 ++++++++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 37 deletions(-) diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index 58b6c2f637f0..1361177b8f42 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -1,10 +1,9 @@ /*- * Copyright (c) 2013, 2014 Andrew Turner - * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. + * Copyright (c) 2015,2021 The FreeBSD Foundation * - * This software was developed by Andrew Turner under - * sponsorship from the FreeBSD Foundation. + * Portions of this software were developed by Andrew Turner + * under sponsorship from the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -804,41 +803,55 @@ #define PAR_S_MASK (0x1 << PAR_S_SHIFT) /* SCTLR_EL1 - System Control Register */ -#define SCTLR_RES0 0xc8222440 /* Reserved ARMv8.0, write 0 */ #define SCTLR_RES1 0x30d00800 /* Reserved ARMv8.0, write 1 */ - -#define SCTLR_M 0x00000001 -#define SCTLR_A 0x00000002 -#define SCTLR_C 0x00000004 -#define SCTLR_SA 0x00000008 -#define SCTLR_SA0 0x00000010 -#define SCTLR_CP15BEN 0x00000020 -/* Bit 6 is reserved */ -#define SCTLR_ITD 0x00000080 -#define SCTLR_SED 0x00000100 -#define SCTLR_UMA 0x00000200 -/* Bit 10 is reserved */ -/* Bit 11 is reserved */ -#define SCTLR_I 0x00001000 -#define SCTLR_EnDB 0x00002000 /* ARMv8.3 */ -#define SCTLR_DZE 0x00004000 -#define SCTLR_UCT 0x00008000 -#define SCTLR_nTWI 0x00010000 +#define SCTLR_M (UL(0x1) << 0) +#define SCTLR_A (UL(0x1) << 1) +#define SCTLR_C (UL(0x1) << 2) +#define SCTLR_SA (UL(0x1) << 3) +#define SCTLR_SA0 (UL(0x1) << 4) +#define SCTLR_CP15BEN (UL(0x1) << 5) +#define SCTLR_nAA (UL(0x1) << 6) +#define SCTLR_ITD (UL(0x1) << 7) +#define SCTLR_SED (UL(0x1) << 8) +#define SCTLR_UMA (UL(0x1) << 9) +#define SCTLR_EnRCTX (UL(0x1) << 10) +#define SCTLR_EOS (UL(0x1) << 11) +#define SCTLR_I (UL(0x1) << 12) +#define SCTLR_EnDB (UL(0x1) << 13) +#define SCTLR_DZE (UL(0x1) << 14) +#define SCTLR_UCT (UL(0x1) << 15) +#define SCTLR_nTWI (UL(0x1) << 16) /* Bit 17 is reserved */ -#define SCTLR_nTWE 0x00040000 -#define SCTLR_WXN 0x00080000 -/* Bit 20 is reserved */ -#define SCTLR_IESB 0x00200000 /* ARMv8.2 */ -/* Bit 22 is reserved */ -#define SCTLR_SPAN 0x00800000 /* ARMv8.1 */ -#define SCTLR_E0E 0x01000000 -#define SCTLR_EE 0x02000000 -#define SCTLR_UCI 0x04000000 -#define SCTLR_EnDA 0x08000000 /* ARMv8.3 */ -#define SCTLR_nTLSMD 0x10000000 /* ARMv8.2 */ -#define SCTLR_LSMAOE 0x20000000 /* ARMv8.2 */ -#define SCTLR_EnIB 0x40000000 /* ARMv8.3 */ -#define SCTLR_EnIA 0x80000000 /* ARMv8.3 */ +#define SCTLR_nTWE (UL(0x1) << 18) +#define SCTLR_WXN (UL(0x1) << 19) +#define SCTLR_TSCXT (UL(0x1) << 20) +#define SCTLR_IESB (UL(0x1) << 21) +#define SCTLR_EIS (UL(0x1) << 22) +#define SCTLR_SPAN (UL(0x1) << 23) +#define SCTLR_E0E (UL(0x1) << 24) +#define SCTLR_EE (UL(0x1) << 25) +#define SCTLR_UCI (UL(0x1) << 26) +#define SCTLR_EnDA (UL(0x1) << 27) +#define SCTLR_nTLSMD (UL(0x1) << 28) +#define SCTLR_LSMAOE (UL(0x1) << 29) +#define SCTLR_EnIB (UL(0x1) << 30) +#define SCTLR_EnIA (UL(0x1) << 31) +/* Bits 34:32 are reserved */ +#define SCTLR_BT0 (UL(0x1) << 35) +#define SCTLR_BT1 (UL(0x1) << 36) +#define SCTLR_ITFSB (UL(0x1) << 37) +#define SCTLR_TCF0_MASK (UL(0x3) << 38) +#define SCTLR_TCF_MASK (UL(0x3) << 40) +#define SCTLR_ATA0 (UL(0x1) << 42) +#define SCTLR_ATA (UL(0x1) << 43) +#define SCTLR_DSSBS (UL(0x1) << 44) +#define SCTLR_TWEDEn (UL(0x1) << 45) +#define SCTLR_TWEDEL_MASK (UL(0xf) << 46) +/* Bits 53:50 are reserved */ +#define SCTLR_EnASR (UL(0x1) << 54) +#define SCTLR_EnAS0 (UL(0x1) << 55) +#define SCTLR_EnALS (UL(0x1) << 56) +#define SCTLR_EPAN (UL(0x1) << 57) /* SPSR_EL1 */ /* From owner-dev-commits-src-main@freebsd.org Thu Jul 15 09:37:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2F42662F02; Thu, 15 Jul 2021 09:37: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 4GQTmy4RS0z4Rm6; Thu, 15 Jul 2021 09:37: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 7D47727227; Thu, 15 Jul 2021 09:37: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 16F9bcwk099841; Thu, 15 Jul 2021 09:37:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16F9bcHT099840; Thu, 15 Jul 2021 09:37:38 GMT (envelope-from git) Date: Thu, 15 Jul 2021 09:37:38 GMT Message-Id: <202107150937.16F9bcHT099840@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: 266585108679 - main - Remove the newline from arm64 trap panics 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: 2665851086795c61e799fbe57bfb37cabab3cf8c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 09:37:38 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=2665851086795c61e799fbe57bfb37cabab3cf8c commit 2665851086795c61e799fbe57bfb37cabab3cf8c Author: Andrew Turner AuthorDate: 2021-07-14 19:49:58 +0000 Commit: Andrew Turner CommitDate: 2021-07-14 19:49:58 +0000 Remove the newline from arm64 trap panics The panic function will already print a newline so there is no need to add it here. Sponsored by: The FreeBSD Foundation --- sys/arm64/arm64/trap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 744b646b31c8..e876fa5011c3 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -425,7 +425,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) #ifdef KDB kdb_trap(exception, 0, frame); #else - panic("No debugger in kernel.\n"); + panic("No debugger in kernel."); #endif break; case EXCP_WATCHPT_EL1: @@ -433,7 +433,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) #ifdef KDB kdb_trap(exception, 0, frame); #else - panic("No debugger in kernel.\n"); + panic("No debugger in kernel."); #endif break; case EXCP_UNKNOWN: @@ -443,7 +443,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) default: print_registers(frame); printf(" far: %16lx\n", READ_SPECIALREG(far_el1)); - panic("Unknown kernel exception %x esr_el1 %lx\n", exception, + panic("Unknown kernel exception %x esr_el1 %lx", exception, esr); } } From owner-dev-commits-src-main@freebsd.org Thu Jul 15 10:03:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06457663604; Thu, 15 Jul 2021 10:03: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 4GQVLF52j7z4WPr; Thu, 15 Jul 2021 10:03: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 95A4A278F8; Thu, 15 Jul 2021 10:03: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 16FA31Sw039907; Thu, 15 Jul 2021 10:03:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FA31UG039906; Thu, 15 Jul 2021 10:03:01 GMT (envelope-from git) Date: Thu, 15 Jul 2021 10:03:01 GMT Message-Id: <202107151003.16FA31UG039906@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: ab9f9cfda5a7 - main - Add virtio comments to the arm64 GENERIC config 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: ab9f9cfda5a77ff511d56cf183f081cb72ada79d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 10:03:02 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=ab9f9cfda5a77ff511d56cf183f081cb72ada79d commit ab9f9cfda5a77ff511d56cf183f081cb72ada79d Author: Andrew Turner AuthorDate: 2021-07-14 20:08:29 +0000 Commit: Andrew Turner CommitDate: 2021-07-14 20:08:29 +0000 Add virtio comments to the arm64 GENERIC config Most of these are from the amd64 GENERIC config. Sponsored by: The FreeBSD Foundation --- sys/arm64/conf/GENERIC | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index f92a78f8e802..152257783a96 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -377,11 +377,11 @@ device rk_dwmmc device rk_emmcphy # VirtIO support -device virtio -device virtio_pci -device virtio_mmio -device virtio_blk -device vtnet +device virtio # Generic VirtIO bus (required) +device virtio_pci # VirtIO PCI device +device virtio_mmio # VirtIO Memory Mapped IO device +device virtio_blk # VirtIO Block device +device vtnet # VirtIO Ethernet device # Chip-specific errata options THUNDERX_PASS_1_1_ERRATA From owner-dev-commits-src-main@freebsd.org Thu Jul 15 10:03:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11C0F6633E2; Thu, 15 Jul 2021 10:03: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 4GQVLG620gz4WYH; Thu, 15 Jul 2021 10:03: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 B768127767; Thu, 15 Jul 2021 10:03: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 16FA32TQ039931; Thu, 15 Jul 2021 10:03:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FA321Y039930; Thu, 15 Jul 2021 10:03:02 GMT (envelope-from git) Date: Thu, 15 Jul 2021 10:03:02 GMT Message-Id: <202107151003.16FA321Y039930@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: b644d64e8a46 - main - Add virtio_scsi to the arm64 GENERIC config 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: b644d64e8a4641a6e4c53b3f4be51e08cb17f6cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 10:03:03 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=b644d64e8a4641a6e4c53b3f4be51e08cb17f6cc commit b644d64e8a4641a6e4c53b3f4be51e08cb17f6cc Author: Andrew Turner AuthorDate: 2021-07-14 20:13:10 +0000 Commit: Andrew Turner CommitDate: 2021-07-14 20:13:10 +0000 Add virtio_scsi to the arm64 GENERIC config This is needed to boot on the Oracle Cloud VM.Standard.A1.Flex instance Sponsored by: The FreeBSD Foundation --- sys/arm64/conf/GENERIC | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index 152257783a96..c096c4774f41 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -381,6 +381,7 @@ device virtio # Generic VirtIO bus (required) device virtio_pci # VirtIO PCI device device virtio_mmio # VirtIO Memory Mapped IO device device virtio_blk # VirtIO Block device +device virtio_scsi # VirtIO SCSI device device vtnet # VirtIO Ethernet device # Chip-specific errata From owner-dev-commits-src-main@freebsd.org Thu Jul 15 10:13:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA393663B97; Thu, 15 Jul 2021 10:13: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 4GQVZJ4sJDz4Y0n; Thu, 15 Jul 2021 10:13: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 5B35427C07; Thu, 15 Jul 2021 10:13: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 16FADSIs053402; Thu, 15 Jul 2021 10:13:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FADSAg053401; Thu, 15 Jul 2021 10:13:28 GMT (envelope-from git) Date: Thu, 15 Jul 2021 10:13:28 GMT Message-Id: <202107151013.16FADSAg053401@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: f83f5d58394d - main - Send a zero-length-packet first when opening a BULK endpoint for USB serial port devices. If it gets eaten it is fine. Many USB device side implementations don't properly support the clear endpoint halt command and if they do, data is lost because the transmit FIFO is typically reset when this command is received. 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: f83f5d58394db57576bbed6dc7531997cabeb102 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 10:13:29 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=f83f5d58394db57576bbed6dc7531997cabeb102 commit f83f5d58394db57576bbed6dc7531997cabeb102 Author: Hans Petter Selasky AuthorDate: 2021-07-06 10:29:57 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-15 10:11:53 +0000 Send a zero-length-packet first when opening a BULK endpoint for USB serial port devices. If it gets eaten it is fine. Many USB device side implementations don't properly support the clear endpoint halt command and if they do, data is lost because the transmit FIFO is typically reset when this command is received. Tested by: jmg MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/serial/u3g.c | 6 +++-- sys/dev/usb/serial/uark.c | 10 +++++--- sys/dev/usb/serial/ubsa.c | 10 +++++--- sys/dev/usb/serial/ubser.c | 10 +++++--- sys/dev/usb/serial/uchcom.c | 6 +++-- sys/dev/usb/serial/ufoma.c | 10 +++++--- sys/dev/usb/serial/uftdi.c | 6 +++-- sys/dev/usb/serial/ugensa.c | 11 +++++---- sys/dev/usb/serial/uipaq.c | 10 +++++--- sys/dev/usb/serial/ulpt.c | 9 +++---- sys/dev/usb/serial/umcs.c | 10 +++++--- sys/dev/usb/serial/umodem.c | 18 +++++++------- sys/dev/usb/serial/umoscom.c | 10 +++++--- sys/dev/usb/serial/uplcom.c | 21 ++++++++-------- sys/dev/usb/serial/uslcom.c | 10 +++++--- sys/dev/usb/serial/uvscom.c | 10 +++++--- sys/dev/usb/usb_transfer.c | 59 +++++++++++++++++++++++++++++++++++++++++--- sys/dev/usb/usbdi.h | 3 +++ 18 files changed, 155 insertions(+), 74 deletions(-) diff --git a/sys/dev/usb/serial/u3g.c b/sys/dev/usb/serial/u3g.c index 22e4e8f6b2bb..d7d8fd80b42a 100644 --- a/sys/dev/usb/serial/u3g.c +++ b/sys/dev/usb/serial/u3g.c @@ -978,8 +978,7 @@ u3g_attach(device_t dev) /* set stall by default */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(sc->sc_xfer[nports][U3G_BULK_WR]); - usbd_xfer_set_stall(sc->sc_xfer[nports][U3G_BULK_RD]); + usbd_xfer_set_zlp(sc->sc_xfer[nports][U3G_BULK_WR]); mtx_unlock(&sc->sc_mtx); nports++; /* found one port */ @@ -1100,6 +1099,9 @@ u3g_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_TRANSFERRED: case USB_ST_SETUP: tr_setup: + if (usbd_xfer_get_and_clr_zlp(xfer)) + break; + for (frame = 0; frame != U3G_TXFRAMES; frame++) { usbd_xfer_set_frame_offset(xfer, frame * U3G_TXSIZE, frame); diff --git a/sys/dev/usb/serial/uark.c b/sys/dev/usb/serial/uark.c index 904977e1ec14..072edf6389cd 100644 --- a/sys/dev/usb/serial/uark.c +++ b/sys/dev/usb/serial/uark.c @@ -219,8 +219,7 @@ uark_attach(device_t dev) } /* clear stall at first run */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(sc->sc_xfer[UARK_BULK_DT_WR]); - usbd_xfer_set_stall(sc->sc_xfer[UARK_BULK_DT_RD]); + usbd_xfer_set_zlp(sc->sc_xfer[UARK_BULK_DT_WR]); mtx_unlock(&sc->sc_mtx); error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, @@ -281,13 +280,16 @@ uark_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: + if (usbd_xfer_get_and_clr_zlp(xfer)) + break; + pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UARK_BUF_SIZE, &actlen)) { usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -295,7 +297,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - return; + break; } } diff --git a/sys/dev/usb/serial/ubsa.c b/sys/dev/usb/serial/ubsa.c index 10b37984db2f..3286df7331b4 100644 --- a/sys/dev/usb/serial/ubsa.c +++ b/sys/dev/usb/serial/ubsa.c @@ -320,8 +320,7 @@ ubsa_attach(device_t dev) } /* clear stall at first run */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(sc->sc_xfer[UBSA_BULK_DT_WR]); - usbd_xfer_set_stall(sc->sc_xfer[UBSA_BULK_DT_RD]); + usbd_xfer_set_zlp(sc->sc_xfer[UBSA_BULK_DT_WR]); mtx_unlock(&sc->sc_mtx); error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, @@ -583,13 +582,16 @@ ubsa_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: + if (usbd_xfer_get_and_clr_zlp(xfer)) + break; + pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UBSA_BSIZE, &actlen)) { usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -597,7 +599,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - return; + break; } } diff --git a/sys/dev/usb/serial/ubser.c b/sys/dev/usb/serial/ubser.c index 2a35756b0a7e..61b9c6c433fb 100644 --- a/sys/dev/usb/serial/ubser.c +++ b/sys/dev/usb/serial/ubser.c @@ -293,8 +293,7 @@ ubser_attach(device_t dev) ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(sc->sc_xfer[UBSER_BULK_DT_WR]); - usbd_xfer_set_stall(sc->sc_xfer[UBSER_BULK_DT_RD]); + usbd_xfer_set_zlp(sc->sc_xfer[UBSER_BULK_DT_WR]); usbd_transfer_start(sc->sc_xfer[UBSER_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); @@ -410,6 +409,9 @@ ubser_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: + if (usbd_xfer_get_and_clr_zlp(xfer)) + break; + pc = usbd_xfer_get_frame(xfer, 0); do { if (ucom_get_data(sc->sc_ucom + sc->sc_curr_tx_unit, @@ -430,7 +432,7 @@ tr_setup: } while (sc->sc_curr_tx_unit != first_unit); - return; + break; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -438,7 +440,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - return; + break; } } diff --git a/sys/dev/usb/serial/uchcom.c b/sys/dev/usb/serial/uchcom.c index 6b17141c6ece..aef1515d3586 100644 --- a/sys/dev/usb/serial/uchcom.c +++ b/sys/dev/usb/serial/uchcom.c @@ -350,8 +350,7 @@ uchcom_attach(device_t dev) /* clear stall at first run */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(sc->sc_xfer[UCHCOM_BULK_DT_WR]); - usbd_xfer_set_stall(sc->sc_xfer[UCHCOM_BULK_DT_RD]); + usbd_xfer_set_zlp(sc->sc_xfer[UCHCOM_BULK_DT_WR]); mtx_unlock(&sc->sc_mtx); error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, @@ -828,6 +827,9 @@ uchcom_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: + if (usbd_xfer_get_and_clr_zlp(xfer)) + break; + pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, usbd_xfer_max_len(xfer), &actlen)) { diff --git a/sys/dev/usb/serial/ufoma.c b/sys/dev/usb/serial/ufoma.c index bc3f00a7b473..ca52752accad 100644 --- a/sys/dev/usb/serial/ufoma.c +++ b/sys/dev/usb/serial/ufoma.c @@ -438,8 +438,7 @@ ufoma_attach(device_t dev) /* clear stall at first run, if any */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]); - usbd_xfer_set_stall(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ]); + usbd_xfer_set_zlp(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]); mtx_unlock(&sc->sc_mtx); error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, @@ -791,13 +790,16 @@ ufoma_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: + if (usbd_xfer_get_and_clr_zlp(xfer)) + break; + pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UFOMA_BULK_BUF_SIZE, &actlen)) { usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -805,7 +807,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - return; + break; } } diff --git a/sys/dev/usb/serial/uftdi.c b/sys/dev/usb/serial/uftdi.c index 52977352fb94..9dc00e82253f 100644 --- a/sys/dev/usb/serial/uftdi.c +++ b/sys/dev/usb/serial/uftdi.c @@ -1117,8 +1117,7 @@ uftdi_attach(device_t dev) } /* clear stall at first run */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_WR]); - usbd_xfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_RD]); + usbd_xfer_set_zlp(sc->sc_xfer[UFTDI_BULK_DT_WR]); mtx_unlock(&sc->sc_mtx); /* set a valid "lcr" value */ @@ -1221,6 +1220,9 @@ uftdi_write_callback(struct usb_xfer *xfer, usb_error_t error) /* FALLTHROUGH */ case USB_ST_SETUP: case USB_ST_TRANSFERRED: + if (usbd_xfer_get_and_clr_zlp(xfer)) + break; + /* * If output packets don't require headers (the common case) we * can just load the buffer up with payload bytes all at once. diff --git a/sys/dev/usb/serial/ugensa.c b/sys/dev/usb/serial/ugensa.c index ba694e4805bd..1d2f1e57ef58 100644 --- a/sys/dev/usb/serial/ugensa.c +++ b/sys/dev/usb/serial/ugensa.c @@ -233,10 +233,8 @@ ugensa_attach(device_t dev) break; } - /* clear stall at first run */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_WR]); - usbd_xfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_RD]); + usbd_xfer_set_zlp(ssc->sc_xfer[UGENSA_BULK_DT_WR]); mtx_unlock(&sc->sc_mtx); /* initialize port number */ @@ -313,13 +311,16 @@ ugensa_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: + if (usbd_xfer_get_and_clr_zlp(xfer)) + break; + pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(ssc->sc_ucom_ptr, pc, 0, UGENSA_BUF_SIZE, &actlen)) { usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -327,7 +328,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - return; + break; } } diff --git a/sys/dev/usb/serial/uipaq.c b/sys/dev/usb/serial/uipaq.c index 33f2ae4c0845..0449a5663c71 100644 --- a/sys/dev/usb/serial/uipaq.c +++ b/sys/dev/usb/serial/uipaq.c @@ -1157,8 +1157,7 @@ uipaq_attach(device_t dev) } /* clear stall at first run */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(sc->sc_xfer[UIPAQ_BULK_DT_WR]); - usbd_xfer_set_stall(sc->sc_xfer[UIPAQ_BULK_DT_RD]); + usbd_xfer_set_zlp(sc->sc_xfer[UIPAQ_BULK_DT_WR]); mtx_unlock(&sc->sc_mtx); error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, @@ -1320,13 +1319,16 @@ uipaq_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: + if (usbd_xfer_get_and_clr_zlp(xfer)) + break; + pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UIPAQ_BUF_SIZE, &actlen)) { usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -1334,7 +1336,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - return; + break; } } diff --git a/sys/dev/usb/serial/ulpt.c b/sys/dev/usb/serial/ulpt.c index c566da924374..56f99519d4cd 100644 --- a/sys/dev/usb/serial/ulpt.c +++ b/sys/dev/usb/serial/ulpt.c @@ -218,6 +218,9 @@ ulpt_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_TRANSFERRED: case USB_ST_SETUP: tr_setup: + if (usbd_xfer_get_and_clr_zlp(xfer)) + break; + pc = usbd_xfer_get_frame(xfer, 0); max = usbd_xfer_max_len(xfer); if (usb_fifo_get_data(f, pc, 0, max, &actlen, 0)) { @@ -436,10 +439,6 @@ unlpt_open(struct usb_fifo *fifo, int fflags) return (EBUSY); } if (fflags & FREAD) { - /* clear stall first */ - mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(sc->sc_xfer[ULPT_BULK_DT_RD]); - mtx_unlock(&sc->sc_mtx); if (usb_fifo_alloc_buffer(fifo, usbd_xfer_max_len(sc->sc_xfer[ULPT_BULK_DT_RD]), ULPT_IFQ_MAXLEN)) { @@ -451,7 +450,7 @@ unlpt_open(struct usb_fifo *fifo, int fflags) if (fflags & FWRITE) { /* clear stall first */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(sc->sc_xfer[ULPT_BULK_DT_WR]); + usbd_xfer_set_zlp(sc->sc_xfer[ULPT_BULK_DT_WR]); mtx_unlock(&sc->sc_mtx); if (usb_fifo_alloc_buffer(fifo, usbd_xfer_max_len(sc->sc_xfer[ULPT_BULK_DT_WR]), diff --git a/sys/dev/usb/serial/umcs.c b/sys/dev/usb/serial/umcs.c index e3c8f1a764fb..76ecd1ffa452 100644 --- a/sys/dev/usb/serial/umcs.c +++ b/sys/dev/usb/serial/umcs.c @@ -382,8 +382,7 @@ umcs7840_attach(device_t dev) /* clear stall at first run */ mtx_lock(&sc->sc_mtx); for (subunit = 0; subunit < sc->sc_numports; ++subunit) { - usbd_xfer_set_stall(sc->sc_ports[sc->sc_ucom[subunit].sc_portno].sc_xfer[UMCS7840_BULK_RD_EP]); - usbd_xfer_set_stall(sc->sc_ports[sc->sc_ucom[subunit].sc_portno].sc_xfer[UMCS7840_BULK_WR_EP]); + usbd_xfer_set_zlp(sc->sc_ports[sc->sc_ucom[subunit].sc_portno].sc_xfer[UMCS7840_BULK_WR_EP]); } mtx_unlock(&sc->sc_mtx); @@ -916,13 +915,16 @@ umcs7840_write_callbackN(struct usb_xfer *xfer, usb_error_t error, uint8_t subun case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: + if (usbd_xfer_get_and_clr_zlp(xfer)) + break; + pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(ucom, pc, 0, usbd_xfer_max_len(xfer), &actlen)) { DPRINTF("Port %d write, has %d bytes\n", ucom->sc_portno, actlen); usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -930,7 +932,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - return; + break; } } diff --git a/sys/dev/usb/serial/umodem.c b/sys/dev/usb/serial/umodem.c index 573d74cdb526..b8b7ae2f005c 100644 --- a/sys/dev/usb/serial/umodem.c +++ b/sys/dev/usb/serial/umodem.c @@ -447,13 +447,10 @@ umodem_attach(device_t dev) goto detach; } - /* clear stall at first run, if USB host mode */ - if (uaa->usb_mode == USB_MODE_HOST) { - mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(sc->sc_xfer[UMODEM_BULK_WR]); - usbd_xfer_set_stall(sc->sc_xfer[UMODEM_BULK_RD]); - mtx_unlock(&sc->sc_mtx); - } + /* send a ZLP at first run */ + mtx_lock(&sc->sc_mtx); + usbd_xfer_set_zlp(sc->sc_xfer[UMODEM_BULK_WR]); + mtx_unlock(&sc->sc_mtx); ucom_set_usb_mode(&sc->sc_super_ucom, uaa->usb_mode); @@ -863,13 +860,16 @@ umodem_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: + if (usbd_xfer_get_and_clr_zlp(xfer)) + break; + pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UMODEM_BUF_SIZE, &actlen)) { usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -877,7 +877,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - return; + break; } } diff --git a/sys/dev/usb/serial/umoscom.c b/sys/dev/usb/serial/umoscom.c index 724ab7f94092..536772a7f697 100644 --- a/sys/dev/usb/serial/umoscom.c +++ b/sys/dev/usb/serial/umoscom.c @@ -333,8 +333,7 @@ umoscom_attach(device_t dev) } /* clear stall at first run */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(sc->sc_xfer[UMOSCOM_BULK_DT_WR]); - usbd_xfer_set_stall(sc->sc_xfer[UMOSCOM_BULK_DT_RD]); + usbd_xfer_set_zlp(sc->sc_xfer[UMOSCOM_BULK_DT_WR]); mtx_unlock(&sc->sc_mtx); error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, @@ -639,13 +638,16 @@ umoscom_write_callback(struct usb_xfer *xfer, usb_error_t error) tr_setup: DPRINTF("\n"); + if (usbd_xfer_get_and_clr_zlp(xfer)) + break; + pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UMOSCOM_BUFSIZE, &actlen)) { usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -654,7 +656,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - return; + break; } } diff --git a/sys/dev/usb/serial/uplcom.c b/sys/dev/usb/serial/uplcom.c index 9efac9ff6b7c..6808ddd64a4b 100644 --- a/sys/dev/usb/serial/uplcom.c +++ b/sys/dev/usb/serial/uplcom.c @@ -507,14 +507,12 @@ uplcom_attach(device_t dev) goto detach; } - if (sc->sc_chiptype == TYPE_PL2303) { - /* HX variants seem to lock up after a clear stall request. */ - mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_WR]); - usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]); - mtx_unlock(&sc->sc_mtx); - } else if (sc->sc_chiptype == TYPE_PL2303HX || - sc->sc_chiptype == TYPE_PL2303HXD) { + mtx_lock(&sc->sc_mtx); + usbd_xfer_set_zlp(sc->sc_xfer[UPLCOM_BULK_DT_WR]); + mtx_unlock(&sc->sc_mtx); + + if (sc->sc_chiptype == TYPE_PL2303HX || + sc->sc_chiptype == TYPE_PL2303HXD) { /* reset upstream data pipes */ if (uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 8, 0, 0) || @@ -1094,6 +1092,9 @@ uplcom_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: + if (usbd_xfer_get_and_clr_zlp(xfer)) + break; + pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UPLCOM_BULK_BUF_SIZE, &actlen)) { @@ -1102,7 +1103,7 @@ tr_setup: usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -1110,7 +1111,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - return; + break; } } diff --git a/sys/dev/usb/serial/uslcom.c b/sys/dev/usb/serial/uslcom.c index fec18d2a5631..8c40a2c2fc3a 100644 --- a/sys/dev/usb/serial/uslcom.c +++ b/sys/dev/usb/serial/uslcom.c @@ -443,8 +443,7 @@ uslcom_attach(device_t dev) } /* clear stall at first run */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_WR]); - usbd_xfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_RD]); + usbd_xfer_set_zlp(sc->sc_xfer[USLCOM_BULK_DT_WR]); mtx_unlock(&sc->sc_mtx); sc->sc_partnum = uslcom_get_partnum(sc); @@ -819,6 +818,9 @@ uslcom_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: + if (usbd_xfer_get_and_clr_zlp(xfer)) + break; + pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, USLCOM_BULK_BUF_SIZE, &actlen)) { @@ -827,7 +829,7 @@ tr_setup: usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -835,7 +837,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - return; + break; } } diff --git a/sys/dev/usb/serial/uvscom.c b/sys/dev/usb/serial/uvscom.c index 8bb69e4402cf..81fd5334a243 100644 --- a/sys/dev/usb/serial/uvscom.c +++ b/sys/dev/usb/serial/uvscom.c @@ -318,8 +318,7 @@ uvscom_attach(device_t dev) /* clear stall at first run */ mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(sc->sc_xfer[UVSCOM_BULK_DT_WR]); - usbd_xfer_set_stall(sc->sc_xfer[UVSCOM_BULK_DT_RD]); + usbd_xfer_set_zlp(sc->sc_xfer[UVSCOM_BULK_DT_WR]); mtx_unlock(&sc->sc_mtx); error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, @@ -391,13 +390,16 @@ uvscom_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: + if (usbd_xfer_get_and_clr_zlp(xfer)) + break; + pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UVSCOM_BULK_BUF_SIZE, &actlen)) { usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -405,7 +407,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - return; + break; } } diff --git a/sys/dev/usb/usb_transfer.c b/sys/dev/usb/usb_transfer.c index 436e08db14a1..e1582926b08d 100644 --- a/sys/dev/usb/usb_transfer.c +++ b/sys/dev/usb/usb_transfer.c @@ -2,7 +2,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2008-2021 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -2689,6 +2689,61 @@ usbd_transfer_start_cb(void *arg) } } +/*------------------------------------------------------------------------* + * usbd_xfer_set_zlp + * + * This function sets the USB transfers ZLP flag. + *------------------------------------------------------------------------*/ +void +usbd_xfer_set_zlp(struct usb_xfer *xfer) +{ + if (xfer == NULL) { + /* tearing down */ + return; + } + USB_XFER_LOCK_ASSERT(xfer, MA_OWNED); + + /* avoid any races by locking the USB mutex */ + USB_BUS_LOCK(xfer->xroot->bus); + xfer->flags.send_zlp = 1; + USB_BUS_UNLOCK(xfer->xroot->bus); +} + +/*------------------------------------------------------------------------* + * usbd_xfer_get_and_clr_zlp + * + * This function gets and clears the USB transfers ZLP flag and + * queues a zero-length USB transfer if the flag was set. + *------------------------------------------------------------------------*/ +uint8_t +usbd_xfer_get_and_clr_zlp(struct usb_xfer *xfer) +{ + uint8_t retval; + + if (xfer == NULL) { + /* tearing down */ + return (0); + } + USB_XFER_LOCK_ASSERT(xfer, MA_OWNED); + + retval = xfer->flags.send_zlp; + + if (retval != 0) { + DPRINTFN(1, "Sending zero-length packet.\n"); + + /* avoid any races by locking the USB mutex */ + USB_BUS_LOCK(xfer->xroot->bus); + xfer->flags.send_zlp = 0; + USB_BUS_UNLOCK(xfer->xroot->bus); + + /* queue up a zero-length packet */ + usbd_xfer_set_frame_len(xfer, 0, 0); + usbd_xfer_set_frames(xfer, 1); + usbd_transfer_submit(xfer); + } + return (retval); +} + /*------------------------------------------------------------------------* * usbd_xfer_set_stall * @@ -2733,9 +2788,7 @@ usbd_transfer_clear_stall(struct usb_xfer *xfer) /* avoid any races by locking the USB mutex */ USB_BUS_LOCK(xfer->xroot->bus); - xfer->flags.stall_pipe = 0; - USB_BUS_UNLOCK(xfer->xroot->bus); } diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h index 1b3b4af5f717..287e40d59364 100644 --- a/sys/dev/usb/usbdi.h +++ b/sys/dev/usb/usbdi.h @@ -218,6 +218,7 @@ struct usb_xfer_flags { * option only has effect for * ISOCHRONOUS transfers. */ + uint8_t send_zlp:1; /* send a zero length packet first */ }; /* @@ -655,6 +656,8 @@ void usbd_xfer_set_frame_len(struct usb_xfer *xfer, usb_frcount_t frindex, usb_frlength_t len); void usbd_xfer_set_timeout(struct usb_xfer *xfer, int timeout); void usbd_xfer_set_frames(struct usb_xfer *xfer, usb_frcount_t n); +void usbd_xfer_set_zlp(struct usb_xfer *xfer); +uint8_t usbd_xfer_get_and_clr_zlp(struct usb_xfer *xfer); void usbd_xfer_set_stall(struct usb_xfer *xfer); int usbd_xfer_is_stalled(struct usb_xfer *xfer); void usbd_xfer_set_flag(struct usb_xfer *xfer, int flag); From owner-dev-commits-src-main@freebsd.org Thu Jul 15 10:39:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01E41664484; Thu, 15 Jul 2021 10: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 4GQW8N6TxKz4dWt; Thu, 15 Jul 2021 10:39: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 C5E4C27EAA; Thu, 15 Jul 2021 10:39: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 16FAdWgH081084; Thu, 15 Jul 2021 10:39:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FAdW2W081083; Thu, 15 Jul 2021 10:39:32 GMT (envelope-from git) Date: Thu, 15 Jul 2021 10:39:32 GMT Message-Id: <202107151039.16FAdW2W081083@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: 65788dae3117 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 65788dae3117ed307d8d507a06a43f2b32d342fa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 10:39:33 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=65788dae3117ed307d8d507a06a43f2b32d342fa commit 65788dae3117ed307d8d507a06a43f2b32d342fa Author: Hans Petter Selasky AuthorDate: 2021-07-15 10:38:16 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-15 10:38:42 +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 91f4f6790b31..60841f473334 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-main@freebsd.org Thu Jul 15 14:54:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 190046482F6; Thu, 15 Jul 2021 14:54:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQcpF6lJPz3ryG; Thu, 15 Jul 2021 14:54: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 CBC1238AB; Thu, 15 Jul 2021 14:54: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 16FEsD4O026508; Thu, 15 Jul 2021 14:54:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FEsDk1026507; Thu, 15 Jul 2021 14:54:13 GMT (envelope-from git) Date: Thu, 15 Jul 2021 14:54:13 GMT Message-Id: <202107151454.16FEsDk1026507@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Neel Chauhan Subject: git: 086cfe4df8ab - main - linuxkpi: Add spin_trylock_irqsave() macro MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 086cfe4df8ab237f0cf156e95d36657250931981 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 14:54:14 -0000 The branch main has been updated by nc (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=086cfe4df8ab237f0cf156e95d36657250931981 commit 086cfe4df8ab237f0cf156e95d36657250931981 Author: Neel Chauhan AuthorDate: 2021-07-15 14:52:42 +0000 Commit: Neel Chauhan CommitDate: 2021-07-15 14:52:42 +0000 linuxkpi: Add spin_trylock_irqsave() macro This is needed by the drm-kmod 5.6 update. Reviewed by: hselasky MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D30706 --- sys/compat/linuxkpi/common/include/linux/spinlock.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/spinlock.h b/sys/compat/linuxkpi/common/include/linux/spinlock.h index 46b1f8b9a180..56eaecfb4cd6 100644 --- a/sys/compat/linuxkpi/common/include/linux/spinlock.h +++ b/sys/compat/linuxkpi/common/include/linux/spinlock.h @@ -104,6 +104,11 @@ typedef struct { #define spin_trylock_irq(_l) \ spin_trylock(_l) +#define spin_trylock_irqsave(_l, flags) ({ \ + (flags) = 0; \ + spin_trylock(_l); \ +}) + #define spin_lock_nested(_l, _n) do { \ if (SPIN_SKIP()) \ break; \ From owner-dev-commits-src-main@freebsd.org Thu Jul 15 15:16:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 74FC5648A5B; Thu, 15 Jul 2021 15:16: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 4GQdHR2qSMz4RkL; Thu, 15 Jul 2021 15:16: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 480B84098; Thu, 15 Jul 2021 15:16: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 16FFG3ae054110; Thu, 15 Jul 2021 15:16:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FFG3DU054109; Thu, 15 Jul 2021 15:16:03 GMT (envelope-from git) Date: Thu, 15 Jul 2021 15:16:03 GMT Message-Id: <202107151516.16FFG3DU054109@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: b9296725cf99 - main - Add __diagused 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: b9296725cf99696b48926270a553044522d6e344 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 15:16:03 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=b9296725cf99696b48926270a553044522d6e344 commit b9296725cf99696b48926270a553044522d6e344 Author: Mateusz Guzik AuthorDate: 2021-07-15 14:01:02 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-15 15:15:54 +0000 Add __diagused This can be used for variables which are only used with either INVARIANTS or WITNESS. Without any annotation they run into dead store warnings from cc --analyze and always annotating with __unused may hide bad vars when it should not. Reviewed by: kib, markj Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31185 --- sys/sys/systm.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 5d41c9d53c2c..8080f22266e2 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -637,6 +637,13 @@ void _gone_in_dev(device_t dev, int major, const char *msg); #endif #define gone_in(major, msg) __gone_ok(major, msg) _gone_in(major, msg) #define gone_in_dev(dev, major, msg) __gone_ok(major, msg) _gone_in_dev(dev, major, msg) + +#if defined(INVARIANTS) || defined(WITNESS) +#define __diagused +#else +#define __diagused __unused +#endif + #endif /* _KERNEL */ __NULLABILITY_PRAGMA_POP From owner-dev-commits-src-main@freebsd.org Thu Jul 15 15:16:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F83D648E99; Thu, 15 Jul 2021 15:16: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 4GQdHS4GCMz4Rwy; Thu, 15 Jul 2021 15:16: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 721E03CCF; Thu, 15 Jul 2021 15:16: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 16FFG4oK054136; Thu, 15 Jul 2021 15:16:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FFG4NK054135; Thu, 15 Jul 2021 15:16:04 GMT (envelope-from git) Date: Thu, 15 Jul 2021 15:16:04 GMT Message-Id: <202107151516.16FFG4NK054135@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: aee6e7dc0cab - main - hwpmc: mostly clean up cc --analyze 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: aee6e7dc0cabc670f3a9eabac579a030b363a417 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 15:16:05 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=aee6e7dc0cabc670f3a9eabac579a030b363a417 commit aee6e7dc0cabc670f3a9eabac579a030b363a417 Author: Mateusz Guzik AuthorDate: 2021-07-15 14:01:11 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-15 15:15:55 +0000 hwpmc: mostly clean up cc --analyze Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/dev/hwpmc/hwpmc_amd.c | 2 +- sys/dev/hwpmc/hwpmc_core.c | 5 +---- sys/dev/hwpmc/hwpmc_logging.c | 4 +--- sys/dev/hwpmc/hwpmc_mod.c | 7 +++---- sys/dev/hwpmc/hwpmc_soft.c | 8 +++----- sys/dev/hwpmc/hwpmc_tsc.c | 4 ++-- sys/dev/hwpmc/hwpmc_uncore.c | 4 +--- 7 files changed, 12 insertions(+), 22 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_amd.c b/sys/dev/hwpmc/hwpmc_amd.c index d54cf52f1082..a95615926bc3 100644 --- a/sys/dev/hwpmc/hwpmc_amd.c +++ b/sys/dev/hwpmc/hwpmc_amd.c @@ -669,7 +669,7 @@ amd_release_pmc(int cpu, int ri, struct pmc *pmc) #ifdef HWPMC_DEBUG const struct amd_descr *pd; #endif - struct pmc_hw *phw; + struct pmc_hw *phw __diagused; (void) pmc; diff --git a/sys/dev/hwpmc/hwpmc_core.c b/sys/dev/hwpmc/hwpmc_core.c index f49aeb2fcfd9..b0773227fac7 100644 --- a/sys/dev/hwpmc/hwpmc_core.c +++ b/sys/dev/hwpmc/hwpmc_core.c @@ -741,7 +741,6 @@ static int iap_allocate_pmc(int cpu, int ri, struct pmc *pm, const struct pmc_op_pmcallocate *a) { - enum pmc_event map; uint8_t ev; uint32_t caps; const struct pmc_md_iap_op_pmcallocate *iap; @@ -755,7 +754,6 @@ iap_allocate_pmc(int cpu, int ri, struct pmc *pm, caps = a->pm_caps; if ((IAP_PMC_CAPS & caps) != caps) return (EPERM); - map = 0; /* XXX: silent GCC warning */ iap = &a->pm_md.pm_iap; ev = IAP_EVSEL_GET(iap->pm_iap_config); @@ -961,7 +959,7 @@ iap_start_pmc(int cpu, int ri) static int iap_stop_pmc(int cpu, int ri) { - struct pmc *pm; + struct pmc *pm __diagused; struct core_cpu *cc; uint64_t msr; @@ -985,7 +983,6 @@ iap_stop_pmc(int cpu, int ri) if (core_cputype == PMC_CPU_INTEL_CORE) return (0); - msr = 0; do { cc->pc_resync = 0; cc->pc_globalctrl &= ~(1ULL << ri); diff --git a/sys/dev/hwpmc/hwpmc_logging.c b/sys/dev/hwpmc/hwpmc_logging.c index e76aa9b710eb..c13b87f4165f 100644 --- a/sys/dev/hwpmc/hwpmc_logging.c +++ b/sys/dev/hwpmc/hwpmc_logging.c @@ -550,7 +550,7 @@ pmclog_release(struct pmc_owner *po) static uint32_t * pmclog_reserve(struct pmc_owner *po, int length) { - uintptr_t newptr, oldptr; + uintptr_t newptr, oldptr __diagused; struct pmclog_buffer *plb, **pplb; PMCDBG2(LOG,ALL,1, "po=%p len=%d", po, length); @@ -693,7 +693,6 @@ pmclog_configure_log(struct pmc_mdep *md, struct pmc_owner *po, int logfd) { struct proc *p; struct timespec ts; - uint64_t tsc; int error; sx_assert(&pmc_sx, SA_XLOCKED); @@ -722,7 +721,6 @@ pmclog_configure_log(struct pmc_mdep *md, struct pmc_owner *po, int logfd) p->p_flag |= P_HWPMC; PROC_UNLOCK(p); nanotime(&ts); - tsc = pmc_rdtsc(); /* create a log initialization entry */ PMCLOG_RESERVE_WITH_ERROR(po, INITIALIZE, sizeof(struct pmclog_initialize)); diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c index 6f7753dd11c1..8d5d0183d3ad 100644 --- a/sys/dev/hwpmc/hwpmc_mod.c +++ b/sys/dev/hwpmc/hwpmc_mod.c @@ -1351,7 +1351,7 @@ pmc_process_csw_in(struct thread *td) struct pmc *pm; struct proc *p; struct pmc_cpu *pc; - struct pmc_hw *phw; + struct pmc_hw *phw __diagused; pmc_value_t newvalue; struct pmc_process *pp; struct pmc_thread *pt; @@ -2769,7 +2769,7 @@ static void pmc_release_pmc_descriptor(struct pmc *pm) { enum pmc_mode mode; - struct pmc_hw *phw; + struct pmc_hw *phw __diagused; u_int adjri, ri, cpu; struct pmc_owner *po; struct pmc_binding pb; @@ -4336,7 +4336,6 @@ pmc_syscall_handler(struct thread *td, void *syscall_args) if ((error = copyin(arg, &prw, sizeof(prw))) != 0) break; - ri = 0; PMCDBG2(PMC,OPS,1, "rw id=%d flags=0x%x", prw.pm_pmcid, prw.pm_flags); @@ -4920,7 +4919,7 @@ pmc_process_samples(int cpu, ring_type_t ring) struct pmc_sample *ps; struct pmc_classdep *pcd; struct pmc_samplebuffer *psb; - uint64_t delta; + uint64_t delta __diagused; KASSERT(PCPU_GET(cpuid) == cpu, ("[pmc,%d] not on the correct CPU pcpu=%d cpu=%d", __LINE__, diff --git a/sys/dev/hwpmc/hwpmc_soft.c b/sys/dev/hwpmc/hwpmc_soft.c index 77a8c7b3abbb..cf2401e9159e 100644 --- a/sys/dev/hwpmc/hwpmc_soft.c +++ b/sys/dev/hwpmc/hwpmc_soft.c @@ -264,7 +264,7 @@ soft_pcpu_init(struct pmc_mdep *md, int cpu) static int soft_read_pmc(int cpu, int ri, pmc_value_t *v) { - struct pmc *pm; + struct pmc *pm __diagused; const struct pmc_hw *phw; KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), @@ -288,8 +288,7 @@ soft_read_pmc(int cpu, int ri, pmc_value_t *v) static int soft_write_pmc(int cpu, int ri, pmc_value_t v) { - struct pmc *pm; - const struct soft_descr *pd; + struct pmc *pm __diagused; KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[soft,%d] illegal cpu value %d", __LINE__, cpu)); @@ -297,7 +296,6 @@ soft_write_pmc(int cpu, int ri, pmc_value_t v) ("[soft,%d] illegal row-index %d", __LINE__, ri)); pm = soft_pcpu[cpu]->soft_hw[ri].phw_pmc; - pd = &soft_pmcdesc[ri]; KASSERT(pm, ("[soft,%d] cpu %d ri %d pmc not configured", __LINE__, cpu, ri)); @@ -312,7 +310,7 @@ soft_write_pmc(int cpu, int ri, pmc_value_t v) static int soft_release_pmc(int cpu, int ri, struct pmc *pmc) { - struct pmc_hw *phw; + struct pmc_hw *phw __diagused; enum pmc_event ev; struct pmc_soft *ps; diff --git a/sys/dev/hwpmc/hwpmc_tsc.c b/sys/dev/hwpmc/hwpmc_tsc.c index ef11e6991aed..6cd098a8113b 100644 --- a/sys/dev/hwpmc/hwpmc_tsc.c +++ b/sys/dev/hwpmc/hwpmc_tsc.c @@ -237,7 +237,7 @@ static int tsc_read_pmc(int cpu, int ri, pmc_value_t *v) { struct pmc *pm; - enum pmc_mode mode; + enum pmc_mode mode __diagused; const struct pmc_hw *phw; KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), @@ -265,7 +265,7 @@ tsc_read_pmc(int cpu, int ri, pmc_value_t *v) static int tsc_release_pmc(int cpu, int ri, struct pmc *pmc) { - struct pmc_hw *phw; + struct pmc_hw *phw __diagused; (void) pmc; diff --git a/sys/dev/hwpmc/hwpmc_uncore.c b/sys/dev/hwpmc/hwpmc_uncore.c index 594367c3542a..2c638833dcd9 100644 --- a/sys/dev/hwpmc/hwpmc_uncore.c +++ b/sys/dev/hwpmc/hwpmc_uncore.c @@ -189,7 +189,6 @@ static int ucf_allocate_pmc(int cpu, int ri, struct pmc *pm, const struct pmc_op_pmcallocate *a) { - enum pmc_event ev; uint32_t caps, flags; KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), @@ -206,7 +205,6 @@ ucf_allocate_pmc(int cpu, int ri, struct pmc *pm, (caps & UCF_PMC_CAPS) != caps) return (EINVAL); - ev = pm->pm_event; flags = UCF_EN; pm->pm_md.pm_ucf.pm_ucf_ctrl = (flags << (ri * 4)); @@ -718,7 +716,7 @@ ucp_start_pmc(int cpu, int ri) static int ucp_stop_pmc(int cpu, int ri) { - struct pmc *pm; + struct pmc *pm __diagused; struct uncore_cpu *cc; KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), From owner-dev-commits-src-main@freebsd.org Thu Jul 15 16:25:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 12B2F64A04A; Thu, 15 Jul 2021 16:25:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQfqv03t2z4fY3; Thu, 15 Jul 2021 16:25: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 DEA644CE7; Thu, 15 Jul 2021 16:25:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16FGPkUq046207; Thu, 15 Jul 2021 16:25:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FGPkqj046206; Thu, 15 Jul 2021 16:25:46 GMT (envelope-from git) Date: Thu, 15 Jul 2021 16:25:46 GMT Message-Id: <202107151625.16FGPkqj046206@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: b092c58c006f - main - Assert that valid PTEs are not overwritten when installing a new PTP 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: b092c58c006fd5c5c051b30ab097f5c1655e0d53 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 16:25:47 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b092c58c006fd5c5c051b30ab097f5c1655e0d53 commit b092c58c006fd5c5c051b30ab097f5c1655e0d53 Author: Mark Johnston AuthorDate: 2021-07-15 16:17:33 +0000 Commit: Mark Johnston CommitDate: 2021-07-15 16:17:33 +0000 Assert that valid PTEs are not overwritten when installing a new PTP amd64 and 32-bit ARM already had assertions to this effect. Add them to other pmaps. Reviewed by: alc, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31171 --- sys/arm64/arm64/pmap.c | 6 ++++++ sys/i386/i386/pmap.c | 5 ++++- sys/mips/mips/pmap.c | 4 ++++ sys/powerpc/aim/mmu_radix.c | 8 ++++++-- sys/riscv/riscv/pmap.c | 4 ++++ 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 678feae55c25..190b56285e76 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -1870,6 +1870,8 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) l0index = ptepindex - (NUL2E + NUL1E); l0 = &pmap->pm_l0[l0index]; + KASSERT((pmap_load(l0) & ATTR_DESCR_VALID) == 0, + ("%s: L0 entry %#lx is valid", __func__, pmap_load(l0))); pmap_store(l0, VM_PAGE_TO_PHYS(m) | L0_TABLE); } else if (ptepindex >= NUL2E) { vm_pindex_t l0index, l1index; @@ -1896,6 +1898,8 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) l1 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l0) & ~ATTR_MASK); l1 = &l1[ptepindex & Ln_ADDR_MASK]; + KASSERT((pmap_load(l1) & ATTR_DESCR_VALID) == 0, + ("%s: L1 entry %#lx is valid", __func__, pmap_load(l1))); pmap_store(l1, VM_PAGE_TO_PHYS(m) | L1_TABLE); } else { vm_pindex_t l0index, l1index; @@ -1938,6 +1942,8 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) l2 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l1) & ~ATTR_MASK); l2 = &l2[ptepindex & Ln_ADDR_MASK]; + KASSERT((pmap_load(l2) & ATTR_DESCR_VALID) == 0, + ("%s: L2 entry %#lx is valid", __func__, pmap_load(l2))); pmap_store(l2, VM_PAGE_TO_PHYS(m) | L2_TABLE); } diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index b1014b332150..ffd41304be43 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -2157,8 +2157,11 @@ _pmap_allocpte(pmap_t pmap, u_int ptepindex, u_int flags) pmap->pm_stats.resident_count++; ptepa = VM_PAGE_TO_PHYS(m); + KASSERT((pmap->pm_pdir[ptepindex] & PG_V) == 0, + ("%s: page directory entry %#jx is valid", + __func__, (uintmax_t)pmap->pm_pdir[ptepindex])); pmap->pm_pdir[ptepindex] = - (pd_entry_t) (ptepa | PG_U | PG_RW | PG_V | PG_A | PG_M); + (pd_entry_t)(ptepa | PG_U | PG_RW | PG_V | PG_A | PG_M); return (m); } diff --git a/sys/mips/mips/pmap.c b/sys/mips/mips/pmap.c index a022e7619bc5..d459bbeab1b2 100644 --- a/sys/mips/mips/pmap.c +++ b/sys/mips/mips/pmap.c @@ -1217,9 +1217,13 @@ _pmap_allocpte(pmap_t pmap, unsigned ptepindex, u_int flags) } /* Next level entry */ pde = (pd_entry_t *)*pdep; + KASSERT(pde[pdeindex] == 0, + ("%s: PTE %p is valid", __func__, pde[pdeindex])); pde[pdeindex] = (pd_entry_t)pageva; } #else + KASSERT(pmap->pm_segtab[ptepindex] == 0, + ("%s: PTE %p is valid", __func__, pmap->pm_segtab[ptepindex])); pmap->pm_segtab[ptepindex] = (pd_entry_t)pageva; #endif pmap->pm_stats.resident_count++; diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index c1f587a09e86..58fca5dec471 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -4248,8 +4248,9 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) /* Wire up a new PDPE page */ pml1index = ptepindex - (NUPDE + NUPDPE); l1e = &pmap->pm_pml1[pml1index]; + KASSERT((be64toh(*l1e) & PG_V) == 0, + ("%s: L1 entry %#lx is valid", __func__, *l1e)); pde_store(l1e, VM_PAGE_TO_PHYS(m)); - } else if (ptepindex >= NUPDE) { vm_pindex_t pml1index; vm_pindex_t pdpindex; @@ -4278,8 +4279,9 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) /* Now find the pdp page */ l2e = &l2e[pdpindex & RPTE_MASK]; + KASSERT((be64toh(*l2e) & PG_V) == 0, + ("%s: L2 entry %#lx is valid", __func__, *l2e)); pde_store(l2e, VM_PAGE_TO_PHYS(m)); - } else { vm_pindex_t pml1index; vm_pindex_t pdpindex; @@ -4324,6 +4326,8 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) /* Now we know where the page directory page is */ l3e = &l3e[ptepindex & RPTE_MASK]; + KASSERT((be64toh(*l3e) & PG_V) == 0, + ("%s: L3 entry %#lx is valid", __func__, *l3e)); pde_store(l3e, VM_PAGE_TO_PHYS(m)); } diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 50248ac79bf4..924e1aefc82f 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -1285,6 +1285,8 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) l1index = ptepindex - NUL1E; l1 = &pmap->pm_l1[l1index]; + KASSERT((pmap_load(l1) & PTE_V) == 0, + ("%s: L1 entry %#lx is valid", __func__, pmap_load(l1))); pn = (VM_PAGE_TO_PHYS(m) / PAGE_SIZE); entry = (PTE_V); @@ -1314,6 +1316,8 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) phys = PTE_TO_PHYS(pmap_load(l1)); l2 = (pd_entry_t *)PHYS_TO_DMAP(phys); l2 = &l2[ptepindex & Ln_ADDR_MASK]; + KASSERT((pmap_load(l2) & PTE_V) == 0, + ("%s: L2 entry %#lx is valid", __func__, pmap_load(l2))); pn = (VM_PAGE_TO_PHYS(m) / PAGE_SIZE); entry = (PTE_V); From owner-dev-commits-src-main@freebsd.org Thu Jul 15 16:25:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3FAB264A0D7; Thu, 15 Jul 2021 16:25: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 4GQfqw16Mxz4fqp; Thu, 15 Jul 2021 16:25: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 0C3434CE8; Thu, 15 Jul 2021 16:25: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 16FGPlnh046237; Thu, 15 Jul 2021 16:25:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FGPlMb046236; Thu, 15 Jul 2021 16:25:47 GMT (envelope-from git) Date: Thu, 15 Jul 2021 16:25:47 GMT Message-Id: <202107151625.16FGPlMb046236@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: 81f95106b8c1 - main - pf: Constify tag name and queue name helper functions 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: 81f95106b8c14d7ce935864b4705d54a8e437ed6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 16:25:48 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=81f95106b8c14d7ce935864b4705d54a8e437ed6 commit 81f95106b8c14d7ce935864b4705d54a8e437ed6 Author: Mark Johnston AuthorDate: 2021-07-15 16:17:58 +0000 Commit: Mark Johnston CommitDate: 2021-07-15 16:17:58 +0000 pf: Constify tag name and queue name helper functions No functional change intended. Reviewed by: kp MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31168 --- sys/netpfil/pf/pf_ioctl.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index e0f7216ce5fc..45d446697981 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -99,8 +99,8 @@ SDT_PROBE_DEFINE3(pf, ioctl, function, error, "char *", "int", "int"); SDT_PROBE_DEFINE2(pf, ioctl, addrule, error, "int", "int"); SDT_PROBE_DEFINE2(pf, ioctl, nvchk, error, "int", "int"); -static struct pf_kpool *pf_get_kpool(char *, u_int32_t, u_int8_t, u_int32_t, - u_int8_t, u_int8_t, u_int8_t); +static struct pf_kpool *pf_get_kpool(const char *, u_int32_t, u_int8_t, + u_int32_t, u_int8_t, u_int8_t, u_int8_t); static void pf_mv_kpool(struct pf_kpalist *, struct pf_kpalist *); static void pf_empty_kpool(struct pf_kpalist *); @@ -112,7 +112,7 @@ static int pf_rollback_altq(u_int32_t); static int pf_commit_altq(u_int32_t); static int pf_enable_altq(struct pf_altq *); static int pf_disable_altq(struct pf_altq *); -static u_int32_t pf_qname2qid(char *); +static u_int32_t pf_qname2qid(const char *); static void pf_qid_unref(u_int32_t); #endif /* ALTQ */ static int pf_begin_rules(u_int32_t *, int, const char *); @@ -188,8 +188,8 @@ static void pf_init_tagset(struct pf_tagset *, unsigned int *, static void pf_cleanup_tagset(struct pf_tagset *); static uint16_t tagname2hashindex(const struct pf_tagset *, const char *); static uint16_t tag2hashindex(const struct pf_tagset *, uint16_t); -static u_int16_t tagname2tag(struct pf_tagset *, char *); -static u_int16_t pf_tagname2tag(char *); +static u_int16_t tagname2tag(struct pf_tagset *, const char *); +static u_int16_t pf_tagname2tag(const char *); static void tag_unref(struct pf_tagset *, u_int16_t); #define DPFPRINTF(n, x) if (V_pf_status.debug >= (n)) printf x @@ -356,7 +356,7 @@ pfattach_vnet(void) } static struct pf_kpool * -pf_get_kpool(char *anchor, u_int32_t ticket, u_int8_t rule_action, +pf_get_kpool(const char *anchor, u_int32_t ticket, u_int8_t rule_action, u_int32_t rule_number, u_int8_t r_last, u_int8_t active, u_int8_t check_ticket) { @@ -549,7 +549,7 @@ tag2hashindex(const struct pf_tagset *ts, uint16_t tag) } static u_int16_t -tagname2tag(struct pf_tagset *ts, char *tagname) +tagname2tag(struct pf_tagset *ts, const char *tagname) { struct pf_tagname *tag; u_int32_t index; @@ -628,14 +628,14 @@ tag_unref(struct pf_tagset *ts, u_int16_t tag) } static u_int16_t -pf_tagname2tag(char *tagname) +pf_tagname2tag(const char *tagname) { return (tagname2tag(&V_pf_tags, tagname)); } #ifdef ALTQ static u_int32_t -pf_qname2qid(char *qname) +pf_qname2qid(const char *qname) { return ((u_int32_t)tagname2tag(&V_pf_qids, qname)); } From owner-dev-commits-src-main@freebsd.org Thu Jul 15 16:25:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D72764A285; Thu, 15 Jul 2021 16:25: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 4GQfqx24YJz4fxd; Thu, 15 Jul 2021 16:25: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 2EC185078; Thu, 15 Jul 2021 16:25: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 16FGPnTG046261; Thu, 15 Jul 2021 16:25:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FGPnnT046260; Thu, 15 Jul 2021 16:25:49 GMT (envelope-from git) Date: Thu, 15 Jul 2021 16:25:49 GMT Message-Id: <202107151625.16FGPnnT046260@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: 44de1834b53f - main - nfsclient: Avoid copying uninitialized bytes into statfs 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: 44de1834b53f4654cc2f6d76406f5705f8167927 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 16:25:49 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=44de1834b53f4654cc2f6d76406f5705f8167927 commit 44de1834b53f4654cc2f6d76406f5705f8167927 Author: Mark Johnston AuthorDate: 2021-07-15 16:18:17 +0000 Commit: Mark Johnston CommitDate: 2021-07-15 16:18:17 +0000 nfsclient: Avoid copying uninitialized bytes into statfs hst will be nul-terminated but the remaining space in the buffer is left uninitialized. Avoid copying the entire buffer to ensure that uninitialized bytes are not leaked via statfs(2). Reported by: KMSAN Reviewed by: rmacklem MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31167 --- sys/fs/nfsclient/nfs_clvfsops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index 57eae3f1f1cf..6323451adf54 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -1594,7 +1594,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, nmp->nm_fhsize = argp->fhsize; if (nmp->nm_fhsize > 0) bcopy((caddr_t)argp->fh, (caddr_t)nmp->nm_fh, argp->fhsize); - bcopy(hst, mp->mnt_stat.f_mntfromname, MNAMELEN); + strlcpy(mp->mnt_stat.f_mntfromname, hst, MNAMELEN); nmp->nm_nam = nam; /* Set up the sockets and per-host congestion */ nmp->nm_sotype = argp->sotype; From owner-dev-commits-src-main@freebsd.org Thu Jul 15 16:25:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CC4B64A318; Thu, 15 Jul 2021 16:25: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 4GQfqy3Dlvz4fxl; Thu, 15 Jul 2021 16:25: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 455FF4D38; Thu, 15 Jul 2021 16:25: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 16FGPo6f046286; Thu, 15 Jul 2021 16:25:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FGPoSk046285; Thu, 15 Jul 2021 16:25:50 GMT (envelope-from git) Date: Thu, 15 Jul 2021 16:25:50 GMT Message-Id: <202107151625.16FGPoSk046285@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: 0fcafe8516d1 - main - eli: Zero pad bytes that arise when certain auth algorithms are used 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: 0fcafe8516d170852aa73f029a6a28bed1e29292 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 16:25:50 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0fcafe8516d170852aa73f029a6a28bed1e29292 commit 0fcafe8516d170852aa73f029a6a28bed1e29292 Author: Mark Johnston AuthorDate: 2021-07-15 16:23:04 +0000 Commit: Mark Johnston CommitDate: 2021-07-15 16:23:04 +0000 eli: Zero pad bytes that arise when certain auth algorithms are used When authentication is configured, GELI ensures that the amount of data per sector is a multiple of 16 bytes. This is done in eli_metadata_softc(). When the digest size is not a multiple of 16 bytes, this leaves some extra pad bytes at the end of every sector, and they were not being zeroed before being written to disk. In particular, this happens with the HMAC/SHA1, HMAC/RIPEMD160 and HMAC/SHA384 data authentication algorithms. This change ensures that they are zeroed before being written to disk. Reported by: KMSAN Reviewed by: delphij, asomers MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31170 --- sys/geom/eli/g_eli_integrity.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/geom/eli/g_eli_integrity.c b/sys/geom/eli/g_eli_integrity.c index e79ec136aa2e..e97924b8df08 100644 --- a/sys/geom/eli/g_eli_integrity.c +++ b/sys/geom/eli/g_eli_integrity.c @@ -515,6 +515,17 @@ g_eli_auth_run(struct g_eli_worker *wr, struct bio *bp) if (bp->bio_cmd == BIO_WRITE) memset(data + sc->sc_alen + data_secsize, 0, encr_secsize - sc->sc_alen - data_secsize); + } else if (data_secsize + sc->sc_alen != encr_secsize) { + /* + * If the HMAC size is not a multiple of 128 bits, the + * per-sector data size is rounded down to ensure that + * encryption can be performed without requiring any + * padding. In this case, each sector contains unused + * bytes. + */ + if (bp->bio_cmd == BIO_WRITE) + memset(data + sc->sc_alen + data_secsize, 0, + encr_secsize - sc->sc_alen - data_secsize); } if (bp->bio_cmd == BIO_WRITE) { From owner-dev-commits-src-main@freebsd.org Thu Jul 15 16:40:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8F89A64A555; Thu, 15 Jul 2021 16:40: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 4GQg9B2XPyz4j5m; Thu, 15 Jul 2021 16:40: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 30FB252C5; Thu, 15 Jul 2021 16:40: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 16FGekCE068524; Thu, 15 Jul 2021 16:40:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FGekEG068523; Thu, 15 Jul 2021 16:40:46 GMT (envelope-from git) Date: Thu, 15 Jul 2021 16:40:46 GMT Message-Id: <202107151640.16FGekEG068523@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: 8c3ea3f4c4f3 - main - Create namespace for the symbols added during 14-CURRENT cycle. 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: 8c3ea3f4c4f343e5ecf653e2a50e1fb178cd0b02 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 16:40:46 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8c3ea3f4c4f343e5ecf653e2a50e1fb178cd0b02 commit 8c3ea3f4c4f343e5ecf653e2a50e1fb178cd0b02 Author: Konstantin Belousov AuthorDate: 2021-07-14 15:41:05 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-15 16:40:28 +0000 Create namespace for the symbols added during 14-CURRENT cycle. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31180 --- lib/libc/Versions.def | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/libc/Versions.def b/lib/libc/Versions.def index fce33f53a475..fea6693cee8a 100644 --- a/lib/libc/Versions.def +++ b/lib/libc/Versions.def @@ -35,6 +35,9 @@ FBSD_1.5 { FBSD_1.6 { } FBSD_1.5; +FBSD_1.7 { +} FBSD_1.6; + # This is our private namespace. Any global interfaces that are # strictly for use only by other FreeBSD applications and libraries # are listed here. We use a separate namespace so we can write @@ -42,4 +45,4 @@ FBSD_1.6 { # # Please do NOT increment the version of this namespace. FBSDprivate_1.0 { -} FBSD_1.6; +} FBSD_1.7; From owner-dev-commits-src-main@freebsd.org Thu Jul 15 16:40:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA10F64A46F; Thu, 15 Jul 2021 16:40: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 4GQg9C3nrpz4j0V; Thu, 15 Jul 2021 16:40: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 541614F7D; Thu, 15 Jul 2021 16:40: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 16FGeli2068548; Thu, 15 Jul 2021 16:40:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FGelvY068547; Thu, 15 Jul 2021 16:40:47 GMT (envelope-from git) Date: Thu, 15 Jul 2021 16:40:47 GMT Message-Id: <202107151640.16FGelvY068547@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: ee37f64cf875 - main - libc: add mempcpy(3) and wmempcpy(3) 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: ee37f64cf875255338f917a9da76c643cf59786c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 16:40:48 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ee37f64cf875255338f917a9da76c643cf59786c commit ee37f64cf875255338f917a9da76c643cf59786c Author: Konstantin Belousov AuthorDate: 2021-07-14 15:41:36 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-15 16:40:28 +0000 libc: add mempcpy(3) and wmempcpy(3) Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31180 --- include/string.h | 3 +++ include/wchar.h | 3 +++ lib/libc/string/Makefile.inc | 6 ++++-- lib/libc/string/Symbol.map | 5 +++++ lib/libc/string/memcpy.3 | 19 +++++++++++++++---- lib/libc/string/mempcpy.c | 41 +++++++++++++++++++++++++++++++++++++++++ lib/libc/string/wmemchr.3 | 10 +++++++--- lib/libc/string/wmempcpy.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 120 insertions(+), 9 deletions(-) diff --git a/include/string.h b/include/string.h index 540258cfcf4f..15d4dc7e9701 100644 --- a/include/string.h +++ b/include/string.h @@ -66,6 +66,9 @@ void *memcpy(void * __restrict, const void * __restrict, size_t); void *memmem(const void *, size_t, const void *, size_t) __pure; #endif void *memmove(void *, const void *, size_t); +#if __BSD_VISIBLE +void *mempcpy(void * __restrict, const void * __restrict, size_t); +#endif void *memset(void *, int, size_t); #if __POSIX_VISIBLE >= 200809 char *stpcpy(char * __restrict, const char * __restrict); diff --git a/include/wchar.h b/include/wchar.h index 1c9d232d47e3..78f2f010048f 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -172,6 +172,9 @@ wchar_t *wmemchr(const wchar_t *, wchar_t, size_t) __pure; int wmemcmp(const wchar_t *, const wchar_t *, size_t) __pure; wchar_t *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t); wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t); +#if __BSD_VISIBLE +wchar_t *wmempcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t); +#endif wchar_t *wmemset(wchar_t *, wchar_t, size_t); int wprintf(const wchar_t * __restrict, ...); int wscanf(const wchar_t * __restrict, ...); diff --git a/lib/libc/string/Makefile.inc b/lib/libc/string/Makefile.inc index 6e6a3f42f723..6945155812af 100644 --- a/lib/libc/string/Makefile.inc +++ b/lib/libc/string/Makefile.inc @@ -10,7 +10,7 @@ CFLAGS+= -I${LIBC_SRCTOP}/locale MISRCS+=bcmp.c bcopy.c bzero.c explicit_bzero.c \ ffs.c ffsl.c ffsll.c fls.c flsl.c flsll.c \ memccpy.c memchr.c memrchr.c memcmp.c \ - memcpy.c memmem.c memmove.c memset.c memset_s.c \ + memcpy.c memmem.c memmove.c mempcpy.c memset.c memset_s.c \ stpcpy.c stpncpy.c strcasecmp.c \ strcat.c strcasestr.c strchr.c strchrnul.c strcmp.c strcoll.c strcpy.c\ strcspn.c strdup.c strerror.c strlcat.c strlcpy.c strlen.c strmode.c \ @@ -25,7 +25,7 @@ MISRCS+=bcmp.c bcopy.c bzero.c explicit_bzero.c \ wcsncpy.c wcsnlen.c wcspbrk.c \ wcsrchr.c wcsspn.c wcsstr.c wcstok.c wcswidth.c wcsxfrm.c wmemchr.c \ wmemcmp.c \ - wmemcpy.c wmemmove.c wmemset.c + wmemcpy.c wmemmove.c wmempcpy.c wmemset.c SYM_MAPS+= ${LIBC_SRCTOP}/string/Symbol.map @@ -50,6 +50,7 @@ MLINKS+=ffs.3 ffsl.3 \ ffs.3 flsll.3 MLINKS+=index.3 rindex.3 MLINKS+=memchr.3 memrchr.3 +MLINKS+=memcpy.3 mempcpy.3 MLINKS+=memset.3 memset_s.3 MLINKS+=strcasecmp.3 strncasecmp.3 \ strcasecmp.3 strcasecmp_l.3 \ @@ -101,4 +102,5 @@ MLINKS+=wmemchr.3 wcpcpy.3 \ wmemchr.3 wmemcmp.3 \ wmemchr.3 wmemcpy.3 \ wmemchr.3 wmemmove.3 \ + wmemchr.3 wmempcpy.3 \ wmemchr.3 wmemset.3 diff --git a/lib/libc/string/Symbol.map b/lib/libc/string/Symbol.map index 450b745c7e0a..ec45d7fd7ddb 100644 --- a/lib/libc/string/Symbol.map +++ b/lib/libc/string/Symbol.map @@ -114,6 +114,11 @@ FBSD_1.6 { strerror_l; }; +FBSD_1.7 { + mempcpy; + wmempcpy; +}; + FBSDprivate_1.0 { __strtok_r; }; diff --git a/lib/libc/string/memcpy.3 b/lib/libc/string/memcpy.3 index febc0fa34dd9..c65e4145264a 100644 --- a/lib/libc/string/memcpy.3 +++ b/lib/libc/string/memcpy.3 @@ -32,7 +32,7 @@ .\" @(#)memcpy.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd July 14, 2021 .Dt MEMCPY 3 .Os .Sh NAME @@ -44,11 +44,15 @@ .In string.h .Ft void * .Fn memcpy "void *dst" "const void *src" "size_t len" +.Ft void * +.Fn mempcpy "void *dst" "const void *src" "size_t len" .Sh DESCRIPTION The .Fn memcpy -function -copies +and +.Fn mempcpy +functions +copy .Fa len bytes from string .Fa src @@ -65,12 +69,17 @@ The function returns the original value of .Fa dst . +.Pp +The +.Fn mempcpy +function returns a pointer to the byte after the last written byte. .Sh SEE ALSO .Xr bcopy 3 , .Xr memccpy 3 , .Xr memmove 3 , .Xr strcpy 3 , .Xr wmemcpy 3 +.Xr wmempcpy 3 .Sh STANDARDS The .Fn memcpy @@ -80,7 +89,9 @@ conforms to .Sh BUGS In this implementation .Fn memcpy -is implemented using +and +.Fn mempcpy +are implemented using .Xr bcopy 3 , and therefore the strings may overlap. On other systems, copying overlapping strings may produce surprises. diff --git a/lib/libc/string/mempcpy.c b/lib/libc/string/mempcpy.c new file mode 100644 index 000000000000..12c0d791e9d3 --- /dev/null +++ b/lib/libc/string/mempcpy.c @@ -0,0 +1,41 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 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 + +void * +mempcpy(void *__restrict dst, const void *__restrict src, size_t len) +{ + return ((char *)memcpy(dst, src, len) + len); +} diff --git a/lib/libc/string/wmemchr.3 b/lib/libc/string/wmemchr.3 index 37ba05031ca9..8a926eef456a 100644 --- a/lib/libc/string/wmemchr.3 +++ b/lib/libc/string/wmemchr.3 @@ -35,7 +35,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 4, 2009 +.Dd July 14, 2021 .Dt WMEMCHR 3 .Os .Sh NAME @@ -43,6 +43,7 @@ .Nm wmemcmp , .Nm wmemcpy , .Nm wmemmove , +.Nm wmempcpy , .Nm wmemset , .Nm wcpcpy , .Nm wcpncpy , @@ -79,6 +80,8 @@ .Ft wchar_t * .Fn wmemmove "wchar_t *s1" "const wchar_t *s2" "size_t n" .Ft wchar_t * +.Fn wmempcpy "wchar_t * restrict s1" "const wchar_t * restrict s2" "size_t n" +.Ft wchar_t * .Fn wmemset "wchar_t *s" "wchar_t c" "size_t n" .Ft wchar_t * .Fn wcpcpy "wchar_t *s1" "wchar_t *s2" @@ -168,7 +171,8 @@ and which conform to .St -p1003.1-2008 ; and -.Fn wcslcat -and +.Fn wcslcat , .Fn wcslcpy , +and +.Fn wmempcpy , which are extensions. diff --git a/lib/libc/string/wmempcpy.c b/lib/libc/string/wmempcpy.c new file mode 100644 index 000000000000..208d62a26849 --- /dev/null +++ b/lib/libc/string/wmempcpy.c @@ -0,0 +1,42 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 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 + +wchar_t * +wmempcpy(wchar_t *__restrict dst, const wchar_t *__restrict src, size_t len) +{ + return (wmemcpy(dst, src, len) + len); +} From owner-dev-commits-src-main@freebsd.org Thu Jul 15 22:15:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C6EE652089; Thu, 15 Jul 2021 22:15:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQpbg6Trxz4g0l; Thu, 15 Jul 2021 22:15:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6A8611CC8; Thu, 15 Jul 2021 22:15:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16FMFhJW020499; Thu, 15 Jul 2021 22:15:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FMFhVB020498; Thu, 15 Jul 2021 22:15:43 GMT (envelope-from git) Date: Thu, 15 Jul 2021 22:15:43 GMT Message-Id: <202107152215.16FMFhVB020498@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: 587c054bea0f - main - nanobsd: Use gpart and create code image before full disk image 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: 587c054bea0f652fdbd86baf5807f21c904ac2ad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 22:15:44 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=587c054bea0f652fdbd86baf5807f21c904ac2ad commit 587c054bea0f652fdbd86baf5807f21c904ac2ad Author: Arrigo Marchiori AuthorDate: 2021-07-15 22:06:51 +0000 Commit: Warner Losh CommitDate: 2021-07-15 22:15:01 +0000 nanobsd: Use gpart and create code image before full disk image The attached patch brings two main changes to the nanobsd script: 1- gpart is used instead of fdisk; 2- the code image is created first, and then used to ``assemble'' the full disk image. The patch was first proposed on the freebsd-embedded list: http://lists.freebsd.org/pipermail/freebsd-embedded/2012-June/001580.html and is currently under discussion: http://lists.freebsd.org/pipermail/freebsd-embedded/2014-January/002216.html Another effect is that the -f option ("suppress code slice extraction") now imples the -i option ("suppress disk image build"). imp@ applied Patch by hand to new legacy.sh, plus tweaked for NANO_LOG vs NANO_OBJ confusion in original. PR: 186030 Reviewed by: imp@ Differential Revision: https://reviews.freebsd.org/D31102 --- tools/tools/nanobsd/defaults.sh | 4 +- tools/tools/nanobsd/legacy.sh | 132 ++++++++++++++++++++++++++-------------- tools/tools/nanobsd/nanobsd.sh | 17 ++++-- 3 files changed, 103 insertions(+), 50 deletions(-) diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh index 1ebc88fecac3..7bc74c42170e 100755 --- a/tools/tools/nanobsd/defaults.sh +++ b/tools/tools/nanobsd/defaults.sh @@ -161,6 +161,8 @@ NANO_SLICE_ROOT=s1 NANO_SLICE_ALTROOT=s2 NANO_SLICE_CFG=s3 NANO_SLICE_DATA=s4 +NANO_PARTITION_ROOT=a +NANO_PARTITION_ALTROOT=a NANO_ROOT=s1a NANO_ALTROOT=s2a @@ -853,7 +855,7 @@ usage ( ) { echo "Usage: $0 [-bfhiKknqvwX] [-c config_file]" echo " -b suppress builds (both kernel and world)" echo " -c specify config file" - echo " -f suppress code slice extraction" + echo " -f suppress code slice extraction (implies -i)" echo " -h print this help summary page" echo " -i suppress disk image build" echo " -K suppress installkernel" diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh index b59a9e795b66..0a966c8c127e 100644 --- a/tools/tools/nanobsd/legacy.sh +++ b/tools/tools/nanobsd/legacy.sh @@ -35,30 +35,18 @@ # Functions and variable definitions used by the legacy nanobsd # image building system. -create_diskimage ( ) ( - pprint 2 "build diskimage" - pprint 3 "log: ${NANO_LOG}/_.di" - - ( +calculate_partitioning ( ) ( echo $NANO_MEDIASIZE $NANO_IMAGES \ $NANO_SECTS $NANO_HEADS \ $NANO_CODESIZE $NANO_CONFSIZE $NANO_DATASIZE | awk ' { - printf "# %s\n", $0 - # size of cylinder in sectors cs = $3 * $4 # number of full cylinders on media cyl = int ($1 / cs) - # output fdisk geometry spec, truncate cyls to 1023 - if (cyl <= 1023) - print "g c" cyl " h" $4 " s" $3 - else - print "g c" 1023 " h" $4 " s" $3 - if ($7 > 0) { # size of data partition in full cylinders dsl = int (($7 + cs - 1) / cs) @@ -69,44 +57,100 @@ create_diskimage ( ) ( # size of config partition in full cylinders csl = int (($6 + cs - 1) / cs) + # size of image partition(s) in full cylinders if ($5 == 0) { - # size of image partition(s) in full cylinders isl = int ((cyl - dsl - csl) / $2) } else { isl = int (($5 + cs - 1) / cs) } # First image partition start at second track - print "p 1 165 " $3, isl * cs - $3 + print $3, isl * cs - $3 c = isl * cs; # Second image partition (if any) also starts offset one # track to keep them identical. if ($2 > 1) { - print "p 2 165 " $3 + c, isl * cs - $3 + print $3 + c, isl * cs - $3 c += isl * cs; } # Config partition starts at cylinder boundary. - print "p 3 165 " c, csl * cs + print c, csl * cs c += csl * cs # Data partition (if any) starts at cylinder boundary. if ($7 > 0) { - print "p 4 165 " c, dsl * cs + print c, dsl * cs } else if ($7 < 0 && $1 > c) { - print "p 4 165 " c, $1 - c + print c, $1 - c } else if ($1 < c) { print "Disk space overcommitted by", \ c - $1, "sectors" > "/dev/stderr" exit 2 } - # Force slice 1 to be marked active. This is necessary - # for booting the image from a USB device to work. - print "a 1" } - ' > ${NANO_LOG}/_.fdisk + ' > ${NANO_LOG}/_.partitioning +) + +create_code_slice ( ) ( + pprint 2 "build code slice" + pprint 3 "log: ${NANO_OBJ}/_.cs" + + ( + IMG=${NANO_DISKIMGDIR}/_.disk.image + MNT=${NANO_OBJ}/_.mnt + mkdir -p ${MNT} + CODE_SIZE=`head -n 1 ${NANO_LOG}/_.partitioning | awk '{ print $2 }'` + + if [ "${NANO_MD_BACKING}" = "swap" ] ; then + MD=`mdconfig -a -t swap -s ${CODE_SIZE} -x ${NANO_SECTS} \ + -y ${NANO_HEADS}` + else + echo "Creating md backing file..." + rm -f ${IMG} + dd if=/dev/zero of=${IMG} seek=${CODE_SIZE} count=0 + MD=`mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \ + -y ${NANO_HEADS}` + fi + + trap "echo 'Running exit trap code' ; df -i ${MNT} ; umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT + + bsdlabel -w ${MD} + if [ -f ${NANO_WORLDDIR}/boot/boot ]; then + echo "Making bootable partition" + gpart bootcode -b ${NANO_WORLDDIR}/boot/boot ${MD} + else + echo "Partition will not be bootable" + fi + bsdlabel ${MD} + + # Create first image + populate_slice /dev/${MD}${NANO_PARTITION_ROOT} ${NANO_WORLDDIR} ${MNT} "${NANO_ROOT}" + mount /dev/${MD}a ${MNT} + echo "Generating mtree..." + ( cd ${MNT} && mtree -c ) > ${NANO_OBJ}/_.mtree + ( cd ${MNT} && du -k ) > ${NANO_OBJ}/_.du + nano_umount ${MNT} + + if [ "${NANO_MD_BACKING}" = "swap" ] ; then + echo "Writing out _.disk.image..." + dd conv=sparse if=/dev/${MD} of=${NANO_DISKIMGDIR}/_.disk.image bs=64k + fi + mdconfig -d -u $MD + + trap - 1 2 15 EXIT + + ) > ${NANO_OBJ}/_.cs 2>&1 +) + + +create_diskimage ( ) ( + pprint 2 "build diskimage" + pprint 3 "log: ${NANO_OBJ}/_.di" + + ( IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME} MNT=${NANO_OBJ}/_.mnt @@ -123,29 +167,34 @@ create_diskimage ( ) ( -y ${NANO_HEADS}` fi + awk ' + BEGIN { + # Create MBR partition table + print "gpart create -s mbr $1" + } + { + # Make partition + print "gpart add -t freebsd -b ", $1, " -s ", $2, " $1" + } + END { + # Force slice 1 to be marked active. This is necessary + # for booting the image from a USB device to work. + print "gpart set -a active -i 1 $1" + } + ' ${NANO_LOG}/_.partitioning > ${NANO_OBJ}/_.gpart + trap "echo 'Running exit trap code' ; df -i ${MNT} ; nano_umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT - fdisk -i -f ${NANO_LOG}/_.fdisk ${MD} - fdisk ${MD} + sh ${NANO_OBJ}/_.gpart ${MD} + gpart show ${MD} # XXX: params # XXX: pick up cached boot* files, they may not be in image anymore. if [ -f ${NANO_WORLDDIR}/${NANO_BOOTLOADER} ]; then - boot0cfg -B -b ${NANO_WORLDDIR}/${NANO_BOOTLOADER} ${NANO_BOOT0CFG} ${MD} - fi - if [ -f ${NANO_WORLDDIR}/boot/boot ]; then - bsdlabel -w -B -b ${NANO_WORLDDIR}/boot/boot ${MD}${NANO_SLICE_ROOT} - else - bsdlabel -w ${MD}${NANO_SLICE_ROOT} + gpart bootcode -b ${NANO_WORLDDIR}/${NANO_BOOTLOADER} ${NANO_BOOTFLAGS} ${MD} fi - bsdlabel ${MD}${NANO_SLICE_ROOT} - # Create first image - populate_slice /dev/${MD}${NANO_ROOT} ${NANO_WORLDDIR} ${MNT} "${NANO_ROOT}" - mount /dev/${MD}${NANO_ROOT} ${MNT} - echo "Generating mtree..." - ( cd "${MNT}" && mtree -c ) > ${NANO_LOG}/_.mtree - ( cd "${MNT}" && du -k ) > ${NANO_LOG}/_.du - nano_umount "${MNT}" + echo "Writing code image..." + dd conv=sparse if=${NANO_DISKIMGDIR}/_.disk.image of=/dev/${MD}${NANO_SLICE_ROOT} bs=64k if [ $NANO_IMAGES -gt 1 -a $NANO_INIT_IMG2 -gt 0 ] ; then # Duplicate to second image (if present) @@ -190,11 +239,6 @@ create_diskimage ( ) ( dd conv=sparse if=/dev/${MD} of=${IMG} bs=64k fi - if ${do_copyout_partition} ; then - echo "Writing out ${NANO_IMG1NAME}..." - dd conv=sparse if=/dev/${MD}${NANO_SLICE_ROOT} \ - of=${NANO_DISKIMGDIR}/${NANO_IMG1NAME} bs=64k - fi mdconfig -d -u $MD trap - 1 2 15 EXIT diff --git a/tools/tools/nanobsd/nanobsd.sh b/tools/tools/nanobsd/nanobsd.sh index 89d0bed60b7a..c5c680025fc7 100755 --- a/tools/tools/nanobsd/nanobsd.sh +++ b/tools/tools/nanobsd/nanobsd.sh @@ -40,9 +40,9 @@ do_clean=true do_kernel=true do_installkernel=true do_world=true +do_code=true do_installworld=true do_image=true -do_copyout_partition=true do_native_xtools=false do_prep_image=true @@ -94,7 +94,8 @@ do shift ;; -f) - do_copyout_partition=false + do_code=false + do_image=false shift ;; -h) @@ -215,10 +216,16 @@ if $do_prep_image ; then else pprint 2 "Skipping image prep (as instructed)" fi -if $do_image ; then - create_diskimage +if $do_code ; then + calculate_partitioning + create_code_slice + if $do_image ; then + create_diskimage + else + pprint 2 "Skipping image build (as instructed)" + fi else - pprint 2 "Skipping image build (as instructed)" + pprint 2 "Skipping code and image build (as instructed)" fi last_orders From owner-dev-commits-src-main@freebsd.org Thu Jul 15 22:15:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 42169651876; Thu, 15 Jul 2021 22:15:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQpbj0cWNz4gD5; Thu, 15 Jul 2021 22:15:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E96A011E22; Thu, 15 Jul 2021 22:15: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 16FMFiqE020523; Thu, 15 Jul 2021 22:15:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FMFirG020522; Thu, 15 Jul 2021 22:15:44 GMT (envelope-from git) Date: Thu, 15 Jul 2021 22:15:44 GMT Message-Id: <202107152215.16FMFirG020522@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: 7e3a794be375 - main - nanobsd: default to -j $hw.ncpu 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: 7e3a794be3752d21fe760cfb2a38665532c4b6b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 22:15:45 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7e3a794be3752d21fe760cfb2a38665532c4b6b4 commit 7e3a794be3752d21fe760cfb2a38665532c4b6b4 Author: Warner Losh AuthorDate: 2021-07-15 22:07:51 +0000 Commit: Warner Losh CommitDate: 2021-07-15 22:15:01 +0000 nanobsd: default to -j $hw.ncpu For paralllel builds, default to using all the CPUs on the system. The old default of -j 3 was too few. Sponsored by: Netflix --- tools/tools/nanobsd/defaults.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh index 7bc74c42170e..77c0e216ec80 100755 --- a/tools/tools/nanobsd/defaults.sh +++ b/tools/tools/nanobsd/defaults.sh @@ -67,7 +67,8 @@ NANO_PKG_META_BASE=/var/db # Make & parallel Make NANO_MAKE="make" -NANO_PMAKE="make -j 3" +NANO_NCPU=$(sysctl -n hw.ncpu) +NANO_PMAKE="make -j $NANO_NCPU" # The default name for any image we create. NANO_IMGNAME="_.disk.full" @@ -920,6 +921,7 @@ set_defaults_and_export ( ) { export_var NANO_MAKE_CONF_INSTALL export_var NANO_MEDIASIZE export_var NANO_NAME + export_var NANO_NCPU export_var NANO_NEWFS export_var NANO_OBJ export_var NANO_PMAKE From owner-dev-commits-src-main@freebsd.org Thu Jul 15 22:15:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 693BB652021; Thu, 15 Jul 2021 22:15:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQpbk1jhYz4fxQ; Thu, 15 Jul 2021 22:15:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0865A11E23; Thu, 15 Jul 2021 22:15:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16FMFjYe020547; Thu, 15 Jul 2021 22:15:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FMFjJk020546; Thu, 15 Jul 2021 22:15:45 GMT (envelope-from git) Date: Thu, 15 Jul 2021 22:15:45 GMT Message-Id: <202107152215.16FMFjJk020546@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: e44c62068170 - main - pcengines: Fix kernel config 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: e44c62068170987e37ed2d8dea6a035fdc691fc2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 22:15:46 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e44c62068170987e37ed2d8dea6a035fdc691fc2 commit e44c62068170987e37ed2d8dea6a035fdc691fc2 Author: Warner Losh AuthorDate: 2021-07-15 22:11:11 +0000 Commit: Warner Losh CommitDate: 2021-07-15 22:15:01 +0000 pcengines: Fix kernel config Update the old ALIX config to remove devices, add iflib and remove trailing white space. Sponsored by: Netflix --- tools/tools/nanobsd/pcengines/ALIX_DSK | 127 +++++++++++++++--------------- tools/tools/nanobsd/pcengines/common.conf | 3 +- 2 files changed, 65 insertions(+), 65 deletions(-) diff --git a/tools/tools/nanobsd/pcengines/ALIX_DSK b/tools/tools/nanobsd/pcengines/ALIX_DSK index e11f7de4f2f4..f82bbfbd85d8 100644 --- a/tools/tools/nanobsd/pcengines/ALIX_DSK +++ b/tools/tools/nanobsd/pcengines/ALIX_DSK @@ -4,83 +4,84 @@ cpu I586_CPU ident ALIX_DSK -makeoptions DEBUG=-g +makeoptions DEBUG=-g options CPU_GEODE -options SCHED_ULE -options PREEMPTION -options INET -options INET6 -options FFS -options SOFTUPDATES -options UFS_ACL -options UFS_DIRHASH +options SCHED_ULE +options PREEMPTION +options INET +options INET6 +options FFS +options SOFTUPDATES +options UFS_ACL +options UFS_DIRHASH options NFSCL # Network Filesystem Client -options NFSLOCKD -options MSDOSFS -options CD9660 -options PROCFS -options PSEUDOFS -options GEOM_PART_GPT -options GEOM_LABEL -options COMPAT_43TTY +options NFSLOCKD +options MSDOSFS +options CD9660 +options PROCFS +options PSEUDOFS +options GEOM_PART_GPT +options GEOM_LABEL +options COMPAT_43TTY options COMPAT_FREEBSD4 # Compatible with FreeBSD4 options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 options COMPAT_FREEBSD7 # Compatible with FreeBSD7 options COMPAT_FREEBSD9 # Compatible with FreeBSD9 options COMPAT_FREEBSD10 # Compatible with FreeBSD10 -options SCSI_DELAY=5000 -options SYSVSHM -options SYSVMSG -options SYSVSEM -options P1003_1B_SEMAPHORES +options COMPAT_FREEBSD11 # Compatible with FreeBSD11 +options COMPAT_FREEBSD12 # Compatible with FreeBSD12 +options SCSI_DELAY=5000 +options SYSVSHM +options SYSVMSG +options SYSVSEM +options P1003_1B_SEMAPHORES options _KPOSIX_PRIORITY_SCHEDULING -options PRINTF_BUFR_SIZE=128 -device apic +options PRINTF_BUFR_SIZE=128 +device apic device cpufreq device acpi device pci device fdc device ata -options ATA_STATIC_ID -device scbus -device da -device sa -device cd -device pass -device uart -device em -device miibus -device vr -device wlan -options IEEE80211_DEBUG -options IEEE80211_SUPPORT_MESH -device wlan_wep -device wlan_ccmp -device wlan_tkip -device wlan_amrr -device an -device ath -device ath_hal -device ath_rate_sample -device wi -device loop -device ether -device tun -device pty -device md -device gif -device firmware -device bpf -device uhci -device ohci -device ehci -device usb -device ulpt -device umass -device u3g -device ubsa -device uftdi +options ATA_STATIC_ID +device scbus +device da +device sa +device cd +device pass +device uart +device iflib +device em +device miibus +device vr +device wlan +options IEEE80211_DEBUG +options IEEE80211_SUPPORT_MESH +device wlan_wep +device wlan_ccmp +device wlan_tkip +device wlan_amrr +device ath +device ath_hal +device ath_rate_sample +device loop +device ether +device tuntap +device pty +device md +device gif +device firmware +device bpf +device uhci +device ohci +device ehci +device usb +device ulpt +device umass +device u3g +device ubsa +device uftdi options INCLUDE_CONFIG_FILE diff --git a/tools/tools/nanobsd/pcengines/common.conf b/tools/tools/nanobsd/pcengines/common.conf index 8cd870b2dd7d..632ace1841cc 100644 --- a/tools/tools/nanobsd/pcengines/common.conf +++ b/tools/tools/nanobsd/pcengines/common.conf @@ -4,13 +4,12 @@ NANO_SRC=$(pwd) NANO_SRC=${NANO_SRC%/tools/tools/nanobsd/pcengines} -NANO_OBJ=${NANO_SRC}/../${NANO_NAME}/obj +NANO_OBJ=${NANO_SRC}/../nanobsd-builds/${NANO_NAME}/obj NANO_TOOLS=$(pwd) NANO_PACKAGE_DIR=$(pwd)/Pkg #NANO_RAM_TMPVARSIZE=20480 #NANO_RAM_TMPVARSIZE=30720 NANO_RAM_TMPVARSIZE=40960 -NANO_PMAKE="make -j 8" NANO_MD_BACKING="swap" From owner-dev-commits-src-main@freebsd.org Thu Jul 15 22:15:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5356652293; Thu, 15 Jul 2021 22:15: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 4GQpbl3Dygz4gBp; Thu, 15 Jul 2021 22:15:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31AA411BC8; Thu, 15 Jul 2021 22:15:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16FMFl8n020576; Thu, 15 Jul 2021 22:15:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FMFlGG020575; Thu, 15 Jul 2021 22:15:47 GMT (envelope-from git) Date: Thu, 15 Jul 2021 22:15:47 GMT Message-Id: <202107152215.16FMFlGG020575@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: 998abf5a1274 - main - nanobsd: Bump rescue size to 8GB 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: 998abf5a1274609f9b74b3301dc0dabe659bd36b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 22:15:47 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=998abf5a1274609f9b74b3301dc0dabe659bd36b commit 998abf5a1274609f9b74b3301dc0dabe659bd36b Author: Warner Losh AuthorDate: 2021-07-15 22:11:15 +0000 Commit: Warner Losh CommitDate: 2021-07-15 22:15:01 +0000 nanobsd: Bump rescue size to 8GB Bump the rescue size from 1.2GB to just shy of 8GB as things have grown somewhat. Also make it possible to build rescue somewhere other than /usr/src. Sponsored by: Netflix --- tools/tools/nanobsd/rescue/common | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/tools/nanobsd/rescue/common b/tools/tools/nanobsd/rescue/common index d2a8a6de9e91..d14ad8b5af2b 100644 --- a/tools/tools/nanobsd/rescue/common +++ b/tools/tools/nanobsd/rescue/common @@ -1,15 +1,17 @@ # # $FreeBSD$ # +NANO_SRC=$(pwd) +NANO_SRC=${NANO_SRC%/tools/tools/nanobsd/rescue} +NANO_OBJ=${NANO_SRC}/../nanobsd-builds/${NANO_NAME}/obj NANO_TOOLS=`pwd` NANO_PACKAGE_DIR=`pwd`/Pkg NANO_RAM_TMPVARSIZE=40960 NANO_PMAKE="make -j 8" NANO_LABEL="rescue" NANO_RAM_TMPVARSIZE=40960 -#NANO_MEDIASIZE="8027712" -#NANO_MEDIASIZE="2097152" -NANO_MEDIASIZE="3932160" +#NANO_MEDIASIZE="3932160" +NANO_MEDIASIZE="16384000" NANO_SECTS="63" NANO_HEADS="16" NANO_IMAGES="2" @@ -19,7 +21,7 @@ NANO_DRIVE=da0 #NANO_MODULES= NANO_BOOTLOADER="boot/boot0" NANO_BOOT2CFG="" -NANO_MD_BACKING=swap +NANO_MD_BACKING=file # Options to put in make.conf during buildworld only CONF_BUILD=' From owner-dev-commits-src-main@freebsd.org Thu Jul 15 22:18:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6881765205D; Thu, 15 Jul 2021 22:18: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 4GQpfd2RYBz4gR7; Thu, 15 Jul 2021 22:18: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 3C8AF11CCA; Thu, 15 Jul 2021 22:18: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 16FMIH84020868; Thu, 15 Jul 2021 22: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 16FMIHsl020867; Thu, 15 Jul 2021 22:18:17 GMT (envelope-from git) Date: Thu, 15 Jul 2021 22:18:17 GMT Message-Id: <202107152218.16FMIHsl020867@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: fc9a08402317 - main - nvme: Enable interrupts after qpair fully constructed 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: fc9a0840231770bc7e7dcfe4616babdc6d4389a6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 22:18:17 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=fc9a0840231770bc7e7dcfe4616babdc6d4389a6 commit fc9a0840231770bc7e7dcfe4616babdc6d4389a6 Author: Warner Losh AuthorDate: 2021-07-15 22:17:23 +0000 Commit: Warner Losh CommitDate: 2021-07-15 22:17:23 +0000 nvme: Enable interrupts after qpair fully constructed To guard against the ill effects of a spurious interrupt during construction (or one that was bogusly pending), enable interrupts after the qpair is completely constructed. Otherwise, we can die with null pointer dereferences in nvme_qpair_process_completions. This has been observed in at least one pre-release NVMe drive where the MSIX interrupt fired while the queue was being created, before we'd started the NVMe controller card. The alternative of only turning on the interrupts after the rest was tried, but was insufficient to work around this bug and made the code more complicated w/o benefit. Reviewed by: mav, chuck Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31182 --- sys/dev/nvme/nvme_qpair.c | 49 ++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 12770f38d42e..4402d1000e67 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -675,30 +675,6 @@ nvme_qpair_construct(struct nvme_qpair *qpair, qpair->num_trackers = num_trackers; qpair->ctrlr = ctrlr; - if (ctrlr->msix_enabled) { - /* - * MSI-X vector resource IDs start at 1, so we add one to - * the queue's vector to get the corresponding rid to use. - */ - qpair->rid = qpair->vector + 1; - - qpair->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ, - &qpair->rid, RF_ACTIVE); - if (bus_setup_intr(ctrlr->dev, qpair->res, - INTR_TYPE_MISC | INTR_MPSAFE, NULL, - nvme_qpair_msix_handler, qpair, &qpair->tag) != 0) { - nvme_printf(ctrlr, "unable to setup intx handler\n"); - goto out; - } - if (qpair->id == 0) { - bus_describe_intr(ctrlr->dev, qpair->res, qpair->tag, - "admin"); - } else { - bus_describe_intr(ctrlr->dev, qpair->res, qpair->tag, - "io%d", qpair->id - 1); - } - } - mtx_init(&qpair->lock, "nvme qpair lock", NULL, MTX_DEF); /* Note: NVMe PRP format is restricted to 4-byte alignment. */ @@ -818,6 +794,31 @@ nvme_qpair_construct(struct nvme_qpair *qpair, qpair->act_tr = malloc_domainset(sizeof(struct nvme_tracker *) * qpair->num_entries, M_NVME, DOMAINSET_PREF(qpair->domain), M_ZERO | M_WAITOK); + + if (ctrlr->msix_enabled) { + /* + * MSI-X vector resource IDs start at 1, so we add one to + * the queue's vector to get the corresponding rid to use. + */ + qpair->rid = qpair->vector + 1; + + qpair->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ, + &qpair->rid, RF_ACTIVE); + if (bus_setup_intr(ctrlr->dev, qpair->res, + INTR_TYPE_MISC | INTR_MPSAFE, NULL, + nvme_qpair_msix_handler, qpair, &qpair->tag) != 0) { + nvme_printf(ctrlr, "unable to setup intx handler\n"); + goto out; + } + if (qpair->id == 0) { + bus_describe_intr(ctrlr->dev, qpair->res, qpair->tag, + "admin"); + } else { + bus_describe_intr(ctrlr->dev, qpair->res, qpair->tag, + "io%d", qpair->id - 1); + } + } + return (0); out: From owner-dev-commits-src-main@freebsd.org Thu Jul 15 22:18:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBEAB652437; Thu, 15 Jul 2021 22: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 4GQpff3sSxz4gfF; Thu, 15 Jul 2021 22: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 62A3211CCB; Thu, 15 Jul 2021 22: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 16FMII27020895; Thu, 15 Jul 2021 22:18:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FMIIqS020894; Thu, 15 Jul 2021 22:18:18 GMT (envelope-from git) Date: Thu, 15 Jul 2021 22:18:18 GMT Message-Id: <202107152218.16FMIIqS020894@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: a53541355645 - main - devd: remove pccard entries 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: a53541355645080cb6d94466f5363db0941da4fa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 22:18:19 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a53541355645080cb6d94466f5363db0941da4fa commit a53541355645080cb6d94466f5363db0941da4fa Author: Warner Losh AuthorDate: 2021-07-15 22:17:33 +0000 Commit: Warner Losh CommitDate: 2021-07-15 22:17:33 +0000 devd: remove pccard entries The pccard entries are now obsolete, remove them. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31184 --- sbin/devd/devd.conf | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/sbin/devd/devd.conf b/sbin/devd/devd.conf index 9d23b77fe96a..d88f1fde743c 100644 --- a/sbin/devd/devd.conf +++ b/sbin/devd/devd.conf @@ -179,23 +179,8 @@ nomatch 10 { bus $bus"; }; -# Some PC-CARDs don't offer numerical manufacturer/product IDs, just +# Some Cardbus cards don't offer numerical manufacturer/product IDs, just # show the CIS info there. -nomatch 20 { - match "bus" "pccard[0-9]+"; - match "manufacturer" "0xffffffff"; - match "product" "0xffffffff"; - action "logger Unknown PCCARD device: CISproduct $cisproduct \ - CIS-vendor $cisvendor bus $bus"; -}; - -nomatch 10 { - match "bus" "pccard[0-9]+"; - action "logger Unknown PCCARD device: manufacturer $manufacturer \ - product $product CISproduct $cisproduct CIS-vendor \ - $cisvendor bus $bus"; -}; - nomatch 10 { match "bus" "cardbus[0-9]+"; action "logger Unknown Cardbus device: device $device class $class \ @@ -234,26 +219,6 @@ notify 10 { /* EXAMPLES TO END OF FILE -# An example of something that a vendor might install if you were to -# add their device. This might reside in /usr/local/etc/devd/deqna.conf. -# A deqna is, in this hypothetical example, a pccard ethernet-like device. -# Students of history may know other devices by this name, and will get -# the in-jokes in this entry. -nomatch 10 { - match "bus" "pccard[0-9]+"; - match "manufacturer" "0x1234"; - match "product" "0x2323"; - action "kldload -n if_deqna"; -}; -attach 10 { - device-name "deqna[0-9]+"; - action "/etc/pccard_ether $device-name start"; -}; -detach 10 { - device-name "deqna[0-9]+"; - action "/etc/pccard_ether $device-name stop"; -}; - # Examples of notify hooks. A notify is a generic way for a kernel # subsystem to send event notification to userland. From owner-dev-commits-src-main@freebsd.org Thu Jul 15 22:35:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C86B6652A85; Thu, 15 Jul 2021 22:35: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 4GQq2g5KrKz4jqk; Thu, 15 Jul 2021 22:35: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 98F4911BF7; Thu, 15 Jul 2021 22:35: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 16FMZduZ047448; Thu, 15 Jul 2021 22:35:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FMZd1D047447; Thu, 15 Jul 2021 22:35:39 GMT (envelope-from git) Date: Thu, 15 Jul 2021 22:35:39 GMT Message-Id: <202107152235.16FMZd1D047447@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 7fb152d22935 - main - arm64: Sync icache when creating executable superpage mappings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7fb152d22935e014afcad4ddc0b3a7e3c2795762 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 22:35:39 -0000 The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=7fb152d22935e014afcad4ddc0b3a7e3c2795762 commit 7fb152d22935e014afcad4ddc0b3a7e3c2795762 Author: Alan Cox AuthorDate: 2021-07-14 17:59:49 +0000 Commit: Alan Cox CommitDate: 2021-07-15 22:34:54 +0000 arm64: Sync icache when creating executable superpage mappings Reviewed by: andrew, kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31181 --- sys/arm64/arm64/pmap.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 190b56285e76..13941f4f61ea 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -4041,7 +4041,7 @@ pmap_enter_2mpage(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, if (pmap != kernel_pmap) new_l2 |= ATTR_S1_nG; return (pmap_enter_l2(pmap, va, new_l2, PMAP_ENTER_NOSLEEP | - PMAP_ENTER_NOREPLACE | PMAP_ENTER_NORECLAIM, NULL, lockp) == + PMAP_ENTER_NOREPLACE | PMAP_ENTER_NORECLAIM, m, lockp) == KERN_SUCCESS); } @@ -4071,8 +4071,6 @@ pmap_every_pte_zero(vm_paddr_t pa) * KERN_RESOURCE_SHORTAGE if PMAP_ENTER_NOSLEEP was specified and a page table * page allocation failed. Returns KERN_RESOURCE_SHORTAGE if * PMAP_ENTER_NORECLAIM was specified and a PV entry allocation failed. - * - * The parameter "m" is only used when creating a managed, writeable mapping. */ static int pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t new_l2, u_int flags, @@ -4159,6 +4157,16 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t new_l2, u_int flags, pmap->pm_stats.wired_count += L2_SIZE / PAGE_SIZE; pmap->pm_stats.resident_count += L2_SIZE / PAGE_SIZE; + /* + * Conditionally sync the icache. See pmap_enter() for details. + */ + if ((new_l2 & ATTR_S1_XN) == 0 && ((new_l2 & ~ATTR_MASK) != + (old_l2 & ~ATTR_MASK) || (old_l2 & ATTR_S1_XN) != 0) && + pmap != kernel_pmap && m->md.pv_memattr == VM_MEMATTR_WRITE_BACK) { + cpu_icache_sync_range(PHYS_TO_DMAP(new_l2 & ~ATTR_MASK), + L2_SIZE); + } + /* * Map the superpage. */ From owner-dev-commits-src-main@freebsd.org Thu Jul 15 23:08:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 10490652B21; Thu, 15 Jul 2021 23:08: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 4GQqmV6QD8z4nym; Thu, 15 Jul 2021 23:08: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 C324F12643; Thu, 15 Jul 2021 23:08: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 16FN8QMA087513; Thu, 15 Jul 2021 23:08:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FN8Qne087512; Thu, 15 Jul 2021 23:08:26 GMT (envelope-from git) Date: Thu, 15 Jul 2021 23:08:26 GMT Message-Id: <202107152308.16FN8Qne087512@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: d4d252c49976 - main - awk: revert upstream's attempt to disallow hex strings 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: d4d252c49976de33d0a2926df733744d0b8d95fa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 23:08:27 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d4d252c49976de33d0a2926df733744d0b8d95fa commit d4d252c49976de33d0a2926df733744d0b8d95fa Author: Warner Losh AuthorDate: 2021-07-15 22:46:06 +0000 Commit: Warner Losh CommitDate: 2021-07-15 23:08:03 +0000 awk: revert upstream's attempt to disallow hex strings Upstream one-true-awk decided to disallow hex strings as numbers. This is in line with awk's behavior prior to C99, and allowed by the POSIX standard. The standard, however, allows them to be treated as numbers because that's what the standard said in the 2001 through 2004 editions. Since 2001, the nawk in FreeBSD has treated them as numbers, so restore that behavior, allowed by the standard. A number of scripts in the FreeBSD tree depend on this interpretation, including scripts to build the kernel which had mysteriously started failing for some people and not others. By re-allowing 0x hex numbers, this fixes those scripts and restores POLA. Upstream issue: https://github.com/onetrueawk/awk/issues/126 Sponsored by: Netflix Reviewed by: kevans MFC After: asap due to regression alrady merged to stable Differential Revision: https://reviews.freebsd.org/D31199 --- contrib/one-true-awk/lib.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/contrib/one-true-awk/lib.c b/contrib/one-true-awk/lib.c index 18adbd2d1fd6..6bfe5e8eaad9 100644 --- a/contrib/one-true-awk/lib.c +++ b/contrib/one-true-awk/lib.c @@ -793,9 +793,18 @@ bool is_valid_number(const char *s, bool trailing_stuff_ok, while (isspace(*s)) s++; +/* + * This test, while allowed by newer POSIX standards, represents a regression + * where hex strings were treated as numbers in nawk the whole time it has been + * in FreeBSD (since 2001). The POSIX 2001 through 2004 standards mandated this + * behavior and the current standard allows it. Deviate from upstream by restoring + * the prior FreeBSD behavior. + */ +#if 0 // no hex floating point, sorry if (s[0] == '0' && tolower(s[1]) == 'x') return false; +#endif // allow +nan, -nan, +inf, -inf, any other letter, no if (s[0] == '+' || s[0] == '-') { From owner-dev-commits-src-main@freebsd.org Fri Jul 16 00:33:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04178654E73; Fri, 16 Jul 2021 00:33:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQsfg6bcdz3JCG; Fri, 16 Jul 2021 00:33:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA7A513D9E; Fri, 16 Jul 2021 00:33:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16G0XVlX008031; Fri, 16 Jul 2021 00:33:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16G0XV3o008030; Fri, 16 Jul 2021 00:33:31 GMT (envelope-from git) Date: Fri, 16 Jul 2021 00:33:31 GMT Message-Id: <202107160033.16G0XV3o008030@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: 5ede4fc06d84 - main - UPDATING: Not unusual side effect of the awk bug fixed in d4d252c49976 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: 5ede4fc06d842dad5b3c7e5112fc8a6877bbc6e2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 00:33:32 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5ede4fc06d842dad5b3c7e5112fc8a6877bbc6e2 commit 5ede4fc06d842dad5b3c7e5112fc8a6877bbc6e2 Author: Warner Losh AuthorDate: 2021-07-16 00:30:53 +0000 Commit: Warner Losh CommitDate: 2021-07-16 00:30:53 +0000 UPDATING: Not unusual side effect of the awk bug fixed in d4d252c49976 You might not be able to build the kernel if you have an awk between Jul 7th and today. It does not affect all platforms due to the nature of the bug (so amd64 is unaffected in stable/13 or current, but is affected in stable/12. i386 seems to be affected everywhere). Sponsored by: Netflix --- UPDATING | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/UPDATING b/UPDATING index 4a8fde856e83..929b7b479060 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,18 @@ 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".) +20210715: + The 20210707 awk update brought in a change in behavior. This has + been corrected as of d4d252c49976. Between these dates, if you + installed a new awk binary, you may not be able to build a new + kernel because the change in behavior affected the genoffset + script used to build the kernel. If you did update, the fix is + to update your sources past the above hash and do + % cd usr.bin/awk + % make clean all + % sudo -E make install + to enable building kernels again. + 20210708: Commit 1e0a518d6548 changed the internal KAPI between the NFS modules. They all need to be rebuilt from sources. I did not From owner-dev-commits-src-main@freebsd.org Fri Jul 16 02:26:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56869656B5F; Fri, 16 Jul 2021 02:26:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQw8t1m7rz3rCj; Fri, 16 Jul 2021 02:26: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 2409D1530F; Fri, 16 Jul 2021 02:26: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 16G2QMwZ054323; Fri, 16 Jul 2021 02:26:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16G2QMCv054322; Fri, 16 Jul 2021 02:26:22 GMT (envelope-from git) Date: Fri, 16 Jul 2021 02:26:22 GMT Message-Id: <202107160226.16G2QMCv054322@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Neel Chauhan Subject: git: ad1f608fb2f5 - main - vmd: Rename vmd_bus class to pci MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ad1f608fb2f529baf028384bbe7e8fbbff5cbe23 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 02:26:22 -0000 The branch main has been updated by nc (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=ad1f608fb2f529baf028384bbe7e8fbbff5cbe23 commit ad1f608fb2f529baf028384bbe7e8fbbff5cbe23 Author: Neel Chauhan AuthorDate: 2021-07-16 02:03:05 +0000 Commit: Neel Chauhan CommitDate: 2021-07-16 02:26:20 +0000 vmd: Rename vmd_bus class to pci This fixes a kernel panic when probing for vmd_bus on Intel TigerLake on 14-CURRENT. Apparently, vmd_bus is a type of PCI bus, but was registered as a separate device class. PR: 256915 Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D31071 --- sys/dev/vmd/vmd_bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/vmd/vmd_bus.c b/sys/dev/vmd/vmd_bus.c index 5eed6176630f..28ce14c63128 100644 --- a/sys/dev/vmd/vmd_bus.c +++ b/sys/dev/vmd/vmd_bus.c @@ -213,8 +213,8 @@ static device_method_t vmd_bus_pci_methods[] = { static devclass_t vmd_bus_devclass; -DEFINE_CLASS_1(vmd_bus, vmd_bus_pci_driver, vmd_bus_pci_methods, +DEFINE_CLASS_1(pci, vmd_bus_pci_driver, vmd_bus_pci_methods, sizeof(struct pci_softc), pci_driver); -DRIVER_MODULE(vmd_bus, vmd, vmd_bus_pci_driver, vmd_bus_devclass, NULL, NULL); +DRIVER_MODULE(pci, vmd, vmd_bus_pci_driver, vmd_bus_devclass, NULL, NULL); MODULE_VERSION(vmd_bus, 1); From owner-dev-commits-src-main@freebsd.org Fri Jul 16 02:42:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38BD66572BA; Fri, 16 Jul 2021 02:42: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 4GQwWR05f8z3tdT; Fri, 16 Jul 2021 02:42: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 DFCA215066; Fri, 16 Jul 2021 02: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 16G2gQRo080478; Fri, 16 Jul 2021 02: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 16G2gQwI080477; Fri, 16 Jul 2021 02:42:26 GMT (envelope-from git) Date: Fri, 16 Jul 2021 02:42:26 GMT Message-Id: <202107160242.16G2gQwI080477@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: f238ebd14293 - main - rtld/arm64: Remove checks for undefined symbols when processing TPREL64 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: f238ebd1429312ac2a4cb9f764babc4b6f69721e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 02:42:27 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f238ebd1429312ac2a4cb9f764babc4b6f69721e commit f238ebd1429312ac2a4cb9f764babc4b6f69721e Author: Mark Johnston AuthorDate: 2021-07-16 02:26:25 +0000 Commit: Mark Johnston CommitDate: 2021-07-16 02:41:10 +0000 rtld/arm64: Remove checks for undefined symbols when processing TPREL64 lld emits several GOT relocations referencing the null sumbol in libc.so when compiled with -ftls-model=initial-exec. This symbol is specified to be undefined. We generally do not handle dynamic TLS relocations against weak, undefined symbols, so avoid printing a warning here. This makes it possible to compile libc.so using the initial-exec TLS model on arm64. Reviewed by: jrtc27, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31069 --- libexec/rtld-elf/aarch64/reloc.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/libexec/rtld-elf/aarch64/reloc.c b/libexec/rtld-elf/aarch64/reloc.c index 8d9c23a41aa5..8cc66c87d698 100644 --- a/libexec/rtld-elf/aarch64/reloc.c +++ b/libexec/rtld-elf/aarch64/reloc.c @@ -479,25 +479,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, return (-1); } } - /* Test weak undefined thread variable */ - if (def->st_shndx != SHN_UNDEF) { - *where = def->st_value + rela->r_addend + - defobj->tlsoffset; - } else { - /* - * XXX We should relocate undefined thread - * weak variable address to NULL, but how? - * Can we return error in this situation? - */ - rtld_printf("%s: Unable to relocate undefined " - "weak TLS variable\n", obj->path); -#if 0 - return (-1); -#else - *where = def->st_value + rela->r_addend + - defobj->tlsoffset; -#endif - } + *where = def->st_value + rela->r_addend + + defobj->tlsoffset; break; /* From owner-dev-commits-src-main@freebsd.org Fri Jul 16 02:42:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5323B6572BC; Fri, 16 Jul 2021 02:42: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 4GQwWS1J2Yz3tHN; Fri, 16 Jul 2021 02:42: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 F2B9B156A2; Fri, 16 Jul 2021 02:42: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 16G2gRWZ080508; Fri, 16 Jul 2021 02:42:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16G2gRcO080507; Fri, 16 Jul 2021 02:42:27 GMT (envelope-from git) Date: Fri, 16 Jul 2021 02:42:27 GMT Message-Id: <202107160242.16G2gRcO080507@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: 9c97062b6201 - main - libc: Use the initial-exec TLS model 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: 9c97062b620137a1f7cad4c6b3fb030a396b3266 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 02:42:28 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9c97062b620137a1f7cad4c6b3fb030a396b3266 commit 9c97062b620137a1f7cad4c6b3fb030a396b3266 Author: Mark Johnston AuthorDate: 2021-07-16 02:35:28 +0000 Commit: Mark Johnston CommitDate: 2021-07-16 02:41:10 +0000 libc: Use the initial-exec TLS model This permits more efficient accesses of thread-local variables, which are heavily used at least by jemalloc and locale-aware code. Note that on amd64 and i386, jemalloc's thread-local variables already have their TLS model overridden by defining JEMALLOC_TLS_MODEL. For now the change is applied only to tested platforms, but should in principle be enabled everywhere. PR: 255840 Suggested by: jrtc27 Reviewed by: kib MFC after: 2 months Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31070 --- lib/libc/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/libc/Makefile b/lib/libc/Makefile index 958270e6ddf5..fdf6aa49932b 100644 --- a/lib/libc/Makefile +++ b/lib/libc/Makefile @@ -54,6 +54,13 @@ CANCELPOINTS_CFLAGS=-fexceptions CFLAGS+=${CANCELPOINTS_CFLAGS} .endif +# Use a more efficient TLS model for libc since we can reasonably assume that +# it will be loaded during program startup. +.if ${LIBC_ARCH} == "aarch64" || ${LIBC_ARCH} == "amd64" || \ + ${LIBC_ARCH} == "i386" || ${LIBC_ARCH} == "riscv" +CFLAGS+= -ftls-model=initial-exec +.endif + # # Link with static libcompiler_rt.a. # From owner-dev-commits-src-main@freebsd.org Fri Jul 16 02:42:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7EB86656EF1; Fri, 16 Jul 2021 02:42:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQwWT1wSNz3tDj; Fri, 16 Jul 2021 02:42:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 250E615887; Fri, 16 Jul 2021 02:42:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16G2gTV2080533; Fri, 16 Jul 2021 02:42:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16G2gTYw080532; Fri, 16 Jul 2021 02:42:29 GMT (envelope-from git) Date: Fri, 16 Jul 2021 02:42:29 GMT Message-Id: <202107160242.16G2gTYw080532@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: 2e5f6152952e - main - lio_listio: Don't post a completion notification if none was requested 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: 2e5f6152952e4cfbaab3d96368c3dc4218786632 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 02:42:29 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2e5f6152952e4cfbaab3d96368c3dc4218786632 commit 2e5f6152952e4cfbaab3d96368c3dc4218786632 Author: Mark Johnston AuthorDate: 2021-07-16 02:38:46 +0000 Commit: Mark Johnston CommitDate: 2021-07-16 02:41:10 +0000 lio_listio: Don't post a completion notification if none was requested One is allowed to use LIO_NOWAIT without specifying a sigevent. In this case, lj->lioj_signal is left uninitialized, but several code paths examine liov_signal.sigev_notify to figure out which notification to post. Unconditionally initialize that field to SIGEV_NONE. Add a dumb test case which triggers the bug. Reported by: KMSAN+syzkaller Reviewed by: asomers MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31197 --- sys/kern/vfs_aio.c | 1 + tests/sys/aio/lio_test.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 640e82b6f0ff..7d4d9ac3e94b 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -2246,6 +2246,7 @@ kern_lio_listio(struct thread *td, int mode, struct aiocb * const *uacb_list, lj->lioj_flags = 0; lj->lioj_count = 0; lj->lioj_finished_count = 0; + lj->lioj_signal.sigev_notify = SIGEV_NONE; knlist_init_mtx(&lj->klist, AIO_MTX(ki)); ksiginfo_init(&lj->lioj_ksi); diff --git a/tests/sys/aio/lio_test.c b/tests/sys/aio/lio_test.c index fb519aac978d..a4f5a6a38632 100644 --- a/tests/sys/aio/lio_test.c +++ b/tests/sys/aio/lio_test.c @@ -133,6 +133,15 @@ ATF_TC_BODY(lio_listio_empty_wait, tc) ATF_REQUIRE_EQ(0, lio_listio(LIO_WAIT, &list, 0, NULL)); } +/* With LIO_NOWAIT, an empty lio_listio should return immediately */ +ATF_TC_WITHOUT_HEAD(lio_listio_empty_nowait); +ATF_TC_BODY(lio_listio_empty_nowait, tc) +{ + struct aiocb *list = NULL; + + ATF_REQUIRE_EQ(0, lio_listio(LIO_NOWAIT, &list, 0, NULL)); +} + /* * With LIO_NOWAIT, an empty lio_listio should send completion notification * immediately @@ -253,6 +262,7 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, lio_listio_eagain_kevent); + ATF_TP_ADD_TC(tp, lio_listio_empty_nowait); ATF_TP_ADD_TC(tp, lio_listio_empty_nowait_kevent); ATF_TP_ADD_TC(tp, lio_listio_empty_nowait_signal); ATF_TP_ADD_TC(tp, lio_listio_empty_nowait_thread); From owner-dev-commits-src-main@freebsd.org Fri Jul 16 02:42:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F244665731A; Fri, 16 Jul 2021 02:42:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQwWW4QlLz3tbj; Fri, 16 Jul 2021 02:42:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FCE615351; Fri, 16 Jul 2021 02:42:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16G2gVnX080581; Fri, 16 Jul 2021 02:42:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16G2gViW080580; Fri, 16 Jul 2021 02:42:31 GMT (envelope-from git) Date: Fri, 16 Jul 2021 02:42:31 GMT Message-Id: <202107160242.16G2gViW080580@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: c1aff72cfa30 - main - callout: Make cc_cpu local to kern_timeout.c 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: c1aff72cfa30fa27efe867a4feb667f1963e8cf7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 02:42:32 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c1aff72cfa30fa27efe867a4feb667f1963e8cf7 commit c1aff72cfa30fa27efe867a4feb667f1963e8cf7 Author: Mark Johnston AuthorDate: 2021-07-16 02:40:23 +0000 Commit: Mark Johnston CommitDate: 2021-07-16 02:41:10 +0000 callout: Make cc_cpu local to kern_timeout.c No functional change intended. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/kern/kern_timeout.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index cc1521adf151..d9cf2784f642 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -190,14 +190,14 @@ struct callout_cpu { #define cc_migration_time(cc, dir) cc->cc_exec_entity[dir].ce_migration_time #define cc_migration_prec(cc, dir) cc->cc_exec_entity[dir].ce_migration_prec -struct callout_cpu cc_cpu[MAXCPU]; +static struct callout_cpu cc_cpu[MAXCPU]; #define CPUBLOCK MAXCPU #define CC_CPU(cpu) (&cc_cpu[(cpu)]) #define CC_SELF() CC_CPU(PCPU_GET(cpuid)) #else -struct callout_cpu cc_cpu; -#define CC_CPU(cpu) &cc_cpu -#define CC_SELF() &cc_cpu +static struct callout_cpu cc_cpu; +#define CC_CPU(cpu) (&cc_cpu) +#define CC_SELF() (&cc_cpu) #endif #define CC_LOCK(cc) mtx_lock_spin(&(cc)->cc_lock) #define CC_UNLOCK(cc) mtx_unlock_spin(&(cc)->cc_lock) From owner-dev-commits-src-main@freebsd.org Fri Jul 16 02:42:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B9E4657382; Fri, 16 Jul 2021 02:42:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQwWV4RkMz3tbd; Fri, 16 Jul 2021 02:42:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48FCF15856; Fri, 16 Jul 2021 02:42:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16G2gU2v080557; Fri, 16 Jul 2021 02:42:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16G2gU2L080556; Fri, 16 Jul 2021 02:42:30 GMT (envelope-from git) Date: Fri, 16 Jul 2021 02:42:30 GMT Message-Id: <202107160242.16G2gU2L080556@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: 7a9bc8a82ec2 - main - nfssvc: Zero the buffer copied out when NFSSVC_DUMPMNTOPTS is set 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: 7a9bc8a82ec20f9208643f1615ea4ca1d0e5d933 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 02:42:31 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7a9bc8a82ec20f9208643f1615ea4ca1d0e5d933 commit 7a9bc8a82ec20f9208643f1615ea4ca1d0e5d933 Author: Mark Johnston AuthorDate: 2021-07-16 02:39:27 +0000 Commit: Mark Johnston CommitDate: 2021-07-16 02:41:10 +0000 nfssvc: Zero the buffer copied out when NFSSVC_DUMPMNTOPTS is set Reported by: KMSAN MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/fs/nfsclient/nfs_clport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c index 90d403334155..5c79e3ac6960 100644 --- a/sys/fs/nfsclient/nfs_clport.c +++ b/sys/fs/nfsclient/nfs_clport.c @@ -1312,7 +1312,8 @@ nfssvc_nfscl(struct thread *td, struct nfssvc_args *uap) error = EINVAL; } if (error == 0) { - buf = malloc(dumpmntopts.ndmnt_blen, M_TEMP, M_WAITOK); + buf = malloc(dumpmntopts.ndmnt_blen, M_TEMP, M_WAITOK | + M_ZERO); nfscl_retopts(VFSTONFS(nd.ni_vp->v_mount), buf, dumpmntopts.ndmnt_blen); vput(nd.ni_vp); From owner-dev-commits-src-main@freebsd.org Fri Jul 16 04:07:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 706AC659F8E; Fri, 16 Jul 2021 04:07: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 4GQyPX2dTMz4bfw; Fri, 16 Jul 2021 04:07: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 387BB166F3; Fri, 16 Jul 2021 04:07: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 16G47Sfx089379; Fri, 16 Jul 2021 04:07:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16G47SO1089378; Fri, 16 Jul 2021 04:07:28 GMT (envelope-from git) Date: Fri, 16 Jul 2021 04:07:28 GMT Message-Id: <202107160407.16G47SO1089378@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: f28f13890541 - main - freebsd-update: create a ZFS boot environment on install 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: f28f138905416c45ebaa6429f44a0b88a72f54b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 04:07:28 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=f28f138905416c45ebaa6429f44a0b88a72f54b1 commit f28f138905416c45ebaa6429f44a0b88a72f54b1 Author: Dave Fullard AuthorDate: 2021-07-16 04:02:48 +0000 Commit: Kyle Evans CommitDate: 2021-07-16 04:07:00 +0000 freebsd-update: create a ZFS boot environment on install Updated freebsd-update to allow it to create boot environments using bectl should the system support it. The bectl utility was updated in r352211 (490e13c1403f) to support a 'check' to determine if the system supports boot environments. If UFS is used, the bectl check will fail then no attempt will be made to create the boot environment. If freebsd-update is run inside a jail, no attempt will be made to create a boot environment. The boot environment function will create a new environment using the format: current FreeBSD kernel version and date/timestamp, example: 12.0-RELEASE-p10_2019-10-03_185233 This functionality can be disabled by setting 'CreateBootEnv' in freebsd-update.conf to 'no'. Discussed with: allanjude MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21892 --- usr.sbin/freebsd-update/freebsd-update.conf | 3 ++ usr.sbin/freebsd-update/freebsd-update.sh | 57 +++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/usr.sbin/freebsd-update/freebsd-update.conf b/usr.sbin/freebsd-update/freebsd-update.conf index 7f0917053750..62e6acf96cc8 100644 --- a/usr.sbin/freebsd-update/freebsd-update.conf +++ b/usr.sbin/freebsd-update/freebsd-update.conf @@ -74,3 +74,6 @@ MergeChanges /etc/ /boot/device.hints # When backing up a kernel also back up debug symbol files? # BackupKernelSymbolFiles no + +# Create a new boot environment when installing patches +# CreateBootEnv yes diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index f82ec7d7730c..4fbac58cb562 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -410,6 +410,23 @@ config_BackupKernelSymbolFiles () { fi } +config_CreateBootEnv () { + if [ -z ${BOOTENV} ]; then + case $1 in + [Yy][Ee][Ss]) + BOOTENV=yes + ;; + [Nn][Oo]) + BOOTENV=no + ;; + *) + return 1 + ;; + esac + else + return 1 + fi +} # Handle one line of configuration configline () { if [ $# -eq 0 ]; then @@ -586,6 +603,7 @@ default_params () { config_BackupKernel yes config_BackupKernelDir /boot/kernel.old config_BackupKernelSymbolFiles no + config_CreateBootEnv yes # Merge these defaults into the earlier-configured settings mergeconfig @@ -850,6 +868,44 @@ install_check_params () { fi } +# Creates a new boot environment +install_create_be () { + # Figure out if we're running in a jail and return if we are + if [ `sysctl -n security.jail.jailed` = 1 ]; then + return 1 + fi + # Create a boot environment if enabled + if [ ${BOOTENV} = yes ]; then + bectl check 2>/dev/null + case $? in + 0) + # Boot environment are supported + CREATEBE=yes + ;; + 255) + # Boot environments are not supported + CREATEBE=no + ;; + *) + # If bectl returns an unexpected exit code, don't create a BE + CREATEBE=no + ;; + esac + if [ ${CREATEBE} = yes ]; then + echo -n "Creating snapshot of existing boot environment... " + VERSION=`freebsd-version -k` + TIMESTAMP=`date +"%Y-%m-%d_%H%M%S"` + bectl create ${VERSION}_${TIMESTAMP} + if [ $? -eq 0 ]; then + echo "done."; + else + echo "failed." + exit 1 + fi + fi + fi +} + # Perform sanity checks and set some final parameters in # preparation for UNinstalling updates. rollback_check_params () { @@ -3366,6 +3422,7 @@ cmd_updatesready () { cmd_install () { finalize_components_config ${COMPONENTS} install_check_params + install_create_be install_run || exit 1 } From owner-dev-commits-src-main@freebsd.org Fri Jul 16 06:53:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D71F465C2C8; Fri, 16 Jul 2021 06:53: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 4GR25M5hBhz3JR8; Fri, 16 Jul 2021 06:53: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 A9B3A18B8D; Fri, 16 Jul 2021 06:53: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 16G6rhUK015179; Fri, 16 Jul 2021 06:53:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16G6rhi4015178; Fri, 16 Jul 2021 06:53:43 GMT (envelope-from git) Date: Fri, 16 Jul 2021 06:53:43 GMT Message-Id: <202107160653.16G6rhi4015178@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: 7660e4ea5cb7 - main - ixgbe: Print FW NVM and Option ROM versions 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: 7660e4ea5cb750ded38a0bd81cde2e2b130222df Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 06:53:43 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=7660e4ea5cb750ded38a0bd81cde2e2b130222df commit 7660e4ea5cb750ded38a0bd81cde2e2b130222df Author: Kevin Bowling AuthorDate: 2021-07-16 06:50:14 +0000 Commit: Kevin Bowling CommitDate: 2021-07-16 06:53:23 +0000 ixgbe: Print FW NVM and Option ROM versions It can be useful for system operators to see this kind of information when correlating issues or requesting support from the OEM or Intel for hardware and firmware issues. Reviewed by: gallatin MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30178 --- sys/dev/ixgbe/if_ix.c | 100 +++++++++++++++++++++++++++++++++++++++++++++ sys/dev/ixgbe/ixgbe_type.h | 2 +- 2 files changed, 101 insertions(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index fbe4f1df38ca..8e14a008e09b 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -173,6 +173,8 @@ static void ixgbe_initialize_transmit_units(if_ctx_t ctx); 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 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); @@ -196,6 +198,7 @@ static int ixgbe_sysctl_interrupt_rate_handler(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_dmac(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_phy_temp(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_phy_overtemp_occurred(SYSCTL_HANDLER_ARGS); +static int ixgbe_sysctl_print_fw_version(SYSCTL_HANDLER_ARGS); #ifdef IXGBE_DEBUG static int ixgbe_sysctl_power_state(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_print_rss_config(SYSCTL_HANDLER_ARGS); @@ -1119,6 +1122,9 @@ ixgbe_if_attach_post(if_ctx_t ctx) */ ixgbe_bypass_init(adapter); + /* Display NVM and Option ROM versions */ + ixgbe_print_fw_version(ctx); + /* Set an initial dmac value */ adapter->dmac = 0; /* Set initial advertised speeds (if applicable) */ @@ -2648,6 +2654,10 @@ ixgbe_add_device_sysctls(if_ctx_t ctx) SYSCTL_ADD_INT(ctx_list, child, OID_AUTO, "enable_aim", CTLFLAG_RW, &adapter->enable_aim, 0, "Interrupt Moderation"); + SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "fw_version", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, adapter, 0, + ixgbe_sysctl_print_fw_version, "A", "Prints FW/NVM Versions"); + #ifdef IXGBE_DEBUG /* testing sysctls (for all devices) */ SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "power_state", @@ -4674,3 +4684,93 @@ ixgbe_check_fan_failure(struct adapter *adapter, u32 reg, bool in_interrupt) if (reg & mask) device_printf(adapter->dev, "\nCRITICAL: FAN FAILURE!! REPLACE IMMEDIATELY!!\n"); } /* ixgbe_check_fan_failure */ + +/************************************************************************ + * ixgbe_sbuf_fw_version + ************************************************************************/ +static void +ixgbe_sbuf_fw_version(struct ixgbe_hw *hw, struct sbuf *buf) +{ + struct ixgbe_nvm_version nvm_ver = {0}; + uint16_t phyfw = 0; + int status; + + ixgbe_get_oem_prod_version(hw, &nvm_ver); /* OEM's NVM version */ + ixgbe_get_orom_version(hw, &nvm_ver); /* Option ROM */ + ixgbe_get_etk_id(hw, &nvm_ver); /* eTrack identifies a build in Intel's SCM */ + status = ixgbe_get_phy_firmware_version(hw, &phyfw); + + if (nvm_ver.oem_valid) + sbuf_printf(buf, "NVM OEM V%d.%d R%d ", nvm_ver.oem_major, + nvm_ver.oem_minor, nvm_ver.oem_release); + + if (nvm_ver.or_valid) + sbuf_printf(buf, "Option ROM V%d-b%d-p%d ", nvm_ver.or_major, + nvm_ver.or_build, nvm_ver.or_patch); + + if (nvm_ver.etk_id != ((NVM_VER_INVALID << NVM_ETK_SHIFT) | NVM_VER_INVALID)) + sbuf_printf(buf, "eTrack 0x%08x ", nvm_ver.etk_id); + + if (phyfw != 0 && status == IXGBE_SUCCESS) + sbuf_printf(buf, "PHY FW V%d ", phyfw); + + sbuf_trim(buf); +} /* ixgbe_sbuf_fw_version */ + +/************************************************************************ + * ixgbe_print_fw_version + ************************************************************************/ +static void +ixgbe_print_fw_version(if_ctx_t ctx) +{ + struct adapter *adapter = iflib_get_softc(ctx); + struct ixgbe_hw *hw = &adapter->hw; + device_t dev = adapter->dev; + struct sbuf *buf; + int error = 0; + + buf = sbuf_new_auto(); + if (!buf) { + device_printf(dev, "Could not allocate sbuf for output.\n"); + return; + } + + ixgbe_sbuf_fw_version(hw, buf); + + error = sbuf_finish(buf); + if (error) + device_printf(dev, "Error finishing sbuf: %d\n", error); + else if (sbuf_len(buf)) + device_printf(dev, "%s\n", sbuf_data(buf)); + + sbuf_delete(buf); +} /* ixgbe_print_fw_version */ + +/************************************************************************ + * ixgbe_sysctl_print_fw_version + ************************************************************************/ +static int +ixgbe_sysctl_print_fw_version(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter = (struct adapter *)arg1; + struct ixgbe_hw *hw = &adapter->hw; + device_t dev = adapter->dev; + struct sbuf *buf; + int error = 0; + + buf = sbuf_new_for_sysctl(NULL, NULL, 128, req); + if (!buf) { + device_printf(dev, "Could not allocate sbuf for output.\n"); + return (ENOMEM); + } + + ixgbe_sbuf_fw_version(hw, buf); + + error = sbuf_finish(buf); + if (error) + device_printf(dev, "Error finishing sbuf: %d\n", error); + + sbuf_delete(buf); + + return (0); +} /* ixgbe_sysctl_print_fw_version */ diff --git a/sys/dev/ixgbe/ixgbe_type.h b/sys/dev/ixgbe/ixgbe_type.h index fc5f191ee65e..1d00eadc890a 100644 --- a/sys/dev/ixgbe/ixgbe_type.h +++ b/sys/dev/ixgbe/ixgbe_type.h @@ -306,7 +306,7 @@ #define NVM_VER_INVALID 0xFFFF #define NVM_ETK_VALID 0x8000 #define NVM_INVALID_PTR 0xFFFF -#define NVM_VER_SIZE 32 /* version sting size */ +#define NVM_VER_SIZE 32 /* version string size */ struct ixgbe_nvm_version { u32 etk_id; From owner-dev-commits-src-main@freebsd.org Fri Jul 16 10:08:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 534B565EFEE; Fri, 16 Jul 2021 10:08:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GR6QS1kMRz4Y5W; Fri, 16 Jul 2021 10:08:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 243791B3D9; Fri, 16 Jul 2021 10:08:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GA8mmL071539; Fri, 16 Jul 2021 10:08:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GA8mrw071538; Fri, 16 Jul 2021 10:08:48 GMT (envelope-from git) Date: Fri, 16 Jul 2021 10:08:48 GMT Message-Id: <202107161008.16GA8mrw071538@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: 1d171e5ab962 - main - tcp: Lro needs to validate that it does not go beyond the end of the mbuf as it parses. 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: 1d171e5ab9622e512ea4fc95b8eb3682d1858c6f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 10:08:48 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=1d171e5ab9622e512ea4fc95b8eb3682d1858c6f commit 1d171e5ab9622e512ea4fc95b8eb3682d1858c6f Author: Randall Stewart AuthorDate: 2021-07-16 10:07:13 +0000 Commit: Randall Stewart CommitDate: 2021-07-16 10:07:13 +0000 tcp: Lro needs to validate that it does not go beyond the end of the mbuf as it parses. Currently the LRO parser, if given a packet that say has ETH+IP header but the TCP header is in the next mbuf (split), would walk garbage. Lets make sure we keep track as we parse of the length and return NULL anytime we exceed the length of the mbuf. Reviewed by: tuexen, hselasky Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D31195 --- sys/netinet/tcp_lro.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c index 23e64b29b296..f0a996f685c3 100644 --- a/sys/netinet/tcp_lro.c +++ b/sys/netinet/tcp_lro.c @@ -228,7 +228,7 @@ struct vxlan_header { }; static inline void * -tcp_lro_low_level_parser(void *ptr, struct lro_parser *parser, bool update_data, bool is_vxlan) +tcp_lro_low_level_parser(void *ptr, struct lro_parser *parser, bool update_data, bool is_vxlan, int mlen) { const struct ether_vlan_header *eh; void *old; @@ -258,16 +258,21 @@ tcp_lro_low_level_parser(void *ptr, struct lro_parser *parser, bool update_data, } /* advance to next header */ ptr = (uint8_t *)ptr + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; + mlen -= (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); } else { eth_type = eh->evl_encap_proto; /* advance to next header */ + mlen -= ETHER_HDR_LEN; ptr = (uint8_t *)ptr + ETHER_HDR_LEN; } - + if (__predict_false(mlen <= 0)) + return (NULL); switch (eth_type) { #ifdef INET case htons(ETHERTYPE_IP): parser->ip4 = ptr; + if (__predict_false(mlen < sizeof(struct ip))) + return (NULL); /* Ensure there are no IPv4 options. */ if ((parser->ip4->ip_hl << 2) != sizeof (*parser->ip4)) break; @@ -275,12 +280,15 @@ tcp_lro_low_level_parser(void *ptr, struct lro_parser *parser, bool update_data, if (parser->ip4->ip_off & htons(IP_MF|IP_OFFMASK)) break; ptr = (uint8_t *)ptr + (parser->ip4->ip_hl << 2); + mlen -= sizeof(struct ip); if (update_data) { parser->data.s_addr.v4 = parser->ip4->ip_src; parser->data.d_addr.v4 = parser->ip4->ip_dst; } switch (parser->ip4->ip_p) { case IPPROTO_UDP: + if (__predict_false(mlen < sizeof(struct udphdr))) + return (NULL); parser->udp = ptr; if (update_data) { parser->data.lro_type = LRO_TYPE_IPV4_UDP; @@ -294,6 +302,8 @@ tcp_lro_low_level_parser(void *ptr, struct lro_parser *parser, bool update_data, return (ptr); case IPPROTO_TCP: parser->tcp = ptr; + if (__predict_false(mlen < sizeof(struct tcphdr))) + return (NULL); if (update_data) { parser->data.lro_type = LRO_TYPE_IPV4_TCP; parser->data.s_port = parser->tcp->th_sport; @@ -301,6 +311,8 @@ tcp_lro_low_level_parser(void *ptr, struct lro_parser *parser, bool update_data, } else { MPASS(parser->data.lro_type == LRO_TYPE_IPV4_TCP); } + if (__predict_false(mlen < (parser->tcp->th_off << 2))) + return (NULL); ptr = (uint8_t *)ptr + (parser->tcp->th_off << 2); parser->total_hdr_len = (uint8_t *)ptr - (uint8_t *)old; return (ptr); @@ -312,13 +324,18 @@ tcp_lro_low_level_parser(void *ptr, struct lro_parser *parser, bool update_data, #ifdef INET6 case htons(ETHERTYPE_IPV6): parser->ip6 = ptr; + if (__predict_false(mlen < sizeof(struct ip6_hdr))) + return (NULL); ptr = (uint8_t *)ptr + sizeof(*parser->ip6); if (update_data) { parser->data.s_addr.v6 = parser->ip6->ip6_src; parser->data.d_addr.v6 = parser->ip6->ip6_dst; } + mlen -= sizeof(struct ip6_hdr); switch (parser->ip6->ip6_nxt) { case IPPROTO_UDP: + if (__predict_false(mlen < sizeof(struct udphdr))) + return (NULL); parser->udp = ptr; if (update_data) { parser->data.lro_type = LRO_TYPE_IPV6_UDP; @@ -331,6 +348,8 @@ tcp_lro_low_level_parser(void *ptr, struct lro_parser *parser, bool update_data, parser->total_hdr_len = (uint8_t *)ptr - (uint8_t *)old; return (ptr); case IPPROTO_TCP: + if (__predict_false(mlen < sizeof(struct tcphdr))) + return (NULL); parser->tcp = ptr; if (update_data) { parser->data.lro_type = LRO_TYPE_IPV6_TCP; @@ -339,6 +358,8 @@ tcp_lro_low_level_parser(void *ptr, struct lro_parser *parser, bool update_data, } else { MPASS(parser->data.lro_type == LRO_TYPE_IPV6_TCP); } + if (__predict_false(mlen < (parser->tcp->th_off << 2))) + return (NULL); ptr = (uint8_t *)ptr + (parser->tcp->th_off << 2); parser->total_hdr_len = (uint8_t *)ptr - (uint8_t *)old; return (ptr); @@ -363,7 +384,7 @@ tcp_lro_parser(struct mbuf *m, struct lro_parser *po, struct lro_parser *pi, boo void *data_ptr; /* Try to parse outer headers first. */ - data_ptr = tcp_lro_low_level_parser(m->m_data, po, update_data, false); + data_ptr = tcp_lro_low_level_parser(m->m_data, po, update_data, false, m->m_len); if (data_ptr == NULL || po->total_hdr_len > m->m_len) return (NULL); @@ -383,8 +404,9 @@ tcp_lro_parser(struct mbuf *m, struct lro_parser *po, struct lro_parser *pi, boo break; /* Try to parse inner headers. */ - data_ptr = tcp_lro_low_level_parser(data_ptr, pi, update_data, true); - if (data_ptr == NULL || pi->total_hdr_len > m->m_len) + data_ptr = tcp_lro_low_level_parser(data_ptr, pi, update_data, true, + (m->m_len - ((caddr_t)data_ptr - m->m_data))); + if (data_ptr == NULL || (pi->total_hdr_len + po->total_hdr_len) > m->m_len) break; /* Verify supported header types. */ From owner-dev-commits-src-main@freebsd.org Fri Jul 16 13:01:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7028A66167D; Fri, 16 Jul 2021 13:01:16 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) (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 4GRBFS1tsHz3Mkf; Fri, 16 Jul 2021 13:01:16 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-ot1-f53.google.com with SMTP id t4-20020a05683014c4b02904cd671b911bso1694740otq.1; Fri, 16 Jul 2021 06:01:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DE6weTYt9AQXUmMI1n7nbHeaynF0EdWBKDOB1WNRN2Q=; b=lJ8o7mG0c+X23lUbKy1ca9aVbZgNdOHL7l1IRlOaSptNHPmU/ttT4Imv7JEWVgKtlE J+Z9L3CRKYJ3YK6I8IXtDdeTjFSwn8VoHarBZoEHxOmD3YkoPKzZTQbvenmD+uYdrT4y beVj2DIjF18pO1G5TU5B7hJRsIDOtR2OmRUZsNBR8m9K6obwBXfFfo3WUj23ebg0708B /DWqELEDG2hgJfAadODlahRAGKZsHqMuYRUUtRirwuRD8kVUaVk0TS59citMbfwVbJov pGeSAbrNRn957lYK4GrtJHJ4MQuJincza5Bf09KoPIM4Jh07kZD3rLGa2EvTDi+FcLhO aIYA== X-Gm-Message-State: AOAM5320E+gUKQwc4P8snBPyCdKRdA2JBcnR03KoBBtI2EYgIV7QD48/ KAIjnyKbWUDR/uRxbBKdwFWPvYJ/DrFb6xx1FcQM44cwFJs= X-Google-Smtp-Source: ABdhPJz5BpCZFGKmDIiGnYv6lSkAtIhaIKwCtsZPp29IfuAX4lLWjgcidTZwI8Y+rRDq9X0QArinpZjjqZgbYoOzeOk= X-Received: by 2002:a9d:7982:: with SMTP id h2mr7686787otm.291.1626440474867; Fri, 16 Jul 2021 06:01:14 -0700 (PDT) MIME-Version: 1.0 References: <202107160407.16G47SO1089378@gitrepo.freebsd.org> In-Reply-To: <202107160407.16G47SO1089378@gitrepo.freebsd.org> From: Alan Somers Date: Fri, 16 Jul 2021 07:01:03 -0600 Message-ID: Subject: Re: git: f28f13890541 - main - freebsd-update: create a ZFS boot environment on install To: Kyle Evans Cc: src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4GRBFS1tsHz3Mkf X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 13:01:16 -0000 On Thu, Jul 15, 2021 at 10:07 PM Kyle Evans wrote: > The branch main has been updated by kevans: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=f28f138905416c45ebaa6429f44a0b88a72f54b1 > > commit f28f138905416c45ebaa6429f44a0b88a72f54b1 > Author: Dave Fullard > AuthorDate: 2021-07-16 04:02:48 +0000 > Commit: Kyle Evans > CommitDate: 2021-07-16 04:07:00 +0000 > > freebsd-update: create a ZFS boot environment on install > > Updated freebsd-update to allow it to create boot environments using > bectl should the system support it. The bectl utility was updated in > r352211 (490e13c1403f) to support a 'check' to determine if the system > supports boot environments. If UFS is used, the bectl check will fail > then no attempt will be made to create the boot environment. > > If freebsd-update is run inside a jail, no attempt will be made to > create a boot environment. > > The boot environment function will create a new environment using the > format: current FreeBSD kernel version and date/timestamp, example: > > 12.0-RELEASE-p10_2019-10-03_185233 > > This functionality can be disabled by setting 'CreateBootEnv' in > freebsd-update.conf to 'no'. > > Discussed with: allanjude > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D21892 > --- > usr.sbin/freebsd-update/freebsd-update.conf | 3 ++ > usr.sbin/freebsd-update/freebsd-update.sh | 57 > +++++++++++++++++++++++++++++ > 2 files changed, 60 insertions(+) > Ooh, are you getting ready to make freebsd-update install upgrades into a fresh BE? That would be pretty cool. It's already cool that you can do it today, but it takes about 10 commands instead of one. From owner-dev-commits-src-main@freebsd.org Fri Jul 16 13:49:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D36E8661E2D; Fri, 16 Jul 2021 13:49: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 4GRCK254wDz3kZB; Fri, 16 Jul 2021 13:49: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 9757A1E2C8; Fri, 16 Jul 2021 13:49: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 16GDnQHX062502; Fri, 16 Jul 2021 13:49:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GDnQKJ062501; Fri, 16 Jul 2021 13:49:26 GMT (envelope-from git) Date: Fri, 16 Jul 2021 13:49:26 GMT Message-Id: <202107161349.16GDnQKJ062501@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: ae47eecf87b5 - main - Hide arm64 features that don't have a HWCAP 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: ae47eecf87b5d8a054bd5d640da12608cc5f126a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 13:49:26 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=ae47eecf87b5d8a054bd5d640da12608cc5f126a commit ae47eecf87b5d8a054bd5d640da12608cc5f126a Author: Andrew Turner AuthorDate: 2021-07-15 23:22:07 +0000 Commit: Andrew Turner CommitDate: 2021-07-15 23:56:47 +0000 Hide arm64 features that don't have a HWCAP We should only export MSR fields if there is also a HWCAP so it doesn't matter which software uses. Sponsored by: The FreeBSD Foundation --- sys/arm64/arm64/identcpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index c2812055dfa9..f4ce02791787 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -467,7 +467,7 @@ static struct mrs_field_value id_aa64isar0_aes[] = { static struct mrs_field id_aa64isar0_fields[] = { MRS_FIELD(ID_AA64ISAR0, RNDR, false, MRS_LOWER, id_aa64isar0_rndr), - MRS_FIELD(ID_AA64ISAR0, TLB, false, MRS_LOWER, id_aa64isar0_tlb), + MRS_FIELD(ID_AA64ISAR0, TLB, false, MRS_EXACT, id_aa64isar0_tlb), MRS_FIELD(ID_AA64ISAR0, TS, false, MRS_LOWER, id_aa64isar0_ts), MRS_FIELD(ID_AA64ISAR0, FHM, false, MRS_LOWER, id_aa64isar0_fhm), MRS_FIELD(ID_AA64ISAR0, DP, false, MRS_LOWER, id_aa64isar0_dp), @@ -568,7 +568,7 @@ static struct mrs_field id_aa64isar1_fields[] = { MRS_FIELD(ID_AA64ISAR1, I8MM, false, MRS_LOWER, id_aa64isar1_i8mm), MRS_FIELD(ID_AA64ISAR1, DGH, false, MRS_LOWER, id_aa64isar1_dgh), MRS_FIELD(ID_AA64ISAR1, BF16, false, MRS_LOWER, id_aa64isar1_bf16), - MRS_FIELD(ID_AA64ISAR1, SPECRES, false, MRS_LOWER, + MRS_FIELD(ID_AA64ISAR1, SPECRES, false, MRS_EXACT, id_aa64isar1_specres), MRS_FIELD(ID_AA64ISAR1, SB, false, MRS_LOWER, id_aa64isar1_sb), MRS_FIELD(ID_AA64ISAR1, FRINTTS, false, MRS_LOWER, From owner-dev-commits-src-main@freebsd.org Fri Jul 16 16:14:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05B2B663C33; Fri, 16 Jul 2021 16:14: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 4GRGXQ69cgz4m1R; Fri, 16 Jul 2021 16:14: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 BAA70200CA; Fri, 16 Jul 2021 16:14: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 16GGEUUM061887; Fri, 16 Jul 2021 16:14:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GGEUpK061886; Fri, 16 Jul 2021 16:14:30 GMT (envelope-from git) Date: Fri, 16 Jul 2021 16:14:30 GMT Message-Id: <202107161614.16GGEUpK061886@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: 5d40fb677a9e - main - Add some missing osd.9 MLINKs 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: 5d40fb677a9ec95a508f510f6238f4ec3ef65e01 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 16:14:31 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5d40fb677a9ec95a508f510f6238f4ec3ef65e01 commit 5d40fb677a9ec95a508f510f6238f4ec3ef65e01 Author: Mark Johnston AuthorDate: 2021-07-16 16:13:51 +0000 Commit: Mark Johnston CommitDate: 2021-07-16 16:13:51 +0000 Add some missing osd.9 MLINKs MFC after: 1 week Sponsored by: The FreeBSD Foundation --- share/man/man9/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index ac4cf67f52f7..a335f53b27f3 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1672,9 +1672,12 @@ MLINKS+=osd.9 osd_call.9 \ osd.9 osd_del.9 \ osd.9 osd_deregister.9 \ osd.9 osd_exit.9 \ + osd.9 osd_free_reserved.9 \ osd.9 osd_get.9 \ osd.9 osd_register.9 \ - osd.9 osd_set.9 + osd.9 osd_reserve.9 \ + osd.9 osd_set.9 \ + osd.9 osd_set_reserved.9 MLINKS+=panic.9 vpanic.9 MLINKS+=PCBGROUP.9 in_pcbgroup_byhash.9 \ PCBGROUP.9 in_pcbgroup_byinpcb.9 \ From owner-dev-commits-src-main@freebsd.org Fri Jul 16 16:30:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6188D663F51; Fri, 16 Jul 2021 16:30: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 4GRGtc2Hwfz4rZ2; Fri, 16 Jul 2021 16:30: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 36D7A204E9; Fri, 16 Jul 2021 16:30: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 16GGUGDY081209; Fri, 16 Jul 2021 16:30:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GGUG54081182; Fri, 16 Jul 2021 16:30:16 GMT (envelope-from git) Date: Fri, 16 Jul 2021 16:30:16 GMT Message-Id: <202107161630.16GGUG54081182@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: 4652422eb477 - main - Merge llvm-project 12.0.1 release 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: 4652422eb477731f284b1345afeefef7f269da50 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 16:30:16 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=4652422eb477731f284b1345afeefef7f269da50 commit 4652422eb477731f284b1345afeefef7f269da50 Author: Dimitry Andric AuthorDate: 2021-07-16 16:29:42 +0000 Commit: Dimitry Andric CommitDate: 2021-07-16 16:29:42 +0000 Merge llvm-project 12.0.1 release This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-12.0.1-0-gfed41342a82f, a.k.a. 12.0.1 release. PR: 255570 MFC after: 6 weeks --- .../llvm-project/clang/lib/Basic/Targets/X86.cpp | 3 +- .../sanitizer_common_interceptors_ioctl.inc | 9 --- .../sanitizer_platform_limits_posix.cpp | 11 ---- .../sanitizer_platform_limits_posix.h | 10 ---- .../sanitizer_common/sanitizer_posix_libcdep.cpp | 13 +++-- contrib/llvm-project/libcxx/include/__availability | 43 ++++++++++++++ .../llvm-project/libcxx/include/__bit_reference | 34 +++++------ contrib/llvm-project/libcxx/include/memory | 40 +++++++++---- contrib/llvm-project/libcxx/include/version | 16 ++--- contrib/llvm-project/llvm/include/llvm-c/Core.h | 12 ++++ .../DebugInfo/DWARF/DWARFAbbreviationDeclaration.h | 10 ++++ .../llvm-project/llvm/include/llvm/Support/Host.h | 14 +++++ .../Vectorize/LoopVectorizationLegality.h | 15 ++--- .../llvm/lib/DebugInfo/DWARF/DWARFDie.cpp | 35 ++++++----- .../llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp | 5 ++ contrib/llvm-project/llvm/lib/IR/Core.cpp | 16 +++++ contrib/llvm-project/llvm/lib/Support/Host.cpp | 68 +++++++++++++++++----- .../llvm/lib/Target/ARM/ARMBlockPlacement.cpp | 7 +-- .../llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp | 20 ++++--- .../lib/Target/ARM/MVEGatherScatterLowering.cpp | 5 +- .../llvm/lib/Target/ARM/MVETailPredication.cpp | 4 ++ .../llvm/lib/Target/ARM/MVEVPTBlockPass.cpp | 13 ++++- .../llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 41 +++++++++---- .../lib/Target/SystemZ/SystemZISelLowering.cpp | 22 +++++-- .../llvm/lib/Transforms/Coroutines/CoroEarly.cpp | 9 +++ .../llvm/lib/Transforms/Coroutines/CoroFrame.cpp | 31 ++++++++-- .../llvm/lib/Transforms/IPO/ConstantMerge.cpp | 2 + .../Vectorize/LoopVectorizationLegality.cpp | 14 +---- .../llvm/tools/llvm-cov/CoverageSummaryInfo.cpp | 6 +- .../llvm/tools/llvm-cov/CoverageSummaryInfo.h | 5 ++ lib/clang/include/VCSVersion.inc | 8 +-- lib/clang/include/llvm/Config/llvm-config.h | 1 - lib/clang/include/llvm/Support/VCSRevision.h | 2 +- 33 files changed, 378 insertions(+), 166 deletions(-) diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/X86.cpp b/contrib/llvm-project/clang/lib/Basic/Targets/X86.cpp index 694a8095e336..c5ad1c7d2c2e 100644 --- a/contrib/llvm-project/clang/lib/Basic/Targets/X86.cpp +++ b/contrib/llvm-project/clang/lib/Basic/Targets/X86.cpp @@ -513,10 +513,11 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts, case CK_K8: case CK_K8SSE3: case CK_x86_64: + defineCPUMacros(Builder, "k8"); + break; case CK_x86_64_v2: case CK_x86_64_v3: case CK_x86_64_v4: - defineCPUMacros(Builder, "k8"); break; case CK_AMDFAM10: defineCPUMacros(Builder, "amdfam10"); diff --git a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc index 7f181258eab5..b7da65987557 100644 --- a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +++ b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc @@ -370,15 +370,6 @@ static void ioctl_table_fill() { #if SANITIZER_GLIBC // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE - _(CYGETDEFTHRESH, WRITE, sizeof(int)); - _(CYGETDEFTIMEOUT, WRITE, sizeof(int)); - _(CYGETMON, WRITE, struct_cyclades_monitor_sz); - _(CYGETTHRESH, WRITE, sizeof(int)); - _(CYGETTIMEOUT, WRITE, sizeof(int)); - _(CYSETDEFTHRESH, NONE, 0); - _(CYSETDEFTIMEOUT, NONE, 0); - _(CYSETTHRESH, NONE, 0); - _(CYSETTIMEOUT, NONE, 0); _(EQL_EMANCIPATE, WRITE, struct_ifreq_sz); _(EQL_ENSLAVE, WRITE, struct_ifreq_sz); _(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz); diff --git a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp index 12dd39e674ac..7abaeb880bf3 100644 --- a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp +++ b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp @@ -143,7 +143,6 @@ typedef struct user_fpregs elf_fpregset_t; # include #endif #include -#include #include #include #include @@ -459,7 +458,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); #if SANITIZER_GLIBC unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct); - unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor); #if EV_VERSION > (0x010000) unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry); #else @@ -823,15 +821,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); #endif // SANITIZER_LINUX #if SANITIZER_LINUX && !SANITIZER_ANDROID - unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH; - unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT; - unsigned IOCTL_CYGETMON = CYGETMON; - unsigned IOCTL_CYGETTHRESH = CYGETTHRESH; - unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT; - unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH; - unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT; - unsigned IOCTL_CYSETTHRESH = CYSETTHRESH; - unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT; unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE; unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE; unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG; diff --git a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h index 5839dd77ea75..d3e9a6353909 100644 --- a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h @@ -983,7 +983,6 @@ extern unsigned struct_vt_mode_sz; #if SANITIZER_LINUX && !SANITIZER_ANDROID extern unsigned struct_ax25_parms_struct_sz; -extern unsigned struct_cyclades_monitor_sz; extern unsigned struct_input_keymap_entry_sz; extern unsigned struct_ipx_config_data_sz; extern unsigned struct_kbdiacrs_sz; @@ -1328,15 +1327,6 @@ extern unsigned IOCTL_VT_WAITACTIVE; #endif // SANITIZER_LINUX #if SANITIZER_LINUX && !SANITIZER_ANDROID -extern unsigned IOCTL_CYGETDEFTHRESH; -extern unsigned IOCTL_CYGETDEFTIMEOUT; -extern unsigned IOCTL_CYGETMON; -extern unsigned IOCTL_CYGETTHRESH; -extern unsigned IOCTL_CYGETTIMEOUT; -extern unsigned IOCTL_CYSETDEFTHRESH; -extern unsigned IOCTL_CYSETDEFTIMEOUT; -extern unsigned IOCTL_CYSETTHRESH; -extern unsigned IOCTL_CYSETTIMEOUT; extern unsigned IOCTL_EQL_EMANCIPATE; extern unsigned IOCTL_EQL_ENSLAVE; extern unsigned IOCTL_EQL_GETMASTRCFG; diff --git a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp index d29438cf9dbd..12603da1750d 100644 --- a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp +++ b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp @@ -165,7 +165,12 @@ bool SupportsColoredOutput(fd_t fd) { #if !SANITIZER_GO // TODO(glider): different tools may require different altstack size. -static const uptr kAltStackSize = SIGSTKSZ * 4; // SIGSTKSZ is not enough. +static uptr GetAltStackSize() { + // Note: since GLIBC_2.31, SIGSTKSZ may be a function call, so this may be + // more costly that you think. However GetAltStackSize is only call 2-3 times + // per thread so don't cache the evaluation. + return SIGSTKSZ * 4; +} void SetAlternateSignalStack() { stack_t altstack, oldstack; @@ -176,10 +181,10 @@ void SetAlternateSignalStack() { // TODO(glider): the mapped stack should have the MAP_STACK flag in the // future. It is not required by man 2 sigaltstack now (they're using // malloc()). - void* base = MmapOrDie(kAltStackSize, __func__); + void *base = MmapOrDie(GetAltStackSize(), __func__); altstack.ss_sp = (char*) base; altstack.ss_flags = 0; - altstack.ss_size = kAltStackSize; + altstack.ss_size = GetAltStackSize(); CHECK_EQ(0, sigaltstack(&altstack, nullptr)); } @@ -187,7 +192,7 @@ void UnsetAlternateSignalStack() { stack_t altstack, oldstack; altstack.ss_sp = nullptr; altstack.ss_flags = SS_DISABLE; - altstack.ss_size = kAltStackSize; // Some sane value required on Darwin. + altstack.ss_size = GetAltStackSize(); // Some sane value required on Darwin. CHECK_EQ(0, sigaltstack(&altstack, &oldstack)); UnmapOrDie(oldstack.ss_sp, oldstack.ss_size); } diff --git a/contrib/llvm-project/libcxx/include/__availability b/contrib/llvm-project/libcxx/include/__availability index db2267c8eb16..cc3b6fabdab1 100644 --- a/contrib/llvm-project/libcxx/include/__availability +++ b/contrib/llvm-project/libcxx/include/__availability @@ -43,6 +43,14 @@ // as unavailable. When vendors decide to ship the feature as part of their // shared library, they can update the markup appropriately. // +// Furthermore, many features in the standard library have corresponding +// feature-test macros. When a feature is made unavailable on some deployment +// target, a macro should be defined to signal that it is unavailable. That +// macro can then be picked up when feature-test macros are generated (see +// generate_feature_test_macro_components.py) to make sure that feature-test +// macros don't announce a feature as being implemented if it has been marked +// as unavailable. +// // Note that this mechanism is disabled by default in the "upstream" libc++. // Availability annotations are only meaningful when shipping libc++ inside // a platform (i.e. as a system library), and so vendors that want them should @@ -76,6 +84,8 @@ // This controls the availability of std::shared_mutex and std::shared_timed_mutex, // which were added to the dylib later. # define _LIBCPP_AVAILABILITY_SHARED_MUTEX +// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex +// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex // These macros control the availability of std::bad_optional_access and // other exception types. These were put in the shared library to prevent @@ -114,6 +124,7 @@ # define _LIBCPP_AVAILABILITY_FILESYSTEM # define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH # define _LIBCPP_AVAILABILITY_FILESYSTEM_POP +// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem // This controls the availability of std::to_chars. # define _LIBCPP_AVAILABILITY_TO_CHARS @@ -122,6 +133,10 @@ // which requires shared library support for various operations // (see libcxx/src/atomic.cpp). # define _LIBCPP_AVAILABILITY_SYNC +// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait +// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier +// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch +// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore #elif defined(__APPLE__) @@ -130,6 +145,14 @@ __attribute__((availability(ios,strict,introduced=10.0))) \ __attribute__((availability(tvos,strict,introduced=10.0))) \ __attribute__((availability(watchos,strict,introduced=3.0))) +# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200) || \ + (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 100000) || \ + (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 100000) || \ + (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 30000) +# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex +# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex +# endif + # define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS \ __attribute__((availability(macosx,strict,introduced=10.13))) \ __attribute__((availability(ios,strict,introduced=11.0))) \ @@ -139,27 +162,34 @@ _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS # define _LIBCPP_AVAILABILITY_BAD_ANY_CAST \ _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS + # define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \ __attribute__((availability(macosx,strict,introduced=10.12))) \ __attribute__((availability(ios,strict,introduced=10.0))) \ __attribute__((availability(tvos,strict,introduced=10.0))) \ __attribute__((availability(watchos,strict,introduced=3.0))) + # define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \ __attribute__((availability(macosx,strict,introduced=10.12))) \ __attribute__((availability(ios,strict,introduced=10.0))) \ __attribute__((availability(tvos,strict,introduced=10.0))) \ __attribute__((availability(watchos,strict,introduced=3.0))) + # define _LIBCPP_AVAILABILITY_FUTURE_ERROR \ __attribute__((availability(ios,strict,introduced=6.0))) + # define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \ __attribute__((availability(macosx,strict,introduced=10.9))) \ __attribute__((availability(ios,strict,introduced=7.0))) + # define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \ __attribute__((availability(macosx,strict,introduced=10.9))) \ __attribute__((availability(ios,strict,introduced=7.0))) + # define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \ __attribute__((availability(macosx,strict,introduced=10.9))) \ __attribute__((availability(ios,strict,introduced=7.0))) + # define _LIBCPP_AVAILABILITY_FILESYSTEM \ __attribute__((availability(macosx,strict,introduced=10.15))) \ __attribute__((availability(ios,strict,introduced=13.0))) \ @@ -175,10 +205,23 @@ _Pragma("clang attribute pop") \ _Pragma("clang attribute pop") \ _Pragma("clang attribute pop") +# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \ + (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000) || \ + (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 130000) || \ + (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 60000) +# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem +# endif + # define _LIBCPP_AVAILABILITY_TO_CHARS \ _LIBCPP_AVAILABILITY_FILESYSTEM + + // Note: Those are not ABI-stable yet, so we can't ship them. # define _LIBCPP_AVAILABILITY_SYNC \ __attribute__((unavailable)) +# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait +# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier +# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch +# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore #else diff --git a/contrib/llvm-project/libcxx/include/__bit_reference b/contrib/llvm-project/libcxx/include/__bit_reference index 9cfb4b84e653..d44ad03d3134 100644 --- a/contrib/llvm-project/libcxx/include/__bit_reference +++ b/contrib/llvm-project/libcxx/include/__bit_reference @@ -1114,28 +1114,26 @@ public: #endif {} - // avoid re-declaring a copy constructor for the non-const version. - using __type_for_copy_to_const = - _If<_IsConst, __bit_iterator<_Cp, false>, struct __private_nat>; - + // When _IsConst=false, this is the copy constructor. + // It is non-trivial. Making it trivial would break ABI. + // When _IsConst=true, this is a converting constructor; + // the copy and move constructors are implicitly generated + // and trivial. _LIBCPP_INLINE_VISIBILITY - __bit_iterator(const __type_for_copy_to_const& __it) _NOEXCEPT + __bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT : __seg_(__it.__seg_), __ctz_(__it.__ctz_) {} - // The non-const __bit_iterator has historically had a non-trivial - // copy constructor (as a quirk of its construction). We need to maintain - // this for ABI purposes. - using __type_for_abi_non_trivial_copy_ctor = - _If; - - _LIBCPP_INLINE_VISIBILITY - __bit_iterator(__type_for_abi_non_trivial_copy_ctor const& __it) _NOEXCEPT - : __seg_(__it.__seg_), __ctz_(__it.__ctz_) {} - - // Always declare the copy assignment operator since the implicit declaration - // is deprecated. + // When _IsConst=false, we have a user-provided copy constructor, + // so we must also provide a copy assignment operator because + // the implicit generation of a defaulted one is deprecated. + // When _IsConst=true, the assignment operators are + // implicitly generated and trivial. _LIBCPP_INLINE_VISIBILITY - __bit_iterator& operator=(__bit_iterator const&) = default; + __bit_iterator& operator=(const _If<_IsConst, struct __private_nat, __bit_iterator>& __it) { + __seg_ = __it.__seg_; + __ctz_ = __it.__ctz_; + return *this; + } _LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT {return reference(__seg_, __storage_type(1) << __ctz_);} diff --git a/contrib/llvm-project/libcxx/include/memory b/contrib/llvm-project/libcxx/include/memory index efb10c8fd25b..62235cf72b35 100644 --- a/contrib/llvm-project/libcxx/include/memory +++ b/contrib/llvm-project/libcxx/include/memory @@ -810,10 +810,35 @@ public: }; #endif +// This class provides a non-trivial default constructor to the class that derives from it +// if the condition is satisfied. +// +// The second template parameter exists to allow giving a unique type to __non_trivial_if, +// which makes it possible to avoid breaking the ABI when making this a base class of an +// existing class. Without that, imagine we have classes D1 and D2, both of which used to +// have no base classes, but which now derive from __non_trivial_if. The layout of a class +// that inherits from both D1 and D2 will change because the two __non_trivial_if base +// classes are not allowed to share the same address. +// +// By making those __non_trivial_if base classes unique, we work around this problem and +// it is safe to start deriving from __non_trivial_if in existing classes. +template +struct __non_trivial_if { }; + +template +struct __non_trivial_if { + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR __non_trivial_if() _NOEXCEPT { } +}; + // allocator +// +// Note: For ABI compatibility between C++20 and previous standards, we make +// allocator trivial in C++20. template class _LIBCPP_TEMPLATE_VIS allocator + : private __non_trivial_if::value, allocator<_Tp> > { public: typedef size_t size_type; @@ -823,7 +848,7 @@ public: typedef true_type is_always_equal; _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - allocator() _NOEXCEPT { } + allocator() _NOEXCEPT _LIBCPP_DEFAULT template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 @@ -895,6 +920,7 @@ public: template class _LIBCPP_TEMPLATE_VIS allocator + : private __non_trivial_if::value, allocator > { public: typedef size_t size_type; @@ -904,7 +930,7 @@ public: typedef true_type is_always_equal; _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - allocator() _NOEXCEPT { } + allocator() _NOEXCEPT _LIBCPP_DEFAULT template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 @@ -2745,7 +2771,6 @@ public: typename enable_if < !is_lvalue_reference<_Dp>::value && - !is_array<_Yp>::value && is_convertible::pointer, element_type*>::value, __nat >::type = __nat()); @@ -2754,7 +2779,6 @@ public: typename enable_if < is_lvalue_reference<_Dp>::value && - !is_array<_Yp>::value && is_convertible::pointer, element_type*>::value, __nat >::type = __nat()); @@ -2795,7 +2819,6 @@ public: template typename enable_if < - !is_array<_Yp>::value && is_convertible::pointer, element_type*>::value, shared_ptr& >::type @@ -3157,7 +3180,6 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r, typename enable_if < !is_lvalue_reference<_Dp>::value && - !is_array<_Yp>::value && is_convertible::pointer, element_type*>::value, __nat >::type) @@ -3170,7 +3192,7 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r, #endif { typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; - typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk; + typedef __shared_ptr_pointer::pointer, _Dp, _AllocT > _CntrlBlk; __cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), _AllocT()); __enable_weak_this(__r.get(), __r.get()); } @@ -3183,7 +3205,6 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r, typename enable_if < is_lvalue_reference<_Dp>::value && - !is_array<_Yp>::value && is_convertible::pointer, element_type*>::value, __nat >::type) @@ -3196,7 +3217,7 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r, #endif { typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; - typedef __shared_ptr_pointer<_Yp*, + typedef __shared_ptr_pointer::pointer, reference_wrapper::type>, _AllocT > _CntrlBlk; __cntrl_ = new _CntrlBlk(__r.get(), _VSTD::ref(__r.get_deleter()), _AllocT()); @@ -3280,7 +3301,6 @@ template inline typename enable_if < - !is_array<_Yp>::value && is_convertible::pointer, typename shared_ptr<_Tp>::element_type*>::value, shared_ptr<_Tp>& diff --git a/contrib/llvm-project/libcxx/include/version b/contrib/llvm-project/libcxx/include/version index 813bc1ab9e6a..c021db8bddd7 100644 --- a/contrib/llvm-project/libcxx/include/version +++ b/contrib/llvm-project/libcxx/include/version @@ -184,7 +184,7 @@ __cpp_lib_void_t 201411L # define __cpp_lib_quoted_string_io 201304L # define __cpp_lib_result_of_sfinae 201210L # define __cpp_lib_robust_nonmodifying_seq_ops 201304L -# if !defined(_LIBCPP_HAS_NO_THREADS) +# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) # define __cpp_lib_shared_timed_mutex 201402L # endif # define __cpp_lib_string_udls 201304L @@ -213,7 +213,9 @@ __cpp_lib_void_t 201411L # define __cpp_lib_clamp 201603L # define __cpp_lib_enable_shared_from_this 201603L // # define __cpp_lib_execution 201603L -# define __cpp_lib_filesystem 201703L +# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) +# define __cpp_lib_filesystem 201703L +# endif # define __cpp_lib_gcd_lcm 201606L // # define __cpp_lib_hardware_interference_size 201703L # if defined(_LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS) @@ -241,7 +243,7 @@ __cpp_lib_void_t 201411L # define __cpp_lib_raw_memory_algorithms 201606L # define __cpp_lib_sample 201603L # define __cpp_lib_scoped_lock 201703L -# if !defined(_LIBCPP_HAS_NO_THREADS) +# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) # define __cpp_lib_shared_mutex 201505L # endif # define __cpp_lib_shared_ptr_arrays 201611L @@ -279,10 +281,10 @@ __cpp_lib_void_t 201411L # if !defined(_LIBCPP_HAS_NO_THREADS) // # define __cpp_lib_atomic_value_initialization 201911L # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) +# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait) # define __cpp_lib_atomic_wait 201907L # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) +# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier) # define __cpp_lib_barrier 201907L # endif // # define __cpp_lib_bind_front 201907L @@ -326,7 +328,7 @@ __cpp_lib_void_t 201411L # if !defined(_LIBCPP_HAS_NO_THREADS) // # define __cpp_lib_jthread 201911L # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) +# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch) # define __cpp_lib_latch 201907L # endif # define __cpp_lib_list_remove_return_type 201806L @@ -336,7 +338,7 @@ __cpp_lib_void_t 201411L // # define __cpp_lib_polymorphic_allocator 201902L // # define __cpp_lib_ranges 201811L # define __cpp_lib_remove_cvref 201711L -# if !defined(_LIBCPP_HAS_NO_THREADS) +# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore) # define __cpp_lib_semaphore 201907L # endif # define __cpp_lib_shift 201806L diff --git a/contrib/llvm-project/llvm/include/llvm-c/Core.h b/contrib/llvm-project/llvm/include/llvm-c/Core.h index a78df16ca404..2901ab715810 100644 --- a/contrib/llvm-project/llvm/include/llvm-c/Core.h +++ b/contrib/llvm-project/llvm/include/llvm-c/Core.h @@ -604,6 +604,17 @@ unsigned LLVMGetEnumAttributeKind(LLVMAttributeRef A); */ uint64_t LLVMGetEnumAttributeValue(LLVMAttributeRef A); +/** + * Create a type attribute + */ +LLVMAttributeRef LLVMCreateTypeAttribute(LLVMContextRef C, unsigned KindID, + LLVMTypeRef type_ref); + +/** + * Get the type attribute's value. + */ +LLVMTypeRef LLVMGetTypeAttributeValue(LLVMAttributeRef A); + /** * Create a string attribute. */ @@ -626,6 +637,7 @@ const char *LLVMGetStringAttributeValue(LLVMAttributeRef A, unsigned *Length); */ LLVMBool LLVMIsEnumAttribute(LLVMAttributeRef A); LLVMBool LLVMIsStringAttribute(LLVMAttributeRef A); +LLVMBool LLVMIsTypeAttribute(LLVMAttributeRef A); /** * Obtain a Type from a context by its registered name. diff --git a/contrib/llvm-project/llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h b/contrib/llvm-project/llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h index 39ae53c4e7fe..cf4c827b9267 100644 --- a/contrib/llvm-project/llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h +++ b/contrib/llvm-project/llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h @@ -111,6 +111,16 @@ public: return AttributeSpecs[idx].Attr; } + bool getAttrIsImplicitConstByIndex(uint32_t idx) const { + assert(idx < AttributeSpecs.size()); + return AttributeSpecs[idx].isImplicitConst(); + } + + int64_t getAttrImplicitConstValueByIndex(uint32_t idx) const { + assert(idx < AttributeSpecs.size()); + return AttributeSpecs[idx].getImplicitConstValue(); + } + /// Get the index of the specified attribute. /// /// Searches the this abbreviation declaration for the index of the specified diff --git a/contrib/llvm-project/llvm/include/llvm/Support/Host.h b/contrib/llvm-project/llvm/include/llvm/Support/Host.h index d4ef389450cc..b3c15f0683b9 100644 --- a/contrib/llvm-project/llvm/include/llvm/Support/Host.h +++ b/contrib/llvm-project/llvm/include/llvm/Support/Host.h @@ -65,6 +65,20 @@ namespace sys { StringRef getHostCPUNameForARM(StringRef ProcCpuinfoContent); StringRef getHostCPUNameForS390x(StringRef ProcCpuinfoContent); StringRef getHostCPUNameForBPF(); + + /// Helper functions to extract CPU details from CPUID on x86. + namespace x86 { + enum class VendorSignatures { + UNKNOWN, + GENUINE_INTEL, + AUTHENTIC_AMD, + }; + + /// Returns the host CPU's vendor. + /// MaxLeaf: if a non-nullptr pointer is specified, the EAX value will be + /// assigned to its pointee. + VendorSignatures getVendorSignature(unsigned *MaxLeaf = nullptr); + } // namespace x86 } } } diff --git a/contrib/llvm-project/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h b/contrib/llvm-project/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h index 2f80b4373b46..246db0fd2dd9 100644 --- a/contrib/llvm-project/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h +++ b/contrib/llvm-project/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h @@ -396,22 +396,17 @@ private: bool canVectorizeOuterLoop(); /// Return true if all of the instructions in the block can be speculatively - /// executed, and record the loads/stores that require masking. If's that - /// guard loads can be ignored under "assume safety" unless \p PreserveGuards - /// is true. This can happen when we introduces guards for which the original - /// "unguarded-loads are safe" assumption does not hold. For example, the - /// vectorizer's fold-tail transformation changes the loop to execute beyond - /// its original trip-count, under a proper guard, which should be preserved. + /// executed, and record the loads/stores that require masking. /// \p SafePtrs is a list of addresses that are known to be legal and we know /// that we can read from them without segfault. /// \p MaskedOp is a list of instructions that have to be transformed into /// calls to the appropriate masked intrinsic when the loop is vectorized. /// \p ConditionalAssumes is a list of assume instructions in predicated /// blocks that must be dropped if the CFG gets flattened. - bool blockCanBePredicated(BasicBlock *BB, SmallPtrSetImpl &SafePtrs, - SmallPtrSetImpl &MaskedOp, - SmallPtrSetImpl &ConditionalAssumes, - bool PreserveGuards = false) const; + bool blockCanBePredicated( + BasicBlock *BB, SmallPtrSetImpl &SafePtrs, + SmallPtrSetImpl &MaskedOp, + SmallPtrSetImpl &ConditionalAssumes) const; /// Updates the vectorization state by adding \p Phi to the inductions list. /// This can set \p Phi as the main induction of the loop if \p Phi is a diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp index 427f6f4942c3..5a55f3a04148 100644 --- a/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp +++ b/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp @@ -69,7 +69,7 @@ static void dumpRanges(const DWARFObject &Obj, raw_ostream &OS, } } -static void dumpLocation(raw_ostream &OS, DWARFFormValue &FormValue, +static void dumpLocation(raw_ostream &OS, const DWARFFormValue &FormValue, DWARFUnit *U, unsigned Indent, DIDumpOptions DumpOpts) { DWARFContext &Ctx = U->getContext(); @@ -230,21 +230,22 @@ static void dumpTypeName(raw_ostream &OS, const DWARFDie &D) { } static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die, - uint64_t *OffsetPtr, dwarf::Attribute Attr, - dwarf::Form Form, unsigned Indent, + const DWARFAttribute &AttrValue, unsigned Indent, DIDumpOptions DumpOpts) { if (!Die.isValid()) return; const char BaseIndent[] = " "; OS << BaseIndent; OS.indent(Indent + 2); + dwarf::Attribute Attr = AttrValue.Attr; WithColor(OS, HighlightColor::Attribute) << formatv("{0}", Attr); + dwarf::Form Form = AttrValue.Value.getForm(); if (DumpOpts.Verbose || DumpOpts.ShowForm) OS << formatv(" [{0}]", Form); DWARFUnit *U = Die.getDwarfUnit(); - DWARFFormValue FormValue = DWARFFormValue::createFromUnit(Form, U, OffsetPtr); + const DWARFFormValue &FormValue = AttrValue.Value; OS << "\t("; @@ -631,16 +632,8 @@ void DWARFDie::dump(raw_ostream &OS, unsigned Indent, OS << '\n'; // Dump all data in the DIE for the attributes. - for (const auto &AttrSpec : AbbrevDecl->attributes()) { - if (AttrSpec.Form == DW_FORM_implicit_const) { - // We are dumping .debug_info section , - // implicit_const attribute values are not really stored here, - // but in .debug_abbrev section. So we just skip such attrs. - continue; - } - dumpAttribute(OS, *this, &offset, AttrSpec.Attr, AttrSpec.Form, - Indent, DumpOpts); - } + for (const DWARFAttribute &AttrValue : attributes()) + dumpAttribute(OS, *this, AttrValue, Indent, DumpOpts); DWARFDie child = getFirstChild(); if (DumpOpts.ShowChildren && DumpOpts.ChildRecurseDepth > 0 && child) { @@ -723,10 +716,16 @@ void DWARFDie::attribute_iterator::updateForIndex( // Add the previous byte size of any previous attribute value. AttrValue.Offset += AttrValue.ByteSize; uint64_t ParseOffset = AttrValue.Offset; - auto U = Die.getDwarfUnit(); - assert(U && "Die must have valid DWARF unit"); - AttrValue.Value = DWARFFormValue::createFromUnit( - AbbrDecl.getFormByIndex(Index), U, &ParseOffset); + if (AbbrDecl.getAttrIsImplicitConstByIndex(Index)) + AttrValue.Value = DWARFFormValue::createFromSValue( + AbbrDecl.getFormByIndex(Index), + AbbrDecl.getAttrImplicitConstValueByIndex(Index)); + else { + auto U = Die.getDwarfUnit(); + assert(U && "Die must have valid DWARF unit"); + AttrValue.Value = DWARFFormValue::createFromUnit( + AbbrDecl.getFormByIndex(Index), U, &ParseOffset); + } AttrValue.ByteSize = ParseOffset - AttrValue.Offset; } else { assert(Index == NumAttrs && "Indexes should be [0, NumAttrs) only"); diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp index 7a84605211fb..2559765876d9 100644 --- a/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp +++ b/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp @@ -168,6 +168,7 @@ bool DWARFFormValue::skipValue(dwarf::Form Form, DataExtractor DebugInfoData, case DW_FORM_line_strp: case DW_FORM_GNU_ref_alt: case DW_FORM_GNU_strp_alt: + case DW_FORM_implicit_const: if (Optional FixedSize = dwarf::getFixedFormByteSize(Form, Params)) { *OffsetPtr += *FixedSize; @@ -345,6 +346,9 @@ bool DWARFFormValue::extractValue(const DWARFDataExtractor &Data, case DW_FORM_ref_sig8: Value.uval = Data.getU64(OffsetPtr, &Err); break; + case DW_FORM_implicit_const: + // Value has been already set by DWARFFormValue::createFromSValue. + break; default: // DWARFFormValue::skipValue() will have caught this and caused all // DWARF DIEs to fail to be parsed, so this code is not be reachable. @@ -482,6 +486,7 @@ void DWARFFormValue::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const { break; case DW_FORM_sdata: + case DW_FORM_implicit_const: OS << Value.sval; break; case DW_FORM_udata: diff --git a/contrib/llvm-project/llvm/lib/IR/Core.cpp b/contrib/llvm-project/llvm/lib/IR/Core.cpp index 90ba69069bae..039b34ace6ab 100644 --- a/contrib/llvm-project/llvm/lib/IR/Core.cpp +++ b/contrib/llvm-project/llvm/lib/IR/Core.cpp @@ -164,6 +164,18 @@ uint64_t LLVMGetEnumAttributeValue(LLVMAttributeRef A) { return Attr.getValueAsInt(); } +LLVMAttributeRef LLVMCreateTypeAttribute(LLVMContextRef C, unsigned KindID, + LLVMTypeRef type_ref) { + auto &Ctx = *unwrap(C); + auto AttrKind = (Attribute::AttrKind)KindID; + return wrap(Attribute::get(Ctx, AttrKind, unwrap(type_ref))); +} + +LLVMTypeRef LLVMGetTypeAttributeValue(LLVMAttributeRef A) { + auto Attr = unwrap(A); + return wrap(Attr.getValueAsType()); +} + LLVMAttributeRef LLVMCreateStringAttribute(LLVMContextRef C, const char *K, unsigned KLength, const char *V, unsigned VLength) { @@ -194,6 +206,10 @@ LLVMBool LLVMIsStringAttribute(LLVMAttributeRef A) { return unwrap(A).isStringAttribute(); } +LLVMBool LLVMIsTypeAttribute(LLVMAttributeRef A) { + return unwrap(A).isTypeAttribute(); +} + char *LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI) { std::string MsgStorage; raw_string_ostream Stream(MsgStorage); diff --git a/contrib/llvm-project/llvm/lib/Support/Host.cpp b/contrib/llvm-project/llvm/lib/Support/Host.cpp index a1bd3cc12f1d..09146c47ff2c 100644 --- a/contrib/llvm-project/llvm/lib/Support/Host.cpp +++ b/contrib/llvm-project/llvm/lib/Support/Host.cpp @@ -417,11 +417,6 @@ StringRef sys::detail::getHostCPUNameForBPF() { #if defined(__i386__) || defined(_M_IX86) || \ defined(__x86_64__) || defined(_M_X64) -enum VendorSignatures { - SIG_INTEL = 0x756e6547 /* Genu */, - SIG_AMD = 0x68747541 /* Auth */ -}; - // The check below for i386 was copied from clang's cpuid.h (__get_cpuid_max). // Check motivated by bug reports for OpenSSL crashing on CPUs without CPUID // support. Consequently, for i386, the presence of CPUID is checked first @@ -495,6 +490,42 @@ static bool getX86CpuIDAndInfo(unsigned value, unsigned *rEAX, unsigned *rEBX, #endif } +namespace llvm { +namespace sys { +namespace detail { +namespace x86 { + +VendorSignatures getVendorSignature(unsigned *MaxLeaf) { + unsigned EAX = 0, EBX = 0, ECX = 0, EDX = 0; + if (MaxLeaf == nullptr) + MaxLeaf = &EAX; + else + *MaxLeaf = 0; + + if (!isCpuIdSupported()) + return VendorSignatures::UNKNOWN; + + if (getX86CpuIDAndInfo(0, MaxLeaf, &EBX, &ECX, &EDX) || *MaxLeaf < 1) + return VendorSignatures::UNKNOWN; + + // "Genu ineI ntel" + if (EBX == 0x756e6547 && EDX == 0x49656e69 && ECX == 0x6c65746e) + return VendorSignatures::GENUINE_INTEL; + + // "Auth enti cAMD" + if (EBX == 0x68747541 && EDX == 0x69746e65 && ECX == 0x444d4163) + return VendorSignatures::AUTHENTIC_AMD; + + return VendorSignatures::UNKNOWN; +} + +} // namespace x86 +} // namespace detail +} // namespace sys +} // namespace llvm + +using namespace llvm::sys::detail::x86; + /// getX86CpuIDAndInfoEx - Execute the specified cpuid with subleaf and return /// the 4 values in the specified arguments. If we can't run cpuid on the host, /// return true. @@ -1092,14 +1123,12 @@ static void getAvailableFeatures(unsigned ECX, unsigned EDX, unsigned MaxLeaf, } StringRef sys::getHostCPUName() { - unsigned EAX = 0, EBX = 0, ECX = 0, EDX = 0; - unsigned MaxLeaf, Vendor; - - if (!isCpuIdSupported()) + unsigned MaxLeaf = 0; + const VendorSignatures Vendor = getVendorSignature(&MaxLeaf); + if (Vendor == VendorSignatures::UNKNOWN) return "generic"; - if (getX86CpuIDAndInfo(0, &MaxLeaf, &Vendor, &ECX, &EDX) || MaxLeaf < 1) - return "generic"; + unsigned EAX = 0, EBX = 0, ECX = 0, EDX = 0; getX86CpuIDAndInfo(0x1, &EAX, &EBX, &ECX, &EDX); unsigned Family = 0, Model = 0; @@ -1114,10 +1143,10 @@ StringRef sys::getHostCPUName() { StringRef CPU; - if (Vendor == SIG_INTEL) { + if (Vendor == VendorSignatures::GENUINE_INTEL) { CPU = getIntelProcessorTypeAndSubtype(Family, Model, Features, &Type, &Subtype); - } else if (Vendor == SIG_AMD) { + } else if (Vendor == VendorSignatures::AUTHENTIC_AMD) { CPU = getAMDProcessorTypeAndSubtype(Family, Model, Features, &Type, &Subtype); } @@ -1219,6 +1248,19 @@ StringRef sys::getHostCPUName() { } #else StringRef sys::getHostCPUName() { return "generic"; } +namespace llvm { +namespace sys { +namespace detail { +namespace x86 { + +VendorSignatures getVendorSignature(unsigned *MaxLeaf) { + return VendorSignatures::UNKNOWN; +} + +} // namespace x86 +} // namespace detail +} // namespace sys +} // namespace llvm #endif #if defined(__linux__) && (defined(__i386__) || defined(__x86_64__)) diff --git a/contrib/llvm-project/llvm/lib/Target/ARM/ARMBlockPlacement.cpp b/contrib/llvm-project/llvm/lib/Target/ARM/ARMBlockPlacement.cpp index 581b4b9857af..9ba16003a97a 100644 --- a/contrib/llvm-project/llvm/lib/Target/ARM/ARMBlockPlacement.cpp +++ b/contrib/llvm-project/llvm/lib/Target/ARM/ARMBlockPlacement.cpp @@ -145,8 +145,7 @@ bool ARMBlockPlacement::runOnMachineFunction(MachineFunction &MF) { It++) { MachineBasicBlock *MBB = &*It; for (auto &Terminator : MBB->terminators()) { - if (Terminator.getOpcode() != ARM::t2LoopEnd && - Terminator.getOpcode() != ARM::t2LoopEndDec) + if (Terminator.getOpcode() != ARM::t2LoopEndDec) continue; MachineBasicBlock *LETarget = Terminator.getOperand(2).getMBB(); // The LE will become forwards branching if it branches to LoopExit @@ -204,10 +203,8 @@ void ARMBlockPlacement::moveBasicBlock(MachineBasicBlock *BB, if (!Terminator.isUnconditionalBranch()) { // The BB doesn't have an unconditional branch so it relied on // fall-through. Fix by adding an unconditional branch to the moved BB. - unsigned BrOpc = - BBUtils->isBBInRange(&Terminator, To, 254) ? ARM::tB : ARM::t2B; MachineInstrBuilder MIB = - BuildMI(From, Terminator.getDebugLoc(), TII->get(BrOpc)); + BuildMI(From, Terminator.getDebugLoc(), TII->get(ARM::t2B)); MIB.addMBB(To); MIB.addImm(ARMCC::CondCodes::AL); MIB.addReg(ARM::NoRegister); diff --git a/contrib/llvm-project/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp b/contrib/llvm-project/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp index 61a924078f29..8dc532058492 100644 --- a/contrib/llvm-project/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp +++ b/contrib/llvm-project/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp @@ -1467,14 +1467,15 @@ MachineInstr* ARMLowOverheadLoops::ExpandLoopStart(LowOverheadLoop &LoLoop) { void ARMLowOverheadLoops::ConvertVPTBlocks(LowOverheadLoop &LoLoop) { auto RemovePredicate = [](MachineInstr *MI) { + if (MI->isDebugInstr()) + return; LLVM_DEBUG(dbgs() << "ARM Loops: Removing predicate from: " << *MI); - if (int PIdx = llvm::findFirstVPTPredOperandIdx(*MI)) { - assert(MI->getOperand(PIdx).getImm() == ARMVCC::Then && - "Expected Then predicate!"); - MI->getOperand(PIdx).setImm(ARMVCC::None); - MI->getOperand(PIdx+1).setReg(0); - } else - llvm_unreachable("trying to unpredicate a non-predicated instruction"); + int PIdx = llvm::findFirstVPTPredOperandIdx(*MI); + assert(PIdx >= 1 && "Trying to unpredicate a non-predicated instruction"); + assert(MI->getOperand(PIdx).getImm() == ARMVCC::Then && + "Expected Then predicate!"); + MI->getOperand(PIdx).setImm(ARMVCC::None); + MI->getOperand(PIdx + 1).setReg(0); }; for (auto &Block : LoLoop.getVPTBlocks()) { @@ -1518,8 +1519,13 @@ void ARMLowOverheadLoops::ConvertVPTBlocks(LowOverheadLoop &LoLoop) { // - Insert a new vpst to predicate the instruction(s) that following // the divergent vpr def. MachineInstr *Divergent = VPTState::getDivergent(Block); + MachineBasicBlock *MBB = Divergent->getParent(); auto DivergentNext = ++MachineBasicBlock::iterator(Divergent); + while (DivergentNext != MBB->end() && DivergentNext->isDebugInstr()) + ++DivergentNext; + bool DivergentNextIsPredicated = + DivergentNext != MBB->end() && getVPTInstrPredicate(*DivergentNext) != ARMVCC::None; *** 435 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Fri Jul 16 17:07:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EF4A46649C5; Fri, 16 Jul 2021 17:07: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 4GRHjv6QRSz3K1h; Fri, 16 Jul 2021 17:07: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 BE8ED20856; Fri, 16 Jul 2021 17:07: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 16GH7lnt028966; Fri, 16 Jul 2021 17:07:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GH7lXA028965; Fri, 16 Jul 2021 17:07:47 GMT (envelope-from git) Date: Fri, 16 Jul 2021 17:07:47 GMT Message-Id: <202107161707.16GH7lXA028965@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: David Chisnall Subject: git: cf98bc28d39d - main - Pass the syscall number to capsicum permission-denied signals MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: theraven X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cf98bc28d39d6df5386ac57375af1b60af5d6bb3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 17:07:48 -0000 The branch main has been updated by theraven: URL: https://cgit.FreeBSD.org/src/commit/?id=cf98bc28d39d6df5386ac57375af1b60af5d6bb3 commit cf98bc28d39d6df5386ac57375af1b60af5d6bb3 Author: David Chisnall AuthorDate: 2021-07-10 16:19:52 +0000 Commit: David Chisnall CommitDate: 2021-07-16 17:06:44 +0000 Pass the syscall number to capsicum permission-denied signals The syscall number is stored in the same register as the syscall return on amd64 (and possibly other architectures) and so it is impossible to recover in the signal handler after the call has returned. This small tweak delivers it in the `si_value` field of the signal, which is sufficient to catch capability violations and emulate them with a call to a more-privileged process in the signal handler. This reapplies 3a522ba1bc852c3d4660a4fa32e4a94999d09a47 with a fix for the static assertion failure on i386. Approved by: markj (mentor) Reviewed by: kib, bcr (manpages) Differential Revision: https://reviews.freebsd.org/D29185 --- lib/libc/sys/procctl.2 | 10 ++++++++++ share/man/man3/siginfo.3 | 2 ++ sys/amd64/amd64/trap.c | 1 + sys/amd64/cloudabi32/cloudabi32_sysvec.c | 1 + sys/amd64/cloudabi64/cloudabi64_sysvec.c | 1 + sys/amd64/ia32/ia32_syscall.c | 1 + sys/amd64/include/proc.h | 1 + sys/amd64/linux/linux_sysvec.c | 1 + sys/amd64/linux32/linux32_sysvec.c | 1 + sys/arm/arm/syscall.c | 1 + sys/arm/cloudabi32/cloudabi32_sysvec.c | 1 + sys/arm/include/proc.h | 1 + sys/arm64/arm64/elf32_machdep.c | 1 + sys/arm64/arm64/trap.c | 1 + sys/arm64/cloudabi32/cloudabi32_sysvec.c | 1 + sys/arm64/cloudabi64/cloudabi64_sysvec.c | 1 + sys/arm64/include/proc.h | 1 + sys/arm64/linux/linux_sysvec.c | 1 + sys/i386/cloudabi32/cloudabi32_sysvec.c | 1 + sys/i386/i386/trap.c | 1 + sys/i386/include/proc.h | 1 + sys/i386/linux/linux_sysvec.c | 1 + sys/kern/kern_thread.c | 4 ++-- sys/kern/subr_syscall.c | 1 + sys/mips/include/proc.h | 1 + sys/mips/mips/trap.c | 1 + sys/powerpc/include/proc.h | 1 + sys/powerpc/powerpc/trap.c | 1 + sys/riscv/include/proc.h | 1 + sys/riscv/riscv/trap.c | 1 + sys/sys/signal.h | 7 +++++++ 31 files changed, 48 insertions(+), 2 deletions(-) diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2 index 432ed5919a81..ce7a2be5d5e4 100644 --- a/lib/libc/sys/procctl.2 +++ b/lib/libc/sys/procctl.2 @@ -454,6 +454,16 @@ and the .Va si_code member is set to .Dv TRAP_CAP . +The system call number is stored in the +.Va si_syscall +field of the +.Fa siginfo +signal handler parameter. +The other system call parameters can be read from the +.Fa ucontext_t +but the system call number is typically stored in the register +that also contains the return value and so is unavailable in the +signal handler. .Pp See .Xr capsicum 4 diff --git a/share/man/man3/siginfo.3 b/share/man/man3/siginfo.3 index acc8785b2f0d..7f8a809cdfa5 100644 --- a/share/man/man3/siginfo.3 +++ b/share/man/man3/siginfo.3 @@ -85,6 +85,8 @@ timer overrun count .It Vt int Ta Va si_mqd Ta .Tn POSIX message queue ID +.It Vt int Ta Va si_syscall Ta +system-call number for system calls blocked by Capsicum .El .Pp The diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 55649687ce50..b08495f3f139 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -1059,6 +1059,7 @@ cpu_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = frame->tf_rax; + sa->original_code = sa->code; if (__predict_false(sa->code == SYS_syscall || sa->code == SYS___syscall || diff --git a/sys/amd64/cloudabi32/cloudabi32_sysvec.c b/sys/amd64/cloudabi32/cloudabi32_sysvec.c index 164f87e90e91..26924ed5a980 100644 --- a/sys/amd64/cloudabi32/cloudabi32_sysvec.c +++ b/sys/amd64/cloudabi32/cloudabi32_sysvec.c @@ -101,6 +101,7 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* 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]; diff --git a/sys/amd64/cloudabi64/cloudabi64_sysvec.c b/sys/amd64/cloudabi64/cloudabi64_sysvec.c index d3893902b08e..c08d912e84d4 100644 --- a/sys/amd64/cloudabi64/cloudabi64_sysvec.c +++ b/sys/amd64/cloudabi64/cloudabi64_sysvec.c @@ -98,6 +98,7 @@ cloudabi64_fetch_syscall_args(struct thread *td) /* 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]; diff --git a/sys/amd64/ia32/ia32_syscall.c b/sys/amd64/ia32/ia32_syscall.c index 6c9399d1a52f..9294ef8ce741 100644 --- a/sys/amd64/ia32/ia32_syscall.c +++ b/sys/amd64/ia32/ia32_syscall.c @@ -150,6 +150,7 @@ ia32_fetch_syscall_args(struct thread *td) params = (caddr_t)frame->tf_rsp + sizeof(u_int32_t); sa->code = frame->tf_rax; + sa->original_code = sa->code; /* * Need to check if this is a 32 bit or 64 bit syscall. diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h index 59796e729ac4..0f8cf50e326d 100644 --- a/sys/amd64/include/proc.h +++ b/sys/amd64/include/proc.h @@ -92,6 +92,7 @@ struct mdproc { struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[8]; }; diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index c5538932b1e3..566af6de29e7 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -191,6 +191,7 @@ linux_fetch_syscall_args(struct thread *td) sa->args[4] = frame->tf_r8; sa->args[5] = frame->tf_r9; sa->code = frame->tf_rax; + sa->original_code = sa->code; if (sa->code >= p->p_sysent->sv_size) /* nosys */ diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index 504d57e418a5..7dfd57a74a1e 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -662,6 +662,7 @@ linux32_fetch_syscall_args(struct thread *td) sa->args[4] = frame->tf_rdi; sa->args[5] = frame->tf_rbp; /* Unconfirmed */ sa->code = frame->tf_rax; + sa->original_code = sa->code; if (sa->code >= p->p_sysent->sv_size) /* nosys */ diff --git a/sys/arm/arm/syscall.c b/sys/arm/arm/syscall.c index a851db6e4556..a635de0ec716 100644 --- a/sys/arm/arm/syscall.c +++ b/sys/arm/arm/syscall.c @@ -108,6 +108,7 @@ cpu_fetch_syscall_args(struct thread *td) nap = 4; sa = &td->td_sa; sa->code = td->td_frame->tf_r7; + sa->original_code = sa->code; ap = &td->td_frame->tf_r0; if (sa->code == SYS_syscall) { sa->code = *ap++; diff --git a/sys/arm/cloudabi32/cloudabi32_sysvec.c b/sys/arm/cloudabi32/cloudabi32_sysvec.c index a8c5da47d265..4df57b22e13d 100644 --- a/sys/arm/cloudabi32/cloudabi32_sysvec.c +++ b/sys/arm/cloudabi32/cloudabi32_sysvec.c @@ -78,6 +78,7 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_r12; + sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/arm/include/proc.h b/sys/arm/include/proc.h index a37ccd8f621c..9566c264731e 100644 --- a/sys/arm/include/proc.h +++ b/sys/arm/include/proc.h @@ -75,6 +75,7 @@ struct mdproc { */ struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[MAXARGS]; } __aligned(8); diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c index 206413b45172..7cedbffc4d43 100644 --- a/sys/arm64/arm64/elf32_machdep.c +++ b/sys/arm64/arm64/elf32_machdep.c @@ -175,6 +175,7 @@ freebsd32_fetch_syscall_args(struct thread *td) /* r7 is the syscall id */ sa->code = td->td_frame->tf_x[7]; + sa->original_code = sa->code; if (sa->code == SYS_syscall) { sa->code = *ap++; diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index e876fa5011c3..c6dd8c276414 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -130,6 +130,7 @@ cpu_fetch_syscall_args(struct thread *td) dst_ap = &sa->args[0]; sa->code = td->td_frame->tf_x[8]; + sa->original_code = sa->code; if (__predict_false(sa->code == SYS_syscall || sa->code == SYS___syscall)) { sa->code = *ap++; diff --git a/sys/arm64/cloudabi32/cloudabi32_sysvec.c b/sys/arm64/cloudabi32/cloudabi32_sysvec.c index 889393560ede..b7be5cc0e5e3 100644 --- a/sys/arm64/cloudabi32/cloudabi32_sysvec.c +++ b/sys/arm64/cloudabi32/cloudabi32_sysvec.c @@ -75,6 +75,7 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_x[0]; + sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/arm64/cloudabi64/cloudabi64_sysvec.c b/sys/arm64/cloudabi64/cloudabi64_sysvec.c index bdbd828b7b62..624d86693457 100644 --- a/sys/arm64/cloudabi64/cloudabi64_sysvec.c +++ b/sys/arm64/cloudabi64/cloudabi64_sysvec.c @@ -78,6 +78,7 @@ cloudabi64_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_x[8]; + sa->original_code = sa->code; if (sa->code >= CLOUDABI64_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi64_sysent[sa->code]; diff --git a/sys/arm64/include/proc.h b/sys/arm64/include/proc.h index bb933dc98241..3800798d79b7 100644 --- a/sys/arm64/include/proc.h +++ b/sys/arm64/include/proc.h @@ -49,6 +49,7 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 40f68a537985..e684fb604889 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -123,6 +123,7 @@ linux_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = td->td_frame->tf_x[8]; + sa->original_code = sa->code; /* LINUXTODO: generic syscall? */ if (sa->code >= p->p_sysent->sv_size) sa->callp = &p->p_sysent->sv_table[0]; diff --git a/sys/i386/cloudabi32/cloudabi32_sysvec.c b/sys/i386/cloudabi32/cloudabi32_sysvec.c index 4f12d2b6cbce..e0a50f6697a9 100644 --- a/sys/i386/cloudabi32/cloudabi32_sysvec.c +++ b/sys/i386/cloudabi32/cloudabi32_sysvec.c @@ -96,6 +96,7 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_eax; + sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 045478149be5..07abac23c9da 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -1052,6 +1052,7 @@ cpu_fetch_syscall_args(struct thread *td) #endif sa->code = frame->tf_eax; + sa->original_code = sa->code; params = (caddr_t)frame->tf_esp + sizeof(uint32_t); /* diff --git a/sys/i386/include/proc.h b/sys/i386/include/proc.h index 2950946ff155..76e1ac611474 100644 --- a/sys/i386/include/proc.h +++ b/sys/i386/include/proc.h @@ -64,6 +64,7 @@ struct mdproc { struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[8]; }; diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index adb70fded6dc..a0959d55b585 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -756,6 +756,7 @@ linux_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = frame->tf_eax; + sa->original_code = sa->code; sa->args[0] = frame->tf_ebx; sa->args[1] = frame->tf_ecx; sa->args[2] = frame->tf_edx; diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 7d971d295cba..328a69bc5f23 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -108,9 +108,9 @@ _Static_assert(offsetof(struct thread, td_flags) == 0x98, "struct thread KBI td_flags"); _Static_assert(offsetof(struct thread, td_pflags) == 0xa0, "struct thread KBI td_pflags"); -_Static_assert(offsetof(struct thread, td_frame) == 0x300, +_Static_assert(offsetof(struct thread, td_frame) == 0x304, "struct thread KBI td_frame"); -_Static_assert(offsetof(struct thread, td_emuldata) == 0x344, +_Static_assert(offsetof(struct thread, td_emuldata) == 0x348, "struct thread KBI td_emuldata"); _Static_assert(offsetof(struct proc, p_flag) == 0x6c, "struct proc KBI p_flag"); diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c index 85a0814a2125..2304e3e7f3f9 100644 --- a/sys/kern/subr_syscall.c +++ b/sys/kern/subr_syscall.c @@ -230,6 +230,7 @@ syscallret(struct thread *td) ksi.ksi_signo = SIGTRAP; ksi.ksi_errno = td->td_errno; ksi.ksi_code = TRAP_CAP; + ksi.ksi_info.si_syscall = sa->original_code; trapsignal(td, &ksi); } } diff --git a/sys/mips/include/proc.h b/sys/mips/include/proc.h index 0cb1d433387c..29d832a162e6 100644 --- a/sys/mips/include/proc.h +++ b/sys/mips/include/proc.h @@ -84,6 +84,7 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/mips/mips/trap.c b/sys/mips/mips/trap.c index 96a2de4ee817..9d7a07606373 100644 --- a/sys/mips/mips/trap.c +++ b/sys/mips/mips/trap.c @@ -355,6 +355,7 @@ cpu_fetch_syscall_args(struct thread *td) else locr0->pc += sizeof(int); sa->code = locr0->v0; + sa->original_code = sa->code; switch (sa->code) { case SYS___syscall: diff --git a/sys/powerpc/include/proc.h b/sys/powerpc/include/proc.h index d4df3ccfefef..aac4e66b39fc 100644 --- a/sys/powerpc/include/proc.h +++ b/sys/powerpc/include/proc.h @@ -62,6 +62,7 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/powerpc/powerpc/trap.c b/sys/powerpc/powerpc/trap.c index 3a1bdf7cde07..ab5189a0f418 100644 --- a/sys/powerpc/powerpc/trap.c +++ b/sys/powerpc/powerpc/trap.c @@ -667,6 +667,7 @@ cpu_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = frame->fixreg[0]; + sa->original_code = sa->code; params = (caddr_t)(frame->fixreg + FIRSTARG); n = NARGREG; diff --git a/sys/riscv/include/proc.h b/sys/riscv/include/proc.h index 4b5ae9ebe3ed..1c6c8d2919b5 100644 --- a/sys/riscv/include/proc.h +++ b/sys/riscv/include/proc.h @@ -48,6 +48,7 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/riscv/riscv/trap.c b/sys/riscv/riscv/trap.c index 07d7f84a94e8..8844638c8204 100644 --- a/sys/riscv/riscv/trap.c +++ b/sys/riscv/riscv/trap.c @@ -103,6 +103,7 @@ cpu_fetch_syscall_args(struct thread *td) dst_ap = &sa->args[0]; sa->code = td->td_frame->tf_t[0]; + sa->original_code = sa->code; if (__predict_false(sa->code == SYS_syscall || sa->code == SYS___syscall)) { sa->code = *ap++; diff --git a/sys/sys/signal.h b/sys/sys/signal.h index 8b45a521c3ee..9dae3ce04745 100644 --- a/sys/sys/signal.h +++ b/sys/sys/signal.h @@ -255,6 +255,12 @@ typedef struct __siginfo { struct { long _band; /* band event for SIGPOLL */ } _poll; /* was this ever used ? */ + struct { + int _syscall; /* Syscall number for signals + * delivered as a result of + * system calls denied by + * Capsicum. */ + } _capsicum; struct { long __spare1__; int __spare2__[7]; @@ -267,6 +273,7 @@ typedef struct __siginfo { #define si_overrun _reason._timer._overrun #define si_mqd _reason._mesgq._mqd #define si_band _reason._poll._band +#define si_syscall _reason._capsicum._syscall #if defined(_WANT_LWPINFO32) || (defined(_KERNEL) && defined(__LP64__)) struct siginfo32 { From owner-dev-commits-src-main@freebsd.org Fri Jul 16 18:01:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4BA236657D2; Fri, 16 Jul 2021 18:01: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 4GRJvr1kLYz3q4M; Fri, 16 Jul 2021 18:01: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 235C4218C3; Fri, 16 Jul 2021 18:01: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 16GI1SM9006501; Fri, 16 Jul 2021 18:01:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GI1StW006500; Fri, 16 Jul 2021 18:01:28 GMT (envelope-from git) Date: Fri, 16 Jul 2021 18:01:28 GMT Message-Id: <202107161801.16GI1StW006500@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: db4d2d7222ee - main - tcp: When rack or bbr get a pullup failure in the common code, don't free the NULL mbuf. 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: db4d2d7222ee1c03ade4eb3b82e263ce5c94cf61 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 18:01:28 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=db4d2d7222ee1c03ade4eb3b82e263ce5c94cf61 commit db4d2d7222ee1c03ade4eb3b82e263ce5c94cf61 Author: Randall Stewart AuthorDate: 2021-07-16 17:59:57 +0000 Commit: Randall Stewart CommitDate: 2021-07-16 17:59:57 +0000 tcp: When rack or bbr get a pullup failure in the common code, don't free the NULL mbuf. There is a bug in the error path where rack_bbr_common does a m_pullup() and the pullup fails. There is a stray mfree(m) after m is set to NULL. This is not a good idea :-) Reviewed by: tuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D31194 --- sys/netinet/tcp_stacks/rack_bbr_common.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack_bbr_common.c b/sys/netinet/tcp_stacks/rack_bbr_common.c index d9f48f733e93..baa267b43752 100644 --- a/sys/netinet/tcp_stacks/rack_bbr_common.c +++ b/sys/netinet/tcp_stacks/rack_bbr_common.c @@ -210,7 +210,6 @@ ctf_get_enet_type(struct ifnet *ifp, struct mbuf *m) m = m_pullup(m, sizeof(*ip6) + sizeof(*th)); if (m == NULL) { KMOD_TCPSTAT_INC(tcps_rcvshort); - m_freem(m); return (-1); } } @@ -243,7 +242,6 @@ ctf_get_enet_type(struct ifnet *ifp, struct mbuf *m) m = m_pullup(m, sizeof (struct tcpiphdr)); if (m == NULL) { KMOD_TCPSTAT_INC(tcps_rcvshort); - m_freem(m); return (-1); } } From owner-dev-commits-src-main@freebsd.org Fri Jul 16 22:08:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 35012668A53; Fri, 16 Jul 2021 22:08: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 4GRQNs0XjSz3P01; Fri, 16 Jul 2021 22:08: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 EDAC624BA8; Fri, 16 Jul 2021 22:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GM8SaY027948; Fri, 16 Jul 2021 22:08:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GM8SPl027947; Fri, 16 Jul 2021 22:08:28 GMT (envelope-from git) Date: Fri, 16 Jul 2021 22:08:28 GMT Message-Id: <202107162208.16GM8SPl027947@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: ee29e6f31111 - main - nfsd: Add sysctl to set maximum I/O size up to 1Mbyte MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee29e6f31111ea3cd490248987f2f2ec412eb0bb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 22:08:29 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=ee29e6f31111ea3cd490248987f2f2ec412eb0bb commit ee29e6f31111ea3cd490248987f2f2ec412eb0bb Author: Rick Macklem AuthorDate: 2021-07-16 22:01:03 +0000 Commit: Rick Macklem CommitDate: 2021-07-16 22:01:03 +0000 nfsd: Add sysctl to set maximum I/O size up to 1Mbyte Since MAXPHYS now allows the FreeBSD NFS client to do 1Mbyte I/O operations, add a sysctl called vfs.nfsd.srvmaxio so that the maximum NFS server I/O size can be set up to 1Mbyte. The Linux NFS client can also do 1Mbyte I/O operations. The default of 128Kbytes for the maximum I/O size has not been changed for two reasons: - kern.ipc.maxsockbuf must be increased to support 1Mbyte I/O - The limited benchmarking I can do actually shows a drop in I/O rate when the I/O size is above 256Kbytes. However, daveb@spectralogic.com reports seeing an increase in I/O rate for the 1Mbyte I/O size vs 128Kbytes using a Linux client. Reviewed by: asomers MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30826 --- sys/fs/nfs/nfs.h | 2 +- sys/fs/nfs/nfs_commonport.c | 7 ++-- sys/fs/nfs/nfs_commonsubs.c | 5 ++- sys/fs/nfs/nfsproto.h | 1 - sys/fs/nfsserver/nfs_nfsdport.c | 81 ++++++++++++++++++++++++++++++++++++++++ sys/fs/nfsserver/nfs_nfsdserv.c | 12 ++++-- sys/fs/nfsserver/nfs_nfsdstate.c | 11 +++--- 7 files changed, 104 insertions(+), 15 deletions(-) diff --git a/sys/fs/nfs/nfs.h b/sys/fs/nfs/nfs.h index 272b8dbfee22..1a29a7e1d6ec 100644 --- a/sys/fs/nfs/nfs.h +++ b/sys/fs/nfs/nfs.h @@ -156,7 +156,7 @@ (t).tv_sec = time.tv_sec; (t).tv_nsec = 1000 * time.tv_usec; } while (0) #define NFS_SRVMAXDATA(n) \ (((n)->nd_flag & (ND_NFSV3 | ND_NFSV4)) ? \ - NFS_SRVMAXIO : NFS_V2MAXDATA) + nfs_srvmaxio : NFS_V2MAXDATA) #define NFS64BITSSET 0xffffffffffffffffull #define NFS64BITSMINUS1 0xfffffffffffffffeull diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c index 47038980c640..8a100749fc32 100644 --- a/sys/fs/nfs/nfs_commonport.c +++ b/sys/fs/nfs/nfs_commonport.c @@ -76,6 +76,7 @@ void (*nfsd_call_servertimer)(void) = NULL; void (*ncl_call_invalcaches)(struct vnode *) = NULL; vop_advlock_t *nfs_advlock_p = NULL; vop_reclaim_t *nfs_reclaim_p = NULL; +uint32_t nfs_srvmaxio = NFS_SRVMAXIO; int nfs_pnfsio(task_fn_t *, void *); @@ -303,11 +304,11 @@ nfsvno_getfs(struct nfsfsinfo *sip, int isdgram) if (isdgram) pref = NFS_MAXDGRAMDATA; else - pref = NFS_SRVMAXIO; - sip->fs_rtmax = NFS_SRVMAXIO; + pref = nfs_srvmaxio; + sip->fs_rtmax = nfs_srvmaxio; sip->fs_rtpref = pref; sip->fs_rtmult = NFS_FABLKSIZE; - sip->fs_wtmax = NFS_SRVMAXIO; + sip->fs_wtmax = nfs_srvmaxio; sip->fs_wtpref = pref; sip->fs_wtmult = NFS_FABLKSIZE; sip->fs_dtpref = pref; diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 1bdc13123aac..817d89284091 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -85,6 +85,7 @@ extern volatile int nfsrv_devidcnt; extern int nfscl_debuglevel; extern struct nfsdevicehead nfsrv_devidhead; extern struct nfsstatsv1 nfsstatsv1; +extern uint32_t nfs_srvmaxio; SYSCTL_DECL(_vfs_nfs); SYSCTL_INT(_vfs_nfs, OID_AUTO, enable_uidtostring, CTLFLAG_RW, @@ -2201,7 +2202,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); attrsum += NFSX_UNSIGNED; i = fxdr_unsigned(int, *tl); - if (compare && !(*retcmpp) && i != NFS_SRVMAXIO) + if (compare && !(*retcmpp) && i != nfs_srvmaxio) *retcmpp = NFSERR_NOTSAME; break; default: @@ -3012,7 +3013,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp, case NFSATTRBIT_LAYOUTALIGNMENT: case NFSATTRBIT_LAYOUTBLKSIZE: NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); - *tl = txdr_unsigned(NFS_SRVMAXIO); + *tl = txdr_unsigned(nfs_srvmaxio); retnum += NFSX_UNSIGNED; break; case NFSATTRBIT_XATTRSUPPORT: diff --git a/sys/fs/nfs/nfsproto.h b/sys/fs/nfs/nfsproto.h index 62d86c3a4593..13e146154805 100644 --- a/sys/fs/nfs/nfsproto.h +++ b/sys/fs/nfs/nfsproto.h @@ -73,7 +73,6 @@ */ #define NFS_MAXPKTHDR 404 #define NFS_MAXXDR 4096 -#define NFS_MAXPACKET (NFS_SRVMAXIO + NFS_MAXXDR) #define NFS_MINPACKET 20 #define NFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */ #define NFSV4_MINORVERSION 0 /* V4 Minor version */ diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 7bcbc738d61b..efe9aac7a136 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -76,6 +76,9 @@ extern struct nfsdontlisthead nfsrv_dontlisthead; extern volatile int nfsrv_dontlistlen; extern volatile int nfsrv_devidcnt; extern int nfsrv_maxpnfsmirror; +extern uint32_t nfs_srvmaxio; +extern int nfs_bufpackets; +extern u_long sb_max_adj; struct vfsoptlist nfsv4root_opt, nfsv4root_newopt; NFSDLOCKMUTEX; NFSSTATESPINLOCK; @@ -195,6 +198,84 @@ SYSCTL_PROC(_vfs_nfsd, OID_AUTO, dsdirsize, CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, sizeof(nfsrv_dsdirsize), sysctl_dsdirsize, "IU", "Number of dsN subdirs on the DS servers"); +/* + * nfs_srvmaxio can only be increased and only when the nfsd threads are + * not running. The setting must be a power of 2, with the current limit of + * 1Mbyte. + */ +static int +sysctl_srvmaxio(SYSCTL_HANDLER_ARGS) +{ + int error; + u_int newsrvmaxio; + uint64_t tval; + + newsrvmaxio = nfs_srvmaxio; + error = sysctl_handle_int(oidp, &newsrvmaxio, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (newsrvmaxio == nfs_srvmaxio) + return (0); + if (newsrvmaxio < nfs_srvmaxio) { + printf("nfsd: vfs.nfsd.srvmaxio can only be increased\n"); + return (EINVAL); + } + if (newsrvmaxio > 1048576) { + printf("nfsd: vfs.nfsd.srvmaxio cannot be > 1Mbyte\n"); + return (EINVAL); + } + if ((newsrvmaxio & (newsrvmaxio - 1)) != 0) { + printf("nfsd: vfs.nfsd.srvmaxio must be a power of 2\n"); + return (EINVAL); + } + + /* + * Check that kern.ipc.maxsockbuf is large enough for + * newsrviomax, given the setting of vfs.nfs.bufpackets. + */ + if ((newsrvmaxio + NFS_MAXXDR) * nfs_bufpackets > + sb_max_adj) { + /* + * Suggest vfs.nfs.bufpackets * maximum RPC message for + * sb_max_adj. + */ + tval = (newsrvmaxio + NFS_MAXXDR) * nfs_bufpackets; + + /* + * Convert suggested sb_max_adj value to a suggested + * sb_max value, which is what is set via kern.ipc.maxsockbuf. + * Perform the inverse calculation of (from uipc_sockbuf.c): + * sb_max_adj = (u_quad_t)sb_max * MCLBYTES / + * (MSIZE + MCLBYTES); + * XXX If the calculation of sb_max_adj from sb_max changes, + * this calculation must be changed as well. + */ + tval *= (MSIZE + MCLBYTES); /* Brackets for readability. */ + tval += MCLBYTES - 1; /* Round up divide. */ + tval /= MCLBYTES; + printf("nfsd: set kern.ipc.maxsockbuf to a minimum of " + "%ju to support %ubyte NFS I/O\n", (uintmax_t)tval, + newsrvmaxio); + return (EINVAL); + } + + NFSD_LOCK(); + if (newnfs_numnfsd != 0) { + NFSD_UNLOCK(); + printf("nfsd: cannot set vfs.nfsd.srvmaxio when nfsd " + "threads are running\n"); + return (EINVAL); + } + + + nfs_srvmaxio = newsrvmaxio; + NFSD_UNLOCK(); + return (0); +} +SYSCTL_PROC(_vfs_nfsd, OID_AUTO, srvmaxio, + CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RW, NULL, 0, + sysctl_srvmaxio, "IU", "Maximum I/O size in bytes"); + #define MAX_REORDERED_RPC 16 #define NUM_HEURISTIC 1031 #define NHUSE_INIT 64 diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index e564a6a48b79..0ba3472b4ff9 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -66,6 +66,7 @@ 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; SYSCTL_DECL(_vfs_nfsd); @@ -1023,7 +1024,7 @@ nfsrvd_write(struct nfsrv_descript *nd, __unused int isdgram, lop->lo_end = NFS64BITSSET; } - if (retlen > NFS_SRVMAXIO || retlen < 0) + if (retlen > nfs_srvmaxio || retlen < 0) nd->nd_repstat = EIO; if (vnode_vtype(vp) != VREG && !nd->nd_repstat) { if (nd->nd_flag & ND_NFSV3) @@ -4417,6 +4418,7 @@ nfsrvd_createsession(struct nfsrv_descript *nd, __unused int isdgram, struct nfsdsession *sep = NULL; uint32_t rdmacnt; struct thread *p = curthread; + static bool do_printf = true; if ((nd->nd_repstat = nfsd_checkrootexp(nd)) != 0) goto nfsmout; @@ -4438,12 +4440,16 @@ nfsrvd_createsession(struct nfsrv_descript *nd, __unused int isdgram, sep->sess_maxreq = fxdr_unsigned(uint32_t, *tl++); if (sep->sess_maxreq > sb_max_adj - NFS_MAXXDR) { sep->sess_maxreq = sb_max_adj - NFS_MAXXDR; - printf("Consider increasing kern.ipc.maxsockbuf\n"); + if (do_printf) + printf("Consider increasing kern.ipc.maxsockbuf\n"); + do_printf = false; } sep->sess_maxresp = fxdr_unsigned(uint32_t, *tl++); if (sep->sess_maxresp > sb_max_adj - NFS_MAXXDR) { sep->sess_maxresp = sb_max_adj - NFS_MAXXDR; - printf("Consider increasing kern.ipc.maxsockbuf\n"); + if (do_printf) + printf("Consider increasing kern.ipc.maxsockbuf\n"); + do_printf = false; } sep->sess_maxrespcached = fxdr_unsigned(uint32_t, *tl++); sep->sess_maxops = fxdr_unsigned(uint32_t, *tl++); diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 01280c8e49c6..750eda2027ec 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -42,6 +42,7 @@ struct nfsv4lock nfsv4rootfs_lock; time_t nfsdev_time = 0; int nfsrv_layouthashsize; volatile int nfsrv_layoutcnt = 0; +extern uint32_t nfs_srvmaxio; extern int newnfs_numnfsd; extern struct nfsstatsv1 nfsstatsv1; @@ -6898,7 +6899,7 @@ nfsrv_filelayout(struct nfsrv_descript *nd, int iomode, fhandle_t *fhp, tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED); /* Set the stripe size to the maximum I/O size. */ - *tl++ = txdr_unsigned(NFS_SRVMAXIO & NFSFLAYUTIL_STRIPE_MASK); + *tl++ = txdr_unsigned(nfs_srvmaxio & NFSFLAYUTIL_STRIPE_MASK); *tl++ = 0; /* 1st stripe index. */ pattern_offset = 0; txdr_hyper(pattern_offset, tl); tl += 2; /* Pattern offset. */ @@ -7964,13 +7965,13 @@ nfsrv_allocdevid(struct nfsdevice *ds, char *addr, char *dnshost) *tl++ = txdr_unsigned(2); /* Two NFS Versions. */ *tl++ = txdr_unsigned(NFS_VER4); /* NFSv4. */ *tl++ = txdr_unsigned(NFSV42_MINORVERSION); /* Minor version 2. */ - *tl++ = txdr_unsigned(NFS_SRVMAXIO); /* DS max rsize. */ - *tl++ = txdr_unsigned(NFS_SRVMAXIO); /* DS max wsize. */ + *tl++ = txdr_unsigned(nfs_srvmaxio); /* DS max rsize. */ + *tl++ = txdr_unsigned(nfs_srvmaxio); /* DS max wsize. */ *tl++ = newnfs_true; /* Tightly coupled. */ *tl++ = txdr_unsigned(NFS_VER4); /* NFSv4. */ *tl++ = txdr_unsigned(NFSV41_MINORVERSION); /* Minor version 1. */ - *tl++ = txdr_unsigned(NFS_SRVMAXIO); /* DS max rsize. */ - *tl++ = txdr_unsigned(NFS_SRVMAXIO); /* DS max wsize. */ + *tl++ = txdr_unsigned(nfs_srvmaxio); /* DS max rsize. */ + *tl++ = txdr_unsigned(nfs_srvmaxio); /* DS max wsize. */ *tl = newnfs_true; /* Tightly coupled. */ ds->nfsdev_hostnamelen = strlen(dnshost); From owner-dev-commits-src-main@freebsd.org Fri Jul 16 22:16:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BC3F668D37; Fri, 16 Jul 2021 22:16: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 4GRQYv0fMkz3Q75; Fri, 16 Jul 2021 22:16: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 ED54624CEE; Fri, 16 Jul 2021 22:16: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 16GMGI8f041384; Fri, 16 Jul 2021 22:16:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GMGIkc041383; Fri, 16 Jul 2021 22:16:18 GMT (envelope-from git) Date: Fri, 16 Jul 2021 22:16:18 GMT Message-Id: <202107162216.16GMGIkc041383@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: fad3f322efb5 - main - param.h: Bump __FreeBSD_version to 1400026 for commit ee29e6f31111 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fad3f322efb53d4924fdda34f9f23f881659c269 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 22:16:19 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=fad3f322efb53d4924fdda34f9f23f881659c269 commit fad3f322efb53d4924fdda34f9f23f881659c269 Author: Rick Macklem AuthorDate: 2021-07-16 22:13:27 +0000 Commit: Rick Macklem CommitDate: 2021-07-16 22:13:27 +0000 param.h: Bump __FreeBSD_version to 1400026 for commit ee29e6f31111 Commit ee29e6f31111 changed the internal KAPI between the nfscommon and nfsd modules. Bump __FreeBSD_version to 1400026 since both modules will need to be rebuilt from sources. --- sys/sys/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index 96538a949c3f..f1dc6dd2fcd6 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -76,7 +76,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400025 +#define __FreeBSD_version 1400026 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-main@freebsd.org Fri Jul 16 22:26:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F154A669120; Fri, 16 Jul 2021 22:26: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 4GRQnk6Pwxz3RJC; Fri, 16 Jul 2021 22:26: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 C4C5E24E6D; Fri, 16 Jul 2021 22:26: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 16GMQYlI054550; Fri, 16 Jul 2021 22:26:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GMQYMC054549; Fri, 16 Jul 2021 22:26:34 GMT (envelope-from git) Date: Fri, 16 Jul 2021 22:26:34 GMT Message-Id: <202107162226.16GMQYMC054549@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 7fa21b6dc6ed - main - UPDATING: Add entry for commit ee29e6f31111 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7fa21b6dc6ede78c3c19012d4b68c14e8cfd87c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 22:26:35 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=7fa21b6dc6ede78c3c19012d4b68c14e8cfd87c9 commit 7fa21b6dc6ede78c3c19012d4b68c14e8cfd87c9 Author: Rick Macklem AuthorDate: 2021-07-16 22:23:46 +0000 Commit: Rick Macklem CommitDate: 2021-07-16 22:23:46 +0000 UPDATING: Add entry for commit ee29e6f31111 --- UPDATING | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UPDATING b/UPDATING index 929b7b479060..7e45e9aa49fd 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".) +20210716: + Commit ee29e6f31111 changed the internal KAPI between the nfscommon + and nfsd modules. Therefore, both need to be rebuilt from sources. + Bump __FreeBSD_version to 1400026 for this KAPI change. + 20210715: The 20210707 awk update brought in a change in behavior. This has been corrected as of d4d252c49976. Between these dates, if you From owner-dev-commits-src-main@freebsd.org Fri Jul 16 22:36:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECB11669142; Fri, 16 Jul 2021 22:36:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRR1X6NYxz3jYq; Fri, 16 Jul 2021 22:36:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3F5A2538E; Fri, 16 Jul 2021 22:36:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16GMam0v067728; Fri, 16 Jul 2021 22:36:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16GMam63067727; Fri, 16 Jul 2021 22:36:48 GMT (envelope-from git) Date: Fri, 16 Jul 2021 22:36:48 GMT Message-Id: <202107162236.16GMam63067727@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: be7c64704edf - main - RELNOTES: Add an entry for commit ee29e6f31111 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: be7c64704edffc774937b8d39218da38a9f06f3a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 22:36:49 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=be7c64704edffc774937b8d39218da38a9f06f3a commit be7c64704edffc774937b8d39218da38a9f06f3a Author: Rick Macklem AuthorDate: 2021-07-16 22:33:52 +0000 Commit: Rick Macklem CommitDate: 2021-07-16 22:33:52 +0000 RELNOTES: Add an entry for commit ee29e6f31111 --- RELNOTES | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/RELNOTES b/RELNOTES index 2ed1e14f67a1..173878640975 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,16 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +ee29e6f31111 + Commit ee29e6f31111 added a new sysctl called vfs.nfsd.srvmaxio + that can be used to increase the maximum I/O size for the NFS + server to any power of 2 up to 1Mbyte while the nfsd(8) is not running. + The FreeBSD NFS client can now be set to use a 1Mbyte I/O size + via the vfs.maxbcachebuf tunable and the Linux NFS client + can also do 1Mbyte I/O. + kern.ipc.maxsockbuf will need to be increased. A console + message will suggest a setting for it. + d575e81fbcfa gconcat(8) has added support for appending devices to the device not present at creation time. From owner-dev-commits-src-main@freebsd.org Sat Jul 17 12:44:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E0B0654235; Sat, 17 Jul 2021 12:44: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 4GRnqB2wSZz4YHH; Sat, 17 Jul 2021 12:44: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 4D00410E06; Sat, 17 Jul 2021 12:44: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 16HCi6G8099943; Sat, 17 Jul 2021 12:44:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16HCi6pJ099942; Sat, 17 Jul 2021 12:44:06 GMT (envelope-from git) Date: Sat, 17 Jul 2021 12:44:06 GMT Message-Id: <202107171244.16HCi6pJ099942@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: ef950daa35d4 - main - pf: match keyword 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: ef950daa35d43dd396958ca28ce9de0514daf873 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jul 2021 12:44:06 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ef950daa35d43dd396958ca28ce9de0514daf873 commit ef950daa35d43dd396958ca28ce9de0514daf873 Author: Kristof Provost AuthorDate: 2021-03-02 15:01:04 +0000 Commit: Kristof Provost CommitDate: 2021-07-17 10:01:08 +0000 pf: match keyword support Support the 'match' keyword. Note that support is limited to adding queuing information, so without ALTQ support in the kernel setting match rules is pointless. For the avoidance of doubt: this is NOT full support for the match keyword as found in OpenBSD's pf. That could potentially be built on top of this, but this commit is NOT that. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31115 --- sbin/pfctl/parse.y | 4 ++- sbin/pfctl/pf_ruleset.c | 1 + sbin/pfctl/pfctl_parser.c | 4 ++- sys/net/pfvar.h | 8 +++++ sys/netpfil/pf/pf.c | 81 +++++++++++++++++++++++++++++++++++++-------- sys/netpfil/pf/pf.h | 3 +- sys/netpfil/pf/pf_ruleset.c | 1 + 7 files changed, 85 insertions(+), 17 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index acd90e280b53..74744794370f 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -456,7 +456,7 @@ int parseport(char *, struct range *r, int); %} -%token PASS BLOCK SCRUB RETURN IN OS OUT LOG QUICK ON FROM TO FLAGS +%token PASS BLOCK MATCH SCRUB RETURN IN OS OUT LOG QUICK ON FROM TO FLAGS %token RETURNRST RETURNICMP RETURNICMP6 PROTO INET INET6 ALL ANY ICMPTYPE %token ICMP6TYPE CODE KEEP MODULATE STATE PORT RDR NAT BINAT ARROW NODF %token MINTTL ERROR ALLOWOPTS FASTROUTE FILENAME ROUTETO DUPTO REPLYTO NO LABEL @@ -2677,6 +2677,7 @@ action : PASS { $$.w = returnicmpdefault; $$.w2 = returnicmp6default; } + | MATCH { $$.b1 = PF_MATCH; $$.b2 = $$.w = 0; } | BLOCK blockspec { $$ = $2; $$.b1 = PF_DROP; } ; @@ -5612,6 +5613,7 @@ lookup(char *s) { "log", LOG}, { "loginterface", LOGINTERFACE}, { "map-e-portset", MAPEPORTSET}, + { "match", MATCH}, { "max", MAXIMUM}, { "max-mss", MAXMSS}, { "max-src-conn", MAXSRCCONN}, diff --git a/sbin/pfctl/pf_ruleset.c b/sbin/pfctl/pf_ruleset.c index f5cddf481871..480e0f0c9b45 100644 --- a/sbin/pfctl/pf_ruleset.c +++ b/sbin/pfctl/pf_ruleset.c @@ -106,6 +106,7 @@ pf_get_ruleset_number(u_int8_t action) break; case PF_PASS: case PF_DROP: + case PF_MATCH: return (PF_RULESET_FILTER); break; case PF_NAT: diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index b4a1cde967bd..62d4b42bd416 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -708,7 +708,9 @@ print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numer if (verbose) printf("@%d ", r->nr); - if (r->action > PF_NORDR) + if (r->action == PF_MATCH) + printf("match"); + else if (r->action > PF_NORDR) printf("action(%d)", r->action); else if (anchor_call[0]) { if (anchor_call[0] == '_') { diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 17af5d46a183..46b71c5eedce 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -332,6 +332,11 @@ struct pf_kpool { u_int8_t opts; }; +struct pf_rule_actions { + u_int32_t qid; + u_int32_t pqid; +}; + union pf_krule_ptr { struct pf_krule *ptr; u_int32_t nr; @@ -607,6 +612,8 @@ struct pf_kstate { u_int32_t creation; u_int32_t expire; u_int32_t pfsync_time; + u_int32_t qid; + u_int32_t pqid; u_int16_t tag; u_int8_t log; u_int8_t state_flags; @@ -1057,6 +1064,7 @@ struct pf_pdesc { u_int16_t *sport; u_int16_t *dport; struct pf_mtag *pf_mtag; + struct pf_rule_actions act; u_int32_t p_len; /* total length of payload */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 3ca921ff3287..7d73f1d119e4 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -257,6 +257,8 @@ static int pf_state_key_attach(struct pf_state_key *, static void pf_state_key_detach(struct pf_kstate *, int); static int pf_state_key_ctor(void *, int, void *, int); static u_int32_t pf_tcp_iss(struct pf_pdesc *); +void pf_rule_to_actions(struct pf_krule *, + struct pf_rule_actions *); static int pf_test_rule(struct pf_krule **, struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, struct pf_pdesc *, struct pf_krule **, @@ -3112,6 +3114,15 @@ pf_addr_inc(struct pf_addr *addr, sa_family_t af) } #endif /* INET6 */ +void +pf_rule_to_actions(struct pf_krule *r, struct pf_rule_actions *a) +{ + if (r->qid) + a->qid = r->qid; + if (r->pqid) + a->pqid = r->pqid; +} + int pf_socket_lookup(int direction, struct pf_pdesc *pd, struct mbuf *m) { @@ -3620,10 +3631,20 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, int direction, if (r->rtableid >= 0) rtableid = r->rtableid; if (r->anchor == NULL) { - match = 1; - *rm = r; - *am = a; - *rsm = ruleset; + if (r->action == PF_MATCH) { + counter_u64_add(r->packets[direction == PF_OUT], 1); + counter_u64_add(r->bytes[direction == PF_OUT], pd->tot_len); + pf_rule_to_actions(r, &pd->act); + if (r->log) + PFLOG_PACKET(kif, m, af, + direction, PFRES_MATCH, r, + a, ruleset, pd, 1); + } else { + match = 1; + *rm = r; + *am = a; + *rsm = ruleset; + } if ((*rm)->quick) break; r = TAILQ_NEXT(r, entries); @@ -3642,6 +3663,9 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, int direction, REASON_SET(&reason, PFRES_MATCH); + /* apply actions for last matching pass/block rule */ + pf_rule_to_actions(r, &pd->act); + if (r->log || (nr != NULL && nr->log)) { if (rewrite) m_copyback(m, off, hdrlen, pd->hdr.any); @@ -3760,6 +3784,8 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, s->state_flags |= PFSTATE_SLOPPY; s->log = r->log & PF_LOG_ALL; s->sync_state = PFSYNC_S_NONE; + s->qid = pd->act.qid; + s->pqid = pd->act.pqid; if (nr != NULL) s->log |= nr->log & PF_LOG_ALL; switch (pd->proto) { @@ -4019,10 +4045,20 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kkif *kif, r = TAILQ_NEXT(r, entries); else { if (r->anchor == NULL) { - match = 1; - *rm = r; - *am = a; - *rsm = ruleset; + if (r->action == PF_MATCH) { + counter_u64_add(r->packets[direction == PF_OUT], 1); + counter_u64_add(r->bytes[direction == PF_OUT], pd->tot_len); + pf_rule_to_actions(r, &pd->act); + if (r->log) + PFLOG_PACKET(kif, m, af, + direction, PFRES_MATCH, r, + a, ruleset, pd, 1); + } else { + match = 1; + *rm = r; + *am = a; + *rsm = ruleset; + } if ((*rm)->quick) break; r = TAILQ_NEXT(r, entries); @@ -4041,6 +4077,9 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kkif *kif, REASON_SET(&reason, PFRES_MATCH); + /* apply actions for last matching pass/block rule */ + pf_rule_to_actions(r, &pd->act); + if (r->log) PFLOG_PACKET(kif, m, af, direction, reason, r, a, ruleset, pd, 1); @@ -6152,7 +6191,14 @@ done: } #ifdef ALTQ - if (action == PF_PASS && r->qid) { + if (s && s->qid) { + pd.act.pqid = s->pqid; + pd.act.qid = s->qid; + } else if (r->qid) { + pd.act.pqid = r->pqid; + pd.act.qid = r->qid; + } + if (action == PF_PASS && pd.act.qid) { if (pd.pf_mtag == NULL && ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { action = PF_DROP; @@ -6161,9 +6207,9 @@ done: if (s != NULL) pd.pf_mtag->qid_hash = pf_state_hash(s); if (pqid || (pd.tos & IPTOS_LOWDELAY)) - pd.pf_mtag->qid = r->pqid; + pd.pf_mtag->qid = pd.act.pqid; else - pd.pf_mtag->qid = r->qid; + pd.pf_mtag->qid = pd.act.qid; /* Add hints for ecn. */ pd.pf_mtag->hdr = h; } @@ -6592,7 +6638,14 @@ done: } #ifdef ALTQ - if (action == PF_PASS && r->qid) { + if (s && s->qid) { + pd.act.pqid = s->pqid; + pd.act.qid = s->qid; + } else if (r->qid) { + pd.act.pqid = r->pqid; + pd.act.qid = r->qid; + } + if (action == PF_PASS && pd.act.qid) { if (pd.pf_mtag == NULL && ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { action = PF_DROP; @@ -6601,9 +6654,9 @@ done: if (s != NULL) pd.pf_mtag->qid_hash = pf_state_hash(s); if (pd.tos & IPTOS_LOWDELAY) - pd.pf_mtag->qid = r->pqid; + pd.pf_mtag->qid = pd.act.pqid; else - pd.pf_mtag->qid = r->qid; + pd.pf_mtag->qid = pd.act.qid; /* Add hints for ecn. */ pd.pf_mtag->hdr = h; } diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 6df1426c9e0c..d8ee43506d99 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -49,7 +49,8 @@ enum { PF_INOUT, PF_IN, PF_OUT }; enum { PF_PASS, PF_DROP, PF_SCRUB, PF_NOSCRUB, PF_NAT, PF_NONAT, - PF_BINAT, PF_NOBINAT, PF_RDR, PF_NORDR, PF_SYNPROXY_DROP, PF_DEFER }; + PF_BINAT, PF_NOBINAT, PF_RDR, PF_NORDR, PF_SYNPROXY_DROP, PF_DEFER, + PF_MATCH }; enum { PF_RULESET_SCRUB, PF_RULESET_FILTER, PF_RULESET_NAT, PF_RULESET_BINAT, PF_RULESET_RDR, PF_RULESET_MAX }; enum { PF_OP_NONE, PF_OP_IRG, PF_OP_EQ, PF_OP_NE, PF_OP_LT, diff --git a/sys/netpfil/pf/pf_ruleset.c b/sys/netpfil/pf/pf_ruleset.c index ad1b07f69fe6..c21f4dfdd4a0 100644 --- a/sys/netpfil/pf/pf_ruleset.c +++ b/sys/netpfil/pf/pf_ruleset.c @@ -95,6 +95,7 @@ pf_get_ruleset_number(u_int8_t action) return (PF_RULESET_SCRUB); break; case PF_PASS: + case PF_MATCH: case PF_DROP: return (PF_RULESET_FILTER); break; From owner-dev-commits-src-main@freebsd.org Sat Jul 17 12:44:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05013653F6C; Sat, 17 Jul 2021 12:44: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 4GRnqD4vrgz4YHS; Sat, 17 Jul 2021 12:44: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 7E8ED10DCE; Sat, 17 Jul 2021 12:44: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 16HCi8n0099996; Sat, 17 Jul 2021 12:44:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16HCi8pb099995; Sat, 17 Jul 2021 12:44:08 GMT (envelope-from git) Date: Sat, 17 Jul 2021 12:44:08 GMT Message-Id: <202107171244.16HCi8pb099995@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: 0351b9875a3e - main - pf.conf.5: Document new 'match' keyword 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: 0351b9875a3eb5eb4b502a4106b1917ce954e959 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jul 2021 12:44:09 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0351b9875a3eb5eb4b502a4106b1917ce954e959 commit 0351b9875a3eb5eb4b502a4106b1917ce954e959 Author: Kristof Provost AuthorDate: 2021-03-02 19:34:41 +0000 Commit: Kristof Provost CommitDate: 2021-07-17 10:01:08 +0000 pf.conf.5: Document new 'match' keyword Reviewed by: bcr Obtained from: pfSense MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31117 --- share/man/man5/pf.conf.5 | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index 00fbd4421e7f..7b97657d7d1c 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -1236,8 +1236,10 @@ below. .Xr pf 4 has the ability to .Ar block -and +, .Ar pass +and +.Ar match packets based on attributes of their layer 3 (see .Xr ip 4 and @@ -1253,7 +1255,15 @@ assigned to queues for the purpose of bandwidth control. .Pp For each packet processed by the packet filter, the filter rules are evaluated in sequential order, from first to last. -The last matching rule decides what action is taken. +For +.Ar block +and +.Ar pass +, the last matching rule decides what action is taken. +For +.Ar match +, rules are evaulated every time they match; the pass/block state of a packet +remains unchanged. If no rule matches the packet, the default action is to pass the packet. .Pp @@ -1301,6 +1311,21 @@ packets that match explicit rules is specify a first filter rule of: .Bd -literal -offset indent block all .Ed +.It Ar match +The packet is matched. +This mechanism is used to provide fine grained filtering without altering the +block/pass state of a packet. +.Ar match +rules differ from +.Ar block +and +.Ar pass +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 +. .It Ar pass The packet is passed; state is created unless the From owner-dev-commits-src-main@freebsd.org Sat Jul 17 12:44:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AB24654466; Sat, 17 Jul 2021 12:44: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 4GRnqC3hMwz4Y82; Sat, 17 Jul 2021 12:44: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 6284B10BF6; Sat, 17 Jul 2021 12:44: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 16HCi7SO099972; Sat, 17 Jul 2021 12:44:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16HCi7Z0099971; Sat, 17 Jul 2021 12:44:07 GMT (envelope-from git) Date: Sat, 17 Jul 2021 12:44:07 GMT Message-Id: <202107171244.16HCi7Z0099971@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: d363ebc78cbb - main - pf tests: Test the match keyword 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: d363ebc78cbb50bc334d74fb5bb755af53c69ff0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jul 2021 12:44:07 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d363ebc78cbb50bc334d74fb5bb755af53c69ff0 commit d363ebc78cbb50bc334d74fb5bb755af53c69ff0 Author: Kristof Provost AuthorDate: 2021-03-02 15:57:27 +0000 Commit: Kristof Provost CommitDate: 2021-07-17 10:01:08 +0000 pf tests: Test the match keyword The new match keyword can currently only assign queues, so we can only test it with ALTQ. Set up a basic scenario where we use 'match' to assign ICMP traffic to a slow queue, and confirm that it's really getting slowed down. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31116 --- tests/sys/netpfil/pf/altq.sh | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/sys/netpfil/pf/altq.sh b/tests/sys/netpfil/pf/altq.sh index 89da4c0deb6f..294c01e9f8bd 100644 --- a/tests/sys/netpfil/pf/altq.sh +++ b/tests/sys/netpfil/pf/altq.sh @@ -42,8 +42,53 @@ hfsc_cleanup() altq_cleanup } +atf_test_case "match" "cleanup" +match_head() +{ + atf_set descr 'Basic match keyword test' + atf_set require.user root +} + +match_body() +{ + altq_init + is_altq_supported hfsc + + epair=$(vnet_mkepair) + vnet_mkjail altq_match ${epair}b + + ifconfig ${epair}a 192.0.2.1/24 up + jexec altq_match ifconfig ${epair}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2 + + jexec altq_match pfctl -e + pft_set_rules altq_match \ + "altq on ${epair}b bandwidth 100000000b hfsc queue { default, slow }" \ + "queue default hfsc(default linkshare 80000000b)" \ + "queue slow hfsc(linkshare 80b upperlimit 80b)" \ + "match proto icmp queue slow" \ + "pass" + + # single ping succeeds just fine + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # "Saturate the link" + ping -i .1 -c 5 -s 1200 192.0.2.2 + + # We should now be hitting the limits and get this packet dropped. + atf_check -s exit:2 -o ignore ping -c 1 -s 1200 192.0.2.2 +} + +match_cleanup() +{ + altq_cleanup +} + atf_init_test_cases() { atf_add_test_case "hfsc" + atf_add_test_case "match" } From owner-dev-commits-src-main@freebsd.org Sat Jul 17 14:00:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED9D0655930; Sat, 17 Jul 2021 14:00: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 4GRqWG65nVz4mvD; Sat, 17 Jul 2021 14:00: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 B9DCD11D0E; Sat, 17 Jul 2021 14:00: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 16HE0QGr004621; Sat, 17 Jul 2021 14:00:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16HE0Qh6004620; Sat, 17 Jul 2021 14:00:26 GMT (envelope-from git) Date: Sat, 17 Jul 2021 14:00:26 GMT Message-Id: <202107171400.16HE0Qh6004620@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: 295f2d939d96 - main - pf: Remove unused arguments from pf_send_tcp() 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: 295f2d939d960e2bdf5c1499da3eb41618be05e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jul 2021 14:00:27 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=295f2d939d960e2bdf5c1499da3eb41618be05e6 commit 295f2d939d960e2bdf5c1499da3eb41618be05e6 Author: Kristof Provost AuthorDate: 2021-05-19 18:33:28 +0000 Commit: Kristof Provost CommitDate: 2021-07-17 13:18:15 +0000 pf: Remove unused arguments from pf_send_tcp() struct mbuf *replyto is not actually used (and only rarely provided). The same applies to struct ifnet *ifp. No functional change. Reviewed by: mjg MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31136 --- sys/netpfil/pf/pf.c | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 7d73f1d119e4..29b3f6b8d94d 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -243,12 +243,11 @@ static void pf_change_icmp(struct pf_addr *, u_int16_t *, struct pf_addr *, struct pf_addr *, u_int16_t, u_int16_t *, u_int16_t *, u_int16_t *, u_int16_t *, u_int8_t, sa_family_t); -static void pf_send_tcp(struct mbuf *, - const struct pf_krule *, sa_family_t, +static void pf_send_tcp(const struct pf_krule *, sa_family_t, const struct pf_addr *, const struct pf_addr *, u_int16_t, u_int16_t, u_int32_t, u_int32_t, u_int8_t, u_int16_t, u_int16_t, u_int8_t, int, - u_int16_t, struct ifnet *); + u_int16_t); static void pf_send_icmp(struct mbuf *, u_int8_t, u_int8_t, sa_family_t, struct pf_krule *); static void pf_detach_state(struct pf_kstate *); @@ -1725,13 +1724,13 @@ pf_unlink_state(struct pf_kstate *s, u_int flags) if (s->src.state == PF_TCPS_PROXY_DST) { /* XXX wire key the right one? */ - pf_send_tcp(NULL, s->rule.ptr, s->key[PF_SK_WIRE]->af, + pf_send_tcp(s->rule.ptr, s->key[PF_SK_WIRE]->af, &s->key[PF_SK_WIRE]->addr[1], &s->key[PF_SK_WIRE]->addr[0], s->key[PF_SK_WIRE]->port[1], s->key[PF_SK_WIRE]->port[0], s->src.seqhi, s->src.seqlo + 1, - TH_RST|TH_ACK, 0, 0, 0, 1, s->tag, NULL); + TH_RST|TH_ACK, 0, 0, 0, 1, s->tag); } LIST_REMOVE(s, entry); @@ -2461,11 +2460,11 @@ pf_modulate_sack(struct mbuf *m, int off, struct pf_pdesc *pd, } static void -pf_send_tcp(struct mbuf *replyto, const struct pf_krule *r, sa_family_t af, +pf_send_tcp(const struct pf_krule *r, sa_family_t af, const struct pf_addr *saddr, const struct pf_addr *daddr, u_int16_t sport, u_int16_t dport, u_int32_t seq, u_int32_t ack, u_int8_t flags, u_int16_t win, u_int16_t mss, u_int8_t ttl, int tag, - u_int16_t rtag, struct ifnet *ifp) + u_int16_t rtag) { struct pf_send_entry *pfse; struct mbuf *m; @@ -2679,10 +2678,10 @@ pf_return(struct pf_krule *r, struct pf_krule *nr, struct pf_pdesc *pd, ack++; if (th->th_flags & TH_FIN) ack++; - pf_send_tcp(m, r, af, pd->dst, + pf_send_tcp(r, af, pd->dst, pd->src, th->th_dport, th->th_sport, ntohl(th->th_ack), ack, TH_RST|TH_ACK, 0, 0, - r->return_ttl, 1, 0, kif->pfik_ifp); + r->return_ttl, 1, 0); } } else if (pd->proto != IPPROTO_ICMP && af == AF_INET && r->return_icmp) @@ -3941,9 +3940,9 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, mss = pf_calc_mss(pd->src, pd->af, rtid, mss); mss = pf_calc_mss(pd->dst, pd->af, rtid, mss); s->src.mss = mss; - pf_send_tcp(NULL, r, pd->af, pd->dst, pd->src, th->th_dport, + pf_send_tcp(r, pd->af, pd->dst, pd->src, th->th_dport, th->th_sport, s->src.seqhi, ntohl(th->th_seq) + 1, - TH_SYN|TH_ACK, 0, s->src.mss, 0, 1, 0, NULL); + TH_SYN|TH_ACK, 0, s->src.mss, 0, 1, 0); REASON_SET(&reason, PFRES_SYNPROXY); return (PF_SYNPROXY_DROP); } @@ -4385,12 +4384,11 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, (*state)->src.state == TCPS_SYN_SENT) { /* Send RST for state mismatches during handshake */ if (!(th->th_flags & TH_RST)) - pf_send_tcp(NULL, (*state)->rule.ptr, pd->af, + pf_send_tcp((*state)->rule.ptr, pd->af, pd->dst, pd->src, th->th_dport, th->th_sport, ntohl(th->th_ack), 0, TH_RST, 0, 0, - (*state)->rule.ptr->return_ttl, 1, 0, - kif->pfik_ifp); + (*state)->rule.ptr->return_ttl, 1, 0); src->seqlo = 0; src->seqhi = 1; src->max_win = 1; @@ -4540,10 +4538,10 @@ pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, REASON_SET(reason, PFRES_SYNPROXY); return (PF_DROP); } - pf_send_tcp(NULL, (*state)->rule.ptr, pd->af, pd->dst, + pf_send_tcp((*state)->rule.ptr, pd->af, pd->dst, pd->src, th->th_dport, th->th_sport, (*state)->src.seqhi, ntohl(th->th_seq) + 1, - TH_SYN|TH_ACK, 0, (*state)->src.mss, 0, 1, 0, NULL); + TH_SYN|TH_ACK, 0, (*state)->src.mss, 0, 1, 0); REASON_SET(reason, PFRES_SYNPROXY); return (PF_SYNPROXY_DROP); } else if ((th->th_flags & (TH_ACK|TH_RST|TH_FIN)) != TH_ACK || @@ -4569,11 +4567,11 @@ pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, (*state)->src.max_win = MAX(ntohs(th->th_win), 1); if ((*state)->dst.seqhi == 1) (*state)->dst.seqhi = htonl(arc4random()); - pf_send_tcp(NULL, (*state)->rule.ptr, pd->af, + pf_send_tcp((*state)->rule.ptr, pd->af, &sk->addr[pd->sidx], &sk->addr[pd->didx], sk->port[pd->sidx], sk->port[pd->didx], (*state)->dst.seqhi, 0, TH_SYN, 0, - (*state)->src.mss, 0, 0, (*state)->tag, NULL); + (*state)->src.mss, 0, 0, (*state)->tag); REASON_SET(reason, PFRES_SYNPROXY); return (PF_SYNPROXY_DROP); } else if (((th->th_flags & (TH_SYN|TH_ACK)) != @@ -4584,16 +4582,16 @@ pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, } else { (*state)->dst.max_win = MAX(ntohs(th->th_win), 1); (*state)->dst.seqlo = ntohl(th->th_seq); - pf_send_tcp(NULL, (*state)->rule.ptr, pd->af, pd->dst, + pf_send_tcp((*state)->rule.ptr, pd->af, pd->dst, pd->src, th->th_dport, th->th_sport, ntohl(th->th_ack), ntohl(th->th_seq) + 1, TH_ACK, (*state)->src.max_win, 0, 0, 0, - (*state)->tag, NULL); - pf_send_tcp(NULL, (*state)->rule.ptr, pd->af, + (*state)->tag); + pf_send_tcp((*state)->rule.ptr, pd->af, &sk->addr[pd->sidx], &sk->addr[pd->didx], sk->port[pd->sidx], sk->port[pd->didx], (*state)->src.seqhi + 1, (*state)->src.seqlo + 1, - TH_ACK, (*state)->dst.max_win, 0, 0, 1, 0, NULL); + TH_ACK, (*state)->dst.max_win, 0, 0, 1, 0); (*state)->src.seqdiff = (*state)->dst.seqhi - (*state)->src.seqlo; (*state)->dst.seqdiff = (*state)->src.seqhi - From owner-dev-commits-src-main@freebsd.org Sat Jul 17 14:29:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5CEAD655F4F; Sat, 17 Jul 2021 14:29: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 4GRr921kH2z4rcd; Sat, 17 Jul 2021 14:29: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 2395F119EE; Sat, 17 Jul 2021 14:29: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 16HETgjh035752; Sat, 17 Jul 2021 14:29:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16HETguO035751; Sat, 17 Jul 2021 14:29:42 GMT (envelope-from git) Date: Sat, 17 Jul 2021 14:29:42 GMT Message-Id: <202107171429.16HETguO035751@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: 2c0d115bbc8f - main - pf: locally originating connections with 'route-to' fail 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: 2c0d115bbc8f8ee3f011a5c4a69bcbf58c4b721f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jul 2021 14:29:42 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2c0d115bbc8f8ee3f011a5c4a69bcbf58c4b721f commit 2c0d115bbc8f8ee3f011a5c4a69bcbf58c4b721f Author: Kristof Provost AuthorDate: 2021-07-14 10:17:03 +0000 Commit: Kristof Provost CommitDate: 2021-07-17 12:28:07 +0000 pf: locally originating connections with 'route-to' fail Similar to the REPLY_TO shortcut (6d786845cf) we also can't shortcut ROUTE_TO. If we do we will fail to apply transformations or update the state, which can lead to premature termination of the connections. PR: 257106 MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31177 --- sys/netpfil/pf/pf.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 29b3f6b8d94d..51b26350d0bb 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -346,12 +346,6 @@ VNET_DEFINE(struct pf_limit, pf_limits[PF_LIMIT_MAX]); return (PF_DROP); \ if (PACKET_LOOPED(pd)) \ return (PF_PASS); \ - if ((d) == PF_OUT && \ - (s)->rule.ptr->rt == PF_ROUTETO && \ - (s)->rule.ptr->direction == PF_OUT && \ - (s)->rt_kif != NULL && \ - (s)->rt_kif != (i)) \ - return (PF_PASS); \ } while (0) #define BOUND_IFACE(r, k) \ From owner-dev-commits-src-main@freebsd.org Sat Jul 17 14:29:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73A526560DD; Sat, 17 Jul 2021 14:29:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GRr932l71z4rhx; Sat, 17 Jul 2021 14:29: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 45CD0122B8; Sat, 17 Jul 2021 14:29:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16HETh2g035776; Sat, 17 Jul 2021 14:29:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16HETh7o035775; Sat, 17 Jul 2021 14:29:43 GMT (envelope-from git) Date: Sat, 17 Jul 2021 14:29:43 GMT Message-Id: <202107171429.16HETh7o035775@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: f808bb9b7e5e - main - pf tests: test locally originated connections with route-to 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: f808bb9b7e5ee2243e5a2aaad2275a78cdbe981b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jul 2021 14:29:43 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f808bb9b7e5ee2243e5a2aaad2275a78cdbe981b commit f808bb9b7e5ee2243e5a2aaad2275a78cdbe981b Author: Kristof Provost AuthorDate: 2021-07-14 10:33:37 +0000 Commit: Kristof Provost CommitDate: 2021-07-17 12:28:08 +0000 pf tests: test locally originated connections with route-to PR: 257106 Submitted by: Mark Cammidge MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D31178 --- tests/sys/netpfil/pf/route_to.sh | 70 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/tests/sys/netpfil/pf/route_to.sh b/tests/sys/netpfil/pf/route_to.sh index 59b16e35ee6f..957317eb462e 100644 --- a/tests/sys/netpfil/pf/route_to.sh +++ b/tests/sys/netpfil/pf/route_to.sh @@ -181,9 +181,79 @@ multiwan_cleanup() pft_cleanup } +atf_test_case "multiwanlocal" "cleanup" +multiwanlocal_head() +{ + atf_set descr 'Multi-WAN local origin source-based redirection / route-to test' + atf_set require.user root +} + +multiwanlocal_body() +{ + pft_init + + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + epair_cl_one=$(vnet_mkepair) + epair_cl_two=$(vnet_mkepair) + + vnet_mkjail srv1 ${epair_one}b + vnet_mkjail srv2 ${epair_two}b + vnet_mkjail wan_one ${epair_one}a ${epair_cl_one}b + vnet_mkjail wan_two ${epair_two}a ${epair_cl_two}b + vnet_mkjail client ${epair_cl_one}a ${epair_cl_two}a + + jexec client ifconfig ${epair_cl_one}a 203.0.113.1/25 + jexec wan_one ifconfig ${epair_cl_one}b 203.0.113.2/25 + jexec wan_one ifconfig ${epair_one}a 192.0.2.1/24 up + jexec wan_one sysctl net.inet.ip.forwarding=1 + jexec srv1 ifconfig ${epair_one}b 192.0.2.2/24 up + + jexec client ifconfig ${epair_cl_two}a 203.0.113.128/25 + jexec wan_two ifconfig ${epair_cl_two}b 203.0.113.129/25 + jexec wan_two ifconfig ${epair_two}a 198.51.100.1/24 up + jexec wan_two sysctl net.inet.ip.forwarding=1 + jexec srv2 ifconfig ${epair_two}b 198.51.100.2/24 up + + jexec client route add default 203.0.113.2 + jexec srv1 route add default 192.0.2.1 + jexec srv2 route add default 198.51.100.1 + + # Run data source in srv1 and srv2 + jexec srv1 sh -c 'dd if=/dev/zero bs=1024 count=100 | nc -l 7 -w 2 -N &' + jexec srv2 sh -c 'dd if=/dev/zero bs=1024 count=100 | nc -l 7 -w 2 -N &' + + jexec client pfctl -e + pft_set_rules client \ + "block in" \ + "block out" \ + "pass out quick route-to (${epair_cl_two}a 203.0.113.129) inet proto tcp from 203.0.113.128 to any port 7" \ + "pass out on ${epair_cl_one}a inet proto tcp from any to any port 7" + + # This should work + result=$(jexec client nc -N -w 1 192.0.2.2 7 | wc -c) + if [ ${result} -ne 102400 ]; then + jexec client pfctl -ss + atf_fail "Redirect from client on one failed: ${result}" + fi + + # This should trigger the issue + result=$(jexec client nc -N -w 1 -s 203.0.113.128 198.51.100.2 7 | wc -c) + jexec client pfctl -ss + if [ ${result} -ne 102400 ]; then + atf_fail "Redirect from client on two failed: ${result}" + fi +} + +multiwanlocal_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4" atf_add_test_case "v6" atf_add_test_case "multiwan" + atf_add_test_case "multiwanlocal" } From owner-dev-commits-src-main@freebsd.org Sat Jul 17 22:12:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53F5565CA7E; Sat, 17 Jul 2021 22:12:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS2RT1wJwz3G56; Sat, 17 Jul 2021 22:12:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A76118901; Sat, 17 Jul 2021 22:12:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16HMCr8L062504; Sat, 17 Jul 2021 22:12:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16HMCrd3062503; Sat, 17 Jul 2021 22:12:53 GMT (envelope-from git) Date: Sat, 17 Jul 2021 22:12:53 GMT Message-Id: <202107172212.16HMCrd3062503@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: abea0c6b0ddc - main - cam: Mark the qos data is valid in xpd_done_direct() too. 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: abea0c6b0ddc969d1f3b9cab1fd90df00de1f2e4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jul 2021 22:12:53 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=abea0c6b0ddc969d1f3b9cab1fd90df00de1f2e4 commit abea0c6b0ddc969d1f3b9cab1fd90df00de1f2e4 Author: Warner Losh AuthorDate: 2021-07-17 22:10:46 +0000 Commit: Warner Losh CommitDate: 2021-07-17 22:12:00 +0000 cam: Mark the qos data is valid in xpd_done_direct() too. Sponsored by: Netflix --- sys/cam/cam_xpt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index b76d6f5adde7..6b5a04b174e1 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -4642,6 +4642,7 @@ xpt_done_direct(union ccb *done_ccb) /* Store the time the ccb was in the sim */ done_ccb->ccb_h.qos.periph_data = cam_iosched_delta_t(done_ccb->ccb_h.qos.periph_data); + done_ccb->ccb_h.status |= CAM_QOS_VALID; xpt_done_process(&done_ccb->ccb_h); } From owner-dev-commits-src-main@freebsd.org Sat Jul 17 22:45:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCD2265D0DF; Sat, 17 Jul 2021 22:45: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 4GS38X5CsCz3KnM; Sat, 17 Jul 2021 22:45: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 9BB901895C; Sat, 17 Jul 2021 22:45: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 16HMj0Et002521; Sat, 17 Jul 2021 22:45:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16HMj0pV002520; Sat, 17 Jul 2021 22:45:00 GMT (envelope-from git) Date: Sat, 17 Jul 2021 22:45:00 GMT Message-Id: <202107172245.16HMj0pV002520@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: dbaad75f2834 - main - zfs: add missed dependency of zfs module on zlib 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: dbaad75f2834f40bfe74ebe393d2101967052036 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jul 2021 22:45:00 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=dbaad75f2834f40bfe74ebe393d2101967052036 commit dbaad75f2834f40bfe74ebe393d2101967052036 Author: Konstantin Belousov AuthorDate: 2021-07-17 14:59:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-17 22:44:22 +0000 zfs: add missed dependency of zfs module on zlib Reviewed by: mm Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31207 --- sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c b/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c index d9096575d853..2b808357ecc8 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c @@ -329,3 +329,4 @@ MODULE_DEPEND(zfsctrl, krpc, 1, 1, 1); #endif MODULE_DEPEND(zfsctrl, acl_nfs4, 1, 1, 1); MODULE_DEPEND(zfsctrl, crypto, 1, 1, 1); +MODULE_DEPEND(zfsctrl, zlib, 1, 1, 1); From owner-dev-commits-src-main@freebsd.org Sun Jul 18 01:03:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFFE4661A03; Sun, 18 Jul 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 4GS6Dv4rdPz4Y38; Sun, 18 Jul 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 8D6991AC83; Sun, 18 Jul 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 16I13xkO090490; Sun, 18 Jul 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 16I13xP8090489; Sun, 18 Jul 2021 01:03:59 GMT (envelope-from git) Date: Sun, 18 Jul 2021 01:03:59 GMT Message-Id: <202107180103.16I13xP8090489@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Neel Chauhan Subject: git: 76fffd0a8653 - main - vmd_bus: Fix typo in comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 76fffd0a865374e1e09d8f61f36bfbda918da5c7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 01:03:59 -0000 The branch main has been updated by nc (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=76fffd0a865374e1e09d8f61f36bfbda918da5c7 commit 76fffd0a865374e1e09d8f61f36bfbda918da5c7 Author: Neel Chauhan AuthorDate: 2021-07-17 21:31:57 +0000 Commit: Neel Chauhan CommitDate: 2021-07-18 01:03:39 +0000 vmd_bus: Fix typo in comment Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D31210 --- sys/dev/vmd/vmd_bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/vmd/vmd_bus.c b/sys/dev/vmd/vmd_bus.c index 28ce14c63128..cf37a2dd9af2 100644 --- a/sys/dev/vmd/vmd_bus.c +++ b/sys/dev/vmd/vmd_bus.c @@ -77,8 +77,8 @@ vmd_bus_attach(device_t dev) /* * Start at max PCI vmd_domain and work down. Only VMD - * starting bus is connect to VMD device directly. Scan al - * lslots and function connected to starting bus. + * starting bus is connect to VMD device directly. Scan + * all slots and function connected to starting bus. */ b = sc->vmd_bus_start; From owner-dev-commits-src-main@freebsd.org Sun Jul 18 05:22:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E1E6664D46; Sun, 18 Jul 2021 05:22: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 4GSCzN70MMz3kl8; Sun, 18 Jul 2021 05:22: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 D64F41DFFB; Sun, 18 Jul 2021 05:22: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 16I5MeF6035594; Sun, 18 Jul 2021 05:22:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I5Meng035593; Sun, 18 Jul 2021 05:22:40 GMT (envelope-from git) Date: Sun, 18 Jul 2021 05:22:40 GMT Message-Id: <202107180522.16I5Meng035593@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: 30a1828c5196 - main - less: upgrade to v590. 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: 30a1828c5196c415c8afc0d50f9131885d0c6b43 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 05:22:41 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=30a1828c5196c415c8afc0d50f9131885d0c6b43 commit 30a1828c5196c415c8afc0d50f9131885d0c6b43 Merge: 76fffd0a8653 1f8b3bb911e3 Author: Xin LI AuthorDate: 2021-07-18 05:20:44 +0000 Commit: Xin LI CommitDate: 2021-07-18 05:20:44 +0000 less: upgrade to v590. MFC after: 2 weeks contrib/less/NEWS | 30 ++- contrib/less/README | 9 +- contrib/less/ch.c | 2 +- contrib/less/cmdbuf.c | 31 ++- contrib/less/command.c | 1 + contrib/less/decode.c | 93 +++++-- contrib/less/edit.c | 4 +- contrib/less/filename.c | 57 ++-- contrib/less/funcs.h | 12 +- contrib/less/help.c | 4 +- contrib/less/less.h | 1 + contrib/less/less.hlp | 2 + contrib/less/less.nro | 102 +++++--- contrib/less/lessecho.nro | 2 +- contrib/less/lesskey.c | 607 ++++--------------------------------------- contrib/less/lesskey.h | 24 ++ contrib/less/lesskey.nro | 51 ++-- contrib/less/lesskey_parse.c | 580 +++++++++++++++++++++++++++++++++++++++++ contrib/less/line.c | 85 +++--- contrib/less/linenum.c | 23 ++ contrib/less/optfunc.c | 61 ++++- contrib/less/opttbl.c | 23 +- contrib/less/output.c | 15 +- contrib/less/screen.c | 15 +- contrib/less/tags.c | 18 +- contrib/less/version.c | 15 +- contrib/less/xbuf.c | 52 ++++ contrib/less/xbuf.h | 15 ++ usr.bin/less/Makefile | 2 +- usr.bin/less/defines.h | 6 +- usr.bin/lesskey/Makefile | 2 +- 31 files changed, 1182 insertions(+), 762 deletions(-) diff --cc contrib/less/README index 2acbd00d762a,000000000000..4a5aa62a44ee mode 100644,000000..100644 --- a/contrib/less/README +++ b/contrib/less/README @@@ -1,251 -1,0 +1,254 @@@ +************************************************************************** +************************************************************************** +** ** +** The FreeBSD Project has chosen to redistribute and modify Less under ** +** the 'Less License' (as described in the 'LICENSE' file). ** +** ** +************************************************************************** +************************************************************************** + - Less, version 581.2 - - This is the distribution of less, version 581.2, released 28 Apr 2021. ++ This is the source code distribution of "less". + This program is part of the GNU project (http://www.gnu.org). + + This program is free software. You may redistribute it and/or + modify it under the terms of either: + + 1. The GNU General Public License, as published by the Free + Software Foundation; either version 3, or (at your option) any + later version. A copy of this license is in the file COPYING. + or + 2. The Less License, in the file LICENSE. + + Please report any problems at https://github.com/gwsw/less/issues. + See https://greenwoodsoftware.com/less for the latest info. + Source repository is at https://github.com/gwsw/less.git. + +========================================================================= + ++You should build from a clone of a git repository ++ONLY IF you are doing development on the less source itself. ++If you are merely using less as a tool, you should download a release ++from http://greenwoodsoftware.com and NOT from github. ++ +The formatted manual page is in less.man. +The manual page nroff source is in less.nro. +Major changes made since the last posted version are in NEWS. + +======================================================================= +INSTALLATION (Unix & Linux systems only): + +1. Move the distributed source to its own directory and unpack it, + if you have not already done so. + +2. If you are building from a clone of a git repository, + type "make -f Makefile.aut". + If you are building from a numbered release package (a tar or + zip file with a name like less-999.tar.gz or less-999.zip downloaded + from greenwoodsoftware.com, not from github), you should skip this step. + +3. Type "sh configure". + This will generate a Makefile and a defines.h. + Warning: if you have a GNU sed, make sure it is version 2.05 or later. + + The file INSTALL describes the usage of the configure program in + general. In addition, these options to configure are supported: + + --with-editor=program + Specifies the default editor program used by the "v" command. + The default is "vi". + + --with-regex=lib + Specifies the regular expression library used by less for pattern + matching. The default is "auto", which means the configure program + finds a regular expression library automatically. Other values are: + gnu Use the GNU regex library. + pcre Use the PCRE library. + pcre2 Use the PCRE2 library. + posix Use the POSIX-compatible regcomp. + regcmp Use the regcmp library. + re_comp Use the re_comp library. + regcomp Use the V8-compatible regcomp. + regcomp-local Use Henry Spencer's V8-compatible regcomp + (source is supplied with less). + none No regular expressions, only simple string matching. + + --with-secure + Builds a "secure" version of less, with some features disabled + to prevent users from viewing other files, accessing shell + commands, etc. + + +4. It is a good idea to look over the generated Makefile and defines.h + and make sure they look ok. If you know of any peculiarities of + your system that configure might not have detected, you may fix the + Makefile now. Take particular notice of the list of "terminal" + libraries in the LIBS definition in the Makefile; these may need + to be edited. The terminal libraries will be some subset of + -lncurses -lcurses -ltermcap -ltermlib + + If you wish, you may edit defines.h to remove some optional features. + If you choose not to include some features in your version, you may + wish to edit the manual page "less.nro" and the help page "less.hlp" + to remove the descriptions of the features which you are removing. + If you edit less.hlp, you should run "make -f Makefile.aut help.c". + +5. Type "make" and watch the fun. + +6. If the make succeeds, it will generate the programs "less", + "lesskey" and "lessecho" in your current directory. Test the + generated programs. + +7. When satisfied that it works, if you wish to install it + in a public place, type "make install". + + The default install destinations are: + Executables (less, lesskey, lessecho) in /usr/local/bin + Documentation (less.nro, lesskey.nro) in /usr/local/man/man1 + If you want to install any of these files elsewhere, define + bindir and/or mandir to the appropriate directories. + + +Note to hackers: comments noting possible improvements are enclosed +in double curly brackets {{ like this }}. + +(Note that the above note was originally written at a time when +"hackers" most commonly meant "enthusiastic and dedicated computer +programmers", not "persons who attempt to circumvent computer security".) + + + +======================================================================= +INSTALLATION (MS-DOS systems only, + with Microsoft C, Borland C, or DJGPP) + +1. Move the distributed source to its own directory. + Depending on your compiler, you may need to convert the source + to have CR-LF rather than LF as line terminators. + +2. If you are using Microsoft C, rename MAKEFILE.DSU to MAKEFILE. + If you are using Borland C, rename MAKEFILE.DSB to MAKEFILE. + If you are using DJGPP, rename MAKEFILE.DSG to MAKEFILE. + +3. Look at MAKEFILE to make sure that the definitions for CC and LIBDIR + are correct. CC should be the name of your C compiler and + LIBDIR should be the directory where the C libraries reside (for + Microsoft C only). If these definitions need to be changed, you can + either modify the definitions directly in MAKEFILE, or set your + environment variables CC and/or LIBDIR to override the definitions + in MAKEFILE. + +4. If you wish, you may edit DEFINES.DS to remove some optional features. + If you choose not to include some features in your version, you may + wish to edit the manual page LESS.MAN and the help page HELP.C + to remove the descriptions of the features which you are removing. + +5. Run your "make" program and watch the fun. + If your "make" requires a flag to import environment variables, + you should use that flag. + If your compiler runs out of memory, try running "make -n >cmds.bat" + and then run cmds.bat. + +6. If the make succeeds, it will generate the programs "LESS.EXE" and + "LESSKEY.EXE" in your current directory. Test the generated programs. + +7. When satisfied that it works, you may wish to install LESS.EXE and + LESSKEY.EXE in a directory which is included in your PATH. + + + +======================================================================= +INSTALLATION (Windows-95, Windows-98 and Windows-NT systems only, + with Borland C or Microsoft Visual C++) + +1. Move the distributed source to its own directory. + +2. If you are using Borland C, rename Makefile.wnb to Makefile. + If you are using Microsoft Visual C++, rename Makefile.wnm to Makefile. + +3. Check the Makefile to make sure the definitions look ok. + +4. If you wish, you may edit defines.wn to remove some optional features. + If you choose not to include some features in your version, you may + wish to edit the manual page less.man and the help page help.c + to remove the descriptions of the features which you are removing. + +5. Type "make" and watch the fun. + +6. If the make succeeds, it will generate the programs "less.exe" and + "lesskey.exe" in your current directory. Test the generated programs. + +7. When satisfied that it works, if you wish to install it + in a public place, type "make install". + See step 6 of the Unix installation instructions for details + on how to change the default installation directories. + + + +======================================================================= +INSTALLATION (OS/2 systems only, + with EMX C) + +1. Move the distributed source to its own directory. + +2. Rename Makefile.o2e to Makefile. + +3. Check the Makefile to make sure the definitions look ok. + +4. If you wish, you may edit defines.o2 to remove some optional features. + If you choose not to include some features in your version, you may + wish to edit the manual page less.man and the help page help.c + to remove the descriptions of the features which you are removing. + +5. Type "make" and watch the fun. + +6. If the make succeeds, it will generate the programs "less.exe" and + "lesskey.exe" in your current directory. Test the generated programs. + +7. Make sure you have the emx runtime installed. You need the emx DLLs + emx.dll and emxlibcs.dll and also the termcap database, termcap.dat. + Make sure you have termcap.dat either in the default location or + somewhere in a directory listed in the PATH or INIT environment + variables. + +8. When satisfied that it works, you may wish to install less.exe, + lesskey.exe and scrsize.exe in a directory which is included in + your PATH. scrsize.exe is required only if you use a terminal + emulator such as xterm or rxvt. + + + +======================================================================= +INSTALLATION (OS-9 systems only, + with Microware C or Ultra C) + +1. Move the distributed source to its own directory. + +2. If you are using Microware C, rename Makefile.o9c to Makefile. + If you are using Ultra C, rename Makefile.o9u to Makefile. + +3. Check the Makefile to make sure the definitions look ok. + +4. If you wish, you may edit defines.o9 to remove some optional features. + If you choose not to include some features in your version, you may + wish to edit the manual page less.man and the help page help.c + to remove the descriptions of the features which you are removing. + +5. Type "dmake" and watch the fun. + The standard OS-9 "make" will probably not work. If you don't + have dmake, you can get a copy from os9archive.rtsi.com. + +6. If the make succeeds, it will generate the programs "less" and + "lesskey" in your current directory. Test the generated programs. + +7. When satisfied that it works, if you wish to install it + in a public place, type "dmake install". + See step 6 of the Unix installation instructions for details + on how to change the default installation directories. + +======================================================================= +ACKNOWLEDGMENTS: + Some versions of the less distribution are packaged using + Info-ZIP's compression utility. + Info-ZIP's software is free and can be obtained as source + code or executables from various anonymous-ftp sites, + including ftp.uu.net:/pub/archiving/zip. diff --cc contrib/less/command.c index ae59181c2827,000000000000..171788f2e750 mode 100644,000000..100644 --- a/contrib/less/command.c +++ b/contrib/less/command.c @@@ -1,2060 -1,0 +1,2061 @@@ +/* $FreeBSD$ */ +/* + * Copyright (C) 1984-2021 Mark Nudelman + * + * You may distribute under the terms of either the GNU General Public + * License or the Less License, as specified in the README file. + * + * For more information, see the README file. + */ + + +/* + * User-level command processor. + */ + +#include "less.h" +#if MSDOS_COMPILER==WIN32C +#include +#endif +#include "position.h" +#include "option.h" +#include "cmd.h" + +extern int erase_char, erase2_char, kill_char; +extern int sigs; +extern int quit_if_one_screen; +extern int squished; +extern int sc_width; +extern int sc_height; +extern char *kent; +extern int swindow; +extern int jump_sline; +extern int quitting; +extern int wscroll; +extern int top_scroll; +extern int ignore_eoi; +extern int secure; +extern int hshift; +extern int bs_mode; +extern int show_attn; +extern int less_is_more; +extern int status_col; +extern POSITION highest_hilite; +extern POSITION start_attnpos; +extern POSITION end_attnpos; +extern char *every_first_cmd; +extern char version[]; +extern struct scrpos initial_scrpos; +extern IFILE curr_ifile; +extern void *ml_search; +extern void *ml_examine; +extern int wheel_lines; +#if SHELL_ESCAPE || PIPEC +extern void *ml_shell; +#endif +#if EDITOR +extern char *editor; +extern char *editproto; +#endif +extern int screen_trashed; /* The screen has been overwritten */ +extern int shift_count; +extern int oldbot; +extern int forw_prompt; +extern int incr_search; +#if MSDOS_COMPILER==WIN32C +extern int utf_mode; +#endif + +#if SHELL_ESCAPE +static char *shellcmd = NULL; /* For holding last shell command for "!!" */ +#endif +static int mca; /* The multicharacter command (action) */ +static int search_type; /* The previous type of search */ +static LINENUM number; /* The number typed by the user */ +static long fraction; /* The fractional part of the number */ +static struct loption *curropt; +static int opt_lower; +static int optflag; +static int optgetname; +static POSITION bottompos; +static int save_hshift; +static int save_bs_mode; +#if PIPEC +static char pipec; +#endif + +/* Stack of ungotten chars (via ungetcc) */ +struct ungot { + struct ungot *ug_next; + LWCHAR ug_char; +}; +static struct ungot* ungot = NULL; + +static void multi_search LESSPARAMS((char *pattern, int n, int silent)); + +/* + * Move the cursor to start of prompt line before executing a command. + * This looks nicer if the command takes a long time before + * updating the screen. + */ + static void +cmd_exec(VOID_PARAM) +{ + clear_attn(); + clear_bot(); + flush(); +} + +/* + * Indicate we are reading a multi-character command. + */ + static void +set_mca(action) + int action; +{ + mca = action; + clear_bot(); + clear_cmd(); +} + +/* + * Indicate we are not reading a multi-character command. + */ + static void +clear_mca(VOID_PARAM) +{ + if (mca == 0) + return; + mca = 0; +} + +/* + * Set up the display to start a new multi-character command. + */ + static void +start_mca(action, prompt, mlist, cmdflags) + int action; + constant char *prompt; + void *mlist; + int cmdflags; +{ + set_mca(action); + cmd_putstr(prompt); + set_mlist(mlist, cmdflags); +} + + public int +in_mca(VOID_PARAM) +{ + return (mca != 0 && mca != A_PREFIX); +} + +/* + * Set up the display to start a new search command. + */ + static void +mca_search(VOID_PARAM) +{ +#if HILITE_SEARCH + if (search_type & SRCH_FILTER) + set_mca(A_FILTER); + else +#endif + if (search_type & SRCH_FORW) + set_mca(A_F_SEARCH); + else + set_mca(A_B_SEARCH); + + if (search_type & SRCH_NO_MATCH) + cmd_putstr("Non-match "); + if (search_type & SRCH_FIRST_FILE) + cmd_putstr("First-file "); + if (search_type & SRCH_PAST_EOF) + cmd_putstr("EOF-ignore "); + if (search_type & SRCH_NO_MOVE) + cmd_putstr("Keep-pos "); + if (search_type & SRCH_NO_REGEX) + cmd_putstr("Regex-off "); + if (search_type & SRCH_WRAP) + cmd_putstr("Wrap "); + +#if HILITE_SEARCH + if (search_type & SRCH_FILTER) + cmd_putstr("&/"); + else +#endif + if (search_type & SRCH_FORW) + cmd_putstr("/"); + else + cmd_putstr("?"); + forw_prompt = 0; + set_mlist(ml_search, 0); +} + +/* + * Set up the display to start a new toggle-option command. + */ + static void +mca_opt_toggle(VOID_PARAM) +{ + int no_prompt; + int flag; + char *dash; + + no_prompt = (optflag & OPT_NO_PROMPT); + flag = (optflag & ~OPT_NO_PROMPT); + dash = (flag == OPT_NO_TOGGLE) ? "_" : "-"; + + set_mca(A_OPT_TOGGLE); + cmd_putstr(dash); + if (optgetname) + cmd_putstr(dash); + if (no_prompt) + cmd_putstr("(P)"); + switch (flag) + { + case OPT_UNSET: + cmd_putstr("+"); + break; + case OPT_SET: + cmd_putstr("!"); + break; + } + forw_prompt = 0; + set_mlist(NULL, 0); +} + +/* + * Execute a multicharacter command. + */ + static void +exec_mca(VOID_PARAM) +{ + char *cbuf; + + cmd_exec(); + cbuf = get_cmdbuf(); + + switch (mca) + { + case A_F_SEARCH: + case A_B_SEARCH: + multi_search(cbuf, (int) number, 0); + break; +#if HILITE_SEARCH + case A_FILTER: + search_type ^= SRCH_NO_MATCH; + set_filter_pattern(cbuf, search_type); + break; +#endif + case A_FIRSTCMD: + /* + * Skip leading spaces or + signs in the string. + */ + while (*cbuf == '+' || *cbuf == ' ') + cbuf++; + if (every_first_cmd != NULL) + free(every_first_cmd); + if (*cbuf == '\0') + every_first_cmd = NULL; + else + every_first_cmd = save(cbuf); + break; + case A_OPT_TOGGLE: + toggle_option(curropt, opt_lower, cbuf, optflag); + curropt = NULL; + break; + case A_F_BRACKET: + match_brac(cbuf[0], cbuf[1], 1, (int) number); + break; + case A_B_BRACKET: + match_brac(cbuf[1], cbuf[0], 0, (int) number); + break; +#if EXAMINE + case A_EXAMINE: + if (secure) + break; + edit_list(cbuf); +#if TAGS + /* If tag structure is loaded then clean it up. */ + cleantags(); +#endif + break; +#endif +#if SHELL_ESCAPE + case A_SHELL: + /* + * !! just uses whatever is in shellcmd. + * Otherwise, copy cmdbuf to shellcmd, + * expanding any special characters ("%" or "#"). + */ + if (*cbuf != '!') + { + if (shellcmd != NULL) + free(shellcmd); + shellcmd = fexpand(cbuf); + } + + if (secure) + break; + if (shellcmd == NULL) + lsystem("", "!done"); + else + lsystem(shellcmd, "!done"); + break; +#endif +#if PIPEC + case A_PIPE: + if (secure) + break; + (void) pipe_mark(pipec, cbuf); + error("|done", NULL_PARG); + break; +#endif + } +} + +/* + * Is a character an erase or kill char? + */ + static int +is_erase_char(c) + int c; +{ + return (c == erase_char || c == erase2_char || c == kill_char); +} + +/* + * Is a character a carriage return or newline? + */ + static int +is_newline_char(c) + int c; +{ + return (c == '\n' || c == '\r'); +} + +/* + * Handle the first char of an option (after the initial dash). + */ + static int +mca_opt_first_char(c) + int c; +{ + int flag = (optflag & ~OPT_NO_PROMPT); + if (flag == OPT_NO_TOGGLE) + { + switch (c) + { + case '_': + /* "__" = long option name. */ + optgetname = TRUE; + mca_opt_toggle(); + return (MCA_MORE); + } + } else + { + switch (c) + { + case '+': + /* "-+" = UNSET. */ + optflag = (flag == OPT_UNSET) ? + OPT_TOGGLE : OPT_UNSET; + mca_opt_toggle(); + return (MCA_MORE); + case '!': + /* "-!" = SET */ + optflag = (flag == OPT_SET) ? + OPT_TOGGLE : OPT_SET; + mca_opt_toggle(); + return (MCA_MORE); + case CONTROL('P'): + optflag ^= OPT_NO_PROMPT; + mca_opt_toggle(); + return (MCA_MORE); + case '-': + /* "--" = long option name. */ + optgetname = TRUE; + mca_opt_toggle(); + return (MCA_MORE); + } + } + /* Char was not handled here. */ + return (NO_MCA); +} + +/* + * Add a char to a long option name. + * See if we've got a match for an option name yet. + * If so, display the complete name and stop + * accepting chars until user hits RETURN. + */ + static int +mca_opt_nonfirst_char(c) + int c; +{ + char *p; + char *oname; + int err; + + if (curropt != NULL) + { + /* + * Already have a match for the name. + * Don't accept anything but erase/kill. + */ + if (is_erase_char(c)) + return (MCA_DONE); + return (MCA_MORE); + } + /* + * Add char to cmd buffer and try to match + * the option name. + */ + if (cmd_char(c) == CC_QUIT) + return (MCA_DONE); + p = get_cmdbuf(); + opt_lower = ASCII_IS_LOWER(p[0]); + err = 0; + curropt = findopt_name(&p, &oname, &err); + if (curropt != NULL) + { + /* + * Got a match. + * Remember the option and + * display the full option name. + */ + cmd_reset(); + mca_opt_toggle(); + for (p = oname; *p != '\0'; p++) + { + c = *p; + if (!opt_lower && ASCII_IS_LOWER(c)) + c = ASCII_TO_UPPER(c); + if (cmd_char(c) != CC_OK) + return (MCA_DONE); + } + } else if (err != OPT_AMBIG) + { + bell(); + } + return (MCA_MORE); +} + +/* + * Handle a char of an option toggle command. + */ + static int +mca_opt_char(c) + int c; +{ + PARG parg; + + /* + * This may be a short option (single char), + * or one char of a long option name, + * or one char of the option parameter. + */ + if (curropt == NULL && len_cmdbuf() == 0) + { + int ret = mca_opt_first_char(c); + if (ret != NO_MCA) + return (ret); + } + if (optgetname) + { + /* We're getting a long option name. */ + if (!is_newline_char(c)) + return (mca_opt_nonfirst_char(c)); + if (curropt == NULL) + { + parg.p_string = get_cmdbuf(); + error("There is no --%s option", &parg); + return (MCA_DONE); + } + optgetname = FALSE; + cmd_reset(); + } else + { + if (is_erase_char(c)) + return (NO_MCA); + if (curropt != NULL) + /* We're getting the option parameter. */ + return (NO_MCA); + curropt = findopt(c); + if (curropt == NULL) + { + parg.p_string = propt(c); + error("There is no %s option", &parg); + return (MCA_DONE); + } + opt_lower = ASCII_IS_LOWER(c); + } + /* + * If the option which was entered does not take a + * parameter, toggle the option immediately, + * so user doesn't have to hit RETURN. + */ + if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE || + !opt_has_param(curropt)) + { + toggle_option(curropt, opt_lower, "", optflag); + return (MCA_DONE); + } + /* + * Display a prompt appropriate for the option parameter. + */ + start_mca(A_OPT_TOGGLE, opt_prompt(curropt), (void*)NULL, 0); + return (MCA_MORE); +} + +/* + * Handle a char of a search command. + */ + static int +mca_search_char(c) + int c; +{ + int flag = 0; + + /* + * Certain characters as the first char of + * the pattern have special meaning: + * ! Toggle the NO_MATCH flag + * * Toggle the PAST_EOF flag + * @ Toggle the FIRST_FILE flag + */ + if (len_cmdbuf() > 0) + return (NO_MCA); + + switch (c) + { + case '*': + if (less_is_more) + break; + case CONTROL('E'): /* ignore END of file */ + if (mca != A_FILTER) + flag = SRCH_PAST_EOF; + break; + case '@': + if (less_is_more) + break; + case CONTROL('F'): /* FIRST file */ + if (mca != A_FILTER) + flag = SRCH_FIRST_FILE; + break; + case CONTROL('K'): /* KEEP position */ + if (mca != A_FILTER) + flag = SRCH_NO_MOVE; + break; + case CONTROL('W'): /* WRAP around */ + if (mca != A_FILTER) + flag = SRCH_WRAP; + break; + case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */ + flag = SRCH_NO_REGEX; + break; + case CONTROL('N'): /* NOT match */ + case '!': + flag = SRCH_NO_MATCH; + break; + } + + if (flag != 0) + { + /* Toggle flag, but keep PAST_EOF and WRAP mutually exclusive. */ + search_type ^= flag | (search_type & (SRCH_PAST_EOF|SRCH_WRAP)); + mca_search(); + return (MCA_MORE); + } + return (NO_MCA); +} + +/* + * Handle a character of a multi-character command. + */ + static int +mca_char(c) + int c; +{ + int ret; + + switch (mca) + { + case 0: + /* + * We're not in a multicharacter command. + */ + return (NO_MCA); + + case A_PREFIX: + /* + * In the prefix of a command. + * This not considered a multichar command + * (even tho it uses cmdbuf, etc.). + * It is handled in the commands() switch. + */ + return (NO_MCA); + + case A_DIGIT: + /* + * Entering digits of a number. + * Terminated by a non-digit. + */ + if ((c >= '0' && c <= '9') || c == '.') + break; + switch (editchar(c, ECF_PEEK|ECF_NOHISTORY|ECF_NOCOMPLETE|ECF_NORIGHTLEFT)) + { + case A_NOACTION: + /* + * Ignore this char and get another one. + */ + return (MCA_MORE); + case A_INVALID: + /* + * Not part of the number. + * End the number and treat this char + * as a normal command character. + */ + number = cmd_int(&fraction); + clear_mca(); + cmd_accept(); + return (NO_MCA); + } + break; + + case A_OPT_TOGGLE: + ret = mca_opt_char(c); + if (ret != NO_MCA) + return (ret); + break; + + case A_F_SEARCH: + case A_B_SEARCH: + case A_FILTER: + ret = mca_search_char(c); + if (ret != NO_MCA) + return (ret); + break; + + default: + /* Other multicharacter command. */ + break; + } + + /* + * The multichar command is terminated by a newline. + */ + if (is_newline_char(c)) + { + /* + * Execute the command. + */ + exec_mca(); + return (MCA_DONE); + } + + /* + * Append the char to the command buffer. + */ + if (cmd_char(c) == CC_QUIT) + /* + * Abort the multi-char command. + */ + return (MCA_DONE); + + switch (mca) + { + case A_F_BRACKET: + case A_B_BRACKET: *** 1921 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Sun Jul 18 05:51:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 862AF665313; Sun, 18 Jul 2021 05:51: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 4GSDct3STPz3pZN; Sun, 18 Jul 2021 05:51: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 5FFE31E3D7; Sun, 18 Jul 2021 05:51: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 16I5pgs5074151; Sun, 18 Jul 2021 05:51:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I5pg2t074150; Sun, 18 Jul 2021 05:51:42 GMT (envelope-from git) Date: Sun, 18 Jul 2021 05:51:42 GMT Message-Id: <202107180551.16I5pg2t074150@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: 4bcc6d14e23d - main - Fix build 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: 4bcc6d14e23d1443a275fc3a494094274a2f8382 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 05:51:42 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=4bcc6d14e23d1443a275fc3a494094274a2f8382 commit 4bcc6d14e23d1443a275fc3a494094274a2f8382 Author: Xin LI AuthorDate: 2021-07-18 05:51:28 +0000 Commit: Xin LI CommitDate: 2021-07-18 05:51:28 +0000 Fix build MFC after: 2 weeks --- usr.bin/less/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.bin/less/Makefile b/usr.bin/less/Makefile index faa4fe7ca972..08c5249598f9 100644 --- a/usr.bin/less/Makefile +++ b/usr.bin/less/Makefile @@ -3,7 +3,8 @@ PROG= less SRCS= main.c screen.c brac.c ch.c charset.c cmdbuf.c command.c cvt.c \ decode.c edit.c filename.c forwback.c help.c ifile.c input.c \ - jump.c line.c linenum.c lsystem.c mark.c optfunc.c option.c \ + jump.c lesskey_parse.c \ + line.c linenum.c lsystem.c mark.c optfunc.c option.c \ opttbl.c os.c output.c pattern.c position.c prompt.c search.c \ signal.c tags.c ttyin.c version.c xbuf.c SCRIPTS=lesspipe.sh zless.sh From owner-dev-commits-src-main@freebsd.org Sun Jul 18 06:26:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 417F6665A82; Sun, 18 Jul 2021 06:26:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GSFNq1H9Gz3vYm; Sun, 18 Jul 2021 06:26:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 110D41EE2E; Sun, 18 Jul 2021 06:26:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I6QIgO015526; Sun, 18 Jul 2021 06:26:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I6QI0H015525; Sun, 18 Jul 2021 06:26:18 GMT (envelope-from git) Date: Sun, 18 Jul 2021 06:26:18 GMT Message-Id: <202107180626.16I6QI0H015525@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: 51e46835e10a - main - ixgbe: Clean up ix_txrx 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: 51e46835e10a2628482deefc0efd356fb733337a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 06:26:19 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=51e46835e10a2628482deefc0efd356fb733337a commit 51e46835e10a2628482deefc0efd356fb733337a Author: Kevin Bowling AuthorDate: 2021-07-18 06:24:28 +0000 Commit: Kevin Bowling CommitDate: 2021-07-18 06:25:56 +0000 ixgbe: Clean up ix_txrx The intention here is to reduce differences with D30072. The only functional change is logical simplification in ixgbe_rx_checksum. Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D30074 --- sys/dev/ixgbe/ix_txrx.c | 87 +++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c index 9d31e0b1b43e..fe38919fc594 100644 --- a/sys/dev/ixgbe/ix_txrx.c +++ b/sys/dev/ixgbe/ix_txrx.c @@ -50,16 +50,19 @@ static void ixgbe_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx); static int ixgbe_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear); static void ixgbe_isc_rxd_refill(void *arg, if_rxd_update_t iru); -static void ixgbe_isc_rxd_flush(void *arg, uint16_t qsidx, uint8_t flidx __unused, qidx_t pidx); +static void ixgbe_isc_rxd_flush(void *arg, uint16_t qsidx, + uint8_t flidx __unused, qidx_t pidx); static int ixgbe_isc_rxd_available(void *arg, uint16_t qsidx, qidx_t pidx, - qidx_t budget); + qidx_t budget); static int ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri); -static void ixgbe_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype); -static int ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *, if_pkt_info_t); +static void ixgbe_rx_checksum(uint32_t staterr, if_rxd_info_t ri, + uint32_t ptype); +static int ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *, + if_pkt_info_t); extern void ixgbe_if_enable_intr(if_ctx_t ctx); -static int ixgbe_determine_rsstype(u16 pkt_info); +static int ixgbe_determine_rsstype(uint16_t pkt_info); struct if_txrx ixgbe_txrx = { .ift_txd_encap = ixgbe_isc_txd_encap, @@ -81,8 +84,8 @@ struct if_txrx ixgbe_txrx = { static int ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *TXD, if_pkt_info_t pi) { - u32 vlan_macip_lens, type_tucmd_mlhl; - u32 olinfo_status, mss_l4len_idx, pktlen, offload; + uint32_t vlan_macip_lens, type_tucmd_mlhl; + uint32_t olinfo_status, mss_l4len_idx, pktlen, offload; u8 ehdrlen; offload = TRUE; @@ -150,7 +153,7 @@ ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *TXD, if_pkt_info_t pi) offload = FALSE; break; } -/* Insert L4 checksum into data descriptors */ + /* Insert L4 checksum into data descriptors */ if (offload) olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8; @@ -180,7 +183,7 @@ ixgbe_isc_txd_encap(void *arg, if_pkt_info_t pi) union ixgbe_adv_tx_desc *txd = NULL; struct ixgbe_adv_tx_context_desc *TXD; int i, j, first, pidx_last; - u32 olinfo_status, cmd, flags; + uint32_t olinfo_status, cmd, flags; qidx_t ntxd; cmd = (IXGBE_ADVTXD_DTYP_DATA | @@ -364,7 +367,7 @@ ixgbe_isc_rxd_available(void *arg, uint16_t qsidx, qidx_t pidx, qidx_t budget) struct ix_rx_queue *que = &sc->rx_queues[qsidx]; struct rx_ring *rxr = &que->rxr; union ixgbe_adv_rx_desc *rxd; - u32 staterr; + uint32_t staterr; int cnt, i, nrxd; nrxd = sc->shared->isc_nrxd[0]; @@ -400,11 +403,11 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) struct ifnet *ifp = iflib_get_ifp(adapter->ctx); union ixgbe_adv_rx_desc *rxd; - u16 pkt_info, len, cidx, i; - u16 vtag = 0; - u32 ptype; - u32 staterr = 0; - bool eop; + uint16_t pkt_info, len, cidx, i; + uint16_t vtag = 0; + uint32_t ptype; + uint32_t staterr = 0; + bool eop; i = 0; cidx = ri->iri_cidx; @@ -434,11 +437,8 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) /* Make sure bad packets are discarded */ if (eop && (staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) { - -#if __FreeBSD_version >= 1100036 if (adapter->feat_en & IXGBE_FEATURE_VF) if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); -#endif rxr->rx_discarded++; return (EBADMSG); @@ -483,35 +483,28 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) * doesn't spend time verifying the checksum. ************************************************************************/ static void -ixgbe_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) +ixgbe_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) { - u16 status = (u16)staterr; - u8 errors = (u8)(staterr >> 24); - bool sctp = false; - - if ((ptype & IXGBE_RXDADV_PKTTYPE_ETQF) == 0 && - (ptype & IXGBE_RXDADV_PKTTYPE_SCTP) != 0) - sctp = TRUE; - - /* IPv4 checksum */ - if (status & IXGBE_RXD_STAT_IPCS) { - if (!(errors & IXGBE_RXD_ERR_IPE)) { - /* IP Checksum Good */ - ri->iri_csum_flags = CSUM_IP_CHECKED | CSUM_IP_VALID; - } else - ri->iri_csum_flags = 0; - } - /* TCP/UDP/SCTP checksum */ - if (status & IXGBE_RXD_STAT_L4CS) { - u64 type = (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); -#if __FreeBSD_version >= 800000 - if (sctp) - type = CSUM_SCTP_VALID; -#endif - if (!(errors & IXGBE_RXD_ERR_TCPE)) { - ri->iri_csum_flags |= type; - if (!sctp) - ri->iri_csum_data = htons(0xffff); + uint16_t status = (uint16_t)staterr; + uint8_t errors = (uint8_t)(staterr >> 24); + + /* If there is a layer 3 or 4 error we are done */ + if (__predict_false(errors & (IXGBE_RXD_ERR_IPE | IXGBE_RXD_ERR_TCPE))) + return; + + /* IP Checksum Good */ + if (status & IXGBE_RXD_STAT_IPCS) + ri->iri_csum_flags = (CSUM_IP_CHECKED | CSUM_IP_VALID); + + /* Valid L4E checksum */ + if (__predict_true(status & IXGBE_RXD_STAT_L4CS)) { + /* SCTP header present. */ + if (__predict_false((ptype & IXGBE_RXDADV_PKTTYPE_ETQF) == 0 && + (ptype & IXGBE_RXDADV_PKTTYPE_SCTP) != 0)) { + ri->iri_csum_flags |= CSUM_SCTP_VALID; + } else { + ri->iri_csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + ri->iri_csum_data = htons(0xffff); } } } /* ixgbe_rx_checksum */ @@ -522,7 +515,7 @@ ixgbe_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) * Parse the packet type to determine the appropriate hash ************************************************************************/ static int -ixgbe_determine_rsstype(u16 pkt_info) +ixgbe_determine_rsstype(uint16_t pkt_info) { switch (pkt_info & IXGBE_RXDADV_RSSTYPE_MASK) { case IXGBE_RXDADV_RSSTYPE_IPV4_TCP: From owner-dev-commits-src-main@freebsd.org Sun Jul 18 09:24:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4FA7F667AEF; Sun, 18 Jul 2021 09:24:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GSKLG1T9Jz4qhw; Sun, 18 Jul 2021 09:24:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B1FE213A7; Sun, 18 Jul 2021 09:24:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I9OMeb054290; Sun, 18 Jul 2021 09:24:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I9OMtP054289; Sun, 18 Jul 2021 09:24:22 GMT (envelope-from git) Date: Sun, 18 Jul 2021 09:24:22 GMT Message-Id: <202107180924.16I9OMtP054289@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Oskar Holmlund Subject: git: 8cdb4491c90d - main - arm: TI AM335x fix gpio_pin numbers in lookup table. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oh X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8cdb4491c90d3b52d86ea1641ad85d2539f2d4e4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 09:24:22 -0000 The branch main has been updated by oh: URL: https://cgit.FreeBSD.org/src/commit/?id=8cdb4491c90d3b52d86ea1641ad85d2539f2d4e4 commit 8cdb4491c90d3b52d86ea1641ad85d2539f2d4e4 Author: Oskar Holmlund AuthorDate: 2021-07-18 11:06:26 +0000 Commit: Oskar Holmlund CommitDate: 2021-07-18 11:06:26 +0000 arm: TI AM335x fix gpio_pin numbers in lookup table. gpio_pin are calculated as [GPIO_BANK]*32 + GPIO_PIN. gpio_pin are wrong for these pins. As a consequence wrong pins are acquired and used. Approved by: manu (mentor) Reported by: Martin Zakardissnehf (martin.zakardissnehf@se.abb.com) Differential revision: https://reviews.freebsd.org/D31164 --- sys/arm/ti/am335x/am335x_scm_padconf.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/sys/arm/ti/am335x/am335x_scm_padconf.c b/sys/arm/ti/am335x/am335x_scm_padconf.c index 06be33278332..f87f447fdd31 100644 --- a/sys/arm/ti/am335x/am335x_scm_padconf.c +++ b/sys/arm/ti/am335x/am335x_scm_padconf.c @@ -114,19 +114,19 @@ const static struct ti_pinmux_padconf ti_padconf_devmap[] = { _PIN(0x090, "GPMC_ADVn_ALE", 66, 7, "gpmc_advn_ale", NULL, "timer4", NULL, NULL, NULL, NULL, "gpio2_2"), _PIN(0x094, "GPMC_OEn_REn", 67, 7, "gpmc_oen_ren", NULL, "timer7", NULL, NULL, NULL, NULL, "gpio2_3"), _PIN(0x098, "GPMC_WEn", 68, 7, "gpmc_wen", NULL, "timer6", NULL, NULL, NULL, NULL, "gpio2_4"), - _PIN(0x09c, "GPMC_BEn0_CLE", 67, 7, "gpmc_ben0_cle", NULL, "timer5", NULL, NULL, NULL, NULL, "gpio2_5"), - _PIN(0x0a0, "LCD_DATA0", 68, 7, "lcd_data0", "gpmc_a0", "pr1_mii_mt0_clk", "ehrpwm2A", NULL, "pr1_pru1_pru_r30_0", "pr1_pru1_pru_r31_0", "gpio2_6"), - _PIN(0x0a4, "LCD_DATA1", 69, 7, "lcd_data1", "gpmc_a1", "pr1_mii0_txen", "ehrpwm2B", NULL, "pr1_pru1_pru_r30_1", "pr1_pru1_pru_r31_1", "gpio2_7"), - _PIN(0x0a8, "LCD_DATA2", 70, 7, "lcd_data2", "gpmc_a2", "pr1_mii0_txd3", "ehrpwm2_tripzone_input", NULL, "pr1_pru1_pru_r30_2", "pr1_pru1_pru_r31_2", "gpio2_8"), - _PIN(0x0ac, "LCD_DATA3", 71, 7, "lcd_data3", "gpmc_a3", "pr1_mii0_txd2", "ehrpwm0_synco", NULL, "pr1_pru1_pru_r30_3", "pr1_pru1_pru_r31_3", "gpio2_9"), - _PIN(0x0b0, "LCD_DATA4", 72, 7, "lcd_data4", "gpmc_a4", "pr1_mii0_txd1", "eQEP2A_in", NULL, "pr1_pru1_pru_r30_4", "pr1_pru1_pru_r31_4", "gpio2_10"), - _PIN(0x0b4, "LCD_DATA5", 73, 7, "lcd_data5", "gpmc_a5", "pr1_mii0_txd0", "eQEP2B_in", NULL, "pr1_pru1_pru_r30_5", "pr1_pru1_pru_r31_5", "gpio2_11"), - _PIN(0x0b8, "LCD_DATA6", 74, 7, "lcd_data6", "gpmc_a6", "pr1_edio_data_in6", "eQEP2_index", "pr1_edio_data_out6", "pr1_pru1_pru_r30_6", "pr1_pru1_pru_r31_6", "gpio2_12"), - _PIN(0x0bc, "LCD_DATA7", 75, 7, "lcd_data7", "gpmc_a7", "pr1_edio_data_in7", "eQEP2_strobe", "pr1_edio_data_out7", "pr1_pru1_pru_r30_7", "pr1_pru1_pru_r31_7", "gpio2_13"), - _PIN(0x0c0, "LCD_DATA8", 76, 7, "lcd_data8", "gpmc_a12", "ehrpwm1_tripzone_input", "mcasp0_aclkx", "uart5_txd", "pr1_mii0_rxd3", "uart2_ctsn", "gpio2_14"), - _PIN(0x0c4, "LCD_DATA9", 76, 7, "lcd_data9", "gpmc_a13", "ehrpwm0_synco", "mcasp0_fsx", "uart5_rxd", "pr1_mii0_rxd2", "uart2_rtsn", "gpio2_15"), - _PIN(0x0c8, "LCD_DATA10", 77, 7, "lcd_data10", "gpmc_a14", "ehrpwm1A", "mcasp0_axr0", NULL, "pr1_mii0_rxd1", "uart3_ctsn", "gpio2_16"), - _PIN(0x0cc, "LCD_DATA11", 78, 7, "lcd_data11", "gpmc_a15", "ehrpwm1B", "mcasp0_ahclkr", "mcasp0_axr2", "pr1_mii0_rxd0", "uart3_rtsn", "gpio2_17"), + _PIN(0x09c, "GPMC_BEn0_CLE", 69, 7, "gpmc_ben0_cle", NULL, "timer5", NULL, NULL, NULL, NULL, "gpio2_5"), + _PIN(0x0a0, "LCD_DATA0", 70, 7, "lcd_data0", "gpmc_a0", "pr1_mii_mt0_clk", "ehrpwm2A", NULL, "pr1_pru1_pru_r30_0", "pr1_pru1_pru_r31_0", "gpio2_6"), + _PIN(0x0a4, "LCD_DATA1", 71, 7, "lcd_data1", "gpmc_a1", "pr1_mii0_txen", "ehrpwm2B", NULL, "pr1_pru1_pru_r30_1", "pr1_pru1_pru_r31_1", "gpio2_7"), + _PIN(0x0a8, "LCD_DATA2", 72, 7, "lcd_data2", "gpmc_a2", "pr1_mii0_txd3", "ehrpwm2_tripzone_input", NULL, "pr1_pru1_pru_r30_2", "pr1_pru1_pru_r31_2", "gpio2_8"), + _PIN(0x0ac, "LCD_DATA3", 73, 7, "lcd_data3", "gpmc_a3", "pr1_mii0_txd2", "ehrpwm0_synco", NULL, "pr1_pru1_pru_r30_3", "pr1_pru1_pru_r31_3", "gpio2_9"), + _PIN(0x0b0, "LCD_DATA4", 74, 7, "lcd_data4", "gpmc_a4", "pr1_mii0_txd1", "eQEP2A_in", NULL, "pr1_pru1_pru_r30_4", "pr1_pru1_pru_r31_4", "gpio2_10"), + _PIN(0x0b4, "LCD_DATA5", 75, 7, "lcd_data5", "gpmc_a5", "pr1_mii0_txd0", "eQEP2B_in", NULL, "pr1_pru1_pru_r30_5", "pr1_pru1_pru_r31_5", "gpio2_11"), + _PIN(0x0b8, "LCD_DATA6", 76, 7, "lcd_data6", "gpmc_a6", "pr1_edio_data_in6", "eQEP2_index", "pr1_edio_data_out6", "pr1_pru1_pru_r30_6", "pr1_pru1_pru_r31_6", "gpio2_12"), + _PIN(0x0bc, "LCD_DATA7", 77, 7, "lcd_data7", "gpmc_a7", "pr1_edio_data_in7", "eQEP2_strobe", "pr1_edio_data_out7", "pr1_pru1_pru_r30_7", "pr1_pru1_pru_r31_7", "gpio2_13"), + _PIN(0x0c0, "LCD_DATA8", 78, 7, "lcd_data8", "gpmc_a12", "ehrpwm1_tripzone_input", "mcasp0_aclkx", "uart5_txd", "pr1_mii0_rxd3", "uart2_ctsn", "gpio2_14"), + _PIN(0x0c4, "LCD_DATA9", 79, 7, "lcd_data9", "gpmc_a13", "ehrpwm0_synco", "mcasp0_fsx", "uart5_rxd", "pr1_mii0_rxd2", "uart2_rtsn", "gpio2_15"), + _PIN(0x0c8, "LCD_DATA10", 80, 7, "lcd_data10", "gpmc_a14", "ehrpwm1A", "mcasp0_axr0", NULL, "pr1_mii0_rxd1", "uart3_ctsn", "gpio2_16"), + _PIN(0x0cc, "LCD_DATA11", 81, 7, "lcd_data11", "gpmc_a15", "ehrpwm1B", "mcasp0_ahclkr", "mcasp0_axr2", "pr1_mii0_rxd0", "uart3_rtsn", "gpio2_17"), _PIN(0x0d0, "LCD_DATA12", 8, 7, "lcd_data12", "gpmc_a16", "eQEP1A_in", "mcasp0_aclkr", "mcasp0_axr2", "pr1_mii0_rxlink", "uart4_ctsn", "gpio0_8"), _PIN(0x0d4, "LCD_DATA13", 9, 7, "lcd_data13", "gpmc_a17", "eQEP1B_in", "mcasp0_fsr", "mcasp0_axr3", "pr1_mii0_rxer", "uart4_rtsn", "gpio0_9"), _PIN(0x0d8, "LCD_DATA14", 10, 7, "lcd_data14", "gpmc_a18", "eQEP1_index", "mcasp0_axr1", "uart5_rxd", "pr1_mii_mr0_clk", "uart5_ctsn", "gpio0_10"), From owner-dev-commits-src-main@freebsd.org Sun Jul 18 14:20:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A18166BCFB; Sun, 18 Jul 2021 14:20: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 4GSRwM2GQvz4hQY; Sun, 18 Jul 2021 14:20: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 35AC524AF3; Sun, 18 Jul 2021 14:20: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 16IEKpFM052450; Sun, 18 Jul 2021 14:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16IEKpdh052449; Sun, 18 Jul 2021 14:20:51 GMT (envelope-from git) Date: Sun, 18 Jul 2021 14:20:51 GMT Message-Id: <202107181420.16IEKpdh052449@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: 0f2c633164a6 - main - arm64: Add per SoC family kernel config 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: 0f2c633164a6af70db8a8ecf4f70f61d241e7529 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 14:20:51 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=0f2c633164a6af70db8a8ecf4f70f61d241e7529 commit 0f2c633164a6af70db8a8ecf4f70f61d241e7529 Author: Emmanuel Vadot AuthorDate: 2021-02-05 20:41:06 +0000 Commit: Emmanuel Vadot CommitDate: 2021-07-18 14:11:08 +0000 arm64: Add per SoC family kernel config There is multiple reason for this : - This makes it easier to see which driver is needed for each SoC - This makes it easier to create a custom config for one SoC - This really reduce boot time (which some people might want) Some explaination about the files : - std.arm64 contains all standard kernel option - std.dev contains all the standard kernel devices - std. contains all drivers needed to boot on this SoC family - includes std.arm64, std.dev and std. - GENERIC includes std.arm64, std.dev and all std. Sponsored by: Diablotin Systems MFC After: 2 months Reviewed by: mmel, cognet, imp Differential Revision: https://reviews.freebsd.org/D30474 --- sys/arm64/conf/AL | 27 +++ sys/arm64/conf/ALLWINNER | 27 +++ sys/arm64/conf/ALTERA | 27 +++ sys/arm64/conf/AMD | 27 +++ sys/arm64/conf/ARM | 27 +++ sys/arm64/conf/BROADCOM | 27 +++ sys/arm64/conf/CAVIUM | 27 +++ sys/arm64/conf/GENERIC | 396 +++---------------------------------------- sys/arm64/conf/HISILICON | 27 +++ sys/arm64/conf/IMX | 27 +++ sys/arm64/conf/MARVELL | 27 +++ sys/arm64/conf/NVIDIA | 27 +++ sys/arm64/conf/NXP | 27 +++ sys/arm64/conf/QCOM | 27 +++ sys/arm64/conf/ROCKCHIP | 27 +++ sys/arm64/conf/VIRT | 27 +++ sys/arm64/conf/XILINX | 27 +++ sys/arm64/conf/std.al | 27 +++ sys/arm64/conf/std.allwinner | 72 ++++++++ sys/arm64/conf/std.altera | 21 +++ sys/arm64/conf/std.amd | 16 ++ sys/arm64/conf/std.arm | 15 ++ sys/arm64/conf/std.arm64 | 98 +++++++++++ sys/arm64/conf/std.broadcom | 33 ++++ sys/arm64/conf/std.cavium | 27 +++ sys/arm64/conf/std.dev | 112 ++++++++++++ sys/arm64/conf/std.hisilicon | 19 +++ sys/arm64/conf/std.imx | 21 +++ sys/arm64/conf/std.marvell | 58 +++++++ sys/arm64/conf/std.nvidia | 27 +++ sys/arm64/conf/std.nxp | 26 +++ sys/arm64/conf/std.qcom | 14 ++ sys/arm64/conf/std.rockchip | 51 ++++++ sys/arm64/conf/std.virt | 26 +++ sys/arm64/conf/std.xilinx | 19 +++ 35 files changed, 1134 insertions(+), 376 deletions(-) diff --git a/sys/arm64/conf/AL b/sys/arm64/conf/AL new file mode 100644 index 000000000000..b5eb983119c7 --- /dev/null +++ b/sys/arm64/conf/AL @@ -0,0 +1,27 @@ +# +# AL -- Annapurna Alpine kernel configuration file for FreeBSD/arm64 +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# + +#NO_UNIVERSE + +cpu ARM64 +ident AL + +include "std.arm64" +include "std.dev" +include "std.al" diff --git a/sys/arm64/conf/ALLWINNER b/sys/arm64/conf/ALLWINNER new file mode 100644 index 000000000000..5cf5a0929894 --- /dev/null +++ b/sys/arm64/conf/ALLWINNER @@ -0,0 +1,27 @@ +# +# ALLWINNER -- Allwinner kernel configuration file for FreeBSD/arm64 +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# + +#NO_UNIVERSE + +cpu ARM64 +ident ALLWINNER + +include "std.arm64" +include "std.dev" +include "std.allwinner" diff --git a/sys/arm64/conf/ALTERA b/sys/arm64/conf/ALTERA new file mode 100644 index 000000000000..707db3b5ae89 --- /dev/null +++ b/sys/arm64/conf/ALTERA @@ -0,0 +1,27 @@ +# +# ALTERA -- Intel Altera kernel configuration file for FreeBSD/arm64 +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# + +#NO_UNIVERSE + +cpu ARM64 +ident ALTERA + +include "std.arm64" +include "std.dev" +include "std.altera" diff --git a/sys/arm64/conf/AMD b/sys/arm64/conf/AMD new file mode 100644 index 000000000000..27058d90dce4 --- /dev/null +++ b/sys/arm64/conf/AMD @@ -0,0 +1,27 @@ +# +# AMD -- AMD Seattle kernel configuration file for FreeBSD/arm64 +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# + +#NO_UNIVERSE + +cpu ARM64 +ident AMD + +include "std.arm64" +include "std.dev" +include "std.amd" diff --git a/sys/arm64/conf/ARM b/sys/arm64/conf/ARM new file mode 100644 index 000000000000..78022aa4d568 --- /dev/null +++ b/sys/arm64/conf/ARM @@ -0,0 +1,27 @@ +# +# ARM -- ARM kernel configuration file for FreeBSD/arm64 +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# + +#NO_UNIVERSE + +cpu ARM64 +ident ARM + +include "std.arm64" +include "std.dev" +include "std.arm" diff --git a/sys/arm64/conf/BROADCOM b/sys/arm64/conf/BROADCOM new file mode 100644 index 000000000000..0a5478a19d08 --- /dev/null +++ b/sys/arm64/conf/BROADCOM @@ -0,0 +1,27 @@ +# +# BROADCOM -- Broadcom kernel configuration file for FreeBSD/arm64 +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# + +#NO_UNIVERSE + +cpu ARM64 +ident BROADCOM + +include "std.arm64" +include "std.dev" +include "std.broadcom" diff --git a/sys/arm64/conf/CAVIUM b/sys/arm64/conf/CAVIUM new file mode 100644 index 000000000000..4ab13de8e4ff --- /dev/null +++ b/sys/arm64/conf/CAVIUM @@ -0,0 +1,27 @@ +# +# CAVIUM -- Cavium kernel configuration file for FreeBSD/arm64 +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# + +#NO_UNIVERSE + +cpu ARM64 +ident CAVIUM + +include "std.arm64" +include "std.dev" +include "std.cavium" diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index c096c4774f41..c716183aae61 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -16,383 +16,27 @@ # If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # -# $FreeBSD$ cpu ARM64 ident GENERIC -makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols -makeoptions WITH_CTF=1 # Run ctfconvert(1) for DTrace support - -options SCHED_ULE # ULE scheduler -options NUMA # Non-Uniform Memory Architecture support -options PREEMPTION # Enable kernel thread preemption -options VIMAGE # Subsystem virtualization, e.g. VNET -options INET # InterNETworking -options INET6 # IPv6 communications protocols -options IPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 -options ROUTE_MPATH # Multipath routing support -options FIB_ALGO # Modular fib lookups -options TCP_OFFLOAD # TCP offload -options TCP_HHOOK # hhook(9) framework for TCP -options TCP_RFC7413 # TCP Fast Open -options SCTP_SUPPORT # Allow kldload of SCTP -options KERN_TLS # TLS transmit & receive offload -options FFS # Berkeley Fast Filesystem -options SOFTUPDATES # Enable FFS soft updates support -options UFS_ACL # Support for access control lists -options UFS_DIRHASH # Improve performance on big directories -options UFS_GJOURNAL # Enable gjournal-based UFS journaling -options QUOTA # Enable disk quotas for UFS -options MD_ROOT # MD is a potential root device -options NFSCL # Network Filesystem Client -options NFSD # Network Filesystem Server -options NFSLOCKD # Network Lock Manager -options NFS_ROOT # NFS usable as /, requires NFSCL -options MSDOSFS # MSDOS Filesystem -options CD9660 # ISO 9660 Filesystem -options PROCFS # Process filesystem (requires PSEUDOFS) -options PSEUDOFS # Pseudo-filesystem framework -options TMPFS # Efficient memory filesystem -options GEOM_RAID # Soft RAID functionality. -options GEOM_LABEL # Provides labelization -options EFIRT # EFI Runtime Services support -options COMPAT_FREEBSD32 # Compatible with FreeBSD/arm -options COMPAT_FREEBSD11 # Compatible with FreeBSD11 -options COMPAT_FREEBSD12 # Compatible with FreeBSD12 -options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI -options KTRACE # ktrace(1) support -options STACK # stack(9) support -options SYSVSHM # SYSV-style shared memory -options SYSVMSG # SYSV-style message queues -options SYSVSEM # SYSV-style semaphores -options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions -options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. -options KBD_INSTALL_CDEV # install a CDEV entry in /dev -options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) -options AUDIT # Security event auditing -options CAPABILITY_MODE # Capsicum capability mode -options CAPABILITIES # Capsicum capabilities -options MAC # TrustedBSD MAC Framework -options KDTRACE_FRAME # Ensure frames are compiled in -options KDTRACE_HOOKS # Kernel DTrace hooks -options DDB_CTF # Kernel ELF linker loads CTF data -options VFP # Floating-point support -options RACCT # Resource accounting framework -options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default -options RCTL # Resource limits -options INTRNG -options LINUX_BOOT_ABI # Boot using booti command from U-Boot - -# Debugging support. Always need this: -options KDB # Enable kernel debugger support. -options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB # Support DDB. -options GDB # Support remote GDB. -options DEADLKRES # Enable the deadlock resolver -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones -options ALT_BREAK_TO_DEBUGGER # Enter debugger on keyboard escape sequence -options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default - -# Kernel Sanitizers -#options COVERAGE # Generic kernel coverage. Used by KCOV -#options KCOV # Kernel Coverage Sanitizer -# Warning: KUBSAN can result in a kernel too large for loader to load -#options KUBSAN # Kernel Undefined Behavior Sanitizer -#options KCSAN # Kernel Concurrency Sanitizer - -# Kernel dump features. -options EKCD # Support for encrypted kernel dumps -options GZIO # gzip-compressed kernel and user dumps -options ZSTDIO # zstd-compressed kernel and user dumps -options DEBUGNET # debugnet networking -options NETDUMP # netdump(4) client support - -# Make an SMP-capable kernel by default -options SMP # Symmetric MultiProcessor Kernel - -# SoC support -options SOC_ALLWINNER_A64 -options SOC_ALLWINNER_H5 -options SOC_ALLWINNER_H6 -options SOC_CAVM_THUNDERX -options SOC_FREESCALE_IMX8 -options SOC_HISI_HI6220 -options SOC_INTEL_STRATIX10 -options SOC_BRCM_BCM2837 -options SOC_BRCM_BCM2838 -options SOC_BRCM_NS2 -options SOC_MARVELL_8K -options SOC_NVIDIA_TEGRA210 -options SOC_NXP_LS -options SOC_ROCKCHIP_RK3328 -options SOC_ROCKCHIP_RK3399 -options SOC_XILINX_ZYNQ - -# Timer drivers -device a10_timer - -# Annapurna Alpine drivers -device al_ccu # Alpine Cache Coherency Unit -device al_nb_service # Alpine North Bridge Service -device al_iofic # I/O Fabric Interrupt Controller -device al_serdes # Serializer/Deserializer -device al_udma # Universal DMA - -# Qualcomm Snapdragon drivers -device qcom_gcc # Global Clock Controller - -# CPU frequency control -device cpufreq - -# Bus drivers -device pci -device pci_n1sdp # ARM Neoverse N1 SDP PCI -device al_pci # Annapurna Alpine PCI-E -options PCI_HP # PCI-Express native HotPlug -options PCI_IOV # PCI SR-IOV support - -# Block devices -device ahci -device scbus -device da -device pvscsi # VMware PVSCSI - -# ATA/SCSI peripherals -device cd # CD -device pass # Passthrough device (direct ATA/SCSI access) - -# NVM Express (NVMe) support -device nvme # base NVMe driver -options NVME_USE_NVD=0 # prefer the cam(4) based nda(4) driver -device nvd # expose NVMe namespaces as disks, depends on nvme - -# DMA controller -device a31_dmac - -# GPIO / PINCTRL -device a37x0_gpio # Marvell Armada 37x0 GPIO controller -device aw_gpio # Allwinner GPIO controller -device dwgpio # Synopsys DesignWare APB GPIO Controller -device gpio -device gpioled -device fdt_pinctrl -device gpioregulator -device mv_gpio # Marvell GPIO controller -device mvebu_pinctrl # Marvell Pinmux Controller -device pl061 # Arm PL061 GPIO controller -device rk_gpio # RockChip GPIO Controller -device rk_pinctrl # RockChip Pinmux Controller - -# I2C -device a37x0_iic # Armada 37x0 I2C controller -device aw_rsb # Allwinner Reduced Serial Bus -device bcm2835_bsc # Broadcom BCM283x I2C bus -device iicbus -device iicmux -device iic -device icee # Generic IIC eeprom -device twsi # Allwinner I2C controller -device fan53555 # Fairchild Semi FAN53555/SYR82x Regulator -device pca9547 # NPX I2C bus multiplexer -device pcf8563 # NXP Real-time clock/calendar -device rk_i2c # RockChip I2C controller -device sy8106a # SY8106A Buck Regulator -device vf_i2c # Freescale Vybrid I2C controller -device fsliic # Freescale iMX I2C controller - -# Clock and reset controllers -device aw_ccu # Allwinner clock controller - -# Interrupt controllers -device aw_nmi # Allwinner NMI support -device aw_r_intc # Allwinner RINTC support -device mv_cp110_icu # Marvell CP110 ICU -device mv_ap806_gicp # Marvell AP806 GICP -device mv_ap806_sei # Marvell AP806 SEI - -# Real-time clock support -device aw_rtc # Allwinner Real-time Clock -device mv_rtc # Marvell Real-time Clock - -# Crypto accelerators -device armv8crypto # ARMv8 OpenCrypto module -device safexcel # Inside Secure EIP-97 - -# Watchdog controllers -device aw_wdog # Allwinner Watchdog - -# Power management controllers -device axp81x # X-Powers AXP81x PMIC -device rk805 # RockChip RK805 PMIC - -# EFUSE -device aw_sid # Allwinner Secure ID EFUSE - -# Thermal sensors -device aw_thermal # Allwinner Thermal Sensor Controller -device mv_thermal # Marvell Thermal Sensor Controller - -# SPI -device spibus -device a37x0_spi # Marvell Armada 37x0 SPI Controller -device bcm2835_spi # Broadcom BCM283x SPI bus -device rk_spi # RockChip SPI controller - -# PWM -device pwm -device aw_pwm -device rk_pwm - -# Console -device vt -device kbdmux - -device vt_efifb - -# EVDEV support -device evdev # input event device support -options EVDEV_SUPPORT # evdev support in legacy drivers -device uinput # install /dev/uinput cdev -device aw_cir - -# Serial (COM) ports -device uart # Generic UART driver -device uart_imx # iMX8 UART -device uart_msm # Qualcomm MSM UART driver -device uart_mu # RPI3 aux port -device uart_mvebu # Armada 3700 UART driver -device uart_ns8250 # ns8250-type UART driver -device uart_snps -device pl011 - -# PCI/PCI-X/PCIe Ethernet NICs that use iflib infrastructure -device iflib -device enetc # NXP Gigabit NIC -device em # Intel PRO/1000 Gigabit Ethernet Family -device ix # Intel 10Gb Ethernet Family -device vmx # VMware VMXNET3 Ethernet - -# Ethernet NICs -device mdio -device mii -device miibus # MII bus support -device al_eth # Annapurna Alpine Ethernet NIC -device awg # Allwinner EMAC Gigabit Ethernet -device axa # AMD Opteron A1100 integrated NIC -device cgem # Cadence GEM Gigabit Ethernet device -device dwc_rk # Rockchip Designware -device dwc_socfpga # Altera SOCFPGA Ethernet MAC -device ffec # iMX FFEC -device genet # Broadcom on RPi4 -device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet -device neta # Marvell Armada 370/38x/XP/3700 NIC -device re # RealTek 8139C+/8169/8169S/8110S -device smc # SMSC LAN91C111 -device vnic # Cavium ThunderX NIC - -# Etherswitch devices -device etherswitch # Enable etherswitch support -device miiproxy # Required for etherswitch -device e6000sw # Marvell mv88e6085 based switches - - -# Pseudo devices. -device crypto # core crypto support -device loop # Network loopback -device ether # Ethernet support -device vlan # 802.1Q VLAN support -device tuntap # Packet tunnel. -device md # Memory "disks" -device gif # IPv6 and IPv4 tunneling -device firmware # firmware assist module - -# EXT_RESOURCES pseudo devices -options EXT_RESOURCES -device clk -device phy -device hwreset -device nvmem -device regulator -device syscon -device aw_syscon - -# IO Domains -device rk_iodomain - -# The `bpf' device enables the Berkeley Packet Filter. -# Be aware of the administrative consequences of enabling this! -# Note that 'bpf' is required for DHCP. -device bpf # Berkeley packet filter - -# USB support -options USB_DEBUG # enable debug msgs -options USB_HOST_ALIGN=64 # Align usb buffers to cache line size. -device aw_usbphy # Allwinner USB PHY -device rk_usb2phy # Rockchip USB2PHY -device rk_typec_phy # Rockchip TypeC PHY -device dwcotg # DWC OTG controller -device musb # Mentor Graphics USB OTG controller -device ohci # OHCI USB interface -device uhci # UHCI USB interface -device ehci # EHCI USB interface (USB 2.0) -device ehci_mv # Marvell EHCI USB interface -device xhci # XHCI USB interface (USB 3.0) -device dwc3 # Synopsys DWC controller -device aw_dwc3 # Allwinner DWC3 controller -device rk_dwc3 # Rockchip DWC3 controller -device usb # USB Bus (required) -device ukbd # Keyboard -device umass # Disks/Mass storage - Requires scbus and da -device tegra210_xusb_fw # Tegra XUSB firmware - -# USB ethernet support -device muge -device smcphy -device smsc -device ure - -# Sound support -device sound -device a10_codec # Allwinner A10 codec -device aw_i2s # Allwinner I2S -device a33_codec # Allwinner A33 codec -device a64_codec # Allwinner A64 Analog codec - -# MMC/SD/SDIO Card slot support -device sdhci -device sdhci_xenon # Marvell Xenon SD/MMC controller -device aw_mmc # Allwinner SD/MMC controller -device mmc # mmc/sd bus -device mmcsd # mmc/sd flash cards -device dwmmc -device dwmmc_altera -device dwmmc_hisi -device rk_dwmmc -device rk_emmcphy - -# VirtIO support -device virtio # Generic VirtIO bus (required) -device virtio_pci # VirtIO PCI device -device virtio_mmio # VirtIO Memory Mapped IO device -device virtio_blk # VirtIO Block device -device virtio_scsi # VirtIO SCSI device -device vtnet # VirtIO Ethernet device - -# Chip-specific errata -options THUNDERX_PASS_1_1_ERRATA - -options FDT -device acpi - -# DTBs -makeoptions MODULES_EXTRA="dtb/allwinner dtb/freescale dtb/imx8 dtb/nvidia dtb/mv dtb/rockchip dtb/rpi" - -# HID support -options HID_DEBUG # enable debug msgs -device hid # Generic HID support +include "std.arm64" +include "std.dev" + +# Include SoC specific configuration +include "std.al" +include "std.allwinner" +include "std.altera" +include "std.amd" +include "std.arm" +include "std.broadcom" +include "std.cavium" +include "std.hisilicon" +include "std.imx" +include "std.marvell" +include "std.nvidia" +include "std.nxp" +include "std.qcom" +include "std.rockchip" +include "std.virt" +include "std.xilinx" diff --git a/sys/arm64/conf/HISILICON b/sys/arm64/conf/HISILICON new file mode 100644 index 000000000000..3c7eb9573fd2 --- /dev/null +++ b/sys/arm64/conf/HISILICON @@ -0,0 +1,27 @@ +# +# HISILICON -- HiSilicon kernel configuration file for FreeBSD/arm64 +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# + +#NO_UNIVERSE + +cpu ARM64 +ident HISILICON + +include "std.arm64" +include "std.dev" +include "std.hisilicon" diff --git a/sys/arm64/conf/IMX b/sys/arm64/conf/IMX new file mode 100644 index 000000000000..b1d3821e077f --- /dev/null +++ b/sys/arm64/conf/IMX @@ -0,0 +1,27 @@ +# +# IMX -- IMX kernel configuration file for FreeBSD/arm64 +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# + +#NO_UNIVERSE + +cpu ARM64 +ident IMX + +include "std.arm64" +include "std.dev" +include "std.imx" diff --git a/sys/arm64/conf/MARVELL b/sys/arm64/conf/MARVELL new file mode 100644 index 000000000000..60538e735e7e --- /dev/null +++ b/sys/arm64/conf/MARVELL @@ -0,0 +1,27 @@ +# +# MARVELL -- Marvell kernel configuration file for FreeBSD/arm64 +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# + +#NO_UNIVERSE + +cpu ARM64 +ident MARVELL + +include "std.arm64" +include "std.dev" +include "std.marvell" diff --git a/sys/arm64/conf/NVIDIA b/sys/arm64/conf/NVIDIA new file mode 100644 index 000000000000..8d5ee13c9a01 --- /dev/null +++ b/sys/arm64/conf/NVIDIA @@ -0,0 +1,27 @@ +# +# NVIDIA -- NVIDIA kernel configuration file for FreeBSD/arm64 +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# + +#NO_UNIVERSE + +cpu ARM64 +ident NVIDIA + +include "std.arm64" +include "std.dev" +include "std.nvidia" diff --git a/sys/arm64/conf/NXP b/sys/arm64/conf/NXP new file mode 100644 index 000000000000..51708d18277b --- /dev/null +++ b/sys/arm64/conf/NXP @@ -0,0 +1,27 @@ +# +# NXP -- NXP kernel configuration file for FreeBSD/arm64 +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# + +#NO_UNIVERSE + +cpu ARM64 +ident NXP + +include "std.arm64" +include "std.dev" +include "std.nxp" diff --git a/sys/arm64/conf/QCOM b/sys/arm64/conf/QCOM new file mode 100644 index 000000000000..2e1ec2dea0ab --- /dev/null +++ b/sys/arm64/conf/QCOM @@ -0,0 +1,27 @@ +# +# QCOM -- Qualcomm kernel configuration file for FreeBSD/arm64 +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# + +#NO_UNIVERSE + +cpu ARM64 +ident QCOM + +include "std.arm64" +include "std.dev" +include "std.qcom" diff --git a/sys/arm64/conf/ROCKCHIP b/sys/arm64/conf/ROCKCHIP new file mode 100644 index 000000000000..4024e422a473 --- /dev/null +++ b/sys/arm64/conf/ROCKCHIP @@ -0,0 +1,27 @@ +# +# ROCKCHIP -- Rockchip kernel configuration file for FreeBSD/arm64 +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# + +#NO_UNIVERSE + +cpu ARM64 +ident ROCKCHIP + +include "std.arm64" +include "std.dev" +include "std.rockchip" diff --git a/sys/arm64/conf/VIRT b/sys/arm64/conf/VIRT new file mode 100644 index 000000000000..bd5256e428a5 --- /dev/null +++ b/sys/arm64/conf/VIRT @@ -0,0 +1,27 @@ +# +# VIRT -- Virt kernel configuration file for FreeBSD/arm64 +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# + +#NO_UNIVERSE + +cpu ARM64 +ident VIRM + +include "std.arm64" +include "std.dev" +include "std.virt" diff --git a/sys/arm64/conf/XILINX b/sys/arm64/conf/XILINX new file mode 100644 index 000000000000..f4c45081bf06 --- /dev/null +++ b/sys/arm64/conf/XILINX @@ -0,0 +1,27 @@ +# +# XILINX -- Xilinx kernel configuration file for FreeBSD/arm64 +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the +# latest information. *** 805 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Sun Jul 18 16:36:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C74A66D46C; Sun, 18 Jul 2021 16:36: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 4GSVwk25m4z3JYC; Sun, 18 Jul 2021 16:36: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 292C526C4E; Sun, 18 Jul 2021 16:36: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 16IGaM61029986; Sun, 18 Jul 2021 16:36:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16IGaMva029985; Sun, 18 Jul 2021 16:36:22 GMT (envelope-from git) Date: Sun, 18 Jul 2021 16:36:22 GMT Message-Id: <202107181636.16IGaMva029985@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: d72d5ced80f1 - main - arm64: std.allwinner: Fix mismerge 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: d72d5ced80f1eb63bb17ea91c18bf58bbfb7464f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 16:36:22 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=d72d5ced80f1eb63bb17ea91c18bf58bbfb7464f commit d72d5ced80f1eb63bb17ea91c18bf58bbfb7464f Author: Emmanuel Vadot AuthorDate: 2021-07-18 16:35:47 +0000 Commit: Emmanuel Vadot CommitDate: 2021-07-18 16:35:47 +0000 arm64: std.allwinner: Fix mismerge Re-add aw_r_intc and remove duplicate a10_codec --- sys/arm64/conf/std.allwinner | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/conf/std.allwinner b/sys/arm64/conf/std.allwinner index 851e158a5648..71d71300c9b1 100644 --- a/sys/arm64/conf/std.allwinner +++ b/sys/arm64/conf/std.allwinner @@ -25,6 +25,7 @@ device sy8106a # SY8106A Buck Regulator device aw_ccu # Allwinner clock controller # Interrupt controllers +device aw_r_intc # Allwinner RINTC support device aw_nmi # Allwinner NMI support # Real-time clock support @@ -57,7 +58,6 @@ device dwc3 # Synopsys DWC controller device aw_dwc3 # Allwinner DWC3 controller # Sound support -device a10_codec device a10_codec # Allwinner A10 codec device aw_i2s # Allwinner I2S device a33_codec # Allwinner A33 codec