From owner-svn-src-stable-11@freebsd.org Mon Apr 13 00:50:36 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E35E2AE535; Mon, 13 Apr 2020 00:50:36 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 490qmC6jZzz3PQN; Mon, 13 Apr 2020 00:50:35 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E133CAB49; Mon, 13 Apr 2020 00:50:35 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03D0oZ7E095864; Mon, 13 Apr 2020 00:50:35 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03D0oZ00095863; Mon, 13 Apr 2020 00:50:35 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <202004130050.03D0oZ00095863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Mon, 13 Apr 2020 00:50:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359843 - in stable: 11/sys/dev/mii 12/sys/dev/mii X-SVN-Group: stable-11 X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in stable: 11/sys/dev/mii 12/sys/dev/mii X-SVN-Commit-Revision: 359843 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 00:50:36 -0000 Author: jhibbits Date: Mon Apr 13 00:50:35 2020 New Revision: 359843 URL: https://svnweb.freebsd.org/changeset/base/359843 Log: MFC r359756: Add support for BCM54618SE PHY Sponsored by: Juniper Networks, Inc Modified: stable/11/sys/dev/mii/brgphy.c stable/11/sys/dev/mii/miidevs Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/dev/mii/brgphy.c stable/12/sys/dev/mii/miidevs Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/dev/mii/brgphy.c ============================================================================== --- stable/11/sys/dev/mii/brgphy.c Mon Apr 13 00:38:02 2020 (r359842) +++ stable/11/sys/dev/mii/brgphy.c Mon Apr 13 00:50:35 2020 (r359843) @@ -150,6 +150,7 @@ static const struct mii_phydesc brgphys[] = { #ifdef notyet /* better handled by ukphy(4) until WARs are implemented */ MII_PHY_DESC(BROADCOM2, BCM5785), #endif + MII_PHY_DESC(BROADCOM3, BCM54618SE), MII_PHY_DESC(BROADCOM3, BCM5717C), MII_PHY_DESC(BROADCOM3, BCM5719C), MII_PHY_DESC(BROADCOM3, BCM5720C), Modified: stable/11/sys/dev/mii/miidevs ============================================================================== --- stable/11/sys/dev/mii/miidevs Mon Apr 13 00:38:02 2020 (r359842) +++ stable/11/sys/dev/mii/miidevs Mon Apr 13 00:50:35 2020 (r359843) @@ -190,6 +190,7 @@ model BROADCOM2 BCM5784 0x003a BCM5784 10/100/1000bas model BROADCOM2 BCM5709C 0x003c BCM5709 10/100/1000baseT PHY model BROADCOM2 BCM5761 0x003d BCM5761 10/100/1000baseT PHY model BROADCOM2 BCM5709S 0x003f BCM5709S/5720S 1000/2500baseSX PHY +model BROADCOM3 BCM54618SE 0x000d BCM54618SE 10/100/1000BASE-T PHY model BROADCOM3 BCM57780 0x0019 BCM57780 1000BASE-T media interface model BROADCOM3 BCM5717C 0x0020 BCM5717C 1000BASE-T media interface model BROADCOM3 BCM5719C 0x0022 BCM5719C 1000BASE-T media interface From owner-svn-src-stable-11@freebsd.org Mon Apr 13 08:28:03 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E6302B6DF0; Mon, 13 Apr 2020 08:28:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4911w26btSz4GWR; Mon, 13 Apr 2020 08:28:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DDAC518527; Mon, 13 Apr 2020 08:28:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03D8S2sO077084; Mon, 13 Apr 2020 08:28:02 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03D8S2eO077083; Mon, 13 Apr 2020 08:28:02 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004130828.03D8S2eO077083@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 13 Apr 2020 08:28:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359846 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 359846 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 08:28:03 -0000 Author: hselasky Date: Mon Apr 13 08:28:02 2020 New Revision: 359846 URL: https://svnweb.freebsd.org/changeset/base/359846 Log: MFC r359654: Ensure a minimum inline size of 16 bytes in mlx5en(4). This includes 14 bytes of ethernet header and 2 bytes of VLAN header. This allows for making assumptions about the inline size limit in the fast transmit path later on. Use a signed integer variable to catch underflow. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Apr 13 08:27:19 2020 (r359845) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Apr 13 08:28:02 2020 (r359846) @@ -3351,15 +3351,19 @@ mlx5e_check_required_hca_cap(struct mlx5_core_dev *mde static u16 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev) { - uint32_t bf_buf_size = (1U << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2U; + const int min_size = ETHER_VLAN_ENCAP_LEN + ETHER_HDR_LEN; + const int max_size = MLX5E_MAX_TX_INLINE; + const int bf_buf_size = + ((1U << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2U) - + (sizeof(struct mlx5e_tx_wqe) - 2); - bf_buf_size -= sizeof(struct mlx5e_tx_wqe) - 2; - - /* verify against driver hardware limit */ - if (bf_buf_size > MLX5E_MAX_TX_INLINE) - bf_buf_size = MLX5E_MAX_TX_INLINE; - - return (bf_buf_size); + /* verify against driver limits */ + if (bf_buf_size > max_size) + return (max_size); + else if (bf_buf_size < min_size) + return (min_size); + else + return (bf_buf_size); } static int From owner-svn-src-stable-11@freebsd.org Mon Apr 13 08:45:05 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF4D62B746C; Mon, 13 Apr 2020 08:45:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4912Hj59X9z4HyP; Mon, 13 Apr 2020 08:45:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 945E9188F1; Mon, 13 Apr 2020 08:45:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03D8j52D089869; Mon, 13 Apr 2020 08:45:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03D8j5dU089868; Mon, 13 Apr 2020 08:45:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004130845.03D8j5dU089868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 13 Apr 2020 08:45:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359850 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 359850 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 08:45:05 -0000 Author: hselasky Date: Mon Apr 13 08:45:05 2020 New Revision: 359850 URL: https://svnweb.freebsd.org/changeset/base/359850 Log: MFC r359655: Don't drop packets having too many TCP option headers in mlx5en(4). When using SACK it can happen there are multiple option headers. Don't drop these packets, but instead limit the amount of inlining to the maximum supported. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Mon Apr 13 08:42:13 2020 (r359849) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Mon Apr 13 08:45:05 2020 (r359850) @@ -357,18 +357,18 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp) if (likely(ihs == 0)) { /* nothing to inline */ - } else if (unlikely(ihs > sq->max_inline)) { - /* inline header size is too big */ - err = EINVAL; - goto tx_drop; } else if ((mb->m_flags & M_VLANTAG) != 0) { struct ether_vlan_header *eh = (struct ether_vlan_header *) wqe->eth.inline_hdr_start; /* Range checks */ - if (unlikely(ihs > (MLX5E_MAX_TX_INLINE - ETHER_VLAN_ENCAP_LEN))) - ihs = (MLX5E_MAX_TX_INLINE - ETHER_VLAN_ENCAP_LEN); - else if (unlikely(ihs < ETHER_HDR_LEN)) { + if (unlikely(ihs > (sq->max_inline - ETHER_VLAN_ENCAP_LEN))) { + if (mb->m_pkthdr.csum_flags & CSUM_TSO) { + err = EINVAL; + goto tx_drop; + } + ihs = (sq->max_inline - ETHER_VLAN_ENCAP_LEN); + } else if (unlikely(ihs < ETHER_HDR_LEN)) { err = EINVAL; goto tx_drop; } @@ -385,6 +385,14 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp) ihs += ETHER_VLAN_ENCAP_LEN; wqe->eth.inline_hdr_sz = cpu_to_be16(ihs); } else { + /* check if inline header size is too big */ + if (unlikely(ihs > sq->max_inline)) { + if (unlikely(mb->m_pkthdr.csum_flags & CSUM_TSO)) { + err = EINVAL; + goto tx_drop; + } + ihs = sq->max_inline; + } m_copydata(mb, 0, ihs, wqe->eth.inline_hdr_start); m_adj(mb, ihs); wqe->eth.inline_hdr_sz = cpu_to_be16(ihs); From owner-svn-src-stable-11@freebsd.org Mon Apr 13 08:58:36 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24F322B782D; Mon, 13 Apr 2020 08:58:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4912bJ094yz4JyY; Mon, 13 Apr 2020 08:58:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F02B818B06; Mon, 13 Apr 2020 08:58:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03D8wZnJ096055; Mon, 13 Apr 2020 08:58:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03D8wZc8096052; Mon, 13 Apr 2020 08:58:35 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004130858.03D8wZc8096052@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 13 Apr 2020 08:58:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359853 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 359853 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 08:58:36 -0000 Author: hselasky Date: Mon Apr 13 08:58:35 2020 New Revision: 359853 URL: https://svnweb.freebsd.org/changeset/base/359853 Log: MFC r359653: Count number of times transmit ring is out of buffers in mlx5en(4). Differential Revision: https://reviews.freebsd.org/D24273 Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Mon Apr 13 08:56:48 2020 (r359852) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Mon Apr 13 08:58:35 2020 (r359853) @@ -623,6 +623,7 @@ struct mlx5e_rq_stats { m(+1, u64, csum_offload_none, "csum_offload_none", "Transmitted packets") \ m(+1, u64, defragged, "defragged", "Transmitted packets") \ m(+1, u64, dropped, "dropped", "Transmitted packets") \ + m(+1, u64, enobuf, "enobuf", "Transmitted packets") \ m(+1, u64, nop, "nop", "Transmitted packets") #define MLX5E_SQ_STATS_NUM (0 MLX5E_SQ_STATS(MLX5E_STATS_COUNT)) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Mon Apr 13 08:56:48 2020 (r359852) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Mon Apr 13 08:58:35 2020 (r359853) @@ -265,8 +265,10 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp) u8 opcode; /* Return ENOBUFS if the queue is full */ - if (unlikely(!mlx5e_sq_has_room_for(sq, 2 * MLX5_SEND_WQE_MAX_WQEBBS))) + if (unlikely(!mlx5e_sq_has_room_for(sq, 2 * MLX5_SEND_WQE_MAX_WQEBBS))) { + sq->stats.enobuf++; return (ENOBUFS); + } /* Align SQ edge with NOPs to avoid WQE wrap around */ pi = ((~sq->pc) & sq->wq.sz_m1); @@ -274,8 +276,10 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp) /* Send one multi NOP message instead of many */ mlx5e_send_nop(sq, (pi + 1) * MLX5_SEND_WQEBB_NUM_DS); pi = ((~sq->pc) & sq->wq.sz_m1); - if (pi < (MLX5_SEND_WQE_MAX_WQEBBS - 1)) + if (pi < (MLX5_SEND_WQE_MAX_WQEBBS - 1)) { + sq->stats.enobuf++; return (ENOMEM); + } } /* Setup local variables */ From owner-svn-src-stable-11@freebsd.org Mon Apr 13 09:05:21 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF1472B7E3E; Mon, 13 Apr 2020 09:05:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4912l55BPsz4KnR; Mon, 13 Apr 2020 09:05:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA18518D27; Mon, 13 Apr 2020 09:05:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03D95LOn002380; Mon, 13 Apr 2020 09:05:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03D95LYS002360; Mon, 13 Apr 2020 09:05:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004130905.03D95LYS002360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 13 Apr 2020 09:05:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359857 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 359857 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 09:05:21 -0000 Author: hselasky Date: Mon Apr 13 09:05:21 2020 New Revision: 359857 URL: https://svnweb.freebsd.org/changeset/base/359857 Log: MFC r359723: Remove obsolete bufring stats in mlx5en(4). Leftover from when DRBR was removed. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Mon Apr 13 09:04:32 2020 (r359856) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Mon Apr 13 09:05:21 2020 (r359857) @@ -816,7 +816,6 @@ struct mlx5e_sq { /* pointers to per packet info: write@xmit, read@completion */ struct mlx5e_sq_mbuf *mbuf; - struct buf_ring *br; /* read only */ struct mlx5_wq_cyc wq; Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Apr 13 09:04:32 2020 (r359856) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Apr 13 09:05:21 2020 (r359857) @@ -837,7 +837,6 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) struct mlx5_core_dev *mdev = priv->mdev; struct mlx5e_vport_stats *s = &priv->stats.vport; struct mlx5e_sq_stats *sq_stats; - struct buf_ring *sq_br; #if (__FreeBSD_version < 1100000) struct ifnet *ifp = priv->ifp; #endif @@ -887,13 +886,10 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) for (j = 0; j < priv->num_tc; j++) { sq_stats = &pch->sq[j].stats; - sq_br = pch->sq[j].br; tso_packets += sq_stats->tso_packets; tso_bytes += sq_stats->tso_bytes; tx_queue_dropped += sq_stats->dropped; - if (sq_br != NULL) - tx_queue_dropped += sq_br->br_drops; tx_defragged += sq_stats->defragged; tx_offload_none += sq_stats->csum_offload_none; } From owner-svn-src-stable-11@freebsd.org Mon Apr 13 09:09:29 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 200912B81E3; Mon, 13 Apr 2020 09:09:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4912qr74Pyz4LFf; Mon, 13 Apr 2020 09:09:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDF8618D2B; Mon, 13 Apr 2020 09:09:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03D99Sdq002733; Mon, 13 Apr 2020 09:09:28 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03D99SaP002732; Mon, 13 Apr 2020 09:09:28 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004130909.03D99SaP002732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 13 Apr 2020 09:09:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359859 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 359859 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 09:09:29 -0000 Author: hselasky Date: Mon Apr 13 09:09:28 2020 New Revision: 359859 URL: https://svnweb.freebsd.org/changeset/base/359859 Log: MFC r359724: Account out of buffer as dropped packets in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Apr 13 09:08:47 2020 (r359858) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Apr 13 09:09:28 2020 (r359859) @@ -890,6 +890,7 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) tso_packets += sq_stats->tso_packets; tso_bytes += sq_stats->tso_bytes; tx_queue_dropped += sq_stats->dropped; + tx_queue_dropped += sq_stats->enobuf; tx_defragged += sq_stats->defragged; tx_offload_none += sq_stats->csum_offload_none; } From owner-svn-src-stable-11@freebsd.org Mon Apr 13 13:33:24 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E60022BE8BC; Mon, 13 Apr 2020 13:33:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4918hN5kQ8z4c5Y; Mon, 13 Apr 2020 13:33:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF7B31C159; Mon, 13 Apr 2020 13:33:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03DDXO9k080841; Mon, 13 Apr 2020 13:33:24 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03DDXONb080840; Mon, 13 Apr 2020 13:33:24 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202004131333.03DDXONb080840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 13 Apr 2020 13:33:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359861 - stable/11/sys/cam/scsi X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam/scsi X-SVN-Commit-Revision: 359861 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 13:33:25 -0000 Author: mav Date: Mon Apr 13 13:33:24 2020 New Revision: 359861 URL: https://svnweb.freebsd.org/changeset/base/359861 Log: MFC r359662: Relax too strict SES element descriptors check in r355430. SES specifications allows the string to be NULL-terminated, while previous code was considering it as invalid due to incorrectly ordered conditions. Modified: stable/11/sys/cam/scsi/scsi_enc_ses.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_enc_ses.c Mon Apr 13 13:33:01 2020 (r359860) +++ stable/11/sys/cam/scsi/scsi_enc_ses.c Mon Apr 13 13:33:24 2020 (r359861) @@ -2002,11 +2002,11 @@ ses_sanitize_elm_desc(const char *desc, uint16_t *len) int i; for (i = 0; i < *len; i++) { - if (desc[i] < 0x20 || desc[i] > 0x7e) { + if (desc[i] == 0) { + break; + } else if (desc[i] < 0x20 || desc[i] > 0x7e) { *len = strlen(invalid); return (invalid); - } else if (desc[i] == 0) { - break; } } return (desc); From owner-svn-src-stable-11@freebsd.org Mon Apr 13 14:44:45 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 21ABD2C0216; Mon, 13 Apr 2020 14:44:45 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 491BGj05xDz3CKq; Mon, 13 Apr 2020 14:44:45 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F2A011CF0D; Mon, 13 Apr 2020 14:44:44 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03DEiied023951; Mon, 13 Apr 2020 14:44:44 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03DEiiSo023950; Mon, 13 Apr 2020 14:44:44 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <202004131444.03DEiiSo023950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Mon, 13 Apr 2020 14:44:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359864 - stable/11/usr.bin/calendar/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: stable/11/usr.bin/calendar/tests X-SVN-Commit-Revision: 359864 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 14:44:45 -0000 Author: lwhsu Date: Mon Apr 13 14:44:44 2020 New Revision: 359864 URL: https://svnweb.freebsd.org/changeset/base/359864 Log: MFC r359862: Install expected output file of test missed in r359585 Sponsored by: The FreeBSD Foundation Modified: stable/11/usr.bin/calendar/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/calendar/tests/Makefile ============================================================================== --- stable/11/usr.bin/calendar/tests/Makefile Mon Apr 13 14:43:35 2020 (r359863) +++ stable/11/usr.bin/calendar/tests/Makefile Mon Apr 13 14:44:44 2020 (r359864) @@ -19,6 +19,7 @@ ${PACKAGE}FILES+= regress.s1.out ${PACKAGE}FILES+= regress.s2.out ${PACKAGE}FILES+= regress.s3.out ${PACKAGE}FILES+= regress.s4.out +${PACKAGE}FILES+= regress.s5.out ${PACKAGE}FILES+= regress.sh ${PACKAGE}FILES+= regress.w0-1.out ${PACKAGE}FILES+= regress.w0-2.out From owner-svn-src-stable-11@freebsd.org Mon Apr 13 16:19:12 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AA7B2C256E; Mon, 13 Apr 2020 16:19:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 491DMh3fV7z3KW3; Mon, 13 Apr 2020 16:19:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 78AA11E1F2; Mon, 13 Apr 2020 16:19:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03DGJCTN080407; Mon, 13 Apr 2020 16:19:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03DGJC4X080406; Mon, 13 Apr 2020 16:19:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004131619.03DGJC4X080406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 13 Apr 2020 16:19:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359868 - stable/11/sys/dev/sound/usb X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/sound/usb X-SVN-Commit-Revision: 359868 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 16:19:12 -0000 Author: hselasky Date: Mon Apr 13 16:19:12 2020 New Revision: 359868 URL: https://svnweb.freebsd.org/changeset/base/359868 Log: MFC r359320: Avoid scaling USB audio mixer values twice. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/sound/usb/uaudio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/11/sys/dev/sound/usb/uaudio.c Mon Apr 13 16:18:38 2020 (r359867) +++ stable/11/sys/dev/sound/usb/uaudio.c Mon Apr 13 16:19:12 2020 (r359868) @@ -552,10 +552,7 @@ static void uaudio_mixer_add_ctl(struct uaudio_softc * struct uaudio_mixer_node *); static void uaudio_mixer_fill_info(struct uaudio_softc *, struct usb_device *, void *); -static void uaudio_mixer_ctl_set(struct uaudio_softc *, - struct uaudio_mixer_node *, uint8_t, int32_t val); static int uaudio_mixer_signext(uint8_t, int); -static int uaudio_mixer_bsd2value(struct uaudio_mixer_node *, int32_t val); static void uaudio_mixer_init(struct uaudio_softc *); static const struct uaudio_terminal_node *uaudio_mixer_get_input( const struct uaudio_terminal_node *, uint8_t); @@ -5373,7 +5370,7 @@ uaudio_mixer_signext(uint8_t type, int val) } static int -uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, int32_t val) +uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, int val) { if (mc->type == MIX_ON_OFF) { val = (val != 0); @@ -5385,7 +5382,7 @@ uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, i } else { /* compute actual volume */ - val = (val * mc->mul) / 255; + val = (val * mc->mul) / 100; /* add lower offset */ val = val + mc->minval; @@ -5404,7 +5401,7 @@ uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, i static void uaudio_mixer_ctl_set(struct uaudio_softc *sc, struct uaudio_mixer_node *mc, - uint8_t chan, int32_t val) + uint8_t chan, int val) { val = uaudio_mixer_bsd2value(mc, val); @@ -5493,8 +5490,7 @@ uaudio_mixer_set(struct uaudio_softc *sc, unsigned typ if (mc->ctl == type) { for (chan = 0; chan < mc->nchan; chan++) { uaudio_mixer_ctl_set(sc, mc, chan, - (int)((chan == 0 ? left : right) * - 255) / 100); + chan == 0 ? left : right); } } } From owner-svn-src-stable-11@freebsd.org Mon Apr 13 16:21:39 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B3F52C285E; Mon, 13 Apr 2020 16:21:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 491DQW2HwWz3L57; Mon, 13 Apr 2020 16:21:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A1311E261; Mon, 13 Apr 2020 16:21:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03DGLdKO080766; Mon, 13 Apr 2020 16:21:39 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03DGLdZf080765; Mon, 13 Apr 2020 16:21:39 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004131621.03DGLdZf080765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 13 Apr 2020 16:21:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359871 - stable/11/sys/dev/sound/usb X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/sound/usb X-SVN-Commit-Revision: 359871 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 16:21:39 -0000 Author: hselasky Date: Mon Apr 13 16:21:38 2020 New Revision: 359871 URL: https://svnweb.freebsd.org/changeset/base/359871 Log: MFC r359321: Factor out USB audio mixer value range check. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/sound/usb/uaudio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/11/sys/dev/sound/usb/uaudio.c Mon Apr 13 16:21:03 2020 (r359870) +++ stable/11/sys/dev/sound/usb/uaudio.c Mon Apr 13 16:21:38 2020 (r359871) @@ -5374,25 +5374,19 @@ uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, i { if (mc->type == MIX_ON_OFF) { val = (val != 0); - } else if (mc->type == MIX_SELECTOR) { - if ((val < mc->minval) || - (val > mc->maxval)) { - val = mc->minval; - } - } else { + } else if (mc->type != MIX_SELECTOR) { /* compute actual volume */ val = (val * mc->mul) / 100; /* add lower offset */ val = val + mc->minval; - - /* make sure we don't write a value out of range */ - if (val > mc->maxval) - val = mc->maxval; - else if (val < mc->minval) - val = mc->minval; } + /* make sure we don't write a value out of range */ + if (val > mc->maxval) + val = mc->maxval; + else if (val < mc->minval) + val = mc->minval; DPRINTFN(6, "type=0x%03x val=%d min=%d max=%d val=%d\n", mc->type, val, mc->minval, mc->maxval, val); From owner-svn-src-stable-11@freebsd.org Mon Apr 13 16:23:46 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6EAA2C29E8; Mon, 13 Apr 2020 16:23:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 491DSy4w1kz3LVq; Mon, 13 Apr 2020 16:23:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3C841E3EC; Mon, 13 Apr 2020 16:23:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03DGNkw1086551; Mon, 13 Apr 2020 16:23:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03DGNkD1086550; Mon, 13 Apr 2020 16:23:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004131623.03DGNkD1086550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 13 Apr 2020 16:23:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359874 - stable/11/sys/dev/sound/usb X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/sound/usb X-SVN-Commit-Revision: 359874 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 16:23:46 -0000 Author: hselasky Date: Mon Apr 13 16:23:46 2020 New Revision: 359874 URL: https://svnweb.freebsd.org/changeset/base/359874 Log: MFC r359322: Make mute controls available for USB audio mixers. Submitted by: Horse Ma Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/sound/usb/uaudio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/11/sys/dev/sound/usb/uaudio.c Mon Apr 13 16:23:10 2020 (r359873) +++ stable/11/sys/dev/sound/usb/uaudio.c Mon Apr 13 16:23:46 2020 (r359874) @@ -3573,7 +3573,7 @@ uaudio_mixer_add_feature(struct uaudio_softc *sc, switch (ctl) { case MUTE_CONTROL: MIX(sc).type = MIX_ON_OFF; - MIX(sc).ctl = SOUND_MIXER_NRDEVICES; + MIX(sc).ctl = SOUND_MIXER_MUTE; MIX(sc).name = "mute"; break; @@ -3688,7 +3688,7 @@ uaudio20_mixer_add_feature(struct uaudio_softc *sc, switch (ctl) { case (3 << 0): MIX(sc).type = MIX_ON_OFF; - MIX(sc).ctl = SOUND_MIXER_NRDEVICES; + MIX(sc).ctl = SOUND_MIXER_MUTE; MIX(sc).name = "mute"; what = MUTE_CONTROL; break; From owner-svn-src-stable-11@freebsd.org Mon Apr 13 16:25:45 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1403A2C2B4A; Mon, 13 Apr 2020 16:25:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 491DWD6jBSz3Lrn; Mon, 13 Apr 2020 16:25:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C77811E3EF; Mon, 13 Apr 2020 16:25:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03DGPifG086862; Mon, 13 Apr 2020 16:25:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03DGPiNI086861; Mon, 13 Apr 2020 16:25:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004131625.03DGPiNI086861@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 13 Apr 2020 16:25:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359877 - stable/11/sys/dev/sound/usb X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/sound/usb X-SVN-Commit-Revision: 359877 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 16:25:45 -0000 Author: hselasky Date: Mon Apr 13 16:25:44 2020 New Revision: 359877 URL: https://svnweb.freebsd.org/changeset/base/359877 Log: MFC r359323: Be more intelligent when classifying USB audio terminal types, so that we don't end up using SOUND_MIXER_VOLUME for all undefined types. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/sound/usb/uaudio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/11/sys/dev/sound/usb/uaudio.c Mon Apr 13 16:25:11 2020 (r359876) +++ stable/11/sys/dev/sound/usb/uaudio.c Mon Apr 13 16:25:44 2020 (r359877) @@ -4509,52 +4509,61 @@ static const struct uaudio_tt_to_feature uaudio_tt_to_ {UATF_MULTITRACK, SOUND_MIXER_VOLUME}, {0xffff, SOUND_MIXER_VOLUME}, - /* default */ - {0x0000, SOUND_MIXER_VOLUME}, + /* end */ + {} }; static uint16_t -uaudio_mixer_feature_name(const struct uaudio_terminal_node *iot, - struct uaudio_mixer_node *mix) +uaudio_mixer_feature_name_sub(uint16_t terminal_type) { const struct uaudio_tt_to_feature *uat = uaudio_tt_to_feature; - uint16_t terminal_type = uaudio_mixer_determine_class(iot, mix); + uint16_t retval; - if ((mix->class == UAC_RECORD) && (terminal_type == 0)) { - return (SOUND_MIXER_IMIX); - } - while (uat->terminal_type) { - if (uat->terminal_type == terminal_type) { - break; + while (1) { + if (uat->terminal_type == 0) { + switch (terminal_type >> 8) { + case UATI_UNDEFINED >> 8: + retval = SOUND_MIXER_RECLEV; + goto done; + case UATO_UNDEFINED >> 8: + retval = SOUND_MIXER_PCM; + goto done; + default: + retval = SOUND_MIXER_VOLUME; + goto done; + } + } else if (uat->terminal_type == terminal_type) { + retval = uat->feature; + goto done; } uat++; } - +done: DPRINTF("terminal_type=0x%04x -> %d\n", - terminal_type, uat->feature); + terminal_type, retval); + return (retval); +} - return (uat->feature); +static uint16_t +uaudio_mixer_feature_name(const struct uaudio_terminal_node *iot, + struct uaudio_mixer_node *mix) +{ + uint16_t terminal_type = uaudio_mixer_determine_class(iot, mix); + + if (mix->class == UAC_RECORD && terminal_type == 0) + return (SOUND_MIXER_IMIX); + return (uaudio_mixer_feature_name_sub(terminal_type)); } static uint16_t uaudio20_mixer_feature_name(const struct uaudio_terminal_node *iot, struct uaudio_mixer_node *mix) { - const struct uaudio_tt_to_feature *uat; uint16_t terminal_type = uaudio20_mixer_determine_class(iot, mix); - if ((mix->class == UAC_RECORD) && (terminal_type == 0)) + if (mix->class == UAC_RECORD && terminal_type == 0) return (SOUND_MIXER_IMIX); - - for (uat = uaudio_tt_to_feature; uat->terminal_type != 0; uat++) { - if (uat->terminal_type == terminal_type) - break; - } - - DPRINTF("terminal_type=0x%04x -> %d\n", - terminal_type, uat->feature); - - return (uat->feature); + return (uaudio_mixer_feature_name_sub(terminal_type)); } static const struct uaudio_terminal_node * From owner-svn-src-stable-11@freebsd.org Mon Apr 13 16:27:40 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B78182C2CCE; Mon, 13 Apr 2020 16:27:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 491DYS4rWnz3MD9; Mon, 13 Apr 2020 16:27:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A15051E3F2; Mon, 13 Apr 2020 16:27:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03DGReJ8087140; Mon, 13 Apr 2020 16:27:40 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03DGRehw087139; Mon, 13 Apr 2020 16:27:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004131627.03DGRehw087139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 13 Apr 2020 16:27:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359880 - stable/11/sys/dev/sound/usb X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/sound/usb X-SVN-Commit-Revision: 359880 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 16:27:40 -0000 Author: hselasky Date: Mon Apr 13 16:27:40 2020 New Revision: 359880 URL: https://svnweb.freebsd.org/changeset/base/359880 Log: MFC r359355: Improve USB audio mixer support for USB audio class 1 and 2. - make sure volume controls are correctly mapped to "pcm" and "rec" depending on how they deliver audio to the USB host. - make sure there are no duplicate record selections. - remove internal only mixer class type. - don't add software volume controls for recording only. - some minor mixer code cleanup. Tested by: Horse Ma Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/sound/usb/uaudio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/11/sys/dev/sound/usb/uaudio.c Mon Apr 13 16:27:05 2020 (r359879) +++ stable/11/sys/dev/sound/usb/uaudio.c Mon Apr 13 16:27:40 2020 (r359880) @@ -192,7 +192,6 @@ struct uaudio_mixer_node { #define MAX_SELECTOR_INPUT_PIN 256 uint8_t slctrtype[MAX_SELECTOR_INPUT_PIN]; - uint8_t class; uint8_t val_default; uint8_t desc[64]; @@ -453,19 +452,6 @@ static const struct uaudio_format uaudio20_formats[] = {0, 0, 0, NULL} }; -#define UAC_OUTPUT 0 -#define UAC_INPUT 1 -#define UAC_EQUAL 2 -#define UAC_RECORD 3 -#define UAC_NCLASSES 4 - -#ifdef USB_DEBUG -static const char *uac_names[] = { - "outputs", "inputs", "equalization", "record" -}; - -#endif - /* prototypes */ static device_probe_t uaudio_probe; @@ -509,10 +495,7 @@ static void uaudio_mixer_add_extension(struct uaudio_s const struct uaudio_terminal_node *, int); static struct usb_audio_cluster uaudio_mixer_get_cluster(uint8_t, const struct uaudio_terminal_node *); -static uint16_t uaudio_mixer_determine_class(const struct uaudio_terminal_node *, - struct uaudio_mixer_node *); -static uint16_t uaudio_mixer_feature_name(const struct uaudio_terminal_node *, - struct uaudio_mixer_node *); +static uint16_t uaudio_mixer_determine_class(const struct uaudio_terminal_node *); static void uaudio_mixer_find_inputs_sub(struct uaudio_terminal_node *, const uint8_t *, uint8_t, struct uaudio_search_result *); static const void *uaudio_mixer_verify_desc(const void *, uint32_t); @@ -530,10 +513,7 @@ static void uaudio20_mixer_add_feature(struct uaudio_s const struct uaudio_terminal_node *, int); static struct usb_audio20_cluster uaudio20_mixer_get_cluster(uint8_t, const struct uaudio_terminal_node *); -static uint16_t uaudio20_mixer_determine_class(const struct uaudio_terminal_node *, - struct uaudio_mixer_node *); -static uint16_t uaudio20_mixer_feature_name(const struct uaudio_terminal_node *, - struct uaudio_mixer_node *); +static uint16_t uaudio20_mixer_determine_class(const struct uaudio_terminal_node *); static void uaudio20_mixer_find_inputs_sub(struct uaudio_terminal_node *, const uint8_t *, uint8_t, struct uaudio_search_result *); static const void *uaudio20_mixer_verify_desc(const void *, uint32_t); @@ -554,12 +534,6 @@ static void uaudio_mixer_fill_info(struct uaudio_softc struct usb_device *, void *); static int uaudio_mixer_signext(uint8_t, int); static void uaudio_mixer_init(struct uaudio_softc *); -static const struct uaudio_terminal_node *uaudio_mixer_get_input( - const struct uaudio_terminal_node *, uint8_t); -static const struct uaudio_terminal_node *uaudio_mixer_get_output( - const struct uaudio_terminal_node *, uint8_t); -static void uaudio_mixer_find_outputs_sub(struct uaudio_terminal_node *, - uint8_t, uint8_t, struct uaudio_search_result *); static uint8_t umidi_convert_to_usb(struct umidi_sub_chan *, uint8_t, uint8_t); static struct umidi_sub_chan *umidi_sub_by_fifo(struct usb_fifo *); static void umidi_start_read(struct usb_fifo *); @@ -1136,7 +1110,8 @@ uaudio_attach_sub(device_t dev, kobj_class_t mixer_cla DPRINTF("hardware has swapped left and right\n"); /* uaudio_pcm_setflags(dev, SD_F_PSWAPLR); */ } - if (!(sc->sc_mix_info & SOUND_MASK_PCM)) { + if (sc->sc_play_chan.num_alt > 0 && + (sc->sc_mix_info & SOUND_MASK_PCM) == 0) { DPRINTF("emulating master volume\n"); @@ -2960,7 +2935,6 @@ uaudio_mixer_controls_create_ftu(struct uaudio_softc * memset(&MIX(sc), 0, sizeof(MIX(sc))); MIX(sc).wIndex = MAKE_WORD(6, sc->sc_mixer_iface_no); MIX(sc).wValue[0] = MAKE_WORD(8, 0); - MIX(sc).class = UAC_OUTPUT; MIX(sc).type = MIX_UNSIGNED_16; MIX(sc).ctl = SOUND_MIXER_NRDEVICES; MIX(sc).name = "effect"; @@ -3007,7 +2981,6 @@ uaudio_mixer_controls_create_ftu(struct uaudio_softc * memset(&MIX(sc), 0, sizeof(MIX(sc))); MIX(sc).wIndex = MAKE_WORD(6, sc->sc_mixer_iface_no); MIX(sc).wValue[0] = MAKE_WORD(2, 0); - MIX(sc).class = UAC_OUTPUT; MIX(sc).type = MIX_SIGNED_8; MIX(sc).ctl = SOUND_MIXER_NRDEVICES; MIX(sc).name = "effect_vol"; @@ -3024,7 +2997,6 @@ uaudio_mixer_controls_create_ftu(struct uaudio_softc * memset(&MIX(sc), 0, sizeof(MIX(sc))); MIX(sc).wIndex = MAKE_WORD(6, sc->sc_mixer_iface_no); MIX(sc).wValue[0] = MAKE_WORD(3, 0); - MIX(sc).class = UAC_OUTPUT; MIX(sc).type = MIX_SIGNED_16; MIX(sc).ctl = SOUND_MIXER_NRDEVICES; MIX(sc).name = "effect_dur"; @@ -3041,7 +3013,6 @@ uaudio_mixer_controls_create_ftu(struct uaudio_softc * memset(&MIX(sc), 0, sizeof(MIX(sc))); MIX(sc).wIndex = MAKE_WORD(6, sc->sc_mixer_iface_no); MIX(sc).wValue[0] = MAKE_WORD(4, 0); - MIX(sc).class = UAC_OUTPUT; MIX(sc).type = MIX_SIGNED_8; MIX(sc).ctl = SOUND_MIXER_NRDEVICES; MIX(sc).name = "effect_fb"; @@ -3163,12 +3134,7 @@ uaudio_mixer_add_ctl(struct uaudio_softc *sc, struct u { int32_t res; - if (mc->class < UAC_NCLASSES) { - DPRINTF("adding %s.%d\n", - uac_names[mc->class], mc->ctl); - } else { - DPRINTF("adding %d\n", mc->ctl); - } + DPRINTF("adding %d\n", mc->ctl); if (mc->type == MIX_ON_OFF) { mc->minval = 0; @@ -3260,7 +3226,6 @@ uaudio_mixer_add_mixer(struct uaudio_softc *sc, memset(&MIX(sc), 0, sizeof(MIX(sc))); MIX(sc).wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); - uaudio_mixer_determine_class(&iot[id], &MIX(sc)); MIX(sc).type = MIX_SIGNED_16; if (uaudio_mixer_verify_desc(d0, ((ichs * ochs) + 7) / 8) == NULL) @@ -3339,7 +3304,6 @@ uaudio20_mixer_add_mixer(struct uaudio_softc *sc, memset(&MIX(sc), 0, sizeof(MIX(sc))); MIX(sc).wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); - uaudio20_mixer_determine_class(&iot[id], &MIX(sc)); MIX(sc).type = MIX_SIGNED_16; if (uaudio20_mixer_verify_desc(d0, ((ichs * ochs) + 7) / 8) == NULL) @@ -3379,6 +3343,58 @@ uaudio20_mixer_add_mixer(struct uaudio_softc *sc, } static void +uaudio_mixer_check_selectors(struct uaudio_softc *sc) +{ + uint8_t reserve_feature[] = { + SOUND_MIXER_LINE, + SOUND_MIXER_LINE1, + SOUND_MIXER_LINE2, + SOUND_MIXER_LINE3, + SOUND_MIXER_DIGITAL1, + SOUND_MIXER_DIGITAL2, + SOUND_MIXER_DIGITAL3, + }; + const uint16_t reserve_max = + sizeof(reserve_feature) / sizeof(reserve_feature[0]); + uint16_t i; + uint16_t j; + uint16_t k; + + /* remove existing selector types from the reserve */ + for (i = 0; i < MIX(sc).maxval; i++) { + if (MIX(sc).slctrtype[i] == SOUND_MIXER_NRDEVICES) + continue; + for (j = 0; j != reserve_max; j++) { + if (reserve_feature[j] == MIX(sc).slctrtype[i]) + reserve_feature[j] = SOUND_MIXER_NRDEVICES; + } + } + + /* make sure selector types are not overlapping */ + for (i = 0; i < MIX(sc).maxval; i++) { + if (MIX(sc).slctrtype[i] == SOUND_MIXER_NRDEVICES) + continue; + for (j = i + 1; j < MIX(sc).maxval; j++) { + if (MIX(sc).slctrtype[j] == SOUND_MIXER_NRDEVICES) + continue; + if (MIX(sc).slctrtype[i] != MIX(sc).slctrtype[j]) + continue; + for (k = 0; k != reserve_max; k++) { + if (reserve_feature[k] == SOUND_MIXER_NRDEVICES) + continue; + MIX(sc).slctrtype[j] = reserve_feature[k]; + reserve_feature[k] = SOUND_MIXER_NRDEVICES; + break; + } + if (k == reserve_max) { + DPRINTF("Selector type %d is not selectable!\n", j); + MIX(sc).slctrtype[j] = SOUND_MIXER_NRDEVICES; + } + } + } +} + +static void uaudio_mixer_add_selector(struct uaudio_softc *sc, const struct uaudio_terminal_node *iot, int id) { @@ -3395,7 +3411,6 @@ uaudio_mixer_add_selector(struct uaudio_softc *sc, MIX(sc).wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); MIX(sc).wValue[0] = MAKE_WORD(0, 0); - uaudio_mixer_determine_class(&iot[id], &MIX(sc)); MIX(sc).nchan = 1; MIX(sc).type = MIX_SELECTOR; MIX(sc).ctl = SOUND_MIXER_NRDEVICES; @@ -3410,21 +3425,19 @@ uaudio_mixer_add_selector(struct uaudio_softc *sc, MIX(sc).desc[0] = 0; } - if (MIX(sc).maxval > MAX_SELECTOR_INPUT_PIN) { + if (MIX(sc).maxval > MAX_SELECTOR_INPUT_PIN) MIX(sc).maxval = MAX_SELECTOR_INPUT_PIN; - } - MIX(sc).mul = (MIX(sc).maxval - MIX(sc).minval); - for (i = 0; i < MAX_SELECTOR_INPUT_PIN; i++) { - MIX(sc).slctrtype[i] = SOUND_MIXER_NRDEVICES; - } + MIX(sc).mul = MIX(sc).maxval - MIX(sc).minval; + for (i = 0; i < MIX(sc).maxval; i++) { - MIX(sc).slctrtype[i] = uaudio_mixer_feature_name( - &iot[d->baSourceId[i]], &MIX(sc)); + MIX(sc).slctrtype[i] = + uaudio_mixer_determine_class(&iot[d->baSourceId[i]]); } + for (; i < MAX_SELECTOR_INPUT_PIN; i++) + MIX(sc).slctrtype[i] = SOUND_MIXER_NRDEVICES; - MIX(sc).class = 0; /* not used */ - + uaudio_mixer_check_selectors(sc); uaudio_mixer_add_ctl(sc, &MIX(sc)); } @@ -3445,7 +3458,6 @@ uaudio20_mixer_add_selector(struct uaudio_softc *sc, MIX(sc).wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); MIX(sc).wValue[0] = MAKE_WORD(0, 0); - uaudio20_mixer_determine_class(&iot[id], &MIX(sc)); MIX(sc).nchan = 1; MIX(sc).type = MIX_SELECTOR; MIX(sc).ctl = SOUND_MIXER_NRDEVICES; @@ -3463,17 +3475,16 @@ uaudio20_mixer_add_selector(struct uaudio_softc *sc, if (MIX(sc).maxval > MAX_SELECTOR_INPUT_PIN) MIX(sc).maxval = MAX_SELECTOR_INPUT_PIN; - MIX(sc).mul = (MIX(sc).maxval - MIX(sc).minval); - for (i = 0; i < MAX_SELECTOR_INPUT_PIN; i++) - MIX(sc).slctrtype[i] = SOUND_MIXER_NRDEVICES; + MIX(sc).mul = MIX(sc).maxval - MIX(sc).minval; for (i = 0; i < MIX(sc).maxval; i++) { - MIX(sc).slctrtype[i] = uaudio20_mixer_feature_name( - &iot[d->baSourceId[i]], &MIX(sc)); + MIX(sc).slctrtype[i] = + uaudio20_mixer_determine_class(&iot[d->baSourceId[i]]); } + for (; i < MAX_SELECTOR_INPUT_PIN; i++) + MIX(sc).slctrtype[i] = SOUND_MIXER_NRDEVICES; - MIX(sc).class = 0; /* not used */ - + uaudio_mixer_check_selectors(sc); uaudio_mixer_add_ctl(sc, &MIX(sc)); } @@ -3534,9 +3545,9 @@ uaudio_mixer_add_feature(struct uaudio_softc *sc, cmask |= uaudio_mixer_feature_get_bmaControls(d, chan); } - if (nchan > MIX_MAX_CHAN) { + if (nchan > MIX_MAX_CHAN) nchan = MIX_MAX_CHAN; - } + MIX(sc).wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); i = d->bmaControls[d->bControlSize]; @@ -3568,7 +3579,7 @@ uaudio_mixer_add_feature(struct uaudio_softc *sc, continue; } - mixernumber = uaudio_mixer_feature_name(&iot[id], &MIX(sc)); + mixernumber = uaudio_mixer_determine_class(&iot[id]); switch (ctl) { case MUTE_CONTROL: @@ -3683,7 +3694,7 @@ uaudio20_mixer_add_feature(struct uaudio_softc *sc, for (ctl = 3; ctl != 0; ctl <<= 2) { - mixernumber = uaudio20_mixer_feature_name(&iot[id], &MIX(sc)); + mixernumber = uaudio20_mixer_determine_class(&iot[id]); switch (ctl) { case (3 << 0): @@ -3806,7 +3817,6 @@ uaudio_mixer_add_processing_updown(struct uaudio_softc MIX(sc).wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); MIX(sc).nchan = 1; MIX(sc).wValue[0] = MAKE_WORD(UD_MODE_SELECT_CONTROL, 0); - uaudio_mixer_determine_class(&iot[id], &MIX(sc)); MIX(sc).type = MIX_ON_OFF; /* XXX */ for (i = 0; i < ud->bNrModes; i++) { @@ -3840,7 +3850,6 @@ uaudio_mixer_add_processing(struct uaudio_softc *sc, MIX(sc).wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); MIX(sc).nchan = 1; MIX(sc).wValue[0] = MAKE_WORD(XX_ENABLE_CONTROL, 0); - uaudio_mixer_determine_class(&iot[id], &MIX(sc)); MIX(sc).type = MIX_ON_OFF; uaudio_mixer_add_ctl(sc, &MIX(sc)); } @@ -3885,7 +3894,6 @@ uaudio_mixer_add_extension(struct uaudio_softc *sc, MIX(sc).wIndex = MAKE_WORD(d0->bUnitId, sc->sc_mixer_iface_no); MIX(sc).nchan = 1; MIX(sc).wValue[0] = MAKE_WORD(UA_EXT_ENABLE, 0); - uaudio_mixer_determine_class(&iot[id], &MIX(sc)); MIX(sc).type = MIX_ON_OFF; uaudio_mixer_add_ctl(sc, &MIX(sc)); @@ -4315,114 +4323,42 @@ done: return (r); } -static uint16_t -uaudio_mixer_determine_class(const struct uaudio_terminal_node *iot, - struct uaudio_mixer_node *mix) +static bool +uaudio_mixer_foreach_input(const struct uaudio_terminal_node *iot, uint8_t *pindex) { - uint16_t terminal_type = 0x0000; - const struct uaudio_terminal_node *input[2]; - const struct uaudio_terminal_node *output[2]; + uint8_t n; - input[0] = uaudio_mixer_get_input(iot, 0); - input[1] = uaudio_mixer_get_input(iot, 1); + n = *pindex; - output[0] = uaudio_mixer_get_output(iot, 0); - output[1] = uaudio_mixer_get_output(iot, 1); - - /* - * check if there is only - * one output terminal: - */ - if (output[0] && (!output[1])) { - terminal_type = - UGETW(output[0]->u.ot_v1->wTerminalType); + while (1) { + if (!n--) + n = iot->usr.id_max; + if (n == 0) + return (false); + if (iot->usr.bit_input[n / 8] & (1 << (n % 8))) + break; } - /* - * If the only output terminal is USB, - * the class is UAC_RECORD. - */ - if ((terminal_type & 0xff00) == (UAT_UNDEFINED & 0xff00)) { - - mix->class = UAC_RECORD; - if (input[0] && (!input[1])) { - terminal_type = - UGETW(input[0]->u.it_v1->wTerminalType); - } else { - terminal_type = 0; - } - goto done; - } - /* - * if the unit is connected to just - * one input terminal, the - * class is UAC_INPUT: - */ - if (input[0] && (!input[1])) { - mix->class = UAC_INPUT; - terminal_type = - UGETW(input[0]->u.it_v1->wTerminalType); - goto done; - } - /* - * Otherwise, the class is UAC_OUTPUT. - */ - mix->class = UAC_OUTPUT; -done: - return (terminal_type); + *pindex = n; + return (true); } -static uint16_t -uaudio20_mixer_determine_class(const struct uaudio_terminal_node *iot, - struct uaudio_mixer_node *mix) +static bool +uaudio_mixer_foreach_output(const struct uaudio_terminal_node *iot, uint8_t *pindex) { - uint16_t terminal_type = 0x0000; - const struct uaudio_terminal_node *input[2]; - const struct uaudio_terminal_node *output[2]; + uint8_t n; - input[0] = uaudio_mixer_get_input(iot, 0); - input[1] = uaudio_mixer_get_input(iot, 1); + n = *pindex; - output[0] = uaudio_mixer_get_output(iot, 0); - output[1] = uaudio_mixer_get_output(iot, 1); - - /* - * check if there is only - * one output terminal: - */ - if (output[0] && (!output[1])) - terminal_type = UGETW(output[0]->u.ot_v2->wTerminalType); - /* - * If the only output terminal is USB, - * the class is UAC_RECORD. - */ - if ((terminal_type & 0xff00) == (UAT_UNDEFINED & 0xff00)) { - - mix->class = UAC_RECORD; - if (input[0] && (!input[1])) { - terminal_type = - UGETW(input[0]->u.it_v2->wTerminalType); - } else { - terminal_type = 0; - } - goto done; + while (1) { + if (!n--) + n = iot->usr.id_max; + if (n == 0) + return (false); + if (iot->usr.bit_output[n / 8] & (1 << (n % 8))) + break; } - /* - * if the unit is connected to just - * one input terminal, the - * class is UAC_INPUT: - */ - if (input[0] && (!input[1])) { - mix->class = UAC_INPUT; - terminal_type = - UGETW(input[0]->u.it_v2->wTerminalType); - goto done; - } - /* - * Otherwise, the class is UAC_OUTPUT. - */ - mix->class = UAC_OUTPUT; -done: - return (terminal_type); + *pindex = n; + return (true); } struct uaudio_tt_to_feature { @@ -4432,8 +4368,6 @@ struct uaudio_tt_to_feature { static const struct uaudio_tt_to_feature uaudio_tt_to_feature[] = { - {UAT_STREAM, SOUND_MIXER_PCM}, - {UATI_MICROPHONE, SOUND_MIXER_MIC}, {UATI_DESKMICROPHONE, SOUND_MIXER_MIC}, {UATI_PERSONALMICROPHONE, SOUND_MIXER_MIC}, @@ -4441,11 +4375,6 @@ static const struct uaudio_tt_to_feature uaudio_tt_to_ {UATI_MICROPHONEARRAY, SOUND_MIXER_MIC}, {UATI_PROCMICROPHONEARR, SOUND_MIXER_MIC}, - {UATO_SPEAKER, SOUND_MIXER_SPEAKER}, - {UATO_DESKTOPSPEAKER, SOUND_MIXER_SPEAKER}, - {UATO_ROOMSPEAKER, SOUND_MIXER_SPEAKER}, - {UATO_COMMSPEAKER, SOUND_MIXER_SPEAKER}, - {UATE_ANALOGCONN, SOUND_MIXER_LINE}, {UATE_LINECONN, SOUND_MIXER_LINE}, {UATE_LEGACYCONN, SOUND_MIXER_LINE}, @@ -4463,63 +4392,21 @@ static const struct uaudio_tt_to_feature uaudio_tt_to_ {UATF_DVDAUDIO, SOUND_MIXER_VIDEO}, {UATF_TVTUNERAUDIO, SOUND_MIXER_VIDEO}, - /* telephony terminal types */ - {UATT_UNDEFINED, SOUND_MIXER_PHONEIN}, /* SOUND_MIXER_PHONEOUT */ - {UATT_PHONELINE, SOUND_MIXER_PHONEIN}, /* SOUND_MIXER_PHONEOUT */ - {UATT_TELEPHONE, SOUND_MIXER_PHONEIN}, /* SOUND_MIXER_PHONEOUT */ - {UATT_DOWNLINEPHONE, SOUND_MIXER_PHONEIN}, /* SOUND_MIXER_PHONEOUT */ - {UATF_RADIORECV, SOUND_MIXER_RADIO}, {UATF_RADIOXMIT, SOUND_MIXER_RADIO}, - {UAT_UNDEFINED, SOUND_MIXER_VOLUME}, - {UAT_VENDOR, SOUND_MIXER_VOLUME}, - {UATI_UNDEFINED, SOUND_MIXER_VOLUME}, - - /* output terminal types */ - {UATO_UNDEFINED, SOUND_MIXER_VOLUME}, - {UATO_DISPLAYAUDIO, SOUND_MIXER_VOLUME}, - {UATO_SUBWOOFER, SOUND_MIXER_VOLUME}, - {UATO_HEADPHONES, SOUND_MIXER_VOLUME}, - - /* bidir terminal types */ - {UATB_UNDEFINED, SOUND_MIXER_VOLUME}, - {UATB_HANDSET, SOUND_MIXER_VOLUME}, - {UATB_HEADSET, SOUND_MIXER_VOLUME}, - {UATB_SPEAKERPHONE, SOUND_MIXER_VOLUME}, - {UATB_SPEAKERPHONEESUP, SOUND_MIXER_VOLUME}, - {UATB_SPEAKERPHONEECANC, SOUND_MIXER_VOLUME}, - - /* external terminal types */ - {UATE_UNDEFINED, SOUND_MIXER_VOLUME}, - - /* embedded function terminal types */ - {UATF_UNDEFINED, SOUND_MIXER_VOLUME}, - {UATF_CALIBNOISE, SOUND_MIXER_VOLUME}, - {UATF_EQUNOISE, SOUND_MIXER_VOLUME}, - {UATF_DAT, SOUND_MIXER_VOLUME}, - {UATF_DCC, SOUND_MIXER_VOLUME}, - {UATF_MINIDISK, SOUND_MIXER_VOLUME}, - {UATF_ANALOGTAPE, SOUND_MIXER_VOLUME}, - {UATF_PHONOGRAPH, SOUND_MIXER_VOLUME}, - {UATF_VCRAUDIO, SOUND_MIXER_VOLUME}, - {UATF_SATELLITE, SOUND_MIXER_VOLUME}, - {UATF_CABLETUNER, SOUND_MIXER_VOLUME}, - {UATF_DSS, SOUND_MIXER_VOLUME}, - {UATF_MULTITRACK, SOUND_MIXER_VOLUME}, - {0xffff, SOUND_MIXER_VOLUME}, - - /* end */ - {} + {} /* END */ }; static uint16_t -uaudio_mixer_feature_name_sub(uint16_t terminal_type) +uaudio_mixer_get_feature_by_tt(uint16_t terminal_type, uint16_t default_type) { const struct uaudio_tt_to_feature *uat = uaudio_tt_to_feature; uint16_t retval; - while (1) { + if (terminal_type == 0) { + retval = default_type; + } else while (1) { if (uat->terminal_type == 0) { switch (terminal_type >> 8) { case UATI_UNDEFINED >> 8: @@ -4528,8 +4415,11 @@ uaudio_mixer_feature_name_sub(uint16_t terminal_type) case UATO_UNDEFINED >> 8: retval = SOUND_MIXER_PCM; goto done; + case UATT_UNDEFINED >> 8: + retval = SOUND_MIXER_PHONEIN; + goto done; default: - retval = SOUND_MIXER_VOLUME; + retval = default_type; goto done; } } else if (uat->terminal_type == terminal_type) { @@ -4539,65 +4429,138 @@ uaudio_mixer_feature_name_sub(uint16_t terminal_type) uat++; } done: - DPRINTF("terminal_type=0x%04x -> %d\n", - terminal_type, retval); + DPRINTF("terminal_type=0x%04x RET=%d DEF=%d\n", + terminal_type, retval, default_type); return (retval); } static uint16_t -uaudio_mixer_feature_name(const struct uaudio_terminal_node *iot, - struct uaudio_mixer_node *mix) +uaudio_mixer_determine_class(const struct uaudio_terminal_node *iot) { - uint16_t terminal_type = uaudio_mixer_determine_class(iot, mix); + const struct uaudio_terminal_node *ptr; + uint16_t terminal_type_input = 0; + uint16_t terminal_type_output = 0; + uint16_t temp; + uint8_t match = 0; + uint8_t i; - if (mix->class == UAC_RECORD && terminal_type == 0) + for (i = 0; uaudio_mixer_foreach_input(iot, &i); ) { + ptr = iot->root + i; + temp = UGETW(ptr->u.it_v1->wTerminalType); + + if (temp == 0) + continue; + else if (temp == UAT_STREAM) + match |= 1; + else if ((temp & 0xFF00) != (UAT_UNDEFINED & 0xff00)) + terminal_type_input = temp; + } + + for (i = 0; uaudio_mixer_foreach_output(iot, &i); ) { + ptr = iot->root + i; + temp = UGETW(ptr->u.ot_v1->wTerminalType); + + if (temp == 0) + continue; + else if (temp == UAT_STREAM) + match |= 2; + else if ((temp & 0xFF00) != (UAT_UNDEFINED & 0xff00)) + terminal_type_output = temp; + } + + DPRINTF("MATCH=%d IN=0x%04x OUT=0x%04x\n", + match, terminal_type_input, terminal_type_output); + + switch (match) { + case 0: /* not connected to USB */ + if (terminal_type_output != 0) { + return (uaudio_mixer_get_feature_by_tt( + terminal_type_output, SOUND_MIXER_MONITOR)); + } else { + return (uaudio_mixer_get_feature_by_tt( + terminal_type_input, SOUND_MIXER_MONITOR)); + } + case 3: /* connected to both USB input and USB output */ return (SOUND_MIXER_IMIX); - return (uaudio_mixer_feature_name_sub(terminal_type)); + case 2: /* connected to USB output */ + return (uaudio_mixer_get_feature_by_tt( + terminal_type_input, SOUND_MIXER_RECLEV)); + case 1: /* connected to USB input */ + return (uaudio_mixer_get_feature_by_tt( + terminal_type_output, SOUND_MIXER_PCM)); + default: + return (SOUND_MIXER_NRDEVICES); + } } static uint16_t -uaudio20_mixer_feature_name(const struct uaudio_terminal_node *iot, - struct uaudio_mixer_node *mix) +uaudio20_mixer_determine_class(const struct uaudio_terminal_node *iot) { - uint16_t terminal_type = uaudio20_mixer_determine_class(iot, mix); + const struct uaudio_terminal_node *ptr; + uint16_t terminal_type_input = 0; + uint16_t terminal_type_output = 0; + uint16_t temp; + uint8_t match = 0; + uint8_t i; - if (mix->class == UAC_RECORD && terminal_type == 0) - return (SOUND_MIXER_IMIX); - return (uaudio_mixer_feature_name_sub(terminal_type)); -} + for (i = 0; uaudio_mixer_foreach_input(iot, &i); ) { + ptr = iot->root + i; + temp = UGETW(ptr->u.it_v2->wTerminalType); -static const struct uaudio_terminal_node * -uaudio_mixer_get_input(const struct uaudio_terminal_node *iot, uint8_t i) -{ - struct uaudio_terminal_node *root = iot->root; - uint8_t n; + if (temp == 0) + continue; + else if (temp == UAT_STREAM) + match |= 1; + else if ((temp & 0xFF00) != (UAT_UNDEFINED & 0xff00)) + terminal_type_input = temp; + } - n = iot->usr.id_max; - do { - if (iot->usr.bit_input[n / 8] & (1 << (n % 8))) { - if (!i--) - return (root + n); - } - } while (n--); + for (i = 0; uaudio_mixer_foreach_output(iot, &i); ) { + ptr = iot->root + i; + temp = UGETW(ptr->u.ot_v2->wTerminalType); - return (NULL); -} + if (temp == 0) + continue; + else if (temp == UAT_STREAM) + match |= 2; + else if ((temp & 0xFF00) != (UAT_UNDEFINED & 0xff00)) + terminal_type_output = temp; + } -static const struct uaudio_terminal_node * -uaudio_mixer_get_output(const struct uaudio_terminal_node *iot, uint8_t i) -{ - struct uaudio_terminal_node *root = iot->root; - uint8_t n; + DPRINTF("MATCH=%d IN=0x%04x OUT=0x%04x\n", + match, terminal_type_input, terminal_type_output); - n = iot->usr.id_max; - do { - if (iot->usr.bit_output[n / 8] & (1 << (n % 8))) { - if (!i--) - return (root + n); + switch (match) { + case 0: /* not connected to USB */ + if (terminal_type_output != 0) { + return (uaudio_mixer_get_feature_by_tt( + terminal_type_output, SOUND_MIXER_MONITOR)); + } else { + return (uaudio_mixer_get_feature_by_tt( + terminal_type_input, SOUND_MIXER_MONITOR)); } - } while (n--); + case 3: /* connected to both USB input and USB output */ + return (SOUND_MIXER_IMIX); + case 2: /* connected to USB output */ + return (uaudio_mixer_get_feature_by_tt( + terminal_type_input, SOUND_MIXER_RECLEV)); + case 1: /* connected to USB input */ + return (uaudio_mixer_get_feature_by_tt( + terminal_type_output, SOUND_MIXER_PCM)); + default: + return (SOUND_MIXER_NRDEVICES); + } +} - return (NULL); +static void +uaudio_mixer_merge_outputs(struct uaudio_search_result *dst, + const struct uaudio_search_result *src) +{ + const uint8_t max = sizeof(src->bit_output) / sizeof(src->bit_output[0]); + uint8_t x; + + for (x = 0; x != max; x++) + dst->bit_output[x] |= src->bit_output[x]; } static void @@ -4608,9 +4571,7 @@ uaudio_mixer_find_inputs_sub(struct uaudio_terminal_no struct uaudio_terminal_node *iot; uint8_t n; uint8_t i; - uint8_t is_last; -top: for (n = 0; n < n_id; n++) { i = p_id[n]; @@ -4627,72 +4588,48 @@ top: if (iot->u.desc == NULL) continue; - is_last = ((n + 1) == n_id); - switch (iot->u.desc->bDescriptorSubtype) { case UDESCSUB_AC_INPUT: + uaudio_mixer_merge_outputs(&iot->usr, info); info->bit_input[i / 8] |= (1 << (i % 8)); break; case UDESCSUB_AC_FEATURE: - if (is_last) { - p_id = &iot->u.fu_v1->bSourceId; - n_id = 1; - goto top; - } + uaudio_mixer_merge_outputs(&iot->usr, info); uaudio_mixer_find_inputs_sub( root, &iot->u.fu_v1->bSourceId, 1, info); break; case UDESCSUB_AC_OUTPUT: - if (is_last) { - p_id = &iot->u.ot_v1->bSourceId; - n_id = 1; - goto top; - } + info->bit_output[i / 8] |= (1 << (i % 8)); uaudio_mixer_find_inputs_sub( root, &iot->u.ot_v1->bSourceId, 1, info); + info->bit_output[i / 8] &= ~(1 << (i % 8)); break; case UDESCSUB_AC_MIXER: - if (is_last) { - p_id = iot->u.mu_v1->baSourceId; - n_id = iot->u.mu_v1->bNrInPins; - goto top; - } + uaudio_mixer_merge_outputs(&iot->usr, info); uaudio_mixer_find_inputs_sub( root, iot->u.mu_v1->baSourceId, iot->u.mu_v1->bNrInPins, info); break; case UDESCSUB_AC_SELECTOR: - if (is_last) { - p_id = iot->u.su_v1->baSourceId; - n_id = iot->u.su_v1->bNrInPins; - goto top; - } + uaudio_mixer_merge_outputs(&iot->usr, info); uaudio_mixer_find_inputs_sub( root, iot->u.su_v1->baSourceId, iot->u.su_v1->bNrInPins, info); break; case UDESCSUB_AC_PROCESSING: - if (is_last) { - p_id = iot->u.pu_v1->baSourceId; - n_id = iot->u.pu_v1->bNrInPins; - goto top; - } + uaudio_mixer_merge_outputs(&iot->usr, info); uaudio_mixer_find_inputs_sub( root, iot->u.pu_v1->baSourceId, iot->u.pu_v1->bNrInPins, info); break; case UDESCSUB_AC_EXTENSION: - if (is_last) { - p_id = iot->u.eu_v1->baSourceId; - n_id = iot->u.eu_v1->bNrInPins; - goto top; - } + uaudio_mixer_merge_outputs(&iot->usr, info); uaudio_mixer_find_inputs_sub( root, iot->u.eu_v1->baSourceId, iot->u.eu_v1->bNrInPins, info); @@ -4712,9 +4649,7 @@ uaudio20_mixer_find_inputs_sub(struct uaudio_terminal_ struct uaudio_terminal_node *iot; uint8_t n; uint8_t i; - uint8_t is_last; -top: for (n = 0; n < n_id; n++) { i = p_id[n]; @@ -4731,94 +4666,62 @@ top: if (iot->u.desc == NULL) continue; - is_last = ((n + 1) == n_id); - switch (iot->u.desc->bDescriptorSubtype) { case UDESCSUB_AC_INPUT: + uaudio_mixer_merge_outputs(&iot->usr, info); info->bit_input[i / 8] |= (1 << (i % 8)); break; case UDESCSUB_AC_OUTPUT: - if (is_last) { - p_id = &iot->u.ot_v2->bSourceId; - n_id = 1; - goto top; - } + info->bit_output[i / 8] |= (1 << (i % 8)); uaudio20_mixer_find_inputs_sub( root, &iot->u.ot_v2->bSourceId, 1, info); + info->bit_output[i / 8] &= ~(1 << (i % 8)); break; case UDESCSUB_AC_MIXER: - if (is_last) { - p_id = iot->u.mu_v2->baSourceId; - n_id = iot->u.mu_v2->bNrInPins; - goto top; - } + uaudio_mixer_merge_outputs(&iot->usr, info); uaudio20_mixer_find_inputs_sub( root, iot->u.mu_v2->baSourceId, iot->u.mu_v2->bNrInPins, info); break; case UDESCSUB_AC_SELECTOR: - if (is_last) { - p_id = iot->u.su_v2->baSourceId; - n_id = iot->u.su_v2->bNrInPins; - goto top; - } + uaudio_mixer_merge_outputs(&iot->usr, info); uaudio20_mixer_find_inputs_sub( root, iot->u.su_v2->baSourceId, iot->u.su_v2->bNrInPins, info); break; case UDESCSUB_AC_SAMPLE_RT: - if (is_last) { - p_id = &iot->u.ru_v2->bSourceId; - n_id = 1; - goto top; - } + uaudio_mixer_merge_outputs(&iot->usr, info); uaudio20_mixer_find_inputs_sub( root, &iot->u.ru_v2->bSourceId, 1, info); break; case UDESCSUB_AC_EFFECT: - if (is_last) { - p_id = &iot->u.ef_v2->bSourceId; - n_id = 1; - goto top; - } + uaudio_mixer_merge_outputs(&iot->usr, info); uaudio20_mixer_find_inputs_sub( root, &iot->u.ef_v2->bSourceId, 1, info); break; case UDESCSUB_AC_FEATURE: - if (is_last) { - p_id = &iot->u.fu_v2->bSourceId; - n_id = 1; - goto top; - } + uaudio_mixer_merge_outputs(&iot->usr, info); uaudio20_mixer_find_inputs_sub( root, &iot->u.fu_v2->bSourceId, 1, info); break; case UDESCSUB_AC_PROCESSING_V2: - if (is_last) { - p_id = iot->u.pu_v2->baSourceId; - n_id = iot->u.pu_v2->bNrInPins; - goto top; - } + uaudio_mixer_merge_outputs(&iot->usr, info); uaudio20_mixer_find_inputs_sub( root, iot->u.pu_v2->baSourceId, iot->u.pu_v2->bNrInPins, info); break; case UDESCSUB_AC_EXTENSION_V2: - if (is_last) { - p_id = iot->u.eu_v2->baSourceId; - n_id = iot->u.eu_v2->bNrInPins; - goto top; - } + uaudio_mixer_merge_outputs(&iot->usr, info); uaudio20_mixer_find_inputs_sub( root, iot->u.eu_v2->baSourceId, iot->u.eu_v2->bNrInPins, info); @@ -4927,31 +4830,6 @@ top: } static void -uaudio_mixer_find_outputs_sub(struct uaudio_terminal_node *root, uint8_t id, - uint8_t n_id, struct uaudio_search_result *info) -{ - struct uaudio_terminal_node *iot = (root + id); - uint8_t j; - - j = n_id; - do { - if ((j != id) && ((root + j)->u.desc) && - ((root + j)->u.desc->bDescriptorSubtype == UDESCSUB_AC_OUTPUT)) { - - /* - * "j" (output) <--- virtual wire <--- "id" (input) - * - * if "j" has "id" on the input, then "id" have "j" on - * the output, because they are connected: - */ - if ((root + j)->usr.bit_input[id / 8] & (1 << (id % 8))) { - iot->usr.bit_output[j / 8] |= (1 << (j % 8)); - } - } - } while (j--); -} - -static void uaudio_mixer_fill_info(struct uaudio_softc *sc, struct usb_device *udev, void *desc) { @@ -5043,16 +4921,6 @@ uaudio_mixer_fill_info(struct uaudio_softc *sc, } } while (i--); - /* - * determine outputs for - * all nodes in the tree: - */ - i = ID_max; - do { - uaudio_mixer_find_outputs_sub(iot, - i, ID_max, &((iot + i)->usr)); - } while (i--); - /* set "id_max" and "root" */ i = ID_max; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Mon Apr 13 16:29:35 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9DC342C2E8B; Mon, 13 Apr 2020 16:29:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 491Dbg3gpvz3MbT; Mon, 13 Apr 2020 16:29:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7988B1E3FA; Mon, 13 Apr 2020 16:29:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03DGTZTX087433; Mon, 13 Apr 2020 16:29:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03DGTZrI087432; Mon, 13 Apr 2020 16:29:35 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004131629.03DGTZrI087432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 13 Apr 2020 16:29:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359883 - stable/11/sys/dev/sound/pcm X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/sound/pcm X-SVN-Commit-Revision: 359883 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 16:29:35 -0000 Author: hselasky Date: Mon Apr 13 16:29:35 2020 New Revision: 359883 URL: https://svnweb.freebsd.org/changeset/base/359883 Log: MFC r359356: Change default microphone level from 0 to 25. Discussed with: Horse Ma Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/sound/pcm/mixer.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sound/pcm/mixer.c ============================================================================== --- stable/11/sys/dev/sound/pcm/mixer.c Mon Apr 13 16:29:03 2020 (r359882) +++ stable/11/sys/dev/sound/pcm/mixer.c Mon Apr 13 16:29:35 2020 (r359883) @@ -81,7 +81,7 @@ static u_int16_t snd_mixerdefaults[SOUND_MIXER_NRDEVIC [SOUND_MIXER_PCM] = 75, [SOUND_MIXER_SPEAKER] = 75, [SOUND_MIXER_LINE] = 75, - [SOUND_MIXER_MIC] = 0, + [SOUND_MIXER_MIC] = 25, [SOUND_MIXER_CD] = 75, [SOUND_MIXER_IGAIN] = 0, [SOUND_MIXER_LINE1] = 75, From owner-svn-src-stable-11@freebsd.org Mon Apr 13 16:31:47 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3FF172C3166; Mon, 13 Apr 2020 16:31:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 491DfC12GMz3NBh; Mon, 13 Apr 2020 16:31:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A9AD1E5A3; Mon, 13 Apr 2020 16:31:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03DGVkG0092395; Mon, 13 Apr 2020 16:31:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03DGVkNM092394; Mon, 13 Apr 2020 16:31:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004131631.03DGVkNM092394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 13 Apr 2020 16:31:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359886 - stable/11/sys/dev/sound/pcm X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/sound/pcm X-SVN-Commit-Revision: 359886 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 16:31:47 -0000 Author: hselasky Date: Mon Apr 13 16:31:46 2020 New Revision: 359886 URL: https://svnweb.freebsd.org/changeset/base/359886 Log: MFC r359440: Implement new mixer API to return the device pointer based on the mixer pointer. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/sound/pcm/mixer.c stable/11/sys/dev/sound/pcm/mixer.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sound/pcm/mixer.c ============================================================================== --- stable/11/sys/dev/sound/pcm/mixer.c Mon Apr 13 16:31:13 2020 (r359885) +++ stable/11/sys/dev/sound/pcm/mixer.c Mon Apr 13 16:31:46 2020 (r359886) @@ -1030,6 +1030,14 @@ mix_get_type(struct snd_mixer *m) return (m->type); } +device_t +mix_get_dev(struct snd_mixer *m) +{ + KASSERT(m != NULL, ("NULL snd_mixer")); + + return (m->dev); +} + /* ----------------------------------------------------------------------- */ static int Modified: stable/11/sys/dev/sound/pcm/mixer.h ============================================================================== --- stable/11/sys/dev/sound/pcm/mixer.h Mon Apr 13 16:31:13 2020 (r359885) +++ stable/11/sys/dev/sound/pcm/mixer.h Mon Apr 13 16:31:46 2020 (r359886) @@ -54,6 +54,7 @@ int mix_get(struct snd_mixer *m, u_int dev); int mix_setrecsrc(struct snd_mixer *m, u_int32_t src); u_int32_t mix_getrecsrc(struct snd_mixer *m); int mix_get_type(struct snd_mixer *m); +device_t mix_get_dev(struct snd_mixer *m); void mix_setdevs(struct snd_mixer *m, u_int32_t v); void mix_setrecdevs(struct snd_mixer *m, u_int32_t v); From owner-svn-src-stable-11@freebsd.org Mon Apr 13 16:33:46 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F2772C341D; Mon, 13 Apr 2020 16:33:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 491DhV1LnPz3Nmq; Mon, 13 Apr 2020 16:33:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 295E81E606; Mon, 13 Apr 2020 16:33:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03DGXk9r093424; Mon, 13 Apr 2020 16:33:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03DGXj5j093421; Mon, 13 Apr 2020 16:33:45 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004131633.03DGXj5j093421@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 13 Apr 2020 16:33:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359889 - stable/11/sys/dev/sound/usb X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/sound/usb X-SVN-Commit-Revision: 359889 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 16:33:46 -0000 Author: hselasky Date: Mon Apr 13 16:33:45 2020 New Revision: 359889 URL: https://svnweb.freebsd.org/changeset/base/359889 Log: MFC r359446: Add support for multiple playback and recording devices per physical USB audio device. This requires some structural refactoring inside the driver, mostly about converting existing audio channel structures into arrays. The main audio mixer is provided by the first PCM instance. The non-first audio instances may only have a software mixer for PCM playback. Tested by: Horse Ma Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/sound/usb/uaudio.c stable/11/sys/dev/sound/usb/uaudio.h stable/11/sys/dev/sound/usb/uaudio_pcm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/11/sys/dev/sound/usb/uaudio.c Mon Apr 13 16:33:10 2020 (r359888) +++ stable/11/sys/dev/sound/usb/uaudio.c Mon Apr 13 16:33:45 2020 (r359889) @@ -258,6 +258,8 @@ struct uaudio_chan { #define CHAN_OP_START 1 #define CHAN_OP_STOP 2 #define CHAN_OP_DRAIN 3 + + uint8_t iface_index; }; #define UMIDI_EMB_JACK_MAX 16 /* units */ @@ -343,37 +345,45 @@ struct uaudio_hid { #define UAUDIO_SPDIF_OUT_96K 0x04 /* Out sample rate = 96K */ #define UAUDIO_SPDIF_IN_MIX 0x10 /* Input mix enable */ +#define UAUDIO_MAX_CHILD 2 + +struct uaudio_softc_child { + device_t pcm_device; + struct mtx *mixer_lock; + struct snd_mixer *mixer_dev; + + uint32_t mix_info; + uint32_t recsrc_info; + + uint8_t pcm_registered:1; + uint8_t mixer_init:1; +}; + struct uaudio_softc { struct sbuf sc_sndstat; struct sndcard_func sc_sndcard_func; - struct uaudio_chan sc_rec_chan; - struct uaudio_chan sc_play_chan; + struct uaudio_chan sc_rec_chan[UAUDIO_MAX_CHILD]; + struct uaudio_chan sc_play_chan[UAUDIO_MAX_CHILD]; struct umidi_chan sc_midi_chan; struct uaudio_hid sc_hid; struct uaudio_search_result sc_mixer_clocks; struct uaudio_mixer_node sc_mixer_node; struct uaudio_configure_msg sc_config_msg[2]; + struct uaudio_softc_child sc_child[UAUDIO_MAX_CHILD]; - struct mtx *sc_mixer_lock; - struct snd_mixer *sc_mixer_dev; struct usb_device *sc_udev; struct usb_xfer *sc_mixer_xfer[1]; struct uaudio_mixer_node *sc_mixer_root; struct uaudio_mixer_node *sc_mixer_curr; int (*sc_set_spdif_fn) (struct uaudio_softc *, int); - uint32_t sc_mix_info; - uint32_t sc_recsrc_info; - uint16_t sc_audio_rev; uint16_t sc_mixer_count; - uint8_t sc_sndstat_valid; uint8_t sc_mixer_iface_index; uint8_t sc_mixer_iface_no; uint8_t sc_mixer_chan; - uint8_t sc_pcm_registered:1; - uint8_t sc_mixer_init:1; + uint8_t sc_sndstat_valid:1; uint8_t sc_uq_audio_swap_lr:1; uint8_t sc_uq_au_inp_async:1; uint8_t sc_uq_au_no_xu:1; @@ -473,7 +483,7 @@ static usb_proc_callback_t uaudio_configure_msg; static int uaudio_mixer_sysctl_handler(SYSCTL_HANDLER_ARGS); static void uaudio_mixer_ctl_free(struct uaudio_softc *); -static void uaudio_mixer_register_sysctl(struct uaudio_softc *, device_t); +static void uaudio_mixer_register_sysctl(struct uaudio_softc *, device_t, unsigned); static void uaudio_mixer_reload_all(struct uaudio_softc *); static void uaudio_mixer_controls_create_ftu(struct uaudio_softc *); @@ -533,7 +543,7 @@ static void uaudio_mixer_add_ctl(struct uaudio_softc * static void uaudio_mixer_fill_info(struct uaudio_softc *, struct usb_device *, void *); static int uaudio_mixer_signext(uint8_t, int); -static void uaudio_mixer_init(struct uaudio_softc *); +static void uaudio_mixer_init(struct uaudio_softc *, unsigned); static uint8_t umidi_convert_to_usb(struct umidi_sub_chan *, uint8_t, uint8_t); static struct umidi_sub_chan *umidi_sub_by_fifo(struct usb_fifo *); static void umidi_start_read(struct usb_fifo *); @@ -823,6 +833,33 @@ static const STRUCT_USB_HOST_ID __used uaudio_devs[] = USB_IFACE_SUBCLASS(UISUBCLASS_MIDISTREAM),}, }; +static unsigned +uaudio_get_child_index_by_dev(struct uaudio_softc *sc, device_t dev) +{ + unsigned i; + + for (i = 0; i != UAUDIO_MAX_CHILD; i++) { + if (dev == sc->sc_child[i].pcm_device) + return (i); + } + panic("uaudio_get_child_index_dev: Invalid device: %p\n", dev); + return (0); +} + +static unsigned +uaudio_get_child_index_by_chan(struct uaudio_softc *sc, struct uaudio_chan *ch) +{ + unsigned i; + + for (i = 0; i != UAUDIO_MAX_CHILD; i++) { + if ((sc->sc_play_chan + i) == ch || + (sc->sc_rec_chan + i) == ch) + return (i); + } + panic("uaudio_get_child_index_by_chan: Invalid chan: %p\n", ch); + return (0); +} + static int uaudio_probe(device_t dev) { @@ -911,10 +948,8 @@ uaudio_attach(device_t dev) struct uaudio_softc *sc = device_get_softc(dev); struct usb_interface_descriptor *id; usb_error_t err; - device_t child; + unsigned i; - sc->sc_play_chan.priv_sc = sc; - sc->sc_rec_chan.priv_sc = sc; sc->sc_udev = uaa->device; sc->sc_mixer_iface_index = uaa->info.bIfaceIndex; sc->sc_mixer_iface_no = uaa->info.bIfaceNum; @@ -972,57 +1007,63 @@ uaudio_attach(device_t dev) DPRINTF("%d mixer controls\n", sc->sc_mixer_count); - if (sc->sc_play_chan.num_alt > 0) { + for (i = 0; i != UAUDIO_MAX_CHILD; i++) { uint8_t x; + if (sc->sc_play_chan[i].num_alt <= 0) + break; + /* * Need to set a default alternate interface, else * some USB audio devices might go into an infinte * re-enumeration loop: */ err = usbd_set_alt_interface_index(sc->sc_udev, - sc->sc_play_chan.usb_alt[0].iface_index, - sc->sc_play_chan.usb_alt[0].iface_alt_index); + sc->sc_play_chan[i].usb_alt[0].iface_index, + sc->sc_play_chan[i].usb_alt[0].iface_alt_index); if (err) { DPRINTF("setting of alternate index failed: %s!\n", usbd_errstr(err)); } - for (x = 0; x != sc->sc_play_chan.num_alt; x++) { - device_printf(dev, "Play: %d Hz, %d ch, %s format, " - "2x8ms buffer.\n", - sc->sc_play_chan.usb_alt[x].sample_rate, - sc->sc_play_chan.usb_alt[x].channels, - sc->sc_play_chan.usb_alt[x].p_fmt->description); + for (x = 0; x != sc->sc_play_chan[i].num_alt; x++) { + device_printf(dev, "Play[%u]: %d Hz, %d ch, %s format, " + "2x8ms buffer.\n", i, + sc->sc_play_chan[i].usb_alt[x].sample_rate, + sc->sc_play_chan[i].usb_alt[x].channels, + sc->sc_play_chan[i].usb_alt[x].p_fmt->description); } - } else { - device_printf(dev, "No playback.\n"); } + if (i == 0) + device_printf(dev, "No playback.\n"); - if (sc->sc_rec_chan.num_alt > 0) { + for (i = 0; i != UAUDIO_MAX_CHILD; i++) { uint8_t x; + if (sc->sc_rec_chan[i].num_alt <= 0) + break; + /* * Need to set a default alternate interface, else * some USB audio devices might go into an infinte * re-enumeration loop: */ err = usbd_set_alt_interface_index(sc->sc_udev, - sc->sc_rec_chan.usb_alt[0].iface_index, - sc->sc_rec_chan.usb_alt[0].iface_alt_index); + sc->sc_rec_chan[i].usb_alt[0].iface_index, + sc->sc_rec_chan[i].usb_alt[0].iface_alt_index); if (err) { DPRINTF("setting of alternate index failed: %s!\n", usbd_errstr(err)); } - for (x = 0; x != sc->sc_rec_chan.num_alt; x++) { - device_printf(dev, "Record: %d Hz, %d ch, %s format, " - "2x8ms buffer.\n", - sc->sc_rec_chan.usb_alt[x].sample_rate, - sc->sc_rec_chan.usb_alt[x].channels, - sc->sc_rec_chan.usb_alt[x].p_fmt->description); + for (x = 0; x != sc->sc_rec_chan[i].num_alt; x++) { + device_printf(dev, "Record[%u]: %d Hz, %d ch, %s format, " + "2x8ms buffer.\n", i, + sc->sc_rec_chan[i].usb_alt[x].sample_rate, + sc->sc_rec_chan[i].usb_alt[x].channels, + sc->sc_rec_chan[i].usb_alt[x].p_fmt->description); } - } else { - device_printf(dev, "No recording.\n"); } + if (i == 0) + device_printf(dev, "No recording.\n"); if (sc->sc_midi_chan.valid == 0) { if (usbd_lookup_id_by_uaa(uaudio_vendor_midi, @@ -1054,16 +1095,20 @@ uaudio_attach(device_t dev) * Only attach a PCM device if we have a playback, recording * or mixer device present: */ - if (sc->sc_play_chan.num_alt > 0 || - sc->sc_rec_chan.num_alt > 0 || - sc->sc_mix_info) { - child = device_add_child(dev, "pcm", -1); + for (i = 0; i != UAUDIO_MAX_CHILD; i++) { + if (sc->sc_play_chan[i].num_alt <= 0 && + sc->sc_rec_chan[i].num_alt <= 0 && + sc->sc_child[i].mix_info == 0) + continue; + sc->sc_child[i].pcm_device = + device_add_child(dev, "pcm", -1); - if (child == NULL) { + if (sc->sc_child[i].pcm_device == NULL) { DPRINTF("out of memory\n"); goto detach; } - device_set_ivars(child, &sc->sc_sndcard_func); + device_set_ivars(sc->sc_child[i].pcm_device, + &sc->sc_sndcard_func); } if (bus_generic_attach(dev)) { @@ -1102,16 +1147,17 @@ int uaudio_attach_sub(device_t dev, kobj_class_t mixer_class, kobj_class_t chan_class) { struct uaudio_softc *sc = device_get_softc(device_get_parent(dev)); + unsigned i = uaudio_get_child_index_by_dev(sc, dev); char status[SND_STATUSLEN]; - uaudio_mixer_init(sc); + uaudio_mixer_init(sc, i); if (sc->sc_uq_audio_swap_lr) { DPRINTF("hardware has swapped left and right\n"); /* uaudio_pcm_setflags(dev, SD_F_PSWAPLR); */ } - if (sc->sc_play_chan.num_alt > 0 && - (sc->sc_mix_info & SOUND_MASK_PCM) == 0) { + if (sc->sc_play_chan[i].num_alt > 0 && + (sc->sc_child[i].mix_info & SOUND_MASK_PCM) == 0) { DPRINTF("emulating master volume\n"); @@ -1127,34 +1173,39 @@ uaudio_attach_sub(device_t dev, kobj_class_t mixer_cla } if (mixer_init(dev, mixer_class, sc)) goto detach; - sc->sc_mixer_init = 1; + sc->sc_child[i].mixer_init = 1; mixer_hwvol_init(dev); snprintf(status, sizeof(status), "at ? %s", PCM_KLDSTRING(snd_uaudio)); if (pcm_register(dev, sc, - (sc->sc_play_chan.num_alt > 0) ? 1 : 0, - (sc->sc_rec_chan.num_alt > 0) ? 1 : 0)) { + (sc->sc_play_chan[i].num_alt > 0) ? 1 : 0, + (sc->sc_rec_chan[i].num_alt > 0) ? 1 : 0)) { goto detach; } uaudio_pcm_setflags(dev, SD_F_MPSAFE); - sc->sc_pcm_registered = 1; + sc->sc_child[i].pcm_registered = 1; - if (sc->sc_play_chan.num_alt > 0) { - pcm_addchan(dev, PCMDIR_PLAY, chan_class, sc); + if (sc->sc_play_chan[i].num_alt > 0) { + sc->sc_play_chan[i].priv_sc = sc; + pcm_addchan(dev, PCMDIR_PLAY, chan_class, + &sc->sc_play_chan[i]); } - if (sc->sc_rec_chan.num_alt > 0) { - pcm_addchan(dev, PCMDIR_REC, chan_class, sc); + + if (sc->sc_rec_chan[i].num_alt > 0) { + sc->sc_rec_chan[i].priv_sc = sc; + pcm_addchan(dev, PCMDIR_REC, chan_class, + &sc->sc_rec_chan[i]); } pcm_setstatus(dev, status); - uaudio_mixer_register_sysctl(sc, dev); + uaudio_mixer_register_sysctl(sc, dev, i); SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, - "feedback_rate", CTLFLAG_RD, &sc->sc_play_chan.feedback_rate, + "feedback_rate", CTLFLAG_RD, &sc->sc_play_chan[i].feedback_rate, 0, "Feedback sample rate in Hz"); return (0); /* success */ @@ -1168,18 +1219,15 @@ int uaudio_detach_sub(device_t dev) { struct uaudio_softc *sc = device_get_softc(device_get_parent(dev)); + unsigned i = uaudio_get_child_index_by_dev(sc, dev); int error = 0; - /* disable S/PDIF output, if any */ - (void) sc->sc_set_spdif_fn(sc, 0); - repeat: - if (sc->sc_pcm_registered) { + if (sc->sc_child[i].pcm_registered) { error = pcm_unregister(dev); } else { - if (sc->sc_mixer_init) { + if (sc->sc_child[i].mixer_init) error = mixer_uninit(dev); - } } if (error) { @@ -1194,6 +1242,7 @@ static int uaudio_detach(device_t dev) { struct uaudio_softc *sc = device_get_softc(dev); + unsigned i; /* * Stop USB transfers early so that any audio applications @@ -1201,14 +1250,18 @@ uaudio_detach(device_t dev) * any. */ usb_proc_explore_lock(sc->sc_udev); - sc->sc_play_chan.operation = CHAN_OP_DRAIN; - sc->sc_rec_chan.operation = CHAN_OP_DRAIN; + for (i = 0; i != UAUDIO_MAX_CHILD; i++) { + sc->sc_play_chan[i].operation = CHAN_OP_DRAIN; + sc->sc_rec_chan[i].operation = CHAN_OP_DRAIN; + } usb_proc_explore_mwait(sc->sc_udev, &sc->sc_config_msg[0], &sc->sc_config_msg[1]); usb_proc_explore_unlock(sc->sc_udev); - usbd_transfer_unsetup(sc->sc_play_chan.xfer, UAUDIO_NCHANBUFS + 1); - usbd_transfer_unsetup(sc->sc_rec_chan.xfer, UAUDIO_NCHANBUFS + 1); + for (i = 0; i != UAUDIO_MAX_CHILD; i++) { + usbd_transfer_unsetup(sc->sc_play_chan[i].xfer, UAUDIO_NCHANBUFS + 1); + usbd_transfer_unsetup(sc->sc_rec_chan[i].xfer, UAUDIO_NCHANBUFS + 1); + } uaudio_hid_detach(sc); @@ -1224,6 +1277,9 @@ uaudio_detach(device_t dev) uaudio_mixer_ctl_free(sc); + /* disable S/PDIF output, if any */ + (void) sc->sc_set_spdif_fn(sc, 0); + return (0); } @@ -1414,10 +1470,13 @@ static void uaudio_configure_msg(struct usb_proc_msg *pm) { struct uaudio_softc *sc = ((struct uaudio_configure_msg *)pm)->sc; + unsigned i; usb_proc_explore_unlock(sc->sc_udev); - uaudio_configure_msg_sub(sc, &sc->sc_play_chan, PCMDIR_PLAY); - uaudio_configure_msg_sub(sc, &sc->sc_rec_chan, PCMDIR_REC); + for (i = 0; i != UAUDIO_MAX_CHILD; i++) { + uaudio_configure_msg_sub(sc, &sc->sc_play_chan[i], PCMDIR_PLAY); + uaudio_configure_msg_sub(sc, &sc->sc_rec_chan[i], PCMDIR_REC); + } usb_proc_explore_lock(sc->sc_udev); } @@ -1583,6 +1642,22 @@ uaudio20_check_rate(struct usb_device *udev, uint8_t i return (USB_ERR_INVAL); } +static struct uaudio_chan * +uaudio_get_chan(struct uaudio_softc *sc, struct uaudio_chan *chan, + uint8_t iface_index) +{ + unsigned i; + + for (i = 0; i != UAUDIO_MAX_CHILD; i++, chan++) { + if (chan->num_alt == 0) { + chan->iface_index = iface_index; + return (chan); + } else if (chan->iface_index == iface_index) + return (chan); + } + return (NULL); +} + static void uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb_device *udev, uint32_t rate, uint8_t channels, uint8_t bit_resolution) @@ -1890,8 +1965,12 @@ uaudio_chan_fill_info_sub(struct uaudio_softc *sc, str } } - chan = (ep_dir == UE_DIR_IN) ? - &sc->sc_rec_chan : &sc->sc_play_chan; + chan = uaudio_get_chan(sc, (ep_dir == UE_DIR_OUT) ? &sc->sc_play_chan[0] : + &sc->sc_rec_chan[0], curidx); + if (chan == NULL) { + DPRINTF("More than %d sub devices. (skipped)\n", UAUDIO_MAX_CHILD); + goto next_ep; + } if (usbd_get_iface(udev, curidx) == NULL) { DPRINTF("Interface is not valid\n"); @@ -1910,8 +1989,8 @@ uaudio_chan_fill_info_sub(struct uaudio_softc *sc, str uaudio_chan_dump_ep_desc(ed1); #endif DPRINTF("Sample rate = %dHz, channels = %d, " - "bits = %d, format = %s\n", rate, channels, - bit_resolution, p_fmt->description); + "bits = %d, format = %s, ep 0x%02x, chan %p\n", rate, channels, + bit_resolution, p_fmt->description, ed1->bEndpointAddress, chan); chan_alt->sample_rate = rate; chan_alt->p_asf1d = asf1d; @@ -2095,12 +2174,15 @@ uaudio_chan_play_sync_callback(struct usb_xfer *xfer, uint64_t sample_rate; uint8_t buf[4]; uint64_t temp; + unsigned i; int len; int actlen; int nframes; usbd_xfer_status(xfer, &actlen, NULL, NULL, &nframes); + i = uaudio_get_child_index_by_chan(ch->priv_sc, ch); + switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: @@ -2151,7 +2233,7 @@ uaudio_chan_play_sync_callback(struct usb_xfer *xfer, * Use feedback value as fallback when there is no * recording channel: */ - if (ch->priv_sc->sc_rec_chan.num_alt == 0) { + if (ch->priv_sc->sc_rec_chan[i].num_alt == 0) { int32_t jitter_max = howmany(sample_rate, 16000); /* @@ -2177,7 +2259,7 @@ uaudio_chan_play_sync_callback(struct usb_xfer *xfer, * source of jitter information to save some * isochronous bandwidth: */ - if (ch->priv_sc->sc_rec_chan.num_alt != 0 && + if (ch->priv_sc->sc_rec_chan[i].num_alt != 0 && uaudio_debug == 0) break; usbd_xfer_set_frames(xfer, 1); @@ -2208,6 +2290,7 @@ uaudio_chan_play_callback(struct usb_xfer *xfer, usb_e uint32_t blockcount; uint32_t n; uint32_t offset; + unsigned i; int sample_size; int actlen; int sumlen; @@ -2217,10 +2300,12 @@ uaudio_chan_play_callback(struct usb_xfer *xfer, usb_e return; } - /* check if there is a record channel */ - if (ch->priv_sc->sc_rec_chan.num_alt > 0) - ch_rec = &ch->priv_sc->sc_rec_chan; - else + i = uaudio_get_child_index_by_chan(ch->priv_sc, ch); + + /* check if there is a valid record channel */ + ch_rec = ch->priv_sc->sc_rec_chan + i; + + if (ch_rec->num_alt == 0) ch_rec = NULL; usbd_xfer_status(xfer, &actlen, &sumlen, NULL, NULL); @@ -2484,11 +2569,9 @@ tr_setup: } void * -uaudio_chan_init(struct uaudio_softc *sc, struct snd_dbuf *b, +uaudio_chan_init(struct uaudio_chan *ch, struct snd_dbuf *b, struct pcm_channel *c, int dir) { - struct uaudio_chan *ch = ((dir == PCMDIR_PLAY) ? - &sc->sc_play_chan : &sc->sc_rec_chan); uint32_t buf_size; uint8_t x; @@ -2679,36 +2762,36 @@ uaudio_chan_start_sub(struct uaudio_chan *ch) } static int -uaudio_chan_need_both(struct uaudio_softc *sc) +uaudio_chan_need_both(struct uaudio_chan *pchan, struct uaudio_chan *rchan) { - return (sc->sc_play_chan.num_alt > 0 && - sc->sc_play_chan.running != 0 && - uaudio_chan_is_async(&sc->sc_play_chan, - sc->sc_play_chan.set_alt) != 0 && - sc->sc_rec_chan.num_alt > 0 && - sc->sc_rec_chan.running == 0); + return (pchan->num_alt > 0 && + pchan->running != 0 && + uaudio_chan_is_async(pchan, pchan->set_alt) != 0 && + rchan->num_alt > 0 && + rchan->running == 0); } static int -uaudio_chan_need_none(struct uaudio_softc *sc) +uaudio_chan_need_none(struct uaudio_chan *pchan, struct uaudio_chan *rchan) { - return (sc->sc_play_chan.num_alt > 0 && - sc->sc_play_chan.running == 0 && - sc->sc_rec_chan.num_alt > 0 && - sc->sc_rec_chan.running == 0); + return (pchan->num_alt > 0 && + pchan->running == 0 && + rchan->num_alt > 0 && + rchan->running == 0); } void uaudio_chan_start(struct uaudio_chan *ch) { struct uaudio_softc *sc = ch->priv_sc; + unsigned i = uaudio_get_child_index_by_chan(sc, ch); /* make operation atomic */ usb_proc_explore_lock(sc->sc_udev); /* check if not running */ if (ch->running == 0) { - uint32_t temp; + uint32_t temp; /* get current buffer size */ temp = 2 * uaudio_get_buffer_size(ch, ch->set_alt); @@ -2721,13 +2804,15 @@ uaudio_chan_start(struct uaudio_chan *ch) ch->end = ch->buf + temp; ch->cur = ch->buf; - if (uaudio_chan_need_both(sc)) { + if (uaudio_chan_need_both( + &sc->sc_play_chan[i], + &sc->sc_rec_chan[i])) { /* * Start both endpoints because of need for * jitter information: */ - uaudio_chan_start_sub(&sc->sc_rec_chan); - uaudio_chan_start_sub(&sc->sc_play_chan); + uaudio_chan_start_sub(&sc->sc_rec_chan[i]); + uaudio_chan_start_sub(&sc->sc_play_chan[i]); } else { uaudio_chan_start_sub(ch); } @@ -2765,6 +2850,7 @@ void uaudio_chan_stop(struct uaudio_chan *ch) { struct uaudio_softc *sc = ch->priv_sc; + unsigned i = uaudio_get_child_index_by_chan(sc, ch); /* make operation atomic */ usb_proc_explore_lock(sc->sc_udev); @@ -2774,18 +2860,22 @@ uaudio_chan_stop(struct uaudio_chan *ch) /* clear running flag */ ch->running = 0; - if (uaudio_chan_need_both(sc)) { + if (uaudio_chan_need_both( + &sc->sc_play_chan[i], + &sc->sc_rec_chan[i])) { /* * Leave the endpoints running because we need * information about jitter! */ - } else if (uaudio_chan_need_none(sc)) { + } else if (uaudio_chan_need_none( + &sc->sc_play_chan[i], + &sc->sc_rec_chan[i])) { /* * Stop both endpoints in case the one was used for * jitter information: */ - uaudio_chan_stop_sub(&sc->sc_rec_chan); - uaudio_chan_stop_sub(&sc->sc_play_chan); + uaudio_chan_stop_sub(&sc->sc_rec_chan[i]); + uaudio_chan_stop_sub(&sc->sc_play_chan[i]); } else { uaudio_chan_stop_sub(ch); } @@ -2812,12 +2902,12 @@ uaudio_mixer_sysctl_handler(SYSCTL_HANDLER_ARGS) sc = (struct uaudio_softc *)oidp->oid_arg1; hint = oidp->oid_arg2; - if (sc->sc_mixer_lock == NULL) + if (sc->sc_child[0].mixer_lock == NULL) return (ENXIO); /* lookup mixer node */ - mtx_lock(sc->sc_mixer_lock); + mtx_lock(sc->sc_child[0].mixer_lock); for (pmc = sc->sc_mixer_root; pmc != NULL; pmc = pmc->next) { for (chan = 0; chan != (int)pmc->nchan; chan++) { if (pmc->wValue[chan] != -1 && @@ -2828,7 +2918,7 @@ uaudio_mixer_sysctl_handler(SYSCTL_HANDLER_ARGS) } } found: - mtx_unlock(sc->sc_mixer_lock); + mtx_unlock(sc->sc_child[0].mixer_lock); error = sysctl_handle_int(oidp, &temp, 0, req); if (error != 0 || req->newptr == NULL) @@ -2836,7 +2926,7 @@ found: /* update mixer value */ - mtx_lock(sc->sc_mixer_lock); + mtx_lock(sc->sc_child[0].mixer_lock); if (pmc != NULL && temp >= pmc->minval && temp <= pmc->maxval) { @@ -2847,7 +2937,7 @@ found: /* start the transfer, if not already started */ usbd_transfer_start(sc->sc_mixer_xfer[0]); } - mtx_unlock(sc->sc_mixer_lock); + mtx_unlock(sc->sc_child[0].mixer_lock); return (0); } @@ -2864,7 +2954,8 @@ uaudio_mixer_ctl_free(struct uaudio_softc *sc) } static void -uaudio_mixer_register_sysctl(struct uaudio_softc *sc, device_t dev) +uaudio_mixer_register_sysctl(struct uaudio_softc *sc, device_t dev, + unsigned index) { struct uaudio_mixer_node *pmc; struct sysctl_oid *mixer_tree; @@ -2873,6 +2964,9 @@ uaudio_mixer_register_sysctl(struct uaudio_softc *sc, int chan; int n; + if (index != 0) + return; + mixer_tree = SYSCTL_ADD_NODE(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "mixer", CTLFLAG_RD, NULL, ""); @@ -3076,10 +3170,10 @@ uaudio_mixer_reload_all(struct uaudio_softc *sc) struct uaudio_mixer_node *pmc; int chan; - if (sc->sc_mixer_lock == NULL) + if (sc->sc_child[0].mixer_lock == NULL) return; - mtx_lock(sc->sc_mixer_lock); + mtx_lock(sc->sc_child[0].mixer_lock); for (pmc = sc->sc_mixer_root; pmc != NULL; pmc = pmc->next) { /* use reset defaults for non-oss controlled settings */ if (pmc->ctl == SOUND_MIXER_NRDEVICES) @@ -3091,7 +3185,7 @@ uaudio_mixer_reload_all(struct uaudio_softc *sc) /* start HID volume keys, if any */ usbd_transfer_start(sc->sc_hid.xfer[0]); - mtx_unlock(sc->sc_mixer_lock); + mtx_unlock(sc->sc_child[0].mixer_lock); } static void @@ -5285,11 +5379,13 @@ uaudio_mixer_ctl_set(struct uaudio_softc *sc, struct u } static void -uaudio_mixer_init(struct uaudio_softc *sc) +uaudio_mixer_init(struct uaudio_softc *sc, unsigned index) { struct uaudio_mixer_node *mc; int32_t i; + if (index != 0) + return; for (mc = sc->sc_mixer_root; mc; mc = mc->next) { if (mc->ctl != SOUND_MIXER_NRDEVICES) { @@ -5297,7 +5393,7 @@ uaudio_mixer_init(struct uaudio_softc *sc) * Set device mask bits. See * /usr/include/machine/soundcard.h */ - sc->sc_mix_info |= 1U << mc->ctl; + sc->sc_child[index].mix_info |= 1U << mc->ctl; } if ((mc->ctl == SOUND_MIXER_NRDEVICES) && (mc->type == MIX_SELECTOR)) { @@ -5305,7 +5401,7 @@ uaudio_mixer_init(struct uaudio_softc *sc) for (i = mc->minval; (i > 0) && (i <= mc->maxval); i++) { if (mc->slctrtype[i - 1] == SOUND_MIXER_NRDEVICES) continue; - sc->sc_recsrc_info |= 1U << mc->slctrtype[i - 1]; + sc->sc_child[index].recsrc_info |= 1U << mc->slctrtype[i - 1]; } } } @@ -5314,50 +5410,57 @@ uaudio_mixer_init(struct uaudio_softc *sc) int uaudio_mixer_init_sub(struct uaudio_softc *sc, struct snd_mixer *m) { - DPRINTF("\n"); + unsigned i = uaudio_get_child_index_by_dev(sc, mix_get_dev(m)); - sc->sc_mixer_lock = mixer_get_lock(m); - sc->sc_mixer_dev = m; + DPRINTF("child=%u\n", i); - if (usbd_transfer_setup(sc->sc_udev, &sc->sc_mixer_iface_index, + sc->sc_child[i].mixer_lock = mixer_get_lock(m); + sc->sc_child[i].mixer_dev = m; + + if (i == 0 && + usbd_transfer_setup(sc->sc_udev, &sc->sc_mixer_iface_index, sc->sc_mixer_xfer, uaudio_mixer_config, 1, sc, - sc->sc_mixer_lock)) { - DPRINTFN(0, "could not allocate USB " - "transfer for audio mixer!\n"); + sc->sc_child[i].mixer_lock)) { + DPRINTFN(0, "could not allocate USB transfer for mixer!\n"); return (ENOMEM); } - if (sc->sc_play_chan.num_alt > 0 && - (sc->sc_mix_info & SOUND_MASK_VOLUME) == 0) { + if (sc->sc_play_chan[i].num_alt > 0 && + (sc->sc_child[i].mix_info & SOUND_MASK_VOLUME) == 0) { mix_setparentchild(m, SOUND_MIXER_VOLUME, SOUND_MASK_PCM); mix_setrealdev(m, SOUND_MIXER_VOLUME, SOUND_MIXER_NONE); } - mix_setdevs(m, sc->sc_mix_info); - mix_setrecdevs(m, sc->sc_recsrc_info); + mix_setdevs(m, sc->sc_child[i].mix_info); + mix_setrecdevs(m, sc->sc_child[i].recsrc_info); return (0); } int -uaudio_mixer_uninit_sub(struct uaudio_softc *sc) +uaudio_mixer_uninit_sub(struct uaudio_softc *sc, struct snd_mixer *m) { - DPRINTF("\n"); + unsigned index = uaudio_get_child_index_by_dev(sc, mix_get_dev(m)); - usbd_transfer_unsetup(sc->sc_mixer_xfer, 1); + DPRINTF("child=%u\n", index); - sc->sc_mixer_lock = NULL; + if (index == 0) + usbd_transfer_unsetup(sc->sc_mixer_xfer, 1); + sc->sc_child[index].mixer_lock = NULL; + return (0); } void -uaudio_mixer_set(struct uaudio_softc *sc, unsigned type, - unsigned left, unsigned right) +uaudio_mixer_set(struct uaudio_softc *sc, struct snd_mixer *m, + unsigned type, unsigned left, unsigned right) { + unsigned index = uaudio_get_child_index_by_dev(sc, mix_get_dev(m)); struct uaudio_mixer_node *mc; int chan; + if (index != 0) + return; for (mc = sc->sc_mixer_root; mc != NULL; mc = mc->next) { - if (mc->ctl == type) { for (chan = 0; chan < mc->nchan; chan++) { uaudio_mixer_ctl_set(sc, mc, chan, @@ -5368,13 +5471,16 @@ uaudio_mixer_set(struct uaudio_softc *sc, unsigned typ } uint32_t -uaudio_mixer_setrecsrc(struct uaudio_softc *sc, uint32_t src) +uaudio_mixer_setrecsrc(struct uaudio_softc *sc, struct snd_mixer *m, uint32_t src) { + unsigned index = uaudio_get_child_index_by_dev(sc, mix_get_dev(m)); struct uaudio_mixer_node *mc; uint32_t mask; uint32_t temp; int32_t i; + if (index != 0) + return (0); for (mc = sc->sc_mixer_root; mc; mc = mc->next) { if ((mc->ctl == SOUND_MIXER_NRDEVICES) && @@ -6002,7 +6108,7 @@ uaudio_hid_rx_callback(struct usb_xfer *xfer, usb_erro id = 0; } - m = sc->sc_mixer_dev; + m = sc->sc_child[0].mixer_dev; if ((sc->sc_hid.flags & UAUDIO_HID_HAS_MUTE) && (sc->sc_hid.mute_id == id) && @@ -6067,7 +6173,7 @@ uaudio_hid_probe(struct uaudio_softc *sc, if (!(sc->sc_hid.flags & UAUDIO_HID_VALID)) return (-1); - if (sc->sc_mixer_lock == NULL) + if (sc->sc_child[0].mixer_lock == NULL) return (-1); /* Get HID descriptor */ @@ -6128,7 +6234,7 @@ uaudio_hid_probe(struct uaudio_softc *sc, /* allocate USB transfers */ error = usbd_transfer_setup(uaa->device, &sc->sc_hid.iface_index, sc->sc_hid.xfer, uaudio_hid_config, UAUDIO_HID_N_TRANSFER, - sc, sc->sc_mixer_lock); + sc, sc->sc_child[0].mixer_lock); if (error) { DPRINTF("error=%s\n", usbd_errstr(error)); return (-1); Modified: stable/11/sys/dev/sound/usb/uaudio.h ============================================================================== --- stable/11/sys/dev/sound/usb/uaudio.h Mon Apr 13 16:33:10 2020 (r359888) +++ stable/11/sys/dev/sound/usb/uaudio.h Mon Apr 13 16:33:45 2020 (r359889) @@ -39,7 +39,7 @@ struct pcm_channel; extern int uaudio_attach_sub(device_t dev, kobj_class_t mixer_class, kobj_class_t chan_class); extern int uaudio_detach_sub(device_t dev); -extern void *uaudio_chan_init(struct uaudio_softc *sc, struct snd_dbuf *b, +extern void *uaudio_chan_init(struct uaudio_chan *ch, struct snd_dbuf *b, struct pcm_channel *c, int dir); extern int uaudio_chan_free(struct uaudio_chan *ch); extern int uaudio_chan_set_param_blocksize(struct uaudio_chan *ch, @@ -56,12 +56,12 @@ extern int uaudio_chan_set_param_format(struct uaudio_ uint32_t format); extern void uaudio_chan_start(struct uaudio_chan *ch); extern void uaudio_chan_stop(struct uaudio_chan *ch); -extern int uaudio_mixer_init_sub(struct uaudio_softc *sc, - struct snd_mixer *m); -extern int uaudio_mixer_uninit_sub(struct uaudio_softc *sc); -extern void uaudio_mixer_set(struct uaudio_softc *sc, unsigned type, - unsigned left, unsigned right); -extern uint32_t uaudio_mixer_setrecsrc(struct uaudio_softc *sc, uint32_t src); +extern int uaudio_mixer_init_sub(struct uaudio_softc *, struct snd_mixer *); +extern int uaudio_mixer_uninit_sub(struct uaudio_softc *, struct snd_mixer *); +extern void uaudio_mixer_set(struct uaudio_softc *, struct snd_mixer *, + unsigned type, unsigned left, unsigned right); +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); Modified: stable/11/sys/dev/sound/usb/uaudio_pcm.c ============================================================================== --- stable/11/sys/dev/sound/usb/uaudio_pcm.c Mon Apr 13 16:33:10 2020 (r359888) +++ stable/11/sys/dev/sound/usb/uaudio_pcm.c Mon Apr 13 16:33:45 2020 (r359889) @@ -144,7 +144,7 @@ ua_mixer_set(struct snd_mixer *m, unsigned type, unsig do_unlock = 1; mtx_lock(mtx); } - uaudio_mixer_set(mix_getdevinfo(m), type, left, right); + uaudio_mixer_set(mix_getdevinfo(m), m, type, left, right); if (do_unlock) { mtx_unlock(mtx); } @@ -164,7 +164,7 @@ ua_mixer_setrecsrc(struct snd_mixer *m, uint32_t src) do_unlock = 1; mtx_lock(mtx); } - retval = uaudio_mixer_setrecsrc(mix_getdevinfo(m), src); + retval = uaudio_mixer_setrecsrc(mix_getdevinfo(m), m, src); if (do_unlock) { mtx_unlock(mtx); } @@ -174,7 +174,7 @@ ua_mixer_setrecsrc(struct snd_mixer *m, uint32_t src) static int ua_mixer_uninit(struct snd_mixer *m) { - return (uaudio_mixer_uninit_sub(mix_getdevinfo(m))); + return (uaudio_mixer_uninit_sub(mix_getdevinfo(m), m)); } static kobj_method_t ua_mixer_methods[] = { From owner-svn-src-stable-11@freebsd.org Mon Apr 13 22:21:02 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8405D2AAEAC; Mon, 13 Apr 2020 22:21:02 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 491NPB2kt8z4Hq8; Mon, 13 Apr 2020 22:21:02 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 592D022998; Mon, 13 Apr 2020 22:21:02 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03DML2T2010950; Mon, 13 Apr 2020 22:21:02 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03DML262010949; Mon, 13 Apr 2020 22:21:02 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <202004132221.03DML262010949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Mon, 13 Apr 2020 22:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359907 - stable/11/sys/dev/evdev X-SVN-Group: stable-11 X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: stable/11/sys/dev/evdev X-SVN-Commit-Revision: 359907 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 22:21:02 -0000 Author: wulf Date: Mon Apr 13 22:21:01 2020 New Revision: 359907 URL: https://svnweb.freebsd.org/changeset/base/359907 Log: MFC r359428: evdev: Add COMPAT_FREEBSD32 support for amd64 arch Incompatibility between i386 and amd64 evdev ABIs was caused by presence of 'struct timeval' in evdev protocol. Replace it with 'struct timeval32' for 32 bit binaries. Big-endian platforms may require additional work due to bitstr_t (array of unsigned longs) usage in ioctl interface. MFC r359429: evdev: return error rather than zero-length data on blocked read() if blocked process has been woken up by evdev device destruction. Modified: stable/11/sys/dev/evdev/cdev.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/evdev/cdev.c ============================================================================== --- stable/11/sys/dev/evdev/cdev.c Mon Apr 13 22:18:49 2020 (r359906) +++ stable/11/sys/dev/evdev/cdev.c Mon Apr 13 22:21:01 2020 (r359907) @@ -47,6 +47,18 @@ #include #include +#ifdef COMPAT_FREEBSD32 +#include +#include +#include +struct input_event32 { + struct timeval32 time; + uint16_t type; + uint16_t code; + int32_t value; +}; +#endif + #ifdef EVDEV_DEBUG #define debugf(client, fmt, args...) printf("evdev cdev: "fmt"\n", ##args) #else @@ -161,7 +173,14 @@ static int evdev_read(struct cdev *dev, struct uio *uio, int ioflag) { struct evdev_client *client; - struct input_event event; + union { + struct input_event t; +#ifdef COMPAT_FREEBSD32 + struct input_event32 t32; +#endif + } event; + struct input_event *head; + size_t evsize; int ret = 0; int remaining; @@ -175,11 +194,18 @@ evdev_read(struct cdev *dev, struct uio *uio, int iofl if (client->ec_revoked) return (ENODEV); +#ifdef COMPAT_FREEBSD32 + if (SV_CURPROC_FLAG(SV_ILP32)) + evsize = sizeof(struct input_event32); + else +#endif + evsize = sizeof(struct input_event); + /* Zero-sized reads are allowed for error checking */ - if (uio->uio_resid != 0 && uio->uio_resid < sizeof(struct input_event)) + if (uio->uio_resid != 0 && uio->uio_resid < evsize) return (EINVAL); - remaining = uio->uio_resid / sizeof(struct input_event); + remaining = uio->uio_resid / evsize; EVDEV_CLIENT_LOCKQ(client); @@ -191,19 +217,31 @@ evdev_read(struct cdev *dev, struct uio *uio, int iofl client->ec_blocked = true; ret = mtx_sleep(client, &client->ec_buffer_mtx, PCATCH, "evread", 0); + if (ret == 0 && client->ec_revoked) + ret = ENODEV; } } } while (ret == 0 && !EVDEV_CLIENT_EMPTYQ(client) && remaining > 0) { - memcpy(&event, &client->ec_buffer[client->ec_buffer_head], - sizeof(struct input_event)); + head = client->ec_buffer + client->ec_buffer_head; +#ifdef COMPAT_FREEBSD32 + if (SV_CURPROC_FLAG(SV_ILP32)) { + bzero(&event.t32, sizeof(struct input_event32)); + TV_CP(*head, event.t32, time); + CP(*head, event.t32, type); + CP(*head, event.t32, code); + CP(*head, event.t32, value); + } else +#endif + bcopy(head, &event.t, evsize); + client->ec_buffer_head = (client->ec_buffer_head + 1) % client->ec_buffer_size; remaining--; EVDEV_CLIENT_UNLOCKQ(client); - ret = uiomove(&event, sizeof(struct input_event), uio); + ret = uiomove(&event, evsize, uio); EVDEV_CLIENT_LOCKQ(client); } @@ -217,7 +255,13 @@ evdev_write(struct cdev *dev, struct uio *uio, int iof { struct evdev_dev *evdev = dev->si_drv1; struct evdev_client *client; - struct input_event event; + union { + struct input_event t; +#ifdef COMPAT_FREEBSD32 + struct input_event32 t32; +#endif + } event; + size_t evsize; int ret = 0; ret = devfs_get_cdevpriv((void **)&client); @@ -230,16 +274,30 @@ evdev_write(struct cdev *dev, struct uio *uio, int iof if (client->ec_revoked || evdev == NULL) return (ENODEV); - if (uio->uio_resid % sizeof(struct input_event) != 0) { +#ifdef COMPAT_FREEBSD32 + if (SV_CURPROC_FLAG(SV_ILP32)) + evsize = sizeof(struct input_event32); + else +#endif + evsize = sizeof(struct input_event); + + if (uio->uio_resid % evsize != 0) { debugf(client, "write size not multiple of input_event size"); return (EINVAL); } while (uio->uio_resid > 0 && ret == 0) { - ret = uiomove(&event, sizeof(struct input_event), uio); - if (ret == 0) - ret = evdev_inject_event(evdev, event.type, event.code, - event.value); + ret = uiomove(&event, evsize, uio); + if (ret == 0) { +#ifdef COMPAT_FREEBSD32 + if (SV_CURPROC_FLAG(SV_ILP32)) + ret = evdev_inject_event(evdev, event.t32.type, + event.t32.code, event.t32.value); + else +#endif + ret = evdev_inject_event(evdev, event.t.type, + event.t.code, event.t.value); + } } return (ret); From owner-svn-src-stable-11@freebsd.org Wed Apr 15 04:52:59 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96D1E2AAD22; Wed, 15 Apr 2020 04:52:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49292z3Q2Hz4GBq; Wed, 15 Apr 2020 04:52:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7049D1982D; Wed, 15 Apr 2020 04:52:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03F4qx1q015069; Wed, 15 Apr 2020 04:52:59 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03F4qx5E015068; Wed, 15 Apr 2020 04:52:59 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004150452.03F4qx5E015068@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 15 Apr 2020 04:52:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359956 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 359956 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2020 04:52:59 -0000 Author: hselasky Date: Wed Apr 15 04:52:59 2020 New Revision: 359956 URL: https://svnweb.freebsd.org/changeset/base/359956 Log: MFC r359726: Some fixes for SRCU in the LinuxKPI. - Make sure to use READ_ONCE() when deferring variables. - Remove superfluous zero initializer. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/srcu.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/srcu.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/srcu.h Wed Apr 15 04:52:10 2020 (r359955) +++ stable/11/sys/compat/linuxkpi/common/include/linux/srcu.h Wed Apr 15 04:52:59 2020 (r359956) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2017 Mellanox Technologies, Ltd. + * Copyright (c) 2015-2020 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,13 +29,16 @@ #ifndef _LINUX_SRCU_H_ #define _LINUX_SRCU_H_ +#include + struct srcu_struct { }; -#define srcu_dereference(ptr,srcu) ((__typeof(*(ptr)) *)(ptr)) +#define srcu_dereference(p, srcu) \ + ((__typeof(*(p)) *)READ_ONCE(p)) #define DEFINE_STATIC_SRCU(name) \ - static struct srcu_struct name = {} + static struct srcu_struct name /* prototypes */ From owner-svn-src-stable-11@freebsd.org Wed Apr 15 05:02:50 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A2962AB00B; Wed, 15 Apr 2020 05:02:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4929GL3687z4Gh7; Wed, 15 Apr 2020 05:02:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 65D4D19A0A; Wed, 15 Apr 2020 05:02:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03F52oSQ021692; Wed, 15 Apr 2020 05:02:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03F52nAF021690; Wed, 15 Apr 2020 05:02:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004150502.03F52nAF021690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 15 Apr 2020 05:02:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359958 - in stable/11/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys X-SVN-Commit-Revision: 359958 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2020 05:02:50 -0000 Author: hselasky Date: Wed Apr 15 05:02:49 2020 New Revision: 359958 URL: https://svnweb.freebsd.org/changeset/base/359958 Log: MFC r359727: Clone the RCU interface into a sleepable and a non-sleepable part in the LinuxKPI. This allows synchronize RCU to be used inside a SRCU read section. No functional change intended. Bump the __FreeBSD_version to force recompilation of external kernel modules. PR: 242272 Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/rcupdate.h stable/11/sys/compat/linuxkpi/common/src/linux_rcu.c stable/11/sys/sys/param.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/rcupdate.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/rcupdate.h Wed Apr 15 04:56:27 2020 (r359957) +++ stable/11/sys/compat/linuxkpi/common/include/linux/rcupdate.h Wed Apr 15 05:02:49 2020 (r359958) @@ -35,6 +35,11 @@ #define LINUX_KFREE_RCU_OFFSET_MAX 4096 /* exclusive */ +/* BSD specific defines */ +#define RCU_TYPE_REGULAR 0 +#define RCU_TYPE_SLEEPABLE 1 +#define RCU_TYPE_MAX 2 + #define RCU_INITIALIZER(v) \ ((__typeof(*(v)) *)(v)) @@ -43,27 +48,27 @@ } while (0) #define call_rcu(ptr, func) do { \ - linux_call_rcu(ptr, func); \ + linux_call_rcu(RCU_TYPE_REGULAR, ptr, func); \ } while (0) #define rcu_barrier(void) do { \ - linux_rcu_barrier(); \ + linux_rcu_barrier(RCU_TYPE_REGULAR); \ } while (0) #define rcu_read_lock(void) do { \ - linux_rcu_read_lock(); \ + linux_rcu_read_lock(RCU_TYPE_REGULAR); \ } while (0) #define rcu_read_unlock(void) do { \ - linux_rcu_read_unlock(); \ + linux_rcu_read_unlock(RCU_TYPE_REGULAR);\ } while (0) #define synchronize_rcu(void) do { \ - linux_synchronize_rcu(); \ + linux_synchronize_rcu(RCU_TYPE_REGULAR); \ } while (0) #define synchronize_rcu_expedited(void) do { \ - linux_synchronize_rcu(); \ + linux_synchronize_rcu(RCU_TYPE_REGULAR); \ } while (0) #define kfree_rcu(ptr, rcu_head) do { \ @@ -94,11 +99,11 @@ /* prototypes */ -extern void linux_call_rcu(struct rcu_head *ptr, rcu_callback_t func); -extern void linux_rcu_barrier(void); -extern void linux_rcu_read_lock(void); -extern void linux_rcu_read_unlock(void); -extern void linux_synchronize_rcu(void); +extern void linux_call_rcu(unsigned type, struct rcu_head *ptr, rcu_callback_t func); +extern void linux_rcu_barrier(unsigned type); +extern void linux_rcu_read_lock(unsigned type); +extern void linux_rcu_read_unlock(unsigned type); +extern void linux_synchronize_rcu(unsigned type); /* Empty implementation for !DEBUG */ #define init_rcu_head(...) Modified: stable/11/sys/compat/linuxkpi/common/src/linux_rcu.c ============================================================================== --- stable/11/sys/compat/linuxkpi/common/src/linux_rcu.c Wed Apr 15 04:56:27 2020 (r359957) +++ stable/11/sys/compat/linuxkpi/common/src/linux_rcu.c Wed Apr 15 05:02:49 2020 (r359958) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2016 Matthew Macy (mmacy@mattmacy.io) + * Copyright (c) 2017-2020 Hans Petter Selasky (hselasky@freebsd.org) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -89,9 +90,9 @@ CTASSERT(sizeof(struct rcu_head) == sizeof(struct call */ CTASSERT(offsetof(struct linux_epoch_record, epoch_record) == 0); -static ck_epoch_t linux_epoch; -static struct linux_epoch_head linux_epoch_head; -static DPCPU_DEFINE(struct linux_epoch_record, linux_epoch_record); +static ck_epoch_t linux_epoch[RCU_TYPE_MAX]; +static struct linux_epoch_head linux_epoch_head[RCU_TYPE_MAX]; +static DPCPU_DEFINE(struct linux_epoch_record, linux_epoch_record[RCU_TYPE_MAX]); static void linux_rcu_cleaner_func(void *, int); @@ -100,23 +101,27 @@ linux_rcu_runtime_init(void *arg __unused) { struct linux_epoch_head *head; int i; + int j; - ck_epoch_init(&linux_epoch); + for (j = 0; j != RCU_TYPE_MAX; j++) { + ck_epoch_init(&linux_epoch[j]); - head = &linux_epoch_head; + head = &linux_epoch_head[j]; - mtx_init(&head->lock, "LRCU-HEAD", NULL, MTX_DEF); - TASK_INIT(&head->task, 0, linux_rcu_cleaner_func, NULL); - STAILQ_INIT(&head->cb_head); + mtx_init(&head->lock, "LRCU-HEAD", NULL, MTX_DEF); + TASK_INIT(&head->task, 0, linux_rcu_cleaner_func, head); + STAILQ_INIT(&head->cb_head); - CPU_FOREACH(i) { - struct linux_epoch_record *record; + CPU_FOREACH(i) { + struct linux_epoch_record *record; - record = &DPCPU_ID_GET(i, linux_epoch_record); + record = &DPCPU_ID_GET(i, linux_epoch_record[j]); - record->cpuid = i; - ck_epoch_register(&linux_epoch, &record->epoch_record, NULL); - TAILQ_INIT(&record->ts_head); + record->cpuid = i; + ck_epoch_register(&linux_epoch[j], + &record->epoch_record, NULL); + TAILQ_INIT(&record->ts_head); + } } } SYSINIT(linux_rcu_runtime, SI_SUB_CPU, SI_ORDER_ANY, linux_rcu_runtime_init, NULL); @@ -125,24 +130,27 @@ static void linux_rcu_runtime_uninit(void *arg __unused) { struct linux_epoch_head *head; + int j; - head = &linux_epoch_head; + for (j = 0; j != RCU_TYPE_MAX; j++) { + head = &linux_epoch_head[j]; - /* destroy head lock */ - mtx_destroy(&head->lock); + mtx_destroy(&head->lock); + } } SYSUNINIT(linux_rcu_runtime, SI_SUB_LOCK, SI_ORDER_SECOND, linux_rcu_runtime_uninit, NULL); static void -linux_rcu_cleaner_func(void *context __unused, int pending __unused) +linux_rcu_cleaner_func(void *context, int pending __unused) { struct linux_epoch_head *head; struct callback_head *rcu; STAILQ_HEAD(, callback_head) tmp_head; + uintptr_t offset; linux_set_current(curthread); - head = &linux_epoch_head; + head = context; /* move current callbacks into own queue */ mtx_lock(&head->lock); @@ -151,11 +159,10 @@ linux_rcu_cleaner_func(void *context __unused, int pen mtx_unlock(&head->lock); /* synchronize */ - linux_synchronize_rcu(); + linux_synchronize_rcu(head - linux_epoch_head); /* dispatch all callbacks, if any */ while ((rcu = STAILQ_FIRST(&tmp_head)) != NULL) { - uintptr_t offset; STAILQ_REMOVE_HEAD(&tmp_head, entry); @@ -169,11 +176,13 @@ linux_rcu_cleaner_func(void *context __unused, int pen } void -linux_rcu_read_lock(void) +linux_rcu_read_lock(unsigned type) { struct linux_epoch_record *record; struct task_struct *ts; + MPASS(type < RCU_TYPE_MAX); + if (RCU_SKIP()) return; @@ -183,7 +192,7 @@ linux_rcu_read_lock(void) */ sched_pin(); - record = &DPCPU_GET(linux_epoch_record); + record = &DPCPU_GET(linux_epoch_record[type]); ts = current; /* @@ -199,15 +208,17 @@ linux_rcu_read_lock(void) } void -linux_rcu_read_unlock(void) +linux_rcu_read_unlock(unsigned type) { struct linux_epoch_record *record; struct task_struct *ts; + MPASS(type < RCU_TYPE_MAX); + if (RCU_SKIP()) return; - record = &DPCPU_GET(linux_epoch_record); + record = &DPCPU_GET(linux_epoch_record[type]); ts = current; /* @@ -281,7 +292,7 @@ linux_synchronize_rcu_cb(ck_epoch_t *epoch __unused, c } void -linux_synchronize_rcu(void) +linux_synchronize_rcu(unsigned type) { struct thread *td; int was_bound; @@ -289,6 +300,8 @@ linux_synchronize_rcu(void) int old_pinned; u_char old_prio; + MPASS(type < RCU_TYPE_MAX); + if (RCU_SKIP()) return; @@ -312,7 +325,7 @@ linux_synchronize_rcu(void) td->td_pinned = 0; sched_bind(td, old_cpu); - ck_epoch_synchronize_wait(&linux_epoch, + ck_epoch_synchronize_wait(&linux_epoch[type], &linux_synchronize_rcu_cb, NULL); /* restore CPU binding, if any */ @@ -335,24 +348,31 @@ linux_synchronize_rcu(void) } void -linux_rcu_barrier(void) +linux_rcu_barrier(unsigned type) { struct linux_epoch_head *head; - linux_synchronize_rcu(); + MPASS(type < RCU_TYPE_MAX); - head = &linux_epoch_head; + linux_synchronize_rcu(type); + head = &linux_epoch_head[type]; + /* wait for callbacks to complete */ taskqueue_drain(taskqueue_fast, &head->task); } void -linux_call_rcu(struct rcu_head *context, rcu_callback_t func) +linux_call_rcu(unsigned type, struct rcu_head *context, rcu_callback_t func) { - struct callback_head *rcu = (struct callback_head *)context; - struct linux_epoch_head *head = &linux_epoch_head; + struct callback_head *rcu; + struct linux_epoch_head *head; + MPASS(type < RCU_TYPE_MAX); + + rcu = (struct callback_head *)context; + head = &linux_epoch_head[type]; + mtx_lock(&head->lock); rcu->func = func; STAILQ_INSERT_TAIL(&head->cb_head, rcu, entry); @@ -374,24 +394,24 @@ cleanup_srcu_struct(struct srcu_struct *srcu) int srcu_read_lock(struct srcu_struct *srcu) { - linux_rcu_read_lock(); + linux_rcu_read_lock(RCU_TYPE_SLEEPABLE); return (0); } void srcu_read_unlock(struct srcu_struct *srcu, int key __unused) { - linux_rcu_read_unlock(); + linux_rcu_read_unlock(RCU_TYPE_SLEEPABLE); } void synchronize_srcu(struct srcu_struct *srcu) { - linux_synchronize_rcu(); + linux_synchronize_rcu(RCU_TYPE_SLEEPABLE); } void srcu_barrier(struct srcu_struct *srcu) { - linux_rcu_barrier(); + linux_rcu_barrier(RCU_TYPE_SLEEPABLE); } Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Wed Apr 15 04:56:27 2020 (r359957) +++ stable/11/sys/sys/param.h Wed Apr 15 05:02:49 2020 (r359958) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1103508 /* Master, propagated to newvers */ +#define __FreeBSD_version 1103509 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable-11@freebsd.org Wed Apr 15 13:59:09 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D17272B7B6F; Wed, 15 Apr 2020 13:59:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 492P995DCsz3NkH; Wed, 15 Apr 2020 13:59:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE77A1FF7C; Wed, 15 Apr 2020 13:59:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03FDx9Tw051744; Wed, 15 Apr 2020 13:59:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03FDx9kf051743; Wed, 15 Apr 2020 13:59:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202004151359.03FDx9kf051743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 15 Apr 2020 13:59:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359971 - stable/11/sys/dev/ahci X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/ahci X-SVN-Commit-Revision: 359971 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2020 13:59:09 -0000 Author: mav Date: Wed Apr 15 13:59:09 2020 New Revision: 359971 URL: https://svnweb.freebsd.org/changeset/base/359971 Log: MFC r359499: Add ID for JMicron JMB582/JMB585 AHCI controller. JMB582 has 2 6Gbps SATA ports and PCIe 3.0 x1. JMB585 has 5 6Gbps SATA ports and PCIe 3.0 x2. Both chips support AHCI v1.31, Port Multiplier with FBS and 8 MSI vectors. Modified: stable/11/sys/dev/ahci/ahci_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ahci/ahci_pci.c ============================================================================== --- stable/11/sys/dev/ahci/ahci_pci.c Wed Apr 15 13:58:42 2020 (r359970) +++ stable/11/sys/dev/ahci/ahci_pci.c Wed Apr 15 13:59:09 2020 (r359971) @@ -247,6 +247,7 @@ static const struct { {0x2365197b, 0x00, "JMicron JMB365", AHCI_Q_NOFORCE}, {0x2366197b, 0x00, "JMicron JMB366", AHCI_Q_NOFORCE}, {0x2368197b, 0x00, "JMicron JMB368", AHCI_Q_NOFORCE}, + {0x0585197b, 0x00, "JMicron JMB58x", 0}, {0x611111ab, 0x00, "Marvell 88SE6111", AHCI_Q_NOFORCE | AHCI_Q_NOPMP | AHCI_Q_1CH | AHCI_Q_EDGEIS}, {0x612111ab, 0x00, "Marvell 88SE6121", AHCI_Q_NOFORCE | AHCI_Q_NOPMP | @@ -401,6 +402,7 @@ ahci_probe(device_t dev) !(ahci_ids[i].quirks & AHCI_Q_NOFORCE)))) { /* Do not attach JMicrons with single PCI function. */ if (pci_get_vendor(dev) == 0x197b && + (ahci_ids[i].quirks & AHCI_Q_NOFORCE) && (pci_read_config(dev, 0xdf, 1) & 0x40) == 0) return (ENXIO); snprintf(buf, sizeof(buf), "%s AHCI SATA controller", From owner-svn-src-stable-11@freebsd.org Thu Apr 16 11:49:14 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D7B72BA6E0; Thu, 16 Apr 2020 11:49:14 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 492yDp2Hg7z4Nls; Thu, 16 Apr 2020 11:49:14 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49A4083F8; Thu, 16 Apr 2020 11:49:14 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03GBnEK6074862; Thu, 16 Apr 2020 11:49:14 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03GBnEDk074861; Thu, 16 Apr 2020 11:49:14 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202004161149.03GBnEDk074861@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Thu, 16 Apr 2020 11:49:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r360006 - stable/11/usr.bin/wc X-SVN-Group: stable-11 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/11/usr.bin/wc X-SVN-Commit-Revision: 360006 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Apr 2020 11:49:14 -0000 Author: eugen Date: Thu Apr 16 11:49:13 2020 New Revision: 360006 URL: https://svnweb.freebsd.org/changeset/base/360006 Log: MFC r359801: wc(1): document SIGINFO handling in the manual page. Modified: stable/11/usr.bin/wc/wc.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/wc/wc.1 ============================================================================== --- stable/11/usr.bin/wc/wc.1 Thu Apr 16 11:47:53 2020 (r360005) +++ stable/11/usr.bin/wc/wc.1 Thu Apr 16 11:49:13 2020 (r360006) @@ -31,7 +31,7 @@ .\" @(#)wc.1 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd December 1, 2015 +.Dd April 11, 2020 .Dt WC 1 .Os .Sh NAME @@ -123,6 +123,18 @@ file name is displayed. The prompt will accept input until receiving EOF, or .Bq ^D in most environments. +.Pp +If +.Nm +receives a +.Dv SIGINFO +(see the +.Cm status +argument for +.Xr stty 1 ) +signal, the interim data will be written +to the standard error output in the same format +as the standard completion message. .Sh ENVIRONMENT The .Ev LANG , LC_ALL From owner-svn-src-stable-11@freebsd.org Fri Apr 17 01:52:28 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 354EE2CE01E; Fri, 17 Apr 2020 01:52:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 493Jxm0gXlz4NnZ; Fri, 17 Apr 2020 01:52:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1252D1AB21; Fri, 17 Apr 2020 01:52:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03H1qR7Y008577; Fri, 17 Apr 2020 01:52:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03H1qRdC008576; Fri, 17 Apr 2020 01:52:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202004170152.03H1qRdC008576@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 17 Apr 2020 01:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r360030 - stable/11/sys/ufs/ffs X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/ufs/ffs X-SVN-Commit-Revision: 360030 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2020 01:52:28 -0000 Author: kib Date: Fri Apr 17 01:52:27 2020 New Revision: 360030 URL: https://svnweb.freebsd.org/changeset/base/360030 Log: MFC r359766: ufs: apply suspension for non-forced rw unmounts. Modified: stable/11/sys/ufs/ffs/ffs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- stable/11/sys/ufs/ffs/ffs_vfsops.c Fri Apr 17 01:06:51 2020 (r360029) +++ stable/11/sys/ufs/ffs/ffs_vfsops.c Fri Apr 17 01:52:27 2020 (r360030) @@ -1252,11 +1252,9 @@ ffs_unmount(mp, mntflags) flags = 0; td = curthread; fs = ump->um_fs; - susp = 0; - if (mntflags & MNT_FORCE) { + if (mntflags & MNT_FORCE) flags |= FORCECLOSE; - susp = fs->fs_ronly == 0; - } + susp = fs->fs_ronly == 0; #ifdef UFS_EXTATTR if ((error = ufs_extattr_stop(mp, td))) { if (error != EOPNOTSUPP) From owner-svn-src-stable-11@freebsd.org Fri Apr 17 07:41:27 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B37212AE329; Fri, 17 Apr 2020 07:41:27 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 493ShR4Gktz4kZ1; Fri, 17 Apr 2020 07:41:27 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8DEEE1EDCB; Fri, 17 Apr 2020 07:41:27 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03H7fRg4026452; Fri, 17 Apr 2020 07:41:27 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03H7fRAv026451; Fri, 17 Apr 2020 07:41:27 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202004170741.03H7fRAv026451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Fri, 17 Apr 2020 07:41:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r360039 - stable/11/sbin/umount X-SVN-Group: stable-11 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: stable/11/sbin/umount X-SVN-Commit-Revision: 360039 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2020 07:41:27 -0000 Author: 0mp (doc,ports committer) Date: Fri Apr 17 07:41:27 2020 New Revision: 360039 URL: https://svnweb.freebsd.org/changeset/base/360039 Log: MFC 359916: Improve manual page formatting - Use appropriate macros for command arguments. - Increase option list indentation for better readability. Modified: stable/11/sbin/umount/umount.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/umount/umount.8 ============================================================================== --- stable/11/sbin/umount/umount.8 Fri Apr 17 07:40:56 2020 (r360038) +++ stable/11/sbin/umount/umount.8 Fri Apr 17 07:41:27 2020 (r360039) @@ -28,7 +28,7 @@ .\" @(#)umount.8 8.2 (Berkeley) 5/8/95 .\" $FreeBSD$ .\" -.Dd July 25, 2017 +.Dd April 14, 2020 .Dt UMOUNT 8 .Os .Sh NAME @@ -52,7 +52,9 @@ utility calls the system call to remove a file system from the file system tree. The file system can be specified by its .Ar special -device or remote node (rhost:path), the path to the mount point +device or remote node +.Pq Ar rhost Ns Cm \& : Ns Ar path , +the path to the mount point .Ar node or by the file system ID .Ar fsid @@ -61,7 +63,7 @@ as reported by when run by root. .Pp The options are as follows: -.Bl -tag -width indent +.Bl -tag -width "-F fstab" .It Fl a All the file systems described in .Xr fstab 5