From owner-svn-src-head@FreeBSD.ORG Sun Jan 30 11:23:59 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAFEC1065672; Sun, 30 Jan 2011 11:23:59 +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 DB3B08FC0A; Sun, 30 Jan 2011 11:23:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0UBNx3E069777; Sun, 30 Jan 2011 11:23:59 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0UBNxuk069775; Sun, 30 Jan 2011 11:23:59 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201101301123.p0UBNxuk069775@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 30 Jan 2011 11:23: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: r218085 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 11:24:00 -0000 Author: bschmidt Date: Sun Jan 30 11:23:59 2011 New Revision: 218085 URL: http://svn.freebsd.org/changeset/base/218085 Log: Honor the IEEE80211_SCAN_BGSCAN flag, which makes it possible to actually request a background scan using IEEE80211_IOC_SCAN_BGSCAN. MFC after: 1 month Modified: head/sys/net80211/ieee80211_scan.c Modified: head/sys/net80211/ieee80211_scan.c ============================================================================== --- head/sys/net80211/ieee80211_scan.c Sun Jan 30 10:35:41 2011 (r218084) +++ head/sys/net80211/ieee80211_scan.c Sun Jan 30 11:23:59 2011 (r218085) @@ -416,6 +416,8 @@ start_scan_locked(const struct ieee80211 vap->iv_stats.is_scan_passive++; if (flags & IEEE80211_SCAN_FLUSH) ss->ss_ops->scan_flush(ss); + if (flags & IEEE80211_SCAN_BGSCAN) + ic->ic_flags_ext |= IEEE80211_FEXT_BGSCAN; /* NB: flush frames rx'd before 1st channel change */ SCAN_PRIVATE(ss)->ss_iflags |= ISCAN_DISCARD; From owner-svn-src-head@FreeBSD.ORG Sun Jan 30 12:14:06 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F40B1065670; Sun, 30 Jan 2011 12:14: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 5FA378FC0C; Sun, 30 Jan 2011 12:14:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0UCE6Dm071209; Sun, 30 Jan 2011 12:14:06 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0UCE6IL071207; Sun, 30 Jan 2011 12:14:06 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201101301214.p0UCE6IL071207@svn.freebsd.org> From: Adrian Chadd Date: Sun, 30 Jan 2011 12:14: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: r218088 - head/sys/dev/flash X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 12:14:06 -0000 Author: adrian Date: Sun Jan 30 12:14:06 2011 New Revision: 218088 URL: http://svn.freebsd.org/changeset/base/218088 Log: Add support for the m25p64; lifted straight from Linux. This flash chip is found on the Ubiquiti LS-SR71 board. I've successfully tested reading; I've not tried writing to it yet. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Jan 30 12:12:25 2011 (r218087) +++ head/sys/dev/flash/mx25l.c Sun Jan 30 12:14:06 2011 (r218088) @@ -90,6 +90,7 @@ static void mx25l_task(void *arg); struct mx25l_flash_ident flash_devices[] = { { "mx25ll32", 0xc2, 0x2016, 64 * 1024, 64, FL_NONE }, + { "m25p64", 0x20, 0x2017, 64 * 1024, 128, FL_NONE }, { "mx25ll64", 0xc2, 0x2017, 64 * 1024, 128, FL_NONE }, { "mx25ll128", 0xc2, 0x2018, 64 * 1024, 256, FL_ERASE_4K | FL_ERASE_32K }, { "s25fl128", 0x01, 0x2018, 64 * 1024, 256, FL_NONE }, From owner-svn-src-head@FreeBSD.ORG Sun Jan 30 12:57:10 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8710106566C; Sun, 30 Jan 2011 12:57:10 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B8C0C8FC16; Sun, 30 Jan 2011 12:57:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0UCvAXA072266; Sun, 30 Jan 2011 12:57:10 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0UCvAUa072264; Sun, 30 Jan 2011 12:57:10 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201101301257.p0UCvAUa072264@svn.freebsd.org> From: Ulrich Spoerlein Date: Sun, 30 Jan 2011 12:57: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: r218089 - head/share/syscons/keymaps X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 12:57:10 -0000 Author: uqs Date: Sun Jan 30 12:57:10 2011 New Revision: 218089 URL: http://svn.freebsd.org/changeset/base/218089 Log: syscons: install all available kbdmaps eee_nordic.kbd, us.dvorakl.kbd, and us.dvorakr.kbd were not installed. Found by: Neil Short MFC after: 3 weeks Modified: head/share/syscons/keymaps/Makefile Modified: head/share/syscons/keymaps/Makefile ============================================================================== --- head/share/syscons/keymaps/Makefile Sun Jan 30 12:14:06 2011 (r218088) +++ head/share/syscons/keymaps/Makefile Sun Jan 30 12:57:10 2011 (r218089) @@ -11,7 +11,7 @@ FILES= INDEX.keymaps \ cz.iso2.kbd \ danish.iso.kbd danish.iso.acc.kbd danish.cp865.kbd \ dutch.iso.acc.kbd \ - el.iso07.kbd \ + eee_nordic.kbd el.iso07.kbd \ estonian.iso.kbd estonian.iso15.kbd estonian.cp850.kbd \ finnish.iso.kbd finnish.cp850.kbd \ fr.iso.kbd fr.iso.acc.kbd fr.dvorak.kbd fr.dvorak.acc.kbd \ @@ -45,8 +45,8 @@ FILES= INDEX.keymaps \ ua.koi8-u.kbd ua.koi8-u.shift.alt.kbd ua.iso5.kbd \ uk.iso.kbd uk.iso-ctrl.kbd uk.cp850.kbd uk.cp850-ctrl.kbd \ uk.dvorak.kbd \ - us.iso.kbd us.dvorak.kbd us.dvorakx.kbd us.emacs.kbd us.pc-ctrl.kbd \ - us.unix.kbd us.iso.acc.kbd + us.iso.kbd us.dvorak.kbd us.dvorakl.kbd us.dvorakr.kbd us.dvorakx.kbd \ + us.emacs.kbd us.pc-ctrl.kbd us.unix.kbd us.iso.acc.kbd FILESDIR= ${SHAREDIR}/syscons/keymaps From owner-svn-src-head@FreeBSD.ORG Sun Jan 30 13:17:45 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C4631065679; Sun, 30 Jan 2011 13:17: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 8C7FF8FC16; Sun, 30 Jan 2011 13:17:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0UDHja6072819; Sun, 30 Jan 2011 13:17:45 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0UDHjuq072817; Sun, 30 Jan 2011 13:17:45 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201101301317.p0UDHjuq072817@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 30 Jan 2011 13:17:45 +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: r218090 - head/sbin/ifconfig X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 13:17:45 -0000 Author: bschmidt Date: Sun Jan 30 13:17:45 2011 New Revision: 218090 URL: http://svn.freebsd.org/changeset/base/218090 Log: When doing a scan while being associated it is possible that the scan is deferred for the time it takes to flush the TX queue. This work being done the scan then is continued, but only if it is marked to do so. As the 'ifconfig scan' request is meant to be used after the interface is brought up, request a background scan by default. This behaviour is already documented in manual page. This fixes on possible case where 'ifconfig scan' hangs infinitely. MFC after: 1 month Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Sun Jan 30 12:57:10 2011 (r218089) +++ head/sbin/ifconfig/ifieee80211.c Sun Jan 30 13:17:45 2011 (r218090) @@ -3222,6 +3222,7 @@ scan_and_wait(int s) memset(&sr, 0, sizeof(sr)); sr.sr_flags = IEEE80211_IOC_SCAN_ACTIVE + | IEEE80211_IOC_SCAN_BGSCAN | IEEE80211_IOC_SCAN_NOPICK | IEEE80211_IOC_SCAN_ONCE; sr.sr_duration = IEEE80211_IOC_SCAN_FOREVER; From owner-svn-src-head@FreeBSD.ORG Sun Jan 30 14:00:50 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD692106564A; Sun, 30 Jan 2011 14:00: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 AD7928FC12; Sun, 30 Jan 2011 14:00:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0UE0ouC073892; Sun, 30 Jan 2011 14:00:50 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0UE0osq073890; Sun, 30 Jan 2011 14:00:50 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201101301400.p0UE0osq073890@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 30 Jan 2011 14:00: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: r218091 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 14:00:50 -0000 Author: bschmidt Date: Sun Jan 30 14:00:50 2011 New Revision: 218091 URL: http://svn.freebsd.org/changeset/base/218091 Log: Change return code semantics of start_scan_locked(). Instead of reporting if a scan is running, report if a scan has been started. The return value itself is not (yet) used anywhere in the tree and it is also not exported to userspace. MFC after: 1 month Modified: head/sys/net80211/ieee80211_scan.c Modified: head/sys/net80211/ieee80211_scan.c ============================================================================== --- head/sys/net80211/ieee80211_scan.c Sun Jan 30 13:17:45 2011 (r218090) +++ head/sys/net80211/ieee80211_scan.c Sun Jan 30 14:00:50 2011 (r218091) @@ -434,12 +434,13 @@ start_scan_locked(const struct ieee80211 ic->ic_flags |= IEEE80211_F_SCAN; ieee80211_runtask(ic, &SCAN_PRIVATE(ss)->ss_scan_task); } + return 1; } else { IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, "%s: %s scan already in progress\n", __func__, ss->ss_flags & IEEE80211_SCAN_ACTIVE ? "active" : "passive"); } - return (ic->ic_flags & IEEE80211_F_SCAN); + return 0; } /* From owner-svn-src-head@FreeBSD.ORG Sun Jan 30 14:05:21 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE4931065675; Sun, 30 Jan 2011 14:05: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 CE6F08FC08; Sun, 30 Jan 2011 14:05:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0UE5Lim074029; Sun, 30 Jan 2011 14:05:21 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0UE5LLL074027; Sun, 30 Jan 2011 14:05:21 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201101301405.p0UE5LLL074027@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 30 Jan 2011 14:05: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: r218092 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 14:05:22 -0000 Author: bschmidt Date: Sun Jan 30 14:05:21 2011 New Revision: 218092 URL: http://svn.freebsd.org/changeset/base/218092 Log: Instead of always returning 0 to a scan request, indicate if there is one running already. MFC after: 1 month Modified: head/sys/net80211/ieee80211_ioctl.c Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Sun Jan 30 14:00:50 2011 (r218091) +++ head/sys/net80211/ieee80211_ioctl.c Sun Jan 30 14:05:21 2011 (r218092) @@ -2384,7 +2384,7 @@ ieee80211_scanreq(struct ieee80211vap *v IEEE80211_IOC_SCAN_NOJOIN | IEEE80211_IOC_SCAN_FLUSH | \ IEEE80211_IOC_SCAN_CHECK) struct ieee80211com *ic = vap->iv_ic; - int i; + int error, i; /* convert duration */ if (sr->sr_duration == IEEE80211_IOC_SCAN_FOREVER) @@ -2458,20 +2458,21 @@ ieee80211_scanreq(struct ieee80211vap *v } else { vap->iv_flags_ext &= ~IEEE80211_FEXT_SCANREQ; IEEE80211_UNLOCK(ic); - /* XXX neeed error return codes */ if (sr->sr_flags & IEEE80211_IOC_SCAN_CHECK) { - (void) ieee80211_check_scan(vap, sr->sr_flags, + error = ieee80211_check_scan(vap, sr->sr_flags, sr->sr_duration, sr->sr_mindwell, sr->sr_maxdwell, sr->sr_nssid, /* NB: cheat, we assume structures are compatible */ (const struct ieee80211_scan_ssid *) &sr->sr_ssid[0]); } else { - (void) ieee80211_start_scan(vap, sr->sr_flags, + error = ieee80211_start_scan(vap, sr->sr_flags, sr->sr_duration, sr->sr_mindwell, sr->sr_maxdwell, sr->sr_nssid, /* NB: cheat, we assume structures are compatible */ (const struct ieee80211_scan_ssid *) &sr->sr_ssid[0]); } + if (error == 0) + return EINPROGRESS; } return 0; #undef IEEE80211_IOC_SCAN_FLAGS From owner-svn-src-head@FreeBSD.ORG Sun Jan 30 14:22:46 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0993A1065672; Sun, 30 Jan 2011 14:22:46 +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 EDFE68FC16; Sun, 30 Jan 2011 14:22:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0UEMjV6074516; Sun, 30 Jan 2011 14:22:45 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0UEMjnj074514; Sun, 30 Jan 2011 14:22:45 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201101301422.p0UEMjnj074514@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 30 Jan 2011 14:22:45 +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: r218093 - head/sbin/ifconfig X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 14:22:46 -0000 Author: bschmidt Date: Sun Jan 30 14:22:45 2011 New Revision: 218093 URL: http://svn.freebsd.org/changeset/base/218093 Log: Fix the 'scan hang' issue. When requesting a scan and one is already in progess, e.g. while in scan state, we happily wait for a scan done notification. Though, this notification might never be sent, e.g. if we are trying to find a network to associate to and there is none. Instead of always waiting for a notification just do so if a new scan has been started. For both cases the scan cache is used to report available networks even if the content might not be fresh. MFC after: 1 month Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Sun Jan 30 14:05:21 2011 (r218092) +++ head/sbin/ifconfig/ifieee80211.c Sun Jan 30 14:22:45 2011 (r218093) @@ -3230,8 +3230,12 @@ scan_and_wait(int s) ireq.i_data = &sr; ireq.i_len = sizeof(sr); - /* NB: only root can trigger a scan so ignore errors */ - if (ioctl(s, SIOCS80211, &ireq) >= 0) { + /* + * NB: only root can trigger a scan so ignore errors. Also ignore + * possible errors from net80211, even if no new scan could be + * started there might still be a valid scan cache. + */ + if (ioctl(s, SIOCS80211, &ireq) == 0) { char buf[2048]; struct if_announcemsghdr *ifan; struct rt_msghdr *rtm; From owner-svn-src-head@FreeBSD.ORG Sun Jan 30 16:14:10 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36043106566B; Sun, 30 Jan 2011 16:14:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 261CF8FC0A; Sun, 30 Jan 2011 16:14:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0UGEAZC077284; Sun, 30 Jan 2011 16:14:10 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0UGEAjx077282; Sun, 30 Jan 2011 16:14:10 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201101301614.p0UGEAjx077282@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 30 Jan 2011 16:14: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: r218098 - head/libexec/rtld-elf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 16:14:10 -0000 Author: kib Date: Sun Jan 30 16:14:09 2011 New Revision: 218098 URL: http://svn.freebsd.org/changeset/base/218098 Log: Make ldd(1) work when versioned dependency file is cannot be loaded. Instead of aborting in locate_dependency(), propagate the error to caller. The rtld startup function does the right thing with an error from rtld_verify_versions(), depending on the mode of operation. Reported by: maho In collaboration with: kan MFC after: 1 week Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Sun Jan 30 15:36:59 2011 (r218097) +++ head/libexec/rtld-elf/rtld.c Sun Jan 30 16:14:09 2011 (r218098) @@ -3704,10 +3704,17 @@ locate_dependency(const Obj_Entry *obj, } for (needed = obj->needed; needed != NULL; needed = needed->next) { - if (needed->obj == NULL) - continue; - if (object_match_name(needed->obj, name)) - return needed->obj; + if (strcmp(obj->strtab + needed->name, name) == 0 || + (needed->obj != NULL && object_match_name(needed->obj, name))) { + /* + * If there is DT_NEEDED for the name we are looking for, + * we are all set. Note that object might not be found if + * dependency was not loaded yet, so the function can + * return NULL here. This is expected and handled + * properly in caller. + */ + return (needed->obj); + } } _rtld_error("%s: Unexpected inconsistency: dependency %s not found", obj->path, name); @@ -3833,6 +3840,8 @@ rtld_verify_object_versions(Obj_Entry *o vn = obj->verneed; while (vn != NULL) { depobj = locate_dependency(obj, obj->strtab + vn->vn_file); + if (depobj == NULL) + return (-1); vna = (const Elf_Vernaux *) ((char *)vn + vn->vn_aux); for (;;) { if (check_object_provided_version(obj, depobj, vna)) From owner-svn-src-head@FreeBSD.ORG Sun Jan 30 16:21:26 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 096141065696; Sun, 30 Jan 2011 16:21:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EDE558FC12; Sun, 30 Jan 2011 16:21:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0UGLPDc077475; Sun, 30 Jan 2011 16:21:25 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0UGLPwB077473; Sun, 30 Jan 2011 16:21:25 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201101301621.p0UGLPwB077473@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 30 Jan 2011 16:21:25 +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: r218099 - head/libexec/rtld-elf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 16:21:26 -0000 Author: kib Date: Sun Jan 30 16:21:25 2011 New Revision: 218099 URL: http://svn.freebsd.org/changeset/base/218099 Log: Fix grammar in comment. Pointy hat to: kib MFC after: 1 week Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Sun Jan 30 16:14:09 2011 (r218098) +++ head/libexec/rtld-elf/rtld.c Sun Jan 30 16:21:25 2011 (r218099) @@ -3711,7 +3711,7 @@ locate_dependency(const Obj_Entry *obj, * we are all set. Note that object might not be found if * dependency was not loaded yet, so the function can * return NULL here. This is expected and handled - * properly in caller. + * properly by the caller. */ return (needed->obj); } From owner-svn-src-head@FreeBSD.ORG Sun Jan 30 18:17:39 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CFCF106566B; Sun, 30 Jan 2011 18:17:39 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0283F8FC0C; Sun, 30 Jan 2011 18:17:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0UIHcBN080314; Sun, 30 Jan 2011 18:17:38 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0UIHcs3080311; Sun, 30 Jan 2011 18:17:38 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <201101301817.p0UIHcs3080311@svn.freebsd.org> From: Dmitry Chagin Date: Sun, 30 Jan 2011 18:17: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: r218100 - in head/sys: amd64/linux32 i386/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 18:17:39 -0000 Author: dchagin Date: Sun Jan 30 18:17:38 2011 New Revision: 218100 URL: http://svn.freebsd.org/changeset/base/218100 Log: The kern_wait() code already removes the SIGCHLD signal for the waited process. Removing other SIGCHLD signals is not needed and may cause problems. Pointed out by: jilles MFC after: 1 Month. Modified: head/sys/amd64/linux32/linux32_machdep.c head/sys/i386/linux/linux_machdep.c Modified: head/sys/amd64/linux32/linux32_machdep.c ============================================================================== --- head/sys/amd64/linux32/linux32_machdep.c Sun Jan 30 16:21:25 2011 (r218099) +++ head/sys/amd64/linux32/linux32_machdep.c Sun Jan 30 18:17:38 2011 (r218100) @@ -1283,7 +1283,6 @@ linux_wait4(struct thread *td, struct li int error, options; struct rusage ru, *rup; struct l_rusage lru; - struct proc *p; #ifdef DEBUG if (ldebug(wait4)) @@ -1304,12 +1303,6 @@ linux_wait4(struct thread *td, struct li error = linux_common_wait(td, args->pid, args->status, options, rup); if (error) return (error); - - p = td->td_proc; - PROC_LOCK(p); - sigqueue_delete(&p->p_sigqueue, SIGCHLD); - PROC_UNLOCK(p); - if (args->rusage != NULL) { bsd_to_linux_rusage(rup, &lru); error = copyout(&lru, args->rusage, sizeof(lru)); Modified: head/sys/i386/linux/linux_machdep.c ============================================================================== --- head/sys/i386/linux/linux_machdep.c Sun Jan 30 16:21:25 2011 (r218099) +++ head/sys/i386/linux/linux_machdep.c Sun Jan 30 18:17:38 2011 (r218100) @@ -1318,7 +1318,6 @@ linux_wait4(struct thread *td, struct li { int error, options; struct rusage ru, *rup; - struct proc *p; #ifdef DEBUG if (ldebug(wait4)) @@ -1339,12 +1338,6 @@ linux_wait4(struct thread *td, struct li error = linux_common_wait(td, args->pid, args->status, options, rup); if (error) return (error); - - p = td->td_proc; - PROC_LOCK(p); - sigqueue_delete(&p->p_sigqueue, SIGCHLD); - PROC_UNLOCK(p); - if (args->rusage != NULL) error = copyout(&ru, args->rusage, sizeof(ru)); From owner-svn-src-head@FreeBSD.ORG Sun Jan 30 20:31:43 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97F8C106564A; Sun, 30 Jan 2011 20:31:43 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D9368FC0C; Sun, 30 Jan 2011 20:31:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0UKVhgY084798; Sun, 30 Jan 2011 20:31:43 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0UKVh2C084795; Sun, 30 Jan 2011 20:31:43 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <201101302031.p0UKVh2C084795@svn.freebsd.org> From: Dmitry Chagin Date: Sun, 30 Jan 2011 20:31:43 +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: r218101 - in head/sys: amd64/linux32 i386/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 20:31:43 -0000 Author: dchagin Date: Sun Jan 30 20:31:43 2011 New Revision: 218101 URL: http://svn.freebsd.org/changeset/base/218101 Log: Change linux futex syscall definition to match actual linux one. MFC after: 1 Month. Modified: head/sys/amd64/linux32/syscalls.master head/sys/i386/linux/syscalls.master Modified: head/sys/amd64/linux32/syscalls.master ============================================================================== --- head/sys/amd64/linux32/syscalls.master Sun Jan 30 18:17:38 2011 (r218100) +++ head/sys/amd64/linux32/syscalls.master Sun Jan 30 20:31:43 2011 (r218101) @@ -405,8 +405,8 @@ 237 AUE_NULL STD { int linux_fremovexattr(void); } 238 AUE_NULL STD { int linux_tkill(int tid, int sig); } 239 AUE_SENDFILE UNIMPL linux_sendfile64 -240 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, int val, \ - struct l_timespec *timeout, void *uaddr2, int val3); } +240 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, uint32_t val, \ + struct l_timespec *timeout, uint32_t *uaddr2, uint32_t val3); } 241 AUE_NULL STD { int linux_sched_setaffinity(l_pid_t pid, l_uint len, \ l_ulong *user_mask_ptr); } 242 AUE_NULL STD { int linux_sched_getaffinity(l_pid_t pid, l_uint len, \ Modified: head/sys/i386/linux/syscalls.master ============================================================================== --- head/sys/i386/linux/syscalls.master Sun Jan 30 18:17:38 2011 (r218100) +++ head/sys/i386/linux/syscalls.master Sun Jan 30 20:31:43 2011 (r218101) @@ -407,8 +407,8 @@ 237 AUE_NULL STD { int linux_fremovexattr(void); } 238 AUE_NULL STD { int linux_tkill(int tid, int sig); } 239 AUE_SENDFILE UNIMPL linux_sendfile64 -240 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, int val, \ - struct l_timespec *timeout, void *uaddr2, int val3); } +240 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, uint32_t val, \ + struct l_timespec *timeout, uint32_t *uaddr2, uint32_t val3); } 241 AUE_NULL STD { int linux_sched_setaffinity(l_pid_t pid, l_uint len, \ l_ulong *user_mask_ptr); } 242 AUE_NULL STD { int linux_sched_getaffinity(l_pid_t pid, l_uint len, \ From owner-svn-src-head@FreeBSD.ORG Sun Jan 30 20:38:27 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2985C106566C; Sun, 30 Jan 2011 20:38:27 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F34E08FC15; Sun, 30 Jan 2011 20:38:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0UKcQG1085050; Sun, 30 Jan 2011 20:38:26 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0UKcQfL085047; Sun, 30 Jan 2011 20:38:26 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <201101302038.p0UKcQfL085047@svn.freebsd.org> From: Dmitry Chagin Date: Sun, 30 Jan 2011 20:38:26 +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: r218103 - in head/sys: amd64/linux32 i386/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 20:38:27 -0000 Author: dchagin Date: Sun Jan 30 20:38:26 2011 New Revision: 218103 URL: http://svn.freebsd.org/changeset/base/218103 Log: Regen for r218101. MFC after: 1 Month. Modified: head/sys/amd64/linux32/linux32_proto.h head/sys/i386/linux/linux_proto.h Modified: head/sys/amd64/linux32/linux32_proto.h ============================================================================== --- head/sys/amd64/linux32/linux32_proto.h Sun Jan 30 20:37:42 2011 (r218102) +++ head/sys/amd64/linux32/linux32_proto.h Sun Jan 30 20:38:26 2011 (r218103) @@ -734,10 +734,10 @@ struct linux_tkill_args { struct linux_sys_futex_args { char uaddr_l_[PADL_(void *)]; void * uaddr; char uaddr_r_[PADR_(void *)]; char op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)]; - char val_l_[PADL_(int)]; int val; char val_r_[PADR_(int)]; + char val_l_[PADL_(uint32_t)]; uint32_t val; char val_r_[PADR_(uint32_t)]; char timeout_l_[PADL_(struct l_timespec *)]; struct l_timespec * timeout; char timeout_r_[PADR_(struct l_timespec *)]; - char uaddr2_l_[PADL_(void *)]; void * uaddr2; char uaddr2_r_[PADR_(void *)]; - char val3_l_[PADL_(int)]; int val3; char val3_r_[PADR_(int)]; + char uaddr2_l_[PADL_(uint32_t *)]; uint32_t * uaddr2; char uaddr2_r_[PADR_(uint32_t *)]; + char val3_l_[PADL_(uint32_t)]; uint32_t val3; char val3_r_[PADR_(uint32_t)]; }; struct linux_sched_setaffinity_args { char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; Modified: head/sys/i386/linux/linux_proto.h ============================================================================== --- head/sys/i386/linux/linux_proto.h Sun Jan 30 20:37:42 2011 (r218102) +++ head/sys/i386/linux/linux_proto.h Sun Jan 30 20:38:26 2011 (r218103) @@ -731,10 +731,10 @@ struct linux_tkill_args { struct linux_sys_futex_args { char uaddr_l_[PADL_(void *)]; void * uaddr; char uaddr_r_[PADR_(void *)]; char op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)]; - char val_l_[PADL_(int)]; int val; char val_r_[PADR_(int)]; + char val_l_[PADL_(uint32_t)]; uint32_t val; char val_r_[PADR_(uint32_t)]; char timeout_l_[PADL_(struct l_timespec *)]; struct l_timespec * timeout; char timeout_r_[PADR_(struct l_timespec *)]; - char uaddr2_l_[PADL_(void *)]; void * uaddr2; char uaddr2_r_[PADR_(void *)]; - char val3_l_[PADL_(int)]; int val3; char val3_r_[PADR_(int)]; + char uaddr2_l_[PADL_(uint32_t *)]; uint32_t * uaddr2; char uaddr2_r_[PADR_(uint32_t *)]; + char val3_l_[PADL_(uint32_t)]; uint32_t val3; char val3_r_[PADR_(uint32_t)]; }; struct linux_sched_setaffinity_args { char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; From owner-svn-src-head@FreeBSD.ORG Sun Jan 30 20:43:45 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id A3473106566C; Sun, 30 Jan 2011 20:43:45 +0000 (UTC) Date: Sun, 30 Jan 2011 20:43:45 +0000 From: Alexander Best To: Dmitry Chagin Message-ID: <20110130204345.GA29544@freebsd.org> References: <201101302031.p0UKVh2C084795@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201101302031.p0UKVh2C084795@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r218101 - in head/sys: amd64/linux32 i386/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 20:43:45 -0000 On Sun Jan 30 11, Dmitry Chagin wrote: > Author: dchagin > Date: Sun Jan 30 20:31:43 2011 > New Revision: 218101 > URL: http://svn.freebsd.org/changeset/base/218101 > > Log: > Change linux futex syscall definition to match actual linux one. nice catch. i'll adjust my FUTEX_WAIT_BITSET/FUTEX_WAKE_BITSET patch accordingly. cheers. alex > > MFC after: 1 Month. > > Modified: > head/sys/amd64/linux32/syscalls.master > head/sys/i386/linux/syscalls.master > > Modified: head/sys/amd64/linux32/syscalls.master > ============================================================================== > --- head/sys/amd64/linux32/syscalls.master Sun Jan 30 18:17:38 2011 (r218100) > +++ head/sys/amd64/linux32/syscalls.master Sun Jan 30 20:31:43 2011 (r218101) > @@ -405,8 +405,8 @@ > 237 AUE_NULL STD { int linux_fremovexattr(void); } > 238 AUE_NULL STD { int linux_tkill(int tid, int sig); } > 239 AUE_SENDFILE UNIMPL linux_sendfile64 > -240 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, int val, \ > - struct l_timespec *timeout, void *uaddr2, int val3); } > +240 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, uint32_t val, \ > + struct l_timespec *timeout, uint32_t *uaddr2, uint32_t val3); } > 241 AUE_NULL STD { int linux_sched_setaffinity(l_pid_t pid, l_uint len, \ > l_ulong *user_mask_ptr); } > 242 AUE_NULL STD { int linux_sched_getaffinity(l_pid_t pid, l_uint len, \ > > Modified: head/sys/i386/linux/syscalls.master > ============================================================================== > --- head/sys/i386/linux/syscalls.master Sun Jan 30 18:17:38 2011 (r218100) > +++ head/sys/i386/linux/syscalls.master Sun Jan 30 20:31:43 2011 (r218101) > @@ -407,8 +407,8 @@ > 237 AUE_NULL STD { int linux_fremovexattr(void); } > 238 AUE_NULL STD { int linux_tkill(int tid, int sig); } > 239 AUE_SENDFILE UNIMPL linux_sendfile64 > -240 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, int val, \ > - struct l_timespec *timeout, void *uaddr2, int val3); } > +240 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, uint32_t val, \ > + struct l_timespec *timeout, uint32_t *uaddr2, uint32_t val3); } > 241 AUE_NULL STD { int linux_sched_setaffinity(l_pid_t pid, l_uint len, \ > l_ulong *user_mask_ptr); } > 242 AUE_NULL STD { int linux_sched_getaffinity(l_pid_t pid, l_uint len, \ -- a13x From owner-svn-src-head@FreeBSD.ORG Sun Jan 30 20:51:13 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 5E339106567A; Sun, 30 Jan 2011 20:51:13 +0000 (UTC) Date: Sun, 30 Jan 2011 20:51:13 +0000 From: Alexander Best To: Dmitry Chagin Message-ID: <20110130205113.GA30126@freebsd.org> References: <201101302031.p0UKVh2C084795@svn.freebsd.org> <20110130204345.GA29544@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110130204345.GA29544@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r218101 - in head/sys: amd64/linux32 i386/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 20:51:13 -0000 On Sun Jan 30 11, Alexander Best wrote: > On Sun Jan 30 11, Dmitry Chagin wrote: > > Author: dchagin > > Date: Sun Jan 30 20:31:43 2011 > > New Revision: 218101 > > URL: http://svn.freebsd.org/changeset/base/218101 > > > > Log: > > Change linux futex syscall definition to match actual linux one. > > nice catch. i'll adjust my FUTEX_WAIT_BITSET/FUTEX_WAKE_BITSET patch > accordingly. oh...and also you might want to have a look at the LINUX_CTR* occurrences, where val3 gets output. i think you can turn lots of "%d"s to "%u"s. > > cheers. > alex > > > > > MFC after: 1 Month. > > > > Modified: > > head/sys/amd64/linux32/syscalls.master > > head/sys/i386/linux/syscalls.master > > > > Modified: head/sys/amd64/linux32/syscalls.master > > ============================================================================== > > --- head/sys/amd64/linux32/syscalls.master Sun Jan 30 18:17:38 2011 (r218100) > > +++ head/sys/amd64/linux32/syscalls.master Sun Jan 30 20:31:43 2011 (r218101) > > @@ -405,8 +405,8 @@ > > 237 AUE_NULL STD { int linux_fremovexattr(void); } > > 238 AUE_NULL STD { int linux_tkill(int tid, int sig); } > > 239 AUE_SENDFILE UNIMPL linux_sendfile64 > > -240 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, int val, \ > > - struct l_timespec *timeout, void *uaddr2, int val3); } > > +240 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, uint32_t val, \ > > + struct l_timespec *timeout, uint32_t *uaddr2, uint32_t val3); } > > 241 AUE_NULL STD { int linux_sched_setaffinity(l_pid_t pid, l_uint len, \ > > l_ulong *user_mask_ptr); } > > 242 AUE_NULL STD { int linux_sched_getaffinity(l_pid_t pid, l_uint len, \ > > > > Modified: head/sys/i386/linux/syscalls.master > > ============================================================================== > > --- head/sys/i386/linux/syscalls.master Sun Jan 30 18:17:38 2011 (r218100) > > +++ head/sys/i386/linux/syscalls.master Sun Jan 30 20:31:43 2011 (r218101) > > @@ -407,8 +407,8 @@ > > 237 AUE_NULL STD { int linux_fremovexattr(void); } > > 238 AUE_NULL STD { int linux_tkill(int tid, int sig); } > > 239 AUE_SENDFILE UNIMPL linux_sendfile64 > > -240 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, int val, \ > > - struct l_timespec *timeout, void *uaddr2, int val3); } > > +240 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, uint32_t val, \ > > + struct l_timespec *timeout, uint32_t *uaddr2, uint32_t val3); } > > 241 AUE_NULL STD { int linux_sched_setaffinity(l_pid_t pid, l_uint len, \ > > l_ulong *user_mask_ptr); } > > 242 AUE_NULL STD { int linux_sched_getaffinity(l_pid_t pid, l_uint len, \ > > -- > a13x -- a13x From owner-svn-src-head@FreeBSD.ORG Sun Jan 30 22:57:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7FD36106564A; Sun, 30 Jan 2011 22:57:53 +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 6F7488FC1A; Sun, 30 Jan 2011 22:57:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0UMvr70088269; Sun, 30 Jan 2011 22:57:53 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0UMvr79088266; Sun, 30 Jan 2011 22:57:53 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201101302257.p0UMvr79088266@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 30 Jan 2011 22:57: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: r218105 - in head: bin/sh tools/regression/bin/sh/execution X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 22:57:53 -0000 Author: jilles Date: Sun Jan 30 22:57:52 2011 New Revision: 218105 URL: http://svn.freebsd.org/changeset/base/218105 Log: sh: Send messages about signals to stderr. This is required by POSIX and seems to make more sense. See also r217557. Added: head/tools/regression/bin/sh/execution/killed2.0 (contents, props changed) Modified: head/bin/sh/jobs.c Modified: head/bin/sh/jobs.c ============================================================================== --- head/bin/sh/jobs.c Sun Jan 30 21:00:57 2011 (r218104) +++ head/bin/sh/jobs.c Sun Jan 30 22:57:52 2011 (r218105) @@ -1056,13 +1056,13 @@ dowait(int block, struct job *job) } if (sig > 0 && sig != SIGINT && sig != SIGPIPE) { if (sig < sys_nsig && sys_siglist[sig]) - out1str(sys_siglist[sig]); + out2str(sys_siglist[sig]); else - out1fmt("Signal %d", sig); + outfmt(out2, "Signal %d", sig); if (coredump) - out1str(" (core dumped)"); - out1c('\n'); - flushout(out1); + out2str(" (core dumped)"); + out2c('\n'); + flushout(out2); } } else { TRACE(("Not printing status, rootshell=%d, job=%p\n", rootshell, job)); Added: head/tools/regression/bin/sh/execution/killed2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/killed2.0 Sun Jan 30 22:57:52 2011 (r218105) @@ -0,0 +1,10 @@ +# $FreeBSD$ +# Most shells print a message when a foreground job is killed by a signal. +# POSIX allows this, provided the message is sent to stderr, not stdout. +# Some trickery is needed to capture the message as redirecting stderr of +# the command itself does not affect it. The colon command ensures that +# the subshell forks for ${SH}. + +exec 3>&1 +r=`(${SH} -c 'kill $$'; :) 2>&1 >&3` +[ -n "$r" ] From owner-svn-src-head@FreeBSD.ORG Sun Jan 30 23:55:48 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A777C1065670; Sun, 30 Jan 2011 23:55:48 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 983E38FC08; Sun, 30 Jan 2011 23:55:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0UNtmpQ090457; Sun, 30 Jan 2011 23:55:48 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0UNtm9G090455; Sun, 30 Jan 2011 23:55:48 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201101302355.p0UNtm9G090455@svn.freebsd.org> From: Alan Cox Date: Sun, 30 Jan 2011 23:55:48 +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: r218113 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 23:55:48 -0000 Author: alc Date: Sun Jan 30 23:55:48 2011 New Revision: 218113 URL: http://svn.freebsd.org/changeset/base/218113 Log: Release the free page queues lock earlier in vm_page_alloc(). Discussed with: kib@ Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Jan 30 23:29:45 2011 (r218112) +++ head/sys/vm/vm_page.c Sun Jan 30 23:55:48 2011 (r218113) @@ -1318,7 +1318,8 @@ vm_page_alloc(vm_object_t object, vm_pin } /* - * Initialize structure. Only the PG_ZERO flag is inherited. + * Only the PG_ZERO flag is inherited. The PG_CACHED or PG_FREE flag + * must be cleared before the free page queues lock is released. */ flags = 0; if (m->flags & PG_ZERO) { @@ -1329,15 +1330,19 @@ vm_page_alloc(vm_object_t object, vm_pin if (object == NULL || object->type == OBJT_PHYS) flags |= PG_UNMANAGED; m->flags = flags; + mtx_unlock(&vm_page_queue_free_mtx); if (req & (VM_ALLOC_NOBUSY | VM_ALLOC_NOOBJ)) m->oflags = 0; else m->oflags = VPO_BUSY; if (req & VM_ALLOC_WIRED) { + /* + * The page lock is not required for wiring a page until that + * page is inserted into the object. + */ atomic_add_int(&cnt.v_wire_count, 1); m->wire_count = 1; } - mtx_unlock(&vm_page_queue_free_mtx); m->act_count = 0; if (object != NULL) { From owner-svn-src-head@FreeBSD.ORG Mon Jan 31 00:09:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F2A01065670; Mon, 31 Jan 2011 00:09:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 050E08FC16; Mon, 31 Jan 2011 00:09:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0V09q2W091018; Mon, 31 Jan 2011 00:09:52 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0V09qia091016; Mon, 31 Jan 2011 00:09:52 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201101310009.p0V09qia091016@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 31 Jan 2011 00:09:52 +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: r218114 - head/sys/compat/linprocfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jan 2011 00:09:53 -0000 Author: bz Date: Mon Jan 31 00:09:52 2011 New Revision: 218114 URL: http://svn.freebsd.org/changeset/base/218114 Log: Update interface stats counters to match the current format in linux and try to export as much information as we can match. Requested on: Debian GNU/kFreeBSD list (debian-bsd lists.debian.org) 2010-12 Tested by: Mats Erik Andersson (mats.andersson gisladisker.se) MFC after: 10 days Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Sun Jan 30 23:55:48 2011 (r218113) +++ head/sys/compat/linprocfs/linprocfs.c Mon Jan 31 00:09:52 2011 (r218114) @@ -1215,20 +1215,43 @@ linprocfs_donetdev(PFS_FILL_ARGS) char ifname[16]; /* XXX LINUX_IFNAMSIZ */ struct ifnet *ifp; - sbuf_printf(sb, "%6s|%58s|%s\n%6s|%58s|%58s\n", - "Inter-", " Receive", " Transmit", " face", - "bytes packets errs drop fifo frame compressed", - "bytes packets errs drop fifo frame compressed"); + sbuf_printf(sb, "%6s|%58s|%s\n" + "%6s|%58s|%58s\n", + "Inter-", " Receive", " Transmit", + " face", + "bytes packets errs drop fifo frame compressed multicast", + "bytes packets errs drop fifo colls carrier compressed"); CURVNET_SET(TD_TO_VNET(curthread)); IFNET_RLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { linux_ifname(ifp, ifname, sizeof ifname); - sbuf_printf(sb, "%6.6s:", ifname); - sbuf_printf(sb, "%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu ", - 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL); + sbuf_printf(sb, "%6.6s: ", ifname); + sbuf_printf(sb, "%7lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu ", + ifp->if_ibytes, /* rx_bytes */ + ifp->if_ipackets, /* rx_packets */ + ifp->if_ierrors, /* rx_errors */ + ifp->if_iqdrops, /* rx_dropped + + * rx_missed_errors */ + 0UL, /* rx_fifo_errors */ + 0UL, /* rx_length_errors + + * rx_over_errors + + * rx_crc_errors + + * rx_frame_errors */ + 0UL, /* rx_compressed */ + ifp->if_imcasts); /* multicast, XXX-BZ rx only? */ sbuf_printf(sb, "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n", - 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL); + ifp->if_obytes, /* tx_bytes */ + ifp->if_opackets, /* tx_packets */ + ifp->if_oerrors, /* tx_errors */ + 0UL, /* tx_dropped */ + 0UL, /* tx_fifo_errors */ + ifp->if_collisions, /* collisions */ + 0UL, /* tx_carrier_errors + + * tx_aborted_errors + + * tx_window_errors + + * tx_heartbeat_errors */ + 0UL); /* tx_compressed */ } IFNET_RUNLOCK(); CURVNET_RESTORE(); From owner-svn-src-head@FreeBSD.ORG Mon Jan 31 05:59:06 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F5E61065672; Mon, 31 Jan 2011 05:59:06 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F2D658FC0A; Mon, 31 Jan 2011 05:59:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0V5x58S009272; Mon, 31 Jan 2011 05:59:05 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0V5x5kt009269; Mon, 31 Jan 2011 05:59:05 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <201101310559.p0V5x5kt009269@svn.freebsd.org> From: Dmitry Chagin Date: Mon, 31 Jan 2011 05:59:05 +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: r218117 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jan 2011 05:59:06 -0000 Author: dchagin Date: Mon Jan 31 05:59:05 2011 New Revision: 218117 URL: http://svn.freebsd.org/changeset/base/218117 Log: Implement a futex BITSET op. Submitted by: arundel MFC after: 1 month. Modified: head/sys/compat/linux/linux_futex.c head/sys/compat/linux/linux_futex.h Modified: head/sys/compat/linux/linux_futex.c ============================================================================== --- head/sys/compat/linux/linux_futex.c Mon Jan 31 00:29:11 2011 (r218116) +++ head/sys/compat/linux/linux_futex.c Mon Jan 31 05:59:05 2011 (r218117) @@ -79,6 +79,7 @@ struct futex { struct sx f_lck; uint32_t *f_uaddr; uint32_t f_refcount; + uint32_t f_bitset; LIST_ENTRY(futex) f_list; TAILQ_HEAD(lf_waiting_proc, waiting_proc) f_waiting_proc; }; @@ -264,15 +265,25 @@ futex_sleep(struct futex *f, struct wait } static int -futex_wake(struct futex *f, int n) +futex_wake(struct futex *f, int n, uint32_t bitset) { struct waiting_proc *wp, *wpt; int count = 0; + if (bitset == 0) + return (EINVAL); + FUTEX_ASSERT_LOCKED(f); TAILQ_FOREACH_SAFE(wp, &f->f_waiting_proc, wp_list, wpt) { LINUX_CTR3(sys_futex, "futex_wake uaddr %p wp %p ref %d", f->f_uaddr, wp, f->f_refcount); + /* + * Unless we find a matching bit in + * the bitset, continue searching. + */ + if (!(wp->wp_futex->f_bitset & bitset)) + continue; + wp->wp_flags |= FUTEX_WP_REMOVED; TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list); wakeup_one(wp); @@ -325,13 +336,18 @@ futex_requeue(struct futex *f, int n, st } static int -futex_wait(struct futex *f, struct waiting_proc *wp, struct l_timespec *ts) +futex_wait(struct futex *f, struct waiting_proc *wp, struct l_timespec *ts, + uint32_t bitset) { struct l_timespec timeout; struct timeval tv; int timeout_hz; int error; + if (bitset == 0) + return (EINVAL); + f->f_bitset = bitset; + if (ts != NULL) { error = copyin(ts, &timeout, sizeof(timeout)); if (error) @@ -445,13 +461,18 @@ linux_sys_futex(struct thread *td, struc switch (args->op) { case LINUX_FUTEX_WAIT: + args->val3 = FUTEX_BITSET_MATCH_ANY; + /* FALLTHROUGH */ + + case LINUX_FUTEX_WAIT_BITSET: - LINUX_CTR2(sys_futex, "WAIT val %d uaddr %p", - args->val, args->uaddr); + LINUX_CTR3(sys_futex, "WAIT uaddr %p val %d val3 %d", + args->uaddr, args->val, args->val3); #ifdef DEBUG if (ldebug(sys_futex)) - printf(ARGS(sys_futex, "futex_wait val %d uaddr %p"), - args->val, args->uaddr); + printf(ARGS(sys_futex, + "futex_wait uaddr %p val %d val3 %d"), + args->uaddr, args->val, args->val3); #endif error = futex_get(args->uaddr, &wp, &f, FUTEX_CREATE_WP); if (error) @@ -464,19 +485,24 @@ linux_sys_futex(struct thread *td, struc return (error); } if (val != args->val) { - LINUX_CTR3(sys_futex, "WAIT uaddr %p val %d != uval %d", - args->uaddr, args->val, val); + LINUX_CTR4(sys_futex, + "WAIT uaddr %p val %d != uval %d val3 %d", + args->uaddr, args->val, val, args->val3); futex_put(f, wp); return (EWOULDBLOCK); } - error = futex_wait(f, wp, args->timeout); + error = futex_wait(f, wp, args->timeout, args->val3); break; case LINUX_FUTEX_WAKE: + args->val3 = FUTEX_BITSET_MATCH_ANY; + /* FALLTHROUGH */ + + case LINUX_FUTEX_WAKE_BITSET: - LINUX_CTR2(sys_futex, "WAKE val %d uaddr %p", - args->val, args->uaddr); + LINUX_CTR3(sys_futex, "WAKE uaddr %p val % d val3 %d", + args->uaddr, args->val, args->val3); /* * XXX: Linux is able to cope with different addresses @@ -485,8 +511,8 @@ linux_sys_futex(struct thread *td, struc */ #ifdef DEBUG if (ldebug(sys_futex)) - printf(ARGS(sys_futex, "futex_wake val %d uaddr %p"), - args->val, args->uaddr); + printf(ARGS(sys_futex, "futex_wake uaddr %p val %d val3 %d"), + args->uaddr, args->val, args->val3); #endif error = futex_get(args->uaddr, NULL, &f, FUTEX_DONTCREATE); if (error) @@ -495,7 +521,7 @@ linux_sys_futex(struct thread *td, struc td->td_retval[0] = 0; return (error); } - td->td_retval[0] = futex_wake(f, args->val); + td->td_retval[0] = futex_wake(f, args->val, args->val3); futex_put(f, NULL); break; @@ -603,16 +629,16 @@ linux_sys_futex(struct thread *td, struc return (EFAULT); } - ret = futex_wake(f, args->val); + ret = futex_wake(f, args->val, args->val3); if (op_ret > 0) { op_ret = 0; nrwake = (int)(unsigned long)args->timeout; if (f2 != NULL) - op_ret += futex_wake(f2, nrwake); + op_ret += futex_wake(f2, nrwake, args->val3); else - op_ret += futex_wake(f, nrwake); + op_ret += futex_wake(f, nrwake, args->val3); ret += op_ret; } @@ -660,13 +686,6 @@ linux_sys_futex(struct thread *td, struc } return (EINVAL); - case LINUX_FUTEX_WAIT_BITSET: - /* not yet implemented */ - linux_msg(td, - "linux_sys_futex: " - "op FUTEX_WAIT_BITSET not implemented\n"); - return (ENOSYS); - case LINUX_FUTEX_WAIT_REQUEUE_PI: /* not yet implemented */ linux_msg(td, @@ -775,7 +794,7 @@ retry: if (error) return (error); if (f != NULL) { - futex_wake(f, 1); + futex_wake(f, 1, FUTEX_BITSET_MATCH_ANY); futex_put(f, NULL); } } Modified: head/sys/compat/linux/linux_futex.h ============================================================================== --- head/sys/compat/linux/linux_futex.h Mon Jan 31 00:29:11 2011 (r218116) +++ head/sys/compat/linux/linux_futex.h Mon Jan 31 05:59:05 2011 (r218117) @@ -49,6 +49,7 @@ extern struct mtx futex_mtx; #define LINUX_FUTEX_UNLOCK_PI 7 #define LINUX_FUTEX_TRYLOCK_PI 8 #define LINUX_FUTEX_WAIT_BITSET 9 +#define LINUX_FUTEX_WAKE_BITSET 10 #define LINUX_FUTEX_WAIT_REQUEUE_PI 11 #define LINUX_FUTEX_PRIVATE_FLAG 128 @@ -72,6 +73,7 @@ extern struct mtx futex_mtx; #define FUTEX_WAITERS 0x80000000 #define FUTEX_OWNER_DIED 0x40000000 #define FUTEX_TID_MASK 0x3fffffff +#define FUTEX_BITSET_MATCH_ANY 0xffffffff void release_futexes(struct proc *); From owner-svn-src-head@FreeBSD.ORG Mon Jan 31 06:06:23 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CF0E106566B; Mon, 31 Jan 2011 06:06:23 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D6248FC1B; Mon, 31 Jan 2011 06:06:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0V66NhI009577; Mon, 31 Jan 2011 06:06:23 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0V66N9E009574; Mon, 31 Jan 2011 06:06:23 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <201101310606.p0V66N9E009574@svn.freebsd.org> From: Dmitry Chagin Date: Mon, 31 Jan 2011 06:06: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: r218118 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jan 2011 06:06:23 -0000 Author: dchagin Date: Mon Jan 31 06:06:23 2011 New Revision: 218118 URL: http://svn.freebsd.org/changeset/base/218118 Log: Yet another unimplemented futex operation, print out about. Submitted by: arundel MFC after: 1 month. Modified: head/sys/compat/linux/linux_futex.c head/sys/compat/linux/linux_futex.h Modified: head/sys/compat/linux/linux_futex.c ============================================================================== --- head/sys/compat/linux/linux_futex.c Mon Jan 31 05:59:05 2011 (r218117) +++ head/sys/compat/linux/linux_futex.c Mon Jan 31 06:06:23 2011 (r218118) @@ -693,6 +693,13 @@ linux_sys_futex(struct thread *td, struc "op FUTEX_WAIT_REQUEUE_PI not implemented\n"); return (ENOSYS); + case LINUX_FUTEX_CMP_REQUEUE_PI: + /* not yet implemented */ + linux_msg(td, + "linux_sys_futex: " + "op LINUX_FUTEX_CMP_REQUEUE_PI not implemented\n"); + return (ENOSYS); + default: linux_msg(td, "linux_sys_futex: unknown op %d\n", args->op); Modified: head/sys/compat/linux/linux_futex.h ============================================================================== --- head/sys/compat/linux/linux_futex.h Mon Jan 31 05:59:05 2011 (r218117) +++ head/sys/compat/linux/linux_futex.h Mon Jan 31 06:06:23 2011 (r218118) @@ -51,6 +51,7 @@ extern struct mtx futex_mtx; #define LINUX_FUTEX_WAIT_BITSET 9 #define LINUX_FUTEX_WAKE_BITSET 10 #define LINUX_FUTEX_WAIT_REQUEUE_PI 11 +#define LINUX_FUTEX_CMP_REQUEUE_PI 12 #define LINUX_FUTEX_PRIVATE_FLAG 128 #define LINUX_FUTEX_CLOCK_REALTIME 256 From owner-svn-src-head@FreeBSD.ORG Mon Jan 31 07:47:29 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6FA8106564A; Mon, 31 Jan 2011 07:47:28 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 975E08FC14; Mon, 31 Jan 2011 07:47:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0V7lSWJ012633; Mon, 31 Jan 2011 07:47:28 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0V7lSpx012630; Mon, 31 Jan 2011 07:47:28 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201101310747.p0V7lSpx012630@svn.freebsd.org> From: Maxim Konovalov Date: Mon, 31 Jan 2011 07:47:28 +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: r218119 - in head/etc: . mail X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jan 2011 07:47:29 -0000 Author: maxim Date: Mon Jan 31 07:47:28 2011 New Revision: 218119 URL: http://svn.freebsd.org/changeset/base/218119 Log: o Add user 'hast'. Modified: head/etc/ftpusers head/etc/mail/aliases Modified: head/etc/ftpusers ============================================================================== --- head/etc/ftpusers Mon Jan 31 06:06:23 2011 (r218118) +++ head/etc/ftpusers Mon Jan 31 07:47:28 2011 (r218119) @@ -20,6 +20,7 @@ _dhcp uucp pop www +hast nobody mailnull smmsp Modified: head/etc/mail/aliases ============================================================================== --- head/etc/mail/aliases Mon Jan 31 06:06:23 2011 (r218118) +++ head/etc/mail/aliases Mon Jan 31 07:47:28 2011 (r218119) @@ -30,6 +30,7 @@ bin: root bind: root daemon: root games: root +hast: root kmem: root mailnull: postmaster man: root From owner-svn-src-head@FreeBSD.ORG Mon Jan 31 09:22:49 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA912106566B; Mon, 31 Jan 2011 09:22:49 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA82B8FC15; Mon, 31 Jan 2011 09:22:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0V9Mn3Q016087; Mon, 31 Jan 2011 09:22:49 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0V9MnrU016084; Mon, 31 Jan 2011 09:22:49 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201101310922.p0V9MnrU016084@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 31 Jan 2011 09:22: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: r218122 - head/contrib/tzdata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jan 2011 09:22:50 -0000 Author: edwin Date: Mon Jan 31 09:22:49 2011 New Revision: 218122 URL: http://svn.freebsd.org/changeset/base/218122 Log: MFV of tzdata2011a, r218120 - Cleanup rules for Australia/South_Australia (nothing changed) - Add historical information for Honolulu. Modified: head/contrib/tzdata/australasia head/contrib/tzdata/northamerica Directory Properties: head/contrib/tzdata/ (props changed) Modified: head/contrib/tzdata/australasia ============================================================================== --- head/contrib/tzdata/australasia Mon Jan 31 09:18:32 2011 (r218121) +++ head/contrib/tzdata/australasia Mon Jan 31 09:22:49 2011 (r218122) @@ -1,5 +1,5 @@ #
-# @(#)australasia	8.20
+# @(#)australasia	8.22
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -84,14 +84,13 @@ Rule	AS	1986	only	-	Oct	19	2:00s	1:00	-
 Rule	AS	1987	2007	-	Oct	lastSun	2:00s	1:00	-
 Rule	AS	1972	only	-	Feb	27	2:00s	0	-
 Rule	AS	1973	1985	-	Mar	Sun>=1	2:00s	0	-
-Rule	AS	1986	1989	-	Mar	Sun>=15	2:00s	0	-
-Rule	AS	1990	only	-	Mar	Sun>=18	2:00s	0	-
-Rule	AS	1991	only	-	Mar	Sun>=1	2:00s	0	-
-Rule	AS	1992	only	-	Mar	Sun>=18	2:00s	0	-
-Rule	AS	1993	only	-	Mar	Sun>=1	2:00s	0	-
-Rule	AS	1994	only	-	Mar	Sun>=18	2:00s	0	-
+Rule	AS	1986	1990	-	Mar	Sun>=15	2:00s	0	-
+Rule	AS	1991	only	-	Mar	3	2:00s	0	-
+Rule	AS	1992	only	-	Mar	22	2:00s	0	-
+Rule	AS	1993	only	-	Mar	7	2:00s	0	-
+Rule	AS	1994	only	-	Mar	20	2:00s	0	-
 Rule	AS	1995	2005	-	Mar	lastSun	2:00s	0	-
-Rule	AS	2006	only	-	Apr	Sun>=1	2:00s	0	-
+Rule	AS	2006	only	-	Apr	2	2:00s	0	-
 Rule	AS	2007	only	-	Mar	lastSun	2:00s	0	-
 Rule	AS	2008	max	-	Apr	Sun>=1	2:00s	0	-
 Rule	AS	2008	max	-	Oct	Sun>=1	2:00s	1:00	-

Modified: head/contrib/tzdata/northamerica
==============================================================================
--- head/contrib/tzdata/northamerica	Mon Jan 31 09:18:32 2011	(r218121)
+++ head/contrib/tzdata/northamerica	Mon Jan 31 09:22:49 2011	(r218122)
@@ -1,5 +1,5 @@
 # 
-# @(#)northamerica	8.34
+# %W%
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -471,20 +471,50 @@ Zone America/Adak	 12:13:21 -	LMT	1867 O
 #  three votes for and one against."
 
 # Hawaii
-#
-# From Arthur David Olson:
-# And then there's Hawaii.
-# DST was observed for one day in 1933;
-# standard time was changed by half an hour in 1947;
-# it's always standard as of 1986.
-#
-# From Paul Eggert:
-# Shanks says the 1933 experiment lasted for three weeks.  Go with Shanks.
-#
-Zone Pacific/Honolulu	-10:31:26 -	LMT	1900 Jan  1 12:00
-			-10:30	-	HST	1933 Apr 30 2:00
-			-10:30	1:00	HDT	1933 May 21 2:00
-			-10:30	US	H%sT	1947 Jun  8 2:00
+
+# From Arthur David Olson (2010-12-09):
+# "Hawaiian Time" by Robert C. Schmitt and Doak C. Cox appears on pages 207-225
+# of volume 26 of The Hawaiian Journal of History (1992). As of 2010-12-09,
+# the article is available at
+# 
+# http://evols.library.manoa.hawaii.edu/bitstream/10524/239/2/JL26215.pdf
+# 
+# and indicates that standard time was adopted effective noon, January
+# 13, 1896 (page 218), that in "1933, the Legislature decreed daylight
+# saving for the period between the last Sunday of each April and the
+# last Sunday of each September, but less than a month later repealed the
+# act," (page 220), that year-round daylight saving time was in effect
+# from 1942-02-09 to 1945-09-30 (page 221, with no time of day given for
+# when clocks changed) and that clocks were changed by 30 minutes
+# effective the second Sunday of June, 1947 (page 219, with no time of
+# day given for when clocks changed). A footnote for the 1933 changes
+# cites Session Laws of Hawaii 1933, "Act. 90 (approved 26 Apr. 1933)
+# and Act 163 (approved 21 May 1933)."
+
+# From Arthur David Olson (2011-01-19):
+# The following is from "Laws of the Territory of Hawaii Passed by the
+# Seventeenth Legislature: Regular Session 1933," available (as of
+# 2011-01-19) at American University's Pence Law Library. Page 85: "Act
+# 90...At 2 o'clock ante meridian of the last Sunday in April of each
+# year, the standard time of this Territory shall be advanced one
+# hour...This Act shall take effect upon its approval. Approved this 26th
+# day of April, A. D. 1933. LAWRENCE M JUDD, Governor of the Territory of
+# Hawaii." Page 172:  "Act 163...Act 90 of the Session Laws of 1933 is
+# hereby repealed...This Act shall take effect upon its approval, upon
+# which date the standard time of this Territory shall be restored to
+# that existing immediately prior to the taking effect of said Act 90.
+# Approved this 21st day of May, A. D. 1933. LAWRENCE M. JUDD, Governor
+# of the Territory of Hawaii."
+#
+# Note that 1933-05-21 was a Sunday.
+# We're left to guess the time of day when Act 163 was approved; guess noon.
+
+Zone Pacific/Honolulu	-10:31:26 -	LMT	1896 Jan 13 12:00 #Schmitt&Cox
+			-10:30	-	HST	1933 Apr 30 2:00 #Laws 1933
+			-10:30	1:00	HDT	1933 May 21 12:00 #Laws 1933+12
+			-10:30	-	HST	1942 Feb 09 2:00 #Schmitt&Cox+2
+			-10:30	1:00	HDT	1945 Sep 30 2:00 #Schmitt&Fox+2
+			-10:30	US	H%sT	1947 Jun  8 2:00 #Schmitt&Fox+2
 			-10:00	-	HST
 
 # Now we turn to US areas that have diverged from the consensus since 1970.

From owner-svn-src-head@FreeBSD.ORG  Mon Jan 31 09:58:05 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4128210656FE;
	Mon, 31 Jan 2011 09:58:05 +0000 (UTC)
	(envelope-from pawel@dawidek.net)
Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60])
	by mx1.freebsd.org (Postfix) with ESMTP id D3E038FC19;
	Mon, 31 Jan 2011 09:58:04 +0000 (UTC)
Received: by mail.garage.freebsd.pl (Postfix, from userid 65534)
	id 9953445C8A; Mon, 31 Jan 2011 10:58:01 +0100 (CET)
Received: from localhost (58.wheelsystems.com [83.12.187.58])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.garage.freebsd.pl (Postfix) with ESMTP id 9E3E645684;
	Mon, 31 Jan 2011 10:57:55 +0100 (CET)
Date: Mon, 31 Jan 2011 10:57:43 +0100
From: Pawel Jakub Dawidek 
To: Maxim Konovalov 
Message-ID: <20110131095743.GA1723@garage.freebsd.pl>
References: <201101310747.p0V7lSpx012630@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="2fHTh5uZTiUOsy+g"
Content-Disposition: inline
In-Reply-To: <201101310747.p0V7lSpx012630@svn.freebsd.org>
User-Agent: Mutt/1.4.2.3i
X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc
X-OS: FreeBSD 9.0-CURRENT amd64
X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on 
	mail.garage.freebsd.pl
X-Spam-Level: 
X-Spam-Status: No, score=-5.9 required=4.5 tests=ALL_TRUSTED,BAYES_00 
	autolearn=ham version=3.0.4
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218119 - in head/etc: . mail
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 31 Jan 2011 09:58:05 -0000


--2fHTh5uZTiUOsy+g
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jan 31, 2011 at 07:47:28AM +0000, Maxim Konovalov wrote:
> Author: maxim
> Date: Mon Jan 31 07:47:28 2011
> New Revision: 218119
> URL: http://svn.freebsd.org/changeset/base/218119
>=20
> Log:
>   o Add user 'hast'.

Thanks.

--=20
Pawel Jakub Dawidek                       http://www.wheelsystems.com
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

--2fHTh5uZTiUOsy+g
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (FreeBSD)

iEYEARECAAYFAk1Gh5cACgkQForvXbEpPzTvUgCg5yf++8+tomortRa48L/smsvo
T7IAnjaMQr+9Lp0i0OupggUuxvLqPNMJ
=OyQI
-----END PGP SIGNATURE-----

--2fHTh5uZTiUOsy+g--

From owner-svn-src-head@FreeBSD.ORG  Mon Jan 31 10:57:54 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9BB481065698;
	Mon, 31 Jan 2011 10:57:54 +0000 (UTC) (envelope-from mm@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8AE518FC24;
	Mon, 31 Jan 2011 10:57:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0VAvsJe020896;
	Mon, 31 Jan 2011 10:57:54 GMT (envelope-from mm@svn.freebsd.org)
Received: (from mm@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0VAvsQ4020891;
	Mon, 31 Jan 2011 10:57:54 GMT (envelope-from mm@svn.freebsd.org)
Message-Id: <201101311057.p0VAvsQ4020891@svn.freebsd.org>
From: Martin Matuska 
Date: Mon, 31 Jan 2011 10:57: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: r218127 - head/usr.sbin/newsyslog
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 31 Jan 2011 10:57:54 -0000

Author: mm
Date: Mon Jan 31 10:57:54 2011
New Revision: 218127
URL: http://svn.freebsd.org/changeset/base/218127

Log:
  Add xz(1) support to newsyslog.
  Rewrite and simplify logfile compression code.
  
  Approved by:	gad
  MFC after:	3 weeks

Modified:
  head/usr.sbin/newsyslog/newsyslog.8
  head/usr.sbin/newsyslog/newsyslog.c
  head/usr.sbin/newsyslog/newsyslog.conf.5
  head/usr.sbin/newsyslog/pathnames.h

Modified: head/usr.sbin/newsyslog/newsyslog.8
==============================================================================
--- head/usr.sbin/newsyslog/newsyslog.8	Mon Jan 31 10:18:42 2011	(r218126)
+++ head/usr.sbin/newsyslog/newsyslog.8	Mon Jan 31 10:57:54 2011	(r218127)
@@ -17,7 +17,7 @@
 .\" the suitability of this software for any purpose.  It is
 .\" provided "as is" without express or implied warranty.
 .\"
-.Dd July 23, 2010
+.Dd January 31, 2011
 .Dt NEWSYSLOG 8
 .Os
 .Sh NAME
@@ -277,6 +277,7 @@ names may contain the dot character.
 The dot (``.'') character is still
 accepted for backwards compatibility.
 .Sh SEE ALSO
+.Xr xz 1 ,
 .Xr bzip2 1 ,
 .Xr gzip 1 ,
 .Xr syslog 3 ,

Modified: head/usr.sbin/newsyslog/newsyslog.c
==============================================================================
--- head/usr.sbin/newsyslog/newsyslog.c	Mon Jan 31 10:18:42 2011	(r218126)
+++ head/usr.sbin/newsyslog/newsyslog.c	Mon Jan 31 10:57:54 2011	(r218127)
@@ -57,12 +57,6 @@
 __FBSDID("$FreeBSD$");
 
 #define	OSF
-#ifndef COMPRESS_POSTFIX
-#define	COMPRESS_POSTFIX ".gz"
-#endif
-#ifndef	BZCOMPRESS_POSTFIX
-#define	BZCOMPRESS_POSTFIX ".bz2"
-#endif
 
 #include 
 #include 
@@ -92,10 +86,35 @@ __FBSDID("$FreeBSD$");
 #include "extern.h"
 
 /*
+ * Compression suffixes
+ */
+#ifndef	COMPRESS_SUFFIX_GZ
+#define	COMPRESS_SUFFIX_GZ	".gz"
+#endif
+
+#ifndef	COMPRESS_SUFFIX_BZ2
+#define	COMPRESS_SUFFIX_BZ2	".bz2"
+#endif
+
+#ifndef	COMPRESS_SUFFIX_XZ
+#define	COMPRESS_SUFFIX_XZ	".xz"
+#endif
+
+#define	COMPRESS_SUFFIX_MAXLEN	MAX(MAX(sizeof(COMPRESS_SUFFIX_GZ),sizeof(COMPRESS_SUFFIX_BZ2)),sizeof(COMPRESS_SUFFIX_XZ))
+
+/*
+ * Compression types
+ */
+#define	COMPRESS_TYPES  4	/* Number of supported compression types */
+
+#define	COMPRESS_NONE	0
+#define	COMPRESS_GZIP	1
+#define	COMPRESS_BZIP2	2
+#define	COMPRESS_XZ	3
+
+/*
  * Bit-values for the 'flags' parsed from a config-file entry.
  */
-#define	CE_COMPACT	0x0001	/* Compact the archived log files with gzip. */
-#define	CE_BZCOMPACT	0x0002	/* Compact the archived log files with bzip2. */
 #define	CE_BINARY	0x0008	/* Logfile is in binary, do not add status */
 				/*    messages to logfile(s) when rotating. */
 #define	CE_NOSIGNAL	0x0010	/* There is no process to signal when */
@@ -119,6 +138,19 @@ __FBSDID("$FreeBSD$");
 
 #define	MAX_OLDLOGS 65536	/* Default maximum number of old logfiles */
 
+struct compress_types {
+	const char *flag;	/* Flag in configuration file */
+	const char *suffix;	/* Compression suffix */
+	const char *path;	/* Path to compression program */
+};
+
+const struct compress_types compress_type[COMPRESS_TYPES] = {
+	{ "", "", "" },					/* no compression */
+	{ "Z", COMPRESS_SUFFIX_GZ, _PATH_GZIP },	/* gzip compression */
+	{ "J", COMPRESS_SUFFIX_BZ2, _PATH_BZIP2 },	/* bzip2 compression */
+	{ "X", COMPRESS_SUFFIX_XZ, _PATH_XZ }		/* xz compression */
+};
+
 struct conf_entry {
 	STAILQ_ENTRY(conf_entry) cf_nextp;
 	char *log;		/* Name of the log */
@@ -134,7 +166,8 @@ struct conf_entry {
 	int hours;		/* Hours between log trimming */
 	struct ptime_data *trim_at;	/* Specific time to do trimming */
 	unsigned int permissions;	/* File permissions on the log */
-	int flags;		/* CE_COMPACT, CE_BZCOMPACT, CE_BINARY */
+	int flags;		/* CE_BINARY */
+	int compress;		/* Compression */
 	int sig;		/* Signal to send */
 	int def_cfg;		/* Using the  rule for this file */
 };
@@ -218,6 +251,7 @@ static int isnumberstr(const char *);
 static int isglobstr(const char *);
 static char *missing_field(char *p, char *errline);
 static void	 change_attrs(const char *, const struct conf_entry *);
+static const char *get_logfile_suffix(const char *logfile);
 static fk_entry	 do_entry(struct conf_entry *);
 static fk_entry	 do_rotate(const struct conf_entry *);
 static void	 do_sigwork(struct sigwork_entry *);
@@ -367,6 +401,7 @@ init_entry(const char *fname, struct con
 			tempwork->trim_at = ptime_init(src_entry->trim_at);
 		tempwork->permissions = src_entry->permissions;
 		tempwork->flags = src_entry->flags;
+		tempwork->compress = src_entry->compress;
 		tempwork->sig = src_entry->sig;
 		tempwork->def_cfg = src_entry->def_cfg;
 	} else {
@@ -384,6 +419,7 @@ init_entry(const char *fname, struct con
 		tempwork->trim_at = NULL;
 		tempwork->permissions = 0;
 		tempwork->flags = 0;
+		tempwork->compress = COMPRESS_NONE;
 		tempwork->sig = SIGHUP;
 		tempwork->def_cfg = 0;
 	}
@@ -448,14 +484,9 @@ do_entry(struct conf_entry * ent)
 	char temp_reason[REASON_MAX];
 
 	free_or_keep = FREE_ENT;
-	if (verbose) {
-		if (ent->flags & CE_COMPACT)
-			printf("%s <%dZ>: ", ent->log, ent->numlogs);
-		else if (ent->flags & CE_BZCOMPACT)
-			printf("%s <%dJ>: ", ent->log, ent->numlogs);
-		else
-			printf("%s <%d>: ", ent->log, ent->numlogs);
-	}
+	if (verbose)
+		printf("%s <%d%s>: ", ent->log, ent->numlogs,
+		    compress_type[ent->compress].flag);
 	ent->fsize = sizefile(ent->log);
 	modtime = age_old_log(ent->log);
 	ent->rotate = 0;
@@ -560,17 +591,10 @@ do_entry(struct conf_entry * ent)
 				ent->r_reason = strdup(temp_reason);
 			if (verbose)
 				printf("--> trimming log....\n");
-			if (noaction && !verbose) {
-				if (ent->flags & CE_COMPACT)
-					printf("%s <%dZ>: trimming\n",
-					    ent->log, ent->numlogs);
-				else if (ent->flags & CE_BZCOMPACT)
-					printf("%s <%dJ>: trimming\n",
-					    ent->log, ent->numlogs);
-				else
-					printf("%s <%d>: trimming\n",
-					    ent->log, ent->numlogs);
-			}
+			if (noaction && !verbose)
+				printf("%s <%d%s>: trimming\n", ent->log,
+				    ent->numlogs,
+				    compress_type[ent->compress].flag);
 			free_or_keep = do_rotate(ent);
 		} else {
 			if (verbose)
@@ -1183,6 +1207,7 @@ parse_file(FILE *cf, struct cflist *work
 		}
 
 		working->flags = 0;
+		working->compress = COMPRESS_NONE;
 		q = parse = missing_field(sob(++parse), errline);
 		parse = son(parse);
 		eol = !*parse;
@@ -1261,7 +1286,7 @@ no_trimat:
 				working->flags |= CE_GLOB;
 				break;
 			case 'j':
-				working->flags |= CE_BZCOMPACT;
+				working->compress = COMPRESS_BZIP2;
 				break;
 			case 'n':
 				working->flags |= CE_NOSIGNAL;
@@ -1272,8 +1297,11 @@ no_trimat:
 			case 'w':
 				/* Depreciated flag - keep for compatibility purposes */
 				break;
+			case 'x':
+				working->compress = COMPRESS_XZ;
+				break;
 			case 'z':
-				working->flags |= CE_COMPACT;
+				working->compress = COMPRESS_GZIP;
 				break;
 			case '-':
 				break;
@@ -1415,7 +1443,7 @@ static void
 delete_oldest_timelog(const struct conf_entry *ent, const char *archive_dir)
 {
 	char *logfname, *s, *dir, errbuf[80];
-	int logcnt, max_logcnt, dirfd, i;
+	int dirfd, i, logcnt, max_logcnt, valid;
 	struct oldlog_entry *oldlogs;
 	size_t logfname_len;
 	struct dirent *dp;
@@ -1485,9 +1513,12 @@ delete_oldest_timelog(const struct conf_
 				    "match time format\n", dp->d_name);
 			continue;
 		}
-		if (*s != '\0' && !(strcmp(s, BZCOMPRESS_POSTFIX) == 0 ||
-			strcmp(s, COMPRESS_POSTFIX) == 0))  {
-			    if (verbose)
+
+		for (int c = 0; c < COMPRESS_TYPES; c++)
+			if (strcmp(s, compress_type[c].suffix) == 0)
+				valid = 1;
+		if (valid != 1) {
+			if (verbose)
 				printf("Ignoring %s which has unexpected "
 				    "extension '%s'\n", dp->d_name, s);
 			continue;
@@ -1586,13 +1617,35 @@ add_to_queue(const char *fname, struct i
 	STAILQ_INSERT_TAIL(inclist, inc, inc_nextp);
 }
 
+/*
+ * Search for logfile and return its compression suffix (if supported)
+ * The suffix detection is first-match in the order of compress_types
+ *
+ * Note: if logfile without suffix exists (uncompressed, COMPRESS_NONE)
+ * a zero-length string is returned
+ */
+static const char *
+get_logfile_suffix(const char *logfile)
+{
+	struct stat st;
+	char zfile[MAXPATHLEN];
+
+	for (int c = 0; c < COMPRESS_TYPES; c++) {
+		(void) strlcpy(zfile, logfile, MAXPATHLEN);
+		(void) strlcat(zfile, compress_type[c].suffix, MAXPATHLEN);
+		if (lstat(zfile, &st) == 0)
+			return (compress_type[c].suffix);
+	}
+	return (NULL);
+}
+
 static fk_entry
 do_rotate(const struct conf_entry *ent)
 {
 	char dirpart[MAXPATHLEN], namepart[MAXPATHLEN];
 	char file1[MAXPATHLEN], file2[MAXPATHLEN];
 	char zfile1[MAXPATHLEN], zfile2[MAXPATHLEN];
-	char jfile1[MAXPATHLEN];
+	const char *logfile_suffix;
 	char datetimestr[30];
 	int flags, numlogs_c;
 	fk_entry free_or_keep;
@@ -1650,19 +1703,13 @@ do_rotate(const struct conf_entry *ent)
 		delete_oldest_timelog(ent, dirpart);
 	else {
 		/* name of oldest log */
-		(void) snprintf(zfile1, sizeof(zfile1), "%s%s", file1,
-		    COMPRESS_POSTFIX);
-		snprintf(jfile1, sizeof(jfile1), "%s%s", file1,
-		    BZCOMPRESS_POSTFIX);
-
-		if (noaction) {
-			printf("\trm -f %s\n", file1);
-			printf("\trm -f %s\n", zfile1);
-			printf("\trm -f %s\n", jfile1);
-		} else {
-			(void) unlink(file1);
-			(void) unlink(zfile1);
-			(void) unlink(jfile1);
+		for (int c = 0; c < COMPRESS_TYPES; c++) {
+			(void) snprintf(zfile1, sizeof(zfile1), "%s%s", file1,
+			    compress_type[c].suffix);
+			if (noaction)
+				printf("\trm -f %s\n", zfile1);
+			else
+				(void) unlink(zfile1);
 		}
 	}
 
@@ -1697,24 +1744,14 @@ do_rotate(const struct conf_entry *ent)
 			(void) snprintf(file1, sizeof(file1), "%s.%d",
 			    ent->log, numlogs_c);
 
-		(void) strlcpy(zfile1, file1, sizeof(zfile1));
-		(void) strlcpy(zfile2, file2, sizeof(zfile2));
-		if (lstat(file1, &st)) {
-			(void) strlcat(zfile1, COMPRESS_POSTFIX,
-			    sizeof(zfile1));
-			(void) strlcat(zfile2, COMPRESS_POSTFIX,
-			    sizeof(zfile2));
-			if (lstat(zfile1, &st)) {
-				strlcpy(zfile1, file1, sizeof(zfile1));
-				strlcpy(zfile2, file2, sizeof(zfile2));
-				strlcat(zfile1, BZCOMPRESS_POSTFIX,
-				    sizeof(zfile1));
-				strlcat(zfile2, BZCOMPRESS_POSTFIX,
-				    sizeof(zfile2));
-				if (lstat(zfile1, &st))
-					continue;
-			}
-		}
+		logfile_suffix = get_logfile_suffix(file1);
+		if (logfile_suffix == NULL)
+			continue;
+		(void) strlcpy(zfile1, file1, MAXPATHLEN);
+		(void) strlcpy(zfile2, file2, MAXPATHLEN);
+		(void) strlcat(zfile1, logfile_suffix, MAXPATHLEN);
+		(void) strlcat(zfile2, logfile_suffix, MAXPATHLEN);
+
 		if (noaction)
 			printf("\tmv %s %s\n", zfile1, zfile2);
 		else {
@@ -1760,7 +1797,7 @@ do_rotate(const struct conf_entry *ent)
 	swork = NULL;
 	if (ent->pid_file != NULL)
 		swork = save_sigwork(ent);
-	if (ent->numlogs > 0 && (flags & (CE_COMPACT | CE_BZCOMPACT))) {
+	if (ent->numlogs > 0 && ent->compress > COMPRESS_NONE) {
 		/*
 		 * The zipwork_entry will include a pointer to this
 		 * conf_entry, so the conf_entry should not be freed.
@@ -1855,15 +1892,16 @@ do_zipwork(struct zipwork_entry *zwork)
 
 	pgm_path = NULL;
 	strlcpy(zresult, zwork->zw_fname, sizeof(zresult));
-	if (zwork != NULL && zwork->zw_conf != NULL) {
-		if (zwork->zw_conf->flags & CE_COMPACT) {
-			pgm_path = _PATH_GZIP;
-			strlcat(zresult, COMPRESS_POSTFIX, sizeof(zresult));
-		} else if (zwork->zw_conf->flags & CE_BZCOMPACT) {
-			pgm_path = _PATH_BZIP2;
-			strlcat(zresult, BZCOMPRESS_POSTFIX, sizeof(zresult));
+	if (zwork != NULL && zwork->zw_conf != NULL &&
+	    zwork->zw_conf->compress > COMPRESS_NONE)
+		for (int c = 1; c < COMPRESS_TYPES; c++) {
+			if (zwork->zw_conf->compress == c) {
+				pgm_path = compress_type[c].path;
+				(void) strlcat(zresult,
+				    compress_type[c].suffix, sizeof(zresult));
+				break;
+			}
 		}
-	}
 	if (pgm_path == NULL) {
 		warnx("invalid entry for %s in do_zipwork", zwork->zw_fname);
 		return;
@@ -2141,9 +2179,8 @@ static int
 age_old_log(char *file)
 {
 	struct stat sb;
-	char *endp;
-	char tmp[MAXPATHLEN + sizeof(".0") + sizeof(COMPRESS_POSTFIX) +
-		sizeof(BZCOMPRESS_POSTFIX) + 1];
+	const char *logfile_suffix;
+	char tmp[MAXPATHLEN + sizeof(".0") + COMPRESS_SUFFIX_MAXLEN + 1];
 
 	if (archtodir) {
 		char *p;
@@ -2173,21 +2210,12 @@ age_old_log(char *file)
 	}
 
 	strlcat(tmp, ".0", sizeof(tmp));
-	if (stat(tmp, &sb) < 0) {
-		/*
-		 * A plain '.0' file does not exist.  Try again, first
-		 * with the added suffix of '.gz', then with an added
-		 * suffix of '.bz2' instead of '.gz'.
-		 */
-		endp = strchr(tmp, '\0');
-		strlcat(tmp, COMPRESS_POSTFIX, sizeof(tmp));
-		if (stat(tmp, &sb) < 0) {
-			*endp = '\0';		/* Remove .gz */
-			strlcat(tmp, BZCOMPRESS_POSTFIX, sizeof(tmp));
-			if (stat(tmp, &sb) < 0)
-				return (-1);
-		}
-	}
+	logfile_suffix = get_logfile_suffix(tmp);
+	if (logfile_suffix == NULL)
+		return (-1);
+	(void) strlcat(tmp, logfile_suffix, sizeof(tmp));
+	if (stat(tmp, &sb) < 0)
+		return (-1);
 	return ((int)(ptimeget_secs(timenow) - sb.st_mtime + 1800) / 3600);
 }
 

Modified: head/usr.sbin/newsyslog/newsyslog.conf.5
==============================================================================
--- head/usr.sbin/newsyslog/newsyslog.conf.5	Mon Jan 31 10:18:42 2011	(r218126)
+++ head/usr.sbin/newsyslog/newsyslog.conf.5	Mon Jan 31 10:57:54 2011	(r218127)
@@ -21,7 +21,7 @@
 .\" the suitability of this software for any purpose.  It is
 .\" provided "as is" without express or implied warranty.
 .\"
-.Dd July 23, 2010
+.Dd January 31, 2011
 .Dt NEWSYSLOG.CONF 5
 .Os
 .Sh NAME
@@ -292,6 +292,12 @@ indicates that
 should attempt to save disk space by compressing the rotated
 log file using
 .Xr bzip2 1 .
+.It Cm X
+indicates that
+.Xr newsyslog 8
+should attempt to save disk space by compressing the rotated
+log file using
+.Xr xz 1 .
 .It Cm N
 indicates that there is no process which needs to be signaled
 when this log file is rotated.
@@ -344,6 +350,7 @@ If this field is not present, then a
 signal will be sent.
 .El
 .Sh SEE ALSO
+.Xr xz 1 ,
 .Xr bzip2 1 ,
 .Xr gzip 1 ,
 .Xr syslog 3 ,

Modified: head/usr.sbin/newsyslog/pathnames.h
==============================================================================
--- head/usr.sbin/newsyslog/pathnames.h	Mon Jan 31 10:18:42 2011	(r218126)
+++ head/usr.sbin/newsyslog/pathnames.h	Mon Jan 31 10:57:54 2011	(r218127)
@@ -22,7 +22,8 @@ provided "as is" without express or impl
 
 */
 
-#define _PATH_CONF	"/etc/newsyslog.conf"
-#define _PATH_SYSLOGPID	_PATH_VARRUN "syslog.pid"
-#define _PATH_BZIP2	"/usr/bin/bzip2"
-#define _PATH_GZIP	"/usr/bin/gzip"
+#define	_PATH_CONF	"/etc/newsyslog.conf"
+#define	_PATH_SYSLOGPID	_PATH_VARRUN "syslog.pid"
+#define	_PATH_BZIP2	"/usr/bin/bzip2"
+#define	_PATH_GZIP	"/usr/bin/gzip"
+#define	_PATH_XZ	"/usr/bin/xz"

From owner-svn-src-head@FreeBSD.ORG  Mon Jan 31 11:30:26 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ABCE41065694;
	Mon, 31 Jan 2011 11:30:26 +0000 (UTC) (envelope-from mm@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9C1428FC15;
	Mon, 31 Jan 2011 11:30:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0VBUQsk021891;
	Mon, 31 Jan 2011 11:30:26 GMT (envelope-from mm@svn.freebsd.org)
Received: (from mm@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0VBUQE4021888;
	Mon, 31 Jan 2011 11:30:26 GMT (envelope-from mm@svn.freebsd.org)
Message-Id: <201101311130.p0VBUQE4021888@svn.freebsd.org>
From: Martin Matuska 
Date: Mon, 31 Jan 2011 11:30:26 +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: r218128 - head/usr.sbin/newsyslog
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 31 Jan 2011 11:30:26 -0000

Author: mm
Date: Mon Jan 31 11:30:26 2011
New Revision: 218128
URL: http://svn.freebsd.org/changeset/base/218128

Log:
  Use correct alphabetical order for xz(1) in SEE ALSO section
  of newsyslog manpages.
  
  Reported by:	maxim
  MFC after:	3 weeks

Modified:
  head/usr.sbin/newsyslog/newsyslog.8
  head/usr.sbin/newsyslog/newsyslog.conf.5

Modified: head/usr.sbin/newsyslog/newsyslog.8
==============================================================================
--- head/usr.sbin/newsyslog/newsyslog.8	Mon Jan 31 10:57:54 2011	(r218127)
+++ head/usr.sbin/newsyslog/newsyslog.8	Mon Jan 31 11:30:26 2011	(r218128)
@@ -277,9 +277,9 @@ names may contain the dot character.
 The dot (``.'') character is still
 accepted for backwards compatibility.
 .Sh SEE ALSO
-.Xr xz 1 ,
 .Xr bzip2 1 ,
 .Xr gzip 1 ,
+.Xr xz 1 ,
 .Xr syslog 3 ,
 .Xr newsyslog.conf 5 ,
 .Xr chown 8 ,

Modified: head/usr.sbin/newsyslog/newsyslog.conf.5
==============================================================================
--- head/usr.sbin/newsyslog/newsyslog.conf.5	Mon Jan 31 10:57:54 2011	(r218127)
+++ head/usr.sbin/newsyslog/newsyslog.conf.5	Mon Jan 31 11:30:26 2011	(r218128)
@@ -350,9 +350,9 @@ If this field is not present, then a
 signal will be sent.
 .El
 .Sh SEE ALSO
-.Xr xz 1 ,
 .Xr bzip2 1 ,
 .Xr gzip 1 ,
+.Xr xz 1 ,
 .Xr syslog 3 ,
 .Xr chown 8 ,
 .Xr newsyslog 8 ,

From owner-svn-src-head@FreeBSD.ORG  Mon Jan 31 11:50:11 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8D817106564A;
	Mon, 31 Jan 2011 11:50:11 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7CC518FC14;
	Mon, 31 Jan 2011 11:50:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0VBoBmT022567;
	Mon, 31 Jan 2011 11:50:11 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0VBoBCk022556;
	Mon, 31 Jan 2011 11:50:11 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <201101311150.p0VBoBCk022556@svn.freebsd.org>
From: Randall Stewart 
Date: Mon, 31 Jan 2011 11:50:11 +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: r218129 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 31 Jan 2011 11:50:11 -0000

Author: rrs
Date: Mon Jan 31 11:50:11 2011
New Revision: 218129
URL: http://svn.freebsd.org/changeset/base/218129

Log:
  More ECN fixes:
  1) We now remove ECN-Nonce since it will no longer continue as a I-D
  2) Eliminate last_tsn_echo, this tied us to an assoc not the net
     and thus we were not doing m-homing on the ECN-Echo senders side right.
  3) Increment the count going out even if the TSN in lower in the pending
     ECN-Echo, this way the receiver knows exactly how many packets were
     marked even with network re-ordering
  4) Fix so we DO NOT stop doing delayed sack if a ECN Echo is in queue
  MFC after:	1 month

Modified:
  head/sys/netinet/sctp_cc_functions.c
  head/sys/netinet/sctp_constants.h
  head/sys/netinet/sctp_header.h
  head/sys/netinet/sctp_indata.c
  head/sys/netinet/sctp_indata.h
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_structs.h
  head/sys/netinet/sctp_sysctl.c
  head/sys/netinet/sctp_sysctl.h
  head/sys/netinet/sctp_timer.c
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctp_cc_functions.c
==============================================================================
--- head/sys/netinet/sctp_cc_functions.c	Mon Jan 31 11:30:26 2011	(r218128)
+++ head/sys/netinet/sctp_cc_functions.c	Mon Jan 31 11:50:11 2011	(r218129)
@@ -168,13 +168,6 @@ sctp_cwnd_update_after_fr(struct sctp_tc
 					net->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1;
 				}
 
-				/*
-				 * Disable Nonce Sum Checking and store the
-				 * resync tsn
-				 */
-				asoc->nonce_sum_check = 0;
-				asoc->nonce_resync_tsn = asoc->fast_recovery_tsn + 1;
-
 				sctp_timer_stop(SCTP_TIMER_TYPE_SEND,
 				    stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_INDATA + SCTP_LOC_32);
 				sctp_timer_start(SCTP_TIMER_TYPE_SEND,
@@ -489,25 +482,28 @@ sctp_cwnd_update_after_timeout(struct sc
 }
 
 static void
-sctp_cwnd_update_after_ecn_echo(struct sctp_tcb *stcb, struct sctp_nets *net)
+sctp_cwnd_update_after_ecn_echo(struct sctp_tcb *stcb, struct sctp_nets *net,
+    int in_window, int num_pkt_lost)
 {
 	int old_cwnd = net->cwnd;
 
-	SCTP_STAT_INCR(sctps_ecnereducedcwnd);
-	net->ssthresh = net->cwnd / 2;
-	if (net->ssthresh < net->mtu) {
-		net->ssthresh = net->mtu;
-		/* here back off the timer as well, to slow us down */
-		net->RTO <<= 1;
-	}
-	net->cwnd = net->ssthresh;
-	SDT_PROBE(sctp, cwnd, net, ecn,
-	    stcb->asoc.my_vtag,
-	    ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)),
-	    net,
-	    old_cwnd, net->cwnd);
-	if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
-		sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT);
+	if (in_window == 0) {
+		SCTP_STAT_INCR(sctps_ecnereducedcwnd);
+		net->ssthresh = net->cwnd / 2;
+		if (net->ssthresh < net->mtu) {
+			net->ssthresh = net->mtu;
+			/* here back off the timer as well, to slow us down */
+			net->RTO <<= 1;
+		}
+		net->cwnd = net->ssthresh;
+		SDT_PROBE(sctp, cwnd, net, ecn,
+		    stcb->asoc.my_vtag,
+		    ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)),
+		    net,
+		    old_cwnd, net->cwnd);
+		if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
+			sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT);
+		}
 	}
 }
 
@@ -888,13 +884,6 @@ sctp_hs_cwnd_update_after_fr(struct sctp
 					net->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1;
 				}
 
-				/*
-				 * Disable Nonce Sum Checking and store the
-				 * resync tsn
-				 */
-				asoc->nonce_sum_check = 0;
-				asoc->nonce_resync_tsn = asoc->fast_recovery_tsn + 1;
-
 				sctp_timer_stop(SCTP_TIMER_TYPE_SEND,
 				    stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_INDATA + SCTP_LOC_32);
 				sctp_timer_start(SCTP_TIMER_TYPE_SEND,
@@ -1609,13 +1598,6 @@ sctp_htcp_cwnd_update_after_fr(struct sc
 					net->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1;
 				}
 
-				/*
-				 * Disable Nonce Sum Checking and store the
-				 * resync tsn
-				 */
-				asoc->nonce_sum_check = 0;
-				asoc->nonce_resync_tsn = asoc->fast_recovery_tsn + 1;
-
 				sctp_timer_stop(SCTP_TIMER_TYPE_SEND,
 				    stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_INDATA + SCTP_LOC_32);
 				sctp_timer_start(SCTP_TIMER_TYPE_SEND,
@@ -1673,24 +1655,26 @@ sctp_htcp_cwnd_update_after_fr_timer(str
 
 static void
 sctp_htcp_cwnd_update_after_ecn_echo(struct sctp_tcb *stcb,
-    struct sctp_nets *net)
+    struct sctp_nets *net, int in_window, int num_pkt_lost)
 {
 	int old_cwnd;
 
 	old_cwnd = net->cwnd;
 
 	/* JRS - reset hctp as if state changed */
-	htcp_reset(&net->htcp_ca);
-	SCTP_STAT_INCR(sctps_ecnereducedcwnd);
-	net->ssthresh = htcp_recalc_ssthresh(stcb, net);
-	if (net->ssthresh < net->mtu) {
-		net->ssthresh = net->mtu;
-		/* here back off the timer as well, to slow us down */
-		net->RTO <<= 1;
-	}
-	net->cwnd = net->ssthresh;
-	if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
-		sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT);
+	if (in_window == 0) {
+		htcp_reset(&net->htcp_ca);
+		SCTP_STAT_INCR(sctps_ecnereducedcwnd);
+		net->ssthresh = htcp_recalc_ssthresh(stcb, net);
+		if (net->ssthresh < net->mtu) {
+			net->ssthresh = net->mtu;
+			/* here back off the timer as well, to slow us down */
+			net->RTO <<= 1;
+		}
+		net->cwnd = net->ssthresh;
+		if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) {
+			sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT);
+		}
 	}
 }
 

Modified: head/sys/netinet/sctp_constants.h
==============================================================================
--- head/sys/netinet/sctp_constants.h	Mon Jan 31 11:30:26 2011	(r218128)
+++ head/sys/netinet/sctp_constants.h	Mon Jan 31 11:50:11 2011	(r218129)
@@ -411,8 +411,7 @@ __FBSDID("$FreeBSD$");
 
 /*************0x8000 series*************/
 #define SCTP_ECN_CAPABLE		0x8000
-/* ECN Nonce: draft-ladha-sctp-ecn-nonce */
-#define SCTP_ECN_NONCE_SUPPORTED	0x8001
+
 /* draft-ietf-tsvwg-auth-xxx */
 #define SCTP_RANDOM			0x8002
 #define SCTP_CHUNK_LIST			0x8003

Modified: head/sys/netinet/sctp_header.h
==============================================================================
--- head/sys/netinet/sctp_header.h	Mon Jan 31 11:30:26 2011	(r218128)
+++ head/sys/netinet/sctp_header.h	Mon Jan 31 11:50:11 2011	(r218129)
@@ -142,12 +142,6 @@ struct sctp_supported_chunk_types_param 
 }                                SCTP_PACKED;
 
 
-/* ECN Nonce: draft-ladha-sctp-ecn-nonce */
-struct sctp_ecn_nonce_supported_param {
-	struct sctp_paramhdr ph;/* type = 0x8001  len = 4 */
-}                              SCTP_PACKED;
-
-
 /*
  * Structures for DATA chunks
  */

Modified: head/sys/netinet/sctp_indata.c
==============================================================================
--- head/sys/netinet/sctp_indata.c	Mon Jan 31 11:30:26 2011	(r218128)
+++ head/sys/netinet/sctp_indata.c	Mon Jan 31 11:50:11 2011	(r218129)
@@ -2386,7 +2386,6 @@ sctp_slide_mapping_arrays(struct sctp_tc
 	}
 }
 
-
 void
 sctp_sack_check(struct sctp_tcb *stcb, int was_a_gap, int *abort_flag)
 {
@@ -2857,11 +2856,6 @@ sctp_process_segment_range(struct sctp_t
 					 * must be held until
 					 * cum-ack passes
 					 */
-					/*-
-					 * ECN Nonce: Add the nonce
-					 * value to the sender's
-					 * nonce sum
-					 */
 					if (tp1->sent < SCTP_DATAGRAM_RESEND) {
 						/*-
 						 * If it is less than RESEND, it is
@@ -2967,8 +2961,6 @@ sctp_process_segment_range(struct sctp_t
 						}
 					}
 					if (tp1->sent <= SCTP_DATAGRAM_RESEND) {
-						(*ecn_seg_sums) += tp1->rec.data.ect_nonce;
-						(*ecn_seg_sums) &= SCTP_SACK_NONCE_SUM;
 						if (SCTP_TSN_GT(tp1->rec.data.TSN_seq,
 						    stcb->asoc.this_sack_highest_gap)) {
 							stcb->asoc.this_sack_highest_gap =
@@ -3152,23 +3144,6 @@ sctp_check_for_revoked(struct sctp_tcb *
 		if (tp1->sent == SCTP_DATAGRAM_UNSENT)
 			break;
 	}
-	if (tot_revoked > 0) {
-		/*
-		 * Setup the ecn nonce re-sync point. We do this since once
-		 * data is revoked we begin to retransmit things, which do
-		 * NOT have the ECN bits set. This means we are now out of
-		 * sync and must wait until we get back in sync with the
-		 * peer to check ECN bits.
-		 */
-		tp1 = TAILQ_FIRST(&asoc->send_queue);
-		if (tp1 == NULL) {
-			asoc->nonce_resync_tsn = asoc->sending_seq;
-		} else {
-			asoc->nonce_resync_tsn = tp1->rec.data.TSN_seq;
-		}
-		asoc->nonce_wait_for_ecne = 0;
-		asoc->nonce_sum_check = 0;
-	}
 }
 
 
@@ -3604,17 +3579,6 @@ sctp_strike_gap_ack_chunks(struct sctp_t
 			}
 		}
 	}
-
-	if (tot_retrans > 0) {
-		/*
-		 * Setup the ecn nonce re-sync point. We do this since once
-		 * we go to FR something we introduce a Karn's rule scenario
-		 * and won't know the totals for the ECN bits.
-		 */
-		asoc->nonce_resync_tsn = sending_seq;
-		asoc->nonce_wait_for_ecne = 0;
-		asoc->nonce_sum_check = 0;
-	}
 }
 
 struct sctp_tmit_chunk *
@@ -3787,7 +3751,7 @@ sctp_window_probe_recovery(struct sctp_t
 
 void
 sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
-    uint32_t rwnd, int nonce_sum_flag, int *abort_now)
+    uint32_t rwnd, int *abort_now)
 {
 	struct sctp_nets *net;
 	struct sctp_association *asoc;
@@ -3901,11 +3865,6 @@ sctp_express_handle_sack(struct sctp_tcb
 				if (tp1->sent == SCTP_DATAGRAM_UNSENT) {
 					printf("Warning, an unsent is now acked?\n");
 				}
-				/*
-				 * ECN Nonce: Add the nonce to the sender's
-				 * nonce sum
-				 */
-				asoc->nonce_sum_expect_base += tp1->rec.data.ect_nonce;
 				if (tp1->sent < SCTP_DATAGRAM_ACKED) {
 					/*
 					 * If it is less than ACKED, it is
@@ -4049,53 +4008,6 @@ sctp_express_handle_sack(struct sctp_tcb
 		asoc->total_flight = 0;
 		asoc->total_flight_count = 0;
 	}
-	/* ECN Nonce updates */
-	if (asoc->ecn_nonce_allowed) {
-		if (asoc->nonce_sum_check) {
-			if (nonce_sum_flag != ((asoc->nonce_sum_expect_base) & SCTP_SACK_NONCE_SUM)) {
-				if (asoc->nonce_wait_for_ecne == 0) {
-					struct sctp_tmit_chunk *lchk;
-
-					lchk = TAILQ_FIRST(&asoc->send_queue);
-					asoc->nonce_wait_for_ecne = 1;
-					if (lchk) {
-						asoc->nonce_wait_tsn = lchk->rec.data.TSN_seq;
-					} else {
-						asoc->nonce_wait_tsn = asoc->sending_seq;
-					}
-				} else {
-					if (SCTP_TSN_GE(asoc->last_acked_seq, asoc->nonce_wait_tsn)) {
-						/*
-						 * Misbehaving peer. We need
-						 * to react to this guy
-						 */
-						asoc->ecn_allowed = 0;
-						asoc->ecn_nonce_allowed = 0;
-					}
-				}
-			}
-		} else {
-			/* See if Resynchronization Possible */
-			if (SCTP_TSN_GT(asoc->last_acked_seq, asoc->nonce_resync_tsn)) {
-				asoc->nonce_sum_check = 1;
-				/*
-				 * Now we must calculate what the base is.
-				 * We do this based on two things, we know
-				 * the total's for all the segments
-				 * gap-acked in the SACK (none). We also
-				 * know the SACK's nonce sum, its in
-				 * nonce_sum_flag. So we can build a truth
-				 * table to back-calculate the new value of
-				 * asoc->nonce_sum_expect_base:
-				 * 
-				 * SACK-flag-Value         Seg-Sums Base 0 0 0
-				 * 1                    0 1 0 1 1 1
-				 * 1 0
-				 */
-				asoc->nonce_sum_expect_base = (0 ^ nonce_sum_flag) & SCTP_SACK_NONCE_SUM;
-			}
-		}
-	}
 	/* RWND update */
 	asoc->peers_rwnd = sctp_sbspace_sub(rwnd,
 	    (uint32_t) (asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh))));
@@ -4297,18 +4209,10 @@ again:
 		/* C3. See if we need to send a Fwd-TSN */
 		if (SCTP_TSN_GT(asoc->advanced_peer_ack_point, cumack)) {
 			/*
-			 * ISSUE with ECN, see FWD-TSN processing for notes
-			 * on issues that will occur when the ECN NONCE
-			 * stuff is put into SCTP for cross checking.
+			 * ISSUE with ECN, see FWD-TSN processing.
 			 */
 			if (SCTP_TSN_GT(asoc->advanced_peer_ack_point, old_adv_peer_ack_point)) {
 				send_forward_tsn(stcb, asoc);
-				/*
-				 * ECN Nonce: Disable Nonce Sum check when
-				 * FWD TSN is sent and store resync tsn
-				 */
-				asoc->nonce_sum_check = 0;
-				asoc->nonce_resync_tsn = asoc->advanced_peer_ack_point;
 			} else if (lchk) {
 				/* try to FR fwd-tsn's that get lost too */
 				if (lchk->rec.data.fwd_tsn_cnt >= 3) {
@@ -4351,7 +4255,7 @@ sctp_handle_sack(struct mbuf *m, int off
 	int win_probe_recovery = 0;
 	int win_probe_recovered = 0;
 	struct sctp_nets *net = NULL;
-	int nonce_sum_flag, ecn_seg_sums = 0;
+	int ecn_seg_sums = 0;
 	int done_once;
 	uint8_t reneged_all = 0;
 	uint8_t cmt_dac_flag;
@@ -4383,7 +4287,6 @@ sctp_handle_sack(struct mbuf *m, int off
 	j = 0;
 	SCTP_STAT_INCR(sctps_slowpath_sack);
 	last_tsn = cum_ack;
-	nonce_sum_flag = flags & SCTP_SACK_NONCE_SUM;
 	cmt_dac_flag = flags & SCTP_SACK_CMT_DAC;
 #ifdef SCTP_ASOCLOG_OF_TSNS
 	stcb->asoc.cumack_log[stcb->asoc.cumack_log_at] = cum_ack;
@@ -4545,11 +4448,6 @@ sctp_handle_sack(struct mbuf *m, int off
 	TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) {
 		if (SCTP_TSN_GE(last_tsn, tp1->rec.data.TSN_seq)) {
 			if (tp1->sent != SCTP_DATAGRAM_UNSENT) {
-				/*
-				 * ECN Nonce: Add the nonce to the sender's
-				 * nonce sum
-				 */
-				asoc->nonce_sum_expect_base += tp1->rec.data.ect_nonce;
 				accum_moved = 1;
 				if (tp1->sent < SCTP_DATAGRAM_ACKED) {
 					/*
@@ -4999,60 +4897,6 @@ sctp_handle_sack(struct mbuf *m, int off
 	/* JRS - Use the congestion control given in the CC module */
 	asoc->cc_functions.sctp_cwnd_update_after_fr(stcb, asoc);
 
-	/******************************************************************
-	 *  Here we do the stuff with ECN Nonce checking.
-	 *  We basically check to see if the nonce sum flag was incorrect
-	 *  or if resynchronization needs to be done. Also if we catch a
-	 *  misbehaving receiver we give him the kick.
-	 ******************************************************************/
-
-	if (asoc->ecn_nonce_allowed) {
-		if (asoc->nonce_sum_check) {
-			if (nonce_sum_flag != ((asoc->nonce_sum_expect_base + ecn_seg_sums) & SCTP_SACK_NONCE_SUM)) {
-				if (asoc->nonce_wait_for_ecne == 0) {
-					struct sctp_tmit_chunk *lchk;
-
-					lchk = TAILQ_FIRST(&asoc->send_queue);
-					asoc->nonce_wait_for_ecne = 1;
-					if (lchk) {
-						asoc->nonce_wait_tsn = lchk->rec.data.TSN_seq;
-					} else {
-						asoc->nonce_wait_tsn = asoc->sending_seq;
-					}
-				} else {
-					if (SCTP_TSN_GE(asoc->last_acked_seq, asoc->nonce_wait_tsn)) {
-						/*
-						 * Misbehaving peer. We need
-						 * to react to this guy
-						 */
-						asoc->ecn_allowed = 0;
-						asoc->ecn_nonce_allowed = 0;
-					}
-				}
-			}
-		} else {
-			/* See if Resynchronization Possible */
-			if (SCTP_TSN_GT(asoc->last_acked_seq, asoc->nonce_resync_tsn)) {
-				asoc->nonce_sum_check = 1;
-				/*
-				 * now we must calculate what the base is.
-				 * We do this based on two things, we know
-				 * the total's for all the segments
-				 * gap-acked in the SACK, its stored in
-				 * ecn_seg_sums. We also know the SACK's
-				 * nonce sum, its in nonce_sum_flag. So we
-				 * can build a truth table to back-calculate
-				 * the new value of
-				 * asoc->nonce_sum_expect_base:
-				 * 
-				 * SACK-flag-Value         Seg-Sums Base 0 0 0
-				 * 1                    0 1 0 1 1 1
-				 * 1 0
-				 */
-				asoc->nonce_sum_expect_base = (ecn_seg_sums ^ nonce_sum_flag) & SCTP_SACK_NONCE_SUM;
-			}
-		}
-	}
 	/* Now are we exiting loss recovery ? */
 	if (will_exit_fast_recovery) {
 		/* Ok, we must exit fast recovery */
@@ -5190,9 +5034,7 @@ again:
 		/* C3. See if we need to send a Fwd-TSN */
 		if (SCTP_TSN_GT(asoc->advanced_peer_ack_point, cum_ack)) {
 			/*
-			 * ISSUE with ECN, see FWD-TSN processing for notes
-			 * on issues that will occur when the ECN NONCE
-			 * stuff is put into SCTP for cross checking.
+			 * ISSUE with ECN, see FWD-TSN processing.
 			 */
 			if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) {
 				sctp_misc_ints(SCTP_FWD_TSN_CHECK,
@@ -5200,14 +5042,7 @@ again:
 				    old_adv_peer_ack_point);
 			}
 			if (SCTP_TSN_GT(asoc->advanced_peer_ack_point, old_adv_peer_ack_point)) {
-
 				send_forward_tsn(stcb, asoc);
-				/*
-				 * ECN Nonce: Disable Nonce Sum check when
-				 * FWD TSN is sent and store resync tsn
-				 */
-				asoc->nonce_sum_check = 0;
-				asoc->nonce_resync_tsn = asoc->advanced_peer_ack_point;
 			} else if (lchk) {
 				/* try to FR fwd-tsn's that get lost too */
 				if (lchk->rec.data.fwd_tsn_cnt >= 3) {
@@ -5242,7 +5077,7 @@ sctp_update_acked(struct sctp_tcb *stcb,
 	a_rwnd = stcb->asoc.peers_rwnd + stcb->asoc.total_flight;
 
 	/* Now call the express sack handling */
-	sctp_express_handle_sack(stcb, cum_ack, a_rwnd, 0, abort_flag);
+	sctp_express_handle_sack(stcb, cum_ack, a_rwnd, abort_flag);
 }
 
 static void
@@ -5384,17 +5219,6 @@ sctp_handle_forward_tsn(struct sctp_tcb 
     struct sctp_forward_tsn_chunk *fwd,
     int *abort_flag, struct mbuf *m, int offset)
 {
-	/*
-	 * ISSUES that MUST be fixed for ECN! When we are the sender of the
-	 * forward TSN, when the SACK comes back that acknowledges the
-	 * FWD-TSN we must reset the NONCE sum to match correctly. This will
-	 * get quite tricky since we may have sent more data interveneing
-	 * and must carefully account for what the SACK says on the nonce
-	 * and any gaps that are reported. This work will NOT be done here,
-	 * but I note it here since it is really related to PR-SCTP and
-	 * FWD-TSN's
-	 */
-
 	/* The pr-sctp fwd tsn */
 	/*
 	 * here we will perform all the data receiver side steps for
@@ -5482,7 +5306,6 @@ sctp_handle_forward_tsn(struct sctp_tcb 
 		if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) {
 			sctp_log_map(0, 3, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT);
 		}
-		asoc->last_echo_tsn = asoc->highest_tsn_inside_map;
 	} else {
 		SCTP_TCB_LOCK_ASSERT(stcb);
 		for (i = 0; i <= gap; i++) {

Modified: head/sys/netinet/sctp_indata.h
==============================================================================
--- head/sys/netinet/sctp_indata.h	Mon Jan 31 11:30:26 2011	(r218128)
+++ head/sys/netinet/sctp_indata.h	Mon Jan 31 11:50:11 2011	(r218129)
@@ -93,7 +93,7 @@ sctp_calc_rwnd(struct sctp_tcb *stcb, st
 
 void
 sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
-    uint32_t rwnd, int nonce_sum_flag, int *abort_now);
+    uint32_t rwnd, int *abort_now);
 
 void
 sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup,

Modified: head/sys/netinet/sctp_input.c
==============================================================================
--- head/sys/netinet/sctp_input.c	Mon Jan 31 11:30:26 2011	(r218128)
+++ head/sys/netinet/sctp_input.c	Mon Jan 31 11:50:11 2011	(r218129)
@@ -264,11 +264,13 @@ sctp_process_init(struct sctp_init_chunk
 	/* save off parameters */
 	asoc->peer_vtag = ntohl(init->initiate_tag);
 	asoc->peers_rwnd = ntohl(init->a_rwnd);
+	/* init tsn's */
+	asoc->highest_tsn_inside_map = asoc->asconf_seq_in = ntohl(init->initial_tsn) - 1;
+
 	if (!TAILQ_EMPTY(&asoc->nets)) {
 		/* update any ssthresh's that may have a default */
 		TAILQ_FOREACH(lnet, &asoc->nets, sctp_next) {
 			lnet->ssthresh = asoc->peers_rwnd;
-
 			if (SCTP_BASE_SYSCTL(sctp_logging_level) & (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) {
 				sctp_log_cwnd(stcb, lnet, 0, SCTP_CWND_INITIALIZATION);
 			}
@@ -328,8 +330,7 @@ sctp_process_init(struct sctp_init_chunk
 	}
 	SCTP_TCB_SEND_UNLOCK(stcb);
 	asoc->strm_realoutsize = asoc->streamoutcnt = asoc->pre_open_streams;
-	/* init tsn's */
-	asoc->highest_tsn_inside_map = asoc->asconf_seq_in = ntohl(init->initial_tsn) - 1;
+
 	/* EY - nr_sack: initialize highest tsn in nr_mapping_array */
 	asoc->highest_tsn_inside_nr_map = asoc->highest_tsn_inside_map;
 	if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) {
@@ -340,7 +341,7 @@ sctp_process_init(struct sctp_init_chunk
 
 	asoc->mapping_array_base_tsn = ntohl(init->initial_tsn);
 	asoc->tsn_last_delivered = asoc->cumulative_tsn = asoc->asconf_seq_in;
-	asoc->last_echo_tsn = asoc->asconf_seq_in;
+
 	asoc->advanced_peer_ack_point = asoc->last_acked_seq;
 	/* open the requested streams */
 
@@ -1044,11 +1045,6 @@ sctp_process_unrecog_param(struct sctp_t
 	case SCTP_HAS_NAT_SUPPORT:
 		stcb->asoc.peer_supports_nat = 0;
 		break;
-	case SCTP_ECN_NONCE_SUPPORTED:
-		stcb->asoc.peer_supports_ecn_nonce = 0;
-		stcb->asoc.ecn_nonce_allowed = 0;
-		stcb->asoc.ecn_allowed = 0;
-		break;
 	case SCTP_ADD_IP_ADDRESS:
 	case SCTP_DEL_IP_ADDRESS:
 	case SCTP_SET_PRIM_ADDR:
@@ -2931,16 +2927,12 @@ sctp_handle_ecn_echo(struct sctp_ecne_ch
 	SCTP_STAT_INCR(sctps_recvecne);
 	tsn = ntohl(cp->tsn);
 	pkt_cnt = ntohl(cp->num_pkts_since_cwr);
-	/* ECN Nonce stuff: need a resync and disable the nonce sum check */
-	/* Also we make sure we disable the nonce_wait */
 	lchk = TAILQ_LAST(&stcb->asoc.send_queue, sctpchunk_listhead);
 	if (lchk == NULL) {
-		window_data_tsn = stcb->asoc.nonce_resync_tsn = stcb->asoc.sending_seq - 1;
+		window_data_tsn = stcb->asoc.sending_seq - 1;
 	} else {
-		window_data_tsn = stcb->asoc.nonce_resync_tsn = lchk->rec.data.TSN_seq;
+		window_data_tsn = lchk->rec.data.TSN_seq;
 	}
-	stcb->asoc.nonce_wait_for_ecne = 0;
-	stcb->asoc.nonce_sum_check = 0;
 
 	/* Find where it was sent to if possible. */
 	net = NULL;
@@ -2974,7 +2966,8 @@ sctp_handle_ecn_echo(struct sctp_ecne_ch
 		override_bit = SCTP_CWR_REDUCE_OVERRIDE;
 	}
 out:
-	if (SCTP_TSN_GT(tsn, net->cwr_window_tsn)) {
+	if (SCTP_TSN_GT(tsn, net->cwr_window_tsn) &&
+	    ((override_bit & SCTP_CWR_REDUCE_OVERRIDE) == 0)) {
 		/*
 		 * JRS - Use the congestion control given in the pluggable
 		 * CC module
@@ -2982,7 +2975,7 @@ out:
 		int ocwnd;
 
 		ocwnd = net->cwnd;
-		stcb->asoc.cc_functions.sctp_cwnd_update_after_ecn_echo(stcb, net);
+		stcb->asoc.cc_functions.sctp_cwnd_update_after_ecn_echo(stcb, net, 0, pkt_cnt);
 		/*
 		 * We reduce once every RTT. So we will only lower cwnd at
 		 * the next sending seq i.e. the window_data_tsn
@@ -2993,18 +2986,26 @@ out:
 		net->last_cwr_tsn = tsn;
 	} else {
 		override_bit |= SCTP_CWR_IN_SAME_WINDOW;
-		if (SCTP_TSN_GT(tsn, net->last_cwr_tsn)) {
+		if (SCTP_TSN_GT(tsn, net->last_cwr_tsn) &&
+		    ((override_bit & SCTP_CWR_REDUCE_OVERRIDE) == 0)) {
 			/*
-			 * Another loss in the same window update how man
-			 * marks we have had
+			 * Another loss in the same window update how many
+			 * marks/packets lost we have had.
 			 */
+			int cnt = 1;
 
 			if (pkt_cnt > net->lost_cnt) {
 				/* Should be the case */
-				net->ecn_ce_pkt_cnt += (pkt_cnt - net->lost_cnt);
-				net->lost_cnt = pkt_cnt;
+				cnt = (pkt_cnt - net->lost_cnt);
+				net->ecn_ce_pkt_cnt += cnt;
 			}
+			net->lost_cnt = pkt_cnt;
 			net->last_cwr_tsn = tsn;
+			/*
+			 * Most CC functions will ignore this call, since we
+			 * are in-window yet of the initial CE the peer saw.
+			 */
+			stcb->asoc.cc_functions.sctp_cwnd_update_after_ecn_echo(stcb, net, 1, cnt);
 		}
 	}
 	/*
@@ -3184,11 +3185,6 @@ process_chunk_drop(struct sctp_tcb *stcb
 						}
 					}
 				}
-				/*
-				 * We zero out the nonce so resync not
-				 * needed
-				 */
-				tp1->rec.data.ect_nonce = 0;
 
 				if (tp1->do_rtt) {
 					/*
@@ -4643,7 +4639,6 @@ process_control_chunks:
 				uint16_t num_seg, num_dup;
 				uint8_t flags;
 				int offset_seg, offset_dup;
-				int nonce_sum_flag;
 
 				SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SACK\n");
 				SCTP_STAT_INCR(sctps_recvsacks);
@@ -4665,7 +4660,6 @@ process_control_chunks:
 				}
 				sack = (struct sctp_sack_chunk *)ch;
 				flags = ch->chunk_flags;
-				nonce_sum_flag = flags & SCTP_SACK_NONCE_SUM;
 				cum_ack = ntohl(sack->sack.cum_tsn_ack);
 				num_seg = ntohs(sack->sack.num_gap_ack_blks);
 				num_dup = ntohs(sack->sack.num_dup_tsns);
@@ -4697,8 +4691,7 @@ process_control_chunks:
 					 * with no missing segments to go
 					 * this way too.
 					 */
-					sctp_express_handle_sack(stcb, cum_ack, a_rwnd, nonce_sum_flag,
-					    &abort_now);
+					sctp_express_handle_sack(stcb, cum_ack, a_rwnd, &abort_now);
 				} else {
 					if (netp && *netp)
 						sctp_handle_sack(m, offset_seg, offset_dup,
@@ -4730,7 +4723,6 @@ process_control_chunks:
 				uint16_t num_seg, num_nr_seg, num_dup;
 				uint8_t flags;
 				int offset_seg, offset_dup;
-				int nonce_sum_flag;
 
 				SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_NR_SACK\n");
 				SCTP_STAT_INCR(sctps_recvsacks);
@@ -4756,8 +4748,6 @@ process_control_chunks:
 				}
 				nr_sack = (struct sctp_nr_sack_chunk *)ch;
 				flags = ch->chunk_flags;
-				nonce_sum_flag = flags & SCTP_SACK_NONCE_SUM;
-
 				cum_ack = ntohl(nr_sack->nr_sack.cum_tsn_ack);
 				num_seg = ntohs(nr_sack->nr_sack.num_gap_ack_blks);
 				num_nr_seg = ntohs(nr_sack->nr_sack.num_nr_gap_ack_blks);
@@ -4789,7 +4779,7 @@ process_control_chunks:
 					 * missing segments to go this way
 					 * too.
 					 */
-					sctp_express_handle_sack(stcb, cum_ack, a_rwnd, nonce_sum_flag,
+					sctp_express_handle_sack(stcb, cum_ack, a_rwnd,
 					    &abort_now);
 				} else {
 					if (netp && *netp)
@@ -5395,66 +5385,6 @@ next_chunk:
 }
 
 
-/*
- * Process the ECN bits we have something set so we must look to see if it is
- * ECN(0) or ECN(1) or CE
- */
-static void
-sctp_process_ecn_marked_a(struct sctp_tcb *stcb, struct sctp_nets *net,
-    uint8_t ecn_bits)
-{
-	if ((ecn_bits & SCTP_CE_BITS) == SCTP_CE_BITS) {
-		;
-	} else if ((ecn_bits & SCTP_ECT1_BIT) == SCTP_ECT1_BIT) {
-		/*
-		 * we only add to the nonce sum for ECT1, ECT0 does not
-		 * change the NS bit (that we have yet to find a way to send
-		 * it yet).
-		 */
-
-		/* ECN Nonce stuff */
-		stcb->asoc.receiver_nonce_sum++;
-		stcb->asoc.receiver_nonce_sum &= SCTP_SACK_NONCE_SUM;
-
-		/*
-		 * Drag up the last_echo point if cumack is larger since we
-		 * don't want the point falling way behind by more than
-		 * 2^^31 and then having it be incorrect.
-		 */
-		if (SCTP_TSN_GT(stcb->asoc.cumulative_tsn, stcb->asoc.last_echo_tsn)) {
-			stcb->asoc.last_echo_tsn = stcb->asoc.cumulative_tsn;
-		}
-	} else if ((ecn_bits & SCTP_ECT0_BIT) == SCTP_ECT0_BIT) {
-		/*
-		 * Drag up the last_echo point if cumack is larger since we
-		 * don't want the point falling way behind by more than
-		 * 2^^31 and then having it be incorrect.
-		 */
-		if (SCTP_TSN_GT(stcb->asoc.cumulative_tsn, stcb->asoc.last_echo_tsn)) {
-			stcb->asoc.last_echo_tsn = stcb->asoc.cumulative_tsn;
-		}
-	}
-}
-
-static void
-sctp_process_ecn_marked_b(struct sctp_tcb *stcb, struct sctp_nets *net,
-    uint32_t high_tsn, uint8_t ecn_bits)
-{
-	if ((ecn_bits & SCTP_CE_BITS) == SCTP_CE_BITS) {
-		/*
-		 * we possibly must notify the sender that a congestion
-		 * window reduction is in order. We do this by adding a ECNE
-		 * chunk to the output chunk queue. The incoming CWR will
-		 * remove this chunk.
-		 */
-		if (SCTP_TSN_GT(high_tsn, stcb->asoc.last_echo_tsn)) {
-			/* Yep, we need to add a ECNE */
-			sctp_send_ecn_echo(stcb, net, high_tsn);
-			stcb->asoc.last_echo_tsn = high_tsn;
-		}
-	}
-}
-
 #ifdef INVARIANTS
 #ifdef __GNUC__
 __attribute__((noinline))
@@ -5496,6 +5426,7 @@ sctp_common_input_processing(struct mbuf
 	struct mbuf *m = *mm;
 	int abort_flag = 0;
 	int un_sent;
+	int cnt_ctrl_ready = 0;
 
 	SCTP_STAT_INCR(sctps_recvdatagrams);
 #ifdef SCTP_AUDITING_ENABLED
@@ -5653,11 +5584,6 @@ sctp_common_input_processing(struct mbuf
 		case SCTP_STATE_SHUTDOWN_SENT:
 			break;
 		}
-		/* take care of ECN, part 1. */
-		if (stcb->asoc.ecn_allowed &&
-		    (ecn_bits & (SCTP_ECT0_BIT | SCTP_ECT1_BIT))) {
-			sctp_process_ecn_marked_a(stcb, net, ecn_bits);
-		}
 		/* plow through the data chunks while length > offset */
 		retval = sctp_process_data(mm, iphlen, &offset, length, sh,
 		    inp, stcb, net, &high_tsn);
@@ -5669,19 +5595,16 @@ sctp_common_input_processing(struct mbuf
 			goto out_now;
 		}
 		data_processed = 1;
-		if (retval == 0) {
-			/* take care of ecn part 2. */
-			if (stcb->asoc.ecn_allowed &&
-			    (ecn_bits & (SCTP_ECT0_BIT | SCTP_ECT1_BIT))) {
-				sctp_process_ecn_marked_b(stcb, net, high_tsn,
-				    ecn_bits);
-			}
-		}
 		/*
 		 * Anything important needs to have been m_copy'ed in
 		 * process_data
 		 */
 	}
+	/* take care of ecn */
+	if (stcb->asoc.ecn_allowed && ((ecn_bits & SCTP_CE_BITS) == SCTP_CE_BITS)) {
+		/* Yep, we need to add a ECNE */
+		sctp_send_ecn_echo(stcb, net, high_tsn);
+	}
 	if ((data_processed == 0) && (fwd_tsn_seen)) {
 		int was_a_gap;
 		uint32_t highest_tsn;
@@ -5713,8 +5636,10 @@ trigger_send:
 	    TAILQ_EMPTY(&stcb->asoc.control_send_queue),
 	    stcb->asoc.total_flight);
 	un_sent = (stcb->asoc.total_output_queue_size - stcb->asoc.total_flight);
-
-	if (!TAILQ_EMPTY(&stcb->asoc.control_send_queue) ||
+	if (!TAILQ_EMPTY(&stcb->asoc.control_send_queue)) {
+		cnt_ctrl_ready = stcb->asoc.ctrl_queue_cnt - stcb->asoc.ecn_echo_cnt_onq;
+	}
+	if (cnt_ctrl_ready ||
 	    ((un_sent) &&
 	    (stcb->asoc.peers_rwnd > 0 ||
 	    (stcb->asoc.peers_rwnd <= 0 && stcb->asoc.total_flight == 0)))) {

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Mon Jan 31 11:30:26 2011	(r218128)
+++ head/sys/netinet/sctp_output.c	Mon Jan 31 11:50:11 2011	(r218129)
@@ -3389,55 +3389,10 @@ static uint8_t
 sctp_get_ect(struct sctp_tcb *stcb,
     struct sctp_tmit_chunk *chk)
 {
-	uint8_t this_random;
-
-	/* Huh? */
 	if (SCTP_BASE_SYSCTL(sctp_ecn_enable) == 0)
 		return (0);
 
-	if (SCTP_BASE_SYSCTL(sctp_ecn_nonce) == 0)
-		/* no nonce, always return ECT0 */
-		return (SCTP_ECT0_BIT);
-
-	if (stcb->asoc.peer_supports_ecn_nonce == 0) {
-		/* Peer does NOT support it, so we send a ECT0 only */
-		return (SCTP_ECT0_BIT);
-	}
-	if (chk == NULL)
-		return (SCTP_ECT0_BIT);
-
-	if ((stcb->asoc.hb_random_idx > 3) ||
-	    ((stcb->asoc.hb_random_idx == 3) &&
-	    (stcb->asoc.hb_ect_randombit > 7))) {
-		uint32_t rndval;
-
-warp_drive_sa:
-		rndval = sctp_select_initial_TSN(&stcb->sctp_ep->sctp_ep);
-		memcpy(stcb->asoc.hb_random_values, &rndval,
-		    sizeof(stcb->asoc.hb_random_values));
-		this_random = stcb->asoc.hb_random_values[0];
-		stcb->asoc.hb_random_idx = 0;
-		stcb->asoc.hb_ect_randombit = 0;
-	} else {
-		if (stcb->asoc.hb_ect_randombit > 7) {
-			stcb->asoc.hb_ect_randombit = 0;
-			stcb->asoc.hb_random_idx++;
-			if (stcb->asoc.hb_random_idx > 3) {
-				goto warp_drive_sa;
-			}
-		}
-		this_random = stcb->asoc.hb_random_values[stcb->asoc.hb_random_idx];
-	}
-	if ((this_random >> stcb->asoc.hb_ect_randombit) & 0x01) {
-		if (chk != NULL)
-			/* ECN Nonce stuff */
-			chk->rec.data.ect_nonce = SCTP_ECT1_BIT;
-		stcb->asoc.hb_ect_randombit++;
-		return (SCTP_ECT1_BIT);
-	} else {
-		stcb->asoc.hb_ect_randombit++;
-		return (SCTP_ECT0_BIT);
-	}
+	return (SCTP_ECT0_BIT);
 }
 
 static int
@@ -4167,7 +4122,6 @@ sctp_send_initiate(struct sctp_inpcb *in
 	struct sctp_adaptation_layer_indication *ali;
 	struct sctp_ecn_supported_param *ecn;
 	struct sctp_prsctp_supported_param *prsctp;
-	struct sctp_ecn_nonce_supported_param *ecn_nonce;
 	struct sctp_supported_chunk_types_param *pr_supported;
 	int cnt_inits_to = 0;
 	int padval, ret;
@@ -4326,14 +4280,6 @@ sctp_send_initiate(struct sctp_inpcb *in
 	SCTP_BUF_LEN(m) += SCTP_SIZE32(p_len);
 
 
-	/* ECN nonce: And now tell the peer we support ECN nonce */
-	if (SCTP_BASE_SYSCTL(sctp_ecn_nonce)) {
-		ecn_nonce = (struct sctp_ecn_nonce_supported_param *)
-		    ((caddr_t)pr_supported + SCTP_SIZE32(p_len));
-		ecn_nonce->ph.param_type = htons(SCTP_ECN_NONCE_SUPPORTED);
-		ecn_nonce->ph.param_length = htons(sizeof(*ecn_nonce));
-		SCTP_BUF_LEN(m) += sizeof(*ecn_nonce);
-	}
 	/* add authentication parameters */
 	if (!SCTP_BASE_SYSCTL(sctp_auth_disable)) {
 		struct sctp_auth_random *randp;
@@ -4555,11 +4501,10 @@ sctp_arethere_unrecognized_parameters(st
 		case SCTP_HAS_NAT_SUPPORT:
 			*nat_friendly = 1;
 			/* fall through */
-		case SCTP_ECN_NONCE_SUPPORTED:
 		case SCTP_PRSCTP_SUPPORTED:
 
 			if (padded_size != sizeof(struct sctp_paramhdr)) {
-				SCTPDBG(SCTP_DEBUG_OUTPUT1, "Invalid size - error ecnnonce/prsctp/nat support %d\n", plen);
+				SCTPDBG(SCTP_DEBUG_OUTPUT1, "Invalid size - error prsctp/nat support %d\n", plen);
 				goto invalid_size;
 			}
 			at += padded_size;
@@ -4960,7 +4905,6 @@ sctp_send_initiate_ack(struct sctp_inpcb
 	struct sctp_adaptation_layer_indication *ali;
 	struct sctp_ecn_supported_param *ecn;
 	struct sctp_prsctp_supported_param *prsctp;
-	struct sctp_ecn_nonce_supported_param *ecn_nonce;
 	struct sctp_supported_chunk_types_param *pr_supported;
 	union sctp_sockstore store, store1, *over_addr;
 	struct sockaddr_in *sin, *to_sin;
@@ -5444,14 +5388,6 @@ do_a_abort:
 	bzero((caddr_t)pr_supported + p_len, SCTP_SIZE32(p_len) - p_len);
 	SCTP_BUF_LEN(m) += SCTP_SIZE32(p_len);
 
-	/* ECN nonce: And now tell the peer we support ECN nonce */
-	if (SCTP_BASE_SYSCTL(sctp_ecn_nonce)) {
-		ecn_nonce = (struct sctp_ecn_nonce_supported_param *)
-		    ((caddr_t)pr_supported + SCTP_SIZE32(p_len));
-		ecn_nonce->ph.param_type = htons(SCTP_ECN_NONCE_SUPPORTED);
-		ecn_nonce->ph.param_length = htons(sizeof(*ecn_nonce));
-		SCTP_BUF_LEN(m) += sizeof(*ecn_nonce);
-	}
 	/* add authentication parameters */
 	if (!SCTP_BASE_SYSCTL(sctp_auth_disable)) {
 		struct sctp_auth_random *randp;
@@ -7009,7 +6945,6 @@ dont_do_it:
 	chk->rec.data.payloadtype = sp->ppid;
 	chk->rec.data.context = sp->context;
 	chk->rec.data.doing_fast_retransmit = 0;
-	chk->rec.data.ect_nonce = 0;	/* ECN Nonce */
 
 	chk->rec.data.timetodrop = sp->ts;
 	chk->flags = sp->act_flags;
@@ -10000,13 +9935,7 @@ sctp_send_sack(struct sctp_tcb *stcb)
 	limit = mtod(a_chk->data, caddr_t);
 	limit += space;
 
-	/* 0x01 is used by nonce for ecn */
-	if ((SCTP_BASE_SYSCTL(sctp_ecn_enable)) &&
-	    (SCTP_BASE_SYSCTL(sctp_ecn_nonce)) &&
-	    (asoc->peer_supports_ecn_nonce))
-		flags = (asoc->receiver_nonce_sum & SCTP_SACK_NONCE_SUM);
-	else
-		flags = 0;
+	flags = 0;
 
 	if ((asoc->sctp_cmt_on_off > 0) &&
 	    SCTP_BASE_SYSCTL(sctp_cmt_use_dac)) {
@@ -10809,11 +10738,11 @@ sctp_send_ecn_echo(struct sctp_tcb *stcb
 			ctsn = ntohl(ecne->tsn);
 			if (SCTP_TSN_GT(high_tsn, ctsn)) {
 				ecne->tsn = htonl(high_tsn);
-				cnt = ntohl(ecne->num_pkts_since_cwr);
-				cnt++;
-				ecne->num_pkts_since_cwr = htonl(cnt);
 				SCTP_STAT_INCR(sctps_queue_upd_ecne);
 			}
+			cnt = ntohl(ecne->num_pkts_since_cwr);
+			cnt++;
+			ecne->num_pkts_since_cwr = htonl(cnt);
 			return;
 		}
 	}

Modified: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c	Mon Jan 31 11:30:26 2011	(r218128)
+++ head/sys/netinet/sctp_pcb.c	Mon Jan 31 11:50:11 2011	(r218129)
@@ -6139,10 +6139,6 @@ sctp_load_addresses_from_init(struct sct
 
 				}
 			}
-		} else if (ptype == SCTP_ECN_NONCE_SUPPORTED) {
-			/* Peer supports ECN-nonce */
-			stcb->asoc.peer_supports_ecn_nonce = 1;
-			stcb->asoc.ecn_nonce_allowed = 1;
 		} else if (ptype == SCTP_RANDOM) {
 			if (plen > sizeof(random_store))
 				break;

Modified: head/sys/netinet/sctp_structs.h
==============================================================================
--- head/sys/netinet/sctp_structs.h	Mon Jan 31 11:30:26 2011	(r218128)
+++ head/sys/netinet/sctp_structs.h	Mon Jan 31 11:50:11 2011	(r218129)
@@ -330,8 +330,6 @@ struct sctp_data_chunkrec {
 	uint32_t payloadtype;
 	uint32_t context;	/* from send */
 
-	/* ECN Nonce: Nonce Value for this chunk */
-	uint8_t ect_nonce;
 	uint8_t fwd_tsn_cnt;
 	/*
 	 * part of the Highest sacked algorithm to be able to stroke counts
@@ -607,7 +605,7 @@ struct sctp_cc_functions {
 	void (*sctp_cwnd_update_after_timeout) (struct sctp_tcb *stcb,
 	         struct sctp_nets *net);
 	void (*sctp_cwnd_update_after_ecn_echo) (struct sctp_tcb *stcb,
-	         struct sctp_nets *net);
+	         struct sctp_nets *net, int in_window, int num_pkt_lost);
 	void (*sctp_cwnd_update_after_packet_dropped) (struct sctp_tcb *stcb,
 	         struct sctp_nets *net, struct sctp_pktdrop_chunk *cp,
 	         uint32_t * bottle_bw, uint32_t * on_queue);
@@ -866,7 +864,6 @@ struct sctp_association {
 	uint8_t *nr_mapping_array;
 	uint32_t highest_tsn_inside_nr_map;
 
-	uint32_t last_echo_tsn;
 	uint32_t fast_recovery_tsn;
 	uint32_t sat_t3_recovery_tsn;
 	uint32_t tsn_last_delivered;
@@ -921,12 +918,9 @@ struct sctp_association {
 	uint32_t sb_send_resv;	/* amount reserved on a send */
 	uint32_t my_rwnd_control_len;	/* shadow of sb_mbcnt used for rwnd
 					 * control */
-	/* 32 bit nonce stuff */
-	uint32_t nonce_resync_tsn;
-	uint32_t nonce_wait_tsn;
 	uint32_t default_flowlabel;
 	uint32_t pr_sctp_cnt;
-	int ctrl_queue_cnt;	/* could be removed  REM */
+	int ctrl_queue_cnt;	/* could be removed  REM - NO IT CAN'T!! RRS */

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Mon Jan 31 12:44:34 2011
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3427A1065673;
	Mon, 31 Jan 2011 12:44:34 +0000 (UTC)
	(envelope-from gavin@FreeBSD.org)
Received: from gse-mta-27.emailfiltering.com (gse-mta-27-tx.emailfiltering.com
	[194.116.198.158])
	by mx1.freebsd.org (Postfix) with ESMTP id EEB108FC17;
	Mon, 31 Jan 2011 12:44:32 +0000 (UTC)
Received: from mail-gw12.york.ac.uk ([144.32.129.162])
	by gse-mta-27.emailfiltering.com with emfmta (version 4.8.0.417) by TLS
	id 890007720 for andrew@FreeBSD.org; d57d04184f792023;
	Mon, 31 Jan 2011 12:34:19 +0000
Received: from buffy-128.york.ac.uk ([144.32.128.160]:26163
	helo=buffy.york.ac.uk) by mail-gw12.york.ac.uk with esmtps
	(TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71)
	(envelope-from )
	id 1PjsxW-0004zH-Ph; Mon, 31 Jan 2011 12:34:18 +0000
Received: from buffy.york.ac.uk (localhost [127.0.0.1])
	by buffy.york.ac.uk (8.14.4/8.14.4) with ESMTP id p0VCYI0h086353;
	Mon, 31 Jan 2011 12:34:18 GMT (envelope-from gavin@FreeBSD.org)
Received: (from ga9@localhost)
	by buffy.york.ac.uk (8.14.4/8.14.4/Submit) id p0VCYIBH086352;
	Mon, 31 Jan 2011 12:34:18 GMT (envelope-from gavin@FreeBSD.org)
X-Authentication-Warning: buffy.york.ac.uk: ga9 set sender to
	gavin@FreeBSD.org using -f
From: Gavin Atkinson 
To: Andrew Turner 
In-Reply-To: <201101290053.p0T0rwg2007250@svn.freebsd.org>
References: <201101290053.p0T0rwg2007250@svn.freebsd.org>
Content-Type: text/plain; charset="ASCII"
Content-Transfer-Encoding: quoted-printable
Date: Mon, 31 Jan 2011 12:34:17 +0000
Message-ID: <1296477257.85782.2.camel@buffy.york.ac.uk>
Mime-Version: 1.0
X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port 
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r218055 - head/sys/dev/cs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 31 Jan 2011 12:44:34 -0000

On Sat, 2011-01-29 at 00:53 +0000, Andrew Turner wrote:
> Author: andrew
> Date: Sat Jan 29 00:53:58 2011
> New Revision: 218055
> URL: http://svn.freebsd.org/changeset/base/218055
>=20
> Log:
>   Use bus space functions rather than inw/outw
>   to help a future port of the driver to ARM.
>  =20
>   Approved by:	imp (mentor)

Thanks!  This has been on my todo list for way too long.

http://www.freebsd.org/projects/busdma/ now needs updating to reflect
this change, although a lot of other entries on that page could also do
with updating too.

Thanks,

Gavin

--=20
Gavin Atkinson
FreeBSD committer and bugmeister
GPG: A093262B (313A A79F 697D 3A5C 216A  EDF5 935D EF44 A093 262B)

From owner-svn-src-head@FreeBSD.ORG  Mon Jan 31 15:17:48 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2D2EE106564A;
	Mon, 31 Jan 2011 15:17:48 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1C9098FC08;
	Mon, 31 Jan 2011 15:17:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0VFHm1L028042;
	Mon, 31 Jan 2011 15:17:48 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0VFHl9F028038;
	Mon, 31 Jan 2011 15:17:47 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <201101311517.p0VFHl9F028038@svn.freebsd.org>
From: Warner Losh 
Date: Mon, 31 Jan 2011 15:17:47 +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: r218130 - head
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 31 Jan 2011 15:17:48 -0000

Author: imp
Date: Mon Jan 31 15:17:47 2011
New Revision: 218130
URL: http://svn.freebsd.org/changeset/base/218130

Log:
  Move the architecture guessing from Makefile.inc1 to Makefile.  We
  need to do this because variables specified on the command line
  override those specified in the Makefile.  This is why we also moved
  from TARGET to _TARGET in Makefile, and then set TARGET on the command
  line when we fork a submake with Makefile.inc1.
  
  This makes mips/mips work again, even without the workaround committed to
  lib/libc/Makefile.

Modified:
  head/Makefile
  head/Makefile.inc1

Modified: head/Makefile
==============================================================================
--- head/Makefile	Mon Jan 31 11:50:11 2011	(r218129)
+++ head/Makefile	Mon Jan 31 15:17:47 2011	(r218130)
@@ -126,6 +126,38 @@ BINMAKE= \
 	-m ${.CURDIR}/share/mk
 _MAKE=	PATH=${PATH} ${BINMAKE} -f Makefile.inc1
 
+# Guess machine architecture from machine type, and vice versa.
+.if !defined(TARGET_ARCH) && defined(TARGET)
+_TARGET_ARCH=	${TARGET:S/pc98/i386/:S/sun4v/sparc64/:S/mips/mipsel/}
+.elif !defined(TARGET) && defined(TARGET_ARCH) && \
+    ${TARGET_ARCH} != ${MACHINE_ARCH}
+_TARGET=		${TARGET_ARCH:C/mips.*e[lb]/mips/:C/armeb/arm/}
+.endif
+# Legacy names, for a transition period mips:mips -> mipsel:mips
+.if defined(TARGET) && defined(TARGET_ARCH) && \
+    ${TARGET_ARCH} == "mips" && ${TARGET} == "mips"
+.warning "TARGET_ARCH of mips is deprecated in favor of mipsel or mipseb"
+.if defined(TARGET_BIG_ENDIAN)
+_TARGET_ARCH=mipseb
+.else
+_TARGET_ARCH=mipsel
+.endif
+.endif
+# arm with TARGET_BIG_ENDIAN -> armeb
+.if defined(TARGET_ARCH) && ${TARGET_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN)
+.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated.  use armeb"
+_TARGET_ARCH=armeb
+.endif
+.if defined(TARGET) && !defined(_TARGET)
+_TARGET=${TARGET}
+.endif
+.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH)
+_TARGET_ARCH=${TARGET_ARCH}
+.endif
+# Otherwise, default to current machine type and architecture.
+_TARGET?=	${MACHINE}
+_TARGET_ARCH?=	${MACHINE_ARCH}
+
 #
 # Make sure we have an up-to-date make(1). Only world and buildworld
 # should do this as those are the initial targets used for upgrades.
@@ -173,8 +205,7 @@ cleanworld:
 #
 
 ${TGTS}:
-	${_+_}@cd ${.CURDIR}; \
-		${_MAKE} ${.TARGET}
+	${_+_}cd ${.CURDIR}; ${_MAKE} TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH} ${.TARGET}
 
 # Set a reasonable default
 .MAIN:	all

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1	Mon Jan 31 11:50:11 2011	(r218129)
+++ head/Makefile.inc1	Mon Jan 31 15:17:47 2011	(r218130)
@@ -116,32 +116,6 @@ VERSION!=	uname -srp
 VERSION+=	${OSRELDATE}
 .endif
 
-# Guess machine architecture from machine type, and vice versa.
-.if !defined(TARGET_ARCH) && defined(TARGET)
-TARGET_ARCH=	${TARGET:S/pc98/i386/:S/sun4v/sparc64/:S/mips/mipsel/}
-.elif !defined(TARGET) && defined(TARGET_ARCH) && \
-    ${TARGET_ARCH} != ${MACHINE_ARCH}
-TARGET=		${TARGET_ARCH:C/mips.*e[lb]/mips/:C/armeb/arm/}
-.endif
-# Legacy names, for a transition period mips:mips -> mipsel:mips
-.if defined(TARGET) && defined(TARGET_ARCH) && \
-    ${TARGET_ARCH} == "mips" && ${TARGET} == "mips"
-.warning "TARGET_ARCH of mips is deprecated in favor of mipsel or mipseb"
-.if defined(TARGET_BIG_ENDIAN)
-TARGET_ARCH=mipseb
-.else
-TARGET_ARCH=mipsel
-.endif
-.endif
-# arm with TARGET_BIG_ENDIAN -> armeb
-.if defined(TARGET_ARCH) && ${TARGET_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN)
-.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated.  use armeb"
-TARGET_ARCH=armeb
-.endif
-# Otherwise, default to current machine type and architecture.
-TARGET?=	${MACHINE}
-TARGET_ARCH?=	${MACHINE_ARCH}
-
 KNOWN_ARCHES?=	amd64 arm armeb/arm i386 i386/pc98 ia64 mipsel/mips mipseb/mips mips64el/mips mips64eb/mips mipsn32el/mips mipsn32eb/mips powerpc powerpc64/powerpc sparc64 sparc64/sun4v
 .if ${TARGET} == ${TARGET_ARCH}
 _t=		${TARGET}

From owner-svn-src-head@FreeBSD.ORG  Mon Jan 31 15:42:43 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1C1611065674;
	Mon, 31 Jan 2011 15:42: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 0B3888FC12;
	Mon, 31 Jan 2011 15:42:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0VFggue028717;
	Mon, 31 Jan 2011 15:42:42 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0VFggC6028715;
	Mon, 31 Jan 2011 15:42:42 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201101311542.p0VFggC6028715@svn.freebsd.org>
From: Adrian Chadd 
Date: Mon, 31 Jan 2011 15:42: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: r218131 - head/sys/dev/ath/ath_hal/ar5416
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 31 Jan 2011 15:42:43 -0000

Author: adrian
Date: Mon Jan 31 15:42:42 2011
New Revision: 218131
URL: http://svn.freebsd.org/changeset/base/218131

Log:
  Don't incorrectly set the burst duration setting in the TX descriptor.
  
  After inspecting the ath9k source, it seems the AR5416 and later MACs
  don't take an explicit RTS/CTS duration. A per-scenario (ie, what multi-
  rate retry became) rts/cts control flag and packet duration is provided;
  the hardware then apparently fills in whatever details are required.
  The per-rate sp/lpack duration calculation just isn't used anywhere
  in the ath9k TX packet length calculations.
  
  The burst duration register controls something different; it seems to
  be involved with RTS/CTS protection of 11n aggregate frames and is set
  via a call to ar5416Set11nBurstDuration().
  
  I've done some light testing with rts/cts protected frames and nothing
  seems to break; but this may break said RTS/CTS and CTS-to-self protection.

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c	Mon Jan 31 15:17:47 2011	(r218130)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c	Mon Jan 31 15:42:42 2011	(r218131)
@@ -227,7 +227,6 @@ ar5416SetupTxDesc(struct ath_hal *ah, st
 		ads->ds_ctl0 |= (flags & HAL_TXDESC_CTSENA ? AR_CTSEnable : 0)
 			     | (flags & HAL_TXDESC_RTSENA ? AR_RTSEnable : 0)
 			     ;
-		ads->ds_ctl2 |= SM(rtsctsDuration, AR_BurstDur);
 		ads->ds_ctl7 |= (rtsctsRate << AR_RTSCTSRate_S);
 	}
 
@@ -421,7 +420,6 @@ ar5416SetupFirstTxDesc(struct ath_hal *a
 		/* XXX validate rtsctsDuration */
 		ads->ds_ctl0 |= (flags & HAL_TXDESC_CTSENA ? AR_CTSEnable : 0)
 			| (flags & HAL_TXDESC_RTSENA ? AR_RTSEnable : 0);
-		ads->ds_ctl2 |= SM(rtsctsDuration, AR_BurstDur);
 	}
 
 	if (AR_SREV_KITE(ah)) {

From owner-svn-src-head@FreeBSD.ORG  Mon Jan 31 15:52:01 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 34233106566B;
	Mon, 31 Jan 2011 15:52:01 +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 0923C8FC17;
	Mon, 31 Jan 2011 15:52:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0VFq0Ek029089;
	Mon, 31 Jan 2011 15:52:00 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0VFq0k1029086;
	Mon, 31 Jan 2011 15:52:00 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201101311552.p0VFq0k1029086@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Mon, 31 Jan 2011 15:52:00 +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: r218132 - head/sbin/hastd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 31 Jan 2011 15:52:01 -0000

Author: pjd
Date: Mon Jan 31 15:52:00 2011
New Revision: 218132
URL: http://svn.freebsd.org/changeset/base/218132

Log:
  Rename pjdlog_verify() to pjdlog_abort() as it better describes what the
  the function does and mark it with __dead2.
  
  MFC after:	1 week

Modified:
  head/sbin/hastd/pjdlog.c
  head/sbin/hastd/pjdlog.h

Modified: head/sbin/hastd/pjdlog.c
==============================================================================
--- head/sbin/hastd/pjdlog.c	Mon Jan 31 15:42:42 2011	(r218131)
+++ head/sbin/hastd/pjdlog.c	Mon Jan 31 15:52:00 2011	(r218132)
@@ -437,10 +437,10 @@ pjdlog_exitx(int exitcode, const char *f
 }
 
 /*
- * Log assertion and exit.
+ * Log failure message and exit.
  */
 void
-pjdlog_verify(const char *func, const char *file, int line,
+pjdlog_abort(const char *func, const char *file, int line,
     const char *failedexpr, const char *fmt, ...)
 {
 	va_list ap;

Modified: head/sbin/hastd/pjdlog.h
==============================================================================
--- head/sbin/hastd/pjdlog.h	Mon Jan 31 15:42:42 2011	(r218131)
+++ head/sbin/hastd/pjdlog.h	Mon Jan 31 15:52:00 2011	(r218132)
@@ -89,22 +89,22 @@ void pjdlogv_exit(int exitcode, const ch
 void pjdlog_exitx(int exitcode, const char *fmt, ...) __printflike(2, 3) __dead2;
 void pjdlogv_exitx(int exitcode, const char *fmt, va_list ap) __printflike(2, 0) __dead2;
 
-void pjdlog_verify(const char *func, const char *file, int line,
-    const char *failedexpr, const char *fmt, ...) __printflike(5, 6);
+void pjdlog_abort(const char *func, const char *file, int line,
+    const char *failedexpr, const char *fmt, ...) __printflike(5, 6) __dead2;
 
 #define	PJDLOG_VERIFY(expr)	do {					\
 	if (!(expr)) {							\
-		pjdlog_verify(__func__, __FILE__, __LINE__, #expr,	\
+		pjdlog_abort(__func__, __FILE__, __LINE__, #expr,	\
 		    __func__);						\
 	}								\
 } while (0)
 #define	PJDLOG_RVERIFY(expr, ...)	do {				\
 	if (!(expr)) {							\
-		pjdlog_verify(__func__, __FILE__, __LINE__, #expr,	\
+		pjdlog_abort(__func__, __FILE__, __LINE__, #expr,	\
 		    __VA_ARGS__);					\
 	}								\
 } while (0)
-#define	PJDLOG_ABORT(...)	pjdlog_verify(__func__, __FILE__,	\
+#define	PJDLOG_ABORT(...)	pjdlog_abort(__func__, __FILE__,	\
 				    __LINE__, NULL, __VA_ARGS__)
 #ifdef NDEBUG
 #define	PJDLOG_ASSERT(expr)	do { } while (0)

From owner-svn-src-head@FreeBSD.ORG  Mon Jan 31 18:32:17 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CA2651065696;
	Mon, 31 Jan 2011 18:32:17 +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 B8BA78FC0A;
	Mon, 31 Jan 2011 18:32:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0VIWHxi039326;
	Mon, 31 Jan 2011 18:32:17 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0VIWHGW039317;
	Mon, 31 Jan 2011 18:32:17 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201101311832.p0VIWHGW039317@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Mon, 31 Jan 2011 18:32: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: r218138 - head/sbin/hastd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 31 Jan 2011 18:32:17 -0000

Author: pjd
Date: Mon Jan 31 18:32:17 2011
New Revision: 218138
URL: http://svn.freebsd.org/changeset/base/218138

Log:
  - Use pjdlog for assertions and aborts as this will log assert/abort message
    to syslog if we run in background.
  - Asserts in proto.c that method we want to call is implemented and remove
    dummy methods from protocols implementation that are only there to abort
    the program with nice message.
  
  MFC after:	1 week

Modified:
  head/sbin/hastd/hastd.c
  head/sbin/hastd/primary.c
  head/sbin/hastd/proto.c
  head/sbin/hastd/proto_common.c
  head/sbin/hastd/proto_socketpair.c
  head/sbin/hastd/proto_tcp4.c
  head/sbin/hastd/proto_uds.c
  head/sbin/hastd/secondary.c
  head/sbin/hastd/subr.c

Modified: head/sbin/hastd/hastd.c
==============================================================================
--- head/sbin/hastd/hastd.c	Mon Jan 31 17:57:53 2011	(r218137)
+++ head/sbin/hastd/hastd.c	Mon Jan 31 18:32:17 2011	(r218138)
@@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
@@ -328,7 +327,7 @@ resource_needs_restart(const struct hast
     const struct hast_resource *res1)
 {
 
-	assert(strcmp(res0->hr_name, res1->hr_name) == 0);
+	PJDLOG_ASSERT(strcmp(res0->hr_name, res1->hr_name) == 0);
 
 	if (strcmp(res0->hr_provname, res1->hr_provname) != 0)
 		return (true);
@@ -353,9 +352,9 @@ resource_needs_reload(const struct hast_
     const struct hast_resource *res1)
 {
 
-	assert(strcmp(res0->hr_name, res1->hr_name) == 0);
-	assert(strcmp(res0->hr_provname, res1->hr_provname) == 0);
-	assert(strcmp(res0->hr_localpath, res1->hr_localpath) == 0);
+	PJDLOG_ASSERT(strcmp(res0->hr_name, res1->hr_name) == 0);
+	PJDLOG_ASSERT(strcmp(res0->hr_provname, res1->hr_provname) == 0);
+	PJDLOG_ASSERT(strcmp(res0->hr_localpath, res1->hr_localpath) == 0);
 
 	if (res0->hr_role != HAST_ROLE_PRIMARY)
 		return (false);
@@ -377,7 +376,7 @@ resource_reload(const struct hast_resour
 	struct nv *nvin, *nvout;
 	int error;
 
-	assert(res->hr_role == HAST_ROLE_PRIMARY);
+	PJDLOG_ASSERT(res->hr_role == HAST_ROLE_PRIMARY);
 
 	nvout = nv_alloc();
 	nv_add_uint8(nvout, HASTCTL_RELOAD, "cmd");
@@ -524,7 +523,7 @@ hastd_reload(void)
 			if (strcmp(cres->hr_name, nres->hr_name) == 0)
 				break;
 		}
-		assert(cres != NULL);
+		PJDLOG_ASSERT(cres != NULL);
 		if (resource_needs_restart(cres, nres)) {
 			pjdlog_info("Resource %s configuration was modified, restarting it.",
 			    cres->hr_name);
@@ -700,10 +699,10 @@ listen_accept(void)
 	 * we have to cancel those and accept the new connection.
 	 */
 	if (token == NULL) {
-		assert(res->hr_remoteout == NULL);
+		PJDLOG_ASSERT(res->hr_remoteout == NULL);
 		pjdlog_debug(1, "Initial connection from %s.", raddr);
 		if (res->hr_workerpid != 0) {
-			assert(res->hr_remotein == NULL);
+			PJDLOG_ASSERT(res->hr_remotein == NULL);
 			pjdlog_debug(1,
 			    "Worker process exists (pid=%u), stopping it.",
 			    (unsigned int)res->hr_workerpid);
@@ -843,29 +842,29 @@ main_loop(void)
 				hastd_reload();
 				break;
 			default:
-				assert(!"invalid condition");
+				PJDLOG_ABORT("Unexpected signal (%d).", signo);
 			}
 		}
 
 		/* Setup descriptors for select(2). */
 		FD_ZERO(&rfds);
 		maxfd = fd = proto_descriptor(cfg->hc_controlconn);
-		assert(fd >= 0);
+		PJDLOG_ASSERT(fd >= 0);
 		FD_SET(fd, &rfds);
 		fd = proto_descriptor(cfg->hc_listenconn);
-		assert(fd >= 0);
+		PJDLOG_ASSERT(fd >= 0);
 		FD_SET(fd, &rfds);
 		maxfd = fd > maxfd ? fd : maxfd;
 		TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) {
 			if (res->hr_event == NULL)
 				continue;
 			fd = proto_descriptor(res->hr_event);
-			assert(fd >= 0);
+			PJDLOG_ASSERT(fd >= 0);
 			FD_SET(fd, &rfds);
 			maxfd = fd > maxfd ? fd : maxfd;
 		}
 
-		assert(maxfd + 1 <= (int)FD_SETSIZE);
+		PJDLOG_ASSERT(maxfd + 1 <= (int)FD_SETSIZE);
 		ret = select(maxfd + 1, &rfds, NULL, NULL, &seltimeout);
 		if (ret == 0)
 			hook_check();
@@ -957,7 +956,7 @@ main(int argc, char *argv[])
 	}
 
 	cfg = yy_config_parse(cfgpath, true);
-	assert(cfg != NULL);
+	PJDLOG_ASSERT(cfg != NULL);
 
 	/*
 	 * Restore default actions for interesting signals in case parent

Modified: head/sbin/hastd/primary.c
==============================================================================
--- head/sbin/hastd/primary.c	Mon Jan 31 17:57:53 2011	(r218137)
+++ head/sbin/hastd/primary.c	Mon Jan 31 18:32:17 2011	(r218138)
@@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#include 
 #include 
 #include 
 #include 
@@ -266,7 +265,7 @@ primary_exit(int exitcode, const char *f
 {
 	va_list ap;
 
-	assert(exitcode != EX_OK);
+	PJDLOG_ASSERT(exitcode != EX_OK);
 	va_start(ap, fmt);
 	pjdlogv_errno(LOG_ERR, fmt, ap);
 	va_end(ap);
@@ -293,8 +292,8 @@ hast_activemap_flush(struct hast_resourc
 	size_t size;
 
 	buf = activemap_bitmap(res->hr_amp, &size);
-	assert(buf != NULL);
-	assert((size % res->hr_local_sectorsize) == 0);
+	PJDLOG_ASSERT(buf != NULL);
+	PJDLOG_ASSERT((size % res->hr_local_sectorsize) == 0);
 	if (pwrite(res->hr_localfd, buf, size, METADATA_SIZE) !=
 	    (ssize_t)size) {
 		KEEP_ERRNO(pjdlog_errno(LOG_ERR,
@@ -503,8 +502,8 @@ init_remote(struct hast_resource *res, s
 	uint32_t mapsize;
 	size_t size;
 
-	assert((inp == NULL && outp == NULL) || (inp != NULL && outp != NULL));
-	assert(real_remote(res));
+	PJDLOG_ASSERT((inp == NULL && outp == NULL) || (inp != NULL && outp != NULL));
+	PJDLOG_ASSERT(real_remote(res));
 
 	in = out = NULL;
 	errmsg = NULL;
@@ -857,7 +856,7 @@ hastd_primary(struct hast_resource *res)
 	 * very begining.
 	 */
 	error = pthread_create(&td, NULL, guard_thread, res);
-	assert(error == 0);
+	PJDLOG_ASSERT(error == 0);
 	/*
 	 * Create the control thread before sending any event to the parent,
 	 * as we can deadlock when parent sends control request to worker,
@@ -867,19 +866,19 @@ hastd_primary(struct hast_resource *res)
 	 * request response.
 	 */
 	error = pthread_create(&td, NULL, ctrl_thread, res);
-	assert(error == 0);
+	PJDLOG_ASSERT(error == 0);
 	if (real_remote(res) && init_remote(res, NULL, NULL))
 		sync_start();
 	error = pthread_create(&td, NULL, ggate_recv_thread, res);
-	assert(error == 0);
+	PJDLOG_ASSERT(error == 0);
 	error = pthread_create(&td, NULL, local_send_thread, res);
-	assert(error == 0);
+	PJDLOG_ASSERT(error == 0);
 	error = pthread_create(&td, NULL, remote_send_thread, res);
-	assert(error == 0);
+	PJDLOG_ASSERT(error == 0);
 	error = pthread_create(&td, NULL, remote_recv_thread, res);
-	assert(error == 0);
+	PJDLOG_ASSERT(error == 0);
 	error = pthread_create(&td, NULL, ggate_send_thread, res);
-	assert(error == 0);
+	PJDLOG_ASSERT(error == 0);
 	(void)sync_thread(res);
 }
 
@@ -932,14 +931,14 @@ remote_close(struct hast_resource *res, 
 	 * another thread can close connection in-between.
 	 */
 	if (!ISCONNECTED(res, ncomp)) {
-		assert(res->hr_remotein == NULL);
-		assert(res->hr_remoteout == NULL);
+		PJDLOG_ASSERT(res->hr_remotein == NULL);
+		PJDLOG_ASSERT(res->hr_remoteout == NULL);
 		rw_unlock(&hio_remote_lock[ncomp]);
 		return;
 	}
 
-	assert(res->hr_remotein != NULL);
-	assert(res->hr_remoteout != NULL);
+	PJDLOG_ASSERT(res->hr_remotein != NULL);
+	PJDLOG_ASSERT(res->hr_remoteout != NULL);
 
 	pjdlog_debug(2, "Closing incoming connection to %s.",
 	    res->hr_remoteaddr);
@@ -1051,7 +1050,7 @@ ggate_recv_thread(void *arg)
 				ncomp = 0;
 			} else /* if (res->hr_syncsrc ==
 			    HAST_SYNCSRC_SECONDARY) */ {
-				assert(res->hr_syncsrc ==
+				PJDLOG_ASSERT(res->hr_syncsrc ==
 				    HAST_SYNCSRC_SECONDARY);
 				/*
 				 * This range is out-of-date on local component,
@@ -1233,8 +1232,8 @@ keepalive_send(struct hast_resource *res
 	if (!ISCONNECTED(res, ncomp))
 		return;
 	
-	assert(res->hr_remotein != NULL);
-	assert(res->hr_remoteout != NULL);
+	PJDLOG_ASSERT(res->hr_remotein != NULL);
+	PJDLOG_ASSERT(res->hr_remoteout != NULL);
 
 	nv = nv_alloc();
 	nv_add_uint8(nv, HIO_KEEPALIVE, "cmd");
@@ -1317,7 +1316,7 @@ remote_send_thread(void *arg)
 			length = 0;
 			break;
 		default:
-			assert(!"invalid condition");
+			PJDLOG_ASSERT(!"invalid condition");
 			abort();
 		}
 		nv = nv_alloc();
@@ -1447,7 +1446,7 @@ remote_recv_thread(void *arg)
 			 */
 			mtx_lock(&hio_recv_list_lock[ncomp]);
 			hio = TAILQ_FIRST(&hio_recv_list[ncomp]);
-			assert(hio != NULL);
+			PJDLOG_ASSERT(hio != NULL);
 			TAILQ_REMOVE(&hio_recv_list[ncomp], hio,
 			    hio_next[ncomp]);
 			mtx_unlock(&hio_recv_list_lock[ncomp]);
@@ -1517,7 +1516,7 @@ remote_recv_thread(void *arg)
 		case BIO_FLUSH:
 			break;
 		default:
-			assert(!"invalid condition");
+			PJDLOG_ASSERT(!"invalid condition");
 			abort();
 		}
 		hio->hio_errors[ncomp] = 0;
@@ -1769,7 +1768,7 @@ sync_thread(void *arg __unused)
 			 /* Local component is 0 for now. */
 			ncomp = 0;
 		} else /* if (res->hr_syncsrc == HAST_SYNCSRC_SECONDARY) */ {
-			assert(res->hr_syncsrc == HAST_SYNCSRC_SECONDARY);
+			PJDLOG_ASSERT(res->hr_syncsrc == HAST_SYNCSRC_SECONDARY);
 			/*
 			 * This range is out-of-date on local component,
 			 * so send request to the remote node.
@@ -1816,7 +1815,7 @@ sync_thread(void *arg __unused)
 			 /* Remote component is 1 for now. */
 			ncomp = 1;
 		} else /* if (res->hr_syncsrc == HAST_SYNCSRC_SECONDARY) */ {
-			assert(res->hr_syncsrc == HAST_SYNCSRC_SECONDARY);
+			PJDLOG_ASSERT(res->hr_syncsrc == HAST_SYNCSRC_SECONDARY);
 			/*
 			 * This range is out-of-date on local component,
 			 * so we update it.
@@ -1869,8 +1868,8 @@ primary_config_reload(struct hast_resour
 
 	pjdlog_info("Reloading configuration...");
 
-	assert(res->hr_role == HAST_ROLE_PRIMARY);
-	assert(gres == res);
+	PJDLOG_ASSERT(res->hr_role == HAST_ROLE_PRIMARY);
+	PJDLOG_ASSERT(gres == res);
 	nv_assert(nv, "remoteaddr");
 	nv_assert(nv, "replication");
 	nv_assert(nv, "timeout");
@@ -1971,16 +1970,16 @@ guard_one(struct hast_resource *res, uns
 	}
 
 	if (ISCONNECTED(res, ncomp)) {
-		assert(res->hr_remotein != NULL);
-		assert(res->hr_remoteout != NULL);
+		PJDLOG_ASSERT(res->hr_remotein != NULL);
+		PJDLOG_ASSERT(res->hr_remoteout != NULL);
 		rw_unlock(&hio_remote_lock[ncomp]);
 		pjdlog_debug(2, "remote_guard: Connection to %s is ok.",
 		    res->hr_remoteaddr);
 		return;
 	}
 
-	assert(res->hr_remotein == NULL);
-	assert(res->hr_remoteout == NULL);
+	PJDLOG_ASSERT(res->hr_remotein == NULL);
+	PJDLOG_ASSERT(res->hr_remoteout == NULL);
 	/*
 	 * Upgrade the lock. It doesn't have to be atomic as no other thread
 	 * can change connection status from disconnected to connected.
@@ -1991,9 +1990,9 @@ guard_one(struct hast_resource *res, uns
 	in = out = NULL;
 	if (init_remote(res, &in, &out)) {
 		rw_wlock(&hio_remote_lock[ncomp]);
-		assert(res->hr_remotein == NULL);
-		assert(res->hr_remoteout == NULL);
-		assert(in != NULL && out != NULL);
+		PJDLOG_ASSERT(res->hr_remotein == NULL);
+		PJDLOG_ASSERT(res->hr_remoteout == NULL);
+		PJDLOG_ASSERT(in != NULL && out != NULL);
 		res->hr_remotein = in;
 		res->hr_remoteout = out;
 		rw_unlock(&hio_remote_lock[ncomp]);
@@ -2002,9 +2001,9 @@ guard_one(struct hast_resource *res, uns
 		sync_start();
 	} else {
 		/* Both connections should be NULL. */
-		assert(res->hr_remotein == NULL);
-		assert(res->hr_remoteout == NULL);
-		assert(in == NULL && out == NULL);
+		PJDLOG_ASSERT(res->hr_remotein == NULL);
+		PJDLOG_ASSERT(res->hr_remoteout == NULL);
+		PJDLOG_ASSERT(in == NULL && out == NULL);
 		pjdlog_debug(2, "remote_guard: Reconnect to %s failed.",
 		    res->hr_remoteaddr);
 	}

Modified: head/sbin/hastd/proto.c
==============================================================================
--- head/sbin/hastd/proto.c	Mon Jan 31 17:57:53 2011	(r218137)
+++ head/sbin/hastd/proto.c	Mon Jan 31 18:32:17 2011	(r218138)
@@ -34,10 +34,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
 #include 
 
+#include "pjdlog.h"
 #include "proto.h"
 #include "proto_impl.h"
 
@@ -62,7 +62,7 @@ proto_register(struct hast_proto *proto,
 	if (!isdefault)
 		TAILQ_INSERT_HEAD(&protos, proto, hp_next);
 	else {
-		assert(!seen_default);
+		PJDLOG_ASSERT(!seen_default);
 		seen_default = true;
 		TAILQ_INSERT_TAIL(&protos, proto, hp_next);
 	}
@@ -76,7 +76,7 @@ proto_common_setup(const char *addr, str
 	void *ctx;
 	int ret;
 
-	assert(side == PROTO_SIDE_CLIENT || side == PROTO_SIDE_SERVER_LISTEN);
+	PJDLOG_ASSERT(side == PROTO_SIDE_CLIENT || side == PROTO_SIDE_SERVER_LISTEN);
 
 	conn = malloc(sizeof(*conn));
 	if (conn == NULL)
@@ -127,10 +127,11 @@ proto_connect(struct proto_conn *conn)
 {
 	int ret;
 
-	assert(conn != NULL);
-	assert(conn->pc_magic == PROTO_CONN_MAGIC);
-	assert(conn->pc_side == PROTO_SIDE_CLIENT);
-	assert(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn != NULL);
+	PJDLOG_ASSERT(conn->pc_magic == PROTO_CONN_MAGIC);
+	PJDLOG_ASSERT(conn->pc_side == PROTO_SIDE_CLIENT);
+	PJDLOG_ASSERT(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn->pc_proto->hp_connect != NULL);
 
 	ret = conn->pc_proto->hp_connect(conn->pc_ctx);
 	if (ret != 0) {
@@ -154,10 +155,11 @@ proto_accept(struct proto_conn *conn, st
 	struct proto_conn *newconn;
 	int ret;
 
-	assert(conn != NULL);
-	assert(conn->pc_magic == PROTO_CONN_MAGIC);
-	assert(conn->pc_side == PROTO_SIDE_SERVER_LISTEN);
-	assert(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn != NULL);
+	PJDLOG_ASSERT(conn->pc_magic == PROTO_CONN_MAGIC);
+	PJDLOG_ASSERT(conn->pc_side == PROTO_SIDE_SERVER_LISTEN);
+	PJDLOG_ASSERT(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn->pc_proto->hp_accept != NULL);
 
 	newconn = malloc(sizeof(*newconn));
 	if (newconn == NULL)
@@ -183,9 +185,10 @@ proto_send(const struct proto_conn *conn
 {
 	int ret;
 
-	assert(conn != NULL);
-	assert(conn->pc_magic == PROTO_CONN_MAGIC);
-	assert(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn != NULL);
+	PJDLOG_ASSERT(conn->pc_magic == PROTO_CONN_MAGIC);
+	PJDLOG_ASSERT(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn->pc_proto->hp_send != NULL);
 
 	ret = conn->pc_proto->hp_send(conn->pc_ctx, data, size);
 	if (ret != 0) {
@@ -200,9 +203,10 @@ proto_recv(const struct proto_conn *conn
 {
 	int ret;
 
-	assert(conn != NULL);
-	assert(conn->pc_magic == PROTO_CONN_MAGIC);
-	assert(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn != NULL);
+	PJDLOG_ASSERT(conn->pc_magic == PROTO_CONN_MAGIC);
+	PJDLOG_ASSERT(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn->pc_proto->hp_recv != NULL);
 
 	ret = conn->pc_proto->hp_recv(conn->pc_ctx, data, size);
 	if (ret != 0) {
@@ -216,9 +220,10 @@ int
 proto_descriptor(const struct proto_conn *conn)
 {
 
-	assert(conn != NULL);
-	assert(conn->pc_magic == PROTO_CONN_MAGIC);
-	assert(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn != NULL);
+	PJDLOG_ASSERT(conn->pc_magic == PROTO_CONN_MAGIC);
+	PJDLOG_ASSERT(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn->pc_proto->hp_descriptor != NULL);
 
 	return (conn->pc_proto->hp_descriptor(conn->pc_ctx));
 }
@@ -227,9 +232,10 @@ bool
 proto_address_match(const struct proto_conn *conn, const char *addr)
 {
 
-	assert(conn != NULL);
-	assert(conn->pc_magic == PROTO_CONN_MAGIC);
-	assert(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn != NULL);
+	PJDLOG_ASSERT(conn->pc_magic == PROTO_CONN_MAGIC);
+	PJDLOG_ASSERT(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn->pc_proto->hp_address_match != NULL);
 
 	return (conn->pc_proto->hp_address_match(conn->pc_ctx, addr));
 }
@@ -238,9 +244,10 @@ void
 proto_local_address(const struct proto_conn *conn, char *addr, size_t size)
 {
 
-	assert(conn != NULL);
-	assert(conn->pc_magic == PROTO_CONN_MAGIC);
-	assert(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn != NULL);
+	PJDLOG_ASSERT(conn->pc_magic == PROTO_CONN_MAGIC);
+	PJDLOG_ASSERT(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn->pc_proto->hp_local_address != NULL);
 
 	conn->pc_proto->hp_local_address(conn->pc_ctx, addr, size);
 }
@@ -249,9 +256,10 @@ void
 proto_remote_address(const struct proto_conn *conn, char *addr, size_t size)
 {
 
-	assert(conn != NULL);
-	assert(conn->pc_magic == PROTO_CONN_MAGIC);
-	assert(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn != NULL);
+	PJDLOG_ASSERT(conn->pc_magic == PROTO_CONN_MAGIC);
+	PJDLOG_ASSERT(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn->pc_proto->hp_remote_address != NULL);
 
 	conn->pc_proto->hp_remote_address(conn->pc_ctx, addr, size);
 }
@@ -262,9 +270,9 @@ proto_timeout(const struct proto_conn *c
 	struct timeval tv;
 	int fd;
 
-	assert(conn != NULL);
-	assert(conn->pc_magic == PROTO_CONN_MAGIC);
-	assert(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn != NULL);
+	PJDLOG_ASSERT(conn->pc_magic == PROTO_CONN_MAGIC);
+	PJDLOG_ASSERT(conn->pc_proto != NULL);
 
 	fd = proto_descriptor(conn);
 	if (fd < 0)
@@ -284,9 +292,10 @@ void
 proto_close(struct proto_conn *conn)
 {
 
-	assert(conn != NULL);
-	assert(conn->pc_magic == PROTO_CONN_MAGIC);
-	assert(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn != NULL);
+	PJDLOG_ASSERT(conn->pc_magic == PROTO_CONN_MAGIC);
+	PJDLOG_ASSERT(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn->pc_proto->hp_close != NULL);
 
 	conn->pc_proto->hp_close(conn->pc_ctx);
 	conn->pc_magic = 0;

Modified: head/sbin/hastd/proto_common.c
==============================================================================
--- head/sbin/hastd/proto_common.c	Mon Jan 31 17:57:53 2011	(r218137)
+++ head/sbin/hastd/proto_common.c	Mon Jan 31 18:32:17 2011	(r218138)
@@ -33,11 +33,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
 
+#include "pjdlog.h"
 #include "proto_impl.h"
 
 /* Maximum size of packet we want to use when sending data. */
@@ -51,6 +51,10 @@ proto_common_send(int fd, const unsigned
 	ssize_t done;
 	size_t sendsize;
 
+	PJDLOG_ASSERT(fd >= 0);
+	PJDLOG_ASSERT(data != NULL);
+	PJDLOG_ASSERT(size > 0);
+
 	do {
 		sendsize = size < MAX_SEND_SIZE ? size : MAX_SEND_SIZE;
 		done = send(fd, data, sendsize, MSG_NOSIGNAL);
@@ -73,6 +77,10 @@ proto_common_recv(int fd, unsigned char 
 {
 	ssize_t done;
 
+	PJDLOG_ASSERT(fd >= 0);
+	PJDLOG_ASSERT(data != NULL);
+	PJDLOG_ASSERT(size > 0);
+
 	do {
 		done = recv(fd, data, size, MSG_WAITALL);
 	} while (done == -1 && errno == EINTR);

Modified: head/sbin/hastd/proto_socketpair.c
==============================================================================
--- head/sbin/hastd/proto_socketpair.c	Mon Jan 31 17:57:53 2011	(r218137)
+++ head/sbin/hastd/proto_socketpair.c	Mon Jan 31 18:32:17 2011	(r218138)
@@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
@@ -42,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "hast.h"
+#include "pjdlog.h"
 #include "proto_impl.h"
 
 #define	SP_CTX_MAGIC	0x50c3741
@@ -83,40 +83,13 @@ sp_client(const char *addr, void **ctxp)
 }
 
 static int
-sp_connect(void *ctx __unused)
-{
-
-	assert(!"proto_connect() not supported on socketpairs");
-	abort();
-}
-
-static int
-sp_server(const char *addr, void **ctxp __unused)
-{
-
-	if (strcmp(addr, "socketpair://") != 0)
-		return (-1);
-
-	assert(!"proto_server() not supported on socketpairs");
-	abort();
-}
-
-static int
-sp_accept(void *ctx __unused, void **newctxp __unused)
-{
-
-	assert(!"proto_server() not supported on socketpairs");
-	abort();
-}
-
-static int
 sp_send(void *ctx, const unsigned char *data, size_t size)
 {
 	struct sp_ctx *spctx = ctx;
 	int fd;
 
-	assert(spctx != NULL);
-	assert(spctx->sp_magic == SP_CTX_MAGIC);
+	PJDLOG_ASSERT(spctx != NULL);
+	PJDLOG_ASSERT(spctx->sp_magic == SP_CTX_MAGIC);
 
 	switch (spctx->sp_side) {
 	case SP_SIDE_UNDEF:
@@ -128,16 +101,17 @@ sp_send(void *ctx, const unsigned char *
 		spctx->sp_side = SP_SIDE_CLIENT;
 		/* Close other end. */
 		close(spctx->sp_fd[1]);
+		spctx->sp_fd[1] = -1;
 	case SP_SIDE_CLIENT:
-		assert(spctx->sp_fd[0] >= 0);
+		PJDLOG_ASSERT(spctx->sp_fd[0] >= 0);
 		fd = spctx->sp_fd[0];
 		break;
 	case SP_SIDE_SERVER:
-		assert(spctx->sp_fd[1] >= 0);
+		PJDLOG_ASSERT(spctx->sp_fd[1] >= 0);
 		fd = spctx->sp_fd[1];
 		break;
 	default:
-		abort();
+		PJDLOG_ABORT("Invalid socket side (%d).", spctx->sp_side);
 	}
 
 	/* Someone is just trying to decide about side. */
@@ -153,8 +127,8 @@ sp_recv(void *ctx, unsigned char *data, 
 	struct sp_ctx *spctx = ctx;
 	int fd;
 
-	assert(spctx != NULL);
-	assert(spctx->sp_magic == SP_CTX_MAGIC);
+	PJDLOG_ASSERT(spctx != NULL);
+	PJDLOG_ASSERT(spctx->sp_magic == SP_CTX_MAGIC);
 
 	switch (spctx->sp_side) {
 	case SP_SIDE_UNDEF:
@@ -166,16 +140,17 @@ sp_recv(void *ctx, unsigned char *data, 
 		spctx->sp_side = SP_SIDE_SERVER;
 		/* Close other end. */
 		close(spctx->sp_fd[0]);
+		spctx->sp_fd[0] = -1;
 	case SP_SIDE_SERVER:
-		assert(spctx->sp_fd[1] >= 0);
+		PJDLOG_ASSERT(spctx->sp_fd[1] >= 0);
 		fd = spctx->sp_fd[1];
 		break;
 	case SP_SIDE_CLIENT:
-		assert(spctx->sp_fd[0] >= 0);
+		PJDLOG_ASSERT(spctx->sp_fd[0] >= 0);
 		fd = spctx->sp_fd[0];
 		break;
 	default:
-		abort();
+		PJDLOG_ABORT("Invalid socket side (%d).", spctx->sp_side);
 	}
 
 	/* Someone is just trying to decide about side. */
@@ -190,47 +165,21 @@ sp_descriptor(const void *ctx)
 {
 	const struct sp_ctx *spctx = ctx;
 
-	assert(spctx != NULL);
-	assert(spctx->sp_magic == SP_CTX_MAGIC);
-	assert(spctx->sp_side == SP_SIDE_CLIENT ||
+	PJDLOG_ASSERT(spctx != NULL);
+	PJDLOG_ASSERT(spctx->sp_magic == SP_CTX_MAGIC);
+	PJDLOG_ASSERT(spctx->sp_side == SP_SIDE_CLIENT ||
 	    spctx->sp_side == SP_SIDE_SERVER);
 
 	switch (spctx->sp_side) {
 	case SP_SIDE_CLIENT:
-		assert(spctx->sp_fd[0] >= 0);
+		PJDLOG_ASSERT(spctx->sp_fd[0] >= 0);
 		return (spctx->sp_fd[0]);
 	case SP_SIDE_SERVER:
-		assert(spctx->sp_fd[1] >= 0);
+		PJDLOG_ASSERT(spctx->sp_fd[1] >= 0);
 		return (spctx->sp_fd[1]);
 	}
 
-	abort();
-}
-
-static bool
-sp_address_match(const void *ctx __unused, const char *addr __unused)
-{
-
-	assert(!"proto_address_match() not supported on socketpairs");
-	abort();
-}
-
-static void
-sp_local_address(const void *ctx __unused, char *addr __unused,
-    size_t size __unused)
-{
-
-	assert(!"proto_local_address() not supported on socketpairs");
-	abort();
-}
-
-static void
-sp_remote_address(const void *ctx __unused, char *addr __unused,
-    size_t size __unused)
-{
-
-	assert(!"proto_remote_address() not supported on socketpairs");
-	abort();
+	PJDLOG_ABORT("Invalid socket side (%d).", spctx->sp_side);
 }
 
 static void
@@ -238,22 +187,32 @@ sp_close(void *ctx)
 {
 	struct sp_ctx *spctx = ctx;
 
-	assert(spctx != NULL);
-	assert(spctx->sp_magic == SP_CTX_MAGIC);
+	PJDLOG_ASSERT(spctx != NULL);
+	PJDLOG_ASSERT(spctx->sp_magic == SP_CTX_MAGIC);
 
 	switch (spctx->sp_side) {
 	case SP_SIDE_UNDEF:
+		PJDLOG_ASSERT(spctx->sp_fd[0] >= 0);
 		close(spctx->sp_fd[0]);
+		spctx->sp_fd[0] = -1;
+		PJDLOG_ASSERT(spctx->sp_fd[1] >= 0);
 		close(spctx->sp_fd[1]);
+		spctx->sp_fd[1] = -1;
 		break;
 	case SP_SIDE_CLIENT:
+		PJDLOG_ASSERT(spctx->sp_fd[0] >= 0);
 		close(spctx->sp_fd[0]);
+		spctx->sp_fd[0] = -1;
+		PJDLOG_ASSERT(spctx->sp_fd[1] == -1);
 		break;
 	case SP_SIDE_SERVER:
+		PJDLOG_ASSERT(spctx->sp_fd[1] >= 0);
 		close(spctx->sp_fd[1]);
+		spctx->sp_fd[1] = -1;
+		PJDLOG_ASSERT(spctx->sp_fd[0] == -1);
 		break;
 	default:
-		abort();
+		PJDLOG_ABORT("Invalid socket side (%d).", spctx->sp_side);
 	}
 
 	spctx->sp_magic = 0;
@@ -263,15 +222,9 @@ sp_close(void *ctx)
 static struct hast_proto sp_proto = {
 	.hp_name = "socketpair",
 	.hp_client = sp_client,
-	.hp_connect = sp_connect,
-	.hp_server = sp_server,
-	.hp_accept = sp_accept,
 	.hp_send = sp_send,
 	.hp_recv = sp_recv,
 	.hp_descriptor = sp_descriptor,
-	.hp_address_match = sp_address_match,
-	.hp_local_address = sp_local_address,
-	.hp_remote_address = sp_remote_address,
 	.hp_close = sp_close
 };
 

Modified: head/sbin/hastd/proto_tcp4.c
==============================================================================
--- head/sbin/hastd/proto_tcp4.c	Mon Jan 31 17:57:53 2011	(r218137)
+++ head/sbin/hastd/proto_tcp4.c	Mon Jan 31 18:32:17 2011	(r218138)
@@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
@@ -230,10 +229,10 @@ tcp4_connect(void *ctx)
 	socklen_t esize;
 	int error, flags, ret;
 
-	assert(tctx != NULL);
-	assert(tctx->tc_magic == TCP4_CTX_MAGIC);
-	assert(tctx->tc_side == TCP4_SIDE_CLIENT);
-	assert(tctx->tc_fd >= 0);
+	PJDLOG_ASSERT(tctx != NULL);
+	PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
+	PJDLOG_ASSERT(tctx->tc_side == TCP4_SIDE_CLIENT);
+	PJDLOG_ASSERT(tctx->tc_fd >= 0);
 
 	flags = fcntl(tctx->tc_fd, F_GETFL);
 	if (flags == -1) {
@@ -282,8 +281,8 @@ again:
 		pjdlog_common(LOG_DEBUG, 1, errno, "select() failed");
 		goto done;
 	}
-	assert(ret > 0);
-	assert(FD_ISSET(tctx->tc_fd, &fdset));
+	PJDLOG_ASSERT(ret > 0);
+	PJDLOG_ASSERT(FD_ISSET(tctx->tc_fd, &fdset));
 	esize = sizeof(error);
 	if (getsockopt(tctx->tc_fd, SOL_SOCKET, SO_ERROR, &error,
 	    &esize) == -1) {
@@ -349,10 +348,10 @@ tcp4_accept(void *ctx, void **newctxp)
 	socklen_t fromlen;
 	int ret;
 
-	assert(tctx != NULL);
-	assert(tctx->tc_magic == TCP4_CTX_MAGIC);
-	assert(tctx->tc_side == TCP4_SIDE_SERVER_LISTEN);
-	assert(tctx->tc_fd >= 0);
+	PJDLOG_ASSERT(tctx != NULL);
+	PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
+	PJDLOG_ASSERT(tctx->tc_side == TCP4_SIDE_SERVER_LISTEN);
+	PJDLOG_ASSERT(tctx->tc_fd >= 0);
 
 	newtctx = malloc(sizeof(*newtctx));
 	if (newtctx == NULL)
@@ -379,9 +378,9 @@ tcp4_send(void *ctx, const unsigned char
 {
 	struct tcp4_ctx *tctx = ctx;
 
-	assert(tctx != NULL);
-	assert(tctx->tc_magic == TCP4_CTX_MAGIC);
-	assert(tctx->tc_fd >= 0);
+	PJDLOG_ASSERT(tctx != NULL);
+	PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
+	PJDLOG_ASSERT(tctx->tc_fd >= 0);
 
 	return (proto_common_send(tctx->tc_fd, data, size));
 }
@@ -391,9 +390,9 @@ tcp4_recv(void *ctx, unsigned char *data
 {
 	struct tcp4_ctx *tctx = ctx;
 
-	assert(tctx != NULL);
-	assert(tctx->tc_magic == TCP4_CTX_MAGIC);
-	assert(tctx->tc_fd >= 0);
+	PJDLOG_ASSERT(tctx != NULL);
+	PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
+	PJDLOG_ASSERT(tctx->tc_fd >= 0);
 
 	return (proto_common_recv(tctx->tc_fd, data, size));
 }
@@ -403,8 +402,8 @@ tcp4_descriptor(const void *ctx)
 {
 	const struct tcp4_ctx *tctx = ctx;
 
-	assert(tctx != NULL);
-	assert(tctx->tc_magic == TCP4_CTX_MAGIC);
+	PJDLOG_ASSERT(tctx != NULL);
+	PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
 
 	return (tctx->tc_fd);
 }
@@ -415,8 +414,8 @@ sin2str(struct sockaddr_in *sinp, char *
 	in_addr_t ip;
 	unsigned int port;
 
-	assert(addr != NULL);
-	assert(sinp->sin_family == AF_INET);
+	PJDLOG_ASSERT(addr != NULL);
+	PJDLOG_ASSERT(sinp->sin_family == AF_INET);
 
 	ip = ntohl(sinp->sin_addr.s_addr);
 	port = ntohs(sinp->sin_port);
@@ -433,8 +432,8 @@ tcp4_address_match(const void *ctx, cons
 	socklen_t sinlen;
 	in_addr_t ip1, ip2;
 
-	assert(tctx != NULL);
-	assert(tctx->tc_magic == TCP4_CTX_MAGIC);
+	PJDLOG_ASSERT(tctx != NULL);
+	PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
 
 	if (tcp4_addr(addr, &sin) != 0)
 		return (false);
@@ -455,8 +454,8 @@ tcp4_local_address(const void *ctx, char
 	struct sockaddr_in sin;
 	socklen_t sinlen;
 
-	assert(tctx != NULL);
-	assert(tctx->tc_magic == TCP4_CTX_MAGIC);
+	PJDLOG_ASSERT(tctx != NULL);
+	PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
 
 	sinlen = sizeof(sin);
 	if (getsockname(tctx->tc_fd, (struct sockaddr *)&sin, &sinlen) < 0) {
@@ -473,8 +472,8 @@ tcp4_remote_address(const void *ctx, cha
 	struct sockaddr_in sin;
 	socklen_t sinlen;
 
-	assert(tctx != NULL);
-	assert(tctx->tc_magic == TCP4_CTX_MAGIC);
+	PJDLOG_ASSERT(tctx != NULL);
+	PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
 
 	sinlen = sizeof(sin);
 	if (getpeername(tctx->tc_fd, (struct sockaddr *)&sin, &sinlen) < 0) {
@@ -489,8 +488,8 @@ tcp4_close(void *ctx)
 {
 	struct tcp4_ctx *tctx = ctx;
 
-	assert(tctx != NULL);
-	assert(tctx->tc_magic == TCP4_CTX_MAGIC);
+	PJDLOG_ASSERT(tctx != NULL);
+	PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
 
 	if (tctx->tc_fd >= 0)
 		close(tctx->tc_fd);

Modified: head/sbin/hastd/proto_uds.c
==============================================================================
--- head/sbin/hastd/proto_uds.c	Mon Jan 31 17:57:53 2011	(r218137)
+++ head/sbin/hastd/proto_uds.c	Mon Jan 31 18:32:17 2011	(r218138)
@@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#include 
 #include 
 #include 
 #include 
@@ -128,10 +127,10 @@ uds_connect(void *ctx)
 {
 	struct uds_ctx *uctx = ctx;
 
-	assert(uctx != NULL);
-	assert(uctx->uc_magic == UDS_CTX_MAGIC);
-	assert(uctx->uc_side == UDS_SIDE_CLIENT);
-	assert(uctx->uc_fd >= 0);
+	PJDLOG_ASSERT(uctx != NULL);
+	PJDLOG_ASSERT(uctx->uc_magic == UDS_CTX_MAGIC);
+	PJDLOG_ASSERT(uctx->uc_side == UDS_SIDE_CLIENT);
+	PJDLOG_ASSERT(uctx->uc_fd >= 0);
 
 	if (connect(uctx->uc_fd, (struct sockaddr *)&uctx->uc_sun,
 	    sizeof(uctx->uc_sun)) < 0) {
@@ -177,10 +176,10 @@ uds_accept(void *ctx, void **newctxp)
 	socklen_t fromlen;
 	int ret;
 
-	assert(uctx != NULL);
-	assert(uctx->uc_magic == UDS_CTX_MAGIC);
-	assert(uctx->uc_side == UDS_SIDE_SERVER_LISTEN);
-	assert(uctx->uc_fd >= 0);
+	PJDLOG_ASSERT(uctx != NULL);
+	PJDLOG_ASSERT(uctx->uc_magic == UDS_CTX_MAGIC);
+	PJDLOG_ASSERT(uctx->uc_side == UDS_SIDE_SERVER_LISTEN);
+	PJDLOG_ASSERT(uctx->uc_fd >= 0);
 
 	newuctx = malloc(sizeof(*newuctx));
 	if (newuctx == NULL)
@@ -207,9 +206,9 @@ uds_send(void *ctx, const unsigned char 
 {
 	struct uds_ctx *uctx = ctx;
 
-	assert(uctx != NULL);
-	assert(uctx->uc_magic == UDS_CTX_MAGIC);
-	assert(uctx->uc_fd >= 0);
+	PJDLOG_ASSERT(uctx != NULL);
+	PJDLOG_ASSERT(uctx->uc_magic == UDS_CTX_MAGIC);
+	PJDLOG_ASSERT(uctx->uc_fd >= 0);
 
 	return (proto_common_send(uctx->uc_fd, data, size));
 }
@@ -219,9 +218,9 @@ uds_recv(void *ctx, unsigned char *data,
 {
 	struct uds_ctx *uctx = ctx;
 
-	assert(uctx != NULL);
-	assert(uctx->uc_magic == UDS_CTX_MAGIC);
-	assert(uctx->uc_fd >= 0);
+	PJDLOG_ASSERT(uctx != NULL);
+	PJDLOG_ASSERT(uctx->uc_magic == UDS_CTX_MAGIC);
+	PJDLOG_ASSERT(uctx->uc_fd >= 0);
 
 	return (proto_common_recv(uctx->uc_fd, data, size));
 }
@@ -231,20 +230,12 @@ uds_descriptor(const void *ctx)
 {
 	const struct uds_ctx *uctx = ctx;
 
-	assert(uctx != NULL);
-	assert(uctx->uc_magic == UDS_CTX_MAGIC);
+	PJDLOG_ASSERT(uctx != NULL);
+	PJDLOG_ASSERT(uctx->uc_magic == UDS_CTX_MAGIC);
 
 	return (uctx->uc_fd);
 }
 
-static bool
-uds_address_match(const void *ctx __unused, const char *addr __unused)
-{
-
-	assert(!"proto_address_match() not supported on UNIX domain sockets");
-	abort();
-}
-
 static void
 uds_local_address(const void *ctx, char *addr, size_t size)
 {
@@ -252,16 +243,16 @@ uds_local_address(const void *ctx, char 
 	struct sockaddr_un sun;
 	socklen_t sunlen;
 
-	assert(uctx != NULL);
-	assert(uctx->uc_magic == UDS_CTX_MAGIC);
-	assert(addr != NULL);
+	PJDLOG_ASSERT(uctx != NULL);
+	PJDLOG_ASSERT(uctx->uc_magic == UDS_CTX_MAGIC);
+	PJDLOG_ASSERT(addr != NULL);
 

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Mon Jan 31 18:35:17 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7FE73106566C;
	Mon, 31 Jan 2011 18:35:17 +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 6E2588FC24;
	Mon, 31 Jan 2011 18:35:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0VIZHtQ039568;
	Mon, 31 Jan 2011 18:35:17 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0VIZHgv039561;
	Mon, 31 Jan 2011 18:35:17 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201101311835.p0VIZHgv039561@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Mon, 31 Jan 2011 18:35: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: r218139 - head/sbin/hastd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 31 Jan 2011 18:35:17 -0000

Author: pjd
Date: Mon Jan 31 18:35:17 2011
New Revision: 218139
URL: http://svn.freebsd.org/changeset/base/218139

Log:
  Implement two new functions for sending descriptor and receving descriptor
  over UNIX domain sockets and socket pairs.
  This is in preparation for capsicum.
  
  MFC after:	1 week

Modified:
  head/sbin/hastd/proto.c
  head/sbin/hastd/proto.h
  head/sbin/hastd/proto_common.c
  head/sbin/hastd/proto_impl.h
  head/sbin/hastd/proto_socketpair.c
  head/sbin/hastd/proto_uds.c

Modified: head/sbin/hastd/proto.c
==============================================================================
--- head/sbin/hastd/proto.c	Mon Jan 31 18:32:17 2011	(r218138)
+++ head/sbin/hastd/proto.c	Mon Jan 31 18:35:17 2011	(r218139)
@@ -217,6 +217,42 @@ proto_recv(const struct proto_conn *conn
 }
 
 int
+proto_descriptor_send(const struct proto_conn *conn, int fd)
+{
+	int ret;
+
+	PJDLOG_ASSERT(conn != NULL);
+	PJDLOG_ASSERT(conn->pc_magic == PROTO_CONN_MAGIC);
+	PJDLOG_ASSERT(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn->pc_proto->hp_descriptor_send != NULL);
+
+	ret = conn->pc_proto->hp_descriptor_send(conn->pc_ctx, fd);
+	if (ret != 0) {
+		errno = ret;
+		return (-1);
+	}
+	return (0);
+}
+
+int
+proto_descriptor_recv(const struct proto_conn *conn, int *fdp)
+{
+	int ret;
+
+	PJDLOG_ASSERT(conn != NULL);
+	PJDLOG_ASSERT(conn->pc_magic == PROTO_CONN_MAGIC);
+	PJDLOG_ASSERT(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn->pc_proto->hp_descriptor_recv != NULL);
+
+	ret = conn->pc_proto->hp_descriptor_recv(conn->pc_ctx, fdp);
+	if (ret != 0) {
+		errno = ret;
+		return (-1);
+	}
+	return (0);
+}
+
+int
 proto_descriptor(const struct proto_conn *conn)
 {
 

Modified: head/sbin/hastd/proto.h
==============================================================================
--- head/sbin/hastd/proto.h	Mon Jan 31 18:32:17 2011	(r218138)
+++ head/sbin/hastd/proto.h	Mon Jan 31 18:35:17 2011	(r218139)
@@ -43,6 +43,8 @@ int proto_server(const char *addr, struc
 int proto_accept(struct proto_conn *conn, struct proto_conn **newconnp);
 int proto_send(const struct proto_conn *conn, const void *data, size_t size);
 int proto_recv(const struct proto_conn *conn, void *data, size_t size);
+int proto_descriptor_send(const struct proto_conn *conn, int fd);
+int proto_descriptor_recv(const struct proto_conn *conn, int *fdp);
 int proto_descriptor(const struct proto_conn *conn);
 bool proto_address_match(const struct proto_conn *conn, const char *addr);
 void proto_local_address(const struct proto_conn *conn, char *addr,

Modified: head/sbin/hastd/proto_common.c
==============================================================================
--- head/sbin/hastd/proto_common.c	Mon Jan 31 18:32:17 2011	(r218138)
+++ head/sbin/hastd/proto_common.c	Mon Jan 31 18:35:17 2011	(r218139)
@@ -46,18 +46,18 @@ __FBSDID("$FreeBSD$");
 #endif
 
 int
-proto_common_send(int fd, const unsigned char *data, size_t size)
+proto_common_send(int sock, const unsigned char *data, size_t size)
 {
 	ssize_t done;
 	size_t sendsize;
 
-	PJDLOG_ASSERT(fd >= 0);
+	PJDLOG_ASSERT(sock >= 0);
 	PJDLOG_ASSERT(data != NULL);
 	PJDLOG_ASSERT(size > 0);
 
 	do {
 		sendsize = size < MAX_SEND_SIZE ? size : MAX_SEND_SIZE;
-		done = send(fd, data, sendsize, MSG_NOSIGNAL);
+		done = send(sock, data, sendsize, MSG_NOSIGNAL);
 		if (done == 0)
 			return (ENOTCONN);
 		else if (done < 0) {
@@ -73,16 +73,16 @@ proto_common_send(int fd, const unsigned
 }
 
 int
-proto_common_recv(int fd, unsigned char *data, size_t size)
+proto_common_recv(int sock, unsigned char *data, size_t size)
 {
 	ssize_t done;
 
-	PJDLOG_ASSERT(fd >= 0);
+	PJDLOG_ASSERT(sock >= 0);
 	PJDLOG_ASSERT(data != NULL);
 	PJDLOG_ASSERT(size > 0);
 
 	do {
-		done = recv(fd, data, size, MSG_WAITALL);
+		done = recv(sock, data, size, MSG_WAITALL);
 	} while (done == -1 && errno == EINTR);
 	if (done == 0)
 		return (ENOTCONN);
@@ -90,3 +90,66 @@ proto_common_recv(int fd, unsigned char 
 		return (errno);
 	return (0);
 }
+
+int
+proto_common_descriptor_send(int sock, int fd)
+{
+	unsigned char ctrl[CMSG_SPACE(sizeof(fd))];
+	struct msghdr msg;
+	struct cmsghdr *cmsg;
+
+	PJDLOG_ASSERT(sock >= 0);
+	PJDLOG_ASSERT(fd >= 0);
+
+	bzero(&msg, sizeof(msg));
+	bzero(&ctrl, sizeof(ctrl));
+
+	msg.msg_iov = NULL;
+	msg.msg_iovlen = 0;
+	msg.msg_control = ctrl;
+	msg.msg_controllen = sizeof(ctrl);
+
+	cmsg = CMSG_FIRSTHDR(&msg);
+	cmsg->cmsg_level = SOL_SOCKET;
+	cmsg->cmsg_type = SCM_RIGHTS;
+	cmsg->cmsg_len = CMSG_LEN(sizeof(fd));
+	*((int *)CMSG_DATA(cmsg)) = fd;
+
+	if (sendmsg(sock, &msg, 0) == -1)
+		return (errno);
+
+	return (0);
+}
+
+int
+proto_common_descriptor_recv(int sock, int *fdp)
+{
+	unsigned char ctrl[CMSG_SPACE(sizeof(*fdp))];
+	struct msghdr msg;
+	struct cmsghdr *cmsg;
+
+	PJDLOG_ASSERT(sock >= 0);
+	PJDLOG_ASSERT(fdp != NULL);
+
+	bzero(&msg, sizeof(msg));
+	bzero(&ctrl, sizeof(ctrl));
+
+	msg.msg_iov = NULL;
+	msg.msg_iovlen = 0;
+	msg.msg_control = ctrl;
+	msg.msg_controllen = sizeof(ctrl);
+
+	if (recvmsg(sock, &msg, 0) == -1)
+		return (errno);
+
+	for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL;
+	    cmsg = CMSG_NXTHDR(&msg, cmsg)) {
+		if (cmsg->cmsg_level == SOL_SOCKET &&
+		    cmsg->cmsg_type == SCM_RIGHTS) {
+			*fdp = *((int *)CMSG_DATA(cmsg));
+			return (0);
+		}
+	}
+
+	return (ENOENT);
+}

Modified: head/sbin/hastd/proto_impl.h
==============================================================================
--- head/sbin/hastd/proto_impl.h	Mon Jan 31 18:32:17 2011	(r218138)
+++ head/sbin/hastd/proto_impl.h	Mon Jan 31 18:35:17 2011	(r218139)
@@ -45,6 +45,8 @@ typedef int hp_server_t(const char *, vo
 typedef int hp_accept_t(void *, void **);
 typedef int hp_send_t(void *, const unsigned char *, size_t);
 typedef int hp_recv_t(void *, unsigned char *, size_t);
+typedef int hp_descriptor_send_t(void *, int);
+typedef int hp_descriptor_recv_t(void *, int *);
 typedef int hp_descriptor_t(const void *);
 typedef bool hp_address_match_t(const void *, const char *);
 typedef void hp_local_address_t(const void *, char *, size_t);
@@ -59,6 +61,8 @@ struct hast_proto {
 	hp_accept_t	*hp_accept;
 	hp_send_t	*hp_send;
 	hp_recv_t	*hp_recv;
+	hp_descriptor_send_t *hp_descriptor_send;
+	hp_descriptor_recv_t *hp_descriptor_recv;
 	hp_descriptor_t	*hp_descriptor;
 	hp_address_match_t *hp_address_match;
 	hp_local_address_t *hp_local_address;
@@ -69,7 +73,9 @@ struct hast_proto {
 
 void proto_register(struct hast_proto *proto, bool isdefault);
 
-int proto_common_send(int fd, const unsigned char *data, size_t size);
-int proto_common_recv(int fd, unsigned char *data, size_t size);
+int proto_common_send(int sock, const unsigned char *data, size_t size);
+int proto_common_recv(int sock, unsigned char *data, size_t size);
+int proto_common_descriptor_send(int sock, int fd);
+int proto_common_descriptor_recv(int sock, int *fdp);
 
 #endif	/* !_PROTO_IMPL_H_ */

Modified: head/sbin/hastd/proto_socketpair.c
==============================================================================
--- head/sbin/hastd/proto_socketpair.c	Mon Jan 31 18:32:17 2011	(r218138)
+++ head/sbin/hastd/proto_socketpair.c	Mon Jan 31 18:35:17 2011	(r218139)
@@ -161,6 +161,34 @@ sp_recv(void *ctx, unsigned char *data, 
 }
 
 static int
+sp_descriptor_send(void *ctx, int fd)
+{
+	struct sp_ctx *spctx = ctx;
+
+	PJDLOG_ASSERT(spctx != NULL);
+	PJDLOG_ASSERT(spctx->sp_magic == SP_CTX_MAGIC);
+	PJDLOG_ASSERT(spctx->sp_side == SP_SIDE_CLIENT);
+	PJDLOG_ASSERT(spctx->sp_fd[0] >= 0);
+	PJDLOG_ASSERT(fd > 0);
+
+	return (proto_common_descriptor_send(spctx->sp_fd[0], fd));
+}
+
+static int
+sp_descriptor_recv(void *ctx, int *fdp)
+{
+	struct sp_ctx *spctx = ctx;
+
+	PJDLOG_ASSERT(spctx != NULL);
+	PJDLOG_ASSERT(spctx->sp_magic == SP_CTX_MAGIC);
+	PJDLOG_ASSERT(spctx->sp_side == SP_SIDE_SERVER);
+	PJDLOG_ASSERT(spctx->sp_fd[1] >= 0);
+	PJDLOG_ASSERT(fdp != NULL);
+
+	return (proto_common_descriptor_recv(spctx->sp_fd[1], fdp));
+}
+
+static int
 sp_descriptor(const void *ctx)
 {
 	const struct sp_ctx *spctx = ctx;
@@ -224,6 +252,8 @@ static struct hast_proto sp_proto = {
 	.hp_client = sp_client,
 	.hp_send = sp_send,
 	.hp_recv = sp_recv,
+	.hp_descriptor_send = sp_descriptor_send,
+	.hp_descriptor_recv = sp_descriptor_recv,
 	.hp_descriptor = sp_descriptor,
 	.hp_close = sp_close
 };

Modified: head/sbin/hastd/proto_uds.c
==============================================================================
--- head/sbin/hastd/proto_uds.c	Mon Jan 31 18:32:17 2011	(r218138)
+++ head/sbin/hastd/proto_uds.c	Mon Jan 31 18:35:17 2011	(r218139)
@@ -226,6 +226,32 @@ uds_recv(void *ctx, unsigned char *data,
 }
 
 static int
+uds_descriptor_send(void *ctx, int fd)
+{
+	struct uds_ctx *uctx = ctx;
+
+	PJDLOG_ASSERT(uctx != NULL);
+	PJDLOG_ASSERT(uctx->uc_magic == UDS_CTX_MAGIC);
+	PJDLOG_ASSERT(uctx->uc_fd >= 0);
+	PJDLOG_ASSERT(fd >= 0);
+
+	return (proto_common_descriptor_send(uctx->uc_fd, fd));
+}
+
+static int
+uds_descriptor_recv(void *ctx, int *fdp)
+{
+	struct uds_ctx *uctx = ctx;
+
+	PJDLOG_ASSERT(uctx != NULL);
+	PJDLOG_ASSERT(uctx->uc_magic == UDS_CTX_MAGIC);
+	PJDLOG_ASSERT(uctx->uc_fd >= 0);
+	PJDLOG_ASSERT(fdp != NULL);
+
+	return (proto_common_descriptor_recv(uctx->uc_fd, fdp));
+}
+
+static int
 uds_descriptor(const void *ctx)
 {
 	const struct uds_ctx *uctx = ctx;
@@ -307,6 +333,8 @@ static struct hast_proto uds_proto = {
 	.hp_accept = uds_accept,
 	.hp_send = uds_send,
 	.hp_recv = uds_recv,
+	.hp_descriptor_send = uds_descriptor_send,
+	.hp_descriptor_recv = uds_descriptor_recv,
 	.hp_descriptor = uds_descriptor,
 	.hp_local_address = uds_local_address,
 	.hp_remote_address = uds_remote_address,

From owner-svn-src-head@FreeBSD.ORG  Mon Jan 31 18:41:52 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AE57410656AC;
	Mon, 31 Jan 2011 18:41:52 +0000 (UTC) (envelope-from jfv@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9D63C8FC1F;
	Mon, 31 Jan 2011 18:41:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0VIfq67040009;
	Mon, 31 Jan 2011 18:41:52 GMT (envelope-from jfv@svn.freebsd.org)
Received: (from jfv@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0VIfq5Y040001;
	Mon, 31 Jan 2011 18:41:52 GMT (envelope-from jfv@svn.freebsd.org)
Message-Id: <201101311841.p0VIfq5Y040001@svn.freebsd.org>
From: Jack F Vogel 
Date: Mon, 31 Jan 2011 18:41:52 +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: r218140 - in head/sys/dev: ahci ata ata/chipsets ichsmb
	ichwd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 31 Jan 2011 18:41:52 -0000

Author: jfv
Date: Mon Jan 31 18:41:52 2011
New Revision: 218140
URL: http://svn.freebsd.org/changeset/base/218140

Log:
  Support for the new DH89xxCC PCH chipset including:
        - SATA controller
        - Watchdog timer
        - SMBus controller

Modified:
  head/sys/dev/ahci/ahci.c
  head/sys/dev/ata/ata-pci.h
  head/sys/dev/ata/chipsets/ata-intel.c
  head/sys/dev/ichsmb/ichsmb_pci.c
  head/sys/dev/ichwd/ichwd.c
  head/sys/dev/ichwd/ichwd.h

Modified: head/sys/dev/ahci/ahci.c
==============================================================================
--- head/sys/dev/ahci/ahci.c	Mon Jan 31 18:35:17 2011	(r218139)
+++ head/sys/dev/ahci/ahci.c	Mon Jan 31 18:41:52 2011	(r218140)
@@ -161,6 +161,7 @@ static struct {
 	{0x1c038086, 0x00, "Intel Cougar Point",	0},
 	{0x1c048086, 0x00, "Intel Cougar Point",	0},
 	{0x1c058086, 0x00, "Intel Cougar Point",	0},
+	{0x23238086, 0x00, "Intel DH89xxCC",    0},
 	{0x2361197b, 0x00, "JMicron JMB361",	AHCI_Q_NOFORCE},
 	{0x2363197b, 0x00, "JMicron JMB363",	AHCI_Q_NOFORCE},
 	{0x2365197b, 0x00, "JMicron JMB365",	AHCI_Q_NOFORCE},

Modified: head/sys/dev/ata/ata-pci.h
==============================================================================
--- head/sys/dev/ata/ata-pci.h	Mon Jan 31 18:35:17 2011	(r218139)
+++ head/sys/dev/ata/ata-pci.h	Mon Jan 31 18:41:52 2011	(r218140)
@@ -229,6 +229,7 @@ struct ata_pci_controller {
 
 #define ATA_I31244              0x32008086
 #define ATA_ISCH                0x811a8086
+#define ATA_DH89XXCC            0x23238086
 
 #define ATA_ITE_ID              0x1283
 #define ATA_IT8211F             0x82111283

Modified: head/sys/dev/ata/chipsets/ata-intel.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-intel.c	Mon Jan 31 18:35:17 2011	(r218139)
+++ head/sys/dev/ata/chipsets/ata-intel.c	Mon Jan 31 18:41:52 2011	(r218140)
@@ -178,6 +178,7 @@ ata_intel_probe(device_t dev)
      { ATA_CPT_S4,       0, INTEL_6CH2, 0, ATA_SA300, "Cougar Point" },
      { ATA_I31244,       0,          0, 2, ATA_SA150, "31244" },
      { ATA_ISCH,         0,          0, 1, ATA_UDMA5, "SCH" },
+     { ATA_DH89XXCC,     0, INTEL_AHCI, 0, ATA_SA300, "DH89xxCC" },
      { 0, 0, 0, 0, 0, 0}};
 
     if (pci_get_vendor(dev) != ATA_INTEL_ID)

Modified: head/sys/dev/ichsmb/ichsmb_pci.c
==============================================================================
--- head/sys/dev/ichsmb/ichsmb_pci.c	Mon Jan 31 18:35:17 2011	(r218139)
+++ head/sys/dev/ichsmb/ichsmb_pci.c	Mon Jan 31 18:41:52 2011	(r218140)
@@ -81,6 +81,7 @@ __FBSDID("$FreeBSD$");
 #define ID_PCH				0x3b308086
 #define ID_6300ESB			0x25a48086
 #define	ID_631xESB			0x269b8086
+#define ID_DH89XXCC			0x23308086
 #define ID_CPT				0x1c228086
 
 #define PCIS_SERIALBUS_SMBUS_PROGIF	0x00
@@ -175,6 +176,9 @@ ichsmb_pci_probe(device_t dev)
 	case ID_631xESB:
 		device_set_desc(dev, "Intel 631xESB/6321ESB (ESB2) SMBus controller");
 		break;
+	case ID_DH89XXCC:
+		device_set_desc(dev, "Intel DH89xxCC SMBus controller");
+		break;
 	case ID_CPT:
 		device_set_desc(dev, "Intel Cougar Point SMBus controller");
 		break;

Modified: head/sys/dev/ichwd/ichwd.c
==============================================================================
--- head/sys/dev/ichwd/ichwd.c	Mon Jan 31 18:35:17 2011	(r218139)
+++ head/sys/dev/ichwd/ichwd.c	Mon Jan 31 18:41:52 2011	(r218140)
@@ -157,6 +157,7 @@ static struct ichwd_device ichwd_devices
 	{ DEVICEID_CPT29,    "Intel Cougar Point watchdog timer",	10 },
 	{ DEVICEID_CPT30,    "Intel Cougar Point watchdog timer",	10 },
 	{ DEVICEID_CPT31,    "Intel Cougar Point watchdog timer",	10 },
+	{ DEVICEID_DH89XXCC_LPC, "Intel DH89xxCC watchdog timer",	10 },
 	{ 0, NULL, 0 },
 };
 

Modified: head/sys/dev/ichwd/ichwd.h
==============================================================================
--- head/sys/dev/ichwd/ichwd.h	Mon Jan 31 18:35:17 2011	(r218139)
+++ head/sys/dev/ichwd/ichwd.h	Mon Jan 31 18:41:52 2011	(r218140)
@@ -96,6 +96,7 @@ struct ichwd_softc {
 #define DEVICEID_CPT29		0x1c5d
 #define DEVICEID_CPT30		0x1c5e
 #define DEVICEID_CPT31		0x1c5f
+#define DEVICEID_DH89XXCC_LPC	0x2310
 #define DEVICEID_82801AA	0x2410
 #define DEVICEID_82801AB	0x2420
 #define DEVICEID_82801BA	0x2440

From owner-svn-src-head@FreeBSD.ORG  Mon Jan 31 20:00:44 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0B75D106566C;
	Mon, 31 Jan 2011 20:00:44 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EFA1D8FC0C;
	Mon, 31 Jan 2011 20:00:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0VK0hpB043374;
	Mon, 31 Jan 2011 20:00:43 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0VK0hX3043372;
	Mon, 31 Jan 2011 20:00:43 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201101312000.p0VK0hX3043372@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Mon, 31 Jan 2011 20:00:43 +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: r218141 - head/sys/dev/alc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 31 Jan 2011 20:00:44 -0000

Author: yongari
Date: Mon Jan 31 20:00:43 2011
New Revision: 218141
URL: http://svn.freebsd.org/changeset/base/218141

Log:
  alc_rev was used without initialization such that it failed to
  apply AR8152 v1.0 specific initialization code. Fix this bug by
  explicitly reading PCI device revision id via PCI accessor.
  
  Reported by:	Gabriel Linder ( linder.gabriel <> gmail dot com )

Modified:
  head/sys/dev/alc/if_alc.c

Modified: head/sys/dev/alc/if_alc.c
==============================================================================
--- head/sys/dev/alc/if_alc.c	Mon Jan 31 18:41:52 2011	(r218140)
+++ head/sys/dev/alc/if_alc.c	Mon Jan 31 20:00:43 2011	(r218141)
@@ -810,7 +810,7 @@ alc_attach(device_t dev)
 		    CSR_READ_4(sc, ALC_PCIE_PHYMISC) |
 		    PCIE_PHYMISC_FORCE_RCV_DET);
 		if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B &&
-		    sc->alc_rev == ATHEROS_AR8152_B_V10) {
+		    pci_get_revid(dev) == ATHEROS_AR8152_B_V10) {
 			val = CSR_READ_4(sc, ALC_PCIE_PHYMISC2);
 			val &= ~(PCIE_PHYMISC2_SERDES_CDR_MASK |
 			    PCIE_PHYMISC2_SERDES_TH_MASK);

From owner-svn-src-head@FreeBSD.ORG  Mon Jan 31 20:41:34 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 334951065672;
	Mon, 31 Jan 2011 20:41:34 +0000 (UTC)
	(envelope-from pyunyh@gmail.com)
Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com
	[209.85.213.54])
	by mx1.freebsd.org (Postfix) with ESMTP id 8DDA38FC14;
	Mon, 31 Jan 2011 20:41:33 +0000 (UTC)
Received: by ywp6 with SMTP id 6so2308792ywp.13
	for ; Mon, 31 Jan 2011 12:41:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:from:date:to:cc:subject:message-id:reply-to
	:references:mime-version:content-type:content-disposition
	:in-reply-to:user-agent;
	bh=uyW42HOE0tZ+x+q6t2ZX6EZilRd6XMqyTXE/E2/4vzY=;
	b=TUCtk4UFxxL3ZuB4xpVa4yueKhS7L9/NMVkSuFqC042kN/vfpinF8TwQWBuHfbRf1q
	K2gw/k9V/80fqwxcGQ+C3O8T4bHwliwvJTX9l0e45mEwNVo4mPVp7rrLwOqEIBYvhP4q
	CQYakStjsBI4Gw7LmVZ/u/3msWpOEeNU6ZZaE=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=from:date:to:cc:subject:message-id:reply-to:references:mime-version
	:content-type:content-disposition:in-reply-to:user-agent;
	b=gQJW2ID10YelflLQBgCEZZUxY+Grj1slo667w7JM1gmO013t6OhzDVr4XbFuZrf0a0
	nMim8qtaDjxszFavxV5bX/us1X6EMipaCtzB2IqNbjGdTqokJxAFrkNzjZvTyHjowIQA
	5DmXF4MjhdvTPF/890fkEmWi38Btm/noWxkSM=
Received: by 10.150.238.2 with SMTP id l2mr8094629ybh.364.1296505029994;
	Mon, 31 Jan 2011 12:17:09 -0800 (PST)
Received: from pyunyh@gmail.com ([174.35.1.224])
	by mx.google.com with ESMTPS id v8sm13692046ybe.13.2011.01.31.12.17.06
	(version=TLSv1/SSLv3 cipher=RC4-MD5);
	Mon, 31 Jan 2011 12:17:08 -0800 (PST)
Received: by pyunyh@gmail.com (sSMTP sendmail emulation);
	Mon, 31 Jan 2011 12:17:08 -0800
From: Pyun YongHyeon 
Date: Mon, 31 Jan 2011 12:17:08 -0800
To: Gavin Atkinson 
Message-ID: <20110131201708.GC1275@michelle.cdnetworks.com>
References: <201101290053.p0T0rwg2007250@svn.freebsd.org>
	<1296477257.85782.2.camel@buffy.york.ac.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1296477257.85782.2.camel@buffy.york.ac.uk>
User-Agent: Mutt/1.4.2.3i
Cc: Andrew Turner , svn-src-head@freebsd.org,
	svn-src-all@freebsd.org, src-committers@freebsd.org
Subject: Re: svn commit: r218055 - head/sys/dev/cs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: pyunyh@gmail.com
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 31 Jan 2011 20:41:34 -0000

On Mon, Jan 31, 2011 at 12:34:17PM +0000, Gavin Atkinson wrote:
> On Sat, 2011-01-29 at 00:53 +0000, Andrew Turner wrote:
> > Author: andrew
> > Date: Sat Jan 29 00:53:58 2011
> > New Revision: 218055
> > URL: http://svn.freebsd.org/changeset/base/218055
> > 
> > Log:
> >   Use bus space functions rather than inw/outw
> >   to help a future port of the driver to ARM.
> >   
> >   Approved by:	imp (mentor)
> 
> Thanks!  This has been on my todo list for way too long.
> 
> http://www.freebsd.org/projects/busdma/ now needs updating to reflect
> this change, although a lot of other entries on that page could also do
> with updating too.
> 

axe(4), bfe(4), gem(4), nfe(4), nge(4), rl(4), sf(4), sis(4),
ste(4), txp(4) and vr(4) need updating. All these drivers use
bus_dma(9) and should work on PAE environments.

> Thanks,
> 
> Gavin
> 
> -- 
> Gavin Atkinson
> FreeBSD committer and bugmeister
> GPG: A093262B (313A A79F 697D 3A5C 216A  EDF5 935D EF44 A093 262B)

From owner-svn-src-head@FreeBSD.ORG  Mon Jan 31 21:03:08 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7F4E41065670;
	Mon, 31 Jan 2011 21:03:08 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 553C08FC12;
	Mon, 31 Jan 2011 21:03:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0VL38vw045083;
	Mon, 31 Jan 2011 21:03:08 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0VL38tD045081;
	Mon, 31 Jan 2011 21:03:08 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201101312103.p0VL38tD045081@svn.freebsd.org>
From: Doug Barton 
Date: Mon, 31 Jan 2011 21:03:08 +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: r218142 - head/etc/rc.d
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 31 Jan 2011 21:03:08 -0000

Author: dougb
Date: Mon Jan 31 21:03:08 2011
New Revision: 218142
URL: http://svn.freebsd.org/changeset/base/218142

Log:
  Let rpcbind clean up after itself

Modified:
  head/etc/rc.d/rpcbind

Modified: head/etc/rc.d/rpcbind
==============================================================================
--- head/etc/rc.d/rpcbind	Mon Jan 31 20:00:43 2011	(r218141)
+++ head/etc/rc.d/rpcbind	Mon Jan 31 21:03:08 2011	(r218142)
@@ -13,5 +13,7 @@ name="rpcbind"
 rcvar=`set_rcvar`
 command="/usr/sbin/${name}"
 
+stop_postcmd='/bin/rm -f /var/run/rpcbind.*'
+
 load_rc_config $name
 run_rc_command "$1"

From owner-svn-src-head@FreeBSD.ORG  Mon Jan 31 22:44:28 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9BC891065673;
	Mon, 31 Jan 2011 22:44:28 +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 8BE2F8FC0C;
	Mon, 31 Jan 2011 22:44:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0VMiS87047866;
	Mon, 31 Jan 2011 22:44:28 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0VMiS35047864;
	Mon, 31 Jan 2011 22:44:28 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201101312244.p0VMiS35047864@svn.freebsd.org>
From: Adrian Chadd 
Date: Mon, 31 Jan 2011 22:44:28 +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: r218145 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 31 Jan 2011 22:44:28 -0000

Author: adrian
Date: Mon Jan 31 22:44:28 2011
New Revision: 218145
URL: http://svn.freebsd.org/changeset/base/218145

Log:
  Enable AMPDU reorder processing and receiving BAR frames when doing 802.11n.
  
  Obtained from:	rpaulo@

Modified:
  head/sys/dev/ath/if_ath.c

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Mon Jan 31 22:14:47 2011	(r218144)
+++ head/sys/dev/ath/if_ath.c	Mon Jan 31 22:44:28 2011	(r218145)
@@ -2312,6 +2312,8 @@ ath_calcrxfilter(struct ath_softc *sc)
 	}
 	if (ic->ic_opmode == IEEE80211_M_MONITOR)
 		rfilt |= HAL_RX_FILTER_CONTROL;
+	if (IEEE80211_IS_CHAN_HT(ic->ic_curchan))
+		rfilt |= HAL_RX_FILTER_COMPBAR;
 	DPRINTF(sc, ATH_DEBUG_MODE, "%s: RX filter 0x%x, %s if_flags 0x%x\n",
 	    __func__, rfilt, ieee80211_opmode_name[ic->ic_opmode], ifp->if_flags);
 	return rfilt;
@@ -3891,6 +3893,10 @@ rx_accept:
 				IEEE80211_KEYIX_NONE : rs->rs_keyix);
 		sc->sc_lastrs = rs;
 		if (ni != NULL) {
+		/* tag AMPDU aggregates for reorder processing */
+		if (ni->ni_flags & IEEE80211_NODE_HT)
+			m->m_flags |= M_AMPDU;
+
 			/*
 			 * Sending station is known, dispatch directly.
 			 */

From owner-svn-src-head@FreeBSD.ORG  Mon Jan 31 22:45:14 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CB74F106564A;
	Mon, 31 Jan 2011 22:45:14 +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 BBFDE8FC0A;
	Mon, 31 Jan 2011 22:45:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0VMjEuh047934;
	Mon, 31 Jan 2011 22:45:14 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0VMjEYZ047932;
	Mon, 31 Jan 2011 22:45:14 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201101312245.p0VMjEYZ047932@svn.freebsd.org>
From: Adrian Chadd 
Date: Mon, 31 Jan 2011 22:45:14 +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: r218146 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 31 Jan 2011 22:45:14 -0000

Author: adrian
Date: Mon Jan 31 22:45:14 2011
New Revision: 218146
URL: http://svn.freebsd.org/changeset/base/218146

Log:
  Remove the now unneeded XXX.

Modified:
  head/sys/dev/ath/if_ath.c

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Mon Jan 31 22:44:28 2011	(r218145)
+++ head/sys/dev/ath/if_ath.c	Mon Jan 31 22:45:14 2011	(r218146)
@@ -2273,7 +2273,6 @@ ath_key_update_end(struct ieee80211vap *
  *   - when operating in mesh mode to detect neighbors
  * o accept control frames:
  *   - when in monitor mode
- * XXX BAR frames for 11n
  * XXX HT protection for 11n
  */
 static u_int32_t

From owner-svn-src-head@FreeBSD.ORG  Mon Jan 31 23:08:26 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 56574106566B;
	Mon, 31 Jan 2011 23:08:26 +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 4698B8FC0C;
	Mon, 31 Jan 2011 23:08:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0VN8QQ4048850;
	Mon, 31 Jan 2011 23:08:26 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0VN8QYj048848;
	Mon, 31 Jan 2011 23:08:26 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201101312308.p0VN8QYj048848@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Mon, 31 Jan 2011 23:08:26 +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: r218147 - head/sbin/hastd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 31 Jan 2011 23:08:26 -0000

Author: pjd
Date: Mon Jan 31 23:08:26 2011
New Revision: 218147
URL: http://svn.freebsd.org/changeset/base/218147

Log:
  Until I fix the build on ia64 comment out problematic lines.
  Those lines are part of the (for now) unused functions.

Modified:
  head/sbin/hastd/proto_common.c

Modified: head/sbin/hastd/proto_common.c
==============================================================================
--- head/sbin/hastd/proto_common.c	Mon Jan 31 22:45:14 2011	(r218146)
+++ head/sbin/hastd/proto_common.c	Mon Jan 31 23:08:26 2011	(r218147)
@@ -113,7 +113,7 @@ proto_common_descriptor_send(int sock, i
 	cmsg->cmsg_level = SOL_SOCKET;
 	cmsg->cmsg_type = SCM_RIGHTS;
 	cmsg->cmsg_len = CMSG_LEN(sizeof(fd));
-	*((int *)CMSG_DATA(cmsg)) = fd;
+//	*((int *)CMSG_DATA(cmsg)) = fd;
 
 	if (sendmsg(sock, &msg, 0) == -1)
 		return (errno);
@@ -146,7 +146,7 @@ proto_common_descriptor_recv(int sock, i
 	    cmsg = CMSG_NXTHDR(&msg, cmsg)) {
 		if (cmsg->cmsg_level == SOL_SOCKET &&
 		    cmsg->cmsg_type == SCM_RIGHTS) {
-			*fdp = *((int *)CMSG_DATA(cmsg));
+//			*fdp = *((int *)CMSG_DATA(cmsg));
 			return (0);
 		}
 	}

From owner-svn-src-head@FreeBSD.ORG  Mon Jan 31 23:46:36 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9E8E1106566C;
	Mon, 31 Jan 2011 23:46:36 +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 8EDCE8FC1D;
	Mon, 31 Jan 2011 23:46:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0VNkapP049919;
	Mon, 31 Jan 2011 23:46:36 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0VNkaFQ049917;
	Mon, 31 Jan 2011 23:46:36 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201101312346.p0VNkaFQ049917@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Mon, 31 Jan 2011 23:46:36 +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: r218148 - head/sbin/hastd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 31 Jan 2011 23:46:36 -0000

Author: pjd
Date: Mon Jan 31 23:46:36 2011
New Revision: 218148
URL: http://svn.freebsd.org/changeset/base/218148

Log:
  Fix build on ia64.
  
  I found no way how to use CMSG_NXTHDR() macro on ia64 without alignment
  warnings.
  
  MFC after:	1 week

Modified:
  head/sbin/hastd/proto_common.c

Modified: head/sbin/hastd/proto_common.c
==============================================================================
--- head/sbin/hastd/proto_common.c	Mon Jan 31 23:08:26 2011	(r218147)
+++ head/sbin/hastd/proto_common.c	Mon Jan 31 23:46:36 2011	(r218148)
@@ -113,7 +113,7 @@ proto_common_descriptor_send(int sock, i
 	cmsg->cmsg_level = SOL_SOCKET;
 	cmsg->cmsg_type = SCM_RIGHTS;
 	cmsg->cmsg_len = CMSG_LEN(sizeof(fd));
-//	*((int *)CMSG_DATA(cmsg)) = fd;
+	bcopy(&fd, CMSG_DATA(cmsg), sizeof(fd));
 
 	if (sendmsg(sock, &msg, 0) == -1)
 		return (errno);
@@ -142,14 +142,12 @@ proto_common_descriptor_recv(int sock, i
 	if (recvmsg(sock, &msg, 0) == -1)
 		return (errno);
 
-	for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL;
-	    cmsg = CMSG_NXTHDR(&msg, cmsg)) {
-		if (cmsg->cmsg_level == SOL_SOCKET &&
-		    cmsg->cmsg_type == SCM_RIGHTS) {
-//			*fdp = *((int *)CMSG_DATA(cmsg));
-			return (0);
-		}
+	cmsg = CMSG_FIRSTHDR(&msg);
+	if (cmsg->cmsg_level != SOL_SOCKET ||
+	    cmsg->cmsg_type == SCM_RIGHTS) {
+		return (EINVAL);
 	}
+	bcopy(CMSG_DATA(cmsg), fdp, sizeof(*fdp));
 
-	return (ENOENT);
+	return (0);
 }

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 01:05:11 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 965041065670;
	Tue,  1 Feb 2011 01:05:11 +0000 (UTC) (envelope-from jfv@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 837E08FC0A;
	Tue,  1 Feb 2011 01:05:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p1115BT3051923;
	Tue, 1 Feb 2011 01:05:11 GMT (envelope-from jfv@svn.freebsd.org)
Received: (from jfv@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1115B4B051915;
	Tue, 1 Feb 2011 01:05:11 GMT (envelope-from jfv@svn.freebsd.org)
Message-Id: <201102010105.p1115B4B051915@svn.freebsd.org>
From: Jack F Vogel 
Date: Tue, 1 Feb 2011 01:05:11 +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: r218149 - in head/sys/dev: ahci ata ata/chipsets ichsmb
	ichwd sound/pci/hda
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 01:05:11 -0000

Author: jfv
Date: Tue Feb  1 01:05:11 2011
New Revision: 218149
URL: http://svn.freebsd.org/changeset/base/218149

Log:
  Support for the new Patsburg PCH chipset:
       - SMBus Controller
       - SATA Controller
       - HD Audio Controller
       - Watchdog Controller
  
  Thanks to Seth Heasley (seth.heasley@intel.com) for providing us code.
  
  MFC after 3 days

Modified:
  head/sys/dev/ahci/ahci.c
  head/sys/dev/ata/ata-pci.h
  head/sys/dev/ata/chipsets/ata-intel.c
  head/sys/dev/ichsmb/ichsmb_pci.c
  head/sys/dev/ichwd/ichwd.c
  head/sys/dev/ichwd/ichwd.h
  head/sys/dev/sound/pci/hda/hdac.c

Modified: head/sys/dev/ahci/ahci.c
==============================================================================
--- head/sys/dev/ahci/ahci.c	Mon Jan 31 23:46:36 2011	(r218148)
+++ head/sys/dev/ahci/ahci.c	Tue Feb  1 01:05:11 2011	(r218149)
@@ -161,7 +161,10 @@ static struct {
 	{0x1c038086, 0x00, "Intel Cougar Point",	0},
 	{0x1c048086, 0x00, "Intel Cougar Point",	0},
 	{0x1c058086, 0x00, "Intel Cougar Point",	0},
-	{0x23238086, 0x00, "Intel DH89xxCC",    0},
+	{0x23238086, 0x00, "Intel DH89xxCC",	0},
+	{0x1d028086, 0x00, "Intel Patsburg",	0},
+	{0x1d048086, 0x00, "Intel Patsburg",	0},
+	{0x1d068086, 0x00, "Intel Patsburg",	0},
 	{0x2361197b, 0x00, "JMicron JMB361",	AHCI_Q_NOFORCE},
 	{0x2363197b, 0x00, "JMicron JMB363",	AHCI_Q_NOFORCE},
 	{0x2365197b, 0x00, "JMicron JMB365",	AHCI_Q_NOFORCE},

Modified: head/sys/dev/ata/ata-pci.h
==============================================================================
--- head/sys/dev/ata/ata-pci.h	Mon Jan 31 23:46:36 2011	(r218148)
+++ head/sys/dev/ata/ata-pci.h	Tue Feb  1 01:05:11 2011	(r218149)
@@ -227,6 +227,12 @@ struct ata_pci_controller {
 #define ATA_CPT_S3              0x1c088086
 #define ATA_CPT_S4              0x1c098086
 
+#define ATA_PBG_S1		0x1d008086
+#define ATA_PBG_AH1		0x1d028086
+#define ATA_PBG_R1		0x1d048086
+#define ATA_PBG_R2		0x1d068086
+#define ATA_PBG_S2		0x1d088086
+
 #define ATA_I31244              0x32008086
 #define ATA_ISCH                0x811a8086
 #define ATA_DH89XXCC            0x23238086

Modified: head/sys/dev/ata/chipsets/ata-intel.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-intel.c	Mon Jan 31 23:46:36 2011	(r218148)
+++ head/sys/dev/ata/chipsets/ata-intel.c	Tue Feb  1 01:05:11 2011	(r218149)
@@ -176,6 +176,11 @@ ata_intel_probe(device_t dev)
      { ATA_CPT_R2,       0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" },
      { ATA_CPT_S3,       0, INTEL_6CH2, 0, ATA_SA300, "Cougar Point" },
      { ATA_CPT_S4,       0, INTEL_6CH2, 0, ATA_SA300, "Cougar Point" },
+     { ATA_PBG_S1,       0, INTEL_6CH,  0, ATA_SA300, "Patsburg" },
+     { ATA_PBG_AH1,      0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" },
+     { ATA_PBG_R1,       0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" },
+     { ATA_PBG_R2,       0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" },
+     { ATA_PBG_S2,       0, INTEL_6CH2, 0, ATA_SA300, "Patsburg" },
      { ATA_I31244,       0,          0, 2, ATA_SA150, "31244" },
      { ATA_ISCH,         0,          0, 1, ATA_UDMA5, "SCH" },
      { ATA_DH89XXCC,     0, INTEL_AHCI, 0, ATA_SA300, "DH89xxCC" },

Modified: head/sys/dev/ichsmb/ichsmb_pci.c
==============================================================================
--- head/sys/dev/ichsmb/ichsmb_pci.c	Mon Jan 31 23:46:36 2011	(r218148)
+++ head/sys/dev/ichsmb/ichsmb_pci.c	Tue Feb  1 01:05:11 2011	(r218149)
@@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$");
 #define ID_6300ESB			0x25a48086
 #define	ID_631xESB			0x269b8086
 #define ID_DH89XXCC			0x23308086
+#define ID_PATSBURG			0x1d228086
 #define ID_CPT				0x1c228086
 
 #define PCIS_SERIALBUS_SMBUS_PROGIF	0x00
@@ -179,6 +180,9 @@ ichsmb_pci_probe(device_t dev)
 	case ID_DH89XXCC:
 		device_set_desc(dev, "Intel DH89xxCC SMBus controller");
 		break;
+	case ID_PATSBURG:
+		device_set_desc(dev, "Intel Patsburg SMBus controller");
+		break;
 	case ID_CPT:
 		device_set_desc(dev, "Intel Cougar Point SMBus controller");
 		break;

Modified: head/sys/dev/ichwd/ichwd.c
==============================================================================
--- head/sys/dev/ichwd/ichwd.c	Mon Jan 31 23:46:36 2011	(r218148)
+++ head/sys/dev/ichwd/ichwd.c	Tue Feb  1 01:05:11 2011	(r218149)
@@ -157,7 +157,9 @@ static struct ichwd_device ichwd_devices
 	{ DEVICEID_CPT29,    "Intel Cougar Point watchdog timer",	10 },
 	{ DEVICEID_CPT30,    "Intel Cougar Point watchdog timer",	10 },
 	{ DEVICEID_CPT31,    "Intel Cougar Point watchdog timer",	10 },
-	{ DEVICEID_DH89XXCC_LPC, "Intel DH89xxCC watchdog timer",	10 },
+	{ DEVICEID_DH89XXCC_LPC,  "Intel DH89xxCC watchdog timer",	10 },
+	{ DEVICEID_PATSBURG_LPC1, "Intel Patsburg watchdog timer",	10 },
+	{ DEVICEID_PATSBURG_LPC2, "Intel Patsburg watchdog timer",	10 },
 	{ 0, NULL, 0 },
 };
 

Modified: head/sys/dev/ichwd/ichwd.h
==============================================================================
--- head/sys/dev/ichwd/ichwd.h	Mon Jan 31 23:46:36 2011	(r218148)
+++ head/sys/dev/ichwd/ichwd.h	Tue Feb  1 01:05:11 2011	(r218149)
@@ -96,6 +96,8 @@ struct ichwd_softc {
 #define DEVICEID_CPT29		0x1c5d
 #define DEVICEID_CPT30		0x1c5e
 #define DEVICEID_CPT31		0x1c5f
+#define DEVICEID_PATSBURG_LPC1	0x1d40
+#define DEVICEID_PATSBURG_LPC2	0x1d41
 #define DEVICEID_DH89XXCC_LPC	0x2310
 #define DEVICEID_82801AA	0x2410
 #define DEVICEID_82801AB	0x2420

Modified: head/sys/dev/sound/pci/hda/hdac.c
==============================================================================
--- head/sys/dev/sound/pci/hda/hdac.c	Mon Jan 31 23:46:36 2011	(r218148)
+++ head/sys/dev/sound/pci/hda/hdac.c	Tue Feb  1 01:05:11 2011	(r218149)
@@ -141,6 +141,7 @@ SND_DECLARE_FILE("$FreeBSD$");
 /* Intel */
 #define INTEL_VENDORID		0x8086
 #define HDA_INTEL_CPT		HDA_MODEL_CONSTRUCT(INTEL, 0x1c20)
+#define HDA_INTEL_PATSBURG	HDA_MODEL_CONSTRUCT(INTEL, 0x1d20)
 #define HDA_INTEL_82801F	HDA_MODEL_CONSTRUCT(INTEL, 0x2668)
 #define HDA_INTEL_63XXESB	HDA_MODEL_CONSTRUCT(INTEL, 0x269a)
 #define HDA_INTEL_82801G	HDA_MODEL_CONSTRUCT(INTEL, 0x27d8)
@@ -149,6 +150,7 @@ SND_DECLARE_FILE("$FreeBSD$");
 #define HDA_INTEL_82801JI	HDA_MODEL_CONSTRUCT(INTEL, 0x3a3e)
 #define HDA_INTEL_82801JD	HDA_MODEL_CONSTRUCT(INTEL, 0x3a6e)
 #define HDA_INTEL_PCH		HDA_MODEL_CONSTRUCT(INTEL, 0x3b56)
+#define HDA_INTEL_PCH2		HDA_MODEL_CONSTRUCT(INTEL, 0x3b57)
 #define HDA_INTEL_SCH		HDA_MODEL_CONSTRUCT(INTEL, 0x811b)
 #define HDA_INTEL_ALL		HDA_MODEL_CONSTRUCT(INTEL, 0xffff)
 
@@ -492,6 +494,7 @@ static const struct {
 	char		flags;
 } hdac_devices[] = {
 	{ HDA_INTEL_CPT,     "Intel Cougar Point",	0 },
+	{ HDA_INTEL_PATSBURG,"Intel Patsburg",  0 },
 	{ HDA_INTEL_82801F,  "Intel 82801F",	0 },
 	{ HDA_INTEL_63XXESB, "Intel 631x/632xESB",	0 },
 	{ HDA_INTEL_82801G,  "Intel 82801G",	0 },
@@ -499,7 +502,8 @@ static const struct {
 	{ HDA_INTEL_82801I,  "Intel 82801I",	0 },
 	{ HDA_INTEL_82801JI, "Intel 82801JI",	0 },
 	{ HDA_INTEL_82801JD, "Intel 82801JD",	0 },
-	{ HDA_INTEL_PCH,     "Intel PCH",	0 },
+	{ HDA_INTEL_PCH,     "Intel 5 Series/3400 Series",	0 },
+	{ HDA_INTEL_PCH2,    "Intel 5 Series/3400 Series",	0 },
 	{ HDA_INTEL_SCH,     "Intel SCH",	0 },
 	{ HDA_NVIDIA_MCP51,  "NVidia MCP51",	HDAC_NO_MSI },
 	{ HDA_NVIDIA_MCP55,  "NVidia MCP55",	HDAC_NO_MSI },

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 03:51:35 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9A34F106566B;
	Tue,  1 Feb 2011 03:51:35 +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 877408FC18;
	Tue,  1 Feb 2011 03:51:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p113pZWT056403;
	Tue, 1 Feb 2011 03:51:35 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p113pZ1v056395;
	Tue, 1 Feb 2011 03:51:35 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201102010351.p113pZ1v056395@svn.freebsd.org>
From: Adrian Chadd 
Date: Tue, 1 Feb 2011 03:51:35 +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: r218150 - in head/sys/dev/ath/ath_hal: . ar5416 ar9001
	ar9002
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 03:51:35 -0000

Author: adrian
Date: Tue Feb  1 03:51:35 2011
New Revision: 218150
URL: http://svn.freebsd.org/changeset/base/218150

Log:
  Add a new capability which reports the number of spatial streams a device supports.
  
  The higher levels (net80211, if_ath, ath_rate) need this to make correct
  choices about what MCS capabilities to advertise and what MCS rates are
  able to be TXed.
  
  In summary:
  
  * AR5416 - 2/3 antennas, 2x2 streams
  * AR9160 - 2/3 antennas, 2x2 streams
  * AR9220 - 2 antennas, 2x2 sstraems
  * AR9280 - 2 antennas, 2x2 streams
  * AR9285 - 2 antennas but with antenna diversity, 1x1 stream

Modified:
  head/sys/dev/ath/ath_hal/ah.c
  head/sys/dev/ath/ath_hal/ah.h
  head/sys/dev/ath/ath_hal/ah_internal.h
  head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
  head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c
  head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
  head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c

Modified: head/sys/dev/ath/ath_hal/ah.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ah.c	Tue Feb  1 01:05:11 2011	(r218149)
+++ head/sys/dev/ath/ath_hal/ah.c	Tue Feb  1 03:51:35 2011	(r218150)
@@ -583,6 +583,17 @@ ath_hal_getcapability(struct ath_hal *ah
 		return HAL_OK;
 	case HAL_CAP_BSSIDMATCH:	/* hardware has disable bssid match */
 		return pCap->halBssidMatchSupport ? HAL_OK : HAL_ENOTSUPP;
+	case HAL_CAP_STREAMS:		/* number of 11n spatial streams */
+		switch (capability) {
+		case 0:			/* TX */
+			*result = pCap->halTxStreams;
+			return HAL_OK;
+		case 1:			/* RX */
+			*result = pCap->halRxStreams;
+			return HAL_OK;
+		default:
+			return HAL_ENOTSUPP;
+		}
 	default:
 		return HAL_EINVAL;
 	}

Modified: head/sys/dev/ath/ath_hal/ah.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ah.h	Tue Feb  1 01:05:11 2011	(r218149)
+++ head/sys/dev/ath/ath_hal/ah.h	Tue Feb  1 03:51:35 2011	(r218150)
@@ -111,6 +111,7 @@ typedef enum {
 	HAL_CAP_MAC_HANG	= 36,	/* can MAC hang */
 	HAL_CAP_INTRMASK	= 37,	/* bitmask of supported interrupts */
 	HAL_CAP_BSSIDMATCH	= 38,	/* hardware has disable bssid match */
+	HAL_CAP_STREAMS		= 39,	/* how many 802.11n spatial streams are available */
 } HAL_CAPABILITY_TYPE;
 
 /* 

Modified: head/sys/dev/ath/ath_hal/ah_internal.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_internal.h	Tue Feb  1 01:05:11 2011	(r218149)
+++ head/sys/dev/ath/ath_hal/ah_internal.h	Tue Feb  1 03:51:35 2011	(r218150)
@@ -209,6 +209,8 @@ typedef struct {
 	uint8_t		halNumAntCfg2GHz;
 	uint8_t		halNumAntCfg5GHz;
 	uint32_t	halIntrMask;
+	uint8_t		halTxStreams;
+	uint8_t		halRxStreams;
 } HAL_CAPABILITIES;
 
 struct regDomain;

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c	Tue Feb  1 01:05:11 2011	(r218149)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c	Tue Feb  1 03:51:35 2011	(r218150)
@@ -819,6 +819,9 @@ ar5416FillCapabilityInfo(struct ath_hal 
 	pCap->halTxChainMask = ath_hal_eepromGet(ah, AR_EEP_TXMASK, AH_NULL);
 	/* XXX CB71 uses GPIO 0 to indicate 3 rx chains */
 	pCap->halRxChainMask = ath_hal_eepromGet(ah, AR_EEP_RXMASK, AH_NULL);
+	/* AR5416 may have 3 antennas but is a 2x2 stream device */
+	pCap->halTxStreams = 2;
+	pCap->halRxStreams = 2;
 	pCap->halRtsAggrLimit = 8*1024;		/* Owl 2.0 limit */
 	pCap->halMbssidAggrSupport = AH_TRUE;
 	pCap->halForcePpmSupport = AH_TRUE;

Modified: head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c	Tue Feb  1 01:05:11 2011	(r218149)
+++ head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c	Tue Feb  1 03:51:35 2011	(r218150)
@@ -290,6 +290,10 @@ ar9160FillCapabilityInfo(struct ath_hal 
 	pCap->halRtsAggrLimit = 64*1024;	/* 802.11n max */
 	pCap->halExtChanDfsSupport = AH_TRUE;
 	pCap->halAutoSleepSupport = AH_FALSE;	/* XXX? */
+	/* AR9160 is a 2x2 stream device */
+	pCap->halTxStreams = 2;
+	pCap->halRxStreams = 2;
+
 	return AH_TRUE;
 }
 

Modified: head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c	Tue Feb  1 01:05:11 2011	(r218149)
+++ head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c	Tue Feb  1 03:51:35 2011	(r218150)
@@ -684,6 +684,10 @@ ar9280FillCapabilityInfo(struct ath_hal 
 #if 0
 	pCap->halWowMatchPatternDword = AH_TRUE;
 #endif
+	/* AR9280 is a 2x2 stream device */
+	pCap->halTxStreams = 2;
+	pCap->halRxStreams = 2;
+
 	pCap->halCSTSupport = AH_TRUE;
 	pCap->halRifsRxSupport = AH_TRUE;
 	pCap->halRifsTxSupport = AH_TRUE;

Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c	Tue Feb  1 01:05:11 2011	(r218149)
+++ head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c	Tue Feb  1 03:51:35 2011	(r218150)
@@ -370,6 +370,10 @@ ar9285FillCapabilityInfo(struct ath_hal 
 #if 0
 	pCap->halWowMatchPatternDword = AH_TRUE;
 #endif
+	/* AR9285 has 2 antennas but is a 1x1 stream device */
+	pCap->halTxStreams = 2;
+	pCap->halRxStreams = 2;
+
 	pCap->halCSTSupport = AH_TRUE;
 	pCap->halRifsRxSupport = AH_TRUE;
 	pCap->halRifsTxSupport = AH_TRUE;

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 04:39:15 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ECD251065673;
	Tue,  1 Feb 2011 04:39:15 +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 DA7608FC19;
	Tue,  1 Feb 2011 04:39:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p114dFGv058064;
	Tue, 1 Feb 2011 04:39:15 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p114dFCu058062;
	Tue, 1 Feb 2011 04:39:15 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201102010439.p114dFCu058062@svn.freebsd.org>
From: Adrian Chadd 
Date: Tue, 1 Feb 2011 04:39:15 +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: r218151 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 04:39:16 -0000

Author: adrian
Date: Tue Feb  1 04:39:15 2011
New Revision: 218151
URL: http://svn.freebsd.org/changeset/base/218151

Log:
  Add TX/RX chainmask info to if_ath - this is needed for the 11n TX rate series.

Modified:
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_athvar.h
==============================================================================
--- head/sys/dev/ath/if_athvar.h	Tue Feb  1 03:51:35 2011	(r218150)
+++ head/sys/dev/ath/if_athvar.h	Tue Feb  1 04:39:15 2011	(r218151)
@@ -346,6 +346,8 @@ struct ath_softc {
 	u_int32_t		sc_avgtsfdeltap;/* TDMA slot adjust (+) */
 	u_int32_t		sc_avgtsfdeltam;/* TDMA slot adjust (-) */
 	uint16_t		*sc_eepromdata;	/* Local eeprom data, if AR9100 */
+	int			sc_txchainmask;	/* currently configured TX chainmask */
+	int			sc_rxchainmask;	/* currently configured RX chainmask */
 };
 
 #define	ATH_LOCK_INIT(_sc) \
@@ -630,6 +632,10 @@ void	ath_intr(void *);
 	ath_hal_setcapability(_ah, HAL_CAP_INTMIT, 1, _v, NULL)
 #define	ath_hal_getchannoise(_ah, _c) \
 	((*(_ah)->ah_getChanNoise)((_ah), (_c)))
+#define	ath_hal_getrxchainmask(_ah, _prxchainmask) \
+	(ath_hal_getcapability(_ah, HAL_CAP_RX_CHAINMASK, 0, _prxchainmask))
+#define	ath_hal_gettxchainmask(_ah, _ptxchainmask) \
+	(ath_hal_getcapability(_ah, HAL_CAP_TX_CHAINMASK, 0, _ptxchainmask))
 
 #define	ath_hal_setuprxdesc(_ah, _ds, _size, _intreq) \
 	((*(_ah)->ah_setupRxDesc)((_ah), (_ds), (_size), (_intreq)))

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 06:17:00 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EC67C106564A;
	Tue,  1 Feb 2011 06:17:00 +0000 (UTC)
	(envelope-from lstewart@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CD4758FC0A;
	Tue,  1 Feb 2011 06:17:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p116H0cV060696;
	Tue, 1 Feb 2011 06:17:00 GMT (envelope-from lstewart@svn.freebsd.org)
Received: (from lstewart@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p116H0HN060692;
	Tue, 1 Feb 2011 06:17:00 GMT (envelope-from lstewart@svn.freebsd.org)
Message-Id: <201102010617.p116H0HN060692@svn.freebsd.org>
From: Lawrence Stewart 
Date: Tue, 1 Feb 2011 06:17:00 +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: r218152 - in head/sys: modules/cc modules/cc/cc_vegas
	netinet/cc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 06:17:01 -0000

Author: lstewart
Date: Tue Feb  1 06:17:00 2011
New Revision: 218152
URL: http://svn.freebsd.org/changeset/base/218152

Log:
  Import a clean-room implementation of the VEGAS congestion control algorithm
  based on the paper "TCP Vegas: end to end congestion avoidance on a global
  internet" by Brakmo and Peterson. It is implemented as a kernel module
  compatible with the recently committed modular congestion control framework.
  
  VEGAS uses network delay as a congestion indicator and unlike regular loss-based
  algorithms, attempts to keep the network operating with stable queuing delays
  and no congestion losses. By keeping network buffers used along the path within
  a set range, queuing delays are kept low while maintaining high throughput.
  
  In collaboration with:	David Hayes  and
  				Grenville Armitage 
  Sponsored by:	FreeBSD Foundation
  Reviewed by:	bz and others along the way
  MFC after:	3 months

Added:
  head/sys/modules/cc/cc_vegas/
  head/sys/modules/cc/cc_vegas/Makefile   (contents, props changed)
  head/sys/netinet/cc/cc_vegas.c   (contents, props changed)
Modified:
  head/sys/modules/cc/Makefile

Modified: head/sys/modules/cc/Makefile
==============================================================================
--- head/sys/modules/cc/Makefile	Tue Feb  1 04:39:15 2011	(r218151)
+++ head/sys/modules/cc/Makefile	Tue Feb  1 06:17:00 2011	(r218152)
@@ -1,6 +1,7 @@
 # $FreeBSD$
 
 SUBDIR=	cc_cubic \
-	cc_htcp
+	cc_htcp \
+	cc_vegas
 
 .include 

Added: head/sys/modules/cc/cc_vegas/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/modules/cc/cc_vegas/Makefile	Tue Feb  1 06:17:00 2011	(r218152)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+.include 
+
+.PATH: ${.CURDIR}/../../../netinet/cc
+KMOD=	cc_vegas
+SRCS=	cc_vegas.c
+
+.include 

Added: head/sys/netinet/cc/cc_vegas.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/netinet/cc/cc_vegas.c	Tue Feb  1 06:17:00 2011	(r218152)
@@ -0,0 +1,308 @@
+/*-
+ * Copyright (c) 2009-2010
+ *	Swinburne University of Technology, Melbourne, Australia
+ * Copyright (c) 2010 Lawrence Stewart 
+ * Copyright (c) 2010-2011 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed at the Centre for Advanced Internet
+ * Architectures, Swinburne University, by David Hayes and Lawrence Stewart,
+ * made possible in part by a grant from the Cisco University Research Program
+ * Fund at Community Foundation Silicon Valley.
+ *
+ * Portions of this software were developed at the Centre for Advanced Internet
+ * Architectures, Swinburne University of Technology, Melbourne, Australia by
+ * David Hayes under sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * An implementation of the Vegas congestion control algorithm for FreeBSD,
+ * based on L. S. Brakmo and L. L. Peterson, "TCP Vegas: end to end congestion
+ * avoidance on a global internet", IEEE J. Sel. Areas Commun., vol. 13, no. 8,
+ * pp. 1465-1480, Oct. 1995. The original Vegas duplicate ack policy has not
+ * been implemented, since clock ticks are not as course as they were (i.e.
+ * 500ms) when Vegas was designed. Also, packets are timed once per RTT as in
+ * the original paper.
+ *
+ * Originally released as part of the NewTCP research project at Swinburne
+ * University's Centre for Advanced Internet Architectures, Melbourne,
+ * Australia, which was made possible in part by a grant from the Cisco
+ * University Research Program Fund at Community Foundation Silicon Valley. More
+ * details are available at:
+ *   http://caia.swin.edu.au/urp/newtcp/
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#define	CAST_PTR_INT(X)	(*((int*)(X)))
+
+/*
+ * Private signal type for rate based congestion signal.
+ * See  for appropriate bit-range to use for private signals.
+ */
+#define	CC_VEGAS_RATE	0x01000000
+
+static void	vegas_ack_received(struct cc_var *ccv, uint16_t ack_type);
+static void	vegas_cb_destroy(struct cc_var *ccv);
+static int	vegas_cb_init(struct cc_var *ccv);
+static void	vegas_cong_signal(struct cc_var *ccv, uint32_t signal_type);
+static void	vegas_conn_init(struct cc_var *ccv);
+static int	vegas_mod_init(void);
+
+struct vegas {
+	int slow_start_toggle;
+};
+
+static int32_t ertt_id;
+
+static VNET_DEFINE(uint32_t, vegas_alpha) = 1;
+static VNET_DEFINE(uint32_t, vegas_beta) = 3;
+#define	V_vegas_alpha	VNET(vegas_alpha)
+#define	V_vegas_beta	VNET(vegas_beta)
+
+MALLOC_DECLARE(M_VEGAS);
+MALLOC_DEFINE(M_VEGAS, "vegas data",
+    "Per connection data required for the Vegas congestion control algorithm");
+
+struct cc_algo vegas_cc_algo = {
+	.name = "vegas",
+	.ack_received = vegas_ack_received,
+	.cb_destroy = vegas_cb_destroy,
+	.cb_init = vegas_cb_init,
+	.cong_signal = vegas_cong_signal,
+	.conn_init = vegas_conn_init,
+	.mod_init = vegas_mod_init
+};
+
+/*
+ * The vegas window adjustment is done once every RTT, as indicated by the
+ * ERTT_NEW_MEASUREMENT flag. This flag is reset once the new measurment data
+ * has been used.
+ */
+static void
+vegas_ack_received(struct cc_var *ccv, uint16_t ack_type)
+{
+	struct ertt *e_t;
+	struct vegas *vegas_data;
+	long actual_tx_rate, expected_tx_rate, ndiff;
+
+	e_t = khelp_get_osd(CCV(ccv, osd), ertt_id);
+	vegas_data = ccv->cc_data;
+
+	if (e_t->flags & ERTT_NEW_MEASUREMENT) { /* Once per RTT. */
+		if (e_t->minrtt && e_t->markedpkt_rtt) {
+			expected_tx_rate = e_t->marked_snd_cwnd / e_t->minrtt;
+			actual_tx_rate = e_t->bytes_tx_in_marked_rtt /
+			    e_t->markedpkt_rtt;
+			ndiff = (expected_tx_rate - actual_tx_rate) *
+			    e_t->minrtt / CCV(ccv, t_maxseg);
+
+			if (ndiff < V_vegas_alpha) {
+				if (CCV(ccv, snd_cwnd) <=
+				    CCV(ccv, snd_ssthresh)) {
+					vegas_data->slow_start_toggle =
+					    vegas_data->slow_start_toggle ?
+					    0 : 1;
+				} else {
+					vegas_data->slow_start_toggle = 0;
+					CCV(ccv, snd_cwnd) =
+					    min(CCV(ccv, snd_cwnd) +
+					    CCV(ccv, t_maxseg),
+					    TCP_MAXWIN << CCV(ccv, snd_scale));
+				}
+			} else if (ndiff > V_vegas_beta) {
+				/* Rate-based congestion. */
+				vegas_cong_signal(ccv, CC_VEGAS_RATE);
+				vegas_data->slow_start_toggle = 0;
+			}
+		}
+		e_t->flags &= ~ERTT_NEW_MEASUREMENT;
+	}
+
+	if (vegas_data->slow_start_toggle)
+		newreno_cc_algo.ack_received(ccv, ack_type);
+}
+
+static void
+vegas_cb_destroy(struct cc_var *ccv)
+{
+
+	if (ccv->cc_data != NULL)
+		free(ccv->cc_data, M_VEGAS);
+}
+
+static int
+vegas_cb_init(struct cc_var *ccv)
+{
+	struct vegas *vegas_data;
+
+	vegas_data = malloc(sizeof(struct vegas), M_VEGAS, M_NOWAIT);
+
+	if (vegas_data == NULL)
+		return (ENOMEM);
+
+	vegas_data->slow_start_toggle = 1;
+	ccv->cc_data = vegas_data;
+
+	return (0);
+}
+
+/*
+ * If congestion has been triggered triggered by the Vegas measured rates, it is
+ * handled here, otherwise it falls back to newreno's congestion handling.
+ */
+static void
+vegas_cong_signal(struct cc_var *ccv, uint32_t signal_type)
+{
+	struct vegas *vegas_data;
+	int presignalrecov;
+
+	vegas_data = ccv->cc_data;
+
+	if (IN_RECOVERY(CCV(ccv, t_flags)))
+		presignalrecov = 1;
+	else
+		presignalrecov = 0;
+
+	switch(signal_type) {
+	case CC_VEGAS_RATE:
+		if (!IN_RECOVERY(CCV(ccv, t_flags))) {
+			CCV(ccv, snd_cwnd) = max(2 * CCV(ccv, t_maxseg),
+			    CCV(ccv, snd_cwnd) - CCV(ccv, t_maxseg));
+			if (CCV(ccv, snd_cwnd) < CCV(ccv, snd_ssthresh))
+				/* Exit slow start. */
+				CCV(ccv, snd_ssthresh) = CCV(ccv, snd_cwnd);
+		}
+		break;
+
+	default:
+		newreno_cc_algo.cong_signal(ccv, signal_type);
+	}
+
+	if (IN_RECOVERY(CCV(ccv, t_flags)) && !presignalrecov)
+		vegas_data->slow_start_toggle =
+		    (CCV(ccv, snd_cwnd) < CCV(ccv, snd_ssthresh)) ? 1 : 0;
+}
+
+static void
+vegas_conn_init(struct cc_var *ccv)
+{
+	struct vegas *vegas_data;
+
+	vegas_data = ccv->cc_data;
+	vegas_data->slow_start_toggle = 1;
+}
+
+static int
+vegas_mod_init(void)
+{
+
+	ertt_id = khelp_get_id("ertt");
+	if (ertt_id <= 0) {
+		printf("%s: h_ertt module not found\n", __func__);
+		return (ENOENT);
+	}
+
+	vegas_cc_algo.after_idle = newreno_cc_algo.after_idle;
+	vegas_cc_algo.post_recovery = newreno_cc_algo.post_recovery;
+
+	return (0);
+}
+
+static int
+vegas_alpha_handler(SYSCTL_HANDLER_ARGS)
+{
+	int error;
+	uint32_t new;
+
+	new = V_vegas_alpha;
+	error = sysctl_handle_int(oidp, &new, 0, req);
+	if (error == 0 && req->newptr != NULL) {
+		if (CAST_PTR_INT(req->newptr) < 1 ||
+		    CAST_PTR_INT(req->newptr) > V_vegas_beta)
+			error = EINVAL;
+		else
+			V_vegas_alpha = new;
+	}
+
+	return (error);
+}
+
+static int
+vegas_beta_handler(SYSCTL_HANDLER_ARGS)
+{
+	int error;
+	uint32_t new;
+
+	new = V_vegas_beta;
+	error = sysctl_handle_int(oidp, &new, 0, req);
+	if (error == 0 && req->newptr != NULL) {
+		if (CAST_PTR_INT(req->newptr) < 1 ||
+		    CAST_PTR_INT(req->newptr) < V_vegas_alpha)
+			 error = EINVAL;
+		else
+			V_vegas_beta = new;
+	}
+
+	return (error);
+}
+
+SYSCTL_DECL(_net_inet_tcp_cc_vegas);
+SYSCTL_NODE(_net_inet_tcp_cc, OID_AUTO, vegas, CTLFLAG_RW, NULL,
+    "Vegas related settings");
+
+SYSCTL_VNET_PROC(_net_inet_tcp_cc_vegas, OID_AUTO, alpha,
+    CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(vegas_alpha), 1, &vegas_alpha_handler,
+    "IU", "vegas alpha, specified as number of \"buffers\" (0 < alpha < beta)");
+
+SYSCTL_VNET_PROC(_net_inet_tcp_cc_vegas, OID_AUTO, beta,
+    CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(vegas_beta), 3, &vegas_beta_handler,
+    "IU", "vegas beta, specified as number of \"buffers\" (0 < alpha < beta)");
+
+DECLARE_CC_MODULE(vegas, &vegas_cc_algo);
+MODULE_DEPEND(vegas, ertt, 1, 1, 1);

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 06:42:46 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AABB1106564A;
	Tue,  1 Feb 2011 06:42:46 +0000 (UTC)
	(envelope-from lstewart@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 969B38FC17;
	Tue,  1 Feb 2011 06:42:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p116gkkC061319;
	Tue, 1 Feb 2011 06:42:46 GMT (envelope-from lstewart@svn.freebsd.org)
Received: (from lstewart@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p116gkca061315;
	Tue, 1 Feb 2011 06:42:46 GMT (envelope-from lstewart@svn.freebsd.org)
Message-Id: <201102010642.p116gkca061315@svn.freebsd.org>
From: Lawrence Stewart 
Date: Tue, 1 Feb 2011 06:42:46 +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: r218153 - in head/sys: modules/cc modules/cc/cc_hd
	netinet/cc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 06:42:46 -0000

Author: lstewart
Date: Tue Feb  1 06:42:46 2011
New Revision: 218153
URL: http://svn.freebsd.org/changeset/base/218153

Log:
  Import a clean-room implementation of the Hamilton-Delay (HD) congestion control
  algorithm based on the paper "A strategy for fair coexistence of loss and
  delay-based congestion control algorithms" by Budzisz, Stanojevic, Shorten and
  Baker. It is implemented as a kernel module compatible with the recently
  committed modular congestion control framework.
  
  HD uses a probabilistic approach to reacting to delay-based congestion. The
  probability of reducing cwnd is zero when the queuing delay is very small,
  increasing to a maximum at a set threshold, then back down to zero again when
  the queuing delay is high. Normal operation keeps the queuing delay below the
  set threshold. However, since loss-based congestion control algorithms push the
  queuing delay high when probing for bandwidth, having the probability of
  reducing cwnd drop back to zero for high delays allows HD to compete with
  loss-based algorithms.
  
  In collaboration with:	David Hayes  and
  				Grenville Armitage 
  Sponsored by:	FreeBSD Foundation
  Reviewed by:	bz and others along the way
  MFC after:	3 months

Added:
  head/sys/modules/cc/cc_hd/
  head/sys/modules/cc/cc_hd/Makefile   (contents, props changed)
  head/sys/netinet/cc/cc_hd.c   (contents, props changed)
Modified:
  head/sys/modules/cc/Makefile

Modified: head/sys/modules/cc/Makefile
==============================================================================
--- head/sys/modules/cc/Makefile	Tue Feb  1 06:17:00 2011	(r218152)
+++ head/sys/modules/cc/Makefile	Tue Feb  1 06:42:46 2011	(r218153)
@@ -1,6 +1,7 @@
 # $FreeBSD$
 
 SUBDIR=	cc_cubic \
+	cc_hd \
 	cc_htcp \
 	cc_vegas
 

Added: head/sys/modules/cc/cc_hd/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/modules/cc/cc_hd/Makefile	Tue Feb  1 06:42:46 2011	(r218153)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+.include 
+
+.PATH: ${.CURDIR}/../../../netinet/cc
+KMOD=	cc_hd
+SRCS=	cc_hd.c
+
+.include 

Added: head/sys/netinet/cc/cc_hd.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/netinet/cc/cc_hd.c	Tue Feb  1 06:42:46 2011	(r218153)
@@ -0,0 +1,254 @@
+/*-
+ * Copyright (c) 2009-2010
+ *	Swinburne University of Technology, Melbourne, Australia
+ * Copyright (c) 2010 Lawrence Stewart 
+ * Copyright (c) 2010-2011 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed at the Centre for Advanced Internet
+ * Architectures, Swinburne University, by David Hayes and Lawrence Stewart,
+ * made possible in part by a grant from the Cisco University Research Program
+ * Fund at Community Foundation Silicon Valley.
+ *
+ * Portions of this software were developed at the Centre for Advanced Internet
+ * Architectures, Swinburne University of Technology, Melbourne, Australia by
+ * David Hayes under sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * An implementation of the Hamilton Institute's delay-based congestion control
+ * algorithm for FreeBSD, based on "A strategy for fair coexistence of loss and
+ * delay-based congestion control algorithms," by L. Budzisz, R. Stanojevic, R.
+ * Shorten, and F. Baker, IEEE Commun. Lett., vol. 13, no. 7, pp. 555--557, Jul.
+ * 2009.
+ *
+ * Originally released as part of the NewTCP research project at Swinburne
+ * University's Centre for Advanced Internet Architectures, Melbourne,
+ * Australia, which was made possible in part by a grant from the Cisco
+ * University Research Program Fund at Community Foundation Silicon Valley. More
+ * details are available at:
+ *   http://caia.swin.edu.au/urp/newtcp/
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#define	CAST_PTR_INT(X)	(*((int*)(X)))
+
+/* Largest possible number returned by random(). */
+#define	RANDOM_MAX	INT_MAX
+
+static void	hd_ack_received(struct cc_var *ccv, uint16_t ack_type);
+static int	hd_mod_init(void);
+
+static int ertt_id;
+
+static VNET_DEFINE(uint32_t, hd_qthresh) = 20;
+static VNET_DEFINE(uint32_t, hd_qmin) = 5;
+static VNET_DEFINE(uint32_t, hd_pmax) = 5;
+#define	V_hd_qthresh	VNET(hd_qthresh)
+#define	V_hd_qmin	VNET(hd_qmin)
+#define	V_hd_pmax	VNET(hd_pmax)
+
+struct cc_algo hd_cc_algo = {
+	.name = "hd",
+	.ack_received = hd_ack_received,
+	.mod_init = hd_mod_init
+};
+
+/*
+ * Hamilton backoff function. Returns 1 if we should backoff or 0 otherwise.
+ */
+static __inline int
+should_backoff(int qdly, int maxqdly)
+{
+	unsigned long p;
+
+	if (qdly < V_hd_qthresh) {
+		p = (((RANDOM_MAX / 100) * V_hd_pmax) /
+		    (V_hd_qthresh - V_hd_qmin)) * (qdly - V_hd_qmin);
+	} else {
+		if (qdly > V_hd_qthresh)
+			p = (((RANDOM_MAX / 100) * V_hd_pmax) /
+			    (maxqdly - V_hd_qthresh)) * (maxqdly - qdly);
+		else
+			p = (RANDOM_MAX / 100) * V_hd_pmax;
+	}
+
+	return (random() < p);
+}
+
+/*
+ * If the ack type is CC_ACK, and the inferred queueing delay is greater than
+ * the Qmin threshold, cwnd is reduced probabilistically. When backing off due
+ * to delay, HD behaves like NewReno when an ECN signal is received. HD behaves
+ * as NewReno in all other circumstances.
+ */
+static void
+hd_ack_received(struct cc_var *ccv, uint16_t ack_type)
+{
+	struct ertt *e_t;
+	int qdly;
+
+	if (ack_type == CC_ACK) {
+		e_t = khelp_get_osd(CCV(ccv, osd), ertt_id);
+
+		if (e_t->rtt && e_t->minrtt && V_hd_qthresh > 0) {
+			qdly = e_t->rtt - e_t->minrtt;
+
+			if (qdly > V_hd_qmin &&
+			    !IN_RECOVERY(CCV(ccv, t_flags))) {
+				/* Probabilistic backoff of cwnd. */
+				if (should_backoff(qdly,
+				    e_t->maxrtt - e_t->minrtt)) {
+					/*
+					 * Update cwnd and ssthresh update to
+					 * half cwnd and behave like an ECN (ie
+					 * not a packet loss).
+					 */
+					newreno_cc_algo.cong_signal(ccv,
+					    CC_ECN);
+					return;
+				}
+			}
+		}
+	}
+	newreno_cc_algo.ack_received(ccv, ack_type); /* As for NewReno. */
+}
+
+static int
+hd_mod_init(void)
+{
+
+	ertt_id = khelp_get_id("ertt");
+	if (ertt_id <= 0) {
+		printf("%s: h_ertt module not found\n", __func__);
+		return (ENOENT);
+	}
+
+	hd_cc_algo.after_idle = newreno_cc_algo.after_idle;
+	hd_cc_algo.cong_signal = newreno_cc_algo.cong_signal;
+	hd_cc_algo.post_recovery = newreno_cc_algo.post_recovery;
+
+	return (0);
+}
+
+static int
+hd_pmax_handler(SYSCTL_HANDLER_ARGS)
+{
+	int error;
+	uint32_t new;
+
+	new = V_hd_pmax;
+	error = sysctl_handle_int(oidp, &new, 0, req);
+	if (error == 0 && req->newptr != NULL) {
+		if (CAST_PTR_INT(req->newptr) == 0 ||
+		    CAST_PTR_INT(req->newptr) > 100)
+			error = EINVAL;
+		else
+			V_hd_pmax = new;
+	}
+
+	return (error);
+}
+
+static int
+hd_qmin_handler(SYSCTL_HANDLER_ARGS)
+{
+	int error;
+	uint32_t new;
+
+	new = V_hd_qmin;
+	error = sysctl_handle_int(oidp, &new, 0, req);
+	if (error == 0 && req->newptr != NULL) {
+		if (CAST_PTR_INT(req->newptr) > V_hd_qthresh)
+			error = EINVAL;
+		else
+			V_hd_qmin = new;
+	}
+
+	return (error);
+}
+
+static int
+hd_qthresh_handler(SYSCTL_HANDLER_ARGS)
+{
+	int error;
+	uint32_t new;
+
+	new = V_hd_qthresh;
+	error = sysctl_handle_int(oidp, &new, 0, req);
+	if (error == 0 && req->newptr != NULL) {
+		if (CAST_PTR_INT(req->newptr) < 1 ||
+		    CAST_PTR_INT(req->newptr) < V_hd_qmin)
+			error = EINVAL;
+		else
+			V_hd_qthresh = new;
+	}
+
+	return (error);
+}
+
+SYSCTL_DECL(_net_inet_tcp_cc_hd);
+SYSCTL_NODE(_net_inet_tcp_cc, OID_AUTO, hd, CTLFLAG_RW, NULL,
+    "Hamilton delay-based congestion control related settings");
+
+SYSCTL_VNET_PROC(_net_inet_tcp_cc_hd, OID_AUTO, queue_threshold,
+    CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(hd_qthresh), 20, &hd_qthresh_handler,
+    "IU", "queueing congestion threshold (qth) in ticks");
+
+SYSCTL_VNET_PROC(_net_inet_tcp_cc_hd, OID_AUTO, pmax,
+    CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(hd_pmax), 5, &hd_pmax_handler,
+    "IU", "per packet maximum backoff probability as a percentage");
+
+SYSCTL_VNET_PROC(_net_inet_tcp_cc_hd, OID_AUTO, queue_min,
+    CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(hd_qmin), 5, &hd_qmin_handler,
+    "IU", "minimum queueing delay threshold (qmin) in ticks");
+
+DECLARE_CC_MODULE(hd, &hd_cc_algo);
+MODULE_DEPEND(hd, ertt, 1, 1, 1);

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 06:59:44 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 73D19106566B;
	Tue,  1 Feb 2011 06:59:44 +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 611928FC08;
	Tue,  1 Feb 2011 06:59:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p116xiuA061735;
	Tue, 1 Feb 2011 06:59:44 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p116xic9061733;
	Tue, 1 Feb 2011 06:59:44 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201102010659.p116xic9061733@svn.freebsd.org>
From: Adrian Chadd 
Date: Tue, 1 Feb 2011 06:59: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: r218154 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 06:59:44 -0000

Author: adrian
Date: Tue Feb  1 06:59:44 2011
New Revision: 218154
URL: http://svn.freebsd.org/changeset/base/218154

Log:
  * Add a rather hacky "does this speak the 11n TX descriptor format"
    function; which will be later used by the TX path to determine
    whether to use the extended features or not.
  
  * Break out the descriptor chaining logic into a separate function;
    again so it can be switched out later on for the 11n version when
    needed.
  
  * Refactor out the encryption-swizzling code that's common in the
    raw and normal TX path.

Modified:
  head/sys/dev/ath/if_ath_tx.c

Modified: head/sys/dev/ath/if_ath_tx.c
==============================================================================
--- head/sys/dev/ath/if_ath_tx.c	Tue Feb  1 06:42:46 2011	(r218153)
+++ head/sys/dev/ath/if_ath_tx.c	Tue Feb  1 06:59:44 2011	(r218154)
@@ -98,6 +98,15 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+/*
+ * Whether to use the 11n rate scenario functions or not
+ */
+static inline int
+ath_tx_is_11n(struct ath_softc *sc)
+{
+	return (sc->sc_ah->ah_magic == 0x20065416);
+}
+
 void
 ath_txfrag_cleanup(struct ath_softc *sc,
 	ath_bufhead *frags, struct ieee80211_node *ni)
@@ -216,7 +225,7 @@ ath_tx_dmasetup(struct ath_softc *sc, st
 }
 
 static void
-ath_tx_handoff(struct ath_softc *sc, struct ath_txq *txq, struct ath_buf *bf)
+ath_tx_chaindesclist(struct ath_softc *sc, struct ath_txq *txq, struct ath_buf *bf)
 {
 	struct ath_hal *ah = sc->sc_ah;
 	struct ath_desc *ds, *ds0;
@@ -243,6 +252,17 @@ ath_tx_handoff(struct ath_softc *sc, str
 			__func__, i, ds->ds_link, ds->ds_data,
 			ds->ds_ctl0, ds->ds_ctl1, ds->ds_hw[0], ds->ds_hw[1]);
 	}
+
+}
+
+static void
+ath_tx_handoff(struct ath_softc *sc, struct ath_txq *txq, struct ath_buf *bf)
+{
+	struct ath_hal *ah = sc->sc_ah;
+
+	/* Fill in the details in the descriptor list */
+	ath_tx_chaindesclist(sc, txq, bf);
+
 	/*
 	 * Insert the frame on the outbound list and pass it on
 	 * to the hardware.  Multicast frames buffered for power
@@ -348,6 +368,57 @@ ath_tx_handoff(struct ath_softc *sc, str
 	ATH_TXQ_UNLOCK(txq);
 }
 
+static int
+ath_tx_tag_crypto(struct ath_softc *sc, struct ieee80211_node *ni,
+    struct mbuf *m0, int iswep, int isfrag, int *hdrlen, int *pktlen, int *keyix)
+{
+	if (iswep) {
+		const struct ieee80211_cipher *cip;
+		struct ieee80211_key *k;
+
+		/*
+		 * Construct the 802.11 header+trailer for an encrypted
+		 * frame. The only reason this can fail is because of an
+		 * unknown or unsupported cipher/key type.
+		 */
+		k = ieee80211_crypto_encap(ni, m0);
+		if (k == NULL) {
+			/*
+			 * This can happen when the key is yanked after the
+			 * frame was queued.  Just discard the frame; the
+			 * 802.11 layer counts failures and provides
+			 * debugging/diagnostics.
+			 */
+			return 0;
+		}
+		/*
+		 * Adjust the packet + header lengths for the crypto
+		 * additions and calculate the h/w key index.  When
+		 * a s/w mic is done the frame will have had any mic
+		 * added to it prior to entry so m0->m_pkthdr.len will
+		 * account for it. Otherwise we need to add it to the
+		 * packet length.
+		 */
+		cip = k->wk_cipher;
+		(*hdrlen) += cip->ic_header;
+		(*pktlen) += cip->ic_header + cip->ic_trailer;
+		/* NB: frags always have any TKIP MIC done in s/w */
+		if ((k->wk_flags & IEEE80211_KEY_SWMIC) == 0 && !isfrag)
+			(*pktlen) += cip->ic_miclen;
+		(*keyix) = k->wk_keyix;
+	} else if (ni->ni_ucastkey.wk_cipher == &ieee80211_cipher_none) {
+		/*
+		 * Use station key cache slot, if assigned.
+		 */
+		(*keyix) = ni->ni_ucastkey.wk_keyix;
+		if ((*keyix) == IEEE80211_KEYIX_NONE)
+			(*keyix) = HAL_TXKEYIX_INVALID;
+	} else
+		(*keyix) = HAL_TXKEYIX_INVALID;
+
+	return 1;
+}
+
 int
 ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf,
     struct mbuf *m0)
@@ -383,53 +454,14 @@ ath_tx_start(struct ath_softc *sc, struc
 	 */
 	pktlen = m0->m_pkthdr.len - (hdrlen & 3);
 
-	if (iswep) {
-		const struct ieee80211_cipher *cip;
-		struct ieee80211_key *k;
-
-		/*
-		 * Construct the 802.11 header+trailer for an encrypted
-		 * frame. The only reason this can fail is because of an
-		 * unknown or unsupported cipher/key type.
-		 */
-		k = ieee80211_crypto_encap(ni, m0);
-		if (k == NULL) {
-			/*
-			 * This can happen when the key is yanked after the
-			 * frame was queued.  Just discard the frame; the
-			 * 802.11 layer counts failures and provides
-			 * debugging/diagnostics.
-			 */
-			ath_freetx(m0);
-			return EIO;
-		}
-		/*
-		 * Adjust the packet + header lengths for the crypto
-		 * additions and calculate the h/w key index.  When
-		 * a s/w mic is done the frame will have had any mic
-		 * added to it prior to entry so m0->m_pkthdr.len will
-		 * account for it. Otherwise we need to add it to the
-		 * packet length.
-		 */
-		cip = k->wk_cipher;
-		hdrlen += cip->ic_header;
-		pktlen += cip->ic_header + cip->ic_trailer;
-		/* NB: frags always have any TKIP MIC done in s/w */
-		if ((k->wk_flags & IEEE80211_KEY_SWMIC) == 0 && !isfrag)
-			pktlen += cip->ic_miclen;
-		keyix = k->wk_keyix;
+	/* Handle encryption twiddling if needed */
+	if (! ath_tx_tag_crypto(sc, ni, m0, iswep, isfrag, &hdrlen, &pktlen, &keyix)) {
+		ath_freetx(m0);
+		return EIO;
+	}
 
-		/* packet header may have moved, reset our local pointer */
-		wh = mtod(m0, struct ieee80211_frame *);
-	} else if (ni->ni_ucastkey.wk_cipher == &ieee80211_cipher_none) {
-		/*
-		 * Use station key cache slot, if assigned.
-		 */
-		keyix = ni->ni_ucastkey.wk_keyix;
-		if (keyix == IEEE80211_KEYIX_NONE)
-			keyix = HAL_TXKEYIX_INVALID;
-	} else
-		keyix = HAL_TXKEYIX_INVALID;
+	/* packet header may have moved, reset our local pointer */
+	wh = mtod(m0, struct ieee80211_frame *);
 
 	pktlen += IEEE80211_CRC_LEN;
 
@@ -787,53 +819,13 @@ ath_tx_raw_start(struct ath_softc *sc, s
 	/* XXX honor IEEE80211_BPF_DATAPAD */
 	pktlen = m0->m_pkthdr.len - (hdrlen & 3) + IEEE80211_CRC_LEN;
 
-	if (params->ibp_flags & IEEE80211_BPF_CRYPTO) {
-		const struct ieee80211_cipher *cip;
-		struct ieee80211_key *k;
-
-		/*
-		 * Construct the 802.11 header+trailer for an encrypted
-		 * frame. The only reason this can fail is because of an
-		 * unknown or unsupported cipher/key type.
-		 */
-		k = ieee80211_crypto_encap(ni, m0);
-		if (k == NULL) {
-			/*
-			 * This can happen when the key is yanked after the
-			 * frame was queued.  Just discard the frame; the
-			 * 802.11 layer counts failures and provides
-			 * debugging/diagnostics.
-			 */
-			ath_freetx(m0);
-			return EIO;
-		}
-		/*
-		 * Adjust the packet + header lengths for the crypto
-		 * additions and calculate the h/w key index.  When
-		 * a s/w mic is done the frame will have had any mic
-		 * added to it prior to entry so m0->m_pkthdr.len will
-		 * account for it. Otherwise we need to add it to the
-		 * packet length.
-		 */
-		cip = k->wk_cipher;
-		hdrlen += cip->ic_header;
-		pktlen += cip->ic_header + cip->ic_trailer;
-		/* NB: frags always have any TKIP MIC done in s/w */
-		if ((k->wk_flags & IEEE80211_KEY_SWMIC) == 0)
-			pktlen += cip->ic_miclen;
-		keyix = k->wk_keyix;
-
-		/* packet header may have moved, reset our local pointer */
-		wh = mtod(m0, struct ieee80211_frame *);
-	} else if (ni->ni_ucastkey.wk_cipher == &ieee80211_cipher_none) {
-		/*
-		 * Use station key cache slot, if assigned.
-		 */
-		keyix = ni->ni_ucastkey.wk_keyix;
-		if (keyix == IEEE80211_KEYIX_NONE)
-			keyix = HAL_TXKEYIX_INVALID;
-	} else
-		keyix = HAL_TXKEYIX_INVALID;
+	/* Handle encryption twiddling if needed */
+	if (! ath_tx_tag_crypto(sc, ni, m0, params->ibp_flags & IEEE80211_BPF_CRYPTO, 0, &hdrlen, &pktlen, &keyix)) {
+		ath_freetx(m0);
+		return EIO;
+	}
+	/* packet header may have moved, reset our local pointer */
+	wh = mtod(m0, struct ieee80211_frame *);
 
 	error = ath_tx_dmasetup(sc, bf, m0);
 	if (error != 0)

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 07:05:14 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E2EA6106566B;
	Tue,  1 Feb 2011 07:05:14 +0000 (UTC)
	(envelope-from lstewart@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CF1B68FC08;
	Tue,  1 Feb 2011 07:05:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p1175Ei4061909;
	Tue, 1 Feb 2011 07:05:14 GMT (envelope-from lstewart@svn.freebsd.org)
Received: (from lstewart@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1175EgG061905;
	Tue, 1 Feb 2011 07:05:14 GMT (envelope-from lstewart@svn.freebsd.org)
Message-Id: <201102010705.p1175EgG061905@svn.freebsd.org>
From: Lawrence Stewart 
Date: Tue, 1 Feb 2011 07:05:14 +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: r218155 - in head/sys: modules/cc modules/cc/cc_chd
	netinet/cc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 07:05:15 -0000

Author: lstewart
Date: Tue Feb  1 07:05:14 2011
New Revision: 218155
URL: http://svn.freebsd.org/changeset/base/218155

Log:
  Import an implementation of the CAIA-Hamilton-Delay (CHD) congestion control
  algorithm described in the paper "Improved coexistence and loss tolerance for
  delay based TCP congestion control" by Hayes and Armitage. It is implemented as
  a kernel module compatible with the recently committed modular congestion
  control framework.
  
  CHD enhances the approach taken by the Hamilton-Delay (HD) algorithm to provide
  tolerance to non-congestion related packet loss and improvements to coexistence
  with loss-based congestion control algorithms. A key idea in improving
  coexistence with loss-based congestion control algorithms is the use of a shadow
  window, which attempts to track how NewReno's congestion window (cwnd) would
  evolve. At the next packet loss congestion event, CHD uses the shadow window to
  correct cwnd in a way that reduces the amount of unfairness CHD experiences when
  competing with loss-based algorithms.
  
  In collaboration with:	David Hayes  and
  				Grenville Armitage 
  Sponsored by:	FreeBSD Foundation
  Reviewed by:	bz and others along the way
  MFC after:	3 months

Added:
  head/sys/modules/cc/cc_chd/
  head/sys/modules/cc/cc_chd/Makefile   (contents, props changed)
  head/sys/netinet/cc/cc_chd.c   (contents, props changed)
Modified:
  head/sys/modules/cc/Makefile

Modified: head/sys/modules/cc/Makefile
==============================================================================
--- head/sys/modules/cc/Makefile	Tue Feb  1 06:59:44 2011	(r218154)
+++ head/sys/modules/cc/Makefile	Tue Feb  1 07:05:14 2011	(r218155)
@@ -1,6 +1,7 @@
 # $FreeBSD$
 
-SUBDIR=	cc_cubic \
+SUBDIR=	cc_chd \
+	cc_cubic \
 	cc_hd \
 	cc_htcp \
 	cc_vegas

Added: head/sys/modules/cc/cc_chd/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/modules/cc/cc_chd/Makefile	Tue Feb  1 07:05:14 2011	(r218155)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+.include 
+
+.PATH: ${.CURDIR}/../../../netinet/cc
+KMOD=	cc_chd
+SRCS=	cc_chd.c
+
+.include 

Added: head/sys/netinet/cc/cc_chd.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/netinet/cc/cc_chd.c	Tue Feb  1 07:05:14 2011	(r218155)
@@ -0,0 +1,497 @@
+/*-
+ * Copyright (c) 2009-2010
+ *	Swinburne University of Technology, Melbourne, Australia
+ * Copyright (c) 2010-2011 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed at the Centre for Advanced Internet
+ * Architectures, Swinburne University, by David Hayes and Lawrence Stewart,
+ * made possible in part by a grant from the Cisco University Research Program
+ * Fund at Community Foundation Silicon Valley.
+ *
+ * Portions of this software were developed at the Centre for Advanced Internet
+ * Architectures, Swinburne University of Technology, Melbourne, Australia by
+ * David Hayes under sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * An implementation of the CAIA-Hamilton delay based congestion control
+ * algorithm, based on "Improved coexistence and loss tolerance for delay based
+ * TCP congestion control" by D. A. Hayes and G. Armitage., in 35th Annual IEEE
+ * Conference on Local Computer Networks (LCN 2010), Denver, Colorado, USA,
+ * 11-14 October 2010.
+ *
+ * Originally released as part of the NewTCP research project at Swinburne
+ * University's Centre for Advanced Internet Architectures, Melbourne,
+ * Australia, which was made possible in part by a grant from the Cisco
+ * University Research Program Fund at Community Foundation Silicon Valley. More
+ * details are available at:
+ *   http://caia.swin.edu.au/urp/newtcp/
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#define	CAST_PTR_INT(X)	(*((int*)(X)))
+
+/*
+ * Private signal type for rate based congestion signal.
+ * See  for appropriate bit-range to use for private signals.
+ */
+#define	CC_CHD_DELAY	0x02000000
+
+/* Largest possible number returned by random(). */
+#define	RANDOM_MAX	INT_MAX
+
+static void	chd_ack_received(struct cc_var *ccv, uint16_t ack_type);
+static void	chd_cb_destroy(struct cc_var *ccv);
+static int	chd_cb_init(struct cc_var *ccv);
+static void	chd_cong_signal(struct cc_var *ccv, uint32_t signal_type);
+static void	chd_conn_init(struct cc_var *ccv);
+static int	chd_mod_init(void);
+
+struct chd {
+	/*
+	 * Shadow window - keeps track of what the NewReno congestion window
+	 * would have been if delay-based cwnd backoffs had not been made. This
+	 * functionality aids coexistence with loss-based TCP flows which may be
+	 * sharing links along the path.
+	 */
+	unsigned long shadow_w;
+	/*
+	 * Loss-based TCP compatibility flag - When set, it turns on the shadow
+	 * window functionality.
+	 */
+	int loss_compete;
+	 /* The maximum round trip time seen within a measured rtt period. */
+	int maxrtt_in_rtt;
+	/* The previous qdly that caused cwnd to backoff. */
+	int prev_backoff_qdly;
+};
+
+static int ertt_id;
+
+static VNET_DEFINE(uint32_t, chd_qmin) = 5;
+static VNET_DEFINE(uint32_t, chd_pmax) = 50;
+static VNET_DEFINE(uint32_t, chd_loss_fair) = 1;
+static VNET_DEFINE(uint32_t, chd_use_max) = 1;
+static VNET_DEFINE(uint32_t, chd_qthresh) = 20;
+#define	V_chd_qthresh	VNET(chd_qthresh)
+#define	V_chd_qmin	VNET(chd_qmin)
+#define	V_chd_pmax	VNET(chd_pmax)
+#define	V_chd_loss_fair	VNET(chd_loss_fair)
+#define	V_chd_use_max	VNET(chd_use_max)
+
+MALLOC_DECLARE(M_CHD);
+MALLOC_DEFINE(M_CHD, "chd data",
+    "Per connection data required for the CHD congestion control algorithm");
+
+struct cc_algo chd_cc_algo = {
+	.name = "chd",
+	.ack_received = chd_ack_received,
+	.cb_destroy = chd_cb_destroy,
+	.cb_init = chd_cb_init,
+	.cong_signal = chd_cong_signal,
+	.conn_init = chd_conn_init,
+	.mod_init = chd_mod_init
+};
+
+static __inline void
+chd_window_decrease(struct cc_var *ccv)
+{
+	unsigned long win;
+
+	win = min(CCV(ccv, snd_wnd), CCV(ccv, snd_cwnd)) / CCV(ccv, t_maxseg);
+	win -= max((win / 2), 1);
+	CCV(ccv, snd_ssthresh) = max(win, 2) * CCV(ccv, t_maxseg);
+}
+
+/*
+ * Probabilistic backoff function. Returns 1 if we should backoff or 0
+ * otherwise. The calculation of p is similar to the calculation of p in cc_hd.
+ */
+static __inline int
+should_backoff(int qdly, int maxqdly, struct chd *chd_data)
+{
+	unsigned long p, rand;
+
+	rand = random();
+
+	if (qdly < V_chd_qthresh) {
+		chd_data->loss_compete = 0;
+		p = (((RANDOM_MAX / 100) * V_chd_pmax) /
+		    (V_chd_qthresh - V_chd_qmin)) *
+		    (qdly - V_chd_qmin);
+	} else {
+		if (qdly > V_chd_qthresh) {
+			p = (((RANDOM_MAX / 100) * V_chd_pmax) /
+			    (maxqdly - V_chd_qthresh)) *
+			    (maxqdly - qdly);
+			if (V_chd_loss_fair && rand < p)
+				chd_data->loss_compete = 1;
+		} else {
+			p = (RANDOM_MAX / 100) * V_chd_pmax;
+			chd_data->loss_compete = 0;
+		}
+	}
+
+	return (rand < p);
+}
+
+static __inline void
+chd_window_increase(struct cc_var *ccv, int new_measurement)
+{
+	struct chd *chd_data;
+	int incr;
+
+	chd_data = ccv->cc_data;
+	incr = 0;
+
+	if (CCV(ccv, snd_cwnd) <= CCV(ccv, snd_ssthresh)) {
+		/* Adapted from NewReno slow start. */
+		if (V_tcp_do_rfc3465) {
+			/* In slow-start with ABC enabled. */
+			if (CCV(ccv, snd_nxt) == CCV(ccv, snd_max)) {
+				/* Not due to RTO. */
+				incr = min(ccv->bytes_this_ack,
+				    V_tcp_abc_l_var * CCV(ccv, t_maxseg));
+			} else {
+				/* Due to RTO. */
+				incr = min(ccv->bytes_this_ack,
+				    CCV(ccv, t_maxseg));
+			}
+		} else
+			incr = CCV(ccv, t_maxseg);
+
+	} else { /* Congestion avoidance. */
+		if (V_tcp_do_rfc3465) {
+			if (ccv->flags & CCF_ABC_SENTAWND) {
+				ccv->flags &= ~CCF_ABC_SENTAWND;
+				incr = CCV(ccv, t_maxseg);
+			}
+		} else if (new_measurement)
+			incr = CCV(ccv, t_maxseg);
+	}
+
+	if (chd_data->shadow_w > 0) {
+		/* Track NewReno window. */
+		chd_data->shadow_w = min(chd_data->shadow_w + incr,
+		    TCP_MAXWIN << CCV(ccv, snd_scale));
+	}
+
+	CCV(ccv,snd_cwnd) = min(CCV(ccv, snd_cwnd) + incr,
+	    TCP_MAXWIN << CCV(ccv, snd_scale));
+}
+
+/*
+ * All ACK signals are used for timing measurements to determine delay-based
+ * congestion. However, window increases are only performed when
+ * ack_type == CC_ACK.
+ */
+static void
+chd_ack_received(struct cc_var *ccv, uint16_t ack_type)
+{
+	struct chd *chd_data;
+	struct ertt *e_t;
+	int backoff, new_measurement, qdly, rtt;
+
+	e_t = khelp_get_osd(CCV(ccv, osd), ertt_id);
+	chd_data = ccv->cc_data;
+	new_measurement = e_t->flags & ERTT_NEW_MEASUREMENT;
+	backoff = qdly = 0;
+
+	chd_data->maxrtt_in_rtt = imax(e_t->rtt, chd_data->maxrtt_in_rtt);
+
+	if (new_measurement) {
+		/*
+		 * There is a new per RTT measurement, so check to see if there
+		 * is delay based congestion.
+		 */
+		rtt = V_chd_use_max ? chd_data->maxrtt_in_rtt : e_t->rtt;
+		chd_data->maxrtt_in_rtt = 0;
+
+		if (rtt && e_t->minrtt && !IN_RECOVERY(CCV(ccv, t_flags))) {
+			qdly = rtt - e_t->minrtt;
+			if (qdly > V_chd_qmin) {
+				/*
+				 * Probabilistic delay based congestion
+				 * indication.
+				 */
+				backoff = should_backoff(qdly,
+				    e_t->maxrtt - e_t->minrtt, chd_data);
+			} else
+				chd_data->loss_compete = 0;
+		}
+		/* Reset per RTT measurement flag to start a new measurement. */
+		e_t->flags &= ~ERTT_NEW_MEASUREMENT;
+	}
+
+	if (backoff) {
+		/*
+		 * Update shadow_w before delay based backoff.
+		 */
+		if (chd_data->loss_compete ||
+		    qdly > chd_data->prev_backoff_qdly) {
+			/*
+			 * Delay is higher than when we backed off previously,
+			 * so it is possible that this flow is competing with
+			 * loss based flows.
+			 */
+			chd_data->shadow_w = max(CCV(ccv, snd_cwnd),
+			    chd_data->shadow_w);
+		} else {
+			/*
+			 * Reset shadow_w, as it is probable that this flow is
+			 * not competing with loss based flows at the moment.
+			 */
+			chd_data->shadow_w = 0;
+		}
+
+		chd_data->prev_backoff_qdly = qdly;
+		/*
+		 * Send delay-based congestion signal to the congestion signal
+		 * handler.
+		 */
+		chd_cong_signal(ccv, CC_CHD_DELAY);
+
+	} else if (ack_type == CC_ACK)
+		chd_window_increase(ccv, new_measurement);
+}
+
+static void
+chd_cb_destroy(struct cc_var *ccv)
+{
+
+	if (ccv->cc_data != NULL)
+		free(ccv->cc_data, M_CHD);
+}
+
+static int
+chd_cb_init(struct cc_var *ccv)
+{
+	struct chd *chd_data;
+
+	chd_data = malloc(sizeof(struct chd), M_CHD, M_NOWAIT);
+	if (chd_data == NULL)
+		return (ENOMEM);
+
+	chd_data->shadow_w = 0;
+	ccv->cc_data = chd_data;
+
+	return (0);
+}
+
+static void
+chd_cong_signal(struct cc_var *ccv, uint32_t signal_type)
+{
+	struct ertt *e_t;
+	struct chd *chd_data;
+	int qdly;
+
+	e_t = khelp_get_osd(CCV(ccv, osd), ertt_id);
+	chd_data = ccv->cc_data;
+	qdly = imax(e_t->rtt, chd_data->maxrtt_in_rtt) - e_t->minrtt;
+
+	switch(signal_type) {
+	case CC_CHD_DELAY:
+		chd_window_decrease(ccv); /* Set new ssthresh. */
+		CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
+		CCV(ccv, snd_recover) = CCV(ccv, snd_max);
+		ENTER_CONGRECOVERY(CCV(ccv, t_flags));
+		break;
+
+	case CC_NDUPACK: /* Packet loss. */
+		/*
+		 * Only react to loss as a congestion signal if qdly >
+		 * V_chd_qthresh.  If qdly is less than qthresh, presume that
+		 * this is a non congestion related loss. If qdly is greater
+		 * than qthresh, assume that we are competing with loss based
+		 * tcp flows and restore window from any unnecessary backoffs,
+		 * before the decrease.
+		 */
+		if (!IN_RECOVERY(CCV(ccv, t_flags)) && qdly > V_chd_qthresh) {
+			if (chd_data->loss_compete) {
+				CCV(ccv, snd_cwnd) = max(CCV(ccv, snd_cwnd),
+				    chd_data->shadow_w);
+			}
+			chd_window_decrease(ccv);
+		} else {
+			 /*
+			  * This loss isn't congestion related, or already
+			  * recovering from congestion.
+			  */
+			CCV(ccv, snd_ssthresh) = CCV(ccv, snd_cwnd);
+			CCV(ccv, snd_recover) = CCV(ccv, snd_max);
+		}
+
+		if (chd_data->shadow_w > 0) {
+			chd_data->shadow_w = max(chd_data->shadow_w /
+			    CCV(ccv, t_maxseg) / 2, 2) * CCV(ccv, t_maxseg);
+		}
+		ENTER_FASTRECOVERY(CCV(ccv, t_flags));
+		break;
+
+	default:
+		newreno_cc_algo.cong_signal(ccv, signal_type);
+	}
+}
+
+static void
+chd_conn_init(struct cc_var *ccv)
+{
+	struct chd *chd_data;
+
+	chd_data = ccv->cc_data;
+	chd_data->prev_backoff_qdly = 0;
+	chd_data->maxrtt_in_rtt = 0;
+	chd_data->loss_compete = 0;
+	/*
+	 * Initialise the shadow_cwnd to be equal to snd_cwnd in case we are
+	 * competing with loss based flows from the start.
+	 */
+	chd_data->shadow_w = CCV(ccv, snd_cwnd);
+}
+
+static int
+chd_mod_init(void)
+{
+
+	ertt_id = khelp_get_id("ertt");
+	if (ertt_id <= 0) {
+		printf("%s: h_ertt module not found\n", __func__);
+		return (ENOENT);
+	}
+
+	chd_cc_algo.after_idle = newreno_cc_algo.after_idle;
+	chd_cc_algo.post_recovery = newreno_cc_algo.post_recovery;
+
+	return (0);
+}
+
+static int
+chd_loss_fair_handler(SYSCTL_HANDLER_ARGS)
+{
+	int error;
+	uint32_t new;
+
+	new = V_chd_loss_fair;
+	error = sysctl_handle_int(oidp, &new, 0, req);
+	if (error == 0 && req->newptr != NULL) {
+		if (CAST_PTR_INT(req->newptr) > 1)
+			error = EINVAL;
+		else
+			V_chd_loss_fair = new;
+	}
+
+	return (error);
+}
+
+static int
+chd_pmax_handler(SYSCTL_HANDLER_ARGS)
+{
+	int error;
+	uint32_t new;
+
+	new = V_chd_pmax;
+	error = sysctl_handle_int(oidp, &new, 0, req);
+	if (error == 0 && req->newptr != NULL) {
+		if (CAST_PTR_INT(req->newptr) == 0 ||
+		    CAST_PTR_INT(req->newptr) > 100)
+			error = EINVAL;
+		else
+			V_chd_pmax = new;
+	}
+
+	return (error);
+}
+
+static int
+chd_qthresh_handler(SYSCTL_HANDLER_ARGS)
+{
+	int error;
+	uint32_t new;
+
+	new = V_chd_qthresh;
+	error = sysctl_handle_int(oidp, &new, 0, req);
+	if (error == 0 && req->newptr != NULL) {
+		if (CAST_PTR_INT(req->newptr) <= V_chd_qmin)
+			error = EINVAL;
+		else
+			V_chd_qthresh = new;
+	}
+
+	return (error);
+}
+
+SYSCTL_DECL(_net_inet_tcp_cc_chd);
+SYSCTL_NODE(_net_inet_tcp_cc, OID_AUTO, chd, CTLFLAG_RW, NULL,
+    "CAIA Hamilton delay-based congestion control related settings");
+
+SYSCTL_VNET_PROC(_net_inet_tcp_cc_chd, OID_AUTO, loss_fair,
+    CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(chd_loss_fair), 1, &chd_loss_fair_handler,
+    "IU", "Flag to enable shadow window functionality.");
+
+SYSCTL_VNET_PROC(_net_inet_tcp_cc_chd, OID_AUTO, pmax,
+    CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(chd_pmax), 5, &chd_pmax_handler,
+    "IU", "Per RTT maximum backoff probability as a percentage");
+
+SYSCTL_VNET_PROC(_net_inet_tcp_cc_chd, OID_AUTO, queue_threshold,
+    CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(chd_qthresh), 20, &chd_qthresh_handler,
+    "IU", "Queueing congestion threshold in ticks");
+
+SYSCTL_VNET_UINT(_net_inet_tcp_cc_chd, OID_AUTO, queue_min,
+    CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(chd_qmin), 5,
+    "Minimum queueing delay threshold in ticks");
+
+SYSCTL_VNET_UINT(_net_inet_tcp_cc_chd,  OID_AUTO, use_max,
+    CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(chd_use_max), 1,
+    "Use the maximum RTT seen within the measurement period (RTT) "
+    "as the basic delay measurement for the algorithm.");
+
+DECLARE_CC_MODULE(chd, &chd_cc_algo);
+MODULE_DEPEND(chd, ertt, 1, 1, 1);

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 07:10:13 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 74EF81065670;
	Tue,  1 Feb 2011 07:10:13 +0000 (UTC)
	(envelope-from lstewart@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 62F6F8FC12;
	Tue,  1 Feb 2011 07:10:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p117ADQp062050;
	Tue, 1 Feb 2011 07:10:13 GMT (envelope-from lstewart@svn.freebsd.org)
Received: (from lstewart@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p117ADDM062048;
	Tue, 1 Feb 2011 07:10:13 GMT (envelope-from lstewart@svn.freebsd.org)
Message-Id: <201102010710.p117ADDM062048@svn.freebsd.org>
From: Lawrence Stewart 
Date: Tue, 1 Feb 2011 07:10:13 +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: r218156 - head/sys/netinet/cc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 07:10:13 -0000

Author: lstewart
Date: Tue Feb  1 07:10:13 2011
New Revision: 218156
URL: http://svn.freebsd.org/changeset/base/218156

Log:
  Fix typo in comment: "course" -> "coarse"
  
  Sponsored by:	FreeBSD Foundation
  Submitted by:	jmallett
  MFC after:	3 months
  X-MFC with:	r218152

Modified:
  head/sys/netinet/cc/cc_vegas.c

Modified: head/sys/netinet/cc/cc_vegas.c
==============================================================================
--- head/sys/netinet/cc/cc_vegas.c	Tue Feb  1 07:05:14 2011	(r218155)
+++ head/sys/netinet/cc/cc_vegas.c	Tue Feb  1 07:10:13 2011	(r218156)
@@ -41,7 +41,7 @@
  * based on L. S. Brakmo and L. L. Peterson, "TCP Vegas: end to end congestion
  * avoidance on a global internet", IEEE J. Sel. Areas Commun., vol. 13, no. 8,
  * pp. 1465-1480, Oct. 1995. The original Vegas duplicate ack policy has not
- * been implemented, since clock ticks are not as course as they were (i.e.
+ * been implemented, since clock ticks are not as coarse as they were (i.e.
  * 500ms) when Vegas was designed. Also, packets are timed once per RTT as in
  * the original paper.
  *

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 07:50:27 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 42B32106564A;
	Tue,  1 Feb 2011 07:50:27 +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 3018F8FC13;
	Tue,  1 Feb 2011 07:50:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p117oRid063000;
	Tue, 1 Feb 2011 07:50:27 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p117oRuM062998;
	Tue, 1 Feb 2011 07:50:27 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201102010750.p117oRuM062998@svn.freebsd.org>
From: Adrian Chadd 
Date: Tue, 1 Feb 2011 07:50: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: r218157 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 07:50:27 -0000

Author: adrian
Date: Tue Feb  1 07:50:26 2011
New Revision: 218157
URL: http://svn.freebsd.org/changeset/base/218157

Log:
  Refator the common code which calculates the 802.11g protection duration.

Modified:
  head/sys/dev/ath/if_ath_tx.c

Modified: head/sys/dev/ath/if_ath_tx.c
==============================================================================
--- head/sys/dev/ath/if_ath_tx.c	Tue Feb  1 07:10:13 2011	(r218156)
+++ head/sys/dev/ath/if_ath_tx.c	Tue Feb  1 07:50:26 2011	(r218157)
@@ -419,6 +419,46 @@ ath_tx_tag_crypto(struct ath_softc *sc, 
 	return 1;
 }
 
+static void
+ath_tx_calc_ctsduration(struct ath_hal *ah, int rix, int cix,
+    int shortPreamble, int pktlen, const HAL_RATE_TABLE *rt,
+    int flags, u_int8_t *ctsrate, int *ctsduration)
+{
+	/*
+	 * CTS transmit rate is derived from the transmit rate
+	 * by looking in the h/w rate table.  We must also factor
+	 * in whether or not a short preamble is to be used.
+	 */
+	/* NB: cix is set above where RTS/CTS is enabled */
+	KASSERT(cix != 0xff, ("cix not setup"));
+	(*ctsrate) = rt->info[cix].rateCode;
+	/*
+	 * Compute the transmit duration based on the frame
+	 * size and the size of an ACK frame.  We call into the
+	 * HAL to do the computation since it depends on the
+	 * characteristics of the actual PHY being used.
+	 *
+	 * NB: CTS is assumed the same size as an ACK so we can
+	 *     use the precalculated ACK durations.
+	 */
+	if (shortPreamble) {
+		(*ctsrate) |= rt->info[cix].shortPreamble;
+		if (flags & HAL_TXDESC_RTSENA)		/* SIFS + CTS */
+			(*ctsduration) += rt->info[cix].spAckDuration;
+		(*ctsduration) += ath_hal_computetxtime(ah,
+			rt, pktlen, rix, AH_TRUE);
+		if ((flags & HAL_TXDESC_NOACK) == 0)	/* SIFS + ACK */
+			(*ctsduration) += rt->info[rix].spAckDuration;
+	} else {
+		if (flags & HAL_TXDESC_RTSENA)		/* SIFS + CTS */
+			(*ctsduration) += rt->info[cix].lpAckDuration;
+		(*ctsduration) += ath_hal_computetxtime(ah,
+			rt, pktlen, rix, AH_FALSE);
+		if ((flags & HAL_TXDESC_NOACK) == 0)	/* SIFS + ACK */
+			(*ctsduration) += rt->info[rix].lpAckDuration;
+	}
+}
+
 int
 ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf,
     struct mbuf *m0)
@@ -669,39 +709,8 @@ ath_tx_start(struct ath_softc *sc, struc
 	 */
 	ctsduration = 0;
 	if (flags & (HAL_TXDESC_RTSENA|HAL_TXDESC_CTSENA)) {
-		/*
-		 * CTS transmit rate is derived from the transmit rate
-		 * by looking in the h/w rate table.  We must also factor
-		 * in whether or not a short preamble is to be used.
-		 */
-		/* NB: cix is set above where RTS/CTS is enabled */
-		KASSERT(cix != 0xff, ("cix not setup"));
-		ctsrate = rt->info[cix].rateCode;
-		/*
-		 * Compute the transmit duration based on the frame
-		 * size and the size of an ACK frame.  We call into the
-		 * HAL to do the computation since it depends on the
-		 * characteristics of the actual PHY being used.
-		 *
-		 * NB: CTS is assumed the same size as an ACK so we can
-		 *     use the precalculated ACK durations.
-		 */
-		if (shortPreamble) {
-			ctsrate |= rt->info[cix].shortPreamble;
-			if (flags & HAL_TXDESC_RTSENA)		/* SIFS + CTS */
-				ctsduration += rt->info[cix].spAckDuration;
-			ctsduration += ath_hal_computetxtime(ah,
-				rt, pktlen, rix, AH_TRUE);
-			if ((flags & HAL_TXDESC_NOACK) == 0)	/* SIFS + ACK */
-				ctsduration += rt->info[rix].spAckDuration;
-		} else {
-			if (flags & HAL_TXDESC_RTSENA)		/* SIFS + CTS */
-				ctsduration += rt->info[cix].lpAckDuration;
-			ctsduration += ath_hal_computetxtime(ah,
-				rt, pktlen, rix, AH_FALSE);
-			if ((flags & HAL_TXDESC_NOACK) == 0)	/* SIFS + ACK */
-				ctsduration += rt->info[rix].lpAckDuration;
-		}
+		(void) ath_tx_calc_ctsduration(ah, rix, cix, shortPreamble, pktlen,
+		    rt, flags, &ctsrate, &ctsduration);
 		/*
 		 * Must disable multi-rate retry when using RTS/CTS.
 		 */
@@ -856,29 +865,20 @@ ath_tx_raw_start(struct ath_softc *sc, s
 	txantenna = params->ibp_pri >> 2;
 	if (txantenna == 0)			/* XXX? */
 		txantenna = sc->sc_txantenna;
+
 	ctsduration = 0;
-	if (flags & (HAL_TXDESC_CTSENA | HAL_TXDESC_RTSENA)) {
+	if (flags & (HAL_TXDESC_RTSENA|HAL_TXDESC_CTSENA)) {
 		cix = ath_tx_findrix(sc, params->ibp_ctsrate);
-		ctsrate = rt->info[cix].rateCode;
-		if (params->ibp_flags & IEEE80211_BPF_SHORTPRE) {
-			ctsrate |= rt->info[cix].shortPreamble;
-			if (flags & HAL_TXDESC_RTSENA)		/* SIFS + CTS */
-				ctsduration += rt->info[cix].spAckDuration;
-			ctsduration += ath_hal_computetxtime(ah,
-				rt, pktlen, rix, AH_TRUE);
-			if ((flags & HAL_TXDESC_NOACK) == 0)	/* SIFS + ACK */
-				ctsduration += rt->info[rix].spAckDuration;
-		} else {
-			if (flags & HAL_TXDESC_RTSENA)		/* SIFS + CTS */
-				ctsduration += rt->info[cix].lpAckDuration;
-			ctsduration += ath_hal_computetxtime(ah,
-				rt, pktlen, rix, AH_FALSE);
-			if ((flags & HAL_TXDESC_NOACK) == 0)	/* SIFS + ACK */
-				ctsduration += rt->info[rix].lpAckDuration;
-		}
+		(void) ath_tx_calc_ctsduration(ah, rix, cix,
+		    params->ibp_flags & IEEE80211_BPF_SHORTPRE, pktlen,
+		    rt, flags, &ctsrate, &ctsduration);
+		/*
+		 * Must disable multi-rate retry when using RTS/CTS.
+		 */
 		ismrr = 0;			/* XXX */
 	} else
 		ctsrate = 0;
+
 	pri = params->ibp_pri & 3;
 	/*
 	 * NB: we mark all packets as type PSPOLL so the h/w won't

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 07:58:44 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 101B0106564A;
	Tue,  1 Feb 2011 07:58:44 +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 F24EF8FC15;
	Tue,  1 Feb 2011 07:58:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p117whjP063221;
	Tue, 1 Feb 2011 07:58:43 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p117whH4063219;
	Tue, 1 Feb 2011 07:58:43 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201102010758.p117whH4063219@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Tue, 1 Feb 2011 07:58:43 +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: r218158 - head/sbin/hastd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 07:58:44 -0000

Author: pjd
Date: Tue Feb  1 07:58:43 2011
New Revision: 218158
URL: http://svn.freebsd.org/changeset/base/218158

Log:
  Do not set socket send and receive buffer. It will be auto-tuned.
  
  Confirmed by:	rwatson
  MFC after:	1 week

Modified:
  head/sbin/hastd/proto_tcp4.c

Modified: head/sbin/hastd/proto_tcp4.c
==============================================================================
--- head/sbin/hastd/proto_tcp4.c	Tue Feb  1 07:50:26 2011	(r218157)
+++ head/sbin/hastd/proto_tcp4.c	Tue Feb  1 07:58:43 2011	(r218158)
@@ -170,7 +170,7 @@ static int
 tcp4_common_setup(const char *addr, void **ctxp, int side)
 {
 	struct tcp4_ctx *tctx;
-	int ret, val;
+	int ret, nodelay;
 
 	tctx = malloc(sizeof(*tctx));
 	if (tctx == NULL)
@@ -190,21 +190,11 @@ tcp4_common_setup(const char *addr, void
 	}
 
 	/* Socket settings. */
-	val = 1;
-	if (setsockopt(tctx->tc_fd, IPPROTO_TCP, TCP_NODELAY, &val,
-	    sizeof(val)) == -1) {
+	nodelay = 1;
+	if (setsockopt(tctx->tc_fd, IPPROTO_TCP, TCP_NODELAY, &nodelay,
+	    sizeof(nodelay)) == -1) {
 		pjdlog_warning("Unable to set TCP_NOELAY on %s", addr);
 	}
-	val = 131072;
-	if (setsockopt(tctx->tc_fd, SOL_SOCKET, SO_SNDBUF, &val,
-	    sizeof(val)) == -1) {
-		pjdlog_warning("Unable to set send buffer size on %s", addr);
-	}
-	val = 131072;
-	if (setsockopt(tctx->tc_fd, SOL_SOCKET, SO_RCVBUF, &val,
-	    sizeof(val)) == -1) {
-		pjdlog_warning("Unable to set receive buffer size on %s", addr);
-	}
 
 	tctx->tc_side = side;
 	tctx->tc_magic = TCP4_CTX_MAGIC;

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 08:03:02 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 546D1106566B;
	Tue,  1 Feb 2011 08:03:02 +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 40C148FC0C;
	Tue,  1 Feb 2011 08:03:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p11832NV063407;
	Tue, 1 Feb 2011 08:03:02 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p11832lG063402;
	Tue, 1 Feb 2011 08:03:02 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201102010803.p11832lG063402@svn.freebsd.org>
From: Adrian Chadd 
Date: Tue, 1 Feb 2011 08:03:02 +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: r218159 - in head/sys: conf dev/ath modules/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 08:03:02 -0000

Author: adrian
Date: Tue Feb  1 08:03:01 2011
New Revision: 218159
URL: http://svn.freebsd.org/changeset/base/218159

Log:
  Include some preliminary TX HT rate scenario setup code.
  
  The AR5416 and later TX descriptors have new fields for supporting
  11n bits (eg 20/40mhz mode, short/long GI) and enabling/disabling
  RTS/CTS protection per rate.
  
  These functions will be responsible for initialising the TX descriptors
  for the AR5416 and later chips for both HT and legacy frames.
  
  Beacon frames will remain using the non-11n TX descriptor setup for now;
  Linux ath9k does much the same.
  
  Note that these functions aren't yet used anywhere; a few more framework
  changes are needed before all of the right rate information is available
  for TX.

Added:
  head/sys/dev/ath/if_ath_tx_ht.c   (contents, props changed)
  head/sys/dev/ath/if_ath_tx_ht.h   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/modules/ath/Makefile

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Tue Feb  1 07:58:43 2011	(r218158)
+++ head/sys/conf/files	Tue Feb  1 08:03:01 2011	(r218159)
@@ -570,6 +570,8 @@ dev/ath/if_ath_debug.c		optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_tx.c		optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
+dev/ath/if_ath_tx_ht.c		optional ath \
+	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_pci.c		optional ath pci \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/ah_osdep.c		optional ath \

Added: head/sys/dev/ath/if_ath_tx_ht.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/ath/if_ath_tx_ht.c	Tue Feb  1 08:03:01 2011	(r218159)
@@ -0,0 +1,204 @@
+/*-
+ * Copyright (c) 2011 Adrian Chadd, Xenion Pty Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ *    redistribution must be conditioned upon including a substantially
+ *    similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "opt_inet.h"
+#include "opt_ath.h"
+#include "opt_wlan.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#ifdef IEEE80211_SUPPORT_SUPERG
+#include 
+#endif
+#ifdef IEEE80211_SUPPORT_TDMA
+#include 
+#endif
+
+#include 
+
+#ifdef INET
+#include 
+#include 
+#endif
+
+#include 
+#include 		/* XXX for softled */
+#include 
+
+#ifdef ATH_TX99_DIAG
+#include 
+#endif
+
+#include 
+
+/*
+ * Setup a 11n rate series structure
+ *
+ * This should be called for both legacy and MCS rates.
+ */
+static void
+ath_rateseries_setup(struct ath_softc *sc, struct ieee80211_node *ni,
+    HAL_11N_RATE_SERIES *series, unsigned int pktlen, uint8_t *rix,
+    uint8_t *try)
+{
+	struct ieee80211com *ic = ni->ni_ic;
+	struct ath_hal *ah = sc->sc_ah;
+	HAL_BOOL shortPreamble = AH_FALSE;
+	const HAL_RATE_TABLE *rt = sc->sc_currates;
+	int i;
+	uint8_t txrate;
+
+	if ((ic->ic_flags & IEEE80211_F_SHPREAMBLE) &&
+	    (ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_PREAMBLE))
+		shortPreamble = AH_TRUE;
+
+	memset(series, 0, sizeof(HAL_11N_RATE_SERIES) * 4);
+	for (i = 0; i < 4;  i++) {
+		txrate = rt->info[rix[i]].rateCode;
+		series[i].Tries = try[i];
+		series[i].ChSel = sc->sc_txchainmask;
+		if (ic->ic_protmode == IEEE80211_PROT_RTSCTS ||
+		    ic->ic_protmode == IEEE80211_PROT_CTSONLY)
+			series[i].RateFlags |= HAL_RATESERIES_RTS_CTS;
+		if (ni->ni_htcap & IEEE80211_HTCAP_CHWIDTH40)
+			series[i].RateFlags |= HAL_RATESERIES_2040;
+		if (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20 ||
+		    ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40)
+			series[i].RateFlags |= HAL_RATESERIES_HALFGI;
+
+		/* XXX should this check the short preamble value should be set for legacy rates? -adrian */
+		series[i].Rate = txrate;
+
+		/* PktDuration doesn't include slot, ACK, RTS, etc timing - it's just the packet duration */
+		if (txrate & IEEE80211_RATE_MCS) {
+			series[i].PktDuration =
+			    ath_computedur_ht(pktlen
+				, txrate
+				, ic->ic_rxstream
+				, (ni->ni_htcap & IEEE80211_HTCAP_CHWIDTH40)
+				, shortPreamble);
+		} else {
+			series[i].PktDuration = ath_hal_computetxtime(ah,
+			    rt, pktlen, rix[i], shortPreamble);
+		}
+	}
+}
+
+#if 0
+static void
+ath_rateseries_print(HAL_11N_RATE_SERIES *series)
+{
+	int i;
+	for (i = 0; i < 4; i++) {
+		printf("series %d: rate %x; tries %d; pktDuration %d; chSel %d; rateFlags %x\n",
+		    i,
+		    series[i].Rate,
+		    series[i].Tries,
+		    series[i].PktDuration,
+		    series[i].ChSel,
+		    series[i].RateFlags);
+	}
+}
+#endif
+
+/*
+ * Setup the 11n rate scenario and burst duration for the given TX descriptor
+ * list.
+ *
+ * This isn't useful for sending beacon frames, which has different needs
+ * wrt what's passed into the rate scenario function.
+ */
+
+void
+ath_buf_set_rate(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf,
+    int pktlen, int flags, uint8_t ctsrate, uint8_t *rix, uint8_t *try)
+{
+	HAL_11N_RATE_SERIES series[4];
+	struct ath_desc *ds = bf->bf_desc;
+	struct ath_desc *lastds = NULL;
+	struct ath_hal *ah = sc->sc_ah;
+
+	/* Setup rate scenario */
+	memset(&series, 0, sizeof(series));
+
+	ath_rateseries_setup(sc, ni, series, pktlen, rix, try);
+
+	/* Enforce AR5416 aggregate limit - can't do RTS w/ an agg frame > 8k */
+
+	/* Enforce RTS and CTS are mutually exclusive */
+
+	/* Get a pointer to the last tx descriptor in the list */
+	lastds = &bf->bf_desc[bf->bf_nseg - 1];
+
+	/* Set rate scenario */
+	ath_hal_set11nratescenario(ah, ds,
+	    ctsrate,	/* rts/cts rate */
+	    0,		/* rts/cts duration */
+	    series,	/* 11n rate series */
+	    4,		/* number of series */
+	    flags);
+
+	/* Setup the last descriptor in the chain */
+	ath_hal_setuplasttxdesc(ah, lastds, ds);
+
+	/* Set burst duration */
+	/* This should only be done if aggregate protection is enabled */
+	//ath_hal_set11nburstduration(ah, ds, 8192);
+}

Added: head/sys/dev/ath/if_ath_tx_ht.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/ath/if_ath_tx_ht.h	Tue Feb  1 08:03:01 2011	(r218159)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2011 Adrian Chadd, Xenion Pty Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ *    redistribution must be conditioned upon including a substantially
+ *    similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * $FreeBSD$
+ */
+#ifndef	__IF_ATH_TX_HT_H__
+#define	__IF_ATH_TX_HT_H__
+
+extern void	ath_buf_set_rate(struct ath_softc *sc,
+		struct ieee80211_node *ni, struct ath_buf *bf,
+		int pktlen, int flags, uint8_t ctsrate, uint8_t *rix,
+		uint8_t *try);
+
+#endif

Modified: head/sys/modules/ath/Makefile
==============================================================================
--- head/sys/modules/ath/Makefile	Tue Feb  1 07:58:43 2011	(r218158)
+++ head/sys/modules/ath/Makefile	Tue Feb  1 08:03:01 2011	(r218159)
@@ -35,7 +35,7 @@ ATH_RATE?=	sample		# tx rate control alg
 .PATH:	${.CURDIR}/../../dev/ath/ath_hal
 
 KMOD=	if_ath
-SRCS=	if_ath.c if_ath_pci.c if_ath_debug.c if_ath_tx.c
+SRCS=	if_ath.c if_ath_pci.c if_ath_debug.c if_ath_tx.c if_ath_tx_ht.c
 # NB: v3 eeprom support used by both AR5211 and AR5212; just include it
 SRCS+=	ah_osdep.c ah.c ah_regdomain.c ah_eeprom_v3.c
 SRCS+=	device_if.h bus_if.h pci_if.h opt_inet.h opt_ath.h opt_ah.h opt_wlan.h

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 08:10:18 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EC735106564A;
	Tue,  1 Feb 2011 08:10: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 D96328FC08;
	Tue,  1 Feb 2011 08:10:18 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p118AIjI063628;
	Tue, 1 Feb 2011 08:10:18 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p118AIIv063623;
	Tue, 1 Feb 2011 08:10:18 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201102010810.p118AIIv063623@svn.freebsd.org>
From: Adrian Chadd 
Date: Tue, 1 Feb 2011 08:10: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: r218160 - in head/sys/dev/ath: . ath_rate/amrr
	ath_rate/onoe ath_rate/sample
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 08:10:19 -0000

Author: adrian
Date: Tue Feb  1 08:10:18 2011
New Revision: 218160
URL: http://svn.freebsd.org/changeset/base/218160

Log:
  Add a new method to the rate control modules which extract out the
  three other rates and try counts.
  
  The 11n rate scenario path wants to take a list of rate and tries,
  rather than calling setupxtxdesc().

Modified:
  head/sys/dev/ath/ath_rate/amrr/amrr.c
  head/sys/dev/ath/ath_rate/onoe/onoe.c
  head/sys/dev/ath/ath_rate/sample/sample.c
  head/sys/dev/ath/if_athrate.h

Modified: head/sys/dev/ath/ath_rate/amrr/amrr.c
==============================================================================
--- head/sys/dev/ath/ath_rate/amrr/amrr.c	Tue Feb  1 08:03:01 2011	(r218159)
+++ head/sys/dev/ath/ath_rate/amrr/amrr.c	Tue Feb  1 08:10:18 2011	(r218160)
@@ -114,6 +114,30 @@ ath_rate_findrate(struct ath_softc *sc, 
 		*txrate = amn->amn_tx_rate0;
 }
 
+/*
+ * Get the TX rates.
+ *
+ * The short preamble bits aren't set here; the caller should augment
+ * the returned rate with the relevant preamble rate flag.
+ */
+void
+ath_rate_getxtxrates(struct ath_softc *sc, struct ath_node *an,
+    uint8_t rix0, uint8_t *rix, uint8_t *try)
+{
+	struct amrr_node *amn = ATH_NODE_AMRR(an);
+
+/*	rix[0] = amn->amn_tx_rate0; */
+	rix[1] = amn->amn_tx_rate1;
+	rix[2] = amn->amn_tx_rate2;
+	rix[3] = amn->amn_tx_rate3;
+
+	try[0] = amn->amn_tx_try0;
+	try[1] = amn->amn_tx_try1;
+	try[2] = amn->amn_tx_try2;
+	try[3] = amn->amn_tx_try3;
+}
+
+
 void
 ath_rate_setupxtxdesc(struct ath_softc *sc, struct ath_node *an,
 	struct ath_desc *ds, int shortPreamble, u_int8_t rix)

Modified: head/sys/dev/ath/ath_rate/onoe/onoe.c
==============================================================================
--- head/sys/dev/ath/ath_rate/onoe/onoe.c	Tue Feb  1 08:03:01 2011	(r218159)
+++ head/sys/dev/ath/ath_rate/onoe/onoe.c	Tue Feb  1 08:10:18 2011	(r218160)
@@ -122,6 +122,29 @@ ath_rate_findrate(struct ath_softc *sc, 
 		*txrate = on->on_tx_rate0;
 }
 
+/*
+ * Get the TX rates.
+ *
+ * The short preamble bits aren't set here; the caller should augment
+ * the returned rate with the relevant preamble rate flag.
+ */
+void
+ath_rate_getxtxrates(struct ath_softc *sc, struct ath_node *an,
+    uint8_t rix0, uint8_t *rix, uint8_t *try)
+{
+	struct onoe_node *on = ATH_NODE_ONOE(an);
+
+/*	rix[0] = on->on_tx_rate0; */
+	rix[1] = on->on_tx_rate1;
+	rix[2] = on->on_tx_rate2;
+	rix[3] = on->on_tx_rate3;
+
+	try[0] = on->on_tx_try0;
+	try[1] = 2;
+	try[2] = 2;
+	try[3] = 2;
+}
+
 void
 ath_rate_setupxtxdesc(struct ath_softc *sc, struct ath_node *an,
 	struct ath_desc *ds, int shortPreamble, u_int8_t rix)

Modified: head/sys/dev/ath/ath_rate/sample/sample.c
==============================================================================
--- head/sys/dev/ath/ath_rate/sample/sample.c	Tue Feb  1 08:03:01 2011	(r218159)
+++ head/sys/dev/ath/ath_rate/sample/sample.c	Tue Feb  1 08:10:18 2011	(r218160)
@@ -363,6 +363,30 @@ done:
 #undef RATE
 }
 
+/*
+ * Get the TX rates. Don't fiddle with short preamble flags for them;
+ * the caller can do that.
+ */
+void
+ath_rate_getxtxrates(struct ath_softc *sc, struct ath_node *an,
+    uint8_t rix0, uint8_t *rix, uint8_t *try)
+{
+	struct sample_node *sn = ATH_NODE_SAMPLE(an);
+	const struct txschedule *sched = &sn->sched[rix0];
+
+	KASSERT(rix0 == sched->r0, ("rix0 (%x) != sched->r0 (%x)!\n", rix0, sched->r0));
+
+/*	rix[0] = sched->r0; */
+	rix[1] = sched->r1;
+	rix[2] = sched->r2;
+	rix[3] = sched->r3;
+
+	try[0] = sched->t0;
+	try[1] = sched->t1;
+	try[2] = sched->t2;
+	try[3] = sched->t3;
+}
+
 void
 ath_rate_setupxtxdesc(struct ath_softc *sc, struct ath_node *an,
 		      struct ath_desc *ds, int shortPreamble, u_int8_t rix)

Modified: head/sys/dev/ath/if_athrate.h
==============================================================================
--- head/sys/dev/ath/if_athrate.h	Tue Feb  1 08:03:01 2011	(r218159)
+++ head/sys/dev/ath/if_athrate.h	Tue Feb  1 08:10:18 2011	(r218160)
@@ -102,6 +102,12 @@ void	ath_rate_newassoc(struct ath_softc 
  * Transmit handling.
  */
 /*
+ * Return the four TX rate index and try counts for the current data packet.
+ */
+void	ath_rate_getxtxrates(struct ath_softc *sc, struct ath_node *an,
+		uint8_t rix0, uint8_t *rix, uint8_t *try);
+
+/*
  * Return the transmit info for a data packet.  If multi-rate state
  * is to be setup then try0 should contain a value other than ATH_TXMATRY
  * and ath_rate_setupxtxdesc will be called after deciding if the frame

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 10:25:49 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 22A41106566B;
	Tue,  1 Feb 2011 10:25:49 +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 06AFA8FC08;
	Tue,  1 Feb 2011 10:25:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p11APmjQ068421;
	Tue, 1 Feb 2011 10:25:48 GMT (envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p11APmnB068418;
	Tue, 1 Feb 2011 10:25:48 GMT (envelope-from hselasky@svn.freebsd.org)
Message-Id: <201102011025.p11APmnB068418@svn.freebsd.org>
From: Hans Petter Selasky 
Date: Tue, 1 Feb 2011 10:25:48 +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: r218165 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 10:25:49 -0000

Author: hselasky
Date: Tue Feb  1 10:25:48 2011
New Revision: 218165
URL: http://svn.freebsd.org/changeset/base/218165

Log:
  Use correct kernel types for all fields in USB PF code and headers.
  
  Approved by:	thompsa (mentor)

Modified:
  head/sys/dev/usb/usb_pf.c
  head/sys/dev/usb/usb_pf.h

Modified: head/sys/dev/usb/usb_pf.c
==============================================================================
--- head/sys/dev/usb/usb_pf.c	Tue Feb  1 10:20:31 2011	(r218164)
+++ head/sys/dev/usb/usb_pf.c	Tue Feb  1 10:25:48 2011	(r218165)
@@ -228,10 +228,10 @@ usbpf_xfertap(struct usb_xfer *xfer, int
 	ptr += sizeof(struct usbpf_pkthdr);
 
 	for (i = 0; i < up->up_frames; i++) {
-		if (ptr + sizeof(u_int32_t) >= end)
+		if (ptr + sizeof(uint32_t) >= end)
 			goto done;
-		*((u_int32_t *)ptr) = htole32(xfer->frlengths[i]);
-		ptr += sizeof(u_int32_t);
+		*((uint32_t *)ptr) = htole32(xfer->frlengths[i]);
+		ptr += sizeof(uint32_t);
 
 		if (ptr + xfer->frlengths[i] >= end)
 			goto done;

Modified: head/sys/dev/usb/usb_pf.h
==============================================================================
--- head/sys/dev/usb/usb_pf.h	Tue Feb  1 10:20:31 2011	(r218164)
+++ head/sys/dev/usb/usb_pf.h	Tue Feb  1 10:25:48 2011	(r218165)
@@ -38,12 +38,12 @@
 #define	_DEV_USB_PF_H
 
 struct usbpf_pkthdr {
-	int		up_busunit;	/* Host controller unit number */
-	u_char		up_address;	/* USB device address */
-	u_char		up_endpoint;	/* USB endpoint */
-	u_char		up_type;	/* points SUBMIT / DONE */
-	u_char		up_xfertype;	/* Transfer type */
-	u_int32_t	up_flags;	/* Transfer flags */
+	uint32_t	up_busunit;	/* Host controller unit number */
+	uint8_t		up_address;	/* USB device address */
+	uint8_t		up_endpoint;	/* USB endpoint */
+	uint8_t		up_type;	/* points SUBMIT / DONE */
+	uint8_t		up_xfertype;	/* Transfer type */
+	uint32_t	up_flags;	/* Transfer flags */
 #define	USBPF_FLAG_FORCE_SHORT_XFER	(1 << 0)
 #define	USBPF_FLAG_SHORT_XFER_OK	(1 << 1)
 #define	USBPF_FLAG_SHORT_FRAMES_OK	(1 << 2)
@@ -53,7 +53,7 @@ struct usbpf_pkthdr {
 #define	USBPF_FLAG_MANUAL_STATUS	(1 << 6)
 #define	USBPF_FLAG_NO_PIPE_OK		(1 << 7)
 #define	USBPF_FLAG_STALL_PIPE		(1 << 8)
-	u_int32_t	up_status;	/* Transfer status */
+	uint32_t	up_status;	/* Transfer status */
 #define	USBPF_STATUS_OPEN		(1 << 0)
 #define	USBPF_STATUS_TRANSFERRING	(1 << 1)
 #define	USBPF_STATUS_DID_DMA_DELAY	(1 << 2)
@@ -76,12 +76,12 @@ struct usbpf_pkthdr {
 #define	USBPF_STATUS_CURR_DMA_SET	(1 << 17)
 #define	USBPF_STATUS_CAN_CANCEL_IMMED	(1 << 18)
 #define	USBPF_STATUS_DOING_CALLBACK	(1 << 19)
-	u_int32_t	up_length;	/* Total data length (submit/actual) */
-	u_int32_t	up_frames;	/* USB frame number (submit/actual) */
-	u_int32_t	up_error;	/* usb_error_t */
-	u_int32_t	up_interval;	/* for interrupt and isoc */
+	uint32_t	up_length;	/* Total data length (submit/actual) */
+	uint32_t	up_frames;	/* USB frame number (submit/actual) */
+	uint32_t	up_error;	/* usb_error_t */
+	uint32_t	up_interval;	/* for interrupt and isoc */
 	/* sizeof(struct usbpf_pkthdr) == 128 bytes */
-	u_char		up_reserved[96];
+	uint8_t		up_reserved[96];
 };
 
 #define	USBPF_HDR_LEN		128

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 10:28:05 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6603E106566B;
	Tue,  1 Feb 2011 10:28:05 +0000 (UTC) (envelope-from mm@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 54C6F8FC12;
	Tue,  1 Feb 2011 10:28:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p11AS5ja068515;
	Tue, 1 Feb 2011 10:28:05 GMT (envelope-from mm@svn.freebsd.org)
Received: (from mm@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p11AS5og068513;
	Tue, 1 Feb 2011 10:28:05 GMT (envelope-from mm@svn.freebsd.org)
Message-Id: <201102011028.p11AS5og068513@svn.freebsd.org>
From: Martin Matuska 
Date: Tue, 1 Feb 2011 10:28:05 +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: r218166 - head/lib/liblzma
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 10:28:05 -0000

Author: mm
Date: Tue Feb  1 10:28:05 2011
New Revision: 218166
URL: http://svn.freebsd.org/changeset/base/218166

Log:
  Reintroduce bugfix from r210103 and fix xz on strong-aligned architectures.
  This fix was accidentially reverted with the 5.0.0 update in r215187.
  
  PR:		bin/154310
  Submitted by:	Michael Moll 
  MFC after:	3 days

Modified:
  head/lib/liblzma/config.h

Modified: head/lib/liblzma/config.h
==============================================================================
--- head/lib/liblzma/config.h	Tue Feb  1 10:25:48 2011	(r218165)
+++ head/lib/liblzma/config.h	Tue Feb  1 10:28:05 2011	(r218166)
@@ -66,7 +66,6 @@
 #define SIZEOF_SIZE_T 8
 #define STDC_HEADERS 1
 #define TUKLIB_CPUCORES_SYSCTL 1
-#define TUKLIB_FAST_UNALIGNED_ACCESS 1
 #define TUKLIB_PHYSMEM_SYSCONF 1
 #ifndef _ALL_SOURCE
 # define _ALL_SOURCE 1

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 13:32:28 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 60A6F1065674;
	Tue,  1 Feb 2011 13:32:28 +0000 (UTC)
	(envelope-from lstewart@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 348128FC1D;
	Tue,  1 Feb 2011 13:32:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p11DWStY073289;
	Tue, 1 Feb 2011 13:32:28 GMT (envelope-from lstewart@svn.freebsd.org)
Received: (from lstewart@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p11DWSbv073286;
	Tue, 1 Feb 2011 13:32:28 GMT (envelope-from lstewart@svn.freebsd.org)
Message-Id: <201102011332.p11DWSbv073286@svn.freebsd.org>
From: Lawrence Stewart 
Date: Tue, 1 Feb 2011 13:32:28 +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: r218167 - in head/sys/netinet: . cc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 13:32:28 -0000

Author: lstewart
Date: Tue Feb  1 13:32:27 2011
New Revision: 218167
URL: http://svn.freebsd.org/changeset/base/218167

Log:
  Algorithm modules can define their own private congestion signal types in the
  top 8 bits of the 32 bit signal bit field space for internal use. These private
  signals should not be leaked outside of a module.
  
  Given that many algorithm modules use the NewReno hook functions to simplify
  their implementation, the obvious place such a leak would show up is in the
  NewReno cong_signal hook function.
  
  - Show the full number of significant bits in the signal type definitions in
    .
  
  - Add a bitmask to simplify figuring out if a given signal is in the private or
    public bit range.
  
  - Add a sanity check in newreno_cong_signal() to ensure private signals are not
    being leaked into the hook function.
  
  Sponsored by:	FreeBSD Foundation
  Discussed with:	David Hayes 
  MFC after:	1 week
  X-MFC with:	r215166

Modified:
  head/sys/netinet/cc.h
  head/sys/netinet/cc/cc_newreno.c

Modified: head/sys/netinet/cc.h
==============================================================================
--- head/sys/netinet/cc.h	Tue Feb  1 10:28:05 2011	(r218166)
+++ head/sys/netinet/cc.h	Tue Feb  1 13:32:27 2011	(r218167)
@@ -101,10 +101,12 @@ struct cc_var {
  * bits (0x01000000 - 0x80000000) are reserved for CC algos to declare their own
  * congestion signal types.
  */
-#define	CC_ECN		0x000001/* ECN marked packet received. */
-#define	CC_RTO		0x000002/* RTO fired. */
-#define	CC_RTO_ERR	0x000004/* RTO fired in error. */
-#define	CC_NDUPACK	0x000008/* Threshold of dupack's reached. */
+#define	CC_ECN		0x00000001	/* ECN marked packet received. */
+#define	CC_RTO		0x00000002	/* RTO fired. */
+#define	CC_RTO_ERR	0x00000004	/* RTO fired in error. */
+#define	CC_NDUPACK	0x00000008	/* Threshold of dupack's reached. */
+
+#define	CC_SIGPRIVMASK	0xFF000000	/* Mask to check if sig is private. */
 
 /*
  * Structure to hold data and function pointers that together represent a

Modified: head/sys/netinet/cc/cc_newreno.c
==============================================================================
--- head/sys/netinet/cc/cc_newreno.c	Tue Feb  1 10:28:05 2011	(r218166)
+++ head/sys/netinet/cc/cc_newreno.c	Tue Feb  1 13:32:27 2011	(r218167)
@@ -182,6 +182,10 @@ newreno_cong_signal(struct cc_var *ccv, 
 {
 	u_int win;
 
+	/* Catch algos which mistakenly leak private signal types. */
+	KASSERT((type & CC_SIGPRIVMASK) == 0,
+	    ("%s: congestion signal type 0x%08x is private\n", __func__, type));
+
 	win = max(CCV(ccv, snd_cwnd) / 2 / CCV(ccv, t_maxseg), 2) *
 	    CCV(ccv, t_maxseg);
 

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 13:33:49 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 907A0106566B;
	Tue,  1 Feb 2011 13:33:49 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 74AFB8FC13;
	Tue,  1 Feb 2011 13:33:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p11DXnab073369;
	Tue, 1 Feb 2011 13:33:49 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p11DXnJN073367;
	Tue, 1 Feb 2011 13:33:49 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201102011333.p11DXnJN073367@svn.freebsd.org>
From: Konstantin Belousov 
Date: Tue, 1 Feb 2011 13:33: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: r218168 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 13:33:49 -0000

Author: kib
Date: Tue Feb  1 13:33:49 2011
New Revision: 218168
URL: http://svn.freebsd.org/changeset/base/218168

Log:
  The unp_gc() function drops and reaquires lock between scan and
  collect phases.  The unp_discard() function executes
  unp_externalize_fp(), which might make the socket eligible for gc-ing,
  and then, later, taskqueue will close the socket.  Since unp_gc()
  dropped the list lock to do the malloc, close might happen after the
  mark step but before the collection step, causing collection to not
  find the socket and miss one array element.
  
  I believe that the race was there before r216158, but the stated
  revision made the window much wider by postponing the close to
  taskqueue sometimes.
  
  Only process as much array elements as we find the sockets during
  second phase of gc [1].  Take linkage lock and recheck the eligibility
  of the socket for gc, as well as call fhold() under the linkage lock.
  
  Reported and tested by:	jmallett
  Submitted by:   jmallett [1]
  Reviewed by:	rwatson, jeff (possibly)
  MFC after:	1 week

Modified:
  head/sys/kern/uipc_usrreq.c

Modified: head/sys/kern/uipc_usrreq.c
==============================================================================
--- head/sys/kern/uipc_usrreq.c	Tue Feb  1 13:32:27 2011	(r218167)
+++ head/sys/kern/uipc_usrreq.c	Tue Feb  1 13:33:49 2011	(r218168)
@@ -2153,9 +2153,9 @@ unp_gc(__unused void *arg, int pending)
 	struct unp_head *heads[] = { &unp_dhead, &unp_shead, &unp_sphead,
 				    NULL };
 	struct unp_head **head;
-	struct file **unref;
+	struct file *f, **unref;
 	struct unpcb *unp;
-	int i;
+	int i, total;
 
 	unp_taskcount++;
 	UNP_LIST_LOCK();
@@ -2193,33 +2193,37 @@ unp_gc(__unused void *arg, int pending)
 	 * Iterate looking for sockets which have been specifically marked
 	 * as as unreachable and store them locally.
 	 */
+	UNP_LINK_RLOCK();
 	UNP_LIST_LOCK();
-	for (i = 0, head = heads; *head != NULL; head++)
+	for (total = 0, head = heads; *head != NULL; head++)
 		LIST_FOREACH(unp, *head, unp_link)
-			if (unp->unp_gcflag & UNPGC_DEAD) {
-				unref[i++] = unp->unp_file;
-				fhold(unp->unp_file);
-				KASSERT(unp->unp_file != NULL,
-				    ("unp_gc: Invalid unpcb."));
-				KASSERT(i <= unp_unreachable,
+			if ((unp->unp_gcflag & UNPGC_DEAD) != 0) {
+				f = unp->unp_file;
+				if (unp->unp_msgcount == 0 || f == NULL ||
+				    f->f_count != unp->unp_msgcount)
+					continue;
+				unref[total++] = f;
+				fhold(f);
+				KASSERT(total <= unp_unreachable,
 				    ("unp_gc: incorrect unreachable count."));
 			}
 	UNP_LIST_UNLOCK();
+	UNP_LINK_RUNLOCK();
 
 	/*
 	 * Now flush all sockets, free'ing rights.  This will free the
 	 * struct files associated with these sockets but leave each socket
 	 * with one remaining ref.
 	 */
-	for (i = 0; i < unp_unreachable; i++)
+	for (i = 0; i < total; i++)
 		sorflush(unref[i]->f_data);
 
 	/*
 	 * And finally release the sockets so they can be reclaimed.
 	 */
-	for (i = 0; i < unp_unreachable; i++)
+	for (i = 0; i < total; i++)
 		fdrop(unref[i], NULL);
-	unp_recycled += unp_unreachable;
+	unp_recycled += total;
 	free(unref, M_TEMP);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 14:28:51 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1DC8A106564A;
	Tue,  1 Feb 2011 14:28:51 +0000 (UTC) (envelope-from mm@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0C6768FC08;
	Tue,  1 Feb 2011 14:28:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p11ESoTQ074788;
	Tue, 1 Feb 2011 14:28:50 GMT (envelope-from mm@svn.freebsd.org)
Received: (from mm@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p11ESoQw074786;
	Tue, 1 Feb 2011 14:28:50 GMT (envelope-from mm@svn.freebsd.org)
Message-Id: <201102011428.p11ESoQw074786@svn.freebsd.org>
From: Martin Matuska 
Date: Tue, 1 Feb 2011 14:28: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: r218169 - head/sys/cddl/compat/opensolaris/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 14:28:51 -0000

Author: mm
Date: Tue Feb  1 14:28:50 2011
New Revision: 218169
URL: http://svn.freebsd.org/changeset/base/218169

Log:
  For ZFS, change the type of clock_t to int64_t.
  
  The clock_t type in OpenSolaris is long (int64_t on amd64).
  On FreeBSD clock_t is int32_t. The clock_t type is used in several places
  in the ZFS code to store system uptime in milliseconds ("seconds * hz").
  
  With hz=1000 we have a 32-bit integer overflow in 24 days, 20 hours,
  31 minutes and 23.648 seconds. This has a user reported negative impact
  on l2arc_feed_thread() and may cause unexpected results from other functions
  using clock_t.
  
  Reported by:	Artem Belevich  on freebsd-fs@
  MFC after:	1 week

Modified:
  head/sys/cddl/compat/opensolaris/sys/types.h

Modified: head/sys/cddl/compat/opensolaris/sys/types.h
==============================================================================
--- head/sys/cddl/compat/opensolaris/sys/types.h	Tue Feb  1 13:33:49 2011	(r218168)
+++ head/sys/cddl/compat/opensolaris/sys/types.h	Tue Feb  1 14:28:50 2011	(r218169)
@@ -34,6 +34,10 @@
  */
 
 #include 
+
+typedef	int64_t		clock_t;
+#define	_CLOCK_T_DECLARED
+
 #include_next 
 
 #define	MAXNAMELEN	256

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 15:26:30 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9ADF11065693;
	Tue,  1 Feb 2011 15:26:30 +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 8947D8FC0A;
	Tue,  1 Feb 2011 15:26:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p11FQUfv076520;
	Tue, 1 Feb 2011 15:26:30 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p11FQUvA076518;
	Tue, 1 Feb 2011 15:26:30 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201102011526.p11FQUvA076518@svn.freebsd.org>
From: Adrian Chadd 
Date: Tue, 1 Feb 2011 15:26: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: r218170 - head/sys/dev/ath/ath_hal/ar5416
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 15:26:30 -0000

Author: adrian
Date: Tue Feb  1 15:26:30 2011
New Revision: 218170
URL: http://svn.freebsd.org/changeset/base/218170

Log:
  Just to be sure, make sure the MCS rates are allowed for TX.
  
  Approved by:	rpaulo@

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c	Tue Feb  1 14:28:50 2011	(r218169)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c	Tue Feb  1 15:26:30 2011	(r218170)
@@ -149,8 +149,10 @@ ar5416StopTxDma(struct ath_hal *ah, u_in
 #define VALID_TX_RATES \
         ((1<<0x0b)|(1<<0x0f)|(1<<0x0a)|(1<<0x0e)|(1<<0x09)|(1<<0x0d)|\
          (1<<0x08)|(1<<0x0c)|(1<<0x1b)|(1<<0x1a)|(1<<0x1e)|(1<<0x19)|\
-         (1<<0x1d)|(1<<0x18)|(1<<0x1c))
-#define isValidTxRate(_r)       ((1<<(_r)) & VALID_TX_RATES)
+	 (1<<0x1d)|(1<<0x18)|(1<<0x1c)|(1<<0x01)|(1<<0x02)|(1<<0x03)|\
+	 (1<<0x04)|(1<<0x05)|(1<<0x06)|(1<<0x07)|(1<<0x00))
+/* NB: accept HT rates */
+#define	isValidTxRate(_r)	((1<<((_r) & 0x7f)) & VALID_TX_RATES)
 
 HAL_BOOL
 ar5416SetupTxDesc(struct ath_hal *ah, struct ath_desc *ds,

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 15:48:27 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B60C81065672;
	Tue,  1 Feb 2011 15:48:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A51F78FC0C;
	Tue,  1 Feb 2011 15:48:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p11FmRsD077063;
	Tue, 1 Feb 2011 15:48:27 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p11FmRpN077061;
	Tue, 1 Feb 2011 15:48:27 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201102011548.p11FmRpN077061@svn.freebsd.org>
From: John Baldwin 
Date: Tue, 1 Feb 2011 15:48: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: r218171 - head/contrib/top
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 15:48:27 -0000

Author: jhb
Date: Tue Feb  1 15:48:27 2011
New Revision: 218171
URL: http://svn.freebsd.org/changeset/base/218171

Log:
  Output an appropriate amount of padding to line up per-CPU state columns
  rather than using a terminal sequence to move the cursor when drawing the
  initial screen.
  
  Requested by:	arundel
  MFC after:	3 days

Modified:
  head/contrib/top/display.c

Modified: head/contrib/top/display.c
==============================================================================
--- head/contrib/top/display.c	Tue Feb  1 15:26:30 2011	(r218170)
+++ head/contrib/top/display.c	Tue Feb  1 15:48:27 2011	(r218171)
@@ -447,12 +447,14 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
     /* print tag and bump lastline */
     if (num_cpus == 1)
 	printf("\nCPU: ");
-    else
-	printf("\nCPU %d: ", cpu);
+    else {
+	value = printf("\nCPU %d: ", cpu);
+	while (value++ <= cpustates_column)
+		printf(" ");
+    }
     lastline++;
 
     /* now walk thru the names and print the line */
-    Move_to(cpustates_column, y_cpustates + cpu);
     while ((thisname = *names++) != NULL)
     {
 	if (*thisname != '\0')
@@ -532,7 +534,7 @@ z_cpustates()
     register char **names;
     register char *thisname;
     register int *lp;
-    int cpu;
+    int cpu, value;
 
 for (cpu = 0; cpu < num_cpus; cpu++) {
     names = cpustate_names;
@@ -540,11 +542,13 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
     /* show tag and bump lastline */
     if (num_cpus == 1)
 	printf("\nCPU: ");
-    else
-	printf("\nCPU %d: ", cpu);
+    else {
+	value = printf("\nCPU %d: ", cpu);
+	while (value++ <= cpustates_column)
+		printf(" ");
+    }
     lastline++;
 
-    Move_to(cpustates_column, y_cpustates + cpu);
     while ((thisname = *names++) != NULL)
     {
 	if (*thisname != '\0')

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 16:41:27 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: by hub.freebsd.org (Postfix, from userid 1233)
	id 3F8021065694; Tue,  1 Feb 2011 16:41:27 +0000 (UTC)
Date: Tue, 1 Feb 2011 16:41:27 +0000
From: Alexander Best 
To: John Baldwin 
Message-ID: <20110201164127.GA44442@freebsd.org>
References: <201102011548.p11FmRpN077061@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201102011548.p11FmRpN077061@svn.freebsd.org>
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218171 - head/contrib/top
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 16:41:27 -0000

On Tue Feb  1 11, John Baldwin wrote:
> Author: jhb
> Date: Tue Feb  1 15:48:27 2011
> New Revision: 218171
> URL: http://svn.freebsd.org/changeset/base/218171
> 
> Log:
>   Output an appropriate amount of padding to line up per-CPU state columns
>   rather than using a terminal sequence to move the cursor when drawing the
>   initial screen.

thanks. :)

>   
>   Requested by:	arundel
>   MFC after:	3 days
> 
> Modified:
>   head/contrib/top/display.c
> 
> Modified: head/contrib/top/display.c
> ==============================================================================
> --- head/contrib/top/display.c	Tue Feb  1 15:26:30 2011	(r218170)
> +++ head/contrib/top/display.c	Tue Feb  1 15:48:27 2011	(r218171)
> @@ -447,12 +447,14 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
>      /* print tag and bump lastline */
>      if (num_cpus == 1)
>  	printf("\nCPU: ");
> -    else
> -	printf("\nCPU %d: ", cpu);
> +    else {
> +	value = printf("\nCPU %d: ", cpu);
> +	while (value++ <= cpustates_column)
> +		printf(" ");
> +    }
>      lastline++;
>  
>      /* now walk thru the names and print the line */
> -    Move_to(cpustates_column, y_cpustates + cpu);
>      while ((thisname = *names++) != NULL)
>      {
>  	if (*thisname != '\0')
> @@ -532,7 +534,7 @@ z_cpustates()
>      register char **names;
>      register char *thisname;
>      register int *lp;
> -    int cpu;
> +    int cpu, value;
>  
>  for (cpu = 0; cpu < num_cpus; cpu++) {
>      names = cpustate_names;
> @@ -540,11 +542,13 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
>      /* show tag and bump lastline */
>      if (num_cpus == 1)
>  	printf("\nCPU: ");
> -    else
> -	printf("\nCPU %d: ", cpu);
> +    else {
> +	value = printf("\nCPU %d: ", cpu);
> +	while (value++ <= cpustates_column)
> +		printf(" ");
> +    }
>      lastline++;
>  
> -    Move_to(cpustates_column, y_cpustates + cpu);
>      while ((thisname = *names++) != NULL)
>      {
>  	if (*thisname != '\0')

-- 
a13x

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 18:21:45 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C6F9F1065673;
	Tue,  1 Feb 2011 18:21:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B574D8FC08;
	Tue,  1 Feb 2011 18:21:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p11ILjSx080920;
	Tue, 1 Feb 2011 18:21:45 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p11ILjda080918;
	Tue, 1 Feb 2011 18:21:45 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201102011821.p11ILjda080918@svn.freebsd.org>
From: John Baldwin 
Date: Tue, 1 Feb 2011 18:21:45 +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: r218175 - head/sys/fs/ext2fs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 18:21:46 -0000

Author: jhb
Date: Tue Feb  1 18:21:45 2011
New Revision: 218175
URL: http://svn.freebsd.org/changeset/base/218175

Log:
  - Set the next_alloc fields for an i-node after allocating a new block
    so that future allocations start with most recently allocated block
    rather than the beginning of the filesystem.
  - Fix ext2_alloccg() to properly scan for 8 block chunks that are not
    aligned on 8-bit boundaries.  Previously this was causing new blocks
    to be allocated in a highly fragmented fashion (block 0 of a file at
    lbn N, block 1 at lbn N + 8, block 2 at lbn N + 16, etc.).
  - Cosmetic tweaks to the currently-disabled fancy realloc sysctls.
  
  PR:		kern/153584
  Discussed with:	bde
  Tested by:	Pedro F. Giffuni  giffunip at yahoo, Zheng Liu (lz)

Modified:
  head/sys/fs/ext2fs/ext2_alloc.c

Modified: head/sys/fs/ext2fs/ext2_alloc.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_alloc.c	Tue Feb  1 17:42:57 2011	(r218174)
+++ head/sys/fs/ext2fs/ext2_alloc.c	Tue Feb  1 18:21:45 2011	(r218175)
@@ -59,6 +59,10 @@ static u_long	ext2_hashalloc(struct inod
 						int));
 static daddr_t	ext2_nodealloccg(struct inode *, int, daddr_t, int);
 static daddr_t  ext2_mapsearch(struct m_ext2fs *, char *, daddr_t);
+#ifdef FANCY_REALLOC
+static int	ext2_reallocblks(struct vop_reallocblks_args *);
+#endif
+
 /*
  * Allocate a block in the file system.
  *
@@ -108,13 +112,17 @@ ext2_alloc(ip, lbn, bpref, size, cred, b
 		goto nospace;
 	if (bpref >= fs->e2fs->e2fs_bcount)
 		bpref = 0;
-	 if (bpref == 0)
+	if (bpref == 0)
                 cg = ino_to_cg(fs, ip->i_number);
         else
                 cg = dtog(fs, bpref);
         bno = (daddr_t)ext2_hashalloc(ip, cg, bpref, fs->e2fs_bsize,
                                                  ext2_alloccg);
         if (bno > 0) {
+		/* set next_alloc fields as done in block_getblk */
+		ip->i_next_alloc_block = lbn;
+		ip->i_next_alloc_goal = bno;
+
                 ip->i_blocks += btodb(fs->e2fs_bsize);
                 ip->i_flag |= IN_CHANGE | IN_UPDATE;
                 *bnp = bno;
@@ -143,13 +151,14 @@ nospace:
  */
 
 #ifdef FANCY_REALLOC
-#include 
+SYSCTL_NODE(_vfs, OID_AUTO, ext2fs, CTLFLAG_RW, 0, "EXT2FS filesystem");
+
 static int doasyncfree = 1;
-static int doreallocblks = 1;
+SYSCTL_INT(_vfs_ext2fs, OID_AUTO, doasyncfree, CTLFLAG_RW, &doasyncfree, 0,
+    "Use asychronous writes to update block pointers when freeing blocks");
 
-#ifdef	OPT_DEBUG
-SYSCTL_INT(_debug, 14, doasyncfree, CTLFLAG_RW, &doasyncfree, 0, "");
-#endif	/* OPT_DEBUG */
+static int doreallocblks = 1;
+SYSCTL_INT(_vfs_ext2fs, OID_AUTO, doreallocblks, CTLFLAG_RW, &doreallocblks, 0, "");
 #endif
 
 int
@@ -624,7 +633,8 @@ ext2_alloccg(struct inode *ip, int cg, d
 	struct m_ext2fs *fs;
 	struct buf *bp;
 	struct ext2mount *ump;
-	int error, bno, start, end, loc;
+	daddr_t bno, runstart, runlen;
+	int bit, loc, end, error, start;
 	char *bbp;
 	/* XXX ondisk32 */
 	fs = ip->i_e2fs;
@@ -665,18 +675,52 @@ ext2_alloccg(struct inode *ip, int cg, d
 	else
 		start = 0;
 	end = howmany(fs->e2fs->e2fs_fpg, NBBY) - start;
+retry:
+	runlen = 0;
+	runstart = 0;
 	for (loc = start; loc < end; loc++) {
-		if (bbp[loc] == 0) {
-			bno = loc * NBBY;
-			goto gotit;
+		if (bbp[loc] == (char)0xff) {
+			runlen = 0;
+			continue;
 		}
-	}
-	for (loc = 0; loc < start; loc++) {
-		if (bbp[loc] == 0) {
-			bno = loc * NBBY;
+
+		/* Start of a run, find the number of high clear bits. */
+		if (runlen == 0) {
+			bit = fls(bbp[loc]);
+			runlen = NBBY - bit;
+			runstart = loc * NBBY + bit;
+		} else if (bbp[loc] == 0) {
+			/* Continue a run. */
+			runlen += NBBY;
+		} else {
+			/*
+			 * Finish the current run.  If it isn't long
+			 * enough, start a new one.
+			 */
+			bit = ffs(bbp[loc]) - 1;
+			runlen += bit;
+			if (runlen >= 8) {
+				bno = runstart;
+				goto gotit;
+			}
+
+			/* Run was too short, start a new one. */
+			bit = fls(bbp[loc]);
+			runlen = NBBY - bit;
+			runstart = loc * NBBY + bit;
+		}
+
+		/* If the current run is long enough, use it. */
+		if (runlen >= 8) {
+			bno = runstart;
 			goto gotit;
 		}
 	}
+	if (start != 0) {
+		end = start;
+		start = 0;
+		goto retry;
+	}
 
 	bno = ext2_mapsearch(fs, bbp, bpref);
 	if (bno < 0){

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 18:30:53 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 67C801065670;
	Tue,  1 Feb 2011 18:30:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3C2E58FC0C;
	Tue,  1 Feb 2011 18:30:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p11IUrrZ081229;
	Tue, 1 Feb 2011 18:30:53 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p11IUrqY081225;
	Tue, 1 Feb 2011 18:30:53 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201102011830.p11IUrqY081225@svn.freebsd.org>
From: John Baldwin 
Date: Tue, 1 Feb 2011 18:30: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: r218176 - head/sys/fs/ext2fs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 18:30:53 -0000

Author: jhb
Date: Tue Feb  1 18:30:52 2011
New Revision: 218176
URL: http://svn.freebsd.org/changeset/base/218176

Log:
  Some cosmetic fixes and remove a duplicate constant.
  
  Submitted by:	Pedro F. Giffuni  giffunip at yahoo

Modified:
  head/sys/fs/ext2fs/ext2_mount.h
  head/sys/fs/ext2fs/ext2_vfsops.c
  head/sys/fs/ext2fs/ext2fs.h

Modified: head/sys/fs/ext2fs/ext2_mount.h
==============================================================================
--- head/sys/fs/ext2fs/ext2_mount.h	Tue Feb  1 18:21:45 2011	(r218175)
+++ head/sys/fs/ext2fs/ext2_mount.h	Tue Feb  1 18:30:52 2011	(r218176)
@@ -76,4 +76,4 @@ struct ext2mount {
 #define	is_sequential(ump, a, b)	((b) == (a) + ump->um_seqinc)
 #endif /* _KERNEL */
 
-#endif
+#endif	/* !_FS_EXT2FS_EXT2_MOUNT_H_ */

Modified: head/sys/fs/ext2fs/ext2_vfsops.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_vfsops.c	Tue Feb  1 18:21:45 2011	(r218175)
+++ head/sys/fs/ext2fs/ext2_vfsops.c	Tue Feb  1 18:30:52 2011	(r218176)
@@ -59,8 +59,9 @@
 #include 
 
 #include 
-#include 
 #include 
+#include 
+#include 
 
 static int	ext2_flushfiles(struct mount *mp, int flags, struct thread *td);
 static int	ext2_mountfs(struct vnode *, struct mount *);
@@ -329,7 +330,7 @@ compute_sb_data(struct vnode *devvp, str
 	fs->e2fs_fpg = es->e2fs_fpg;
 	fs->e2fs_ipg = es->e2fs_ipg;
 	if (es->e2fs_rev == E2FS_REV0) {
-		fs->e2fs_first_inode = E2FS_REV0_FIRST_INO;
+		fs->e2fs_first_inode = EXT2_FIRSTINO;
 		fs->e2fs_isize = E2FS_REV0_INODE_SIZE ;
 	} else {
 		fs->e2fs_first_inode = es->e2fs_first_ino;

Modified: head/sys/fs/ext2fs/ext2fs.h
==============================================================================
--- head/sys/fs/ext2fs/ext2fs.h	Tue Feb  1 18:21:45 2011	(r218175)
+++ head/sys/fs/ext2fs/ext2fs.h	Tue Feb  1 18:30:52 2011	(r218176)
@@ -34,8 +34,8 @@
  * 
  */
 
-#ifndef _FS_EXT2FS_EXT2_FS_H
-#define _FS_EXT2FS_EXT2_FS_H
+#ifndef _FS_EXT2FS_EXT2_FS_H_
+#define _FS_EXT2FS_EXT2_FS_H_
 
 #include 
 
@@ -118,7 +118,6 @@ struct ext2fs {
 	u_int32_t  reserved2[204];
 };
 
-
 /* Assume that user mode programs are passing in an ext2fs superblock, not
  * a kernel struct super_block.  This will allow us to call the feature-test
  * macros from user land. */
@@ -166,9 +165,6 @@ struct m_ext2fs {
 #define E2FS_DATE		"95/08/09"
 #define E2FS_VERSION		"0.5b"
 
-/* First non-reserved inode for old ext2 filesystems */
-#define E2FS_REV0_FIRST_INO	11
-
 /*
  * The second extended file system magic number
  */
@@ -319,4 +315,4 @@ struct ext2_gd {
 
 #endif
 
-#endif	/* !_FS_EXT2FS_EXT2FS_H */
+#endif	/* !_FS_EXT2FS_EXT2FS_H_ */

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 18:40:34 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 17F2A106566C;
	Tue,  1 Feb 2011 18:40:34 +0000 (UTC)
	(envelope-from swell.k@gmail.com)
Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com
	[209.85.161.54])
	by mx1.freebsd.org (Postfix) with ESMTP id E13BD8FC1C;
	Tue,  1 Feb 2011 18:40:32 +0000 (UTC)
Received: by fxm16 with SMTP id 16so7374433fxm.13
	for ; Tue, 01 Feb 2011 10:40:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:from:to:cc:subject:references:date:message-id
	:user-agent:mime-version:content-type;
	bh=jwtGG8YWgOUOkWCDyrgR2zk4t3AkDat+v4IdQGjC4jI=;
	b=p0Y1Ddsn6kapBISCGjxr/QJqiGDTOBy0A7/n8ST3XzN53RYkC+lBq1Zz9+8vUyUPZK
	wv86n+9QAsms4pcyI9TjCzC5w3nd3PZAKmdCcz1gp2QbdaZlvZjTysTd4kcXBZLLJ0+D
	whZ1C4WZEdN4geW5qSoWO4FCALQIg2RzDT7u4=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=from:to:cc:subject:references:date:message-id:user-agent
	:mime-version:content-type;
	b=F4cTzTS1AUF53anL/6Rwwz2zhKWbH77J0mRZOljdhd3kMjRM5oJM0w65ayY9OQDO3e
	jb7Xr8jJboa6qKynhpKrQd5noCf/cvjfLWuBzzndUDSmUnxBoYKOIKkgtTyk2/O4d8xI
	lNVhuNX8H8cXBaKU+f3/OlCk1MI4TvOhigo/s=
Received: by 10.223.69.141 with SMTP id z13mr7842489fai.9.1296585631415;
	Tue, 01 Feb 2011 10:40:31 -0800 (PST)
Received: from localhost (tor-exit-router41-readme.formlessnetworking.net
	[199.48.147.41])
	by mx.google.com with ESMTPS id y1sm8009027fak.39.2011.02.01.10.40.28
	(version=SSLv3 cipher=RC4-MD5); Tue, 01 Feb 2011 10:40:30 -0800 (PST)
From: Anonymous 
To: Edward Tomasz Napierala 
References: <201101191711.p0JHBqCS083253__17104.8711440109$1295457129$gmane$org@svn.freebsd.org>
Date: Tue, 01 Feb 2011 21:40:08 +0300
Message-ID: <86r5brppiv.fsf@gmail.com>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix)
MIME-Version: 1.0
Content-Type: text/plain
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r217588 -
	head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 18:40:34 -0000

Edward Tomasz Napierala  writes:

> Author: trasz
> Date: Wed Jan 19 17:11:52 2011
> New Revision: 217588
> URL: http://svn.freebsd.org/changeset/base/217588
>
> Log:
>   Add MNT_NFS4ACLS to ZFS mount flags.  It's not conditional, since there
>   is no way to disable NFSv4 ACLs in ZFS.  This should make it easier
>   for the NFS server to figure out whether the exported filesystem supports
>   ACLs or not.

Does it work with MNT_UPDATE? I guess rc.d/root resets "nfsv4acls" on
root mount

  $ mount
  tank on / (zfs, local, nfsv4acls)
  $ mount -uw /
  $ mount
  tank on / (zfs, local)

It's on ZFS v28, I can't test on v15 atm.

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 19:04:22 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4578D1065674;
	Tue,  1 Feb 2011 19:04:22 +0000 (UTC)
	(envelope-from yanegomi@gmail.com)
Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50])
	by mx1.freebsd.org (Postfix) with ESMTP id 80C928FC15;
	Tue,  1 Feb 2011 19:04:20 +0000 (UTC)
Received: by wwf26 with SMTP id 26so7108704wwf.31
	for ; Tue, 01 Feb 2011 11:04:20 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type;
	bh=y3p0BceBzKQU4gZAXsqtgzZF8eWPZrcnIoWettELRQo=;
	b=P6QT0q30azBvuO5d1u/+/qboCTCAfFSlQtefXnScou1a+30p0fdr/XuChmVNsj8MDf
	xtGC4Rk/a0vxli3Pq+9k//at/P5FN4D6XPR6nB/fy2HXOYvap/6As9dlkEKe1/C8zK1N
	ouUtRHSPwC1u+ESoTdfFaQA+HEfcHmzDjIJYE=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type;
	b=ZPlxa1oOhSWCWwShUxjJV8O2TN/wXyj4ieZmgh+pM3bsIVKZX83/688TzvZ1xRu2iD
	zHsGqCfi/xrP7wSxKNwNy362B1OzeNvCMJwVLX+htaXU8EOPtEfBk6BggG7+XKcYUXid
	J8VtHjgapJKgEdq78O5WECg93WWKfIf6+LKOM=
MIME-Version: 1.0
Received: by 10.216.51.130 with SMTP id b2mr7874922wec.42.1296587059428; Tue,
	01 Feb 2011 11:04:19 -0800 (PST)
Sender: yanegomi@gmail.com
Received: by 10.216.71.200 with HTTP; Tue, 1 Feb 2011 11:04:19 -0800 (PST)
In-Reply-To: <201102011428.p11ESoQw074786@svn.freebsd.org>
References: <201102011428.p11ESoQw074786@svn.freebsd.org>
Date: Tue, 1 Feb 2011 11:04:19 -0800
X-Google-Sender-Auth: LvdYIAz-kkgeZLNVn9f1aNKSAJA
Message-ID: 
From: Garrett Cooper 
To: Martin Matuska 
Content-Type: text/plain; charset=ISO-8859-1
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218169 - head/sys/cddl/compat/opensolaris/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 19:04:22 -0000

On Tue, Feb 1, 2011 at 6:28 AM, Martin Matuska  wrote:
> Author: mm
> Date: Tue Feb  1 14:28:50 2011
> New Revision: 218169
> URL: http://svn.freebsd.org/changeset/base/218169
>
> Log:
>  For ZFS, change the type of clock_t to int64_t.
>
>  The clock_t type in OpenSolaris is long (int64_t on amd64).
>  On FreeBSD clock_t is int32_t. The clock_t type is used in several places
>  in the ZFS code to store system uptime in milliseconds ("seconds * hz").
>
>  With hz=1000 we have a 32-bit integer overflow in 24 days, 20 hours,
>  31 minutes and 23.648 seconds. This has a user reported negative impact
>  on l2arc_feed_thread() and may cause unexpected results from other functions
>  using clock_t.

    This change broke the build. This header is also nasty because it
doesn't conform to POSIX. Here's what I did to resolve the POSIX API
issues at least:

    http://p4db.freebsd.org/fileViewer.cgi?FSPC=//depot/user/gcooper/posix-conformance-work/sys/cddl/compat/opensolaris/sys/time.h&REV=3

    If you're going to redefine clock_t though, please define
_CLOCK_T_DECLARED, but note that this will cause issues with ABI
conformance across the board as FreeBSD defines it as one thing and
Solaris defines it as another (so there might be some issues where
FreeBSD and the opensolaris compat crossover).

    clock_t should be bumped to 64-bit on FreeBSD though IMO (based on
the issues encountered and the utility in functions like clock(3)),
but it might have some trickledown impact as filesystem datastructures
(for instance) won't change size as they're on-disk structures (as I
discovered several weeks ago when I proposed that the chflags syscalls
be made consistent on FreeBSD :/...).

Thanks!
-Garrett

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 20:44:32 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7ACA01065698;
	Tue,  1 Feb 2011 20:44:32 +0000 (UTC)
	(envelope-from sgk@troutmask.apl.washington.edu)
Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu
	[128.95.76.21])
	by mx1.freebsd.org (Postfix) with ESMTP id 5B3968FC26;
	Tue,  1 Feb 2011 20:44:32 +0000 (UTC)
Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu
	[127.0.0.1])
	by troutmask.apl.washington.edu (8.14.4/8.14.4) with ESMTP id
	p11KiW0U015516; Tue, 1 Feb 2011 12:44:32 -0800 (PST)
	(envelope-from sgk@troutmask.apl.washington.edu)
Received: (from sgk@localhost)
	by troutmask.apl.washington.edu (8.14.4/8.14.4/Submit) id
	p11KiWn0015515; Tue, 1 Feb 2011 12:44:32 -0800 (PST)
	(envelope-from sgk)
Date: Tue, 1 Feb 2011 12:44:32 -0800
From: Steve Kargl 
To: Martin Matuska 
Message-ID: <20110201204432.GA15470@troutmask.apl.washington.edu>
References: <201102011428.p11ESoQw074786@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201102011428.p11ESoQw074786@svn.freebsd.org>
User-Agent: Mutt/1.4.2.3i
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218169 - head/sys/cddl/compat/opensolaris/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 20:44:32 -0000

On Tue, Feb 01, 2011 at 02:28:50PM +0000, Martin Matuska wrote:
> Author: mm
> Date: Tue Feb  1 14:28:50 2011
> New Revision: 218169
> URL: http://svn.freebsd.org/changeset/base/218169
> 
> Log:
>   For ZFS, change the type of clock_t to int64_t.
>   
>   The clock_t type in OpenSolaris is long (int64_t on amd64).
>   On FreeBSD clock_t is int32_t. The clock_t type is used in several places
>   in the ZFS code to store system uptime in milliseconds ("seconds * hz").
>   
>   With hz=1000 we have a 32-bit integer overflow in 24 days, 20 hours,
>   31 minutes and 23.648 seconds. This has a user reported negative impact
>   on l2arc_feed_thread() and may cause unexpected results from other functions
>   using clock_t.
>   
>   Reported by:	Artem Belevich  on freebsd-fs@
>   MFC after:	1 week
> 

Please, revert!

Tinderboxen are spamming my inbox.

PS: Please test your patches before committing.  Thanks.

-- 
Steve

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 21:15:35 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 94CA31065674;
	Tue,  1 Feb 2011 21:15:35 +0000 (UTC) (envelope-from kan@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 832FD8FC14;
	Tue,  1 Feb 2011 21:15:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p11LFZas085456;
	Tue, 1 Feb 2011 21:15:35 GMT (envelope-from kan@svn.freebsd.org)
Received: (from kan@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p11LFZQh085454;
	Tue, 1 Feb 2011 21:15:35 GMT (envelope-from kan@svn.freebsd.org)
Message-Id: <201102012115.p11LFZQh085454@svn.freebsd.org>
From: Alexander Kabaev 
Date: Tue, 1 Feb 2011 21:15:35 +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: r218177 - head/sys/cddl/compat/opensolaris/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 21:15:35 -0000

Author: kan
Date: Tue Feb  1 21:15:35 2011
New Revision: 218177
URL: http://svn.freebsd.org/changeset/base/218177

Log:
  Revert r218169 until it can be tested and fixed properly.

Modified:
  head/sys/cddl/compat/opensolaris/sys/types.h

Modified: head/sys/cddl/compat/opensolaris/sys/types.h
==============================================================================
--- head/sys/cddl/compat/opensolaris/sys/types.h	Tue Feb  1 18:30:52 2011	(r218176)
+++ head/sys/cddl/compat/opensolaris/sys/types.h	Tue Feb  1 21:15:35 2011	(r218177)
@@ -34,10 +34,6 @@
  */
 
 #include 
-
-typedef	int64_t		clock_t;
-#define	_CLOCK_T_DECLARED
-
 #include_next 
 
 #define	MAXNAMELEN	256

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 21:28:45 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7202B106566B;
	Tue,  1 Feb 2011 21:28:45 +0000 (UTC)
	(envelope-from yanegomi@gmail.com)
Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50])
	by mx1.freebsd.org (Postfix) with ESMTP id 83A348FC0A;
	Tue,  1 Feb 2011 21:28:44 +0000 (UTC)
Received: by wwf26 with SMTP id 26so7255576wwf.31
	for ; Tue, 01 Feb 2011 13:28:43 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=C1wxwYLYJ/FpUiR3Noko41yKIn0zmHUrZYxolmTM7gs=;
	b=ILOeOJxdlasDxviQbNknHpuOI1URqnmbReekpgwA6jVoLtm2Z6NlKUcoPV0tfoc71X
	9/8IXQiMcGJU9gKj+O3SGi2Yv2JZ7d50O/m7hz0ef+s4PSzjOoR3uTBjMr4/nGf72EMI
	qqL2CsCyAr5S1FWJcH1uXAfjiDn2qZI8elKvw=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	b=Dl3vlug02jDlFF0toalNW78eFsSMNuxHEBtRVcI5KYgEw6DUpCoQLRDrWE+T672D3K
	GLzxS38g3h8yJhWrxVOVZOLb8z3TbBExpyhgL6Ejogmu85Kp/X/Sv0fpxrLYj4sypawo
	SC8NAOOms+DoPO+y1cbf3ZhSOjjBUKoGAgUK0=
MIME-Version: 1.0
Received: by 10.216.220.219 with SMTP id o69mr7874975wep.57.1296595723276;
	Tue, 01 Feb 2011 13:28:43 -0800 (PST)
Sender: yanegomi@gmail.com
Received: by 10.216.71.200 with HTTP; Tue, 1 Feb 2011 13:28:43 -0800 (PST)
In-Reply-To: <201102012115.p11LFZQh085454@svn.freebsd.org>
References: <201102012115.p11LFZQh085454@svn.freebsd.org>
Date: Tue, 1 Feb 2011 13:28:43 -0800
X-Google-Sender-Auth: -4v4XELeeA2duwB04V65fJF5qKQ
Message-ID: 
From: Garrett Cooper 
To: Alexander Kabaev 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218177 - head/sys/cddl/compat/opensolaris/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 21:28:45 -0000

On Tue, Feb 1, 2011 at 1:15 PM, Alexander Kabaev  wrote:
> Author: kan
> Date: Tue Feb =A01 21:15:35 2011
> New Revision: 218177
> URL: http://svn.freebsd.org/changeset/base/218177
>
> Log:
> =A0Revert r218169 until it can be tested and fixed properly.

Thanks!
-Garrett

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 22:02:45 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 56CDD1065672;
	Tue,  1 Feb 2011 22:02:45 +0000 (UTC)
	(envelope-from kabaev@gmail.com)
Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com
	[209.85.216.182])
	by mx1.freebsd.org (Postfix) with ESMTP id D2C208FC12;
	Tue,  1 Feb 2011 22:02:44 +0000 (UTC)
Received: by qyk36 with SMTP id 36so7015491qyk.13
	for ; Tue, 01 Feb 2011 14:02:44 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:date:from:to:cc:subject:message-id:in-reply-to
	:references:x-mailer:mime-version:content-type;
	bh=LPQSMCZn3T2hOTsoNaFeK/qcQYKJPX9av6YfktgPaEE=;
	b=A/JNDBnOsmIRAvFCc1cJdmwtx/qdVAyknwYQefhIfesUjeTfbVRDLngp6uhuvGlhOL
	e9lpY+P3INCWfEM7Cpf0Emr7/1sjdCe+yGcBTk0Uluot8k/hSNwPsfDCIQi0NgX6dkug
	x1kR1P6rSoODiK/CVSW9z0fYQ9MzP41S8QWQY=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer
	:mime-version:content-type;
	b=G+FhshxrqqA6+dTEEFyxnC9zBrLD/hxtETJnJ2X1eSuVVf+v3t0oPPdxYEplHD6SLh
	kI6bfNg7EhMKLPm11rloXxWA26wJZV4uIiC+DAVmaTIb3fuI5JhxMi4nZEvB6cbtqhh5
	78MPXwNISsyBI6Kkns/SLLpkvg5VSqv+kK06M=
Received: by 10.224.63.218 with SMTP id c26mr8221511qai.24.1296596334590;
	Tue, 01 Feb 2011 13:38:54 -0800 (PST)
Received: from kan.dnsalias.net (c-24-63-226-98.hsd1.ma.comcast.net
	[24.63.226.98])
	by mx.google.com with ESMTPS id t7sm15971697qcs.28.2011.02.01.13.38.51
	(version=SSLv3 cipher=RC4-MD5); Tue, 01 Feb 2011 13:38:51 -0800 (PST)
Date: Tue, 1 Feb 2011 16:38:44 -0500
From: Alexander Kabaev 
To: src-committers@freebsd.org
Message-ID: <20110201163844.0c585be4@kan.dnsalias.net>
In-Reply-To: 
References: <201102012115.p11LFZQh085454@svn.freebsd.org>
	
X-Mailer: Claws Mail 3.7.8 (GTK+ 2.22.1; amd64-portbld-freebsd9.0)
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=PGP-SHA1;
	boundary="Sig_/ItFC/gBQvUmLFgx2GkRqzzN";
	protocol="application/pgp-signature"
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org
Subject: Re: svn commit: r218177 - head/sys/cddl/compat/opensolaris/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 22:02:45 -0000

--Sig_/ItFC/gBQvUmLFgx2GkRqzzN
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

On Tue, 1 Feb 2011 13:28:43 -0800
Garrett Cooper  wrote:

> On Tue, Feb 1, 2011 at 1:15 PM, Alexander Kabaev 
> wrote:
> > Author: kan
> > Date: Tue Feb =9A1 21:15:35 2011
> > New Revision: 218177
> > URL: http://svn.freebsd.org/changeset/base/218177
> >
> > Log:
> > =9ARevert r218169 until it can be tested and fixed properly.
>=20
> Thanks!
> -Garrett

The real fix from Martin will follow shortly.

--=20
Alexander Kabaev

--Sig_/ItFC/gBQvUmLFgx2GkRqzzN
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)

iD8DBQFNSH1qQ6z1jMm+XZYRAmKkAJ9DIeXDL0KUJwy/E+CO5WNA82AflgCfQ6nv
1xW21Hp6cO0vV3vJXHaDAsA=
=OGVp
-----END PGP SIGNATURE-----

--Sig_/ItFC/gBQvUmLFgx2GkRqzzN--

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 22:10:46 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BB04C1065A13;
	Tue,  1 Feb 2011 22:10:46 +0000 (UTC)
	(envelope-from sgk@troutmask.apl.washington.edu)
Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu
	[128.95.76.21])
	by mx1.freebsd.org (Postfix) with ESMTP id 9A3F28FC18;
	Tue,  1 Feb 2011 22:10:46 +0000 (UTC)
Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu
	[127.0.0.1])
	by troutmask.apl.washington.edu (8.14.4/8.14.4) with ESMTP id
	p11MAkkV016625; Tue, 1 Feb 2011 14:10:46 -0800 (PST)
	(envelope-from sgk@troutmask.apl.washington.edu)
Received: (from sgk@localhost)
	by troutmask.apl.washington.edu (8.14.4/8.14.4/Submit) id
	p11MAkTu016624; Tue, 1 Feb 2011 14:10:46 -0800 (PST)
	(envelope-from sgk)
Date: Tue, 1 Feb 2011 14:10:46 -0800
From: Steve Kargl 
To: Alexander Kabaev 
Message-ID: <20110201221046.GA16607@troutmask.apl.washington.edu>
References: <201102012115.p11LFZQh085454@svn.freebsd.org>
	
	<20110201163844.0c585be4@kan.dnsalias.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20110201163844.0c585be4@kan.dnsalias.net>
User-Agent: Mutt/1.4.2.3i
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218177 - head/sys/cddl/compat/opensolaris/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 22:10:46 -0000

On Tue, Feb 01, 2011 at 04:38:44PM -0500, Alexander Kabaev wrote:
> On Tue, 1 Feb 2011 13:28:43 -0800
> Garrett Cooper  wrote:
> 
> > On Tue, Feb 1, 2011 at 1:15 PM, Alexander Kabaev 
> > wrote:
> > > Author: kan
> > > Date: Tue Feb ?1 21:15:35 2011
> > > New Revision: 218177
> > > URL: http://svn.freebsd.org/changeset/base/218177
> > >
> > > Log:
> > > ?Revert r218169 until it can be tested and fixed properly.
> > 
> > Thanks!
> > -Garrett
> 
> The real fix from Martin will follow shortly.
> 

Will Martin test his real fix prior to committing?

-- 
Steve

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 22:17:08 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 59EF71065672;
	Tue,  1 Feb 2011 22:17:08 +0000 (UTC)
	(envelope-from yanegomi@gmail.com)
Received: from mail-ww0-f42.google.com (mail-ww0-f42.google.com [74.125.82.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 936E48FC2D;
	Tue,  1 Feb 2011 22:17:07 +0000 (UTC)
Received: by wwi17 with SMTP id 17so5324267wwi.1
	for ; Tue, 01 Feb 2011 14:17:06 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=jtgLOkIPyIIvsQAqSr1ehAiGDgxM3ROg7XOA+7g3kg4=;
	b=HGiDuFVK7L5b5oXt1YkkJ1J/KRGmRKhk+C0KRZ08DPCs/fJpxz1/s++b54I0rI0Kv2
	zurz04KyVOgx49fcb/ekAVPrffaP0f6uyi1HYXKcJ605yP8QPf41vV3I9MpGWwg6UR+e
	EYv09EvoEDbUKNTDBjdDMtl0JpfQ/RqTkG/iY=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	b=mCiozMhWZTVUquJxQ6sIhUkY7Yj0pQ8GVCwO74pKvF4vSuvHLQb0TXToccQCZY12IY
	w+F36l5MOX+ePgXJwV1xfHN0mEFFja+HTi3ZIzsfsObbmqIvv+MAiZ64/L6Lzaxxk2Jl
	NOt2PLPH0OAUdjez5sjlJ2aSc2o2wPsvbJQNI=
MIME-Version: 1.0
Received: by 10.216.220.219 with SMTP id o69mr7916465wep.57.1296598625809;
	Tue, 01 Feb 2011 14:17:05 -0800 (PST)
Sender: yanegomi@gmail.com
Received: by 10.216.71.200 with HTTP; Tue, 1 Feb 2011 14:17:05 -0800 (PST)
In-Reply-To: <20110201163844.0c585be4@kan.dnsalias.net>
References: <201102012115.p11LFZQh085454@svn.freebsd.org>
	
	<20110201163844.0c585be4@kan.dnsalias.net>
Date: Tue, 1 Feb 2011 14:17:05 -0800
X-Google-Sender-Auth: 8tXRZTgZ2d75Atm3nS6xK9jrcc8
Message-ID: 
From: Garrett Cooper 
To: Alexander Kabaev 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218177 - head/sys/cddl/compat/opensolaris/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 22:17:08 -0000

2011/2/1 Alexander Kabaev :
> On Tue, 1 Feb 2011 13:28:43 -0800
> Garrett Cooper  wrote:
>
>> On Tue, Feb 1, 2011 at 1:15 PM, Alexander Kabaev 
>> wrote:
>> > Author: kan
>> > Date: Tue Feb =A01 21:15:35 2011
>> > New Revision: 218177
>> > URL: http://svn.freebsd.org/changeset/base/218177
>> >
>> > Log:
>> > =A0Revert r218169 until it can be tested and fixed properly.
>
> The real fix from Martin will follow shortly.

    This really needs to be resolved by rearchitecting clock_t to be
64-bit on amd64/i386, etc, or add the appropriate shims to handle
overflow in our opensolaris compatibility layer.
Thanks,
-Garrett

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 22:26:06 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8376D10656AC;
	Tue,  1 Feb 2011 22:26:06 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 721F98FC12;
	Tue,  1 Feb 2011 22:26:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p11MQ6YN087190;
	Tue, 1 Feb 2011 22:26:06 GMT (envelope-from n_hibma@svn.freebsd.org)
Received: (from n_hibma@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p11MQ6Nh087187;
	Tue, 1 Feb 2011 22:26:06 GMT (envelope-from n_hibma@svn.freebsd.org)
Message-Id: <201102012226.p11MQ6Nh087187@svn.freebsd.org>
From: Nick Hibma 
Date: Tue, 1 Feb 2011 22:26: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: r218178 - in head/sys/dev/usb: . serial
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 22:26:06 -0000

Author: n_hibma
Date: Tue Feb  1 22:26:06 2011
New Revision: 218178
URL: http://svn.freebsd.org/changeset/base/218178

Log:
  New ID for the Novatel MC547
  
  PR:		154127
  Submitted by:	Mike Tancsa
  MFC after:	1 day

Modified:
  head/sys/dev/usb/serial/u3g.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/serial/u3g.c
==============================================================================
--- head/sys/dev/usb/serial/u3g.c	Tue Feb  1 21:15:35 2011	(r218177)
+++ head/sys/dev/usb/serial/u3g.c	Tue Feb  1 22:26:06 2011	(r218178)
@@ -302,6 +302,7 @@ static const struct usb_device_id u3g_de
 	U3G_DEV(NOVATEL, EU740, 0),
 	U3G_DEV(NOVATEL, EU870D, 0),
 	U3G_DEV(NOVATEL, MC760, 0),
+	U3G_DEV(NOVATEL, MC547, 0),
 	U3G_DEV(NOVATEL, MC950D, 0),
 	U3G_DEV(NOVATEL, U720, 0),
 	U3G_DEV(NOVATEL, U727, 0),

Modified: head/sys/dev/usb/usbdevs
==============================================================================
--- head/sys/dev/usb/usbdevs	Tue Feb  1 21:15:35 2011	(r218177)
+++ head/sys/dev/usb/usbdevs	Tue Feb  1 22:26:06 2011	(r218178)
@@ -2387,6 +2387,7 @@ product NOVATEL ZEROCD2		0x5030	Novatel 
 product NOVATEL U727_2		0x5100	Merlin U727 CDMA
 product NOVATEL U760		0x6000	Novatel U760
 product NOVATEL MC760		0x6002	Novatel MC760
+product NOVATEL MC547		0x7042	Novatel MC547
 product NOVATEL2 FLEXPACKGPS	0x0100	NovAtel FlexPack GPS receiver
 
 /* Merlin products */

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 22:50:23 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BD31A10656A3;
	Tue,  1 Feb 2011 22:50:23 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AC7208FC24;
	Tue,  1 Feb 2011 22:50:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p11MoNBu087804;
	Tue, 1 Feb 2011 22:50:23 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p11MoNCm087802;
	Tue, 1 Feb 2011 22:50:23 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <201102012250.p11MoNCm087802@svn.freebsd.org>
From: Warner Losh 
Date: Tue, 1 Feb 2011 22:50: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: r218179 - head/lib/csu/mips
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 22:50:23 -0000

Author: imp
Date: Tue Feb  1 22:50:23 2011
New Revision: 218179
URL: http://svn.freebsd.org/changeset/base/218179

Log:
  Whitespace nit

Modified:
  head/lib/csu/mips/crt1.c

Modified: head/lib/csu/mips/crt1.c
==============================================================================
--- head/lib/csu/mips/crt1.c	Tue Feb  1 22:26:06 2011	(r218178)
+++ head/lib/csu/mips/crt1.c	Tue Feb  1 22:50:23 2011	(r218179)
@@ -83,7 +83,7 @@ __start(char **ap,
 	argv = ap + 1;
 	env  = ap + 2 + argc;
 	environ = env;
-	if(argc > 0 && argv[0] != NULL) {
+	if (argc > 0 && argv[0] != NULL) {
 		const char *s;
 		__progname = argv[0];
 		for (s = __progname; *s != '\0'; s++)

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  1 23:12:13 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E50481065670;
	Tue,  1 Feb 2011 23:12:13 +0000 (UTC) (envelope-from mm@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D424B8FC25;
	Tue,  1 Feb 2011 23:12:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p11NCDrp088368;
	Tue, 1 Feb 2011 23:12:13 GMT (envelope-from mm@svn.freebsd.org)
Received: (from mm@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p11NCDHA088366;
	Tue, 1 Feb 2011 23:12:13 GMT (envelope-from mm@svn.freebsd.org)
Message-Id: <201102012312.p11NCDHA088366@svn.freebsd.org>
From: Martin Matuska 
Date: Tue, 1 Feb 2011 23:12:13 +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: r218180 - head/sys/cddl/compat/opensolaris/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Feb 2011 23:12:14 -0000

Author: mm
Date: Tue Feb  1 23:12:13 2011
New Revision: 218180
URL: http://svn.freebsd.org/changeset/base/218180

Log:
  Recommit r218169, enclosing with #ifdef _KERNEL
  This change is sufficient for the ZFS kernel module.
  
  Discussed with:	pjd
  MFC after:	1 week

Modified:
  head/sys/cddl/compat/opensolaris/sys/types.h

Modified: head/sys/cddl/compat/opensolaris/sys/types.h
==============================================================================
--- head/sys/cddl/compat/opensolaris/sys/types.h	Tue Feb  1 22:50:23 2011	(r218179)
+++ head/sys/cddl/compat/opensolaris/sys/types.h	Tue Feb  1 23:12:13 2011	(r218180)
@@ -34,6 +34,12 @@
  */
 
 #include 
+
+#ifdef _KERNEL
+typedef	int64_t		clock_t;
+#define	_CLOCK_T_DECLARED
+#endif
+
 #include_next 
 
 #define	MAXNAMELEN	256

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 03:24:52 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8338E106564A;
	Wed,  2 Feb 2011 03:24:52 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 728A08FC0C;
	Wed,  2 Feb 2011 03:24:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p123OqPt094251;
	Wed, 2 Feb 2011 03:24:52 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p123Oqb6094249;
	Wed, 2 Feb 2011 03:24:52 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <201102020324.p123Oqb6094249@svn.freebsd.org>
From: Warner Losh 
Date: Wed, 2 Feb 2011 03:24:52 +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: r218181 - head/gnu/lib/libgcc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 03:24:52 -0000

Author: imp
Date: Wed Feb  2 03:24:52 2011
New Revision: 218181
URL: http://svn.freebsd.org/changeset/base/218181

Log:
  Revert last change now that the reason for it is no more...
  MACHINE_ARCH is now always mipsel when building mips/mips.

Modified:
  head/gnu/lib/libgcc/Makefile

Modified: head/gnu/lib/libgcc/Makefile
==============================================================================
--- head/gnu/lib/libgcc/Makefile	Tue Feb  1 23:12:13 2011	(r218180)
+++ head/gnu/lib/libgcc/Makefile	Wed Feb  2 03:24:52 2011	(r218181)
@@ -122,8 +122,7 @@ LIB2FUNCS_EXTRA = floatunsidf.c floatuns
 .if ${TARGET_CPUARCH} == mips
 LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c
 # ABIs other than o32 need this
-.if ${TARGET_ARCH:Mmips64*} != "" || \
-    ${TARGET_ARCH:Mmipsn32*} != ""
+.if ${TARGET_ARCH:Mmipse[lb]} == ""
 LIB2FUNCS_EXTRA+= floatdidf.c fixunsdfsi.c
 LIB2FUNCS_EXTRA+= floatdisf.c floatundidf.c
 LIB2FUNCS_EXTRA+= fixsfdi.c floatundisf.c

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 03:27:32 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3E00E106566B;
	Wed,  2 Feb 2011 03:27:32 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2D5AB8FC0A;
	Wed,  2 Feb 2011 03:27:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p123RW6f094347;
	Wed, 2 Feb 2011 03:27:32 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p123RWPo094345;
	Wed, 2 Feb 2011 03:27:32 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <201102020327.p123RWPo094345@svn.freebsd.org>
From: Warner Losh 
Date: Wed, 2 Feb 2011 03:27:32 +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: r218182 - head/gnu/lib/libgomp
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 03:27:32 -0000

Author: imp
Date: Wed Feb  2 03:27:31 2011
New Revision: 218182
URL: http://svn.freebsd.org/changeset/base/218182

Log:
  Make the generated files depend on the Makefile so new platforms are easier
  to add than mipsn32 was when I was working on it...

Modified:
  head/gnu/lib/libgomp/Makefile

Modified: head/gnu/lib/libgomp/Makefile
==============================================================================
--- head/gnu/lib/libgomp/Makefile	Wed Feb  2 03:24:52 2011	(r218181)
+++ head/gnu/lib/libgomp/Makefile	Wed Feb  2 03:27:31 2011	(r218182)
@@ -47,14 +47,14 @@ gstdint.h:
 CLEANFILES+= gstdint.h
 
 .for HFILE in libgomp_f.h omp.h omp_lib.h
-${HFILE}: ${SRCDIR}/${HFILE}.in
+${HFILE}: ${SRCDIR}/${HFILE}.in ${.CURDIR}/Makefile
 	sed -e 's/@OMP_LOCK_ALIGN@/${OMP_LOCK_ALIGN}/g' \
 	    -e 's/@OMP_LOCK_KIND@/${OMP_LOCK_KIND}/g' \
 	    -e 's/@OMP_LOCK_SIZE@/${OMP_LOCK_SIZE}/g' \
 	    -e 's/@OMP_NEST_LOCK_ALIGN@/${OMP_NEST_LOCK_ALIGN}/g' \
 	    -e 's/@OMP_NEST_LOCK_KIND@/${OMP_NEST_LOCK_KIND}/g' \
 	    -e 's/@OMP_NEST_LOCK_SIZE@/${OMP_NEST_LOCK_SIZE}/g' \
-	    < ${.ALLSRC} > ${.TARGET}
+	    < ${SRCDIR}/${HFILE}.in > ${.TARGET}
 CLEANFILES+= ${HFILE}
 .endfor
 

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 03:55:34 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 81252106566C;
	Wed,  2 Feb 2011 03:55:34 +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 6F5C18FC16;
	Wed,  2 Feb 2011 03:55:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p123tYKO094979;
	Wed, 2 Feb 2011 03:55:34 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p123tYrH094975;
	Wed, 2 Feb 2011 03:55:34 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201102020355.p123tYrH094975@svn.freebsd.org>
From: Adrian Chadd 
Date: Wed, 2 Feb 2011 03:55:34 +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: r218183 - in head/sys/dev/ath/ath_hal: ar9001 ar9002
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 03:55:34 -0000

Author: adrian
Date: Wed Feb  2 03:55:34 2011
New Revision: 218183
URL: http://svn.freebsd.org/changeset/base/218183

Log:
  Call the correct ANI Attach routine.

Modified:
  head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c
  head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
  head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c

Modified: head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c	Wed Feb  2 03:27:31 2011	(r218182)
+++ head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c	Wed Feb  2 03:55:34 2011	(r218183)
@@ -81,7 +81,7 @@ ar9160AniSetup(struct ath_hal *ah)
 		.period			= 100,
 	};
 	/* NB: ANI is not enabled yet */
-	ar5212AniAttach(ah, &aniparams, &aniparams, AH_FALSE);
+	ar5416AniAttach(ah, &aniparams, &aniparams, AH_FALSE);
 }
 
 /*

Modified: head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c	Wed Feb  2 03:27:31 2011	(r218182)
+++ head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c	Wed Feb  2 03:55:34 2011	(r218183)
@@ -69,7 +69,7 @@ static void
 ar9280AniSetup(struct ath_hal *ah)
 {
 	/* NB: disable ANI for reliable RIFS rx */
-	ar5212AniAttach(ah, AH_NULL, AH_NULL, AH_FALSE);
+	ar5416AniAttach(ah, AH_NULL, AH_NULL, AH_FALSE);
 }
 
 /*

Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c	Wed Feb  2 03:27:31 2011	(r218182)
+++ head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c	Wed Feb  2 03:55:34 2011	(r218183)
@@ -71,7 +71,7 @@ static void
 ar9285AniSetup(struct ath_hal *ah)
 {
 	/* NB: disable ANI for reliable RIFS rx */
-	ar5212AniAttach(ah, AH_NULL, AH_NULL, AH_FALSE);
+	ar5416AniAttach(ah, AH_NULL, AH_NULL, AH_FALSE);
 }
 
 /*

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 05:26:39 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4FD311065673;
	Wed,  2 Feb 2011 05:26:39 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail07.syd.optusnet.com.au (mail07.syd.optusnet.com.au
	[211.29.132.188])
	by mx1.freebsd.org (Postfix) with ESMTP id 7DBC38FC12;
	Wed,  2 Feb 2011 05:26:34 +0000 (UTC)
Received: from c122-106-165-206.carlnfd1.nsw.optusnet.com.au
	(c122-106-165-206.carlnfd1.nsw.optusnet.com.au [122.106.165.206])
	by mail07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	p125QUkv003700
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Wed, 2 Feb 2011 16:26:31 +1100
Date: Wed, 2 Feb 2011 16:26:30 +1100 (EST)
From: Bruce Evans 
X-X-Sender: bde@besplex.bde.org
To: Garrett Cooper 
In-Reply-To: 
Message-ID: <20110202162235.P1386@besplex.bde.org>
References: <201102012115.p11LFZQh085454@svn.freebsd.org>
	
	<20110201163844.0c585be4@kan.dnsalias.net>
	
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="0-2007831990-1296624390=:1386"
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Alexander Kabaev 
Subject: Re: svn commit: r218177 - head/sys/cddl/compat/opensolaris/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 05:26:39 -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-2007831990-1296624390=:1386
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

On Tue, 1 Feb 2011, Garrett Cooper wrote:

> 2011/2/1 Alexander Kabaev :
>> On Tue, 1 Feb 2011 13:28:43 -0800
>> Garrett Cooper  wrote:
>>
>>> On Tue, Feb 1, 2011 at 1:15 PM, Alexander Kabaev 
>>> wrote:
>>>> Author: kan
>>>> Date: Tue Feb =A01 21:15:35 2011
>>>> New Revision: 218177
>>>> URL: http://svn.freebsd.org/changeset/base/218177
>>>>
>>>> Log:
>>>> =A0Revert r218169 until it can be tested and fixed properly.
>>
>> The real fix from Martin will follow shortly.
>
>    This really needs to be resolved by rearchitecting clock_t to be
> 64-bit on amd64/i386, etc, or add the appropriate shims to handle
> overflow in our opensolaris compatibility layer.

Not really.  As I explained at length, the bug is mostly abusing clock_t
for something that it is not required to do and in fact doesn't do.  You
shouldn't change the ABI of clock_t just to make abuses work.

Bruce
--0-2007831990-1296624390=:1386--

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 05:58:52 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6E9D1106566B;
	Wed,  2 Feb 2011 05:58:52 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5A6938FC0C;
	Wed,  2 Feb 2011 05:58:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p125wqqk097676;
	Wed, 2 Feb 2011 05:58:52 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p125wqiT097664;
	Wed, 2 Feb 2011 05:58:52 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <201102020558.p125wqiT097664@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Wed, 2 Feb 2011 05:58:52 +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: r218184 - in head/sys/powerpc: include mpc85xx ofw
	powermac powerpc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 05:58:52 -0000

Author: marcel
Date: Wed Feb  2 05:58:51 2011
New Revision: 218184
URL: http://svn.freebsd.org/changeset/base/218184

Log:
  Rename INTR_VEC to MAP_IRQ. From the OFW or FDT we obtain a
  PIC handle with interrupt pin. This we map to the resource
  called SYS_RES_IRQ.

Modified:
  head/sys/powerpc/include/intr_machdep.h
  head/sys/powerpc/mpc85xx/pci_fdt.c
  head/sys/powerpc/ofw/ofw_pcib_pci.c
  head/sys/powerpc/ofw/ofw_pcibus.c
  head/sys/powerpc/powermac/cpcht.c
  head/sys/powerpc/powermac/grackle.c
  head/sys/powerpc/powermac/macgpio.c
  head/sys/powerpc/powermac/macio.c
  head/sys/powerpc/powermac/uninorth.c
  head/sys/powerpc/powermac/uninorthpci.c
  head/sys/powerpc/powerpc/intr_machdep.c

Modified: head/sys/powerpc/include/intr_machdep.h
==============================================================================
--- head/sys/powerpc/include/intr_machdep.h	Wed Feb  2 03:55:34 2011	(r218183)
+++ head/sys/powerpc/include/intr_machdep.h	Wed Feb  2 05:58:51 2011	(r218184)
@@ -31,7 +31,7 @@
 #define	INTR_VECTORS	256
 
 #define	MAX_PICS		5
-#define	INTR_VEC(node, pin)	powerpc_get_irq(node, pin)
+#define	MAP_IRQ(node, pin)	powerpc_get_irq(node, pin)
 
 /*
  * Default base address for MSI messages on PowerPC

Modified: head/sys/powerpc/mpc85xx/pci_fdt.c
==============================================================================
--- head/sys/powerpc/mpc85xx/pci_fdt.c	Wed Feb  2 03:55:34 2011	(r218183)
+++ head/sys/powerpc/mpc85xx/pci_fdt.c	Wed Feb  2 05:58:51 2011	(r218184)
@@ -554,11 +554,11 @@ fsl_pcib_route_int(struct fsl_pcib_softc
 
 	devfn = DEVFN(bus, slot, func);
 	if (devfn == sc->sc_devfn_via_ide)
-		intline = INTR_VEC(0, 14);
+		intline = MAP_IRQ(0, 14);
 	else if (devfn == sc->sc_devfn_via_ide + 1)
-		intline = INTR_VEC(0, 10);
+		intline = MAP_IRQ(0, 10);
 	else if (devfn == sc->sc_devfn_via_ide + 2)
-		intline = INTR_VEC(0, 10);
+		intline = MAP_IRQ(0, 10);
 	else {
 		if (intpin != 0)
 			err = fdt_pci_route_intr(bus, slot, func, intpin,

Modified: head/sys/powerpc/ofw/ofw_pcib_pci.c
==============================================================================
--- head/sys/powerpc/ofw/ofw_pcib_pci.c	Wed Feb  2 03:55:34 2011	(r218183)
+++ head/sys/powerpc/ofw/ofw_pcib_pci.c	Wed Feb  2 05:58:51 2011	(r218184)
@@ -171,7 +171,7 @@ ofw_pcib_pci_route_interrupt(device_t br
 			 * it again on higher levels - that causes problems
 			 * in some cases, and never seems to be required.
 			 */
-			return (INTR_VEC(iparent, mintr));
+			return (MAP_IRQ(iparent, mintr));
 		}
 	} else if (intpin >= 1 && intpin <= 4) {
 		/*

Modified: head/sys/powerpc/ofw/ofw_pcibus.c
==============================================================================
--- head/sys/powerpc/ofw/ofw_pcibus.c	Wed Feb  2 03:55:34 2011	(r218183)
+++ head/sys/powerpc/ofw/ofw_pcibus.c	Wed Feb  2 05:58:51 2011	(r218184)
@@ -213,7 +213,7 @@ ofw_pcibus_enum_devtree(device_t dev, u_
 				    sizeof(icells));
 
 				if (iparent != 0)
-					intr[0] = INTR_VEC(iparent, intr[0]);
+					intr[0] = MAP_IRQ(iparent, intr[0]);
 
 				if (iparent != 0 && icells > 1) {
 					powerpc_config_intr(intr[0],
@@ -348,12 +348,12 @@ ofw_pcibus_assign_interrupt(device_t dev
 
 	isz = OF_getprop(node, "AAPL,interrupts", &intr, sizeof(intr));
 	if (isz == sizeof(intr))
-		return ((iparent == -1) ? intr : INTR_VEC(iparent, intr));
+		return ((iparent == -1) ? intr : MAP_IRQ(iparent, intr));
 
 	isz = OF_getprop(node, "interrupts", &intr, sizeof(intr));
 	if (isz == sizeof(intr)) {
 		if (iparent != -1)
-			intr = INTR_VEC(iparent, intr);
+			intr = MAP_IRQ(iparent, intr);
 	} else {
 		/* No property: our best guess is the intpin. */
 		intr = pci_get_intpin(child);

Modified: head/sys/powerpc/powermac/cpcht.c
==============================================================================
--- head/sys/powerpc/powermac/cpcht.c	Wed Feb  2 03:55:34 2011	(r218183)
+++ head/sys/powerpc/powermac/cpcht.c	Wed Feb  2 05:58:51 2011	(r218184)
@@ -655,7 +655,7 @@ cpcht_alloc_msi(device_t dev, device_t c
 	}
 
 	for (j = 0; j < count; j++) {
-		irqs[j] = INTR_VEC(cpcht_msipic, i+j);
+		irqs[j] = MAP_IRQ(cpcht_msipic, i+j);
 		sc->htirq_map[i+j].irq_type = IRQ_MSI;
 	}
 	mtx_unlock(&sc->htirq_mtx);
@@ -695,7 +695,7 @@ cpcht_alloc_msix(device_t dev, device_t 
 	for (i = 8; i < 124; i++) {
 		if (sc->htirq_map[i].irq_type == IRQ_NONE) {
 			sc->htirq_map[i].irq_type = IRQ_MSI;
-			*irq = INTR_VEC(cpcht_msipic, i);
+			*irq = MAP_IRQ(cpcht_msipic, i);
 
 			mtx_unlock(&sc->htirq_mtx);
 			return (0);

Modified: head/sys/powerpc/powermac/grackle.c
==============================================================================
--- head/sys/powerpc/powermac/grackle.c	Wed Feb  2 03:55:34 2011	(r218183)
+++ head/sys/powerpc/powermac/grackle.c	Wed Feb  2 05:58:51 2011	(r218184)
@@ -353,7 +353,7 @@ grackle_route_interrupt(device_t bus, de
 	if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), &sc->sc_pci_iinfo, ®,
 	    sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr),
 	    &iparent, maskbuf))
-		return (INTR_VEC(iparent, mintr));
+		return (MAP_IRQ(iparent, mintr));
 
 	/* Maybe it's a real interrupt, not an intpin */
 	if (pin > 4)

Modified: head/sys/powerpc/powermac/macgpio.c
==============================================================================
--- head/sys/powerpc/powermac/macgpio.c	Wed Feb  2 03:55:34 2011	(r218183)
+++ head/sys/powerpc/powermac/macgpio.c	Wed Feb  2 05:58:51 2011	(r218184)
@@ -191,7 +191,7 @@ macgpio_attach(device_t dev)
 			OF_searchprop(child, "interrupt-parent", &iparent,
 			    sizeof(iparent));
 			resource_list_add(&dinfo->mdi_resources, SYS_RES_IRQ,
-			    0, INTR_VEC(iparent, irq), INTR_VEC(iparent, irq),
+			    0, MAP_IRQ(iparent, irq), MAP_IRQ(iparent, irq),
 			    1);
 		}
 

Modified: head/sys/powerpc/powermac/macio.c
==============================================================================
--- head/sys/powerpc/powermac/macio.c	Wed Feb  2 03:55:34 2011	(r218183)
+++ head/sys/powerpc/powermac/macio.c	Wed Feb  2 05:58:51 2011	(r218184)
@@ -218,12 +218,12 @@ macio_add_intr(phandle_t devnode, struct
 		panic("Interrupt but no interrupt parent!\n");
 
 	for (i = 0; i < nintr; i+=icells) {
+		u_int irq = MAP_IRQ(iparent, intr[i]);
+
 		resource_list_add(&dinfo->mdi_resources, SYS_RES_IRQ,
-		    dinfo->mdi_ninterrupts, INTR_VEC(iparent, intr[i]),
-		    INTR_VEC(iparent, intr[i]), 1);
+		    dinfo->mdi_ninterrupts, irq, irq, 1);
 
-		dinfo->mdi_interrupts[dinfo->mdi_ninterrupts] =
-		    INTR_VEC(iparent, intr[i]);
+		dinfo->mdi_interrupts[dinfo->mdi_ninterrupts] = irq;
 		dinfo->mdi_ninterrupts++;
 	}
 }

Modified: head/sys/powerpc/powermac/uninorth.c
==============================================================================
--- head/sys/powerpc/powermac/uninorth.c	Wed Feb  2 03:55:34 2011	(r218183)
+++ head/sys/powerpc/powermac/uninorth.c	Wed Feb  2 05:58:51 2011	(r218184)
@@ -175,18 +175,18 @@ unin_chip_add_intr(phandle_t devnode, st
 		icells = 1;
 
 	for (i = 0; i < nintr; i+=icells) {
+		u_int irq = MAP_IRQ(iparent, intr[i]);
+
 		resource_list_add(&dinfo->udi_resources, SYS_RES_IRQ,
-		    dinfo->udi_ninterrupts, INTR_VEC(iparent, intr[i]),
-		    INTR_VEC(iparent, intr[i]), 1);
+		    dinfo->udi_ninterrupts, irq, irq, 1);
 
 		if (icells > 1) {
-			powerpc_config_intr(INTR_VEC(iparent, intr[i]),
+			powerpc_config_intr(irq,
 			    (intr[i+1] & 1) ? INTR_TRIGGER_LEVEL :
 			    INTR_TRIGGER_EDGE, INTR_POLARITY_LOW);
 		}
 
-		dinfo->udi_interrupts[dinfo->udi_ninterrupts] =
-		    INTR_VEC(iparent, intr[i]);
+		dinfo->udi_interrupts[dinfo->udi_ninterrupts] = irq;
 		dinfo->udi_ninterrupts++;
 	}
 }

Modified: head/sys/powerpc/powermac/uninorthpci.c
==============================================================================
--- head/sys/powerpc/powermac/uninorthpci.c	Wed Feb  2 03:55:34 2011	(r218183)
+++ head/sys/powerpc/powermac/uninorthpci.c	Wed Feb  2 05:58:51 2011	(r218184)
@@ -367,7 +367,7 @@ uninorth_route_interrupt(device_t bus, d
 	if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), &sc->sc_pci_iinfo, ®,
 	    sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr),
 	    &iparent, maskbuf))
-		return (INTR_VEC(iparent, mintr));
+		return (MAP_IRQ(iparent, mintr));
 
 	/* Maybe it's a real interrupt, not an intpin */
 	if (pin > 4)

Modified: head/sys/powerpc/powerpc/intr_machdep.c
==============================================================================
--- head/sys/powerpc/powerpc/intr_machdep.c	Wed Feb  2 03:55:34 2011	(r218183)
+++ head/sys/powerpc/powerpc/intr_machdep.c	Wed Feb  2 05:58:51 2011	(r218184)
@@ -403,7 +403,7 @@ powerpc_enable_intr(void)
 
 		KASSERT(piclist[n].ipis != 0, ("%s", __func__));
 		error = powerpc_setup_intr("IPI",
-		    INTR_VEC(piclist[n].node, piclist[n].irqs),
+		    MAP_IRQ(piclist[n].node, piclist[n].irqs),
 		    powerpc_ipi_handler, NULL, NULL,
 		    INTR_TYPE_MISC | INTR_EXCL, &ipi_cookie);
 		if (error) {

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 08:24:26 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8EDF0106564A;
	Wed,  2 Feb 2011 08:24:26 +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 7D9638FC08;
	Wed,  2 Feb 2011 08:24:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p128OQbD001120;
	Wed, 2 Feb 2011 08:24:26 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p128OQKv001118;
	Wed, 2 Feb 2011 08:24:26 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201102020824.p128OQKv001118@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Wed, 2 Feb 2011 08:24:26 +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: r218185 - head/sbin/hastd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 08:24:26 -0000

Author: pjd
Date: Wed Feb  2 08:24:26 2011
New Revision: 218185
URL: http://svn.freebsd.org/changeset/base/218185

Log:
  Be prepared that hp_client or hp_server might be NULL now.
  
  MFC after:	1 week

Modified:
  head/sbin/hastd/proto.c

Modified: head/sbin/hastd/proto.c
==============================================================================
--- head/sbin/hastd/proto.c	Wed Feb  2 05:58:51 2011	(r218184)
+++ head/sbin/hastd/proto.c	Wed Feb  2 08:24:26 2011	(r218185)
@@ -83,10 +83,17 @@ proto_common_setup(const char *addr, str
 		return (-1);
 
 	TAILQ_FOREACH(proto, &protos, hp_next) {
-		if (side == PROTO_SIDE_CLIENT)
-			ret = proto->hp_client(addr, &ctx);
-		else /* if (side == PROTO_SIDE_SERVER_LISTEN) */
-			ret = proto->hp_server(addr, &ctx);
+		if (side == PROTO_SIDE_CLIENT) {
+			if (proto->hp_client == NULL)
+				ret = -1;
+			else
+				ret = proto->hp_client(addr, &ctx);
+		} else /* if (side == PROTO_SIDE_SERVER_LISTEN) */ {
+			if (proto->hp_server == NULL)
+				ret = -1;
+			else
+				ret = proto->hp_server(addr, &ctx);
+		}
 		/*
 		 * ret == 0  - success
 		 * ret == -1 - addr is not for this protocol

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 11:13:23 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BDA051065679;
	Wed,  2 Feb 2011 11:13:23 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AD7678FC1E;
	Wed,  2 Feb 2011 11:13:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p12BDNGH007322;
	Wed, 2 Feb 2011 11:13:23 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p12BDNSP007307;
	Wed, 2 Feb 2011 11:13:23 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <201102021113.p12BDNSP007307@svn.freebsd.org>
From: Randall Stewart 
Date: Wed, 2 Feb 2011 11:13: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: r218186 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 11:13:23 -0000

Author: rrs
Date: Wed Feb  2 11:13:23 2011
New Revision: 218186
URL: http://svn.freebsd.org/changeset/base/218186

Log:
  1) Allow a chunk to track the cwnd it was at when sent.
  2) Add separate max-bursts for retransmit and hb. These
     are set to sysctlable values but not settable via the
     socket api. This makes sure we don't blast out HB's or
     fast-retransmits.
  3) Determine on the first data transmission on a net if
     its local-lan (by being under or over a RTT). This
     can later be used to think about different algorithms
     based on locallan vs big-i (experimental)
  4) The cwnd should NOT be allowed to grow when an ECNEcho
     is seen (TCP has this same bug). We fix this in SCTP
     so an ECNe being seen prevents an advance of cwnd.
  5) CWR's should not be sent multiple times to the
     same network, instead just updating the TSN being
     transmitted if needed.
  
  MFC after:	1 Month

Modified:
  head/sys/netinet/sctp_cc_functions.c
  head/sys/netinet/sctp_constants.h
  head/sys/netinet/sctp_indata.c
  head/sys/netinet/sctp_indata.h
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_pcb.h
  head/sys/netinet/sctp_structs.h
  head/sys/netinet/sctp_sysctl.c
  head/sys/netinet/sctp_sysctl.h
  head/sys/netinet/sctp_timer.c
  head/sys/netinet/sctputil.c
  head/sys/netinet/sctputil.h

Modified: head/sys/netinet/sctp_cc_functions.c
==============================================================================
--- head/sys/netinet/sctp_cc_functions.c	Wed Feb  2 08:24:26 2011	(r218185)
+++ head/sys/netinet/sctp_cc_functions.c	Wed Feb  2 11:13:23 2011	(r218186)
@@ -481,6 +481,7 @@ sctp_cwnd_update_after_timeout(struct sc
 	}
 }
 
+
 static void
 sctp_cwnd_update_after_ecn_echo(struct sctp_tcb *stcb, struct sctp_nets *net,
     int in_window, int num_pkt_lost)

Modified: head/sys/netinet/sctp_constants.h
==============================================================================
--- head/sys/netinet/sctp_constants.h	Wed Feb  2 08:24:26 2011	(r218185)
+++ head/sys/netinet/sctp_constants.h	Wed Feb  2 11:13:23 2011	(r218186)
@@ -345,6 +345,16 @@ __FBSDID("$FreeBSD$");
 
 /* default max I can burst out after a fast retransmit, 0 disables it */
 #define SCTP_DEF_MAX_BURST 0
+#define SCTP_DEF_HBMAX_BURST 4
+#define SCTP_DEF_FRMAX_BURST 4
+
+/* RTO calculation flag to say if it
+ * is safe to determine local lan or not.
+ */
+#define SCTP_DETERMINE_LL_NOTOK 0
+#define SCTP_DETERMINE_LL_OK    1
+
+
 /* IP hdr (20/40) + 12+2+2 (enet) + sctp common 12 */
 #define SCTP_FIRST_MBUF_RESV 68
 /* Packet transmit states in the sent field */
@@ -947,6 +957,18 @@ __FBSDID("$FreeBSD$");
  */
 #define SCTP_TIME_WAIT 60
 
+/* How many micro seconds is the cutoff from
+ * local lan type rtt's
+ */
+ /*
+  * We allow 500us for the rtt and another 500us for the cookie processing
+  * since we measure this on the first rtt.
+  */
+#define SCTP_LOCAL_LAN_RTT 1100
+#define SCTP_LAN_UNKNOWN  0
+#define SCTP_LAN_LOCAL    1
+#define SCTP_LAN_INTERNET 2
+
 #define SCTP_SEND_BUFFER_SPLITTING 0x00000001
 #define SCTP_RECV_BUFFER_SPLITTING 0x00000002
 
@@ -994,6 +1016,7 @@ __FBSDID("$FreeBSD$");
 
 #if defined(_KERNEL)
 
+#define SCTP_GETTIME_TIMESPEC(x) (getnanouptime(x))
 #define SCTP_GETTIME_TIMEVAL(x)	(getmicrouptime(x))
 #define SCTP_GETPTIME_TIMEVAL(x)	(microuptime(x))
 #endif

Modified: head/sys/netinet/sctp_indata.c
==============================================================================
--- head/sys/netinet/sctp_indata.c	Wed Feb  2 08:24:26 2011	(r218185)
+++ head/sys/netinet/sctp_indata.c	Wed Feb  2 11:13:23 2011	(r218186)
@@ -2955,7 +2955,8 @@ sctp_process_segment_range(struct sctp_t
 								    &stcb->asoc,
 								    tp1->whoTo,
 								    &tp1->sent_rcv_time,
-								    sctp_align_safe_nocopy);
+								    sctp_align_safe_nocopy,
+								    SCTP_DETERMINE_LL_OK);
 								tp1->do_rtt = 0;
 							}
 						}
@@ -3751,7 +3752,7 @@ sctp_window_probe_recovery(struct sctp_t
 
 void
 sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
-    uint32_t rwnd, int *abort_now)
+    uint32_t rwnd, int *abort_now, int ecne_seen)
 {
 	struct sctp_nets *net;
 	struct sctp_association *asoc;
@@ -3902,7 +3903,8 @@ sctp_express_handle_sack(struct sctp_tcb
 							    sctp_calculate_rto(stcb,
 							    asoc, tp1->whoTo,
 							    &tp1->sent_rcv_time,
-							    sctp_align_safe_nocopy);
+							    sctp_align_safe_nocopy,
+							    SCTP_DETERMINE_LL_OK);
 							tp1->do_rtt = 0;
 						}
 					}
@@ -3994,7 +3996,7 @@ sctp_express_handle_sack(struct sctp_tcb
 	}
 
 	/* JRS - Use the congestion control given in the CC module */
-	if (asoc->last_acked_seq != cumack)
+	if ((asoc->last_acked_seq != cumack) && (ecne_seen == 0))
 		asoc->cc_functions.sctp_cwnd_update_after_sack(stcb, asoc, 1, 0, 0);
 
 	asoc->last_acked_seq = cumack;
@@ -4240,7 +4242,7 @@ sctp_handle_sack(struct mbuf *m, int off
     struct sctp_tcb *stcb, struct sctp_nets *net_from,
     uint16_t num_seg, uint16_t num_nr_seg, uint16_t num_dup,
     int *abort_now, uint8_t flags,
-    uint32_t cum_ack, uint32_t rwnd)
+    uint32_t cum_ack, uint32_t rwnd, int ecne_seen)
 {
 	struct sctp_association *asoc;
 	struct sctp_tmit_chunk *tp1, *tp2;
@@ -4500,7 +4502,8 @@ sctp_handle_sack(struct mbuf *m, int off
 							    sctp_calculate_rto(stcb,
 							    asoc, tp1->whoTo,
 							    &tp1->sent_rcv_time,
-							    sctp_align_safe_nocopy);
+							    sctp_align_safe_nocopy,
+							    SCTP_DETERMINE_LL_OK);
 							tp1->do_rtt = 0;
 						}
 					}
@@ -4754,7 +4757,8 @@ sctp_handle_sack(struct mbuf *m, int off
 		asoc->saw_sack_with_nr_frags = 0;
 
 	/* JRS - Use the congestion control given in the CC module */
-	asoc->cc_functions.sctp_cwnd_update_after_sack(stcb, asoc, accum_moved, reneged_all, will_exit_fast_recovery);
+	if (ecne_seen == 0)
+		asoc->cc_functions.sctp_cwnd_update_after_sack(stcb, asoc, accum_moved, reneged_all, will_exit_fast_recovery);
 
 	if (TAILQ_EMPTY(&asoc->sent_queue)) {
 		/* nothing left in-flight */
@@ -5077,7 +5081,7 @@ sctp_update_acked(struct sctp_tcb *stcb,
 	a_rwnd = stcb->asoc.peers_rwnd + stcb->asoc.total_flight;
 
 	/* Now call the express sack handling */
-	sctp_express_handle_sack(stcb, cum_ack, a_rwnd, abort_flag);
+	sctp_express_handle_sack(stcb, cum_ack, a_rwnd, abort_flag, 0);
 }
 
 static void

Modified: head/sys/netinet/sctp_indata.h
==============================================================================
--- head/sys/netinet/sctp_indata.h	Wed Feb  2 08:24:26 2011	(r218185)
+++ head/sys/netinet/sctp_indata.h	Wed Feb  2 11:13:23 2011	(r218186)
@@ -93,14 +93,14 @@ sctp_calc_rwnd(struct sctp_tcb *stcb, st
 
 void
 sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
-    uint32_t rwnd, int *abort_now);
+    uint32_t rwnd, int *abort_now, int ecne_seen);
 
 void
 sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup,
     struct sctp_tcb *stcb, struct sctp_nets *net_from,
     uint16_t num_seg, uint16_t num_nr_seg, uint16_t num_dup,
     int *abort_now, uint8_t flags,
-    uint32_t cum_ack, uint32_t rwnd);
+    uint32_t cum_ack, uint32_t rwnd, int ecne_seen);
 
 /* draft-ietf-tsvwg-usctp */
 void

Modified: head/sys/netinet/sctp_input.c
==============================================================================
--- head/sys/netinet/sctp_input.c	Wed Feb  2 08:24:26 2011	(r218185)
+++ head/sys/netinet/sctp_input.c	Wed Feb  2 11:13:23 2011	(r218186)
@@ -481,7 +481,8 @@ sctp_process_init_ack(struct mbuf *m, in
 	    asoc->primary_destination, SCTP_FROM_SCTP_INPUT + SCTP_LOC_4);
 
 	/* calculate the RTO */
-	net->RTO = sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered, sctp_align_safe_nocopy);
+	net->RTO = sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered, sctp_align_safe_nocopy,
+	    SCTP_DETERMINE_LL_NOTOK);
 
 	retval = sctp_send_cookie_echo(m, offset, stcb, net);
 	if (retval < 0) {
@@ -625,7 +626,8 @@ sctp_handle_heartbeat_ack(struct sctp_he
 		    net, net->cwnd);
 	}
 	/* Now lets do a RTO with this */
-	r_net->RTO = sctp_calculate_rto(stcb, &stcb->asoc, r_net, &tv, sctp_align_safe_nocopy);
+	r_net->RTO = sctp_calculate_rto(stcb, &stcb->asoc, r_net, &tv, sctp_align_safe_nocopy,
+	    SCTP_DETERMINE_LL_OK);
 	/* Mobility adaptation */
 	if (req_prim) {
 		if ((sctp_is_mobility_feature_on(stcb->sctp_ep,
@@ -1540,7 +1542,9 @@ sctp_process_cookie_existing(struct mbuf
 			 */
 			net->hb_responded = 1;
 			net->RTO = sctp_calculate_rto(stcb, asoc, net,
-			    &cookie->time_entered, sctp_align_unsafe_makecopy);
+			    &cookie->time_entered,
+			    sctp_align_unsafe_makecopy,
+			    SCTP_DETERMINE_LL_NOTOK);
 
 			if (stcb->asoc.sctp_autoclose_ticks &&
 			    (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTOCLOSE))) {
@@ -2243,7 +2247,8 @@ sctp_process_cookie_new(struct mbuf *m, 
 	(void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered);
 	if ((netp) && (*netp)) {
 		(*netp)->RTO = sctp_calculate_rto(stcb, asoc, *netp,
-		    &cookie->time_entered, sctp_align_unsafe_makecopy);
+		    &cookie->time_entered, sctp_align_unsafe_makecopy,
+		    SCTP_DETERMINE_LL_NOTOK);
 	}
 	/* respond with a COOKIE-ACK */
 	sctp_send_cookie_ack(stcb);
@@ -2831,7 +2836,8 @@ sctp_handle_cookie_ack(struct sctp_cooki
 		SCTP_STAT_INCR_GAUGE32(sctps_currestab);
 		if (asoc->overall_error_count == 0) {
 			net->RTO = sctp_calculate_rto(stcb, asoc, net,
-			    &asoc->time_entered, sctp_align_safe_nocopy);
+			    &asoc->time_entered, sctp_align_safe_nocopy,
+			    SCTP_DETERMINE_LL_NOTOK);
 		}
 		(void)SCTP_GETTIME_TIMEVAL(&asoc->time_entered);
 		sctp_ulp_notify(SCTP_NOTIFY_ASSOC_UP, stcb, 0, NULL, SCTP_SO_NOT_LOCKED);
@@ -2939,6 +2945,7 @@ sctp_handle_ecn_echo(struct sctp_ecne_ch
 	TAILQ_FOREACH(lchk, &stcb->asoc.sent_queue, sctp_next) {
 		if (lchk->rec.data.TSN_seq == tsn) {
 			net = lchk->whoTo;
+			net->ecn_prev_cwnd = lchk->rec.data.cwnd_at_send;
 			break;
 		}
 		if (SCTP_TSN_GT(lchk->rec.data.TSN_seq, tsn)) {
@@ -4196,6 +4203,7 @@ __attribute__((noinline))
 	uint32_t chk_length;
 	int ret;
 	int abort_no_unlock = 0;
+	int ecne_seen = 0;
 
 	/*
 	 * How big should this be, and should it be alloc'd? Lets try the
@@ -4691,13 +4699,13 @@ process_control_chunks:
 					 * with no missing segments to go
 					 * this way too.
 					 */
-					sctp_express_handle_sack(stcb, cum_ack, a_rwnd, &abort_now);
+					sctp_express_handle_sack(stcb, cum_ack, a_rwnd, &abort_now, ecne_seen);
 				} else {
 					if (netp && *netp)
 						sctp_handle_sack(m, offset_seg, offset_dup,
 						    stcb, *netp,
 						    num_seg, 0, num_dup, &abort_now, flags,
-						    cum_ack, a_rwnd);
+						    cum_ack, a_rwnd, ecne_seen);
 				}
 				if (abort_now) {
 					/* ABORT signal from sack processing */
@@ -4780,13 +4788,13 @@ process_control_chunks:
 					 * too.
 					 */
 					sctp_express_handle_sack(stcb, cum_ack, a_rwnd,
-					    &abort_now);
+					    &abort_now, ecne_seen);
 				} else {
 					if (netp && *netp)
 						sctp_handle_sack(m, offset_seg, offset_dup,
 						    stcb, *netp,
 						    num_seg, num_nr_seg, num_dup, &abort_now, flags,
-						    cum_ack, a_rwnd);
+						    cum_ack, a_rwnd, ecne_seen);
 				}
 				if (abort_now) {
 					/* ABORT signal from sack processing */
@@ -5063,6 +5071,7 @@ process_control_chunks:
 				stcb->asoc.overall_error_count = 0;
 				sctp_handle_ecn_echo((struct sctp_ecne_chunk *)ch,
 				    stcb);
+				ecne_seen = 1;
 			}
 			break;
 		case SCTP_ECN_CWR:

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Wed Feb  2 08:24:26 2011	(r218185)
+++ head/sys/netinet/sctp_output.c	Wed Feb  2 11:13:23 2011	(r218186)
@@ -6395,6 +6395,7 @@ sctp_clean_up_datalist(struct sctp_tcb *
 		}
 		/* record time */
 		data_list[i]->sent_rcv_time = net->last_sent_time;
+		data_list[i]->rec.data.cwnd_at_send = net->cwnd;
 		data_list[i]->rec.data.fast_retran_tsn = data_list[i]->rec.data.TSN_seq;
 		if (data_list[i]->whoTo == NULL) {
 			data_list[i]->whoTo = net;
@@ -9414,7 +9415,7 @@ sctp_chunk_output(struct sctp_inpcb *inp
 			    &now, &now_filled, frag_point, so_locked);
 			return;
 		}
-		if ((asoc->max_burst > 0) && (tot_frs > asoc->max_burst)) {
+		if ((asoc->fr_max_burst > 0) && (tot_frs >= asoc->fr_max_burst)) {
 			/* Hit FR burst limit */
 			return;
 		}
@@ -10962,6 +10963,27 @@ sctp_send_cwr(struct sctp_tcb *stcb, str
 	asoc = &stcb->asoc;
 	SCTP_TCB_LOCK_ASSERT(stcb);
 
+
+	TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
+		if ((chk->rec.chunk_id.id == SCTP_ECN_CWR) && (net == chk->whoTo)) {
+			/*
+			 * found a previous CWR queued to same destination
+			 * update it if needed
+			 */
+			uint32_t ctsn;
+
+			cwr = mtod(chk->data, struct sctp_cwr_chunk *);
+			ctsn = ntohl(cwr->tsn);
+			if (SCTP_TSN_GT(high_tsn, ctsn)) {
+				cwr->tsn = htonl(high_tsn);
+			}
+			if (override & SCTP_CWR_REDUCE_OVERRIDE) {
+				/* Make sure override is carried */
+				cwr->ch.chunk_flags |= SCTP_CWR_REDUCE_OVERRIDE;
+			}
+			return;
+		}
+	}
 	sctp_alloc_a_chunk(stcb, chk);
 	if (chk == NULL) {
 		return;

Modified: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c	Wed Feb  2 08:24:26 2011	(r218185)
+++ head/sys/netinet/sctp_pcb.c	Wed Feb  2 11:13:23 2011	(r218186)
@@ -2516,6 +2516,8 @@ sctp_inpcb_alloc(struct socket *so, uint
 	m->sctp_sws_sender = SCTP_SWS_SENDER_DEF;
 	m->sctp_sws_receiver = SCTP_SWS_RECEIVER_DEF;
 	m->max_burst = SCTP_BASE_SYSCTL(sctp_max_burst_default);
+	m->fr_max_burst = SCTP_BASE_SYSCTL(sctp_fr_max_burst_default);
+
 	m->sctp_default_cc_module = SCTP_BASE_SYSCTL(sctp_default_cc_module);
 	m->sctp_default_ss_module = SCTP_BASE_SYSCTL(sctp_default_ss_module);
 	/* number of streams to pre-open on a association */

Modified: head/sys/netinet/sctp_pcb.h
==============================================================================
--- head/sys/netinet/sctp_pcb.h	Wed Feb  2 08:24:26 2011	(r218185)
+++ head/sys/netinet/sctp_pcb.h	Wed Feb  2 11:13:23 2011	(r218186)
@@ -318,6 +318,7 @@ struct sctp_pcb {
 	uint32_t adaptation_layer_indicator;
 	uint32_t store_at;
 	uint32_t max_burst;
+	uint32_t fr_max_burst;
 	char current_secret_number;
 	char last_secret_number;
 };

Modified: head/sys/netinet/sctp_structs.h
==============================================================================
--- head/sys/netinet/sctp_structs.h	Wed Feb  2 08:24:26 2011	(r218185)
+++ head/sys/netinet/sctp_structs.h	Wed Feb  2 11:13:23 2011	(r218186)
@@ -237,6 +237,8 @@ struct sctp_nets {
 	uint32_t flight_size;
 	uint32_t cwnd;		/* actual cwnd */
 	uint32_t prev_cwnd;	/* cwnd before any processing */
+	uint32_t ecn_prev_cwnd;	/* ECN prev cwnd at first ecn_echo seen in new
+				 * window */
 	uint32_t partial_bytes_acked;	/* in CA tracks when to incr a MTU */
 	uint32_t prev_rtt;
 	/* tracking variables to avoid the aloc/free in sack processing */
@@ -318,6 +320,7 @@ struct sctp_nets {
 	uint8_t window_probe;	/* Doing a window probe? */
 	uint8_t RTO_measured;	/* Have we done the first measure */
 	uint8_t last_hs_used;	/* index into the last HS table entry we used */
+	uint8_t lan_type;
 	/* JRS - struct used in HTCP algorithm */
 	struct htcp htcp_ca;
 };
@@ -329,8 +332,7 @@ struct sctp_data_chunkrec {
 	uint16_t stream_number;	/* the stream number of this guy */
 	uint32_t payloadtype;
 	uint32_t context;	/* from send */
-
-	uint8_t fwd_tsn_cnt;
+	uint32_t cwnd_at_send;
 	/*
 	 * part of the Highest sacked algorithm to be able to stroke counts
 	 * on ones that are FR'd.
@@ -342,6 +344,7 @@ struct sctp_data_chunkrec {
 				 * outbound holds sending flags for PR-SCTP. */
 	uint8_t state_flags;
 	uint8_t chunk_was_revoked;
+	uint8_t fwd_tsn_cnt;
 };
 
 TAILQ_HEAD(sctpchunk_listhead, sctp_tmit_chunk);
@@ -1052,8 +1055,10 @@ struct sctp_association {
 	 */
 	uint8_t send_sack;
 
-	/* max burst after fast retransmit completes */
+	/* max burst of new packets into the network */
 	uint32_t max_burst;
+	/* max burst of fast retransmit packets */
+	uint32_t fr_max_burst;
 
 	uint8_t sat_network;	/* RTT is in range of sat net or greater */
 	uint8_t sat_network_lockout;	/* lockout code */

Modified: head/sys/netinet/sctp_sysctl.c
==============================================================================
--- head/sys/netinet/sctp_sysctl.c	Wed Feb  2 08:24:26 2011	(r218185)
+++ head/sys/netinet/sctp_sysctl.c	Wed Feb  2 11:13:23 2011	(r218186)
@@ -59,6 +59,7 @@ sctp_init_sysctls()
 	SCTP_BASE_SYSCTL(sctp_strict_init) = SCTPCTL_STRICT_INIT_DEFAULT;
 	SCTP_BASE_SYSCTL(sctp_peer_chunk_oh) = SCTPCTL_PEER_CHKOH_DEFAULT;
 	SCTP_BASE_SYSCTL(sctp_max_burst_default) = SCTPCTL_MAXBURST_DEFAULT;
+	SCTP_BASE_SYSCTL(sctp_fr_max_burst_default) = SCTPCTL_FRMAXBURST_DEFAULT;
 	SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue) = SCTPCTL_MAXCHUNKS_DEFAULT;
 	SCTP_BASE_SYSCTL(sctp_hashtblsize) = SCTPCTL_TCBHASHSIZE_DEFAULT;
 	SCTP_BASE_SYSCTL(sctp_pcbtblsize) = SCTPCTL_PCBHASHSIZE_DEFAULT;
@@ -576,6 +577,7 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS)
 		RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_init), SCTPCTL_STRICT_INIT_MIN, SCTPCTL_STRICT_INIT_MAX);
 		RANGECHK(SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), SCTPCTL_PEER_CHKOH_MIN, SCTPCTL_PEER_CHKOH_MAX);
 		RANGECHK(SCTP_BASE_SYSCTL(sctp_max_burst_default), SCTPCTL_MAXBURST_MIN, SCTPCTL_MAXBURST_MAX);
+		RANGECHK(SCTP_BASE_SYSCTL(sctp_fr_max_burst_default), SCTPCTL_FRMAXBURST_MIN, SCTPCTL_FRMAXBURST_MAX);
 		RANGECHK(SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue), SCTPCTL_MAXCHUNKS_MIN, SCTPCTL_MAXCHUNKS_MAX);
 		RANGECHK(SCTP_BASE_SYSCTL(sctp_hashtblsize), SCTPCTL_TCBHASHSIZE_MIN, SCTPCTL_TCBHASHSIZE_MAX);
 		RANGECHK(SCTP_BASE_SYSCTL(sctp_pcbtblsize), SCTPCTL_PCBHASHSIZE_MIN, SCTPCTL_PCBHASHSIZE_MAX);
@@ -849,6 +851,10 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, ma
     &SCTP_BASE_SYSCTL(sctp_max_burst_default), 0, sysctl_sctp_check, "IU",
     SCTPCTL_MAXBURST_DESC);
 
+SYSCTL_PROC(_net_inet_sctp, OID_AUTO, fr_maxburst, CTLTYPE_UINT | CTLFLAG_RW,
+    &SCTP_BASE_SYSCTL(sctp_fr_max_burst_default), 0, sysctl_sctp_check, "IU",
+    SCTPCTL_FRMAXBURST_DESC);
+
 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, maxchunks, CTLTYPE_UINT | CTLFLAG_RW,
     &SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue), 0, sysctl_sctp_check, "IU",
     SCTPCTL_MAXCHUNKS_DESC);

Modified: head/sys/netinet/sctp_sysctl.h
==============================================================================
--- head/sys/netinet/sctp_sysctl.h	Wed Feb  2 08:24:26 2011	(r218185)
+++ head/sys/netinet/sctp_sysctl.h	Wed Feb  2 11:13:23 2011	(r218186)
@@ -43,7 +43,7 @@ struct sctp_sysctl {
 	uint32_t sctp_auto_asconf;
 	uint32_t sctp_multiple_asconfs;
 	uint32_t sctp_ecn_enable;
-	uint32_t sctp_not_used;
+	uint32_t sctp_fr_max_burst_default;
 	uint32_t sctp_strict_sacks;
 #if !defined(SCTP_WITH_NO_CSUM)
 	uint32_t sctp_no_csum_on_loopback;
@@ -182,6 +182,13 @@ struct sctp_sysctl {
 #define SCTPCTL_MAXBURST_MAX		0xFFFFFFFF
 #define SCTPCTL_MAXBURST_DEFAULT	SCTP_DEF_MAX_BURST
 
+/* fr_maxburst: Default max burst for sctp endpoints when fast retransmitting */
+#define SCTPCTL_FRMAXBURST_DESC		"Default fr max burst for sctp endpoints"
+#define SCTPCTL_FRMAXBURST_MIN		0
+#define SCTPCTL_FRMAXBURST_MAX		0xFFFFFFFF
+#define SCTPCTL_FRMAXBURST_DEFAULT	SCTP_DEF_FRMAX_BURST
+
+
 /* maxchunks: Default max chunks on queue per asoc */
 #define SCTPCTL_MAXCHUNKS_DESC		"Default max chunks on queue per asoc"
 #define SCTPCTL_MAXCHUNKS_MIN		0
@@ -402,7 +409,7 @@ struct sctp_sysctl {
 #define SCTPCTL_HB_MAX_BURST_DESC	"Confirmation Heartbeat max burst"
 #define SCTPCTL_HB_MAX_BURST_MIN	1
 #define SCTPCTL_HB_MAX_BURST_MAX	0xFFFFFFFF
-#define SCTPCTL_HB_MAX_BURST_DEFAULT	SCTP_DEF_MAX_BURST
+#define SCTPCTL_HB_MAX_BURST_DEFAULT	SCTP_DEF_HBMAX_BURST
 
 /* abort_at_limit: When one-2-one hits qlimit abort */
 #define SCTPCTL_ABORT_AT_LIMIT_DESC	"When one-2-one hits qlimit abort"

Modified: head/sys/netinet/sctp_timer.c
==============================================================================
--- head/sys/netinet/sctp_timer.c	Wed Feb  2 08:24:26 2011	(r218185)
+++ head/sys/netinet/sctp_timer.c	Wed Feb  2 11:13:23 2011	(r218186)
@@ -1630,7 +1630,8 @@ sctp_heartbeat_timer(struct sctp_inpcb *
 				else if (ret == 0) {
 					break;
 				}
-				if (cnt_sent >= SCTP_BASE_SYSCTL(sctp_hb_maxburst))
+				if (SCTP_BASE_SYSCTL(sctp_hb_maxburst) &&
+				    (cnt_sent >= SCTP_BASE_SYSCTL(sctp_hb_maxburst)))
 					break;
 			}
 		}

Modified: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c	Wed Feb  2 08:24:26 2011	(r218185)
+++ head/sys/netinet/sctputil.c	Wed Feb  2 11:13:23 2011	(r218186)
@@ -913,6 +913,7 @@ sctp_init_asoc(struct sctp_inpcb *m, str
 	/* init all variables to a known value. */
 	SCTP_SET_STATE(&stcb->asoc, SCTP_STATE_INUSE);
 	asoc->max_burst = m->sctp_ep.max_burst;
+	asoc->fr_max_burst = m->sctp_ep.fr_max_burst;
 	asoc->heart_beat_delay = TICKS_TO_MSEC(m->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT]);
 	asoc->cookie_life = m->sctp_ep.def_cookie_life;
 	asoc->sctp_cmt_on_off = m->sctp_cmt_on_off;
@@ -2459,12 +2460,13 @@ sctp_mtu_size_reset(struct sctp_inpcb *i
  * given an association and starting time of the current RTT period return
  * RTO in number of msecs net should point to the current network
  */
+
 uint32_t
 sctp_calculate_rto(struct sctp_tcb *stcb,
     struct sctp_association *asoc,
     struct sctp_nets *net,
     struct timeval *told,
-    int safe)
+    int safe, int local_lan_determine)
 {
 	/*-
 	 * given an association and the starting time of the current RTT
@@ -2492,13 +2494,21 @@ sctp_calculate_rto(struct sctp_tcb *stcb
 	/************************/
 	/* get the current time */
 	(void)SCTP_GETTIME_TIMEVAL(&now);
-
 	/*
 	 * Record the real time of the last RTT for use in DC-CC.
 	 */
 	net->last_measured_rtt = now;
 	timevalsub(&net->last_measured_rtt, old);
 
+	/* Do we need to determine the lan type? */
+	if ((local_lan_determine == SCTP_DETERMINE_LL_OK) && (net->lan_type == SCTP_LAN_UNKNOWN)) {
+		if ((net->last_measured_rtt.tv_sec) ||
+		    (net->last_measured_rtt.tv_usec > SCTP_LOCAL_LAN_RTT)) {
+			net->lan_type = SCTP_LAN_INTERNET;
+		} else {
+			net->lan_type = SCTP_LAN_LOCAL;
+		}
+	}
 	/* compute the RTT value */
 	if ((u_long)now.tv_sec > (u_long)old->tv_sec) {
 		calc_time = ((u_long)now.tv_sec - (u_long)old->tv_sec) * 1000;

Modified: head/sys/netinet/sctputil.h
==============================================================================
--- head/sys/netinet/sctputil.h	Wed Feb  2 08:24:26 2011	(r218185)
+++ head/sys/netinet/sctputil.h	Wed Feb  2 11:13:23 2011	(r218186)
@@ -132,7 +132,7 @@ void
 
 uint32_t
 sctp_calculate_rto(struct sctp_tcb *, struct sctp_association *,
-    struct sctp_nets *, struct timeval *, int);
+    struct sctp_nets *, struct timeval *, int, int);
 
 uint32_t sctp_calculate_len(struct mbuf *);
 

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 14:41:32 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5999F106564A;
	Wed,  2 Feb 2011 14:41:32 +0000 (UTC)
	(envelope-from pluknet@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 48A6B8FC0A;
	Wed,  2 Feb 2011 14:41:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p12EfWXK012152;
	Wed, 2 Feb 2011 14:41:32 GMT (envelope-from pluknet@svn.freebsd.org)
Received: (from pluknet@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p12EfWkJ012150;
	Wed, 2 Feb 2011 14:41:32 GMT (envelope-from pluknet@svn.freebsd.org)
Message-Id: <201102021441.p12EfWkJ012150@svn.freebsd.org>
From: Sergey Kandaurov 
Date: Wed, 2 Feb 2011 14:41:32 +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: r218189 - head/sys/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 14:41:32 -0000

Author: pluknet
Date: Wed Feb  2 14:41:32 2011
New Revision: 218189
URL: http://svn.freebsd.org/changeset/base/218189

Log:
  Remove OpenSolaris include path referring to a non-existing directory
  never committed from p4 dtrace branch.
  [The correct include path is referenced from every opensolaris compat
  consumer's module Makefile, so it doesn't serve any purpose anyway.]
  
  Reported by:	arundel on freebsd-hackers@ via clang
  Approved by:	kib (mentor)
  MFC after:	1 week

Modified:
  head/sys/conf/kern.pre.mk

Modified: head/sys/conf/kern.pre.mk
==============================================================================
--- head/sys/conf/kern.pre.mk	Wed Feb  2 12:24:53 2011	(r218188)
+++ head/sys/conf/kern.pre.mk	Wed Feb  2 14:41:32 2011	(r218189)
@@ -82,9 +82,6 @@ INCLUDES+= -I$S/dev/twa
 # ...  and XFS
 INCLUDES+= -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs
 
-# ...  and OpenSolaris
-INCLUDES+= -I$S/contrib/opensolaris/compat
-
 # ... and the same for cxgb
 INCLUDES+= -I$S/dev/cxgb
 

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 14:59:05 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9B6241065670;
	Wed,  2 Feb 2011 14:59:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8A57A8FC1A;
	Wed,  2 Feb 2011 14:59:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p12Ex58D012580;
	Wed, 2 Feb 2011 14:59:05 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p12Ex5AK012578;
	Wed, 2 Feb 2011 14:59:05 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201102021459.p12Ex5AK012578@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 2 Feb 2011 14:59:05 +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: r218190 - head/sys/fs/ext2fs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 14:59:05 -0000

Author: jhb
Date: Wed Feb  2 14:59:05 2011
New Revision: 218190
URL: http://svn.freebsd.org/changeset/base/218190

Log:
  Fix build with DIAGNOSTIC enabled.
  
  Pointy hat to:	jhb

Modified:
  head/sys/fs/ext2fs/ext2_alloc.c

Modified: head/sys/fs/ext2fs/ext2_alloc.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_alloc.c	Wed Feb  2 14:41:32 2011	(r218189)
+++ head/sys/fs/ext2fs/ext2_alloc.c	Wed Feb  2 14:59:05 2011	(r218190)
@@ -730,13 +730,13 @@ retry:
 	}
 gotit:
 #ifdef DIAGNOSTIC
-	if (isset(bbp, (daddr_t)bno)) {
-		printf("ext2fs_alloccgblk: cg=%d bno=%d fs=%s\n",
-			cg, bno, fs->e2fs_fsmnt);
+	if (isset(bbp, bno)) {
+		printf("ext2fs_alloccgblk: cg=%d bno=%jd fs=%s\n",
+			cg, (intmax_t)bno, fs->e2fs_fsmnt);
 		panic("ext2fs_alloccg: dup alloc");
 	}
 #endif
-	setbit(bbp, (daddr_t)bno);
+	setbit(bbp, bno);
 	EXT2_LOCK(ump);
 	fs->e2fs->e2fs_fbcount--;
 	fs->e2fs_gd[cg].ext2bgd_nbfree--;

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 15:23:07 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CBAA11065670;
	Wed,  2 Feb 2011 15:23:07 +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 BA0888FC19;
	Wed,  2 Feb 2011 15:23:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p12FN7LT013252;
	Wed, 2 Feb 2011 15:23:07 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p12FN77o013250;
	Wed, 2 Feb 2011 15:23:07 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201102021523.p12FN77o013250@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Wed, 2 Feb 2011 15:23:07 +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: r218191 - head/sbin/hastd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 15:23:08 -0000

Author: pjd
Date: Wed Feb  2 15:23:07 2011
New Revision: 218191
URL: http://svn.freebsd.org/changeset/base/218191

Log:
  Move protocol allocation and deallocation to separate functions.
  
  MFC after:	1 week

Modified:
  head/sbin/hastd/proto.c

Modified: head/sbin/hastd/proto.c
==============================================================================
--- head/sbin/hastd/proto.c	Wed Feb  2 14:59:05 2011	(r218190)
+++ head/sbin/hastd/proto.c	Wed Feb  2 15:23:07 2011	(r218191)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 
 #include "pjdlog.h"
 #include "proto.h"
@@ -68,6 +69,40 @@ proto_register(struct hast_proto *proto,
 	}
 }
 
+static struct proto_conn *
+proto_alloc(struct hast_proto *proto, int side)
+{
+	struct proto_conn *conn;
+
+	PJDLOG_ASSERT(proto != NULL);
+	PJDLOG_ASSERT(side == PROTO_SIDE_CLIENT ||
+	    side == PROTO_SIDE_SERVER_LISTEN ||
+	    side == PROTO_SIDE_SERVER_WORK);
+
+	conn = malloc(sizeof(*conn));
+	if (conn != NULL) {
+		conn->pc_proto = proto;
+		conn->pc_side = side;
+		conn->pc_magic = PROTO_CONN_MAGIC;
+	}
+	return (conn);
+}
+
+static void
+proto_free(struct proto_conn *conn)
+{
+
+	PJDLOG_ASSERT(conn != NULL);
+	PJDLOG_ASSERT(conn->pc_magic == PROTO_CONN_MAGIC);
+	PJDLOG_ASSERT(conn->pc_side == PROTO_SIDE_CLIENT ||
+	    conn->pc_side == PROTO_SIDE_SERVER_LISTEN ||
+	    conn->pc_side == PROTO_SIDE_SERVER_WORK);
+	PJDLOG_ASSERT(conn->pc_proto != NULL);
+
+	bzero(conn, sizeof(*conn));
+	free(conn);
+}
+
 static int
 proto_common_setup(const char *addr, struct proto_conn **connp, int side)
 {
@@ -76,11 +111,8 @@ proto_common_setup(const char *addr, str
 	void *ctx;
 	int ret;
 
-	PJDLOG_ASSERT(side == PROTO_SIDE_CLIENT || side == PROTO_SIDE_SERVER_LISTEN);
-
-	conn = malloc(sizeof(*conn));
-	if (conn == NULL)
-		return (-1);
+	PJDLOG_ASSERT(side == PROTO_SIDE_CLIENT ||
+	    side == PROTO_SIDE_SERVER_LISTEN);
 
 	TAILQ_FOREACH(proto, &protos, hp_next) {
 		if (side == PROTO_SIDE_CLIENT) {
@@ -104,21 +136,24 @@ proto_common_setup(const char *addr, str
 	}
 	if (proto == NULL) {
 		/* Unrecognized address. */
-		free(conn);
 		errno = EINVAL;
 		return (-1);
 	}
 	if (ret > 0) {
 		/* An error occured. */
-		free(conn);
 		errno = ret;
 		return (-1);
 	}
-	conn->pc_proto = proto;
+	conn = proto_alloc(proto, side);
+	if (conn == NULL) {
+		if (proto->hp_close != NULL)
+			proto->hp_close(ctx);
+		errno = ENOMEM;
+		return (-1);
+	}
 	conn->pc_ctx = ctx;
-	conn->pc_side = side;
-	conn->pc_magic = PROTO_CONN_MAGIC;
 	*connp = conn;
+
 	return (0);
 }
 
@@ -168,20 +203,17 @@ proto_accept(struct proto_conn *conn, st
 	PJDLOG_ASSERT(conn->pc_proto != NULL);
 	PJDLOG_ASSERT(conn->pc_proto->hp_accept != NULL);
 
-	newconn = malloc(sizeof(*newconn));
+	newconn = proto_alloc(conn->pc_proto, PROTO_SIDE_SERVER_WORK);
 	if (newconn == NULL)
 		return (-1);
 
 	ret = conn->pc_proto->hp_accept(conn->pc_ctx, &newconn->pc_ctx);
 	if (ret != 0) {
-		free(newconn);
+		proto_free(newconn);
 		errno = ret;
 		return (-1);
 	}
 
-	newconn->pc_proto = conn->pc_proto;
-	newconn->pc_side = PROTO_SIDE_SERVER_WORK;
-	newconn->pc_magic = PROTO_CONN_MAGIC;
 	*newconnp = newconn;
 
 	return (0);
@@ -341,6 +373,5 @@ proto_close(struct proto_conn *conn)
 	PJDLOG_ASSERT(conn->pc_proto->hp_close != NULL);
 
 	conn->pc_proto->hp_close(conn->pc_ctx);
-	conn->pc_magic = 0;
-	free(conn);
+	proto_free(conn);
 }

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 15:42:00 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 671321065679;
	Wed,  2 Feb 2011 15:42:00 +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 54DB58FC18;
	Wed,  2 Feb 2011 15:42:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p12Fg08e013718;
	Wed, 2 Feb 2011 15:42:00 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p12Fg05o013711;
	Wed, 2 Feb 2011 15:42:00 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201102021542.p12Fg05o013711@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Wed, 2 Feb 2011 15:42:00 +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: r218192 - head/sbin/hastd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 15:42:00 -0000

Author: pjd
Date: Wed Feb  2 15:42:00 2011
New Revision: 218192
URL: http://svn.freebsd.org/changeset/base/218192

Log:
  Allow to specify connection timeout by the caller.
  
  MFC after:	1 week

Modified:
  head/sbin/hastd/primary.c
  head/sbin/hastd/proto.c
  head/sbin/hastd/proto.h
  head/sbin/hastd/proto_impl.h
  head/sbin/hastd/proto_tcp4.c
  head/sbin/hastd/proto_uds.c

Modified: head/sbin/hastd/primary.c
==============================================================================
--- head/sbin/hastd/primary.c	Wed Feb  2 15:23:07 2011	(r218191)
+++ head/sbin/hastd/primary.c	Wed Feb  2 15:42:00 2011	(r218192)
@@ -515,7 +515,7 @@ init_remote(struct hast_resource *res, s
 		    res->hr_remoteaddr);
 	}
 	/* Try to connect, but accept failure. */
-	if (proto_connect(out) < 0) {
+	if (proto_connect(out, HAST_TIMEOUT) < 0) {
 		pjdlog_errno(LOG_WARNING, "Unable to connect to %s",
 		    res->hr_remoteaddr);
 		goto close;
@@ -582,7 +582,7 @@ init_remote(struct hast_resource *res, s
 		    res->hr_remoteaddr);
 	}
 	/* Try to connect, but accept failure. */
-	if (proto_connect(in) < 0) {
+	if (proto_connect(in, HAST_TIMEOUT) < 0) {
 		pjdlog_errno(LOG_WARNING, "Unable to connect to %s",
 		    res->hr_remoteaddr);
 		goto close;

Modified: head/sbin/hastd/proto.c
==============================================================================
--- head/sbin/hastd/proto.c	Wed Feb  2 15:23:07 2011	(r218191)
+++ head/sbin/hastd/proto.c	Wed Feb  2 15:42:00 2011	(r218192)
@@ -165,7 +165,7 @@ proto_client(const char *addr, struct pr
 }
 
 int
-proto_connect(struct proto_conn *conn)
+proto_connect(struct proto_conn *conn, int timeout)
 {
 	int ret;
 
@@ -174,8 +174,9 @@ proto_connect(struct proto_conn *conn)
 	PJDLOG_ASSERT(conn->pc_side == PROTO_SIDE_CLIENT);
 	PJDLOG_ASSERT(conn->pc_proto != NULL);
 	PJDLOG_ASSERT(conn->pc_proto->hp_connect != NULL);
+	PJDLOG_ASSERT(timeout >= 0);
 
-	ret = conn->pc_proto->hp_connect(conn->pc_ctx);
+	ret = conn->pc_proto->hp_connect(conn->pc_ctx, timeout);
 	if (ret != 0) {
 		errno = ret;
 		return (-1);

Modified: head/sbin/hastd/proto.h
==============================================================================
--- head/sbin/hastd/proto.h	Wed Feb  2 15:23:07 2011	(r218191)
+++ head/sbin/hastd/proto.h	Wed Feb  2 15:42:00 2011	(r218192)
@@ -38,7 +38,7 @@
 struct proto_conn;
 
 int proto_client(const char *addr, struct proto_conn **connp);
-int proto_connect(struct proto_conn *conn);
+int proto_connect(struct proto_conn *conn, int timeout);
 int proto_server(const char *addr, struct proto_conn **connp);
 int proto_accept(struct proto_conn *conn, struct proto_conn **newconnp);
 int proto_send(const struct proto_conn *conn, const void *data, size_t size);

Modified: head/sbin/hastd/proto_impl.h
==============================================================================
--- head/sbin/hastd/proto_impl.h	Wed Feb  2 15:23:07 2011	(r218191)
+++ head/sbin/hastd/proto_impl.h	Wed Feb  2 15:42:00 2011	(r218192)
@@ -40,7 +40,7 @@
 #define	__constructor	__attribute__((constructor))
 
 typedef int hp_client_t(const char *, void **);
-typedef int hp_connect_t(void *);
+typedef int hp_connect_t(void *, int);
 typedef int hp_server_t(const char *, void **);
 typedef int hp_accept_t(void *, void **);
 typedef int hp_send_t(void *, const unsigned char *, size_t);

Modified: head/sbin/hastd/proto_tcp4.c
==============================================================================
--- head/sbin/hastd/proto_tcp4.c	Wed Feb  2 15:23:07 2011	(r218191)
+++ head/sbin/hastd/proto_tcp4.c	Wed Feb  2 15:42:00 2011	(r218192)
@@ -211,7 +211,7 @@ tcp4_client(const char *addr, void **ctx
 }
 
 static int
-tcp4_connect(void *ctx)
+tcp4_connect(void *ctx, int timeout)
 {
 	struct tcp4_ctx *tctx = ctx;
 	struct timeval tv;
@@ -223,6 +223,7 @@ tcp4_connect(void *ctx)
 	PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
 	PJDLOG_ASSERT(tctx->tc_side == TCP4_SIDE_CLIENT);
 	PJDLOG_ASSERT(tctx->tc_fd >= 0);
+	PJDLOG_ASSERT(timeout >= 0);
 
 	flags = fcntl(tctx->tc_fd, F_GETFL);
 	if (flags == -1) {
@@ -255,7 +256,7 @@ tcp4_connect(void *ctx)
 	 * Connection can't be established immediately, let's wait
 	 * for HAST_TIMEOUT seconds.
 	 */
-	tv.tv_sec = HAST_TIMEOUT;
+	tv.tv_sec = timeout;
 	tv.tv_usec = 0;
 again:
 	FD_ZERO(&fdset);

Modified: head/sbin/hastd/proto_uds.c
==============================================================================
--- head/sbin/hastd/proto_uds.c	Wed Feb  2 15:23:07 2011	(r218191)
+++ head/sbin/hastd/proto_uds.c	Wed Feb  2 15:42:00 2011	(r218192)
@@ -123,7 +123,7 @@ uds_client(const char *addr, void **ctxp
 }
 
 static int
-uds_connect(void *ctx)
+uds_connect(void *ctx, int timeout)
 {
 	struct uds_ctx *uctx = ctx;
 
@@ -131,6 +131,7 @@ uds_connect(void *ctx)
 	PJDLOG_ASSERT(uctx->uc_magic == UDS_CTX_MAGIC);
 	PJDLOG_ASSERT(uctx->uc_side == UDS_SIDE_CLIENT);
 	PJDLOG_ASSERT(uctx->uc_fd >= 0);
+	PJDLOG_ASSERT(timeout >= 0);
 
 	if (connect(uctx->uc_fd, (struct sockaddr *)&uctx->uc_sun,
 	    sizeof(uctx->uc_sun)) < 0) {

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 15:46:29 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 05C2D1065670;
	Wed,  2 Feb 2011 15:46:29 +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 E76E58FC19;
	Wed,  2 Feb 2011 15:46:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p12FkSrd013880;
	Wed, 2 Feb 2011 15:46:28 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p12FkS06013874;
	Wed, 2 Feb 2011 15:46:28 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201102021546.p12FkS06013874@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Wed, 2 Feb 2011 15:46:28 +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: r218193 - head/sbin/hastd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 15:46:29 -0000

Author: pjd
Date: Wed Feb  2 15:46:28 2011
New Revision: 218193
URL: http://svn.freebsd.org/changeset/base/218193

Log:
  Add proto_connect_wait() to wait for connection to finish.
  If timeout argument to proto_connect() is -1, then the caller needs to use
  this new function to wait for connection.
  
  This change is in preparation for capsicum, where sandboxed worker wants
  to ask main process to connect in worker's behalf and pass descriptor
  to the worker. Because we don't want the main process to wait for the
  connection, it will start async connection and pass descriptor to the
  worker who will be responsible for waiting for the connection to finish.
  
  MFC after:	1 week

Modified:
  head/sbin/hastd/proto.c
  head/sbin/hastd/proto.h
  head/sbin/hastd/proto_impl.h
  head/sbin/hastd/proto_tcp4.c
  head/sbin/hastd/proto_uds.c

Modified: head/sbin/hastd/proto.c
==============================================================================
--- head/sbin/hastd/proto.c	Wed Feb  2 15:42:00 2011	(r218192)
+++ head/sbin/hastd/proto.c	Wed Feb  2 15:46:28 2011	(r218193)
@@ -174,7 +174,7 @@ proto_connect(struct proto_conn *conn, i
 	PJDLOG_ASSERT(conn->pc_side == PROTO_SIDE_CLIENT);
 	PJDLOG_ASSERT(conn->pc_proto != NULL);
 	PJDLOG_ASSERT(conn->pc_proto->hp_connect != NULL);
-	PJDLOG_ASSERT(timeout >= 0);
+	PJDLOG_ASSERT(timeout >= -1);
 
 	ret = conn->pc_proto->hp_connect(conn->pc_ctx, timeout);
 	if (ret != 0) {
@@ -186,6 +186,27 @@ proto_connect(struct proto_conn *conn, i
 }
 
 int
+proto_connect_wait(struct proto_conn *conn, int timeout)
+{
+	int ret;
+
+	PJDLOG_ASSERT(conn != NULL);
+	PJDLOG_ASSERT(conn->pc_magic == PROTO_CONN_MAGIC);
+	PJDLOG_ASSERT(conn->pc_side == PROTO_SIDE_CLIENT);
+	PJDLOG_ASSERT(conn->pc_proto != NULL);
+	PJDLOG_ASSERT(conn->pc_proto->hp_connect_wait != NULL);
+	PJDLOG_ASSERT(timeout >= 0);
+
+	ret = conn->pc_proto->hp_connect_wait(conn->pc_ctx, timeout);
+	if (ret != 0) {
+		errno = ret;
+		return (-1);
+	}
+
+	return (0);
+}
+
+int
 proto_server(const char *addr, struct proto_conn **connp)
 {
 

Modified: head/sbin/hastd/proto.h
==============================================================================
--- head/sbin/hastd/proto.h	Wed Feb  2 15:42:00 2011	(r218192)
+++ head/sbin/hastd/proto.h	Wed Feb  2 15:46:28 2011	(r218193)
@@ -39,6 +39,7 @@ struct proto_conn;
 
 int proto_client(const char *addr, struct proto_conn **connp);
 int proto_connect(struct proto_conn *conn, int timeout);
+int proto_connect_wait(struct proto_conn *conn, int timeout);
 int proto_server(const char *addr, struct proto_conn **connp);
 int proto_accept(struct proto_conn *conn, struct proto_conn **newconnp);
 int proto_send(const struct proto_conn *conn, const void *data, size_t size);

Modified: head/sbin/hastd/proto_impl.h
==============================================================================
--- head/sbin/hastd/proto_impl.h	Wed Feb  2 15:42:00 2011	(r218192)
+++ head/sbin/hastd/proto_impl.h	Wed Feb  2 15:46:28 2011	(r218193)
@@ -41,6 +41,7 @@
 
 typedef int hp_client_t(const char *, void **);
 typedef int hp_connect_t(void *, int);
+typedef int hp_connect_wait_t(void *, int);
 typedef int hp_server_t(const char *, void **);
 typedef int hp_accept_t(void *, void **);
 typedef int hp_send_t(void *, const unsigned char *, size_t);
@@ -57,6 +58,7 @@ struct hast_proto {
 	const char	*hp_name;
 	hp_client_t	*hp_client;
 	hp_connect_t	*hp_connect;
+	hp_connect_wait_t *hp_connect_wait;
 	hp_server_t	*hp_server;
 	hp_accept_t	*hp_accept;
 	hp_send_t	*hp_send;

Modified: head/sbin/hastd/proto_tcp4.c
==============================================================================
--- head/sbin/hastd/proto_tcp4.c	Wed Feb  2 15:42:00 2011	(r218192)
+++ head/sbin/hastd/proto_tcp4.c	Wed Feb  2 15:46:28 2011	(r218193)
@@ -60,6 +60,7 @@ struct tcp4_ctx {
 #define	TCP4_SIDE_SERVER_WORK	2
 };
 
+static int tcp4_connect_wait(void *ctx, int timeout);
 static void tcp4_close(void *ctx);
 
 static in_addr_t
@@ -214,16 +215,14 @@ static int
 tcp4_connect(void *ctx, int timeout)
 {
 	struct tcp4_ctx *tctx = ctx;
-	struct timeval tv;
-	fd_set fdset;
-	socklen_t esize;
-	int error, flags, ret;
+	int error, flags;
 
 	PJDLOG_ASSERT(tctx != NULL);
 	PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
 	PJDLOG_ASSERT(tctx->tc_side == TCP4_SIDE_CLIENT);
 	PJDLOG_ASSERT(tctx->tc_fd >= 0);
-	PJDLOG_ASSERT(timeout >= 0);
+	PJDLOG_ASSERT(tctx->tc_sin.sin_family != AF_UNSPEC);
+	PJDLOG_ASSERT(timeout >= -1);
 
 	flags = fcntl(tctx->tc_fd, F_GETFL);
 	if (flags == -1) {
@@ -244,6 +243,8 @@ tcp4_connect(void *ctx, int timeout)
 
 	if (connect(tctx->tc_fd, (struct sockaddr *)&tctx->tc_sin,
 	    sizeof(tctx->tc_sin)) == 0) {
+		if (timeout == -1)
+			return (0);
 		error = 0;
 		goto done;
 	}
@@ -252,10 +253,35 @@ tcp4_connect(void *ctx, int timeout)
 		pjdlog_common(LOG_DEBUG, 1, errno, "connect() failed");
 		goto done;
 	}
-	/*
-	 * Connection can't be established immediately, let's wait
-	 * for HAST_TIMEOUT seconds.
-	 */
+	if (timeout == -1)
+		return (0);
+	return (tcp4_connect_wait(ctx, timeout));
+done:
+	flags &= ~O_NONBLOCK;
+	if (fcntl(tctx->tc_fd, F_SETFL, flags) == -1) {
+		if (error == 0)
+			error = errno;
+		pjdlog_common(LOG_DEBUG, 1, errno,
+		    "fcntl(F_SETFL, ~O_NONBLOCK) failed");
+	}
+	return (error);
+}
+
+static int
+tcp4_connect_wait(void *ctx, int timeout)
+{
+	struct tcp4_ctx *tctx = ctx;
+	struct timeval tv;
+	fd_set fdset;
+	socklen_t esize;
+	int error, flags, ret;
+
+	PJDLOG_ASSERT(tctx != NULL);
+	PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
+	PJDLOG_ASSERT(tctx->tc_side == TCP4_SIDE_CLIENT);
+	PJDLOG_ASSERT(tctx->tc_fd >= 0);
+	PJDLOG_ASSERT(timeout >= 0);
+
 	tv.tv_sec = timeout;
 	tv.tv_usec = 0;
 again:
@@ -289,6 +315,13 @@ again:
 	}
 	error = 0;
 done:
+	flags = fcntl(tctx->tc_fd, F_GETFL);
+	if (flags == -1) {
+		if (error == 0)
+			error = errno;
+		pjdlog_common(LOG_DEBUG, 1, errno, "fcntl(F_GETFL) failed");
+		return (error);
+	}
 	flags &= ~O_NONBLOCK;
 	if (fcntl(tctx->tc_fd, F_SETFL, flags) == -1) {
 		if (error == 0)
@@ -492,6 +525,7 @@ static struct hast_proto tcp4_proto = {
 	.hp_name = "tcp4",
 	.hp_client = tcp4_client,
 	.hp_connect = tcp4_connect,
+	.hp_connect_wait = tcp4_connect_wait,
 	.hp_server = tcp4_server,
 	.hp_accept = tcp4_accept,
 	.hp_send = tcp4_send,

Modified: head/sbin/hastd/proto_uds.c
==============================================================================
--- head/sbin/hastd/proto_uds.c	Wed Feb  2 15:42:00 2011	(r218192)
+++ head/sbin/hastd/proto_uds.c	Wed Feb  2 15:46:28 2011	(r218193)
@@ -131,7 +131,7 @@ uds_connect(void *ctx, int timeout)
 	PJDLOG_ASSERT(uctx->uc_magic == UDS_CTX_MAGIC);
 	PJDLOG_ASSERT(uctx->uc_side == UDS_SIDE_CLIENT);
 	PJDLOG_ASSERT(uctx->uc_fd >= 0);
-	PJDLOG_ASSERT(timeout >= 0);
+	PJDLOG_ASSERT(timeout >= -1);
 
 	if (connect(uctx->uc_fd, (struct sockaddr *)&uctx->uc_sun,
 	    sizeof(uctx->uc_sun)) < 0) {
@@ -142,6 +142,20 @@ uds_connect(void *ctx, int timeout)
 }
 
 static int
+uds_connect_wait(void *ctx, int timeout)
+{
+	struct uds_ctx *uctx = ctx;
+
+	PJDLOG_ASSERT(uctx != NULL);
+	PJDLOG_ASSERT(uctx->uc_magic == UDS_CTX_MAGIC);
+	PJDLOG_ASSERT(uctx->uc_side == UDS_SIDE_CLIENT);
+	PJDLOG_ASSERT(uctx->uc_fd >= 0);
+	PJDLOG_ASSERT(timeout >= 0);
+
+	return (0);
+}
+
+static int
 uds_server(const char *addr, void **ctxp)
 {
 	struct uds_ctx *uctx;
@@ -330,6 +344,7 @@ static struct hast_proto uds_proto = {
 	.hp_name = "uds",
 	.hp_client = uds_client,
 	.hp_connect = uds_connect,
+	.hp_connect_wait = uds_connect_wait,
 	.hp_server = uds_server,
 	.hp_accept = uds_accept,
 	.hp_send = uds_send,

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 15:53:09 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D94621065670;
	Wed,  2 Feb 2011 15:53:09 +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 C67818FC0A;
	Wed,  2 Feb 2011 15:53:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p12Fr9qv014051;
	Wed, 2 Feb 2011 15:53:09 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p12Fr9XP014043;
	Wed, 2 Feb 2011 15:53:09 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201102021553.p12Fr9XP014043@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Wed, 2 Feb 2011 15:53: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: r218194 - head/sbin/hastd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 15:53:10 -0000

Author: pjd
Date: Wed Feb  2 15:53:09 2011
New Revision: 218194
URL: http://svn.freebsd.org/changeset/base/218194

Log:
  - Rename proto_descriptor_{send,recv}() functions to
    proto_connection_{send,recv} and change them to return proto_conn
    structure. We don't operate directly on descriptors, but on
    proto_conns.
  - Add wrap method to wrap descriptor with proto_conn.
  - Remove methods to send and receive descriptors and implement this
    functionality as additional argument to send and receive methods.
  
  MFC after:	1 week

Modified:
  head/sbin/hastd/proto.c
  head/sbin/hastd/proto.h
  head/sbin/hastd/proto_common.c
  head/sbin/hastd/proto_impl.h
  head/sbin/hastd/proto_socketpair.c
  head/sbin/hastd/proto_tcp4.c
  head/sbin/hastd/proto_uds.c

Modified: head/sbin/hastd/proto.c
==============================================================================
--- head/sbin/hastd/proto.c	Wed Feb  2 15:46:28 2011	(r218193)
+++ head/sbin/hastd/proto.c	Wed Feb  2 15:53:09 2011	(r218194)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 
 #include "pjdlog.h"
@@ -251,7 +252,7 @@ proto_send(const struct proto_conn *conn
 	PJDLOG_ASSERT(conn->pc_proto != NULL);
 	PJDLOG_ASSERT(conn->pc_proto->hp_send != NULL);
 
-	ret = conn->pc_proto->hp_send(conn->pc_ctx, data, size);
+	ret = conn->pc_proto->hp_send(conn->pc_ctx, data, size, -1);
 	if (ret != 0) {
 		errno = ret;
 		return (-1);
@@ -269,7 +270,7 @@ proto_recv(const struct proto_conn *conn
 	PJDLOG_ASSERT(conn->pc_proto != NULL);
 	PJDLOG_ASSERT(conn->pc_proto->hp_recv != NULL);
 
-	ret = conn->pc_proto->hp_recv(conn->pc_ctx, data, size);
+	ret = conn->pc_proto->hp_recv(conn->pc_ctx, data, size, NULL);
 	if (ret != 0) {
 		errno = ret;
 		return (-1);
@@ -278,16 +279,26 @@ proto_recv(const struct proto_conn *conn
 }
 
 int
-proto_descriptor_send(const struct proto_conn *conn, int fd)
+proto_connection_send(const struct proto_conn *conn, struct proto_conn *mconn)
 {
-	int ret;
+	const char *protoname;
+	int ret, fd;
 
 	PJDLOG_ASSERT(conn != NULL);
 	PJDLOG_ASSERT(conn->pc_magic == PROTO_CONN_MAGIC);
 	PJDLOG_ASSERT(conn->pc_proto != NULL);
-	PJDLOG_ASSERT(conn->pc_proto->hp_descriptor_send != NULL);
-
-	ret = conn->pc_proto->hp_descriptor_send(conn->pc_ctx, fd);
+	PJDLOG_ASSERT(conn->pc_proto->hp_send != NULL);
+	PJDLOG_ASSERT(mconn != NULL);
+	PJDLOG_ASSERT(mconn->pc_magic == PROTO_CONN_MAGIC);
+	PJDLOG_ASSERT(mconn->pc_proto != NULL);
+	fd = proto_descriptor(mconn);
+	PJDLOG_ASSERT(fd >= 0);
+	protoname = mconn->pc_proto->hp_name;
+	PJDLOG_ASSERT(protoname != NULL);
+
+	ret = conn->pc_proto->hp_send(conn->pc_ctx, protoname,
+	    strlen(protoname) + 1, fd);
+	proto_close(mconn);
 	if (ret != 0) {
 		errno = ret;
 		return (-1);
@@ -296,20 +307,54 @@ proto_descriptor_send(const struct proto
 }
 
 int
-proto_descriptor_recv(const struct proto_conn *conn, int *fdp)
+proto_connection_recv(const struct proto_conn *conn, bool client,
+    struct proto_conn **newconnp)
 {
-	int ret;
+	char protoname[128];
+	struct hast_proto *proto;
+	struct proto_conn *newconn;
+	int ret, fd;
 
 	PJDLOG_ASSERT(conn != NULL);
 	PJDLOG_ASSERT(conn->pc_magic == PROTO_CONN_MAGIC);
 	PJDLOG_ASSERT(conn->pc_proto != NULL);
-	PJDLOG_ASSERT(conn->pc_proto->hp_descriptor_recv != NULL);
+	PJDLOG_ASSERT(conn->pc_proto->hp_recv != NULL);
+	PJDLOG_ASSERT(newconnp != NULL);
+
+	bzero(protoname, sizeof(protoname));
+
+	ret = conn->pc_proto->hp_recv(conn->pc_ctx, protoname,
+	    sizeof(protoname) - 1, &fd);
+	if (ret != 0) {
+		errno = ret;
+		return (-1);
+	}
+
+	PJDLOG_ASSERT(fd >= 0);
 
-	ret = conn->pc_proto->hp_descriptor_recv(conn->pc_ctx, fdp);
+	TAILQ_FOREACH(proto, &protos, hp_next) {
+		if (strcmp(proto->hp_name, protoname) == 0)
+			break;
+	}
+	if (proto == NULL) {
+		errno = EINVAL;
+		return (-1);
+	}
+
+	newconn = proto_alloc(proto,
+	    client ? PROTO_SIDE_CLIENT : PROTO_SIDE_SERVER_WORK);
+	if (newconn == NULL)
+		return (-1);
+	PJDLOG_ASSERT(newconn->pc_proto->hp_wrap != NULL);
+	ret = newconn->pc_proto->hp_wrap(fd, client, &newconn->pc_ctx);
 	if (ret != 0) {
+		proto_free(newconn);
 		errno = ret;
 		return (-1);
 	}
+
+	*newconnp = newconn;
+
 	return (0);
 }
 

Modified: head/sbin/hastd/proto.h
==============================================================================
--- head/sbin/hastd/proto.h	Wed Feb  2 15:46:28 2011	(r218193)
+++ head/sbin/hastd/proto.h	Wed Feb  2 15:53:09 2011	(r218194)
@@ -44,8 +44,10 @@ int proto_server(const char *addr, struc
 int proto_accept(struct proto_conn *conn, struct proto_conn **newconnp);
 int proto_send(const struct proto_conn *conn, const void *data, size_t size);
 int proto_recv(const struct proto_conn *conn, void *data, size_t size);
-int proto_descriptor_send(const struct proto_conn *conn, int fd);
-int proto_descriptor_recv(const struct proto_conn *conn, int *fdp);
+int proto_connection_send(const struct proto_conn *conn,
+    struct proto_conn *mconn);
+int proto_connection_recv(const struct proto_conn *conn, bool client,
+    struct proto_conn **newconnp);
 int proto_descriptor(const struct proto_conn *conn);
 bool proto_address_match(const struct proto_conn *conn, const char *addr);
 void proto_local_address(const struct proto_conn *conn, char *addr,

Modified: head/sbin/hastd/proto_common.c
==============================================================================
--- head/sbin/hastd/proto_common.c	Wed Feb  2 15:46:28 2011	(r218193)
+++ head/sbin/hastd/proto_common.c	Wed Feb  2 15:53:09 2011	(r218194)
@@ -45,54 +45,8 @@ __FBSDID("$FreeBSD$");
 #define	MAX_SEND_SIZE	32768
 #endif
 
-int
-proto_common_send(int sock, const unsigned char *data, size_t size)
-{
-	ssize_t done;
-	size_t sendsize;
-
-	PJDLOG_ASSERT(sock >= 0);
-	PJDLOG_ASSERT(data != NULL);
-	PJDLOG_ASSERT(size > 0);
-
-	do {
-		sendsize = size < MAX_SEND_SIZE ? size : MAX_SEND_SIZE;
-		done = send(sock, data, sendsize, MSG_NOSIGNAL);
-		if (done == 0)
-			return (ENOTCONN);
-		else if (done < 0) {
-			if (errno == EINTR)
-				continue;
-			return (errno);
-		}
-		data += done;
-		size -= done;
-	} while (size > 0);
-
-	return (0);
-}
-
-int
-proto_common_recv(int sock, unsigned char *data, size_t size)
-{
-	ssize_t done;
-
-	PJDLOG_ASSERT(sock >= 0);
-	PJDLOG_ASSERT(data != NULL);
-	PJDLOG_ASSERT(size > 0);
-
-	do {
-		done = recv(sock, data, size, MSG_WAITALL);
-	} while (done == -1 && errno == EINTR);
-	if (done == 0)
-		return (ENOTCONN);
-	else if (done < 0)
-		return (errno);
-	return (0);
-}
-
-int
-proto_common_descriptor_send(int sock, int fd)
+static int
+proto_descriptor_send(int sock, int fd)
 {
 	unsigned char ctrl[CMSG_SPACE(sizeof(fd))];
 	struct msghdr msg;
@@ -122,7 +76,37 @@ proto_common_descriptor_send(int sock, i
 }
 
 int
-proto_common_descriptor_recv(int sock, int *fdp)
+proto_common_send(int sock, const unsigned char *data, size_t size, int fd)
+{
+	ssize_t done;
+	size_t sendsize;
+
+	PJDLOG_ASSERT(sock >= 0);
+	PJDLOG_ASSERT(data != NULL);
+	PJDLOG_ASSERT(size > 0);
+
+	do {
+		sendsize = size < MAX_SEND_SIZE ? size : MAX_SEND_SIZE;
+		done = send(sock, data, sendsize, MSG_NOSIGNAL);
+		if (done == 0)
+			return (ENOTCONN);
+		else if (done < 0) {
+			if (errno == EINTR)
+				continue;
+			return (errno);
+		}
+		data += done;
+		size -= done;
+	} while (size > 0);
+
+	if (fd == -1)
+		return (0);
+	return (proto_descriptor_send(sock, fd));
+}
+
+#include 
+static int
+proto_descriptor_recv(int sock, int *fdp)
 {
 	unsigned char ctrl[CMSG_SPACE(sizeof(*fdp))];
 	struct msghdr msg;
@@ -144,10 +128,31 @@ proto_common_descriptor_recv(int sock, i
 
 	cmsg = CMSG_FIRSTHDR(&msg);
 	if (cmsg->cmsg_level != SOL_SOCKET ||
-	    cmsg->cmsg_type == SCM_RIGHTS) {
+	    cmsg->cmsg_type != SCM_RIGHTS) {
 		return (EINVAL);
 	}
 	bcopy(CMSG_DATA(cmsg), fdp, sizeof(*fdp));
 
 	return (0);
 }
+
+int
+proto_common_recv(int sock, unsigned char *data, size_t size, int *fdp)
+{
+	ssize_t done;
+
+	PJDLOG_ASSERT(sock >= 0);
+	PJDLOG_ASSERT(data != NULL);
+	PJDLOG_ASSERT(size > 0);
+
+	do {
+		done = recv(sock, data, size, MSG_WAITALL);
+	} while (done == -1 && errno == EINTR);
+	if (done == 0)
+		return (ENOTCONN);
+	else if (done < 0)
+		return (errno);
+	if (fdp == NULL)
+		return (0);
+	return (proto_descriptor_recv(sock, fdp));
+}

Modified: head/sbin/hastd/proto_impl.h
==============================================================================
--- head/sbin/hastd/proto_impl.h	Wed Feb  2 15:46:28 2011	(r218193)
+++ head/sbin/hastd/proto_impl.h	Wed Feb  2 15:53:09 2011	(r218194)
@@ -44,10 +44,9 @@ typedef int hp_connect_t(void *, int);
 typedef int hp_connect_wait_t(void *, int);
 typedef int hp_server_t(const char *, void **);
 typedef int hp_accept_t(void *, void **);
-typedef int hp_send_t(void *, const unsigned char *, size_t);
-typedef int hp_recv_t(void *, unsigned char *, size_t);
-typedef int hp_descriptor_send_t(void *, int);
-typedef int hp_descriptor_recv_t(void *, int *);
+typedef int hp_wrap_t(int, bool, void **);
+typedef int hp_send_t(void *, const unsigned char *, size_t, int);
+typedef int hp_recv_t(void *, unsigned char *, size_t, int *);
 typedef int hp_descriptor_t(const void *);
 typedef bool hp_address_match_t(const void *, const char *);
 typedef void hp_local_address_t(const void *, char *, size_t);
@@ -55,29 +54,26 @@ typedef void hp_remote_address_t(const v
 typedef void hp_close_t(void *);
 
 struct hast_proto {
-	const char	*hp_name;
-	hp_client_t	*hp_client;
-	hp_connect_t	*hp_connect;
-	hp_connect_wait_t *hp_connect_wait;
-	hp_server_t	*hp_server;
-	hp_accept_t	*hp_accept;
-	hp_send_t	*hp_send;
-	hp_recv_t	*hp_recv;
-	hp_descriptor_send_t *hp_descriptor_send;
-	hp_descriptor_recv_t *hp_descriptor_recv;
-	hp_descriptor_t	*hp_descriptor;
-	hp_address_match_t *hp_address_match;
-	hp_local_address_t *hp_local_address;
-	hp_remote_address_t *hp_remote_address;
-	hp_close_t	*hp_close;
-	TAILQ_ENTRY(hast_proto) hp_next;
+	const char		*hp_name;
+	hp_client_t		*hp_client;
+	hp_connect_t		*hp_connect;
+	hp_connect_wait_t	*hp_connect_wait;
+	hp_server_t		*hp_server;
+	hp_accept_t		*hp_accept;
+	hp_wrap_t		*hp_wrap;
+	hp_send_t		*hp_send;
+	hp_recv_t		*hp_recv;
+	hp_descriptor_t		*hp_descriptor;
+	hp_address_match_t	*hp_address_match;
+	hp_local_address_t	*hp_local_address;
+	hp_remote_address_t	*hp_remote_address;
+	hp_close_t		*hp_close;
+	TAILQ_ENTRY(hast_proto)	 hp_next;
 };
 
 void proto_register(struct hast_proto *proto, bool isdefault);
 
-int proto_common_send(int sock, const unsigned char *data, size_t size);
-int proto_common_recv(int sock, unsigned char *data, size_t size);
-int proto_common_descriptor_send(int sock, int fd);
-int proto_common_descriptor_recv(int sock, int *fdp);
+int proto_common_send(int sock, const unsigned char *data, size_t size, int fd);
+int proto_common_recv(int sock, unsigned char *data, size_t size, int *fdp);
 
 #endif	/* !_PROTO_IMPL_H_ */

Modified: head/sbin/hastd/proto_socketpair.c
==============================================================================
--- head/sbin/hastd/proto_socketpair.c	Wed Feb  2 15:46:28 2011	(r218193)
+++ head/sbin/hastd/proto_socketpair.c	Wed Feb  2 15:53:09 2011	(r218194)
@@ -83,10 +83,10 @@ sp_client(const char *addr, void **ctxp)
 }
 
 static int
-sp_send(void *ctx, const unsigned char *data, size_t size)
+sp_send(void *ctx, const unsigned char *data, size_t size, int fd)
 {
 	struct sp_ctx *spctx = ctx;
-	int fd;
+	int sock;
 
 	PJDLOG_ASSERT(spctx != NULL);
 	PJDLOG_ASSERT(spctx->sp_magic == SP_CTX_MAGIC);
@@ -95,7 +95,7 @@ sp_send(void *ctx, const unsigned char *
 	case SP_SIDE_UNDEF:
 		/*
 		 * If the first operation done by the caller is proto_send(),
-		 * we assume this the client.
+		 * we assume this is the client.
 		 */
 		/* FALLTHROUGH */
 		spctx->sp_side = SP_SIDE_CLIENT;
@@ -104,11 +104,11 @@ sp_send(void *ctx, const unsigned char *
 		spctx->sp_fd[1] = -1;
 	case SP_SIDE_CLIENT:
 		PJDLOG_ASSERT(spctx->sp_fd[0] >= 0);
-		fd = spctx->sp_fd[0];
+		sock = spctx->sp_fd[0];
 		break;
 	case SP_SIDE_SERVER:
 		PJDLOG_ASSERT(spctx->sp_fd[1] >= 0);
-		fd = spctx->sp_fd[1];
+		sock = spctx->sp_fd[1];
 		break;
 	default:
 		PJDLOG_ABORT("Invalid socket side (%d).", spctx->sp_side);
@@ -118,11 +118,11 @@ sp_send(void *ctx, const unsigned char *
 	if (data == NULL)
 		return (0);
 
-	return (proto_common_send(fd, data, size));
+	return (proto_common_send(sock, data, size, fd));
 }
 
 static int
-sp_recv(void *ctx, unsigned char *data, size_t size)
+sp_recv(void *ctx, unsigned char *data, size_t size, int *fdp)
 {
 	struct sp_ctx *spctx = ctx;
 	int fd;
@@ -134,7 +134,7 @@ sp_recv(void *ctx, unsigned char *data, 
 	case SP_SIDE_UNDEF:
 		/*
 		 * If the first operation done by the caller is proto_recv(),
-		 * we assume this the server.
+		 * we assume this is the server.
 		 */
 		/* FALLTHROUGH */
 		spctx->sp_side = SP_SIDE_SERVER;
@@ -157,35 +157,7 @@ sp_recv(void *ctx, unsigned char *data, 
 	if (data == NULL)
 		return (0);
 
-	return (proto_common_recv(fd, data, size));
-}
-
-static int
-sp_descriptor_send(void *ctx, int fd)
-{
-	struct sp_ctx *spctx = ctx;
-
-	PJDLOG_ASSERT(spctx != NULL);
-	PJDLOG_ASSERT(spctx->sp_magic == SP_CTX_MAGIC);
-	PJDLOG_ASSERT(spctx->sp_side == SP_SIDE_CLIENT);
-	PJDLOG_ASSERT(spctx->sp_fd[0] >= 0);
-	PJDLOG_ASSERT(fd > 0);
-
-	return (proto_common_descriptor_send(spctx->sp_fd[0], fd));
-}
-
-static int
-sp_descriptor_recv(void *ctx, int *fdp)
-{
-	struct sp_ctx *spctx = ctx;
-
-	PJDLOG_ASSERT(spctx != NULL);
-	PJDLOG_ASSERT(spctx->sp_magic == SP_CTX_MAGIC);
-	PJDLOG_ASSERT(spctx->sp_side == SP_SIDE_SERVER);
-	PJDLOG_ASSERT(spctx->sp_fd[1] >= 0);
-	PJDLOG_ASSERT(fdp != NULL);
-
-	return (proto_common_descriptor_recv(spctx->sp_fd[1], fdp));
+	return (proto_common_recv(fd, data, size, fdp));
 }
 
 static int
@@ -252,8 +224,6 @@ static struct hast_proto sp_proto = {
 	.hp_client = sp_client,
 	.hp_send = sp_send,
 	.hp_recv = sp_recv,
-	.hp_descriptor_send = sp_descriptor_send,
-	.hp_descriptor_recv = sp_descriptor_recv,
 	.hp_descriptor = sp_descriptor,
 	.hp_close = sp_close
 };

Modified: head/sbin/hastd/proto_tcp4.c
==============================================================================
--- head/sbin/hastd/proto_tcp4.c	Wed Feb  2 15:46:28 2011	(r218193)
+++ head/sbin/hastd/proto_tcp4.c	Wed Feb  2 15:53:09 2011	(r218194)
@@ -168,11 +168,16 @@ tcp4_addr(const char *addr, struct socka
 }
 
 static int
-tcp4_common_setup(const char *addr, void **ctxp, int side)
+tcp4_setup_new(const char *addr, int side, void **ctxp)
 {
 	struct tcp4_ctx *tctx;
 	int ret, nodelay;
 
+	PJDLOG_ASSERT(addr != NULL);
+	PJDLOG_ASSERT(side == TCP4_SIDE_CLIENT ||
+	    side == TCP4_SIDE_SERVER_LISTEN);
+	PJDLOG_ASSERT(ctxp != NULL);
+
 	tctx = malloc(sizeof(*tctx));
 	if (tctx == NULL)
 		return (errno);
@@ -183,6 +188,8 @@ tcp4_common_setup(const char *addr, void
 		return (ret);
 	}
 
+	PJDLOG_ASSERT(tctx->tc_sin.sin_family != AF_UNSPEC);
+
 	tctx->tc_fd = socket(AF_INET, SOCK_STREAM, 0);
 	if (tctx->tc_fd == -1) {
 		ret = errno;
@@ -194,7 +201,7 @@ tcp4_common_setup(const char *addr, void
 	nodelay = 1;
 	if (setsockopt(tctx->tc_fd, IPPROTO_TCP, TCP_NODELAY, &nodelay,
 	    sizeof(nodelay)) == -1) {
-		pjdlog_warning("Unable to set TCP_NOELAY on %s", addr);
+		pjdlog_errno(LOG_WARNING, "Unable to set TCP_NOELAY");
 	}
 
 	tctx->tc_side = side;
@@ -205,10 +212,33 @@ tcp4_common_setup(const char *addr, void
 }
 
 static int
+tcp4_setup_wrap(int fd, int side, void **ctxp)
+{
+	struct tcp4_ctx *tctx;
+
+	PJDLOG_ASSERT(fd >= 0);
+	PJDLOG_ASSERT(side == TCP4_SIDE_CLIENT ||
+	    side == TCP4_SIDE_SERVER_WORK);
+	PJDLOG_ASSERT(ctxp != NULL);
+
+	tctx = malloc(sizeof(*tctx));
+	if (tctx == NULL)
+		return (errno);
+
+	tctx->tc_fd = fd;
+	tctx->tc_sin.sin_family = AF_UNSPEC;
+	tctx->tc_side = side;
+	tctx->tc_magic = TCP4_CTX_MAGIC;
+	*ctxp = tctx;
+
+	return (0);
+}
+
+static int
 tcp4_client(const char *addr, void **ctxp)
 {
 
-	return (tcp4_common_setup(addr, ctxp, TCP4_SIDE_CLIENT));
+	return (tcp4_setup_new(addr, TCP4_SIDE_CLIENT, ctxp));
 }
 
 static int
@@ -338,7 +368,7 @@ tcp4_server(const char *addr, void **ctx
 	struct tcp4_ctx *tctx;
 	int ret, val;
 
-	ret = tcp4_common_setup(addr, ctxp, TCP4_SIDE_SERVER_LISTEN);
+	ret = tcp4_setup_new(addr, TCP4_SIDE_SERVER_LISTEN, ctxp);
 	if (ret != 0)
 		return (ret);
 
@@ -349,6 +379,8 @@ tcp4_server(const char *addr, void **ctx
 	(void)setsockopt(tctx->tc_fd, SOL_SOCKET, SO_REUSEADDR, &val,
 	   sizeof(val));
 
+	PJDLOG_ASSERT(tctx->tc_sin.sin_family != AF_UNSPEC);
+
 	if (bind(tctx->tc_fd, (struct sockaddr *)&tctx->tc_sin,
 	    sizeof(tctx->tc_sin)) < 0) {
 		ret = errno;
@@ -376,6 +408,7 @@ tcp4_accept(void *ctx, void **newctxp)
 	PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
 	PJDLOG_ASSERT(tctx->tc_side == TCP4_SIDE_SERVER_LISTEN);
 	PJDLOG_ASSERT(tctx->tc_fd >= 0);
+	PJDLOG_ASSERT(tctx->tc_sin.sin_family != AF_UNSPEC);
 
 	newtctx = malloc(sizeof(*newtctx));
 	if (newtctx == NULL)
@@ -398,27 +431,37 @@ tcp4_accept(void *ctx, void **newctxp)
 }
 
 static int
-tcp4_send(void *ctx, const unsigned char *data, size_t size)
+tcp4_wrap(int fd, bool client, void **ctxp)
+{
+
+	return (tcp4_setup_wrap(fd,
+	    client ? TCP4_SIDE_CLIENT : TCP4_SIDE_SERVER_WORK, ctxp));
+}
+
+static int
+tcp4_send(void *ctx, const unsigned char *data, size_t size, int fd)
 {
 	struct tcp4_ctx *tctx = ctx;
 
 	PJDLOG_ASSERT(tctx != NULL);
 	PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
 	PJDLOG_ASSERT(tctx->tc_fd >= 0);
+	PJDLOG_ASSERT(fd == -1);
 
-	return (proto_common_send(tctx->tc_fd, data, size));
+	return (proto_common_send(tctx->tc_fd, data, size, -1));
 }
 
 static int
-tcp4_recv(void *ctx, unsigned char *data, size_t size)
+tcp4_recv(void *ctx, unsigned char *data, size_t size, int *fdp)
 {
 	struct tcp4_ctx *tctx = ctx;
 
 	PJDLOG_ASSERT(tctx != NULL);
 	PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
 	PJDLOG_ASSERT(tctx->tc_fd >= 0);
+	PJDLOG_ASSERT(fdp == NULL);
 
-	return (proto_common_recv(tctx->tc_fd, data, size));
+	return (proto_common_recv(tctx->tc_fd, data, size, NULL));
 }
 
 static int
@@ -528,6 +571,7 @@ static struct hast_proto tcp4_proto = {
 	.hp_connect_wait = tcp4_connect_wait,
 	.hp_server = tcp4_server,
 	.hp_accept = tcp4_accept,
+	.hp_wrap = tcp4_wrap,
 	.hp_send = tcp4_send,
 	.hp_recv = tcp4_recv,
 	.hp_descriptor = tcp4_descriptor,

Modified: head/sbin/hastd/proto_uds.c
==============================================================================
--- head/sbin/hastd/proto_uds.c	Wed Feb  2 15:46:28 2011	(r218193)
+++ head/sbin/hastd/proto_uds.c	Wed Feb  2 15:53:09 2011	(r218194)
@@ -217,7 +217,7 @@ uds_accept(void *ctx, void **newctxp)
 }
 
 static int
-uds_send(void *ctx, const unsigned char *data, size_t size)
+uds_send(void *ctx, const unsigned char *data, size_t size, int fd)
 {
 	struct uds_ctx *uctx = ctx;
 
@@ -225,11 +225,11 @@ uds_send(void *ctx, const unsigned char 
 	PJDLOG_ASSERT(uctx->uc_magic == UDS_CTX_MAGIC);
 	PJDLOG_ASSERT(uctx->uc_fd >= 0);
 
-	return (proto_common_send(uctx->uc_fd, data, size));
+	return (proto_common_send(uctx->uc_fd, data, size, fd));
 }
 
 static int
-uds_recv(void *ctx, unsigned char *data, size_t size)
+uds_recv(void *ctx, unsigned char *data, size_t size, int *fdp)
 {
 	struct uds_ctx *uctx = ctx;
 
@@ -237,33 +237,7 @@ uds_recv(void *ctx, unsigned char *data,
 	PJDLOG_ASSERT(uctx->uc_magic == UDS_CTX_MAGIC);
 	PJDLOG_ASSERT(uctx->uc_fd >= 0);
 
-	return (proto_common_recv(uctx->uc_fd, data, size));
-}
-
-static int
-uds_descriptor_send(void *ctx, int fd)
-{
-	struct uds_ctx *uctx = ctx;
-
-	PJDLOG_ASSERT(uctx != NULL);
-	PJDLOG_ASSERT(uctx->uc_magic == UDS_CTX_MAGIC);
-	PJDLOG_ASSERT(uctx->uc_fd >= 0);
-	PJDLOG_ASSERT(fd >= 0);
-
-	return (proto_common_descriptor_send(uctx->uc_fd, fd));
-}
-
-static int
-uds_descriptor_recv(void *ctx, int *fdp)
-{
-	struct uds_ctx *uctx = ctx;
-
-	PJDLOG_ASSERT(uctx != NULL);
-	PJDLOG_ASSERT(uctx->uc_magic == UDS_CTX_MAGIC);
-	PJDLOG_ASSERT(uctx->uc_fd >= 0);
-	PJDLOG_ASSERT(fdp != NULL);
-
-	return (proto_common_descriptor_recv(uctx->uc_fd, fdp));
+	return (proto_common_recv(uctx->uc_fd, data, size, fdp));
 }
 
 static int
@@ -349,8 +323,6 @@ static struct hast_proto uds_proto = {
 	.hp_accept = uds_accept,
 	.hp_send = uds_send,
 	.hp_recv = uds_recv,
-	.hp_descriptor_send = uds_descriptor_send,
-	.hp_descriptor_recv = uds_descriptor_recv,
 	.hp_descriptor = uds_descriptor,
 	.hp_local_address = uds_local_address,
 	.hp_remote_address = uds_remote_address,

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 16:35:10 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BBB74106564A;
	Wed,  2 Feb 2011 16:35:10 +0000 (UTC) (envelope-from mdf@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A6B8A8FC1A;
	Wed,  2 Feb 2011 16:35:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p12GZAo6015187;
	Wed, 2 Feb 2011 16:35:10 GMT (envelope-from mdf@svn.freebsd.org)
Received: (from mdf@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p12GZA94015170;
	Wed, 2 Feb 2011 16:35:10 GMT (envelope-from mdf@svn.freebsd.org)
Message-Id: <201102021635.p12GZA94015170@svn.freebsd.org>
From: Matthew D Fleming 
Date: Wed, 2 Feb 2011 16:35: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: r218195 - in head/sys: amd64/amd64 arm/arm i386/i386
	ia64/ia64 kern mips/mips powerpc/powerpc sparc64/sparc64
	sun4v/sun4v sys ufs/ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 16:35:10 -0000

Author: mdf
Date: Wed Feb  2 16:35:10 2011
New Revision: 218195
URL: http://svn.freebsd.org/changeset/base/218195

Log:
  Put the general logic for being a CPU hog into a new function
  should_yield().  Use this in various places.  Encapsulate the common
  case of check-and-yield into a new function maybe_yield().
  
  Change several checks for a magic number of iterations to use
  should_yield() instead.
  
  MFC after:	1 week

Modified:
  head/sys/amd64/amd64/uio_machdep.c
  head/sys/arm/arm/uio_machdep.c
  head/sys/i386/i386/uio_machdep.c
  head/sys/ia64/ia64/uio_machdep.c
  head/sys/kern/imgact_elf.c
  head/sys/kern/subr_uio.c
  head/sys/kern/vfs_mount.c
  head/sys/kern/vfs_subr.c
  head/sys/mips/mips/uio_machdep.c
  head/sys/powerpc/powerpc/uio_machdep.c
  head/sys/sparc64/sparc64/uio_machdep.c
  head/sys/sun4v/sun4v/uio_machdep.c
  head/sys/sys/uio.h
  head/sys/sys/vnode.h
  head/sys/ufs/ffs/ffs_rawread.c
  head/sys/ufs/ffs/ffs_softdep.c

Modified: head/sys/amd64/amd64/uio_machdep.c
==============================================================================
--- head/sys/amd64/amd64/uio_machdep.c	Wed Feb  2 15:53:09 2011	(r218194)
+++ head/sys/amd64/amd64/uio_machdep.c	Wed Feb  2 16:35:10 2011	(r218195)
@@ -88,8 +88,7 @@ uiomove_fromphys(vm_page_t ma[], vm_offs
 		    page_offset;
 		switch (uio->uio_segflg) {
 		case UIO_USERSPACE:
-			if (ticks - PCPU_GET(switchticks) >= hogticks)
-				uio_yield();
+			maybe_yield();
 			if (uio->uio_rw == UIO_READ)
 				error = copyout(cp, iov->iov_base, cnt);
 			else

Modified: head/sys/arm/arm/uio_machdep.c
==============================================================================
--- head/sys/arm/arm/uio_machdep.c	Wed Feb  2 15:53:09 2011	(r218194)
+++ head/sys/arm/arm/uio_machdep.c	Wed Feb  2 16:35:10 2011	(r218195)
@@ -94,8 +94,7 @@ uiomove_fromphys(vm_page_t ma[], vm_offs
 		cp = (char*)sf_buf_kva(sf) + page_offset;
 		switch (uio->uio_segflg) {
 		case UIO_USERSPACE:
-			if (ticks - PCPU_GET(switchticks) >= hogticks)
-				uio_yield();
+			maybe_yield();
 			if (uio->uio_rw == UIO_READ)
 				error = copyout(cp, iov->iov_base, cnt);
 			else

Modified: head/sys/i386/i386/uio_machdep.c
==============================================================================
--- head/sys/i386/i386/uio_machdep.c	Wed Feb  2 15:53:09 2011	(r218194)
+++ head/sys/i386/i386/uio_machdep.c	Wed Feb  2 16:35:10 2011	(r218195)
@@ -90,8 +90,7 @@ uiomove_fromphys(vm_page_t ma[], vm_offs
 		cp = (char *)sf_buf_kva(sf) + page_offset;
 		switch (uio->uio_segflg) {
 		case UIO_USERSPACE:
-			if (ticks - PCPU_GET(switchticks) >= hogticks)
-				uio_yield();
+			maybe_yield();
 			if (uio->uio_rw == UIO_READ)
 				error = copyout(cp, iov->iov_base, cnt);
 			else

Modified: head/sys/ia64/ia64/uio_machdep.c
==============================================================================
--- head/sys/ia64/ia64/uio_machdep.c	Wed Feb  2 15:53:09 2011	(r218194)
+++ head/sys/ia64/ia64/uio_machdep.c	Wed Feb  2 16:35:10 2011	(r218195)
@@ -89,8 +89,7 @@ uiomove_fromphys(vm_page_t ma[], vm_offs
 		    page_offset;
 		switch (uio->uio_segflg) {
 		case UIO_USERSPACE:
-			if (ticks - PCPU_GET(switchticks) >= hogticks)
-				uio_yield();
+			maybe_yield();
 			if (uio->uio_rw == UIO_READ)
 				error = copyout(cp, iov->iov_base, cnt);
 			else

Modified: head/sys/kern/imgact_elf.c
==============================================================================
--- head/sys/kern/imgact_elf.c	Wed Feb  2 15:53:09 2011	(r218194)
+++ head/sys/kern/imgact_elf.c	Wed Feb  2 16:35:10 2011	(r218195)
@@ -1622,8 +1622,7 @@ compress_core (gzFile file, char *inbuf,
 		}
 		inbuf += chunk_len;
 		len -= chunk_len;
-		if (ticks - PCPU_GET(switchticks) >= hogticks)
-			uio_yield();
+		maybe_yield();
 	}
 
 	return (error);

Modified: head/sys/kern/subr_uio.c
==============================================================================
--- head/sys/kern/subr_uio.c	Wed Feb  2 15:53:09 2011	(r218194)
+++ head/sys/kern/subr_uio.c	Wed Feb  2 16:35:10 2011	(r218195)
@@ -158,8 +158,7 @@ uiomove(void *cp, int n, struct uio *uio
 		switch (uio->uio_segflg) {
 
 		case UIO_USERSPACE:
-			if (ticks - PCPU_GET(switchticks) >= hogticks)
-				uio_yield();
+			maybe_yield();
 			if (uio->uio_rw == UIO_READ)
 				error = copyout(cp, iov->iov_base, cnt);
 			else
@@ -283,11 +282,8 @@ uiomoveco(void *cp, int n, struct uio *u
 		switch (uio->uio_segflg) {
 
 		case UIO_USERSPACE:
-			if (ticks - PCPU_GET(switchticks) >= hogticks)
-				uio_yield();
-
+			maybe_yield();
 			error = userspaceco(cp, cnt, uio, disposable);
-
 			if (error)
 				return (error);
 			break;
@@ -356,6 +352,21 @@ again:
 	return (0);
 }
 
+int
+should_yield(void)
+{
+
+	return (ticks - PCPU_GET(switchticks) >= hogticks);
+}
+
+void
+maybe_yield(void)
+{
+
+	if (should_yield())
+		uio_yield();
+}
+
 void
 uio_yield(void)
 {

Modified: head/sys/kern/vfs_mount.c
==============================================================================
--- head/sys/kern/vfs_mount.c	Wed Feb  2 15:53:09 2011	(r218194)
+++ head/sys/kern/vfs_mount.c	Wed Feb  2 16:35:10 2011	(r218195)
@@ -1659,9 +1659,8 @@ __mnt_vnode_next(struct vnode **mvp, str
 	mtx_assert(MNT_MTX(mp), MA_OWNED);
 
 	KASSERT((*mvp)->v_mount == mp, ("marker vnode mount list mismatch"));
-	if ((*mvp)->v_yield++ == 500) {
+	if (should_yield()) {
 		MNT_IUNLOCK(mp);
-		(*mvp)->v_yield = 0;
 		uio_yield();
 		MNT_ILOCK(mp);
 	}

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Wed Feb  2 15:53:09 2011	(r218194)
+++ head/sys/kern/vfs_subr.c	Wed Feb  2 16:35:10 2011	(r218195)
@@ -707,11 +707,11 @@ vlrureclaim(struct mount *mp)
 		vdropl(vp);
 		done++;
 next_iter_mntunlocked:
-		if ((count % 256) != 0)
+		if (should_yield())
 			goto relock_mnt;
 		goto yield;
 next_iter:
-		if ((count % 256) != 0)
+		if (should_yield())
 			continue;
 		MNT_IUNLOCK(mp);
 yield:

Modified: head/sys/mips/mips/uio_machdep.c
==============================================================================
--- head/sys/mips/mips/uio_machdep.c	Wed Feb  2 15:53:09 2011	(r218194)
+++ head/sys/mips/mips/uio_machdep.c	Wed Feb  2 16:35:10 2011	(r218195)
@@ -107,8 +107,7 @@ uiomove_fromphys(vm_page_t ma[], vm_offs
 		}
 		switch (uio->uio_segflg) {
 		case UIO_USERSPACE:
-			if (ticks - PCPU_GET(switchticks) >= hogticks)
-				uio_yield();
+			maybe_yield();
 			if (uio->uio_rw == UIO_READ)
 				error = copyout(cp, iov->iov_base, cnt);
 			else

Modified: head/sys/powerpc/powerpc/uio_machdep.c
==============================================================================
--- head/sys/powerpc/powerpc/uio_machdep.c	Wed Feb  2 15:53:09 2011	(r218194)
+++ head/sys/powerpc/powerpc/uio_machdep.c	Wed Feb  2 16:35:10 2011	(r218195)
@@ -97,8 +97,7 @@ uiomove_fromphys(vm_page_t ma[], vm_offs
 
 		switch (uio->uio_segflg) {
 			case UIO_USERSPACE:
-				if (ticks - PCPU_GET(switchticks) >= hogticks)
-					uio_yield();
+				maybe_yield();
 				if (uio->uio_rw == UIO_READ)
 					error = copyout(cp, iov->iov_base, cnt);
 				else

Modified: head/sys/sparc64/sparc64/uio_machdep.c
==============================================================================
--- head/sys/sparc64/sparc64/uio_machdep.c	Wed Feb  2 15:53:09 2011	(r218194)
+++ head/sys/sparc64/sparc64/uio_machdep.c	Wed Feb  2 16:35:10 2011	(r218195)
@@ -103,8 +103,7 @@ uiomove_fromphys(vm_page_t ma[], vm_offs
 		}
 		switch (uio->uio_segflg) {
 		case UIO_USERSPACE:
-			if (ticks - PCPU_GET(switchticks) >= hogticks)
-				uio_yield();
+			maybe_yield();
 			if (uio->uio_rw == UIO_READ)
 				error = copyout(cp, iov->iov_base, cnt);
 			else

Modified: head/sys/sun4v/sun4v/uio_machdep.c
==============================================================================
--- head/sys/sun4v/sun4v/uio_machdep.c	Wed Feb  2 15:53:09 2011	(r218194)
+++ head/sys/sun4v/sun4v/uio_machdep.c	Wed Feb  2 16:35:10 2011	(r218195)
@@ -94,8 +94,7 @@ uiomove_fromphys(vm_page_t ma[], vm_offs
 		cp = (char *)TLB_PHYS_TO_DIRECT(pa) + page_offset;
 		switch (uio->uio_segflg) {
 		case UIO_USERSPACE:
-			if (ticks - PCPU_GET(switchticks) >= hogticks)
-				uio_yield();
+			maybe_yield();
 			if (uio->uio_rw == UIO_READ)
 				error = copyout(cp, iov->iov_base, cnt);
 			else

Modified: head/sys/sys/uio.h
==============================================================================
--- head/sys/sys/uio.h	Wed Feb  2 15:53:09 2011	(r218194)
+++ head/sys/sys/uio.h	Wed Feb  2 16:35:10 2011	(r218195)
@@ -95,6 +95,8 @@ int	copyinstrfrom(const void * __restric
 	    size_t len, size_t * __restrict copied, int seg);
 int	copyinuio(struct iovec *iovp, u_int iovcnt, struct uio **uiop);
 void	uio_yield(void);
+void	maybe_yield(void);
+int	should_yield(void);
 int	uiomove(void *cp, int n, struct uio *uio);
 int	uiomove_frombuf(void *buf, int buflen, struct uio *uio);
 int	uiomove_fromphys(struct vm_page *ma[], vm_offset_t offset, int n,

Modified: head/sys/sys/vnode.h
==============================================================================
--- head/sys/sys/vnode.h	Wed Feb  2 15:53:09 2011	(r218194)
+++ head/sys/sys/vnode.h	Wed Feb  2 16:35:10 2011	(r218195)
@@ -121,7 +121,6 @@ struct vnode {
 		struct socket	*vu_socket;	/* v unix domain net (VSOCK) */
 		struct cdev	*vu_cdev; 	/* v device (VCHR, VBLK) */
 		struct fifoinfo	*vu_fifoinfo;	/* v fifo (VFIFO) */
-		int		vu_yield;	/*   yield count (VMARKER) */
 	} v_un;
 
 	/*
@@ -177,7 +176,6 @@ struct vnode {
 #define	v_socket	v_un.vu_socket
 #define	v_rdev		v_un.vu_cdev
 #define	v_fifoinfo	v_un.vu_fifoinfo
-#define	v_yield		v_un.vu_yield
 
 /* XXX: These are temporary to avoid a source sweep at this time */
 #define v_object	v_bufobj.bo_object

Modified: head/sys/ufs/ffs/ffs_rawread.c
==============================================================================
--- head/sys/ufs/ffs/ffs_rawread.c	Wed Feb  2 15:53:09 2011	(r218194)
+++ head/sys/ufs/ffs/ffs_rawread.c	Wed Feb  2 16:35:10 2011	(r218195)
@@ -243,8 +243,7 @@ ffs_rawread_readahead(struct vnode *vp,
 		if (vmapbuf(bp) < 0)
 			return EFAULT;
 		
-		if (ticks - PCPU_GET(switchticks) >= hogticks)
-			uio_yield();
+		maybe_yield();
 		bzero(bp->b_data, bp->b_bufsize);
 
 		/* Mark operation completed (similar to bufdone()) */

Modified: head/sys/ufs/ffs/ffs_softdep.c
==============================================================================
--- head/sys/ufs/ffs/ffs_softdep.c	Wed Feb  2 15:53:09 2011	(r218194)
+++ head/sys/ufs/ffs/ffs_softdep.c	Wed Feb  2 16:35:10 2011	(r218195)
@@ -1342,7 +1342,7 @@ softdep_process_worklist(mp, full)
 	int full;
 {
 	struct thread *td = curthread;
-	int cnt, matchcnt, loopcount;
+	int cnt, matchcnt;
 	struct ufsmount *ump;
 	long starttime;
 
@@ -1354,7 +1354,6 @@ softdep_process_worklist(mp, full)
 	matchcnt = 0;
 	ump = VFSTOUFS(mp);
 	ACQUIRE_LOCK(&lk);
-	loopcount = 1;
 	starttime = time_second;
 	softdep_process_journal(mp, full?MNT_WAIT:0);
 	while (ump->softdep_on_worklist > 0) {
@@ -1379,7 +1378,7 @@ softdep_process_worklist(mp, full)
 		 * We do not generally want to stop for buffer space, but if
 		 * we are really being a buffer hog, we will stop and wait.
 		 */
-		if (loopcount++ % 128 == 0) {
+		if (should_yield()) {
 			FREE_LOCK(&lk);
 			uio_yield();
 			bwillwrite();

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 17:01:26 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6E403106566C;
	Wed,  2 Feb 2011 17:01:26 +0000 (UTC) (envelope-from uqs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5C3F98FC19;
	Wed,  2 Feb 2011 17:01:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p12H1QG9015857;
	Wed, 2 Feb 2011 17:01:26 GMT (envelope-from uqs@svn.freebsd.org)
Received: (from uqs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p12H1Qsf015855;
	Wed, 2 Feb 2011 17:01:26 GMT (envelope-from uqs@svn.freebsd.org)
Message-Id: <201102021701.p12H1Qsf015855@svn.freebsd.org>
From: Ulrich Spoerlein 
Date: Wed, 2 Feb 2011 17:01:26 +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: r218196 - head/lib/libkvm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 17:01:26 -0000

Author: uqs
Date: Wed Feb  2 17:01:26 2011
New Revision: 218196
URL: http://svn.freebsd.org/changeset/base/218196

Log:
  libkvm: fix logic inversion introduced with last commit
  
  Reported by:	Brandon Gooch 
  Pointy hat to:	uqs

Modified:
  head/lib/libkvm/kvm.c

Modified: head/lib/libkvm/kvm.c
==============================================================================
--- head/lib/libkvm/kvm.c	Wed Feb  2 16:35:10 2011	(r218195)
+++ head/lib/libkvm/kvm.c	Wed Feb  2 17:01:26 2011	(r218196)
@@ -454,11 +454,11 @@ again:
 			p->n_other = 0;
 			p->n_desc = 0;
 			if (_kvm_vnet_initialized(kd, initialize) &&
-			    !strcmp(prefix, VNET_SYMPREFIX) == 0)
+			    strcmp(prefix, VNET_SYMPREFIX) == 0)
 				p->n_value =
 				    _kvm_vnet_validaddr(kd, lookup.symvalue);
 			else if (_kvm_dpcpu_initialized(kd, initialize) &&
-			    !strcmp(prefix, DPCPU_SYMPREFIX) == 0)
+			    strcmp(prefix, DPCPU_SYMPREFIX) == 0)
 				p->n_value =
 				    _kvm_dpcpu_validaddr(kd, lookup.symvalue);
 			else

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 19:50:44 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B4D471065672;
	Wed,  2 Feb 2011 19:50:44 +0000 (UTC)
	(envelope-from pawel.worach@gmail.com)
Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com
	[209.85.161.54])
	by mx1.freebsd.org (Postfix) with ESMTP id EB96A8FC13;
	Wed,  2 Feb 2011 19:50:43 +0000 (UTC)
Received: by fxm16 with SMTP id 16so366686fxm.13
	for ; Wed, 02 Feb 2011 11:50:42 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:subject:mime-version:content-type:from
	:in-reply-to:date:cc:content-transfer-encoding:message-id:references
	:to:x-mailer; bh=sxLrbWraAotPfPVCDsgSnIent+SnElGMDCd/MowhAbA=;
	b=Y3G6sanubkplVncjNkBy3xMaDeegjox8B1rb9cuQSFCI0TnHDrD64NMp6cEdQM65s9
	BOrS/zFbaVbhmHBMrTvmIQZh6ZliHcJTGSqWWb7LCUjxhxVuGithJ3cvkgoxQyR0kNmQ
	BSs3dmZMZDoYKGpQ/k3zbOwHeUxRq57I0t3Tc=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=subject:mime-version:content-type:from:in-reply-to:date:cc
	:content-transfer-encoding:message-id:references:to:x-mailer;
	b=Now55PKHw+uOOL/2zT1yqtaSHgxNaI6fdyyTaPIkaI+dbjmf6xHVg0uq8qpTixA7jM
	B6TZvIPK6NuV4M9334XDqJHsDOcyXFnf+e1i++ckAKjiWyMY4EPeElrn2vTHFph65NlH
	Is3AzNd5AeCBm0yTLf4BRegwDDsrOs8CY21X0=
Received: by 10.223.97.8 with SMTP id j8mr1657129fan.141.1296674397176;
	Wed, 02 Feb 2011 11:19:57 -0800 (PST)
Received: from [172.16.0.199] (host-78-64-61-92.homerun.telia.com
	[78.64.61.92])
	by mx.google.com with ESMTPS id n15sm8510000fam.12.2011.02.02.11.19.54
	(version=TLSv1/SSLv3 cipher=RC4-MD5);
	Wed, 02 Feb 2011 11:19:54 -0800 (PST)
Mime-Version: 1.0 (Apple Message framework v1082)
Content-Type: text/plain; charset=us-ascii
From: Pawel Worach 
In-Reply-To: <201102021542.p12Fg05o013711@svn.freebsd.org>
Date: Wed, 2 Feb 2011 20:19:52 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: 
References: <201102021542.p12Fg05o013711@svn.freebsd.org>
To: Pawel Jakub Dawidek 
X-Mailer: Apple Mail (2.1082)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218192 - head/sbin/hastd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 19:50:44 -0000

On Feb 2, 2011, at 16:42, Pawel Jakub Dawidek wrote:
> Author: pjd
> Date: Wed Feb  2 15:42:00 2011
> New Revision: 218192
> URL: http://svn.freebsd.org/changeset/base/218192
>=20
> Log:
>  Allow to specify connection timeout by the caller.
>=20
>  MFC after:	1 week
>=20
> Modified:
>  head/sbin/hastd/primary.c
>  head/sbin/hastd/proto.c
>  head/sbin/hastd/proto.h
>  head/sbin/hastd/proto_impl.h
>  head/sbin/hastd/proto_tcp4.c
>  head/sbin/hastd/proto_uds.c
>=20
...
> int
> -proto_connect(struct proto_conn *conn)
> +proto_connect(struct proto_conn *conn, int timeout)
> {

Hi Pawel,

I think you missed to updated a call.

=
/data/buildslave/freebsd-clang-amd64/obj/obj-llvm.2/Release+Asserts/bin/cl=
ang -isysroot =
/data/buildslave/freebsd-clang-amd64/obj/obj-freebsd/data/buildslave/freeb=
sd-clang-amd64/src-freebsd/tmp =
-B/data/buildslave/freebsd-clang-amd64/obj/obj-freebsd/data/buildslave/fre=
ebsd-clang-amd64/src-freebsd/tmp/usr/lib/ =
-L/data/buildslave/freebsd-clang-amd64/obj/obj-freebsd/data/buildslave/fre=
ebsd-clang-amd64/src-freebsd/tmp/usr/lib/ -O2 -pipe  =
-I/data/buildslave/freebsd-clang-amd64/src-freebsd/sbin/hastctl/../hastd =
-DINET -DINET6 -DYY_NO_UNPUT -DYY_NO_INPUT -DHAVE_CRYPTO -std=3Dgnu99 =
-fstack-protector -Qunused-arguments -Wsystem-headers -Wall =
-Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes =
-Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual =
-Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align =
-Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls =
-Wold-style-definition -Wno-pointer-sign -c =
/data/buildslave/freebsd-clang-amd64/src-freebsd/sbin/hastctl/hastctl.c
=
/data/buildslave/freebsd-clang-amd64/src-freebsd/sbin/hastctl/hastctl.c:49=
0:31: error: too few arguments to function call, expected 2, have 1
        if (proto_connect(controlconn) < 0) {
            ~~~~~~~~~~~~~            ^
1 error generated.

Regards
--=20
Pawel



From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 20:00:35 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D9E0B1065693;
	Wed,  2 Feb 2011 20:00:35 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C80A98FC18;
	Wed,  2 Feb 2011 20:00:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p12K0Zua020303;
	Wed, 2 Feb 2011 20:00:35 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p12K0ZFY020301;
	Wed, 2 Feb 2011 20:00:35 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201102022000.p12K0ZFY020301@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Wed, 2 Feb 2011 20:00:35 +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: r218201 - head/sbin/hastctl
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 20:00:36 -0000

Author: bz
Date: Wed Feb  2 20:00:35 2011
New Revision: 218201
URL: http://svn.freebsd.org/changeset/base/218201

Log:
  Add missing argument after r218192.

Modified:
  head/sbin/hastctl/hastctl.c

Modified: head/sbin/hastctl/hastctl.c
==============================================================================
--- head/sbin/hastctl/hastctl.c	Wed Feb  2 19:20:20 2011	(r218200)
+++ head/sbin/hastctl/hastctl.c	Wed Feb  2 20:00:35 2011	(r218201)
@@ -487,7 +487,7 @@ main(int argc, char *argv[])
 		    cfg->hc_controladdr);
 	}
 	/* ...and connect to hastd. */
-	if (proto_connect(controlconn) < 0) {
+	if (proto_connect(controlconn, HAST_TIMEOUT) < 0) {
 		pjdlog_exit(EX_OSERR, "Unable to connect to hastd via %s",
 		    cfg->hc_controladdr);
 	}

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 20:20:53 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 85A661065672;
	Wed,  2 Feb 2011 20:20:53 +0000 (UTC)
	(envelope-from rfarmer@predatorlabs.net)
Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50])
	by mx1.freebsd.org (Postfix) with ESMTP id 93FDD8FC15;
	Wed,  2 Feb 2011 20:20:52 +0000 (UTC)
Received: by wwf26 with SMTP id 26so361621wwf.31
	for ; Wed, 02 Feb 2011 12:20:51 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=predatorlabs.net; s=google;
	h=domainkey-signature:mime-version:x-originating-ip:in-reply-to
	:references:date:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=DksAdhrw43vnnQ+T5iEoAdRy/vPQ2wLRPllyVAu/t4I=;
	b=fJ5u+WsU5+FzPLLx0QYC1301BDgtQKwgnIz92QDP/83HaOtkw3T/DrodokLdKurhdG
	W0n03v2KRaW6wlDviaB3Y1sUiqDO8fHdPkeZfXoYTBmlX6/BBucbNr2WudMt2ZXXvNq5
	E9lNBViN1XHXnoIw0gQTOzIzFlVLrdBSiwbxc=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=predatorlabs.net; s=google;
	h=mime-version:x-originating-ip:in-reply-to:references:date
	:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	b=fhIdxHXSIDYpEjFmto/iMc2o5HjLCF1jK4cAnpy9NuRyNcjsf47AOV7sdUasN9DaHI
	9twnsM/9FihFRE4J/yeab3FMdyq/+BjUsYZ5o420z++IL0aTFJmIXgQdfGzSrwLmRnmi
	X5rdjFeIqjtBQIJW1GHeRbme/u7HcCxm8gK7E=
MIME-Version: 1.0
Received: by 10.216.179.207 with SMTP id h57mr8979554wem.20.1296676349926;
	Wed, 02 Feb 2011 11:52:29 -0800 (PST)
Received: by 10.216.242.130 with HTTP; Wed, 2 Feb 2011 11:52:29 -0800 (PST)
X-Originating-IP: [128.95.133.25]
In-Reply-To: <201101311517.p0VFHl9F028038@svn.freebsd.org>
References: <201101311517.p0VFHl9F028038@svn.freebsd.org>
Date: Wed, 2 Feb 2011 11:52:29 -0800
Message-ID: 
From: Rob Farmer 
To: Warner Losh 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218130 - head
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 20:20:53 -0000

On Mon, Jan 31, 2011 at 7:17 AM, Warner Losh  wrote:
> Author: imp
> Date: Mon Jan 31 15:17:47 2011
> New Revision: 218130
> URL: http://svn.freebsd.org/changeset/base/218130
>
> Log:
> =A0Move the architecture guessing from Makefile.inc1 to Makefile. =A0We
> =A0need to do this because variables specified on the command line
> =A0override those specified in the Makefile. =A0This is why we also moved
> =A0from TARGET to _TARGET in Makefile, and then set TARGET on the command
> =A0line when we fork a submake with Makefile.inc1.
>
> =A0This makes mips/mips work again, even without the workaround committed=
 to
> =A0lib/libc/Makefile.
>
> Modified:
> =A0head/Makefile
> =A0head/Makefile.inc1
>
> Modified: head/Makefile
> =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/Makefile =A0 =A0 =A0 Mon Jan 31 11:50:11 2011 =A0 =A0 =A0 =A0(r2=
18129)
> +++ head/Makefile =A0 =A0 =A0 Mon Jan 31 15:17:47 2011 =A0 =A0 =A0 =A0(r2=
18130)
> @@ -126,6 +126,38 @@ BINMAKE=3D \
> =A0 =A0 =A0 =A0-m ${.CURDIR}/share/mk
> =A0_MAKE=3D PATH=3D${PATH} ${BINMAKE} -f Makefile.inc1
>
> +# Guess machine architecture from machine type, and vice versa.
> +.if !defined(TARGET_ARCH) && defined(TARGET)
> +_TARGET_ARCH=3D =A0${TARGET:S/pc98/i386/:S/sun4v/sparc64/:S/mips/mipsel/=
}
> +.elif !defined(TARGET) && defined(TARGET_ARCH) && \
> + =A0 =A0${TARGET_ARCH} !=3D ${MACHINE_ARCH}
> +_TARGET=3D =A0 =A0 =A0 =A0 =A0 =A0 =A0 ${TARGET_ARCH:C/mips.*e[lb]/mips/=
:C/armeb/arm/}
> +.endif
> +# Legacy names, for a transition period mips:mips -> mipsel:mips
> +.if defined(TARGET) && defined(TARGET_ARCH) && \
> + =A0 =A0${TARGET_ARCH} =3D=3D "mips" && ${TARGET} =3D=3D "mips"
> +.warning "TARGET_ARCH of mips is deprecated in favor of mipsel or mipseb=
"
> +.if defined(TARGET_BIG_ENDIAN)
> +_TARGET_ARCH=3Dmipseb
> +.else
> +_TARGET_ARCH=3Dmipsel
> +.endif
> +.endif
> +# arm with TARGET_BIG_ENDIAN -> armeb
> +.if defined(TARGET_ARCH) && ${TARGET_ARCH} =3D=3D "arm" && defined(TARGE=
T_BIG_ENDIAN)
> +.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated. =A0us=
e armeb"
> +_TARGET_ARCH=3Darmeb
> +.endif
> +.if defined(TARGET) && !defined(_TARGET)
> +_TARGET=3D${TARGET}
> +.endif
> +.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH)
> +_TARGET_ARCH=3D${TARGET_ARCH}
> +.endif
> +# Otherwise, default to current machine type and architecture.
> +_TARGET?=3D =A0 =A0 =A0${MACHINE}
> +_TARGET_ARCH?=3D ${MACHINE_ARCH}
> +
> =A0#
> =A0# Make sure we have an up-to-date make(1). Only world and buildworld
> =A0# should do this as those are the initial targets used for upgrades.
> @@ -173,8 +205,7 @@ cleanworld:
> =A0#
>
> =A0${TGTS}:
> - =A0 =A0 =A0 ${_+_}@cd ${.CURDIR}; \
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 ${_MAKE} ${.TARGET}
> + =A0 =A0 =A0 ${_+_}cd ${.CURDIR}; ${_MAKE} TARGET=3D${_TARGET} TARGET_AR=
CH=3D${_TARGET_ARCH} ${.TARGET}
>
> =A0# Set a reasonable default
> =A0.MAIN: all
>
> Modified: head/Makefile.inc1
> =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/Makefile.inc1 =A0Mon Jan 31 11:50:11 2011 =A0 =A0 =A0 =A0(r21812=
9)
> +++ head/Makefile.inc1 =A0Mon Jan 31 15:17:47 2011 =A0 =A0 =A0 =A0(r21813=
0)
> @@ -116,32 +116,6 @@ VERSION!=3D =A0uname -srp
> =A0VERSION+=3D =A0 =A0 =A0${OSRELDATE}
> =A0.endif
>
> -# Guess machine architecture from machine type, and vice versa.
> -.if !defined(TARGET_ARCH) && defined(TARGET)
> -TARGET_ARCH=3D =A0 ${TARGET:S/pc98/i386/:S/sun4v/sparc64/:S/mips/mipsel/=
}
> -.elif !defined(TARGET) && defined(TARGET_ARCH) && \
> - =A0 =A0${TARGET_ARCH} !=3D ${MACHINE_ARCH}
> -TARGET=3D =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0${TARGET_ARCH:C/mips.*e[lb]/mip=
s/:C/armeb/arm/}
> -.endif
> -# Legacy names, for a transition period mips:mips -> mipsel:mips
> -.if defined(TARGET) && defined(TARGET_ARCH) && \
> - =A0 =A0${TARGET_ARCH} =3D=3D "mips" && ${TARGET} =3D=3D "mips"
> -.warning "TARGET_ARCH of mips is deprecated in favor of mipsel or mipseb=
"
> -.if defined(TARGET_BIG_ENDIAN)
> -TARGET_ARCH=3Dmipseb
> -.else
> -TARGET_ARCH=3Dmipsel
> -.endif
> -.endif
> -# arm with TARGET_BIG_ENDIAN -> armeb
> -.if defined(TARGET_ARCH) && ${TARGET_ARCH} =3D=3D "arm" && defined(TARGE=
T_BIG_ENDIAN)
> -.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated. =A0us=
e armeb"
> -TARGET_ARCH=3Darmeb
> -.endif
> -# Otherwise, default to current machine type and architecture.
> -TARGET?=3D =A0 =A0 =A0 ${MACHINE}
> -TARGET_ARCH?=3D =A0${MACHINE_ARCH}
> -
> =A0KNOWN_ARCHES?=3D amd64 arm armeb/arm i386 i386/pc98 ia64 mipsel/mips m=
ipseb/mips mips64el/mips mips64eb/mips mipsn32el/mips mipsn32eb/mips powerp=
c powerpc64/powerpc sparc64 sparc64/sun4v
> =A0.if ${TARGET} =3D=3D ${TARGET_ARCH}
> =A0_t=3D =A0 =A0 =A0 =A0 =A0 =A0${TARGET}
> _______________________________________________
> svn-src-head@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org"
>

Hello,

This breaks "make world" as used by ports tinderbox:

[rfarmer@turquoise] /usr/src# env DESTDIR=3D/tmp/world make -DNO_CLEAN worl=
d
--------------------------------------------------------------
>>> make world started on Wed Feb  2 11:45:08 PST 2011
--------------------------------------------------------------
"/usr/src/Makefile.inc1", line 120: Malformed conditional (${TARGET}
=3D=3D ${TARGET_ARCH})
"/usr/src/Makefile.inc1", line 122: if-less else
"/usr/src/Makefile.inc1", line 124: if-less endif
"/usr/src/Makefile.inc1", line 127: Unknown target :.
*** Error code 1

Stop in /usr/src.

--=20
Rob Farmer

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 21:09:31 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 23CC3106566B;
	Wed,  2 Feb 2011 21:09:31 +0000 (UTC) (envelope-from uqs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 121C88FC17;
	Wed,  2 Feb 2011 21:09:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p12L9UGV021982;
	Wed, 2 Feb 2011 21:09:30 GMT (envelope-from uqs@svn.freebsd.org)
Received: (from uqs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p12L9UwO021980;
	Wed, 2 Feb 2011 21:09:30 GMT (envelope-from uqs@svn.freebsd.org)
Message-Id: <201102022109.p12L9UwO021980@svn.freebsd.org>
From: Ulrich Spoerlein 
Date: Wed, 2 Feb 2011 21:09: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: r218202 - head
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 21:09:31 -0000

Author: uqs
Date: Wed Feb  2 21:09:30 2011
New Revision: 218202
URL: http://svn.freebsd.org/changeset/base/218202

Log:
  Add some obsolete manpages.

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==============================================================================
--- head/ObsoleteFiles.inc	Wed Feb  2 20:00:35 2011	(r218201)
+++ head/ObsoleteFiles.inc	Wed Feb  2 21:09:30 2011	(r218202)
@@ -38,6 +38,10 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20110119: Remove SYSCTL_*X* sysctl additions.
+OLD_FILES+=usr/share/man/man9/SYSCTL_XINT.9.gz \
+    usr/share/man/man9/SYSCTL_XLONG.9.gz
+
 # 20110112: Update dialog to new version, rename old libdialog to libodialog,
 #     removing associated man pages and header files.
 OLD_FILES+=usr/share/man/man3/draw_shadow.3.gz \
@@ -100,6 +104,8 @@ OLD_FILES+=usr/include/machine/mca.h
 .endif
 # 20101020: catch up with vm_page_sleep_if_busy rename
 OLD_FILES+=usr/share/man/man9/vm_page_sleep_busy.9.gz
+# 20101018: taskqueue(9) updates
+OLD_FILES+=usr/share/man/man9/taskqueue_find.9.gz
 # 20101011: removed subblock.h from liblzma
 OLD_FILES+=usr/include/lzma/subblock.h
 # 20101002: removed manpath.config

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 21:48:54 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3C822106564A;
	Wed,  2 Feb 2011 21:48:54 +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 2AD4B8FC16;
	Wed,  2 Feb 2011 21:48:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p12Lms0e022918;
	Wed, 2 Feb 2011 21:48:54 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p12Lms96022916;
	Wed, 2 Feb 2011 21:48:54 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201102022148.p12Lms96022916@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Wed, 2 Feb 2011 21:48: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: r218203 - head/bin/sh
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 21:48:54 -0000

Author: jilles
Date: Wed Feb  2 21:48:53 2011
New Revision: 218203
URL: http://svn.freebsd.org/changeset/base/218203

Log:
  sh: Remove comment mentioning herefd, which is gone.

Modified:
  head/bin/sh/expand.c

Modified: head/bin/sh/expand.c
==============================================================================
--- head/bin/sh/expand.c	Wed Feb  2 21:09:30 2011	(r218202)
+++ head/bin/sh/expand.c	Wed Feb  2 21:48:53 2011	(r218203)
@@ -155,8 +155,7 @@ stputs_quotes(const char *data, const ch
  * expansion are always performed; additional expansions can be requested
  * via flag (EXP_*).
  * The result is left in the stack string.
- * When arglist is NULL, perform here document expansion.  A partial result
- * may be written to herefd, which is then not included in the stack string.
+ * When arglist is NULL, perform here document expansion.
  *
  * Caution: this function uses global state and is not reentrant.
  * However, a new invocation after an interrupted invocation is safe

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 22:03:18 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A16631065670;
	Wed,  2 Feb 2011 22:03:18 +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 8FA928FC14;
	Wed,  2 Feb 2011 22:03:18 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p12M3IrP023659;
	Wed, 2 Feb 2011 22:03:18 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p12M3ISH023658;
	Wed, 2 Feb 2011 22:03:18 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201102022203.p12M3ISH023658@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Wed, 2 Feb 2011 22:03: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: r218205 - head/tools/regression/bin/sh/execution
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 22:03:18 -0000

Author: jilles
Date: Wed Feb  2 22:03:18 2011
New Revision: 218205
URL: http://svn.freebsd.org/changeset/base/218205

Log:
  sh: Add test for shell script without '#!'.

Added:
  head/tools/regression/bin/sh/execution/shellproc1.0   (contents, props changed)

Added: head/tools/regression/bin/sh/execution/shellproc1.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/sh/execution/shellproc1.0	Wed Feb  2 22:03:18 2011	(r218205)
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+T=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit
+trap 'rm -rf "${T}"' 0
+cat <"$T/testshellproc"
+printf 'this '
+echo is a test
+EOF
+chmod 755 "$T/testshellproc"
+PATH=$T:$PATH
+[ "`testshellproc`" = "this is a test" ]

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 23:37:00 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F334F106564A;
	Wed,  2 Feb 2011 23:36:59 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 9B3E08FC16;
	Wed,  2 Feb 2011 23:36:59 +0000 (UTC)
Received: from [127.0.0.1] (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id p12NYY4Q076043;
	Wed, 2 Feb 2011 16:34:34 -0700 (MST) (envelope-from imp@bsdimp.com)
Message-ID: <4D49EA0A.8000406@bsdimp.com>
Date: Wed, 02 Feb 2011 16:34:34 -0700
From: Warner Losh 
User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US;
	rv:1.9.2.13) Gecko/20101211 Thunderbird/3.1.7
MIME-Version: 1.0
To: Rob Farmer 
References: <201101311517.p0VFHl9F028038@svn.freebsd.org>
	
In-Reply-To: 
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Warner Losh 
Subject: Re: svn commit: r218130 - head
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 23:37:00 -0000

On 02/02/2011 12:52, Rob Farmer wrote:
> On Mon, Jan 31, 2011 at 7:17 AM, Warner Losh  wrote:
>> Author: imp
>> Date: Mon Jan 31 15:17:47 2011
>> New Revision: 218130
>> URL: http://svn.freebsd.org/changeset/base/218130
>>
>> Log:
>>   Move the architecture guessing from Makefile.inc1 to Makefile.  We
>>   need to do this because variables specified on the command line
>>   override those specified in the Makefile.  This is why we also moved
>>   from TARGET to _TARGET in Makefile, and then set TARGET on the command
>>   line when we fork a submake with Makefile.inc1.
>>
>>   This makes mips/mips work again, even without the workaround committed to
>>   lib/libc/Makefile.
>>
>> Modified:
>>   head/Makefile
>>   head/Makefile.inc1
>>
>> Modified: head/Makefile
>> ==============================================================================
>> --- head/Makefile       Mon Jan 31 11:50:11 2011        (r218129)
>> +++ head/Makefile       Mon Jan 31 15:17:47 2011        (r218130)
>> @@ -126,6 +126,38 @@ BINMAKE= \
>>         -m ${.CURDIR}/share/mk
>>   _MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1
>>
>> +# Guess machine architecture from machine type, and vice versa.
>> +.if !defined(TARGET_ARCH)&&  defined(TARGET)
>> +_TARGET_ARCH=  ${TARGET:S/pc98/i386/:S/sun4v/sparc64/:S/mips/mipsel/}
>> +.elif !defined(TARGET)&&  defined(TARGET_ARCH)&&  \
>> +    ${TARGET_ARCH} != ${MACHINE_ARCH}
>> +_TARGET=               ${TARGET_ARCH:C/mips.*e[lb]/mips/:C/armeb/arm/}
>> +.endif
>> +# Legacy names, for a transition period mips:mips ->  mipsel:mips
>> +.if defined(TARGET)&&  defined(TARGET_ARCH)&&  \
>> +    ${TARGET_ARCH} == "mips"&&  ${TARGET} == "mips"
>> +.warning "TARGET_ARCH of mips is deprecated in favor of mipsel or mipseb"
>> +.if defined(TARGET_BIG_ENDIAN)
>> +_TARGET_ARCH=mipseb
>> +.else
>> +_TARGET_ARCH=mipsel
>> +.endif
>> +.endif
>> +# arm with TARGET_BIG_ENDIAN ->  armeb
>> +.if defined(TARGET_ARCH)&&  ${TARGET_ARCH} == "arm"&&  defined(TARGET_BIG_ENDIAN)
>> +.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated.  use armeb"
>> +_TARGET_ARCH=armeb
>> +.endif
>> +.if defined(TARGET)&&  !defined(_TARGET)
>> +_TARGET=${TARGET}
>> +.endif
>> +.if defined(TARGET_ARCH)&&  !defined(_TARGET_ARCH)
>> +_TARGET_ARCH=${TARGET_ARCH}
>> +.endif
>> +# Otherwise, default to current machine type and architecture.
>> +_TARGET?=      ${MACHINE}
>> +_TARGET_ARCH?= ${MACHINE_ARCH}
>> +
>>   #
>>   # Make sure we have an up-to-date make(1). Only world and buildworld
>>   # should do this as those are the initial targets used for upgrades.
>> @@ -173,8 +205,7 @@ cleanworld:
>>   #
>>
>>   ${TGTS}:
>> -       ${_+_}@cd ${.CURDIR}; \
>> -               ${_MAKE} ${.TARGET}
>> +       ${_+_}cd ${.CURDIR}; ${_MAKE} TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH} ${.TARGET}
>>
>>   # Set a reasonable default
>>   .MAIN: all
>>
>> Modified: head/Makefile.inc1
>> ==============================================================================
>> --- head/Makefile.inc1  Mon Jan 31 11:50:11 2011        (r218129)
>> +++ head/Makefile.inc1  Mon Jan 31 15:17:47 2011        (r218130)
>> @@ -116,32 +116,6 @@ VERSION!=  uname -srp
>>   VERSION+=      ${OSRELDATE}
>>   .endif
>>
>> -# Guess machine architecture from machine type, and vice versa.
>> -.if !defined(TARGET_ARCH)&&  defined(TARGET)
>> -TARGET_ARCH=   ${TARGET:S/pc98/i386/:S/sun4v/sparc64/:S/mips/mipsel/}
>> -.elif !defined(TARGET)&&  defined(TARGET_ARCH)&&  \
>> -    ${TARGET_ARCH} != ${MACHINE_ARCH}
>> -TARGET=                ${TARGET_ARCH:C/mips.*e[lb]/mips/:C/armeb/arm/}
>> -.endif
>> -# Legacy names, for a transition period mips:mips ->  mipsel:mips
>> -.if defined(TARGET)&&  defined(TARGET_ARCH)&&  \
>> -    ${TARGET_ARCH} == "mips"&&  ${TARGET} == "mips"
>> -.warning "TARGET_ARCH of mips is deprecated in favor of mipsel or mipseb"
>> -.if defined(TARGET_BIG_ENDIAN)
>> -TARGET_ARCH=mipseb
>> -.else
>> -TARGET_ARCH=mipsel
>> -.endif
>> -.endif
>> -# arm with TARGET_BIG_ENDIAN ->  armeb
>> -.if defined(TARGET_ARCH)&&  ${TARGET_ARCH} == "arm"&&  defined(TARGET_BIG_ENDIAN)
>> -.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated.  use armeb"
>> -TARGET_ARCH=armeb
>> -.endif
>> -# Otherwise, default to current machine type and architecture.
>> -TARGET?=       ${MACHINE}
>> -TARGET_ARCH?=  ${MACHINE_ARCH}
>> -
>>   KNOWN_ARCHES?= amd64 arm armeb/arm i386 i386/pc98 ia64 mipsel/mips mipseb/mips mips64el/mips mips64eb/mips mipsn32el/mips mipsn32eb/mips powerpc powerpc64/powerpc sparc64 sparc64/sun4v
>>   .if ${TARGET} == ${TARGET_ARCH}
>>   _t=            ${TARGET}
>> _______________________________________________
>> svn-src-head@freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/svn-src-head
>> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org"
>>
> Hello,
>
> This breaks "make world" as used by ports tinderbox:
>
> [rfarmer@turquoise] /usr/src# env DESTDIR=/tmp/world make -DNO_CLEAN world
> --------------------------------------------------------------
>>>> make world started on Wed Feb  2 11:45:08 PST 2011
> --------------------------------------------------------------
> "/usr/src/Makefile.inc1", line 120: Malformed conditional (${TARGET}
> == ${TARGET_ARCH})
> "/usr/src/Makefile.inc1", line 122: if-less else
> "/usr/src/Makefile.inc1", line 124: if-less endif
> "/usr/src/Makefile.inc1", line 127: Unknown target :.
> *** Error code 1
>
> Stop in /usr/src.

How does the ports tinderbox run make world?  Just as you've described 
or are there additional variables set?

Warner

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 23:53:24 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E8278106566B;
	Wed,  2 Feb 2011 23:53:23 +0000 (UTC)
	(envelope-from yanegomi@gmail.com)
Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50])
	by mx1.freebsd.org (Postfix) with ESMTP id 2A64D8FC20;
	Wed,  2 Feb 2011 23:53:22 +0000 (UTC)
Received: by wwf26 with SMTP id 26so567772wwf.31
	for ; Wed, 02 Feb 2011 15:53:22 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=Ntghxv6809kAeKu61uDvSx09VUwbH1AFkEi890HzOpI=;
	b=MWVmZWSJr1can2Vh9Y2M4pymR3OLXU6cJxuiiLZYV+ox+9eCWGvKbb0N3CEMFOwU74
	JVKvdoXWzFVsz41QzGbcpDS6ulzsVvfTl5HIVSzh0ZSpkBwJckqKqcLgTbbYY9Tl1h0Y
	0TrYUEkPyUtYZrwDsbHVloHvuQTql2HH1tuDU=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	b=JT1PEn499++olG1O8dsJkxqMliZkjsdApsZQmxGwWuBeB2+vfRtlRrOI8EwU4oHV6d
	6p0ounxIhnt2UlpukR2aUYE2aASvss4lLXb8qEFvX2P0XkJzbRlUWvCph5pi5qZMkYB8
	wEfyTH7Im2L9P59WEjTRnG4Lvp84+G6nP4/PY=
MIME-Version: 1.0
Received: by 10.216.165.85 with SMTP id d63mr9334320wel.12.1296690801037; Wed,
	02 Feb 2011 15:53:21 -0800 (PST)
Sender: yanegomi@gmail.com
Received: by 10.216.71.200 with HTTP; Wed, 2 Feb 2011 15:53:20 -0800 (PST)
In-Reply-To: <4D49EA0A.8000406@bsdimp.com>
References: <201101311517.p0VFHl9F028038@svn.freebsd.org>
	
	<4D49EA0A.8000406@bsdimp.com>
Date: Wed, 2 Feb 2011 15:53:20 -0800
X-Google-Sender-Auth: uSEY7Kb37G1lVuNqEyADtYPL9KA
Message-ID: 
From: Garrett Cooper 
To: Warner Losh 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, Warner Losh ,
	svn-src-all@freebsd.org, Rob Farmer ,
	src-committers@freebsd.org
Subject: Re: svn commit: r218130 - head
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 23:53:24 -0000

On Wed, Feb 2, 2011 at 3:34 PM, Warner Losh  wrote:
> On 02/02/2011 12:52, Rob Farmer wrote:
>>
>> On Mon, Jan 31, 2011 at 7:17 AM, Warner Losh =A0wrote:
>>>
>>> Author: imp
>>> Date: Mon Jan 31 15:17:47 2011
>>> New Revision: 218130
>>> URL: http://svn.freebsd.org/changeset/base/218130
>>>
>>> Log:
>>> =A0Move the architecture guessing from Makefile.inc1 to Makefile. =A0We
>>> =A0need to do this because variables specified on the command line
>>> =A0override those specified in the Makefile. =A0This is why we also mov=
ed
>>> =A0from TARGET to _TARGET in Makefile, and then set TARGET on the comma=
nd
>>> =A0line when we fork a submake with Makefile.inc1.
>>>
>>> =A0This makes mips/mips work again, even without the workaround committ=
ed
>>> to
>>> =A0lib/libc/Makefile.
>>>
>>> Modified:
>>> =A0head/Makefile
>>> =A0head/Makefile.inc1
>>>
>>> Modified: head/Makefile
>>>
>>> =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/Makefile =A0 =A0 =A0 Mon Jan 31 11:50:11 2011 =A0 =A0 =A0 =A0(=
r218129)
>>> +++ head/Makefile =A0 =A0 =A0 Mon Jan 31 15:17:47 2011 =A0 =A0 =A0 =A0(=
r218130)
>>> @@ -126,6 +126,38 @@ BINMAKE=3D \
>>> =A0 =A0 =A0 =A0-m ${.CURDIR}/share/mk
>>> =A0_MAKE=3D PATH=3D${PATH} ${BINMAKE} -f Makefile.inc1
>>>
>>> +# Guess machine architecture from machine type, and vice versa.
>>> +.if !defined(TARGET_ARCH)&& =A0defined(TARGET)
>>> +_TARGET_ARCH=3D =A0${TARGET:S/pc98/i386/:S/sun4v/sparc64/:S/mips/mipse=
l/}
>>> +.elif !defined(TARGET)&& =A0defined(TARGET_ARCH)&& =A0\
>>> + =A0 =A0${TARGET_ARCH} !=3D ${MACHINE_ARCH}
>>> +_TARGET=3D =A0 =A0 =A0 =A0 =A0 =A0 =A0 ${TARGET_ARCH:C/mips.*e[lb]/mip=
s/:C/armeb/arm/}
>>> +.endif
>>> +# Legacy names, for a transition period mips:mips -> =A0mipsel:mips
>>> +.if defined(TARGET)&& =A0defined(TARGET_ARCH)&& =A0\
>>> + =A0 =A0${TARGET_ARCH} =3D=3D "mips"&& =A0${TARGET} =3D=3D "mips"
>>> +.warning "TARGET_ARCH of mips is deprecated in favor of mipsel or
>>> mipseb"
>>> +.if defined(TARGET_BIG_ENDIAN)
>>> +_TARGET_ARCH=3Dmipseb
>>> +.else
>>> +_TARGET_ARCH=3Dmipsel
>>> +.endif
>>> +.endif
>>> +# arm with TARGET_BIG_ENDIAN -> =A0armeb
>>> +.if defined(TARGET_ARCH)&& =A0${TARGET_ARCH} =3D=3D "arm"&&
>>> =A0defined(TARGET_BIG_ENDIAN)
>>> +.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated. =A0=
use
>>> armeb"
>>> +_TARGET_ARCH=3Darmeb
>>> +.endif
>>> +.if defined(TARGET)&& =A0!defined(_TARGET)
>>> +_TARGET=3D${TARGET}
>>> +.endif
>>> +.if defined(TARGET_ARCH)&& =A0!defined(_TARGET_ARCH)
>>> +_TARGET_ARCH=3D${TARGET_ARCH}
>>> +.endif
>>> +# Otherwise, default to current machine type and architecture.
>>> +_TARGET?=3D =A0 =A0 =A0${MACHINE}
>>> +_TARGET_ARCH?=3D ${MACHINE_ARCH}
>>> +
>>> =A0#
>>> =A0# Make sure we have an up-to-date make(1). Only world and buildworld
>>> =A0# should do this as those are the initial targets used for upgrades.
>>> @@ -173,8 +205,7 @@ cleanworld:
>>> =A0#
>>>
>>> =A0${TGTS}:
>>> - =A0 =A0 =A0 ${_+_}@cd ${.CURDIR}; \
>>> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 ${_MAKE} ${.TARGET}
>>> + =A0 =A0 =A0 ${_+_}cd ${.CURDIR}; ${_MAKE} TARGET=3D${_TARGET}
>>> TARGET_ARCH=3D${_TARGET_ARCH} ${.TARGET}
>>>
>>> =A0# Set a reasonable default
>>> =A0.MAIN: all
>>>
>>> Modified: head/Makefile.inc1
>>>
>>> =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/Makefile.inc1 =A0Mon Jan 31 11:50:11 2011 =A0 =A0 =A0 =A0(r218=
129)
>>> +++ head/Makefile.inc1 =A0Mon Jan 31 15:17:47 2011 =A0 =A0 =A0 =A0(r218=
130)
>>> @@ -116,32 +116,6 @@ VERSION!=3D =A0uname -srp
>>> =A0VERSION+=3D =A0 =A0 =A0${OSRELDATE}
>>> =A0.endif
>>>
>>> -# Guess machine architecture from machine type, and vice versa.
>>> -.if !defined(TARGET_ARCH)&& =A0defined(TARGET)
>>> -TARGET_ARCH=3D =A0 ${TARGET:S/pc98/i386/:S/sun4v/sparc64/:S/mips/mipse=
l/}
>>> -.elif !defined(TARGET)&& =A0defined(TARGET_ARCH)&& =A0\
>>> - =A0 =A0${TARGET_ARCH} !=3D ${MACHINE_ARCH}
>>> -TARGET=3D =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0${TARGET_ARCH:C/mips.*e[lb]/m=
ips/:C/armeb/arm/}
>>> -.endif
>>> -# Legacy names, for a transition period mips:mips -> =A0mipsel:mips
>>> -.if defined(TARGET)&& =A0defined(TARGET_ARCH)&& =A0\
>>> - =A0 =A0${TARGET_ARCH} =3D=3D "mips"&& =A0${TARGET} =3D=3D "mips"
>>> -.warning "TARGET_ARCH of mips is deprecated in favor of mipsel or
>>> mipseb"
>>> -.if defined(TARGET_BIG_ENDIAN)
>>> -TARGET_ARCH=3Dmipseb
>>> -.else
>>> -TARGET_ARCH=3Dmipsel
>>> -.endif
>>> -.endif
>>> -# arm with TARGET_BIG_ENDIAN -> =A0armeb
>>> -.if defined(TARGET_ARCH)&& =A0${TARGET_ARCH} =3D=3D "arm"&&
>>> =A0defined(TARGET_BIG_ENDIAN)
>>> -.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated. =A0=
use
>>> armeb"
>>> -TARGET_ARCH=3Darmeb
>>> -.endif
>>> -# Otherwise, default to current machine type and architecture.
>>> -TARGET?=3D =A0 =A0 =A0 ${MACHINE}
>>> -TARGET_ARCH?=3D =A0${MACHINE_ARCH}
>>> -
>>> =A0KNOWN_ARCHES?=3D amd64 arm armeb/arm i386 i386/pc98 ia64 mipsel/mips
>>> mipseb/mips mips64el/mips mips64eb/mips mipsn32el/mips mipsn32eb/mips
>>> powerpc powerpc64/powerpc sparc64 sparc64/sun4v
>>> =A0.if ${TARGET} =3D=3D ${TARGET_ARCH}
>>> =A0_t=3D =A0 =A0 =A0 =A0 =A0 =A0${TARGET}
>>> _______________________________________________
>>> svn-src-head@freebsd.org mailing list
>>> http://lists.freebsd.org/mailman/listinfo/svn-src-head
>>> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org"
>>>
>> Hello,
>>
>> This breaks "make world" as used by ports tinderbox:
>>
>> [rfarmer@turquoise] /usr/src# env DESTDIR=3D/tmp/world make -DNO_CLEAN w=
orld
>> --------------------------------------------------------------
>>>>>
>>>>> make world started on Wed Feb =A02 11:45:08 PST 2011
>>
>> --------------------------------------------------------------
>> "/usr/src/Makefile.inc1", line 120: Malformed conditional (${TARGET}
>> =3D=3D ${TARGET_ARCH})
>> "/usr/src/Makefile.inc1", line 122: if-less else
>> "/usr/src/Makefile.inc1", line 124: if-less endif
>> "/usr/src/Makefile.inc1", line 127: Unknown target :.
>> *** Error code 1
>>
>> Stop in /usr/src.
>
> How does the ports tinderbox run make world? =A0Just as you've described =
or
> are there additional variables set?

`make world DESTDIR=3D/' is broken. Based on the debug printf it's the
recursive call into buildworld from world that's mucking up the order
of things:

$ make world DESTDIR=3D/
--------------------------------------------------------------
>>> make world started on Wed Feb  2 15:50:37 PST 2011
--------------------------------------------------------------
Entering buildworld
"/usr/src/Makefile.inc1", line 120: Malformed conditional (${TARGET}
=3D=3D ${TARGET_ARCH})
"/usr/src/Makefile.inc1", line 122: if-less else
"/usr/src/Makefile.inc1", line 124: if-less endif
"/usr/src/Makefile.inc1", line 127: Unknown target :.
*** Error code 1

Stop in /usr/src.

Thanks,
-Garrett

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  2 23:59:24 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7D272106566C;
	Wed,  2 Feb 2011 23:59:24 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6D6B38FC13;
	Wed,  2 Feb 2011 23:59:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p12NxOZ3026851;
	Wed, 2 Feb 2011 23:59:24 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p12NxOhO026849;
	Wed, 2 Feb 2011 23:59:24 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <201102022359.p12NxOhO026849@svn.freebsd.org>
From: Warner Losh 
Date: Wed, 2 Feb 2011 23:59:24 +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: r218206 - head
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Feb 2011 23:59:24 -0000

Author: imp
Date: Wed Feb  2 23:59:24 2011
New Revision: 218206
URL: http://svn.freebsd.org/changeset/base/218206

Log:
  Setting TARGET and TARGET_ARCH needs to be done in _MAKE, not in the
  TGTS rule as _MAKE is used elsewhere.  This should fix make world.

Modified:
  head/Makefile

Modified: head/Makefile
==============================================================================
--- head/Makefile	Wed Feb  2 22:03:18 2011	(r218205)
+++ head/Makefile	Wed Feb  2 23:59:24 2011	(r218206)
@@ -124,7 +124,7 @@ MAKEPATH=	${MAKEOBJDIRPREFIX}${.CURDIR}/
 BINMAKE= \
 	`if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
 	-m ${.CURDIR}/share/mk
-_MAKE=	PATH=${PATH} ${BINMAKE} -f Makefile.inc1
+_MAKE=	PATH=${PATH} ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
 
 # Guess machine architecture from machine type, and vice versa.
 .if !defined(TARGET_ARCH) && defined(TARGET)
@@ -205,7 +205,7 @@ cleanworld:
 #
 
 ${TGTS}:
-	${_+_}cd ${.CURDIR}; ${_MAKE} TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH} ${.TARGET}
+	${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
 
 # Set a reasonable default
 .MAIN:	all

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 00:06:45 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5AA1C1065672;
	Thu,  3 Feb 2011 00:06:45 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 00C758FC12;
	Thu,  3 Feb 2011 00:06:44 +0000 (UTC)
Received: from [127.0.0.1] (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id p13006XU076307;
	Wed, 2 Feb 2011 17:00:07 -0700 (MST) (envelope-from imp@bsdimp.com)
Message-ID: <4D49F006.1030503@bsdimp.com>
Date: Wed, 02 Feb 2011 17:00:06 -0700
From: Warner Losh 
User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US;
	rv:1.9.2.13) Gecko/20101211 Thunderbird/3.1.7
MIME-Version: 1.0
To: Rob Farmer 
References: <201101311517.p0VFHl9F028038@svn.freebsd.org>
	
	<4D49EA0A.8000406@bsdimp.com>
In-Reply-To: <4D49EA0A.8000406@bsdimp.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Warner Losh 
Subject: Re: svn commit: r218130 - head
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 00:06:45 -0000

Rob,

r218206 should fix the problem.  Sorry for the hassle.

Warner

On 02/02/2011 16:34, Warner Losh wrote:
> On 02/02/2011 12:52, Rob Farmer wrote:
>> On Mon, Jan 31, 2011 at 7:17 AM, Warner Losh  wrote:
>>> Author: imp
>>> Date: Mon Jan 31 15:17:47 2011
>>> New Revision: 218130
>>> URL: http://svn.freebsd.org/changeset/base/218130
>>>
>>> Log:
>>>   Move the architecture guessing from Makefile.inc1 to Makefile.  We
>>>   need to do this because variables specified on the command line
>>>   override those specified in the Makefile.  This is why we also moved
>>>   from TARGET to _TARGET in Makefile, and then set TARGET on the 
>>> command
>>>   line when we fork a submake with Makefile.inc1.
>>>
>>>   This makes mips/mips work again, even without the workaround 
>>> committed to
>>>   lib/libc/Makefile.
>>>
>>> Modified:
>>>   head/Makefile
>>>   head/Makefile.inc1
>>>
>>> Modified: head/Makefile
>>> ============================================================================== 
>>>
>>> --- head/Makefile       Mon Jan 31 11:50:11 2011        (r218129)
>>> +++ head/Makefile       Mon Jan 31 15:17:47 2011        (r218130)
>>> @@ -126,6 +126,38 @@ BINMAKE= \
>>>         -m ${.CURDIR}/share/mk
>>>   _MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1
>>>
>>> +# Guess machine architecture from machine type, and vice versa.
>>> +.if !defined(TARGET_ARCH)&&  defined(TARGET)
>>> +_TARGET_ARCH=  ${TARGET:S/pc98/i386/:S/sun4v/sparc64/:S/mips/mipsel/}
>>> +.elif !defined(TARGET)&&  defined(TARGET_ARCH)&&  \
>>> +    ${TARGET_ARCH} != ${MACHINE_ARCH}
>>> +_TARGET=               ${TARGET_ARCH:C/mips.*e[lb]/mips/:C/armeb/arm/}
>>> +.endif
>>> +# Legacy names, for a transition period mips:mips ->  mipsel:mips
>>> +.if defined(TARGET)&&  defined(TARGET_ARCH)&&  \
>>> +    ${TARGET_ARCH} == "mips"&&  ${TARGET} == "mips"
>>> +.warning "TARGET_ARCH of mips is deprecated in favor of mipsel or 
>>> mipseb"
>>> +.if defined(TARGET_BIG_ENDIAN)
>>> +_TARGET_ARCH=mipseb
>>> +.else
>>> +_TARGET_ARCH=mipsel
>>> +.endif
>>> +.endif
>>> +# arm with TARGET_BIG_ENDIAN ->  armeb
>>> +.if defined(TARGET_ARCH)&&  ${TARGET_ARCH} == "arm"&&  
>>> defined(TARGET_BIG_ENDIAN)
>>> +.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated.  
>>> use armeb"
>>> +_TARGET_ARCH=armeb
>>> +.endif
>>> +.if defined(TARGET)&&  !defined(_TARGET)
>>> +_TARGET=${TARGET}
>>> +.endif
>>> +.if defined(TARGET_ARCH)&&  !defined(_TARGET_ARCH)
>>> +_TARGET_ARCH=${TARGET_ARCH}
>>> +.endif
>>> +# Otherwise, default to current machine type and architecture.
>>> +_TARGET?=      ${MACHINE}
>>> +_TARGET_ARCH?= ${MACHINE_ARCH}
>>> +
>>>   #
>>>   # Make sure we have an up-to-date make(1). Only world and buildworld
>>>   # should do this as those are the initial targets used for upgrades.
>>> @@ -173,8 +205,7 @@ cleanworld:
>>>   #
>>>
>>>   ${TGTS}:
>>> -       ${_+_}@cd ${.CURDIR}; \
>>> -               ${_MAKE} ${.TARGET}
>>> +       ${_+_}cd ${.CURDIR}; ${_MAKE} TARGET=${_TARGET} 
>>> TARGET_ARCH=${_TARGET_ARCH} ${.TARGET}
>>>
>>>   # Set a reasonable default
>>>   .MAIN: all
>>>
>>> Modified: head/Makefile.inc1
>>> ============================================================================== 
>>>
>>> --- head/Makefile.inc1  Mon Jan 31 11:50:11 2011        (r218129)
>>> +++ head/Makefile.inc1  Mon Jan 31 15:17:47 2011        (r218130)
>>> @@ -116,32 +116,6 @@ VERSION!=  uname -srp
>>>   VERSION+=      ${OSRELDATE}
>>>   .endif
>>>
>>> -# Guess machine architecture from machine type, and vice versa.
>>> -.if !defined(TARGET_ARCH)&&  defined(TARGET)
>>> -TARGET_ARCH=   ${TARGET:S/pc98/i386/:S/sun4v/sparc64/:S/mips/mipsel/}
>>> -.elif !defined(TARGET)&&  defined(TARGET_ARCH)&&  \
>>> -    ${TARGET_ARCH} != ${MACHINE_ARCH}
>>> -TARGET=                ${TARGET_ARCH:C/mips.*e[lb]/mips/:C/armeb/arm/}
>>> -.endif
>>> -# Legacy names, for a transition period mips:mips ->  mipsel:mips
>>> -.if defined(TARGET)&&  defined(TARGET_ARCH)&&  \
>>> -    ${TARGET_ARCH} == "mips"&&  ${TARGET} == "mips"
>>> -.warning "TARGET_ARCH of mips is deprecated in favor of mipsel or 
>>> mipseb"
>>> -.if defined(TARGET_BIG_ENDIAN)
>>> -TARGET_ARCH=mipseb
>>> -.else
>>> -TARGET_ARCH=mipsel
>>> -.endif
>>> -.endif
>>> -# arm with TARGET_BIG_ENDIAN ->  armeb
>>> -.if defined(TARGET_ARCH)&&  ${TARGET_ARCH} == "arm"&&  
>>> defined(TARGET_BIG_ENDIAN)
>>> -.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated.  
>>> use armeb"
>>> -TARGET_ARCH=armeb
>>> -.endif
>>> -# Otherwise, default to current machine type and architecture.
>>> -TARGET?=       ${MACHINE}
>>> -TARGET_ARCH?=  ${MACHINE_ARCH}
>>> -
>>>   KNOWN_ARCHES?= amd64 arm armeb/arm i386 i386/pc98 ia64 mipsel/mips 
>>> mipseb/mips mips64el/mips mips64eb/mips mipsn32el/mips 
>>> mipsn32eb/mips powerpc powerpc64/powerpc sparc64 sparc64/sun4v
>>>   .if ${TARGET} == ${TARGET_ARCH}
>>>   _t=            ${TARGET}
>>> _______________________________________________
>>> svn-src-head@freebsd.org mailing list
>>> http://lists.freebsd.org/mailman/listinfo/svn-src-head
>>> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org"
>>>
>> Hello,
>>
>> This breaks "make world" as used by ports tinderbox:
>>
>> [rfarmer@turquoise] /usr/src# env DESTDIR=/tmp/world make -DNO_CLEAN 
>> world
>> --------------------------------------------------------------
>>>>> make world started on Wed Feb  2 11:45:08 PST 2011
>> --------------------------------------------------------------
>> "/usr/src/Makefile.inc1", line 120: Malformed conditional (${TARGET}
>> == ${TARGET_ARCH})
>> "/usr/src/Makefile.inc1", line 122: if-less else
>> "/usr/src/Makefile.inc1", line 124: if-less endif
>> "/usr/src/Makefile.inc1", line 127: Unknown target :.
>> *** Error code 1
>>
>> Stop in /usr/src.
>
> How does the ports tinderbox run make world?  Just as you've described 
> or are there additional variables set?
>
> Warner
>
>
>


From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 02:14:54 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0D2A51065670;
	Thu,  3 Feb 2011 02:14:54 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F18F98FC13;
	Thu,  3 Feb 2011 02:14:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p132Erm0029935;
	Thu, 3 Feb 2011 02:14:53 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p132Er6s029933;
	Thu, 3 Feb 2011 02:14:53 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <201102030214.p132Er6s029933@svn.freebsd.org>
From: Ed Maste 
Date: Thu, 3 Feb 2011 02:14: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: r218207 - head/sys/dev/aac
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 02:14:54 -0000

Author: emaste
Date: Thu Feb  3 02:14:53 2011
New Revision: 218207
URL: http://svn.freebsd.org/changeset/base/218207

Log:
  Revert part of r173264.  Both aac_ioctl_sendfib and aac_ioctl_send_raw_srb
  make use of the aac_ioctl_event callback, if aac_alloc_command fails.  This
  can end up in an infinite loop in the while loop in aac_release_command.
  
  Further investigation into the issue mentioned by Scott Long [1] will be
  necessary.
  
  [1] http://lists.freebsd.org/pipermail/freebsd-current/2007-October/078740.html

Modified:
  head/sys/dev/aac/aac.c

Modified: head/sys/dev/aac/aac.c
==============================================================================
--- head/sys/dev/aac/aac.c	Wed Feb  2 23:59:24 2011	(r218206)
+++ head/sys/dev/aac/aac.c	Thu Feb  3 02:14:53 2011	(r218207)
@@ -1415,11 +1415,7 @@ aac_release_command(struct aac_command *
 
 	aac_enqueue_free(cm);
 
-	/*
-	 * Dequeue all events so that there's no risk of events getting
-	 * stranded.
-	 */
-	while ((event = TAILQ_FIRST(&sc->aac_ev_cmfree)) != NULL) {
+	if ((event = TAILQ_FIRST(&sc->aac_ev_cmfree)) != NULL) {
 		TAILQ_REMOVE(&sc->aac_ev_cmfree, event, ev_links);
 		event->ev_callback(sc, event, event->ev_arg);
 	}

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 03:07:11 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A5896106566C;
	Thu,  3 Feb 2011 03:07:11 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7B2778FC15;
	Thu,  3 Feb 2011 03:07:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p1337BX8031212;
	Thu, 3 Feb 2011 03:07:11 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1337B1U031210;
	Thu, 3 Feb 2011 03:07:11 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <201102030307.p1337B1U031210@svn.freebsd.org>
From: Ed Maste 
Date: Thu, 3 Feb 2011 03:07:11 +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: r218208 - head/sys/dev/aac
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 03:07:11 -0000

Author: emaste
Date: Thu Feb  3 03:07:11 2011
New Revision: 218208
URL: http://svn.freebsd.org/changeset/base/218208

Log:
  Include driver name in panic string, to make it easier to find these should
  the panic ever occur.

Modified:
  head/sys/dev/aac/aacvar.h

Modified: head/sys/dev/aac/aacvar.h
==============================================================================
--- head/sys/dev/aac/aacvar.h	Thu Feb  3 02:14:53 2011	(r218207)
+++ head/sys/dev/aac/aacvar.h	Thu Feb  3 03:07:11 2011	(r218208)
@@ -539,7 +539,7 @@ aac_enqueue_ ## name (struct aac_command
 	if ((cm->cm_flags & AAC_ON_AACQ_MASK) != 0) {			\
 		printf("command %p is on another queue, flags = %#x\n",	\
 		       cm, cm->cm_flags);				\
-		panic("command is on another queue");			\
+		panic("aac: command is on another queue");		\
 	}								\
 	TAILQ_INSERT_TAIL(&cm->cm_sc->aac_ ## name, cm, cm_link);	\
 	cm->cm_flags |= AAC_ON_ ## index;				\
@@ -551,7 +551,7 @@ aac_requeue_ ## name (struct aac_command
 	if ((cm->cm_flags & AAC_ON_AACQ_MASK) != 0) {			\
 		printf("command %p is on another queue, flags = %#x\n",	\
 		       cm, cm->cm_flags);				\
-		panic("command is on another queue");			\
+		panic("aac: command is on another queue");		\
 	}								\
 	TAILQ_INSERT_HEAD(&cm->cm_sc->aac_ ## name, cm, cm_link);	\
 	cm->cm_flags |= AAC_ON_ ## index;				\
@@ -567,7 +567,7 @@ aac_dequeue_ ## name (struct aac_softc *
 			printf("command %p not in queue, flags = %#x, "	\
 			       "bit = %#x\n", cm, cm->cm_flags,		\
 			       AAC_ON_ ## index);			\
-			panic("command not in queue");			\
+			panic("aac: command not in queue");		\
 		}							\
 		TAILQ_REMOVE(&sc->aac_ ## name, cm, cm_link);		\
 		cm->cm_flags &= ~AAC_ON_ ## index;			\
@@ -582,7 +582,7 @@ aac_remove_ ## name (struct aac_command 
 		printf("command %p not in queue, flags = %#x, "		\
 		       "bit = %#x\n", cm, cm->cm_flags, 		\
 		       AAC_ON_ ## index);				\
-		panic("command not in queue");				\
+		panic("aac: command not in queue");			\
 	}								\
 	TAILQ_REMOVE(&cm->cm_sc->aac_ ## name, cm, cm_link);		\
 	cm->cm_flags &= ~AAC_ON_ ## index;				\

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 04:24:13 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E4FA51065694;
	Thu,  3 Feb 2011 04:24:12 +0000 (UTC)
	(envelope-from rfarmer@predatorlabs.net)
Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com
	[74.125.82.182])
	by mx1.freebsd.org (Postfix) with ESMTP id 0482A8FC28;
	Thu,  3 Feb 2011 04:24:11 +0000 (UTC)
Received: by wyf19 with SMTP id 19so752819wyf.13
	for ; Wed, 02 Feb 2011 20:24:11 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=predatorlabs.net; s=google;
	h=domainkey-signature:mime-version:x-originating-ip:in-reply-to
	:references:date:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=VHmMs0pXzXAqI8F7wbv691TSe3VL7TyE7bRS918q27U=;
	b=QJuq68BGv5axRDnmfkn9JYUz3juHCxoyaZX93ZvEXa2QcjgHPa95oZGBTzjs48jFhM
	6BmDa5WiKR7dYmnebnKN+ZFVrKtBMoDXgQPxORKrw3bIJ8FLfPrgD0SZyESDuLSFvvL8
	1QkzP6w8CdwOvydNkSm1Urr0Qq1UfuCvukcAM=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=predatorlabs.net; s=google;
	h=mime-version:x-originating-ip:in-reply-to:references:date
	:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	b=Zx9O/YF/OlIN+Nkzg3Q6jO9DwhvMuffVxGI3We5NvBpzuZNcxuvoIWaMyX25jhJ28b
	G+SgGoqK0VNzlyamd9/mIMF/Xwpn9xQwHiH2ybfoEGVUjpZt9BfxDJK+aqMXpdSiuwr6
	Watr/q5K8us3ZWHyPsXnJuisng5oNAP3EzJ/0=
MIME-Version: 1.0
Received: by 10.216.1.145 with SMTP id 17mr9369279wed.50.1296707051104; Wed,
	02 Feb 2011 20:24:11 -0800 (PST)
Received: by 10.216.242.130 with HTTP; Wed, 2 Feb 2011 20:24:11 -0800 (PST)
X-Originating-IP: [128.95.133.25]
In-Reply-To: <4D49F006.1030503@bsdimp.com>
References: <201101311517.p0VFHl9F028038@svn.freebsd.org>
	
	<4D49EA0A.8000406@bsdimp.com> <4D49F006.1030503@bsdimp.com>
Date: Wed, 2 Feb 2011 20:24:11 -0800
Message-ID: 
From: Rob Farmer 
To: Warner Losh 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Warner Losh 
Subject: Re: svn commit: r218130 - head
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 04:24:13 -0000

On Wed, Feb 2, 2011 at 4:00 PM, Warner Losh  wrote:
> Rob,
>
> r218206 should fix the problem. =A0Sorry for the hassle.
>
> Warner
>

Thanks for the quick response - it is working now.

--=20
Rob Farmer

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 07:17:44 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7BCE0106566B;
	Thu,  3 Feb 2011 07:17:44 +0000 (UTC)
	(envelope-from pawel@dawidek.net)
Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60])
	by mx1.freebsd.org (Postfix) with ESMTP id 0A9318FC0A;
	Thu,  3 Feb 2011 07:17:43 +0000 (UTC)
Received: by mail.garage.freebsd.pl (Postfix, from userid 65534)
	id AAF3E45C98; Thu,  3 Feb 2011 08:17:41 +0100 (CET)
Received: from localhost (58.wheelsystems.com [83.12.187.58])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.garage.freebsd.pl (Postfix) with ESMTP id E2FF945685;
	Thu,  3 Feb 2011 08:17:35 +0100 (CET)
Date: Thu, 3 Feb 2011 08:17:21 +0100
From: Pawel Jakub Dawidek 
To: "Bjoern A. Zeeb" 
Message-ID: <20110203071721.GA12051@garage.freebsd.pl>
References: <201102022000.p12K0ZFY020301@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="k1lZvvs/B4yU6o8G"
Content-Disposition: inline
In-Reply-To: <201102022000.p12K0ZFY020301@svn.freebsd.org>
User-Agent: Mutt/1.4.2.3i
X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc
X-OS: FreeBSD 9.0-CURRENT amd64
X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on 
	mail.garage.freebsd.pl
X-Spam-Level: 
X-Spam-Status: No, score=-5.9 required=4.5 tests=ALL_TRUSTED,BAYES_00 
	autolearn=ham version=3.0.4
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218201 - head/sbin/hastctl
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 07:17:44 -0000


--k1lZvvs/B4yU6o8G
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Feb 02, 2011 at 08:00:35PM +0000, Bjoern A. Zeeb wrote:
> Author: bz
> Date: Wed Feb  2 20:00:35 2011
> New Revision: 218201
> URL: http://svn.freebsd.org/changeset/base/218201
>=20
> Log:
>   Add missing argument after r218192.

Thank you and sorry everyone!

--=20
Pawel Jakub Dawidek                       http://www.wheelsystems.com
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

--k1lZvvs/B4yU6o8G
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (FreeBSD)

iEYEARECAAYFAk1KVoEACgkQForvXbEpPzRgEgCeKnAS+U0K2qAorA4FxDbEgJEk
DsYAn3M/VS75FXvYD8Nf6boXCFxdAcjc
=1rek
-----END PGP SIGNATURE-----

--k1lZvvs/B4yU6o8G--

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 07:47:41 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D29271065673;
	Thu,  3 Feb 2011 07:47:41 +0000 (UTC)
	(envelope-from juli@clockworksquid.com)
Received: from mail-yi0-f54.google.com (mail-yi0-f54.google.com
	[209.85.218.54])
	by mx1.freebsd.org (Postfix) with ESMTP id 5B3218FC15;
	Thu,  3 Feb 2011 07:47:41 +0000 (UTC)
Received: by yie19 with SMTP id 19so378660yie.13
	for ; Wed, 02 Feb 2011 23:47:40 -0800 (PST)
Received: by 10.150.95.9 with SMTP id s9mr3990933ybb.26.1296719260556; Wed, 02
	Feb 2011 23:47:40 -0800 (PST)
MIME-Version: 1.0
Sender: juli@clockworksquid.com
Received: by 10.150.196.12 with HTTP; Wed, 2 Feb 2011 23:47:20 -0800 (PST)
In-Reply-To: <201102021635.p12GZA94015170@svn.freebsd.org>
References: <201102021635.p12GZA94015170@svn.freebsd.org>
From: Juli Mallett 
Date: Wed, 2 Feb 2011 23:47:20 -0800
X-Google-Sender-Auth: Lh0Q-c4lBzGJc1Op1CNAgZyCuS8
Message-ID: 
To: Matthew D Fleming 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218195 - in head/sys: amd64/amd64 arm/arm i386/i386
 ia64/ia64 kern mips/mips powerpc/powerpc sparc64/sparc64 sun4v/sun4v sys
 ufs/ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 07:47:41 -0000

On Wed, Feb 2, 2011 at 08:35, Matthew D Fleming  wrote:
> Author: mdf
> Date: Wed Feb =A02 16:35:10 2011
> New Revision: 218195
> URL: http://svn.freebsd.org/changeset/base/218195
>
> Log:
> =A0Put the general logic for being a CPU hog into a new function
> =A0should_yield(). =A0Use this in various places. =A0Encapsulate the comm=
on
> =A0case of check-and-yield into a new function maybe_yield().
>
> =A0Change several checks for a magic number of iterations to use
> =A0should_yield() instead.

First off, I admittedly don't know or care very much about this area,
but this commit stood out to me and I had a few minor concerns.

I'm slightly uncomfortable with the flat namespace here.  It isn't
obvious from the names that maybe_yield() and should_yield() relate
only to uio_yield() and not other types of yielding (from DELAY() to
cpu_idle() to sched_yield().)  The other problematic element here is
that "maybe_yield" and "should_yield" could quite reasonably be
variables or functions in existing code in the kernel, and although we
don't try to protect against changes that could cause such collisions,
we shouldn't do them gratuitously, and there's even something that
seems aesthetically off about these; they seem...informal, even
Linuxy.  I think names like uio_should_yield() and uio_maybe_yield()
wouldn't have nearly as much of a problem, since the context of the
question of "should" is isolated to uio operations rather than, say,
whether the scheduler would *like* for us, as the running thread, to
yield, or other considerations that may be more general.

Thanks,
Juli.

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 10:05:31 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4E5921065674;
	Thu,  3 Feb 2011 10:05:31 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3C9D38FC12;
	Thu,  3 Feb 2011 10:05:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13A5VUa040813;
	Thu, 3 Feb 2011 10:05:31 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13A5Vwi040803;
	Thu, 3 Feb 2011 10:05:31 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <201102031005.p13A5Vwi040803@svn.freebsd.org>
From: Randall Stewart 
Date: Thu, 3 Feb 2011 10:05: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: r218211 - in head/sys: conf netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 10:05:31 -0000

Author: rrs
Date: Thu Feb  3 10:05:30 2011
New Revision: 218211
URL: http://svn.freebsd.org/changeset/base/218211

Log:
  Adds an experimental option to create a pool of
  threads. These serve as input threads and are queued
  packets based on the V-tag number. This is similar to
  what a modern card can do with queue's for TCP... but
  alas modern cards know nothing about SCTP.
  
  MFC after:	3 months (maybe)

Modified:
  head/sys/conf/options
  head/sys/netinet/sctp_bsd_addr.c
  head/sys/netinet/sctp_constants.h
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_lock_bsd.h
  head/sys/netinet/sctp_os_bsd.h
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_pcb.h
  head/sys/netinet/sctp_structs.h

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Thu Feb  3 08:55:45 2011	(r218210)
+++ head/sys/conf/options	Thu Feb  3 10:05:30 2011	(r218211)
@@ -439,6 +439,7 @@ SCTP_PACKET_LOGGING	opt_sctp.h # Log to 
 SCTP_LTRACE_CHUNKS	opt_sctp.h # Log to KTR chunks processed
 SCTP_LTRACE_ERRORS	opt_sctp.h # Log to KTR error returns.
 SCTP_USE_PERCPU_STAT    opt_sctp.h # Use per cpu stats.
+SCTP_MCORE_INPUT        opt_sctp.h # Have multiple input threads for input mbufs
 #
 #
 #

Modified: head/sys/netinet/sctp_bsd_addr.c
==============================================================================
--- head/sys/netinet/sctp_bsd_addr.c	Thu Feb  3 08:55:45 2011	(r218210)
+++ head/sys/netinet/sctp_bsd_addr.c	Thu Feb  3 10:05:30 2011	(r218211)
@@ -68,6 +68,7 @@ MALLOC_DEFINE(SCTP_M_TIMW, "sctp_timw", 
 MALLOC_DEFINE(SCTP_M_MVRF, "sctp_mvrf", "sctp mvrf pcb list");
 MALLOC_DEFINE(SCTP_M_ITER, "sctp_iter", "sctp iterator control");
 MALLOC_DEFINE(SCTP_M_SOCKOPT, "sctp_socko", "sctp socket option");
+MALLOC_DEFINE(SCTP_M_MCORE, "sctp_mcore", "sctp mcore queue");
 
 /* Global NON-VNET structure that controls the iterator */
 struct iterator_control sctp_it_ctl;

Modified: head/sys/netinet/sctp_constants.h
==============================================================================
--- head/sys/netinet/sctp_constants.h	Thu Feb  3 08:55:45 2011	(r218210)
+++ head/sys/netinet/sctp_constants.h	Thu Feb  3 10:05:30 2011	(r218211)
@@ -91,6 +91,8 @@ __FBSDID("$FreeBSD$");
 #define SCTP_KTRHEAD_NAME "sctp_iterator"
 #define SCTP_KTHREAD_PAGES 0
 
+#define SCTP_MCORE_NAME "sctp_core_worker"
+
 
 /* If you support Multi-VRF how big to
  * make the initial array of VRF's to.

Modified: head/sys/netinet/sctp_input.c
==============================================================================
--- head/sys/netinet/sctp_input.c	Thu Feb  3 08:55:45 2011	(r218210)
+++ head/sys/netinet/sctp_input.c	Thu Feb  3 10:05:30 2011	(r218211)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 
 
@@ -5921,10 +5922,32 @@ bad:
 	}
 	return;
 }
+
+
 void
-sctp_input(i_pak, off)
-	struct mbuf *i_pak;
-	int off;
+sctp_input(struct mbuf *m, int off)
 {
-	sctp_input_with_port(i_pak, off, 0);
+#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP)
+	struct ip *ip;
+	struct sctphdr *sh;
+	int offset;
+	int cpu_to_use;
+
+	if (mp_ncpus > 1) {
+		ip = mtod(m, struct ip *);
+		offset = off + sizeof(*sh);
+		if (SCTP_BUF_LEN(m) < offset) {
+			if ((m = m_pullup(m, offset)) == 0) {
+				SCTP_STAT_INCR(sctps_hdrops);
+				return;
+			}
+			ip = mtod(m, struct ip *);
+		}
+		sh = (struct sctphdr *)((caddr_t)ip + off);
+		cpu_to_use = ntohl(sh->v_tag) % mp_ncpus;
+		sctp_queue_to_mcore(m, off, cpu_to_use);
+		return;
+	}
+#endif
+	sctp_input_with_port(m, off, 0);
 }

Modified: head/sys/netinet/sctp_lock_bsd.h
==============================================================================
--- head/sys/netinet/sctp_lock_bsd.h	Thu Feb  3 08:55:45 2011	(r218210)
+++ head/sys/netinet/sctp_lock_bsd.h	Thu Feb  3 10:05:30 2011	(r218211)
@@ -97,6 +97,48 @@ extern int sctp_logoff_stuff;
              rw_rlock(&SCTP_BASE_INFO(ipi_ep_mtx));                         \
 } while (0)
 
+#define SCTP_MCORE_QLOCK_INIT(cpstr) do { \
+		mtx_init(&(cpstr)->que_mtx,	      \
+			 "sctp-mcore_queue","queue_lock",	\
+			 MTX_DEF|MTX_DUPOK);		\
+} while (0)
+
+#define SCTP_MCORE_QLOCK(cpstr)  do { \
+		mtx_lock(&(cpstr)->que_mtx);	\
+} while (0)
+
+#define SCTP_MCORE_QUNLOCK(cpstr)  do { \
+		mtx_unlock(&(cpstr)->que_mtx);	\
+} while (0)
+
+#define SCTP_MCORE_QDESTROY(cpstr)  do { \
+	if(mtx_owned(&(cpstr)->core_mtx)) {	\
+		mtx_unlock(&(cpstr)->que_mtx);	\
+        } \
+	mtx_destroy(&(cpstr)->que_mtx);	\
+} while (0)
+
+
+#define SCTP_MCORE_LOCK_INIT(cpstr) do { \
+		mtx_init(&(cpstr)->core_mtx,	      \
+			 "sctp-cpulck","cpu_proc_lock",	\
+			 MTX_DEF|MTX_DUPOK);		\
+} while (0)
+
+#define SCTP_MCORE_LOCK(cpstr)  do { \
+		mtx_lock(&(cpstr)->core_mtx);	\
+} while (0)
+
+#define SCTP_MCORE_UNLOCK(cpstr)  do { \
+		mtx_unlock(&(cpstr)->core_mtx);	\
+} while (0)
+
+#define SCTP_MCORE_DESTROY(cpstr)  do { \
+	if(mtx_owned(&(cpstr)->core_mtx)) {	\
+		mtx_unlock(&(cpstr)->core_mtx);	\
+        } \
+	mtx_destroy(&(cpstr)->core_mtx);	\
+} while (0)
 
 #define SCTP_INP_INFO_WLOCK()	do { 					\
             rw_wlock(&SCTP_BASE_INFO(ipi_ep_mtx));                         \

Modified: head/sys/netinet/sctp_os_bsd.h
==============================================================================
--- head/sys/netinet/sctp_os_bsd.h	Thu Feb  3 08:55:45 2011	(r218210)
+++ head/sys/netinet/sctp_os_bsd.h	Thu Feb  3 10:05:30 2011	(r218211)
@@ -123,6 +123,7 @@ MALLOC_DECLARE(SCTP_M_TIMW);
 MALLOC_DECLARE(SCTP_M_MVRF);
 MALLOC_DECLARE(SCTP_M_ITER);
 MALLOC_DECLARE(SCTP_M_SOCKOPT);
+MALLOC_DECLARE(SCTP_M_MCORE);
 
 #if defined(SCTP_LOCAL_TRACE_BUF)
 

Modified: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c	Thu Feb  3 08:55:45 2011	(r218210)
+++ head/sys/netinet/sctp_pcb.c	Thu Feb  3 10:05:30 2011	(r218211)
@@ -47,6 +47,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 
 VNET_DEFINE(struct sctp_base_info, system_base_info);
@@ -5435,6 +5438,148 @@ sctp_del_local_addr_restricted(struct sc
 static int sctp_max_number_of_assoc = SCTP_MAX_NUM_OF_ASOC;
 static int sctp_scale_up_for_address = SCTP_SCALE_FOR_ADDR;
 
+
+
+#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP)
+struct sctp_mcore_ctrl *sctp_mcore_workers = NULL;
+
+void
+sctp_queue_to_mcore(struct mbuf *m, int off, int cpu_to_use)
+{
+	/* Queue a packet to a processor for the specified core */
+	struct sctp_mcore_queue *qent;
+	struct sctp_mcore_ctrl *wkq;
+	int need_wake = 0;
+
+	if (sctp_mcore_workers == NULL) {
+		/* Something went way bad during setup */
+		sctp_input_with_port(m, off, 0);
+		return;
+	}
+	SCTP_MALLOC(qent, struct sctp_mcore_queue *,
+	    (sizeof(struct sctp_mcore_queue)),
+	    SCTP_M_MCORE);
+	if (qent == NULL) {
+		/* This is trouble  */
+		sctp_input_with_port(m, off, 0);
+		return;
+	}
+	qent->vn = curvnet;
+	qent->m = m;
+	qent->off = off;
+	qent->v6 = 0;
+	wkq = &sctp_mcore_workers[cpu_to_use];
+	SCTP_MCORE_QLOCK(wkq);
+
+	TAILQ_INSERT_TAIL(&wkq->que, qent, next);
+	if (wkq->running == 0) {
+		need_wake = 1;
+	}
+	SCTP_MCORE_QUNLOCK(wkq);
+	if (need_wake) {
+		wakeup(&wkq->running);
+	}
+}
+
+static void
+sctp_mcore_thread(void *arg)
+{
+
+	struct sctp_mcore_ctrl *wkq;
+	struct sctp_mcore_queue *qent;
+
+	wkq = (struct sctp_mcore_ctrl *)arg;
+	struct mbuf *m;
+	int off, v6;
+
+	/* Wait for first tickle */
+	SCTP_MCORE_LOCK(wkq);
+	wkq->running = 0;
+	msleep(&wkq->running,
+	    &wkq->core_mtx,
+	    0, "wait for pkt", 0);
+	SCTP_MCORE_UNLOCK(wkq);
+
+	/* Bind to our cpu */
+	thread_lock(curthread);
+	sched_bind(curthread, wkq->cpuid);
+	thread_unlock(curthread);
+
+	/* Now lets start working */
+	SCTP_MCORE_LOCK(wkq);
+	/* Now grab lock and go */
+	while (1) {
+		SCTP_MCORE_QLOCK(wkq);
+skip_sleep:
+		wkq->running = 1;
+		qent = TAILQ_FIRST(&wkq->que);
+		if (qent) {
+			TAILQ_REMOVE(&wkq->que, qent, next);
+			SCTP_MCORE_QUNLOCK(wkq);
+			CURVNET_SET(qent->vn);
+			m = qent->m;
+			off = qent->off;
+			v6 = qent->v6;
+			SCTP_FREE(qent, SCTP_M_MCORE);
+			if (v6 == 0) {
+				sctp_input_with_port(m, off, 0);
+			} else {
+				printf("V6 not yet supported\n");
+				sctp_m_freem(m);
+			}
+			CURVNET_RESTORE();
+			SCTP_MCORE_QLOCK(wkq);
+		}
+		wkq->running = 0;
+		if (!TAILQ_EMPTY(&wkq->que)) {
+			goto skip_sleep;
+		}
+		SCTP_MCORE_QUNLOCK(wkq);
+		msleep(&wkq->running,
+		    &wkq->core_mtx,
+		    0, "wait for pkt", 0);
+	};
+}
+
+static void
+sctp_startup_mcore_threads(void)
+{
+	int i;
+
+	if (mp_ncpus == 1)
+		return;
+
+	SCTP_MALLOC(sctp_mcore_workers, struct sctp_mcore_ctrl *,
+	    (mp_ncpus * sizeof(struct sctp_mcore_ctrl)),
+	    SCTP_M_MCORE);
+	if (sctp_mcore_workers == NULL) {
+		/* TSNH I hope */
+		return;
+	}
+	memset(sctp_mcore_workers, 0, (mp_ncpus *
+	    sizeof(struct sctp_mcore_ctrl)));
+	/* Init the structures */
+	for (i = 0; i < mp_ncpus; i++) {
+		TAILQ_INIT(&sctp_mcore_workers[i].que);
+		SCTP_MCORE_LOCK_INIT(&sctp_mcore_workers[i]);
+		SCTP_MCORE_QLOCK_INIT(&sctp_mcore_workers[i]);
+		sctp_mcore_workers[i].cpuid = i;
+	}
+	/* Now start them all */
+	for (i = 0; i < mp_ncpus; i++) {
+		(void)kproc_create(sctp_mcore_thread,
+		    (void *)&sctp_mcore_workers[i],
+		    &sctp_mcore_workers[i].thread_proc,
+		    RFPROC,
+		    SCTP_KTHREAD_PAGES,
+		    SCTP_MCORE_NAME);
+
+	}
+}
+
+#endif
+
+
 void
 sctp_pcb_init()
 {
@@ -5565,6 +5710,10 @@ sctp_pcb_init()
 
 	sctp_startup_iterator();
 
+#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP)
+	sctp_startup_mcore_threads();
+#endif
+
 	/*
 	 * INIT the default VRF which for BSD is the only one, other O/S's
 	 * may have more. But initially they must start with one and then

Modified: head/sys/netinet/sctp_pcb.h
==============================================================================
--- head/sys/netinet/sctp_pcb.h	Thu Feb  3 08:55:45 2011	(r218210)
+++ head/sys/netinet/sctp_pcb.h	Thu Feb  3 10:05:30 2011	(r218211)
@@ -624,6 +624,12 @@ sctp_initiate_iterator(inp_func inpf,
     struct sctp_inpcb *,
     uint8_t co_off);
 
+#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP)
+void
+     sctp_queue_to_mcore(struct mbuf *m, int off, int cpu_to_use);
+
+#endif
+
 #ifdef INVARIANTS
 void
      sctp_validate_no_locks(struct sctp_inpcb *inp);

Modified: head/sys/netinet/sctp_structs.h
==============================================================================
--- head/sys/netinet/sctp_structs.h	Thu Feb  3 08:55:45 2011	(r218210)
+++ head/sys/netinet/sctp_structs.h	Thu Feb  3 10:05:30 2011	(r218211)
@@ -106,6 +106,31 @@ typedef void (*asoc_func) (struct sctp_i
 typedef int (*inp_func) (struct sctp_inpcb *, void *ptr, uint32_t val);
 typedef void (*end_func) (void *ptr, uint32_t val);
 
+#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP)
+/* whats on the mcore control struct */
+struct sctp_mcore_queue {
+	TAILQ_ENTRY(sctp_mcore_queue) next;
+	struct vnet *vn;
+	struct mbuf *m;
+	int off;
+	int v6;
+};
+
+TAILQ_HEAD(sctp_mcore_qhead, sctp_mcore_queue);
+
+struct sctp_mcore_ctrl {
+	SCTP_PROCESS_STRUCT thread_proc;
+	struct sctp_mcore_qhead que;
+	struct mtx core_mtx;
+	struct mtx que_mtx;
+	int running;
+	int cpuid;
+};
+
+
+#endif
+
+
 struct sctp_iterator {
 	TAILQ_ENTRY(sctp_iterator) sctp_nxt_itr;
 	struct vnet *vn;

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 10:37:44 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B926510656A4;
	Thu,  3 Feb 2011 10:37:44 +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 A8BAB8FC0A;
	Thu,  3 Feb 2011 10:37:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13Abirx042609;
	Thu, 3 Feb 2011 10:37:44 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13AbiOd042605;
	Thu, 3 Feb 2011 10:37:44 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201102031037.p13AbiOd042605@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Thu, 3 Feb 2011 10:37: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: r218214 - head/sbin/hastd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 10:37:44 -0000

Author: pjd
Date: Thu Feb  3 10:37:44 2011
New Revision: 218214
URL: http://svn.freebsd.org/changeset/base/218214

Log:
  Let the caller log info about successful privilege drop.
  We don't want to log this in hastctl.
  
  MFC after:	1 week

Modified:
  head/sbin/hastd/primary.c
  head/sbin/hastd/secondary.c
  head/sbin/hastd/subr.c

Modified: head/sbin/hastd/primary.c
==============================================================================
--- head/sbin/hastd/primary.c	Thu Feb  3 10:29:04 2011	(r218213)
+++ head/sbin/hastd/primary.c	Thu Feb  3 10:37:44 2011	(r218214)
@@ -850,6 +850,7 @@ hastd_primary(struct hast_resource *res)
 		cleanup(res);
 		exit(EX_CONFIG);
 	}
+	pjdlog_info("Privileges successfully dropped.");
 
 	/*
 	 * Create the guard thread first, so we can handle signals from the

Modified: head/sbin/hastd/secondary.c
==============================================================================
--- head/sbin/hastd/secondary.c	Thu Feb  3 10:29:04 2011	(r218213)
+++ head/sbin/hastd/secondary.c	Thu Feb  3 10:37:44 2011	(r218214)
@@ -414,6 +414,7 @@ hastd_secondary(struct hast_resource *re
 
 	if (drop_privs() != 0)
 		exit(EX_CONFIG);
+	pjdlog_info("Privileges successfully dropped.");
 
 	/*
 	 * Create the control thread before sending any event to the parent,

Modified: head/sbin/hastd/subr.c
==============================================================================
--- head/sbin/hastd/subr.c	Thu Feb  3 10:29:04 2011	(r218213)
+++ head/sbin/hastd/subr.c	Thu Feb  3 10:37:44 2011	(r218214)
@@ -184,7 +184,5 @@ drop_privs(void)
 	PJDLOG_VERIFY(getgroups(1, gidset) == 1);
 	PJDLOG_VERIFY(gidset[0] == pw->pw_gid);
 
-	pjdlog_info("Privileges successfully dropped.");
-
 	return (0);
 }

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 10:44:40 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9D6821065673;
	Thu,  3 Feb 2011 10:44:40 +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 8BCF78FC1B;
	Thu,  3 Feb 2011 10:44:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13AieNi042804;
	Thu, 3 Feb 2011 10:44:40 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13Aieaw042802;
	Thu, 3 Feb 2011 10:44:40 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201102031044.p13Aieaw042802@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Thu, 3 Feb 2011 10:44:40 +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: r218215 - head/sbin/hastctl
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 10:44:41 -0000

Author: pjd
Date: Thu Feb  3 10:44:40 2011
New Revision: 218215
URL: http://svn.freebsd.org/changeset/base/218215

Log:
  Drop privileges after connecting to hastd, but before sending or receiving
  anything.
  
  MFC after:	1 week

Modified:
  head/sbin/hastctl/hastctl.c

Modified: head/sbin/hastctl/hastctl.c
==============================================================================
--- head/sbin/hastctl/hastctl.c	Thu Feb  3 10:37:44 2011	(r218214)
+++ head/sbin/hastctl/hastctl.c	Thu Feb  3 10:44:40 2011	(r218215)
@@ -491,6 +491,11 @@ main(int argc, char *argv[])
 		pjdlog_exit(EX_OSERR, "Unable to connect to hastd via %s",
 		    cfg->hc_controladdr);
 	}
+
+	if (drop_privs() != 0)
+		exit(EX_CONFIG);
+	pjdlog_debug(1, "Privileges successfully dropped.");
+
 	/* Send the command to the server... */
 	if (hast_proto_send(NULL, controlconn, nv, NULL, 0) < 0) {
 		pjdlog_exit(EX_UNAVAILABLE,

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 11:33:32 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AFC7F1065673;
	Thu,  3 Feb 2011 11:33:32 +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 9F8E18FC1A;
	Thu,  3 Feb 2011 11:33:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13BXWDC043964;
	Thu, 3 Feb 2011 11:33:32 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13BXW4b043962;
	Thu, 3 Feb 2011 11:33:32 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201102031133.p13BXW4b043962@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Thu, 3 Feb 2011 11:33:32 +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: r218217 - head/sbin/hastd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 11:33:32 -0000

Author: pjd
Date: Thu Feb  3 11:33:32 2011
New Revision: 218217
URL: http://svn.freebsd.org/changeset/base/218217

Log:
  Add missing locking after moving keepalive_send() to remote send thread
  in r214692.
  
  MFC after:	1 week

Modified:
  head/sbin/hastd/primary.c

Modified: head/sbin/hastd/primary.c
==============================================================================
--- head/sbin/hastd/primary.c	Thu Feb  3 11:09:27 2011	(r218216)
+++ head/sbin/hastd/primary.c	Thu Feb  3 11:33:32 2011	(r218217)
@@ -1230,8 +1230,12 @@ keepalive_send(struct hast_resource *res
 {
 	struct nv *nv;
 
-	if (!ISCONNECTED(res, ncomp))
+	rw_rlock(&hio_remote_lock[ncomp]);
+
+	if (!ISCONNECTED(res, ncomp)) {
+		rw_unlock(&hio_remote_lock[ncomp]);
 		return;
+	}
 	
 	PJDLOG_ASSERT(res->hr_remotein != NULL);
 	PJDLOG_ASSERT(res->hr_remoteout != NULL);
@@ -1239,20 +1243,22 @@ keepalive_send(struct hast_resource *res
 	nv = nv_alloc();
 	nv_add_uint8(nv, HIO_KEEPALIVE, "cmd");
 	if (nv_error(nv) != 0) {
+		rw_unlock(&hio_remote_lock[ncomp]);
 		nv_free(nv);
 		pjdlog_debug(1,
 		    "keepalive_send: Unable to prepare header to send.");
 		return;
 	}
 	if (hast_proto_send(res, res->hr_remoteout, nv, NULL, 0) < 0) {
+		rw_unlock(&hio_remote_lock[ncomp]);
 		pjdlog_common(LOG_DEBUG, 1, errno,
 		    "keepalive_send: Unable to send request");
 		nv_free(nv);
-		rw_unlock(&hio_remote_lock[ncomp]);
 		remote_close(res, ncomp);
-		rw_rlock(&hio_remote_lock[ncomp]);
 		return;
 	}
+
+	rw_unlock(&hio_remote_lock[ncomp]);
 	nv_free(nv);
 	pjdlog_debug(2, "keepalive_send: Request sent.");
 }

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 11:39:49 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CA7581065674;
	Thu,  3 Feb 2011 11:39: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 B8F618FC19;
	Thu,  3 Feb 2011 11:39:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13BdnHn044117;
	Thu, 3 Feb 2011 11:39:49 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13BdnjX044111;
	Thu, 3 Feb 2011 11:39:49 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201102031139.p13BdnjX044111@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Thu, 3 Feb 2011 11:39: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: r218218 - head/sbin/hastd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 11:39:49 -0000

Author: pjd
Date: Thu Feb  3 11:39:49 2011
New Revision: 218218
URL: http://svn.freebsd.org/changeset/base/218218

Log:
  Setup another socketpair between parent and child, so that primary sandboxed
  worker can ask the main privileged process to connect in worker's behalf
  and then we can migrate descriptor using this socketpair to worker.
  This is not really needed now, but will be needed once we start to use
  capsicum for sandboxing.
  
  MFC after:	1 week

Modified:
  head/sbin/hastd/control.c
  head/sbin/hastd/hast.h
  head/sbin/hastd/hastd.c
  head/sbin/hastd/primary.c
  head/sbin/hastd/secondary.c

Modified: head/sbin/hastd/control.c
==============================================================================
--- head/sbin/hastd/control.c	Thu Feb  3 11:33:32 2011	(r218217)
+++ head/sbin/hastd/control.c	Thu Feb  3 11:39:49 2011	(r218218)
@@ -62,6 +62,10 @@ child_cleanup(struct hast_resource *res)
 		proto_close(res->hr_event);
 		res->hr_event = NULL;
 	}
+	if (res->hr_conn != NULL) {
+		proto_close(res->hr_conn);
+		res->hr_conn = NULL;
+	}
 	res->hr_workerpid = 0;
 }
 

Modified: head/sbin/hastd/hast.h
==============================================================================
--- head/sbin/hastd/hast.h	Thu Feb  3 11:33:32 2011	(r218217)
+++ head/sbin/hastd/hast.h	Thu Feb  3 11:39:49 2011	(r218218)
@@ -182,10 +182,12 @@ struct hast_resource {
 	int	hr_previous_role;
 	/* PID of child worker process. 0 - no child. */
 	pid_t	hr_workerpid;
-	/* Control connection between parent and child. */
+	/* Control commands from parent to child. */
 	struct proto_conn *hr_ctrl;
 	/* Events from child to parent. */
 	struct proto_conn *hr_event;
+	/* Connection requests from child to parent. */
+	struct proto_conn *hr_conn;
 
 	/* Activemap structure. */
 	struct activemap *hr_amp;

Modified: head/sbin/hastd/hastd.c
==============================================================================
--- head/sbin/hastd/hastd.c	Thu Feb  3 11:33:32 2011	(r218217)
+++ head/sbin/hastd/hastd.c	Thu Feb  3 11:39:49 2011	(r218218)
@@ -214,6 +214,19 @@ descriptors_assert(const struct hast_res
 				    fd, dtype2str(mode), dtype2str(S_IFSOCK));
 				break;
 			}
+		} else if (fd == proto_descriptor(res->hr_conn)) {
+			if (!isopen) {
+				snprintf(msg, sizeof(msg),
+				    "Descriptor %d (conn) is closed, but should be open.",
+				    fd);
+				break;
+			}
+			if (!S_ISSOCK(mode)) {
+				snprintf(msg, sizeof(msg),
+				    "Descriptor %d (conn) is %s, but should be %s.",
+				    fd, dtype2str(mode), dtype2str(S_IFSOCK));
+				break;
+			}
 		} else if (res->hr_role == HAST_ROLE_SECONDARY &&
 		    fd == proto_descriptor(res->hr_remotein)) {
 			if (!isopen) {
@@ -802,6 +815,41 @@ close:
 }
 
 static void
+connection_migrate(struct hast_resource *res)
+{
+	struct proto_conn *conn;
+	int16_t val = 0;
+
+	if (proto_recv(res->hr_conn, &val, sizeof(val)) < 0) {
+		pjdlog_errno(LOG_WARNING,
+		    "Unable to receive connection command");
+		return;
+	}
+	if (proto_client(res->hr_remoteaddr, &conn) < 0) {
+		val = errno;
+		pjdlog_errno(LOG_WARNING,
+		    "Unable to create outgoing connection to %s",
+		    res->hr_remoteaddr);
+		goto out;
+	}
+	if (proto_connect(conn, -1) < 0) {
+		val = errno;
+		pjdlog_errno(LOG_WARNING, "Unable to connect to %s",
+		    res->hr_remoteaddr);
+		proto_close(conn);
+		goto out;
+	}
+	val = 0;
+out:
+	if (proto_send(res->hr_conn, &val, sizeof(val)) < 0) {
+		pjdlog_errno(LOG_WARNING,
+		    "Unable to send reply to connection request");
+	}
+	if (val == 0 && proto_connection_send(res->hr_conn, conn) < 0)
+		pjdlog_errno(LOG_WARNING, "Unable to send connection");
+}
+
+static void
 main_loop(void)
 {
 	struct hast_resource *res;
@@ -858,10 +906,18 @@ main_loop(void)
 		TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) {
 			if (res->hr_event == NULL)
 				continue;
+			PJDLOG_ASSERT(res->hr_conn != NULL);
 			fd = proto_descriptor(res->hr_event);
 			PJDLOG_ASSERT(fd >= 0);
 			FD_SET(fd, &rfds);
 			maxfd = fd > maxfd ? fd : maxfd;
+			if (res->hr_role == HAST_ROLE_PRIMARY) {
+				/* Only primary workers asks for connections. */
+				fd = proto_descriptor(res->hr_conn);
+				PJDLOG_ASSERT(fd >= 0);
+				FD_SET(fd, &rfds);
+				maxfd = fd > maxfd ? fd : maxfd;
+			}
 		}
 
 		PJDLOG_ASSERT(maxfd + 1 <= (int)FD_SETSIZE);
@@ -882,12 +938,20 @@ main_loop(void)
 		TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) {
 			if (res->hr_event == NULL)
 				continue;
+			PJDLOG_ASSERT(res->hr_conn != NULL);
 			if (FD_ISSET(proto_descriptor(res->hr_event), &rfds)) {
 				if (event_recv(res) == 0)
 					continue;
 				/* The worker process exited? */
 				proto_close(res->hr_event);
 				res->hr_event = NULL;
+				proto_close(res->hr_conn);
+				res->hr_conn = NULL;
+				continue;
+			}
+			if (res->hr_role == HAST_ROLE_PRIMARY &&
+			    FD_ISSET(proto_descriptor(res->hr_conn), &rfds)) {
+				connection_migrate(res);
 			}
 		}
 	}

Modified: head/sbin/hastd/primary.c
==============================================================================
--- head/sbin/hastd/primary.c	Thu Feb  3 11:33:32 2011	(r218217)
+++ head/sbin/hastd/primary.c	Thu Feb  3 11:39:49 2011	(r218218)
@@ -488,6 +488,46 @@ init_local(struct hast_resource *res)
 		exit(EX_NOINPUT);
 }
 
+static int
+primary_connect(struct hast_resource *res, struct proto_conn **connp)
+{
+	struct proto_conn *conn;
+	int16_t val;
+
+	val = 1;
+	if (proto_send(res->hr_conn, &val, sizeof(val)) < 0) {
+		primary_exit(EX_TEMPFAIL,
+		    "Unable to send connection request to parent");
+	}
+	if (proto_recv(res->hr_conn, &val, sizeof(val)) < 0) {
+		primary_exit(EX_TEMPFAIL,
+		    "Unable to receive reply to connection request from parent");
+	}
+	if (val != 0) {
+		errno = val;
+		pjdlog_errno(LOG_WARNING, "Unable to connect to %s",
+		    res->hr_remoteaddr);
+		return (-1);
+	}
+	if (proto_connection_recv(res->hr_conn, true, &conn) < 0) {
+		primary_exit(EX_TEMPFAIL,
+		    "Unable to receive connection from parent");
+	}
+	if (proto_connect_wait(conn, HAST_TIMEOUT) < 0) {
+		pjdlog_errno(LOG_WARNING, "Unable to connect to %s",
+		    res->hr_remoteaddr);
+		proto_close(conn);
+		return (-1);
+	}
+	/* Error in setting timeout is not critical, but why should it fail? */
+	if (proto_timeout(conn, res->hr_timeout) < 0)
+		pjdlog_errno(LOG_WARNING, "Unable to set connection timeout");
+
+	*connp = conn;
+
+	return (0);
+}
+
 static bool
 init_remote(struct hast_resource *res, struct proto_conn **inp,
     struct proto_conn **outp)
@@ -508,21 +548,9 @@ init_remote(struct hast_resource *res, s
 	in = out = NULL;
 	errmsg = NULL;
 
-	/* Prepare outgoing connection with remote node. */
-	if (proto_client(res->hr_remoteaddr, &out) < 0) {
-		primary_exit(EX_TEMPFAIL,
-		    "Unable to create outgoing connection to %s",
-		    res->hr_remoteaddr);
-	}
-	/* Try to connect, but accept failure. */
-	if (proto_connect(out, HAST_TIMEOUT) < 0) {
-		pjdlog_errno(LOG_WARNING, "Unable to connect to %s",
-		    res->hr_remoteaddr);
-		goto close;
-	}
-	/* Error in setting timeout is not critical, but why should it fail? */
-	if (proto_timeout(out, res->hr_timeout) < 0)
-		pjdlog_errno(LOG_WARNING, "Unable to set connection timeout");
+	if (primary_connect(res, &out) == -1)
+		return (false);
+
 	/*
 	 * First handshake step.
 	 * Setup outgoing connection with remote node.
@@ -576,20 +604,9 @@ init_remote(struct hast_resource *res, s
 	 * Second handshake step.
 	 * Setup incoming connection with remote node.
 	 */
-	if (proto_client(res->hr_remoteaddr, &in) < 0) {
-		primary_exit(EX_TEMPFAIL,
-		    "Unable to create incoming connection to %s",
-		    res->hr_remoteaddr);
-	}
-	/* Try to connect, but accept failure. */
-	if (proto_connect(in, HAST_TIMEOUT) < 0) {
-		pjdlog_errno(LOG_WARNING, "Unable to connect to %s",
-		    res->hr_remoteaddr);
+	if (primary_connect(res, &in) == -1)
 		goto close;
-	}
-	/* Error in setting timeout is not critical, but why should it fail? */
-	if (proto_timeout(in, res->hr_timeout) < 0)
-		pjdlog_errno(LOG_WARNING, "Unable to set connection timeout");
+
 	nvout = nv_alloc();
 	nv_add_string(nvout, res->hr_name, "resource");
 	nv_add_uint8_array(nvout, res->hr_token, sizeof(res->hr_token),
@@ -792,7 +809,8 @@ hastd_primary(struct hast_resource *res)
 	int error, mode;
 
 	/*
-	 * Create communication channel between parent and child.
+	 * Create communication channel for sending control commands from
+	 * parent to child.
 	 */
 	if (proto_client("socketpair://", &res->hr_ctrl) < 0) {
 		/* TODO: There's no need for this to be fatal error. */
@@ -801,7 +819,7 @@ hastd_primary(struct hast_resource *res)
 		    "Unable to create control sockets between parent and child");
 	}
 	/*
-	 * Create communication channel between child and parent.
+	 * Create communication channel for sending events from child to parent.
 	 */
 	if (proto_client("socketpair://", &res->hr_event) < 0) {
 		/* TODO: There's no need for this to be fatal error. */
@@ -809,6 +827,16 @@ hastd_primary(struct hast_resource *res)
 		pjdlog_exit(EX_OSERR,
 		    "Unable to create event sockets between child and parent");
 	}
+	/*
+	 * Create communication channel for sending connection requests from
+	 * child to parent.
+	 */
+	if (proto_client("socketpair://", &res->hr_conn) < 0) {
+		/* TODO: There's no need for this to be fatal error. */
+		KEEP_ERRNO((void)pidfile_remove(pfh));
+		pjdlog_exit(EX_OSERR,
+		    "Unable to create connection sockets between child and parent");
+	}
 
 	pid = fork();
 	if (pid < 0) {
@@ -821,6 +849,7 @@ hastd_primary(struct hast_resource *res)
 		/* This is parent. */
 		/* Declare that we are receiver. */
 		proto_recv(res->hr_event, NULL, 0);
+		proto_recv(res->hr_conn, NULL, 0);
 		/* Declare that we are sender. */
 		proto_send(res->hr_ctrl, NULL, 0);
 		res->hr_workerpid = pid;
@@ -832,6 +861,7 @@ hastd_primary(struct hast_resource *res)
 
 	/* Declare that we are sender. */
 	proto_send(res->hr_event, NULL, 0);
+	proto_send(res->hr_conn, NULL, 0);
 	/* Declare that we are receiver. */
 	proto_recv(res->hr_ctrl, NULL, 0);
 	descriptors_cleanup(res);

Modified: head/sbin/hastd/secondary.c
==============================================================================
--- head/sbin/hastd/secondary.c	Thu Feb  3 11:33:32 2011	(r218217)
+++ head/sbin/hastd/secondary.c	Thu Feb  3 11:39:49 2011	(r218218)
@@ -364,6 +364,16 @@ hastd_secondary(struct hast_resource *re
 		pjdlog_exit(EX_OSERR,
 		    "Unable to create event sockets between child and parent");
 	}
+	/*
+	 * Create communication channel for sending connection requests from
+	 * parent to child.
+	 */
+	if (proto_client("socketpair://", &res->hr_conn) < 0) {
+		/* TODO: There's no need for this to be fatal error. */
+		KEEP_ERRNO((void)pidfile_remove(pfh));
+		pjdlog_exit(EX_OSERR,
+		    "Unable to create connection sockets between parent and child");
+	}
 
 	pid = fork();
 	if (pid < 0) {
@@ -381,6 +391,7 @@ hastd_secondary(struct hast_resource *re
 		proto_recv(res->hr_event, NULL, 0);
 		/* Declare that we are sender. */
 		proto_send(res->hr_ctrl, NULL, 0);
+		proto_send(res->hr_conn, NULL, 0);
 		res->hr_workerpid = pid;
 		return;
 	}
@@ -392,6 +403,7 @@ hastd_secondary(struct hast_resource *re
 	proto_send(res->hr_event, NULL, 0);
 	/* Declare that we are receiver. */
 	proto_recv(res->hr_ctrl, NULL, 0);
+	proto_recv(res->hr_conn, NULL, 0);
 	descriptors_cleanup(res);
 
 	descriptors_assert(res, mode);

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 11:52:22 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C47C0106566C;
	Thu,  3 Feb 2011 11:52:22 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B391F8FC14;
	Thu,  3 Feb 2011 11:52:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13BqM0v044437;
	Thu, 3 Feb 2011 11:52:22 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13BqM8u044432;
	Thu, 3 Feb 2011 11:52:22 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <201102031152.p13BqM8u044432@svn.freebsd.org>
From: Randall Stewart 
Date: Thu, 3 Feb 2011 11:52: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: r218219 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 11:52:22 -0000

Author: rrs
Date: Thu Feb  3 11:52:22 2011
New Revision: 218219
URL: http://svn.freebsd.org/changeset/base/218219

Log:
  Fix the per CPU stats so that:
  1) They don't use the giant "MAX_CPU" define and instead
     are allocated dynamically based on mp_ncpus
  2) Will zero with the netstat -z -s -p sctp
  3) Will be properly handled by both the sctp_init and finish
     (the multi-net stuff was incorrectly bzero'ing in sctp_init
      the wrong size.. the bzero is now moved to the right places).
      And of course the free is put in at the very end.
  
  MFC after:	3 Months

Modified:
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_pcb.h
  head/sys/netinet/sctp_sysctl.c
  head/sys/netinet/sctp_usrreq.c

Modified: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c	Thu Feb  3 11:39:49 2011	(r218218)
+++ head/sys/netinet/sctp_pcb.c	Thu Feb  3 11:52:22 2011	(r218219)
@@ -1,5 +1,8 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
+ *                          Michael Tuexen, tuexen@fh-muenster.de
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -5599,11 +5602,18 @@ sctp_pcb_init()
 #if defined(SCTP_LOCAL_TRACE_BUF)
 	bzero(&SCTP_BASE_SYSCTL(sctp_log), sizeof(struct sctp_log));
 #endif
+#if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
+	SCTP_MALLOC(SCTP_BASE_STATS, struct sctpstat *,
+	    (mp_ncpus * sizeof(struct sctpstat)),
+	    SCTP_M_MCORE);
+#endif
 	(void)SCTP_GETTIME_TIMEVAL(&tv);
 #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
+	bzero(SCTP_BASE_STATS, (sizeof(struct sctpstat) * mp_ncpus));
 	SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_sec = (uint32_t) tv.tv_sec;
 	SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_usec = (uint32_t) tv.tv_usec;
 #else
+	bzero(&SCTP_BASE_STATS, sizeof(struct sctpstat));
 	SCTP_BASE_STAT(sctps_discontinuitytime).tv_sec = (uint32_t) tv.tv_sec;
 	SCTP_BASE_STAT(sctps_discontinuitytime).tv_usec = (uint32_t) tv.tv_usec;
 #endif
@@ -5846,7 +5856,9 @@ sctp_pcb_finish(void)
 		SCTP_HASH_FREE(SCTP_BASE_INFO(sctp_ephash), SCTP_BASE_INFO(hashmark));
 	if (SCTP_BASE_INFO(sctp_tcpephash) != NULL)
 		SCTP_HASH_FREE(SCTP_BASE_INFO(sctp_tcpephash), SCTP_BASE_INFO(hashtcpmark));
-
+#if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
+	SCTP_FREE(SCTP_BASE_STATS, SCTP_M_MCORE);
+#endif
 }
 
 

Modified: head/sys/netinet/sctp_pcb.h
==============================================================================
--- head/sys/netinet/sctp_pcb.h	Thu Feb  3 11:39:49 2011	(r218218)
+++ head/sys/netinet/sctp_pcb.h	Thu Feb  3 11:52:22 2011	(r218219)
@@ -1,6 +1,8 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
- *
+ * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
+ *                          Michael Tuexen, tuexen@fh-muenster.de
+ *                          All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
  *
@@ -240,7 +242,7 @@ struct sctp_base_info {
 	 */
 	struct sctp_epinfo sctppcbinfo;
 #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
-	struct sctpstat sctpstat[MAXCPU];
+	struct sctpstat *sctpstat;
 #else
 	struct sctpstat sctpstat;
 #endif

Modified: head/sys/netinet/sctp_sysctl.c
==============================================================================
--- head/sys/netinet/sctp_sysctl.c	Thu Feb  3 11:39:49 2011	(r218218)
+++ head/sys/netinet/sctp_sysctl.c	Thu Feb  3 11:52:22 2011	(r218219)
@@ -1,5 +1,8 @@
 /*-
  * Copyright (c) 2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
+ *                          Michael Tuexen, tuexen@fh-muenster.de
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -648,8 +651,18 @@ static int
 sysctl_stat_get(SYSCTL_HANDLER_ARGS)
 {
 	int cpu, error;
-	struct sctpstat sb, *sarry;
+	struct sctpstat sb, *sarry, *cpin = NULL;
 
+	if ((req->newptr) && (req->newlen == sizeof(struct sctpstat))) {
+		/*
+		 * User wants us to clear or at least reset the counters to
+		 * the specified values.
+		 */
+		cpin = (struct sctpstat *)req->newptr;
+	} else if (req->newptr) {
+		/* Must be a stat structure */
+		return (EINVAL);
+	}
 	memset(&sb, 0, sizeof(sb));
 	for (cpu = 0; cpu < mp_ncpus; cpu++) {
 		sarry = &SCTP_BASE_STATS[cpu];
@@ -789,6 +802,9 @@ sysctl_stat_get(SYSCTL_HANDLER_ARGS)
 		sb.sctps_send_burst_avoid += sarry->sctps_send_burst_avoid;
 		sb.sctps_send_cwnd_avoid += sarry->sctps_send_cwnd_avoid;
 		sb.sctps_fwdtsn_map_over += sarry->sctps_fwdtsn_map_over;
+		if (cpin) {
+			memcpy(sarry, cpin, sizeof(struct sctpstat));
+		}
 	}
 	error = SYSCTL_OUT(req, &sb, sizeof(sb));
 	return (error);
@@ -1099,7 +1115,7 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, ou
 #endif
 #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, stats,
-    CTLTYPE_STRUCT | CTLFLAG_RD,
+    CTLTYPE_STRUCT | CTLFLAG_RW,
     0, 0, sysctl_stat_get, "S,sctpstat",
     "SCTP statistics (struct sctp_stat)");
 #else

Modified: head/sys/netinet/sctp_usrreq.c
==============================================================================
--- head/sys/netinet/sctp_usrreq.c	Thu Feb  3 11:39:49 2011	(r218218)
+++ head/sys/netinet/sctp_usrreq.c	Thu Feb  3 11:52:22 2011	(r218219)
@@ -1,5 +1,8 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
+ *                          Michael Tuexen, tuexen@fh-muenster.de
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -60,8 +63,6 @@ sctp_init(void)
 {
 	u_long sb_max_adj;
 
-	bzero(&SCTP_BASE_STATS, sizeof(struct sctpstat));
-
 	/* Initialize and modify the sysctled variables */
 	sctp_init_sysctls();
 	if ((nmbclusters / 8) > SCTP_ASOC_MAX_CHUNKS_ON_QUEUE)

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 13:09:22 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7DE82106564A;
	Thu,  3 Feb 2011 13:09:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6C9AA8FC0A;
	Thu,  3 Feb 2011 13:09:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13D9MvK046349;
	Thu, 3 Feb 2011 13:09:22 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13D9MfK046347;
	Thu, 3 Feb 2011 13:09:22 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201102031309.p13D9MfK046347@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 3 Feb 2011 13:09: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: r218221 - head/sys/x86/x86
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 13:09:22 -0000

Author: jhb
Date: Thu Feb  3 13:09:22 2011
New Revision: 218221
URL: http://svn.freebsd.org/changeset/base/218221

Log:
  Use a dedicated taskqueue with a thread that runs at a software-interrupt
  priority for the periodic polling of the machine check registers.

Modified:
  head/sys/x86/x86/mca.c

Modified: head/sys/x86/x86/mca.c
==============================================================================
--- head/sys/x86/x86/mca.c	Thu Feb  3 12:19:07 2011	(r218220)
+++ head/sys/x86/x86/mca.c	Thu Feb  3 13:09:22 2011	(r218221)
@@ -105,6 +105,7 @@ SYSCTL_INT(_hw_mca, OID_AUTO, erratum383
 static STAILQ_HEAD(, mca_internal) mca_records;
 static struct callout mca_timer;
 static int mca_ticks = 3600;	/* Check hourly by default. */
+static struct taskqueue *mca_tq;
 static struct task mca_task;
 static struct mtx mca_lock;
 
@@ -606,7 +607,7 @@ static void
 mca_periodic_scan(void *arg)
 {
 
-	taskqueue_enqueue(taskqueue_thread, &mca_task);
+	taskqueue_enqueue(mca_tq, &mca_task);
 	callout_reset(&mca_timer, mca_ticks * hz, mca_periodic_scan, NULL);
 }
 
@@ -620,7 +621,7 @@ sysctl_mca_scan(SYSCTL_HANDLER_ARGS)
 	if (error)
 		return (error);
 	if (i)
-		taskqueue_enqueue(taskqueue_thread, &mca_task);
+		taskqueue_enqueue(mca_tq, &mca_task);
 	return (0);
 }
 
@@ -631,6 +632,9 @@ mca_startup(void *dummy)
 	if (!mca_enabled || !(cpu_feature & CPUID_MCA))
 		return;
 
+	mca_tq = taskqueue_create("mca", M_WAITOK, taskqueue_thread_enqueue,
+	    &mca_tq);
+	taskqueue_start_threads(&mca_tq, 1, PI_SWI(SWI_TQ), "mca taskq");
 	callout_reset(&mca_timer, mca_ticks * hz, mca_periodic_scan,
 		    NULL);
 }
@@ -670,7 +674,7 @@ mca_setup(uint64_t mcg_cap)
 
 	mtx_init(&mca_lock, "mca", NULL, MTX_SPIN);
 	STAILQ_INIT(&mca_records);
-	TASK_INIT(&mca_task, 0x8000, mca_scan_cpus, NULL);
+	TASK_INIT(&mca_task, 0, mca_scan_cpus, NULL);
 	callout_init(&mca_timer, CALLOUT_MPSAFE);
 	SYSCTL_ADD_INT(NULL, SYSCTL_STATIC_CHILDREN(_hw_mca), OID_AUTO,
 	    "count", CTLFLAG_RD, &mca_count, 0, "Record count");

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 13:11:09 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0E406106566C;
	Thu,  3 Feb 2011 13:11:09 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au
	[211.29.132.184])
	by mx1.freebsd.org (Postfix) with ESMTP id 8F4D08FC0A;
	Thu,  3 Feb 2011 13:11:08 +0000 (UTC)
Received: from c122-106-165-206.carlnfd1.nsw.optusnet.com.au
	(c122-106-165-206.carlnfd1.nsw.optusnet.com.au [122.106.165.206])
	by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	p13DAvw5013847
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 4 Feb 2011 00:11:05 +1100
Date: Fri, 4 Feb 2011 00:10:33 +1100 (EST)
From: Bruce Evans 
X-X-Sender: bde@besplex.bde.org
To: Juli Mallett 
In-Reply-To: 
Message-ID: <20110203235212.S2089@besplex.bde.org>
References: <201102021635.p12GZA94015170@svn.freebsd.org>
	
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="0-1747581021-1296738633=:2089"
Cc: svn-src-head@freebsd.org, Matthew D Fleming ,
	svn-src-all@freebsd.org, src-committers@freebsd.org
Subject: Re: svn commit: r218195 - in head/sys: amd64/amd64 arm/arm i386/i386
 ia64/ia64 kern mips/mips powerpc/powerpc sparc64/sparc64 sun4v/sun4v sys
 ufs/ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 13:11:09 -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-1747581021-1296738633=:2089
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

On Wed, 2 Feb 2011, Juli Mallett wrote:

> On Wed, Feb 2, 2011 at 08:35, Matthew D Fleming  wrote:
>> Author: mdf
>> Date: Wed Feb =A02 16:35:10 2011
>> New Revision: 218195
>> URL: http://svn.freebsd.org/changeset/base/218195
>>
>> Log:
>> =A0Put the general logic for being a CPU hog into a new function
>> =A0should_yield(). =A0Use this in various places. =A0Encapsulate the com=
mon
>> =A0case of check-and-yield into a new function maybe_yield().
>>
>> =A0Change several checks for a magic number of iterations to use
>> =A0should_yield() instead.

Grr, hard \xa0.

> First off, I admittedly don't know or care very much about this area,
> but this commit stood out to me and I had a few minor concerns.

I sent a long private mail saying how it is quite broken.  The hogticks
hasn't worked for 10.4 years, since switchtime is reset on every context
switch and there are lots of context switches for ithreads).  Thus
should_yield() almost always returns false, and the old code that used
its logic was mostly dead.  The old code that didn't use its logic
worked, but now mostly doesn't.  Also, preemption makes the non-preemptive
yielding mostly unnecessary.  When preemption occurs, it doesn't do
the right thing in cases where it is necessary to drop all locks, while
manual yielding does. But preemption certainly resets switchtime, so
if is happening then sched_yield() returns false always instead of
only almost always.  (Almost always is when the context switch rate
is less than 5 Hz.  Non-fast interrups at more than 5 Hz normally
prevent this.)

> I'm slightly uncomfortable with the flat namespace here.  It isn't
> obvious from the names that maybe_yield() and should_yield() relate
> only to uio_yield() and not other types of yielding (from DELAY() to
> cpu_idle() to sched_yield().)  The other problematic element here is

I noted many namespace problems too, starting with my static uio_yield()
already being exported for abuse by non-uio things.

> Linuxy.  I think names like uio_should_yield() and uio_maybe_yield()
> wouldn't have nearly as much of a problem, since the context of the
> question of "should" is isolated to uio operations rather than, say,
> whether the scheduler would *like* for us, as the running thread, to
> yield, or other considerations that may be more general.

But this has nothing to do with uio.   The uio case has been most
perfectly broken for 10.4 years, since the uio_yield() calls for actual
uio things are the main places that use the should_yield() condition.
Non-uio places mostly did an unconditional uio_yield(), and this worked.
I think uio also doesn't hold any locks, for the same reason that
copyin()/out() don't (it might fault and have to sleep for a long time).
Thus preemption works right for the uio case, and its perfect brokenness
10.4 years ago turned into mostly just dead code when the kernel became
preemptible.

The breakage is perfect in bdeBSD, since it uses ithreads for clock
interrupts.  Thus switchticks is guaranteed to be reset by the same
interrupts that advance `ticks', and so (ticks - switchticks) is
either 0 or 1 (mostly 1?).

Bruce
--0-1747581021-1296738633=:2089--

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 13:57:01 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BEFFD1065679;
	Thu,  3 Feb 2011 13:57:01 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 91CEE8FC0A;
	Thu,  3 Feb 2011 13:57:01 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 49F4E46B1A;
	Thu,  3 Feb 2011 08:57:01 -0500 (EST)
Received: from jhbbsd.localnet (unknown [209.249.190.10])
	by bigwig.baldwin.cx (Postfix) with ESMTPSA id 882818A01D;
	Thu,  3 Feb 2011 08:57:00 -0500 (EST)
From: John Baldwin 
To: Randall Stewart 
Date: Thu, 3 Feb 2011 07:45:34 -0500
User-Agent: KMail/1.13.5 (FreeBSD/7.4-CBSD-20110107; KDE/4.4.5; amd64; ; )
References: <201102031152.p13BqM8u044432@svn.freebsd.org>
In-Reply-To: <201102031152.p13BqM8u044432@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <201102030745.34617.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6
	(bigwig.baldwin.cx); Thu, 03 Feb 2011 08:57:00 -0500 (EST)
X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=0.5 required=4.2 tests=BAYES_00,MAY_BE_FORGED,
	RDNS_DYNAMIC autolearn=no version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218219 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 13:57:01 -0000

On Thursday, February 03, 2011 6:52:22 am Randall Stewart wrote:
> Author: rrs
> Date: Thu Feb  3 11:52:22 2011
> New Revision: 218219
> URL: http://svn.freebsd.org/changeset/base/218219
> 
> Log:
>   Fix the per CPU stats so that:
>   1) They don't use the giant "MAX_CPU" define and instead
>      are allocated dynamically based on mp_ncpus

You probably want to use mp_maxid instead.  CPU IDs are not guaranteed to be 
contiguous (though they currently are).  Instead, the only guarantee are that 
there are mp_ncpus CPUs numbered 0 ... mp_maxid.  There may be gaps in that 
range (and there have been in the past).

-- 
John Baldwin

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 13:57:03 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8B14C106564A;
	Thu,  3 Feb 2011 13:57:03 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 56E758FC12;
	Thu,  3 Feb 2011 13:57:03 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 0132946B53;
	Thu,  3 Feb 2011 08:57:03 -0500 (EST)
Received: from jhbbsd.localnet (unknown [209.249.190.10])
	by bigwig.baldwin.cx (Postfix) with ESMTPSA id 124928A027;
	Thu,  3 Feb 2011 08:57:02 -0500 (EST)
From: John Baldwin 
To: Juli Mallett 
Date: Thu, 3 Feb 2011 07:50:06 -0500
User-Agent: KMail/1.13.5 (FreeBSD/7.4-CBSD-20110107; KDE/4.4.5; amd64; ; )
References: <201102021635.p12GZA94015170@svn.freebsd.org>
	
In-Reply-To: 
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <201102030750.07076.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6
	(bigwig.baldwin.cx); Thu, 03 Feb 2011 08:57:02 -0500 (EST)
X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=0.5 required=4.2 tests=BAYES_00,MAY_BE_FORGED,
	RDNS_DYNAMIC autolearn=no version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, Matthew D Fleming ,
	svn-src-all@freebsd.org, src-committers@freebsd.org
Subject: Re: svn commit: r218195 - in head/sys: amd64/amd64 arm/arm
	i386/i386 ia64/ia64 kern mips/mips powerpc/powerpc
	sparc64/sparc64 sun4v/sun4v sys ufs/ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 13:57:03 -0000

On Thursday, February 03, 2011 2:47:20 am Juli Mallett wrote:
> On Wed, Feb 2, 2011 at 08:35, Matthew D Fleming  wrote:
> > Author: mdf
> > Date: Wed Feb  2 16:35:10 2011
> > New Revision: 218195
> > URL: http://svn.freebsd.org/changeset/base/218195
> >
> > Log:
> >  Put the general logic for being a CPU hog into a new function
> >  should_yield().  Use this in various places.  Encapsulate the common
> >  case of check-and-yield into a new function maybe_yield().
> >
> >  Change several checks for a magic number of iterations to use
> >  should_yield() instead.
> 
> First off, I admittedly don't know or care very much about this area,
> but this commit stood out to me and I had a few minor concerns.
> 
> I'm slightly uncomfortable with the flat namespace here.  It isn't
> obvious from the names that maybe_yield() and should_yield() relate
> only to uio_yield() and not other types of yielding (from DELAY() to
> cpu_idle() to sched_yield().)  The other problematic element here is
> that "maybe_yield" and "should_yield" could quite reasonably be
> variables or functions in existing code in the kernel, and although we
> don't try to protect against changes that could cause such collisions,
> we shouldn't do them gratuitously, and there's even something that
> seems aesthetically off about these; they seem...informal, even
> Linuxy.  I think names like uio_should_yield() and uio_maybe_yield()
> wouldn't have nearly as much of a problem, since the context of the
> question of "should" is isolated to uio operations rather than, say,
> whether the scheduler would *like* for us, as the running thread, to
> yield, or other considerations that may be more general.

I mostly agree, but these checks are no longer specific to uio.  Matt used 
them to replace many ad-hoc checks using counters with hardcoded maximums in 
places like softupdates, etc.

I don't have any good suggestions for what else you would call these.  I'm not 
sure 'sched_amcpuhog() or sched_hoggingcpu()' are really better (and these are 
not scheduler dependent, so sched_ would probably not be a good prefix).

-- 
John Baldwin

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 14:42:47 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2DED01065673;
	Thu,  3 Feb 2011 14:42:47 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1C3C48FC0C;
	Thu,  3 Feb 2011 14:42:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13EglBw048704;
	Thu, 3 Feb 2011 14:42:47 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13EglG7048701;
	Thu, 3 Feb 2011 14:42:47 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <201102031442.p13EglG7048701@svn.freebsd.org>
From: Alan Cox 
Date: Thu, 3 Feb 2011 14:42:46 +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: r218223 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 14:42:47 -0000

Author: alc
Date: Thu Feb  3 14:42:46 2011
New Revision: 218223
URL: http://svn.freebsd.org/changeset/base/218223

Log:
  Eliminate unnecessary page hold_count checks.  These checks predate
  r90944, which introduced a general mechanism for handling the freeing
  of held pages.
  
  Reviewed by:	kib@

Modified:
  head/sys/kern/uipc_syscalls.c
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/uipc_syscalls.c
==============================================================================
--- head/sys/kern/uipc_syscalls.c	Thu Feb  3 13:10:13 2011	(r218222)
+++ head/sys/kern/uipc_syscalls.c	Thu Feb  3 14:42:46 2011	(r218223)
@@ -2115,8 +2115,7 @@ retry_space:
 				 * then free it.
 				 */
 				if (pg->wire_count == 0 && pg->valid == 0 &&
-				    pg->busy == 0 && !(pg->oflags & VPO_BUSY) &&
-				    pg->hold_count == 0)
+				    pg->busy == 0 && !(pg->oflags & VPO_BUSY))
 					vm_page_free(pg);
 				vm_page_unlock(pg);
 				VM_OBJECT_UNLOCK(obj);

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c	Thu Feb  3 13:10:13 2011	(r218222)
+++ head/sys/kern/vfs_bio.c	Thu Feb  3 14:42:46 2011	(r218223)
@@ -1647,8 +1647,7 @@ vfs_vmio_release(struct buf *bp)
 			 * no valid data.  We also free the page if the
 			 * buffer was used for direct I/O
 			 */
-			if ((bp->b_flags & B_ASYNC) == 0 && !m->valid &&
-			    m->hold_count == 0) {
+			if ((bp->b_flags & B_ASYNC) == 0 && !m->valid) {
 				vm_page_free(m);
 			} else if (bp->b_flags & B_DIRECT) {
 				vm_page_try_to_free(m);

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 15:19:19 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 307D7106566B;
	Thu,  3 Feb 2011 15:19:19 +0000 (UTC)
	(envelope-from harti@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 032858FC18;
	Thu,  3 Feb 2011 15:19:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13FJI2A049700;
	Thu, 3 Feb 2011 15:19:18 GMT (envelope-from harti@svn.freebsd.org)
Received: (from harti@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13FJIEA049698;
	Thu, 3 Feb 2011 15:19:18 GMT (envelope-from harti@svn.freebsd.org)
Message-Id: <201102031519.p13FJIEA049698@svn.freebsd.org>
From: Hartmut Brandt 
Date: Thu, 3 Feb 2011 15:19: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: r218225 - head/contrib/bsnmp
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 15:19:19 -0000

Author: harti
Date: Thu Feb  3 15:19:18 2011
New Revision: 218225
URL: http://svn.freebsd.org/changeset/base/218225

Log:
  Bring the list of OIDs up-to-date to prevent conflicts.

Modified:
  head/contrib/bsnmp/oid-list

Modified: head/contrib/bsnmp/oid-list
==============================================================================
--- head/contrib/bsnmp/oid-list	Thu Feb  3 15:13:15 2011	(r218224)
+++ head/contrib/bsnmp/oid-list	Thu Feb  3 15:19:18 2011	(r218225)
@@ -1,4 +1,4 @@
-$Begemot: bsnmp/oid-list,v 1.5 2006/02/27 09:55:45 brandt_h Exp $
+$Begemot: bsnmp/trunk/oid-list 1512 2011-02-03 15:16:22Z brandt_h $
 
 This file documents the OID assignments under BSNMP's private OID.
 
@@ -12,12 +12,30 @@ enterprises
       1		BEGEMOT-SNMPD
       2		BEGEMOT-NETGRAPH	snmpd netgraph module
       3		BEGEMOT-IP		snmpd IP related stuff.
+      4		BEGEMOT-IFACE-MIB	interface MIB private stuff
+      5		BEGEMOT-IPSTATS-MIB	IP statistics
+      6		BEGEMOT-IP-MIB		IP objects
       100	BEGEMOT-ILMID		snmpd ILMID module
       101	BEGEMOT-ATM		snmpd ATM module
       200	BEGEMOT-PF		snmpd PF module (phillip@freebsd.org)
       201	BEGEMOT-NTP		snmpd NTP module
       202	BEGEMOT-HOSTRES		snmpd HOSTRES module private stuff
+      203	regexData		bsnmp-regex (Nate Nielsen )
+      204	pingData		bsnmp-ping (Nate Nielsen )
+      205	begemotBridge		bridge module
+      210	begemotWlan		WLAN module
+
       300	BEGEMOT-ACM		DLR ACM project
+      303	BEGEMOT-WLINK		DLR WLINK simulator
+      304	BEGEMOT-SATX		DLR SatX simulator
+
+      405	mysql			(vanilla@fatpipi.com)
+      406	varnish			(vanilla@fatpipi.com)
+
+      500	DLR-MOSAKA		DLR Mosaka simulation platform
+
+      1111	bsnmp-jails		per-jail network, cpu, disk, memory statistics (Stef Walter )
+      1112	bsnmp-pcap		monitor traffic for specific network flows (Stef Walter )
 
 If you need an OID and don't know where to stuck it in, I can assign you one -
 just drop me a mail.

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 17:08:29 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 132D0106564A;
	Thu,  3 Feb 2011 17:08:29 +0000 (UTC)
	(envelope-from mdf356@gmail.com)
Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com
	[74.125.82.182])
	by mx1.freebsd.org (Postfix) with ESMTP id EF68D8FC12;
	Thu,  3 Feb 2011 17:08:27 +0000 (UTC)
Received: by wyf19 with SMTP id 19so1373133wyf.13
	for ; Thu, 03 Feb 2011 09:08:26 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=CWubPBgVPqbwer0xUfL8VVSarR17677TeDgcT6yUAyo=;
	b=vPytzZ7/MK+RNagc9yO8EKtpJfoyHV1K2m9QteCbU1WuJ/fQUOVkCBwK2JajXeFFII
	V9Zb8MzR7bQf06Xvbk4pHy0UEl5UYyzca3x1YjO4/X31ySirPcYtMEY2uW0U/fspd6MB
	T9ivXn3lGRKDt3CPQ4pIP6qT77gpk/jWkJeeU=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	b=DSJsLgmG5LQP+sLH3SFiQLYeXQ3+yfHfI+xReclAZFkzDbH/xGgrrRLl7yklXU67u7
	O9d8cQarUSy18N8SB4iDp+Q06vhpcSIWRQpkIatMC0Zhi6uQD9NBVE0DNcDfVrPJcTZp
	pTzXm75vr19Wtjx0IcJKhd8QHR8vhPWIEIR+U=
MIME-Version: 1.0
Received: by 10.216.179.140 with SMTP id h12mr10069891wem.40.1296752900170;
	Thu, 03 Feb 2011 09:08:20 -0800 (PST)
Sender: mdf356@gmail.com
Received: by 10.216.62.203 with HTTP; Thu, 3 Feb 2011 09:08:20 -0800 (PST)
In-Reply-To: <201102030750.07076.jhb@freebsd.org>
References: <201102021635.p12GZA94015170@svn.freebsd.org>
	
	<201102030750.07076.jhb@freebsd.org>
Date: Thu, 3 Feb 2011 09:08:20 -0800
X-Google-Sender-Auth: E-s5PMGM2Wb-wuguUpOQVtKiI1o
Message-ID: 
From: mdf@FreeBSD.org
To: John Baldwin 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: Juli Mallett , svn-src-head@freebsd.org,
	svn-src-all@freebsd.org, src-committers@freebsd.org
Subject: Re: svn commit: r218195 - in head/sys: amd64/amd64 arm/arm i386/i386
 ia64/ia64 kern mips/mips powerpc/powerpc sparc64/sparc64 sun4v/sun4v sys
 ufs/ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 17:08:29 -0000

On Thu, Feb 3, 2011 at 4:50 AM, John Baldwin  wrote:
> On Thursday, February 03, 2011 2:47:20 am Juli Mallett wrote:
>> On Wed, Feb 2, 2011 at 08:35, Matthew D Fleming  wrote:
>> > Author: mdf
>> > Date: Wed Feb =A02 16:35:10 2011
>> > New Revision: 218195
>> > URL: http://svn.freebsd.org/changeset/base/218195
>> >
>> > Log:
>> > =A0Put the general logic for being a CPU hog into a new function
>> > =A0should_yield(). =A0Use this in various places. =A0Encapsulate the c=
ommon
>> > =A0case of check-and-yield into a new function maybe_yield().
>> >
>> > =A0Change several checks for a magic number of iterations to use
>> > =A0should_yield() instead.
>>
>> First off, I admittedly don't know or care very much about this area,
>> but this commit stood out to me and I had a few minor concerns.
>>
>> I'm slightly uncomfortable with the flat namespace here. =A0It isn't
>> obvious from the names that maybe_yield() and should_yield() relate
>> only to uio_yield() and not other types of yielding (from DELAY() to
>> cpu_idle() to sched_yield().) =A0The other problematic element here is
>> that "maybe_yield" and "should_yield" could quite reasonably be
>> variables or functions in existing code in the kernel, and although we
>> don't try to protect against changes that could cause such collisions,
>> we shouldn't do them gratuitously, and there's even something that
>> seems aesthetically off about these; they seem...informal, even
>> Linuxy. =A0I think names like uio_should_yield() and uio_maybe_yield()
>> wouldn't have nearly as much of a problem, since the context of the
>> question of "should" is isolated to uio operations rather than, say,
>> whether the scheduler would *like* for us, as the running thread, to
>> yield, or other considerations that may be more general.
>
> I mostly agree, but these checks are no longer specific to uio. =A0Matt u=
sed
> them to replace many ad-hoc checks using counters with hardcoded maximums=
 in
> places like softupdates, etc.
>
> I don't have any good suggestions for what else you would call these. =A0=
I'm not
> sure 'sched_amcpuhog() or sched_hoggingcpu()' are really better (and thes=
e are
> not scheduler dependent, so sched_ would probably not be a good prefix).

Bruce correctly points out that the code doesn't work like I expect
with PREEMPTION, which most people will be running.

I'm thinking of adding a new per-thread field to record the last ticks
value that a voluntary mi_switch() was done, so that there's a
standard way of checking if a thread is being a hog; this will work
for both PREEMPTION and !PREEMPTION, and would be appropriate for the
places that previously used a counter.  (This would require
uio_yield() to be SW_VOL, but I can't see why it's not a voluntary
context switch anyways).

I'm happy to rename the functions (perhaps just yield_foo() rather
than foo_yield()?) and stop using uio_yield as the base name since
it's not a uio function.  I wanted to keep the uio_yield symbol to
preserve the KBI/KPI.

Any suggestions for names are welcome.

Thanks,
matthew

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 17:35:17 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 39AEF106564A;
	Thu,  3 Feb 2011 17:35:17 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 270DF8FC08;
	Thu,  3 Feb 2011 17:35:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13HZH9h053023;
	Thu, 3 Feb 2011 17:35:17 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13HZHPI053021;
	Thu, 3 Feb 2011 17:35:17 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <201102031735.p13HZHPI053021@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Thu, 3 Feb 2011 17:35: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: r218227 - head/sys/arm/arm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 17:35:17 -0000

Author: marcel
Date: Thu Feb  3 17:35:16 2011
New Revision: 218227
URL: http://svn.freebsd.org/changeset/base/218227

Log:
  Accept r1 as having the metadata pointer argument if r0 is 0.
  This provides backward compatibility with Juniper loaders.
  
  Sponsored by: Juniper Networks

Modified:
  head/sys/arm/arm/locore.S

Modified: head/sys/arm/arm/locore.S
==============================================================================
--- head/sys/arm/arm/locore.S	Thu Feb  3 15:46:54 2011	(r218226)
+++ head/sys/arm/arm/locore.S	Thu Feb  3 17:35:16 2011	(r218227)
@@ -65,14 +65,20 @@ __FBSDID("$FreeBSD$");
 
 ENTRY_NP(btext)
 
-ASENTRY_NP(_start)
-
 /*
- * Move metadata ptr to r12 (ip)
+ * On entry:
+ *	r0 - metadata pointer or 0
+ *	r1 - if (r0 == 0) then metadata pointer
  */
+ASENTRY_NP(_start)
 
+	/* Move metadata ptr to r12 (ip) */
 	mov	ip, r0
-
+	ldr	r0, =0
+	cmp	ip, r0
+	bne	1f
+	mov	ip, r1
+1:
 	/* Make sure interrupts are disabled. */
 	mrs	r7, cpsr
 	orr	r7, r7, #(I32_bit|F32_bit)

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 18:07:06 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1CBCB1065672;
	Thu,  3 Feb 2011 18:07:06 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E43038FC0A;
	Thu,  3 Feb 2011 18:07:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13I75lx053792;
	Thu, 3 Feb 2011 18:07:05 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13I75Xh053790;
	Thu, 3 Feb 2011 18:07:05 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <201102031807.p13I75Xh053790@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Thu, 3 Feb 2011 18:07:05 +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: r218228 - head/sys/arm/mv
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 18:07:06 -0000

Author: marcel
Date: Thu Feb  3 18:07:05 2011
New Revision: 218228
URL: http://svn.freebsd.org/changeset/base/218228

Log:
  The FDT describes the host controller directly. There's no need to
  get properties from the parent. The parent is in fact the FDT bus
  itself and will therefore not have the properties we're looking
  for.
  
  Sponsored by: Juniper Networks

Modified:
  head/sys/arm/mv/mv_pci.c

Modified: head/sys/arm/mv/mv_pci.c
==============================================================================
--- head/sys/arm/mv/mv_pci.c	Thu Feb  3 17:35:16 2011	(r218227)
+++ head/sys/arm/mv/mv_pci.c	Thu Feb  3 18:07:05 2011	(r218228)
@@ -212,23 +212,17 @@ static struct mtx pcicfg_mtx;
 static int
 mv_pcib_probe(device_t self)
 {
-	phandle_t parnode;
+	phandle_t node;
 
-	/*
-	 * The PCI subnode does not have the 'compatible' property, so we need
-	 * to check in the parent PCI node. However the parent is not
-	 * represented by a separate ofw_bus child, and therefore
-	 * ofw_bus_is_compatible() cannot be used, but direct fdt equivalent.
-	 */
-	parnode = OF_parent(ofw_bus_get_node(self));
-	if (parnode == 0)
+	node = ofw_bus_get_node(self);
+	if (!fdt_is_type(node, "pci"))
 		return (ENXIO);
-	if (!(fdt_is_compatible(parnode, "mrvl,pcie") ||
-	    fdt_is_compatible(parnode, "mrvl,pci")))
+
+	if (!(fdt_is_compatible(node, "mrvl,pcie") ||
+	    fdt_is_compatible(node, "mrvl,pci")))
 		return (ENXIO);
 
 	device_set_desc(self, "Marvell Integrated PCI/PCI-E Controller");
-
 	return (BUS_PROBE_DEFAULT);
 }
 
@@ -243,15 +237,16 @@ mv_pcib_attach(device_t self)
 	sc = device_get_softc(self);
 	sc->sc_dev = self;
 
-	parnode = OF_parent(ofw_bus_get_node(self));
-	if (fdt_is_compatible(parnode, "mrvl,pcie")) {
+	node = ofw_bus_get_node(self);
+	parnode = OF_parent(node);
+	if (fdt_is_compatible(node, "mrvl,pcie")) {
 		sc->sc_type = MV_TYPE_PCIE;
 		sc->sc_mem_win_target = MV_WIN_PCIE_MEM_TARGET;
 		sc->sc_mem_win_attr = MV_WIN_PCIE_MEM_ATTR;
 		sc->sc_io_win_target = MV_WIN_PCIE_IO_TARGET;
 		sc->sc_io_win_attr = MV_WIN_PCIE_IO_ATTR;
 #ifdef SOC_MV_ORION
-	} else if (fdt_is_compatible(parnode, "mrvl,pci")) {
+	} else if (fdt_is_compatible(node, "mrvl,pci")) {
 		sc->sc_type = MV_TYPE_PCI;
 		sc->sc_mem_win_target = MV_WIN_PCI_MEM_TARGET;
 		sc->sc_mem_win_attr = MV_WIN_PCI_MEM_ATTR;
@@ -261,8 +256,6 @@ mv_pcib_attach(device_t self)
 	} else
 		return (ENXIO);
 
-	node = ofw_bus_get_node(self);
-
 	/*
 	 * Get PCI interrupt info.
 	 */

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 18:25:55 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 851FD106564A;
	Thu,  3 Feb 2011 18:25:55 +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 72C958FC08;
	Thu,  3 Feb 2011 18:25:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13IPtCM054252;
	Thu, 3 Feb 2011 18:25:55 GMT (envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13IPtU7054249;
	Thu, 3 Feb 2011 18:25:55 GMT (envelope-from hselasky@svn.freebsd.org)
Message-Id: <201102031825.p13IPtU7054249@svn.freebsd.org>
From: Hans Petter Selasky 
Date: Thu, 3 Feb 2011 18:25:55 +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: r218229 - in head/sys/dev/usb: . serial
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 18:25:55 -0000

Author: hselasky
Date: Thu Feb  3 18:25:55 2011
New Revision: 218229
URL: http://svn.freebsd.org/changeset/base/218229

Log:
  Fix for detection of MTK 3329 GPS USB devices.
  
  Submitted by:	Mykhaylo Yehorov
  PR:		usb/153929
  Approved by:	thompsa (mentor)

Modified:
  head/sys/dev/usb/serial/umodem.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/serial/umodem.c
==============================================================================
--- head/sys/dev/usb/serial/umodem.c	Thu Feb  3 18:07:05 2011	(r218228)
+++ head/sys/dev/usb/serial/umodem.c	Thu Feb  3 18:25:55 2011	(r218229)
@@ -197,6 +197,8 @@ static void	*umodem_get_desc(struct usb_
 static usb_error_t umodem_set_comm_feature(struct usb_device *, uint8_t,
 		    uint16_t, uint16_t);
 static void	umodem_poll(struct ucom_softc *ucom);
+static void	umodem_find_data_iface(struct usb_attach_arg *uaa,
+		    uint8_t, uint8_t *, uint8_t *);
 
 static const struct usb_config umodem_config[UMODEM_N_TRANSFER] = {
 
@@ -311,13 +313,30 @@ umodem_attach(device_t dev)
 		    0 - 1, UDESCSUB_CDC_UNION, 0 - 1);
 
 		if ((cud == NULL) || (cud->bLength < sizeof(*cud))) {
-			device_printf(dev, "Missing descriptor. "
+			DPRINTF("Missing descriptor. "
 			    "Assuming data interface is next.\n");
-			if (sc->sc_ctrl_iface_no == 0xFF)
+			if (sc->sc_ctrl_iface_no == 0xFF) {
 				goto detach;
-			else
-				sc->sc_data_iface_no = 
-				    sc->sc_ctrl_iface_no + 1;
+			} else {
+				uint8_t class_match = 0;
+
+				/* set default interface number */
+				sc->sc_data_iface_no = 0xFF;
+
+				/* try to find the data interface backwards */
+				umodem_find_data_iface(uaa,
+				    uaa->info.bIfaceIndex - 1,
+				    &sc->sc_data_iface_no, &class_match);
+
+				/* try to find the data interface forwards */
+				umodem_find_data_iface(uaa,
+				    uaa->info.bIfaceIndex + 1,
+				    &sc->sc_data_iface_no, &class_match);
+
+				/* check if nothing was found */
+				if (sc->sc_data_iface_no == 0xFF)
+					goto detach;
+			}
 		} else {
 			sc->sc_data_iface_no = cud->bSlaveInterface[0];
 		}
@@ -398,6 +417,36 @@ detach:
 }
 
 static void
+umodem_find_data_iface(struct usb_attach_arg *uaa,
+    uint8_t iface_index, uint8_t *p_data_no, uint8_t *p_match_class)
+{
+	struct usb_interface_descriptor *id;
+	struct usb_interface *iface;
+	
+	iface = usbd_get_iface(uaa->device, iface_index);
+
+	/* check for end of interfaces */
+	if (iface == NULL)
+		return;
+
+	id = usbd_get_interface_descriptor(iface);
+
+	/* check for non-matching interface class */
+	if (id->bInterfaceClass != UICLASS_CDC_DATA ||
+	    id->bInterfaceSubClass != UISUBCLASS_DATA) {
+		/* if we got a class match then return */
+		if (*p_match_class)
+			return;
+	} else {
+		*p_match_class = 1;
+	}
+
+	DPRINTFN(11, "Match at index %u\n", iface_index);
+
+	*p_data_no = id->bInterfaceNumber;
+}
+
+static void
 umodem_start_read(struct ucom_softc *ucom)
 {
 	struct umodem_softc *sc = ucom->sc_parent;

Modified: head/sys/dev/usb/usbdevs
==============================================================================
--- head/sys/dev/usb/usbdevs	Thu Feb  3 18:07:05 2011	(r218228)
+++ head/sys/dev/usb/usbdevs	Thu Feb  3 18:25:55 2011	(r218229)
@@ -536,6 +536,7 @@ vendor SPEEDDRAGON	0x0e55	Speed Dragon M
 vendor HAWKING		0x0e66	Hawking
 vendor FOSSIL		0x0e67	Fossil, Inc
 vendor GMATE		0x0e7e	G.Mate, Inc
+vendor MEDIATEK		0x0e8d	MediaTek, Inc.
 vendor OTI		0x0ea0	Ours Technology
 vendor YISO		0x0eab	Yiso Wireless Co.
 vendor PILOTECH		0x0eaf	Pilotech
@@ -2120,6 +2121,9 @@ product MCT DU_H3SP_USB232	0x0200	D-Link
 product MCT USB232		0x0210	USB-232 Interface
 product MCT SITECOM_USB232	0x0230	Sitecom USB-232 Products
 
+/* MediaTek, Inc. */
+product MEDIATEK MTK3329	0x3329	MTK II GPS Receiver
+
 /* Meizu Electronics */
 product MEIZU M6_SL		0x0140	MiniPlayer M6 (SL)
 

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 19:10:04 2011
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CFDF0106564A;
	Thu,  3 Feb 2011 19:10:04 +0000 (UTC)
	(envelope-from rrs@lakerest.net)
Received: from lakerest.net (unknown [IPv6:2001:240:585:2:213:d4ff:fef3:2d8d])
	by mx1.freebsd.org (Postfix) with ESMTP id 7834C8FC0A;
	Thu,  3 Feb 2011 19:10:04 +0000 (UTC)
Received: from [10.1.1.53] ([10.1.1.53]) (authenticated bits=0)
	by lakerest.net (8.14.4/8.14.3) with ESMTP id p13JA3RG040858
	(version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT);
	Thu, 3 Feb 2011 14:10:03 -0500 (EST) (envelope-from rrs@lakerest.net)
Mime-Version: 1.0 (Apple Message framework v1082)
Content-Type: text/plain; charset=us-ascii
From: Randall Stewart 
In-Reply-To: <201102030745.34617.jhb@freebsd.org>
Date: Thu, 3 Feb 2011 14:10:03 -0500
Content-Transfer-Encoding: quoted-printable
Message-Id: 
References: <201102031152.p13BqM8u044432@svn.freebsd.org>
	<201102030745.34617.jhb@freebsd.org>
To: John Baldwin 
X-Mailer: Apple Mail (2.1082)
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r218219 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 19:10:05 -0000

John:

Ahh.. thanks for the information .. I did not know that.

I will change it to use it..

Before it was using the define.. which as Julian said a while ago was a
bad idea.

R
On Feb 3, 2011, at 7:45 AM, John Baldwin wrote:

> On Thursday, February 03, 2011 6:52:22 am Randall Stewart wrote:
>> Author: rrs
>> Date: Thu Feb  3 11:52:22 2011
>> New Revision: 218219
>> URL: http://svn.freebsd.org/changeset/base/218219
>>=20
>> Log:
>>  Fix the per CPU stats so that:
>>  1) They don't use the giant "MAX_CPU" define and instead
>>     are allocated dynamically based on mp_ncpus
>=20
> You probably want to use mp_maxid instead.  CPU IDs are not guaranteed =
to be=20
> contiguous (though they currently are).  Instead, the only guarantee =
are that=20
> there are mp_ncpus CPUs numbered 0 ... mp_maxid.  There may be gaps in =
that=20
> range (and there have been in the past).
>=20
> --=20
> John Baldwin
>=20

------------------------------
Randall Stewart
803-317-4952 (cell)


From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 19:22:21 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8CEF81065670;
	Thu,  3 Feb 2011 19:22:21 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7AF228FC0C;
	Thu,  3 Feb 2011 19:22:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13JMLmP055705;
	Thu, 3 Feb 2011 19:22:21 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13JML8i055697;
	Thu, 3 Feb 2011 19:22:21 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <201102031922.p13JML8i055697@svn.freebsd.org>
From: Randall Stewart 
Date: Thu, 3 Feb 2011 19:22: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: r218232 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 19:22:21 -0000

Author: rrs
Date: Thu Feb  3 19:22:21 2011
New Revision: 218232
URL: http://svn.freebsd.org/changeset/base/218232

Log:
  1) Move per John Baldwin to mp_maxid
  2) Some signed/unsigned errors found by Mac OS compiler (from Michael)
  3) a couple of copyright updates on the effected files.
  
  MFC after:	3 months

Modified:
  head/sys/netinet/sctp_asconf.c
  head/sys/netinet/sctp_cc_functions.c
  head/sys/netinet/sctp_constants.h
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_sysctl.c

Modified: head/sys/netinet/sctp_asconf.c
==============================================================================
--- head/sys/netinet/sctp_asconf.c	Thu Feb  3 18:50:10 2011	(r218231)
+++ head/sys/netinet/sctp_asconf.c	Thu Feb  3 19:22:21 2011	(r218232)
@@ -1,5 +1,8 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
+ *                          Michael Tuexen, tuexen@fh-muenster.de
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -1348,7 +1351,7 @@ sctp_asconf_queue_mgmt(struct sctp_tcb *
 
 	TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa, next);
 #ifdef SCTP_DEBUG
-	if (SCTP_BASE_SYSCTL(sctp_debug_on) && SCTP_DEBUG_ASCONF2) {
+	if (SCTP_BASE_SYSCTL(sctp_debug_on) & SCTP_DEBUG_ASCONF2) {
 		if (type == SCTP_ADD_IP_ADDRESS) {
 			SCTP_PRINTF("asconf_queue_mgmt: inserted asconf ADD_IP_ADDRESS: ");
 			SCTPDBG_ADDR(SCTP_DEBUG_ASCONF2, sa);

Modified: head/sys/netinet/sctp_cc_functions.c
==============================================================================
--- head/sys/netinet/sctp_cc_functions.c	Thu Feb  3 18:50:10 2011	(r218231)
+++ head/sys/netinet/sctp_cc_functions.c	Thu Feb  3 19:22:21 2011	(r218232)
@@ -1,5 +1,8 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
+ *                          Michael Tuexen, tuexen@fh-muenster.de
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -375,8 +378,6 @@ sctp_cwnd_update_after_sack(struct sctp_
 				}
 			} else {
 				/* We are in congestion avoidance */
-				uint32_t incr;
-
 				/*
 				 * Add to pba
 				 */
@@ -514,7 +515,8 @@ sctp_cwnd_update_after_packet_dropped(st
     uint32_t * bottle_bw, uint32_t * on_queue)
 {
 	uint32_t bw_avail;
-	int rtt, incr;
+	int rtt;
+	unsigned int incr;
 	int old_cwnd = net->cwnd;
 
 	/* need real RTT for this calc */

Modified: head/sys/netinet/sctp_constants.h
==============================================================================
--- head/sys/netinet/sctp_constants.h	Thu Feb  3 18:50:10 2011	(r218231)
+++ head/sys/netinet/sctp_constants.h	Thu Feb  3 19:22:21 2011	(r218232)
@@ -1,5 +1,8 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
+ *                          Michael Tuexen, tuexen@fh-muenster.de
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -915,11 +918,11 @@ __FBSDID("$FreeBSD$");
 
 /* modular comparison */
 /* See RFC 1982 for details. */
-#define SCTP_SSN_GT(a, b) (((a < b) && ((b - a) > (1<<15))) || \
-                           ((a > b) && ((a - b) < (1<<15))))
+#define SCTP_SSN_GT(a, b) (((a < b) && ((uint16_t)(b - a) > (1U<<15))) || \
+                           ((a > b) && ((uint16_t)(a - b) < (1U<<15))))
 #define SCTP_SSN_GE(a, b) (SCTP_SSN_GT(a, b) || (a == b))
-#define SCTP_TSN_GT(a, b) (((a < b) && ((b - a) > (1<<31))) || \
-                           ((a > b) && ((a - b) < (1<<31))))
+#define SCTP_TSN_GT(a, b) (((a < b) && ((uint32_t)(b - a) > (1U<<31))) || \
+                           ((a > b) && ((uint32_t)(a - b) < (1U<<31))))
 #define SCTP_TSN_GE(a, b) (SCTP_TSN_GT(a, b) || (a == b))
 
 /* Mapping array manipulation routines */

Modified: head/sys/netinet/sctp_input.c
==============================================================================
--- head/sys/netinet/sctp_input.c	Thu Feb  3 18:50:10 2011	(r218231)
+++ head/sys/netinet/sctp_input.c	Thu Feb  3 19:22:21 2011	(r218232)
@@ -1,5 +1,8 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
+ *                          Michael Tuexen, tuexen@fh-muenster.de
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -2918,7 +2921,7 @@ sctp_handle_ecn_echo(struct sctp_ecne_ch
 	uint8_t override_bit = 0;
 	uint32_t tsn, window_data_tsn;
 	int len;
-	int pkt_cnt;
+	unsigned int pkt_cnt;
 
 	len = ntohs(cp->ch.chunk_length);
 	if ((len != sizeof(struct sctp_ecne_chunk)) &&
@@ -5933,7 +5936,7 @@ sctp_input(struct mbuf *m, int off)
 	int offset;
 	int cpu_to_use;
 
-	if (mp_ncpus > 1) {
+	if (mp_maxid > 1) {
 		ip = mtod(m, struct ip *);
 		offset = off + sizeof(*sh);
 		if (SCTP_BUF_LEN(m) < offset) {
@@ -5944,7 +5947,7 @@ sctp_input(struct mbuf *m, int off)
 			ip = mtod(m, struct ip *);
 		}
 		sh = (struct sctphdr *)((caddr_t)ip + off);
-		cpu_to_use = ntohl(sh->v_tag) % mp_ncpus;
+		cpu_to_use = ntohl(sh->v_tag) % mp_maxid;
 		sctp_queue_to_mcore(m, off, cpu_to_use);
 		return;
 	}

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Thu Feb  3 18:50:10 2011	(r218231)
+++ head/sys/netinet/sctp_output.c	Thu Feb  3 19:22:21 2011	(r218232)
@@ -1,5 +1,8 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
+ *                          Michael Tuexen, tuexen@fh-muenster.de
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -9311,14 +9314,15 @@ sctp_chunk_output(struct sctp_inpcb *inp
 	 */
 	struct sctp_association *asoc;
 	struct sctp_nets *net;
-	int error = 0, num_out = 0, tot_out = 0, ret = 0, reason_code = 0,
-	    burst_cnt = 0;
+	int error = 0, num_out = 0, tot_out = 0, ret = 0, reason_code = 0;
+	unsigned int burst_cnt = 0;
 	struct timeval now;
 	int now_filled = 0;
 	int nagle_on = 0;
 	int frag_point = sctp_get_frag_point(stcb, &stcb->asoc);
 	int un_sent = 0;
-	int fr_done, tot_frs = 0;
+	int fr_done;
+	unsigned int tot_frs = 0;
 
 	asoc = &stcb->asoc;
 	if (from_where == SCTP_OUTPUT_FROM_USR_SEND) {

Modified: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c	Thu Feb  3 18:50:10 2011	(r218231)
+++ head/sys/netinet/sctp_pcb.c	Thu Feb  3 19:22:21 2011	(r218232)
@@ -5549,27 +5549,27 @@ sctp_startup_mcore_threads(void)
 {
 	int i;
 
-	if (mp_ncpus == 1)
+	if (mp_maxid == 1)
 		return;
 
 	SCTP_MALLOC(sctp_mcore_workers, struct sctp_mcore_ctrl *,
-	    (mp_ncpus * sizeof(struct sctp_mcore_ctrl)),
+	    (mp_maxid * sizeof(struct sctp_mcore_ctrl)),
 	    SCTP_M_MCORE);
 	if (sctp_mcore_workers == NULL) {
 		/* TSNH I hope */
 		return;
 	}
-	memset(sctp_mcore_workers, 0, (mp_ncpus *
+	memset(sctp_mcore_workers, 0, (mp_maxid *
 	    sizeof(struct sctp_mcore_ctrl)));
 	/* Init the structures */
-	for (i = 0; i < mp_ncpus; i++) {
+	for (i = 0; i < mp_maxid; i++) {
 		TAILQ_INIT(&sctp_mcore_workers[i].que);
 		SCTP_MCORE_LOCK_INIT(&sctp_mcore_workers[i]);
 		SCTP_MCORE_QLOCK_INIT(&sctp_mcore_workers[i]);
 		sctp_mcore_workers[i].cpuid = i;
 	}
 	/* Now start them all */
-	for (i = 0; i < mp_ncpus; i++) {
+	for (i = 0; i < mp_maxid; i++) {
 		(void)kproc_create(sctp_mcore_thread,
 		    (void *)&sctp_mcore_workers[i],
 		    &sctp_mcore_workers[i].thread_proc,
@@ -5604,12 +5604,12 @@ sctp_pcb_init()
 #endif
 #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
 	SCTP_MALLOC(SCTP_BASE_STATS, struct sctpstat *,
-	    (mp_ncpus * sizeof(struct sctpstat)),
+	    (mp_maxid * sizeof(struct sctpstat)),
 	    SCTP_M_MCORE);
 #endif
 	(void)SCTP_GETTIME_TIMEVAL(&tv);
 #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
-	bzero(SCTP_BASE_STATS, (sizeof(struct sctpstat) * mp_ncpus));
+	bzero(SCTP_BASE_STATS, (sizeof(struct sctpstat) * mp_maxid));
 	SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_sec = (uint32_t) tv.tv_sec;
 	SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_usec = (uint32_t) tv.tv_usec;
 #else

Modified: head/sys/netinet/sctp_sysctl.c
==============================================================================
--- head/sys/netinet/sctp_sysctl.c	Thu Feb  3 18:50:10 2011	(r218231)
+++ head/sys/netinet/sctp_sysctl.c	Thu Feb  3 19:22:21 2011	(r218232)
@@ -664,7 +664,7 @@ sysctl_stat_get(SYSCTL_HANDLER_ARGS)
 		return (EINVAL);
 	}
 	memset(&sb, 0, sizeof(sb));
-	for (cpu = 0; cpu < mp_ncpus; cpu++) {
+	for (cpu = 0; cpu < mp_maxid; cpu++) {
 		sarry = &SCTP_BASE_STATS[cpu];
 		if (sarry->sctps_discontinuitytime.tv_sec > sb.sctps_discontinuitytime.tv_sec) {
 			sb.sctps_discontinuitytime.tv_sec = sarry->sctps_discontinuitytime.tv_sec;

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 19:59:01 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 41377106566B;
	Thu,  3 Feb 2011 19:59:01 +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 3047E8FC0A;
	Thu,  3 Feb 2011 19:59:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13Jx1MH056614;
	Thu, 3 Feb 2011 19:59:01 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13Jx0tj056607;
	Thu, 3 Feb 2011 19:59:00 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <201102031959.p13Jx0tj056607@svn.freebsd.org>
From: Michael Tuexen 
Date: Thu, 3 Feb 2011 19:59:00 +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: r218235 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 19:59:01 -0000

Author: tuexen
Date: Thu Feb  3 19:59:00 2011
New Revision: 218235
URL: http://svn.freebsd.org/changeset/base/218235

Log:
  Make sure that changing the ECN sysctl does not affect
  exisiting associations and endpoints.
  
  MFC after: 3 months.

Modified:
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_pcb.h
  head/sys/netinet/sctp_peeloff.c
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctp_input.c
==============================================================================
--- head/sys/netinet/sctp_input.c	Thu Feb  3 19:50:42 2011	(r218234)
+++ head/sys/netinet/sctp_input.c	Thu Feb  3 19:59:00 2011	(r218235)
@@ -2719,6 +2719,7 @@ sctp_handle_cookie_echo(struct mbuf *m, 
 			inp->sctp_socket = so;
 			inp->sctp_frag_point = (*inp_p)->sctp_frag_point;
 			inp->sctp_cmt_on_off = (*inp_p)->sctp_cmt_on_off;
+			inp->sctp_ecn_enable = (*inp_p)->sctp_ecn_enable;
 			inp->partial_delivery_point = (*inp_p)->partial_delivery_point;
 			inp->sctp_context = (*inp_p)->sctp_context;
 			inp->inp_starting_point_for_iterator = NULL;
@@ -5614,7 +5615,8 @@ sctp_common_input_processing(struct mbuf
 		 */
 	}
 	/* take care of ecn */
-	if (stcb->asoc.ecn_allowed && ((ecn_bits & SCTP_CE_BITS) == SCTP_CE_BITS)) {
+	if ((stcb->asoc.ecn_allowed == 1) &&
+	    ((ecn_bits & SCTP_CE_BITS) == SCTP_CE_BITS)) {
 		/* Yep, we need to add a ECNE */
 		sctp_send_ecn_echo(stcb, net, high_tsn);
 	}

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Thu Feb  3 19:50:42 2011	(r218234)
+++ head/sys/netinet/sctp_output.c	Thu Feb  3 19:59:00 2011	(r218235)
@@ -3392,10 +3392,11 @@ static uint8_t
 sctp_get_ect(struct sctp_tcb *stcb,
     struct sctp_tmit_chunk *chk)
 {
-	if (SCTP_BASE_SYSCTL(sctp_ecn_enable) == 0)
+	if ((stcb != NULL) && (stcb->asoc.ecn_allowed == 1)) {
+		return (SCTP_ECT0_BIT);
+	} else {
 		return (0);
-
-	return (SCTP_ECT0_BIT);
+	}
 }
 
 static int
@@ -3502,17 +3503,9 @@ sctp_lowlevel_chunk_output(struct sctp_i
 
 		ip->ip_ttl = inp->ip_inp.inp.inp_ip_ttl;
 		ip->ip_len = packet_length;
-		if (stcb) {
-			if ((stcb->asoc.ecn_allowed) && ecn_ok) {
-				/* Enable ECN */
-				ip->ip_tos = ((u_char)(tos_value & 0xfc) | sctp_get_ect(stcb, chk));
-			} else {
-				/* No ECN */
-				ip->ip_tos = (u_char)(tos_value & 0xfc);
-			}
-		} else {
-			/* no association at all */
-			ip->ip_tos = (tos_value & 0xfc);
+		ip->ip_tos = tos_value & 0xfc;
+		if (ecn_ok) {
+			ip->ip_tos |= sctp_get_ect(stcb, chk);
 		}
 		if (port) {
 			ip->ip_p = IPPROTO_UDP;
@@ -3839,18 +3832,11 @@ sctp_lowlevel_chunk_output(struct sctp_i
 		} else {
 			ro = (sctp_route_t *) & net->ro;
 		}
-		if (stcb != NULL) {
-			if ((stcb->asoc.ecn_allowed) && ecn_ok) {
-				/* Enable ECN */
-				tosBottom = (((((struct in6pcb *)inp)->in6p_flowinfo & 0x0c) | sctp_get_ect(stcb, chk)) << 4);
-			} else {
-				/* No ECN */
-				tosBottom = ((((struct in6pcb *)inp)->in6p_flowinfo & 0x0c) << 4);
-			}
-		} else {
-			/* we could get no asoc if it is a O-O-T-B packet */
-			tosBottom = ((((struct in6pcb *)inp)->in6p_flowinfo & 0x0c) << 4);
+		tosBottom = (((struct in6pcb *)inp)->in6p_flowinfo & 0x0c);
+		if (ecn_ok) {
+			tosBottom |= sctp_get_ect(stcb, chk);
 		}
+		tosBottom <<= 4;
 		ip6h->ip6_flow = htonl(((tosTop << 24) | ((tosBottom | flowTop) << 16) | flowBottom));
 		if (port) {
 			ip6h->ip6_nxt = IPPROTO_UDP;
@@ -4247,7 +4233,7 @@ sctp_send_initiate(struct sctp_inpcb *in
 		stcb->asoc.cookie_preserve_req = 0;
 	}
 	/* ECN parameter */
-	if (SCTP_BASE_SYSCTL(sctp_ecn_enable) == 1) {
+	if (stcb->asoc.ecn_allowed == 1) {
 		ecn->ph.param_type = htons(SCTP_ECN_CAPABLE);
 		ecn->ph.param_length = htons(sizeof(*ecn));
 		SCTP_BUF_LEN(m) += sizeof(*ecn);
@@ -5350,7 +5336,8 @@ do_a_abort:
 	ecn = (struct sctp_ecn_supported_param *)((caddr_t)ali + sizeof(*ali));
 
 	/* ECN parameter */
-	if (SCTP_BASE_SYSCTL(sctp_ecn_enable) == 1) {
+	if (((asoc != NULL) && (asoc->ecn_allowed == 1)) ||
+	    (inp->sctp_ecn_enable == 1)) {
 		ecn->ph.param_type = htons(SCTP_ECN_CAPABLE);
 		ecn->ph.param_length = htons(sizeof(*ecn));
 		SCTP_BUF_LEN(m) += sizeof(*ecn);

Modified: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c	Thu Feb  3 19:50:42 2011	(r218234)
+++ head/sys/netinet/sctp_pcb.c	Thu Feb  3 19:59:00 2011	(r218235)
@@ -2399,6 +2399,7 @@ sctp_inpcb_alloc(struct socket *so, uint
 	inp->partial_delivery_point = SCTP_SB_LIMIT_RCV(so) >> SCTP_PARTIAL_DELIVERY_SHIFT;
 	inp->sctp_frag_point = SCTP_DEFAULT_MAXSEGMENT;
 	inp->sctp_cmt_on_off = SCTP_BASE_SYSCTL(sctp_cmt_on_off);
+	inp->sctp_ecn_enable = SCTP_BASE_SYSCTL(sctp_ecn_enable);
 	/* init the small hash table we use to track asocid <-> tcb */
 	inp->sctp_asocidhash = SCTP_HASH_INIT(SCTP_STACK_VTAG_HASH_SIZE, &inp->hashasocidmark);
 	if (inp->sctp_asocidhash == NULL) {
@@ -5899,6 +5900,7 @@ sctp_load_addresses_from_init(struct sct
 	sctp_key_t *new_key;
 	uint32_t keylen;
 	int got_random = 0, got_hmacs = 0, got_chklist = 0;
+	uint8_t ecn_allowed;
 
 	/* First get the destination address setup too. */
 	memset(&sin, 0, sizeof(sin));
@@ -5959,7 +5961,7 @@ sctp_load_addresses_from_init(struct sct
 		sa = altsa;
 	}
 	/* Turn off ECN until we get through all params */
-	stcb->asoc.ecn_allowed = 0;
+	ecn_allowed = 0;
 	TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
 		/* mark all addresses that we have currently on the list */
 		net->dest_state |= SCTP_ADDR_NOT_IN_ASSOC;
@@ -6192,7 +6194,7 @@ sctp_load_addresses_from_init(struct sct
 				}
 			}
 		} else if (ptype == SCTP_ECN_CAPABLE) {
-			stcb->asoc.ecn_allowed = 1;
+			ecn_allowed = 1;
 		} else if (ptype == SCTP_ULP_ADAPTATION) {
 			if (stcb->asoc.state != SCTP_STATE_OPEN) {
 				struct sctp_adaptation_layer_indication ai,
@@ -6431,6 +6433,9 @@ next_param:
 			}
 		}
 	}
+	if (ecn_allowed == 0) {
+		stcb->asoc.ecn_allowed = 0;
+	}
 	/* validate authentication required parameters */
 	if (got_random && got_hmacs) {
 		stcb->asoc.peer_supports_auth = 1;

Modified: head/sys/netinet/sctp_pcb.h
==============================================================================
--- head/sys/netinet/sctp_pcb.h	Thu Feb  3 19:50:42 2011	(r218234)
+++ head/sys/netinet/sctp_pcb.h	Thu Feb  3 19:59:00 2011	(r218235)
@@ -394,6 +394,7 @@ struct sctp_inpcb {
 	uint32_t partial_delivery_point;
 	uint32_t sctp_context;
 	uint32_t sctp_cmt_on_off;
+	uint32_t sctp_ecn_enable;
 	struct sctp_nonpad_sndrcvinfo def_send;
 	/*-
 	 * These three are here for the sosend_dgram

Modified: head/sys/netinet/sctp_peeloff.c
==============================================================================
--- head/sys/netinet/sctp_peeloff.c	Thu Feb  3 19:50:42 2011	(r218234)
+++ head/sys/netinet/sctp_peeloff.c	Thu Feb  3 19:59:00 2011	(r218235)
@@ -1,5 +1,8 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
+ *                          Michael Tuexen, tuexen@fh-muenster.de
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -113,6 +116,7 @@ sctp_do_peeloff(struct socket *head, str
 	n_inp->sctp_mobility_features = inp->sctp_mobility_features;
 	n_inp->sctp_frag_point = inp->sctp_frag_point;
 	n_inp->sctp_cmt_on_off = inp->sctp_cmt_on_off;
+	n_inp->sctp_ecn_enable = inp->sctp_ecn_enable;
 	n_inp->partial_delivery_point = inp->partial_delivery_point;
 	n_inp->sctp_context = inp->sctp_context;
 	n_inp->inp_starting_point_for_iterator = NULL;
@@ -185,6 +189,7 @@ sctp_get_peeloff(struct socket *head, sc
 	n_inp->sctp_features = inp->sctp_features;
 	n_inp->sctp_frag_point = inp->sctp_frag_point;
 	n_inp->sctp_cmt_on_off = inp->sctp_cmt_on_off;
+	n_inp->sctp_ecn_enable = inp->sctp_ecn_enable;
 	n_inp->partial_delivery_point = inp->partial_delivery_point;
 	n_inp->sctp_context = inp->sctp_context;
 	n_inp->inp_starting_point_for_iterator = NULL;

Modified: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c	Thu Feb  3 19:50:42 2011	(r218234)
+++ head/sys/netinet/sctputil.c	Thu Feb  3 19:59:00 2011	(r218235)
@@ -1,5 +1,8 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
+ *                          Michael Tuexen, tuexen@fh-muenster.de
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -917,6 +920,7 @@ sctp_init_asoc(struct sctp_inpcb *m, str
 	asoc->heart_beat_delay = TICKS_TO_MSEC(m->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT]);
 	asoc->cookie_life = m->sctp_ep.def_cookie_life;
 	asoc->sctp_cmt_on_off = m->sctp_cmt_on_off;
+	asoc->ecn_allowed = m->sctp_ecn_enable;
 	asoc->sctp_nr_sack_on_off = (uint8_t) SCTP_BASE_SYSCTL(sctp_nr_sack_on_off);
 	asoc->sctp_cmt_pf = (uint8_t) SCTP_BASE_SYSCTL(sctp_cmt_pf);
 	asoc->sctp_frag_point = m->sctp_frag_point;

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 20:26:26 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 870D4106564A;
	Thu,  3 Feb 2011 20:26:26 +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 775848FC17;
	Thu,  3 Feb 2011 20:26:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13KQQWT057421;
	Thu, 3 Feb 2011 20:26:26 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13KQQX2057419;
	Thu, 3 Feb 2011 20:26:26 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201102032026.p13KQQX2057419@svn.freebsd.org>
From: Adrian Chadd 
Date: Thu, 3 Feb 2011 20:26:26 +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: r218238 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 20:26:26 -0000

Author: adrian
Date: Thu Feb  3 20:26:26 2011
New Revision: 218238
URL: http://svn.freebsd.org/changeset/base/218238

Log:
  Disable the code I previously added from Rui's 802.11n branch.
  
  A-MPDU RX interferes with packet retransmission/reordering.
  In local testing, I was seeing A-MPDU being negotiated and then
  not used by the AP sending frames to the STA; the STA would then
  treat non A-MPDU frames that are retransmits as out of the window
  and get plain confused.
  
  The hardware RX status descriptor has a "I'm part of an aggregate"
  bit; so this should eventually be tested and then punted to the
  A-MPDU reorder handling only if it has this bit set.

Modified:
  head/sys/dev/ath/if_ath.c

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Thu Feb  3 20:10:16 2011	(r218237)
+++ head/sys/dev/ath/if_ath.c	Thu Feb  3 20:26:26 2011	(r218238)
@@ -3892,9 +3892,15 @@ rx_accept:
 				IEEE80211_KEYIX_NONE : rs->rs_keyix);
 		sc->sc_lastrs = rs;
 		if (ni != NULL) {
+#if NOTYET
 		/* tag AMPDU aggregates for reorder processing */
+		/*
+		 * XXX this should only tag frames marked as aggregate; rather
+		 * XXX than all frames.
+		 */
 		if (ni->ni_flags & IEEE80211_NODE_HT)
 			m->m_flags |= M_AMPDU;
+#endif
 
 			/*
 			 * Sending station is known, dispatch directly.

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 20:30:18 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1859E106564A;
	Thu,  3 Feb 2011 20:30: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 0810A8FC12;
	Thu,  3 Feb 2011 20:30:18 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13KUHJ9057587;
	Thu, 3 Feb 2011 20:30:17 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13KUH9B057585;
	Thu, 3 Feb 2011 20:30:17 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201102032030.p13KUH9B057585@svn.freebsd.org>
From: Adrian Chadd 
Date: Thu, 3 Feb 2011 20:30: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: r218240 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 20:30:18 -0000

Author: adrian
Date: Thu Feb  3 20:30:17 2011
New Revision: 218240
URL: http://svn.freebsd.org/changeset/base/218240

Log:
  Modify the TX path to set and use the 11n rate scenario bits.
  
  This isn't strictly required to TX (at least non-agg and non-HT40,
  non-short-GI) frames; but as it needs to be done anyway, just get
  it done.
  
  Linux ath9k uses the rate scenario style path for -all- packets,
  legacy or otherwise. This code does much the same.
  
  Beacon TX still uses the legacy, non-rate-scenario TX descriptor
  setup. Ath9k also does this.
  
  This 11n rate scenario path is only called for chips in the AR5416
  HAL; legacy chips use the previous interface for TX'ing.

Modified:
  head/sys/dev/ath/if_ath_tx.c

Modified: head/sys/dev/ath/if_ath_tx.c
==============================================================================
--- head/sys/dev/ath/if_ath_tx.c	Thu Feb  3 20:27:20 2011	(r218239)
+++ head/sys/dev/ath/if_ath_tx.c	Thu Feb  3 20:30:17 2011	(r218240)
@@ -97,6 +97,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 
 /*
  * Whether to use the 11n rate scenario functions or not
@@ -482,6 +483,10 @@ ath_tx_start(struct ath_softc *sc, struc
 	HAL_BOOL shortPreamble;
 	struct ath_node *an;
 	u_int pri;
+	uint8_t try[4], rate[4];
+
+	bzero(try, sizeof(try));
+	bzero(rate, sizeof(rate));
 
 	wh = mtod(m0, struct ieee80211_frame *);
 	iswep = wh->i_fc[1] & IEEE80211_FC1_WEP;
@@ -768,10 +773,17 @@ ath_tx_start(struct ath_softc *sc, struc
 		txq->axq_intrcnt = 0;
 	}
 
+	if (ath_tx_is_11n(sc)) {
+		rate[0] = rix;
+		try[0] = try0;
+	}
+
 	/*
 	 * Formulate first tx descriptor with tx controls.
 	 */
 	/* XXX check return value? */
+	/* XXX is this ok to call for 11n descriptors? */
+	/* XXX or should it go through the first, next, last 11n calls? */
 	ath_hal_setuptxdesc(ah, ds
 		, pktlen		/* packet length */
 		, hdrlen		/* header length */
@@ -792,8 +804,16 @@ ath_tx_start(struct ath_softc *sc, struc
 	 * when the hardware supports multi-rate retry and
 	 * we don't use it.
 	 */
-	if (ismrr)
-		ath_rate_setupxtxdesc(sc, an, ds, shortPreamble, rix);
+        if (ismrr) {
+                if (ath_tx_is_11n(sc))
+                        ath_rate_getxtxrates(sc, an, rix, rate, try);
+                else
+                        ath_rate_setupxtxdesc(sc, an, ds, shortPreamble, rix);
+        }
+
+        if (ath_tx_is_11n(sc)) {
+                ath_buf_set_rate(sc, ni, bf, pktlen, flags, ctsrate, rate, try);
+        }
 
 	ath_tx_handoff(sc, txq, bf);
 	return 0;
@@ -817,6 +837,10 @@ ath_tx_raw_start(struct ath_softc *sc, s
 	const HAL_RATE_TABLE *rt;
 	struct ath_desc *ds;
 	u_int pri;
+	uint8_t try[4], rate[4];
+
+	bzero(try, sizeof(try));
+	bzero(rate, sizeof(rate));
 
 	wh = mtod(m0, struct ieee80211_frame *);
 	ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1);
@@ -925,30 +949,56 @@ ath_tx_raw_start(struct ath_softc *sc, s
 	);
 	bf->bf_txflags = flags;
 
-	if (ismrr) {
-		rix = ath_tx_findrix(sc, params->ibp_rate1);
-		rate1 = rt->info[rix].rateCode;
-		if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
-			rate1 |= rt->info[rix].shortPreamble;
-		if (params->ibp_try2) {
-			rix = ath_tx_findrix(sc, params->ibp_rate2);
-			rate2 = rt->info[rix].rateCode;
-			if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
-				rate2 |= rt->info[rix].shortPreamble;
-		} else
-			rate2 = 0;
-		if (params->ibp_try3) {
-			rix = ath_tx_findrix(sc, params->ibp_rate3);
-			rate3 = rt->info[rix].rateCode;
+	if (ath_tx_is_11n(sc)) {
+		rate[0] = ath_tx_findrix(sc, params->ibp_rate0);
+		try[0] = params->ibp_try0;
+
+		if (ismrr) {
+			/* Remember, rate[] is actually an array of rix's -adrian */
+			rate[0] = ath_tx_findrix(sc, params->ibp_rate0);
+			rate[1] = ath_tx_findrix(sc, params->ibp_rate1);
+			rate[2] = ath_tx_findrix(sc, params->ibp_rate2);
+			rate[3] = ath_tx_findrix(sc, params->ibp_rate3);
+
+			try[0] = params->ibp_try0;
+			try[1] = params->ibp_try1;
+			try[2] = params->ibp_try2;
+			try[3] = params->ibp_try3;
+		}
+	} else {
+		if (ismrr) {
+			rix = ath_tx_findrix(sc, params->ibp_rate1);
+			rate1 = rt->info[rix].rateCode;
 			if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
-				rate3 |= rt->info[rix].shortPreamble;
-		} else
-			rate3 = 0;
-		ath_hal_setupxtxdesc(ah, ds
-			, rate1, params->ibp_try1	/* series 1 */
-			, rate2, params->ibp_try2	/* series 2 */
-			, rate3, params->ibp_try3	/* series 3 */
-		);
+				rate1 |= rt->info[rix].shortPreamble;
+			if (params->ibp_try2) {
+				rix = ath_tx_findrix(sc, params->ibp_rate2);
+				rate2 = rt->info[rix].rateCode;
+				if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
+					rate2 |= rt->info[rix].shortPreamble;
+			} else
+				rate2 = 0;
+			if (params->ibp_try3) {
+				rix = ath_tx_findrix(sc, params->ibp_rate3);
+				rate3 = rt->info[rix].rateCode;
+				if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
+					rate3 |= rt->info[rix].shortPreamble;
+			} else
+				rate3 = 0;
+			ath_hal_setupxtxdesc(ah, ds
+				, rate1, params->ibp_try1	/* series 1 */
+				, rate2, params->ibp_try2	/* series 2 */
+				, rate3, params->ibp_try3	/* series 3 */
+			);
+		}
+	}
+
+	if (ath_tx_is_11n(sc)) {
+		/*
+		 * notice that rix doesn't include any of the "magic" flags txrate
+		 * does for communicating "other stuff" to the HAL.
+		 */
+		ath_buf_set_rate(sc, ni, bf, pktlen, flags, ctsrate, rate, try);
 	}
 
 	/* NB: no buffered multicast in power save support */

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 20:34:17 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 43C85106564A;
	Thu,  3 Feb 2011 20:34:17 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 142FF8FC0C;
	Thu,  3 Feb 2011 20:34:17 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 9A6B946B2C;
	Thu,  3 Feb 2011 15:34:16 -0500 (EST)
Received: from jhbbsd.localnet (unknown [209.249.190.10])
	by bigwig.baldwin.cx (Postfix) with ESMTPSA id C01E18A009;
	Thu,  3 Feb 2011 15:34:15 -0500 (EST)
From: John Baldwin 
To: Randall Stewart 
Date: Thu, 3 Feb 2011 15:29:24 -0500
User-Agent: KMail/1.13.5 (FreeBSD/7.4-CBSD-20110107; KDE/4.4.5; amd64; ; )
References: <201102031922.p13JML8i055697@svn.freebsd.org>
In-Reply-To: <201102031922.p13JML8i055697@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <201102031529.25072.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6
	(bigwig.baldwin.cx); Thu, 03 Feb 2011 15:34:15 -0500 (EST)
X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=0.5 required=4.2 tests=BAYES_00,MAY_BE_FORGED,
	RDNS_DYNAMIC autolearn=no version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218232 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 20:34:17 -0000

On Thursday, February 03, 2011 2:22:21 pm Randall Stewart wrote:
> Author: rrs
> Date: Thu Feb  3 19:22:21 2011
> New Revision: 218232
> URL: http://svn.freebsd.org/changeset/base/218232
> 
> Log:
>   1) Move per John Baldwin to mp_maxid
>   2) Some signed/unsigned errors found by Mac OS compiler (from Michael)
>   3) a couple of copyright updates on the effected files.

Note that mp_maxid is the maxium valid ID, so you typically have to do things 
like:

	for (i = 0; i <= mp_maxid; i++) {
		if (CPU_ABSENT(i))
			continue;
		...
	}

There is a CPU_FOREACH() macro that does the above (but assumes you want to 
skip over non-existent CPUs).

> Modified: head/sys/netinet/sctp_input.c
> 
==============================================================================
> --- head/sys/netinet/sctp_input.c	Thu Feb  3 18:50:10 2011	(r218231)
> +++ head/sys/netinet/sctp_input.c	Thu Feb  3 19:22:21 2011	(r218232)
> @@ -1,5 +1,8 @@
>  /*-
>   * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
> + * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
> + *                          Michael Tuexen, tuexen@fh-muenster.de
> + *                          All rights reserved.
>   *
>   * Redistribution and use in source and binary forms, with or without
>   * modification, are permitted provided that the following conditions are 
met:
> @@ -2918,7 +2921,7 @@ sctp_handle_ecn_echo(struct sctp_ecne_ch
>  	uint8_t override_bit = 0;
>  	uint32_t tsn, window_data_tsn;
>  	int len;
> -	int pkt_cnt;
> +	unsigned int pkt_cnt;
>  
>  	len = ntohs(cp->ch.chunk_length);
>  	if ((len != sizeof(struct sctp_ecne_chunk)) &&
> @@ -5933,7 +5936,7 @@ sctp_input(struct mbuf *m, int off)
>  	int offset;
>  	int cpu_to_use;
>  
> -	if (mp_ncpus > 1) {
> +	if (mp_maxid > 1) {

The old version of this is still correct.

>  		ip = mtod(m, struct ip *);
>  		offset = off + sizeof(*sh);
>  		if (SCTP_BUF_LEN(m) < offset) {
> @@ -5944,7 +5947,7 @@ sctp_input(struct mbuf *m, int off)
>  			ip = mtod(m, struct ip *);
>  		}
>  		sh = (struct sctphdr *)((caddr_t)ip + off);
> -		cpu_to_use = ntohl(sh->v_tag) % mp_ncpus;
> +		cpu_to_use = ntohl(sh->v_tag) % mp_maxid;

Hmmm, this is more complicated.   Can sctp_queue_to_mcore() handle the fact 
that a cpu_to_use value might not be valid?  If not you might want to maintain 
a separate "dense" virtual CPU ID table numbered 0 .. mp_ncpus - 1 that maps 
to "present" FreeBSD CPU IDs.  I think Robert has done something similar to 
support RSS in TCP.  Does that make sense?

-- 
John Baldwin

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 20:44:49 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8E538106566C;
	Thu,  3 Feb 2011 20:44:49 +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 7D2668FC15;
	Thu,  3 Feb 2011 20:44:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13Kin35057960;
	Thu, 3 Feb 2011 20:44:49 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13KinL3057953;
	Thu, 3 Feb 2011 20:44:49 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <201102032044.p13KinL3057953@svn.freebsd.org>
From: Michael Tuexen 
Date: Thu, 3 Feb 2011 20:44: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: r218241 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 20:44:49 -0000

Author: tuexen
Date: Thu Feb  3 20:44:49 2011
New Revision: 218241
URL: http://svn.freebsd.org/changeset/base/218241

Log:
  Fix several bugs in the stream schedulers.
  From Robin Seggelmann.
  
  MFC after: 3 months.

Modified:
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_ss_functions.c
  head/sys/netinet/sctp_structs.h
  head/sys/netinet/sctp_timer.c
  head/sys/netinet/sctp_usrreq.c
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Thu Feb  3 20:30:17 2011	(r218240)
+++ head/sys/netinet/sctp_output.c	Thu Feb  3 20:44:49 2011	(r218241)
@@ -12342,7 +12342,7 @@ sctp_lower_sosend(struct socket *so,
 							TAILQ_INIT(&asoc->strmout[i].outqueue);
 							asoc->strmout[i].stream_no = i;
 							asoc->strmout[i].last_msg_incomplete = 0;
-							asoc->ss_functions.sctp_ss_init_stream(&asoc->strmout[i]);
+							asoc->ss_functions.sctp_ss_init_stream(&asoc->strmout[i], NULL);
 						}
 					}
 				}

Modified: head/sys/netinet/sctp_ss_functions.c
==============================================================================
--- head/sys/netinet/sctp_ss_functions.c	Thu Feb  3 20:30:17 2011	(r218240)
+++ head/sys/netinet/sctp_ss_functions.c	Thu Feb  3 20:44:49 2011	(r218241)
@@ -1,6 +1,7 @@
 /*-
- * Copyright (c) 2010, by Randall Stewart & Michael Tuexen,
- * All rights reserved.
+ * Copyright (c) 2010-2011, by Randall Stewart, rrs@lakerest.net and
+ *                          Michael Tuexen, tuexen@fh-muenster.de
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -56,6 +57,11 @@ sctp_ss_default_init(struct sctp_tcb *st
 	uint16_t i;
 
 	TAILQ_INIT(&asoc->ss_data.out_wheel);
+	/*
+	 * If there is data in the stream queues already, the scheduler of
+	 * an existing association has been changed. We need to add all
+	 * stream queues to the wheel.
+	 */
 	for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
 		if (!TAILQ_EMPTY(&stcb->asoc.strmout[i].outqueue)) {
 			sctp_ss_default_add(stcb, &stcb->asoc,
@@ -83,7 +89,7 @@ sctp_ss_default_clear(struct sctp_tcb *s
 }
 
 static void
-sctp_ss_default_init_stream(struct sctp_stream_out *strq)
+sctp_ss_default_init_stream(struct sctp_stream_out *strq, struct sctp_stream_out *with_strq)
 {
 	strq->ss_params.rr.next_spoke.tqe_next = NULL;
 	strq->ss_params.rr.next_spoke.tqe_prev = NULL;
@@ -411,11 +417,15 @@ sctp_ss_prio_clear(struct sctp_tcb *stcb
 }
 
 static void
-sctp_ss_prio_init_stream(struct sctp_stream_out *strq)
+sctp_ss_prio_init_stream(struct sctp_stream_out *strq, struct sctp_stream_out *with_strq)
 {
 	strq->ss_params.prio.next_spoke.tqe_next = NULL;
 	strq->ss_params.prio.next_spoke.tqe_prev = NULL;
-	strq->ss_params.prio.priority = 0;
+	if (with_strq != NULL) {
+		strq->ss_params.prio.priority = with_strq->ss_params.prio.priority;
+	} else {
+		strq->ss_params.prio.priority = 0;
+	}
 	return;
 }
 
@@ -575,11 +585,15 @@ sctp_ss_fb_clear(struct sctp_tcb *stcb, 
 }
 
 static void
-sctp_ss_fb_init_stream(struct sctp_stream_out *strq)
+sctp_ss_fb_init_stream(struct sctp_stream_out *strq, struct sctp_stream_out *with_strq)
 {
 	strq->ss_params.fb.next_spoke.tqe_next = NULL;
 	strq->ss_params.fb.next_spoke.tqe_prev = NULL;
-	strq->ss_params.fb.rounds = -1;
+	if (with_strq != NULL) {
+		strq->ss_params.fb.rounds = with_strq->ss_params.fb.rounds;
+	} else {
+		strq->ss_params.fb.rounds = -1;
+	}
 	return;
 }
 
@@ -697,28 +711,40 @@ sctp_ss_fb_scheduled(struct sctp_tcb *st
  * Maintains the order provided by the application.
  */
 static void
+sctp_ss_fcfs_add(struct sctp_tcb *stcb, struct sctp_association *asoc,
+    struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp,
+    int holds_lock);
+
+static void
 sctp_ss_fcfs_init(struct sctp_tcb *stcb, struct sctp_association *asoc,
     int holds_lock)
 {
-	int x, element = 0, add_more = 1;
+	uint32_t x, n = 0, add_more = 1;
 	struct sctp_stream_queue_pending *sp;
 	uint16_t i;
 
 	TAILQ_INIT(&asoc->ss_data.out_list);
+	/*
+	 * If there is data in the stream queues already, the scheduler of
+	 * an existing association has been changed. We can only cycle
+	 * through the stream queues and add everything to the FCFS queue.
+	 */
 	while (add_more) {
 		add_more = 0;
 		for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
-			sp = TAILQ_FIRST(&asoc->ss_data.out_list);
-			x = element;
-			while (sp != NULL && x > 0) {
+			sp = TAILQ_FIRST(&stcb->asoc.strmout[i].outqueue);
+			x = 0;
+			/* Find n. message in current stream queue */
+			while (sp != NULL && x < n) {
 				sp = TAILQ_NEXT(sp, next);
+				x++;
 			}
 			if (sp != NULL) {
-				sctp_ss_default_add(stcb, &stcb->asoc, &stcb->asoc.strmout[i], NULL, holds_lock);
+				sctp_ss_fcfs_add(stcb, &stcb->asoc, &stcb->asoc.strmout[i], sp, holds_lock);
 				add_more = 1;
 			}
 		}
-		element++;
+		n++;
 	}
 	return;
 }
@@ -729,14 +755,14 @@ sctp_ss_fcfs_clear(struct sctp_tcb *stcb
 {
 	if (clear_values) {
 		while (!TAILQ_EMPTY(&asoc->ss_data.out_list)) {
-			TAILQ_REMOVE(&asoc->ss_data.out_list, TAILQ_FIRST(&asoc->ss_data.out_list), next);
+			TAILQ_REMOVE(&asoc->ss_data.out_list, TAILQ_FIRST(&asoc->ss_data.out_list), ss_next);
 		}
 	}
 	return;
 }
 
 static void
-sctp_ss_fcfs_init_stream(struct sctp_stream_out *strq)
+sctp_ss_fcfs_init_stream(struct sctp_stream_out *strq, struct sctp_stream_out *with_strq)
 {
 	/* Nothing to be done here */
 	return;
@@ -750,9 +776,9 @@ sctp_ss_fcfs_add(struct sctp_tcb *stcb, 
 	if (holds_lock == 0) {
 		SCTP_TCB_SEND_LOCK(stcb);
 	}
-	if (sp && (sp->next.tqe_next == NULL) &&
-	    (sp->next.tqe_prev == NULL)) {
-		TAILQ_INSERT_TAIL(&asoc->ss_data.out_list, sp, next);
+	if (sp && (sp->ss_next.tqe_next == NULL) &&
+	    (sp->ss_next.tqe_prev == NULL)) {
+		TAILQ_INSERT_TAIL(&asoc->ss_data.out_list, sp, ss_next);
 	}
 	if (holds_lock == 0) {
 		SCTP_TCB_SEND_UNLOCK(stcb);
@@ -779,9 +805,9 @@ sctp_ss_fcfs_remove(struct sctp_tcb *stc
 		SCTP_TCB_SEND_LOCK(stcb);
 	}
 	if (sp &&
-	    ((sp->next.tqe_next != NULL) ||
-	    (sp->next.tqe_prev != NULL))) {
-		TAILQ_REMOVE(&asoc->ss_data.out_list, sp, next);
+	    ((sp->ss_next.tqe_next != NULL) ||
+	    (sp->ss_next.tqe_prev != NULL))) {
+		TAILQ_REMOVE(&asoc->ss_data.out_list, sp, ss_next);
 	}
 	if (holds_lock == 0) {
 		SCTP_TCB_SEND_UNLOCK(stcb);
@@ -819,7 +845,7 @@ default_again:
 		if (TAILQ_FIRST(&strq->outqueue) &&
 		    TAILQ_FIRST(&strq->outqueue)->net != NULL &&
 		    TAILQ_FIRST(&strq->outqueue)->net != net) {
-			sp = TAILQ_NEXT(sp, next);
+			sp = TAILQ_NEXT(sp, ss_next);
 			goto default_again;
 		}
 	}

Modified: head/sys/netinet/sctp_structs.h
==============================================================================
--- head/sys/netinet/sctp_structs.h	Thu Feb  3 20:30:17 2011	(r218240)
+++ head/sys/netinet/sctp_structs.h	Thu Feb  3 20:44:49 2011	(r218241)
@@ -1,5 +1,8 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
+ *                          Michael Tuexen, tuexen@fh-muenster.de
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -475,6 +478,7 @@ struct sctp_stream_queue_pending {
 	struct timeval ts;
 	struct sctp_nets *net;
 	          TAILQ_ENTRY(sctp_stream_queue_pending) next;
+	          TAILQ_ENTRY(sctp_stream_queue_pending) ss_next;
 	uint32_t length;
 	uint32_t timetolive;
 	uint32_t ppid;
@@ -652,7 +656,7 @@ struct sctp_ss_functions {
 	         int holds_lock);
 	void (*sctp_ss_clear) (struct sctp_tcb *stcb, struct sctp_association *asoc,
 	         int clear_values, int holds_lock);
-	void (*sctp_ss_init_stream) (struct sctp_stream_out *strq);
+	void (*sctp_ss_init_stream) (struct sctp_stream_out *strq, struct sctp_stream_out *with_strq);
 	void (*sctp_ss_add_to_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc,
 	         struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp, int holds_lock);
 	int (*sctp_ss_is_empty) (struct sctp_tcb *stcb, struct sctp_association *asoc);
@@ -751,12 +755,7 @@ struct sctp_association {
 	/* re-assembly queue for fragmented chunks on the inbound path */
 	struct sctpchunk_listhead reasmqueue;
 
-	/*
-	 * this queue is used when we reach a condition that we can NOT put
-	 * data into the socket buffer. We track the size of this queue and
-	 * set our rwnd to the space in the socket minus also the
-	 * size_on_delivery_queue.
-	 */
+	/* Scheduling queues */
 	union scheduling_data ss_data;
 
 	/*

Modified: head/sys/netinet/sctp_timer.c
==============================================================================
--- head/sys/netinet/sctp_timer.c	Thu Feb  3 20:30:17 2011	(r218240)
+++ head/sys/netinet/sctp_timer.c	Thu Feb  3 20:44:49 2011	(r218241)
@@ -1,5 +1,8 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
+ *                          Michael Tuexen, tuexen@fh-muenster.de
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -1510,32 +1513,17 @@ sctp_audit_stream_queues_for_size(struct
 		    stcb->asoc.sent_queue_retran_cnt);
 		stcb->asoc.sent_queue_retran_cnt = 0;
 	}
-	SCTP_TCB_SEND_LOCK(stcb);
 	if (stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, &stcb->asoc)) {
-		int cnt = 0;
-
-		/* Check to see if a spoke fell off the wheel */
-		for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
-			if (!TAILQ_EMPTY(&stcb->asoc.strmout[i].outqueue)) {
-				stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb,
-				    &stcb->asoc,
-				    &stcb->asoc.strmout[i],
-				    NULL,
-				    1);
-				cnt++;
-			}
-		}
-		if (cnt) {
-			/* yep, we lost a spoke or two */
-			SCTP_PRINTF("Found an additional %d streams NOT on outwheel, corrected\n", cnt);
+		/* No stream scheduler information, initialize scheduler */
+		stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 0);
+		if (!stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, &stcb->asoc)) {
+			/* yep, we lost a stream or two */
+			SCTP_PRINTF("Found additional streams NOT managed by scheduler, corrected\n");
 		} else {
-			/* no spokes lost, */
+			/* no streams lost */
 			stcb->asoc.total_output_queue_size = 0;
 		}
-		SCTP_TCB_SEND_UNLOCK(stcb);
-		return;
 	}
-	SCTP_TCB_SEND_UNLOCK(stcb);
 	/* Check to see if some data queued, if so report it */
 	for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
 		if (!TAILQ_EMPTY(&stcb->asoc.strmout[i].outqueue)) {

Modified: head/sys/netinet/sctp_usrreq.c
==============================================================================
--- head/sys/netinet/sctp_usrreq.c	Thu Feb  3 20:30:17 2011	(r218240)
+++ head/sys/netinet/sctp_usrreq.c	Thu Feb  3 20:44:49 2011	(r218241)
@@ -3448,7 +3448,7 @@ sctp_setopt(struct socket *so, int optna
 						stcb->asoc.strmout[i].next_sequence_sent = oldstream[i].next_sequence_sent;
 						stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete;
 						stcb->asoc.strmout[i].stream_no = i;
-						stcb->asoc.ss_functions.sctp_ss_init_stream(&oldstream[i]);
+						stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i], &oldstream[i]);
 						/*
 						 * now anything on those
 						 * queues?
@@ -3475,7 +3475,7 @@ sctp_setopt(struct socket *so, int optna
 						TAILQ_INIT(&stcb->asoc.strmout[i].outqueue);
 						stcb->asoc.strmout[i].stream_no = i;
 						stcb->asoc.strmout[i].last_msg_incomplete = 0;
-						stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i]);
+						stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i], NULL);
 					}
 					stcb->asoc.strm_realoutsize = stcb->asoc.streamoutcnt + addstrmcnt;
 					SCTP_FREE(oldstream, SCTP_M_STRMO);

Modified: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c	Thu Feb  3 20:30:17 2011	(r218240)
+++ head/sys/netinet/sctputil.c	Thu Feb  3 20:44:49 2011	(r218241)
@@ -1076,7 +1076,7 @@ sctp_init_asoc(struct sctp_inpcb *m, str
 		TAILQ_INIT(&asoc->strmout[i].outqueue);
 		asoc->strmout[i].stream_no = i;
 		asoc->strmout[i].last_msg_incomplete = 0;
-		asoc->ss_functions.sctp_ss_init_stream(&asoc->strmout[i]);
+		asoc->ss_functions.sctp_ss_init_stream(&asoc->strmout[i], NULL);
 	}
 	asoc->ss_functions.sctp_ss_init(stcb, asoc, 0);
 

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 20:59:26 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 89E731065675;
	Thu,  3 Feb 2011 20:59:26 +0000 (UTC)
	(envelope-from juli@clockworksquid.com)
Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com
	[209.85.213.182])
	by mx1.freebsd.org (Postfix) with ESMTP id 1A6288FC13;
	Thu,  3 Feb 2011 20:59:25 +0000 (UTC)
Received: by yxh35 with SMTP id 35so686963yxh.13
	for ; Thu, 03 Feb 2011 12:59:25 -0800 (PST)
Received: by 10.151.108.9 with SMTP id k9mr13788084ybm.83.1296766764990; Thu,
	03 Feb 2011 12:59:24 -0800 (PST)
MIME-Version: 1.0
Sender: juli@clockworksquid.com
Received: by 10.150.196.12 with HTTP; Thu, 3 Feb 2011 12:38:24 -0800 (PST)
In-Reply-To: <201102031529.25072.jhb@freebsd.org>
References: <201102031922.p13JML8i055697@svn.freebsd.org>
	<201102031529.25072.jhb@freebsd.org>
From: Juli Mallett 
Date: Thu, 3 Feb 2011 12:38:24 -0800
X-Google-Sender-Auth: i2YXzA7I0QwpeblUfzPbDSHrA2k
Message-ID: 
To: John Baldwin 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, Randall Stewart ,
	svn-src-all@freebsd.org, src-committers@freebsd.org
Subject: Re: svn commit: r218232 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 20:59:26 -0000

On Thu, Feb 3, 2011 at 12:29, John Baldwin  wrote:
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 ip =3D mtod(m, struct ip *);
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 offset =3D off + sizeof(*sh);
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (SCTP_BUF_LEN(m) < offset) {
>> @@ -5944,7 +5947,7 @@ sctp_input(struct mbuf *m, int off)
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ip =3D mtod(m, struct ip *);
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 sh =3D (struct sctphdr *)((caddr_t)ip + off)=
;
>> - =A0 =A0 =A0 =A0 =A0 =A0 cpu_to_use =3D ntohl(sh->v_tag) % mp_ncpus;
>> + =A0 =A0 =A0 =A0 =A0 =A0 cpu_to_use =3D ntohl(sh->v_tag) % mp_maxid;
>
> Hmmm, this is more complicated. =A0 Can sctp_queue_to_mcore() handle the =
fact
> that a cpu_to_use value might not be valid? =A0If not you might want to m=
aintain
> a separate "dense" virtual CPU ID table numbered 0 .. mp_ncpus - 1 that m=
aps
> to "present" FreeBSD CPU IDs. =A0I think Robert has done something simila=
r to
> support RSS in TCP. =A0Does that make sense?

Plus mp_maxid is inclusive, so rrs probably meant (mp_maxid + 1) not
mp_maxid in that modulus.

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 23:07:22 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 495ED1065672;
	Thu,  3 Feb 2011 23:07:22 +0000 (UTC)
	(envelope-from brucec@muon.cran.org.uk)
Received: from muon.cran.org.uk (muon.cran.org.uk
	[IPv6:2a01:348:0:15:5d59:5c40:0:1])
	by mx1.freebsd.org (Postfix) with ESMTP id 109EA8FC0A;
	Thu,  3 Feb 2011 23:07:22 +0000 (UTC)
Received: by muon.cran.org.uk (Postfix, from userid 1001)
	id 60C93E7551; Thu,  3 Feb 2011 23:07:21 +0000 (GMT)
Date: Thu, 3 Feb 2011 23:07:21 +0000
From: Bruce Cran 
To: Adrian Chadd 
Message-ID: <20110203230721.GA47981@muon.cran.org.uk>
References: <201102032026.p13KQQX2057419@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201102032026.p13KQQX2057419@svn.freebsd.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218238 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 23:07:22 -0000

On Thu, Feb 03, 2011 at 08:26:26PM +0000, Adrian Chadd wrote:
>  		if (ni != NULL) {
> +#if NOTYET
>  		/* tag AMPDU aggregates for reorder processing */

This seems to have broken the build because NOTYET isn't defined.

-- 
Bruce Cran

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  3 23:38:11 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6CF06106566B;
	Thu,  3 Feb 2011 23:38:11 +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 5BC2C8FC0A;
	Thu,  3 Feb 2011 23:38:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13NcBFP062223;
	Thu, 3 Feb 2011 23:38:11 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13NcBSh062221;
	Thu, 3 Feb 2011 23:38:11 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201102032338.p13NcBSh062221@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Thu, 3 Feb 2011 23:38:11 +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: r218242 - head/bin/sh
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Feb 2011 23:38:11 -0000

Author: jilles
Date: Thu Feb  3 23:38:11 2011
New Revision: 218242
URL: http://svn.freebsd.org/changeset/base/218242

Log:
  sh: Return only 126 or 127 for execve() failures.
  
  Do not return 2 for errors other than [EACCES] or [ENOENT].

Modified:
  head/bin/sh/exec.c

Modified: head/bin/sh/exec.c
==============================================================================
--- head/bin/sh/exec.c	Thu Feb  3 20:44:49 2011	(r218241)
+++ head/bin/sh/exec.c	Thu Feb  3 23:38:11 2011	(r218242)
@@ -129,20 +129,13 @@ shellexec(char **argv, char **envp, cons
 	}
 
 	/* Map to POSIX errors */
-	switch (e) {
-	case EACCES:
-		exerrno = 126;
-		break;
-	case ENOENT:
+	if (e == ENOENT || e == ENOTDIR) {
 		exerrno = 127;
-		break;
-	default:
-		exerrno = 2;
-		break;
-	}
-	if (e == ENOENT || e == ENOTDIR)
 		exerror(EXEXEC, "%s: not found", argv[0]);
-	exerror(EXEXEC, "%s: %s", argv[0], strerror(e));
+	} else {
+		exerrno = 126;
+		exerror(EXEXEC, "%s: %s", argv[0], strerror(e));
+	}
 }
 
 

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 00:25:19 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 26786106566B;
	Fri,  4 Feb 2011 00:25:19 +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 14BFE8FC17;
	Fri,  4 Feb 2011 00:25:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p140PIKM063293;
	Fri, 4 Feb 2011 00:25:18 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p140PIqC063291;
	Fri, 4 Feb 2011 00:25:18 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201102040025.p140PIqC063291@svn.freebsd.org>
From: Adrian Chadd 
Date: Fri, 4 Feb 2011 00:25: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: r218243 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 00:25:19 -0000

Author: adrian
Date: Fri Feb  4 00:25:18 2011
New Revision: 218243
URL: http://svn.freebsd.org/changeset/base/218243

Log:
  Oops, fix newbie mistake that breaks the normal build.

Modified:
  head/sys/dev/ath/if_ath.c

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Thu Feb  3 23:38:11 2011	(r218242)
+++ head/sys/dev/ath/if_ath.c	Fri Feb  4 00:25:18 2011	(r218243)
@@ -3892,7 +3892,7 @@ rx_accept:
 				IEEE80211_KEYIX_NONE : rs->rs_keyix);
 		sc->sc_lastrs = rs;
 		if (ni != NULL) {
-#if NOTYET
+#ifdef	NOTYET
 		/* tag AMPDU aggregates for reorder processing */
 		/*
 		 * XXX this should only tag frames marked as aggregate; rather

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 01:09:03 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 029DB106566B;
	Fri,  4 Feb 2011 01:09:03 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E47508FC0C;
	Fri,  4 Feb 2011 01:09:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14192Tw064479;
	Fri, 4 Feb 2011 01:09:02 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14192mJ064477;
	Fri, 4 Feb 2011 01:09:02 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <201102040109.p14192mJ064477@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Fri, 4 Feb 2011 01:09:02 +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: r218246 - head/sys/boot/fdt/dts
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 01:09:03 -0000

Author: marcel
Date: Fri Feb  4 01:09:02 2011
New Revision: 218246
URL: http://svn.freebsd.org/changeset/base/218246

Log:
  Add PEX0 and select the first serial port as console.

Modified:
  head/sys/boot/fdt/dts/db78100.dts

Modified: head/sys/boot/fdt/dts/db78100.dts
==============================================================================
--- head/sys/boot/fdt/dts/db78100.dts	Fri Feb  4 00:57:04 2011	(r218245)
+++ head/sys/boot/fdt/dts/db78100.dts	Fri Feb  4 01:09:02 2011	(r218246)
@@ -308,8 +308,36 @@
 		};
 	};
 
+	pci0: pcie@f1040000 {
+		compatible = "mrvl,pcie";
+		device_type = "pci";
+		#interrupt-cells = <1>;
+		#size-cells = <2>;
+		#address-cells = <3>;
+		reg = <0xf1040000 0x2000>;
+		bus-range = <0 255>;
+		ranges = <0x02000000 0x0 0xf2000000 0xf2000000 0x0 0x04000000
+			  0x01000000 0x0 0x00000000 0xf1100000 0x0 0x00100000>;
+		clock-frequency = <33333333>;
+		interrupt-parent = <&PIC>;
+		interrupts = <68>;
+		interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
+		interrupt-map = <
+			/* IDSEL 0x1 */
+			0x0800 0x0 0x0 0x1 &PIC 0x20
+			0x0800 0x0 0x0 0x2 &PIC 0x21
+			0x0800 0x0 0x0 0x3 &PIC 0x22
+			0x0800 0x0 0x0 0x4 &PIC 0x23
+			>;
+	};
+
 	sram@fd000000 {
 		compatible = "mrvl,cesa-sram";
 		reg = <0xfd000000 0x00100000>;
 	};
+
+	chosen {
+		stdin = "serial0";
+		stdout = "serial0";
+	};
 };

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 02:28:28 2011
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F24A5106566B;
	Fri,  4 Feb 2011 02:28:27 +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 872C08FC14;
	Fri,  4 Feb 2011 02:28:27 +0000 (UTC)
Received: from c122-106-165-206.carlnfd1.nsw.optusnet.com.au
	(c122-106-165-206.carlnfd1.nsw.optusnet.com.au [122.106.165.206])
	by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	p142SMng030705
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 4 Feb 2011 13:28:25 +1100
Date: Fri, 4 Feb 2011 13:28:22 +1100 (EST)
From: Bruce Evans 
X-X-Sender: bde@besplex.bde.org
To: mdf@FreeBSD.org
In-Reply-To: 
Message-ID: <20110204125820.Q935@besplex.bde.org>
References: <201102021635.p12GZA94015170@svn.freebsd.org>
	
	<201102030750.07076.jhb@freebsd.org>
	
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: Juli Mallett , svn-src-head@FreeBSD.org,
	svn-src-all@FreeBSD.org, src-committers@FreeBSD.org,
	John Baldwin 
Subject: Re: svn commit: r218195 - in head/sys: amd64/amd64 arm/arm i386/i386
 ia64/ia64 kern mips/mips powerpc/powerpc sparc64/sparc64 sun4v/sun4v sys
 ufs/ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 02:28:28 -0000

On Thu, 3 Feb 2011 mdf@FreeBSD.org wrote:

> Bruce correctly points out that the code doesn't work like I expect
> with PREEMPTION, which most people will be running.

Not just PREEMPTION, but with almost any non-fast^Wfiltered interrupt
activity.

> I'm thinking of adding a new per-thread field to record the last ticks
> value that a voluntary mi_switch() was done, so that there's a
> standard way of checking if a thread is being a hog; this will work
> for both PREEMPTION and !PREEMPTION, and would be appropriate for the
> places that previously used a counter.  (This would require
> uio_yield() to be SW_VOL, but I can't see why it's not a voluntary
> context switch anyways).

I don't like using a ticks value for this at all.  It gives complexities
and doing the scheduler's work for it.  If you don't count involuntary
context switches, then the ticks spent by involuntarily-switch-to threads
will be counted against the hog thread.  And switches back from these
threads are probably voluntary (this is the case for ithreads), so you
would need complexities to not reset the last ticks values for some
voluntary context switches too.  A perfectly fair way to keep track of
hoggishness might be to monitor the thread's runtime and yield if this
is too large a percentage of the real time, but this might be complex
and is doing the scheduler's work for it (better than the scheduler does
-- schedulers still use ticks, but the runtime is much more accurate).
OTOH, yielding on every tick might work well.  This is equivalent to
reducing hogticks to 1 and doesn't need an externally maintained last-
tick value.  Just do an atomic cmpset of `ticks' with a previous value
and yield if it changed.  This could probably be used for increments of
larger than 1 too.  But I now remember that the hogticks checks are
intentionally not done like this, so that they can be as small and
efficient as possible and not need local state or a function call.
I must have expected them to be used more.  The reason to consider
yielding on every tick is that 2 quanta (200 mS) isn't as long as it
was when it was first used for hogticks.  Back then, memory speeds were
maybe 50 MB/S at best and you could reach hogticks limit simply by
reading a few MB from /dev/zero.

> I'm happy to rename the functions (perhaps just yield_foo() rather
> than foo_yield()?) and stop using uio_yield as the base name since
> it's not a uio function.  I wanted to keep the uio_yield symbol to
> preserve the KBI/KPI.

Errors should not be preserved.

Bruce

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 02:38:18 2011
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 33578106564A;
	Fri,  4 Feb 2011 02:38:18 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au
	[211.29.132.186])
	by mx1.freebsd.org (Postfix) with ESMTP id A757D8FC08;
	Fri,  4 Feb 2011 02:38:17 +0000 (UTC)
Received: from c122-106-165-206.carlnfd1.nsw.optusnet.com.au
	(c122-106-165-206.carlnfd1.nsw.optusnet.com.au [122.106.165.206])
	by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	p142c9us009942
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 4 Feb 2011 13:38:10 +1100
Date: Fri, 4 Feb 2011 13:38:09 +1100 (EST)
From: Bruce Evans 
X-X-Sender: bde@besplex.bde.org
To: Bruce Cran 
In-Reply-To: <20110203230721.GA47981@muon.cran.org.uk>
Message-ID: <20110204133640.X1052@besplex.bde.org>
References: <201102032026.p13KQQX2057419@svn.freebsd.org>
	<20110203230721.GA47981@muon.cran.org.uk>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@FreeBSD.org, Adrian Chadd ,
	src-committers@FreeBSD.org, svn-src-all@FreeBSD.org
Subject: Re: svn commit: r218238 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 02:38:18 -0000

On Thu, 3 Feb 2011, Bruce Cran wrote:

> On Thu, Feb 03, 2011 at 08:26:26PM +0000, Adrian Chadd wrote:
>>  		if (ni != NULL) {
>> +#if NOTYET
>>  		/* tag AMPDU aggregates for reorder processing */
>
> This seems to have broken the build because NOTYET isn't defined.

It is a style bug ("#ifdefnotyet" is normal), but it only breaks
the build because kernel builds don't use a C compiler (they use -Wundef
to break the compiler).

Bruce

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 06:40:47 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E21B5106564A;
	Fri,  4 Feb 2011 06:40:47 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 947B78FC12;
	Fri,  4 Feb 2011 06:40:47 +0000 (UTC)
Received: from fledge.watson.org (fledge.watson.org [65.122.17.41])
	by cyrus.watson.org (Postfix) with ESMTPS id 1E59746B23;
	Fri,  4 Feb 2011 01:40:47 -0500 (EST)
Date: Fri, 4 Feb 2011 06:40:46 +0000 (GMT)
From: Robert Watson 
X-X-Sender: robert@fledge.watson.org
To: Randall Stewart 
In-Reply-To: <201102031005.p13A5Vwi040803@svn.freebsd.org>
Message-ID: 
References: <201102031005.p13A5Vwi040803@svn.freebsd.org>
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218211 - in head/sys: conf netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 06:40:48 -0000


On Thu, 3 Feb 2011, Randall Stewart wrote:

> Author: rrs
> Date: Thu Feb  3 10:05:30 2011
> New Revision: 218211
> URL: http://svn.freebsd.org/changeset/base/218211
>
> Log:
>  Adds an experimental option to create a pool of
>  threads. These serve as input threads and are queued
>  packets based on the V-tag number. This is similar to
>  what a modern card can do with queue's for TCP... but
>  alas modern cards know nothing about SCTP.

Hmm.  It might be better to add a new NETISR_SCTP and use netisr's support for 
multithreading?

(I'm preparing a patch for review that enhances that a bit so that protocols 
can be a bit more expressive in terms of specifying dispatch policy, etc, 
currently).

Robert


>
>  MFC after:	3 months (maybe)
>
> Modified:
>  head/sys/conf/options
>  head/sys/netinet/sctp_bsd_addr.c
>  head/sys/netinet/sctp_constants.h
>  head/sys/netinet/sctp_input.c
>  head/sys/netinet/sctp_lock_bsd.h
>  head/sys/netinet/sctp_os_bsd.h
>  head/sys/netinet/sctp_pcb.c
>  head/sys/netinet/sctp_pcb.h
>  head/sys/netinet/sctp_structs.h
>
> Modified: head/sys/conf/options
> ==============================================================================
> --- head/sys/conf/options	Thu Feb  3 08:55:45 2011	(r218210)
> +++ head/sys/conf/options	Thu Feb  3 10:05:30 2011	(r218211)
> @@ -439,6 +439,7 @@ SCTP_PACKET_LOGGING	opt_sctp.h # Log to
> SCTP_LTRACE_CHUNKS	opt_sctp.h # Log to KTR chunks processed
> SCTP_LTRACE_ERRORS	opt_sctp.h # Log to KTR error returns.
> SCTP_USE_PERCPU_STAT    opt_sctp.h # Use per cpu stats.
> +SCTP_MCORE_INPUT        opt_sctp.h # Have multiple input threads for input mbufs
> #
> #
> #
>
> Modified: head/sys/netinet/sctp_bsd_addr.c
> ==============================================================================
> --- head/sys/netinet/sctp_bsd_addr.c	Thu Feb  3 08:55:45 2011	(r218210)
> +++ head/sys/netinet/sctp_bsd_addr.c	Thu Feb  3 10:05:30 2011	(r218211)
> @@ -68,6 +68,7 @@ MALLOC_DEFINE(SCTP_M_TIMW, "sctp_timw",
> MALLOC_DEFINE(SCTP_M_MVRF, "sctp_mvrf", "sctp mvrf pcb list");
> MALLOC_DEFINE(SCTP_M_ITER, "sctp_iter", "sctp iterator control");
> MALLOC_DEFINE(SCTP_M_SOCKOPT, "sctp_socko", "sctp socket option");
> +MALLOC_DEFINE(SCTP_M_MCORE, "sctp_mcore", "sctp mcore queue");
>
> /* Global NON-VNET structure that controls the iterator */
> struct iterator_control sctp_it_ctl;
>
> Modified: head/sys/netinet/sctp_constants.h
> ==============================================================================
> --- head/sys/netinet/sctp_constants.h	Thu Feb  3 08:55:45 2011	(r218210)
> +++ head/sys/netinet/sctp_constants.h	Thu Feb  3 10:05:30 2011	(r218211)
> @@ -91,6 +91,8 @@ __FBSDID("$FreeBSD$");
> #define SCTP_KTRHEAD_NAME "sctp_iterator"
> #define SCTP_KTHREAD_PAGES 0
>
> +#define SCTP_MCORE_NAME "sctp_core_worker"
> +
>
> /* If you support Multi-VRF how big to
>  * make the initial array of VRF's to.
>
> Modified: head/sys/netinet/sctp_input.c
> ==============================================================================
> --- head/sys/netinet/sctp_input.c	Thu Feb  3 08:55:45 2011	(r218210)
> +++ head/sys/netinet/sctp_input.c	Thu Feb  3 10:05:30 2011	(r218211)
> @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
> #include 
> #include 
> #include 
> +#include 
>
>
>
> @@ -5921,10 +5922,32 @@ bad:
> 	}
> 	return;
> }
> +
> +
> void
> -sctp_input(i_pak, off)
> -	struct mbuf *i_pak;
> -	int off;
> +sctp_input(struct mbuf *m, int off)
> {
> -	sctp_input_with_port(i_pak, off, 0);
> +#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP)
> +	struct ip *ip;
> +	struct sctphdr *sh;
> +	int offset;
> +	int cpu_to_use;
> +
> +	if (mp_ncpus > 1) {
> +		ip = mtod(m, struct ip *);
> +		offset = off + sizeof(*sh);
> +		if (SCTP_BUF_LEN(m) < offset) {
> +			if ((m = m_pullup(m, offset)) == 0) {
> +				SCTP_STAT_INCR(sctps_hdrops);
> +				return;
> +			}
> +			ip = mtod(m, struct ip *);
> +		}
> +		sh = (struct sctphdr *)((caddr_t)ip + off);
> +		cpu_to_use = ntohl(sh->v_tag) % mp_ncpus;
> +		sctp_queue_to_mcore(m, off, cpu_to_use);
> +		return;
> +	}
> +#endif
> +	sctp_input_with_port(m, off, 0);
> }
>
> Modified: head/sys/netinet/sctp_lock_bsd.h
> ==============================================================================
> --- head/sys/netinet/sctp_lock_bsd.h	Thu Feb  3 08:55:45 2011	(r218210)
> +++ head/sys/netinet/sctp_lock_bsd.h	Thu Feb  3 10:05:30 2011	(r218211)
> @@ -97,6 +97,48 @@ extern int sctp_logoff_stuff;
>              rw_rlock(&SCTP_BASE_INFO(ipi_ep_mtx));                         \
> } while (0)
>
> +#define SCTP_MCORE_QLOCK_INIT(cpstr) do { \
> +		mtx_init(&(cpstr)->que_mtx,	      \
> +			 "sctp-mcore_queue","queue_lock",	\
> +			 MTX_DEF|MTX_DUPOK);		\
> +} while (0)
> +
> +#define SCTP_MCORE_QLOCK(cpstr)  do { \
> +		mtx_lock(&(cpstr)->que_mtx);	\
> +} while (0)
> +
> +#define SCTP_MCORE_QUNLOCK(cpstr)  do { \
> +		mtx_unlock(&(cpstr)->que_mtx);	\
> +} while (0)
> +
> +#define SCTP_MCORE_QDESTROY(cpstr)  do { \
> +	if(mtx_owned(&(cpstr)->core_mtx)) {	\
> +		mtx_unlock(&(cpstr)->que_mtx);	\
> +        } \
> +	mtx_destroy(&(cpstr)->que_mtx);	\
> +} while (0)
> +
> +
> +#define SCTP_MCORE_LOCK_INIT(cpstr) do { \
> +		mtx_init(&(cpstr)->core_mtx,	      \
> +			 "sctp-cpulck","cpu_proc_lock",	\
> +			 MTX_DEF|MTX_DUPOK);		\
> +} while (0)
> +
> +#define SCTP_MCORE_LOCK(cpstr)  do { \
> +		mtx_lock(&(cpstr)->core_mtx);	\
> +} while (0)
> +
> +#define SCTP_MCORE_UNLOCK(cpstr)  do { \
> +		mtx_unlock(&(cpstr)->core_mtx);	\
> +} while (0)
> +
> +#define SCTP_MCORE_DESTROY(cpstr)  do { \
> +	if(mtx_owned(&(cpstr)->core_mtx)) {	\
> +		mtx_unlock(&(cpstr)->core_mtx);	\
> +        } \
> +	mtx_destroy(&(cpstr)->core_mtx);	\
> +} while (0)
>
> #define SCTP_INP_INFO_WLOCK()	do { 					\
>             rw_wlock(&SCTP_BASE_INFO(ipi_ep_mtx));                         \
>
> Modified: head/sys/netinet/sctp_os_bsd.h
> ==============================================================================
> --- head/sys/netinet/sctp_os_bsd.h	Thu Feb  3 08:55:45 2011	(r218210)
> +++ head/sys/netinet/sctp_os_bsd.h	Thu Feb  3 10:05:30 2011	(r218211)
> @@ -123,6 +123,7 @@ MALLOC_DECLARE(SCTP_M_TIMW);
> MALLOC_DECLARE(SCTP_M_MVRF);
> MALLOC_DECLARE(SCTP_M_ITER);
> MALLOC_DECLARE(SCTP_M_SOCKOPT);
> +MALLOC_DECLARE(SCTP_M_MCORE);
>
> #if defined(SCTP_LOCAL_TRACE_BUF)
>
>
> Modified: head/sys/netinet/sctp_pcb.c
> ==============================================================================
> --- head/sys/netinet/sctp_pcb.c	Thu Feb  3 08:55:45 2011	(r218210)
> +++ head/sys/netinet/sctp_pcb.c	Thu Feb  3 10:05:30 2011	(r218211)
> @@ -47,6 +47,9 @@ __FBSDID("$FreeBSD$");
> #include 
> #include 
> #include 
> +#include 
> +#include 
> +#include 
>
>
> VNET_DEFINE(struct sctp_base_info, system_base_info);
> @@ -5435,6 +5438,148 @@ sctp_del_local_addr_restricted(struct sc
> static int sctp_max_number_of_assoc = SCTP_MAX_NUM_OF_ASOC;
> static int sctp_scale_up_for_address = SCTP_SCALE_FOR_ADDR;
>
> +
> +
> +#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP)
> +struct sctp_mcore_ctrl *sctp_mcore_workers = NULL;
> +
> +void
> +sctp_queue_to_mcore(struct mbuf *m, int off, int cpu_to_use)
> +{
> +	/* Queue a packet to a processor for the specified core */
> +	struct sctp_mcore_queue *qent;
> +	struct sctp_mcore_ctrl *wkq;
> +	int need_wake = 0;
> +
> +	if (sctp_mcore_workers == NULL) {
> +		/* Something went way bad during setup */
> +		sctp_input_with_port(m, off, 0);
> +		return;
> +	}
> +	SCTP_MALLOC(qent, struct sctp_mcore_queue *,
> +	    (sizeof(struct sctp_mcore_queue)),
> +	    SCTP_M_MCORE);
> +	if (qent == NULL) {
> +		/* This is trouble  */
> +		sctp_input_with_port(m, off, 0);
> +		return;
> +	}
> +	qent->vn = curvnet;
> +	qent->m = m;
> +	qent->off = off;
> +	qent->v6 = 0;
> +	wkq = &sctp_mcore_workers[cpu_to_use];
> +	SCTP_MCORE_QLOCK(wkq);
> +
> +	TAILQ_INSERT_TAIL(&wkq->que, qent, next);
> +	if (wkq->running == 0) {
> +		need_wake = 1;
> +	}
> +	SCTP_MCORE_QUNLOCK(wkq);
> +	if (need_wake) {
> +		wakeup(&wkq->running);
> +	}
> +}
> +
> +static void
> +sctp_mcore_thread(void *arg)
> +{
> +
> +	struct sctp_mcore_ctrl *wkq;
> +	struct sctp_mcore_queue *qent;
> +
> +	wkq = (struct sctp_mcore_ctrl *)arg;
> +	struct mbuf *m;
> +	int off, v6;
> +
> +	/* Wait for first tickle */
> +	SCTP_MCORE_LOCK(wkq);
> +	wkq->running = 0;
> +	msleep(&wkq->running,
> +	    &wkq->core_mtx,
> +	    0, "wait for pkt", 0);
> +	SCTP_MCORE_UNLOCK(wkq);
> +
> +	/* Bind to our cpu */
> +	thread_lock(curthread);
> +	sched_bind(curthread, wkq->cpuid);
> +	thread_unlock(curthread);
> +
> +	/* Now lets start working */
> +	SCTP_MCORE_LOCK(wkq);
> +	/* Now grab lock and go */
> +	while (1) {
> +		SCTP_MCORE_QLOCK(wkq);
> +skip_sleep:
> +		wkq->running = 1;
> +		qent = TAILQ_FIRST(&wkq->que);
> +		if (qent) {
> +			TAILQ_REMOVE(&wkq->que, qent, next);
> +			SCTP_MCORE_QUNLOCK(wkq);
> +			CURVNET_SET(qent->vn);
> +			m = qent->m;
> +			off = qent->off;
> +			v6 = qent->v6;
> +			SCTP_FREE(qent, SCTP_M_MCORE);
> +			if (v6 == 0) {
> +				sctp_input_with_port(m, off, 0);
> +			} else {
> +				printf("V6 not yet supported\n");
> +				sctp_m_freem(m);
> +			}
> +			CURVNET_RESTORE();
> +			SCTP_MCORE_QLOCK(wkq);
> +		}
> +		wkq->running = 0;
> +		if (!TAILQ_EMPTY(&wkq->que)) {
> +			goto skip_sleep;
> +		}
> +		SCTP_MCORE_QUNLOCK(wkq);
> +		msleep(&wkq->running,
> +		    &wkq->core_mtx,
> +		    0, "wait for pkt", 0);
> +	};
> +}
> +
> +static void
> +sctp_startup_mcore_threads(void)
> +{
> +	int i;
> +
> +	if (mp_ncpus == 1)
> +		return;
> +
> +	SCTP_MALLOC(sctp_mcore_workers, struct sctp_mcore_ctrl *,
> +	    (mp_ncpus * sizeof(struct sctp_mcore_ctrl)),
> +	    SCTP_M_MCORE);
> +	if (sctp_mcore_workers == NULL) {
> +		/* TSNH I hope */
> +		return;
> +	}
> +	memset(sctp_mcore_workers, 0, (mp_ncpus *
> +	    sizeof(struct sctp_mcore_ctrl)));
> +	/* Init the structures */
> +	for (i = 0; i < mp_ncpus; i++) {
> +		TAILQ_INIT(&sctp_mcore_workers[i].que);
> +		SCTP_MCORE_LOCK_INIT(&sctp_mcore_workers[i]);
> +		SCTP_MCORE_QLOCK_INIT(&sctp_mcore_workers[i]);
> +		sctp_mcore_workers[i].cpuid = i;
> +	}
> +	/* Now start them all */
> +	for (i = 0; i < mp_ncpus; i++) {
> +		(void)kproc_create(sctp_mcore_thread,
> +		    (void *)&sctp_mcore_workers[i],
> +		    &sctp_mcore_workers[i].thread_proc,
> +		    RFPROC,
> +		    SCTP_KTHREAD_PAGES,
> +		    SCTP_MCORE_NAME);
> +
> +	}
> +}
> +
> +#endif
> +
> +
> void
> sctp_pcb_init()
> {
> @@ -5565,6 +5710,10 @@ sctp_pcb_init()
>
> 	sctp_startup_iterator();
>
> +#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP)
> +	sctp_startup_mcore_threads();
> +#endif
> +
> 	/*
> 	 * INIT the default VRF which for BSD is the only one, other O/S's
> 	 * may have more. But initially they must start with one and then
>
> Modified: head/sys/netinet/sctp_pcb.h
> ==============================================================================
> --- head/sys/netinet/sctp_pcb.h	Thu Feb  3 08:55:45 2011	(r218210)
> +++ head/sys/netinet/sctp_pcb.h	Thu Feb  3 10:05:30 2011	(r218211)
> @@ -624,6 +624,12 @@ sctp_initiate_iterator(inp_func inpf,
>     struct sctp_inpcb *,
>     uint8_t co_off);
>
> +#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP)
> +void
> +     sctp_queue_to_mcore(struct mbuf *m, int off, int cpu_to_use);
> +
> +#endif
> +
> #ifdef INVARIANTS
> void
>      sctp_validate_no_locks(struct sctp_inpcb *inp);
>
> Modified: head/sys/netinet/sctp_structs.h
> ==============================================================================
> --- head/sys/netinet/sctp_structs.h	Thu Feb  3 08:55:45 2011	(r218210)
> +++ head/sys/netinet/sctp_structs.h	Thu Feb  3 10:05:30 2011	(r218211)
> @@ -106,6 +106,31 @@ typedef void (*asoc_func) (struct sctp_i
> typedef int (*inp_func) (struct sctp_inpcb *, void *ptr, uint32_t val);
> typedef void (*end_func) (void *ptr, uint32_t val);
>
> +#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP)
> +/* whats on the mcore control struct */
> +struct sctp_mcore_queue {
> +	TAILQ_ENTRY(sctp_mcore_queue) next;
> +	struct vnet *vn;
> +	struct mbuf *m;
> +	int off;
> +	int v6;
> +};
> +
> +TAILQ_HEAD(sctp_mcore_qhead, sctp_mcore_queue);
> +
> +struct sctp_mcore_ctrl {
> +	SCTP_PROCESS_STRUCT thread_proc;
> +	struct sctp_mcore_qhead que;
> +	struct mtx core_mtx;
> +	struct mtx que_mtx;
> +	int running;
> +	int cpuid;
> +};
> +
> +
> +#endif
> +
> +
> struct sctp_iterator {
> 	TAILQ_ENTRY(sctp_iterator) sctp_nxt_itr;
> 	struct vnet *vn;
>

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 08:40:12 2011
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A43C3106564A;
	Fri,  4 Feb 2011 08:40:12 +0000 (UTC)
	(envelope-from rrs@lakerest.net)
Received: from lakerest.net (unknown [IPv6:2001:240:585:2:213:d4ff:fef3:2d8d])
	by mx1.freebsd.org (Postfix) with ESMTP id 5190F8FC0C;
	Fri,  4 Feb 2011 08:40:12 +0000 (UTC)
Received: from [10.1.1.53] ([10.1.1.53]) (authenticated bits=0)
	by lakerest.net (8.14.4/8.14.3) with ESMTP id p148eBsM072506
	(version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT);
	Fri, 4 Feb 2011 03:40:11 -0500 (EST) (envelope-from rrs@lakerest.net)
Mime-Version: 1.0 (Apple Message framework v1082)
Content-Type: text/plain; charset=us-ascii
From: Randall Stewart 
In-Reply-To: 
Date: Fri, 4 Feb 2011 03:40:10 -0500
Content-Transfer-Encoding: quoted-printable
Message-Id: <5261CAA5-4ACB-4B0D-BB56-BD9FEAC85555@lakerest.net>
References: <201102031005.p13A5Vwi040803@svn.freebsd.org>
	
To: Robert Watson 
X-Mailer: Apple Mail (2.1082)
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r218211 - in head/sys: conf netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 08:40:12 -0000


On Feb 4, 2011, at 1:40 AM, Robert Watson wrote:

>=20
> On Thu, 3 Feb 2011, Randall Stewart wrote:
>=20
>> Author: rrs
>> Date: Thu Feb  3 10:05:30 2011
>> New Revision: 218211
>> URL: http://svn.freebsd.org/changeset/base/218211
>>=20
>> Log:
>> Adds an experimental option to create a pool of
>> threads. These serve as input threads and are queued
>> packets based on the V-tag number. This is similar to
>> what a modern card can do with queue's for TCP... but
>> alas modern cards know nothing about SCTP.
>=20
> Hmm.  It might be better to add a new NETISR_SCTP and use netisr's =
support for multithreading?
>=20
> (I'm preparing a patch for review that enhances that a bit so that =
protocols can be a bit more expressive in terms of specifying dispatch =
policy, etc, currently).
>=20
> Robert

Robert:

Let me know when the patch goes in and point me in the general direction
of what code to look at and I will convert it to use it... In the mean
time I will do a couple of minor fixes that jb suggested and then
use this for the measurements I am doing ;)

R



------------------------------
Randall Stewart
803-317-4952 (cell)


From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 09:57:41 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D6C36106564A;
	Fri,  4 Feb 2011 09:57:41 +0000 (UTC)
	(envelope-from pawel@dawidek.net)
Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60])
	by mx1.freebsd.org (Postfix) with ESMTP id 7DF378FC19;
	Fri,  4 Feb 2011 09:57:40 +0000 (UTC)
Received: by mail.garage.freebsd.pl (Postfix, from userid 65534)
	id 7FE0145E9D; Fri,  4 Feb 2011 10:57:38 +0100 (CET)
Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.garage.freebsd.pl (Postfix) with ESMTP id 2D57D45C9F;
	Fri,  4 Feb 2011 10:57:33 +0100 (CET)
Date: Fri, 4 Feb 2011 10:57:17 +0100
From: Pawel Jakub Dawidek 
To: Adrian Chadd 
Message-ID: <20110204095717.GI2035@garage.freebsd.pl>
References: <201102040025.p140PIqC063291@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="v2Uk6McLiE8OV1El"
Content-Disposition: inline
In-Reply-To: <201102040025.p140PIqC063291@svn.freebsd.org>
User-Agent: Mutt/1.4.2.3i
X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc
X-OS: FreeBSD 9.0-CURRENT amd64
X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on 
	mail.garage.freebsd.pl
X-Spam-Level: 
X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL 
	autolearn=no version=3.0.4
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218243 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 09:57:41 -0000


--v2Uk6McLiE8OV1El
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Feb 04, 2011 at 12:25:18AM +0000, Adrian Chadd wrote:
> Author: adrian
> Date: Fri Feb  4 00:25:18 2011
> New Revision: 218243
> URL: http://svn.freebsd.org/changeset/base/218243
>=20
> Log:
>   Oops, fix newbie mistake that breaks the normal build.
>=20
> Modified:
>   head/sys/dev/ath/if_ath.c
>=20
> Modified: head/sys/dev/ath/if_ath.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/dev/ath/if_ath.c	Thu Feb  3 23:38:11 2011	(r218242)
> +++ head/sys/dev/ath/if_ath.c	Fri Feb  4 00:25:18 2011	(r218243)
> @@ -3892,7 +3892,7 @@ rx_accept:
>  				IEEE80211_KEYIX_NONE : rs->rs_keyix);
>  		sc->sc_lastrs =3D rs;
>  		if (ni !=3D NULL) {
> -#if NOTYET
> +#ifdef	NOTYET
>  		/* tag AMPDU aggregates for reorder processing */
>  		/*
>  		 * XXX this should only tag frames marked as aggregate; rather

Yeah, all real hackers have CFLAGS+=3D-DNOTYET in their src.confs to get
the most cutting edge features:)

--=20
Pawel Jakub Dawidek                       http://www.wheelsystems.com
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

--v2Uk6McLiE8OV1El
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (FreeBSD)

iEYEARECAAYFAk1LzX0ACgkQForvXbEpPzShgwCgup6PtI3DRB0txAX1nJuj9lOp
oiMAoKdmMgVQlUmUwgZJkdb/aaZUZUi/
=qBqs
-----END PGP SIGNATURE-----

--v2Uk6McLiE8OV1El--

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 12:03:48 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8B4F8106564A;
	Fri,  4 Feb 2011 12:03:48 +0000 (UTC)
	(envelope-from brucec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7A8E28FC17;
	Fri,  4 Feb 2011 12:03:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14C3maM080970;
	Fri, 4 Feb 2011 12:03:48 GMT (envelope-from brucec@svn.freebsd.org)
Received: (from brucec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14C3mP4080968;
	Fri, 4 Feb 2011 12:03:48 GMT (envelope-from brucec@svn.freebsd.org)
Message-Id: <201102041203.p14C3mP4080968@svn.freebsd.org>
From: Bruce Cran 
Date: Fri, 4 Feb 2011 12:03:48 +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: r218264 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 12:03:48 -0000

Author: brucec
Date: Fri Feb  4 12:03:48 2011
New Revision: 218264
URL: http://svn.freebsd.org/changeset/base/218264

Log:
  Fix typo (Tuneable -> Tunable).

Modified:
  head/sys/netinet/sctp_sysctl.h

Modified: head/sys/netinet/sctp_sysctl.h
==============================================================================
--- head/sys/netinet/sctp_sysctl.h	Fri Feb  4 11:02:58 2011	(r218263)
+++ head/sys/netinet/sctp_sysctl.h	Fri Feb  4 12:03:48 2011	(r218264)
@@ -195,13 +195,13 @@ struct sctp_sysctl {
 #define SCTPCTL_MAXCHUNKS_MAX		0xFFFFFFFF
 #define SCTPCTL_MAXCHUNKS_DEFAULT	SCTP_ASOC_MAX_CHUNKS_ON_QUEUE
 
-/* tcbhashsize: Tuneable for Hash table sizes */
+/* tcbhashsize: Tunable for Hash table sizes */
 #define SCTPCTL_TCBHASHSIZE_DESC	"Tunable for TCB hash table sizes"
 #define SCTPCTL_TCBHASHSIZE_MIN		1
 #define SCTPCTL_TCBHASHSIZE_MAX		0xFFFFFFFF
 #define SCTPCTL_TCBHASHSIZE_DEFAULT	SCTP_TCBHASHSIZE
 
-/* pcbhashsize: Tuneable for PCB Hash table sizes */
+/* pcbhashsize: Tunable for PCB Hash table sizes */
 #define SCTPCTL_PCBHASHSIZE_DESC	"Tunable for PCB hash table sizes"
 #define SCTPCTL_PCBHASHSIZE_MIN		1
 #define SCTPCTL_PCBHASHSIZE_MAX		0xFFFFFFFF
@@ -213,8 +213,8 @@ struct sctp_sysctl {
 #define SCTPCTL_MIN_SPLIT_POINT_MAX	0xFFFFFFFF
 #define SCTPCTL_MIN_SPLIT_POINT_DEFAULT	SCTP_DEFAULT_SPLIT_POINT_MIN
 
-/* chunkscale: Tuneable for Scaling of number of chunks and messages */
-#define SCTPCTL_CHUNKSCALE_DESC		"Tuneable for Scaling of number of chunks and messages"
+/* chunkscale: Tunable for Scaling of number of chunks and messages */
+#define SCTPCTL_CHUNKSCALE_DESC		"Tunable for Scaling of number of chunks and messages"
 #define SCTPCTL_CHUNKSCALE_MIN		1
 #define SCTPCTL_CHUNKSCALE_MAX		0xFFFFFFFF
 #define SCTPCTL_CHUNKSCALE_DEFAULT	SCTP_CHUNKQUEUE_SCALE

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 13:09:47 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 237441065673;
	Fri,  4 Feb 2011 13:09:47 +0000 (UTC)
	(envelope-from tijl@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 11FB28FC1A;
	Fri,  4 Feb 2011 13:09:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14D9kBF082599;
	Fri, 4 Feb 2011 13:09:46 GMT (envelope-from tijl@svn.freebsd.org)
Received: (from tijl@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14D9ka0082594;
	Fri, 4 Feb 2011 13:09:46 GMT (envelope-from tijl@svn.freebsd.org)
Message-Id: <201102041309.p14D9ka0082594@svn.freebsd.org>
From: Tijl Coosemans 
Date: Fri, 4 Feb 2011 13:09:46 +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: r218266 - head/sys/mips/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 13:09:47 -0000

Author: tijl
Date: Fri Feb  4 13:09:46 2011
New Revision: 218266
URL: http://svn.freebsd.org/changeset/base/218266

Log:
  Replace __LP64__ with __mips_n64. This partly reverts r217147.
  
  Requested by:	jmallett, imp
  Approved by:	kib (mentor)

Modified:
  head/sys/mips/include/_inttypes.h
  head/sys/mips/include/_limits.h
  head/sys/mips/include/_stdint.h
  head/sys/mips/include/_types.h

Modified: head/sys/mips/include/_inttypes.h
==============================================================================
--- head/sys/mips/include/_inttypes.h	Fri Feb  4 12:41:49 2011	(r218265)
+++ head/sys/mips/include/_inttypes.h	Fri Feb  4 13:09:46 2011	(r218266)
@@ -38,7 +38,7 @@
  * Macros for format specifiers.
  */
 
-#ifdef __LP64__
+#ifdef __mips_n64
 #define	__PRI64		"l"
 #define	__PRIptr	"l"
 #else

Modified: head/sys/mips/include/_limits.h
==============================================================================
--- head/sys/mips/include/_limits.h	Fri Feb  4 12:41:49 2011	(r218265)
+++ head/sys/mips/include/_limits.h	Fri Feb  4 13:09:46 2011	(r218266)
@@ -58,7 +58,7 @@
 #define	__INT_MAX	0x7fffffff	/* max value for an int */
 #define	__INT_MIN	(-0x7fffffff - 1)	/* min value for an int */
 
-#ifdef __LP64__
+#ifdef __mips_n64
 #define	__ULONG_MAX	0xffffffffffffffff
 #define	__LONG_MAX	0x7fffffffffffffff
 #define	__LONG_MIN	(-0x7fffffffffffffff - 1)

Modified: head/sys/mips/include/_stdint.h
==============================================================================
--- head/sys/mips/include/_stdint.h	Fri Feb  4 12:41:49 2011	(r218265)
+++ head/sys/mips/include/_stdint.h	Fri Feb  4 13:09:46 2011	(r218266)
@@ -51,7 +51,7 @@
 #define	UINT16_C(c)		(c)
 #define	UINT32_C(c)		(c ## U)
 
-#ifdef __LP64__
+#ifdef __mips_n64
 #define	INT64_C(c)		(c ## L)
 #define	UINT64_C(c)		(c ## UL)
 #else
@@ -136,7 +136,7 @@
  * ISO/IEC 9899:1999
  * 7.18.2.4  Limits of integer types capable of holding object pointers
  */
-#ifdef __LP64__
+#ifdef __mips_n64
 #define	INTPTR_MIN	INT64_MIN
 #define	INTPTR_MAX	INT64_MAX
 #define	UINTPTR_MAX	UINT64_MAX
@@ -158,7 +158,7 @@
  * ISO/IEC 9899:1999
  * 7.18.3  Limits of other integer types
  */
-#ifdef __LP64__
+#ifdef __mips_n64
 /* Limits of ptrdiff_t. */
 #define	PTRDIFF_MIN	INT64_MIN
 #define	PTRDIFF_MAX	INT64_MAX

Modified: head/sys/mips/include/_types.h
==============================================================================
--- head/sys/mips/include/_types.h	Fri Feb  4 12:41:49 2011	(r218265)
+++ head/sys/mips/include/_types.h	Fri Feb  4 13:09:46 2011	(r218266)
@@ -53,7 +53,7 @@ typedef	short			__int16_t;
 typedef	unsigned short		__uint16_t;
 typedef	int			__int32_t;
 typedef	unsigned int		__uint32_t;
-#ifdef __LP64__
+#ifdef __mips_n64
 typedef	long			__int64_t;
 typedef	unsigned long		__uint64_t;
 #else
@@ -76,7 +76,7 @@ typedef	__int32_t	__clock_t;		/* clock()
 typedef	unsigned int	__cpumask_t;
 typedef	double		__double_t;
 typedef	double		__float_t;
-#ifdef __LP64__
+#ifdef __mips_n64
 typedef	__int64_t	__critical_t;
 typedef	__int64_t	__intfptr_t;
 typedef	__int64_t	__intptr_t;
@@ -94,14 +94,14 @@ typedef	__int8_t	__int_least8_t;
 typedef	__int16_t	__int_least16_t;
 typedef	__int32_t	__int_least32_t;
 typedef	__int64_t	__int_least64_t;
-#if defined(__LP64__) || defined(__mips_n32)
+#if defined(__mips_n64) || defined(__mips_n32)
 typedef	__int64_t	__register_t;
 typedef	__int64_t	f_register_t;
 #else
 typedef	__int32_t	__register_t;
 typedef	__int32_t	f_register_t;
 #endif
-#ifdef __LP64__
+#ifdef __mips_n64
 typedef	__int64_t	__ptrdiff_t;
 typedef	__int64_t	__segsz_t;
 typedef	__uint64_t	__size_t;
@@ -126,19 +126,19 @@ typedef	__uint8_t	__uint_least8_t;
 typedef	__uint16_t	__uint_least16_t;
 typedef	__uint32_t	__uint_least32_t;
 typedef	__uint64_t	__uint_least64_t;
-#if defined(__LP64__) || defined(__mips_n32)
+#if defined(__mips_n64) || defined(__mips_n32)
 typedef	__uint64_t	__u_register_t;
 #else
 typedef	__uint32_t	__u_register_t;
 #endif
-#ifdef __LP64__
+#ifdef __mips_n64
 typedef	__uint64_t	__vm_offset_t;
 typedef	__uint64_t	__vm_size_t;
 #else
 typedef	__uint32_t	__vm_offset_t;
 typedef	__uint32_t	__vm_size_t;
 #endif
-#if defined(__LP64__) || defined(__mips_n32) /* PHYSADDR_64_BIT */
+#if defined(__mips_n64) || defined(__mips_n32) /* PHYSADDR_64_BIT */
 typedef	__uint64_t	__vm_paddr_t;
 #else
 typedef	__uint32_t	__vm_paddr_t;

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 13:50:31 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1D0B5106564A;
	Fri,  4 Feb 2011 13:50:31 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 007AB8FC0A;
	Fri,  4 Feb 2011 13:50:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14DoU0D085532;
	Fri, 4 Feb 2011 13:50:30 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14DoUIu085529;
	Fri, 4 Feb 2011 13:50:30 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <201102041350.p14DoUIu085529@svn.freebsd.org>
From: Randall Stewart 
Date: Fri, 4 Feb 2011 13:50: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: r218269 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 13:50:31 -0000

Author: rrs
Date: Fri Feb  4 13:50:30 2011
New Revision: 218269
URL: http://svn.freebsd.org/changeset/base/218269

Log:
  1) Fix cpu mapping per JB's suggestions
  2) Fix it so INIT's don't always end up on CPU0
  
  MFC after:	3 months

Modified:
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_pcb.c

Modified: head/sys/netinet/sctp_input.c
==============================================================================
--- head/sys/netinet/sctp_input.c	Fri Feb  4 13:40:02 2011	(r218268)
+++ head/sys/netinet/sctp_input.c	Fri Feb  4 13:50:30 2011	(r218269)
@@ -1,8 +1,7 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
- * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
- *                          Michael Tuexen, tuexen@fh-muenster.de
- *                          All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -5928,6 +5927,10 @@ bad:
 	return;
 }
 
+#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP)
+extern int *sctp_cpuarry;
+
+#endif
 
 void
 sctp_input(struct mbuf *m, int off)
@@ -5937,8 +5940,9 @@ sctp_input(struct mbuf *m, int off)
 	struct sctphdr *sh;
 	int offset;
 	int cpu_to_use;
+	uint32_t tag;
 
-	if (mp_maxid > 1) {
+	if (mp_ncpus > 1) {
 		ip = mtod(m, struct ip *);
 		offset = off + sizeof(*sh);
 		if (SCTP_BUF_LEN(m) < offset) {
@@ -5949,7 +5953,19 @@ sctp_input(struct mbuf *m, int off)
 			ip = mtod(m, struct ip *);
 		}
 		sh = (struct sctphdr *)((caddr_t)ip + off);
-		cpu_to_use = ntohl(sh->v_tag) % mp_maxid;
+		if (sh->v_tag) {
+			tag = htonl(sh->v_tag);
+		} else {
+			/*
+			 * Distribute new INIT's to all CPU's don't just
+			 * pick on 0.
+			 */
+			struct timeval tv;
+
+			(void)SCTP_GETTIME_TIMEVAL(&tv);
+			tag = (uint32_t) tv.tv_usec;
+		}
+		cpu_to_use = sctp_cpuarry[tag % mp_ncpus];
 		sctp_queue_to_mcore(m, off, cpu_to_use);
 		return;
 	}

Modified: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c	Fri Feb  4 13:40:02 2011	(r218268)
+++ head/sys/netinet/sctp_pcb.c	Fri Feb  4 13:50:30 2011	(r218269)
@@ -1,8 +1,7 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
- * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
- *                          Michael Tuexen, tuexen@fh-muenster.de
- *                          All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -5446,7 +5445,7 @@ static int sctp_scale_up_for_address = S
 
 #if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP)
 struct sctp_mcore_ctrl *sctp_mcore_workers = NULL;
-
+int *sctp_cpuarry = NULL;
 void
 sctp_queue_to_mcore(struct mbuf *m, int off, int cpu_to_use)
 {
@@ -5548,32 +5547,48 @@ skip_sleep:
 static void
 sctp_startup_mcore_threads(void)
 {
-	int i;
+	int i, cpu;
 
-	if (mp_maxid == 1)
+	if (mp_ncpus == 1)
 		return;
 
+	if (sctp_mcore_workers != NULL) {
+		/*
+		 * Already been here in some previous vnet?
+		 */
+		return;
+	}
 	SCTP_MALLOC(sctp_mcore_workers, struct sctp_mcore_ctrl *,
-	    (mp_maxid * sizeof(struct sctp_mcore_ctrl)),
+	    ((mp_maxid + 1) * sizeof(struct sctp_mcore_ctrl)),
 	    SCTP_M_MCORE);
 	if (sctp_mcore_workers == NULL) {
 		/* TSNH I hope */
 		return;
 	}
-	memset(sctp_mcore_workers, 0, (mp_maxid *
+	memset(sctp_mcore_workers, 0, ((mp_maxid + 1) *
 	    sizeof(struct sctp_mcore_ctrl)));
 	/* Init the structures */
-	for (i = 0; i < mp_maxid; i++) {
+	for (i = 0; i <= mp_maxid; i++) {
 		TAILQ_INIT(&sctp_mcore_workers[i].que);
 		SCTP_MCORE_LOCK_INIT(&sctp_mcore_workers[i]);
 		SCTP_MCORE_QLOCK_INIT(&sctp_mcore_workers[i]);
 		sctp_mcore_workers[i].cpuid = i;
 	}
+	if (sctp_cpuarry == NULL) {
+		SCTP_MALLOC(sctp_cpuarry, int *,
+		    (mp_ncpus * sizeof(int)),
+		    SCTP_M_MCORE);
+		i = 0;
+		CPU_FOREACH(cpu) {
+			sctp_cpuarry[i] = cpu;
+			i++;
+		}
+	}
 	/* Now start them all */
-	for (i = 0; i < mp_maxid; i++) {
+	CPU_FOREACH(cpu) {
 		(void)kproc_create(sctp_mcore_thread,
-		    (void *)&sctp_mcore_workers[i],
-		    &sctp_mcore_workers[i].thread_proc,
+		    (void *)&sctp_mcore_workers[cpu],
+		    &sctp_mcore_workers[cpu].thread_proc,
 		    RFPROC,
 		    SCTP_KTHREAD_PAGES,
 		    SCTP_MCORE_NAME);
@@ -5605,12 +5620,12 @@ sctp_pcb_init()
 #endif
 #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
 	SCTP_MALLOC(SCTP_BASE_STATS, struct sctpstat *,
-	    (mp_maxid * sizeof(struct sctpstat)),
+	    ((mp_maxid + 1) * sizeof(struct sctpstat)),
 	    SCTP_M_MCORE);
 #endif
 	(void)SCTP_GETTIME_TIMEVAL(&tv);
 #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
-	bzero(SCTP_BASE_STATS, (sizeof(struct sctpstat) * mp_maxid));
+	bzero(SCTP_BASE_STATS, (sizeof(struct sctpstat) * (mp_maxid + 1)));
 	SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_sec = (uint32_t) tv.tv_sec;
 	SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_usec = (uint32_t) tv.tv_usec;
 #else

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 14:06:57 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B0A241065670;
	Fri,  4 Feb 2011 14:06:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9FB428FC13;
	Fri,  4 Feb 2011 14:06:57 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14E6v1E086407;
	Fri, 4 Feb 2011 14:06:57 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14E6vTi086405;
	Fri, 4 Feb 2011 14:06:57 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201102041406.p14E6vTi086405@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 4 Feb 2011 14:06:57 +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: r218270 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 14:06:57 -0000

Author: jhb
Date: Fri Feb  4 14:06:57 2011
New Revision: 218270
URL: http://svn.freebsd.org/changeset/base/218270

Log:
  Use M_WAITOK rather than M_NOWAIT when creating taskqueues via the
  TASKQUEUE_DEFINE macros.  All the places that use these macros to create
  taskqueues assume that the operation succeeds.
  
  MFC after:	1 week

Modified:
  head/sys/sys/taskqueue.h

Modified: head/sys/sys/taskqueue.h
==============================================================================
--- head/sys/sys/taskqueue.h	Fri Feb  4 13:50:30 2011	(r218269)
+++ head/sys/sys/taskqueue.h	Fri Feb  4 14:06:57 2011	(r218270)
@@ -96,7 +96,7 @@ static void								\
 taskqueue_define_##name(void *arg)					\
 {									\
 	taskqueue_##name =						\
-	    taskqueue_create(#name, M_NOWAIT, (enqueue), (context));	\
+	    taskqueue_create(#name, M_WAITOK, (enqueue), (context));	\
 	init;								\
 }									\
 									\
@@ -120,7 +120,7 @@ static void								\
 taskqueue_define_##name(void *arg)					\
 {									\
 	taskqueue_##name =						\
-	    taskqueue_create_fast(#name, M_NOWAIT, (enqueue),		\
+	    taskqueue_create_fast(#name, M_WAITOK, (enqueue),		\
 	    (context));							\
 	init;								\
 }									\

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 14:13:16 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4664A1065670;
	Fri,  4 Feb 2011 14:13:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 33A4E8FC16;
	Fri,  4 Feb 2011 14:13:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14EDGTf086605;
	Fri, 4 Feb 2011 14:13:16 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14EDGsd086603;
	Fri, 4 Feb 2011 14:13:16 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201102041413.p14EDGsd086603@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 4 Feb 2011 14:13: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: r218271 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 14:13:16 -0000

Author: jhb
Date: Fri Feb  4 14:13:15 2011
New Revision: 218271
URL: http://svn.freebsd.org/changeset/base/218271

Log:
  When turning off TCP_NOPUSH, only call tcp_output() to immediately flush
  any pending data if the connection is established.
  
  Submitted by:	csjp
  Reviewed by:	lstewart
  MFC after:	1 week

Modified:
  head/sys/netinet/tcp_usrreq.c

Modified: head/sys/netinet/tcp_usrreq.c
==============================================================================
--- head/sys/netinet/tcp_usrreq.c	Fri Feb  4 14:06:57 2011	(r218270)
+++ head/sys/netinet/tcp_usrreq.c	Fri Feb  4 14:13:15 2011	(r218271)
@@ -1328,9 +1328,10 @@ tcp_ctloutput(struct socket *so, struct 
 			INP_WLOCK_RECHECK(inp);
 			if (optval)
 				tp->t_flags |= TF_NOPUSH;
-			else {
+			else if (tp->t_flags & TF_NOPUSH) {
 				tp->t_flags &= ~TF_NOPUSH;
-				error = tcp_output(tp);
+				if (TCPS_HAVEESTABLISHED(tp->t_state))
+					error = tcp_output(tp);
 			}
 			INP_WUNLOCK(inp);
 			break;

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 14:16:41 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B7C6F1065672;
	Fri,  4 Feb 2011 14:16:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A6CE58FC1F;
	Fri,  4 Feb 2011 14:16:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14EGfBR086717;
	Fri, 4 Feb 2011 14:16:41 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14EGfF0086715;
	Fri, 4 Feb 2011 14:16:41 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201102041416.p14EGfF0086715@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 4 Feb 2011 14:16:41 +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: r218272 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 14:16:41 -0000

Author: jhb
Date: Fri Feb  4 14:16:41 2011
New Revision: 218272
URL: http://svn.freebsd.org/changeset/base/218272

Log:
  Always assert that the turnstile chain lock is held in turnstile_wait()
  and remove a duplicate hash lookup.
  
  MFC after:	1 week

Modified:
  head/sys/kern/subr_turnstile.c

Modified: head/sys/kern/subr_turnstile.c
==============================================================================
--- head/sys/kern/subr_turnstile.c	Fri Feb  4 14:13:15 2011	(r218271)
+++ head/sys/kern/subr_turnstile.c	Fri Feb  4 14:16:41 2011	(r218272)
@@ -685,8 +685,8 @@ turnstile_wait(struct turnstile *ts, str
 	 * turnstile already in use by this lock.
 	 */
 	tc = TC_LOOKUP(ts->ts_lockobj);
+	mtx_assert(&tc->tc_lock, MA_OWNED);
 	if (ts == td->td_turnstile) {
-		mtx_assert(&tc->tc_lock, MA_OWNED);
 #ifdef TURNSTILE_PROFILING
 		tc->tc_depth++;
 		if (tc->tc_depth > tc->tc_max_depth) {
@@ -695,7 +695,6 @@ turnstile_wait(struct turnstile *ts, str
 				turnstile_max_depth = tc->tc_max_depth;
 		}
 #endif
-		tc = TC_LOOKUP(ts->ts_lockobj);
 		LIST_INSERT_HEAD(&tc->tc_turnstiles, ts, ts_hash);
 		KASSERT(TAILQ_EMPTY(&ts->ts_pending),
 		    ("thread's turnstile has pending threads"));

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 14:20:28 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0218B106566C;
	Fri,  4 Feb 2011 14:20:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E51478FC16;
	Fri,  4 Feb 2011 14:20:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14EKRAc086849;
	Fri, 4 Feb 2011 14:20:27 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14EKRvB086847;
	Fri, 4 Feb 2011 14:20:27 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201102041420.p14EKRvB086847@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 4 Feb 2011 14: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: r218273 - head/sys/fs/ext2fs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 14:20:28 -0000

Author: jhb
Date: Fri Feb  4 14:20:27 2011
New Revision: 218273
URL: http://svn.freebsd.org/changeset/base/218273

Log:
  Collapse duplicate definitions of EXT2_SB().
  
  Submitted by:	Pedro F. Giffuni  giffunip at yahoo

Modified:
  head/sys/fs/ext2fs/ext2fs.h

Modified: head/sys/fs/ext2fs/ext2fs.h
==============================================================================
--- head/sys/fs/ext2fs/ext2fs.h	Fri Feb  4 14:16:41 2011	(r218272)
+++ head/sys/fs/ext2fs/ext2fs.h	Fri Feb  4 14:20:27 2011	(r218273)
@@ -39,19 +39,6 @@
 
 #include 
 
-#if defined(_KERNEL)
-/*
- * FreeBSD passes the pointer to the in-core struct with relevant
- * fields to EXT2_SB macro when accessing superblock fields.
- */
-#define EXT2_SB(sb)	(sb)
-#else
-/* Assume that user mode programs are passing in an ext2fs superblock, not
- * a kernel struct super_block.  This will allow us to call the feature-test
- * macros from user land. */
-#define EXT2_SB(sb)	(sb)
-#endif
-
 /*
  * Maximal count of links to a file
  */
@@ -118,10 +105,6 @@ struct ext2fs {
 	u_int32_t  reserved2[204];
 };
 
-/* Assume that user mode programs are passing in an ext2fs superblock, not
- * a kernel struct super_block.  This will allow us to call the feature-test
- * macros from user land. */
-#define EXT2_SB(sb)	(sb)
 
 /*
  * In-Memory Superblock
@@ -208,6 +191,11 @@ struct m_ext2fs {
 					 | EXT2F_ROCOMPAT_LARGEFILE)
 #define EXT2F_INCOMPAT_SUPP		EXT2F_INCOMPAT_FTYPE
 
+/* Assume that user mode programs are passing in an ext2fs superblock, not
+ * a kernel struct super_block.  This will allow us to call the feature-test
+ * macros from user land. */
+#define EXT2_SB(sb)	(sb)
+
 /*
  * Feature set definitions
  */
@@ -260,6 +248,7 @@ struct ext2_gd {
 
 #define e2fs_cgload(old, new, size) memcpy((new), (old), (size));
 #define e2fs_cgsave(old, new, size) memcpy((new), (old), (size));
+
 /*
  * Macro-instructions used to manage several block sizes
  */

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 15:22:56 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 79D24106566C;
	Fri,  4 Feb 2011 15:22:56 +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 680318FC12;
	Fri,  4 Feb 2011 15:22:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14FMuPZ088659;
	Fri, 4 Feb 2011 15:22:56 GMT (envelope-from ae@svn.freebsd.org)
Received: (from ae@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14FMuvR088657;
	Fri, 4 Feb 2011 15:22:56 GMT (envelope-from ae@svn.freebsd.org)
Message-Id: <201102041522.p14FMuvR088657@svn.freebsd.org>
From: "Andrey V. Elsukov" 
Date: Fri, 4 Feb 2011 15:22: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: r218278 -
	head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 15:22:56 -0000

Author: ae
Date: Fri Feb  4 15:22:56 2011
New Revision: 218278
URL: http://svn.freebsd.org/changeset/base/218278

Log:
  vdev's sectorsize should not be greater than 8 Kbytes and also
  it should be power of 2. This prevents non-aligned access while
  probing vdev's labels.
  
  PR:		kern/147852
  Reviewed by:	pjd
  MFC after:	1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c	Fri Feb  4 14:44:59 2011	(r218277)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c	Fri Feb  4 15:22:56 2011	(r218278)
@@ -393,7 +393,8 @@ vdev_geom_open_by_path(vdev_t *vd, int c
 	if (pp != NULL) {
 		ZFS_LOG(1, "Found provider by name %s.", vd->vdev_path);
 		cp = vdev_geom_attach(pp);
-		if (cp != NULL && check_guid) {
+		if (cp != NULL && check_guid && ISP2(pp->sectorsize) &&
+		    pp->sectorsize <= VDEV_PAD_SIZE) {
 			g_topology_unlock();
 			guid = vdev_geom_read_guid(cp);
 			g_topology_lock();
@@ -457,6 +458,17 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi
 	if (cp == NULL) {
 		ZFS_LOG(1, "Provider %s not found.", vd->vdev_path);
 		error = ENOENT;
+	} else if (cp->provider->sectorsize > VDEV_PAD_SIZE ||
+	    !ISP2(cp->provider->sectorsize)) {
+		ZFS_LOG(1, "Provider %s has unsupported sectorsize.",
+		    vd->vdev_path);
+
+		g_topology_lock();
+		vdev_geom_detach(cp, 0);
+		g_topology_unlock();
+
+		error = EINVAL;
+		cp = NULL;
 	} else if (cp->acw == 0 && (spa_mode(vd->vdev_spa) & FWRITE) != 0) {
 		int i;
 

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 15:45:48 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C33A9106564A;
	Fri,  4 Feb 2011 15:45:48 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 978AB8FC1B;
	Fri,  4 Feb 2011 15:45:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14FjmIQ089303;
	Fri, 4 Feb 2011 15:45:48 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14Fjmmc089301;
	Fri, 4 Feb 2011 15:45:48 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <201102041545.p14Fjmmc089301@svn.freebsd.org>
From: Ed Maste 
Date: Fri, 4 Feb 2011 15:45:48 +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: r218280 - head/sys/dev/aac
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 15:45:48 -0000

Author: emaste
Date: Fri Feb  4 15:45:48 2011
New Revision: 218280
URL: http://svn.freebsd.org/changeset/base/218280

Log:
  We can pass a format string and args to panic(), so instead of using
  printf() to output some information before a panic, just include that
  information in the panic.
  
  Submitted by:	bde
  Reviewed by:	bde

Modified:
  head/sys/dev/aac/aacvar.h

Modified: head/sys/dev/aac/aacvar.h
==============================================================================
--- head/sys/dev/aac/aacvar.h	Fri Feb  4 15:28:26 2011	(r218279)
+++ head/sys/dev/aac/aacvar.h	Fri Feb  4 15:45:48 2011	(r218280)
@@ -537,9 +537,8 @@ static __inline void							\
 aac_enqueue_ ## name (struct aac_command *cm)				\
 {									\
 	if ((cm->cm_flags & AAC_ON_AACQ_MASK) != 0) {			\
-		printf("command %p is on another queue, flags = %#x\n",	\
-		       cm, cm->cm_flags);				\
-		panic("aac: command is on another queue");		\
+		panic("aac: command %p is on another queue, flags = %#x", \
+		    cm, cm->cm_flags);					\
 	}								\
 	TAILQ_INSERT_TAIL(&cm->cm_sc->aac_ ## name, cm, cm_link);	\
 	cm->cm_flags |= AAC_ON_ ## index;				\
@@ -549,9 +548,8 @@ static __inline void							\
 aac_requeue_ ## name (struct aac_command *cm)				\
 {									\
 	if ((cm->cm_flags & AAC_ON_AACQ_MASK) != 0) {			\
-		printf("command %p is on another queue, flags = %#x\n",	\
-		       cm, cm->cm_flags);				\
-		panic("aac: command is on another queue");		\
+		panic("aac: command %p is on another queue, flags = %#x", \
+		    cm, cm->cm_flags);					\
 	}								\
 	TAILQ_INSERT_HEAD(&cm->cm_sc->aac_ ## name, cm, cm_link);	\
 	cm->cm_flags |= AAC_ON_ ## index;				\
@@ -564,10 +562,8 @@ aac_dequeue_ ## name (struct aac_softc *
 									\
 	if ((cm = TAILQ_FIRST(&sc->aac_ ## name)) != NULL) {		\
 		if ((cm->cm_flags & AAC_ON_ ## index) == 0) {		\
-			printf("command %p not in queue, flags = %#x, "	\
-			       "bit = %#x\n", cm, cm->cm_flags,		\
-			       AAC_ON_ ## index);			\
-			panic("aac: command not in queue");		\
+			panic("aac: command %p not in queue, flags = %#x, bit = %#x", \
+			    cm, cm->cm_flags, AAC_ON_ ## index);	\
 		}							\
 		TAILQ_REMOVE(&sc->aac_ ## name, cm, cm_link);		\
 		cm->cm_flags &= ~AAC_ON_ ## index;			\
@@ -579,10 +575,8 @@ static __inline void							\
 aac_remove_ ## name (struct aac_command *cm)				\
 {									\
 	if ((cm->cm_flags & AAC_ON_ ## index) == 0) {			\
-		printf("command %p not in queue, flags = %#x, "		\
-		       "bit = %#x\n", cm, cm->cm_flags, 		\
-		       AAC_ON_ ## index);				\
-		panic("aac: command not in queue");			\
+		panic("aac: command %p not in queue, flags = %#x, bit = %#x", \
+		    cm, cm->cm_flags, AAC_ON_ ## index);		\
 	}								\
 	TAILQ_REMOVE(&cm->cm_sc->aac_ ## name, cm, cm_link);		\
 	cm->cm_flags &= ~AAC_ON_ ## index;				\

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 16:29:27 2011
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 59B7C106564A;
	Fri,  4 Feb 2011 16:29:27 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id F2A7E8FC19;
	Fri,  4 Feb 2011 16:29:26 +0000 (UTC)
Received: from [127.0.0.1] (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id p14GN1J6002115;
	Fri, 4 Feb 2011 09:23:01 -0700 (MST) (envelope-from imp@bsdimp.com)
Message-ID: <4D4C27E5.2020708@bsdimp.com>
Date: Fri, 04 Feb 2011 09:23:01 -0700
From: Warner Losh 
User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US;
	rv:1.9.2.13) Gecko/20101211 Thunderbird/3.1.7
MIME-Version: 1.0
To: Bruce Cran 
References: <201102032026.p13KQQX2057419@svn.freebsd.org>
	<20110203230721.GA47981@muon.cran.org.uk>
In-Reply-To: <20110203230721.GA47981@muon.cran.org.uk>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, Adrian Chadd ,
	src-committers@FreeBSD.org, svn-src-all@FreeBSD.org
Subject: Re: svn commit: r218238 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 16:29:27 -0000

On 02/03/2011 16:07, Bruce Cran wrote:
> On Thu, Feb 03, 2011 at 08:26:26PM +0000, Adrian Chadd wrote:
>>   		if (ni != NULL) {
>> +#if NOTYET
>>   		/* tag AMPDU aggregates for reorder processing */
> This seems to have broken the build because NOTYET isn't defined.

ANSI C states that all undefined preprocessor variables shall expand to 
0.  If we have a warning on that complains, we should turn it off.

Warner

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 16:40:50 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 868FC1065673;
	Fri,  4 Feb 2011 16:40:50 +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 73E898FC13;
	Fri,  4 Feb 2011 16:40:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14Geogx090912;
	Fri, 4 Feb 2011 16:40:50 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14Geowb090904;
	Fri, 4 Feb 2011 16:40:50 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201102041640.p14Geowb090904@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Fri, 4 Feb 2011 16:40: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: r218285 - in head: bin/kill bin/pkill bin/sh
	lib/libc/gen usr.bin/killall usr.bin/truss
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 16:40:50 -0000

Author: jilles
Date: Fri Feb  4 16:40:50 2011
New Revision: 218285
URL: http://svn.freebsd.org/changeset/base/218285

Log:
  Make sys_signame upper case.
  
  This matches the constants from  with 'SIG' removed, which POSIX
  requires kill and trap to accept and 'kill -l' to write.
  
  'kill -l', 'trap', 'trap -l' output is now upper case.
  
  In Turkish locales, signal names with an upper case 'I' are now accepted,
  while signal names with a lower case 'i' are no longer accepted, and the
  output of 'killall -l' now contains proper capital 'I' without dot instead
  of a dotted capital 'I'.

Modified:
  head/bin/kill/kill.c
  head/bin/pkill/pkill.c
  head/bin/sh/trap.c
  head/lib/libc/gen/psignal.3
  head/lib/libc/gen/siglist.c
  head/usr.bin/killall/killall.c
  head/usr.bin/truss/main.c

Modified: head/bin/kill/kill.c
==============================================================================
--- head/bin/kill/kill.c	Fri Feb  4 16:32:34 2011	(r218284)
+++ head/bin/kill/kill.c	Fri Feb  4 16:40:50 2011	(r218285)
@@ -152,7 +152,7 @@ signame_to_signum(const char *sig)
 {
 	int n;
 
-	if (!strncasecmp(sig, "sig", (size_t)3))
+	if (!strncasecmp(sig, "SIG", (size_t)3))
 		sig += 3;
 	for (n = 1; n < sys_nsig; n++) {
 		if (!strcasecmp(sys_signame[n], sig))

Modified: head/bin/pkill/pkill.c
==============================================================================
--- head/bin/pkill/pkill.c	Fri Feb  4 16:32:34 2011	(r218284)
+++ head/bin/pkill/pkill.c	Fri Feb  4 16:40:50 2011	(r218285)
@@ -156,7 +156,7 @@ main(int argc, char **argv)
 				argv++;
 				argc--;
 			} else {
-				if (strncasecmp(p, "sig", 3) == 0)
+				if (strncasecmp(p, "SIG", 3) == 0)
 					p += 3;
 				for (i = 1; i < NSIG; i++)
 					if (strcasecmp(sys_signame[i], p) == 0)

Modified: head/bin/sh/trap.c
==============================================================================
--- head/bin/sh/trap.c	Fri Feb  4 16:32:34 2011	(r218284)
+++ head/bin/sh/trap.c	Fri Feb  4 16:40:50 2011	(r218285)
@@ -101,12 +101,12 @@ sigstring_to_signum(char *sig)
 
 		signo = atoi(sig);
 		return ((signo >= 0 && signo < NSIG) ? signo : (-1));
-	} else if (strcasecmp(sig, "exit") == 0) {
+	} else if (strcasecmp(sig, "EXIT") == 0) {
 		return (0);
 	} else {
 		int n;
 
-		if (strncasecmp(sig, "sig", 3) == 0)
+		if (strncasecmp(sig, "SIG", 3) == 0)
 			sig += 3;
 		for (n = 1; n < sys_nsig; n++)
 			if (sys_signame[n] &&
@@ -171,7 +171,7 @@ trapcmd(int argc, char **argv)
 				out1str("trap -- ");
 				out1qstr(trap[signo]);
 				if (signo == 0) {
-					out1str(" exit\n");
+					out1str(" EXIT\n");
 				} else if (sys_signame[signo]) {
 					out1fmt(" %s\n", sys_signame[signo]);
 				} else {

Modified: head/lib/libc/gen/psignal.3
==============================================================================
--- head/lib/libc/gen/psignal.3	Fri Feb  4 16:32:34 2011	(r218284)
+++ head/lib/libc/gen/psignal.3	Fri Feb  4 16:40:50 2011	(r218285)
@@ -28,7 +28,7 @@
 .\"     @(#)psignal.3	8.2 (Berkeley) 2/27/95
 .\" $FreeBSD$
 .\"
-.Dd February 27, 1995
+.Dd February 4, 2011
 .Dt PSIGNAL 3
 .Os
 .Sh NAME
@@ -89,7 +89,7 @@ indexed by recognized signal numbers.
 The external array
 .Va sys_signame
 is used similarly and
-contains short, lower-case abbreviations for signals
+contains short, upper-case abbreviations for signals
 which are useful for recognizing signal names
 in user input.
 The defined variable

Modified: head/lib/libc/gen/siglist.c
==============================================================================
--- head/lib/libc/gen/siglist.c	Fri Feb  4 16:32:34 2011	(r218284)
+++ head/lib/libc/gen/siglist.c	Fri Feb  4 16:40:50 2011	(r218285)
@@ -37,37 +37,37 @@ __FBSDID("$FreeBSD$");
 
 const char *const sys_signame[NSIG] = {
 	"Signal 0",
-	"hup",				/* SIGHUP */
-	"int",				/* SIGINT */
-	"quit",				/* SIGQUIT */
-	"ill",				/* SIGILL */
-	"trap",				/* SIGTRAP */
-	"abrt",				/* SIGABRT */
-	"emt",				/* SIGEMT */
-	"fpe",				/* SIGFPE */
-	"kill",				/* SIGKILL */
-	"bus",				/* SIGBUS */
-	"segv",				/* SIGSEGV */
-	"sys",				/* SIGSYS */
-	"pipe",				/* SIGPIPE */
-	"alrm",				/* SIGALRM */
-	"term",				/* SIGTERM */
-	"urg",				/* SIGURG */
-	"stop",				/* SIGSTOP */
-	"tstp",				/* SIGTSTP */
-	"cont",				/* SIGCONT */
-	"chld",				/* SIGCHLD */
-	"ttin",				/* SIGTTIN */
-	"ttou",				/* SIGTTOU */
-	"io",				/* SIGIO */
-	"xcpu",				/* SIGXCPU */
-	"xfsz",				/* SIGXFSZ */
-	"vtalrm",			/* SIGVTALRM */
-	"prof",				/* SIGPROF */
-	"winch",			/* SIGWINCH */
-	"info",				/* SIGINFO */
-	"usr1",				/* SIGUSR1 */
-	"usr2"				/* SIGUSR2 */
+	"HUP",				/* SIGHUP */
+	"INT",				/* SIGINT */
+	"QUIT",				/* SIGQUIT */
+	"ILL",				/* SIGILL */
+	"TRAP",				/* SIGTRAP */
+	"ABRT",				/* SIGABRT */
+	"EMT",				/* SIGEMT */
+	"FPE",				/* SIGFPE */
+	"KILL",				/* SIGKILL */
+	"BUS",				/* SIGBUS */
+	"SEGV",				/* SIGSEGV */
+	"SYS",				/* SIGSYS */
+	"PIPE",				/* SIGPIPE */
+	"ALRM",				/* SIGALRM */
+	"TERM",				/* SIGTERM */
+	"URG",				/* SIGURG */
+	"STOP",				/* SIGSTOP */
+	"TSTP",				/* SIGTSTP */
+	"CONT",				/* SIGCONT */
+	"CHLD",				/* SIGCHLD */
+	"TTIN",				/* SIGTTIN */
+	"TTOU",				/* SIGTTOU */
+	"IO",				/* SIGIO */
+	"XCPU",				/* SIGXCPU */
+	"XFSZ",				/* SIGXFSZ */
+	"VTALRM",			/* SIGVTALRM */
+	"PROF",				/* SIGPROF */
+	"WINCH",			/* SIGWINCH */
+	"INFO",				/* SIGINFO */
+	"USR1",				/* SIGUSR1 */
+	"USR2"				/* SIGUSR2 */
 };
 
 const char *const sys_siglist[NSIG] = {

Modified: head/usr.bin/killall/killall.c
==============================================================================
--- head/usr.bin/killall/killall.c	Fri Feb  4 16:32:34 2011	(r218284)
+++ head/usr.bin/killall/killall.c	Fri Feb  4 16:40:50 2011	(r218285)
@@ -218,7 +218,7 @@ main(int ac, char **av)
 				break;
 			default:
 				if (isalpha((unsigned char)**av)) {
-					if (strncasecmp(*av, "sig", 3) == 0)
+					if (strncasecmp(*av, "SIG", 3) == 0)
 						*av += 3;
 					for (sig = NSIG, p = sys_signame + 1;
 					     --sig; ++p)

Modified: head/usr.bin/truss/main.c
==============================================================================
--- head/usr.bin/truss/main.c	Fri Feb  4 16:32:34 2011	(r218284)
+++ head/usr.bin/truss/main.c	Fri Feb  4 16:40:50 2011	(r218285)
@@ -155,7 +155,7 @@ strsig(int sig)
 	ret = NULL;
 	if (sig > 0 && sig < NSIG) {
 		int i;
-		asprintf(&ret, "sig%s", sys_signame[sig]);
+		asprintf(&ret, "SIG%s", sys_signame[sig]);
 		if (ret == NULL)
 			return (NULL);
 		for (i = 0; ret[i] != '\0'; ++i)

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 17:38:05 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 45186106564A;
	Fri,  4 Feb 2011 17:38:05 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 1C7098FC14;
	Fri,  4 Feb 2011 17:38:05 +0000 (UTC)
Received: from fledge.watson.org (fledge.watson.org [65.122.17.41])
	by cyrus.watson.org (Postfix) with ESMTPS id B897146B0C;
	Fri,  4 Feb 2011 12:38:04 -0500 (EST)
Date: Fri, 4 Feb 2011 17:38:04 +0000 (GMT)
From: Robert Watson 
X-X-Sender: robert@fledge.watson.org
To: John Baldwin 
In-Reply-To: <201102031529.25072.jhb@freebsd.org>
Message-ID: 
References: <201102031922.p13JML8i055697@svn.freebsd.org>
	<201102031529.25072.jhb@freebsd.org>
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, Randall Stewart ,
	svn-src-all@freebsd.org, src-committers@freebsd.org
Subject: Re: svn commit: r218232 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 17:38:05 -0000


On Thu, 3 Feb 2011, John Baldwin wrote:

>>   1) Move per John Baldwin to mp_maxid
>>   2) Some signed/unsigned errors found by Mac OS compiler (from Michael)
>>   3) a couple of copyright updates on the effected files.
>
> Note that mp_maxid is the maxium valid ID, so you typically have to do 
> things like:
>
> 	for (i = 0; i <= mp_maxid; i++) {
> 		if (CPU_ABSENT(i))
> 			continue;
> 		...
> 	}
>
> There is a CPU_FOREACH() macro that does the above (but assumes you want to 
> skip over non-existent CPUs).

I'm finding the network stack requires quite a bit more along these lines, 
btw.  I'd love also to have:

   PACKAGE_FOREACH()
   CORE_FOREACH()
   HWTHREAD_FOREACH()

   CURPACKAGE()
   CURCORE()
   CURTHREAD()

Available when putting together thread worker pools, distributing work, 
identifying where to channel work, making dispatch decisions and so on.  It 
seems likely that in some scenarios, it will be desirable to have worker 
thread topology linked to hardware topology -- for example, a network stack 
worker per core, with distribution of work targeting the closest worker 
(subject to ordering constraints)...

> Hmmm, this is more complicated.  Can sctp_queue_to_mcore() handle the fact 
> that a cpu_to_use value might not be valid?  If not you might want to 
> maintain a separate "dense" virtual CPU ID table numbered 0 .. mp_ncpus - 1 
> that maps to "present" FreeBSD CPU IDs.  I think Robert has done something 
> similar to support RSS in TCP.  Does that make sense?

This proves somewhat complicated.  I basically have two models, depending on 
whether RSS is involved (which adds an external factor).  Without RSS, I build 
a contiguous workstream number space, which is then mapped via a table to the 
CPU ID space, allowing mappings and hashing to be done easily -- however, 
these refer to ordered flow processing streams (i.e., "threads") rather than 
CPUs, in the strict sense.  In the future with dynamic configuration, this 
becomes important because what I do is rebalance ordered processing streams 
rather than work to CPUs.  With RSS there has to be a link between work 
distribution and the CPU identifiers shared by device drivers, hardware, etc, 
in which case RSS identifies viable CPUs as it starts (probably not quite 
correctly, I'll be looking for a review of that code shortly, cleaning it up 
currently).

This issue came up some at the BSDCan devsummit last year: as more and more 
kernel subsystems need to exploit parallelism explicitly, the thread 
programming model isn't bad, but lacks a strong tie to hardware topology in 
order to help manage work distribution.  One idea idly bandied around was to 
do something along the lines of KSE/GCD for the kernel: provide a layered 
"work" model with ordering constraints, rather than exploit threads directly, 
for work-oriented subsystems.  This is effectively what netisr does, but in a 
network stack-specific way.  But with crypto code, IPSEC, storage stuff, etc, 
all looking to exploit parallelism, perhaps a more general model is called 
for.

Robert

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 17:49:55 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 98867106566B;
	Fri,  4 Feb 2011 17:49:55 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6D9578FC08;
	Fri,  4 Feb 2011 17:49:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14HntfA092692;
	Fri, 4 Feb 2011 17:49:55 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14Hntjo092690;
	Fri, 4 Feb 2011 17:49:55 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201102041749.p14Hntjo092690@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 4 Feb 2011 17:49:55 +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: r218289 - head/sys/dev/re
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 17:49:55 -0000

Author: yongari
Date: Fri Feb  4 17:49:55 2011
New Revision: 218289
URL: http://svn.freebsd.org/changeset/base/218289

Log:
  Disable TX IP checksum offloading for RTL8168C controllers.  The
  controller in question generates frames with bad IP checksum value
  if packets contain IP options.  For instance, packets generated by
  ping(8) with record route option have wrong IP checksum value. The
  controller correctly computes checksum for normal TCP/UDP packets
  though.
  There are two known RTL8168/8111C variants in market and the issue
  I observed happened on RL_HWREV_8168C_SPIN2. I'm not sure
  RL_HWREV_8168C also has the same issue but it would be better to
  assume it has the same issue since they shall share same core.
  RTL8102E which is supposed to be released at the time of
  RTL8168/8111C announcement does not have the issue.
  
  Tested by:	Konstantin V. Krotov ( kkv <> insysnet dot ru )

Modified:
  head/sys/dev/re/if_re.c

Modified: head/sys/dev/re/if_re.c
==============================================================================
--- head/sys/dev/re/if_re.c	Fri Feb  4 17:26:44 2011	(r218288)
+++ head/sys/dev/re/if_re.c	Fri Feb  4 17:49:55 2011	(r218289)
@@ -1527,7 +1527,16 @@ re_attach(device_t dev)
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_ioctl = re_ioctl;
 	ifp->if_start = re_start;
-	ifp->if_hwassist = RE_CSUM_FEATURES | CSUM_TSO;
+	/*
+	 * RTL8168/8111C generates wrong IP checksummed frame if the
+	 * packet has IP options so disable TX IP checksum offloading.
+	 */
+	if (sc->rl_hwrev->rl_rev == RL_HWREV_8168C ||
+	    sc->rl_hwrev->rl_rev == RL_HWREV_8168C_SPIN2)
+		ifp->if_hwassist = CSUM_TCP | CSUM_UDP;
+	else
+		ifp->if_hwassist = CSUM_IP | CSUM_TCP | CSUM_UDP;
+	ifp->if_hwassist |= CSUM_TSO;
 	ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_TSO4;
 	ifp->if_capenable = ifp->if_capabilities;
 	ifp->if_init = re_init;
@@ -3209,6 +3218,7 @@ re_ioctl(struct ifnet *ifp, u_long comma
 	struct rl_softc		*sc = ifp->if_softc;
 	struct ifreq		*ifr = (struct ifreq *) data;
 	struct mii_data		*mii;
+	uint32_t		rev;
 	int			error = 0;
 
 	switch (command) {
@@ -3294,9 +3304,14 @@ re_ioctl(struct ifnet *ifp, u_long comma
 		if ((mask & IFCAP_TXCSUM) != 0 &&
 		    (ifp->if_capabilities & IFCAP_TXCSUM) != 0) {
 			ifp->if_capenable ^= IFCAP_TXCSUM;
-			if ((ifp->if_capenable & IFCAP_TXCSUM) != 0)
-				ifp->if_hwassist |= RE_CSUM_FEATURES;
-			else
+			if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) {
+				rev = sc->rl_hwrev->rl_rev;
+				if (rev == RL_HWREV_8168C ||
+				    rev == RL_HWREV_8168C_SPIN2)
+					ifp->if_hwassist |= CSUM_TCP | CSUM_UDP;
+				else
+					ifp->if_hwassist |= RE_CSUM_FEATURES;
+			} else
 				ifp->if_hwassist &= ~RE_CSUM_FEATURES;
 			reinit = 1;
 		}

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 18:36:10 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 05637106566B;
	Fri,  4 Feb 2011 18:36:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E96598FC0C;
	Fri,  4 Feb 2011 18:36:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14Ia9k7093829;
	Fri, 4 Feb 2011 18:36:09 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14Ia9wH093827;
	Fri, 4 Feb 2011 18:36:09 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201102041836.p14Ia9wH093827@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 4 Feb 2011 18:36: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: r218290 - head/sys/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 18:36:10 -0000

Author: jhb
Date: Fri Feb  4 18:36:09 2011
New Revision: 218290
URL: http://svn.freebsd.org/changeset/base/218290

Log:
  Correct include path.
  
  Submitted by:	arundel
  MFC after:	1 week

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Fri Feb  4 17:49:55 2011	(r218289)
+++ head/sys/conf/files	Fri Feb  4 18:36:09 2011	(r218290)
@@ -960,7 +960,7 @@ dev/e1000/e1000_82543.c		optional em | i
 dev/e1000/e1000_82571.c		optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_82575.c		optional em | igb \
-	 compile-with "${NORMAL_C} -I$S/dev/igb"
+	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_ich8lan.c	optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_api.c		optional em | igb \

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 18:53:48 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: by hub.freebsd.org (Postfix, from userid 1233)
	id A2971106567A; Fri,  4 Feb 2011 18:53:48 +0000 (UTC)
Date: Fri, 4 Feb 2011 18:53:48 +0000
From: Alexander Best 
To: John Baldwin 
Message-ID: <20110204185348.GA16723@freebsd.org>
References: <201102041836.p14Ia9wH093827@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201102041836.p14Ia9wH093827@svn.freebsd.org>
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218290 - head/sys/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 18:53:48 -0000

On Fri Feb  4 11, John Baldwin wrote:
> Author: jhb
> Date: Fri Feb  4 18:36:09 2011
> New Revision: 218290
> URL: http://svn.freebsd.org/changeset/base/218290
> 
> Log:
>   Correct include path.

thanks a bunch. :)

>   
>   Submitted by:	arundel
>   MFC after:	1 week
> 
> Modified:
>   head/sys/conf/files
> 
> Modified: head/sys/conf/files
> ==============================================================================
> --- head/sys/conf/files	Fri Feb  4 17:49:55 2011	(r218289)
> +++ head/sys/conf/files	Fri Feb  4 18:36:09 2011	(r218290)
> @@ -960,7 +960,7 @@ dev/e1000/e1000_82543.c		optional em | i
>  dev/e1000/e1000_82571.c		optional em | igb \
>  	compile-with "${NORMAL_C} -I$S/dev/e1000"
>  dev/e1000/e1000_82575.c		optional em | igb \
> -	 compile-with "${NORMAL_C} -I$S/dev/igb"
> +	compile-with "${NORMAL_C} -I$S/dev/e1000"
>  dev/e1000/e1000_ich8lan.c	optional em | igb \
>  	compile-with "${NORMAL_C} -I$S/dev/e1000"
>  dev/e1000/e1000_api.c		optional em | igb \

-- 
a13x

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 18:56:15 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EB502106566C;
	Fri,  4 Feb 2011 18:56:14 +0000 (UTC)
	(envelope-from julian@freebsd.org)
Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16])
	by mx1.freebsd.org (Postfix) with ESMTP id B4B788FC15;
	Fri,  4 Feb 2011 18:56:14 +0000 (UTC)
Received: from julian-mac.elischer.org (home-nat.elischer.org [67.100.89.137])
	(authenticated bits=0)
	by vps1.elischer.org (8.14.4/8.14.4) with ESMTP id p14IUUUZ025431
	(version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO);
	Fri, 4 Feb 2011 10:30:32 -0800 (PST)
	(envelope-from julian@freebsd.org)
Message-ID: <4D4C45C9.4080105@freebsd.org>
Date: Fri, 04 Feb 2011 10:30:33 -0800
From: Julian Elischer 
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US;
	rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7
MIME-Version: 1.0
To: Robert Watson 
References: <201102031922.p13JML8i055697@svn.freebsd.org>
	<201102031529.25072.jhb@freebsd.org>
	
In-Reply-To: 
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, Randall Stewart ,
	svn-src-all@freebsd.org, src-committers@freebsd.org,
	John Baldwin 
Subject: Re: svn commit: r218232 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 18:56:15 -0000

On 2/4/11 9:38 AM, Robert Watson wrote:
>
> On Thu, 3 Feb 2011, John Baldwin wrote:
>
>>>   1) Move per John Baldwin to mp_maxid
>>>   2) Some signed/unsigned errors found by Mac OS compiler (from 
>>> Michael)
>>>   3) a couple of copyright updates on the effected files.
>>
>> Note that mp_maxid is the maxium valid ID, so you typically have to 
>> do things like:
>>
>>     for (i = 0; i <= mp_maxid; i++) {
>>         if (CPU_ABSENT(i))
>>             continue;
>>         ...
>>     }
>>
>> There is a CPU_FOREACH() macro that does the above (but assumes you 
>> want to skip over non-existent CPUs).
>
> I'm finding the network stack requires quite a bit more along these 
> lines, btw.  I'd love also to have:
>
>   PACKAGE_FOREACH()
>   CORE_FOREACH()
>   HWTHREAD_FOREACH()
>

I agree, which is why I usually support adding such iterators though 
some people scream about them.
(e.g. FOREACH_THREAD_IN_PROC and there is one for iterating through 
vnets too.)

>   CURPACKAGE()
>   CURCORE()
>   CURTHREAD()

also current jail, vnet, etc. (these (kinda) exist)
>
> Available when putting together thread worker pools, distributing 
> work, identifying where to channel work, making dispatch decisions 
> and so on.  It seems likely that in some scenarios, it will be 
> desirable to have worker thread topology linked to hardware topology 
> -- for example, a network stack worker per core, with distribution 
> of work targeting the closest worker (subject to ordering 
> constraints)...
>
>> Hmmm, this is more complicated.  Can sctp_queue_to_mcore() handle 
>> the fact that a cpu_to_use value might not be valid?  If not you 
>> might want to maintain a separate "dense" virtual CPU ID table 
>> numbered 0 .. mp_ncpus - 1 that maps to "present" FreeBSD CPU IDs.  
>> I think Robert has done something similar to support RSS in TCP.  
>> Does that make sense?
>
> This proves somewhat complicated.  I basically have two models, 
> depending on whether RSS is involved (which adds an external 
> factor).  Without RSS, I build a contiguous workstream number space, 
> which is then mapped via a table to the CPU ID space, allowing 
> mappings and hashing to be done easily -- however, these refer to 
> ordered flow processing streams (i.e., "threads") rather than CPUs, 
> in the strict sense.  In the future with dynamic configuration, this 
> becomes important because what I do is rebalance ordered processing 
> streams rather than work to CPUs.  With RSS there has to be a link 
> between work distribution and the CPU identifiers shared by device 
> drivers, hardware, etc, in which case RSS identifies viable CPUs as 
> it starts (probably not quite correctly, I'll be looking for a 
> review of that code shortly, cleaning it up currently).
>
> This issue came up some at the BSDCan devsummit last year: as more 
> and more kernel subsystems need to exploit parallelism explicitly, 
> the thread programming model isn't bad, but lacks a strong tie to 
> hardware topology in order to help manage work distribution.  One 
> idea idly bandied around was to do something along the lines of 
> KSE/GCD for the kernel: provide a layered "work" model with ordering 
> constraints, rather than exploit threads directly, for work-oriented 
> subsystems.  This is effectively what netisr does, but in a network 
> stack-specific way.  But with crypto code, IPSEC, storage stuff, 
> etc, all looking to exploit parallelism, perhaps a more general 
> model is called for.
>
> Robert
>


From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 18:56:53 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 476D41065675;
	Fri,  4 Feb 2011 18:56:53 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 181338FC1B;
	Fri,  4 Feb 2011 18:56:53 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id A10F046B17;
	Fri,  4 Feb 2011 13:56:52 -0500 (EST)
Received: from jhbbsd.localnet (unknown [209.249.190.10])
	by bigwig.baldwin.cx (Postfix) with ESMTPSA id C40968A009;
	Fri,  4 Feb 2011 13:56:51 -0500 (EST)
From: John Baldwin 
To: Julian Elischer 
Date: Fri, 4 Feb 2011 13:56:39 -0500
User-Agent: KMail/1.13.5 (FreeBSD/7.4-CBSD-20110107; KDE/4.4.5; amd64; ; )
References: <201102031922.p13JML8i055697@svn.freebsd.org>
	
	<4D4C45C9.4080105@freebsd.org>
In-Reply-To: <4D4C45C9.4080105@freebsd.org>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <201102041356.39777.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6
	(bigwig.baldwin.cx); Fri, 04 Feb 2011 13:56:51 -0500 (EST)
X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=0.5 required=4.2 tests=BAYES_00,MAY_BE_FORGED,
	RDNS_DYNAMIC autolearn=no version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, Randall Stewart ,
	svn-src-all@freebsd.org, src-committers@freebsd.org,
	Robert Watson 
Subject: Re: svn commit: r218232 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 18:56:53 -0000

On Friday, February 04, 2011 1:30:33 pm Julian Elischer wrote:
> On 2/4/11 9:38 AM, Robert Watson wrote:
> >
> > On Thu, 3 Feb 2011, John Baldwin wrote:
> >
> >>>   1) Move per John Baldwin to mp_maxid
> >>>   2) Some signed/unsigned errors found by Mac OS compiler (from 
> >>> Michael)
> >>>   3) a couple of copyright updates on the effected files.
> >>
> >> Note that mp_maxid is the maxium valid ID, so you typically have to 
> >> do things like:
> >>
> >>     for (i = 0; i <= mp_maxid; i++) {
> >>         if (CPU_ABSENT(i))
> >>             continue;
> >>         ...
> >>     }
> >>
> >> There is a CPU_FOREACH() macro that does the above (but assumes you 
> >> want to skip over non-existent CPUs).
> >
> > I'm finding the network stack requires quite a bit more along these 
> > lines, btw.  I'd love also to have:
> >
> >   PACKAGE_FOREACH()
> >   CORE_FOREACH()
> >   HWTHREAD_FOREACH()
> >
> 
> I agree, which is why I usually support adding such iterators though 
> some people scream about them.
> (e.g. FOREACH_THREAD_IN_PROC and there is one for iterating through 
> vnets too.)

The difference here is that FOREACH_THREAD_IN_PROC() is just a
TAILQ_FOREACH().  The CPU iterators are more complex.

I agree that that we should have topology-aware iterators, though part of the 
problem is what do you iterate?  We'd have to create new sets of package and 
core IDs.

For HWTHREAD_FOREACH() you can already use CPU_FOREACH().

-- 
John Baldwin

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 19:06:45 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6A449106564A;
	Fri,  4 Feb 2011 19:06:45 +0000 (UTC)
	(envelope-from rwatson@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 41DBD8FC12;
	Fri,  4 Feb 2011 19:06:45 +0000 (UTC)
Received: from [10.255.240.234] (192-5-67-11.sri.com [192.5.67.11])
	by cyrus.watson.org (Postfix) with ESMTPSA id 5F85946B06;
	Fri,  4 Feb 2011 14:06:44 -0500 (EST)
Mime-Version: 1.0 (Apple Message framework v1082)
Content-Type: text/plain; charset=us-ascii
From: "Robert N. M. Watson" 
In-Reply-To: <201102041356.39777.jhb@freebsd.org>
Date: Fri, 4 Feb 2011 11:06:41 -0800
Content-Transfer-Encoding: quoted-printable
Message-Id: <58E18E40-3670-429A-A8D9-0A1C65E99CC5@freebsd.org>
References: <201102031922.p13JML8i055697@svn.freebsd.org>
	
	<4D4C45C9.4080105@freebsd.org> <201102041356.39777.jhb@freebsd.org>
To: John Baldwin 
X-Mailer: Apple Mail (2.1082)
Cc: svn-src-head@freebsd.org, Randall Stewart ,
	svn-src-all@freebsd.org, src-committers@freebsd.org,
	Julian Elischer 
Subject: Re: svn commit: r218232 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 19:06:45 -0000


On 4 Feb 2011, at 10:56, John Baldwin wrote:

> The difference here is that FOREACH_THREAD_IN_PROC() is just a
> TAILQ_FOREACH().  The CPU iterators are more complex.
>=20
> I agree that that we should have topology-aware iterators, though part =
of the=20
> problem is what do you iterate?  We'd have to create new sets of =
package and=20
> core IDs.
>=20
> For HWTHREAD_FOREACH() you can already use CPU_FOREACH().

Yeah, I have no real opinion on spelling at all. Rather, I'm of the =
opinion that we need some more semantics in order to express useful =
concepts, and make it easy to represent things like "one X per package", =
and "find me the closest X to which I wish to enqueue this request".

Robert=

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 19:49:03 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 29117106564A;
	Fri,  4 Feb 2011 19:49:03 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F237D8FC13;
	Fri,  4 Feb 2011 19:49:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14Jn2Aj095715;
	Fri, 4 Feb 2011 19:49:02 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14Jn20Y095713;
	Fri, 4 Feb 2011 19:49:02 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <201102041949.p14Jn20Y095713@svn.freebsd.org>
From: Jung-uk Kim 
Date: Fri, 4 Feb 2011 19:49:02 +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: r218293 - head/usr.sbin/pw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 19:49:03 -0000

Author: jkim
Date: Fri Feb  4 19:49:02 2011
New Revision: 218293
URL: http://svn.freebsd.org/changeset/base/218293

Log:
  Do not let pw.conf(5) or -M option affect creation of basehome, e.g., /home.
  When the basehome does not exist, it creates all intermediate directories as
  required, which is logically equivalent to mkdir(1) with -m and -p options.
  However, it modifies all intermediate directories, not just the final home
  directory unlike mkdir.  This problem was introduced in two revisions, i.e.,
  r1.59 (SVN r167919) and r1.60 (SVN r168044).
  
  MFC after:	1 month

Modified:
  head/usr.sbin/pw/pw_user.c

Modified: head/usr.sbin/pw/pw_user.c
==============================================================================
--- head/usr.sbin/pw/pw_user.c	Fri Feb  4 19:27:59 2011	(r218292)
+++ head/usr.sbin/pw/pw_user.c	Fri Feb  4 19:49:02 2011	(r218293)
@@ -151,14 +151,14 @@ pw_user(struct userconf * cnf, int mode,
 		cnf->home = arg->val;
 	}
 
+	dmode = S_IRWXU | S_IRWXG | S_IRWXO;
 	if ((arg = getarg(args, 'M')) != NULL) {
 		dmode_c = arg->val;
 		if ((set = setmode(dmode_c)) == NULL)
 			errx(EX_DATAERR, "invalid directory creation mode '%s'",
 			    dmode_c);
-		dmode = getmode(set, S_IRWXU | S_IRWXG | S_IRWXO);
+		cnf->homemode = getmode(set, dmode);
 		free(set);
-		cnf->homemode = dmode;
 	}
 
 	/*
@@ -186,7 +186,7 @@ pw_user(struct userconf * cnf, int mode,
 			if (strchr(cnf->home+1, '/') == NULL) {
 				strcpy(dbuf, "/usr");
 				strncat(dbuf, cnf->home, MAXPATHLEN-5);
-				if (mkdir(dbuf, cnf->homemode) != -1 || errno == EEXIST) {
+				if (mkdir(dbuf, dmode) != -1 || errno == EEXIST) {
 					chown(dbuf, 0, 0);
 					/*
 					 * Skip first "/" and create symlink:
@@ -202,7 +202,7 @@ pw_user(struct userconf * cnf, int mode,
 				while ((p = strchr(++p, '/')) != NULL) {
 					*p = '\0';
 					if (stat(dbuf, &st) == -1) {
-						if (mkdir(dbuf, cnf->homemode) == -1)
+						if (mkdir(dbuf, dmode) == -1)
 							goto direrr;
 						chown(dbuf, 0, 0);
 					} else if (!S_ISDIR(st.st_mode))
@@ -211,7 +211,7 @@ pw_user(struct userconf * cnf, int mode,
 				}
 			}
 			if (stat(dbuf, &st) == -1) {
-				if (mkdir(dbuf, cnf->homemode) == -1) {
+				if (mkdir(dbuf, dmode) == -1) {
 				direrr:	err(EX_OSFILE, "mkdir '%s'", dbuf);
 				}
 				chown(dbuf, 0, 0);

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 21:01:42 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BE24E106566B;
	Fri,  4 Feb 2011 21:01:42 +0000 (UTC)
	(envelope-from marius@alchemy.franken.de)
Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214])
	by mx1.freebsd.org (Postfix) with ESMTP id 4C7C28FC0A;
	Fri,  4 Feb 2011 21:01:41 +0000 (UTC)
Received: from alchemy.franken.de (localhost [127.0.0.1])
	by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id
	p14L1eqG079908; Fri, 4 Feb 2011 22:01:40 +0100 (CET)
	(envelope-from marius@alchemy.franken.de)
Received: (from marius@localhost)
	by alchemy.franken.de (8.14.4/8.14.4/Submit) id p14L1efT079907;
	Fri, 4 Feb 2011 22:01:40 +0100 (CET) (envelope-from marius)
Date: Fri, 4 Feb 2011 22:01:40 +0100
From: Marius Strobl 
To: Martin Matuska 
Message-ID: <20110204210140.GA10347@alchemy.franken.de>
References: <201102011028.p11AS5og068513@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201102011028.p11AS5og068513@svn.freebsd.org>
User-Agent: Mutt/1.4.2.3i
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218166 - head/lib/liblzma
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 21:01:42 -0000

On Tue, Feb 01, 2011 at 10:28:05AM +0000, Martin Matuska wrote:
> Author: mm
> Date: Tue Feb  1 10:28:05 2011
> New Revision: 218166
> URL: http://svn.freebsd.org/changeset/base/218166
> 
> Log:
>   Reintroduce bugfix from r210103 and fix xz on strong-aligned architectures.
>   This fix was accidentially reverted with the 5.0.0 update in r215187.
>   
>   PR:		bin/154310
>   Submitted by:	Michael Moll 
>   MFC after:	3 days
> 

Could you please try to get this into 8.2?

Thanks,
Marius


From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 21:04:00 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 726D11065673;
	Fri,  4 Feb 2011 21:04:00 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5B8388FC14;
	Fri,  4 Feb 2011 21:04:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14L40ce098214;
	Fri, 4 Feb 2011 21:04:00 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14L40gg098210;
	Fri, 4 Feb 2011 21:04:00 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201102042104.p14L40gg098210@svn.freebsd.org>
From: Konstantin Belousov 
Date: Fri, 4 Feb 2011 21:04:00 +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: r218303 - in head/lib/libc: amd64/string i386/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 21:04:00 -0000

Author: kib
Date: Fri Feb  4 21:04:00 2011
New Revision: 218303
URL: http://svn.freebsd.org/changeset/base/218303

Log:
  Remove duplicate .note.GNU-stack section declaration. bcopy already
  made the neccessary provisions.
  
  Reported by:	arundel

Modified:
  head/lib/libc/amd64/string/memmove.S
  head/lib/libc/i386/string/memcpy.S
  head/lib/libc/i386/string/memmove.S

Modified: head/lib/libc/amd64/string/memmove.S
==============================================================================
--- head/lib/libc/amd64/string/memmove.S	Fri Feb  4 20:59:45 2011	(r218302)
+++ head/lib/libc/amd64/string/memmove.S	Fri Feb  4 21:04:00 2011	(r218303)
@@ -3,5 +3,3 @@
 
 #define MEMMOVE
 #include "bcopy.S"
-
-	.section .note.GNU-stack,"",%progbist

Modified: head/lib/libc/i386/string/memcpy.S
==============================================================================
--- head/lib/libc/i386/string/memcpy.S	Fri Feb  4 20:59:45 2011	(r218302)
+++ head/lib/libc/i386/string/memcpy.S	Fri Feb  4 21:04:00 2011	(r218303)
@@ -3,5 +3,3 @@ __FBSDID("$FreeBSD$");
 
 #define MEMCOPY
 #include "bcopy.S"
-
-	.section .note.GNU-stack,"",%progbits

Modified: head/lib/libc/i386/string/memmove.S
==============================================================================
--- head/lib/libc/i386/string/memmove.S	Fri Feb  4 20:59:45 2011	(r218302)
+++ head/lib/libc/i386/string/memmove.S	Fri Feb  4 21:04:00 2011	(r218303)
@@ -3,5 +3,3 @@ __FBSDID("$FreeBSD$");
 
 #define MEMMOVE
 #include "bcopy.S"
-
-	.section .note.GNU-stack,"",%progbits

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 21:30:28 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A7C8710656A8;
	Fri,  4 Feb 2011 21:30:28 +0000 (UTC)
	(envelope-from tuexen@fh-muenster.de)
Received: from mail-n.franken.de (drew.ipv6.franken.de
	[IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa])
	by mx1.freebsd.org (Postfix) with ESMTP id BF4838FC20;
	Fri,  4 Feb 2011 21:30:26 +0000 (UTC)
Received: from [192.168.1.113] (p508FA367.dip.t-dialin.net [80.143.163.103])
	(Authenticated sender: macmic)
	by mail-n.franken.de (Postfix) with ESMTP id D68901C0C0BD8;
	Fri,  4 Feb 2011 22:30:23 +0100 (CET)
Mime-Version: 1.0 (Apple Message framework v1082)
Content-Type: text/plain; charset=us-ascii
From: Michael Tuexen 
In-Reply-To: 
Date: Fri, 4 Feb 2011 22:30:22 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: 
References: <201102031005.p13A5Vwi040803@svn.freebsd.org>
	
To: Robert Watson 
X-Mailer: Apple Mail (2.1082)
Cc: svn-src-head@freebsd.org, Randall Stewart ,
	svn-src-all@freebsd.org, src-committers@freebsd.org
Subject: Re: svn commit: r218211 - in head/sys: conf netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 21:30:28 -0000

On Feb 4, 2011, at 7:40 AM, Robert Watson wrote:

>=20
> On Thu, 3 Feb 2011, Randall Stewart wrote:
>=20
>> Author: rrs
>> Date: Thu Feb  3 10:05:30 2011
>> New Revision: 218211
>> URL: http://svn.freebsd.org/changeset/base/218211
>>=20
>> Log:
>> Adds an experimental option to create a pool of
>> threads. These serve as input threads and are queued
>> packets based on the V-tag number. This is similar to
>> what a modern card can do with queue's for TCP... but
>> alas modern cards know nothing about SCTP.
>=20
> Hmm.  It might be better to add a new NETISR_SCTP and use netisr's =
support for multithreading?
That sounds really good.

Is it possible that different network cards put packets in the same =
queue?
That would be helpful in the case of SCTP.
>=20
> (I'm preparing a patch for review that enhances that a bit so that =
protocols can be a bit more expressive in terms of specifying dispatch =
policy, etc, currently).
Great!

Best regards
Michael
>=20
> Robert
>=20
>=20
>>=20
>> MFC after:	3 months (maybe)
>>=20
>> Modified:
>> head/sys/conf/options
>> head/sys/netinet/sctp_bsd_addr.c
>> head/sys/netinet/sctp_constants.h
>> head/sys/netinet/sctp_input.c
>> head/sys/netinet/sctp_lock_bsd.h
>> head/sys/netinet/sctp_os_bsd.h
>> head/sys/netinet/sctp_pcb.c
>> head/sys/netinet/sctp_pcb.h
>> head/sys/netinet/sctp_structs.h
>>=20
>> Modified: head/sys/conf/options
>> =
=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/conf/options	Thu Feb  3 08:55:45 2011	=
(r218210)
>> +++ head/sys/conf/options	Thu Feb  3 10:05:30 2011	=
(r218211)
>> @@ -439,6 +439,7 @@ SCTP_PACKET_LOGGING	opt_sctp.h # Log to
>> SCTP_LTRACE_CHUNKS	opt_sctp.h # Log to KTR chunks processed
>> SCTP_LTRACE_ERRORS	opt_sctp.h # Log to KTR error returns.
>> SCTP_USE_PERCPU_STAT    opt_sctp.h # Use per cpu stats.
>> +SCTP_MCORE_INPUT        opt_sctp.h # Have multiple input threads for =
input mbufs
>> #
>> #
>> #
>>=20
>> Modified: head/sys/netinet/sctp_bsd_addr.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/netinet/sctp_bsd_addr.c	Thu Feb  3 08:55:45 2011	=
(r218210)
>> +++ head/sys/netinet/sctp_bsd_addr.c	Thu Feb  3 10:05:30 2011	=
(r218211)
>> @@ -68,6 +68,7 @@ MALLOC_DEFINE(SCTP_M_TIMW, "sctp_timw",
>> MALLOC_DEFINE(SCTP_M_MVRF, "sctp_mvrf", "sctp mvrf pcb list");
>> MALLOC_DEFINE(SCTP_M_ITER, "sctp_iter", "sctp iterator control");
>> MALLOC_DEFINE(SCTP_M_SOCKOPT, "sctp_socko", "sctp socket option");
>> +MALLOC_DEFINE(SCTP_M_MCORE, "sctp_mcore", "sctp mcore queue");
>>=20
>> /* Global NON-VNET structure that controls the iterator */
>> struct iterator_control sctp_it_ctl;
>>=20
>> Modified: head/sys/netinet/sctp_constants.h
>> =
=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/netinet/sctp_constants.h	Thu Feb  3 08:55:45 2011	=
(r218210)
>> +++ head/sys/netinet/sctp_constants.h	Thu Feb  3 10:05:30 2011	=
(r218211)
>> @@ -91,6 +91,8 @@ __FBSDID("$FreeBSD$");
>> #define SCTP_KTRHEAD_NAME "sctp_iterator"
>> #define SCTP_KTHREAD_PAGES 0
>>=20
>> +#define SCTP_MCORE_NAME "sctp_core_worker"
>> +
>>=20
>> /* If you support Multi-VRF how big to
>> * make the initial array of VRF's to.
>>=20
>> Modified: head/sys/netinet/sctp_input.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/netinet/sctp_input.c	Thu Feb  3 08:55:45 2011	=
(r218210)
>> +++ head/sys/netinet/sctp_input.c	Thu Feb  3 10:05:30 2011	=
(r218211)
>> @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
>> #include 
>> #include 
>> #include 
>> +#include 
>>=20
>>=20
>>=20
>> @@ -5921,10 +5922,32 @@ bad:
>> 	}
>> 	return;
>> }
>> +
>> +
>> void
>> -sctp_input(i_pak, off)
>> -	struct mbuf *i_pak;
>> -	int off;
>> +sctp_input(struct mbuf *m, int off)
>> {
>> -	sctp_input_with_port(i_pak, off, 0);
>> +#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && =
defined(SMP)
>> +	struct ip *ip;
>> +	struct sctphdr *sh;
>> +	int offset;
>> +	int cpu_to_use;
>> +
>> +	if (mp_ncpus > 1) {
>> +		ip =3D mtod(m, struct ip *);
>> +		offset =3D off + sizeof(*sh);
>> +		if (SCTP_BUF_LEN(m) < offset) {
>> +			if ((m =3D m_pullup(m, offset)) =3D=3D 0) {
>> +				SCTP_STAT_INCR(sctps_hdrops);
>> +				return;
>> +			}
>> +			ip =3D mtod(m, struct ip *);
>> +		}
>> +		sh =3D (struct sctphdr *)((caddr_t)ip + off);
>> +		cpu_to_use =3D ntohl(sh->v_tag) % mp_ncpus;
>> +		sctp_queue_to_mcore(m, off, cpu_to_use);
>> +		return;
>> +	}
>> +#endif
>> +	sctp_input_with_port(m, off, 0);
>> }
>>=20
>> Modified: head/sys/netinet/sctp_lock_bsd.h
>> =
=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/netinet/sctp_lock_bsd.h	Thu Feb  3 08:55:45 2011	=
(r218210)
>> +++ head/sys/netinet/sctp_lock_bsd.h	Thu Feb  3 10:05:30 2011	=
(r218211)
>> @@ -97,6 +97,48 @@ extern int sctp_logoff_stuff;
>>             rw_rlock(&SCTP_BASE_INFO(ipi_ep_mtx));                    =
     \
>> } while (0)
>>=20
>> +#define SCTP_MCORE_QLOCK_INIT(cpstr) do { \
>> +		mtx_init(&(cpstr)->que_mtx,	      \
>> +			 "sctp-mcore_queue","queue_lock",	\
>> +			 MTX_DEF|MTX_DUPOK);		\
>> +} while (0)
>> +
>> +#define SCTP_MCORE_QLOCK(cpstr)  do { \
>> +		mtx_lock(&(cpstr)->que_mtx);	\
>> +} while (0)
>> +
>> +#define SCTP_MCORE_QUNLOCK(cpstr)  do { \
>> +		mtx_unlock(&(cpstr)->que_mtx);	\
>> +} while (0)
>> +
>> +#define SCTP_MCORE_QDESTROY(cpstr)  do { \
>> +	if(mtx_owned(&(cpstr)->core_mtx)) {	\
>> +		mtx_unlock(&(cpstr)->que_mtx);	\
>> +        } \
>> +	mtx_destroy(&(cpstr)->que_mtx);	\
>> +} while (0)
>> +
>> +
>> +#define SCTP_MCORE_LOCK_INIT(cpstr) do { \
>> +		mtx_init(&(cpstr)->core_mtx,	      \
>> +			 "sctp-cpulck","cpu_proc_lock",	\
>> +			 MTX_DEF|MTX_DUPOK);		\
>> +} while (0)
>> +
>> +#define SCTP_MCORE_LOCK(cpstr)  do { \
>> +		mtx_lock(&(cpstr)->core_mtx);	\
>> +} while (0)
>> +
>> +#define SCTP_MCORE_UNLOCK(cpstr)  do { \
>> +		mtx_unlock(&(cpstr)->core_mtx);	\
>> +} while (0)
>> +
>> +#define SCTP_MCORE_DESTROY(cpstr)  do { \
>> +	if(mtx_owned(&(cpstr)->core_mtx)) {	\
>> +		mtx_unlock(&(cpstr)->core_mtx);	\
>> +        } \
>> +	mtx_destroy(&(cpstr)->core_mtx);	\
>> +} while (0)
>>=20
>> #define SCTP_INP_INFO_WLOCK()	do { 					=
\
>>            rw_wlock(&SCTP_BASE_INFO(ipi_ep_mtx));                     =
    \
>>=20
>> Modified: head/sys/netinet/sctp_os_bsd.h
>> =
=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/netinet/sctp_os_bsd.h	Thu Feb  3 08:55:45 2011	=
(r218210)
>> +++ head/sys/netinet/sctp_os_bsd.h	Thu Feb  3 10:05:30 2011	=
(r218211)
>> @@ -123,6 +123,7 @@ MALLOC_DECLARE(SCTP_M_TIMW);
>> MALLOC_DECLARE(SCTP_M_MVRF);
>> MALLOC_DECLARE(SCTP_M_ITER);
>> MALLOC_DECLARE(SCTP_M_SOCKOPT);
>> +MALLOC_DECLARE(SCTP_M_MCORE);
>>=20
>> #if defined(SCTP_LOCAL_TRACE_BUF)
>>=20
>>=20
>> Modified: head/sys/netinet/sctp_pcb.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/netinet/sctp_pcb.c	Thu Feb  3 08:55:45 2011	=
(r218210)
>> +++ head/sys/netinet/sctp_pcb.c	Thu Feb  3 10:05:30 2011	=
(r218211)
>> @@ -47,6 +47,9 @@ __FBSDID("$FreeBSD$");
>> #include 
>> #include 
>> #include 
>> +#include 
>> +#include 
>> +#include 
>>=20
>>=20
>> VNET_DEFINE(struct sctp_base_info, system_base_info);
>> @@ -5435,6 +5438,148 @@ sctp_del_local_addr_restricted(struct sc
>> static int sctp_max_number_of_assoc =3D SCTP_MAX_NUM_OF_ASOC;
>> static int sctp_scale_up_for_address =3D SCTP_SCALE_FOR_ADDR;
>>=20
>> +
>> +
>> +#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && =
defined(SMP)
>> +struct sctp_mcore_ctrl *sctp_mcore_workers =3D NULL;
>> +
>> +void
>> +sctp_queue_to_mcore(struct mbuf *m, int off, int cpu_to_use)
>> +{
>> +	/* Queue a packet to a processor for the specified core */
>> +	struct sctp_mcore_queue *qent;
>> +	struct sctp_mcore_ctrl *wkq;
>> +	int need_wake =3D 0;
>> +
>> +	if (sctp_mcore_workers =3D=3D NULL) {
>> +		/* Something went way bad during setup */
>> +		sctp_input_with_port(m, off, 0);
>> +		return;
>> +	}
>> +	SCTP_MALLOC(qent, struct sctp_mcore_queue *,
>> +	    (sizeof(struct sctp_mcore_queue)),
>> +	    SCTP_M_MCORE);
>> +	if (qent =3D=3D NULL) {
>> +		/* This is trouble  */
>> +		sctp_input_with_port(m, off, 0);
>> +		return;
>> +	}
>> +	qent->vn =3D curvnet;
>> +	qent->m =3D m;
>> +	qent->off =3D off;
>> +	qent->v6 =3D 0;
>> +	wkq =3D &sctp_mcore_workers[cpu_to_use];
>> +	SCTP_MCORE_QLOCK(wkq);
>> +
>> +	TAILQ_INSERT_TAIL(&wkq->que, qent, next);
>> +	if (wkq->running =3D=3D 0) {
>> +		need_wake =3D 1;
>> +	}
>> +	SCTP_MCORE_QUNLOCK(wkq);
>> +	if (need_wake) {
>> +		wakeup(&wkq->running);
>> +	}
>> +}
>> +
>> +static void
>> +sctp_mcore_thread(void *arg)
>> +{
>> +
>> +	struct sctp_mcore_ctrl *wkq;
>> +	struct sctp_mcore_queue *qent;
>> +
>> +	wkq =3D (struct sctp_mcore_ctrl *)arg;
>> +	struct mbuf *m;
>> +	int off, v6;
>> +
>> +	/* Wait for first tickle */
>> +	SCTP_MCORE_LOCK(wkq);
>> +	wkq->running =3D 0;
>> +	msleep(&wkq->running,
>> +	    &wkq->core_mtx,
>> +	    0, "wait for pkt", 0);
>> +	SCTP_MCORE_UNLOCK(wkq);
>> +
>> +	/* Bind to our cpu */
>> +	thread_lock(curthread);
>> +	sched_bind(curthread, wkq->cpuid);
>> +	thread_unlock(curthread);
>> +
>> +	/* Now lets start working */
>> +	SCTP_MCORE_LOCK(wkq);
>> +	/* Now grab lock and go */
>> +	while (1) {
>> +		SCTP_MCORE_QLOCK(wkq);
>> +skip_sleep:
>> +		wkq->running =3D 1;
>> +		qent =3D TAILQ_FIRST(&wkq->que);
>> +		if (qent) {
>> +			TAILQ_REMOVE(&wkq->que, qent, next);
>> +			SCTP_MCORE_QUNLOCK(wkq);
>> +			CURVNET_SET(qent->vn);
>> +			m =3D qent->m;
>> +			off =3D qent->off;
>> +			v6 =3D qent->v6;
>> +			SCTP_FREE(qent, SCTP_M_MCORE);
>> +			if (v6 =3D=3D 0) {
>> +				sctp_input_with_port(m, off, 0);
>> +			} else {
>> +				printf("V6 not yet supported\n");
>> +				sctp_m_freem(m);
>> +			}
>> +			CURVNET_RESTORE();
>> +			SCTP_MCORE_QLOCK(wkq);
>> +		}
>> +		wkq->running =3D 0;
>> +		if (!TAILQ_EMPTY(&wkq->que)) {
>> +			goto skip_sleep;
>> +		}
>> +		SCTP_MCORE_QUNLOCK(wkq);
>> +		msleep(&wkq->running,
>> +		    &wkq->core_mtx,
>> +		    0, "wait for pkt", 0);
>> +	};
>> +}
>> +
>> +static void
>> +sctp_startup_mcore_threads(void)
>> +{
>> +	int i;
>> +
>> +	if (mp_ncpus =3D=3D 1)
>> +		return;
>> +
>> +	SCTP_MALLOC(sctp_mcore_workers, struct sctp_mcore_ctrl *,
>> +	    (mp_ncpus * sizeof(struct sctp_mcore_ctrl)),
>> +	    SCTP_M_MCORE);
>> +	if (sctp_mcore_workers =3D=3D NULL) {
>> +		/* TSNH I hope */
>> +		return;
>> +	}
>> +	memset(sctp_mcore_workers, 0, (mp_ncpus *
>> +	    sizeof(struct sctp_mcore_ctrl)));
>> +	/* Init the structures */
>> +	for (i =3D 0; i < mp_ncpus; i++) {
>> +		TAILQ_INIT(&sctp_mcore_workers[i].que);
>> +		SCTP_MCORE_LOCK_INIT(&sctp_mcore_workers[i]);
>> +		SCTP_MCORE_QLOCK_INIT(&sctp_mcore_workers[i]);
>> +		sctp_mcore_workers[i].cpuid =3D i;
>> +	}
>> +	/* Now start them all */
>> +	for (i =3D 0; i < mp_ncpus; i++) {
>> +		(void)kproc_create(sctp_mcore_thread,
>> +		    (void *)&sctp_mcore_workers[i],
>> +		    &sctp_mcore_workers[i].thread_proc,
>> +		    RFPROC,
>> +		    SCTP_KTHREAD_PAGES,
>> +		    SCTP_MCORE_NAME);
>> +
>> +	}
>> +}
>> +
>> +#endif
>> +
>> +
>> void
>> sctp_pcb_init()
>> {
>> @@ -5565,6 +5710,10 @@ sctp_pcb_init()
>>=20
>> 	sctp_startup_iterator();
>>=20
>> +#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && =
defined(SMP)
>> +	sctp_startup_mcore_threads();
>> +#endif
>> +
>> 	/*
>> 	 * INIT the default VRF which for BSD is the only one, other =
O/S's
>> 	 * may have more. But initially they must start with one and =
then
>>=20
>> Modified: head/sys/netinet/sctp_pcb.h
>> =
=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/netinet/sctp_pcb.h	Thu Feb  3 08:55:45 2011	=
(r218210)
>> +++ head/sys/netinet/sctp_pcb.h	Thu Feb  3 10:05:30 2011	=
(r218211)
>> @@ -624,6 +624,12 @@ sctp_initiate_iterator(inp_func inpf,
>>    struct sctp_inpcb *,
>>    uint8_t co_off);
>>=20
>> +#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && =
defined(SMP)
>> +void
>> +     sctp_queue_to_mcore(struct mbuf *m, int off, int cpu_to_use);
>> +
>> +#endif
>> +
>> #ifdef INVARIANTS
>> void
>>     sctp_validate_no_locks(struct sctp_inpcb *inp);
>>=20
>> Modified: head/sys/netinet/sctp_structs.h
>> =
=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/netinet/sctp_structs.h	Thu Feb  3 08:55:45 2011	=
(r218210)
>> +++ head/sys/netinet/sctp_structs.h	Thu Feb  3 10:05:30 2011	=
(r218211)
>> @@ -106,6 +106,31 @@ typedef void (*asoc_func) (struct sctp_i
>> typedef int (*inp_func) (struct sctp_inpcb *, void *ptr, uint32_t =
val);
>> typedef void (*end_func) (void *ptr, uint32_t val);
>>=20
>> +#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && =
defined(SMP)
>> +/* whats on the mcore control struct */
>> +struct sctp_mcore_queue {
>> +	TAILQ_ENTRY(sctp_mcore_queue) next;
>> +	struct vnet *vn;
>> +	struct mbuf *m;
>> +	int off;
>> +	int v6;
>> +};
>> +
>> +TAILQ_HEAD(sctp_mcore_qhead, sctp_mcore_queue);
>> +
>> +struct sctp_mcore_ctrl {
>> +	SCTP_PROCESS_STRUCT thread_proc;
>> +	struct sctp_mcore_qhead que;
>> +	struct mtx core_mtx;
>> +	struct mtx que_mtx;
>> +	int running;
>> +	int cpuid;
>> +};
>> +
>> +
>> +#endif
>> +
>> +
>> struct sctp_iterator {
>> 	TAILQ_ENTRY(sctp_iterator) sctp_nxt_itr;
>> 	struct vnet *vn;
>>=20
>=20


From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 21:30:47 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: by hub.freebsd.org (Postfix, from userid 1233)
	id 53DC510656AA; Fri,  4 Feb 2011 21:30:47 +0000 (UTC)
Date: Fri, 4 Feb 2011 21:30:47 +0000
From: Alexander Best 
To: Konstantin Belousov 
Message-ID: <20110204213047.GA36268@freebsd.org>
References: <201102042104.p14L40gg098210@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201102042104.p14L40gg098210@svn.freebsd.org>
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r218303 - in head/lib/libc: amd64/string i386/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 21:30:47 -0000

On Fri Feb  4 11, Konstantin Belousov wrote:
> Author: kib
> Date: Fri Feb  4 21:04:00 2011
> New Revision: 218303
> URL: http://svn.freebsd.org/changeset/base/218303
> 
> Log:
>   Remove duplicate .note.GNU-stack section declaration. bcopy already
>   made the neccessary provisions.

...and some more in
lib/msun/amd64/s_llrint.S
lib/msun/amd64/s_llrintf.S

due to the inclusion of s_lrintf.S

>   
>   Reported by:	arundel
> 
> Modified:
>   head/lib/libc/amd64/string/memmove.S
>   head/lib/libc/i386/string/memcpy.S
>   head/lib/libc/i386/string/memmove.S
> 
> Modified: head/lib/libc/amd64/string/memmove.S
> ==============================================================================
> --- head/lib/libc/amd64/string/memmove.S	Fri Feb  4 20:59:45 2011	(r218302)
> +++ head/lib/libc/amd64/string/memmove.S	Fri Feb  4 21:04:00 2011	(r218303)
> @@ -3,5 +3,3 @@
>  
>  #define MEMMOVE
>  #include "bcopy.S"
> -
> -	.section .note.GNU-stack,"",%progbist
> 
> Modified: head/lib/libc/i386/string/memcpy.S
> ==============================================================================
> --- head/lib/libc/i386/string/memcpy.S	Fri Feb  4 20:59:45 2011	(r218302)
> +++ head/lib/libc/i386/string/memcpy.S	Fri Feb  4 21:04:00 2011	(r218303)
> @@ -3,5 +3,3 @@ __FBSDID("$FreeBSD$");
>  
>  #define MEMCOPY
>  #include "bcopy.S"
> -
> -	.section .note.GNU-stack,"",%progbits
> 
> Modified: head/lib/libc/i386/string/memmove.S
> ==============================================================================
> --- head/lib/libc/i386/string/memmove.S	Fri Feb  4 20:59:45 2011	(r218302)
> +++ head/lib/libc/i386/string/memmove.S	Fri Feb  4 21:04:00 2011	(r218303)
> @@ -3,5 +3,3 @@ __FBSDID("$FreeBSD$");
>  
>  #define MEMMOVE
>  #include "bcopy.S"
> -
> -	.section .note.GNU-stack,"",%progbits

-- 
a13x

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 21:49:24 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A943A106566B;
	Fri,  4 Feb 2011 21:49:24 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7E90E8FC19;
	Fri,  4 Feb 2011 21:49:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14LnO52003267;
	Fri, 4 Feb 2011 21:49:24 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14LnOTS003264;
	Fri, 4 Feb 2011 21:49:24 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <201102042149.p14LnOTS003264@svn.freebsd.org>
From: Alan Cox 
Date: Fri, 4 Feb 2011 21:49:24 +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: r218304 - head/sys/vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 21:49:24 -0000

Author: alc
Date: Fri Feb  4 21:49:24 2011
New Revision: 218304
URL: http://svn.freebsd.org/changeset/base/218304

Log:
  Since the last parameter to vm_object_shadow() is a vm_size_t and not a
  vm_pindex_t, it makes no sense for its callers to perform atop().  Let
  vm_object_shadow() do that instead.

Modified:
  head/sys/vm/vm_map.c
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_map.c
==============================================================================
--- head/sys/vm/vm_map.c	Fri Feb  4 21:04:00 2011	(r218303)
+++ head/sys/vm/vm_map.c	Fri Feb  4 21:49:24 2011	(r218304)
@@ -3077,8 +3077,8 @@ vmspace_fork(struct vmspace *vm1, vm_oof
 			vm_object_reference(object);
 			if (old_entry->eflags & MAP_ENTRY_NEEDS_COPY) {
 				vm_object_shadow(&old_entry->object.vm_object,
-					&old_entry->offset,
-					atop(old_entry->end - old_entry->start));
+				    &old_entry->offset,
+				    old_entry->end - old_entry->start);
 				old_entry->eflags &= ~MAP_ENTRY_NEEDS_COPY;
 				/* Transfer the second reference too. */
 				vm_object_reference(
@@ -3589,8 +3589,8 @@ vm_map_lookup(vm_map_t *var_map,		/* IN/
 	vm_prot_t prot;
 	vm_prot_t fault_type = fault_typea;
 	vm_object_t eobject;
+	vm_size_t size;
 	struct ucred *cred;
-	vm_ooffset_t size;
 
 RetryLookup:;
 
@@ -3677,10 +3677,8 @@ RetryLookup:;
 				}
 				entry->cred = cred;
 			}
-			vm_object_shadow(
-			    &entry->object.vm_object,
-			    &entry->offset,
-			    atop(size));
+			vm_object_shadow(&entry->object.vm_object,
+			    &entry->offset, size);
 			entry->eflags &= ~MAP_ENTRY_NEEDS_COPY;
 			eobject = entry->object.vm_object;
 			if (eobject->cred != NULL) {

Modified: head/sys/vm/vm_object.c
==============================================================================
--- head/sys/vm/vm_object.c	Fri Feb  4 21:04:00 2011	(r218303)
+++ head/sys/vm/vm_object.c	Fri Feb  4 21:49:24 2011	(r218304)
@@ -1147,7 +1147,7 @@ vm_object_shadow(
 	/*
 	 * Allocate a new object with the given length.
 	 */
-	result = vm_object_allocate(OBJT_DEFAULT, length);
+	result = vm_object_allocate(OBJT_DEFAULT, atop(length));
 
 	/*
 	 * The new object shadows the source object, adding a reference to it.

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 21:54:06 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9198A106566B;
	Fri,  4 Feb 2011 21:54:06 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 812C08FC0A;
	Fri,  4 Feb 2011 21:54:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14Ls6rR003851;
	Fri, 4 Feb 2011 21:54:06 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14Ls6HG003848;
	Fri, 4 Feb 2011 21:54:06 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201102042154.p14Ls6HG003848@svn.freebsd.org>
From: Konstantin Belousov 
Date: Fri, 4 Feb 2011 21:54: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: r218305 - head/lib/msun/amd64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 21:54:06 -0000

Author: kib
Date: Fri Feb  4 21:54:06 2011
New Revision: 218305
URL: http://svn.freebsd.org/changeset/base/218305

Log:
  Remove duplicate .note.GNU-stack section declaration.
  
  Reported by:	arundel

Modified:
  head/lib/msun/amd64/s_llrint.S
  head/lib/msun/amd64/s_llrintf.S

Modified: head/lib/msun/amd64/s_llrint.S
==============================================================================
--- head/lib/msun/amd64/s_llrint.S	Fri Feb  4 21:49:24 2011	(r218304)
+++ head/lib/msun/amd64/s_llrint.S	Fri Feb  4 21:54:06 2011	(r218305)
@@ -4,5 +4,3 @@ __FBSDID("$FreeBSD$")
 /* sizeof(long) == sizeof(long long) */
 #define	fn	llrint
 #include "s_lrint.S"
-
-	.section .note.GNU-stack,"",%progbits

Modified: head/lib/msun/amd64/s_llrintf.S
==============================================================================
--- head/lib/msun/amd64/s_llrintf.S	Fri Feb  4 21:49:24 2011	(r218304)
+++ head/lib/msun/amd64/s_llrintf.S	Fri Feb  4 21:54:06 2011	(r218305)
@@ -4,5 +4,3 @@ __FBSDID("$FreeBSD$")
 /* sizeof(long) == sizeof(long long) */
 #define	fn	llrintf
 #include "s_lrintf.S"
-
-	.section .note.GNU-stack,"",%progbits

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 22:00:08 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6E3BA1065672;
	Fri,  4 Feb 2011 22:00:06 +0000 (UTC)
	(envelope-from rwatson@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 579918FC13;
	Fri,  4 Feb 2011 22:00:06 +0000 (UTC)
Received: from [10.255.240.234] (192-5-67-11.sri.com [192.5.67.11])
	by cyrus.watson.org (Postfix) with ESMTPSA id 7169846B03;
	Fri,  4 Feb 2011 17:00:05 -0500 (EST)
Mime-Version: 1.0 (Apple Message framework v1082)
Content-Type: text/plain; charset=us-ascii
From: "Robert N. M. Watson" 
In-Reply-To: 
Date: Fri, 4 Feb 2011 14:00:04 -0800
Content-Transfer-Encoding: quoted-printable
Message-Id: <1F9E5E6D-ADCA-4F43-B04D-54CCBD5AC2A8@freebsd.org>
References: <201102031005.p13A5Vwi040803@svn.freebsd.org>
	
	
To: Michael Tuexen 
X-Mailer: Apple Mail (2.1082)
Cc: svn-src-head@freebsd.org, Randall Stewart ,
	svn-src-all@freebsd.org, src-committers@freebsd.org
Subject: Re: svn commit: r218211 - in head/sys: conf netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 22:00:09 -0000


On 4 Feb 2011, at 13:30, Michael Tuexen wrote:

>> Hmm.  It might be better to add a new NETISR_SCTP and use netisr's =
support for multithreading?
> That sounds really good.
>=20
> Is it possible that different network cards put packets in the same =
queue?
> That would be helpful in the case of SCTP.
>>=20
>> (I'm preparing a patch for review that enhances that a bit so that =
protocols can be a bit more expressive in terms of specifying dispatch =
policy, etc, currently).
> Great!

You get a spectrum of possibilities -- protocols can request source =
ordering (i.e., ifnet), flow ordering (in which they expose ordering =
information but not CPU affinity), or a full CPU affinity. How work is =
distributed and what queue it ends up in depends on the model, but yes, =
you can request that interfaces distribute packets to various queues, =
and that multiple interfaces use consistent distribution models. I =
implement this for RSS, where there's a global RSS setup that is =
propagated to supporting device drivers so that they can align their =
distribution with the network stack's affinity model for connection =
groups.

Robert


From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 22:07:52 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A9C631065670;
	Fri,  4 Feb 2011 22:07:52 +0000 (UTC)
	(envelope-from tuexen@fh-muenster.de)
Received: from mail-n.franken.de (drew.ipv6.franken.de
	[IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa])
	by mx1.freebsd.org (Postfix) with ESMTP id 09DB68FC08;
	Fri,  4 Feb 2011 22:07:52 +0000 (UTC)
Received: from [192.168.1.113] (p508FA367.dip.t-dialin.net [80.143.163.103])
	(Authenticated sender: macmic)
	by mail-n.franken.de (Postfix) with ESMTP id D059F1C0C0BD8;
	Fri,  4 Feb 2011 23:07:50 +0100 (CET)
Mime-Version: 1.0 (Apple Message framework v1082)
Content-Type: text/plain; charset=us-ascii
From: Michael Tuexen 
In-Reply-To: <1F9E5E6D-ADCA-4F43-B04D-54CCBD5AC2A8@freebsd.org>
Date: Fri, 4 Feb 2011 23:07:49 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <37716196-EE55-4D94-82BB-4DE19AAF34F2@fh-muenster.de>
References: <201102031005.p13A5Vwi040803@svn.freebsd.org>
	
	
	<1F9E5E6D-ADCA-4F43-B04D-54CCBD5AC2A8@freebsd.org>
To: "Robert N. M. Watson" 
X-Mailer: Apple Mail (2.1082)
Cc: svn-src-head@freebsd.org, Randall Stewart ,
	svn-src-all@freebsd.org, src-committers@freebsd.org
Subject: Re: svn commit: r218211 - in head/sys: conf netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 22:07:52 -0000

On Feb 4, 2011, at 11:00 PM, Robert N. M. Watson wrote:
>=20
> On 4 Feb 2011, at 13:30, Michael Tuexen wrote:
>=20
>>> Hmm.  It might be better to add a new NETISR_SCTP and use netisr's =
support for multithreading?
>> That sounds really good.
>>=20
>> Is it possible that different network cards put packets in the same =
queue?
>> That would be helpful in the case of SCTP.
>>>=20
>>> (I'm preparing a patch for review that enhances that a bit so that =
protocols can be a bit more expressive in terms of specifying dispatch =
policy, etc, currently).
>> Great!
>=20
> You get a spectrum of possibilities -- protocols can request source =
ordering (i.e., ifnet), flow ordering (in which they expose ordering =
information but not CPU affinity), or a full CPU affinity. How work is =
distributed and what queue it ends up in depends on the model, but yes, =
you can request that interfaces distribute packets to various queues, =
and that multiple interfaces use consistent distribution models. I =
implement this for RSS, where there's a global RSS setup that is =
propagated to supporting device drivers so that they can align their =
distribution with the network stack's affinity model for connection =
groups.
That sounds great. Let us know when the code is ready for testing...

Best regards
Michael
>=20
> Robert
>=20
>=20


From owner-svn-src-head@FreeBSD.ORG  Fri Feb  4 22:47:56 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 46CDF106566C;
	Fri,  4 Feb 2011 22:47:56 +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 34F648FC08;
	Fri,  4 Feb 2011 22:47:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p14Mluhd006621;
	Fri, 4 Feb 2011 22:47:56 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p14Mlum2006603;
	Fri, 4 Feb 2011 22:47:56 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201102042247.p14Mlum2006603@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Fri, 4 Feb 2011 22:47: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: r218306 - head/bin/sh
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Feb 2011 22:47:56 -0000

Author: jilles
Date: Fri Feb  4 22:47:55 2011
New Revision: 218306
URL: http://svn.freebsd.org/changeset/base/218306

Log:
  sh: Remove special code for shell scripts without magic number.
  
  These are called "shell procedures" in the source.
  
  If execve() failed with [ENOEXEC], the shell would reinitialize itself
  and execute the program as a script. This requires a fair amount of code
  which is not frequently used (most scripts have a #! magic number).
  Therefore just execute a new instance of sh (_PATH_BSHELL) to run the
  script.

Modified:
  head/bin/sh/TOUR
  head/bin/sh/alias.c
  head/bin/sh/alias.h
  head/bin/sh/error.h
  head/bin/sh/eval.c
  head/bin/sh/exec.c
  head/bin/sh/exec.h
  head/bin/sh/init.h
  head/bin/sh/input.c
  head/bin/sh/jobs.c
  head/bin/sh/main.c
  head/bin/sh/mkinit.c
  head/bin/sh/options.c
  head/bin/sh/redir.c
  head/bin/sh/sh.1
  head/bin/sh/trap.c
  head/bin/sh/var.c

Modified: head/bin/sh/TOUR
==============================================================================
--- head/bin/sh/TOUR	Fri Feb  4 21:54:06 2011	(r218305)
+++ head/bin/sh/TOUR	Fri Feb  4 22:47:55 2011	(r218306)
@@ -44,10 +44,6 @@ C source files for entries looking like:
                            back to the main command loop */
         }
 
-        SHELLPROC {
-              x = 3;    /* executed when the shell runs a shell procedure */
-        }
-
 It pulls this code out into routines which are when particular
 events occur.  The intent is to improve modularity by isolating
 the information about which modules need to be explicitly
@@ -80,12 +76,7 @@ EXCEPTIONS:  Code for dealing with excep
 exceptions.c.  The C language doesn't include exception handling,
 so I implement it using setjmp and longjmp.  The global variable
 exception contains the type of exception.  EXERROR is raised by
-calling error.  EXINT is an interrupt.  EXSHELLPROC is an excep-
-tion which is raised when a shell procedure is invoked.  The pur-
-pose of EXSHELLPROC is to perform the cleanup actions associated
-with other exceptions.  After these cleanup actions, the shell
-can interpret a shell procedure itself without exec'ing a new
-copy of the shell.
+calling error.  EXINT is an interrupt.
 
 INTERRUPTS:  In an interactive shell, an interrupt will cause an
 EXINT exception to return to the main command loop.  (Exception:
@@ -270,14 +261,6 @@ When a program is run, the code in eval.
 variables which precede the command (as in "PATH=xxx command") in
 the variable table as the simplest way to strip duplicates, and
 then calls "environment" to get the value of the environment.
-There are two consequences of this.  First, if an assignment to
-PATH precedes the command, the value of PATH before the assign-
-ment must be remembered and passed to shellexec.  Second, if the
-program turns out to be a shell procedure, the strings from the
-environment variables which preceded the command must be pulled
-out of the table and replaced with strings obtained from malloc,
-since the former will automatically be freed when the stack (see
-the entry on memalloc.c) is emptied.
 
 BUILTIN COMMANDS:  The procedures for handling these are scat-
 tered throughout the code, depending on which location appears

Modified: head/bin/sh/alias.c
==============================================================================
--- head/bin/sh/alias.c	Fri Feb  4 21:54:06 2011	(r218305)
+++ head/bin/sh/alias.c	Fri Feb  4 22:47:55 2011	(r218306)
@@ -145,15 +145,7 @@ unalias(const char *name)
 	return (1);
 }
 
-#ifdef mkinit
-MKINIT void rmaliases(void);
-
-SHELLPROC {
-	rmaliases();
-}
-#endif
-
-void
+static void
 rmaliases(void)
 {
 	struct alias *ap, *tmp;

Modified: head/bin/sh/alias.h
==============================================================================
--- head/bin/sh/alias.h	Fri Feb  4 21:54:06 2011	(r218305)
+++ head/bin/sh/alias.h	Fri Feb  4 22:47:55 2011	(r218306)
@@ -45,4 +45,3 @@ struct alias {
 struct alias *lookupalias(const char *, int);
 int aliascmd(int, char **);
 int unaliascmd(int, char **);
-void rmaliases(void);

Modified: head/bin/sh/error.h
==============================================================================
--- head/bin/sh/error.h	Fri Feb  4 21:54:06 2011	(r218305)
+++ head/bin/sh/error.h	Fri Feb  4 22:47:55 2011	(r218306)
@@ -56,8 +56,7 @@ extern volatile sig_atomic_t exception;
 /* exceptions */
 #define EXINT 0		/* SIGINT received */
 #define EXERROR 1	/* a generic error */
-#define EXSHELLPROC 2	/* execute a shell procedure */
-#define EXEXEC 3	/* command execution failed */
+#define EXEXEC 2	/* command execution failed */
 
 
 /*

Modified: head/bin/sh/eval.c
==============================================================================
--- head/bin/sh/eval.c	Fri Feb  4 21:54:06 2011	(r218305)
+++ head/bin/sh/eval.c	Fri Feb  4 22:47:55 2011	(r218306)
@@ -111,10 +111,6 @@ RESET {
 	loopnest = 0;
 	funcnest = 0;
 }
-
-SHELLPROC {
-	exitstatus = 0;
-}
 #endif
 
 
@@ -732,7 +728,9 @@ evalcommand(union node *cmd, int flags, 
 	argc = 0;
 	for (sp = arglist.list ; sp ; sp = sp->next)
 		argc++;
-	argv = stalloc(sizeof (char *) * (argc + 1));
+	/* Add one slot at the beginning for tryexec(). */
+	argv = stalloc(sizeof (char *) * (argc + 2));
+	argv++;
 
 	for (sp = arglist.list ; sp ; sp = sp->next) {
 		TRACE(("evalcommand arg: %s\n", sp->text));
@@ -927,14 +925,10 @@ evalcommand(union node *cmd, int flags, 
 		reffunc(cmdentry.u.func);
 		savehandler = handler;
 		if (setjmp(jmploc.loc)) {
-			if (exception == EXSHELLPROC)
-				freeparam(&saveparam);
-			else {
-				freeparam(&shellparam);
-				shellparam = saveparam;
-				if (exception == EXERROR || exception == EXEXEC)
-					popredir();
-			}
+			freeparam(&shellparam);
+			shellparam = saveparam;
+			if (exception == EXERROR || exception == EXEXEC)
+				popredir();
 			unreffunc(cmdentry.u.func);
 			poplocalvars();
 			localvars = savelocalvars;
@@ -1016,11 +1010,9 @@ cmddone:
 		out2 = &errout;
 		freestdout();
 		handler = savehandler;
-		if (e != EXSHELLPROC) {
-			commandname = savecmdname;
-			if (jp)
-				exitshell(exitstatus);
-		}
+		commandname = savecmdname;
+		if (jp)
+			exitshell(exitstatus);
 		if (flags == EV_BACKCMD) {
 			backcmd->buf = memout.buf;
 			backcmd->nleft = memout.nextc - memout.buf;

Modified: head/bin/sh/exec.c
==============================================================================
--- head/bin/sh/exec.c	Fri Feb  4 21:54:06 2011	(r218305)
+++ head/bin/sh/exec.c	Fri Feb  4 22:47:55 2011	(r218306)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /*
@@ -105,6 +106,8 @@ static void delete_cmd_entry(void);
 /*
  * Exec a program.  Never returns.  If you change this routine, you may
  * have to change the find_command routine as well.
+ *
+ * The argv array may be changed and element argv[-1] should be writable.
  */
 
 void
@@ -147,12 +150,9 @@ tryexec(char *cmd, char **argv, char **e
 	execve(cmd, argv, envp);
 	e = errno;
 	if (e == ENOEXEC) {
-		initshellproc();
-		setinputfile(cmd, 0);
-		commandname = arg0 = savestr(argv[0]);
-		setparam(argv + 1);
-		exraise(EXSHELLPROC);
-		/*NOTREACHED*/
+		*argv = cmd;
+		*--argv = _PATH_BSHELL;
+		execve(_PATH_BSHELL, argv, envp);
 	}
 	errno = e;
 }
@@ -537,43 +537,6 @@ clearcmdentry(int firstchange)
 
 
 /*
- * Delete all functions.
- */
-
-#ifdef mkinit
-MKINIT void deletefuncs(void);
-
-SHELLPROC {
-	deletefuncs();
-}
-#endif
-
-void
-deletefuncs(void)
-{
-	struct tblentry **tblp;
-	struct tblentry **pp;
-	struct tblentry *cmdp;
-
-	INTOFF;
-	for (tblp = cmdtable ; tblp < &cmdtable[CMDTABLESIZE] ; tblp++) {
-		pp = tblp;
-		while ((cmdp = *pp) != NULL) {
-			if (cmdp->cmdtype == CMDFUNCTION) {
-				*pp = cmdp->next;
-				unreffunc(cmdp->param.func);
-				ckfree(cmdp);
-			} else {
-				pp = &cmdp->next;
-			}
-		}
-	}
-	INTON;
-}
-
-
-
-/*
  * Locate a command in the command hash table.  If "add" is nonzero,
  * add the command to the table if it is not already present.  The
  * variable "lastcmdentry" is set to point to the address of the link

Modified: head/bin/sh/exec.h
==============================================================================
--- head/bin/sh/exec.h	Fri Feb  4 21:54:06 2011	(r218305)
+++ head/bin/sh/exec.h	Fri Feb  4 22:47:55 2011	(r218306)
@@ -71,7 +71,6 @@ void find_command(const char *, struct c
 int find_builtin(const char *, int *);
 void hashcd(void);
 void changepath(const char *);
-void deletefuncs(void);
 void addcmdentry(const char *, struct cmdentry *);
 void defun(const char *, union node *);
 int unsetfunc(const char *);

Modified: head/bin/sh/init.h
==============================================================================
--- head/bin/sh/init.h	Fri Feb  4 21:54:06 2011	(r218305)
+++ head/bin/sh/init.h	Fri Feb  4 22:47:55 2011	(r218306)
@@ -35,4 +35,3 @@
 
 void init(void);
 void reset(void);
-void initshellproc(void);

Modified: head/bin/sh/input.c
==============================================================================
--- head/bin/sh/input.c	Fri Feb  4 21:54:06 2011	(r218305)
+++ head/bin/sh/input.c	Fri Feb  4 22:47:55 2011	(r218306)
@@ -119,12 +119,7 @@ INIT {
 
 RESET {
 	popallfiles();
-	if (exception != EXSHELLPROC)
-		parselleft = parsenleft = 0;	/* clear input buffer */
-}
-
-SHELLPROC {
-	popallfiles();
+	parselleft = parsenleft = 0;	/* clear input buffer */
 }
 #endif
 

Modified: head/bin/sh/jobs.c
==============================================================================
--- head/bin/sh/jobs.c	Fri Feb  4 21:54:06 2011	(r218305)
+++ head/bin/sh/jobs.c	Fri Feb  4 22:47:55 2011	(r218306)
@@ -177,22 +177,6 @@ out:				out2fmt_flush("sh: can't access 
 #endif
 
 
-#ifdef mkinit
-INCLUDE 
-INCLUDE 
-
-SHELLPROC {
-	backgndpid = -1;
-	bgjob = NULL;
-#if JOBS
-	jobctl = 0;
-#endif
-}
-
-#endif
-
-
-
 #if JOBS
 int
 fgcmd(int argc __unused, char **argv)

Modified: head/bin/sh/main.c
==============================================================================
--- head/bin/sh/main.c	Fri Feb  4 21:54:06 2011	(r218305)
+++ head/bin/sh/main.c	Fri Feb  4 22:47:55 2011	(r218306)
@@ -98,19 +98,7 @@ main(int argc, char *argv[])
 	(void) setlocale(LC_ALL, "");
 	state = 0;
 	if (setjmp(main_handler.loc)) {
-		/*
-		 * When a shell procedure is executed, we raise the
-		 * exception EXSHELLPROC to clean up before executing
-		 * the shell procedure.
-		 */
 		switch (exception) {
-		case EXSHELLPROC:
-			rootpid = getpid();
-			rootshell = 1;
-			minusc = NULL;
-			state = 3;
-			break;
-
 		case EXEXEC:
 			exitstatus = exerrno;
 			break;
@@ -123,10 +111,8 @@ main(int argc, char *argv[])
 			break;
 		}
 
-		if (exception != EXSHELLPROC) {
-		    if (state == 0 || iflag == 0 || ! rootshell)
-			    exitshell(exitstatus);
-		}
+		if (state == 0 || iflag == 0 || ! rootshell)
+			exitshell(exitstatus);
 		reset();
 		if (exception == EXINT)
 			out2fmt_flush("\n");

Modified: head/bin/sh/mkinit.c
==============================================================================
--- head/bin/sh/mkinit.c	Fri Feb  4 21:54:06 2011	(r218305)
+++ head/bin/sh/mkinit.c	Fri Feb  4 22:47:55 2011	(r218306)
@@ -126,16 +126,10 @@ char reset[] = "\
  * interactive shell and control is returned to the main command loop.\n\
  */\n";
 
-char shellproc[] = "\
-/*\n\
- * This routine is called to initialize the shell to run a shell procedure.\n\
- */\n";
-
 
 struct event event[] = {
 	{ "INIT", "init", init, { NULL, 0, NULL, NULL } },
 	{ "RESET", "reset", reset, { NULL, 0, NULL, NULL } },
-	{ "SHELLPROC", "initshellproc", shellproc, { NULL, 0, NULL, NULL } },
 	{ NULL, NULL, NULL, { NULL, 0, NULL, NULL } }
 };
 

Modified: head/bin/sh/options.c
==============================================================================
--- head/bin/sh/options.c	Fri Feb  4 21:54:06 2011	(r218305)
+++ head/bin/sh/options.c	Fri Feb  4 22:47:55 2011	(r218306)
@@ -304,21 +304,6 @@ setoption(int flag, int val)
 }
 
 
-
-#ifdef mkinit
-INCLUDE "options.h"
-
-SHELLPROC {
-	int i;
-
-	for (i = 0; i < NOPTS; i++)
-		optlist[i].val = 0;
-	optschanged();
-
-}
-#endif
-
-
 /*
  * Set the shell parameters.
  */

Modified: head/bin/sh/redir.c
==============================================================================
--- head/bin/sh/redir.c	Fri Feb  4 21:54:06 2011	(r218305)
+++ head/bin/sh/redir.c	Fri Feb  4 22:47:55 2011	(r218306)
@@ -324,10 +324,6 @@ RESET {
 		popredir();
 }
 
-SHELLPROC {
-	clearredir();
-}
-
 #endif
 
 /* Return true if fd 0 has already been redirected at least once.  */

Modified: head/bin/sh/sh.1
==============================================================================
--- head/bin/sh/sh.1	Fri Feb  4 21:54:06 2011	(r218305)
+++ head/bin/sh/sh.1	Fri Feb  4 22:47:55 2011	(r218306)
@@ -32,7 +32,7 @@
 .\"	from: @(#)sh.1	8.6 (Berkeley) 5/4/95
 .\" $FreeBSD$
 .\"
-.Dd January 16, 2011
+.Dd February 4, 2011
 .Dt SH 1
 .Os
 .Sh NAME
@@ -647,15 +647,9 @@ resulting in an
 .Er ENOEXEC
 return value from
 .Xr execve 2 )
-the shell will interpret the program in a subshell.
-The child shell will reinitialize itself in this case,
-so that the effect will be
-as if a new shell had been invoked to handle the ad-hoc shell script,
-except that the location of hashed commands located in
-the parent shell will be remembered by the child
-(see the description of the
-.Ic hash
-built-in command below).
+the shell will run a new instance of
+.Nm
+to interpret it.
 .Pp
 Note that previous versions of this document
 and the source code itself misleadingly and sporadically

Modified: head/bin/sh/trap.c
==============================================================================
--- head/bin/sh/trap.c	Fri Feb  4 21:54:06 2011	(r218305)
+++ head/bin/sh/trap.c	Fri Feb  4 22:47:55 2011	(r218306)
@@ -367,22 +367,6 @@ ignoresig(int signo)
 }
 
 
-#ifdef mkinit
-INCLUDE 
-INCLUDE "trap.h"
-
-SHELLPROC {
-	char *sm;
-
-	clear_traps();
-	for (sm = sigmode ; sm < sigmode + NSIG ; sm++) {
-		if (*sm == S_IGN)
-			*sm = S_HARD_IGN;
-	}
-}
-#endif
-
-
 /*
  * Signal handler.
  */

Modified: head/bin/sh/var.c
==============================================================================
--- head/bin/sh/var.c	Fri Feb  4 21:54:06 2011	(r218305)
+++ head/bin/sh/var.c	Fri Feb  4 22:47:55 2011	(r218306)
@@ -161,7 +161,7 @@ INIT {
 
 /*
  * This routine initializes the builtin variables.  It is called when the
- * shell is initialized and again when a shell procedure is spawned.
+ * shell is initialized.
  */
 
 void
@@ -542,47 +542,6 @@ environment(void)
 }
 
 
-/*
- * Called when a shell procedure is invoked to clear out nonexported
- * variables.  It is also necessary to reallocate variables of with
- * VSTACK set since these are currently allocated on the stack.
- */
-
-MKINIT void shprocvar(void);
-
-#ifdef mkinit
-SHELLPROC {
-	shprocvar();
-}
-#endif
-
-void
-shprocvar(void)
-{
-	struct var **vpp;
-	struct var *vp, **prev;
-
-	for (vpp = vartab ; vpp < vartab + VTABSIZE ; vpp++) {
-		for (prev = vpp ; (vp = *prev) != NULL ; ) {
-			if ((vp->flags & VEXPORT) == 0) {
-				*prev = vp->next;
-				if ((vp->flags & VTEXTFIXED) == 0)
-					ckfree(vp->text);
-				if ((vp->flags & VSTRFIXED) == 0)
-					ckfree(vp);
-			} else {
-				if (vp->flags & VSTACK) {
-					vp->text = savestr(vp->text);
-					vp->flags &=~ VSTACK;
-				}
-				prev = &vp->next;
-			}
-		}
-	}
-	initvar();
-}
-
-
 static int
 var_compare(const void *a, const void *b)
 {

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  5 03:30:30 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 02130106576C;
	Sat,  5 Feb 2011 03:30:30 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CA51F8FC13;
	Sat,  5 Feb 2011 03:30:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p153UT8L013237;
	Sat, 5 Feb 2011 03:30:29 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p153UTkJ013233;
	Sat, 5 Feb 2011 03:30:29 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <201102050330.p153UTkJ013233@svn.freebsd.org>
From: Warner Losh 
Date: Sat, 5 Feb 2011 03:30:29 +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: r218310 - in head/sys/arm: arm include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Feb 2011 03:30:30 -0000

Author: imp
Date: Sat Feb  5 03:30:29 2011
New Revision: 218310
URL: http://svn.freebsd.org/changeset/base/218310

Log:
  Make md_tp a register_t not a void *.  This will keep us from
  accidentally dereferencng it and might be one fewer things to change
  if arm64 happens...
  
  Submitted by:	rwatson's question on irc...

Modified:
  head/sys/arm/arm/sys_machdep.c
  head/sys/arm/arm/vm_machdep.c
  head/sys/arm/include/proc.h

Modified: head/sys/arm/arm/sys_machdep.c
==============================================================================
--- head/sys/arm/arm/sys_machdep.c	Sat Feb  5 03:15:28 2011	(r218309)
+++ head/sys/arm/arm/sys_machdep.c	Sat Feb  5 03:30:29 2011	(r218310)
@@ -85,7 +85,7 @@ static int
 arm32_set_tp(struct thread *td, void *args)
 {
 
-	td->td_md.md_tp = args;
+	td->td_md.md_tp = (register_t)args;
 	return (0);
 }
 
@@ -93,7 +93,7 @@ static int
 arm32_get_tp(struct thread *td, void *args)
 {
 
-	td->td_retval[0] = (uint32_t)td->td_md.md_tp;
+	td->td_retval[0] = td->td_md.md_tp;
 	return (0);
 }
 

Modified: head/sys/arm/arm/vm_machdep.c
==============================================================================
--- head/sys/arm/arm/vm_machdep.c	Sat Feb  5 03:15:28 2011	(r218309)
+++ head/sys/arm/arm/vm_machdep.c	Sat Feb  5 03:30:29 2011	(r218310)
@@ -146,7 +146,7 @@ cpu_fork(register struct thread *td1, re
 	/* Setup to release spin count in fork_exit(). */
 	td2->td_md.md_spinlock_count = 1;
 	td2->td_md.md_saved_cspr = 0;
-	td2->td_md.md_tp = *(uint32_t **)ARM_TP_ADDRESS;
+	td2->td_md.md_tp = *(register_t *)ARM_TP_ADDRESS;
 }
 				
 void
@@ -370,10 +370,10 @@ cpu_set_user_tls(struct thread *td, void
 {
 
 	if (td != curthread)
-		td->td_md.md_tp = tls_base;
+		td->td_md.md_tp = (register_t)tls_base;
 	else {
 		critical_enter();
-		*(void **)ARM_TP_ADDRESS = tls_base;
+		*(register_t *)ARM_TP_ADDRESS = (register_t)tls_base;
 		critical_exit();
 	}
 	return (0);

Modified: head/sys/arm/include/proc.h
==============================================================================
--- head/sys/arm/include/proc.h	Sat Feb  5 03:15:28 2011	(r218309)
+++ head/sys/arm/include/proc.h	Sat Feb  5 03:30:29 2011	(r218310)
@@ -50,7 +50,7 @@ struct mdthread {
 	register_t md_saved_cspr;	/* (k) */
 	int md_ptrace_instr;
 	int md_ptrace_addr;
-	void *md_tp;
+	register_t md_tp;
 	void *md_ras_start;
 	void *md_ras_end;
 };

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  5 03:36:35 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 04D27106566B;
	Sat,  5 Feb 2011 03:36:35 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E7FFF8FC0C;
	Sat,  5 Feb 2011 03:36:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p153aYVQ013420;
	Sat, 5 Feb 2011 03:36:34 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p153aYiq013418;
	Sat, 5 Feb 2011 03:36:34 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <201102050336.p153aYiq013418@svn.freebsd.org>
From: Warner Losh 
Date: Sat, 5 Feb 2011 03:36:34 +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: r218311 - head/sys/arm/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Feb 2011 03:36:35 -0000

Author: imp
Date: Sat Feb  5 03:36:34 2011
New Revision: 218311
URL: http://svn.freebsd.org/changeset/base/218311

Log:
  phys_addr is a PA not a VA so declare it as a vm_paddr_t not a vm_offset_t.

Modified:
  head/sys/arm/include/pmap.h

Modified: head/sys/arm/include/pmap.h
==============================================================================
--- head/sys/arm/include/pmap.h	Sat Feb  5 03:30:29 2011	(r218310)
+++ head/sys/arm/include/pmap.h	Sat Feb  5 03:36:34 2011	(r218311)
@@ -204,7 +204,7 @@ vtopte(vm_offset_t va)
 	return (ptep);
 }
 
-extern vm_offset_t phys_avail[];
+extern vm_paddr_t phys_avail[];
 extern vm_offset_t virtual_avail;
 extern vm_offset_t virtual_end;
 

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  5 12:09:00 2011
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1BD711065673;
	Sat,  5 Feb 2011 12:09:00 +0000 (UTC)
	(envelope-from peterjeremy@acm.org)
Received: from mail11.syd.optusnet.com.au (mail11.syd.optusnet.com.au
	[211.29.132.192])
	by mx1.freebsd.org (Postfix) with ESMTP id 8889A8FC0C;
	Sat,  5 Feb 2011 12:08:59 +0000 (UTC)
Received: from server.vk2pj.dyndns.org
	(c220-239-52-50.belrs4.nsw.optusnet.com.au [220.239.52.50])
	by mail11.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	p15C8ofh012662
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Sat, 5 Feb 2011 23:08:51 +1100
X-Bogosity: Ham, spamicity=0.000000
Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1])
	by server.vk2pj.dyndns.org (8.14.4/8.14.4) with ESMTP id p15C0mHF021583;
	Sat, 5 Feb 2011 23:00:48 +1100 (EST)
	(envelope-from peter@server.vk2pj.dyndns.org)
Received: (from peter@localhost)
	by server.vk2pj.dyndns.org (8.14.4/8.14.4/Submit) id p15C0mIB021582;
	Sat, 5 Feb 2011 23:00:48 +1100 (EST) (envelope-from peter)
Date: Sat, 5 Feb 2011 23:00:48 +1100
From: Peter Jeremy 
To: Warner Losh 
Message-ID: <20110205120047.GE20095@server.vk2pj.dyndns.org>
References: <201102032026.p13KQQX2057419@svn.freebsd.org>
	<20110203230721.GA47981@muon.cran.org.uk>
	<4D4C27E5.2020708@bsdimp.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="Lb0e7rgc7IsuDeGj"
Content-Disposition: inline
In-Reply-To: <4D4C27E5.2020708@bsdimp.com>
X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc
User-Agent: Mutt/1.5.20 (2009-06-14)
Cc: svn-src-head@FreeBSD.org, Adrian Chadd ,
	src-committers@FreeBSD.org, svn-src-all@FreeBSD.org
Subject: Re: svn commit: r218238 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Feb 2011 12:09:00 -0000


--Lb0e7rgc7IsuDeGj
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2011-Feb-04 09:23:01 -0700, Warner Losh  wrote:
>On 02/03/2011 16:07, Bruce Cran wrote:
>> On Thu, Feb 03, 2011 at 08:26:26PM +0000, Adrian Chadd wrote:
>>>   		if (ni !=3D NULL) {
>>> +#if NOTYET
>>>   		/* tag AMPDU aggregates for reorder processing */
>> This seems to have broken the build because NOTYET isn't defined.
>
>ANSI C states that all undefined preprocessor variables shall expand to=20
>0.  If we have a warning on that complains, we should turn it off.

Well, bde@ considers it a style bug so from that point of view, the
warning is useful.  Also,  given that the normal way of stating that
is "#ifdef NOTYET", keeping the warning may help catch code where
the preprocessor variable was supposed to have been defined but has
been misspelt - consider "#if _FreeBSD_version > 800100".

--=20
Peter Jeremy

--Lb0e7rgc7IsuDeGj
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (FreeBSD)

iEYEARECAAYFAk1NO+8ACgkQ/opHv/APuIcR/QCeJmAdOeV8kG2u+bTgTkiBESGm
jPQAoJ9RGexE1HSVesXs4OYdkzZKfTSe
=aTK9
-----END PGP SIGNATURE-----

--Lb0e7rgc7IsuDeGj--

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  5 12:12:52 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A1DE9106564A;
	Sat,  5 Feb 2011 12:12:52 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8F2AC8FC13;
	Sat,  5 Feb 2011 12:12:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p15CCqZ0027363;
	Sat, 5 Feb 2011 12:12:52 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p15CCpfd027323;
	Sat, 5 Feb 2011 12:12:51 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <201102051212.p15CCpfd027323@svn.freebsd.org>
From: Randall Stewart 
Date: Sat, 5 Feb 2011 12:12: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: r218319 - in head/sys: netinet netinet6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Feb 2011 12:12:52 -0000

Author: rrs
Date: Sat Feb  5 12:12:51 2011
New Revision: 218319
URL: http://svn.freebsd.org/changeset/base/218319

Log:
  1) Typo correction in comments and one spacing change.
  2) Mass update to all copyrights.
  MFC after:	3 Months

Modified:
  head/sys/netinet/sctp.h
  head/sys/netinet/sctp_asconf.c
  head/sys/netinet/sctp_asconf.h
  head/sys/netinet/sctp_auth.c
  head/sys/netinet/sctp_auth.h
  head/sys/netinet/sctp_bsd_addr.c
  head/sys/netinet/sctp_bsd_addr.h
  head/sys/netinet/sctp_cc_functions.c
  head/sys/netinet/sctp_constants.h
  head/sys/netinet/sctp_crc32.c
  head/sys/netinet/sctp_crc32.h
  head/sys/netinet/sctp_dtrace_declare.h
  head/sys/netinet/sctp_dtrace_define.h
  head/sys/netinet/sctp_header.h
  head/sys/netinet/sctp_indata.c
  head/sys/netinet/sctp_indata.h
  head/sys/netinet/sctp_input.h
  head/sys/netinet/sctp_lock_bsd.h
  head/sys/netinet/sctp_os.h
  head/sys/netinet/sctp_os_bsd.h
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_output.h
  head/sys/netinet/sctp_pcb.h
  head/sys/netinet/sctp_peeloff.c
  head/sys/netinet/sctp_peeloff.h
  head/sys/netinet/sctp_ss_functions.c
  head/sys/netinet/sctp_structs.h
  head/sys/netinet/sctp_sysctl.c
  head/sys/netinet/sctp_sysctl.h
  head/sys/netinet/sctp_timer.c
  head/sys/netinet/sctp_timer.h
  head/sys/netinet/sctp_uio.h
  head/sys/netinet/sctp_usrreq.c
  head/sys/netinet/sctp_var.h
  head/sys/netinet/sctputil.c
  head/sys/netinet/sctputil.h
  head/sys/netinet6/sctp6_usrreq.c
  head/sys/netinet6/sctp6_var.h

Modified: head/sys/netinet/sctp.h
==============================================================================
--- head/sys/netinet/sctp.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_asconf.c
==============================================================================
--- head/sys/netinet/sctp_asconf.c	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_asconf.c	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,8 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
- * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
- *                          Michael Tuexen, tuexen@fh-muenster.de
- *                          All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_asconf.h
==============================================================================
--- head/sys/netinet/sctp_asconf.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_asconf.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_auth.c
==============================================================================
--- head/sys/netinet/sctp_auth.c	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_auth.c	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_auth.h
==============================================================================
--- head/sys/netinet/sctp_auth.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_auth.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_bsd_addr.c
==============================================================================
--- head/sys/netinet/sctp_bsd_addr.c	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_bsd_addr.c	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_bsd_addr.h
==============================================================================
--- head/sys/netinet/sctp_bsd_addr.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_bsd_addr.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_cc_functions.c
==============================================================================
--- head/sys/netinet/sctp_cc_functions.c	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_cc_functions.c	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,8 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
- * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
- *                          Michael Tuexen, tuexen@fh-muenster.de
- *                          All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_constants.h
==============================================================================
--- head/sys/netinet/sctp_constants.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_constants.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,8 +1,7 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
- * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
- *                          Michael Tuexen, tuexen@fh-muenster.de
- *                          All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_crc32.c
==============================================================================
--- head/sys/netinet/sctp_crc32.c	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_crc32.c	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_crc32.h
==============================================================================
--- head/sys/netinet/sctp_crc32.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_crc32.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_dtrace_declare.h
==============================================================================
--- head/sys/netinet/sctp_dtrace_declare.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_dtrace_declare.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,6 +1,6 @@
 /*-
- * Copyright (c) 2010, by Randall Stewart & Michael Tuexen,
- * All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_dtrace_define.h
==============================================================================
--- head/sys/netinet/sctp_dtrace_define.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_dtrace_define.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,6 +1,6 @@
 /*-
- * Copyright (c) 2010, by Randall Stewart & Michael Tuexen,
- * All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_header.h
==============================================================================
--- head/sys/netinet/sctp_header.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_header.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_indata.c
==============================================================================
--- head/sys/netinet/sctp_indata.c	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_indata.c	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_indata.h
==============================================================================
--- head/sys/netinet/sctp_indata.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_indata.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_input.h
==============================================================================
--- head/sys/netinet/sctp_input.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_input.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_lock_bsd.h
==============================================================================
--- head/sys/netinet/sctp_lock_bsd.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_lock_bsd.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -2,6 +2,8 @@
 #define __sctp_lock_bsd_h__
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_os.h
==============================================================================
--- head/sys/netinet/sctp_os.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_os.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2006-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_os_bsd.h
==============================================================================
--- head/sys/netinet/sctp_os_bsd.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_os_bsd.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2006-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_output.c	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,8 +1,7 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
- * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
- *                          Michael Tuexen, tuexen@fh-muenster.de
- *                          All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_output.h
==============================================================================
--- head/sys/netinet/sctp_output.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_output.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_pcb.h
==============================================================================
--- head/sys/netinet/sctp_pcb.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_pcb.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,8 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
- * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
- *                          Michael Tuexen, tuexen@fh-muenster.de
- *                          All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
  *

Modified: head/sys/netinet/sctp_peeloff.c
==============================================================================
--- head/sys/netinet/sctp_peeloff.c	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_peeloff.c	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,8 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
- * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
- *                          Michael Tuexen, tuexen@fh-muenster.de
- *                          All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_peeloff.h
==============================================================================
--- head/sys/netinet/sctp_peeloff.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_peeloff.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_ss_functions.c
==============================================================================
--- head/sys/netinet/sctp_ss_functions.c	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_ss_functions.c	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,7 +1,7 @@
 /*-
- * Copyright (c) 2010-2011, by Randall Stewart, rrs@lakerest.net and
- *                          Michael Tuexen, tuexen@fh-muenster.de
- *                          All rights reserved.
+ * Copyright (c) 2010-2011, by Michael Tuexen. All rights reserved.
+ * Copyright (c) 2010-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2010-2011, by Robin Seggelmann. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -13,10 +13,6 @@
  *    notice, this list of conditions and the following disclaimer in
  *   the documentation and/or other materials provided with the distribution.
  *
- * c) Neither the name of Cisco Systems, Inc. nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -178,7 +174,7 @@ default_again:
 
 	/*
 	 * If CMT is off, we must validate that the stream in question has
-	 * the first item pointed towards are network destionation requested
+	 * the first item pointed towards are network destination requested
 	 * by the caller. Note that if we turn out to be locked to a stream
 	 * (assigning TSN's then we must stop, since we cannot look for
 	 * another stream with data to send to that destination). In CMT's
@@ -287,7 +283,6 @@ sctp_ss_rrp_add(struct sctp_tcb *stcb, s
 	}
 	if ((strq->ss_params.rr.next_spoke.tqe_next == NULL) &&
 	    (strq->ss_params.rr.next_spoke.tqe_prev == NULL)) {
-
 		if (TAILQ_EMPTY(&asoc->ss_data.out_wheel)) {
 			TAILQ_INSERT_HEAD(&asoc->ss_data.out_wheel, strq, ss_params.rr.next_spoke);
 		} else {
@@ -331,7 +326,7 @@ rrp_again:
 
 	/*
 	 * If CMT is off, we must validate that the stream in question has
-	 * the first item pointed towards are network destionation requested
+	 * the first item pointed towards are network destination requested
 	 * by the caller. Note that if we turn out to be locked to a stream
 	 * (assigning TSN's then we must stop, since we cannot look for
 	 * another stream with data to send to that destination). In CMT's
@@ -374,7 +369,7 @@ rrp_pd_again:
 
 	/*
 	 * If CMT is off, we must validate that the stream in question has
-	 * the first item pointed towards are network destionation requested
+	 * the first item pointed towards are network destination requested
 	 * by the caller. Note that if we turn out to be locked to a stream
 	 * (assigning TSN's then we must stop, since we cannot look for
 	 * another stream with data to send to that destination). In CMT's
@@ -441,7 +436,6 @@ sctp_ss_prio_add(struct sctp_tcb *stcb, 
 	}
 	if ((strq->ss_params.prio.next_spoke.tqe_next == NULL) &&
 	    (strq->ss_params.prio.next_spoke.tqe_prev == NULL)) {
-
 		if (TAILQ_EMPTY(&asoc->ss_data.out_wheel)) {
 			TAILQ_INSERT_HEAD(&asoc->ss_data.out_wheel, strq, ss_params.prio.next_spoke);
 		} else {
@@ -516,7 +510,7 @@ prio_again:
 
 	/*
 	 * If CMT is off, we must validate that the stream in question has
-	 * the first item pointed towards are network destionation requested
+	 * the first item pointed towards are network destination requested
 	 * by the caller. Note that if we turn out to be locked to a stream
 	 * (assigning TSN's then we must stop, since we cannot look for
 	 * another stream with data to send to that destination). In CMT's
@@ -833,7 +827,7 @@ default_again:
 
 	/*
 	 * If CMT is off, we must validate that the stream in question has
-	 * the first item pointed towards are network destionation requested
+	 * the first item pointed towards are network destination requested
 	 * by the caller. Note that if we turn out to be locked to a stream
 	 * (assigning TSN's then we must stop, since we cannot look for
 	 * another stream with data to send to that destination). In CMT's

Modified: head/sys/netinet/sctp_structs.h
==============================================================================
--- head/sys/netinet/sctp_structs.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_structs.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,8 +1,7 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
- * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
- *                          Michael Tuexen, tuexen@fh-muenster.de
- *                          All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_sysctl.c
==============================================================================
--- head/sys/netinet/sctp_sysctl.c	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_sysctl.c	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,8 +1,7 @@
 /*-
  * Copyright (c) 2007, by Cisco Systems, Inc. All rights reserved.
- * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
- *                          Michael Tuexen, tuexen@fh-muenster.de
- *                          All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_sysctl.h
==============================================================================
--- head/sys/netinet/sctp_sysctl.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_sysctl.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_timer.c
==============================================================================
--- head/sys/netinet/sctp_timer.c	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_timer.c	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,8 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
- * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
- *                          Michael Tuexen, tuexen@fh-muenster.de
- *                          All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_timer.h
==============================================================================
--- head/sys/netinet/sctp_timer.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_timer.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_uio.h
==============================================================================
--- head/sys/netinet/sctp_uio.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_uio.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_usrreq.c
==============================================================================
--- head/sys/netinet/sctp_usrreq.c	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_usrreq.c	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,8 +1,7 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
- * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
- *                          Michael Tuexen, tuexen@fh-muenster.de
- *                          All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctp_var.h
==============================================================================
--- head/sys/netinet/sctp_var.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctp_var.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctputil.c	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,8 +1,7 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
- * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
- *                          Michael Tuexen, tuexen@fh-muenster.de
- *                          All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet/sctputil.h
==============================================================================
--- head/sys/netinet/sctputil.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet/sctputil.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet6/sctp6_usrreq.c
==============================================================================
--- head/sys/netinet6/sctp6_usrreq.c	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet6/sctp6_usrreq.c	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

Modified: head/sys/netinet6/sctp6_var.h
==============================================================================
--- head/sys/netinet6/sctp6_var.h	Sat Feb  5 11:37:41 2011	(r218318)
+++ head/sys/netinet6/sctp6_var.h	Sat Feb  5 12:12:51 2011	(r218319)
@@ -1,5 +1,7 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  5 12:55:00 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4AB52106566B;
	Sat,  5 Feb 2011 12:55:00 +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 1E7D08FC0A;
	Sat,  5 Feb 2011 12:55:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p15Ct0dt028288;
	Sat, 5 Feb 2011 12:55:00 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p15Csxip028284;
	Sat, 5 Feb 2011 12:54:59 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201102051254.p15Csxip028284@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sat, 5 Feb 2011 12:54: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: r218320 - in head: bin/sh tools/regression/bin/sh/errors
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Feb 2011 12:55:00 -0000

Author: jilles
Date: Sat Feb  5 12:54:59 2011
New Revision: 218320
URL: http://svn.freebsd.org/changeset/base/218320

Log:
  sh: Do not try to execute binary files as scripts.
  
  If execve() returns an [ENOEXEC] error, check if the file is binary before
  trying to execute it using sh. A file is considered binary if at least one
  of the first 256 bytes is '\0'.
  
  In particular, trying to execute ELF binaries for the wrong architecture now
  fails with an "Exec format error" message instead of syntax errors and
  potentially strange results.

Added:
  head/tools/regression/bin/sh/errors/bad-binary1.126   (contents, props changed)
Modified:
  head/bin/sh/exec.c
  head/bin/sh/sh.1

Modified: head/bin/sh/exec.c
==============================================================================
--- head/bin/sh/exec.c	Sat Feb  5 12:12:51 2011	(r218319)
+++ head/bin/sh/exec.c	Sat Feb  5 12:54:59 2011	(r218320)
@@ -126,6 +126,8 @@ shellexec(char **argv, char **envp, cons
 				tryexec(cmdname, argv, envp);
 				if (errno != ENOENT && errno != ENOTDIR)
 					e = errno;
+				if (e == ENOEXEC)
+					break;
 			}
 			stunalloc(cmdname);
 		}
@@ -145,11 +147,23 @@ shellexec(char **argv, char **envp, cons
 static void
 tryexec(char *cmd, char **argv, char **envp)
 {
-	int e;
+	int e, in;
+	ssize_t n;
+	char buf[256];
 
 	execve(cmd, argv, envp);
 	e = errno;
 	if (e == ENOEXEC) {
+		INTOFF;
+		in = open(cmd, O_RDONLY | O_NONBLOCK);
+		if (in != -1) {
+			n = pread(in, buf, sizeof buf, 0);
+			close(in);
+			if (n > 0 && memchr(buf, '\0', n) != NULL) {
+				errno = ENOEXEC;
+				return;
+			}
+		}
 		*argv = cmd;
 		*--argv = _PATH_BSHELL;
 		execve(_PATH_BSHELL, argv, envp);

Modified: head/bin/sh/sh.1
==============================================================================
--- head/bin/sh/sh.1	Sat Feb  5 12:12:51 2011	(r218319)
+++ head/bin/sh/sh.1	Sat Feb  5 12:54:59 2011	(r218320)
@@ -647,6 +647,7 @@ resulting in an
 .Er ENOEXEC
 return value from
 .Xr execve 2 )
+but appears to be a text file,
 the shell will run a new instance of
 .Nm
 to interpret it.

Added: head/tools/regression/bin/sh/errors/bad-binary1.126
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/sh/errors/bad-binary1.126	Sat Feb  5 12:54:59 2011	(r218320)
@@ -0,0 +1,12 @@
+# $FreeBSD$
+# Checking for binary "scripts" without magic number is permitted but not
+# required by POSIX. However, it is preferable to getting errors like
+# Syntax error: word unexpected (expecting ")")
+# from trying to execute ELF binaries for the wrong architecture.
+
+T=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit
+trap 'rm -rf "${T}"' 0
+printf '\0echo bad\n' >"$T/testshellproc"
+chmod 755 "$T/testshellproc"
+PATH=$T:$PATH
+testshellproc 2>/dev/null

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  5 14:01:46 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 92E751065672;
	Sat,  5 Feb 2011 14:01:46 +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 819E88FC21;
	Sat,  5 Feb 2011 14:01:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p15E1klm029782;
	Sat, 5 Feb 2011 14:01:46 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p15E1kgm029779;
	Sat, 5 Feb 2011 14:01:46 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201102051401.p15E1kgm029779@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sat, 5 Feb 2011 14:01:46 +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: r218323 - in head: bin/sh
	tools/regression/bin/sh/execution
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Feb 2011 14:01:46 -0000

Author: jilles
Date: Sat Feb  5 14:01:46 2011
New Revision: 218323
URL: http://svn.freebsd.org/changeset/base/218323

Log:
  sh: Forget all cached command locations on any PATH change.
  
  POSIX requires this and it is simpler than the previous code that remembered
  command locations when appending directories to PATH.
  
  In particular,
    PATH=$PATH
  is no longer a no-op but discards all cached command locations.

Added:
  head/tools/regression/bin/sh/execution/hash1.0   (contents, props changed)
Modified:
  head/bin/sh/exec.c

Modified: head/bin/sh/exec.c
==============================================================================
--- head/bin/sh/exec.c	Sat Feb  5 13:07:35 2011	(r218322)
+++ head/bin/sh/exec.c	Sat Feb  5 14:01:46 2011	(r218323)
@@ -494,30 +494,7 @@ hashcd(void)
 void
 changepath(const char *newval)
 {
-	const char *old, *new;
-	int idx;
-	int firstchange;
-
-	old = pathval();
-	new = newval;
-	firstchange = 9999;	/* assume no change */
-	idx = 0;
-	for (;;) {
-		if (*old != *new) {
-			firstchange = idx;
-			if ((*old == '\0' && *new == ':')
-			 || (*old == ':' && *new == '\0'))
-				firstchange++;
-			old = new;	/* ignore subsequent differences */
-		}
-		if (*new == '\0')
-			break;
-		if (*new == ':') {
-			idx++;
-		}
-		new++, old++;
-	}
-	clearcmdentry(firstchange);
+	clearcmdentry(0);
 }
 
 

Added: head/tools/regression/bin/sh/execution/hash1.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/sh/execution/hash1.0	Sat Feb  5 14:01:46 2011	(r218323)
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+T=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit
+trap 'rm -rf "${T}"' 0
+PATH=$T:$PATH
+ls -ld . >/dev/null
+cat <"$T/ls"
+:
+EOF
+chmod 755 "$T/ls"
+PATH=$PATH
+ls -ld .

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  5 14:08:51 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D6A5C106566B;
	Sat,  5 Feb 2011 14:08:51 +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 AB3CE8FC08;
	Sat,  5 Feb 2011 14:08:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p15E8pG8029954;
	Sat, 5 Feb 2011 14:08:51 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p15E8p8R029950;
	Sat, 5 Feb 2011 14:08:51 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201102051408.p15E8p8R029950@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sat, 5 Feb 2011 14:08: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: r218324 - head/bin/sh
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Feb 2011 14:08:51 -0000

Author: jilles
Date: Sat Feb  5 14:08:51 2011
New Revision: 218324
URL: http://svn.freebsd.org/changeset/base/218324

Log:
  sh: Remove clearcmdentry()'s now unused argument.

Modified:
  head/bin/sh/eval.c
  head/bin/sh/exec.c
  head/bin/sh/exec.h

Modified: head/bin/sh/eval.c
==============================================================================
--- head/bin/sh/eval.c	Sat Feb  5 14:01:46 2011	(r218323)
+++ head/bin/sh/eval.c	Sat Feb  5 14:08:51 2011	(r218324)
@@ -812,7 +812,7 @@ evalcommand(union node *cmd, int flags, 
 				 * bookinging effort, since most such runs add
 				 * directories in front of the new PATH.
 				 */
-				clearcmdentry(0);
+				clearcmdentry();
 				do_clearcmdentry = 1;
 			}
 
@@ -854,7 +854,7 @@ evalcommand(union node *cmd, int flags, 
 						argc -= 2;
 					}
 					path = _PATH_STDPATH;
-					clearcmdentry(0);
+					clearcmdentry();
 					do_clearcmdentry = 1;
 				} else if (!strcmp(argv[1], "--")) {
 					if (argc == 2)
@@ -1061,7 +1061,7 @@ out:
 	if (lastarg)
 		setvar("_", lastarg, 0);
 	if (do_clearcmdentry)
-		clearcmdentry(0);
+		clearcmdentry();
 	popstackmark(&smark);
 }
 

Modified: head/bin/sh/exec.c
==============================================================================
--- head/bin/sh/exec.c	Sat Feb  5 14:01:46 2011	(r218323)
+++ head/bin/sh/exec.c	Sat Feb  5 14:08:51 2011	(r218324)
@@ -234,7 +234,7 @@ hashcmd(int argc __unused, char **argv _
 	verbose = 0;
 	while ((c = nextopt("rv")) != '\0') {
 		if (c == 'r') {
-			clearcmdentry(0);
+			clearcmdentry();
 		} else if (c == 'v') {
 			verbose++;
 		}
@@ -494,7 +494,7 @@ hashcd(void)
 void
 changepath(const char *newval)
 {
-	clearcmdentry(0);
+	clearcmdentry();
 }
 
 
@@ -504,7 +504,7 @@ changepath(const char *newval)
  */
 
 void
-clearcmdentry(int firstchange)
+clearcmdentry(void)
 {
 	struct tblentry **tblp;
 	struct tblentry **pp;
@@ -514,8 +514,7 @@ clearcmdentry(int firstchange)
 	for (tblp = cmdtable ; tblp < &cmdtable[CMDTABLESIZE] ; tblp++) {
 		pp = tblp;
 		while ((cmdp = *pp) != NULL) {
-			if ((cmdp->cmdtype == CMDNORMAL &&
-			     cmdp->param.index >= firstchange)) {
+			if (cmdp->cmdtype == CMDNORMAL) {
 				*pp = cmdp->next;
 				ckfree(cmdp);
 			} else {
@@ -660,7 +659,7 @@ typecmd_impl(int argc, char **argv, int 
 	int error1 = 0;
 
 	if (path != pathval())
-		clearcmdentry(0);
+		clearcmdentry();
 
 	for (i = 1; i < argc; i++) {
 		/* First look at the keywords */
@@ -756,7 +755,7 @@ typecmd_impl(int argc, char **argv, int 
 	}
 
 	if (path != pathval())
-		clearcmdentry(0);
+		clearcmdentry();
 
 	return error1;
 }

Modified: head/bin/sh/exec.h
==============================================================================
--- head/bin/sh/exec.h	Sat Feb  5 14:01:46 2011	(r218323)
+++ head/bin/sh/exec.h	Sat Feb  5 14:08:51 2011	(r218324)
@@ -76,4 +76,4 @@ void defun(const char *, union node *);
 int unsetfunc(const char *);
 int typecmd_impl(int, char **, int, const char *);
 int typecmd(int, char **);
-void clearcmdentry(int);
+void clearcmdentry(void);

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  5 15:02:19 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 61F19106564A;
	Sat,  5 Feb 2011 15:02:19 +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 5045A8FC13;
	Sat,  5 Feb 2011 15:02:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p15F2JXZ031420;
	Sat, 5 Feb 2011 15:02:19 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p15F2J3k031417;
	Sat, 5 Feb 2011 15:02:19 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201102051502.p15F2J3k031417@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sat, 5 Feb 2011 15:02:19 +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: r218325 - in head: bin/sh
	tools/regression/bin/sh/execution
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Feb 2011 15:02:19 -0000

Author: jilles
Date: Sat Feb  5 15:02:19 2011
New Revision: 218325
URL: http://svn.freebsd.org/changeset/base/218325

Log:
  sh: Fix two things about {(...)} type != NSUBSHELL) {
+		if (!is_subshell) {
 			n2 = (union node *)stalloc(sizeof (struct nredir));
 			n2->type = NREDIR;
 			n2->nredir.n = n1;

Added: head/tools/regression/bin/sh/execution/redir5.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/sh/execution/redir5.0	Sat Feb  5 15:02:19 2011	(r218325)
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+{ (echo bad) >/dev/null; } 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B5EDF106566B;
	Sat,  5 Feb 2011 15:10:27 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A31B68FC0A;
	Sat,  5 Feb 2011 15:10:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p15FARwI031671;
	Sat, 5 Feb 2011 15:10:27 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p15FARXr031666;
	Sat, 5 Feb 2011 15:10:27 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201102051510.p15FARXr031666@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 5 Feb 2011 15:10: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: r218327 - in head/sys: amd64/amd64 amd64/ia32 i386/i386
	kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Feb 2011 15:10:27 -0000

Author: kib
Date: Sat Feb  5 15:10:27 2011
New Revision: 218327
URL: http://svn.freebsd.org/changeset/base/218327

Log:
  Clear the padding when returning context to the usermode, for
  MI ucontext_t and x86 MD parts.
  Kernel allocates the structures on the stack, and not clearing
  reserved fields and paddings causes leakage.
  
  Noted and discussed with:	bde
  MFC after:	2 weeks

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/amd64/ia32/ia32_signal.c
  head/sys/i386/i386/machdep.c
  head/sys/kern/kern_context.c

Modified: head/sys/amd64/amd64/machdep.c
==============================================================================
--- head/sys/amd64/amd64/machdep.c	Sat Feb  5 15:09:55 2011	(r218326)
+++ head/sys/amd64/amd64/machdep.c	Sat Feb  5 15:10:27 2011	(r218327)
@@ -331,6 +331,9 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, 
 	fpstate_drop(td);
 	sf.sf_uc.uc_mcontext.mc_fsbase = pcb->pcb_fsbase;
 	sf.sf_uc.uc_mcontext.mc_gsbase = pcb->pcb_gsbase;
+	bzero(sf.sf_uc.uc_mcontext.mc_spare,
+	    sizeof(sf.sf_uc.uc_mcontext.mc_spare));
+	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
 
 	/* Allocate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
@@ -352,6 +355,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, 
 	/* Build the argument list for the signal handler. */
 	regs->tf_rdi = sig;			/* arg 1 in %rdi */
 	regs->tf_rdx = (register_t)&sfp->sf_uc;	/* arg 3 in %rdx */
+	bzero(&sf.sf_si, sizeof(sf.sf_si));
 	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
 		/* Signal handler installed with SA_SIGINFO. */
 		regs->tf_rsi = (register_t)&sfp->sf_si;	/* arg 2 in %rsi */
@@ -2043,6 +2047,7 @@ get_mcontext(struct thread *td, mcontext
 	get_fpcontext(td, mcp);
 	mcp->mc_fsbase = pcb->pcb_fsbase;
 	mcp->mc_gsbase = pcb->pcb_gsbase;
+	bzero(mcp->mc_spare, sizeof(mcp->mc_spare));
 	return (0);
 }
 

Modified: head/sys/amd64/ia32/ia32_signal.c
==============================================================================
--- head/sys/amd64/ia32/ia32_signal.c	Sat Feb  5 15:09:55 2011	(r218326)
+++ head/sys/amd64/ia32/ia32_signal.c	Sat Feb  5 15:10:27 2011	(r218327)
@@ -167,6 +167,8 @@ ia32_get_mcontext(struct thread *td, str
 	ia32_get_fpcontext(td, mcp);
 	mcp->mc_fsbase = pcb->pcb_fsbase;
 	mcp->mc_gsbase = pcb->pcb_gsbase;
+	bzero(mcp->mc_spare1, sizeof(mcp->mc_spare1));
+	bzero(mcp->mc_spare2, sizeof(mcp->mc_spare2));
 	set_pcb_flags(pcb, PCB_FULL_IRET);
 	return (0);
 }
@@ -233,6 +235,7 @@ freebsd32_getcontext(struct thread *td, 
 		PROC_LOCK(td->td_proc);
 		uc.uc_sigmask = td->td_sigmask;
 		PROC_UNLOCK(td->td_proc);
+		bzero(&uc.__spare__, sizeof(uc.__spare__));
 		ret = copyout(&uc, uap->ucp, UC_COPY_SIZE);
 	}
 	return (ret);
@@ -348,6 +351,11 @@ freebsd4_ia32_sendsig(sig_t catcher, ksi
 	sf.sf_uc.uc_mcontext.mc_es = regs->tf_es;
 	sf.sf_uc.uc_mcontext.mc_fs = regs->tf_fs;
 	sf.sf_uc.uc_mcontext.mc_gs = regs->tf_gs;
+	bzero(sf.sf_uc.uc_mcontext.mc_fpregs,
+	    sizeof(sf.sf_uc.uc_mcontext.mc_fpregs));
+	bzero(sf.sf_uc.uc_mcontext.__spare__,
+	    sizeof(sf.sf_uc.uc_mcontext.__spare__));
+	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
 
 	/* Allocate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
@@ -365,6 +373,7 @@ freebsd4_ia32_sendsig(sig_t catcher, ksi
 	/* Build the argument list for the signal handler. */
 	sf.sf_signum = sig;
 	sf.sf_ucontext = (register_t)&sfp->sf_uc;
+	bzero(&sf.sf_si, sizeof(sf.sf_si));
 	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
 		/* Signal handler installed with SA_SIGINFO. */
 		sf.sf_siginfo = (u_int32_t)(uintptr_t)&sfp->sf_si;
@@ -468,6 +477,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *
 	fpstate_drop(td);
 	sf.sf_uc.uc_mcontext.mc_fsbase = td->td_pcb->pcb_fsbase;
 	sf.sf_uc.uc_mcontext.mc_gsbase = td->td_pcb->pcb_gsbase;
+	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
 
 	/* Allocate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
@@ -487,6 +497,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *
 	/* Build the argument list for the signal handler. */
 	sf.sf_signum = sig;
 	sf.sf_ucontext = (register_t)&sfp->sf_uc;
+	bzero(&sf.sf_si, sizeof(sf.sf_si));
 	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
 		/* Signal handler installed with SA_SIGINFO. */
 		sf.sf_siginfo = (u_int32_t)(uintptr_t)&sfp->sf_si;

Modified: head/sys/i386/i386/machdep.c
==============================================================================
--- head/sys/i386/i386/machdep.c	Sat Feb  5 15:09:55 2011	(r218326)
+++ head/sys/i386/i386/machdep.c	Sat Feb  5 15:10:27 2011	(r218327)
@@ -376,12 +376,14 @@ osendsig(sig_t catcher, ksiginfo_t *ksi,
 	/* Build the argument list for the signal handler. */
 	sf.sf_signum = sig;
 	sf.sf_scp = (register_t)&fp->sf_siginfo.si_sc;
+	bzero(&sf.sf_siginfo, sizeof(sf.sf_siginfo));
 	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
 		/* Signal handler installed with SA_SIGINFO. */
 		sf.sf_arg2 = (register_t)&fp->sf_siginfo;
 		sf.sf_siginfo.si_signo = sig;
 		sf.sf_siginfo.si_code = ksi->ksi_code;
 		sf.sf_ahu.sf_action = (__osiginfohandler_t *)catcher;
+		sf.sf_addr = 0;
 	} else {
 		/* Old FreeBSD-style arguments. */
 		sf.sf_arg2 = ksi->ksi_code;
@@ -495,6 +497,11 @@ freebsd4_sendsig(sig_t catcher, ksiginfo
 	sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0;
 	sf.sf_uc.uc_mcontext.mc_gs = rgs();
 	bcopy(regs, &sf.sf_uc.uc_mcontext.mc_fs, sizeof(*regs));
+	bzero(sf.sf_uc.uc_mcontext.mc_fpregs,
+	    sizeof(sf.sf_uc.uc_mcontext.mc_fpregs));
+	bzero(sf.sf_uc.uc_mcontext.__spare__,
+	    sizeof(sf.sf_uc.uc_mcontext.__spare__));
+	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
 
 	/* Allocate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
@@ -514,6 +521,7 @@ freebsd4_sendsig(sig_t catcher, ksiginfo
 	/* Build the argument list for the signal handler. */
 	sf.sf_signum = sig;
 	sf.sf_ucontext = (register_t)&sfp->sf_uc;
+	bzero(&sf.sf_si, sizeof(sf.sf_si));
 	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
 		/* Signal handler installed with SA_SIGINFO. */
 		sf.sf_siginfo = (register_t)&sfp->sf_si;
@@ -640,6 +648,11 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, 
 	sdp = &td->td_pcb->pcb_gsd;
 	sf.sf_uc.uc_mcontext.mc_gsbase = sdp->sd_hibase << 24 |
 	    sdp->sd_lobase;
+	bzero(sf.sf_uc.uc_mcontext.mc_spare1,
+	    sizeof(sf.sf_uc.uc_mcontext.mc_spare1));
+	bzero(sf.sf_uc.uc_mcontext.mc_spare2,
+	    sizeof(sf.sf_uc.uc_mcontext.mc_spare2));
+	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
 
 	/* Allocate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
@@ -661,6 +674,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, 
 	/* Build the argument list for the signal handler. */
 	sf.sf_signum = sig;
 	sf.sf_ucontext = (register_t)&sfp->sf_uc;
+	bzero(&sf.sf_si, sizeof(sf.sf_si));
 	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
 		/* Signal handler installed with SA_SIGINFO. */
 		sf.sf_siginfo = (register_t)&sfp->sf_si;
@@ -3286,7 +3300,8 @@ get_mcontext(struct thread *td, mcontext
 	mcp->mc_fsbase = sdp->sd_hibase << 24 | sdp->sd_lobase;
 	sdp = &td->td_pcb->pcb_gsd;
 	mcp->mc_gsbase = sdp->sd_hibase << 24 | sdp->sd_lobase;
-
+	bzero(mcp->mc_spare1, sizeof(mcp->mc_spare1));
+	bzero(mcp->mc_spare2, sizeof(mcp->mc_spare2));
 	return (0);
 }
 
@@ -3335,6 +3350,7 @@ get_fpcontext(struct thread *td, mcontex
 #ifndef DEV_NPX
 	mcp->mc_fpformat = _MC_FPFMT_NODEV;
 	mcp->mc_ownedfp = _MC_FPOWNED_NONE;
+	bzero(mcp->mc_fpstate, sizeof(mcp->mc_fpstate));
 #else
 	mcp->mc_ownedfp = npxgetregs(td);
 	bcopy(&td->td_pcb->pcb_user_save, &mcp->mc_fpstate,

Modified: head/sys/kern/kern_context.c
==============================================================================
--- head/sys/kern/kern_context.c	Sat Feb  5 15:09:55 2011	(r218326)
+++ head/sys/kern/kern_context.c	Sat Feb  5 15:10:27 2011	(r218327)
@@ -72,6 +72,7 @@ getcontext(struct thread *td, struct get
 		PROC_LOCK(td->td_proc);
 		uc.uc_sigmask = td->td_sigmask;
 		PROC_UNLOCK(td->td_proc);
+		bzero(uc.__spare__, sizeof(uc.__spare__));
 		ret = copyout(&uc, uap->ucp, UC_COPY_SIZE);
 	}
 	return (ret);
@@ -108,6 +109,7 @@ swapcontext(struct thread *td, struct sw
 		ret = EINVAL;
 	else {
 		get_mcontext(td, &uc.uc_mcontext, GET_MC_CLEAR_RET);
+		bzero(uc.__spare__, sizeof(uc.__spare__));
 		PROC_LOCK(td->td_proc);
 		uc.uc_sigmask = td->td_sigmask;
 		PROC_UNLOCK(td->td_proc);

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  5 15:37:10 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 959C8106564A;
	Sat,  5 Feb 2011 15:37:10 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 849E38FC19;
	Sat,  5 Feb 2011 15:37:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p15FbAX2032323;
	Sat, 5 Feb 2011 15:37:10 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p15FbAKZ032321;
	Sat, 5 Feb 2011 15:37:10 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201102051537.p15FbAKZ032321@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 5 Feb 2011 15:37: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: r218329 - head/sys/i386/i386
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Feb 2011 15:37:10 -0000

Author: kib
Date: Sat Feb  5 15:37:10 2011
New Revision: 218329
URL: http://svn.freebsd.org/changeset/base/218329

Log:
  Fix linking of the kernel without device npx.
  
  MFC after:	2 weeks

Modified:
  head/sys/i386/i386/machdep.c

Modified: head/sys/i386/i386/machdep.c
==============================================================================
--- head/sys/i386/i386/machdep.c	Sat Feb  5 15:13:18 2011	(r218328)
+++ head/sys/i386/i386/machdep.c	Sat Feb  5 15:37:10 2011	(r218329)
@@ -3229,7 +3229,11 @@ fill_fpregs(struct thread *td, struct fp
 
 	KASSERT(td == curthread || TD_IS_SUSPENDED(td),
 	    ("not suspended thread %p", td));
+#ifdef DEV_NPX
 	npxgetregs(td);
+#else
+	bzero(fpregs, sizeof(*fpregs));
+#endif
 #ifdef CPU_ENABLE_SSE
 	if (cpu_fxsr)
 		fill_fpregs_xmm(&td->td_pcb->pcb_user_save.sv_xmm,
@@ -3253,7 +3257,9 @@ set_fpregs(struct thread *td, struct fpr
 #endif /* CPU_ENABLE_SSE */
 		bcopy(fpregs, &td->td_pcb->pcb_user_save.sv_87,
 		    sizeof(*fpregs));
+#ifdef DEV_NPX
 	npxuserinited(td);
+#endif
 	return (0);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  5 16:23:32 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A5126106564A;
	Sat,  5 Feb 2011 16:23:32 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 938258FC14;
	Sat,  5 Feb 2011 16:23:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p15GNWw9033480;
	Sat, 5 Feb 2011 16:23:32 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p15GNWpc033477;
	Sat, 5 Feb 2011 16:23:32 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <201102051623.p15GNWpc033477@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Sat, 5 Feb 2011 16:23:32 +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: r218331 - head/gnu/lib/libdialog
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Feb 2011 16:23:32 -0000

Author: nwhitehorn
Date: Sat Feb  5 16:23:32 2011
New Revision: 218331
URL: http://svn.freebsd.org/changeset/base/218331

Log:
  Enable wide character support in libdialog.

Modified:
  head/gnu/lib/libdialog/Makefile
  head/gnu/lib/libdialog/dlg_config.h

Modified: head/gnu/lib/libdialog/Makefile
==============================================================================
--- head/gnu/lib/libdialog/Makefile	Sat Feb  5 16:03:08 2011	(r218330)
+++ head/gnu/lib/libdialog/Makefile	Sat Feb  5 16:23:32 2011	(r218331)
@@ -12,7 +12,7 @@ SRCS=		arrows.c buttons.c calendar.c che
 INCS=		dialog.h dlg_colors.h dlg_config.h dlg_keys.h
 MAN=		dialog.3
 
-CFLAGS+= 	-I${.CURDIR} -I${DIALOG}
+CFLAGS+= 	-I${.CURDIR} -I${DIALOG} -D_XOPEN_SOURCE_EXTENDED
 .PATH:		${DIALOG}
 WARNS?=		3
 

Modified: head/gnu/lib/libdialog/dlg_config.h
==============================================================================
--- head/gnu/lib/libdialog/dlg_config.h	Sat Feb  5 16:03:08 2011	(r218330)
+++ head/gnu/lib/libdialog/dlg_config.h	Sat Feb  5 16:23:32 2011	(r218331)
@@ -5,12 +5,10 @@
  * $FreeBSD$
  */
 
-
 #define DIALOG_PATCHDATE 20100428
 #define DIALOG_VERSION "1.1"
 #define HAVE_ALLOCA 1
 #define HAVE_COLOR 1
-#define HAVE_CURSES_H 1
 #define HAVE_DIRENT_H 1
 #define HAVE_DLG_FORMBOX 1
 #define HAVE_DLG_GAUGE 1
@@ -41,6 +39,7 @@
 #define HAVE_INTTYPES_H 1
 #define HAVE_LANGINFO_CODESET 1
 #define HAVE_LC_MESSAGES 1
+#define HAVE_LIBNCURSESW 1
 #define HAVE_LIMITS_H 1
 #define HAVE_LOCALE_H 1
 #define HAVE_MBSTATE_T 1
@@ -89,3 +88,4 @@
 #define SYSTEM_NAME "freebsd9.0"
 #define TIME_WITH_SYS_TIME 1
 #define TYPE_CHTYPE_IS_SCALAR 1
+#define USE_WIDE_CURSES 1

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  5 19:13:39 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2791210656E4;
	Sat,  5 Feb 2011 19:13:39 +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 087358FC0A;
	Sat,  5 Feb 2011 19:13:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p15JDcVO037690;
	Sat, 5 Feb 2011 19:13:38 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p15JDcGA037685;
	Sat, 5 Feb 2011 19:13:38 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <201102051913.p15JDcGA037685@svn.freebsd.org>
From: Michael Tuexen 
Date: Sat, 5 Feb 2011 19:13: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: r218335 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Feb 2011 19:13:39 -0000

Author: tuexen
Date: Sat Feb  5 19:13:38 2011
New Revision: 218335
URL: http://svn.freebsd.org/changeset/base/218335

Log:
  Add support for M_FLOWID.

Modified:
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_structs.h

Modified: head/sys/netinet/sctp_input.c
==============================================================================
--- head/sys/netinet/sctp_input.c	Sat Feb  5 19:13:34 2011	(r218334)
+++ head/sys/netinet/sctp_input.c	Sat Feb  5 19:13:38 2011	(r218335)
@@ -2615,6 +2615,9 @@ sctp_handle_cookie_echo(struct mbuf *m, 
 		/* still no TCB... must be bad cookie-echo */
 		return (NULL);
 	}
+	if ((*netp != NULL) && (m->m_flags & M_FLOWID)) {
+		(*netp)->flowid = m->m_pkthdr.flowid;
+	}
 	/*
 	 * Ok, we built an association so confirm the address we sent the
 	 * INIT-ACK to.
@@ -5840,6 +5843,9 @@ sctp_skip_csum_4:
 		}
 		net->port = port;
 	}
+	if ((net != NULL) && (m->m_flags & M_FLOWID)) {
+		net->flowid = m->m_pkthdr.flowid;
+	}
 	/* inp's ref-count increased && stcb locked */
 	if (inp == NULL) {
 		struct sctp_init_chunk *init_chk, chunk_buf;

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Sat Feb  5 19:13:34 2011	(r218334)
+++ head/sys/netinet/sctp_output.c	Sat Feb  5 19:13:38 2011	(r218335)
@@ -3419,7 +3419,8 @@ sctp_lowlevel_chunk_output(struct sctp_i
 #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
     SCTP_UNUSED
 #endif
-    union sctp_sockstore *over_addr
+    union sctp_sockstore *over_addr,
+    struct mbuf *init
 )
 /* nofragment_flag to tell if IP_DF should be set (IPv4 only) */
 {
@@ -3483,6 +3484,15 @@ sctp_lowlevel_chunk_output(struct sctp_i
 		SCTP_BUF_LEN(newm) = len;
 		SCTP_BUF_NEXT(newm) = m;
 		m = newm;
+		if (net != NULL) {
+			m->m_pkthdr.flowid = net->flowid;
+			m->m_flags |= M_FLOWID;
+		} else {
+			if ((init != NULL) && (init->m_flags & M_FLOWID)) {
+				m->m_pkthdr.flowid = init->m_pkthdr.flowid;
+				m->m_flags |= M_FLOWID;
+			}
+		}
 		packet_length = sctp_calculate_len(m);
 		ip = mtod(m, struct ip *);
 		ip->ip_v = IPVERSION;
@@ -3804,6 +3814,15 @@ sctp_lowlevel_chunk_output(struct sctp_i
 		SCTP_BUF_LEN(newm) = len;
 		SCTP_BUF_NEXT(newm) = m;
 		m = newm;
+		if (net != NULL) {
+			m->m_pkthdr.flowid = net->flowid;
+			m->m_flags |= M_FLOWID;
+		} else {
+			if ((init != NULL) && (init->m_flags & M_FLOWID)) {
+				m->m_pkthdr.flowid = init->m_pkthdr.flowid;
+				m->m_flags |= M_FLOWID;
+			}
+		}
 		packet_length = sctp_calculate_len(m);
 
 		ip6h = mtod(m, struct ip6_hdr *);
@@ -4365,7 +4384,7 @@ sctp_send_initiate(struct sctp_inpcb *in
 	    (struct sockaddr *)&net->ro._l_addr,
 	    m, 0, NULL, 0, 0, 0, NULL, 0,
 	    inp->sctp_lport, stcb->rport, htonl(0),
-	    net->port, so_locked, NULL);
+	    net->port, so_locked, NULL, NULL);
 	SCTPDBG(SCTP_DEBUG_OUTPUT4, "lowlevel_output - %d\n", ret);
 	SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
 	(void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time);
@@ -5536,7 +5555,7 @@ do_a_abort:
 	(void)sctp_lowlevel_chunk_output(inp, NULL, NULL, to, m, 0, NULL, 0, 0,
 	    0, NULL, 0,
 	    inp->sctp_lport, sh->src_port, init_chk->init.initiate_tag,
-	    port, SCTP_SO_NOT_LOCKED, over_addr);
+	    port, SCTP_SO_NOT_LOCKED, over_addr, init_pkt);
 	SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
 }
 
@@ -7564,7 +7583,7 @@ again_one_more_time:
 					    no_fragmentflg, 0, NULL, asconf,
 					    inp->sctp_lport, stcb->rport,
 					    htonl(stcb->asoc.peer_vtag),
-					    net->port, so_locked, NULL))) {
+					    net->port, so_locked, NULL, NULL))) {
 						if (error == ENOBUFS) {
 							asoc->ifp_had_enobuf = 1;
 							SCTP_STAT_INCR(sctps_lowlevelerr);
@@ -7820,7 +7839,7 @@ again_one_more_time:
 					    no_fragmentflg, 0, NULL, asconf,
 					    inp->sctp_lport, stcb->rport,
 					    htonl(stcb->asoc.peer_vtag),
-					    net->port, so_locked, NULL))) {
+					    net->port, so_locked, NULL, NULL))) {
 						if (error == ENOBUFS) {
 							asoc->ifp_had_enobuf = 1;
 							SCTP_STAT_INCR(sctps_lowlevelerr);
@@ -8151,7 +8170,7 @@ no_data_fill:
 			    asconf,
 			    inp->sctp_lport, stcb->rport,
 			    htonl(stcb->asoc.peer_vtag),
-			    net->port, so_locked, NULL))) {
+			    net->port, so_locked, NULL, NULL))) {
 				/* error, we could not output */
 				if (error == ENOBUFS) {
 					SCTP_STAT_INCR(sctps_lowlevelerr);
@@ -8861,7 +8880,7 @@ sctp_chunk_retransmission(struct sctp_in
 		    auth_offset, auth, stcb->asoc.authinfo.active_keyid,
 		    no_fragmentflg, 0, NULL, 0,
 		    inp->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag),
-		    chk->whoTo->port, so_locked, NULL))) {
+		    chk->whoTo->port, so_locked, NULL, NULL))) {
 			SCTP_STAT_INCR(sctps_lowlevelerr);
 			return (error);
 		}
@@ -9119,7 +9138,7 @@ one_chunk_around:
 			    auth_offset, auth, auth_keyid,
 			    no_fragmentflg, 0, NULL, 0,
 			    inp->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag),
-			    net->port, so_locked, NULL))) {
+			    net->port, so_locked, NULL, NULL))) {
 				/* error, we could not output */
 				SCTP_STAT_INCR(sctps_lowlevelerr);
 				return (error);
@@ -10232,7 +10251,7 @@ sctp_send_abort_tcb(struct sctp_tcb *stc
 	    (struct sockaddr *)&stcb->asoc.primary_destination->ro._l_addr,
 	    m_out, auth_offset, auth, stcb->asoc.authinfo.active_keyid, 1, 0, NULL, 0,
 	    stcb->sctp_ep->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag),
-	    stcb->asoc.primary_destination->port, so_locked, NULL);
+	    stcb->asoc.primary_destination->port, so_locked, NULL, NULL);
 	SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
 }
 
@@ -10269,7 +10288,7 @@ sctp_send_shutdown_complete(struct sctp_
 	    m_shutdown_comp, 0, NULL, 0, 1, 0, NULL, 0,
 	    stcb->sctp_ep->sctp_lport, stcb->rport,
 	    htonl(vtag),
-	    net->port, SCTP_SO_NOT_LOCKED, NULL);
+	    net->port, SCTP_SO_NOT_LOCKED, NULL, NULL);
 	SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
 	return;
 }
@@ -10314,6 +10333,10 @@ sctp_send_shutdown_complete2(struct mbuf
 	SCTP_BUF_RESV_UF(mout, max_linkhdr);
 	SCTP_BUF_LEN(mout) = len;
 	SCTP_BUF_NEXT(mout) = NULL;
+	if (m->m_flags & M_FLOWID) {
+		mout->m_pkthdr.flowid = m->m_pkthdr.flowid;
+		mout->m_flags |= M_FLOWID;
+	}
 	iph_out = NULL;
 #ifdef INET6
 	ip6_out = NULL;
@@ -11378,6 +11401,10 @@ sctp_send_abort(struct mbuf *m, int iphl
 	SCTP_BUF_RESV_UF(mout, max_linkhdr);
 	SCTP_BUF_LEN(mout) = len;
 	SCTP_BUF_NEXT(mout) = err_cause;
+	if (m->m_flags & M_FLOWID) {
+		mout->m_pkthdr.flowid = m->m_pkthdr.flowid;
+		mout->m_flags |= M_FLOWID;
+	}
 	iph_out = NULL;
 #ifdef INET6
 	ip6_out = NULL;
@@ -11623,6 +11650,10 @@ sctp_send_operr_to(struct mbuf *m, int i
 	SCTP_BUF_RESV_UF(mout, max_linkhdr);
 	SCTP_BUF_LEN(mout) = len;
 	SCTP_BUF_NEXT(mout) = scm;
+	if (m->m_flags & M_FLOWID) {
+		mout->m_pkthdr.flowid = m->m_pkthdr.flowid;
+		mout->m_flags |= M_FLOWID;
+	}
 	iph_out = NULL;
 #ifdef INET6
 	ip6_out = NULL;

Modified: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c	Sat Feb  5 19:13:34 2011	(r218334)
+++ head/sys/netinet/sctp_pcb.c	Sat Feb  5 19:13:38 2011	(r218335)
@@ -4035,6 +4035,10 @@ sctp_add_remote_addr(struct sctp_tcb *st
 		TAILQ_INSERT_HEAD(&stcb->asoc.nets,
 		    stcb->asoc.primary_destination, sctp_next);
 	}
+	/* Choose an initial flowid. */
+	net->flowid = stcb->asoc.my_vtag ^
+	    ntohs(stcb->rport) ^
+	    ntohs(stcb->sctp_ep->sctp_lport);
 	return (0);
 }
 

Modified: head/sys/netinet/sctp_structs.h
==============================================================================
--- head/sys/netinet/sctp_structs.h	Sat Feb  5 19:13:34 2011	(r218334)
+++ head/sys/netinet/sctp_structs.h	Sat Feb  5 19:13:38 2011	(r218335)
@@ -350,6 +350,7 @@ struct sctp_nets {
 	uint8_t lan_type;
 	/* JRS - struct used in HTCP algorithm */
 	struct htcp htcp_ca;
+	uint32_t flowid;
 };
 
 

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  5 21:21:28 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 55E84106566B;
	Sat,  5 Feb 2011 21:21:28 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 453038FC17;
	Sat,  5 Feb 2011 21:21:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p15LLSwZ041296;
	Sat, 5 Feb 2011 21:21:28 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p15LLSci041290;
	Sat, 5 Feb 2011 21:21:28 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <201102052121.p15LLSci041290@svn.freebsd.org>
From: Alan Cox 
Date: Sat, 5 Feb 2011 21:21:28 +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: r218345 - in head/sys: fs/nfsserver nfsserver
	security/mac vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Feb 2011 21:21:28 -0000

Author: alc
Date: Sat Feb  5 21:21:27 2011
New Revision: 218345
URL: http://svn.freebsd.org/changeset/base/218345

Log:
  Unless "cnt" exceeds MAX_COMMIT_COUNT, nfsrv_commit() and nfsvno_fsync() are
  incorrectly calling vm_object_page_clean().  They are passing the length of
  the range rather than the ending offset of the range.
  
  Perform the OFF_TO_IDX() conversion in vm_object_page_clean() rather than the
  callers.
  
  Reviewed by:	kib
  MFC after:	3 weeks

Modified:
  head/sys/fs/nfsserver/nfs_nfsdport.c
  head/sys/nfsserver/nfs_serv.c
  head/sys/security/mac/mac_process.c
  head/sys/vm/vm_object.c
  head/sys/vm/vm_object.h

Modified: head/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- head/sys/fs/nfsserver/nfs_nfsdport.c	Sat Feb  5 21:02:13 2011	(r218344)
+++ head/sys/fs/nfsserver/nfs_nfsdport.c	Sat Feb  5 21:21:27 2011	(r218345)
@@ -1225,7 +1225,8 @@ nfsvno_fsync(struct vnode *vp, u_int64_t
 		if (vp->v_object &&
 		   (vp->v_object->flags & OBJ_MIGHTBEDIRTY)) {
 			VM_OBJECT_LOCK(vp->v_object);
-			vm_object_page_clean(vp->v_object, off / PAGE_SIZE, (cnt + PAGE_MASK) / PAGE_SIZE, OBJPC_SYNC);
+			vm_object_page_clean(vp->v_object, off, off + cnt,
+			    OBJPC_SYNC);
 			VM_OBJECT_UNLOCK(vp->v_object);
 		}
 

Modified: head/sys/nfsserver/nfs_serv.c
==============================================================================
--- head/sys/nfsserver/nfs_serv.c	Sat Feb  5 21:02:13 2011	(r218344)
+++ head/sys/nfsserver/nfs_serv.c	Sat Feb  5 21:21:27 2011	(r218345)
@@ -3480,7 +3480,8 @@ nfsrv_commit(struct nfsrv_descript *nfsd
 		if (vp->v_object &&
 		   (vp->v_object->flags & OBJ_MIGHTBEDIRTY)) {
 			VM_OBJECT_LOCK(vp->v_object);
-			vm_object_page_clean(vp->v_object, off / PAGE_SIZE, (cnt + PAGE_MASK) / PAGE_SIZE, OBJPC_SYNC);
+			vm_object_page_clean(vp->v_object, off, off + cnt,
+			    OBJPC_SYNC);
 			VM_OBJECT_UNLOCK(vp->v_object);
 		}
 

Modified: head/sys/security/mac/mac_process.c
==============================================================================
--- head/sys/security/mac/mac_process.c	Sat Feb  5 21:02:13 2011	(r218344)
+++ head/sys/security/mac/mac_process.c	Sat Feb  5 21:21:27 2011	(r218345)
@@ -338,11 +338,8 @@ mac_proc_vm_revoke_recurse(struct thread
 				(void) vn_start_write(vp, &mp, V_WAIT);
 				vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 				VM_OBJECT_LOCK(object);
-				vm_object_page_clean(object,
-				    OFF_TO_IDX(offset),
-				    OFF_TO_IDX(offset + vme->end - vme->start +
-					PAGE_MASK),
-				    OBJPC_SYNC);
+				vm_object_page_clean(object, offset, offset +
+				    vme->end - vme->start, OBJPC_SYNC);
 				VM_OBJECT_UNLOCK(object);
 				VOP_UNLOCK(vp, 0);
 				vn_finished_write(mp);

Modified: head/sys/vm/vm_object.c
==============================================================================
--- head/sys/vm/vm_object.c	Sat Feb  5 21:02:13 2011	(r218344)
+++ head/sys/vm/vm_object.c	Sat Feb  5 21:21:27 2011	(r218345)
@@ -795,11 +795,11 @@ vm_object_page_remove_write(vm_page_t p,
  *	The object must be locked.
  */
 void
-vm_object_page_clean(vm_object_t object, vm_pindex_t start, vm_pindex_t end,
+vm_object_page_clean(vm_object_t object, vm_ooffset_t start, vm_ooffset_t end,
     int flags)
 {
 	vm_page_t np, p;
-	vm_pindex_t pi, tend;
+	vm_pindex_t pi, tend, tstart;
 	int clearobjflags, curgeneration, n, pagerflags;
 
 	mtx_assert(&vm_page_queue_mtx, MA_NOTOWNED);
@@ -813,13 +813,14 @@ vm_object_page_clean(vm_object_t object,
 	    VM_PAGER_PUT_SYNC : VM_PAGER_CLUSTER_OK;
 	pagerflags |= (flags & OBJPC_INVAL) != 0 ? VM_PAGER_PUT_INVAL : 0;
 
-	tend = (end == 0) ? object->size : end;
-	clearobjflags = start == 0 && tend == object->size;
+	tstart = OFF_TO_IDX(start);
+	tend = (end == 0) ? object->size : OFF_TO_IDX(end + PAGE_MASK);
+	clearobjflags = tstart == 0 && tend >= object->size;
 
 rescan:
 	curgeneration = object->generation;
 
-	for (p = vm_page_find_least(object, start); p != NULL; p = np) {
+	for (p = vm_page_find_least(object, tstart); p != NULL; p = np) {
 		pi = p->pindex;
 		if (pi >= tend)
 			break;
@@ -941,10 +942,7 @@ vm_object_sync(vm_object_t object, vm_oo
 		flags = (syncio || invalidate) ? OBJPC_SYNC : 0;
 		flags |= invalidate ? OBJPC_INVAL : 0;
 		VM_OBJECT_LOCK(object);
-		vm_object_page_clean(object,
-		    OFF_TO_IDX(offset),
-		    OFF_TO_IDX(offset + size + PAGE_MASK),
-		    flags);
+		vm_object_page_clean(object, offset, offset + size, flags);
 		VM_OBJECT_UNLOCK(object);
 		VOP_UNLOCK(vp, 0);
 		VFS_UNLOCK_GIANT(vfslocked);

Modified: head/sys/vm/vm_object.h
==============================================================================
--- head/sys/vm/vm_object.h	Sat Feb  5 21:02:13 2011	(r218344)
+++ head/sys/vm/vm_object.h	Sat Feb  5 21:21:27 2011	(r218345)
@@ -217,7 +217,8 @@ void vm_object_destroy (vm_object_t);
 void vm_object_terminate (vm_object_t);
 void vm_object_set_writeable_dirty (vm_object_t);
 void vm_object_init (void);
-void vm_object_page_clean (vm_object_t, vm_pindex_t, vm_pindex_t, boolean_t);
+void vm_object_page_clean(vm_object_t object, vm_ooffset_t start,
+    vm_ooffset_t end, int flags);
 void vm_object_page_remove (vm_object_t, vm_pindex_t, vm_pindex_t, boolean_t);
 boolean_t vm_object_populate(vm_object_t, vm_pindex_t, vm_pindex_t);
 void vm_object_print(long addr, boolean_t have_addr, long count, char *modif);

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  5 21:43:37 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A62F41065672;
	Sat,  5 Feb 2011 21:43:37 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 94C098FC14;
	Sat,  5 Feb 2011 21:43:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p15Lhba3042044;
	Sat, 5 Feb 2011 21:43:37 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p15Lhbo8042042;
	Sat, 5 Feb 2011 21:43:37 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201102052143.p15Lhbo8042042@svn.freebsd.org>
From: Doug Barton 
Date: Sat, 5 Feb 2011 21:43:37 +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: r218350 - head/etc/namedb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Feb 2011 21:43:37 -0000

Author: dougb
Date: Sat Feb  5 21:43:37 2011
New Revision: 218350
URL: http://svn.freebsd.org/changeset/base/218350

Log:
  Catch up with reality and references from the latest RFCs
  (especially 5735) for our default empty zones.

Modified:
  head/etc/namedb/named.conf

Modified: head/etc/namedb/named.conf
==============================================================================
--- head/etc/namedb/named.conf	Sat Feb  5 21:40:57 2011	(r218349)
+++ head/etc/namedb/named.conf	Sat Feb  5 21:43:37 2011	(r218350)
@@ -125,7 +125,7 @@ zone "in-addr.arpa" {
 	1. Faster local resolution for your users
 	2. No spurious traffic will be sent from your network to the roots
 */
-// RFC 1912 (and BCP 32 for localhost)
+// RFCs 1912 and 5735 (and BCP 32 for localhost)
 zone "localhost"	{ type master; file "/etc/namedb/master/localhost-forward.db"; };
 zone "127.in-addr.arpa"	{ type master; file "/etc/namedb/master/localhost-reverse.db"; };
 zone "255.in-addr.arpa"	{ type master; file "/etc/namedb/master/empty.db"; };
@@ -133,10 +133,10 @@ zone "255.in-addr.arpa"	{ type master; f
 // RFC 1912-style zone for IPv6 localhost address
 zone "0.ip6.arpa"	{ type master; file "/etc/namedb/master/localhost-reverse.db"; };
 
-// "This" Network (RFCs 1912 and 3330)
+// "This" Network (RFCs 1912 and 5735)
 zone "0.in-addr.arpa"	{ type master; file "/etc/namedb/master/empty.db"; };
 
-// Private Use Networks (RFC 1918)
+// Private Use Networks (RFCs 1918 and 5735)
 zone "10.in-addr.arpa"	   { type master; file "/etc/namedb/master/empty.db"; };
 zone "16.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
 zone "17.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
@@ -156,16 +156,19 @@ zone "30.172.in-addr.arpa" { type master
 zone "31.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
 zone "168.192.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
 
-// Link-local/APIPA (RFCs 3330 and 3927)
+// Link-local/APIPA (RFCs 3927 and 5735)
 zone "254.169.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
 
-// TEST-NET-[1-3] for Documentation (RFC 5737)
+// IETF protocol assignments (RFCs 5735 and 5736)
+zone "0.0.192.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
+
+// TEST-NET-[1-3] for Documentation (RFCs 5735 and 5737)
 zone "2.0.192.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
 zone "100.51.198.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
 zone "113.0.203.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
 
 // IPv6 Range for Documentation (RFC 3849)
-zone "0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa" { type master; file "/etc/namedb/master/empty.db"; };
+zone "8.b.d.0.1.0.0.2.ip6.arpa" { type master; file "/etc/namedb/master/empty.db"; };
 
 // Domain Names for Documentation and Testing (BCP 32)
 zone "test" { type master; file "/etc/namedb/master/empty.db"; };
@@ -175,11 +178,11 @@ zone "example.com" { type master; file "
 zone "example.net" { type master; file "/etc/namedb/master/empty.db"; };
 zone "example.org" { type master; file "/etc/namedb/master/empty.db"; };
 
-// Router Benchmark Testing (RFC 3330)
+// Router Benchmark Testing (RFCs 2544 and 5735)
 zone "18.198.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
 zone "19.198.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
 
-// IANA Reserved - Old Class E Space
+// IANA Reserved - Old Class E Space (RFC 5735)
 zone "240.in-addr.arpa"	{ type master; file "/etc/namedb/master/empty.db"; };
 zone "241.in-addr.arpa"	{ type master; file "/etc/namedb/master/empty.db"; };
 zone "242.in-addr.arpa"	{ type master; file "/etc/namedb/master/empty.db"; };

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  5 22:54:37 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 894B81065674;
	Sat,  5 Feb 2011 22:54:37 +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 784CB8FC08;
	Sat,  5 Feb 2011 22:54:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p15MsbRD044122;
	Sat, 5 Feb 2011 22:54:37 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p15Msbrk044120;
	Sat, 5 Feb 2011 22:54:37 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201102052254.p15Msbrk044120@svn.freebsd.org>
From: Adrian Chadd 
Date: Sat, 5 Feb 2011 22:54:37 +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: r218354 - head/sys/dev/ath/ath_hal/ar5416
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Feb 2011 22:54:37 -0000

Author: adrian
Date: Sat Feb  5 22:54:37 2011
New Revision: 218354
URL: http://svn.freebsd.org/changeset/base/218354

Log:
  Add a temporary workaround so the 11n rate scenario setup code sets a useful
  TX chainmask.
  
  since the upper layers don't (yet) know about the active TX/RX chainmasks,
  it can't tell the rate scenario functions what to use. I'll eventually sort
  this out; this restores functionality in the meantime.

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c	Sat Feb  5 22:04:20 2011	(r218353)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c	Sat Feb  5 22:54:37 2011	(r218354)
@@ -621,6 +621,20 @@ ar5416Set11nRateScenario(struct ath_hal 
 	(void)nseries;
 
 	/*
+	 * XXX since the upper layers doesn't know the current chainmask
+	 * XXX setup, just override its decisions here.
+	 * XXX The upper layers need to be taught this!
+	 */
+	if (series[0].Tries != 0)
+		series[0].ChSel = AH5416(ah)->ah_tx_chainmask;
+	if (series[1].Tries != 0)
+		series[1].ChSel = AH5416(ah)->ah_tx_chainmask;
+	if (series[2].Tries != 0)
+		series[2].ChSel = AH5416(ah)->ah_tx_chainmask;
+	if (series[3].Tries != 0)
+		series[3].ChSel = AH5416(ah)->ah_tx_chainmask;
+
+	/*
 	 * Only one of RTS and CTS enable must be set.
 	 * If a frame has both set, just do RTS protection -
 	 * that's enough to satisfy legacy protection.
@@ -642,7 +656,6 @@ ar5416Set11nRateScenario(struct ath_hal 
 		    (ads->ds_ctl0 & ~(AR_RTSEnable | AR_CTSEnable));
 	}
 
-
 	ads->ds_ctl2 = set11nTries(series, 0)
 		     | set11nTries(series, 1)
 		     | set11nTries(series, 2)

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  5 23:00:25 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2F35E1065672;
	Sat,  5 Feb 2011 23:00:25 +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 037F88FC18;
	Sat,  5 Feb 2011 23:00:25 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p15N0OP9044371;
	Sat, 5 Feb 2011 23:00:24 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p15N0ONn044367;
	Sat, 5 Feb 2011 23:00:24 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201102052300.p15N0ONn044367@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sat, 5 Feb 2011 23:00:24 +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: r218356 - head/tools/regression/bin/sh/builtins
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Feb 2011 23:00:25 -0000

Author: jilles
Date: Sat Feb  5 23:00:24 2011
New Revision: 218356
URL: http://svn.freebsd.org/changeset/base/218356

Log:
  sh: Weaken some tests to allow /rescue/sh to pass everything.
  
  /rescue/sh has a different _PATH_STDPATH which affects command -p.

Modified:
  head/tools/regression/bin/sh/builtins/command6.0
  head/tools/regression/bin/sh/builtins/command6.0.stdout
  head/tools/regression/bin/sh/builtins/command7.0

Modified: head/tools/regression/bin/sh/builtins/command6.0
==============================================================================
--- head/tools/regression/bin/sh/builtins/command6.0	Sat Feb  5 22:57:14 2011	(r218355)
+++ head/tools/regression/bin/sh/builtins/command6.0	Sat Feb  5 23:00:24 2011	(r218356)
@@ -1,6 +1,12 @@
 # $FreeBSD$
 PATH=/var/empty
-command -pV ls
+case $(command -pV ls) in
+*/var/empty/ls*)
+	echo "Failed: \$(command -pV ls) should not match */var/empty/ls*" ;;
+"ls is"*" "/*/ls) ;;
+*)
+	echo "Failed: \$(command -pV ls) match \"ls is\"*\" \"/*/ls" ;;
+esac
 command -pV true
 command -pV /bin/ls
 

Modified: head/tools/regression/bin/sh/builtins/command6.0.stdout
==============================================================================
--- head/tools/regression/bin/sh/builtins/command6.0.stdout	Sat Feb  5 22:57:14 2011	(r218355)
+++ head/tools/regression/bin/sh/builtins/command6.0.stdout	Sat Feb  5 23:00:24 2011	(r218356)
@@ -1,4 +1,3 @@
-ls is /bin/ls
 true is a shell builtin
 /bin/ls is /bin/ls
 fun is a shell function

Modified: head/tools/regression/bin/sh/builtins/command7.0
==============================================================================
--- head/tools/regression/bin/sh/builtins/command7.0	Sat Feb  5 22:57:14 2011	(r218355)
+++ head/tools/regression/bin/sh/builtins/command7.0	Sat Feb  5 23:00:24 2011	(r218356)
@@ -24,6 +24,11 @@ check '"$(command -pv ld-elf.so.1; :)" =
 PATH=/libexec
 
 check '"$(command -v ls)" = ""'
-check '"$(command -pv ls)" = "/bin/ls"'
+case $(command -pv ls) in
+/*/ls) ;;
+*)
+	echo "Failed: \$(command -pv ls) match /*/ls"
+	: $((failures += 1)) ;;
+esac
 
 exit $((failures > 0))

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  5 23:03:40 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A7BB7106566B;
	Sat,  5 Feb 2011 23:03:40 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7CBC58FC08;
	Sat,  5 Feb 2011 23:03:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p15N3eIF044571;
	Sat, 5 Feb 2011 23:03:40 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p15N3eL5044569;
	Sat, 5 Feb 2011 23:03:40 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <201102052303.p15N3eL5044569@svn.freebsd.org>
From: Luigi Rizzo 
Date: Sat, 5 Feb 2011 23:03:40 +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: r218359 - head/release/picobsd/build
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Feb 2011 23:03:40 -0000

Author: luigi
Date: Sat Feb  5 23:03:40 2011
New Revision: 218359
URL: http://svn.freebsd.org/changeset/base/218359

Log:
  following the recent (218130) changes to Makefile and Makefile.inc1,
  we need to set TARGET and TARGET_ARCH to get a correct WMAKEENV.
  I am setting both to i386 since this is what picobsd is used for,
  though there might be a better fix.
  
  Add initial support for parallel make. This is disabled right now,
  because there are incorrect dependencies somewhere which require
  to run picobsd 2-3 times to complete a build.
  
  MFC after:	2 weeks

Modified:
  head/release/picobsd/build/picobsd

Modified: head/release/picobsd/build/picobsd
==============================================================================
--- head/release/picobsd/build/picobsd	Sat Feb  5 23:02:55 2011	(r218358)
+++ head/release/picobsd/build/picobsd	Sat Feb  5 23:03:40 2011	(r218359)
@@ -176,9 +176,9 @@ create_includes_and_libraries2() { # opt
     ( cd ${SRC};
     # make -DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R -DPICOBSD buildworld
     if [ -d "$1" ] ; then
-	cd $1 ; ${BINMAKE} $2	# specific target, e.g. ld-elf.so
+	cd $1 ; ${BINMAKE} ${o_par} $2	# specific target, e.g. ld-elf.so
     else
-	${BINMAKE} _+_= $no toolchain _includes _libraries
+	${BINMAKE} ${o_par} _+_= $no toolchain _includes _libraries
     fi
     )
 }
@@ -452,7 +452,7 @@ do_kernel() {		# OK
     (cd $MY_TREE; export name SRC BUILDDIR # used in this makefile ;
 	# export CONFIG
 	[ "${o_do_modules}" = "yes" ] && export MODULES=""
-	${BINMAKE} -v -f ${PICO_TREE}/build/Makefile.conf ) || \
+	${BINMAKE} ${o_par} -v -f ${PICO_TREE}/build/Makefile.conf ) || \
 	fail $? missing_kernel
 }
 
@@ -981,6 +981,7 @@ set_build_parameters() {
     log "OSVERSION is ${OSVERSION}"
     if [ ${OSVERSION} -ge 500035 ] ; then
 	export MAKEOBJDIRPREFIX=${l_objtree}
+	export TARGET_ARCH=i386 TARGET=i386
 	eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V BINMAKE`\""
 	eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV`
     fi
@@ -1020,6 +1021,8 @@ set_build_parameters() {
 # Main entry of the script. Initialize variables, parse command line
 # arguments.
 
+# o_par="-j 8"	# parallel make and other make options
+
 set_defaults
 while [ true ]; do
     log "Parsing $1"

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  5 23:32:18 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F24FF106566C;
	Sat,  5 Feb 2011 23:32:17 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E0EB68FC08;
	Sat,  5 Feb 2011 23:32:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p15NWHg1045227;
	Sat, 5 Feb 2011 23:32:17 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id p15NWHHE045225;
	Sat, 5 Feb 2011 23:32:17 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <201102052332.p15NWHHE045225@svn.freebsd.org>
From: Luigi Rizzo 
Date: Sat, 5 Feb 2011 23:32: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: r218360 - head/sys/netinet/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Feb 2011 23:32:18 -0000

Author: luigi
Date: Sat Feb  5 23:32:17 2011
New Revision: 218360
URL: http://svn.freebsd.org/changeset/base/218360

Log:
  correct the 'output_time' of packets generated by dummynet.
  In the dec.2009 rewrite I introduced a bug, using for the
  computation the arrival time instead of the time the packet
  has exited from the queue.
  The bandwidth computation was still correct because it is
  computed elsewhere, but traffic was sent out in bursts.
  
  The bug is also present in RELENG_8 after dec.2009
  
  Thanks to Daikichi Osuga for investingating, finding and fixing the
  bug with detailed graphs of the behaviour before and after the fix.
  
  Submitted by:	Daikichi Osuga
  MFC after:	2 weeks

Modified:
  head/sys/netinet/ipfw/ip_dn_io.c

Modified: head/sys/netinet/ipfw/ip_dn_io.c
==============================================================================
--- head/sys/netinet/ipfw/ip_dn_io.c	Sat Feb  5 23:03:40 2011	(r218359)
+++ head/sys/netinet/ipfw/ip_dn_io.c	Sat Feb  5 23:32:17 2011	(r218360)
@@ -471,7 +471,7 @@ serve_sched(struct mq *q, struct dn_sch_
 			(m->m_pkthdr.len * 8 + extra_bits(m, s));
 		si->credit -= len_scaled;
 		/* Move packet in the delay line */
-		dn_tag_get(m)->output_time += s->link.delay ;
+		dn_tag_get(m)->output_time = dn_cfg.curr_time + s->link.delay ;
 		mq_append(&si->dline.mq, m);
 	}