From nobody Mon Feb 24 00:20:31 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1Lww15Plz5pHK9; Mon, 24 Feb 2025 00:20: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1Lwv4mXJz3bQ1; Mon, 24 Feb 2025 00:20:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740356431; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TXMGKQQI6/shVrG3IQTJepsj1UcpAkS+IFy+1mROvF0=; b=SNBIFrZ6fDIrHiPZwhkeCHlcWyGRMNaFTRxmNNbppufBi9iofpQ9mN0tJ15wiFAz/RDOuk P35ZTqAaTHt7q2TPgQybBixzxZQ7PQgZbQNGWEboziLbG2iPJRJGhmSoJGcPYl6X2VW3qI MxXknfLMsswlHJGZNbzQaibRJIbUVTt23HNPp8YhcYP5zttkbxVKmVLvdos7q+Ms/iV9RT 1e5XwyqED1GoKpbqykYpx167vsoih3XZNsWXNbbBV2D2CqGdLRT5p/Rzck8HbkVipG7SRz d7ftRtS9B5pOhTLUTtESDHKXg8M6bUYkWRyBKgdX8hyovB6N9cfgG9iAkkAJgQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740356431; a=rsa-sha256; cv=none; b=f+94r9oqVpEJJjd+qULK8Z815Ac8UKaXMpfz0dZvEt6KIk+hE+f/6ooS4dFnOIsRYWv43r onJBgLhMAj7ZYfKw2O1WqKsMFAhlMRTKCmnOImcAeayUwRwLrb9n+xOhpSyC/YyC6g9/09 HWfTEAO60K1qHCHMkKSBCpdpxNAcbNe0uMh/6nHXSmqrUXcDHGhr3KFo97QAR1VUxAFY0G Cion30o3YC0gvDC1ELvEwcXSqnTfhqCGQLlkJiXCsH+Cd7gwHU+8kzXsRCThsNbdeCe47N 4nihIANib35ULUK3Dmm376hyDze8tIxzxQmCwiVMB8nGu0lsLS7ns4bIqBDKNw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740356431; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TXMGKQQI6/shVrG3IQTJepsj1UcpAkS+IFy+1mROvF0=; b=Zlwl/T+cfwXaIiM0O/zbxQp+LKGKN1NNkrpK/Y9cUYF3CpOG9NHeGKc6SGza4Wh9fzF+Pc BG9uDrgoddN1gCKVV9IH/n8cmMpKu0EOaCqieZNKqAJNd7kSuFfuWNCCmRT0m/bi/dxE36 CW4suPyeTQ5pYsCdkIcZcw42MVsr1eivz0eTeB6/KbB8TEl5nzaVziaIAmZUt7eqgLqdn/ 0tpVkMohIteVMv9/UgRZhQxkzxMzITKmV2LmUz54cvF0AMOJOu5l68yRgsDCJUVbJb0ae6 i4dMvJyy5ApaXWK0cEl1J4kF5sP30LtrnsadZ9D3PqNGkaOCU7R2uVkGW7/beQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z1Lwv4C4Cz2Xb; Mon, 24 Feb 2025 00:20:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51O0KVXK074752; Mon, 24 Feb 2025 00:20:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51O0KVO1074749; Mon, 24 Feb 2025 00:20:31 GMT (envelope-from git) Date: Mon, 24 Feb 2025 00:20:31 GMT Message-Id: <202502240020.51O0KVO1074749@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ravi Pokala Subject: git: 8d079c6a9a5d - main - if_infininband: Support BPF write for broadcast frames List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rpokala X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8d079c6a9a5dfdc75adaf9bc31f2ee8111b849a1 Auto-Submitted: auto-generated The branch main has been updated by rpokala: URL: https://cgit.FreeBSD.org/src/commit/?id=8d079c6a9a5dfdc75adaf9bc31f2ee8111b849a1 commit 8d079c6a9a5dfdc75adaf9bc31f2ee8111b849a1 Author: Nicholas Dance AuthorDate: 2025-02-05 23:33:20 +0000 Commit: Ravi Pokala CommitDate: 2025-02-24 00:13:09 +0000 if_infininband: Support BPF write for broadcast frames To support DHCP for IPoIB links, DHCP clients and servers require the ability to transmit link-layer broadcasts on the IB interfaces. BPF provides the mechanism for doing this. This change updates the if_infiniband driver to be capable of accepting link-layer broadcast requests via BPF using Ethernet formatted frames (the driver currently registers with BPF as DLT_EN10MB). Only Broadcast frames can reliably be interpreted using the Ethernet header format so detect unicast and multicast frames are rejected if passed in using the Ethernet format. This doesn't impact the ability to support native unicast, broadcast or multicast frames if native infiniband header support is added to BPF at a later date. Further the above, this commit also addresses an issue in the existing code that can result in separation of part of the packet header from the rest of the payload if a BPF write was attempted. This was caused by mbuf preallocation of the infiniband header length regardless of length of the prepend data. Reviewed by: rpokala; Greg Foster Tested by: Greg Foster MFC after: 1 week Sponsored by: Vdura Pull Request: https://github.com/freebsd/freebsd-src/pull/1591 --- sys/net/if_infiniband.c | 57 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/sys/net/if_infiniband.c b/sys/net/if_infiniband.c index 7f0bb02f1687..94492421d962 100644 --- a/sys/net/if_infiniband.c +++ b/sys/net/if_infiniband.c @@ -149,6 +149,43 @@ infiniband_bpf_mtap(struct ifnet *ifp, struct mbuf *mb) mb->m_pkthdr.len += sizeof(*ibh); } +/* + * For clients using BPF to send broadcasts. + * + * This driver binds to BPF as an EN10MB (Ethernet) device type. As such, it is + * expected BPF and BPF users will send frames with Ethernet headers, which + * we'll do our best to handle. We can't resolve non-native unicast or multicast + * link-layer addresses, but we can handle broadcast frames. + * + * phlen is populated with IB header size if ibh was populated, 0 otherwise. + */ +static int +infiniband_resolve_bpf(struct ifnet *ifp, const struct sockaddr *dst, + struct mbuf *mb, const struct route *ro, struct infiniband_header *ibh, + int *phlen) +{ + struct ether_header *eh = (struct ether_header *)ro->ro_prepend; + /* If the prepend data & address length don't have the signature of a frame + * forwarded by BPF, allow frame to passthrough. */ + if (((ro->ro_flags & RT_HAS_HEADER) == 0) || + (ro->ro_plen != ETHER_HDR_LEN)) { + *phlen = 0; + return (0); + } + + /* Looks like this frame is from BPF. Handle broadcasts, reject otherwise */ + if (!ETHER_IS_BROADCAST(eh->ether_dhost)) + return (EOPNOTSUPP); + + memcpy(ibh->ib_hwaddr, ifp->if_broadcastaddr, sizeof(ibh->ib_hwaddr)); + ibh->ib_protocol = eh->ether_type; + mb->m_flags &= ~M_MCAST; + mb->m_flags |= M_BCAST; + + *phlen = INFINIBAND_HDR_LEN; + return (0); +} + static void update_mbuf_csumflags(struct mbuf *src, struct mbuf *dst) { @@ -306,7 +343,7 @@ infiniband_output(struct ifnet *ifp, struct mbuf *m, struct llentry *lle = NULL; struct infiniband_header *ih; int error = 0; - int hlen; /* link layer header length */ + int hlen = 0; /* link layer header length */ uint32_t pflags; bool addref; @@ -316,10 +353,20 @@ infiniband_output(struct ifnet *ifp, struct mbuf *m, phdr = NULL; pflags = 0; if (ro != NULL) { - /* XXX BPF uses ro_prepend */ + /* XXX BPF and ARP use ro_prepend */ if (ro->ro_prepend != NULL) { - phdr = ro->ro_prepend; - hlen = ro->ro_plen; + ih = (struct infiniband_header *)linkhdr; + /* Assess whether frame is from BPF and handle */ + error = infiniband_resolve_bpf(ifp, dst, m, ro, ih, &hlen); + if (error != 0) + goto bad; + + if (hlen != 0) { + phdr = linkhdr; + } else { + phdr = ro->ro_prepend; + hlen = ro->ro_plen; + } } else if (!(m->m_flags & (M_BCAST | M_MCAST))) { if ((ro->ro_flags & RT_LLE_CACHE) != 0) { lle = ro->ro_lle; @@ -386,7 +433,7 @@ infiniband_output(struct ifnet *ifp, struct mbuf *m, * Add local infiniband header. If no space in first mbuf, * allocate another. */ - M_PREPEND(m, INFINIBAND_HDR_LEN, M_NOWAIT); + M_PREPEND(m, hlen, M_NOWAIT); if (m == NULL) { error = ENOBUFS; goto bad; From nobody Mon Feb 24 00:59:57 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1MpR0mX3z5pLvR; Mon, 24 Feb 2025 00:59: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1MpQ1lnHz3tqh; Mon, 24 Feb 2025 00:59:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740358798; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=A7EXkDX434IgwKV+3LSQkI7Dih85/+MYXGgcwDXOHyQ=; b=iaeHCU4Mb56/Ogl+1hmEegEvMexBauN1noLR4K7aSjy+espMPv/gNMhZlGAu3KOaoeuyjX M70xddw9tU8oDdZRABRsHUtWj29+dv+bI03nnyeXFa7Txpa4AI15fFT6gSD2SMfzDgVgyx oC87RjnwByimSVLtnu+ml41cyjeAyDpZ2CclthWYJhB4wYnenydhbjwpkYV1vvc1vGTh9k TzzDlFeobw9qT1RXZhx37TDIv01ggPhL2HbRZOzJKkzChRkf5jyCeFiJGtXN7DnZNcgbVg zs7wQFXM0Pq40YEsWzLamnSJMIm8W4dJc+XQ8nZwxmqU/4UGZPD3tRhZ5k6LTw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740358798; a=rsa-sha256; cv=none; b=iF//IGWWSoObLzYVHf4/PIYe42davEcQfI4YWZOiIGB+r9vHZxOJ3ZGItHGQcH5bKYGDTc YgAW++oPiyLUl6fzpRUpFECqN71iKeKzVw/7hBFVtKL5VsjNnXEpk9qiuKy06I1aWz/LKH +3k5fTyRxN8oNObyywDBu5hkGkmbnddsCkHzSj8aT99aVqkJB63eZ/Jgz1dufM4l4/w7mf vbFIaVw3CneI3dJzDaUWS65eZsLAmMFVHkVs6N2qoDWr+k6wnghV/Jyj1lxqVHPNLueECB oHnth9YP70kQ0N1hnvtx7ZHycUoxpJoKyyegmNIDtkYslYV4HqZ60ieFd6A+8A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740358798; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=A7EXkDX434IgwKV+3LSQkI7Dih85/+MYXGgcwDXOHyQ=; b=nMFHpWGGXgDqNPrbNvEll0KhAX/yQW6JfU1I15zlzQ8lz6iNQ6hydJpvzczx2qu6YyLXAJ /2YZnuZ9R15aN9VR2OTVUKlO2aaK2I/dWlBJ9l9GTSAVe1AnU3A7nahYoAZS4ayNsC41aC G1aFo642hfoS6so7XXhsMb238Q5DfncE6vMWOYknRTsxijRN3mJzLKmII9sb/ziZf0c++z DCgGt20YUMYEPwy4M6+kM+Svb0NcVTO9LV3BlV7kiBYXX5ZC758KSaYYTOB4tU8NvhPCtP 7dy/ECK0y8pB3EINQzpL0AxtgKUl5phR1n8A6Xskqcf8VgxDu4Fao815MlJNiA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z1MpQ0tkrz36R; Mon, 24 Feb 2025 00:59:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51O0xvwG039760; Mon, 24 Feb 2025 00:59:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51O0xvPY039757; Mon, 24 Feb 2025 00:59:57 GMT (envelope-from git) Date: Mon, 24 Feb 2025 00:59:57 GMT Message-Id: <202502240059.51O0xvPY039757@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: c66308d7bcc3 - main - usbconfig: add -l option to dump_device_desc for single line output List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c66308d7bcc3931b60a096bfe6ba0f50105e77de Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=c66308d7bcc3931b60a096bfe6ba0f50105e77de commit c66308d7bcc3931b60a096bfe6ba0f50105e77de Author: Bjoern A. Zeeb AuthorDate: 2025-02-12 22:53:06 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-02-24 00:59:06 +0000 usbconfig: add -l option to dump_device_desc for single line output Like pciconf -l add a -l to dump_device_desc for usbconfig which will fold most fields into a single line. We do filter out some we think will not be interesting in this case. While mangling with string output in ways not always anticipated when the program was initially written this should help to parse the available devices for programs like fwget(8). While I had this in mind for other bits for a while I got prompted by D48678 to finally do it. Sponsored by: The FreebSD Foundation MFC after: 3 days Reviewed by: bapt (LGTM), ziaee (man) Differential Revision: https://reviews.freebsd.org/D48974 --- usr.sbin/usbconfig/dump.c | 145 +++++++++++++++++++++++++++++++++++------ usr.sbin/usbconfig/dump.h | 5 +- usr.sbin/usbconfig/usbconfig.8 | 6 +- usr.sbin/usbconfig/usbconfig.c | 20 ++++-- 4 files changed, 148 insertions(+), 28 deletions(-) diff --git a/usr.sbin/usbconfig/dump.c b/usr.sbin/usbconfig/dump.c index 36f026bfc2fb..2a4a5300efeb 100644 --- a/usr.sbin/usbconfig/dump.c +++ b/usr.sbin/usbconfig/dump.c @@ -3,6 +3,10 @@ * * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. * Copyright (c) 2024 Baptiste Daroussin + * Copyright (c) 2025 The FreeBSD Foundation + * + * Portions of this software were developed by Björn Zeeb + * 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 @@ -28,22 +32,32 @@ #include +#include #include #include #include +#include #include #include #include #include #include +#include #include #include +#include + #include "dump.h" #include "pathnames.h" +#ifndef IOUSB +#define IOUSB(a) a +#endif + #define DUMP0(n,type,field,...) dump_field(pdev, " ", #field, n->field); +#define DUMP0L(n,type,field,...) dump_fieldl(pdev, " ", #field, n->field); #define DUMP1(n,type,field,...) dump_field(pdev, " ", #field, n->field); #define DUMP2(n,type,field,...) dump_field(pdev, " ", #field, n->field); #define DUMP3(n,type,field,...) dump_field(pdev, " ", #field, n->field); @@ -113,11 +127,21 @@ dump_power_mode(uint8_t value) } static void -dump_field(struct libusb20_device *pdev, const char *plevel, - const char *field, uint32_t value) +_dump_field(struct libusb20_device *pdev, const char *plevel, + const char *field, uint32_t value, bool list_mode) { uint8_t temp_string[256]; + if (list_mode) { + /* Skip fields we are not interested in. */ + if (strcmp(field, "bLength") == 0 || + strcmp(field, "bDescriptorType") == 0 || + strcmp(field, "bMaxPacketSize0") == 0) + return; + + printf("%s=%#06x ", field, value); + return; + } printf("%s%s = 0x%04x ", plevel, field, value); if (strlen(plevel) == 8) { @@ -257,6 +281,20 @@ dump_field(struct libusb20_device *pdev, const char *plevel, printf("\n"); } +static void +dump_field(struct libusb20_device *pdev, const char *plevel, + const char *field, uint32_t value) +{ + _dump_field(pdev, plevel, field, value, false); +} + +static void +dump_fieldl(struct libusb20_device *pdev, const char *plevel, + const char *field, uint32_t value) +{ + _dump_field(pdev, plevel, field, value, true); +} + static void dump_extra(struct libusb20_me_struct *str, const char *plevel) { @@ -396,16 +434,34 @@ load_vendors(void) return (usb_vendors); } +enum _device_descr_list_type { + _DEVICE_DESCR_LIST_TYPE_DEFAULT = 0, + _DEVICE_DESCR_LIST_TYPE_UGEN = 1, + _DEVICE_DESCR_LIST_TYPE_PRODUCT_VENDOR = 2, +}; + static char * -_device_desc(struct libusb20_device *pdev) +_device_desc(struct libusb20_device *pdev, + enum _device_descr_list_type list_type) { static struct usb_vendors *usb_vendors = NULL; char *desc = NULL; const char *vendor = NULL, *product = NULL; - uint16_t vid = libusb20_dev_get_device_desc(pdev)->idVendor; - uint16_t pid = libusb20_dev_get_device_desc(pdev)->idProduct; + uint16_t vid; + uint16_t pid; struct usb_vendor_info *vi; struct usb_product_info *pi; + struct usb_device_info devinfo; + + if (list_type == _DEVICE_DESCR_LIST_TYPE_UGEN) { + asprintf(&desc, "ugen%u.%u", + libusb20_dev_get_bus_number(pdev), + libusb20_dev_get_address(pdev)); + return (desc); + } + + vid = libusb20_dev_get_device_desc(pdev)->idVendor; + pid = libusb20_dev_get_device_desc(pdev)->idProduct; if (usb_vendors == NULL) usb_vendors = load_vendors(); @@ -424,6 +480,44 @@ _device_desc(struct libusb20_device *pdev) } } } + + /* + * Try to gather the information; libusb2 unfortunately seems to + * only build an entire string but not save vendor/product individually. + */ + if (vendor == NULL || product == NULL) { + char buf[64]; + int f; + + snprintf(buf, sizeof(buf), "/dev/" USB_GENERIC_NAME "%u.%u", + libusb20_dev_get_bus_number(pdev), + libusb20_dev_get_address(pdev)); + + f = open(buf, O_RDWR); + if (f < 0) + goto skip_vp_recovery; + + if (ioctl(f, IOUSB(USB_GET_DEVICEINFO), &devinfo)) + goto skip_vp_recovery; + + + if (vendor == NULL) + vendor = devinfo.udi_vendor; + if (product == NULL) + product = devinfo.udi_product; + +skip_vp_recovery: + if (f >= 0) + close(f); + } + + if (list_type == _DEVICE_DESCR_LIST_TYPE_PRODUCT_VENDOR) { + asprintf(&desc, "vendor='%s' product='%s'", + (vendor != NULL) ? vendor : "", + (product != NULL) ? product : ""); + return (desc); + } + if (vendor == NULL || product == NULL) return (NULL); @@ -433,12 +527,12 @@ _device_desc(struct libusb20_device *pdev) product, vendor, libusb20_dev_get_bus_number(pdev)); - return (desc); } void -dump_device_info(struct libusb20_device *pdev, uint8_t show_ifdrv) +dump_device_info(struct libusb20_device *pdev, uint8_t show_ifdrv, + bool list_mode) { char buf[128]; uint8_t n; @@ -447,18 +541,22 @@ dump_device_info(struct libusb20_device *pdev, uint8_t show_ifdrv) usage = libusb20_dev_get_power_usage(pdev); - desc = _device_desc(pdev); - - printf("%s, cfg=%u md=%s spd=%s pwr=%s (%umA)\n", - desc ? desc : libusb20_dev_get_desc(pdev), - libusb20_dev_get_config_index(pdev), - dump_mode(libusb20_dev_get_mode(pdev)), - dump_speed(libusb20_dev_get_speed(pdev)), - dump_power_mode(libusb20_dev_get_power_mode(pdev)), - usage); + desc = _device_desc(pdev, (list_mode) ? _DEVICE_DESCR_LIST_TYPE_UGEN : + _DEVICE_DESCR_LIST_TYPE_DEFAULT); + + if (list_mode) + printf("%s: ", desc); + else + printf("%s, cfg=%u md=%s spd=%s pwr=%s (%umA)\n", + desc ? desc : libusb20_dev_get_desc(pdev), + libusb20_dev_get_config_index(pdev), + dump_mode(libusb20_dev_get_mode(pdev)), + dump_speed(libusb20_dev_get_speed(pdev)), + dump_power_mode(libusb20_dev_get_power_mode(pdev)), + usage); free(desc); - if (!show_ifdrv) + if (list_mode || !show_ifdrv) return; for (n = 0; n != 255; n++) { @@ -531,12 +629,21 @@ dump_be_dev_quirks(struct libusb20_backend *pbe) } void -dump_device_desc(struct libusb20_device *pdev) +dump_device_desc(struct libusb20_device *pdev, bool list_mode) { struct LIBUSB20_DEVICE_DESC_DECODED *ddesc; ddesc = libusb20_dev_get_device_desc(pdev); - LIBUSB20_DEVICE_DESC(DUMP0, ddesc); + if (list_mode) { + char *desc; + + LIBUSB20_DEVICE_DESC(DUMP0L, ddesc); + desc = _device_desc(pdev, _DEVICE_DESCR_LIST_TYPE_PRODUCT_VENDOR); + printf("%s\n", (desc != NULL) ? desc : ""); + free(desc); + } else { + LIBUSB20_DEVICE_DESC(DUMP0, ddesc); + } } void diff --git a/usr.sbin/usbconfig/dump.h b/usr.sbin/usbconfig/dump.h index 71adb47262ea..6adc8e54e5a9 100644 --- a/usr.sbin/usbconfig/dump.h +++ b/usr.sbin/usbconfig/dump.h @@ -32,10 +32,11 @@ const char *dump_mode(uint8_t value); const char *dump_speed(uint8_t value); const char *dump_power_mode(uint8_t value); void dump_string_by_index(struct libusb20_device *pdev, uint8_t index); -void dump_device_info(struct libusb20_device *pdev, uint8_t show_drv); +void dump_device_info(struct libusb20_device *pdev, uint8_t show_drv, + bool list_mode); void dump_be_quirk_names(struct libusb20_backend *pbe); void dump_be_dev_quirks(struct libusb20_backend *pbe); -void dump_device_desc(struct libusb20_device *pdev); +void dump_device_desc(struct libusb20_device *pdev, bool list_mode); void dump_device_stats(struct libusb20_device *pdev); void dump_config(struct libusb20_device *pdev, uint8_t all_cfg); diff --git a/usr.sbin/usbconfig/usbconfig.8 b/usr.sbin/usbconfig/usbconfig.8 index 3926b03747e5..511fa9c5dddb 100644 --- a/usr.sbin/usbconfig/usbconfig.8 +++ b/usr.sbin/usbconfig/usbconfig.8 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 29, 2022 +.Dd February 12, 2025 .Dt USBCONFIG 8 .Os .Sh NAME @@ -30,6 +30,7 @@ .Nd configure the USB subsystem .Sh SYNOPSIS .Nm +.Op Fl l .Op Fl v .Op Fl a Ar addr .Op Fl i Ar interface_index @@ -40,6 +41,7 @@ .Sm off .Oo Oo Cm /dev/ Oc Cm ugen Oc Ar unit Cm \&. Ar addr .Sm on +.Op Fl l .Op Fl v .Op Fl i Ar interface_index .Op Ar cmds ... @@ -70,6 +72,8 @@ Show help and available commands. Specify interface index as indicated by the command description. If this argument is not specified a value of zero will be used for the interface index. +.It Fl l Cm dump_device_desc +Show numeral only key=value output as one long line. .It Fl u Ar unit Limit device range to USB devices connected to the given USBUS unit. .It Fl v diff --git a/usr.sbin/usbconfig/usbconfig.c b/usr.sbin/usbconfig/usbconfig.c index e28f8de9f75c..7cab4a1354b1 100644 --- a/usr.sbin/usbconfig/usbconfig.c +++ b/usr.sbin/usbconfig/usbconfig.c @@ -25,6 +25,7 @@ * SUCH DAMAGE. */ +#include #include #include #include @@ -91,6 +92,7 @@ struct options { uint8_t got_dump_string:1; uint8_t got_do_request:1; uint8_t got_detach_kernel_driver:1; + uint8_t opt_dump_in_list_mode:1; }; struct token { @@ -504,11 +506,13 @@ flush_command(struct libusb20_backend *pbe, struct options *opt) if (opt->got_list || dump_any) { dump_device_info(pdev, - opt->got_show_iface_driver); + opt->got_show_iface_driver, + opt->opt_dump_in_list_mode && opt->got_dump_device_desc); } if (opt->got_dump_device_desc) { - printf("\n"); - dump_device_desc(pdev); + if (!opt->opt_dump_in_list_mode) + printf("\n"); + dump_device_desc(pdev, opt->opt_dump_in_list_mode); } if (opt->got_dump_all_config) { printf("\n"); @@ -518,14 +522,14 @@ flush_command(struct libusb20_backend *pbe, struct options *opt) dump_config(pdev, 0); } else if (opt->got_dump_all_desc) { printf("\n"); - dump_device_desc(pdev); + dump_device_desc(pdev, false); dump_config(pdev, 1); } if (opt->got_dump_stats) { printf("\n"); dump_device_stats(pdev); } - if (dump_any) { + if (dump_any && !opt->opt_dump_in_list_mode) { printf("\n"); } if (libusb20_dev_close(pdev)) { @@ -559,7 +563,7 @@ main(int argc, char **argv) if (pbe == NULL) err(1, "could not access USB backend\n"); - while ((ch = getopt(argc, argv, "a:d:hi:u:v")) != -1) { + while ((ch = getopt(argc, argv, "a:d:hi:lu:v")) != -1) { switch (ch) { case 'a': opt->addr = num_id(optarg, "addr"); @@ -596,6 +600,10 @@ main(int argc, char **argv) opt->iface = num_id(optarg, "iface"); break; + case 'l': + opt->opt_dump_in_list_mode = 1; + break; + case 'u': opt->bus = num_id(optarg, "busnum"); opt->got_bus = 1; From nobody Mon Feb 24 03:08:15 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1QfS1y73z5pYKX; Mon, 24 Feb 2025 03:08: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1QfR3TNHz480x; Mon, 24 Feb 2025 03:08:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740366495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ye7W6xnVfFY7d4kzZn1GLydSeyIFcXVkert3FhkSTBo=; b=E2Fgbg0dJiLLqTaCOl7N/by+/EgG2WKc++ZqEYpFEcZjC11mOZ/e3y7b/27eh+ITKwD/Y2 5+TyZ5c5gPCHpd6SDQbb5KdOeGyrQRS091Gh+a6RRkauh/pIuL6TqWMhcAV6oGfmo7l8Xu OdXdseTgUzltYc8Bp9PvGZszJYrmFLPjOgCjrBbb7Qg6Y6+UTHz6aMcelnBc3ud0mYFxJ5 V5gbq5LXS0XW0FJ6p3qrMiWDstvNVyCBmuUUjxSnipB6UzyxNRLR894G7G5aHT9/QQG1bq RceEPn23umhvISwsHJJM1saSsAPcMZvNfC5Vdgp1ezawibW/pwcXFlIOK1anCA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740366495; a=rsa-sha256; cv=none; b=T/dcK5p/+f233sjRp0Rh5/GOPA+9weLG248O3CqinMNUwjZquIEDmvqc6GJACM6/tIK7D9 z5Qj6ukBsSqHYICmld+3eztfmuQSrG1imyzad10gksvqB50K9RZz5WlWUDusC/zKGpalog Rfhk4hYrQda9ikMsybIlMBrj3d6E5kRgPd1nfDBVF/0Ez2w6FjtyCaU3YL2jEcYkym1tdL 6QHGdzqlf3rO08bS3ew/MnUFeqUvPDFbu2hnScXVk8MW+Y/yxFYMPC8sDC1JdWkPM8IPc6 Wc0d7rG04Z67bP/2lYpv0AUAAPbrXPXhscYjaf0uBYSlD95kP4YcKg0t2ZQIQQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740366495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ye7W6xnVfFY7d4kzZn1GLydSeyIFcXVkert3FhkSTBo=; b=rnDj3i7TpaetQBFCtC0atv+YNYeZ4mGP0YPybzNu36my84l6g4onRWdONw39aPH2h2hOBh +UQwZdhbF6gM/63e5TytWimxBnwvbfPvevC2GF24wnG5ijm7FZp6AuepkCAqQwadj3BvqZ usXqKSvNZZFoW5bXKNRShlJ6m2p0LjY9k/iFizLAuhGOo9k1fT9VTfXlyVb9aohv7nMvcr khxXg9FqfjAxGeSiDVmtAVBLFxsKLL1i9+acB54/6i0W55rxe5vPmeELeO8RyOUtsfJZFE UFH0MsbQkNq7or8POu0fLGMOjfSM6KEiLtzHamJ92vtDIKHsgtqdSxiSA4UBJg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z1QfR2sGBz74F; Mon, 24 Feb 2025 03:08:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51O38F8M083229; Mon, 24 Feb 2025 03:08:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51O38Fk3083226; Mon, 24 Feb 2025 03:08:15 GMT (envelope-from git) Date: Mon, 24 Feb 2025 03:08:15 GMT Message-Id: <202502240308.51O38Fk3083226@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: f9c7a07d7f5e - main - LinuxKPI: 802.11: synchronize LinuxKPI 802.11 sta from net80211 ni List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f9c7a07d7f5e1c3694b463423c43051451b61e87 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=f9c7a07d7f5e1c3694b463423c43051451b61e87 commit f9c7a07d7f5e1c3694b463423c43051451b61e87 Author: Bjoern A. Zeeb AuthorDate: 2024-12-30 06:35:03 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-02-24 01:32:22 +0000 LinuxKPI: 802.11: synchronize LinuxKPI 802.11 sta from net80211 ni Have a wrapper function dealing with the synchronization for all the dfferent standards (HT and VHT currently). In case HT or VHT is not supported make sure to turn the LinuxKPI "supported" flag off for that. Previously if it was on once it would never be turned off. For HT and VHT properly compute the NSS and also set the max_amsdu_len correctly. Set the NSS directly in the function (which is called in proper order for this) rather than passing the results back and do the setting in the caller. The only thing we need to make sure upfront is that it remains at least 1 (see f5a58c2da239). This all makes the caller and code a tiny bit simpler and work better. There is more synchronization to be done between the chanctx and the deflink bandwidth, which needs to happen dynamically in case net80211 decides to change that under us but no native driver seems to properly implement this (if at all). HT20-only, HT40, and VHT80 are supposed to work for now at least. VHT160 and VHT80P80 have further debug work to do as it does not yet seem to be consistently set in all cases to sync from. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 133 +++++++++++++++++++-------- 1 file changed, 96 insertions(+), 37 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 8daa2fa4dc8e..b53d8eaa7925 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -367,19 +367,17 @@ lkpi_80211_dump_stas(SYSCTL_HANDLER_ARGS) #if defined(LKPI_80211_HT) static void -lkpi_sta_sync_ht_from_ni(struct ieee80211_sta *sta, struct ieee80211_node *ni, int *ht_rx_nss) +lkpi_sta_sync_ht_from_ni(struct ieee80211_sta *sta, struct ieee80211_node *ni) { struct ieee80211vap *vap; uint8_t *ie; struct ieee80211_ht_cap *htcap; int i, rx_nss; - if ((ni->ni_flags & IEEE80211_NODE_HT) == 0) + if ((ni->ni_flags & IEEE80211_NODE_HT) == 0) { + sta->deflink.ht_cap.ht_supported = false; return; - - if (IEEE80211_IS_CHAN_HT(ni->ni_chan) && - IEEE80211_IS_CHAN_HT40(ni->ni_chan)) - sta->deflink.bandwidth = IEEE80211_STA_RX_BW_40; + } sta->deflink.ht_cap.ht_supported = true; @@ -401,43 +399,116 @@ lkpi_sta_sync_ht_from_ni(struct ieee80211_sta *sta, struct ieee80211_node *ni, i sta->deflink.ht_cap.cap = htcap->cap_info; sta->deflink.ht_cap.mcs = htcap->mcs; + if ((sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) != 0) + sta->deflink.bandwidth = IEEE80211_STA_RX_BW_40; + + /* + * 802.11n-2009 20.6 Parameters for HT MCSs gives the mandatory/ + * optional MCS for Nss=1..4. We need to check the first four + * MCS sets from the Rx MCS Bitmask; then there is MCS 32 and + * MCS33.. is UEQM. + */ rx_nss = 0; - for (i = 0; i < nitems(htcap->mcs.rx_mask); i++) { + for (i = 0; i < 4; i++) { if (htcap->mcs.rx_mask[i]) rx_nss++; } - if (ht_rx_nss != NULL) - *ht_rx_nss = rx_nss; + if (rx_nss > 0) + sta->deflink.rx_nss = rx_nss; - IMPROVE("sta->wme, sta->deflink.agg.max*"); + IMPROVE("sta->wme"); + + if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_MAX_AMSDU) + sta->deflink.agg.max_amsdu_len = IEEE80211_MAX_MPDU_LEN_HT_7935; + else + sta->deflink.agg.max_amsdu_len = IEEE80211_MAX_MPDU_LEN_HT_3839; + sta->deflink.agg.max_rc_amsdu_len = IEEE80211_MAX_MPDU_LEN_HT_BA; +#ifdef __handled_by_driver__ /* iwlwifi only? actually unused? */ + for (i = 0; i < nitems(sta.deflink.agg.max_tid_amsdu_len); i++) { + sta->deflink.agg.max_tid_amsdu_len[j] = ; + } +#endif } #endif #if defined(LKPI_80211_VHT) static void -lkpi_sta_sync_vht_from_ni(struct ieee80211_sta *sta, struct ieee80211_node *ni, int *vht_rx_nss) +lkpi_sta_sync_vht_from_ni(struct ieee80211_sta *sta, struct ieee80211_node *ni) { + uint32_t width; + int rx_nss; + uint16_t rx_mcs_map; + uint8_t mcs; - if ((ni->ni_flags & IEEE80211_NODE_VHT) == 0) + if ((ni->ni_flags & IEEE80211_NODE_VHT) == 0) { + sta->deflink.vht_cap.vht_supported = false; return; + } - if (IEEE80211_IS_CHAN_VHT(ni->ni_chan)) { -#ifdef __notyet__ - if (IEEE80211_IS_CHAN_VHT80P80(ni->ni_chan)) { - sta->deflink.bandwidth = IEEE80211_STA_RX_BW_160; /* XXX? */ - } else + sta->deflink.vht_cap.vht_supported = true; + + sta->deflink.vht_cap.cap = ni->ni_vhtcap; + sta->deflink.vht_cap.vht_mcs = ni->ni_vht_mcsinfo; + + width = (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK); + switch (width) { +#if 0 + case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ: + case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ: + sta->deflink.bandwidth = IEEE80211_STA_RX_BW_160; + break; #endif - if (IEEE80211_IS_CHAN_VHT160(ni->ni_chan)) + default: + /* Check if we do support 160Mhz somehow after all. */ +#if 0 + if ((sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) != 0) sta->deflink.bandwidth = IEEE80211_STA_RX_BW_160; - else if (IEEE80211_IS_CHAN_VHT80(ni->ni_chan)) + else +#endif sta->deflink.bandwidth = IEEE80211_STA_RX_BW_80; } - IMPROVE("VHT sync ni to sta"); - return; + + rx_nss = 0; + rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map; + for (int i = 7; i >= 0; i--) { + mcs = rx_mcs_map >> (2 * i); + mcs &= 0x3; + if (mcs != IEEE80211_VHT_MCS_NOT_SUPPORTED) { + rx_nss = i + 1; + break; + } + } + if (rx_nss > 0) + sta->deflink.rx_nss = rx_nss; + + switch (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_MAX_MPDU_MASK) { + case IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454: + sta->deflink.agg.max_amsdu_len = IEEE80211_MAX_MPDU_LEN_VHT_11454; + break; + case IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991: + sta->deflink.agg.max_amsdu_len = IEEE80211_MAX_MPDU_LEN_VHT_7991; + break; + case IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895: + default: + sta->deflink.agg.max_amsdu_len = IEEE80211_MAX_MPDU_LEN_VHT_3895; + break; + } } #endif +static void +lkpi_sta_sync_from_ni(struct ieee80211_sta *sta, struct ieee80211_node *ni) +{ + +#if defined(LKPI_80211_HT) + lkpi_sta_sync_ht_from_ni(sta, ni); +#endif +#if defined(LKPI_80211_VHT) + lkpi_sta_sync_vht_from_ni(sta, ni); +#endif +} + static void lkpi_lsta_dump(struct lkpi_sta *lsta, struct ieee80211_node *ni, const char *_f, int _l) @@ -480,8 +551,6 @@ lkpi_lsta_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN], struct ieee80211_vif *vif; struct ieee80211_sta *sta; int band, i, tid; - int ht_rx_nss; - int vht_rx_nss; lsta = malloc(sizeof(*lsta) + hw->sta_data_size, M_LKPI80211, M_NOWAIT | M_ZERO); @@ -581,18 +650,9 @@ lkpi_lsta_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN], sta->deflink.bandwidth = IEEE80211_STA_RX_BW_20; sta->deflink.rx_nss = 1; - ht_rx_nss = 0; -#if defined(LKPI_80211_HT) - lkpi_sta_sync_ht_from_ni(sta, ni, &ht_rx_nss); -#endif - vht_rx_nss = 0; -#if defined(LKPI_80211_VHT) - lkpi_sta_sync_vht_from_ni(sta, ni, &vht_rx_nss); -#endif + lkpi_sta_sync_from_ni(sta, ni); - sta->deflink.rx_nss = MAX(ht_rx_nss, sta->deflink.rx_nss); - sta->deflink.rx_nss = MAX(vht_rx_nss, sta->deflink.rx_nss); - IMPROVE("he, ... smps_mode, .."); + IMPROVE("he, eht, bw_320, ... smps_mode, .."); /* Link configuration. */ IEEE80211_ADDR_COPY(sta->deflink.addr, sta->addr); @@ -2531,10 +2591,9 @@ lkpi_sta_assoc_to_run(struct ieee80211vap *vap, enum ieee80211_state nstate, int IMPROVE("net80211 does not consider node authorized"); } -#if defined(LKPI_80211_HT) + sta->deflink.rx_nss = MAX(1, sta->deflink.rx_nss); IMPROVE("Is this the right spot, has net80211 done all updates already?"); - lkpi_sta_sync_ht_from_ni(sta, ni, NULL); -#endif + lkpi_sta_sync_from_ni(sta, ni); /* Update sta_state (ASSOC to AUTHORIZED). */ KASSERT(lsta != NULL, ("%s: ni %p lsta is NULL\n", __func__, ni)); From nobody Mon Feb 24 03:08:16 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1QfS6ZQLz5pY1w; Mon, 24 Feb 2025 03:08: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1QfS4z61z47sC; Mon, 24 Feb 2025 03:08:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740366496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BbwPSKS0hp6B9UdBmFdfa6A2QiWfcKhMCf+hzaEQBig=; b=kePAMRmampgoLocsCkM+VUm/G1wxMpeKmp6A9E7XqZE733IIvNS8rQnt2KZODiM62bX/wN CZS88FUPFRDgQMSgRWjkiLs8jt5uG1/qS0PCjiNA8Nv3pRTkZCF17THw7hyeiutf+sOVeA IJGfMK505lLJqHaE2N13eLlp1CV/9iIu0wnn+wgntnc+HuryK8gvJUGy979cN+IC6dvONP qF0LY6qX5NBG+yDzrC4tWT6SNI7Y0PAaiso3K1l/MjleuqLmwMjUqsQrsGFL/Z/j465BAg bSM5j96/MFdnp5oLxPQq3KFgZ1mbaVAHq7odFLnvb891j855wt+BaBwpDgMjGQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740366496; a=rsa-sha256; cv=none; b=JnkaTs9a1aE8U50tr2OlLdWJi0b+IgCFidfZSrs6GlMoJJ42axwrIA794TfRv8E3UFFRnA DqIXjzxeIwnNnoovm6Z14YUNhDaPCrNBgR26/iELWKEhD9ugi7zyAJc91ikptdsciDVw2e n90qp3BOb7q09G3c+FlceGJOtmR+4O1mkxyHw5OQL0qS4FOz7hufIWDoBpQiXti3EyJjdE GzQoxH19qm3S4/lJDgEUlVPsBcBxPG14BPPIfR/pviNPvOVfHjyk/ZLy5Nqjrmw8k/EObS qajfHDNpvqFp7iu+ZgGqUVaPGNe6YtRA/F64St6cFJ5/QUFFhYyNGZi6DtA/0A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740366496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BbwPSKS0hp6B9UdBmFdfa6A2QiWfcKhMCf+hzaEQBig=; b=d64aQbB4KdPOyzFYolIJwYGarLTCGMdHaTSKBwcjVQXR4iHmRo9tDKgA7du6kEZHgowvAT a74YA394I/4NRZYs3qESyraLOBLnzMuLKggEpqQyEaiuklwC6ayTvc1z6lgXvIWKh7iebd mWWbz40qLVcMa0r/1jYSHzIriaXsMkK4if6Jb2qeP8N20JSqmHeMsduHVzG71FY6PzUH53 0M47Z1HlWzpRkau77GQ767M+o2dxmUNjrXtibWirPnfMjyNRrEPLveUFk0bphUDqfa0sqn 1uVnHzB0pEwVvSoBlQohgXw3tjeBCIu+umevNT8tHHDeSnsohGdziBXEUcVYWg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z1QfS45rCz70n; Mon, 24 Feb 2025 03:08:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51O38GUc083270; Mon, 24 Feb 2025 03:08:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51O38GS6083267; Mon, 24 Feb 2025 03:08:16 GMT (envelope-from git) Date: Mon, 24 Feb 2025 03:08:16 GMT Message-Id: <202502240308.51O38GS6083267@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 90d8e307ff61 - main - LinuxKPI: 802.11: cleanup chanctx freq/width settings List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 90d8e307ff610f20dccffe038353affbad0c374e Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=90d8e307ff610f20dccffe038353affbad0c374e commit 90d8e307ff610f20dccffe038353affbad0c374e Author: Bjoern A. Zeeb AuthorDate: 2025-02-24 01:42:31 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-02-24 01:42:31 +0000 LinuxKPI: 802.11: cleanup chanctx freq/width settings Cleanup chanctx freq1/2 and width settings using the channel from the net80211 node and the net80211 functions to return the center frequencies (already doing the math for us or using pre-computed values). Set the min_def (minimum channel definition) to def (channel definition) for the moment as it seems to be unused by anything but iwl_mvm_chanctx_def() to avoid complications. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 43 +++++++++++++--------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index b53d8eaa7925..6d6d14e06a57 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -1732,39 +1732,45 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int (chan->flags & IEEE80211_CHAN_RADAR) ? true : false; chanctx_conf->def.chan = chan; chanctx_conf->def.width = NL80211_CHAN_WIDTH_20_NOHT; - chanctx_conf->def.center_freq1 = chan->center_freq; - chanctx_conf->def.center_freq2 = 0; + chanctx_conf->def.center_freq1 = ieee80211_get_channel_center_freq1(ni->ni_chan); + chanctx_conf->def.center_freq2 = ieee80211_get_channel_center_freq2(ni->ni_chan); IMPROVE("Check vht_cap from band not just chan?"); KASSERT(ni->ni_chan != NULL && ni->ni_chan != IEEE80211_CHAN_ANYC, ("%s:%d: ni %p ni_chan %p\n", __func__, __LINE__, ni, ni->ni_chan)); #ifdef LKPI_80211_HT if (IEEE80211_IS_CHAN_HT(ni->ni_chan)) { - if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) { + if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) chanctx_conf->def.width = NL80211_CHAN_WIDTH_40; - } else + else chanctx_conf->def.width = NL80211_CHAN_WIDTH_20; } #endif #ifdef LKPI_80211_VHT if (IEEE80211_IS_CHAN_VHT(ni->ni_chan)) { #ifdef __notyet__ - if (IEEE80211_IS_CHAN_VHT80P80(ni->ni_chan)) { + if (IEEE80211_IS_CHAN_VHT80P80(ni->ni_chan)) chanctx_conf->def.width = NL80211_CHAN_WIDTH_80P80; - chanctx_conf->def.center_freq2 = 0; /* XXX */ - } else -#endif - if (IEEE80211_IS_CHAN_VHT160(ni->ni_chan)) + else if (IEEE80211_IS_CHAN_VHT160(ni->ni_chan)) chanctx_conf->def.width = NL80211_CHAN_WIDTH_160; - else if (IEEE80211_IS_CHAN_VHT80(ni->ni_chan)) + else +#endif + if (IEEE80211_IS_CHAN_VHT80(ni->ni_chan)) chanctx_conf->def.width = NL80211_CHAN_WIDTH_80; } #endif /* Responder ... */ - chanctx_conf->min_def.chan = chan; +#if 0 + chanctx_conf->min_def.chan = chanctx_conf->def.chan; chanctx_conf->min_def.width = NL80211_CHAN_WIDTH_20_NOHT; - chanctx_conf->min_def.center_freq1 = chan->center_freq; - chanctx_conf->min_def.center_freq2 = 0; - IMPROVE("currently 20_NOHT min_def only"); +#ifdef LKPI_80211_HT + if (IEEE80211_IS_CHAN_HT(ni->ni_chan) || IEEE80211_IS_CHAN_VHT(ni->ni_chan)) + chanctx_conf->min_def.width = NL80211_CHAN_WIDTH_20; +#endif + chanctx_conf->min_def.center_freq1 = chanctx_conf->def.center_freq1; + chanctx_conf->min_def.center_freq2 = chanctx_conf->def.center_freq2; +#else + chanctx_conf->min_def = chanctx_conf->def; +#endif /* Set bss info (bss_info_changed). */ bss_changed = 0; @@ -1797,15 +1803,6 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int vif->bss_conf.chanreq.oper.width = chanctx_conf->def.width; vif->bss_conf.chanreq.oper.center_freq1 = chanctx_conf->def.center_freq1; -#ifdef LKPI_80211_HT - if (vif->bss_conf.chanreq.oper.width == NL80211_CHAN_WIDTH_40) { - /* Note: it is 10 not 20. */ - if (IEEE80211_IS_CHAN_HT40U(ni->ni_chan)) - vif->bss_conf.chanreq.oper.center_freq1 += 10; - else if (IEEE80211_IS_CHAN_HT40D(ni->ni_chan)) - vif->bss_conf.chanreq.oper.center_freq1 -= 10; - } -#endif vif->bss_conf.chanreq.oper.center_freq2 = chanctx_conf->def.center_freq2; } else { From nobody Mon Feb 24 03:08:17 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1QfV1cPpz5pYCG; Mon, 24 Feb 2025 03:08: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1QfT5PdVz47n6; Mon, 24 Feb 2025 03:08:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740366497; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j/lHMHgEL5PHL7QasQOgg0Y6WgWWjVRU9iYnKTb1ASA=; b=wzm9/Kdns7GF3n1no8IZ31Y1TkOkMZyupMGIoMVTYLdlBkXR2xZVwMbYGoXfEsfu5+qLuX OuiivcOucZotHugycZJeUkO58yaB1T5WcNTdmZaYw0uJcqvBCHL6qDzWx7Pst8Q0AoDPpS LW1Sy6J8F2lPe1ZT98HpvBSDxOmtO6ufFuEBhb/AeThMge+c8TZ6E12Rqkt46kmCpd/VcY HEku1fR6oOELfEeZNtqqf2Pc7r0F/Ep1EKo0ylPcUvRpIkLH0y5zdkNlR78m0cc9LYF4rD XViOboiR64Izj3bfVoJoCZvsX8iNVeh0a0HItfJLsCbkMrXqrbJ6hGka34L4pQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740366497; a=rsa-sha256; cv=none; b=iVfE6v75tea2cAGFWcWBHrhWs7fmuf0dtc2FMnfKV5Fb/jnrq+KUHT6QtBnuNtDTU9nEhH QP02WtARgGcwyIWR7isixNRXkK2BxDHV5NvV0ER+zC3G6Q2lrxD41p4DZv7ZhKfJA+Uem0 DKeFe0U0q3ZooZSz+IWMxvBTwBE6KTqOHGu4rcgy8HIqymjQoIq7XaJ028Fv8YSUVCb+f3 0vz9fpFvM4HbMe7znqkNwEQkPBRJljL7gYTFTwwNAmOBJyVs74ndmxPHHZWd5dUTGH4qh+ vuQu00oHYqQX4W8StchLhOJrp14fTOQl3+WF1Jkh1feLWusiHEUtrgxjh/wBeQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740366497; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j/lHMHgEL5PHL7QasQOgg0Y6WgWWjVRU9iYnKTb1ASA=; b=M8hWQhY960hhHHEXXpk1tvkunQLP0lRHkZ/G5jJ9eBu1372bt2R67OzVSOL8B/QtTXQgSV mfayC9EhSd6zN/3efBkCsR2nDEdi99pT0I5hBVZiDpFrsnobM4g6q4INH2livgElpOwJdy rJiggPziETRxNvMhpJtqZJ/9xHOptIda681296kaVGg423Ss4Jb/vn7sjGED8mHyxHCnKa KKN2zzzfZlmq69/WUt2aGYIQjtnF/4lk8/zphqJYtUD2Un+OUACelEc+kGZppGijoRPGyN UHDeWdDrSwoU635SCaXRNlaxSZS2XUzHfnXZAIFzEnxRUvHzrP/E1SWm0zhZDg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z1QfT4mxfz6qw; Mon, 24 Feb 2025 03:08:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51O38H4n083306; Mon, 24 Feb 2025 03:08:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51O38HGR083303; Mon, 24 Feb 2025 03:08:17 GMT (envelope-from git) Date: Mon, 24 Feb 2025 03:08:17 GMT Message-Id: <202502240308.51O38HGR083303@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: ac2c7271b7c2 - main - LinuxKPI: 802.11: disable A-MDPU TX for now for LinuxKPI WiFi drivers List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ac2c7271b7c2624d7cf3af6bdaf82b00323edfd3 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ac2c7271b7c2624d7cf3af6bdaf82b00323edfd3 commit ac2c7271b7c2624d7cf3af6bdaf82b00323edfd3 Author: Bjoern A. Zeeb AuthorDate: 2025-02-24 02:24:34 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-02-24 02:24:34 +0000 LinuxKPI: 802.11: disable A-MDPU TX for now for LinuxKPI WiFi drivers Clear IEEE80211_FHT_AMPDU_TX from iv_flags_ht to avoid doing A-MPDU TX. For Intel we need to support two different variations at least, both likely needing net80211 surgery first. The good news is that turning it off in net80211 will make it work for modern iwlwifi/mvm chipsets/fw. Realtek will need some mac80211 functions to be implemented at least. Once we've done all and tested one after the other we can remove this again. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 6d6d14e06a57..66c1fa29615a 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -3529,6 +3529,10 @@ lkpi_ic_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], if (!lkpi_hwcrypto && ieee80211_hw_check(hw, AMPDU_AGGREGATION)) vap->iv_flags_ht &= ~IEEE80211_FHT_AMPDU_RX; #endif +#if defined(LKPI_80211_HT) + /* 20250125-BZ Keep A-MPDU TX cleared until we sorted out AddBA for all drivers. */ + vap->iv_flags_ht &= ~IEEE80211_FHT_AMPDU_TX; +#endif if (hw->max_listen_interval == 0) hw->max_listen_interval = 7 * (ic->ic_lintval / ic->ic_bintval); From nobody Mon Feb 24 03:08:18 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1QfW2CKJz5pY3y; Mon, 24 Feb 2025 03:08:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1QfV6zJtz47v6; Mon, 24 Feb 2025 03:08:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740366499; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5c7AARLVBBmMZmr2rpNlRXk/hWjYfO74Vq8WVisPcPE=; b=c0FD1xFRxVkIqpj75Sv/eFAYtBD6l0HAQjqprK6r4+rHu7L6Xm7A1YOEPff7IdQZKYf294 wiSeGB6FiyizG6R+ggMSnwCPxq/rVxnI8+G26NFqIDsXRu+DiE36by1pBwhxI0uVamUVAu FA7P9C7/dxNVVirml5g/NyI0KhvHfZvAf7durkRu8VkUgLL/FZrAsccDU569qVaylvhByy /aj3eolSebCEBXEeX7AjonZiSJOg34qvtZsE1ZXT7PqI6uLYGAlt+y1HPrPkYwDhCc9SYz wKIz6k6DDplADxsNIfDbbVSU/m5NqoRFAH1TlGsrOSN6WQeOj8awb1MkH5goTg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740366499; a=rsa-sha256; cv=none; b=YvaTEmKvtvtw3aznGokHla0JrVEdO1Fr02trgDRnL7kRzavAMkMDVlMMveECPX5H1+CGu3 bKwMurGNA6HN/4qzcIdYf+iUjPg9bI2RzNW3MUXTIEVGLandfbQLKp3XvYUB83VluZVWgr uMndrLly7NVIvjGTeengDiVXcH+keoGyM8T326prIW7GTjmhmfiCde1Mbk678W3w7I6WFI TsdbCzExo3gQG+Hy82VWC8IcnZIZHr6mc/MEGE+bQ6u3WLLsDoA5uZCNGBJW6d4b0FYMuI gZQWsFhoyA6SRUKl8qxAF9fTJ624ZZQ+McIdWI7VUwtNBAmWfdZU50tjfzFRTQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740366499; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5c7AARLVBBmMZmr2rpNlRXk/hWjYfO74Vq8WVisPcPE=; b=v5GtWc0DXZLQJEjkP3wg8PLlT3HeFzJZSL9jos1Mnt3I5K5ZVAjYrrRTmY3g2QYZI3VewN zD3YuULnQdNg68wF/mHAe64Ee56ecFe0zCT5fbZkJbnvE4+pr/VJbqpo0zhcA8YDVV5Kk3 AVhxjU6yilY+TOeVd83q/kmUaPwvw8KpNfxdJnJRG2osyWIkl38XZmcPNNppgRat6mzagj CAKDGNYFq/vLKzZB085/rdSLwyu1XD3ZQ0wkPY5sengjHd98Qj11mrf5U3nBHNw5nv/7og H1K2i5OKzNY4zeJOpiH2mJ/R23hgBcR7nQH1CdBV4A5EEVdiIb4t9/JkvbIxgA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z1QfV60xbz74G; Mon, 24 Feb 2025 03:08:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51O38IRZ083341; Mon, 24 Feb 2025 03:08:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51O38I5p083338; Mon, 24 Feb 2025 03:08:18 GMT (envelope-from git) Date: Mon, 24 Feb 2025 03:08:18 GMT Message-Id: <202502240308.51O38I5p083338@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 389265e3ca82 - main - LinuxKPI: 802.11: factor out dynamic_rx_chains computation List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 389265e3ca827ad88b3b8ad787251471161d6634 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=389265e3ca827ad88b3b8ad787251471161d6634 commit 389265e3ca827ad88b3b8ad787251471161d6634 Author: Bjoern A. Zeeb AuthorDate: 2025-02-24 02:43:27 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-02-24 02:56:18 +0000 LinuxKPI: 802.11: factor out dynamic_rx_chains computation For the moment we set dynamic_rx_chains to the rx_nss value which should be correct given we count from 1 there too and we call lkpi_get_max_rx_chains() after we synced ht/vht initially already. Long-term some of these counting bits should be further factored out into their own functions and used both here and for the sync code. This will likely want to change as well once more dyamic synncronization takes place. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 30 +++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 66c1fa29615a..63f6f5a182b5 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -509,6 +509,33 @@ lkpi_sta_sync_from_ni(struct ieee80211_sta *sta, struct ieee80211_node *ni) #endif } +static uint8_t +lkpi_get_max_rx_chains(struct ieee80211_node *ni) +{ + uint8_t chains; +#if defined(LKPI_80211_HT) || defined(LKPI_80211_VHT) + struct lkpi_sta *lsta; + struct ieee80211_sta *sta; + + lsta = ni->ni_drv_data; + sta = LSTA_TO_STA(lsta); +#endif + + chains = 1; +#if defined(LKPI_80211_HT) + IMPROVE("We should factor counting MCS/NSS out for sync and here"); + if (sta->deflink.ht_cap.ht_supported) + chains = MAX(chains, sta->deflink.rx_nss); +#endif + +#if defined(LKPI_80211_VHT) + if (sta->deflink.vht_cap.vht_supported) + chains = MAX(chains, sta->deflink.rx_nss); +#endif + + return (chains); +} + static void lkpi_lsta_dump(struct lkpi_sta *lsta, struct ieee80211_node *ni, const char *_f, int _l) @@ -1726,8 +1753,8 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int chanctx_conf = &lchanctx->chanctx_conf; } - chanctx_conf->rx_chains_dynamic = 1; chanctx_conf->rx_chains_static = 1; + chanctx_conf->rx_chains_dynamic = 1; chanctx_conf->radar_enabled = (chan->flags & IEEE80211_CHAN_RADAR) ? true : false; chanctx_conf->def.chan = chan; @@ -1758,6 +1785,7 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int chanctx_conf->def.width = NL80211_CHAN_WIDTH_80; } #endif + chanctx_conf->rx_chains_dynamic = lkpi_get_max_rx_chains(ni); /* Responder ... */ #if 0 chanctx_conf->min_def.chan = chanctx_conf->def.chan; From nobody Mon Feb 24 10:15:11 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1c731gfdz5nm4n; Mon, 24 Feb 2025 10:15:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1c7315l0z4567; Mon, 24 Feb 2025 10:15:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740392111; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JxrbieA8xOcm+nZpP++VsqJGrmEq8x7EibXtpT66ts4=; b=FG62gNmPa9o0U+s0pQmx2qn9E4jf585IdChBoPdpkl9GI9dyYXm0H/uh3IT/1y0mV8wCtR /DOw7yI6KSclEeSK2/ZEaNQSJWVSq7MaUxWATkZOLF4Yh8say00oPX/RehR7XeiDLisHzi p9kUkmkXSJCHpebHTTQoc46QCSekwweIb+51ZJ2d7RkMpk8xqRnPXjzA+GuSHggSwdl10E uOi4NxuME+Jn/tv20gq0gwQrinhryBxOyyh5e+mwhdiK1TLR2P/IVs5OB2RbHQ59TIH206 TxnkBnB4hcnUV4Xmo/L/9C+Bwn2Xu8AzJoJl6DOt9ogR11g3xw12RjWYmvJ1jQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740392111; a=rsa-sha256; cv=none; b=CRjchlYeWGwsotbE70HVqbpc4QFmxdEEWaHF6mZAZ7CsmsE9YN6ZMzlbXQvmSFPu1Je5St ncKpoI4iBmZi1tcgbotKkfKcc/SLlhh3D0FBSxJISBcKvsEG4ggzuhATTNLkJOjtCC9zD1 kZq1mZiZsLMNJ+LgNFdnebNic3Mfc+VzHtdkXKqiiUtsg5TsVVIwxdIqvLhVEsncBmO5ZT maVffJNr0JgcsTjM6LHyC+478eNjByxPO1oTyLNy7q6LxDrsb15RcAC7aw/0547x7LWQtj 2Wka7UDwyW5fzvak8B6RbTy6V3jXa+am3ZOU3CLO7WQ90/pU/wmPuA7t3OH/0Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740392111; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JxrbieA8xOcm+nZpP++VsqJGrmEq8x7EibXtpT66ts4=; b=HvOaxzKOA6gC8CSIuZKPaQUH051Qa5Fdmwu2sEYcryn86Qr3COBNNxDtufmVZml7Y11SuL pmgr8xQ/q9VE3hJDLlCNxoW2EUMfanS1qYyAfouYGbF2ESgjo6B040ll+pA7t9Hc1NgNi/ DylfDqq9s5fQM9eS5p1vsdJ5VELakdGzjj1EPrdlIhXyl1pvqyXZwjA6w226VqKR29/hIy PdzG5kM3jUnQxUxBOOgviawT/UDVN/sLKS82+LyFx4/cMMWpSSn2VR9qg0HpxrCpOdLTEg l6j0iUCrqnG7PncNzMyPViUqWqYfXT6hWZunkNvrPVEWJFq8Seu1q9ROfwqIhw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z1c730fqYzcrl; Mon, 24 Feb 2025 10:15:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51OAFB7p086748; Mon, 24 Feb 2025 10:15:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51OAFBOZ086745; Mon, 24 Feb 2025 10:15:11 GMT (envelope-from git) Date: Mon, 24 Feb 2025 10:15:11 GMT Message-Id: <202502241015.51OAFBOZ086745@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: a5e380e51cdb - main - netinet: Update a comment for in_localip() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a5e380e51cdba64a392846a4eeda000f948f42ce Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=a5e380e51cdba64a392846a4eeda000f948f42ce commit a5e380e51cdba64a392846a4eeda000f948f42ce Author: Zhenlei Huang AuthorDate: 2025-02-24 10:14:39 +0000 Commit: Zhenlei Huang CommitDate: 2025-02-24 10:14:39 +0000 netinet: Update a comment for in_localip() The function in_localip() was changed to return bool but the comment was left unchanged. Fixes: c8ee75f2315e Use network epoch to protect local IPv4 addresses hash MFC after: 3 days --- sys/netinet/in.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 7196eabc123e..4c0908937ddc 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -147,7 +147,7 @@ in_localaddr(struct in_addr in) } /* - * Return 1 if an internet address is for the local host and configured + * Return true if an internet address is for the local host and configured * on one of its interfaces. */ bool From nobody Mon Feb 24 14:04:24 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1jCY1kf9z5pBDW; Mon, 24 Feb 2025 14:04:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1jCY13ynz46bG; Mon, 24 Feb 2025 14:04:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740405865; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iI9uPKaRWrnWIgd47rZCDSZ1K69/0IkUvP2PbuK/BV4=; b=iwf/hNtsuGUMmuUbXen3MmaTWFZl1gUHXbWEvsaduLhqBUoDVamqnNUhu2xmy4YXSPMROG STgVwjZSt7AfTmyVkEIYcKIJMsaL6Z/k62K148dG5CsNyn/nsAatsxtqdwJHTKfjXP4Esl Qs7CRlu1dp2GDtMgH4QfBNcKaPxSh2L/vIys6gty6awRP4RxNp+aXwlBnUMa4keVNY8Zye 2ZtjgjYmBTGFNDYSrw3sdxyKfeHnExwWF3u63ci9WsrP3IT7ZZ0tLeK4GP2dVzinJhen1l x7z+rVMr1V4z/DUCX5MeCZb3wF1mdTNGV8+VcqRIxS/Q9lj6vccu4BG6sS6z7A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740405865; a=rsa-sha256; cv=none; b=KmPAMHuFett3vNXzVn17UmZm3cFJJ5YlbTsRmd2Y54vE2WgyYChCaY3PKCzAynrPb+dXvM SAz6IuGQ2TRLJiT4QtT2Qg30QS//bTSF8lO67mcxVlku6omHszUt4tVDUd7m3JznSBzwgI CehaWkP7NNjGPFYedrcm+LyErutTX5T4zpnmkEECKPINxwwfS5X6+pxuhfW7rItVBvOaBr LpFiQyfHEDup7m1/iuxyr+h31+o0W3qeZu0n9Gxi4AUmp3+7glZlJyt26Hu0FGZPY24Q1k Z4vf92iDP4HwUYDNZm8FurV9LTIkAeI3UvAbV01+yEEdzRju7YdN2oFuX+8tdA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740405865; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iI9uPKaRWrnWIgd47rZCDSZ1K69/0IkUvP2PbuK/BV4=; b=JosFNhENJHL3wH8mEkhVl7MEbf37Rp8LN6ftZPJsFGisf6Nsbz8djmNQg6tKGQqE7CHLaK 7QWylzC9diPj1r5RPuIbdzL3Q3qq8pXCWfGyINAmeOVlEJIXdGL5d6HlBVbo52QswllvIb NK2v8m8Cv5+orO6zRPJip+4iZXCsYflyO+Dc4KunbRDcpHQLX9zkGYJLfx4sQf/E1S9Jyr AtmuIVf4lld9suvwGtsZYpNDFfgzzLoFU24XhRigmjIvF7U7FVkCr0Zw74AXAmfrct5mFe tBqXbLgqtntnHsV1WF3zee2M3l/9iyARDjXAprIL6pQ3nmzpechuir82gop1dQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z1jCY0Mhnzjxn; Mon, 24 Feb 2025 14:04:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51OE4OAE014811; Mon, 24 Feb 2025 14:04:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51OE4Os9014808; Mon, 24 Feb 2025 14:04:24 GMT (envelope-from git) Date: Mon, 24 Feb 2025 14:04:24 GMT Message-Id: <202502241404.51OE4Os9014808@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wei Hu Subject: git: a18e99945414 - main - mana: Increase default tx and rx ring size to 1024 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a18e99945414fb1f9d455b780c6fcf2d09cc68d8 Auto-Submitted: auto-generated The branch main has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=a18e99945414fb1f9d455b780c6fcf2d09cc68d8 commit a18e99945414fb1f9d455b780c6fcf2d09cc68d8 Author: Wei Hu AuthorDate: 2025-02-24 13:56:06 +0000 Commit: Wei Hu CommitDate: 2025-02-24 13:56:06 +0000 mana: Increase default tx and rx ring size to 1024 Tcp perfomance tests show high number of retries under heave tx traffic. The numbers of queue stops and wakeups also increase. Further analysis suggests the FreeBSD network stack tends to send TSO packets with multiple sg entries, typically ranging from 10 to 16. On mana, every two sgs takes one unit of tx ring. Therefore, adding up one unit for the head, it takes 6 to 9 units of tx ring to send a typical TSO packet. Current default tx ring size is 256, which can get filled up quickly under heavy load. When tx ring is full, the send queue is stopped waiting for the ring space to be freed. This could cause the network stack to drop packets, and lead to tcp retransmissions. Increase the default tx and rx ring size to 1024 units. Also introduce two tuneables allowing users to request tx and rx ring size in loader.conf: hw.mana.rx_req_size hw.mana.tx_req_size When mana is loading, the driver checks these two values and round them up to power of 2. If these two are not set or the request values are out of the allowable range, it sets the default ring size instead. Also change the tx and rx single loop completion budget to 8. Tested by: whu MFC after: 2 weeks Sponsored by: Microsoft --- sys/dev/mana/mana.h | 23 +++++++++-- sys/dev/mana/mana_en.c | 96 +++++++++++++++++++++++++++++++++++++++------- sys/dev/mana/mana_sysctl.c | 16 ++++++++ 3 files changed, 119 insertions(+), 16 deletions(-) diff --git a/sys/dev/mana/mana.h b/sys/dev/mana/mana.h index 906b28eb56b6..a805aa047b9d 100644 --- a/sys/dev/mana/mana.h +++ b/sys/dev/mana/mana.h @@ -106,9 +106,23 @@ enum TRI_STATE { #define DEFAULT_FRAME_SIZE (ADAPTER_MTU_SIZE + 14) #define MAX_FRAME_SIZE 4096 -#define RX_BUFFERS_PER_QUEUE 512 - -#define MAX_SEND_BUFFERS_PER_QUEUE 256 +/* Unit number of RX buffers. Must be power of two + * Higher number could fail at allocation. + */ +#define MAX_RX_BUFFERS_PER_QUEUE 8192 +#define DEF_RX_BUFFERS_PER_QUEUE 1024 +#define MIN_RX_BUFFERS_PER_QUEUE 128 + +/* Unit number of TX buffers. Must be power of two + * Higher number could fail at allocation. + * The max value is derived as the maximum + * allocatable pages supported on host per guest + * through testing. TX buffer size beyond this + * value is rejected by the hardware. + */ +#define MAX_SEND_BUFFERS_PER_QUEUE 16384 +#define DEF_SEND_BUFFERS_PER_QUEUE 1024 +#define MIN_SEND_BUFFERS_PER_QUEUE 128 #define EQ_SIZE (8 * PAGE_SIZE) #define LOG2_EQ_THROTTLE 3 @@ -507,6 +521,9 @@ struct mana_port_context { unsigned int max_queues; unsigned int num_queues; + unsigned int tx_queue_size; + unsigned int rx_queue_size; + mana_handle_t port_handle; int vport_use_count; diff --git a/sys/dev/mana/mana_en.c b/sys/dev/mana/mana_en.c index 735b94bba6cd..a1d2d1015b89 100644 --- a/sys/dev/mana/mana_en.c +++ b/sys/dev/mana/mana_en.c @@ -67,6 +67,9 @@ static int mana_up(struct mana_port_context *apc); static int mana_down(struct mana_port_context *apc); +extern unsigned int mana_tx_req_size; +extern unsigned int mana_rx_req_size; + static void mana_rss_key_fill(void *k, size_t size) { @@ -492,6 +495,7 @@ mana_xmit(struct mana_txq *txq) if_t ndev = txq->ndev; struct mbuf *mbuf; struct mana_port_context *apc = if_getsoftc(ndev); + unsigned int tx_queue_size = apc->tx_queue_size; struct mana_port_stats *port_stats = &apc->port_stats; struct gdma_dev *gd = apc->ac->gdma_dev; uint64_t packets, bytes; @@ -635,7 +639,7 @@ mana_xmit(struct mana_txq *txq) } next_to_use = - (next_to_use + 1) % MAX_SEND_BUFFERS_PER_QUEUE; + (next_to_use + 1) % tx_queue_size; (void)atomic_inc_return(&txq->pending_sends); @@ -1423,6 +1427,7 @@ mana_poll_tx_cq(struct mana_cq *cq) unsigned int wqe_unit_cnt = 0; struct mana_txq *txq = cq->txq; struct mana_port_context *apc; + unsigned int tx_queue_size; uint16_t next_to_complete; if_t ndev; int comp_read; @@ -1436,6 +1441,7 @@ mana_poll_tx_cq(struct mana_cq *cq) ndev = txq->ndev; apc = if_getsoftc(ndev); + tx_queue_size = apc->tx_queue_size; comp_read = mana_gd_poll_cq(cq->gdma_cq, completions, CQE_POLLING_BUFFER); @@ -1521,7 +1527,7 @@ mana_poll_tx_cq(struct mana_cq *cq) mb(); next_to_complete = - (next_to_complete + 1) % MAX_SEND_BUFFERS_PER_QUEUE; + (next_to_complete + 1) % tx_queue_size; pkt_transmitted++; } @@ -1867,9 +1873,9 @@ mana_cq_handler(void *context, struct gdma_queue *gdma_queue) mana_gd_ring_cq(gdma_queue, arm_bit); } -#define MANA_POLL_BUDGET 8 -#define MANA_RX_BUDGET 256 -#define MANA_TX_BUDGET MAX_SEND_BUFFERS_PER_QUEUE +#define MANA_POLL_BUDGET 256 +#define MANA_RX_BUDGET 8 +#define MANA_TX_BUDGET 8 static void mana_poll(void *arg, int pending) @@ -1976,7 +1982,7 @@ mana_deinit_txq(struct mana_port_context *apc, struct mana_txq *txq) if (txq->tx_buf_info) { /* Free all mbufs which are still in-flight */ - for (i = 0; i < MAX_SEND_BUFFERS_PER_QUEUE; i++) { + for (i = 0; i < apc->tx_queue_size; i++) { txbuf_info = &txq->tx_buf_info[i]; if (txbuf_info->mbuf) { mana_tx_unmap_mbuf(apc, txbuf_info); @@ -2034,15 +2040,19 @@ mana_create_txq(struct mana_port_context *apc, if_t net) M_DEVBUF, M_WAITOK | M_ZERO); /* The minimum size of the WQE is 32 bytes, hence - * MAX_SEND_BUFFERS_PER_QUEUE represents the maximum number of WQEs + * apc->tx_queue_size represents the maximum number of WQEs * the SQ can store. This value is then used to size other queues * to prevent overflow. + * Also note that the txq_size is always going to be page aligned, + * as min val of apc->tx_queue_size is 128 and that would make + * txq_size 128 * 32 = 4096 and the other higher values of + * apc->tx_queue_size are always power of two. */ - txq_size = MAX_SEND_BUFFERS_PER_QUEUE * 32; + txq_size = apc->tx_queue_size * 32; KASSERT(IS_ALIGNED(txq_size, PAGE_SIZE), ("txq size not page aligned")); - cq_size = MAX_SEND_BUFFERS_PER_QUEUE * COMP_ENTRY_SIZE; + cq_size = apc->tx_queue_size * COMP_ENTRY_SIZE; cq_size = ALIGN(cq_size, PAGE_SIZE); gc = gd->gdma_context; @@ -2125,7 +2135,7 @@ mana_create_txq(struct mana_port_context *apc, if_t net) gc->cq_table[cq->gdma_id] = cq->gdma_cq; /* Initialize tx specific data */ - txq->tx_buf_info = malloc(MAX_SEND_BUFFERS_PER_QUEUE * + txq->tx_buf_info = malloc(apc->tx_queue_size * sizeof(struct mana_send_buf_info), M_DEVBUF, M_WAITOK | M_ZERO); @@ -2133,7 +2143,7 @@ mana_create_txq(struct mana_port_context *apc, if_t net) "mana:tx(%d)", i); mtx_init(&txq->txq_mtx, txq->txq_mtx_name, NULL, MTX_DEF); - txq->txq_br = buf_ring_alloc(4 * MAX_SEND_BUFFERS_PER_QUEUE, + txq->txq_br = buf_ring_alloc(4 * apc->tx_queue_size, M_DEVBUF, M_WAITOK, &txq->txq_mtx); /* Allocate taskqueue for deferred send */ @@ -2323,10 +2333,10 @@ mana_create_rxq(struct mana_port_context *apc, uint32_t rxq_idx, gc = gd->gdma_context; rxq = malloc(sizeof(*rxq) + - RX_BUFFERS_PER_QUEUE * sizeof(struct mana_recv_buf_oob), + apc->rx_queue_size * sizeof(struct mana_recv_buf_oob), M_DEVBUF, M_WAITOK | M_ZERO); rxq->ndev = ndev; - rxq->num_rx_buf = RX_BUFFERS_PER_QUEUE; + rxq->num_rx_buf = apc->rx_queue_size; rxq->rxq_idx = rxq_idx; /* * Minimum size is MCLBYTES(2048) bytes for a mbuf cluster. @@ -2763,6 +2773,62 @@ mana_detach(if_t ndev) return err; } +static unsigned int +mana_get_tx_queue_size(int port_idx, unsigned int request_size) +{ + unsigned int new_size; + + if (request_size == 0) + /* Uninitialized */ + new_size = DEF_SEND_BUFFERS_PER_QUEUE; + else + new_size = roundup_pow_of_two(request_size); + + if (new_size < MIN_SEND_BUFFERS_PER_QUEUE || + new_size > MAX_SEND_BUFFERS_PER_QUEUE) { + mana_info(NULL, "mana port %d: requested tx buffer " + "size %u out of allowable range (%u - %u), " + "setting to default\n", + port_idx, request_size, + MIN_SEND_BUFFERS_PER_QUEUE, + MAX_SEND_BUFFERS_PER_QUEUE); + new_size = DEF_SEND_BUFFERS_PER_QUEUE; + } + mana_info(NULL, "mana port %d: tx buffer size %u " + "(%u requested)\n", + port_idx, new_size, request_size); + + return (new_size); +} + +static unsigned int +mana_get_rx_queue_size(int port_idx, unsigned int request_size) +{ + unsigned int new_size; + + if (request_size == 0) + /* Uninitialized */ + new_size = DEF_RX_BUFFERS_PER_QUEUE; + else + new_size = roundup_pow_of_two(request_size); + + if (new_size < MIN_RX_BUFFERS_PER_QUEUE || + new_size > MAX_RX_BUFFERS_PER_QUEUE) { + mana_info(NULL, "mana port %d: requested rx buffer " + "size %u out of allowable range (%u - %u), " + "setting to default\n", + port_idx, request_size, + MIN_RX_BUFFERS_PER_QUEUE, + MAX_RX_BUFFERS_PER_QUEUE); + new_size = DEF_RX_BUFFERS_PER_QUEUE; + } + mana_info(NULL, "mana port %d: rx buffer size %u " + "(%u requested)\n", + port_idx, new_size, request_size); + + return (new_size); +} + static int mana_probe_port(struct mana_context *ac, int port_idx, if_t *ndev_storage) @@ -2782,6 +2848,10 @@ mana_probe_port(struct mana_context *ac, int port_idx, apc->max_queues = gc->max_num_queues; apc->num_queues = min_t(unsigned int, gc->max_num_queues, MANA_MAX_NUM_QUEUES); + apc->tx_queue_size = mana_get_tx_queue_size(port_idx, + mana_tx_req_size); + apc->rx_queue_size = mana_get_rx_queue_size(port_idx, + mana_rx_req_size); apc->port_handle = INVALID_MANA_HANDLE; apc->port_idx = port_idx; apc->frame_size = DEFAULT_FRAME_SIZE; diff --git a/sys/dev/mana/mana_sysctl.c b/sys/dev/mana/mana_sysctl.c index 844a05040595..acb3628f09bc 100644 --- a/sys/dev/mana/mana_sysctl.c +++ b/sys/dev/mana/mana_sysctl.c @@ -34,9 +34,17 @@ static int mana_sysctl_cleanup_thread_cpu(SYSCTL_HANDLER_ARGS); int mana_log_level = MANA_ALERT | MANA_WARNING | MANA_INFO; +unsigned int mana_tx_req_size; +unsigned int mana_rx_req_size; + SYSCTL_NODE(_hw, OID_AUTO, mana, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "MANA driver parameters"); +SYSCTL_UINT(_hw_mana, OID_AUTO, tx_req_size, CTLFLAG_RWTUN, + &mana_tx_req_size, 0, "requested number of unit of tx queue"); +SYSCTL_UINT(_hw_mana, OID_AUTO, rx_req_size, CTLFLAG_RWTUN, + &mana_rx_req_size, 0, "requested number of unit of rx queue"); + /* * Logging level for changing verbosity of the output */ @@ -166,6 +174,14 @@ mana_sysctl_add_port(struct mana_port_context *apc) "enable_altq", CTLFLAG_RW, &apc->enable_tx_altq, 0, "Choose alternative txq under heavy load"); + SYSCTL_ADD_UINT(ctx, apc->port_list, OID_AUTO, + "tx_queue_size", CTLFLAG_RD, &apc->tx_queue_size, 0, + "number of unit of tx queue"); + + SYSCTL_ADD_UINT(ctx, apc->port_list, OID_AUTO, + "rx_queue_size", CTLFLAG_RD, &apc->rx_queue_size, 0, + "number of unit of rx queue"); + SYSCTL_ADD_PROC(ctx, apc->port_list, OID_AUTO, "bind_cleanup_thread_cpu", CTLTYPE_U8 | CTLFLAG_RW | CTLFLAG_MPSAFE, From nobody Mon Feb 24 14:40:46 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1k1V5wMgz5pFZg; Mon, 24 Feb 2025 14: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1k1V3s0Nz4QM7; Mon, 24 Feb 2025 14:40:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740408046; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oPbZLct5Te+E5l7xxjFgn9LprtfeIVaC3n+PcjNq4/w=; b=vkLWOs8CQFl0ztWbDkcCaxjC0KqKZ8FRwFoAGLh1doK3I848Se56rgbGfO5D2o/r90fygU ulFcprbkN6wg9LeqdNBNm0UZSWkZx4arbioA98j/KXcmcElT+5qQAf2MYwIYepIoIo6C9n Nxm+l1FzaXDde2XzW+w9PcI8lanDgWD1HiLcAZaYAlgf+EqViCy1q6Pdr45BqAh4aJ47cA 1/Fpc/bD92kyOCG5srhi2HHz8Y1vlICCBt9YJA0ZL8OsrMYb0lhj6DgppWfapno/51T871 aHzNRSZcn9MJqVVR1D7jn3VChrajg6sGLtb4Qi82Hxaa+QocqxRaqCmMt8oq+A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740408046; a=rsa-sha256; cv=none; b=NsOZ13Ooauk2P050ovdFEnTWsTVe9Omy31pXdnChzAil2tpoDY6x/0k/VQTrCYmaM8Vm3e OsFk381k0tO/h4adycXToxWlqTZaFqfhcnzjlKVnVuolMFwTRnMg+jRlgI/htWjy7Bko0A Jr7oQoGQGdh6gVuEfyQ7Ilzvmk3TDK5YuF/ITbaZldEusei8oXjmchLXKINd5/qbC9VMZj ssV1XcvzDUtEaQcHFdVVXNV0Y9PxWdzrXAZQ4ppPK66ITyaMmkGyNEK0IVLAkYEDsjMPaI 9eBjLaMmPKgg/Bbll/mQyVmnIjRPvu9bxJsdyN+J2eEiI0PD4mxQjYBgRgp9Xw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740408046; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oPbZLct5Te+E5l7xxjFgn9LprtfeIVaC3n+PcjNq4/w=; b=y1sVzDgthdbD0uKeq5vBhfJ5YG3WUF7Gj37+ZsWuX9KQGDr0/y0SkHWTo4LUtrd5Om81dx EEX5T7SRDfnwxQyKK1bBi7gGAGQFpol/JBK3aqnf7YJov/dZuVmBxY38VHPxwKG0nu9ScH Z6qVbhkNCny3hpDMPuw6WDMJPbrCtx4VWGg98HA7cQzhQ1rajn6aYOL8Jl2thvPoX4nFnw pBRTyys4Igsbt41EfqQ6LNQ1KmQM2vQfWCwJyNdtboIsiqUVGSNTBZ5E/n6Sgpb8oVXVCV DAX6GXzp9ttgr/WZFRGDu4IO7Jn1oRps5nMYI2mRUZY9BZYwRTqHLmJVZTXGAA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z1k1V3CmdzlSH; Mon, 24 Feb 2025 14:40:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51OEekol082041; Mon, 24 Feb 2025 14:40:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51OEekwk082038; Mon, 24 Feb 2025 14:40:46 GMT (envelope-from git) Date: Mon, 24 Feb 2025 14:40:46 GMT Message-Id: <202502241440.51OEekwk082038@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: 61d8af38bf1c - main - openssh: Fix blacklistd sshd-session integration List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 61d8af38bf1c5328c27ccfcd8a3b73e9e8604d16 Auto-Submitted: auto-generated The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=61d8af38bf1c5328c27ccfcd8a3b73e9e8604d16 commit 61d8af38bf1c5328c27ccfcd8a3b73e9e8604d16 Author: Jose Luis Duran AuthorDate: 2025-02-24 14:38:52 +0000 Commit: Jose Luis Duran CommitDate: 2025-02-24 14:38:52 +0000 openssh: Fix blacklistd sshd-session integration In version 9.8, the server was split into a listener binary, sshd(8), and a per-session binary "sshd-session". Our blacklistd changes also have to be moved from sshd.c to sshd-session.c. Reviewed by: emaste Approved by: emaste (mentor) Fixes: 0fdf8fae8b56 ("openssh: Update to 9.8p1") MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D49116 --- crypto/openssh/sshd-session.c | 3 +++ crypto/openssh/sshd.c | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/crypto/openssh/sshd-session.c b/crypto/openssh/sshd-session.c index 3092cd91242e..ee983176d3aa 100644 --- a/crypto/openssh/sshd-session.c +++ b/crypto/openssh/sshd-session.c @@ -109,6 +109,7 @@ #include "sk-api.h" #include "srclimit.h" #include "dh.h" +#include "blacklist_client.h" /* Re-exec fds */ #define REEXEC_DEVCRYPTO_RESERVED_FD (STDERR_FILENO + 1) @@ -1316,6 +1317,8 @@ main(int ac, char **av) fatal("sshbuf_new loginmsg failed"); auth_debug_reset(); + BLACKLIST_INIT(); + if (privsep_preauth(ssh) == 1) goto authenticated; diff --git a/crypto/openssh/sshd.c b/crypto/openssh/sshd.c index 68e48d75369a..fd48835ebd2a 100644 --- a/crypto/openssh/sshd.c +++ b/crypto/openssh/sshd.c @@ -101,7 +101,6 @@ #include "sk-api.h" #include "addr.h" #include "srclimit.h" -#include "blacklist_client.h" #ifdef LIBWRAP #include @@ -1876,9 +1875,6 @@ main(int ac, char **av) } #endif #endif - - - BLACKLIST_INIT(); } /* server specific fatal cleanup */ From nobody Mon Feb 24 14:40:45 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1k1T42z2z5pFPd; Mon, 24 Feb 2025 14:40: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1k1T2pVGz4QDY; Mon, 24 Feb 2025 14:40:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740408045; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QGRN9iVhPlZSmn0Hxn9NCU1LVYF3EUWEaiO78u+WCGE=; b=Vpd12morf1TnNiqHn/BsEdSSPBsMRj2MRup1AvHU0/nyRoDWm5cqhMytdJDncvoJdebxMl 2wxIp/LsJeGHa4ghgtz3Q2Td0qk6ac2REeo0/xu0/74FZ7zOmMSS3dayZguKWN1kzgjyVy lZrXdfZwcOXUxOCGV9FpiOZ7lbJN6WQdDY9DuXv1rzR9HS93oChmqKGLJ8IkC1Oq+Q+cp+ 7aBqQwMIxo3vq9UtfBaA+BV1YWfco5iWqT7KiFU0LsHJy2i17W5XKHSbCwGoJY7gLwC9nv 7IvFK44oCi2g4KEIe7cLkZRvyyGfVE/TyeZIAdgTqJEdYO6Fb6W8lyLZg9cdKw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740408045; a=rsa-sha256; cv=none; b=qjWNyG+YgCd2sI7dnx/fa/NHNvbNyfe/n4gJgz0wwV1rxT9qqtik4oDQb1se1NIO/Mc7nx eTjovqzMFQRuPWsy9aufNQrLiPwCLcEziHLTDOFCis/pfJh0DLZtNqG5H7X3rBQxjG/+ht Wr6/VRODzDu3m+YzhoDgef6BAp6rtleKOPxqUGD09q+aB9IJAJJ4HloMWW2XBhbmF90RtJ S64SrZ1crHtbWfxLY+fQnttLtd/fdRnv3Zmpbr/OYd7+/LLF9LaLolkzfff/Pu2qBjRxqN XqA+XxyPW+tCOFDbDkyIjP/VNydbxUhk4iAvEY4dejNzoTE/2PBPeCcdtHS3ww== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740408045; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QGRN9iVhPlZSmn0Hxn9NCU1LVYF3EUWEaiO78u+WCGE=; b=hxfONBqYKlLWm8TLs0pgPDelUmbgoIQRTC1khNbzobzi9xipO/UpZERM1r/LRLnPNFnGlV GaoiTyD21OD/XuZEb2Zbhne5WKopBQsG8qxROeCZEqpenhz6fjoDYT1IH3Wx93jdNtpy8B HYzmBCmdayEYov9VvxLzhQxFD88f4r4SRhStYRAzgFG+YPrMXzFEs8cNzRnf7PziJzTs/f IBPXrT7P8kKOJSlo1icP2HGW/kaORH00cwYGvCrZNvaoutL+0b4hY9uZgfrKdFo/GNsyBh emYaZDRyoigyJMSkBb3+oNhRt93TmTQGITEz+B/Tu4luj/zlGJ3x6EGo/LbIPg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z1k1T2NjszlW6; Mon, 24 Feb 2025 14:40:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51OEej9Q082001; Mon, 24 Feb 2025 14:40:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51OEejYi081998; Mon, 24 Feb 2025 14:40:45 GMT (envelope-from git) Date: Mon, 24 Feb 2025 14:40:45 GMT Message-Id: <202502241440.51OEejYi081998@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: 7d1d7f42302d - main - stand: Fix brand positioning on framebuffer console List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7d1d7f42302d80c33243501601b77323acc0717f Auto-Submitted: auto-generated The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=7d1d7f42302d80c33243501601b77323acc0717f commit 7d1d7f42302d80c33243501601b77323acc0717f Author: Jose Luis Duran AuthorDate: 2025-02-24 14:36:10 +0000 Commit: Jose Luis Duran CommitDate: 2025-02-24 14:36:10 +0000 stand: Fix brand positioning on framebuffer console The drawer.lua script ignores the values in loader_brand_x and loader_brand_y on framebuffer consoles, always positioning the brand at (1, 1). Allow it to be positioned by accepting the x and y values just like the text version. For example: /boot/lua/gfx-nanobsd.lua: return { brand = { graphic = { "" }, requires_color = true, image = "/boot/images/freebsd-logo-rev.png" } } /boot/loader.conf.d/bootloader.conf: loader_logo="none" loader_brand="nanobsd" loader_brand_x="15" PR: 255202 Reviewed by: manu, imp Approved by: emaste (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D49092 --- stand/lua/drawer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index 2d04e29ac462..1bf741b2373e 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -327,7 +327,7 @@ local function drawbrand() if core.isFramebufferConsole() and gfx.term_putimage ~= nil and branddef.image ~= nil then - if gfx.term_putimage(branddef.image, 1, 1, 0, 7, 0) + if gfx.term_putimage(branddef.image, x, y, 0, 7, 0) then return true end From nobody Mon Feb 24 14:56:34 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1kMl1CFbz5pHSk; Mon, 24 Feb 2025 14:56: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1kMk6FlSz3PcW; Mon, 24 Feb 2025 14:56:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740408994; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ah7iqrbK5orDm/dK7TVFOka0laoLPU91xr9xdlH3ByU=; b=uQ+P+mc8nHtBtiy9wr2n4s8vnYxrpYuqAiYIuH3wJZDF+90TiOGSQzdEXjtzqJPVVIslSL FWnDKN4XKaSvqysKqROvgfikX5rIceRzKbuFPRl+/ajjUv3Fj2m6/+aOlFTWXjuegQh1Ap 1cBrhA0KgIGD+tlRmJVtUWEp6P6V7acScZlmOE5TOjIqqs/NB1nVVAGv/9uYMGoYWFVXmH yavV2+UO+t4n0PeE0hiHF8PFYAFHQ+74C4Sy/IiO2E/xK2atkvsf6hpl0TZgEt6qDCuLYF SAFtAYl2tKJIeLls2I7iEec8t6RB265vmIojR0xqvPLwzpMYpYnin8XRtf/zGQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740408994; a=rsa-sha256; cv=none; b=cKtqUwyWbR8EykQ9BhzV0RE8Bdc5zErUAAOiRJPivb9q6nBKE/cq3RGemXy+GyUd+5QxfY C6zvB88JqdsqlkJ96eh6YO/KZrntSdq7lIo651CrgXNrDd+j/AJAqpc0vT2I2l7WPICDGQ IR0KWhWnwqpCsH8ILlHLR2yKAOobscYsRj04FZPUub9ZTqe+VovwvAZ3w1m1Q2p965CKR5 QB2JZaa3PrdLX/bbEiTvFD+QJX9RzgphhLx7jnT3drhx9G2eizU8kDbHOTZ4I0R9v0bW9D /+WLV3yWP6GKJPaeHaV+bxYdsPt9VVprBIIeTUfBDZSMN2ZTfbfAKBd0Jjri/A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740408994; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ah7iqrbK5orDm/dK7TVFOka0laoLPU91xr9xdlH3ByU=; b=Eo4rOhQidKoVZvyTt1omzIYjHJ9PcDfGqBO/PW3KPZVsiEbgGMi5SGVRKPtGSSijAL5zCr 2DpuZpgc5v8RjujsEC63Z5s2O+6D6um8ypQwNgItmvUuHPh+GK4kuSwb89tfBMusslQQ7e eGK7OJ/gGtq7dA9U6tEqNfGARtlFt+BvmclBA4iIl085ZgZypx7emJgBKGNA4leXKacC5v VXjb/1tX/d96hLHODAleHTgvL9TqwSr8bb2HssgkR7G/nOiCorIarzFyPxqUBwlVtUY0Kp fR79DcddpaAE4ccFqfv0MQhxTopJgzg605OPpWhaicwRy4+fNs67qiwxBac+UQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z1kMk5ksZzlv7; Mon, 24 Feb 2025 14:56:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51OEuYa5008840; Mon, 24 Feb 2025 14:56:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51OEuYcu008837; Mon, 24 Feb 2025 14:56:34 GMT (envelope-from git) Date: Mon, 24 Feb 2025 14:56:34 GMT Message-Id: <202502241456.51OEuYcu008837@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: a1452eec4768 - main - dtrace: fix signature mismatch for taskqueue callbacks List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a1452eec4768272056aa070db94ea7184ce1117c Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a1452eec4768272056aa070db94ea7184ce1117c commit a1452eec4768272056aa070db94ea7184ce1117c Author: SHENGYI HONG AuthorDate: 2025-02-23 17:42:41 +0000 Commit: Mark Johnston CommitDate: 2025-02-24 14:56:29 +0000 dtrace: fix signature mismatch for taskqueue callbacks Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D49112 --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index 608bff1d23ae..cfd403ac1a01 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -594,7 +594,8 @@ static dtrace_probe_t *dtrace_probe_lookup_id(dtrace_id_t id); static void dtrace_enabling_provide(dtrace_provider_t *); static int dtrace_enabling_match(dtrace_enabling_t *, int *); static void dtrace_enabling_matchall(void); -static void dtrace_enabling_reap(void); +static void dtrace_enabling_matchall_task(void *); +static void dtrace_enabling_reap(void *); static dtrace_state_t *dtrace_anon_grab(void); static uint64_t dtrace_helper(int, dtrace_mstate_t *, dtrace_state_t *, uint64_t, uint64_t); @@ -12991,6 +12992,12 @@ dtrace_enabling_match(dtrace_enabling_t *enab, int *nmatched) return (0); } +static void +dtrace_enabling_matchall_task(void *args __unused) +{ + dtrace_enabling_matchall(); +} + static void dtrace_enabling_matchall(void) { @@ -13118,7 +13125,7 @@ retry: * Called to reap ECBs that are attached to probes from defunct providers. */ static void -dtrace_enabling_reap(void) +dtrace_enabling_reap(void *args __unused) { dtrace_provider_t *prov; dtrace_probe_t *probe; @@ -16719,8 +16726,8 @@ dtrace_module_loaded(modctl_t *ctl) return; } - (void) taskq_dispatch(dtrace_taskq, - (task_func_t *)dtrace_enabling_matchall, NULL, TQ_SLEEP); + (void)taskq_dispatch(dtrace_taskq, + (task_func_t *)dtrace_enabling_matchall_task, NULL, TQ_SLEEP); mutex_exit(&dtrace_lock); From nobody Mon Feb 24 16:10:31 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1m141JTSz5pPck; Mon, 24 Feb 2025 16:10: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1m140gCWz471P; Mon, 24 Feb 2025 16:10:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740413432; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LhX193wRd3cD/0tvvxeDFCuR3h+AQsAOpMLANf+SBho=; b=J+UJERClX4PhmWn8GFx0hOb23qZzO8iJSRjDPyYaYYVkoe/3SYVauzorEWCJQALep8gwzK fzuqLLqrXEyP51vQLWNO2Zn6GEPlpoRxxv7dxmBrgSr8wTyUaX97lk2CI6DAqvDdDlSMR1 geI3acZtvHWGZNXi1f4jUEVcaSTJWjCVgrOfH8HBuJyLz9PPDk//n0fWS64cuu6b8UzBb7 R74x1cqS0HfUfvI2DvcxKsv50Q8TRLzLk1t8MW6zDMGn7Uu2YMuMU3v0w4he3Av90ZIw/5 Bu9XhMsjfZ1QhdQPNUPImVBpSZ32MBiwTpf9zu5jOBTEuFtblADLSu1RgFAITQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740413432; a=rsa-sha256; cv=none; b=Odc1kScyCqYihXbilKNyesuPp9KAy/k4alcH7KknLTExsr65tXrC7jEcJ+N0ue7Vg6GcLa J5ve5yC8Tloxan9vwi2iP0biykQr9z2q4+PC1dfT9f4SJehwUj8zIyz3utMFOXaDm9+bV7 id4w66CmCyEyK6vUPo8VJlXVQkoqV4kEVyjtg4CL1phuegemqOPYFLJnORehg6Mr1TWYqo IuTm4QCRuwfyviZ5rN5Z519mARc+LktWRJQpmA34hV4uwxmlN0NNR1i1qBqoogenlZCm9U xf9QACok/QXF4X2sbDPRQfxnsw/iWTwCgGtAkXPOtsewYHq6Y9VllpPeWAUSiQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740413432; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LhX193wRd3cD/0tvvxeDFCuR3h+AQsAOpMLANf+SBho=; b=OzmwfCQXpjmYqNVnGVhEFbLkGB45cVYDl21Z2EnEmJvzk8yHcuDAo2yOVU/adqs8jpRfJg 6GMtDzJW63EBcuxwYx3SQgdV3/h12uEfZbuPHT4Jqq9iNTDrmhpwJdGus0zMsNlPdrXxt6 45Qg2RrwG2Fi0aPHCe/W8zM+TUS/o/AzhkvctM3IolhI2OIWkgpAz2e6CmuLrJc3qIaKOd D4dtjBQdI+x21fNCpii3ha8r6ZDVvD/ptgyWeqBCsiMfMkc4chK6JpLA/rMooTJamh4qef FN3XStjpFv+KPoVW+M2CE8oWg/tZ9V0cmP2NGwFpqBK0hvwT0A1whwEE2WlD6w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z1m136phpznpX; Mon, 24 Feb 2025 16:10:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51OGAV8n049975; Mon, 24 Feb 2025 16:10:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51OGAVD7049972; Mon, 24 Feb 2025 16:10:31 GMT (envelope-from git) Date: Mon, 24 Feb 2025 16:10:31 GMT Message-Id: <202502241610.51OGAVD7049972@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: f510c5b2135b - main - netinet: fix build List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f510c5b2135b7ec1dad8329413b83766646cc7e0 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=f510c5b2135b7ec1dad8329413b83766646cc7e0 commit f510c5b2135b7ec1dad8329413b83766646cc7e0 Author: Gleb Smirnoff AuthorDate: 2025-02-24 16:08:54 +0000 Commit: Gleb Smirnoff CommitDate: 2025-02-24 16:08:54 +0000 netinet: fix build Fixes: 3b281d1421a78b588c5fc4182009ce62d8823d95 --- sys/netinet/in.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/in.h b/sys/netinet/in.h index fa710af7cd58..e42422341ada 100644 --- a/sys/netinet/in.h +++ b/sys/netinet/in.h @@ -689,8 +689,8 @@ void in_ifdetach(struct ifnet *); static inline bool in_broadcast(struct in_addr in) { - return (in.s_addr == htonl(INADDR_BROADCAST) || - in.s_addr == htonl(INADDR_ANY)); + return (in.s_addr == __htonl(INADDR_BROADCAST) || + in.s_addr == __htonl(INADDR_ANY)); } #define in_hosteq(s, t) ((s).s_addr == (t).s_addr) From nobody Mon Feb 24 16:14:15 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1m5N1HQZz5pQ4c; Mon, 24 Feb 2025 16: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1m5M70gHz48lW; Mon, 24 Feb 2025 16:14:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740413656; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lQsBwGukloxHvjnQ6v5yqdURUnkOMUyp2lp5NGPRhu8=; b=mht9Zoy/8Jxr9YBHkmhXdAb7TtRxUC4SOx1ygI8wZm/UtUxajXX+AtFyA7S5rvj0B405KL ObkaoONwt9GL19zQB0JU4OOuW2Lv9F+AgghvYvioXhzsNhxbmLOw7HCMnRkj4CE/MLKFDS WFl0qitpZvMW7seCvCxLT3gxbRYi8Eq/sZSi1XR+QetmUa0bMXGt2VXdhhqQgqZl6VCAcz 5baRD2NXH+JNXJ5Nxu6dFLQ5yFM6yX6VC/6gvwE+wOqhTh+EcPqflEWRKLLvArpAokvKqU Pq+LMZpgPGdJ8vNRcu7n0C7XyrFBEB11kHYNK/s8mQpIzIg411JiZjNYH3XJJA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740413656; a=rsa-sha256; cv=none; b=dh0GFVHxKid6s0RLc4EVhQcvH7NRngQjxA7V+Q6/1SsFob4CHGB78dfW01BUHcz7TzU/93 4cifaKXZ3hCCcCafFXB0KySVFpPDcJV9vvLpdGJIrFwKcNLzdRjTom2HBqcMrXsiCSA8U1 sUaogNUtR2N/YVDqgeBouJrrP/UfC8Voq7ENRS3OGbUXp8zHkztMufevTRCXgIBfnE0ICu 1JtDMqXVvSwEeSMOsmwXs9o1pbSbdLhuJ/56CoL4w2OBmKL+VTWM5gCj3Mgk9QfsOsI7db vPy469ZzlaugFPepeSzp5y8Sflc6EfPZqfVjNwhmlmLkx0fAXJP/7cFbj1aSOw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740413656; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lQsBwGukloxHvjnQ6v5yqdURUnkOMUyp2lp5NGPRhu8=; b=LKW1DstJlnZhr356PYc+ygxcNmJmfOnrxhAvc2FFCJQUVwigDJdIv2o8xGZdTkIiHJHivW HfvNdkLqRmWcAxS7jtTs9Smp2B8kGVanfsN/zF6n7xexAVfA1kN97+9CTaIYsQDsJuqGJK 2z+wbgWhkmCvAEveZkA9MI8lhcAN1nHt1iuUn0MhpAemmwMcOs2O0ascmfzzlz2grICrdR eIeOjn/rWG5mBCw2Tw6VxPaFDeOmns1TBzgDVRPl395wxI/6h4Y2TrpKLQY8j5tFvlpmpJ KuZr8VtUQ8OEiUzmF3amVHhojvsb7EGcsVEUKLhrXrHBi41LH7debMMF/DqUNA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z1m5M69f4zp44; Mon, 24 Feb 2025 16:14:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51OGEFsR058240; Mon, 24 Feb 2025 16:14:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51OGEFYf058237; Mon, 24 Feb 2025 16:14:15 GMT (envelope-from git) Date: Mon, 24 Feb 2025 16:14:15 GMT Message-Id: <202502241614.51OGEFYf058237@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Ziaee Subject: git: 26eeda7bd656 - main - safexel manuals: Improve apropos and HW relnotes List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 26eeda7bd65603cdc6ff764349f55416b9766b43 Auto-Submitted: auto-generated The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=26eeda7bd65603cdc6ff764349f55416b9766b43 commit 26eeda7bd65603cdc6ff764349f55416b9766b43 Author: Alexander Ziaee AuthorDate: 2024-11-22 17:45:36 +0000 Commit: Alexander Ziaee CommitDate: 2025-02-24 16:13:38 +0000 safexel manuals: Improve apropos and HW relnotes safe.4: Improve document description (Nd) for apropos. Remove Nm from sysctls in synopsis. This was causing this page to get pulled into results for `apropos sysctl`. Instead, use kernel declaration macros like vt(4). Convert the HARDWARE tagged list to a column list for better rendering in HW Relnotes. Tested in man(1) at MANWIDTH 59 and 80. safexcel.4: Nd: s/security packet/cryptographic offload/ for apropos. HARDWARE: Create this section for inclusion in the HW relnotes. SPDX: both tagged MFC after: 3 days MFC to: 13.5 Reported by: markj (cryptographic offload, Inside Secure) Reviewed by: jhb, markj, mhorne Accepted by: markj (src), mhorne (mentor) Differential Revision: https://reviews.freebsd.org/D47706 --- share/man/man4/safe.4 | 34 +++++++++++++++++++--------------- share/man/man4/safexcel.4 | 13 ++++++++++--- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/share/man/man4/safe.4 b/share/man/man4/safe.4 index 61f2041ff333..89375d058bf7 100644 --- a/share/man/man4/safe.4 +++ b/share/man/man4/safe.4 @@ -1,4 +1,6 @@ -.\"- +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 2003 Sam Leffler, Errno Consulting .\" All rights reserved. .\" @@ -22,13 +24,13 @@ .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. -.\"/ -.Dd July 29, 2020 +.\" +.Dd November 22, 2024 .Dt SAFE 4 .Os .Sh NAME .Nm safe -.Nd SafeNet crypto accelerator +.Nd SafeNet SafeXcel 1141/1741 crypto accelerator .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -46,11 +48,15 @@ module at boot time, place the following line in safe_load="YES" .Ed .Pp -.Nm sysctl Va hw.safe.debug -.Nm sysctl Va hw.safe.dump -.Nm sysctl Va hw.safe.rnginterval -.Nm sysctl Va hw.safe.rngbufsize -.Nm sysctl Va hw.safe.rngmaxalarm +In +.Xr sysctl.conf 5 : +.Bd -ragged -offset indent +.Cd hw.safe.debug +.Cd hw.safe.dump +.Cd hw.safe.rnginterval +.Cd hw.safe.rngbufsize +.Cd hw.safe.rngmaxalarm +.Ed .Sh DESCRIPTION The .Nm @@ -106,15 +112,13 @@ to dump the hardware interrupt registers. .Sh HARDWARE The .Nm -driver supports cards containing any of the following chips: -.Bl -tag -width "SafeNet 1141" -offset indent -.It SafeNet 1141 -The original chipset. +driver supports the following SafeXcel chips: +.Bl -column "SafeNet 1141" "The original chipset. Supports" -offset indent +.It SafeNet 1141 Ta The original chipset. Supports DES, Triple-DES, AES, MD5, and SHA-1 symmetric crypto operations, RNG, public key operations, and full IPsec packet processing. -.It SafeNet 1741 -A faster version of the 1141. +.It SafeNet 1741 Ta A faster version of the 1141. .El .Sh SEE ALSO .Xr crypt 3 , diff --git a/share/man/man4/safexcel.4 b/share/man/man4/safexcel.4 index d5e079822ecc..e14eebe40da2 100644 --- a/share/man/man4/safexcel.4 +++ b/share/man/man4/safexcel.4 @@ -1,4 +1,6 @@ -.\"- +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 2020 Rubicon Communications, LLC (Netgate) .\" .\" Redistribution and use in source and binary forms, with or without @@ -22,12 +24,12 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 29, 2020 +.Dd November 22, 2024 .Dt SAFEXCEL 4 .Os .Sh NAME .Nm safexcel -.Nd Inside Secure SafeXcel-IP-97 security packet engine +.Nd Inside Secure SafeXcel-IP-97 cryptographic offload engine .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -69,6 +71,11 @@ AES-CCM .Nm also implements SHA1 and SHA2 transforms, and can combine AES-CBC and AES-CTR with SHA1-HMAC and SHA2-HMAC for encrypt-then-authenticate operations. +.Sh HARDWARE +The +.Nm +driver supports the cryptographic acceleration functions of the +Inside Secure EIP-97 device found on some Marvell systems-on-chip. .Sh SEE ALSO .Xr crypto 4 , .Xr ipsec 4 , From nobody Mon Feb 24 16:20:32 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1mDc5yhzz5pQdM; Mon, 24 Feb 2025 16:20: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1mDc4Xy9z3FZD; Mon, 24 Feb 2025 16:20:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740414032; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XpavRXfchEUAqDwOMPSE0F8R8sWVsRQ8eeRC3uzTTMM=; b=IVMi4LWjH9c1Yvk37hncGsDBx2PSYx5RpnYSdutcq3QBlIcY4xSKt3aZSmlUnzNEO/g6UO Gkf9k5gAwHvwlM6VWvjzC0BllGfbbhhmp5e7k2nMq7PhhAaN2qRyV+y6NQSYUk/KrM4W6o ARqPrxOSc6GpM9YdVOdLem4ON/xLE0j95R/U2jXUPpQB8pdPHsQV9tJD8yP0GUXT7cE53d R2tT1SNnIll7kV5iR0DgYGJrpXbllkC4nawU7WheETr8oB6iMrCDc7pDC8VCN2iz3ao8rt neHwmgYHxg4Snm+a/9kwa43YUuGgVX1rv1jji9mcqM+lVukE848Pte6dhhGZ5g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740414032; a=rsa-sha256; cv=none; b=li9YLcd/dQt8nZ/RjzV2aE1eWsPszWIAfYiktwcNr8r8qd/rxPm5DchI78iCnq+Y/wqqAp 3cFn+U5IDQuWdhXY1IvlHJ9/wPtEoAihqkh8l7dZcO5Kw1MTkgoNiSdzrENXabbnkRBpEe yFUrRZSjIyjZbcm09GfC7hjgJTM3nHwyfahZBtugvOQzy+P6mNA0/TLr5XDy8E/yvbsEa3 ZnOkFCOGmJz/YkB/3mMhxlg86nZdFCPEO5UeKIVCpcSeROSdwmG5BIXjILC24BcnvX+/W7 30pCr8VWUzSMuKcx5AQ1gHD3KX/QoRgW1NStLvm9h2pfC5BaRym/juPBdpioIw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740414032; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XpavRXfchEUAqDwOMPSE0F8R8sWVsRQ8eeRC3uzTTMM=; b=IhBdtGmYjOigZjXvUbTQ00palvkWoqEBzL8UhUkOevsgqGUGjHmlk+6g5EtnIOMiXs8LlR EZ3q4+UmEXUGYLqBOGFYgYhqvQKJZhHXYjF6k01MEsIwALZH8+UDi5cyc2mynS6zdSRi3F slPKH8WcRfLL7kAbsY9FTcNeWQAP6+KcLPAkjcwkO6lIJhGoDzr1sHUvQtyb5jSA55cUTN 87R7wBvKYHcIwBr62pyKTbLVxqAg6dGjVAkaDablFf+JxK3prf3IFNZep/mMMHi1J0WWr2 KbgTo8US9pgaK/d7QdegaBwo378S+njznJwAMqAInq5qBvxOwOQgWtigCsQImQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z1mDc43rlzp6R; Mon, 24 Feb 2025 16:20:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51OGKWU8068743; Mon, 24 Feb 2025 16:20:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51OGKW6e068740; Mon, 24 Feb 2025 16:20:32 GMT (envelope-from git) Date: Mon, 24 Feb 2025 16:20:32 GMT Message-Id: <202502241620.51OGKW6e068740@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Ziaee Subject: git: f4727eca4057 - main - sh.1: document optional arguments to `:` List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f4727eca405763dd1feb4ca3e17be40c2da337de Auto-Submitted: auto-generated The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=f4727eca405763dd1feb4ca3e17be40c2da337de commit f4727eca405763dd1feb4ca3e17be40c2da337de Author: Alexander Ziaee AuthorDate: 2025-01-09 17:51:57 +0000 Commit: Alexander Ziaee CommitDate: 2025-02-24 16:19:22 +0000 sh.1: document optional arguments to `:` TIL the `:` command accepts and discards arguments, and this is occasionally used to embed comments in interesting places. While here, fix another `...` argument that was not marked up. MFC after: 3 days Thanks: Community Discord Approved by: carlavilla, mhorne (mentors) Differential Revision: https://reviews.freebsd.org/D48398 --- bin/sh/sh.1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/sh/sh.1 b/bin/sh/sh.1 index a34f7676fffa..3d3f200a8e17 100644 --- a/bin/sh/sh.1 +++ b/bin/sh/sh.1 @@ -31,7 +31,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd November 20, 2024 +.Dd January 10, 2025 .Dt SH 1 .Os .Sh NAME @@ -1945,8 +1945,9 @@ make it the first or last character listed. .Ss Built-in Commands This section lists the built-in commands. .Bl -tag -width indent -.It Ic \&: +.It Ic \&: Op Ar arg Ar ... A null command that returns a 0 (true) exit value. +Any arguments are discarded. .It Ic \&. Ar file The commands in the specified file are read and executed by the shell. The @@ -1968,7 +1969,7 @@ it is sought in the current working directory. .It Ic \&[ A built-in equivalent of .Xr test 1 . -.It Ic alias Oo Ar name Ns Oo = Ns Ar string Oc ... Oc +.It Ic alias Oo Ar name Ns Oo = Ns Ar string Oc Ar ... Oc If .Ar name Ns = Ns Ar string is specified, the shell defines the alias From nobody Mon Feb 24 17:32:02 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1nq61WTQz5pXgl; Mon, 24 Feb 2025 17:32: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1nq610PZz3qY2; Mon, 24 Feb 2025 17:32:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740418322; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uWUA2CSGjSXgEhW6n7Gljc+G2PO5Dzkk0iz3Xb/r2nI=; b=xZTf1OhdmMEQgS6Z0rlOzScQzW+15ZBbQU7188PyI+N9wHmwzrXl3eJxnyJLAVE2nEdD4T ft6pl8g+1qJcLxR9s20KRDv58pZRvBMOywAAIHbKgmmtdHDD6ZlqygPDwcF5wDqozZ4RPG 9FgxUoGvdj/TFwZwTwRu2WRHVAjXczCso+5Ko8k8C3nbmFq7RMc8oeaV8caxkhVyMasNcP rfTAenxRbnG1vxkXjyahhZyKM6GJhZGn+t3gr1Aw2FPyuxKXpsnf73wyURULpmR8lE45NO oIhjgTBg+JHk374ISawL/E8gmDOgZWDxZCv9C9JjQQC09IW0nQvJXe5GHTdCMQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740418322; a=rsa-sha256; cv=none; b=aN713MA+C2WBFyBLx17tn6RtIUoaX6043Nm4mpIF7EM/3YIlC99nYl1YVKoS0CQx4haCOj zjWntLgl3FQ7lrGz8Z1F2xFBowicDOpSQROUuigMIaL9edc3w0p+Xh+SOSirK0YwhyFCGU 4DWu1fwJ/YTsKmnBgqlie2cdD/J3B/J+KagagSr2TCKhO+AMjnAuXuCz04ER7liLH9k08e wHLpMG9qQ7iTQj9YOvdYvnxPfpUWzhltB2WIynnsiNxen4yBVTfVidZNrWRkKDaVZ051by XNifjBqx6j9G0svYQiI+q7t71aVVfSTG6DScyPz/jfWeHtQdNgFpqpUsMZJeUA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740418322; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uWUA2CSGjSXgEhW6n7Gljc+G2PO5Dzkk0iz3Xb/r2nI=; b=ropX4PHws5uJXy0ee3jzJPjnbkqbRznqY+Lou10NkeTXesU3fCp2NYLjuN4aAqUGRdMIRo jpcS+KGnH75pnVbtdPvxeoUjGvkCHZZBu6bNMhXFKLresc0KkgcFk8rGCUe0N4cUfSPpoB cdMvCtyBGKQrCZV3l1W6BUss4DQnKTxH3q0mhgxRtqbve3xruSsA0Hh5GeAaZ0GNYjJC5P Eyb8VNi5oQwu+N3hv/r8Ke9k+Oul+bl8NPPcWPX3xtnBCO1pRncVZ3hKYlh7B9p+ji7qkN YekbNG1J1XjwEy7TTHlre/FKpm1c4rmacDTJxQlJmwpYDEjT1AIiK5epg7++TA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z1nq60Vn0zq81; Mon, 24 Feb 2025 17:32:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51OHW2OT002744; Mon, 24 Feb 2025 17:32:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51OHW25t002741; Mon, 24 Feb 2025 17:32:02 GMT (envelope-from git) Date: Mon, 24 Feb 2025 17:32:02 GMT Message-Id: <202502241732.51OHW25t002741@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Ziaee Subject: git: 5a0d9605a44b - main - bridge.4: Remove incorrect line + polish List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a0d9605a44bf39402211e009365f1043faa2b0b Auto-Submitted: auto-generated The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=5a0d9605a44bf39402211e009365f1043faa2b0b commit 5a0d9605a44bf39402211e009365f1043faa2b0b Author: Alexander Ziaee AuthorDate: 2025-02-24 17:28:51 +0000 Commit: Alexander Ziaee CommitDate: 2025-02-24 17:30:53 +0000 bridge.4: Remove incorrect line + polish In an AMA on Community Discord, it was revealed that simply setting a bridge to up is not equivelant to setting it as "inet6 auto_linklocal". Remove the incorrect line, and while here: + reset sysctl list width to indent, saving 2/13 lines on MANWIDTH 59/80 + tag spdx + break two long lines over 80 characters MFC after: 3 days Reported by: Antranig Vartanian Reported by: Jan Bramkamp Reported by: Niclas Approved by: mhorne (mentor) Differential Revision: https://reviews.freebsd.org/D48981 --- share/man/man4/bridge.4 | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/share/man/man4/bridge.4 b/share/man/man4/bridge.4 index 31a0ce43a263..b741ec0b73c8 100644 --- a/share/man/man4/bridge.4 +++ b/share/man/man4/bridge.4 @@ -1,3 +1,6 @@ +.\" +.\" SPDX-License-Identifier: BSD-4-Clause +.\" .\" $NetBSD: bridge.4,v 1.5 2004/01/31 20:14:11 jdc Exp $ .\" .\" Copyright 2001 Wasabi Systems, Inc. @@ -33,7 +36,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd April 10, 2023 +.Dd April 10, 2024 .Dt IF_BRIDGE 4 .Os .Sh NAME @@ -125,7 +128,8 @@ variable to .Li 0 . .Pp -All the bridged member interfaces need to be up in order to pass network traffic. +All the bridged member interfaces need to be up +in order to pass network traffic. These can be enabled using .Xr ifconfig 8 or @@ -165,11 +169,6 @@ variable configures an IPv6 link-local address on .Li bridge0 interface: .Bd -literal -offset indent -ifconfig_bridge0_ipv6="up" -.Ed -.Pp -or in a more explicit manner: -.Bd -literal -offset indent ifconfig_bridge0_ipv6="inet6 auto_linklocal" .Ed .Pp @@ -261,7 +260,7 @@ the appropriate interfaces. Either stage can be disabled. The filtering behavior can be controlled using .Xr sysctl 8 : -.Bl -tag -width ".Va net.link.bridge.pfil_onlyip" +.Bl -tag -width indent .It Va net.link.bridge.pfil_onlyip Controls the handling of non-IP packets which are not passed to .Xr pfil 9 . @@ -470,8 +469,8 @@ ifconfig_fxp0="up" .Ed .Pp Consider a system with two 4-port Ethernet boards. -The following will cause a bridge consisting of all 8 ports with Rapid Spanning -Tree enabled to be created: +The following will cause a bridge consisting of all 8 ports with +Rapid Spanning Tree enabled to be created: .Bd -literal -offset indent ifconfig bridge0 create ifconfig bridge0 \e From nobody Mon Feb 24 17:35:01 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1ntZ2x7rz5pXTj; Mon, 24 Feb 2025 17:35: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1ntY6TS3z3rFl; Mon, 24 Feb 2025 17:35:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740418501; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Jljqb6mLF4U79GZD/wpmP5lUm8ormDOadt+XfSiHC1o=; b=Z4uzi3CwB+Nvvp7QuUNbv2FTzXPZ8iJAeGxzo2SsPtPf2eYd3vYtGEd0y8YS9B3HiK4Zgy 85SksYj9Ggkc0/XS09wIXZNHsp1h+sb4oSfCwNsUl1oWK9CyqXbfluGTznlpR8OCUBkH4d ceBB5d8w+5R+ABeLoexYoid/Z360uropeBL8rTfx5mbM6ojnWGTX1oJ1aO1RK4xe50ov90 xbO+k/Hu72b/3bPIA3of2CK33mAeeCQbe2+OI2vo22OrY6UWDYCoQXX3VEcsDdg2EIMY+7 bFcbCUW67L+HMjUDEMLzFJdX1bsNieMmNpAEh7T+C4UOOIwpIY0n3w27Tb1rDQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740418501; a=rsa-sha256; cv=none; b=OWaH/mk5Y5OU9eH05q0BIw6Hg0JGfilITks6q135Nuf6TIqYC/H++jtQziAu1b5nPtZTmj N2E9FOQXL2PxfASbpC6UQHGf0BjbHVMTkqL83eR+aGhNiU+zaHW9jieNebM3PVNLaPC3yl LuGwhSOZ2I3I+55geVrYeFNWMHGpwwxerYwbd1oJ9JGPMGkS8y0rbCmJ6SllSSqUWOWa3k BbA7je451DVhWiAocPQCgHrKjkCR8kFOxbtCT/XOFEMFgO0Ndx+nDPUxk1OiNblktrE9PJ RfB8dEHHaX0QUd4+MuLccOfgMWqAdZ58MZ8lg7Tk09CC9nNjaX8Qav+MPcEvpw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740418501; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Jljqb6mLF4U79GZD/wpmP5lUm8ormDOadt+XfSiHC1o=; b=P+TZsdaFfY+P/wdLjIYRHQvpEPPNSs4tQTd4CXL9z9HutrKnqURZXWXTt0bm0K6Byj+/GH ldTpKURlHVGtrkZ9sx7O96YtHywGPsP1BdEdcOKfahHeTaKGwyBhzUc9Oq3Jsj8PRZtr0Z 4VDGbzGdJ5hfxet7DoSNrjanyI8e1MKpxlTgLcptCdlUMB1fYZUGODvucO2t5ym17iTyfy r3LPp64zWkc9iMJ2BMR0fqYXal/wbn3iFVI4jFHuOq4J32spIvCS7D0HbsyqmaBVNRODgh Bida87GBVDl7tzvNl6jgkX1vxgEQmlND44edwv3+3YKmEvSDBV47t0NeOJ1Dhg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z1ntY5vY4zqpd; Mon, 24 Feb 2025 17:35:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51OHZ1B3008794; Mon, 24 Feb 2025 17:35:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51OHZ1OQ008791; Mon, 24 Feb 2025 17:35:01 GMT (envelope-from git) Date: Mon, 24 Feb 2025 17:35:01 GMT Message-Id: <202502241735.51OHZ1OQ008791@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Ziaee Subject: git: 7c3c8605d62f - main - recv.2: Improve style in RETURN VALUES List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7c3c8605d62f5d27a5228a3787aae6e573f77d59 Auto-Submitted: auto-generated The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=7c3c8605d62f5d27a5228a3787aae6e573f77d59 commit 7c3c8605d62f5d27a5228a3787aae6e573f77d59 Author: Alexander Ziaee AuthorDate: 2025-02-24 17:33:24 +0000 Commit: Alexander Ziaee CommitDate: 2025-02-24 17:33:38 +0000 recv.2: Improve style in RETURN VALUES Reported by: des MFC after: 3 days Fixes: 571df2c64a3c1 (Explain how recv functions can) Reviewed by: mhorne, des Approved by: mhorne (mentor) Differential Revision: https://reviews.freebsd.org/D48995 --- lib/libsys/recv.2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libsys/recv.2 b/lib/libsys/recv.2 index 9dc1f3cc84ca..f3ee60b75663 100644 --- a/lib/libsys/recv.2 +++ b/lib/libsys/recv.2 @@ -316,14 +316,14 @@ On data reception the .Fa msg_len field is updated to the length of the received message. .Sh RETURN VALUES -On successful completion, +On successful completion, the .Fn recv , .Fn recvfrom , and .Fn recvmsg -return the number of bytes received. +functions return the number of bytes received, while the .Fn recvmmsg -returns the number of messages received. +function returns the number of messages received. If no messages are available to be received and the peer has performed an orderly shutdown, 0 is returned. Otherwise, -1 is returned and From nobody Mon Feb 24 20:59:31 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1tQX1c96z5pspP; Mon, 24 Feb 2025 20:59: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1tQW728sz4Gtk; Mon, 24 Feb 2025 20:59:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740430772; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nth2TyyBl6A1GbFd0UKTYHtBLOKEjkV+a3UYpq1222c=; b=qI9oS6P2vzyS9IQeLoGLXXbqaouAgn7o5RW6a6x/BbP22k1+Y4znnrZwkwyuMkpLvM2/NG vo3dHvKheTPE+8J/90dJGd0APHUK1a0dllH/aU/OqmoPezoNpEmHaij1l3G7ZvTK08iVrs h8lvV3hKSmdXSoW42QB8jiXzRbLfdEsIxMdLOw4sPQU773Wp6hU6OVKN2G0YPx7/ej57tJ 6X4PO0yLr/4VkPfd2c0wgW8xS1fpWCICwVJL+5T1E5Anttub89+g1yBpzH1XPYn0iwtCOq 9pcSIraxIcOpQH49DKCTGVg2tXgT0fbP5IUeOTgW8ZoX7eixNH/5UtDxc3ukbQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740430772; a=rsa-sha256; cv=none; b=VBOJxgxuWLn9gWxiqmX/8ovu7Y7egR+Lh9CmD2lRXEXpqXBniqNOSEGt1YzgQ8fo+BMxq8 b+Sk1g9YP59r8t/1i/7ZX/5FeBqYoatEfqqycGw3j/uqR7jQrmWkxWgyuuGkZjpXGytiW8 JaSoN+vztKreGERTjkATQRkqMe85iFZexJ+5mdhH4ddpSZtrP7CAshUt0nmjpiEmERMGtX 5DAYaxs2gD+sd5kpnz12QzS2xOm2x1kcgFLECPS4CbMbnsInj6ZJtRz7dOZaLgLWMIywFl clVwfWJv1KSn0dhhgw1vzbQIZeRWXfFpqONSxZsDu6wlTg3c5tlVfwdHfLHnRA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740430772; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nth2TyyBl6A1GbFd0UKTYHtBLOKEjkV+a3UYpq1222c=; b=xURExbn+exS45FWqfkffEkY8qkKVxx91uThvZEQ8LV75oUtSJCcvJbqs1Od8YhHSt/6sAj R3HZIk2eydmgZq5wbAOtvRrUGC5Mx5e1Z5AzqFgIKqOlfMD2CnIccqmnuqHar6pg1aI9ct q+BJ6UbylRv3QsXz50Eb+3rKw/5PEFEK/uoo1hJwzBRqIJmtLg0dDl+wAhirVkOt4z0Koj voN0Mn6HZraRiBY6kNFnN6g7Hk1PSrtHFcPjysLwsW5AH5RxWVH7Saw8GlnGmAeHIRrcjY Z7x3EXg04WoVfurBQDP7xx60jMBBgEgYtj47Xkmndso9/n52wtgL5XJqYXNDdg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z1tQW6CKXzx01; Mon, 24 Feb 2025 20:59:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51OKxVgV083247; Mon, 24 Feb 2025 20:59:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51OKxVE9083244; Mon, 24 Feb 2025 20:59:31 GMT (envelope-from git) Date: Mon, 24 Feb 2025 20:59:31 GMT Message-Id: <202502242059.51OKxVE9083244@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: b616d997cb48 - main - nfscl: Fix setting of mtime for the NFSv4.n client List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b616d997cb48eaafe13069eecd95f0495b2358eb Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=b616d997cb48eaafe13069eecd95f0495b2358eb commit b616d997cb48eaafe13069eecd95f0495b2358eb Author: Rick Macklem AuthorDate: 2025-02-24 20:58:27 +0000 Commit: Rick Macklem CommitDate: 2025-02-24 20:58:27 +0000 nfscl: Fix setting of mtime for the NFSv4.n client It was reported on freebsd-fs@ that unrolling a tarball failed to set the correct modify time if delegations were being issued. This patch fixes the problem. This bug only affects NFSv4 mounts where delegations are being issued. Not running the nfscbd or disabling delegations on the NFSv4 server avoids the problem. Reported by: Peter Much Tested by: Peter Much MFC after: 3 days --- sys/fs/nfs/nfs_var.h | 2 +- sys/fs/nfsclient/nfs_clstate.c | 7 +++++-- sys/fs/nfsclient/nfs_clvnops.c | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index b48d853b285e..a95d9245c098 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -626,7 +626,7 @@ int nfscl_renamedeleg(vnode_t, nfsv4stateid_t *, int *, vnode_t, nfsv4stateid_t *, int *, NFSPROC_T *); void nfscl_reclaimnode(vnode_t); void nfscl_newnode(vnode_t); -void nfscl_delegmodtime(vnode_t); +void nfscl_delegmodtime(struct vnode *, struct timespec *); void nfscl_deleggetmodtime(vnode_t, struct timespec *); int nfscl_trydelegreturn(struct nfscldeleg *, struct ucred *, struct nfsmount *, NFSPROC_T *); diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 7d1aab753628..adfb68f5d8f5 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -5174,7 +5174,7 @@ nfscl_newnode(vnode_t vp) * to the local clock time. */ void -nfscl_delegmodtime(vnode_t vp) +nfscl_delegmodtime(struct vnode *vp, struct timespec *mtime) { struct nfsclclient *clp; struct nfscldeleg *dp; @@ -5198,7 +5198,10 @@ nfscl_delegmodtime(vnode_t vp) } dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); if (dp != NULL && (dp->nfsdl_flags & NFSCLDL_WRITE)) { - nanotime(&dp->nfsdl_modtime); + if (mtime != NULL) + dp->nfsdl_modtime = *mtime; + else + nanotime(&dp->nfsdl_modtime); dp->nfsdl_flags |= NFSCLDL_MODTIMESET; } NFSUNLOCKCLSTATE(); diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index bf24a161b94b..a0bb781e5e5d 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -1120,7 +1120,7 @@ nfs_setattr(struct vop_setattr_args *ap) * Call nfscl_delegmodtime() to set the modify time * locally, as required. */ - nfscl_delegmodtime(vp); + nfscl_delegmodtime(vp, NULL); } else NFSUNLOCKNODE(np); /* @@ -1158,6 +1158,8 @@ nfs_setattr(struct vop_setattr_args *ap) NFSUNLOCKNODE(np); } } + if (vap->va_mtime.tv_sec != VNOVAL && error == 0) + nfscl_delegmodtime(vp, &vap->va_mtime); return (error); } From nobody Mon Feb 24 21:35:09 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z1vCd4bxdz5nj0S; Mon, 24 Feb 2025 21:35:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z1vCd2vnqz3QQR; Mon, 24 Feb 2025 21:35:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740432909; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vn/pR57x1Xm10R4w3ySv/jKhVJOoLz2EEwXUhlIL/SI=; b=WOZq/otZVTgMBPcpvENt6xdcQLul+CkQ1q9XFL3uXE+fD58JAYaDRm9RlJVVGuPLl4JLZY 9xCK+7iEvNOGljGfOZqGp/hbVwGvftnzEVY/A4Fefk9EjMMuMMfjrDpqOs6IXelF+dEegM hKayCSnN6ucEdpv1zL5Qm1hqih+Y9eFVFBjlpomHlUCpHkICli7thHpO1lccQER5acDMAp UbvZ4xYr9qOnp3EJCw9adEgGLtHQQR1hb8zeRSdlUvGz8JE77hARDYwgTPgQZ/D26NbZKe V6yKkXjEDznPocJpjIUSbPW0JbLr/MKkYBbMmBL8LwRBfqBLJpwv2O7txDjLDA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740432909; a=rsa-sha256; cv=none; b=WJNqZkQRSGn37LuZBZrqsxO3MyupJlFrMDsySYAOhlrLCmOy+HtWo2YIlAVMuprP7Yc63p 37s2U6h2rXin1Nu7LIiimCp2fZus7ssrP7SWOwNEOujo4Zfm0TWVNCoXI7Y/y9qnjG3Mqc 43bJkTNoYWDSpurl+VSvfEjn/nJxrkiwO9SU8zUZOsq67qYUjDsdHCwlTioCKiyZXkAWAC mpKR/D11SCTMPe1hbcsGk6QRAcV9oUbz8xlTnWEo/yyK/5NmTVDYpNQqt0AucLO++6Fm/x faASBitN40SDRyC4rZ/pXJBJj+cjTjr2WgknIsrtn2EuwcfpoK9NkTMKM2cECQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740432909; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vn/pR57x1Xm10R4w3ySv/jKhVJOoLz2EEwXUhlIL/SI=; b=a8TlOGfUbyAVOMS4WaGxaE/fgkhxRv0ADGv6sjBXtwrIXp6wmu+EgxCZ0ujGiMCiJ0k2Ee jpHaNUjtd6W13EWAed/Xg2lTtEBdm5ByL5uzULs5Ms3uEMFFyvIuQN9YVEpf+S7BdLybYd OfeSabq5QwYqTFPmmbWsFN6UKnYr4n9+gurW0ZtefEP+CCXVGs+q2t1JPTL8DX3Agl2Zzm wD4pnNJE953kOnkpHG9BWGHSoqCORlIFbfpNAhqhtlpf6wOoZpPnRP8wGP/WGNZP13PYhp 8vU0OyLb6w3TgGRYrfrAkDfC1NLZPRGrMmktFfLzLlSIDPsqFnpBud1qaHGJ+Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z1vCd2LPBzy2y; Mon, 24 Feb 2025 21:35:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51OLZ9hr057371; Mon, 24 Feb 2025 21:35:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51OLZ9AS057368; Mon, 24 Feb 2025 21:35:09 GMT (envelope-from git) Date: Mon, 24 Feb 2025 21:35:09 GMT Message-Id: <202502242135.51OLZ9AS057368@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: b01495caac2e - main - umtx: Add a helper for unlocked umtxq_busy() calls List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b01495caac2eca73463f4a889936a19e4c1c5909 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b01495caac2eca73463f4a889936a19e4c1c5909 commit b01495caac2eca73463f4a889936a19e4c1c5909 Author: Mark Johnston AuthorDate: 2025-02-24 20:36:48 +0000 Commit: Mark Johnston CommitDate: 2025-02-24 21:34:51 +0000 umtx: Add a helper for unlocked umtxq_busy() calls This seems like a natural complement to umtxq_unbusy_unlocked(). No functional change intended. Reviewed by: olce, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D49124 --- sys/compat/linux/linux_futex.c | 12 +++--------- sys/kern/kern_umtx.c | 34 +++++++++++++++------------------- sys/sys/umtxvar.h | 1 + 3 files changed, 19 insertions(+), 28 deletions(-) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index ab2760859e16..37d0142bae8b 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -501,9 +501,7 @@ linux_futex_lock_pi(struct thread *td, bool try, struct linux_futex_args *args) if (error != 0) break; - umtxq_lock(&uq->uq_key); - umtxq_busy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_busy_unlocked(&uq->uq_key); /* * Set the contested bit so that a release in user space knows @@ -642,9 +640,7 @@ linux_futex_wakeop(struct thread *td, struct linux_futex_args *args) umtx_key_release(&key); return (error); } - umtxq_lock(&key); - umtxq_busy(&key); - umtxq_unlock(&key); + umtxq_busy_unlocked(&key); error = futex_atomic_op(td, args->val3, args->uaddr2, &op_ret); umtxq_lock(&key); umtxq_unbusy(&key); @@ -701,9 +697,7 @@ linux_futex_requeue(struct thread *td, struct linux_futex_args *args) umtx_key_release(&key); return (error); } - umtxq_lock(&key); - umtxq_busy(&key); - umtxq_unlock(&key); + umtxq_busy_unlocked(&key); error = fueword32(args->uaddr, &uval); if (error != 0) error = EFAULT; diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index f9189024d629..dc6fee1f8f38 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -441,9 +441,16 @@ umtxq_unbusy(struct umtx_key *key) } void -umtxq_unbusy_unlocked(struct umtx_key *key) +umtxq_busy_unlocked(struct umtx_key *key) { + umtxq_lock(key); + umtxq_busy(key); + umtxq_unlock(key); +} +void +umtxq_unbusy_unlocked(struct umtx_key *key) +{ umtxq_lock(key); umtxq_unbusy(key); umtxq_unlock(key); @@ -2372,9 +2379,7 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32_t flags, if (error != 0) break; - umtxq_lock(&uq->uq_key); - umtxq_busy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_busy_unlocked(&uq->uq_key); /* * Set the contested bit so that a release in user space @@ -2540,9 +2545,7 @@ do_lock_pp(struct thread *td, struct umutex *m, uint32_t flags, su = (priv_check(td, PRIV_SCHED_RTPRIO) == 0); for (;;) { old_inherited_pri = uq->uq_inherited_pri; - umtxq_lock(&uq->uq_key); - umtxq_busy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_busy_unlocked(&uq->uq_key); rv = fueword32(&m->m_ceilings[0], &ceiling); if (rv == -1) { @@ -2727,9 +2730,8 @@ do_unlock_pp(struct thread *td, struct umutex *m, uint32_t flags, bool rb) TYPE_PP_ROBUST_UMUTEX : TYPE_PP_UMUTEX, GET_SHARE(flags), &key)) != 0) return (error); - umtxq_lock(&key); - umtxq_busy(&key); - umtxq_unlock(&key); + umtxq_busy_unlocked(&key); + /* * For priority protected mutex, always set unlocked state * to UMUTEX_CONTESTED, so that userland always enters kernel @@ -2792,9 +2794,7 @@ do_set_ceiling(struct thread *td, struct umutex *m, uint32_t ceiling, &uq->uq_key)) != 0) return (error); for (;;) { - umtxq_lock(&uq->uq_key); - umtxq_busy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_busy_unlocked(&uq->uq_key); rv = fueword32(&m->m_ceilings[0], &save_ceiling); if (rv == -1) { @@ -3148,9 +3148,7 @@ do_rw_rdlock(struct thread *td, struct urwlock *rwlock, long fflag, break; /* grab monitor lock */ - umtxq_lock(&uq->uq_key); - umtxq_busy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_busy_unlocked(&uq->uq_key); /* * re-read the state, in case it changed between the try-lock above @@ -3341,9 +3339,7 @@ do_rw_wrlock(struct thread *td, struct urwlock *rwlock, struct _umtx_time *timeo } /* grab monitor lock */ - umtxq_lock(&uq->uq_key); - umtxq_busy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_busy_unlocked(&uq->uq_key); /* * Re-read the state, in case it changed between the diff --git a/sys/sys/umtxvar.h b/sys/sys/umtxvar.h index 647ee2a4650c..6165d37d9195 100644 --- a/sys/sys/umtxvar.h +++ b/sys/sys/umtxvar.h @@ -206,6 +206,7 @@ int umtx_key_get(const void *, int, int, struct umtx_key *); void umtx_key_release(struct umtx_key *); struct umtx_q *umtxq_alloc(void); void umtxq_busy(struct umtx_key *); +void umtxq_busy_unlocked(struct umtx_key *); int umtxq_count(struct umtx_key *); void umtxq_free(struct umtx_q *); struct umtxq_chain *umtxq_getchain(struct umtx_key *); From nobody Tue Feb 25 04:04:26 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z23rp5sMZz5pNSb; Tue, 25 Feb 2025 04:04:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z23rp5Jbxz41tw; Tue, 25 Feb 2025 04:04:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740456266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mDSDM/V/wO3EsZLMPOWz4giiaK1VXI6ZEFeKjBpnIx8=; b=U9zelaQ7i3XLwK4JXLtEjoiCIW6ttgiu/q4gl0F5iN0oP71kjNGpUytg1bTOS5+sOsFLFt RNEBOaSF9WCWE8zaTncF+fD6JY7sSlVYiQfupo+IT2Kens/drMhjrCIz0D10Y3+T03PGuA U9N8/3yXgTotSIpP+v1MbWMAKO89V94iARAx1+wQG6VtU3IkmVMSoTJsbjNQxk3jLKFSBe rQv5bVRwVXObbhB7DYueFcSwj3v9TEsOfQuKdiOrxQkaCEcZ01D+2A4e/MJVqzL77ZjMVM AAoxwx6F7e2b+mwULe47MU9lTQzD8ERoU/Yi4eEbFcNW3uPTfChBBbG3uO52Nw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740456266; a=rsa-sha256; cv=none; b=jV+LoeYMRDOG1giJ4kX3vXXOBLchw6GSD1uIPAvwS+MrSEnm3wZ4As7VHLKMJ27cd93QRb LKd5LQ0k7bxHRhNGQ4VXfyFPhOf3Uj+59N3hxwm9DGy7ZFuLYtq5Qy+Hk6cjDhvbbISDlY OFqYoJxXweT00ASo3uknlNaFbIVzvucRMvt8bopfECnMp9A9FfSMR1cQ4YpzskC45vEOqE 9pGKxGwGscG+bcyAJ0tUo2rCM//6WOuGetOpAO0g469AqzedD5QHk6cf5NKovENX9dQ9iH BEgI2bWDCxU+Zqqey0UItvpQ/IJ5khBtwxuQ2FLG7dqWVva84E6K9Eug7hFQnQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740456266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mDSDM/V/wO3EsZLMPOWz4giiaK1VXI6ZEFeKjBpnIx8=; b=cBxvEGpHve1yR6/ejLqab9npmcR+45SU2sgSBYN4Uj1Hzb+OW7ruvdHwxiLyFPly90M+jg +YZLS7GebbVJ0TUIqVsbUdnG2DPCglHwNqfFd4CaPPouHw9uZSEU9CjiWm6s8EghnnHC6s kxGjqN6NwdQyTqXnJFfhiVVJgEFJJOII/fSh9yxddPm3+gN5khgV/rZeIsuvXZdIICqBvp KKcMHd7VoaPVnm94EvxJEK/J9GdcblbqMebVarbjGBI0m5QpT+hAPwJfWXbIr+83kJNnde RiKuYBSO3hfkEGClQPbU+NkMFl8KF/P5/4yo5YOIafm+Q2sPuEXI/BH/b71P+g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z23rp4mWrz18r6; Tue, 25 Feb 2025 04:04:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51P44QeU091677; Tue, 25 Feb 2025 04:04:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51P44Qdi091674; Tue, 25 Feb 2025 04:04:26 GMT (envelope-from git) Date: Tue, 25 Feb 2025 04:04:26 GMT Message-Id: <202502250404.51P44Qdi091674@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Ziaee Subject: git: b3de60980210 - main - style: Recomend SPDX licenses List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b3de609802104234dca7449fc2b4f4106098d41b Auto-Submitted: auto-generated The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=b3de609802104234dca7449fc2b4f4106098d41b commit b3de609802104234dca7449fc2b4f4106098d41b Author: Alexander Ziaee AuthorDate: 2025-02-25 03:48:12 +0000 Commit: Alexander Ziaee CommitDate: 2025-02-25 03:48:24 +0000 style: Recomend SPDX licenses While here, take this opportunity to update the copyright and clean some mdoc errors. MFC after: 3 days Reviewed by: carlavilla, mhorne, imp Approved by: imp (srcmgr) Approved by: carlavilla, mhorne (mentors) Differential Revision: https://reviews.freebsd.org/D49051 --- share/man/man9/style.9 | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/share/man/man9/style.9 b/share/man/man9/style.9 index 0e766840c9ee..5542a9685c46 100644 --- a/share/man/man9/style.9 +++ b/share/man/man9/style.9 @@ -1,5 +1,5 @@ -.\"- -.\" Copyright (c) 1995-2022 The FreeBSD Project +.\" +.\" Copyright (c) 1995-2025 The FreeBSD Project .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -22,12 +22,12 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 3, 2024 +.Dd February 18, 2025 .Dt STYLE 9 .Os .Sh NAME .Nm style -.Nd "kernel source file style guide" +.Nd kernel source file style guide .Sh DESCRIPTION This file specifies the preferred style for kernel source files in the .Fx @@ -59,34 +59,24 @@ is silent on an issue. * them so they look like real paragraphs. */ .Ed +.Pp C++ comments may be used in C and C++ code. Single-line comments should be consistently either C or C++ within a file. Multi-line comments should also be consistently either C or C++, but may differ from single-line comments. .Pp -The copyright header should be a multi-line comment, with the first -line of the comment having a dash after the star like so: +The copyright header should be a multi-line comment like so: .Bd -literal -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 1984-2025 John Q. Public * - * Long, boring license goes here, but trimmed for brevity + * SPDX-License-Identifier: BSD-2-Clause */ .Ed .Pp -An automatic script collects license information from the tree for -all comments that start in the first column with -.Dq Li "/*-" . -If you desire to flag -.Xr indent 1 -to not reformat a comment that starts in the first column which is not a -license or copyright notice, change the dash to a star for those -comments. Comments starting in columns other than the first are never considered license statements. -Use the appropriate SPDX-License-Identifier line before the copyright. +Write the copyright lines before the appropriate SPDX-License-Identifier. If the copyright assertion contains the phrase .Dq Li "All Rights Reserved" that should be on the same line as the word @@ -132,11 +122,11 @@ Only add in front of foreign VCS IDs if the file is renamed. Add .Dq Li "From: " -and FreeBSD git hash with full path name if the file was derived -from another FreeBSD file and include relevant copyright info -from the original file. -.Bd -literal -.Ed +and the +.Fx +git hash with full path name if the file was derived from another +.Fx +file and include relevant copyright info from the original file. .Pp Leave one blank line before the header files. .Pp @@ -923,7 +913,8 @@ When using branch prediction hints, atypical error conditions should use (document the exceptions). Operations that almost always succeed use .Fn __predict_true . -Only use the annotation for the entire if statement, rather than individual clauses. +Only use the annotation for the entire if statement, +rather than individual clauses. Do not add these annotations without empirical evidence of the likelihood of the branch. .Sh FILES From nobody Tue Feb 25 07:20:18 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z28Bp3NRYz5pCLK; Tue, 25 Feb 2025 07:20: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z28Bp35mcz3C5q; Tue, 25 Feb 2025 07:20:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740468018; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+AS9LMx1ko8P3g7YHAfb8ajV/SuOLeOtsyACVGlZD0E=; b=fNRIgobgsS/XmCswGnfOWHiBObgqwUDBIwmPJSIDMiENgN6zwN60HHtm/La4N10UrEcl1o SVth//4xapiqcxUTfxowSB6vrfiz2zeI+QaTHv9rvA7esaISOqPqwBwZL51mNkLA8P8kP2 lg8DYVSbywrzUvMyziPaG92SxHMg3ehNsFpr6r04NfHyjO3M2/u+BBKrs/3VxevBSIDEyv u72LsMC2Ijku5daOTeJdu42+KlZ73096lVmq4IgaZ3K11TDC4Itf9b26DbDfSxNuoPj9nD NcLIATKh2iKUapKSFbfWYgkT0GPfrB6My8SJcFKnc2D3Q7GgaZl6vOUkRBdB8w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740468018; a=rsa-sha256; cv=none; b=wFtjZ/8dObWBKr+7Ok2M8WsSL6KRpWPLkCkrOsavQl5CAojRoSat8OkUSVZc6YHNAqt8iY 8J/02VOvOR3horFoOZjeqIuEllk22f2Kz1vEuP2TBvR72fATth/ndyXAIVQfifKw+5fc8x MfK3BoElbZuPAcib/Q5/OocWnP1Qq40DarhhPD1ryXyaoUIeGWGYz6YLMg+WZX/XuTAhwT /kQtdKYKgZS61fYdQ8jwETRqw6126iht2/YSiKqw9Lo6BjFdofeOY1EAuX59h+rIQ1ijsY edbHqs6gkAN8kTaP4sjdsERFJnZgdsAgAZZdptVNejNKbRuRdEDt8tuQM3GdJw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740468018; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+AS9LMx1ko8P3g7YHAfb8ajV/SuOLeOtsyACVGlZD0E=; b=kTbaZTlt1IrqX5Ean0QCPSxerQ7HkJ/H2HBLqW8q9EXxJ1z+kxY6rwMD9jiOHhG8zzVOis /FxtYfV7D6OVAtBPVctJBBv0EGfvYIseiRSbDyMok9B9Lv9rHyBMrAHQ7J3WGo/HrD4wn8 cIj72lKfgp71uYbh2Y5pgC+tMqL7OZnMeeCBGddn9YKn0GgMEa1X4FuFbj/GDUhO/eNF7a 8s4gi+5qnuPImDY/Zjnb2TVKnUHBEypXomJoe0zxgJOXd2cMYwlhAKtJG/pQpya30QfE8Y aRgwY4mFLGRs11iXcIRK7OzcmaG94X5lgfcucrrUjci+adKawkzZjkiJWj0kqg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z28Bp2csTz21f; Tue, 25 Feb 2025 07:20:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51P7KI6K056018; Tue, 25 Feb 2025 07:20:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51P7KIP4056015; Tue, 25 Feb 2025 07:20:18 GMT (envelope-from git) Date: Tue, 25 Feb 2025 07:20:18 GMT Message-Id: <202502250720.51P7KIP4056015@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: d40daefca647 - main - libc/gen: split user-visible opendir()-like functions into separate source files List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d40daefca64750c1076822bdbd3c409a9519f513 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d40daefca64750c1076822bdbd3c409a9519f513 commit d40daefca64750c1076822bdbd3c409a9519f513 Author: Konstantin Belousov AuthorDate: 2025-02-20 23:32:22 +0000 Commit: Konstantin Belousov CommitDate: 2025-02-25 07:09:29 +0000 libc/gen: split user-visible opendir()-like functions into separate source files This allows, for instance, to interpose opendir() with an implementation that calls into fdopendir(), without causing multiple symbol definitions when libc is linked in statically. This is aligned with the quality of implementation principle that single object file from a static library should not provide more than one app-visible symbol. [The copyright for fopendir() was copied, it might be refined by the author] Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D49089 --- lib/libc/gen/Makefile.inc | 2 + lib/libc/gen/fdopendir.c | 56 ++++++ lib/libc/gen/opendir.c | 312 +---------------------------- lib/libc/gen/opendir2.c | 340 ++++++++++++++++++++++++++++++++ lib/libc/gen/telldir.h | 1 + libexec/rtld-elf/rtld-libc/Makefile.inc | 2 +- 6 files changed, 401 insertions(+), 312 deletions(-) diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index 42a359ccfb72..9b92e52cdfad 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -50,6 +50,7 @@ SRCS+= \ exec.c \ exect.c \ fdevname.c \ + fdopendir.c \ feature_present.c \ fmtcheck.c \ fmtmsg.c \ @@ -106,6 +107,7 @@ SRCS+= \ nlist.c \ nrand48.c \ opendir.c \ + opendir2.c \ pause.c \ pmadvise.c \ popen.c \ diff --git a/lib/libc/gen/fdopendir.c b/lib/libc/gen/fdopendir.c new file mode 100644 index 000000000000..67c0766b6d83 --- /dev/null +++ b/lib/libc/gen/fdopendir.c @@ -0,0 +1,56 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the 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 "namespace.h" +#include + +#include +#include +#include +#include +#include +#include +#include "un-namespace.h" + +#include "gen-private.h" +#include "telldir.h" + +/* + * Open a directory with existing file descriptor. + */ +DIR * +fdopendir(int fd) +{ + + if (_fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) + return (NULL); + return (__opendir_common(fd, DTF_HIDEW | DTF_NODUP, true)); +} diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c index a47725578c33..956c92c321e8 100644 --- a/lib/libc/gen/opendir.c +++ b/lib/libc/gen/opendir.c @@ -43,8 +43,6 @@ #include "gen-private.h" #include "telldir.h" -static DIR * __opendir_common(int, int, bool); - /* * Open a directory. */ @@ -52,313 +50,5 @@ DIR * opendir(const char *name) { - return (__opendir2(name, DTF_HIDEW|DTF_NODUP)); -} - -/* - * Open a directory with existing file descriptor. - */ -DIR * -fdopendir(int fd) -{ - - if (_fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) - return (NULL); - return (__opendir_common(fd, DTF_HIDEW|DTF_NODUP, true)); -} - -DIR * -__opendir2(const char *name, int flags) -{ - int fd; - DIR *dir; - int saved_errno; - - if ((flags & (__DTF_READALL | __DTF_SKIPREAD)) != 0) - return (NULL); - if ((fd = _open(name, - O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC)) == -1) - return (NULL); - - dir = __opendir_common(fd, flags, false); - if (dir == NULL) { - saved_errno = errno; - _close(fd); - errno = saved_errno; - } - return (dir); -} - -static int -opendir_compar(const void *p1, const void *p2) -{ - - return (strcmp((*(const struct dirent * const *)p1)->d_name, - (*(const struct dirent * const *)p2)->d_name)); -} - -/* - * For a directory at the top of a unionfs stack, the entire directory's - * contents are read and cached locally until the next call to rewinddir(). - * For the fdopendir() case, the initial seek position must be preserved. - * For rewinddir(), the full directory should always be re-read from the - * beginning. - * - * If an error occurs, the existing buffer and state of 'dirp' is left - * unchanged. - */ -bool -_filldir(DIR *dirp, bool use_current_pos) -{ - struct dirent **dpv; - char *buf, *ddptr, *ddeptr; - off_t pos; - int fd2, incr, len, n, saved_errno, space; - - len = 0; - space = 0; - buf = NULL; - ddptr = NULL; - - /* - * Use the system page size if that is a multiple of DIRBLKSIZ. - * Hopefully this can be a big win someday by allowing page - * trades to user space to be done by _getdirentries(). - */ - incr = getpagesize(); - if ((incr % DIRBLKSIZ) != 0) - incr = DIRBLKSIZ; - - /* - * The strategy here is to read all the directory - * entries into a buffer, sort the buffer, and - * remove duplicate entries by setting the inode - * number to zero. - * - * We reopen the directory because _getdirentries() - * on a MNT_UNION mount modifies the open directory, - * making it refer to the lower directory after the - * upper directory's entries are exhausted. - * This would otherwise break software that uses - * the directory descriptor for fchdir or *at - * functions, such as fts.c. - */ - if ((fd2 = _openat(dirp->dd_fd, ".", O_RDONLY | O_CLOEXEC)) == -1) - return (false); - - if (use_current_pos) { - pos = lseek(dirp->dd_fd, 0, SEEK_CUR); - if (pos == -1 || lseek(fd2, pos, SEEK_SET) == -1) { - saved_errno = errno; - _close(fd2); - errno = saved_errno; - return (false); - } - } - - do { - /* - * Always make at least DIRBLKSIZ bytes - * available to _getdirentries - */ - if (space < DIRBLKSIZ) { - space += incr; - len += incr; - buf = reallocf(buf, len); - if (buf == NULL) { - saved_errno = errno; - _close(fd2); - errno = saved_errno; - return (false); - } - ddptr = buf + (len - space); - } - - n = _getdirentries(fd2, ddptr, space, &dirp->dd_seek); - if (n > 0) { - ddptr += n; - space -= n; - } - if (n < 0) { - saved_errno = errno; - _close(fd2); - errno = saved_errno; - return (false); - } - } while (n > 0); - _close(fd2); - - ddeptr = ddptr; - - /* - * There is now a buffer full of (possibly) duplicate - * names. - */ - dirp->dd_buf = buf; - - /* - * Go round this loop twice... - * - * Scan through the buffer, counting entries. - * On the second pass, save pointers to each one. - * Then sort the pointers and remove duplicate names. - */ - for (dpv = NULL;;) { - n = 0; - ddptr = buf; - while (ddptr < ddeptr) { - struct dirent *dp; - - dp = (struct dirent *) ddptr; - if ((long)dp & 03L) - break; - if ((dp->d_reclen <= 0) || - (dp->d_reclen > (ddeptr + 1 - ddptr))) - break; - ddptr += dp->d_reclen; - if (dp->d_fileno) { - if (dpv) - dpv[n] = dp; - n++; - } - } - - if (dpv) { - struct dirent *xp; - - /* - * This sort must be stable. - */ - mergesort(dpv, n, sizeof(*dpv), opendir_compar); - - dpv[n] = NULL; - xp = NULL; - - /* - * Scan through the buffer in sort order, - * zapping the inode number of any - * duplicate names. - */ - for (n = 0; dpv[n]; n++) { - struct dirent *dp = dpv[n]; - - if ((xp == NULL) || - strcmp(dp->d_name, xp->d_name)) { - xp = dp; - } else { - dp->d_fileno = 0; - } - if (dp->d_type == DT_WHT && - (dirp->dd_flags & DTF_HIDEW)) - dp->d_fileno = 0; - } - - free(dpv); - break; - } else { - dpv = malloc((n+1) * sizeof(struct dirent *)); - if (dpv == NULL) - break; - } - } - - dirp->dd_len = len; - dirp->dd_size = ddptr - dirp->dd_buf; - return (true); -} - -static bool -is_unionstack(int fd) -{ - int unionstack; - - unionstack = _fcntl(fd, F_ISUNIONSTACK, 0); - if (unionstack != -1) - return (unionstack); - - /* - * Should not happen unless running on a kernel without the op, - * but no use rendering the system useless in such a case. - */ - return (0); -} - -/* - * Common routine for opendir(3), __opendir2(3) and fdopendir(3). - */ -static DIR * -__opendir_common(int fd, int flags, bool use_current_pos) -{ - DIR *dirp; - int incr; - int saved_errno; - bool unionstack; - - if ((dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL) - return (NULL); - - dirp->dd_buf = NULL; - dirp->dd_fd = fd; - dirp->dd_flags = flags; - dirp->dd_loc = 0; - dirp->dd_lock = NULL; - dirp->dd_td = (struct _telldir *)((char *)dirp + sizeof(DIR)); - LIST_INIT(&dirp->dd_td->td_locq); - dirp->dd_td->td_loccnt = 0; - dirp->dd_compat_de = NULL; - - /* - * Use the system page size if that is a multiple of DIRBLKSIZ. - * Hopefully this can be a big win someday by allowing page - * trades to user space to be done by _getdirentries(). - */ - incr = getpagesize(); - if ((incr % DIRBLKSIZ) != 0) - incr = DIRBLKSIZ; - - /* - * Determine whether this directory is the top of a union stack. - */ - unionstack = false; - if (flags & DTF_NODUP) { - unionstack = is_unionstack(fd); - } - - if (unionstack) { - if (!_filldir(dirp, use_current_pos)) - goto fail; - dirp->dd_flags |= __DTF_READALL; - } else { - dirp->dd_len = incr; - dirp->dd_buf = malloc(dirp->dd_len); - if (dirp->dd_buf == NULL) - goto fail; - if (use_current_pos) { - /* - * Read the first batch of directory entries - * to prime dd_seek. This also checks if the - * fd passed to fdopendir() is a directory. - */ - dirp->dd_size = _getdirentries(dirp->dd_fd, - dirp->dd_buf, dirp->dd_len, &dirp->dd_seek); - if (dirp->dd_size < 0) { - if (errno == EINVAL) - errno = ENOTDIR; - goto fail; - } - dirp->dd_flags |= __DTF_SKIPREAD; - } else { - dirp->dd_size = 0; - dirp->dd_seek = 0; - } - } - - return (dirp); - -fail: - saved_errno = errno; - free(dirp->dd_buf); - free(dirp); - errno = saved_errno; - return (NULL); + return (__opendir2(name, DTF_HIDEW | DTF_NODUP)); } diff --git a/lib/libc/gen/opendir2.c b/lib/libc/gen/opendir2.c new file mode 100644 index 000000000000..30a9030693e4 --- /dev/null +++ b/lib/libc/gen/opendir2.c @@ -0,0 +1,340 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the 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 "namespace.h" +#include + +#include +#include +#include +#include +#include +#include +#include "un-namespace.h" + +#include "gen-private.h" +#include "telldir.h" + +DIR * +__opendir2(const char *name, int flags) +{ + int fd; + DIR *dir; + int saved_errno; + + if ((flags & (__DTF_READALL | __DTF_SKIPREAD)) != 0) + return (NULL); + if ((fd = _open(name, + O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC)) == -1) + return (NULL); + + dir = __opendir_common(fd, flags, false); + if (dir == NULL) { + saved_errno = errno; + _close(fd); + errno = saved_errno; + } + return (dir); +} + +static int +opendir_compar(const void *p1, const void *p2) +{ + + return (strcmp((*(const struct dirent * const *)p1)->d_name, + (*(const struct dirent * const *)p2)->d_name)); +} + +/* + * For a directory at the top of a unionfs stack, the entire directory's + * contents are read and cached locally until the next call to rewinddir(). + * For the fdopendir() case, the initial seek position must be preserved. + * For rewinddir(), the full directory should always be re-read from the + * beginning. + * + * If an error occurs, the existing buffer and state of 'dirp' is left + * unchanged. + */ +bool +_filldir(DIR *dirp, bool use_current_pos) +{ + struct dirent **dpv; + char *buf, *ddptr, *ddeptr; + off_t pos; + int fd2, incr, len, n, saved_errno, space; + + len = 0; + space = 0; + buf = NULL; + ddptr = NULL; + + /* + * Use the system page size if that is a multiple of DIRBLKSIZ. + * Hopefully this can be a big win someday by allowing page + * trades to user space to be done by _getdirentries(). + */ + incr = getpagesize(); + if ((incr % DIRBLKSIZ) != 0) + incr = DIRBLKSIZ; + + /* + * The strategy here is to read all the directory + * entries into a buffer, sort the buffer, and + * remove duplicate entries by setting the inode + * number to zero. + * + * We reopen the directory because _getdirentries() + * on a MNT_UNION mount modifies the open directory, + * making it refer to the lower directory after the + * upper directory's entries are exhausted. + * This would otherwise break software that uses + * the directory descriptor for fchdir or *at + * functions, such as fts.c. + */ + if ((fd2 = _openat(dirp->dd_fd, ".", O_RDONLY | O_CLOEXEC)) == -1) + return (false); + + if (use_current_pos) { + pos = lseek(dirp->dd_fd, 0, SEEK_CUR); + if (pos == -1 || lseek(fd2, pos, SEEK_SET) == -1) { + saved_errno = errno; + _close(fd2); + errno = saved_errno; + return (false); + } + } + + do { + /* + * Always make at least DIRBLKSIZ bytes + * available to _getdirentries + */ + if (space < DIRBLKSIZ) { + space += incr; + len += incr; + buf = reallocf(buf, len); + if (buf == NULL) { + saved_errno = errno; + _close(fd2); + errno = saved_errno; + return (false); + } + ddptr = buf + (len - space); + } + + n = _getdirentries(fd2, ddptr, space, &dirp->dd_seek); + if (n > 0) { + ddptr += n; + space -= n; + } + if (n < 0) { + saved_errno = errno; + _close(fd2); + errno = saved_errno; + return (false); + } + } while (n > 0); + _close(fd2); + + ddeptr = ddptr; + + /* + * There is now a buffer full of (possibly) duplicate + * names. + */ + dirp->dd_buf = buf; + + /* + * Go round this loop twice... + * + * Scan through the buffer, counting entries. + * On the second pass, save pointers to each one. + * Then sort the pointers and remove duplicate names. + */ + for (dpv = NULL;;) { + n = 0; + ddptr = buf; + while (ddptr < ddeptr) { + struct dirent *dp; + + dp = (struct dirent *) ddptr; + if ((long)dp & 03L) + break; + if ((dp->d_reclen <= 0) || + (dp->d_reclen > (ddeptr + 1 - ddptr))) + break; + ddptr += dp->d_reclen; + if (dp->d_fileno) { + if (dpv) + dpv[n] = dp; + n++; + } + } + + if (dpv) { + struct dirent *xp; + + /* + * This sort must be stable. + */ + mergesort(dpv, n, sizeof(*dpv), opendir_compar); + + dpv[n] = NULL; + xp = NULL; + + /* + * Scan through the buffer in sort order, + * zapping the inode number of any + * duplicate names. + */ + for (n = 0; dpv[n]; n++) { + struct dirent *dp = dpv[n]; + + if ((xp == NULL) || + strcmp(dp->d_name, xp->d_name)) { + xp = dp; + } else { + dp->d_fileno = 0; + } + if (dp->d_type == DT_WHT && + (dirp->dd_flags & DTF_HIDEW)) + dp->d_fileno = 0; + } + + free(dpv); + break; + } else { + dpv = malloc((n+1) * sizeof(struct dirent *)); + if (dpv == NULL) + break; + } + } + + dirp->dd_len = len; + dirp->dd_size = ddptr - dirp->dd_buf; + return (true); +} + +static bool +is_unionstack(int fd) +{ + int unionstack; + + unionstack = _fcntl(fd, F_ISUNIONSTACK, 0); + if (unionstack != -1) + return (unionstack); + + /* + * Should not happen unless running on a kernel without the op, + * but no use rendering the system useless in such a case. + */ + return (0); +} + +/* + * Common routine for opendir(3), __opendir2(3) and fdopendir(3). + */ +DIR * +__opendir_common(int fd, int flags, bool use_current_pos) +{ + DIR *dirp; + int incr; + int saved_errno; + bool unionstack; + + if ((dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL) + return (NULL); + + dirp->dd_buf = NULL; + dirp->dd_fd = fd; + dirp->dd_flags = flags; + dirp->dd_loc = 0; + dirp->dd_lock = NULL; + dirp->dd_td = (struct _telldir *)((char *)dirp + sizeof(DIR)); + LIST_INIT(&dirp->dd_td->td_locq); + dirp->dd_td->td_loccnt = 0; + dirp->dd_compat_de = NULL; + + /* + * Use the system page size if that is a multiple of DIRBLKSIZ. + * Hopefully this can be a big win someday by allowing page + * trades to user space to be done by _getdirentries(). + */ + incr = getpagesize(); + if ((incr % DIRBLKSIZ) != 0) + incr = DIRBLKSIZ; + + /* + * Determine whether this directory is the top of a union stack. + */ + unionstack = false; + if (flags & DTF_NODUP) { + unionstack = is_unionstack(fd); + } + + if (unionstack) { + if (!_filldir(dirp, use_current_pos)) + goto fail; + dirp->dd_flags |= __DTF_READALL; + } else { + dirp->dd_len = incr; + dirp->dd_buf = malloc(dirp->dd_len); + if (dirp->dd_buf == NULL) + goto fail; + if (use_current_pos) { + /* + * Read the first batch of directory entries + * to prime dd_seek. This also checks if the + * fd passed to fdopendir() is a directory. + */ + dirp->dd_size = _getdirentries(dirp->dd_fd, + dirp->dd_buf, dirp->dd_len, &dirp->dd_seek); + if (dirp->dd_size < 0) { + if (errno == EINVAL) + errno = ENOTDIR; + goto fail; + } + dirp->dd_flags |= __DTF_SKIPREAD; + } else { + dirp->dd_size = 0; + dirp->dd_seek = 0; + } + } + + return (dirp); + +fail: + saved_errno = errno; + free(dirp->dd_buf); + free(dirp); + errno = saved_errno; + return (NULL); +} diff --git a/lib/libc/gen/telldir.h b/lib/libc/gen/telldir.h index aafa6ac71b1e..6d113491e819 100644 --- a/lib/libc/gen/telldir.h +++ b/lib/libc/gen/telldir.h @@ -103,6 +103,7 @@ struct dirent *_readdir_unlocked(DIR *, int); void _reclaim_telldir(DIR *); void _seekdir(DIR *, long); void _fixtelldir(DIR *dirp, long oldseek, long oldloc); +DIR *__opendir_common(int, int, bool); #define RDU_SKIP 0x0001 #define RDU_SHORT 0x0002 diff --git a/libexec/rtld-elf/rtld-libc/Makefile.inc b/libexec/rtld-elf/rtld-libc/Makefile.inc index 14f31f05829d..79d68a1e803c 100644 --- a/libexec/rtld-elf/rtld-libc/Makefile.inc +++ b/libexec/rtld-elf/rtld-libc/Makefile.inc @@ -17,7 +17,7 @@ CFLAGS+= -I${SRCTOP}/libexec/rtld-elf/rtld-libc # redirects all calls to interposed functions to use the non-interposed version # instead. .PATH: ${LIBC_SRCTOP}/gen -SRCS+= opendir.c closedir.c readdir.c telldir.c +SRCS+= fdopendir.c opendir.c opendir2.c closedir.c readdir.c telldir.c # Avoid further dependencies by providing simple implementations of libc # functions such as __error(), etc. From nobody Tue Feb 25 07:20:19 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z28Bq4ZT8z5pD1l; Tue, 25 Feb 2025 07:20: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z28Bq3YFWz3CKl; Tue, 25 Feb 2025 07:20:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740468019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=U7daj8XbgpAjqDm9py65RIOYB//TbaJcbYXNCNEV6wY=; b=appdcqChe/SnDr3A/TPviU+SO+ZppvXOWp9EenOWXBYaapq9xXyFFI2L9iQXnrqTx93zhw dh77Wxzf/Be6F1Irer8DKJKR45BxCkLZGgsfwTIqmHP3cvtyaD1Od3ZCshCCXu9fwF7gsb QaSeOabKDSNVIBOdeK0Fl/FqWaDnDLBR6om9jRuiHZh7xXXdNNd4HoZLrrjQt1VY3zBkFX WLL+QV3R6wmpoxirhYOvMU1eqmEb5HeQv511yVDnKPCqqbJHEQqJgOG/g0/bxIeCO/gxn/ sOEFPklH/JmjEf52jG+hyB4dADnNhliZ7WnzEStJNFig0YSQzJSIjh02bTDNeg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740468019; a=rsa-sha256; cv=none; b=kzLBs6pKA98UMfIOX3yutdybQLNTOJsWX1/KK6497mvTJotCmNZWgkUwOuC5ZKRpGlrroy PhPtnVxZR3UDGLZnlluKMZ/lRHmDkalDqSAKk8+el5FvAM4Vy6IDxZ9yiQJDJ7OVgDBm1T JzBPcQbGi73QcuXkcvtevSUgwIe8QU/UWJYxk/dwV95fEelIqWXtYw5USWx7629GV8oJIf RGHnNetCUPIZOiOiM1A15tRZH6DM8Wv8UgnF/fOaD2QBM54/W66IcFPljIc8UIw5TDY9vO WggvXkKHUfgznMxLuOBqIjl26NjVcZqr/Wn/E/TrASG3ysHw0Yl3Az+iW/Dytg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740468019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=U7daj8XbgpAjqDm9py65RIOYB//TbaJcbYXNCNEV6wY=; b=Wt7MKDMVO5nzKkNYYUBPl3GILVPsdzD/oiPPfLQQZx2SImlRoqWYZer+sQUl/q6Nqg2IVA 8WR34eE6mVzD2SKYO37ed2MMESBXpv9Eid3i0gc+3KLgMkF1giDHpAyM9/osZyWqYzqwA8 jwJ5tKlKpP3oQn/o6KMdtm5M40LNdf57psuWRBxqcvvUHoNmQPBJXRXEQJU914JqdsgLYH rX60ximZizLDviBIeIRFOhaipqAzZOIhJJwgX5pBWl1m9Aemct8YCL7UbDqBlf+UTQZW2j kycO8ynm4h97Bq/PT4RaIjN0wUeentAy/7kHfJbpxU3ZnBngjLT+8XPkFHOOKA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z28Bq38h8z2C2; Tue, 25 Feb 2025 07:20:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51P7KJL3056051; Tue, 25 Feb 2025 07:20:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51P7KJkI056048; Tue, 25 Feb 2025 07:20:19 GMT (envelope-from git) Date: Tue, 25 Feb 2025 07:20:19 GMT Message-Id: <202502250720.51P7KJkI056048@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: e59991206b14 - main - fts(3): be less strict when automount does its job under us walking autofs mount List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e59991206b1463b7e85cc8aafde7f1dc03fcedcf Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e59991206b1463b7e85cc8aafde7f1dc03fcedcf commit e59991206b1463b7e85cc8aafde7f1dc03fcedcf Author: Konstantin Belousov AuthorDate: 2025-02-21 13:07:43 +0000 Commit: Konstantin Belousov CommitDate: 2025-02-25 07:09:29 +0000 fts(3): be less strict when automount does its job under us walking autofs mount Namely, allow the file id change if the resulting file belongs to automounted filesystem. If it is, remember the updated id. This allows the ids from the automounted volumes to change without restrictions, might be a further refinement would be to only allow such inconsistency once. PR: 284914 Reported and tested by: Lexi Winter Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D49094 --- lib/libc/gen/fts.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c index 770a7b2cc322..bd193c7c6cfc 100644 --- a/lib/libc/gen/fts.c +++ b/lib/libc/gen/fts.c @@ -1132,6 +1132,7 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char *path) { int ret, oerrno, newfd; struct stat sb; + struct statfs sf; newfd = fd; if (ISSET(FTS_NOCHDIR)) @@ -1144,9 +1145,15 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char *path) goto bail; } if (p->fts_dev != sb.st_dev || p->fts_ino != sb.st_ino) { - errno = ENOENT; /* disinformation */ - ret = -1; - goto bail; + if (_fstatfs(newfd, &sf) != 0 || + (sf.f_flags & MNT_AUTOMOUNTED) == 0) { + errno = ENOENT; /* disinformation */ + ret = -1; + goto bail; + } + /* autofs might did the mount under us, accept. */ + p->fts_dev = sb.st_dev; + p->fts_ino == sb.st_ino; } ret = fchdir(newfd); bail: From nobody Tue Feb 25 07:22:58 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z28Ft5TWkz5pDMD; Tue, 25 Feb 2025 07:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z28Ft1h4gz3GGg; Tue, 25 Feb 2025 07:22:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740468178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=T4GKiYFoasKe40Vfg9pq2mVKrl88Yg3bgkCgnNjLv5I=; b=yrl4amxX1cPULjgFYIoeJJl/mswmo4q8UFcWveM9u+ovnNLTNaRPgaeHZcc9odqsRXpjSQ CJF8l88EH5QVoV+3Zyndq1MHAr8Y9ym6nRp24sILNq+KyHtTyREgYrhcMjVNoXe9dWfIgH obh2Bnpw5/T/5x6KDucirpeZ2A1yOkWY1kiZsLW4n8ILZNylwsqhCGhg1xj75yF04CSiKe CLVS94mh0+MVHdmPqP5zP9Mkxr8ClbaGOEutSWwutIXNjLisB1/EC1CYBk6KgIQYEPp61n xj5IWur3+KrgFWpgeYoeoIfdp4h97jLTzlywd/Y9vS3xKWkuCJy9jc2iN7BwIA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740468178; a=rsa-sha256; cv=none; b=U0A9y/9ECPmKyNFPjpRyLypbeJQ/viu59Txpoa4WfOHGJD9GnB2H5cCT77kkvr5kR9aja6 tKfDyOPF4Wks8NaHC+a8ASqaUd7vb2RsIJV1yIHzPXh5C2Fdzonds9dc2IRCTWiHnLfsxo MWcq+gIG25icGPzrzg0jDizZnEds2Fek3nu/dJ/hoRssC1yUwjWb3YU1OfW7Ew1Wf0zYdv xDluw0uxKdqhf/sOcq4JWSMTKdnGA8PXA5DNQlOu/RqiR6H5ebCXtG6t1yoZa1xCz5YSDM Nsp0ksuksGxsfJax7el8yBScDEPaPVqN1B+ZkwTxVKdy5u45FxYgJNvLm8aBcA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740468178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=T4GKiYFoasKe40Vfg9pq2mVKrl88Yg3bgkCgnNjLv5I=; b=ICsPj5BPunEGoPqxeWK0mliPltQKfDA+eGKqMIWWpw3C1/DYpvulAgPksq+ZNr+a3AEK1R JDuqJGWt1cx8Ey1YyFyYuwSbAv/Xiog4pWtblCV2i8lfCuVe/lPn4LeJyeb/MUVP2m1O8Z CHJwwLuMLPCmDIFGFoxaco/hWQk7o3BPe5CHtB5jJmFOyou6KOcKMcAg43fQ+co9p/eygd rjraE0RAwHrpdRFbLhoiDsz8gOBVZOgPVMFCqeyDsLAYQXhfcLi2T5v3vMPQJGdiHw7w57 xP2LOUadBZD/IrV9CuQohyqXG4LJkFR3OdtZ3rMyCo1Vt8PnvjWGWRPliPIMsw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z28Ft12pJz1Rc; Tue, 25 Feb 2025 07:22:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51P7MwvB064436; Tue, 25 Feb 2025 07:22:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51P7Mwnr064433; Tue, 25 Feb 2025 07:22:58 GMT (envelope-from git) Date: Tue, 25 Feb 2025 07:22:58 GMT Message-Id: <202502250722.51P7Mwnr064433@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eugene Grosbein Subject: git: 93b4a5445658 - main - netgraph: prevent panic with INVARIANTS-enabled kernel List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 93b4a54456589e78dcd37f2db8333baff3f3f0b2 Auto-Submitted: auto-generated The branch main has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=93b4a54456589e78dcd37f2db8333baff3f3f0b2 commit 93b4a54456589e78dcd37f2db8333baff3f3f0b2 Author: Eugene Grosbein AuthorDate: 2025-02-25 07:18:29 +0000 Commit: Eugene Grosbein CommitDate: 2025-02-25 07:22:53 +0000 netgraph: prevent panic with INVARIANTS-enabled kernel This change makes NG_ABI_VERSION depend on INVARIANTS in addition to NETGRAPH_DEBUG. PR: 257876 MFC-after: 2 weeks --- sys/netgraph/netgraph.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/sys/netgraph/netgraph.h b/sys/netgraph/netgraph.h index e83f61d3f60b..10db352e0fa2 100644 --- a/sys/netgraph/netgraph.h +++ b/sys/netgraph/netgraph.h @@ -69,11 +69,20 @@ * modules. */ #define _NG_ABI_VERSION 12 -#ifdef NETGRAPH_DEBUG /*----------------------------------------------*/ -#define NG_ABI_VERSION (_NG_ABI_VERSION + 0x10000) -#else /* NETGRAPH_DEBUG */ /*----------------------------------------------*/ -#define NG_ABI_VERSION _NG_ABI_VERSION -#endif /* NETGRAPH_DEBUG */ /*----------------------------------------------*/ + +#ifdef NETGRAPH_DEBUG +#define _NG_ABI_PREFIX1 0x10000 +#else +#define _NG_ABI_PREFIX1 0 +#endif + +#ifdef INVARIANTS +#define _NG_ABI_PREFIX2 0x20000 +#else +#define _NG_ABI_PREFIX2 0 +#endif + +#define NG_ABI_VERSION (_NG_ABI_PREFIX1 + _NG_ABI_PREFIX2 + _NG_ABI_VERSION) /* * Forward references for the basic structures so we can From nobody Tue Feb 25 07:59:47 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z294X2JZHz5pHkg; Tue, 25 Feb 2025 07:59:56 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z294X1g7Gz3jgG; Tue, 25 Feb 2025 07:59:56 +0000 (UTC) (envelope-from zlei@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740470396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mSEx2eb3TXQUSLjSzZ5tA+jkdfYsRKYHQy/PRC5AKC8=; b=CS8LX4ZpqJi5CdRr2AJcZYnIW7CeB11/OuR399HkSXavD3dCADk8K8b9Y1lso2AyxPuZS1 +lldBg54siIXB1vHlah7VCIhU9U26zc/L/UOOs5for0aTd5KpVU5bWASoIfHiJzzUs3Ygi pKof+eqJt5i08YKAkVenq3oxZHvG9myo5CYw1cX/dPCzV5VlpUEc3/Ad6ninGE5twd7J+Q uEFOKgspp98r3qgKy+f+0nhFeCbCQTwmFsq2l/3X4tNoB4soroKSL8yndNlBq2zdBAR/SC ndACKZNgttQ110Ay7Bc5s8Cza4QsQ0l32oQhKu+dCRG0tgmnpnzpJWGdX2sGTQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740470396; a=rsa-sha256; cv=none; b=QgyoM0rB2gxxX/iyR51ONHoPEKPTVf4w85Lo+1Zk2FJoTKfP0btd4rIJiXOWSJZqUEQEAH uK3dMoiqUibns/mCQUod1mukOYLd8BLHCLz+4I0m+p1hvGzWxfJNWFqGLBaK7m6Zt3aDbi MAOCoiBTMwTbM6x895MTCp9bGh6QcmeMlhc1lnVmf2aMFZu5k7w3jjqYz8OX5ybvM/W8PC SmVtPl4SV52O5Gr9iLtimrti6JLAcn5omw01/B+qfuN6FBDVQZhbM0PlOQb+ssb2qtm1Wx 6Ox9p/n8llR8z623uWJmMhYFrRcCKVH8GRglz8W7BBuTla2GPj9HPppirHBKEA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740470396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mSEx2eb3TXQUSLjSzZ5tA+jkdfYsRKYHQy/PRC5AKC8=; b=MGsv+58Lla1ijBu+EbLfKzanfmRFfVeFqHGvM/hFLbeYDG31BSE/uoRTNU60hBWZwZDbWH nMzpUv78aoohOhlxUhz5qHjTRIvNerCOXfKiLIyf0NsC6IlSQPnKZWbYgcRyGg9WSvU8+e SQn1keL2Et0VJ0eQSXwuewuN1MYzFXzGJE/kR5C2tf2bJAkmG8pGU+4iUDtn6ClCZBlmH6 PiKxZ8/548mBI58fqL6eCBBYWx/vY+325jFa+FccinrClWMnZa0eh4u+MftBFSzsKVUkfs n3Y1FOW8y7ARlRwxoABa9h1lPdTXB+1C3KZqLPUw4uL1Jxrnp5SwmzE/GEpWcQ== Received: from smtpclient.apple (unknown [IPv6:2001:19f0:6001:9db:98f0:9fe0:3545:10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: zlei/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Z294V4TBTz1C6l; Tue, 25 Feb 2025 07:59:54 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Content-Type: text/plain; charset=us-ascii List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.10\)) Subject: Re: git: 93b4a5445658 - main - netgraph: prevent panic with INVARIANTS-enabled kernel From: Zhenlei Huang In-Reply-To: <202502250722.51P7Mwnr064433@gitrepo.freebsd.org> Date: Tue, 25 Feb 2025 15:59:47 +0800 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202502250722.51P7Mwnr064433@gitrepo.freebsd.org> To: Eugene Grosbein X-Mailer: Apple Mail (2.3696.120.41.1.10) > On Feb 25, 2025, at 3:22 PM, Eugene Grosbein = wrote: >=20 > The branch main has been updated by eugen: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D93b4a54456589e78dcd37f2db8333baf= f3f3f0b2 >=20 > commit 93b4a54456589e78dcd37f2db8333baff3f3f0b2 > Author: Eugene Grosbein > AuthorDate: 2025-02-25 07:18:29 +0000 > Commit: Eugene Grosbein > CommitDate: 2025-02-25 07:22:53 +0000 >=20 > netgraph: prevent panic with INVARIANTS-enabled kernel >=20 > This change makes NG_ABI_VERSION depend on INVARIANTS > in addition to NETGRAPH_DEBUG. >=20 > PR: 257876 Maybe a wrong PR ? The PR 257876 is about port math/deal.ii , I do not see any relationship = between it and netgraph(3) or netgraph(4). Best regards, Zhenlei > MFC-after: 2 weeks > --- > sys/netgraph/netgraph.h | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) >=20 > diff --git a/sys/netgraph/netgraph.h b/sys/netgraph/netgraph.h > index e83f61d3f60b..10db352e0fa2 100644 > --- a/sys/netgraph/netgraph.h > +++ b/sys/netgraph/netgraph.h > @@ -69,11 +69,20 @@ > * modules. > */ > #define _NG_ABI_VERSION 12 > -#ifdef NETGRAPH_DEBUG = /*----------------------------------------------*/ > -#define NG_ABI_VERSION (_NG_ABI_VERSION + 0x10000) > -#else /* NETGRAPH_DEBUG */ = /*----------------------------------------------*/ > -#define NG_ABI_VERSION _NG_ABI_VERSION > -#endif /* NETGRAPH_DEBUG */ = /*----------------------------------------------*/ > + > +#ifdef NETGRAPH_DEBUG > +#define _NG_ABI_PREFIX1 0x10000 > +#else > +#define _NG_ABI_PREFIX1 0 > +#endif > + > +#ifdef INVARIANTS > +#define _NG_ABI_PREFIX2 0x20000 > +#else > +#define _NG_ABI_PREFIX2 0 > +#endif > + > +#define NG_ABI_VERSION (_NG_ABI_PREFIX1 + _NG_ABI_PREFIX2 + = _NG_ABI_VERSION) >=20 > /* > * Forward references for the basic structures so we can From eugen@freebsd.org Tue Feb 25 09:37:02 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2CDy6jPzz5pVC2 for ; Tue, 25 Feb 2025 09:37:22 +0000 (UTC) (envelope-from eugen@freebsd.org) Received: from mail.rdtc.ru (mail.rdtc.ru [62.231.190.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2CDy3zKlz3ZKR for ; Tue, 25 Feb 2025 09:37:22 +0000 (UTC) (envelope-from eugen@freebsd.org) Authentication-Results: mx1.freebsd.org; none Received: by mail.rdtc.ru (RDTC Post Office Server, from userid 1000) id DA4A71D0A3; Tue, 25 Feb 2025 16:37:13 +0700 (+07) Received: from eg.sd.rdtc.ru (eg.sd.rdtc.ru [62.231.161.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: egrosbein@rdtc.ru) by mail.rdtc.ru (RDTC Post Office Server) with ESMTPSA id 1AA001CFBB; Tue, 25 Feb 2025 16:37:07 +0700 (+07) X-Envelope-From: eugen@freebsd.org X-Envelope-To: zlei@FreeBSD.org Received: from [10.58.0.10] (dadvw [10.58.0.10]) by eg.sd.rdtc.ru (8.18.1/8.18.1) with ESMTPS id 51P9b33X054584 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 25 Feb 2025 16:37:04 +0700 (+07) (envelope-from eugen@freebsd.org) Subject: Re: git: 93b4a5445658 - main - netgraph: prevent panic with INVARIANTS-enabled kernel To: Zhenlei Huang References: <202502250722.51P7Mwnr064433@gitrepo.freebsd.org> Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" , "Herbert J. Skuhra" From: Eugene Grosbein Message-ID: Date: Tue, 25 Feb 2025 16:37:02 +0700 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=2.1 required=5.0 tests=DATE_IN_FUTURE_96_Q, NICE_REPLY_A,SPF_SOFTFAIL autolearn=no autolearn_force=no version=4.0.0 X-Spam-Report: * 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) * 2.0 DATE_IN_FUTURE_96_Q Date: is 4 days to 4 months after Received: date * -0.8 NICE_REPLY_A Looks like a legit reply (A) X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on eg.sd.rdtc.ru X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:29072, ipnet:62.231.184.0/21, country:RU] X-Rspamd-Queue-Id: 4Z2CDy3zKlz3ZKR X-Spamd-Bar: ---- 25.02.2025 14:59, Zhenlei Huang wrote: >> commit 93b4a54456589e78dcd37f2db8333baff3f3f0b2 >> Author: Eugene Grosbein >> AuthorDate: 2025-02-25 07:18:29 +0000 >> Commit: Eugene Grosbein >> CommitDate: 2025-02-25 07:22:53 +0000 >> >> netgraph: prevent panic with INVARIANTS-enabled kernel >> >> This change makes NG_ABI_VERSION depend on INVARIANTS >> in addition to NETGRAPH_DEBUG. >> >> PR: 257876 > > Maybe a wrong PR ? > > The PR 257876 is about port math/deal.ii , I do not see any relationship between it and netgraph(3) or netgraph(4). Sorry, paste error. Right number is 214624. From nobody Tue Feb 25 10:04:18 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2Cr31tf6z5pY4f; Tue, 25 Feb 2025 10:04: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2Cr318HZz3plD; Tue, 25 Feb 2025 10:04:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740477859; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9EfajY7m508vlCQXzftJ2J9AAV5iu7VDe/r+x9aNNno=; b=G9ZsK9VsAOqINvSnJbIujyITQtdlKLang7KjutRlm4Bg6+lqoM4M7VwAz64Yxj6TPSpXTA GocCvJQL/op0NSJcHfClo/7f3E06jb1t7P1kusolOMU66EtEKqoen2PzwT+LXKj1sE8iEY 1jDVa0f3v8XlR2ooISlclbFGic/6Z/EMrZ3bGheDE8dMYHmpoA1+h7PoCzcS9KhyTb2AwD P2dgY1SX0C/V5CV+8E82QK3v696fhD8PuTtJMPZaVXhuVFyJ8N+K+w/AYz/Sw4yy1kMgg6 TBzxfEpXP8eB7yaHsN0GwLHsQRCrIMqPUlr3iiPlkY+A0/5aIMFSOYA/OEy0KA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740477859; a=rsa-sha256; cv=none; b=BaGS3lM7srdUTx5KYt8D64TQE++Rs2E4qegYfxOe9csZG7UIEY2Jctsd64m9Hey5+L5xcC 4zqyXemJbcuYvJz4mxdtvL4bwwfrBLI2JS5RHg4MVoS/fMosFJ7GXZ4ZnuldchbQ6Xgb+1 EKV9UUiBkWp1FU+D5r1p7D56K2pww2AIlGCMfzbDbMno9pvQll2wrPsTMB4IDxnlI2wrmx XM004IMyMhCAXQBPn2Rv/vRw2BfnrPOS/iGb10CotltyMge/KVFzf93Q2YAOCa47ViVD+7 kRM8p5ryZLwNY2Nl0J+UKMzJUZ3PbsDujorzoCVxYLOPMzSzUSANiv/S0N75lA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740477859; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9EfajY7m508vlCQXzftJ2J9AAV5iu7VDe/r+x9aNNno=; b=TizRA4ywX8bVpfnJ2X9NRxa2PKnG4ohO0ZVy8Jmq3xcqh/dlYE+rmVOBsm21Kj7g+wPFH0 vk/og+fAfRm/m4Y1lh4DwX44TD72iWyXicpMx5hztv/1fV+C/QTUQW5MBZnjmr7I15f+8M OHGSqjbKM0EsxUp7xYrRSi5mU+OtW8J1ZcFQj8+r569oUFlwVdej+LMGIWwfPQ33Fbvo6S WkhE+VhBZ/FwIB7vZPDlGQiovh9FtL6s0Au1ISV/s80SJZnYKuYQNWpjceEx+sT1koRPCo SLE1w1Sdki3aHkkXCO335Pj/7sIU4H+pF+rDTRiX8M02lbcP0Cw/kJsB6mWrXA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2Cr30JyYz6Pm; Tue, 25 Feb 2025 10:04:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PA4IkB064237; Tue, 25 Feb 2025 10:04:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PA4I6h064234; Tue, 25 Feb 2025 10:04:18 GMT (envelope-from git) Date: Tue, 25 Feb 2025 10:04:18 GMT Message-Id: <202502251004.51PA4I6h064234@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: 9bdb3272f753 - main - pf tests: remove stray debug log line List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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: 9bdb3272f75346e53e67007fbf84fad6e9815e11 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9bdb3272f75346e53e67007fbf84fad6e9815e11 commit 9bdb3272f75346e53e67007fbf84fad6e9815e11 Author: Kristof Provost AuthorDate: 2025-02-21 12:54:58 +0000 Commit: Kristof Provost CommitDate: 2025-02-25 08:32:33 +0000 pf tests: remove stray debug log line Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/nat64.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/sys/netpfil/pf/nat64.sh b/tests/sys/netpfil/pf/nat64.sh index 68d9191cacb9..6227da01fccf 100644 --- a/tests/sys/netpfil/pf/nat64.sh +++ b/tests/sys/netpfil/pf/nat64.sh @@ -501,7 +501,6 @@ table_range_cleanup() table_common_body() { pool_type=$1 -echo pool_type=${pool_type} pft_init From nobody Tue Feb 25 10:04:19 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2Cr41jgLz5pY4l; Tue, 25 Feb 2025 10:04:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2Cr40XYqz3pnj; Tue, 25 Feb 2025 10:04:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740477860; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0f3XPLXM9DOiYC7VuFf0GfDOIZPPiM9xdstSfbeJ89U=; b=Cy4iMJZ+mdBWB1Jua6BbircowZXclNCa48HupgSVBDOQPHfDpgRlzs1dwcRladcuohlEgh JqI4nj0EbpgKDT/fHuNlTTdhLMPa5Rq3IhwvttlT9Z90J3URhamOMpeUOpshmdz+TdG32z +aKXT0t62+CUqUiQq+jfV87cTRzM3Cd4rasJfUNt0bPPoWPnTZYh+DPKZ6zvmypiz3CzYl oKEGWJzdc8SAT1cJgLtKRLEzLkfzz3ekq7Jy1cG76CHOyCdwUA4XFKxHQb/C2jDijcYj+r gizCad17/mKHETze1KVg4RUBL2v3Jsipo1vvBajFawA/SVv0ym5PjFpfZmNYjw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740477860; a=rsa-sha256; cv=none; b=dWIFljhMKP+r5VVi4twd1v7hDOd9cTh5eTEC6dyi+F8fDyEe1kUrT5lxod5fbYXQAlpiSG oJNETW0rtfLQZfKZ7ql8MbEh/+8+THJ377e7B7Vgeq+4G2KKH16OvTc3idyBV5RKROCLlI ngNACFzKpbz+SKTK/Lt041m5nCTrvYVUEfWaDWAX3bRPSxRPSVarnQgjGQhEemX3Gilwyz Mjgm2DTaGFcVsVETSzTK1nMl9cwSyDILzMhdnhvmscGfdVlWJJ42qakd0UItRonga2D8zL BpoabDFUdy7Wr7XA5FOxm67IjazSSRD5ts7WOXnfCdQZoMlBh1SROS4VpsSNPQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740477860; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0f3XPLXM9DOiYC7VuFf0GfDOIZPPiM9xdstSfbeJ89U=; b=CVSIvH3xZWtINP556/V8EY69CmmIaUw6zaTQBQ01dwVC45jdecRKbh8BTMpe5692NxvvJm oI4yR2IqkLJdRjB/2vJJbOeKATUqvxupZQlmCOYlJQ368ooJtxP+JIRZ/NtunJ/3Yf3EVA o77vzFPoqDFsNSzsnsK44VQpqtxhLAyed0YKJ0dGF0uEREqchcgygPdN0h/JbDudH7rfor ubyTCyh7+0EncwZnfZepKcrrrub18qyzR6T4WpAzTpGqVI8KbO1p77y/3Q6fJIz7Oa9W5m +vaohHP+Uxgz3Wb7nmHtkteybrf3H2ypxl6/rtj6qXPbTuswDwwEldJO6+3HuQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2Cr403Nqz6jK; Tue, 25 Feb 2025 10:04:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PA4Jj5064270; Tue, 25 Feb 2025 10:04:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PA4Jb3064267; Tue, 25 Feb 2025 10:04:19 GMT (envelope-from git) Date: Tue, 25 Feb 2025 10:04:19 GMT Message-Id: <202502251004.51PA4Jb3064267@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: 41265f65a549 - main - pf: cope with IPv6 gateways for an IPv4 route in nat64 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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: 41265f65a549d919363e322a39cbf3ce034c5de9 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=41265f65a549d919363e322a39cbf3ce034c5de9 commit 41265f65a549d919363e322a39cbf3ce034c5de9 Author: Kristof Provost AuthorDate: 2025-02-21 15:49:45 +0000 Commit: Kristof Provost CommitDate: 2025-02-25 08:32:34 +0000 pf: cope with IPv6 gateways for an IPv4 route in nat64 It's possible for an IPv4 next hop to be specified as an IPv6 address. This broke pf's route lookup in pf_route(), which is required for nat64. Handle this case just like ip_tryforward(): use the struct sockaddr from the struct nhop_object, and mark a struct route to indicate if_output() has to use the gateway. Add a test case for this. PR: 284946 Reviewed by: zlei Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D49095 --- sys/netpfil/pf/pf.c | 40 +++++++++++++++------------- tests/sys/netpfil/pf/nat64.sh | 62 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 19 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 15d9697c0040..f3c9ea7a2fb1 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -337,7 +337,7 @@ static int pf_dummynet(struct pf_pdesc *, struct pf_kstate *, struct pf_krule *, struct mbuf **); static int pf_dummynet_route(struct pf_pdesc *, struct pf_kstate *, struct pf_krule *, - struct ifnet *, struct sockaddr *, struct mbuf **); + struct ifnet *, const struct sockaddr *, struct mbuf **); static int pf_test_eth_rule(int, struct pfi_kkif *, struct mbuf **); static int pf_test_rule(struct pf_krule **, struct pf_kstate **, @@ -8665,7 +8665,9 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, struct pf_kstate *s, struct pf_pdesc *pd, struct inpcb *inp) { struct mbuf *m0, *m1, *md; - struct sockaddr_in dst; + struct route ro; + const struct sockaddr *gw = &ro.ro_dst; + struct sockaddr_in *dst; struct ip *ip; struct ifnet *ifp = NULL; int error = 0; @@ -8754,11 +8756,11 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, ip = mtod(m0, struct ip *); - bzero(&dst, sizeof(dst)); - dst.sin_family = AF_INET; - dst.sin_len = sizeof(dst); - dst.sin_addr = ip->ip_dst; - dst.sin_addr.s_addr = pd->act.rt_addr.v4.s_addr; + bzero(&ro, sizeof(ro)); + dst = (struct sockaddr_in *)&ro.ro_dst; + dst->sin_family = AF_INET; + dst->sin_len = sizeof(struct sockaddr_in); + dst->sin_addr.s_addr = pd->act.rt_addr.v4.s_addr; if (s != NULL){ if (ifp == NULL && (pd->af != pd->naf)) { @@ -8769,10 +8771,12 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, ifp = nh->nh_ifp; /* Use the gateway if needed. */ - if (nh->nh_flags & NHF_GATEWAY) - dst.sin_addr = nh->gw4_sa.sin_addr; - else - dst.sin_addr = ip->ip_dst; + if (nh->nh_flags & NHF_GATEWAY) { + gw = &nh->gw_sa; + ro.ro_flags |= RT_HAS_GW; + } else { + dst->sin_addr = ip->ip_dst; + } /* * Bind to the correct interface if we're @@ -8873,9 +8877,9 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, m_clrprotoflags(m0); /* Avoid confusing lower layers. */ md = m0; - error = pf_dummynet_route(pd, s, r, ifp, sintosa(&dst), &md); + error = pf_dummynet_route(pd, s, r, ifp, gw, &md); if (md != NULL) { - error = (*ifp->if_output)(ifp, md, sintosa(&dst), NULL); + error = (*ifp->if_output)(ifp, md, gw, &ro); SDT_PROBE2(pf, ip, route_to, output, ifp, error); } goto done; @@ -8915,10 +8919,9 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, md = m0; pd->pf_mtag = pf_find_mtag(md); error = pf_dummynet_route(pd, s, r, ifp, - sintosa(&dst), &md); + gw, &md); if (md != NULL) { - error = (*ifp->if_output)(ifp, md, - sintosa(&dst), NULL); + error = (*ifp->if_output)(ifp, md, gw, &ro); SDT_PROBE2(pf, ip, route_to, output, ifp, error); } } else @@ -9038,7 +9041,6 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, bzero(&dst, sizeof(dst)); dst.sin6_family = AF_INET6; dst.sin6_len = sizeof(dst); - dst.sin6_addr = ip6->ip6_dst; PF_ACPY((struct pf_addr *)&dst.sin6_addr, &pd->act.rt_addr, AF_INET6); if (s != NULL) { @@ -9442,7 +9444,7 @@ pf_dummynet(struct pf_pdesc *pd, struct pf_kstate *s, static int pf_dummynet_route(struct pf_pdesc *pd, struct pf_kstate *s, - struct pf_krule *r, struct ifnet *ifp, struct sockaddr *sa, + struct pf_krule *r, struct ifnet *ifp, const struct sockaddr *sa, struct mbuf **m0) { struct ip_fw_args dnflow; @@ -9473,7 +9475,7 @@ pf_dummynet_route(struct pf_pdesc *pd, struct pf_kstate *s, MPASS(sa != NULL); - switch (pd->naf) { + switch (sa->sa_family) { case AF_INET: memcpy(&pd->pf_mtag->dst, sa, sizeof(struct sockaddr_in)); diff --git a/tests/sys/netpfil/pf/nat64.sh b/tests/sys/netpfil/pf/nat64.sh index 6227da01fccf..94c6c5fd8c8f 100644 --- a/tests/sys/netpfil/pf/nat64.sh +++ b/tests/sys/netpfil/pf/nat64.sh @@ -799,6 +799,67 @@ reply_to_cleanup() pft_cleanup } +atf_test_case "v6_gateway" "cleanup" +v6_gateway_head() +{ + atf_set descr 'nat64 when the IPv4 gateway is given by an IPv6 address' + atf_set require.user root +} + +v6_gateway_body() +{ + pft_init + + epair_wan_two=$(vnet_mkepair) + epair_wan_one=$(vnet_mkepair) + epair_lan=$(vnet_mkepair) + + ifconfig ${epair_lan}a inet6 2001:db8::2/64 up no_dad + route -6 add default 2001:db8::1 + + vnet_mkjail rtr ${epair_lan}b ${epair_wan_one}a + jexec rtr ifconfig ${epair_lan}b inet6 2001:db8::1/64 up no_dad + jexec rtr ifconfig ${epair_wan_one}a 192.0.2.1/24 up + jexec rtr ifconfig ${epair_wan_one}a inet6 -ifdisabled + jexec rtr route add default -inet6 fe80::1%${epair_wan_one}a + #jexec rtr route add default 192.0.2.2 + + vnet_mkjail wan_one ${epair_wan_one}b ${epair_wan_two}a + jexec wan_one ifconfig ${epair_wan_one}b 192.0.2.2/24 up + jexec wan_one ifconfig ${epair_wan_one}b inet6 fe80::1/64 + jexec wan_one ifconfig ${epair_wan_two}a 198.51.100.2/24 up + jexec wan_one route add default 192.0.2.1 + jexec wan_one sysctl net.inet.ip.forwarding=1 + + vnet_mkjail wan_two ${epair_wan_two}b + jexec wan_two ifconfig ${epair_wan_two}b 198.51.100.1/24 up + jexec wan_two route add default 198.51.100.2 + + # Sanity checks + atf_check -s exit:0 -o ignore \ + ping6 -c 1 2001:db8::1 + atf_check -s exit:0 -o ignore \ + jexec rtr ping -c 1 192.0.2.2 + atf_check -s exit:0 -o ignore \ + jexec rtr ping -c 1 198.51.100.1 + + jexec rtr pfctl -e + pft_set_rules rtr \ + "set reassemble yes" \ + "set state-policy if-bound" \ + "pass in on ${epair_lan}b inet6 from any to 64:ff9b::/96 af-to inet from (${epair_wan_one}a)" + + atf_check -s exit:0 -o ignore \ + ping6 -c 3 64:ff9b::192.0.2.2 + atf_check -s exit:0 -o ignore \ + ping6 -c 3 64:ff9b::198.51.100.1 +} + +v6_gateway_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "icmp_echo" @@ -818,4 +879,5 @@ atf_init_test_cases() atf_add_test_case "gateway6" atf_add_test_case "route_to" atf_add_test_case "reply_to" + atf_add_test_case "v6_gateway" } From nobody Tue Feb 25 11:48:09 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2G7s4LzHz5pjnW; Tue, 25 Feb 2025 11:48: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2G7s2rqbz3kK9; Tue, 25 Feb 2025 11:48:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h/jyf3EV2ZXeGS3uNuhE4qsAzp6ADMqX34ZYeSnnjsw=; b=Tn6cGg861hZ20ZcsboKzbWMtK8QSNDBPPGse2DaDdoZIn9W7Lp2e0zsaGLaEQnUtav8lMs kcBRnUOUpciiq7sSXoLoHQW0iHz7NZyaTOeTCPlghTbSTYhKMK+LpVpIp5uVVo+191pOg2 V7JkmmUEdau+iZys5kOxqWchrGWFl/Mu6DlaxYNq8c40/1ftJAp8rZVU282w+8aKEr+VHu JaBCVrr9TrCWiI156UVWLxkYfViARLH5xD8RLhB+NB6F5/NAqAc470ZYclIdoCIbsqgRsK /+4JQ59uJjKGhyFA1yihUqcd220e+2UCnaphb4vrYxIQogpdMM34VmWPaAwMsg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484089; a=rsa-sha256; cv=none; b=rec+QrV2NKV3nUBOm2vraB0pfK739B26FEX+5R025mkLASIe8j3p+dqrbaTB4oYTEP0vuB dTNB+wZ4ZVgqEwsqfCdSO2TVQJL72Yrmr7zRfAuX2Yw696QG80e/3UulAea3uFLtr72CO5 uouL1QblKN5sh0dO3jsEeJOGCPOrPnPCa8wZBhlTOZmleIzZFD+B3GOyfMcqFYRLTyAGrv VqQmHWvdjDLMULxDf9j4uUb12Q8dzBhqvtD1mG3RBhO4O2ymHo1tQ+xvrifMMiovccBVFr 4oaGTp5vlBMMLMq78XNrYxsnP7h4q/BLrHAZ+0YAwUAyuykuqgbgxCFtfTagOA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h/jyf3EV2ZXeGS3uNuhE4qsAzp6ADMqX34ZYeSnnjsw=; b=k9dEWc4WjEgF2P8uFSH3djJWY40Vmj5Z4y6RdJgW5seF8rgw5M2OK5BsNWVMUvVZpBbtPB nUeVMVkR71jmuSICmYI/QZstCoq/K2UPcD2N4VVFJwQ7D6/qXw+b75tV0NP9pmNskteWaZ TXqidnTq770m1y5osw4OG9RKrUiFdIpNKtrx+nkdajrpktc/eIXdQS8loxwyXxbbUPrWqu Dx3quAozH8XbiICel4rcH8hD0Qax5hSqgR4aqSucCxsOc35C8DAIx5ldZsLglzjkSGJBUO 2idqN8LLfV+ErpkzbgcHQRlPUxlI08552OGdK6ZU0E/zPVVdbaOE/F0Qu+dPxQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2G7s1zFhz8pg; Tue, 25 Feb 2025 11:48:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PBm9Vw050732; Tue, 25 Feb 2025 11:48:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PBm9x1050729; Tue, 25 Feb 2025 11:48:09 GMT (envelope-from git) Date: Tue, 25 Feb 2025 11:48:09 GMT Message-Id: <202502251148.51PBm9x1050729@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 164651f16c86 - main - sound: Do not return an error from chn_notify() if the children list is empty List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 164651f16c860049a4ad2098206def8ca7a39b4a Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=164651f16c860049a4ad2098206def8ca7a39b4a commit 164651f16c860049a4ad2098206def8ca7a39b4a Author: Christos Margiolis AuthorDate: 2025-02-25 11:42:59 +0000 Commit: Christos Margiolis CommitDate: 2025-02-25 11:42:59 +0000 sound: Do not return an error from chn_notify() if the children list is empty An empty children list does not mean that there is an error. Reported by: Florian Walpen Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D48156 --- sys/dev/sound/pcm/channel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 4b0ca128391b..4d275d00762a 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -2360,7 +2360,7 @@ chn_notify(struct pcm_channel *c, u_int32_t flags) CHN_LOCKASSERT(c); if (CHN_EMPTY(c, children)) - return (ENODEV); + return (0); err = 0; From nobody Tue Feb 25 11:48:10 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2G7t4fnRz5pjfs; Tue, 25 Feb 2025 11:48:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2G7t2bhwz3kBD; Tue, 25 Feb 2025 11:48:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KjLazXzMtYF9p7u911ChYKzTLktmpeC/Qx3JemQ5L94=; b=oLinL3FjzNfX+OWwvg225asxOMDPsHJr6aSrwrRLrTgGvw5TWit8ybVrKv1YUVq5qIQ801 2iqU6Yx1HIF1hpPyDy6CW0WRLzGaGquWj0glqcBZAxHV9p50KJL/RZ7eVM1Pv3sGNz4kPh TB8RHUJiUoMkNsWSk4HWGiUdBDwB7YMDG8QYd+pOh6zo1UO/nRlDqgdlpDvmICyaR0nHos yjDRpmdC8rrube8sXEKwN1eEN/cvHd1UuDABaUxcInHoBqS1wiP9rzZTxuDSxqadD7Iawm PnHFxNdNUd5yNvM/sUBjKStgREHesNcuBRxyc8svZmCEBnh3YkccVDjBuuiYdw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484090; a=rsa-sha256; cv=none; b=MuKj/L91INajmYXeP4oeWF7mnzLGnZqa49O+Ox6stH6TOwOshZjtJGB7Hj0mGIbwXHVz6r h3JipUDBceX37szXMaaIWWFZHkllArEiD+gyfeSsjOYGjiBhXEcL/m19zzH5RTBekojUjy mJIck+f55o78s4YrZlJpHLSSudFtILqb6McRCLBcKaLvgy0gOSMys1fstrnkO8LJJrSCH7 b0Zh+nNm6FwvaTOIeYh8mAXjw/YrN0F19w1bSjfNvx9HCaUrA4DRS7cWd+ouETSPtUCc5Y LNTWWdWbIrULaCV49suNDdUyIOFgI80Ai6RLvlRhaA5gpB2O4EE9Vx6RySKWnQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KjLazXzMtYF9p7u911ChYKzTLktmpeC/Qx3JemQ5L94=; b=K+ofEBiVRAM4NKDyIKjEanCVXQELDpM1J0PfwIO7BA7NLjKz0UyhlXO/3uPBJ83cWOJCq1 1NqRuumoK+if2iTxyE1tof4PIAmPLOC1dOGJ1SskVloRrX0hNVfFzhFK/tPyNQTgEfACnk Q4+AH81SYG3TJ7PF4x/X1g2f4y4E6cHraa8ZlQj9z780OQslIONOzrVogzPAMLo80weP0a uVVrvv9/fBiUkqXxfIvTSChLGFm9Ba5D6m30IYlB0/ciwevEJxf/IX3pjHnjMbMx94DbN2 kD25sfFKTEd2LSx7sCbI7imhPuHmlB7gu3D38wUGP152A2EPgcmB9AsaKxBh0Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2G7t1zCDz94H; Tue, 25 Feb 2025 11:48:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PBmAU8050766; Tue, 25 Feb 2025 11:48:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PBmAve050763; Tue, 25 Feb 2025 11:48:10 GMT (envelope-from git) Date: Tue, 25 Feb 2025 11:48:10 GMT Message-Id: <202502251148.51PBmAve050763@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 405b1e50926d - main - sound: Do not fail from vchan_destroy() if children list is empty List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 405b1e50926d4162fb9503644073c0184a8b37d9 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=405b1e50926d4162fb9503644073c0184a8b37d9 commit 405b1e50926d4162fb9503644073c0184a8b37d9 Author: Christos Margiolis AuthorDate: 2025-02-25 11:43:11 +0000 Commit: Christos Margiolis CommitDate: 2025-02-25 11:43:11 +0000 sound: Do not fail from vchan_destroy() if children list is empty vchan_destroy() should be able to call chn_kill() regardless of whether the channel has been added to the children list yet or not. Also remove the CHN_F_BUSY check. There is no reason we shouldn't execute the code below if the parent is not busy. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D48185 --- sys/dev/sound/pcm/vchan.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c index 4165d0712b94..ea8a50b316fe 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -838,15 +838,8 @@ vchan_destroy(struct pcm_channel *c) CHN_UNLOCK(c); - if (!(parent->flags & CHN_F_BUSY)) - return (EBUSY); - - if (CHN_EMPTY(parent, children)) - return (EINVAL); - /* remove us from our parent's children list */ CHN_REMOVE(parent, c, children); - if (CHN_EMPTY(parent, children)) { parent->flags &= ~(CHN_F_BUSY | CHN_F_HAS_VCHAN); chn_reset(parent, parent->format, parent->speed); From nobody Tue Feb 25 11:48:11 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2G7w0GNTz5pjlp; Tue, 25 Feb 2025 11:48: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2G7v3VJyz3k8r; Tue, 25 Feb 2025 11:48:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v5w7Cteon3nt8/sS7tP/Yd6BlAdG3wdid6898FEpqGM=; b=FPr/PRRxvFMgKlkI9W5vKuz670ayAK0zca5BMPJ4Njz2pwXuFHkkQuLvsaW3tuWajWJIXt 2V/7pC70G7pEJPg3AeGuk6oGQy3O5VCDLCyU0xPG6uBC1SF50CXx66XQPtEMprTjXNEYeW rfL8w0HvXr3Ac5zz5pGR8QMXKFTVm0/YBLCgS8NDC7/bfaKuQkE2y1kxRlXflENubuLp9M whNc0Q0F1d6CdHqlvhqVKICIfCrv9/DTjprpXIzNWzi1til16ALB4UAjkxUz2fe1TW9nAb z1E/wTzEAHhgKuvg3TrlPTQfuNTumkERzKhhNaFE9L7kuNrWDzHDmUPF8JgBVA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484091; a=rsa-sha256; cv=none; b=ArBElE6BINy4/8IyY0DfGPMV6ExZ6T3+BZw4Hi0cpgKH2U6VgCFNQ2efGZtvy2wP8cjrpP e5pujb/9ktiJUukEXE0Wk1lDzdGsEeTmdS6WNbdvZhFHg7N35glUONQcVa+kId0gTT+B5k jY2BHsMIkKnJBH3CLls/nQ+VXROE2WLSraVDy263u1i2JuJ0ujmAUACms6WqO119T3v40x bS9LkIys/zYkGo0LOE/eUfWuYZPQ9AUdvpwflGc6r7c9/JxOlhzptbRgg4CzKnaR0acGFc K8gJSD8CsGLHjy7TvPVfIKdFTa3LWL8nkArweyevdC8or0qTFzr3eWX3VsLWoA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v5w7Cteon3nt8/sS7tP/Yd6BlAdG3wdid6898FEpqGM=; b=RvhrigeCSMS2xIxkUGU5GGLl0b1gBBDRO7muz4CTk9EcLJiE/2SUVGQuh8DsdlVk2ndUvG Y/Cir7XemKDFazTPZ9/LpURK8+MmcD5rA2acjpOkkohUtwCYw3k7Sg0yPqSP/x2UopsGwG vl0CDGCfu2JatHytrCOkOfH62vWb69XQoFz3UoKIzCsI69b3B+zF61QYz6VsKs3qB8BLU+ 8S7UHP039/BiwOW4ZeWV1JsSaB+Nsc+ksu+p9h7R8aTYx0WGMQXUSceq1DIudaWDogVgSz xobnxenTKjhjJeKNclvfTZAh4yESZHvSEAepqqWpcOc2SPsAAd+e9fwU56N6cQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2G7v34pcz94J; Tue, 25 Feb 2025 11:48:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PBmBK7050798; Tue, 25 Feb 2025 11:48:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PBmB6K050795; Tue, 25 Feb 2025 11:48:11 GMT (envelope-from git) Date: Tue, 25 Feb 2025 11:48:11 GMT Message-Id: <202502251148.51PBmB6K050795@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 2546ab1b3632 - main - sound: Call vchan_destroy() on vchan_create() failure List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2546ab1b3632a9ebfe88d9d5dc55700e653bff5d Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=2546ab1b3632a9ebfe88d9d5dc55700e653bff5d commit 2546ab1b3632a9ebfe88d9d5dc55700e653bff5d Author: Christos Margiolis AuthorDate: 2025-02-25 11:43:19 +0000 Commit: Christos Margiolis CommitDate: 2025-02-25 11:43:19 +0000 sound: Call vchan_destroy() on vchan_create() failure Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D48183 --- sys/dev/sound/pcm/vchan.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c index ea8a50b316fe..4ee7e01066d3 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -811,11 +811,8 @@ vchan_create(struct pcm_channel *parent) return (ret); fail: - CHN_REMOVE(parent, ch, children); - parent->flags &= ~CHN_F_HAS_VCHAN; - CHN_UNLOCK(parent); - chn_kill(ch); - CHN_LOCK(parent); + CHN_LOCK(ch); + vchan_destroy(ch); return (ret); } From nobody Tue Feb 25 11:48:12 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2G7w6g04z5pjjQ; Tue, 25 Feb 2025 11:48: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2G7w4Svxz3kKS; Tue, 25 Feb 2025 11:48:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484092; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=O4as4I/KhcACbui5SzxUTRQEPwlvCjuflmUIouFOaaQ=; b=O2CZ7f/ncO0wwXxmq3hcWqWVK1gQknSY5uvisiFNka25p00BZh5j1sYsQds0hHXk/sbX/+ mXoQmR0mZSq+sw4meT5DZIxGNMVZ+jHZVs9pmPdhb0pftFJhOTHeeFkdq2mV877LsE8vmH NFEKK0kDdyilzVkPDddw/91wid9zHdrDcYdCfENzZk/eXRmC/LkLnFVZc5iOzbMWhiwOcE s5opgTYUt+ErejpOa3dFFS4egomkL6TysYbIHhAAI7whB+3bGzl0zjKnYBtB0tOQ3PWG/R UO7lUipqSuPUkshHWbpbLcMz1YbR9XKMXsrxDrlu+VLHDI5nHh4FbQMI/QYVEA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484092; a=rsa-sha256; cv=none; b=xwqSnt8N78m/KCXJAHLW700Cyz8p7tfMFV220BOKDKp+fAm+RKUFsmGlNp0+a16vYdiYtB Ko21JE8PN3CkR3qQRmjwXTEoRpQRflWozKRQJ84HxBYyg8nCTDkidmQ/29iWv50EoCUPMm pOUQCP89PSRYOwzVau8+QJkOwAMNnTHfJoU+tU0S7vokUAqzke1yDLkLrCy1n7IV7+N0AF q+sOntvsLwj0FIsWUeoOzf3ZtJZsi+/3aCYIKJlmc5C9RpJm5j55NaVCdyPArLZf1RgvgP Ubn/e5+y9F4j19ADt7fw0Id/B3wggJaSj8oHXJhjusgF8i9HCywZS5qo5448zg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484092; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=O4as4I/KhcACbui5SzxUTRQEPwlvCjuflmUIouFOaaQ=; b=MYRogRr0TDaYPMYCyU4CVRYhy1mrmqyYFjBPbyc+teRirAJsZXUDkg0GINEvzO20A3sI3K 3vpVzimE9egcHF0KZYsJ8iCJbqhD14qD/aWa+bIR7QYTPgVUDN6Nf4QAls/tGzec/R4aaU 24IH9PlsmuEmNMG3AgPm1jHt0JsEZaer5AO6VLCiEZD+cBWXFoYKuL/OgbRSd7QuDcwrZ4 PeGtwT1WnSOXpQPQVyQPdC1qodzKzBoEflrM86vTJ9l6C0luSRf6aasICmT+kKUXqpHvnk +8m6O4h402AULXXLX1g9f2wkEHk334DRyLYxs+I8y8ZtZ7I0wb2oiIFEezommQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2G7w40Mhz9R2; Tue, 25 Feb 2025 11:48:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PBmCq9050830; Tue, 25 Feb 2025 11:48:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PBmCbQ050827; Tue, 25 Feb 2025 11:48:12 GMT (envelope-from git) Date: Tue, 25 Feb 2025 11:48:12 GMT Message-Id: <202502251148.51PBmCbQ050827@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: e89ee05b7cf1 - main - sound: Initialize channels with sane default rate and format List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e89ee05b7cf1a54d0d6ed56e4d451fdd9a10db43 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=e89ee05b7cf1a54d0d6ed56e4d451fdd9a10db43 commit e89ee05b7cf1a54d0d6ed56e4d451fdd9a10db43 Author: Christos Margiolis AuthorDate: 2025-02-25 11:43:26 +0000 Commit: Christos Margiolis CommitDate: 2025-02-25 11:43:26 +0000 sound: Initialize channels with sane default rate and format There is no good reason to initialize with AFMT_U8 at 8000Hz. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D48434 --- sys/dev/sound/pcm/channel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 4d275d00762a..58315610312e 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1205,8 +1205,8 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, c->direction = direction; c->type = dir; c->unit = alloc_unr(chn_getunr(d, c->type)); - c->format = SND_FORMAT(AFMT_U8, 1, 0); - c->speed = DSP_DEFAULT_SPEED; + c->format = SND_FORMAT(AFMT_S16_LE, 2, 0); + c->speed = 48000; c->pid = -1; c->latency = -1; c->timeout = 1; From nobody Tue Feb 25 11:48:13 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2G7z0WXKz5pjnd; Tue, 25 Feb 2025 11: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2G7y1z5mz3kSp; Tue, 25 Feb 2025 11:48:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484094; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nY4SzJdaVFuGM1HDUu4TbMxLxp8jfKq6YLRKI0lTGdw=; b=RzKyq0uVumF4owCRnciVp3DubKypYYzZfuScqnTXe1+VjsHa6xZ+0xxY1N9pO9lU/aa2U5 g4GheaAVKhCpJ6CCQ8EAjKura4/6qMSIBGUtNEG3uONGoLB0bFnOK+5tdYjzq+bMMrkx+6 cUeOADab5eh6RaKVh+Qy7MWFQ3kQqSDtDBMHP39lngdELb51AV/IppDbLWxpBXq8pyoFgW /uj9XR+HLRU77Jcrh26zu/xih0ICt5sIboNI3dGe+qz4G1rjTYDYtsjZonAXD+R4PnQVyQ Phk1I+80cKou/k2bIC3kYufbUiuKK9wLWkflsbiD1882OU5w6RMYaj8AeEgUIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484094; a=rsa-sha256; cv=none; b=K5yLYA5Yh8y3igWNJRCbY64AhFoWq3GZLIH5nHrQ+s/NFJ2vB9AsGKIl0bY4XMuYgKYiC6 tfDIF+6DsbDYsENOaq/qiQ5Z+TEFp/z/HPNYqaiRc1OIYabZyAcCRSNg1fp/KlW44ldrHM aAQQCU1Ojzh0obo14h02Et5o2ea5pUiiNjw8ursl1LyCE7guN71CDQac586xwlYfGozujO wC1B/BoMn7mpKKlRgX4I8Q46g8kLQBf53k3k8imTCjSs9CanEGwD+SBrcDH0uvtmkapH8h +hsviIflYO8u2ZFikGpm8ZCNtPWEpuSWf46gYPs24GLt/GXOsVAvk9cJEJ938w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484094; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nY4SzJdaVFuGM1HDUu4TbMxLxp8jfKq6YLRKI0lTGdw=; b=GJHT1zzdbEdOuqh4QNd08ZLH2LayqYhSPSEZeOmdHw46uMNvtGPN7q6LCniVqFnY5mnoC7 FFiflGb7WgmJhzBeAXoyQs3w6eq8Jbme6Ak9hRWwYNGCfBxjB2HmULRbjsIcdzbncyA7vt BiVhCk0eQgRC9WsqTqI9XFp05untnjzPLZk77ZWJH/VtQizNDbBjiVE92etRzHfKet7cTa VDhL8mdnRBUJWjjdj8c3rVWD0B5GNClzO+nIt2WnSO4GojVjNEgT4zAFLTrZEPGqk4o49l FoGUb3Rs0yurWrCyd71l3P3mkVAEi+2RJvYMSqSHS1dMx4lMBm18k7ZRvOw6WQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2G7x55mmz91r; Tue, 25 Feb 2025 11:48:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PBmDB8050868; Tue, 25 Feb 2025 11:48:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PBmD45050865; Tue, 25 Feb 2025 11:48:13 GMT (envelope-from git) Date: Tue, 25 Feb 2025 11:48:13 GMT Message-Id: <202502251148.51PBmD45050865@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: d39be38a3533 - main - sound: Report actual vchanrate and vchanformat in sysctl List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d39be38a353323d05744eeb3e08267108e55b9b1 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=d39be38a353323d05744eeb3e08267108e55b9b1 commit d39be38a353323d05744eeb3e08267108e55b9b1 Author: Christos Margiolis AuthorDate: 2025-02-25 11:43:33 +0000 Commit: Christos Margiolis CommitDate: 2025-02-25 11:43:33 +0000 sound: Report actual vchanrate and vchanformat in sysctl Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D48435 --- sys/dev/sound/pcm/vchan.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c index 4ee7e01066d3..b0caec3acfec 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -497,9 +497,7 @@ sysctl_dev_pcm_vchanrate(SYSCTL_HANDLER_ARGS) KASSERT(direction == c->direction, ("%s(): invalid direction %d/%d", __func__, direction, c->direction)); - CHN_LOCK(c); - newspd = c->speed; - CHN_UNLOCK(c); + newspd = *vchanrate; ret = sysctl_handle_int(oidp, &newspd, 0, req); if (ret != 0 || req->newptr == NULL) { @@ -530,7 +528,6 @@ sysctl_dev_pcm_vchanrate(SYSCTL_HANDLER_ARGS) ret = chn_reset(c, c->format, newspd); if (ret == 0) { - *vchanrate = c->speed; if (restart != 0) { CHN_FOREACH(ch, c, children.busy) { CHN_LOCK(ch); @@ -543,6 +540,7 @@ sysctl_dev_pcm_vchanrate(SYSCTL_HANDLER_ARGS) } } } + *vchanrate = c->speed; CHN_UNLOCK(c); @@ -605,15 +603,11 @@ sysctl_dev_pcm_vchanformat(SYSCTL_HANDLER_ARGS) KASSERT(direction == c->direction, ("%s(): invalid direction %d/%d", __func__, direction, c->direction)); - CHN_LOCK(c); - bzero(fmtstr, sizeof(fmtstr)); - if (snd_afmt2str(c->format, fmtstr, sizeof(fmtstr)) != c->format) + if (snd_afmt2str(*vchanformat, fmtstr, sizeof(fmtstr)) != *vchanformat) strlcpy(fmtstr, "", sizeof(fmtstr)); - CHN_UNLOCK(c); - ret = sysctl_handle_string(oidp, fmtstr, sizeof(fmtstr), req); if (ret != 0 || req->newptr == NULL) { PCM_RELEASE_QUICK(d); @@ -637,7 +631,6 @@ sysctl_dev_pcm_vchanformat(SYSCTL_HANDLER_ARGS) ret = chn_reset(c, newfmt, c->speed); if (ret == 0) { - *vchanformat = c->format; if (restart != 0) { CHN_FOREACH(ch, c, children.busy) { CHN_LOCK(ch); @@ -650,6 +643,7 @@ sysctl_dev_pcm_vchanformat(SYSCTL_HANDLER_ARGS) } } } + *vchanformat = c->format; CHN_UNLOCK(c); From nobody Tue Feb 25 11:48:15 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2G8145Dfz5pjnf; Tue, 25 Feb 2025 11:48:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2G800DYdz3kFH; Tue, 25 Feb 2025 11:48:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484096; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WVNIKQ6BgLfoVRHWC7ltZ8XzbpI1gKHwT2wDQRdhX+g=; b=CBP+kupPXD50ahFgQ7f3HBZvHRgRALuRAC5LKNEIV0qTjW6lKlXO40EKIr8ZwLRU3x5pok hAkP8wUSOsEz0kvUK8SAeGWBRnLwkDTl51ab75Vkk5xw0kYAeQMdVJAmtLDLYrtEa+X0PH UUsf2X3uvuqPexbH7j1L6ZENQIl90ev3pBvSH88bUmgJjwefGwsz5a2hlHw1lYvSjLmlzl CZBr3Zy8UsTU3rDWAzdC5vQ1dJ1HgdBRzTgAvUrSXv0TOT9C4qbwvM4C+/B01KaHg9N0jD wvDfd6D8wCpQ0rnecmXhKDATRaqw7SHZi4NWG6ULSbX/tFVhOVYFThZBY15xWA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484096; a=rsa-sha256; cv=none; b=Oey8eFl3Uy2ZMv1Rv6ymv86LAYqzsfnhnPKmOH8HwrRHCmI/CUGzaf7HNBdVgKx3/i4cbL 3hB+fg62lBNWok5uDyNp8KZ+z5Y/QZo8CZu9Fvg3AWYibcPCveaT8A7EYNIZRIb+nu5u02 UP9m0QJTRjmaFhkRxsVT7x7GwpMYE5HLmpzy7nQu4wHFAu2bZrNUGsn+lamJ0+zqAzAkEC L3WL0XHc2vliFPGPvIf/4FBusThdEaJm3kLd/b8k0MMSLgYj/UwGahBYxIX7FQ2HKpUUoo F5aYW73j1jnuyPMttgyZaaNbJ3P77erbyMBQOQ8KyGmSJuWvAyf4Y+UzvFD7cQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484096; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WVNIKQ6BgLfoVRHWC7ltZ8XzbpI1gKHwT2wDQRdhX+g=; b=hRBN7/MemjIxikFetYL7MmDkLdxHccNdcgeLJzwSv3aTh0A9yCfyHQqYRWu9tfj2E0bny5 KhwBD5SdSOTJwkePgsZoyd3cPsWIXGpmhvNopsHxqM78d6HQdkgkaCSrNLttOKiPYn+dZw rqMb+7QVUKOvKUgoYQZr6qXvqc8IoyVN6UEhXP+tJeL7Q5OvoJy10rpyRmO3sr5xdPtO1B wLLTaUSoMpwqbyCrxAv9tPjjEJF5ceCCdqNdGhYlYeT2mwnMWpptrcY7NaCQFUv0vZIczL v41Osrq4bJyfefKn++MGtblk+wurIdsBiBqumS7YxGoOFzOrMOgWn/cNeMHC/Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2G7z6LjMz8ph; Tue, 25 Feb 2025 11:48:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PBmFmT050933; Tue, 25 Feb 2025 11:48:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PBmFrh050930; Tue, 25 Feb 2025 11:48:15 GMT (envelope-from git) Date: Tue, 25 Feb 2025 11:48:15 GMT Message-Id: <202502251148.51PBmFrh050930@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: b50f53cf872e - main - sound: Cache vchanmode List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b50f53cf872eca6b9a174a51fa183e8c2f88d97c Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=b50f53cf872eca6b9a174a51fa183e8c2f88d97c commit b50f53cf872eca6b9a174a51fa183e8c2f88d97c Author: Christos Margiolis AuthorDate: 2025-02-25 11:43:46 +0000 Commit: Christos Margiolis CommitDate: 2025-02-25 11:43:46 +0000 sound: Cache vchanmode We already cache vchanrate and vchanformat. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D48335 --- sys/dev/sound/pcm/sound.h | 4 ++-- sys/dev/sound/pcm/vchan.c | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index 0452a58dfcbf..92d6e79600d1 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -238,8 +238,8 @@ struct snddev_info { struct mtx *lock; struct cdev *mixer_dev; struct cdev *dsp_dev; - uint32_t pvchanrate, pvchanformat; - uint32_t rvchanrate, rvchanformat; + uint32_t pvchanrate, pvchanformat, pvchanmode; + uint32_t rvchanrate, rvchanformat, rvchanmode; int32_t eqpreamp; struct sysctl_ctx_list play_sysctl_ctx, rec_sysctl_ctx; struct sysctl_oid *play_sysctl_tree, *rec_sysctl_tree; diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c index 297120199fe7..379d647cbcf8 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -356,7 +356,7 @@ sysctl_dev_pcm_vchanmode(SYSCTL_HANDLER_ARGS) struct snddev_info *d; struct pcm_channel *c; uint32_t dflags; - int direction, ret; + int *vchanmode, direction, ret; char dtype[16]; d = devclass_get_softc(pcm_devclass, VCHAN_SYSCTL_UNIT(oidp->oid_arg1)); @@ -373,6 +373,7 @@ sysctl_dev_pcm_vchanmode(SYSCTL_HANDLER_ARGS) return (ENODEV); } direction = PCMDIR_PLAY; + vchanmode = &d->pvchanmode; break; case VCHAN_REC: if ((d->flags & SD_F_RVCHANS) == 0) { @@ -380,6 +381,7 @@ sysctl_dev_pcm_vchanmode(SYSCTL_HANDLER_ARGS) return (ENODEV); } direction = PCMDIR_REC; + vchanmode = &d->rvchanmode; break; default: PCM_UNLOCK(d); @@ -402,14 +404,12 @@ sysctl_dev_pcm_vchanmode(SYSCTL_HANDLER_ARGS) KASSERT(direction == c->direction, ("%s(): invalid direction %d/%d", __func__, direction, c->direction)); - CHN_LOCK(c); - if (c->flags & CHN_F_VCHAN_PASSTHROUGH) + if (*vchanmode & CHN_F_VCHAN_PASSTHROUGH) strlcpy(dtype, "passthrough", sizeof(dtype)); - else if (c->flags & CHN_F_VCHAN_ADAPTIVE) + else if (*vchanmode & CHN_F_VCHAN_ADAPTIVE) strlcpy(dtype, "adaptive", sizeof(dtype)); else strlcpy(dtype, "fixed", sizeof(dtype)); - CHN_UNLOCK(c); ret = sysctl_handle_string(oidp, dtype, sizeof(dtype), req); if (ret == 0 && req->newptr != NULL) { @@ -436,6 +436,7 @@ sysctl_dev_pcm_vchanmode(SYSCTL_HANDLER_ARGS) c->flags &= ~CHN_F_VCHAN_DYNAMIC; c->flags |= dflags; CHN_UNLOCK(c); + *vchanmode = dflags; } PCM_RELEASE_QUICK(d); From nobody Tue Feb 25 11:48:14 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2G815GpNz5pjb1; Tue, 25 Feb 2025 11:48:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2G7z19cvz3kF9; Tue, 25 Feb 2025 11:48:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484095; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=A3UMUNLZMYNTG7b3TvwpVpWiMVszgTvCA9OzcHBGDQs=; b=kmBqqG4KPg1ihsFWX5XXamf1liBcFAm6Pvqdw9wG/IzRvB2+sQ2d/qf89WKqsOIYR6U+YK ZNBgASeWJ2t+i/HGnhrBh3yzu1ZZOaYnFYUsqDKc4rO8hG/vbIi/jvnAJ2y7Xmq3W1xczW sij1lp4cYTn4mtR9FVxuZoiHeek1dYrhEdee02aKDtLEjYdebqv84uB8T7sWBIagPV8e0O W5oW6z28gyXXsvbvdic6tfViqrRJIuvrsH0dxXjhdFUDZT/3rgJpzvEdfrST3XvHZmwJ8O 6b93lZkWSxQmo6HJe8GeoKIP33MzKpehTN8r6s2cXrwT2xzflv9GqsFbwI58cg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484095; a=rsa-sha256; cv=none; b=jTP55hzen88OCKCgh2Gv0+HagqgqAjztNTHvZjGsJjrPhCokywS/Bj4uXDDqdtNjw63MFF QSQSYY331OYvGYMKv5VKV4+pg/Sbd3+5pqArRb9BePikqJ606m6Jr4/GlEVmBq1KPmOjBl Zsd1sPH0qbN6ULvrNaxAdhFJEdIgBNOXeyQV8BLgWGRQKMViSTCerg6qpqCeUl00p1+4X0 VpJKsE/d++4nIVBz7mfKaNH1V5x2OSftQPYpymVL4w6CrjPfQMhEQm5Bg7sohJ4e1GA+2u bpvZPviUOE1yxqpKD9b0DXF4b12rO23uRRmwXHlu8ZGaZ1Wb5gG07a6qY2RcrA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484095; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=A3UMUNLZMYNTG7b3TvwpVpWiMVszgTvCA9OzcHBGDQs=; b=coIiHL6I5delfeFhxzLKvNXYNZ+XKKf/1IaKGyykDBCP1AeY1Rhnxyya+w2L5e7mMwJLmX OJCUV6zHcgAVDQwrgG+85Dm+zyA2sy32qAnKPtn0CQw2jErbI0Q3La5mReMir7UR0wK1Yn tPdcYSaCBg8Yv+ZlMzVwpNkNpxlOyNvOhjrq/VgfrmF0MYSVQWnwyr5idNIjC+hj79Y5N1 sJriEto8D4VxIeDNYdxICf1YrHG7EQrqTdxpS4ZmhLQtvo4Jiwv8L6aafKMjigKp02lrWX IpaAQKJTEwUrXEIVBr5z6O2m9caPgyuvI/RxTt9W7ltt8dwsZM6yYbB3tlKh4w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2G7y5Qfrz810; Tue, 25 Feb 2025 11:48:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PBmEwj050901; Tue, 25 Feb 2025 11:48:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PBmEaZ050898; Tue, 25 Feb 2025 11:48:14 GMT (envelope-from git) Date: Tue, 25 Feb 2025 11:48:14 GMT Message-Id: <202502251148.51PBmEaZ050898@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 02d4eeabfd73 - main - sound: Allocate vchans on-demand List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 02d4eeabfd73e6a827f5d42601e99aad92060b04 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=02d4eeabfd73e6a827f5d42601e99aad92060b04 commit 02d4eeabfd73e6a827f5d42601e99aad92060b04 Author: Christos Margiolis AuthorDate: 2025-02-25 11:43:39 +0000 Commit: Christos Margiolis CommitDate: 2025-02-25 11:43:39 +0000 sound: Allocate vchans on-demand Refactor pcm_chnalloc() and merge with parts of vchan_setnew() (now removed) and dsp_open()’s channel creation into a new dsp_chn_alloc() function. The function is responsible for either using a free HW channel (if vchans are disabled), or allocating a new vchan. Clean up allocated vchans associated with a given dsp_cdevpriv on dsp_close() instead of leaving them unused. hw.snd.vchans_enable (previously hw.snd.maxautovchans) and dev.pcm.X.{play|rec}.vchans now work as tunables to only enable/disable vchans, as opposed to setting their number and/or (de-)allocating vchans. Since these sysctls do not trigger any (de-)allocations anymore, their effect is instantaneous, whereas before we could have frozen the machine (when trying to allocate new vchans) when setting dev.pcm.X.{play|rec}.vchans to a very large value. Create a new "primary" channel sublist so that we do not waste time looping through all channels in dsp_chn_alloc(), since we are only looking for a parent channel to either use, or add a new vchan to. This guarantees a steady traversal speed, as the parent channels are most likely going to be just a handful (2). What was currently in place was a loop through the whole channel list, which meant that the traversal would take longer the more channels were added to that list. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D47917 --- share/man/man4/pcm.4 | 23 ++-- sys/dev/sound/pcm/channel.c | 14 ++- sys/dev/sound/pcm/channel.h | 3 + sys/dev/sound/pcm/dsp.c | 233 ++++++++++++++++++++---------------- sys/dev/sound/pcm/sound.c | 70 ++--------- sys/dev/sound/pcm/sound.h | 13 +- sys/dev/sound/pcm/vchan.c | 285 +++++++++++++------------------------------- sys/dev/sound/pcm/vchan.h | 7 +- 8 files changed, 254 insertions(+), 394 deletions(-) diff --git a/share/man/man4/pcm.4 b/share/man/man4/pcm.4 index 769f562fe91e..e25ffe264ae8 100644 --- a/share/man/man4/pcm.4 +++ b/share/man/man4/pcm.4 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 24, 2024 +.Dd December 4, 2024 .Dt SOUND 4 .Os .Sh NAME @@ -360,14 +360,12 @@ A value of 0 will use a low and aggressive latency profile which can result in possible underruns if the application cannot keep up with a rapid irq rate, especially during high workload. The default value is 1, which is considered a moderate/safe latency profile. -.It Va hw.snd.maxautovchans -Global VCHAN setting that only affects devices with at least one playback or -recording channel available. -The sound system will dynamically create up to this many VCHANs. -Set to -.Dq 0 -if no VCHANs are desired. -Maximum value is 256. +.It Va hw.snd.vchans_enable +Global VCHAN setting to enable (1) or disable (0) VCHANs. +This setting can be overridden for an individual device by using the +.Va dev.pcm.%d.[play|rec].vchans +tunables. +Default is enabled. .It Va hw.snd.report_soft_formats Controls the internal format conversion if it is available transparently to the application software. @@ -434,11 +432,8 @@ The recommended way to use bitperfect mode is to disable VCHANs and enable this sysctl. Default is disabled. .It Va dev.pcm.%d.[play|rec].vchans -The current number of VCHANs allocated per device. -This can be set to preallocate a certain number of VCHANs. -Setting this value to -.Dq 0 -will disable VCHANs for this device. +Enable (1) or disable (0) VCHANs. +Default is enabled. .It Va dev.pcm.%d.[play|rec].vchanformat Format for VCHAN mixing. All playback paths will be converted to this format before the mixing diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 58315610312e..17c11dc33b7a 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1172,7 +1172,7 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, struct feeder_class *fc; struct snd_dbuf *b, *bs; char buf[CHN_NAMELEN]; - int i, direction; + int err, i, direction; PCM_BUSYASSERT(d); PCM_LOCKASSERT(d); @@ -1279,8 +1279,18 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, bs->shadbuf = malloc(bs->sl, M_DEVBUF, M_WAITOK); } + if ((c->flags & CHN_F_VIRTUAL) == 0) { + CHN_LOCK(c); + err = chn_reset(c, c->format, c->speed); + CHN_UNLOCK(c); + if (err != 0) + goto fail; + } + PCM_LOCK(d); CHN_INSERT_SORT_ASCEND(d, c, channels.pcm); + if ((c->flags & CHN_F_VIRTUAL) == 0) + CHN_INSERT_SORT_ASCEND(d, c, channels.pcm.primary); switch (c->type) { case PCMDIR_PLAY: @@ -1332,6 +1342,8 @@ chn_kill(struct pcm_channel *c) PCM_LOCK(d); CHN_REMOVE(d, c, channels.pcm); + if ((c->flags & CHN_F_VIRTUAL) == 0) + CHN_REMOVE(d, c, channels.pcm.primary); switch (c->type) { case PCMDIR_PLAY: diff --git a/sys/dev/sound/pcm/channel.h b/sys/dev/sound/pcm/channel.h index 6eaad8cc2c0b..31c617a6df78 100644 --- a/sys/dev/sound/pcm/channel.h +++ b/sys/dev/sound/pcm/channel.h @@ -160,6 +160,9 @@ struct pcm_channel { struct { SLIST_ENTRY(pcm_channel) link; } opened; + struct { + SLIST_ENTRY(pcm_channel) link; + } primary; } pcm; } channels; diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index dcbdd581c82a..88e0580c5c45 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -37,6 +37,7 @@ #endif #include +#include #include #include #include @@ -158,6 +159,81 @@ dsp_unlock_chans(struct dsp_cdevpriv *priv, uint32_t prio) CHN_UNLOCK(priv->wrch); } +static int +dsp_chn_alloc(struct snddev_info *d, struct pcm_channel **ch, int direction, + int flags, struct thread *td) +{ + struct pcm_channel *c; + char *comm; + pid_t pid; + int err; + bool vdir_enabled; + + KASSERT(d != NULL && ch != NULL && + (direction == PCMDIR_PLAY || direction == PCMDIR_REC), + ("%s(): invalid d=%p ch=%p direction=%d", + __func__, d, ch, direction)); + PCM_BUSYASSERT(d); + + pid = td->td_proc->p_pid; + comm = td->td_proc->p_comm; + + vdir_enabled = (direction == PCMDIR_PLAY && d->flags & SD_F_PVCHANS) || + (direction == PCMDIR_REC && d->flags & SD_F_RVCHANS); + + *ch = NULL; + CHN_FOREACH(c, d, channels.pcm.primary) { + CHN_LOCK(c); + if (c->direction != direction) { + CHN_UNLOCK(c); + continue; + } + /* Find an available primary channel to use. */ + if ((c->flags & CHN_F_BUSY) == 0 || + (vdir_enabled && (c->flags & CHN_F_HAS_VCHAN))) + break; + CHN_UNLOCK(c); + } + if (c == NULL) + return (EBUSY); + + /* + * We can have the following cases: + * - vchans are enabled, add a new vchan to the primary channel. + * - vchans are disabled, use the primary channel directly. + */ + if (vdir_enabled && ((c->flags & CHN_F_BUSY) == 0 || + c->flags & CHN_F_HAS_VCHAN)) { + err = vchan_create(c, ch); + CHN_UNLOCK(c); + if (err != 0) + return (err); + CHN_LOCK(*ch); + } else if ((c->flags & CHN_F_BUSY) == 0) { + *ch = c; + } else { + CHN_UNLOCK(c); + return (ENODEV); + } + + (*ch)->flags |= CHN_F_BUSY; + if (flags & O_NONBLOCK) + (*ch)->flags |= CHN_F_NBIO; + if (flags & O_EXCL) + (*ch)->flags |= CHN_F_EXCLUSIVE; + (*ch)->pid = pid; + strlcpy((*ch)->comm, (comm != NULL) ? comm : CHN_COMM_UNKNOWN, + sizeof((*ch)->comm)); + + if ((err = chn_reset(*ch, (*ch)->format, (*ch)->speed)) != 0) + return (err); + chn_vpc_reset(*ch, SND_VOL_C_PCM, 0); + + CHN_UNLOCK(*ch); + + return (0); +} + #define DSP_F_VALID(x) ((x) & (FREAD | FWRITE)) #define DSP_F_DUPLEX(x) (((x) & (FREAD | FWRITE)) == (FREAD | FWRITE)) #define DSP_F_SIMPLEX(x) (!DSP_F_DUPLEX(x)) @@ -168,7 +244,7 @@ static void dsp_close(void *data) { struct dsp_cdevpriv *priv = data; - struct pcm_channel *rdch, *wrch; + struct pcm_channel *rdch, *wrch, *parent; struct snddev_info *d; int sg_ids; @@ -214,12 +290,20 @@ dsp_close(void *data) if (sg_ids != 0) free_unr(pcmsg_unrhdr, sg_ids); - CHN_LOCK(rdch); - chn_abort(rdch); /* won't sleep */ - rdch->flags &= ~(CHN_F_RUNNING | CHN_F_MMAP | - CHN_F_DEAD | CHN_F_EXCLUSIVE); - chn_reset(rdch, 0, 0); - chn_release(rdch); + if (rdch->flags & CHN_F_VIRTUAL) { + parent = rdch->parentchannel; + CHN_LOCK(parent); + CHN_LOCK(rdch); + vchan_destroy(rdch); + CHN_UNLOCK(parent); + } else { + CHN_LOCK(rdch); + chn_abort(rdch); /* won't sleep */ + rdch->flags &= ~(CHN_F_RUNNING | CHN_F_MMAP | + CHN_F_DEAD | CHN_F_EXCLUSIVE); + chn_reset(rdch, 0, 0); + chn_release(rdch); + } } if (wrch != NULL) { /* @@ -231,12 +315,20 @@ dsp_close(void *data) if (sg_ids != 0) free_unr(pcmsg_unrhdr, sg_ids); - CHN_LOCK(wrch); - chn_flush(wrch); /* may sleep */ - wrch->flags &= ~(CHN_F_RUNNING | CHN_F_MMAP | - CHN_F_DEAD | CHN_F_EXCLUSIVE); - chn_reset(wrch, 0, 0); - chn_release(wrch); + if (wrch->flags & CHN_F_VIRTUAL) { + parent = wrch->parentchannel; + CHN_LOCK(parent); + CHN_LOCK(wrch); + vchan_destroy(wrch); + CHN_UNLOCK(parent); + } else { + CHN_LOCK(wrch); + chn_flush(wrch); /* may sleep */ + wrch->flags &= ~(CHN_F_RUNNING | CHN_F_MMAP | + CHN_F_DEAD | CHN_F_EXCLUSIVE); + chn_reset(wrch, 0, 0); + chn_release(wrch); + } } PCM_LOCK(d); } @@ -254,10 +346,9 @@ static int dsp_open(struct cdev *i_dev, int flags, int mode, struct thread *td) { struct dsp_cdevpriv *priv; - struct pcm_channel *rdch, *wrch, *ch; + struct pcm_channel *ch; struct snddev_info *d; - uint32_t fmt, spd; - int error, rderror, wrerror, dir; + int error, dir; /* Kind of impossible.. */ if (i_dev == NULL || td == NULL) @@ -267,11 +358,11 @@ dsp_open(struct cdev *i_dev, int flags, int mode, struct thread *td) if (!DSP_REGISTERED(d)) return (EBADF); + if (PCM_CHANCOUNT(d) >= PCM_MAXCHANS) + return (ENOMEM); + priv = malloc(sizeof(*priv), M_DEVBUF, M_WAITOK | M_ZERO); priv->sc = d; - priv->rdch = NULL; - priv->wrch = NULL; - priv->volch = NULL; error = devfs_set_cdevpriv(priv, dsp_close); if (error != 0) @@ -334,98 +425,30 @@ dsp_open(struct cdev *i_dev, int flags, int mode, struct thread *td) PCM_ACQUIRE(d); PCM_UNLOCK(d); - fmt = SND_FORMAT(AFMT_U8, 1, 0); - spd = DSP_DEFAULT_SPEED; - - rdch = NULL; - wrch = NULL; - rderror = 0; - wrerror = 0; - - if (DSP_F_READ(flags)) { - /* open for read */ - rderror = pcm_chnalloc(d, &rdch, PCMDIR_REC, - td->td_proc->p_pid, td->td_proc->p_comm); - - if (rderror == 0 && chn_reset(rdch, fmt, spd) != 0) - rderror = ENXIO; - - if (rderror != 0) { - if (rdch != NULL) - chn_release(rdch); - if (!DSP_F_DUPLEX(flags)) { - PCM_RELEASE_QUICK(d); - PCM_GIANT_EXIT(d); - return (rderror); - } - rdch = NULL; - } else { - if (flags & O_NONBLOCK) - rdch->flags |= CHN_F_NBIO; - if (flags & O_EXCL) - rdch->flags |= CHN_F_EXCLUSIVE; - chn_vpc_reset(rdch, SND_VOL_C_PCM, 0); - CHN_UNLOCK(rdch); - } - } - if (DSP_F_WRITE(flags)) { - /* open for write */ - wrerror = pcm_chnalloc(d, &wrch, PCMDIR_PLAY, - td->td_proc->p_pid, td->td_proc->p_comm); - - if (wrerror == 0 && chn_reset(wrch, fmt, spd) != 0) - wrerror = ENXIO; - - if (wrerror != 0) { - if (wrch != NULL) - chn_release(wrch); - if (!DSP_F_DUPLEX(flags)) { - if (rdch != NULL) { - /* - * Lock, and release previously created - * record channel - */ - CHN_LOCK(rdch); - chn_release(rdch); - } - PCM_RELEASE_QUICK(d); - PCM_GIANT_EXIT(d); - return (wrerror); - } - wrch = NULL; - } else { - if (flags & O_NONBLOCK) - wrch->flags |= CHN_F_NBIO; - if (flags & O_EXCL) - wrch->flags |= CHN_F_EXCLUSIVE; - chn_vpc_reset(wrch, SND_VOL_C_PCM, 0); - CHN_UNLOCK(wrch); + error = dsp_chn_alloc(d, &priv->wrch, PCMDIR_PLAY, flags, td); + if (error != 0) { + PCM_RELEASE_QUICK(d); + PCM_GIANT_EXIT(d); + return (error); } + PCM_LOCK(d); + CHN_INSERT_HEAD(d, priv->wrch, channels.pcm.opened); + PCM_UNLOCK(d); } - - PCM_LOCK(d); - - if (wrch == NULL && rdch == NULL) { - PCM_RELEASE(d); + if (DSP_F_READ(flags)) { + error = dsp_chn_alloc(d, &priv->rdch, PCMDIR_REC, flags, td); + if (error != 0) { + PCM_RELEASE_QUICK(d); + PCM_GIANT_EXIT(d); + return (error); + } + PCM_LOCK(d); + CHN_INSERT_HEAD(d, priv->rdch, channels.pcm.opened); PCM_UNLOCK(d); - PCM_GIANT_EXIT(d); - if (wrerror != 0) - return (wrerror); - if (rderror != 0) - return (rderror); - return (EINVAL); } - if (rdch != NULL) - CHN_INSERT_HEAD(d, rdch, channels.pcm.opened); - if (wrch != NULL) - CHN_INSERT_HEAD(d, wrch, channels.pcm.opened); - priv->rdch = rdch; - priv->wrch = wrch; - - PCM_RELEASE(d); - PCM_UNLOCK(d); + PCM_RELEASE_QUICK(d); PCM_GIANT_LEAVE(d); return (0); diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index 2d57852e036d..c0934dde7718 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -107,62 +107,6 @@ snd_setup_intr(device_t dev, struct resource *res, int flags, driver_intr_t hand return bus_setup_intr(dev, res, flags, NULL, hand, param, cookiep); } -int -pcm_chnalloc(struct snddev_info *d, struct pcm_channel **ch, int direction, - pid_t pid, char *comm) -{ - struct pcm_channel *c; - int err, vchancount; - bool retry; - - KASSERT(d != NULL && ch != NULL && - (direction == PCMDIR_PLAY || direction == PCMDIR_REC), - ("%s(): invalid d=%p ch=%p direction=%d pid=%d", - __func__, d, ch, direction, pid)); - PCM_BUSYASSERT(d); - - *ch = NULL; - vchancount = (direction == PCMDIR_PLAY) ? d->pvchancount : - d->rvchancount; - retry = false; - -retry_chnalloc: - /* Scan for a free channel. */ - CHN_FOREACH(c, d, channels.pcm) { - CHN_LOCK(c); - if (c->direction != direction) { - CHN_UNLOCK(c); - continue; - } - if (!(c->flags & CHN_F_BUSY)) { - c->flags |= CHN_F_BUSY; - c->pid = pid; - strlcpy(c->comm, (comm != NULL) ? comm : - CHN_COMM_UNKNOWN, sizeof(c->comm)); - *ch = c; - - return (0); - } - CHN_UNLOCK(c); - } - /* Maybe next time... */ - if (retry) - return (EBUSY); - - /* No channel available. We also cannot create more VCHANs. */ - if (!(vchancount > 0 && vchancount < snd_maxautovchans)) - return (ENOTSUP); - - /* Increase the VCHAN count and try to get the new channel. */ - err = vchan_setnew(d, direction, vchancount + 1); - if (err == 0) { - retry = true; - goto retry_chnalloc; - } - - return (err); -} - static int sysctl_hw_snd_default_unit(SYSCTL_HANDLER_ARGS) { @@ -472,6 +416,7 @@ pcm_init(device_t dev, void *devinfo) CHN_INIT(d, channels.pcm); CHN_INIT(d, channels.pcm.busy); CHN_INIT(d, channels.pcm.opened); + CHN_INIT(d, channels.pcm.primary); } int @@ -491,7 +436,10 @@ pcm_register(device_t dev, char *str) if (d->playcount > 0 || d->reccount > 0) d->flags |= SD_F_AUTOVCHAN; - vchan_setmaxauto(d, snd_maxautovchans); + if (d->playcount > 0) + d->flags |= SD_F_PVCHANS; + if (d->reccount > 0) + d->flags |= SD_F_RVCHANS; strlcpy(d->status, str, SND_STATUSLEN); sndstat_register(dev, d->status); @@ -733,9 +681,7 @@ sound_global_init(void) if (snd_unit < 0) snd_unit = -1; - if (snd_maxautovchans < 0 || - snd_maxautovchans > SND_MAXVCHANS) - snd_maxautovchans = 0; + snd_vchans_enable = true; if (chn_latency < CHN_LATENCY_MIN || chn_latency > CHN_LATENCY_MAX) @@ -759,11 +705,11 @@ sound_global_init(void) feeder_rate_round = FEEDRATE_ROUNDHZ; if (bootverbose) - printf("%s: snd_unit=%d snd_maxautovchans=%d " + printf("%s: snd_unit=%d snd_vchans_enable=%d " "latency=%d " "feeder_rate_min=%d feeder_rate_max=%d " "feeder_rate_round=%d\n", - __func__, snd_unit, snd_maxautovchans, + __func__, snd_unit, snd_vchans_enable, chn_latency, feeder_rate_min, feeder_rate_max, feeder_rate_round); diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index 019fe67ac892..0452a58dfcbf 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -99,8 +99,6 @@ struct snd_mixer; #define SOUND_PREFVER SOUND_MODVER #define SOUND_MAXVER SOUND_MODVER -#define SND_MAXVCHANS 256 - #define SD_F_SIMPLEX 0x00000001 #define SD_F_AUTOVCHAN 0x00000002 #define SD_F_SOFTPCMVOL 0x00000004 @@ -113,6 +111,8 @@ struct snd_mixer; #define SD_F_EQ_ENABLED 0x00000200 /* EQ enabled */ #define SD_F_EQ_BYPASSED 0x00000400 /* EQ bypassed */ #define SD_F_EQ_PC 0x00000800 /* EQ per-channel */ +#define SD_F_PVCHANS 0x00001000 /* Playback vchans enabled */ +#define SD_F_RVCHANS 0x00002000 /* Recording vchans enabled */ #define SD_F_EQ_DEFAULT (SD_F_EQ | SD_F_EQ_ENABLED) #define SD_F_EQ_MASK (SD_F_EQ | SD_F_EQ_ENABLED | \ @@ -134,12 +134,15 @@ struct snd_mixer; "\012EQ_ENABLED" \ "\013EQ_BYPASSED" \ "\014EQ_PC" \ + "\015PVCHANS" \ + "\016RVCHANS" \ "\035PRIO_RD" \ "\036PRIO_WR" #define PCM_ALIVE(x) ((x) != NULL && (x)->lock != NULL) #define PCM_REGISTERED(x) (PCM_ALIVE(x) && ((x)->flags & SD_F_REGISTERED)) +#define PCM_MAXCHANS 10000 #define PCM_CHANCOUNT(d) \ (d->playcount + d->pvchancount + d->reccount + d->rvchancount) @@ -168,9 +171,6 @@ extern struct unrhdr *pcmsg_unrhdr; SYSCTL_DECL(_hw_snd); -int pcm_chnalloc(struct snddev_info *d, struct pcm_channel **ch, int direction, - pid_t pid, char *comm); - int pcm_addchan(device_t dev, int dir, kobj_class_t cls, void *devinfo); unsigned int pcm_getbuffersize(device_t dev, unsigned int minbufsz, unsigned int deflt, unsigned int maxbufsz); void pcm_init(device_t dev, void *devinfo); @@ -224,6 +224,9 @@ struct snddev_info { struct { SLIST_HEAD(, pcm_channel) head; } opened; + struct { + SLIST_HEAD(, pcm_channel) head; + } primary; } pcm; } channels; unsigned playcount, reccount, pvchancount, rvchancount; diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c index b0caec3acfec..297120199fe7 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -61,7 +61,7 @@ struct vchan_info { int trigger; }; -int snd_maxautovchans = 16; +bool snd_vchans_enable = true; static void * vchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, @@ -277,7 +277,7 @@ vchan_getparentchannel(struct snddev_info *d, *ch = NULL; break; } - } else if (c->flags & CHN_F_HAS_VCHAN) { + } else { /* No way!! */ if (*ch != NULL) { CHN_UNLOCK(c); @@ -299,8 +299,7 @@ static int sysctl_dev_pcm_vchans(SYSCTL_HANDLER_ARGS) { struct snddev_info *d; - int direction, vchancount; - int err, cnt; + int err, enabled, flag; d = devclass_get_softc(pcm_devclass, VCHAN_SYSCTL_UNIT(oidp->oid_arg1)); if (!PCM_REGISTERED(d) || !(d->flags & SD_F_AUTOVCHAN)) @@ -311,43 +310,44 @@ sysctl_dev_pcm_vchans(SYSCTL_HANDLER_ARGS) switch (VCHAN_SYSCTL_DIR(oidp->oid_arg1)) { case VCHAN_PLAY: - direction = PCMDIR_PLAY; - vchancount = d->pvchancount; - cnt = d->playcount; + /* Exit if we do not support this direction. */ + if (d->playcount < 1) { + PCM_UNLOCK(d); + return (ENODEV); + } + flag = SD_F_PVCHANS; break; case VCHAN_REC: - direction = PCMDIR_REC; - vchancount = d->rvchancount; - cnt = d->reccount; + if (d->reccount < 1) { + PCM_UNLOCK(d); + return (ENODEV); + } + flag = SD_F_RVCHANS; break; default: PCM_UNLOCK(d); return (EINVAL); - break; } - if (cnt < 1) { - PCM_UNLOCK(d); - return (ENODEV); - } + enabled = (d->flags & flag) != 0; PCM_ACQUIRE(d); PCM_UNLOCK(d); - cnt = vchancount; - err = sysctl_handle_int(oidp, &cnt, 0, req); - - if (err == 0 && req->newptr != NULL && vchancount != cnt) { - if (cnt < 0) - cnt = 0; - if (cnt > SND_MAXVCHANS) - cnt = SND_MAXVCHANS; - err = vchan_setnew(d, direction, cnt); + err = sysctl_handle_int(oidp, &enabled, 0, req); + if (err != 0 || req->newptr == NULL) { + PCM_RELEASE_QUICK(d); + return (err); } + if (enabled <= 0) + d->flags &= ~flag; + else + d->flags |= flag; + PCM_RELEASE_QUICK(d); - return err; + return (0); } static int @@ -368,15 +368,22 @@ sysctl_dev_pcm_vchanmode(SYSCTL_HANDLER_ARGS) switch (VCHAN_SYSCTL_DIR(oidp->oid_arg1)) { case VCHAN_PLAY: + if ((d->flags & SD_F_PVCHANS) == 0) { + PCM_UNLOCK(d); + return (ENODEV); + } direction = PCMDIR_PLAY; break; case VCHAN_REC: + if ((d->flags & SD_F_RVCHANS) == 0) { + PCM_UNLOCK(d); + return (ENODEV); + } direction = PCMDIR_REC; break; default: PCM_UNLOCK(d); return (EINVAL); - break; } PCM_ACQUIRE(d); @@ -450,7 +457,7 @@ sysctl_dev_pcm_vchanrate(SYSCTL_HANDLER_ARGS) struct snddev_info *d; struct pcm_channel *c, *ch; struct pcmchan_caps *caps; - int *vchanrate, vchancount, direction, ret, newspd, restart; + int *vchanrate, direction, ret, newspd, restart; d = devclass_get_softc(pcm_devclass, VCHAN_SYSCTL_UNIT(oidp->oid_arg1)); if (!PCM_REGISTERED(d) || !(d->flags & SD_F_AUTOVCHAN)) @@ -461,24 +468,24 @@ sysctl_dev_pcm_vchanrate(SYSCTL_HANDLER_ARGS) switch (VCHAN_SYSCTL_DIR(oidp->oid_arg1)) { case VCHAN_PLAY: + if ((d->flags & SD_F_PVCHANS) == 0) { + PCM_UNLOCK(d); + return (ENODEV); + } direction = PCMDIR_PLAY; - vchancount = d->pvchancount; vchanrate = &d->pvchanrate; break; case VCHAN_REC: + if ((d->flags & SD_F_RVCHANS) == 0) { + PCM_UNLOCK(d); + return (ENODEV); + } direction = PCMDIR_REC; - vchancount = d->rvchancount; vchanrate = &d->rvchanrate; break; default: PCM_UNLOCK(d); return (EINVAL); - break; - } - - if (vchancount < 1) { - PCM_UNLOCK(d); - return (EINVAL); } PCM_ACQUIRE(d); @@ -555,7 +562,7 @@ sysctl_dev_pcm_vchanformat(SYSCTL_HANDLER_ARGS) struct snddev_info *d; struct pcm_channel *c, *ch; uint32_t newfmt; - int *vchanformat, vchancount, direction, ret, restart; + int *vchanformat, direction, ret, restart; char fmtstr[AFMTSTR_LEN]; d = devclass_get_softc(pcm_devclass, VCHAN_SYSCTL_UNIT(oidp->oid_arg1)); @@ -567,24 +574,24 @@ sysctl_dev_pcm_vchanformat(SYSCTL_HANDLER_ARGS) switch (VCHAN_SYSCTL_DIR(oidp->oid_arg1)) { case VCHAN_PLAY: + if ((d->flags & SD_F_PVCHANS) == 0) { + PCM_UNLOCK(d); + return (ENODEV); + } direction = PCMDIR_PLAY; - vchancount = d->pvchancount; vchanformat = &d->pvchanformat; break; case VCHAN_REC: + if ((d->flags & SD_F_RVCHANS) == 0) { + PCM_UNLOCK(d); + return (ENODEV); + } direction = PCMDIR_REC; - vchancount = d->rvchancount; vchanformat = &d->rvchanformat; break; default: PCM_UNLOCK(d); return (EINVAL); - break; - } - - if (vchancount < 1) { - PCM_UNLOCK(d); - return (EINVAL); } PCM_ACQUIRE(d); @@ -660,7 +667,7 @@ sysctl_dev_pcm_vchanformat(SYSCTL_HANDLER_ARGS) "play.vchanrate" : "rec.vchanrate" int -vchan_create(struct pcm_channel *parent) +vchan_create(struct pcm_channel *parent, struct pcm_channel **child) { struct snddev_info *d; struct pcm_channel *ch; @@ -676,9 +683,6 @@ vchan_create(struct pcm_channel *parent) PCM_BUSYASSERT(d); CHN_LOCKASSERT(parent); - if (!(parent->flags & CHN_F_BUSY)) - return (EBUSY); - if (!(parent->direction == PCMDIR_PLAY || parent->direction == PCMDIR_REC)) return (EINVAL); @@ -713,10 +717,12 @@ vchan_create(struct pcm_channel *parent) */ CHN_INSERT_SORT_DESCEND(parent, ch, children); + *child = ch; + if (parent->flags & CHN_F_HAS_VCHAN) return (0); - parent->flags |= CHN_F_HAS_VCHAN; + parent->flags |= CHN_F_HAS_VCHAN | CHN_F_BUSY; parent_caps = chn_getcaps(parent); if (parent_caps == NULL) { @@ -807,6 +813,7 @@ vchan_create(struct pcm_channel *parent) fail: CHN_LOCK(ch); vchan_destroy(ch); + *child = NULL; return (ret); } @@ -878,166 +885,40 @@ vchan_sync(struct pcm_channel *c) return (ret); } -int -vchan_setnew(struct snddev_info *d, int direction, int newcnt) -{ - struct pcm_channel *c, *ch, *nch; - struct pcmchan_caps *caps; - int i, err, vcnt; - - PCM_BUSYASSERT(d); - - if ((direction == PCMDIR_PLAY && d->playcount < 1) || - (direction == PCMDIR_REC && d->reccount < 1)) - return (ENODEV); - - if (!(d->flags & SD_F_AUTOVCHAN)) - return (EINVAL); - - if (newcnt < 0 || newcnt > SND_MAXVCHANS) - return (E2BIG); - - if (direction == PCMDIR_PLAY) - vcnt = d->pvchancount; - else if (direction == PCMDIR_REC) - vcnt = d->rvchancount; - else - return (EINVAL); - - if (newcnt > vcnt) { - /* add new vchans - find a parent channel first */ - ch = NULL; - CHN_FOREACH(c, d, channels.pcm) { - CHN_LOCK(c); - if (c->direction == direction && - ((c->flags & CHN_F_HAS_VCHAN) || (vcnt == 0 && - !(c->flags & (CHN_F_BUSY | CHN_F_VIRTUAL))))) { - /* - * Reuse hw channel with vchans already - * created. - */ - if (c->flags & CHN_F_HAS_VCHAN) { - ch = c; - break; - } - /* - * No vchans ever created, look for - * channels with supported formats. - */ - caps = chn_getcaps(c); - if (caps == NULL) { - CHN_UNLOCK(c); - continue; - } - for (i = 0; caps->fmtlist[i] != 0; i++) { - if (caps->fmtlist[i] & AFMT_CONVERTIBLE) - break; - } - if (caps->fmtlist[i] != 0) { - ch = c; - break; - } - } - CHN_UNLOCK(c); - } - if (ch == NULL) - return (EBUSY); - ch->flags |= CHN_F_BUSY; - err = 0; - while (err == 0 && newcnt > vcnt) { - err = vchan_create(ch); - if (err == 0) - vcnt++; - else if (err == E2BIG && newcnt > vcnt) - device_printf(d->dev, - "%s: err=%d Maximum channel reached.\n", - __func__, err); - } - if (vcnt == 0) - ch->flags &= ~CHN_F_BUSY; - CHN_UNLOCK(ch); - if (err != 0) - return (err); - } else if (newcnt < vcnt) { - CHN_FOREACH(c, d, channels.pcm) { - CHN_LOCK(c); - if (c->direction != direction || - CHN_EMPTY(c, children) || - !(c->flags & CHN_F_HAS_VCHAN)) { - CHN_UNLOCK(c); - continue; - } - CHN_FOREACH_SAFE(ch, c, nch, children) { - CHN_LOCK(ch); - if (vcnt == 1 && ch->flags & CHN_F_BUSY) { - CHN_UNLOCK(ch); - break; - } - if (!(ch->flags & CHN_F_BUSY)) { - err = vchan_destroy(ch); - if (err == 0) - vcnt--; - } else - CHN_UNLOCK(ch); - if (vcnt == newcnt) - break; - } - CHN_UNLOCK(c); - break; - } - } - - return (0); *** 122 LINES SKIPPED *** From nobody Tue Feb 25 11:48:20 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2G84529Qz5pjgH; Tue, 25 Feb 2025 11:48:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2G843JL9z3kJ8; Tue, 25 Feb 2025 11:48:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484100; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9o0wnGJOg6A0zBpS1GkIfnRYika9fje5gjQK5iru+SQ=; b=r2Y6dJ97kL+Wu3oZONac30lxGZ9tSW/rpaNnU/QQSgYbNCcj3DAbbV+caCXCqWZGTtp2jA 6lMxKZ1MmHmIRvtpPTr43Q80EGqGRjKDZ1bV8tgy/WGHu4N3Gz+mzhCAzwGMyLnFARC0Ey rYLSMlIrT9LYDwuWhcOF3XUDktl+eayx9UgdzPuyVWpW5oUyNpSTU4429IVsInq79wLhWX G0wKdu5b7oZaeGUZnaYJxG+t/TGLWbK8wh86N3SUv777mHwH/dC+Gc0qEYKrb18a5VBcMp eoc7U8JBxgNQArcX6D+D+YNBy6Orzv+c7EEJ4z7xaMDSz6mWKJgmrjOp9MMPWQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484100; a=rsa-sha256; cv=none; b=L3NKA6Nhc0NlLXTJqy4ceWUYUQooqD/ixJR1+ujp45OAXaAJwVxQd8IMGOob4ZuUHmzgzK GREGSKt8ChCexJ2HaM6fqLZXKp4IrAppNN7NZVeXFEaDruJgIPIWdVzqmjggIQSfc+UW15 1R8ZFvoaD9R5/5YugnV1J4/5awtbfrWIhywvSQZHknbM131xtFSJZ3ShO5tPb7sU8hKQSc wdbbmnd8k4ZZgjHVw+kZrr2WC7SQG4FAveMj2W7xxVmjY7ECiHGxTCnVGHbjmqx6TAwr5G O1eoN43i3qrk0S2ZU/9FR8u+XYJEHVGyvIBjT6eQVnJ8ElriNBBijjCpFQumTQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484100; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9o0wnGJOg6A0zBpS1GkIfnRYika9fje5gjQK5iru+SQ=; b=B2zLKPR9xpXWRgbJhfK8wS19oNDQteblMLnOhwIfFKJyZNVpbvfMP7UCqJjuSmCR1DjIS/ a0+GqlFXAR9Kbsv/UA9aW6YFcZa7fIWpSwVp7aSoCsNH/iIFx+q0kJ9Qx+mhlJefMjabts QAIrSE6yF2G2knudkRkbUzFw1GSh+YzmGzsU4nGt6I2zFpyxvMihtuH+74lRkg4mwL7prC LtJ7QVI1w7DdQxug5bILCI2PT7jWBpcCMrhWt3lOzRndfmOuRsDzGk/mChxZgZ6oNFqb0i ubs1Z1kH/uCnhUHxV4mxEZcN89lenKZEwIRqOnfSVvV7K13VUzszqoLRbfS9EA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2G842n4gz8pk; Tue, 25 Feb 2025 11:48:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PBmKOo051068; Tue, 25 Feb 2025 11:48:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PBmKTC051065; Tue, 25 Feb 2025 11:48:20 GMT (envelope-from git) Date: Tue, 25 Feb 2025 11:48:20 GMT Message-Id: <202502251148.51PBmKTC051065@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 40616b7e41ff - main - sound: Return if the new speed/format is the same as the current one List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 40616b7e41ff96b6d7522445b00f27f26d593a85 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=40616b7e41ff96b6d7522445b00f27f26d593a85 commit 40616b7e41ff96b6d7522445b00f27f26d593a85 Author: Christos Margiolis AuthorDate: 2025-02-25 11:44:12 +0000 Commit: Christos Margiolis CommitDate: 2025-02-25 11:44:12 +0000 sound: Return if the new speed/format is the same as the current one This gives us a slight performance boost since we do not have to go through chn_setparam() and the driver functions. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: dev_submerge.ch, emaste Differential Revision: https://reviews.freebsd.org/D48012 --- sys/dev/sound/pcm/channel.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 19b2db321cee..c3ee50d51c4b 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -2110,6 +2110,9 @@ chn_setspeed(struct pcm_channel *c, uint32_t speed) oldformat = c->format; oldspeed = c->speed; + if (c->speed == speed) + return (0); + ret = chn_setparam(c, c->format, speed); if (ret != 0) { if (snd_verbose > 3) @@ -2138,6 +2141,9 @@ chn_setformat(struct pcm_channel *c, uint32_t format) oldformat = c->format; oldspeed = c->speed; + if (c->format == format) + return (0); + ret = chn_setparam(c, format, c->speed); if (ret != 0) { if (snd_verbose > 3) From nobody Tue Feb 25 11:48:19 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2G8401pYz5pjm3; Tue, 25 Feb 2025 11:48:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2G832Snqz3kNk; Tue, 25 Feb 2025 11:48:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GNEvXzD0NbYvN4FtLjVHLRfmlVbF55k9rPrjy9qqQD4=; b=fEbWzGyK2shhLwwAEPnwRGop4cn/j3qCUt7vZfVpFfHyU8LO63ShkFbCiO36ubhq2+NkFa QZ2sIrmMGJZQ25xQCoLkgh0akOptSwEvPQam/bLb6Z0pOZZk1HVJ4sBdrjFyFocm02I8jp tYZRLhF3x/t6uc689xz8R53Cu8v/stSuE3izsPev9qkg5INiriUBEqav3IENac3/78Qz1Y 7N86jMRid3lzqaTnn/WiWt4tKzIienLJSHdq/Pwr/T2MUsP2jkr3KLlybRl9HFvUmB0lZO BSZDRz7jQqPzC/8UIWQKoWMmNMs2y5Dfd8TaF3Q5cRv9Om3dLnghpGnkApTxkA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484099; a=rsa-sha256; cv=none; b=a3xet1aLOukrCM++ryOLYCpV0eCOo6FEaMEVKje/KSzVlChACT6ZUAVpLwFawV+dlfu6qY 5hAGrLKrz8ux9lYg+zbw9IvTLutjfNua+uGVw4i3Dr6yZjXiqqdjHvvuch9GdutAz1wkxm xQubYWo2nbp9dEBEf1fS0/cQeOYQ1h8lRQuAAfNv2InmGtXgfu3deZkLvqfqK+gCbIl3s7 T4TVRux+0GInpx0hvzgM6q3+8s7PaJA1Plsi+mvA1R/rstLV3sA9nmtxPH9YoNuw26HvBd 9b1uEMaoYk+kgEWMCf3gEBJQqnqkkQnMIe0r5OrG66PCQhVnG7TqYJTPia1lnw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GNEvXzD0NbYvN4FtLjVHLRfmlVbF55k9rPrjy9qqQD4=; b=ymioF/z4jPQ/Phrut5uf7hw9Cgb+PhW6cUFN4kkTihECKkz42cga44IJMMGXiVht8ueWuJ 9NSZNzUGVspuCoIfPyR9qiT8+jqD7wvwTvEjoa6CsrhV96E9xaNdSrKQpE1k0Ii+y/nfvZ UCsOzvZpLQoewetHUjdQ3eNGSDCFoON1UpTnjbCmaTtg+test+whDtalX7nme/rs58g7rI l3KDAi1ATs1ibklQbT0vobm13wan9D39yYZTz7UR7qV13hR83FETXScen1dr0OjBW8Tg4O bKx7PmsAcDnYjW3L72ubOvpLegcfwzT55UayKa2ONa4MdHQKZCAZ3SXKxm601w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2G831svZz9Cr; Tue, 25 Feb 2025 11:48:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PBmJ8E051033; Tue, 25 Feb 2025 11:48:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PBmJhD051030; Tue, 25 Feb 2025 11:48:19 GMT (envelope-from git) Date: Tue, 25 Feb 2025 11:48:19 GMT Message-Id: <202502251148.51PBmJhD051030@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 4e1b75bebf41 - main - sound: Get rid of redundant variables in chn_setspeed() and chn_setformat() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4e1b75bebf41b6e446d72c755fa420836341ade2 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=4e1b75bebf41b6e446d72c755fa420836341ade2 commit 4e1b75bebf41b6e446d72c755fa420836341ade2 Author: Christos Margiolis AuthorDate: 2025-02-25 11:44:05 +0000 Commit: Christos Margiolis CommitDate: 2025-02-25 11:44:05 +0000 sound: Get rid of redundant variables in chn_setspeed() and chn_setformat() Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: dev_submerge.ch, emaste Differential Revision: https://reviews.freebsd.org/D48011 --- sys/dev/sound/pcm/channel.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 17c11dc33b7a..19b2db321cee 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -2104,21 +2104,20 @@ chn_setparam(struct pcm_channel *c, uint32_t format, uint32_t speed) int chn_setspeed(struct pcm_channel *c, uint32_t speed) { - uint32_t oldformat, oldspeed, format; + uint32_t oldformat, oldspeed; int ret; oldformat = c->format; oldspeed = c->speed; - format = oldformat; - ret = chn_setparam(c, format, speed); + ret = chn_setparam(c, c->format, speed); if (ret != 0) { if (snd_verbose > 3) device_printf(c->dev, "%s(): Setting speed %d failed, " "falling back to %d\n", __func__, speed, oldspeed); - chn_setparam(c, c->format, oldspeed); + chn_setparam(c, oldformat, oldspeed); } return (ret); @@ -2127,7 +2126,7 @@ chn_setspeed(struct pcm_channel *c, uint32_t speed) int chn_setformat(struct pcm_channel *c, uint32_t format) { - uint32_t oldformat, oldspeed, speed; + uint32_t oldformat, oldspeed; int ret; /* XXX force stereo */ @@ -2138,9 +2137,8 @@ chn_setformat(struct pcm_channel *c, uint32_t format) oldformat = c->format; oldspeed = c->speed; - speed = oldspeed; - ret = chn_setparam(c, format, speed); + ret = chn_setparam(c, format, c->speed); if (ret != 0) { if (snd_verbose > 3) device_printf(c->dev, From nobody Tue Feb 25 11:48:18 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2G832Zytz5pjL5; Tue, 25 Feb 2025 11:48:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2G821Yx3z3kWk; Tue, 25 Feb 2025 11:48:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484098; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DO6Bkdz9vwFhMnRelSru/o2aV4xhSOCpjq2Jml2dW1o=; b=P2NyTetfJTgPCEo+Sy0EjhJY0GN0RNXkkcoaRT0X4pV5mW1fxXur9i3SftgK5BllKhCNo8 9PnHwT37+xjkvP6+2obvWWWKc+pug28JrykWdjjKLnu3GYkJHSxXhJB/TMqRRUE4kvNbxx sYLkMtI+D+KxtyuD6dmoqSdaBZ748WxUYvocZbhZ6z18mDyqFjBZP5NU2j0gphotdIqSqg LpUFkaf1t72Yvt8/IY6Zl8t5AiF9Xc1NdXbV/tbn6+YAKY2ELlHMgr5ukEuylOiB2bfpLp ov9PYEvkpM6KUuO5a8iQBSPK2lRckc6pAAriZdno1+J815KHPb/3GFAwZVb/Hg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484098; a=rsa-sha256; cv=none; b=tu1uQjzXtg7BSb01C8mN9NDG6NcXfx2KPdWJ4VuwBfAPQRcHyH1FrV40Ya5pU9CaWaw3ON 0ml+aJ7DzOaUPewisTWHflN+QshhTJZvbNmfLJ74MXWA1j+seXsPzoEEC3f8vBwnJgQQcN d8ioTrDJbOq9BqykalZZ8OWOMjGa0HUR5ZjKyzFrY6oCqVLBN0xsSaxQBTrCS4aJxp3ygz /f/ayt99/mmOy823S6osnT74MvOfAbVs/fuUPua7BYC36c/YWZv/HpG+sg1BcyzdT8IAPB VpGxwmhGKl1m2nrBANWBQW4jGzu1uawbU73J7a1crUeZjtnTdMBqzt0GXHoMyA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484098; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DO6Bkdz9vwFhMnRelSru/o2aV4xhSOCpjq2Jml2dW1o=; b=gMZabYOGPCK8a02BRWiW8/q+kfpjh4WoaDhQOlY6kFhIi8FBW/1teDxC6lDnRR4fTn7Mg/ e3YGGJdAdGWH6NhHvqR1ueCsKAcXQZ98setMS51X9hBLqK9ZcmOwtJ28eQJUk663y+fBX7 zEX6OZedHn0iZz6BamgOc6felbnDYuxJOxWHiYArbIsrqKdprRPlTH22NBiZd+Z4FdtF8E oKtBhSMZYdvGaEoiYbWHda7U576GovlyIjF2/TAjxAxz5XeIfv6/FM+AVXP9odrwbUwi3L UsXcYyAIuXdQ8AYgBkfwgPcyNQyHToCQxxxlTnCLPl6iOuBgRRrGR+rI+cl6bA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2G820tFqz8pj; Tue, 25 Feb 2025 11:48:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PBmIUB050997; Tue, 25 Feb 2025 11:48:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PBmIqQ050994; Tue, 25 Feb 2025 11:48:18 GMT (envelope-from git) Date: Tue, 25 Feb 2025 11:48:18 GMT Message-Id: <202502251148.51PBmIqQ050994@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 6524d2a5affd - main - sound: Remove SNDBUF_LOCKASSERT() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6524d2a5affd02623e6909fff0ca03ba21882a0c Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=6524d2a5affd02623e6909fff0ca03ba21882a0c commit 6524d2a5affd02623e6909fff0ca03ba21882a0c Author: Christos Margiolis AuthorDate: 2025-02-25 11:43:59 +0000 Commit: Christos Margiolis CommitDate: 2025-02-25 11:43:59 +0000 sound: Remove SNDBUF_LOCKASSERT() It's a no-op. There is no lock associated with the buffer. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: dev_submerge.ch, markj Differential Revision: https://reviews.freebsd.org/D48008 --- sys/dev/sound/pcm/buffer.c | 22 ---------------------- sys/dev/sound/pcm/buffer.h | 2 -- 2 files changed, 24 deletions(-) diff --git a/sys/dev/sound/pcm/buffer.c b/sys/dev/sound/pcm/buffer.c index 8bf3631afb7a..de535ec2dcba 100644 --- a/sys/dev/sound/pcm/buffer.c +++ b/sys/dev/sound/pcm/buffer.c @@ -461,39 +461,30 @@ sndbuf_getsel(struct snd_dbuf *b) unsigned int sndbuf_getxrun(struct snd_dbuf *b) { - SNDBUF_LOCKASSERT(b); - return b->xrun; } void sndbuf_setxrun(struct snd_dbuf *b, unsigned int xrun) { - SNDBUF_LOCKASSERT(b); - b->xrun = xrun; } unsigned int sndbuf_gethwptr(struct snd_dbuf *b) { - SNDBUF_LOCKASSERT(b); - return b->hp; } void sndbuf_sethwptr(struct snd_dbuf *b, unsigned int ptr) { - SNDBUF_LOCKASSERT(b); - b->hp = ptr; } unsigned int sndbuf_getready(struct snd_dbuf *b) { - SNDBUF_LOCKASSERT(b); KASSERT((b->rl >= 0) && (b->rl <= b->bufsize), ("%s: b->rl invalid %d", __func__, b->rl)); return b->rl; @@ -502,7 +493,6 @@ sndbuf_getready(struct snd_dbuf *b) unsigned int sndbuf_getreadyptr(struct snd_dbuf *b) { - SNDBUF_LOCKASSERT(b); KASSERT((b->rp >= 0) && (b->rp <= b->bufsize), ("%s: b->rp invalid %d", __func__, b->rp)); return b->rp; @@ -511,7 +501,6 @@ sndbuf_getreadyptr(struct snd_dbuf *b) unsigned int sndbuf_getfree(struct snd_dbuf *b) { - SNDBUF_LOCKASSERT(b); KASSERT((b->rl >= 0) && (b->rl <= b->bufsize), ("%s: b->rl invalid %d", __func__, b->rl)); return b->bufsize - b->rl; @@ -520,7 +509,6 @@ sndbuf_getfree(struct snd_dbuf *b) unsigned int sndbuf_getfreeptr(struct snd_dbuf *b) { - SNDBUF_LOCKASSERT(b); KASSERT((b->rp >= 0) && (b->rp <= b->bufsize), ("%s: b->rp invalid %d", __func__, b->rp)); KASSERT((b->rl >= 0) && (b->rl <= b->bufsize), ("%s: b->rl invalid %d", __func__, b->rl)); @@ -530,40 +518,30 @@ sndbuf_getfreeptr(struct snd_dbuf *b) u_int64_t sndbuf_getblocks(struct snd_dbuf *b) { - SNDBUF_LOCKASSERT(b); - return b->total / b->blksz; } u_int64_t sndbuf_getprevblocks(struct snd_dbuf *b) { - SNDBUF_LOCKASSERT(b); - return b->prev_total / b->blksz; } u_int64_t sndbuf_gettotal(struct snd_dbuf *b) { - SNDBUF_LOCKASSERT(b); - return b->total; } u_int64_t sndbuf_getprevtotal(struct snd_dbuf *b) { - SNDBUF_LOCKASSERT(b); - return b->prev_total; } void sndbuf_updateprevtotal(struct snd_dbuf *b) { - SNDBUF_LOCKASSERT(b); - b->prev_total = b->total; } diff --git a/sys/dev/sound/pcm/buffer.h b/sys/dev/sound/pcm/buffer.h index 2c5d6e7c214b..ddf4083ec19f 100644 --- a/sys/dev/sound/pcm/buffer.h +++ b/sys/dev/sound/pcm/buffer.h @@ -26,8 +26,6 @@ * SUCH DAMAGE. */ -#define SNDBUF_LOCKASSERT(b) - #define SNDBUF_F_MANAGED 0x00000008 #define SNDBUF_NAMELEN 48 From nobody Tue Feb 25 11:48:16 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2G830cR1z5pjjf; Tue, 25 Feb 2025 11:48:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2G810Lpnz3kCZ; Tue, 25 Feb 2025 11:48:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484097; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=usbJ3hZEpsCAZvXOFF+9lRTdOnuugQiqHWgBiSnzFPc=; b=lN4Bto58Ch6ZtyZ2IovvDQ37kRNSONm9eLth2CoqB/W4Gz4vfN5S8AmFqJO3HCn6/1UaV1 QDbM9dPkPMFBG7o/35Us7Y5Hj8k1RxpNrSDH/8VJBZ2mhbIOdfkyhgj5fWdEq17kxDpEXI pFQkcpVnkYbqfi9vTKq9h+sKNplt+NHyqimO9fjuu6EUnSPgdgvGVoe+oQHL6DfGqyKy+9 C8ShPrjxQ3FUrtrQbB45DjtxNumYaVDirml7V0S8VNdvTYkDcHsANvdJE5jYcnJn/znvFE zcvqFwI1XoMYTvx4rgz0kf88XwTWZGtd4wHNLAy/24Z9HoLrKRCsMbnhWHZIig== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484097; a=rsa-sha256; cv=none; b=wEMUFCexuyf98WMEmHSh9deoP75fyKEjz2GWjoDcp+DYHgpQ0tqNVoYaz3Mq0hUWQ1y5kT kTmUrK1WJOCiYo9NjyaPH09u1d08NxwHHFlfsQ1VLXb6u7lOF8E0KoZrsKJD2QpsDdwugr TPqZMkmmZW2SxlYEhdUq7ck0EHRJ3wP+MUH224ysg25JsoJ8ecubEeJB4V1Sek3ngFSl/I LXizeEDxBcZbKRng0qCJhOPwag/1bQfNa9GKLJTu2lZU8RPk5Gi5yRlhDZrkwgbc5ygiVL lBzvICp2Iml/reOISIVEaC/VmFWeM3gIL///awMXMEIgAxTg0QmOC9CdkI2G5A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484097; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=usbJ3hZEpsCAZvXOFF+9lRTdOnuugQiqHWgBiSnzFPc=; b=woYb3U+5IM2awBMCKLEMoOPjQXyNXDvlLD9RjgqRbIeLyrbMi99vSGZgTCHVwof1rzzmIy TkfILsf85AsFa1qaFzvHRFqmaIe49dUxa7kZW7n2kmXzlH3ifKciMzxK3JGEozxQ0Jyr6c yJaEvgz01vM8K36BMs1RcCrfnzWSIllo4Nj73n49eMYbrPjwqa+AmnbU3PQH2btBYvb5jL ArFkBO/TuchS3oJhnfw11gXFOJIiO/NqRRq8ba6+ZkMaJLK5pUUsmwzjGN1GpjvYsj7htP Npcio2GT58P9BVvR7l6lfV5Xd9clwsLRXjpQNsUvvezn29XCTQ9tBT14lxEkbg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2G8074Ndz9Np; Tue, 25 Feb 2025 11:48:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PBmGiJ050965; Tue, 25 Feb 2025 11:48:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PBmGpS050962; Tue, 25 Feb 2025 11:48:16 GMT (envelope-from git) Date: Tue, 25 Feb 2025 11:48:16 GMT Message-Id: <202502251148.51PBmGpS050962@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 1cbafcd13796 - main - sound: Handle multiple primary channel cases in vchan sysctls List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1cbafcd13796934a7896064cdb23fd4e37d58821 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=1cbafcd13796934a7896064cdb23fd4e37d58821 commit 1cbafcd13796934a7896064cdb23fd4e37d58821 Author: Christos Margiolis AuthorDate: 2025-02-25 11:43:52 +0000 Commit: Christos Margiolis CommitDate: 2025-02-25 11:43:52 +0000 sound: Handle multiple primary channel cases in vchan sysctls vchan_getparentchannel() is used by various vchan sysctl functions to fetch the first primary channel. However, this assumes that all devices have only one primary channel per direction. If a device does not meet this assumption, then the sysctl functions will be applying the configurations on the first primary channel only. Since we now have the "primary" channel sublist, we can retire vchan_getparentchannel() and iterate through the "primary" list in each sysctl function and apply the settings to all primary channels. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D48336 --- sys/dev/sound/pcm/vchan.c | 227 ++++++++++++++++------------------------------ 1 file changed, 80 insertions(+), 147 deletions(-) diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c index 379d647cbcf8..45f0a8b00bd2 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -253,48 +253,6 @@ static kobj_method_t vchan_methods[] = { }; CHANNEL_DECLARE(vchan); -static void -vchan_getparentchannel(struct snddev_info *d, - struct pcm_channel **wrch, struct pcm_channel **rdch) -{ - struct pcm_channel **ch, *wch, *rch, *c; - - KASSERT(d != NULL, ("%s(): NULL snddev_info", __func__)); - - PCM_BUSYASSERT(d); - PCM_UNLOCKASSERT(d); - - wch = NULL; - rch = NULL; - - CHN_FOREACH(c, d, channels.pcm) { - CHN_LOCK(c); - ch = (c->direction == PCMDIR_PLAY) ? &wch : &rch; - if (c->flags & CHN_F_VIRTUAL) { - /* Sanity check */ - if (*ch != NULL && *ch != c->parentchannel) { - CHN_UNLOCK(c); - *ch = NULL; - break; - } - } else { - /* No way!! */ - if (*ch != NULL) { - CHN_UNLOCK(c); - *ch = NULL; - break; - } - *ch = c; - } - CHN_UNLOCK(c); - } - - if (wrch != NULL) - *wrch = wch; - if (rdch != NULL) - *rdch = rch; -} - static int sysctl_dev_pcm_vchans(SYSCTL_HANDLER_ARGS) { @@ -391,19 +349,6 @@ sysctl_dev_pcm_vchanmode(SYSCTL_HANDLER_ARGS) PCM_ACQUIRE(d); PCM_UNLOCK(d); - if (direction == PCMDIR_PLAY) - vchan_getparentchannel(d, &c, NULL); - else - vchan_getparentchannel(d, NULL, &c); - - if (c == NULL) { - PCM_RELEASE_QUICK(d); - return (EINVAL); - } - - KASSERT(direction == c->direction, ("%s(): invalid direction %d/%d", - __func__, direction, c->direction)); - if (*vchanmode & CHN_F_VCHAN_PASSTHROUGH) strlcpy(dtype, "passthrough", sizeof(dtype)); else if (*vchanmode & CHN_F_VCHAN_ADAPTIVE) @@ -412,26 +357,29 @@ sysctl_dev_pcm_vchanmode(SYSCTL_HANDLER_ARGS) strlcpy(dtype, "fixed", sizeof(dtype)); ret = sysctl_handle_string(oidp, dtype, sizeof(dtype), req); - if (ret == 0 && req->newptr != NULL) { - if (strcasecmp(dtype, "passthrough") == 0 || - strcmp(dtype, "1") == 0) - dflags = CHN_F_VCHAN_PASSTHROUGH; - else if (strcasecmp(dtype, "adaptive") == 0 || - strcmp(dtype, "2") == 0) - dflags = CHN_F_VCHAN_ADAPTIVE; - else if (strcasecmp(dtype, "fixed") == 0 || - strcmp(dtype, "0") == 0) - dflags = 0; - else { - PCM_RELEASE_QUICK(d); - return (EINVAL); - } + if (ret != 0 || req->newptr == NULL) { + PCM_RELEASE_QUICK(d); + return (ret); + } + + if (strcasecmp(dtype, "passthrough") == 0 || strcmp(dtype, "1") == 0) + dflags = CHN_F_VCHAN_PASSTHROUGH; + else if (strcasecmp(dtype, "adaptive") == 0 || strcmp(dtype, "2") == 0) + dflags = CHN_F_VCHAN_ADAPTIVE; + else if (strcasecmp(dtype, "fixed") == 0 || strcmp(dtype, "0") == 0) + dflags = 0; + else { + PCM_RELEASE_QUICK(d); + return (EINVAL); + } + + CHN_FOREACH(c, d, channels.pcm.primary) { CHN_LOCK(c); - if (dflags == (c->flags & CHN_F_VCHAN_DYNAMIC) || + if (c->direction != direction || + dflags == (c->flags & CHN_F_VCHAN_DYNAMIC) || (c->flags & CHN_F_PASSTHROUGH)) { CHN_UNLOCK(c); - PCM_RELEASE_QUICK(d); - return (0); + continue; } c->flags &= ~CHN_F_VCHAN_DYNAMIC; c->flags |= dflags; @@ -492,19 +440,6 @@ sysctl_dev_pcm_vchanrate(SYSCTL_HANDLER_ARGS) PCM_ACQUIRE(d); PCM_UNLOCK(d); - if (direction == PCMDIR_PLAY) - vchan_getparentchannel(d, &c, NULL); - else - vchan_getparentchannel(d, NULL, &c); - - if (c == NULL) { - PCM_RELEASE_QUICK(d); - return (EINVAL); - } - - KASSERT(direction == c->direction, ("%s(): invalid direction %d/%d", - __func__, direction, c->direction)); - newspd = *vchanrate; ret = sysctl_handle_int(oidp, &newspd, 0, req); @@ -518,39 +453,45 @@ sysctl_dev_pcm_vchanrate(SYSCTL_HANDLER_ARGS) return (EINVAL); } - CHN_LOCK(c); - - if (newspd != c->speed && VCHAN_ACCESSIBLE(c)) { - if (CHN_STARTED(c)) { - chn_abort(c); - restart = 1; - } else - restart = 0; - - if (feeder_rate_round) { - caps = chn_getcaps(c); - RANGE(newspd, caps->minspeed, caps->maxspeed); - newspd = CHANNEL_SETSPEED(c->methods, - c->devinfo, newspd); + CHN_FOREACH(c, d, channels.pcm.primary) { + CHN_LOCK(c); + if (c->direction != direction) { + CHN_UNLOCK(c); + continue; } - ret = chn_reset(c, c->format, newspd); - if (ret == 0) { - if (restart != 0) { - CHN_FOREACH(ch, c, children.busy) { - CHN_LOCK(ch); - if (VCHAN_SYNC_REQUIRED(ch)) - vchan_sync(ch); - CHN_UNLOCK(ch); + if (newspd != c->speed && VCHAN_ACCESSIBLE(c)) { + if (CHN_STARTED(c)) { + chn_abort(c); + restart = 1; + } else + restart = 0; + + if (feeder_rate_round) { + caps = chn_getcaps(c); + RANGE(newspd, caps->minspeed, caps->maxspeed); + newspd = CHANNEL_SETSPEED(c->methods, + c->devinfo, newspd); + } + + ret = chn_reset(c, c->format, newspd); + if (ret == 0) { + if (restart != 0) { + CHN_FOREACH(ch, c, children.busy) { + CHN_LOCK(ch); + if (VCHAN_SYNC_REQUIRED(ch)) + vchan_sync(ch); + CHN_UNLOCK(ch); + } + c->flags |= CHN_F_DIRTY; + ret = chn_start(c, 1); } - c->flags |= CHN_F_DIRTY; - ret = chn_start(c, 1); } } - } - *vchanrate = c->speed; + *vchanrate = c->speed; - CHN_UNLOCK(c); + CHN_UNLOCK(c); + } PCM_RELEASE_QUICK(d); @@ -598,19 +539,6 @@ sysctl_dev_pcm_vchanformat(SYSCTL_HANDLER_ARGS) PCM_ACQUIRE(d); PCM_UNLOCK(d); - if (direction == PCMDIR_PLAY) - vchan_getparentchannel(d, &c, NULL); - else - vchan_getparentchannel(d, NULL, &c); - - if (c == NULL) { - PCM_RELEASE_QUICK(d); - return (EINVAL); - } - - KASSERT(direction == c->direction, ("%s(): invalid direction %d/%d", - __func__, direction, c->direction)); - bzero(fmtstr, sizeof(fmtstr)); if (snd_afmt2str(*vchanformat, fmtstr, sizeof(fmtstr)) != *vchanformat) @@ -628,32 +556,37 @@ sysctl_dev_pcm_vchanformat(SYSCTL_HANDLER_ARGS) return (EINVAL); } - CHN_LOCK(c); - - if (newfmt != c->format && VCHAN_ACCESSIBLE(c)) { - if (CHN_STARTED(c)) { - chn_abort(c); - restart = 1; - } else - restart = 0; - - ret = chn_reset(c, newfmt, c->speed); - if (ret == 0) { - if (restart != 0) { - CHN_FOREACH(ch, c, children.busy) { - CHN_LOCK(ch); - if (VCHAN_SYNC_REQUIRED(ch)) - vchan_sync(ch); - CHN_UNLOCK(ch); + CHN_FOREACH(c, d, channels.pcm.primary) { + CHN_LOCK(c); + if (c->direction != direction) { + CHN_UNLOCK(c); + continue; + } + if (newfmt != c->format && VCHAN_ACCESSIBLE(c)) { + if (CHN_STARTED(c)) { + chn_abort(c); + restart = 1; + } else + restart = 0; + + ret = chn_reset(c, newfmt, c->speed); + if (ret == 0) { + if (restart != 0) { + CHN_FOREACH(ch, c, children.busy) { + CHN_LOCK(ch); + if (VCHAN_SYNC_REQUIRED(ch)) + vchan_sync(ch); + CHN_UNLOCK(ch); + } + c->flags |= CHN_F_DIRTY; + ret = chn_start(c, 1); } - c->flags |= CHN_F_DIRTY; - ret = chn_start(c, 1); } } - } - *vchanformat = c->format; + *vchanformat = c->format; - CHN_UNLOCK(c); + CHN_UNLOCK(c); + } PCM_RELEASE_QUICK(d); From nobody Tue Feb 25 11:48:21 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2G863kf8z5pjm4; Tue, 25 Feb 2025 11:48: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2G854DVhz3kJS; Tue, 25 Feb 2025 11:48:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xvHD2fz0l5IoZqtn1YkatmKLn670i6xESby0sDWTQFg=; b=FivsYuw15EPMRvlcBRZb69+cTLRCPu7HTaTf2u5er947+M8VPu/EMqHs+DDYhuOgcLXriq Zw8h27uqB1a59DUjEaAueKwPY7EL2/VONpXK/XqaZ6gZV4nCMBCFq9UDucJl4Bu1xDTamc RTxXifW7A3SU7bBD6vmKkhV1wTn6I6hXmz30QpdQkR3isyuJZ4Ah8wQ3VplIaCkXbPhUiO hSHvcnSw5UGtZe613AIWab7oTxrQkCLla9QbrpEZT17zW138BmHghewx6k4AATbaRUV57N x40s+D+9dTtW2evu9DgRwVLxF8zZ4dZZlCgVjHV/PMRd3FNFgCFlH8yCISTjJA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484101; a=rsa-sha256; cv=none; b=TLDQniowAYtvRBLui2gsF/6nkvlrvZ0xH1SQ1b/0rMheYtbJ0/F6gDEkhY/nZZnnmHZpDM YeLPMdoY5Sy/N/kUiNhl7mIIS+Ucgjed74rF9zrGVcSyCR8JKvzUas3jExYZIFYq1OflDk ms1TXF+/cwxZrYsqDHykpl4o4hnqxTWvctH38m8zNdyg8j/4//0SgN7djB5qd4JD2TkkBC 7m7XTtjWM6q7YTxlaY/O+knASYpD63iczDpoKmJmCglM0uxArrwjybzWZcLAalRxhchdq4 IOoQcvXQcv1RB8IfXnUDPCgi8Mo5oddSQQbFSqVRrvDMD79YJiivbv+CCIdXOg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xvHD2fz0l5IoZqtn1YkatmKLn670i6xESby0sDWTQFg=; b=qRUqEvCC9Bw3xmBXT8DcR6zgIZ4oDENv2Bn+YTTMxorTQykJ/eGoTcGum0PsBqW0LXlQ1n 27tmmBhVHj91Wkx/t0MVapviOmnKUt33syY0CfpxX0hQoz5Mx7QzTxI5ruNb2jtemYA7D3 kNu1VW7brBhUlySr0iI0UntW95dyNf6pMlFOt2DOXcbaFjdns4Yy2wXkecDqX0XRlGZGh0 qYg5K/XoPYll4anjwkAMuXCXScibKEvonj/5nDdMU1nCN9Ub2mzoDxFi8n+HC29gkO6bhM /LHJHe7dVK9r9b/e69/SM1HBMRm2HJOX8yPc0WJft5W9Wg63YpHjtKWSkmIZxg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2G853nw1z94K; Tue, 25 Feb 2025 11:48:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PBmLCu051101; Tue, 25 Feb 2025 11:48:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PBmLBe051098; Tue, 25 Feb 2025 11:48:21 GMT (envelope-from git) Date: Tue, 25 Feb 2025 11:48:21 GMT Message-Id: <202502251148.51PBmLBe051098@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 352aa9ad1d77 - main - snd_uaudio: Remove undefined functions List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 352aa9ad1d77a8ea8e4afef66691dc1a06344618 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=352aa9ad1d77a8ea8e4afef66691dc1a06344618 commit 352aa9ad1d77a8ea8e4afef66691dc1a06344618 Author: Christos Margiolis AuthorDate: 2025-02-25 11:44:18 +0000 Commit: Christos Margiolis CommitDate: 2025-02-25 11:44:18 +0000 snd_uaudio: Remove undefined functions Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: dev_submerge.ch, markj, emaste Differential Revision: https://reviews.freebsd.org/D48424 --- sys/dev/sound/usb/uaudio.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sys/dev/sound/usb/uaudio.h b/sys/dev/sound/usb/uaudio.h index 08144701efe5..54b31a4e7bd2 100644 --- a/sys/dev/sound/usb/uaudio.h +++ b/sys/dev/sound/usb/uaudio.h @@ -64,8 +64,4 @@ extern void uaudio_mixer_set(struct uaudio_softc *, struct snd_mixer *, extern uint32_t uaudio_mixer_setrecsrc(struct uaudio_softc *, struct snd_mixer *, uint32_t src); -int uaudio_get_vendor(device_t dev); -int uaudio_get_product(device_t dev); -int uaudio_get_release(device_t dev); - #endif /* _UAUDIO_H_ */ From nobody Tue Feb 25 11:48:22 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2G872xTTz5pjm5; Tue, 25 Feb 2025 11:48:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2G8654LTz3kZ2; Tue, 25 Feb 2025 11:48:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484102; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DxA0Vi/aHMmz6l3M2U9N6TKBeXiqZ3jT/nMDr6UHrqc=; b=V84J91ZDHCud+J6l9HLBjISwbzmZpD2NM+3/2dzBdywktCpllNS3PIdwCijsI6V0+v9GbJ 62Y58QytKWC9+H89vzUCTybQWOWs5SmFVWo9WcQMJnCK3QnOaouBeUQBf9d6kxlKJVAS1m Q6ZGKdSjN5QKzmiGIsC3SiioJqWqUbl/IsMThh8JyAU6hQJTQz/LmzVzeop5WDHSgdNYZN 8GU/HFdEErf2xlUTTi0MleEo6NGx5Gw/90rZ5IEuFfLmuDfcbwbHh1kCRlO1x8JUkOKqdz 30dZQqainxulAJjGF+hXwh0WopTbRf7SK9MfknfcB9Bm24tk/S1b+pFVwRr3uw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484102; a=rsa-sha256; cv=none; b=CaFnM9A6SQlE1Q2lV+weEYP5gHG+zPycFDJGm+NWs6zlRZ9WxPbsfUZblaRiZpXWXgSrDu Hf+KG9LwFl4S0EEcdKzoCC9qziMfGjv3Ay3yY3xAnvW5cr5rmj6pn1JgyZWlVbdypNT78D 1P40f8zJN0sPoYAjdsN3QCfosXy0bILnEGCrRjydkXWGXCJIyrg8fJm22T7x7y7SZi3m0t d+9KIfViDD2PX24KtDlN8XdjV3HY0jxAgx6bBslrTE+GZQ5ku1SIEFSyFDm+oWpBDFITEM r1QEp6CcQHUwwHdezBjnu7rEOIcXWef+pFNvyt5nVV2y6ZwZrP0Rqg9kmunPHQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484102; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DxA0Vi/aHMmz6l3M2U9N6TKBeXiqZ3jT/nMDr6UHrqc=; b=GrdQgjkBrlMhk53GVk2kto5F03DdUrfu3pGDXR8n6LnYWJOrUZa0+1E//zZ4vW36ljy88Z Cp6F4h1XVmakUbF0kbOteepWilf2jQurw1ripLyGmZbBpNVR0qlSyNuJBLnehZXRacL3EI 9lu/h93yntW9ZrYmMbgkuPyrCRE6UC4pTaUZuWLKCiafemchJbu93oeFXgh92G4AO9a0pN GCDy0s/IXgYhw8eYjhfhdzCeZ7lWVn7N1kQ8kjbfcIJxhVQ4hUqdfkGN0cMCp+F+2o/anH BFna8H/jiOJmdbpE5feft8dY+gWoWatUWZnsDnHgNDXzacoP6p/CK/h6ROH6AQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2G864dJ6z94L; Tue, 25 Feb 2025 11:48:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PBmM0p051137; Tue, 25 Feb 2025 11:48:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PBmMcO051134; Tue, 25 Feb 2025 11:48:22 GMT (envelope-from git) Date: Tue, 25 Feb 2025 11:48:22 GMT Message-Id: <202502251148.51PBmMcO051134@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: fd906e47b18f - main - sound: Simplify locking during device creation List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fd906e47b18f53b09524647bf8431dc6170b8dfd Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=fd906e47b18f53b09524647bf8431dc6170b8dfd commit fd906e47b18f53b09524647bf8431dc6170b8dfd Author: Christos Margiolis AuthorDate: 2025-02-25 11:44:24 +0000 Commit: Christos Margiolis CommitDate: 2025-02-25 11:44:24 +0000 sound: Simplify locking during device creation The mechanism of acquiring SD_F_BUSY in pcm_init() and releasing it in pcm_register() is a leftover from the previous device creation scheme, where pcm_init() (previously pcm_register()) would create the sysctl nodes, as well as the device node. In this scenario, acquiring SD_F_BUSY was necessary, in order to avoid races in case the device was accessed before it was ready for use. Commit 66f3eb14e955 ("sound: Move sysctl and /dev/dspX creation to pcm_setstatus()") fixed this issue, so we can simplify things now. Only acquire SD_F_BUSY in pcm_addchan(), because chn_init() expects to be called with SD_F_BUSY acquired. While here, move the sndstat_register() call further down to be more robust. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D48482 --- sys/dev/sound/pcm/sound.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index c0934dde7718..3e76626f5c57 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -136,9 +136,9 @@ pcm_addchan(device_t dev, int dir, kobj_class_t cls, void *devinfo) struct snddev_info *d = device_get_softc(dev); struct pcm_channel *ch; - PCM_BUSYASSERT(d); - PCM_LOCK(d); + PCM_WAIT(d); + PCM_ACQUIRE(d); ch = chn_init(d, NULL, cls, dir, devinfo); if (!ch) { device_printf(d->dev, "chn_init(%s, %d, %p) failed\n", @@ -146,6 +146,7 @@ pcm_addchan(device_t dev, int dir, kobj_class_t cls, void *devinfo) PCM_UNLOCK(d); return (ENODEV); } + PCM_RELEASE(d); PCM_UNLOCK(d); return (0); @@ -388,7 +389,6 @@ pcm_init(device_t dev, void *devinfo) d->dev = dev; d->lock = snd_mtxcreate(device_get_nameunit(dev), "sound cdev"); cv_init(&d->cv, device_get_nameunit(dev)); - PCM_ACQUIRE_QUICK(d); i = 0; if (resource_int_value(device_get_name(dev), device_get_unit(dev), @@ -428,8 +428,6 @@ pcm_register(device_t dev, char *str) if (d->flags & SD_F_REGISTERED) return (EINVAL); - PCM_BUSYASSERT(d); - if (d->playcount == 0 || d->reccount == 0) d->flags |= SD_F_SIMPLEX; @@ -442,17 +440,10 @@ pcm_register(device_t dev, char *str) d->flags |= SD_F_RVCHANS; strlcpy(d->status, str, SND_STATUSLEN); - sndstat_register(dev, d->status); - - PCM_LOCK(d); /* Done, we're ready.. */ d->flags |= SD_F_REGISTERED; - PCM_RELEASE(d); - - PCM_UNLOCK(d); - /* * Create all sysctls once SD_F_REGISTERED is set else * tunable sysctls won't work: @@ -466,6 +457,8 @@ pcm_register(device_t dev, char *str) else if (snd_unit_auto == 1) snd_unit = pcm_best_unit(snd_unit); + sndstat_register(dev, d->status); + return (dsp_make_dev(dev)); } From nobody Tue Feb 25 11:48:24 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2G891Ywrz5pjwc; Tue, 25 Feb 2025 11:48:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2G886hyNz3kcR; Tue, 25 Feb 2025 11:48:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484104; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LXMUmlVqvfRKWrKgE1QzxvjVPK2/UymSMQOSFPlHEDI=; b=M336k4nD4VAA/EbNwYU4+MJhxxwC+P2OgmeEJtRvCppgve6kQARA0SynMcQKl/rBGc5vrV d49n72OE4RlWUmx22EK3USXVgRjDabDe//fercLhQsCVD3toWTfnRKDv/vHbuADkdRgEDj FWFEX4pq2vXjIn698TBtvUj+CCLM7lIQSgYnaReIMsDZSNVEAYUuDGfylDuZJpJVbx3Mqz BMqJFhrnhrNm8ACBCZQ+JbgPadxkrdVDFEtCLQ9bt1I11YHqoYNtYu/FAY2MDpba8nKsxw vbun8VIkLQbot3rSbcITuq+Oo96Fc4iwzLZeGGNG1fLDi9Gl+Qc2hhbLTsaALg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484104; a=rsa-sha256; cv=none; b=cbXkrMgHtLHk6ycdNYTn0cMN0vj4SkYInzJUmlXj66HfowuHFNs9iFykSDet2TCmEspw+p BX41fgOJsnyV4NjBQkpTPAPGwe8tYEfsxEFxu65c5yiX67BZmiZtcIOFZUm3mmOdo3Uw2B B+U6eHBmtQvDd3f/WElgKblfW+qDMdYthui7yDjtbdsagqqbzClRTN9N4Md7cHQWct5Q5g GMp5bj2f+J/h+ospUu1l4kYwihSqa6BpY4K2L8+UJ930+YMd8WM2PrC9C5IYXuPxWgr5+A PCAPL/EKdmZgOH+bkN+mgIv/eEI+5B2R6RkdOcge45QRUgtEL+rNO+BuN0Qtgw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484104; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LXMUmlVqvfRKWrKgE1QzxvjVPK2/UymSMQOSFPlHEDI=; b=pW/nfPz2NO8sLgoAnUSu+5PYAXO32JYN4mr4ot/ZjehpjX+O6/nfN+nUuh9KIPUpcrzViL Y7Hsui3av4MIRoqT+0r/OkP2AOzpwyN0SDCt9JYHtPY7jY2El0Q99rCQ3q2z37+911iEwA 8vuoXNoCfl6i4ZArYf0U9iFFCklaqAo2Bat7xr9IlYPseztu2AMq2TlfOfUYkp5kE/G3Vx N3AKtpuApqayy6+jkQPmTNBRkgGX25RWOqkhhpDPC0yzI4BBlXr6JZjoNJOCU8vV2rMhts a96rrqOIKB4LJD8PzUI5DR27e75NmDNa+2Sfzed4NGOiKWSDwgRiA2b4Whc96g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2G886CFgz811; Tue, 25 Feb 2025 11:48:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PBmORf051207; Tue, 25 Feb 2025 11:48:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PBmOfZ051204; Tue, 25 Feb 2025 11:48:24 GMT (envelope-from git) Date: Tue, 25 Feb 2025 11:48:24 GMT Message-Id: <202502251148.51PBmOfZ051204@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: bc7e65e95015 - main - sound: Call chn_kill() in chn_init() failure List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bc7e65e950154572d8c9a04dc033075bf37aae40 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=bc7e65e950154572d8c9a04dc033075bf37aae40 commit bc7e65e950154572d8c9a04dc033075bf37aae40 Author: Christos Margiolis AuthorDate: 2025-02-25 11:44:37 +0000 Commit: Christos Margiolis CommitDate: 2025-02-25 11:44:37 +0000 sound: Call chn_kill() in chn_init() failure Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D48966 --- sys/dev/sound/pcm/channel.c | 50 ++++++++++++++------------------------------- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index c3ee50d51c4b..0a0059411399 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1179,11 +1179,19 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, switch (dir) { case PCMDIR_PLAY: + d->playcount++; + /* FALLTHROUGH */ case PCMDIR_PLAY_VIRTUAL: + if (dir == PCMDIR_PLAY_VIRTUAL) + d->pvchancount++; direction = PCMDIR_PLAY; break; case PCMDIR_REC: + d->reccount++; + /* FALLTHROUGH */ case PCMDIR_REC_VIRTUAL: + if (dir == PCMDIR_REC_VIRTUAL) + d->rvchancount++; direction = PCMDIR_REC; break; default: @@ -1292,40 +1300,10 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, if ((c->flags & CHN_F_VIRTUAL) == 0) CHN_INSERT_SORT_ASCEND(d, c, channels.pcm.primary); - switch (c->type) { - case PCMDIR_PLAY: - d->playcount++; - break; - case PCMDIR_PLAY_VIRTUAL: - d->pvchancount++; - break; - case PCMDIR_REC: - d->reccount++; - break; - case PCMDIR_REC_VIRTUAL: - d->rvchancount++; - break; - default: - __assert_unreachable(); - } - return (c); fail: - free_unr(chn_getunr(d, c->type), c->unit); - feeder_remove(c); - if (c->devinfo && CHANNEL_FREE(c->methods, c->devinfo)) - sndbuf_free(b); - if (bs) - sndbuf_destroy(bs); - if (b) - sndbuf_destroy(b); - CHN_LOCK(c); - chn_lockdestroy(c); - - kobj_delete(c->methods, M_DEVBUF); - free(c, M_DEVBUF); - + chn_kill(c); PCM_LOCK(d); return (NULL); @@ -1368,12 +1346,14 @@ chn_kill(struct pcm_channel *c) chn_trigger(c, PCMTRIG_ABORT); CHN_UNLOCK(c); } - free_unr(chn_getunr(c->parentsnddev, c->type), c->unit); + free_unr(chn_getunr(d, c->type), c->unit); feeder_remove(c); - if (CHANNEL_FREE(c->methods, c->devinfo)) + if (c->devinfo && CHANNEL_FREE(c->methods, c->devinfo)) sndbuf_free(b); - sndbuf_destroy(bs); - sndbuf_destroy(b); + if (bs) + sndbuf_destroy(bs); + if (b) + sndbuf_destroy(b); CHN_LOCK(c); c->flags |= CHN_F_DEAD; chn_lockdestroy(c); From nobody Tue Feb 25 11:48:23 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2G8823Gbz5pjr9; Tue, 25 Feb 2025 11:48:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2G8763n0z3kPY; Tue, 25 Feb 2025 11:48:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484103; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=b/7+6OF8Y20GGsenMe+eFvbWbhgt5gSzNQ/gOdRa1nE=; b=EG4v+8KivFMMqpXNYzo9P4JMjReXVuOjbar6hRxDsSKE5zFs6uOCxrq6/p86xYHlOXEryC jF9A2gmR3pOpJVY06b8dbZJGbHF7POaRi7ZGbVMLc1h13OJnQPkTAeue+EqLCQiwtxJrAG M9s9YsIlm12HBq2AF5SliYM3CHENc8ylanWQc3uvZmalbVrtapOmIOQC2z+PB7T3zQejFv qSA7axyyyq4aO8MewUk9sSeghEwN2HzroDRQPPmtOjfaOn+cJy5dOaactVXV2jbPR5CtBW e3Yz4pygA0DqWWnxrpX9cdrwReeYONy1lPqOtsaZ+HaFUE3ux6PBbrP/qfGoYA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484103; a=rsa-sha256; cv=none; b=TLQYCHWpw9dFgYnz7whDVxBKIAkh2GgZHk3XDFFm3BQZcllglP+qeFSWr3FdEpNJddPOIR Ur6gWeh30e+Tmi0oxcgGDH8ZI4yQ2M/ZvoDZK3GGPWax+bbeU5N9Kn+NEBjPRCTKiAMfcY DgxEVj9uhCZFl9y2lWJG8XxGMxY25Kv821sMk/pTcZ9rkJ0DjO63s50xHMdr22/6j5xhaO Scx9Ha9ZQum4YSIycLW0ojEU+hoJQGY9As/fOB3lj2t6t4ZhAIGuKH1NipImbKw4TxFLbV aVP0DrFY1runRCeNlotbU3QuqlP3NvBfIsWSX+Mc2YuBuL63SGO7dECw+poadA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484103; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=b/7+6OF8Y20GGsenMe+eFvbWbhgt5gSzNQ/gOdRa1nE=; b=ngoo7Y+zBa/PawOeKU/H30tJ6G7ny+VLzHenP/maxa9WJCnBu5YYxHkeQLXS/1mvquNGIJ cpUq18PLTVWbK6k25jikFbo2aFll6ph+BiymxcKjWJNcBxr/ziOB/VgWCklIT2dMJJ6dBJ ex372dlQdGls7sOg5rtby8SXXzTxyNIL63jwLDw6NB9A09FWO5SHr35ZbYebZwChK0T8Rk WwZH8gCaKUqj9//Jy/rNC0T+2pTTbe28zLZ3fzt1kseug4+rP6yOAPgIfyaSBPoAbauIh5 fGJ8Ki75Ah15eP2fGrUd3t+7vzlWqgy/YnZBjpZRKvnMjt5GxW3g/tOZAFWDAA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2G875Z1xz94M; Tue, 25 Feb 2025 11:48:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PBmNou051170; Tue, 25 Feb 2025 11:48:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PBmNnu051167; Tue, 25 Feb 2025 11:48:23 GMT (envelope-from git) Date: Tue, 25 Feb 2025 11:48:23 GMT Message-Id: <202502251148.51PBmNnu051167@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 2868776c9c6f - main - sound: Update comment and channel insertion in vchan_create() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2868776c9c6f5313a5676786f642b766f103d780 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=2868776c9c6f5313a5676786f642b766f103d780 commit 2868776c9c6f5313a5676786f642b766f103d780 Author: Christos Margiolis AuthorDate: 2025-02-25 11:44:30 +0000 Commit: Christos Margiolis CommitDate: 2025-02-25 11:44:30 +0000 sound: Update comment and channel insertion in vchan_create() The comment and rationale behind choosing CHN_INSERT_SORT_DESCEND() instead of CHN_INSERT_SORT_ASCEND() are no longer relevant as of FILLME ("sound: Allocate vchans on-demand"). Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D48962 --- sys/dev/sound/pcm/vchan.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c index 45f0a8b00bd2..27739fe68852 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -644,12 +644,7 @@ vchan_create(struct pcm_channel *parent, struct pcm_channel **child) PCM_UNLOCK(d); CHN_LOCK(parent); - /* - * Add us to our parent channel's children in reverse order - * so future destruction will pick the last (biggest number) - * channel. - */ - CHN_INSERT_SORT_DESCEND(parent, ch, children); + CHN_INSERT_SORT_ASCEND(parent, ch, children); *child = ch; From nobody Tue Feb 25 11:48:25 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2G8B5Vgmz5pjwj; Tue, 25 Feb 2025 11:48:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2G8B0tpnz3klx; Tue, 25 Feb 2025 11:48:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484106; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FxmoDP4W5230XQd8fYQrpF4DZZ5AI5QHJ07zFeoGzao=; b=ieOv/ZEPjz6b2JFVWgNpvyuIADYFk3jeotpubLNs2CcrToODpQWfkqoDTM3WBpQBgXO9FH zzsb5FXdLah7Y2RzCd3rrFH4bf8I7H06RLCdUi/lcYGEBN7KxPLdwNvdm7bf2M05q4TvUB qKTPB+9I/AKuFlhaCNN1WXaqQgLl7hQgy9MhjKY6pwbcf+uM2/dmopMubClYPK0AoNexSj kb3rO90ULhpbUmmrT4u8oAU1QQrW4O/48mgQXvvBg7KYH5lbBAF9nQWQhJf3+bZCImN/OE Pe7zjLtSnPKsaxHEo+R2g+iXCVOW/nHhbtz2VQj/pNDd2LPsknKY/XiWOvTqcw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484106; a=rsa-sha256; cv=none; b=HFdh/VupeE3FFC9s10ctt5EiUwy/pUdqkRf+ftP6TvLiTRitqcEjJI+Arreqt561VH6OQu xAZZZFxFL443Iif8Rigla4fyJlBfROq+FZRFAGh/Nv/vZRh0WtUlh+Ttoih9E9iClvgBKt cEI2sp94pHyIfiuozeeDwRp8nwLUb/IVGClnrkOiSY9niaXsCtFNus2Xb8gJAAivl7Kue0 YsbHYt6iOGQhUMi+svziWVOiQb8o1gGUNIgUN8EgAg1XjLQK39UDanHsdccMkvpibhuqpo SBQEy/J+HEtIYIoHGW3HcJ/+lOlcQbuV3fTc3VFDxNDMtpHogELmliibbI6H0g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484106; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FxmoDP4W5230XQd8fYQrpF4DZZ5AI5QHJ07zFeoGzao=; b=odD3Ol9TAKhIii8LOS1x0/KkuAekXPYTGxxCdbvSe45InVqLJUgsyHt3197MYGUelFicPF d9c3CNn4gwzaPEb8hfBUAoxLPprZ4K4idn1+5jXOQZr+WM3k0VGenHVMkcKU/cDQ5dxHS/ OpphhXWhbyJkSQ8K8StOyR/TFQ3pOc3du1VfLzTqIEOnZNMx/RewAIXLqC5/j5Jx/VVfAR /lcp4TZZX/UGJMgG/dcIb882qineS5nZzZOiEniTsuwzdCa4btbX/SX0uB1+B1lExOB9Ff +u8k64W/TxXWTEqdwsssB0QeHk14HNalx0gdJW+miihM5v/w4BefReMyFgwKiQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2G8B043kz94N; Tue, 25 Feb 2025 11:48:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PBmPl3051242; Tue, 25 Feb 2025 11:48:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PBmPNo051239; Tue, 25 Feb 2025 11:48:25 GMT (envelope-from git) Date: Tue, 25 Feb 2025 11:48:25 GMT Message-Id: <202502251148.51PBmPNo051239@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: cfdee707fb18 - main - snd_uaudio.4: Move non-uaudio-specific BUGS paragraph to pcm.4 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cfdee707fb18a0fde4bed4e85414f8803461249d Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=cfdee707fb18a0fde4bed4e85414f8803461249d commit cfdee707fb18a0fde4bed4e85414f8803461249d Author: Christos Margiolis AuthorDate: 2025-02-25 11:44:43 +0000 Commit: Christos Margiolis CommitDate: 2025-02-25 11:44:43 +0000 snd_uaudio.4: Move non-uaudio-specific BUGS paragraph to pcm.4 Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D49019 --- share/man/man4/pcm.4 | 9 ++++++++- share/man/man4/snd_uaudio.4 | 9 +-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/share/man/man4/pcm.4 b/share/man/man4/pcm.4 index e25ffe264ae8..518c37b54f1d 100644 --- a/share/man/man4/pcm.4 +++ b/share/man/man4/pcm.4 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 4, 2024 +.Dd February 15, 2025 .Dt SOUND 4 .Os .Sh NAME @@ -673,3 +673,10 @@ It was then rewritten for .Sh BUGS Some features of your sound card (e.g., global volume control) might not be supported on all devices. +.Pp +Some audio devices might refuse to work properly unless the sample rate is +configured the same for both recording and playback, even if only simplex is +used. +See the +.Va dev.pcm.%d.[play|rec].vchanrate +sysctls. diff --git a/share/man/man4/snd_uaudio.4 b/share/man/man4/snd_uaudio.4 index 6e2509b8f2ac..00329a6d8e40 100644 --- a/share/man/man4/snd_uaudio.4 +++ b/share/man/man4/snd_uaudio.4 @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd March 26, 2024 +.Dd February 15, 2025 .Dt SND_UAUDIO 4 .Os .Sh NAME @@ -156,13 +156,6 @@ and modified for by .An Hiten Pandya Aq Mt hmp@FreeBSD.org . .Sh BUGS -Some USB audio devices might refuse to work properly unless the sample -rate is configured the same for both recording and playback, even if -only simplex is used. -See the -.Va dev.pcm.%d.[play|rec].vchanrate -sysctls. -.Pp The PCM framework in .Fx currently does not support the full set of USB audio mixer controls. From nobody Tue Feb 25 11:48:27 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2G8C2dDnz5pjrK; Tue, 25 Feb 2025 11:48:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2G8C1VMYz3kmB; Tue, 25 Feb 2025 11:48:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484107; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qSzTaushSYAyfOZMusASMoyG6vpALdn018w1FcL1tjk=; b=e6oeWKWc+S945O0pjykasVL1QJRDx5cRJK7gHUEPbgMRspqzpJZTw/U8LlfB4AjPn/Obi6 ZBQyPlDDbuZywJynumXYgyBqgU7+72Wdakax3WsnxjrmqEZ21Tt6x9n28+NaJXwxi2mA6F Vb9hJ7iK1sn61fjqb7qS2MlQPXoix3mT+OUSsnQ+7N3vssmtxG6JS/AWZwzInOKOx8tw1Z Dw4h7BnqE+zJVHecl5fm80HLw7nwsvPfiFMXQ7J9bRbJ1zuQig4oAngQt2EJ24ReHx9HIv n2TQ28D1UIa1cfWNHE89qYQwRFaFJ6+ZMrv9JEBRBctawWDAQlcE1fMXU5mH1Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484107; a=rsa-sha256; cv=none; b=CtGBjjEV+7JJGjewpJqhQmBw4OsKOJv3jEI3LeCoUUERjNQERU3CIInaSf3XjGSq36NJAe E8Xbxrc00xWxAbdPOz4MYTGk1VvcXBkXV2eH9jv0Z/JekgL7lh8ZV7XeR7IhA4IwEtf4Lo IgJTDzgLFVCNiB7Kl57jRDF6NIDx//2lJ4tth7Dh8YYFI9kKzqxPXbb8IOKPk1KlEyoZAX pSpRQ73pFysK5XYnQ2vRdYqM13rJc3BwIlP7QR4t7H1Nz2PPtojJrFHsXQwdtyKg9nHOGI Lo+HLqmYP1fIGgp1zaT8O+Zkkq53iuw1LCNGztOYpYOaSvi2z2jsm2fVLOwWAg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484107; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qSzTaushSYAyfOZMusASMoyG6vpALdn018w1FcL1tjk=; b=bBybChxFjsxw3T1fH5ff3l7+OL8efVMKWKmVUD48VudaZ4PAiZycqKISsgs7mk3aqSxaK6 DuvSKD5Bb84UQWtiGoX1ThhSjmfHDeoN2k4Tnekpee6r1LsKCp1cQqcFoRZCYOz7nIbQTC leePe+rrydYl1uN95wUdNyeZiaTdrrWZYANL9xVb1FkqCYGTaSevnN1Owmaw8W6p0Zf76v wlGhlZr5EsTLKOo2gNRbTeCDXQMJgE7icck9kLPjlyalKKo6Wxk5wfVqh0dyAWsXyRUMz3 22rzzyckiDM0p6HJZfgqKqzyE+ScwNTU62PExsqrLdrEf+MbU6NXIQ9JW2aRDw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2G8C0y4zz8pl; Tue, 25 Feb 2025 11:48:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PBmRLs051275; Tue, 25 Feb 2025 11:48:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PBmR84051272; Tue, 25 Feb 2025 11:48:27 GMT (envelope-from git) Date: Tue, 25 Feb 2025 11:48:27 GMT Message-Id: <202502251148.51PBmR84051272@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: f121de8fbcbc - main - mixer(3): Do not skip devices with no volume control List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f121de8fbcbc8aa82f9fb59039c502406b7c88b6 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=f121de8fbcbc8aa82f9fb59039c502406b7c88b6 commit f121de8fbcbc8aa82f9fb59039c502406b7c88b6 Author: Christos Margiolis AuthorDate: 2025-02-25 11:44:49 +0000 Commit: Christos Margiolis CommitDate: 2025-02-25 11:44:49 +0000 mixer(3): Do not skip devices with no volume control Some devices might not have a software volume control, but still be able to be set as recording sources. PR: 279787 Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D48730 --- lib/libmixer/mixer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libmixer/mixer.c b/lib/libmixer/mixer.c index 4abbed9b27d3..2be3a48eb755 100644 --- a/lib/libmixer/mixer.c +++ b/lib/libmixer/mixer.c @@ -113,14 +113,14 @@ dunit: TAILQ_INIT(&m->devs); for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { - if (!MIX_ISDEV(m, i)) + if (!MIX_ISDEV(m, i) && !MIX_ISREC(m, i)) continue; if ((dp = calloc(1, sizeof(struct mix_dev))) == NULL) goto fail; dp->parent_mixer = m; dp->devno = i; dp->nctl = 0; - if (_mixer_readvol(dp) < 0) + if (MIX_ISDEV(m, i) && _mixer_readvol(dp) < 0) goto fail; (void)strlcpy(dp->name, names[i], sizeof(dp->name)); TAILQ_INIT(&dp->ctls); From nobody Tue Feb 25 11:54:19 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2GH66NFxz5pjwZ; Tue, 25 Feb 2025 11:54:26 +0000 (UTC) (envelope-from christos@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2GH64dCdz3vkX; Tue, 25 Feb 2025 11:54:26 +0000 (UTC) (envelope-from christos@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484466; 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=g9IOjDed+bs1ZaMrUKuPZRlOFJsXfubdJTsTBGzlriU=; b=ceV9wAvpjdkKv4Jcr0vyNq752X92KfNYhMdJ60UYQ5qDMMgohhpRKfR6TODschtRxGyLj1 9JoAxTQE9k1Ym//tpW78ee4+Xp84syoVi3RvB4rdlzjSz4l9b9qTkrFlCuVb7wYlflfm7G jhLF6pcbrlOUDgdm/dEvi/NJ4q0ynjAbfqp2BAbyNs32w6sHKnv4ZxuXrOKCZC3lmiY68y jve8nxWEJqHlDX1KtW0X+fECGTom9NfctWFC8bgClIRVSribSsjZ5hxfDcNS5GV97cWqfr F0wmRHdXBos0sm3Lsrzr2+/chTcvlmBjti4IPMmJj235vmg2BPwQC0rZHQZ3mA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484466; a=rsa-sha256; cv=none; b=PcOTG2Jjed4xflgRjnm+2JPMIWHWwNAg0AngFLpZPdsxUT6fqWYcYIL6k/9RmW33pjNGOX BBoBivvOZt1shUvOQbTKySOMjY2/WUvxk493u76TvZL02rQYmVZhy6Vrv8yQeQH7pbUO4x ZEt3Fg2MJFPDXHrMTPD2Vq/2WISmmRS0ftoICnQC6eSniaVxD6hnfXI3sHQ3vTLJjs1lAb RPWNHztjXlzGuN5ZTG0PW/Oz+wt/VKMDaOnhQ7t7PJHm+nDKd/TayfCIIzARjA9/08obfA y0ObxBnucLx3MawFl6pNmSs6pq8EN9J0YyaQhg1/q4tQamdcugIj1x5qfnEQEQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484466; 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:dkim-signature; bh=g9IOjDed+bs1ZaMrUKuPZRlOFJsXfubdJTsTBGzlriU=; b=jwFA0CLPe8J3Sp4O0jwZnt96namwIUIPKti3Z4+LM1zu1n0mJCpatE7EsNCt1ARjG9XUee puP6ZXhSP57gGqqp5VU1DgmdGQzUeO9oKyhuFoUq7PrRHqSgqvfhXhXWmajYzozTJhkzTH MUwaXwTg1mLeb0DNr9ufTUG8fXdmc1KrjW3m0/eD1st7oiYYjYRjQ0eI06tkTx+Hu18kTt +kUZHWv7rPNqBgcYn4k50YtvfukpWctXgooYC84gKkXA4AJIcVxsYJhPn4JDBVVrTj45+3 2bZ8bN6uYFTi1QxP7JgV20KzKnFBmPrsp7hLTuGFitsQqm5+iiiBuZWvtvwN5Q== Received: from margiolis.net (mail.margiolis.net [95.179.159.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512) (Client did not present a certificate) (Authenticated sender: christos/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Z2GH6173Fz3BX; Tue, 25 Feb 2025 11:54:26 +0000 (UTC) (envelope-from christos@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=mail; bh=nR9/Tla7mTwEfJc tYYMPqysE4Fmv3XnZcBxQXJ5txgY=; h=in-reply-to:references:subject:cc:to: from:date; d=margiolis.net; b=RouBSHxmCTKYZNrDShYPvpRMfSSu0RZlNdv/Qrvb Is/KN5r169juKocbOll9e0mRZrpP1hpa5s7ciBpmVL35/LifzKHIvfxSbMqzQtRiQft9Qc gzbwc/7EBFrshNblCxw+qsYgFOCD/BTOI31cjCpEUco/3Fs18W9u1c9e9Fxh0= Received: from pleb (public-gprs368599.centertel.pl [37.47.71.24]) by margiolis.net (OpenSMTPD) with ESMTPSA id c765c465 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 25 Feb 2025 11:54:22 +0000 (UTC) Date: Tue, 25 Feb 2025 13:54:19 +0200 From: Christos Margiolis To: src-committers@freebsd.org Cc: dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 2868776c9c6f - main - sound: Update comment and channel insertion in vchan_create() Message-ID: <5c6vlgmnxtmfmscsegx265wrxwjgrd7tqi6nhztqpxz4zmyvof@qrhioyjpx5hz> References: <202502251148.51PBmNnu051167@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202502251148.51PBmNnu051167@gitrepo.freebsd.org> Christos Margiolis wrote: > The branch main has been updated by christos: > > URL: https://cgit.FreeBSD.org/src/commit/?id=2868776c9c6f5313a5676786f642b766f103d780 > > commit 2868776c9c6f5313a5676786f642b766f103d780 > Author: Christos Margiolis > AuthorDate: 2025-02-25 11:44:30 +0000 > Commit: Christos Margiolis > CommitDate: 2025-02-25 11:44:30 +0000 > > sound: Update comment and channel insertion in vchan_create() > > The comment and rationale behind choosing CHN_INSERT_SORT_DESCEND() > instead of CHN_INSERT_SORT_ASCEND() are no longer relevant as of FILLME > ("sound: Allocate vchans on-demand"). Forgot to fill the FILLME. Sorry. Christos From nobody Tue Feb 25 11:58:59 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2GNN0wsLz5pkfH; Tue, 25 Feb 2025 11:59: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2GNN0RQ5z41KQ; Tue, 25 Feb 2025 11:59:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484740; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1XIRy47ptex23QvUgf9agNVkHjjXDo63ZeLDutXFwDQ=; b=s7LzuWdMPPuwf3kmDucJxPlM3fTux1CloDVR+Hz/STdaIiqZ3ALxzGg99ZX3ZwYujgbScZ w7Z7zzkSacYqGDxCeiKgpuTgiNaSHtIkwR5be7VW+YL7yxe9gGt1b8ufSBet66qHbBX+xU VhPTdZFo/Up5WWataR48rR0ZrkafxBUhRMjIpaG45ZehqO48g6AID+ZjbrqzTE3zidOUEj IaLGzgVRKOyYMWDQFV2PSSdZyDcKAhzFNJ5sbb6aY3vrN7znL/q3AIB8QqN8hMJiBQX/dI CKC5E3cAKCO4P+X4rvlxabNTgNiaw9zEVK01kMgVAuQjOuq6bKD+IaJL1GywRQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740484740; a=rsa-sha256; cv=none; b=TJxFXaMJ98JzK3PxlPquUrzw4ydS9uxaYOo/im3q+FEbpA0cg+GF2pmTFGPmWmpw5Gitaz QvFX2VH5LK2l8BUdLPBAg/5XiHhzek3U/9aXlzn+N3KB4nVu/EMgbtUPUO6NTya3UMuM2T lOepRqsa3Rpn8ikCL1T9ARI55ST40Kasa+3nLzA4QIaCPPdhbSrfiUumPGqhmbayE5/8v8 8jhbZ8T7XNhERqVmqgkejGcKecgg7cuKyiT8y2cvQOLz7G1zZK6EtCXupJpJTVuNU1uXYh 4y/zwlVIhnCsLr7mMaFtIjNDthJUbaolxdCQ9Ga5Dfj/LrUQLMCURxbYbuFtjQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740484740; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1XIRy47ptex23QvUgf9agNVkHjjXDo63ZeLDutXFwDQ=; b=L2rdCHj/+l9LBgzaRIDduDaqqgCbLcOWpE+duQvbtvo8pgR1zycSRV+US8NWXnmYqUP7X3 K4sTRh8it+pM7os0nu1u/Pw2oQFhR81a1CgDulCq45WMhwOUFSmbhGnTThwxLiQhFDFptq VezI5lAXCHN/yuE/bxhdkeHt0kIzkX01E2SL8PmgYc5DbAF2/5Tl4Afa5ob4ssA2necnO9 mJzg4AfYNfHSYYaxItDQ+pK7S5KoUfyBgy7V62o+p5VN9pej6CeWm2HaetMRQYodB7EDM9 Kb40WLQ5V2YILIUL8HJELArDq18dWDhQSI7FsHoe5zgw3RmjRArrR0qsMKaWXw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2GNN02Ftz92c; Tue, 25 Feb 2025 11:59:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PBwxLF069941; Tue, 25 Feb 2025 11:58:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PBwxbO069938; Tue, 25 Feb 2025 11:58:59 GMT (envelope-from git) Date: Tue, 25 Feb 2025 11:58:59 GMT Message-Id: <202502251158.51PBwxbO069938@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 3b60c193fc8e - main - RELNOTES: Add 02d4eeabfd73 note List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b60c193fc8e0d4fdc6cf8683afbb7c9b3b5f6ca Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=3b60c193fc8e0d4fdc6cf8683afbb7c9b3b5f6ca commit 3b60c193fc8e0d4fdc6cf8683afbb7c9b3b5f6ca Author: Christos Margiolis AuthorDate: 2025-02-25 11:58:25 +0000 Commit: Christos Margiolis CommitDate: 2025-02-25 11:58:25 +0000 RELNOTES: Add 02d4eeabfd73 note Sponsored by: The FreeBSD Foundation --- RELNOTES | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/RELNOTES b/RELNOTES index 96e2d24bf833..7b5eac0d8730 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. +02d4eeabfd73: + hw.snd.maxautovchans has been retired. The commit introduced a + hw.snd.vchans_enable sysctl, which along with + dev.pcm.X.{play|rec}.vchans, from now on work as tunables to only + enable/disable vchans, as opposed to setting their number and/or + (de-)allocating vchans. Since these sysctls do not trigger any + (de-)allocations anymore, their effect is instantaneous, whereas before + we could have frozen the machine (when trying to allocate new vchans) + when setting dev.pcm.X.{play|rec}.vchans to a very large value. + 7e7f88001d7d: The definition of pf's struct pfr_tstats and struct pfr_astats has changed, breaking ABI compatibility for 32-bit powerpc (including From nobody Tue Feb 25 13:10:18 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2Hyg1Y2sz5prPX; Tue, 25 Feb 2025 13:10: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2Hyg1643z3dd2; Tue, 25 Feb 2025 13:10:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740489019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5T/CfwqOmtUuO8cneYhsQmvM1lQJWQ5KngzJ6EH5bqo=; b=CTxEk0cqjmsXKbAdlPR1BH4+r1U+ULFvxlZa29lj9FGwlF7UZlk9nU/JT6lWoh50rPxfpY FG3ukh86mhf/Dh0lvnwvqJoQEcc5eDKS3uB7ENQM/nDxpO+F4cU0wZQLoXiEuOTYID6NmZ abJsryREUI0hxH4VGEjvYbmFRD9+wsbHqaFrMk5HTvto8DSFZXj4h/L9DbdkuiFF4s7aeb w6M/M+Pszg9e4Tw858jHaCNs/CN6/dSk5GHdKspaFEx2XN6ndDLhxZTuG9GrOG3Ku+MjCl QVYF73N4kZ59qSnW691ebQiS5jc6vNsMEkC82436qJgcD8cYkOVG3Ys+rtKMBg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740489019; a=rsa-sha256; cv=none; b=NZTM5KjHgZ4tXQ8631myYCALZ7EVeqAtHyIVlaJzUz9hRRrSg/O+MeTn5oesP1+wqwJoh+ nO1Y2QYrKB01H6oWPpct4ksbQDAF/6rGgkrTyJmcfG6k54syOxdRoVJ2RJb9RqkxJlLoPT duv1CMxyloHxYjLH2UIl+g8D6npmJ1ZrQUCWYDecxDZWl77iI0IirVzKvMhhg6ZVlpzxIu MQRqYF1LoymZFPRQ2vTzviHhDkiqDsM4xJVy8wBY3LeaT6YEfwKiQwiOGzAWirFqd5Z4NF PI5Z4OrGsGzLR/MoieOzd5e/SIQg8GZBgyLnIXXluAeyrWHEn4lslaPtqTGrKA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740489019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5T/CfwqOmtUuO8cneYhsQmvM1lQJWQ5KngzJ6EH5bqo=; b=NCTFQZuVuC+Cx3MspxCC8WNWUzYImvhh6o9JAgEftZljEXXFty93jXqMVVk274HfKMJQ7p rPppuBbW2SMzNxui8eixq8nLufb95rYduj9j12Lpt502tQJKVAfGBTQ/pl87pW7IYmXLwA YcEmmDvmYpOkz6GlBTzLap47vynr1+05lY5Izvs7MvaBfAJYaC4WJsPv+a1ZRXbHiPhUQR +deBg66Zrov+8+e3X9GV94mDu+rj6vVduhXZ6ZxTko0eT9eeqaeBgsr/nktX+jknPldrmG K6BXJWGgCz1e1vxcuxe2lgZJyoog28abRiiYY7AULoiDgApDpjGLCbXqkRO5nQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2Hyg0SrSzCD3; Tue, 25 Feb 2025 13:10:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PDAI5Q011263; Tue, 25 Feb 2025 13:10:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PDAICC011260; Tue, 25 Feb 2025 13:10:18 GMT (envelope-from git) Date: Tue, 25 Feb 2025 13:10:18 GMT Message-Id: <202502251310.51PDAICC011260@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 085c0641a2ea - main - bsd.mkopt.mk: Avoid warning from makeman List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 085c0641a2ea0dee2c58b5bc6e62790a164ebd52 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=085c0641a2ea0dee2c58b5bc6e62790a164ebd52 commit 085c0641a2ea0dee2c58b5bc6e62790a164ebd52 Author: Ed Maste AuthorDate: 2025-02-24 14:51:31 +0000 Commit: Ed Maste CommitDate: 2025-02-25 13:10:07 +0000 bsd.mkopt.mk: Avoid warning from makeman Setting WITHOUT_X where X is a __REQUIRED_OPTION produces a warning. This occurred during makeman's `make showconfig` invocatation, but the warning serves no purpose there, and clutters makeman's output. Skip the warning for the showconfig target used by makeman. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49123 --- share/mk/bsd.mkopt.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mk/bsd.mkopt.mk b/share/mk/bsd.mkopt.mk index 043a41212064..f93101544bf7 100644 --- a/share/mk/bsd.mkopt.mk +++ b/share/mk/bsd.mkopt.mk @@ -67,7 +67,7 @@ MK_${var}:= yes # step towards removing the options entirely. # .for var in ${__REQUIRED_OPTIONS} -.if defined(WITHOUT_${var}) +.if defined(WITHOUT_${var}) && !make(showconfig) .warning WITHOUT_${var} option ignored: it is no longer supported .endif MK_${var}:= yes From nobody Tue Feb 25 13:33:20 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2JTF3Tcnz5psxf; Tue, 25 Feb 2025 13:33:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2JTF2snSz3t3k; Tue, 25 Feb 2025 13:33:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740490401; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0bw8qQOKtyKxT/egx8mCAZjxcBHDdMnyS4h+qPhynEE=; b=n9EazGtLSBKXppNt7ROgJ1kTnvfZ2KIlEeYLhy/6UdLLlZGa7tdhIQbpC6ex7mAlM/eXE+ BTOWYAZ4Rtqd9yeqbod2Eu4DDtghMWtLYEAoh9+VW9ACQHGIlgqDgBd13K3h9UCGMIA5FH ETp53YWsWIs/wmKKnJnCRT3M28kn66myQaqBAjNMj3SJY1rnU7/ot3hGQqYh1XLDsq8s/x dHedRgMhx0og+AO63yZckoN3GGNAF9SILgKbrj4ebUTi6w2cA2fHnpFTfF209ahqn8XEDi gKVVV86B2KOdkqMOjiquDj6EdF35eWbFSriMPTlDJMtZvIVhthSF9G34z/LG/Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740490401; a=rsa-sha256; cv=none; b=dyuwb0j0JsTGiL7tCCfUx4rHaHfpFrAVjraRl13aQ9TMaPx/yYbgkNtjWD3RxhM+i10QBb LYqYx95eDpiy/iiUfbm8s5lnr+Nufs19Ud52ZFYs3Xu6dJamJ15cIniV76CyeZppgPdvr0 PCEYQ9t/ekBwKB6PiyFhmWq9clsDHYMLcFhY0BB88V5jxiBfCWekPsoIG8wNO4bsnnZxAu eqEWgWDokCK5El4uayAVSHfKu/1YrikxfEE9nVp5YGN0uZl67rq5NTYLXBagQBQWDtzIPn Zq0kcvicVOre+OZSm5qWXzGgzWO9NSgjDYw1sN+4aIsSkR2/EAkznEizSLJiCg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740490401; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0bw8qQOKtyKxT/egx8mCAZjxcBHDdMnyS4h+qPhynEE=; b=IDOd3IaRzeSs/8pkThSSwlYvrLMBEtKg15wa9zG1tsCmEM6kQx0d8whY6ZoP3iLrDd4irx onWpps2UhXHw1n0DizhK+F5r03a+K5f6ezcIUEX4QEJquIn/1jblJsNuE3ee5yjuVL7fez TxxfTm0PyaXcErwmDtdILqknGbaRribC7j/eyofyu+OS8B5c8dXn2HCtg22UHy1yNqUwWi 6yiCs3dkDYeDV1tlUg2NEDzYxHCb9Wifz/wKkprzWPa/LAvVSsc5GMKjcgpywYTH49Kzl/ J+azp2OOqJ9B/cJWQOBmYEZO5MPAty+tIpSOxDBxl4nffhxtA7kHuVvlP8KmNw== Received: from [IPV6:2601:5c0:4200:b830:7494:dfe3:4196:8949] (unknown [IPv6:2601:5c0:4200:b830:7494:dfe3:4196:8949]) (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 did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Z2JTF0hssz4tr; Tue, 25 Feb 2025 13:33:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Tue, 25 Feb 2025 08:33:20 -0500 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: 93b4a5445658 - main - netgraph: prevent panic with INVARIANTS-enabled kernel Content-Language: en-US To: Eugene Grosbein , Zhenlei Huang Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" , "Herbert J. Skuhra" References: <202502250722.51P7Mwnr064433@gitrepo.freebsd.org> From: John Baldwin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2/25/25 04:37, Eugene Grosbein wrote: > 25.02.2025 14:59, Zhenlei Huang wrote: > >>> commit 93b4a54456589e78dcd37f2db8333baff3f3f0b2 >>> Author: Eugene Grosbein >>> AuthorDate: 2025-02-25 07:18:29 +0000 >>> Commit: Eugene Grosbein >>> CommitDate: 2025-02-25 07:22:53 +0000 >>> >>> netgraph: prevent panic with INVARIANTS-enabled kernel >>> >>> This change makes NG_ABI_VERSION depend on INVARIANTS >>> in addition to NETGRAPH_DEBUG. >>> >>> PR: 257876 >> >> Maybe a wrong PR ? >> >> The PR 257876 is about port math/deal.ii , I do not see any relationship between it and netgraph(3) or netgraph(4). > > Sorry, paste error. Right number is 214624. The best way to probably rectify this is to go add a comment in PR 257876 saying that the commit in comment N (7 in this case) is for PR 214624. Then if someone in the future tries to look up the bug from the commit message that gives them the note in the right place to find the right PR. (We should perhaps codify this as the way to deal with PR mismatches in commit logs) -- John Baldwin From nobody Tue Feb 25 14:58:50 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2LMt5ZCSz5q264; Tue, 25 Feb 2025 14:58:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2LMt4yTDz3Rmv; Tue, 25 Feb 2025 14:58:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740495530; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XnMItXFVTfi46rEY3EthXH52VdZxP+3MLZSKsYV4YPE=; b=PTCKDt5BN0IUR2q94nJfymo0A91vVlOLzR9sx9ELheqqKp2kIKwzF1CJe3HT4Las/Y0hJU bX3F+WEG7Ng2gWkZN2j7pLPQ6zH9B2nyhJO9gRFy4Gj8kjRl+Iw2Bo/BRPXlU1UxtPqGKM iITM3ZSXDTG9KaSb6FmSnfSNABYyKV3RAgCeW5S/LpiYp5/iPV0xcvzKd0iEz2wA00wkPM tb8VyAYez99pkdKgEs89kqwUZArx2CAUIMHQp+B7rUVAGm59j8bHQnUwPKme0VEgxP32b8 IZ1dd7RUwN2DQc0Y/qbI9jzaS0Yi83TVcxB9o+M4ZYaElFMjlNGgCRBT2wOlOA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740495530; a=rsa-sha256; cv=none; b=gL5tm5mNU+QqPSZddWPSmQdO1NGTXC8+SbUonjUGUe5X/ORfvJbOLTzjyXBhNIKQPsPA9g 3+HVTGP1K2zP9GmG14yLAoVXQwH0lO9FwOdrnvlLDRnVqp2XWCwxt823QR0dzORkGzZW76 DCyNKLENjq0Q5j+ZhFYNHXfXhz3w5OYgUE7iQMIIx5SsXi06Zh6kPPu4DTNQsTVEgEFQnS 9uJZblcM4hrkSTuau2fivz1ZjEc8WP2im3Z6jqouTy04L/f2yGNas4MulKL/9raR+PZg8A QKCVqx2stE+MC82ZhbwjKH87QKC0veq3loF+Cf5iAOmK/CZutBHhm+7OPfyj0g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740495530; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XnMItXFVTfi46rEY3EthXH52VdZxP+3MLZSKsYV4YPE=; b=hC1jYDgUAEUhCke9+f987J5rI7H0MZHlW8t6wFvxQZQIdiMyGSlETvQVDbeq3a78R5ahQy uXsFqgMK/TUTUJbzIHktg45rsFob1M7s3GfUSwkO2qEfPa4Mw3btzZMf0gEHmmQM75H/EF x7GiKFD6/SWFvyenVY8EW9A7thXdwDxw4kfKRSipZJxsdB+1dYqznexSlBO6LYqLImQawR JyWsSGwPOLY9jjhKyuQJSRo8Yf7rPokywGcQMmeUQmcQqfZOTTB4JnBDlTd7Br1VqE6VXf yvFkO/hNQ/LZkJYtgqNTUNWcwAD4KIydQdeE4gUlbJ1mmVQVupsKSpd3dbIJKg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2LMt4FxBzWg1; Tue, 25 Feb 2025 14:58:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PEwovr006835; Tue, 25 Feb 2025 14:58:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PEwolL006832; Tue, 25 Feb 2025 14:58:50 GMT (envelope-from git) Date: Tue, 25 Feb 2025 14:58:50 GMT Message-Id: <202502251458.51PEwolL006832@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c040011f072d - main - ifdi: fix signature mismatch for null_priv_ioctl List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c040011f072d192ef73439087ea986e498975234 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c040011f072d192ef73439087ea986e498975234 commit c040011f072d192ef73439087ea986e498975234 Author: SHENGYI HONG AuthorDate: 2025-02-23 17:10:43 +0000 Commit: John Baldwin CommitDate: 2025-02-25 14:21:51 +0000 ifdi: fix signature mismatch for null_priv_ioctl Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D49110 --- sys/net/ifdi_if.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/ifdi_if.m b/sys/net/ifdi_if.m index d52bf66bd110..f4a3db5092ab 100644 --- a/sys/net/ifdi_if.m +++ b/sys/net/ifdi_if.m @@ -107,7 +107,7 @@ CODE { } static int - null_priv_ioctl(if_ctx_t _ctx __unused, u_long command, caddr_t *data __unused) + null_priv_ioctl(if_ctx_t _ctx __unused, u_long command, caddr_t data __unused) { return (ENOTSUP); } From nobody Tue Feb 25 15:37:07 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2MD34J1Rz5q51s; Tue, 25 Feb 2025 15:37: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2MD33jDjz3p4S; Tue, 25 Feb 2025 15:37:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740497827; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eq6KmCJIeBTd8rDD6WgL6PdNTcwGR32M2h38PAVExfo=; b=nlsrsUSLVpPcTuW7IsCieimtiB5uJROhVsbiaMcPNpXVwNcU7+j8SXLvxWaXsEpx76aXDg fZqkUnZT59pE0dKey+liCbsFraqLL105txIUSAofY3ouoPykkcIczAL58VY75Cjo0O0uAF VZQWTX64RXBHwkj9ANLKhdMqhL6eHaCC8YujaJM7obif0MRJKJo2visxt91LBiTLxAxGvp t6LA+DOwB7XQ2h8slCg2TuzEV0jyBAnj2KXc5qpWvh3jldd3sY9x7j5XzLmaQIlI4BB/79 ZXeHmDNYdiufZcLkQjEgcgc5sTeF+3kUv1q9L7O2jGXVzZDtqCpjVz5d5Wwpfw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740497827; a=rsa-sha256; cv=none; b=YkcGt3/9XlaN+TT8T6peHaHHO7KAFjpGeNJoTSQUEwo0FtOLcCWax0Qj+1dNKaW84U98Kt FVZIkHbobkvbNubTs55KfA/mR3AOGxPg6E5+EPC9bceAVGoZMbuzysTAhZbA4ovGf79AxV 4mp+KwLL0+Fft8A9E/mRNx2pxkhgutJpoJ4tk4srG+slcbe+UD7pooWtkASZ0D5rj2IJxI X4a9+skS3a9cY8vgG96veSkc4VAK8uW8j6DOe9L4roquNT77zJz5TkFSTlj2Q+KMyCAmay YQds5ehq9WrL+URkyYdPPkX1vTiQo8HrseUyEc75hLHjP8xdU8jCB0T9xhRcQA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740497827; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eq6KmCJIeBTd8rDD6WgL6PdNTcwGR32M2h38PAVExfo=; b=eYevGVe/aaj8UpdFW5BHIf4t00QJiHGa2N52diL27BRIPJ1sagljk83TtflvgZfvRKeX6Y q9YUNxEms7ZtqgnTSZOgMHOFKO6pUWHa3U0uqLY8d7BdHn7XJhtL21NQljx1g4krUUHsAe 0OAkxkoG9ItbWCXVPkW+I2GCRpV9QPO2zbJUkfogGbh+OmvCKV7lE7JAkUJemksV1IOPv1 Q4RzzJJTQHvd7ywAB12w3Q8ilYJ1612m7OfJWeFXT7ymWK5aaHoXHHL8EzgbNwAaPj26Ms db8uBohU+55Z2YSGtzimkM2bAux++KAdI3Yy/suOb/fp+RABra5IWXEOHGuxQw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2MD33JldzZ3s; Tue, 25 Feb 2025 15:37:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PFb72V081865; Tue, 25 Feb 2025 15:37:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PFb7MY081862; Tue, 25 Feb 2025 15:37:07 GMT (envelope-from git) Date: Tue, 25 Feb 2025 15:37:07 GMT Message-Id: <202502251537.51PFb7MY081862@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 601925180df4 - main - libpmc: add more alderlake models List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 601925180df4d165f4c2c4dc91a49da7b9f3438b Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=601925180df4d165f4c2c4dc91a49da7b9f3438b commit 601925180df4d165f4c2c4dc91a49da7b9f3438b Author: acazuc AuthorDate: 2025-02-25 15:23:37 +0000 Commit: Mitchell Horne CommitDate: 2025-02-25 15:35:26 +0000 libpmc: add more alderlake models According to [1], the CPU models 6-{b7,ba,bf} are also alderlake-family models. This patch adds them to the mapfile.csv. [1] https://github.com/torvalds/linux/blob/master/tools/perf/pmu-events/arch/x86/mapfile.csv#L2 Reviewed by: mhorne MFC after: 3 days Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D49126 --- lib/libpmc/pmu-events/arch/x86/mapfile.csv | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/libpmc/pmu-events/arch/x86/mapfile.csv b/lib/libpmc/pmu-events/arch/x86/mapfile.csv index e09007e0e353..7a9fe8c59cb2 100644 --- a/lib/libpmc/pmu-events/arch/x86/mapfile.csv +++ b/lib/libpmc/pmu-events/arch/x86/mapfile.csv @@ -45,6 +45,9 @@ GenuineIntel-6-86,v1,tremontx,core GenuineIntel-6-96,v1,elkhartlake,core GenuineIntel-6-97,v1,alderlake,core GenuineIntel-6-9A,v1,alderlake,core +GenuineIntel-6-B7,v1,alderlake,core +GenuineIntel-6-BA,v1,alderlake,core +GenuineIntel-6-BF,v1,alderlake,core GenuineIntel-6-8F,v1,sapphirerapids,core AuthenticAMD-23-[012][0-9A-F],v2,amdzen1,core AuthenticAMD-23-[[:xdigit:]]+,v1,amdzen2,core From nobody Tue Feb 25 16:48:18 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2NpB4f5Cz5qBf3; Tue, 25 Feb 2025 16:48:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2NpB3y6Rz3QwF; Tue, 25 Feb 2025 16:48:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740502098; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NiSU14r71Q5XUroEcCU21G93G+cgtVgy8kxjydR6OI4=; b=c8CaLpUOy8LMeQlumn611xann+NQ6CaRjNEdoq9rMuzc//uAeYGmuj1eqiPGdimsxDgQfR vMVW0OU5OP9jIbrIJUVFH0Jn70sRULrgbYT3UgoyTw/fcsoapA9BtdwYtmfC20HwoNtY05 cVTNRBGWJlF8B79oakDMYRxGrUYwFidScEb7xb/fPz9jCjK7rjdobrDkLYsdf/88hmHEWM TpJqNS5rtspPm4g7MHRh7HgtVKopTBpNMv3tUuyygAM5AUPg+j8nHRQjWHjXBmrXLEfYCo fPIgYZwxtnKwptSuLwhWvEfmvwXJR4B2numz8r6vIwPjuX/m19+aZPVePDbRdg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740502098; a=rsa-sha256; cv=none; b=UY56jgJFXvDsAzqKIxNxJZZIomZk5TYeHhfYTh0mHacyId3k6P+WrFI2a/J014kfqceRzc pQAwAGuDrl67UYB2qg1njnzeP6MaUBWOfmtgFL4BeZPMABWG6YHyBRfMcwdguRxx62tJwj wdIQGFHRfveJuCbMTNkWW665P6NWGaR6rzTzcTMgLnAQ0Fhk9An+adcOYcDIqphnD3+Gpf /OlE0AumITTBS0yVj2VgjGrauYzdwQElb8puRJ7RpDej8PXTimcT3qYlJngFyjdTGJKPv3 BEuVdGP15ngdFCIVtQ2veWjJdiANVCn3ZReN/1V0EvspyHwyDSL2uPdHxr2adQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740502098; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NiSU14r71Q5XUroEcCU21G93G+cgtVgy8kxjydR6OI4=; b=pLDngdlGsgBcEpKmemVWIIyFAamFeMJTN7f5IX+bmSeQ6qnyWKIT5o7UPVWF6DDENSpDEW 7NK1nENb1EByozqCpeCqJDBlETPIwvDpKHInznTQ6M+MFLynBM0NgPMULewjkPrD4bKoND EgeIxFm9S91G5KgtwW8sVTpiiwJa7KLJNNxeV03YuRIDKhFmYviKKlK/ICCzu2GDCAm3Xw PvMblocIMi5fRg+vAMftMsKiJ6RGrble4W2cs6hZ7ImSq0rYopynP+7UNe1PluW8rK4DWi J/zlctkmXdQWBzXfusp+G55/ZxLSVeSiUbVYD73gmxKx92G8+Btvo8xDWEzywg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2NpB38LmzZqB; Tue, 25 Feb 2025 16:48:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PGmIBo013176; Tue, 25 Feb 2025 16:48:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PGmISF013173; Tue, 25 Feb 2025 16:48:18 GMT (envelope-from git) Date: Tue, 25 Feb 2025 16:48:18 GMT Message-Id: <202502251648.51PGmISF013173@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: dc95228d9847 - main - nvme: Fix hotplug on one of the amazon platforms List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc95228d98474aba940e3885164912b419c5579d Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=dc95228d98474aba940e3885164912b419c5579d commit dc95228d98474aba940e3885164912b419c5579d Author: Warner Losh AuthorDate: 2025-02-25 16:29:14 +0000 Commit: Warner Losh CommitDate: 2025-02-25 16:36:53 +0000 nvme: Fix hotplug on one of the amazon platforms Amazon EC2 m7i cloud instances use PCI hotplug rather than ACPI hotplug. The card is removed and detach is called to remove the drive from the system. The hardware is no longer present at this point, but the bridge doesn't translate the now-missing hardware reads to all ff's leading us to conclude the hardware is there and we need to do a proper shutdown of it. Fix this oversight by asking the bridge if the device is still present as well. We need both tests since some systems one cane remove the card w/o a hotplug event and we want to fail-safe in those cases. Convert gone to a bool while I'm here and update a comment about shutting down the controller and why that's important. Tested by: cperciva Sponsored by: Netflix --- sys/dev/nvme/nvme_ctrlr.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 98a9e62f851b..c47e7ece5a04 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1612,7 +1612,8 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev) void nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev) { - int gone, i; + int i; + bool gone; ctrlr->is_dying = true; @@ -1622,10 +1623,16 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev) goto noadminq; /* - * Check whether it is a hot unplug or a clean driver detach. - * If device is not there any more, skip any shutdown commands. + * Check whether it is a hot unplug or a clean driver detach. If device + * is not there any more, skip any shutdown commands. Some hotplug + * bridges will return zeros instead of ff's when the device is + * departing, so ask the bridge if the device is gone. Some systems can + * remove the drive w/o the bridge knowing its gone (they don't really + * do hotplug), so failsafe with detecting all ff's (impossible with + * this hardware) as the device being gone. */ - gone = (nvme_mmio_read_4(ctrlr, csts) == NVME_GONE); + gone = bus_child_present(dev) == 0 || + (nvme_mmio_read_4(ctrlr, csts) == NVME_GONE); if (gone) nvme_ctrlr_fail(ctrlr, true); else @@ -1653,17 +1660,17 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev) nvme_admin_qpair_destroy(&ctrlr->adminq); /* - * Notify the controller of a shutdown, even though this is due to - * a driver unload, not a system shutdown (this path is not invoked - * during shutdown). This ensures the controller receives a - * shutdown notification in case the system is shutdown before - * reloading the driver. + * Notify the controller of a shutdown, even though this is due to a + * driver unload, not a system shutdown (this path is not invoked uring + * shutdown). This ensures the controller receives a shutdown + * notification in case the system is shutdown before reloading the + * driver. Some NVMe drives need this to flush their cache to stable + * media and consider it a safe shutdown in SMART stats. */ - if (!gone) + if (!gone) { nvme_ctrlr_shutdown(ctrlr); - - if (!gone) nvme_ctrlr_disable(ctrlr); + } noadminq: if (ctrlr->taskqueue) From nobody Tue Feb 25 19:26:31 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2SJm2G5cz5njs8; Tue, 25 Feb 2025 19:26: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2SJl1ZPpz44k7; Tue, 25 Feb 2025 19:26:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740511591; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Td6VhVmD4I3rSben+7gnN/MaoazpvjPNfZuWAepreDU=; b=OjXwcHd+W+BcqSEGGRryj1wjtCSTw6PF8WIUECC6HAIpk0rpcXQNdNSOhOn1y/0MY8lTTO 9Akc1IySTfyvfNj7RZWZ8MEOLspRAEVS+0FntyjjUjjXlrWjsPprmRI5/dVuOROi2BFxNg p7gCvhUnYlvHhNnZPEcogwcptQoVgHzT29d9GyE1XvO8XK6iuKn+SU5TgepGG4aS5IIOQS AoPoCRt46tiGQyTRYCPuNdPQkD5OvYgiEakTMc1uLoCSBMr8vKYqoJ1vrK0S+jx9wDrSEL wZu4c/wywxEU3GIm8Y2pEFRkpeNwUuffl0FDe/FixhOZWScuPXZMTB6PLA+ZtQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740511591; a=rsa-sha256; cv=none; b=Pi5X0gfGxyksqW4xX01QAIahu9cYpaf3/T2p3W+4B2q2PwKAtn02CXD0MYVkl8r1up4TEn adDUOsXovK8d6ZOiHSagrYmTarVXL5JJ9a9Qw9ZN+oY8N7H4z0dA5Kz5IOjJ1WH8C/Q+Zm LiFFmV9zFc2f2wJjvJcIpQCWbGVZCrf+N/daHTXSQYhSEi298uMoI0Tlky1k3N9DzudAFi rO91Z0Ck9PB6asexLuN6N8G64U5Q+5ERD2fQtcOUdnVtmO1qXWXtfWzqxtPqT566HTBh0E kCqykGTlooHqr2MKtr/nM7qpZGTUUWT1dQaIQYqz/Cx7qkJe7nqNhLafM5Jr6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740511591; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Td6VhVmD4I3rSben+7gnN/MaoazpvjPNfZuWAepreDU=; b=TTEcL3ey2KM2Ip3e0kAPyxtZisWPOSnaxf9IzLPKVqIR+WHBdl5+VyYaGxEqTpZgO8HOnn hiVf8kf/2+DmzJqVi63J9RnLgMV4dkAev6mkKE2jV0eYNP6A0GldKw7UGpFN4dirsDVPph Za94G4fpx1ATNP4geuj4zQmk3PNYfytABYNZaiEy/j4XB37Cea8gwUiRERL2LUOu0XvzpJ pE5wKkybZzGHAniAbxdPYCkSXcGA5lj3AgqJ3GpagNiaiHYSnGLe6X6yN2QlxvtM1KERZ9 aimRqNjZVHSezfZpa63RTnEMieRyEWBIiK/51VfpKqbGiugAk4dcbKu12Nd3OQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2SJl18w1zg98; Tue, 25 Feb 2025 19:26:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PJQVqG011526; Tue, 25 Feb 2025 19:26:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PJQVQm011523; Tue, 25 Feb 2025 19:26:31 GMT (envelope-from git) Date: Tue, 25 Feb 2025 19:26:31 GMT Message-Id: <202502251926.51PJQVQm011523@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: 709348c21351 - main - ifconfig: fix reporting optics on most 100g interfaces List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 709348c21351a783ff0025519d1f7cf884771077 Auto-Submitted: auto-generated The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=709348c21351a783ff0025519d1f7cf884771077 commit 709348c21351a783ff0025519d1f7cf884771077 Author: Andrew Gallatin AuthorDate: 2025-02-25 19:17:14 +0000 Commit: Andrew Gallatin CommitDate: 2025-02-25 19:26:07 +0000 ifconfig: fix reporting optics on most 100g interfaces This fixes a bug where optics on 100G and faster NICs were not properly reported. The problem is that we pull the string from the correct table in ifconfig_sfp_physical_spec only when sfp_eth_1040g contains the SFP_ETH_1040G_EXTENDED bit. However, we were never saving that bit when it was encountered. This change records that bit into sfp_eth_1040g, allowing us to later select the appropriate ID string. This should cause most 100G interfaces to stop being identified as "unknown" in the "plugged" output of ifconfig -v, and to start being identified as what they really are. Example output from a Chelsio T6 with SR4 optics in one port and DR1 optics in another: Before: plugged: QSFP28 Unknown (MPO 1x12 Parallel Optic) plugged: QSFP28 Unknown (LC) After: plugged: QSFP28 100GBASE-SR4 or 25GBASE-SR (MPO 1x12 Parallel Optic) plugged: QSFP28 100GBASE-DR (LC) Reviewed by: kbowling, np Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49127 MFC after: 7 days --- lib/libifconfig/libifconfig_sfp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libifconfig/libifconfig_sfp.c b/lib/libifconfig/libifconfig_sfp.c index 17f130606765..8292135d3e47 100644 --- a/lib/libifconfig/libifconfig_sfp.c +++ b/lib/libifconfig/libifconfig_sfp.c @@ -181,6 +181,7 @@ get_qsfp_info(struct i2c_info *ii, struct ifconfig_sfp_info *sfp) if (code & SFF_8636_EXT_COMPLIANCE) { read_i2c(ii, SFF_8436_BASE, SFF_8436_OPTIONS_START, 1, &sfp->sfp_eth_ext); + sfp->sfp_eth_1040g = code; } else { /* Check 10/40G Ethernet class only */ sfp->sfp_eth_1040g = From nobody Tue Feb 25 19:35:30 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2SW65gyWz5njqx; Tue, 25 Feb 2025 19:35: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2SW65DMQz4DlY; Tue, 25 Feb 2025 19:35:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740512130; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sSUIGaYJbDhuNt25KjaNiv4PdCincmgpT62zFjXipfk=; b=xkBHM7hrEvIC5QaWeEu4RID7ryxJ8Ettz9y26azPW0GVJCaewdIYX68oDJvoXN7yjIUcVA gU4sRatJkfxCNhBvjSPMmwT1YyWlA9Aaby4YdnC6zF/BcFccV7iaZ5fxI6ZBqGOKfPDaUc QRUXACwDKE1NrNkXuYM3OmoU/m1pLMrwZUyRstcZerAtEYs78IhOnDtot55BQVOqlbO4nn c2m3taNaLXAhRgU9/u+7keLS2d5X9DfKWCIVWpheU7Rbzcc8ssm0RECwMyi97S01Jp7NmD gcCgK3IB+kAIvjd7svma1Zs8rOZv8QHaBzY1J8R9rifL5Bn5jIaBl7HWAYGM8g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740512130; a=rsa-sha256; cv=none; b=BSsg7QCyyLIyIF8dRrJNgWUZQtQfLdupVkf7erihhXShZ111C9lygUu+z5Zs4wQugiGxb3 B61Fs4F5Tz3T+spAPL2Wk5WUH48x2BoYd0+55MM8PcpPTwD/h0JhOYsuLKVJEEDJIZaBzV z7LqFea2QkFHj7IgujX1X77LajF7W9dPhfpDdobijHQ5mLojB2UFiZYQWXCXQhwACI+PmY AS6qm2N1sKaZzUWQKmLWEg5cjAMl2XFpTyf5rLQsyP7F6bJtejUOxsgKI3VWF/Vb5LFgEu oJO5RRgR1dxtZNb/yLY4LGbnkb3O1dVh6ggPwhMyUSyiDoWMjJjrTxelwova6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740512130; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sSUIGaYJbDhuNt25KjaNiv4PdCincmgpT62zFjXipfk=; b=L0UC4PBHsgX6plSM4U5/HM2nLHyEjkuEqNygZtbYl7QGlmpMSTN86y8p1wBk0ysE7Vruid 44TGhU8/Jfhow1B6fQqU66qeUr31iXffou7T5HBVasXzrAGyXebiG3FiWd3qiDAcpQWYAS WL43c1IwDywW1ave6HMR27mkFhnsrd/kXprxcTzA8TcAlsIyi+2kAxi21lIOsOmZzMo1wx UCYabh3UJz98s3PJ9t+NLsIPXgfnjVmbNXUzguVncum618TWHk3M/OrOADDnERiLxYr0zN Xp+JLFh4wiR62FV+yHj0EN+Xk9vNqQDsUeJY+hXkVyq2nWvO4WZUIe5GaLRqxg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2SW64kmGzgsF; Tue, 25 Feb 2025 19:35:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PJZUZl029260; Tue, 25 Feb 2025 19:35:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PJZURu029257; Tue, 25 Feb 2025 19:35:30 GMT (envelope-from git) Date: Tue, 25 Feb 2025 19:35:30 GMT Message-Id: <202502251935.51PJZURu029257@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: e19d84979a18 - main - cxgbe(4): Block most access to the hardware as soon as the adapter stops. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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: e19d84979a183deb37ce6d7e385c3ccf02a3c8c7 Auto-Submitted: auto-generated The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=e19d84979a183deb37ce6d7e385c3ccf02a3c8c7 commit e19d84979a183deb37ce6d7e385c3ccf02a3c8c7 Author: Navdeep Parhar AuthorDate: 2025-02-12 00:29:46 +0000 Commit: Navdeep Parhar CommitDate: 2025-02-25 19:33:40 +0000 cxgbe(4): Block most access to the hardware as soon as the adapter stops. Add a new hw_all_ok() routine and use it to avoid hardware access in the public control interfaces (ifnet ioctls, ifmedia calls, etc.). Continue to use hw_off_limits() in the private ioctls/sysctls and other debug code. Retire adapter_stopped() as it's of no use by itself. This fixes problems where ifnet slow-path operations would enter a synch_op just before set_adapter_hwstatus(false) and touch the hardware when it's not safe to do so. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/adapter.h | 10 ++++++---- sys/dev/cxgbe/t4_clip.c | 2 +- sys/dev/cxgbe/t4_filter.c | 8 ++++---- sys/dev/cxgbe/t4_main.c | 40 ++++++++++++++++++++-------------------- sys/dev/cxgbe/tom/t4_tom_l2t.c | 2 +- 5 files changed, 32 insertions(+), 30 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 8d10a07e0933..3bf4f666ce7d 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -1118,7 +1118,7 @@ forwarding_intr_to_fwq(struct adapter *sc) return (sc->intr_count == 1); } -/* Works reliably inside a sync_op or with reg_lock held. */ +/* Works reliably inside a synch_op or with reg_lock held. */ static inline bool hw_off_limits(struct adapter *sc) { @@ -1127,12 +1127,14 @@ hw_off_limits(struct adapter *sc) return (__predict_false(off_limits != 0)); } +/* Works reliably inside a synch_op or with reg_lock held. */ static inline bool -adapter_stopped(struct adapter *sc) +hw_all_ok(struct adapter *sc) { - const int stopped = atomic_load_int(&sc->error_flags) & ADAP_STOPPED; + const int not_ok = atomic_load_int(&sc->error_flags) & + (ADAP_STOPPED | HW_OFF_LIMITS); - return (__predict_false(stopped != 0)); + return (__predict_true(not_ok == 0)); } static inline int diff --git a/sys/dev/cxgbe/t4_clip.c b/sys/dev/cxgbe/t4_clip.c index 24f049f9dc06..e462a064847f 100644 --- a/sys/dev/cxgbe/t4_clip.c +++ b/sys/dev/cxgbe/t4_clip.c @@ -576,7 +576,7 @@ update_hw_clip_table(struct adapter *sc) rc = begin_synchronized_op(sc, NULL, HOLD_LOCK, "t4clip"); if (rc != 0) return (rc); - if (hw_off_limits(sc)) + if (!hw_all_ok(sc)) goto done; /* with rc = 0, we don't want to reschedule. */ while (!TAILQ_EMPTY(&sc->clip_pending)) { ce = TAILQ_FIRST(&sc->clip_pending); diff --git a/sys/dev/cxgbe/t4_filter.c b/sys/dev/cxgbe/t4_filter.c index 359aae6df24e..8d4552116d96 100644 --- a/sys/dev/cxgbe/t4_filter.c +++ b/sys/dev/cxgbe/t4_filter.c @@ -520,7 +520,7 @@ set_filter_mode(struct adapter *sc, uint32_t mode) if (rc) return (rc); - if (hw_off_limits(sc)) { + if (!hw_all_ok(sc)) { rc = ENXIO; goto done; } @@ -571,7 +571,7 @@ set_filter_mask(struct adapter *sc, uint32_t mode) if (rc) return (rc); - if (hw_off_limits(sc)) { + if (!hw_all_ok(sc)) { rc = ENXIO; goto done; } @@ -602,7 +602,7 @@ get_filter_hits(struct adapter *sc, uint32_t tid) tcb_addr = t4_read_reg(sc, A_TP_CMM_TCB_BASE) + tid * TCB_SIZE; mtx_lock(&sc->reg_lock); - if (hw_off_limits(sc)) + if (!hw_all_ok(sc)) hits = 0; else if (is_t4(sc)) { uint64_t t; @@ -976,7 +976,7 @@ set_filter(struct adapter *sc, struct t4_filter *t) if (rc) return (rc); - if (hw_off_limits(sc)) { + if (!hw_all_ok(sc)) { rc = ENXIO; goto done; } diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 51ba6d94b5fa..6ee839151db0 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -1133,7 +1133,7 @@ t4_calibration(void *arg) sc = (struct adapter *)arg; - KASSERT((hw_off_limits(sc) == 0), ("hw_off_limits at t4_calibration")); + KASSERT(hw_all_ok(sc), ("!hw_all_ok at t4_calibration")); hw = t4_read_reg64(sc, A_SGE_TIMESTAMP_LO); sbt = sbinuptime(); @@ -2864,7 +2864,7 @@ cxgbe_ioctl(if_t ifp, unsigned long cmd, caddr_t data) if_setmtu(ifp, mtu); if (vi->flags & VI_INIT_DONE) { t4_update_fl_bufsize(ifp); - if (!hw_off_limits(sc) && + if (hw_all_ok(sc) && if_getdrvflags(ifp) & IFF_DRV_RUNNING) rc = update_mac_settings(ifp, XGMAC_MTU); } @@ -2876,7 +2876,7 @@ cxgbe_ioctl(if_t ifp, unsigned long cmd, caddr_t data) if (rc) return (rc); - if (hw_off_limits(sc)) { + if (!hw_all_ok(sc)) { rc = ENXIO; goto fail; } @@ -2904,7 +2904,7 @@ cxgbe_ioctl(if_t ifp, unsigned long cmd, caddr_t data) rc = begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4multi"); if (rc) return (rc); - if (!hw_off_limits(sc) && if_getdrvflags(ifp) & IFF_DRV_RUNNING) + if (hw_all_ok(sc) && if_getdrvflags(ifp) & IFF_DRV_RUNNING) rc = update_mac_settings(ifp, XGMAC_MCADDRS); end_synchronized_op(sc, 0); break; @@ -3079,7 +3079,7 @@ fail: rc = begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4i2c"); if (rc) return (rc); - if (hw_off_limits(sc)) + if (!hw_all_ok(sc)) rc = ENXIO; else rc = -t4_i2c_rd(sc, sc->mbox, pi->port_id, i2c.dev_addr, @@ -3356,7 +3356,7 @@ cxgbe_media_change(if_t ifp) if (IFM_OPTIONS(ifm->ifm_media) & IFM_ETH_TXPAUSE) lc->requested_fc |= PAUSE_TX; } - if (pi->up_vis > 0 && !hw_off_limits(sc)) { + if (pi->up_vis > 0 && hw_all_ok(sc)) { fixup_link_config(pi); rc = apply_link_config(pi); } @@ -3524,7 +3524,7 @@ cxgbe_media_status(if_t ifp, struct ifmediareq *ifmr) return; PORT_LOCK(pi); - if (pi->up_vis == 0 && !hw_off_limits(sc)) { + if (pi->up_vis == 0 && hw_all_ok(sc)) { /* * If all the interfaces are administratively down the firmware * does not report transceiver changes. Refresh port info here @@ -8272,7 +8272,7 @@ sysctl_btphy(SYSCTL_HANDLER_ARGS) rc = begin_synchronized_op(sc, &pi->vi[0], SLEEP_OK | INTR_OK, "t4btt"); if (rc) return (rc); - if (hw_off_limits(sc)) + if (!hw_all_ok(sc)) rc = ENXIO; else { /* XXX: magic numbers */ @@ -8329,7 +8329,7 @@ sysctl_tx_vm_wr(SYSCTL_HANDLER_ARGS) "t4txvm"); if (rc) return (rc); - if (hw_off_limits(sc)) + if (!hw_all_ok(sc)) rc = ENXIO; else if (if_getdrvflags(vi->ifp) & IFF_DRV_RUNNING) { /* @@ -8543,7 +8543,7 @@ sysctl_pause_settings(SYSCTL_HANDLER_ARGS) "t4PAUSE"); if (rc) return (rc); - if (!hw_off_limits(sc)) { + if (hw_all_ok(sc)) { PORT_LOCK(pi); lc->requested_fc = n; fixup_link_config(pi); @@ -8639,7 +8639,7 @@ sysctl_requested_fec(SYSCTL_HANDLER_ARGS) lc->requested_fec = n & (M_FW_PORT_CAP32_FEC | FEC_MODULE); } - if (!hw_off_limits(sc)) { + if (hw_all_ok(sc)) { fixup_link_config(pi); if (pi->up_vis > 0) { rc = apply_link_config(pi); @@ -8677,7 +8677,7 @@ sysctl_module_fec(SYSCTL_HANDLER_ARGS) rc = EBUSY; goto done; } - if (hw_off_limits(sc)) { + if (!hw_all_ok(sc)) { rc = ENXIO; goto done; } @@ -8743,7 +8743,7 @@ sysctl_autoneg(SYSCTL_HANDLER_ARGS) goto done; } lc->requested_aneg = val; - if (!hw_off_limits(sc)) { + if (hw_all_ok(sc)) { fixup_link_config(pi); if (pi->up_vis > 0) rc = apply_link_config(pi); @@ -8778,7 +8778,7 @@ sysctl_force_fec(SYSCTL_HANDLER_ARGS) return (rc); PORT_LOCK(pi); lc->force_fec = val; - if (!hw_off_limits(sc)) { + if (hw_all_ok(sc)) { fixup_link_config(pi); if (pi->up_vis > 0) rc = apply_link_config(pi); @@ -8818,7 +8818,7 @@ sysctl_temperature(SYSCTL_HANDLER_ARGS) rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4temp"); if (rc) return (rc); - if (hw_off_limits(sc)) + if (!hw_all_ok(sc)) rc = ENXIO; else { param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | @@ -8849,7 +8849,7 @@ sysctl_vdd(SYSCTL_HANDLER_ARGS) "t4vdd"); if (rc) return (rc); - if (hw_off_limits(sc)) + if (!hw_all_ok(sc)) rc = ENXIO; else { param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | @@ -8886,7 +8886,7 @@ sysctl_reset_sensor(SYSCTL_HANDLER_ARGS) rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4srst"); if (rc) return (rc); - if (hw_off_limits(sc)) + if (!hw_all_ok(sc)) rc = ENXIO; else { param = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | @@ -8912,7 +8912,7 @@ sysctl_loadavg(SYSCTL_HANDLER_ARGS) rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4lavg"); if (rc) return (rc); - if (hw_off_limits(sc)) + if (hw_all_ok(sc)) rc = ENXIO; else { param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | @@ -12366,7 +12366,7 @@ toe_capability(struct vi_info *vi, bool enable) if (!is_offload(sc)) return (ENODEV); - if (hw_off_limits(sc)) + if (!hw_all_ok(sc)) return (ENXIO); if (enable) { @@ -12629,7 +12629,7 @@ ktls_capability(struct adapter *sc, bool enable) return (ENODEV); if (!is_t6(sc)) return (0); - if (hw_off_limits(sc)) + if (!hw_all_ok(sc)) return (ENXIO); if (enable) { diff --git a/sys/dev/cxgbe/tom/t4_tom_l2t.c b/sys/dev/cxgbe/tom/t4_tom_l2t.c index 909abe793835..3fd0d5ca41d4 100644 --- a/sys/dev/cxgbe/tom/t4_tom_l2t.c +++ b/sys/dev/cxgbe/tom/t4_tom_l2t.c @@ -289,7 +289,7 @@ again: mtx_unlock(&e->lock); goto again; } - if (adapter_stopped(sc)) + if (!hw_all_ok(sc)) free(wr, M_CXGBE); else arpq_enqueue(e, wr); From nobody Tue Feb 25 20:48:03 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2V6q4l8Wz5ns4R; Tue, 25 Feb 2025 20:48: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2V6q2jNVz3rbd; Tue, 25 Feb 2025 20:48:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740516483; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Nfm0AxljYN/miwcaIMe74e9N5EiHoX967UJAcNq39oE=; b=I7kUW1PsuHld7mTQVTgB8xFUiusQPOGSsra92rwTCclYGoO2WehKT5m8/Mk7BPv3u0sgOF qFFMkoTak6NzJWEjowUiAOCzIeHm65uinsR25NOclyEoBRCYjS4asrxQl5nuHyz0So9q6M HY6e7VoxQG/qkB+uChtrPLVPtdIUbYwe1YznvZ1m93irKHivyOaV8xHBumik1mNzIvg89L 0LZqAkNXlE8MFLOMlxdxdoYDZs7gb6lIm9m9QHs9OxPvSQ6vPZqH+EpcNe68542HO31H/u b/wOvC4JIxMk0oAVGUcE71XiuDKUF6Fh1rhFzqlkx9HACcmN1rzGmecBih6SlA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740516483; a=rsa-sha256; cv=none; b=AEx+TDhR+NctCq2wKq02rnJDDpGdEvXfRzDC57STu2wTKjacxwHfb1dtFrAgDH4XOOMBLk ffdV33CCxrhxRphRXYSs5gAzetpjRJaeYO3YiJW8vJ1a8iElSSPmn+F3PY2+vBvEgUh7U4 UR2OQkGdbWORXvK0gm1c78UnSJPEWuIsQU3xwzN9AE3wXs/V4SWCDVlTmqskSdCHjs+MYQ kd9DrN1flL0Oheh2hy2DBAadDe1ztGkg6IsVs+SGd7udN5TTOKu2J+pnbrdUAt/D+1Q6Qg RzPuo+0sPos8TABjdI776tnLsKsq/P9Lo7Hep6az3k6WV1EtWeD+QnUvrKVaow== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740516483; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Nfm0AxljYN/miwcaIMe74e9N5EiHoX967UJAcNq39oE=; b=vr4lt8vroN4QCjxOz3G9KdrMYPQIbv3Vt2Sj6u0jU4kaYBk+vzyNrQu0u8VTujJkuQgWU1 QdC5oCgcpGgKGGwDXVfvU29CIGMFGnHnNs6rVkEhHDfHnexAr6POgSAsVsYu3ZQJ2OhxZt 3/SwfNXvB5KrizaUjXj1YZ+2MPPOHiV2BU5/cBtns6YGjM0u0vnN36iFnhMTJzB+aHN6Gh rxoiT3nmidtoGOdUhbCNvlr2Emu4btDuD9LPwEvJnFNK8Ojgw4AALEee2y+t3D9pgVqGE/ z06wtJqCZV65A1jq5nvcSN+WmckAAW/rzsnS0rS0w2xGxnVT9G2QvudRjPiGKw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2V6q2Frkzjqy; Tue, 25 Feb 2025 20:48:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PKm3Jw061273; Tue, 25 Feb 2025 20:48:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PKm3IN061270; Tue, 25 Feb 2025 20:48:03 GMT (envelope-from git) Date: Tue, 25 Feb 2025 20:48:03 GMT Message-Id: <202502252048.51PKm3IN061270@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 163c30c79398 - main - tcp rack: remove dead code List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 163c30c79398331106d1237af767a5aed54371a9 Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=163c30c79398331106d1237af767a5aed54371a9 commit 163c30c79398331106d1237af767a5aed54371a9 Author: Peter Lei AuthorDate: 2025-02-25 20:33:32 +0000 Commit: Michael Tuexen CommitDate: 2025-02-25 20:33:32 +0000 tcp rack: remove dead code Reviewed by: tuexen MFC after: 1 week Sponsored by: Netflix, Inc. --- sys/netinet/tcp_stacks/rack.c | 25 +------------------------ sys/netinet/tcp_stacks/tcp_rack.h | 32 -------------------------------- 2 files changed, 1 insertion(+), 56 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 902845ad34f6..ab80ed9f4060 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -212,7 +212,6 @@ static uint32_t rack_highest_sack_thresh_seen = 0; static uint32_t rack_highest_move_thresh_seen = 0; static uint32_t rack_merge_out_sacks_on_attack = 0; static int32_t rack_enable_hw_pacing = 0; /* Due to CCSP keep it off by default */ -static int32_t rack_hw_pace_extra_slots = 0; /* 2 extra MSS time betweens */ static int32_t rack_hw_rate_caps = 0; /* 1; */ static int32_t rack_hw_rate_cap_per = 0; /* 0 -- off */ static int32_t rack_hw_rate_min = 0; /* 1500000;*/ @@ -263,7 +262,7 @@ static int32_t rack_enobuf_hw_max = 12000; /* 12 ms in usecs */ static int32_t rack_enobuf_hw_min = 10000; /* 10 ms in usecs */ static int32_t rack_hw_rwnd_factor = 2; /* How many max_segs the rwnd must be before we hold off sending */ static int32_t rack_hw_check_queue = 0; /* Do we always pre-check queue depth of a hw queue */ -static int32_t rack_full_buffer_discount = 10; + /* * Currently regular tcp has a rto_min of 30ms * the backoff goes 12 times so that ends up @@ -356,8 +355,6 @@ static int32_t rack_timely_dec_clear = 6; /* Do we clear decrement count at a va static int32_t rack_timely_max_push_rise = 3; /* One round of pushing */ static int32_t rack_timely_max_push_drop = 3; /* Three round of pushing */ static int32_t rack_timely_min_segs = 4; /* 4 segment minimum */ -static int32_t rack_use_max_for_nobackoff = 0; -static int32_t rack_timely_int_timely_only = 0; /* do interim timely's only use the timely algo (no b/w changes)? */ static int32_t rack_timely_no_stopping = 0; static int32_t rack_down_raise_thresh = 100; static int32_t rack_req_segs = 1; @@ -1054,11 +1051,6 @@ rack_init_sysctls(void) OID_AUTO, "no_timely", CTLFLAG_RW, &rack_timely_off, 0, "Do we not use timely in DGP?"); - SYSCTL_ADD_S32(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_pacing), - OID_AUTO, "fullbufdisc", CTLFLAG_RW, - &rack_full_buffer_discount, 10, - "What percentage b/w reduction over the GP estimate for a full buffer (default=0 off)?"); SYSCTL_ADD_S32(&rack_sysctl_ctx, SYSCTL_CHILDREN(rack_pacing), OID_AUTO, "fillcw", CTLFLAG_RW, @@ -1201,11 +1193,6 @@ rack_init_sysctls(void) OID_AUTO, "up_only", CTLFLAG_RW, &rack_hw_up_only, 0, "Do we allow hw pacing to lower the rate selected?"); - SYSCTL_ADD_S32(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_hw_pacing), - OID_AUTO, "extra_mss_precise", CTLFLAG_RW, - &rack_hw_pace_extra_slots, 0, - "If the rates between software and hardware match precisely how many extra time_betweens do we get?"); rack_timely = SYSCTL_ADD_NODE(&rack_sysctl_ctx, SYSCTL_CHILDREN(rack_sysctl_root), OID_AUTO, @@ -1299,16 +1286,6 @@ rack_init_sysctls(void) OID_AUTO, "min_segs", CTLFLAG_RW, &rack_timely_min_segs, 4, "Rack timely when setting the cwnd what is the min num segments"); - SYSCTL_ADD_S32(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_timely), - OID_AUTO, "noback_max", CTLFLAG_RW, - &rack_use_max_for_nobackoff, 0, - "Rack timely when deciding if to backoff on a loss, do we use under max rtt else min"); - SYSCTL_ADD_S32(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_timely), - OID_AUTO, "interim_timely_only", CTLFLAG_RW, - &rack_timely_int_timely_only, 0, - "Rack timely when doing interim timely's do we only do timely (no b/w consideration)"); SYSCTL_ADD_S32(&rack_sysctl_ctx, SYSCTL_CHILDREN(rack_timely), OID_AUTO, "nonstop", CTLFLAG_RW, diff --git a/sys/netinet/tcp_stacks/tcp_rack.h b/sys/netinet/tcp_stacks/tcp_rack.h index d7f36a520045..a6cb0a81bb81 100644 --- a/sys/netinet/tcp_stacks/tcp_rack.h +++ b/sys/netinet/tcp_stacks/tcp_rack.h @@ -435,7 +435,6 @@ struct rack_control { uint32_t rc_rcvtime; /* When we last received data */ uint32_t rc_num_split_allocs; /* num split map entries allocated */ uint32_t rc_split_limit; /* Limit from control var can be set by socket opt */ - uint32_t rack_avg_rec_sends; uint32_t rc_last_output_to; uint32_t rc_went_idle_time; @@ -462,7 +461,6 @@ struct rack_control { uint32_t rc_agg_early; uint32_t rc_agg_delayed; uint32_t rc_tlp_rxt_last_time; - uint32_t rc_saved_cwnd; uint64_t rc_gp_output_ts; /* chg*/ uint64_t rc_gp_cumack_ts; /* chg*/ struct timeval act_rcv_time; @@ -540,8 +538,6 @@ struct rack_control { uint32_t rc_min_to; /* Socket option value Lock(a) */ uint32_t rc_pkt_delay; /* Socket option value Lock(a) */ uint32_t persist_lost_ends; - uint32_t input_pkt; - uint32_t saved_input_pkt; uint32_t cleared_app_ack_seq; uint32_t last_rcv_tstmp_for_rtt; uint32_t last_time_of_arm_rcv; @@ -572,11 +568,9 @@ struct rack_control { uint8_t rc_tlp_cwnd_reduce; /* Socket option value Lock(a) */ uint8_t rc_prr_sendalot;/* Socket option value Lock(a) */ uint8_t rc_rate_sample_method; - uint8_t full_dgp_in_rec; /* Flag to say if we do full DGP in recovery */ uint8_t client_suggested_maxseg; /* Not sure what to do with this yet */ uint8_t use_gp_not_last; uint8_t pacing_method; /* If pace_always, what type of pacing */ - uint8_t already_had_a_excess; }; #endif @@ -584,27 +578,6 @@ struct rack_control { #define RACK_DGP_PACING 0x01 #define RACK_REG_PACING 0x02 -/* DGP with no buffer level mitigations */ -#define DGP_LEVEL0 0 - -/* - * DGP with buffer level mitigation where BL:4 caps fillcw and BL:5 - * turns off fillcw. - */ -#define DGP_LEVEL1 1 - -/* - * DGP with buffer level mitigation where BL:3 caps fillcw and BL:4 turns off fillcw - * and BL:5 reduces by 10% - */ -#define DGP_LEVEL2 2 - -/* - * DGP with buffer level mitigation where BL:2 caps fillcw and BL:3 turns off - * fillcw BL:4 reduces by 10% and BL:5 reduces by 20% - */ -#define DGP_LEVEL3 3 - /* Hybrid pacing log defines */ #define HYBRID_LOG_NO_ROOM 0 /* No room for the clients request */ #define HYBRID_LOG_TURNED_OFF 1 /* Turned off hybrid pacing */ @@ -623,12 +596,7 @@ struct rack_control { #define HYBRID_LOG_EXTEND 14 /* We extended the end */ #define HYBRID_LOG_SENT_LOST 15 /* A closing sent/lost report */ -#define LOST_ZERO 1 /* Zero it out */ -#define LOST_ADD 2 /* Add to it */ -#define LOST_SUB 3 /* Sub from it */ - #define RACK_TIMELY_CNT_BOOST 5 /* At 5th increase boost */ -#define RACK_MINRTT_FILTER_TIM 10 /* Seconds */ #define RACK_HYSTART_OFF 0 #define RACK_HYSTART_ON 1 /* hystart++ on */ From nobody Tue Feb 25 20:48:04 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2V6r6v4nz5ns4S; Tue, 25 Feb 2025 20:48: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2V6r3bmLz3rkd; Tue, 25 Feb 2025 20:48:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740516484; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kuNDdzYCNGQiAJOeleQ0C1eNOJRpDoD3RU5iyJwAaGA=; b=uTDeLayyqP91Q9ZDsiofXLFQ8i8JXIz/zEArIpgtdxvJC+y3zVtTn4+qmB6FEhRhWCB5LL NJ75C9bcQ+sZ76681AeOIFTpPuQn0BkqDkz/Wg7YH29TY2IAMx3rNmn2FQsH/Q+t6iWuQn M7H7r9TIeBEFNIbmrypHBn1LxjO+TIJMbxUnZlah5y58ZwhPyCZ4bkqMtJnI8BOwgdIou0 euPlTZzhNcaL8J1eUsuiTubfe/68x/gmSDlemy9cUyFbWMF9NaJHB5PEnmesb0ABMG06PI RH4AOLB0AOJw3B/pXCLedxDbdCJ0ap98ofrF65pPhiNcyfDafNPMP3VecDBr2Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740516484; a=rsa-sha256; cv=none; b=RzLX4CJwLQT785I2t+6UFbbHOCKaupTBI7+ABJ57wzrRKIvJVYx724FlUJkhVj/E4qtMRw NKc6uu7dD3L8nv+prZ6BKGtwaUMcNmeo15IoZhZBaBgieYFnG+VV9b46QKP7oRhQjckFxP WgJxjnzLCe23F7hBJb9o8Oxf7hum934o4jrw39McXjdmBV+ZfYn/JUbnjYM2eBOdb1ZbnS xYYztHAB2YZ/NnRU2KgIRKI0lfHyWXng+fOhhfN+RPhNEbw1Cm6H7NXGm1T8WacUSwvL/1 pNzo37ZsdGcilHepaRP+A79g6cm2JMK7JKHe1vBbA9GQ2i901tTO5FF4tMJ2cQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740516484; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kuNDdzYCNGQiAJOeleQ0C1eNOJRpDoD3RU5iyJwAaGA=; b=s3IIHiWMdu98efN7QTaDgt9YbdQXcIuF3ax3w1VQykc+8ODq5uwMNePrgy9mBXW6fzYeBc pgcWdgJPfmpLrYEa0QJkS+m267a5f+1iE1y42mPlNd1UuTd04zJnXri7mt7QeTFRN/v0Kr KsyESI1qMaEZhFHqZpadGvoRkKLyQwEMKuzxD+Zb9KKH/ePhQ8Aqr/TwDzDt7sFoZ0UE3z g0CcQ8xcr7dR1b4NoEyhPIwUehCcYiSluTOWy9Rgx0/eZInkn858j7LyjbH7cR/lUt3HKb 2/2e0Juoh8ct4cfIGDKwKEFT0o/lCwdc8i5sM6WvYOhj5Tw4w1r9Yf1esMEFcg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2V6r3BP4zjcX; Tue, 25 Feb 2025 20:48:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PKm4ui061308; Tue, 25 Feb 2025 20:48:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PKm4YX061305; Tue, 25 Feb 2025 20:48:04 GMT (envelope-from git) Date: Tue, 25 Feb 2025 20:48:04 GMT Message-Id: <202502252048.51PKm4YX061305@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 0e58542fd246 - main - tcp: remove unused field from struct tcpcb List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0e58542fd246242bc64bd03d8b2f28cf981c062b Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=0e58542fd246242bc64bd03d8b2f28cf981c062b commit 0e58542fd246242bc64bd03d8b2f28cf981c062b Author: Peter Lei AuthorDate: 2025-02-25 20:37:48 +0000 Commit: Michael Tuexen CommitDate: 2025-02-25 20:37:48 +0000 tcp: remove unused field from struct tcpcb Reviewed by: tuexen Sponsored by: Netflix, Inc. --- sys/netinet/tcp_var.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index e65e44840bd8..31663ed48f81 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -452,7 +452,6 @@ struct tcpcb { tcp_seq gput_seq; /* Outbound measurement seq */ tcp_seq gput_ack; /* Inbound measurement ack */ int32_t t_stats_gput_prev; /* XXXLAS: Prev gput measurement */ - uint32_t t_maxpeakrate; /* max peak rate set by user, bytes/s */ uint32_t t_sndtlppack; /* tail loss probe packets sent */ uint64_t t_sndtlpbyte; /* total tail loss probe bytes sent */ uint64_t t_sndbytes; /* total bytes sent */ From nobody Tue Feb 25 20:48:05 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2V6s73f8z5ns1l; Tue, 25 Feb 2025 20:48: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2V6s4ndbz3rrx; Tue, 25 Feb 2025 20:48:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740516485; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=c5QI2ZHGeICscofNDIGXisyHaG7AJedKdQAdlCkiick=; b=XrTIxVzRtoA6BUfT+SW6zMIG+jLB8Tckj3wmfrlw7dr/atdSKZHgewEU5o+1nrbQY02tiB DgbKE74A2tr47Xpi0p99fk4xdT3SrOi8P6p0W6IC4s1aqXmG2oGfIsHLjfoIDvmKxrWFO0 OYhZJGNIb/SlYVuJm8/5Cq0e3Zf+EwLYD/+4rgOu+jjS47iurv+qcgIMzxSOw9Re2qNYgi IMesxVwYyz+5GFq0aXyPuFbiX0Y5lVINNE5LRGKYU/hxgX9+wmUPrK0ucG5AmvO7PCgE5Z y0c9+1/6BVVjyNp4Eu8Au2jNtcx49gcPnwHXV1zkAwPe6Y73ASbSmEKMtwIn+g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740516485; a=rsa-sha256; cv=none; b=CfC9tmnvCFEky9q4ZDbIz8mo02HsUuOxHMZvTxjXnZyIag9dZRcnQVMlYtbj2k4ZT66cPz ovzKIWSYGI4hHdwhs3ayuxcEHtfkM+y+E73Zud0RlHk3ZieE22Im+ciUfgrruaYm+izmeK vYLlJAdSQzAIJKNj3rq8qK4XG/H/0Pvob5uICNyTeYtp5bQO12kkSl0kdoPSL1Vx7JarTN lR26Va8Yhn0+WrMlL8NNaqv27WQFx8nvYCR6OjkEZplloM66ldd4kIt1g9pwsVZnAMuIC/ A5FL9IpxPl3p/mazbNHVocHei2b5ZSTv/DI8N3dT0NYYN3BWZOJQE84pIcPTOQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740516485; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=c5QI2ZHGeICscofNDIGXisyHaG7AJedKdQAdlCkiick=; b=Wsg6XcoVNn8QDQyElejL9DuJVhnI84eDo+uvrLgZZfW4ICXxIuNe3FwN+htSbtjljWa9cb BUDKIfXX/eqR6D+jnmOJuV5ie/GNBjZ/Bl03fGYcBha/NYj2lv7/VUnv55xNZKGEQvWkTS 5musSwoNvydc7+87JL+o0x2udDNEK8RGizTVmntf+Dsw/tMKLw6gsSxi0wxiunuEYn5jXD 7O/UnB9FwiMCXUM5HPvB+jJoNhYkcZ5hcQgpE+g4MUQRvyyVmEFFYse5+HEVu23GUqnvgt r5u27Q5+bLh/UkZXu7XVY6iubR6vvQxYEko4tl/i5stepU6/KebHRx3+nttYRg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2V6s4Kd2zjkc; Tue, 25 Feb 2025 20:48:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51PKm5lx061344; Tue, 25 Feb 2025 20:48:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51PKm5DO061341; Tue, 25 Feb 2025 20:48:05 GMT (envelope-from git) Date: Tue, 25 Feb 2025 20:48:05 GMT Message-Id: <202502252048.51PKm5DO061341@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 6f27541d948f - main - tcp rack: cleanup accounting conditional checks List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6f27541d948fa0126f9262f8cc5326b1c4befcc7 Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=6f27541d948fa0126f9262f8cc5326b1c4befcc7 commit 6f27541d948fa0126f9262f8cc5326b1c4befcc7 Author: Peter Lei AuthorDate: 2025-02-25 20:45:40 +0000 Commit: Michael Tuexen CommitDate: 2025-02-25 20:45:40 +0000 tcp rack: cleanup accounting conditional checks No functional change intended. Reviewed by: tuexen MFC after: 1 week Sponsored by: Netflix, Inc. --- sys/netinet/tcp_stacks/rack.c | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index ab80ed9f4060..5a9171abeaf5 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -18970,11 +18970,7 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma crtsc = get_cyclecount(); if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_cnt_counters[SND_OUT_DATA] += cnt_thru; - } - if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_proc_time[SND_OUT_DATA] += (crtsc - ts_val); - } - if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_cnt_counters[CNT_OF_MSS_OUT] += ((len + segsiz - 1) / segsiz); } sched_unpin(); @@ -19525,11 +19521,7 @@ again: crtsc = get_cyclecount(); if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_cnt_counters[SND_OUT_DATA] += cnt_thru; - } - if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_proc_time[SND_OUT_DATA] += (crtsc - ts_val); - } - if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_cnt_counters[CNT_OF_MSS_OUT] += ((tot_len + segsiz - 1) / segsiz); } sched_unpin(); @@ -19860,8 +19852,6 @@ rack_output(struct tcpcb *tp) crtsc = get_cyclecount(); if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_proc_time[SND_BLOCKED] += (crtsc - ts_val); - } - if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_cnt_counters[SND_BLOCKED]++; } sched_unpin(); @@ -21070,19 +21060,13 @@ just_return_nolock: crtsc = get_cyclecount(); if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_cnt_counters[SND_OUT_DATA]++; - } - if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_proc_time[SND_OUT_DATA] += (crtsc - ts_val); - } - if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_cnt_counters[CNT_OF_MSS_OUT] += ((tot_len_this_send + segsiz - 1) / segsiz); } } else { crtsc = get_cyclecount(); if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_cnt_counters[SND_LIMITED]++; - } - if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_proc_time[SND_LIMITED] += (crtsc - ts_val); } } @@ -21329,8 +21313,6 @@ send: crtsc = get_cyclecount(); if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_cnt_counters[SND_OUT_FAIL]++; - } - if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_proc_time[SND_OUT_FAIL] += (crtsc - ts_val); } sched_unpin(); @@ -22348,8 +22330,6 @@ nomore: crtsc = get_cyclecount(); if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_cnt_counters[SND_OUT_FAIL]++; - } - if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_proc_time[SND_OUT_FAIL] += (crtsc - ts_val); } sched_unpin(); @@ -22403,8 +22383,6 @@ nomore: crtsc = get_cyclecount(); if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_cnt_counters[SND_OUT_FAIL]++; - } - if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_proc_time[SND_OUT_FAIL] += (crtsc - ts_val); } sched_unpin(); @@ -22428,8 +22406,6 @@ nomore: crtsc = get_cyclecount(); if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_cnt_counters[SND_OUT_FAIL]++; - } - if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_proc_time[SND_OUT_FAIL] += (crtsc - ts_val); } sched_unpin(); @@ -22580,18 +22556,12 @@ skip_all_send: if (tot_len_this_send) { if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_cnt_counters[SND_OUT_DATA]++; - } - if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_proc_time[SND_OUT_DATA] += crtsc; - } - if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_cnt_counters[CNT_OF_MSS_OUT] += ((tot_len_this_send + segsiz - 1) /segsiz); } } else { if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_cnt_counters[SND_OUT_ACK]++; - } - if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { tp->tcp_proc_time[SND_OUT_ACK] += crtsc; } } From nobody Wed Feb 26 02:11:58 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2dJZ5f34z5pQT2; Wed, 26 Feb 2025 02:11: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2dJZ46FPz49TL; Wed, 26 Feb 2025 02:11:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740535918; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KzFm21/gEPeNJGIgJomqLzCUroGGml7VmGiIkk/4FVk=; b=IhoDrkBenYMXRVzShQ11X35YNt1vYbXAPFUm2RlqYtAdzLfbXSMpp4aQL1iFCh9kgW9E7P 2CoxwNmieaGyN0dGX9QsV4dcu14JGFxGxx9u355Up7Oon8Q/X8Dc5FKp1fIBJhXo77gr8n sNaTPCwDlrbCHv/DfY4TROOxk7cks+N25UzUoyEqF95+q4flLPJpBk5tphn05Bpq7sMKsK 5UJ4SJUq17zEsFJy16bUV2eF9UquP/9bI+7+m/zHPVnBy0f7JCTzi3BGcwaDBvasSd9iho f/CUdobuzrNSvJTcHt1Uv3aOxM+OCXgCLe4AcKMQKdvIQ1+BE2zslJMDCcK0Bw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740535918; a=rsa-sha256; cv=none; b=VeE+/5u0SOZ2PDAKn+BwO/St6YRrZzodD8TljztgtzRXwNqUhMU5F+m2ftHzWhfp34Q4QW FBzpD3KJZMj1E2phhKjp5RdidvyArZ6lJThlZ5bw/2WFg83JegSCw7a++MK9ZwnLyZhn0V rVcM6Ve3rJA5qHZsPZY1tgLYJHblT/MaOL8xxDtC4pKXWfRCek4j4fi2jeIzqxOgTrPg3/ ewLuXsWYFe/plbJvjJJXL0GFK5tXZLCDUP0GXBY3GShJcrjZ7wKWoIVLEpHfkdCaSIqHrg Ga0QSHo5He8hUD4zYIPt6S2BKlSzYcgQhO8walBxWVUwThwYA/5asVcVipH0YQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740535918; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KzFm21/gEPeNJGIgJomqLzCUroGGml7VmGiIkk/4FVk=; b=DB4z3Q3AChadCDqipWNmIni+O3pai037KeK0CJgX77gFyYx9zZgcguqw7GEEzNLkHlpv+e KURxXanSk0HmiINZEhrycxulE9aUKT0K6US08augfWe58UCUD5yb/GRgZlz4WB0IAGQQko +4j7e83PZQz5Rn5dZufN+RFFEMEDW/CWk41Rzs2kYd63zVfVRfqYalcyhwb2veB27vkA+e LAvrpQQOOBWPzhP9uEYn5qxyawWHXUu8j00udQXkyyEQVVNLPu0I5xGXHTAX/fPGoiXvJk iF0YvecHicMqPD3bVwTMEucefxQCJA6hMrM8ym/v0sVH8A8+84zLWsAs0CHLIA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2dJZ3dPpzsjr; Wed, 26 Feb 2025 02:11:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51Q2Bw5S073103; Wed, 26 Feb 2025 02:11:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51Q2BwbT073100; Wed, 26 Feb 2025 02:11:58 GMT (envelope-from git) Date: Wed, 26 Feb 2025 02:11:58 GMT Message-Id: <202502260211.51Q2BwbT073100@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 3f8cfb8a3a3b - main - iwlwifi: bring in some of the rs code List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3f8cfb8a3a3b9fbe6d4aebde81aee80f8e89e2ea Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3f8cfb8a3a3b9fbe6d4aebde81aee80f8e89e2ea commit 3f8cfb8a3a3b9fbe6d4aebde81aee80f8e89e2ea Author: Bjoern A. Zeeb AuthorDate: 2025-01-25 11:00:23 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-02-26 02:10:55 +0000 iwlwifi: bring in some of the rs code Bring in code to call into rs-fw.c functionality for firmware supported rate select. Anything before AX200 (firmware matching iwlwiif-[0-9]*.ucode) will still need further implementation, and so does iwl_mvm_rs_tx_status(). These bits marked with compat.linuxkpi.80211.debug TODO()s for now. Implement some lindebugfs bits to gather more statistical information. Sponsored by: The FreeBSD Foundation Obtained from: bz_wifi_11n branch (partially) MFC after: 3 days --- sys/contrib/dev/iwlwifi/mvm/rs.c | 133 +++++++++++++++++++++++++++++++++++---- sys/contrib/dev/iwlwifi/mvm/rs.h | 9 ++- 2 files changed, 128 insertions(+), 14 deletions(-) diff --git a/sys/contrib/dev/iwlwifi/mvm/rs.c b/sys/contrib/dev/iwlwifi/mvm/rs.c index 981686e66920..f460624871ee 100644 --- a/sys/contrib/dev/iwlwifi/mvm/rs.c +++ b/sys/contrib/dev/iwlwifi/mvm/rs.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2020-2021 The FreeBSD Foundation + * Copyright (c) 2020-2025 The FreeBSD Foundation * * This software was developed by Björn Zeeb under sponsorship from * the FreeBSD Foundation. @@ -33,42 +33,123 @@ * This file is left as a wrapper to make mvm compile and we will only * deal with it on a need basis. Most newer chipsets do this in firmware. */ +#include +#include /* LinuxKPI 802.11 TODO() calls. */ -#include - +#include "rs.h" #include "mvm.h" #ifdef CONFIG_IWLWIFI_DEBUGFS +/* + * Fill struct iwl_mvm_frame_stats. + * Deal with various RATE_MCS_*_MSK. See rx.c, fw/api/rs.h, et al. + * XXX-BZ consider calling iwl_new_rate_from_v1() in rx.c so we can also + * use this in rxmq.c. + */ void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg) { - + uint8_t nss; + + spin_lock_bh(&mvm->drv_stats_lock); + mvm->drv_rx_stats.success_frames++; + + if (rate & RATE_MCS_HT_MSK_V1) { + mvm->drv_rx_stats.ht_frames++; + nss = 1 + ((rate & RATE_HT_MCS_NSS_MSK_V1) >> RATE_HT_MCS_NSS_POS_V1); + } else if (rate & RATE_MCS_VHT_MSK_V1) { + mvm->drv_rx_stats.vht_frames++; + nss = 1 + FIELD_GET(RATE_MCS_NSS_MSK, rate); + } else { + mvm->drv_rx_stats.legacy_frames++; + nss = 0; + } + + switch (rate & RATE_MCS_CHAN_WIDTH_MSK_V1) { + case RATE_MCS_CHAN_WIDTH_20: + mvm->drv_rx_stats.bw_20_frames++; + break; + case RATE_MCS_CHAN_WIDTH_40: + mvm->drv_rx_stats.bw_40_frames++; + break; + case RATE_MCS_CHAN_WIDTH_80: + mvm->drv_rx_stats.bw_80_frames++; + break; + case RATE_MCS_CHAN_WIDTH_160: + mvm->drv_rx_stats.bw_160_frames++; + break; + } + + if ((rate & RATE_MCS_CCK_MSK_V1) == 0 && + (rate & RATE_MCS_SGI_MSK_V1) != 0) + mvm->drv_rx_stats.sgi_frames++; + else + mvm->drv_rx_stats.ngi_frames++; + + switch (nss) { + case 1: + mvm->drv_rx_stats.siso_frames++; + break; + case 2: + mvm->drv_rx_stats.mimo2_frames++; + break; + } + + if (agg) + mvm->drv_rx_stats.agg_frames++; + + /* ampdu_count? */ + /* fail_frames? */ + + mvm->drv_rx_stats.last_rates[mvm->drv_rx_stats.last_frame_idx] = rate; + mvm->drv_rx_stats.last_frame_idx++; + mvm->drv_rx_stats.last_frame_idx %= + ARRAY_SIZE(mvm->drv_rx_stats.last_rates); + + spin_unlock_bh(&mvm->drv_stats_lock); } void iwl_mvm_reset_frame_stats(struct iwl_mvm *mvm) { - + /* Apply same locking rx.c does; debugfs seems to read unloked? */ + spin_lock_bh(&mvm->drv_stats_lock); + memset(&mvm->drv_rx_stats, 0, sizeof(mvm->drv_rx_stats)); + spin_unlock_bh(&mvm->drv_stats_lock); } #endif int iwl_mvm_rate_control_register(void) { - + TODO("This likely has to call into net80211 unless we gain compat code in LinuxKPI"); return (0); } -int -iwl_mvm_tx_protection(struct iwl_mvm *mvm, struct iwl_mvm_sta *sta, bool enable) +void +iwl_mvm_rate_control_unregister(void) { + TODO("This likely has to call into net80211 unless we gain compat code in LinuxKPI"); +} - return (0); +int +iwl_mvm_tx_protection(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, bool enable) +{ + if (iwl_mvm_has_tlc_offload(mvm)) + return (rs_fw_tx_protection(mvm, mvmsta, enable)); + else { + TODO(); + return (0); + } } -void -iwl_mvm_rate_control_unregister(void) +static void +iwl_mvm_rs_sw_rate_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + struct ieee80211_bss_conf *link_conf, struct ieee80211_link_sta *link_sta, + enum nl80211_band band) { + TODO(); } void @@ -77,18 +158,28 @@ iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif, struct ieee80211_bss_conf *link_conf, struct ieee80211_link_sta *link_sta, enum nl80211_band band) { + if (iwl_mvm_has_tlc_offload(mvm)) + iwl_mvm_rs_fw_rate_init(mvm, vif, sta, link_conf, link_sta, band); + else + iwl_mvm_rs_sw_rate_init(mvm, vif, sta, link_conf, link_sta, band); } void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta, int tid, struct ieee80211_tx_info *ba_info, bool t) { + TODO(); } void -rs_update_last_rssi(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, +rs_update_last_rssi(struct iwl_mvm *mvm __unused, struct iwl_mvm_sta *mvmsta, struct ieee80211_rx_status *rx_status) { + struct iwl_lq_sta *lq_sta; + int i; + + if (mvmsta == NULL || rx_status == NULL) + return; /* * Assumption based on mvm/sta.h is that this should update @@ -96,12 +187,28 @@ rs_update_last_rssi(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, * access in that struct so nowhere to put rssi information. * So the only thing would be if this is required internally * to functions in this file. + * The "FW" version accesses more fields. We assume they + * are the same for now. */ + + lq_sta = &mvmsta->deflink.lq_sta.rs_drv; + + lq_sta->pers.last_rssi = S8_MIN; + lq_sta->pers.chains = rx_status->chains; + + for (i = 0; i < nitems(lq_sta->pers.chain_signal); i++) { + if ((rx_status->chains & BIT(i)) == 0) + continue; + + lq_sta->pers.chain_signal[i] = rx_status->chain_signal[i]; + if (rx_status->chain_signal[i] > lq_sta->pers.last_rssi) + lq_sta->pers.last_rssi = rx_status->chain_signal[i]; + } } int rs_pretty_print_rate_v1(char *buf, int bufsz, const u32 rate) { - + TODO(); return (0); } diff --git a/sys/contrib/dev/iwlwifi/mvm/rs.h b/sys/contrib/dev/iwlwifi/mvm/rs.h index a9b10b841f95..71c0744f017c 100644 --- a/sys/contrib/dev/iwlwifi/mvm/rs.h +++ b/sys/contrib/dev/iwlwifi/mvm/rs.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2020-2021 The FreeBSD Foundation + * Copyright (c) 2020-2025 The FreeBSD Foundation * * This software was developed by Björn Zeeb under sponsorship from * the FreeBSD Foundation. @@ -69,6 +69,13 @@ struct iwl_lq_sta { struct { spinlock_t lock; uint16_t max_agg_bufsize; + /* + * Based on the assumption that these are in "FW" too and + * there is a f() to set last_rssi add them here too. + */ + uint8_t chains; + uint8_t chain_signal[IEEE80211_MAX_CHAINS]; + uint8_t last_rssi; } pers; }; From nobody Wed Feb 26 02:12:01 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2dJf3ly2z5pQfY; Wed, 26 Feb 2025 02:12: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2dJd6f9Sz49jF; Wed, 26 Feb 2025 02:12:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740535922; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GcPlzZEZmOb6boXCaGGvGB7R7wzJdRyN5BY+HAyPQ+Q=; b=TlehpRy0o8zYcI4qGXJ+Ox6iWn4Q1rCn7ui/Jx30H4jnfNMAlbGqZAeux06QJFpkTy7Oks r2UZBo0eqx1BEJQd+1yH36hnvRRAEQw3JbD1AWFOZt9CWRrvOJCe2AYMyBGXhDqY1b3P4y J7Okd1dx1dECOpDsQpaaSSuYyHXIDGQaVxjiO/1Mmr7l844R7Q4fDkMC+fZEolL5yEKb2a DoXe3eCnfsya+t93i7TPPkvC8Rwn+8xuuSDIMcVL0Wk1dwWPvKpDpaH2vBTkvzVpWsV3hr gU7eO31YJ4PyzJ1JsZ+N18WgwgnpRZCOD9TObf9N1gJ5SxNmtxHKENyIqa3dLg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740535922; a=rsa-sha256; cv=none; b=rHwa9qnhrUQvoECziLfWO+y/K+ETiyeoeeJlQmHYFqGVdkxl0SFi1mgV4wBJJw655Io3Zq 9p4oXAgoTyxpAWGzESGTqVYqpL+P25zq+KbdiFCy05TvoHx0Njncn/zPYGcmD1pCAalBwK Ef0wpcTcALQdCz1FjrHQxQg5Dz1xDzh8gIYAwbhnwFsit/8UQvS6iwDU0MWGN5tmxlEi71 jf5ohPCOtntNTbz2ullCRInBqGEzz0NvfLIhH6lF/ncYggrRcsNd4QZDl32fDMhe1MjwbS znjMjAHtqZiYAHuq4VMKCCg2eNvOp8S/g51O+oR7uODbKRy+7PB/Jvm5my1Ocg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740535922; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GcPlzZEZmOb6boXCaGGvGB7R7wzJdRyN5BY+HAyPQ+Q=; b=m8qDvF7FHQ5HytYTKOygAkN/kzBNDY/pbqA5efu4Vx1cORNNx3xqh3B+7m1TBc3vPDUbHn sj3YREp44F5zFx7L1wuRN4CDKLfBGhuSM2SJmQlP/SlINxlZh+pg08oBqilCcdSI9re+AD fJtPTl7GBTqIqXtQbfLKYrClSl+DaBw7puMoxLkx5ke9Z6bInUHJmMFgJDfSnJK+JIQftz TLZ31QfFfLY54r5HMtO/EidDRebjdUsl83OlpWDvlRc57HXtrZt0YN0Qb+luM5YhYuWMXP s+FNIuPNEm2760QI6g3kakpPEix1WQyq3uhBrNt7n0IWgtTS9jheqkNVtYxdSg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2dJd68krztJ1; Wed, 26 Feb 2025 02:12:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51Q2C1AW074099; Wed, 26 Feb 2025 02:12:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51Q2C1cV074096; Wed, 26 Feb 2025 02:12:01 GMT (envelope-from git) Date: Wed, 26 Feb 2025 02:12:01 GMT Message-Id: <202502260212.51Q2C1cV074096@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 2c44f1ff6935 - main - LinuxKPI: 802.11: compile in VHT compat code by default List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2c44f1ff6935e93f7774e526f2f1ab0a2812eab5 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=2c44f1ff6935e93f7774e526f2f1ab0a2812eab5 commit 2c44f1ff6935e93f7774e526f2f1ab0a2812eab5 Author: Bjoern A. Zeeb AuthorDate: 2025-02-25 02:27:29 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-02-26 02:10:55 +0000 LinuxKPI: 802.11: compile in VHT compat code by default Compile in the VHT compat code by default even though no one will make use of it yet. Sponsored by: The FreeBSD Foundation MFC after: 3 days Tested with: iwlwifi AX210 (NOHT, HT20, HT40, VHT20, VHT40, VHT80) --- sys/compat/linuxkpi/common/src/linux_80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 410ec0679d44..894d0db39677 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -80,7 +80,7 @@ #define LKPI_80211_WME #define LKPI_80211_HW_CRYPTO #define LKPI_80211_HT -/* #define LKPI_80211_VHT */ +#define LKPI_80211_VHT #if defined(LKPI_80211_VHT) && !defined(LKPI_80211_HT) #define LKPI_80211_HT From nobody Wed Feb 26 02:12:00 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2dJd3G3qz5pQKd; Wed, 26 Feb 2025 02:12:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2dJc5pnHz49GP; Wed, 26 Feb 2025 02:12:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740535920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9ETYBgEgiGcOXOJK+ZgrazZG78U4RJvkejslkJ+PUIU=; b=dSWZo2tHadvYaGjq3Mn67CZ9eJs2vQYsH3UNxRN/Y7uIb3sHwGsvCWRj+l3xJXWTWEpVyn WHmDROShhyDkEDw7InLn6tD+Y5D3aEFc99mEhHRTqV5+QqvKKa3UMkJKIE2/Un5HlJyurP UHDz74MsqwMbFdS99IS8zGPCYkEH6Kh77SQjgd8q/v7BBPk88qkxBq6v+6B49wFS2mVnm/ xlEDbYlz1VvepF3m+zvsJB9UsAXY6+r1l099cEZFpWFJ4QbQmH5dxGVRh1kiaHMDIy+4sQ FkiPQo5z0alBJLEcLdZwl19M+VI3395C9Pp1/wYLPyTpqKAifwcbw9Ob3B6hXA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740535920; a=rsa-sha256; cv=none; b=pM/j3ylkHn7aVeOJnzdOhpurPbIn/iWujOd/dn+PZfGH/F7X7vQKZTFQWV9Z5DOAqJeanp aoW2or+F781X3RYUl/NhJhSuAWC9ifFTPeQvvAvBh8ZF2yL/2d40OLC36ugN+0EXDpd1tI XtqlZPKWN+YsHaO8Oy5FuKoDBNJSRVzKys1crLlBeV/EuDF8vfzSL3Gyazpdc2PHte626T FrxtiE6/P9IPXJBfe3EVkMYIvZlykwrqEDB3uUu0fuWA92dv5mX9PGL73oqV6hpTPlrIj+ O5K46I2I/VHWWgQc+BvmdBkIHnYHrDTWyYtXo/x6yTeAkiTzpPUHAuOCB/7pww== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740535920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9ETYBgEgiGcOXOJK+ZgrazZG78U4RJvkejslkJ+PUIU=; b=VqAPPgt0klrjgDoWzLPfwpx7FTw222bbSjuJDOMVqjmVPrqoH74sapNggANiXNtdOpHQpe IgfBUKJjNswLZXzzGxqKiWoB3eJ1WkjjgiMqhQ+iuLM7K/LaA9xH7RjfSK1MwTSdQDceP4 yHZ9oZ1mPrKhTJga7RKdg2ZlNw60LfJzCSSTCHWewPH9683v3EQ/hi0gzzp5UhOysKFqvD MAaValS3RQbCtSHhd5ku+hLzFBzJ5ZCVrnUICRzPZ1eOqihK1MrxwUj7PfBlpDRJpbQ4XW QVE4lgjtoQRfJ4F3Lf3RqBaKtlGkGS6FVblLeOX7NeGNZp0UTvex80B76LJJEQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2dJc5CYQzt4b; Wed, 26 Feb 2025 02:12:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51Q2C0dT074062; Wed, 26 Feb 2025 02:12:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51Q2C0ZB074059; Wed, 26 Feb 2025 02:12:00 GMT (envelope-from git) Date: Wed, 26 Feb 2025 02:12:00 GMT Message-Id: <202502260212.51Q2C0ZB074059@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 3e022a91c91c - main - LinuxKPI: 802.11: ensure to select the correct channel width List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3e022a91c91cf1b967d7de7b6fe81c6632fe1207 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3e022a91c91cf1b967d7de7b6fe81c6632fe1207 commit 3e022a91c91cf1b967d7de7b6fe81c6632fe1207 Author: Bjoern A. Zeeb AuthorDate: 2025-02-25 01:57:46 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-02-26 02:10:55 +0000 LinuxKPI: 802.11: ensure to select the correct channel width If HT is enabled but not using CHW=40 set CHW=20 to make sure we do not get stuck on any other value. If VHT and the VHT Operation element Channel Width field is 0 (use 20/40) do not update the bandwidth but stick with what HT selected. This is better than disabling VHT alltogether for 20/40 and allows us to work on VHT20 and VHT40 APs it seems. We will have to do more work to can align with the chanctx or deal with Operating Mode Notification Action frames in LinuxKPI or net80211. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 1c9f8bc63292..410ec0679d44 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -401,6 +401,8 @@ lkpi_sta_sync_ht_from_ni(struct ieee80211_sta *sta, struct ieee80211_node *ni) if ((sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) != 0) sta->deflink.bandwidth = IEEE80211_STA_RX_BW_40; + else + sta->deflink.bandwidth = IEEE80211_STA_RX_BW_20; /* * 802.11n-2009 20.6 Parameters for HT MCSs gives the mandatory/ @@ -450,6 +452,13 @@ lkpi_sta_sync_vht_from_ni(struct ieee80211_sta *sta, struct ieee80211_node *ni) sta->deflink.vht_cap.cap = ni->ni_vhtcap; sta->deflink.vht_cap.vht_mcs = ni->ni_vht_mcsinfo; + /* + * If VHT20/40 are selected do not update the bandwidth + * from HT but stya on VHT. + */ + if (ni->ni_vht_chanwidth == IEEE80211_VHT_CHANWIDTH_USE_HT) + goto skip_bw; + width = (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK); switch (width) { #if 0 @@ -467,7 +476,7 @@ lkpi_sta_sync_vht_from_ni(struct ieee80211_sta *sta, struct ieee80211_node *ni) #endif sta->deflink.bandwidth = IEEE80211_STA_RX_BW_80; } - +skip_bw: rx_nss = 0; rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map; From nobody Wed Feb 26 02:23:46 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2dZG6qjKz5pRx5; Wed, 26 Feb 2025 02:23:50 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2dZG6NQ5z3NLn; Wed, 26 Feb 2025 02:23:50 +0000 (UTC) (envelope-from bz@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740536630; 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=hWeI3t+aDvNY7pBXSMz9lxI57twPQwfQ5OYw0R0TgBY=; b=oBjiie9+5K5gMmaXUeWvGM1ZVo5DrPbFy/h7MEdidh+OK55mw2zzhnWTcaaJqiyy8QQ17F RxNGB2Ypv8gjduiQtMCoOPBME91/h1gwYV/+Lk871Rp5jcxVZi+y0m+0GriMz4rDaenL2Y FTHgm+fy3ghRISX8PD0z3lNRvVGVTMGeMpY76NpjplGjmMuaDuCUVjmomsY3QfimpJ0mcL 2spESHS7eDqg/VKppSKVRQkpDqN1nQ/qFybyIcTzncApI+0akNDvE6nO+99UTm7woroHbM M7jUJHhZgNV2S353uF+6+98NBojbDnEMBi0jLMmoFtiDvwTCW6CEfpFxWpI86A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740536630; a=rsa-sha256; cv=none; b=yi9Q0wU5HVJxC+gYdiEoa6M/MradNnSDjsUKDscASdBgWsXMpydn+4SyEBtDZq/s0C3/mH NxLhv3tw8ogpgWeiGl1jpJ+4Ua49rez9+FsqqiK13zNzR35T1UnGRGeqFNFakeiT9WQ32z v/a7WvdTw9qsMLD02WAby39RMgMzJTnjdt8plV7YdfjUU/OzedrnIZ/DeU8xppdKmi8JWz o20ecC2GsFE7gSa1YwdgMRdvzckJ5aZpdTqXwRWOu7+c2v+CCnBVUD/9D6bRHIGi2f7F8t pzPC17wgcf5GcPfbPAgvcPGl7XxS1T/MOrm88/1It3dGP14axcL8IRMgsJIN4A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740536630; 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=hWeI3t+aDvNY7pBXSMz9lxI57twPQwfQ5OYw0R0TgBY=; b=UFYr24p6GElY9qE6Qb6wLDkg06rA/3MwmuIzShueZM3RpfbZGxVYTnCGAQLimfciEMiuIK js85KiAJ3vzNdhFfrkJ/Kmn3MXpKebpYzlKUr7fuPhwtMGspY0n/zoegT89WZzw8CDHVIF Cgx+FE+HGJTm2hTF+8b86DD8xhGqJRIk424ph5NuwwS91fFwaohge07AnMtFBUQFj4sg+H vPbO2QWNGVa3rYYXJS/8N/e1jpDrhbPxRAcNBb52a7SJJIF8V7tpGc5WNkS8t1g8UD6yfW u4/gKVZz/NET3q1HAQ3gzmCk+fIlnMtb2z6UccNrlpaU6FUpqiKWsBGx+7MMzQ== Received: from mx-01.divo.sbone.de (mx-01.divo.sbone.de [IPv6:2003:a:140a:2200:6:594:fffe:19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature ECDSA (prime256v1) client-digest SHA256) (Client CN "mx-01.divo.sbone.de", Issuer "E5" (verified OK)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Z2dZG4yP4zMY5; Wed, 26 Feb 2025 02:23:50 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mx-01.divo.sbone.de (Postfix) with ESMTPS id 9CC59A64805; Wed, 26 Feb 2025 02:23:47 +0000 (UTC) Received: from content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id E65562D029E0; Wed, 26 Feb 2025 02:23:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) by content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (amavisd-new, port 10024) with ESMTP id KVMaVZViNVFH; Wed, 26 Feb 2025 02:23:47 +0000 (UTC) Received: from strong-rtwn0.sbone.de (strong-rtwn0.sbone.de [IPv6:fde9:577b:c1a9:4902:da44:89ff:fedd:d5ab]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id BF74E2D029D8; Wed, 26 Feb 2025 02:23:47 +0000 (UTC) Date: Wed, 26 Feb 2025 02:23:46 +0000 (UTC) From: "Bjoern A. Zeeb" To: Michael Tuexen cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 0e58542fd246 - main - tcp: remove unused field from struct tcpcb In-Reply-To: <202502252048.51PKm4YX061305@gitrepo.freebsd.org> Message-ID: References: <202502252048.51PKm4YX061305@gitrepo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed On Tue, 25 Feb 2025, Michael Tuexen wrote: > The branch main has been updated by tuexen: > > URL: https://cgit.FreeBSD.org/src/commit/?id=0e58542fd246242bc64bd03d8b2f28cf981c062b > > commit 0e58542fd246242bc64bd03d8b2f28cf981c062b > Author: Peter Lei > AuthorDate: 2025-02-25 20:37:48 +0000 > Commit: Michael Tuexen > CommitDate: 2025-02-25 20:37:48 +0000 > > tcp: remove unused field from struct tcpcb > > Reviewed by: tuexen > Sponsored by: Netflix, Inc. > --- > sys/netinet/tcp_var.h | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h > index e65e44840bd8..31663ed48f81 100644 > --- a/sys/netinet/tcp_var.h > +++ b/sys/netinet/tcp_var.h > @@ -452,7 +452,6 @@ struct tcpcb { > tcp_seq gput_seq; /* Outbound measurement seq */ > tcp_seq gput_ack; /* Inbound measurement ack */ > int32_t t_stats_gput_prev; /* XXXLAS: Prev gput measurement */ > - uint32_t t_maxpeakrate; /* max peak rate set by user, bytes/s */ Is the tcpcb no longer KBI relevant these days? In the old days we'd simply make this a spare and not move all offsets below around. > uint32_t t_sndtlppack; /* tail loss probe packets sent */ > uint64_t t_sndtlpbyte; /* total tail loss probe bytes sent */ > uint64_t t_sndbytes; /* total bytes sent */ > -- Bjoern A. Zeeb r15:7 From nobody Wed Feb 26 05:27:39 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2jfP11ZRz5pJx0; Wed, 26 Feb 2025 05:27:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2jfM5Fhnz3wFZ; Wed, 26 Feb 2025 05:27:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740547659; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=S29OIn/zb5+nFOQb6XDP5z+yyX5Fl5B21koqCpab4go=; b=R70GdxaQLGeaZWlfXtaSNx12HQyX6fvbQG7RCtmdjH0W/fQm/UdgZUDyc7blDd+7zcK7hY Y+7kvGZm/KRDSuM45aOlGb1R2ewWVJMJlV9PWUaur4fmpdntpKoviGpQ7diDgk7zLDXNBT t6eQmCOxNKITL4g20yCngJjerNfqGWmhAHgPB+xnqEfTZx96yAJ2kX+p+fnWqOufxiYuks DjiUllB82b4MN1gjU0sFelpjkk+GZvxt0Xtfm8U1I84J09Oy3vfQ8rrC8h6CkOWgnZ1+1+ ucDUzlIZq47RbThmZpRpbtywzUwJy05rB7p5WZPbGHe5m4+j99524m0L3TZmqA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740547659; a=rsa-sha256; cv=none; b=CpSfh3l3OW9+UlSSEqB8bl9ec03tC4vBQ18PoJ/nA+ciMusaU81/yRR5Yi0osuuXEim8oc dJFtVZy/0Powi/WO02GJl98EiU/KJAFJI563C9ZFM2dsBS53QfeuFAK0SR2RidYSuXWRtu BzXav1MdRWU9D0v+B5Yqs7cQfVQoHQtcMO8m1ne3pTgiR7DX08aa5yIBwH7f+bxJYa8YHK sMC5rj/EJW51CZFb4rRMYrK5+YK/u7r/WB54MA4f1FtGpSUAMU+FHNbuFU4D4iJ+Iir98S k2EUsCRtfNT1vjdxE1CHEyOU/s8VZ0yZqjzxKhuxQk84/bu0hdPCxsq2TKc4pA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740547659; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=S29OIn/zb5+nFOQb6XDP5z+yyX5Fl5B21koqCpab4go=; b=OOjwtwJ5L6crCH7aB0tleBIdrg21gVUNRBnWuqxiQ9CsRbnzgEdu1dyKCKfb1N3+cuNXCU AqMdUDQJfXiYBfytvlRLUBcEYFwOm/kOlbS0kNY371SbM1J6P3XHg3ySJtxjvvJ3u3PPQI 6/Z69wiA6KIQOKbZZ32n042Vlwl6vSGp4LahzZfMnEWx5avhs8NWFeaCd8WI/6q/4+0XaK nzVTx8zf3iQfGj9f5QGYUkq0cbvFgPyyOLDYPJPrnzND7vdamosxDgJ5JIBbpuAkf7Mi9Y 2CzUwfZrUnSpfKWV7a/eB1RPuCV8nbW35sENuP+Nu4GoLL7uKBQILYffdm5fvw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2jfM1yWRzyc9; Wed, 26 Feb 2025 05:27:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51Q5Rdlj032644; Wed, 26 Feb 2025 05:27:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51Q5RdNt032641; Wed, 26 Feb 2025 05:27:39 GMT (envelope-from git) Date: Wed, 26 Feb 2025 05:27:39 GMT Message-Id: <202502260527.51Q5RdNt032641@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: 8c108dccd7f8 - main - acpidump: do not use pointer arithmetic to check for overflow List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8c108dccd7f878ad44aaef1f5bfb5622666bd09a Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8c108dccd7f878ad44aaef1f5bfb5622666bd09a commit 8c108dccd7f878ad44aaef1f5bfb5622666bd09a Author: Konstantin Belousov AuthorDate: 2025-02-26 05:24:30 +0000 Commit: Konstantin Belousov CommitDate: 2025-02-26 05:27:32 +0000 acpidump: do not use pointer arithmetic to check for overflow Pointer arithmetic overflow is UB. Convert to unsigned uintptr_t and do the check there. PR: 204945 Reported by: David Binderman Sponsored by: The FreeBSD Foundation MFC after: 1 week --- usr.sbin/acpi/acpidump/acpi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/usr.sbin/acpi/acpidump/acpi.c b/usr.sbin/acpi/acpidump/acpi.c index c9e2d5745d50..a8a3c953d72d 100644 --- a/usr.sbin/acpi/acpidump/acpi.c +++ b/usr.sbin/acpi/acpidump/acpi.c @@ -1222,13 +1222,14 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) vend = vaddr + len; while (vaddr != NULL) { - if ((vaddr + sizeof(struct TCPAevent) >= vend)|| - (vaddr + sizeof(struct TCPAevent) < vaddr)) + if ((uintptr_t)vaddr + sizeof(struct TCPAevent) >= + (uintptr_t)vend || (uintptr_t)vaddr + sizeof( + struct TCPAevent) < (uintptr_t)vaddr) break; event = (struct TCPAevent *)(void *)vaddr; - if (vaddr + event->event_size >= vend) + if ((uintptr_t)vaddr + event->event_size >= (uintptr_t)vend) break; - if (vaddr + event->event_size < vaddr) + if ((uintptr_t)vaddr + event->event_size < (uintptr_t)vaddr) break; if (event->event_type == 0 && event->event_size == 0) break; From nobody Wed Feb 26 09:06:21 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2pVv5XhJz5phdD; Wed, 26 Feb 2025 09:06:31 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from drew.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "Certum Domain Validation CA SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2pVv3KXTz3bCR; Wed, 26 Feb 2025 09:06:31 +0000 (UTC) (envelope-from tuexen@freebsd.org) Authentication-Results: mx1.freebsd.org; none Received: from smtpclient.apple (unknown [IPv6:2a02:8109:1101:be00:9dcd:4a6f:c57f:9896]) (Authenticated sender: macmic) by drew.franken.de (Postfix) with ESMTPSA id 57334721E281C; Wed, 26 Feb 2025 10:06:22 +0100 (CET) Content-Type: text/plain; charset=us-ascii List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.400.131.1.6\)) Subject: Re: git: 0e58542fd246 - main - tcp: remove unused field from struct tcpcb From: tuexen@freebsd.org In-Reply-To: Date: Wed, 26 Feb 2025 10:06:21 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <1B9ED49E-E36A-4C0A-A47E-C97569C2354C@freebsd.org> References: <202502252048.51PKm4YX061305@gitrepo.freebsd.org> To: "Bjoern A. Zeeb" X-Mailer: Apple Mail (2.3826.400.131.1.6) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:680, ipnet:2001:638::/32, country:DE] X-Rspamd-Queue-Id: 4Z2pVv3KXTz3bCR X-Spamd-Bar: ---- > On 26. Feb 2025, at 03:23, Bjoern A. Zeeb wrote: >=20 > On Tue, 25 Feb 2025, Michael Tuexen wrote: >=20 >> The branch main has been updated by tuexen: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D0e58542fd246242bc64bd03d8b2f28cf= 981c062b >>=20 >> commit 0e58542fd246242bc64bd03d8b2f28cf981c062b >> Author: Peter Lei >> AuthorDate: 2025-02-25 20:37:48 +0000 >> Commit: Michael Tuexen >> CommitDate: 2025-02-25 20:37:48 +0000 >>=20 >> tcp: remove unused field from struct tcpcb >>=20 >> Reviewed by: tuexen >> Sponsored by: Netflix, Inc. >> --- >> sys/netinet/tcp_var.h | 1 - >> 1 file changed, 1 deletion(-) >>=20 >> diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h >> index e65e44840bd8..31663ed48f81 100644 >> --- a/sys/netinet/tcp_var.h >> +++ b/sys/netinet/tcp_var.h >> @@ -452,7 +452,6 @@ struct tcpcb { >> tcp_seq gput_seq; /* Outbound measurement seq */ >> tcp_seq gput_ack; /* Inbound measurement ack */ >> int32_t t_stats_gput_prev; /* XXXLAS: Prev gput measurement */ >> - uint32_t t_maxpeakrate; /* max peak rate set by user, bytes/s */ >=20 > Is the tcpcb no longer KBI relevant these days? > In the old days we'd simply make this a spare and not move all offsets > below around. I can do that, if it is preferred. I was actually thinking about this, but did not find any variable in the struct which indicates it is = unused, spare or so. I do know that the size of the structure matters (smaller = is better). So please let me know. I will not MFC this change. Best regards Michael >=20 >> uint32_t t_sndtlppack; /* tail loss probe packets sent */ >> uint64_t t_sndtlpbyte; /* total tail loss probe bytes sent */ >> uint64_t t_sndbytes; /* total bytes sent */ >>=20 >=20 > --=20 > Bjoern A. Zeeb = r15:7 From nobody Wed Feb 26 13:36:57 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2wW15nV6z5q6cD; Wed, 26 Feb 2025 13:37:01 +0000 (UTC) (envelope-from SRS0=9B21=VR=klop.ws=ronald-lists@realworks.nl) Received: from smtp-relay-int.realworks.nl (smtp-relay-int.realworks.nl [194.109.157.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2wW00D1Lz3fxp; Wed, 26 Feb 2025 13:36:59 +0000 (UTC) (envelope-from SRS0=9B21=VR=klop.ws=ronald-lists@realworks.nl) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=klop.ws header.s=rw2 header.b=TqoxRpJZ; dmarc=pass (policy=quarantine) header.from=klop.ws; spf=pass (mx1.freebsd.org: domain of "SRS0=9B21=VR=klop.ws=ronald-lists@realworks.nl" designates 194.109.157.24 as permitted sender) smtp.mailfrom="SRS0=9B21=VR=klop.ws=ronald-lists@realworks.nl" Date: Wed, 26 Feb 2025 14:36:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=klop.ws; s=rw2; t=1740577017; 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; bh=GoUtTbhguEC8ktm/KOi3SPUA00DMT+u9ObPodYWGu98=; b=TqoxRpJZz98DVAmFx847zfu6+vz4iIyy1gW2r8/MLRBnEgumaUsvsdwDGQhCDb+Q5iEKD4 aZl5h0bpSCuAA4iEnx9LyZUUhW17Wakb7tn5KHPMypJA8lE5+3RtHUZlh8346fIYsmvuYL yFCgad3mnKE5ksl0f+CsUWY7NiHbQd7TY5vDHeBvpjyn/8crsfQT/FTTX+rx1ewt8RXOMc 3ptGz05/3wWh+CKy7knBt6WwIgb0vOntZK9NuOciHubE66WNwHWY60omippBO991p/KwZC UtWx36K1bkCZqtlCI/W00fJt50dDf9ae7PIDQsVtFsRsqfFDZ06yXQaNs6YlIA== From: Ronald Klop To: Konstantin Belousov Cc: dev-commits-src-all@FreeBSD.org, src-committers@FreeBSD.org, dev-commits-src-main@FreeBSD.org Message-ID: <985139317.7211.1740577017034@localhost> In-Reply-To: <202502250720.51P7KJkI056048@gitrepo.freebsd.org> Subject: Re: git: e59991206b14 - main - fts(3): be less strict when automount does its job under us walking autofs mount List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_7210_1760650439.1740577017031" X-Mailer: Realworks (739.null) Importance: Normal X-Priority: 3 (Normal) X-Spamd-Result: default: False [-0.28 / 15.00]; RBL_SENDERSCORE_REPUT_9(-1.00)[194.109.157.24:from]; NEURAL_SPAM_LONG(0.96)[0.962]; NEURAL_HAM_SHORT(-0.83)[-0.831]; NEURAL_SPAM_MEDIUM(0.69)[0.692]; MID_RHS_NOT_FQDN(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[klop.ws,quarantine]; FORGED_SENDER(0.30)[ronald-lists@klop.ws,SRS0=9B21=VR=klop.ws=ronald-lists@realworks.nl]; R_SPF_ALLOW(-0.20)[+ip4:194.109.157.0/24]; R_DKIM_ALLOW(-0.20)[klop.ws:s=rw2]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; ONCE_RECEIVED(0.10)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:3265, ipnet:194.109.0.0/16, country:NL]; TO_DN_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[194.109.157.24:from]; RCVD_COUNT_ZERO(0.00)[0]; RCPT_COUNT_THREE(0.00)[4]; FROM_NEQ_ENVFROM(0.00)[ronald-lists@klop.ws,SRS0=9B21=VR=klop.ws=ronald-lists@realworks.nl]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; HAS_X_PRIO_THREE(0.00)[3]; MLMMJ_DEST(0.00)[dev-commits-src-all@FreeBSD.org,dev-commits-src-main@FreeBSD.org]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[klop.ws:+] X-Rspamd-Queue-Id: 4Z2wW00D1Lz3fxp X-Spamd-Bar: / ------=_Part_7210_1760650439.1740577017031 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Van: Konstantin Belousov Datum: 25 februari 2025 08:20 Aan: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commi= ts-src-main@FreeBSD.org Onderwerp: git: e59991206b14 - main - fts(3): be less strict when automoun= t does its job under us walking autofs mount >=20 >=20 > The branch main has been updated by kib: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3De59991206b1463b7e85cc8aafd= e7f1dc03fcedcf >=20 > commit e59991206b1463b7e85cc8aafde7f1dc03fcedcf > Author: Konstantin Belousov=20 > AuthorDate: 2025-02-21 13:07:43 +0000 > Commit: Konstantin Belousov=20 > CommitDate: 2025-02-25 07:09:29 +0000 >=20 > fts(3): be less strict when automount does its job under us walking a= utofs mount > =20 > Namely, allow the file id change if the resulting file belongs to > automounted filesystem. If it is, remember the updated id. > =20 > This allows the ids from the automounted volumes to change without > restrictions, might be a further refinement would be to only allow su= ch > inconsistency once. > =20 > PR: 284914 > Reported and tested by: Lexi Winter=20 > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D49094 > --- > lib/libc/gen/fts.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) >=20 > diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c > index 770a7b2cc322..bd193c7c6cfc 100644 > --- a/lib/libc/gen/fts.c > +++ b/lib/libc/gen/fts.c > @@ -1132,6 +1132,7 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char= *path) > { > int ret, oerrno, newfd; > struct stat sb; > + struct statfs sf; > =20 > newfd =3D fd; > if (ISSET(FTS_NOCHDIR)) > @@ -1144,9 +1145,15 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, cha= r *path) > goto bail; > } > if (p->fts_dev !=3D sb.st_dev || p->fts_ino !=3D sb.st_ino) { > - errno =3D ENOENT; /* disinformation */ > - ret =3D -1; > - goto bail; > + if (_fstatfs(newfd, &sf) !=3D 0 || > + (sf.f_flags & MNT_AUTOMOUNTED) =3D=3D 0) { > + errno =3D ENOENT; /* disinformation */ > + ret =3D -1; > + goto bail; > + } > + /* autofs might did the mount under us, accept. */ > + p->fts_dev =3D sb.st_dev; > + p->fts_ino =3D=3D sb.st_ino; > } > ret =3D fchdir(newfd); > bail: >=20 >=20 >=20 >=20 >=20 /* autofs might did the mount under us, accept. */ I=E2=80=99m not native English so forgive me my question. But what does thi= s comment mean? Regards, Ronald.=20 ------=_Part_7210_1760650439.1740577017031 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

Van: Konstantin Bel= ousov <kib@FreeBSD.org>
Datum: 25 februari 2025 0= 8:20
Aan: src-committers@FreeBSD.org, dev-commits-src-a= ll@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Onderwerp: git: e59991206b14 - main - fts(3): be less strict when automount does= its job under us walking autofs mount

The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=3De5999120= 6b1463b7e85cc8aafde7f1dc03fcedcf

commit e59991206b1463b7e85cc8aafde7f1dc03fcedcf
Author:     Konstantin Belousov
AuthorDate: 2025-02-21 13:07:43 +0000
Commit:     Konstantin Belousov
CommitDate: 2025-02-25 07:09:29 +0000

    fts(3): be less strict when automount does its job = under us walking autofs mount
    
    Namely, allow the file id change if the resulting f= ile belongs to
    automounted filesystem.  If it is, remember th= e updated id.
    
    This allows the ids from the automounted volumes to= change without
    restrictions, might be a further refinement would b= e to only allow such
    inconsistency once.
    
    PR:     284914
    Reported and tested by: Lexi Winter
    Sponsored by:   The FreeBSD Foundation     MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D49094
---
 lib/libc/gen/fts.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c
index 770a7b2cc322..bd193c7c6cfc 100644
--- a/lib/libc/gen/fts.c
+++ b/lib/libc/gen/fts.c
@@ -1132,6 +1132,7 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char *= path)
 {
    int ret, oerrno, newfd;
    struct stat sb;
+   struct statfs sf;
 
    newfd =3D fd;
    if (ISSET(FTS_NOCHDIR))
@@ -1144,9 +1145,15 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char = *path)
        goto bail;
    }
    if (p->fts_dev !=3D sb.st_dev || p->fts_ino != =3D sb.st_ino) {
-       errno =3D ENOENT;    &= nbsp;/* disinformation */
-       ret =3D -1;
-       goto bail;
+       if (_fstatfs(newfd, &sf) !=3D 0 |= |
+           (sf.f_flags &= amp; MNT_AUTOMOUNTED) =3D=3D 0) {
+           errno =3D ENO= ENT;     /* disinformation */
+           ret =3D -1; +           goto bail; +       }
+       /* autofs might did the mount under u= s, accept. */
+       p->fts_dev =3D sb.st_dev;
+       p->fts_ino =3D=3D sb.st_ino;
    }
    ret =3D fchdir(newfd);
 bail:




   /* autofs might did the mount under us, a= ccept. */


I=E2=80=99m not native English = so forgive me my question. But what does this comment mean?

<= /div>
Regards,
Ronald. 


------=_Part_7210_1760650439.1740577017031-- From nobody Wed Feb 26 14:03:33 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2x5h37Vlz5q8rL; Wed, 26 Feb 2025 14:03:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2x5h2WD6z3tjm; Wed, 26 Feb 2025 14:03:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740578616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=li4egja3ZojePcybNgN/Ag2/idPE4LCzTZePpzjYVVc=; b=Pssa9yUd/iT3SbA00HYDkO7TRHv16eDhAVDtzzoeYCAy1Ugi4vLSIgXxPpV5kAlNKHomC4 B6W1QqaXN+/IMhUIzL4mojGreWTA+hPeQyVClhKP2iJSdsBcLei8pMTKCgrjDia2exN8yj GIMqNnr5X5rXk1SsP8gLpN3BqFuny8c2/tfmDszcuS5Pwm4gAphK/qlkB8/nNdcK0Uh+PW TTuiC6WvhYQeRHmk4GFzbWsd5ulhZEXaHNgxHA7nUxIaT7pWYmiq2ZVARJp30HzjdVVIie o9tJdMaiOg7OfIAg1nzlaQM7Q/vncUaaNBc1W0MZciCIcKJveeQyMcd6Cy6PzA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740578616; a=rsa-sha256; cv=none; b=LBvKNwZXGY5KIzpAtwQKE9YmtaQHk4Qorb1s0OOVusN3EKIA4OlABFrVHlcsNP04XkgMDh +opFPpoYKoXtgYAxB7d22HHExZPkcE1me++uRCO4077p3xgYSK7h9zAjw2V5xptmIV0txY eckQuabkUsq1T9qCUzQZ6kYygg/nR66f21CTjh7qYoMFNyU8soSoQ+F3h5Lrp3j+d8CMLc u/RitlfvAH+mdNocxgK6GZjnROonxnUS8x5EO/l4SOPGIlnDmJKCtJzLgzEVzgeiCJaZYr 7OkOHMc2AAmPq65XfIGtx2fVXlWugsLgA3odG+44fwNnNJHaYwVaewDM6xr5cw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740578616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=li4egja3ZojePcybNgN/Ag2/idPE4LCzTZePpzjYVVc=; b=mqQ+ZnyCQ/2EbRhk5ZR7BGMC5VC+bdeu+0ZWG+xcas5S8LcbM17m4jQXS3z3dTKe6IUVtN m4jbwUL/hGJWGyzWYyr4FSdIlOzKaB5RGZi+c+2xTdzpQnhC54MvylGvzkeG0y4jMK0moL +1EAgPdhc2dCX4aFM4YrmKJ5GnKX5GZnctvr4AZ6AMBZoCSYqM+ZIU+l/uTCZzov3IP+po wLPqPTw74rziwj4fYEXZZd3J2lb3H9O6yok+Amkb1JO/UyLpcBGJgSlv1E1dHqDC8JLRqL hKS8TvuiKCtN8xWamfsBsgpxMhZgRj7HEj8oQYI2btsZJ2Rif9Z4GzKwImhf8A== Received: from [10.9.4.95] (unknown [209.182.120.176]) (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 did not present a certificate) (Authenticated sender: kevans/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Z2x5g5VYYzsq1; Wed, 26 Feb 2025 14:03:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Message-ID: Date: Wed, 26 Feb 2025 08:03:33 -0600 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: e59991206b14 - main - fts(3): be less strict when automount does its job under us walking autofs mount To: Ronald Klop , Konstantin Belousov Cc: dev-commits-src-all@FreeBSD.org, src-committers@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <985139317.7211.1740577017034@localhost> Content-Language: en-US From: Kyle Evans In-Reply-To: <985139317.7211.1740577017034@localhost> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2/26/25 07:36, Ronald Klop wrote: > > *Van:* Konstantin Belousov > *Datum:* 25 februari 2025 08:20 > *Aan:* src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev- > commits-src-main@FreeBSD.org > *Onderwerp:* git: e59991206b14 - main - fts(3): be less strict when > automount does its job under us walking autofs mount > > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/? > id=e59991206b1463b7e85cc8aafde7f1dc03fcedcf cgit.FreeBSD.org/src/commit/? > id=e59991206b1463b7e85cc8aafde7f1dc03fcedcf> > > commit e59991206b1463b7e85cc8aafde7f1dc03fcedcf > Author:     Konstantin Belousov > AuthorDate: 2025-02-21 13:07:43 +0000 > Commit:     Konstantin Belousov > CommitDate: 2025-02-25 07:09:29 +0000 > >     fts(3): be less strict when automount does its job under us > walking autofs mount > >     Namely, allow the file id change if the resulting file belongs to >     automounted filesystem.  If it is, remember the updated id. > >     This allows the ids from the automounted volumes to change without >     restrictions, might be a further refinement would be to only > allow such >     inconsistency once. > >     PR:     284914 >     Reported and tested by: Lexi Winter >     Sponsored by:   The FreeBSD Foundation >     MFC after:      1 week >     Differential revision: https://reviews.freebsd.org/D49094 > > --- >  lib/libc/gen/fts.c | 13 ++++++++++--- >  1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c > index 770a7b2cc322..bd193c7c6cfc 100644 > --- a/lib/libc/gen/fts.c > +++ b/lib/libc/gen/fts.c > @@ -1132,6 +1132,7 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, > char *path) >  { >     int ret, oerrno, newfd; >     struct stat sb; > +   struct statfs sf; > >     newfd = fd; >     if (ISSET(FTS_NOCHDIR)) > @@ -1144,9 +1145,15 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int > fd, char *path) >         goto bail; >     } >     if (p->fts_dev != sb.st_dev || p->fts_ino != sb.st_ino) { > -       errno = ENOENT;     /* disinformation */ > -       ret = -1; > -       goto bail; > +       if (_fstatfs(newfd, &sf) != 0 || > +           (sf.f_flags & MNT_AUTOMOUNTED) == 0) { > +           errno = ENOENT;     /* disinformation */ > +           ret = -1; > +           goto bail; > +       } > +       /* autofs might did the mount under us, accept. */ > +       p->fts_dev = sb.st_dev; > +       p->fts_ino == sb.st_ino; >     } >     ret = fchdir(newfd); >  bail: > > ------------------------------------------------------------------------ > > > >    /* autofs might did the mount under us, accept. */ > > > I’m not native English so forgive me my question. But what does this > comment mean? > It might have triggered an autofs mount while we're running, so we just accept the otherwise suspicious looking change. From nobody Wed Feb 26 15:15:48 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2yj11lr0z5qH1Z; Wed, 26 Feb 2025 15:15:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2yj040l8z3P3R; Wed, 26 Feb 2025 15:15:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740582948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=B3TpKte9kpDmYUOva+2kL5uqx08jONRFjK26n1Yq9ZA=; b=Vm8nN1wZUKnVezMdtkDFodwQcRiFR91J7qQj/Ojw2eZ7QmCjePRUuvBIMyjEqr9DnNhR6t F+4EiZoat8DTN1P6mUKAqiOWz6mZ2rQZ8LJ8PR79vlYoN3v5E8EMjHek+vi9DR3pwLRe10 dF2aZxikpqJLSbMesNL2Z9W2H3NKJm7FxeLNwBxiHsQwqUkS1HCiPe9/La0zLKpBh8Xue7 Z3VWgFMAJ97Yrj/xLiN3HWs0HJ4/f6qirD2meT4wKdPtaL74R0VLQ1ypVFVnfxVkb8TLqy jyUj2C/hT0enIp+5mJlBloPwoKGVD0Si/+5EIkrxOrJQuCtxF2V8tusvNKnUlQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740582948; a=rsa-sha256; cv=none; b=l2D5M8+nlRUCasAxrDb6n/W4SBpSzSCoe02zPxlJuEYhN2E6TLvO4At9y1kGLuqqGomPEA CYc38IwoXylTCRrFPBvJ+i3Rn+mVsTzt8PZprqTomIr2PlYQOtOZ9U1mZgLGjbkbFnAn9Q GpovJxuwGeRtMXlGpkeaBXrQqFTX6RQFMs+7QNkHzeJVWv05Bbxf992mkZJ2YUvaX66hXj egkQaIW9Ry/4MG0Ae2JlfICWkTPgnXtg/IA1s2BtP01e/r8y2zRbuRStdeiLbEAtJnqEDt +Lylsm7zhW/vyxGTR877O5UVF2ziy1nWyh+y7cfWNAW3eijcfvkDiZOyk8fsAw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740582948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=B3TpKte9kpDmYUOva+2kL5uqx08jONRFjK26n1Yq9ZA=; b=HNxTTR8wrjPhdDv3SSjK+eDWLf699XYJxLV6WqQLpgpBHi8RuH7qeQGgkn8Atz2X5K0wms HSKuJmSSjPieKIeLrWt0caHstAf+5iE+sjeEcOijWLV27W4Hbk7oCRjo8/VmrlmnmWJcW1 +AlX7pqR9LIehfF4ffexwPmIQPtwCgC6NH8wMwMPL06gIdAbMUpD65KpRtjpHgNgoU1NSi koK9qGSqmweFTNAw4p7ktmFexbRPV32s+OI5xeWSPMCK+jALIKYCjNdcv6dqeFXvkPmu0R l9+mPz3lJ0KtAIhR3QAiVFohFSdroKc38Jf54twvrP7rSQOL17W+JjZrX4t7Dw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2yj03J9bz1Gxm; Wed, 26 Feb 2025 15:15:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QFFmn2033913; Wed, 26 Feb 2025 15:15:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QFFmtp033910; Wed, 26 Feb 2025 15:15:48 GMT (envelope-from git) Date: Wed, 26 Feb 2025 15:15:48 GMT Message-Id: <202502261515.51QFFmtp033910@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: d42a73fb6a85 - main - ctld: Add a dedicated API between parse.y and the rest of the program List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d42a73fb6a85b2dd4692cb003065be5c68863860 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d42a73fb6a85b2dd4692cb003065be5c68863860 commit d42a73fb6a85b2dd4692cb003065be5c68863860 Author: John Baldwin AuthorDate: 2025-02-26 15:10:33 +0000 Commit: John Baldwin CommitDate: 2025-02-26 15:10:33 +0000 ctld: Add a dedicated API between parse.y and the rest of the program The primary purpose of this is to permit the rest of ctld to use C++. However, this also has the nice side effect of reducing code duplication with the UCL parser. As a general rule, setting of options including error handling for invalid values, etc. is moved out of parse.y and into conf.c. The globals for the current configuration, auth group, portal group, lun, and target are also moved into conf.c hiding the types from parse.y. The intention is that all of the functions declared in conf.h will be extern "C" for use by parse.y and that the backing data structures can be reimplemented as C++ classes instead of C structures if desired. A few other small changes are included with this refactoring: - Warn and fail a configuration that specifies the same LUN multiple times for a target. - Use T_* constants for SCSI device types instead of magic numbers. - Warn and fail for a few UCL properties that aren't the required type including "discovery-auth-group" in a portal group context, "auth-type" and "port" in a target context. - Fix a bug where chap-mutual in a target in UCL would not auto-create a new auth-group. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D48934 --- usr.sbin/ctld/Makefile | 2 +- usr.sbin/ctld/conf.c | 772 +++++++++++++++++++++++++++++++++++++++++++++++ usr.sbin/ctld/conf.h | 100 ++++++ usr.sbin/ctld/ctld.c | 225 ++------------ usr.sbin/ctld/ctld.h | 39 +-- usr.sbin/ctld/kernel.c | 23 +- usr.sbin/ctld/parse.y | 553 ++++++++++----------------------- usr.sbin/ctld/uclparse.c | 689 +++++++++++++++++++----------------------- 8 files changed, 1388 insertions(+), 1015 deletions(-) diff --git a/usr.sbin/ctld/Makefile b/usr.sbin/ctld/Makefile index d6bef1032c5a..787a608c37be 100644 --- a/usr.sbin/ctld/Makefile +++ b/usr.sbin/ctld/Makefile @@ -5,7 +5,7 @@ CFLAGS+=-I${SRCTOP}/contrib/libucl/include PACKAGE= iscsi PROG= ctld -SRCS= ctld.c discovery.c isns.c kernel.c +SRCS= ctld.c conf.c discovery.c isns.c kernel.c SRCS+= login.c parse.y token.l y.tab.h uclparse.c CFLAGS+= -I${.CURDIR} CFLAGS+= -I${SRCTOP}/sys diff --git a/usr.sbin/ctld/conf.c b/usr.sbin/ctld/conf.c new file mode 100644 index 000000000000..ac82d06ad8fa --- /dev/null +++ b/usr.sbin/ctld/conf.c @@ -0,0 +1,772 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2012 The FreeBSD Foundation + * + * This software was developed by Edward Tomasz Napierala 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 +#include +#include +#include +#include +#include +#include +#include +#include + +#include "conf.h" +#include "ctld.h" + +static struct conf *conf = NULL; +static struct auth_group *auth_group = NULL; +static struct portal_group *portal_group = NULL; +static struct target *target = NULL; +static struct lun *lun = NULL; + +void +conf_start(struct conf *new_conf) +{ + assert(conf == NULL); + conf = new_conf; +} + +void +conf_finish(void) +{ + auth_group = NULL; + portal_group = NULL; + target = NULL; + lun = NULL; + conf = NULL; +} + +bool +isns_add_server(const char *addr) +{ + return (isns_new(conf, addr)); +} + +void +conf_set_debug(int debug) +{ + conf->conf_debug = debug; +} + +void +conf_set_isns_period(int period) +{ + conf->conf_isns_period = period; +} + +void +conf_set_isns_timeout(int timeout) +{ + conf->conf_isns_timeout = timeout; +} + +void +conf_set_maxproc(int maxproc) +{ + conf->conf_maxproc = maxproc; +} + +bool +conf_set_pidfile_path(const char *path) +{ + if (conf->conf_pidfile_path != NULL) { + log_warnx("pidfile specified more than once"); + return (false); + } + conf->conf_pidfile_path = checked_strdup(path); + return (true); +} + +void +conf_set_timeout(int timeout) +{ + conf->conf_timeout = timeout; +} + +static bool +_auth_group_set_type(struct auth_group *ag, const char *str) +{ + int type; + + if (strcmp(str, "none") == 0) { + type = AG_TYPE_NO_AUTHENTICATION; + } else if (strcmp(str, "deny") == 0) { + type = AG_TYPE_DENY; + } else if (strcmp(str, "chap") == 0) { + type = AG_TYPE_CHAP; + } else if (strcmp(str, "chap-mutual") == 0) { + type = AG_TYPE_CHAP_MUTUAL; + } else { + if (ag->ag_name != NULL) + log_warnx("invalid auth-type \"%s\" for auth-group " + "\"%s\"", str, ag->ag_name); + else + log_warnx("invalid auth-type \"%s\" for target " + "\"%s\"", str, ag->ag_target->t_name); + return (false); + } + + if (ag->ag_type != AG_TYPE_UNKNOWN && ag->ag_type != type) { + if (ag->ag_name != NULL) { + log_warnx("cannot set auth-type to \"%s\" for " + "auth-group \"%s\"; already has a different " + "type", str, ag->ag_name); + } else { + log_warnx("cannot set auth-type to \"%s\" for target " + "\"%s\"; already has a different type", + str, ag->ag_target->t_name); + } + return (false); + } + + ag->ag_type = type; + + return (true); +} + +bool +auth_group_add_chap(const char *user, const char *secret) +{ + return (auth_new_chap(auth_group, user, secret)); +} + +bool +auth_group_add_chap_mutual(const char *user, const char *secret, + const char *user2, const char *secret2) +{ + return (auth_new_chap_mutual(auth_group, user, secret, user2, secret2)); +} + +bool +auth_group_add_initiator_name(const char *name) +{ + return (auth_name_new(auth_group, name)); +} + +bool +auth_group_add_initiator_portal(const char *portal) +{ + return (auth_portal_new(auth_group, portal)); +} + +bool +auth_group_set_type(const char *type) +{ + return (_auth_group_set_type(auth_group, type)); +} + +bool +auth_group_start(const char *name) +{ + /* + * Make it possible to redefine the default auth-group. but + * only once. + */ + if (strcmp(name, "default") == 0) { + if (conf->conf_default_ag_defined) { + log_warnx("duplicated auth-group \"default\""); + return (false); + } + + conf->conf_default_ag_defined = true; + auth_group = auth_group_find(conf, "default"); + return (true); + } + + auth_group = auth_group_new(conf, name); + return (auth_group != NULL); +} + +void +auth_group_finish(void) +{ + auth_group = NULL; +} + +bool +portal_group_start(const char *name) +{ + /* + * Make it possible to redefine the default portal-group. but + * only once. + */ + if (strcmp(name, "default") == 0) { + if (conf->conf_default_pg_defined) { + log_warnx("duplicated portal-group \"default\""); + return (false); + } + + conf->conf_default_pg_defined = true; + portal_group = portal_group_find(conf, "default"); + return (true); + } + + portal_group = portal_group_new(conf, name); + return (portal_group != NULL); +} + +void +portal_group_finish(void) +{ + portal_group = NULL; +} + +bool +portal_group_add_listen(const char *listen, bool iser) +{ + return (portal_group_add_portal(portal_group, listen, iser)); +} + +bool +portal_group_add_option(const char *name, const char *value) +{ + return (option_new(portal_group->pg_options, name, value)); +} + +bool +portal_group_set_discovery_auth_group(const char *name) +{ + if (portal_group->pg_discovery_auth_group != NULL) { + log_warnx("discovery-auth-group for portal-group " + "\"%s\" specified more than once", + portal_group->pg_name); + return (false); + } + portal_group->pg_discovery_auth_group = auth_group_find(conf, name); + if (portal_group->pg_discovery_auth_group == NULL) { + log_warnx("unknown discovery-auth-group \"%s\" " + "for portal-group \"%s\"", name, portal_group->pg_name); + return (false); + } + return (true); +} + +bool +portal_group_set_dscp(u_int dscp) +{ + if (dscp >= 0x40) { + log_warnx("invalid DSCP value %u for portal-group \"%s\"", + dscp, portal_group->pg_name); + return (false); + } + + portal_group->pg_dscp = dscp; + return (true); +} + +bool +portal_group_set_filter(const char *str) +{ + int filter; + + if (strcmp(str, "none") == 0) { + filter = PG_FILTER_NONE; + } else if (strcmp(str, "portal") == 0) { + filter = PG_FILTER_PORTAL; + } else if (strcmp(str, "portal-name") == 0) { + filter = PG_FILTER_PORTAL_NAME; + } else if (strcmp(str, "portal-name-auth") == 0) { + filter = PG_FILTER_PORTAL_NAME_AUTH; + } else { + log_warnx("invalid discovery-filter \"%s\" for portal-group " + "\"%s\"; valid values are \"none\", \"portal\", " + "\"portal-name\", and \"portal-name-auth\"", + str, portal_group->pg_name); + return (false); + } + + if (portal_group->pg_discovery_filter != PG_FILTER_UNKNOWN && + portal_group->pg_discovery_filter != filter) { + log_warnx("cannot set discovery-filter to \"%s\" for " + "portal-group \"%s\"; already has a different " + "value", str, portal_group->pg_name); + return (false); + } + + portal_group->pg_discovery_filter = filter; + + return (true); +} + +void +portal_group_set_foreign(void) +{ + portal_group->pg_foreign = true; +} + +bool +portal_group_set_offload(const char *offload) +{ + + if (portal_group->pg_offload != NULL) { + log_warnx("cannot set offload to \"%s\" for " + "portal-group \"%s\"; already defined", + offload, portal_group->pg_name); + return (false); + } + + portal_group->pg_offload = checked_strdup(offload); + + return (true); +} + +bool +portal_group_set_pcp(u_int pcp) +{ + if (pcp > 7) { + log_warnx("invalid PCP value %u for portal-group \"%s\"", + pcp, portal_group->pg_name); + return (false); + } + + portal_group->pg_pcp = pcp; + return (true); +} + +bool +portal_group_set_redirection(const char *addr) +{ + + if (portal_group->pg_redirection != NULL) { + log_warnx("cannot set redirection to \"%s\" for " + "portal-group \"%s\"; already defined", + addr, portal_group->pg_name); + return (false); + } + + portal_group->pg_redirection = checked_strdup(addr); + + return (true); +} + +void +portal_group_set_tag(uint16_t tag) +{ + portal_group->pg_tag = tag; +} + +bool +lun_start(const char *name) +{ + lun = lun_new(conf, name); + return (lun != NULL); +} + +void +lun_finish(void) +{ + lun = NULL; +} + +bool +lun_add_option(const char *name, const char *value) +{ + return (option_new(lun->l_options, name, value)); +} + +bool +lun_set_backend(const char *value) +{ + if (lun->l_backend != NULL) { + log_warnx("backend for lun \"%s\" specified more than once", + lun->l_name); + return (false); + } + + lun->l_backend = checked_strdup(value); + return (true); +} + +bool +lun_set_blocksize(size_t value) +{ + if (lun->l_blocksize != 0) { + log_warnx("blocksize for lun \"%s\" specified more than once", + lun->l_name); + return (false); + } + lun->l_blocksize = value; + return (true); +} + +bool +lun_set_device_type(const char *value) +{ + uint64_t device_type; + + if (strcasecmp(value, "disk") == 0 || + strcasecmp(value, "direct") == 0) + device_type = T_DIRECT; + else if (strcasecmp(value, "processor") == 0) + device_type = T_PROCESSOR; + else if (strcasecmp(value, "cd") == 0 || + strcasecmp(value, "cdrom") == 0 || + strcasecmp(value, "dvd") == 0 || + strcasecmp(value, "dvdrom") == 0) + device_type = T_CDROM; + else if (expand_number(value, &device_type) != 0 || device_type > 15) { + log_warnx("invalid device-type \"%s\" for lun \"%s\"", value, + lun->l_name); + return (false); + } + + lun->l_device_type = device_type; + return (true); +} + +bool +lun_set_device_id(const char *value) +{ + if (lun->l_device_id != NULL) { + log_warnx("device_id for lun \"%s\" specified more than once", + lun->l_name); + return (false); + } + + lun->l_device_id = checked_strdup(value); + return (true); +} + +bool +lun_set_path(const char *value) +{ + if (lun->l_path != NULL) { + log_warnx("path for lun \"%s\" specified more than once", + lun->l_name); + return (false); + } + + lun->l_path = checked_strdup(value); + return (true); +} + +bool +lun_set_serial(const char *value) +{ + if (lun->l_serial != NULL) { + log_warnx("serial for lun \"%s\" specified more than once", + lun->l_name); + return (false); + } + + lun->l_serial = checked_strdup(value); + return (true); +} + +bool +lun_set_size(uint64_t value) +{ + if (lun->l_size != 0) { + log_warnx("size for lun \"%s\" specified more than once", + lun->l_name); + return (false); + } + + lun->l_size = value; + return (true); +} + +bool +lun_set_ctl_lun(uint32_t value) +{ + + if (lun->l_ctl_lun >= 0) { + log_warnx("ctl_lun for lun \"%s\" specified more than once", + lun->l_name); + return (false); + } + lun->l_ctl_lun = value; + return (true); +} + +bool +target_start(const char *name) +{ + target = target_new(conf, name); + return (target != NULL); +} + +void +target_finish(void) +{ + target = NULL; +} + +bool +target_add_chap(const char *user, const char *secret) +{ + if (target->t_auth_group != NULL) { + if (target->t_auth_group->ag_name != NULL) { + log_warnx("cannot use both auth-group and " + "chap for target \"%s\"", target->t_name); + return (false); + } + } else { + target->t_auth_group = auth_group_new(conf, NULL); + if (target->t_auth_group == NULL) + return (false); + target->t_auth_group->ag_target = target; + } + return (auth_new_chap(target->t_auth_group, user, secret)); +} + +bool +target_add_chap_mutual(const char *user, const char *secret, + const char *user2, const char *secret2) +{ + if (target->t_auth_group != NULL) { + if (target->t_auth_group->ag_name != NULL) { + log_warnx("cannot use both auth-group and " + "chap-mutual for target \"%s\"", target->t_name); + return (false); + } + } else { + target->t_auth_group = auth_group_new(conf, NULL); + if (target->t_auth_group == NULL) + return (false); + target->t_auth_group->ag_target = target; + } + return (auth_new_chap_mutual(target->t_auth_group, user, secret, user2, + secret2)); +} + +bool +target_add_initiator_name(const char *name) +{ + if (target->t_auth_group != NULL) { + if (target->t_auth_group->ag_name != NULL) { + log_warnx("cannot use both auth-group and " + "initiator-name for target \"%s\"", target->t_name); + return (false); + } + } else { + target->t_auth_group = auth_group_new(conf, NULL); + if (target->t_auth_group == NULL) + return (false); + target->t_auth_group->ag_target = target; + } + return (auth_name_new(target->t_auth_group, name)); +} + +bool +target_add_initiator_portal(const char *addr) +{ + if (target->t_auth_group != NULL) { + if (target->t_auth_group->ag_name != NULL) { + log_warnx("cannot use both auth-group and " + "initiator-portal for target \"%s\"", + target->t_name); + return (false); + } + } else { + target->t_auth_group = auth_group_new(conf, NULL); + if (target->t_auth_group == NULL) + return (false); + target->t_auth_group->ag_target = target; + } + return (auth_portal_new(target->t_auth_group, addr)); +} + +bool +target_add_lun(u_int id, const char *name) +{ + struct lun *t_lun; + + if (id >= MAX_LUNS) { + log_warnx("LUN %u too big for target \"%s\"", id, + target->t_name); + return (false); + } + + if (target->t_luns[id] != NULL) { + log_warnx("duplicate LUN %u for target \"%s\"", id, + target->t_name); + return (false); + } + + t_lun = lun_find(conf, name); + if (t_lun == NULL) { + log_warnx("unknown LUN named %s used for target \"%s\"", + name, target->t_name); + return (false); + } + + target->t_luns[id] = t_lun; + return (true); +} + +bool +target_add_portal_group(const char *pg_name, const char *ag_name) +{ + struct portal_group *pg; + struct auth_group *ag; + struct port *p; + + pg = portal_group_find(conf, pg_name); + if (pg == NULL) { + log_warnx("unknown portal-group \"%s\" for target \"%s\"", + pg_name, target->t_name); + return (false); + } + + if (ag_name != NULL) { + ag = auth_group_find(conf, ag_name); + if (ag == NULL) { + log_warnx("unknown auth-group \"%s\" for target \"%s\"", + ag_name, target->t_name); + return (false); + } + } else + ag = NULL; + + p = port_new(conf, target, pg); + if (p == NULL) { + log_warnx("can't link portal-group \"%s\" to target \"%s\"", + pg_name, target->t_name); + return (false); + } + p->p_auth_group = ag; + return (true); +} + +bool +target_set_alias(const char *alias) +{ + if (target->t_alias != NULL) { + log_warnx("alias for target \"%s\" specified more than once", + target->t_name); + return (false); + } + target->t_alias = checked_strdup(alias); + return (true); +} + +bool +target_set_auth_group(const char *name) +{ + if (target->t_auth_group != NULL) { + if (target->t_auth_group->ag_name != NULL) + log_warnx("auth-group for target \"%s\" " + "specified more than once", target->t_name); + else + log_warnx("cannot use both auth-group and explicit " + "authorisations for target \"%s\"", target->t_name); + return (false); + } + target->t_auth_group = auth_group_find(conf, name); + if (target->t_auth_group == NULL) { + log_warnx("unknown auth-group \"%s\" for target \"%s\"", name, + target->t_name); + return (false); + } + return (true); +} + +bool +target_set_auth_type(const char *type) +{ + if (target->t_auth_group != NULL) { + if (target->t_auth_group->ag_name != NULL) { + log_warnx("cannot use both auth-group and " + "auth-type for target \"%s\"", target->t_name); + return (false); + } + } else { + target->t_auth_group = auth_group_new(conf, NULL); + if (target->t_auth_group == NULL) + return (false); + target->t_auth_group->ag_target = target; + } + return (_auth_group_set_type(target->t_auth_group, type)); +} + +bool +target_set_physical_port(const char *pport) +{ + if (target->t_pport != NULL) { + log_warnx("cannot set multiple physical ports for target " + "\"%s\"", target->t_name); + return (false); + } + target->t_pport = checked_strdup(pport); + return (true); +} + +bool +target_set_redirection(const char *addr) +{ + + if (target->t_redirection != NULL) { + log_warnx("cannot set redirection to \"%s\" for " + "target \"%s\"; already defined", + addr, target->t_name); + return (false); + } + + target->t_redirection = checked_strdup(addr); + + return (true); +} + +bool +target_start_lun(u_int id) +{ + struct lun *new_lun; + char *name; + + if (id >= MAX_LUNS) { + log_warnx("LUN %u too big for target \"%s\"", id, + target->t_name); + return (false); + } + + if (target->t_luns[id] != NULL) { + log_warnx("duplicate LUN %u for target \"%s\"", id, + target->t_name); + return (false); + } + + if (asprintf(&name, "%s,lun,%u", target->t_name, id) <= 0) + log_err(1, "asprintf"); + + new_lun = lun_new(conf, name); + if (new_lun == NULL) + return (false); + + lun_set_scsiname(new_lun, name); + free(name); + + target->t_luns[id] = new_lun; + + lun = new_lun; + return (true); +} diff --git a/usr.sbin/ctld/conf.h b/usr.sbin/ctld/conf.h new file mode 100644 index 000000000000..d8f036e67136 --- /dev/null +++ b/usr.sbin/ctld/conf.h @@ -0,0 +1,100 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2012 The FreeBSD Foundation + * + * This software was developed by Edward Tomasz Napierala 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. + */ + +#ifndef __CONF_H__ +#define __CONF_H__ + +/* + * This file defines the interface between parse.y and the rest of + * ctld. + */ + +bool auth_group_start(const char *name); +void auth_group_finish(void); +bool auth_group_add_chap(const char *user, const char *secret); +bool auth_group_add_chap_mutual(const char *user, const char *secret, + const char *user2, const char *secret2); +bool auth_group_add_initiator_name(const char *name); +bool auth_group_add_initiator_portal(const char *portal); +bool auth_group_set_type(const char *type); + +void conf_set_debug(int debug); +void conf_set_isns_period(int period); +void conf_set_isns_timeout(int timeout); +void conf_set_maxproc(int maxproc); +bool conf_set_pidfile_path(const char *path); +void conf_set_timeout(int timeout); + +bool isns_add_server(const char *addr); + +bool portal_group_start(const char *name); +void portal_group_finish(void); +bool portal_group_add_listen(const char *listen, bool iser); +bool portal_group_add_option(const char *name, const char *value); +bool portal_group_set_discovery_auth_group(const char *name); +bool portal_group_set_dscp(u_int dscp); +bool portal_group_set_filter(const char *filter); +void portal_group_set_foreign(void); +bool portal_group_set_offload(const char *offload); +bool portal_group_set_pcp(u_int pcp); +bool portal_group_set_redirection(const char *addr); +void portal_group_set_tag(uint16_t tag); + +bool target_start(const char *name); +void target_finish(void); +bool target_add_chap(const char *user, const char *secret); +bool target_add_chap_mutual(const char *user, const char *secret, + const char *user2, const char *secret2); +bool target_add_initiator_name(const char *name); +bool target_add_initiator_portal(const char *addr); +bool target_add_lun(u_int id, const char *name); +bool target_add_portal_group(const char *pg_name, const char *ag_name); +bool target_set_alias(const char *alias); +bool target_set_auth_group(const char *name); +bool target_set_auth_type(const char *type); +bool target_set_physical_port(const char *pport); +bool target_set_redirection(const char *addr); +bool target_start_lun(u_int id); + +bool lun_start(const char *name); +void lun_finish(void); +bool lun_add_option(const char *name, const char *value); +bool lun_set_backend(const char *value); +bool lun_set_blocksize(size_t value); +bool lun_set_ctl_lun(uint32_t value); +bool lun_set_device_id(const char *value); +bool lun_set_device_type(const char *value); +bool lun_set_path(const char *value); +bool lun_set_serial(const char *value); +bool lun_set_size(uint64_t value); + +bool parse_conf(const char *path); + +#endif /* !__CONF_H__ */ diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index a76db10999e1..21d833df5f83 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -49,7 +49,9 @@ #include #include #include +#include +#include "conf.h" #include "ctld.h" #include "isns.h" @@ -237,7 +239,7 @@ auth_check_secret_length(struct auth *auth) } } -const struct auth * +bool auth_new_chap(struct auth_group *ag, const char *user, const char *secret) { @@ -253,7 +255,7 @@ auth_new_chap(struct auth_group *ag, const char *user, log_warnx("cannot mix \"chap\" authentication with " "other types for target \"%s\"", ag->ag_target->t_name); - return (NULL); + return (false); } auth = auth_new(ag); @@ -262,10 +264,10 @@ auth_new_chap(struct auth_group *ag, const char *user, auth_check_secret_length(auth); - return (auth); + return (true); *** 2675 LINES SKIPPED *** From nobody Wed Feb 26 15:15:50 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2yj30C7bz5qHDw; Wed, 26 Feb 2025 15:15:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2yj25J5Fz3NnK; Wed, 26 Feb 2025 15:15:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740582950; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=To7qEX4jQ24pKwV+vFq9nOOndfARqetS/AErrlDDT4c=; b=xlDnfNz7hJg+JANnZsej63GF4SbBKGvqS45UZekAFgqSrc3hjfcDV4XB7D4/Zg6pNb+tfn y8X9gfqQai7IhjXvH4Lnk3hXA3nbjrn23qtyBMbYmV6He/ky+I4pWL0npXD8EfCHGQshbR IxagdE8It5nc62DaiRjUiSDZ614KODY2zUxd6b6SEsVrB007BouLImhnsQqJHpXQ2+mRq7 3YIyJfy2IxHZHgGTfcrhtjMoSQ9/1HOgeB9uWuqCZJTmtImKndxiR4XXcQx2Bzble60+YA 8naMVB3kWxqLS0ZoY8A1z7ALXTE3+rCUoOIDTwO36Lacx7+lRuvH1pzjhz7L7A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740582950; a=rsa-sha256; cv=none; b=RAXOScEt/RUvdIaly5sOc9uxvJp2R/WKzPWKlJsKAoGVEc2S4h+GNnsPEVRuNkzsjscuP4 3Nkj2/RC79n2d37cZO7P+x8yx5/u3lJx96ufPJMK8n3KxYUw1lMsvZa2BdVQVcbhVpAmOx ZMgqigSwa0Ah9iZj2gLnycvEyzxFHF8ZuBHI8cPc8Fzj9CkK1UiX11CRC6TC4cvpkP+uaU T6XbuYXuda78dnzMap77J07PfCf9TqhuHdjmMyatWAPFNraMalBkGZolL+cCWoMq2eEHYp VXJvPOsdT1ppIqNnDaIujOJd5t32jrka4OtW37ANjf5UB4HetfinQcZlBZZw6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740582950; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=To7qEX4jQ24pKwV+vFq9nOOndfARqetS/AErrlDDT4c=; b=KO2TX05sMW8d+uRJ3Q88eGF2AzDsa82bp5udEUVhZDeNLEfA6hNZU07Rk/d1voUEOThBKM bKiygdS4g1az5LBpYaRX6OqVW//0EyTrMZBbJGdJcBKpfKtEYEVx8Naxy4HS/j7JoeLZzj vR0miLYEA9JInxCxdXOHCY/mbBNdXwKY/JCdJMzUmPYCoMbH0cY3DVzL0cT+nzt6nJCBh4 zvQtTpIHBSKRx6vER1i09ubZFBfoTb/otxcJALo1zNDpOiOS8hlyC+iftI0h+xlnH+otnq f33L9COqojxIDqzbfSJfllcLHLY0x9mWZvLD/LYTSL7B4oxxheWKRSXJUQgTSw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2yj24Wbmz1Gw5; Wed, 26 Feb 2025 15:15:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QFFo6w033988; Wed, 26 Feb 2025 15:15:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QFFovv033985; Wed, 26 Feb 2025 15:15:50 GMT (envelope-from git) Date: Wed, 26 Feb 2025 15:15:50 GMT Message-Id: <202502261515.51QFFovv033985@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: e28b758b35d0 - main - ctld: Be more consistent for auth parameters in the UCL config List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e28b758b35d0f80b38c295587271ec9588040077 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e28b758b35d0f80b38c295587271ec9588040077 commit e28b758b35d0f80b38c295587271ec9588040077 Author: John Baldwin AuthorDate: 2025-02-26 15:11:30 +0000 Commit: John Baldwin CommitDate: 2025-02-26 15:11:30 +0000 ctld: Be more consistent for auth parameters in the UCL config The auth-group context required an array of entries for "chap", "chap-mutual", "initiator-name", and "initiator-portal" whereas the target context required exactly one entry (and only permitted a single entry). Allow either a single entry or an array of entries for these keywords in both the auth-group and target contexts. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D48935 --- usr.sbin/ctld/uclparse.c | 163 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 121 insertions(+), 42 deletions(-) diff --git a/usr.sbin/ctld/uclparse.c b/usr.sbin/ctld/uclparse.c index 2dc4872bee84..e8e026247b71 100644 --- a/usr.sbin/ctld/uclparse.c +++ b/usr.sbin/ctld/uclparse.c @@ -420,66 +420,90 @@ uclparse_auth_group(const char *name, const ucl_object_t *top) } if (strcmp(key, "chap") == 0) { - if (obj->type != UCL_ARRAY) { - log_warnx("\"chap\" property of " - "auth-group \"%s\" is not an array", + if (obj->type == UCL_OBJECT) { + if (!uclparse_chap(name, obj)) + goto fail; + } else if (obj->type == UCL_ARRAY) { + it2 = NULL; + while ((tmp = ucl_iterate_object(obj, &it2, + true))) { + if (!uclparse_chap(name, tmp)) + goto fail; + } + } else { + log_warnx("\"chap\" property of auth-group " + "\"%s\" is not an array or object", name); goto fail; } - - it2 = NULL; - while ((tmp = ucl_iterate_object(obj, &it2, true))) { - if (!uclparse_chap(name, tmp)) - goto fail; - } } if (strcmp(key, "chap-mutual") == 0) { - if (obj->type != UCL_ARRAY) { + if (obj->type == UCL_OBJECT) { + if (!uclparse_chap_mutual(name, obj)) + goto fail; + } else if (obj->type == UCL_ARRAY) { + it2 = NULL; + while ((tmp = ucl_iterate_object(obj, &it2, + true))) { + if (!uclparse_chap_mutual(name, tmp)) + goto fail; + } + } else { log_warnx("\"chap-mutual\" property of " - "auth-group \"%s\" is not an array", + "auth-group \"%s\" is not an array or object", name); goto fail; } - - it2 = NULL; - while ((tmp = ucl_iterate_object(obj, &it2, true))) { - if (!uclparse_chap_mutual(name, tmp)) - goto fail; - } } if (strcmp(key, "initiator-name") == 0) { - if (obj->type != UCL_ARRAY) { - log_warnx("\"initiator-name\" property of " - "auth-group \"%s\" is not an array", - name); - goto fail; - } - - it2 = NULL; - while ((tmp = ucl_iterate_object(obj, &it2, true))) { - const char *value = ucl_object_tostring(tmp); + if (obj->type == UCL_STRING) { + const char *value = ucl_object_tostring(obj); if (!auth_group_add_initiator_name(value)) goto fail; - } - } + } else if (obj->type == UCL_ARRAY) { + it2 = NULL; + while ((tmp = ucl_iterate_object(obj, &it2, + true))) { + const char *value = + ucl_object_tostring(tmp); - if (strcmp(key, "initiator-portal") == 0) { - if (obj->type != UCL_ARRAY) { - log_warnx("\"initiator-portal\" property of " - "auth-group \"%s\" is not an array", + if (!auth_group_add_initiator_name( + value)) + goto fail; + } + } else { + log_warnx("\"initiator-name\" property of " + "auth-group \"%s\" is not an array or string", name); goto fail; } + } - it2 = NULL; - while ((tmp = ucl_iterate_object(obj, &it2, true))) { - const char *value = ucl_object_tostring(tmp); + if (strcmp(key, "initiator-portal") == 0) { + if (obj->type == UCL_STRING) { + const char *value = ucl_object_tostring(obj); if (!auth_group_add_initiator_portal(value)) goto fail; + } else if (obj->type == UCL_ARRAY) { + it2 = NULL; + while ((tmp = ucl_iterate_object(obj, &it2, + true))) { + const char *value = + ucl_object_tostring(tmp); + + if (!auth_group_add_initiator_portal( + value)) + goto fail; + } + } else { + log_warnx("\"initiator-portal\" property of " + "auth-group \"%s\" is not an array or string", + name); + goto fail; } } } @@ -746,25 +770,80 @@ uclparse_target(const char *name, const ucl_object_t *top) } if (strcmp(key, "chap") == 0) { - if (!uclparse_target_chap(name, obj)) + if (obj->type == UCL_OBJECT) { + if (!uclparse_target_chap(name, obj)) + goto fail; + } else if (obj->type == UCL_ARRAY) { + while ((tmp = ucl_iterate_object(obj, &it2, + true))) { + if (!uclparse_target_chap(name, tmp)) + goto fail; + } + } else { + log_warnx("\"chap\" property of target " + "\"%s\" is not an array or object", + name); goto fail; + } } if (strcmp(key, "chap-mutual") == 0) { - if (!uclparse_target_chap_mutual(name, obj)) + if (obj->type == UCL_OBJECT) { + if (!uclparse_target_chap_mutual(name, obj)) + goto fail; + } else if (obj->type == UCL_ARRAY) { + while ((tmp = ucl_iterate_object(obj, &it2, + true))) { + if (!uclparse_target_chap_mutual(name, + tmp)) + goto fail; + } + } else { + log_warnx("\"chap-mutual\" property of target " + "\"%s\" is not an array or object", + name); goto fail; + } } if (strcmp(key, "initiator-name") == 0) { - if (!target_add_initiator_name( - ucl_object_tostring(obj))) + if (obj->type == UCL_STRING) { + if (!target_add_initiator_name( + ucl_object_tostring(obj))) + goto fail; + } else if (obj->type == UCL_ARRAY) { + while ((tmp = ucl_iterate_object(obj, &it2, + true))) { + if (!target_add_initiator_name( + ucl_object_tostring(tmp))) + goto fail; + } + } else { + log_warnx("\"initiator-name\" property of " + "target \"%s\" is not an array or string", + name); goto fail; + } } if (strcmp(key, "initiator-portal") == 0) { - if (!target_add_initiator_portal( - ucl_object_tostring(obj))) + if (obj->type == UCL_STRING) { + if (!target_add_initiator_portal( + ucl_object_tostring(obj))) + goto fail; + } else if (obj->type == UCL_ARRAY) { + while ((tmp = ucl_iterate_object(obj, &it2, + true))) { + if (!target_add_initiator_portal( + ucl_object_tostring(tmp))) + goto fail; + } + } else { + log_warnx("\"initiator-portal\" property of " + "target \"%s\" is not an array or string", + name); goto fail; + } } if (strcmp(key, "portal-group") == 0) { From nobody Wed Feb 26 15:15:51 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2yj43KDPz5qH1j; Wed, 26 Feb 2025 15:15: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2yj35tMPz3P5x; Wed, 26 Feb 2025 15:15:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740582951; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9TBSAzIsrNLtenckBILx1GaKsvMEehYpBtfsHuSBzPY=; b=rTJZ4bxWWgwzZx9uGt7qcajGA07Mdh4ld1Y9tPIeywQ4QRxr1guj0qlzF2ikXAVICb7ppb sm8TalPatTrgRUBB4LkTSP3AR7p961TtzsA14gF4iCBDbWKL0Xw3mP1IDxCQpNAdec6RAn 4qJ64Z+1b3f+1UB1kTTFG2jsopvm99vOPXgddR/VTbFO3Tr4N7LexCSxCh34zUVZSBDKiw 4aP+kgFMAQK/u0K+tyJB8RgqbIYYDJcLCN0abo+xhrj7agGEXhfV9RvfqIepFuAGj1dy7J Bsx/o8o+5kJ8K6de67073L3lIRdiHr4TXzYTxBh9e+H+LQEFIgY+jw+tYeGjBw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740582951; a=rsa-sha256; cv=none; b=YMQ0oqCtBpg/SGYe9OlVY3LAsdqUxYxYObkUwvteaKZkrVCVDrxfOH0COPC4kkF+1TfA/0 VzQnLHVBzaPlNErOmeAztH8vXwrvQXb8DzQh+NP21gaGZNoxEaeUikaFcD3a11u/bQL7Wr gWpayAoONp0pibsvwmDMyMh6hmALaHsVPjhGJHH6TdW0FtYAqfIaWLvxSQJNOu3C/smH+u ihapdvsZ/OkScLlpIlLdYTMD2wKch8Kq7dc4eiJTtOJy1atNLUp4bvOvo01C01p8HPH1uF QnQxFx4Og0JfBzhmJBbnWzHn7s32qMQowq4XdwMD6bwNmtmKTf3LDs+HtHB5aw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740582951; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9TBSAzIsrNLtenckBILx1GaKsvMEehYpBtfsHuSBzPY=; b=jV1GdBogtzUCr2d3oBAm5/zu73Ks1Ih7bJU/cAlmo+3dSaHsAwPZBtswuTB/U7FSxPwp/L E2HDa7Mmj/jO2+FrwyJv7vm5EHCTTfHfVfldqNxkmP2hKeFkkxN3109tbGd1q4LBsQb2qk 35qtl9H/x3fcGZWpaaIaJIUrWQu2RawM7Ew6Uo4xNrKMu3MUFhlajiJxTTJfkc4mlBOTfI U1Q7hT7rVqPUafORBryQ3KwjsbHoY7gHBNAVkg4oAOW40j9AJqPiB4wS/CV9HyOPzSRdnO XdMxeiRUM2JwBxZoXKWylt260cbG2ZdUbKZDBjIKyNciBqT+CuhHD0h9v16maw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2yj35Swnz1Gw6; Wed, 26 Feb 2025 15:15:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QFFphx034023; Wed, 26 Feb 2025 15:15:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QFFpZH034021; Wed, 26 Feb 2025 15:15:51 GMT (envelope-from git) Date: Wed, 26 Feb 2025 15:15:51 GMT Message-Id: <202502261515.51QFFpZH034021@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 67940b204f58 - main - ctld: Add missing properties to the UCL parser List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 67940b204f5829a72e7c47f92069fb06a7dad91f Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=67940b204f5829a72e7c47f92069fb06a7dad91f commit 67940b204f5829a72e7c47f92069fb06a7dad91f Author: John Baldwin AuthorDate: 2025-02-26 15:12:25 +0000 Commit: John Baldwin CommitDate: 2025-02-26 15:12:25 +0000 ctld: Add missing properties to the UCL parser - Support for "foreign", "offload", and "tag" properties in portal group contexts. - Support for "ctl-lun" and "device-type" properties in LUN contexts. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D48936 --- usr.sbin/ctld/uclparse.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/usr.sbin/ctld/uclparse.c b/usr.sbin/ctld/uclparse.c index e8e026247b71..7c786afb1e93 100644 --- a/usr.sbin/ctld/uclparse.c +++ b/usr.sbin/ctld/uclparse.c @@ -634,6 +634,10 @@ uclparse_portal_group(const char *name, const ucl_object_t *top) goto fail; } + if (strcmp(key, "foreign") == 0) { + portal_group_set_foreign(); + } + if (strcmp(key, "listen") == 0) { if (obj->type == UCL_STRING) { if (!portal_group_add_listen( @@ -676,6 +680,18 @@ uclparse_portal_group(const char *name, const ucl_object_t *top) } } + if (strcmp(key, "offload") == 0) { + if (obj->type != UCL_STRING) { + log_warnx("\"offload\" property of " + "portal-group \"%s\" is not a string", + name); + goto fail; + } + + if (!portal_group_set_offload(ucl_object_tostring(obj))) + goto fail; + } + if (strcmp(key, "redirect") == 0) { if (obj->type != UCL_STRING) { log_warnx("\"listen\" property of " @@ -705,6 +721,17 @@ uclparse_portal_group(const char *name, const ucl_object_t *top) } } + if (strcmp(key, "tag") == 0) { + if (obj->type != UCL_INT) { + log_warnx("\"tag\" property of portal group " + "\"%s\" is not an integer", + name); + goto fail; + } + + portal_group_set_tag(ucl_object_toint(obj)); + } + if (strcmp(key, "dscp") == 0) { if (!uclparse_dscp("portal", name, obj)) goto fail; @@ -946,6 +973,28 @@ uclparse_lun(const char *name, const ucl_object_t *top) goto fail; } + if (strcmp(key, "device-type") == 0) { + if (obj->type != UCL_STRING) { + log_warnx("\"device-type\" property of lun " + "\"%s\" is not an integer", name); + goto fail; + } + + if (!lun_set_device_type(ucl_object_tostring(obj))) + goto fail; + } + + if (strcmp(key, "ctl-lun") == 0) { + if (obj->type != UCL_INT) { + log_warnx("\"ctl-lun\" property of lun " + "\"%s\" is not an integer", name); + goto fail; + } + + if (!lun_set_ctl_lun(ucl_object_toint(obj))) + goto fail; + } + if (strcmp(key, "options") == 0) { if (obj->type != UCL_OBJECT) { log_warnx("\"options\" property of lun " From nobody Wed Feb 26 15:15:52 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2yj52gcCz5qHF2; Wed, 26 Feb 2025 15:15: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2yj46qXWz3Nsd; Wed, 26 Feb 2025 15:15:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740582953; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bfSaRDkpSTjtImzQCtnq2vkAPUXzvcohG1XOiZxNCpc=; b=acIyLnIY0aumFGJLIR6rNBzFHGSlVPp5bfg3s+JmgViRwkJ8/8z77wkvVjE4ouI9sW+sKJ xx8O7YlETS5ckhVK0+n43hHT/vhEee91bS1ayW+tlTaDFJLTn0QAHrhE1pNwBeo2bwEEWY FOFUHXjw3NHFORyY+Ij0X96+9E28pz2Z0/AgOPFuKiwlWTFI2BWBB7XX+nk4bLpIQNk368 NDMJTWVMLO5OQjw6CzxQeY6Burz5PbReMRccFUxFgx8vQXSVzv+zfRD57WClgl3fO9Q3cg WDvHgIE1YiP6TozkM9Dc6I61l4WeXk05jDTjyVEE+Ogf51xihc/S6dQOueW6nA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740582953; a=rsa-sha256; cv=none; b=f42Kkp0UJG6ipGEXp339CUlP04/W7G/FsL3klKZlyCK0diyQkAGHJIkhnYX12UzpPJCfe8 jtAGor3FwTGAJQOkN1grANCBSuACLIEfP6GKV7dmPqok7j6EIv+5z3/dqhbRhQ4bETo/Na asf5enp8aCtzjy2H69521Ukx0aM9uOpicI/TSYDoeWOPpF0ly1UVmv9LbYfEfK8eUA3Ugw LOtNhrEIajhztvLowMmU+1nnjulrcstbM5J8Debyc1xWowyPmeEqjxkodmFc2t7aKHaj/y CyBVz9f5ZfBKunghgS9gViZ5Z8WGwKV6QLnijbChuzcqYkuaF3vf17GyCHTI0g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740582953; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bfSaRDkpSTjtImzQCtnq2vkAPUXzvcohG1XOiZxNCpc=; b=FTbIf73R3OszmrJS0QC/8hW6AvwUBn2Im+N21UHHut7WMIw6Ouj8BQwoC5LGaoV09hKWG1 i4eHWSXE4CGJfpgEUkPQLbSWf4PONMBvyBsflMpaI6Zpjv2s5IdTaZ+D/JlwDHsaT/D684 buor0C64pnEemfYUDNS/ZqeEOYnp8lzwVv0dovfa56aOyTUmp1SVkIsrqn/2jKRJIul5X/ b5JPgVc/6mURi/dfi7iA1PaIOSwG9kOgUyGimiCZSXJZhSXErcinAG9D0R/QquegCTXMhl R48suIFmbvkpjrt5Y/gbg+qyD2tDk1gJeRfCYVN6nrXmQf9HCvDAk6/FB5bWDw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2yj46RFXz1HDB; Wed, 26 Feb 2025 15:15:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QFFq8c034058; Wed, 26 Feb 2025 15:15:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QFFq8D034055; Wed, 26 Feb 2025 15:15:52 GMT (envelope-from git) Date: Wed, 26 Feb 2025 15:15:52 GMT Message-Id: <202502261515.51QFFq8D034055@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: b797cc839a12 - main - ctld: Support anonymous LUN entries in UCL List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b797cc839a12fc358e99635ca3adf3cf80e0825b Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b797cc839a12fc358e99635ca3adf3cf80e0825b commit b797cc839a12fc358e99635ca3adf3cf80e0825b Author: John Baldwin AuthorDate: 2025-02-26 15:13:10 +0000 Commit: John Baldwin CommitDate: 2025-02-26 15:13:48 +0000 ctld: Support anonymous LUN entries in UCL If a target LUN entry doesn't have a name property, assume it is an anonymous LUN and parse other properties from the entry to define the LUN. This removes the odd support for target LUNs only named by an integer. My guess is this was meant to implement support for anonymous LUNs based on how the syntax for this works in the non-UCL case, but the prior implementation was useless (it just created unconfigured LUNs). Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D48937 --- usr.sbin/ctld/ctl.conf.5 | 30 +++++++------- usr.sbin/ctld/uclparse.c | 106 ++++++++++++++++++++++++++++------------------- 2 files changed, 77 insertions(+), 59 deletions(-) diff --git a/usr.sbin/ctld/ctl.conf.5 b/usr.sbin/ctld/ctl.conf.5 index 0be873fe512c..015fc1e12e36 100644 --- a/usr.sbin/ctld/ctl.conf.5 +++ b/usr.sbin/ctld/ctl.conf.5 @@ -26,7 +26,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 13, 2020 +.Dd February 26, 2025 .Dt CTL.CONF 5 .Os .Sh NAME @@ -543,25 +543,12 @@ portal-group { } lun { - example_0 { - path = /dev/zvol/tank/example_0 - blocksize = 4096 - size = 4GB - } - example_1 { path = /dev/zvol/tank/example_1 options { naa = "0x50015178f369f093" } } - - example_2 { - path = /dev/zvol/tank/example_2 - options { - vendor = "FreeBSD" - } - } } target { @@ -569,7 +556,12 @@ target { alias = "Example target" auth-group = no-authentication lun = [ - { number = 0, name = example_0 }, + { + number = 0 + path = /dev/zvol/tank/example_0 + blocksize = 4096 + size = 4GB + } ] } @@ -578,7 +570,13 @@ target { portal-group { name = pg0 } lun = [ { number = 0, name = example_1 }, - { number = 1, name = example_2 } + { + number = 1 + path = /dev/zvol/tank/example_2 + options { + vendor = "FreeBSD" + } + } ] } diff --git a/usr.sbin/ctld/uclparse.c b/usr.sbin/ctld/uclparse.c index 7c786afb1e93..b9d88a1d45d2 100644 --- a/usr.sbin/ctld/uclparse.c +++ b/usr.sbin/ctld/uclparse.c @@ -48,6 +48,7 @@ static bool uclparse_toplevel(const ucl_object_t *); static bool uclparse_chap(const char *, const ucl_object_t *); static bool uclparse_chap_mutual(const char *, const ucl_object_t *); static bool uclparse_lun(const char *, const ucl_object_t *); +static bool uclparse_lun_entries(const char *, const ucl_object_t *); static bool uclparse_auth_group(const char *, const ucl_object_t *); static bool uclparse_portal_group(const char *, const ucl_object_t *); static bool uclparse_target(const char *, const ucl_object_t *); @@ -216,35 +217,44 @@ uclparse_target_portal_group(const char *t_name, const ucl_object_t *obj) static bool uclparse_target_lun(const char *t_name, const ucl_object_t *obj) { - if (obj->type == UCL_INT) { - if (!target_start_lun(ucl_object_toint(obj))) - return (false); - lun_finish(); - return (true); + const ucl_object_t *num; + const ucl_object_t *name; + char *lun_name; + u_int id; + bool ok; + + if (obj->type != UCL_OBJECT) { + log_warnx("lun section entries in target \"%s\" must be objects", + t_name); + return (false); } - if (obj->type == UCL_OBJECT) { - const ucl_object_t *num = ucl_object_find_key(obj, "number"); - const ucl_object_t *name = ucl_object_find_key(obj, "name"); + num = ucl_object_find_key(obj, "number"); + if (num == NULL || num->type != UCL_INT) { + log_warnx("lun section in target \"%s\" is missing " + "\"number\" integer property", t_name); + return (false); + } + id = ucl_object_toint(num); - if (num == NULL || num->type != UCL_INT) { - log_warnx("lun section in target \"%s\" is missing " - "\"number\" integer property", t_name); + name = ucl_object_find_key(obj, "name"); + if (name == NULL) { + if (!target_start_lun(id)) return (false); - } - if (name == NULL || name->type != UCL_STRING) { - log_warnx("lun section in target \"%s\" is missing " - "\"name\" string property", t_name); - return (false); - } + asprintf(&lun_name, "lun %u for target \"%s\"", id, t_name); + ok = uclparse_lun_entries(lun_name, obj); + free(lun_name); + return (ok); + } - if (!target_add_lun(ucl_object_toint(num), - ucl_object_tostring(name))) - return (false); + if (name->type != UCL_STRING) { + log_warnx("\"name\" property for lun %u for target " + "\"%s\" is not a string", id, t_name); + return (false); } - return (true); + return (target_add_lun(id, ucl_object_tostring(name))); } static bool @@ -929,21 +939,31 @@ fail: static bool uclparse_lun(const char *name, const ucl_object_t *top) { - ucl_object_iter_t it = NULL, child_it = NULL; - const ucl_object_t *obj = NULL, *child = NULL; - const char *key; + char *lun_name; + bool ok; if (!lun_start(name)) return (false); + asprintf(&lun_name, "lun \"%s\"", name); + ok = uclparse_lun_entries(lun_name, top); + free(lun_name); + return (ok); +} + +static bool +uclparse_lun_entries(const char *name, const ucl_object_t *top) +{ + ucl_object_iter_t it = NULL, child_it = NULL; + const ucl_object_t *obj = NULL, *child = NULL; + const char *key; while ((obj = ucl_iterate_object(top, &it, true))) { key = ucl_object_key(obj); if (strcmp(key, "backend") == 0) { if (obj->type != UCL_STRING) { - log_warnx("\"backend\" property of lun " - "\"%s\" is not a string", - name); + log_warnx("\"backend\" property of %s " + "is not a string", name); goto fail; } @@ -953,8 +973,8 @@ uclparse_lun(const char *name, const ucl_object_t *top) if (strcmp(key, "blocksize") == 0) { if (obj->type != UCL_INT) { - log_warnx("\"blocksize\" property of lun " - "\"%s\" is not an integer", name); + log_warnx("\"blocksize\" property of %s " + "is not an integer", name); goto fail; } @@ -964,8 +984,8 @@ uclparse_lun(const char *name, const ucl_object_t *top) if (strcmp(key, "device-id") == 0) { if (obj->type != UCL_STRING) { - log_warnx("\"device-id\" property of lun " - "\"%s\" is not an integer", name); + log_warnx("\"device-id\" property of %s " + "is not an integer", name); goto fail; } @@ -975,8 +995,8 @@ uclparse_lun(const char *name, const ucl_object_t *top) if (strcmp(key, "device-type") == 0) { if (obj->type != UCL_STRING) { - log_warnx("\"device-type\" property of lun " - "\"%s\" is not an integer", name); + log_warnx("\"device-type\" property of %s " + "is not an integer", name); goto fail; } @@ -986,8 +1006,8 @@ uclparse_lun(const char *name, const ucl_object_t *top) if (strcmp(key, "ctl-lun") == 0) { if (obj->type != UCL_INT) { - log_warnx("\"ctl-lun\" property of lun " - "\"%s\" is not an integer", name); + log_warnx("\"ctl-lun\" property of %s " + "is not an integer", name); goto fail; } @@ -997,8 +1017,8 @@ uclparse_lun(const char *name, const ucl_object_t *top) if (strcmp(key, "options") == 0) { if (obj->type != UCL_OBJECT) { - log_warnx("\"options\" property of lun " - "\"%s\" is not an object", name); + log_warnx("\"options\" property of %s " + "is not an object", name); goto fail; } @@ -1012,8 +1032,8 @@ uclparse_lun(const char *name, const ucl_object_t *top) if (strcmp(key, "path") == 0) { if (obj->type != UCL_STRING) { - log_warnx("\"path\" property of lun " - "\"%s\" is not a string", name); + log_warnx("\"path\" property of %s " + "is not a string", name); goto fail; } @@ -1023,8 +1043,8 @@ uclparse_lun(const char *name, const ucl_object_t *top) if (strcmp(key, "serial") == 0) { if (obj->type != UCL_STRING) { - log_warnx("\"serial\" property of lun " - "\"%s\" is not a string", name); + log_warnx("\"serial\" property of %s " + "is not a string", name); goto fail; } @@ -1034,8 +1054,8 @@ uclparse_lun(const char *name, const ucl_object_t *top) if (strcmp(key, "size") == 0) { if (obj->type != UCL_INT) { - log_warnx("\"size\" property of lun " - "\"%s\" is not an integer", name); + log_warnx("\"size\" property of %s " + "is not an integer", name); goto fail; } From nobody Wed Feb 26 15:15:55 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2yj7756Hz5qHBn; Wed, 26 Feb 2025 15:15: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2yj71tdJz3Nsq; Wed, 26 Feb 2025 15:15:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740582955; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YjWYkAD3tBKLjsqm00PAGtOep9drW7pB2yJ+o3/KO+Y=; b=pDojmtQFY6UC1fjegVt/Sw9yhKXPGcnoNhwQI7uS9fD5h9XUHsRdTPikgt71EFgG9OGqHP xSKxYP4t+TJUW55me790tPwGw1hTqccnAIlBOS5FsCWRYImm15v8AyR4JE6DEd4YfXnAq6 1TJGSLQ7ERzjPNkUG2PAM7t52hJGA1tOGCAtaCVwchPjBdcQW5EuLMStOxSCulF1ypHT4h YXkmUD7ZlHRQPsXiYIs9JR38hupRD1zw5nIHO8rv2dwIFRcVxSiXSOTwobtuRspAMPVIe1 +UQry1ptJbTdLp84CxAWXaJeDaUHWseuNfGTijvzgRkPyB12YFWWAAXzALpPOA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740582955; a=rsa-sha256; cv=none; b=sPOltpKoEhJZtcSLah1bCEOHu0Pm3XHPFpYBCj7dFM7MUfaDEfs65kYZ1Rajg8Iddk1n06 rhrmrfQ4W7y86CZcu4zy9YKau3Hwg+rfjbv/rLpONUJlDZKMBX+BQ7xriEKJtnmO1bXm0F LWNc6dW4uo09nKt/MP8XAVdI7us/MbBG/OGFfBouAxifTzQ6XZowVfahghJDQEXObPLzTn kmYUS32a34vDkcbAVsOZvAbDkRRLozoFh1XDh+6znFLSMR8ui3zgI+g87ddWUFAZxohHiS /9oFgoHHubGi/7FCrK2q9Wfa13kEH6WTQNldxC4KyvFSHTqeLF24T5XoMkFSuw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740582955; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YjWYkAD3tBKLjsqm00PAGtOep9drW7pB2yJ+o3/KO+Y=; b=XC66v1Hh1tSmGBWwyJog+TlHVj3wJVmW5neP+Pfg4fBYwnk0idk+xtU7jj21M4lcxHN6qQ GJUS+gjgQum8RgdWCZhNZCoiBKWO2hUiGgsAZ2jbXNRQzJ7U25o1/wyl+cpF+46V21sqaE 60iG4SumtqCMXNWAg6Hpl6qkWsqt+iJ4VIMetS2iQdfb6q/B7SmDHFh5A5hHH2t9zA7u+q fAugOT2dWiNnBRKygqeHSxHbpVbEGe5zjDVe3oevFQDMEHHBLastg2uO3Jp44NepNrmNAQ 5eKVwNm7luTm21mJHF3KrPOlRIAW63Sz0Sc5DYfq93C7mkoyG5PIaDViRDmjgw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2yj71Cdyz1HDC; Wed, 26 Feb 2025 15:15:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QFFtxJ034127; Wed, 26 Feb 2025 15:15:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QFFtxA034124; Wed, 26 Feb 2025 15:15:55 GMT (envelope-from git) Date: Wed, 26 Feb 2025 15:15:55 GMT Message-Id: <202502261515.51QFFtxA034124@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 5b511473999a - main - ctld: Permit simpler syntax for target LUNs in UCL List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5b511473999a1d0145635fcc9d922601f34b670b Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5b511473999a1d0145635fcc9d922601f34b670b commit 5b511473999a1d0145635fcc9d922601f34b670b Author: John Baldwin AuthorDate: 2025-02-26 15:14:53 +0000 Commit: John Baldwin CommitDate: 2025-02-26 15:14:53 +0000 ctld: Permit simpler syntax for target LUNs in UCL Allow the LUN number to be specified as the key for a LUN instead of requiring it as a "number" field. If a key is used, permit a simple string value to be used for non-anymous LUNs. This permits replacing: lun = [ { number = 0, name = zvol_lun }, { number = 1 backend = ramdisk size = 1GB } ] with: lun = { 0 = zvol_lun 1 { backend = ramdisk size = 1GB } } Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D48939 --- usr.sbin/ctld/ctl.conf.5 | 22 ++++++++++------------ usr.sbin/ctld/uclparse.c | 30 +++++++++++++++++++++++------- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/usr.sbin/ctld/ctl.conf.5 b/usr.sbin/ctld/ctl.conf.5 index 8cc7c85b6f95..e42dd8067006 100644 --- a/usr.sbin/ctld/ctl.conf.5 +++ b/usr.sbin/ctld/ctl.conf.5 @@ -555,36 +555,34 @@ target { "iqn.2012-06.com.example:target0" { alias = "Example target" auth-group = no-authentication - lun = [ - { - number = 0 + lun = { + 0 { path = /dev/zvol/tank/example_0 blocksize = 4096 size = 4GB } - ] + } } "iqn.2012-06.com.example:target1" { auth-group = ag0 portal-group = pg0 - lun = [ - { number = 0, name = example_1 }, - { - number = 1 + lun { + 0 = example_1 + 1 { path = /dev/zvol/tank/example_2 options { vendor = "FreeBSD" } } - ] + } } naa.50015178f369f092 { port = isp0 - lun = [ - { number = 0, name = example_1 } - ] + lun { + 0 = example_1 + } } } .Ed diff --git a/usr.sbin/ctld/uclparse.c b/usr.sbin/ctld/uclparse.c index ab41e328cd90..05cfcc8df7e7 100644 --- a/usr.sbin/ctld/uclparse.c +++ b/usr.sbin/ctld/uclparse.c @@ -233,23 +233,39 @@ uclparse_target_lun(const char *t_name, const ucl_object_t *obj) { const ucl_object_t *num; const ucl_object_t *name; - char *lun_name; + const char *key; + char *end, *lun_name; u_int id; bool ok; + key = ucl_object_key(obj); + if (key != NULL) { + id = strtoul(key, &end, 0); + if (*end != '\0') { + log_warnx("lun key \"%s\" in target \"%s\" is invalid", + key, t_name); + return (false); + } + + if (obj->type == UCL_STRING) + return (target_add_lun(id, ucl_object_tostring(obj))); + } + if (obj->type != UCL_OBJECT) { log_warnx("lun section entries in target \"%s\" must be objects", t_name); return (false); } - num = ucl_object_find_key(obj, "number"); - if (num == NULL || num->type != UCL_INT) { - log_warnx("lun section in target \"%s\" is missing " - "\"number\" integer property", t_name); - return (false); + if (key == NULL) { + num = ucl_object_find_key(obj, "number"); + if (num == NULL || num->type != UCL_INT) { + log_warnx("lun section in target \"%s\" is missing " + "\"number\" integer property", t_name); + return (false); + } + id = ucl_object_toint(num); } - id = ucl_object_toint(num); name = ucl_object_find_key(obj, "name"); if (name == NULL) { From nobody Wed Feb 26 15:15:53 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2yj63t1lz5qH8j; Wed, 26 Feb 2025 15:15: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2yj60fC1z3P3g; Wed, 26 Feb 2025 15:15:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740582954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Hm6xWeC4DxGdUQQsWSqK4WcNywaCiM7oq9ECXcHCERk=; b=uKrtCdQSqbPaTPonWHe4PhUZgQqLfwyRMxUR1WxhzMjT1odsn7NQkYKcJmgBJORR7TRo74 Ymd1dYxrFSn53w2NHMViHV7h61SxRCYkVTBeNHbsxYkU/N2dz67yeT5Jw+zpJ/embnnfw8 Un4+jbbaeMk/4RkwdOw8TcFHxIXoZQCr8x/mKuJrxObPJgkdEnI5jXRxDD++HMrgPjai+u 6lbl2jzwT+3XFmtQwXBqJ0r/pJZvupFq57FMLq84rEB5+5sZKwcdo/jI9fiB6LDz34VFSQ VK3tB4y+ilr6o3IebIoHU1H0Mz1ShohRc9n+g0PRRgiBiWmWJ7b37aMgL5r3GQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740582954; a=rsa-sha256; cv=none; b=LIlHJ+WqzQec82CE1F7l9hJrvjJStjeypopGht24p9iAYE60+t1AUwp0lkmA3QFerAbp9v JLUjGy3vZQEzbGxMkYUgIgnQaOTSZUvZMGH9EJH/Yo1B2wmhpgVQZM17RgR3coy+SBl+S5 VTQslwC9foBlQ350JbggWkIL9htiRHKYT5DiqP2bzD3xzufiQ1LcaN4MvD6p1piTCpaTK+ gCpXbgoKZlILzAbqWpaI4df96NOgL74eEEWP1NEYhcmhiB624U4zyFkAhfbPA5SRHYZ+dp Ilcm1bvDkrRyJHvr8giCdmIs4AiNHropMeCQ3yE6vOdos5yde0pDK/DSkimvDw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740582954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Hm6xWeC4DxGdUQQsWSqK4WcNywaCiM7oq9ECXcHCERk=; b=p4S1TRyxjPrlaG2wi6kDecB5PUmNdLdN24SK+POXy8SgpIWATU2OaD9c5yhYhthEx+2wgQ pOVB9IBRKCGPDgyWJKFy/QH97YKwQUx4Nen4scehC700vwzYL11WJ3Vh2/RQ1SaTOjIlps r6MANMmzuK66Fu/gvpRoIoIu8IHgyJQw0h3J5z5hp0gVGSObewas7rDGKgC2KZIZHaQxbD /tkr+50WZXXmAQ63rxTNkVrHQPTIcBzW+OGyQm+3Boo+LdF1V4zmzsSAgcd7oClUvHt8kQ ih5Ja6Im+k1MQz0o37kdJAy2/3RHIIHcmEMMqMco3M8O1S9Gs4inMixKewqdXw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2yj60FZKz1HCr; Wed, 26 Feb 2025 15:15:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QFFrw3034093; Wed, 26 Feb 2025 15:15:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QFFrba034090; Wed, 26 Feb 2025 15:15:53 GMT (envelope-from git) Date: Wed, 26 Feb 2025 15:15:53 GMT Message-Id: <202502261515.51QFFrba034090@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: e49db000c493 - main - ctld: Permit targets to use a string for portal-groups in UCL List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e49db000c4932753fb309ad895c02e98723023f3 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e49db000c4932753fb309ad895c02e98723023f3 commit e49db000c4932753fb309ad895c02e98723023f3 Author: John Baldwin AuthorDate: 2025-02-26 15:13:56 +0000 Commit: John Baldwin CommitDate: 2025-02-26 15:13:56 +0000 ctld: Permit targets to use a string for portal-groups in UCL In the case that a separate auth-group is not required, this permits replacing: portal-group = { name = pg0 } with: portal-group = pg0 Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D48938 --- usr.sbin/ctld/ctl.conf.5 | 2 +- usr.sbin/ctld/uclparse.c | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/usr.sbin/ctld/ctl.conf.5 b/usr.sbin/ctld/ctl.conf.5 index 015fc1e12e36..8cc7c85b6f95 100644 --- a/usr.sbin/ctld/ctl.conf.5 +++ b/usr.sbin/ctld/ctl.conf.5 @@ -567,7 +567,7 @@ target { "iqn.2012-06.com.example:target1" { auth-group = ag0 - portal-group { name = pg0 } + portal-group = pg0 lun = [ { number = 0, name = example_1 }, { diff --git a/usr.sbin/ctld/uclparse.c b/usr.sbin/ctld/uclparse.c index b9d88a1d45d2..ab41e328cd90 100644 --- a/usr.sbin/ctld/uclparse.c +++ b/usr.sbin/ctld/uclparse.c @@ -191,6 +191,20 @@ uclparse_target_portal_group(const char *t_name, const ucl_object_t *obj) const ucl_object_t *portal_group, *auth_group; const char *ag_name; + /* + * If the value is a single string, assume it is a + * portal-group name. + */ + if (obj->type == UCL_STRING) + return (target_add_portal_group(ucl_object_tostring(obj), + NULL)); + + if (obj->type != UCL_OBJECT) { + log_warnx("portal-group section in target \"%s\" must be " + "an object or string", t_name); + return (false); + } + portal_group = ucl_object_find_key(obj, "name"); if (!portal_group || portal_group->type != UCL_STRING) { log_warnx("portal-group section in target \"%s\" is missing " @@ -884,11 +898,6 @@ uclparse_target(const char *name, const ucl_object_t *top) } if (strcmp(key, "portal-group") == 0) { - if (obj->type == UCL_OBJECT) { - if (!uclparse_target_portal_group(name, obj)) - goto fail; - } - if (obj->type == UCL_ARRAY) { while ((tmp = ucl_iterate_object(obj, &it2, true))) { @@ -896,6 +905,9 @@ uclparse_target(const char *name, const ucl_object_t *top) tmp)) goto fail; } + } else { + if (!uclparse_target_portal_group(name, obj)) + goto fail; } } From nobody Wed Feb 26 15:58:52 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z2zfj0WgLz5qLTR; Wed, 26 Feb 2025 15:58: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z2zfh4ckjz3l5g; Wed, 26 Feb 2025 15:58:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740585532; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jyCoXrdOnhAnUkB2Dlloz/VF5qJjweVGFOYAC8J08+0=; b=gNh5swF38dZ0ze9n5Ai6dkCLKAn6zNyOSn7hFPGoyJ6jnksP/8+678/3X0KW2IVUKzcvAv PRyPGojI1gGMAYA8z7Lgk0nChCbBG0dz+30TkTYHrbk0fQiEO+bisx0TiFwD5Ee5ZXkYSc sB3nlFAOf8kaqH1OL7LFBEiVFekYUNJDDA7LB0Gq9H6odkdg2Ps1UJNbsIvZb9UDkeTNtX 7Of4kpg9liHHRfPGNCG8x5UKphFuJLIlGR9uylorrwF31c3swheeJdwprJ32RNKF3XVIqT T9UnngSKiJM+lH8hFMJjUu/i1j7EvEVhuriraOmBm46u870ahVdxJzvailrZ3Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740585532; a=rsa-sha256; cv=none; b=BuIhqveeU2txw6pcHakPwjHZkD5/A7xqBK6NlodtnM0n2841fM38d1E3wdUoFqK1tFXrVm 5oILu03CDUfaOVj/OhgI8ZSVF7eaabJCu1XqpySTHy2qKqDMjdVP/HO1vLB1EwsiQKC5dq rV4PlNvTzKzVwDDSzA9uTiQxBxEkFf8fcR5w2kwcFvVRbvjqFFdaRIYJu68NNG5pgTtW0x SikdJ5Itd0eRMrarXPXk0ILAtz+pyvYeZZoc/V8CSnN2b9zmokn2Tc5OLKMKL3kGpmaPPA p5cyujfXIlEVCbRA2lZadrZly3yyPa7FVfkEVIJU4M1pB6uT+PdsCmSSWzq2rw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740585532; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jyCoXrdOnhAnUkB2Dlloz/VF5qJjweVGFOYAC8J08+0=; b=xamRW/7GQUpgbFxU2ER0o8Z6+x/gSq3sKKMYElr4s3YCuKCcd7dtGgUGKSe/el3rvfKvLF r4+OxKp9W2EIByVoltaXbFsK1Z2kbsWyiI0frKScCvu+cSCUeZJ3GSsBDCtfW3Ysl9VuiH 6Im7S7rf0J8uYWtLIDlRpaV3WyOb1thzKajn1FHCrXGEDBEtptAUN4p1FSVUOQj7VibFAI QWCKNAN0D1T7/F97BVQw+iVPAwI0MoTWA7nz3xgnmZwH9rslV3/1rrGRO472YrU/1/Tfd8 dpMmv02zrkELWDbZ9RSkK60AeWM5dYUjuj4EalFEbUT4LnfnSSfmVsfOG1c02A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z2zfh3LMlz1J1p; Wed, 26 Feb 2025 15:58:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QFwqhM009286; Wed, 26 Feb 2025 15:58:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QFwq77009283; Wed, 26 Feb 2025 15:58:52 GMT (envelope-from git) Date: Wed, 26 Feb 2025 15:58:52 GMT Message-Id: <202502261558.51QFwq77009283@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: a6b74183b63d - main - pf: list dependecy on crypto.ko List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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: a6b74183b63ddd5428c68daf7c66d4bb49e3a469 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a6b74183b63ddd5428c68daf7c66d4bb49e3a469 commit a6b74183b63ddd5428c68daf7c66d4bb49e3a469 Author: Kristof Provost AuthorDate: 2025-02-26 09:52:44 +0000 Commit: Kristof Provost CommitDate: 2025-02-26 14:58:29 +0000 pf: list dependecy on crypto.ko Since 9d5c83a0b84c pf depends on the crypto module (for SHA512_*). Explicitly list this dependency. PR: 285019 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_ioctl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index c8447b4e64b8..e622186f671f 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -6933,4 +6933,5 @@ static moduledata_t pf_mod = { DECLARE_MODULE(pf, pf_mod, SI_SUB_PROTO_FIREWALL, SI_ORDER_SECOND); MODULE_DEPEND(pf, netlink, 1, 1, 1); +MODULE_DEPEND(pf, crypto, 1, 1, 1); MODULE_VERSION(pf, PF_MODVER); From nobody Wed Feb 26 16:35:21 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z30Sq2znWz52dtv; Wed, 26 Feb 2025 16:35:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z30Sq2SLcz438m; Wed, 26 Feb 2025 16:35:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740587723; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vYzoCfbr21bbJJfnCILrH4U5UGGDWGltDGaUEAtTA3g=; b=OIt6Es94cvD+sAaOLqBhpsLiQXavIOhlMr4mZ+FURow7wsV+jKWb3xYUfVnKh8hU6kEI/O 8WXVAAdiXsxK3MVsZs6PTBU5jseeysoPx+8j6cerj+6uf6GWSgPkyDXu36T7mEcraZugeb sW6hOns0ob+NzTaiPyUNyyGOnZcpAJJQa72xz+pFYcf5kfZfRWGhRTDw0zpsp5jZsOz6qV yXCujUD0MI9+0xjULL9GcXDAWYXqmIL1T5NL7kW60PD1u7BowSayhVH8WAeoPCRJllZobU nzTTmE0QO7bsFJhNM8UxF4Iamzz0GX/GVxykn3N/s8uStMYuYfM7svWWP57ISA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740587723; a=rsa-sha256; cv=none; b=QCRpULLVQSn+18MVWOBrODe9Nt3vx8o4nda3FfEDwBdiXVyW7lMhU8jyRBb7l+zy5T8cns /W8ODSzcZZQLkkp6An8Zy6iQuBCSQtfgAKHH3tFEO+RzvIfdKttvok4qzRUQG56lklVoqO q4WtqnmiV/FihMJ9wKDnlNWXJYFArgJos02K87XyNRma7S743FP+zpjWDthkgBrM7lb/0E OZp3uSkNq5i6mzFh96rPrwz/d+zMvIBrvn7djXSrfN4L0WVwJX8RwGywoOXLyIGmT+cW4u SkEBKSuC7hR5dMX7b++8LhvuNSZf5lb04n3nr/c/xl+/4kMWBfz3na3ZzVVr6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740587723; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vYzoCfbr21bbJJfnCILrH4U5UGGDWGltDGaUEAtTA3g=; b=Q6xD2BndNuMshMJ437M4/O5i13WMzg3Vrb22yipiB92qGne11wychak0rxOw58tKeMTl5X DgtHU6rGrwvrGgU4/OpIgd/amT2pqn7+gVOiTCg9ol1qjXVMTu2qmhk2Ie787e6rvRrmFs 9cCvBgs7ofBx4UoEgE/3LyIeV5H0axpW6vzqBNIyPhkv8mgd7KdU6E+fWlCRuZhY60Zvcd YTERG8lNMvM4QCkDbAClM/zRb+xBYdGTEco8fe06Ajm+tNJNHwwFEzvxHxDG1InYpeDU// mbYiDi0qliUjK9qqxfVOflQ8typW+A6V6EDmJG28nP2aBH/q4uPW9W5UYRD+Gw== Received: from [IPV6:2601:5c0:4200:b830:a15f:d124:4862:d27d] (unknown [IPv6:2601:5c0:4200:b830:a15f:d124:4862:d27d]) (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 did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Z30Sq00KRzxV0; Wed, 26 Feb 2025 16:35:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Wed, 26 Feb 2025 11:35:21 -0500 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: 0e58542fd246 - main - tcp: remove unused field from struct tcpcb Content-Language: en-US To: "Bjoern A. Zeeb" , Michael Tuexen Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202502252048.51PKm4YX061305@gitrepo.freebsd.org> From: John Baldwin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2/25/25 21:23, Bjoern A. Zeeb wrote: > On Tue, 25 Feb 2025, Michael Tuexen wrote: > >> The branch main has been updated by tuexen: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=0e58542fd246242bc64bd03d8b2f28cf981c062b >> >> commit 0e58542fd246242bc64bd03d8b2f28cf981c062b >> Author: Peter Lei >> AuthorDate: 2025-02-25 20:37:48 +0000 >> Commit: Michael Tuexen >> CommitDate: 2025-02-25 20:37:48 +0000 >> >> tcp: remove unused field from struct tcpcb >> >> Reviewed by: tuexen >> Sponsored by: Netflix, Inc. >> --- >> sys/netinet/tcp_var.h | 1 - >> 1 file changed, 1 deletion(-) >> >> diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h >> index e65e44840bd8..31663ed48f81 100644 >> --- a/sys/netinet/tcp_var.h >> +++ b/sys/netinet/tcp_var.h >> @@ -452,7 +452,6 @@ struct tcpcb { >> tcp_seq gput_seq; /* Outbound measurement seq */ >> tcp_seq gput_ack; /* Inbound measurement ack */ >> int32_t t_stats_gput_prev; /* XXXLAS: Prev gput measurement */ >> - uint32_t t_maxpeakrate; /* max peak rate set by user, bytes/s */ > > Is the tcpcb no longer KBI relevant these days? > In the old days we'd simply make this a spare and not move all offsets > below around. Only in stable branches would we do that sort of thing though. In main we keep all the spares at the end and never use them (they are reserved so they can be used for MFC of new fields in stable). -- John Baldwin From nobody Wed Feb 26 19:31:34 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z34N72McRz5nksH; Wed, 26 Feb 2025 19:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34N70BdKz3d7s; Wed, 26 Feb 2025 19:31:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598295; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qrjqs0GK5S0UB3sAWRqkA7IX9+QG2ZQoC5SlYqZh2F4=; b=SQX52ir+aNr1ZI1EyXsGorjEmXT6VPYsHywQbj3GBzl+nNp4ZPy9tMpvy7KjCF+BUJo6jP 6afcbETPqactEZdEZrnqf5sLRVVNszaSaqw5ICpFvJ5umSzJdrYw8SqslSNsyiijmNeq0h u6UyoQ6rHH7RzscVblZt1uHuP0cAPKwZWwGK0t0fLYjpQ/4eOGl5hJsdbxs92CVXZ8K6Hw aveS6GaYoInwYs6HwrgTZS49L3D6ssTN4gdIrMhNbHEYro4jt7wNK7k0VTgsGPSA/1d7rs N8v/GEh0cWs+8MtoKMrQ3m8AqS5nA5CnWD3+KK6klfPkZ4AGaE/bd7zsED7B/w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598295; a=rsa-sha256; cv=none; b=G3qeCQSrERdDOHgGiY0J0kk9uCQnMj39OzG27p+QLVLQikylvaq+s/1RFoOp3HKG4EeyEW 3K4i2C8N0nDlXDwqreQjdI5n20Dm3nGPVp1Wl9pJzNgfX3QNB4VooVXY/UYGyfgryemnCi vW6EVD7J+2BlKAQUoWcofwHeyY/MiBg7eIabNHknYx8Hk1sJYtItKZ3H2vGEDQhMffMnS9 9OMTuhZpn3HNg/knPFTZp+ucrlix1q0N51YezJEQRT2rjg/wkuaxxPtqUXUKjOykvUJXER cBN6K9nJWJN457e9SwraJlcdMOVC7is0ExLw0AmHhuiTV3mw9C4S8Fb5umRpEg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598295; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qrjqs0GK5S0UB3sAWRqkA7IX9+QG2ZQoC5SlYqZh2F4=; b=U1bXqI6198QgKzAGE/xVnRi60EWPBcdnnvuc0rWba7Aaeq7rYZSKwaDOoELTAb1OksLOD6 EFufM9TD7nPpyLrWzRze1RvVX6mJKjGmglJWBEBmP5Sxacu7nwoVrZScvjcMEpLREQEGwh nhbHq/+yUpxLogfeUhRIoH2ZU3yqblptqoY0gZvKYZqs2+x95rn/A4RN20nE5/UaWV+0M2 /tDRx1bWLG4gdwJyJ2eOXTys0VgGh+kSu1/8COITaXgCowsr4/b1b53jCylMyOmmO9eHD6 0ySC9kVTkH7DLeu+cAgPvJvgUBne5vnEe4h+anZNgZniLan0adv+zwBhq5kmhA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z34N66pBBz1PYg; Wed, 26 Feb 2025 19:31:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QJVY08017475; Wed, 26 Feb 2025 19:31:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVYXM017472; Wed, 26 Feb 2025 19:31:34 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:34 GMT Message-Id: <202502261931.51QJVYXM017472@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 38075f7d5c87 - main - net80211: remove direct use of ni->ni_txrate, add indirection methods List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 38075f7d5c87176f7b317c368712444a2f450a5e Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=38075f7d5c87176f7b317c368712444a2f450a5e commit 38075f7d5c87176f7b317c368712444a2f450a5e Author: Adrian Chadd AuthorDate: 2025-01-02 03:52:25 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:29:09 +0000 net80211: remove direct use of ni->ni_txrate, add indirection methods The summary: * Refactor ni_txrate access into ieee80211_node_get_txrate_dot11rate() and ieee80211_node_set_txrate_dot11rate(). These wrap the ni->ni_txrate access and will eventually be able to do runtime sanity checks and fallback where necessary. * Refactor ieee80211_node_get_txrate_kbit() from the ioctl code which sets isi_txmbps (which is in 0.5Mbit/s units.) This new routine returns the TX rate in kbit/s units. * Also use ieee80211_node_get_txrate_kbit() in various places in the code where the dot11rate was turned into a Mbit/sec value, which was very wrong for HT (but also only used for logging, so it didn't have an effect on normal runtime.) * Mb -> Mbit/s The long version: The current ni->ni_txrate value is what net80211's phy code calls a 'dot11rate'. Inside the ieee80211_phy.c tables you'll find a bunch of tables which represent: * for legacy rates its in 1/2 mbit units. * for turbo (Atheros 40MHz OFDM) it's the non-turbo rates, but the turbo rate speed in kbit/sec. * for 802.11n rates its the MCS, starting at 0x80. However there are a couple of catches with this: * Basic rates are represented in the pre-11n rates using the high bit (IEEE80211_RATE_BASIC) * 11n rates are also represented using the high bit (IEEE80211_RATE_MCS) Now, ni->ni_txrate will clear the IEEE80211_RATE_BASIC flag before storing it, so if the high bit exists it must be an 802.11n rate. However, there's still a bunch of code everywhere that purposefully filters that out. The goals of this commit: * Provide an easy API to migrate existing drivers and other consumers to - ieee80211_node_get_txrate_dot11rate() is defined as "will return the normal legacy or HT rate" so all the existing code can work. * Lay the ground work for extending ni_txrate (and a rate representation in general) that can represent legacy, HT, VHT, EHT, HE, etc rates. * Create a central place where ni_txrate is updated from rate control, drivers that will update ni_txrate itself, and consumers, so we can provide some basic runtime checks / logging as VHT, EHT, HE, etc rates are eventually added. For example, a VHT driver will eventually receive VHT rates, but an existing HT driver will not, so the API should log and return a sensible default when something like a VHT rate shows up on a HT only device. The rate control code currently returns a rix, and sets ni_txrate to the dot11rate. Drivers can choose either. However, choosing the rix is risky because you need to know if it's the ni_rates or ni_htrates, which requires a lot of duplicate work that lines up consistently at all layers (see the AMRR code for an example.) Differential Revision: https://reviews.freebsd.org/D48601 Reviewed by: bz, thj --- sys/net80211/ieee80211.c | 2 +- sys/net80211/ieee80211_adhoc.c | 5 ++- sys/net80211/ieee80211_amrr.c | 14 +++++--- sys/net80211/ieee80211_hostap.c | 7 ++-- sys/net80211/ieee80211_ioctl.c | 20 ++--------- sys/net80211/ieee80211_mesh.c | 2 +- sys/net80211/ieee80211_node.c | 65 +++++++++++++++++++++++++++++++++++ sys/net80211/ieee80211_node.h | 6 ++++ sys/net80211/ieee80211_ratectl_none.c | 6 ++-- sys/net80211/ieee80211_rssadapt.c | 16 +++++---- sys/net80211/ieee80211_scan_sta.c | 2 +- sys/net80211/ieee80211_sta.c | 7 ++-- sys/net80211/ieee80211_superg.c | 10 +++--- 13 files changed, 112 insertions(+), 50 deletions(-) diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index 49d313e5077d..eb796462d3d1 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -2306,7 +2306,7 @@ ieee80211_media_status(struct ifnet *ifp, struct ifmediareq *imr) * In station mode report the current transmit rate. */ imr->ifm_active |= ieee80211_rate2media(ic, - vap->iv_bss->ni_txrate, mode); + ieee80211_node_get_txrate_dot11rate(vap->iv_bss), mode); } else imr->ifm_active |= IFM_AUTO; if (imr->ifm_status & IFM_ACTIVE) diff --git a/sys/net80211/ieee80211_adhoc.c b/sys/net80211/ieee80211_adhoc.c index d252b75899a2..77e5a2d99904 100644 --- a/sys/net80211/ieee80211_adhoc.c +++ b/sys/net80211/ieee80211_adhoc.c @@ -235,10 +235,9 @@ adhoc_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) ether_sprintf(ni->ni_bssid)); ieee80211_print_essid(vap->iv_bss->ni_essid, ni->ni_esslen); - /* XXX MCS/HT */ - printf(" channel %d start %uMb\n", + printf(" channel %d start %uMbit/s\n", ieee80211_chan2ieee(ic, ic->ic_curchan), - IEEE80211_RATE2MBS(ni->ni_txrate)); + ieee80211_node_get_txrate_kbit(ni) / 1000); } #endif break; diff --git a/sys/net80211/ieee80211_amrr.c b/sys/net80211/ieee80211_amrr.c index 386a3de92a74..d366bf71e367 100644 --- a/sys/net80211/ieee80211_amrr.c +++ b/sys/net80211/ieee80211_amrr.c @@ -207,7 +207,7 @@ amrr_node_init(struct ieee80211_node *ni) rate |= IEEE80211_RATE_MCS; /* Assign initial rate from the rateset */ - ni->ni_txrate = rate; + ieee80211_node_set_txrate_dot11rate(ni, rate); amn->amn_ticks = ticks; /* XXX TODO: we really need a rate-to-string method */ @@ -321,7 +321,8 @@ amrr_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg __unused) /* XXX should return -1 here, but drivers may not expect this... */ if (!amn) { - ni->ni_txrate = ni->ni_rates.rs_rates[0]; + ieee80211_node_set_txrate_dot11rate(ni, + ni->ni_rates.rs_rates[0]); return 0; } @@ -338,13 +339,16 @@ amrr_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg __unused) if (is_enough(amn) && (ticks - amn->amn_ticks) > amrr->amrr_interval) { rix = amrr_update(amrr, amn, ni); if (rix != amn->amn_rix) { + uint8_t dot11Rate; /* update public rate */ - ni->ni_txrate = rs->rs_rates[rix]; + dot11Rate = rs->rs_rates[rix]; /* XXX strip basic rate flag from txrate, if non-11n */ if (ieee80211_ht_check_tx_ht(ni)) - ni->ni_txrate |= IEEE80211_RATE_MCS; + dot11Rate |= IEEE80211_RATE_MCS; else - ni->ni_txrate &= IEEE80211_RATE_VAL; + dot11Rate &= IEEE80211_RATE_VAL; + ieee80211_node_set_txrate_dot11rate(ni, dot11Rate); + amn->amn_rix = rix; } amn->amn_ticks = ticks; diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c index 1dce9a6b5923..76c419f5bdf8 100644 --- a/sys/net80211/ieee80211_hostap.c +++ b/sys/net80211/ieee80211_hostap.c @@ -63,8 +63,6 @@ #include #include /* for parse_wmeie */ -#define IEEE80211_RATE2MBS(r) (((r) & IEEE80211_RATE_VAL) / 2) - static void hostap_vattach(struct ieee80211vap *); static int hostap_newstate(struct ieee80211vap *, enum ieee80211_state, int); static int hostap_input(struct ieee80211_node *ni, struct mbuf *m, @@ -311,10 +309,9 @@ hostap_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) ether_sprintf(ni->ni_bssid)); ieee80211_print_essid(ni->ni_essid, ni->ni_esslen); - /* XXX MCS/HT */ - printf(" channel %d start %uMb\n", + printf(" channel %d start %uMbit/s\n", ieee80211_chan2ieee(ic, ic->ic_curchan), - IEEE80211_RATE2MBS(ni->ni_txrate)); + ieee80211_node_get_txrate_kbit(ni) / 1000); } #endif break; diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index 3b57e7d8cd8e..24ec9659dc2d 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -406,23 +406,9 @@ get_sta_info(void *arg, struct ieee80211_node *ni) if (si->isi_nrates > 15) si->isi_nrates = 15; memcpy(si->isi_rates, ni->ni_rates.rs_rates, si->isi_nrates); - si->isi_txrate = ni->ni_txrate; - if (si->isi_txrate & IEEE80211_RATE_MCS) { - const struct ieee80211_mcs_rates *mcs = - &ieee80211_htrates[ni->ni_txrate &~ IEEE80211_RATE_MCS]; - if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) { - if (ni->ni_flags & IEEE80211_NODE_SGI40) - si->isi_txmbps = mcs->ht40_rate_800ns; - else - si->isi_txmbps = mcs->ht40_rate_400ns; - } else { - if (ni->ni_flags & IEEE80211_NODE_SGI20) - si->isi_txmbps = mcs->ht20_rate_800ns; - else - si->isi_txmbps = mcs->ht20_rate_400ns; - } - } else - si->isi_txmbps = si->isi_txrate; + si->isi_txrate = ieee80211_node_get_txrate_dot11rate(ni); + /* Note: txmbps is in 1/2Mbit/s units */ + si->isi_txmbps = ieee80211_node_get_txrate_kbit(ni) / 500; si->isi_associd = ni->ni_associd; si->isi_txpower = ni->ni_txpower; si->isi_vlan = ni->ni_vlan; diff --git a/sys/net80211/ieee80211_mesh.c b/sys/net80211/ieee80211_mesh.c index c52122ebeb13..9f81bc3643aa 100644 --- a/sys/net80211/ieee80211_mesh.c +++ b/sys/net80211/ieee80211_mesh.c @@ -3298,7 +3298,7 @@ mesh_airtime_calc(struct ieee80211_node *ni) uint64_t res; /* Time to transmit a frame */ - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); overhead = ieee80211_compute_duration(ic->ic_rt, ifp->if_mtu + IEEE80211_MESH_MAXOVERHEAD, rate, 0) << M_BITS; /* Error rate in percentage */ diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index f2fc3d21a361..f5b05ed769c9 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -3137,3 +3137,68 @@ ieee80211_getsignal(struct ieee80211vap *vap, int8_t *rssi, int8_t *noise) if (vap->iv_opmode != IEEE80211_M_STA) *rssi = ieee80211_getrssi(vap); } + +uint8_t +ieee80211_node_get_txrate_dot11rate(struct ieee80211_node *ni) +{ + return (ni->ni_txrate); +} + +void +ieee80211_node_set_txrate_dot11rate(struct ieee80211_node *ni, + uint8_t dot11Rate) +{ + ni->ni_txrate = dot11Rate; +} + +void +ieee80211_node_set_txrate_ht_mcsrate(struct ieee80211_node *ni, + uint8_t mcs) +{ + KASSERT(mcs <= 76, ("%s: MCS is not 0..76 (%d)", __func__, mcs)); + if (mcs > 76) { + ic_printf(ni->ni_ic, "%s: invalid MCS (%d)\n", __func__, mcs); + return; + } + ni->ni_txrate = IEEE80211_RATE_MCS | mcs; +} + + +/* + * @brief Fetch the transmit rate for the given node in kbit/s. + * + * This currently only works for CCK, OFDM and HT rates. + * + * @param ni struct ieee80211_node * to lookup + * @returns current transmit rate in kbit/s + */ +uint32_t +ieee80211_node_get_txrate_kbit(struct ieee80211_node *ni) +{ + uint32_t mbps; + + if (ni->ni_txrate & IEEE80211_RATE_MCS) { + const struct ieee80211_mcs_rates *mcs = + &ieee80211_htrates[ni->ni_txrate & ~IEEE80211_RATE_MCS]; + + if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) { + /* Note: these are in 1/2Mbit/s units */ + if (ni->ni_flags & IEEE80211_NODE_SGI40) + mbps = mcs->ht40_rate_800ns; + else + mbps = mcs->ht40_rate_400ns; + } else { + if (ni->ni_flags & IEEE80211_NODE_SGI20) + mbps = mcs->ht20_rate_800ns; + else + mbps = mcs->ht20_rate_400ns; + } + } else + /* Note: CCK/OFDM dot11rate entries are in 1/2Mbit/s units */ + mbps = ni->ni_txrate; + + /* + * Note; 'mbps' in 1/2 Mbit/s units so *500 to make it in kbit/s units. + */ + return (mbps * 500); +} diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h index 0039c743544c..722f3d54a00b 100644 --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -498,4 +498,10 @@ void ieee80211_node_join(struct ieee80211_node *,int); void ieee80211_node_leave(struct ieee80211_node *); int8_t ieee80211_getrssi(struct ieee80211vap *); void ieee80211_getsignal(struct ieee80211vap *, int8_t *, int8_t *); + +uint8_t ieee80211_node_get_txrate_dot11rate(struct ieee80211_node *); +void ieee80211_node_set_txrate_dot11rate(struct ieee80211_node *, uint8_t); +void ieee80211_node_set_txrate_ht_mcsrate(struct ieee80211_node *, uint8_t); +uint32_t ieee80211_node_get_txrate_kbit(struct ieee80211_node *); + #endif /* _NET80211_IEEE80211_NODE_H_ */ diff --git a/sys/net80211/ieee80211_ratectl_none.c b/sys/net80211/ieee80211_ratectl_none.c index 4ab122fbab92..47f88cbd3a79 100644 --- a/sys/net80211/ieee80211_ratectl_none.c +++ b/sys/net80211/ieee80211_ratectl_none.c @@ -62,7 +62,8 @@ none_deinit(struct ieee80211vap *vap) static void none_node_init(struct ieee80211_node *ni) { - ni->ni_txrate = ni->ni_rates.rs_rates[0] & IEEE80211_RATE_VAL; + ieee80211_node_set_txrate_dot11rate(ni, + ni->ni_rates.rs_rates[0] & IEEE80211_RATE_VAL); } static void @@ -75,7 +76,8 @@ none_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg __unused) { int rix = 0; - ni->ni_txrate = ni->ni_rates.rs_rates[rix] & IEEE80211_RATE_VAL; + ieee80211_node_set_txrate_dot11rate(ni, + ni->ni_rates.rs_rates[rix] & IEEE80211_RATE_VAL); return rix; } diff --git a/sys/net80211/ieee80211_rssadapt.c b/sys/net80211/ieee80211_rssadapt.c index 6c77727d7526..43118aad53c3 100644 --- a/sys/net80211/ieee80211_rssadapt.c +++ b/sys/net80211/ieee80211_rssadapt.c @@ -203,11 +203,13 @@ rssadapt_node_init(struct ieee80211_node *ni) ra->ra_rix > 0 && (rs->rs_rates[ra->ra_rix] & IEEE80211_RATE_VAL) > 72; ra->ra_rix--) ; - ni->ni_txrate = rs->rs_rates[ra->ra_rix] & IEEE80211_RATE_VAL; + ieee80211_node_set_txrate_dot11rate(ni, + rs->rs_rates[ra->ra_rix] & IEEE80211_RATE_VAL); ra->ra_ticks = ticks; IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "RSSADAPT initial rate %d", ni->ni_txrate); + "RSSADAPT initial rate %d Mbit/s", + ieee80211_node_get_txrate_kbit(ni) / 1000); } static void @@ -244,7 +246,8 @@ rssadapt_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg) /* XXX should return -1 here, but drivers may not expect this... */ if (!ra) { - ni->ni_txrate = ni->ni_rates.rs_rates[0]; + ieee80211_node_set_txrate_dot11rate(ni, + ni->ni_rates.rs_rates[0]); return 0; } @@ -263,12 +266,13 @@ rssadapt_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg) break; if (rix != ra->ra_rix) { /* update public rate */ - ni->ni_txrate = ni->ni_rates.rs_rates[rix] & IEEE80211_RATE_VAL; + ieee80211_node_set_txrate_dot11rate(ni, + ni->ni_rates.rs_rates[rix] & IEEE80211_RATE_VAL); ra->ra_rix = rix; IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "RSSADAPT new rate %d (pktlen %d rssi %d)", - ni->ni_txrate, pktlen, rssi); + "RSSADAPT new rate %d Mbit/s (pktlen %d rssi %d)", + ieee80211_node_get_txrate_kbit(ni) / 1000, pktlen, rssi); } return rix; } diff --git a/sys/net80211/ieee80211_scan_sta.c b/sys/net80211/ieee80211_scan_sta.c index a8159fca6d80..69347a5d99cf 100644 --- a/sys/net80211/ieee80211_scan_sta.c +++ b/sys/net80211/ieee80211_scan_sta.c @@ -1365,7 +1365,7 @@ sta_roam_check(struct ieee80211_scan_state *ss, struct ieee80211vap *vap) /* NB: the most up to date rssi is in the node, not the scan cache */ curRssi = ic->ic_node_getrssi(ni); if (ucastRate == IEEE80211_FIXED_RATE_NONE) { - curRate = ni->ni_txrate; + curRate = ieee80211_node_get_txrate_dot11rate(ni); IEEE80211_DPRINTF(vap, IEEE80211_MSG_ROAM, "%s: currssi %d currate %u roamrssi %d roamrate %u\n", __func__, curRssi, curRate, roamRssi, roamRate); diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c index 9e4e1013fd2f..96603f339710 100644 --- a/sys/net80211/ieee80211_sta.c +++ b/sys/net80211/ieee80211_sta.c @@ -64,8 +64,6 @@ #include #include -#define IEEE80211_RATE2MBS(r) (((r) & IEEE80211_RATE_VAL) / 2) - static void sta_vattach(struct ieee80211vap *); static void sta_beacon_miss(struct ieee80211vap *); static int sta_newstate(struct ieee80211vap *, enum ieee80211_state, int); @@ -417,10 +415,9 @@ sta_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) ether_sprintf(ni->ni_bssid)); ieee80211_print_essid(vap->iv_bss->ni_essid, ni->ni_esslen); - /* XXX MCS/HT */ - printf(" channel %d start %uMb\n", + printf(" channel %d start %uMbit/s\n", ieee80211_chan2ieee(ic, ic->ic_curchan), - IEEE80211_RATE2MBS(ni->ni_txrate)); + ieee80211_node_get_txrate_kbit(ni) / 1000); } #endif ieee80211_scan_assoc_success(vap, ni->ni_macaddr); diff --git a/sys/net80211/ieee80211_superg.c b/sys/net80211/ieee80211_superg.c index 815fb356891c..ee3b70d5ed9f 100644 --- a/sys/net80211/ieee80211_superg.c +++ b/sys/net80211/ieee80211_superg.c @@ -725,6 +725,7 @@ ff_approx_txtime(struct ieee80211_node *ni, struct ieee80211vap *vap = ni->ni_vap; uint32_t framelen; uint32_t frame_time; + uint8_t dot11rate; /* * Approximate the frame length to be transmitted. A swag to add @@ -746,15 +747,16 @@ ff_approx_txtime(struct ieee80211_node *ni, * For now, we assume non-shortgi, 20MHz, just because I want to * at least test 802.11n. */ - if (ni->ni_txrate & IEEE80211_RATE_MCS) + dot11rate = ieee80211_node_get_txrate_dot11rate(ni); + if (dot11rate & IEEE80211_RATE_MCS) frame_time = ieee80211_compute_duration_ht(framelen, - ni->ni_txrate, - IEEE80211_HT_RC_2_STREAMS(ni->ni_txrate), + dot11rate, + IEEE80211_HT_RC_2_STREAMS(dot11rate), 0, /* isht40 */ 0); /* isshortgi */ else frame_time = ieee80211_compute_duration(ic->ic_rt, framelen, - ni->ni_txrate, 0); + dot11rate, 0); return (frame_time); } From nobody Wed Feb 26 19:31:37 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z34N94CxLz5nkpF; Wed, 26 Feb 2025 19:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34N92Jvlz3d5D; Wed, 26 Feb 2025 19:31:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598297; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LsSksQ71Y3HlsrbETlsU9vXGA7Xtq2YuMWurMeHrZxE=; b=nXpwwI0iNAeEyI5+Bml8ko4DaaKBZJP5uSbDcvYn33nUVyTSW8lQn1E5ey0+AVxbw4W/QT 7UjzGYYrJ3ecDGuWNT1+xeNxeZYC5DKEXSqhvCFskuKYwkPreW0wvLXYDLaJPyNFMwVaa0 rBRUS4gv4uYxbU5Z/KHiR8zIAnVovwYnB+mIUj7Ar9ahzMOIK3v7i+5E2iyUr3J6b5/pOE xKk6QI6y9NBg+BtAXDhxsquzGAfq+RZlVC/aP1iC/hDZQ4uLrQfpmOibNsqhsvIA5R1OmN kylBJiEwQsL5f9itC/y//qLw65zLlQQqK6BOQp3nyc1OYWc14bNGrwmS4ji2HA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598297; a=rsa-sha256; cv=none; b=LWoxzXgD+F5CR1KU/yAoIGZH2ljObI6EOnlvyEX4ePSifjnICFJF9S+FdAts9u/7Jcrk86 XLpgr7r7IYx/tcJ5k+yMUWLFXasYB6C0UKisOvt5UREAoojKPqjverYEzZarS91SIIfC7o Zvi7rqc+H7iygEl7cM60NWqlWRYOAQu24fIzVCPUfjmR10LyflhC0OwB/SXnovLTnxlB7H wY+KUZFgrsJykXLtTXEDN657o4KRSPjHi5f6dQO/8oM0ucVcSFToydBtA9Y2IKYjv92GwH Qk9kVGJPp9OxVQmoVbwSVfYHxWo++WWTmCc57+cgQx3UjRZWtLRyBUj69YQLbg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598297; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LsSksQ71Y3HlsrbETlsU9vXGA7Xtq2YuMWurMeHrZxE=; b=j3YKytMPJrLa8VkvD/jXb4oYNmvNKqbVAu5KwGXHFVB8AyEtsl+Zz/CsIV8+9GzvMAp2gb nRxZSq5X6RV3O0eyVDOTVcnmIx7t2809SYjrazDv7adMqhO+SuQDUe/mVEJuERhCz8G/ko ZJt35+Z1Dcikk94DM3CpDqsHxpCvaZTN39kqSxw/oovEkQqO3/LvK7z6ynU/G4r2RuH+hx ex8s9XSZq6dY56nRSnlMB5rmX1jW8U2wownnAJdbFQXaxDiOjKqrb7k94OSjRVFmgyCp9Q 2/uWyCe7zgiIR5QOGxIp+jQ4OeTVNrDtNSAymWfNsVO+wVmS3IBZ9ciceaO7zg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z34N91fRVz1P2F; Wed, 26 Feb 2025 19:31:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QJVbJ8017547; Wed, 26 Feb 2025 19:31:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVbih017544; Wed, 26 Feb 2025 19:31:37 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:37 GMT Message-Id: <202502261931.51QJVbih017544@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 46de4d9fc21d - main - net80211: change ieee80211_ratectl_rate() to not return a rix List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 46de4d9fc21dfd8945e95135f607ba4fdfdf3d78 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=46de4d9fc21dfd8945e95135f607ba4fdfdf3d78 commit 46de4d9fc21dfd8945e95135f607ba4fdfdf3d78 Author: Adrian Chadd AuthorDate: 2025-01-12 15:48:59 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:29:36 +0000 net80211: change ieee80211_ratectl_rate() to not return a rix There are only a few places where the returned rix is used: * linuxkpi - logging * bwi/bwn - used for finding a fallback rate to choose, which honestly should be returned by the ratectl API * iwm - building the rateset to program into firmware Everyone else uses the dot11rate value in ni->ni_txnode. This is a precursor for VHT and later rate support; where currently there aren't rate tables in ieee80211_phy.c for VHT and later rates. Although it's likely doable to add tables for VHT, 11ax and MU-OFDMA (HE) rates are sufficiently larger/different to just not fit in the current scheme without more refactoring. Differential Revision: https://reviews.freebsd.org/D48603 Reviewed by: bz, thj --- sys/compat/linuxkpi/common/src/linux_80211.c | 7 +++--- sys/dev/bwi/if_bwi.c | 13 ++++------- sys/dev/bwn/if_bwn.c | 12 ++++------- sys/dev/iwm/if_iwm.c | 32 ++++++++++++++++++++++------ sys/net80211/ieee80211_ratectl.h | 4 ++-- 5 files changed, 39 insertions(+), 29 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 72227378b097..14c7bab163b6 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -6921,7 +6921,6 @@ linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *hw, } if (ni != NULL) { - int ridx __unused; #ifdef LINUXKPI_DEBUG_80211 int old_rate; @@ -6946,15 +6945,15 @@ linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *hw, IMPROVE("only update of rate matches but that requires us to get a proper rate"); ieee80211_ratectl_tx_complete(ni, &txs); - ridx = ieee80211_ratectl_rate(ni->ni_vap->iv_bss, NULL, 0); + ieee80211_ratectl_rate(ni->ni_vap->iv_bss, NULL, 0); #ifdef LINUXKPI_DEBUG_80211 if (linuxkpi_debug_80211 & D80211_TRACE_TX) { - printf("TX-RATE: %s: old %d new %d ridx %d, " + printf("TX-RATE: %s: old %d new %d " "long_retries %d\n", __func__, old_rate, ieee80211_node_get_txrate_dot11rate(ni->ni_vap->iv_bss), - ridx, txs.long_retries); + txs.long_retries); } #endif } diff --git a/sys/dev/bwi/if_bwi.c b/sys/dev/bwi/if_bwi.c index 079dac73ea43..1087ca813d65 100644 --- a/sys/dev/bwi/if_bwi.c +++ b/sys/dev/bwi/if_bwi.c @@ -2916,7 +2916,7 @@ bwi_encap(struct bwi_softc *sc, int idx, struct mbuf *m, uint32_t mac_ctrl; uint16_t phy_ctrl; bus_addr_t paddr; - int type, ismcast, pkt_len, error, rix; + int type, ismcast, pkt_len, error; #if 0 const uint8_t *p; int i; @@ -2943,15 +2943,10 @@ bwi_encap(struct bwi_softc *sc, int idx, struct mbuf *m, } else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) { rate = rate_fb = tp->ucastrate; } else { - rix = ieee80211_ratectl_rate(ni, NULL, pkt_len); + ieee80211_ratectl_rate(ni, NULL, pkt_len); rate = ieee80211_node_get_txrate_dot11rate(ni); - - if (rix > 0) { - rate_fb = ni->ni_rates.rs_rates[rix-1] & - IEEE80211_RATE_VAL; - } else { - rate_fb = rate; - } + /* TODO: assign rate_fb the previous rate, if available */ + rate_fb = rate; } tb->tb_rate[0] = rate; tb->tb_rate[1] = rate_fb; diff --git a/sys/dev/bwn/if_bwn.c b/sys/dev/bwn/if_bwn.c index 571482afda70..38bf6f5d31a3 100644 --- a/sys/dev/bwn/if_bwn.c +++ b/sys/dev/bwn/if_bwn.c @@ -6394,7 +6394,7 @@ bwn_set_txhdr(struct bwn_mac *mac, struct ieee80211_node *ni, uint8_t *prot_ptr; unsigned int len; uint32_t macctl = 0; - int rts_rate, rts_rate_fb, ismcast, isshort, rix, type; + int rts_rate, rts_rate_fb, ismcast, isshort, type; uint16_t phyctl = 0; uint8_t rate, rate_fb; int fill_phy_ctl1 = 0; @@ -6420,14 +6420,10 @@ bwn_set_txhdr(struct bwn_mac *mac, struct ieee80211_node *ni, else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) rate = rate_fb = tp->ucastrate; else { - rix = ieee80211_ratectl_rate(ni, NULL, 0); + ieee80211_ratectl_rate(ni, NULL, 0); rate = ieee80211_node_get_txrate_dot11rate(ni); - - if (rix > 0) - rate_fb = ni->ni_rates.rs_rates[rix - 1] & - IEEE80211_RATE_VAL; - else - rate_fb = rate; + /* TODO: assign rate_fb the previous rate, if available */ + rate_fb = rate; } sc->sc_tx_rate = rate; diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index bfe8c3635c7c..1e9090310ece 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -3502,11 +3502,11 @@ iwm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt, if (rate_matched) { ieee80211_ratectl_tx_complete(ni, txs); - int rix = ieee80211_ratectl_rate(vap->iv_bss, NULL, 0); + ieee80211_ratectl_rate(vap->iv_bss, NULL, 0); new_rate = ieee80211_node_get_txrate_dot11rate(vap->iv_bss); if (new_rate != 0 && new_rate != cur_rate) { struct iwm_node *in = IWM_NODE(vap->iv_bss); - iwm_setrates(sc, in, rix); + iwm_setrates(sc, in, new_rate); iwm_send_lq_cmd(sc, &in->in_lq, FALSE); } } @@ -4270,7 +4270,7 @@ iwm_rate2ridx(struct iwm_softc *sc, uint8_t rate) static void -iwm_setrates(struct iwm_softc *sc, struct iwm_node *in, int rix) +iwm_setrates(struct iwm_softc *sc, struct iwm_node *in, int dot11rate) { struct ieee80211_node *ni = &in->in_ni; struct iwm_lq_cmd *lq = &in->in_lq; @@ -4278,8 +4278,27 @@ iwm_setrates(struct iwm_softc *sc, struct iwm_node *in, int rix) int nrates = rs->rs_nrates; int i, ridx, tab = 0; // int txant = 0; + int rix; - KASSERT(rix >= 0 && rix < nrates, ("invalid rix")); + /* + * Look up the rate index for the given legacy rate from + * the rs_rates table. Default to the lowest rate if it's + * not found (which is obviously hugely problematic.) + */ + rix = -1; + for (i = 0; i < nrates; i++) { + int rate = rs->rs_rates[i] & IEEE80211_RATE_VAL; + if (rate == dot11rate) { + rix = i; + break; + } + } + if (rix < 0) { + device_printf(sc->sc_dev, + "%s: failed to lookup dot11rate (%d)\n", + __func__, dot11rate); + rix = 0; + } if (nrates > nitems(lq->rs_table)) { device_printf(sc->sc_dev, @@ -4559,8 +4578,9 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) iwm_enable_beacon_filter(sc, ivp); iwm_power_update_mac(sc); iwm_update_quotas(sc, ivp); - int rix = ieee80211_ratectl_rate(&in->in_ni, NULL, 0); - iwm_setrates(sc, in, rix); + ieee80211_ratectl_rate(&in->in_ni, NULL, 0); + iwm_setrates(sc, in, + ieee80211_node_get_txrate_dot11rate(&in->in_ni)); if ((error = iwm_send_lq_cmd(sc, &in->in_lq, TRUE)) != 0) { device_printf(sc->sc_dev, diff --git a/sys/net80211/ieee80211_ratectl.h b/sys/net80211/ieee80211_ratectl.h index 2eae34763ed4..0e5beb5185cb 100644 --- a/sys/net80211/ieee80211_ratectl.h +++ b/sys/net80211/ieee80211_ratectl.h @@ -127,12 +127,12 @@ ieee80211_ratectl_node_deinit(struct ieee80211_node *ni) vap->iv_rate->ir_node_deinit(ni); } -static int __inline +static void __inline ieee80211_ratectl_rate(struct ieee80211_node *ni, void *arg, uint32_t iarg) { const struct ieee80211vap *vap = ni->ni_vap; - return vap->iv_rate->ir_rate(ni, arg, iarg); + vap->iv_rate->ir_rate(ni, arg, iarg); } static __inline void From nobody Wed Feb 26 19:31:35 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z34N8430pz5nkpD; Wed, 26 Feb 2025 19:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34N80qKQz3dVT; Wed, 26 Feb 2025 19:31:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598296; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uofPAcPZP+v7cuqhZfb8rKlqEQA/M5C3D42M2LC/b1M=; b=fKJ8mxJxf3REBGEyOKHG8BYiymBhleKFhLRKFKPg5YggjyF/VNWN/1SBzwYXN1egRprGlk ZZwC/C5VeB8nafr4SchmMB78Pi1jgJyQXSPxZGpzaixCsCJq+8PStIOmKscoB7W5B08Li0 znwoJaFNCdnDvbk1FjFbMh9ST7Q4v4MYbvOjtDzl1r3D7DT6ad3zU45pefiYSPgZm/k8NZ 8L7i587ecTHWOHBa/lpz9wPOg4xaAkcbqIrZGUejeJ+Yco74XUJMwUikpFgVkBY2hDz7HS QkD2FagtR3ao+NuW886IUbZh+10RQxNZicdl5o9+SpmlmV6rXtkYB/vqCy6aVg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598296; a=rsa-sha256; cv=none; b=TUZU9ESWBW/A0pmiLE+WQAUUunnXCO27vraQi14bEoeIaRzaSW3KCCWxNkJuSRkVDyr2lf 8oXVN/m+PHSdjsIOV6/42NZFjmzBVBHM6C7p3qA4w4N94K+kL2LNq5uUPOx9Ki2m/4yEnL Up8pn0C/WZrX1dJ5/vkUUW1PUDSIlFmZC6uE+Po9zoqrbbcs9ECAE7KvTMRc0Kl1w6OpRH 4/C3W6rBDVzOyeARzTbl5bYaZd24sT89SCCC1sj0ujAmL2rP+K744N6F6ajKCPEH0R+VRz qm1mGa9R0FtSlmcYAlma5P00Nf0+ImucZDL9xk9pRyrA2e5IaP/F+VBMjZmJ9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598296; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uofPAcPZP+v7cuqhZfb8rKlqEQA/M5C3D42M2LC/b1M=; b=S2IqMivRHfe/AQLE8sVNcrwGf7CWZk+Si8KVz6p91j3p151GqlBIwi9wSQubbsYEa/KbBW yGbHYYusI0mY0GX0qQHiuydQZuRly2Pn10k3fJqQbkreoJW8QvlmCjviJa+LQOUsPlGYpI 60JcBIejpZq56XyYAIsjmdA0lDt8FzK/ttHG3SvU+7lvA859nim5ESpPNaVssiacPRaX5+ bNLu1e6QJGORR8dmrL+S/XFcBJUh8uk4eXsNU8eqS0p8WuVHfYytSB7vSTTng/EBYj/tef VxGoL4ucZouzOC6mzh9x2nsnv9cO22K/4j1eE9pcwPsccazStWJgaHQ6asLVOA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z34N80PyWz1PTw; Wed, 26 Feb 2025 19:31:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QJVaw8017512; Wed, 26 Feb 2025 19:31:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVZKf017509; Wed, 26 Feb 2025 19:31:35 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:35 GMT Message-Id: <202502261931.51QJVZKf017509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 706745001093 - main - sys: convert ni->ni_txrate references use to the new net80211 API List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7067450010931479f8dd97e51e4c5bf6a4d34c7e Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=7067450010931479f8dd97e51e4c5bf6a4d34c7e commit 7067450010931479f8dd97e51e4c5bf6a4d34c7e Author: Adrian Chadd AuthorDate: 2025-01-02 04:35:24 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:29:18 +0000 sys: convert ni->ni_txrate references use to the new net80211 API This just mechanically converts things. * For linuxkpi, it was just used for display. * For uath, it was just used for display, as firmware doesn't report it up. Differential Revision: https://reviews.freebsd.org/D48602 Reviewed by: bz, thj --- sys/compat/linuxkpi/common/src/linux_80211.c | 6 ++++-- sys/dev/ath/ath_rate/amrr/amrr.c | 7 +++++-- sys/dev/ath/ath_rate/onoe/onoe.c | 8 +++++--- sys/dev/ath/ath_rate/sample/sample.c | 15 ++++++++++----- sys/dev/bwi/if_bwi.c | 2 +- sys/dev/bwn/if_bwn.c | 2 +- sys/dev/ipw/if_ipw.c | 4 ++-- sys/dev/iwi/if_iwi.c | 4 ++-- sys/dev/iwm/if_iwm.c | 8 +++++--- sys/dev/iwn/if_iwn.c | 2 +- sys/dev/malo/if_malo.c | 2 +- sys/dev/mwl/if_mwl.c | 11 ++++++----- sys/dev/otus/if_otus.c | 9 ++++++--- sys/dev/ral/rt2560.c | 4 ++-- sys/dev/ral/rt2661.c | 4 ++-- sys/dev/ral/rt2860.c | 2 +- sys/dev/rtwn/if_rtwn_tx.c | 2 +- sys/dev/usb/wlan/if_mtw.c | 10 ++++++---- sys/dev/usb/wlan/if_rsu.c | 3 ++- sys/dev/usb/wlan/if_rum.c | 2 +- sys/dev/usb/wlan/if_run.c | 7 +++++-- sys/dev/usb/wlan/if_uath.c | 3 ++- sys/dev/usb/wlan/if_ural.c | 2 +- sys/dev/usb/wlan/if_zyd.c | 2 +- sys/dev/wpi/if_wpi.c | 2 +- sys/dev/wtap/if_wtap.c | 5 ++--- 26 files changed, 76 insertions(+), 52 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 894d0db39677..72227378b097 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -6925,7 +6925,8 @@ linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *hw, #ifdef LINUXKPI_DEBUG_80211 int old_rate; - old_rate = ni->ni_vap->iv_bss->ni_txrate; + old_rate = + ieee80211_node_get_txrate_dot11rate(ni->ni_vap->iv_bss); #endif txs.pktlen = skb->len; txs.flags |= IEEE80211_RATECTL_STATUS_PKTLEN; @@ -6951,7 +6952,8 @@ linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *hw, if (linuxkpi_debug_80211 & D80211_TRACE_TX) { printf("TX-RATE: %s: old %d new %d ridx %d, " "long_retries %d\n", __func__, - old_rate, ni->ni_vap->iv_bss->ni_txrate, + old_rate, + ieee80211_node_get_txrate_dot11rate(ni->ni_vap->iv_bss), ridx, txs.long_retries); } #endif diff --git a/sys/dev/ath/ath_rate/amrr/amrr.c b/sys/dev/ath/ath_rate/amrr/amrr.c index 81bd03484de5..8f696eba23eb 100644 --- a/sys/dev/ath/ath_rate/amrr/amrr.c +++ b/sys/dev/ath/ath_rate/amrr/amrr.c @@ -245,8 +245,11 @@ ath_rate_update(struct ath_softc *sc, struct ieee80211_node *ni, int rate) * lowest hardware rate. */ if (ni->ni_rates.rs_nrates > 0) { - ni->ni_txrate = ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL; - amn->amn_tx_rix0 = sc->sc_rixmap[ni->ni_txrate]; + uint8_t dot11rate; + + dot11rate = ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL; + amn->amn_tx_rix0 = sc->sc_rixmap[dot11rate]; + ieee80211_node_set_txrate_dot11rate(ni, dot11rate); amn->amn_tx_rate0 = rt->info[amn->amn_tx_rix0].rateCode; amn->amn_tx_rate0sp = amn->amn_tx_rate0 | rt->info[amn->amn_tx_rix0].shortPreamble; diff --git a/sys/dev/ath/ath_rate/onoe/onoe.c b/sys/dev/ath/ath_rate/onoe/onoe.c index 8d86f13ef703..035d54b00b62 100644 --- a/sys/dev/ath/ath_rate/onoe/onoe.c +++ b/sys/dev/ath/ath_rate/onoe/onoe.c @@ -203,6 +203,7 @@ ath_rate_update(struct ath_softc *sc, struct ieee80211_node *ni, int rate) struct ieee80211vap *vap = ni->ni_vap; const HAL_RATE_TABLE *rt = sc->sc_currates; u_int8_t rix; + uint8_t dot11rate; KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode)); @@ -221,8 +222,9 @@ ath_rate_update(struct ath_softc *sc, struct ieee80211_node *ni, int rate) if (ni->ni_rates.rs_nrates == 0) goto done; on->on_rix = rate; - ni->ni_txrate = ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL; - on->on_tx_rix0 = sc->sc_rixmap[ni->ni_txrate]; + dot11rate = ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL; + ieee80211_node_set_txrate_dot11rate(ni, dot11rate); + on->on_tx_rix0 = sc->sc_rixmap[dot11rate]; on->on_tx_rate0 = rt->info[on->on_tx_rix0].rateCode; on->on_tx_rate0sp = on->on_tx_rate0 | @@ -389,7 +391,7 @@ ath_rate_ctl(void *arg, struct ieee80211_node *ni) if (nrate != on->on_rix) { IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, "%s: %dM -> %dM (%d ok, %d err, %d retr)", __func__, - ni->ni_txrate / 2, + ieee80211_node_get_txrate_kbit(ni) / 1000, (rs->rs_rates[nrate] & IEEE80211_RATE_VAL) / 2, on->on_tx_ok, on->on_tx_err, on->on_tx_retr); ath_rate_update(sc, ni, nrate); diff --git a/sys/dev/ath/ath_rate/sample/sample.c b/sys/dev/ath/ath_rate/sample/sample.c index 58df9ad1c1cd..8fba3c68099f 100644 --- a/sys/dev/ath/ath_rate/sample/sample.c +++ b/sys/dev/ath/ath_rate/sample/sample.c @@ -855,9 +855,13 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_node *an, /* * Set the visible txrate for this node. */ - an->an_node.ni_txrate = - (rt->info[best_rix].phy == IEEE80211_T_HT) ? - MCS(best_rix) : DOT11RATE(best_rix); + if (rt->info[best_rix].phy == IEEE80211_T_HT) + ieee80211_node_set_txrate_ht_mcsrate( + &an->an_node, MCS(best_rix)); + else + ieee80211_node_set_txrate_dot11rate( + &an->an_node, + DOT11RATE(best_rix)); } rix = sn->current_rix[size_bin]; sn->packets_since_switch[size_bin]++; @@ -1409,9 +1413,10 @@ ath_rate_ctl_reset(struct ath_softc *sc, struct ieee80211_node *ni) #endif /* set the visible bit-rate */ if (sn->static_rix != -1) - ni->ni_txrate = DOT11RATE(sn->static_rix); + ieee80211_node_set_txrate_dot11rate(ni, + DOT11RATE(sn->static_rix)); else - ni->ni_txrate = RATE(0); + ieee80211_node_set_txrate_dot11rate(ni, RATE(0)); #undef RATE #undef DOT11RATE } diff --git a/sys/dev/bwi/if_bwi.c b/sys/dev/bwi/if_bwi.c index f9a6b2357cc0..079dac73ea43 100644 --- a/sys/dev/bwi/if_bwi.c +++ b/sys/dev/bwi/if_bwi.c @@ -2944,7 +2944,7 @@ bwi_encap(struct bwi_softc *sc, int idx, struct mbuf *m, rate = rate_fb = tp->ucastrate; } else { rix = ieee80211_ratectl_rate(ni, NULL, pkt_len); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); if (rix > 0) { rate_fb = ni->ni_rates.rs_rates[rix-1] & diff --git a/sys/dev/bwn/if_bwn.c b/sys/dev/bwn/if_bwn.c index 0f44c3c94672..571482afda70 100644 --- a/sys/dev/bwn/if_bwn.c +++ b/sys/dev/bwn/if_bwn.c @@ -6421,7 +6421,7 @@ bwn_set_txhdr(struct bwn_mac *mac, struct ieee80211_node *ni, rate = rate_fb = tp->ucastrate; else { rix = ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); if (rix > 0) rate_fb = ni->ni_rates.rs_rates[rix - 1] & diff --git a/sys/dev/ipw/if_ipw.c b/sys/dev/ipw/if_ipw.c index 68662f378933..01d713cdae18 100644 --- a/sys/dev/ipw/if_ipw.c +++ b/sys/dev/ipw/if_ipw.c @@ -838,8 +838,8 @@ ipw_media_status(if_t ifp, struct ifmediareq *imr) struct ipw_softc *sc = ic->ic_softc; /* read current transmission rate from adapter */ - vap->iv_bss->ni_txrate = ipw_cvtrate( - ipw_read_table1(sc, IPW_INFO_CURRENT_TX_RATE) & 0xf); + ieee80211_node_set_txrate_dot11rate(vap->iv_bss, + ipw_cvtrate(ipw_read_table1(sc, IPW_INFO_CURRENT_TX_RATE) & 0xf)); ieee80211_media_status(ifp, imr); } diff --git a/sys/dev/iwi/if_iwi.c b/sys/dev/iwi/if_iwi.c index 4d71550f512e..3a410a5cbf2c 100644 --- a/sys/dev/iwi/if_iwi.c +++ b/sys/dev/iwi/if_iwi.c @@ -927,8 +927,8 @@ iwi_media_status(if_t ifp, struct ifmediareq *imr) /* read current transmission rate from adapter */ ni = ieee80211_ref_node(vap->iv_bss); - ni->ni_txrate = - iwi_cvtrate(CSR_READ_4(sc, IWI_CSR_CURRENT_TX_RATE)); + ieee80211_node_set_txrate_dot11rate(ni, + iwi_cvtrate(CSR_READ_4(sc, IWI_CSR_CURRENT_TX_RATE))); ieee80211_free_node(ni); ieee80211_media_status(ifp, imr); } diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 248bfd056580..bfe8c3635c7c 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -3445,7 +3445,7 @@ iwm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt, struct ieee80211_node *ni = &in->in_ni; struct ieee80211vap *vap = ni->ni_vap; int status = le16toh(tx_resp->status.status) & IWM_TX_STATUS_MSK; - int new_rate, cur_rate = vap->iv_bss->ni_txrate; + int new_rate, cur_rate; boolean_t rate_matched; uint8_t tx_resp_rate; @@ -3463,6 +3463,7 @@ iwm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt, le32toh(tx_resp->initial_rate), (int) le16toh(tx_resp->wireless_media_time)); + cur_rate = ieee80211_node_get_txrate_dot11rate(vap->iv_bss); tx_resp_rate = iwm_rate_from_ucode_rate(le32toh(tx_resp->initial_rate)); /* For rate control, ignore frames sent at different initial rate */ @@ -3502,7 +3503,7 @@ iwm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt, ieee80211_ratectl_tx_complete(ni, txs); int rix = ieee80211_ratectl_rate(vap->iv_bss, NULL, 0); - new_rate = vap->iv_bss->ni_txrate; + new_rate = ieee80211_node_get_txrate_dot11rate(vap->iv_bss); if (new_rate != 0 && new_rate != cur_rate) { struct iwm_node *in = IWM_NODE(vap->iv_bss); iwm_setrates(sc, in, rix); @@ -3695,7 +3696,8 @@ iwm_tx_fill_cmd(struct iwm_softc *sc, struct iwm_node *in, } else { /* for data frames, use RS table */ IWM_DPRINTF(sc, IWM_DEBUG_TXRATE, "%s: DATA\n", __func__); - ridx = iwm_rate2ridx(sc, ni->ni_txrate); + ridx = iwm_rate2ridx(sc, + ieee80211_node_get_txrate_dot11rate(ni)); if (ridx == -1) ridx = 0; diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c index b887ebf842e1..b7c452a4f074 100644 --- a/sys/dev/iwn/if_iwn.c +++ b/sys/dev/iwn/if_iwn.c @@ -4570,7 +4570,7 @@ iwn_tx_data(struct iwn_softc *sc, struct mbuf *m, struct ieee80211_node *ni) else { /* XXX pass pktlen */ (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); } /* diff --git a/sys/dev/malo/if_malo.c b/sys/dev/malo/if_malo.c index 52419f377bb6..79a3213c6802 100644 --- a/sys/dev/malo/if_malo.c +++ b/sys/dev/malo/if_malo.c @@ -898,7 +898,7 @@ malo_updatetxrate(struct ieee80211_node *ni, int rix) static const int ieeerates[] = { 2, 4, 11, 22, 44, 12, 18, 24, 36, 48, 96, 108 }; if (rix < nitems(ieeerates)) - ni->ni_txrate = ieeerates[rix]; + ieee80211_node_set_txrate_dot11rate(ni, ieeerates[rix]); } static int diff --git a/sys/dev/mwl/if_mwl.c b/sys/dev/mwl/if_mwl.c index d0d13e576d31..2570cbce525b 100644 --- a/sys/dev/mwl/if_mwl.c +++ b/sys/dev/mwl/if_mwl.c @@ -3344,6 +3344,7 @@ mwl_tx_processq(struct mwl_softc *sc, struct mwl_txq *txq) ni = bf->bf_node; if (ni != NULL) { status = le32toh(ds->Status); + int rate; if (status & EAGLE_TXD_STATUS_OK) { uint16_t Format = le16toh(ds->Format); uint8_t txant = _IEEE80211_MASKSHIFT(Format, @@ -3356,14 +3357,14 @@ mwl_tx_processq(struct mwl_softc *sc, struct mwl_txq *txq) sc->sc_stats.mst_tx_mretries++; if (txq->qnum >= MWL_WME_AC_VO) ic->ic_wme.wme_hipri_traffic++; - ni->ni_txrate = _IEEE80211_MASKSHIFT(Format, + rate = _IEEE80211_MASKSHIFT(Format, EAGLE_TXD_RATE); if ((Format & EAGLE_TXD_FORMAT_HT) == 0) { - ni->ni_txrate = mwl_cvtlegacyrix( - ni->ni_txrate); + rate = mwl_cvtlegacyrix(rate); } else - ni->ni_txrate |= IEEE80211_RATE_MCS; - sc->sc_stats.mst_tx_rate = ni->ni_txrate; + rate |= IEEE80211_RATE_MCS; + sc->sc_stats.mst_tx_rate = rate; + ieee80211_node_set_txrate_dot11rate(ni, rate); } else { if (status & EAGLE_TXD_STATUS_FAILED_LINK_ERROR) sc->sc_stats.mst_tx_linkerror++; diff --git a/sys/dev/otus/if_otus.c b/sys/dev/otus/if_otus.c index a620a400bfd6..5919e75a59cf 100644 --- a/sys/dev/otus/if_otus.c +++ b/sys/dev/otus/if_otus.c @@ -2281,7 +2281,8 @@ otus_tx(struct otus_softc *sc, struct ieee80211_node *ni, struct mbuf *m, rate = otus_rate_to_hw_rate(sc, tp->ucastrate); else { (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = otus_rate_to_hw_rate(sc, ni->ni_txrate); + rate = otus_rate_to_hw_rate(sc, + ieee80211_node_get_txrate_dot11rate(ni)); } phyctl = 0; @@ -2346,9 +2347,11 @@ otus_tx(struct otus_softc *sc, struct ieee80211_node *ni, struct mbuf *m, data->m = m; OTUS_DPRINTF(sc, OTUS_DEBUG_XMIT, - "%s: tx: m=%p; data=%p; len=%d mac=0x%04x phy=0x%08x rate=0x%02x, ni_txrate=%d\n", + "%s: tx: m=%p; data=%p; len=%d mac=0x%04x phy=0x%08x " + "rate=0x%02x, dot11rate=%d\n", __func__, m, data, le16toh(head->len), macctl, phyctl, - (int) rate, (int) ni->ni_txrate); + (int) rate, + (int) ieee80211_node_get_txrate_dot11rate(ni)); /* Submit transfer */ STAILQ_INSERT_TAIL(&sc->sc_tx_pending[OTUS_BULK_TX], data, next); diff --git a/sys/dev/ral/rt2560.c b/sys/dev/ral/rt2560.c index aaae1245a9a1..09b01ea55be9 100644 --- a/sys/dev/ral/rt2560.c +++ b/sys/dev/ral/rt2560.c @@ -1740,7 +1740,7 @@ rt2560_tx_data(struct rt2560_softc *sc, struct mbuf *m0, rate = tp->ucastrate; } else { (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); } if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { @@ -1821,7 +1821,7 @@ rt2560_tx_data(struct rt2560_softc *sc, struct mbuf *m0, /* remember link conditions for rate adaptation algorithm */ if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE) { - data->rix = ni->ni_txrate; + data->rix = ieee80211_node_get_txrate_dot11rate(ni); /* XXX probably need last rssi value and not avg */ data->rssi = ic->ic_node_getrssi(ni); } else diff --git a/sys/dev/ral/rt2661.c b/sys/dev/ral/rt2661.c index 4912e1106fa6..38cd99d899ed 100644 --- a/sys/dev/ral/rt2661.c +++ b/sys/dev/ral/rt2661.c @@ -1431,7 +1431,7 @@ rt2661_tx_data(struct rt2661_softc *sc, struct mbuf *m0, rate = tp->ucastrate; } else { (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); } rate &= IEEE80211_RATE_VAL; @@ -1515,7 +1515,7 @@ rt2661_tx_data(struct rt2661_softc *sc, struct mbuf *m0, /* remember link conditions for rate adaptation algorithm */ if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE) { - data->rix = ni->ni_txrate; + data->rix = ieee80211_node_get_txrate_dot11rate(ni); /* XXX probably need last rssi value and not avg */ data->rssi = ic->ic_node_getrssi(ni); } else diff --git a/sys/dev/ral/rt2860.c b/sys/dev/ral/rt2860.c index e928de084bcb..1449df683a93 100644 --- a/sys/dev/ral/rt2860.c +++ b/sys/dev/ral/rt2860.c @@ -1493,7 +1493,7 @@ rt2860_tx(struct rt2860_softc *sc, struct mbuf *m, struct ieee80211_node *ni) rate = tp->ucastrate; } else { (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); } rate &= IEEE80211_RATE_VAL; diff --git a/sys/dev/rtwn/if_rtwn_tx.c b/sys/dev/rtwn/if_rtwn_tx.c index c59d1de1dea8..f355bc589143 100644 --- a/sys/dev/rtwn/if_rtwn_tx.c +++ b/sys/dev/rtwn/if_rtwn_tx.c @@ -143,7 +143,7 @@ rtwn_tx_data(struct rtwn_softc *sc, struct ieee80211_node *ni, if (sc->sc_ratectl == RTWN_RATECTL_NET80211) { /* XXX pass pktlen */ (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); } else { if (ni->ni_flags & IEEE80211_NODE_HT) rate = IEEE80211_RATE_MCS | 0x4; /* MCS4 */ diff --git a/sys/dev/usb/wlan/if_mtw.c b/sys/dev/usb/wlan/if_mtw.c index 51398134ff9d..b42ed336d18e 100644 --- a/sys/dev/usb/wlan/if_mtw.c +++ b/sys/dev/usb/wlan/if_mtw.c @@ -2155,7 +2155,7 @@ mtw_iter_func(void *arg, struct ieee80211_node *ni) uint32_t sta[3]; uint16_t(*wstat)[3]; int error, ridx; - + uint8_t txrate = 0; /* Check for special case */ if (sc->rvp_cnt <= 1 && vap->iv_opmode == IEEE80211_M_STA && @@ -2208,11 +2208,13 @@ mtw_iter_func(void *arg, struct ieee80211_node *ni) ieee80211_ratectl_tx_update(vap, txs); ieee80211_ratectl_rate(ni, NULL, 0); + txrate = ieee80211_node_get_txrate_dot11rate(ni); + /* XXX TODO: methodize with MCS rates */ for (ridx = 0; ridx < MTW_RIDX_MAX; ridx++) { MTW_DPRINTF(sc, MTW_DEBUG_RATE, "ni_txrate=0x%x\n", - ni->ni_txrate); - if (rt2860_rates[ridx].rate == ni->ni_txrate) { + txrate); + if (rt2860_rates[ridx].rate == txrate) { break; } } @@ -2221,7 +2223,7 @@ fail: MTW_UNLOCK(sc); MTW_DPRINTF(sc, MTW_DEBUG_RATE, "rate=%d, ridx=%d\n", - ni->ni_txrate, rn->amrr_ridx); + txrate, rn->amrr_ridx); } static void diff --git a/sys/dev/usb/wlan/if_rsu.c b/sys/dev/usb/wlan/if_rsu.c index c967435250ee..997a739562f6 100644 --- a/sys/dev/usb/wlan/if_rsu.c +++ b/sys/dev/usb/wlan/if_rsu.c @@ -1500,7 +1500,8 @@ rsu_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) ni = ieee80211_ref_node(vap->iv_bss); rs = &ni->ni_rates; /* Indicate highest supported rate. */ - ni->ni_txrate = rs->rs_rates[rs->rs_nrates - 1]; + ieee80211_node_set_txrate_dot11rate(ni, + rs->rs_rates[rs->rs_nrates - 1]); (void) rsu_set_fw_power_state(sc, RSU_PWR_SLEEP); ieee80211_free_node(ni); startcal = 1; diff --git a/sys/dev/usb/wlan/if_rum.c b/sys/dev/usb/wlan/if_rum.c index fc83409543ec..48674d84ffe3 100644 --- a/sys/dev/usb/wlan/if_rum.c +++ b/sys/dev/usb/wlan/if_rum.c @@ -1646,7 +1646,7 @@ rum_tx_data(struct rum_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) rate = tp->ucastrate; else { (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); } if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c index e709ceff8849..81f4d172241f 100644 --- a/sys/dev/usb/wlan/if_run.c +++ b/sys/dev/usb/wlan/if_run.c @@ -2685,6 +2685,7 @@ run_iter_func(void *arg, struct ieee80211_node *ni) union run_stats sta[2]; uint16_t (*wstat)[3]; int error, ridx; + uint8_t dot11rate; RUN_LOCK(sc); @@ -2737,15 +2738,17 @@ run_iter_func(void *arg, struct ieee80211_node *ni) ieee80211_ratectl_tx_update(vap, txs); ieee80211_ratectl_rate(ni, NULL, 0); /* XXX TODO: methodize with MCS rates */ + dot11rate = ieee80211_node_get_txrate_dot11rate(ni); for (ridx = 0; ridx < RT2860_RIDX_MAX; ridx++) - if (rt2860_rates[ridx].rate == ni->ni_txrate) + if (rt2860_rates[ridx].rate == dot11rate) break; rn->amrr_ridx = ridx; fail: RUN_UNLOCK(sc); - RUN_DPRINTF(sc, RUN_DEBUG_RATE, "rate=%d, ridx=%d\n", ni->ni_txrate, rn->amrr_ridx); + RUN_DPRINTF(sc, RUN_DEBUG_RATE, "rate=0x%02x, ridx=%d\n", + ieee80211_node_get_txrate_dot11rate(ni), rn->amrr_ridx); } static void diff --git a/sys/dev/usb/wlan/if_uath.c b/sys/dev/usb/wlan/if_uath.c index 10e3b50eaeb3..e4493ba50a30 100644 --- a/sys/dev/usb/wlan/if_uath.c +++ b/sys/dev/usb/wlan/if_uath.c @@ -2058,7 +2058,8 @@ uath_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) * Tx rate is controlled by firmware, report the maximum * negotiated rate in ifconfig output. */ - ni->ni_txrate = ni->ni_rates.rs_rates[ni->ni_rates.rs_nrates-1]; + ieee80211_node_set_txrate_dot11rate(ni, + ni->ni_rates.rs_rates[ni->ni_rates.rs_nrates-1]); if (uath_write_associd(sc) != 0) { device_printf(sc->sc_dev, diff --git a/sys/dev/usb/wlan/if_ural.c b/sys/dev/usb/wlan/if_ural.c index 6e01592da44f..c47b8cbeb3ae 100644 --- a/sys/dev/usb/wlan/if_ural.c +++ b/sys/dev/usb/wlan/if_ural.c @@ -1227,7 +1227,7 @@ ural_tx_data(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) rate = tp->ucastrate; else { (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); } if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { diff --git a/sys/dev/usb/wlan/if_zyd.c b/sys/dev/usb/wlan/if_zyd.c index 76e7d4312040..1815dc04cd09 100644 --- a/sys/dev/usb/wlan/if_zyd.c +++ b/sys/dev/usb/wlan/if_zyd.c @@ -2460,7 +2460,7 @@ zyd_tx_start(struct zyd_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) rate = tp->ucastrate; else { (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); } } diff --git a/sys/dev/wpi/if_wpi.c b/sys/dev/wpi/if_wpi.c index 11b8a749090d..471700ca9f5c 100644 --- a/sys/dev/wpi/if_wpi.c +++ b/sys/dev/wpi/if_wpi.c @@ -2821,7 +2821,7 @@ wpi_tx_data(struct wpi_softc *sc, struct mbuf *m, struct ieee80211_node *ni) else { /* XXX pass pktlen */ (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ni->ni_txrate; + rate = ieee80211_node_get_txrate_dot11rate(ni); } /* Encrypt the frame if need be. */ diff --git a/sys/dev/wtap/if_wtap.c b/sys/dev/wtap/if_wtap.c index f9e0c2a7e5c4..3aa3831e72c2 100644 --- a/sys/dev/wtap/if_wtap.c +++ b/sys/dev/wtap/if_wtap.c @@ -401,7 +401,7 @@ wtap_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], /* TODO this is a hack to force it to choose the rate we want */ ni = ieee80211_ref_node(vap->iv_bss); - ni->ni_txrate = 130; + ieee80211_node_set_txrate_ht_mcsrate(ni, 2); ieee80211_free_node(ni); return vap; } @@ -617,8 +617,7 @@ wtap_node_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) M_NOWAIT|M_ZERO); if (ni == NULL) return (NULL); - - ni->ni_txrate = 130; + ieee80211_node_set_txrate_ht_mcsrate(ni, 2); return ni; } From nobody Wed Feb 26 19:31:38 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z34NC26zSz5nl19; Wed, 26 Feb 2025 19:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34NB2nvzz3dBS; Wed, 26 Feb 2025 19:31:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598298; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BJRMgZsrYTOwenLB2LarIXgFJ/4QsVCLINx3Cp6XWSs=; b=XJcMe7rixVkBDrDiBa6DlQidTgRprWSO1doKDbJvLNJCD6yzZor8ZCnB7UZC6eKt7UGxSf S5ZF1C69MIlpyKymLW+VQcYSagd5z3B6llK8jiRaMUePa5itz4rFVPv31tAyjPoV2hSYvu EtHduszp+Nxa4Xi38AbArmyOaJBtnYTTLjQYPFnnb0AXstiNQ6GnppEJQGe6dsIFXYWqTh mdNbe5pTfvUnRzdbLRGe4DSCeAG4tB2vhSchrr7jixsQPavyPqg/Ep13PiC7Rf84LwZciy Y326LcBaWa3Tqsx8biKlIZwAiDzL+ohiyzlown8ayM9GeyNdu3rJSqjFEsrHzQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598298; a=rsa-sha256; cv=none; b=nAH+HoA/nmSMEMCWfsG4N/H6xPL1FCAyzgVdLD6pqPM1adteaiTQuMoS+HXAUY26HkTl10 8qm7fQ3Psq2YRxZpbMn4XCyxidGoQNdXWT4VOhtkAugKseXiLHMNcCnuy0RSWkNxfR58f4 1TNsINwCwoO3gwDy3WSfAkgHTpAwnXLCq6uZSZZ8urduwG4oWXHlWO5Dzm+llsq7rYSN2B 55P/e9tzP1iL9xAmpnApGNMy+Ql0IE4fLSAs6CdyIBt2QdV3yutUskXdxTHMdsdp7HvtCs TnthhjjlrFCwTDHeNPxqJPuol3nYHBYIciXVUVXtT4SCCh+eB23tBoPEDZTUSA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598298; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BJRMgZsrYTOwenLB2LarIXgFJ/4QsVCLINx3Cp6XWSs=; b=tJflNKfsGzDvkoPyQ1EzTM89aDfaDjKzSyvIq1i3jezTPHCtJdAr2k1FGdTAVVtjoXHiWy S6UvlfqZ3fd8JI/uyu+Pv4ij5nFgDbE9LJNzRnXSQEsLL+agJChJTGn6YvPgGWbxflV62a Keb+aWK7EwaE3fVvqaS82BQITNpOrD+Zxx9WcBZtyq2bdmvVlWg9PqPf4V/1w7TbJRYj23 cMrmHZ7yAxr5GspRrjgrQzzckgw6TZSm79k6ERFYShqWx7iKaop+kTt5UAOoJyS0Zl0zpz O97ONjJMF51LgXTFQWWl2lpu5GZ1LG9Iq9xDZeLYtcUphV5qzAy9D/dwor4Ovw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z34NB29Ltz1P2G; Wed, 26 Feb 2025 19:31:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QJVcsn017585; Wed, 26 Feb 2025 19:31:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVc6S017582; Wed, 26 Feb 2025 19:31:38 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:38 GMT Message-Id: <202502261931.51QJVc6S017582@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 378eeae502e2 - main - net80211: convert ni_txrate to a struct, with extra rate information List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 378eeae502e2d556733d20edaac8dc1ac5573d6d Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=378eeae502e2d556733d20edaac8dc1ac5573d6d commit 378eeae502e2d556733d20edaac8dc1ac5573d6d Author: Adrian Chadd AuthorDate: 2025-01-12 23:58:58 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:29:39 +0000 net80211: convert ni_txrate to a struct, with extra rate information * create struct ieee80211_node_txrate, which represents both the existing legacy / HT rates, and makes space for VHT rates * convert the ieee80211_node_* routines that manipulate the txrate field to use the new format * return OFDM6 for now if a VHT rate is set but the driver calls ieee80211_node_get_txrate_dot11rate(). It SHOULD be the lowest available rate - which for 11b will be a CCK rate, for turbo/half/quarter will be different rates! - but this is just for development. This should be a no-op for existing drivers and rate control, as everything now uses the accessor functions instead of directly accessing ni->ni_txrate. Locally tested: * RTL8821AU, STA mode (5GHz VHT/40) Differential Revision: https://reviews.freebsd.org/D48604 Reviewed by: bz, thj --- sys/net80211/ieee80211_ddb.c | 5 ++- sys/net80211/ieee80211_node.c | 94 ++++++++++++++++++++++++++++++++++++++----- sys/net80211/ieee80211_node.h | 21 +++++++++- 3 files changed, 108 insertions(+), 12 deletions(-) diff --git a/sys/net80211/ieee80211_ddb.c b/sys/net80211/ieee80211_ddb.c index 05b370eafa38..5dbb20dfe8e0 100644 --- a/sys/net80211/ieee80211_ddb.c +++ b/sys/net80211/ieee80211_ddb.c @@ -306,8 +306,9 @@ _db_show_sta(const struct ieee80211_node *ni) if (ni->ni_rx_ampdu[i].rxa_flags) _db_show_rxampdu("\t", i, &ni->ni_rx_ampdu[i]); - db_printf("\tinact %u inact_reload %u txrate %u\n", - ni->ni_inact, ni->ni_inact_reload, ni->ni_txrate); + db_printf("\tinact %u inact_reload %u txrate type %d rate %u\n", + ni->ni_inact, ni->ni_inact_reload, ni->ni_txrate.type, + ni->ni_txrate.dot11rate); #ifdef IEEE80211_SUPPORT_MESH _db_show_ssid("\tmeshid ", 0, ni->ni_meshidlen, ni->ni_meshid); db_printf(" mlstate %b mllid 0x%x mlpid 0x%x mlrcnt %u mltval %u\n", diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index f5b05ed769c9..01f7c8904237 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -2667,8 +2667,10 @@ ieee80211_dump_node(struct ieee80211_node_table *nt __unused, ni->ni_esslen, ni->ni_essid, (ni->ni_chan != IEEE80211_CHAN_ANYC) ? ni->ni_chan->ic_freq : 0, (ni->ni_chan != IEEE80211_CHAN_ANYC) ? ni->ni_chan->ic_flags : 0); - printf("\tinact %u inact_reload %u txrate %u\n", - ni->ni_inact, ni->ni_inact_reload, ni->ni_txrate); + printf("\tinact %u inact_reload %u txrate type %d dot11rate %u\n", + ni->ni_inact, ni->ni_inact_reload, + ni->ni_txrate.type, + ni->ni_txrate.dot11rate); printf("\thtcap %x htparam %x htctlchan %u ht2ndchan %u\n", ni->ni_htcap, ni->ni_htparam, ni->ni_htctlchan, ni->ni_ht2ndchan); @@ -3138,19 +3140,73 @@ ieee80211_getsignal(struct ieee80211vap *vap, int8_t *rssi, int8_t *noise) *rssi = ieee80211_getrssi(vap); } +/** + * @brief return a dot11rate / ratecode representing the current transmit rate + * + * This is the API call for legacy / 802.11n drivers and rate control APIs + * which expect a dot11rate / ratecode representation for legacy and HT MCS + * rates. + * + * Drivers which support VHT should not use this API, as it will log an error + * and return a low rate if a VHT rate is selected. + * + * @param ni the ieee80211_node to return the transmit rate for + * @returns the dot11rate / ratecode for legacy/MCS, or the + * lowest available dot11rate if it's VHT (and shouldn't + * have been called.) + */ uint8_t ieee80211_node_get_txrate_dot11rate(struct ieee80211_node *ni) { - return (ni->ni_txrate); + switch (ni->ni_txrate.type) { + case IEEE80211_NODE_TXRATE_LEGACY: + case IEEE80211_NODE_TXRATE_HT: + return (ni->ni_txrate.dot11rate); + break; + case IEEE80211_NODE_TXRATE_VHT: + default: + printf("%s: called for VHT / unknown rate (type %d)!\n", + __func__, ni->ni_txrate.type); + return (12); /* OFDM6 for now */ + } } +/** + * @brief set the dot11rate / ratecode representing the current transmit rate + * + * This is the API call for legacy / 802.11n drivers and rate control APIs + * which expect a dot11rate / ratecode representation for legacy and HT MCS + * rates. + * + * @param ni the ieee80211_node to return the transmit rate for + * @param dot11rate the dot11rate rate code to use + */ void ieee80211_node_set_txrate_dot11rate(struct ieee80211_node *ni, uint8_t dot11Rate) { - ni->ni_txrate = dot11Rate; + if (dot11Rate & IEEE80211_RATE_MCS) { + ni->ni_txrate.type = IEEE80211_NODE_TXRATE_HT; + ni->ni_txrate.mcs = dot11Rate & IEEE80211_RATE_VAL; + ni->ni_txrate.nss = 0; + ni->ni_txrate.dot11rate = dot11Rate; + } else { + ni->ni_txrate.type = IEEE80211_NODE_TXRATE_LEGACY; + ni->ni_txrate.mcs = ni->ni_txrate.nss = 0; + ni->ni_txrate.dot11rate = dot11Rate; + } } +/** + * @brief set the dot11rate / ratecode representing the current HT transmit rate + * + * This is the API call for 802.11n drivers and rate control APIs + * which expect a dot11rate / ratecode representation for legacy and HT MCS + * rates. It expects an MCS rate code from 0 .. 76. + * + * @param ni the ieee80211_node to return the transmit rate for + * @param mcs the MCS rate to select + */ void ieee80211_node_set_txrate_ht_mcsrate(struct ieee80211_node *ni, uint8_t mcs) @@ -3160,7 +3216,11 @@ ieee80211_node_set_txrate_ht_mcsrate(struct ieee80211_node *ni, ic_printf(ni->ni_ic, "%s: invalid MCS (%d)\n", __func__, mcs); return; } - ni->ni_txrate = IEEE80211_RATE_MCS | mcs; + + ni->ni_txrate.type = IEEE80211_NODE_TXRATE_HT; + ni->ni_txrate.mcs = mcs; + ni->ni_txrate.nss = 0; + ni->ni_txrate.dot11rate = IEEE80211_RATE_MCS | mcs; } @@ -3177,10 +3237,26 @@ ieee80211_node_get_txrate_kbit(struct ieee80211_node *ni) { uint32_t mbps; - if (ni->ni_txrate & IEEE80211_RATE_MCS) { - const struct ieee80211_mcs_rates *mcs = - &ieee80211_htrates[ni->ni_txrate & ~IEEE80211_RATE_MCS]; + /* + * TODO: only handle legacy/HT rates, VHT will need + * to use other logic. + */ + switch (ni->ni_txrate.type) { + case IEEE80211_NODE_TXRATE_LEGACY: + case IEEE80211_NODE_TXRATE_HT: + break; + case IEEE80211_NODE_TXRATE_VHT: + default: + printf("%s: called for VHT / unknown rate (type %d)!\n", + __func__, ni->ni_txrate.type); + return (0); + } + /* Legacy / MCS rates */ + if (ni->ni_txrate.dot11rate & IEEE80211_RATE_MCS) { + const struct ieee80211_mcs_rates *mcs = + &ieee80211_htrates[ni->ni_txrate.dot11rate & + ~IEEE80211_RATE_MCS]; if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) { /* Note: these are in 1/2Mbit/s units */ if (ni->ni_flags & IEEE80211_NODE_SGI40) @@ -3195,7 +3271,7 @@ ieee80211_node_get_txrate_kbit(struct ieee80211_node *ni) } } else /* Note: CCK/OFDM dot11rate entries are in 1/2Mbit/s units */ - mbps = ni->ni_txrate; + mbps = ni->ni_txrate.dot11rate; /* * Note; 'mbps' in 1/2 Mbit/s units so *500 to make it in kbit/s units. diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h index 722f3d54a00b..859b8b0288a1 100644 --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -139,6 +139,20 @@ ieee80211_ni_chw_to_str(enum ieee80211_sta_rx_bw bw) } } +enum ieee80211_node_txrate_type { + IEEE80211_NODE_TXRATE_UNDEFINED = 0, + IEEE80211_NODE_TXRATE_LEGACY = 1, /* CCK/OFDM, HT for now */ + IEEE80211_NODE_TXRATE_HT = 2, /* HT */ + IEEE80211_NODE_TXRATE_VHT = 3, /* VHT */ +}; + +struct ieee80211_node_txrate { + enum ieee80211_node_txrate_type type; + uint8_t nss; /* VHT - number of spatial streams */ + uint8_t mcs; /* HT/VHT - MCS */ + uint8_t dot11rate; /* Legacy/HT - dot11rate / ratecode */ +}; + /* * Node specific information. Note that drivers are expected * to derive from this structure to add device-specific per-node @@ -275,7 +289,7 @@ struct ieee80211_node { /* others */ short ni_inact; /* inactivity mark count */ short ni_inact_reload;/* inactivity reload value */ - int ni_txrate; /* legacy rate/MCS */ + struct ieee80211_node_txrate ni_txrate; /* current transmit rate */ struct ieee80211_psq ni_psq; /* power save queue */ struct ieee80211_nodestats ni_stats; /* per-node statistics */ @@ -499,6 +513,11 @@ void ieee80211_node_leave(struct ieee80211_node *); int8_t ieee80211_getrssi(struct ieee80211vap *); void ieee80211_getsignal(struct ieee80211vap *, int8_t *, int8_t *); +/* + * Node transmit rate specific manipulation. + * + * This should eventually be refactored into its own type. + */ uint8_t ieee80211_node_get_txrate_dot11rate(struct ieee80211_node *); void ieee80211_node_set_txrate_dot11rate(struct ieee80211_node *, uint8_t); void ieee80211_node_set_txrate_ht_mcsrate(struct ieee80211_node *, uint8_t); From nobody Wed Feb 26 19:31:39 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z34NC5Sl0z5nkgv; Wed, 26 Feb 2025 19:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34NC3cRcz3dXn; Wed, 26 Feb 2025 19:31:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598299; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bcnsk/MzukAmZDePM/BXV8PQfWXUXUxSRcWj5ifpxFE=; b=X9UvL/+jwo057rGrN2xyJR8XQUN/HKzoRcm/UVaFH2m/mTqVtjrP6pSZVUFGlSE3/X0+dT i5eF4vhF0gyEBvLUipWJ+Ebrxo+ngLAcxqzWUZS37+80dSuO1MpbVUbiPbElKpuBjmT0qX 2Wht1HpJR7HBzro0tnWCsYMBxL3lDsZv2JfcdhWjXWW2S3KMOt4pwmFcgjIwExnDUnbai0 y5WpBjcoNUGYE0q1g5AXafwd2SlD9hxsZi/2PdG69Y+ozmG74GlB78znFF5h1lAMXgC1Bv yyp+rDJU/SIQNoZ0EC6M2ixgLUI7dXYnncWOJi/MaYMWnt8R/O6J41eqmSqq9Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598299; a=rsa-sha256; cv=none; b=Tg0qK5Rf5wOVN6C8DpeFYb04qJcVu3SqUtbnBYUUzhdL8+dbPLZE5Y8YY41dOGZGH3zVvB H3wpzcQMD5WvkeApNAlYOk0Of3EeuE1RrQ41Er1FFteBFmDEsAgtPfh1KBiESqhQF1GBFw QL1aQRxbDZKWkVwvAumCL01l7uP5WE2DDUAZr87BXdtZzWxl1jc/wfw8v/mDMJqadbonAu jpr6ZZtMg59x9uNPala6flKFiJH8Cla6uD/XZesCtgoD6Umufu5XM2TDE+Qd4wbxAwuAKH 90r7tFD1k+XxpRmRkL0ldmMrT2waJdSlEcuY9crZMKJmK2uZjttUYoChO9IHFA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598299; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bcnsk/MzukAmZDePM/BXV8PQfWXUXUxSRcWj5ifpxFE=; b=aEatGo8OTaaKt23bkaw3mnzLyz5cfLNETGuBzR2AqKQS8sKBijrVqh6zt03GTazSqa8Oo1 eOji3u3qQfeaI+DIAO5qG282lCeviVJLqsBvSI4zAiUs+ubSdngn0cYH4F+hLW8TaAa5FC Q+ez29yr6bCtICzo7yFM2B8JMAj460HufXw2KzOfRwrkdj1tmH3YRpn6Bjhv/Uttmr5nOf s4P5nnobNW/TtYqkqddL3XqOIha87XjzrZfTYpOzEg48HbeoqLw6XFGP4h491H6prSsbUV GJtRSpKYAB+Cf54Of4v5npEBC/d8gYuJ2hcAOK40VYtqxafy0OtOZjXb2B2KWQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z34NC36C0z1P6y; Wed, 26 Feb 2025 19:31:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QJVd8e017623; Wed, 26 Feb 2025 19:31:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVdkN017620; Wed, 26 Feb 2025 19:31:39 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:39 GMT Message-Id: <202502261931.51QJVdkN017620@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 0da0a5fc73e6 - main - net80211: add ieee80211_node_get_txrate() to populate the "new" transmit struct List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0da0a5fc73e66c8839ebc8455dd12a9c3c273d5a Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=0da0a5fc73e66c8839ebc8455dd12a9c3c273d5a commit 0da0a5fc73e66c8839ebc8455dd12a9c3c273d5a Author: Adrian Chadd AuthorDate: 2025-01-13 02:13:51 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:29:52 +0000 net80211: add ieee80211_node_get_txrate() to populate the "new" transmit struct ieee80211_node_get_txrate() populates the passed-in ieee80211_node_txrate with the current rate configuration. This is a no-op - nothing is yet setting VHT rates. Differential Revision: https://reviews.freebsd.org/D48605 Reviewed by: bz --- sys/net80211/ieee80211_node.c | 20 ++++++++++++++++++++ sys/net80211/ieee80211_node.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 01f7c8904237..c781280d5e8a 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -3171,6 +3171,26 @@ ieee80211_node_get_txrate_dot11rate(struct ieee80211_node *ni) } } +/** + * @brief return the txrate representing the current transmit rate + * + * This is the API call for drivers and rate control APIs to fetch + * rates. It will populate a struct ieee80211_node_txrate with the + * current rate configuration to use. + * + * @param ni the ieee80211_node to return the transmit rate for + * @param txrate the struct ieee80211_node_txrate to populate + */ +void +ieee80211_node_get_txrate(struct ieee80211_node *ni, + struct ieee80211_node_txrate *txr) +{ + MPASS(ni != NULL); + MPASS(txr != NULL); + + *txr = ni->ni_txrate; +} + /** * @brief set the dot11rate / ratecode representing the current transmit rate * diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h index 859b8b0288a1..bb14c8c4bb42 100644 --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -519,6 +519,8 @@ void ieee80211_getsignal(struct ieee80211vap *, int8_t *, int8_t *); * This should eventually be refactored into its own type. */ uint8_t ieee80211_node_get_txrate_dot11rate(struct ieee80211_node *); +void ieee80211_node_get_txrate(struct ieee80211_node *, + struct ieee80211_node_txrate *); void ieee80211_node_set_txrate_dot11rate(struct ieee80211_node *, uint8_t); void ieee80211_node_set_txrate_ht_mcsrate(struct ieee80211_node *, uint8_t); uint32_t ieee80211_node_get_txrate_kbit(struct ieee80211_node *); From nobody Wed Feb 26 19:31:40 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z34NF2XLSz5nl5G; Wed, 26 Feb 2025 19:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34ND4GxLz3d5L; Wed, 26 Feb 2025 19:31:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598300; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=L6GBab9aJ98IHHUGTi1HejEdNJvQOjpaPxKpm6b+sk0=; b=cRcrAZNOSCxOrwPlRzlZYoyOYjKnjQOyCpWo/0VUzg5V/Sa6DtPpd2b3TVW686StX3WKV+ A2bBLCgDdA6gSSUyqOn0THFF52RBZeVr3XmlixmzxU/Fsb2Wa57jiTY4trUlnHLKmY6yxV 0D0Z5wgeWDUO9FEXlsv9p7Cv0XYrRa2yTT8CogY9FYSJgY4DN0rMQIK76deNzBZNGhPPav ++Rvfz4kf20Y1/YcWxnxIksU9SFwAfVKP2rwRrFzzEpVTDxRpd+5vxSE6HHzkrNG7CXVvI I9XRY6ZwdOty/VyqZ3dTDPfLJbFBjLgHxxfAFTJCV+nrMz6Aahm8rP0Jk/VUAQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598300; a=rsa-sha256; cv=none; b=vtPDjDbIveN5HOkypapd/7UoUlEpSzjDTAHjmjLekuL1aTliVmiUMHzM+2ygHWnsu+CGQI wmZj1hPHtbWCSRpxeJI66t1m2UzgMAJbTcDgfmI/pOFeyFJ7T2cBAqhy8PFyFx+vq39jSc sEIVOPxYxNyZCQtgMN/fA+Avu9pnExjZO16gwAq/vVgXACf8uNxSXj+J1/Kml1URnLc0Jg QHcA5RfAlU4NhsJFZ4D2XV3mqqTatjMebIgHV3Sp2NH6gnj4ohdbm9YQYKJ1tOOapu05sg s4LWjfuPWss+ySiPvYZdg/RMRFj6+ipP6BPpd61Hupa3oLilciGWRSWE1gpnrg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598300; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=L6GBab9aJ98IHHUGTi1HejEdNJvQOjpaPxKpm6b+sk0=; b=Zx8hHlgybw1dk4Lml39ooC2gTWVRjC5KRAPor3nLmvNfiKEJx3lSWaq+B8DV6j2hDnXLGW yVm5/46j3/tGkNR23JE62JFwZfGhQRv7XR6QNJicPwScIQAx8+2forY9OWqd0AEDpFiLsj LSjbDo47+ImWxpTjfiTjo02LxbZOZ3hDr7ixdxBAzu4WEmy8vpZG0nCl/xKjpyAnXpim/j AF47thIWviCRzeGmVhscGOEv2DpnCJIfyFSMHcyFuf9Uduv8MJ/F5MOQKu/A3xQk1RAk+P cEtHSlhQ0ifPPBpqUZOT4SR5PArnfTuQOidLZAAZtxQqXC4lKACymQEc53LoRg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z34ND3lVvz1P9p; Wed, 26 Feb 2025 19:31:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QJVeE9017657; Wed, 26 Feb 2025 19:31:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVemW017654; Wed, 26 Feb 2025 19:31:40 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:40 GMT Message-Id: <202502261931.51QJVemW017654@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: fdc884161187 - main - rtwn: move to using ieee80211_node_get_txrate() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fdc88416118759692fb1773deffe298e86cc902b Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=fdc88416118759692fb1773deffe298e86cc902b commit fdc88416118759692fb1773deffe298e86cc902b Author: Adrian Chadd AuthorDate: 2025-01-13 02:15:05 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:30:01 +0000 rtwn: move to using ieee80211_node_get_txrate() Migrate the transmit path to use ieee80211_node_get_txrate(), and handle VHT rates. Nothing is currently setting VHT rates, but the driver should now be ready. Differential Revision: https://reviews.freebsd.org/D48606 Reviewed by: bz --- sys/dev/rtwn/if_rtwn_tx.c | 49 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/sys/dev/rtwn/if_rtwn_tx.c b/sys/dev/rtwn/if_rtwn_tx.c index f355bc589143..2c9c246dfbb4 100644 --- a/sys/dev/rtwn/if_rtwn_tx.c +++ b/sys/dev/rtwn/if_rtwn_tx.c @@ -105,6 +105,33 @@ rtwn_get_cipher(u_int ic_cipher) return (cipher); } +static uint8_t +rtwn_tx_ratectl_to_ridx(struct rtwn_softc *sc, struct ieee80211_node *ni, + struct ieee80211_node_txrate *txr) +{ + /* TODO: this should be based on the node channel */ + struct ieee80211com *ic = &sc->sc_ic; + uint8_t ridx; + + switch (txr->type) { + case IEEE80211_NODE_TXRATE_LEGACY: + case IEEE80211_NODE_TXRATE_HT: + ridx = rate2ridx(txr->dot11rate); + break; + case IEEE80211_NODE_TXRATE_VHT: + ridx = RTWN_RIDX_VHT_MCS(txr->nss - 1, txr->mcs); + break; + default: + if (ic->ic_curmode != IEEE80211_MODE_11B) + ridx = RTWN_RIDX_OFDM36; + else + ridx = RTWN_RIDX_CCK55; + break; + } + + return (ridx); +} + static int rtwn_tx_data(struct rtwn_softc *sc, struct ieee80211_node *ni, struct mbuf *m) @@ -116,7 +143,7 @@ rtwn_tx_data(struct rtwn_softc *sc, struct ieee80211_node *ni, struct ieee80211_frame *wh; struct rtwn_tx_desc_common *txd; struct rtwn_tx_buf buf; - uint8_t rate, ridx, type; + uint8_t ridx, type; bool force_rate = false; u_int cipher; int ismcast; @@ -131,31 +158,31 @@ rtwn_tx_data(struct rtwn_softc *sc, struct ieee80211_node *ni, if (type == IEEE80211_FC0_TYPE_MGT || type == IEEE80211_FC0_TYPE_CTL || (m->m_flags & M_EAPOL) != 0) { - rate = tp->mgmtrate; + ridx = rate2ridx(tp->mgmtrate); force_rate = true; } else if (ismcast) { + ridx = rate2ridx(tp->mcastrate); force_rate = true; - rate = tp->mcastrate; } else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) { + ridx = rate2ridx(tp->ucastrate); force_rate = true; - rate = tp->ucastrate; } else { if (sc->sc_ratectl == RTWN_RATECTL_NET80211) { + struct ieee80211_node_txrate txr = { 0 }; /* XXX pass pktlen */ - (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ieee80211_node_get_txrate_dot11rate(ni); + ieee80211_ratectl_rate(ni, NULL, 0); + ieee80211_node_get_txrate(ni, &txr); + ridx = rtwn_tx_ratectl_to_ridx(sc, ni, &txr); } else { if (ni->ni_flags & IEEE80211_NODE_HT) - rate = IEEE80211_RATE_MCS | 0x4; /* MCS4 */ + ridx = rate2ridx(IEEE80211_RATE_MCS | 0x4); /* MCS4 */ else if (ic->ic_curmode != IEEE80211_MODE_11B) - rate = ridx2rate[RTWN_RIDX_OFDM36]; + ridx = RTWN_RIDX_OFDM36; else - rate = ridx2rate[RTWN_RIDX_CCK55]; + ridx = RTWN_RIDX_CCK55; } } - ridx = rate2ridx(rate); - cipher = IEEE80211_CIPHER_NONE; if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { k = ieee80211_crypto_encap(ni, m); From nobody Wed Feb 26 19:31:41 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z34NG04T7z5nl1B; Wed, 26 Feb 2025 19:31:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34NF5R8kz3dbJ; Wed, 26 Feb 2025 19:31:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598301; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NOKZbIdrOLrVQE+2ZO1TpV053XqhCV1sVjwaO+lW/+U=; b=M+awjHB3rkfeAzKI3+oAoKi7ei0uoIWpDkGaflvvKZKiTjLB3uZESngW4bj1uc6n13mvB3 vZTc8nBNuXtljftxKLGreImp5x1P1OX7Aq7Yvv/PgvYWo2KcBS10mpE1EJNK5bcgMzzl5y d7yhht/2fvgNHVqUnYK+6Lob6MunBPIqTJfQi98cQihYfGCz+CjVmdmeaFBqJ6ibIBeRlO L/ZEOuXpOmOygKMYFbci6H2Z4V2dD5M50KaYdbvPnJIyjqvwYqmbNUoD20q29JqjBg0Xul WJ2/rFFLQ2BkxJuW3cYuwiO516tnZoDEWFWZIHPpf+RBeWIL1eR+uKirXv3o1Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598301; a=rsa-sha256; cv=none; b=FGKjG+O88WBRV0wvfcHX7cRn4+BkLkRWSawOU6qaZxbCVqLi74Ic3MJPGLNDnDFIRdMt9w hRQZ1OGux05u1qi4YMWw9xSQfiuEAzgmDwK3tmqTeIp49hbSbjbY2MtiH2vf1AiXeV0p0e /obMxeiaSA30jaXAXRo6OvOajEobiohs71Ca94SHVklekOyRzlkasqqYWZjLBgTy2mXEOq jWxJaNuonQ/UZBQY0U1id2MhsD34x2dDjEkt/Wq68Ikj0/nLWw4QQVrV75oFMQ+XInfPZH Bpb3Mi3/RJlK6++N9E2H7teTfQqwWqKz7EQm/kf59OfESLcWuZtOUc9fIu9Qqg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598301; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NOKZbIdrOLrVQE+2ZO1TpV053XqhCV1sVjwaO+lW/+U=; b=S1w4rntrXDRlmeYz1YvpPPWU0ftPQIMzL3evHFPDRuZKsx8IFfcLgALylPXaab4OQHAkgR 72u57lJpJwIK9/f2vJ0szvu4NW1sXUHf7SYxecX0+NEs/tac1l0YDT85s3vp2MWhAfOoIv JVYlAsQPjQth54frF8qtJt5dnZUdIGT1+FNEJImayJhZGyUeHh/EvoVexiYvDCRKlbSjK4 izMtf75yEulXdUr7EraWWnrf+aNeDOG3HYeYhT213/t0g+znVZhazn0/MI98fVHycnZCH8 LG8cd2pA5V7n/E36v80PJbbUam1ACIWRYNX3rG0hCEdq9RvcbaQD5G2hthRJdw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z34NF4nwWz1P9r; Wed, 26 Feb 2025 19:31:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QJVf2u017691; Wed, 26 Feb 2025 19:31:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVfQN017688; Wed, 26 Feb 2025 19:31:41 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:41 GMT Message-Id: <202502261931.51QJVfQN017688@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 1c746222c2ef - main - net80211: Implement ieee80211_setup_vht_rates() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1c746222c2ef25d2caa7578217ce92b637a1ee3d Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=1c746222c2ef25d2caa7578217ce92b637a1ee3d commit 1c746222c2ef25d2caa7578217ce92b637a1ee3d Author: Adrian Chadd AuthorDate: 2025-01-13 05:17:36 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:30:23 +0000 net80211: Implement ieee80211_setup_vht_rates() Implement ieee80211_setup_vht_rates() - calculate the intersection between the peers advertised RX VHT MCS map and the vap's configured TX map. Whilst here, remove the unused vhtcap/vhtinfo fields; they're already populated in the ieee80211_node before ieee80211_setup_vht_rates() is called. Differential Revision: https://reviews.freebsd.org/D48607 Reviewed by: bz --- sys/net80211/ieee80211_ddb.c | 4 +-- sys/net80211/ieee80211_node.c | 7 ++--- sys/net80211/ieee80211_node.h | 4 +-- sys/net80211/ieee80211_sta.c | 2 +- sys/net80211/ieee80211_vht.c | 61 +++++++++++++++++++++++++++++++++++++++---- sys/net80211/ieee80211_vht.h | 3 +-- 6 files changed, 64 insertions(+), 17 deletions(-) diff --git a/sys/net80211/ieee80211_ddb.c b/sys/net80211/ieee80211_ddb.c index 5dbb20dfe8e0..3c57b03ddc65 100644 --- a/sys/net80211/ieee80211_ddb.c +++ b/sys/net80211/ieee80211_ddb.c @@ -317,9 +317,9 @@ _db_show_sta(const struct ieee80211_node *ni) #endif /* VHT state */ - db_printf("\tvhtcap %b vht_basicmcs %#06x vht_pad2 %#06x\n", + db_printf("\tvhtcap %b vht_basicmcs %#06x vht_tx_map %#06x\n", ni->ni_vhtcap, IEEE80211_VHTCAP_BITS, - ni->ni_vht_basicmcs, ni->ni_vht_pad2); + ni->ni_vht_basicmcs, ni->ni_vht_tx_map); db_printf("\tvht_mcsinfo: { rx_mcs_map %#06x rx_highest %#06x " "tx_mcs_map %#06x tx_highest %#06x }\n", ni->ni_vht_mcsinfo.rx_mcs_map, ni->ni_vht_mcsinfo.rx_highest, diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index c781280d5e8a..5a239bbd30f6 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -1044,8 +1044,7 @@ ieee80211_sta_join(struct ieee80211vap *vap, struct ieee80211_channel *chan, ieee80211_vht_updateparams(ni, ni->ni_ies.vhtcap_ie, ni->ni_ies.vhtopmode_ie); - ieee80211_setup_vht_rates(ni, ni->ni_ies.vhtcap_ie, - ni->ni_ies.vhtopmode_ie); + ieee80211_setup_vht_rates(ni); do_ht = 1; } } @@ -1874,9 +1873,7 @@ ieee80211_init_neighbor(struct ieee80211_node *ni, ieee80211_vht_updateparams(ni, ni->ni_ies.vhtcap_ie, ni->ni_ies.vhtopmode_ie); - ieee80211_setup_vht_rates(ni, - ni->ni_ies.vhtcap_ie, - ni->ni_ies.vhtopmode_ie); + ieee80211_setup_vht_rates(ni); } } diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h index bb14c8c4bb42..969d8e563fa9 100644 --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -274,8 +274,8 @@ struct ieee80211_node { /* VHT state */ uint32_t ni_vhtcap; - uint16_t ni_vht_basicmcs; - uint16_t ni_vht_pad2; + uint16_t ni_vht_basicmcs; /* Basic VHT MCS bitmap from IE */ + uint16_t ni_vht_tx_map; /* Negotiated MCS TX map with peer */ struct ieee80211_vht_mcs_info ni_vht_mcsinfo; uint8_t ni_vht_chan1; /* 20/40/80/160 - VHT chan1 */ uint8_t ni_vht_chan2; /* 80+80 - VHT chan2 */ diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c index 96603f339710..48d56d0ad217 100644 --- a/sys/net80211/ieee80211_sta.c +++ b/sys/net80211/ieee80211_sta.c @@ -1875,7 +1875,7 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype, } else { ieee80211_vht_node_init(ni); ieee80211_vht_updateparams(ni, vhtcap, vhtopmode); - ieee80211_setup_vht_rates(ni, vhtcap, vhtopmode); + ieee80211_setup_vht_rates(ni); } } diff --git a/sys/net80211/ieee80211_vht.c b/sys/net80211/ieee80211_vht.c index 82879f90c67b..e704e0cbd176 100644 --- a/sys/net80211/ieee80211_vht.c +++ b/sys/net80211/ieee80211_vht.c @@ -284,14 +284,65 @@ ieee80211_vht_updateparams(struct ieee80211_node *ni, return (0); } +/** + * @brief calculate the supported MCS rates for this node + * + * This is called once a node has finished association / + * joined a BSS. The vhtcap / vhtop IEs are from the + * peer. The transmit rate tables need to be combined + * together to setup the list of available rates. + * + * This must be called after the ieee80211_node VHT fields + * have been parsed / populated by either ieee80211_vht_updateparams() or + * ieee80211_parse_vhtcap(), + * + * This does not take into account the channel bandwidth, + * which (a) may change during operation, and (b) depends + * upon packet to packet rate transmission selection. + * There are various rate combinations which are not + * available in various channel widths and those will + * need to be masked off separately. + * + * (See 802.11-2020 21.5 Parameters for VHT-MCSs for the + * tables and supported rates.) + * + * ALSO: i need to do some filtering based on the HT set too. + * (That should be done here too, and in the negotiation, sigh.) + * (See 802.11-2016 10.7.12.3 Additional rate selection constraints + * for VHT PPDUs) + * + * @param ni struct ieee80211_node to configure + */ void -ieee80211_setup_vht_rates(struct ieee80211_node *ni, - const uint8_t *vhtcap_ie, - const uint8_t *vhtop_ie) +ieee80211_setup_vht_rates(struct ieee80211_node *ni) { + struct ieee80211vap *vap = ni->ni_vap; + uint32_t val, val1, val2; + uint16_t tx_mcs_map = 0; + int i; - //printf("%s: called\n", __func__); - /* XXX TODO */ + /* + * Merge our tx_mcs_map with the peer rx_mcs_map to determine what + * can be actually transmitted to the peer. + */ + + for (i = 0; i < 8; i++) { + /* + * Merge the two together; remember that 0..2 is in order + * of increasing MCS support, but 3 equals + * IEEE80211_VHT_MCS_NOT_SUPPORTED so must "win". + */ + val1 = (vap->iv_vht_cap.supp_mcs.tx_mcs_map >> (i*2)) & 0x3; + val2 = (ni->ni_vht_mcsinfo.rx_mcs_map >> (i*2)) & 0x3; + val = MIN(val1, val2); + if (val1 == IEEE80211_VHT_MCS_NOT_SUPPORTED || + val2 == IEEE80211_VHT_MCS_NOT_SUPPORTED) + val = IEEE80211_VHT_MCS_NOT_SUPPORTED; + tx_mcs_map |= (val << (i*2)); + } + + /* Store the TX MCS map somewhere in the node that can be used */ + ni->ni_vht_tx_map = tx_mcs_map; } void diff --git a/sys/net80211/ieee80211_vht.h b/sys/net80211/ieee80211_vht.h index bcb61020c5a1..a61804a43059 100644 --- a/sys/net80211/ieee80211_vht.h +++ b/sys/net80211/ieee80211_vht.h @@ -40,8 +40,7 @@ void ieee80211_parse_vhtcap(struct ieee80211_node *, const uint8_t *); int ieee80211_vht_updateparams(struct ieee80211_node *, const uint8_t *, const uint8_t *); -void ieee80211_setup_vht_rates(struct ieee80211_node *, - const uint8_t *, const uint8_t *); +void ieee80211_setup_vht_rates(struct ieee80211_node *); void ieee80211_vht_timeout(struct ieee80211vap *vap); From nobody Wed Feb 26 19:31:44 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z34NL1lcKz5nksT; Wed, 26 Feb 2025 19:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34NK2djDz3d5y; Wed, 26 Feb 2025 19:31:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BIvViSubOXdXcUHNhCySB9O291kV0SEMGEECIM1GLw4=; b=rU5IA5VTD0aUd+qiKaWunbqymp+2zoeUDyt8tVGPu03cTBAvZkreqQBkpwgJmPuTIa0gDS ztjXWJlAgU6JlZaqSIR5LwDOjv2ANwowFu/pp7o7IK7Uc7BWoZ3o6I8tuTSetRH6vmAhUR I2jcpNn/2aXTOv9Mh9sjwPDHq6cr2MMqF4CMNnYqJcs7mLcz+Ua1v6AzoWlQTWg7suhZ+2 SYIRur5hnG7AXnVqv4wNs58Qg8jTM6qQlwv+tTdv5KTluA4zGmUGeI6J9zHncnnk6Z08xo 0bB2Qif5y+/UtJEEC1/PdowXLS40NR0u54ePXpRkuC5UpNemI26mZJivhoenvQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598305; a=rsa-sha256; cv=none; b=hWxSM+wlaTQb0NkcYDbR2F5MHHVXniUYyPqlcX3q9K8Q3qjdlxf2f+C9QSDRuFknPk6Qo0 iCXBTE57K096hG3iOQPBIR794Uob06kKfP4PtCP8frHs5kL/UeEIczliBJt/CiUTFN+R71 SvuuZVUMD7Kn3fxQczSSBqO72FPfDZs0ADkbkcpu2dsyGtOz+oPklo4NzNDCtGrgHVtLPU MlCAPjMryuntgxjjD9dr+G1RvRIBSKnd53dDfenmHkr2HEbaI9337FvtQT0kUDpRaq5olr khEPd51lUEfRWENeg/5+qnWAVi84XkYe0irEGNg+m2ZJ/aqZRcOn8UO1aKPHGg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BIvViSubOXdXcUHNhCySB9O291kV0SEMGEECIM1GLw4=; b=LsqYkPHpNh5UuFrGjyxEj5Q6HBSClVjQAFaMaKUuSYuxom/CglLLdbxCgQzSIty/dQK1Gn LU7AVaWL2eDO2281dMlGnulgcKYxkZW3pTHb8QUd6wonPX57mNv7BKtr3vsdE1r9uzjl0w Tg5W7QHorxo90ltxb4nlRKZuwYc/qHyLLq//FIK2nw8wcWUePpslY/FihmwuqgMnGuIkXP oDguyYXb4hZQVkFG9efybs2o9m4ic7fPmsx26/8ppw3Ei8JHc1fucCtrgaJB57hduEBTj3 hpdlJwoDxPdouhsa/PP4BQkbsl9pQj/r8T31m6IrqpkJox18hdOLWsJ0Ngq2rg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z34NK0ST7z1P70; Wed, 26 Feb 2025 19:31:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QJVi8Q017800; Wed, 26 Feb 2025 19:31:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVi5i017797; Wed, 26 Feb 2025 19:31:44 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:44 GMT Message-Id: <202502261931.51QJVi5i017797@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 7b0e3c5b2b74 - main - net80211: add ieee80211_vht_node_check_tx_valid_mcs() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7b0e3c5b2b74f6e249d2820dbac6e420338bd226 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=7b0e3c5b2b74f6e249d2820dbac6e420338bd226 commit 7b0e3c5b2b74f6e249d2820dbac6e420338bd226 Author: Adrian Chadd AuthorDate: 2025-01-23 02:18:07 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:31:02 +0000 net80211: add ieee80211_vht_node_check_tx_valid_mcs() Introduce ieee80211_vht_node_check_tx_valid_mcs(), which takes the node, bandwidth, NSS and MCS and validates whether that is possible to TX to the given node. Differential Revision: https://reviews.freebsd.org/D48610 Reviewed by: bz, thj --- sys/net80211/ieee80211_vht.c | 49 ++++++++++++++++++++++++++++++++++++++++++++ sys/net80211/ieee80211_vht.h | 2 ++ 2 files changed, 51 insertions(+) diff --git a/sys/net80211/ieee80211_vht.c b/sys/net80211/ieee80211_vht.c index e704e0cbd176..703447945845 100644 --- a/sys/net80211/ieee80211_vht.c +++ b/sys/net80211/ieee80211_vht.c @@ -1061,3 +1061,52 @@ ieee80211_vht_check_tx_bw(const struct ieee80211_node *ni, return (false); } } + +/** + * @brief Check if the given VHT bw/nss/mcs combination is valid + * for the give node. + * + * This checks whether the given VHT bw/nss/mcs is valid based on + * the negotiated rate mask in the node. + * + * @param ni struct ieee80211_node node to check + * @param bw channel bandwidth to check + * @param nss NSS + * @param mcs MCS + * @returns True if this combination is available, false otherwise. + */ +bool +ieee80211_vht_node_check_tx_valid_mcs(const struct ieee80211_node *ni, + enum ieee80211_sta_rx_bw bw, uint8_t nss, uint8_t mcs) +{ + uint8_t mc; + + /* Validate arguments */ + if (nss < 1 || nss > 8) + return (false); + if (mcs > 9) + return (false); + + /* Check our choice of rate is actually valid */ + if (!ieee80211_phy_vht_validate_mcs(bw, nss, mcs)) + return (false); + + /* + * Next, check if the MCS rate is available for the + * given NSS. + */ + mc = ni->ni_vht_tx_map >> (2*(nss-1)) & 0x3; + switch (mc) { + case IEEE80211_VHT_MCS_NOT_SUPPORTED: + /* Not supported at this NSS */ + return (false); + case IEEE80211_VHT_MCS_SUPPORT_0_9: + return (mcs <= 9); + case IEEE80211_VHT_MCS_SUPPORT_0_8: + return (mcs <= 8); + case IEEE80211_VHT_MCS_SUPPORT_0_7: + return (mcs <= 7); + default: + return (false); + } +} diff --git a/sys/net80211/ieee80211_vht.h b/sys/net80211/ieee80211_vht.h index a61804a43059..2964de63c343 100644 --- a/sys/net80211/ieee80211_vht.h +++ b/sys/net80211/ieee80211_vht.h @@ -67,5 +67,7 @@ void ieee80211_vht_get_vhtinfo_ie(struct ieee80211_node *ni, bool ieee80211_vht_check_tx_vht(const struct ieee80211_node *); bool ieee80211_vht_check_tx_bw(const struct ieee80211_node *, enum ieee80211_sta_rx_bw); +bool ieee80211_vht_node_check_tx_valid_mcs(const struct ieee80211_node *, + enum ieee80211_sta_rx_bw bw, uint8_t, uint8_t); #endif /* _NET80211_IEEE80211_VHT_H_ */ From nobody Wed Feb 26 19:31:42 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z34NH4RyJz5nl4b; Wed, 26 Feb 2025 19:31:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34NG6TjWz3dLR; Wed, 26 Feb 2025 19:31:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598302; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1WQZEy+Cw2D4wUmf5EMx4im6lOTn8tWDC0SSTbmXOM4=; b=iuMDvwvHMVMXyFfvWmzvcQ0WyscpFOMzvStPV2ubbuDTtowbHicOUy+HLX9jvO/xTyaS1U GNhhce4tqbxEryrdXRcL5o93sDDFgjD0WDztHK6WW/t8rW4ZB0B5k67qTOZJECGYftQYrb 5wG+kHRvtKXCnGLUtBJg6gvGiwi999jwAx4qD/9KoZbbEv2LsUFyiKnGjN0A1+D6gY71mj GUCh8KobKDWNe9tFGPfQjQCXfkWW/MIFEVjJBouUXYQJ8j7GL25+UZN+h1PTEMVI3AReKc DcIyjKJ7Kt563WmVg7LGhE3t/JSdgbtkIaoVfV5skRe2c+iuLk0TscmkXGk0ZA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598302; a=rsa-sha256; cv=none; b=YGSNeK2+swBmgF1cLah0uosf1zkynZ4JIRL7GhypAKn530CS0KNn8jmLvOyzRROCbcIU/v 16x2SaL1lVhUOQjJTuv6ydVYd3cYMjEujo6dwO1Hq1/InuFj1AlCM8Sp/rYrSW3PhBkvns e8W6CPAZ323xnKHg+zT7dikgJn1u0gEmK7W6iHwF9E7GPtldn2AJ7lKiipBrnZdt5x5Qh+ R0Xq27m3gC9Ckl74ncX5l5kYGpCuVNRqfZvWBoRyoAk+IsICrrVoQC9NN7Xfkq6ZeJgY3o fw+uXnqy7CKk0P+vunEg1AhbA0zw8NRNkSCRyo6bpRpfh9GdQn7tcz7Bwk6kSw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598302; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1WQZEy+Cw2D4wUmf5EMx4im6lOTn8tWDC0SSTbmXOM4=; b=Hy16R00bGc8tKXcH7VV/AOStlRCUhGYfuOVJjQ/QFNSUoB/054VGhkgsYIlyOIwirBj5K3 yOGumCQFvExw2ajV7sv5lYk3czeX2rQyymkakNJGieOs4Fr8bKSNgGhLr4cnzIZh//tTP3 OofjQkPnpPQ4s23dccscp9JVMT8YH54VxV5wyxOBeOe55oYxv22vR50Ww3JvaoMB7aVVfh OESpCAHfnipmsKY0XOE7f2AceKqatJ99EqdQFQb8v/cRO3xJm+cf85o6fWmvEvACm8oo7O fYGyySXYOgiEc7buoBySyFuNuY7BRqZSM/63g6gfSBTy+Iyx2uZ9UMTD1Ob4gw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z34NG5qspz1NX8; Wed, 26 Feb 2025 19:31:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QJVgGv017725; Wed, 26 Feb 2025 19:31:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVgTT017722; Wed, 26 Feb 2025 19:31:42 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:42 GMT Message-Id: <202502261931.51QJVgTT017722@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 1568caaf5721 - main - net80211: add valid VHT MCS combinations and helper functions List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1568caaf572125b883aa6d0ed7f87b87ab0c9d45 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=1568caaf572125b883aa6d0ed7f87b87ab0c9d45 commit 1568caaf572125b883aa6d0ed7f87b87ab0c9d45 Author: Adrian Chadd AuthorDate: 2025-01-13 05:47:37 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:30:51 +0000 net80211: add valid VHT MCS combinations and helper functions Not all NSS / MCS / channel bandwidth combinations are valid. This will be important for rate control and transmit rate setup (eg static management, unicast, multicast rates.) This is based on 802.11-2020 Section 21.5 (Parameters for VHT-MCSs.) Differential Revision: https://reviews.freebsd.org/D48608 Reviewed by: bz --- sys/net80211/ieee80211_phy.c | 86 ++++++++++++++++++++++++++++++++++++++++++++ sys/net80211/ieee80211_phy.h | 7 ++++ 2 files changed, 93 insertions(+) diff --git a/sys/net80211/ieee80211_phy.c b/sys/net80211/ieee80211_phy.c index eaad7dde0653..9c2b1197564a 100644 --- a/sys/net80211/ieee80211_phy.c +++ b/sys/net80211/ieee80211_phy.c @@ -621,3 +621,89 @@ ieee80211_compute_duration_ht(uint32_t frameLen, uint16_t rate, #undef HT_L_LTF #undef HT_L_STF #undef OFDM_PLCP_BITS + + +/* + * A bitmask of allowable rates for each spatial stream + * and bandwidth. + * + * This is based on 802.11-2020 21.5 (Parameters for VHT-MCSs.) + * + * Not all MCS rate / channel widths are valid, as there needs + * to be an integer number of symbols and the number of tones + * available for each channel bandwidth doesn't result in + * an integer value. + */ +static uint16_t ieee80211_vht_mcs_allowed_list_20[] = { + 0x01ff, 0x01ff, 0x03ff, 0x01ff, 0x01ff, 0x03ff, 0x01ff, 0x01ff, +}; + +static uint16_t ieee80211_vht_mcs_allowed_list_40[] = { + 0x03ff, 0x03ff, 0x03ff, 0x03ff, 0x03ff, 0x03ff, 0x03ff, 0x03ff, +}; + +static uint16_t ieee80211_vht_mcs_allowed_list_80[] = { + 0x03ff, 0x03ff, 0x03bf, 0x03ff, 0x03ff, 0x01ff, 0x03bf, 0x03ff, +}; + +static uint16_t ieee80211_vht_mcs_allowed_list_160[] = { + 0x03ff, 0x03ff, 0x01ff, 0x03ff, 0x03ff, 0x03ff, 0x03ff, 0x03ff, +}; + +/** + * @brief Fetch the allowable MCS mask for the given channel bandwidth and NSS + * + * Return a bitmask of valid MCS rates from 0..9 given a channel bandwith + * and number of spatial streams. + * + * See 802.11-2020 21.5 (Parameters for VHT-MCSs) for more details. + * + * @param bw channel bandwidth, via enum ieee80211_sta_rx_bw + * @param nss number of spatial streams, 1..8 + * @returns bitmask of valid MCS rates from 0..9 + */ +uint16_t +ieee80211_phy_vht_get_mcs_mask(enum ieee80211_sta_rx_bw bw, uint8_t nss) +{ + if (nss == 0 || nss > 8) + return (0); + + switch (bw) { + case IEEE80211_STA_RX_BW_20: + return (ieee80211_vht_mcs_allowed_list_20[nss - 1]); + case IEEE80211_STA_RX_BW_40: + return (ieee80211_vht_mcs_allowed_list_40[nss - 1]); + case IEEE80211_STA_RX_BW_80: + return (ieee80211_vht_mcs_allowed_list_80[nss - 1]); + case IEEE80211_STA_RX_BW_160: + return (ieee80211_vht_mcs_allowed_list_160[nss - 1]); + case IEEE80211_STA_RX_BW_320: + /* invalid for VHT */ + return (0); + } +} + +/** + * @brief Check if the given NSS/MCS combination is valid for the given channel + * bandwidth + * + * See 802.11-2020 21.5 (Parameters for VHT-MCSs) for more details. + * + * @param bw channel bandwidth, via enum ieee80211_sta_rx_bw + * @param nss number of spatial streams, 1..8 + * @param mcs MCS rate, 0..9 + * @retval true if the NSS / MCS / bandwidth combination is valid + * @retval false if the NSS / MCS / bandwidth combination is not valid + */ +bool +ieee80211_phy_vht_validate_mcs(enum ieee80211_sta_rx_bw bw, uint8_t nss, + uint8_t mcs) +{ + uint16_t mask; + + mask = ieee80211_phy_vht_get_mcs_mask(bw, nss); + if (mask == 0) + return (false); + + return ((mask & (1 << mcs)) != 0); +} diff --git a/sys/net80211/ieee80211_phy.h b/sys/net80211/ieee80211_phy.h index f73abaff85d0..466f59584f2c 100644 --- a/sys/net80211/ieee80211_phy.h +++ b/sys/net80211/ieee80211_phy.h @@ -221,5 +221,12 @@ uint32_t ieee80211_compute_duration_ht(uint32_t frameLen, uint16_t rate, int streams, int isht40, int isShortGI); +enum ieee80211_sta_rx_bw; + +uint16_t ieee80211_phy_vht_get_mcs_mask(enum ieee80211_sta_rx_bw, + uint8_t); +bool ieee80211_phy_vht_validate_mcs(enum ieee80211_sta_rx_bw, + uint8_t, uint8_t); + #endif /* _KERNEL */ #endif /* !_NET80211_IEEE80211_PHY_H_ */ From nobody Wed Feb 26 19:31:43 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z34NK34Ksz5nl5P; Wed, 26 Feb 2025 19:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34NJ0jt5z3dY9; Wed, 26 Feb 2025 19:31:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598304; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k/OdvO6KM2kveG2la6gTIOEujkR75h2UR3GI3oNhMtw=; b=ARHGf4j0w+utvEEILS+aad863oza510QuyWmR1OMhyE82V5c6icmU/VVk3HaC4darna7oh IRMZMKxR9egTlkP3Uxe45uIFmo32PL5OOtedAgUwToJ0ss0Kk+VQMPZw8mwjeBSza8oGpn CV81d87jB7G9GR5dtEygzf2uC4srns17tPQG5vDuUU6C2BuWjVHXcTVQZgkiEZo3CskvJ6 omCt6OymlG6HFswPfvjgcUakQv3Re+UJAuxwFRa/BPYV3m/U09/zWfrBICE+SJe9JdZBnC flQxKjNDnxtufLE1pVSBeHSJt9SsZs40lfe6uCn4yahDmLwNoiHjq8ED4MGAsA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598304; a=rsa-sha256; cv=none; b=IBmeTxrmDBcKZE84qq2Jhk40ncGvVEHZPhuQ16MNLqx2MQbS8E7BFdUtZn3MJlpV81dAG3 uic4yXtbyIoL4CKeUcyKDkixpiDzBtEGHWUkT3H6Kk+J46a5BlkDVdky+gQJaZm+eMQmYq cgQNC1tmm9DUcdXdmEZ3PitRYYHKp6oRwOIF2FmDMbOylr+iu4ilRlKZYQ6tWwczBUk2jc hnKvdOov4JfS45iktM2iYUz15+/DeFHgZisqaAtsMH87bq5pDbOqIsIMvJnOh1owShUY3O UZqmczg+u8gDOk3GROtLmfOEpw+nJ87/idKfpnm9g0KhvNQ7pFCne/sFHbeQTw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598304; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k/OdvO6KM2kveG2la6gTIOEujkR75h2UR3GI3oNhMtw=; b=iuPkbQ1IpDjkkaeH6ISy3VUZsXhITkKwQ89+8pvE84sADJD6xbNj2moAeOIXbZQXGFyArc j0Sz7ZfOOIndIJWijjLU16ePx0Qpcu/Bm1afJttnrO9iGwLklXe3s1LbxMQxQy8IkIRZ5g 5jO2RfhIppOvpx0+qV1HoHXqX2/byg53bJVfV/mWWLxT3BFZxXrbMpwUsUc0LhIM5sBDK8 yP5uJbrWvAzGSYilnu42QaDSL2zKvwzJl/zjQ31S7vB1xr3jyNG2vb9tAOYPZRMcW/R4hM qXBUOJ+O7leDGRo1fzyEHXj1dnxekEyOsb9f4vkne74sAyH+38s3kcREnygT4A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z34NH6vHsz1PYl; Wed, 26 Feb 2025 19:31:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QJVhjb017761; Wed, 26 Feb 2025 19:31:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVhp8017757; Wed, 26 Feb 2025 19:31:43 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:43 GMT Message-Id: <202502261931.51QJVhp8017757@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 1086f7bab303 - main - net80211: add node VHT transmit rate helper functions List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1086f7bab303cc61b3dce1ae51cb008675ad758a Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=1086f7bab303cc61b3dce1ae51cb008675ad758a commit 1086f7bab303cc61b3dce1ae51cb008675ad758a Author: Adrian Chadd AuthorDate: 2025-01-13 05:50:34 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:30:51 +0000 net80211: add node VHT transmit rate helper functions * add a node VHT transmit function, which configures the parameters accordingly. * add a node VHT transmit function which just copies in another ieee80211_node_txrate struct. Differential Revision: https://reviews.freebsd.org/D48609 Reviewed by: bz --- sys/net80211/ieee80211_node.c | 40 ++++++++++++++++++++++++++++++++++++++++ sys/net80211/ieee80211_node.h | 4 ++++ 2 files changed, 44 insertions(+) diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 5a239bbd30f6..bc0358feb7a8 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -3188,6 +3188,26 @@ ieee80211_node_get_txrate(struct ieee80211_node *ni, *txr = ni->ni_txrate; } +/** + * @brief Set the txrate representing the current transmit rate + * + * This is the API call for drivers and rate control APIs to set + * rates. It will copy a struct ieee80211_node_txrate with the + * current rate configuration to use. + * + * @param ni the ieee80211_node to return the transmit rate for + * @param txrate the struct ieee80211_node_txrate to copy to the node + */ +void +ieee80211_node_set_txrate(struct ieee80211_node *ni, + const struct ieee80211_node_txrate *txr) +{ + MPASS(ni != NULL); + MPASS(txr != NULL); + + ni->ni_txrate = *txr; +} + /** * @brief set the dot11rate / ratecode representing the current transmit rate * @@ -3240,6 +3260,26 @@ ieee80211_node_set_txrate_ht_mcsrate(struct ieee80211_node *ni, ni->ni_txrate.dot11rate = IEEE80211_RATE_MCS | mcs; } +/** + * @brief set the rate to the given VHT transmission rate. + * + * This sets the current transmit rate to the given VHT NSS/MCS. + * + * @param ni the ieee80211_node to set the transmit rate for + * @param nss the number of spatial streams + * @param mcs the MCS rate to select + */ +void +ieee80211_node_set_txrate_vht_rate(struct ieee80211_node *ni, + uint8_t nss, uint8_t mcs) +{ + MPASS(ni != NULL); + + ni->ni_txrate.type = IEEE80211_NODE_TXRATE_VHT; + ni->ni_txrate.mcs = mcs; + ni->ni_txrate.nss = nss; + ni->ni_txrate.dot11rate = 0; +} /* * @brief Fetch the transmit rate for the given node in kbit/s. diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h index 969d8e563fa9..ae5f72a070b6 100644 --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -521,8 +521,12 @@ void ieee80211_getsignal(struct ieee80211vap *, int8_t *, int8_t *); uint8_t ieee80211_node_get_txrate_dot11rate(struct ieee80211_node *); void ieee80211_node_get_txrate(struct ieee80211_node *, struct ieee80211_node_txrate *); +void ieee80211_node_set_txrate(struct ieee80211_node *, + const struct ieee80211_node_txrate *); void ieee80211_node_set_txrate_dot11rate(struct ieee80211_node *, uint8_t); void ieee80211_node_set_txrate_ht_mcsrate(struct ieee80211_node *, uint8_t); uint32_t ieee80211_node_get_txrate_kbit(struct ieee80211_node *); +void ieee80211_node_set_txrate_vht_rate(struct ieee80211_node *ni, + uint8_t nss, uint8_t mcs); #endif /* _NET80211_IEEE80211_NODE_H_ */ From nobody Wed Feb 26 19:31:47 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z34NM4y89z5nl4j; Wed, 26 Feb 2025 19:31:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34NM25zXz3dc5; Wed, 26 Feb 2025 19:31:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598307; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oDvP8aL56FvIDrRi3fh52p82raU38XdfNqb4Hk33rlw=; b=oaN2v6JPySKvJ9NMvsxoed2ijoeAhs7uiyZD6+5ATskshTZyFQioJTITj7/GM6oDGdIahZ ykx0l2KiX6LfSXCsG7Otc9OX3RUFM4YCI33fw9uFFhPUrCZVJKUW7t+wb0dtbIF4S2yqzu 44SFTrB6yR/knbxDxgl2GSV1xMGs5KjAR25epPkIauZQV7bxYpVreSjbe/IZoduVtQEPzl Pft+0cg+g35Rw3RfA+EP9afiQZlc3HzuDD1lI4R3S2KCswL8shtArAyoG2ZqNf1GWTzXHe DjZf2YzkjsIsXUjpN11WY8HtvKdcIP3bwHnqpY32y7hw/x0QTeOY8/HHgGNtYw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598307; a=rsa-sha256; cv=none; b=sebjhtjh3yzp4L9V4kVzEhgr9hscCTIDrYDacE0N04nlxbykZgCYq5iGzu8OJE8ctX9y4n KbvWeC1LzlUBnsuZKhd6VVZDDXQyTG22R3FIUCMmlT0luP508ZhU3W8e4B3h0vn7qqFRGF jru+XnbRlGP1dVH1WzuloJ3YQxB7yK64pPGEwal4XAeFBxEOKdrCa74iQdGMH1XzWTpkZk bJ7aIyKa2Rf5poJXATMZmnZNAgfcpPdqr/1yZ0fwtnJIejh7ef260RW2u642yvGQSo4jJB EzQz6+8wFmLizgFjCI34G59JClAhiGNw88i2lWbPTiWUcMyggGUQYgm0xE/VZw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598307; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oDvP8aL56FvIDrRi3fh52p82raU38XdfNqb4Hk33rlw=; b=ssgynmVrXXhL5VMnK3Cd/JFue0wrzw6mWVPnAZcl+sYSh9sHJNThl1BG2x1YPxsfFYksGP vfUyy6P8HsdHm9Ai6KiT50jDSaGUliQpjFRPS4KtHI+5fZ32i3BnSWpNdySTuqvWz41ehj mvkNtSfmSRpJKDnesfJXQgJEFl/+Q+EEetBALufqz5r69pQShM1u2Dou6Cbu6n4KZNvOUm Kd2ObfmXNi2tGJySVt9BK2/PxLjSOHBdi8DeEc9URJyalmtj8OEcEKzVjLvBlFT2MzzUI2 uTTNF3dTD0Fy9075Jj4Zn3n4dLK+CuDLH+QxOzUX1f9jfKYYgZMLMe4AVswq6Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z34NM1Msbz1Pgj; Wed, 26 Feb 2025 19:31:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QJVl6L018821; Wed, 26 Feb 2025 19:31:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVl8d018818; Wed, 26 Feb 2025 19:31:47 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:47 GMT Message-Id: <202502261931.51QJVl8d018818@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 078acac88264 - main - net80211: refactor amrr_node_init() into HT and legacy paths List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 078acac882642ac5c88409d2f3e9d04acdcc63cc Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=078acac882642ac5c88409d2f3e9d04acdcc63cc commit 078acac882642ac5c88409d2f3e9d04acdcc63cc Author: Adrian Chadd AuthorDate: 2025-01-04 02:53:01 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:31:24 +0000 net80211: refactor amrr_node_init() into HT and legacy paths Refactor amrr_node_init() into HT and legacy paths, clean up the printing to be a bit clearer about the selected rates. This is precursor work to setting VHT rates in ni->ni_txrate . Differential Revision: https://reviews.freebsd.org/D48429 --- sys/net80211/ieee80211_amrr.c | 121 +++++++++++++++++++++++++----------------- 1 file changed, 73 insertions(+), 48 deletions(-) diff --git a/sys/net80211/ieee80211_amrr.c b/sys/net80211/ieee80211_amrr.c index 20e90026bfe9..352f8df3a03e 100644 --- a/sys/net80211/ieee80211_amrr.c +++ b/sys/net80211/ieee80211_amrr.c @@ -138,14 +138,79 @@ amrr_deinit(struct ieee80211vap *vap) nrefs--; /* XXX locking */ } +static void +amrr_node_init_ht(struct ieee80211_node *ni) +{ + const struct ieee80211_rateset *rs; + struct ieee80211_amrr_node *amn = ni->ni_rctls; + uint8_t rate; /* dot11rate */ + + rs = (struct ieee80211_rateset *) &ni->ni_htrates; + /* Initial rate - lowest */ + rate = rs->rs_rates[0]; + + /* Pick something low that's likely to succeed */ + for (amn->amn_rix = rs->rs_nrates - 1; amn->amn_rix > 0; + amn->amn_rix--) { + /* 11n - stop at MCS4 */ + if ((rs->rs_rates[amn->amn_rix] & 0x1f) < 4) + break; + } + rate = rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL; + + /* Ensure the MCS bit is set */ + rate |= IEEE80211_RATE_MCS; + + /* Assign initial rate from the rateset */ + ieee80211_node_set_txrate_dot11rate(ni, rate); + + /* XXX TODO: we really need a rate-to-string method */ + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, + "AMRR: nrates=%d, initial rate MCS %d", + rs->rs_nrates, + (rate & IEEE80211_RATE_VAL)); +} + +static void +amrr_node_init_legacy(struct ieee80211_node *ni) +{ + const struct ieee80211_rateset *rs; + struct ieee80211_amrr_node *amn = ni->ni_rctls; + uint8_t rate; /* dot11rate */ + + rs = &ni->ni_rates; + /* Initial rate - lowest */ + rate = rs->rs_rates[0]; + + /* Clear the basic rate flag if it's not 11n */ + rate &= IEEE80211_RATE_VAL; + + /* Pick something low that's likely to succeed */ + for (amn->amn_rix = rs->rs_nrates - 1; amn->amn_rix > 0; + amn->amn_rix--) { + /* legacy - anything < 36mbit, stop searching */ + if ((rs->rs_rates[amn->amn_rix] & + IEEE80211_RATE_VAL) <= 72) + break; + } + rate = rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL; + + /* Assign initial rate from the rateset */ + ieee80211_node_set_txrate_dot11rate(ni, rate); + + /* XXX TODO: we really need a rate-to-string method */ + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, + "AMRR: nrates=%d, initial rate %d Mb", + rs->rs_nrates, + (rate & IEEE80211_RATE_VAL) / 2); +} + static void amrr_node_init(struct ieee80211_node *ni) { - const struct ieee80211_rateset *rs = NULL; struct ieee80211vap *vap = ni->ni_vap; struct ieee80211_amrr *amrr = vap->iv_rs; struct ieee80211_amrr_node *amn; - uint8_t rate; if (!amrr) { if_printf(vap->iv_ifp, "ratectl structure was not allocated, " @@ -163,60 +228,20 @@ amrr_node_init(struct ieee80211_node *ni) } } else amn = ni->ni_rctls; + + /* Common state */ amn->amn_amrr = amrr; amn->amn_success = 0; amn->amn_recovery = 0; amn->amn_txcnt = amn->amn_retrycnt = 0; amn->amn_success_threshold = amrr->amrr_min_success_threshold; + amn->amn_ticks = ticks; /* 11n or not? Pick the right rateset */ - if (ieee80211_ht_check_tx_ht(ni)) { - /* XXX ew */ - IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "%s: 11n node", __func__); - rs = (struct ieee80211_rateset *) &ni->ni_htrates; - } else { - IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "%s: non-11n node", __func__); - rs = &ni->ni_rates; - } - - /* Initial rate - lowest */ - rate = rs->rs_rates[0]; - - /* XXX clear the basic rate flag if it's not 11n */ - if (! ieee80211_ht_check_tx_ht(ni)) - rate &= IEEE80211_RATE_VAL; - - /* pick initial rate from the rateset - HT or otherwise */ - /* Pick something low that's likely to succeed */ - for (amn->amn_rix = rs->rs_nrates - 1; amn->amn_rix > 0; - amn->amn_rix--) { - /* legacy - anything < 36mbit, stop searching */ - /* 11n - stop at MCS4 */ - if (ieee80211_ht_check_tx_ht(ni)) { - if ((rs->rs_rates[amn->amn_rix] & 0x1f) < 4) - break; - } else if ((rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL) <= 72) - break; - } - rate = rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL; - - /* if the rate is an 11n rate, ensure the MCS bit is set */ if (ieee80211_ht_check_tx_ht(ni)) - rate |= IEEE80211_RATE_MCS; - - /* Assign initial rate from the rateset */ - ieee80211_node_set_txrate_dot11rate(ni, rate); - amn->amn_ticks = ticks; - - /* XXX TODO: we really need a rate-to-string method */ - /* XXX TODO: non-11n rate should be divided by two.. */ - IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "AMRR: nrates=%d, initial rate %s%d", - rs->rs_nrates, - ieee80211_ht_check_tx_ht(ni) ? "MCS " : "", - rate & IEEE80211_RATE_VAL); + amrr_node_init_ht(ni); + else + amrr_node_init_legacy(ni); } static void From nobody Wed Feb 26 19:31:46 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z34NL5ybhz5nl5Q; Wed, 26 Feb 2025 19:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34NL2TFFz3dks; Wed, 26 Feb 2025 19:31:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=B8yvYP2DkJb7Fs/2RHYTpPb3jRswbnMEMltU9MgovvE=; b=yhuNZWMMXsSZf79yJvIBwaeLDGfKjvp0/lz+tsTo2GUpLubthvjs5IALqm7l6dUDFAkVDC 13QagPf2F+oCT0JsVJ1rxpRiy1ocX0C5PcZi6CsTg3Ev+/UrPFhkqcheKvjtWqn/FVXH/A 1t9qO6Qko20/hUuUnSLdrecF+v1ib3n6/BKg5Pj5UcednpMT8hvUz7PHBfWgCzhPHcmGgL R9KMYJh69kpW89iptPBpLdalE9dTOvv0kutkKXibfEkzTLZSmSTuDJiTZS0F7JKQhKSW/h Xz8hW1Bpo5HJ1KvvoSsm8i5z8W2CQpVWnevFpRERVgHT6ZYTYTLy6B+idGxlag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598306; a=rsa-sha256; cv=none; b=bRbabbJ3EGRWXKDQus1Oxl3i4ngNfFN5GXIwFzjx+1K0FKvtGvaplezY9UDIa4+4pmm1iA 6d7vvRtYmjYZY+bn499rO4/F9zHVhFEOLey08M+L73qpNv8sEfueItZoeBvu/12X4dD442 mzxWm0OkSPiR4Tap4xMDe5AAKucRdTGTUSKqhsY6mB5MrCI4qpFfOp6ZqFL0IHLyh9L8qS oPtoPBF8KSLc2RrBEPaDxyul3bFoa9ObORxQ7psaBHhiJjH8WAX+PdkSdeHFgkKjuB3OPC XJNai63wExBYIg7BCalv6ThP46MLJeesEWO+AQuFhXRYJ4KbxE5O8yhyLf5dqQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=B8yvYP2DkJb7Fs/2RHYTpPb3jRswbnMEMltU9MgovvE=; b=ih2I3gmhnSHm+SInvDZQbNyoTypjmChBFXgmc3lsJ+WAvsU8ExU0YHyM+BoMF5aGQorCx7 NFUJq2BfQnPEjhxxM6Yt/4yQ/sZmHwDd3CqXCHQF9hbbfEBl6MNKSnj35PXYDWt6rOD451 SU+VSvS6T20bvzrYeGaBB5bV7erZkrVNyI88hCz6XOogz2wCtXHkePi32iL3MKht6RzXNW YVjmrs3R1Yk+nCBJUha1ZbvOgVX/JIY2/cXuDseMk26ypF16ubZ23Aj+H5g7OQy3fqW9FH ry4UAILP5Jgdsxax4YFuc3QKuC2JlUrco7yeyaVOIVhkA0hzdiPiKU10+OhlDA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z34NL0szWz1PTx; Wed, 26 Feb 2025 19:31:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QJVkQM018485; Wed, 26 Feb 2025 19:31:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVkEC018472; Wed, 26 Feb 2025 19:31:46 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:46 GMT Message-Id: <202502261931.51QJVkEC018472@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: e99cbea414ff - main - net80211: refactor amrr_update() into HT and legacy paths List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e99cbea414ffa2c439a651e4726896ea8de99c83 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=e99cbea414ffa2c439a651e4726896ea8de99c83 commit e99cbea414ffa2c439a651e4726896ea8de99c83 Author: Adrian Chadd AuthorDate: 2024-12-29 19:38:51 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:31:21 +0000 net80211: refactor amrr_update() into HT and legacy paths Split the amrr_update() routine into HT and legacy paths. Currently they're the same, minus HT / non-HT specific comments and some logging changes. HT rates don't monotonically go up (ie, going MCS 7 -> MCS 8 is wrong, as MCS8 is "just" two stream MCS0) and failing a rate by a little shouldn't necessarily preclude testing the next rate up. This should be a no-op, besides the logging changes. Locally tested: * RTL8192CU, STA mode Differential Revision: https://reviews.freebsd.org/D48248 Reviewed by: bz, thj --- sys/net80211/ieee80211_amrr.c | 101 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 83 insertions(+), 18 deletions(-) diff --git a/sys/net80211/ieee80211_amrr.c b/sys/net80211/ieee80211_amrr.c index d366bf71e367..20e90026bfe9 100644 --- a/sys/net80211/ieee80211_amrr.c +++ b/sys/net80211/ieee80211_amrr.c @@ -226,26 +226,17 @@ amrr_node_deinit(struct ieee80211_node *ni) } static int -amrr_update(struct ieee80211_amrr *amrr, struct ieee80211_amrr_node *amn, +amrr_update_ht(struct ieee80211_amrr *amrr, struct ieee80211_amrr_node *amn, struct ieee80211_node *ni) { int rix = amn->amn_rix; - const struct ieee80211_rateset *rs = NULL; + const struct ieee80211_rateset *rs; - KASSERT(is_enough(amn), ("txcnt %d", amn->amn_txcnt)); - - /* 11n or not? Pick the right rateset */ - if (ieee80211_ht_check_tx_ht(ni)) { - /* XXX ew */ - rs = (struct ieee80211_rateset *) &ni->ni_htrates; - } else { - rs = &ni->ni_rates; - } + rs = (struct ieee80211_rateset *)&ni->ni_htrates; /* XXX TODO: we really need a rate-to-string method */ - /* XXX TODO: non-11n rate should be divided by two.. */ IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "AMRR: current rate %d, txcnt=%d, retrycnt=%d", + "AMRR: current rate MCS %d, txcnt=%d, retrycnt=%d", rs->rs_rates[rix] & IEEE80211_RATE_VAL, amn->amn_txcnt, amn->amn_retrycnt); @@ -266,9 +257,9 @@ amrr_update(struct ieee80211_amrr *amrr, struct ieee80211_amrr_node *amn, amn->amn_success = 0; rix++; /* XXX TODO: we really need a rate-to-string method */ - /* XXX TODO: non-11n rate should be divided by two.. */ IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "AMRR increasing rate %d (txcnt=%d retrycnt=%d)", + "AMRR increasing rate MCS %d " + "(txcnt=%d retrycnt=%d)", rs->rs_rates[rix] & IEEE80211_RATE_VAL, amn->amn_txcnt, amn->amn_retrycnt); } else { @@ -289,20 +280,94 @@ amrr_update(struct ieee80211_amrr *amrr, struct ieee80211_amrr_node *amn, } rix--; /* XXX TODO: we really need a rate-to-string method */ - /* XXX TODO: non-11n rate should be divided by two.. */ IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "AMRR decreasing rate %d (txcnt=%d retrycnt=%d)", + "AMRR decreasing rate MCS %d " + "(txcnt=%d retrycnt=%d)", rs->rs_rates[rix] & IEEE80211_RATE_VAL, amn->amn_txcnt, amn->amn_retrycnt); } amn->amn_recovery = 0; } + return (rix); +} + +static int +amrr_update_legacy(struct ieee80211_amrr *amrr, struct ieee80211_amrr_node *amn, + struct ieee80211_node *ni) +{ + int rix = amn->amn_rix; + const struct ieee80211_rateset *rs; + + rs = &ni->ni_rates; + + /* XXX TODO: we really need a rate-to-string method */ + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, + "AMRR: current rate %d Mb, txcnt=%d, retrycnt=%d", + (rs->rs_rates[rix] & IEEE80211_RATE_VAL) / 2, + amn->amn_txcnt, + amn->amn_retrycnt); + + if (is_success(amn)) { + amn->amn_success++; + if (amn->amn_success >= amn->amn_success_threshold && + rix + 1 < rs->rs_nrates) { + amn->amn_recovery = 1; + amn->amn_success = 0; + rix++; + /* XXX TODO: we really need a rate-to-string method */ + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, + "AMRR increasing rate %d Mb (txcnt=%d retrycnt=%d)", + (rs->rs_rates[rix] & IEEE80211_RATE_VAL) / 2, + amn->amn_txcnt, amn->amn_retrycnt); + } else { + amn->amn_recovery = 0; + } + } else if (is_failure(amn)) { + amn->amn_success = 0; + if (rix > 0) { + if (amn->amn_recovery) { + amn->amn_success_threshold *= 2; + if (amn->amn_success_threshold > + amrr->amrr_max_success_threshold) + amn->amn_success_threshold = + amrr->amrr_max_success_threshold; + } else { + amn->amn_success_threshold = + amrr->amrr_min_success_threshold; + } + rix--; + /* XXX TODO: we really need a rate-to-string method */ + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, + "AMRR decreasing rate %d Mb (txcnt=%d retrycnt=%d)", + (rs->rs_rates[rix] & IEEE80211_RATE_VAL) / 2, + amn->amn_txcnt, amn->amn_retrycnt); + } + amn->amn_recovery = 0; + } + + return (rix); +} + +static int +amrr_update(struct ieee80211_amrr *amrr, struct ieee80211_amrr_node *amn, + struct ieee80211_node *ni) +{ + int rix; + + KASSERT(is_enough(amn), ("txcnt %d", amn->amn_txcnt)); + + /* 11n or not? Pick the right rateset */ + if (ieee80211_ht_check_tx_ht(ni)) + rix = amrr_update_ht(amrr, amn, ni); + else + rix = amrr_update_legacy(amrr, amn, ni); + /* reset counters */ amn->amn_txcnt = 0; amn->amn_retrycnt = 0; - return rix; + return (rix); } /* From nobody Wed Feb 26 19:31:49 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z34NP6m3Qz5nksY; Wed, 26 Feb 2025 19:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34NP3lw0z3dhw; Wed, 26 Feb 2025 19:31:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598309; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9R9VtWgfozUtTK/Cx8zjZ2c4CsakGmm62ZyWDNjmu0s=; b=bq6ZSQMt/VWd84Js4s3PL1kdw/EoT1JQrhGlqQwqGu7WGCCG2dLK8RYnVZstZv9yfm5lHX /X00feTXJo6pNPCZ+3fhDJJ3Trt55aWvDtIlRtog5IRGCtopt+ivPqtJnbOyO2VZuBvJHt nRLo6wJhymFB7z8CUAY8lJkDw8azyLu/O1yY9Qo2BH8zVKXwKIhrP1xicKQ5wYK/RQEdfl seZOhxAIJxcFtCsdnSqg2YK/keEGEMFSYEwZO7mUIuHarsI/4VgLIwP2e1eqlHL2xuHXDK aFImv/ii2SNl06FnNRgWD+J8T5MhBW57/UjbEYvIcRLBOZZ+OyKIBpERlRSDNw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598309; a=rsa-sha256; cv=none; b=FrvDl4EWifzer10L4a0ahxcc/RTAmo5NOxqcXYAvPteMJIWRxwOlJISQPov8XvuQhcFNeQ IQ69v6i9DU//b9xTjErwFwUitTKa+g3OCPVFyMIsCACWKafYUfswKeWmEvDa1qUUYz7GET WsikrbIYOhlFneeIytG/8hFrTAityeCnxsDaPZf2cszVE5Iq2hp1w6Faqr9J6Wc35CLSb4 pv8hqf1Xce1Y5wYFK9ACuBUcAQ3oRo4jDGmehrifL9287k9CgI5P/EV6otuSipyceqENeR YrOS+ilU2IfYbwuok0EkAWZGO56ioVWsav/8M18tZ+McPHN6a+SG0G9CX9lCgg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598309; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9R9VtWgfozUtTK/Cx8zjZ2c4CsakGmm62ZyWDNjmu0s=; b=oSEJGUIRo/I7DZHE9M01DE9RlypvTKQPH+g+AcEn1eo3wl8u9g3/L/xdfatKGaiQGDHjWD YDX9YJitwyVjq4WvhhobdgsGRKEIuXcagJGkcpPsbjSwJvMtk74oen8XhRimQKZtyWdsRa hpnF1AURCdsRvMSwg4LVr8oaAxlAmnNa6doXXiPaWNvvxUsKEmlaVfNOQZoXCeakL3N2BF E9Y1I2HxOHF++Izvtl6UsGQDmjBr/MwF+nrUIWph6rADNGOMjLcn0gBtc0sm8odsjYDDcE aZIYrN0MlC9cOaentb/wSt3CgjxLEmZTk/RP7vK1m5RoEuaQeEbYTYvqyncIjw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z34NP3CFbz1PTy; Wed, 26 Feb 2025 19:31:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QJVnWs018888; Wed, 26 Feb 2025 19:31:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVnfr018885; Wed, 26 Feb 2025 19:31:49 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:49 GMT Message-Id: <202502261931.51QJVnfr018885@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: ff0e22f88d04 - main - net80211: add ieee80211_phy_vht_get_mcs_kbit() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ff0e22f88d041da2a146d70140a535c57b40c16d Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=ff0e22f88d041da2a146d70140a535c57b40c16d commit ff0e22f88d041da2a146d70140a535c57b40c16d Author: Adrian Chadd AuthorDate: 2025-01-15 05:09:27 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:31:25 +0000 net80211: add ieee80211_phy_vht_get_mcs_kbit() Add ieee80211_phy_vht_get_mcs_kbit(), which calculates the VHT rate in kbit/sec. Differential Revision: https://reviews.freebsd.org/D48612 --- sys/net80211/ieee80211_phy.c | 85 ++++++++++++++++++++++++++++++++++++++++++++ sys/net80211/ieee80211_phy.h | 2 ++ 2 files changed, 87 insertions(+) diff --git a/sys/net80211/ieee80211_phy.c b/sys/net80211/ieee80211_phy.c index 9c2b1197564a..eb96d74a2bd9 100644 --- a/sys/net80211/ieee80211_phy.c +++ b/sys/net80211/ieee80211_phy.c @@ -707,3 +707,88 @@ ieee80211_phy_vht_validate_mcs(enum ieee80211_sta_rx_bw bw, uint8_t nss, return ((mask & (1 << mcs)) != 0); } + +struct mcs_entry { + int n_sym; /* Number of bits per symbol */ + int cod_n; /* Coding rate numerator */ + int cod_d; /* Coding rate denominator */ +}; + +/* + * These parameters are taken from 802.11-2020 Table 21-29 + * (VHT-MCSs for Mandatory 20 MHZ, Nss=1). + * + * n_sym corresponds to "Nbpscs", cod_n/cod_d corresponds to + * "R". + */ +static struct mcs_entry mcs_entries[] = { + { 1, 1, 2 }, /* MCS0 */ + { 2, 1, 2 }, + { 2, 3, 4 }, + { 4, 1, 2 }, + { 4, 3, 4 }, + { 6, 2, 3 }, + { 6, 3, 4 }, + { 6, 5, 6 }, + { 8, 3, 4 }, + { 8, 5, 6 }, /* MCS9 */ +}; + +/** + * @brief Calculate the bitrate of the given VHT MCS rate. + * + * @param bw Channel bandwidth (enum ieee80211_sta_rx_bw) + * @param nss Number of spatial streams, 1..8 + * @param mcs MCS, 0..9 + * @param is_shortgi True if short guard-interval (400nS) + * false otherwise (800nS) + * + * @returns The bitrate in kbit/sec. + */ +uint32_t +ieee80211_phy_vht_get_mcs_kbit(enum ieee80211_sta_rx_bw bw, + uint8_t nss, uint8_t mcs, bool is_shortgi) +{ + uint32_t sym_len, n_carriers; + + /* Validate MCS 0..9, NSS 1..8 */ + if (mcs > 9) + return (0); + if (nss == 0 || nss > 8) + return (0); + + /* + * Short-GI - 3.6uS symbol time, long-GI - 4.0uS symbol time + * + * See 802.11-2020 Table 21-5 (Timing-related constraints.) + */ + if (is_shortgi) + sym_len = 36; + else + sym_len = 40; + + /* + * Calculate the number of carriers for the given channel bandwidth + * + * See 802.11-2020 Table 21-5 (Timing-related constraints.) + */ + switch (bw) { + case IEEE80211_STA_RX_BW_20: + n_carriers = 52; + break; + case IEEE80211_STA_RX_BW_40: + n_carriers = 108; + break; + case IEEE80211_STA_RX_BW_80: + n_carriers = 234; + break; + case IEEE80211_STA_RX_BW_160: + n_carriers = 468; + break; + default: + return (0); + } + + return ((n_carriers * mcs_entries[mcs].n_sym * mcs_entries[mcs].cod_n * + nss * 10000) / (mcs_entries[mcs].cod_d * sym_len)); +} diff --git a/sys/net80211/ieee80211_phy.h b/sys/net80211/ieee80211_phy.h index 466f59584f2c..749b082e34e9 100644 --- a/sys/net80211/ieee80211_phy.h +++ b/sys/net80211/ieee80211_phy.h @@ -227,6 +227,8 @@ uint16_t ieee80211_phy_vht_get_mcs_mask(enum ieee80211_sta_rx_bw, uint8_t); bool ieee80211_phy_vht_validate_mcs(enum ieee80211_sta_rx_bw, uint8_t, uint8_t); +uint32_t ieee80211_phy_vht_get_mcs_kbit(enum ieee80211_sta_rx_bw, + uint8_t, uint8_t, bool); #endif /* _KERNEL */ #endif /* !_NET80211_IEEE80211_PHY_H_ */ From nobody Wed Feb 26 19:31:48 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z34NN6BFvz5nksX; Wed, 26 Feb 2025 19:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34NN2jk2z3dX5; Wed, 26 Feb 2025 19:31:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598308; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1RDsHcHHa5AKxLQWBQFb6KrikAnl7TNPWPwkJQV7fvU=; b=lKU54+A0P1Oql7F1xOX4TKCTD4o9Q+OsIgu0D+EH+4I0qwCxsZ1AQiNJy3tnQz0NjNN76H Tr3L7T7TzfnGpJQPk/jpUz6iL11D8JUsNgcXktAlbl2GbOV7TZ1KXjzc8ogS/67Xe+HpF8 eyL4fH7NIos2QA8FIe0tpvycstb6HKnNwYlJwRnOqw5NyQRZiBrcW5cex1HOROoHPXwDBg Wuh2y8Ri2QX7KsJFQ21BPIOMHmPc7tVP212FNCy1vi0PO+8LZ3lN7n51q8+jcniwr0jb+Q P6mo8VDwAgbD/XpHRu6ETyl/QA6cAuavSZjerl+gRPx3VTm5pOmX9X5T7XyFCQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598308; a=rsa-sha256; cv=none; b=LMqHVWa5vFBd1QJIPv5Q5057cLruNbcfbZC4uZkgKpGBI7H6IwzAZaUZGfsItfjrHtuvIM LzzH8YlVmiJNKatuVelu9QPw2rzFsESkzdg19rkFxhK3Q5XvKG7Cv3SpZWJes/L52XOszX M/a6NceKO5WgMz8085oH2nHFWV+FesMPJmNUKMT4JvY7qulEe3KRxvTPP2gN631e9Vl6TQ 1JWF0Mn1//lf28zgTzgGWedmmLLvGXtKWN7CczbWfh79v7ZMbN/G+1bSkC/3lVkwmxo1I/ beepQVhqKOWUYRpzIqW8yhLarYLqN23KjXV1bj82BrbFPML/HcFSOeYYRN4ePA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598308; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1RDsHcHHa5AKxLQWBQFb6KrikAnl7TNPWPwkJQV7fvU=; b=ZOlUOqhgIrLnkhh9l0e1iBJGNbbi8vljJpIvzD4KiKCFBwsrrHSrxRuhparYNeK58TISTz vLUwUGwpKAj7Xkti7hT6v6YzpNHE3+RujXuWv/4Ad3B5pysX1EBkwz/ZeFlkCnU7IrRGAV h0JodppwZ6iRvXAC4ZXx/B9AMRJUrb0ALCdMLOjPIanYs2gnYBiotGtY1YgwfgrBUzgaAF 6puIWraUUF1MMejpx5DDyuNG8pNYbsqgreRF7Z4NBvgXMYetGT+nQ1jDuX8pJFJauZTpQO 0SX/KIsalSUIebEwn0NlAyn9miuFxDAMJGJTGCdQ4SdZHsI9Sl7My528vIhb/A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z34NN2HZpz1Pm0; Wed, 26 Feb 2025 19:31:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QJVmbD018854; Wed, 26 Feb 2025 19:31:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVmsf018851; Wed, 26 Feb 2025 19:31:48 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:48 GMT Message-Id: <202502261931.51QJVmsf018851@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 4b2c7dfe768d - main - net80211: add VHT MCS in AMRR rate control List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b2c7dfe768d341336f58db3cced9b097e1a6d2d Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=4b2c7dfe768d341336f58db3cced9b097e1a6d2d commit 4b2c7dfe768d341336f58db3cced9b097e1a6d2d Author: Adrian Chadd AuthorDate: 2025-01-13 17:05:31 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:31:24 +0000 net80211: add VHT MCS in AMRR rate control This is a simple implementation, similar to HT, to generate VHT MCS rates for testing. I've verified it seems to do the right thing through MCS 0..9 and NSS 1..2. It's not very optimal - same issues as with 11n - but it at least now fully tests the 11ac TX path in rtwn and the tx rate refactoring. Differential Revision: https://reviews.freebsd.org/D48611 --- sys/net80211/ieee80211_amrr.c | 183 ++++++++++++++++++++++++++++++++++++++++-- sys/net80211/ieee80211_amrr.h | 4 + 2 files changed, 181 insertions(+), 6 deletions(-) diff --git a/sys/net80211/ieee80211_amrr.c b/sys/net80211/ieee80211_amrr.c index 352f8df3a03e..1a06303bd2c9 100644 --- a/sys/net80211/ieee80211_amrr.c +++ b/sys/net80211/ieee80211_amrr.c @@ -49,6 +49,7 @@ #include #include +#include #include #include @@ -138,6 +139,23 @@ amrr_deinit(struct ieee80211vap *vap) nrefs--; /* XXX locking */ } +static void +amrr_node_init_vht(struct ieee80211_node *ni) +{ + struct ieee80211_amrr_node *amn = ni->ni_rctls; + + /* Default to VHT NSS 1 MCS 2; should be reliable! */ + amn->amn_vht_mcs = 2; + amn->amn_vht_nss = 1; + ieee80211_node_set_txrate_vht_rate(ni, amn->amn_vht_nss, + amn->amn_vht_mcs); + + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, + "AMRR: VHT: initial rate NSS %d MCS %d", + amn->amn_vht_nss, + amn->amn_vht_mcs); +} + static void amrr_node_init_ht(struct ieee80211_node *ni) { @@ -237,8 +255,10 @@ amrr_node_init(struct ieee80211_node *ni) amn->amn_success_threshold = amrr->amrr_min_success_threshold; amn->amn_ticks = ticks; - /* 11n or not? Pick the right rateset */ - if (ieee80211_ht_check_tx_ht(ni)) + /* Pick the right rateset */ + if (ieee80211_vht_check_tx_vht(ni)) + amrr_node_init_vht(ni); + else if (ieee80211_ht_check_tx_ht(ni)) amrr_node_init_ht(ni); else amrr_node_init_legacy(ni); @@ -250,6 +270,137 @@ amrr_node_deinit(struct ieee80211_node *ni) IEEE80211_FREE(ni->ni_rctls, M_80211_RATECTL); } +static void +amrr_update_vht_inc(struct ieee80211_node *ni) +{ + struct ieee80211_amrr_node *amn = ni->ni_rctls; + uint8_t nss, mcs; + + /* + * For now just keep looping over MCS to 9, then NSS up, checking if + * it's valid via ieee80211_vht_node_check_tx_valid_mcs(), + * until we hit max. This at least tests the VHT MCS rates, + * but definitely is suboptimal (in the same way the 11n MCS selection + * is suboptimal.) + */ + nss = amn->amn_vht_nss; + mcs = amn->amn_vht_mcs; + + while (nss <= 8 && mcs <= 9) { + /* Increment MCS 0..9, NSS 1..8 */ + if (mcs == 9) { + mcs = 0; + nss++; + } else + mcs++; + if (nss > 8) + break; + + if (ieee80211_vht_node_check_tx_valid_mcs(ni, ni->ni_chw, nss, + mcs)) { + amn->amn_vht_nss = nss; + amn->amn_vht_mcs = mcs; + break; + } + } +} + +static void +amrr_update_vht_dec(struct ieee80211_node *ni) +{ + struct ieee80211_amrr_node *amn = ni->ni_rctls; + uint8_t nss, mcs; + + /* + * For now just keep looping over MCS 9 .. 0 then NSS down, checking if + * it's valid via ieee80211_vht_node_check_tx_valid_mcs(), + * until we hit min. This at least tests the VHT MCS rates, + * but definitely is suboptimal (in the same way the 11n MCS selection + * is suboptimal. + */ + nss = amn->amn_vht_nss; + mcs = amn->amn_vht_mcs; + + while (nss >= 1 && mcs >= 0) { + + if (mcs == 0) { + mcs = 9; + nss--; + } else + mcs--; + if (nss < 1) + break; + + if (ieee80211_vht_node_check_tx_valid_mcs(ni, ni->ni_chw, nss, + mcs)) { + amn->amn_vht_nss = nss; + amn->amn_vht_mcs = mcs; + break; + } + } +} + +/* + * A placeholder / temporary hack VHT rate control. + * + * Use the available MCS rates at the current node bandwidth + * and configured / negotiated MCS rates. + */ +static int +amrr_update_vht(struct ieee80211_node *ni) +{ + struct ieee80211_amrr_node *amn = ni->ni_rctls; + struct ieee80211_amrr *amrr = ni->ni_vap->iv_rs; + + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, + "AMRR: VHT: current rate NSS %d MCS %d, txcnt=%d, retrycnt=%d", + amn->amn_vht_nss, amn->amn_vht_mcs, amn->amn_txcnt, + amn->amn_retrycnt); + + if (is_success(amn)) { + amn->amn_success++; + if (amn->amn_success >= amn->amn_success_threshold) { + amn->amn_recovery = 1; + amn->amn_success = 0; + + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, + "AMRR: VHT: increase rate (txcnt=%d retrycnt=%d)", + amn->amn_txcnt, amn->amn_retrycnt); + + amrr_update_vht_inc(ni); + } else { + amn->amn_recovery = 0; + } + } else if (is_failure(amn)) { + amn->amn_success = 0; + + if (amn->amn_recovery) { + amn->amn_success_threshold *= 2; + if (amn->amn_success_threshold > + amrr->amrr_max_success_threshold) + amn->amn_success_threshold = + amrr->amrr_max_success_threshold; + } else { + amn->amn_success_threshold = + amrr->amrr_min_success_threshold; + } + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, + "AMRR: VHT: decreasing rate (txcnt=%d retrycnt=%d)", + amn->amn_txcnt, amn->amn_retrycnt); + + amrr_update_vht_dec(ni); + + amn->amn_recovery = 0; + } + + /* Reset counters */ + amn->amn_txcnt = 0; + amn->amn_retrycnt = 0; + + /* Return 0, not useful anymore */ + return (0); +} + static int amrr_update_ht(struct ieee80211_amrr *amrr, struct ieee80211_amrr_node *amn, struct ieee80211_node *ni) @@ -382,8 +533,10 @@ amrr_update(struct ieee80211_amrr *amrr, struct ieee80211_amrr_node *amn, KASSERT(is_enough(amn), ("txcnt %d", amn->amn_txcnt)); - /* 11n or not? Pick the right rateset */ - if (ieee80211_ht_check_tx_ht(ni)) + /* Pick the right rateset */ + if (ieee80211_vht_check_tx_vht(ni)) + rix = amrr_update_vht(ni); + else if (ieee80211_ht_check_tx_ht(ni)) rix = amrr_update_ht(amrr, amn, ni); else rix = amrr_update_legacy(amrr, amn, ni); @@ -395,6 +548,22 @@ amrr_update(struct ieee80211_amrr *amrr, struct ieee80211_amrr_node *amn, return (rix); } +static int +amrr_rate_vht(struct ieee80211_node *ni) +{ + struct ieee80211_amrr *amrr = ni->ni_vap->iv_rs; + struct ieee80211_amrr_node *amn = ni->ni_rctls; + + if (is_enough(amn) && (ticks - amn->amn_ticks) > amrr->amrr_interval) + amrr_update_vht(ni); + + ieee80211_node_set_txrate_vht_rate(ni, amn->amn_vht_nss, + amn->amn_vht_mcs); + + /* Note: There's no vht rs_rates, and the API doesn't use it anymore */ + return (0); +} + /* * Return the rate index to use in sending a data frame. * Update our internal state if it's been long enough. @@ -416,9 +585,10 @@ amrr_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg __unused) return 0; } - amrr = amn->amn_amrr; + if (ieee80211_vht_check_tx_vht(ni)) + return (amrr_rate_vht(ni)); - /* 11n or not? Pick the right rateset */ + /* Pick the right rateset */ if (ieee80211_ht_check_tx_ht(ni)) { /* XXX ew */ rs = (struct ieee80211_rateset *) &ni->ni_htrates; @@ -426,6 +596,7 @@ amrr_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg __unused) rs = &ni->ni_rates; } + amrr = amn->amn_amrr; if (is_enough(amn) && (ticks - amn->amn_ticks) > amrr->amrr_interval) { rix = amrr_update(amrr, amn, ni); if (rix != amn->amn_rix) { diff --git a/sys/net80211/ieee80211_amrr.h b/sys/net80211/ieee80211_amrr.h index 795cbf673e56..49d62953e625 100644 --- a/sys/net80211/ieee80211_amrr.h +++ b/sys/net80211/ieee80211_amrr.h @@ -49,6 +49,10 @@ struct ieee80211_amrr_node { struct ieee80211_amrr *amn_amrr;/* backpointer */ int amn_rix; /* current rate index */ int amn_ticks; /* time of last update */ + /* for VHT, since there's no VHT RIX right now */ + int amn_vht_mcs; + int amn_vht_nss; + /* statistics */ u_int amn_txcnt; u_int amn_success; From nobody Wed Feb 26 19:31:51 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z34NS1cXkz5nl82; Wed, 26 Feb 2025 19:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34NR5ThYz3dcn; Wed, 26 Feb 2025 19:31:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598311; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Mpr/ND3HIFE8KgnMztEYZBT3jGuyI1kkq4/f43zEtiE=; b=bDwxEmYAWY8FW1fn6ttDZvGlhBL8TOcSc7OJgQQr8a45dR3LYD8i1ebOngXH4uiEeDelD3 5CB8CUdC8UHJ3+X8y8v6XQy2m3A3/c7Q2wkEhLUWP7iSHtgFNk8nrE071PkoAACr3VoJ3E SWenXAzBZVlVE+tn5LdxlKSXSh/o7yd6VpTGgv9a2bqnsCbpAA5vYJBLhSLpqiCYVWMMPw 0QLktxum1Q54FFm3ncj07xibfF0Nvx/MgwGlCwkUuN4XW+5gpB8RXC3tfIkV7pUvyvSq9g qGUrfhKxxygVFGHIS6DxrhAh4VMA6cjJkNAq3fkZOtMrhx+OCB4PGW/5AgBCew== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598311; a=rsa-sha256; cv=none; b=pUOJswlLGTE5ua1n+c9XpEDLNGwgTHHOXXO+dqHEGi1+Hh2vyvI05qcJmPrC64tpH4FgL2 jhKzYUrRIoarMuB9R8vESHAIpMLUN+0nGLUahYE4C2+oogBtfegmVNz34UTmgBhP5+MRrs CZlaQW5+6t51o2psGmoJf0UyvSZpWR3Z7fKkZpp7wx6itnhwQN8CNMiZ2PJeEBDr98516W dQqn6GMPzOVCkOZd6JYJVf7Ak/xEIeiApj/k+xaJzFZTZbjenySuczpkBxtxRkhH0Z+Wgv dK1DwF0DVS8a+/6IBGEtdkdEYs1OAT+uGhnCGTW/mIp8es6+KblDqkg7QQ525Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598311; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Mpr/ND3HIFE8KgnMztEYZBT3jGuyI1kkq4/f43zEtiE=; b=HBbaluGfps1dfS0JPwlfhC6QpqQex/ny7rtaGvAXI+IexlBj9P4EoBqwt7cqs0oGs6TdOp YhCR9NZtAZYYoUDOtrBgYAGgHNq5tPiPibUBT58Kn+1pI6qUS6a+v7Gefcp8mShN1jmUSV rDN8xwN5vM44HItcY3NQgP9kX/nDWcN6smJ+CTyOpjI4R/nm7Zm5zvSVu4OwYlSL10hNOD 08aiDWoi3Z7GQ/YHcxbYkZFsCk/C0u12MJ9u61EtHPJIsx2IhqwSBP1WHmD1cGomqQU/rJ OjuSjL6xfvoxN6OqBxbqPd25XiaqQ8NxLkrB6raji7Daoi9ia2sSlhp3a27UKQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z34NR54gcz1PV1; Wed, 26 Feb 2025 19:31:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QJVpZF018964; Wed, 26 Feb 2025 19:31:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVptH018961; Wed, 26 Feb 2025 19:31:51 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:51 GMT Message-Id: <202502261931.51QJVptH018961@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 62823019db16 - main - net80211: add static initialisers for the ieee80211_node_txrate options List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 62823019db16bdd30a6505290c090db105d432d4 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=62823019db16bdd30a6505290c090db105d432d4 commit 62823019db16bdd30a6505290c090db105d432d4 Author: Adrian Chadd AuthorDate: 2025-01-17 02:34:44 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:31:26 +0000 net80211: add static initialisers for the ieee80211_node_txrate options Add static initialisers for legacy, ht and vht rates. Differential Revision: https://reviews.freebsd.org/D48614 --- sys/net80211/ieee80211_node.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h index ae5f72a070b6..e87192a8a5ae 100644 --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -153,6 +153,24 @@ struct ieee80211_node_txrate { uint8_t dot11rate; /* Legacy/HT - dot11rate / ratecode */ }; +#define IEEE80211_NODE_TXRATE_INIT_LEGACY(rate) \ + (struct ieee80211_node_txrate) { .type = IEEE80211_NODE_TXRATE_LEGACY, \ + .nss = 0, \ + .mcs = 0, \ + .dot11rate = (rate) } + +#define IEEE80211_NODE_TXRATE_INIT_HT(i_mcs) \ + (struct ieee80211_node_txrate) { .type = IEEE80211_NODE_TXRATE_HT, \ + .nss = 0, \ + .mcs = (i_mcs), \ + .dot11rate = (i_mcs) | IEEE80211_RATE_MCS } + +#define IEEE80211_NODE_TXRATE_INIT_VHT(i_nss, i_mcs) \ + (struct ieee80211_node_txrate) { .type = IEEE80211_NODE_TXRATE_VHT, \ + .nss = (i_nss), \ + .mcs = (i_mcs), \ + .dot11rate = 0 } + /* * Node specific information. Note that drivers are expected * to derive from this structure to add device-specific per-node From nobody Wed Feb 26 19:31:50 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z34NR48DFz5nl7y; Wed, 26 Feb 2025 19:31:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34NQ4ylBz3dcb; Wed, 26 Feb 2025 19:31:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598310; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nR0qHLnlv2AMDMcNRRYoAa3FwVQUTgoHLOBwsr3kV7w=; b=fe88+aeGakSqN1oIoW0wMV8zmzSDf3U/HNid4PJs5yhOcQZHbUkBlUSBBiHNeZ93viHywI osb2NUMFgirjPHVbX+g0VJlKheVCCbMZe2F6RNjHoowuEm82T9ZBpOjfZayzP02AFLFwkH TbW9bbnlsRBbTXr9f/rTTFKTVkLkIXm9gn/8fI97xaH+/ph5z8Pzv6Xl0Au9j5DCywtI4t 1I92/gg+DOdo2w9bZ3GvThuggDEViwq1BLFWUQBxloVZFdI0VlUbqOtk0Yrwz6vZ6pGqxm NemWRub6n3miOWeZYtNPjgp0A6S9rVQcjjghSyBnRmNFa8TlS9E9AtqbUqYDuA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598310; a=rsa-sha256; cv=none; b=P/XD8LWWhpK02v2dFbC6Dervf5PSEpRj3NfeEQhVeS5VHgdhkPzwiVZZLub4MiAZmVfR3M MEO0ZuZ36huGlFBG+LWb40DUuVjsfoKHy4x9SG9m2cEYYnSnX/nWTKaNSWn1ETQgfvKijj 54rsc06yZbZ1NRcqlxKPg8FmRyCVEyC2sGibCt45VEXBoZRp2S8D/9WgrXaGpmlFS3UKFi KyM7gnXNgQZzjUNLLMlSgrfqwephNLHbp8TsyPRHLaTw6gcVow4c9sb5/pu7wF1tUTBks6 i1fdAyPHNCCk6uj5fQYuymzwGkIZ4Vi9Ngeh1cYe+PqQzY23JpjD8apbfD6+AQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598310; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nR0qHLnlv2AMDMcNRRYoAa3FwVQUTgoHLOBwsr3kV7w=; b=ep2QX1JL9xOkKRTaOUjKjvGvkyWR+jgEdjeMXxlqYqQFX3ifgcElqOGqlWFpbr9LD/4Ves oQy7wcybMrgi9Fpy5y6XI1rfdgeZ6td+EM3iesLT5prbIRu2MHFeOd3n1cPDUz81HVh0CL phafpqA4rzC8vvaiHcrB8JsOEo/lx0BJY1E73xD2+JbFZ1XPPyOlxnVbj1ngUrxbdkns2z EVxNjW2Rt0xLPI8itBEpMsl3J6BRDtK8wl2/ak3TuHel3N7dSzTrkfM15EZVWrEPvkQvaS Vm3274crk7mKyNm5zOAtqbxOnl/+9VUTLkXY1StV/GaKnG4rpwGm70zvmcVCCw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z34NQ482Kz1NX9; Wed, 26 Feb 2025 19:31:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QJVort018929; Wed, 26 Feb 2025 19:31:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVoQi018926; Wed, 26 Feb 2025 19:31:50 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:50 GMT Message-Id: <202502261931.51QJVoQi018926@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 6fef9e7378d0 - main - net80211: update ieee80211_node_get_txrate_mbit() to support VHT List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6fef9e7378d0af0e710ce7c3601886410db82cd6 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=6fef9e7378d0af0e710ce7c3601886410db82cd6 commit 6fef9e7378d0af0e710ce7c3601886410db82cd6 Author: Adrian Chadd AuthorDate: 2025-01-15 05:10:59 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:31:26 +0000 net80211: update ieee80211_node_get_txrate_mbit() to support VHT Update ieee80211_node_get_txrate_mbit() to use ieee80211_phy_vht_get_mcs_kbit() to calculate VHT rates. For now just assume long-GI; I'd have to go and do some extra work to figure out which short/long GI flag to use. Differential Revision: https://reviews.freebsd.org/D48613 --- sys/net80211/ieee80211_node.c | 58 ++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index bc0358feb7a8..f4185dfb04d4 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -3292,46 +3292,42 @@ ieee80211_node_set_txrate_vht_rate(struct ieee80211_node *ni, uint32_t ieee80211_node_get_txrate_kbit(struct ieee80211_node *ni) { - uint32_t mbps; + uint32_t kbps; - /* - * TODO: only handle legacy/HT rates, VHT will need - * to use other logic. - */ switch (ni->ni_txrate.type) { case IEEE80211_NODE_TXRATE_LEGACY: + kbps = ni->ni_txrate.dot11rate * 500; + break; case IEEE80211_NODE_TXRATE_HT: + /* Note: Valid for MCS 0..76 */ + { + const struct ieee80211_mcs_rates *mcs = + &ieee80211_htrates[ni->ni_txrate.dot11rate & + ~IEEE80211_RATE_MCS]; + + if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) { + if (ni->ni_flags & IEEE80211_NODE_SGI40) + kbps = mcs->ht40_rate_800ns * 500; + else + kbps = mcs->ht40_rate_400ns * 500; + } else { + if (ni->ni_flags & IEEE80211_NODE_SGI20) + kbps = mcs->ht20_rate_800ns * 500; + else + kbps = mcs->ht20_rate_400ns * 500; + } + } break; case IEEE80211_NODE_TXRATE_VHT: + /* Note: valid for VHT rates, assumes long-GI for now */ + kbps = ieee80211_phy_vht_get_mcs_kbit(ni->ni_chw, + ni->ni_txrate.nss, ni->ni_txrate.mcs, false); + break; default: - printf("%s: called for VHT / unknown rate (type %d)!\n", + printf("%s: called for unknown rate (type %d)!\n", __func__, ni->ni_txrate.type); return (0); } - /* Legacy / MCS rates */ - if (ni->ni_txrate.dot11rate & IEEE80211_RATE_MCS) { - const struct ieee80211_mcs_rates *mcs = - &ieee80211_htrates[ni->ni_txrate.dot11rate & - ~IEEE80211_RATE_MCS]; - if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) { - /* Note: these are in 1/2Mbit/s units */ - if (ni->ni_flags & IEEE80211_NODE_SGI40) - mbps = mcs->ht40_rate_800ns; - else - mbps = mcs->ht40_rate_400ns; - } else { - if (ni->ni_flags & IEEE80211_NODE_SGI20) - mbps = mcs->ht20_rate_800ns; - else - mbps = mcs->ht20_rate_400ns; - } - } else - /* Note: CCK/OFDM dot11rate entries are in 1/2Mbit/s units */ - mbps = ni->ni_txrate.dot11rate; - - /* - * Note; 'mbps' in 1/2 Mbit/s units so *500 to make it in kbit/s units. - */ - return (mbps * 500); + return (kbps); } From nobody Wed Feb 26 19:31:52 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z34NT1lPdz5nkpx; Wed, 26 Feb 2025 19:31:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34NS6jXdz3djf; Wed, 26 Feb 2025 19:31:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598312; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XJn9thu+DglhMzH0Xu2L5D7MUfaZi1q+3qWBJS6PHVk=; b=orfz03ZqSoERVxJp9AHCpg2AypXRdC1iKo4VNSVDUb6hVqxTsaB6yrnFnyTT8UiFw6dDtK qJIKo4N9PGY2QYq09CaOEH2Xwz+ptDM4vbe4j58aCnrzlwDkGWr3toCTmNqmo2rJGnAsGE z9WkifW6whquC6BDfvXYbO4gqXewiP7KrKRI1L0aGA/L0pSV6qHXkROWtB+S8o/A1cXoG2 gRSbxOnMdXvAwKHP9BvGHk9/xPPMJZCflkdDthz4XexBL2ZvF1/ffFK1XulU3yrD1VlLLP 2D7WSE8xkbBdKoQW8OFlMRFEWWcTQ5eni44se8ZcLdlrkKoCLWXdKDS2F26rOA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598312; a=rsa-sha256; cv=none; b=pTjA0v6ohzjCf5Hjfg/3ShfocdcdJoYqNzuRhtPwci3rlB+2NxETyKgA+OA8C+CC2LFKnC FfO1JFmNIcpf0Ocbltu67AN/UMusuBDl+nrFxlAUrnv/amN2FdP+dfM/6ibmVE+X4hw0M1 VducpAtaF1IHEmtcrOHyw+3+WR2Spk3VxLHSuyMSijxXWa6crwHAO2nWuJbzavtMNfiKFz 5ezUw/EyivRQTEkC2ZTLCcyyeqJlYjtYYO3UzHFEJ7llCjC+L57deeirP9VdzQNsRv85jw 6+T53qUp6SUR1IcViqTFdi8gaHx+qoYXXhf5LN0SmM49aFN8KOeyiiKgiNG+SA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598312; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XJn9thu+DglhMzH0Xu2L5D7MUfaZi1q+3qWBJS6PHVk=; b=cmggJlsqi0vdI3MRMC65R8ruCngnM8kkqlEsDb5BnMQTlrw4G8nngNvR2BhOxL25kOQhdZ pU1Wz83zcAp+xkxuRFr0xqdMUzjFcthRl3+zaE7gGurt6sTx0D6HokU6Q8E/kXOavXGw8C VwAkeog4jlLiscozGSHOnZWBfXzSYbYUULgfV928pc5PaDotHUW4xJt/BKPWBvVbk1DBTB m+nYZbt2KdkNiLhmetcEWgorWiYCHT7FNjjqbF6XYXbiRbUxCYHD+91PezxP1hsYq+RhPK Bwiu8+YD6WxdOsrz6Rr+9+B/VsZk1RahZA5PTeCJpSlIVkaMKkJeCYf9td9Ikg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z34NS62mmz1PYn; Wed, 26 Feb 2025 19:31:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QJVq34018999; Wed, 26 Feb 2025 19:31:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVqb8018996; Wed, 26 Feb 2025 19:31:52 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:52 GMT Message-Id: <202502261931.51QJVqb8018996@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: e274a23c0d3d - main - net80211: migrate ieee80211_rate2media() to use ieee80211_node_txrate List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e274a23c0d3d3c8e9796158029f36e60edf61831 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=e274a23c0d3d3c8e9796158029f36e60edf61831 commit e274a23c0d3d3c8e9796158029f36e60edf61831 Author: Adrian Chadd AuthorDate: 2025-01-17 02:35:10 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:31:27 +0000 net80211: migrate ieee80211_rate2media() to use ieee80211_node_txrate This is one of the two obvious left-over dot11rate lookups that trigger a debug print. (The other is get_sta_info()). * Change ieee80211_rate2media() to use the passed in ieee80211_node_txrate and use the rate type field to see if it's legacy/ht or vht. * .. and (I hope!) actually handle the VHT rate correctly. * Change the callers of ieee80211_rate2media() to use the new static initialisers. For the one spot in ieee80211_ht.c which uses the HT initialiser, it should just be a straight up mechanical change that correctly sets the HT MCS rate. For the rest of them in ieee80211.c, they're doing table initialisation for the media types / rates, and it's currently very focused on legacy rates. So just leave that all as-is for now with a mechanical change. Differential Revision: https://reviews.freebsd.org/D48615 --- sys/net80211/ieee80211.c | 56 ++++++++++++++++++++++++++++---------------- sys/net80211/ieee80211_ht.c | 5 +++- sys/net80211/ieee80211_var.h | 3 ++- 3 files changed, 42 insertions(+), 22 deletions(-) diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index eb796462d3d1..9d036f298ed3 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -1949,6 +1949,7 @@ ieee80211_media_setup(struct ieee80211com *ic, enum ieee80211_phymode mode; const struct ieee80211_rateset *rs; struct ieee80211_rateset allrates; + struct ieee80211_node_txrate tn; /* * Fill in media characteristics. @@ -1968,7 +1969,8 @@ ieee80211_media_setup(struct ieee80211com *ic, rs = &ic->ic_sup_rates[mode]; for (i = 0; i < rs->rs_nrates; i++) { rate = rs->rs_rates[i]; - mword = ieee80211_rate2media(ic, rate, mode); + tn = IEEE80211_NODE_TXRATE_INIT_LEGACY(rate); + mword = ieee80211_rate2media(ic, &tn, mode); if (mword == 0) continue; addmedia(media, caps, addsta, mode, mword); @@ -1990,8 +1992,8 @@ ieee80211_media_setup(struct ieee80211com *ic, } } for (i = 0; i < allrates.rs_nrates; i++) { - mword = ieee80211_rate2media(ic, allrates.rs_rates[i], - IEEE80211_MODE_AUTO); + tn = IEEE80211_NODE_TXRATE_INIT_LEGACY(allrates.rs_rates[i]); + mword = ieee80211_rate2media(ic, &tn, IEEE80211_MODE_AUTO); if (mword == 0) continue; /* NB: remove media options from mword */ @@ -2071,6 +2073,7 @@ ieee80211_announce(struct ieee80211com *ic) int i, rate, mword; enum ieee80211_phymode mode; const struct ieee80211_rateset *rs; + struct ieee80211_node_txrate tn; /* NB: skip AUTO since it has no rates */ for (mode = IEEE80211_MODE_AUTO+1; mode < IEEE80211_MODE_11NA; mode++) { @@ -2079,7 +2082,8 @@ ieee80211_announce(struct ieee80211com *ic) ic_printf(ic, "%s rates: ", ieee80211_phymode_name[mode]); rs = &ic->ic_sup_rates[mode]; for (i = 0; i < rs->rs_nrates; i++) { - mword = ieee80211_rate2media(ic, rs->rs_rates[i], mode); + tn = IEEE80211_NODE_TXRATE_INIT_LEGACY(rs->rs_rates[i]); + mword = ieee80211_rate2media(ic, &tn, mode); if (mword == 0) continue; rate = ieee80211_media2rate(mword); @@ -2278,6 +2282,7 @@ ieee80211_media_status(struct ifnet *ifp, struct ifmediareq *imr) struct ieee80211vap *vap = ifp->if_softc; struct ieee80211com *ic = vap->iv_ic; enum ieee80211_phymode mode; + struct ieee80211_node_txrate tn; imr->ifm_status = IFM_AVALID; /* @@ -2299,14 +2304,15 @@ ieee80211_media_status(struct ifnet *ifp, struct ifmediareq *imr) /* * A fixed rate is set, report that. */ - imr->ifm_active |= ieee80211_rate2media(ic, - vap->iv_txparms[mode].ucastrate, mode); + tn = IEEE80211_NODE_TXRATE_INIT_LEGACY( + vap->iv_txparms[mode].ucastrate); + imr->ifm_active |= ieee80211_rate2media(ic, &tn, mode); } else if (vap->iv_opmode == IEEE80211_M_STA) { /* * In station mode report the current transmit rate. */ - imr->ifm_active |= ieee80211_rate2media(ic, - ieee80211_node_get_txrate_dot11rate(vap->iv_bss), mode); + ieee80211_node_get_txrate(vap->iv_bss, &tn); + imr->ifm_active |= ieee80211_rate2media(ic, &tn, mode); } else imr->ifm_active |= IFM_AUTO; if (imr->ifm_status & IFM_ACTIVE) @@ -2399,7 +2405,8 @@ findmedia(const struct ratemedia rates[], int n, u_int match) * or an MCS index. */ int -ieee80211_rate2media(struct ieee80211com *ic, int rate, enum ieee80211_phymode mode) +ieee80211_rate2media(struct ieee80211com *ic, + const struct ieee80211_node_txrate *tr, enum ieee80211_phymode mode) { static const struct ratemedia rates[] = { { 2 | IFM_IEEE80211_FH, IFM_IEEE80211_FH1 }, @@ -2530,35 +2537,44 @@ ieee80211_rate2media(struct ieee80211com *ic, int rate, enum ieee80211_phymode m { 11, IFM_IEEE80211_VHT }, #endif }; - int m; + int m, rate; /* * Check 11ac/11n rates first for match as an MCS. */ if (mode == IEEE80211_MODE_VHT_5GHZ) { - if (rate & IFM_IEEE80211_VHT) { - rate &= ~IFM_IEEE80211_VHT; - m = findmedia(vhtrates, nitems(vhtrates), rate); + if (tr->type == IEEE80211_NODE_TXRATE_VHT) { + m = findmedia(vhtrates, nitems(vhtrates), tr->mcs); if (m != IFM_AUTO) return (m | IFM_IEEE80211_VHT); } } else if (mode == IEEE80211_MODE_11NA) { - if (rate & IEEE80211_RATE_MCS) { - rate &= ~IEEE80211_RATE_MCS; - m = findmedia(htrates, nitems(htrates), rate); + /* NB: 12 is ambiguous, it will be treated as an MCS */ + if (tr->type == IEEE80211_NODE_TXRATE_HT) { + m = findmedia(htrates, nitems(htrates), + tr->dot11rate & ~IEEE80211_RATE_MCS); if (m != IFM_AUTO) return m | IFM_IEEE80211_11NA; } } else if (mode == IEEE80211_MODE_11NG) { /* NB: 12 is ambiguous, it will be treated as an MCS */ - if (rate & IEEE80211_RATE_MCS) { - rate &= ~IEEE80211_RATE_MCS; - m = findmedia(htrates, nitems(htrates), rate); + if (tr->type == IEEE80211_NODE_TXRATE_HT) { + m = findmedia(htrates, nitems(htrates), + tr->dot11rate & ~IEEE80211_RATE_MCS); if (m != IFM_AUTO) return m | IFM_IEEE80211_11NG; } } - rate &= IEEE80211_RATE_VAL; + + /* + * At this point it needs to be a dot11rate (legacy/HT) for the + * rest of the logic to work. + */ + if ((tr->type != IEEE80211_NODE_TXRATE_LEGACY) && + (tr->type != IEEE80211_NODE_TXRATE_HT)) + return (IFM_AUTO); + rate = tr->dot11rate & IEEE80211_RATE_VAL; + switch (mode) { case IEEE80211_MODE_11A: case IEEE80211_MODE_HALF: /* XXX good 'nuf */ diff --git a/sys/net80211/ieee80211_ht.c b/sys/net80211/ieee80211_ht.c index 9e047244cc3b..08912dc8fca2 100644 --- a/sys/net80211/ieee80211_ht.c +++ b/sys/net80211/ieee80211_ht.c @@ -317,9 +317,12 @@ static int ht_getrate(struct ieee80211com *ic, int index, enum ieee80211_phymode mode, int ratetype) { + struct ieee80211_node_txrate tr; int mword, rate; - mword = ieee80211_rate2media(ic, index | IEEE80211_RATE_MCS, mode); + tr = IEEE80211_NODE_TXRATE_INIT_HT(index); + + mword = ieee80211_rate2media(ic, &tr, mode); if (IFM_SUBTYPE(mword) != IFM_IEEE80211_MCS) return (0); switch (ratetype) { diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index 5a0d017bd590..4f3ed5e4a3d8 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -794,7 +794,8 @@ void ieee80211_iterate_coms(ieee80211_com_iter_func *, void *); int ieee80211_media_change(struct ifnet *); void ieee80211_media_status(struct ifnet *, struct ifmediareq *); int ieee80211_ioctl(struct ifnet *, u_long, caddr_t); -int ieee80211_rate2media(struct ieee80211com *, int, +int ieee80211_rate2media(struct ieee80211com *, + const struct ieee80211_node_txrate *, enum ieee80211_phymode); int ieee80211_media2rate(int); int ieee80211_mhz2ieee(u_int, u_int); From nobody Wed Feb 26 19:31:53 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z34NV55M6z5nkt0; Wed, 26 Feb 2025 19:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z34NV1Dmkz3dtp; Wed, 26 Feb 2025 19:31:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8upJysKzA3TtraSjZY0lyJ/GXKJEP1P2q6Wm71H0fSk=; b=T1ky5aGYXFpw2x8jhmuueqTK1TQpY7TD2fcl+O7iycASHvzJN5W7K+fDoxwnChGdpyhBLs mq2W/stPEDojd53+ytWm47+qiJVJRPrG/JRz2az4H07WnDqeyUkkk/01/V3X4k/dRhfeIx 17lKhLNeSaS0/nwLZfkvQIAuzV2yChqx/5KEyaLKssmXi1X0X4wSdIYqLNYN7A0aQOAlP9 FUwBJvh7z+W8VpXgCddpX9jsJIqZ9dGm32R/g7m5nSIriSd5RYMnGthTLAKLU5gbjNc4CE TXmvWFapTKgK3Qq8W3s5vR3VnMVPMYpONDnNmQtF4Pqd9VCq+c8kF5KMqFw0JQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740598314; a=rsa-sha256; cv=none; b=PYg4JFaZR6flrnW0rvM+McQS11WbeALI02qWIxa0TcOk65vOCo6SyHdiz4j56ufjuHz8Fl uY5nshuTFKVtj6Z6TKm6sEvRk2TUv0BbRCouxjxSRlaXYEshrKkEmkfNbW3NjVbTMNOsx0 aMyZpFci0EUaMh2bx5ebprg7Jb5LnldF8ocitVoGLHfLpalDidSj7NDcJathsuGtedBbal fsR8bvDXcVToTuEazdfXrbtAVjpGRG8xxM8A+h1YC4GgK8ii0k3vwEMQJirCGAhFoOZCLT VFQLEjqtCr1s2C5uaBHx/fD1yXT6Rh95ifr70qb6p6GXfxaBHwaiCnXyYreU6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740598314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8upJysKzA3TtraSjZY0lyJ/GXKJEP1P2q6Wm71H0fSk=; b=gaeiyZ7SR+AbZIpfLyRd8e4SxEPP4JzG9u7fdI2XoZJ2eLhDyid7sYyh5tLQaiV6xZGh3R oDXYbWGxfYmLHvaJ4h7Ehj3SC1++OqxRn1ImCdyonAlOnTR3BrmazZtOBL/sbZsTuvJJyp ds2ZJ6KwmKrQYvh0UoKU/qbNX/5I/vZVUlSGUg+GXQ/qva0K1vhatzERZchawg08FV1ck8 RhTILoekftec3vv6PyT2n0yGBdKvwNVpmF7rqYx1gv38mGa8LQeO1LjP9rISpzEpVMjc7W okoYw7oqcCez54rNJcgIR/w83mVHJiMC+uELz7NgWFEVOMgRd9DxmJedamxk0w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z34NT6nxgz1P4L; Wed, 26 Feb 2025 19:31:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QJVr1d019034; Wed, 26 Feb 2025 19:31:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QJVrdh019031; Wed, 26 Feb 2025 19:31:53 GMT (envelope-from git) Date: Wed, 26 Feb 2025 19:31:53 GMT Message-Id: <202502261931.51QJVrdh019031@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 17e8437e8d05 - main - net80211: update get_sta_info() to only populate isi_txrate for legacy rates List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 17e8437e8d05aa91f2d1f31cece68204e7294a74 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=17e8437e8d05aa91f2d1f31cece68204e7294a74 commit 17e8437e8d05aa91f2d1f31cece68204e7294a74 Author: Adrian Chadd AuthorDate: 2025-01-17 02:41:14 +0000 Commit: Adrian Chadd CommitDate: 2025-02-26 19:31:27 +0000 net80211: update get_sta_info() to only populate isi_txrate for legacy rates The isi_txrate field is 8 bits and only represents legacy/HT rates. So to avoid logging a warning, only populate if it's a legacy/HT rate. Differential Revision: https://reviews.freebsd.org/D48616 --- sys/net80211/ieee80211_ioctl.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index 24ec9659dc2d..caa0c77e2897 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -376,6 +376,7 @@ static void get_sta_info(void *arg, struct ieee80211_node *ni) { struct stainforeq *req = arg; + struct ieee80211_node_txrate tr; struct ieee80211vap *vap = ni->ni_vap; struct ieee80211req_sta_info *si; size_t ielen, len; @@ -406,7 +407,16 @@ get_sta_info(void *arg, struct ieee80211_node *ni) if (si->isi_nrates > 15) si->isi_nrates = 15; memcpy(si->isi_rates, ni->ni_rates.rs_rates, si->isi_nrates); - si->isi_txrate = ieee80211_node_get_txrate_dot11rate(ni); + /* + * isi_txrate can only represent the legacy/HT rates. + * Only set it if the rate is a legacy/HT rate. + * + * TODO: For VHT and later rates the API will need changing. + */ + ieee80211_node_get_txrate(ni, &tr); + if ((tr.type == IEEE80211_NODE_TXRATE_LEGACY) || + (tr.type == IEEE80211_NODE_TXRATE_HT)) + si->isi_txrate = ieee80211_node_get_txrate_dot11rate(ni); /* Note: txmbps is in 1/2Mbit/s units */ si->isi_txmbps = ieee80211_node_get_txrate_kbit(ni) / 500; si->isi_associd = ni->ni_associd; From nobody Wed Feb 26 21:13:52 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z36fN1tWRz5nw3c; Wed, 26 Feb 2025 21:14:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z36fM4YTFz3nTr; Wed, 26 Feb 2025 21:14:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 51QLDr8s030620; Wed, 26 Feb 2025 23:13:56 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 51QLDr8s030620 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 51QLDqqv030619; Wed, 26 Feb 2025 23:13:52 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 26 Feb 2025 23:13:52 +0200 From: Konstantin Belousov To: Kyle Evans Cc: Ronald Klop , dev-commits-src-all@freebsd.org, src-committers@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: e59991206b14 - main - fts(3): be less strict when automount does its job under us walking autofs mount Message-ID: References: <985139317.7211.1740577017034@localhost> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on tom.home X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Queue-Id: 4Z36fM4YTFz3nTr X-Spamd-Bar: ---- On Wed, Feb 26, 2025 at 08:03:33AM -0600, Kyle Evans wrote: > On 2/26/25 07:36, Ronald Klop wrote: > > > > *Van:* Konstantin Belousov > > *Datum:* 25 februari 2025 08:20 > > *Aan:* src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev- > > commits-src-main@FreeBSD.org > > *Onderwerp:* git: e59991206b14 - main - fts(3): be less strict when > > automount does its job under us walking autofs mount > > > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/? > > id=e59991206b1463b7e85cc8aafde7f1dc03fcedcf > cgit.FreeBSD.org/src/commit/? > > id=e59991206b1463b7e85cc8aafde7f1dc03fcedcf> > > > > commit e59991206b1463b7e85cc8aafde7f1dc03fcedcf > > Author:     Konstantin Belousov > > AuthorDate: 2025-02-21 13:07:43 +0000 > > Commit:     Konstantin Belousov > > CommitDate: 2025-02-25 07:09:29 +0000 > > > >     fts(3): be less strict when automount does its job under us > > walking autofs mount > > > >     Namely, allow the file id change if the resulting file belongs to > >     automounted filesystem.  If it is, remember the updated id. > > > >     This allows the ids from the automounted volumes to change without > >     restrictions, might be a further refinement would be to only > > allow such > >     inconsistency once. > > > >     PR:     284914 > >     Reported and tested by: Lexi Winter > >     Sponsored by:   The FreeBSD Foundation > >     MFC after:      1 week > >     Differential revision: https://reviews.freebsd.org/D49094 > > > > --- > >  lib/libc/gen/fts.c | 13 ++++++++++--- > >  1 file changed, 10 insertions(+), 3 deletions(-) > > > > diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c > > index 770a7b2cc322..bd193c7c6cfc 100644 > > --- a/lib/libc/gen/fts.c > > +++ b/lib/libc/gen/fts.c > > @@ -1132,6 +1132,7 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, > > char *path) > >  { > >     int ret, oerrno, newfd; > >     struct stat sb; > > +   struct statfs sf; > > > >     newfd = fd; > >     if (ISSET(FTS_NOCHDIR)) > > @@ -1144,9 +1145,15 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int > > fd, char *path) > >         goto bail; > >     } > >     if (p->fts_dev != sb.st_dev || p->fts_ino != sb.st_ino) { > > -       errno = ENOENT;     /* disinformation */ > > -       ret = -1; > > -       goto bail; > > +       if (_fstatfs(newfd, &sf) != 0 || > > +           (sf.f_flags & MNT_AUTOMOUNTED) == 0) { > > +           errno = ENOENT;     /* disinformation */ > > +           ret = -1; > > +           goto bail; > > +       } > > +       /* autofs might did the mount under us, accept. */ > > +       p->fts_dev = sb.st_dev; > > +       p->fts_ino == sb.st_ino; > >     } > >     ret = fchdir(newfd); > >  bail: > > > > ------------------------------------------------------------------------ > > > > > > > >    /* autofs might did the mount under us, accept. */ > > > > > > I’m not native English so forgive me my question. But what does this > > comment mean? > > > > It might have triggered an autofs mount while we're running, so we just > accept the otherwise suspicious looking change. If you have a better formulation for the comment, please go ahead and commit. I did not wanted to give too formal explanation there, esp. due to the notes given in the commit message. From nobody Wed Feb 26 22:24:32 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z38Cj2D7vz5p3Yd; Wed, 26 Feb 2025 22:24: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z38Cj0y7Wz3mDJ; Wed, 26 Feb 2025 22:24:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740608673; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1h+v+ffPWl4U7F/q7x4MnymaM+DSgfZHbbmtPGEXR3c=; b=J2qcpIcMbBYqcq0tCeJ9rlf6AG/VR0bHI5RfWzAJSkJXYc+SHBaSNqvfkwb825WQgB1dz5 vUzBVXAqzQoZwp0V0ZJzxyB5rFzrykDlvfW8I78TIdoEL78pSjoIb6Pn2vYOsTVa8tqto3 vrwUx/mtrxCNvExtkoRGJDqFe/UowUwyBH/IhlZNV2Zfw/nvwd61OJKw0JWd0/c0e1dUKS MW/maf7kCdLzzSdOlIhDKRakUvkFEVo8IsHjKWLZAw8mG9MOk5eIgoCNMJ/OHq8VQsI7/v ygtnxpTV2NqrtqWa6laGMlLAXmrcUGpsOGcbLYRN4o4HVWjy2b9mS+ZvHtuXbQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740608673; a=rsa-sha256; cv=none; b=j+b3EZtXwluaTuhLYyo+fyTEjjSEnmIJoiCNUAyoq41dUwZfMptJdrHIW6wE/ngRP64VAA 3LvS1RxIQ22/E3+nFD9IUarAFSC5Arpj1xvhdPl0kXdBBNjG6/ugKOfWez/SxUnvmFR2wm BUVkp3Ia66UUiPKVpaDHoRElWK5Cdcy13dazGW+CgvMkyeXj6TaG0ZMOkMZnof/RHFdNfR lcbF1XjbJ1nAM4dPJXW7Hyesag98IVHZXyf6zD4S0/hkN6WFThBE3fJ6UPsXYVKV7f1Myb 0WnaRiJOzZu5z2NcoAMEGUkwZq2jUn5ZFTb8I7hWxEl4/PpdgzGAB/4y5vtRQQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740608673; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1h+v+ffPWl4U7F/q7x4MnymaM+DSgfZHbbmtPGEXR3c=; b=D1qDGOkP7So06LIEZysTTlex+JgjUG8Icd33Kz78iQdYfe0i6WmQKwnBkg/PZoAW1WUIyt ri6xaTyyCTDmPQj06k8+7fO1DAz6t5QNmqir8KGZEbZ7vTYIeabkV7sfKRXIbm8Lcshzhj UNs9Tw99FD14N40l62dXpJq/riGPzhWhl9+gqiphN6SD1a51w03oxpWw5wJO8NcIw+/NWi lUIVLuQclfMcZTGABfLnUhmGE220xr554a9pn46sZp24R1ZhWhGPpoaQ0NYKB705/ppZs9 YPK45/1Kn1JboazE9qWkYmzydoXa7Rnd8bj/hSxoszSnhtDWXvEw4umaVdpTHw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z38Cj0PQDz17N; Wed, 26 Feb 2025 22:24:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QMOWKl036226; Wed, 26 Feb 2025 22:24:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QMOWWM036223; Wed, 26 Feb 2025 22:24:32 GMT (envelope-from git) Date: Wed, 26 Feb 2025 22:24:32 GMT Message-Id: <202502262224.51QMOWWM036223@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: 181549c37f19 - main - libbe: avoid copying encryption-related props List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 181549c37f1913f5ca292d8515a6e5e0068a9fe7 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=181549c37f1913f5ca292d8515a6e5e0068a9fe7 commit 181549c37f1913f5ca292d8515a6e5e0068a9fe7 Author: Kyle Evans AuthorDate: 2025-02-26 22:23:24 +0000 Commit: Kyle Evans CommitDate: 2025-02-26 22:24:24 +0000 libbe: avoid copying encryption-related props libzfs insists that these be cloned from the origin, so avoid making a deep copy of them ourselves to unbreak creating a new BE from a BE with encrypted components -- in today's environment, without a loader that does encryption, this means a deep BE setup where something underneath the BE (e.g., home directories) are encrypted. Reported and tested by: arrowd Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D48464 --- lib/libbe/be.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/libbe/be.c b/lib/libbe/be.c index 62563a33d975..e0ced1c5bcfc 100644 --- a/lib/libbe/be.c +++ b/lib/libbe/be.c @@ -680,8 +680,20 @@ be_deep_clone_prop(int prop, void *cb) dccb = cb; /* Skip some properties we don't want to touch */ - if (prop == ZFS_PROP_CANMOUNT) + switch (prop) { + /* + * libzfs insists on these being naturally inherited in the + * cloning process. + */ + case ZFS_PROP_KEYFORMAT: + case ZFS_PROP_KEYLOCATION: + case ZFS_PROP_ENCRYPTION: + case ZFS_PROP_PBKDF2_ITERS: + + /* FALLTHROUGH */ + case ZFS_PROP_CANMOUNT: /* Forced by libbe */ return (ZPROP_CONT); + } /* Don't copy readonly properties */ if (zfs_prop_readonly(prop)) From nobody Wed Feb 26 22:41:20 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z38b51mFNz5p5fw; Wed, 26 Feb 2025 22:41: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z38b46lnpz41Yt; Wed, 26 Feb 2025 22:41:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740609680; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J39RPAQ/83tildPh9qI29Wz+rnkhul14M8E9w2eG2Ec=; b=V42Fbjw2cYcRA4WVEiCUZBRah4j4zqAqW7wycDAwyzVcXgscPNyXmKJuW34dSsV7ql2Pn4 UFsovoqUVutbag7xYFTdmDV4FI7+1Vxyt7ZzDUrnBJlBe3t2GBvODxbCatwXyHhpxX4zmr C0JH4gL7pj8EYPw/m+6/XLyQHMS1lus43VDtcD80VoW+6Na5w7SQJPRgWAaHjrmRRdD1cW U9IlO8zrhxJeDD8jbXVbEUbLTK/tdQdJAi4YNA3JQDcXT/Xf/2PoCuwzgyv7A93rnnYtz4 hu1tGIXiaFb78Hoa4lDk2/jW+l+hGAXlG4/6KauNpdBp6ehF036KT2HtPfZ32A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740609680; a=rsa-sha256; cv=none; b=F8lwkJqkB02AbyUpuhf8peGu79E19HqMChLyqKtrepjAxha1OVyfaWOCFR5ZytJu2cUaVR RirH/tdJSw4v/yYXmkprS3/bUaqQ9L9UUTJpmmc3ofOK/zmb18sY+AeUFVSFE5qv0YYoK9 ZgSkVgnU+Bpc6SkvVA9Ds+7COXwMT50RCNQFO3JyN0aAccU+4A4WyEndgzxMAZq9domCSP Ngr3DML3jdjKl/TLoMF/QZ5Y8+5ehyDUaK/kOyRSEV1dxCDxdCjlNJPXbgyr0OA0L7B/EH LJ2Io80GprIyyKp5UcMn0zCjP0MJUqFk0dGvvUmEBuh1DS6v8MWfyjXg8I7cZg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740609680; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J39RPAQ/83tildPh9qI29Wz+rnkhul14M8E9w2eG2Ec=; b=bKa6Mmq6JWVhUrTbAgp6NBsMewZ7qGfk4k9xmLyPQ5ujULwtGTZJOpRqwCWHgRLNRGkpjP gkV+pXWtW+lRNr/kLbB62JtVyKYRtk/PJ4dSgahROS/KVerObJQeujqdh9na9P9eFFbbOr WyOJukB9+W4HSWLe6twULGduA4eeR/yxznnL1Kf2Wib+64CcHe/LiQLQLhpKDow6I9hR0k 8cIlepVF3s+I5lpbqz+uLpx1eTfnmcDgY6G9lkAkfzZKGTXAJBpAXFUV/6RxjI8h8JIgOV 8sf+curORmlOiTsgrTvwZpFjJN6hrhvcZhxJj+VnYnOqyUoZ762quI++vjvHcQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z38b46DSrz1Sx; Wed, 26 Feb 2025 22:41:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51QMfKLk067780; Wed, 26 Feb 2025 22:41:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QMfKJc067777; Wed, 26 Feb 2025 22:41:20 GMT (envelope-from git) Date: Wed, 26 Feb 2025 22:41:20 GMT Message-Id: <202502262241.51QMfKJc067777@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: 8a85584785e3 - main - pf: fix incorrect calls to pf_translate_icmp_af() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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: 8a85584785e3135f00a6d42e642f0e7ccee4f0f5 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8a85584785e3135f00a6d42e642f0e7ccee4f0f5 commit 8a85584785e3135f00a6d42e642f0e7ccee4f0f5 Author: Kristof Provost AuthorDate: 2025-02-26 16:22:25 +0000 Commit: Kristof Provost CommitDate: 2025-02-26 22:40:40 +0000 pf: fix incorrect calls to pf_translate_icmp_af() The 'iih' argument is already a pointer, pass it as is rather than its address. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index f3c9ea7a2fb1..24ddf75936de 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -8353,7 +8353,7 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, nk->af)) return (PF_DROP); pd->proto = IPPROTO_ICMPV6; - if (pf_translate_icmp_af(nk->af, &iih)) + if (pf_translate_icmp_af(nk->af, iih)) return (PF_DROP); if (virtual_type == htons(ICMP_ECHO) && nk->port[iidx] != iih->icmp_id) @@ -8465,7 +8465,7 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, nk->af)) return (PF_DROP); pd->proto = IPPROTO_ICMP; - if (pf_translate_icmp_af(nk->af, &iih)) + if (pf_translate_icmp_af(nk->af, iih)) return (PF_DROP); if (virtual_type == htons(ICMP6_ECHO_REQUEST) && From nobody Wed Feb 26 23:55:34 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z3BDn1dJKz5pChK; Wed, 26 Feb 2025 23:55:37 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z3BDn15f5z3w6f; Wed, 26 Feb 2025 23:55:37 +0000 (UTC) (envelope-from glebius@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740614137; 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=n7SW/UvcJkTk4xF4ffRVnl9NtcsbSYoaE/5bqjKcbf4=; b=R2RVTXqlnZsd07ym22PaNs+ogA8dp/0ICgegc+v/vhHaHnd4mvFv/vN0BMd90kfkf7TGoF jXOlAPGfDVuaxrPPPjr9wk4qzNaEIYLG+TnaA2Z0FkoLzGecVb1xWc29l4k11GyR8b7Z6F N459F9OQwP8mZVzs8Cw4ZXvouBZ/HvoAca73km3+RcTFJgHWW4BC/3Ac2IpPS1zqNkWNzk gKdN8lb6pr8up8G3F3E5suxbFxQcZwFkPyJB/vjQDSnE4rHl5n01UMhxMIHMugtaslQsoN heYV+6J9Zzf401FZP7T6dBcDYaAigIWGMdWqpCh7qgPHei3ww0p+uUbd8uai7g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740614137; a=rsa-sha256; cv=none; b=RoeBRrczpp1ieRuRpSN3nKctfHVyYD8+1Z+Z8JA5OqTppinJoZAjzLDzzmmotzpUzmaAYP xEMWG/dWE5LMu/hOUVXzt8PwyuorGZmH4BQgHDKHHS3bfeaIC81GazQNu2UT0QT9Ds1fKp itSvMzl7jKOA6bl/lHf1W8Bn90AwMM+4/O/ToAgAgJzvKDQwi0d+YHW5uWA3Qx3iwNjrg6 NXfxZnfX1mZ20VzR7OMYKLZu3hVliY93l7wdM5ZmbtuFefrncrBOpK7nbiwT/t9dMEkmxY 7iSQPhH4W3v3kWxhdrOh/bbxKB2uU+MV/BKh84DJUFE+lcqdur5j7R6COsY9Pg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740614137; 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=n7SW/UvcJkTk4xF4ffRVnl9NtcsbSYoaE/5bqjKcbf4=; b=jIFuAAw04kRKz1Jh+DzylAIErSKk3qQgctW4qt/qm/K4hP3x42M7YrYTeU7WZ4tXdCLaHc aZzWFY8ZNPTlt9aogt98CCaSkt2jo1MS2xDRMY1MZSguglaI9d9zbB+pm3C/w+ZbU8XzDI dQg/ikDa0I1MZLhZ1nrbHN0H+Byqrp2Z2seoGNDzen8I+V+4pg+SmExDRG4NFdzeJNfsn+ gHlS6nZDSnMcwmXrpnIISqBQIYqQU80yFgtZXmUsL2wBKpdEI50y81N9KDmvdtPg2hf+yA 9cChiVYb1nLV3vM9nC+3U/Nj3ECGtLtkWyJi9a80SHsvlVno+YVIX1gOm45pBg== Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: glebius) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Z3BDm3JxJz16Lp; Wed, 26 Feb 2025 23:55:36 +0000 (UTC) (envelope-from glebius@freebsd.org) Date: Wed, 26 Feb 2025 15:55:34 -0800 From: Gleb Smirnoff To: "Bjoern A. Zeeb" Cc: Michael Tuexen , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 0e58542fd246 - main - tcp: remove unused field from struct tcpcb Message-ID: References: <202502252048.51PKm4YX061305@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Feb 26, 2025 at 02:23:46AM +0000, Bjoern A. Zeeb wrote: B> > --- a/sys/netinet/tcp_var.h B> > +++ b/sys/netinet/tcp_var.h B> > @@ -452,7 +452,6 @@ struct tcpcb { B> > tcp_seq gput_seq; /* Outbound measurement seq */ B> > tcp_seq gput_ack; /* Inbound measurement ack */ B> > int32_t t_stats_gput_prev; /* XXXLAS: Prev gput measurement */ B> > - uint32_t t_maxpeakrate; /* max peak rate set by user, bytes/s */ B> B> Is the tcpcb no longer KBI relevant these days? B> In the old days we'd simply make this a spare and not move all offsets B> below around. In the old days tcpcb was visible to userland, that's why there was the spare habit. On FreeBSD CURRENT we don't provide KBI stability between core network stack and advanced TCP stacks as loadable modules, neither NIC driver modules that meddle with TCP. -- Gleb Smirnoff From nobody Thu Feb 27 00:32:22 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z3C3G4LmSz5pHwK; Thu, 27 Feb 2025 00:32:26 +0000 (UTC) (envelope-from bz@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z3C3G3hntz3QPp; Thu, 27 Feb 2025 00:32:26 +0000 (UTC) (envelope-from bz@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740616346; 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=NSi1RwBnMCoCVaVDviJXgmBW1fXREFT0snSTgJZ3ijg=; b=G6rZwQxuUF+LE7XMROkujeUpc2F0O2NJA5d2bxp0TAy2ATzzxJMMGwnrYQPcy22tu4Wn8a oU3sbfGATvB71JvkBGG+zfWEddzE6HHvGiA1yLJuFjon6aHFX92Pdn+p4fEvuhHPCCm4J1 nEh1i74aiiL2K2bl2gvw5+g/vhh4PmJESrg3gQvmOu8BaoGia+1ui00vjLCq38tmSCKzZy +nJV2IfKep/ZRZp6MyQTx/acXQftGY7cH8/PRHjWAkbdrjcpgFcEuttR3y9FwL7DrwV0EA p8h0JNBL08ryF1KisnuLzoQWraOg++uBMaHN7PxwWah+kgzTUluJazMSeysc4A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740616346; a=rsa-sha256; cv=none; b=cOGdCJm9q0Apuzep32m0tbnZoEal3M0TuRY+JqDNZjZUZyCfZlyR4lMhIDg9hWH6c6UsD/ +fsGWyDoWaoI8s2WCGqphS9Oo5BGVeXRosacDDit16cxnrDRhbilqvlQmLScwZSxgLlhp6 PKuVeYoVZJw5MA8tULYFddct9Tut2FkcvafbMGndsUfUGA6G3vJJnpHZOaGQfVYRCn3nFx gCcWSRhZmPqTK2dQgQG7HcRNOt6BcOaDzMWXxoF2Tth3zx4fRIusXg+htk0TR04yZwgIWH jlIMEqFE2sR1kUfbmnVgbdL70Jnzcc5dmPh4E317c8Xr+j+a4R7e5+UUlYNO0A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740616346; 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=NSi1RwBnMCoCVaVDviJXgmBW1fXREFT0snSTgJZ3ijg=; b=Pvj/6GX24pusdLBHTT71UmIwY0VZOLJOakuzzAxryF2wkOW4ZksCIpyaTlXvHxSvEezHkJ T0l2cFMtq8Kea8mopDcsr8H1NyBQrP/90MKaLrkVpcEkE+yAMbmIOtp+vJA8ZVdUppyK1G 5eH7fcnoEjyB6ko9Ew5PmbOTAPGFpOBh4+Zhe6p9hSpOKp3Y603qLRMOqXp6wLRnrJtPzI fnNKwtTqPLkyp9EmJD7s1aZkmZ6KdSFWKRg79cegWyu0EwE6tlwac0C6uFhcBV/sN5w3Pu 7Ja/7rKV/4R2aeeTbhhFzQ8f0rm8VIzGbju1GAK2yg6qKH9Mb9+iroDZFmYGjQ== Received: from mx-01.divo.sbone.de (mx-01.divo.sbone.de [IPv6:2003:a:140a:2200:6:594:fffe:19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature ECDSA (prime256v1) client-digest SHA256) (Client CN "mx-01.divo.sbone.de", Issuer "E5" (verified OK)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Z3C3G27Dnz16Xy; Thu, 27 Feb 2025 00:32:26 +0000 (UTC) (envelope-from bz@freebsd.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mx-01.divo.sbone.de (Postfix) with ESMTPS id 144D9A64806; Thu, 27 Feb 2025 00:32:23 +0000 (UTC) Received: from content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 8070E2D029D8; Thu, 27 Feb 2025 00:32:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) by content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (amavisd-new, port 10024) with ESMTP id yXwISqJBOk23; Thu, 27 Feb 2025 00:32:23 +0000 (UTC) Received: from strong-rtwn0.sbone.de (strong-rtwn0.sbone.de [IPv6:fde9:577b:c1a9:4902:da44:89ff:fedd:d5ab]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id A7EE02D029E1; Thu, 27 Feb 2025 00:32:23 +0000 (UTC) Date: Thu, 27 Feb 2025 00:32:22 +0000 (UTC) From: "Bjoern A. Zeeb" To: Gleb Smirnoff cc: Michael Tuexen , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 0e58542fd246 - main - tcp: remove unused field from struct tcpcb In-Reply-To: Message-ID: References: <202502252048.51PKm4YX061305@gitrepo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed On Wed, 26 Feb 2025, Gleb Smirnoff wrote: > On Wed, Feb 26, 2025 at 02:23:46AM +0000, Bjoern A. Zeeb wrote: > B> > --- a/sys/netinet/tcp_var.h > B> > +++ b/sys/netinet/tcp_var.h > B> > @@ -452,7 +452,6 @@ struct tcpcb { > B> > tcp_seq gput_seq; /* Outbound measurement seq */ > B> > tcp_seq gput_ack; /* Inbound measurement ack */ > B> > int32_t t_stats_gput_prev; /* XXXLAS: Prev gput measurement */ > B> > - uint32_t t_maxpeakrate; /* max peak rate set by user, bytes/s */ > B> > B> Is the tcpcb no longer KBI relevant these days? > B> In the old days we'd simply make this a spare and not move all offsets > B> below around. > > In the old days tcpcb was visible to userland, that's why there was > the spare habit. Yes, the problem really was with uitilities such as netstat. But I see you solved that ages ago with struct xtcpcb which has tons of spares to avoid that problem. Sorry for the noise. /bz -- Bjoern A. Zeeb r15:7 From nobody Thu Feb 27 08:08:32 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z3P9X4Wtlz5ppVD; Thu, 27 Feb 2025 08:08: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z3P9X3nhjz3WX3; Thu, 27 Feb 2025 08:08:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740643712; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bo4mVmuGMjlB+sK03YUTJxTUaS97EHtFlVTSvdlzbdA=; b=dL+nQ2BJ2b9UqFkH8I7lwtZVWbzFqx5Ef8UxHkJDsivFY6buj8n7bOOOWysYh9R98JrqDy 8GOrGfmP5Mwc+GCK6DBNgAjUpEzbxmrcOutLXbHU6JUbQnzg67iD3dqoVgqPq5UrZBCxU1 KT3NYc4aQriJutWR6Lfj7HiekV5lwA5ER6Rae9QubrT3Hwji0ubMaa9ILvglujeOGUMRsL b0VmxENjzAhs8vHallcQepsocWDiX0oU6rCq67PsaFbhJIXhBZ81pBfRcHEUMhL8BKarvZ 9FHIe5Gsi9LkmwLhgQWvAjOta5fywQCokEcmelj7Z4VJZH6aIiXyDhAIka8O7g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740643712; a=rsa-sha256; cv=none; b=c5AXfwcy0yIjTdNIxYJ/xYmjjJDJIOfnZVgIH9xGGfV7wMr3elpPSnCulL0Xrj9pWM6JZQ kBjnyL6nud3VsCoGSovoLgf5dfaH7XHNvwhOAkfJXbRSdzFkYpbD/Gkvy3QljXvvoAUCkl EpoNuTS+nCvRjl+iaZTeyumQIK51wGY/jbYIkjg0mz6LZRt5tLfV9TEgmb1UpDOJ6YBOzo UMk1bE1O0MdE9wVeY5eTgaZJRJih1qRSNqurSwCpK2o4HmgMb/pzf+DoCCUTs0ffWRKIKD j70RgwilqEb0RSlC9Df8tRZ4spfT4dRvP5/tmfDyFJKHwn1Kspdg+A2fW5ziTQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740643712; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bo4mVmuGMjlB+sK03YUTJxTUaS97EHtFlVTSvdlzbdA=; b=ggZMVClCPPi03hzGAFhMIPmS9f+IuT1cwT7XbLhfyv5P/79mcU8V14Dcy+SaHRfcsfhYc/ gfZy6K/XG3YtLHvpwzKDz94LRNZXJpI7tlFQTC84D5amF+WhRfPJmZdH5XuASyYYG9Q+4S SOowafWZVsS5PPubXwqXvTn6aQdvEbHEcfI4bM+aqvQjY9800VBAK0HZOwtI7T5FtnhUaF ny33AXdxBC+L/ZCImhKl3rrvC/7IXSxw6z7qmxFyfKWeBn98hsJnpzVCj+WzHWeb8I78Wj kedzA2s20sEPuJc2DnYYcR8BpoZtpwTEQenlc162KIRUdJh6M1vdctvOE9/gbg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z3P9X38sqzbGS; Thu, 27 Feb 2025 08:08:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51R88WtP024548; Thu, 27 Feb 2025 08:08:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51R88WAF024545; Thu, 27 Feb 2025 08:08:32 GMT (envelope-from git) Date: Thu, 27 Feb 2025 08:08:32 GMT Message-Id: <202502270808.51R88WAF024545@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wei Hu Subject: git: 9b8701b81f14 - main - mana: refill the rx mbuf in batch List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9b8701b81f14f0fa0787425eb9761b765d5faab0 Auto-Submitted: auto-generated The branch main has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=9b8701b81f14f0fa0787425eb9761b765d5faab0 commit 9b8701b81f14f0fa0787425eb9761b765d5faab0 Author: Wei Hu AuthorDate: 2025-02-27 08:02:46 +0000 Commit: Wei Hu CommitDate: 2025-02-27 08:08:13 +0000 mana: refill the rx mbuf in batch Set the default refill threshod to be one quarter of the rx queue length. User can change this value with hw.mana.rx_refill_thresh in loader.conf. It improves the rx completion handling by saving 10% to 15% of overall time with this change. Tested by: whu MFC after: 2 weeks Sponsored by: Microsoft --- sys/dev/mana/mana.h | 10 ++++ sys/dev/mana/mana_en.c | 127 ++++++++++++++++++++++++++++++++++----------- sys/dev/mana/mana_sysctl.c | 7 +++ 3 files changed, 114 insertions(+), 30 deletions(-) diff --git a/sys/dev/mana/mana.h b/sys/dev/mana/mana.h index a805aa047b9d..a037eb3f05c7 100644 --- a/sys/dev/mana/mana.h +++ b/sys/dev/mana/mana.h @@ -149,6 +149,7 @@ struct mana_stats { counter_u64_t collapse_err; /* tx */ counter_u64_t dma_mapping_err; /* rx, tx */ counter_u64_t mbuf_alloc_fail; /* rx */ + counter_u64_t partial_refill; /* rx */ counter_u64_t alt_chg; /* tx */ counter_u64_t alt_reset; /* tx */ counter_u64_t cqe_err; /* tx */ @@ -441,6 +442,8 @@ struct mana_rxq { uint32_t num_rx_buf; uint32_t buf_index; + uint32_t next_to_refill; + uint32_t refill_thresh; uint64_t lro_tried; uint64_t lro_failed; @@ -711,6 +714,13 @@ struct mana_cfg_rx_steer_resp { #define MANA_SHORT_VPORT_OFFSET_MAX ((1U << 8) - 1) +#define MANA_IDX_NEXT(idx, size) (((idx) + 1) & ((size) - 1)) +#define MANA_GET_SPACE(start_idx, end_idx, size) \ + (((end_idx) >= (start_idx)) ? \ + ((end_idx) - (start_idx)) : ((size) - (start_idx) + (end_idx))) + +#define MANA_RX_REFILL_THRESH 256 + struct mana_tx_package { struct gdma_wqe_request wqe_req; struct gdma_sge sgl_array[MAX_MBUF_FRAGS]; diff --git a/sys/dev/mana/mana_en.c b/sys/dev/mana/mana_en.c index a1d2d1015b89..94cca4fa50c7 100644 --- a/sys/dev/mana/mana_en.c +++ b/sys/dev/mana/mana_en.c @@ -69,6 +69,7 @@ static int mana_down(struct mana_port_context *apc); extern unsigned int mana_tx_req_size; extern unsigned int mana_rx_req_size; +extern unsigned int mana_rx_refill_threshold; static void mana_rss_key_fill(void *k, size_t size) @@ -638,8 +639,7 @@ mana_xmit(struct mana_txq *txq) continue; } - next_to_use = - (next_to_use + 1) % tx_queue_size; + next_to_use = MANA_IDX_NEXT(next_to_use, tx_queue_size); (void)atomic_inc_return(&txq->pending_sends); @@ -1527,7 +1527,7 @@ mana_poll_tx_cq(struct mana_cq *cq) mb(); next_to_complete = - (next_to_complete + 1) % tx_queue_size; + MANA_IDX_NEXT(next_to_complete, tx_queue_size); pkt_transmitted++; } @@ -1592,18 +1592,11 @@ mana_poll_tx_cq(struct mana_cq *cq) } static void -mana_post_pkt_rxq(struct mana_rxq *rxq) +mana_post_pkt_rxq(struct mana_rxq *rxq, + struct mana_recv_buf_oob *recv_buf_oob) { - struct mana_recv_buf_oob *recv_buf_oob; - uint32_t curr_index; int err; - curr_index = rxq->buf_index++; - if (rxq->buf_index == rxq->num_rx_buf) - rxq->buf_index = 0; - - recv_buf_oob = &rxq->rx_oobs[curr_index]; - err = mana_gd_post_work_request(rxq->gdma_rq, &recv_buf_oob->wqe_req, &recv_buf_oob->wqe_inf); if (err) { @@ -1722,6 +1715,68 @@ mana_rx_mbuf(struct mbuf *mbuf, struct mana_rxcomp_oob *cqe, counter_exit(); } +static int +mana_refill_rx_mbufs(struct mana_port_context *apc, + struct mana_rxq *rxq, uint32_t num) +{ + struct mana_recv_buf_oob *rxbuf_oob; + uint32_t next_to_refill; + uint32_t i; + int err; + + next_to_refill = rxq->next_to_refill; + + for (i = 0; i < num; i++) { + if (next_to_refill == rxq->buf_index) { + mana_warn(NULL, "refilling index reached current, " + "aborted! rxq %u, oob idx %u\n", + rxq->rxq_idx, next_to_refill); + break; + } + + rxbuf_oob = &rxq->rx_oobs[next_to_refill]; + + if (likely(rxbuf_oob->mbuf == NULL)) { + err = mana_load_rx_mbuf(apc, rxq, rxbuf_oob, true); + } else { + mana_warn(NULL, "mbuf not null when refilling, " + "rxq %u, oob idx %u, reusing\n", + rxq->rxq_idx, next_to_refill); + err = mana_load_rx_mbuf(apc, rxq, rxbuf_oob, false); + } + + if (unlikely(err != 0)) { + mana_dbg(NULL, + "failed to load rx mbuf, err = %d, rxq = %u\n", + err, rxq->rxq_idx); + counter_u64_add(rxq->stats.mbuf_alloc_fail, 1); + break; + } + + mana_post_pkt_rxq(rxq, rxbuf_oob); + + next_to_refill = MANA_IDX_NEXT(next_to_refill, + rxq->num_rx_buf); + } + + if (likely(i != 0)) { + struct gdma_context *gc = + rxq->gdma_rq->gdma_dev->gdma_context; + + mana_gd_wq_ring_doorbell(gc, rxq->gdma_rq); + } + + if (unlikely(i < num)) { + counter_u64_add(rxq->stats.partial_refill, 1); + mana_dbg(NULL, + "refilled rxq %u with only %u mbufs (%u requested)\n", + rxq->rxq_idx, i, num); + } + + rxq->next_to_refill = next_to_refill; + return (i); +} + static void mana_process_rx_cqe(struct mana_rxq *rxq, struct mana_cq *cq, struct gdma_comp *cqe) @@ -1731,8 +1786,8 @@ mana_process_rx_cqe(struct mana_rxq *rxq, struct mana_cq *cq, if_t ndev = rxq->ndev; struct mana_port_context *apc; struct mbuf *old_mbuf; + uint32_t refill_required; uint32_t curr, pktlen; - int err; switch (oob->cqe_hdr.cqe_type) { case CQE_RX_OKAY: @@ -1785,29 +1840,24 @@ mana_process_rx_cqe(struct mana_rxq *rxq, struct mana_cq *cq, /* Unload DMA map for the old mbuf */ mana_unload_rx_mbuf(apc, rxq, rxbuf_oob, false); - - /* Load a new mbuf to replace the old one */ - err = mana_load_rx_mbuf(apc, rxq, rxbuf_oob, true); - if (err) { - mana_dbg(NULL, - "failed to load rx mbuf, err = %d, packet dropped.\n", - err); - counter_u64_add(rxq->stats.mbuf_alloc_fail, 1); - /* - * Failed to load new mbuf, rxbuf_oob->mbuf is still - * pointing to the old one. Drop the packet. - */ - old_mbuf = NULL; - /* Reload the existing mbuf */ - mana_load_rx_mbuf(apc, rxq, rxbuf_oob, false); - } + /* Clear the mbuf pointer to avoid reuse */ + rxbuf_oob->mbuf = NULL; mana_rx_mbuf(old_mbuf, oob, rxq); drop: mana_move_wq_tail(rxq->gdma_rq, rxbuf_oob->wqe_inf.wqe_size_in_bu); - mana_post_pkt_rxq(rxq); + rxq->buf_index = MANA_IDX_NEXT(rxq->buf_index, rxq->num_rx_buf); + + /* Check if refill is needed */ + refill_required = MANA_GET_SPACE(rxq->next_to_refill, + rxq->buf_index, rxq->num_rx_buf); + + if (refill_required >= rxq->refill_thresh) { + /* Refill empty rx_oobs with new mbufs */ + mana_refill_rx_mbufs(apc, rxq, refill_required); + } } static void @@ -2349,6 +2399,23 @@ mana_create_rxq(struct mana_port_context *apc, uint32_t rxq_idx, mana_dbg(NULL, "Setting rxq %d datasize %d\n", rxq_idx, rxq->datasize); + /* + * Two steps to set the mbuf refill_thresh. + * 1) If mana_rx_refill_threshold is set, honor it. + * Set to default value otherwise. + * 2) Select the smaller of 1) above and 1/4 of the + * rx buffer size. + */ + if (mana_rx_refill_threshold != 0) + rxq->refill_thresh = mana_rx_refill_threshold; + else + rxq->refill_thresh = MANA_RX_REFILL_THRESH; + rxq->refill_thresh = min_t(uint32_t, + rxq->num_rx_buf / 4, rxq->refill_thresh); + + mana_dbg(NULL, "Setting rxq %d refill thresh %u\n", + rxq_idx, rxq->refill_thresh); + rxq->rxobj = INVALID_MANA_HANDLE; err = mana_alloc_rx_wqe(apc, rxq, &rq_size, &cq_size); diff --git a/sys/dev/mana/mana_sysctl.c b/sys/dev/mana/mana_sysctl.c index acb3628f09bc..c2916f9004cd 100644 --- a/sys/dev/mana/mana_sysctl.c +++ b/sys/dev/mana/mana_sysctl.c @@ -36,6 +36,7 @@ int mana_log_level = MANA_ALERT | MANA_WARNING | MANA_INFO; unsigned int mana_tx_req_size; unsigned int mana_rx_req_size; +unsigned int mana_rx_refill_threshold; SYSCTL_NODE(_hw, OID_AUTO, mana, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "MANA driver parameters"); @@ -44,6 +45,9 @@ SYSCTL_UINT(_hw_mana, OID_AUTO, tx_req_size, CTLFLAG_RWTUN, &mana_tx_req_size, 0, "requested number of unit of tx queue"); SYSCTL_UINT(_hw_mana, OID_AUTO, rx_req_size, CTLFLAG_RWTUN, &mana_rx_req_size, 0, "requested number of unit of rx queue"); +SYSCTL_UINT(_hw_mana, OID_AUTO, rx_refill_thresh, CTLFLAG_RWTUN, + &mana_rx_refill_threshold, 0, + "number of rx slots before starting the refill"); /* * Logging level for changing verbosity of the output @@ -329,6 +333,9 @@ mana_sysctl_add_queues(struct mana_port_context *apc) SYSCTL_ADD_COUNTER_U64(ctx, rx_list, OID_AUTO, "mbuf_alloc_fail", CTLFLAG_RD, &rx_stats->mbuf_alloc_fail, "Failed mbuf allocs"); + SYSCTL_ADD_COUNTER_U64(ctx, rx_list, OID_AUTO, + "partial_refill", CTLFLAG_RD, + &rx_stats->partial_refill, "Partially refilled mbuf"); SYSCTL_ADD_COUNTER_U64(ctx, rx_list, OID_AUTO, "dma_mapping_err", CTLFLAG_RD, &rx_stats->dma_mapping_err, "DMA mapping errors"); From nobody Thu Feb 27 09:36:34 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z3R765YMBz5pxrW; Thu, 27 Feb 2025 09:36: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z3R764yjdz3hZJ; Thu, 27 Feb 2025 09:36:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740648994; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=A9+skjn7P+VOPRvkeS2Hs+C++L8xiLxBJjOwDLtWTp4=; b=dgphkpWnPisQoXLfmxvJ3IT+zC2zjzcOqIRCtf7ItlqrgaJ/HQ4cUjLc5Jrrf4/PuNvjkO WW0z3mKpl9Vok4ktQIo4E8hQfLcQH73BFo0l6Lvp/Bh12AFH/vQiRNXh7Xzml8fSKsuNWc A21vN255oztGLuaGD+KWhA42EzwWFS4hZ+ijuhpJjvDFb5B+k3dxRT6QgWQtZnRjiWVJsP UhrNJdVhxillkrmCIEUSKqxObEduSVqWqcr7zPDfQUuK8TJSlZb0g9WV2jUlOUTAkxOats Cughy4L/4KRnw2EtV+SmtKaS2pcuu+pMGTs0zrqta6K6gt+QoTTfz14EAEvdSQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740648994; a=rsa-sha256; cv=none; b=bmmhwwn2MchDkESsnKCRQEdkuniDFeeG3Q6ZJ0GjDygTtiP5i20RnKH7QuZEjC3RiNEC2p MFjIbs6xoEycre/XZ/acVONnu9u9qRRaugkJ6Z8zdxAWr62HMZPm9gBVx4o0cBiaUw4oNA bwTeG0/BoSPvhAQpuSOWB9wA/0SZbiyi2yVC1Cb3ZqreGXj4tLa4lmkvpdObQErGpR8Yau raFELTB/tjOXJGpB9Bg03cyamy0UVOv8YEBHw/EV4k4z3mIq1+aEsWZpHOH0gbc5qPPwmH BpxwSIfKeBxLtM9byKkU0ifNOzGyGbxkK6hXYBgUouX3q2VhMZ4PyRE2B5jziw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740648994; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=A9+skjn7P+VOPRvkeS2Hs+C++L8xiLxBJjOwDLtWTp4=; b=f+nVHz8OsemLMchAHAE/zlt8/AjKUMTnynmsgUARJpQRCtvVk9Uq58CekM9t+rFCI1BqZ9 Wq4CzioYjKZ9qReKQsPRnUyf/fiOkeAt3+rFGabJUwr7JUdoLFM5CNzhAQP8DxqzT0EPQZ yflvGM0Hh+PIWkS7qVlEKqepgJSOxoRRDlqsXtQjRAFHWCbpHZjOeKx7AdPFkiKv5nxLH+ BW9mz1m//37c0r+vpUHczMTtUz2OfyrANMfKJvX9qVBvm/wxRTG5rP5TtP99LS8gKnydkY 7ka8iNFinX/FX/iO44eTJSJurDIRul8cX+SPVu3reB2FCHVLh1bbcMQTK5qTGw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z3R764G1Lzcwt; Thu, 27 Feb 2025 09:36:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51R9aYqP091779; Thu, 27 Feb 2025 09:36:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51R9aYg1091776; Thu, 27 Feb 2025 09:36:34 GMT (envelope-from git) Date: Thu, 27 Feb 2025 09:36:34 GMT Message-Id: <202502270936.51R9aYg1091776@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Stefan =?utf-8?Q?E=C3=9Fer?= Subject: git: ab6a311c720e - main - libc/gen/fts.c: fix assignment List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ab6a311c720e93c860d3dd4a335264d725db7a0d Auto-Submitted: auto-generated The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=ab6a311c720e93c860d3dd4a335264d725db7a0d commit ab6a311c720e93c860d3dd4a335264d725db7a0d Author: Stefan Eßer AuthorDate: 2025-02-27 09:29:17 +0000 Commit: Stefan Eßer CommitDate: 2025-02-27 09:29:17 +0000 libc/gen/fts.c: fix assignment Fix typo in commit e59991206b ("==" instead of "=" for the assignment of st_ino). Reported by: Coverity Scan CID 1592442 Approved by: kib Fixes: e59991206b fts(3): be less strict when automount does its job under us walking autofs mount --- lib/libc/gen/fts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c index bd193c7c6cfc..80f98a993123 100644 --- a/lib/libc/gen/fts.c +++ b/lib/libc/gen/fts.c @@ -1153,7 +1153,7 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char *path) } /* autofs might did the mount under us, accept. */ p->fts_dev = sb.st_dev; - p->fts_ino == sb.st_ino; + p->fts_ino = sb.st_ino; } ret = fchdir(newfd); bail: From nobody Thu Feb 27 22:22:00 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z3m6K1hjhz5JlFf; Thu, 27 Feb 2025 22:22:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z3m6J2w2Pz3YR3; Thu, 27 Feb 2025 22:22:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740694920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/iz2HSFOjdLlCsk3DUmwOze5MmXUzK/94QMwU1DgOGo=; b=IbsK9MJKbYA5APL8fgxtyjd2wF7nn4YEcInM8ny/X/nbhplN+sKJrc3SrAOKKeiDb5mayq 93ow2j0SGwGo85QCUSlC8bRqH35Utse0natUPzaFHqxj2JmYEY23auH8kubiwyRfx0geLA mOS+VU01V9YrxM/jHdWlDTMhSm2up8Zz/jj4+LESIjASUWF55s+l0sz4xkTWpaUxRg7cO6 LmGeGJ6eemwVrP8oKmSpNTgexKQ9j+W3d0zAeRBpF78HLDmMs4z7pkNHEeDKKA40Qa1x3Q WmhEFaGm3Cflxb4Zj90gkMZ7u/PodtIi6xHELcfr3PLm/dopDXYwsHwJ8mqnDw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740694920; a=rsa-sha256; cv=none; b=mo3y/l1JHxhJZItkycnFtZJsLcBZiz4dgxBzd4bjZnAbVZ/kyaRbZoYuT/eRNYJMsLcZU2 hqy31Mf3aJiyF0Q7/98ehGbpOCyuZV0lQaKQxuA0/7TlsvhlSa6hod9af3La7B1aFKIqPm 0gA70lIleTFGrFMx14ihv+w+XEPHawJa6uT+o8DDhVipnTsy1ovXLMeR98ZELDt3zyk0Fi 4puuLiODPm3RaBzYAqMQcTbhgRLLNlzdeiQrRSszX+aSRWWEQ8i9P4CXvQHyb06uWfsm1m b1v+HZ7lHGI5Tipt9UjXWhbJywEHP2yGcRvwuoYr1osPQl2gwVtQN3NQlh+sKA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740694920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/iz2HSFOjdLlCsk3DUmwOze5MmXUzK/94QMwU1DgOGo=; b=W+WtHTVLceQyF2rLOQI6HMEfv+qoQPno+0QJyRwUQKNDImU1LBnR2/LpiV5at/29STeXL+ 2IUCoMq5Bmlla/DG3elk8tR2r3wmWQKQaM1emJyjO6LaLrFzWpIzGsidjrF7VNu7N6U3gA sBiqORIBlaYFVdS1tN3rkcmej5d/AvA5D03Bz1LRhBL2Q4v951VzVmihRZiITlarDXYPV6 jSakssFXDUZX861BohUE/1r+ymQlDfFeDa3P0QUiO4xPP9uqM66taxTrO8gBwacY9seMKn w2MZIgO9+ylyohrVZT24IMQHkPXDg7es/iBAokdGHb0nLA4q/z6tJwmOaisM8w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z3m6J1vM3z11QL; Thu, 27 Feb 2025 22:22:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51RMM0sn033516; Thu, 27 Feb 2025 22:22:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51RMM0fg033513; Thu, 27 Feb 2025 22:22:00 GMT (envelope-from git) Date: Thu, 27 Feb 2025 22:22:00 GMT Message-Id: <202502272222.51RMM0fg033513@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Ziaee Subject: git: 4262dbc57982 - main - wifi manuals: Mlink + document description consistency List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4262dbc57982383eb61a8b7806de6dd4b7802da8 Auto-Submitted: auto-generated The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=4262dbc57982383eb61a8b7806de6dd4b7802da8 commit 4262dbc57982383eb61a8b7806de6dd4b7802da8 Author: Alexander Ziaee AuthorDate: 2025-02-19 15:54:27 +0000 Commit: Alexander Ziaee CommitDate: 2025-02-27 22:20:22 +0000 wifi manuals: Mlink + document description consistency Interfaces all have an mlink to if_$foo. Add these for the missing ones and remove an incorrect one from rtwn_pci. Wireless network drivers are all accessible via `apropos -s4 "wireless network driver", except two which are "wireless network device". I actually prefer the latter, but make them all consistent upon the more common parlance. Tag SPDX on one of the files I touched, while here. MFC after: 3 days Reviewed by: bz, carlavilla, mhorne Approved by: carlavilla, mhorne (mentors) Differential Revision: https://reviews.freebsd.org/D49063 --- share/man/man4/Makefile | 4 +++- share/man/man4/uath.4 | 4 +++- share/man/man4/upgt.4 | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 13afc9b8d399..8e0af19eec3d 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -764,7 +764,9 @@ MLINKS+=ptnet.4 if_ptnet.4 MLINKS+=ral.4 if_ral.4 MLINKS+=re.4 if_re.4 MLINKS+=rl.4 if_rl.4 -MLINKS+=rtwn_pci.4 if_rtwn_pci.4 +MLINKS+=rtw88.4 if_rtw89.4 +MLINKS+=rtw89.4 if_rtw89.4 +MLINKS+=rtwn.4 if_rtwn.4 MLINKS+=rue.4 if_rue.4 MLINKS+=scsi.4 cam.4 MLINKS+=scsi.4 scbus.4 diff --git a/share/man/man4/uath.4 b/share/man/man4/uath.4 index 7d9632fe8e0f..865f04b84232 100644 --- a/share/man/man4/uath.4 +++ b/share/man/man4/uath.4 @@ -1,4 +1,6 @@ .\" +.\" SPDX-License-Identifier: ISC +.\" .\" Copyright (c) 2006 .\" Damien Bergamini .\" @@ -19,7 +21,7 @@ .Os .Sh NAME .Nm uath -.Nd Atheros USB IEEE 802.11a/b/g wireless network device +.Nd Atheros USB IEEE 802.11a/b/g wireless network driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your diff --git a/share/man/man4/upgt.4 b/share/man/man4/upgt.4 index 508c87c6a925..5d4ada1d1a1f 100644 --- a/share/man/man4/upgt.4 +++ b/share/man/man4/upgt.4 @@ -54,7 +54,7 @@ .Sh NAME .Nm upgt .Nd Conexant/Intersil PrismGT SoftMAC USB IEEE 802.11b/g wireless network -device +driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your From nobody Thu Feb 27 21:05:32 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z3kQ508B8z59Wyd; Thu, 27 Feb 2025 21:05: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z3kQ46Yycz43tk; Thu, 27 Feb 2025 21:05:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740690332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BvwJutJZeD+c1t+ae1APbgtquXkhcIgT3lcTCtw96dk=; b=H33NC7hrx9W8wNZnGLVqU7HjawhbH43F7oEpAN0zaCLW/znspG8hf7oMz6mFT/M7UNqaJ0 ilkm7EMTylzNADlcBdDWw3g+yH9wssikqmV3bckThrd1GZoMfr0ZRAWAB4amtL/xMS7/I/ ++CaTNxzy0m5uNjgqwZuQBLHk8tUOx5ICud3A/GlH7pxLUJ6kstjZgx6y9iLtNMklAAzK1 zFM6G9pLVvj7I48/rfOL29qudJT75toVo4WeSpdCaKmdOeyVfCVf7EtAcmQ0HYzOm+MiZH D+/VZKsuLx5Ra231k8TqSL4Wp8O3qfq9+mWoF0in19SOj/8FDQMQuh/pzxguPA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740690332; a=rsa-sha256; cv=none; b=JDrOwtAElPVTybTAtZvNqpXjmvJ04II0g1P/yIItqRhVAKRF+zEmH0MZAas2mdgQSn5lsx 380/+zpvHUI+DkZTACr6C4VI28Q68cpI56CNj7nf+HW2IERdRXIO1YHcxXkFHOhgK8mxoH Xdc6wL5+v6Yr79bNT7Q95r9zbf/MRRMEJ1cXvnEp7WYmjjXz33yMFlXKJjOwH3Rc7k7t2N NmzceMWKrONbl57ezb6Qk3ics4Zu+aDwl9rOaXTIy2fceil2quWJJlfGsvHAmNcCN2gVbG dNqFA7ECm/PJ1DvSm8Hs/UocLmRMjpRJZhsqBtkvpExCJqDy5Q6WrxednoigTw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740690332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BvwJutJZeD+c1t+ae1APbgtquXkhcIgT3lcTCtw96dk=; b=azxv6w5hJ+I6kDZeSKQ4uFE+ZYYZrvbZUekyR0w3HZs4szUEEpdvt7Y9465e+VPNVeoFQ7 J3/dwrCZ9yBHEOsW0g16LGLB5aNu8DCmroWpXR1QenFGE4IGf6FcLnKh+F3LWeVW4bqjw1 qpxkHJDr7viI82FbVDdRoGfEirqqcO8FJPAOP3CqvZ9sWn4QA4HK+lFArLX3JGCLM3v0ld Uyn3PVDUeko5KljBvXGogy8aQdr05hJjXdl0OXQoQFmMNS8tXf7yRUUDQD3ctvWN2unMR+ EMbswF1aVaANMxpvgikSTQV9c/sexc+o8XdxOe0gpRSO64OJK+EvY+/noHrokQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z3kQ469GZz10Cl; Thu, 27 Feb 2025 21:05:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51RL5W9P085998; Thu, 27 Feb 2025 21:05:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51RL5WB1085995; Thu, 27 Feb 2025 21:05:32 GMT (envelope-from git) Date: Thu, 27 Feb 2025 21:05:32 GMT Message-Id: <202502272105.51RL5WB1085995@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: d3c4b002d1fd - main - queue: Fix STAILQ_ASSERT_EMPTY() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d3c4b002d1fd54ac69c1714e208051867ee56dc4 Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=d3c4b002d1fd54ac69c1714e208051867ee56dc4 commit d3c4b002d1fd54ac69c1714e208051867ee56dc4 Author: Olivier Certner AuthorDate: 2025-02-27 20:59:41 +0000 Commit: Olivier Certner CommitDate: 2025-02-27 21:04:17 +0000 queue: Fix STAILQ_ASSERT_EMPTY() The 'while' part corresponding to the 'do' was missing. Did not notice the problem as later commits using it have been stashed and never reworked up to now, and it is currently unused in the tree. While here, fix spacing after the '#define' in the !(_KERNEL && INVARIANS) part. Fixes: 34740937f7a4 ("queue: New debug macros for STAILQ") MFC after: 1 minute Sponsored by: The FreeBSD Foundation --- sys/sys/queue.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/sys/queue.h b/sys/sys/queue.h index 6e4da0fa0bec..70d13ee92617 100644 --- a/sys/sys/queue.h +++ b/sys/sys/queue.h @@ -358,7 +358,7 @@ struct { \ #define STAILQ_ASSERT_EMPTY(head) do { \ if (!STAILQ_EMPTY((head))) \ panic("stailq %p is not empty", (head)); \ -} +} while (0) /* * QMD_STAILQ_CHECK_TAIL(STAILQ_HEAD *head) @@ -372,7 +372,7 @@ struct { \ } while (0) #else #define QMD_STAILQ_CHECK_EMPTY(head) -#define STAILQ_ASSERT_EMPTY(head) +#define STAILQ_ASSERT_EMPTY(head) #define QMD_STAILQ_CHECK_TAIL(head) #endif /* (_KERNEL && INVARIANTS) */ From nobody Thu Feb 27 15:59:20 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z3bcn1H0Qz5qKcl; Thu, 27 Feb 2025 15:59:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z3bcm5BgVz43WZ; Thu, 27 Feb 2025 15:59:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740671960; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4lafgwD9w4GGx0ZwQM1MNNFPt6gcE7UeBvQep5RpCDI=; b=Yu0Cog3+cObxenNx5vxfzIWRDGIGoJq5K+1cC9j6a17oKo45Dny4HTDWQ5QqVwhHkbJ95+ WxsquAY4Wc49Mc7txgw/JzH0j71wo68TLd18TGmJoC/VrdDplmq+Saczx5/pPjmiEuWwMZ 4uDxrQHrTFoFJkL0dVtJiCstrgHf3mRKslrnH7wsL1rcczrFWdl9E/v+Zwjjz8TFOcIDmn lCbitvAN5No/okRt2VNhcRbnWScJpTjuKL7s1mG2WWKjPpgEUcScuNr2ytsqEUurme/d9b pu/uR8SRrb7qWEDlDVi/l916/ZeV8l8L5yi9QUpKleASEWE5eyIXjSzS3J5YJA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740671960; a=rsa-sha256; cv=none; b=WEjhgdsbAwBtzmZbU4krlubs1Qnwjk1clEP75q16UzA+BsqCy6/ofOB3M7bnktUg6MdgRd cN6vhVO8sBoQtRoirE4iuXQw0vIH7+CQx6b+Pqq0PnK4c8/Cy+xV7xg2V/1Y03AlRTdp2J 7Uo50r4i9wdYZb8z+kK0Sky7b9blT2CoNvEUoGTfTVqthrMt9eHJg3n/k/dR5bPbhdw97D tnD3OUIBkLJpUlRQg4kCY5AOnRa+VeWpcl7sGTI7kdCi5n2HyKDDDb9uoCzftcskO4YUGy S/EItUf2fb1uTVCzWR7QOmnEe6DTiOjIu/+nmD7SXtWwGZEHN1iY7MF5sVXpKQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740671960; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4lafgwD9w4GGx0ZwQM1MNNFPt6gcE7UeBvQep5RpCDI=; b=LuR5i7wnR0bGN4WqqntuMr+fZNHUL8mcMfXQ/D/ePfFz78uhGXgnF2+aEeEaxs1EdVtzzs n/fYTv1+rqiKcIO+qvQu3knu9RhWYu1gSCv7WYt7iUpUWAVl4napu0llugnVf/e0AX4jYf rjVom4Q64MxiOb4rBzCc77SqIQmI9AVjyCM9GVU/3ht4djM+04fSafYTxW2rLXB5A1zeHu IemCXdPqMrqrrXGuRRUKZxSpw4p/sXEvmiobu1Khvcz3JhMk7vPORT33ZM7UeGfLgqMhr3 yEtHuXxYGHFWnn5FDQbNfL110/+TtiiVmsJuELM8hdEuFWMKL705kA/7E7T3WA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z3bcm4dVkzqP2; Thu, 27 Feb 2025 15:59:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51RFxKPp004670; Thu, 27 Feb 2025 15:59:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51RFxKme004667; Thu, 27 Feb 2025 15:59:20 GMT (envelope-from git) Date: Thu, 27 Feb 2025 15:59:20 GMT Message-Id: <202502271559.51RFxKme004667@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 97309cec6f31 - main - netinet: Make in_ifhasaddr() return bool List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 97309cec6f31f1f4f7a76f9ec5c7dd359c56de02 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=97309cec6f31f1f4f7a76f9ec5c7dd359c56de02 commit 97309cec6f31f1f4f7a76f9ec5c7dd359c56de02 Author: Zhenlei Huang AuthorDate: 2025-02-27 15:58:20 +0000 Commit: Zhenlei Huang CommitDate: 2025-02-27 15:58:20 +0000 netinet: Make in_ifhasaddr() return bool No functional change intended. MFC after: 1 week --- sys/netinet/in.c | 8 ++++---- sys/netinet/in.h | 2 +- sys/netinet/udp_usrreq.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 5a28eecc6945..9a644c60e541 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -185,9 +185,9 @@ in_localip_fib(struct in_addr in, uint16_t fib) } /* - * Return 1 if an internet address is configured on an interface. + * Return true if an internet address is configured on an interface. */ -int +bool in_ifhasaddr(struct ifnet *ifp, struct in_addr in) { struct ifaddr *ifa; @@ -200,10 +200,10 @@ in_ifhasaddr(struct ifnet *ifp, struct in_addr in) continue; ia = (struct in_ifaddr *)ifa; if (ia->ia_addr.sin_addr.s_addr == in.s_addr) - return (1); + return (true); } - return (0); + return (false); } /* diff --git a/sys/netinet/in.h b/sys/netinet/in.h index 0ebd238d6638..3d087e5b06d5 100644 --- a/sys/netinet/in.h +++ b/sys/netinet/in.h @@ -678,7 +678,7 @@ int in_canforward(struct in_addr); bool in_localaddr(struct in_addr); bool in_localip(struct in_addr); bool in_localip_fib(struct in_addr, uint16_t); -int in_ifhasaddr(struct ifnet *, struct in_addr); +bool in_ifhasaddr(struct ifnet *, struct in_addr); struct in_ifaddr *in_findlocal(uint32_t, bool); int inet_aton(const char *, struct in_addr *); /* in libkern */ char *inet_ntoa_r(struct in_addr ina, char *buf); /* in libkern */ diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 131242ce9859..2c68d0880100 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1072,7 +1072,7 @@ udp_v4mapped_pktinfo(struct cmsghdr *cm, struct sockaddr_in * src, ifp = NULL; if (ifp != NULL && !IN6_IS_ADDR_UNSPECIFIED(&pktinfo->ipi6_addr)) { ia.s_addr = pktinfo->ipi6_addr.s6_addr32[3]; - if (in_ifhasaddr(ifp, ia) == 0) + if (!in_ifhasaddr(ifp, ia)) return (EADDRNOTAVAIL); } From nobody Thu Feb 27 15:59:19 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z3bcm10qCz5qKXh; Thu, 27 Feb 2025 15:59: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z3bcl4Qvvz43HP; Thu, 27 Feb 2025 15:59:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740671959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZcINcqUqiKkNO3qxq0fG9f4C2FHXQa6XM5+TV6epi9E=; b=IA+0NliFpHzY5i8T6hLxAhEMhrJWb9/vdk+e+z8yp6vCqAa718ES9Wm8BrtXss5ZDvJqLi rJ0pz0BAdNGv796UAEDrOs/c8/5KVguKiLu+EUI3z8VuCHgqqX/WOZr9RCU96Ob0gA6icj MheKCoKEpLTM5bvi5fQZ2bqgJFCir/yt2WR+1866nI2yi/65PD6wTSrRDBUPlWHykasD3K WY+8ad1s93gCsikVGLjlh7IhCp1JBNNxuf4A8KhsL8/kGZofNDTt8lvRXkbvyP87Je8oLW PookOO73a6nhJZvGuk2HYQ+c8qD7BTxFK3pPgvu78IPiI0rBLHMITvH5t9wGyg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740671959; a=rsa-sha256; cv=none; b=UzNv+/A+emvwZQfo0L0UqYfJFtNpb9jyXrGeDKLjFyaXdOJHgXgav8zz6xefTDxgfXHV6B GMNdREWByC44fx23olNEq5QH/zjmKXhPTX4U3fOe2x272SAf7jBVzmLYwzE5lZtNIQbjzs vB36SDqo5VtQw0x4aytI7C1RVlj7WSzX0NQj3BZjBgvFjJomQRXpad9G+aFMVn3fsjDdoH 1ozQhbE9xWQEzp7PhoiBOrryCdh4zI9FJFdnkPJdfFeaXOEj3qeps9gAg1fQsvsPLLiJgT Ija517DlUooLRi4vxqMLKgQ37KxM985t/KfdFirYHOsXHrRxg6ocSEB4w7myug== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740671959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZcINcqUqiKkNO3qxq0fG9f4C2FHXQa6XM5+TV6epi9E=; b=LkBjlXQqsyT1Ca5569yh5cXapXNbl43KTiFMRliA2zcQho+Zw/dgJZBQ4mDKYkFKBBpA2x oAuSO1lPTNCmsHj14wAeuUD1kacG9FfzbCNRYcO0AUE9wItlFAiH/ZpLq+j3AWWnZaRsRB NaZ7VkFNPHs6eUzqvCYD3k4NHhxKKU2UaGpH0jyYjfBdEGQWxhs4QqUjdOq0CUB/qtitY1 Mk3Gqb4xG1UJ9FMaFbUxnfq7YuQQGKgZR4KoS7vpGcokBMAMzfxHaaD6d/Z+chD51xBnl8 ygpaGJAzpy4+KCNbWDXKnaMhUIAsFGi46QaKt4l0JK+AjjWwfkafr5WbZ6DSGQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z3bcl3zzfzpR5; Thu, 27 Feb 2025 15:59:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51RFxJ8R004627; Thu, 27 Feb 2025 15:59:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51RFxJ36004624; Thu, 27 Feb 2025 15:59:19 GMT (envelope-from git) Date: Thu, 27 Feb 2025 15:59:19 GMT Message-Id: <202502271559.51RFxJ36004624@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 69beb162848b - main - netinet: Make in_localaddr() return bool List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 69beb162848b15c967d3b45ac56501dbd8b94e91 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=69beb162848b15c967d3b45ac56501dbd8b94e91 commit 69beb162848b15c967d3b45ac56501dbd8b94e91 Author: Zhenlei Huang AuthorDate: 2025-02-27 15:58:20 +0000 Commit: Zhenlei Huang CommitDate: 2025-02-27 15:58:20 +0000 netinet: Make in_localaddr() return bool It is used as a boolean function everywhere. No functional change intended. MFC after: 1 week --- sys/netinet/in.c | 8 ++++---- sys/netinet/in.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 4c0908937ddc..5a28eecc6945 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -127,10 +127,10 @@ static struct sx in_control_sx; SX_SYSINIT(in_control_sx, &in_control_sx, "in_control"); /* - * Return 1 if an internet address is for a ``local'' host + * Return true if an internet address is for a ``local'' host * (one to which we have a connection). */ -int +bool in_localaddr(struct in_addr in) { u_long i = ntohl(in.s_addr); @@ -140,10 +140,10 @@ in_localaddr(struct in_addr in) CK_STAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if ((i & ia->ia_subnetmask) == ia->ia_subnet) - return (1); + return (true); } - return (0); + return (false); } /* diff --git a/sys/netinet/in.h b/sys/netinet/in.h index e42422341ada..0ebd238d6638 100644 --- a/sys/netinet/in.h +++ b/sys/netinet/in.h @@ -675,7 +675,7 @@ struct in_ifaddr; bool in_ifnet_broadcast(struct in_addr, struct ifnet *); bool in_ifaddr_broadcast(struct in_addr, struct in_ifaddr *); int in_canforward(struct in_addr); -int in_localaddr(struct in_addr); +bool in_localaddr(struct in_addr); bool in_localip(struct in_addr); bool in_localip_fib(struct in_addr, uint16_t); int in_ifhasaddr(struct ifnet *, struct in_addr); From nobody Thu Feb 27 16:57:01 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z3cvK6LrNz59JCt; Thu, 27 Feb 2025 16:57:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z3cvK5cnFz45x2; Thu, 27 Feb 2025 16:57:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740675421; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iOJpLiq8aWTbGsTA6X9aIv0QDTZHoqy9gbr5Ql/aLGE=; b=ZtJ+gvXeW7ey1Xe+rgF1oe5SdPIIdp1ABq6FLFVODTrS8qAd+pdtmpVVr5YEzYLXKSYLkn PY92ogb9UPsf3n9bJ8Yy6dysQBG76pqSsLke7S+il0gMWOqP0A2KI0vay4NqITtzZQ+7s0 VgtAHGnwB8U45QQNLOLoylzGacQvkZZFvtFkrTKVrYy5PxibXkA1CZGHPrfhXd19oHEBpx 1Wnz6D/HLkd2NI3vx1/7KHKcsvNJI7fTmgh7hoWVMjG7y9//KSoVFxKn1D8PflR+WeWFLO +91L4bsaeNKzg6V29+PqB7CaIZnSvu7wE+flKIlR/+M7jHpUgYTkSHLGy4EWaA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740675421; a=rsa-sha256; cv=none; b=g0eC3W8+yrcrUDT53kD7CqdtTtKuayJ/bjp/j4przw0nUfYORoMvNaIAlI1pRTBaMiJRHv v6Xw3M42tCH3nb8wz85Eam9Iw9eyDXqcsXhuUDYaKWKIFZxvKNii8TzwxsfnJnJ4BQiaKG 9UCiNS3Y6ag1wQl/XUMyfsz61nuPdF/kqBXefYzPWygGO55xUin+yLKGViIk5iZQe9pC2g 5Op0v/1HJ52JFOh+9rQ8QqAluJZD1HRaPsbCmwltXclO3L/xAlVpLgwov0KupLxvbGDXNA aqAUGGvkirEuyWEygzpMly/D6SZt3BJeNG2hs9dWVUzFkPk75o1EdTmyZ+XeSQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740675421; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iOJpLiq8aWTbGsTA6X9aIv0QDTZHoqy9gbr5Ql/aLGE=; b=vSUqaAHeLBJNd4Ku6jiMhHM80q7IqAdG5PHUO1XGR+4X+ZK+y1kPQUbzYtFv+q/IAzMsZ/ bnrhcHrHTSh4F+TpEmjIRD7FaRHtcBVOoX+YkptIsC4yvjYl+sl0FHZtVsnww02tduKVN5 W5txh4SUhoPGGWuBx+1sUhLAvfcDZ8oAMJR1UUYb0DhxNdQ+bIkNaKjXb0x7Jm0TUaTIvI Wzv6OlguaOWDmSPJIaKnbZa5Zj2WqihfvzE/46wEjEDGbGQ6ciYH5UvZIOnfeys1p2wNLL 4Ixj9idP/FHTpL6BtzI1jY8nsjVmBdKhTd5W+9/eT5jBa9rnSHXLhgtkZGhXew== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z3cvK4wqkzrvS; Thu, 27 Feb 2025 16:57:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51RGv1WG017551; Thu, 27 Feb 2025 16:57:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51RGv1FS017548; Thu, 27 Feb 2025 16:57:01 GMT (envelope-from git) Date: Thu, 27 Feb 2025 16:57:01 GMT Message-Id: <202502271657.51RGv1FS017548@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Moore Subject: git: 6b33d9dc46c2 - main - vm_page: expose page_alloc_after List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dougm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6b33d9dc46c2f1cbb91273771198b71d7cbdb328 Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=6b33d9dc46c2f1cbb91273771198b71d7cbdb328 commit 6b33d9dc46c2f1cbb91273771198b71d7cbdb328 Author: Doug Moore AuthorDate: 2025-02-27 16:55:33 +0000 Commit: Doug Moore CommitDate: 2025-02-27 16:55:33 +0000 vm_page: expose page_alloc_after vm_page_alloc() just calls vm_page_alloc_after(), after it has found the predecessor of a page parameter. Many callers of vm_page_alloc() already know that predecessor. Letting them pass that to vm_page_alloc_after() directly could save a little redundant calculation. Reviewed by: alc Tested by: pho Differential Revision: https://reviews.freebsd.org/D49103 --- sys/vm/swap_pager.c | 23 ++++++++++++++++------- sys/vm/vm_fault.c | 10 ++++++---- sys/vm/vm_page.c | 8 +++----- sys/vm/vm_page.h | 1 + sys/vm/vnode_pager.c | 22 ++++++++++++++-------- 5 files changed, 40 insertions(+), 24 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 3d02f365cad9..dbe0b6710367 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -1415,9 +1415,11 @@ swap_pager_getpages_locked(struct pctrie_iter *blks, vm_object_t object, * Allocate readahead and readbehind pages. */ if (rbehind != NULL) { + pindex = ma[0]->pindex; + /* Stepping backward from pindex, mpred doesn't change. */ for (i = 1; i <= *rbehind; i++) { - p = vm_page_alloc(object, ma[0]->pindex - i, - VM_ALLOC_NORMAL); + p = vm_page_alloc_after(object, pindex - i, + VM_ALLOC_NORMAL, mpred); if (p == NULL) break; p->oflags |= VPO_SWAPINPROG; @@ -1426,9 +1428,11 @@ swap_pager_getpages_locked(struct pctrie_iter *blks, vm_object_t object, *rbehind = i - 1; } if (rahead != NULL) { + p = ma[reqcount - 1]; + pindex = p->pindex; for (i = 0; i < *rahead; i++) { - p = vm_page_alloc(object, - ma[reqcount - 1]->pindex + i + 1, VM_ALLOC_NORMAL); + p = vm_page_alloc_after(object, pindex + i + 1, + VM_ALLOC_NORMAL, p); if (p == NULL) break; p->oflags |= VPO_SWAPINPROG; @@ -1982,9 +1986,14 @@ swap_pager_swapoff_object(struct swdevt *sp, vm_object_t object) if (m != NULL) { if (!vm_page_busy_acquire(m, VM_ALLOC_WAITFAIL)) break; - } else if ((m = vm_page_alloc(object, blks.index + i, - VM_ALLOC_NORMAL | VM_ALLOC_WAITFAIL)) == NULL) - break; + } else { + m = vm_radix_iter_lookup_le(&pages, + blks.index + i); + m = vm_page_alloc_after(object, blks.index + i, + VM_ALLOC_NORMAL | VM_ALLOC_WAITFAIL, m); + if (m == NULL) + break; + } /* Get the page from swap, and restart the scan. */ vm_object_pip_add(object, 1); diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 8c7fe9e37af1..c97a7cd998df 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -2085,7 +2085,7 @@ vm_fault_copy_entry(vm_map_t dst_map, vm_map_t src_map __unused, vm_pindex_t dst_pindex, pindex, src_pindex; vm_prot_t access, prot; vm_offset_t vaddr; - vm_page_t dst_m; + vm_page_t dst_m, mpred; vm_page_t src_m; bool upgrade; @@ -2157,9 +2157,11 @@ vm_fault_copy_entry(vm_map_t dst_map, vm_map_t src_map __unused, * with the source object, all of its pages must be dirtied, * regardless of whether they can be written. */ + mpred = (src_object == dst_object) ? + vm_page_mpred(src_object, src_pindex) : NULL; for (vaddr = dst_entry->start, dst_pindex = 0; vaddr < dst_entry->end; - vaddr += PAGE_SIZE, dst_pindex++) { + vaddr += PAGE_SIZE, dst_pindex++, mpred = dst_m) { again: /* * Find the page in the source object, and copy it in. @@ -2197,9 +2199,9 @@ again: /* * Allocate a page in the destination object. */ - dst_m = vm_page_alloc(dst_object, (src_object == + dst_m = vm_page_alloc_after(dst_object, (src_object == dst_object ? src_pindex : 0) + dst_pindex, - VM_ALLOC_NORMAL); + VM_ALLOC_NORMAL, mpred); if (dst_m == NULL) { VM_OBJECT_WUNLOCK(dst_object); VM_OBJECT_RUNLOCK(object); diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index e4c2aadf5d56..e9c371e62d70 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -162,8 +162,6 @@ SYSCTL_PROC(_vm, OID_AUTO, page_blacklist, CTLTYPE_STRING | CTLFLAG_RD | static uma_zone_t fakepg_zone; -static vm_page_t vm_page_alloc_after(vm_object_t object, vm_pindex_t pindex, - int req, vm_page_t mpred); static void vm_page_alloc_check(vm_page_t m); static vm_page_t vm_page_alloc_nofree_domain(int domain, int req); static bool _vm_page_busy_sleep(vm_object_t obj, vm_page_t m, @@ -2173,7 +2171,7 @@ vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req) * the resident page in the object with largest index smaller than the given * page index, or NULL if no such page exists. */ -static vm_page_t +vm_page_t vm_page_alloc_after(vm_object_t object, vm_pindex_t pindex, int req, vm_page_t mpred) { @@ -5045,8 +5043,8 @@ retrylookup: !vm_page_tryxbusy(ma[i])) break; } else { - ma[i] = vm_page_alloc(object, m->pindex + i, - VM_ALLOC_NORMAL); + ma[i] = vm_page_alloc_after(object, + m->pindex + i, VM_ALLOC_NORMAL, ma[i - 1]); if (ma[i] == NULL) break; } diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 5a166d9ba44c..05c16212a995 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -608,6 +608,7 @@ void vm_page_activate (vm_page_t); void vm_page_advise(vm_page_t m, int advice); vm_page_t vm_page_mpred(vm_object_t, vm_pindex_t); vm_page_t vm_page_alloc(vm_object_t, vm_pindex_t, int); +vm_page_t vm_page_alloc_after(vm_object_t, vm_pindex_t, int, vm_page_t); vm_page_t vm_page_alloc_domain_after(vm_object_t, vm_pindex_t, int, int, vm_page_t); vm_page_t vm_page_alloc_contig(vm_object_t object, vm_pindex_t pindex, int req, diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index 842d4ab89b90..d5d312b3cf71 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -1042,19 +1042,23 @@ vnode_pager_generic_getpages(struct vnode *vp, vm_page_t *m, int count, i = bp->b_npages = 0; if (rbehind) { vm_pindex_t startpindex, tpindex; - vm_page_t p; + vm_page_t mpred, p; VM_OBJECT_WLOCK(object); startpindex = m[0]->pindex - rbehind; - if ((p = TAILQ_PREV(m[0], pglist, listq)) != NULL && - p->pindex >= startpindex) - startpindex = p->pindex + 1; + if ((mpred = TAILQ_PREV(m[0], pglist, listq)) != NULL && + mpred->pindex >= startpindex) + startpindex = mpred->pindex + 1; - /* tpindex is unsigned; beware of numeric underflow. */ + /* + * tpindex is unsigned; beware of numeric underflow. + * Stepping backward from pindex, mpred doesn't change. + */ for (tpindex = m[0]->pindex - 1; tpindex >= startpindex && tpindex < m[0]->pindex; tpindex--, i++) { - p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL); + p = vm_page_alloc_after(object, tpindex, + VM_ALLOC_NORMAL, mpred); if (p == NULL) { /* Shift the array. */ for (int j = 0; j < i; j++) @@ -1089,9 +1093,11 @@ vnode_pager_generic_getpages(struct vnode *vp, vm_page_t *m, int count, if (endpindex > object->size) endpindex = object->size; - for (tpindex = m[count - 1]->pindex + 1; + p = m[count - 1]; + for (tpindex = p->pindex + 1; tpindex < endpindex; i++, tpindex++) { - p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL); + p = vm_page_alloc_after(object, tpindex, + VM_ALLOC_NORMAL, p); if (p == NULL) break; bp->b_pages[i] = p; From nobody Thu Feb 27 17:51:08 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z3f5m67P3z59LfK; Thu, 27 Feb 2025 17:51: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z3f5m54yjz493w; Thu, 27 Feb 2025 17:51:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740678668; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ohf5Ljt3FQTKHILIshEKdshRoDG4GqH2bvVVFs1xCI0=; b=UCrmrtg8njMC6+Ih1ds9WJblyHEHU5cZqp42xbc7LzIDcAamoOKC9q79Gk6MbFUPan48lZ L7rBW4d1NzuvSyP5eqVtw04HTD4p96SaWSihp50xfCu0SCfviJoE28ob97H8vk28ZpFzwq XwaLtKaZJjiG1bpAXi147j4KGAymMbulQWy18vqN8jGW8XiKT8mYS/jwaRvjssIQlSj9OH yOldS4JuQDB906LYh/bDo/BAEWkExtxDum+HUNfuXjd6wmm5poEFSQhQ0jEch+jHNcIWtW 9X2P59tgS01v61XpEO9c5epDKB/m9HteqJK6u33fIb0RjgCYBdPVNd+UbzYSog== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740678668; a=rsa-sha256; cv=none; b=t8jbgf/5PqUKmslQbbT8ldN+GUX6fnfgs2LJB0dGAizrYTQXwQNlBN1/qTqA0VCr3XkYbR y7EAAEkfuvMceze+JHcRhF7HpqNPl6D3mSw5yVKz5tyhlACr3/4K0etAHuGJI4IZvRD5Am SPOYGq/5Q+dixYlBh5jmpO4G468Vh4dytdGCa+TMK5JcoAKFhELkNT5uMhFDoYFEXhbHtO HH077USOWBYaENYzBdg4z2uKZ40xHkZ66dah41HJ51azxKUroqrwmy9LkYGzwyxEgnBjAo 1hz38WOk1uYbbDuLypunJuwq8YPMU24aXc8Vp4/8Qz3HTqHdNflJkj6QW5n00Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740678668; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ohf5Ljt3FQTKHILIshEKdshRoDG4GqH2bvVVFs1xCI0=; b=Knj4drBw7XkzdDCwT42u/IFJSq4V+3TPaaQzIHMzcOoOBXekmjUwOBCbQIFVJMi6K4DQHF IjQuNkVTagvd9Dhy6NH5F1W9LqFAdiRP6NTD7YcdGHTj1HLnjPqucVdkA1UvtUExx23dPf EtfIyK+pN1akVezl6eQODIhas67tqH3tjkaetHktA0Z9E//Iae1YfySBvyGvYa6rlETLLj cJDggaPrJ2zoW7IacEgwf9sP+G6ygKx/2CU566yCVQpYWxaRuBvZf3trvpNeX+/HgFo7n6 N3OuzIJsev07UkmMWH6fo1f7c+0nOh22Q9IqaToReXAltWswMoKUYvwL0c453A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z3f5m4ckqzskT; Thu, 27 Feb 2025 17:51:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51RHp8Pd025468; Thu, 27 Feb 2025 17:51:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51RHp8xu025465; Thu, 27 Feb 2025 17:51:08 GMT (envelope-from git) Date: Thu, 27 Feb 2025 17:51:08 GMT Message-Id: <202502271751.51RHp8xu025465@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 2980318b2747 - main - sh.1: extend the section about getopts List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2980318b2747711433c4408e89cb1b208aac9748 Auto-Submitted: auto-generated The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=2980318b2747711433c4408e89cb1b208aac9748 commit 2980318b2747711433c4408e89cb1b208aac9748 Author: Piotr Paweł Stefaniak AuthorDate: 2025-02-22 15:57:05 +0000 Commit: Piotr Paweł Stefaniak CommitDate: 2025-02-27 17:39:29 +0000 sh.1: extend the section about getopts Provide more details about the influence of optargs' first character on the shell's behavior in regard to invalid arguments. Also do some minor word-smithing. Original submission by rea@ Differential Revision: https://reviews.freebsd.org/D49106 --- bin/sh/sh.1 | 60 ++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/bin/sh/sh.1 b/bin/sh/sh.1 index 3d3f200a8e17..768193905c49 100644 --- a/bin/sh/sh.1 +++ b/bin/sh/sh.1 @@ -31,7 +31,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 10, 2025 +.Dd February 27, 2025 .Dt SH 1 .Os .Sh NAME @@ -2356,29 +2356,61 @@ Move the specified .Ar job or the current job to the foreground. .It Ic getopts Ar optstring var -The POSIX -.Ic getopts -command. -The -.Ic getopts -command deprecates the older -.Xr getopt 1 -command. -The first argument should be a series of letters, each possibly +Parse command-line options and arguments. +The first argument +.Va optstring +should be a series of letters, each possibly followed by a colon which indicates that the option takes an argument. -The specified variable is set to the parsed option. +The specified variable +.Va var +is set to the parsed option. The index of the next argument is placed into the shell variable .Va OPTIND . If an option takes an argument, it is placed into the shell variable .Va OPTARG . -If an invalid option is encountered, +.Pp +If the found character +is not specified by +.Va optstring +or if it is missing a required argument, +the option is considered invalid and: +.Bl -offset indent +.It +If the first character of +.Va optstring +is not a colon then +.Va OPTARG +is unset, .Ar var is set to -.Ql \&? . -It returns a false value (1) when it encounters the end of the options. +.Ql \&? +and a diagnostic message is written to stderr. +.It +If the first character of +.Va optstring +is a colon then +.Va OPTARG +is set to the the option character found, +.Ar var +is set to +.Ql \&: +when a required argument is missing or to +.Ql \&? +when the option was not specified by +.Va optstring , +and no diagnostic message is written to stderr. +.El +.Pp +.Ic getopts +returns a false value (1) when it encounters the end of the options. A new set of arguments may be parsed by assigning .Li OPTIND=1 . +The POSIX +.Ic getopts +command deprecates the older +.Xr getopt 1 +command. .It Ic hash Oo Fl rv Oc Op Ar command ... The shell maintains a hash table which remembers the locations of commands. With no arguments whatsoever, the From nobody Thu Feb 27 15:33:55 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z3b3R6CV1z5qKD6; Thu, 27 Feb 2025 15:33: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z3b3R5rKkz42jr; Thu, 27 Feb 2025 15:33:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740670435; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wXAnIej6HVpWmVv+tzuiyKZl7HSi/4cwfAves/XImQQ=; b=h8fQGh93QU+6xBzPnFe3RAvhWI10iLdteye9PhAHvECRZzrzeryIGuwxxFBsoR10PPBc/B 0Jk0Sdi8Zx4R9Y/oeMDJ7BTsrYSQXdBR/6iGx83iuYah2VGVm0YdU2cf3LmXsdJJR4XaTg v9y20a68ZKZG4wnXY8HiNIrqEymxIuIgESsjLs4d+K+EZFAPhvRhqhH5fUtYsxeyG3PilI WrKKdfBQRLApqyJzadoHy3Y6gQlhyk1JVDNbg/C2b5uJYme5uSLOXlFRRMcVmgYCkDOCIC G+CYwdhm/U2lY4cvxuy+vvpERcQN6f2nzQI3Ea7sFXqhTZ4qo0D3b6C6H4Tpcw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740670435; a=rsa-sha256; cv=none; b=FSNaVmsrjRH2nVcZaEc9+T5ZMypKmWbNLZL5vH+BzIXp9qe5sLjipr82VKTDm5drtFc/yI Rb393JZCAVW1ZB9+0DFZjPYskivT17vHfTzfh/210k5Eh/QQoyI5PDgVoRTG8bqEgdGquv +EuoiI4D1uOpmnzC/IGV87SHr2by3efUvlJnWFA2JN3At2QAo1q2fFZoPa1bFNWc52b6gj GhArif/eP+EQMvDJu8Uv9P8DJLP3aab1yjGzSCiyIUMhkCEq/uxiYeqjTuBMJPlDwlLKli E6tTGZyTU9RsSNh4PA/X7LpFJUM7uYRPX6QqQAW1+T5KUS2OnGE+Y0JTuOIf6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740670435; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wXAnIej6HVpWmVv+tzuiyKZl7HSi/4cwfAves/XImQQ=; b=de5h13ACnRr3rnZNEbNOgc45XuhPyLPT+9zZhhDikHhdVdAuUC0gnJGjeu3zoL4Pg7gibH s0iEfF13VCDNYBQzGmdffKNP0VEBwzty74idpSqOyJBLZ7hvOXmgiFiNxJ4MNJcOmVDGDo 4FOB+kSKo9nyWgkz5VvqixFd+fDvIuy6dmgbdpJ5fxS9GujqgZxHOsguG+i0Q098p1FA0d 66Bw8enPJ9TOaqWV7RS9UX/mQeWkop872P02XkEOnJVEvTiSt67/HUvt2tGBojfZkaKL3g 2EpdFWPmXe3CBBDFaTV5NIRUlOlZ9w1XpGwbAignAfVU5Lo4TxvruXAz6qFylg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z3b3R59BtzpvY; Thu, 27 Feb 2025 15:33:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51RFXt0Q065948; Thu, 27 Feb 2025 15:33:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51RFXtl7065945; Thu, 27 Feb 2025 15:33:55 GMT (envelope-from git) Date: Thu, 27 Feb 2025 15:33:55 GMT Message-Id: <202502271533.51RFXtl7065945@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kajetan Staszkiewicz Subject: git: f6f116cdbd2a - main - pf: Make af-to work on outbound interface List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f6f116cdbd2a406d2913df5368299ba4cdbf40a1 Auto-Submitted: auto-generated The branch main has been updated by ks: URL: https://cgit.FreeBSD.org/src/commit/?id=f6f116cdbd2a406d2913df5368299ba4cdbf40a1 commit f6f116cdbd2a406d2913df5368299ba4cdbf40a1 Author: Kajetan Staszkiewicz AuthorDate: 2025-02-23 18:13:48 +0000 Commit: Kajetan Staszkiewicz CommitDate: 2025-02-27 15:28:27 +0000 pf: Make af-to work on outbound interface Currently af-to works only on inbound interface by creating a reversed NAT state key which is used to match traffic returning on the outbound interface. Such limitation is not necessary. When an af-to state is created for an outbound rule do not reverse the NAT state key, making it work just like if it was created for a normal NAT rule. Depending on firewall design it might be easier and more natural to use af-to on the outbound interface. Reviewed by: kp Approved by: kp (mentor) Sponsored by: InnoGames GmbH Differential Revision: https://reviews.freebsd.org/D49122 --- sys/net/pfvar.h | 7 +- sys/netpfil/pf/pf.c | 245 +++++++++++++++++++++++------------------ sys/netpfil/pf/pf_lb.c | 42 ++----- tests/sys/netpfil/pf/nat64.sh | 247 +++++++++++++++++++++++++++++++++++------- 4 files changed, 368 insertions(+), 173 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index b481f767725d..b9b7f71c07d1 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1005,9 +1005,10 @@ struct pf_state_key { TAILQ_HEAD(, pf_kstate) states[2]; }; -#define PF_REVERSED_KEY(key, family) \ - ((key[PF_SK_WIRE]->af != key[PF_SK_STACK]->af) && \ - (key[PF_SK_WIRE]->af != (family))) +#define PF_REVERSED_KEY(state, family) \ + (((state)->key[PF_SK_WIRE]->af != (state)->key[PF_SK_STACK]->af) && \ + ((state)->key[PF_SK_WIRE]->af != (family)) && \ + ((state)->direction == PF_IN)) /* Keep synced with struct pf_kstate. */ struct pf_state_cmp { diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 24ddf75936de..72e648b84b2f 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -351,9 +351,13 @@ static int pf_create_state(struct pf_krule *, struct pf_krule *, static int pf_state_key_addr_setup(struct pf_pdesc *, struct pf_state_key_cmp *, int); static int pf_tcp_track_full(struct pf_kstate **, - struct pf_pdesc *, u_short *, int *); + struct pf_pdesc *, u_short *, int *, + struct pf_state_peer *, struct pf_state_peer *, + u_int8_t, u_int8_t); static int pf_tcp_track_sloppy(struct pf_kstate **, - struct pf_pdesc *, u_short *); + struct pf_pdesc *, u_short *, + struct pf_state_peer *, struct pf_state_peer *, + u_int8_t, u_int8_t); static int pf_test_state(struct pf_kstate **, struct pf_pdesc *, u_short *); int pf_icmp_state_lookup(struct pf_state_key_cmp *, @@ -458,7 +462,7 @@ BOUND_IFACE(struct pf_kstate *st, struct pf_pdesc *pd) * Initially set to all, because we don't know what interface we'll be * sending this out when we create the state. */ - if (st->rule->rt == PF_REPLYTO || (pd->af != pd->naf)) + if (st->rule->rt == PF_REPLYTO || (pd->af != pd->naf && st->direction == PF_IN)) return (V_pfi_all); /* @@ -1739,11 +1743,18 @@ pf_state_key_setup(struct pf_pdesc *pd, u_int16_t sport, u_int16_t dport, */ bzero(&(*nk)->addr[0], sizeof((*nk)->addr[0])); bzero(&(*nk)->addr[1], sizeof((*nk)->addr[1])); + if (pd->dir == PF_IN) { + PF_ACPY(&(*nk)->addr[pd->didx], &pd->nsaddr, pd->naf); + PF_ACPY(&(*nk)->addr[pd->sidx], &pd->ndaddr, pd->naf); + (*nk)->port[pd->didx] = pd->nsport; + (*nk)->port[pd->sidx] = pd->ndport; + } else { + PF_ACPY(&(*nk)->addr[pd->sidx], &pd->nsaddr, pd->naf); + PF_ACPY(&(*nk)->addr[pd->didx], &pd->ndaddr, pd->naf); + (*nk)->port[pd->sidx] = pd->nsport; + (*nk)->port[pd->didx] = pd->ndport; + } - PF_ACPY(&(*nk)->addr[pd->didx], &pd->nsaddr, pd->naf); - PF_ACPY(&(*nk)->addr[pd->sidx], &pd->ndaddr, pd->naf); - (*nk)->port[pd->didx] = pd->nsport; - (*nk)->port[pd->sidx] = pd->ndport; switch (pd->proto) { case IPPROTO_ICMP: (*nk)->proto = IPPROTO_ICMPV6; @@ -5934,24 +5945,25 @@ nextrule: nat64 = pd->af != pd->naf; if (nat64) { - struct pf_state_key *_sk; int ret; if (sk == NULL) sk = (*sm)->key[pd->dir == PF_IN ? PF_SK_STACK : PF_SK_WIRE]; if (nk == NULL) nk = (*sm)->key[pd->dir == PF_IN ? PF_SK_WIRE : PF_SK_STACK]; - if (pd->dir == PF_IN) - _sk = sk; - else - _sk = nk; - - ret = pf_translate(pd, - &_sk->addr[pd->didx], - _sk->port[pd->didx], - &_sk->addr[pd->sidx], - _sk->port[pd->sidx], - virtual_type, icmp_dir); + + if (pd->dir == PF_IN) { + ret = pf_translate(pd, &sk->addr[pd->didx], + sk->port[pd->didx], &sk->addr[pd->sidx], + sk->port[pd->sidx], virtual_type, + icmp_dir); + } else { + ret = pf_translate(pd, &sk->addr[pd->sidx], + sk->port[pd->sidx], &sk->addr[pd->didx], + sk->port[pd->didx], virtual_type, + icmp_dir); + } + if (ret < 0) goto cleanup; @@ -6383,37 +6395,15 @@ pf_translate(struct pf_pdesc *pd, struct pf_addr *saddr, u_int16_t sport, static int pf_tcp_track_full(struct pf_kstate **state, struct pf_pdesc *pd, - u_short *reason, int *copyback) + u_short *reason, int *copyback, struct pf_state_peer *src, + struct pf_state_peer *dst, u_int8_t psrc, u_int8_t pdst) { struct tcphdr *th = &pd->hdr.tcp; - struct pf_state_peer *src, *dst; u_int16_t win = ntohs(th->th_win); u_int32_t ack, end, data_end, seq, orig_seq; - u_int8_t sws, dws, psrc, pdst; + u_int8_t sws, dws; int ackskew; - if (pd->dir == (*state)->direction) { - if (PF_REVERSED_KEY((*state)->key, pd->af)) { - src = &(*state)->dst; - dst = &(*state)->src; - } else { - src = &(*state)->src; - dst = &(*state)->dst; - } - psrc = PF_PEER_SRC; - pdst = PF_PEER_DST; - } else { - if (PF_REVERSED_KEY((*state)->key, pd->af)) { - src = &(*state)->src; - dst = &(*state)->dst; - } else { - src = &(*state)->dst; - dst = &(*state)->src; - } - psrc = PF_PEER_DST; - pdst = PF_PEER_SRC; - } - if (src->wscale && dst->wscale && !(tcp_get_flags(th) & TH_SYN)) { sws = src->wscale & PF_WSCALE_MASK; dws = dst->wscale & PF_WSCALE_MASK; @@ -6733,23 +6723,11 @@ pf_tcp_track_full(struct pf_kstate **state, struct pf_pdesc *pd, } static int -pf_tcp_track_sloppy(struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) +pf_tcp_track_sloppy(struct pf_kstate **state, struct pf_pdesc *pd, + u_short *reason, struct pf_state_peer *src, struct pf_state_peer *dst, + u_int8_t psrc, u_int8_t pdst) { struct tcphdr *th = &pd->hdr.tcp; - struct pf_state_peer *src, *dst; - u_int8_t psrc, pdst; - - if (pd->dir == (*state)->direction) { - src = &(*state)->src; - dst = &(*state)->dst; - psrc = PF_PEER_SRC; - pdst = PF_PEER_DST; - } else { - src = &(*state)->dst; - dst = &(*state)->src; - psrc = PF_PEER_DST; - pdst = PF_PEER_SRC; - } if (tcp_get_flags(th) & TH_SYN) if (src->state < TCPS_SYN_SENT) @@ -6932,15 +6910,29 @@ pf_test_state(struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) STATE_LOOKUP(&key, *state, pd); if (pd->dir == (*state)->direction) { - src = &(*state)->src; - dst = &(*state)->dst; - psrc = PF_PEER_SRC; - pdst = PF_PEER_DST; + if (PF_REVERSED_KEY(*state, pd->af)) { + src = &(*state)->dst; + dst = &(*state)->src; + psrc = PF_PEER_DST; + pdst = PF_PEER_SRC; + } else { + src = &(*state)->src; + dst = &(*state)->dst; + psrc = PF_PEER_SRC; + pdst = PF_PEER_DST; + } } else { - src = &(*state)->dst; - dst = &(*state)->src; - psrc = PF_PEER_DST; - pdst = PF_PEER_SRC; + if (PF_REVERSED_KEY(*state, pd->af)) { + src = &(*state)->src; + dst = &(*state)->dst; + psrc = PF_PEER_SRC; + pdst = PF_PEER_DST; + } else { + src = &(*state)->dst; + dst = &(*state)->src; + psrc = PF_PEER_DST; + pdst = PF_PEER_SRC; + } } switch (pd->virtual_proto) { @@ -6967,13 +6959,14 @@ pf_test_state(struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) return (PF_DROP); } if ((*state)->state_flags & PFSTATE_SLOPPY) { - if (pf_tcp_track_sloppy(state, pd, reason) == PF_DROP) + if (pf_tcp_track_sloppy(state, pd, reason, src, dst, + psrc, pdst) == PF_DROP) return (PF_DROP); } else { int ret; ret = pf_tcp_track_full(state, pd, reason, - ©back); + ©back, src, dst, psrc, pdst); if (ret == PF_DROP) return (PF_DROP); } @@ -7069,26 +7062,32 @@ pf_test_state(struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) struct pf_state_key *nk; int afto, sidx, didx; - if (PF_REVERSED_KEY((*state)->key, pd->af)) + if (PF_REVERSED_KEY(*state, pd->af)) nk = (*state)->key[pd->sidx]; else nk = (*state)->key[pd->didx]; afto = pd->af != nk->af; - sidx = afto ? pd->didx : pd->sidx; - didx = afto ? pd->sidx : pd->didx; + + if (afto && (*state)->direction == PF_IN) { + sidx = pd->didx; + didx = pd->sidx; + } else { + sidx = pd->sidx; + didx = pd->didx; + } if (afto || PF_ANEQ(pd->src, &nk->addr[sidx], pd->af) || nk->port[sidx] != pd->osport) pf_change_ap(pd->m, pd->src, pd->sport, pd->ip_sum, - pd->pcksum, &nk->addr[pd->sidx], + pd->pcksum, &nk->addr[sidx], nk->port[sidx], pd->virtual_proto == IPPROTO_UDP, pd->af, nk->af); if (afto || PF_ANEQ(pd->dst, &nk->addr[didx], pd->af) || nk->port[didx] != pd->odport) pf_change_ap(pd->m, pd->dst, pd->dport, pd->ip_sum, - pd->pcksum, &nk->addr[pd->didx], + pd->pcksum, &nk->addr[didx], nk->port[didx], pd->virtual_proto == IPPROTO_UDP, pd->af, nk->af); @@ -7114,12 +7113,12 @@ pf_sctp_track(struct pf_kstate *state, struct pf_pdesc *pd, { struct pf_state_peer *src; if (pd->dir == state->direction) { - if (PF_REVERSED_KEY(state->key, pd->af)) + if (PF_REVERSED_KEY(state, pd->af)) src = &state->dst; else src = &state->src; } else { - if (PF_REVERSED_KEY(state->key, pd->af)) + if (PF_REVERSED_KEY(state, pd->af)) src = &state->src; else src = &state->dst; @@ -7679,15 +7678,21 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, struct pf_state_key *nk; int afto, sidx, didx; - if (PF_REVERSED_KEY((*state)->key, pd->af)) + if (PF_REVERSED_KEY(*state, pd->af)) nk = (*state)->key[pd->sidx]; else nk = (*state)->key[pd->didx]; afto = pd->af != nk->af; - sidx = afto ? pd->didx : pd->sidx; - didx = afto ? pd->sidx : pd->didx; - iidx = afto ? !iidx : iidx; + + if (afto && (*state)->direction == PF_IN) { + sidx = pd->didx; + didx = pd->sidx; + iidx = !iidx; + } else { + sidx = pd->sidx; + didx = pd->didx; + } switch (pd->af) { #ifdef INET @@ -7894,7 +7899,7 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, STATE_LOOKUP(&key, *state, pd); if (pd->dir == (*state)->direction) { - if (PF_REVERSED_KEY((*state)->key, pd->af)) { + if (PF_REVERSED_KEY(*state, pd->af)) { src = &(*state)->src; dst = &(*state)->dst; } else { @@ -7902,7 +7907,7 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, dst = &(*state)->src; } } else { - if (PF_REVERSED_KEY((*state)->key, pd->af)) { + if (PF_REVERSED_KEY(*state, pd->af)) { src = &(*state)->dst; dst = &(*state)->src; } else { @@ -7958,7 +7963,7 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, struct pf_state_key *nk; - if (PF_REVERSED_KEY((*state)->key, pd->af)) + if (PF_REVERSED_KEY(*state, pd->af)) nk = (*state)->key[pd->sidx]; else nk = (*state)->key[pd->didx]; @@ -7967,8 +7972,14 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, int afto, sidx, didx; afto = pd->af != nk->af; - sidx = afto ? pd2.didx : pd2.sidx; - didx = afto ? pd2.sidx : pd2.didx; + + if (afto && (*state)->direction == PF_IN) { + sidx = pd2.didx; + didx = pd2.sidx; + } else { + sidx = pd2.sidx; + didx = pd2.didx; + } if (afto) { if (pf_translate_icmp_af(nk->af, @@ -8073,7 +8084,7 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, (*state)->key[PF_SK_STACK]) { struct pf_state_key *nk; - if (PF_REVERSED_KEY((*state)->key, pd->af)) + if (PF_REVERSED_KEY(*state, pd->af)) nk = (*state)->key[pd->sidx]; else nk = (*state)->key[pd->didx]; @@ -8082,8 +8093,14 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, int afto, sidx, didx; afto = pd->af != nk->af; - sidx = afto ? pd2.didx : pd2.sidx; - didx = afto ? pd2.sidx : pd2.didx; + + if (afto && (*state)->direction == PF_IN) { + sidx = pd2.didx; + didx = pd2.sidx; + } else { + sidx = pd2.sidx; + didx = pd2.didx; + } if (afto) { if (pf_translate_icmp_af(nk->af, @@ -8183,12 +8200,12 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, STATE_LOOKUP(&key, *state, pd); if (pd->dir == (*state)->direction) { - if (PF_REVERSED_KEY((*state)->key, pd->af)) + if (PF_REVERSED_KEY(*state, pd->af)) src = &(*state)->src; else src = &(*state)->dst; } else { - if (PF_REVERSED_KEY((*state)->key, pd->af)) + if (PF_REVERSED_KEY(*state, pd->af)) src = &(*state)->dst; else src = &(*state)->src; @@ -8207,7 +8224,7 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, struct pf_state_key *nk; - if (PF_REVERSED_KEY((*state)->key, pd->af)) + if (PF_REVERSED_KEY(*state, pd->af)) nk = (*state)->key[pd->sidx]; else nk = (*state)->key[pd->didx]; @@ -8216,8 +8233,14 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, int afto, sidx, didx; afto = pd->af != nk->af; - sidx = afto ? pd2.didx : pd2.sidx; - didx = afto ? pd2.sidx : pd2.didx; + + if (afto && (*state)->direction == PF_IN) { + sidx = pd2.didx; + didx = pd2.sidx; + } else { + sidx = pd2.sidx; + didx = pd2.didx; + } if (afto) { if (pf_translate_icmp_af(nk->af, @@ -8325,7 +8348,7 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, (*state)->key[PF_SK_STACK]) { struct pf_state_key *nk; - if (PF_REVERSED_KEY((*state)->key, pd->af)) + if (PF_REVERSED_KEY(*state, pd->af)) nk = (*state)->key[pd->sidx]; else nk = (*state)->key[pd->didx]; @@ -8334,9 +8357,15 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, int afto, sidx, didx; afto = pd->af != nk->af; - sidx = afto ? pd2.didx : pd2.sidx; - didx = afto ? pd2.sidx : pd2.didx; - iidx = afto ? !iidx : iidx; + + if (afto && (*state)->direction == PF_IN) { + sidx = pd2.didx; + didx = pd2.sidx; + iidx = !iidx; + } else { + sidx = pd2.sidx; + didx = pd2.didx; + } if (afto) { if (nk->af != AF_INET6) @@ -8437,7 +8466,7 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, (*state)->key[PF_SK_STACK]) { struct pf_state_key *nk; - if (PF_REVERSED_KEY((*state)->key, pd->af)) + if (PF_REVERSED_KEY(*state, pd->af)) nk = (*state)->key[pd->sidx]; else nk = (*state)->key[pd->didx]; @@ -8446,9 +8475,15 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, int afto, sidx, didx; afto = pd->af != nk->af; - sidx = afto ? pd2.didx : pd2.sidx; - didx = afto ? pd2.sidx : pd2.didx; - iidx = afto ? !iidx : iidx; + + if (afto && (*state)->direction == PF_IN) { + sidx = pd2.didx; + didx = pd2.sidx; + iidx = !iidx; + } else { + sidx = pd2.sidx; + didx = pd2.didx; + } if (afto) { if (nk->af != AF_INET) @@ -8732,7 +8767,9 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, PF_STATE_UNLOCK(s); return; } else { - skip_test = true; + if (r_dir == PF_IN) { + skip_test = true; + } } } @@ -9014,7 +9051,9 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, PF_STATE_UNLOCK(s); return; } else { - skip_test = true; + if (r_dir == PF_IN) { + skip_test = true; + } } } diff --git a/sys/netpfil/pf/pf_lb.c b/sys/netpfil/pf/pf_lb.c index d1ba2495dc30..cb1d7af258f3 100644 --- a/sys/netpfil/pf/pf_lb.c +++ b/sys/netpfil/pf/pf_lb.c @@ -1053,37 +1053,19 @@ pf_get_transaddr_af(struct pf_krule *r, struct pf_pdesc *pd) } if (pd->proto == IPPROTO_ICMPV6 && pd->naf == AF_INET) { - if (pd->dir == PF_IN) { - NTOHS(pd->ndport); - if (pd->ndport == ICMP6_ECHO_REQUEST) - pd->ndport = ICMP_ECHO; - else if (pd->ndport == ICMP6_ECHO_REPLY) - pd->ndport = ICMP_ECHOREPLY; - HTONS(pd->ndport); - } else { - NTOHS(pd->nsport); - if (pd->nsport == ICMP6_ECHO_REQUEST) - pd->nsport = ICMP_ECHO; - else if (pd->nsport == ICMP6_ECHO_REPLY) - pd->nsport = ICMP_ECHOREPLY; - HTONS(pd->nsport); - } + NTOHS(pd->ndport); + if (pd->ndport == ICMP6_ECHO_REQUEST) + pd->ndport = ICMP_ECHO; + else if (pd->ndport == ICMP6_ECHO_REPLY) + pd->ndport = ICMP_ECHOREPLY; + HTONS(pd->ndport); } else if (pd->proto == IPPROTO_ICMP && pd->naf == AF_INET6) { - if (pd->dir == PF_IN) { - NTOHS(pd->ndport); - if (pd->ndport == ICMP_ECHO) - pd->ndport = ICMP6_ECHO_REQUEST; - else if (pd->ndport == ICMP_ECHOREPLY) - pd->ndport = ICMP6_ECHO_REPLY; - HTONS(pd->ndport); - } else { - NTOHS(pd->nsport); - if (pd->nsport == ICMP_ECHO) - pd->nsport = ICMP6_ECHO_REQUEST; - else if (pd->nsport == ICMP_ECHOREPLY) - pd->nsport = ICMP6_ECHO_REPLY; - HTONS(pd->nsport); - } + NTOHS(pd->ndport); + if (pd->ndport == ICMP_ECHO) + pd->ndport = ICMP6_ECHO_REQUEST; + else if (pd->ndport == ICMP_ECHOREPLY) + pd->ndport = ICMP6_ECHO_REPLY; + HTONS(pd->ndport); } /* get the destination address and port */ diff --git a/tests/sys/netpfil/pf/nat64.sh b/tests/sys/netpfil/pf/nat64.sh index 94c6c5fd8c8f..0bba1470c4c5 100644 --- a/tests/sys/netpfil/pf/nat64.sh +++ b/tests/sys/netpfil/pf/nat64.sh @@ -26,7 +26,7 @@ . $(atf_get_srcdir)/utils.subr -nat64_setup() +nat64_setup_base() { pft_init @@ -51,22 +51,70 @@ nat64_setup() jexec dst ping -c 1 192.0.2.1 jexec rtr pfctl -e +} + +nat64_setup_in() +{ + nat64_setup_base pft_set_rules rtr \ "set reassemble yes" \ "set state-policy if-bound" \ "pass in on ${epair}b inet6 from any to 64:ff9b::/96 af-to inet from (${epair_link}a)" } -atf_test_case "icmp_echo" "cleanup" -icmp_echo_head() +nat64_setup_out() +{ + nat64_setup_base + jexec rtr sysctl net.inet6.ip6.forwarding=1 + # AF translation happens post-routing, traffic must be directed + # towards the outbound interface using routes for the original AF. + # jexec rtr ifconfig ${epair_link}a inet6 2001:db8:2::1/64 up no_dad + jexec rtr route add -inet6 64:ff9b::/96 -iface ${epair_link}a; + pft_set_rules rtr \ + "set reassemble yes" \ + "set state-policy if-bound" \ + "pass quick inet6 proto icmp6 icmp6-type { neighbrsol, neighbradv }" \ + "pass in quick on ${epair}b from any to 64:ff9b::/96" \ + "pass out quick on ${epair_link}a from any to 64:ff9b::/96 af-to inet from (${epair_link}a)" \ + "block" +} + +atf_test_case "icmp_echo_in" "cleanup" +icmp_echo_in_head() +{ + atf_set descr 'Basic NAT64 ICMP echo test on inbound interface' + atf_set require.user root +} + +icmp_echo_in_body() +{ + nat64_setup_in + + # One ping + atf_check -s exit:0 -o ignore \ + ping6 -c 1 64:ff9b::192.0.2.2 + + # Make sure packets make it even when state is established + atf_check -s exit:0 \ + -o match:'5 packets transmitted, 5 packets received, 0.0% packet loss' \ + ping6 -c 5 64:ff9b::192.0.2.2 +} + +icmp_echo_in_cleanup() +{ + pft_cleanup +} + +atf_test_case "icmp_echo_out" "cleanup" +icmp_echo_out_head() { - atf_set descr 'Basic NAT64 ICMP echo test' + atf_set descr 'Basic NAT64 ICMP echo test on outbound interface' atf_set require.user root } -icmp_echo_body() +icmp_echo_out_body() { - nat64_setup + nat64_setup_out # One ping atf_check -s exit:0 -o ignore \ @@ -78,21 +126,21 @@ icmp_echo_body() ping6 -c 5 64:ff9b::192.0.2.2 } -icmp_echo_cleanup() +icmp_echo_out_cleanup() { pft_cleanup } -atf_test_case "fragmentation" "cleanup" -fragmentation_head() +atf_test_case "fragmentation_in" "cleanup" +fragmentation_in_head() { - atf_set descr 'Test fragmented packets' + atf_set descr 'Test fragmented packets on inbound interface' atf_set require.user root } -fragmentation_body() +fragmentation_in_body() { - nat64_setup + nat64_setup_in atf_check -s exit:0 -o ignore \ ping6 -c 1 -s 1280 64:ff9b::192.0.2.2 @@ -105,21 +153,48 @@ fragmentation_body() ping6 -c 3 -s 10000 -b 20000 64:ff9b::192.0.2.2 } -fragmentation_cleanup() +fragmentation_in_cleanup() { pft_cleanup } -atf_test_case "tcp" "cleanup" -tcp_head() +atf_test_case "fragmentation_out" "cleanup" +fragmentation_out_head() { - atf_set descr 'TCP NAT64 test' + atf_set descr 'Test fragmented packets on outbound interface' atf_set require.user root } -tcp_body() +fragmentation_out_body() { - nat64_setup + nat64_setup_out + + atf_check -s exit:0 -o ignore \ + ping6 -c 1 -s 1280 64:ff9b::192.0.2.2 + + atf_check -s exit:0 \ + -o match:'3 packets transmitted, 3 packets received, 0.0% packet loss' \ + ping6 -c 3 -s 2000 64:ff9b::192.0.2.2 + atf_check -s exit:0 \ + -o match:'3 packets transmitted, 3 packets received, 0.0% packet loss' \ + ping6 -c 3 -s 10000 -b 20000 64:ff9b::192.0.2.2 +} + +fragmentation_out_cleanup() +{ + pft_cleanup +} + +atf_test_case "tcp_in" "cleanup" +tcp_in_head() +{ + atf_set descr 'TCP NAT64 test on inbound interface' + atf_set require.user root +} + +tcp_in_body() +{ + nat64_setup_in echo "foo" | jexec dst nc -l 1234 & @@ -135,21 +210,81 @@ tcp_body() fi } -tcp_cleanup() +tcp_in_cleanup() { pft_cleanup } -atf_test_case "udp" "cleanup" -udp_head() +atf_test_case "tcp_out" "cleanup" +tcp_out_head() { - atf_set descr 'UDP NAT64 test' + atf_set descr 'TCP NAT64 test on outbound interface' atf_set require.user root } -udp_body() +tcp_out_body() { - nat64_setup + nat64_setup_out + + echo "foo" | jexec dst nc -l 1234 & + + # Sanity check & delay for nc startup + atf_check -s exit:0 -o ignore \ + ping6 -c 1 64:ff9b::192.0.2.2 + + rcv=$(nc -w 3 -6 64:ff9b::c000:202 1234) + if [ "${rcv}" != "foo" ]; + then + echo "rcv=${rcv}" + atf_fail "Failed to connect to TCP server" + fi +} + +tcp_out_cleanup() +{ + pft_cleanup +} + +atf_test_case "udp_in" "cleanup" +udp_in_head() +{ + atf_set descr 'UDP NAT64 test on inbound interface' + atf_set require.user root +} + +udp_in_body() +{ + nat64_setup_in + + echo "foo" | jexec dst nc -u -l 1234 & + + # Sanity check & delay for nc startup + atf_check -s exit:0 -o ignore \ + ping6 -c 1 64:ff9b::192.0.2.2 + + rcv=$(echo bar | nc -w 3 -6 -u 64:ff9b::c000:202 1234) + if [ "${rcv}" != "foo" ]; + then + echo "rcv=${rcv}" + atf_fail "Failed to connect to UDP server" + fi +} + +udp_in_cleanup() +{ + pft_cleanup +} + +atf_test_case "udp_out" "cleanup" +udp_out_head() +{ + atf_set descr 'UDP NAT64 test on outbound interface' + atf_set require.user root +} + +udp_out_body() +{ + nat64_setup_out echo "foo" | jexec dst nc -u -l 1234 & @@ -165,21 +300,54 @@ udp_body() fi } -udp_cleanup() +udp_out_cleanup() +{ + pft_cleanup +} + +atf_test_case "sctp_in" "cleanup" +sctp_in_head() +{ + atf_set descr 'SCTP NAT64 test on inbound interface' + atf_set require.user root +} + +sctp_in_body() +{ + nat64_setup_in + if ! kldstat -q -m sctp; then + atf_skip "This test requires SCTP" + fi + + echo "foo" | jexec dst nc --sctp -N -l 1234 & + + # Sanity check & delay for nc startup + atf_check -s exit:0 -o ignore \ + ping6 -c 1 64:ff9b::192.0.2.2 + + rcv=$(echo bar | nc --sctp -w 3 -6 64:ff9b::c000:202 1234) + if [ "${rcv}" != "foo" ]; + then + echo "rcv=${rcv}" + atf_fail "Failed to connect to SCTP server" + fi +} + +sctp_in_cleanup() { pft_cleanup } -atf_test_case "sctp" "cleanup" -sctp_head() +atf_test_case "sctp_out" "cleanup" +sctp_out_head() { - atf_set descr 'SCTP NAT64 test' + atf_set descr 'SCTP NAT64 test on outbound interface' atf_set require.user root } -sctp_body() +sctp_out_body() { - nat64_setup + nat64_setup_out if ! kldstat -q -m sctp; then atf_skip "This test requires SCTP" fi @@ -198,7 +366,7 @@ sctp_body() fi } -sctp_cleanup() +sctp_out_cleanup() { pft_cleanup } @@ -212,7 +380,7 @@ tos_head() tos_body() { - nat64_setup + nat64_setup_in # Ensure we can distinguish ToS on the destination jexec dst pfctl -e @@ -862,11 +1030,16 @@ v6_gateway_cleanup() atf_init_test_cases() { - atf_add_test_case "icmp_echo" - atf_add_test_case "fragmentation" - atf_add_test_case "tcp" - atf_add_test_case "udp" - atf_add_test_case "sctp" + atf_add_test_case "icmp_echo_in" + atf_add_test_case "icmp_echo_out" + atf_add_test_case "fragmentation_in" + atf_add_test_case "fragmentation_out" + atf_add_test_case "tcp_in" + atf_add_test_case "tcp_out" + atf_add_test_case "udp_in" + atf_add_test_case "udp_out" + atf_add_test_case "sctp_in" + atf_add_test_case "sctp_out" atf_add_test_case "tos" atf_add_test_case "no_v4" atf_add_test_case "range" From nobody Fri Feb 28 02:50:05 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z3t3f2kcPz5Mt4Y; Fri, 28 Feb 2025 02: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z3t3f0SCZz3LBF; Fri, 28 Feb 2025 02:50:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740711006; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uIv/vPhJtPbkqWXBVBpP8a2kJP2pHoYx1RCm7PQhQlw=; b=aeE5b7BftO+g7Q22Ru6B3TrE7y6gJiqEXHVhK6QmuSCRJ7a0wQegI8We9fBztPL+1Jtk66 w7CMa2FPLhDd1D3MzCMeGUTDXERgP9oKCiV045a0ypb7F+BW6m/PAV9oFn7cnxUc+M35fF NILi1QbEKLDs+eukYVHj3/ffUaUb18ZtUv5yFu2rHnMJGDh6ptnQAYuy8/fxjXEmWEhLYk QQqraUYB/FagwEZeMz43DDV4pG6JhK1kEHNSqPAf+t5o5VgdZYW0kUVyvb6FQv3T3qrcQ+ fokkF4ZkIzPLiJ4KWaREcItk4qj3F6lPH8hptquIGyDpvvEtjsL3HuqMAjD2Cw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740711006; a=rsa-sha256; cv=none; b=G6c8kdOrJuvbkdfpoR4mix6s+8oOG23QTj4lhdDkLFVozEPmVJ9q7edTfhDAYaKEvCr3om bMSPU4eyBuP1Ge4qxHanJeDGSkf6tqFhuwdV5/KIjSV+Hw1jouMBLgzUNoDp6no3eUbN79 G598k7+bw3sNmYB/sz/yC7l1G4oDpwMbLIzG1jRfC5nmRMSYj5MjaU6DP5nU4oIM5oYwiA saEZL3tZDyNMrwK1FAdOxlzfmhKDgFFmska4hPid7SxeSQ1ukSW/c/QXpJU1Jsvd6tzxMj 5uy+SPAKdFfNZ7+7jwVxdoGeAggGYKD4UX1jGoKSXEdPeO8pyms0L8SEeR1a3Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740711006; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uIv/vPhJtPbkqWXBVBpP8a2kJP2pHoYx1RCm7PQhQlw=; b=YUA8T6qLRpgs8csoDjEBnJrlKDyrNRI2uvsW5L8Yq39gFGJafR5ekBdp7f9Zz8qSzcO6qx vMHK9VwS5Dgij7bRg17GFLHmlqL31G97r4nhZJc9gHTYpNPXz1h47IK1AiEm98NKY95bMl 4hdBwqVCXUbtn+0kU7rajgX2Hl0bkPvp8hhpxH4sOHnAX3K5UyVAfbLEzSicK767Rwfrs+ 736AxlqePVZmMy16Hh8+8OqgCRgOUfuEXEGpaSv9sQxDMybhRZAtVY1DfkQhkznSMpy7ub LtQOn1w+Ex5+FlPNFxbZJ0ylLmxCxQObfZ2nxUr81ZbkIezpMVL7Lc3Ub0qomw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z3t3f03Xkz181d; Fri, 28 Feb 2025 02:50:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51S2o53C024193; Fri, 28 Feb 2025 02:50:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51S2o5fR024189; Fri, 28 Feb 2025 02:50:05 GMT (envelope-from git) Date: Fri, 28 Feb 2025 02:50:05 GMT Message-Id: <202502280250.51S2o5fR024189@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 36347cfbf7ac - main - wlanwds: convert getifaddrs() iteration to use the ifa_next pointer List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 36347cfbf7ac3d1db79fa369266b1cc391daf511 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=36347cfbf7ac3d1db79fa369266b1cc391daf511 commit 36347cfbf7ac3d1db79fa369266b1cc391daf511 Author: Adrian Chadd AuthorDate: 2025-02-27 02:18:23 +0000 Commit: Adrian Chadd CommitDate: 2025-02-28 02:49:49 +0000 wlanwds: convert getifaddrs() iteration to use the ifa_next pointer I don't know what I was thinking in 2017 when I wrote this, but it's very wrong. Use ifa->ifa_next to iterate, not the array index / pointer arithmetic. Differential Revision: https://reviews.freebsd.org/D49148 --- tools/tools/net80211/wlanwds/wlanwds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tools/net80211/wlanwds/wlanwds.c b/tools/tools/net80211/wlanwds/wlanwds.c index a9ca89e4d5b1..193a9b0a60d4 100644 --- a/tools/tools/net80211/wlanwds/wlanwds.c +++ b/tools/tools/net80211/wlanwds/wlanwds.c @@ -283,7 +283,7 @@ getlladdr(const char *ifname, uint8_t macaddr[ETHER_ADDR_LEN]) } /* Look for a matching interface */ - for (ifa = ifap; ifa != NULL; ifa++) { + for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) { if (strcmp(ifname, ifa->ifa_name) != 0) continue; From nobody Fri Feb 28 02:50:06 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z3t3g3ltTz5MswV; Fri, 28 Feb 2025 02:50: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z3t3g18BFz3LV6; Fri, 28 Feb 2025 02:50:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740711007; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GPh4/gHIykfKpdGqahfHtau2fTNrG/TLsS04eCJoFpE=; b=el32d2sdm9zLCvnPaytOR8hwLHBRfjAHY/r0dLtinJ/NvWSOhNyAXO1a5HkAo5V9KHd55L bBLXSZbdL0T2CPJJvon3JlpoUoiJlAfQDt+EiQIAiAks7QneU/RSeUM+8PPHwBuErcJ0Bk bhRC6/sAcXTQUX4FQ2qfVQPx3VhA5XxMdarGTuKJo+/jbzJHhyu8Bqa2xaW9bJfl4EAMPx +/0bQh7ZnQZO83Pu+VzbkoKgkfXd9qavCJXqxtgCN8awPtJzu613B5eX4sZFZqlzfFmEAe qXrp6X4crEj6uBVapbUpmaCPCwcze2TrXkxHqd8rgFENvBmU1AWG2JIc9ASNvA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740711007; a=rsa-sha256; cv=none; b=enSXF0exgqWJkh+pHEIqI9KCRl5FZ0uCfP/OhHgCyaVpuGsCvfCDkPYDLHyc6nbbQQLEBk 4/Oxwa5i61x2XvwUdi0/b6iLhTfdfvIGMFYmFYoLneV5IzIQYhGhlIbEvvE65kNfmLgWs5 UYObP9eTSMispgpIHSeZTCNZ5AoX28jpGfnpNw2lUR9eHqcfZ+m/4KrMLyqyNABh+0H+U0 qgONkBrP39E5P2tDLDoIwfg/4B0VibncJzRrbv1MrInhckzkHJtR70X1QVOLRQsen78kA9 WPwkxHWRT5jSymGEr9d94FH48lCrYNTdASW7X9lkPZvno82dPlDmYMtaRKkCgQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740711007; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GPh4/gHIykfKpdGqahfHtau2fTNrG/TLsS04eCJoFpE=; b=wbGM+EPJr6RdBk7W1pSqXs4/UwxfPTfwiRk5N8+BNleJ2LSKRnufCsYHwPUg+/tzONrB0A C7TyVy9QCMvGhW+FzoElPeARd2lS2wTzVZ6eC1RAuaYuE6ZYmXw/2jP9SK7SFB8V8pZeVU coIGvegIXdtocFLzT1BF1kzwfs+Zsq17ld6AivJitgB4DogbmtvWynA1ELUs5ctFpLUNzM XXGX/ipPh9YE43w0xBuUKPVD4v5qSIGM2GmGhWWucs4uZuMD9FcvytVMF8xhjr3aXQ1u2F BfAHw+y5G5dLMnmNu2+fKeXtKepo9pj0HGUVpxDzB5LD8fqixAzLHMVv9RiDew== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z3t3g0YHBz181f; Fri, 28 Feb 2025 02:50:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51S2o6Om024456; Fri, 28 Feb 2025 02:50:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51S2o6QN024451; Fri, 28 Feb 2025 02:50:06 GMT (envelope-from git) Date: Fri, 28 Feb 2025 02:50:06 GMT Message-Id: <202502280250.51S2o6QN024451@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 571743bdc6e2 - main - wlanwds: use a local copy of the ifaddr sockaddr, avoid cast List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 571743bdc6e20b14589fef3568f40167399336ec Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=571743bdc6e20b14589fef3568f40167399336ec commit 571743bdc6e20b14589fef3568f40167399336ec Author: Adrian Chadd AuthorDate: 2025-02-13 18:28:22 +0000 Commit: Adrian Chadd CommitDate: 2025-02-28 02:49:49 +0000 wlanwds: use a local copy of the ifaddr sockaddr, avoid cast Using the cast results in alignment errors from LLVM. Fix it to go through void *. Differential Revision: https://reviews.freebsd.org/D48996 --- tools/tools/net80211/wlanwds/wlanwds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tools/net80211/wlanwds/wlanwds.c b/tools/tools/net80211/wlanwds/wlanwds.c index 193a9b0a60d4..e64b05658740 100644 --- a/tools/tools/net80211/wlanwds/wlanwds.c +++ b/tools/tools/net80211/wlanwds/wlanwds.c @@ -295,7 +295,7 @@ getlladdr(const char *ifname, uint8_t macaddr[ETHER_ADDR_LEN]) } /* Check address family */ - sdl = (struct sockaddr_dl *) ifa->ifa_addr; + sdl = (struct sockaddr_dl *)(void *)ifa->ifa_addr; if (sdl->sdl_type != IFT_ETHER) { syslog(LOG_CRIT, "%s: %s: unknown aftype (%d)\n", __func__, From nobody Fri Feb 28 02:50:08 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z3t3h3LNSz5MtFd; Fri, 28 Feb 2025 02:50: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z3t3h1Xw4z3LV7; Fri, 28 Feb 2025 02:50:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740711008; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7Yi8XjPj5eBqp8gnWBCBk9M6XK0R6TY3c1C35Qi6jf0=; b=Q937tzeOPM3rR3FTzsE60Iibox18w2N2IqNu1xRlecVySybyPq69SgYTYEKuD9pG3o6nMw wKNcI0+XLoJfpxmugU1tHydCSPPGVY1tZVEoHQkCnZvueqAXulSX37+O8q/2YZ+geXGF+x SnahBIi4v1PfHP8/qnTs4sG8hs6HkwXR7tIjA/izG+HLDI3qSwAoN7AaEFzjMcerQBItXp Sgb+13rMADOQcUSgAE4LSriIJYsrxRJhchLIr5JVTcFZDgNpphY6Jxbyu+XynnHjiVZqNQ PuhxwIctdbN3G0JjlakdGN2nA/jdoo+KG8RjtHjG0lpU9u8R5YLsdkVw2rh+JA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740711008; a=rsa-sha256; cv=none; b=bKT8cZMbjh02urd+N1yJ72NJOx+K1C6v7UfPmFKVx3iCgYfEusofRNuAM2WS0Ne3i8rl5F akSPWW345k5mzP0/G4HIKLmTPDQiJSG3WHROjGpgbXDvecjryHZEFEwRZ0FmU2hFMDqlNZ ZGQQGSGN/7DBzuZy+GQL8K0ZPTvJUQWTAkdzXsyie8HMuw9CG74oBjwtFcB+p9ixz7WGDI ByE54X/Tr7N1vdbp6w3ZY+j+qhXMfiPkuX01jexLCXTORau9qkkGIHNy8iYrSPeUItU9fQ hzGfzm/i7upywmGdWoFu7O+emtvem1lKowK9ZQsC/fpKVhvn+Z/ENfU4szh3qg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740711008; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7Yi8XjPj5eBqp8gnWBCBk9M6XK0R6TY3c1C35Qi6jf0=; b=fwkIQUgb5rtAgAmBoJbwHG/UTDFTp9KSy8N+lRVTjWjrZND6LTd7udwPy+j2tmrDNKkNsr AUbU+FNoZB+Ydb5POMaqgkVHksVhAtjUCaGiJ+/9ALfXLHSOgTUETSK6Elg7mDo8Kghl8P 4H/GJiZBcDXTZhDG8sUXAWFSE25RxDLPnqm4D8p3nlgMOIZc7iiGlbPiuwE+WQgnJCtjjE LZo98Kg4C1SsO7RlfScjD/rEcEioAUdvSEFSsWI557cxFugOn9Y0AMT/2aBqq9JmeFt4p/ VOpqY5qK2cEcfkS2VRGFrXB3c3UX+n0gzn5USUViZHoHsgiMLNQD19t+0btTfw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z3t3h14g6z18Q9; Fri, 28 Feb 2025 02:50:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51S2o8fY024720; Fri, 28 Feb 2025 02:50:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51S2o885024715; Fri, 28 Feb 2025 02:50:08 GMT (envelope-from git) Date: Fri, 28 Feb 2025 02:50:08 GMT Message-Id: <202502280250.51S2o885024715@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: db80116da404 - main - wlanwds: add pidfile support List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: db80116da404c90e6f0d69350554291f866e8ebb Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=db80116da404c90e6f0d69350554291f866e8ebb commit db80116da404c90e6f0d69350554291f866e8ebb Author: Adrian Chadd AuthorDate: 2025-02-13 18:33:12 +0000 Commit: Adrian Chadd CommitDate: 2025-02-28 02:49:49 +0000 wlanwds: add pidfile support Add pidfile support based on "man pidfile". Differential Revision: https://reviews.freebsd.org/D48997 --- tools/tools/net80211/wlanwds/Makefile | 2 ++ tools/tools/net80211/wlanwds/wlanwds.c | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/tools/tools/net80211/wlanwds/Makefile b/tools/tools/net80211/wlanwds/Makefile index 1e993cc07c21..293ddb75f9b4 100644 --- a/tools/tools/net80211/wlanwds/Makefile +++ b/tools/tools/net80211/wlanwds/Makefile @@ -2,4 +2,6 @@ PROG= wlanwds BINDIR= /usr/local/bin MAN= +LIBADD= util + .include diff --git a/tools/tools/net80211/wlanwds/wlanwds.c b/tools/tools/net80211/wlanwds/wlanwds.c index e64b05658740..f6364c3ce4da 100644 --- a/tools/tools/net80211/wlanwds/wlanwds.c +++ b/tools/tools/net80211/wlanwds/wlanwds.c @@ -68,6 +68,7 @@ #include #include #include +#include #define IEEE80211_ADDR_EQ(a1,a2) (memcmp(a1,a2,IEEE80211_ADDR_LEN) == 0) #define IEEE80211_ADDR_COPY(dst,src) memcpy(dst,src,IEEE80211_ADDR_LEN) @@ -107,9 +108,11 @@ main(int argc, char *argv[]) { const char *progname = argv[0]; const char *pidfile = NULL; + struct pidfh *pfh = NULL; int s, c, logmask, bg = 1; char msg[2048]; int log_stderr = 0; + pid_t otherpid; logmask = LOG_UPTO(LOG_INFO); while ((c = getopt(argc, argv, "efjP:s:tv")) != -1) @@ -148,6 +151,17 @@ main(int argc, char *argv[]) ifnets = argv; nifnets = argc; + if (pidfile != NULL) { + pfh = pidfile_open(pidfile, 0600, &otherpid); + if (pfh == NULL) { + if (errno == EEXIST) + errx(EXIT_FAILURE, "Daemon already running; pid: %jd.", + (intmax_t)otherpid); + + warn("Cannot open or create pidfile"); + } + } + s = socket(PF_ROUTE, SOCK_RAW, 0); if (s < 0) err(EX_OSERR, "socket"); @@ -157,8 +171,12 @@ main(int argc, char *argv[]) scanforvaps(s); /* XXX what directory to work in? */ - if (bg && daemon(0, 0) < 0) + if (bg && daemon(0, 0) < 0) { + pidfile_remove(pfh); err(EX_OSERR, "daemon"); + } + + pidfile_write(pfh); openlog("wlanwds", log_stderr | LOG_PID | LOG_CONS, LOG_DAEMON); setlogmask(logmask); @@ -167,6 +185,8 @@ main(int argc, char *argv[]) ssize_t n = read(s, msg, sizeof(msg)); handle_rtmsg((struct rt_msghdr *)msg, n); } + + pidfile_remove(pfh); return 0; } From nobody Fri Feb 28 02:50:09 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z3t3j2stTz5Mt4f; Fri, 28 Feb 2025 02:50: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z3t3j21GSz3LV8; Fri, 28 Feb 2025 02:50:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740711009; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mGAPeffUKoB9XiBKnCw/tIDXAAZlPx+h8zlboZKEYh4=; b=RGbTs/BcZzle0j4ndZWhPIfDVInNS7aprBOT2eCukCUhZtU//y4jfNIYnC9Y4u5cdp0y8C y8sxhIBY5+04l0SXyr6B07QjnQwfooUDsgGTR8zZlXQW1QQBM48IMh93Ip/TeSRzZwed0N O9z0EEWEzg0qA+npkFlq65IVgHHGKbHuPc0IAe2+6pDXvvQq8guQBAT/FxuVHfCqjuu+13 enc6MzzAc7g9V+URhGDANPVDSEUbg112uE2xsngSHast3asMZSvekPqbl+kXHlQ8IB3qfD J5dAKEo2vg7A18442E2VreLtwipj22S/Y6BuXpjruXDTmdMC28iFkVI7S5ePmg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740711009; a=rsa-sha256; cv=none; b=MZwz4ta9fif8JUAtOZppbJxhBnl27meeYegSvLjmqs7zlt7Z5QSo+mrTrsa4GFq9rX+6Xd 8s2au+rBdiDPx8JaGvuHYhZh0DfT1cRxvSHIePDNsF5ux+E7QABomgxiuBSBnG1+oBfUWS bTTdDk3YqlHncgk6rekPNqvmu6vcY9uS3gM94UR2yqxQJYYfHmW2dBQbq/gBMtMvnF+8/K mmsaLZ245WH3zbuc7wS/PERxneJldGXuaFLNlbZeUyid75ISAar4+bNEIl7n5aViKe4+vR NHO4UEcQN/el/oY2w4pLsPDRE1vZcjpt4fC7y3Cc0K+qcPefVskXgzoHdS+SKQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740711009; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mGAPeffUKoB9XiBKnCw/tIDXAAZlPx+h8zlboZKEYh4=; b=Hf4hF9sYTpBTobxaYJS0GCrsdf6mafJACiV/hrWcxzJGuD0En5OrFxY4MeMxoyPq2gKAnl BRkA5C/AHVasbxmbcpeVXjEeVY1vRbvwzlcYQW/jYo03JYrlTUxluErfk77JEvP6ctyxFs sBkJhbdyD0LQ8bgHppvPvCtc0dnQuizaX3fOX7N8NTeKW52AZqXQ4rt+UTlEvCWVmZ0iUt de8jGCK7DrYEcwBj0iks5RXbIc0X7Fz/E9+BhN6z1UVawCuJ9muVW0RVZy3leJI8AH0yxh Oa73hWFgXpBQDBfwkeGajpPxl2MzrKqga5YMiXPD9+LA7Y7u+nDFgr4XVk4l5w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z3t3j1Yp4z18jw; Fri, 28 Feb 2025 02:50:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51S2o9Cl025039; Fri, 28 Feb 2025 02:50:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51S2o98i025031; Fri, 28 Feb 2025 02:50:09 GMT (envelope-from git) Date: Fri, 28 Feb 2025 02:50:09 GMT Message-Id: <202502280250.51S2o98i025031@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 92caff2b1b6b - main - wlanwatch: clean up to compile / run List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 92caff2b1b6b3aa5da49a2cb90f3c787fc11d17e Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=92caff2b1b6b3aa5da49a2cb90f3c787fc11d17e commit 92caff2b1b6b3aa5da49a2cb90f3c787fc11d17e Author: Adrian Chadd AuthorDate: 2025-02-27 02:37:42 +0000 Commit: Adrian Chadd CommitDate: 2025-02-28 02:49:49 +0000 wlanwatch: clean up to compile / run * add static where needed * delete old unused flags, dating back to the initial commit from Sam * indirect through void * where appropriate, to avoid LLVM alignment errors * PRIu64 where needed This does work, but it currently doesn't track the ifname itself, so we see ifindexes, not ifnames: Wed Feb 26 18:35:59 RTM_IEEE80211: if# 2, scan complete Wed Feb 26 18:35:59 RTM_IEEE80211: if# 2, associate with 30:de:4b:db:46:0a Wed Feb 26 18:35:59 RTM_IFINFO: if# 2, link: up, flags: .. but it does work! Differential Revision: https://reviews.freebsd.org/D49149 --- tools/tools/net80211/wlanwatch/wlanwatch.c | 31 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/tools/tools/net80211/wlanwatch/wlanwatch.c b/tools/tools/net80211/wlanwatch/wlanwatch.c index 6e3bfd798c2d..ec6d85cc1ffb 100644 --- a/tools/tools/net80211/wlanwatch/wlanwatch.c +++ b/tools/tools/net80211/wlanwatch/wlanwatch.c @@ -63,6 +63,7 @@ #include #include #include +#include /* XXX */ enum ieee80211_notify_cac_event { @@ -74,7 +75,7 @@ enum ieee80211_notify_cac_event { static void print_rtmsg(struct rt_msghdr *rtm, int msglen); -int nflag = 0; +static int nflag = 0; int main(int argc, char *argv[]) @@ -121,22 +122,17 @@ bprintf(FILE *fp, int b, char *s) putc('>', fp); } -char metricnames[] = -"\011pksent\010rttvar\7rtt\6ssthresh\5sendpipe\4recvpipe\3expire\2hopcount" -"\1mtu"; -char routeflags[] = -"\1UP\2GATEWAY\3HOST\4REJECT\5DYNAMIC\6MODIFIED\7DONE\010MASK_PRESENT" -"\011CLONING\012XRESOLVE\013LLINFO\014STATIC\015BLACKHOLE\016b016" -"\017PROTO2\020PROTO1\021PRCLONING\022WASCLONED\023PROTO3\024CHAINDELETE" -"\025PINNED\026LOCAL\027BROADCAST\030MULTICAST"; -char ifnetflags[] = +static char ifnetflags[] = "\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5PTP\6b6\7RUNNING\010NOARP" "\011PPROMISC\012ALLMULTI\013OACTIVE\014SIMPLEX\015LINK0\016LINK1" "\017LINK2\020MULTICAST"; -char addrnames[] = +static char addrnames[] = "\1DST\2GATEWAY\3NETMASK\4GENMASK\5IFP\6IFA\7AUTHOR\010BRD"; -char defaultname[] = "default"; +static char defaultname[] = "default"; + +#define SOCKADDR_CNV_CONST(sa, sa_fam) \ + ((struct sa_fam *)(void *) (sa)) static const char * routename(struct sockaddr *sa) @@ -165,7 +161,7 @@ routename(struct sockaddr *sa) { struct in_addr in; char *cp; - in = ((struct sockaddr_in *)sa)->sin_addr; + in = SOCKADDR_CNV_CONST(sa, sockaddr_in)->sin_addr; cp = NULL; if (in.s_addr == INADDR_ANY || sa->sa_len < 4) @@ -220,10 +216,10 @@ routename(struct sockaddr *sa) #endif case AF_LINK: - return (link_ntoa((struct sockaddr_dl *)sa)); + return (link_ntoa(SOCKADDR_CNV_CONST(sa, sockaddr_dl))); default: - { u_short *s = (u_short *)sa; + { u_short *s = (u_short *)(void *)sa; u_short *slim = s + ((sa->sa_len + 1) >> 1); char *cp = line + sprintf(line, "(%d)", sa->sa_family); char *cpe = line + sizeof(line); @@ -340,7 +336,7 @@ print_rtmsg(struct rt_msghdr *rtm, int msglen) fflush(stdout); break; case RTM_IEEE80211: -#define V(type) ((struct type *)(&ifan[1])) +#define V(type) ((struct type *)(void *)(&ifan[1])) ifan = (struct if_announcemsghdr *)rtm; printf("%.19s RTM_IEEE80211: if# %d, ", cnow, ifan->ifan_index); switch (ifan->ifan_what) { @@ -373,7 +369,8 @@ print_rtmsg(struct rt_msghdr *rtm, int msglen) printf("replay failure: src %s " , ether_sprintf(V(ieee80211_replay_event)->iev_src) ); - printf("dst %s cipher %u keyix %u keyrsc %llu rsc %llu" + printf("dst %s cipher %u keyix %u keyrsc %" PRIu64 + " rsc %" PRIu64 , ether_sprintf(V(ieee80211_replay_event)->iev_dst) , V(ieee80211_replay_event)->iev_cipher , V(ieee80211_replay_event)->iev_keyix From nobody Fri Feb 28 08:13:26 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z41Dl1Pvjz5Vpwt; Fri, 28 Feb 2025 08:13: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z41Dk68mbz4QK5; Fri, 28 Feb 2025 08:13:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740730406; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cXzqNO6kI+h/J0wrWyvyz+HNt7s8BkSru8PSIdvGCQc=; b=rDy9EeHmiwoKdNYE65iGk+jyp3pUJ9d6Pb2Q8YI2/nsW1Ot7coFJOqWMVi41KAhbcpqDs4 NeDDtARHsWRUiQxJuiSLOu/hDxwPEqMtiBhsPOzJNA+ZsRmpJZHi0SFJyCv7IIyfrv9iau UK6i2TFVk9sLfQBQ/Uwt7ATpSpZzM8lBZEDdWUSs0crXCQtvmHBQbDMNRwlKoQ/jQrNpaU 2RRBBLtw5i4rgSFJn4xg+SGvocq5XbfA47N3lp/YADmzGcIN/ZZ0VHeul1dMljDn8qfcWH ZG6rl8yGOucPsQq8FnGKsx6F1PwlyhuGWpaP3CRI2CQjmq1kvgDJLrILdn1RFA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740730406; a=rsa-sha256; cv=none; b=duDpdzGEGBT4saqLfYJlb6mjDRnpiOY66YLMa2DnOpSfpquG7R17sL/VwrNN+rX0keqA2H L9TduHl2evMKBJTwzT3sgOySjWklU26NvC6/vRVff7m5I9JKuMhiC9QAhqB6cwWuSfBjbr 2+lQnMjgybldWGDi09vU5F8dGWgdqHzJlbfb9XKQVQHBT+XspbdhaL2OgOGTqV83thhi1i 4juXb7mopq4+ue7qgp52oV7XKVR6YI+Bw8UeyC1BzqGVW9Ci5njCESQt4wHe9b2S7gPsvF sWUShdILBeIXZFLlWdlYy6yNbQxb/OB7h3MO75wfn1VBdrOlTXZMPqcgGZzYCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740730406; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cXzqNO6kI+h/J0wrWyvyz+HNt7s8BkSru8PSIdvGCQc=; b=rawjSwDcdTWF6FYECuoMsrde8mLdvpYSanWbOuLmRgrjp4eWC2PoDaVO1xtUe0YKtav/xd xwrm1SuutxzorZmCafSlrP56b0cZdB5CoMMopzTeGTV4lCDhO9idd63gRoA/aDaB8UVHYH mNHzn8/YjNapFx0QLWLP75sNDRqfl+mGtNrclJ3KnVkhASLpIEKlAAtBqVRAMH0jzm8zBt pcNnYVJxyya6Rf3WpK2+ErifoTuZioX+qbBpOtANcIQ+O0bvFf6BVkg3rvu6k6oWkyNRT8 0jZWJzn8Vzt9ad844RyAvvOOapCFUY5jVCyFAc7zQxGoIZfJMjsun/tlwSwLDw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z41Dk5mMrz5W0; Fri, 28 Feb 2025 08:13:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51S8DQf6037988; Fri, 28 Feb 2025 08:13:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51S8DQiZ037985; Fri, 28 Feb 2025 08:13:26 GMT (envelope-from git) Date: Fri, 28 Feb 2025 08:13:26 GMT Message-Id: <202502280813.51S8DQiZ037985@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Lo Subject: git: 5c7087c349fc - main - ixgbe: Fix a logic error in ixgbe_read_mailbox_vf() Reviewed by: kbowling Differential Revision: https://reviews.freebsd.org/D49156 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevlo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5c7087c349fc1d826807aa1a11912c9e774e3321 Auto-Submitted: auto-generated The branch main has been updated by kevlo: URL: https://cgit.FreeBSD.org/src/commit/?id=5c7087c349fc1d826807aa1a11912c9e774e3321 commit 5c7087c349fc1d826807aa1a11912c9e774e3321 Author: Kevin Lo AuthorDate: 2025-02-28 08:12:00 +0000 Commit: Kevin Lo CommitDate: 2025-02-28 08:12:00 +0000 ixgbe: Fix a logic error in ixgbe_read_mailbox_vf() Reviewed by: kbowling Differential Revision: https://reviews.freebsd.org/D49156 --- sys/dev/ixgbe/ixgbe_mbx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/ixgbe_mbx.c b/sys/dev/ixgbe/ixgbe_mbx.c index 5f1f64e02b82..0b866e7a39af 100644 --- a/sys/dev/ixgbe/ixgbe_mbx.c +++ b/sys/dev/ixgbe/ixgbe_mbx.c @@ -297,7 +297,7 @@ static u32 ixgbe_read_mailbox_vf(struct ixgbe_hw *hw) u32 vf_mailbox = IXGBE_READ_REG(hw, IXGBE_VFMAILBOX); vf_mailbox |= hw->mbx.vf_mailbox; - hw->mbx.vf_mailbox |= vf_mailbox % IXGBE_VFMAILBOX_R2C_BITS; + hw->mbx.vf_mailbox |= vf_mailbox & IXGBE_VFMAILBOX_R2C_BITS; return vf_mailbox; } From nobody Fri Feb 28 08:54:08 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z427y3czlz59Lwh for ; Fri, 28 Feb 2025 08:54:22 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z427y0WKCz3RBs for ; Fri, 28 Feb 2025 08:54:22 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-qt1-x836.google.com with SMTP id d75a77b69052e-472039adb9bso23348351cf.0 for ; Fri, 28 Feb 2025 00:54:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; t=1740732861; x=1741337661; darn=freebsd.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=H8fKMpzSYGiWY2xWlAr/vgsLROlvzPfThcGGrc9JAmw=; b=pF09AXntMZk8H/Ey2RzIP4bCteX5yAUS/KA7TIxv0bx0F8cg9D9dKvU427bIrbP6xQ X2k+jaH2rXecZaOowlfR6thJMUzsju8P9RKYvZvLPIgjSRFhtuMvBYO7MplcpXu8X0VR sebIUhFnrHekZyuFYfffZobjCyUqkMufX5Yxk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740732861; x=1741337661; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H8fKMpzSYGiWY2xWlAr/vgsLROlvzPfThcGGrc9JAmw=; b=QuGQCToVLDU4yOI1V/6kwPKM0ctu/3Jz0VIvdB4oVIWs3tequGOon3sq1giv3QYrkg PdqG64aSVGZpECh1dKqpp4dyz1CZ7lzvPJ5R8ogXO+GGKeCcXYos4hi6FqYgaJdcYA8P iZm2haR0I/NWfPfuRyir2bu9AGBrI77/o/kpiGyhYl81/yzJFh/Rv0sw16EiGOpHHY9S 4/gRalCiyIZ+HXS+tBMJbvfR63TFw4LNYA/l5+4kz7zS+1fIYQuDKtWdarNw+x6OaUcZ axGKu1Y3bZQM3D3Xipv9FNmtnW25L8iNQvgUJ8VlKliZTdDjX+l57I+CJS7eOdbIP7MC pD4w== X-Forwarded-Encrypted: i=1; AJvYcCXW8/fE41ZPzMkxCKyHqeoJiErV7rR4n2GrhM9U+6PcJ5zAQ8n1CD0bDQFZn40ei4TQKqYv8GZeNh6HSBoE0c0GJ/c4qg==@freebsd.org X-Gm-Message-State: AOJu0YwTLi55DgIfS81NNaQTNMHDbkJ8UwO4B9guZaIiiRfRcJTFN7mw jzMt1SBGndP9gqHVyp8YoHZc2vg4ucJVLjf0YabUZhbYldoQaKAWmlmvp9LDDQOkWZ5YxM3FPyK 632bkLwcFIaVXNLtCOKAXWEMJhuYLeaJkC834 X-Gm-Gg: ASbGncvSNgIfxnxGH+eXvOsqBLYSJbrtfzyfqOONRk+P9ZC1B/Z8jjUv9eMwkVb4daV 5iay+JDTUX3114Ume8h/vk02/4VbQiWoYTLGmapG+COVFxbA9mgylOiPCeDOxq6xYJrZO4kfEEG o4HdyP8KRG X-Google-Smtp-Source: AGHT+IG4OE6XK2iDR8tOQiVd1//Lhn3WoNvRL+rjwI2+UnwToixP2fZII2MUvfU5T0vOUGC/ltc6eB8Bs1Hhs3wFwNw= X-Received: by 2002:ac8:5a82:0:b0:471:cfa9:2612 with SMTP id d75a77b69052e-474bc0fdc44mr30736231cf.32.1740732861238; Fri, 28 Feb 2025 00:54:21 -0800 (PST) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 References: <202502280813.51S8DQiZ037985@gitrepo.freebsd.org> In-Reply-To: <202502280813.51S8DQiZ037985@gitrepo.freebsd.org> From: Kevin Bowling Date: Fri, 28 Feb 2025 01:54:08 -0700 X-Gm-Features: AQ5f1Jr76GqwPhHbItb0i6IYOYc-q37SUz7CcgcHltpPd6rl1HkIS2Bj2PJ-ulc Message-ID: Subject: Re: git: 5c7087c349fc - main - ixgbe: Fix a logic error in ixgbe_read_mailbox_vf() Reviewed by: kbowling Differential Revision: https://reviews.freebsd.org/D49156 To: Kevin Lo Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4Z427y0WKCz3RBs X-Spamd-Bar: ---- MFC? On Fri, Feb 28, 2025 at 1:13=E2=80=AFAM Kevin Lo wrote: > > The branch main has been updated by kevlo: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D5c7087c349fc1d826807aa1a11= 912c9e774e3321 > > commit 5c7087c349fc1d826807aa1a11912c9e774e3321 > Author: Kevin Lo > AuthorDate: 2025-02-28 08:12:00 +0000 > Commit: Kevin Lo > CommitDate: 2025-02-28 08:12:00 +0000 > > ixgbe: Fix a logic error in ixgbe_read_mailbox_vf() > Reviewed by: kbowling > Differential Revision: https://reviews.freebsd.org/D49156 > --- > sys/dev/ixgbe/ixgbe_mbx.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sys/dev/ixgbe/ixgbe_mbx.c b/sys/dev/ixgbe/ixgbe_mbx.c > index 5f1f64e02b82..0b866e7a39af 100644 > --- a/sys/dev/ixgbe/ixgbe_mbx.c > +++ b/sys/dev/ixgbe/ixgbe_mbx.c > @@ -297,7 +297,7 @@ static u32 ixgbe_read_mailbox_vf(struct ixgbe_hw *hw) > u32 vf_mailbox =3D IXGBE_READ_REG(hw, IXGBE_VFMAILBOX); > > vf_mailbox |=3D hw->mbx.vf_mailbox; > - hw->mbx.vf_mailbox |=3D vf_mailbox % IXGBE_VFMAILBOX_R2C_BITS; > + hw->mbx.vf_mailbox |=3D vf_mailbox & IXGBE_VFMAILBOX_R2C_BITS; > > return vf_mailbox; > } From nobody Fri Feb 28 10:29:30 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z44Fk64Yxz59W0C; Fri, 28 Feb 2025 10:29: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z44Fk5PMGz3vR0; Fri, 28 Feb 2025 10:29:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740738570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PxD+Ubpe3rNzUscujBl1eqsUMpH0tAKoKl+TCai6JXE=; b=yRNkv/n+xf/bBkvsphBOjkXetK+JGT3frFBBnlDSXjH4BYC3kDNhc7ywep9wFeiY1Yoe+n 33xpQxu81Q/1YrntlfyvZpy0cBVcZOEvL9s0GB3OLc96Txry3cvPmorG8aTwV9cpBHchcg WtmfF/WKYx3OkDEfy7EIhQoaUr8GSaHVKtafVYQG8Z3iSJYsjBuCd6gMYkVCEipA5fo1pb d9hADe8kaRRK7PykZT90yaAscsz0jCBrw0PXJH9zpy1qQrZItFF89ekncpEUP7Atm1V09s MegQKl+3w955f11OZ/LYEi027HSrqk9vhtE25+Uhpdy51m38hQLUbVRcc89kdA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740738570; a=rsa-sha256; cv=none; b=CHSqgEugCK1yq/xzT7oT1AdfejiiYr/xvQ2nyXiOrV0Eqa9+kK3YFyOUVicMmDViwRFz8W fKL4Uu6sNhupvNCrfJqfFNg85QsUAmyG9Ezz5BN9MBMAT3xgVlFpZltN4ZBHu6u6/NCrS1 prLUpxZ5DlhlxlUjf94Evnkanal2LK2MH9DIgn//4TXUL7n+n4a1ZLv+f7h9Jc+SqHlNk3 MG0BtwxVUbQbQZeKU5M6b7QNwyotz5XXanXkUmFotAOGG1G292D5MidAGI4sQqb9LjtzBD gS2A3/R9eZ0asiND8jtiFR4bu593emBivT5D6rDRe9M7uYeHxFemZiPaxhDPrg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740738570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PxD+Ubpe3rNzUscujBl1eqsUMpH0tAKoKl+TCai6JXE=; b=V/oHvSvSuZD4/xCHbD7pSSLLqhaz1ptuQjmLY+xtddJ3pKeiZnze9q1PBBVp9pgI4/Vpir Y/2WI6jD0dKuPXHAtC8JCuhsC2Lwy2Z7Rt+kIrbW6K76j1Yj5Wzbm/jerm9F8PInVci1l0 4a91RfAjqsX1OuYY7JLp8uhjsd0gpntmC6fk/GdjnyfToJko7T+gM8XBHn/Jl6CXyP/hsV 4mZkNsX4L3TmKDG5WiahlQ4zE0O2JtwOGMRaiO7+2sgc0BTlQ+Hajyj7D5sHWAGEkOQmuw 2SW5naO5nQ7dwJmgN9jbcCuEeR/D+WA0zLAkyQpw82GgonEmsDZSRFTts1EuxQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z44Fk4zspz8Wf; Fri, 28 Feb 2025 10:29:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51SATUgF083204; Fri, 28 Feb 2025 10:29:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51SATUA7083201; Fri, 28 Feb 2025 10:29:30 GMT (envelope-from git) Date: Fri, 28 Feb 2025 10:29:30 GMT Message-Id: <202502281029.51SATUA7083201@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: 8cebb0630046 - main - open.2: add separate paragraph for O_CREAT List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8cebb0630046a8eb10c551a856397ed230e73833 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8cebb0630046a8eb10c551a856397ed230e73833 commit 8cebb0630046a8eb10c551a856397ed230e73833 Author: artembunichev AuthorDate: 2025-02-27 14:21:20 +0000 Commit: Konstantin Belousov CommitDate: 2025-02-28 10:29:12 +0000 open.2: add separate paragraph for O_CREAT PR: 284353 MFC after: 1 week --- lib/libsys/open.2 | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/lib/libsys/open.2 b/lib/libsys/open.2 index 9ad5440bf239..699446b6c7c2 100644 --- a/lib/libsys/open.2 +++ b/lib/libsys/open.2 @@ -231,16 +231,36 @@ is specified and the file exists, the file is truncated to zero length. .Pp If -.Dv O_EXCL -is set with .Dv O_CREAT -and the file already -exists, +is set, but file already exists, +this flag has no effect except when +.Dv O_EXCL +is set too, in this case .Fn open fails with .Er EEXIST . This may be used to implement a simple exclusive access locking mechanism. +In all other cases, the file is created +and the access permission bits (see +.Xr chmod 2) +of the file mode +are set to the value of the third argument taken as +.Fa "mode_t mode" +and passed through the +.Xr umask 2 . +This argument does not affect whether the file is opened +for reading, writing, or for both. +The open' request for a lock on the file, created with +.Dv O_CREAT , +will never fail +(provided that the underlying file system supports locking; +see also +.Dv O_SHLOCK +and +.Dv O_EXLOCK +below). +.Pp If .Dv O_EXCL is set and the last component of the pathname is @@ -289,10 +309,6 @@ semantics can be obtained by setting for a shared lock, or .Dv O_EXLOCK for an exclusive lock. -If creating a file with -.Dv O_CREAT , -the request for the lock will never fail -(provided that the underlying file system supports locking). .Pp .Dv O_DIRECT may be used to minimize or eliminate the cache effects of reading and writing. From nobody Fri Feb 28 13:33:37 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z48L93zWGz5hxWm; Fri, 28 Feb 2025 13:33: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z48L93K8cz3Tmc; Fri, 28 Feb 2025 13:33:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740749617; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X0eyymz0UJGE5UC5yiBWVfMTTbRuWDujUa21utLbCu0=; b=B7km4UNb4x0vinUf/FZj+CzE5E/+bqwJH9oYg+5pkb605oM26fWw7Wt7jzxKq7lmaQV/s+ rm/nARId2s/oI8j4c4thhpL8gl94kUxP8Uy7UpBVzamRPkbn9CuT2G07PN+B2oZYtLtUKj 796esk1YA4SEWh9gghjHuzskp1dJuol7dwt93+SRvT59Lza0A3dumyWGaIzgTsEulCb8IT tQL/YzK7oy4d5efgJTqxKobYZXcah2rOXpH2TLhG7FoHamYHBh7C9I6zh6UNmDGxr8Olzi FNkmfh3UdSOKoaDA/wz/wY/Ih6nsklYDwtzAa4rpRXZIu1L5AKsxzOiQZ5ahzQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740749617; a=rsa-sha256; cv=none; b=AaeO3qQcIAiF+nSDlucDMLYXBjsI9VWFRXeOLG2QUJBJ45dUjj3fU6OfMaJ44T8A6K0SkI U1qviXqq2RTTwXyBmF4zgMZTnC8HQ7XZr2vprByVPbWZgDZpnL5VPB/YK8ax8TJJfSxAZ3 /IEccPAHRon63XmE+lTH1uZKWCc9/h+K6zkYQ294KEBr+2nYFpS6EH6fG+uF6j+v7H1uwF aW/4KRVBfTfPfzog3pW5TCVddxxOG3jE1UQMfVuLFhPi1QkaulVoZ48KioxGFHaaE5YR6l ItkEYy6UhMPUVdSrGow2OJpMeOLbcUvuAuzc25G6HwM/fuPfnKckZEmmxvIKFw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740749617; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X0eyymz0UJGE5UC5yiBWVfMTTbRuWDujUa21utLbCu0=; b=OGmQ46q/s0ODBUM16fUDYmHdW3sRzC++8TYCJOUL7tlI5uIhopQAMxnKr2D17EwJk4lVKC FoRQM0JsRRgA+cPFocCwdrcnV7KLLbbV+jHZ/15DzOYrawkX9pYsYVI5aQlkd5e8ShJ53B /w2ZqdD+/TEH/SX8xW5i8Fg9KzCSn7L3/Vd5opVZpbMO43kpx5aEqPAmX9/9UorVKAeW80 Jdr+gbcrgoqNvbn93IPl2e73j/xGSbi8J1iS3fFlgWQzWyN/Xks822BsJX3QlS5BsjqIvM ALRs+cIjfQZubFZPJxOf4GPjqRmaNVvjwMcSMyvmmHxEeu+7JGnY7vu/CuXaDQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z48L92wd7zWY1; Fri, 28 Feb 2025 13:33:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51SDXboW036909; Fri, 28 Feb 2025 13:33:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51SDXbUg036906; Fri, 28 Feb 2025 13:33:37 GMT (envelope-from git) Date: Fri, 28 Feb 2025 13:33:37 GMT Message-Id: <202502281333.51SDXbUg036906@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: ae2b84d9ab9c - main - man4: Fix duplicate if_rtw89.4 MLINK List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ae2b84d9ab9cb01abb035ad6e938382d1f7c1e3e Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ae2b84d9ab9cb01abb035ad6e938382d1f7c1e3e commit ae2b84d9ab9cb01abb035ad6e938382d1f7c1e3e Author: Ed Maste AuthorDate: 2025-02-28 13:31:02 +0000 Commit: Ed Maste CommitDate: 2025-02-28 13:33:14 +0000 man4: Fix duplicate if_rtw89.4 MLINK Fixes: 4262dbc57982 ("wifi manuals: Mlink + document description consistency") Sponsored by: The FreeBSD Foundation --- share/man/man4/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 8e0af19eec3d..5f950b7275da 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -764,7 +764,7 @@ MLINKS+=ptnet.4 if_ptnet.4 MLINKS+=ral.4 if_ral.4 MLINKS+=re.4 if_re.4 MLINKS+=rl.4 if_rl.4 -MLINKS+=rtw88.4 if_rtw89.4 +MLINKS+=rtw88.4 if_rtw88.4 MLINKS+=rtw89.4 if_rtw89.4 MLINKS+=rtwn.4 if_rtwn.4 MLINKS+=rue.4 if_rue.4 From nobody Fri Feb 28 14:11:42 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z49B64LLyz5m05j; Fri, 28 Feb 2025 14:11: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z49B63WPjz3ZXf; Fri, 28 Feb 2025 14:11:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740751902; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aCESBnRg1WdSELgFgU/WcFv+R6jUKKg+3KU2mmZeQ/8=; b=P0X42Sy6GALabND9xg2OrZVXJAa1guGOBvmiy8O3WfUmMFihLXEkembknRApKADnO3jqKN 6Ovr9ly048qsk1vChhW5G308cILE/XsUBQfLIPTLjVz+Gv4ONRyerSmjgk4x6uCCH7dxk+ O4ui8QOnoTGHXsJmDUtH6XLcBZTgm//+poI0SPXE6CHKeEnlj2Iwf+Bsw7Wakk9dP0oGyU AWiuzNVlPwrzMIUO/f2HYQuPUXOpIWLtdBj3IpA/xT6jVidZvJF/lwCdOOrT4h/Lm5yfFR cnwKiqhv7IKKEmAbL6joBxxxKo7dN11z9a6XQKlWtOjbyjjnywqgcCJ0AyQ5Xw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740751902; a=rsa-sha256; cv=none; b=pVBz3TgIU2uuabrLWjr9B39Ncv4EZ4+Az3qygoJ2f7BESNXEiWDiKUKDHuSipN1sRzkW/U MDiIzrn90MaPs369B0Fwv+wjSpWSGnwiMN5L2M3tD/9gY71NeTDQg8la/GF+ZapVjexNhS ZWmcTM9cVybYBi3V1V4rntOVrh+/tRriENb/yuFvs+RvUzxAz8axJ4pNjepd0vdlYG4HZN 0FNodq+OCKlZhgpvZ/wx8scuOjf8ki6DAH8F+Nahca+/hAXsKi77VcA7HXD4MRTXpZAj8C Wzc6vb6O2Ah5rYTDU8iXRJmteMpTBRpNA8hEAKl5jemguZiFtRHUWAGYuakUjg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740751902; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aCESBnRg1WdSELgFgU/WcFv+R6jUKKg+3KU2mmZeQ/8=; b=VvYf4l7g5ecncs9+lIPO+Wj+1zAhc+1hE9ZvFseh3cNdq4c3Raa/sKlLLTiTvVawgrFLMj 9CoLqH61w0HLkGTmjThElzXcGbW3IuXnVFleUc7seIS2x7mACHz7ZikMp1MG6fjgnP1OGT ui2CMzSdvYbJB9sOdRrc7GRws6ejFT22qXt+D7CaXhdptv7cXKrZB4coN/moTzyrVC8aji 64NjU0YNxx3TmTHVcPEzwOmsUJFHAhVsG1oWPs2EW5hMQu593g9OczOpIdg08i0qUbH/8Q 9CP07p+xTBdPBUhLYg2NDSQSv/NwGu8sGIcD8edrDkLqPE4q55KNsvzVyf/S6w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z49B633q7zXG7; Fri, 28 Feb 2025 14:11:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51SEBg7S009394; Fri, 28 Feb 2025 14:11:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51SEBgOR009391; Fri, 28 Feb 2025 14:11:42 GMT (envelope-from git) Date: Fri, 28 Feb 2025 14:11:42 GMT Message-Id: <202502281411.51SEBgOR009391@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: f2644d64b40f - main - routing: set net.route.multipath=0 when kernel doesn't have ROUTE_MPATH List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f2644d64b40f611fd4d4f66069ad8d6cf33f69df Auto-Submitted: auto-generated The branch main has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=f2644d64b40f611fd4d4f66069ad8d6cf33f69df commit f2644d64b40f611fd4d4f66069ad8d6cf33f69df Author: Andrey V. Elsukov AuthorDate: 2025-02-28 14:05:47 +0000 Commit: Andrey V. Elsukov CommitDate: 2025-02-28 14:05:47 +0000 routing: set net.route.multipath=0 when kernel doesn't have ROUTE_MPATH MFC after: 1 week --- sys/net/route/route_ctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index d7756f2a0eb6..e5ddd7782e1e 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -109,10 +109,11 @@ SYSCTL_DECL(_net_route); #define V_rib_route_multipath VNET(rib_route_multipath) #ifdef ROUTE_MPATH #define _MP_FLAGS CTLFLAG_RW +VNET_DEFINE(u_int, rib_route_multipath) = 1; #else #define _MP_FLAGS CTLFLAG_RD +VNET_DEFINE(u_int, rib_route_multipath) = 0; #endif -VNET_DEFINE(u_int, rib_route_multipath) = 1; SYSCTL_UINT(_net_route, OID_AUTO, multipath, _MP_FLAGS | CTLFLAG_VNET, &VNET_NAME(rib_route_multipath), 0, "Enable route multipath"); #undef _MP_FLAGS From nobody Fri Feb 28 15:16:22 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z4Bck5Jhbz5m4kr; Fri, 28 Feb 2025 15:16: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z4Bck4Mfzz3kMN; Fri, 28 Feb 2025 15:16:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740755782; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZENnwvlp8HKMqTpNRRo6sFVq52hidLjDcTkOjXVm96I=; b=POFGxXpt5HTK3lvQwq27ZFZk7w/QrZzPjVTfm56/8eKj6WvCFbAtuVqe+DTPpk8mATsJDw hSjFrFRhUGIKdAfrTN5BXAJoAdV18Izt9TpusY2plExL3lQcz+g6tsCO2NWWPm84xwE8t3 pgqjHlkboJUHWJEcFULW+/52H1xAe3FWv1i8tOhhMGKOz/IfD+FcpvfHIK14JtwmGGhVO8 4rGkIln8DDRBH68yALElOZLmm7GU9nUPW2DZz5y0n4qlbbwRkmGNf/SpJ6yN+j4p71fBBK vZMKoTitKYHlQIu+vlKhJDAspGjn8gzS6jo6utllLHsRlGqC4t8bPp98k28q2Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740755782; a=rsa-sha256; cv=none; b=hGRKJnG87c4cmtUMihaoSqZ2rdKSczmBo0dDmv/alPrOEnpeAcL4B3HlmH0o3PC8ZrmXTY UResiOGBJxdKJqM6iaw7YVHmnnHV5jCKDJwEtb8UZPGGVfQUWhJnUswbVxcxh0DJRoTgQv 1ejO8im5rnLW27ppUQgE895PQ9N0itqAsAFVRH+KCO/sHEx5u3L6lK4gwa9RTl+uZ+XSvy 9iXaA8TDjJaiyc+HcuSp/jcuY09+6LkBckd/axCtZNGY/Bh7uXBYh5JCD7u+EbRE/+sY08 xQ81dWXElgV1mZyXrePjtYIj4lHEYQzk49OdArTxUyI9l6zLY6QAvLLkIGr6BQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740755782; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZENnwvlp8HKMqTpNRRo6sFVq52hidLjDcTkOjXVm96I=; b=CBSqBUcST8SrVTXo1slMH20LgbcYv2FJPllA5nN6FXs5it9cDWY6woOF7/dMV9VZI+F351 HUPfSYybzfYIEz/rD8G8XcsUCTCYgdSJAfWrDRxjR0kE+ibJu+enmhw/J1T/dueMTjfdZC QGgS2EzKG3h/CCZKt3Qg/mdU1XDGh3oHqE8UCtdZ5sctHYyecIN2aeu/f+iVEacghv6Fw9 coYCM8NNecvyc6J53JoAdRzVbYfbLG8D5kPnZ4L5eR/zEjwklDZZK6wtnKhpUf+1l68kwO KieZjt4UxW+BH03T/BwjEkOX+TiscWLk7MjnDfOYHM+51eE7e+CrmIgQfciLzg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z4Bck3c3Szb5b; Fri, 28 Feb 2025 15:16:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51SFGMeg025563; Fri, 28 Feb 2025 15:16:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51SFGMT5025560; Fri, 28 Feb 2025 15:16:22 GMT (envelope-from git) Date: Fri, 28 Feb 2025 15:16:22 GMT Message-Id: <202502281516.51SFGMT5025560@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 8a3537aaf7c1 - main - Makefile.inc1: Make package timestamps reproducible by default List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8a3537aaf7c19f7331fcc160ab42e36fc79e408a Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=8a3537aaf7c19f7331fcc160ab42e36fc79e408a commit 8a3537aaf7c19f7331fcc160ab42e36fc79e408a Author: Ed Maste AuthorDate: 2025-02-27 13:17:11 +0000 Commit: Ed Maste CommitDate: 2025-02-28 15:11:52 +0000 Makefile.inc1: Make package timestamps reproducible by default Set package archive timestamps based on most recent source commit timestamp (approach suggested by bapt). I'd like to include git metadata in a file included in src tarballs, so that the build is reproducible (including the hash shown in uname etc.) outside of a git checkout. There are still details to be sorted out to do that, so this is an interim step to improve reproducibility. Reviewed by: bapt Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49165 --- Makefile.inc1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile.inc1 b/Makefile.inc1 index c9a4fee236aa..f51fe7d3b119 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -597,8 +597,12 @@ PKG_VERSION:= ${_PKG_REVISION}${EXTRA_REVISION:C/[[:space:]]//g} .endif # !defined(PKG_VERSION) .if !defined(PKG_TIMESTAMP) +.if !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git) +SOURCE_DATE_EPOCH!= ${GIT_CMD} -C ${SRCDIR} show -s --format=%ct HEAD +.else TIMEEPOCHNOW= %s SOURCE_DATE_EPOCH= ${TIMEEPOCHNOW:gmtime} +.endif .else SOURCE_DATE_EPOCH= ${PKG_TIMESTAMP} .endif From nobody Fri Feb 28 15:53:46 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z4CRv0MDyz5m7nH; Fri, 28 Feb 2025 15:53: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z4CRt6Wy3z3vHZ; Fri, 28 Feb 2025 15:53:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740758026; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bICeD2S3A81nSG1D/ngIcKicp9xvQcxwBW0BUk43ijU=; b=d5FpGRaQNkDPx/gk1ZIPO1Ysyts2GBDnXZJ5cutZ9igoY/xO4fHZM3u/mm2H+LlvDwjDxk ir5JSOx6ljMHHdGCcLWw/PEmvuK/m0o1KmA8RDZD/EttNeGMNfjonMC+G7de41Pk3quBHy i6kqqJF37Ykn+NzWxWyZoXE0Sm/Z/r5Yx+4gplaUXIB4f41yXdy6jsueONZg2r142PeUPf a5jLm3OpId7pe8feOhmxARPskWXDcPkV4+zBeTV5EFvczP6qttFf8vsz8uPdJ/8KtqAMte 1q7a9JELYRz6qqTexdqLxzPtkJBPvR4GAy7S36OFYe/+eu7lOTJrEkEOgEu59g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740758026; a=rsa-sha256; cv=none; b=iwj50cILmy4Rccc3ufgJi3FgTDpmNm116Pq0IN4KpCGEaAT0IRIydHg79PIs1lvPvt4DXC ixYSBz9zgoe9wq3uRxRFcUnRUQ8hRBZn+OQBbgkpEcb1vDKZzUv82tc3P53lBPoX6CubAQ 5cQd62fbRIBw6pHLtEX0YNQYGdw6mEvTzpDDCKz2pgQzwywxxEbG35WbFdBgx03LA7JZhk IIBL04Iwa+l/aZkBW9OdE9ZTLgZ1+NZojsHWRJTPXWVikRWV5WhaKmwFa3HQJ6ekWAcDF/ FJxFFsQnolXZbOFOyRMcwcyL0rrt4pzTgr8zjnAIK1Nmk9mcyVnhRNbyJieTmQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740758026; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bICeD2S3A81nSG1D/ngIcKicp9xvQcxwBW0BUk43ijU=; b=iuJ8i8LSoU8okqe2/V2nLzkuKc3aoxX7PbTgPn8AVtlHja6F2OMzrnAMYgORQMjMHDEp13 e4B5R2n6GzNxFPVaZ906uJa1bzRbslKP7eBPsU+ALO1p5Yuotb9lfzyyNLMZCYhHXEYHd4 yIRKYTj6CqiBv8j6y+4y2IcWiN3yBkmS/rrTNdHASWHPw8lX82lC7/KhtD/tRjjp4gXPKQ 78ubRUNlWnzjE/o14SYBmQ03EjPVMmPap4eKRinyQAUX/BxhzChPGTHxx3uTWA51HQNXsa k0GYUA9XFtPB6Nub796AaPcSYUcdg6wLo+yS2MY7RFgaFjI64wItmi/n4AUnjA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z4CRt5xPnzc9t; Fri, 28 Feb 2025 15:53:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51SFrkiF099047; Fri, 28 Feb 2025 15:53:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51SFrkfQ099044; Fri, 28 Feb 2025 15:53:46 GMT (envelope-from git) Date: Fri, 28 Feb 2025 15:53:46 GMT Message-Id: <202502281553.51SFrkfQ099044@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 628715fdcc9f - main - ntp: NULL pointer deref when create_interface() fails List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 628715fdcc9f2226bfe0f4ebe381aaa7761cb6cc Auto-Submitted: auto-generated The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=628715fdcc9f2226bfe0f4ebe381aaa7761cb6cc commit 628715fdcc9f2226bfe0f4ebe381aaa7761cb6cc Author: Cy Schubert AuthorDate: 2025-02-28 15:46:23 +0000 Commit: Cy Schubert CommitDate: 2025-02-28 15:53:22 +0000 ntp: NULL pointer deref when create_interface() fails Fix NULL pointer dereference when create_interface() fails in update_interfaces(). The upstream bug report says a typo was introduced by https://bk.ntp.org/ntp-dev/ntpd/ntp_io.c?PAGE=diffs&REV=66175036PETA6g__fON8oNrjL54Ttw. ep should have been ep2. Fix obtained from upstream bug report. PR: 285065 Upstream bug: https://bugs.ntp.org/show_bug.cgi?id=3939 MFC after: 1 minute --- contrib/ntp/ntpd/ntp_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/ntp/ntpd/ntp_io.c b/contrib/ntp/ntpd/ntp_io.c index 6a796101b0e8..9c4f6c1553e3 100644 --- a/contrib/ntp/ntpd/ntp_io.c +++ b/contrib/ntp/ntpd/ntp_io.c @@ -1919,7 +1919,7 @@ update_interfaces( } else { DPRINT_INTERFACE(3, - (ep, "updating ", " new - FAILED")); + (ep2, "updating ", " new - FAILED")); msyslog(LOG_ERR, "cannot bind address %s", From nobody Fri Feb 28 20:35:16 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z4Khh6zVsz5p54P; Fri, 28 Feb 2025 20:35: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z4Khh60sDz3hj0; Fri, 28 Feb 2025 20:35:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740774916; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=51yy4IgW+H6VI6hr+/2fXQHBcz+lW3NRmMXQ+POQZGQ=; b=PUofQ9sUiLwVK/hNaNFsT+394P8SpCIHPbUa5LYKsXOIjhPH1opXfOT4dd/Z6o2OPv2xkJ Gx1B2NQAN47XrcUnV4qpu79ax0izG77MIpBdpCM+avpGw7qB5m4eHunqu2++mM+WILY5Ig P6eHEDIJOYtOdo/qDAHRfwI/hPgZysOOiYXaXYI+kFsRMvfOD+0d/Ld6obYfbW31Vwu6BO Z/fWNs/6qzF1gu8zf5+C3mg2uQ3OIdWWRBpQa6mRzeTcDPNbTS/SnqpX+C8LLUKJ/naWtK VrnnRxclxZ8rYKsWV+crDtfpS/80ETelakri7FpIEsWLn0Thk4/6gMhiO22FjA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740774916; a=rsa-sha256; cv=none; b=CnvpB9cblBrD3i8d8xuI9zol/jRr87SgVpTo+E/wbf0qm3+XL6is69nuMxl8a72pLalKsG DKB4uU5sIcNs1eqnqdAWtvvZAYgO4Oxyn6EhKnAR0hCjw+eZwFWzh6dS8AvjBDD5v8Fb0b JwtH+ujkouE6GqDRPIoaOAkrMVVytQDlFFahdIHrOq6b5Zc3lpE4GeqGic3mpGLAtr03gV 4Q6D9xlDyIUs4NKlzOXdG0vr4Qa4ulVwCuRmPGD3O+z3eDsYfYylK8Lk7xQCX4cvfjtATU K1TrcTyK+EqJfXrcFM2ZQtuB77FXvKAsLJ2zBToz14kFLJ1CEyRQIBX+vyXZsg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740774916; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=51yy4IgW+H6VI6hr+/2fXQHBcz+lW3NRmMXQ+POQZGQ=; b=yzMgUqexRbdPYdR+H2P8ndjpZu2O1h13rTFIRc/Qha5d3i6ALmg0aLqTL4Xxdhx/sgkxuj nMYHNGFnizstxse5OYwYW8Qi06gwmIUy/TD4s93zODimnclkzIho2i/vx3y9q7WqtgFg6g mgj19swy9B0GMboTlSe7lSUwyjI+mpoKlSljRjkLsk6DzU+6mOh6OQVO7sQYKl+44ZEI3+ 9wTs9YUtT3mfObtN1b4G3cv7smk4RdWvXyPjrftHZ03c5jb83UUDyp85B3mkGXj6eiw7sK lazH0P7eXatRc+CFuhkZRUfN37F8rU+ZFiPTpkJ/QQTmlY/xxXeF2CU+x5AQ6Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z4Khh5YwdzlLS; Fri, 28 Feb 2025 20:35:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51SKZG0H024094; Fri, 28 Feb 2025 20:35:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51SKZGSp024091; Fri, 28 Feb 2025 20:35:16 GMT (envelope-from git) Date: Fri, 28 Feb 2025 20:35:16 GMT Message-Id: <202502282035.51SKZGSp024091@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 518cdd344ec5 - main - makefs: Make cd9660 Rock Ridge inodes reproducible List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 518cdd344ec51584478f39b9a9cac77fc0766ce1 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=518cdd344ec51584478f39b9a9cac77fc0766ce1 commit 518cdd344ec51584478f39b9a9cac77fc0766ce1 Author: Ed Maste AuthorDate: 2025-02-26 16:44:12 +0000 Commit: Ed Maste CommitDate: 2025-02-28 20:34:52 +0000 makefs: Make cd9660 Rock Ridge inodes reproducible Rock Ridge extensions include an inode field: "POSIX File Serial Number" shall have the same meaning as and may be used for the st_ino field of POSIX:5.6.1. This field shall be recorded according to ISO 9660:7.3.3. Directory Records which share the value of this field are defined as links (see POSIX:2.2.2.17) and, by definition, point to the same file or directory. Previously we'd store the source file's st_ino (except that in metalog mode we'd record 0 for files with nlink = 1). This had two issues: the generated ISO image was nonreproducible due to the arbitrary inode numbers, and files without hard links would falsely be detected (by certain tools) as hard links to each other. Note that the kernel's cd9660(5) file system ignores the Rock Ridge PX File Serial Number, so this issue isn't observed by mounting such a file system. Instead of using the source inode directly, assign target inode numbers sequentially. Use a map so that files with the same source inode (hard links) still receive the same target inode number. PR: 284795 PR: 285027 Reviewed by: brooks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49141 --- usr.sbin/makefs/cd9660.h | 12 +++++++ usr.sbin/makefs/cd9660/iso9660_rrip.c | 67 ++++++++++++++++++++++++++++++----- usr.sbin/makefs/cd9660/iso9660_rrip.h | 2 +- 3 files changed, 71 insertions(+), 10 deletions(-) diff --git a/usr.sbin/makefs/cd9660.h b/usr.sbin/makefs/cd9660.h index b2db31460d02..c6f0e6472af3 100644 --- a/usr.sbin/makefs/cd9660.h +++ b/usr.sbin/makefs/cd9660.h @@ -51,6 +51,7 @@ #include #include #include +#include #include "makefs.h" #include "iso.h" @@ -203,6 +204,12 @@ typedef struct _volume_descriptor struct _volume_descriptor *next; } volume_descriptor; +struct inode_map_node { + RB_ENTRY(inode_map_node) entry; + uint64_t key; + uint64_t value; +}; + typedef struct _iso9660_disk { int sectorSize; struct iso_primary_descriptor primaryDescriptor; @@ -249,6 +256,9 @@ typedef struct _iso9660_disk { unsigned rock_ridge_move_count; cd9660node *rr_moved_dir; + uint64_t rr_inode_next; + RB_HEAD(inode_map_tree, inode_map_node) rr_inode_map; + int chrp_boot; /* Spec breaking options */ @@ -275,6 +285,8 @@ typedef struct _iso9660_disk { } iso9660_disk; +RB_PROTOTYPE(inode_map_tree, inode_map_node, entry, inode_map_node_cmp); + /************ FUNCTIONS **************/ int cd9660_valid_a_chars(const char *); int cd9660_valid_d_chars(const char *); diff --git a/usr.sbin/makefs/cd9660/iso9660_rrip.c b/usr.sbin/makefs/cd9660/iso9660_rrip.c index a4ce5c09b24b..e037f1db175f 100644 --- a/usr.sbin/makefs/cd9660/iso9660_rrip.c +++ b/usr.sbin/makefs/cd9660/iso9660_rrip.c @@ -47,7 +47,7 @@ #include "iso9660_rrip.h" #include -static void cd9660_rrip_initialize_inode(cd9660node *); +static void cd9660_rrip_initialize_inode(iso9660_disk *, cd9660node *); static int cd9660_susp_handle_continuation(iso9660_disk *, cd9660node *); static int cd9660_susp_handle_continuation_common(iso9660_disk *, cd9660node *, int); @@ -70,6 +70,9 @@ cd9660_susp_initialize(iso9660_disk *diskStructure, cd9660node *node, if (node->dot_dot_record != 0) TAILQ_INIT(&(node->dot_dot_record->head)); + RB_INIT(&diskStructure->rr_inode_map); + diskStructure->rr_inode_next = 1; + /* SUSP specific entries here */ if ((r = cd9660_susp_initialize_node(diskStructure, node)) < 0) return r; @@ -101,6 +104,7 @@ int cd9660_susp_finalize(iso9660_disk *diskStructure, cd9660node *node) { cd9660node *temp; + struct inode_map_node *mapnode, *mapnodetmp; int r; assert(node != NULL); @@ -117,6 +121,12 @@ cd9660_susp_finalize(iso9660_disk *diskStructure, cd9660node *node) if ((r = cd9660_susp_finalize(diskStructure, temp)) < 0) return r; } + RB_FOREACH_SAFE(mapnode, inode_map_tree, + &(diskStructure->rr_inode_map), mapnodetmp) { + RB_REMOVE(inode_map_tree, &(diskStructure->rr_inode_map), + mapnode); + free(mapnode); + } return 1; } @@ -323,7 +333,7 @@ cd9660_susp_initialize_node(iso9660_disk *diskStructure, cd9660node *node) } static void -cd9660_rrip_initialize_inode(cd9660node *node) +cd9660_rrip_initialize_inode(iso9660_disk *diskStructure, cd9660node *node) { struct ISO_SUSP_ATTRIBUTES *attr; @@ -337,7 +347,7 @@ cd9660_rrip_initialize_inode(cd9660node *node) /* PX - POSIX attributes */ attr = cd9660node_susp_create_node(SUSP_TYPE_RRIP, SUSP_ENTRY_RRIP_PX, "PX", SUSP_LOC_ENTRY); - cd9660node_rrip_px(attr, node->node); + cd9660node_rrip_px(diskStructure, attr, node->node); TAILQ_INSERT_TAIL(&node->head, attr, rr_ll); @@ -390,7 +400,8 @@ cd9660_rrip_initialize_node(iso9660_disk *diskStructure, cd9660node *node, /* PX - POSIX attributes */ current = cd9660node_susp_create_node(SUSP_TYPE_RRIP, SUSP_ENTRY_RRIP_PX, "PX", SUSP_LOC_ENTRY); - cd9660node_rrip_px(current, parent->node); + cd9660node_rrip_px(diskStructure, current, + parent->node); TAILQ_INSERT_TAIL(&node->head, current, rr_ll); /* TF - timestamp */ @@ -405,7 +416,8 @@ cd9660_rrip_initialize_node(iso9660_disk *diskStructure, cd9660node *node, /* PX - POSIX attributes */ current = cd9660node_susp_create_node(SUSP_TYPE_RRIP, SUSP_ENTRY_RRIP_PX, "PX", SUSP_LOC_ENTRY); - cd9660node_rrip_px(current, grandparent->node); + cd9660node_rrip_px(diskStructure, current, + grandparent->node); TAILQ_INSERT_TAIL(&node->head, current, rr_ll); /* TF - timestamp */ @@ -422,7 +434,7 @@ cd9660_rrip_initialize_node(iso9660_disk *diskStructure, cd9660node *node, TAILQ_INSERT_TAIL(&node->head, current, rr_ll); } } else { - cd9660_rrip_initialize_inode(node); + cd9660_rrip_initialize_inode(diskStructure, node); if (node == diskStructure->rr_moved_dir) { cd9660_rrip_add_NM(node, RRIP_DEFAULT_MOVE_DIR_NAME); @@ -630,8 +642,45 @@ cd9660_createSL(cd9660node *node) } } +static int +inode_map_node_cmp(struct inode_map_node *a, struct inode_map_node *b) +{ + if (a->key < b->key) + return (-1); + if (a->key > b->key) + return (1); + return (0); +} + +RB_GENERATE(inode_map_tree, inode_map_node, entry, inode_map_node_cmp); + +static uint64_t +inode_map(iso9660_disk *diskStructure, uint64_t in) +{ + struct inode_map_node lookup = { .key = in }; + struct inode_map_node *node; + + /* + * Always assign an inode number if src inode unset. mtree mode leaves + * src inode unset for files with st_nlink == 1. + */ + if (in != 0) { + node = RB_FIND(inode_map_tree, &(diskStructure->rr_inode_map), + &lookup); + if (node != 0) + return (node->value); + } + + node = emalloc(sizeof(struct inode_map_node)); + node->key = in; + node->value = diskStructure->rr_inode_next++; + RB_INSERT(inode_map_tree, &(diskStructure->rr_inode_map), node); + return (node->value); +} + int -cd9660node_rrip_px(struct ISO_SUSP_ATTRIBUTES *v, fsnode *pxinfo) +cd9660node_rrip_px(iso9660_disk *diskStructure, struct ISO_SUSP_ATTRIBUTES *v, + fsnode *pxinfo) { v->attr.rr_entry.PX.h.length[0] = 44; v->attr.rr_entry.PX.h.version[0] = 1; @@ -643,8 +692,8 @@ cd9660node_rrip_px(struct ISO_SUSP_ATTRIBUTES *v, fsnode *pxinfo) v->attr.rr_entry.PX.uid); cd9660_bothendian_dword(pxinfo->inode->st.st_gid, v->attr.rr_entry.PX.gid); - cd9660_bothendian_dword(pxinfo->inode->st.st_ino, - v->attr.rr_entry.PX.serial); + cd9660_bothendian_dword(inode_map(diskStructure, + pxinfo->inode->st.st_ino), v->attr.rr_entry.PX.serial); return 1; } diff --git a/usr.sbin/makefs/cd9660/iso9660_rrip.h b/usr.sbin/makefs/cd9660/iso9660_rrip.h index 5e1e8b5130f0..4c738d27ba45 100644 --- a/usr.sbin/makefs/cd9660/iso9660_rrip.h +++ b/usr.sbin/makefs/cd9660/iso9660_rrip.h @@ -224,7 +224,7 @@ int cd9660_susp_finalize_node(iso9660_disk *, cd9660node *); int cd9660_rrip_finalize_node(cd9660node *); /* POSIX File attribute */ -int cd9660node_rrip_px(struct ISO_SUSP_ATTRIBUTES *, fsnode *); +int cd9660node_rrip_px(iso9660_disk *, struct ISO_SUSP_ATTRIBUTES *, fsnode *); /* Device number */ int cd9660node_rrip_pn(struct ISO_SUSP_ATTRIBUTES *, fsnode *); From nobody Fri Feb 28 20:55:16 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z4L7m32Vrz5p6K6; Fri, 28 Feb 2025 20:55: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z4L7m2LRcz3kjq; Fri, 28 Feb 2025 20:55:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740776116; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jT20TBx7XZOb+11N8AXIKOTqGIcHkNfZ+YMpspta+Pc=; b=OlTZSKopedAbVoonh8GUyxrHKPfP14lu6NnJrLlQDmOZp8kTtdjShTJovDzwTu40li0HrZ G28bAX2jiMbe7Zqp8Bj/nLReV3NQPh8qWEZz8wTikZh0n5cK/pQhx8zVoj0RuunT+njLSo 07j5IdbMSdATGGTFCEqx5bd7fMkiZVErSTV9A76htfpft+/32ANDbVCPcIZ1Kyc9MczSsX XGkErR/aY/0Rx9EMEznC87zIDKB4jlhSBmFV9zXGiKnLE3HSgf4eY0YHdptbTS1NU8N3NT MFpI6V2VHuVP8fmvbdU14k9CVe9RFv3YaWXQbLOXtLR2Egd/6aAzyvHdKhLBFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740776116; a=rsa-sha256; cv=none; b=WumGLJefqaC5Z5la3r44oxM2AiqpEut2zFt56RmU7S3m765KkFbPG+pp/eBQsOMifn8P7e gQVSdN/Dh5Z/EeRbWQITAwf9b9Ugnvzs0nKdAfPRQx/Z9zABcF0rVw0738V9Y6siLWUAyk 0UGpw236348amxW4Oo9FQ6Fo9W9rYLHsv9pEj5L1xHlh6PX/Sbnw5tKARYHu2QHxc6vzHQ wTWhUyBeu+Vx98O2xlouK7CMTyObHdlxuD22CIpT9cV/CPtYg1XJg9F6IzwiQEYVYwH6nx reI2mxfYbHHxKx/bGuoIlXrkid2os7oA5GhkFDhO2wat6oE3XdLYpv8Xo1x3vQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740776116; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jT20TBx7XZOb+11N8AXIKOTqGIcHkNfZ+YMpspta+Pc=; b=mU5WV6pJDe7XfmW39HQruaMpYxhDIOoKDpH3tShXBF+f2xlhawuYJrqWVPaSmPRO9ayl0S ehgzkhZZ0ijJINnemsgCdvvtNbXqV50X08wvtKVYCaiXrriHfCzd8T93wkQkoQka+FXzBa H8KMAVbrBxXwlWcIXRxbQsMWpI1tdG2bHi0rH5/E7dko1Bg80whvtzdfeXGVyCW5ywqWuk zBv2Op4nUBEH7HRsamjSJQEI6OOutAIYeqEL0Rls2y8x9ohZsFOtoj0Vj/1/bDOwVRKbag pWC7QAIBdp5Y8KRBy/5FhwpAhiv7v/ifmKCghdkBxcE1rajsurqpkHuXpkXOZA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z4L7m1HQRzlC2; Fri, 28 Feb 2025 20:55:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51SKtGfX061191; Fri, 28 Feb 2025 20:55:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51SKtGiE061188; Fri, 28 Feb 2025 20:55:16 GMT (envelope-from git) Date: Fri, 28 Feb 2025 20:55:16 GMT Message-Id: <202502282055.51SKtGiE061188@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cheng Cui Subject: git: 67787d200488 - main - tcp: make inflight data (pipe) calculation consistent List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 67787d200488f0d838b20b0f483d1ca08ff6c014 Auto-Submitted: auto-generated The branch main has been updated by cc: URL: https://cgit.FreeBSD.org/src/commit/?id=67787d200488f0d838b20b0f483d1ca08ff6c014 commit 67787d200488f0d838b20b0f483d1ca08ff6c014 Author: Cheng Cui AuthorDate: 2025-02-21 20:53:06 +0000 Commit: Cheng Cui CommitDate: 2025-02-28 20:53:12 +0000 tcp: make inflight data (pipe) calculation consistent Reviewed by: glebius, rrs, tuexen Differential Revision: https://reviews.freebsd.org/D49047 --- sys/netinet/cc/cc.c | 8 +------- sys/netinet/cc/cc_cubic.c | 8 +------- sys/netinet/cc/cc_dctcp.c | 8 +------- sys/netinet/cc/cc_htcp.c | 8 +------- sys/netinet/cc/cc_newreno.c | 8 +------- sys/netinet/tcp_input.c | 26 +++++++++++--------------- 6 files changed, 16 insertions(+), 50 deletions(-) diff --git a/sys/netinet/cc/cc.c b/sys/netinet/cc/cc.c index eae5b7bca4d9..a34eefcf0066 100644 --- a/sys/netinet/cc/cc.c +++ b/sys/netinet/cc/cc.c @@ -500,13 +500,7 @@ newreno_cc_cong_signal(struct cc_var *ccv, ccsignal_t type) break; case CC_RTO: if (CCV(ccv, t_rxtshift) == 1) { - if (V_tcp_do_newsack) { - pipe = tcp_compute_pipe(ccv->tp); - } else { - pipe = CCV(ccv, snd_max) - - CCV(ccv, snd_fack) + - CCV(ccv, sackhint.sack_bytes_rexmit); - } + pipe = tcp_compute_pipe(ccv->tp); CCV(ccv, snd_ssthresh) = max(2, min(CCV(ccv, snd_wnd), pipe) / 2 / mss) * mss; } diff --git a/sys/netinet/cc/cc_cubic.c b/sys/netinet/cc/cc_cubic.c index 91d6642eb08d..82b0d9b7fa99 100644 --- a/sys/netinet/cc/cc_cubic.c +++ b/sys/netinet/cc/cc_cubic.c @@ -470,13 +470,7 @@ cubic_cong_signal(struct cc_var *ccv, ccsignal_t type) cubic_data->undo_cwnd_epoch = cubic_data->cwnd_epoch; cubic_data->undo_W_max = cubic_data->W_max; cubic_data->undo_K = cubic_data->K; - if (V_tcp_do_newsack) { - pipe = tcp_compute_pipe(ccv->tp); - } else { - pipe = CCV(ccv, snd_max) - - CCV(ccv, snd_fack) + - CCV(ccv, sackhint.sack_bytes_rexmit); - } + pipe = tcp_compute_pipe(ccv->tp); CCV(ccv, snd_ssthresh) = max(2, (((uint64_t)min(CCV(ccv, snd_wnd), pipe) * CUBIC_BETA) >> CUBIC_SHIFT) / mss) * mss; diff --git a/sys/netinet/cc/cc_dctcp.c b/sys/netinet/cc/cc_dctcp.c index f43efe0e27c7..757bc005edb4 100644 --- a/sys/netinet/cc/cc_dctcp.c +++ b/sys/netinet/cc/cc_dctcp.c @@ -294,13 +294,7 @@ dctcp_cong_signal(struct cc_var *ccv, ccsignal_t type) break; case CC_RTO: if (CCV(ccv, t_rxtshift) == 1) { - if (V_tcp_do_newsack) { - pipe = tcp_compute_pipe(ccv->tp); - } else { - pipe = CCV(ccv, snd_max) - - CCV(ccv, snd_fack) + - CCV(ccv, sackhint.sack_bytes_rexmit); - } + pipe = tcp_compute_pipe(ccv->tp); CCV(ccv, snd_ssthresh) = max(2, min(CCV(ccv, snd_wnd), pipe) / 2 / mss) * mss; } diff --git a/sys/netinet/cc/cc_htcp.c b/sys/netinet/cc/cc_htcp.c index 13441bb49190..ab6165f2e720 100644 --- a/sys/netinet/cc/cc_htcp.c +++ b/sys/netinet/cc/cc_htcp.c @@ -325,13 +325,7 @@ htcp_cong_signal(struct cc_var *ccv, ccsignal_t type) case CC_RTO: if (CCV(ccv, t_rxtshift) == 1) { - if (V_tcp_do_newsack) { - pipe = tcp_compute_pipe(ccv->tp); - } else { - pipe = CCV(ccv, snd_max) - - CCV(ccv, snd_fack) + - CCV(ccv, sackhint.sack_bytes_rexmit); - } + pipe = tcp_compute_pipe(ccv->tp); CCV(ccv, snd_ssthresh) = max(2, min(CCV(ccv, snd_wnd), pipe) / 2 / mss) * mss; } diff --git a/sys/netinet/cc/cc_newreno.c b/sys/netinet/cc/cc_newreno.c index d7172fa78bc4..de7b878152b0 100644 --- a/sys/netinet/cc/cc_newreno.c +++ b/sys/netinet/cc/cc_newreno.c @@ -428,13 +428,7 @@ newreno_cong_signal(struct cc_var *ccv, ccsignal_t type) break; case CC_RTO: if (CCV(ccv, t_rxtshift) == 1) { - if (V_tcp_do_newsack) { - pipe = tcp_compute_pipe(ccv->tp); - } else { - pipe = CCV(ccv, snd_max) - - CCV(ccv, snd_fack) + - CCV(ccv, sackhint.sack_bytes_rexmit); - } + pipe = tcp_compute_pipe(ccv->tp); CCV(ccv, snd_ssthresh) = max(2, ((uint64_t)min(CCV(ccv, snd_wnd), pipe) * (uint64_t)factor) / diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index e21043fac0cf..cf480ccf9772 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -2660,12 +2660,7 @@ tcp_do_segment(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th, * we have less than ssthresh * worth of data in flight. */ - if (V_tcp_do_newsack) { - awnd = tcp_compute_pipe(tp); - } else { - awnd = (tp->snd_nxt - tp->snd_fack) + - tp->sackhint.sack_bytes_rexmit; - } + awnd = tcp_compute_pipe(tp); if (awnd < tp->snd_ssthresh) { tp->snd_cwnd += imax(maxseg, imin(2 * maxseg, @@ -4098,11 +4093,7 @@ tcp_do_prr_ack(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to, (IN_CONGRECOVERY(tp->t_flags) && !IN_FASTRECOVERY(tp->t_flags))) { del_data = tp->sackhint.delivered_data; - if (V_tcp_do_newsack) - pipe = tcp_compute_pipe(tp); - else - pipe = (tp->snd_nxt - tp->snd_fack) + - tp->sackhint.sack_bytes_rexmit; + pipe = tcp_compute_pipe(tp); } else { if (tp->sackhint.prr_delivered < (tcprexmtthresh * maxseg + tp->snd_recover - tp->snd_una)) { @@ -4206,14 +4197,19 @@ tcp_newreno_partial_ack(struct tcpcb *tp, struct tcphdr *th) int tcp_compute_pipe(struct tcpcb *tp) { - if (tp->t_fb->tfb_compute_pipe == NULL) { - return (tp->snd_max - tp->snd_una + + int pipe; + + if (tp->t_fb->tfb_compute_pipe != NULL) { + pipe = (*tp->t_fb->tfb_compute_pipe)(tp); + } else if (V_tcp_do_newsack) { + pipe = tp->snd_max - tp->snd_una + tp->sackhint.sack_bytes_rexmit - tp->sackhint.sacked_bytes - - tp->sackhint.lost_bytes); + tp->sackhint.lost_bytes; } else { - return((*tp->t_fb->tfb_compute_pipe)(tp)); + pipe = tp->snd_nxt - tp->snd_fack + tp->sackhint.sack_bytes_rexmit; } + return (imax(pipe, 0)); } uint32_t From nobody Fri Feb 28 21:18:04 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z4Lf51VC3z5p7lk; Fri, 28 Feb 2025 21:18: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z4Lf50jtVz3lwm; Fri, 28 Feb 2025 21:18:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740777485; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qxbNeZgT9e7wM0PR7s5Mvqf9VrZdmMFn5IofbMz5Mdk=; b=rzTFuJvxk10toX3eqkTKCGBmUaiVFXQr3UQo+F5rW3UILHJPRovC+zUtNbsgW31cnis3HI vMULyyHLpmLex4O2QXLJ90KOOoXtKatXNUNE4NA9ainmKUoUpqjvLod78QYoQUcOCTrx79 AuWSRuqClGEcznhGIjezphV7mjK6RHsD5uX0gJh0jDSB76WXyitDgew4GRln3cvaWaWQVz uuqWF4XUGlxmV5RhchHzZydntB5QybEl9y5P1684XJBLl3t77mXys4B1/2wo4pFM5kshKh OaoW34IDx9hxJafy5Zs+7kRNYcJpdUqHOWRe98k/DjAg1vrFNrQ60qlyRwOKaA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740777485; a=rsa-sha256; cv=none; b=Ko1W+tzNWB9qj9X3Wx3ENwATxpgrYLJRO/FVdSNTBKzHKIolskhteLPugSgKG08XNxojeM 2OVHjBYpQ+ntE6tb5vOiHqOPU2cQiQku57tSfFck8R2DHqgH7ZEprD/61Hmu3NsApANJK8 IJ6hHPnLyECoCwwV4iRw/UKx0+R+ps1ddA6kefkdy+3u8m0FpVveYzPMjZVntxw/lEefBY tE4QubMJbyqsJ/348OYx5BuTKIybC8A88boumDr75cEuS6EqYpxQg209BagikWcVjyWS0i 4lhDyl2FQ2UAZCKDhuHjcKCyDM7CueK55RBzVO+IsD27hVI4hu40dmhFpqByBA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740777485; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qxbNeZgT9e7wM0PR7s5Mvqf9VrZdmMFn5IofbMz5Mdk=; b=Snj4J7MxJrsPvZ2IShn8afPZ83oHQmh77qeK1zwyFXBjrmLnnAiYjoGdPlKwb4etmGa69f pC6XsZiQq45UIglOarIdbTk2gQrI/SwHa30AOw/z4nbSIXe81R9D3iTiQMwNX50hLh7GwP IhxxrN4Ya3jpAcsEwTWm2Q1pfxid2Ly1snqaGCQupp0Jj5cjzWYh9dH4+btjoq8Y5+VhFo Qm19GVfU+v0JjuMjqs9YTDxvKfBxiCUid5RoiAQ+d9Ua9Ux/0PuFFz7XrGlBFXL4Yx3M7H BchcKBjs4XRH2YJ2TV3cav9gemano0f19DSbGwAFfUwkiJa7UoB7Dkhl52Xc3g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z4Lf50Hbqzm78; Fri, 28 Feb 2025 21:18:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51SLI4cP099992; Fri, 28 Feb 2025 21:18:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51SLI4dI099989; Fri, 28 Feb 2025 21:18:04 GMT (envelope-from git) Date: Fri, 28 Feb 2025 21:18:04 GMT Message-Id: <202502282118.51SLI4dI099989@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 337f5e7a44c4 - main - makefs: Compare pointer against NULL, not 0 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 337f5e7a44c4d5ac29e0b0c0fe957bb3b9bae222 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=337f5e7a44c4d5ac29e0b0c0fe957bb3b9bae222 commit 337f5e7a44c4d5ac29e0b0c0fe957bb3b9bae222 Author: Ed Maste AuthorDate: 2025-02-28 21:16:29 +0000 Commit: Ed Maste CommitDate: 2025-02-28 21:17:34 +0000 makefs: Compare pointer against NULL, not 0 Reported by: rpokala Sponsred by: The FreeBSD Foundation Fixes: 35a2e286157a ("makefs: Record inode for all entries in mtree mode") --- usr.sbin/makefs/cd9660/iso9660_rrip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/makefs/cd9660/iso9660_rrip.c b/usr.sbin/makefs/cd9660/iso9660_rrip.c index e037f1db175f..1b8ce42da4c0 100644 --- a/usr.sbin/makefs/cd9660/iso9660_rrip.c +++ b/usr.sbin/makefs/cd9660/iso9660_rrip.c @@ -667,7 +667,7 @@ inode_map(iso9660_disk *diskStructure, uint64_t in) if (in != 0) { node = RB_FIND(inode_map_tree, &(diskStructure->rr_inode_map), &lookup); - if (node != 0) + if (node != NULL) return (node->value); } From nobody Fri Feb 28 22:34:34 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z4NLL5kjdz59PQS; Fri, 28 Feb 2025 22:34:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z4NLL3SLzz3ydq; Fri, 28 Feb 2025 22:34:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740782074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RA8bZszRB2Iazse0i1CafWLTmXU+Tr7GsDbCoHLeCBQ=; b=c2rLeSSefJApnY3DkR+7x5cHWarr7dqSvbiyBeXj577U/yGvvUlU4FpHA+K7gC7WoJp6IG 50gWGCZTCbqOZ0afPxOlwnEmFe8FPexAA1l89CD+O4mDn4twkI1ehAj8hfnBW/wG6Kua6X cGyhAQIV/5DgsTiUW6o/Os3ZiGbS5iThr1mbypkfoB5zuFEZAeMyRDfETk6rTNqe824fI7 EYrigSSMNxcIXVCxcz9lR7aSLSL06iDKoHtXncI/4ueUcL49qgVmaRHj2HIKCBTFH2CuY6 62scN7wqe5IJrSs1/r25u7f6ulIWekMl1jXw1K15InwXuSdAQxQK14/x6+d+Cw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740782074; a=rsa-sha256; cv=none; b=Kdl97c7U/VeTRA0485OzKZEzP9KNcvkCz1pBgv68q7go9MIm4rsLQ5zUJBTX4+jeCwmeDo cxPQE4cwfeBv3F2KoW1AJGl5wLTf4wupDEd0gRIsnfiS2nKXIH+a46NnSmbE+/A59l8r0k /dkj9A5CV1rKrj1XPF4/Z/oV85P/r1eFoUkaEOPieWsTJ9Xtv2y0jP/a7Dm+E5wzpffCGT pk2ehMu8zIlLqOklJ3pTu6gp4cw8UosSVkciKST6PUOnyvzNQ6iFB22W7OwC0aODKYU4RO Ed8xiaHFzbfg3+02B5gPRPlDBIvzopBit5rTruDWbyzZO6R4eAAOEVAyHqEYpQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740782074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RA8bZszRB2Iazse0i1CafWLTmXU+Tr7GsDbCoHLeCBQ=; b=oNoSrv1vVc+ET4isd7rN3BEGdgQyC0CWTmoMrxaeBJRBVDgGxj0LrpqLHuvFJfWuhGLIbI x6GXfxcMUXeLhwQN38Wn3U56WDHdLwpVaUCbf1D15viMXcdDVS8JCMiT3VKWW4jqIKLCmr FPRnBJah6wOjD82dEVe4JnNLpMlcQ1+RcK+UBEFxZV4TOp3gW7mCg0Vq97QpWZV+rf+a3R X49gJz6WbQQcrRshW0zL5u0Ax2/5tqcC5aDr69/9ISkcwa4q5FTK989cFDwZe2rz5mE1DJ hNYAomNOraFRUiyfCl7gzwbDQKQLJRJE16ZvPO1wPX1HxDZ205jP1psEMZxh6A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z4NLL2nD1znVf; Fri, 28 Feb 2025 22:34:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51SMYYXr048132; Fri, 28 Feb 2025 22:34:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51SMYYHK048129; Fri, 28 Feb 2025 22:34:34 GMT (envelope-from git) Date: Fri, 28 Feb 2025 22:34:34 GMT Message-Id: <202502282234.51SMYYHK048129@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dave Cottlehuber Subject: git: 457d745d90a6 - main - release: ensure default sudo flavor is selected List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dch X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 457d745d90a6b63793c9ca17bcd7ec5ff4cd8b93 Auto-Submitted: auto-generated The branch main has been updated by dch: URL: https://cgit.FreeBSD.org/src/commit/?id=457d745d90a6b63793c9ca17bcd7ec5ff4cd8b93 commit 457d745d90a6b63793c9ca17bcd7ec5ff4cd8b93 Author: Dave Cottlehuber AuthorDate: 2025-02-28 22:27:31 +0000 Commit: Dave Cottlehuber CommitDate: 2025-02-28 22:33:46 +0000 release: ensure default sudo flavor is selected pkg behaviour selects the non-default flavour, this trims 0,5GiB per cloudware image, by being explicit. Approved by: cperciva Differential Revision: https://reviews.freebsd.org/D48599 Sponsored by: SkunkWerks, GmbH PR: 284278 MFC after: 10 days --- release/scripts/pkg-stage.sh | 2 +- release/tools/oracle.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/release/scripts/pkg-stage.sh b/release/scripts/pkg-stage.sh index 495c328e4724..58b6d25fcccf 100755 --- a/release/scripts/pkg-stage.sh +++ b/release/scripts/pkg-stage.sh @@ -23,7 +23,7 @@ net/wifi-firmware-kmod@release ports-mgmt/pkg shells/bash shells/zsh -security/sudo +security/sudo@default sysutils/screen sysutils/seatd sysutils/tmux diff --git a/release/tools/oracle.conf b/release/tools/oracle.conf index 08a9a3a372b0..8a4206c05623 100644 --- a/release/tools/oracle.conf +++ b/release/tools/oracle.conf @@ -19,7 +19,7 @@ export VM_EXTRA_PACKAGES=" net/rsync panicmail security/ca_root_nss - security/sudo + security/sudo@default sysutils/firstboot-freebsd-update sysutils/firstboot-pkgs sysutils/panicmail From nobody Fri Feb 28 23:46:33 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z4PxP5dpyz59WGk; Fri, 28 Feb 2025 23:46:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z4PxP51Kqz45NL; Fri, 28 Feb 2025 23:46:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740786393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UqHv+VR6W1DZ29G22niNQa2uT5+SYyVMI0HNDdvTK9U=; b=nUvGINFgqEZuMeJgycrBAxXmjbABnMF/6QQ6FzaqBv3ePX+wMRRcPo8G7djHfKctLyuBnh cV7z4orRvkCLRGjOBlPShRm0vm3gPuEb9gl3wxbEUy955A+K2fdcgUTU678+p0/umtrLKM rE1fheF4HmxV2wKdmxANrXdLJdXQpgyuU+Ot2TsoIuXYBzLUUOSWVA+gqPiIpyZxtmm3e/ qBd1QM2W1r/9BLfURMcZqjY7H1dMMXCDjv8Q5e8GfHcbqeq7C3AH9XEhmDcD83wI2XfU6T C0vA5pUFGan8OQLhBiv7Js6UL9sY1b271Zvk0VQX5ctOY4mumjY6GuP1wuM9IQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740786393; a=rsa-sha256; cv=none; b=CxL5rBJfMGpjG8Ol67Y80axZ6WM7s6O6HIP2kjTGIRPr3bwxYtdrBFIQf0jn9qM7XPy8ri zCZjV4SGcJtsG8ykpSqwM/3RbrctYlehQ071Eg+pPm7nTq6HAnRX/f9vKNtywnrvkDgn1J b/XdL8toe5/nUzrYua7WLWqB65tLcYht2K9SivoOE+jpnr5l7ajeDnqddKUbzcuQ8nuYfZ /nDS8kiqzv1VVjlK1GYB5nadk4BlS9CCvsxp0ws7zLxqhpIfihLPT5s+xiXgN6vlywSnxD HfTRYpJISetebRK2yOh1UkH/L7hpeOaflz0CvWwWEYteyyeZE3TGlDAPSeIG3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740786393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UqHv+VR6W1DZ29G22niNQa2uT5+SYyVMI0HNDdvTK9U=; b=B+4VCOYBCsx6Tw/gZBD0lZDlKP+2X25AXKApV+kTjDMtHdHVsFGAEpSpFLOC7h37FH7NVN 7HGi3YQ2N+3H12QiXN8ouqvpxePCWjBCyAwdxmY+aORto7TDc98Rkm8YabQQey4uAPvYWG dO919qNw8PgoXqTxM/ysiC+ljx6oTilSbh/vLnfMA/i+JEIzh/JDKmhIUsDxugAt2Afyp2 pJrsyVgKu9VVluRMWleAHAKmcHkvJ4j3I0tXok5ilg1ElBNWKgjfAOb1GclONMna12exoV ZXR5T8Q1hRYwOvs7OoBHc0vW6EK96UbSQScOVoVdPJIITXiOmjfFyud8MDGzgQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z4PxP4JZ3zqc9; Fri, 28 Feb 2025 23:46:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51SNkXDn079088; Fri, 28 Feb 2025 23:46:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51SNkXiY079084; Fri, 28 Feb 2025 23:46:33 GMT (envelope-from git) Date: Fri, 28 Feb 2025 23:46:33 GMT Message-Id: <202502282346.51SNkXiY079084@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: a80bbc4e9597 - main - netlink: refuse a send(2) that is larger than socket buffer List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a80bbc4e9597530b91735ebf366a2a62dc27a8d8 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=a80bbc4e9597530b91735ebf366a2a62dc27a8d8 commit a80bbc4e9597530b91735ebf366a2a62dc27a8d8 Author: Gleb Smirnoff AuthorDate: 2025-02-28 23:39:15 +0000 Commit: Gleb Smirnoff CommitDate: 2025-02-28 23:39:15 +0000 netlink: refuse a send(2) that is larger than socket buffer The Netlink RFC doesn't say that explicitly, but general discussion seems to state that a single netlink message shall be delivered in a single send(2) to the socket. So, if a single message doesn't fit into buffer it is clear EMSGSIZE. The RFC is unclear if application is allowed to send several smaller messages with a single syscall potentially overflowing the buffer and whether kernel should accept any of them. At the moment, no legit application does that. So, decision was taken not to overload nl_sosend() with a message parsing logic and deny any oversized write. Reported-by: syzbot+eb5db60d36b005dbccf5@syzkaller.appspotmail.com --- sys/netlink/netlink_domain.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/netlink/netlink_domain.c b/sys/netlink/netlink_domain.c index a7ceae687d86..74b46114716e 100644 --- a/sys/netlink/netlink_domain.c +++ b/sys/netlink/netlink_domain.c @@ -568,6 +568,9 @@ nl_sosend(struct socket *so, struct sockaddr *addr, struct uio *uio, if (__predict_false(uio->uio_resid < sizeof(struct nlmsghdr))) return (ENOBUFS); /* XXXGL: any better error? */ + if (__predict_false(uio->uio_resid > sb->sb_hiwat)) + return (EMSGSIZE); + error = SOCK_IO_SEND_LOCK(so, SBLOCKWAIT(flags)); if (error) return (error); From nobody Sat Mar 1 00:12:12 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z4QW13NY0z5Vbkn; Sat, 01 Mar 2025 00:12:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z4QW10syvz49yd; Sat, 01 Mar 2025 00:12:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740787933; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Zmt1dEUIa3PW3aGWZYKFGzGrScVRKADL3rdFnIyFzzg=; b=iSNhNEtJq1SkKCifpTUpZB3IuxwbZBs7ouL+zIaj64Hozp7hJf3LUPOEQV6S9LAwdFFF2O tCf3Mf4m3zImD6HO84qPUEKIn7C9vqY+59YsImv3tQdPS8qwMMi+XMU1zRmcBO63v6jt2a fGOa57+cLDpnvb/Uhbpfp7oYlKF8HAeNqHYZWnO18W2nU+JXyBanPMoF48pgj7m7zIOa+R y1i3NEL2BUXegJmlF0eh1MfMW2UrytMyTV/QSBmJhXKzTYg64AC2tzoKwz/ObMMdrXk3h6 D8f97atKBZCa4JFq2EeSOwvyYQS8Lw8KmV25R+xmYzJm7jxHBDtD85bWWVwHNQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740787933; a=rsa-sha256; cv=none; b=TdUsn1X4Wm65NBbhmQxNLmbeKppAVPv0HNyKjBJHuMPrDKjxe5jW302a9pKd2neu37kUaH bkgIvlj/M244gPRMFzZ7PogQ+ylkYXN+mmEPrshbtPlr1GZESWqggO3TwiZ4CCNLe/GqE3 OPdJeO0XEuwfWEoSgR9i25rwPmbJRhX3sIp7+7T4H7sYpxp8tf1rWkRtEpm0ZMutTbvuQY qLK2BJmMEXOLM9V/hGHd13KOgfMvpPN7sAznm0Ek4yZ9Pf/ohWmbO4ZQFvVXRIT9IaWIvF XpquVonUGsIPrjofVaj8eipABI036RGwYotNnTYtnai8+yVkFQcMK7RDkrhjkA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740787933; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Zmt1dEUIa3PW3aGWZYKFGzGrScVRKADL3rdFnIyFzzg=; b=FbwD5PlMlhpM24O3DIZWt2WsQnjQaX9/hsO5h7Cj0b2xh3OqTOnSRmF76XbmQtGqZxJCeX ue0uG8PZfiqIp5nQ+aTXgk4Dt+Lbi1uJI1Zv+D4eBCeLoD10lPXhpEhaIzRfjLccAxv64d ra1II1Q1153KMJaRbbQRUUbDxFUyiGlqikGjlkhgIGmRO0qGWrFSHLUr+DWA7+ewMmKBZo qZeemEN5pNU6I+ep4f2/a2jIafmMqg5emen3R+EN6wlb4l7f7bAqntIhUTCpCmzbuW/VOx EEFRtkIUUPDU1iSBCPAp/81nwynriDPs7OHh+cEG/80JOnGoiRV1IMwYxdZ1Ow== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z4QW10NmFzrc2; Sat, 01 Mar 2025 00:12:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5210CCTU033051; Sat, 1 Mar 2025 00:12:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5210CCBG033048; Sat, 1 Mar 2025 00:12:12 GMT (envelope-from git) Date: Sat, 1 Mar 2025 00:12:12 GMT Message-Id: <202503010012.5210CCBG033048@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: e2dd73cf45a6 - main - open.2: minor editing List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e2dd73cf45a6a8d97131bdbe512ab1ff63121d85 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e2dd73cf45a6a8d97131bdbe512ab1ff63121d85 commit e2dd73cf45a6a8d97131bdbe512ab1ff63121d85 Author: Konstantin Belousov AuthorDate: 2025-02-28 23:40:32 +0000 Commit: Konstantin Belousov CommitDate: 2025-03-01 00:12:07 +0000 open.2: minor editing Remove unneeded braces. Bump Dd. Suggested and reviewed by: maxim Sponsored by: The FreeBSD Foundation MFC after: 1 week --- lib/libsys/open.2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libsys/open.2 b/lib/libsys/open.2 index 699446b6c7c2..d8540637b690 100644 --- a/lib/libsys/open.2 +++ b/lib/libsys/open.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 3, 2025 +.Dd February 28, 2025 .Dt OPEN 2 .Os .Sh NAME @@ -254,12 +254,12 @@ for reading, writing, or for both. The open' request for a lock on the file, created with .Dv O_CREAT , will never fail -(provided that the underlying file system supports locking; +provided that the underlying file system supports locking; see also .Dv O_SHLOCK and .Dv O_EXLOCK -below). +below. .Pp If .Dv O_EXCL From nobody Sat Mar 1 02:34:35 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z4TgT5vmkz5hjnn; Sat, 01 Mar 2025 02:34:45 +0000 (UTC) (envelope-from kevlo@freebsd.org) Received: from mail.kevlo.org (ns.kevlo.org [220.134.220.36]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z4TgS3KDvz3Zs7; Sat, 01 Mar 2025 02:34:44 +0000 (UTC) (envelope-from kevlo@freebsd.org) Authentication-Results: mx1.freebsd.org; none Received: from localhost (ns.kevlo.org [local]) by ns.kevlo.org (OpenSMTPD) with ESMTPA id 498fd117; Sat, 1 Mar 2025 10:34:35 +0800 (CST) Date: Sat, 1 Mar 2025 10:34:35 +0800 From: Kevin Lo To: Kevin Bowling Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 5c7087c349fc - main - ixgbe: Fix a logic error in ixgbe_read_mailbox_vf() Reviewed by: kbowling Differential Revision: https://reviews.freebsd.org/D49156 Message-ID: References: <202502280813.51S8DQiZ037985@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:3462, ipnet:220.134.0.0/16, country:TW] X-Rspamd-Queue-Id: 4Z4TgS3KDvz3Zs7 X-Spamd-Bar: ---- On Fri, Feb 28, 2025 at 01:54:08AM -0700, Kevin Bowling wrote: > > MFC? Done. Thanks for reminding me. > On Fri, Feb 28, 2025 at 1:13???AM Kevin Lo wrote: > > > > The branch main has been updated by kevlo: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=5c7087c349fc1d826807aa1a11912c9e774e3321 > > > > commit 5c7087c349fc1d826807aa1a11912c9e774e3321 > > Author: Kevin Lo > > AuthorDate: 2025-02-28 08:12:00 +0000 > > Commit: Kevin Lo > > CommitDate: 2025-02-28 08:12:00 +0000 > > > > ixgbe: Fix a logic error in ixgbe_read_mailbox_vf() > > Reviewed by: kbowling > > Differential Revision: https://reviews.freebsd.org/D49156 > > --- > > sys/dev/ixgbe/ixgbe_mbx.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/sys/dev/ixgbe/ixgbe_mbx.c b/sys/dev/ixgbe/ixgbe_mbx.c > > index 5f1f64e02b82..0b866e7a39af 100644 > > --- a/sys/dev/ixgbe/ixgbe_mbx.c > > +++ b/sys/dev/ixgbe/ixgbe_mbx.c > > @@ -297,7 +297,7 @@ static u32 ixgbe_read_mailbox_vf(struct ixgbe_hw *hw) > > u32 vf_mailbox = IXGBE_READ_REG(hw, IXGBE_VFMAILBOX); > > > > vf_mailbox |= hw->mbx.vf_mailbox; > > - hw->mbx.vf_mailbox |= vf_mailbox % IXGBE_VFMAILBOX_R2C_BITS; > > + hw->mbx.vf_mailbox |= vf_mailbox & IXGBE_VFMAILBOX_R2C_BITS; > > > > return vf_mailbox; > > } From nobody Sat Mar 1 04:14:36 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z4Wth2kxbz5htbk; Sat, 01 Mar 2025 04:14: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z4Wth21bFz3mJG; Sat, 01 Mar 2025 04:14:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740802476; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Itm+c4MAo2ES0EUXeoFMgQvxMGReYgpdUnCYAi3oLcE=; b=ZTTIuVYXy1uD9Y5b4DZgZsGfDlPbCDUVRmCVgRSCOs7YUiwdBBzZt2mLo0ToPO1nCojrtU 6HayPrK77EYg3QofPSx1qdtlwJTu49mS0ZX/ruUU4qqQr13+UiHHFghJPt0oSg/GRjR83/ /pnsBFk09mKlIAmKRLqWkqCS8A7pkOqwBQPyVA4xlKnT3z8z0YIJlqE0uO9OfjvqG2ocOT I/etdipzaCX1TE4nzLnBu5hqmG5iRGf/oyyZUEmRq0HwhqaTsEnyVLskgr3mqgFsNtVFto f/LSLVOTzu16arvaOhz5PFb4TmgIyRcNYG+6pgke4z6DuuPZUiuPJfmInK9y2A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740802476; a=rsa-sha256; cv=none; b=lxiuM0y/TaVr4psJUuCfo3aEBVmZls5HeIVMYO+HzawO5TUkXsPPimDri5leilDbSdN9vt j4+aTM5vSE6NZOsRG2Smp31rl3MVV0VCU68nYhw7kj92U/3AeqOR43GeVcL3mZOBpUKcUp EhnoA2zoFuHjgEQ87owjlTlGf8450qHVvI3a7IDb3rnR4pdB5v4Nb3EMshMjPt/EJdzm08 GPgy8UlwqpVHl78xomMTGDgwdKTRiZEJ6/cS3T5QJ345MZzuE0TlLuamfNABUiMtgnKEVz g8kTpaaiOV/c5tlC89GiIBFfB0fa3P9bGyUk+fapcjubdOWRlKWccTL01K9JRQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740802476; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Itm+c4MAo2ES0EUXeoFMgQvxMGReYgpdUnCYAi3oLcE=; b=BgRbVT7RB1vGz1fXXLoFZt6/hpFIXRR2vFRYnqo92DKJ7iWeUZ4k5/uJZ6CpHNKZLC7JZl R8cidGd+qb4LR7d9TfFPIUI1u1XpvD4SYUz4gip/SwGMoDCwJp6gQZxYEIV79hn+L7xODZ doRGaNABToe4PK8HiJ1G04AYRXRMmsIw9A2f3wQ8FXrUjayI071VjMtzxCVs4462PcjgwY +fZA99WRB8o6ZUSY+cl6K3IGtsihGN/De4V/8xC2o1NXI5umbcHfescq6h/MEL3/c/wfQk 7rEkMxCjTmc6PJSz9k+C7BWZ7gsRUFah3cn76pYuz1oN3+jrHkLQKDBnW3U3tQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z4Wth1Vyfz10Kx; Sat, 01 Mar 2025 04:14:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5214EaH7083299; Sat, 1 Mar 2025 04:14:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5214EaxT083297; Sat, 1 Mar 2025 04:14:36 GMT (envelope-from git) Date: Sat, 1 Mar 2025 04:14:36 GMT Message-Id: <202503010414.5214EaxT083297@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eric Joyner Subject: git: 7ee310c80ea7 - main - igc(4): Fix attach for I226-K and LMVP devices List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7ee310c80ea7b336972f53cc48b8c3d03029941e Auto-Submitted: auto-generated The branch main has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=7ee310c80ea7b336972f53cc48b8c3d03029941e commit 7ee310c80ea7b336972f53cc48b8c3d03029941e Author: Eric Joyner AuthorDate: 2025-02-26 17:19:38 +0000 Commit: Eric Joyner CommitDate: 2025-02-26 18:15:38 +0000 igc(4): Fix attach for I226-K and LMVP devices Summary: The device IDs for these were in the driver's list of PCI ids to attach to, but igc_set_mac_type() had never been setup to set the correct mac type for these devices. Fix this by adding these IDs to the switch block in order for them to be recognized by the driver instead of returning an error. This fixes the igc(4) attach for the I226-K LOM on the ASRock Z790 PG-ITX/TB4 motherboard, allowing it to be recognized and used. Signed-off-by: Eric Joyner Reviewed by: kbowling@ MFC after: 3 days Relnotes: yes Differential Revision: https://reviews.freebsd.org/D49147 --- sys/dev/igc/igc_api.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/igc/igc_api.c b/sys/dev/igc/igc_api.c index 9e91e7a4c73f..da499274fca4 100644 --- a/sys/dev/igc/igc_api.c +++ b/sys/dev/igc/igc_api.c @@ -109,6 +109,8 @@ s32 igc_set_mac_type(struct igc_hw *hw) case IGC_DEV_ID_I220_V: case IGC_DEV_ID_I225_K2: case IGC_DEV_ID_I225_LMVP: + case IGC_DEV_ID_I226_K: + case IGC_DEV_ID_I226_LMVP: case IGC_DEV_ID_I225_IT: case IGC_DEV_ID_I226_LM: case IGC_DEV_ID_I226_V: From nobody Sat Mar 1 04:38:41 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z4XQk39Lhz5hwR2 for ; Sat, 01 Mar 2025 04:38:54 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) (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 "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z4XQk0vXQz3r56 for ; Sat, 01 Mar 2025 04:38:54 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-qt1-x833.google.com with SMTP id d75a77b69052e-4720cfc35e9so44237121cf.2 for ; Fri, 28 Feb 2025 20:38:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; t=1740803933; x=1741408733; darn=freebsd.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dhZQYuVAQT74LiW0PpGG4ltBoR2Yae9snPmUrkfZZkQ=; b=J1EXqLsSsatj0VU2zC89Q6GKn7Sv1PV6W3GAmkTUlkq+RweMIpPLff9HQ4MqiNVmny wtgrhSEX1nL42MLCsTPmrx4dLHYpV6Gw+vWwwtnL2t5hvSGXUX7KAFT3E+S0nBaWMS4o V1LCv3qSAxT5SBpsiIcH/lnV9jWbS5Zidze+A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740803933; x=1741408733; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dhZQYuVAQT74LiW0PpGG4ltBoR2Yae9snPmUrkfZZkQ=; b=lwmewRdEiug00jMIJy5KoJAMk73ydU8wAvvwoNG1vVgnpZxcm54GDd3Tu+l1frcgjn tWJTuhbSp4XbaJn3BceeHhU+3hj8tehz8dKm+P1CvFfoCeN60CnAiZmYFVPNwqhbGHHH 9KcJLl3I9jQMhDiPrpax7E3Sk4tgdIPFBl+UJfNHFhFSMNxZsVYi5CE3qWOyduPyIso7 a4aC34plJE2z8BKtJQ36Sp2KK4nrf4pAp2gNDdgs/NazYMd0yV967SGU0ibGdjI9BYvB Aqq3B+Fxg+tr8LurKoQD8x7z6jxzYRlxLxugRqB2VtxAHziWHQWT5e0j8Gm+RCEQuMMr pPAA== X-Forwarded-Encrypted: i=1; AJvYcCWaHffjDdyb0BMsEcDhh8LUb/c9nwWstEAznCsg2yrVFFjh2lXO0G5Du1JDz8FWxdPuY9rjf5zsapUolNvYKJnnKbljPw==@freebsd.org X-Gm-Message-State: AOJu0YyzwVs0tFPNYHAgk8K3nG0EWSFzTvJXpGFTjptZ6SGW4MiTkQZo jehiQUAF5lxiv1Ex98WOSYRShr4pofy4RN9QrnaGX31CI08Z1g5R4ukTvQUHbY1sVpfNMTqvviV foWN4VaQsEq63UmEzq1SaM603tNXVArxKl+cc9at9RWDVLJ6rjQ== X-Gm-Gg: ASbGncthxTyM4yFfGqbiSy1iAT9fYCTrdwo1tCGD+QzxCwSquauVjPkY3iuaQ9icgnB r9c/hX19EPF/k0h/CVAqY2LgJ7jH4pzVU8lmvv0qHa4UdPEUG2cj2E7kDi9KuM+Jjpmre0/qdcy bezjsLrIEl6z3W6WdzoUS18C9ZunI= X-Google-Smtp-Source: AGHT+IH46mvBLegAtcZ3O6ovxoS8p5lnbKXbgdqwFHOwl4gWhsfx5W9PDaXnZXUBhaiDbRu6bPmHFxGD++SSepKQZqg= X-Received: by 2002:a05:622a:1115:b0:474:b801:d04f with SMTP id d75a77b69052e-474bc0a1fa3mr80888351cf.25.1740803933065; Fri, 28 Feb 2025 20:38:53 -0800 (PST) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 References: <202502280813.51S8DQiZ037985@gitrepo.freebsd.org> In-Reply-To: From: Kevin Bowling Date: Fri, 28 Feb 2025 21:38:41 -0700 X-Gm-Features: AQ5f1JomG_8ufV-ZZ0SmFl31lzU4rqLPkipIxFJ1Us-1h3tqNMinnnwNeaINv9A Message-ID: Subject: Re: git: 5c7087c349fc - main - ixgbe: Fix a logic error in ixgbe_read_mailbox_vf() Reviewed by: kbowling Differential Revision: https://reviews.freebsd.org/D49156 To: Kevin Lo Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4Z4XQk0vXQz3r56 X-Spamd-Bar: ---- stable/13 needs MFC as well On Fri, Feb 28, 2025 at 7:34=E2=80=AFPM Kevin Lo wrote: > > On Fri, Feb 28, 2025 at 01:54:08AM -0700, Kevin Bowling wrote: > > > > MFC? > > Done. Thanks for reminding me. > > > On Fri, Feb 28, 2025 at 1:13???AM Kevin Lo wrote: > > > > > > The branch main has been updated by kevlo: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D5c7087c349fc1d826807aa= 1a11912c9e774e3321 > > > > > > commit 5c7087c349fc1d826807aa1a11912c9e774e3321 > > > Author: Kevin Lo > > > AuthorDate: 2025-02-28 08:12:00 +0000 > > > Commit: Kevin Lo > > > CommitDate: 2025-02-28 08:12:00 +0000 > > > > > > ixgbe: Fix a logic error in ixgbe_read_mailbox_vf() > > > Reviewed by: kbowling > > > Differential Revision: https://reviews.freebsd.org/D49156 > > > --- > > > sys/dev/ixgbe/ixgbe_mbx.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/sys/dev/ixgbe/ixgbe_mbx.c b/sys/dev/ixgbe/ixgbe_mbx.c > > > index 5f1f64e02b82..0b866e7a39af 100644 > > > --- a/sys/dev/ixgbe/ixgbe_mbx.c > > > +++ b/sys/dev/ixgbe/ixgbe_mbx.c > > > @@ -297,7 +297,7 @@ static u32 ixgbe_read_mailbox_vf(struct ixgbe_hw = *hw) > > > u32 vf_mailbox =3D IXGBE_READ_REG(hw, IXGBE_VFMAILBOX); > > > > > > vf_mailbox |=3D hw->mbx.vf_mailbox; > > > - hw->mbx.vf_mailbox |=3D vf_mailbox % IXGBE_VFMAILBOX_R2C_BITS= ; > > > + hw->mbx.vf_mailbox |=3D vf_mailbox & IXGBE_VFMAILBOX_R2C_BITS= ; > > > > > > return vf_mailbox; > > > } From nobody Sat Mar 1 13:35:41 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z4mL567WFz5VjRL; Sat, 01 Mar 2025 13:35: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z4mL524NPz3fNH; Sat, 01 Mar 2025 13:35:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740836141; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iEYO6t3Utso/Y5K5ZOoDoJT03gao8Aj/qF3uVSHaEYY=; b=vy7qIoCC+CZs6xQH9izuN4IGOVsNUjsZJ5cWCyMatcS1YfGj2ntsXHWQdyH33TqmAeEEL9 nOsru5VYPayuGHvmz7t0HnpayTxAxMiYM87cCULny6jG/2Voersy09UJR8/lijWWNqnJln teVQ0B76LjdLTTRl7LRSNrPLy9UXKWpR7+SIckOE6EkthSFfePEDl3gEgYEqX0XVs8nzX6 NH+XKLEJaiB0iqMEIeBLb2eqEiwjj+F7DWojyq5dUymZEwcfwZm0Iu4sn1vRuGjDlk2BIU 2BOfhAsLVCIFsYAlyPvmav7IgYBS0eIftABsBaD8VLJAmfc8s13G8l1BZ4VGVA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740836141; a=rsa-sha256; cv=none; b=ZXhWCaM75DAvtOOojiTgvXqn++0MUsR2GRW+gI+3j0ksa5acG0VnZ9UXa4v4q4WYqNccS3 +h3QEzG2u5CpqXSpxrHirgehZMcj521slQe4xzo+a0nHCGhG8gCm2o5PBYvKIGD7cGsKOc sfF8ftp5kMrlSTx9w3Y5kbefyK0YF8KxyvNxx+guPjteo4j8TtzrJHJ4qiIl+QirlZxjao KtG5cFPrcQLNRtBktRUtD8Caf0YxB9VwPqM90UPQHodxuFFLRZxTOzx5ajEEqngC3kxOVk 5Y/6hC+fGKDKUIhOBF2ErFVVeTMiDn/F+b9K2hW1nlU1/3YkhMgclkL/5HQwzQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740836141; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iEYO6t3Utso/Y5K5ZOoDoJT03gao8Aj/qF3uVSHaEYY=; b=TkxgTfwsYESy/7LtS2Q8fXFk+lG9+8Xl25g+xxN75SsLKy24aWvx9ayoxIj1WxbMPaDoI1 2KGYUkQEJ10qYPKWyBAhaB+K3C4W7F7/ViCv04QoMU5prOXBjs4I65f522eCNeBnPN2n16 CYsdsb4n0Xmlu2uPuCoh/U0f4pTb0lPuAbTnPUBym0DJtk/W6BDg9cxA/MBpLMuEyEYfKL ExUFjzZJYzXFBnGdPoh6K1kAvZ8b88ZoWxp2mrJuxieg2wvwBapBwejtXTZykNGDETKeAw YLiJp68jw584R+7cbQAZTiwD221a1UEyBcrSXHp+C25hY0hOi5RyO923DIxVqg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z4mL51Zk6z2pt; Sat, 01 Mar 2025 13:35:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 521DZfkI030948; Sat, 1 Mar 2025 13:35:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 521DZf8X030945; Sat, 1 Mar 2025 13:35:41 GMT (envelope-from git) Date: Sat, 1 Mar 2025 13:35:41 GMT Message-Id: <202503011335.521DZf8X030945@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: a18be39aafc1 - main - makefs: Initialize cd9660 inode map only once List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a18be39aafc1b55fd67603ee6a6d820d0fcd877f Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=a18be39aafc1b55fd67603ee6a6d820d0fcd877f commit a18be39aafc1b55fd67603ee6a6d820d0fcd877f Author: Ed Maste AuthorDate: 2025-03-01 13:30:52 +0000 Commit: Ed Maste CommitDate: 2025-03-01 13:35:15 +0000 makefs: Initialize cd9660 inode map only once Error introduced during a refactoring; cd9660_susp_initialize calls itself recursively. Sponsred by: The FreeBSD Foundation Fixes: 35a2e286157a ("makefs: Record inode for all entries in mtree mode") --- usr.sbin/makefs/cd9660/iso9660_rrip.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/usr.sbin/makefs/cd9660/iso9660_rrip.c b/usr.sbin/makefs/cd9660/iso9660_rrip.c index 1b8ce42da4c0..31c6e38a96fe 100644 --- a/usr.sbin/makefs/cd9660/iso9660_rrip.c +++ b/usr.sbin/makefs/cd9660/iso9660_rrip.c @@ -70,8 +70,10 @@ cd9660_susp_initialize(iso9660_disk *diskStructure, cd9660node *node, if (node->dot_dot_record != 0) TAILQ_INIT(&(node->dot_dot_record->head)); - RB_INIT(&diskStructure->rr_inode_map); - diskStructure->rr_inode_next = 1; + if (diskStructure->rr_inode_next == 0) { + RB_INIT(&diskStructure->rr_inode_map); + diskStructure->rr_inode_next = 1; + } /* SUSP specific entries here */ if ((r = cd9660_susp_initialize_node(diskStructure, node)) < 0) @@ -121,11 +123,15 @@ cd9660_susp_finalize(iso9660_disk *diskStructure, cd9660node *node) if ((r = cd9660_susp_finalize(diskStructure, temp)) < 0) return r; } - RB_FOREACH_SAFE(mapnode, inode_map_tree, - &(diskStructure->rr_inode_map), mapnodetmp) { - RB_REMOVE(inode_map_tree, &(diskStructure->rr_inode_map), - mapnode); - free(mapnode); + + if (diskStructure->rr_inode_next != 0) { + RB_FOREACH_SAFE(mapnode, inode_map_tree, + &(diskStructure->rr_inode_map), mapnodetmp) { + RB_REMOVE(inode_map_tree, + &(diskStructure->rr_inode_map), mapnode); + free(mapnode); + } + diskStructure->rr_inode_next = 0; } return 1; } From nobody Sat Mar 1 21:41:56 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z4z793Wygz5ppMp; Sat, 01 Mar 2025 21:41:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z4z790zZMz3RgY; Sat, 01 Mar 2025 21:41:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740865317; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J0cjA/mOD/DPQ3FQCekvYfCQrx0nLa7iWfXBjelGG4k=; b=B4SEj9imI22gPXM3Z75ZV8qZl8tnLBlZhg7x3Jrkam3WP7cPyk6y21xfImxJU9MHf9HfmB kTq0PPocR2fUHkGgiJFjeVv5Ofk8s7B08LpophyUUdhZvtFpUFe7DhdQBLDlmVSXJGtUc/ lHmPP/HFDdLHSJNDibcDcDbpXvnOs9TQyMHt8o3y03Uz9KFpI6ViPLgoZQKvcl7hpsyt4y f1lb4pT9fcZkgXusCVb7fIAjGM0xRh9OVQljc5JB+mIChop8Q/GovEUYG6JY6MD46jRREp W6yh+Dpd0hgrK3wVEXzQFag3+CXr3gQ2eZRDLWTKWKw/i1NhrogYFnGp9IGu5w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740865317; a=rsa-sha256; cv=none; b=c6B7UI5MiJqIcip1dbGlvJox2/cxqEymwRDXbldFMj4WL767WmPfJRKMHObr8riA7YWVxW Y3iIfewbUZbB5SZaxWMmFWKCMoeX7aawFyn6aoX1s9krtd4MuFGk7gc1w/EZcFNT2aWZyV 0rUdtgX4D/Bwn6D1KMq5ItttJ6xGi4IoNavWF06WTQ/GYtN4gGC+jeh42DGGBHgE122zxb 1P6YkbDeMM1fmid6dHLj9c1rPttkm5AhIW7NfCw/L+vLmWx2k2nWzrRPfByV7ArjTHCfGO SqpYKaRq9yYylPrqXnvAlpbcsCkMmB9WPpfDbK0vG/8aWXYwoUsb3x115xn+tg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740865317; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J0cjA/mOD/DPQ3FQCekvYfCQrx0nLa7iWfXBjelGG4k=; b=Quy62OS2pRG30BRGxs/+RS1gXdwykITAHs32dahQzFcIR2wQTfbAEIU3KqTLHO9/7C7pGe NhWTKKx8W9FIXvadtq+fVFfmZm+gvt/i7Uqa8xg8P3xCFLunGJzHyYJJ+XflojRcWJGmJh 7CX+TMMDnj+MXOd68/XxWFmRYI1UECNtLW4aEjnmQJlfR6MhZIGs2EFFUK9ZYYxmjZW/ws I9BaWK3agvrAwtsTs0cedBTg2/mc8gYg4ek1pVM2u2Nfz9i/Q7IPyOdib9X3HgxPEr7h6e IwsOfdzWE6WSDQNoxy4/HBOemsALL4LYc213bYHxSdmyywSNa8fKBH4dRZBxuQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z4z790M30zYjm; Sat, 01 Mar 2025 21:41:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 521Lfuuv045737; Sat, 1 Mar 2025 21:41:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 521LfuuA045734; Sat, 1 Mar 2025 21:41:56 GMT (envelope-from git) Date: Sat, 1 Mar 2025 21:41:56 GMT Message-Id: <202503012141.521LfuuA045734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: c21c8a10d739 - main - IfAPI: Update ifnet(9) man page List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c21c8a10d7390f59a852b8689f1de951c2e955a5 Auto-Submitted: auto-generated The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=c21c8a10d7390f59a852b8689f1de951c2e955a5 commit c21c8a10d7390f59a852b8689f1de951c2e955a5 Author: Justin Hibbits AuthorDate: 2023-04-13 15:27:36 +0000 Commit: Justin Hibbits CommitDate: 2025-03-01 21:40:35 +0000 IfAPI: Update ifnet(9) man page Add starting documentation of the IfAPI to the ifnet(9) page. This replaces the existing struct ifnet documentation, since it's to be treated as opaque now. Reviewed by: #manpages, adrian, ziaee Differential Revision: https://reviews.freebsd.org/D47931 --- share/man/man9/Makefile | 3 + share/man/man9/ifnet.9 | 599 ++++++++++++++++++++++++++++-------------------- 2 files changed, 351 insertions(+), 251 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index ed9f2a9b9ede..8a3c36b0f8aa 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1373,6 +1373,9 @@ MLINKS+=ifnet.9 if_addmulti.9 \ ifnet.9 ifqueue.9 \ ifnet.9 ifunit.9 \ ifnet.9 ifunit_ref.9 +# IfAPI +MLINKS+=ifnet.9 ifapi.9 + MLINKS+=insmntque.9 insmntque1.9 MLINKS+=intr_event.9 intr_event_add_handler.9 \ intr_event.9 intr_event_create.9 \ diff --git a/share/man/man9/ifnet.9 b/share/man/man9/ifnet.9 index 69804a754b3a..3c45e4f29e2d 100644 --- a/share/man/man9/ifnet.9 +++ b/share/man/man9/ifnet.9 @@ -26,10 +26,11 @@ .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd Nov 12, 2024 +.Dd December 10, 2024 .Dt IFNET 9 .Os .Sh NAME +.Nm if_t , .Nm ifnet , .Nm ifaddr , .Nm ifqueue , @@ -44,34 +45,34 @@ .In net/if_types.h .\" .Ss "Interface Manipulation Functions" -.Ft "struct ifnet *" +.Ft "if_t" .Fn if_alloc "u_char type" -.Ft "struct ifnet *" +.Ft "if_t" .Fn if_alloc_dev "u_char type" "device_t dev" -.Ft "struct ifnet *" +.Ft "if_t" .Fn if_alloc_domain "u_char type" "int numa_domain" .Ft void -.Fn if_attach "struct ifnet *ifp" +.Fn if_attach "if_t ifp" .Ft void -.Fn if_detach "struct ifnet *ifp" +.Fn if_detach "if_t ifp" .Ft void -.Fn if_free "struct ifnet *ifp" +.Fn if_free "if_t ifp" .Ft void -.Fn if_free_type "struct ifnet *ifp" "u_char type" +.Fn if_free_type "if_t ifp" "u_char type" .Ft void -.Fn if_down "struct ifnet *ifp" +.Fn if_down "if_t ifp" .Ft int .Fn ifioctl "struct socket *so" "u_long cmd" "caddr_t data" "struct thread *td" .Ft int -.Fn ifpromisc "struct ifnet *ifp" "int pswitch" +.Fn ifpromisc "if_t ifp" "int pswitch" .Ft int -.Fn if_allmulti "struct ifnet *ifp" "int amswitch" -.Ft "struct ifnet *" +.Fn if_allmulti "if_t ifp" "int amswitch" +.Ft "if_t" .Fn ifunit "const char *name" -.Ft "struct ifnet *" +.Ft "if_t" .Fn ifunit_ref "const char *name" .Ft void -.Fn if_up "struct ifnet *ifp" +.Fn if_up "if_t ifp" .\" .Ss "Interface Address Functions" .Ft "struct ifaddr *" @@ -81,7 +82,7 @@ .Ft "struct ifaddr *" .Fn ifa_ifwithnet "struct sockaddr *addr" "int ignore_ptp" "int fib" .Ft "struct ifaddr *" -.Fn ifaof_ifpforaddr "struct sockaddr *addr" "struct ifnet *ifp" +.Fn ifaof_ifpforaddr "struct sockaddr *addr" "if_t ifp" .Ft void .Fn ifa_ref "struct ifaddr *ifa" .Ft void @@ -89,35 +90,221 @@ .\" .Ss "Interface Multicast Address Functions" .Ft int -.Fn if_addmulti "struct ifnet *ifp" "struct sockaddr *sa" "struct ifmultiaddr **ifmap" +.Fn if_addmulti "if_t ifp" "struct sockaddr *sa" "struct ifmultiaddr **ifmap" .Ft int -.Fn if_delmulti "struct ifnet *ifp" "struct sockaddr *sa" +.Fn if_delmulti "if_t ifp" "struct sockaddr *sa" .Ft "struct ifmultiaddr *" -.Fn if_findmulti "struct ifnet *ifp" "struct sockaddr *sa" +.Fn if_findmulti "if_t ifp" "struct sockaddr *sa" +.Ss "Output queue accessors" +.Fn if_dequeue "if_t ifp" "struct mbuf *m" .Ss "Output queue macros" .Fn IF_DEQUEUE "struct ifqueue *ifq" "struct mbuf *m" .\" +.Ss "if_t accesors" +.Ft uint64_t +.Fn if_setbaudrate "if_t ifp" "uint64_t baudrate" +.Ft uint64_t +.Fn if_getbaudrate "const if_t ifp" +.Ft int +.Fn if_setcapabilities "if_t ifp" "int capabilities" +.Ft int +.Fn if_setcapabilitiesbit "if_t ifp" "int setbit" "int clearbit" +.Ft int +.Fn if_getcapabilities "const if_t ifp" +.Ft int +.Fn if_togglecapenable "if_t ifp" "int togglecap" +.Ft int +.Fn if_setcapenable "if_t ifp" "int capenable" +.Ft int +.Fn if_setcapenablebit "if_t ifp" "int setcap" "int clearcap" +.Ft int +.Fn if_getcapenable "const if_t ifp" +.Ft int +.Fn if_setcapabilities2 "if_t ifp" "int capabilities" +.Ft int +.Fn if_setcapabilities2bit "if_t ifp" "int setbit" "int clearbit" +.Ft int +.Fn if_getcapabilities2 "const if_t ifp" +.Ft int +.Fn if_togglecapenable2 "if_t ifp" "int togglecap" +.Ft int +.Fn if_setcapenable2 "if_t ifp" "int capenable" +.Ft int +.Fn if_setcapenable2bit "if_t ifp" "int setcap" "int clearcap" +.Ft int +.Fn if_getcapenable2 "const if_t ifp" +.Ft int +.Fn if_getdunit "const if_t ifp" +.Ft int +.Fn if_getindex "const if_t ifp" +.Ft int +.Fn if_getidxgen "const if_t ifp" +.Ft const char * +.Fn if_getdname "const if_t ifp" +.Ft void +.Fn if_setdname "if_t ifp" "const char *name" +.Ft const char * +.Fn if_name "if_t ifp" +.Ft int +.Fn if_setname "if_t ifp" "const char *name" +.Ft void +.Fn if_setdescr "if_t ifp" "char *descrbuf" +.Ft char * +.Fn if_allocdescr "size_t sz" "int malloc_flag" +.Ft void +.Fn if_freedescr "char *descrbuf" +.Ft int +.Fn if_getalloctype "const if_t ifp" +.Ft int +.Fn if_gettype "const if_t ifp" +.Ft int +.Fn if_setdev "if_t ifp" "void *dev" +.Ft int +.Fn if_setdrvflagbits "if_t ifp" "int if_setflags" "int clear_flags" +.Ft int +.Fn if_getdrvflags "const if_t ifp" +.Ft int +.Fn if_setdrvflags "if_t ifp" "int flags" +.Ft int +.Fn if_getlinkstate "if_t ifp" +.Ft int +.Fn if_clearhwassist "if_t ifp" +.Ft int +.Fn if_sethwassistbits "if_t ifp" "int toset" "int toclear" +.Ft int +.Fn if_sethwassist "if_t ifp" "int hwassist_bit" +.Ft int +.Fn if_gethwassist "const if_t ifp" +.Ft int +.Fn if_togglehwassist "if_t ifp" "int toggle_bits" +.Ft int +.Fn if_setsoftc "if_t ifp" "void *softc" +.Ft void * +.Fn if_getsoftc "if_t ifp" +.Ft void +.Fn if_setllsoftc "if_t ifp" "void *softc" +.Ft void * +.Fn if_getllsoftc "if_t ifp" +.Ft u_int +.Fn if_getfib "if_t ifp" +.Ft uint8_t +.Fn if_getaddrlen "if_t ifp" +.Ft int +.Fn if_gethwaddr "const if_t ifp" "struct ifreq *" +.Ft const uint8_t * +.Fn if_getbroadcastaddr "const if_t ifp" +.Ft void +.Fn if_setbroadcastaddr "if_t ifp" "const uint8_t *" +.Ft int +.Fn if_setmtu "if_t ifp" "int mtu" +.Ft int +.Fn if_getmtu "const if_t ifp" +.Ft int +.Fn if_getmtu_family "const if_t ifp" "int family" +.Ft void +.Fn if_notifymtu "if_t ifp" +.Ft int +.Fn if_setflagbits "if_t ifp" "int set" "int clear" +.Ft int +.Fn if_setflags "if_t ifp" "int flags" +.Ft int +.Fn if_getflags "const if_t ifp" +.Ft int +.Fn if_getnumadomain "if_t ifp" +.Ft int +.Fn if_sendq_empty "if_t ifp" +.Ft int +.Fn if_setsendqready "if_t ifp" +.Ft int +.Fn if_setsendqlen "if_t ifp" "int tx_desc_count" +.Ft int +.Fn if_sethwtsomax "if_t ifp" "u_int if_hw_tsomax" +.Ft int +.Fn if_sethwtsomaxsegcount "if_t ifp" "u_int if_hw_tsomaxsegcount" +.Ft int +.Fn if_sethwtsomaxsegsize "if_t ifp" "u_int if_hw_tsomaxsegsize" +.Ft u_int +.Fn if_gethwtsomax "const if_t ifp" +.Ft u_int +.Fn if_gethwtsomaxsegcount "const if_t ifp" +.Ft u_int +.Fn if_gethwtsomaxsegsize "const if_t ifp" +.Ft void +.Fn if_setnetmapadapter "if_t ifp" "struct netmap_adapter *na" +.Ft struct netmap_adapter * +.Fn if_getnetmapadapter "if_t ifp" +.Ft void +.Fn if_input "if_t ifp" "struct mbuf* sendmp" +.Ft int +.Fn if_sendq_prepend "if_t ifp" "struct mbuf *m" +.Ft struct mbuf * +.Fn if_dequeue "if_t ifp" +.Ft int +.Fn if_setifheaderlen "if_t ifp" "int len" +.Ft void +.Fn if_setrcvif "struct mbuf *m" "if_t ifp" +.Ft void +.Fn if_setvtag "struct mbuf *m" "u_int16_t tag" +.Ft u_int16_t +.Fn if_getvtag "struct mbuf *m" +.Ft int +.Fn if_vlantrunkinuse "if_t ifp" +.Ft caddr_t +.Fn if_getlladdr "const if_t ifp" +.Ft struct vnet * +.Fn if_getvnet "const if_t ifp" +.Ft void * +.Fn if_gethandle "u_char" +.Ft void +.Fn if_bpfmtap "if_t ifp" "struct mbuf *m" +.Ft void +.Fn if_etherbpfmtap "if_t ifp" "struct mbuf *m" +.Ft void +.Fn if_vlancap "if_t ifp" +.Ft int +.Fn if_transmit "if_t ifp" "struct mbuf *m" +.Ft void +.Fn if_init "if_t ifp" "void *ctx" +.Ft int +.Fn if_resolvemulti "if_t ifp" "struct sockaddr **" "struct sockaddr *" +.Ft uint64_t +.Fn if_getcounter "if_t ifp" "ift_counter counter" +.Ft struct label * +.Fn if_getmaclabel "if_t ifp" +.Ft void +.Fn if_setmaclabel "if_t ifp" "struct label *label" +.Ft struct bpf_if * +.Fn if_getbpf "if_t ifp" +.Ft uint8_t +.Fn if_getpcp "if_t ifp" +.Ft void * +.Fn if_getl2com "if_t ifp" +.Ft struct ifvlantrunk * +.Fn if_getvlantrunk "if_t ifp" +.Ft bool +.Fn if_altq_is_enabled "if_t ifp" +.\" .Ss "struct ifnet Member Functions" .Ft void -.Fn \*(lp*if_input\*(rp "struct ifnet *ifp" "struct mbuf *m" +.Fn \*(lp*if_input\*(rp "if_t ifp" "struct mbuf *m" .Ft int .Fo \*(lp*if_output\*(rp -.Fa "struct ifnet *ifp" "struct mbuf *m" +.Fa "if_t ifp" "struct mbuf *m" .Fa "const struct sockaddr *dst" "struct route *ro" .Fc .Ft void -.Fn \*(lp*if_start\*(rp "struct ifnet *ifp" +.Fn \*(lp*if_start\*(rp "if_t ifp" .Ft int -.Fn \*(lp*if_transmit\*(rp "struct ifnet *ifp" "struct mbuf *m" +.Fn \*(lp*if_transmit\*(rp "if_t ifp" "struct mbuf *m" .Ft void -.Fn \*(lp*if_qflush\*(rp "struct ifnet *ifp" +.Fn \*(lp*if_qflush\*(rp "if_t ifp" .Ft int -.Fn \*(lp*if_ioctl\*(rp "struct ifnet *ifp" "u_long cmd" "caddr_t data" +.Fn \*(lp*if_ioctl\*(rp "if_t ifp" "u_long cmd" "caddr_t data" .Ft void .Fn \*(lp*if_init\*(rp "void *if_softc" .Ft int .Fo \*(lp*if_resolvemulti\*(rp -.Fa "struct ifnet *ifp" "struct sockaddr **retsa" "struct sockaddr *addr" +.Fa "if_t ifp" "struct sockaddr **retsa" "struct sockaddr *addr" .Fc .Ss "struct ifaddr member function" .Ft void @@ -212,232 +399,98 @@ Interfaces are also associated with an output queue, defined as a .Vt "struct ifqueue" ; this structure is used to hold packets while the interface is in the process of sending another. -.Ss The ifnet Structure -The fields of -.Vt "struct ifnet" +.Ss The ifnet accessors +The accessors for +.Vt "if_t" are as follows: -.Bl -tag -width ".Va if_capabilities" -offset indent -.It Va if_softc -.Pq Vt "void *" -A pointer to the driver's private state block. -(Initialized by driver.) -.It Va if_l2com -.Pq Vt "void *" -A pointer to the common data for the interface's layer 2 protocol. -(Initialized by -.Fn if_alloc . ) -.It Va if_vnet -.Pq Vt "struct vnet *" -A pointer to the virtual network stack instance. -(Initialized by -.Fn if_attach . ) -.It Va if_home_vnet -.Pq Vt "struct vnet *" -A pointer to the parent virtual network stack, where this -.Vt "struct ifnet" -originates from. -(Initialized by -.Fn if_attach . ) -.It Va if_link -.Pq Fn TAILQ_ENTRY ifnet -.Xr queue 3 -macro glue. -.It Va if_xname -.Pq Vt "char *" -The name of the interface, -(e.g., -.Dq Li fxp0 -or -.Dq Li lo0 ) . -(Initialized by driver -(usually via -.Fn if_initname ) . ) -.It Va if_dname -.Pq Vt "const char *" -The name of the driver. -(Initialized by driver -(usually via -.Fn if_initname ) . ) -.It Va if_dunit +.Bl -tag -width indent -offset indent +.It Fn if_getbaudrate Fn if_setbaudrate +.Pq Vt u_long +The line rate of the interface, in bits per second. +.It Fn if_setcapabilities Fn if_setcapabilitiesbit Fn if_getcapabilities +.Pq Vt int +Flags describing the capabilities the interface supports (see below). +.It Fn if_getcapenable Fn if_setcapenable Fn if_setcapenablebit Fn if_togglecapenable +.Pq Vt int +Flags describing the enabled capabilities of the interface (see below). +.It Fn if_getcapabilities2 Fn if_setcapabilities2 Fn if_setcapabilities2bit +.It Fn if_getcapenable2 Fn if_setcapenable2 Fn if_setcapenable2bit Fn if_togglecapenable2 +.It Fn if_getdunit .Pq Vt int A unique number assigned to each interface managed by a particular driver. Drivers may choose to set this to .Dv IF_DUNIT_NONE if a unit number is not associated with the device. -(Initialized by driver -(usually via -.Fn if_initname ) . ) -.It Va if_refcount -.Pq Vt u_int -The reference count. -(Initialized by -.Fn if_alloc . ) -.It Va if_addrhead -.Pq Vt "struct ifaddrhead" -The head of the -.Xr queue 3 -.Li TAILQ -containing the list of addresses assigned to this interface. -.It Va if_pcount -.Pq Vt int -A count of promiscuous listeners on this interface, used to -reference-count the -.Dv IFF_PROMISC -flag. -.It Va if_carp -.Pq Vt "struct carp_if *" -A pointer to the CARP interface structure, -.Xr carp 4 . -(Initialized by the driver-specific -.Fn if_ioctl -routine.) -.It Va if_bpf -.Pq Vt "struct bpf_if *" -Opaque per-interface data for the packet filter, -.Xr bpf 4 . -(Initialized by -.Fn bpf_attach . ) -.It Va if_index +(Initialized by driver, usually via +.Fn if_initname . ) +.It Fn if_getindex .Pq Vt u_short -A unique number assigned to each interface in sequence as it is -attached. +Return the unique number assigned to the device when attached. This number can be used in a .Vt "struct sockaddr_dl" to refer to a particular interface by index (see .Xr link_addr 3 ) . -(Initialized by -.Fn if_alloc . ) -.It Va if_vlantrunk -.Pq Vt struct ifvlantrunk * -A pointer to 802.1Q trunk structure, -.Xr vlan 4 . -(Initialized by the driver-specific -.Fn if_ioctl -routine.) -.It Va if_flags -.Pq Vt int -Flags describing operational parameters of this interface (see below). -(Manipulated by generic code.) -.It Va if_drv_flags -.Pq Vt int -Flags describing operational status of this interface (see below). -(Manipulated by driver.) -.It Va if_capabilities -.Pq Vt int -Flags describing the capabilities the interface supports (see below). -.It Va if_capenable -.Pq Vt int -Flags describing the enabled capabilities of the interface (see below). -.It Va if_linkmib -.Pq Vt "void *" -A pointer to an interface-specific MIB structure exported by -.Xr ifmib 4 . -(Initialized by driver.) -.It Va if_linkmiblen -.Pq Vt size_t -The size of said structure. -(Initialized by driver.) -.It Va if_data -.Pq Vt "struct if_data" -More statistics and information; see -.Sx "The if_data structure" , -below. -(Initialized by driver, manipulated by both driver and generic -code.) -.It Va if_multiaddrs -.Pq Vt struct ifmultihead -The head of the -.Xr queue 3 -.Li TAILQ -containing the list of multicast addresses assigned to this interface. -.It Va if_amcount -.Pq Vt int -A number of multicast requests on this interface, used to -reference-count the -.Dv IFF_ALLMULTI -flag. -.It Va if_addr -.Pq Vt "struct ifaddr *" -A pointer to the link-level interface address. -(Initialized by -.Fn if_alloc . ) -.\" .It Va if_llsoftc -.\" .Pq Vt "void *" -.\" The purpose of the field is unclear. -.It Va if_snd -.Pq Vt "struct ifaltq" -The output queue. -(Manipulated by driver.) -.It Va if_broadcastaddr -.Pq Vt "const u_int8_t *" -A link-level broadcast bytestring for protocols with variable address -length. -.It Va if_bridge -.Pq Vt "void *" -A pointer to the bridge interface structure, -.Xr if_bridge 4 . -(Initialized by the driver-specific -.Fn if_ioctl -routine.) -.It Va if_label -.Pq Vt "struct label *" -A pointer to the MAC Framework label structure, -.Xr mac 4 . -(Initialized by -.Fn if_alloc . ) -.It Va if_afdata -.Pq Vt "void *" -An address family dependent data region. -.It Va if_afdata_initialized -.Pq Vt int -Used to track the current state of address family initialization. -.It Va if_afdata_lock -.Pq Vt "struct rwlock" -An -.Xr rwlock 9 -lock used to protect -.Va if_afdata -internals. -.It Va if_linktask -.Pq Vt "struct task" -A -.Xr taskqueue 9 -task scheduled for link state change events of the interface. -.It Va if_addr_lock -.Pq Vt "struct rwlock" -An -.Xr rwlock 9 -lock used to protect interface-related address lists. -.It Va if_clones -.Pq Fn LIST_ENTRY ifnet -.Xr queue 3 -macro glue for the list of clonable network interfaces. -.It Va if_groups -.Pq Fn TAILQ_HEAD "" "ifg_list" -The head of the -.Xr queue 3 -.Li TAILQ -containing the list of groups per interface. -.It Va if_pf_kif -.Pq Vt "void *" -A pointer to the structure used for interface abstraction by -.Xr pf 4 . -.It Va if_lagg -.Pq Vt "void *" -A pointer to the -.Xr lagg 4 -interface structure. -.It Va if_alloctype -.Pq Vt u_char +This is initialized by +.Fn if_alloc . +.It Fn if_getidxgen +.It Fn if_getdname Fn if_setdname +.Pq Ft "const char *" +The name of the driver. +This is initialized by driver +(usually via +.Fn if_initname ) . +.It Fn if_name Fn if_setname +.Pq Vt "char *" +The name of the interface, +(e.g., +.Ql fxp0 +or +.Dq Li lo0 ) . +This is initialized by driver, usually via +.Fn if_initname . +.It Fn if_getalloctype +.Pq Ft u_char The type of the interface as it was at the time of its allocation. It is used to cache the type passed to .Fn if_alloc , but unlike .Va if_type , it would not be changed by drivers. -.It Va if_numa_domain +.It Fn if_gettype +.It Fn if_setdev +.It Fn if_getdrvflags Fn if_setdrvflags Fn if_setdrvflagbits +.It Fn if_getlinkstate +.It Fn if_clearhwassist Fn if_sethwassistbits +.Fn if_gethwassist Fn if_sethwassist Fn if_togglehwassist +.Pq Vt u_long +A detailed interpretation of the capabilities +to offload computational tasks for +.Em outgoing +packets. +The interface driver must keep this field in accord with +the current value of +.Va if_capenable . +.It Fn if_getsoftc Fn if_setsoftc +.Pq Ft "void *" +A pointer to the driver's private state block. +This is initialized by driver at attach. +.It Fn if_setllsoftc +.It Fn if_getllsoftc +.It Fn if_getfib +.It Fn if_getaddrlen +.It Fn if_gethwaddr +.It Fn if_getbroadcastaddr Fn if_setbroadcastaddr +Access the interface broadcast addess. +.It Fn if_setmtu +.It Fn if_getmtu +Access the interface MTU. +.It Fn if_setflags Fn if_getflags Fn if_setflagbits +.Pq Vt int +Flags describing operational parameters of this interface (see below). +These flags are manipulated by generic code. +.It Fn if_getnumadomain .Pq Vt uint8_t The NUMA domain of the hardware device associated with the interface. This is filled in with a wildcard value unless the kernel is NUMA @@ -446,6 +499,63 @@ using .Fn if_alloc_dev or .Fn if_alloc_domain . +.It Fn if_sendq_empty +.It Fn if_setsendqready +.It Fn if_setsendqlen +.It Fn if_sethwtsomax Fn if_gethwtsomax +.It Fn if_sethwtsomaxsegcount Fn if_gethwtsomaxsegcount +.It Fn if_sethwtsomaxsegsize Fn if_gethwtsomaxsegsize +.It Fn if_setnetmapadapter Fn if_getnetmapadapter +.It Fn if_setifheaderlen +.It Fn if_setrcvif +.It Fn if_setvtag Fn if_getvtag +.It Fn if_vlantrunkinuse +.It Fn if_getlladdr +.It Fn if_getvnet +.Pq Vt "struct vnet *" +A pointer to the virtual network stack instance. +This is initialized by +.Fn if_attach . +.It Fn if_gethandle +.It Fn if_vlancap +.It Fn if_getcounter +.It Fn if_getmaclabel Fn if_setmaclabel +.It Fn if_getbpf +.Pq Ft "struct bpf_if *" +Opaque per-interface data for the packet filter, +.Xr bpf 4 . +This is initialized by +.Fn bpf_attach . +.It Fn if_getpcp +.It Fn if_getl2com +A pointer to the common data for the interface's layer 2 protocol. +This is initialized by +.Fn if_alloc . +.Fn if_getvlantrunk "if_t ifp" +.Pq Ft struct ifvlantrunk * +A pointer to 802.1Q trunk structure, +.Xr vlan 4 . +This is initialized by the driver-specific +.Fn if_ioctl +routine. +.It Fn if_getdrvflags Fn if_setdrvflags Fn if_setdrvflagbits +.Pq Ft int +Flags describing operational status of this interface (see below). +These flags are manipulated by driver. +.It Fn if_addmulti Fn if_delmulti Fn if_findmulti +Add, remove, and find multicast addresses assigned to this interface. +.It Fn if_getifaddr +.Pq Vt "struct ifaddr *" +Get a pointer to the interface's link-level address. +.It Fn if_getbroadcastaddr Fn if_setbroadcastaddr +.Pq Ft "const u_int8_t *" +A link-level broadcast bytestring for protocols with variable address +length. +.It Fn if_getafdata +.Pq Ft "void *" +An address family dependent data region. +.It Fn if_addgroup Fn if_delgroup +Add and delete groups from the interface. .El .Pp References to @@ -611,7 +721,7 @@ This interface is in all-multicasts mode (used by multicast routers). .It Dv IFF_PALLMULTI .Aq D This interface is in the permanently all-multicasts mode (implies -.Dv IFF_ALLMULTI) . +.Dv IFF_ALLMULTI ) . .It Dv IFF_DRV_OACTIVE .Aq D* The interface's hardware output queue (if any) is full; output packets @@ -891,18 +1001,6 @@ link-layer overhead. .It Va ifi_metric .Pq Vt u_long A dimensionless metric interpreted by a user-mode routing process. -.It Va ifi_baudrate -.Pq Vt u_long -The line rate of the interface, in bits per second. -.It Va ifi_hwassist -.Pq Vt u_long -A detailed interpretation of the capabilities -to offload computational tasks for -.Em outgoing -packets. -The interface driver must keep this field in accord with -the current value of -.Va if_capenable . .It Va ifi_epoch .Pq Vt time_t The system uptime when interface was attached or the statistics @@ -961,8 +1059,7 @@ Number of packets received for unknown network-layer protocol. .It Va ifi_lastchange .Pq Vt "struct timeval" The time of the last administrative change to the interface (as required -for -.Tn SNMP ) . +for SNMP ) . .El .Ss Interface Types The header file @@ -997,7 +1094,7 @@ interface Serial Line IP .It Dv IFT_PARA Parallel-port IP -.Pq Dq Tn PLIP +.Pq Dq PLIP .It Dv IFT_ATM Asynchronous Transfer Mode .It Dv IFT_USB @@ -1062,7 +1159,7 @@ is a macro for The network mask for multi-access interfaces, and the confusion generator for point-to-point interfaces. .It Va ifa_ifp -.Pq Vt "struct ifnet *" +.Pq Vt "if_t" A link back to the interface structure. .It Va ifa_link .Pq Fn TAILQ_ENTRY ifaddr @@ -1324,7 +1421,7 @@ and appropriately. .Pp .It Dv SIOCGIFCAPNV -.Xr NV 9 +.Xr nv 9 version of the .Dv SIOCGIFCAP ioctl. @@ -1368,7 +1465,7 @@ non-modifiable capability bit in .Dv if_capabilities . .Pp .It Dv SIOCSIFCAPNV -.Xr NV 9 +.Xr nv 9 version of the .Dv SIOCSIFCAP ioctl. From nobody Sat Mar 1 23:33:12 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z51bX6HGyz59N7w; Sat, 01 Mar 2025 23:33:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z51bX5P7zz3mTl; Sat, 01 Mar 2025 23:33:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740871992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3WNoBHyPYKOkCkyDhGninHUEk2zM+QZ2EvNL94phqq4=; b=C/UyF5LsQZx2rTLTfNaI2aEHwMSakULWL7m1NpO2g41OO4z++9WJxqbHB5h2nZ2Z2w3XlJ bgA3V3dYfFlA9BPQGTI25sZkHdg1MfWOf3CUUi7Yd0i5Sg9mNlhsRwvYY1EObNsRUoBAtI sv1Nl1tWvxB8cRYdTKB4OK3EsFZoy7pLLoX5F5iGswf4wxvGmvpNY43JPFCKwVEhh2PU43 eBbfa1wnMQG/RkablV4QLyNuToSC8uYR3jMfC7SKLDK7ou42G5+98K+ivBH+AKd2wSzn8y UYAUK1PTX7SgH1JI25P3u5fvEPeS36WRMsd8SXNmOFXUSAj8YxYSIZ2YOTw6iQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740871992; a=rsa-sha256; cv=none; b=uWPwzJ9mx1hsneQ5taxR3OqkEIgCLTaYry+Dbqts5B7lXpFKX3f+jHJkDrDbUflR0T7fTu cjUB4PUI2N5RUOotFrYwz9gpfy/cpAOeqRGE3wsjZrHOgmiG1wsyOMpvJzyJnmBS8rEjO4 iN8Me7vY54iytFKY/fXymtZo4iSUFzGIwd0UdJ3s0o/0U01aryyLTQYkOFMij3olEAbNoL LG+97o1nj2XAgf3FCFTfC1txCe3j3GYwqL5cUiy2flXd+Gxbx6LBdUx50ioyYZtzCcJtnO 6vQvFjRWVI9GjHlv0welh3QioIqeyK2EOJhllxKpYwgUCNfQy1lGEVW3wLKGpA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740871992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3WNoBHyPYKOkCkyDhGninHUEk2zM+QZ2EvNL94phqq4=; b=aUU+xeCdm2O3AGT/X1RXEO1+OKlae+anFk6+4ar8wj4ZB2HiRf7Fy65K6R3LAVCQ08BdMY o6QX/H0zirIG/9tLijhycd+vroAIwBb2W4Ljq5h3EhhnIj7CSQqnZIfmHSA+dICSDzFwQx UzUsFa4A9wOsRaskMxBE3ry64bEzlISAJLRbGg/+7bHjw3/hr4kY3GeAS5b3RjLx7rfrH6 vJ/BLUMZ2aLwwZLBE+0mXTv8V9xgLVswooOc/YrAQp1I9I0Aj255T1KGO57YbVjHloAdKS /OSCZt/XFKbyi+MYcfzWy62jD+ipgIXEyOklAroi1Y/GlbSpX8lBXbiHRySY0Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z51bX4mnYzcyK; Sat, 01 Mar 2025 23:33:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 521NXCgD052816; Sat, 1 Mar 2025 23:33:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 521NXC2W052813; Sat, 1 Mar 2025 23:33:12 GMT (envelope-from git) Date: Sat, 1 Mar 2025 23:33:12 GMT Message-Id: <202503012333.521NXC2W052813@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 50ec1e7af002 - main - ath: fix 20MHz HT short-gi logic. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 50ec1e7af002d710eaefa5dd5f581efc20159122 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=50ec1e7af002d710eaefa5dd5f581efc20159122 commit 50ec1e7af002d710eaefa5dd5f581efc20159122 Author: Adrian Chadd AuthorDate: 2025-03-01 22:35:26 +0000 Commit: Adrian Chadd CommitDate: 2025-03-01 23:32:04 +0000 ath: fix 20MHz HT short-gi logic. This was broken in an earlier commit (ca389486a9599768e0ba69dca13c208020623083). PR: kern/285096 Differential Revision: https://reviews.freebsd.org/D49196 Fixes: ca389486a9599768e0ba69dca13c208020623083 Reviewed by: bz --- sys/dev/ath/if_ath_tx_ht.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ath/if_ath_tx_ht.c b/sys/dev/ath/if_ath_tx_ht.c index ac61c7b4cf54..e7ee029fecf0 100644 --- a/sys/dev/ath/if_ath_tx_ht.c +++ b/sys/dev/ath/if_ath_tx_ht.c @@ -301,7 +301,7 @@ ath_tx_rate_fill_rcflags(struct ath_softc *sc, struct ath_buf *bf) rc[i].flags |= ATH_RC_SGI_FLAG; } - if (ni->ni_chw == IEEE80211_STA_RX_BW_40 && + if (ni->ni_chw == IEEE80211_STA_RX_BW_20 && ieee80211_ht_check_tx_shortgi_20(ni) && (bf->bf_flags & ATH_BUF_TOA_PROBE) == 0) { rc[i].flags |= ATH_RC_SGI_FLAG; From nobody Sat Mar 1 23:33:13 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z51bZ30VMz59N3y; Sat, 01 Mar 2025 23:33: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z51bZ0CKVz3mP9; Sat, 01 Mar 2025 23:33:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740871994; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QMLLCKuGteYfLPcbL/bGMY4vfsC0namrxaNGcl2MfCI=; b=X5pBpiFO1v0iBrcndy5P7SzKg1x66sclGVq3qjiLhRwMfTLz82fcltafXfI0AZsPSoEoub mA3HXgO/sxqCfJU1Q/SbOiexiNWNY9KDEWj+uiyWzDULRSh8VLTdhutliuDDAGmJdizcdq mozzedxYJiGbk0wO3CJ9DXwTNZnDlh9WtiugO1HEP9JQssNijb/L6ees6OO4phOysLpIgg wIjQZ8RB5s+jbmpxKzOBccvGyLI6m733VNu+o5JXbQXSCX3HcmsYOzOXFWQlUSbkKV70DT qqi78Bq+eA/16CqM4ELBgIjC9MeeFsw520RCoKvBjPdOXN71CZswWIKkQVP4Zg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740871994; a=rsa-sha256; cv=none; b=dsalzDRACkP9H9aAQDkdJ9ufHQFO+4pxXqbh4C1qKIXA+FLppPafsJl3HUTDjSese0zVxm qqYybXniMcD8c2TIsUAcDHvAqZteA9aYz7PNGknH687ZO2xsrj7RpnlsCgpYO5U449ef1j ihWbxw9F+t5ioLoy6XR+nNMSlUI+t/Z4fxNhAx56cB/cUJIrR84XvuML4fCHKdbUie5Nh+ 99TJ2KRWKRnUgoBPRDYAZpCABAhEZTa5N+sJDYevE/PNKP2YWw7GWA0rWZcjm7bfH1wbGu NcywMf176P3VMK39G5/w3n5W/qjogSje0sD4D0OhmQ5PiqsVXcOxKUyRY1qcIA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740871994; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QMLLCKuGteYfLPcbL/bGMY4vfsC0namrxaNGcl2MfCI=; b=R3RTtDa9dddW0ZWCAFqLZbh0zD8vu4YLF8TKQsjmA82Et1IgOGJvn32wX2Iwuf4alyMVxm 2nVL6EoBB15EkgTzDonKLCLWc2kDi71Cv5tEe6/b7MO08pnPmHQESPZfbHyHkzThu9ZDSU s8U35BXUIYfHidKo608h4dv82Yql5xohMRpQdkZ4YTY/X3Y2axk0hausEQLAqTjeYtlYVB /liTq0E1O7psdxeMrhWVxuWI4sXOdwGdBbLgK5wYXH3DKOmQ9p7BQ7ft64HbbS+pF11Ccj TVVAkHGOCF8Z4T60AZ6Us0xd4EUjU9ey6A8W13s2KHRmRN9ik8p03jqBCoEq1Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z51bY6M2Szd1j; Sat, 01 Mar 2025 23:33:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 521NXDlK052852; Sat, 1 Mar 2025 23:33:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 521NXDtY052849; Sat, 1 Mar 2025 23:33:13 GMT (envelope-from git) Date: Sat, 1 Mar 2025 23:33:13 GMT Message-Id: <202503012333.521NXDtY052849@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 10c633ab1204 - main - ath_rate_sample: fix setting HT rates List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 10c633ab1204e13d6fbad9f0f474229eed5fd280 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=10c633ab1204e13d6fbad9f0f474229eed5fd280 commit 10c633ab1204e13d6fbad9f0f474229eed5fd280 Author: Adrian Chadd AuthorDate: 2025-03-01 22:38:53 +0000 Commit: Adrian Chadd CommitDate: 2025-03-01 23:32:56 +0000 ath_rate_sample: fix setting HT rates ieee80211_node_set_txrate_ht_mcsrate() takes an MCS rate from 0..76, the high bit (IEEE80211_RATE_MCS) must not be set. This is definitely my fault - I likely didn't get to testing this diff when I changed it from ieee80211_node_set_txrate_dot11rate() just before landing. Differential Revision: https://reviews.freebsd.org/D49197 Reviewed by: bz --- sys/dev/ath/ath_rate/sample/sample.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/ath/ath_rate/sample/sample.c b/sys/dev/ath/ath_rate/sample/sample.c index 8fba3c68099f..291d1ec64ed7 100644 --- a/sys/dev/ath/ath_rate/sample/sample.c +++ b/sys/dev/ath/ath_rate/sample/sample.c @@ -857,7 +857,8 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_node *an, */ if (rt->info[best_rix].phy == IEEE80211_T_HT) ieee80211_node_set_txrate_ht_mcsrate( - &an->an_node, MCS(best_rix)); + &an->an_node, + MCS(best_rix) & IEEE80211_RATE_VAL); else ieee80211_node_set_txrate_dot11rate( &an->an_node, From nobody Sun Mar 2 01:25:19 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z544w1m3Kz5Vbh6; Sun, 02 Mar 2025 01:25: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z544w0styz3wHl; Sun, 02 Mar 2025 01:25:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740878720; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7Jsfaqz63nq2A3EjL/6lx0EJd07IZpE33KQ13XEBedY=; b=J5AhZZ4lD3mVlZ2g5IHifFgHWasbSfUaiM/icaGi+cMtqcc+iKna2rj/Bjz6FOt0oAk7YK Oj9XnGHLxye1HFtLJDEr4s7+lh741kIju3eW/vZ3HbFj4pX/KKK2v3V5Vnud0CdFxlNnRf r3KSXje7CHtbM9uJcq1uSwGSksMfAkHfXo1oqpQHTFg17Ngm8/h5wgVtRPYMUgU/7o02xe iM/YbpV1VoDK5n6PjGTa2x9BsRB4IahJo5/6NCuC9sU1WLbZiK+nvbBsonQsEXsGkGWqf2 NCKXHZLh6o+HwM3wyqJJE7K58QrJ6oismPILtBcurpAnCgVIUqOYL2uVMvR/yQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740878720; a=rsa-sha256; cv=none; b=GngDNcIl70ovQoPipj5l1Pg3UMLnfFjUc0jTyeVlR/yDLo6kpj8Qmzuhyuo6SLI51qJ5vf 29lDbgI2H2D+eMf9n/g/rUrgEJWmBeByvwiYKXPTD4nVldwugaz71qhjm0R55RCuj4ulaL fDPHJHVVikHQQikNdkAvqRbm6bwlWWuLvx/glCmzaI2lqzdOfdNHjwh6SMeqQl4Pjds5uY uWV639icVyTpyQpv3kJg0VJd8ylVp9o0QaxB9MJz6JmjSMgc+KPTTa49yFIyQG1rt6fn/1 7BOd/dMXKr+L4iGwGms2JV07VH0EbFaQLG5KOydws3yyIQdSk2KGkzpShfeG9w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740878720; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7Jsfaqz63nq2A3EjL/6lx0EJd07IZpE33KQ13XEBedY=; b=d+PGNl3Sw0yKB/kDjJFZgegc0H47uEJt4m7ecZlcuhLBRdrrb9eROSXzwxFd6iVJBubQx+ aybbxyTt4OpUVeIK2KqiSKyVXabt4mQU1jcDGNi0DggHc8OoF6yLM0CO0YosE/0h0VTbKl A2E4JeacTpSw5Xtj91nhx7PAPXNyblD7KL18onQBflqtE0khWyCeXwdnANBG8ryDPHmUQ4 HJndr4jLq1vKd1SrnKijxm7XNhrRV+9X1u7EDreA7OPuRLLDCPK8Yp3SAcL8neC97vNrvm f/r8kczZ9dP6GayHU0E6xf574IffWnKMS/IPPwNW8S4uaypaSvTl13ZWSqFCVw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z544w0Shlzgt1; Sun, 02 Mar 2025 01:25:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5221PJqJ059149; Sun, 2 Mar 2025 01:25:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5221PJk0059144; Sun, 2 Mar 2025 01:25:19 GMT (envelope-from git) Date: Sun, 2 Mar 2025 01:25:19 GMT Message-Id: <202503020125.5221PJk0059144@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: 43fa7b907e9c - main - amdiommu: add register definitions from IOMMU spec 48882 rev. 3.10 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 43fa7b907e9cc5ce365afd05775349d199fc2eb4 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=43fa7b907e9cc5ce365afd05775349d199fc2eb4 commit 43fa7b907e9cc5ce365afd05775349d199fc2eb4 Author: Konstantin Belousov AuthorDate: 2025-03-02 01:23:41 +0000 Commit: Konstantin Belousov CommitDate: 2025-03-02 01:23:41 +0000 amdiommu: add register definitions from IOMMU spec 48882 rev. 3.10 Most important for us is the max interrupt remapping count report in the EFR2 register. Sponsored by: Advanced Micro Devices (AMD) Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/x86/iommu/amd_reg.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sys/x86/iommu/amd_reg.h b/sys/x86/iommu/amd_reg.h index 37375b3fa7b5..53b8b0cb42fc 100644 --- a/sys/x86/iommu/amd_reg.h +++ b/sys/x86/iommu/amd_reg.h @@ -186,6 +186,9 @@ #define AMDIOMMU_CTRL_MARC_EN 0x0000010000000000ull /* Memory Addr Routing En */ #define AMDIOMMU_CTRL_BLKSTOPMRK_EN 0x0000020000000000ull /* Block StopMark En */ #define AMDIOMMU_CTRL_PPRAUTORESPA_EN 0x0000040000000000ull /* PPR Auto Resp Always En */ +#define AMDIOMMU_CTRL_NUMINTRREMAP_MASK 0x0000180000000000ull /* Remapping MSI mode */ +#define AMDIOMMU_CTRL_NUMINTRREMAP_512 0x0000000000000000ull /* 512 max */ +#define AMDIOMMU_CTRL_NUMINTRREMAP_2048 0x0000080000000000ull /* 2048 max */ #define AMDIOMMU_CTRL_EPH_EN 0x0000200000000000ull /* Enh PPR Handling En */ #define AMDIOMMU_CTRL_HADUP_MASK 0x0000c00000000000ull /* Access and Dirty in host PT */ #define AMDIOMMU_CTRL_GDUP_DIS 0x0001000000000000ull /* Dis Dirty in guest PT */ @@ -256,6 +259,21 @@ #define AMDIOMMU_CMDEVS_PPROVRFLWEB 0x00020000 #define AMDIOMMU_CMDEVS_PPROVRFLWE 0x00040000 +/* + * IOMMU Extended Feature2 register fields. + * All currently defined bits are RO. + */ +#define AMDIOMMU_EFR2_TMPMSUP 0x0000000000000004ull /* Tired Mem Migration */ +#define AMDIOMMU_EFR2_GCR3TRPM 0x0000000000000008ull /* GPA based GCR3 pointer in DTE */ +#define AMDIOMMU_EFR2_GAPPID 0x0000000000000010ull /* masking of GAPIC PPI */ +#define AMDIOMMU_EFR2_SNPAVIC_MASK 0x00000000000000e0ull /* SNP-enabled Adv intr features */ +#define AMDIOMMU_EFR2_SNPAVIC_NO 0x0000000000000000ull /* No features supported */ +#define AMDIOMMU_EFR2_SNPAVIC_REMAPV 0x0000000000000020ull /* Intr remapping with GVAPIC */ +#define AMDIOMMU_EFR2_NUMINTRREMAP_MASK 0x0000000000000300ull /* Number of remapped intr per dev */ +#define AMDIOMMU_EFR2_NUMINTRREMAP_512 0x0000000000000000ull /* 512 */ +#define AMDIOMMU_EFR2_NUMINTRREMAP_2048 0x0000000000000100ull /* 2048 */ +#define AMDIOMMU_EFR2_HTRANGEIGN 0x0000000000000800ull /* HT range is regular GPA */ + /* * Device Table Entry (DTE) */ From nobody Sun Mar 2 01:35:36 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z54Jn0xxXz5VcJv; Sun, 02 Mar 2025 01:35:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z54Jm6lkWz43Jw; Sun, 02 Mar 2025 01:35:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740879337; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tlL9r14rsSDD/D9MhPwmN00XzlSN3VHhkhAt/aUmzg4=; b=FsIuwvLNRk82DqKIHWoVtpLxVCDBaf+Ps133kUrScv85KarcWrd3fRrkDljHTEKmJgho7E DF8Q6poRs8BEH5u7you2zkAQpQjTZDoXxnex3+AycAPB2JMqArIxtCICu5znCXyYf1ZNMW NOH0uVXkXVocaoSzuB/RugP2tMfXwJUsQf+H3QGbKyhJPxE4yEd0N0cOArGE3/Tj4zX5Gx Y57binGoXjvPy16gztSkufw1Rveeap1cvI08+eiTKkKgy5f0Tl0fCRNpOzMpHJG0IrM9mr 9k71+d+ExTyaefFsSCKkkLQtBd4w2bDVQxNtY1Y2UyM4PFmqNrel1r6elzCoVA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740879337; a=rsa-sha256; cv=none; b=JF4xq7HoZ0IoVGP0Y3JCQ79XOpUVgGnxhWz3lLglwQW9tND8fY+XOZrN54D+vDOVTg+I54 Q23vpGLtwvbONZPla3nvFE+qD3XbIl8v5x23JDMbFbtABttS2SeWnKq3r8C+rqTBL6emKW NlCjTcxX0ZNnjSCISE44hbYPGRJvc8lyhq33YXIFrz1vSrYVFBiF3tc2mgKe4fEu5tuHl/ 1iJAAvBd1jIX4NrwFl5xuZo1qhDhYAULKrFtce2vTtbc3QxVqPWY5SttxOi5N5pB64i8qj MqPOVjYfSCXcVIH9y7+Ly/c4z8selYOizbas7/iOoPBPXoOfhm9CqYL7W2dvGA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740879337; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tlL9r14rsSDD/D9MhPwmN00XzlSN3VHhkhAt/aUmzg4=; b=GoJJjDBWWzWMJg9qCwCKQBcihF/4qAZjvnKjcfka8nU1xHBTCItZpWQa6sl8erUua7Z6O4 EMKynRN1xdEbq2TfwfH6DY2y6zUIDTr0I7+ZQWOb8Bbaq5ZEFKdtAVNwLDSOBJSr+dbS4i FGsxLgp6LMdNJep1BgGt9I8jAfYVo7rCpAquM5HH3iMLRoEi1MGp9avAlQ5PnhAqFL2Z36 Ou0JL2TjZ1MK1ZpvSwgDypISn+ouXKBFu0nCF4j/yxA3M59oRxgWE8iZuob1vRIY+zmQb1 nvXBYmc2ehPrYVWxQ+dqRzaNV72wgeWopB2h/ADnMXorExgnIImEJfdbwIjStQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z54Jm5n8xzh4F; Sun, 02 Mar 2025 01:35:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5221ZaTi077444; Sun, 2 Mar 2025 01:35:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5221ZaKC077441; Sun, 2 Mar 2025 01:35:36 GMT (envelope-from git) Date: Sun, 2 Mar 2025 01:35:36 GMT Message-Id: <202503020135.5221ZaKC077441@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 4b86550923cf - main - ifconfig: add AES-GCMP RSN OUI decoding List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b86550923cfb226a65b7d48c661654bd0a240cc Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=4b86550923cfb226a65b7d48c661654bd0a240cc commit 4b86550923cfb226a65b7d48c661654bd0a240cc Author: Adrian Chadd AuthorDate: 2025-03-01 01:18:40 +0000 Commit: Adrian Chadd CommitDate: 2025-03-02 01:35:08 +0000 ifconfig: add AES-GCMP RSN OUI decoding This decodes the AES-GCMP OUI in ifconfig, ifconfig list sta, ifconfig list scan, etc. Differential Revision: https://reviews.freebsd.org/D49187 Reviewed by: bz --- sbin/ifconfig/ifieee80211.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c index 9f66281931c0..656e71e325cd 100644 --- a/sbin/ifconfig/ifieee80211.c +++ b/sbin/ifconfig/ifieee80211.c @@ -3136,6 +3136,8 @@ rsn_cipher(const u_int8_t *sel) return "AES-CCMP"; case RSN_SEL(RSN_CSE_WRAP): return "AES-OCB"; + case RSN_SEL(RSN_CSE_GCMP_128): + return "AES-GCMP"; } return "?"; #undef WPA_SEL From nobody Sun Mar 2 01:35:37 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z54Jq39W2z5VcND; Sun, 02 Mar 2025 01: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z54Jp0cnqz43Gb; Sun, 02 Mar 2025 01:35:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740879338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HI/ZIVKo63gxjDxU+u61ccwNnSNdmeWR+O9XSvTgtDU=; b=lpxBMqbRB0NgvzPGil+QQExEF4C3zEPlBtSncY5aQakEG9oMLLn99zKgkhgoUI+12Z2Ez1 kzSoffqRwhMg0VMvrRw5Xo3RVQZ5YK5TzDoaz+iBj6GQuBZeGsCh7ZtT4N6Sek0D7Xued9 3YYJHubDGdg7CZzTAonu5599eOEQxi1wgQtosTreYKSw5md31Onls0VORvmAd9WlRcg/FH aJj5VPIRTf6AJkePza12b2aZYR54JLsKWDPPxVI4tqdeP+pUR2hP5cmnZDQiivxYyrJ7Ra q+n+XGcdcRmMKAs9ZC5d/kWWI6ilCS7q76iUhaFGbo/vaSrm8jos8bOK4u9rPA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740879338; a=rsa-sha256; cv=none; b=RlsI17o/Iu/Dw/VyxL7ZgYfsQ4pPsE06NCk1etuPfdzZrrNv+VLvDsTlVa92DXtN+Oa93w IICGcFDZmdpaPefnuyb+0QZQ6k6g1XbXMqlmFFz716WN0NA8r3UmPdHedKv8mlTXrrI9hL O1Vgo4h6qlaPUvEF7HnQc+QqxaR+RKo42OO7U9qN7+2tGrkCMMocelvyzliRfOw/4kUoY8 B4UYNLIrcQMzNC2YbT8UdH5kUSNZbkssjvbN97iumaYtEUlmw/02rj2PKxvO7pzrmyfjei VQL1rIESkk8s/ookC02uTr90OknmwRShQJ43qa7RG8dMzf7u3xJatXb3Gw9RsQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740879338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HI/ZIVKo63gxjDxU+u61ccwNnSNdmeWR+O9XSvTgtDU=; b=O7aTU5EVy7vVaQBPDBnpEBUt96YXCtP28WZX2z+aerrGlCFjwuXZgTQUiXdtsfH/4JB/zp 1p0EYpo1f7Cz84TfOttawVOtpRj0y9r9JcCoeqBfmp7GyUPwg/zUOEIAzLmDnM2ia3+3XD gdYuZ05mDWziX+9yKPK5Wq7WQgPTOQhGLNE/1rqLu5UZEl1iR/rbLSw9/uS4JOSE9WCgZf N8UhF88kub5BHPcYMA8ebfqC2ysvU5s9+pxa7Kvuw0sT0hAeLfa8v0hdu/pdxhMd/vkv+9 Tc+zfwrJ9YqDEZQsLvh5QkW9s++CEIrbGH5rq/67esMz8WEDSgxA1vX4UwtBSA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z54Jn6zxvzhLq; Sun, 02 Mar 2025 01:35:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5221ZbUJ077485; Sun, 2 Mar 2025 01:35:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5221ZblP077482; Sun, 2 Mar 2025 01:35:37 GMT (envelope-from git) Date: Sun, 2 Mar 2025 01:35:37 GMT Message-Id: <202503020135.5221ZblP077482@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: e74a3c75855f - main - net80211: add AES-GCM in ddb output List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e74a3c75855ffae028bd1991c73dee474aafce05 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=e74a3c75855ffae028bd1991c73dee474aafce05 commit e74a3c75855ffae028bd1991c73dee474aafce05 Author: Adrian Chadd AuthorDate: 2025-03-01 04:20:30 +0000 Commit: Adrian Chadd CommitDate: 2025-03-02 01:35:23 +0000 net80211: add AES-GCM in ddb output Add the AES-GCM crypto cipher field decode in ddb. Differential Revision: https://reviews.freebsd.org/D49188 Reviewed by: bz --- sys/net80211/ieee80211_ddb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/net80211/ieee80211_ddb.c b/sys/net80211/ieee80211_ddb.c index 3c57b03ddc65..d96d7988a864 100644 --- a/sys/net80211/ieee80211_ddb.c +++ b/sys/net80211/ieee80211_ddb.c @@ -942,6 +942,9 @@ _db_show_key(const char *tag, int ix, const struct ieee80211_key *wk) case IEEE80211_CIPHER_CKIP: db_printf(" CKIP %u:%u-bit", wk->wk_keyix, 8*keylen); break; + case IEEE80211_CIPHER_AES_GCM_128: + db_printf(" AES-GCM %u:%u-bit", wk->wk_keyix, 8*keylen); + break; case IEEE80211_CIPHER_NONE: db_printf(" NULL %u:%u-bit", wk->wk_keyix, 8*keylen); break; From nobody Sun Mar 2 05:19:26 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z59H33XWPz5hsRH; Sun, 02 Mar 2025 05:19: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z59H32R2nz46RR; Sun, 02 Mar 2025 05:19:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740892767; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=d/ztPTBCAIdWKiqb+rD+s6UFAZndYSBETYtW62u5pFU=; b=KpjXPCEg2ZrgBOXOe+YxFEC0jyukzk7h8FBsEBe/vgIAf1fR+zg5dh+b652cBs+aI0JDEN +QFj9VycsRk37/En2t8QGtXxxDFPdKIN75X8cl6qsGxSG7PFBao0IEOoie07nL1LoRqvCF f1zdHmv18Nu9ZedjybpVa6BJeNcRKfP7G2KMqvihs+YE2+zF40PZ9Jc2fnoYp1Q4aFsbCE d/LzNvnygoiww2R0ZsX2jBS9O8PLEaaYAlEXMrJubS3hBdREfe0rwe9vxCaazDVVY/f3Wi wq5G3eJxYacilsbLtPGR1NgjVGhk7e5fWsnIssezf0aAQZXXu3Tgz4VI+UtU9w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740892767; a=rsa-sha256; cv=none; b=NbnwPp571vTkwiPtanHqj5/vjMvYOhlp7iRUwwUSAHosountkty25vqZDHxIqpjepGqQmV vCODI/VOetFJLhHLq4NHODt/mtJNr5fUg3nhRftT+Fgy+U2lCOZJR7Sw+w7EmTCmb2VTJR hxY3l/vDBWUCVgbLEG8ZauP8i7iJ8sMXVzGKcC+PxtsK2y17gC8xMqNixNzxGodqJg34zG FmSV5eIvqwRy8V3Gcd4ZZS6wSlVtq+OJiTqOJcKU8svNgh1WKtf5MOGsqEAH4aUGOGn+3H P+mjI7Fx0qyZ2GFTunQjTIajqRsTsjy+5zWhm7L0NjeksIs1mREFOXtaQHeGxA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740892767; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=d/ztPTBCAIdWKiqb+rD+s6UFAZndYSBETYtW62u5pFU=; b=UFuRLT4VGwMWkpXT0tKmGwgzwnasXbOk5VptMXG/L3XhdgW4cz4QmJvwJzYGfT1AiCm0tE bsz3oxa54yNan+xQi31Zk7rJuQo0SkV/qb7LRN2qYgjvk8shOLmJQEatkaR+SgVraGwx94 VKxV3bOFTvtFD9PYjrfzRXq1L+QzBZkqR0H7UsqhhtHKTo/8i6xDV6UJ5x6Se8pjoC5M1C 2KehQCTsg/12w8mxjA6/hLSPClVnL9PzEKAnMzUsYBQ10oXhmzrePVvoc0YaDBh8aKu2h1 oZ8IiAzpgIS5JAviv/UcWm2l15v9dcZzCOZ+yQQ1GyLvwoKBSHyYXVP2Y9U+bQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z59H31Nk6zngc; Sun, 02 Mar 2025 05:19:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5225JQgr091656; Sun, 2 Mar 2025 05:19:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5225JQYl091653; Sun, 2 Mar 2025 05:19:26 GMT (envelope-from git) Date: Sun, 2 Mar 2025 05:19:26 GMT Message-Id: <202503020519.5225JQYl091653@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: 23da585dd465 - main - pci(4): Give UEFI wiring example List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 23da585dd4650bd17d605049779baceb466cf59b Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=23da585dd4650bd17d605049779baceb466cf59b commit 23da585dd4650bd17d605049779baceb466cf59b Author: Warner Losh AuthorDate: 2025-03-02 05:19:11 +0000 Commit: Warner Losh CommitDate: 2025-03-02 05:19:11 +0000 pci(4): Give UEFI wiring example Sponsored by: Netflix Reviewed by: ziaee Differential Revision: https://reviews.freebsd.org/D49195 --- share/man/man4/pci.4 | 48 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/share/man/man4/pci.4 b/share/man/man4/pci.4 index e9b587dac12c..8623eaf3c3b5 100644 --- a/share/man/man4/pci.4 +++ b/share/man/man4/pci.4 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 4, 2022 +.Dd March 1, 2025 .Dt PCI 4 .Os .Sh NAME @@ -624,7 +624,12 @@ pin identified by the tunable name. Mapping of IRQ values to platform interrupt sources is machine dependent. .El .Sh DEVICE WIRING -You can wire the device unit at a given location with device.hints. +You can wire the device unit at a given location with +.Xr device.hints 5 . +.Ss BSF Based Wiring +Devices may be wired to a Bus / Slot / Function (BSF) address. +This is the form reported by +.Xr pciconf 8 Entries of the form .Va hints...at="pci::" or @@ -639,7 +644,7 @@ for any PCI device found to match the specification, where: The domain .Pq or segment of the PCI device in decimal. -Defaults to 0 if unspecified +Defaults to 0 if unspecified. .It The bus address of the PCI device in decimal. .It @@ -660,15 +665,18 @@ produces undefined results. .Ss Examples Given the following lines in .Pa /boot/device.hints : -.Cd hint.nvme.3.at="pci6:0:0" -.Cd hint.igb.8.at="pci14:0:0" +.Bd -literal +hint.nvme.3.at="pci6:0:0" +hint.igb.8.at="pci14:0:0" +.Ed +.Pp If there is a device that supports .Xr igb 4 at PCI bus 14 slot 0 function 0, then it will be assigned igb8 for probe and attach. Likewise, if there is an .Xr nvme 4 -card at PCI bus 6 slot 0 function 0, +device at PCI bus 6 slot 0 function 0, then it will be assigned nvme3 for probe and attach. If another type of card is in either of these locations, the name and unit of that card will be the default names and will be unaffected by @@ -676,6 +684,33 @@ these hints. If other igb or nvme cards are located elsewhere, they will be assigned their unit numbers sequentially, skipping the unit numbers that have 'at' hints. +.Ss Location Based Wiring +While simple to locate where to place a device for BSF wiring, the +bus number of that is not invariant. +Any number of changes to the devices within the system can cause +this value to vary from boot to boot. +The UEFI Standard defines a device path that's based only on the invariant parts +of the address: The root complex (domain), the slot number and the function. +These paths are hard to construct by hand, please see +.Xr devctl 8 +.Sq Cm getpath +command with a +.Sq Ar UEFI +locator. +The above example could also be expressed as +.Bd -literal +hint.nvme.3.at="PciRoot(0x2)/Pci(0x1,0x3)/Pci(0x0,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)" +hint.nvme.8.at="PciRoot(0x1)/Pci(0x2,0x2)/Pci(0x0,0x0)/Pci(0x0,0x0)" +.Ed +.Pp +The advantage of this notation is that you can specify the exact location a +device will be at. +For deployments of multiple systems with the same configuration, this can be +helpful in managing the devices. +However, even slight variation in motherboards can cause the path to change +substantially. +It is also less natural to think of the UEFI Device Paths since little else +will report it. .Sh FILES .Bl -tag -width /dev/pci -compact .It Pa /dev/pci @@ -684,6 +719,7 @@ Character device for the driver. .El .Sh SEE ALSO +.Xr device.hints 5 .Xr pciconf 8 .Sh HISTORY The From nobody Sun Mar 2 08:14:22 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z5F8t5M4sz5nqwC; Sun, 02 Mar 2025 08:14: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z5F8t4cGdz3Vjv; Sun, 02 Mar 2025 08:14:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740903262; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aWXZ8hOaO/Yo9+pl1meEjzQ+nJda972lHecDcNFQlTk=; b=IwohgO1CvvHzoAv73fHvnm9DWlUb/glMfZbyl4K5cqckMHgEUDwuDeX4KJHFTsVqvU0Tix sie1vvW9NVZQATlL0PwoHe90noRh7DlLxUGwdZZI6ErXefI52v29aEQkyPfnAxjhejo+Wg UkBtP031QWvsa9plTSDLcdg/OHRkkAbGjLC9juby9aosrqtEeUfMRW0mIKtnopDATKeHkp b9Xagaa7/ce103b19469oGNHnZ2EirW+fqZ5UKKzs/joFJ4ZcZkNmOFgkIbANSmNgonloo EnGznNCCG37d2K59ea1s/1dzVqoVhC55kp4ZvkfzrWbhdwIyZ/c+hTo5vErHCA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740903262; a=rsa-sha256; cv=none; b=E2+dqNEqRobZ2DaUtfj4NDRN540IA9bOEaRuMiJUzPL1aht+ccFBXREg765Xlg4MFaQZ/e Mbc0jrjDDkQX3/fbX7kHcQMTX0TNnuKmg8X0+dwIyGN1Y/TrXQ163WmYA80b6Yw5XH/Ec1 jtz1WwuZoJiXXSXL3uKvaj1FY2GVqtnX5cvAYPjodpF6++T4Fe23IgDYAeLBVudZ5socHU PGYLbr7COLny2JWrTX63igQgMsAgdUj2mXov/H1+Trt59ckTONHs8dKkrJY0VfNn7dGZjX nfxK50BZRf8mAwlHXixwtBZRJGUcyVkcdYYHzb+PE6mAuyFwouCuKZ2Q9s7cIw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740903262; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aWXZ8hOaO/Yo9+pl1meEjzQ+nJda972lHecDcNFQlTk=; b=iS7qw93cX5P3UivOqK8Sqg4Lr1YtuCJDniQQeJJtFMUp9BJXG0DdRT9tEsnhZh/rUyfAVt Ufn55SXw19qX2jxFpfGOMmeSbBTAgFPXi6+srpXWEOkcOt3fpHqaa1b4c8a3LnEhF1mz12 ami3PZJlqaMr+yA7f94dP3yLMn+nmtHErxuNC5x3caa4qpW2AVwXkLLqzVIENDcHoqfEh7 p5qekKk7+U6R/1LsDIhGSbPWgGeZv7SXpzOfXCQi1pJ/NM+ZDOA1vLME6OjJduqTGGOa7+ 7d13zYujIcuj4E0IhNJ9B55GzDZMCIYyQX/jq6Duot/KRThR/K7t+RgCyE1GxQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z5F8t49W4zt4g; Sun, 02 Mar 2025 08:14:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5228EMC2025349; Sun, 2 Mar 2025 08:14:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5228EMPi025346; Sun, 2 Mar 2025 08:14:22 GMT (envelope-from git) Date: Sun, 2 Mar 2025 08:14:22 GMT Message-Id: <202503020814.5228EMPi025346@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Moore Subject: git: 420e2f8a74df - main - vnode_pager: simplify loop, avoid overflow List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dougm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 420e2f8a74df4be1237244a4ef222d2ceae6823d Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=420e2f8a74df4be1237244a4ef222d2ceae6823d commit 420e2f8a74df4be1237244a4ef222d2ceae6823d Author: Doug Moore AuthorDate: 2025-03-02 08:13:24 +0000 Commit: Doug Moore CommitDate: 2025-03-02 08:13:24 +0000 vnode_pager: simplify loop, avoid overflow Filling in read-behind pages in vnode_pager_generic_getpages() is made very slightly simpler here, by avoiding overflowing the startpindex variable and then avoiding an extra test in the allocation loop that handles the overflow case. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D49200 --- sys/vm/vnode_pager.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index d5d312b3cf71..69509fe8948a 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -1045,18 +1045,13 @@ vnode_pager_generic_getpages(struct vnode *vp, vm_page_t *m, int count, vm_page_t mpred, p; VM_OBJECT_WLOCK(object); - startpindex = m[0]->pindex - rbehind; - if ((mpred = TAILQ_PREV(m[0], pglist, listq)) != NULL && - mpred->pindex >= startpindex) - startpindex = mpred->pindex + 1; + tpindex = m[0]->pindex; + startpindex = MAX(tpindex, rbehind) - rbehind; + if ((mpred = TAILQ_PREV(m[0], pglist, listq)) != NULL) + startpindex = MAX(startpindex, mpred->pindex + 1); - /* - * tpindex is unsigned; beware of numeric underflow. - * Stepping backward from pindex, mpred doesn't change. - */ - for (tpindex = m[0]->pindex - 1; - tpindex >= startpindex && tpindex < m[0]->pindex; - tpindex--, i++) { + /* Stepping backward from pindex, mpred doesn't change. */ + for (; tpindex-- > startpindex; i++) { p = vm_page_alloc_after(object, tpindex, VM_ALLOC_NORMAL, mpred); if (p == NULL) { From nobody Sun Mar 2 10:57:23 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z5Jmz5207z5p5h5; Sun, 02 Mar 2025 10:57: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z5Jmz20MFz3krm; Sun, 02 Mar 2025 10:57:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740913043; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/TCuP9YhHrOMFZyAOW5DNNQc8hl9dZ4+o2F5L+Vo/3o=; b=Dr5bapUFYgygHnqYfkL7NJAFzzUkhsseCNup7YsNeTJRcoWgK6wJE4yv+U6I+GM0pcNDur XpbgPpdLMyuXwn2DHFF3EEVdORZQZ0LU+o3j2qXQTDjbCPeO/d4QT2zANwAzrxhdbsJoSv LtXODo4VNCaxxHDCK7gu1Ez6JrRBRGREzEvST6cN18MeFt7iW/eCWyzLooMpTaXzzTvHjM XJHUQW4IsRKV7GLqNSUSIi7A8j/Ss6HSUbXkstjMp7PZ0buli0Eo1jE6xnxUjXFOkiDcIW c7FzRAFHIlpbvrJBXoPf/E/c02zKLtEPBi3wDUxyWieX5/wTMI27aaIJRtGSBw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740913043; a=rsa-sha256; cv=none; b=DA8LInrXk/P5cECJ45Os1YtWAEDJmRTH0b+s2QXFKJApyFPQdb1g64FHJDMrenAmqR7Oji K1k8Mrn5szHXv0WlQkjieTZDVjK+lIcQaxq0KsG28WtHa5PpLYT56SnD+7u8DHfZoWNiBM ElivFu4w8FbevGy4sIxTHVbBOwp9GzXpe7gM/q+G12os6Q9VQFlkFVdiIiZY1cTyJnpwvV ICYukJsbzZu9SkFX6vCRmdOILQydeUyTK8j7SWHBpLgsYm6GAhfeD8NCUOqp6n31tVcqPI LAG3qnU++cPuueGZPxPh5Qf0hSnVsLuNLUQQFNUoXcOHkyBZBzys8kiJGUJJyg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740913043; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/TCuP9YhHrOMFZyAOW5DNNQc8hl9dZ4+o2F5L+Vo/3o=; b=G3KQVvD1YH5BoIPXM93lgT7v8rY0cOIcP2737FlgaYbI9B5VhmGMEqVpTyPqSQicK4oSZv xo68WeGHaAAFDaL+LwVLnD3bXegsgwThnfnEN8iYGeuZlj5RKpEoxq8CaUdVqOt0CvNmim U5tnqTqMTi1IzzpCh2LU84AoqtONF6H4VW8R00WvaBIHyr2YeGGjEjbWiJ2gig6g586o0l oinGTcXPXTNGslfixdLQJAx67n+bNqiWT9cwg0FzzHQ6wzVKADoQKvoibUlrEORANhIYV4 +aNIbaiG3OHELH1Flb3pvNXnzVrgOx7pizL6HzqBT3Q6huskA9OEYa3VGlBpXA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z5Jmz1bClzxZG; Sun, 02 Mar 2025 10:57:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 522AvN1a023028; Sun, 2 Mar 2025 10:57:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 522AvNpL023025; Sun, 2 Mar 2025 10:57:23 GMT (envelope-from git) Date: Sun, 2 Mar 2025 10:57:23 GMT Message-Id: <202503021057.522AvNpL023025@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: 361a8395f0b0 - main - routing: do not allow PINNED routes to be overriden List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 361a8395f0b0e6f254fd138798232529679d99f6 Auto-Submitted: auto-generated The branch main has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=361a8395f0b0e6f254fd138798232529679d99f6 commit 361a8395f0b0e6f254fd138798232529679d99f6 Author: Andrey V. Elsukov AuthorDate: 2025-03-02 10:53:49 +0000 Commit: Andrey V. Elsukov CommitDate: 2025-03-02 10:53:49 +0000 routing: do not allow PINNED routes to be overriden First configured PINNED routes should have higher priority. Fixes: 1da4954c92ea MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D48650 --- sys/net/route/route_ctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index e5ddd7782e1e..5a04e9dcf6e7 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -821,7 +821,7 @@ add_route_flags(struct rib_head *rnh, struct rtentry *rt, struct route_nhop_data /* Now either append or replace */ if (op_flags & RTM_F_REPLACE) { - if (nhop_get_prio(rnd_orig.rnd_nhop) > nhop_get_prio(rnd_add->rnd_nhop)) { + if (nhop_get_prio(rnd_orig.rnd_nhop) == NH_PRIORITY_HIGH) { /* Old path is "better" (e.g. has PINNED flag set) */ RIB_WUNLOCK(rnh); error = EEXIST; From nobody Sun Mar 2 15:02:43 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z5QD32xL7z5pTvL; Sun, 02 Mar 2025 15:02: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z5QD31hNwz3TTC; Sun, 02 Mar 2025 15:02:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740927763; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Sdlodn3S9br/PEzssoJF+S7EvmvHwmu5590QGHwh00g=; b=yQNy4BqWaeM7+jVsg1zsTz0FMaaGZT+y7KYrd0dE0AScjAAfiOETKL9o8OzMbtxWFyjcg5 VPCl/9EJzYXz98gDqOKwH3PS/ATNvIBwLx8goVxlJ/jyTm2Q2J4JHRmqIyK7N4VI1KEx9b vIwOoi5eA8akoJNMB5YV5lTJhI4kzGn46ieBapb6MRCxxAns0yHGQ0242fG0ov/REHENsy 2J5A5rmRAtul/TP8YsEc0WAdNCm1CoNEahfWgxd6dCyBB1eP+sTC+9Bk05I/wuN+sKaDfP 2u/7EYIaIU6wS8VPTHsUHqciBtZdGnFQcO+r9Kj0FhsM+I2Tyq5KQPdQZkOz0A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740927763; a=rsa-sha256; cv=none; b=WF3gnZbcnYKfUJDTlh4EhlGMOB54gE79thgHM3FV8zrZu+hPF84qbRr9o+JlfCBo1HHox/ bPQ/P4DdDnDoWlPgGWat0DgwZDAZvA41xSRsGCKkCOMysEfWRh5/3arhsWnQ96MutnjICf rUsWVn5G8jMRspMJMjBSy9Kp3IPYibqZ0lDGjF+jkwADYqjM0N+IiX7sZriAqQVfHf59iz UKNm/8dvUqSnSsdN5/4Al9icRrGKxcBRy+1Z3IaDPq7KJD1iaczWFGRkvYt0aP3Ul0pyWd r2KBdqSUc1TzXhuWsypIh4MKKa6z3SJd5EcJbBhcoHINFxgICWzZWcO1T9z4ZA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740927763; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Sdlodn3S9br/PEzssoJF+S7EvmvHwmu5590QGHwh00g=; b=BA5ql0UXCKgiAB0RwLhoLTqrIz1qrPp92AqmhIXu4sqOjx59yxea5VgebO3PN/q4B0EPqu aNrsxRPE+jaDgvDhpj/yhtQSQhg/VPWqixKInLStqO9UC7iEdcqxPPzH5W/WKqV3TlQcUD z3DJbj2yFwH5KbJ3Jz1niRB5YKX8Nk7WBnpx2tA8/rTG39rPzUzdNawxyKxbgoMy6aTtGJ Nh/Zabnf7fRRN0EDNJOHIZSbE7gEvF1kbC1So2xVLs2pjQStwX6HoOODSHrQgsAE1AN3HP mlej2UgWDyZmbx6LWYoJarCH6GqzF1FAKo199V1BTWguXNYsal7MrdkjWP8Ujw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z5QD31HZ9z1644; Sun, 02 Mar 2025 15:02:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 522F2hLQ089753; Sun, 2 Mar 2025 15:02:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 522F2hCi089750; Sun, 2 Mar 2025 15:02:43 GMT (envelope-from git) Date: Sun, 2 Mar 2025 15:02:43 GMT Message-Id: <202503021502.522F2hCi089750@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: f7174eb2b4c4 - main - netinet: Do not forward or ICMP response to INADDR_ANY List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f7174eb2b4c45573bb9e836edad2b179a445a88f Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=f7174eb2b4c45573bb9e836edad2b179a445a88f commit f7174eb2b4c45573bb9e836edad2b179a445a88f Author: Zhenlei Huang AuthorDate: 2025-03-02 15:00:42 +0000 Commit: Zhenlei Huang CommitDate: 2025-03-02 15:00:42 +0000 netinet: Do not forward or ICMP response to INADDR_ANY The section 4 in the draft proposal [1] explicitly states that 0.0.0.0, aka INADDR_ANY, retains its existing special meanings. [1] https://datatracker.ietf.org/doc/draft-schoen-intarea-unicast-0 Reviewed by: glebius Fixes: efe58855f3ea IPv4: experimental changes to allow net 0/8, 240/4, part of 127/8 MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D49157 --- sys/netinet/in.c | 3 ++- sys/netinet/ip_icmp.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 9a644c60e541..22adc8277b93 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -276,7 +276,8 @@ in_canforward(struct in_addr in) { u_long i = ntohl(in.s_addr); - if (IN_MULTICAST(i) || IN_LINKLOCAL(i) || IN_LOOPBACK(i)) + if (IN_MULTICAST(i) || IN_LINKLOCAL(i) || IN_LOOPBACK(i) || + in_nullhost(in)) return (0); if (IN_EXPERIMENTAL(i) && !V_ip_allow_net240) return (0); diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index 936f76e7fbe3..17d15d7d9629 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -783,10 +783,11 @@ icmp_reflect(struct mbuf *m) if (IN_MULTICAST(ntohl(ip->ip_src.s_addr)) || (IN_EXPERIMENTAL(ntohl(ip->ip_src.s_addr)) && !V_ip_allow_net240) || - (IN_ZERONET(ntohl(ip->ip_src.s_addr)) && !V_ip_allow_net0) ) { + (IN_ZERONET(ntohl(ip->ip_src.s_addr)) && !V_ip_allow_net0) || + in_nullhost(ip->ip_src) ) { m_freem(m); /* Bad return address */ ICMPSTAT_INC(icps_badaddr); - goto done; /* Ip_output() will check for broadcast */ + goto done; /* ip_output() will check for broadcast */ } t = ip->ip_dst; From nobody Sun Mar 2 15:02:44 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z5QD44h5rz5pV6v; Sun, 02 Mar 2025 15:02:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z5QD42fbMz3TTD; Sun, 02 Mar 2025 15:02:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740927764; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=S23VVF8kFwUWLxPIlcjX3r1rM/PCkilV1r2dxVDcnh8=; b=nxbNsdNa1kM1dMAqErKsS5D7PLNfPd7utVNRzpVK0wsUPbLf3/Uc/99FysL61P8bYzKc8w lw1jKdTyT0ufcZD4gRdNDU4HWAICXQ92AcyjDF6VWWt5R2DWgWkEAu6NV3PA0/Q49A5zEy 9R9e7/v0L2tdKgUN5BmFYda77pZ1GroaXIeiuFa2q0CkF1Op31FQWJFCEK0oTlmd1Scm0m GPWCTpVmWPX45dgJOQ04hwL0AixJ8bTY19ypqvHpgQLQqprgym9vMQ4B+oZALtyvrNv9Jc lKCsKvc8IGO2s0tdVgUwn6n5R6PL7JvrHu6Cd2NdGoI6p8xecOTZOnufRMqzlw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740927764; a=rsa-sha256; cv=none; b=Hdnir07tFhjZZ7lZNG77JA2XkXWDHs2BSLd0Qnyzi1WlbxqQ/WYbZQlVPmmukDlqKXkjo2 ClcjNLrGLYpg2cJbOtP4oRshPAb4byCmi/WdCgf4auH9KKoTgSZP7D5lyYhFk6ttIHTQbt 6rFoJVGtLT/htOIOh/gEdLFdJAmmyr5UW1yphhXRPkRkfEeWXg90T7bV5uiWoAES1SLVwp 0cSu8R5SfLawIhFw7oHh/oVPHQS7rIxrmikqoMQV683V20wO0sEKaU8duL6kSwydG4OI3c KigUX6N8rHoV84g+/Cw5bdhw0QsDeylS9f0hnXcKnnVYiX9L25CNx2ZmRr+VOA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740927764; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=S23VVF8kFwUWLxPIlcjX3r1rM/PCkilV1r2dxVDcnh8=; b=PhHsTmvFvw9LccM6mOznZ2/razHr/iUKszukQVDMyd7vs+7RDq+q840dWcxc+VMK83lsR0 a6RlWxOWWXkO/ZqBopnXCuDijubTQ43r8sqlokBWreg7Rj4JB56fcldw6OcMpt/E5fC6gJ fJjLi6/wm87VZN8Cpz3yw1F89tuW3c5k4nm/x76HX0HnFK5wsVd8CpxTskyW9R4zrPLC+x iTEIxFywjCdx3hS0vgnYn+nUAwh+/xTI5w3ruqlYSNg6otj/0I1kGcwuMP2mvvY/cVP9dO p7DpqPXch7uGDKpQm51raDw/aXluX1LMaSGFnRYs6tGwglDkjRyOmI8s+QPflg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z5QD42GK4z15wq; Sun, 02 Mar 2025 15:02:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 522F2iNA089790; Sun, 2 Mar 2025 15:02:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 522F2i5x089787; Sun, 2 Mar 2025 15:02:44 GMT (envelope-from git) Date: Sun, 2 Mar 2025 15:02:44 GMT Message-Id: <202503021502.522F2i5x089787@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 3ae7c763540a - main - netinet: Make in_canforward() return bool List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3ae7c763540afc0bc5320eb45f2661d315370eb8 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=3ae7c763540afc0bc5320eb45f2661d315370eb8 commit 3ae7c763540afc0bc5320eb45f2661d315370eb8 Author: Zhenlei Huang AuthorDate: 2025-03-02 15:00:42 +0000 Commit: Zhenlei Huang CommitDate: 2025-03-02 15:00:42 +0000 netinet: Make in_canforward() return bool No functional change intended. MFC after: 5 days --- sys/netinet/in.c | 10 +++++----- sys/netinet/in.h | 2 +- sys/netinet/ip_input.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 22adc8277b93..2fcbff8611ff 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -271,19 +271,19 @@ in_findlocal(uint32_t fibnum, bool loopback_ok) * that may not be forwarded, or whether datagrams to that destination * may be forwarded. */ -int +bool in_canforward(struct in_addr in) { u_long i = ntohl(in.s_addr); if (IN_MULTICAST(i) || IN_LINKLOCAL(i) || IN_LOOPBACK(i) || in_nullhost(in)) - return (0); + return (false); if (IN_EXPERIMENTAL(i) && !V_ip_allow_net240) - return (0); + return (false); if (IN_ZERONET(i) && !V_ip_allow_net0) - return (0); - return (1); + return (false); + return (true); } /* diff --git a/sys/netinet/in.h b/sys/netinet/in.h index 3d087e5b06d5..3f2c388548ec 100644 --- a/sys/netinet/in.h +++ b/sys/netinet/in.h @@ -674,7 +674,7 @@ struct in_ifaddr; bool in_ifnet_broadcast(struct in_addr, struct ifnet *); bool in_ifaddr_broadcast(struct in_addr, struct in_ifaddr *); -int in_canforward(struct in_addr); +bool in_canforward(struct in_addr); bool in_localaddr(struct in_addr); bool in_localip(struct in_addr); bool in_localip_fib(struct in_addr, uint16_t); diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 08c48996a798..4d614dfeb0a2 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -924,7 +924,7 @@ ip_forward(struct mbuf *m, int srcrt) NET_EPOCH_ASSERT(); - if (m->m_flags & (M_BCAST|M_MCAST) || in_canforward(ip->ip_dst) == 0) { + if (m->m_flags & (M_BCAST|M_MCAST) || !in_canforward(ip->ip_dst)) { IPSTAT_INC(ips_cantforward); m_freem(m); return; From nobody Sun Mar 2 15:17:49 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z5QYV2XHsz5pWCr; Sun, 02 Mar 2025 15:17: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z5QYV1gp1z3ZSy; Sun, 02 Mar 2025 15:17:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740928670; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jzGWHNPwbMHu1gicJwBvcgIdbuZG4krjYfglW9/K870=; b=AOIWMkvFOanHx/CtLvkLYoHkTNXkYOyGGIKyZg3lRNRdTSIBry1YKna/SCbb0uXk99LU6J T4o6B05LzScS785r3O+AaZ03iHByJjWf1+0yTOqpMNHt3KtiQgIAdmjhOvvETVAnnh7l7L pWWAFlEk8BnGb6s0+q5basujMBNeKln/Bnv2nlBcZ2LP8P8UtR3lDzB50WxqdmvbQZkeGl eNEN3oxwS9Zzip1fp/J7K1vAedCzBmWNNnjDm9XTErpSDhuu8BXiCjBwp8oWZiI4EUmiXa S9uo9JMVYP+tmctFj9r+Sbh0m81SUGHBaKIT6EDqQFA8X4SyQLEtK8ks/6n33w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740928670; a=rsa-sha256; cv=none; b=ADIVeSv/zM7YcgfuJfwSfrodXpnJbU6uGZ+1SXRY+j2VkGhU4hs/9AO+yYy0ZOLK0ADHla /CdIpXzmVG3eAk3jXHtSMSrRxdJ6WuTHl6jnWsvzwKsovzfvaXvidiLfaTWFV7vDE42pq2 d0P9yA52RkU5jl6BNSVjhgoWLtwtx3lQq76NCoWqUxkedhll9qte50S3pG5V9Eh7JpcNQe 6hdWyZh61pEyuS43uDgenrN4DxTvXjkgg88kPFEpvEYsngh05wT+Jue+mmn+jfUgBAf695 rBm06yRgTJ9NWqgUiiMVMgl4dOx+HnTnjmXW14DOgmF/P1EpgHtUu/jT6K0eaA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740928670; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jzGWHNPwbMHu1gicJwBvcgIdbuZG4krjYfglW9/K870=; b=nIRmvCZ75SY99yDfTBVLzdhhe849RvqLXnLH8igJFFt//5KnD+y7qW25bUKok4GJaxdXPz sX0OvLIAf3shhJrumrOI6+rVZAgW0oW9HxwjluIYJH6mjlttQZcJE7XQYf3zNnQJZ93fUE dGklabE6YkytSamaE/B00SmogmAFu865QDuPG1/sDJuM4gs4MP9/wybqQk525xUVTtmt+o BsGJIfYQMdvpg6C62+N3IXPA75fY+m8+oMuw/Otbr4jRe84c+HdtCuKpAWwU41BjeNt9Hh gucsq49cmSQ+FmNj/sD4scmLCO0ld5csNAsqeQgUVgzK5pOfwkUkabFglSQ8TA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z5QYV0zHKz15xW; Sun, 02 Mar 2025 15:17:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 522FHnpG009619; Sun, 2 Mar 2025 15:17:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 522FHnWk009616; Sun, 2 Mar 2025 15:17:49 GMT (envelope-from git) Date: Sun, 2 Mar 2025 15:17:49 GMT Message-Id: <202503021517.522FHnWk009616@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Rabson Subject: git: e8a5b9fd73f4 - main - release: build OCI images with shell scripts List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dfr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e8a5b9fd73f4f437a03c85e7644daa55652e224b Auto-Submitted: auto-generated The branch main has been updated by dfr: URL: https://cgit.FreeBSD.org/src/commit/?id=e8a5b9fd73f4f437a03c85e7644daa55652e224b commit e8a5b9fd73f4f437a03c85e7644daa55652e224b Author: Doug Rabson AuthorDate: 2024-12-12 16:42:00 +0000 Commit: Doug Rabson CommitDate: 2025-03-02 15:17:13 +0000 release: build OCI images with shell scripts This avoids the need for buildah and skopeo for building releases. Reviewed by: cpersiva MFC after: 1 day Differential Revision: https://reviews.freebsd.org/D48574 --- release/Makefile.oci | 6 +- release/release.sh | 38 ------------- release/scripts/make-oci-image.sh | 105 +++++++++++++++++++++++++++++++---- release/tools/oci-image-dynamic.conf | 2 +- release/tools/oci-image-minimal.conf | 3 +- release/tools/oci-image-static.conf | 3 +- 6 files changed, 99 insertions(+), 58 deletions(-) diff --git a/release/Makefile.oci b/release/Makefile.oci index da35156c5a95..e4b5df580055 100644 --- a/release/Makefile.oci +++ b/release/Makefile.oci @@ -26,11 +26,7 @@ OCI_TARGETS+= container-image-${_IMG}.txz container-image-${_IMG}.txz: ${OCI_DEPS_${_IMG}} # Adjust PATH so that we run pwd_mkdb from the bootstrap tools env PATH=${OBJTOP}/tmp/legacy/bin:${PATH:Q} \ - sh ${.CURDIR}/scripts/make-oci-image.sh ${.CURDIR} ${REVISION} ${BRANCH} ${TARGET_ARCH} ${_IMG} - skopeo copy \ - containers-storage:localhost/freebsd${REVISION:R}-${_IMG}:latest \ - oci-archive:${.OBJDIR}/container-image-${_IMG}.tar:freebsd${REVISION:R}-${_IMG}:${REVISION}-${BRANCH}-${TARGET_ARCH} - ${XZ_CMD} < ${.OBJDIR}/container-image-${_IMG}.tar > ${.OBJDIR}/container-image-${_IMG}.txz + sh ${.CURDIR}/scripts/make-oci-image.sh ${.CURDIR} ${REVISION} ${BRANCH} ${TARGET_ARCH} ${_IMG} container-image-${_IMG}.txz .endfor oci-release: ${OCI_TARGETS} diff --git a/release/release.sh b/release/release.sh index d6752e016994..5a6de297f7a1 100755 --- a/release/release.sh +++ b/release/release.sh @@ -292,44 +292,6 @@ extra_chroot_setup() { fi fi - if [ ! -z "${WITH_OCIIMAGES}" ]; then - # Install buildah and skopeo from ports if the ports tree is available; - # otherwise install the pkg. - if [ -d ${CHROOTDIR}/usr/ports ]; then - # Trick the ports 'run-autotools-fixup' target to do the right - # thing. - _OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U) - REVISION=$(chroot ${CHROOTDIR} make -C /usr/src/release -V REVISION) - BRANCH=$(chroot ${CHROOTDIR} make -C /usr/src/release -V BRANCH) - UNAME_r=${REVISION}-${BRANCH} - GITUNSETOPTS="CONTRIB CURL CVS GITWEB GUI HTMLDOCS" - GITUNSETOPTS="${GITUNSETOPTS} ICONV NLS P4 PERL" - GITUNSETOPTS="${GITUNSETOPTS} SEND_EMAIL SUBTREE SVN" - GITUNSETOPTS="${GITUNSETOPTS} PCRE PCRE2" - PBUILD_FLAGS="OSVERSION=${_OSVERSION} BATCH=yes" - PBUILD_FLAGS="${PBUILD_FLAGS} UNAME_r=${UNAME_r}" - PBUILD_FLAGS="${PBUILD_FLAGS} OSREL=${REVISION}" - PBUILD_FLAGS="${PBUILD_FLAGS} WRKDIRPREFIX=/tmp/ports" - PBUILD_FLAGS="${PBUILD_FLAGS} DISTDIR=/tmp/distfiles" - for _PORT in sysutils/buildah sysutils/skopeo; do - eval chroot ${CHROOTDIR} env ${PBUILD_FLAGS} make -C \ - /usr/ports/${_PORT} \ - FORCE_PKG_REGISTER=1 deinstall install clean distclean - done - else - eval chroot ${CHROOTDIR} env ASSUME_ALWAYS_YES=yes \ - pkg install -y sysutils/buildah sysutils/skopeo - eval chroot ${CHROOTDIR} env ASSUME_ALWAYS_YES=yes \ - pkg clean -y - fi - # Use the vfs storage driver so that this works whether or not - # the build directory is on ZFS. The images are small so the - # performance difference is negligible. - eval chroot ${CHROOTDIR} sed -I .bak -e '/^driver/s/zfs/vfs/' /usr/local/etc/containers/storage.conf - # Remove any stray images from previous builds - eval chroot ${CHROOTDIR} buildah rmi -af - fi - if [ ! -z "${EMBEDDEDPORTS}" ]; then _OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U) REVISION=$(chroot ${CHROOTDIR} make -C /usr/src/release -V REVISION) diff --git a/release/scripts/make-oci-image.sh b/release/scripts/make-oci-image.sh index 6180ed9d53b4..0fd64602b403 100644 --- a/release/scripts/make-oci-image.sh +++ b/release/scripts/make-oci-image.sh @@ -7,21 +7,23 @@ rev=$1; shift branch=$1; shift arch=$1; shift image=$1; shift +output=$1; shift major=${rev%.*} minor=${rev#*.} abi=FreeBSD:${major}:${arch} +ver=${rev}-${branch}-${arch} echo "Building OCI freebsd${major}-${image} image for ${abi}" . ${curdir}/tools/oci-image-${image}.conf -init_workdir() { +init_repo() { + local workdir=$1; shift local abi=$1; shift - local workdir=$(mktemp -d -t oci-images) - mkdir ${workdir}/repos + mkdir -p ${workdir}/repos cat > ${workdir}/repos/base.conf < ${workdir}/config.json + local config_hash=$(sha256 -q < ${workdir}/config.json) + local config_size=$(stat -f %z ${workdir}/config.json) + + echo "{\"schemaVersion\":2,\"mediaType\":\"application/vnd.oci.image.manifest.v1+json\",\"config\":{\"mediaType\":\"application/vnd.oci.image.config.v1+json\",\"digest\":\"sha256:${config_hash}\",\"size\":${config_size}},\"layers\":[{\"mediaType\":\"application/vnd.oci.image.layer.v1.tar+gzip\",\"digest\":\"sha256:${root_hash}\",\"size\":${root_size}}],\"annotations\":{}}" > ${workdir}/manifest.json + local manifest_hash=$(sha256 -q < ${workdir}/manifest.json) + local manifest_size=$(stat -f %z ${workdir}/manifest.json) + + mkdir -p ${workdir}/oci/blobs/sha256 + echo "{\"imageLayoutVersion\": \"1.0.0\"}" > ${workdir}/oci/oci-layout + echo "{\"schemaVersion\":2,\"manifests\":[{\"mediaType\":\"application/vnd.oci.image.manifest.v1+json\",\"digest\":\"sha256:${manifest_hash}\",\"size\":${manifest_size},\"annotations\":{\"org.opencontainers.image.ref.name\":\"freebsd-${image}:${ver}\"}}]}" > ${workdir}/oci/index.json + ln ${workdir}/rootfs.tar.gz ${workdir}/oci/blobs/sha256/${root_hash} + ln ${workdir}/config.json ${workdir}/oci/blobs/sha256/${config_hash} + ln ${workdir}/manifest.json ${workdir}/oci/blobs/sha256/${manifest_hash} + + tar -C ${workdir}/oci --xz --strip-components 1 --no-read-sparse -a -cf ${output} . +} + +# Prefix with "container-image-" so that we can create a unique work area under +# ${.OBJDIR}. We can assume that make has set our working directory to +# ${.OBJDIR}. +workdir=${PWD}/container-image-${image} +init_repo ${workdir} ${abi} + if [ -n "${OCI_BASE_IMAGE}" ]; then - base_image=freebsd${major}-${OCI_BASE_IMAGE} + base_workdir=${PWD}/container-image-${OCI_BASE_IMAGE} else - base_image=scratch + base_workdir= fi -c=$(buildah from --arch ${arch} ${base_image}) -m=$(buildah mount $c) +create_container ${workdir} ${base_workdir} oci_image_build -buildah unmount $c -buildah commit --rm $c freebsd${major}-${image}:latest +commit_container ${workdir} ${image} ${output} diff --git a/release/tools/oci-image-dynamic.conf b/release/tools/oci-image-dynamic.conf index b146ff2cf7c3..61cb90187764 100644 --- a/release/tools/oci-image-dynamic.conf +++ b/release/tools/oci-image-dynamic.conf @@ -7,5 +7,5 @@ OCI_BASE_IMAGE=static oci_image_build() { - install_packages ${abi} ${workdir} $m FreeBSD-clibs FreeBSD-openssl-lib + install_packages ${abi} ${workdir} FreeBSD-clibs FreeBSD-openssl-lib } diff --git a/release/tools/oci-image-minimal.conf b/release/tools/oci-image-minimal.conf index 82e2ce6a1bd3..93aad1e39250 100644 --- a/release/tools/oci-image-minimal.conf +++ b/release/tools/oci-image-minimal.conf @@ -8,7 +8,8 @@ OCI_BASE_IMAGE=dynamic oci_image_build() { - install_packages ${abi} ${workdir} $m \ + set_cmd ${workdir} /bin/sh + install_packages ${abi} ${workdir} \ FreeBSD-runtime \ FreeBSD-certctl \ FreeBSD-kerberos-lib \ diff --git a/release/tools/oci-image-static.conf b/release/tools/oci-image-static.conf index 552328e66f3c..753a03af653b 100644 --- a/release/tools/oci-image-static.conf +++ b/release/tools/oci-image-static.conf @@ -8,12 +8,13 @@ OCI_BASE_IMAGE= oci_image_build() { local srcdir=${curdir}/.. + local m=${workdir}/rootfs mtree -deU -p $m/ -f ${srcdir}/etc/mtree/BSD.root.dist > /dev/null mtree -deU -p $m/var -f ${srcdir}/etc/mtree/BSD.var.dist > /dev/null mtree -deU -p $m/usr -f ${srcdir}/etc/mtree/BSD.usr.dist > /dev/null mtree -deU -p $m/usr/include -f ${srcdir}/etc/mtree/BSD.include.dist > /dev/null mtree -deU -p $m/usr/lib -f ${srcdir}/etc/mtree/BSD.debug.dist > /dev/null - install_packages ${abi} ${workdir} $m FreeBSD-caroot FreeBSD-zoneinfo + install_packages ${abi} ${workdir} FreeBSD-caroot FreeBSD-zoneinfo cp ${srcdir}/etc/master.passwd $m/etc pwd_mkdb -p -d $m/etc $m/etc/master.passwd || return $? cp ${srcdir}/etc/group $m/etc || return $?