From owner-svn-src-all@FreeBSD.ORG Sun May 8 01:01:27 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A69AE1065670; Sun, 8 May 2011 01:01:27 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C7EB8FC1B; Sun, 8 May 2011 01:01:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4811Rr9022211; Sun, 8 May 2011 01:01:27 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4811RDN022207; Sun, 8 May 2011 01:01:27 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201105080101.p4811RDN022207@svn.freebsd.org> From: Rick Macklem Date: Sun, 8 May 2011 01:01:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221615 - in head: etc/rc.d sys/fs/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 01:01:27 -0000 Author: rmacklem Date: Sun May 8 01:01:27 2011 New Revision: 221615 URL: http://svn.freebsd.org/changeset/base/221615 Log: Change the new NFS server so that it uses vfs.nfsd naming for its sysctls instead of vfs.newnfs. This separates the names from the ones used by the client. Modified: head/etc/rc.d/nfsd head/sys/fs/nfsserver/nfs_nfsdkrpc.c head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/etc/rc.d/nfsd ============================================================================== --- head/etc/rc.d/nfsd Sun May 8 00:39:49 2011 (r221614) +++ head/etc/rc.d/nfsd Sun May 8 01:01:27 2011 (r221615) @@ -33,13 +33,13 @@ nfsd_precmd() else rc_flags="${nfs_server_flags}" - # Load the modules now, so that the vfs.newnfs sysctl + # Load the modules now, so that the vfs.nfsd sysctl # oids are available. load_kld nfsd if checkyesno nfs_reserved_port_only; then echo 'NFS on reserved port only=YES' - sysctl vfs.newnfs.nfs_privport=1 > /dev/null + sysctl vfs.nfsd.nfs_privport=1 > /dev/null fi if checkyesno nfsv4_server_enable; then @@ -52,7 +52,7 @@ nfsd_precmd() fi else echo 'NFSv4 is disabled' - sysctl vfs.newnfs.server_max_nfsvers=3 > /dev/null + sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null fi fi Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdkrpc.c Sun May 8 00:39:49 2011 (r221614) +++ head/sys/fs/nfsserver/nfs_nfsdkrpc.c Sun May 8 01:01:27 2011 (r221615) @@ -75,21 +75,21 @@ static int newnfs_nfsv3_procid[NFS_V3NPR }; -SYSCTL_DECL(_vfs_newnfs); +SYSCTL_DECL(_vfs_nfsd); SVCPOOL *nfsrvd_pool; static int nfs_privport = 0; -SYSCTL_INT(_vfs_newnfs, OID_AUTO, nfs_privport, CTLFLAG_RW, +SYSCTL_INT(_vfs_nfsd, OID_AUTO, nfs_privport, CTLFLAG_RW, &nfs_privport, 0, "Only allow clients using a privileged port for NFSv2 and 3"); static int nfs_minvers = NFS_VER2; -SYSCTL_INT(_vfs_newnfs, OID_AUTO, server_min_nfsvers, CTLFLAG_RW, +SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_min_nfsvers, CTLFLAG_RW, &nfs_minvers, 0, "The lowest version of NFS handled by the server"); static int nfs_maxvers = NFS_VER4; -SYSCTL_INT(_vfs_newnfs, OID_AUTO, server_max_nfsvers, CTLFLAG_RW, +SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_max_nfsvers, CTLFLAG_RW, &nfs_maxvers, 0, "The highest version of NFS handled by the server"); static int nfs_proc(struct nfsrv_descript *, u_int32_t, struct socket *, @@ -475,7 +475,7 @@ nfsrvd_init(int terminating) NFSD_UNLOCK(); - nfsrvd_pool = svcpool_create("nfsd", SYSCTL_STATIC_CHILDREN(_vfs_newnfs)); + nfsrvd_pool = svcpool_create("nfsd", SYSCTL_STATIC_CHILDREN(_vfs_nfsd)); nfsrvd_pool->sp_rcache = NULL; nfsrvd_pool->sp_assign = NULL; nfsrvd_pool->sp_done = NULL; Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Sun May 8 00:39:49 2011 (r221614) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Sun May 8 01:01:27 2011 (r221615) @@ -76,16 +76,16 @@ static int nfs_commit_miss; extern int nfsrv_issuedelegs; extern int nfsrv_dolocallocks; -SYSCTL_DECL(_vfs_newnfs); -SYSCTL_INT(_vfs_newnfs, OID_AUTO, mirrormnt, CTLFLAG_RW, +SYSCTL_NODE(_vfs, OID_AUTO, nfsd, CTLFLAG_RW, 0, "New NFS server"); +SYSCTL_INT(_vfs_nfsd, OID_AUTO, mirrormnt, CTLFLAG_RW, &nfsrv_enable_crossmntpt, 0, "Enable nfsd to cross mount points"); -SYSCTL_INT(_vfs_newnfs, OID_AUTO, commit_blks, CTLFLAG_RW, &nfs_commit_blks, +SYSCTL_INT(_vfs_nfsd, OID_AUTO, commit_blks, CTLFLAG_RW, &nfs_commit_blks, 0, ""); -SYSCTL_INT(_vfs_newnfs, OID_AUTO, commit_miss, CTLFLAG_RW, &nfs_commit_miss, +SYSCTL_INT(_vfs_nfsd, OID_AUTO, commit_miss, CTLFLAG_RW, &nfs_commit_miss, 0, ""); -SYSCTL_INT(_vfs_newnfs, OID_AUTO, issue_delegations, CTLFLAG_RW, +SYSCTL_INT(_vfs_nfsd, OID_AUTO, issue_delegations, CTLFLAG_RW, &nfsrv_issuedelegs, 0, "Enable nfsd to issue delegations"); -SYSCTL_INT(_vfs_newnfs, OID_AUTO, enable_locallocks, CTLFLAG_RW, +SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_locallocks, CTLFLAG_RW, &nfsrv_dolocallocks, 0, "Enable nfsd to acquire local locks on files"); #define NUM_HEURISTIC 1017 From owner-svn-src-all@FreeBSD.ORG Sun May 8 03:24:18 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 680181065673; Sun, 8 May 2011 03:24:18 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C2698FC0A; Sun, 8 May 2011 03:24:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p483OIKh027044; Sun, 8 May 2011 03:24:18 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p483OIfF027042; Sun, 8 May 2011 03:24:18 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105080324.p483OIfF027042@svn.freebsd.org> From: Adrian Chadd Date: Sun, 8 May 2011 03:24:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221616 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 03:24:18 -0000 Author: adrian Date: Sun May 8 03:24:17 2011 New Revision: 221616 URL: http://svn.freebsd.org/changeset/base/221616 Log: Fiddle with the AR5416 1.0 chainmask setup. Apparently all three RX chains need to be enabled before initial calibration is done, even if only two are configured. Reorder the alt chain swap bit to match what the Atheros HAL is doing. Obtained From: ath9k, Atheros Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sun May 8 01:01:27 2011 (r221615) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sun May 8 03:24:17 2011 (r221616) @@ -1285,26 +1285,46 @@ ar5416SetReset(struct ath_hal *ah, int t void ar5416InitChainMasks(struct ath_hal *ah) { - if (AH5416(ah)->ah_rx_chainmask == 0x5 || - AH5416(ah)->ah_tx_chainmask == 0x5) - OS_REG_WRITE(ah, AR_PHY_ANALOG_SWAP, AR_PHY_SWAP_ALT_CHAIN); - /* Setup Chain Masks */ - OS_REG_WRITE(ah, AR_PHY_RX_CHAINMASK, AH5416(ah)->ah_rx_chainmask); - OS_REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, AH5416(ah)->ah_rx_chainmask); + int rx_chainmask = AH5416(ah)->ah_rx_chainmask; + + if (rx_chainmask) + OS_REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, AR_PHY_SWAP_ALT_CHAIN); + + /* + * Workaround for OWL 1.0 calibration failure; enable multi-chain; + * then set true mask after calibration. + */ + if (IS_5416V1(ah) && (rx_chainmask == 0x5 || rx_chainmask == 0x3)) { + OS_REG_WRITE(ah, AR_PHY_RX_CHAINMASK, 0x7); + OS_REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, 0x7); + } else { + OS_REG_WRITE(ah, AR_PHY_RX_CHAINMASK, AH5416(ah)->ah_rx_chainmask); + OS_REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, AH5416(ah)->ah_rx_chainmask); + } OS_REG_WRITE(ah, AR_SELFGEN_MASK, AH5416(ah)->ah_tx_chainmask); + if (AH5416(ah)->ah_tx_chainmask == 0x5) + OS_REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, AR_PHY_SWAP_ALT_CHAIN); + if (AR_SREV_HOWL(ah)) { OS_REG_WRITE(ah, AR_PHY_ANALOG_SWAP, OS_REG_READ(ah, AR_PHY_ANALOG_SWAP) | 0x00000001); } } +/* + * Work-around for Owl 1.0 calibration failure. + * + * ar5416InitChainMasks sets the RX chainmask to 0x7 if it's Owl 1.0 + * due to init calibration failures. ar5416RestoreChainMask restores + * these registers to the correct setting. + */ void ar5416RestoreChainMask(struct ath_hal *ah) { int rx_chainmask = AH5416(ah)->ah_rx_chainmask; - if ((rx_chainmask == 0x5) || (rx_chainmask == 0x3)) { + if (IS_5416V1(ah) && (rx_chainmask == 0x5 || rx_chainmask == 0x3)) { OS_REG_WRITE(ah, AR_PHY_RX_CHAINMASK, rx_chainmask); OS_REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, rx_chainmask); } From owner-svn-src-all@FreeBSD.ORG Sun May 8 05:25:43 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35DDC106566C; Sun, 8 May 2011 05:25:43 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B20B8FC12; Sun, 8 May 2011 05:25:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p485PgFE030654; Sun, 8 May 2011 05:25:42 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p485PgSL030651; Sun, 8 May 2011 05:25:42 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105080525.p485PgSL030651@svn.freebsd.org> From: Adrian Chadd Date: Sun, 8 May 2011 05:25:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221617 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 05:25:43 -0000 Author: adrian Date: Sun May 8 05:25:42 2011 New Revision: 221617 URL: http://svn.freebsd.org/changeset/base/221617 Log: * Add in a comment about ar5416InitUserSettings() potentially modifying AR_DIAG_SW. There's a hardware workaround which sets disabling some errors early at startup and clears said bits before the PCU begins receiving - it does this to avoid RX descriptor status errors. It's possible these bits aren't being completely properly twiddled in all instances; but in particular if the diag_reg HAL variable is set it won't be setting these bits correctly. I'll review this at some point. * Disable multicast search on mac address and key id - the driver doesn't use it at the moment and thus adhoc may be broken for merlin and later. * Change this to be for Merlin 1.0 (which from what I understand wasn't ever publicly released) to be more correct. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sun May 8 03:24:17 2011 (r221616) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sun May 8 05:25:42 2011 (r221617) @@ -286,6 +286,7 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO ar5416InitIMR(ah, opmode); ar5212SetCoverageClass(ah, AH_PRIVATE(ah)->ah_coverageClass, 1); ar5416InitQoS(ah); + /* This may override the AR_DIAG_SW register */ ar5416InitUserSettings(ah); /* @@ -2508,8 +2509,9 @@ ar5416OverrideIni(struct ath_hal *ah, co */ OS_REG_SET_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); - if (AR_SREV_MERLIN_20_OR_LATER(ah)) { + if (AR_SREV_MERLIN_10_OR_LATER(ah)) { val = OS_REG_READ(ah, AR_PCU_MISC_MODE2); + val &= (~AR_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE); if (!AR_SREV_9271(ah)) val &= ~AR_PCU_MISC_MODE2_HWWAR1; Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Sun May 8 03:24:17 2011 (r221616) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Sun May 8 05:25:42 2011 (r221617) @@ -535,6 +535,12 @@ #define AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE 0x00000002 #define AR_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT 0x00000004 +/* + * This bit enables the Multicast search based on both MAC Address and Key ID. + * If bit is 0, then Multicast search is based on MAC address only. + * For Merlin and above only. + */ +#define AR_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE 0x00000040 #define AR_PCU_MISC_MODE2_HWWAR1 0x00100000 #define AR_PCU_MISC_MODE2_HWWAR2 0x02000000 From owner-svn-src-all@FreeBSD.ORG Sun May 8 05:45:07 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68EEA106564A; Sun, 8 May 2011 05:45:06 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DBC8B8FC0C; Sun, 8 May 2011 05:45:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p485j6oA031249; Sun, 8 May 2011 05:45:06 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p485j6E1031247; Sun, 8 May 2011 05:45:06 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105080545.p485j6E1031247@svn.freebsd.org> From: Adrian Chadd Date: Sun, 8 May 2011 05:45:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221618 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 05:45:07 -0000 Author: adrian Date: Sun May 8 05:45:06 2011 New Revision: 221618 URL: http://svn.freebsd.org/changeset/base/221618 Log: Properly indent the WAR code i pasted in from ath9k a few months ago. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sun May 8 05:25:42 2011 (r221617) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sun May 8 05:45:06 2011 (r221618) @@ -2509,18 +2509,17 @@ ar5416OverrideIni(struct ath_hal *ah, co */ OS_REG_SET_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); - if (AR_SREV_MERLIN_10_OR_LATER(ah)) { - val = OS_REG_READ(ah, AR_PCU_MISC_MODE2); + if (AR_SREV_MERLIN_10_OR_LATER(ah)) { + val = OS_REG_READ(ah, AR_PCU_MISC_MODE2); val &= (~AR_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE); + if (!AR_SREV_9271(ah)) + val &= ~AR_PCU_MISC_MODE2_HWWAR1; - if (!AR_SREV_9271(ah)) - val &= ~AR_PCU_MISC_MODE2_HWWAR1; + if (AR_SREV_9287_11_OR_LATER(ah)) + val = val & (~AR_PCU_MISC_MODE2_HWWAR2); - if (AR_SREV_9287_11_OR_LATER(ah)) - val = val & (~AR_PCU_MISC_MODE2_HWWAR2); - - OS_REG_WRITE(ah, AR_PCU_MISC_MODE2, val); - } + OS_REG_WRITE(ah, AR_PCU_MISC_MODE2, val); + } /* * Disable RIFS search on some chips to avoid baseband From owner-svn-src-all@FreeBSD.ORG Sun May 8 06:25:50 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A69371065670; Sun, 8 May 2011 06:25:50 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 981F28FC12; Sun, 8 May 2011 06:25:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p486Pobf032458; Sun, 8 May 2011 06:25:50 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p486PoUE032456; Sun, 8 May 2011 06:25:50 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201105080625.p486PoUE032456@svn.freebsd.org> From: Navdeep Parhar Date: Sun, 8 May 2011 06:25:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221619 - stable/8/sys/dev/cxgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 06:25:50 -0000 Author: np Date: Sun May 8 06:25:50 2011 New Revision: 221619 URL: http://svn.freebsd.org/changeset/base/221619 Log: MFC r221516: Bump up the number of egress queues that the driver is allowed to use. Modified: stable/8/sys/dev/cxgbe/t4_main.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_main.c Sun May 8 05:45:06 2011 (r221618) +++ stable/8/sys/dev/cxgbe/t4_main.c Sun May 8 06:25:50 2011 (r221619) @@ -388,7 +388,7 @@ t4_attach(device_t dev) /* These are total (sum of all ports) limits for a bus driver */ rc = -t4_cfg_pfvf(sc, sc->mbox, sc->pf, 0, - 64, /* max # of egress queues */ + 128, /* max # of egress queues */ 64, /* max # of egress Ethernet or control queues */ 64, /* max # of ingress queues with fl/interrupt */ 0, /* max # of ingress queues without interrupt */ From owner-svn-src-all@FreeBSD.ORG Sun May 8 07:21:09 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DA7C1065670; Sun, 8 May 2011 07:21:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75A9C8FC08; Sun, 8 May 2011 07:21:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p487L9oC034117; Sun, 8 May 2011 07:21:09 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p487L9LG034115; Sun, 8 May 2011 07:21:09 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105080721.p487L9LG034115@svn.freebsd.org> From: Adrian Chadd Date: Sun, 8 May 2011 07:21:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221620 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 07:21:09 -0000 Author: adrian Date: Sun May 8 07:21:09 2011 New Revision: 221620 URL: http://svn.freebsd.org/changeset/base/221620 Log: Fiddle with the PLL initialisation order to match ath9k/Atheros HAL. This seems to make the AR9160 behave better during heavy scanning, where before it'd hang and require a hard reset to recover. Obtained From: Linux ath9k, Atheros Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sun May 8 06:25:50 2011 (r221619) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sun May 8 07:21:09 2011 (r221620) @@ -521,7 +521,6 @@ ar5416InitBB(struct ath_hal *ah, const s /* Turn on PLL on 5416 */ HALDEBUG(ah, HAL_DEBUG_RESET, "%s %s channel\n", __func__, IEEE80211_IS_CHAN_5GHZ(chan) ? "5GHz" : "2GHz"); - AH5416(ah)->ah_initPLL(ah, chan); /* Activate the PHY (includes baseband activate and synthesizer on) */ OS_REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); @@ -674,6 +673,10 @@ ar5416ChipReset(struct ath_hal *ah, cons if (!ar5416SetPowerMode(ah, HAL_PM_AWAKE, AH_TRUE)) return AH_FALSE; +#ifdef notyet + ahp->ah_chipFullSleep = AH_FALSE; +#endif + AH5416(ah)->ah_initPLL(ah, chan); /* @@ -682,8 +685,7 @@ ar5416ChipReset(struct ath_hal *ah, cons * with an active radio can result in corrupted shifts to the * radio device. */ - if (chan != AH_NULL) - ar5416SetRfMode(ah, chan); + ar5416SetRfMode(ah, chan); return AH_TRUE; } @@ -1103,7 +1105,11 @@ ar5416Disable(struct ath_hal *ah) { if (!ar5212SetPowerMode(ah, HAL_PM_AWAKE, AH_TRUE)) return AH_FALSE; - return ar5416SetResetReg(ah, HAL_RESET_COLD); + if (! ar5416SetResetReg(ah, HAL_RESET_COLD)) + return AH_FALSE; + + AH5416(ah)->ah_initPLL(ah, AH_NULL); + return AH_TRUE; } /* @@ -1115,7 +1121,11 @@ ar5416Disable(struct ath_hal *ah) HAL_BOOL ar5416PhyDisable(struct ath_hal *ah) { - return ar5416SetResetReg(ah, HAL_RESET_WARM); + if (! ar5416SetResetReg(ah, HAL_RESET_WARM)) + return AH_FALSE; + + AH5416(ah)->ah_initPLL(ah, AH_NULL); + return AH_TRUE; } /* @@ -1278,8 +1288,6 @@ ar5416SetReset(struct ath_hal *ah, int t } } - AH5416(ah)->ah_initPLL(ah, AH_NULL); - return AH_TRUE; } From owner-svn-src-all@FreeBSD.ORG Sun May 8 08:17:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 621FA106566B; Sun, 8 May 2011 08:17:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 537458FC0A; Sun, 8 May 2011 08:17:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p488HHLD035909; Sun, 8 May 2011 08:17:17 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p488HHp0035906; Sun, 8 May 2011 08:17:17 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201105080817.p488HHp0035906@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 8 May 2011 08:17:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221621 - stable/8/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 08:17:17 -0000 Author: hselasky Date: Sun May 8 08:17:16 2011 New Revision: 221621 URL: http://svn.freebsd.org/changeset/base/221621 Log: MFC r214221, r216072 and r214809. Make configuration of USB stack more flexible. Modified: stable/8/sys/dev/usb/usb_device.c stable/8/sys/dev/usb/usb_freebsd.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/usb_device.c ============================================================================== --- stable/8/sys/dev/usb/usb_device.c Sun May 8 07:21:09 2011 (r221620) +++ stable/8/sys/dev/usb/usb_device.c Sun May 8 08:17:16 2011 (r221621) @@ -97,8 +97,10 @@ static void usb_suspend_resume_sub(struc static void usbd_clear_stall_proc(struct usb_proc_msg *_pm); static usb_error_t usb_config_parse(struct usb_device *, uint8_t, uint8_t); static void usbd_set_device_strings(struct usb_device *); -#if USB_HAVE_UGEN +#if USB_HAVE_DEVCTL static void usb_notify_addq(const char *type, struct usb_device *); +#endif +#if USB_HAVE_UGEN static void usb_fifo_free_wrap(struct usb_device *, uint8_t, uint8_t); static struct cdev *usb_make_dev(struct usb_device *, int, int); static void usb_cdev_create(struct usb_device *); @@ -1865,7 +1867,9 @@ config_done: printf("%s: <%s> at %s\n", udev->ugen_name, usb_get_manufacturer(udev), device_get_nameunit(udev->bus->bdev)); +#endif +#if USB_HAVE_DEVCTL usb_notify_addq("ATTACH", udev); #endif done: @@ -2011,9 +2015,11 @@ usb_free_device(struct usb_device *udev, bus = udev->bus; usb_set_device_state(udev, USB_STATE_DETACHED); -#if USB_HAVE_UGEN +#if USB_HAVE_DEVCTL usb_notify_addq("DETACH", udev); +#endif +#if USB_HAVE_UGEN printf("%s: <%s> at %s (disconnected)\n", udev->ugen_name, usb_get_manufacturer(udev), device_get_nameunit(bus->bdev)); @@ -2380,7 +2386,7 @@ usbd_get_device_index(struct usb_device return (udev->device_index); } -#if USB_HAVE_UGEN +#if USB_HAVE_DEVCTL /*------------------------------------------------------------------------* * usb_notify_addq * @@ -2416,7 +2422,9 @@ usb_notify_addq_compat(const char *type, /* String it all together. */ snprintf(data, buf_size, "%s" +#if USB_HAVE_UGEN "%s " +#endif "at port=%u " "vendor=0x%04x " "product=0x%04x " @@ -2424,20 +2432,27 @@ usb_notify_addq_compat(const char *type, "devsubclass=0x%02x " "sernum=\"%s\" " "release=0x%04x " - "on " - "%s\n", +#if USB_HAVE_UGEN + "on %s\n" +#endif + "", ntype, +#if USB_HAVE_UGEN udev->ugen_name, +#endif udev->port_no, UGETW(udev->ddesc.idVendor), UGETW(udev->ddesc.idProduct), udev->ddesc.bDeviceClass, udev->ddesc.bDeviceSubClass, usb_get_serial(udev), - UGETW(udev->ddesc.bcdDevice), - udev->parent_hub != NULL ? + UGETW(udev->ddesc.bcdDevice) +#if USB_HAVE_UGEN + , udev->parent_hub != NULL ? udev->parent_hub->ugen_name : - device_get_nameunit(device_get_parent(udev->bus->bdev))); + device_get_nameunit(device_get_parent(udev->bus->bdev)) +#endif + ); devctl_queue_data(data); } @@ -2457,7 +2472,10 @@ usb_notify_addq(const char *type, struct /* announce the device */ sb = sbuf_new_auto(); sbuf_printf(sb, +#if USB_HAVE_UGEN + "ugen=%s " "cdev=%s " +#endif "vendor=0x%04x " "product=0x%04x " "devclass=0x%02x " @@ -2466,8 +2484,14 @@ usb_notify_addq(const char *type, struct "release=0x%04x " "mode=%s " "port=%u " - "parent=%s", +#if USB_HAVE_UGEN + "parent=%s" +#endif + "", +#if USB_HAVE_UGEN + udev->ugen_name, udev->ugen_name, +#endif UGETW(udev->ddesc.idVendor), UGETW(udev->ddesc.idProduct), udev->ddesc.bDeviceClass, @@ -2475,10 +2499,13 @@ usb_notify_addq(const char *type, struct usb_get_serial(udev), UGETW(udev->ddesc.bcdDevice), (udev->flags.usb_mode == USB_MODE_HOST) ? "host" : "device", - udev->port_no, - udev->parent_hub != NULL ? - udev->parent_hub->ugen_name : - device_get_nameunit(device_get_parent(udev->bus->bdev))); + udev->port_no +#if USB_HAVE_UGEN + , udev->parent_hub != NULL ? + udev->parent_hub->ugen_name : + device_get_nameunit(device_get_parent(udev->bus->bdev)) +#endif + ); sbuf_finish(sb); devctl_notify("USB", "DEVICE", type, sbuf_data(sb)); sbuf_delete(sb); @@ -2493,7 +2520,10 @@ usb_notify_addq(const char *type, struct sb = sbuf_new_auto(); sbuf_printf(sb, +#if USB_HAVE_UGEN + "ugen=%s " "cdev=%s " +#endif "vendor=0x%04x " "product=0x%04x " "devclass=0x%02x " @@ -2506,7 +2536,10 @@ usb_notify_addq(const char *type, struct "intclass=0x%02x " "intsubclass=0x%02x " "intprotocol=0x%02x", +#if USB_HAVE_UGEN udev->ugen_name, + udev->ugen_name, +#endif UGETW(udev->ddesc.idVendor), UGETW(udev->ddesc.idProduct), udev->ddesc.bDeviceClass, @@ -2524,7 +2557,9 @@ usb_notify_addq(const char *type, struct sbuf_delete(sb); } } +#endif +#if USB_HAVE_UGEN /*------------------------------------------------------------------------* * usb_fifo_free_wrap * Modified: stable/8/sys/dev/usb/usb_freebsd.h ============================================================================== --- stable/8/sys/dev/usb/usb_freebsd.h Sun May 8 07:21:09 2011 (r221620) +++ stable/8/sys/dev/usb/usb_freebsd.h Sun May 8 08:17:16 2011 (r221621) @@ -33,6 +33,7 @@ /* Default USB configuration */ #define USB_HAVE_UGEN 1 +#define USB_HAVE_DEVCTL 1 #define USB_HAVE_BUSDMA 1 #define USB_HAVE_COMPAT_LINUX 1 #define USB_HAVE_USER_IO 1 From owner-svn-src-all@FreeBSD.ORG Sun May 8 08:18:31 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47815106566B; Sun, 8 May 2011 08:18:31 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A1F38FC14; Sun, 8 May 2011 08:18:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p488IV7A035987; Sun, 8 May 2011 08:18:31 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p488IVAB035985; Sun, 8 May 2011 08:18:31 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105080818.p488IVAB035985@svn.freebsd.org> From: Adrian Chadd Date: Sun, 8 May 2011 08:18:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221622 - head/sys/dev/ath/ath_hal X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 08:18:31 -0000 Author: adrian Date: Sun May 8 08:18:30 2011 New Revision: 221622 URL: http://svn.freebsd.org/changeset/base/221622 Log: These EEPROM bits actually defined whether HT/20 and HT/40 support for the given channel is available. It isn't used yet; ar5416GetWirelessModes() needs to be taught about this rather than assuming HT20/HT40 is available. Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v14.h Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v14.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_eeprom_v14.h Sun May 8 08:17:16 2011 (r221621) +++ head/sys/dev/ath/ath_hal/ah_eeprom_v14.h Sun May 8 08:18:30 2011 (r221622) @@ -95,10 +95,10 @@ #define AR5416_OPFLAGS_11A 0x01 #define AR5416_OPFLAGS_11G 0x02 -#define AR5416_OPFLAGS_5G_HT40 0x04 -#define AR5416_OPFLAGS_2G_HT40 0x08 -#define AR5416_OPFLAGS_5G_HT20 0x10 -#define AR5416_OPFLAGS_2G_HT20 0x20 +#define AR5416_OPFLAGS_N_5G_HT40 0x04 /* If set, disable 5G HT40 */ +#define AR5416_OPFLAGS_N_2G_HT40 0x08 +#define AR5416_OPFLAGS_N_5G_HT20 0x10 +#define AR5416_OPFLAGS_N_2G_HT20 0x20 /* RF silent fields in EEPROM */ #define EEP_RFSILENT_ENABLED 0x0001 /* enabled/disabled */ From owner-svn-src-all@FreeBSD.ORG Sun May 8 08:22:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51FB2106566B; Sun, 8 May 2011 08:22:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A3AD8FC16; Sun, 8 May 2011 08:22:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p488MC8c036154; Sun, 8 May 2011 08:22:12 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p488MCEV036152; Sun, 8 May 2011 08:22:12 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201105080822.p488MCEV036152@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 8 May 2011 08:22:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221623 - head/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 08:22:12 -0000 Author: hselasky Date: Sun May 8 08:22:11 2011 New Revision: 221623 URL: http://svn.freebsd.org/changeset/base/221623 Log: Cleanup usb_notify_addq_compat(). It should not be needed any more. MFC after: 7 days Modified: head/sys/dev/usb/usb_device.c Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Sun May 8 08:18:30 2011 (r221622) +++ head/sys/dev/usb/usb_device.c Sun May 8 08:22:11 2011 (r221623) @@ -2387,77 +2387,6 @@ usbd_get_device_index(struct usb_device } #if USB_HAVE_DEVCTL -/*------------------------------------------------------------------------* - * usb_notify_addq - * - * This function will generate events for dev. - *------------------------------------------------------------------------*/ -#ifndef BURN_BRIDGES -static void -usb_notify_addq_compat(const char *type, struct usb_device *udev) -{ - char *data = NULL; - const char *ntype; - struct malloc_type *mt; - const size_t buf_size = 512; - - /* Convert notify type */ - if (strcmp(type, "ATTACH") == 0) - ntype = "+"; - else if (strcmp(type, "DETACH") == 0) - ntype = "-"; - else - return; - - mtx_lock(&malloc_mtx); - mt = malloc_desc2type("bus"); /* XXX M_BUS */ - mtx_unlock(&malloc_mtx); - if (mt == NULL) - return; - - data = malloc(buf_size, mt, M_NOWAIT); - if (data == NULL) - return; - - /* String it all together. */ - snprintf(data, buf_size, - "%s" -#if USB_HAVE_UGEN - "%s " -#endif - "at port=%u " - "vendor=0x%04x " - "product=0x%04x " - "devclass=0x%02x " - "devsubclass=0x%02x " - "sernum=\"%s\" " - "release=0x%04x " -#if USB_HAVE_UGEN - "on %s\n" -#endif - "", - ntype, -#if USB_HAVE_UGEN - udev->ugen_name, -#endif - udev->port_no, - UGETW(udev->ddesc.idVendor), - UGETW(udev->ddesc.idProduct), - udev->ddesc.bDeviceClass, - udev->ddesc.bDeviceSubClass, - usb_get_serial(udev), - UGETW(udev->ddesc.bcdDevice) -#if USB_HAVE_UGEN - , udev->parent_hub != NULL ? - udev->parent_hub->ugen_name : - device_get_nameunit(device_get_parent(udev->bus->bdev)) -#endif - ); - - devctl_queue_data(data); -} -#endif - static void usb_notify_addq(const char *type, struct usb_device *udev) { @@ -2465,10 +2394,6 @@ usb_notify_addq(const char *type, struct struct sbuf *sb; int i; -#ifndef BURN_BRIDGES - usb_notify_addq_compat(type, udev); -#endif - /* announce the device */ sb = sbuf_new_auto(); sbuf_printf(sb, From owner-svn-src-all@FreeBSD.ORG Sun May 8 09:08:50 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB8DA1065670; Sun, 8 May 2011 09:08:50 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 939BD8FC14; Sun, 8 May 2011 09:08:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4898owY037595; Sun, 8 May 2011 09:08:50 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4898o4S037593; Sun, 8 May 2011 09:08:50 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201105080908.p4898o4S037593@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 8 May 2011 09:08:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221624 - head/sys/geom/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 09:08:50 -0000 Author: pjd Date: Sun May 8 09:08:50 2011 New Revision: 221624 URL: http://svn.freebsd.org/changeset/base/221624 Log: Add magic field to the g_eli_key structure to detect if we are really operating on proper structures. MFC after: 1 week Modified: head/sys/geom/eli/g_eli_key_cache.c Modified: head/sys/geom/eli/g_eli_key_cache.c ============================================================================== --- head/sys/geom/eli/g_eli_key_cache.c Sun May 8 08:22:11 2011 (r221623) +++ head/sys/geom/eli/g_eli_key_cache.c Sun May 8 09:08:50 2011 (r221624) @@ -57,9 +57,13 @@ static uint64_t g_eli_key_cache_misses; SYSCTL_UQUAD(_kern_geom_eli, OID_AUTO, key_cache_misses, CTLFLAG_RW, &g_eli_key_cache_misses, 0, "Key cache misses"); +#define G_ELI_KEY_MAGIC 0xe11341c + struct g_eli_key { /* Key value, must be first in the structure. */ uint8_t gek_key[G_ELI_DATAKEYLEN]; + /* Magic. */ + int gek_magic; /* Key number. */ uint64_t gek_keyno; /* Reference counter. */ @@ -98,6 +102,7 @@ g_eli_key_fill(struct g_eli_softc *sc, s sizeof(hmacdata), key->gek_key, 0); key->gek_keyno = keyno; key->gek_count = 0; + key->gek_magic = G_ELI_KEY_MAGIC; } static struct g_eli_key * @@ -150,6 +155,7 @@ g_eli_key_replace(struct g_eli_softc *sc { mtx_assert(&sc->sc_ekeys_lock, MA_OWNED); + KASSERT(key->gek_magic == G_ELI_KEY_MAGIC, ("Invalid magic.")); RB_REMOVE(g_eli_key_tree, &sc->sc_ekeys_tree, key); TAILQ_REMOVE(&sc->sc_ekeys_queue, key, gek_next); @@ -167,7 +173,7 @@ g_eli_key_remove(struct g_eli_softc *sc, { mtx_assert(&sc->sc_ekeys_lock, MA_OWNED); - + KASSERT(key->gek_magic == G_ELI_KEY_MAGIC, ("Invalid magic.")); KASSERT(key->gek_count == 0, ("gek_count=%d", key->gek_count)); RB_REMOVE(g_eli_key_tree, &sc->sc_ekeys_tree, key); @@ -276,6 +282,8 @@ g_eli_key_hold(struct g_eli_softc *sc, o /* We have all the keys, so avoid some overhead. */ key = RB_FIND(g_eli_key_tree, &sc->sc_ekeys_tree, &keysearch); KASSERT(key != NULL, ("No key %ju found.", (uintmax_t)keyno)); + KASSERT(key->gek_magic == G_ELI_KEY_MAGIC, + ("Invalid key magic.")); return (key->gek_key); } @@ -306,6 +314,8 @@ g_eli_key_hold(struct g_eli_softc *sc, o key->gek_count++; mtx_unlock(&sc->sc_ekeys_lock); + KASSERT(key->gek_magic == G_ELI_KEY_MAGIC, ("Invalid key magic.")); + return (key->gek_key); } @@ -317,6 +327,8 @@ g_eli_key_drop(struct g_eli_softc *sc, u if ((sc->sc_flags & G_ELI_FLAG_SINGLE_KEY) != 0) return; + KASSERT(key->gek_magic == G_ELI_KEY_MAGIC, ("Invalid key magic.")); + if (sc->sc_ekeys_total == sc->sc_ekeys_allocated) return; From owner-svn-src-all@FreeBSD.ORG Sun May 8 09:09:36 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C27941065679; Sun, 8 May 2011 09:09:36 +0000 (UTC) (envelope-from jhellenthal@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 42A2A8FC1B; Sun, 8 May 2011 09:09:36 +0000 (UTC) Received: by iwn33 with SMTP id 33so5153190iwn.13 for ; Sun, 08 May 2011 02:09:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:date:from:to:cc:subject:message-id :references:mime-version:content-type:content-disposition :in-reply-to:x-openpgp-key-id:x-openpgp-key-fingerprint :x-openpgp-key-url; bh=vNr/PBhJqyrszdyvANkZJK7wiOr6raAxoH6HGroaXdk=; b=qUfLPZI+QY0M8UXlC9MXrrQfnVF5rXkVFvbub89te220yjpWzE8al5m6KN49nKhV4N UTL5SQ6DJTq2Us5fgBZomxC8g1q2Z/6ylUXAjZXk1os7lRVtSGyoURn9zCxB1lFhaVEg rQu5nJbP7LVX6LItaEEdbJ9HxJW2E35ufSEgs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:x-openpgp-key-id :x-openpgp-key-fingerprint:x-openpgp-key-url; b=WKsm1laUmgqaUNhf1nWYFV1YCxx4v6UfwrXBICz1glkjYg9/EQhKXkfjrHNzzqtG2v YR/pctVKXpWsP4EoLnjgVjphlD5dRz4N1Aqv2t4rTk90dA2WZk5gT0Q1pYLxfwjiAdEf TuX22cEunYNgBraw4dDzp7+PPwQjGFfKjDHHE= Received: by 10.42.130.130 with SMTP id v2mr5021572ics.233.1304844343449; Sun, 08 May 2011 01:45:43 -0700 (PDT) Received: from DataIX.net (adsl-99-190-84-116.dsl.klmzmi.sbcglobal.net [99.190.84.116]) by mx.google.com with ESMTPS id o3sm2112317ibd.10.2011.05.08.01.45.41 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 08 May 2011 01:45:42 -0700 (PDT) Sender: "J. Hellenthal" Received: from DataIX.net (localhost [127.0.0.1]) by DataIX.net (8.14.4/8.14.4) with ESMTP id p488jcgQ094710 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 8 May 2011 04:45:39 -0400 (EDT) (envelope-from jhell@DataIX.net) Received: (from jhell@localhost) by DataIX.net (8.14.4/8.14.4/Submit) id p488jblN094709; Sun, 8 May 2011 04:45:37 -0400 (EDT) (envelope-from jhell@DataIX.net) Date: Sun, 8 May 2011 04:45:37 -0400 From: Jason Hellenthal To: Hans Petter Selasky Message-ID: <20110508084537.GA70268@DataIX.net> References: <201105080817.p488HHp0035906@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wac7ysb48OaltWcw" Content-Disposition: inline In-Reply-To: <201105080817.p488HHp0035906@svn.freebsd.org> X-OpenPGP-Key-Id: 0x89D8547E X-OpenPGP-Key-Fingerprint: 85EF E26B 07BB 3777 76BE B12A 9057 8789 89D8 547E X-OpenPGP-Key-URL: http://bit.ly/0x89D8547E Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r221621 - stable/8/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 09:09:37 -0000 --wac7ysb48OaltWcw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hans, Was this intended. ? "udev->ugen_name," On Sun, May 08, 2011 at 08:17:17AM +0000, Hans Petter Selasky wrote:=20 > Author: hselasky > Date: Sun May 8 08:17:16 2011 > New Revision: 221621 > URL: http://svn.freebsd.org/changeset/base/221621 >=20 [...] > +#if USB_HAVE_UGEN > + "parent=3D%s" > +#endif > + "", > +#if USB_HAVE_UGEN > + udev->ugen_name, > udev->ugen_name, > +#endif [...] > +#if USB_HAVE_UGEN > udev->ugen_name, > + udev->ugen_name, > +#endif --=20 Regards, (jhell) Jason Hellenthal --wac7ysb48OaltWcw Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) Comment: http://bit.ly/0x89D8547E iQEcBAEBAgAGBQJNxlgxAAoJEJBXh4mJ2FR+ySoH/2dYPFMxfwpTdKJSw1DxVOBA O5pKONp9SHxGNX023/G4r3Zktuegd4URWtUb2G2hcDDPqwaa9ZcQ9G8oYm2vITUS YQj6aXfWNtDsKLHdr5CqKcK/R5u89pIySWi/IxxZ+jzd6DDO3f94LNB9vV5l5cTu 5fW9nvfPmW/gmnqdmGUHiCb4CENVKZokhRH1LYzxtdtLroBJjCkEnN3q4hdl7k+q rF66DkxzR8hy3feyZl47D3lTLMzO5M9PrAR8gId0gb1ctejMczejLDsu7EB2nSe6 Bqg+BdOOalOEJ5g1fLQiEaTQtHdhciDuPeugPdFtgl9+5Rfl+x6yJIyt7Bhf/pU= =OCa4 -----END PGP SIGNATURE----- --wac7ysb48OaltWcw-- From owner-svn-src-all@FreeBSD.ORG Sun May 8 09:09:49 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFD54106566B; Sun, 8 May 2011 09:09:49 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D2A5A8FC08; Sun, 8 May 2011 09:09:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4899nd3037662; Sun, 8 May 2011 09:09:49 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4899nUY037660; Sun, 8 May 2011 09:09:49 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201105080909.p4899nUY037660@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 8 May 2011 09:09:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221625 - head/sys/geom/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 09:09:50 -0000 Author: pjd Date: Sun May 8 09:09:49 2011 New Revision: 221625 URL: http://svn.freebsd.org/changeset/base/221625 Log: Drop proper key. MFC after: 1 week Modified: head/sys/geom/eli/g_eli_integrity.c Modified: head/sys/geom/eli/g_eli_integrity.c ============================================================================== --- head/sys/geom/eli/g_eli_integrity.c Sun May 8 09:08:50 2011 (r221624) +++ head/sys/geom/eli/g_eli_integrity.c Sun May 8 09:09:49 2011 (r221625) @@ -149,7 +149,7 @@ g_eli_auth_read_done(struct cryptop *crp bp->bio_error = crp->crp_etype; } sc = bp->bio_to->geom->softc; - g_eli_key_drop(sc, crp->crp_desc->crd_key); + g_eli_key_drop(sc, crp->crp_desc->crd_next->crd_key); /* * Do we have all sectors already? */ From owner-svn-src-all@FreeBSD.ORG Sun May 8 09:11:05 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5325106566C; Sun, 8 May 2011 09:11:04 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B7F498FC14; Sun, 8 May 2011 09:11:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p489B4pR037760; Sun, 8 May 2011 09:11:04 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p489B4jd037758; Sun, 8 May 2011 09:11:04 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201105080911.p489B4jd037758@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 8 May 2011 09:11:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221626 - head/sys/geom/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 09:11:05 -0000 Author: pjd Date: Sun May 8 09:11:04 2011 New Revision: 221626 URL: http://svn.freebsd.org/changeset/base/221626 Log: Remove prototype for a function that no longer exist. MFC after: 1 week Modified: head/sys/geom/eli/g_eli.h Modified: head/sys/geom/eli/g_eli.h ============================================================================== --- head/sys/geom/eli/g_eli.h Sun May 8 09:09:49 2011 (r221625) +++ head/sys/geom/eli/g_eli.h Sun May 8 09:11:04 2011 (r221626) @@ -509,8 +509,6 @@ void g_eli_config(struct gctl_req *req, void g_eli_read_done(struct bio *bp); void g_eli_write_done(struct bio *bp); int g_eli_crypto_rerun(struct cryptop *crp); -uint8_t *g_eli_crypto_key(struct g_eli_softc *sc, off_t offset, - size_t blocksize); void g_eli_crypto_ivgen(struct g_eli_softc *sc, off_t offset, u_char *iv, size_t size); From owner-svn-src-all@FreeBSD.ORG Sun May 8 09:11:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92184106566B; Sun, 8 May 2011 09:11:59 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8382C8FC08; Sun, 8 May 2011 09:11:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p489Bx5U037827; Sun, 8 May 2011 09:11:59 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p489BxTW037814; Sun, 8 May 2011 09:11:59 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201105080911.p489BxTW037814@svn.freebsd.org> From: Michael Tuexen Date: Sun, 8 May 2011 09:11:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221627 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 09:11:59 -0000 Author: tuexen Date: Sun May 8 09:11:59 2011 New Revision: 221627 URL: http://svn.freebsd.org/changeset/base/221627 Log: Fix a locking issue showing up on Mac OS X when subscribing to authentication events. DTLS/SCTP renegotiations trigger the bug. MFC after: 2 weeks. Modified: head/sys/netinet/sctp_auth.c head/sys/netinet/sctp_auth.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_input.h head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_timer.c head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctp_var.h head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_auth.c ============================================================================== --- head/sys/netinet/sctp_auth.c Sun May 8 09:11:04 2011 (r221626) +++ head/sys/netinet/sctp_auth.c Sun May 8 09:11:59 2011 (r221627) @@ -598,7 +598,11 @@ sctp_auth_key_acquire(struct sctp_tcb *s } void -sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id) +sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id, int so_locked +#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) + SCTP_UNUSED +#endif +) { sctp_sharedkey_t *skey; @@ -616,7 +620,7 @@ sctp_auth_key_release(struct sctp_tcb *s if ((skey->refcount <= 1) && (skey->deactivated)) { /* notify ULP that key is no longer used */ sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb, - key_id, 0, SCTP_SO_LOCKED); + key_id, 0, so_locked); SCTPDBG(SCTP_DEBUG_AUTH2, "%s: stcb %p key %u no longer used, %d\n", __FUNCTION__, stcb, key_id, skey->refcount); Modified: head/sys/netinet/sctp_auth.h ============================================================================== --- head/sys/netinet/sctp_auth.h Sun May 8 09:11:04 2011 (r221626) +++ head/sys/netinet/sctp_auth.h Sun May 8 09:11:59 2011 (r221627) @@ -156,7 +156,9 @@ sctp_copy_skeylist(const struct sctp_key /* ref counts on shared keys, by key id */ extern void sctp_auth_key_acquire(struct sctp_tcb *stcb, uint16_t keyid); -extern void sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t keyid); +extern void +sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t keyid, + int so_locked); /* hmac list handling */ Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sun May 8 09:11:04 2011 (r221626) +++ head/sys/netinet/sctp_indata.c Sun May 8 09:11:59 2011 (r221627) @@ -375,7 +375,7 @@ abandon: chk->data = NULL; } /* Now free the address and data */ - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); /* sa_ignore FREED_MEMORY */ } return; @@ -479,7 +479,7 @@ abandon: sctp_ucount_decr(asoc->cnt_on_reasm_queue); /* free up the chk */ chk->data = NULL; - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); if (asoc->fragmented_delivery_inprogress == 0) { /* @@ -1011,7 +1011,7 @@ sctp_queue_data_for_reasm(struct sctp_tc sctp_m_freem(chk->data); chk->data = NULL; } - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); return; } else { last_flags = at->rec.data.rcv_flags; @@ -2416,7 +2416,7 @@ sctp_sack_check(struct sctp_tcb *stcb, i stcb->sctp_ep, stcb, NULL, SCTP_FROM_SCTP_INDATA + SCTP_LOC_18); } sctp_send_shutdown(stcb, stcb->asoc.primary_destination); - sctp_send_sack(stcb); + sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); } else { int is_a_gap; @@ -2466,7 +2466,7 @@ sctp_sack_check(struct sctp_tcb *stcb, i * there are gaps or duplicates. */ (void)SCTP_OS_TIMER_STOP(&stcb->asoc.dack_timer.timer); - sctp_send_sack(stcb); + sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); } } else { if (!SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) { @@ -3993,7 +3993,7 @@ sctp_express_handle_sack(struct sctp_tcb SCTP_LOG_FREE_SENT); } asoc->sent_queue_cnt--; - sctp_free_a_chunk(stcb, tp1); + sctp_free_a_chunk(stcb, tp1, SCTP_SO_NOT_LOCKED); } else { break; } @@ -4709,7 +4709,7 @@ sctp_handle_sack(struct mbuf *m, int off 0, SCTP_LOG_FREE_SENT); } - sctp_free_a_chunk(stcb, tp1); + sctp_free_a_chunk(stcb, tp1, SCTP_SO_NOT_LOCKED); wake_him++; } if (TAILQ_EMPTY(&asoc->sent_queue) && (asoc->total_flight > 0)) { @@ -5260,7 +5260,7 @@ sctp_flush_reassm_for_str_seq(struct sct sctp_m_freem(chk->data); chk->data = NULL; } - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); } else if (SCTP_SSN_GT(chk->rec.data.stream_seq, seq)) { /* * If the stream_seq is > than the purging one, we @@ -5431,7 +5431,7 @@ sctp_handle_forward_tsn(struct sctp_tcb sctp_m_freem(chk->data); chk->data = NULL; } - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); } else { /* * Ok we have gone beyond the end of the fwd-tsn's Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sun May 8 09:11:04 2011 (r221626) +++ head/sys/netinet/sctp_input.c Sun May 8 09:11:59 2011 (r221627) @@ -193,7 +193,11 @@ outnow: */ int -sctp_is_there_unsent_data(struct sctp_tcb *stcb) +sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked +#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) + SCTP_UNUSED +#endif +) { int unsent_data = 0; unsigned int i; @@ -242,7 +246,7 @@ sctp_is_there_unsent_data(struct sctp_tc sctp_m_freem(sp->data); sp->data = NULL; } - sctp_free_a_strmoq(stcb, sp); + sctp_free_a_strmoq(stcb, sp, so_locked); } else { unsent_data++; break; @@ -301,7 +305,7 @@ sctp_process_init(struct sctp_init_chunk chk->data = NULL; } } - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); /* sa_ignore FREED_MEMORY */ } } @@ -323,7 +327,7 @@ sctp_process_init(struct sctp_init_chunk sp->net = NULL; } /* Free the chunk */ - sctp_free_a_strmoq(stcb, sp); + sctp_free_a_strmoq(stcb, sp, SCTP_SO_NOT_LOCKED); /* sa_ignore FREED_MEMORY */ } } @@ -902,7 +906,7 @@ sctp_handle_shutdown(struct sctp_shutdow sctp_timer_stop(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_INPUT + SCTP_LOC_8); } /* Now is there unsent data on a stream somewhere? */ - some_on_streamwheel = sctp_is_there_unsent_data(stcb); + some_on_streamwheel = sctp_is_there_unsent_data(stcb, SCTP_SO_NOT_LOCKED); if (!TAILQ_EMPTY(&asoc->send_queue) || !TAILQ_EMPTY(&asoc->sent_queue) || @@ -3127,7 +3131,7 @@ sctp_handle_ecn_cwr(struct sctp_cwr_chun chk->data = NULL; } stcb->asoc.ctrl_queue_cnt--; - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); if (override == 0) { break; } @@ -3367,7 +3371,7 @@ process_chunk_drop(struct sctp_tcb *stcb case SCTP_SELECTIVE_ACK: case SCTP_NR_SELECTIVE_ACK: /* resend the sack */ - sctp_send_sack(stcb); + sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); break; case SCTP_HEARTBEAT_REQUEST: /* resend a demand HB */ @@ -3376,7 +3380,7 @@ process_chunk_drop(struct sctp_tcb *stcb * Only retransmit if we KNOW we wont destroy the * tcb */ - (void)sctp_send_hb(stcb, 1, net); + (void)sctp_send_hb(stcb, 1, net, SCTP_SO_NOT_LOCKED); } break; case SCTP_SHUTDOWN: @@ -3547,7 +3551,7 @@ sctp_clean_up_stream_reset(struct sctp_t chk->data = NULL; } asoc->ctrl_queue_cnt--; - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); /* sa_ignore NO_NULL_CHK */ stcb->asoc.str_reset = NULL; } @@ -3987,7 +3991,7 @@ strres_nochunk: sctp_m_freem(chk->data); chk->data = NULL; } - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); return (ret_code); } SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD); Modified: head/sys/netinet/sctp_input.h ============================================================================== --- head/sys/netinet/sctp_input.h Sun May 8 09:11:04 2011 (r221626) +++ head/sys/netinet/sctp_input.h Sun May 8 09:11:59 2011 (r221627) @@ -53,7 +53,7 @@ sctp_reset_in_stream(struct sctp_tcb *st uint16_t * list); -int sctp_is_there_unsent_data(struct sctp_tcb *stcb); +int sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked); #endif #endif Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sun May 8 09:11:04 2011 (r221626) +++ head/sys/netinet/sctp_output.c Sun May 8 09:11:59 2011 (r221627) @@ -6178,7 +6178,7 @@ sctp_sendall_iterator(struct sctp_inpcb /* shutdown this assoc */ int cnt; - cnt = sctp_is_there_unsent_data(stcb); + cnt = sctp_is_there_unsent_data(stcb, SCTP_SO_NOT_LOCKED); if (TAILQ_EMPTY(&asoc->send_queue) && TAILQ_EMPTY(&asoc->sent_queue) && @@ -6425,7 +6425,7 @@ sctp_toss_old_cookies(struct sctp_tcb *s chk->data = NULL; } asoc->ctrl_queue_cnt--; - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); } } } @@ -6454,7 +6454,7 @@ sctp_toss_old_asconf(struct sctp_tcb *st chk->data = NULL; } asoc->ctrl_queue_cnt--; - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); } } } @@ -6553,7 +6553,11 @@ all_done: } static void -sctp_clean_up_ctl(struct sctp_tcb *stcb, struct sctp_association *asoc) +sctp_clean_up_ctl(struct sctp_tcb *stcb, struct sctp_association *asoc, int so_locked +#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) + SCTP_UNUSED +#endif +) { struct sctp_tmit_chunk *chk, *nchk; @@ -6580,7 +6584,7 @@ sctp_clean_up_ctl(struct sctp_tcb *stcb, asoc->ctrl_queue_cnt--; if (chk->rec.chunk_id.id == SCTP_FORWARD_CUM_TSN) asoc->fwd_tsn_cnt--; - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, so_locked); } else if (chk->rec.chunk_id.id == SCTP_STREAM_RESET) { /* special handling, we must look into the param */ if (chk != asoc->str_reset) { @@ -6660,7 +6664,12 @@ sctp_move_to_outqueue(struct sctp_tcb *s int *locked, int *giveup, int eeor_mode, - int *bail) + int *bail, + int so_locked +#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) + SCTP_UNUSED +#endif +) { /* Move from the stream to the send_queue keeping track of the total */ struct sctp_association *asoc; @@ -6731,7 +6740,7 @@ one_more_time: sctp_m_freem(sp->data); sp->data = NULL; } - sctp_free_a_strmoq(stcb, sp); + sctp_free_a_strmoq(stcb, sp, so_locked); /* we can't be locked to it */ *locked = 0; stcb->asoc.locked_on_sending = NULL; @@ -6897,7 +6906,7 @@ dont_do_it: chk->last_mbuf = NULL; if (chk->data == NULL) { sp->some_taken = some_taken; - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, so_locked); *bail = 1; to_move = 0; goto out_of; @@ -7001,7 +7010,7 @@ dont_do_it: atomic_add_int(&sp->length, to_move); chk->data = NULL; *bail = 1; - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, so_locked); to_move = 0; goto out_of; } else { @@ -7018,7 +7027,7 @@ dont_do_it: panic("prepend failes HELP?"); #else SCTP_PRINTF("prepend fails HELP?\n"); - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, so_locked); #endif *bail = 1; to_move = 0; @@ -7140,7 +7149,7 @@ dont_do_it: sctp_m_freem(sp->data); sp->data = NULL; } - sctp_free_a_strmoq(stcb, sp); + sctp_free_a_strmoq(stcb, sp, so_locked); /* we can't be locked to it */ *locked = 0; @@ -7163,7 +7172,11 @@ out_of: static void sctp_fill_outqueue(struct sctp_tcb *stcb, - struct sctp_nets *net, int frag_point, int eeor_mode, int *quit_now) + struct sctp_nets *net, int frag_point, int eeor_mode, int *quit_now, int so_locked +#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) + SCTP_UNUSED +#endif +) { struct sctp_association *asoc; struct sctp_stream_out *strq, *strqn; @@ -7200,7 +7213,7 @@ sctp_fill_outqueue(struct sctp_tcb *stcb giveup = 0; bail = 0; moved_how_much = sctp_move_to_outqueue(stcb, strq, goal_mtu, frag_point, &locked, - &giveup, eeor_mode, &bail); + &giveup, eeor_mode, &bail, so_locked); if (moved_how_much) stcb->asoc.ss_functions.sctp_ss_scheduled(stcb, net, asoc, strq, moved_how_much); @@ -7440,7 +7453,7 @@ nothing_to_send: if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) { sctp_log_cwnd(stcb, net, 4, SCTP_CWND_LOG_FILL_OUTQ_CALLED); } - sctp_fill_outqueue(stcb, net, frag_point, eeor_mode, &quit_now); + sctp_fill_outqueue(stcb, net, frag_point, eeor_mode, &quit_now, so_locked); if (quit_now) { /* memory alloc failure */ no_data_chunks = 1; @@ -8378,7 +8391,7 @@ no_data_fill: } else { *reason_code = 5; } - sctp_clean_up_ctl(stcb, asoc); + sctp_clean_up_ctl(stcb, asoc, so_locked); return (0); } @@ -8403,7 +8416,7 @@ sctp_queue_op_err(struct sctp_tcb *stcb, chk->copy_by_ref = 0; SCTP_BUF_PREPEND(op_err, sizeof(struct sctp_chunkhdr), M_DONTWAIT); if (op_err == NULL) { - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); return; } chk->send_size = 0; @@ -8992,7 +9005,7 @@ sctp_chunk_retransmission(struct sctp_in return (0); } else { /* Clean up the fwd-tsn list */ - sctp_clean_up_ctl(stcb, asoc); + sctp_clean_up_ctl(stcb, asoc, so_locked); return (0); } } @@ -9446,7 +9459,7 @@ sctp_chunk_output(struct sctp_inpcb *inp * running, if so piggy-back the sack. */ if (SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) { - sctp_send_sack(stcb); + sctp_send_sack(stcb, so_locked); (void)SCTP_OS_TIMER_STOP(&stcb->asoc.dack_timer.timer); } while (asoc->sent_queue_retran_cnt) { @@ -9730,7 +9743,7 @@ send_forward_tsn(struct sctp_tcb *stcb, chk->whoTo = NULL; chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_DONTWAIT, 1, MT_DATA); if (chk->data == NULL) { - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); return; } SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD); @@ -9875,7 +9888,11 @@ sctp_fill_in_rest: } void -sctp_send_sack(struct sctp_tcb *stcb) +sctp_send_sack(struct sctp_tcb *stcb, int so_locked +#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) + SCTP_UNUSED +#endif +) { /*- * Queue up a SACK or NR-SACK in the control queue. @@ -10017,7 +10034,7 @@ sctp_send_sack(struct sctp_tcb *stcb) sctp_m_freem(a_chk->data); a_chk->data = NULL; } - sctp_free_a_chunk(stcb, a_chk); + sctp_free_a_chunk(stcb, a_chk, so_locked); /* sa_ignore NO_NULL_CHK */ if (stcb->asoc.delayed_ack) { sctp_timer_stop(SCTP_TIMER_TYPE_RECV, @@ -10691,7 +10708,11 @@ sctp_select_hb_destination(struct sctp_t } int -sctp_send_hb(struct sctp_tcb *stcb, int user_req, struct sctp_nets *u_net) +sctp_send_hb(struct sctp_tcb *stcb, int user_req, struct sctp_nets *u_net, int so_locked +#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) + SCTP_UNUSED +#endif +) { struct sctp_tmit_chunk *chk; struct sctp_nets *net; @@ -10747,7 +10768,7 @@ sctp_send_hb(struct sctp_tcb *stcb, int chk->data = sctp_get_mbuf_for_msg(chk->send_size, 0, M_DONTWAIT, 1, MT_HEADER); if (chk->data == NULL) { - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, so_locked); return (0); } SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD); @@ -10836,7 +10857,7 @@ sctp_send_hb(struct sctp_tcb *stcb, int sctp_free_remote_addr(chk->whoTo); chk->whoTo = NULL; } - sctp_free_a_chunk((struct sctp_tcb *)NULL, chk); + sctp_free_a_chunk((struct sctp_tcb *)NULL, chk, so_locked); return (-1); } } @@ -10892,7 +10913,7 @@ sctp_send_ecn_echo(struct sctp_tcb *stcb chk->send_size = sizeof(struct sctp_ecne_chunk); chk->data = sctp_get_mbuf_for_msg(chk->send_size, 0, M_DONTWAIT, 1, MT_HEADER); if (chk->data == NULL) { - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); return; } SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD); @@ -10955,7 +10976,7 @@ sctp_send_packet_dropped(struct sctp_tcb chk->copy_by_ref = 0; iph = mtod(m, struct ip *); if (iph == NULL) { - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); return; } switch (iph->ip_v) { @@ -10995,7 +11016,7 @@ sctp_send_packet_dropped(struct sctp_tcb * INIT-ACK, because we can't know if the initiation * tag is correct or not. */ - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); return; default: break; @@ -11018,7 +11039,7 @@ sctp_send_packet_dropped(struct sctp_tcb chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_DONTWAIT, 1, MT_DATA); if (chk->data == NULL) { jump_out: - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); return; } SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD); @@ -11129,7 +11150,7 @@ sctp_send_cwr(struct sctp_tcb *stcb, str chk->send_size = sizeof(struct sctp_cwr_chunk); chk->data = sctp_get_mbuf_for_msg(chk->send_size, 0, M_DONTWAIT, 1, MT_HEADER); if (chk->data == NULL) { - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); return; } SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD); @@ -11418,7 +11439,7 @@ sctp_send_str_reset_req(struct sctp_tcb chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_DONTWAIT, 1, MT_DATA); if (chk->data == NULL) { - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_LOCKED); SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM); return (ENOMEM); } @@ -12108,7 +12129,7 @@ sctp_copy_it_in(struct sctp_tcb *stcb, *error = sctp_copy_one(sp, uio, resv_in_first); skip_copy: if (*error) { - sctp_free_a_strmoq(stcb, sp); + sctp_free_a_strmoq(stcb, sp, SCTP_SO_LOCKED); sp = NULL; } else { if (sp->sinfo_flags & SCTP_ADDR_OVER) { @@ -13206,7 +13227,7 @@ dataless_eof: SCTP_TCB_LOCK(stcb); hold_tcblock = 1; } - cnt = sctp_is_there_unsent_data(stcb); + cnt = sctp_is_there_unsent_data(stcb, SCTP_SO_LOCKED); if (TAILQ_EMPTY(&asoc->send_queue) && TAILQ_EMPTY(&asoc->sent_queue) && (cnt == 0)) { Modified: head/sys/netinet/sctp_output.h ============================================================================== --- head/sys/netinet/sctp_output.h Sun May 8 09:11:04 2011 (r221626) +++ head/sys/netinet/sctp_output.h Sun May 8 09:11:59 2011 (r221627) @@ -152,9 +152,9 @@ sctp_send_abort_tcb(struct sctp_tcb *, s void send_forward_tsn(struct sctp_tcb *, struct sctp_association *); -void sctp_send_sack(struct sctp_tcb *); +void sctp_send_sack(struct sctp_tcb *, int); -int sctp_send_hb(struct sctp_tcb *, int, struct sctp_nets *); +int sctp_send_hb(struct sctp_tcb *, int, struct sctp_nets *, int); void sctp_send_ecn_echo(struct sctp_tcb *, struct sctp_nets *, uint32_t); Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sun May 8 09:11:04 2011 (r221626) +++ head/sys/netinet/sctp_pcb.c Sun May 8 09:11:59 2011 (r221627) @@ -4988,7 +4988,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, } sctp_free_spbufspace(stcb, asoc, sp); if (sp->holds_key_ref) - sctp_auth_key_release(stcb, sp->auth_keyid); + sctp_auth_key_release(stcb, sp->auth_keyid, SCTP_SO_LOCKED); /* Free the zone stuff */ SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_strmoq), sp); SCTP_DECR_STRMOQ_COUNT(); @@ -5021,7 +5021,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, chk->data = NULL; } if (chk->holds_key_ref) - sctp_auth_key_release(stcb, chk->auth_keyid); + sctp_auth_key_release(stcb, chk->auth_keyid, SCTP_SO_LOCKED); SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), chk); SCTP_DECR_CHK_COUNT(); atomic_subtract_int(&SCTP_BASE_INFO(ipi_free_chunks), 1); @@ -5043,7 +5043,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, } } if (chk->holds_key_ref) - sctp_auth_key_release(stcb, chk->auth_keyid); + sctp_auth_key_release(stcb, chk->auth_keyid, SCTP_SO_LOCKED); if (chk->whoTo) { sctp_free_remote_addr(chk->whoTo); chk->whoTo = NULL; @@ -5067,7 +5067,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, } } if (chk->holds_key_ref) - sctp_auth_key_release(stcb, chk->auth_keyid); + sctp_auth_key_release(stcb, chk->auth_keyid, SCTP_SO_LOCKED); sctp_free_remote_addr(chk->whoTo); SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), chk); SCTP_DECR_CHK_COUNT(); @@ -5081,7 +5081,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, chk->data = NULL; } if (chk->holds_key_ref) - sctp_auth_key_release(stcb, chk->auth_keyid); + sctp_auth_key_release(stcb, chk->auth_keyid, SCTP_SO_LOCKED); sctp_free_remote_addr(chk->whoTo); SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), chk); SCTP_DECR_CHK_COUNT(); @@ -5095,7 +5095,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, chk->data = NULL; } if (chk->holds_key_ref) - sctp_auth_key_release(stcb, chk->auth_keyid); + sctp_auth_key_release(stcb, chk->auth_keyid, SCTP_SO_LOCKED); sctp_free_remote_addr(chk->whoTo); SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), chk); SCTP_DECR_CHK_COUNT(); @@ -5108,7 +5108,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, chk->data = NULL; } if (chk->holds_key_ref) - sctp_auth_key_release(stcb, chk->auth_keyid); + sctp_auth_key_release(stcb, chk->auth_keyid, SCTP_SO_LOCKED); sctp_free_remote_addr(chk->whoTo); SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), chk); SCTP_DECR_CHK_COUNT(); @@ -6895,7 +6895,7 @@ sctp_drain_mbufs(struct sctp_inpcb *inp, sctp_m_freem(chk->data); chk->data = NULL; } - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); } } /* Ok that was fun, now we will drain all the inbound streams? */ @@ -6958,7 +6958,7 @@ sctp_drain_mbufs(struct sctp_inpcb *inp, asoc->last_revoke_count = cnt; (void)SCTP_OS_TIMER_STOP(&stcb->asoc.dack_timer.timer); /* sa_ignore NO_NULL_CHK */ - sctp_send_sack(stcb); + sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_DRAIN, SCTP_SO_NOT_LOCKED); reneged_asoc_ids[reneged_at] = sctp_get_associd(stcb); reneged_at++; Modified: head/sys/netinet/sctp_timer.c ============================================================================== --- head/sys/netinet/sctp_timer.c Sun May 8 09:11:04 2011 (r221626) +++ head/sys/netinet/sctp_timer.c Sun May 8 09:11:59 2011 (r221627) @@ -597,7 +597,7 @@ sctp_recover_sent_list(struct sctp_tcb * } } asoc->sent_queue_cnt--; - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); } } SCTP_PRINTF("after recover order is as follows\n"); @@ -1056,7 +1056,7 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, * no recent feed back in an RTO or * more, request a RTT update */ - if (sctp_send_hb(stcb, 1, net) < 0) + if (sctp_send_hb(stcb, 1, net, SCTP_SO_NOT_LOCKED) < 0) /* * Less than 0 means we lost * the assoc @@ -1120,7 +1120,7 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, * but is in PF state, a PF-heartbeat needs to be sent * manually. */ - if (sctp_send_hb(stcb, 1, net) < 0) + if (sctp_send_hb(stcb, 1, net, SCTP_SO_NOT_LOCKED) < 0) /* Return less than 0 means we lost the association */ return (1); } @@ -1598,7 +1598,7 @@ sctp_heartbeat_timer(struct sctp_inpcb * } /* Send a new HB, this will do threshold managment, pick a new dest */ if (cnt_of_unconf == 0) { - if (sctp_send_hb(stcb, 0, NULL) < 0) { + if (sctp_send_hb(stcb, 0, NULL, SCTP_SO_NOT_LOCKED) < 0) { return (1); } } else { @@ -1620,7 +1620,7 @@ sctp_heartbeat_timer(struct sctp_inpcb * net->src_addr_selected = 0; } } - ret = sctp_send_hb(stcb, 1, net); + ret = sctp_send_hb(stcb, 1, net, SCTP_SO_NOT_LOCKED); if (ret < 0) return 1; else if (ret == 0) { Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sun May 8 09:11:04 2011 (r221626) +++ head/sys/netinet/sctp_usrreq.c Sun May 8 09:11:59 2011 (r221627) @@ -3997,7 +3997,7 @@ sctp_setopt(struct socket *so, int optna /************************NET SPECIFIC SET ******************/ if (paddrp->spp_flags & SPP_HB_DEMAND) { /* on demand HB */ - if (sctp_send_hb(stcb, 1, net) < 0) { + if (sctp_send_hb(stcb, 1, net, SCTP_SO_LOCKED) < 0) { /* asoc destroyed */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; Modified: head/sys/netinet/sctp_var.h ============================================================================== --- head/sys/netinet/sctp_var.h Sun May 8 09:11:04 2011 (r221626) +++ head/sys/netinet/sctp_var.h Sun May 8 09:11:59 2011 (r221627) @@ -87,9 +87,9 @@ extern struct pr_usrreqs sctp_usrreqs; } \ } -#define sctp_free_a_strmoq(_stcb, _strmoq) { \ +#define sctp_free_a_strmoq(_stcb, _strmoq, _so_locked) { \ if ((_strmoq)->holds_key_ref) { \ - sctp_auth_key_release(stcb, sp->auth_keyid); \ + sctp_auth_key_release(stcb, sp->auth_keyid, _so_locked); \ (_strmoq)->holds_key_ref = 0; \ } \ SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_strmoq), (_strmoq)); \ @@ -105,9 +105,9 @@ extern struct pr_usrreqs sctp_usrreqs; } \ } -#define sctp_free_a_chunk(_stcb, _chk) { \ +#define sctp_free_a_chunk(_stcb, _chk, _so_locked) { \ if ((_chk)->holds_key_ref) {\ - sctp_auth_key_release((_stcb), (_chk)->auth_keyid); \ + sctp_auth_key_release((_stcb), (_chk)->auth_keyid, _so_locked); \ (_chk)->holds_key_ref = 0; \ } \ if (_stcb) { \ Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sun May 8 09:11:04 2011 (r221626) +++ head/sys/netinet/sctputil.c Sun May 8 09:11:59 2011 (r221627) @@ -1634,7 +1634,7 @@ sctp_timeout_handler(void *t) } { SCTP_STAT_INCR(sctps_timosack); stcb->asoc.timosack++; - sctp_send_sack(stcb); + sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); } #ifdef SCTP_AUDITING_ENABLED sctp_auditing(4, inp, stcb, net); @@ -3656,7 +3656,7 @@ sctp_report_all_outbound(struct sctp_tcb chk->data = NULL; } } - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, so_locked); /* sa_ignore FREED_MEMORY */ } /* pending send queue SHOULD be empty */ @@ -3672,7 +3672,7 @@ sctp_report_all_outbound(struct sctp_tcb chk->data = NULL; } } - sctp_free_a_chunk(stcb, chk); + sctp_free_a_chunk(stcb, chk, so_locked); /* sa_ignore FREED_MEMORY */ } for (i = 0; i < asoc->streamoutcnt; i++) { @@ -3697,7 +3697,7 @@ sctp_report_all_outbound(struct sctp_tcb sp->net = NULL; } /* Free the chunk */ - sctp_free_a_strmoq(stcb, sp); + sctp_free_a_strmoq(stcb, sp, so_locked); /* sa_ignore FREED_MEMORY */ } } @@ -5033,7 +5033,7 @@ sctp_user_rcvd(struct sctp_tcb *stcb, ui goto out; } SCTP_STAT_INCR(sctps_wu_sacks_sent); - sctp_send_sack(stcb); + sctp_send_sack(stcb, SCTP_SO_LOCKED); sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_USR_RCVD, SCTP_SO_LOCKED); From owner-svn-src-all@FreeBSD.ORG Sun May 8 09:17:57 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38CB7106566B; Sun, 8 May 2011 09:17:57 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1FE648FC0A; Sun, 8 May 2011 09:17:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p489Hv9I038041; Sun, 8 May 2011 09:17:57 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p489HuAH038037; Sun, 8 May 2011 09:17:56 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201105080917.p489HuAH038037@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 8 May 2011 09:17:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221628 - head/sys/geom/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 09:17:57 -0000 Author: pjd Date: Sun May 8 09:17:56 2011 New Revision: 221628 URL: http://svn.freebsd.org/changeset/base/221628 Log: When support for multiple encryption keys was committed, GELI integrity mode was not updated to pass CRD_F_KEY_EXPLICIT flag to opencrypto. This resulted in always using first key. We need to support providers created with this bug, so set special G_ELI_FLAG_FIRST_KEY flag for GELI provider in integrity mode with version smaller than 6 and pass the CRD_F_KEY_EXPLICIT flag to opencrypto only if G_ELI_FLAG_FIRST_KEY doesn't exist. Reported by: Anton Yuzhaninov MFC after: 1 week Modified: head/sys/geom/eli/g_eli.c head/sys/geom/eli/g_eli.h head/sys/geom/eli/g_eli_integrity.c Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Sun May 8 09:11:59 2011 (r221627) +++ head/sys/geom/eli/g_eli.c Sun May 8 09:17:56 2011 (r221628) @@ -329,7 +329,12 @@ g_eli_newsession(struct g_eli_worker *wr crie.cri_klen = sc->sc_ekeylen; if (sc->sc_ealgo == CRYPTO_AES_XTS) crie.cri_klen <<= 1; - crie.cri_key = sc->sc_ekey; + if ((sc->sc_flags & G_ELI_FLAG_FIRST_KEY) != 0) { + crie.cri_key = g_eli_key_hold(sc, 0, + LIST_FIRST(&sc->sc_geom->consumer)->provider->sectorsize); + } else { + crie.cri_key = sc->sc_ekey; + } if (sc->sc_flags & G_ELI_FLAG_AUTH) { bzero(&cria, sizeof(cria)); cria.cri_alg = sc->sc_aalgo; @@ -368,6 +373,9 @@ g_eli_newsession(struct g_eli_worker *wr panic("%s: invalid condition", __func__); } + if ((sc->sc_flags & G_ELI_FLAG_FIRST_KEY) != 0) + g_eli_key_drop(sc, crie.cri_key); + return (error); } @@ -708,6 +716,8 @@ g_eli_create(struct gctl_req *req, struc sc->sc_flags |= G_ELI_FLAG_NATIVE_BYTE_ORDER; if (md->md_version < 5) sc->sc_flags |= G_ELI_FLAG_SINGLE_KEY; + if (md->md_version < 6 && (sc->sc_flags & G_ELI_FLAG_AUTH) != 0) + sc->sc_flags |= G_ELI_FLAG_FIRST_KEY; sc->sc_ealgo = md->md_ealgo; sc->sc_nkey = nkey; Modified: head/sys/geom/eli/g_eli.h ============================================================================== --- head/sys/geom/eli/g_eli.h Sun May 8 09:11:59 2011 (r221627) +++ head/sys/geom/eli/g_eli.h Sun May 8 09:17:56 2011 (r221628) @@ -63,10 +63,19 @@ * 2 - Added G_ELI_FLAG_READONLY. * 3 - Added 'configure' subcommand. * 4 - IV is generated from offset converted to little-endian - * (flag G_ELI_FLAG_NATIVE_BYTE_ORDER will be set for older versions). + * (the G_ELI_FLAG_NATIVE_BYTE_ORDER flag will be set for older versions). * 5 - Added multiple encrypton keys and AES-XTS support. + * 6 - Fixed usage of multiple keys for authenticated providers (the + * G_ELI_FLAG_FIRST_KEY flag will be set for older versions). */ -#define G_ELI_VERSION 5 +#define G_ELI_VERSION_00 0 +#define G_ELI_VERSION_01 1 +#define G_ELI_VERSION_02 2 +#define G_ELI_VERSION_03 3 +#define G_ELI_VERSION_04 4 +#define G_ELI_VERSION_05 5 +#define G_ELI_VERSION_06 6 +#define G_ELI_VERSION G_ELI_VERSION_06 /* ON DISK FLAGS. */ /* Use random, onetime keys. */ @@ -92,6 +101,8 @@ #define G_ELI_FLAG_SINGLE_KEY 0x00080000 /* Device suspended. */ #define G_ELI_FLAG_SUSPEND 0x00100000 +/* Provider uses first encryption key. */ +#define G_ELI_FLAG_FIRST_KEY 0x00200000 #define G_ELI_NEW_BIO 255 Modified: head/sys/geom/eli/g_eli_integrity.c ============================================================================== --- head/sys/geom/eli/g_eli_integrity.c Sun May 8 09:11:59 2011 (r221627) +++ head/sys/geom/eli/g_eli_integrity.c Sun May 8 09:17:56 2011 (r221628) @@ -513,6 +513,8 @@ g_eli_auth_run(struct g_eli_worker *wr, crde->crd_skip = sc->sc_alen; crde->crd_len = data_secsize; crde->crd_flags = CRD_F_IV_EXPLICIT | CRD_F_IV_PRESENT; + if ((sc->sc_flags & G_ELI_FLAG_FIRST_KEY) == 0) + crde->crd_flags |= CRD_F_KEY_EXPLICIT; if (bp->bio_cmd == BIO_WRITE) crde->crd_flags |= CRD_F_ENCRYPT; crde->crd_alg = sc->sc_ealgo; From owner-svn-src-all@FreeBSD.ORG Sun May 8 09:25:16 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E1BED106567B; Sun, 8 May 2011 09:25:16 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D48B68FC17; Sun, 8 May 2011 09:25:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p489PGGd038302; Sun, 8 May 2011 09:25:16 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p489PG12038300; Sun, 8 May 2011 09:25:16 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201105080925.p489PG12038300@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 8 May 2011 09:25:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221629 - head/sys/geom/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 09:25:17 -0000 Author: pjd Date: Sun May 8 09:25:16 2011 New Revision: 221629 URL: http://svn.freebsd.org/changeset/base/221629 Log: Detect and handle metadata of version 6. MFC after: 1 week Modified: head/sys/geom/eli/g_eli.h Modified: head/sys/geom/eli/g_eli.h ============================================================================== --- head/sys/geom/eli/g_eli.h Sun May 8 09:17:56 2011 (r221628) +++ head/sys/geom/eli/g_eli.h Sun May 8 09:25:16 2011 (r221629) @@ -265,7 +265,7 @@ eli_metadata_decode_v0(const u_char *dat } static __inline int -eli_metadata_decode_v1v2v3v4v5(const u_char *data, struct g_eli_metadata *md) +eli_metadata_decode_v1v2v3v4v5v6(const u_char *data, struct g_eli_metadata *md) { MD5_CTX ctx; const u_char *p; @@ -296,15 +296,16 @@ eli_metadata_decode(const u_char *data, bcopy(data, md->md_magic, sizeof(md->md_magic)); md->md_version = le32dec(data + sizeof(md->md_magic)); switch (md->md_version) { - case 0: + case G_ELI_VERSION_00: error = eli_metadata_decode_v0(data, md); break; - case 1: - case 2: - case 3: - case 4: - case 5: - error = eli_metadata_decode_v1v2v3v4v5(data, md); + case G_ELI_VERSION_01: + case G_ELI_VERSION_02: + case G_ELI_VERSION_03: + case G_ELI_VERSION_04: + case G_ELI_VERSION_05: + case G_ELI_VERSION_06: + error = eli_metadata_decode_v1v2v3v4v5v6(data, md); break; default: error = EINVAL; From owner-svn-src-all@FreeBSD.ORG Sun May 8 09:25:54 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7669A1065678; Sun, 8 May 2011 09:25:54 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 696AB8FC25; Sun, 8 May 2011 09:25:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p489PsPs038355; Sun, 8 May 2011 09:25:54 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p489PsFt038353; Sun, 8 May 2011 09:25:54 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201105080925.p489PsFt038353@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 8 May 2011 09:25:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221630 - head/sys/geom/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 09:25:54 -0000 Author: pjd Date: Sun May 8 09:25:54 2011 New Revision: 221630 URL: http://svn.freebsd.org/changeset/base/221630 Log: Version 6 is compatible with version 5 when it comes to control commands. MFC after: 1 week Modified: head/sys/geom/eli/g_eli_ctl.c Modified: head/sys/geom/eli/g_eli_ctl.c ============================================================================== --- head/sys/geom/eli/g_eli_ctl.c Sun May 8 09:25:16 2011 (r221629) +++ head/sys/geom/eli/g_eli_ctl.c Sun May 8 09:25:54 2011 (r221630) @@ -1014,7 +1014,12 @@ g_eli_config(struct gctl_req *req, struc gctl_error(req, "No '%s' argument.", "version"); return; } - if (*version != G_ELI_VERSION) { + while (*version != G_ELI_VERSION) { + if (G_ELI_VERSION == G_ELI_VERSION_06 && + *version == G_ELI_VERSION_05) { + /* Compatible. */ + break; + } gctl_error(req, "Userland and kernel parts are out of sync."); return; } From owner-svn-src-all@FreeBSD.ORG Sun May 8 09:29:22 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21F02106564A; Sun, 8 May 2011 09:29:22 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 14D248FC13; Sun, 8 May 2011 09:29:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p489TLkm038488; Sun, 8 May 2011 09:29:21 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p489TLMK038486; Sun, 8 May 2011 09:29:21 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201105080929.p489TLMK038486@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 8 May 2011 09:29:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221631 - head/sys/geom/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 09:29:22 -0000 Author: pjd Date: Sun May 8 09:29:21 2011 New Revision: 221631 URL: http://svn.freebsd.org/changeset/base/221631 Log: Export GELI class version via sysctl kern.geom.eli.version. MFC after: 1 week Modified: head/sys/geom/eli/g_eli.c Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Sun May 8 09:25:54 2011 (r221630) +++ head/sys/geom/eli/g_eli.c Sun May 8 09:29:21 2011 (r221631) @@ -57,6 +57,9 @@ MALLOC_DEFINE(M_ELI, "eli data", "GEOM_E SYSCTL_DECL(_kern_geom); SYSCTL_NODE(_kern_geom, OID_AUTO, eli, CTLFLAG_RW, 0, "GEOM_ELI stuff"); +static int g_eli_version = G_ELI_VERSION; +SYSCTL_INT(_kern_geom_eli, OID_AUTO, version, CTLFLAG_RD, &g_eli_version, 0, + "GELI version"); int g_eli_debug = 0; TUNABLE_INT("kern.geom.eli.debug", &g_eli_debug); SYSCTL_INT(_kern_geom_eli, OID_AUTO, debug, CTLFLAG_RW, &g_eli_debug, 0, From owner-svn-src-all@FreeBSD.ORG Sun May 8 09:31:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAA271065672; Sun, 8 May 2011 09:31:17 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CD70D8FC15; Sun, 8 May 2011 09:31:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p489VHBL038584; Sun, 8 May 2011 09:31:17 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p489VHFS038582; Sun, 8 May 2011 09:31:17 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201105080931.p489VHFS038582@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 8 May 2011 09:31:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221632 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 09:31:18 -0000 Author: trociny Date: Sun May 8 09:31:17 2011 New Revision: 221632 URL: http://svn.freebsd.org/changeset/base/221632 Log: Fix isitme(), which is used to check if node-specific configuration belongs to our node, and was returning false positive if the first part of a node name matches short hostname. Approved by: pjd (mentor) Modified: head/sbin/hastd/parse.y Modified: head/sbin/hastd/parse.y ============================================================================== --- head/sbin/hastd/parse.y Sun May 8 09:29:21 2011 (r221631) +++ head/sbin/hastd/parse.y Sun May 8 09:31:17 2011 (r221632) @@ -92,8 +92,10 @@ isitme(const char *name) * Now check if it matches first part of the host name. */ pos = strchr(buf, '.'); - if (pos != NULL && pos != buf && strncmp(buf, name, pos - buf) == 0) + if (pos != NULL && (size_t)(pos - buf) == strlen(name) && + strncmp(buf, name, pos - buf) == 0) { return (1); + } /* * At the end check if name is equal to our host's UUID. From owner-svn-src-all@FreeBSD.ORG Sun May 8 09:38:22 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9E331065672; Sun, 8 May 2011 09:38:22 +0000 (UTC) (envelope-from hselasky@freebsd.org) Received: from swip.net (mailfe06.c2i.net [212.247.154.162]) by mx1.freebsd.org (Postfix) with ESMTP id 77B0C8FC1A; Sun, 8 May 2011 09:38:20 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=NvrFngl24Vvwb7eBef0tfsytOWEnP/WlkqxQrRnklhk= c=1 sm=1 a=SvYTsOw2Z4kA:10 a=YKcn08c2pF4A:10 a=dBRESv0yCI8A:10 a=Q9fys5e9bTEA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=DiimSGeJN9pgu_E7FloA:9 a=PUjeQqilurYA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe06.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 123106928; Sun, 08 May 2011 11:38:19 +0200 Received-SPF: softfail receiver=mailfe06.swip.net; client-ip=188.126.198.129; envelope-from=hselasky@freebsd.org From: Hans Petter Selasky To: Jason Hellenthal Date: Sun, 8 May 2011 11:37:10 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <201105080817.p488HHp0035906@svn.freebsd.org> <20110508084537.GA70268@DataIX.net> In-Reply-To: <20110508084537.GA70268@DataIX.net> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201105081137.10517.hselasky@freebsd.org> Cc: "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "svn-src-stable-8@freebsd.org" Subject: Re: svn commit: r221621 - stable/8/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 09:38:22 -0000 On Sunday 08 May 2011 10:45:37 Jason Hellenthal wrote: > Hans, > > Was this intended. ? "udev->ugen_name," > No, we added a second variable, ugen=ugenX.Y. That's why it is listed twice. I think if ugen_name is NULL, the print statement will not panic. Thanks for your comment! --HPS From owner-svn-src-all@FreeBSD.ORG Sun May 8 09:46:10 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F4EA106566B; Sun, 8 May 2011 09:46:10 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2797A8FC08; Sun, 8 May 2011 09:46:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p489kAgr039068; Sun, 8 May 2011 09:46:10 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p489kAHs039066; Sun, 8 May 2011 09:46:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201105080946.p489kAHs039066@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 8 May 2011 09:46:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221633 - head/sbin/geom/class/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 09:46:10 -0000 Author: pjd Date: Sun May 8 09:46:09 2011 New Revision: 221633 URL: http://svn.freebsd.org/changeset/base/221633 Log: Document the following sysctls: kern.geom.eli.version kern.geom.eli.key_cache_limit kern.geom.eli.key_cache_hits kern.geom.eli.key_cache_misses MFC after: 1 week Modified: head/sbin/geom/class/eli/geli.8 Modified: head/sbin/geom/class/eli/geli.8 ============================================================================== --- head/sbin/geom/class/eli/geli.8 Sun May 8 09:31:17 2011 (r221632) +++ head/sbin/geom/class/eli/geli.8 Sun May 8 09:46:09 2011 (r221633) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2005-2010 Pawel Jakub Dawidek +.\" Copyright (c) 2005-2011 Pawel Jakub Dawidek .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -627,9 +627,13 @@ variables can be used to control the beh .Nm ELI GEOM class. The default value is shown next to each variable. -All variables can also be set in +Some variables can also be set in .Pa /boot/loader.conf . .Bl -tag -width indent +.It Va kern.geom.eli.version +Version number of the +.Nm ELI +GEOM class. .It Va kern.geom.eli.debug : No 0 Debug level of the .Nm ELI @@ -668,6 +672,22 @@ When set to 1, can speed-up crypto opera Batching allows to reduce number of interrupts by responding on a group of crypto requests with one interrupt. The crypto card and the driver has to support this feature. +.It Va kern.geom.eli.key_cache_limit : No 8192 +Specifies how many encryption keys to cache. +The default limit +.No ( 8192 +keys) will allow to cache all keys for 4TB provider with 512 bytes sectors and +will take around 1MB of memory. +.It Va kern.geom.eli.key_cache_hits +Reports how many times we were looking up a key and it was already in cache. +This sysctl is not updated for providers that need less keys than the limit +specified in +.Va kern.geom.eli.key_cache_limit . +.It Va kern.geom.eli.key_cache_misses +Reports how many times we were looking up a key and it was not in cache. +This sysctl is not updated for providers that need less keys than the limit +specified in +.Va kern.geom.eli.key_cache_limit . .El .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. From owner-svn-src-all@FreeBSD.ORG Sun May 8 09:50:17 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFABF106566B; Sun, 8 May 2011 09:50:17 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 79BBE8FC08; Sun, 8 May 2011 09:50:17 +0000 (UTC) Received: from c122-106-155-58.carlnfd1.nsw.optusnet.com.au (c122-106-155-58.carlnfd1.nsw.optusnet.com.au [122.106.155.58]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p489o442008739 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 8 May 2011 19:50:06 +1000 Date: Sun, 8 May 2011 19:50:04 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Garrett Cooper In-Reply-To: Message-ID: <20110508194150.R981@besplex.bde.org> References: <201105071628.p47GSO16006145@svn.freebsd.org> <201105071836.00660.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1604857336-1304848204=:981" Cc: "svn-src-head@freebsd.org" , mdf@FreeBSD.org, "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Hans Petter Selasky Subject: Re: svn commit: r221604 - head/usr.sbin/usbdump X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 09:50:18 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1604857336-1304848204=:981 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Sat, 7 May 2011, Garrett Cooper wrote: > On Sat, May 7, 2011 at 10:13 AM, wrote: >> On Sat, May 7, 2011 at 9:36 AM, Hans Petter Selasky w= rote: >>> On Saturday 07 May 2011 18:28:24 Hans Petter Selasky wrote: >>>> =A0 - Use memcpy() instead of bcopy(). >>> >>> - Use memset() instead of bzero(). >> >> Why? =A0It usually falls through to the same code in libc. =A0Is there >> some standardization on memfoo versus bfoo here? As part of adding lots of style bugs I suppose. > bfoo is marked legacy per POSIX 2001.1; example: > http://pubs.opengroup.org/onlinepubs/009695399/functions/bcopy.html . bfoo was correctly left out of POSIX.1-1988. However, POSIX.1-2001 brought back lots of historical cruft 13 years after POSIX.1-1988 deprecated it by not having it at all. However2, the bcopy family is not historical cruft in BSD. > A lot of folks (Linux leading the charge) are actively working to > deprecate the APIs. Another reason to not deprecate it in BSD :-). bzero() is technically better than memset() since it doesn't waste space or time for an extra arg. bcmp() is technically better than memcmp() for the usual case where you only want a binary result. The other bcopy functions are just different spellings of the newer interfaces. Bruce --0-1604857336-1304848204=:981-- From owner-svn-src-all@FreeBSD.ORG Sun May 8 10:14:36 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A675106566B; Sun, 8 May 2011 10:14:36 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id E9C758FC13; Sun, 8 May 2011 10:14:35 +0000 (UTC) Received: from c122-106-155-58.carlnfd1.nsw.optusnet.com.au (c122-106-155-58.carlnfd1.nsw.optusnet.com.au [122.106.155.58]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p48AEQoA032357 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 8 May 2011 20:14:26 +1000 Date: Sun, 8 May 2011 20:14:25 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Hans Petter Selasky In-Reply-To: <201105071955.35305.hselasky@c2i.net> Message-ID: <20110508195020.V981@besplex.bde.org> References: <201105071628.p47GSO16006145@svn.freebsd.org> <201105071836.00660.hselasky@c2i.net> <201105071955.35305.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: "svn-src-head@freebsd.org" , mdf@FreeBSD.org, "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r221604 - head/usr.sbin/usbdump X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 10:14:36 -0000 On Sat, 7 May 2011, Hans Petter Selasky wrote: > On Saturday 07 May 2011 19:13:27 mdf@freebsd.org wrote: >> On Sat, May 7, 2011 at 9:36 AM, Hans Petter Selasky > wrote: >>> On Saturday 07 May 2011 18:28:24 Hans Petter Selasky wrote: >>>> - Use memcpy() instead of bcopy(). >>> >>> - Use memset() instead of bzero(). >> >> Why? It usually falls through to the same code in libc. Is there >> some standardization on memfoo versus bfoo here? > > I thought that memset() was a compiler builtin and bzero() optimised for > larger amounts of data? In the kernel, compiler builtins aren't used, memset() is slightly pessimized, and bzero() is not optimized (except in old versions of FreeBSD on i386, attempts were made to optimize bzero() for large data at a tiny cost to small data). A better implementation would use the compiler builtin for both. My version does this, but the gains (or losses) from using builtins for this and other things in the kernel insignificant. Here it is for bzero(): #define bzero(p, n) ({ \ if (__builtin_constant_p(n) && (n) <= 32) \ __builtin_memset((p), 0, (n)); \ else \ (bzero)((p), (n)); \ }) This hard-codes the limit of 32 for the builtin since some versions of gcc use a worse limit. In userland, on at least amd64 and i386, the extern bzero() and memset() are unoptimized, but the compiler builtin is used for memset() only. A better implementation of bzero() would use the compiler builtin for it too. The above is not good enough for libc, since it evaluates args more than once and has a hard-coded gccism. The correct optimizations for bzero() etc. are very machine-dependent and context-dependent and are far too hard for anyone or the compiler or the CPU to get right (but I believe newer Intel CPUs are closer to making unoptimized stosb as fast as possible). Context-dependent parts include whether the data should go through cache(s) (it shouldn't iff it won't be used soon and the memory system is such that not going through caches is either faster or saves time later). Bruce From owner-svn-src-all@FreeBSD.ORG Sun May 8 10:19:30 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46EA8106564A; Sun, 8 May 2011 10:19:30 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 395E68FC08; Sun, 8 May 2011 10:19:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48AJUdY040119; Sun, 8 May 2011 10:19:30 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48AJUpL040117; Sun, 8 May 2011 10:19:30 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201105081019.p48AJUpL040117@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 8 May 2011 10:19:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221634 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 10:19:30 -0000 Author: bschmidt Date: Sun May 8 10:19:29 2011 New Revision: 221634 URL: http://svn.freebsd.org/changeset/base/221634 Log: Re-add 2 device IDs which got lost. Pointed out by: benjsc Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun May 8 09:46:09 2011 (r221633) +++ head/sys/dev/iwn/if_iwn.c Sun May 8 10:19:29 2011 (r221634) @@ -92,8 +92,10 @@ static const struct iwn_ident iwn_ident_ { 0x8086, 0x4229, "Intel(R) Wireless WiFi Link 4965" }, { 0x8086, 0x422b, "Intel(R) Centrino(R) Ultimate-N 6300" }, { 0x8086, 0x422c, "Intel(R) Centrino(R) Advanced-N 6200" }, + { 0x8086, 0x422d, "Intel(R) Wireless WiFi Link 4965" }, { 0x8086, 0x4230, "Intel(R) Wireless WiFi Link 4965" }, { 0x8086, 0x4232, "Intel(R) WiFi Link 5100" }, + { 0x8086, 0x4233, "Intel(R) Wireless WiFi Link 4965" }, { 0x8086, 0x4235, "Intel(R) Ultimate N WiFi Link 5300" }, { 0x8086, 0x4236, "Intel(R) Ultimate N WiFi Link 5300" }, { 0x8086, 0x4237, "Intel(R) WiFi Link 5100" }, From owner-svn-src-all@FreeBSD.ORG Sun May 8 10:21:42 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75E25106566C; Sun, 8 May 2011 10:21:42 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 686948FC13; Sun, 8 May 2011 10:21:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48ALgfE040239; Sun, 8 May 2011 10:21:42 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48ALgnD040236; Sun, 8 May 2011 10:21:42 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201105081021.p48ALgnD040236@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 8 May 2011 10:21:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221635 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 10:21:42 -0000 Author: bschmidt Date: Sun May 8 10:21:42 2011 New Revision: 221635 URL: http://svn.freebsd.org/changeset/base/221635 Log: The 6000 series adapters have a slightly different offset for band 6, 2GHz HT40 channels. Modified: head/sys/dev/iwn/if_iwn.c head/sys/dev/iwn/if_iwnreg.h Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun May 8 10:19:29 2011 (r221634) +++ head/sys/dev/iwn/if_iwn.c Sun May 8 10:21:42 2011 (r221635) @@ -1784,7 +1784,10 @@ iwn5000_read_eeprom(struct iwn_softc *sc /* Read the list of authorized channels (20MHz ones only). */ for (i = 0; i < 5; i++) { - addr = base + iwn5000_regulatory_bands[i]; + if (sc->hw_type >= IWN_HW_REV_TYPE_6000) + addr = base + iwn6000_regulatory_bands[i]; + else + addr = base + iwn5000_regulatory_bands[i]; iwn_read_eeprom_channels(sc, i, addr); } Modified: head/sys/dev/iwn/if_iwnreg.h ============================================================================== --- head/sys/dev/iwn/if_iwnreg.h Sun May 8 10:19:29 2011 (r221634) +++ head/sys/dev/iwn/if_iwnreg.h Sun May 8 10:21:42 2011 (r221635) @@ -1403,6 +1403,7 @@ struct iwn_fw_tlv { #define IWN5000_EEPROM_BAND4 0x02e #define IWN5000_EEPROM_BAND5 0x03a #define IWN5000_EEPROM_BAND6 0x041 +#define IWN6000_EEPROM_BAND6 0x040 #define IWN5000_EEPROM_BAND7 0x049 #define IWN6000_EEPROM_ENHINFO 0x054 #define IWN5000_EEPROM_CRYSTAL 0x128 @@ -1486,6 +1487,16 @@ static const uint32_t iwn5000_regulatory IWN5000_EEPROM_BAND7 }; +static const uint32_t iwn6000_regulatory_bands[IWN_NBANDS] = { + IWN5000_EEPROM_BAND1, + IWN5000_EEPROM_BAND2, + IWN5000_EEPROM_BAND3, + IWN5000_EEPROM_BAND4, + IWN5000_EEPROM_BAND5, + IWN6000_EEPROM_BAND6, + IWN5000_EEPROM_BAND7 +}; + #define IWN_CHAN_BANDS_COUNT 7 #define IWN_MAX_CHAN_PER_BAND 14 static const struct iwn_chan_band { From owner-svn-src-all@FreeBSD.ORG Sun May 8 10:31:23 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2400F106564A; Sun, 8 May 2011 10:31:23 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 161BE8FC12; Sun, 8 May 2011 10:31:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48AVMRJ041623; Sun, 8 May 2011 10:31:22 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48AVMO7041621; Sun, 8 May 2011 10:31:22 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201105081031.p48AVMO7041621@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 8 May 2011 10:31:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221636 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 10:31:23 -0000 Author: bschmidt Date: Sun May 8 10:31:22 2011 New Revision: 221636 URL: http://svn.freebsd.org/changeset/base/221636 Log: Hook HT channel setup. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun May 8 10:21:42 2011 (r221635) +++ head/sys/dev/iwn/if_iwn.c Sun May 8 10:31:22 2011 (r221636) @@ -154,9 +154,7 @@ static void iwn4965_print_power_group(st static void iwn5000_read_eeprom(struct iwn_softc *); static uint32_t iwn_eeprom_channel_flags(struct iwn_eeprom_chan *); static void iwn_read_eeprom_band(struct iwn_softc *, int); -#if 0 /* HT */ static void iwn_read_eeprom_ht40(struct iwn_softc *, int); -#endif static void iwn_read_eeprom_channels(struct iwn_softc *, int, uint32_t); static struct iwn_eeprom_chan *iwn_find_eeprom_channel(struct iwn_softc *, struct ieee80211_channel *); @@ -1696,7 +1694,7 @@ iwn4965_read_eeprom(struct iwn_softc *sc iwn_read_prom_data(sc, IWN4965_EEPROM_DOMAIN, sc->eeprom_domain, 4); /* Read the list of authorized channels (20MHz ones only). */ - for (i = 0; i < 5; i++) { + for (i = 0; i < 7; i++) { addr = iwn4965_regulatory_bands[i]; iwn_read_eeprom_channels(sc, i, addr); } @@ -1783,7 +1781,7 @@ iwn5000_read_eeprom(struct iwn_softc *sc sc->eeprom_domain, 4); /* Read the list of authorized channels (20MHz ones only). */ - for (i = 0; i < 5; i++) { + for (i = 0; i < 7; i++) { if (sc->hw_type >= IWN_HW_REV_TYPE_6000) addr = base + iwn6000_regulatory_bands[i]; else @@ -1889,18 +1887,15 @@ iwn_read_eeprom_band(struct iwn_softc *s "add chan %d flags 0x%x maxpwr %d\n", chan, channels[i].flags, channels[i].maxpwr); -#if 0 /* HT */ - /* XXX no constraints on using HT20 */ - /* add HT20, HT40 added separately */ - c = &ic->ic_channels[ic->ic_nchans++]; - c[0] = c[-1]; - c->ic_flags |= IEEE80211_CHAN_HT20; - /* XXX NARROW =>'s 1/2 and 1/4 width? */ -#endif + if (sc->sc_flags & IWN_FLAG_HAS_11N) { + /* add HT20, HT40 added separately */ + c = &ic->ic_channels[ic->ic_nchans++]; + c[0] = c[-1]; + c->ic_flags |= IEEE80211_CHAN_HT20; + } } } -#if 0 /* HT */ static void iwn_read_eeprom_ht40(struct iwn_softc *sc, int n) { @@ -1909,55 +1904,59 @@ iwn_read_eeprom_ht40(struct iwn_softc *s struct iwn_eeprom_chan *channels = sc->eeprom_channels[n]; const struct iwn_chan_band *band = &iwn_bands[n]; struct ieee80211_channel *c, *cent, *extc; - int i; + uint8_t chan; + int i, nflags; + + if (!(sc->sc_flags & IWN_FLAG_HAS_11N)) + return; for (i = 0; i < band->nchan; i++) { - if (!(channels[i].flags & IWN_EEPROM_CHAN_VALID) || - !(channels[i].flags & IWN_EEPROM_CHAN_WIDE)) { + if (!(channels[i].flags & IWN_EEPROM_CHAN_VALID)) { DPRINTF(sc, IWN_DEBUG_RESET, "skip chan %d flags 0x%x maxpwr %d\n", band->chan[i], channels[i].flags, channels[i].maxpwr); continue; } + chan = band->chan[i]; + nflags = iwn_eeprom_channel_flags(&channels[i]); + /* * Each entry defines an HT40 channel pair; find the * center channel, then the extension channel above. */ - cent = ieee80211_find_channel_byieee(ic, band->chan[i], - band->flags & ~IEEE80211_CHAN_HT); + cent = ieee80211_find_channel_byieee(ic, chan, + (n == 5 ? IEEE80211_CHAN_G : IEEE80211_CHAN_A)); if (cent == NULL) { /* XXX shouldn't happen */ device_printf(sc->sc_dev, - "%s: no entry for channel %d\n", - __func__, band->chan[i]); + "%s: no entry for channel %d\n", __func__, chan); continue; } extc = ieee80211_find_channel(ic, cent->ic_freq+20, - band->flags & ~IEEE80211_CHAN_HT); + (n == 5 ? IEEE80211_CHAN_G : IEEE80211_CHAN_A)); if (extc == NULL) { DPRINTF(sc, IWN_DEBUG_RESET, - "skip chan %d, extension channel not found\n", - band->chan[i]); + "%s: skip chan %d, extension channel not found\n", + __func__, chan); continue; } DPRINTF(sc, IWN_DEBUG_RESET, "add ht40 chan %d flags 0x%x maxpwr %d\n", - band->chan[i], channels[i].flags, channels[i].maxpwr); + chan, channels[i].flags, channels[i].maxpwr); c = &ic->ic_channels[ic->ic_nchans++]; c[0] = cent[0]; c->ic_extieee = extc->ic_ieee; c->ic_flags &= ~IEEE80211_CHAN_HT; - c->ic_flags |= IEEE80211_CHAN_HT40U; + c->ic_flags |= IEEE80211_CHAN_HT40U | nflags; c = &ic->ic_channels[ic->ic_nchans++]; c[0] = extc[0]; c->ic_extieee = cent->ic_ieee; c->ic_flags &= ~IEEE80211_CHAN_HT; - c->ic_flags |= IEEE80211_CHAN_HT40D; + c->ic_flags |= IEEE80211_CHAN_HT40D | nflags; } } -#endif static void iwn_read_eeprom_channels(struct iwn_softc *sc, int n, uint32_t addr) @@ -1970,25 +1969,34 @@ iwn_read_eeprom_channels(struct iwn_soft if (n < 5) iwn_read_eeprom_band(sc, n); -#if 0 /* HT */ else iwn_read_eeprom_ht40(sc, n); -#endif ieee80211_sort_channels(ic->ic_channels, ic->ic_nchans); } static struct iwn_eeprom_chan * iwn_find_eeprom_channel(struct iwn_softc *sc, struct ieee80211_channel *c) { - int i, j; + int band, chan, i, j; - for (j = 0; j < 7; j++) { - for (i = 0; i < iwn_bands[j].nchan; i++) { - if (iwn_bands[j].chan[i] == c->ic_ieee) - return &sc->eeprom_channels[j][i]; + if (IEEE80211_IS_CHAN_HT40(c)) { + band = IEEE80211_IS_CHAN_5GHZ(c) ? 6 : 5; + if (IEEE80211_IS_CHAN_HT40D(c)) + chan = c->ic_extieee; + else + chan = c->ic_ieee; + for (i = 0; i < iwn_bands[band].nchan; i++) { + if (iwn_bands[band].chan[i] == chan) + return &sc->eeprom_channels[band][i]; + } + } else { + for (j = 0; j < 5; j++) { + for (i = 0; i < iwn_bands[j].nchan; i++) { + if (iwn_bands[j].chan[i] == c->ic_ieee) + return &sc->eeprom_channels[j][i]; + } } } - return NULL; } From owner-svn-src-all@FreeBSD.ORG Sun May 8 10:35:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EED3E106566C; Sun, 8 May 2011 10:35:16 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E14428FC15; Sun, 8 May 2011 10:35:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48AZGsr041779; Sun, 8 May 2011 10:35:16 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48AZGMn041775; Sun, 8 May 2011 10:35:16 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201105081035.p48AZGMn041775@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 8 May 2011 10:35:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221637 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 10:35:17 -0000 Author: bschmidt Date: Sun May 8 10:35:16 2011 New Revision: 221637 URL: http://svn.freebsd.org/changeset/base/221637 Log: Use the enhanced TX power information availabe on newer EEPROMs. Modified: head/sys/dev/iwn/if_iwn.c head/sys/dev/iwn/if_iwnreg.h head/sys/dev/iwn/if_iwnvar.h Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun May 8 10:31:22 2011 (r221636) +++ head/sys/dev/iwn/if_iwn.c Sun May 8 10:35:16 2011 (r221637) @@ -2033,18 +2033,22 @@ static void iwn_read_eeprom_enhinfo(struct iwn_softc *sc) { struct iwn_eeprom_enhinfo enhinfo[35]; + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211_channel *c; uint16_t val, base; int8_t maxpwr; - int i; + uint8_t flags; + int i, j; iwn_read_prom_data(sc, IWN5000_EEPROM_REG, &val, 2); base = le16toh(val); iwn_read_prom_data(sc, base + IWN6000_EEPROM_ENHINFO, enhinfo, sizeof enhinfo); - memset(sc->enh_maxpwr, 0, sizeof sc->enh_maxpwr); for (i = 0; i < nitems(enhinfo); i++) { - if (enhinfo[i].chan == 0 || enhinfo[i].reserved != 0) + flags = enhinfo[i].flags; + if (!(flags & IWN_ENHINFO_VALID)) continue; /* Skip invalid entries. */ maxpwr = 0; @@ -2058,11 +2062,34 @@ iwn_read_eeprom_enhinfo(struct iwn_softc maxpwr = MAX(maxpwr, enhinfo[i].mimo2); else if (sc->ntxchains == 3) maxpwr = MAX(maxpwr, enhinfo[i].mimo3); - maxpwr /= 2; /* Convert half-dBm to dBm. */ - DPRINTF(sc, IWN_DEBUG_RESET, "enhinfo %d, maxpwr=%d\n", i, - maxpwr); - sc->enh_maxpwr[i] = maxpwr; + for (j = 0; j < ic->ic_nchans; j++) { + c = &ic->ic_channels[j]; + if ((flags & IWN_ENHINFO_5GHZ)) { + if (!IEEE80211_IS_CHAN_A(c)) + continue; + } else if ((flags & IWN_ENHINFO_OFDM)) { + if (!IEEE80211_IS_CHAN_G(c)) + continue; + } else if (!IEEE80211_IS_CHAN_B(c)) + continue; + if ((flags & IWN_ENHINFO_HT40)) { + if (!IEEE80211_IS_CHAN_HT40(c)) + continue; + } else { + if (IEEE80211_IS_CHAN_HT40(c)) + continue; + } + if (enhinfo[i].chan != 0 && + enhinfo[i].chan != c->ic_ieee) + continue; + + DPRINTF(sc, IWN_DEBUG_RESET, + "channel %d(%x), maxpwr %d\n", c->ic_ieee, + c->ic_flags, maxpwr / 2); + c->ic_maxregpower = maxpwr / 2; + c->ic_maxpower = maxpwr; + } } } Modified: head/sys/dev/iwn/if_iwnreg.h ============================================================================== --- head/sys/dev/iwn/if_iwnreg.h Sun May 8 10:31:22 2011 (r221636) +++ head/sys/dev/iwn/if_iwnreg.h Sun May 8 10:35:16 2011 (r221637) @@ -1433,7 +1433,17 @@ struct iwn_eeprom_chan { } __packed; struct iwn_eeprom_enhinfo { - uint16_t chan; + uint8_t flags; +#define IWN_ENHINFO_VALID 0x01 +#define IWN_ENHINFO_5GHZ 0x02 +#define IWN_ENHINFO_OFDM 0x04 +#define IWN_ENHINFO_HT40 0x08 +#define IWN_ENHINFO_HTAP 0x10 +#define IWN_ENHINFO_RES1 0x20 +#define IWN_ENHINFO_RES2 0x40 +#define IWN_ENHINFO_COMMON 0x80 + + uint8_t chan; int8_t chain[3]; /* max power in half-dBm */ uint8_t reserved; int8_t mimo2; /* max power in half-dBm */ Modified: head/sys/dev/iwn/if_iwnvar.h ============================================================================== --- head/sys/dev/iwn/if_iwnvar.h Sun May 8 10:31:22 2011 (r221636) +++ head/sys/dev/iwn/if_iwnvar.h Sun May 8 10:35:16 2011 (r221637) @@ -295,7 +295,6 @@ struct iwn_softc { int8_t maxpwr2GHz; int8_t maxpwr5GHz; int8_t maxpwr[IEEE80211_CHAN_MAX]; - int8_t enh_maxpwr[35]; int32_t temp_off; uint32_t int_mask; From owner-svn-src-all@FreeBSD.ORG Sun May 8 10:54:50 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96749106566B; Sun, 8 May 2011 10:54:50 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 88FE48FC16; Sun, 8 May 2011 10:54:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48AsoGU042419; Sun, 8 May 2011 10:54:50 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48Aso1H042417; Sun, 8 May 2011 10:54:50 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201105081054.p48Aso1H042417@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 8 May 2011 10:54:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221638 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 10:54:50 -0000 Author: bschmidt Date: Sun May 8 10:54:50 2011 New Revision: 221638 URL: http://svn.freebsd.org/changeset/base/221638 Log: Allocate all TX rings, those will be use for TX packet aggregation. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun May 8 10:35:16 2011 (r221637) +++ head/sys/dev/iwn/if_iwn.c Sun May 8 10:54:50 2011 (r221638) @@ -1489,13 +1489,6 @@ iwn_alloc_tx_ring(struct iwn_softc *sc, __func__, error); goto fail; } - /* - * We only use rings 0 through 4 (4 EDCA + cmd) so there is no need - * to allocate commands space for other rings. - * XXX Do we really need to allocate descriptors for other rings? - */ - if (qid > 4) - return 0; size = IWN_TX_RING_COUNT * sizeof (struct iwn_tx_cmd); error = iwn_dma_contig_alloc(sc, &ring->cmd_dma, (void **)&ring->cmd, From owner-svn-src-all@FreeBSD.ORG Sun May 8 10:57:45 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1BA95106566C; Sun, 8 May 2011 10:57:45 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E5C58FC0C; Sun, 8 May 2011 10:57:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48Aviiq042562; Sun, 8 May 2011 10:57:44 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48AviJE042560; Sun, 8 May 2011 10:57:44 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201105081057.p48AviJE042560@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 8 May 2011 10:57:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221639 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 10:57:45 -0000 Author: bschmidt Date: Sun May 8 10:57:44 2011 New Revision: 221639 URL: http://svn.freebsd.org/changeset/base/221639 Log: RX aggregation is slightly different then the legacy path, we will only receive one RX_PHY for each aggregate and not one RX_PHY per frame. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun May 8 10:54:50 2011 (r221638) +++ head/sys/dev/iwn/if_iwn.c Sun May 8 10:57:44 2011 (r221639) @@ -2253,7 +2253,6 @@ iwn_rx_done(struct iwn_softc *sc, struct "%s: missing RX_PHY\n", __func__); return; } - sc->last_rx_valid = 0; stat = &sc->last_rx_stat; } else stat = (struct iwn_rx_stat *)(desc + 1); From owner-svn-src-all@FreeBSD.ORG Sun May 8 11:01:53 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63927106564A; Sun, 8 May 2011 11:01:53 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 563948FC08; Sun, 8 May 2011 11:01:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48B1rH9042739; Sun, 8 May 2011 11:01:53 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48B1rKj042737; Sun, 8 May 2011 11:01:53 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201105081101.p48B1rKj042737@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 8 May 2011 11:01:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221640 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 11:01:53 -0000 Author: bschmidt Date: Sun May 8 11:01:53 2011 New Revision: 221640 URL: http://svn.freebsd.org/changeset/base/221640 Log: Disable background scan support for 4965 adapters. On legacy channels every once in a while the firmware throws a SYSASSERT on line 208. On HT channels though this does always happen and I'm not aware of any workaround currently. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun May 8 10:57:44 2011 (r221639) +++ head/sys/dev/iwn/if_iwn.c Sun May 8 11:01:53 2011 (r221640) @@ -584,12 +584,14 @@ iwn_attach(device_t dev) | IEEE80211_C_SHSLOT /* short slot time supported */ | IEEE80211_C_WPA | IEEE80211_C_SHPREAMBLE /* short preamble supported */ - | IEEE80211_C_BGSCAN /* background scanning */ #if 0 | IEEE80211_C_IBSS /* ibss/adhoc mode */ #endif | IEEE80211_C_WME /* WME */ ; + if (sc->hw_type != IWN_HW_REV_TYPE_4965) + ic->ic_caps |= IEEE80211_C_BGSCAN; /* background scanning */ + #if 0 /* HT */ /* XXX disable until HT channel setup works */ ic->ic_htcaps = From owner-svn-src-all@FreeBSD.ORG Sun May 8 11:03:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28B3F106566C; Sun, 8 May 2011 11:03:17 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B7788FC1C; Sun, 8 May 2011 11:03:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48B3G6i042827; Sun, 8 May 2011 11:03:16 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48B3G6B042825; Sun, 8 May 2011 11:03:16 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201105081103.p48B3G6B042825@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 8 May 2011 11:03:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221641 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 11:03:17 -0000 Author: bschmidt Date: Sun May 8 11:03:16 2011 New Revision: 221641 URL: http://svn.freebsd.org/changeset/base/221641 Log: Add HT capabilities to probe requests. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun May 8 11:01:53 2011 (r221640) +++ head/sys/dev/iwn/if_iwn.c Sun May 8 11:03:16 2011 (r221641) @@ -4942,6 +4942,7 @@ iwn_scan(struct iwn_softc *sc) struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; struct ieee80211_scan_state *ss = ic->ic_scan; /*XXX*/ + struct ieee80211_node *ni = ss->ss_vap->iv_bss; struct iwn_scan_hdr *hdr; struct iwn_cmd_data *tx; struct iwn_scan_essid *essid; @@ -5028,10 +5029,8 @@ iwn_scan(struct iwn_softc *sc) frm = ieee80211_add_rates(frm, rs); if (rs->rs_nrates > IEEE80211_RATE_SIZE) frm = ieee80211_add_xrates(frm, rs); -#if 0 /* HT */ - if (ic->ic_flags & IEEE80211_F_HTON) - frm = ieee80211_add_htcaps(frm, ic); -#endif + if (ic->ic_htcaps & IEEE80211_HTC_HT) + frm = ieee80211_add_htcap(frm, ni); /* Set length of probe request. */ tx->len = htole16(frm - (uint8_t *)wh); From owner-svn-src-all@FreeBSD.ORG Sun May 8 11:05:03 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A8311065679; Sun, 8 May 2011 11:05:03 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E96C8FC23; Sun, 8 May 2011 11:05:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48B53WK042930; Sun, 8 May 2011 11:05:03 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48B53qZ042928; Sun, 8 May 2011 11:05:03 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201105081105.p48B53qZ042928@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 8 May 2011 11:05:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221642 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 11:05:03 -0000 Author: bschmidt Date: Sun May 8 11:05:03 2011 New Revision: 221642 URL: http://svn.freebsd.org/changeset/base/221642 Log: Read chainmask information before announcing it. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun May 8 11:03:16 2011 (r221641) +++ head/sys/dev/iwn/if_iwn.c Sun May 8 11:05:03 2011 (r221642) @@ -550,21 +550,6 @@ iwn_attach(device_t dev) /* Clear pending interrupts. */ IWN_WRITE(sc, IWN_INT, 0xffffffff); - /* Count the number of available chains. */ - sc->ntxchains = - ((sc->txchainmask >> 2) & 1) + - ((sc->txchainmask >> 1) & 1) + - ((sc->txchainmask >> 0) & 1); - sc->nrxchains = - ((sc->rxchainmask >> 2) & 1) + - ((sc->rxchainmask >> 1) & 1) + - ((sc->rxchainmask >> 0) & 1); - if (bootverbose) { - device_printf(dev, "MIMO %dT%dR, %.4s, address %6D\n", - sc->ntxchains, sc->nrxchains, sc->eeprom_domain, - macaddr, ":"); - } - ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); if (ifp == NULL) { device_printf(dev, "can not allocate ifnet structure\n"); @@ -592,6 +577,28 @@ iwn_attach(device_t dev) if (sc->hw_type != IWN_HW_REV_TYPE_4965) ic->ic_caps |= IEEE80211_C_BGSCAN; /* background scanning */ + /* Read MAC address, channels, etc from EEPROM. */ + if ((error = iwn_read_eeprom(sc, macaddr)) != 0) { + device_printf(dev, "could not read EEPROM, error %d\n", + error); + goto fail; + } + + /* Count the number of available chains. */ + sc->ntxchains = + ((sc->txchainmask >> 2) & 1) + + ((sc->txchainmask >> 1) & 1) + + ((sc->txchainmask >> 0) & 1); + sc->nrxchains = + ((sc->rxchainmask >> 2) & 1) + + ((sc->rxchainmask >> 1) & 1) + + ((sc->rxchainmask >> 0) & 1); + if (bootverbose) { + device_printf(dev, "MIMO %dT%dR, %.4s, address %6D\n", + sc->ntxchains, sc->nrxchains, sc->eeprom_domain, + macaddr, ":"); + } + #if 0 /* HT */ /* XXX disable until HT channel setup works */ ic->ic_htcaps = @@ -623,13 +630,6 @@ iwn_attach(device_t dev) ic->ic_htcaps |= IEEE80211_HTCAP_SMPS_DIS; #endif - /* Read MAC address, channels, etc from EEPROM. */ - if ((error = iwn_read_eeprom(sc, macaddr)) != 0) { - device_printf(dev, "could not read EEPROM, error %d\n", - error); - goto fail; - } - #if 0 /* HT */ /* Set supported HT rates. */ ic->ic_sup_mcs[0] = 0xff; From owner-svn-src-all@FreeBSD.ORG Sun May 8 11:10:56 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68880106564A; Sun, 8 May 2011 11:10:56 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B8BB8FC12; Sun, 8 May 2011 11:10:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48BAuAI043165; Sun, 8 May 2011 11:10:56 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48BAuK9043163; Sun, 8 May 2011 11:10:56 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201105081110.p48BAuK9043163@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 8 May 2011 11:10:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221643 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 11:10:56 -0000 Author: pjd Date: Sun May 8 11:10:56 2011 New Revision: 221643 URL: http://svn.freebsd.org/changeset/base/221643 Log: Allow to specify remote as 'none' again which was broken by r219351, where 'none' was defined as a value for checksum. Reported by: trasz MFC after: 1 week Modified: head/sbin/hastd/parse.y Modified: head/sbin/hastd/parse.y ============================================================================== --- head/sbin/hastd/parse.y Sun May 8 11:05:03 2011 (r221642) +++ head/sbin/hastd/parse.y Sun May 8 11:10:56 2011 (r221643) @@ -289,6 +289,7 @@ yy_config_free(struct hastd_config *conf %token FULLSYNC MEMSYNC ASYNC NONE CRC32 SHA256 HOLE LZF %token NUM STR OB CB +%type remote_str %type replication_type %type checksum_type %type compression_type @@ -796,7 +797,7 @@ resource_node_entry: source_statement ; -remote_statement: REMOTE STR +remote_statement: REMOTE remote_str { assert(depth == 2); if (mynode) { @@ -813,6 +814,12 @@ remote_statement: REMOTE STR } ; +remote_str: + NONE { $$ = strdup("none"); } + | + STR { } + ; + source_statement: SOURCE STR { assert(depth == 2); From owner-svn-src-all@FreeBSD.ORG Sun May 8 11:16:18 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E1411065672; Sun, 8 May 2011 11:16:18 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4150B8FC0C; Sun, 8 May 2011 11:16:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48BGI7g043383; Sun, 8 May 2011 11:16:18 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48BGIp0043381; Sun, 8 May 2011 11:16:18 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105081116.p48BGIp0043381@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 8 May 2011 11:16:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221644 - head/sys/geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 11:16:18 -0000 Author: ae Date: Sun May 8 11:16:17 2011 New Revision: 221644 URL: http://svn.freebsd.org/changeset/base/221644 Log: Limit number of sectors that can be addressed. MFC after: 1 week Modified: head/sys/geom/part/g_part_mbr.c Modified: head/sys/geom/part/g_part_mbr.c ============================================================================== --- head/sys/geom/part/g_part_mbr.c Sun May 8 11:10:56 2011 (r221643) +++ head/sys/geom/part/g_part_mbr.c Sun May 8 11:16:17 2011 (r221644) @@ -262,7 +262,7 @@ g_part_mbr_create(struct g_part_table *b if (pp->sectorsize < MBRSIZE) return (ENOSPC); - msize = MIN(pp->mediasize / pp->sectorsize, 0xffffffff); + msize = MIN(pp->mediasize / pp->sectorsize, UINT_MAX); basetable->gpt_first = basetable->gpt_sectors; basetable->gpt_last = msize - (msize % basetable->gpt_sectors) - 1; @@ -433,7 +433,7 @@ g_part_mbr_read(struct g_part_table *bas pp = cp->provider; table = (struct g_part_mbr_table *)basetable; - msize = pp->mediasize / pp->sectorsize; + msize = MIN(pp->mediasize / pp->sectorsize, UINT_MAX); buf = g_read_data(cp, 0L, pp->sectorsize, &error); if (buf == NULL) From owner-svn-src-all@FreeBSD.ORG Sun May 8 11:20:27 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F0381065673; Sun, 8 May 2011 11:20:27 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6220B8FC15; Sun, 8 May 2011 11:20:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48BKR01043546; Sun, 8 May 2011 11:20:27 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48BKRB7043544; Sun, 8 May 2011 11:20:27 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105081120.p48BKRB7043544@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 8 May 2011 11:20:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221645 - head/sys/geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 11:20:27 -0000 Author: ae Date: Sun May 8 11:20:27 2011 New Revision: 221645 URL: http://svn.freebsd.org/changeset/base/221645 Log: Limit number of sectors that can be addressed. MFC after: 1 week Modified: head/sys/geom/part/g_part_pc98.c Modified: head/sys/geom/part/g_part_pc98.c ============================================================================== --- head/sys/geom/part/g_part_pc98.c Sun May 8 11:16:17 2011 (r221644) +++ head/sys/geom/part/g_part_pc98.c Sun May 8 11:20:27 2011 (r221645) @@ -261,7 +261,7 @@ g_part_pc98_create(struct g_part_table * cyl = basetable->gpt_heads * basetable->gpt_sectors; - msize = MIN(pp->mediasize / SECSIZE, 0xffffffff); + msize = MIN(pp->mediasize / SECSIZE, UINT_MAX); basetable->gpt_first = cyl; basetable->gpt_last = msize - (msize % cyl) - 1; @@ -451,7 +451,7 @@ g_part_pc98_read(struct g_part_table *ba pp = cp->provider; table = (struct g_part_pc98_table *)basetable; - msize = pp->mediasize / SECSIZE; + msize = MIN(pp->mediasize / SECSIZE, UINT_MAX); buf = g_read_data(cp, 0L, BOOTSIZE, &error); if (buf == NULL) From owner-svn-src-all@FreeBSD.ORG Sun May 8 11:32:20 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EF92106566C; Sun, 8 May 2011 11:32:20 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6098B8FC0A; Sun, 8 May 2011 11:32:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48BWKV2043928; Sun, 8 May 2011 11:32:20 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48BWKEk043924; Sun, 8 May 2011 11:32:20 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201105081132.p48BWKEk043924@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 8 May 2011 11:32:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221646 - in head: bin/sh tools/regression/bin/sh/builtins tools/regression/bin/sh/expansion X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 11:32:20 -0000 Author: jilles Date: Sun May 8 11:32:20 2011 New Revision: 221646 URL: http://svn.freebsd.org/changeset/base/221646 Log: sh: Add UTF-8 support to pattern matching. ?, [...] patterns match codepoints instead of bytes. They do not match invalid sequences. [...] patterns must not contain invalid sequences otherwise they will not match anything. This is so that ${var#?} removes the first codepoint, not the first byte, without putting UTF-8 knowledge into the ${var#pattern} code. However, * continues to match any string and an invalid sequence matches an identical invalid sequence. (This differs from fnmatch(3).) Added: head/tools/regression/bin/sh/builtins/case5.0 (contents, props changed) head/tools/regression/bin/sh/expansion/trim8.0 (contents, props changed) Modified: head/bin/sh/expand.c Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Sun May 8 11:20:27 2011 (r221645) +++ head/bin/sh/expand.c Sun May 8 11:32:20 2011 (r221646) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* * Routines to expand arguments to commands. We have to deal with @@ -111,16 +112,16 @@ static void addfname(char *); static struct strlist *expsort(struct strlist *); static struct strlist *msort(struct strlist *, int); static char *cvtnum(int, char *); -static int collate_range_cmp(int, int); +static int collate_range_cmp(wchar_t, wchar_t); static int -collate_range_cmp(int c1, int c2) +collate_range_cmp(wchar_t c1, wchar_t c2) { - static char s1[2], s2[2]; + static wchar_t s1[2], s2[2]; s1[0] = c1; s2[0] = c2; - return (strcoll(s1, s2)); + return (wcscoll(s1, s2)); } /* @@ -1377,6 +1378,23 @@ msort(struct strlist *list, int len) +static wchar_t +get_wc(const char **p) +{ + wchar_t c; + int chrlen; + + chrlen = mbtowc(&c, *p, 4); + if (chrlen == 0) + return 0; + else if (chrlen == -1) + c = 0; + else + *p += chrlen; + return c; +} + + /* * Returns true if the pattern matches the string. */ @@ -1386,6 +1404,7 @@ patmatch(const char *pattern, const char { const char *p, *q; char c; + wchar_t wc, wc2; p = pattern; q = string; @@ -1404,7 +1423,11 @@ patmatch(const char *pattern, const char case '?': if (squoted && *q == CTLESC) q++; - if (*q++ == '\0') + if (localeisutf8) + wc = get_wc(&q); + else + wc = *q++; + if (wc == '\0') return 0; break; case '*': @@ -1434,7 +1457,7 @@ patmatch(const char *pattern, const char case '[': { const char *endp; int invert, found; - char chr; + wchar_t chr; endp = p; if (*endp == '!' || *endp == '^') @@ -1455,8 +1478,11 @@ patmatch(const char *pattern, const char p++; } found = 0; - chr = *q++; - if (squoted && chr == CTLESC) + if (squoted && *q == CTLESC) + q++; + if (localeisutf8) + chr = get_wc(&q); + else chr = *q++; if (chr == '\0') return 0; @@ -1466,19 +1492,31 @@ patmatch(const char *pattern, const char continue; if (c == CTLESC) c = *p++; + if (localeisutf8 && c & 0x80) { + p--; + wc = get_wc(&p); + if (wc == 0) /* bad utf-8 */ + return 0; + } else + wc = c; if (*p == '-' && p[1] != ']') { p++; while (*p == CTLQUOTEMARK) p++; if (*p == CTLESC) p++; - if ( collate_range_cmp(chr, c) >= 0 - && collate_range_cmp(chr, *p) <= 0 + if (localeisutf8) { + wc2 = get_wc(&p); + if (wc2 == 0) /* bad utf-8 */ + return 0; + } else + wc2 = *p++; + if ( collate_range_cmp(chr, wc) >= 0 + && collate_range_cmp(chr, wc2) <= 0 ) found = 1; - p++; } else { - if (chr == c) + if (chr == wc) found = 1; } } while ((c = *p++) != ']'); Added: head/tools/regression/bin/sh/builtins/case5.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/case5.0 Sun May 8 11:32:20 2011 (r221646) @@ -0,0 +1,57 @@ +# $FreeBSD$ + +unset LC_ALL +LC_CTYPE=en_US.UTF-8 +export LC_CTYPE + +c1=e +# a umlaut +c2=$(printf '\303\244') +# euro sign +c3=$(printf '\342\202\254') +# some sort of 't' outside BMP +c4=$(printf '\360\235\225\245') + +ok=0 +case $c1$c2$c3$c4 in +*) ok=1 ;; +esac +if [ $ok = 0 ]; then + echo wrong at $LINENO + exit 3 +fi + +case $c1$c2$c3$c4 in +$c1$c2$c3$c4) ;; +*) echo wrong at $LINENO ;; +esac + +case $c1$c2$c3$c4 in +"$c1$c2$c3$c4") ;; +*) echo wrong at $LINENO ;; +esac + +case $c1$c2$c3$c4 in +????) ;; +*) echo wrong at $LINENO ;; +esac + +case $c1.$c2.$c3.$c4 in +?.?.?.?) ;; +*) echo wrong at $LINENO ;; +esac + +case $c1$c2$c3$c4 in +[!a][!b][!c][!d]) ;; +*) echo wrong at $LINENO ;; +esac + +case $c1$c2$c3$c4 in +[$c1][$c2][$c3][$c4]) ;; +*) echo wrong at $LINENO ;; +esac + +case $c1$c2$c3$c4 in +["$c1"]["$c2"]["$c3"]["$c4"]) ;; +*) echo wrong at $LINENO ;; +esac Added: head/tools/regression/bin/sh/expansion/trim8.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/trim8.0 Sun May 8 11:32:20 2011 (r221646) @@ -0,0 +1,75 @@ +# $FreeBSD$ + +unset LC_ALL +LC_CTYPE=en_US.UTF-8 +export LC_CTYPE + +c1=e +# a umlaut +c2=$(printf '\303\244') +# euro sign +c3=$(printf '\342\202\254') +# some sort of 't' outside BMP +c4=$(printf '\360\235\225\245') + +s=$c1$c2$c3$c4 + +testcase() { + code="$1" + expected="$2" + oIFS="$IFS" + eval "$code" + IFS='|' + result="$#|$*" + IFS="$oIFS" + if [ "x$result" = "x$expected" ]; then + ok=x$ok + else + failures=x$failures + echo "For $code, expected $expected actual $result" + fi +} + +testcase 'set -- "$s"' "1|$s" +testcase 'set -- "${s#$c2}"' "1|$s" +testcase 'set -- "${s#*}"' "1|$s" +testcase 'set -- "${s#$c1}"' "1|$c2$c3$c4" +testcase 'set -- "${s#$c1$c2}"' "1|$c3$c4" +testcase 'set -- "${s#$c1$c2$c3}"' "1|$c4" +testcase 'set -- "${s#$c1$c2$c3$c4}"' "1|" +testcase 'set -- "${s#?}"' "1|$c2$c3$c4" +testcase 'set -- "${s#??}"' "1|$c3$c4" +testcase 'set -- "${s#???}"' "1|$c4" +testcase 'set -- "${s#????}"' "1|" +testcase 'set -- "${s#*$c3}"' "1|$c4" +testcase 'set -- "${s%$c4}"' "1|$c1$c2$c3" +testcase 'set -- "${s%$c3$c4}"' "1|$c1$c2" +testcase 'set -- "${s%$c2$c3$c4}"' "1|$c1" +testcase 'set -- "${s%$c1$c2$c3$c4}"' "1|" +testcase 'set -- "${s%?}"' "1|$c1$c2$c3" +testcase 'set -- "${s%??}"' "1|$c1$c2" +testcase 'set -- "${s%???}"' "1|$c1" +testcase 'set -- "${s%????}"' "1|" +testcase 'set -- "${s%$c2*}"' "1|$c1" +testcase 'set -- "${s##$c2}"' "1|$s" +testcase 'set -- "${s##*}"' "1|" +testcase 'set -- "${s##$c1}"' "1|$c2$c3$c4" +testcase 'set -- "${s##$c1$c2}"' "1|$c3$c4" +testcase 'set -- "${s##$c1$c2$c3}"' "1|$c4" +testcase 'set -- "${s##$c1$c2$c3$c4}"' "1|" +testcase 'set -- "${s##?}"' "1|$c2$c3$c4" +testcase 'set -- "${s##??}"' "1|$c3$c4" +testcase 'set -- "${s##???}"' "1|$c4" +testcase 'set -- "${s##????}"' "1|" +testcase 'set -- "${s##*$c3}"' "1|$c4" +testcase 'set -- "${s%%$c4}"' "1|$c1$c2$c3" +testcase 'set -- "${s%%$c3$c4}"' "1|$c1$c2" +testcase 'set -- "${s%%$c2$c3$c4}"' "1|$c1" +testcase 'set -- "${s%%$c1$c2$c3$c4}"' "1|" +testcase 'set -- "${s%%?}"' "1|$c1$c2$c3" +testcase 'set -- "${s%%??}"' "1|$c1$c2" +testcase 'set -- "${s%%???}"' "1|$c1" +testcase 'set -- "${s%%????}"' "1|" +testcase 'set -- "${s%%$c2*}"' "1|$c1" + +test "x$failures" = x From owner-svn-src-all@FreeBSD.ORG Sun May 8 11:34:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06F71106566C; Sun, 8 May 2011 11:34:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 6E8AF8FC08; Sun, 8 May 2011 11:34:58 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p48BYpkX058461 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 8 May 2011 14:34:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p48BYpB9068470; Sun, 8 May 2011 14:34:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p48BYpPO068469; Sun, 8 May 2011 14:34:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 8 May 2011 14:34:51 +0300 From: Kostik Belousov To: "Andrey V. Elsukov" Message-ID: <20110508113451.GY48734@deviant.kiev.zoral.com.ua> References: <201105081120.p48BKRB7043544@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xfLSUI6RYrtWMjtK" Content-Disposition: inline In-Reply-To: <201105081120.p48BKRB7043544@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221645 - head/sys/geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 11:34:59 -0000 --xfLSUI6RYrtWMjtK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, May 08, 2011 at 11:20:27AM +0000, Andrey V. Elsukov wrote: > Author: ae > Date: Sun May 8 11:20:27 2011 > New Revision: 221645 > URL: http://svn.freebsd.org/changeset/base/221645 >=20 > Log: > Limit number of sectors that can be addressed. > =20 > MFC after: 1 week >=20 > Modified: > head/sys/geom/part/g_part_pc98.c >=20 > Modified: head/sys/geom/part/g_part_pc98.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/geom/part/g_part_pc98.c Sun May 8 11:16:17 2011 (r221644) > +++ head/sys/geom/part/g_part_pc98.c Sun May 8 11:20:27 2011 (r221645) > @@ -261,7 +261,7 @@ g_part_pc98_create(struct g_part_table * > =20 > cyl =3D basetable->gpt_heads * basetable->gpt_sectors; > =20 > - msize =3D MIN(pp->mediasize / SECSIZE, 0xffffffff); > + msize =3D MIN(pp->mediasize / SECSIZE, UINT_MAX); Shouldn't this be UINT32_MAX (consistently) ? --xfLSUI6RYrtWMjtK Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk3Gf9sACgkQC3+MBN1Mb4hnBgCfUhhIp0+nLXWtYSyWTAIOGstW eJgAoNgNiGhzr/h/ve1gIzE0FZadzrg1 =H1z7 -----END PGP SIGNATURE----- --xfLSUI6RYrtWMjtK-- From owner-svn-src-all@FreeBSD.ORG Sun May 8 11:42:51 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96FD3106566C; Sun, 8 May 2011 11:42:51 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 701F88FC14; Sun, 8 May 2011 11:42:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48Bgp8n044266; Sun, 8 May 2011 11:42:51 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48Bgp9g044263; Sun, 8 May 2011 11:42:51 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105081142.p48Bgp9g044263@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 8 May 2011 11:42:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221647 - head/sys/geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 11:42:51 -0000 Author: ae Date: Sun May 8 11:42:51 2011 New Revision: 221647 URL: http://svn.freebsd.org/changeset/base/221647 Log: Replace UINT_MAX to UINT32_MAX. Pointed out by: kib MFC after: 1 week Modified: head/sys/geom/part/g_part_mbr.c head/sys/geom/part/g_part_pc98.c Modified: head/sys/geom/part/g_part_mbr.c ============================================================================== --- head/sys/geom/part/g_part_mbr.c Sun May 8 11:32:20 2011 (r221646) +++ head/sys/geom/part/g_part_mbr.c Sun May 8 11:42:51 2011 (r221647) @@ -262,7 +262,7 @@ g_part_mbr_create(struct g_part_table *b if (pp->sectorsize < MBRSIZE) return (ENOSPC); - msize = MIN(pp->mediasize / pp->sectorsize, UINT_MAX); + msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX); basetable->gpt_first = basetable->gpt_sectors; basetable->gpt_last = msize - (msize % basetable->gpt_sectors) - 1; @@ -433,7 +433,7 @@ g_part_mbr_read(struct g_part_table *bas pp = cp->provider; table = (struct g_part_mbr_table *)basetable; - msize = MIN(pp->mediasize / pp->sectorsize, UINT_MAX); + msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX); buf = g_read_data(cp, 0L, pp->sectorsize, &error); if (buf == NULL) Modified: head/sys/geom/part/g_part_pc98.c ============================================================================== --- head/sys/geom/part/g_part_pc98.c Sun May 8 11:32:20 2011 (r221646) +++ head/sys/geom/part/g_part_pc98.c Sun May 8 11:42:51 2011 (r221647) @@ -261,7 +261,7 @@ g_part_pc98_create(struct g_part_table * cyl = basetable->gpt_heads * basetable->gpt_sectors; - msize = MIN(pp->mediasize / SECSIZE, UINT_MAX); + msize = MIN(pp->mediasize / SECSIZE, UINT32_MAX); basetable->gpt_first = cyl; basetable->gpt_last = msize - (msize % cyl) - 1; @@ -451,7 +451,7 @@ g_part_pc98_read(struct g_part_table *ba pp = cp->provider; table = (struct g_part_pc98_table *)basetable; - msize = MIN(pp->mediasize / SECSIZE, UINT_MAX); + msize = MIN(pp->mediasize / SECSIZE, UINT32_MAX); buf = g_read_data(cp, 0L, BOOTSIZE, &error); if (buf == NULL) From owner-svn-src-all@FreeBSD.ORG Sun May 8 11:49:51 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1029A106566B; Sun, 8 May 2011 11:49:51 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 02B2A8FC0C; Sun, 8 May 2011 11:49:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48BnooB044511; Sun, 8 May 2011 11:49:50 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48BnoHC044507; Sun, 8 May 2011 11:49:50 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201105081149.p48BnoHC044507@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 8 May 2011 11:49:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221648 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 11:49:51 -0000 Author: bschmidt Date: Sun May 8 11:49:50 2011 New Revision: 221648 URL: http://svn.freebsd.org/changeset/base/221648 Log: Prepare for transmitting frames at MCS rates: - instead of calling iwn_plcp_signal() for every frame, map the expected value directly within wn->ridx - concat plcp, rflags and xrflags, there is no clean byte boundary within the flags, for example the antenna setting uses bit 6, 7 and 8 - there is still need for a custom rate to plcp mapping, as those expected by the hardware are not conform to the std Modified: head/sys/dev/iwn/if_iwn.c head/sys/dev/iwn/if_iwnreg.h head/sys/dev/iwn/if_iwnvar.h Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun May 8 11:42:51 2011 (r221647) +++ head/sys/dev/iwn/if_iwn.c Sun May 8 11:49:50 2011 (r221648) @@ -199,7 +199,6 @@ static void iwn5000_update_sched(struct #ifdef notyet static void iwn5000_reset_sched(struct iwn_softc *, int, int); #endif -static uint8_t iwn_plcp_signal(int); static int iwn_tx_data(struct iwn_softc *, struct mbuf *, struct ieee80211_node *); static int iwn_tx_data_raw(struct iwn_softc *, struct mbuf *, @@ -2094,15 +2093,48 @@ iwn_node_alloc(struct ieee80211vap *vap, return malloc(sizeof (struct iwn_node), M_80211_NODE,M_NOWAIT | M_ZERO); } +static __inline int +rate2plcp(int rate) +{ + switch (rate & 0xff) { + case 12: return 0xd; + case 18: return 0xf; + case 24: return 0x5; + case 36: return 0x7; + case 48: return 0x9; + case 72: return 0xb; + case 96: return 0x1; + case 108: return 0x3; + case 2: return 10; + case 4: return 20; + case 11: return 55; + case 22: return 110; + } + return 0; +} + static void iwn_newassoc(struct ieee80211_node *ni, int isnew) { + struct ieee80211com *ic = ni->ni_ic; + struct iwn_softc *sc = ic->ic_ifp->if_softc; struct iwn_node *wn = (void *)ni; - int ridx, i; + uint8_t txant; + int i, plcp, rate, ridx; + + /* Use the first valid TX antenna. */ + txant = IWN_LSB(sc->txchainmask); for (i = 0; i < ni->ni_rates.rs_nrates; i++) { - ridx = iwn_plcp_signal(ni->ni_rates.rs_rates[i]); - wn->ridx[i] = ridx; + rate = ni->ni_rates.rs_rates[i] & IEEE80211_RATE_VAL; + plcp = rate2plcp(rate); + ridx = ic->ic_rt->rateCodeToIndex[rate]; + + if (ridx < IWN_RIDX_OFDM6 && + IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) + plcp |= IWN_RFLAG_CCK; + plcp |= IWN_RFLAG_ANT(txant); + wn->ridx[rate] = htole32(plcp); } } @@ -3087,18 +3119,6 @@ iwn5000_reset_sched(struct iwn_softc *sc } #endif -static uint8_t -iwn_plcp_signal(int rate) { - int i; - - for (i = 0; i < IWN_RIDX_MAX + 1; i++) { - if ((rate & IEEE80211_RATE_VAL) == iwn_rates[i].rate) - return i; - } - - return 0; -} - static int iwn_tx_data(struct iwn_softc *sc, struct mbuf *m, struct ieee80211_node *ni) { @@ -3111,7 +3131,6 @@ iwn_tx_data(struct iwn_softc *sc, struct struct iwn_tx_data *data; struct iwn_tx_cmd *cmd; struct iwn_cmd_data *tx; - const struct iwn_rate *rinfo; struct ieee80211_frame *wh; struct ieee80211_key *k = NULL; struct mbuf *m1; @@ -3155,8 +3174,7 @@ iwn_tx_data(struct iwn_softc *sc, struct (void) ieee80211_ratectl_rate(ni, NULL, 0); rate = ni->ni_txrate; } - ridx = iwn_plcp_signal(rate); - rinfo = &iwn_rates[ridx]; + ridx = ic->ic_rt->rateCodeToIndex[rate]; /* Encrypt the frame if need be. */ if (wh->i_fc[1] & IEEE80211_FC1_WEP) { @@ -3175,7 +3193,7 @@ iwn_tx_data(struct iwn_softc *sc, struct struct iwn_tx_radiotap_header *tap = &sc->sc_txtap; tap->wt_flags = 0; - tap->wt_rate = rinfo->rate; + tap->wt_rate = rate; if (k != NULL) tap->wt_flags |= IEEE80211_RADIOTAP_F_WEP; @@ -3262,14 +3280,13 @@ iwn_tx_data(struct iwn_softc *sc, struct tx->rts_ntries = 60; tx->data_ntries = 15; tx->lifetime = htole32(IWN_LIFETIME_INFINITE); - tx->plcp = rinfo->plcp; - tx->rflags = rinfo->flags; + tx->rate = wn->ridx[rate]; if (tx->id == sc->broadcast_id) { /* Group or management frame. */ tx->linkq = 0; /* XXX Alternate between antenna A and B? */ txant = IWN_LSB(sc->txchainmask); - tx->rflags |= IWN_RFLAG_ANT(txant); + tx->rate |= htole32(IWN_RFLAG_ANT(txant)); } else { tx->linkq = ni->ni_rates.rs_nrates - ridx - 1; flags |= IWN_TX_LINKQ; /* enable MRR */ @@ -3364,7 +3381,6 @@ static int iwn_tx_data_raw(struct iwn_softc *sc, struct mbuf *m, struct ieee80211_node *ni, const struct ieee80211_bpf_params *params) { - const struct iwn_rate *rinfo; struct ifnet *ifp = sc->sc_ifp; struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = ifp->if_l2com; @@ -3395,13 +3411,12 @@ iwn_tx_data_raw(struct iwn_softc *sc, st /* Choose a TX rate index. */ rate = params->ibp_rate0; - if (!ieee80211_isratevalid(ic->ic_rt, rate)) { + ridx = ic->ic_rt->rateCodeToIndex[rate]; + if (ridx == (uint8_t)-1) { /* XXX fall back to mcast/mgmt rate? */ m_freem(m); return EINVAL; } - ridx = iwn_plcp_signal(rate); - rinfo = &iwn_rates[ridx]; totlen = m->m_pkthdr.len; @@ -3472,12 +3487,14 @@ iwn_tx_data_raw(struct iwn_softc *sc, st tx->rts_ntries = params->ibp_try1; tx->data_ntries = params->ibp_try0; tx->lifetime = htole32(IWN_LIFETIME_INFINITE); - tx->plcp = rinfo->plcp; - tx->rflags = rinfo->flags; + tx->rate = htole32(rate2plcp(rate)); + if (ridx < IWN_RIDX_OFDM6 && + IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) + tx->rate |= htole32(IWN_RFLAG_CCK); /* Group or management frame. */ tx->linkq = 0; txant = IWN_LSB(sc->txchainmask); - tx->rflags |= IWN_RFLAG_ANT(txant); + tx->rate |= htole32(IWN_RFLAG_ANT(txant)); /* Set physical address of "scratch area". */ tx->loaddr = htole32(IWN_LOADDR(data->scratch_paddr)); tx->hiaddr = IWN_HIADDR(data->scratch_paddr); @@ -3817,9 +3834,8 @@ iwn_set_link_quality(struct iwn_softc *s struct iwn_node *wn = (void *)ni; struct ieee80211_rateset *rs = &ni->ni_rates; struct iwn_cmd_link_quality linkq; - const struct iwn_rate *rinfo; uint8_t txant; - int i, txrate; + int i, rate, txrate; /* Use the first valid TX antenna. */ txant = IWN_LSB(sc->txchainmask); @@ -3835,10 +3851,9 @@ iwn_set_link_quality(struct iwn_softc *s /* Start at highest available bit-rate. */ txrate = rs->rs_nrates - 1; for (i = 0; i < IWN_MAX_TX_RETRIES; i++) { - rinfo = &iwn_rates[wn->ridx[txrate]]; - linkq.retry[i].plcp = rinfo->plcp; - linkq.retry[i].rflags = rinfo->flags; - linkq.retry[i].rflags |= IWN_RFLAG_ANT(txant); + rate = rs->rs_rates[txrate] & IEEE80211_RATE_VAL; + linkq.retry[i] = wn->ridx[rate]; + /* Next retry at immediate lower bit-rate. */ if (txrate > 0) txrate--; @@ -3857,7 +3872,6 @@ iwn_add_broadcast_node(struct iwn_softc struct ieee80211com *ic = ifp->if_l2com; struct iwn_node_info node; struct iwn_cmd_link_quality linkq; - const struct iwn_rate *rinfo; uint8_t txant; int i, error; @@ -3881,16 +3895,13 @@ iwn_add_broadcast_node(struct iwn_softc /* Use lowest mandatory bit-rate. */ if (IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan)) - rinfo = &iwn_rates[IWN_RIDX_OFDM6]; + linkq.retry[0] = htole32(0xd); else - rinfo = &iwn_rates[IWN_RIDX_CCK1]; - linkq.retry[0].plcp = rinfo->plcp; - linkq.retry[0].rflags = rinfo->flags; - linkq.retry[0].rflags |= IWN_RFLAG_ANT(txant); + linkq.retry[0] = htole32(10 | IWN_RFLAG_CCK); + linkq.retry[0] |= htole32(IWN_RFLAG_ANT(txant)); /* Use same bit-rate for all TX retries. */ for (i = 1; i < IWN_MAX_TX_RETRIES; i++) { - linkq.retry[i].plcp = linkq.retry[0].plcp; - linkq.retry[i].rflags = linkq.retry[0].rflags; + linkq.retry[i] = linkq.retry[0]; } return iwn_cmd(sc, IWN_CMD_LINK_QUALITY, &linkq, sizeof linkq, async); } @@ -4991,18 +5002,17 @@ iwn_scan(struct iwn_softc *sc) if (IEEE80211_IS_CHAN_A(ic->ic_curchan)) { /* Send probe requests at 6Mbps. */ - tx->plcp = iwn_rates[IWN_RIDX_OFDM6].plcp; + tx->rate = htole32(0xd); rs = &ic->ic_sup_rates[IEEE80211_MODE_11A]; } else { hdr->flags = htole32(IWN_RXON_24GHZ | IWN_RXON_AUTO); /* Send probe requests at 1Mbps. */ - tx->plcp = iwn_rates[IWN_RIDX_CCK1].plcp; - tx->rflags = IWN_RFLAG_CCK; + tx->rate = htole32(10 | IWN_RFLAG_CCK); rs = &ic->ic_sup_rates[IEEE80211_MODE_11G]; } /* Use the first valid TX antenna. */ txant = IWN_LSB(sc->txchainmask); - tx->rflags |= IWN_RFLAG_ANT(txant); + tx->rate |= htole32(IWN_RFLAG_ANT(txant)); essid = (struct iwn_scan_essid *)(tx + 1); if (ss->ss_ssid[0].len != 0) { Modified: head/sys/dev/iwn/if_iwnreg.h ============================================================================== --- head/sys/dev/iwn/if_iwnreg.h Sun May 8 11:42:51 2011 (r221647) +++ head/sys/dev/iwn/if_iwnreg.h Sun May 8 11:49:50 2011 (r221648) @@ -625,8 +625,8 @@ struct iwn4965_node_info { uint32_t reserved7; } __packed; -#define IWN_RFLAG_CCK (1 << 1) -#define IWN_RFLAG_ANT(x) ((x) << 6) +#define IWN_RFLAG_CCK (1 << 9) +#define IWN_RFLAG_ANT(x) ((x) << 14) /* Structure for command IWN_CMD_TX_DATA. */ struct iwn_cmd_data { @@ -647,9 +647,7 @@ struct iwn_cmd_data { #define IWN_TX_NEED_PADDING (1 << 20) uint32_t scratch; - uint8_t plcp; - uint8_t rflags; - uint16_t xrflags; + uint32_t rate; uint8_t id; uint8_t security; @@ -690,11 +688,7 @@ struct iwn_cmd_link_quality { uint8_t ampdu_threshold; uint8_t ampdu_max; uint32_t reserved2; - struct { - uint8_t plcp; - uint8_t rflags; - uint16_t xrflags; - } __packed retry[IWN_MAX_TX_RETRIES]; + uint32_t retry[IWN_MAX_TX_RETRIES]; uint32_t reserved3; } __packed; @@ -1065,9 +1059,7 @@ struct iwn4965_tx_stat { uint8_t btkillcnt; uint8_t rtsfailcnt; uint8_t ackfailcnt; - uint8_t rate; - uint8_t rflags; - uint16_t xrflags; + uint32_t rate; uint16_t duration; uint16_t reserved; uint32_t power[2]; @@ -1079,9 +1071,7 @@ struct iwn5000_tx_stat { uint8_t btkillcnt; uint8_t rtsfailcnt; uint8_t ackfailcnt; - uint8_t rate; - uint8_t rflags; - uint16_t xrflags; + uint32_t rate; uint16_t duration; uint16_t reserved; uint32_t power[2]; @@ -1136,9 +1126,7 @@ struct iwn_rx_stat { uint16_t chan; uint8_t phybuf[32]; - uint8_t rate; - uint8_t rflags; - uint16_t xrflags; + uint32_t rate; uint16_t len; uint16_t reserve3; } __packed; @@ -1534,26 +1522,6 @@ static const struct iwn_chan_band { #define IWN_RIDX_CCK1 0 #define IWN_RIDX_OFDM6 4 -static const struct iwn_rate { - uint8_t rate; - uint8_t plcp; - uint8_t flags; -} iwn_rates[IWN_RIDX_MAX + 1] = { - { 2, 10, IWN_RFLAG_CCK }, - { 4, 20, IWN_RFLAG_CCK }, - { 11, 55, IWN_RFLAG_CCK }, - { 22, 110, IWN_RFLAG_CCK }, - { 12, 0xd, 0 }, - { 18, 0xf, 0 }, - { 24, 0x5, 0 }, - { 36, 0x7, 0 }, - { 48, 0x9, 0 }, - { 72, 0xb, 0 }, - { 96, 0x1, 0 }, - { 108, 0x3, 0 }, - { 120, 0x3, 0 } -}; - #define IWN4965_MAX_PWR_INDEX 107 /* Modified: head/sys/dev/iwn/if_iwnvar.h ============================================================================== --- head/sys/dev/iwn/if_iwnvar.h Sun May 8 11:42:51 2011 (r221647) +++ head/sys/dev/iwn/if_iwnvar.h Sun May 8 11:49:50 2011 (r221648) @@ -101,7 +101,7 @@ struct iwn_node { struct ieee80211_node ni; /* must be the first */ uint16_t disable_tid; uint8_t id; - uint8_t ridx[IEEE80211_RATE_MAXSIZE]; + uint32_t ridx[256]; }; struct iwn_calib_state { From owner-svn-src-all@FreeBSD.ORG Sun May 8 11:54:38 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC4931065673; Sun, 8 May 2011 11:54:38 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3FD48FC0A; Sun, 8 May 2011 11:54:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48Bsc8h044693; Sun, 8 May 2011 11:54:38 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48Bsc7e044690; Sun, 8 May 2011 11:54:38 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201105081154.p48Bsc7e044690@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 8 May 2011 11:54:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221649 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 11:54:38 -0000 Author: bschmidt Date: Sun May 8 11:54:38 2011 New Revision: 221649 URL: http://svn.freebsd.org/changeset/base/221649 Log: Add support for transmitting frames at MCS rates. Modified: head/sys/dev/iwn/if_iwn.c head/sys/dev/iwn/if_iwnreg.h Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun May 8 11:49:50 2011 (r221648) +++ head/sys/dev/iwn/if_iwn.c Sun May 8 11:54:38 2011 (r221649) @@ -2119,22 +2119,47 @@ iwn_newassoc(struct ieee80211_node *ni, struct ieee80211com *ic = ni->ni_ic; struct iwn_softc *sc = ic->ic_ifp->if_softc; struct iwn_node *wn = (void *)ni; - uint8_t txant; + uint8_t txant1, txant2; int i, plcp, rate, ridx; /* Use the first valid TX antenna. */ - txant = IWN_LSB(sc->txchainmask); + txant1 = IWN_LSB(sc->txchainmask); + txant2 = IWN_LSB(sc->txchainmask & ~txant1); + + if (IEEE80211_IS_CHAN_HT(ni->ni_chan)) { + ridx = ni->ni_rates.rs_nrates - 1; + for (i = ni->ni_htrates.rs_nrates - 1; i >= 0; i--) { + plcp = ni->ni_htrates.rs_rates[i] | IWN_RFLAG_MCS; + if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) { + plcp |= IWN_RFLAG_HT40; + if (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40) + plcp |= IWN_RFLAG_SGI; + } else if (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20) + plcp |= IWN_RFLAG_SGI; + if (i > 7) + plcp |= IWN_RFLAG_ANT(txant1 | txant2); + else + plcp |= IWN_RFLAG_ANT(txant1); + if (ridx >= 0) { + rate = ni->ni_rates.rs_rates[ridx]; + rate &= IEEE80211_RATE_VAL; + wn->ridx[rate] = plcp; + } + wn->ridx[IEEE80211_RATE_MCS | i] = plcp; + ridx--; + } + } else { + for (i = 0; i < ni->ni_rates.rs_nrates; i++) { + rate = ni->ni_rates.rs_rates[i] & IEEE80211_RATE_VAL; - for (i = 0; i < ni->ni_rates.rs_nrates; i++) { - rate = ni->ni_rates.rs_rates[i] & IEEE80211_RATE_VAL; - plcp = rate2plcp(rate); - ridx = ic->ic_rt->rateCodeToIndex[rate]; - - if (ridx < IWN_RIDX_OFDM6 && - IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) - plcp |= IWN_RFLAG_CCK; - plcp |= IWN_RFLAG_ANT(txant); - wn->ridx[rate] = htole32(plcp); + plcp = rate2plcp(rate); + ridx = ic->ic_rt->rateCodeToIndex[rate]; + if (ridx < IWN_RIDX_OFDM6 && + IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) + plcp |= IWN_RFLAG_CCK; + plcp |= IWN_RFLAG_ANT(txant1); + wn->ridx[rate] = htole32(plcp); + } } } @@ -3849,11 +3874,21 @@ iwn_set_link_quality(struct iwn_softc *s linkq.ampdu_limit = htole16(4000); /* 4ms */ /* Start at highest available bit-rate. */ - txrate = rs->rs_nrates - 1; + if (IEEE80211_IS_CHAN_HT(ni->ni_chan)) + txrate = ni->ni_htrates.rs_nrates - 1; + else + txrate = rs->rs_nrates - 1; for (i = 0; i < IWN_MAX_TX_RETRIES; i++) { - rate = rs->rs_rates[txrate] & IEEE80211_RATE_VAL; + if (IEEE80211_IS_CHAN_HT(ni->ni_chan)) + rate = IEEE80211_RATE_MCS | txrate; + else + rate = rs->rs_rates[txrate] & IEEE80211_RATE_VAL; linkq.retry[i] = wn->ridx[rate]; + if ((le32toh(wn->ridx[rate]) & IWN_RFLAG_MCS) && + (le32toh(wn->ridx[rate]) & 0xff) > 7) + linkq.mimo = i + 1; + /* Next retry at immediate lower bit-rate. */ if (txrate > 0) txrate--; Modified: head/sys/dev/iwn/if_iwnreg.h ============================================================================== --- head/sys/dev/iwn/if_iwnreg.h Sun May 8 11:49:50 2011 (r221648) +++ head/sys/dev/iwn/if_iwnreg.h Sun May 8 11:54:38 2011 (r221649) @@ -625,7 +625,12 @@ struct iwn4965_node_info { uint32_t reserved7; } __packed; +#define IWN_RFLAG_MCS (1 << 8) #define IWN_RFLAG_CCK (1 << 9) +#define IWN_RFLAG_GREENFIELD (1 << 10) +#define IWN_RFLAG_HT40 (1 << 11) +#define IWN_RFLAG_DUPLICATE (1 << 12) +#define IWN_RFLAG_SGI (1 << 13) #define IWN_RFLAG_ANT(x) ((x) << 14) /* Structure for command IWN_CMD_TX_DATA. */ From owner-svn-src-all@FreeBSD.ORG Sun May 8 11:58:23 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9BE2106564A; Sun, 8 May 2011 11:58:23 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC8C68FC08; Sun, 8 May 2011 11:58:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48BwNx1044855; Sun, 8 May 2011 11:58:23 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48BwNdC044852; Sun, 8 May 2011 11:58:23 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201105081158.p48BwNdC044852@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 8 May 2011 11:58:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221650 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 11:58:23 -0000 Author: bschmidt Date: Sun May 8 11:58:23 2011 New Revision: 221650 URL: http://svn.freebsd.org/changeset/base/221650 Log: Add support for RX packet aggregation. Modified: head/sys/dev/iwn/if_iwn.c head/sys/dev/iwn/if_iwnvar.h Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun May 8 11:54:38 2011 (r221649) +++ head/sys/dev/iwn/if_iwn.c Sun May 8 11:58:23 2011 (r221650) @@ -251,11 +251,11 @@ static uint8_t *ieee80211_add_ssid(uint8 static int iwn_scan(struct iwn_softc *); static int iwn_auth(struct iwn_softc *, struct ieee80211vap *vap); static int iwn_run(struct iwn_softc *, struct ieee80211vap *vap); +static int iwn_ampdu_rx_start(struct ieee80211_node *, + struct ieee80211_rx_ampdu *, int, int, int); +static void iwn_ampdu_rx_stop(struct ieee80211_node *, + struct ieee80211_rx_ampdu *); #if 0 /* HT */ -static int iwn_ampdu_rx_start(struct ieee80211com *, - struct ieee80211_node *, uint8_t); -static void iwn_ampdu_rx_stop(struct ieee80211com *, - struct ieee80211_node *, uint8_t); static int iwn_ampdu_tx_start(struct ieee80211com *, struct ieee80211_node *, uint8_t); static void iwn_ampdu_tx_stop(struct ieee80211com *, @@ -653,9 +653,11 @@ iwn_attach(device_t dev) ic->ic_vap_delete = iwn_vap_delete; ic->ic_raw_xmit = iwn_raw_xmit; ic->ic_node_alloc = iwn_node_alloc; -#if 0 /* HT */ + sc->sc_ampdu_rx_start = ic->ic_ampdu_rx_start; ic->ic_ampdu_rx_start = iwn_ampdu_rx_start; + sc->sc_ampdu_rx_stop = ic->ic_ampdu_rx_stop; ic->ic_ampdu_rx_stop = iwn_ampdu_rx_stop; +#if 0 /* HT */ ic->ic_ampdu_tx_start = iwn_ampdu_tx_start; ic->ic_ampdu_tx_stop = iwn_ampdu_tx_stop; #endif @@ -2434,6 +2436,8 @@ iwn_rx_done(struct iwn_softc *sc, struct /* Send the frame to the 802.11 layer. */ if (ni != NULL) { + if (ni->ni_flags & IEEE80211_NODE_HT) + m->m_flags |= M_AMPDU; (void)ieee80211_input(ni, m, rssi - nf, nf); /* Node is no longer needed. */ ieee80211_free_node(ni); @@ -3765,7 +3769,8 @@ iwn_cmd(struct iwn_softc *sc, int code, bus_addr_t paddr; int totlen, error; - IWN_LOCK_ASSERT(sc); + if (async == 0) + IWN_LOCK_ASSERT(sc); desc = &ring->desc[ring->cur]; data = &ring->data[ring->cur]; @@ -5321,30 +5326,39 @@ iwn_run(struct iwn_softc *sc, struct iee #undef MS } -#if 0 /* HT */ /* * This function is called by upper layer when an ADDBA request is received * from another STA and before the ADDBA response is sent. */ static int -iwn_ampdu_rx_start(struct ieee80211com *ic, struct ieee80211_node *ni, - uint8_t tid) +iwn_ampdu_rx_start(struct ieee80211_node *ni, struct ieee80211_rx_ampdu *rap, + int baparamset, int batimeout, int baseqctl) { - struct ieee80211_rx_ba *ba = &ni->ni_rx_ba[tid]; - struct iwn_softc *sc = ic->ic_softc; +#define MS(_v, _f) (((_v) & _f) >> _f##_S) + struct iwn_softc *sc = ni->ni_ic->ic_ifp->if_softc; struct iwn_ops *ops = &sc->ops; struct iwn_node *wn = (void *)ni; struct iwn_node_info node; + uint16_t ssn; + uint8_t tid; + int error; + + tid = MS(le16toh(baparamset), IEEE80211_BAPS_TID); + ssn = MS(le16toh(baseqctl), IEEE80211_BASEQ_START); memset(&node, 0, sizeof node); node.id = wn->id; node.control = IWN_NODE_UPDATE; node.flags = IWN_FLAG_SET_ADDBA; node.addba_tid = tid; - node.addba_ssn = htole16(ba->ba_winstart); + node.addba_ssn = htole16(ssn); DPRINTF(sc, IWN_DEBUG_RECV, "ADDBA RA=%d TID=%d SSN=%d\n", - wn->id, tid, ba->ba_winstart); - return ops->add_node(sc, &node, 1); + wn->id, tid, ssn); + error = ops->add_node(sc, &node, 1); + if (error != 0) + return error; + return sc->sc_ampdu_rx_start(ni, rap, baparamset, batimeout, baseqctl); +#undef MS } /* @@ -5352,13 +5366,20 @@ iwn_ampdu_rx_start(struct ieee80211com * * Block Ack agreement (eg. uppon receipt of a DELBA frame). */ static void -iwn_ampdu_rx_stop(struct ieee80211com *ic, struct ieee80211_node *ni, - uint8_t tid) +iwn_ampdu_rx_stop(struct ieee80211_node *ni, struct ieee80211_rx_ampdu *rap) { - struct iwn_softc *sc = ic->ic_softc; + struct ieee80211com *ic = ni->ni_ic; + struct iwn_softc *sc = ic->ic_ifp->if_softc; struct iwn_ops *ops = &sc->ops; struct iwn_node *wn = (void *)ni; struct iwn_node_info node; + uint8_t tid; + + /* XXX: tid as an argument */ + for (tid = 0; tid < WME_NUM_TID; tid++) { + if (&ni->ni_rx_ampdu[tid] == rap) + break; + } memset(&node, 0, sizeof node); node.id = wn->id; @@ -5367,8 +5388,10 @@ iwn_ampdu_rx_stop(struct ieee80211com *i node.delba_tid = tid; DPRINTF(sc, IWN_DEBUG_RECV, "DELBA RA=%d TID=%d\n", wn->id, tid); (void)ops->add_node(sc, &node, 1); + sc->sc_ampdu_rx_stop(ni, rap); } +#if 0 /* HT */ /* * This function is called by upper layer when an ADDBA response is received * from another STA. Modified: head/sys/dev/iwn/if_iwnvar.h ============================================================================== --- head/sys/dev/iwn/if_iwnvar.h Sun May 8 11:54:38 2011 (r221649) +++ head/sys/dev/iwn/if_iwnvar.h Sun May 8 11:58:23 2011 (r221650) @@ -306,6 +306,11 @@ struct iwn_softc { int sc_tx_timer; + int (*sc_ampdu_rx_start)(struct ieee80211_node *, + struct ieee80211_rx_ampdu *, int, int, int); + void (*sc_ampdu_rx_stop)(struct ieee80211_node *, + struct ieee80211_rx_ampdu *); + struct iwn_rx_radiotap_header sc_rxtap; struct iwn_tx_radiotap_header sc_txtap; }; From owner-svn-src-all@FreeBSD.ORG Sun May 8 12:06:13 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 049A91065744; Sun, 8 May 2011 12:06:13 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EAEA68FC1A; Sun, 8 May 2011 12:06:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48C6CBO045135; Sun, 8 May 2011 12:06:12 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48C6CnJ045131; Sun, 8 May 2011 12:06:12 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201105081206.p48C6CnJ045131@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 8 May 2011 12:06:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221651 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 12:06:13 -0000 Author: bschmidt Date: Sun May 8 12:06:12 2011 New Revision: 221651 URL: http://svn.freebsd.org/changeset/base/221651 Log: Add support for TX packet aggregation. Modified: head/sys/dev/iwn/if_iwn.c head/sys/dev/iwn/if_iwnreg.h head/sys/dev/iwn/if_iwnvar.h Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun May 8 11:58:23 2011 (r221650) +++ head/sys/dev/iwn/if_iwn.c Sun May 8 12:06:12 2011 (r221651) @@ -172,10 +172,8 @@ static void iwn_rx_phy(struct iwn_softc struct iwn_rx_data *); static void iwn_rx_done(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); -#if 0 /* HT */ static void iwn_rx_compressed_ba(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); -#endif static void iwn5000_rx_calib_results(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); static void iwn_rx_statistics(struct iwn_softc *, struct iwn_rx_desc *, @@ -186,6 +184,7 @@ static void iwn5000_tx_done(struct iwn_s struct iwn_rx_data *); static void iwn_tx_done(struct iwn_softc *, struct iwn_rx_desc *, int, uint8_t); +static void iwn_ampdu_tx_done(struct iwn_softc *, int, int, int, void *); static void iwn_cmd_done(struct iwn_softc *, struct iwn_rx_desc *); static void iwn_notif_intr(struct iwn_softc *); static void iwn_wakeup_intr(struct iwn_softc *); @@ -255,20 +254,22 @@ static int iwn_ampdu_rx_start(struct iee struct ieee80211_rx_ampdu *, int, int, int); static void iwn_ampdu_rx_stop(struct ieee80211_node *, struct ieee80211_rx_ampdu *); -#if 0 /* HT */ +static int iwn_addba_request(struct ieee80211_node *, + struct ieee80211_tx_ampdu *, int, int, int); +static int iwn_addba_response(struct ieee80211_node *, + struct ieee80211_tx_ampdu *, int, int, int); static int iwn_ampdu_tx_start(struct ieee80211com *, struct ieee80211_node *, uint8_t); -static void iwn_ampdu_tx_stop(struct ieee80211com *, - struct ieee80211_node *, uint8_t); +static void iwn_ampdu_tx_stop(struct ieee80211_node *, + struct ieee80211_tx_ampdu *); static void iwn4965_ampdu_tx_start(struct iwn_softc *, - struct ieee80211_node *, uint8_t, uint16_t); -static void iwn4965_ampdu_tx_stop(struct iwn_softc *, + struct ieee80211_node *, int, uint8_t, uint16_t); +static void iwn4965_ampdu_tx_stop(struct iwn_softc *, int, uint8_t, uint16_t); static void iwn5000_ampdu_tx_start(struct iwn_softc *, - struct ieee80211_node *, uint8_t, uint16_t); -static void iwn5000_ampdu_tx_stop(struct iwn_softc *, + struct ieee80211_node *, int, uint8_t, uint16_t); +static void iwn5000_ampdu_tx_stop(struct iwn_softc *, int, uint8_t, uint16_t); -#endif static int iwn5000_query_calibration(struct iwn_softc *); static int iwn5000_send_calibration(struct iwn_softc *); static int iwn5000_send_wimax_coex(struct iwn_softc *); @@ -657,10 +658,12 @@ iwn_attach(device_t dev) ic->ic_ampdu_rx_start = iwn_ampdu_rx_start; sc->sc_ampdu_rx_stop = ic->ic_ampdu_rx_stop; ic->ic_ampdu_rx_stop = iwn_ampdu_rx_stop; -#if 0 /* HT */ - ic->ic_ampdu_tx_start = iwn_ampdu_tx_start; - ic->ic_ampdu_tx_stop = iwn_ampdu_tx_stop; -#endif + sc->sc_addba_request = ic->ic_addba_request; + ic->ic_addba_request = iwn_addba_request; + sc->sc_addba_response = ic->ic_addba_response; + ic->ic_addba_response = iwn_addba_response; + sc->sc_addba_stop = ic->ic_addba_stop; + ic->ic_addba_stop = iwn_ampdu_tx_stop; ic->ic_newassoc = iwn_newassoc; ic->ic_wme.wme_update = iwn_updateedca; ic->ic_update_mcast = iwn_update_mcast; @@ -717,11 +720,10 @@ iwn4965_attach(struct iwn_softc *sc, uin ops->set_gains = iwn4965_set_gains; ops->add_node = iwn4965_add_node; ops->tx_done = iwn4965_tx_done; -#if 0 /* HT */ ops->ampdu_tx_start = iwn4965_ampdu_tx_start; ops->ampdu_tx_stop = iwn4965_ampdu_tx_stop; -#endif sc->ntxqs = IWN4965_NTXQUEUES; + sc->firstaggqueue = IWN4965_FIRSTAGGQUEUE; sc->ndmachnls = IWN4965_NDMACHNLS; sc->broadcast_id = IWN4965_ID_BROADCAST; sc->rxonsz = IWN4965_RXONSZ; @@ -756,11 +758,10 @@ iwn5000_attach(struct iwn_softc *sc, uin ops->set_gains = iwn5000_set_gains; ops->add_node = iwn5000_add_node; ops->tx_done = iwn5000_tx_done; -#if 0 /* HT */ ops->ampdu_tx_start = iwn5000_ampdu_tx_start; ops->ampdu_tx_stop = iwn5000_ampdu_tx_stop; -#endif sc->ntxqs = IWN5000_NTXQUEUES; + sc->firstaggqueue = IWN5000_FIRSTAGGQUEUE; sc->ndmachnls = IWN5000_NDMACHNLS; sc->broadcast_id = IWN5000_ID_BROADCAST; sc->rxonsz = IWN5000_RXONSZ; @@ -2447,21 +2448,53 @@ iwn_rx_done(struct iwn_softc *sc, struct IWN_LOCK(sc); } -#if 0 /* HT */ /* Process an incoming Compressed BlockAck. */ static void iwn_rx_compressed_ba(struct iwn_softc *sc, struct iwn_rx_desc *desc, struct iwn_rx_data *data) { + struct ifnet *ifp = sc->sc_ifp; + struct iwn_node *wn; + struct ieee80211_node *ni; struct iwn_compressed_ba *ba = (struct iwn_compressed_ba *)(desc + 1); struct iwn_tx_ring *txq; + struct ieee80211_tx_ampdu *tap; + uint64_t bitmap; + uint8_t tid; + int ackfailcnt = 0, i, shift; bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD); - txq = &sc->txq[letoh16(ba->qid)]; - /* XXX TBD */ + txq = &sc->txq[le16toh(ba->qid)]; + tap = sc->qid2tap[le16toh(ba->qid)]; + tid = WME_AC_TO_TID(tap->txa_ac); + ni = tap->txa_ni; + wn = (void *)ni; + + if (wn->agg[tid].bitmap == 0) + return; + + shift = wn->agg[tid].startidx - ((le16toh(ba->seq) >> 4) & 0xff); + if (shift < 0) + shift += 0x100; + + if (wn->agg[tid].nframes > (64 - shift)) + return; + + bitmap = (le64toh(ba->bitmap) >> shift) & wn->agg[tid].bitmap; + for (i = 0; bitmap; i++) { + if ((bitmap & 1) == 0) { + ifp->if_oerrors++; + ieee80211_ratectl_tx_complete(ni->ni_vap, ni, + IEEE80211_RATECTL_TX_FAILURE, &ackfailcnt, NULL); + } else { + ifp->if_opackets++; + ieee80211_ratectl_tx_complete(ni->ni_vap, ni, + IEEE80211_RATECTL_TX_SUCCESS, &ackfailcnt, NULL); + } + bitmap >>= 1; + } } -#endif /* * Process a CALIBRATION_RESULT notification sent by the initialization @@ -2590,7 +2623,11 @@ iwn4965_tx_done(struct iwn_softc *sc, st struct iwn_rx_data *data) { struct iwn4965_tx_stat *stat = (struct iwn4965_tx_stat *)(desc + 1); - struct iwn_tx_ring *ring = &sc->txq[desc->qid & 0xf]; + struct iwn_tx_ring *ring; + int qid; + + qid = desc->qid & 0xf; + ring = &sc->txq[qid]; DPRINTF(sc, IWN_DEBUG_XMIT, "%s: " "qid %d idx %d retries %d nkill %d rate %x duration %d status %x\n", @@ -2599,7 +2636,13 @@ iwn4965_tx_done(struct iwn_softc *sc, st le32toh(stat->status)); bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTREAD); - iwn_tx_done(sc, desc, stat->ackfailcnt, le32toh(stat->status) & 0xff); + if (qid >= sc->firstaggqueue) { + iwn_ampdu_tx_done(sc, qid, desc->idx, stat->nframes, + &stat->status); + } else { + iwn_tx_done(sc, desc, stat->ackfailcnt, + le32toh(stat->status) & 0xff); + } } static void @@ -2607,7 +2650,11 @@ iwn5000_tx_done(struct iwn_softc *sc, st struct iwn_rx_data *data) { struct iwn5000_tx_stat *stat = (struct iwn5000_tx_stat *)(desc + 1); - struct iwn_tx_ring *ring = &sc->txq[desc->qid & 0xf]; + struct iwn_tx_ring *ring; + int qid; + + qid = desc->qid & 0xf; + ring = &sc->txq[qid]; DPRINTF(sc, IWN_DEBUG_XMIT, "%s: " "qid %d idx %d retries %d nkill %d rate %x duration %d status %x\n", @@ -2621,7 +2668,13 @@ iwn5000_tx_done(struct iwn_softc *sc, st #endif bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTREAD); - iwn_tx_done(sc, desc, stat->ackfailcnt, le16toh(stat->status) & 0xff); + if (qid >= sc->firstaggqueue) { + iwn_ampdu_tx_done(sc, qid, desc->idx, stat->nframes, + &stat->status); + } else { + iwn_tx_done(sc, desc, stat->ackfailcnt, + le16toh(stat->status) & 0xff); + } } /* @@ -2722,6 +2775,96 @@ iwn_cmd_done(struct iwn_softc *sc, struc wakeup(&ring->desc[desc->idx]); } +static void +iwn_ampdu_tx_done(struct iwn_softc *sc, int qid, int idx, int nframes, + void *stat) +{ + struct ifnet *ifp = sc->sc_ifp; + struct iwn_tx_ring *ring = &sc->txq[qid]; + struct iwn_tx_data *data; + struct mbuf *m; + struct iwn_node *wn; + struct ieee80211_node *ni; + struct ieee80211vap *vap; + struct ieee80211_tx_ampdu *tap; + uint64_t bitmap; + uint32_t *status = stat; + uint16_t *aggstatus = stat; + uint8_t tid; + int bit, i, lastidx, seqno, shift, start; + +#ifdef NOT_YET + if (nframes == 1) { + if ((*status & 0xff) != 1 && (*status & 0xff) != 2) + printf("ieee80211_send_bar()\n"); + } +#endif + + bitmap = 0; + start = idx; + for (i = 0; i < nframes; i++) { + if (le16toh(aggstatus[i * 2]) & 0xc) + continue; + + idx = le16toh(aggstatus[2*i + 1]) & 0xff; + bit = idx - start; + shift = 0; + if (bit >= 64) { + shift = 0x100 - idx + start; + bit = 0; + start = idx; + } else if (bit <= -64) + bit = 0x100 - start + idx; + else if (bit < 0) { + shift = start - idx; + start = idx; + bit = 0; + } + bitmap = bitmap << shift; + bitmap |= 1ULL << bit; + } + tap = sc->qid2tap[qid]; + tid = WME_AC_TO_TID(tap->txa_ac); + wn = (void *)tap->txa_ni; + wn->agg[tid].bitmap = bitmap; + wn->agg[tid].startidx = start; + wn->agg[tid].nframes = nframes; + + seqno = le32toh(*(status + nframes)) & 0xfff; + for (lastidx = (seqno & 0xff); ring->read != lastidx;) { + data = &ring->data[ring->read]; + + KASSERT(data->ni != NULL, ("no node")); + + /* Unmap and free mbuf. */ + bus_dmamap_sync(ring->data_dmat, data->map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(ring->data_dmat, data->map); + m = data->m, data->m = NULL; + ni = data->ni, data->ni = NULL; + vap = ni->ni_vap; + + if (m->m_flags & M_TXCB) + ieee80211_process_callback(ni, m, 1); + + m_freem(m); + ieee80211_free_node(ni); + + ring->queued--; + ring->read = (ring->read + 1) % IWN_TX_RING_COUNT; + } + + sc->sc_tx_timer = 0; + if (ring->queued < IWN_TX_RING_LOMARK) { + sc->qfullmsk &= ~(1 << ring->qid); + if (sc->qfullmsk == 0 && + (ifp->if_drv_flags & IFF_DRV_OACTIVE)) { + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + iwn_start_locked(ifp); + } + } +} + /* * Process an INT_FH_RX or INT_SW_RX interrupt. */ @@ -2766,12 +2909,10 @@ iwn_notif_intr(struct iwn_softc *sc) iwn_rx_done(sc, desc, data); break; -#if 0 /* HT */ case IWN_RX_COMPRESSED_BA: /* A Compressed BlockAck has been received. */ iwn_rx_compressed_ba(sc, desc, data); break; -#endif case IWN_TX_DONE: /* An 802.11 frame has been transmitted. */ @@ -3151,6 +3292,7 @@ iwn5000_reset_sched(struct iwn_softc *sc static int iwn_tx_data(struct iwn_softc *sc, struct mbuf *m, struct ieee80211_node *ni) { + struct iwn_ops *ops = &sc->ops; const struct ieee80211_txparam *tp; struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = ni->ni_ic; @@ -3186,7 +3328,16 @@ iwn_tx_data(struct iwn_softc *sc, struct } ac = M_WME_GETAC(m); - ring = &sc->txq[ac]; + if (IEEE80211_AMPDU_RUNNING(&ni->ni_tx_ampdu[ac])) { + struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[ac]; + + ring = &sc->txq[*(int *)tap->txa_private]; + *(uint16_t *)wh->i_seq = + htole16(ni->ni_txseqs[tid] << IEEE80211_SEQ_SEQ_SHIFT); + ni->ni_txseqs[tid]++; + } else { + ring = &sc->txq[ac]; + } desc = &ring->desc[ring->cur]; data = &ring->data[ring->cur]; @@ -3390,10 +3541,8 @@ iwn_tx_data(struct iwn_softc *sc, struct bus_dmamap_sync(ring->desc_dma.tag, ring->desc_dma.map, BUS_DMASYNC_PREWRITE); -#ifdef notyet /* Update TX scheduler. */ ops->update_sched(sc, ring->qid, ring->cur, tx->id, totlen); -#endif /* Kick TX ring. */ ring->cur = (ring->cur + 1) % IWN_TX_RING_COUNT; @@ -3410,6 +3559,7 @@ static int iwn_tx_data_raw(struct iwn_softc *sc, struct mbuf *m, struct ieee80211_node *ni, const struct ieee80211_bpf_params *params) { + struct iwn_ops *ops = &sc->ops; struct ifnet *ifp = sc->sc_ifp; struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = ifp->if_l2com; @@ -3594,10 +3744,8 @@ iwn_tx_data_raw(struct iwn_softc *sc, st bus_dmamap_sync(ring->desc_dma.tag, ring->desc_dma.map, BUS_DMASYNC_PREWRITE); -#ifdef notyet /* Update TX scheduler. */ ops->update_sched(sc, ring->qid, ring->cur, tx->id, totlen); -#endif /* Kick TX ring. */ ring->cur = (ring->cur + 1) % IWN_TX_RING_COUNT; @@ -3761,6 +3909,7 @@ iwn_ioctl(struct ifnet *ifp, u_long cmd, static int iwn_cmd(struct iwn_softc *sc, int code, const void *buf, int size, int async) { + struct iwn_ops *ops = &sc->ops; struct iwn_tx_ring *ring = &sc->txq[4]; struct iwn_tx_desc *desc; struct iwn_tx_data *data; @@ -3820,10 +3969,8 @@ iwn_cmd(struct iwn_softc *sc, int code, bus_dmamap_sync(ring->desc_dma.tag, ring->desc_dma.map, BUS_DMASYNC_PREWRITE); -#ifdef notyet /* Update TX scheduler. */ ops->update_sched(sc, ring->qid, ring->cur, 0, 0); -#endif /* Kick command ring. */ ring->cur = (ring->cur + 1) % IWN_TX_RING_COUNT; @@ -3874,7 +4021,7 @@ iwn_set_link_quality(struct iwn_softc *s linkq.id = wn->id; linkq.antmsk_1stream = txant; linkq.antmsk_2stream = IWN_ANT_AB; - linkq.ampdu_max = 31; + linkq.ampdu_max = 64; linkq.ampdu_threshold = 3; linkq.ampdu_limit = htole16(4000); /* 4ms */ @@ -5391,7 +5538,56 @@ iwn_ampdu_rx_stop(struct ieee80211_node sc->sc_ampdu_rx_stop(ni, rap); } -#if 0 /* HT */ +static int +iwn_addba_request(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap, + int dialogtoken, int baparamset, int batimeout) +{ + struct iwn_softc *sc = ni->ni_ic->ic_ifp->if_softc; + int qid; + + for (qid = sc->firstaggqueue; qid < sc->ntxqs; qid++) { + if (sc->qid2tap[qid] == NULL) + break; + } + if (qid == sc->ntxqs) { + DPRINTF(sc, IWN_DEBUG_XMIT, "%s: not free aggregation queue\n", + __func__); + return 0; + } + tap->txa_private = malloc(sizeof(int), M_DEVBUF, M_NOWAIT); + if (tap->txa_private == NULL) { + device_printf(sc->sc_dev, + "%s: failed to alloc TX aggregation structure\n", __func__); + return 0; + } + sc->qid2tap[qid] = tap; + *(int *)tap->txa_private = qid; + return sc->sc_addba_request(ni, tap, dialogtoken, baparamset, + batimeout); +} + +static int +iwn_addba_response(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap, + int code, int baparamset, int batimeout) +{ + struct iwn_softc *sc = ni->ni_ic->ic_ifp->if_softc; + int qid = *(int *)tap->txa_private; + uint8_t tid = WME_AC_TO_TID(tap->txa_ac); + int ret; + + if (code == IEEE80211_STATUS_SUCCESS) { + ni->ni_txseqs[tid] = tap->txa_start & 0xfff; + ret = iwn_ampdu_tx_start(ni->ni_ic, ni, tid); + if (ret != 1) + return ret; + } else { + sc->qid2tap[qid] = NULL; + free(tap->txa_private, M_DEVBUF); + tap->txa_private = NULL; + } + return sc->sc_addba_response(ni, tap, code, baparamset, batimeout); +} + /* * This function is called by upper layer when an ADDBA response is received * from another STA. @@ -5400,12 +5596,12 @@ static int iwn_ampdu_tx_start(struct ieee80211com *ic, struct ieee80211_node *ni, uint8_t tid) { - struct ieee80211_tx_ba *ba = &ni->ni_tx_ba[tid]; - struct iwn_softc *sc = ic->ic_softc; + struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[TID_TO_WME_AC(tid)]; + struct iwn_softc *sc = ni->ni_ic->ic_ifp->if_softc; struct iwn_ops *ops = &sc->ops; struct iwn_node *wn = (void *)ni; struct iwn_node_info node; - int error; + int error, qid; /* Enable TX for the specified RA/TID. */ wn->disable_tid &= ~(1 << tid); @@ -5416,35 +5612,44 @@ iwn_ampdu_tx_start(struct ieee80211com * node.disable_tid = htole16(wn->disable_tid); error = ops->add_node(sc, &node, 1); if (error != 0) - return error; + return 0; if ((error = iwn_nic_lock(sc)) != 0) - return error; - ops->ampdu_tx_start(sc, ni, tid, ba->ba_winstart); + return 0; + qid = *(int *)tap->txa_private; + ops->ampdu_tx_start(sc, ni, qid, tid, tap->txa_start & 0xfff); iwn_nic_unlock(sc); - return 0; + + iwn_set_link_quality(sc, ni); + return 1; } static void -iwn_ampdu_tx_stop(struct ieee80211com *ic, struct ieee80211_node *ni, - uint8_t tid) +iwn_ampdu_tx_stop(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap) { - struct ieee80211_tx_ba *ba = &ni->ni_tx_ba[tid]; - struct iwn_softc *sc = ic->ic_softc; + struct iwn_softc *sc = ni->ni_ic->ic_ifp->if_softc; struct iwn_ops *ops = &sc->ops; + uint8_t tid = WME_AC_TO_TID(tap->txa_ac); + int qid; + + if (tap->txa_private == NULL) + return; + qid = *(int *)tap->txa_private; if (iwn_nic_lock(sc) != 0) return; - ops->ampdu_tx_stop(sc, tid, ba->ba_winstart); + ops->ampdu_tx_stop(sc, qid, tid, tap->txa_start & 0xfff); iwn_nic_unlock(sc); + sc->qid2tap[qid] = NULL; + free(tap->txa_private, M_DEVBUF); + tap->txa_private = NULL; } static void iwn4965_ampdu_tx_start(struct iwn_softc *sc, struct ieee80211_node *ni, - uint8_t tid, uint16_t ssn) + int qid, uint8_t tid, uint16_t ssn) { struct iwn_node *wn = (void *)ni; - int qid = 7 + tid; /* Stop TX scheduler while we're changing its configuration. */ iwn_prph_write(sc, IWN4965_SCHED_QUEUE_STATUS(qid), @@ -5458,6 +5663,7 @@ iwn4965_ampdu_tx_start(struct iwn_softc iwn_prph_setbits(sc, IWN4965_SCHED_QCHAIN_SEL, 1 << qid); /* Set starting sequence number from the ADDBA request. */ + sc->txq[qid].cur = sc->txq[qid].read = (ssn & 0xff); IWN_WRITE(sc, IWN_HBUS_TARG_WRPTR, qid << 8 | (ssn & 0xff)); iwn_prph_write(sc, IWN4965_SCHED_QUEUE_RDPTR(qid), ssn); @@ -5478,10 +5684,8 @@ iwn4965_ampdu_tx_start(struct iwn_softc } static void -iwn4965_ampdu_tx_stop(struct iwn_softc *sc, uint8_t tid, uint16_t ssn) +iwn4965_ampdu_tx_stop(struct iwn_softc *sc, int qid, uint8_t tid, uint16_t ssn) { - int qid = 7 + tid; - /* Stop TX scheduler while we're changing its configuration. */ iwn_prph_write(sc, IWN4965_SCHED_QUEUE_STATUS(qid), IWN4965_TXQ_STATUS_CHGACT); @@ -5500,10 +5704,9 @@ iwn4965_ampdu_tx_stop(struct iwn_softc * static void iwn5000_ampdu_tx_start(struct iwn_softc *sc, struct ieee80211_node *ni, - uint8_t tid, uint16_t ssn) + int qid, uint8_t tid, uint16_t ssn) { struct iwn_node *wn = (void *)ni; - int qid = 10 + tid; /* Stop TX scheduler while we're changing its configuration. */ iwn_prph_write(sc, IWN5000_SCHED_QUEUE_STATUS(qid), @@ -5520,6 +5723,7 @@ iwn5000_ampdu_tx_start(struct iwn_softc iwn_prph_setbits(sc, IWN5000_SCHED_AGGR_SEL, 1 << qid); /* Set starting sequence number from the ADDBA request. */ + sc->txq[qid].cur = sc->txq[qid].read = (ssn & 0xff); IWN_WRITE(sc, IWN_HBUS_TARG_WRPTR, qid << 8 | (ssn & 0xff)); iwn_prph_write(sc, IWN5000_SCHED_QUEUE_RDPTR(qid), ssn); @@ -5536,10 +5740,8 @@ iwn5000_ampdu_tx_start(struct iwn_softc } static void -iwn5000_ampdu_tx_stop(struct iwn_softc *sc, uint8_t tid, uint16_t ssn) +iwn5000_ampdu_tx_stop(struct iwn_softc *sc, int qid, uint8_t tid, uint16_t ssn) { - int qid = 10 + tid; - /* Stop TX scheduler while we're changing its configuration. */ iwn_prph_write(sc, IWN5000_SCHED_QUEUE_STATUS(qid), IWN5000_TXQ_STATUS_CHGACT); @@ -5558,7 +5760,6 @@ iwn5000_ampdu_tx_stop(struct iwn_softc * iwn_prph_write(sc, IWN5000_SCHED_QUEUE_STATUS(qid), IWN5000_TXQ_STATUS_INACTIVE | iwn_tid2fifo[tid]); } -#endif /* * Query calibration tables from the initialization firmware. We do this Modified: head/sys/dev/iwn/if_iwnreg.h ============================================================================== --- head/sys/dev/iwn/if_iwnreg.h Sun May 8 11:58:23 2011 (r221650) +++ head/sys/dev/iwn/if_iwnreg.h Sun May 8 12:06:12 2011 (r221651) @@ -27,6 +27,9 @@ #define IWN4965_NTXQUEUES 16 #define IWN5000_NTXQUEUES 20 +#define IWN4965_FIRSTAGGQUEUE 7 +#define IWN5000_FIRSTAGGQUEUE 10 + #define IWN4965_NDMACHNLS 7 #define IWN5000_NDMACHNLS 8 Modified: head/sys/dev/iwn/if_iwnvar.h ============================================================================== --- head/sys/dev/iwn/if_iwnvar.h Sun May 8 11:58:23 2011 (r221650) +++ head/sys/dev/iwn/if_iwnvar.h Sun May 8 12:06:12 2011 (r221651) @@ -78,6 +78,7 @@ struct iwn_tx_ring { int qid; int queued; int cur; + int read; }; struct iwn_softc; @@ -102,6 +103,11 @@ struct iwn_node { uint16_t disable_tid; uint8_t id; uint32_t ridx[256]; + struct { + uint64_t bitmap; + int startidx; + int nframes; + } agg[IEEE80211_TID_SIZE]; }; struct iwn_calib_state { @@ -174,12 +180,10 @@ struct iwn_ops { int); void (*tx_done)(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); -#if 0 /* HT */ void (*ampdu_tx_start)(struct iwn_softc *, - struct ieee80211_node *, uint8_t, uint16_t); - void (*ampdu_tx_stop)(struct iwn_softc *, uint8_t, + struct ieee80211_node *, int, uint8_t, uint16_t); + void (*ampdu_tx_stop)(struct iwn_softc *, int, uint8_t, uint16_t); -#endif }; struct iwn_vap { @@ -215,6 +219,7 @@ struct iwn_softc { const struct iwn_sensitivity_limits *limits; int ntxqs; + int firstaggqueue; int ndmachnls; uint8_t broadcast_id; int rxonsz; @@ -306,10 +311,19 @@ struct iwn_softc { int sc_tx_timer; + struct ieee80211_tx_ampdu *qid2tap[IWN5000_NTXQUEUES]; + int (*sc_ampdu_rx_start)(struct ieee80211_node *, struct ieee80211_rx_ampdu *, int, int, int); void (*sc_ampdu_rx_stop)(struct ieee80211_node *, struct ieee80211_rx_ampdu *); + int (*sc_addba_request)(struct ieee80211_node *, + struct ieee80211_tx_ampdu *, int, int, int); + int (*sc_addba_response)(struct ieee80211_node *, + struct ieee80211_tx_ampdu *, int, int, int); + void (*sc_addba_stop)(struct ieee80211_node *, + struct ieee80211_tx_ampdu *); + struct iwn_rx_radiotap_header sc_rxtap; struct iwn_tx_radiotap_header sc_txtap; From owner-svn-src-all@FreeBSD.ORG Sun May 8 12:11:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5771E106564A; Sun, 8 May 2011 12:11:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4ADE78FC16; Sun, 8 May 2011 12:11:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48CBH1j045325; Sun, 8 May 2011 12:11:17 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48CBHgF045323; Sun, 8 May 2011 12:11:17 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105081211.p48CBHgF045323@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 8 May 2011 12:11:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221652 - head/sys/geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 12:11:17 -0000 Author: ae Date: Sun May 8 12:11:16 2011 New Revision: 221652 URL: http://svn.freebsd.org/changeset/base/221652 Log: Limit number of sectors that can be addressed. MFC after: 1 week Modified: head/sys/geom/part/g_part_bsd.c Modified: head/sys/geom/part/g_part_bsd.c ============================================================================== --- head/sys/geom/part/g_part_bsd.c Sun May 8 12:06:12 2011 (r221651) +++ head/sys/geom/part/g_part_bsd.c Sun May 8 12:11:16 2011 (r221652) @@ -206,7 +206,7 @@ g_part_bsd_create(struct g_part_table *b if (BBSIZE % pp->sectorsize) return (ENOTBLK); - msize = MIN(pp->mediasize / pp->sectorsize, 0xffffffff); + msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX); secpercyl = basetable->gpt_sectors * basetable->gpt_heads; ncyls = msize / secpercyl; @@ -365,7 +365,7 @@ g_part_bsd_read(struct g_part_table *bas pp = cp->provider; table = (struct g_part_bsd_table *)basetable; - msize = pp->mediasize / pp->sectorsize; + msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX); table->bbarea = g_read_data(cp, 0, BBSIZE, &error); if (table->bbarea == NULL) From owner-svn-src-all@FreeBSD.ORG Sun May 8 12:11:21 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41FD7106566B; Sun, 8 May 2011 12:11:21 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34E618FC17; Sun, 8 May 2011 12:11:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48CBL7d045363; Sun, 8 May 2011 12:11:21 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48CBLqH045360; Sun, 8 May 2011 12:11:21 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201105081211.p48CBLqH045360@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 8 May 2011 12:11:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221653 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 12:11:21 -0000 Author: bschmidt Date: Sun May 8 12:11:20 2011 New Revision: 221653 URL: http://svn.freebsd.org/changeset/base/221653 Log: Notify firmware about various HT parameters once associated. Modified: head/sys/dev/iwn/if_iwn.c head/sys/dev/iwn/if_iwnreg.h Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun May 8 12:11:16 2011 (r221652) +++ head/sys/dev/iwn/if_iwn.c Sun May 8 12:11:20 2011 (r221653) @@ -5348,12 +5348,12 @@ iwn_auth(struct iwn_softc *sc, struct ie static int iwn_run(struct iwn_softc *sc, struct ieee80211vap *vap) { -#define MS(v,x) (((v) & x) >> x##_S) struct iwn_ops *ops = &sc->ops; struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; struct ieee80211_node *ni = vap->iv_bss; struct iwn_node_info node; + uint32_t htflags = 0; int error; if (ic->ic_opmode == IEEE80211_M_MONITOR) { @@ -5389,26 +5389,22 @@ iwn_run(struct iwn_softc *sc, struct iee sc->rxon.cck_mask = 0x0f; sc->rxon.ofdm_mask = 0x15; } -#if 0 /* HT */ if (IEEE80211_IS_CHAN_HT(ni->ni_chan)) { - sc->rxon.flags &= ~htole32(IWN_RXON_HT); - if (IEEE80211_IS_CHAN_HT40U(ni->ni_chan)) - sc->rxon.flags |= htole32(IWN_RXON_HT40U); - else if (IEEE80211_IS_CHAN_HT40D(ni->ni_chan)) - sc->rxon.flags |= htole32(IWN_RXON_HT40D); - else - sc->rxon.flags |= htole32(IWN_RXON_HT20); - sc->rxon.rxchain = htole16( - IWN_RXCHAIN_VALID(3) - | IWN_RXCHAIN_MIMO_COUNT(3) - | IWN_RXCHAIN_IDLE_COUNT(1) - | IWN_RXCHAIN_MIMO_FORCE); - - maxrxampdu = MS(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU); - ampdudensity = MS(ni->ni_htparam, IEEE80211_HTCAP_MPDUDENSITY); - } else - maxrxampdu = ampdudensity = 0; -#endif + htflags |= IWN_RXON_HT_PROTMODE(ic->ic_curhtprotmode); + if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) { + switch (ic->ic_curhtprotmode) { + case IEEE80211_HTINFO_OPMODE_HT20PR: + htflags |= IWN_RXON_HT_MODEPURE40; + break; + default: + htflags |= IWN_RXON_HT_MODEMIXED; + break; + } + } + if (IEEE80211_IS_CHAN_HT40D(ni->ni_chan)) + htflags |= IWN_RXON_HT_HT40MINUS; + } + sc->rxon.flags |= htole32(htflags); sc->rxon.filter |= htole32(IWN_FILTER_BSS); DPRINTF(sc, IWN_DEBUG_STATE, "rxon chan %d flags %x\n", sc->rxon.chan, sc->rxon.flags); @@ -5435,10 +5431,20 @@ iwn_run(struct iwn_softc *sc, struct iee memset(&node, 0, sizeof node); IEEE80211_ADDR_COPY(node.macaddr, ni->ni_macaddr); node.id = IWN_ID_BSS; -#ifdef notyet - node.htflags = htole32(IWN_AMDPU_SIZE_FACTOR(3) | - IWN_AMDPU_DENSITY(5)); /* 2us */ -#endif + if (IEEE80211_IS_CHAN_HT(ni->ni_chan)) { + switch (ni->ni_htcap & IEEE80211_HTCAP_SMPS) { + case IEEE80211_HTCAP_SMPS_ENA: + node.htflags |= htole32(IWN_SMPS_MIMO_DIS); + break; + case IEEE80211_HTCAP_SMPS_DYNAMIC: + node.htflags |= htole32(IWN_SMPS_MIMO_PROT); + break; + } + node.htflags |= htole32(IWN_AMDPU_SIZE_FACTOR(3) | + IWN_AMDPU_DENSITY(5)); /* 4us */ + if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) + node.htflags |= htole32(IWN_NODE_HT40); + } DPRINTF(sc, IWN_DEBUG_STATE, "%s: adding BSS node\n", __func__); error = ops->add_node(sc, &node, 1); if (error != 0) { @@ -5470,7 +5476,6 @@ iwn_run(struct iwn_softc *sc, struct iee /* Link LED always on while associated. */ iwn_set_led(sc, IWN_LED_LINK, 0, 1); return 0; -#undef MS } /* Modified: head/sys/dev/iwn/if_iwnreg.h ============================================================================== --- head/sys/dev/iwn/if_iwnreg.h Sun May 8 12:11:16 2011 (r221652) +++ head/sys/dev/iwn/if_iwnreg.h Sun May 8 12:11:20 2011 (r221653) @@ -492,6 +492,10 @@ struct iwn_rxon { #define IWN_RXON_ANTENNA_A (1 << 8) #define IWN_RXON_ANTENNA_B (1 << 9) #define IWN_RXON_TSF (1 << 15) +#define IWN_RXON_HT_HT40MINUS (1 << 22) +#define IWN_RXON_HT_PROTMODE(x) (x << 23) +#define IWN_RXON_HT_MODEPURE40 (1 << 25) +#define IWN_RXON_HT_MODEMIXED (2 << 25) #define IWN_RXON_CTS_TO_SELF (1 << 30) uint32_t filter; @@ -591,7 +595,10 @@ struct iwn_node_info { uint8_t txmic[8]; uint32_t htflags; +#define IWN_SMPS_MIMO_PROT (1 << 17) #define IWN_AMDPU_SIZE_FACTOR(x) ((x) << 19) +#define IWN_NODE_HT40 (1 << 21) +#define IWN_SMPS_MIMO_DIS (1 << 22) #define IWN_AMDPU_DENSITY(x) ((x) << 23) uint32_t mask; From owner-svn-src-all@FreeBSD.ORG Sun May 8 12:16:39 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76457106564A; Sun, 8 May 2011 12:16:39 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 69B468FC08; Sun, 8 May 2011 12:16:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48CGdto045574; Sun, 8 May 2011 12:16:39 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48CGdd5045572; Sun, 8 May 2011 12:16:39 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105081216.p48CGdd5045572@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 8 May 2011 12:16:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221654 - head/sys/geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 12:16:39 -0000 Author: ae Date: Sun May 8 12:16:39 2011 New Revision: 221654 URL: http://svn.freebsd.org/changeset/base/221654 Log: Limit number of sectors that can be addressed. Reject table if blkcount from metadata is greater than provider. Modified: head/sys/geom/part/g_part_apm.c Modified: head/sys/geom/part/g_part_apm.c ============================================================================== --- head/sys/geom/part/g_part_apm.c Sun May 8 12:11:20 2011 (r221653) +++ head/sys/geom/part/g_part_apm.c Sun May 8 12:16:39 2011 (r221654) @@ -255,7 +255,7 @@ g_part_apm_create(struct g_part_table *b return (ENOSPC); /* APM uses 32-bit LBAs. */ - last = MIN(pp->mediasize / pp->sectorsize, 0xffffffff) - 1; + last = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX) - 1; basetable->gpt_first = 2 + basetable->gpt_entries; basetable->gpt_last = last; @@ -398,6 +398,8 @@ g_part_apm_probe(struct g_part_table *ba g_free(buf); if (table->ddr.ddr_blksize != pp->sectorsize) return (ENXIO); + if (table->ddr.ddr_blkcount > pp->mediasize / pp->sectorsize) + return (ENXIO); } else { /* * Check for Tivo drives, which have no DDR and a different @@ -412,7 +414,8 @@ g_part_apm_probe(struct g_part_table *ba } table->ddr.ddr_sig = APM_DDR_SIG; /* XXX */ table->ddr.ddr_blksize = pp->sectorsize; /* XXX */ - table->ddr.ddr_blkcount = pp->mediasize / pp->sectorsize;/* XXX */ + table->ddr.ddr_blkcount = + MIN(pp->mediasize / pp->sectorsize, UINT32_MAX); table->tivo_series1 = 1; g_free(buf); } From owner-svn-src-all@FreeBSD.ORG Sun May 8 12:16:39 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F275106566C; Sun, 8 May 2011 12:16:39 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 82A288FC0A; Sun, 8 May 2011 12:16:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48CGdem045578; Sun, 8 May 2011 12:16:39 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48CGdw3045576; Sun, 8 May 2011 12:16:39 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201105081216.p48CGdw3045576@svn.freebsd.org> From: Benedict Reuschling Date: Sun, 8 May 2011 12:16:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221655 - head/usr.sbin/jail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 12:16:39 -0000 Author: bcr (doc committer) Date: Sun May 8 12:16:39 2011 New Revision: 221655 URL: http://svn.freebsd.org/changeset/base/221655 Log: Jails have a problem in that if the jail directory is world-readable, an attacker with root access to the jail can create a setuid binary for their own use in the host environment (if they also have this access), thus breaking root in the host. This exploit is impossible if the jail's files are not world-readable. Add instructions to the man page on how to create a jail with the correct permissions set. PR: docs/156853 Submitted by: Chris Rees (utisoft at gmail dot com) Reviewed by: cperciva (security parts) MFC after: 9 days Modified: head/usr.sbin/jail/jail.8 Modified: head/usr.sbin/jail/jail.8 ============================================================================== --- head/usr.sbin/jail/jail.8 Sun May 8 12:16:39 2011 (r221654) +++ head/usr.sbin/jail/jail.8 Sun May 8 12:16:39 2011 (r221655) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 17, 2010 +.Dd May 8, 2011 .Dt JAIL 8 .Os .Sh NAME @@ -431,7 +431,7 @@ command script can be used: .Bd -literal D=/here/is/the/jail cd /usr/src -mkdir -p $D +mkdir -p -m 0700 $D make world DESTDIR=$D make distribution DESTDIR=$D mount -t devfs devfs $D/dev @@ -448,6 +448,10 @@ in the per-jail devfs. A simple devfs ruleset for jails is available as ruleset #4 in .Pa /etc/defaults/devfs.rules . .Pp +Non-superusers in the host system should not be able to access the +jail's files; otherwise an attacker with root access to the jail +could obtain elevated privileges on the host. +.Pp In many cases this example would put far more in the jail than needed. In the other extreme case a jail might contain only one file: the executable to be run in the jail. From owner-svn-src-all@FreeBSD.ORG Sun May 8 12:20:30 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98E8F1065670; Sun, 8 May 2011 12:20:30 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C44E8FC08; Sun, 8 May 2011 12:20:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48CKUix045737; Sun, 8 May 2011 12:20:30 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48CKUv5045735; Sun, 8 May 2011 12:20:30 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105081220.p48CKUv5045735@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 8 May 2011 12:20:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221656 - head/sys/geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 12:20:30 -0000 Author: ae Date: Sun May 8 12:20:30 2011 New Revision: 221656 URL: http://svn.freebsd.org/changeset/base/221656 Log: Limit number of sectors that can be addressed. MFC after: 1 week Modified: head/sys/geom/part/g_part_ebr.c Modified: head/sys/geom/part/g_part_ebr.c ============================================================================== --- head/sys/geom/part/g_part_ebr.c Sun May 8 12:16:39 2011 (r221655) +++ head/sys/geom/part/g_part_ebr.c Sun May 8 12:20:30 2011 (r221656) @@ -288,7 +288,7 @@ g_part_ebr_create(struct g_part_table *b if (strcmp(psn, "MBR")) return (ENXIO); - msize = MIN(pp->mediasize / pp->sectorsize, 0xffffffff); + msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX); msize -= msize % basetable->gpt_sectors; basetable->gpt_first = 0; basetable->gpt_last = msize - 1; @@ -464,7 +464,7 @@ g_part_ebr_read(struct g_part_table *bas pp = cp->provider; table = (struct g_part_ebr_table *)basetable; - msize = pp->mediasize / pp->sectorsize; + msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX); lba = 0; while (1) { From owner-svn-src-all@FreeBSD.ORG Sun May 8 12:23:01 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 864861065673; Sun, 8 May 2011 12:23:01 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F4D68FC15; Sun, 8 May 2011 12:23:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48CN11L045862; Sun, 8 May 2011 12:23:01 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48CN1Qm045860; Sun, 8 May 2011 12:23:01 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201105081223.p48CN1Qm045860@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 8 May 2011 12:23:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221657 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 12:23:01 -0000 Author: bschmidt Date: Sun May 8 12:23:01 2011 New Revision: 221657 URL: http://svn.freebsd.org/changeset/base/221657 Log: Enable 11n (sans HT40) support. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun May 8 12:20:30 2011 (r221656) +++ head/sys/dev/iwn/if_iwn.c Sun May 8 12:23:01 2011 (r221657) @@ -599,45 +599,30 @@ iwn_attach(device_t dev) macaddr, ":"); } -#if 0 /* HT */ - /* XXX disable until HT channel setup works */ - ic->ic_htcaps = - IEEE80211_HTCAP_SMPS_ENA /* SM PS mode enabled */ - | IEEE80211_HTCAP_CHWIDTH40 /* 40MHz channel width */ - | IEEE80211_HTCAP_SHORTGI20 /* short GI in 20MHz */ - | IEEE80211_HTCAP_SHORTGI40 /* short GI in 40MHz */ - | IEEE80211_HTCAP_RXSTBC_2STREAM/* 1-2 spatial streams */ - | IEEE80211_HTCAP_MAXAMSDU_3839 /* max A-MSDU length */ - /* s/w capabilities */ - | IEEE80211_HTC_HT /* HT operation */ - | IEEE80211_HTC_AMPDU /* tx A-MPDU */ - | IEEE80211_HTC_AMSDU /* tx A-MSDU */ - ; - - /* Set HT capabilities. */ - ic->ic_htcaps = + if (sc->sc_flags & IWN_FLAG_HAS_11N) { + ic->ic_rxstream = sc->nrxchains; + ic->ic_txstream = sc->ntxchains; + ic->ic_htcaps = + IEEE80211_HTCAP_SMPS_OFF /* SMPS mode disabled */ + | IEEE80211_HTCAP_SHORTGI20 /* short GI in 20MHz */ +#ifdef notyet + | IEEE80211_HTCAP_CHWIDTH40 /* 40MHz channel width*/ + | IEEE80211_HTCAP_SHORTGI40 /* short GI in 40MHz */ + | IEEE80211_HTCAP_GREENFIELD #if IWN_RBUF_SIZE == 8192 - IEEE80211_HTCAP_AMSDU7935 | + | IEEE80211_HTCAP_MAXAMSDU_7935 /* max A-MSDU length */ +#else + | IEEE80211_HTCAP_MAXAMSDU_3839 /* max A-MSDU length */ #endif - IEEE80211_HTCAP_CBW20_40 | - IEEE80211_HTCAP_SGI20 | - IEEE80211_HTCAP_SGI40; - if (sc->hw_type != IWN_HW_REV_TYPE_4965) - ic->ic_htcaps |= IEEE80211_HTCAP_GF; - if (sc->hw_type == IWN_HW_REV_TYPE_6050) - ic->ic_htcaps |= IEEE80211_HTCAP_SMPS_DYN; - else - ic->ic_htcaps |= IEEE80211_HTCAP_SMPS_DIS; #endif - -#if 0 /* HT */ - /* Set supported HT rates. */ - ic->ic_sup_mcs[0] = 0xff; - if (sc->nrxchains > 1) - ic->ic_sup_mcs[1] = 0xff; - if (sc->nrxchains > 2) - ic->ic_sup_mcs[2] = 0xff; + /* s/w capabilities */ + | IEEE80211_HTC_HT /* HT operation */ + | IEEE80211_HTC_AMPDU /* tx A-MPDU */ +#ifdef notyet + | IEEE80211_HTC_AMSDU /* tx A-MSDU */ #endif + ; + } if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_softc = sc; From owner-svn-src-all@FreeBSD.ORG Sun May 8 12:28:14 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04FA71065672; Sun, 8 May 2011 12:28:14 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC8F38FC18; Sun, 8 May 2011 12:28:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48CSDo7046103; Sun, 8 May 2011 12:28:13 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48CSDmp046101; Sun, 8 May 2011 12:28:13 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105081228.p48CSDmp046101@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 8 May 2011 12:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-sr