From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 24 08:17:23 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36DE0106564A; Sun, 24 Oct 2010 08:17:23 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 35BEE8FC16; Sun, 24 Oct 2010 08:17:20 +0000 (UTC) Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id LAA14191; Sun, 24 Oct 2010 11:17:19 +0300 (EEST) (envelope-from avg@freebsd.org) Received: from localhost.topspin.kiev.ua ([127.0.0.1]) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1P9vlX-000L6L-2E; Sun, 24 Oct 2010 11:17:19 +0300 Message-ID: <4CC3EB8E.9000701@freebsd.org> Date: Sun, 24 Oct 2010 11:17:18 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.11) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.5 MIME-Version: 1.0 To: Robert Watson References: <201010220846.o9M8kMEo020056@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r214199 - stable/8 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 08:17:23 -0000 on 23/10/2010 13:05 Robert Watson said the following: > > On Fri, 22 Oct 2010, Andriy Gapon wrote: > >> +20101022: >> + A workaround for a fixed ld bug has been removed in kernel code, >> + so make sure that your system ld is built from sources after >> + revision 211583 (r210245 if building stable/8 kernel on head, >> + r211584 for stable/7). A symptom of incorrect ld version is >> + different addresses for set_pcpu section and __start_set_pcpu >> + symbol in kernel and/or modules. > > Since many of our users still rely on cvsup to update FreeBSD source, it might > be useful to provide rough date thresholds for the branches in addition to the > Subversion changeset numbers (which are less easy to deal with when checking out > with cvsup/cvs). Good point. Will do. Thank you! -- Andriy Gapon From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 24 13:39:19 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A849B1065695; Sun, 24 Oct 2010 13:39:19 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 943128FC1C; Sun, 24 Oct 2010 13:39: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 o9ODdJQF029571; Sun, 24 Oct 2010 13:39:19 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9ODdJp1029552; Sun, 24 Oct 2010 13:39:19 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201010241339.o9ODdJp1029552@svn.freebsd.org> From: Marius Strobl Date: Sun, 24 Oct 2010 13:39:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214266 - in stable/8/sys/dev: dc mii X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 13:39:19 -0000 Author: marius Date: Sun Oct 24 13:39:19 2010 New Revision: 214266 URL: http://svn.freebsd.org/changeset/base/214266 Log: MFC: r213364 - In the spirit of previous simplifications factor out the checks for a different PHY instance being selected and isolation out into the wrappers around the service methods rather than duplicating them over and over again (besides, a PHY driver shouldn't need to care about which instance it actually is). - Centralize the check for the need to isolate a non-zero PHY instance not supporting isolation in mii_mediachg() and just ignore it rather than panicing, which should sufficient given that a) things are likely to just work anyway if one doesn't plug in more than one port at a time and b) refusing to attach in this case just leaves us in a unknown but most likely also not exactly correct configuration (besides several drivers setting MIIF_NOISOLATE didn't care about these anyway, probably due to setting this flag for no real reason). - Minor fixes like removing unnecessary setting of sc->mii_anegticks, using sc->mii_anegticks instead of hardcoded values etc. Modified: stable/8/sys/dev/dc/dcphy.c stable/8/sys/dev/dc/pnphy.c stable/8/sys/dev/mii/acphy.c stable/8/sys/dev/mii/amphy.c stable/8/sys/dev/mii/atphy.c stable/8/sys/dev/mii/axphy.c stable/8/sys/dev/mii/bmtphy.c stable/8/sys/dev/mii/brgphy.c stable/8/sys/dev/mii/ciphy.c stable/8/sys/dev/mii/e1000phy.c stable/8/sys/dev/mii/exphy.c stable/8/sys/dev/mii/gentbi.c stable/8/sys/dev/mii/icsphy.c stable/8/sys/dev/mii/inphy.c stable/8/sys/dev/mii/ip1000phy.c stable/8/sys/dev/mii/jmphy.c stable/8/sys/dev/mii/lxtphy.c stable/8/sys/dev/mii/mii.c stable/8/sys/dev/mii/mlphy.c stable/8/sys/dev/mii/nsgphy.c stable/8/sys/dev/mii/nsphy.c stable/8/sys/dev/mii/nsphyter.c stable/8/sys/dev/mii/pnaphy.c stable/8/sys/dev/mii/qsphy.c stable/8/sys/dev/mii/rgephy.c stable/8/sys/dev/mii/rlphy.c stable/8/sys/dev/mii/rlswitch.c stable/8/sys/dev/mii/ruephy.c stable/8/sys/dev/mii/smcphy.c stable/8/sys/dev/mii/tdkphy.c stable/8/sys/dev/mii/tlphy.c stable/8/sys/dev/mii/truephy.c stable/8/sys/dev/mii/ukphy.c stable/8/sys/dev/mii/xmphy.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/dc/dcphy.c ============================================================================== --- stable/8/sys/dev/dc/dcphy.c Sun Oct 24 12:59:43 2010 (r214265) +++ stable/8/sys/dev/dc/dcphy.c Sun Oct 24 13:39:19 2010 (r214266) @@ -149,7 +149,7 @@ dcphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = dcphy_service; sc->mii_pdata = mii; @@ -159,8 +159,6 @@ dcphy_attach(device_t dev) */ sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; - mii->mii_instance++; - /*dcphy_reset(sc);*/ dc_sc = mii->mii_ifp->if_softc; CSR_WRITE_4(dc_sc, DC_10BTSTAT, 0); @@ -204,22 +202,10 @@ dcphy_service(struct mii_softc *sc, stru switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); break; case MII_MEDIACHG: /* - * If the media indicates a different PHY instance, - * isolate ourselves. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); - - /* * If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) @@ -276,12 +262,6 @@ dcphy_service(struct mii_softc *sc, stru case MII_TICK: /* - * If we're not currently selected, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); - - /* * Is the interface even up? */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) Modified: stable/8/sys/dev/dc/pnphy.c ============================================================================== --- stable/8/sys/dev/dc/pnphy.c Sun Oct 24 12:59:43 2010 (r214265) +++ stable/8/sys/dev/dc/pnphy.c Sun Oct 24 13:39:19 2010 (r214266) @@ -132,7 +132,7 @@ pnphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = pnphy_service; sc->mii_pdata = mii; @@ -142,8 +142,6 @@ pnphy_attach(device_t dev) */ sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; - mii->mii_instance++; - sc->mii_capabilities = BMSR_100TXFDX | BMSR_100TXHDX | BMSR_10TFDX | BMSR_10THDX; sc->mii_capabilities &= ma->mii_capmask; @@ -162,22 +160,10 @@ pnphy_service(struct mii_softc *sc, stru switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); break; case MII_MEDIACHG: /* - * If the media indicates a different PHY instance, - * isolate ourselves. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); - - /* * If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) @@ -212,12 +198,6 @@ pnphy_service(struct mii_softc *sc, stru case MII_TICK: /* - * If we're not currently selected, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); - - /* * Is the interface even up? */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) Modified: stable/8/sys/dev/mii/acphy.c ============================================================================== --- stable/8/sys/dev/mii/acphy.c Sun Oct 24 12:59:43 2010 (r214265) +++ stable/8/sys/dev/mii/acphy.c Sun Oct 24 13:39:19 2010 (r214266) @@ -132,17 +132,14 @@ acphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = acphy_service; sc->mii_pdata = mii; - mii->mii_instance++; - acphy_reset(sc); - sc->mii_capabilities = - PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) @@ -167,22 +164,8 @@ acphy_attach(device_t dev) static int acphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { - struct ifmedia_entry *ife = mii->mii_media.ifm_cur; int reg; - /* - * If we're not selected, then do nothing, just isolate and power - * down, if changing media. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - if (cmd == MII_MEDIACHG) { - reg = PHY_READ(sc, MII_BMCR); - PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO | BMCR_PDOWN); - } - - return (0); - } - switch (cmd) { case MII_POLLSTAT: break; Modified: stable/8/sys/dev/mii/amphy.c ============================================================================== --- stable/8/sys/dev/mii/amphy.c Sun Oct 24 12:59:43 2010 (r214265) +++ stable/8/sys/dev/mii/amphy.c Sun Oct 24 13:39:19 2010 (r214266) @@ -109,13 +109,11 @@ amphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = amphy_service; sc->mii_pdata = mii; - mii->mii_instance++; - #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) #if 0 @@ -125,8 +123,7 @@ amphy_attach(device_t dev) mii_phy_reset(sc); - sc->mii_capabilities = - PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); mii_phy_add_media(sc); printf("\n"); @@ -138,30 +135,13 @@ amphy_attach(device_t dev) static int amphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { - struct ifmedia_entry *ife = mii->mii_media.ifm_cur; - int reg; switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); break; case MII_MEDIACHG: /* - * If the media indicates a different PHY instance, - * isolate ourselves. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - reg = PHY_READ(sc, MII_BMCR); - PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO); - return (0); - } - - /* * If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) @@ -171,11 +151,6 @@ amphy_service(struct mii_softc *sc, stru break; case MII_TICK: - /* - * If we're not currently selected, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); if (mii_phy_tick(sc) == EJUSTRETURN) return (0); break; Modified: stable/8/sys/dev/mii/atphy.c ============================================================================== --- stable/8/sys/dev/mii/atphy.c Sun Oct 24 12:59:43 2010 (r214265) +++ stable/8/sys/dev/mii/atphy.c Sun Oct 24 13:39:19 2010 (r214266) @@ -113,13 +113,10 @@ atphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = atphy_service; sc->mii_pdata = mii; - sc->mii_anegticks = MII_ANEGTICKS_GIGE; - - mii->mii_instance++; asc->mii_oui = MII_OUI(ma->mii_id1, ma->mii_id2); asc->mii_model = MII_MODEL(ma->mii_id2); @@ -138,7 +135,7 @@ atphy_attach(device_t dev) printf("\n"); MIIBUS_MEDIAINIT(sc->mii_dev); - return(0); + return (0); } static int @@ -149,25 +146,10 @@ atphy_service(struct mii_softc *sc, stru switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); break; case MII_MEDIACHG: /* - * If the media indicates a different PHY instance, - * isolate ourselves. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - bmcr = PHY_READ(sc, MII_BMCR); - PHY_WRITE(sc, MII_BMCR, bmcr | BMCR_ISO); - return (0); - } - - /* * If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) @@ -225,12 +207,6 @@ done: case MII_TICK: /* - * If we're not currently selected, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); - - /* * Is the interface even up? */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) Modified: stable/8/sys/dev/mii/axphy.c ============================================================================== --- stable/8/sys/dev/mii/axphy.c Sun Oct 24 12:59:43 2010 (r214265) +++ stable/8/sys/dev/mii/axphy.c Sun Oct 24 13:39:19 2010 (r214266) @@ -99,12 +99,12 @@ axphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = axphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOISOLATE; - mii->mii_instance++; mii_phy_reset(sc); @@ -122,22 +122,12 @@ axphy_attach(device_t dev) static int axphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { - struct ifmedia_entry *ife = mii->mii_media.ifm_cur; - int reg; switch (cmd) { case MII_POLLSTAT: - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); break; case MII_MEDIACHG: - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - reg = PHY_READ(sc, MII_BMCR); - PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO); - return (0); - } - /* * If the interface is not up, don't do anything. */ @@ -148,8 +138,6 @@ axphy_service(struct mii_softc *sc, stru break; case MII_TICK: - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); if (mii_phy_tick(sc) == EJUSTRETURN) return (0); break; Modified: stable/8/sys/dev/mii/bmtphy.c ============================================================================== --- stable/8/sys/dev/mii/bmtphy.c Sun Oct 24 12:59:43 2010 (r214265) +++ stable/8/sys/dev/mii/bmtphy.c Sun Oct 24 13:39:19 2010 (r214266) @@ -147,17 +147,14 @@ bmtphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = bmtphy_service; sc->mii_pdata = mii; mii_phy_reset(sc); - mii->mii_instance++; - - sc->mii_capabilities = - PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); mii_phy_add_media(sc); printf("\n"); @@ -170,32 +167,13 @@ bmtphy_attach(device_t dev) static int bmtphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { - struct ifmedia_entry *ife; - int reg; - - ife = mii->mii_media.ifm_cur; switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); break; case MII_MEDIACHG: /* - * If the media indicates a different PHY instance, - * isolate ourselves. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - reg = PHY_READ(sc, MII_BMCR); - PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO); - return (0); - } - - /* * If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) @@ -205,11 +183,6 @@ bmtphy_service(struct mii_softc *sc, str break; case MII_TICK: - /* - * If we're not currently selected, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); if (mii_phy_tick(sc) == EJUSTRETURN) return (0); break; Modified: stable/8/sys/dev/mii/brgphy.c ============================================================================== --- stable/8/sys/dev/mii/brgphy.c Sun Oct 24 12:59:43 2010 (r214265) +++ stable/8/sys/dev/mii/brgphy.c Sun Oct 24 13:39:19 2010 (r214266) @@ -191,13 +191,17 @@ brgphy_attach(device_t dev) LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); /* Initialize mii_softc structure */ - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = brgphy_service; sc->mii_pdata = mii; - sc->mii_anegticks = MII_ANEGTICKS_GIGE; + + /* + * At least some variants wedge when isolating, at least some also + * don't support loopback. + */ sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; - mii->mii_instance++; + sc->mii_anegticks = MII_ANEGTICKS_GIGE; /* Initialize brgphy_softc structure */ bsc->mii_oui = MII_OUI(ma->mii_id1, ma->mii_id2); @@ -283,9 +287,6 @@ brgphy_attach(device_t dev) #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) - /* Create an instance of Ethernet media. */ - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst), BMCR_ISO); - /* Add the supported media types */ if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst), @@ -345,26 +346,12 @@ brgphy_service(struct mii_softc *sc, str { struct brgphy_softc *bsc = (struct brgphy_softc *)sc; struct ifmedia_entry *ife = mii->mii_media.ifm_cur; - int error = 0; int val; switch (cmd) { case MII_POLLSTAT: - /* If we're not polling our PHY instance, just return. */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - goto brgphy_service_exit; break; case MII_MEDIACHG: - /* - * If the media indicates a different PHY instance, - * isolate ourselves. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - PHY_WRITE(sc, MII_BMCR, - PHY_READ(sc, MII_BMCR) | BMCR_ISO); - goto brgphy_service_exit; - } - /* If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; @@ -385,18 +372,13 @@ brgphy_service(struct mii_softc *sc, str mii->mii_ifp->if_flags & IFF_LINK0); break; default: - error = EINVAL; - goto brgphy_service_exit; + return (EINVAL); } break; case MII_TICK: - /* Bail if we're not currently selected. */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - goto brgphy_service_exit; - /* Bail if the interface isn't up. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) - goto brgphy_service_exit; + return (0); /* Bail if autoneg isn't in process. */ @@ -465,8 +447,7 @@ brgphy_service(struct mii_softc *sc, str } } mii_phy_update(sc, cmd); -brgphy_service_exit: - return (error); + return (0); } @@ -1182,4 +1163,3 @@ brgphy_reset(struct mii_softc *sc) } } - Modified: stable/8/sys/dev/mii/ciphy.c ============================================================================== --- stable/8/sys/dev/mii/ciphy.c Sun Oct 24 12:59:43 2010 (r214265) +++ stable/8/sys/dev/mii/ciphy.c Sun Oct 24 13:39:19 2010 (r214266) @@ -118,18 +118,16 @@ ciphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = ciphy_service; sc->mii_pdata = mii; sc->mii_flags |= MIIF_NOISOLATE; - mii->mii_instance++; ciphy_reset(sc); - sc->mii_capabilities = - PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; if (sc->mii_capabilities & BMSR_EXTSTAT) sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); device_printf(dev, " "); @@ -148,25 +146,10 @@ ciphy_service(struct mii_softc *sc, stru switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); break; case MII_MEDIACHG: /* - * If the media indicates a different PHY instance, - * isolate ourselves. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - reg = PHY_READ(sc, MII_BMCR); - PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO); - return (0); - } - - /* * If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) @@ -239,12 +222,6 @@ setit: case MII_TICK: /* - * If we're not currently selected, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); - - /* * Is the interface even up? */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) Modified: stable/8/sys/dev/mii/e1000phy.c ============================================================================== --- stable/8/sys/dev/mii/e1000phy.c Sun Oct 24 12:59:43 2010 (r214265) +++ stable/8/sys/dev/mii/e1000phy.c Sun Oct 24 13:39:19 2010 (r214266) @@ -144,11 +144,10 @@ e1000phy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = e1000phy_service; sc->mii_pdata = mii; - mii->mii_instance++; esc->mii_model = MII_MODEL(ma->mii_id2); ifp = sc->mii_pdata->mii_ifp; @@ -322,25 +321,10 @@ e1000phy_service(struct mii_softc *sc, s switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); break; case MII_MEDIACHG: /* - * If the media indicates a different PHY instance, - * isolate ourselves. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - reg = PHY_READ(sc, E1000_CR); - PHY_WRITE(sc, E1000_CR, reg | E1000_CR_ISOLATE); - return (0); - } - - /* * If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) @@ -417,12 +401,6 @@ done: break; case MII_TICK: /* - * If we're not currently selected, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); - - /* * Is the interface even up? */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) Modified: stable/8/sys/dev/mii/exphy.c ============================================================================== --- stable/8/sys/dev/mii/exphy.c Sun Oct 24 12:59:43 2010 (r214265) +++ stable/8/sys/dev/mii/exphy.c Sun Oct 24 13:39:19 2010 (r214266) @@ -136,24 +136,16 @@ exphy_attach(device_t dev) ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); mii = ma->mii_data; - - /* - * The 3Com PHY can never be isolated, so never allow non-zero - * instances! - */ - if (mii->mii_instance != 0) { - device_printf(dev, "ignoring this PHY, non-zero instance\n"); - return (ENXIO); - } - LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = exphy_service; sc->mii_pdata = mii; - mii->mii_instance++; + /* + * The 3Com PHY can never be isolated. + */ sc->mii_flags |= MIIF_NOISOLATE; #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) @@ -163,8 +155,7 @@ exphy_attach(device_t dev) exphy_reset(sc); - sc->mii_capabilities = - PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); mii_phy_add_media(sc); printf("\n"); @@ -176,13 +167,6 @@ exphy_attach(device_t dev) static int exphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { - struct ifmedia_entry *ife = mii->mii_media.ifm_cur; - - /* - * We can't isolate the 3Com PHY, so it has to be the only one! - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - panic("exphy_service: can't isolate 3Com PHY"); switch (cmd) { case MII_POLLSTAT: Modified: stable/8/sys/dev/mii/gentbi.c ============================================================================== --- stable/8/sys/dev/mii/gentbi.c Sun Oct 24 12:59:43 2010 (r214265) +++ stable/8/sys/dev/mii/gentbi.c Sun Oct 24 13:39:19 2010 (r214266) @@ -55,7 +55,7 @@ */ /* - * Driver for generic ten-bit (1000BASE-SX) interfaces, built in to + * Driver for generic ten-bit (1000BASE-SX) interfaces, built into * many Gigabit Ethernet chips. * * All we have to do here is correctly report speed and duplex. @@ -166,13 +166,11 @@ gentbi_attach(device_t dev) MII_OUI(ma->mii_id1, ma->mii_id2), MII_MODEL(ma->mii_id2), MII_REV(ma->mii_id2)); - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = gentbi_service; sc->mii_pdata = mii; - mii->mii_instance++; - mii_phy_reset(sc); /* @@ -195,30 +193,13 @@ gentbi_attach(device_t dev) static int gentbi_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { - struct ifmedia_entry *ife = mii->mii_media.ifm_cur; - int reg; switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); break; case MII_MEDIACHG: /* - * If the media indicates a different PHY instance, - * isolate ourselves. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - reg = PHY_READ(sc, MII_BMCR); - PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO); - return (0); - } - - /* * If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) @@ -228,12 +209,6 @@ gentbi_service(struct mii_softc *sc, str break; case MII_TICK: - /* - * If we're not currently selected, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); - if (mii_phy_tick(sc) == EJUSTRETURN) return (0); break; Modified: stable/8/sys/dev/mii/icsphy.c ============================================================================== --- stable/8/sys/dev/mii/icsphy.c Sun Oct 24 12:59:43 2010 (r214265) +++ stable/8/sys/dev/mii/icsphy.c Sun Oct 24 13:39:19 2010 (r214266) @@ -141,14 +141,12 @@ icsphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = icsphy_service; sc->mii_pdata = mii; - sc->mii_anegticks = MII_ANEGTICKS; - sc->mii_flags |= MIIF_NOISOLATE; - mii->mii_instance++; + sc->mii_flags |= MIIF_NOISOLATE; ifmedia_add(&mii->mii_media, IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), @@ -170,20 +168,6 @@ icsphy_attach(device_t dev) static int icsphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { - struct ifmedia_entry *ife = mii->mii_media.ifm_cur; - int reg; - - /* - * If we're not selected, then do nothing, just isolate, if - * changing media. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - if (cmd == MII_MEDIACHG) { - reg = PHY_READ(sc, MII_BMCR); - PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO); - } - return (0); - } switch (cmd) { case MII_POLLSTAT: Modified: stable/8/sys/dev/mii/inphy.c ============================================================================== --- stable/8/sys/dev/mii/inphy.c Sun Oct 24 12:59:43 2010 (r214265) +++ stable/8/sys/dev/mii/inphy.c Sun Oct 24 13:39:19 2010 (r214266) @@ -107,11 +107,10 @@ inphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = inphy_service; sc->mii_pdata = mii; - mii->mii_instance++; ifmedia_add(&mii->mii_media, IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), @@ -132,22 +131,12 @@ inphy_attach(device_t dev) static int inphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { - struct ifmedia_entry *ife = mii->mii_media.ifm_cur; - int reg; switch (cmd) { case MII_POLLSTAT: - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); break; case MII_MEDIACHG: - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - reg = PHY_READ(sc, MII_BMCR); - PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO); - return (0); - } - /* * If the interface is not up, don't do anything. */ @@ -158,8 +147,6 @@ inphy_service(struct mii_softc *sc, stru break; case MII_TICK: - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); if (mii_phy_tick(sc) == EJUSTRETURN) return (0); break; Modified: stable/8/sys/dev/mii/ip1000phy.c ============================================================================== --- stable/8/sys/dev/mii/ip1000phy.c Sun Oct 24 12:59:43 2010 (r214265) +++ stable/8/sys/dev/mii/ip1000phy.c Sun Oct 24 13:39:19 2010 (r214266) @@ -114,13 +114,12 @@ ip1000phy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = ip1000phy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE; - mii->mii_instance++; + sc->mii_flags |= MIIF_NOISOLATE; isc->model = MII_MODEL(ma->mii_id2); isc->revision = MII_REV(ma->mii_id2); @@ -135,7 +134,7 @@ ip1000phy_attach(device_t dev) printf("\n"); MIIBUS_MEDIAINIT(sc->mii_dev); - return(0); + return (0); } static int @@ -146,26 +145,10 @@ ip1000phy_service(struct mii_softc *sc, switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); break; case MII_MEDIACHG: /* - * If the media indicates a different PHY instance, - * isolate ourselves. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - reg = PHY_READ(sc, IP1000PHY_MII_BMCR); - PHY_WRITE(sc, IP1000PHY_MII_BMCR, - reg | IP1000PHY_BMCR_ISO); - return (0); - } - - /* * If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) { @@ -237,11 +220,6 @@ done: case MII_TICK: /* - * If we're not currently selected, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); - /* * Is the interface even up? */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) Modified: stable/8/sys/dev/mii/jmphy.c ============================================================================== --- stable/8/sys/dev/mii/jmphy.c Sun Oct 24 12:59:43 2010 (r214265) +++ stable/8/sys/dev/mii/jmphy.c Sun Oct 24 13:39:19 2010 (r214266) @@ -112,13 +112,11 @@ jmphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = jmphy_service; sc->mii_pdata = mii; - mii->mii_instance++; - jsc->mii_oui = MII_OUI(ma->mii_id1, ma->mii_id2); jsc->mii_model = MII_MODEL(ma->mii_id2); jsc->mii_rev = MII_REV(ma->mii_id2); @@ -136,36 +134,20 @@ jmphy_attach(device_t dev) printf("\n"); MIIBUS_MEDIAINIT(sc->mii_dev); - return(0); + return (0); } static int jmphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { struct ifmedia_entry *ife = mii->mii_media.ifm_cur; - uint16_t bmcr; switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); break; case MII_MEDIACHG: /* - * If the media indicates a different PHY instance, - * isolate ourselves. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) { - bmcr = PHY_READ(sc, MII_BMCR); - PHY_WRITE(sc, MII_BMCR, bmcr | BMCR_ISO); - return (0); - } - - /* * If the interface is not up, don't do anything. */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) @@ -177,12 +159,6 @@ jmphy_service(struct mii_softc *sc, stru case MII_TICK: /* - * If we're not currently selected, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) - return (0); - - /* * Is the interface even up? */ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) Modified: stable/8/sys/dev/mii/lxtphy.c ============================================================================== --- stable/8/sys/dev/mii/lxtphy.c Sun Oct 24 12:59:43 2010 (r214265) +++ stable/8/sys/dev/mii/lxtphy.c Sun Oct 24 13:39:19 2010 (r214266) @@ -135,17 +135,14 @@ lxtphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); - sc->mii_inst = mii->mii_instance; + sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = lxtphy_service; sc->mii_pdata = mii; - mii->mii_instance++; - mii_phy_reset(sc); - sc->mii_capabilities = - PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); /* @@ -177,29 +174,13 @@ static int lxtphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { struct ifmedia_entry *ife = mii->mii_media.ifm_cur; - int reg; switch (cmd) { case MII_POLLSTAT: - /* - * If we're not polling our PHY instance, just return. - */ - if (IFM_INST(ife->ifm_media) != sc->mii_inst) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 24 13:41:38 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 906B2106564A; Sun, 24 Oct 2010 13:41:38 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D28A8FC19; Sun, 24 Oct 2010 13:41:38 +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 o9ODfcmw029746; Sun, 24 Oct 2010 13:41:38 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9ODfcro029729; Sun, 24 Oct 2010 13:41:38 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201010241341.o9ODfcro029729@svn.freebsd.org> From: Marius Strobl Date: Sun, 24 Oct 2010 13:41:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214268 - in stable/8/sys/dev: dc mii X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 13:41:38 -0000 Author: marius Date: Sun Oct 24 13:41:38 2010 New Revision: 214268 URL: http://svn.freebsd.org/changeset/base/214268 Log: MFC: r213384 Consistently always explicitly set IFM_HDX for half-duplex. Obtained from: OpenBSD (mostly) Modified: stable/8/sys/dev/dc/dcphy.c stable/8/sys/dev/dc/pnphy.c stable/8/sys/dev/mii/acphy.c stable/8/sys/dev/mii/amphy.c stable/8/sys/dev/mii/axphy.c stable/8/sys/dev/mii/bmtphy.c stable/8/sys/dev/mii/gentbi.c stable/8/sys/dev/mii/inphy.c stable/8/sys/dev/mii/lxtphy.c stable/8/sys/dev/mii/nsphy.c stable/8/sys/dev/mii/qsphy.c stable/8/sys/dev/mii/rlphy.c stable/8/sys/dev/mii/ruephy.c stable/8/sys/dev/mii/tdkphy.c stable/8/sys/dev/mii/tlphy.c stable/8/sys/dev/mii/ukphy_subr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/dc/dcphy.c ============================================================================== --- stable/8/sys/dev/dc/dcphy.c Sun Oct 24 13:39:26 2010 (r214267) +++ stable/8/sys/dev/dc/dcphy.c Sun Oct 24 13:41:38 2010 (r214268) @@ -341,14 +341,14 @@ dcphy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_100_TX | IFM_FDX; else if (anlpar & ANLPAR_T4 && sc->mii_capabilities & BMSR_100T4) - mii->mii_media_active |= IFM_100_T4; + mii->mii_media_active |= IFM_100_T4 | IFM_HDX; else if (anlpar & ANLPAR_TX && sc->mii_capabilities & BMSR_100TXHDX) - mii->mii_media_active |= IFM_100_TX; + mii->mii_media_active |= IFM_100_TX | IFM_HDX; else if (anlpar & ANLPAR_10_FD) mii->mii_media_active |= IFM_10_T | IFM_FDX; else if (anlpar & ANLPAR_10) - mii->mii_media_active |= IFM_10_T; + mii->mii_media_active |= IFM_10_T | IFM_HDX; else mii->mii_media_active |= IFM_NONE; if (DC_IS_INTEL(dc_sc)) @@ -366,9 +366,9 @@ dcphy_status(struct mii_softc *sc) * change the media settings if we're wrong. */ if (!(reg & DC_TSTAT_LS100)) - mii->mii_media_active |= IFM_100_TX; + mii->mii_media_active |= IFM_100_TX | IFM_HDX; else if (!(reg & DC_TSTAT_LS10)) - mii->mii_media_active |= IFM_10_T; + mii->mii_media_active |= IFM_10_T | IFM_HDX; else mii->mii_media_active |= IFM_NONE; if (DC_IS_INTEL(dc_sc)) @@ -383,6 +383,8 @@ skip: mii->mii_media_active |= IFM_100_TX; if (CSR_READ_4(dc_sc, DC_NETCFG) & DC_NETCFG_FULLDUPLEX) mii->mii_media_active |= IFM_FDX; + else + mii->mii_media_active |= IFM_HDX; } static int Modified: stable/8/sys/dev/dc/pnphy.c ============================================================================== --- stable/8/sys/dev/dc/pnphy.c Sun Oct 24 13:39:26 2010 (r214267) +++ stable/8/sys/dev/dc/pnphy.c Sun Oct 24 13:41:38 2010 (r214268) @@ -237,4 +237,6 @@ pnphy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_100_TX; if (CSR_READ_4(dc_sc, DC_NETCFG) & DC_NETCFG_FULLDUPLEX) mii->mii_media_active |= IFM_FDX; + else + mii->mii_media_active |= IFM_HDX; } Modified: stable/8/sys/dev/mii/acphy.c ============================================================================== --- stable/8/sys/dev/mii/acphy.c Sun Oct 24 13:39:26 2010 (r214267) +++ stable/8/sys/dev/mii/acphy.c Sun Oct 24 13:41:38 2010 (r214268) @@ -245,6 +245,8 @@ acphy_status(struct mii_softc *sc) if (diag & AC_DIAG_DUPLEX) mii->mii_media_active |= IFM_FDX; + else + mii->mii_media_active |= IFM_HDX; } else mii->mii_media_active = ife->ifm_media; } Modified: stable/8/sys/dev/mii/amphy.c ============================================================================== --- stable/8/sys/dev/mii/amphy.c Sun Oct 24 13:39:26 2010 (r214267) +++ stable/8/sys/dev/mii/amphy.c Sun Oct 24 13:41:38 2010 (r214268) @@ -206,13 +206,13 @@ amphy_status(struct mii_softc *sc) if (anlpar & ANLPAR_TX_FD) mii->mii_media_active |= IFM_100_TX|IFM_FDX; else if (anlpar & ANLPAR_T4) - mii->mii_media_active |= IFM_100_T4; + mii->mii_media_active |= IFM_100_T4|IFM_HDX; else if (anlpar & ANLPAR_TX) - mii->mii_media_active |= IFM_100_TX; + mii->mii_media_active |= IFM_100_TX|IFM_HDX; else if (anlpar & ANLPAR_10_FD) mii->mii_media_active |= IFM_10_T|IFM_FDX; else if (anlpar & ANLPAR_10) - mii->mii_media_active |= IFM_10_T; + mii->mii_media_active |= IFM_10_T|IFM_HDX; else mii->mii_media_active |= IFM_NONE; return; @@ -225,11 +225,11 @@ amphy_status(struct mii_softc *sc) if (par & DSCSR_100FDX) mii->mii_media_active |= IFM_100_TX|IFM_FDX; else if (par & DSCSR_100HDX) - mii->mii_media_active |= IFM_100_TX; + mii->mii_media_active |= IFM_100_TX|IFM_HDX; else if (par & DSCSR_10FDX) mii->mii_media_active |= IFM_10_T|IFM_HDX; else if (par & DSCSR_10HDX) - mii->mii_media_active |= IFM_10_T; + mii->mii_media_active |= IFM_10_T|IFM_HDX; } else mii->mii_media_active = ife->ifm_media; } Modified: stable/8/sys/dev/mii/axphy.c ============================================================================== --- stable/8/sys/dev/mii/axphy.c Sun Oct 24 13:39:26 2010 (r214267) +++ stable/8/sys/dev/mii/axphy.c Sun Oct 24 13:41:38 2010 (r214268) @@ -189,6 +189,8 @@ axphy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_10_T; if (scr & SCR_FDX) mii->mii_media_active |= IFM_FDX; + else + mii->mii_media_active |= IFM_HDX; #endif } else mii->mii_media_active = ife->ifm_media; Modified: stable/8/sys/dev/mii/bmtphy.c ============================================================================== --- stable/8/sys/dev/mii/bmtphy.c Sun Oct 24 13:39:26 2010 (r214267) +++ stable/8/sys/dev/mii/bmtphy.c Sun Oct 24 13:41:38 2010 (r214268) @@ -243,6 +243,8 @@ bmtphy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_10_T; if (aux_csr & AUX_CSR_FDX) mii->mii_media_active |= IFM_FDX; + else + mii->mii_media_active |= IFM_HDX; } else mii->mii_media_active = ife->ifm_media; } Modified: stable/8/sys/dev/mii/gentbi.c ============================================================================== --- stable/8/sys/dev/mii/gentbi.c Sun Oct 24 13:39:26 2010 (r214267) +++ stable/8/sys/dev/mii/gentbi.c Sun Oct 24 13:41:38 2010 (r214268) @@ -263,11 +263,12 @@ gentbi_status(struct mii_softc *sc) * see if we're doing full-duplex. */ mii->mii_media_active |= IFM_1000_SX; - anlpar = PHY_READ(sc, MII_ANLPAR); if ((sc->mii_extcapabilities & EXTSR_1000XFDX) != 0 && (anlpar & ANLPAR_X_FD) != 0) mii->mii_media_active |= IFM_FDX; + else + mii->mii_media_active |= IFM_HDX; } else mii->mii_media_active = ife->ifm_media; } Modified: stable/8/sys/dev/mii/inphy.c ============================================================================== --- stable/8/sys/dev/mii/inphy.c Sun Oct 24 13:39:26 2010 (r214267) +++ stable/8/sys/dev/mii/inphy.c Sun Oct 24 13:41:38 2010 (r214268) @@ -197,6 +197,8 @@ inphy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_10_T; if (scr & SCR_FDX) mii->mii_media_active |= IFM_FDX; + else + mii->mii_media_active |= IFM_HDX; } else mii->mii_media_active = ife->ifm_media; } Modified: stable/8/sys/dev/mii/lxtphy.c ============================================================================== --- stable/8/sys/dev/mii/lxtphy.c Sun Oct 24 13:39:26 2010 (r214267) +++ stable/8/sys/dev/mii/lxtphy.c Sun Oct 24 13:41:38 2010 (r214268) @@ -250,6 +250,8 @@ lxtphy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_10_T; if (csr & CSR_DUPLEX) mii->mii_media_active |= IFM_FDX; + else + mii->mii_media_active |= IFM_HDX; } else mii->mii_media_active = ife->ifm_media; } Modified: stable/8/sys/dev/mii/nsphy.c ============================================================================== --- stable/8/sys/dev/mii/nsphy.c Sun Oct 24 13:39:26 2010 (r214267) +++ stable/8/sys/dev/mii/nsphy.c Sun Oct 24 13:41:38 2010 (r214268) @@ -298,13 +298,13 @@ nsphy_status(struct mii_softc *sc) if (anlpar & ANLPAR_TX_FD) mii->mii_media_active |= IFM_100_TX|IFM_FDX; else if (anlpar & ANLPAR_T4) - mii->mii_media_active |= IFM_100_T4; + mii->mii_media_active |= IFM_100_T4|IFM_HDX; else if (anlpar & ANLPAR_TX) - mii->mii_media_active |= IFM_100_TX; + mii->mii_media_active |= IFM_100_TX|IFM_HDX; else if (anlpar & ANLPAR_10_FD) mii->mii_media_active |= IFM_10_T|IFM_FDX; else if (anlpar & ANLPAR_10) - mii->mii_media_active |= IFM_10_T; + mii->mii_media_active |= IFM_10_T|IFM_HDX; else mii->mii_media_active |= IFM_NONE; return; @@ -320,10 +320,7 @@ nsphy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_10_T; else mii->mii_media_active |= IFM_100_TX; -#if 0 - if (par & PAR_FDX) - mii->mii_media_active |= IFM_FDX; -#endif + mii->mii_media_active |= IFM_HDX; } else mii->mii_media_active = ife->ifm_media; } Modified: stable/8/sys/dev/mii/qsphy.c ============================================================================== --- stable/8/sys/dev/mii/qsphy.c Sun Oct 24 13:39:26 2010 (r214267) +++ stable/8/sys/dev/mii/qsphy.c Sun Oct 24 13:41:38 2010 (r214268) @@ -215,19 +215,19 @@ qsphy_status(struct mii_softc *sc) pctl = PHY_READ(sc, MII_QSPHY_PCTL); switch (pctl & PCTL_OPMASK) { case PCTL_10_T: - mii->mii_media_active |= IFM_10_T; + mii->mii_media_active |= IFM_10_T|IFM_HDX; break; case PCTL_10_T_FDX: mii->mii_media_active |= IFM_10_T|IFM_FDX; break; case PCTL_100_TX: - mii->mii_media_active |= IFM_100_TX; + mii->mii_media_active |= IFM_100_TX|IFM_HDX; break; case PCTL_100_TX_FDX: mii->mii_media_active |= IFM_100_TX|IFM_FDX; break; case PCTL_100_T4: - mii->mii_media_active |= IFM_100_T4; + mii->mii_media_active |= IFM_100_T4|IFM_HDX; break; case PCTL_AN: mii->mii_media_active |= IFM_NONE; Modified: stable/8/sys/dev/mii/rlphy.c ============================================================================== --- stable/8/sys/dev/mii/rlphy.c Sun Oct 24 13:39:26 2010 (r214267) +++ stable/8/sys/dev/mii/rlphy.c Sun Oct 24 13:41:38 2010 (r214268) @@ -249,13 +249,13 @@ rlphy_status(struct mii_softc *phy) if (anlpar & ANLPAR_TX_FD) mii->mii_media_active |= IFM_100_TX|IFM_FDX; else if (anlpar & ANLPAR_T4) - mii->mii_media_active |= IFM_100_T4; + mii->mii_media_active |= IFM_100_T4|IFM_HDX; else if (anlpar & ANLPAR_TX) - mii->mii_media_active |= IFM_100_TX; + mii->mii_media_active |= IFM_100_TX|IFM_HDX; else if (anlpar & ANLPAR_10_FD) mii->mii_media_active |= IFM_10_T|IFM_FDX; else if (anlpar & ANLPAR_10) - mii->mii_media_active |= IFM_10_T; + mii->mii_media_active |= IFM_10_T|IFM_HDX; else mii->mii_media_active |= IFM_NONE; return; @@ -299,6 +299,7 @@ rlphy_status(struct mii_softc *phy) else mii->mii_media_active |= IFM_100_TX; } + mii->mii_media_active |= IFM_HDX; } else mii->mii_media_active = ife->ifm_media; } Modified: stable/8/sys/dev/mii/ruephy.c ============================================================================== --- stable/8/sys/dev/mii/ruephy.c Sun Oct 24 13:39:26 2010 (r214267) +++ stable/8/sys/dev/mii/ruephy.c Sun Oct 24 13:41:38 2010 (r214268) @@ -244,6 +244,8 @@ ruephy_status(struct mii_softc *phy) if (msr & RUEPHY_MSR_DUPLEX) mii->mii_media_active |= IFM_FDX; + else + mii->mii_media_active |= IFM_HDX; } else mii->mii_media_active = ife->ifm_media; } Modified: stable/8/sys/dev/mii/tdkphy.c ============================================================================== --- stable/8/sys/dev/mii/tdkphy.c Sun Oct 24 13:39:26 2010 (r214267) +++ stable/8/sys/dev/mii/tdkphy.c Sun Oct 24 13:41:38 2010 (r214268) @@ -217,13 +217,13 @@ tdkphy_status(struct mii_softc *phy) if (anlpar & ANLPAR_TX_FD) mii->mii_media_active |= IFM_100_TX|IFM_FDX; else if (anlpar & ANLPAR_T4) - mii->mii_media_active |= IFM_100_T4; + mii->mii_media_active |= IFM_100_T4|IFM_HDX; else if (anlpar & ANLPAR_TX) - mii->mii_media_active |= IFM_100_TX; + mii->mii_media_active |= IFM_100_TX|IFM_HDX; else if (anlpar & ANLPAR_10_FD) mii->mii_media_active |= IFM_10_T|IFM_FDX; else if (anlpar & ANLPAR_10) - mii->mii_media_active |= IFM_10_T; + mii->mii_media_active |= IFM_10_T|IFM_HDX; else { /* * ANLPAR isn't set, which leaves two possibilities: @@ -234,10 +234,12 @@ tdkphy_status(struct mii_softc *phy) */ diag = PHY_READ(phy, MII_DIAG); if (diag & DIAG_NEGFAIL) /* assume 10baseT if no neg */ - mii->mii_media_active |= IFM_10_T; + mii->mii_media_active |= IFM_10_T|IFM_HDX; else { if (diag & DIAG_DUPLEX) mii->mii_media_active |= IFM_FDX; + else + mii->mii_media_active |= IFM_HDX; if (diag & DIAG_RATE_100) mii->mii_media_active |= IFM_100_TX; else Modified: stable/8/sys/dev/mii/tlphy.c ============================================================================== --- stable/8/sys/dev/mii/tlphy.c Sun Oct 24 13:39:26 2010 (r214267) +++ stable/8/sys/dev/mii/tlphy.c Sun Oct 24 13:41:38 2010 (r214268) @@ -333,6 +333,8 @@ tlphy_status(struct tlphy_softc *sc) */ if (bmcr & BMCR_FDX) mii->mii_media_active |= IFM_FDX; + else + mii->mii_media_active |= IFM_HDX; mii->mii_media_active |= IFM_10_T; } Modified: stable/8/sys/dev/mii/ukphy_subr.c ============================================================================== --- stable/8/sys/dev/mii/ukphy_subr.c Sun Oct 24 13:39:26 2010 (r214267) +++ stable/8/sys/dev/mii/ukphy_subr.c Sun Oct 24 13:41:38 2010 (r214268) @@ -104,17 +104,17 @@ ukphy_status(struct mii_softc *phy) mii->mii_media_active |= IFM_1000_T|IFM_FDX; else if ((gtcr & GTCR_ADV_1000THDX) && (gtsr & GTSR_LP_1000THDX)) - mii->mii_media_active |= IFM_1000_T; + mii->mii_media_active |= IFM_1000_T|IFM_HDX; else if (anlpar & ANLPAR_TX_FD) mii->mii_media_active |= IFM_100_TX|IFM_FDX; else if (anlpar & ANLPAR_T4) - mii->mii_media_active |= IFM_100_T4; + mii->mii_media_active |= IFM_100_T4|IFM_HDX; else if (anlpar & ANLPAR_TX) - mii->mii_media_active |= IFM_100_TX; + mii->mii_media_active |= IFM_100_TX|IFM_HDX; else if (anlpar & ANLPAR_10_FD) mii->mii_media_active |= IFM_10_T|IFM_FDX; else if (anlpar & ANLPAR_10) - mii->mii_media_active |= IFM_10_T; + mii->mii_media_active |= IFM_10_T|IFM_HDX; else mii->mii_media_active |= IFM_NONE; } else From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 24 13:43:46 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4938D106564A; Sun, 24 Oct 2010 13:43:46 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3703F8FC18; Sun, 24 Oct 2010 13:43: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 o9ODhkpr029900; Sun, 24 Oct 2010 13:43:46 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9ODhkEN029898; Sun, 24 Oct 2010 13:43:46 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201010241343.o9ODhkEN029898@svn.freebsd.org> From: Marius Strobl Date: Sun, 24 Oct 2010 13:43:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214270 - stable/8/sys/dev/mii X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 13:43:46 -0000 Author: marius Date: Sun Oct 24 13:43:45 2010 New Revision: 214270 URL: http://svn.freebsd.org/changeset/base/214270 Log: MFC: r213385 Remove a header that apart from the license is empty. Deleted: stable/8/sys/dev/mii/axphyreg.h Modified: stable/8/sys/dev/mii/axphy.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/mii/axphy.c ============================================================================== --- stable/8/sys/dev/mii/axphy.c Sun Oct 24 13:42:03 2010 (r214269) +++ stable/8/sys/dev/mii/axphy.c Sun Oct 24 13:43:45 2010 (r214270) @@ -45,8 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include "miidevs.h" -#include - #include "miibus_if.h" static int axphy_probe(device_t dev); From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 24 17:40:19 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E22C106564A; Sun, 24 Oct 2010 17:40:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C5478FC20; Sun, 24 Oct 2010 17:40: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 o9OHeJdm035432; Sun, 24 Oct 2010 17:40:19 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OHeJA2035430; Sun, 24 Oct 2010 17:40:19 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201010241740.o9OHeJA2035430@svn.freebsd.org> From: Alexander Motin Date: Sun, 24 Oct 2010 17:40:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214285 - stable/8/sys/cam X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 17:40:19 -0000 Author: mav Date: Sun Oct 24 17:40:19 2010 New Revision: 214285 URL: http://svn.freebsd.org/changeset/base/214285 Log: MFC r212991: Decrease poll interval from 1000 to 100us. This significantly reduces kernel dump time, especially with minidump. Modified: stable/8/sys/cam/cam_xpt.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Sun Oct 24 17:28:25 2010 (r214284) +++ stable/8/sys/cam/cam_xpt.c Sun Oct 24 17:40:19 2010 (r214285) @@ -2876,7 +2876,7 @@ xpt_polled_action(union ccb *start_ccb) struct cam_ed *dev; - timeout = start_ccb->ccb_h.timeout; + timeout = start_ccb->ccb_h.timeout * 10; sim = start_ccb->ccb_h.path->bus->sim; devq = sim->devq; dev = start_ccb->ccb_h.path->device; @@ -2892,7 +2892,7 @@ xpt_polled_action(union ccb *start_ccb) while(((devq != NULL && devq->send_openings <= 0) || dev->ccbq.dev_openings < 0) && (--timeout > 0)) { - DELAY(1000); + DELAY(100); (*(sim->sim_poll))(sim); camisr_runqueue(&sim->sim_doneq); } @@ -2908,7 +2908,7 @@ xpt_polled_action(union ccb *start_ccb) if ((start_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_INPROG) break; - DELAY(1000); + DELAY(100); } if (timeout == 0) { /* From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 24 17:42:41 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70F87106566B; Sun, 24 Oct 2010 17:42:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5ED1C8FC15; Sun, 24 Oct 2010 17:42: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 o9OHgfCJ035526; Sun, 24 Oct 2010 17:42:41 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OHgfFW035523; Sun, 24 Oct 2010 17:42:41 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201010241742.o9OHgfFW035523@svn.freebsd.org> From: Alexander Motin Date: Sun, 24 Oct 2010 17:42:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214286 - in stable/8/sys/dev/usb: . serial X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 17:42:41 -0000 Author: mav Date: Sun Oct 24 17:42:41 2010 New Revision: 214286 URL: http://svn.freebsd.org/changeset/base/214286 Log: MFC r213509: Add ID for Vodafone (ZTE) Mobile Broadband K3565-Z modem. Modified: stable/8/sys/dev/usb/serial/u3g.c stable/8/sys/dev/usb/usbdevs Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/serial/u3g.c ============================================================================== --- stable/8/sys/dev/usb/serial/u3g.c Sun Oct 24 17:40:19 2010 (r214285) +++ stable/8/sys/dev/usb/serial/u3g.c Sun Oct 24 17:42:41 2010 (r214286) @@ -408,6 +408,7 @@ static const struct usb_device_id u3g_de U3G_DEV(QUALCOMMINC, E0078, 0), U3G_DEV(QUALCOMMINC, E0082, 0), U3G_DEV(QUALCOMMINC, E0086, 0), + U3G_DEV(QUALCOMMINC, E2000, U3GINIT_SCSIEJECT), U3G_DEV(QUALCOMMINC, E2002, 0), U3G_DEV(QUALCOMMINC, E2003, 0), U3G_DEV(QUALCOMMINC, MF626, 0), Modified: stable/8/sys/dev/usb/usbdevs ============================================================================== --- stable/8/sys/dev/usb/usbdevs Sun Oct 24 17:40:19 2010 (r214285) +++ stable/8/sys/dev/usb/usbdevs Sun Oct 24 17:42:41 2010 (r214286) @@ -2636,6 +2636,7 @@ product QUALCOMMINC E0076 0x0076 3G mode product QUALCOMMINC E0078 0x0078 3G modem product QUALCOMMINC E0082 0x0082 3G modem product QUALCOMMINC E0086 0x0086 3G modem +product QUALCOMMINC E2000 0x2000 3G modem product QUALCOMMINC E2002 0x2002 3G modem product QUALCOMMINC E2003 0x2003 3G modem From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 24 18:12:11 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A603106564A; Sun, 24 Oct 2010 18:12:11 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 57D9F8FC0A; Sun, 24 Oct 2010 18:12: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 o9OICBPX036168; Sun, 24 Oct 2010 18:12:11 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OICB2p036165; Sun, 24 Oct 2010 18:12:11 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201010241812.o9OICB2p036165@svn.freebsd.org> From: Ed Schouten Date: Sun, 24 Oct 2010 18:12:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214287 - stable/8/contrib/ee X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 18:12:11 -0000 Author: ed Date: Sun Oct 24 18:12:11 2010 New Revision: 214287 URL: http://svn.freebsd.org/changeset/base/214287 Log: MFC r213567: Import ee 1.5.2 into HEAD. PR: bin/145921 Modified: stable/8/contrib/ee/ee.c stable/8/contrib/ee/ee_version.h Directory Properties: stable/8/contrib/ee/ (props changed) Modified: stable/8/contrib/ee/ee.c ============================================================================== --- stable/8/contrib/ee/ee.c Sun Oct 24 17:42:41 2010 (r214286) +++ stable/8/contrib/ee/ee.c Sun Oct 24 18:12:11 2010 (r214287) @@ -50,7 +50,7 @@ | proprietary information which is protected by | copyright. All rights are reserved. | - | $Header: /home/hugh/sources/old_ae/RCS/ee.c,v 1.102 2009/02/17 03:22:50 hugh Exp hugh $ + | $Header: /home/hugh/sources/old_ae/RCS/ee.c,v 1.104 2010/06/04 01:55:31 hugh Exp hugh $ | */ @@ -62,7 +62,7 @@ char *ee_copyright_message = #include "ee_version.h" -char *version = "@(#) ee, version " EE_VERSION " $Revision: 1.102 $"; +char *version = "@(#) ee, version " EE_VERSION " $Revision: 1.104 $"; #ifdef NCURSE #include "new_curse.h" @@ -307,7 +307,7 @@ void undel_word P_((void)); void del_line P_((void)); void undel_line P_((void)); void adv_word P_((void)); -void move_rel P_((char *direction, int lines)); +void move_rel P_((char direction, int lines)); void eol P_((void)); void bol P_((void)); void adv_line P_((void)); @@ -816,7 +816,7 @@ int disp; tp++; temp2++; } - if (scr_horz < horiz_offset) + if ((scr_horz < horiz_offset) && (horiz_offset > 0)) { horiz_offset -= 8; midscreen(scr_vert, point); @@ -824,7 +824,6 @@ int disp; } else if (curr_line->prev_line != NULL) { - absolute_lin--; text_changes = TRUE; left(disp); /* go to previous line */ temp_buff = curr_line->next_line; @@ -1220,11 +1219,11 @@ control() /* use control for commands else if (in == 13) /* control m */ insert_line(TRUE); else if (in == 14) /* control n */ - move_rel("d", max(5, (last_line - 5))); + move_rel('d', max(5, (last_line - 5))); else if (in == 15) /* control o */ eol(); else if (in == 16) /* control p */ - move_rel("u", max(5, (last_line - 5))); + move_rel('u', max(5, (last_line - 5))); else if (in == 17) /* control q */ ; else if (in == 18) /* control r */ @@ -1275,7 +1274,7 @@ emacs_control() else if (in == 6) /* control f */ right(TRUE); else if (in == 7) /* control g */ - move_rel("u", max(5, (last_line - 5))); + move_rel('u', max(5, (last_line - 5))); else if (in == 8) /* control h */ delete(TRUE); else if (in == 9) /* control i */ @@ -1314,7 +1313,7 @@ emacs_control() else if (in == 21) /* control u */ bottom(); else if (in == 22) /* control v */ - move_rel("d", max(5, (last_line - 5))); + move_rel('d', max(5, (last_line - 5))); else if (in == 23) /* control w */ del_word(); else if (in == 24) /* control x */ @@ -1549,9 +1548,9 @@ function_key() /* process function ke else if (in == KEY_DOWN) down(); else if (in == KEY_NPAGE) - move_rel("d", max( 5, (last_line - 5))); + move_rel('d', max( 5, (last_line - 5))); else if (in == KEY_PPAGE) - move_rel("u", max(5, (last_line - 5))); + move_rel('u', max(5, (last_line - 5))); else if (in == KEY_DL) del_line(); else if (in == KEY_DC) @@ -1989,7 +1988,7 @@ char *cmd_str; int number; int i; char *ptr; - char *direction = "d"; + char direction = '\0'; struct text *t_line; ptr = cmd_str; @@ -2006,12 +2005,12 @@ char *cmd_str; { i++; t_line = t_line->prev_line; - direction = "u"; + direction = 'u'; } while ((t_line->line_number < number) && (t_line->next_line != NULL)) { i++; - direction = "d"; + direction = 'd'; t_line = t_line->next_line; } if ((i < 30) && (i > 0)) @@ -2020,7 +2019,7 @@ char *cmd_str; } else { - if (!strcmp(direction, "d")) + if (direction != 'd') { absolute_lin += i; } @@ -2217,7 +2216,7 @@ check_fp() /* open or close files accor if (start_at_line != NULL) { line_num = atoi(start_at_line) - 1; - move_rel("d", line_num); + move_rel('d', line_num); line_num = 0; start_at_line = NULL; } @@ -2660,7 +2659,7 @@ int display_message; { if (lines_moved < 30) { - move_rel("d", lines_moved); + move_rel('d', lines_moved); while (position < iter) right(TRUE); } @@ -2730,8 +2729,8 @@ del_char() /* delete current character } else { - right(FALSE); - delete(FALSE); + right(TRUE); + delete(TRUE); } } @@ -2940,13 +2939,13 @@ while ((position < curr_line->line_lengt void move_rel(direction, lines) /* move relative to current line */ -char *direction; +char direction; int lines; { int i; char *tmp; - if (*direction == 'u') + if (direction == 'u') { scr_pos = 0; while (position > 1) Modified: stable/8/contrib/ee/ee_version.h ============================================================================== --- stable/8/contrib/ee/ee_version.h Sun Oct 24 17:42:41 2010 (r214286) +++ stable/8/contrib/ee/ee_version.h Sun Oct 24 18:12:11 2010 (r214287) @@ -2,5 +2,5 @@ | provide a version number for ee */ -#define EE_VERSION "1.5.0" -#define DATE_STRING "$Date: 2009/02/17 03:32:30 $" +#define EE_VERSION "1.5.2" +#define DATE_STRING "$Date: 2010/06/04 02:35:35 $" From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 24 21:07:13 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92B77106566C; Sun, 24 Oct 2010 21:07:13 +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 65EEA8FC08; Sun, 24 Oct 2010 21:07: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 o9OL7DMQ039959; Sun, 24 Oct 2010 21:07:13 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OL7Dma039957; Sun, 24 Oct 2010 21:07:13 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010242107.o9OL7Dma039957@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 24 Oct 2010 21:07:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214293 - stable/8/sys/dev/alc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 21:07:13 -0000 Author: yongari Date: Sun Oct 24 21:07:13 2010 New Revision: 214293 URL: http://svn.freebsd.org/changeset/base/214293 Log: MFC r213842: Backout r204230. TX mbuf parser for VLAN is still required to enable TX checksum offloading if VLAN hardware tagging is disabled. Modified: stable/8/sys/dev/alc/if_alc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/alc/if_alc.c ============================================================================== --- stable/8/sys/dev/alc/if_alc.c Sun Oct 24 20:54:46 2010 (r214292) +++ stable/8/sys/dev/alc/if_alc.c Sun Oct 24 21:07:13 2010 (r214293) @@ -2019,7 +2019,7 @@ alc_encap(struct alc_softc *sc, struct m struct tcphdr *tcp; bus_dma_segment_t txsegs[ALC_MAXTXSEGS]; bus_dmamap_t map; - uint32_t cflags, hdrlen, poff, vtag; + uint32_t cflags, hdrlen, ip_off, poff, vtag; int error, idx, nsegs, prod; ALC_LOCK_ASSERT(sc); @@ -2029,7 +2029,7 @@ alc_encap(struct alc_softc *sc, struct m m = *m_head; ip = NULL; tcp = NULL; - poff = 0; + ip_off = poff = 0; if ((m->m_pkthdr.csum_flags & (ALC_CSUM_FEATURES | CSUM_TSO)) != 0) { /* * AR813x/AR815x requires offset of TCP/UDP header in its @@ -2039,6 +2039,7 @@ alc_encap(struct alc_softc *sc, struct m * cycles on FreeBSD so fast host CPU is required to get * smooth TSO performance. */ + struct ether_header *eh; if (M_WRITABLE(m) == 0) { /* Get a writable copy. */ @@ -2052,15 +2053,32 @@ alc_encap(struct alc_softc *sc, struct m *m_head = m; } - m = m_pullup(m, sizeof(struct ether_header) + - sizeof(struct ip)); + ip_off = sizeof(struct ether_header); + m = m_pullup(m, ip_off); if (m == NULL) { *m_head = NULL; return (ENOBUFS); } - ip = (struct ip *)(mtod(m, char *) + - sizeof(struct ether_header)); - poff = sizeof(struct ether_header) + (ip->ip_hl << 2); + eh = mtod(m, struct ether_header *); + /* + * Check if hardware VLAN insertion is off. + * Additional check for LLC/SNAP frame? + */ + if (eh->ether_type == htons(ETHERTYPE_VLAN)) { + ip_off = sizeof(struct ether_vlan_header); + m = m_pullup(m, ip_off); + if (m == NULL) { + *m_head = NULL; + return (ENOBUFS); + } + } + m = m_pullup(m, ip_off + sizeof(struct ip)); + if (m == NULL) { + *m_head = NULL; + return (ENOBUFS); + } + ip = (struct ip *)(mtod(m, char *) + ip_off); + poff = ip_off + (ip->ip_hl << 2); if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) { m = m_pullup(m, poff + sizeof(struct tcphdr)); if (m == NULL) { From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 24 21:14:01 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9A891065674; Sun, 24 Oct 2010 21:14:01 +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 D63908FC14; Sun, 24 Oct 2010 21:14: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 o9OLE17V040209; Sun, 24 Oct 2010 21:14:01 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OLE12x040200; Sun, 24 Oct 2010 21:14:01 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010242114.o9OLE12x040200@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 24 Oct 2010 21:14:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214295 - in stable/8/sys/dev: age alc ale bce bge fxp jme sge X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 21:14:02 -0000 Author: yongari Date: Sun Oct 24 21:14:01 2010 New Revision: 214295 URL: http://svn.freebsd.org/changeset/base/214295 Log: MFC r213844: Make sure to not use stale ip/tcp header pointers. The ip/tcp header parser uses m_pullup(9) to get access to mbuf chain. m_pullup(9) can allocate new mbuf chain and free old one if the space left in the mbuf chain is not enough to hold requested contiguous bytes. Previously drivers can use stale ip/tcp header pointer if m_pullup(9) returned new mbuf chain. Reported by: Andrew Boyer (aboyer <> averesystems dot com) Modified: stable/8/sys/dev/age/if_age.c stable/8/sys/dev/alc/if_alc.c stable/8/sys/dev/ale/if_ale.c stable/8/sys/dev/bce/if_bce.c stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/fxp/if_fxp.c stable/8/sys/dev/jme/if_jme.c stable/8/sys/dev/sge/if_sge.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/age/if_age.c ============================================================================== --- stable/8/sys/dev/age/if_age.c Sun Oct 24 21:09:31 2010 (r214294) +++ stable/8/sys/dev/age/if_age.c Sun Oct 24 21:14:01 2010 (r214295) @@ -1565,6 +1565,7 @@ age_encap(struct age_softc *sc, struct m *m_head = NULL; return (ENOBUFS); } + ip = (struct ip *)(mtod(m, char *) + ip_off); tcp = (struct tcphdr *)(mtod(m, char *) + poff); /* * L1 requires IP/TCP header size and offset as Modified: stable/8/sys/dev/alc/if_alc.c ============================================================================== --- stable/8/sys/dev/alc/if_alc.c Sun Oct 24 21:09:31 2010 (r214294) +++ stable/8/sys/dev/alc/if_alc.c Sun Oct 24 21:14:01 2010 (r214295) @@ -2104,6 +2104,8 @@ alc_encap(struct alc_softc *sc, struct m * Reset IP checksum and recompute TCP pseudo * checksum as NDIS specification said. */ + ip = (struct ip *)(mtod(m, char *) + ip_off); + tcp = (struct tcphdr *)(mtod(m, char *) + poff); ip->ip_sum = 0; tcp->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htons(IPPROTO_TCP)); Modified: stable/8/sys/dev/ale/if_ale.c ============================================================================== --- stable/8/sys/dev/ale/if_ale.c Sun Oct 24 21:09:31 2010 (r214294) +++ stable/8/sys/dev/ale/if_ale.c Sun Oct 24 21:14:01 2010 (r214295) @@ -1677,6 +1677,7 @@ ale_encap(struct ale_softc *sc, struct m *m_head = NULL; return (ENOBUFS); } + ip = (struct ip *)(mtod(m, char *) + ip_off); tcp = (struct tcphdr *)(mtod(m, char *) + poff); m = m_pullup(m, poff + (tcp->th_off << 2)); if (m == NULL) { Modified: stable/8/sys/dev/bce/if_bce.c ============================================================================== --- stable/8/sys/dev/bce/if_bce.c Sun Oct 24 21:09:31 2010 (r214294) +++ stable/8/sys/dev/bce/if_bce.c Sun Oct 24 21:14:01 2010 (r214295) @@ -6733,6 +6733,7 @@ bce_tso_setup(struct bce_softc *sc, stru } /* Get the TCP header length in bytes (min 20) */ + ip = (struct ip *)(m->m_data + sizeof(struct ether_header)); th = (struct tcphdr *)((caddr_t)ip + ip_hlen); tcp_hlen = (th->th_off << 2); @@ -6745,6 +6746,7 @@ bce_tso_setup(struct bce_softc *sc, stru } /* IP header length and checksum will be calc'd by hardware */ + ip = (struct ip *)(m->m_data + sizeof(struct ether_header)); ip_len = ip->ip_len; ip->ip_len = 0; ip->ip_sum = 0; Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Sun Oct 24 21:09:31 2010 (r214294) +++ stable/8/sys/dev/bge/if_bge.c Sun Oct 24 21:14:01 2010 (r214295) @@ -3839,9 +3839,11 @@ bge_setup_tso(struct bge_softc *sc, stru * checksum. These checksum computed by upper stack should be 0. */ *mss = m->m_pkthdr.tso_segsz; + ip = (struct ip *)(mtod(m, char *) + sizeof(struct ether_header)); ip->ip_sum = 0; ip->ip_len = htons(*mss + (ip->ip_hl << 2) + (tcp->th_off << 2)); /* Clear pseudo checksum computed by TCP stack. */ + tcp = (struct tcphdr *)(mtod(m, char *) + poff); tcp->th_sum = 0; /* * Broadcom controllers uses different descriptor format for Modified: stable/8/sys/dev/fxp/if_fxp.c ============================================================================== --- stable/8/sys/dev/fxp/if_fxp.c Sun Oct 24 21:09:31 2010 (r214294) +++ stable/8/sys/dev/fxp/if_fxp.c Sun Oct 24 21:14:01 2010 (r214295) @@ -1454,6 +1454,8 @@ fxp_encap(struct fxp_softc *sc, struct m * Since 82550/82551 doesn't modify IP length and pseudo * checksum in the first frame driver should compute it. */ + ip = (struct ip *)(mtod(m, char *) + ip_off); + tcp = (struct tcphdr *)(mtod(m, char *) + poff); ip->ip_sum = 0; ip->ip_len = htons(m->m_pkthdr.tso_segsz + (ip->ip_hl << 2) + (tcp->th_off << 2)); Modified: stable/8/sys/dev/jme/if_jme.c ============================================================================== --- stable/8/sys/dev/jme/if_jme.c Sun Oct 24 21:09:31 2010 (r214294) +++ stable/8/sys/dev/jme/if_jme.c Sun Oct 24 21:14:01 2010 (r214295) @@ -1665,11 +1665,12 @@ jme_encap(struct jme_softc *sc, struct m *m_head = NULL; return (ENOBUFS); } - tcp = (struct tcphdr *)(mtod(m, char *) + poff); /* * Reset IP checksum and recompute TCP pseudo * checksum that NDIS specification requires. */ + ip = (struct ip *)(mtod(m, char *) + ip_off); + tcp = (struct tcphdr *)(mtod(m, char *) + poff); ip->ip_sum = 0; if (poff + (tcp->th_off << 2) == m->m_pkthdr.len) { tcp->th_sum = in_pseudo(ip->ip_src.s_addr, Modified: stable/8/sys/dev/sge/if_sge.c ============================================================================== --- stable/8/sys/dev/sge/if_sge.c Sun Oct 24 21:09:31 2010 (r214294) +++ stable/8/sys/dev/sge/if_sge.c Sun Oct 24 21:14:01 2010 (r214295) @@ -1457,7 +1457,9 @@ sge_encap(struct sge_softc *sc, struct m * Reset IP checksum and recompute TCP pseudo * checksum that NDIS specification requires. */ + ip = (struct ip *)(mtod(m, char *) + ip_off); ip->ip_sum = 0; + tcp = (struct tcphdr *)(mtod(m, char *) + poff); tcp->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htons(IPPROTO_TCP)); *m_head = m; From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 24 21:22:00 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 980C71065670; Sun, 24 Oct 2010 21:22:00 +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 5694C8FC14; Sun, 24 Oct 2010 21:22: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 o9OLM0W5040468; Sun, 24 Oct 2010 21:22:00 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OLM0UY040466; Sun, 24 Oct 2010 21:22:00 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010242122.o9OLM0UY040466@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 24 Oct 2010 21:22:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214297 - stable/8/sys/dev/usb/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 21:22:00 -0000 Author: yongari Date: Sun Oct 24 21:22:00 2010 New Revision: 214297 URL: http://svn.freebsd.org/changeset/base/214297 Log: MFC r213423: Move updating TX packet counter to the inside of send loop. axe(4) controllers combine multiple TX requests into single one if there is room in TX buffer of controller. Updating TX packet counter at the end of TX completion resulted in incorrect TX packet counter as axe(4) thought it sent 1 packet. There is no easy way to know how many combined TX were completed in the callback. Because this change updates TX packet counter before actual transmission, it may not be ideal one. But I believe it's better than showing fake 8kpps under high TX load. With this change, TX shows 221kpps on Linksus USB200M. Modified: stable/8/sys/dev/usb/net/if_axe.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/net/if_axe.c ============================================================================== --- stable/8/sys/dev/usb/net/if_axe.c Sun Oct 24 21:17:23 2010 (r214296) +++ stable/8/sys/dev/usb/net/if_axe.c Sun Oct 24 21:22:00 2010 (r214297) @@ -862,7 +862,6 @@ axe_bulk_write_callback(struct usb_xfer switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: DPRINTFN(11, "transfer complete\n"); - ifp->if_opackets++; /* FALLTHROUGH */ case USB_ST_SETUP: tr_setup: @@ -908,6 +907,17 @@ tr_setup: pos += m->m_pkthdr.len; /* + * XXX + * Update TX packet counter here. This is not + * correct way but it seems that there is no way + * to know how many packets are sent at the end + * of transfer because controller combines + * multiple writes into single one if there is + * room in TX buffer of controller. + */ + ifp->if_opackets++; + + /* * if there's a BPF listener, bounce a copy * of this frame to him: */ From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 24 21:23:27 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A75A4106566B; Sun, 24 Oct 2010 21:23:27 +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 7ACF48FC0C; Sun, 24 Oct 2010 21:23: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 o9OLNRve040558; Sun, 24 Oct 2010 21:23:27 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OLNRnt040556; Sun, 24 Oct 2010 21:23:27 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010242123.o9OLNRnt040556@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 24 Oct 2010 21:23:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214298 - stable/8/sys/dev/usb/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 21:23:27 -0000 Author: yongari Date: Sun Oct 24 21:23:27 2010 New Revision: 214298 URL: http://svn.freebsd.org/changeset/base/214298 Log: MFC r213424: Make upper stack know driver's output status. This change increased TX performance from 221kpps to 231kpps. Modified: stable/8/sys/dev/usb/net/if_axe.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/net/if_axe.c ============================================================================== --- stable/8/sys/dev/usb/net/if_axe.c Sun Oct 24 21:22:00 2010 (r214297) +++ stable/8/sys/dev/usb/net/if_axe.c Sun Oct 24 21:23:27 2010 (r214298) @@ -862,12 +862,15 @@ axe_bulk_write_callback(struct usb_xfer switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: DPRINTFN(11, "transfer complete\n"); + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; /* FALLTHROUGH */ case USB_ST_SETUP: tr_setup: - if ((sc->sc_flags & AXE_FLAG_LINK) == 0) { + if ((sc->sc_flags & AXE_FLAG_LINK) == 0 || + (ifp->if_drv_flags & IFF_DRV_OACTIVE) != 0) { /* - * don't send anything if there is no link ! + * Don't send anything if there is no link or + * controller is busy. */ return; } @@ -938,6 +941,7 @@ tr_setup: usbd_xfer_set_frame_len(xfer, 0, pos); usbd_transfer_submit(xfer); + ifp->if_drv_flags |= IFF_DRV_OACTIVE; return; default: /* Error */ @@ -945,6 +949,7 @@ tr_setup: usbd_errstr(error)); ifp->if_oerrors++; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ @@ -1077,7 +1082,7 @@ axe_stop(struct usb_ether *ue) AXE_LOCK_ASSERT(sc, MA_OWNED); - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); sc->sc_flags &= ~AXE_FLAG_LINK; /* From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 24 21:25:15 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71C98106578D; Sun, 24 Oct 2010 21:25:15 +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 5F9D98FC19; Sun, 24 Oct 2010 21:25: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 o9OLPFD6040642; Sun, 24 Oct 2010 21:25:15 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OLPFod040640; Sun, 24 Oct 2010 21:25:15 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010242125.o9OLPFod040640@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 24 Oct 2010 21:25:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214299 - stable/8/sys/dev/usb/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 21:25:15 -0000 Author: yongari Date: Sun Oct 24 21:25:15 2010 New Revision: 214299 URL: http://svn.freebsd.org/changeset/base/214299 Log: MFC r213436: Don't count input error twice. uether_rxbuf() already updated that counter. Modified: stable/8/sys/dev/usb/net/if_axe.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/net/if_axe.c ============================================================================== --- stable/8/sys/dev/usb/net/if_axe.c Sun Oct 24 21:23:27 2010 (r214298) +++ stable/8/sys/dev/usb/net/if_axe.c Sun Oct 24 21:25:15 2010 (r214299) @@ -813,13 +813,12 @@ axe_bulk_read_callback(struct usb_xfer * err = EINVAL; break; } - err = uether_rxbuf(ue, pc, pos, len); + uether_rxbuf(ue, pc, pos, len); pos += len + (len % 2); } - } else { - err = uether_rxbuf(ue, pc, 0, actlen); - } + } else + uether_rxbuf(ue, pc, 0, actlen); if (err != 0) ifp->if_ierrors++; From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 24 21:26:41 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAF82106566B; Sun, 24 Oct 2010 21:26:41 +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 C8F758FC1B; Sun, 24 Oct 2010 21:26: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 o9OLQf2p040715; Sun, 24 Oct 2010 21:26:41 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OLQfsL040713; Sun, 24 Oct 2010 21:26:41 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010242126.o9OLQfsL040713@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 24 Oct 2010 21:26:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214300 - stable/8/sys/dev/usb/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 21:26:42 -0000 Author: yongari Date: Sun Oct 24 21:26:41 2010 New Revision: 214300 URL: http://svn.freebsd.org/changeset/base/214300 Log: MFC r213438: RX buffer allocation failure is not an input error. Controller successfully received a frame but we failed to pass it to upper stack due to lack of resources. So update if_iqdrops counter instead of updating if_ierrors counter. Modified: stable/8/sys/dev/usb/net/usb_ethernet.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/net/usb_ethernet.c ============================================================================== --- stable/8/sys/dev/usb/net/usb_ethernet.c Sun Oct 24 21:25:15 2010 (r214299) +++ stable/8/sys/dev/usb/net/usb_ethernet.c Sun Oct 24 21:26:41 2010 (r214300) @@ -558,7 +558,7 @@ uether_rxbuf(struct usb_ether *ue, struc m = uether_newbuf(); if (m == NULL) { - ifp->if_ierrors++; + ifp->if_iqdrops++; return (ENOMEM); } From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 24 21:28:58 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A8D8106564A; Sun, 24 Oct 2010 21:28:58 +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 583718FC0A; Sun, 24 Oct 2010 21:28:58 +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 o9OLSwZP040807; Sun, 24 Oct 2010 21:28:58 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OLSwri040804; Sun, 24 Oct 2010 21:28:58 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010242128.o9OLSwri040804@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 24 Oct 2010 21:28:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214301 - stable/8/sys/dev/usb/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 21:28:58 -0000 Author: yongari Date: Sun Oct 24 21:28:58 2010 New Revision: 214301 URL: http://svn.freebsd.org/changeset/base/214301 Log: MFC r213696: Do not setup interrupt endpoint for axe(4). It seems axe(4) controllers support interrupt endpoint such that enabling interrupt endpoint generates about 1000 interrupts/sec. Controllers transfer 8 bytes data through interrupt endpoint and the data include link UP/DOWN state as well as some PHY related information. Previously axe(4) didn't use the transferred data and didn't even try to read the data. Because axe(4) counts on mii(4) to detect link state changes there is no need to use interrupt endpoint here. This change fixes generation of unnecessary interrupts which was seen when interface is brought to UP. No objections from: hselasky Modified: stable/8/sys/dev/usb/net/if_axe.c stable/8/sys/dev/usb/net/if_axereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/net/if_axe.c ============================================================================== --- stable/8/sys/dev/usb/net/if_axe.c Sun Oct 24 21:26:41 2010 (r214300) +++ stable/8/sys/dev/usb/net/if_axe.c Sun Oct 24 21:28:58 2010 (r214301) @@ -171,7 +171,6 @@ static device_probe_t axe_probe; static device_attach_t axe_attach; static device_detach_t axe_detach; -static usb_callback_t axe_intr_callback; static usb_callback_t axe_bulk_read_callback; static usb_callback_t axe_bulk_write_callback; @@ -215,15 +214,6 @@ static const struct usb_config axe_confi .callback = axe_bulk_read_callback, .timeout = 0, /* no timeout */ }, - - [AXE_INTR_DT_RD] = { - .type = UE_INTERRUPT, - .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_IN, - .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .bufsize = 0, /* use wMaxPacketSize */ - .callback = axe_intr_callback, - }, }; static device_method_t axe_methods[] = { @@ -746,27 +736,6 @@ axe_detach(device_t dev) return (0); } -static void -axe_intr_callback(struct usb_xfer *xfer, usb_error_t error) -{ - switch (USB_GET_STATE(xfer)) { - case USB_ST_TRANSFERRED: - case USB_ST_SETUP: -tr_setup: - usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); - usbd_transfer_submit(xfer); - return; - - default: /* Error */ - if (error != USB_ERR_CANCELLED) { - /* try to clear stall first */ - usbd_xfer_set_stall(xfer); - goto tr_setup; - } - return; - } -} - #if (AXE_BULK_BUF_SIZE >= 0x10000) #error "Please update axe_bulk_read_callback()!" #endif @@ -984,7 +953,6 @@ axe_start(struct usb_ether *ue) /* * start the USB transfers, if not already started: */ - usbd_transfer_start(sc->sc_xfer[AXE_INTR_DT_RD]); usbd_transfer_start(sc->sc_xfer[AXE_BULK_DT_RD]); usbd_transfer_start(sc->sc_xfer[AXE_BULK_DT_WR]); } @@ -1089,7 +1057,6 @@ axe_stop(struct usb_ether *ue) */ usbd_transfer_stop(sc->sc_xfer[AXE_BULK_DT_WR]); usbd_transfer_stop(sc->sc_xfer[AXE_BULK_DT_RD]); - usbd_transfer_stop(sc->sc_xfer[AXE_INTR_DT_RD]); axe_reset(sc); } Modified: stable/8/sys/dev/usb/net/if_axereg.h ============================================================================== --- stable/8/sys/dev/usb/net/if_axereg.h Sun Oct 24 21:26:41 2010 (r214300) +++ stable/8/sys/dev/usb/net/if_axereg.h Sun Oct 24 21:28:58 2010 (r214301) @@ -172,7 +172,6 @@ struct axe_sframe_hdr { enum { AXE_BULK_DT_WR, AXE_BULK_DT_RD, - AXE_INTR_DT_RD, AXE_N_TRANSFER, }; From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 01:02:34 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4107106564A; Mon, 25 Oct 2010 01:02:34 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 771CB8FC08; Mon, 25 Oct 2010 01:02: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 o9P12Y19046152; Mon, 25 Oct 2010 01:02:34 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9P12YBM046148; Mon, 25 Oct 2010 01:02:34 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <201010250102.o9P12YBM046148@svn.freebsd.org> From: Julian Elischer Date: Mon, 25 Oct 2010 01:02:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214310 - in stable/8/sys: ddb net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 01:02:34 -0000 Author: julian Date: Mon Oct 25 01:02:34 2010 New Revision: 214310 URL: http://svn.freebsd.org/changeset/base/214310 Log: MFC of svn change 206639. replace a couple of instances of the same definitions with one in an include file Modified: stable/8/sys/ddb/db_sym.c stable/8/sys/net/vnet.c stable/8/sys/net/vnet.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/ddb/db_sym.c ============================================================================== --- stable/8/sys/ddb/db_sym.c Sun Oct 24 23:25:14 2010 (r214309) +++ stable/8/sys/ddb/db_sym.c Mon Oct 25 01:02:34 2010 (r214310) @@ -64,12 +64,6 @@ static boolean_t db_line_at_pc(c_db_sym_ static int db_cpu = -1; #ifdef VIMAGE -extern uintptr_t *__start_set_vnet; -extern uintptr_t *__stop_set_vnet; - -#define VNET_START (uintptr_t)&__start_set_vnet -#define VNET_STOP (uintptr_t)&__stop_set_vnet - static void *db_vnet = NULL; #endif Modified: stable/8/sys/net/vnet.c ============================================================================== --- stable/8/sys/net/vnet.c Sun Oct 24 23:25:14 2010 (r214309) +++ stable/8/sys/net/vnet.c Mon Oct 25 01:02:34 2010 (r214310) @@ -154,15 +154,6 @@ struct vnet *vnet0; */ /* - * Location of the kernel's 'set_vnet' linker set. - */ -extern uintptr_t *__start_set_vnet; -extern uintptr_t *__stop_set_vnet; - -#define VNET_START (uintptr_t)&__start_set_vnet -#define VNET_STOP (uintptr_t)&__stop_set_vnet - -/* * Number of bytes of data in the 'set_vnet' linker set, and hence the total * size of all kernel virtualized global variables, and the malloc(9) type * that will be used to allocate it. Modified: stable/8/sys/net/vnet.h ============================================================================== --- stable/8/sys/net/vnet.h Sun Oct 24 23:25:14 2010 (r214309) +++ stable/8/sys/net/vnet.h Mon Oct 25 01:02:34 2010 (r214310) @@ -92,6 +92,15 @@ struct vnet { #include /* + * Location of the kernel's 'set_vnet' linker set. + */ +extern uintptr_t *__start_set_vnet; +extern uintptr_t *__stop_set_vnet; + +#define VNET_START (uintptr_t)&__start_set_vnet +#define VNET_STOP (uintptr_t)&__stop_set_vnet + +/* * Functions to allocate and destroy virtual network stacks. */ struct vnet *vnet_alloc(void); From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 01:22:37 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D2B1106564A; Mon, 25 Oct 2010 01:22:37 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EEB598FC0A; Mon, 25 Oct 2010 01:22: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 o9P1MaDL046635; Mon, 25 Oct 2010 01:22:36 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9P1Ma1A046633; Mon, 25 Oct 2010 01:22:36 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <201010250122.o9P1Ma1A046633@svn.freebsd.org> From: Julian Elischer Date: Mon, 25 Oct 2010 01:22:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214311 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 01:22:37 -0000 Author: julian Date: Mon Oct 25 01:22:36 2010 New Revision: 214311 URL: http://svn.freebsd.org/changeset/base/214311 Log: MFC of 206632 If both ALQ and KTR are defined, allow KTR buffer to be used when ALQ is disabled by sysctl. Modified: stable/8/sys/kern/kern_ktr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/kern_ktr.c ============================================================================== --- stable/8/sys/kern/kern_ktr.c Mon Oct 25 01:02:34 2010 (r214310) +++ stable/8/sys/kern/kern_ktr.c Mon Oct 25 01:22:36 2010 (r214311) @@ -194,9 +194,8 @@ ktr_tracepoint(u_int mask, const char *f struct ktr_entry *entry; #ifdef KTR_ALQ struct ale *ale = NULL; -#else - int newindex, saveindex; #endif + int newindex, saveindex; #if defined(KTR_VERBOSE) || defined(KTR_ALQ) struct thread *td; #endif @@ -216,27 +215,30 @@ ktr_tracepoint(u_int mask, const char *f td->td_pflags |= TDP_INKTR; #endif #ifdef KTR_ALQ - if (ktr_alq_enabled && - td->td_critnest == 0 && - (td->td_flags & TDF_IDLETD) == 0 && - td != ald_thread) { - if (ktr_alq_max && ktr_alq_cnt > ktr_alq_max) - goto done; - if ((ale = alq_get(ktr_alq, ALQ_NOWAIT)) == NULL) { - ktr_alq_failed++; + if (ktr_alq_enabled) { + if (td->td_critnest == 0 && + (td->td_flags & TDF_IDLETD) == 0 && + td != ald_thread) { + if (ktr_alq_max && ktr_alq_cnt > ktr_alq_max) + goto done; + if ((ale = alq_get(ktr_alq, ALQ_NOWAIT)) == NULL) { + ktr_alq_failed++; + goto done; + } + ktr_alq_cnt++; + entry = (struct ktr_entry *)ale->ae_data; + } else { goto done; } - ktr_alq_cnt++; - entry = (struct ktr_entry *)ale->ae_data; } else - goto done; -#else - do { - saveindex = ktr_idx; - newindex = (saveindex + 1) & (KTR_ENTRIES - 1); - } while (atomic_cmpset_rel_int(&ktr_idx, saveindex, newindex) == 0); - entry = &ktr_buf[saveindex]; #endif + { + do { + saveindex = ktr_idx; + newindex = (saveindex + 1) & (KTR_ENTRIES - 1); + } while (atomic_cmpset_rel_int(&ktr_idx, saveindex, newindex) == 0); + entry = &ktr_buf[saveindex]; + } entry->ktr_timestamp = KTR_TIME; entry->ktr_cpu = cpu; entry->ktr_thread = curthread; @@ -266,7 +268,7 @@ ktr_tracepoint(u_int mask, const char *f entry->ktr_parms[4] = arg5; entry->ktr_parms[5] = arg6; #ifdef KTR_ALQ - if (ale) + if (ktr_alq_enabled && ale) alq_post(ktr_alq, ale); done: #endif @@ -290,7 +292,9 @@ DB_SHOW_COMMAND(ktr, db_ktr_all) tstate.cur = (ktr_idx - 1) & (KTR_ENTRIES - 1); tstate.first = -1; - db_ktr_verbose = index(modif, 'v') != NULL; + db_ktr_verbose = 0; + db_ktr_verbose |= (index(modif, 'v') != NULL) ? 2 : 0; + db_ktr_verbose |= (index(modif, 'V') != NULL) ? 1 : 0; /* just timestap please */ if (index(modif, 'a') != NULL) { db_disable_pager(); while (cncheckc() != -1) @@ -324,9 +328,11 @@ db_mach_vtrace(void) db_printf(":cpu%d", kp->ktr_cpu); #endif db_printf(")"); - if (db_ktr_verbose) { - db_printf(" %10.10lld %s.%d", (long long)kp->ktr_timestamp, - kp->ktr_file, kp->ktr_line); + if (db_ktr_verbose >= 1) { + db_printf(" %10.10lld", (long long)kp->ktr_timestamp); + } + if (db_ktr_verbose >= 2) { + db_printf(" %s.%d", kp->ktr_file, kp->ktr_line); } db_printf(": "); db_printf(kp->ktr_desc, kp->ktr_parms[0], kp->ktr_parms[1], From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 05:37:12 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98F461065670; Mon, 25 Oct 2010 05:37:12 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 864A98FC18; Mon, 25 Oct 2010 05:37:12 +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 o9P5bCTR051953; Mon, 25 Oct 2010 05:37:12 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9P5bCTL051951; Mon, 25 Oct 2010 05:37:12 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <201010250537.o9P5bCTL051951@svn.freebsd.org> From: Julian Elischer Date: Mon, 25 Oct 2010 05:37:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214315 - stable/8/share/man/man9 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 05:37:13 -0000 Author: julian Date: Mon Oct 25 05:37:12 2010 New Revision: 214315 URL: http://svn.freebsd.org/changeset/base/214315 Log: MFC of 200614 make man page match the output of lock profiling. Modified: stable/8/share/man/man9/LOCK_PROFILING.9 Directory Properties: stable/8/share/man/ (props changed) stable/8/share/man/man1/ (props changed) stable/8/share/man/man3/ (props changed) stable/8/share/man/man4/ (props changed) stable/8/share/man/man5/ (props changed) stable/8/share/man/man7/ (props changed) stable/8/share/man/man8/ (props changed) stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man9/LOCK_PROFILING.9 ============================================================================== --- stable/8/share/man/man9/LOCK_PROFILING.9 Mon Oct 25 03:45:27 2010 (r214314) +++ stable/8/share/man/man9/LOCK_PROFILING.9 Mon Oct 25 05:37:12 2010 (r214315) @@ -114,6 +114,8 @@ The columns are as follows, from left to .Bl -tag -width ".Va cnt_hold" .It Va max The longest continuous hold time in microseconds. +.It Va wait_max +The longest continuous wait time in microseconds. .It Va total The total (accumulated) hold time in microseconds. .It Va wait_total From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 06:16:27 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA10C106566B; Mon, 25 Oct 2010 06:16:27 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B7B648FC13; Mon, 25 Oct 2010 06:16: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 o9P6GRPX052896; Mon, 25 Oct 2010 06:16:27 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9P6GR5R052894; Mon, 25 Oct 2010 06:16:27 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201010250616.o9P6GR5R052894@svn.freebsd.org> From: Kevin Lo Date: Mon, 25 Oct 2010 06:16:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214316 - stable/8/sys/fs/msdosfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 06:16:27 -0000 Author: kevlo Date: Mon Oct 25 06:16:27 2010 New Revision: 214316 URL: http://svn.freebsd.org/changeset/base/214316 Log: MFC r214001: Fix a possible, but very unlikely race where the directory dirent is moved to the location that was used by ".." entry. Modified: stable/8/sys/fs/msdosfs/msdosfs_lookup.c Modified: stable/8/sys/fs/msdosfs/msdosfs_lookup.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_lookup.c Mon Oct 25 05:37:12 2010 (r214315) +++ stable/8/sys/fs/msdosfs/msdosfs_lookup.c Mon Oct 25 06:16:27 2010 (r214316) @@ -594,10 +594,15 @@ msdosfs_deget_dotdot(struct vnode *vp, u vfs_unbusy(mp); if (error == 0) *rvp = DETOV(rdp); - vn_lock(vp, ltype | LK_RETRY); + if (*rvp != vp) + vn_lock(vp, ltype | LK_RETRY); if (vp->v_iflag & VI_DOOMED) { - if (error == 0) - vput(*rvp); + if (error == 0) { + if (*rvp == vp) + vunref(*rvp); + else + vput(*rvp); + } error = ENOENT; } return (error); From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 06:28:19 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0F26106564A; Mon, 25 Oct 2010 06:28:19 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE13F8FC0C; Mon, 25 Oct 2010 06:28: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 o9P6SJf8053256; Mon, 25 Oct 2010 06:28:19 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9P6SJSf053254; Mon, 25 Oct 2010 06:28:19 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <201010250628.o9P6SJSf053254@svn.freebsd.org> From: Julian Elischer Date: Mon, 25 Oct 2010 06:28:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214317 - in stable/8/tools/tools: ath/common termcap tinybsd X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 06:28:19 -0000 Author: julian Date: Mon Oct 25 06:28:19 2010 New Revision: 214317 URL: http://svn.freebsd.org/changeset/base/214317 Log: MFC of 199812 allow tinybsd to abort of a step fails. Modified: stable/8/tools/tools/tinybsd/tinybsd Directory Properties: stable/8/tools/tools/ (props changed) stable/8/tools/tools/ath/ (props changed) stable/8/tools/tools/ath/common/dumpregs.h (props changed) stable/8/tools/tools/ath/common/dumpregs_5210.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5211.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5212.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5416.c (props changed) stable/8/tools/tools/nanobsd/ (props changed) stable/8/tools/tools/netrate/ (props changed) stable/8/tools/tools/netrate/tcpp/ (props changed) stable/8/tools/tools/termcap/termcap.pl (props changed) stable/8/tools/tools/umastat/ (props changed) stable/8/tools/tools/vimage/ (props changed) Modified: stable/8/tools/tools/tinybsd/tinybsd ============================================================================== --- stable/8/tools/tools/tinybsd/tinybsd Mon Oct 25 06:16:27 2010 (r214316) +++ stable/8/tools/tools/tinybsd/tinybsd Mon Oct 25 06:28:19 2010 (r214317) @@ -393,7 +393,7 @@ create_etc() { cd /usr/src/etc/ mkdir -p ${WORKDIR}/var/named/etc/namedb - make distribution DESTDIR=${WORKDIR} + make distribution DESTDIR=${WORKDIR} || exit 1 } create_ssh_keys() { From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 06:33:20 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34D5F106566C; Mon, 25 Oct 2010 06:33:20 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 07D688FC08; Mon, 25 Oct 2010 06:33:20 +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 o9P6XJij053415; Mon, 25 Oct 2010 06:33:19 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9P6XJjP053413; Mon, 25 Oct 2010 06:33:19 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <201010250633.o9P6XJjP053413@svn.freebsd.org> From: Julian Elischer Date: Mon, 25 Oct 2010 06:33:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214318 - stable/8/sys/i386/include X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 06:33:20 -0000 Author: julian Date: Mon Oct 25 06:33:19 2010 New Revision: 214318 URL: http://svn.freebsd.org/changeset/base/214318 Log: MFC of 196811 Slight cleanup to pcpu macros to better match amd64 and to improve readability of the output. Modified: stable/8/sys/i386/include/pcpu.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/i386/include/pcpu.h ============================================================================== --- stable/8/sys/i386/include/pcpu.h Mon Oct 25 06:28:19 2010 (r214317) +++ stable/8/sys/i386/include/pcpu.h Mon Oct 25 06:33:19 2010 (r214318) @@ -137,7 +137,7 @@ extern struct pcpu *pcpup; #define __PCPU_GET(name) __extension__ ({ \ __pcpu_type(name) __res; \ struct __s { \ - u_char __b[MIN(sizeof(__pcpu_type(name)), 4)]; \ + u_char __b[MIN(sizeof(__res), 4)]; \ } __s; \ \ if (sizeof(__res) == 1 || sizeof(__res) == 2 || \ @@ -159,7 +159,7 @@ extern struct pcpu *pcpup; #define __PCPU_ADD(name, val) do { \ __pcpu_type(name) __val; \ struct __s { \ - u_char __b[MIN(sizeof(__pcpu_type(name)), 4)]; \ + u_char __b[MIN(sizeof(__val), 4)]; \ } __s; \ \ __val = (val); \ @@ -199,10 +199,10 @@ extern struct pcpu *pcpup; /* * Sets the value of the per-cpu variable name to value val. */ -#define __PCPU_SET(name, val) { \ +#define __PCPU_SET(name, val) do { \ __pcpu_type(name) __val; \ struct __s { \ - u_char __b[MIN(sizeof(__pcpu_type(name)), 4)]; \ + u_char __b[MIN(sizeof(__val), 4)]; \ } __s; \ \ __val = (val); \ @@ -215,7 +215,7 @@ extern struct pcpu *pcpup; } else { \ *__PCPU_PTR(name) = __val; \ } \ -} +} while (0) #define PCPU_GET(member) __PCPU_GET(pc_ ## member) #define PCPU_ADD(member, val) __PCPU_ADD(pc_ ## member, val) From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 07:06:25 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 582D8106564A; Mon, 25 Oct 2010 07:06:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4583D8FC0C; Mon, 25 Oct 2010 07:06: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 o9P76PQW054234; Mon, 25 Oct 2010 07:06:25 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9P76PTQ054229; Mon, 25 Oct 2010 07:06:25 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201010250706.o9P76PTQ054229@svn.freebsd.org> From: Andriy Gapon Date: Mon, 25 Oct 2010 07:06:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214319 - in stable/8: share/man/man9 sys/vm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 07:06:25 -0000 Author: avg Date: Mon Oct 25 07:06:24 2010 New Revision: 214319 URL: http://svn.freebsd.org/changeset/base/214319 Log: MFC r214095: PG_BUSY -> VPO_BUSY, PG_WANTED -> VPO_WANTED in manual pages and comments Modified: stable/8/share/man/man9/vm_page_io.9 stable/8/share/man/man9/vm_page_sleep_busy.9 stable/8/share/man/man9/vm_page_wakeup.9 stable/8/sys/vm/swap_pager.c Directory Properties: stable/8/share/man/man9/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/share/man/man9/vm_page_io.9 ============================================================================== --- stable/8/share/man/man9/vm_page_io.9 Mon Oct 25 06:33:19 2010 (r214318) +++ stable/8/share/man/man9/vm_page_io.9 Mon Oct 25 07:06:24 2010 (r214319) @@ -52,9 +52,9 @@ function lowers the busy count on the pa count is zero, a .Xr wakeup 9 will be issued if the page has been marked -.Dv PG_WANTED . +.Dv VPO_WANTED . A page is typically marked -.Dv PG_WANTED +.Dv VPO_WANTED by a thread to register its interest in the page to either complete I/O or becoming available for general use. .Sh AUTHORS Modified: stable/8/share/man/man9/vm_page_sleep_busy.9 ============================================================================== --- stable/8/share/man/man9/vm_page_sleep_busy.9 Mon Oct 25 06:33:19 2010 (r214318) +++ stable/8/share/man/man9/vm_page_sleep_busy.9 Mon Oct 25 07:06:24 2010 (r214319) @@ -42,7 +42,7 @@ The .Fn vm_page_sleep_busy function waits until the -.Dv PG_BUSY +.Dv VPO_BUSY flag is cleared. If .Fa also_m_busy Modified: stable/8/share/man/man9/vm_page_wakeup.9 ============================================================================== --- stable/8/share/man/man9/vm_page_wakeup.9 Mon Oct 25 06:33:19 2010 (r214318) +++ stable/8/share/man/man9/vm_page_wakeup.9 Mon Oct 25 07:06:24 2010 (r214319) @@ -50,20 +50,20 @@ of a page. .Pp .Fn vm_page_busy sets the -.Dv PG_BUSY +.Dv VPO_BUSY flag in the page. .Pp .Fn vm_page_flash checks to see if there is anybody waiting on the page -.Dv ( PG_WANTED +.Dv ( VPO_WANTED will be set), and if so, clears the -.Dv PG_WANTED +.Dv VPO_WANTED flag and notifies whoever is waiting via .Fn wakeup . .Pp .Fn vm_page_wakeup clears the -.Dv PG_BUSY +.Dv VPO_BUSY flag on the page, and calls .Fn vm_page_flash in case somebody has been waiting for it. Modified: stable/8/sys/vm/swap_pager.c ============================================================================== --- stable/8/sys/vm/swap_pager.c Mon Oct 25 06:33:19 2010 (r214318) +++ stable/8/sys/vm/swap_pager.c Mon Oct 25 07:06:24 2010 (r214319) @@ -1456,8 +1456,8 @@ swap_pager_putpages(vm_object_t object, * Completion routine for asynchronous reads and writes from/to swap. * Also called manually by synchronous code to finish up a bp. * - * For READ operations, the pages are PG_BUSY'd. For WRITE operations, - * the pages are vm_page_t->busy'd. For READ operations, we PG_BUSY + * For READ operations, the pages are VPO_BUSY'd. For WRITE operations, + * the pages are vm_page_t->busy'd. For READ operations, we VPO_BUSY * unbusy all pages except the 'main' request page. For WRITE * operations, we vm_page_t->busy'd unbusy all pages ( we can do this * because we marked them all VM_PAGER_PEND on return from putpages ). From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 07:11:38 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BA80106566C; Mon, 25 Oct 2010 07:11:38 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F4148FC19; Mon, 25 Oct 2010 07:11:38 +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 o9P7Bci3054406; Mon, 25 Oct 2010 07:11:38 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9P7BcN5054404; Mon, 25 Oct 2010 07:11:38 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201010250711.o9P7BcN5054404@svn.freebsd.org> From: Andriy Gapon Date: Mon, 25 Oct 2010 07:11:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214320 - stable/8/share/man/man9 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 07:11:38 -0000 Author: avg Date: Mon Oct 25 07:11:37 2010 New Revision: 214320 URL: http://svn.freebsd.org/changeset/base/214320 Log: MFC r214096: VOP_GETPAGES.9: clarify and correct description of parameters and requirements Modified: stable/8/share/man/man9/VOP_GETPAGES.9 Directory Properties: stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man9/VOP_GETPAGES.9 ============================================================================== --- stable/8/share/man/man9/VOP_GETPAGES.9 Mon Oct 25 07:06:24 2010 (r214319) +++ stable/8/share/man/man9/VOP_GETPAGES.9 Mon Oct 25 07:11:37 2010 (r214320) @@ -41,9 +41,9 @@ .In sys/vnode.h .In vm/vm.h .Ft int -.Fn VOP_GETPAGES "struct vnode *vp" "vm_page_t *m" "int count" "int reqpage" "vm_ooffset_t offset" +.Fn VOP_GETPAGES "struct vnode *vp" "vm_page_t *ma" "int count" "int reqpage" "vm_ooffset_t offset" .Ft int -.Fn VOP_PUTPAGES "struct vnode *vp" "vm_page_t *m" "int count" "int sync" "int *rtvals" "vm_ooffset_t offset" +.Fn VOP_PUTPAGES "struct vnode *vp" "vm_page_t *ma" "int count" "int sync" "int *rtvals" "vm_ooffset_t offset" .Sh DESCRIPTION The .Fn VOP_GETPAGES @@ -66,11 +66,11 @@ The arguments are: .Bl -tag -width reqpage .It Fa vp The file to access. -.It Fa m -Pointer to the first element of an array of contiguous pages representing a +.It Fa ma +Pointer to the first element of an array of pages representing a contiguous region of the file to be read or written. .It Fa count -The number of pages in the array. +The number of bytes that should be read into the pages of the array. .It Fa sync .Dv VM_PAGER_PUT_SYNC if the write should be synchronous. @@ -123,22 +123,27 @@ The page was not handled by this request The .Fn VOP_GETPAGES method is expected to release any pages in -.Fa m +.Fa ma that it does not successfully handle, by calling .Xr vm_page_free 9 . When it succeeds, .Fn VOP_GETPAGES -must set the valid bits appropriately, clear the dirty bit -(using -.Xr vm_page_undirty 9 ) , -either activate the page (if its wanted bit is set) +must set the valid bits appropriately. +.Fn VOP_GETPAGES +must keep +.Fa reqpage +busy. +It must unbusy all other successfully handled pages and put them +on appropriate page queue(s). +For example, +.Fn VOP_GETPAGES +may either activate a page (if its wanted bit is set) or deactivate it (otherwise), and finally call .Xr vm_page_wakeup 9 -to arouse any threads currently waiting for the page to be faulted in, -for each page read. +to arouse any threads currently waiting for the page to be faulted in. .Sh RETURN VALUES If it successfully reads -.Fa m[reqpage] , +.Fa ma[reqpage] , .Fn VOP_GETPAGES returns .Dv VM_PAGER_OK ; From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 07:30:14 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B7231065670; Mon, 25 Oct 2010 07:30:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 685888FC08; Mon, 25 Oct 2010 07:30: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 o9P7UEmx054963; Mon, 25 Oct 2010 07:30:14 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9P7UEiw054958; Mon, 25 Oct 2010 07:30:14 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201010250730.o9P7UEiw054958@svn.freebsd.org> From: Andriy Gapon Date: Mon, 25 Oct 2010 07:30:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214322 - in stable/8: . share/man/man9 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 07:30:14 -0000 Author: avg Date: Mon Oct 25 07:30:14 2010 New Revision: 214322 URL: http://svn.freebsd.org/changeset/base/214322 Log: MFC r214097: catch up manual pages with rename of vm_page_sleep_busy to vm_page_sleep_if_busy Added: stable/8/share/man/man9/vm_page_sleep_if_busy.9 - copied unchanged from r214097, head/share/man/man9/vm_page_sleep_if_busy.9 Deleted: stable/8/share/man/man9/vm_page_sleep_busy.9 Modified: stable/8/ObsoleteFiles.inc stable/8/share/man/man9/Makefile stable/8/share/man/man9/vm_page_wakeup.9 Directory Properties: stable/8/share/man/man9/ (props changed) Modified: stable/8/ObsoleteFiles.inc ============================================================================== --- stable/8/ObsoleteFiles.inc Mon Oct 25 07:17:07 2010 (r214321) +++ stable/8/ObsoleteFiles.inc Mon Oct 25 07:30:14 2010 (r214322) @@ -14,6 +14,8 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20101025: catch up with vm_page_sleep_if_busy rename +OLD_FILES+=usr/share/man/man9/vm_page_sleep_busy.9.gz # 20100327: fusword.9 and susword.9 removed OLD_FILES+=usr/share/man/man9/fusword.9.gz OLD_FILES+=usr/share/man/man9/susword.9.gz Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Mon Oct 25 07:17:07 2010 (r214321) +++ stable/8/share/man/man9/Makefile Mon Oct 25 07:30:14 2010 (r214322) @@ -324,7 +324,7 @@ MAN= accept_filter.9 \ vm_page_lookup.9 \ vm_page_protect.9 \ vm_page_rename.9 \ - vm_page_sleep_busy.9 \ + vm_page_sleep_if_busy.9 \ vm_page_wakeup.9 \ vm_page_wire.9 \ vm_page_zero_fill.9 \ Copied: stable/8/share/man/man9/vm_page_sleep_if_busy.9 (from r214097, head/share/man/man9/vm_page_sleep_if_busy.9) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/share/man/man9/vm_page_sleep_if_busy.9 Mon Oct 25 07:30:14 2010 (r214322, copy of r214097, head/share/man/man9/vm_page_sleep_if_busy.9) @@ -0,0 +1,68 @@ +.\" +.\" Copyright (C) 2001 Chad David . 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(s), this list of conditions and the following disclaimer as +.\" the first lines of this file unmodified other than the possible +.\" addition of one or more copyright notices. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +.\" DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 13, 2001 +.Dt VM_PAGE_SLEEP_IF_BUSY 9 +.Os +.Sh NAME +.Nm vm_page_sleep_if_busy +.Nd "wait for a busy page to become unbusy" +.Sh SYNOPSIS +.In sys/param.h +.In vm/vm.h +.In vm/vm_page.h +.Ft int +.Fn vm_page_sleep_if_busy "vm_page_t m" "int also_m_busy" "const char *wmesg" +.Sh DESCRIPTION +The +.Fn vm_page_sleep_if_busy +function waits until the +.Dv VPO_BUSY +flag is cleared. +If +.Fa also_m_busy +is non-zero, it also waits for +.Fa m->busy +to become zero. +.Sh RETURN VALUES +If +.Fn vm_page_sleep_if_busy +finds the page busy it returns +.Dv TRUE . +If not, it returns +.Dv FALSE . +Returning +.Dv TRUE +does not necessary mean that +.Fn vm_page_sleep_if_busy +slept, but only that +.Fn splvm +was called. +.Sh AUTHORS +This manual page was written by +.An Chad David Aq davidc@acns.ab.ca . Modified: stable/8/share/man/man9/vm_page_wakeup.9 ============================================================================== --- stable/8/share/man/man9/vm_page_wakeup.9 Mon Oct 25 07:17:07 2010 (r214321) +++ stable/8/share/man/man9/vm_page_wakeup.9 Mon Oct 25 07:30:14 2010 (r214322) @@ -68,7 +68,7 @@ flag on the page, and calls .Fn vm_page_flash in case somebody has been waiting for it. .Sh SEE ALSO -.Xr vm_page_sleep_busy 9 , +.Xr vm_page_sleep_if_busy 9 , .Xr wakeup 9 .Sh AUTHORS This manual page was written by From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 07:36:39 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6B0C106566B; Mon, 25 Oct 2010 07:36:39 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A53C68FC0C; Mon, 25 Oct 2010 07:36: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 o9P7adnr055140; Mon, 25 Oct 2010 07:36:39 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9P7ad6R055138; Mon, 25 Oct 2010 07:36:39 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201010250736.o9P7ad6R055138@svn.freebsd.org> From: Andriy Gapon Date: Mon, 25 Oct 2010 07:36:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214323 - stable/8 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 07:36:39 -0000 Author: avg Date: Mon Oct 25 07:36:39 2010 New Revision: 214323 URL: http://svn.freebsd.org/changeset/base/214323 Log: add dates along with revision numbers in UPDATING entry for 20101022 This is a direct commit. Modified: stable/8/UPDATING Modified: stable/8/UPDATING ============================================================================== --- stable/8/UPDATING Mon Oct 25 07:30:14 2010 (r214322) +++ stable/8/UPDATING Mon Oct 25 07:36:39 2010 (r214323) @@ -18,8 +18,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. 20101022: A workaround for a fixed ld bug has been removed in kernel code, so make sure that your system ld is built from sources after - revision 211583 (r210245 if building stable/8 kernel on head, - r211584 for stable/7). A symptom of incorrect ld version is + revision 211583 from 2010-08-21 (r210245 from 2010-07-19 if + building stable/8 kernel on head, r211584 from 2010-08-21 for + stable/7). A symptom of incorrect ld version is different addresses for set_pcpu section and __start_set_pcpu symbol in kernel and/or modules. From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 07:58:38 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64C92106566C; Mon, 25 Oct 2010 07:58:38 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 51E5D8FC16; Mon, 25 Oct 2010 07:58:38 +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 o9P7wc7o055725; Mon, 25 Oct 2010 07:58:38 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9P7wcW2055718; Mon, 25 Oct 2010 07:58:38 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201010250758.o9P7wcW2055718@svn.freebsd.org> From: Andriy Gapon Date: Mon, 25 Oct 2010 07:58:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214326 - in stable/8/sys: amd64/conf i386/conf ia64/conf pc98/conf powerpc/conf sparc64/conf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 07:58:38 -0000 Author: avg Date: Mon Oct 25 07:58:37 2010 New Revision: 214326 URL: http://svn.freebsd.org/changeset/base/214326 Log: stable/8: add options KDB and KDB_TRACE to GENERIC kernels Now that we have code for printing a stack trace on panic using stack(9) facility without any debugger backend configured, use this ability in GENERIC kernels to slightly increase amount of debugging information available in default installations. This change should not break anything for those who include GENERIC into a custom kernel config file and have the above options already enabled. They should only get a warning about duplicate options. This commit should not change behavior of GENERIC kernels for panics and traps with respect to core dumping and automatic reset. As no debugger backend is configured, enter-to-debugger key combination should still be ignored. With this commit the sizes of GENERIC kernels increase by one to two KB. This is a direct commit to the branch. Approved by: re No objections: core, secteam Modified: stable/8/sys/amd64/conf/GENERIC stable/8/sys/i386/conf/GENERIC stable/8/sys/ia64/conf/GENERIC stable/8/sys/pc98/conf/GENERIC stable/8/sys/powerpc/conf/GENERIC stable/8/sys/sparc64/conf/GENERIC Modified: stable/8/sys/amd64/conf/GENERIC ============================================================================== --- stable/8/sys/amd64/conf/GENERIC Mon Oct 25 07:41:21 2010 (r214325) +++ stable/8/sys/amd64/conf/GENERIC Mon Oct 25 07:58:37 2010 (r214326) @@ -77,6 +77,9 @@ options FLOWTABLE # per-cpu routing ca #options KDTRACE_HOOKS # Kernel DTrace hooks options INCLUDE_CONFIG_FILE # Include this file in kernel +options KDB # Kernel debugger related code +options KDB_TRACE # Print a stack trace for a panic + # Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel Modified: stable/8/sys/i386/conf/GENERIC ============================================================================== --- stable/8/sys/i386/conf/GENERIC Mon Oct 25 07:41:21 2010 (r214325) +++ stable/8/sys/i386/conf/GENERIC Mon Oct 25 07:58:37 2010 (r214326) @@ -77,6 +77,9 @@ options FLOWTABLE # per-cpu routing ca #options KDTRACE_HOOKS # Kernel DTrace hooks options INCLUDE_CONFIG_FILE # Include this file in kernel +options KDB # Kernel debugger related code +options KDB_TRACE # Print a stack trace for a panic + # To make an SMP kernel, the next two lines are needed options SMP # Symmetric MultiProcessor Kernel device apic # I/O APIC Modified: stable/8/sys/ia64/conf/GENERIC ============================================================================== --- stable/8/sys/ia64/conf/GENERIC Mon Oct 25 07:41:21 2010 (r214325) +++ stable/8/sys/ia64/conf/GENERIC Mon Oct 25 07:58:37 2010 (r214326) @@ -39,6 +39,8 @@ options INET # InterNETworking options INET6 # IPv6 communications protocols options INVARIANTS # Enable calls of extra sanity checking options INVARIANT_SUPPORT # required by INVARIANTS +options KDB # Kernel debugger related code +options KDB_TRACE # Print a stack trace for a panic options KTRACE # ktrace(1) syscall trace support options MAC # TrustedBSD MAC Framework options MD_ROOT # MD usable as root device Modified: stable/8/sys/pc98/conf/GENERIC ============================================================================== --- stable/8/sys/pc98/conf/GENERIC Mon Oct 25 07:41:21 2010 (r214325) +++ stable/8/sys/pc98/conf/GENERIC Mon Oct 25 07:58:37 2010 (r214326) @@ -77,6 +77,9 @@ options AUDIT # Security event auditi options MAC # TrustedBSD MAC Framework options INCLUDE_CONFIG_FILE # Include this file in kernel +options KDB # Kernel debugger related code +options KDB_TRACE # Print a stack trace for a panic + # To make an SMP kernel, the next two lines are needed #options SMP # Symmetric MultiProcessor Kernel #device apic # I/O APIC Modified: stable/8/sys/powerpc/conf/GENERIC ============================================================================== --- stable/8/sys/powerpc/conf/GENERIC Mon Oct 25 07:41:21 2010 (r214325) +++ stable/8/sys/powerpc/conf/GENERIC Mon Oct 25 07:58:37 2010 (r214326) @@ -68,6 +68,9 @@ options AUDIT # Security event auditi options MAC # TrustedBSD MAC Framework options INCLUDE_CONFIG_FILE # Include this file in kernel +options KDB # Kernel debugger related code +options KDB_TRACE # Print a stack trace for a panic + # To make an SMP kernel, the next line is needed #options SMP # Symmetric MultiProcessor Kernel Modified: stable/8/sys/sparc64/conf/GENERIC ============================================================================== --- stable/8/sys/sparc64/conf/GENERIC Mon Oct 25 07:41:21 2010 (r214325) +++ stable/8/sys/sparc64/conf/GENERIC Mon Oct 25 07:58:37 2010 (r214326) @@ -74,6 +74,9 @@ options AUDIT # Security event auditi options MAC # TrustedBSD MAC Framework options INCLUDE_CONFIG_FILE # Include this file in kernel +options KDB # Kernel debugger related code +options KDB_TRACE # Print a stack trace for a panic + # Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 08:18:29 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84277106564A; Mon, 25 Oct 2010 08:18:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 581EB8FC16; Mon, 25 Oct 2010 08:18: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 o9P8IT9e056571; Mon, 25 Oct 2010 08:18:29 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9P8ITKn056569; Mon, 25 Oct 2010 08:18:29 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201010250818.o9P8ITKn056569@svn.freebsd.org> From: Alexander Motin Date: Mon, 25 Oct 2010 08:18:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214330 - stable/8/sys/geom/concat X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 08:18:29 -0000 Author: mav Date: Mon Oct 25 08:18:29 2010 New Revision: 214330 URL: http://svn.freebsd.org/changeset/base/214330 Log: MFC r212754: Add support for dumping kernel to gconcat. Dumping goes to the component, where dump partition begins. Modified: stable/8/sys/geom/concat/g_concat.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/geom/concat/g_concat.c ============================================================================== --- stable/8/sys/geom/concat/g_concat.c Mon Oct 25 08:11:51 2010 (r214329) +++ stable/8/sys/geom/concat/g_concat.c Mon Oct 25 08:18:29 2010 (r214330) @@ -212,6 +212,39 @@ g_concat_access(struct g_provider *pp, i } static void +g_concat_kernel_dump(struct bio *bp) +{ + struct g_concat_softc *sc; + struct g_concat_disk *disk; + struct bio *cbp; + struct g_kerneldump *gkd; + u_int i; + + sc = bp->bio_to->geom->softc; + gkd = (struct g_kerneldump *)bp->bio_data; + for (i = 0; i < sc->sc_ndisks; i++) { + if (sc->sc_disks[i].d_start <= gkd->offset && + sc->sc_disks[i].d_end > gkd->offset) + break; + } + if (i == sc->sc_ndisks) + g_io_deliver(bp, EOPNOTSUPP); + disk = &sc->sc_disks[i]; + gkd->offset -= disk->d_start; + if (gkd->length > disk->d_end - disk->d_start - gkd->offset) + gkd->length = disk->d_end - disk->d_start - gkd->offset; + cbp = g_clone_bio(bp); + if (cbp == NULL) { + g_io_deliver(bp, ENOMEM); + return; + } + cbp->bio_done = g_std_done; + g_io_request(cbp, disk->d_consumer); + G_CONCAT_DEBUG(1, "Kernel dump will go to %s.", + disk->d_consumer->provider->name); +} + +static void g_concat_flush(struct g_concat_softc *sc, struct bio *bp) { struct bio_queue_head queue; @@ -280,7 +313,12 @@ g_concat_start(struct bio *bp) g_concat_flush(sc, bp); return; case BIO_GETATTR: + if (strcmp("GEOM::kerneldump", bp->bio_attribute) == 0) { + g_concat_kernel_dump(bp); + return; + } /* To which provider it should be delivered? */ + /* FALLTHROUGH */ default: g_io_deliver(bp, EOPNOTSUPP); return; From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 13:01:20 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F3721065670; Mon, 25 Oct 2010 13:01:20 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F0A3E8FC1E; Mon, 25 Oct 2010 13:01: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 o9PD1Jq7065623; Mon, 25 Oct 2010 13:01:19 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PD1JUv065620; Mon, 25 Oct 2010 13:01:19 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010251301.o9PD1JUv065620@svn.freebsd.org> From: Attilio Rao Date: Mon, 25 Oct 2010 13:01:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214336 - stable/8/sys/dev/aac X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 13:01:20 -0000 Author: attilio Date: Mon Oct 25 13:01:19 2010 New Revision: 214336 URL: http://svn.freebsd.org/changeset/base/214336 Log: MFC r212661 and r212756: Implement correct refcounting of cdevsw open/close pair and detach stopping for it. Sponsored by: Sandvine Incorporated Modified: stable/8/sys/dev/aac/aac.c stable/8/sys/dev/aac/aacvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/aac/aac.c ============================================================================== --- stable/8/sys/dev/aac/aac.c Mon Oct 25 11:16:50 2010 (r214335) +++ stable/8/sys/dev/aac/aac.c Mon Oct 25 13:01:19 2010 (r214336) @@ -189,9 +189,9 @@ static char *aac_describe_code(struct aa /* Management Interface */ static d_open_t aac_open; -static d_close_t aac_close; static d_ioctl_t aac_ioctl; static d_poll_t aac_poll; +static void aac_cdevpriv_dtor(void *arg); static int aac_ioctl_sendfib(struct aac_softc *sc, caddr_t ufib); static int aac_ioctl_send_raw_srb(struct aac_softc *sc, caddr_t arg); static void aac_handle_aif(struct aac_softc *sc, @@ -214,7 +214,6 @@ static struct cdevsw aac_cdevsw = { .d_version = D_VERSION, .d_flags = D_NEEDGIANT, .d_open = aac_open, - .d_close = aac_close, .d_ioctl = aac_ioctl, .d_poll = aac_poll, .d_name = "aac", @@ -660,9 +659,6 @@ aac_detach(device_t dev) sc = device_get_softc(dev); fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); - if (sc->aac_state & AAC_STATE_OPEN) - return(EBUSY); - callout_drain(&sc->aac_daemontime); /* Remove the child containers */ @@ -2804,23 +2800,8 @@ aac_open(struct cdev *dev, int flags, in sc = dev->si_drv1; fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); - sc->aac_open_cnt++; - sc->aac_state |= AAC_STATE_OPEN; - - return 0; -} - -static int -aac_close(struct cdev *dev, int flags, int fmt, struct thread *td) -{ - struct aac_softc *sc; - - sc = dev->si_drv1; - fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); - sc->aac_open_cnt--; - /* Mark this unit as no longer open */ - if (sc->aac_open_cnt == 0) - sc->aac_state &= ~AAC_STATE_OPEN; + device_busy(sc->aac_dev); + devfs_set_cdevpriv(sc, aac_cdevpriv_dtor); return 0; } @@ -3208,6 +3189,21 @@ out: } /* + * cdevpriv interface private destructor. + */ +static void +aac_cdevpriv_dtor(void *arg) +{ + struct aac_softc *sc; + + sc = arg; + fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); + mtx_lock(&Giant); + device_unbusy(sc->aac_dev); + mtx_unlock(&Giant); +} + +/* * Handle an AIF sent to us by the controller; queue it for later reference. * If the queue fills up, then drop the older entries. */ Modified: stable/8/sys/dev/aac/aacvar.h ============================================================================== --- stable/8/sys/dev/aac/aacvar.h Mon Oct 25 11:16:50 2010 (r214335) +++ stable/8/sys/dev/aac/aacvar.h Mon Oct 25 13:01:19 2010 (r214336) @@ -319,10 +319,9 @@ struct aac_softc /* controller features, limits and status */ int aac_state; #define AAC_STATE_SUSPEND (1<<0) -#define AAC_STATE_OPEN (1<<1) +#define AAC_STATE_UNUSED0 (1<<1) #define AAC_STATE_INTERRUPTS_ON (1<<2) #define AAC_STATE_AIF_SLEEPER (1<<3) - int aac_open_cnt; struct FsaRevision aac_revision; /* controller hardware interface */ From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 13:16:11 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D6DB10656A4; Mon, 25 Oct 2010 13:16:11 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6AF6E8FC13; Mon, 25 Oct 2010 13:16: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 o9PDGBsX066140; Mon, 25 Oct 2010 13:16:11 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PDGB4L066137; Mon, 25 Oct 2010 13:16:11 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010251316.o9PDGB4L066137@svn.freebsd.org> From: Attilio Rao Date: Mon, 25 Oct 2010 13:16:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214338 - in stable/8/sys: netinet netinet6 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 13:16:11 -0000 Author: attilio Date: Mon Oct 25 13:16:11 2010 New Revision: 214338 URL: http://svn.freebsd.org/changeset/base/214338 Log: IP_BINDANY is not correctly handled in getsockopt() case. Fix it by specifying the correct bits. Modified: stable/8/sys/netinet/ip_output.c stable/8/sys/netinet6/ip6_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/ip_output.c ============================================================================== --- stable/8/sys/netinet/ip_output.c Mon Oct 25 13:13:16 2010 (r214337) +++ stable/8/sys/netinet/ip_output.c Mon Oct 25 13:16:11 2010 (r214338) @@ -1127,6 +1127,7 @@ ip_ctloutput(struct socket *so, struct s case IP_FAITH: case IP_ONESBCAST: case IP_DONTFRAG: + case IP_BINDANY: switch (sopt->sopt_name) { case IP_TOS: @@ -1182,6 +1183,9 @@ ip_ctloutput(struct socket *so, struct s case IP_DONTFRAG: optval = OPTBIT(INP_DONTFRAG); break; + case IP_BINDANY: + optval = OPTBIT(INP_BINDANY); + break; } error = sooptcopyout(sopt, &optval, sizeof optval); break; Modified: stable/8/sys/netinet6/ip6_output.c ============================================================================== --- stable/8/sys/netinet6/ip6_output.c Mon Oct 25 13:13:16 2010 (r214337) +++ stable/8/sys/netinet6/ip6_output.c Mon Oct 25 13:16:11 2010 (r214338) @@ -1798,6 +1798,7 @@ do { \ case IPV6_PORTRANGE: case IPV6_RECVTCLASS: case IPV6_AUTOFLOWLABEL: + case IPV6_BINDANY: switch (optname) { case IPV6_RECVHOPOPTS: From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 13:34:55 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C61D41065785; Mon, 25 Oct 2010 13:34:55 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B28FE8FC14; Mon, 25 Oct 2010 13:34: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 o9PDYtpK066688; Mon, 25 Oct 2010 13:34:55 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PDYtK0066681; Mon, 25 Oct 2010 13:34:55 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010251334.o9PDYtK0066681@svn.freebsd.org> From: Attilio Rao Date: Mon, 25 Oct 2010 13:34:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214339 - in stable/8/sys: conf modules/krpc netinet nlm rpc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 13:34:55 -0000 Author: attilio Date: Mon Oct 25 13:34:55 2010 New Revision: 214339 URL: http://svn.freebsd.org/changeset/base/214339 Log: MFC r213103: Make the RPC specific __rpc_inet_ntop() and __rpc_inet_pton() general in the kernel. Sponsored by: Sandvine Incorporated Deleted: stable/8/sys/rpc/inet_ntop.c stable/8/sys/rpc/inet_pton.c Modified: stable/8/sys/conf/files stable/8/sys/modules/krpc/Makefile stable/8/sys/netinet/in.h stable/8/sys/nlm/nlm_prot_impl.c stable/8/sys/rpc/rpc_com.h stable/8/sys/rpc/rpc_generic.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Mon Oct 25 13:16:11 2010 (r214338) +++ stable/8/sys/conf/files Mon Oct 25 13:34:55 2010 (r214339) @@ -2283,6 +2283,8 @@ libkern/iconv_xlat16.c optional libicon libkern/index.c standard libkern/inet_aton.c standard libkern/inet_ntoa.c standard +libkern/inet_ntop.c standard +libkern/inet_pton.c standard libkern/mcount.c optional profiling-routine libkern/memcmp.c standard libkern/qsort.c standard @@ -2689,8 +2691,6 @@ rpc/clnt_dg.c optional krpc | nfslockd rpc/clnt_rc.c optional krpc | nfslockd | nfsclient | nfscl | nfsd rpc/clnt_vc.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/getnetconfig.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd -rpc/inet_ntop.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd -rpc/inet_pton.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/replay.c optional krpc | nfslockd | nfsserver | nfscl | nfsd rpc/rpc_callmsg.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/rpc_generic.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd Modified: stable/8/sys/modules/krpc/Makefile ============================================================================== --- stable/8/sys/modules/krpc/Makefile Mon Oct 25 13:16:11 2010 (r214338) +++ stable/8/sys/modules/krpc/Makefile Mon Oct 25 13:34:55 2010 (r214339) @@ -9,8 +9,6 @@ SRCS= auth_none.c \ clnt_rc.c \ clnt_vc.c \ getnetconfig.c \ - inet_ntop.c \ - inet_pton.c \ rpc_callmsg.c \ rpc_generic.c \ rpc_prot.c \ Modified: stable/8/sys/netinet/in.h ============================================================================== --- stable/8/sys/netinet/in.h Mon Oct 25 13:16:11 2010 (r214338) +++ stable/8/sys/netinet/in.h Mon Oct 25 13:34:55 2010 (r214339) @@ -744,6 +744,8 @@ int in_localip(struct in_addr); int inet_aton(const char *, struct in_addr *); /* in libkern */ char *inet_ntoa(struct in_addr); /* in libkern */ char *inet_ntoa_r(struct in_addr ina, char *buf); /* in libkern */ +char *inet_ntop(int, const void *, char *, socklen_t); /* in libkern */ +int inet_pton(int af, const char *, void *); /* in libkern */ void in_ifdetach(struct ifnet *); #define in_hosteq(s, t) ((s).s_addr == (t).s_addr) Modified: stable/8/sys/nlm/nlm_prot_impl.c ============================================================================== --- stable/8/sys/nlm/nlm_prot_impl.c Mon Oct 25 13:16:11 2010 (r214338) +++ stable/8/sys/nlm/nlm_prot_impl.c Mon Oct 25 13:34:55 2010 (r214339) @@ -1003,13 +1003,13 @@ nlm_find_host_by_addr(const struct socka switch (addr->sa_family) { case AF_INET: - __rpc_inet_ntop(AF_INET, + inet_ntop(AF_INET, &((const struct sockaddr_in *) addr)->sin_addr, tmp, sizeof tmp); break; #ifdef INET6 case AF_INET6: - __rpc_inet_ntop(AF_INET6, + inet_ntop(AF_INET6, &((const struct sockaddr_in6 *) addr)->sin6_addr, tmp, sizeof tmp); break; Modified: stable/8/sys/rpc/rpc_com.h ============================================================================== --- stable/8/sys/rpc/rpc_com.h Mon Oct 25 13:16:11 2010 (r214338) +++ stable/8/sys/rpc/rpc_com.h Mon Oct 25 13:34:55 2010 (r214339) @@ -111,10 +111,6 @@ extern struct netbuf *__rpc_uaddr2taddr_ extern int __rpc_seman2socktype(int); extern int __rpc_socktype2seman(int); extern int __rpc_sockisbound(struct socket*); -extern const char *__rpc_inet_ntop(int af, const void * __restrict src, - char * __restrict dst, socklen_t size); -extern int __rpc_inet_pton(int af, const char * __restrict src, - void * __restrict dst); extern int bindresvport(struct socket *so, struct sockaddr *sa); struct xucred; Modified: stable/8/sys/rpc/rpc_generic.c ============================================================================== --- stable/8/sys/rpc/rpc_generic.c Mon Oct 25 13:16:11 2010 (r214338) +++ stable/8/sys/rpc/rpc_generic.c Mon Oct 25 13:34:55 2010 (r214339) @@ -306,7 +306,7 @@ __rpc_taddr2uaddr_af(int af, const struc switch (af) { case AF_INET: sin = nbuf->buf; - if (__rpc_inet_ntop(af, &sin->sin_addr, namebuf, sizeof namebuf) + if (inet_ntop(af, &sin->sin_addr, namebuf, sizeof namebuf) == NULL) return NULL; port = ntohs(sin->sin_port); @@ -318,7 +318,7 @@ __rpc_taddr2uaddr_af(int af, const struc #ifdef INET6 case AF_INET6: sin6 = nbuf->buf; - if (__rpc_inet_ntop(af, &sin6->sin6_addr, namebuf6, sizeof namebuf6) + if (inet_ntop(af, &sin6->sin6_addr, namebuf6, sizeof namebuf6) == NULL) return NULL; port = ntohs(sin6->sin6_port); @@ -396,7 +396,7 @@ __rpc_uaddr2taddr_af(int af, const char memset(sin, 0, sizeof *sin); sin->sin_family = AF_INET; sin->sin_port = htons(port); - if (__rpc_inet_pton(AF_INET, addrstr, &sin->sin_addr) <= 0) { + if (inet_pton(AF_INET, addrstr, &sin->sin_addr) <= 0) { free(sin, M_RPC); free(ret, M_RPC); ret = NULL; @@ -414,7 +414,7 @@ __rpc_uaddr2taddr_af(int af, const char memset(sin6, 0, sizeof *sin6); sin6->sin6_family = AF_INET6; sin6->sin6_port = htons(port); - if (__rpc_inet_pton(AF_INET6, addrstr, &sin6->sin6_addr) <= 0) { + if (inet_pton(AF_INET6, addrstr, &sin6->sin6_addr) <= 0) { free(sin6, M_RPC); free(ret, M_RPC); ret = NULL; From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 14:02:14 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E7CC106566C; Mon, 25 Oct 2010 14:02:14 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C1BB8FC0C; Mon, 25 Oct 2010 14:02: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 o9PE2EHP067398; Mon, 25 Oct 2010 14:02:14 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PE2EdA067396; Mon, 25 Oct 2010 14:02:14 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010251402.o9PE2EdA067396@svn.freebsd.org> From: Attilio Rao Date: Mon, 25 Oct 2010 14:02:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214340 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 14:02:14 -0000 Author: attilio Date: Mon Oct 25 14:02:14 2010 New Revision: 214340 URL: http://svn.freebsd.org/changeset/base/214340 Log: MFC r212096 by emaste: As long as we are going to panic anyway, there's no need to hide additional information behind DIAGNOSTIC. Sponsored by: Sandvine Incorporated Modified: stable/8/sys/kern/vfs_subr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/vfs_subr.c ============================================================================== --- stable/8/sys/kern/vfs_subr.c Mon Oct 25 13:34:55 2010 (r214339) +++ stable/8/sys/kern/vfs_subr.c Mon Oct 25 14:02:14 2010 (r214340) @@ -2203,9 +2203,7 @@ vputx(struct vnode *vp, int func) } if (vp->v_usecount != 1) { -#ifdef DIAGNOSTIC vprint("vputx: negative ref count", vp); -#endif panic("vputx: negative ref cnt"); } CTR2(KTR_VFS, "%s: return vnode %p to the freelist", __func__, vp); From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 14:04:22 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 105961065670; Mon, 25 Oct 2010 14:04:22 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F252C8FC19; Mon, 25 Oct 2010 14:04: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 o9PE4L47067481; Mon, 25 Oct 2010 14:04:21 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PE4LOJ067479; Mon, 25 Oct 2010 14:04:21 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010251404.o9PE4LOJ067479@svn.freebsd.org> From: Attilio Rao Date: Mon, 25 Oct 2010 14:04:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214341 - stable/8/sys/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 14:04:22 -0000 Author: attilio Date: Mon Oct 25 14:04:21 2010 New Revision: 214341 URL: http://svn.freebsd.org/changeset/base/214341 Log: MFC r212148 by emaste: Remove trailing whitespace. Sponsored by: Sandvine Incorporated Modified: stable/8/sys/sys/copyright.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/sys/copyright.h ============================================================================== --- stable/8/sys/sys/copyright.h Mon Oct 25 14:02:14 2010 (r214340) +++ stable/8/sys/sys/copyright.h Mon Oct 25 14:04:21 2010 (r214341) @@ -27,7 +27,7 @@ /* Copyrights macros */ - + /* FreeBSD */ #define COPYRIGHT_FreeBSD \ "Copyright (c) 1992-2010 The FreeBSD Project.\n" From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 15:01:41 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 166A51065672; Mon, 25 Oct 2010 15:01:41 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 041558FC0A; Mon, 25 Oct 2010 15:01: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 o9PF1eVX068764; Mon, 25 Oct 2010 15:01:40 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PF1euH068762; Mon, 25 Oct 2010 15:01:40 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010251501.o9PF1euH068762@svn.freebsd.org> From: Attilio Rao Date: Mon, 25 Oct 2010 15:01:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214343 - stable/8/bin/ps X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 15:01:41 -0000 Author: attilio Date: Mon Oct 25 15:01:40 2010 New Revision: 214343 URL: http://svn.freebsd.org/changeset/base/214343 Log: MFC r213012 by emaste: Correct sort order. Sponsored by: Sandvine Incorporated Modified: stable/8/bin/ps/extern.h Directory Properties: stable/8/bin/ps/ (props changed) Modified: stable/8/bin/ps/extern.h ============================================================================== --- stable/8/bin/ps/extern.h Mon Oct 25 14:05:25 2010 (r214342) +++ stable/8/bin/ps/extern.h Mon Oct 25 15:01:40 2010 (r214343) @@ -79,8 +79,8 @@ int s_uname(KINFO *); void showkey(void); void started(KINFO *, VARENT *); void state(KINFO *, VARENT *); -void tdnam(KINFO *, VARENT *); void tdev(KINFO *, VARENT *); +void tdnam(KINFO *, VARENT *); void tname(KINFO *, VARENT *); void ucomm(KINFO *, VARENT *); void uname(KINFO *, VARENT *); From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 15:11:11 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B7F0106566B; Mon, 25 Oct 2010 15:11:11 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 27F008FC1C; Mon, 25 Oct 2010 15:11: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 o9PFBBdM069023; Mon, 25 Oct 2010 15:11:11 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PFBBk1069022; Mon, 25 Oct 2010 15:11:11 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010251511.o9PFBBk1069022@svn.freebsd.org> From: Attilio Rao Date: Mon, 25 Oct 2010 15:11:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214344 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 15:11:11 -0000 Author: attilio Date: Mon Oct 25 15:11:10 2010 New Revision: 214344 URL: http://svn.freebsd.org/changeset/base/214344 Log: MFC r213080 by emaste: merge metadata of a revision that could have been included into r214339 MFC's time. Sponsored by: Sandvine Incorporated Modified: Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 15:17:31 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9963E106564A; Mon, 25 Oct 2010 15:17:31 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 86E7D8FC08; Mon, 25 Oct 2010 15:17: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 o9PFHVbs069188; Mon, 25 Oct 2010 15:17:31 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PFHVT2069186; Mon, 25 Oct 2010 15:17:31 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010251517.o9PFHVT2069186@svn.freebsd.org> From: Attilio Rao Date: Mon, 25 Oct 2010 15:17:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214345 - stable/8/usr.sbin/watchdogd X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 15:17:31 -0000 Author: attilio Date: Mon Oct 25 15:17:31 2010 New Revision: 214345 URL: http://svn.freebsd.org/changeset/base/214345 Log: MFC r213181 by emaste: Protect the watchdog daemon against swap OOM killer. Sponsored by: Sandvine Incorporated Modified: stable/8/usr.sbin/watchdogd/watchdogd.c Directory Properties: stable/8/usr.sbin/watchdogd/ (props changed) Modified: stable/8/usr.sbin/watchdogd/watchdogd.c ============================================================================== --- stable/8/usr.sbin/watchdogd/watchdogd.c Mon Oct 25 15:11:10 2010 (r214344) +++ stable/8/usr.sbin/watchdogd/watchdogd.c Mon Oct 25 15:17:31 2010 (r214345) @@ -31,6 +31,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -117,6 +118,8 @@ main(int argc, char *argv[]) signal(SIGTERM, sighandler); pidfile_write(pfh); + if (madvise(0, 0, MADV_PROTECT) != 0) + warn("madvise failed"); watchdog_loop(); From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 17:05:14 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC9A0106564A; Mon, 25 Oct 2010 17:05:14 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B9AE48FC17; Mon, 25 Oct 2010 17: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 o9PH5EeJ071834; Mon, 25 Oct 2010 17:05:14 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PH5EW4071832; Mon, 25 Oct 2010 17:05:14 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201010251705.o9PH5EW4071832@svn.freebsd.org> From: Rick Macklem Date: Mon, 25 Oct 2010 17:05:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214353 - stable/8/sys/fs/nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 17:05:15 -0000 Author: rmacklem Date: Mon Oct 25 17:05:14 2010 New Revision: 214353 URL: http://svn.freebsd.org/changeset/base/214353 Log: MFC: r213712 Try and make the nfsrv_localunlock() function in the experimental NFSv4 server more readable. Mostly changes to comments, but a case of >= is changed to >, since == can never happen. Also, I've added a couple of KASSERT()s and a slight optimization, since once the "else if" case happens, subsequent locks in the list can't have any effect. None of these changes fixes a known bug. Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Mon Oct 25 16:23:35 2010 (r214352) +++ stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Mon Oct 25 17:05:14 2010 (r214353) @@ -4957,31 +4957,56 @@ nfsrv_locallock(vnode_t vp, struct nfslo /* * Local lock unlock. Unlock all byte ranges that are no longer locked - * by NFSv4. + * by NFSv4. To do this, unlock any subranges of first-->end that + * do not overlap with the byte ranges of any lock in the lfp->lf_lock + * list. This list has all locks for the file held by other + * tuples. The list is ordered by increasing + * lo_first value, but may have entries that overlap each other, for + * the case of read locks. */ static void nfsrv_localunlock(vnode_t vp, struct nfslockfile *lfp, uint64_t init_first, uint64_t init_end, NFSPROC_T *p) { struct nfslock *lop; - - uint64_t first, end; + uint64_t first, end, prevfirst; first = init_first; end = init_end; while (first < init_end) { /* Loop through all nfs locks, adjusting first and end */ + prevfirst = 0; LIST_FOREACH(lop, &lfp->lf_lock, lo_lckfile) { + KASSERT(prevfirst <= lop->lo_first, + ("nfsv4 locks out of order")); + KASSERT(lop->lo_first < lop->lo_end, + ("nfsv4 bogus lock")); + prevfirst = lop->lo_first; if (first >= lop->lo_first && first < lop->lo_end) - /* Overlaps initial part */ + /* + * Overlaps with initial part, so trim + * off that initial part by moving first past + * it. + */ first = lop->lo_end; else if (end > lop->lo_first && - lop->lo_first >= first) - /* Begins before end and past first */ + lop->lo_first > first) { + /* + * This lock defines the end of the + * segment to unlock, so set end to the + * start of it and break out of the loop. + */ end = lop->lo_first; + break; + } if (first >= end) - /* shrunk to 0 so this iteration is done */ + /* + * There is no segment left to do, so + * break out of this loop and then exit + * the outer while() since first will be set + * to end, which must equal init_end here. + */ break; } if (first < end) { @@ -4991,7 +5016,10 @@ nfsrv_localunlock(vnode_t vp, struct nfs nfsrv_locallock_commit(lfp, NFSLCK_UNLOCK, first, end); } - /* and move on to the rest of the range */ + /* + * Now move past this segment and look for any further + * segment in the range, if there is one. + */ first = end; end = init_end; } From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 23:58:16 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4E11106566B; Mon, 25 Oct 2010 23:58:16 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C2A1D8FC0A; Mon, 25 Oct 2010 23:58: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 o9PNwGev081063; Mon, 25 Oct 2010 23:58:16 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PNwGQH081061; Mon, 25 Oct 2010 23:58:16 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010252358.o9PNwGQH081061@svn.freebsd.org> From: Attilio Rao Date: Mon, 25 Oct 2010 23:58:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214361 - stable/8/lib/libstand X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 23:58:16 -0000 Author: attilio Date: Mon Oct 25 23:58:16 2010 New Revision: 214361 URL: http://svn.freebsd.org/changeset/base/214361 Log: MFC r213235 by emaste: Increase maximum network timeout from 20s to 120s. Sponsored by: Sandvine Incorporated Modified: stable/8/lib/libstand/net.h Directory Properties: stable/8/lib/libstand/ (props changed) Modified: stable/8/lib/libstand/net.h ============================================================================== --- stable/8/lib/libstand/net.h Mon Oct 25 21:49:59 2010 (r214360) +++ stable/8/lib/libstand/net.h Mon Oct 25 23:58:16 2010 (r214361) @@ -50,7 +50,7 @@ #define MACPY(s, d) bcopy((char *)s, (char *)d, 6) -#define MAXTMO 20 /* seconds */ +#define MAXTMO 120 /* seconds */ #define MINTMO 2 /* seconds */ #define FNAME_SIZE 128 From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 25 23:59:56 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63098106564A; Mon, 25 Oct 2010 23:59:56 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 50D168FC19; Mon, 25 Oct 2010 23:59: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 o9PNxuPn081144; Mon, 25 Oct 2010 23:59:56 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PNxudt081142; Mon, 25 Oct 2010 23:59:56 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010252359.o9PNxudt081142@svn.freebsd.org> From: Attilio Rao Date: Mon, 25 Oct 2010 23:59:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214362 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 23:59:56 -0000 Author: attilio Date: Mon Oct 25 23:59:56 2010 New Revision: 214362 URL: http://svn.freebsd.org/changeset/base/214362 Log: MFC r213236 by emaste: Style fix. Sponsored by: Sandvine Incorporated Modified: stable/8/sys/kern/subr_trap.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/subr_trap.c ============================================================================== --- stable/8/sys/kern/subr_trap.c Mon Oct 25 23:58:16 2010 (r214361) +++ stable/8/sys/kern/subr_trap.c Mon Oct 25 23:59:56 2010 (r214362) @@ -115,9 +115,8 @@ userret(struct thread *td, struct trapfr /* * Charge system time if profiling. */ - if (p->p_flag & P_PROFIL) { + if (p->p_flag & P_PROFIL) addupc_task(td, TRAPF_PC(frame), td->td_pticks * psratio); - } /* * Let the scheduler adjust our priority etc. */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 00:21:31 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BB3B106564A; Tue, 26 Oct 2010 00:21:31 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7E49B8FC1A; Tue, 26 Oct 2010 00:21: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 o9Q0LVgc081773; Tue, 26 Oct 2010 00:21:31 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9Q0LVf9081768; Tue, 26 Oct 2010 00:21:31 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010260021.o9Q0LVf9081768@svn.freebsd.org> From: Attilio Rao Date: Tue, 26 Oct 2010 00:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214364 - in stable/8: bin/ps sys/kern sys/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 00:21:31 -0000 Author: attilio Date: Tue Oct 26 00:21:31 2010 New Revision: 214364 URL: http://svn.freebsd.org/changeset/base/214364 Log: MFC r213536 by emaste: Make a thread's address available via the kern proc sysctl, just like the process address. Modified: stable/8/bin/ps/keyword.c stable/8/bin/ps/ps.1 stable/8/sys/kern/kern_proc.c stable/8/sys/sys/user.h Directory Properties: stable/8/bin/ps/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/bin/ps/keyword.c ============================================================================== --- stable/8/bin/ps/keyword.c Tue Oct 26 00:07:58 2010 (r214363) +++ stable/8/bin/ps/keyword.c Tue Oct 26 00:21:31 2010 (r214364) @@ -186,6 +186,8 @@ static VAR var[] = { UINT, UIDFMT, 0}, {"svuid", "SVUID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_svuid), UINT, UIDFMT, 0}, + {"tdaddr", "TDADDR", NULL, 0, kvar, NULL, sizeof(void *) * 2, + KOFF(ki_tdaddr), KPTR, "lx", 0}, {"tdev", "TDEV", NULL, 0, tdev, NULL, 5, 0, CHAR, NULL, 0}, {"tdnam", "TDNAM", NULL, LJUST, tdnam, NULL, COMMLEN, 0, CHAR, NULL, 0}, {"time", "TIME", NULL, USER, cputime, NULL, 9, 0, CHAR, NULL, 0}, Modified: stable/8/bin/ps/ps.1 ============================================================================== --- stable/8/bin/ps/ps.1 Tue Oct 26 00:07:58 2010 (r214363) +++ stable/8/bin/ps/ps.1 Tue Oct 26 00:21:31 2010 (r214364) @@ -586,6 +586,8 @@ symbolic process state (alias saved gid from a setgid executable .It Cm svuid saved UID from a setuid executable +.It Cm tdaddr +thread address .It Cm tdev control terminal device number .It Cm time Modified: stable/8/sys/kern/kern_proc.c ============================================================================== --- stable/8/sys/kern/kern_proc.c Tue Oct 26 00:07:58 2010 (r214363) +++ stable/8/sys/kern/kern_proc.c Tue Oct 26 00:21:31 2010 (r214364) @@ -847,6 +847,7 @@ fill_kinfo_thread(struct thread *td, str struct proc *p; p = td->td_proc; + kp->ki_tdaddr = td; PROC_LOCK_ASSERT(p, MA_OWNED); thread_lock(td); Modified: stable/8/sys/sys/user.h ============================================================================== --- stable/8/sys/sys/user.h Tue Oct 26 00:07:58 2010 (r214363) +++ stable/8/sys/sys/user.h Tue Oct 26 00:21:31 2010 (r214364) @@ -85,7 +85,7 @@ */ #define KI_NSPARE_INT 9 #define KI_NSPARE_LONG 12 -#define KI_NSPARE_PTR 7 +#define KI_NSPARE_PTR 6 #ifndef _KERNEL #ifndef KINFO_PROC_SIZE @@ -188,6 +188,7 @@ struct kinfo_proc { struct pcb *ki_pcb; /* kernel virtual addr of pcb */ void *ki_kstack; /* kernel virtual addr of stack */ void *ki_udata; /* User convenience pointer */ + struct thread *ki_tdaddr; /* address of thread */ /* * When adding new variables, take space for pointers from the * front of ki_spareptrs, and longs from the end of ki_sparelongs. From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 00:46:03 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1BD87106566C; Tue, 26 Oct 2010 00:46:03 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08F508FC1C; Tue, 26 Oct 2010 00:46:03 +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 o9Q0k2Wf082399; Tue, 26 Oct 2010 00:46:02 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9Q0k2dj082394; Tue, 26 Oct 2010 00:46:02 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010260046.o9Q0k2dj082394@svn.freebsd.org> From: Attilio Rao Date: Tue, 26 Oct 2010 00:46:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214365 - stable/8/sys/dev/aac X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 00:46:03 -0000 Author: attilio Date: Tue Oct 26 00:46:02 2010 New Revision: 214365 URL: http://svn.freebsd.org/changeset/base/214365 Log: MFC r206540 by emaste: Sync some minor items with the upstream driver. Should have no functional change. Sponsored by: Sandvine Incorporated Modified: stable/8/sys/dev/aac/aac.c stable/8/sys/dev/aac/aac_pci.c stable/8/sys/dev/aac/aac_tables.h stable/8/sys/dev/aac/aacreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/aac/aac.c ============================================================================== --- stable/8/sys/dev/aac/aac.c Tue Oct 26 00:21:31 2010 (r214364) +++ stable/8/sys/dev/aac/aac.c Tue Oct 26 00:46:02 2010 (r214365) @@ -1881,7 +1881,7 @@ aac_init(struct aac_softc *sc) ip->InitFlags = 0; if (sc->flags & AAC_FLAGS_NEW_COMM) { - ip->InitFlags = INITFLAGS_NEW_COMM_SUPPORTED; + ip->InitFlags |= AAC_INITFLAGS_NEW_COMM_SUPPORTED; device_printf(sc->aac_dev, "New comm. interface enabled\n"); } Modified: stable/8/sys/dev/aac/aac_pci.c ============================================================================== --- stable/8/sys/dev/aac/aac_pci.c Tue Oct 26 00:21:31 2010 (r214364) +++ stable/8/sys/dev/aac/aac_pci.c Tue Oct 26 00:46:02 2010 (r214365) @@ -177,7 +177,7 @@ struct aac_ident {0x9005, 0x0285, 0x1014, 0x0312, AAC_HWIF_I960RX, 0, "IBM ServeRAID 8i"}, {0x9005, 0x0285, 0x9005, 0x0298, AAC_HWIF_I960RX, 0, - "Adaptec SAS RAID 4000SAS"}, + "Adaptec RAID 4000"}, {0x9005, 0x0285, 0x9005, 0x0299, AAC_HWIF_I960RX, 0, "Adaptec SAS RAID 4800SAS"}, {0x9005, 0x0285, 0x9005, 0x029a, AAC_HWIF_I960RX, 0, Modified: stable/8/sys/dev/aac/aac_tables.h ============================================================================== --- stable/8/sys/dev/aac/aac_tables.h Tue Oct 26 00:21:31 2010 (r214364) +++ stable/8/sys/dev/aac/aac_tables.h Tue Oct 26 00:46:02 2010 (r214365) @@ -57,6 +57,7 @@ static struct aac_code_lookup aac_comman {"quota exceeded", 69}, {"stale file handle", 70}, {"too many levels of remote in path", 71}, + {"device busy (spinning up)", 72}, {"bad file handle", 10001}, {"not sync", 10002}, {"bad cookie", 10003}, @@ -68,6 +69,7 @@ static struct aac_code_lookup aac_comman {"not mounted", 10009}, {"in maintenance mode", 10010}, {"stale ACL", 10011}, + {"bus reset - command aborted", 20001}, {NULL, 0}, {"unknown command status", 0} }; Modified: stable/8/sys/dev/aac/aacreg.h ============================================================================== --- stable/8/sys/dev/aac/aacreg.h Tue Oct 26 00:21:31 2010 (r214364) +++ stable/8/sys/dev/aac/aacreg.h Tue Oct 26 00:46:02 2010 (r214365) @@ -306,7 +306,7 @@ struct aac_adapter_init { u_int32_t HostElapsedSeconds; /* ADAPTER_INIT_STRUCT_REVISION_4 begins here */ u_int32_t InitFlags; /* flags for supported features */ -#define INITFLAGS_NEW_COMM_SUPPORTED 1 +#define AAC_INITFLAGS_NEW_COMM_SUPPORTED 1 u_int32_t MaxIoCommands; /* max outstanding commands */ u_int32_t MaxIoSize; /* largest I/O command */ u_int32_t MaxFibSize; /* largest FIB to adapter */ @@ -1081,6 +1081,7 @@ typedef enum { ST_DQUOT = 69, ST_STALE = 70, ST_REMOTE = 71, + ST_NOT_READY = 72, ST_BADHANDLE = 10001, ST_NOT_SYNC = 10002, ST_BAD_COOKIE = 10003, @@ -1091,7 +1092,8 @@ typedef enum { ST_JUKEBOX = 10008, ST_NOTMOUNTED = 10009, ST_MAINTMODE = 10010, - ST_STALEACL = 10011 + ST_STALEACL = 10011, + ST_BUS_RESET = 20001 } AAC_FSAStatus; /* From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 00:56:24 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E80F106564A; Tue, 26 Oct 2010 00:56:24 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1163E8FC12; Tue, 26 Oct 2010 00:56: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 o9Q0uNIA082668; Tue, 26 Oct 2010 00:56:23 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9Q0uNPJ082666; Tue, 26 Oct 2010 00:56:23 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010260056.o9Q0uNPJ082666@svn.freebsd.org> From: Attilio Rao Date: Tue, 26 Oct 2010 00:56:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214366 - stable/8/sys/dev/aac X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 00:56:24 -0000 Author: attilio Date: Tue Oct 26 00:56:23 2010 New Revision: 214366 URL: http://svn.freebsd.org/changeset/base/214366 Log: MFC r212628 by emaste: Add some enums and constants from Adaptec's driver. Sponsored by: Sandvine Incorporated Modified: stable/8/sys/dev/aac/aacreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/aac/aacreg.h ============================================================================== --- stable/8/sys/dev/aac/aacreg.h Tue Oct 26 00:46:02 2010 (r214365) +++ stable/8/sys/dev/aac/aacreg.h Tue Oct 26 00:56:23 2010 (r214366) @@ -306,7 +306,9 @@ struct aac_adapter_init { u_int32_t HostElapsedSeconds; /* ADAPTER_INIT_STRUCT_REVISION_4 begins here */ u_int32_t InitFlags; /* flags for supported features */ -#define AAC_INITFLAGS_NEW_COMM_SUPPORTED 1 +#define AAC_INITFLAGS_NEW_COMM_SUPPORTED 1 +#define AAC_INITFLAGS_DRIVER_USES_UTC_TIME 0x10 +#define AAC_INITFLAGS_DRIVER_SUPPORTS_PM 0x20 u_int32_t MaxIoCommands; /* max outstanding commands */ u_int32_t MaxIoSize; /* largest I/O command */ u_int32_t MaxFibSize; /* largest FIB to adapter */ @@ -885,6 +887,17 @@ typedef enum { AifEnBatteryNeedsRecond, /* The battery needs reconditioning */ AifEnClusterEvent, /* Some cluster event */ AifEnDiskSetEvent, /* A disk set event occured. */ + AifEnContainerScsiEvent, /* a container event with no. and scsi id */ + AifEnPicBatteryEvent, /* An event gen. by pic_battery.c for an ABM */ + AifEnExpEvent, /* Exp. Event Type to replace CTPopUp messages */ + AifEnRAID6RebuildDone, /* RAID6 rebuild finished */ + AifEnSensorOverHeat, /* Heat Sensor indicate overheat */ + AifEnSensorCoolDown, /* Heat Sensor ind. cooled down after overheat */ + AifFeatureKeysModified, /* notif. of updated feature keys */ + AifApplicationExpirationEvent, /* notif. on app. expiration status */ + AifEnBackgroundConsistencyCheck,/* BCC notif. for NEC - DDTS 94700 */ + AifEnAddJBOD, /* A new JBOD type drive was created (30) */ + AifEnDeleteJBOD, /* A JBOD type drive was deleted (31) */ AifDriverNotifyStart=199, /* Notifies for host driver go here */ /* Host driver notifications start here */ AifDenMorphComplete, /* A morph operation completed */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 00:58:15 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B47FE106566B; Tue, 26 Oct 2010 00:58:15 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9756F8FC0A; Tue, 26 Oct 2010 00:58: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 o9Q0wFKb082764; Tue, 26 Oct 2010 00:58:15 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9Q0wFST082760; Tue, 26 Oct 2010 00:58:15 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010260058.o9Q0wFST082760@svn.freebsd.org> From: Attilio Rao Date: Tue, 26 Oct 2010 00:58:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214367 - stable/8/sys/dev/aac X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 00:58:15 -0000 Author: attilio Date: Tue Oct 26 00:58:15 2010 New Revision: 214367 URL: http://svn.freebsd.org/changeset/base/214367 Log: MFC r212773 by emaste: Use device_printf where possible, and otherwise at least include the driver name in printf strings. Sponsored by: Sandvine Incorporated Modified: stable/8/sys/dev/aac/aac.c stable/8/sys/dev/aac/aac_cam.c stable/8/sys/dev/aac/aac_disk.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/aac/aac.c ============================================================================== --- stable/8/sys/dev/aac/aac.c Tue Oct 26 00:56:23 2010 (r214366) +++ stable/8/sys/dev/aac/aac.c Tue Oct 26 00:58:15 2010 (r214367) @@ -391,7 +391,7 @@ aac_get_container_info(struct aac_softc if (aac_sync_fib(sc, ContainerCommand, 0, fib, sizeof(struct aac_mntinfo))) { - printf("Error probing container %d\n", cid); + device_printf(sc->aac_dev, "Error probing container %d\n", cid); return (NULL); } Modified: stable/8/sys/dev/aac/aac_cam.c ============================================================================== --- stable/8/sys/dev/aac/aac_cam.c Tue Oct 26 00:56:23 2010 (r214366) +++ stable/8/sys/dev/aac/aac_cam.c Tue Oct 26 00:58:15 2010 (r214367) @@ -569,7 +569,7 @@ aac_cam_reset_bus(struct cam_sim *sim, u sc = camsc->inf->aac_sc; if (sc == NULL) { - printf("Null sc?\n"); + printf("aac: Null sc?\n"); return (CAM_REQ_ABORTED); } Modified: stable/8/sys/dev/aac/aac_disk.c ============================================================================== --- stable/8/sys/dev/aac/aac_disk.c Tue Oct 26 00:56:23 2010 (r214366) +++ stable/8/sys/dev/aac/aac_disk.c Tue Oct 26 00:58:15 2010 (r214367) @@ -106,8 +106,9 @@ aac_disk_open(struct disk *dp) /* check that the controller is up and running */ if (sc->ad_controller->aac_state & AAC_STATE_SUSPEND) { - printf("Controller Suspended controller state = 0x%x\n", - sc->ad_controller->aac_state); + device_printf(sc->ad_controller->aac_dev, + "Controller Suspended controller state = 0x%x\n", + sc->ad_controller->aac_state); return(ENXIO); } @@ -252,7 +253,8 @@ aac_disk_dump(void *arg, void *virtual, if (!first) { first = 1; if (bus_dmamap_create(sc->aac_buffer_dmat, 0, &dump_datamap)) { - printf("bus_dmamap_create failed\n"); + device_printf(sc->aac_dev, + "bus_dmamap_create failed\n"); return (ENOMEM); } } @@ -305,8 +307,9 @@ aac_disk_dump(void *arg, void *virtual, size += fib->Header.Size; if (aac_sync_fib(sc, command, 0, fib, size)) { - printf("Error dumping block 0x%jx\n", - (uintmax_t)physical); + device_printf(sc->aac_dev, + "Error dumping block 0x%jx\n", + (uintmax_t)physical); return (EIO); } From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 01:20:31 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AC72106564A; Tue, 26 Oct 2010 01:20:31 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 47A3B8FC0C; Tue, 26 Oct 2010 01:20: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 o9Q1KVgF083281; Tue, 26 Oct 2010 01:20:31 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9Q1KVhW083276; Tue, 26 Oct 2010 01:20:31 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010260120.o9Q1KVhW083276@svn.freebsd.org> From: Attilio Rao Date: Tue, 26 Oct 2010 01:20:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214368 - stable/8/sys/dev/aac X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 01:20:31 -0000 Author: attilio Date: Tue Oct 26 01:20:30 2010 New Revision: 214368 URL: http://svn.freebsd.org/changeset/base/214368 Log: MFC r213272 by emaste: Previously, the aac driver did not handle enclosure management AIFs, which were raised during hot-swap events. Now such events trigger cam rescans. Sponsored by: Sandvine Incorporated Modified: stable/8/sys/dev/aac/aac.c stable/8/sys/dev/aac/aac_cam.c stable/8/sys/dev/aac/aacreg.h stable/8/sys/dev/aac/aacvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/aac/aac.c ============================================================================== --- stable/8/sys/dev/aac/aac.c Tue Oct 26 00:58:15 2010 (r214367) +++ stable/8/sys/dev/aac/aac.c Tue Oct 26 01:20:30 2010 (r214368) @@ -3216,6 +3216,7 @@ aac_handle_aif(struct aac_softc *sc, str struct aac_mntinforesp *mir; int next, current, found; int count = 0, added = 0, i = 0; + uint32_t channel; fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); @@ -3324,6 +3325,27 @@ aac_handle_aif(struct aac_softc *sc, str break; + case AifEnEnclosureManagement: + switch (aif->data.EN.data.EEE.eventType) { + case AIF_EM_DRIVE_INSERTION: + case AIF_EM_DRIVE_REMOVAL: + channel = aif->data.EN.data.EEE.unitID; + if (sc->cam_rescan_cb != NULL) + sc->cam_rescan_cb(sc, + (channel >> 24) & 0xF, + (channel & 0xFFFF)); + break; + } + break; + + case AifEnAddJBOD: + case AifEnDeleteJBOD: + channel = aif->data.EN.data.ECE.container; + if (sc->cam_rescan_cb != NULL) + sc->cam_rescan_cb(sc, (channel >> 24) & 0xF, + AAC_CAM_TARGET_WILDCARD); + break; + default: break; } Modified: stable/8/sys/dev/aac/aac_cam.c ============================================================================== --- stable/8/sys/dev/aac/aac_cam.c Tue Oct 26 00:58:15 2010 (r214367) +++ stable/8/sys/dev/aac/aac_cam.c Tue Oct 26 01:20:30 2010 (r214368) @@ -37,12 +37,15 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include +#include #include #include #include @@ -76,6 +79,9 @@ static int aac_cam_detach(device_t dev); static void aac_cam_action(struct cam_sim *, union ccb *); static void aac_cam_poll(struct cam_sim *); static void aac_cam_complete(struct aac_command *); +static void aac_cam_rescan(struct aac_softc *sc, uint32_t channel, + uint32_t target_id); + static u_int32_t aac_cam_reset_bus(struct cam_sim *, union ccb *); static u_int32_t aac_cam_abort_ccb(struct cam_sim *, union ccb *); static u_int32_t aac_cam_term_io(struct cam_sim *, union ccb *); @@ -101,6 +107,43 @@ MODULE_DEPEND(aacp, cam, 1, 1, 1); MALLOC_DEFINE(M_AACCAM, "aaccam", "AAC CAM info"); static void +aac_cam_rescan(struct aac_softc *sc, uint32_t channel, uint32_t target_id) +{ + union ccb *ccb; + struct aac_sim *sim; + struct aac_cam *camsc; + + if (target_id == AAC_CAM_TARGET_WILDCARD) + target_id = CAM_TARGET_WILDCARD; + + TAILQ_FOREACH(sim, &sc->aac_sim_tqh, sim_link) { + camsc = sim->aac_cam; + if (camsc == NULL || camsc->inf == NULL || + camsc->inf->BusNumber != channel) + continue; + + ccb = xpt_alloc_ccb_nowait(); + if (ccb == NULL) { + device_printf(sc->aac_dev, + "Cannot allocate ccb for bus rescan.\n"); + return; + } + + if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, + cam_sim_path(camsc->sim), + target_id, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + xpt_free_ccb(ccb); + device_printf(sc->aac_dev, + "Cannot create path for bus rescan.\n"); + return; + } + xpt_rescan(ccb); + break; + } +} + + +static void aac_cam_event(struct aac_softc *sc, struct aac_event *event, void *arg) { union ccb *ccb; @@ -141,6 +184,7 @@ aac_cam_detach(device_t dev) camsc = (struct aac_cam *)device_get_softc(dev); sc = camsc->inf->aac_sc; + camsc->inf->aac_cam = NULL; mtx_lock(&sc->aac_io_lock); @@ -149,6 +193,8 @@ aac_cam_detach(device_t dev) xpt_bus_deregister(cam_sim_path(camsc->sim)); cam_sim_free(camsc->sim, /*free_devq*/TRUE); + sc->cam_rescan_cb = NULL; + mtx_unlock(&sc->aac_io_lock); return (0); @@ -171,6 +217,7 @@ aac_cam_attach(device_t dev) camsc = (struct aac_cam *)device_get_softc(dev); inf = (struct aac_sim *)device_get_ivars(dev); camsc->inf = inf; + camsc->inf->aac_cam = camsc; devq = cam_simq_alloc(inf->TargetsPerBus); if (devq == NULL) @@ -198,6 +245,7 @@ aac_cam_attach(device_t dev) mtx_unlock(&inf->aac_sc->aac_io_lock); return (EIO); } + inf->aac_sc->cam_rescan_cb = aac_cam_rescan; mtx_unlock(&inf->aac_sc->aac_io_lock); camsc->sim = sim; Modified: stable/8/sys/dev/aac/aacreg.h ============================================================================== --- stable/8/sys/dev/aac/aacreg.h Tue Oct 26 00:58:15 2010 (r214367) +++ stable/8/sys/dev/aac/aacreg.h Tue Oct 26 01:20:30 2010 (r214368) @@ -935,6 +935,11 @@ struct aac_AifEnsEnclosureEvent { u_int32_t eventType; /* event type */ } __packed; +typedef enum { + AIF_EM_DRIVE_INSERTION=31, + AIF_EM_DRIVE_REMOVAL +} aac_AifEMEventType; + struct aac_AifEnsBatteryEvent { AAC_NVBATT_TRANSITION transition_type; /* eg from low to ok */ AAC_NVBATTSTATUS current_state; /* current batt state */ Modified: stable/8/sys/dev/aac/aacvar.h ============================================================================== --- stable/8/sys/dev/aac/aacvar.h Tue Oct 26 00:58:15 2010 (r214367) +++ stable/8/sys/dev/aac/aacvar.h Tue Oct 26 01:20:30 2010 (r214368) @@ -113,6 +113,7 @@ struct aac_container /* * Per-SIM data structure */ +struct aac_cam; struct aac_sim { device_t sim_dev; @@ -120,6 +121,7 @@ struct aac_sim int BusNumber; int InitiatorBusId; struct aac_softc *aac_sc; + struct aac_cam *aac_cam; TAILQ_ENTRY(aac_sim) sim_link; }; @@ -420,6 +422,9 @@ struct aac_softc u_int32_t aac_max_fib_size; /* max. FIB size */ u_int32_t aac_sg_tablesize; /* max. sg count from host */ u_int32_t aac_max_sectors; /* max. I/O size from host (blocks) */ +#define AAC_CAM_TARGET_WILDCARD ~0 + void (*cam_rescan_cb)(struct aac_softc *, uint32_t, + uint32_t); }; /* From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 03:34:34 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57558106567A; Tue, 26 Oct 2010 03:34:34 +0000 (UTC) (envelope-from jhellenthal@gmail.com) Received: from mail-gw0-f54.google.com (mail-gw0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id AD6C48FC1C; Tue, 26 Oct 2010 03:34:33 +0000 (UTC) Received: by gwaa18 with SMTP id a18so2231031gwa.13 for ; Mon, 25 Oct 2010 20:34:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :organization:user-agent:mime-version:to:cc:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=4+3yJmsIK3BzjinVoDKPmOeqbYuXSnhPspPtgzTdi3E=; b=BGH7R1IajaWUH7/pPA94ZN4epDMO0s8e8VNMitkvf0EWyrMlh3MMgw8ercyU+mbooy e0lz26flSBQyWWmyVpS1qrDYTrGlDptiroBSDaPOnwWq25vE+vlKyEpKBOJhkrh+k/yu pz3PupajADb7zCJnihHzk6fPTkMIzfc8YiabU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:organization:user-agent:mime-version:to :cc:subject:references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=jsoh7Mt42LzffqFNlK0W3R1QXFxxuvq7oGxgEAtIKJfpTTDEZqnkEXfxuJ+g9QVkVX ki9yuSeziRiB6dVdExBN5zx2r/uOA5SnYt3kuFsHkxAfALdEOzoqeSbD0GTvyBS/QeQM G8BJ99GhKIvUKXWvU5W2ew4OCcPd+fbZrgLrY= Received: by 10.150.96.9 with SMTP id t9mr4083289ybb.4.1288063653655; Mon, 25 Oct 2010 20:27:33 -0700 (PDT) Received: from centel.dataix.local (adsl-99-181-136-243.dsl.klmzmi.sbcglobal.net [99.181.136.243]) by mx.google.com with ESMTPS id r25sm6193311yhc.0.2010.10.25.20.27.31 (version=SSLv3 cipher=RC4-MD5); Mon, 25 Oct 2010 20:27:32 -0700 (PDT) Sender: "J. Hellenthal" Message-ID: <4CC64AA2.8060309@DataIX.net> Date: Mon, 25 Oct 2010 23:27:30 -0400 From: jhell Organization: http://www.DataIX.net User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.11) Gecko/20101021 Lightning/1.0b1 Thunderbird MIME-Version: 1.0 To: Attilio Rao References: <201010251501.o9PF1euH068762@svn.freebsd.org> <4CC648E3.6000307@DataIX.net> In-Reply-To: <4CC648E3.6000307@DataIX.net> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r214343 - stable/8/bin/ps X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 03:34:34 -0000 On 10/25/2010 23:20, jhell wrote: Oops this seems to have been introduced by 214364 rather than the subject listed revision. > > cc -O2 -pipe -DLAZY_PS -std=gnu99 -fstack-protector -Wsystem-headers > -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter > -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type > -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align > -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs > -Wredundant-decls -Wno-pointer-sign -c /usr/src/bin/ps/keyword.c > /usr/src/bin/ps/keyword.c:190: error: 'struct kinfo_proc' has no member > named 'ki_tdaddr' > *** Error code 1 > > ??? > -- jhell,v From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 03:51:01 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AB2C1065670; Tue, 26 Oct 2010 03:51:01 +0000 (UTC) (envelope-from jhellenthal@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 ADA528FC13; Tue, 26 Oct 2010 03:51:00 +0000 (UTC) Received: by ywc21 with SMTP id 21so1679199ywc.13 for ; Mon, 25 Oct 2010 20:50:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :organization:user-agent:mime-version:to:cc:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=nHSquUEa5qD9mctnYSfMc0KT5pyKVGeQxPhAhBITcd4=; b=MOuaAjH7Hd4eRTq+HA4FrkY3wKwfsIvtUgQ+8YrFnA4mNtGR8Hq4qqHX+3QzbBr9xh c4wS6RupOQdAiCp8gMpCSazN9HHk0/he35zcM+lOy/oFqH4gH1tgMR0jyXrDhOyejRvo KudhZ8oL2wajzNPtZttY4JSFnScrT0+DeZDgE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:organization:user-agent:mime-version:to :cc:subject:references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=hbpstNZVAflSfjk2z+r9IEObKt6Md7Zx1xNvEMtEWMBXHhLyXt39gXUKZDAZv18F4b K5rIrH6o3rLaSmmSNz3LG3cbiNLFIxwtpFkwWyjH8qIsAea4y/poiOGiAX0qTa1MSu95 3FqLWD0PXyYxxsajCi7PDXIcZxgtSkHnn5QB0= Received: by 10.151.14.5 with SMTP id r5mr920324ybi.343.1288063206594; Mon, 25 Oct 2010 20:20:06 -0700 (PDT) Received: from centel.dataix.local (adsl-99-181-136-243.dsl.klmzmi.sbcglobal.net [99.181.136.243]) by mx.google.com with ESMTPS id p30sm7268489ybk.8.2010.10.25.20.20.04 (version=SSLv3 cipher=RC4-MD5); Mon, 25 Oct 2010 20:20:05 -0700 (PDT) Sender: "J. Hellenthal" Message-ID: <4CC648E3.6000307@DataIX.net> Date: Mon, 25 Oct 2010 23:20:03 -0400 From: jhell Organization: http://www.DataIX.net User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.11) Gecko/20101021 Lightning/1.0b1 Thunderbird MIME-Version: 1.0 To: Attilio Rao References: <201010251501.o9PF1euH068762@svn.freebsd.org> In-Reply-To: <201010251501.o9PF1euH068762@svn.freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r214343 - stable/8/bin/ps X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 03:51:01 -0000 On 10/25/2010 11:01, Attilio Rao wrote: > Author: attilio > Date: Mon Oct 25 15:01:40 2010 > New Revision: 214343 > URL: http://svn.freebsd.org/changeset/base/214343 > > Log: > MFC r213012 by emaste: > Correct sort order. > > Sponsored by: Sandvine Incorporated > > Modified: > stable/8/bin/ps/extern.h > Directory Properties: > stable/8/bin/ps/ (props changed) > > Modified: stable/8/bin/ps/extern.h > ============================================================================== > --- stable/8/bin/ps/extern.h Mon Oct 25 14:05:25 2010 (r214342) > +++ stable/8/bin/ps/extern.h Mon Oct 25 15:01:40 2010 (r214343) > @@ -79,8 +79,8 @@ int s_uname(KINFO *); > void showkey(void); > void started(KINFO *, VARENT *); > void state(KINFO *, VARENT *); > -void tdnam(KINFO *, VARENT *); > void tdev(KINFO *, VARENT *); > +void tdnam(KINFO *, VARENT *); > void tname(KINFO *, VARENT *); > void ucomm(KINFO *, VARENT *); > void uname(KINFO *, VARENT *); > _______________________________________________ cc -O2 -pipe -DLAZY_PS -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wno-pointer-sign -c /usr/src/bin/ps/keyword.c /usr/src/bin/ps/keyword.c:190: error: 'struct kinfo_proc' has no member named 'ki_tdaddr' *** Error code 1 ??? -- jhell,v From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 03:57:23 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8CE8C106566C; Tue, 26 Oct 2010 03:57:23 +0000 (UTC) (envelope-from jhellenthal@gmail.com) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id E5B468FC08; Tue, 26 Oct 2010 03:57:22 +0000 (UTC) Received: by gya6 with SMTP id 6so2675698gya.13 for ; Mon, 25 Oct 2010 20:57:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :organization:user-agent:mime-version:to:cc:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=Wsm+ZHD9TezslOUa6qFRvAqcPF5nqox7RIaly79neiE=; b=A5SHEWWy3jT5Qfo2EkbMzf32Vwm+AKAdr/RyxJbOuBpt/x2DALWti9hYiONB1OXc+h 4Z95+IzStvlFoQquO3DLwIkxX+JZMGPsQI7eKWTA9BCj8lmzrY18KybN9jdy5i0AVkNh wu5A+aQ5sSP4XCKsYoOfCu1zbO1ZmlsLoSSpg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:organization:user-agent:mime-version:to :cc:subject:references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=lpilT0y5AbEMa8O99T9u54ImwOGF3Nvspev7DF0djHWGiozPqJYJCsp1cxsTC1ENdC wn1ExsluSiDlHyH341BxxfexclXW0kedC4KF7R98I98EE9TaBqdadCX3mFEieQuMuFQt mg1GTGq4hW9AqpafePxsrs6WI6VT7y1GKYWCU= Received: by 10.151.27.1 with SMTP id e1mr14653422ybj.250.1288065440494; Mon, 25 Oct 2010 20:57:20 -0700 (PDT) Received: from centel.dataix.local ([99.181.136.243]) by mx.google.com with ESMTPS id n48sm3272572yha.7.2010.10.25.20.57.18 (version=SSLv3 cipher=RC4-MD5); Mon, 25 Oct 2010 20:57:19 -0700 (PDT) Sender: "J. Hellenthal" Message-ID: <4CC6519D.8070505@DataIX.net> Date: Mon, 25 Oct 2010 23:57:17 -0400 From: jhell Organization: http://www.DataIX.net User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.11) Gecko/20101021 Lightning/1.0b1 Thunderbird MIME-Version: 1.0 To: Attilio Rao References: <201010251501.o9PF1euH068762@svn.freebsd.org> <4CC648E3.6000307@DataIX.net> In-Reply-To: <4CC648E3.6000307@DataIX.net> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r214343 - stable/8/bin/ps X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 03:57:23 -0000 On 10/25/2010 23:20, jhell wrote: > On 10/25/2010 11:01, Attilio Rao wrote: >> Author: attilio >> Date: Mon Oct 25 15:01:40 2010 >> New Revision: 214343 >> URL: http://svn.freebsd.org/changeset/base/214343 >> >> Log: >> MFC r213012 by emaste: >> Correct sort order. >> >> Sponsored by: Sandvine Incorporated >> >> Modified: >> stable/8/bin/ps/extern.h >> Directory Properties: >> stable/8/bin/ps/ (props changed) >> >> Modified: stable/8/bin/ps/extern.h >> ============================================================================== >> --- stable/8/bin/ps/extern.h Mon Oct 25 14:05:25 2010 (r214342) >> +++ stable/8/bin/ps/extern.h Mon Oct 25 15:01:40 2010 (r214343) >> @@ -79,8 +79,8 @@ int s_uname(KINFO *); >> void showkey(void); >> void started(KINFO *, VARENT *); >> void state(KINFO *, VARENT *); >> -void tdnam(KINFO *, VARENT *); >> void tdev(KINFO *, VARENT *); >> +void tdnam(KINFO *, VARENT *); >> void tname(KINFO *, VARENT *); >> void ucomm(KINFO *, VARENT *); >> void uname(KINFO *, VARENT *); >> _______________________________________________ > > cc -O2 -pipe -DLAZY_PS -std=gnu99 -fstack-protector -Wsystem-headers > -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter > -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type > -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align > -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs > -Wredundant-decls -Wno-pointer-sign -c /usr/src/bin/ps/keyword.c > /usr/src/bin/ps/keyword.c:190: error: 'struct kinfo_proc' has no member > named 'ki_tdaddr' > *** Error code 1 > > ??? > Ugh! please ignore this. As Ive been here once already now surprised myself by making the same mistake twice! Once, twice, three time a lady! hopefully it won't come to that. -- jhell,v From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 08:50:09 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8341A106566C; Tue, 26 Oct 2010 08:50:09 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6FE0E8FC15; Tue, 26 Oct 2010 08:50: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 o9Q8o9mZ007530; Tue, 26 Oct 2010 08:50:09 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9Q8o9K1007526; Tue, 26 Oct 2010 08:50:09 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010260850.o9Q8o9K1007526@svn.freebsd.org> From: Attilio Rao Date: Tue, 26 Oct 2010 08:50:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214370 - stable/8/sys/libkern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 08:50:09 -0000 Author: attilio Date: Tue Oct 26 08:50:09 2010 New Revision: 214370 URL: http://svn.freebsd.org/changeset/base/214370 Log: MFC part of r213103: Introduce the new files that were left behind in actual merge. Sponsored by: Sandvine Incorporated Added: stable/8/sys/libkern/inet_ntop.c (contents, props changed) stable/8/sys/libkern/inet_pton.c (contents, props changed) Added: stable/8/sys/libkern/inet_ntop.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/libkern/inet_ntop.c Tue Oct 26 08:50:09 2010 (r214370) @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static const char rcsid[] = "$Id: inet_ntop.c,v 1.3.18.2 2005/11/03 23:02:22 marka Exp $"; +#endif /* LIBC_SCCS and not lint */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include + +/*% + * WARNING: Don't even consider trying to compile this on a system where + * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. + */ + +static char *inet_ntop4(const u_char *src, char *dst, socklen_t size); +static char *inet_ntop6(const u_char *src, char *dst, socklen_t size); + +/* char * + * inet_ntop(af, src, dst, size) + * convert a network format address to presentation format. + * return: + * pointer to presentation format address (`dst'), or NULL (see errno). + * author: + * Paul Vixie, 1996. + */ +char * +inet_ntop(int af, const void *src, char *dst, socklen_t size) +{ + switch (af) { + case AF_INET: + return (inet_ntop4(src, dst, size)); + case AF_INET6: + return (inet_ntop6(src, dst, size)); + default: + return (NULL); + } + /* NOTREACHED */ +} + +/* const char * + * inet_ntop4(src, dst, size) + * format an IPv4 address + * return: + * `dst' (as a const) + * notes: + * (1) uses no statics + * (2) takes a u_char* not an in_addr as input + * author: + * Paul Vixie, 1996. + */ +static char * +inet_ntop4(const u_char *src, char *dst, socklen_t size) +{ + static const char fmt[] = "%u.%u.%u.%u"; + char tmp[sizeof "255.255.255.255"]; + int l; + + l = snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]); + if (l <= 0 || (socklen_t) l >= size) { + return (NULL); + } + strlcpy(dst, tmp, size); + return (dst); +} + +/* const char * + * inet_ntop6(src, dst, size) + * convert IPv6 binary address into presentation (printable) format + * author: + * Paul Vixie, 1996. + */ +static char * +inet_ntop6(const u_char *src, char *dst, socklen_t size) +{ + /* + * Note that int32_t and int16_t need only be "at least" large enough + * to contain a value of the specified size. On some systems, like + * Crays, there is no such thing as an integer variable with 16 bits. + * Keep this in mind if you think this function should have been coded + * to use pointer overlays. All the world's not a VAX. + */ + char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp; + struct { int base, len; } best, cur; +#define NS_IN6ADDRSZ 16 +#define NS_INT16SZ 2 + u_int words[NS_IN6ADDRSZ / NS_INT16SZ]; + int i; + + /* + * Preprocess: + * Copy the input (bytewise) array into a wordwise array. + * Find the longest run of 0x00's in src[] for :: shorthanding. + */ + memset(words, '\0', sizeof words); + for (i = 0; i < NS_IN6ADDRSZ; i++) + words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); + best.base = -1; + best.len = 0; + cur.base = -1; + cur.len = 0; + for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { + if (words[i] == 0) { + if (cur.base == -1) + cur.base = i, cur.len = 1; + else + cur.len++; + } else { + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + cur.base = -1; + } + } + } + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + } + if (best.base != -1 && best.len < 2) + best.base = -1; + + /* + * Format the result. + */ + tp = tmp; + for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { + /* Are we inside the best run of 0x00's? */ + if (best.base != -1 && i >= best.base && + i < (best.base + best.len)) { + if (i == best.base) + *tp++ = ':'; + continue; + } + /* Are we following an initial run of 0x00s or any real hex? */ + if (i != 0) + *tp++ = ':'; + /* Is this address an encapsulated IPv4? */ + if (i == 6 && best.base == 0 && (best.len == 6 || + (best.len == 7 && words[7] != 0x0001) || + (best.len == 5 && words[5] == 0xffff))) { + if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp))) + return (NULL); + tp += strlen(tp); + break; + } + tp += sprintf(tp, "%x", words[i]); + } + /* Was it a trailing run of 0x00's? */ + if (best.base != -1 && (best.base + best.len) == + (NS_IN6ADDRSZ / NS_INT16SZ)) + *tp++ = ':'; + *tp++ = '\0'; + + /* + * Check for overflow, copy, and we're done. + */ + if ((socklen_t)(tp - tmp) > size) { + return (NULL); + } + strcpy(dst, tmp); + return (dst); +} + +/*! \file */ Added: stable/8/sys/libkern/inet_pton.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/libkern/inet_pton.c Tue Oct 26 08:50:09 2010 (r214370) @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 1996,1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static const char rcsid[] = "$Id: inet_pton.c,v 1.3.18.2 2005/07/28 07:38:07 marka Exp $"; +#endif /* LIBC_SCCS and not lint */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include + +#if __FreeBSD_version < 700000 +#define strchr index +#endif + +/*% + * WARNING: Don't even consider trying to compile this on a system where + * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. + */ + +static int inet_pton4(const char *src, u_char *dst); +static int inet_pton6(const char *src, u_char *dst); + +/* int + * inet_pton(af, src, dst) + * convert from presentation format (which usually means ASCII printable) + * to network format (which is usually some kind of binary format). + * return: + * 1 if the address was valid for the specified address family + * 0 if the address wasn't valid (`dst' is untouched in this case) + * -1 if some other error occurred (`dst' is untouched in this case, too) + * author: + * Paul Vixie, 1996. + */ +int +inet_pton(int af, const char *src, void *dst) +{ + switch (af) { + case AF_INET: + return (inet_pton4(src, dst)); + case AF_INET6: + return (inet_pton6(src, dst)); + default: + return (-1); + } + /* NOTREACHED */ +} + +/* int + * inet_pton4(src, dst) + * like inet_aton() but without all the hexadecimal and shorthand. + * return: + * 1 if `src' is a valid dotted quad, else 0. + * notice: + * does not touch `dst' unless it's returning 1. + * author: + * Paul Vixie, 1996. + */ +static int +inet_pton4(const char *src, u_char *dst) +{ + static const char digits[] = "0123456789"; + int saw_digit, octets, ch; +#define NS_INADDRSZ 4 + u_char tmp[NS_INADDRSZ], *tp; + + saw_digit = 0; + octets = 0; + *(tp = tmp) = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr(digits, ch)) != NULL) { + u_int new = *tp * 10 + (pch - digits); + + if (saw_digit && *tp == 0) + return (0); + if (new > 255) + return (0); + *tp = new; + if (!saw_digit) { + if (++octets > 4) + return (0); + saw_digit = 1; + } + } else if (ch == '.' && saw_digit) { + if (octets == 4) + return (0); + *++tp = 0; + saw_digit = 0; + } else + return (0); + } + if (octets < 4) + return (0); + memcpy(dst, tmp, NS_INADDRSZ); + return (1); +} + +/* int + * inet_pton6(src, dst) + * convert presentation level address to network order binary form. + * return: + * 1 if `src' is a valid [RFC1884 2.2] address, else 0. + * notice: + * (1) does not touch `dst' unless it's returning 1. + * (2) :: in a full address is silently ignored. + * credit: + * inspired by Mark Andrews. + * author: + * Paul Vixie, 1996. + */ +static int +inet_pton6(const char *src, u_char *dst) +{ + static const char xdigits_l[] = "0123456789abcdef", + xdigits_u[] = "0123456789ABCDEF"; +#define NS_IN6ADDRSZ 16 +#define NS_INT16SZ 2 + u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; + const char *xdigits, *curtok; + int ch, seen_xdigits; + u_int val; + + memset((tp = tmp), '\0', NS_IN6ADDRSZ); + endp = tp + NS_IN6ADDRSZ; + colonp = NULL; + /* Leading :: requires some special handling. */ + if (*src == ':') + if (*++src != ':') + return (0); + curtok = src; + seen_xdigits = 0; + val = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) + pch = strchr((xdigits = xdigits_u), ch); + if (pch != NULL) { + val <<= 4; + val |= (pch - xdigits); + if (++seen_xdigits > 4) + return (0); + continue; + } + if (ch == ':') { + curtok = src; + if (!seen_xdigits) { + if (colonp) + return (0); + colonp = tp; + continue; + } else if (*src == '\0') { + return (0); + } + if (tp + NS_INT16SZ > endp) + return (0); + *tp++ = (u_char) (val >> 8) & 0xff; + *tp++ = (u_char) val & 0xff; + seen_xdigits = 0; + val = 0; + continue; + } + if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && + inet_pton4(curtok, tp) > 0) { + tp += NS_INADDRSZ; + seen_xdigits = 0; + break; /*%< '\\0' was seen by inet_pton4(). */ + } + return (0); + } + if (seen_xdigits) { + if (tp + NS_INT16SZ > endp) + return (0); + *tp++ = (u_char) (val >> 8) & 0xff; + *tp++ = (u_char) val & 0xff; + } + if (colonp != NULL) { + /* + * Since some memmove()'s erroneously fail to handle + * overlapping regions, we'll do the shift by hand. + */ + const int n = tp - colonp; + int i; + + if (tp == endp) + return (0); + for (i = 1; i <= n; i++) { + endp[- i] = colonp[n - i]; + colonp[n - i] = 0; + } + tp = endp; + } + if (tp != endp) + return (0); + memcpy(dst, tmp, NS_IN6ADDRSZ); + return (1); +} + +/*! \file */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 09:25:29 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8460C1065693; Tue, 26 Oct 2010 09:25:29 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 70F7D8FC18; Tue, 26 Oct 2010 09:25: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 o9Q9PT6H010232; Tue, 26 Oct 2010 09:25:29 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9Q9PTr2010224; Tue, 26 Oct 2010 09:25:29 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010260925.o9Q9PTr2010224@svn.freebsd.org> From: David Xu Date: Tue, 26 Oct 2010 09:25:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214371 - in stable/8: include lib/libthr/thread X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 09:25:29 -0000 Author: davidxu Date: Tue Oct 26 09:25:29 2010 New Revision: 214371 URL: http://svn.freebsd.org/changeset/base/214371 Log: MFC r213241, r213257: In current code, statically initialized and destroyed object have same null value, the code can not distinguish between them, to fix the problem, now a destroyed object is assigned to a non-null value, and it will be rejected by some pthread functions. PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP is changed to number 1, so that adaptive mutex can be statically initialized correctly. Modified: stable/8/include/pthread.h stable/8/lib/libthr/thread/thr_cond.c stable/8/lib/libthr/thread/thr_init.c stable/8/lib/libthr/thread/thr_mutex.c stable/8/lib/libthr/thread/thr_private.h stable/8/lib/libthr/thread/thr_rwlock.c Directory Properties: stable/8/include/ (props changed) stable/8/lib/libthr/ (props changed) Modified: stable/8/include/pthread.h ============================================================================== --- stable/8/include/pthread.h Tue Oct 26 08:50:09 2010 (r214370) +++ stable/8/include/pthread.h Tue Oct 26 09:25:29 2010 (r214371) @@ -98,7 +98,7 @@ * Static initialization values. */ #define PTHREAD_MUTEX_INITIALIZER NULL -#define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP NULL +#define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP ((pthread_mutex_t)1) #define PTHREAD_COND_INITIALIZER NULL #define PTHREAD_RWLOCK_INITIALIZER NULL Modified: stable/8/lib/libthr/thread/thr_cond.c ============================================================================== --- stable/8/lib/libthr/thread/thr_cond.c Tue Oct 26 08:50:09 2010 (r214370) +++ stable/8/lib/libthr/thread/thr_cond.c Tue Oct 26 09:25:29 2010 (r214371) @@ -104,6 +104,19 @@ init_static(struct pthread *thread, pthr return (ret); } +#define CHECK_AND_INIT_COND \ + if (__predict_false((cv = (*cond)) <= THR_COND_DESTROYED)) { \ + if (cv == THR_COND_INITIALIZER) { \ + int ret; \ + ret = init_static(_get_curthread(), cond); \ + if (ret) \ + return (ret); \ + } else if (cv == THR_COND_DESTROYED) { \ + return (EINVAL); \ + } \ + cv = *cond; \ + } + int _pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *cond_attr) { @@ -119,16 +132,14 @@ _pthread_cond_destroy(pthread_cond_t *co struct pthread_cond *cv; int rval = 0; - if (*cond == NULL) + if ((cv = *cond) == THR_COND_INITIALIZER) + rval = 0; + else if (cv == THR_COND_DESTROYED) rval = EINVAL; else { cv = *cond; THR_UMUTEX_LOCK(curthread, &cv->c_lock); - /* - * NULL the caller's pointer now that the condition - * variable has been destroyed: - */ - *cond = NULL; + *cond = THR_COND_DESTROYED; THR_UMUTEX_UNLOCK(curthread, &cv->c_lock); /* @@ -137,7 +148,6 @@ _pthread_cond_destroy(pthread_cond_t *co */ free(cv); } - /* Return the completion status: */ return (rval); } @@ -170,20 +180,18 @@ cond_wait_common(pthread_cond_t *cond, p struct timespec ts, ts2, *tsp; struct cond_cancel_info info; pthread_cond_t cv; - int ret = 0; + int ret; /* * If the condition variable is statically initialized, * perform the dynamic initialization: */ - if (__predict_false(*cond == NULL && - (ret = init_static(curthread, cond)) != 0)) - return (ret); + CHECK_AND_INIT_COND cv = *cond; THR_UMUTEX_LOCK(curthread, &cv->c_lock); ret = _mutex_cv_unlock(mutex, &info.count); - if (ret) { + if (__predict_false(ret != 0)) { THR_UMUTEX_UNLOCK(curthread, &cv->c_lock); return (ret); } @@ -263,11 +271,8 @@ cond_signal_common(pthread_cond_t *cond, * If the condition variable is statically initialized, perform dynamic * initialization. */ - if (__predict_false(*cond == NULL && - (ret = init_static(curthread, cond)) != 0)) - return (ret); + CHECK_AND_INIT_COND - cv = *cond; THR_UMUTEX_LOCK(curthread, &cv->c_lock); if (!broadcast) ret = _thr_ucond_signal(&cv->c_kerncv); Modified: stable/8/lib/libthr/thread/thr_init.c ============================================================================== --- stable/8/lib/libthr/thread/thr_init.c Tue Oct 26 08:50:09 2010 (r214370) +++ stable/8/lib/libthr/thread/thr_init.c Tue Oct 26 09:25:29 2010 (r214371) @@ -92,6 +92,12 @@ struct pthread_mutex_attr _pthread_mutex .m_ceiling = 0 }; +struct pthread_mutex_attr _pthread_mutexattr_adaptive_default = { + .m_type = PTHREAD_MUTEX_ADAPTIVE_NP, + .m_protocol = PTHREAD_PRIO_NONE, + .m_ceiling = 0 +}; + /* Default condition variable attributes: */ struct pthread_cond_attr _pthread_condattr_default = { .c_pshared = PTHREAD_PROCESS_PRIVATE, Modified: stable/8/lib/libthr/thread/thr_mutex.c ============================================================================== --- stable/8/lib/libthr/thread/thr_mutex.c Tue Oct 26 08:50:09 2010 (r214370) +++ stable/8/lib/libthr/thread/thr_mutex.c Tue Oct 26 09:25:29 2010 (r214371) @@ -124,7 +124,7 @@ __weak_reference(_pthread_mutex_isowned_ static int mutex_init(pthread_mutex_t *mutex, - const pthread_mutexattr_t *mutex_attr, + const struct pthread_mutex_attr *mutex_attr, void *(calloc_cb)(size_t, size_t)) { const struct pthread_mutex_attr *attr; @@ -133,7 +133,7 @@ mutex_init(pthread_mutex_t *mutex, if (mutex_attr == NULL) { attr = &_pthread_mutexattr_default; } else { - attr = *mutex_attr; + attr = mutex_attr; if (attr->m_type < PTHREAD_MUTEX_ERRORCHECK || attr->m_type >= PTHREAD_MUTEX_TYPE_MAX) return (EINVAL); @@ -153,6 +153,10 @@ mutex_init(pthread_mutex_t *mutex, pmutex->m_yieldloops = 0; MUTEX_INIT_LINK(pmutex); switch(attr->m_protocol) { + case PTHREAD_PRIO_NONE: + pmutex->m_lock.m_owner = UMUTEX_UNOWNED; + pmutex->m_lock.m_flags = 0; + break; case PTHREAD_PRIO_INHERIT: pmutex->m_lock.m_owner = UMUTEX_UNOWNED; pmutex->m_lock.m_flags = UMUTEX_PRIO_INHERIT; @@ -162,9 +166,6 @@ mutex_init(pthread_mutex_t *mutex, pmutex->m_lock.m_flags = UMUTEX_PRIO_PROTECT; pmutex->m_lock.m_ceilings[0] = attr->m_ceiling; break; - case PTHREAD_PRIO_NONE: - pmutex->m_lock.m_owner = UMUTEX_UNOWNED; - pmutex->m_lock.m_flags = 0; } if (pmutex->m_type == PTHREAD_MUTEX_ADAPTIVE_NP) { @@ -184,11 +185,12 @@ init_static(struct pthread *thread, pthr THR_LOCK_ACQUIRE(thread, &_mutex_static_lock); - if (*mutex == NULL) - ret = mutex_init(mutex, NULL, calloc); + if (*mutex == THR_MUTEX_INITIALIZER) + ret = mutex_init(mutex, &_pthread_mutexattr_default, calloc); + else if (*mutex == THR_ADAPTIVE_MUTEX_INITIALIZER) + ret = mutex_init(mutex, &_pthread_mutexattr_adaptive_default, calloc); else ret = 0; - THR_LOCK_RELEASE(thread, &_mutex_static_lock); return (ret); @@ -210,7 +212,7 @@ int __pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutex_attr) { - return mutex_init(mutex, mutex_attr, calloc); + return mutex_init(mutex, mutex_attr ? *mutex_attr : NULL, calloc); } /* This function is used internally by malloc. */ @@ -223,9 +225,8 @@ _pthread_mutex_init_calloc_cb(pthread_mu .m_protocol = PTHREAD_PRIO_NONE, .m_ceiling = 0 }; - static const struct pthread_mutex_attr *pattr = &attr; - return mutex_init(mutex, (pthread_mutexattr_t *)&pattr, calloc_cb); + return mutex_init(mutex, &attr, calloc_cb); } void @@ -257,19 +258,21 @@ _pthread_mutex_destroy(pthread_mutex_t * uint32_t id; int ret = 0; - if (__predict_false(*mutex == NULL)) + m = *mutex; + if (m < THR_MUTEX_DESTROYED) { + ret = 0; + } else if (m == THR_MUTEX_DESTROYED) { ret = EINVAL; - else { + } else { id = TID(curthread); /* * Try to lock the mutex structure, we only need to * try once, if failed, the mutex is in used. */ - ret = _thr_umutex_trylock(&(*mutex)->m_lock, id); + ret = _thr_umutex_trylock(&m->m_lock, id); if (ret) return (ret); - m = *mutex; /* * Check mutex other fields to see if this mutex is * in use. Mostly for prority mutex types, or there @@ -281,11 +284,7 @@ _pthread_mutex_destroy(pthread_mutex_t * _thr_umutex_unlock(&m->m_lock, id); ret = EBUSY; } else { - /* - * Save a pointer to the mutex so it can be free'd - * and set the caller's pointer to NULL. - */ - *mutex = NULL; + *mutex = THR_MUTEX_DESTROYED; if (m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) set_inherited_priority(curthread, m); @@ -310,17 +309,28 @@ _pthread_mutex_destroy(pthread_mutex_t * TAILQ_INSERT_TAIL(&curthread->pp_mutexq, (m), m_qe);\ } while (0) +#define CHECK_AND_INIT_MUTEX \ + if (__predict_false((m = *mutex) <= THR_MUTEX_DESTROYED)) { \ + if (m == THR_MUTEX_DESTROYED) \ + return (EINVAL); \ + int ret; \ + ret = init_static(_get_curthread(), mutex); \ + if (ret) \ + return (ret); \ + m = *mutex; \ + } + static int -mutex_trylock_common(struct pthread *curthread, pthread_mutex_t *mutex) +mutex_trylock_common(pthread_mutex_t *mutex) { - struct pthread_mutex *m; + struct pthread *curthread = _get_curthread(); + struct pthread_mutex *m = *mutex; uint32_t id; int ret; id = TID(curthread); - m = *mutex; ret = _thr_umutex_trylock(&m->m_lock, id); - if (ret == 0) { + if (__predict_true(ret == 0)) { ENQUEUE_MUTEX(curthread, m); } else if (m->m_owner == curthread) { ret = mutex_self_trylock(m); @@ -332,19 +342,11 @@ mutex_trylock_common(struct pthread *cur int __pthread_mutex_trylock(pthread_mutex_t *mutex) { - struct pthread *curthread = _get_curthread(); - int ret; + struct pthread_mutex *m; - /* - * If the mutex is statically initialized, perform the dynamic - * initialization: - */ - if (__predict_false(*mutex == NULL)) { - ret = init_static(curthread, mutex); - if (__predict_false(ret)) - return (ret); - } - return (mutex_trylock_common(curthread, mutex)); + CHECK_AND_INIT_MUTEX + + return (mutex_trylock_common(mutex)); } static int @@ -365,8 +367,10 @@ mutex_lock_sleep(struct pthread *curthre * the lock is likely to be released quickly and it is * faster than entering the kernel */ - if (m->m_lock.m_flags & (UMUTEX_PRIO_PROTECT | UMUTEX_PRIO_INHERIT)) - goto sleep_in_kernel; + if (__predict_false( + (m->m_lock.m_flags & + (UMUTEX_PRIO_PROTECT | UMUTEX_PRIO_INHERIT)) != 0)) + goto sleep_in_kernel; if (!_thr_is_smp) goto yield_loop; @@ -414,9 +418,10 @@ done: } static inline int -mutex_lock_common(struct pthread *curthread, struct pthread_mutex *m, +mutex_lock_common(struct pthread_mutex *m, const struct timespec *abstime) { + struct pthread *curthread = _get_curthread(); if (_thr_umutex_trylock2(&m->m_lock, TID(curthread)) == 0) { ENQUEUE_MUTEX(curthread, m); @@ -429,50 +434,25 @@ mutex_lock_common(struct pthread *curthr int __pthread_mutex_lock(pthread_mutex_t *mutex) { - struct pthread *curthread; - struct pthread_mutex *m; - int ret; + struct pthread_mutex *m; _thr_check_init(); - curthread = _get_curthread(); - - /* - * If the mutex is statically initialized, perform the dynamic - * initialization: - */ - if (__predict_false((m = *mutex) == NULL)) { - ret = init_static(curthread, mutex); - if (__predict_false(ret)) - return (ret); - m = *mutex; - } + CHECK_AND_INIT_MUTEX - return (mutex_lock_common(curthread, m, NULL)); + return (mutex_lock_common(m, NULL)); } int __pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *abstime) { - struct pthread *curthread; - struct pthread_mutex *m; - int ret; + struct pthread_mutex *m; _thr_check_init(); - curthread = _get_curthread(); + CHECK_AND_INIT_MUTEX - /* - * If the mutex is statically initialized, perform the dynamic - * initialization: - */ - if (__predict_false((m = *mutex) == NULL)) { - ret = init_static(curthread, mutex); - if (__predict_false(ret)) - return (ret); - m = *mutex; - } - return (mutex_lock_common(curthread, m, abstime)); + return (mutex_lock_common(m, abstime)); } int @@ -482,20 +462,22 @@ _pthread_mutex_unlock(pthread_mutex_t *m } int -_mutex_cv_lock(pthread_mutex_t *m, int count) +_mutex_cv_lock(pthread_mutex_t *mutex, int count) { + struct pthread_mutex *m; int ret; - ret = mutex_lock_common(_get_curthread(), *m, NULL); + m = *mutex; + ret = mutex_lock_common(m, NULL); if (ret == 0) { - (*m)->m_refcount--; - (*m)->m_count += count; + m->m_refcount--; + m->m_count += count; } return (ret); } static int -mutex_self_trylock(pthread_mutex_t m) +mutex_self_trylock(struct pthread_mutex *m) { int ret; @@ -523,7 +505,7 @@ mutex_self_trylock(pthread_mutex_t m) } static int -mutex_self_lock(pthread_mutex_t m, const struct timespec *abstime) +mutex_self_lock(struct pthread_mutex *m, const struct timespec *abstime) { struct timespec ts1, ts2; int ret; @@ -598,8 +580,12 @@ mutex_unlock_common(pthread_mutex_t *mut struct pthread_mutex *m; uint32_t id; - if (__predict_false((m = *mutex) == NULL)) - return (EINVAL); + m = *mutex; + if (__predict_false(m <= THR_MUTEX_DESTROYED)) { + if (m == THR_MUTEX_DESTROYED) + return (EINVAL); + return (EPERM); + } /* * Check if the running thread is not the owner of the mutex. @@ -616,7 +602,7 @@ mutex_unlock_common(pthread_mutex_t *mut m->m_owner = NULL; /* Remove the mutex from the threads queue. */ MUTEX_ASSERT_IS_OWNED(m); - if ((m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) == 0) + if (__predict_true((m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) == 0)) TAILQ_REMOVE(&curthread->mutexq, m, m_qe); else { TAILQ_REMOVE(&curthread->pp_mutexq, m, m_qe); @@ -634,8 +620,12 @@ _mutex_cv_unlock(pthread_mutex_t *mutex, struct pthread *curthread = _get_curthread(); struct pthread_mutex *m; - if (__predict_false((m = *mutex) == NULL)) - return (EINVAL); + m = *mutex; + if (__predict_false(m <= THR_MUTEX_DESTROYED)) { + if (m == THR_MUTEX_DESTROYED) + return (EINVAL); + return (EPERM); + } /* * Check if the running thread is not the owner of the mutex. @@ -652,7 +642,7 @@ _mutex_cv_unlock(pthread_mutex_t *mutex, m->m_owner = NULL; /* Remove the mutex from the threads queue. */ MUTEX_ASSERT_IS_OWNED(m); - if ((m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) == 0) + if (__predict_true((m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) == 0)) TAILQ_REMOVE(&curthread->mutexq, m, m_qe); else { TAILQ_REMOVE(&curthread->pp_mutexq, m, m_qe); @@ -667,18 +657,19 @@ int _pthread_mutex_getprioceiling(pthread_mutex_t *mutex, int *prioceiling) { + struct pthread_mutex *m; int ret; - if (*mutex == NULL) - ret = EINVAL; - else if (((*mutex)->m_lock.m_flags & UMUTEX_PRIO_PROTECT) == 0) + m = *mutex; + if ((m <= THR_MUTEX_DESTROYED) || + (m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) == 0) ret = EINVAL; else { - *prioceiling = (*mutex)->m_lock.m_ceilings[0]; + *prioceiling = m->m_lock.m_ceilings[0]; ret = 0; } - return(ret); + return (ret); } int @@ -690,7 +681,8 @@ _pthread_mutex_setprioceiling(pthread_mu int ret; m = *mutex; - if (m == NULL || (m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) == 0) + if ((m <= THR_MUTEX_DESTROYED) || + (m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) == 0) return (EINVAL); ret = __thr_umutex_set_ceiling(&m->m_lock, ceiling, old_ceiling); @@ -719,61 +711,54 @@ _pthread_mutex_setprioceiling(pthread_mu int _pthread_mutex_getspinloops_np(pthread_mutex_t *mutex, int *count) { - if (*mutex == NULL) - return (EINVAL); - *count = (*mutex)->m_spinloops; + struct pthread_mutex *m; + + CHECK_AND_INIT_MUTEX + + *count = m->m_spinloops; return (0); } int __pthread_mutex_setspinloops_np(pthread_mutex_t *mutex, int count) { - struct pthread *curthread = _get_curthread(); - int ret; + struct pthread_mutex *m; - if (__predict_false(*mutex == NULL)) { - ret = init_static(curthread, mutex); - if (__predict_false(ret)) - return (ret); - } - (*mutex)->m_spinloops = count; + CHECK_AND_INIT_MUTEX + + m->m_spinloops = count; return (0); } int _pthread_mutex_getyieldloops_np(pthread_mutex_t *mutex, int *count) { - if (*mutex == NULL) - return (EINVAL); - *count = (*mutex)->m_yieldloops; + struct pthread_mutex *m; + + CHECK_AND_INIT_MUTEX + + *count = m->m_yieldloops; return (0); } int __pthread_mutex_setyieldloops_np(pthread_mutex_t *mutex, int count) { - struct pthread *curthread = _get_curthread(); - int ret; + struct pthread_mutex *m; - if (__predict_false(*mutex == NULL)) { - ret = init_static(curthread, mutex); - if (__predict_false(ret)) - return (ret); - } - (*mutex)->m_yieldloops = count; + CHECK_AND_INIT_MUTEX + + m->m_yieldloops = count; return (0); } int _pthread_mutex_isowned_np(pthread_mutex_t *mutex) { - struct pthread *curthread = _get_curthread(); - int ret; + struct pthread_mutex *m; - if (__predict_false(*mutex == NULL)) { - ret = init_static(curthread, mutex); - if (__predict_false(ret)) - return (ret); - } - return ((*mutex)->m_owner == curthread); + m = *mutex; + if (m <= THR_MUTEX_DESTROYED) + return (0); + return (m->m_owner == _get_curthread()); } Modified: stable/8/lib/libthr/thread/thr_private.h ============================================================================== --- stable/8/lib/libthr/thread/thr_private.h Tue Oct 26 08:50:09 2010 (r214370) +++ stable/8/lib/libthr/thread/thr_private.h Tue Oct 26 09:25:29 2010 (r214371) @@ -107,6 +107,15 @@ TAILQ_HEAD(mutex_queue, pthread_mutex); } \ } while (0) +/* XXX These values should be same as those defined in pthread.h */ +#define THR_MUTEX_INITIALIZER ((struct pthread_mutex *)NULL) +#define THR_ADAPTIVE_MUTEX_INITIALIZER ((struct pthread_mutex *)1) +#define THR_MUTEX_DESTROYED ((struct pthread_mutex *)2) +#define THR_COND_INITIALIZER ((struct pthread_cond *)NULL) +#define THR_COND_DESTROYED ((struct pthread_cond *)1) +#define THR_RWLOCK_INITIALIZER ((struct pthread_rwlock *)NULL) +#define THR_RWLOCK_DESTROYED ((struct pthread_rwlock *)1) + struct pthread_mutex { /* * Lock for accesses to this structure. @@ -571,6 +580,7 @@ extern struct pthread_attr _pthread_attr /* Default mutex attributes: */ extern struct pthread_mutex_attr _pthread_mutexattr_default __hidden; +extern struct pthread_mutex_attr _pthread_mutexattr_adaptive_default __hidden; /* Default condition variable attributes: */ extern struct pthread_cond_attr _pthread_condattr_default __hidden; Modified: stable/8/lib/libthr/thread/thr_rwlock.c ============================================================================== --- stable/8/lib/libthr/thread/thr_rwlock.c Tue Oct 26 08:50:09 2010 (r214370) +++ stable/8/lib/libthr/thread/thr_rwlock.c Tue Oct 26 09:25:29 2010 (r214371) @@ -45,6 +45,19 @@ __weak_reference(_pthread_rwlock_unlock, __weak_reference(_pthread_rwlock_wrlock, pthread_rwlock_wrlock); __weak_reference(_pthread_rwlock_timedwrlock, pthread_rwlock_timedwrlock); +#define CHECK_AND_INIT_RWLOCK \ + if (__predict_false((prwlock = (*rwlock)) <= THR_RWLOCK_DESTROYED)) { \ + if (prwlock == THR_RWLOCK_INITIALIZER) { \ + int ret; \ + ret = init_static(_get_curthread(), rwlock); \ + if (ret) \ + return (ret); \ + } else if (prwlock == THR_RWLOCK_DESTROYED) { \ + return (EINVAL); \ + } \ + prwlock = *rwlock; \ + } + /* * Prototypes */ @@ -64,15 +77,16 @@ rwlock_init(pthread_rwlock_t *rwlock, co int _pthread_rwlock_destroy (pthread_rwlock_t *rwlock) { + pthread_rwlock_t prwlock; int ret; - if (rwlock == NULL) + prwlock = *rwlock; + if (prwlock == THR_RWLOCK_INITIALIZER) + ret = 0; + else if (prwlock == THR_RWLOCK_DESTROYED) ret = EINVAL; else { - pthread_rwlock_t prwlock; - - prwlock = *rwlock; - *rwlock = NULL; + *rwlock = THR_RWLOCK_DESTROYED; free(prwlock); ret = 0; @@ -87,7 +101,7 @@ init_static(struct pthread *thread, pthr THR_LOCK_ACQUIRE(thread, &_rwlock_static_lock); - if (*rwlock == NULL) + if (*rwlock == THR_RWLOCK_INITIALIZER) ret = rwlock_init(rwlock, NULL); else ret = 0; @@ -113,18 +127,7 @@ rwlock_rdlock_common(pthread_rwlock_t *r int flags; int ret; - if (__predict_false(rwlock == NULL)) - return (EINVAL); - - prwlock = *rwlock; - - /* check for static initialization */ - if (__predict_false(prwlock == NULL)) { - if ((ret = init_static(curthread, rwlock)) != 0) - return (ret); - - prwlock = *rwlock; - } + CHECK_AND_INIT_RWLOCK if (curthread->rdlock_count) { /* @@ -206,18 +209,7 @@ _pthread_rwlock_tryrdlock (pthread_rwloc int flags; int ret; - if (__predict_false(rwlock == NULL)) - return (EINVAL); - - prwlock = *rwlock; - - /* check for static initialization */ - if (__predict_false(prwlock == NULL)) { - if ((ret = init_static(curthread, rwlock)) != 0) - return (ret); - - prwlock = *rwlock; - } + CHECK_AND_INIT_RWLOCK if (curthread->rdlock_count) { /* @@ -250,18 +242,7 @@ _pthread_rwlock_trywrlock (pthread_rwloc pthread_rwlock_t prwlock; int ret; - if (__predict_false(rwlock == NULL)) - return (EINVAL); - - prwlock = *rwlock; - - /* check for static initialization */ - if (__predict_false(prwlock == NULL)) { - if ((ret = init_static(curthread, rwlock)) != 0) - return (ret); - - prwlock = *rwlock; - } + CHECK_AND_INIT_RWLOCK ret = _thr_rwlock_trywrlock(&prwlock->lock); if (ret == 0) @@ -277,18 +258,7 @@ rwlock_wrlock_common (pthread_rwlock_t * struct timespec ts, ts2, *tsp; int ret; - if (__predict_false(rwlock == NULL)) - return (EINVAL); - - prwlock = *rwlock; - - /* check for static initialization */ - if (__predict_false(prwlock == NULL)) { - if ((ret = init_static(curthread, rwlock)) != 0) - return (ret); - - prwlock = *rwlock; - } + CHECK_AND_INIT_RWLOCK /* * POSIX said the validity of the abstimeout parameter need @@ -356,12 +326,9 @@ _pthread_rwlock_unlock (pthread_rwlock_t int ret; int32_t state; - if (__predict_false(rwlock == NULL)) - return (EINVAL); - prwlock = *rwlock; - if (__predict_false(prwlock == NULL)) + if (__predict_false(prwlock <= THR_RWLOCK_DESTROYED)) return (EINVAL); state = prwlock->lock.rw_state; From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 11:52:28 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7EDA6106564A; Tue, 26 Oct 2010 11:52:28 +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 57F628FC0C; Tue, 26 Oct 2010 11:52:28 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id F092A46B8C; Tue, 26 Oct 2010 07:52:27 -0400 (EDT) Date: Tue, 26 Oct 2010 12:52:27 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Attilio Rao In-Reply-To: <201010251316.o9PDGB4L066137@svn.freebsd.org> Message-ID: References: <201010251316.o9PDGB4L066137@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-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r214338 - in stable/8/sys: netinet netinet6 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 11:52:28 -0000 On Mon, 25 Oct 2010, Attilio Rao wrote: > IP_BINDANY is not correctly handled in getsockopt() case. > Fix it by specifying the correct bits. It would be nice if we had regression tests to validate this sort of thing; I think we already have something in the area of socket options, but it doesn't test for this sort of stuff... Robert > > Modified: > stable/8/sys/netinet/ip_output.c > stable/8/sys/netinet6/ip6_output.c > Directory Properties: > stable/8/sys/ (props changed) > stable/8/sys/amd64/include/xen/ (props changed) > stable/8/sys/cddl/contrib/opensolaris/ (props changed) > stable/8/sys/contrib/dev/acpica/ (props changed) > stable/8/sys/contrib/pf/ (props changed) > stable/8/sys/dev/xen/xenpci/ (props changed) > > Modified: stable/8/sys/netinet/ip_output.c > ============================================================================== > --- stable/8/sys/netinet/ip_output.c Mon Oct 25 13:13:16 2010 (r214337) > +++ stable/8/sys/netinet/ip_output.c Mon Oct 25 13:16:11 2010 (r214338) > @@ -1127,6 +1127,7 @@ ip_ctloutput(struct socket *so, struct s > case IP_FAITH: > case IP_ONESBCAST: > case IP_DONTFRAG: > + case IP_BINDANY: > switch (sopt->sopt_name) { > > case IP_TOS: > @@ -1182,6 +1183,9 @@ ip_ctloutput(struct socket *so, struct s > case IP_DONTFRAG: > optval = OPTBIT(INP_DONTFRAG); > break; > + case IP_BINDANY: > + optval = OPTBIT(INP_BINDANY); > + break; > } > error = sooptcopyout(sopt, &optval, sizeof optval); > break; > > Modified: stable/8/sys/netinet6/ip6_output.c > ============================================================================== > --- stable/8/sys/netinet6/ip6_output.c Mon Oct 25 13:13:16 2010 (r214337) > +++ stable/8/sys/netinet6/ip6_output.c Mon Oct 25 13:16:11 2010 (r214338) > @@ -1798,6 +1798,7 @@ do { \ > case IPV6_PORTRANGE: > case IPV6_RECVTCLASS: > case IPV6_AUTOFLOWLABEL: > + case IPV6_BINDANY: > switch (optname) { > > case IPV6_RECVHOPOPTS: > From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 14:56:47 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53745106566B; Tue, 26 Oct 2010 14:56:47 +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 409F68FC14; Tue, 26 Oct 2010 14:56: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 o9QEulqh041420; Tue, 26 Oct 2010 14:56:47 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QEulei041414; Tue, 26 Oct 2010 14:56:47 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010261456.o9QEulei041414@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 26 Oct 2010 14:56:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214376 - in stable/8/sys/powerpc: aim include X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 14:56:47 -0000 Author: nwhitehorn Date: Tue Oct 26 14:56:46 2010 New Revision: 214376 URL: http://svn.freebsd.org/changeset/base/214376 Log: MFC r213456: Handle vector assist traps without a kernel panic, by setting denormalized values to zero. A correct solution would involve emulating vector operations on denormalized values, but this has little effect on accuracy and is much less complicated for now. Modified: stable/8/sys/powerpc/aim/machdep.c stable/8/sys/powerpc/aim/trap.c stable/8/sys/powerpc/include/altivec.h stable/8/sys/powerpc/include/pcb.h stable/8/sys/powerpc/include/trap_aim.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/powerpc/aim/machdep.c ============================================================================== --- stable/8/sys/powerpc/aim/machdep.c Tue Oct 26 14:06:59 2010 (r214375) +++ stable/8/sys/powerpc/aim/machdep.c Tue Oct 26 14:56:46 2010 (r214376) @@ -474,8 +474,8 @@ powerpc_init(u_int startkernel, u_int en bcopy(generictrap, (void *)EXC_SC, (size_t)&trapsize); bcopy(generictrap, (void *)EXC_FPA, (size_t)&trapsize); bcopy(generictrap, (void *)EXC_VEC, (size_t)&trapsize); - bcopy(generictrap, (void *)EXC_VECAST, (size_t)&trapsize); - bcopy(generictrap, (void *)EXC_THRM, (size_t)&trapsize); + bcopy(generictrap, (void *)EXC_VECAST_G4, (size_t)&trapsize); + bcopy(generictrap, (void *)EXC_VECAST_G5, (size_t)&trapsize); __syncicache(EXC_RSVD, EXC_LAST - EXC_RSVD); /* Modified: stable/8/sys/powerpc/aim/trap.c ============================================================================== --- stable/8/sys/powerpc/aim/trap.c Tue Oct 26 14:06:59 2010 (r214375) +++ stable/8/sys/powerpc/aim/trap.c Tue Oct 26 14:56:46 2010 (r214376) @@ -196,9 +196,19 @@ trap(struct trapframe *frame) enable_vec(td); break; - case EXC_VECAST: - printf("Vector assist exception!\n"); - sig = SIGILL; + case EXC_VECAST_G4: + case EXC_VECAST_G5: + /* + * We get a VPU assist exception for IEEE mode + * vector operations on denormalized floats. + * Emulating this is a giant pain, so for now, + * just switch off IEEE mode and treat them as + * zero. + */ + + save_vec(td); + td->td_pcb->pcb_vec.vscr |= ALTIVEC_VSCR_NJ; + enable_vec(td); break; case EXC_ALI: Modified: stable/8/sys/powerpc/include/altivec.h ============================================================================== --- stable/8/sys/powerpc/include/altivec.h Tue Oct 26 14:06:59 2010 (r214375) +++ stable/8/sys/powerpc/include/altivec.h Tue Oct 26 14:56:46 2010 (r214376) @@ -29,6 +29,9 @@ #ifndef _MACHINE_ALTIVEC_H_ #define _MACHINE_ALTIVEC_H_ +#define ALTIVEC_VSCR_NJ 0x00010000 /* Enable non-Java mode */ +#define ALTIVEC_VSCR_SAT 0x00000001 /* Saturation status bit */ + void enable_vec(struct thread *); void save_vec(struct thread *); Modified: stable/8/sys/powerpc/include/pcb.h ============================================================================== --- stable/8/sys/powerpc/include/pcb.h Tue Oct 26 14:06:59 2010 (r214375) +++ stable/8/sys/powerpc/include/pcb.h Tue Oct 26 14:56:46 2010 (r214376) @@ -58,7 +58,7 @@ struct pcb { uint32_t vr[32][4]; register_t vrsave; register_t spare[2]; - register_t vscr; + register_t vscr; /* aligned at vector element 3 */ } pcb_vec __attribute__((aligned(16))); /* Vector processor */ unsigned int pcb_veccpu; /* which CPU had our vector stuff. */ Modified: stable/8/sys/powerpc/include/trap_aim.h ============================================================================== --- stable/8/sys/powerpc/include/trap_aim.h Tue Oct 26 14:06:59 2010 (r214375) +++ stable/8/sys/powerpc/include/trap_aim.h Tue Oct 26 14:56:46 2010 (r214376) @@ -52,9 +52,12 @@ /* The following is only available on the 601: */ #define EXC_RUNMODETRC 0x2000 /* Run Mode/Trace Exception */ +/* The following are only available on 970(G5): */ +#define EXC_VECAST_G5 0x1700 /* AltiVec Assist */ + /* The following are only available on 7400(G4): */ #define EXC_VEC 0x0f20 /* AltiVec Unavailable */ -#define EXC_VECAST 0x1600 /* AltiVec Assist */ +#define EXC_VECAST_G4 0x1600 /* AltiVec Assist */ /* The following are only available on 604/750/7400: */ #define EXC_PERF 0x0f00 /* Performance Monitoring */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 14:59:35 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BD791065673; Tue, 26 Oct 2010 14:59:35 +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 79AE48FC08; Tue, 26 Oct 2010 14:59: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 o9QExZ9a041868; Tue, 26 Oct 2010 14:59:35 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QExZoZ041866; Tue, 26 Oct 2010 14:59:35 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010261459.o9QExZoZ041866@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 26 Oct 2010 14:59:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214377 - stable/8/sys/vm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 14:59:35 -0000 Author: nwhitehorn Date: Tue Oct 26 14:59:35 2010 New Revision: 214377 URL: http://svn.freebsd.org/changeset/base/214377 Log: MFC r212360: On architectures with non-tree-based page tables like PowerPC, every page in a range must be checked when calling pmap_remove(). Calling pmap_remove() from vm_pageout_map_deactivate_pages() with the entire range of the map could result in attempting to demap an extraordinary number of pages (> 10^15), so iterate through each map entry and unmap each of them individually. Modified: stable/8/sys/vm/vm_pageout.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/vm/vm_pageout.c ============================================================================== --- stable/8/sys/vm/vm_pageout.c Tue Oct 26 14:56:46 2010 (r214376) +++ stable/8/sys/vm/vm_pageout.c Tue Oct 26 14:59:35 2010 (r214377) @@ -661,8 +661,11 @@ vm_pageout_map_deactivate_pages(map, des * table pages. */ if (desired == 0 && nothingwired) { - pmap_remove(vm_map_pmap(map), vm_map_min(map), - vm_map_max(map)); + tmpe = map->header.next; + while (tmpe != &map->header) { + pmap_remove(vm_map_pmap(map), tmpe->start, tmpe->end); + tmpe = tmpe->next; + } } vm_map_unlock(map); } From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 16:04:24 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E5BD106566B; Tue, 26 Oct 2010 16:04:24 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3CB5D8FC29; Tue, 26 Oct 2010 16:04: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 o9QG4OiR052243; Tue, 26 Oct 2010 16:04:24 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QG4ORP052241; Tue, 26 Oct 2010 16:04:24 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201010261604.o9QG4ORP052241@svn.freebsd.org> From: Benedict Reuschling Date: Tue, 26 Oct 2010 16:04:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214379 - stable/8/lib/libc/stdlib X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 16:04:24 -0000 Author: bcr (doc committer) Date: Tue Oct 26 16:04:23 2010 New Revision: 214379 URL: http://svn.freebsd.org/changeset/base/214379 Log: MFC r214147: Sync with OpenBSD rev. 1.13: strtonum does not require limits.h Obtained from: OpenBSD Discussed with: ru@ Modified: stable/8/lib/libc/stdlib/strtonum.3 Modified: stable/8/lib/libc/stdlib/strtonum.3 ============================================================================== --- stable/8/lib/libc/stdlib/strtonum.3 Tue Oct 26 15:48:03 2010 (r214378) +++ stable/8/lib/libc/stdlib/strtonum.3 Tue Oct 26 16:04:23 2010 (r214379) @@ -12,7 +12,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.\" $OpenBSD: strtonum.3,v 1.12 2005/10/26 11:37:58 jmc Exp $ +.\" $OpenBSD: strtonum.3,v 1.13 2006/04/25 05:15:42 tedu Exp $ .\" $FreeBSD$ .\" .Dd April 29, 2004 @@ -23,7 +23,6 @@ .Nd "reliably convert string value to an integer" .Sh SYNOPSIS .In stdlib.h -.In limits.h .Ft long long .Fo strtonum .Fa "const char *nptr" From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 17:30:34 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E850F1065672; Tue, 26 Oct 2010 17:30:34 +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 D65138FC14; Tue, 26 Oct 2010 17:30: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 o9QHUYf1057524; Tue, 26 Oct 2010 17:30:34 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QHUYYI057521; Tue, 26 Oct 2010 17:30:34 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201010261730.o9QHUYYI057521@svn.freebsd.org> From: Bernhard Schmidt Date: Tue, 26 Oct 2010 17:30:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214382 - stable/8/sys/dev/iwi X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 17:30:35 -0000 Author: bschmidt Date: Tue Oct 26 17:30:34 2010 New Revision: 214382 URL: http://svn.freebsd.org/changeset/base/214382 Log: MFC r213729: Fix monitor mode which is implemented by doing a firmware scan. This is a port from stable/6, seems like the code got lost during the background scan changes in r170530. Modified: stable/8/sys/dev/iwi/if_iwi.c stable/8/sys/dev/iwi/if_iwivar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/iwi/if_iwi.c ============================================================================== --- stable/8/sys/dev/iwi/if_iwi.c Tue Oct 26 16:49:18 2010 (r214381) +++ stable/8/sys/dev/iwi/if_iwi.c Tue Oct 26 17:30:34 2010 (r214382) @@ -180,6 +180,7 @@ static void iwi_release_fw_dma(struct iw static int iwi_config(struct iwi_softc *); static int iwi_get_firmware(struct iwi_softc *, enum ieee80211_opmode); static void iwi_put_firmware(struct iwi_softc *); +static void iwi_monitor_scan(void *, int); static int iwi_scanchan(struct iwi_softc *, unsigned long, int); static void iwi_scan_start(struct ieee80211com *); static void iwi_scan_end(struct ieee80211com *); @@ -292,6 +293,7 @@ iwi_attach(device_t dev) TASK_INIT(&sc->sc_restarttask, 0, iwi_restart, sc); TASK_INIT(&sc->sc_disassoctask, 0, iwi_disassoc, sc); TASK_INIT(&sc->sc_wmetask, 0, iwi_update_wme, sc); + TASK_INIT(&sc->sc_monitortask, 0, iwi_monitor_scan, sc); callout_init_mtx(&sc->sc_wdtimer, &sc->sc_mtx, 0); callout_init_mtx(&sc->sc_rftimer, &sc->sc_mtx, 0); @@ -460,6 +462,7 @@ iwi_detach(device_t dev) ieee80211_draintask(ic, &sc->sc_radiofftask); ieee80211_draintask(ic, &sc->sc_restarttask); ieee80211_draintask(ic, &sc->sc_disassoctask); + ieee80211_draintask(ic, &sc->sc_monitortask); iwi_stop(sc); @@ -988,7 +991,8 @@ iwi_newstate(struct ieee80211vap *vap, e * This is all totally bogus and needs to be redone. */ iwi_auth_and_assoc(sc, vap); - } + } else if (vap->iv_opmode == IEEE80211_M_MONITOR) + ieee80211_runtask(ic, &sc->sc_monitortask); break; case IEEE80211_S_ASSOC: /* @@ -1407,6 +1411,18 @@ iwi_notification_intr(struct iwi_softc * IWI_STATE_END(sc, IWI_FW_SCANNING); + /* + * Monitor mode works by doing a passive scan to set + * the channel and enable rx. Because we don't want + * to abort a scan lest the firmware crash we scan + * for a short period of time and automatically restart + * the scan when notified the sweep has completed. + */ + if (vap->iv_opmode == IEEE80211_M_MONITOR) { + ieee80211_runtask(ic, &sc->sc_monitortask); + break; + } + if (scan->status == IWI_SCAN_COMPLETED) { /* NB: don't need to defer, net80211 does it for us */ ieee80211_scan_next(vap); @@ -2557,6 +2573,11 @@ iwi_config(struct iwi_softc *sc) config.answer_pbreq = (ic->ic_opmode == IEEE80211_M_IBSS) ? 1 : 0; config.disable_unicast_decryption = 1; config.disable_multicast_decryption = 1; + if (ic->ic_opmode == IEEE80211_M_MONITOR) { + config.allow_invalid_frames = 1; + config.allow_beacon_and_probe_resp = 1; + config.allow_mgt = 1; + } DPRINTF(("Configuring adapter\n")); error = iwi_cmd(sc, IWI_CMD_SET_CONFIG, &config, sizeof config); if (error != 0) @@ -2642,6 +2663,17 @@ scan_band(const struct ieee80211_channel return IEEE80211_IS_CHAN_5GHZ(c) ? IWI_CHAN_5GHZ : IWI_CHAN_2GHZ; } +static void +iwi_monitor_scan(void *arg, int npending) +{ + struct iwi_softc *sc = arg; + IWI_LOCK_DECL; + + IWI_LOCK(sc); + (void) iwi_scanchan(sc, 2000, 0); + IWI_UNLOCK(sc); +} + /* * Start a scan on the current channel or all channels. */ Modified: stable/8/sys/dev/iwi/if_iwivar.h ============================================================================== --- stable/8/sys/dev/iwi/if_iwivar.h Tue Oct 26 16:49:18 2010 (r214381) +++ stable/8/sys/dev/iwi/if_iwivar.h Tue Oct 26 17:30:34 2010 (r214382) @@ -193,6 +193,7 @@ struct iwi_softc { struct task sc_restarttask; /* restart adapter processing */ struct task sc_disassoctask; struct task sc_wmetask; /* set wme parameters */ + struct task sc_monitortask; unsigned int sc_softled : 1, /* enable LED gpio status */ sc_ledstate: 1, /* LED on/off state */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 17:38:46 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 376C71065673; Tue, 26 Oct 2010 17:38: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 25C218FC1A; Tue, 26 Oct 2010 17:38: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 o9QHckd7058042; Tue, 26 Oct 2010 17:38:46 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QHckhX058040; Tue, 26 Oct 2010 17:38:46 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201010261738.o9QHckhX058040@svn.freebsd.org> From: Bernhard Schmidt Date: Tue, 26 Oct 2010 17:38:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214384 - stable/8/sys/dev/if_ndis X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 17:38:46 -0000 Author: bschmidt Date: Tue Oct 26 17:38:45 2010 New Revision: 214384 URL: http://svn.freebsd.org/changeset/base/214384 Log: MFC r214070: There is no reason to call rt_ifmsg(), remove it. Submitted by: Paul B Mahol Modified: stable/8/sys/dev/if_ndis/if_ndis.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/if_ndis/if_ndis.c ============================================================================== --- stable/8/sys/dev/if_ndis/if_ndis.c Tue Oct 26 17:31:46 2010 (r214383) +++ stable/8/sys/dev/if_ndis/if_ndis.c Tue Oct 26 17:38:45 2010 (r214384) @@ -1671,10 +1671,6 @@ ndis_linksts_done(adapter) break; } - /* Notify possible listners of interface change. */ - - rt_ifmsg(ifp); - return; } From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 18:56:56 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38113106564A; Tue, 26 Oct 2010 18:56:56 +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 264F58FC0A; Tue, 26 Oct 2010 18:56: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 o9QIuu9s062273; Tue, 26 Oct 2010 18:56:56 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QIuul3062271; Tue, 26 Oct 2010 18:56:56 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201010261856.o9QIuul3062271@svn.freebsd.org> From: Randall Stewart Date: Tue, 26 Oct 2010 18:56:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214388 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 18:56:56 -0000 Author: rrs Date: Tue Oct 26 18:56:55 2010 New Revision: 214388 URL: http://svn.freebsd.org/changeset/base/214388 Log: MFC of 209644 Log is: Fix a bug that will cause a panic. Basically a read-lock is being called to check the vtag-timewait cache. Then in two cases (where a vtag is bad i.e. in the time-wait state) the write-unlokc is called NOT the read-unlock. Under conditions where lots of associations are coming and going this willc ause the system to panic with invariants on. Modified: stable/8/sys/netinet/sctp_pcb.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Tue Oct 26 18:32:51 2010 (r214387) +++ stable/8/sys/netinet/sctp_pcb.c Tue Oct 26 18:56:55 2010 (r214388) @@ -6499,7 +6499,7 @@ sctp_is_vtag_good(struct sctp_inpcb *inp continue; } /* Its a used tag set */ - SCTP_INP_INFO_WUNLOCK(); + SCTP_INP_INFO_RUNLOCK(); return (0); } } @@ -6528,7 +6528,7 @@ skip_vtag_check: (twait_block->vtag_block[i].lport == lport) && (twait_block->vtag_block[i].rport == rport)) { /* Bad tag, sorry :< */ - SCTP_INP_INFO_WUNLOCK(); + SCTP_INP_INFO_RUNLOCK(); return (0); } } From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 18:59:36 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3E9E1065693; Tue, 26 Oct 2010 18:59:36 +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 A81398FC0A; Tue, 26 Oct 2010 18:59: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 o9QIxaRo062504; Tue, 26 Oct 2010 18:59:36 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QIxaJZ062502; Tue, 26 Oct 2010 18:59:36 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201010261859.o9QIxaJZ062502@svn.freebsd.org> From: Randall Stewart Date: Tue, 26 Oct 2010 18:59:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214389 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 18:59:36 -0000 Author: rrs Date: Tue Oct 26 18:59:36 2010 New Revision: 214389 URL: http://svn.freebsd.org/changeset/base/214389 Log: MFC of 209663 This fixes a crash in SCTP. It was possible to have a large number of packets queued to a crashing process. In a specific case you may get 2 ABORT's back (from say two packets in flight). If the aborts happened to be processed at the same time its possible to have one free the association while the other is trying to report all the outbound packets. When this occured it could lead to a crash. Modified: stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Tue Oct 26 18:56:55 2010 (r214388) +++ stable/8/sys/netinet/sctputil.c Tue Oct 26 18:59:36 2010 (r214389) @@ -3691,6 +3691,10 @@ sctp_report_all_outbound(struct sctp_tcb if (stcb == NULL) { return; } + if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { + /* already being freed */ + return; + } if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) { @@ -3750,11 +3754,13 @@ sctp_report_all_outbound(struct sctp_tcb stcb->asoc.stream_queue_cnt--; TAILQ_REMOVE(&outs->outqueue, sp, next); sctp_free_spbufspace(stcb, asoc, sp); - sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb, - SCTP_NOTIFY_DATAGRAM_UNSENT, (void *)sp, so_locked); if (sp->data) { - sctp_m_freem(sp->data); - sp->data = NULL; + sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb, + SCTP_NOTIFY_DATAGRAM_UNSENT, (void *)sp, so_locked); + if (sp->data) { + sctp_m_freem(sp->data); + sp->data = NULL; + } } if (sp->net) sctp_free_remote_addr(sp->net); From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 19:01:56 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A110A1065673; Tue, 26 Oct 2010 19:01:56 +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 8F8728FC15; Tue, 26 Oct 2010 19:01: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 o9QJ1uYe062752; Tue, 26 Oct 2010 19:01:56 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QJ1uh2062750; Tue, 26 Oct 2010 19:01:56 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201010261901.o9QJ1uh2062750@svn.freebsd.org> From: Randall Stewart Date: Tue, 26 Oct 2010 19:01:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214391 - stable/8/lib/libc/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 19:01:56 -0000 Author: rrs Date: Tue Oct 26 19:01:56 2010 New Revision: 214391 URL: http://svn.freebsd.org/changeset/base/214391 Log: MFC: 209760 If a user calls sctp_sendx() with a NULL sinfo we will crash. Instead we should provide our own temp structure to use internally. Modified: stable/8/lib/libc/net/sctp_sys_calls.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/locale/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/sys/ (props changed) Modified: stable/8/lib/libc/net/sctp_sys_calls.c ============================================================================== --- stable/8/lib/libc/net/sctp_sys_calls.c Tue Oct 26 18:59:50 2010 (r214390) +++ stable/8/lib/libc/net/sctp_sys_calls.c Tue Oct 26 19:01:56 2010 (r214391) @@ -724,6 +724,7 @@ sctp_sendx(int sd, const void *msg, size struct sctp_sndrcvinfo *sinfo, int flags) { + struct sctp_sndrcvinfo __sinfo; ssize_t ret; int i, cnt, *aa, saved_errno; char *buf; @@ -790,6 +791,10 @@ sctp_sendx(int sd, const void *msg, size return (ret); } continue_send: + if (sinfo == NULL) { + sinfo = &__sinfo; + memset(&__sinfo, 0, sizeof(__sinfo)); + } sinfo->sinfo_assoc_id = sctp_getassocid(sd, addrs); if (sinfo->sinfo_assoc_id == 0) { printf("Huh, can't get associd? TSNH!\n"); From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 19:04:06 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22CD4106566B; Tue, 26 Oct 2010 19:04:06 +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 EAE328FC0C; Tue, 26 Oct 2010 19:04: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 o9QJ45uL062951; Tue, 26 Oct 2010 19:04:05 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QJ45DI062949; Tue, 26 Oct 2010 19:04:05 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201010261904.o9QJ45DI062949@svn.freebsd.org> From: Randall Stewart Date: Tue, 26 Oct 2010 19:04:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214392 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 19:04:06 -0000 Author: rrs Date: Tue Oct 26 19:04:05 2010 New Revision: 214392 URL: http://svn.freebsd.org/changeset/base/214392 Log: MFC:210493 When counting the number of chunks in the retransmission queue to validate the retran count, we need to include the chunks in the control send queue too. Otherwise the count will not match and you will get the invarient warning if invarients are on. Modified: stable/8/sys/netinet/sctp_timer.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_timer.c ============================================================================== --- stable/8/sys/netinet/sctp_timer.c Tue Oct 26 19:01:56 2010 (r214391) +++ stable/8/sys/netinet/sctp_timer.c Tue Oct 26 19:04:05 2010 (r214392) @@ -870,6 +870,26 @@ start_again: } #endif *num_marked = num_mk; + /* + * Now check for a ECN Echo that may be stranded And include the + * cnt_mk'd to have all resends in the control queue. + */ + TAILQ_FOREACH(chk, &stcb->asoc.control_send_queue, sctp_next) { + if (chk->sent == SCTP_DATAGRAM_RESEND) { + cnt_mk++; + } + if ((chk->whoTo == net) && + (chk->rec.chunk_id.id == SCTP_ECN_ECHO)) { + sctp_free_remote_addr(chk->whoTo); + chk->whoTo = alt; + if (chk->sent != SCTP_DATAGRAM_RESEND) { + chk->sent = SCTP_DATAGRAM_RESEND; + sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt); + cnt_mk++; + } + atomic_add_int(&alt->ref_count, 1); + } + } if ((stcb->asoc.sent_queue_retran_cnt == 0) && (could_be_sent)) { /* fix it so we retransmit the highest acked anyway */ sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt); @@ -885,19 +905,6 @@ start_again: stcb->asoc.sent_queue_retran_cnt = cnt_mk; #endif } - /* Now check for a ECN Echo that may be stranded */ - TAILQ_FOREACH(chk, &stcb->asoc.control_send_queue, sctp_next) { - if ((chk->whoTo == net) && - (chk->rec.chunk_id.id == SCTP_ECN_ECHO)) { - sctp_free_remote_addr(chk->whoTo); - chk->whoTo = alt; - if (chk->sent != SCTP_DATAGRAM_RESEND) { - chk->sent = SCTP_DATAGRAM_RESEND; - sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt); - } - atomic_add_int(&alt->ref_count, 1); - } - } if (audit_tf) { SCTPDBG(SCTP_DEBUG_TIMER4, "Audit total flight due to negative value net:%p\n", From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 19:06:32 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05EED1065675; Tue, 26 Oct 2010 19:06:32 +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 CE40B8FC08; Tue, 26 Oct 2010 19:06: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 o9QJ6Vs5063132; Tue, 26 Oct 2010 19:06:31 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QJ6V5D063130; Tue, 26 Oct 2010 19:06:31 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201010261906.o9QJ6V5D063130@svn.freebsd.org> From: Randall Stewart Date: Tue, 26 Oct 2010 19:06:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214393 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 19:06:32 -0000 Author: rrs Date: Tue Oct 26 19:06:31 2010 New Revision: 214393 URL: http://svn.freebsd.org/changeset/base/214393 Log: MFC:210494 Make sure that we report chunks if a socket still exists that were not sent. In either case carefully remove the data if it does not get taken by the reporting routines. Modified: stable/8/sys/netinet/sctp_pcb.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Tue Oct 26 19:04:05 2010 (r214392) +++ stable/8/sys/netinet/sctp_pcb.c Tue Oct 26 19:06:31 2010 (r214393) @@ -4830,9 +4830,17 @@ sctp_free_assoc(struct sctp_inpcb *inp, while (sp) { TAILQ_REMOVE(&outs->outqueue, sp, next); if (sp->data) { - sctp_m_freem(sp->data); - sp->data = NULL; - sp->tail_mbuf = NULL; + if (so) { + /* Still an open socket - report */ + sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb, + SCTP_NOTIFY_DATAGRAM_UNSENT, + (void *)sp, 0); + } + if (sp->data) { + sctp_m_freem(sp->data); + sp->data = NULL; + sp->tail_mbuf = NULL; + } } sctp_free_remote_addr(sp->net); sctp_free_spbufspace(stcb, asoc, sp); @@ -4892,8 +4900,15 @@ sctp_free_assoc(struct sctp_inpcb *inp, while (chk) { TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next); if (chk->data) { - sctp_m_freem(chk->data); - chk->data = NULL; + if (so) { + /* Still a socket? */ + sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, + SCTP_NOTIFY_DATAGRAM_UNSENT, chk, 0); + } + if (chk->data) { + sctp_m_freem(chk->data); + chk->data = NULL; + } } if (chk->holds_key_ref) sctp_auth_key_release(stcb, chk->auth_keyid); @@ -4917,8 +4932,15 @@ sctp_free_assoc(struct sctp_inpcb *inp, while (chk) { TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next); if (chk->data) { - sctp_m_freem(chk->data); - chk->data = NULL; + if (so) { + /* Still a socket? */ + sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, + SCTP_NOTIFY_DATAGRAM_SENT, chk, 0); + } + if (chk->data) { + sctp_m_freem(chk->data); + chk->data = NULL; + } } if (chk->holds_key_ref) sctp_auth_key_release(stcb, chk->auth_keyid); From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 19:08:26 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 741141065694; Tue, 26 Oct 2010 19:08:26 +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 61C2D8FC1E; Tue, 26 Oct 2010 19: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 o9QJ8Qch063346; Tue, 26 Oct 2010 19:08:26 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QJ8QOL063341; Tue, 26 Oct 2010 19:08:26 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201010261908.o9QJ8QOL063341@svn.freebsd.org> From: Randall Stewart Date: Tue, 26 Oct 2010 19:08:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214394 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 19:08:26 -0000 Author: rrs Date: Tue Oct 26 19:08:26 2010 New Revision: 214394 URL: http://svn.freebsd.org/changeset/base/214394 Log: MFC:210599 PR SCTP Bugs. Basically a full sized frame of PR SCTP FWD-TSN's would not be sent and thus cause a stalled connection. Also the rwnd Calculation was also off on the receiver side for PR-SCTP. Modified: stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_structs.h stable/8/sys/netinet/sctp_timer.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Tue Oct 26 19:06:31 2010 (r214393) +++ stable/8/sys/netinet/sctp_indata.c Tue Oct 26 19:08:26 2010 (r214394) @@ -91,8 +91,10 @@ sctp_calc_rwnd(struct sctp_tcb *stcb, st * take out what has NOT been put on socket queue and we yet hold * for putting up. */ - calc = sctp_sbspace_sub(calc, (uint32_t) asoc->size_on_reasm_queue); - calc = sctp_sbspace_sub(calc, (uint32_t) asoc->size_on_all_streams); + calc = sctp_sbspace_sub(calc, (uint32_t) (asoc->size_on_reasm_queue + + asoc->cnt_on_reasm_queue * MSIZE)); + calc = sctp_sbspace_sub(calc, (uint32_t) (asoc->size_on_all_streams + + asoc->cnt_on_all_streams * MSIZE)); if (calc == 0) { /* out of space */ @@ -3322,6 +3324,10 @@ sctp_strike_gap_ack_chunks(struct sctp_t if (tp1->sent >= SCTP_DATAGRAM_RESEND) { /* either a RESEND, ACKED, or MARKED */ /* skip */ + if (tp1->sent == SCTP_FORWARD_TSN_SKIP) { + /* Continue strikin FWD-TSN chunks */ + tp1->rec.data.fwd_tsn_cnt++; + } tp1 = TAILQ_NEXT(tp1, sctp_next); continue; } @@ -3707,7 +3713,6 @@ sctp_try_advance_peer_ack_point(struct s tp1 = TAILQ_FIRST(&asoc->sent_queue); while (tp1) { if (tp1->sent != SCTP_FORWARD_TSN_SKIP && - tp1->sent != SCTP_DATAGRAM_ACKED && tp1->sent != SCTP_DATAGRAM_RESEND) { /* no chance to advance, out of here */ break; @@ -3763,8 +3768,7 @@ sctp_try_advance_peer_ack_point(struct s * the chunk, advance our peer ack point and we can check * the next chunk. */ - if ((tp1->sent == SCTP_FORWARD_TSN_SKIP) || - (tp1->sent == SCTP_DATAGRAM_ACKED)) { + if (tp1->sent == SCTP_FORWARD_TSN_SKIP) { /* advance PeerAckPoint goes forward */ if (compare_with_wrap(tp1->rec.data.TSN_seq, asoc->advanced_peer_ack_point, @@ -3905,7 +3909,7 @@ sctp_express_handle_sack(struct sctp_tcb } else if (asoc->last_acked_seq == cumack) { /* Window update sack */ asoc->peers_rwnd = sctp_sbspace_sub(rwnd, - (uint32_t) (asoc->total_flight + (asoc->sent_queue_cnt * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)))); + (uint32_t) (asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)))); if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) { /* SWS sender side engages */ asoc->peers_rwnd = 0; @@ -4189,7 +4193,7 @@ sctp_express_handle_sack(struct sctp_tcb } /* RWND update */ asoc->peers_rwnd = sctp_sbspace_sub(rwnd, - (uint32_t) (asoc->total_flight + (asoc->sent_queue_cnt * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)))); + (uint32_t) (asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)))); if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) { /* SWS sender side engages */ asoc->peers_rwnd = 0; @@ -4404,10 +4408,8 @@ again: asoc->nonce_resync_tsn = asoc->advanced_peer_ack_point; } else if (lchk) { /* try to FR fwd-tsn's that get lost too */ - lchk->rec.data.fwd_tsn_cnt++; - if (lchk->rec.data.fwd_tsn_cnt > 3) { + if (lchk->rec.data.fwd_tsn_cnt >= 3) { send_forward_tsn(stcb, asoc); - lchk->rec.data.fwd_tsn_cnt = 0; } } } @@ -5188,10 +5190,10 @@ done_with_it: /* Adjust and set the new rwnd value */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_RWND_ENABLE) { sctp_log_rwnd_set(SCTP_SET_PEER_RWND_VIA_SACK, - asoc->peers_rwnd, asoc->total_flight, (asoc->sent_queue_cnt * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)), a_rwnd); + asoc->peers_rwnd, asoc->total_flight, (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)), a_rwnd); } asoc->peers_rwnd = sctp_sbspace_sub(a_rwnd, - (uint32_t) (asoc->total_flight + (asoc->sent_queue_cnt * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)))); + (uint32_t) (asoc->total_flight + (asoc->total_flight_count * SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)))); if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) { /* SWS sender side engages */ asoc->peers_rwnd = 0; @@ -5314,6 +5316,7 @@ again: } if (compare_with_wrap(asoc->advanced_peer_ack_point, old_adv_peer_ack_point, MAX_TSN)) { + send_forward_tsn(stcb, asoc); /* * ECN Nonce: Disable Nonce Sum check when @@ -5323,10 +5326,8 @@ again: asoc->nonce_resync_tsn = asoc->advanced_peer_ack_point; } else if (lchk) { /* try to FR fwd-tsn's that get lost too */ - lchk->rec.data.fwd_tsn_cnt++; - if (lchk->rec.data.fwd_tsn_cnt > 3) { + if (lchk->rec.data.fwd_tsn_cnt >= 3) { send_forward_tsn(stcb, asoc); - lchk->rec.data.fwd_tsn_cnt = 0; } } } Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Tue Oct 26 19:06:31 2010 (r214393) +++ stable/8/sys/netinet/sctp_output.c Tue Oct 26 19:08:26 2010 (r214394) @@ -6580,6 +6580,8 @@ sctp_clean_up_ctl(struct sctp_tcb *stcb, chk->data = NULL; } asoc->ctrl_queue_cnt--; + if (chk->rec.chunk_id.id == SCTP_FORWARD_CUM_TSN) + asoc->fwd_tsn_cnt--; sctp_free_a_chunk(stcb, chk); } else if (chk->rec.chunk_id.id == SCTP_STREAM_RESET) { /* special handling, we must look into the param */ @@ -7800,7 +7802,7 @@ again_one_more_time: } else omtu = 0; /* Here we do NOT factor the r_mtu */ - if ((chk->send_size < (int)(mtu - omtu)) || + if ((chk->send_size <= (int)(mtu - omtu)) || (chk->flags & CHUNK_FLAGS_FRAGMENT_OK)) { /* * We probably should glom the mbuf chain @@ -9705,6 +9707,7 @@ send_forward_tsn(struct sctp_tcb *stcb, if (chk == NULL) { return; } + asoc->fwd_tsn_cnt++; chk->copy_by_ref = 0; chk->rec.chunk_id.id = SCTP_FORWARD_CUM_TSN; chk->rec.chunk_id.can_take_data = 0; @@ -9736,8 +9739,8 @@ sctp_fill_in_rest: unsigned int cnt_of_skipped = 0; TAILQ_FOREACH(at, &asoc->sent_queue, sctp_next) { - if ((at->sent != SCTP_FORWARD_TSN_SKIP) && - (at->sent != SCTP_DATAGRAM_ACKED)) { + if ((at->sent != SCTP_FORWARD_TSN_SKIP) /* && (at->sent != + SCTP_DATAGRAM_ACKED) */ ) { /* no more to look at */ break; } Modified: stable/8/sys/netinet/sctp_structs.h ============================================================================== --- stable/8/sys/netinet/sctp_structs.h Tue Oct 26 19:06:31 2010 (r214393) +++ stable/8/sys/netinet/sctp_structs.h Tue Oct 26 19:08:26 2010 (r214394) @@ -869,6 +869,7 @@ struct sctp_association { unsigned int size_on_reasm_queue; unsigned int cnt_on_reasm_queue; + unsigned int fwd_tsn_cnt; /* amount of data (bytes) currently in flight (on all destinations) */ unsigned int total_flight; /* Total book size in flight */ Modified: stable/8/sys/netinet/sctp_timer.c ============================================================================== --- stable/8/sys/netinet/sctp_timer.c Tue Oct 26 19:06:31 2010 (r214393) +++ stable/8/sys/netinet/sctp_timer.c Tue Oct 26 19:08:26 2010 (r214394) @@ -545,7 +545,7 @@ static void sctp_backoff_on_timeout(struct sctp_tcb *stcb, struct sctp_nets *net, int win_probe, - int num_marked) + int num_marked, int num_abandoned) { if (net->RTO == 0) { net->RTO = stcb->asoc.minrto; @@ -554,7 +554,7 @@ sctp_backoff_on_timeout(struct sctp_tcb if (net->RTO > stcb->asoc.maxrto) { net->RTO = stcb->asoc.maxrto; } - if ((win_probe == 0) && num_marked) { + if ((win_probe == 0) && (num_marked || num_abandoned)) { /* We don't apply penalty to window probe scenarios */ /* JRS - Use the congestion control given in the CC module */ stcb->asoc.cc_functions.sctp_cwnd_update_after_timeout(stcb, net); @@ -612,7 +612,8 @@ sctp_mark_all_for_resend(struct sctp_tcb struct sctp_nets *net, struct sctp_nets *alt, int window_probe, - int *num_marked) + int *num_marked, + int *num_abandoned) { /* @@ -621,10 +622,11 @@ sctp_mark_all_for_resend(struct sctp_tcb * We only mark chunks that have been outstanding long enough to * have received feed-back. */ - struct sctp_tmit_chunk *chk, *tp2, *could_be_sent = NULL; + struct sctp_tmit_chunk *chk, *tp2; struct sctp_nets *lnets; struct timeval now, min_wait, tv; int cur_rtt; + int cnt_abandoned; int audit_tf, num_mk, fir; unsigned int cnt_mk; uint32_t orig_flight, orig_tf; @@ -680,6 +682,7 @@ sctp_mark_all_for_resend(struct sctp_tcb net->fast_retran_ip = 0; /* Now on to each chunk */ + cnt_abandoned = 0; num_mk = cnt_mk = 0; tsnfirst = tsnlast = 0; #ifndef INVARIANTS @@ -768,6 +771,7 @@ start_again: chk, (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT), SCTP_SO_NOT_LOCKED); + cnt_abandoned++; } continue; } @@ -780,6 +784,7 @@ start_again: chk, (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT), SCTP_SO_NOT_LOCKED); + cnt_abandoned++; } continue; } @@ -841,9 +846,11 @@ start_again: if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 1) { chk->no_fr_allowed = 1; } +#ifdef THIS_SHOULD_NOT_BE_DONE } else if (chk->sent == SCTP_DATAGRAM_ACKED) { /* remember highest acked one */ could_be_sent = chk; +#endif } if (chk->sent == SCTP_DATAGRAM_RESEND) { cnt_mk++; @@ -870,6 +877,7 @@ start_again: } #endif *num_marked = num_mk; + *num_abandoned = cnt_abandoned; /* * Now check for a ECN Echo that may be stranded And include the * cnt_mk'd to have all resends in the control queue. @@ -890,12 +898,14 @@ start_again: atomic_add_int(&alt->ref_count, 1); } } +#ifdef THIS_SHOULD_NOT_BE_DONE if ((stcb->asoc.sent_queue_retran_cnt == 0) && (could_be_sent)) { /* fix it so we retransmit the highest acked anyway */ sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt); cnt_mk++; could_be_sent->sent = SCTP_DATAGRAM_RESEND; } +#endif if (stcb->asoc.sent_queue_retran_cnt != cnt_mk) { #ifdef INVARIANTS SCTP_PRINTF("Local Audit says there are %d for retran asoc cnt:%d we marked:%d this time\n", @@ -996,7 +1006,7 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, struct sctp_nets *net) { struct sctp_nets *alt; - int win_probe, num_mk; + int win_probe, num_mk, num_abandoned; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { sctp_log_fr(0, 0, 0, SCTP_FR_T3_TIMEOUT); @@ -1055,8 +1065,10 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, } else { /* CMT is OFF */ alt = sctp_find_alternate_net(stcb, net, 0); } - - (void)sctp_mark_all_for_resend(stcb, net, alt, win_probe, &num_mk); + num_mk = 0; + num_abandoned = 0; + (void)sctp_mark_all_for_resend(stcb, net, alt, win_probe, + &num_mk, &num_abandoned); /* FR Loss recovery just ended with the T3. */ stcb->asoc.fast_retran_loss_recovery = 0; @@ -1070,7 +1082,7 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, stcb->asoc.sat_t3_recovery_tsn = stcb->asoc.sending_seq; /* Backoff the timer and cwnd */ - sctp_backoff_on_timeout(stcb, net, win_probe, num_mk); + sctp_backoff_on_timeout(stcb, net, win_probe, num_mk, num_abandoned); if (win_probe == 0) { /* We don't do normal threshold management on window probes */ if (sctp_threshold_management(inp, stcb, net, @@ -1221,7 +1233,7 @@ sctp_t1init_timer(struct sctp_inpcb *inp return (1); } stcb->asoc.dropped_special_cnt = 0; - sctp_backoff_on_timeout(stcb, stcb->asoc.primary_destination, 1, 0); + sctp_backoff_on_timeout(stcb, stcb->asoc.primary_destination, 1, 0, 0); if (stcb->asoc.initial_init_rto_max < net->RTO) { net->RTO = stcb->asoc.initial_init_rto_max; } @@ -1302,7 +1314,7 @@ sctp_cookie_timer(struct sctp_inpcb *inp * an alternate */ stcb->asoc.dropped_special_cnt = 0; - sctp_backoff_on_timeout(stcb, cookie->whoTo, 1, 0); + sctp_backoff_on_timeout(stcb, cookie->whoTo, 1, 0, 0); alt = sctp_find_alternate_net(stcb, cookie->whoTo, 0); if (alt != cookie->whoTo) { sctp_free_remote_addr(cookie->whoTo); @@ -1347,7 +1359,7 @@ sctp_strreset_timer(struct sctp_inpcb *i * cleared theshold management now lets backoff the address & select * an alternate */ - sctp_backoff_on_timeout(stcb, strrst->whoTo, 1, 0); + sctp_backoff_on_timeout(stcb, strrst->whoTo, 1, 0, 0); alt = sctp_find_alternate_net(stcb, strrst->whoTo, 0); sctp_free_remote_addr(strrst->whoTo); strrst->whoTo = alt; @@ -1426,7 +1438,7 @@ sctp_asconf_timer(struct sctp_inpcb *inp * cleared threshold management, so now backoff the net and * select an alternate */ - sctp_backoff_on_timeout(stcb, asconf->whoTo, 1, 0); + sctp_backoff_on_timeout(stcb, asconf->whoTo, 1, 0, 0); alt = sctp_find_alternate_net(stcb, asconf->whoTo, 0); if (asconf->whoTo != alt) { sctp_free_remote_addr(asconf->whoTo); @@ -1643,7 +1655,7 @@ sctp_heartbeat_timer(struct sctp_inpcb * net->ro._s_addr = NULL; net->src_addr_selected = 0; } - sctp_backoff_on_timeout(stcb, net, 1, 0); + sctp_backoff_on_timeout(stcb, net, 1, 0, 0); } /* Zero PBA, if it needs it */ if (net->partial_bytes_acked) { From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 19:12:37 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A435106566B; Tue, 26 Oct 2010 19:12:37 +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 4E48F8FC16; Tue, 26 Oct 2010 19:12: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 o9QJCbbJ063725; Tue, 26 Oct 2010 19:12:37 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QJCbdq063723; Tue, 26 Oct 2010 19:12:37 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201010261912.o9QJCbdq063723@svn.freebsd.org> From: Randall Stewart Date: Tue, 26 Oct 2010 19:12:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214397 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 19:12:37 -0000 Author: rrs Date: Tue Oct 26 19:12:37 2010 New Revision: 214397 URL: http://svn.freebsd.org/changeset/base/214397 Log: MFC:210600 Fix the comment block that has the nice table to really have the nice table :-) Modified: stable/8/sys/netinet/sctp_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Tue Oct 26 19:11:09 2010 (r214396) +++ stable/8/sys/netinet/sctp_output.c Tue Oct 26 19:12:37 2010 (r214397) @@ -2186,21 +2186,31 @@ sctp_is_ifa_addr_preferred(struct sctp_i /* dest_is_priv is true if destination is a private address */ /* dest_is_loop is true if destination is a loopback addresses */ - /* + /** * Here we determine if its a preferred address. A preferred address * means it is the same scope or higher scope then the destination. * L = loopback, P = private, G = global - * ----------------------------------------- src | dest | result - * ---------------------------------------- L | L | yes - * ----------------------------------------- P | L | - * yes-v4 no-v6 ----------------------------------------- G | - * L | yes-v4 no-v6 ----------------------------------------- L - * | P | no ----------------------------------------- P | - * P | yes ----------------------------------------- G | - * P | no ----------------------------------------- L | G - * | no ----------------------------------------- P | G | - * no ----------------------------------------- G | G | - * yes ----------------------------------------- + * ----------------------------------------- + * src | dest | result + * ---------------------------------------- + * L | L | yes + * ----------------------------------------- + * P | L | yes-v4 no-v6 + * ----------------------------------------- + * G | L | yes-v4 no-v6 + * ----------------------------------------- + * L | P | no + * ----------------------------------------- + * P | P | yes + * ----------------------------------------- + * G | P | no + * ----------------------------------------- + * L | G | no + * ----------------------------------------- + * P | G | no + * ----------------------------------------- + * G | G | yes + * ----------------------------------------- */ if (ifa->address.sa.sa_family != fam) { From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 19:56:54 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29C3E1065673; Tue, 26 Oct 2010 19:56:54 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 17C038FC1B; Tue, 26 Oct 2010 19:56: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 o9QJur0e066235; Tue, 26 Oct 2010 19:56:53 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QJurxq066233; Tue, 26 Oct 2010 19:56:53 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201010261956.o9QJurxq066233@svn.freebsd.org> From: Rui Paulo Date: Tue, 26 Oct 2010 19:56:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214398 - stable/8/sys/modules/wlan X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 19:56:54 -0000 Author: rpaulo Date: Tue Oct 26 19:56:53 2010 New Revision: 214398 URL: http://svn.freebsd.org/changeset/base/214398 Log: MFC r214056: Revert r206418 Modified: stable/8/sys/modules/wlan/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/modules/wlan/Makefile ============================================================================== --- stable/8/sys/modules/wlan/Makefile Tue Oct 26 19:12:37 2010 (r214397) +++ stable/8/sys/modules/wlan/Makefile Tue Oct 26 19:56:53 2010 (r214398) @@ -3,13 +3,13 @@ .PATH: ${.CURDIR}/../../net80211 KMOD= wlan -SRCS= ieee80211.c ieee80211_action.c ieee80211_ageq.c ieee80211_amrr.c \ +SRCS= ieee80211.c ieee80211_action.c ieee80211_ageq.c \ ieee80211_crypto.c ieee80211_crypto_none.c ieee80211_dfs.c \ ieee80211_freebsd.c ieee80211_input.c ieee80211_ioctl.c \ ieee80211_mesh.c ieee80211_node.c ieee80211_output.c ieee80211_phy.c \ ieee80211_power.c ieee80211_proto.c ieee80211_scan.c \ ieee80211_scan_sta.c ieee80211_radiotap.c ieee80211_ratectl.c \ - ieee80211_regdomain.c ieee80211_rssadapt.c \ + ieee80211_regdomain.c \ ieee80211_ht.c ieee80211_hwmp.c ieee80211_adhoc.c ieee80211_hostap.c \ ieee80211_monitor.c ieee80211_sta.c ieee80211_wds.c ieee80211_ddb.c SRCS+= bus_if.h device_if.h opt_inet.h opt_inet6.h opt_ipx.h opt_wlan.h \ From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 20:23:29 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 768801065670; Tue, 26 Oct 2010 20:23:29 +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 630528FC08; Tue, 26 Oct 2010 20:23: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 o9QKNT7i067764; Tue, 26 Oct 2010 20:23:29 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QKNTlN067758; Tue, 26 Oct 2010 20:23:29 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201010262023.o9QKNTlN067758@svn.freebsd.org> From: Bernhard Schmidt Date: Tue, 26 Oct 2010 20:23:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214399 - in stable/8/sys: conf modules/wlan net80211 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 20:23:29 -0000 Author: bschmidt Date: Tue Oct 26 20:23:29 2010 New Revision: 214399 URL: http://svn.freebsd.org/changeset/base/214399 Log: MFC r214069: Fix an undefined behaviour if the desired ratectl algo is not available. This can happen if the algos are built as modules but are not loaded. If the selected ratectl algo is not available, try to load it (The load module functions does nothing currently). Add a dummy ratectl algo which always selects the first available rate. Use that one if the desired algo is not available. Added: stable/8/sys/net80211/ieee80211_ratectl_none.c - copied unchanged from r214069, head/sys/net80211/ieee80211_ratectl_none.c Modified: stable/8/sys/conf/files stable/8/sys/modules/wlan/Makefile stable/8/sys/net80211/ieee80211_ratectl.c stable/8/sys/net80211/ieee80211_ratectl.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Tue Oct 26 19:56:53 2010 (r214398) +++ stable/8/sys/conf/files Tue Oct 26 20:23:29 2010 (r214399) @@ -2395,6 +2395,7 @@ net80211/ieee80211_power.c optional wlan net80211/ieee80211_proto.c optional wlan net80211/ieee80211_radiotap.c optional wlan net80211/ieee80211_ratectl.c optional wlan +net80211/ieee80211_ratectl_none.c optional wlan net80211/ieee80211_regdomain.c optional wlan net80211/ieee80211_rssadapt.c optional wlan wlan_rssadapt net80211/ieee80211_scan.c optional wlan Modified: stable/8/sys/modules/wlan/Makefile ============================================================================== --- stable/8/sys/modules/wlan/Makefile Tue Oct 26 19:56:53 2010 (r214398) +++ stable/8/sys/modules/wlan/Makefile Tue Oct 26 20:23:29 2010 (r214399) @@ -9,7 +9,7 @@ SRCS= ieee80211.c ieee80211_action.c iee ieee80211_mesh.c ieee80211_node.c ieee80211_output.c ieee80211_phy.c \ ieee80211_power.c ieee80211_proto.c ieee80211_scan.c \ ieee80211_scan_sta.c ieee80211_radiotap.c ieee80211_ratectl.c \ - ieee80211_regdomain.c \ + ieee80211_ratectl_none.c ieee80211_regdomain.c \ ieee80211_ht.c ieee80211_hwmp.c ieee80211_adhoc.c ieee80211_hostap.c \ ieee80211_monitor.c ieee80211_sta.c ieee80211_wds.c ieee80211_ddb.c SRCS+= bus_if.h device_if.h opt_inet.h opt_inet6.h opt_ipx.h opt_wlan.h \ Modified: stable/8/sys/net80211/ieee80211_ratectl.c ============================================================================== --- stable/8/sys/net80211/ieee80211_ratectl.c Tue Oct 26 19:56:53 2010 (r214398) +++ stable/8/sys/net80211/ieee80211_ratectl.c Tue Oct 26 20:23:29 2010 (r214399) @@ -39,6 +39,14 @@ __FBSDID("$FreeBSD$"); static const struct ieee80211_ratectl *ratectls[IEEE80211_RATECTL_MAX]; +static const char *ratectl_modnames[IEEE80211_RATECTL_MAX] = { + [IEEE80211_RATECTL_AMRR] = "wlan_amrr", + [IEEE80211_RATECTL_RSSADAPT] = "wlan_rssadapt", + [IEEE80211_RATECTL_ONOE] = "wlan_onoe", + [IEEE80211_RATECTL_SAMPLE] = "wlan_sample", + [IEEE80211_RATECTL_NONE] = "wlan_none", +}; + MALLOC_DEFINE(M_80211_RATECTL, "80211ratectl", "802.11 rate control"); void @@ -62,5 +70,15 @@ ieee80211_ratectl_set(struct ieee80211va { if (type >= IEEE80211_RATECTL_MAX) return; + if (ratectls[type] == NULL) { + ieee80211_load_module(ratectl_modnames[type]); + if (ratectls[type] == NULL) { + IEEE80211_DPRINTF(vap, IEEE80211_MSG_RATECTL, + "%s: unable to load algo %u, module %s\n", + __func__, type, ratectl_modnames[type]); + vap->iv_rate = ratectls[IEEE80211_RATECTL_NONE]; + return; + } + } vap->iv_rate = ratectls[type]; } Modified: stable/8/sys/net80211/ieee80211_ratectl.h ============================================================================== --- stable/8/sys/net80211/ieee80211_ratectl.h Tue Oct 26 19:56:53 2010 (r214398) +++ stable/8/sys/net80211/ieee80211_ratectl.h Tue Oct 26 20:23:29 2010 (r214399) @@ -26,10 +26,11 @@ */ enum ieee80211_ratealgs { - IEEE80211_RATECTL_AMRR = 0, + IEEE80211_RATECTL_AMRR = 0, IEEE80211_RATECTL_RSSADAPT = 1, IEEE80211_RATECTL_ONOE = 2, IEEE80211_RATECTL_SAMPLE = 3, + IEEE80211_RATECTL_NONE = 4, IEEE80211_RATECTL_MAX }; Copied: stable/8/sys/net80211/ieee80211_ratectl_none.c (from r214069, head/sys/net80211/ieee80211_ratectl_none.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/net80211/ieee80211_ratectl_none.c Tue Oct 26 20:23:29 2010 (r214399, copy of r214069, head/sys/net80211/ieee80211_ratectl_none.c) @@ -0,0 +1,113 @@ +/*- + * Copyright (c) 2010 Bernhard Schmidt + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_wlan.h" + +#include +#include +#include +#include +#include + +#include +#include + +#ifdef INET +#include +#include +#endif + +#include +#include + +static void +none_init(struct ieee80211vap *vap) +{ +} + +static void +none_deinit(struct ieee80211vap *vap) +{ + free(vap->iv_rs, M_80211_RATECTL); +} + +static void +none_node_init(struct ieee80211_node *ni) +{ +} + +static void +none_node_deinit(struct ieee80211_node *ni) +{ +} + +static int +none_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg __unused) +{ + int rix = 0; + + ni->ni_txrate = ni->ni_rates.rs_rates[rix] & IEEE80211_RATE_VAL; + return rix; +} + +static void +none_tx_complete(const struct ieee80211vap *vap, + const struct ieee80211_node *ni, int ok, + void *arg1, void *arg2 __unused) +{ +} + +static void +none_tx_update(const struct ieee80211vap *vap, const struct ieee80211_node *ni, + void *arg1, void *arg2, void *arg3) +{ +} + +static void +none_setinterval(const struct ieee80211vap *vap, int msecs) +{ +} + +/* number of references from net80211 layer */ +static int nrefs = 0; + +static const struct ieee80211_ratectl none = { + .ir_name = "none", + .ir_attach = NULL, + .ir_detach = NULL, + .ir_init = none_init, + .ir_deinit = none_deinit, + .ir_node_init = none_node_init, + .ir_node_deinit = none_node_deinit, + .ir_rate = none_rate, + .ir_tx_complete = none_tx_complete, + .ir_tx_update = none_tx_update, + .ir_setinterval = none_setinterval, +}; +IEEE80211_RATECTL_MODULE(ratectl_none, 1); +IEEE80211_RATECTL_ALG(none, IEEE80211_RATECTL_NONE, none); From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 21:23:56 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51B7A1065672; Tue, 26 Oct 2010 21:23:56 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C9E68FC23; Tue, 26 Oct 2010 21:23: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 o9QLNuAg071319; Tue, 26 Oct 2010 21:23:56 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QLNutG071309; Tue, 26 Oct 2010 21:23:56 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010262123.o9QLNutG071309@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 26 Oct 2010 21:23:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214402 - in stable/8/sbin/geom: class/cache class/eli class/journal class/mirror class/nop class/sched class/stripe class/virstor core X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 21:23:56 -0000 Author: pjd Date: Tue Oct 26 21:23:55 2010 New Revision: 214402 URL: http://svn.freebsd.org/changeset/base/214402 Log: - Make it possible for default value to be const. - Default number is now also a string. Modified: stable/8/sbin/geom/class/cache/geom_cache.c stable/8/sbin/geom/class/eli/geom_eli.c stable/8/sbin/geom/class/journal/geom_journal.c stable/8/sbin/geom/class/mirror/geom_mirror.c stable/8/sbin/geom/class/nop/geom_nop.c stable/8/sbin/geom/class/sched/geom_sched.c stable/8/sbin/geom/class/stripe/geom_stripe.c stable/8/sbin/geom/class/virstor/geom_virstor.c stable/8/sbin/geom/core/geom.c Modified: stable/8/sbin/geom/class/cache/geom_cache.c ============================================================================== --- stable/8/sbin/geom/class/cache/geom_cache.c Tue Oct 26 21:22:55 2010 (r214401) +++ stable/8/sbin/geom/class/cache/geom_cache.c Tue Oct 26 21:23:55 2010 (r214402) @@ -42,10 +42,8 @@ __FBSDID("$FreeBSD$"); uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_CACHE_VERSION; -static intmax_t blocksize_label = 65536; -static intmax_t size_label = 100; -static intmax_t blocksize_configure = 0; -static intmax_t size_configure = 0; +#define GCACHE_BLOCKSIZE "65536" +#define GCACHE_SIZE "100" static void cache_main(struct gctl_req *req, unsigned flags); static void cache_clear(struct gctl_req *req); @@ -58,16 +56,16 @@ struct g_command class_commands[] = { }, { "configure", G_FLAG_VERBOSE, NULL, { - { 'b', "blocksize", &blocksize_configure, G_TYPE_NUMBER }, - { 's', "size", &size_configure, G_TYPE_NUMBER }, + { 'b', "blocksize", "0", G_TYPE_NUMBER }, + { 's', "size", "0", G_TYPE_NUMBER }, G_OPT_SENTINEL }, NULL, "[-v] [-b blocksize] [-s size] name" }, { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, { - { 'b', "blocksize", &blocksize_label, G_TYPE_NUMBER }, - { 's', "size", &size_label, G_TYPE_NUMBER }, + { 'b', "blocksize", GCACHE_BLOCKSIZE, G_TYPE_NUMBER }, + { 's', "size", GCACHE_SIZE, G_TYPE_NUMBER }, G_OPT_SENTINEL }, NULL, "[-v] [-b blocksize] [-s size] name prov" @@ -84,8 +82,8 @@ struct g_command class_commands[] = { }, { "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, cache_main, { - { 'b', "blocksize", &blocksize_label, G_TYPE_NUMBER }, - { 's', "size", &size_label, G_TYPE_NUMBER }, + { 'b', "blocksize", GCACHE_BLOCKSIZE, G_TYPE_NUMBER }, + { 's', "size", GCACHE_SIZE, G_TYPE_NUMBER }, G_OPT_SENTINEL }, NULL, "[-v] [-b blocksize] [-s size] name prov" Modified: stable/8/sbin/geom/class/eli/geom_eli.c ============================================================================== --- stable/8/sbin/geom/class/eli/geom_eli.c Tue Oct 26 21:22:55 2010 (r214401) +++ stable/8/sbin/geom/class/eli/geom_eli.c Tue Oct 26 21:23:55 2010 (r214402) @@ -55,15 +55,7 @@ uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_ELI_VERSION; #define GELI_BACKUP_DIR "/var/backups/" - -static char aalgo[] = "none"; -static char ealgo[] = "aes"; -static intmax_t keylen = 0; -static intmax_t keyno = -1; -static intmax_t iterations = -1; -static intmax_t sectorsize = 0; -static char keyfile[] = "", newkeyfile[] = ""; -static char backupfile[] = ""; +#define GELI_ENC_ALGO "aes" static void eli_main(struct gctl_req *req, unsigned flags); static void eli_init(struct gctl_req *req); @@ -101,30 +93,30 @@ static int eli_backup_create(struct gctl struct g_command class_commands[] = { { "init", G_FLAG_VERBOSE, eli_main, { - { 'a', "aalgo", aalgo, G_TYPE_STRING }, + { 'a', "aalgo", "none", G_TYPE_STRING }, { 'b', "boot", NULL, G_TYPE_BOOL }, - { 'B', "backupfile", backupfile, G_TYPE_STRING }, - { 'e', "ealgo", ealgo, G_TYPE_STRING }, - { 'i', "iterations", &iterations, G_TYPE_NUMBER }, - { 'K', "newkeyfile", newkeyfile, G_TYPE_STRING }, - { 'l', "keylen", &keylen, G_TYPE_NUMBER }, + { 'B', "backupfile", "", G_TYPE_STRING }, + { 'e', "ealgo", GELI_ENC_ALGO, G_TYPE_STRING }, + { 'i', "iterations", "-1", G_TYPE_NUMBER }, + { 'K', "newkeyfile", "", G_TYPE_STRING }, + { 'l', "keylen", "0", G_TYPE_NUMBER }, { 'P', "nonewpassphrase", NULL, G_TYPE_BOOL }, - { 's', "sectorsize", §orsize, G_TYPE_NUMBER }, + { 's', "sectorsize", "0", G_TYPE_NUMBER }, G_OPT_SENTINEL }, NULL, "[-bPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-K newkeyfile] [-s sectorsize] prov" }, { "label", G_FLAG_VERBOSE, eli_main, { - { 'a', "aalgo", aalgo, G_TYPE_STRING }, + { 'a', "aalgo", "none", G_TYPE_STRING }, { 'b', "boot", NULL, G_TYPE_BOOL }, - { 'B', "backupfile", backupfile, G_TYPE_STRING }, - { 'e', "ealgo", ealgo, G_TYPE_STRING }, - { 'i', "iterations", &iterations, G_TYPE_NUMBER }, - { 'K', "newkeyfile", newkeyfile, G_TYPE_STRING }, - { 'l', "keylen", &keylen, G_TYPE_NUMBER }, + { 'B', "backupfile", "", G_TYPE_STRING }, + { 'e', "ealgo", GELI_ENC_ALGO, G_TYPE_STRING }, + { 'i', "iterations", "-1", G_TYPE_NUMBER }, + { 'K', "newkeyfile", "", G_TYPE_STRING }, + { 'l', "keylen", "0", G_TYPE_NUMBER }, { 'P', "nonewpassphrase", NULL, G_TYPE_BOOL }, - { 's', "sectorsize", §orsize, G_TYPE_NUMBER }, + { 's', "sectorsize", "0", G_TYPE_NUMBER }, G_OPT_SENTINEL }, NULL, "- an alias for 'init'" @@ -132,7 +124,7 @@ struct g_command class_commands[] = { { "attach", G_FLAG_VERBOSE | G_FLAG_LOADKLD, eli_main, { { 'd', "detach", NULL, G_TYPE_BOOL }, - { 'k', "keyfile", keyfile, G_TYPE_STRING }, + { 'k', "keyfile", "", G_TYPE_STRING }, { 'p', "nopassphrase", NULL, G_TYPE_BOOL }, { 'r', "readonly", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL @@ -157,11 +149,11 @@ struct g_command class_commands[] = { }, { "onetime", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, { - { 'a', "aalgo", aalgo, G_TYPE_STRING }, + { 'a', "aalgo", "none", G_TYPE_STRING }, { 'd', "detach", NULL, G_TYPE_BOOL }, - { 'e', "ealgo", ealgo, G_TYPE_STRING }, - { 'l', "keylen", &keylen, G_TYPE_NUMBER }, - { 's', "sectorsize", §orsize, G_TYPE_NUMBER }, + { 'e', "ealgo", GELI_ENC_ALGO, G_TYPE_STRING }, + { 'l', "keylen", "0", G_TYPE_NUMBER }, + { 's', "sectorsize", "0", G_TYPE_NUMBER }, G_OPT_SENTINEL }, NULL, "[-d] [-a aalgo] [-e ealgo] [-l keylen] [-s sectorsize] prov" @@ -176,10 +168,10 @@ struct g_command class_commands[] = { }, { "setkey", G_FLAG_VERBOSE, eli_main, { - { 'i', "iterations", &iterations, G_TYPE_NUMBER }, - { 'k', "keyfile", keyfile, G_TYPE_STRING }, - { 'K', "newkeyfile", newkeyfile, G_TYPE_STRING }, - { 'n', "keyno", &keyno, G_TYPE_NUMBER }, + { 'i', "iterations", "-1", G_TYPE_NUMBER }, + { 'k', "keyfile", "", G_TYPE_STRING }, + { 'K', "newkeyfile", "", G_TYPE_STRING }, + { 'n', "keyno", "-1", G_TYPE_NUMBER }, { 'p', "nopassphrase", NULL, G_TYPE_BOOL }, { 'P', "nonewpassphrase", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL @@ -190,7 +182,7 @@ struct g_command class_commands[] = { { { 'a', "all", NULL, G_TYPE_BOOL }, { 'f', "force", NULL, G_TYPE_BOOL }, - { 'n', "keyno", &keyno, G_TYPE_NUMBER }, + { 'n', "keyno", "-1", G_TYPE_NUMBER }, G_OPT_SENTINEL }, NULL, "[-afv] [-n keyno] prov" Modified: stable/8/sbin/geom/class/journal/geom_journal.c ============================================================================== --- stable/8/sbin/geom/class/journal/geom_journal.c Tue Oct 26 21:22:55 2010 (r214401) +++ stable/8/sbin/geom/class/journal/geom_journal.c Tue Oct 26 21:23:55 2010 (r214402) @@ -47,8 +47,6 @@ __FBSDID("$FreeBSD$"); uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_JOURNAL_VERSION; -static intmax_t default_jsize = -1; - static void journal_main(struct gctl_req *req, unsigned flags); static void journal_clear(struct gctl_req *req); static void journal_dump(struct gctl_req *req); @@ -66,7 +64,7 @@ struct g_command class_commands[] = { { 'c', "checksum", NULL, G_TYPE_BOOL }, { 'f', "force", NULL, G_TYPE_BOOL }, { 'h', "hardcode", NULL, G_TYPE_BOOL }, - { 's', "jsize", &default_jsize, G_TYPE_NUMBER }, + { 's', "jsize", "-1", G_TYPE_NUMBER }, G_OPT_SENTINEL }, NULL, "[-cfhv] [-s jsize] dataprov [jprov]" Modified: stable/8/sbin/geom/class/mirror/geom_mirror.c ============================================================================== --- stable/8/sbin/geom/class/mirror/geom_mirror.c Tue Oct 26 21:22:55 2010 (r214401) +++ stable/8/sbin/geom/class/mirror/geom_mirror.c Tue Oct 26 21:23:55 2010 (r214402) @@ -44,9 +44,9 @@ __FBSDID("$FreeBSD$"); uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_MIRROR_VERSION; -static char label_balance[] = "load", configure_balance[] = "none"; -static intmax_t label_slice = 4096, configure_slice = -1; -static intmax_t insert_priority = 0, configure_priority = -1; +#define GMIRROR_BALANCE "load" +#define GMIRROR_SLICE "4096" +#define GMIRROR_PRIORITY "0" static void mirror_main(struct gctl_req *req, unsigned flags); static void mirror_activate(struct gctl_req *req); @@ -64,14 +64,14 @@ struct g_command class_commands[] = { { "configure", G_FLAG_VERBOSE, NULL, { { 'a', "autosync", NULL, G_TYPE_BOOL }, - { 'b', "balance", configure_balance, G_TYPE_STRING }, + { 'b', "balance", "none", G_TYPE_STRING }, { 'd', "dynamic", NULL, G_TYPE_BOOL }, { 'f', "failsync", NULL, G_TYPE_BOOL }, { 'F', "nofailsync", NULL, G_TYPE_BOOL }, { 'h', "hardcode", NULL, G_TYPE_BOOL }, { 'n', "noautosync", NULL, G_TYPE_BOOL }, - { 'p', "priority", &configure_priority, G_TYPE_NUMBER }, - { 's', "slice", &configure_slice, G_TYPE_NUMBER }, + { 'p', "priority", "-1", G_TYPE_NUMBER }, + { 's', "slice", "-1", G_TYPE_NUMBER }, G_OPT_SENTINEL }, NULL, "[-adfFhnv] [-b balance] [-s slice] name\n" @@ -88,11 +88,11 @@ struct g_command class_commands[] = { }, { "label", G_FLAG_VERBOSE, mirror_main, { - { 'b', "balance", label_balance, G_TYPE_STRING }, + { 'b', "balance", GMIRROR_BALANCE, G_TYPE_STRING }, { 'F', "nofailsync", NULL, G_TYPE_BOOL }, { 'h', "hardcode", NULL, G_TYPE_BOOL }, { 'n', "noautosync", NULL, G_TYPE_BOOL }, - { 's', "slice", &label_slice, G_TYPE_NUMBER }, + { 's', "slice", GMIRROR_SLICE, G_TYPE_NUMBER }, G_OPT_SENTINEL }, NULL, "[-Fhnv] [-b balance] [-s slice] name prov ..." @@ -101,7 +101,7 @@ struct g_command class_commands[] = { { { 'h', "hardcode", NULL, G_TYPE_BOOL }, { 'i', "inactive", NULL, G_TYPE_BOOL }, - { 'p', "priority", &insert_priority, G_TYPE_NUMBER }, + { 'p', "priority", GMIRROR_PRIORITY, G_TYPE_NUMBER }, G_OPT_SENTINEL }, NULL, "[-hiv] [-p priority] name prov ..." Modified: stable/8/sbin/geom/class/nop/geom_nop.c ============================================================================== --- stable/8/sbin/geom/class/nop/geom_nop.c Tue Oct 26 21:22:55 2010 (r214401) +++ stable/8/sbin/geom/class/nop/geom_nop.c Tue Oct 26 21:23:55 2010 (r214402) @@ -38,22 +38,15 @@ __FBSDID("$FreeBSD$"); uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_NOP_VERSION; -static intmax_t error = -1; -static intmax_t rfailprob = -1; -static intmax_t wfailprob = -1; -static intmax_t offset = 0; -static intmax_t secsize = 0; -static intmax_t size = 0; - struct g_command class_commands[] = { { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, { - { 'e', "error", &error, G_TYPE_NUMBER }, - { 'o', "offset", &offset, G_TYPE_NUMBER }, - { 'r', "rfailprob", &rfailprob, G_TYPE_NUMBER }, - { 's', "size", &size, G_TYPE_NUMBER }, - { 'S', "secsize", &secsize, G_TYPE_NUMBER }, - { 'w', "wfailprob", &wfailprob, G_TYPE_NUMBER }, + { 'e', "error", "-1", G_TYPE_NUMBER }, + { 'o', "offset", "0", G_TYPE_NUMBER }, + { 'r', "rfailprob", "-1", G_TYPE_NUMBER }, + { 's', "size", "0", G_TYPE_NUMBER }, + { 'S', "secsize", "0", G_TYPE_NUMBER }, + { 'w', "wfailprob", "-1", G_TYPE_NUMBER }, G_OPT_SENTINEL }, NULL, "[-v] [-e error] [-o offset] [-r rfailprob] [-s size] " @@ -61,9 +54,9 @@ struct g_command class_commands[] = { }, { "configure", G_FLAG_VERBOSE, NULL, { - { 'e', "error", &error, G_TYPE_NUMBER }, - { 'r', "rfailprob", &rfailprob, G_TYPE_NUMBER }, - { 'w', "wfailprob", &wfailprob, G_TYPE_NUMBER }, + { 'e', "error", "-1", G_TYPE_NUMBER }, + { 'r', "rfailprob", "-1", G_TYPE_NUMBER }, + { 'w', "wfailprob", "-1", G_TYPE_NUMBER }, G_OPT_SENTINEL }, NULL, "[-v] [-e error] [-r rfailprob] [-w wfailprob] prov ..." Modified: stable/8/sbin/geom/class/sched/geom_sched.c ============================================================================== --- stable/8/sbin/geom/class/sched/geom_sched.c Tue Oct 26 21:22:55 2010 (r214401) +++ stable/8/sbin/geom/class/sched/geom_sched.c Tue Oct 26 21:23:55 2010 (r214402) @@ -54,7 +54,7 @@ uint32_t version = G_SCHED_VERSION; * storage for parameters used by this geom class. * Right now only the scheduler name is used. */ -static char algo[] = "rr"; /* default scheduler */ +#define GSCHED_ALGO "rr" /* default scheduler */ /* * Adapt to differences in geom library. @@ -76,7 +76,7 @@ gcmd_createinsert(struct gctl_req *req, if (gctl_has_param(req, "algo")) reqalgo = gctl_get_ascii(req, "algo"); else - reqalgo = algo; + reqalgo = GSCHED_ALGO; snprintf(name, sizeof(name), "gsched_%s", reqalgo); /* @@ -91,21 +91,21 @@ gcmd_createinsert(struct gctl_req *req, struct g_command class_commands[] = { { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, gcmd_createinsert, { - { 'a', "algo", algo, G_TYPE_STRING }, + { 'a', "algo", GSCHED_ALGO, G_TYPE_STRING }, G_OPT_SENTINEL }, G_ARGNAME "[-v] [-a algorithm_name] dev ..." }, { "insert", G_FLAG_VERBOSE | G_FLAG_LOADKLD, gcmd_createinsert, { - { 'a', "algo", algo, G_TYPE_STRING }, + { 'a', "algo", GSCHED_ALGO, G_TYPE_STRING }, G_OPT_SENTINEL }, G_ARGNAME "[-v] [-a algorithm_name] dev ..." }, { "configure", G_FLAG_VERBOSE, NULL, { - { 'a', "algo", algo, G_TYPE_STRING }, + { 'a', "algo", GSCHED_ALGO, G_TYPE_STRING }, G_OPT_SENTINEL }, G_ARGNAME "[-v] [-a algorithm_name] prov ..." Modified: stable/8/sbin/geom/class/stripe/geom_stripe.c ============================================================================== --- stable/8/sbin/geom/class/stripe/geom_stripe.c Tue Oct 26 21:22:55 2010 (r214401) +++ stable/8/sbin/geom/class/stripe/geom_stripe.c Tue Oct 26 21:23:55 2010 (r214402) @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_STRIPE_VERSION; -static intmax_t default_stripesize = 65536; +#define GSTRIPE_STRIPESIZE "65536" static void stripe_main(struct gctl_req *req, unsigned flags); static void stripe_clear(struct gctl_req *req); @@ -59,7 +59,7 @@ struct g_command class_commands[] = { }, { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, { - { 's', "stripesize", &default_stripesize, G_TYPE_NUMBER }, + { 's', "stripesize", GSTRIPE_STRIPESIZE, G_TYPE_NUMBER }, G_OPT_SENTINEL }, NULL, "[-hv] [-s stripesize] name prov prov ..." @@ -77,7 +77,7 @@ struct g_command class_commands[] = { { "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, stripe_main, { { 'h', "hardcode", NULL, G_TYPE_BOOL }, - { 's', "stripesize", &default_stripesize, G_TYPE_NUMBER }, + { 's', "stripesize", GSTRIPE_STRIPESIZE, G_TYPE_NUMBER }, G_OPT_SENTINEL }, NULL, "[-hv] [-s stripesize] name prov prov ..." Modified: stable/8/sbin/geom/class/virstor/geom_virstor.c ============================================================================== --- stable/8/sbin/geom/class/virstor/geom_virstor.c Tue Oct 26 21:22:55 2010 (r214401) +++ stable/8/sbin/geom/class/virstor/geom_virstor.c Tue Oct 26 21:23:55 2010 (r214402) @@ -48,8 +48,9 @@ __FBSDID("$FreeBSD$"); uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_VIRSTOR_VERSION; -static intmax_t chunk_size = 4 * 1024 * 1024; /* in kB (default: 4 MB) */ -static intmax_t vir_size = 2ULL << 40; /* in MB (default: 2 TB) */ + +#define GVIRSTOR_CHUNK_SIZE "4M" +#define GVIRSTOR_VIR_SIZE "2T" #if G_LIB_VERSION == 1 /* Support RELENG_6 */ @@ -71,8 +72,8 @@ struct g_command class_commands[] = { {"label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, virstor_main, { {'h', "hardcode", NULL, G_TYPE_BOOL}, - {'m', "chunk_size", &chunk_size, G_TYPE_NUMBER}, - {'s', "vir_size", &vir_size, G_TYPE_NUMBER}, + {'m', "chunk_size", GVIRSTOR_CHUNK_SIZE, G_TYPE_NUMBER}, + {'s', "vir_size", GVIRSTOR_VIR_SIZE, G_TYPE_NUMBER}, G_OPT_SENTINEL }, NULL, "[-h] [-v] [-m chunk_size] [-s vir_size] name provider0 [provider1 ...]" Modified: stable/8/sbin/geom/core/geom.c ============================================================================== --- stable/8/sbin/geom/core/geom.c Tue Oct 26 21:22:55 2010 (r214401) +++ stable/8/sbin/geom/core/geom.c Tue Oct 26 21:23:55 2010 (r214402) @@ -374,14 +374,8 @@ parse_arguments(struct g_command *cmd, s usage(); } else if (opt->go_val == G_VAL_OPTIONAL) { /* add nothing. */ - } else if (G_OPT_TYPE(opt) == G_TYPE_STRING) { + } else { set_option(cmd, req, opt, opt->go_val); - } else if (G_OPT_TYPE(opt) == G_TYPE_NUMBER) { - char val[64]; - - snprintf(val, sizeof(val), "%jd", - *(const intmax_t *)opt->go_val); - set_option(cmd, req, opt, val); } } } From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 21:56:47 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92B10106564A; Tue, 26 Oct 2010 21:56:47 +0000 (UTC) (envelope-from mdounin@mdounin.ru) Received: from mdounin.cust.ramtel.ru (mdounin.cust.ramtel.ru [81.19.69.81]) by mx1.freebsd.org (Postfix) with ESMTP id 49A908FC08; Tue, 26 Oct 2010 21:56:47 +0000 (UTC) Received: from mdounin.ru (mdounin.cust.ramtel.ru [81.19.69.81]) by mdounin.cust.ramtel.ru (Postfix) with ESMTP id 6111D1702F; Wed, 27 Oct 2010 01:38:21 +0400 (MSD) Date: Wed, 27 Oct 2010 01:38:21 +0400 From: Maxim Dounin To: Randall Stewart Message-ID: <20101026213820.GK44164@mdounin.ru> References: <201010261912.o9QJCbdq063723@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201010261912.o9QJCbdq063723@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r214397 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 21:56:47 -0000 Hello! On Tue, Oct 26, 2010 at 07:12:37PM +0000, Randall Stewart wrote: > Author: rrs > Date: Tue Oct 26 19:12:37 2010 > New Revision: 214397 > URL: http://svn.freebsd.org/changeset/base/214397 > > Log: > MFC:210600 > > Fix the comment block that has the nice > table to really have the nice table :-) > > ============================================================================== > --- stable/8/sys/netinet/sctp_output.c Tue Oct 26 19:11:09 2010 (r214396) > +++ stable/8/sys/netinet/sctp_output.c Tue Oct 26 19:12:37 2010 (r214397) > @@ -2186,21 +2186,31 @@ sctp_is_ifa_addr_preferred(struct sctp_i > /* dest_is_priv is true if destination is a private address */ > /* dest_is_loop is true if destination is a loopback addresses */ > > - /* > + /** > * Here we determine if its a preferred address. A preferred address > * means it is the same scope or higher scope then the destination. > * L = loopback, P = private, G = global > - * ----------------------------------------- src | dest | result > - * ---------------------------------------- L | L | yes > - * ----------------------------------------- P | L | > - * yes-v4 no-v6 ----------------------------------------- G | > - * L | yes-v4 no-v6 ----------------------------------------- L > - * | P | no ----------------------------------------- P | > - * P | yes ----------------------------------------- G | > - * P | no ----------------------------------------- L | G > - * | no ----------------------------------------- P | G | > - * no ----------------------------------------- G | G | > - * yes ----------------------------------------- > + * ----------------------------------------- > + * src | dest | result > + * ---------------------------------------- Looks like it now has whitespace damage though (uses spaces as indentation). Maxim Dounin From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 26 23:06:54 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2ECC0106564A; Tue, 26 Oct 2010 23:06:54 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A6448FC12; Tue, 26 Oct 2010 23:06: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 o9QN6sAk076796; Tue, 26 Oct 2010 23:06:54 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QN6sWp076792; Tue, 26 Oct 2010 23:06:54 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010262306.o9QN6sWp076792@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 26 Oct 2010 23:06:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214405 - in stable/8: sbin/geom/class/eli sbin/geom/class/sched sbin/geom/core sys/geom/eli X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 23:06:54 -0000 Author: pjd Date: Tue Oct 26 23:06:53 2010 New Revision: 214405 URL: http://svn.freebsd.org/changeset/base/214405 Log: MFC r202976,r211927,r212845,r212846,r212934,r213055,r213056,r213057,r213058, r213059,r213060,r213062,r213063,r213067,r213070,r213071,r213072,r213073, r213164,r213165,r213172,r214116,r214118,r214133,r214163,r214225,r214226, r214227,r214228,r214229,r214404: r202976 (by trasz): Remove pointless assignment. Found with: clang r211927: Correct offset conversion to little endian. It was implemented in version 2, but because of a bug it was a no-op, so we were still using offsets in native byte order for the host. Do it properly this time, bump version to 4 and set the G_ELI_FLAG_NATIVE_BYTE_ORDER flag when version is under 4. Reported by: ivoras r212845 (by brian): Support attaching version 4 metadata Reviewed by: pjd r212846: Fix indent. r212934 (by brian): Add a geli resize subcommand to resize encrypted filesystems prior to growing the filesystem. Refuse to attach providers where the metadata provider size is wrong. This makes post-boot attaches behave consistently with pre-boot attaches. Also refuse to restore metadata to a provider of the wrong size without the new -f switch. The new -f switch forces the metadata restoration despite the provider size, and updates the provider size in the restored metadata to the correct value. Helped by: pjd Reviewed by: pjd r213055: When trashing metadata, flush after each write. r213056: Simplify code a bit by using g_*() API from libgeom. r213057: - Make use of g_*() API. - Flush cache after writing metadata. r213058: Because we first write metadata into new place and then trash old place we don't want situation where old size is equal to new size, as we will trash newly written metadata. r213059: - Use g_*() API when doing backups. - fsync() created files. r213060: - When trashing metadata, repeat overwrite kern.geom.eli.overwrites times. - Flush write cache after each write. r213062: Define default overwrite count, so that userland can use it. r213063: Make the code similar to the code in g_eli_integrity.c. r213067: Implement switching of data encryption key every 2^20 blocks. This ensures the same encryption key won't be used for more than 2^20 blocks (sectors). This will be the default now. r213070: Add support for AES-XTS. This will be the default now. r213071: Document AES-XTS. r213072: Update copyright years. r213073: Update copyright years. r213164: Ignore errors from BIO_FLUSH. It might confuse users that provider wasn't really killed. What we really care about are write errors only. r213165: Change g_eli_debug to int, so one can turn off any GELI output by setting kern.geom.eli.debug sysctl to -1. r213172: - Add support for loading passphrase from a file (-J and -j options). This is especially useful for things like installers, where regular geli prompt can't be used. - Add support for specifing multiple -K or -k options, so there is no need to cat all keyfiles and read them from standard input. Requested by: Kris Moore , thompsa r214116: - Add missing comments. - Make a comment consistent with others. r214118: Bring in geli suspend/resume functionality (finally). Before this change if you wanted to suspend your laptop and be sure that your encryption keys are safe, you had to stop all processes that use file system stored on encrypted device, unmount the file system and detach geli provider. This isn't very handy. If you are a lucky user of a laptop where suspend/resume actually works with FreeBSD (I'm not!) you most likely want to suspend your laptop, because you don't want to start everything over again when you turn your laptop back on. And this is where geli suspend/resume steps in. When you execute: # geli suspend -a geli will wait for all in-flight I/O requests, suspend new I/O requests, remove all geli sensitive data from the kernel memory (like encryption keys) and will wait for either 'geli resume' or 'geli detach'. Now with no keys in memory you can suspend your laptop without stopping any processes or unmounting any file systems. When you resume your laptop you have to resume geli devices using 'geli resume' command. You need to provide your passphrase, etc. again so the keys can be restored and suspended I/O requests released. Of course you need to remember that 'geli suspend' won't clear file system cache and other places where data from your geli-encrypted file system might be present. But to get rid of those stopping processes and unmounting file system won't help either - you have to turn your laptop off. Be warned. Also note, that suspending geli device which contains file system with geli utility (or anything used by 'geli resume') is not very good idea, as you won't be able to resume it - when you execute geli(8), the kernel will try to read it and this read I/O request will be suspended. r214133: Fix a bug introduced in r213067 where we use authentication key before initializing it. r214163: Free opencrypto sessions on suspend, as they also might keep encryption keys. r214225: Move sc_akeyctx and sc_ivctx initialization to the g_eli_mkey_propagate() function which eliminates code duplication and will ensure proper order of operation. r214226: Encryption keys array might be NULL if device is suspended. Check for this, so we don't panic when we detach suspended device. r214227: Add State tag, so 'geli status' will report active/suspended status, eg: # geli status Name Status Components da0.eli SUSPENDED da0 da1.eli ACTIVE da1 r214228: Close a race between checking if device is already suspended and suspending it. r214229: - Improve error messages, so instead of 'Not fully done', the user will get information that device is already suspended or that device is using one-time key and suspend is not supported. - 'geli suspend -a' silently skips devices that use one-time key, this is fine, but because we log which device were suspended on the console, log also which devices were skipped. r214404: Use fprintf(stderr) instead of gctl_error() to print a warning about too big sector size. When gctl error is set gctl_has_param() always returns 'false', which prevents geli(8) from finding some arguments and also masks an error, which is generates in such case. Modified: stable/8/sbin/geom/class/eli/geli.8 stable/8/sbin/geom/class/eli/geom_eli.c stable/8/sbin/geom/core/geom.c stable/8/sys/geom/eli/g_eli.c stable/8/sys/geom/eli/g_eli.h stable/8/sys/geom/eli/g_eli_crypto.c stable/8/sys/geom/eli/g_eli_ctl.c stable/8/sys/geom/eli/g_eli_integrity.c stable/8/sys/geom/eli/g_eli_key.c stable/8/sys/geom/eli/g_eli_privacy.c Directory Properties: stable/8/sbin/geom/ (props changed) stable/8/sbin/geom/class/part/ (props changed) stable/8/sbin/geom/class/sched/gsched.8 (props changed) stable/8/sbin/geom/class/stripe/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sbin/geom/class/eli/geli.8 ============================================================================== --- stable/8/sbin/geom/class/eli/geli.8 Tue Oct 26 22:46:15 2010 (r214404) +++ stable/8/sbin/geom/class/eli/geli.8 Tue Oct 26 23:06:53 2010 (r214405) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2005-2008 Pawel Jakub Dawidek +.\" Copyright (c) 2005-2010 Pawel Jakub Dawidek .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 29, 2008 +.Dd October 20, 2010 .Dt GELI 8 .Os .Sh NAME @@ -56,6 +56,7 @@ utility: .Op Fl B Ar backupfile .Op Fl e Ar ealgo .Op Fl i Ar iterations +.Op Fl J Ar newpassfile .Op Fl K Ar newkeyfile .Op Fl l Ar keylen .Op Fl s Ar sectorsize @@ -66,6 +67,7 @@ utility: .Nm .Cm attach .Op Fl dprv +.Op Fl j Ar passfile .Op Fl k Ar keyfile .Ar prov .Nm @@ -91,6 +93,8 @@ utility: .Cm setkey .Op Fl pPv .Op Fl i Ar iterations +.Op Fl j Ar passfile +.Op Fl J Ar newpassfile .Op Fl k Ar keyfile .Op Fl K Ar newkeyfile .Op Fl n Ar keyno @@ -111,10 +115,25 @@ utility: .Ar file .Nm .Cm restore -.Op Fl v +.Op Fl fv .Ar file .Ar prov .Nm +.Cm suspend +.Op Fl v +.Fl a | Ar prov ... +.Nm +.Cm resume +.Op Fl pv +.Op Fl j Ar passfile +.Op Fl k Ar keyfile +.Ar prov +.Nm +.Cm resize +.Op Fl v +.Fl s Ar oldsize +.Ar prov +.Nm .Cm clear .Op Fl v .Ar prov ... @@ -146,11 +165,12 @@ framework, so when there is crypto hardw will make use of it automatically. .It Supports many cryptographic algorithms (currently -.Nm AES , -.Nm Blowfish , -.Nm Camellia +.Nm AES-XTS , +.Nm AES-CBC , +.Nm Blowfish-CBC , +.Nm Camellia-CBC and -.Nm 3DES ) . +.Nm 3DES-CBC ) . .It Can optionally perform data authentication (integrity verification) utilizing one of the following algorithms: @@ -197,6 +217,8 @@ Allows to attach a provider with a rando partitions and temporary file systems. .It Allows to verify data integrity (data authentication). +.It +Allows to suspend and resume encrypted devices. .El .Pp The first argument to @@ -217,7 +239,7 @@ The metadata can be recovered with the subcommand described below. .Pp Additional options include: -.Bl -tag -width ".Fl a Ar aalgo" +.Bl -tag -width ".Fl J Ar newpassfile" .It Fl a Ar aalgo Enable data integrity verification (authentication) using the given algorithm. This will reduce size of available storage and also reduce speed. @@ -252,39 +274,44 @@ as the .It Fl e Ar ealgo Encryption algorithm to use. Currently supported algorithms are: -.Nm AES , -.Nm Blowfish , -.Nm Camellia +.Nm AES-XTS , +.Nm AES-CBC , +.Nm Blowfish-CBC , +.Nm Camellia-CBC and -.Nm 3DES . +.Nm 3DES-CBC . The default and recommended algorithm is -.Nm AES . +.Nm AES-XTS . .It Fl i Ar iterations Number of iterations to use with PKCS#5v2. If this option is not specified, .Nm will find the number of iterations which is equal to 2 seconds of crypto work. If 0 is given, PKCS#5v2 will not be used. +.It Fl J Ar newpassfile +Specifies a file which contains the passphrase or its part. +If +.Ar newpassfile +is given as -, standard input will be used. +Only the first line (excluding new-line character) is taken from the given file. +This argument can be specified multiple times. .It Fl K Ar newkeyfile Specifies a file which contains part of the key. If .Ar newkeyfile is given as -, standard input will be used. -Here is how more than one file with a key component can be used: -.Bd -literal -offset indent -# cat key1 key2 key3 | geli init -K - /dev/da0 -.Ed +This argument can be specified multiple times. .It Fl l Ar keylen Key length to use with the given cryptographic algorithm. If not given, the default key length for the given algorithm is used, which is: 128 for -.Nm AES , -128 for -.Nm Blowfish , -128 for -.Nm Camellia +.Nm AES-XTS , +.Nm AES-CBC , +.Nm Blowfish-CBC +and +.Nm Camellia-CBC and 192 for -.Nm 3DES . +.Nm 3DES-CBC . .It Fl P Do not use passphrase as the key component. .It Fl s Ar sectorsize @@ -302,7 +329,7 @@ provider's name with an suffix. .Pp Additional options include: -.Bl -tag -width ".Fl a Ar algo" +.Bl -tag -width ".Fl j Ar passfile" .It Fl d If specified, a decrypted provider will be detached automatically on last close. This can help with short memory - user does not have to remember to detach the @@ -314,6 +341,13 @@ Probably a better choice is the option for the .Cm detach subcommand. +.It Fl j Ar passfile +Specifies a file which contains the passphrase or its part. +For more information see the description of the +.Fl J +option for the +.Cm init +subcommand. .It Fl k Ar keyfile Specifies a file which contains part of the key. For more information see the description of the @@ -332,7 +366,7 @@ Detach the given providers, which means and clear the keys from memory. .Pp Additional options include: -.Bl -tag -width ".Fl a Ar algo" +.Bl -tag -width ".Fl f" .It Fl f Force detach - detach even if the provider is open. .It Fl l @@ -347,7 +381,7 @@ Attach the given providers with random, The command can be used to encrypt swap partitions or temporary file systems. .Pp Additional options include: -.Bl -tag -width ".Fl a Ar aalgo" +.Bl -tag -width ".Fl a Ar sectorsize" .It Fl a Ar aalgo Enable data integrity verification (authentication). For more information, see the description of the @@ -402,13 +436,17 @@ When a provider is attached, the user do an old passphrase/keyfile. .Pp Additional options include: -.Bl -tag -width ".Fl a Ar algo" +.Bl -tag -width ".Fl J Ar newpassfile" .It Fl i Ar iterations Number of iterations to use with PKCS#5v2. If 0 is given, PKCS#5v2 will not be used. To be able to use this option with .Cm setkey subcommand, only one key have to be defined and this key has to be changed. +.It Fl j Ar passfile +Specifies a file which contains the old passphrase or its part. +.It Fl J Ar newpassfile +Specifies a file which contains the new passphrase or its part. .It Fl k Ar keyfile Specifies a file which contains part of the old key. .It Fl K Ar newkeyfile @@ -432,7 +470,9 @@ will not be detached even if all keys wi It can be even rescued with the .Cm setkey subcommand. -.Bl -tag -width ".Fl a Ar algo" +.Pp +Additional options include: +.Bl -tag -width ".Fl a Ar keyno" .It Fl a Destroy all keys (does not need .Fl f @@ -456,7 +496,9 @@ backup, your data is gone for good. In case the provider was attached with the .Fl r flag, the keys will not be destroyed, only the provider will be detached. -.Bl -tag -width ".Fl a Ar algo" +.Pp +Additional options include: +.Bl -tag -width ".Fl a" .It Fl a If specified, all currently attached providers will be killed. .El @@ -464,6 +506,97 @@ If specified, all currently attached pro Backup metadata from the given provider to the given file. .It Cm restore Restore metadata from the given file to the given provider. +.Pp +Additional options include: +.Bl -tag -width ".Fl f" +.It Fl f +Metadata contains the size of the provider to ensure that the correct +partition or slice is attached. +If an attempt is made to restore metadata to a provider that has a different +size, +.Nm +will refuse to restore the data unless the +.Fl f +switch is used. +If the partition or slice has been grown, the +.Cm resize +subcommand should be used rather than attempting to relocate the metadata +through +.Cm backup +and +.Cm restore . +.El +.It Cm suspend +Suspend device by waiting for all inflight request to finish, clearing all +sensitive informations (like keys) from the kernel memory and blocking all +further I/O requests until the +.Cm resume +subcommand is executed. +This functionality is useful for eg. laptops - when one wants to suspend a +laptop, one does not want to leave encrypted device attached. +Instead of closing all files and directories opened from a file system placed +on an encrypted device, unmounting the file system and detaching the device, +the +.Cm suspend +subcommand can be used. +Any access to the encrypted device will be blocked until the keys are +recovered through +.Cm resume +subcommand, thus there is no need to close nor unmount anything. +The +.Cm suspend +subcommand does not work with devices created with the +.Cm onetime +subcommand. +Please note that sensitive data might still be present in memory after +suspending encrypted device, because of file system cache, etc. +.Pp +Additional options include: +.Bl -tag -width ".Fl a" +.It Fl a +Suspend all +.Nm +devices. +.El +.It Cm resume +Resume previously suspended device. +The caller must ensure that executing this subcommand won't try to access +suspended device, which will lead to a deadlock. +For example suspending device, which contains file system where the +.Nm +utility is stored is bad idea. +.Pp +Additional options include: +.Bl -tag -width ".Fl j Ar passfile" +.It Fl j Ar passfile +Specifies a file which contains the passphrase or its part. +For more information see the description of the +.Fl J +option for the +.Cm init +subcommand. +.It Fl k Ar keyfile +Specifies a file which contains part of the key. +For more information see the description of the +.Fl K +option for the +.Cm init +subcommand. +.It Fl p +Do not use passphrase as the key component. +.El +.It Cm resize +Inform +.Nm +that the provider has been resized. +The old metadata block is relocated to the correct position at the end of the +provider and the provider size is updated. +.Pp +Additional options include: +.Bl -tag -width ".Fl s Ar oldsize" +.It Fl s Ar oldsize +The size of the provider before it was resized. +.El .It Cm clear Clear metadata from the given providers. .It Cm dump @@ -603,7 +736,7 @@ keyfile: # dd if=/dev/random of=/boot/keys/da0.key0 bs=32k count=1 # dd if=/dev/random of=/boot/keys/da0.key1 bs=32k count=1 # dd if=/dev/random of=/boot/keys/da0.key2 bs=32k count=1 -# cat /boot/keys/da0.key0 /boot/keys/da0.key1 /boot/keys/da0.key2 | geli init -b -K - da0 +# geli init -b -K /boot/keys/da0.key0 -K /boot/keys/da0.key1 -K /boot/keys/da0.key2 da0 Enter new passphrase: Reenter new passphrase: # dd if=/dev/random of=/dev/da1s3a bs=1m @@ -665,6 +798,61 @@ geli: Cannot read metadata from /dev/da0 # geli attach /dev/da0 Enter passphrase: .Ed +.Pp +If an encrypted filesystem is extended, it is necessary to relocate and +update the metadata: +.Bd -literal -offset indent +# gpart create -s GPT ada0 +# gpart add -s 1g -t freebsd-ufs -i 1 ada0 +# geli init -K keyfile -P ada0p1 +# gpart resize -s 2g -i 1 ada0 +# geli resize -s 1g ada0p1 +# geli attach -k keyfile -p ada0p1 +.Ed +.Pp +Initialize provider with passphrase split into two files. +The provider can be attached by giving those two files or by giving +.Dq foobar +passphrase on +.Nm +prompt: +.Bd -literal -offset indent +# echo foo > da0.pass0 +# echo bar > da0.pass1 +# geli init -J da0.pass0 -J da0.pass1 da0 +# geli attach -j da0.pass0 -j da0.pass1 da0 +# geli detach da0 +# geli attach da0 +Enter passphrase: foobar +.Ed +.Pp +Suspend all +.Nm +devices, suspend a laptop, then resume devices one by one after resuming a +laptop: +.Bd -literal -offset indent +# geli suspend -a +# zzz + +# geli resume -p -k keyfile gpt/secret +# geli resume gpt/private +Enter passphrase: +.Ed +.Sh ENCRYPTION MODES +.Nm +supports two encryption modes: +.Nm XTS , +which was standarized as +.Nm IEE P1619 +and +.Nm CBC +with unpredictable IV. +The +.Nm CBC +mode used by +.Nm +is very similar to the mode +.Nm ESSIV . .Sh DATA AUTHENTICATION .Nm can verify data integrity when an authentication algorithm is specified. Modified: stable/8/sbin/geom/class/eli/geom_eli.c ============================================================================== --- stable/8/sbin/geom/class/eli/geom_eli.c Tue Oct 26 22:46:15 2010 (r214404) +++ stable/8/sbin/geom/class/eli/geom_eli.c Tue Oct 26 23:06:53 2010 (r214405) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2008 Pawel Jakub Dawidek + * Copyright (c) 2004-2010 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,6 +27,10 @@ #include __FBSDID("$FreeBSD$"); +#include +#include + +#include #include #include #include @@ -63,9 +67,11 @@ static void eli_attach(struct gctl_req * static void eli_configure(struct gctl_req *req); static void eli_setkey(struct gctl_req *req); static void eli_delkey(struct gctl_req *req); +static void eli_resume(struct gctl_req *req); static void eli_kill(struct gctl_req *req); static void eli_backup(struct gctl_req *req); static void eli_restore(struct gctl_req *req); +static void eli_resize(struct gctl_req *req); static void eli_clear(struct gctl_req *req); static void eli_dump(struct gctl_req *req); @@ -75,18 +81,21 @@ static int eli_backup_create(struct gctl /* * Available commands: * - * init [-bhPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-K newkeyfile] prov + * init [-bhPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] prov * label - alias for 'init' - * attach [-dprv] [-k keyfile] prov + * attach [-dprv] [-j passfile] [-k keyfile] prov * detach [-fl] prov ... * stop - alias for 'detach' * onetime [-d] [-a aalgo] [-e ealgo] [-l keylen] prov * configure [-bB] prov ... - * setkey [-pPv] [-n keyno] [-k keyfile] [-K newkeyfile] prov + * setkey [-pPv] [-n keyno] [-j passfile] [-J newpassfile] [-k keyfile] [-K newkeyfile] prov * delkey [-afv] [-n keyno] prov + * suspend [-v] -a | prov ... + * resume [-pv] [-j passfile] [-k keyfile] prov * kill [-av] [prov ...] * backup [-v] prov file - * restore [-v] file prov + * restore [-fv] file prov + * resize [-v] -s oldsize prov * clear [-v] prov ... * dump [-v] prov ... */ @@ -98,13 +107,15 @@ struct g_command class_commands[] = { { 'B', "backupfile", "", G_TYPE_STRING }, { 'e', "ealgo", GELI_ENC_ALGO, G_TYPE_STRING }, { 'i', "iterations", "-1", G_TYPE_NUMBER }, - { 'K', "newkeyfile", "", G_TYPE_STRING }, + { 'J', "newpassfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, + { 'K', "newkeyfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, { 'l', "keylen", "0", G_TYPE_NUMBER }, { 'P', "nonewpassphrase", NULL, G_TYPE_BOOL }, { 's', "sectorsize", "0", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-bPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-K newkeyfile] [-s sectorsize] prov" + NULL, + "[-bPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] prov" }, { "label", G_FLAG_VERBOSE, eli_main, { @@ -113,23 +124,27 @@ struct g_command class_commands[] = { { 'B', "backupfile", "", G_TYPE_STRING }, { 'e', "ealgo", GELI_ENC_ALGO, G_TYPE_STRING }, { 'i', "iterations", "-1", G_TYPE_NUMBER }, - { 'K', "newkeyfile", "", G_TYPE_STRING }, + { 'J', "newpassfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, + { 'K', "newkeyfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, { 'l', "keylen", "0", G_TYPE_NUMBER }, { 'P', "nonewpassphrase", NULL, G_TYPE_BOOL }, { 's', "sectorsize", "0", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "- an alias for 'init'" + NULL, + "- an alias for 'init'" }, { "attach", G_FLAG_VERBOSE | G_FLAG_LOADKLD, eli_main, { { 'd', "detach", NULL, G_TYPE_BOOL }, - { 'k', "keyfile", "", G_TYPE_STRING }, + { 'j', "passfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, + { 'k', "keyfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, { 'p', "nopassphrase", NULL, G_TYPE_BOOL }, { 'r', "readonly", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-dprv] [-k keyfile] prov" + NULL, + "[-dprv] [-j passfile] [-k keyfile] prov" }, { "detach", 0, NULL, { @@ -137,7 +152,8 @@ struct g_command class_commands[] = { { 'l', "last", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-fl] prov ..." + NULL, + "[-fl] prov ..." }, { "stop", 0, NULL, { @@ -145,7 +161,8 @@ struct g_command class_commands[] = { { 'l', "last", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "- an alias for 'detach'" + NULL, + "- an alias for 'detach'" }, { "onetime", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, { @@ -156,7 +173,8 @@ struct g_command class_commands[] = { { 's', "sectorsize", "0", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-d] [-a aalgo] [-e ealgo] [-l keylen] [-s sectorsize] prov" + NULL, + "[-d] [-a aalgo] [-e ealgo] [-l keylen] [-s sectorsize] prov" }, { "configure", G_FLAG_VERBOSE, eli_main, { @@ -164,19 +182,23 @@ struct g_command class_commands[] = { { 'B', "noboot", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-bB] prov ..." + NULL, + "[-bB] prov ..." }, { "setkey", G_FLAG_VERBOSE, eli_main, { { 'i', "iterations", "-1", G_TYPE_NUMBER }, - { 'k', "keyfile", "", G_TYPE_STRING }, - { 'K', "newkeyfile", "", G_TYPE_STRING }, + { 'j', "passfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, + { 'J', "newpassfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, + { 'k', "keyfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, + { 'K', "newkeyfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, { 'n', "keyno", "-1", G_TYPE_NUMBER }, { 'p', "nopassphrase", NULL, G_TYPE_BOOL }, { 'P', "nonewpassphrase", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-pPv] [-n keyno] [-i iterations] [-k keyfile] [-K newkeyfile] prov" + NULL, + "[-pPv] [-n keyno] [-i iterations] [-j passfile] [-J newpassfile] [-k keyfile] [-K newkeyfile] prov" }, { "delkey", G_FLAG_VERBOSE, eli_main, { @@ -185,20 +207,53 @@ struct g_command class_commands[] = { { 'n', "keyno", "-1", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-afv] [-n keyno] prov" + NULL, + "[-afv] [-n keyno] prov" + }, + { "suspend", G_FLAG_VERBOSE, NULL, + { + { 'a', "all", NULL, G_TYPE_BOOL }, + G_OPT_SENTINEL + }, + NULL, + "[-v] -a | prov ..." + }, + { "resume", G_FLAG_VERBOSE, eli_main, + { + { 'j', "passfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, + { 'k', "keyfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, + { 'p', "nopassphrase", NULL, G_TYPE_BOOL }, + G_OPT_SENTINEL + }, + NULL, + "[-pv] [-j passfile] [-k keyfile] prov" }, { "kill", G_FLAG_VERBOSE, eli_main, { { 'a', "all", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-av] [prov ...]" + NULL, + "[-av] [prov ...]" }, { "backup", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS, NULL, "[-v] prov file" }, - { "restore", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS, NULL, - "[-v] file prov" + { "restore", G_FLAG_VERBOSE, eli_main, + { + { 'f', "force", NULL, G_TYPE_BOOL }, + G_OPT_SENTINEL + }, + NULL, + "[-fv] file prov" + }, + { "resize", G_FLAG_VERBOSE, eli_main, + { + { 's', "oldsize", NULL, G_TYPE_NUMBER }, + G_OPT_SENTINEL + }, + NULL, + "[-v] -s oldsize prov" }, { "clear", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS, NULL, "[-v] prov ..." @@ -233,7 +288,7 @@ eli_protect(struct gctl_req *req) } static void -eli_main(struct gctl_req *req, unsigned flags) +eli_main(struct gctl_req *req, unsigned int flags) { const char *name; @@ -258,12 +313,16 @@ eli_main(struct gctl_req *req, unsigned eli_setkey(req); else if (strcmp(name, "delkey") == 0) eli_delkey(req); + else if (strcmp(name, "resume") == 0) + eli_resume(req); else if (strcmp(name, "kill") == 0) eli_kill(req); else if (strcmp(name, "backup") == 0) eli_backup(req); else if (strcmp(name, "restore") == 0) eli_restore(req); + else if (strcmp(name, "resize") == 0) + eli_resize(req); else if (strcmp(name, "dump") == 0) eli_dump(req); else if (strcmp(name, "clear") == 0) @@ -277,7 +336,7 @@ arc4rand(unsigned char *buf, size_t size { uint32_t *buf4; size_t size4; - unsigned i; + unsigned int i; buf4 = (uint32_t *)buf; size4 = size / 4; @@ -306,123 +365,216 @@ eli_is_attached(const char *prov) return (0); } -static unsigned char * -eli_genkey(struct gctl_req *req, struct g_eli_metadata *md, unsigned char *key, - int new) +static int +eli_genkey_files(struct gctl_req *req, bool new, const char *type, + struct hmac_ctx *ctxp, char *passbuf, size_t passbufsize) { - struct hmac_ctx ctx; - const char *str; - int error, nopassphrase; + char *p, buf[MAXPHYS], argname[16]; + const char *file; + int error, fd, i; + ssize_t done; + + assert((strcmp(type, "keyfile") == 0 && ctxp != NULL && + passbuf == NULL && passbufsize == 0) || + (strcmp(type, "passfile") == 0 && ctxp == NULL && + passbuf != NULL && passbufsize > 0)); + assert(strcmp(type, "keyfile") == 0 || passbuf[0] == '\0'); + + for (i = 0; ; i++) { + snprintf(argname, sizeof(argname), "%s%s%d", + new ? "new" : "", type, i); + + /* No more {key,pass}files? */ + if (!gctl_has_param(req, argname)) + return (i); - nopassphrase = - gctl_get_int(req, new ? "nonewpassphrase" : "nopassphrase"); - - g_eli_crypto_hmac_init(&ctx, NULL, 0); - - str = gctl_get_ascii(req, new ? "newkeyfile" : "keyfile"); - if (str[0] == '\0' && nopassphrase) { - gctl_error(req, "No key components given."); - return (NULL); - } else if (str[0] != '\0') { - char buf[MAXPHYS]; - ssize_t done; - int fd; + file = gctl_get_ascii(req, argname); + assert(file != NULL); - if (strcmp(str, "-") == 0) + if (strcmp(file, "-") == 0) fd = STDIN_FILENO; else { - fd = open(str, O_RDONLY); + fd = open(file, O_RDONLY); if (fd == -1) { - gctl_error(req, "Cannot open keyfile %s: %s.", - str, strerror(errno)); - return (NULL); + gctl_error(req, "Cannot open %s %s: %s.", + type, file, strerror(errno)); + return (-1); + } + } + if (strcmp(type, "keyfile") == 0) { + while ((done = read(fd, buf, sizeof(buf))) > 0) + g_eli_crypto_hmac_update(ctxp, buf, done); + } else /* if (strcmp(type, "passfile") == 0) */ { + while ((done = read(fd, buf, sizeof(buf) - 1)) > 0) { + buf[done] = '\0'; + p = strchr(buf, '\n'); + if (p != NULL) { + *p = '\0'; + done = p - buf; + } + if (strlcat(passbuf, buf, passbufsize) >= + passbufsize) { + gctl_error(req, + "Passphrase in %s too long.", file); + bzero(buf, sizeof(buf)); + return (-1); + } + if (p != NULL) + break; } } - while ((done = read(fd, buf, sizeof(buf))) > 0) - g_eli_crypto_hmac_update(&ctx, buf, done); error = errno; - if (strcmp(str, "-") != 0) + if (strcmp(file, "-") != 0) close(fd); bzero(buf, sizeof(buf)); if (done == -1) { - gctl_error(req, "Cannot read keyfile %s: %s.", str, - strerror(error)); - return (NULL); + gctl_error(req, "Cannot read %s %s: %s.", + type, file, strerror(error)); + return (-1); } } + /* NOTREACHED */ +} - if (!nopassphrase) { - char buf1[BUFSIZ], buf2[BUFSIZ], *p; +static int +eli_genkey_passphrase_prompt(struct gctl_req *req, bool new, char *passbuf, + size_t passbufsize) +{ + char *p; - if (!new && md->md_iterations == -1) { - gctl_error(req, "Missing -p flag."); - return (NULL); + for (;;) { + p = readpassphrase( + new ? "Enter new passphrase:" : "Enter passphrase:", + passbuf, passbufsize, RPP_ECHO_OFF | RPP_REQUIRE_TTY); + if (p == NULL) { + bzero(passbuf, passbufsize); + gctl_error(req, "Cannot read passphrase: %s.", + strerror(errno)); + return (-1); } - for (;;) { - p = readpassphrase( - new ? "Enter new passphrase:" : "Enter passphrase:", - buf1, sizeof(buf1), RPP_ECHO_OFF | RPP_REQUIRE_TTY); + + if (new) { + char tmpbuf[BUFSIZ]; + + p = readpassphrase("Reenter new passphrase: ", + tmpbuf, sizeof(tmpbuf), + RPP_ECHO_OFF | RPP_REQUIRE_TTY); if (p == NULL) { - bzero(buf1, sizeof(buf1)); - gctl_error(req, "Cannot read passphrase: %s.", + bzero(passbuf, passbufsize); + gctl_error(req, + "Cannot read passphrase: %s.", strerror(errno)); - return (NULL); + return (-1); } - - if (new) { - p = readpassphrase("Reenter new passphrase: ", - buf2, sizeof(buf2), - RPP_ECHO_OFF | RPP_REQUIRE_TTY); - if (p == NULL) { - bzero(buf1, sizeof(buf1)); - gctl_error(req, - "Cannot read passphrase: %s.", - strerror(errno)); - return (NULL); - } - - if (strcmp(buf1, buf2) != 0) { - bzero(buf2, sizeof(buf2)); - fprintf(stderr, "They didn't match.\n"); - continue; - } - bzero(buf2, sizeof(buf2)); + + if (strcmp(passbuf, tmpbuf) != 0) { + bzero(passbuf, passbufsize); + fprintf(stderr, "They didn't match.\n"); + continue; } - break; + bzero(tmpbuf, sizeof(tmpbuf)); } - /* - * Field md_iterations equal to -1 means "choose some sane - * value for me". - */ - if (md->md_iterations == -1) { - assert(new); - if (verbose) - printf("Calculating number of iterations...\n"); - md->md_iterations = pkcs5v2_calculate(2000000); - assert(md->md_iterations > 0); - if (verbose) { - printf("Done, using %d iterations.\n", - md->md_iterations); - } + return (0); + } + /* NOTREACHED */ +} + +static int +eli_genkey_passphrase(struct gctl_req *req, struct g_eli_metadata *md, bool new, + struct hmac_ctx *ctxp) +{ + char passbuf[MAXPHYS]; + bool nopassphrase; + int nfiles; + + nopassphrase = + gctl_get_int(req, new ? "nonewpassphrase" : "nopassphrase"); + if (nopassphrase) { + if (gctl_has_param(req, new ? "newpassfile0" : "passfile0")) { + gctl_error(req, + "Options -%c and -%c are mutually exclusive.", + new ? 'J' : 'j', new ? 'P' : 'p'); + return (-1); } - /* - * If md_iterations is equal to 0, user don't want PKCS#5v2. - */ - if (md->md_iterations == 0) { - g_eli_crypto_hmac_update(&ctx, md->md_salt, - sizeof(md->md_salt)); - g_eli_crypto_hmac_update(&ctx, buf1, strlen(buf1)); - } else /* if (md->md_iterations > 0) */ { - unsigned char dkey[G_ELI_USERKEYLEN]; - - pkcs5v2_genkey(dkey, sizeof(dkey), md->md_salt, - sizeof(md->md_salt), buf1, md->md_iterations); - g_eli_crypto_hmac_update(&ctx, dkey, sizeof(dkey)); - bzero(dkey, sizeof(dkey)); + return (0); + } + + if (!new && md->md_iterations == -1) { + gctl_error(req, "Missing -p flag."); + return (-1); + } + passbuf[0] = '\0'; + nfiles = eli_genkey_files(req, new, "passfile", NULL, passbuf, + sizeof(passbuf)); + if (nfiles == -1) + return (-1); + else if (nfiles == 0) { + if (eli_genkey_passphrase_prompt(req, new, passbuf, + sizeof(passbuf)) == -1) { + return (-1); + } + } + /* + * Field md_iterations equal to -1 means "choose some sane + * value for me". + */ + if (md->md_iterations == -1) { + assert(new); + if (verbose) + printf("Calculating number of iterations...\n"); + md->md_iterations = pkcs5v2_calculate(2000000); + assert(md->md_iterations > 0); + if (verbose) { + printf("Done, using %d iterations.\n", + md->md_iterations); } - bzero(buf1, sizeof(buf1)); } + /* + * If md_iterations is equal to 0, user doesn't want PKCS#5v2. + */ + if (md->md_iterations == 0) { + g_eli_crypto_hmac_update(ctxp, md->md_salt, + sizeof(md->md_salt)); + g_eli_crypto_hmac_update(ctxp, passbuf, strlen(passbuf)); + } else /* if (md->md_iterations > 0) */ { + unsigned char dkey[G_ELI_USERKEYLEN]; + + pkcs5v2_genkey(dkey, sizeof(dkey), md->md_salt, + sizeof(md->md_salt), passbuf, md->md_iterations); + g_eli_crypto_hmac_update(ctxp, dkey, sizeof(dkey)); + bzero(dkey, sizeof(dkey)); + } + bzero(passbuf, sizeof(passbuf)); + + return (0); +} + +static unsigned char * +eli_genkey(struct gctl_req *req, struct g_eli_metadata *md, unsigned char *key, + bool new) +{ + struct hmac_ctx ctx; + bool nopassphrase; + int nfiles; + + nopassphrase = + gctl_get_int(req, new ? "nonewpassphrase" : "nopassphrase"); + + g_eli_crypto_hmac_init(&ctx, NULL, 0); + + nfiles = eli_genkey_files(req, new, "keyfile", &ctx, NULL, 0); + if (nfiles == -1) + return (NULL); + else if (nfiles == 0 && nopassphrase) { + gctl_error(req, "No key components given."); + return (NULL); + } + + if (eli_genkey_passphrase(req, md, new, &ctx) == -1) + return (NULL); + g_eli_crypto_hmac_final(&ctx, key, 0); + return (key); } @@ -611,8 +763,8 @@ eli_init(struct gctl_req *req) return; } if (val > sysconf(_SC_PAGE_SIZE)) { - gctl_error(req, "warning: Using sectorsize bigger than " - "the page size!"); + fprintf(stderr, + "warning: Using sectorsize bigger than the page size!\n"); } md.md_sectorsize = val; } @@ -622,7 +774,7 @@ eli_init(struct gctl_req *req) arc4rand(md.md_mkeys, sizeof(md.md_mkeys)); /* Generate user key. */ - if (eli_genkey(req, &md, key, 1) == NULL) { + if (eli_genkey(req, &md, key, true) == NULL) { bzero(key, sizeof(key)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Wed Oct 27 02:04:25 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E01F4106564A; Wed, 27 Oct 2010 02:04:24 +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 CE2058FC12; Wed, 27 Oct 2010 02:04: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 o9R24OFa083668; Wed, 27 Oct 2010 02:04:24 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9R24OVG083666; Wed, 27 Oct 2010 02:04:24 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010270204.o9R24OVG083666@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 27 Oct 2010 02:04:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214407 - stable/8/sys/pci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 02:04:25 -0000 Author: yongari Date: Wed Oct 27 02:04:24 2010 New Revision: 214407 URL: http://svn.freebsd.org/changeset/base/214407 Log: MFC r213796: Rewrite interrupt handler to give fairness for both RX and TX. Previously rl(4) continuously checked whether there are RX events or TX completions in forever loop. This caused TX starvation under high RX load as well as consuming too much CPU cycles in the interrupt handler. If interrupt was shared with other devices which may be always true due to USB devices in these days, rl(4) also tried to process the interrupt. This means polling(4) was the only way to mitigate the these issues. To address these issues, rl(4) now disables interrupts when it knows the interrupt is ours and limit the number of iteration of the loop to 16. The interrupt would be enabled again before exiting interrupt handler if the driver is still running. Because RX buffer is 64KB in size, the number of iterations in the loop has nothing to do with number of RX packets being processed. This change ensures sending TX frames under high RX load. RX handler drops a driver lock to pass received frames to upper stack such that there is a window that user can down the interface. So rl(4) now checks whether driver is still running before serving RX or TX completion in the loop. While I'm here, exit interrupt handler when driver initialized controller. With this change, now rl(4) can send frames under high RX load even though the TX performance is still not good(rl(4) controllers can't queue more than 4 frames at a time so low TX performance was one of design issue of rl(4) controllers). It's much better than previous TX starvation and you should not notice RX performance drop with this change. Controller still shows poor performance under high network load but for many cases it's now usable without resorting to polling(4). Modified: stable/8/sys/pci/if_rl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/pci/if_rl.c ============================================================================== --- stable/8/sys/pci/if_rl.c Tue Oct 26 23:18:37 2010 (r214406) +++ stable/8/sys/pci/if_rl.c Wed Oct 27 02:04:24 2010 (r214407) @@ -1620,6 +1620,7 @@ rl_intr(void *arg) struct rl_softc *sc = arg; struct ifnet *ifp = sc->rl_ifp; uint16_t status; + int count; RL_LOCK(sc); @@ -1631,30 +1632,41 @@ rl_intr(void *arg) goto done_locked; #endif - for (;;) { + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + goto done_locked2; + status = CSR_READ_2(sc, RL_ISR); + if (status == 0xffff || (status & RL_INTRS) == 0) + goto done_locked; + /* + * Ours, disable further interrupts. + */ + CSR_WRITE_2(sc, RL_IMR, 0); + for (count = 16; count > 0; count--) { + CSR_WRITE_2(sc, RL_ISR, status); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + if (status & (RL_ISR_RX_OK | RL_ISR_RX_ERR)) + rl_rxeof(sc); + if (status & (RL_ISR_TX_OK | RL_ISR_TX_ERR)) + rl_txeof(sc); + if (status & RL_ISR_SYSTEM_ERR) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + rl_init_locked(sc); + RL_UNLOCK(sc); + return; + } + } status = CSR_READ_2(sc, RL_ISR); /* If the card has gone away, the read returns 0xffff. */ - if (status == 0xffff) + if (status == 0xffff || (status & RL_INTRS) == 0) break; - if (status != 0) - CSR_WRITE_2(sc, RL_ISR, status); - if ((status & RL_INTRS) == 0) - break; - if (status & RL_ISR_RX_OK) - rl_rxeof(sc); - if (status & RL_ISR_RX_ERR) - rl_rxeof(sc); - if ((status & RL_ISR_TX_OK) || (status & RL_ISR_TX_ERR)) - rl_txeof(sc); - if (status & RL_ISR_SYSTEM_ERR) { - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - rl_init_locked(sc); - } } if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) rl_start_locked(ifp); +done_locked2: + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + CSR_WRITE_2(sc, RL_IMR, RL_INTRS); done_locked: RL_UNLOCK(sc); } From owner-svn-src-stable-8@FreeBSD.ORG Wed Oct 27 13:10:08 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 797EC106564A; Wed, 27 Oct 2010 13:10:08 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 673AB8FC08; Wed, 27 Oct 2010 13:10: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 o9RDA8Ic007032; Wed, 27 Oct 2010 13:10:08 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9RDA8PH007028; Wed, 27 Oct 2010 13:10:08 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201010271310.o9RDA8PH007028@svn.freebsd.org> From: Rick Macklem Date: Wed, 27 Oct 2010 13:10:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214415 - stable/8/sys/rpc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 13:10:08 -0000 Author: rmacklem Date: Wed Oct 27 13:10:08 2010 New Revision: 214415 URL: http://svn.freebsd.org/changeset/base/214415 Log: MFC: r213756 Fix the krpc so that it can handle NFSv3,UDP mounts with a read/write data size greater than 8192. Since soreserve(so, 256*1024, 256*1024) would always fail for the default value of sb_max, modify clnt_dg.c so that it uses the calculated values and checks for an error return from soreserve(). Also, add a check for error return from soreserve() to clnt_vc.c and change __rpc_get_t_size() to use sb_max_adj instead of the bogus maxsize == 256*1024. Modified: stable/8/sys/rpc/clnt_dg.c stable/8/sys/rpc/clnt_vc.c stable/8/sys/rpc/rpc_generic.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/rpc/clnt_dg.c ============================================================================== --- stable/8/sys/rpc/clnt_dg.c Wed Oct 27 12:51:36 2010 (r214414) +++ stable/8/sys/rpc/clnt_dg.c Wed Oct 27 13:10:08 2010 (r214415) @@ -193,6 +193,7 @@ clnt_dg_create( struct rpc_msg call_msg; struct __rpc_sockinfo si; XDR xdrs; + int error; if (svcaddr == NULL) { rpc_createerr.cf_stat = RPC_UNKNOWNADDR; @@ -267,7 +268,12 @@ clnt_dg_create( */ cu->cu_closeit = FALSE; cu->cu_socket = so; - soreserve(so, 256*1024, 256*1024); + error = soreserve(so, (u_long)sendsz, (u_long)recvsz); + if (error != 0) { + rpc_createerr.cf_stat = RPC_FAILED; + rpc_createerr.cf_error.re_errno = error; + goto err2; + } sb = &so->so_rcv; SOCKBUF_LOCK(&so->so_rcv); Modified: stable/8/sys/rpc/clnt_vc.c ============================================================================== --- stable/8/sys/rpc/clnt_vc.c Wed Oct 27 12:51:36 2010 (r214414) +++ stable/8/sys/rpc/clnt_vc.c Wed Oct 27 13:10:08 2010 (r214415) @@ -288,13 +288,19 @@ clnt_vc_create( * Create a client handle which uses xdrrec for serialization * and authnone for authentication. */ + sendsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)sendsz); + recvsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsz); + error = soreserve(ct->ct_socket, sendsz, recvsz); + if (error != 0) { + if (ct->ct_closeit) { + soclose(ct->ct_socket); + } + goto err; + } cl->cl_refs = 1; cl->cl_ops = &clnt_vc_ops; cl->cl_private = ct; cl->cl_auth = authnone_create(); - sendsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)sendsz); - recvsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsz); - soreserve(ct->ct_socket, sendsz, recvsz); SOCKBUF_LOCK(&ct->ct_socket->so_rcv); soupcall_set(ct->ct_socket, SO_RCV, clnt_vc_soupcall, ct); Modified: stable/8/sys/rpc/rpc_generic.c ============================================================================== --- stable/8/sys/rpc/rpc_generic.c Wed Oct 27 12:51:36 2010 (r214414) +++ stable/8/sys/rpc/rpc_generic.c Wed Oct 27 13:10:08 2010 (r214415) @@ -63,6 +63,8 @@ __FBSDID("$FreeBSD$"); #include +extern u_long sb_max_adj; /* not defined in socketvar.h */ + #if __FreeBSD_version < 700000 #define strrchr rindex #endif @@ -113,9 +115,8 @@ u_int /*ARGSUSED*/ __rpc_get_t_size(int af, int proto, int size) { - int maxsize, defsize; + int defsize; - maxsize = 256 * 1024; /* XXX */ switch (proto) { case IPPROTO_TCP: defsize = 64 * 1024; /* XXX */ @@ -131,7 +132,7 @@ __rpc_get_t_size(int af, int proto, int return defsize; /* Check whether the value is within the upper max limit */ - return (size > maxsize ? (u_int)maxsize : (u_int)size); + return (size > sb_max_adj ? (u_int)sb_max_adj : (u_int)size); } /* From owner-svn-src-stable-8@FreeBSD.ORG Wed Oct 27 15:44:49 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9CB51065670; Wed, 27 Oct 2010 15:44: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 D56718FC16; Wed, 27 Oct 2010 15: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 o9RFinKL012607; Wed, 27 Oct 2010 15:44:49 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9RFin4X012592; Wed, 27 Oct 2010 15:44:49 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010271544.o9RFin4X012592@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 27 Oct 2010 15:44:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214420 - in stable/8/sys: fs/cd9660 fs/hpfs fs/msdosfs fs/ntfs gnu/fs/reiserfs kern sys ufs/ffs ufs/ufs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 15:44:50 -0000 Author: kib Date: Wed Oct 27 15:44:49 2010 New Revision: 214420 URL: http://svn.freebsd.org/changeset/base/214420 Log: MFC r213664: The r184588 changed the layout of struct export_args, causing an ABI breakage for old mount(2) syscall, since most struct _args embed export_args. The mount(2) is supposed to provide ABI compatibility for pre-nmount mount(8) binaries, so restore ABI to pre-r184588. Modified: stable/8/sys/fs/cd9660/cd9660_mount.h stable/8/sys/fs/cd9660/cd9660_vfsops.c stable/8/sys/fs/hpfs/hpfs_vfsops.c stable/8/sys/fs/hpfs/hpfsmount.h stable/8/sys/fs/msdosfs/msdosfs_vfsops.c stable/8/sys/fs/msdosfs/msdosfsmount.h stable/8/sys/fs/ntfs/ntfs_vfsops.c stable/8/sys/fs/ntfs/ntfsmount.h stable/8/sys/gnu/fs/reiserfs/reiserfs_mount.h stable/8/sys/gnu/fs/reiserfs/reiserfs_vfsops.c stable/8/sys/kern/vfs_mount.c stable/8/sys/sys/mount.h stable/8/sys/ufs/ffs/ffs_vfsops.c stable/8/sys/ufs/ufs/ufsmount.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/cd9660/cd9660_mount.h ============================================================================== --- stable/8/sys/fs/cd9660/cd9660_mount.h Wed Oct 27 14:11:11 2010 (r214419) +++ stable/8/sys/fs/cd9660/cd9660_mount.h Wed Oct 27 15:44:49 2010 (r214420) @@ -40,7 +40,7 @@ */ struct iso_args { char *fspec; /* block special device to mount */ - struct export_args export; /* network export info */ + struct oexport_args export; /* network export info */ int flags; /* mounting flags, see below */ int ssector; /* starting sector, 0 for 1st session */ char *cs_disk; /* disk charset for Joliet cs conversion */ Modified: stable/8/sys/fs/cd9660/cd9660_vfsops.c ============================================================================== --- stable/8/sys/fs/cd9660/cd9660_vfsops.c Wed Oct 27 14:11:11 2010 (r214419) +++ stable/8/sys/fs/cd9660/cd9660_vfsops.c Wed Oct 27 15:44:49 2010 (r214420) @@ -98,14 +98,16 @@ static int cd9660_cmount(struct mntarg *ma, void *data, int flags) { struct iso_args args; + struct export_args exp; int error; error = copyin(data, &args, sizeof args); if (error) return (error); + vfs_oexport_conv(&args.export, &exp); ma = mount_argsu(ma, "from", args.fspec, MAXPATHLEN); - ma = mount_arg(ma, "export", &args.export, sizeof args.export); + ma = mount_arg(ma, "export", &exp, sizeof(exp)); ma = mount_argsu(ma, "cs_disk", args.cs_disk, 64); ma = mount_argsu(ma, "cs_local", args.cs_local, 64); ma = mount_argf(ma, "ssector", "%u", args.ssector); Modified: stable/8/sys/fs/hpfs/hpfs_vfsops.c ============================================================================== --- stable/8/sys/fs/hpfs/hpfs_vfsops.c Wed Oct 27 14:11:11 2010 (r214419) +++ stable/8/sys/fs/hpfs/hpfs_vfsops.c Wed Oct 27 15:44:49 2010 (r214420) @@ -76,14 +76,16 @@ hpfs_cmount ( int flags) { struct hpfs_args args; + struct export_args exp; int error; error = copyin(data, (caddr_t)&args, sizeof (struct hpfs_args)); if (error) return (error); + vfs_oexport_conv(&args.export, &exp); ma = mount_argsu(ma, "from", args.fspec, MAXPATHLEN); - ma = mount_arg(ma, "export", &args.export, sizeof args.export); + ma = mount_arg(ma, "export", &exp, sizeof(exp)); ma = mount_argf(ma, "uid", "%d", args.uid); ma = mount_argf(ma, "gid", "%d", args.gid); ma = mount_argf(ma, "mode", "%d", args.mode); Modified: stable/8/sys/fs/hpfs/hpfsmount.h ============================================================================== --- stable/8/sys/fs/hpfs/hpfsmount.h Wed Oct 27 14:11:11 2010 (r214419) +++ stable/8/sys/fs/hpfs/hpfsmount.h Wed Oct 27 15:44:49 2010 (r214420) @@ -29,7 +29,7 @@ #define HPFSMNT_TABLES 0x0001 struct hpfs_args { char *fspec; /* block special device to mount */ - struct export_args export; /* network export information */ + struct oexport_args export; /* network export information */ uid_t uid; /* uid that owns hpfs files */ gid_t gid; /* gid that owns hpfs files */ mode_t mode; /* mask to be applied for hpfs perms */ Modified: stable/8/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_vfsops.c Wed Oct 27 14:11:11 2010 (r214419) +++ stable/8/sys/fs/msdosfs/msdosfs_vfsops.c Wed Oct 27 15:44:49 2010 (r214420) @@ -200,6 +200,7 @@ static int msdosfs_cmount(struct mntarg *ma, void *data, int flags) { struct msdosfs_args args; + struct export_args exp; int error; if (data == NULL) @@ -207,9 +208,10 @@ msdosfs_cmount(struct mntarg *ma, void * error = copyin(data, &args, sizeof args); if (error) return (error); + vfs_oexport_conv(&args.export, &exp); ma = mount_argsu(ma, "from", args.fspec, MAXPATHLEN); - ma = mount_arg(ma, "export", &args.export, sizeof args.export); + ma = mount_arg(ma, "export", &exp, sizeof(exp)); ma = mount_argf(ma, "uid", "%d", args.uid); ma = mount_argf(ma, "gid", "%d", args.gid); ma = mount_argf(ma, "mask", "%d", args.mask); Modified: stable/8/sys/fs/msdosfs/msdosfsmount.h ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfsmount.h Wed Oct 27 14:11:11 2010 (r214419) +++ stable/8/sys/fs/msdosfs/msdosfsmount.h Wed Oct 27 15:44:49 2010 (r214420) @@ -234,7 +234,7 @@ uint32_t msdosfs_fileno_map(struct mount */ struct msdosfs_args { char *fspec; /* blocks special holding the fs to mount */ - struct export_args export; /* network export information */ + struct oexport_args export; /* network export information */ uid_t uid; /* uid that owns msdosfs files */ gid_t gid; /* gid that owns msdosfs files */ mode_t mask; /* file mask to be applied for msdosfs perms */ Modified: stable/8/sys/fs/ntfs/ntfs_vfsops.c ============================================================================== --- stable/8/sys/fs/ntfs/ntfs_vfsops.c Wed Oct 27 14:11:11 2010 (r214419) +++ stable/8/sys/fs/ntfs/ntfs_vfsops.c Wed Oct 27 15:44:49 2010 (r214420) @@ -119,14 +119,16 @@ ntfs_cmount ( void *data, int flags) { - int error; struct ntfs_args args; + struct export_args exp; + int error; - error = copyin(data, (caddr_t)&args, sizeof args); + error = copyin(data, &args, sizeof(args)); if (error) return (error); + vfs_oexport_conv(&args.export, &exp); ma = mount_argsu(ma, "from", args.fspec, MAXPATHLEN); - ma = mount_arg(ma, "export", &args.export, sizeof args.export); + ma = mount_arg(ma, "export", &exp, sizeof(exp)); ma = mount_argf(ma, "uid", "%d", args.uid); ma = mount_argf(ma, "gid", "%d", args.gid); ma = mount_argf(ma, "mode", "%d", args.mode); Modified: stable/8/sys/fs/ntfs/ntfsmount.h ============================================================================== --- stable/8/sys/fs/ntfs/ntfsmount.h Wed Oct 27 14:11:11 2010 (r214419) +++ stable/8/sys/fs/ntfs/ntfsmount.h Wed Oct 27 15:44:49 2010 (r214420) @@ -34,7 +34,7 @@ struct ntfs_args { char *fspec; /* block special device to mount */ - struct export_args export; /* network export information */ + struct oexport_args export; /* network export information */ uid_t uid; /* uid that owns ntfs files */ gid_t gid; /* gid that owns ntfs files */ mode_t mode; /* mask to be applied for ntfs perms */ Modified: stable/8/sys/gnu/fs/reiserfs/reiserfs_mount.h ============================================================================== --- stable/8/sys/gnu/fs/reiserfs/reiserfs_mount.h Wed Oct 27 14:11:11 2010 (r214419) +++ stable/8/sys/gnu/fs/reiserfs/reiserfs_mount.h Wed Oct 27 15:44:49 2010 (r214420) @@ -39,7 +39,7 @@ struct reiserfs_mount { /* Arguments to mount ReiserFS filesystems. */ struct reiserfs_args { char *fspec; /* blocks special holding the fs to mount */ - struct export_args export; /* network export information */ + struct oexport_args export; /* network export information */ }; #endif /* !defined _GNU_REISERFS_REISERFS_MOUNT_H */ Modified: stable/8/sys/gnu/fs/reiserfs/reiserfs_vfsops.c ============================================================================== --- stable/8/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Wed Oct 27 14:11:11 2010 (r214419) +++ stable/8/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Wed Oct 27 15:44:49 2010 (r214420) @@ -52,14 +52,16 @@ static int reiserfs_cmount(struct mntarg *ma, void *data, int flags) { struct reiserfs_args args; + struct export_args exp; int error; error = copyin(data, &args, sizeof(args)); if (error) return (error); + vfs_oexport_conv(&args.export, &exp); ma = mount_argsu(ma, "from", args.fspec, MAXPATHLEN); - ma = mount_arg(ma, "export", &args.export, sizeof args.export); + ma = mount_arg(ma, "export", &exp, sizeof(exp)); error = kernel_mount(ma, flags); Modified: stable/8/sys/kern/vfs_mount.c ============================================================================== --- stable/8/sys/kern/vfs_mount.c Wed Oct 27 14:11:11 2010 (r214419) +++ stable/8/sys/kern/vfs_mount.c Wed Oct 27 15:44:49 2010 (r214420) @@ -2501,3 +2501,11 @@ kernel_vmount(int flags, ...) error = kernel_mount(ma, flags); return (error); } + +void +vfs_oexport_conv(const struct oexport_args *oexp, struct export_args *exp) +{ + + bcopy(oexp, exp, sizeof(*oexp)); + exp->ex_numsecflavors = 0; +} Modified: stable/8/sys/sys/mount.h ============================================================================== --- stable/8/sys/sys/mount.h Wed Oct 27 14:11:11 2010 (r214419) +++ stable/8/sys/sys/mount.h Wed Oct 27 15:44:49 2010 (r214420) @@ -738,6 +738,8 @@ int vfs_modevent(module_t, int, void *); void vfs_mount_error(struct mount *, const char *, ...); void vfs_mountroot(void); /* mount our root filesystem */ void vfs_mountedfrom(struct mount *, const char *from); +void vfs_oexport_conv(const struct oexport_args *oexp, + struct export_args *exp); void vfs_ref(struct mount *); void vfs_rel(struct mount *); struct mount *vfs_mount_alloc(struct vnode *, struct vfsconf *, const char *, Modified: stable/8/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- stable/8/sys/ufs/ffs/ffs_vfsops.c Wed Oct 27 14:11:11 2010 (r214419) +++ stable/8/sys/ufs/ffs/ffs_vfsops.c Wed Oct 27 15:44:49 2010 (r214420) @@ -460,6 +460,7 @@ static int ffs_cmount(struct mntarg *ma, void *data, int flags) { struct ufs_args args; + struct export_args exp; int error; if (data == NULL) @@ -467,9 +468,10 @@ ffs_cmount(struct mntarg *ma, void *data error = copyin(data, &args, sizeof args); if (error) return (error); + vfs_oexport_conv(&args.export, &exp); ma = mount_argsu(ma, "from", args.fspec, MAXPATHLEN); - ma = mount_arg(ma, "export", &args.export, sizeof args.export); + ma = mount_arg(ma, "export", &exp, sizeof(exp)); error = kernel_mount(ma, flags); return (error); Modified: stable/8/sys/ufs/ufs/ufsmount.h ============================================================================== --- stable/8/sys/ufs/ufs/ufsmount.h Wed Oct 27 14:11:11 2010 (r214419) +++ stable/8/sys/ufs/ufs/ufsmount.h Wed Oct 27 15:44:49 2010 (r214420) @@ -40,7 +40,7 @@ */ struct ufs_args { char *fspec; /* block special device to mount */ - struct export_args export; /* network export information */ + struct oexport_args export; /* network export information */ }; #ifdef _KERNEL From owner-svn-src-stable-8@FreeBSD.ORG Wed Oct 27 15:57:17 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A587106564A; Wed, 27 Oct 2010 15:57:17 +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 879958FC15; Wed, 27 Oct 2010 15:57: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 o9RFvHY8013023; Wed, 27 Oct 2010 15:57:17 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9RFvHju013016; Wed, 27 Oct 2010 15:57:17 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010271557.o9RFvHju013016@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 27 Oct 2010 15:57:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214421 - in stable/8/sys: amd64/linux32 compat/svr4 i386/ibcs2 i386/linux sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 15:57:17 -0000 Author: kib Date: Wed Oct 27 15:57:17 2010 New Revision: 214421 URL: http://svn.freebsd.org/changeset/base/214421 Log: MFC r213716: Add macro DECLARE_MODULE_TIED to denote a module as requiring the kernel of exactly the same __FreeBSD_version as the headers module was compiled against. Mark our in-tree ABI emulators with DECLARE_MODULE_TIED. The modules use kernel interfaces that the Release Engineering Team feel are not stable enough to guarantee they will not change during the life cycle of a STABLE branch. In particular, the layout of struct sysentvec is declared to be not part of the STABLE KBI. Modified: stable/8/sys/amd64/linux32/linux32_sysvec.c stable/8/sys/compat/svr4/svr4_sysvec.c stable/8/sys/i386/ibcs2/ibcs2_sysvec.c stable/8/sys/i386/linux/linux_sysvec.c stable/8/sys/sys/exec.h stable/8/sys/sys/module.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- stable/8/sys/amd64/linux32/linux32_sysvec.c Wed Oct 27 15:44:49 2010 (r214420) +++ stable/8/sys/amd64/linux32/linux32_sysvec.c Wed Oct 27 15:57:17 2010 (r214421) @@ -1205,4 +1205,4 @@ static moduledata_t linux_elf_mod = { 0 }; -DECLARE_MODULE(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); +DECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); Modified: stable/8/sys/compat/svr4/svr4_sysvec.c ============================================================================== --- stable/8/sys/compat/svr4/svr4_sysvec.c Wed Oct 27 15:44:49 2010 (r214420) +++ stable/8/sys/compat/svr4/svr4_sysvec.c Wed Oct 27 15:57:17 2010 (r214421) @@ -306,5 +306,5 @@ static moduledata_t svr4_elf_mod = { svr4_elf_modevent, 0 }; -DECLARE_MODULE(svr4elf, svr4_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); +DECLARE_MODULE_TIED(svr4elf, svr4_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); MODULE_DEPEND(svr4elf, streams, 1, 1, 1); Modified: stable/8/sys/i386/ibcs2/ibcs2_sysvec.c ============================================================================== --- stable/8/sys/i386/ibcs2/ibcs2_sysvec.c Wed Oct 27 15:44:49 2010 (r214420) +++ stable/8/sys/i386/ibcs2/ibcs2_sysvec.c Wed Oct 27 15:57:17 2010 (r214421) @@ -131,4 +131,4 @@ static moduledata_t ibcs2_mod = { ibcs2_modevent, 0 }; -DECLARE_MODULE(ibcs2, ibcs2_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); +DECLARE_MODULE_TIED(ibcs2, ibcs2_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: stable/8/sys/i386/linux/linux_sysvec.c ============================================================================== --- stable/8/sys/i386/linux/linux_sysvec.c Wed Oct 27 15:44:49 2010 (r214420) +++ stable/8/sys/i386/linux/linux_sysvec.c Wed Oct 27 15:57:17 2010 (r214421) @@ -1167,4 +1167,4 @@ static moduledata_t linux_elf_mod = { 0 }; -DECLARE_MODULE(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); +DECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); Modified: stable/8/sys/sys/exec.h ============================================================================== --- stable/8/sys/sys/exec.h Wed Oct 27 15:44:49 2010 (r214420) +++ stable/8/sys/sys/exec.h Wed Oct 27 15:57:17 2010 (r214421) @@ -115,7 +115,8 @@ int exec_unregister(const struct execsw __CONCAT(name,_modevent), \ (void *)& execsw_arg \ }; \ - DECLARE_MODULE(name, __CONCAT(name,_mod), SI_SUB_EXEC, SI_ORDER_ANY) + DECLARE_MODULE_TIED(name, __CONCAT(name,_mod), SI_SUB_EXEC, \ + SI_ORDER_ANY) #endif #endif Modified: stable/8/sys/sys/module.h ============================================================================== --- stable/8/sys/sys/module.h Wed Oct 27 15:44:49 2010 (r214420) +++ stable/8/sys/sys/module.h Wed Oct 27 15:57:17 2010 (r214421) @@ -125,13 +125,26 @@ struct mod_metadata { */ #define MODULE_KERNEL_MAXVER (roundup(__FreeBSD_version, 100000) - 1) -#define DECLARE_MODULE(name, data, sub, order) \ +#define DECLARE_MODULE_WITH_MAXVER(name, data, sub, order, maxver) \ MODULE_DEPEND(name, kernel, __FreeBSD_version, \ - __FreeBSD_version, MODULE_KERNEL_MAXVER); \ + __FreeBSD_version, maxver); \ MODULE_METADATA(_md_##name, MDT_MODULE, &data, #name); \ SYSINIT(name##module, sub, order, module_register_init, &data); \ struct __hack +#define DECLARE_MODULE(name, data, sub, order) \ + DECLARE_MODULE_WITH_MAXVER(name, data, sub, order, MODULE_KERNEL_MAXVER) + +/* + * The module declared with DECLARE_MODULE_TIED can only be loaded + * into the kernel with exactly the same __FreeBSD_version. + * + * Use it for modules that use kernel interfaces that are not stable + * even on STABLE/X branches. + */ +#define DECLARE_MODULE_TIED(name, data, sub, order) \ + DECLARE_MODULE_WITH_MAXVER(name, data, sub, order, __FreeBSD_version) + #define MODULE_VERSION(module, version) \ static struct mod_version _##module##_version = { \ version \ From owner-svn-src-stable-8@FreeBSD.ORG Wed Oct 27 16:01:58 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 605151065670; Wed, 27 Oct 2010 16:01:58 +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 4E5DC8FC12; Wed, 27 Oct 2010 16:01:58 +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 o9RG1vJd013246; Wed, 27 Oct 2010 16:01:57 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9RG1vZv013243; Wed, 27 Oct 2010 16:01:57 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010271601.o9RG1vZv013243@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 27 Oct 2010 16:01:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214422 - stable/8/share/man/man9 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 16:01:58 -0000 Author: kib Date: Wed Oct 27 16:01:57 2010 New Revision: 214422 URL: http://svn.freebsd.org/changeset/base/214422 Log: MFC r213983: Document vunref(9), add some important notes for vrele(9) and vput(9). Merge all three manpages to one, removing separate file for vput(9). MFC r214061 (by uqs): mdoc: fix markup typo. Deleted: stable/8/share/man/man9/vput.9 Modified: stable/8/share/man/man9/Makefile stable/8/share/man/man9/vrele.9 Directory Properties: stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Wed Oct 27 15:57:17 2010 (r214421) +++ stable/8/share/man/man9/Makefile Wed Oct 27 16:01:57 2010 (r214422) @@ -364,7 +364,6 @@ MAN= accept_filter.9 \ VOP_STRATEGY.9 \ VOP_VPTOCNP.9 \ VOP_VPTOFH.9 \ - vput.9 \ vref.9 \ vrefcnt.9 \ vrele.9 \ @@ -1359,6 +1358,8 @@ MLINKS+=VOP_RDWR.9 VOP_READ.9 \ VOP_RDWR.9 VOP_WRITE.9 MLINKS+=VOP_REMOVE.9 VOP_RMDIR.9 MLINKS+=vref.9 VREF.9 +MLINKS+=vrele.9 vput.9 \ + vrele.9 vunref.9 MLINKS+=vslock.9 vsunlock.9 MLINKS+=zero_copy.9 zero_copy_sockets.9 MLINKS+=zone.9 uma.9 \ Modified: stable/8/share/man/man9/vrele.9 ============================================================================== --- stable/8/share/man/man9/vrele.9 Wed Oct 27 15:57:17 2010 (r214421) +++ stable/8/share/man/man9/vrele.9 Wed Oct 27 16:01:57 2010 (r214422) @@ -1,6 +1,7 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson +.\" Copyright (c) 2010 Konstantin Belousov .\" .\" All rights reserved. .\" @@ -28,17 +29,23 @@ .\" .\" $FreeBSD$ .\" -.Dd July 24, 1996 +.Dd October 17, 2010 .Dt VRELE 9 .Os .Sh NAME -.Nm vrele +.Nm vput , +.Nm vrele , +.Nm vunref .Nd decrement the use count for a vnode .Sh SYNOPSIS .In sys/param.h .In sys/vnode.h .Ft void +.Fn vput "struct vnode *vp" +.Ft void .Fn vrele "struct vnode *vp" +.Ft void +.Fn vunref "struct vnode *vp" .Sh DESCRIPTION Decrement the .Va v_usecount @@ -48,18 +55,51 @@ field of a vnode. the vnode to decrement .El .Pp -Any code in the system which is using a vnode should call +The .Fn vrele -when it is finished with the vnode. +function takes an unlocked vnode and returns with the vnode unlocked. +.Pp +The +.Fn vput +function should be given a locked vnode as argument, the vnode is unlocked +after the function returned. +The +.Fn vput +is operationally equivalent to calling +.Xr VOP_UNLOCK 9 +followed by +.Xr vrele 9 , +with less overhead. +.Pp +The +.Fn vunref +function takes a locked vnode as argument, and returns with the vnode locked. +Nonetheless, the +.Fn vunref +might drop the vnode lock during the operation, so caller should not expect +that non-doomed vnode is still non-doomed after the function returned. +.Pp +Any code in the system which signified its use of a vnode by usecount +should call one of the listed function to decrement use counter. If the .Va v_usecount -field of the vnode reaches zero, then it will be placed on the free list. +field of the non-doomed vnode reaches zero, then it will be inactivated +and placed on the free list. +Since the functions might need to call VOPs for the vnode, the +.Va Giant +mutex should be conditionally locked around the call. +.Pp +The hold count for the vnode is always greater or equal to the usecount. +Non-forced unmount fails when mount point owns a vnode that has non-zero +usecount, see +.Xr vflush 9 . .Sh SEE ALSO .Xr vget 9 , .Xr vnode 9 , -.Xr vput 9 , .Xr vref 9 , .Xr vrefcnt 9 .Sh AUTHORS This manual page was written by -.An Doug Rabson . +.An Doug Rabson +and +.An Konstantin Belousov . From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 00:54:18 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E87C410656A6; Thu, 28 Oct 2010 00:54:18 +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 BBFA18FC13; Thu, 28 Oct 2010 00:54: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 o9S0sIik050351; Thu, 28 Oct 2010 00:54:18 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9S0sIIE050349; Thu, 28 Oct 2010 00:54:18 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201010280054.o9S0sIIE050349@svn.freebsd.org> From: Edwin Groothuis Date: Thu, 28 Oct 2010 00:54:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214442 - stable/8/usr.sbin/lpr/lpr X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 00:54:19 -0000 Author: edwin Date: Thu Oct 28 00:54:18 2010 New Revision: 214442 URL: http://svn.freebsd.org/changeset/base/214442 Log: MFC of 214124 Fix printing of files located on ZFS filesystem with an st_dev or st_ino larger than 2**31. From the PR: Printing from a ZFS filesystem using 'lp' fails and returns an email reporting "Your printer job was not printed because it was not linked to the original file". In order to protect against files being switched when files are printed using 'lp' or 'lpr -s', the st_dev and st_ino values for the original file are saved by lpr and verified by lpd before the file is printed. Unfortunately, lpr prints both values using '%d' (although both fields are unsigned) and lpd(8) assumes a string of decimal digits. ZFS (at least) generates st_dev values greater than 2^31-1, resulting in negative values being printed - which lpd cannot parse, leading it to report that the file has been switched. A similar problem would occur with large inode numbers. How-To-Repeat: Find a file with either st_dev or st_ino greater than 2^31-1 (stat(1) will report both numbers) and print it with 'lpq -s'. This should generate an email reporting that the file could not be printed because it was not linked to the original file PR: bin/151567 Submitted by: Peter Jeremy Modified: stable/8/usr.sbin/lpr/lpr/lpr.c Directory Properties: stable/8/usr.sbin/lpr/ (props changed) Modified: stable/8/usr.sbin/lpr/lpr/lpr.c ============================================================================== --- stable/8/usr.sbin/lpr/lpr/lpr.c Thu Oct 28 00:16:54 2010 (r214441) +++ stable/8/usr.sbin/lpr/lpr/lpr.c Thu Oct 28 00:54:18 2010 (r214442) @@ -386,7 +386,7 @@ main(int argc, char *argv[]) continue; /* file unreasonable */ if (sflag && (cp = linked(arg)) != NULL) { - (void) snprintf(buf, sizeof(buf), "%d %d", statb.st_dev, + (void) snprintf(buf, sizeof(buf), "%u %u", statb.st_dev, statb.st_ino); card('S', buf); if (format == 'p') From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 15:31:19 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D23D106564A; Thu, 28 Oct 2010 15:31:19 +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 0B7AC8FC0C; Thu, 28 Oct 2010 15:31: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 o9SFVIYK011303; Thu, 28 Oct 2010 15:31:18 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SFVILK011301; Thu, 28 Oct 2010 15:31:18 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201010281531.o9SFVILK011301@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 28 Oct 2010 15:31:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214451 - stable/8/sys/dev/mfi X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 15:31:19 -0000 Author: pluknet Date: Thu Oct 28 15:31:18 2010 New Revision: 214451 URL: http://svn.freebsd.org/changeset/base/214451 Log: MFC r214130. Update PD state firmware definitions: add copyback, system. Approved by: kib (mentor) Modified: stable/8/sys/dev/mfi/mfireg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/mfi/mfireg.h ============================================================================== --- stable/8/sys/dev/mfi/mfireg.h Thu Oct 28 14:21:18 2010 (r214450) +++ stable/8/sys/dev/mfi/mfireg.h Thu Oct 28 15:31:18 2010 (r214451) @@ -975,7 +975,9 @@ enum mfi_pd_state { MFI_PD_STATE_OFFLINE = 0x10, MFI_PD_STATE_FAILED = 0x11, MFI_PD_STATE_REBUILD = 0x14, - MFI_PD_STATE_ONLINE = 0x18 + MFI_PD_STATE_ONLINE = 0x18, + MFI_PD_STATE_COPYBACK = 0x20, + MFI_PD_STATE_SYSTEM = 0x40 }; union mfi_ld_ref { From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 15:41:28 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84334106564A; Thu, 28 Oct 2010 15:41:28 +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 728B78FC08; Thu, 28 Oct 2010 15:41: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 o9SFfSMI012205; Thu, 28 Oct 2010 15:41:28 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SFfS3L012203; Thu, 28 Oct 2010 15:41:28 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201010281541.o9SFfS3L012203@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 28 Oct 2010 15:41:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214453 - stable/8/usr.sbin/mfiutil X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 15:41:28 -0000 Author: pluknet Date: Thu Oct 28 15:41:28 2010 New Revision: 214453 URL: http://svn.freebsd.org/changeset/base/214453 Log: MFC r214131. Enable copyback and system PD states. Approved by: kib (mentor) Modified: stable/8/usr.sbin/mfiutil/mfi_drive.c Directory Properties: stable/8/usr.sbin/mfiutil/ (props changed) stable/8/usr.sbin/mfiutil/mfiutil.8 (props changed) Modified: stable/8/usr.sbin/mfiutil/mfi_drive.c ============================================================================== --- stable/8/usr.sbin/mfiutil/mfi_drive.c Thu Oct 28 15:37:58 2010 (r214452) +++ stable/8/usr.sbin/mfiutil/mfi_drive.c Thu Oct 28 15:41:28 2010 (r214453) @@ -65,6 +65,10 @@ mfi_pdstate(enum mfi_pd_state state) return ("REBUILD"); case MFI_PD_STATE_ONLINE: return ("ONLINE"); + case MFI_PD_STATE_COPYBACK: + return ("COPYBACK"); + case MFI_PD_STATE_SYSTEM: + return ("SYSTEM"); default: sprintf(buf, "PSTATE 0x%04x", state); return (buf); From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 16:46:27 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71448106566C; Thu, 28 Oct 2010 16:46:27 +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 5F30C8FC1D; Thu, 28 Oct 2010 16:46: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 o9SGkR0v016902; Thu, 28 Oct 2010 16:46:27 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SGkRki016900; Thu, 28 Oct 2010 16:46:27 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281646.o9SGkRki016900@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 16:46:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214458 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 16:46:27 -0000 Author: tuexen Date: Thu Oct 28 16:46:27 2010 New Revision: 214458 URL: http://svn.freebsd.org/changeset/base/214458 Log: MFC r210495: Fix a bug where the length of a FORWARD-TSN chunk was set incorrectly in the chunk. This resulted in malformed frames. Remove a duplicate assignment. Modified: stable/8/sys/netinet/sctp_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Oct 28 16:31:39 2010 (r214457) +++ stable/8/sys/netinet/sctp_output.c Thu Oct 28 16:46:27 2010 (r214458) @@ -2281,7 +2281,6 @@ sctp_is_ifa_addr_acceptable(struct sctp_ { uint8_t dest_is_global = 0; - /* * Here we determine if its a acceptable address. A acceptable * address means it is the same scope or higher scope but we can @@ -9813,7 +9812,8 @@ sctp_fill_in_rest: * peer ack point */ advance_peer_ack_point = last->rec.data.TSN_seq; - space_needed -= (cnt_of_skipped * sizeof(struct sctp_strseq)); + space_needed = sizeof(struct sctp_forward_tsn_chunk) + + cnt_of_skipped * sizeof(struct sctp_strseq); } chk->send_size = space_needed; /* Setup the chunk */ @@ -9822,8 +9822,6 @@ sctp_fill_in_rest: fwdtsn->ch.chunk_flags = 0; fwdtsn->ch.chunk_type = SCTP_FORWARD_CUM_TSN; fwdtsn->new_cumulative_tsn = htonl(advance_peer_ack_point); - chk->send_size = (sizeof(struct sctp_forward_tsn_chunk) + - (cnt_of_skipped * sizeof(struct sctp_strseq))); SCTP_BUF_LEN(chk->data) = chk->send_size; fwdtsn++; /*- From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 16:49:11 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0D25106564A; Thu, 28 Oct 2010 16:49:11 +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 BEA9A8FC12; Thu, 28 Oct 2010 16:49: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 o9SGnBpF017082; Thu, 28 Oct 2010 16:49:11 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SGnB3E017080; Thu, 28 Oct 2010 16:49:11 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281649.o9SGnB3E017080@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 16:49:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214459 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 16:49:11 -0000 Author: tuexen Date: Thu Oct 28 16:49:11 2010 New Revision: 214459 URL: http://svn.freebsd.org/changeset/base/214459 Log: MFC r210714: Cleanup code. Modified: stable/8/sys/netinet/sctp_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Oct 28 16:46:27 2010 (r214458) +++ stable/8/sys/netinet/sctp_output.c Thu Oct 28 16:49:11 2010 (r214459) @@ -9748,8 +9748,7 @@ sctp_fill_in_rest: unsigned int cnt_of_skipped = 0; TAILQ_FOREACH(at, &asoc->sent_queue, sctp_next) { - if ((at->sent != SCTP_FORWARD_TSN_SKIP) /* && (at->sent != - SCTP_DATAGRAM_ACKED) */ ) { + if (at->sent != SCTP_FORWARD_TSN_SKIP) { /* no more to look at */ break; } From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 16:51:57 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DF99106564A; Thu, 28 Oct 2010 16:51:57 +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 713948FC0A; Thu, 28 Oct 2010 16:51: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 o9SGpvC1017246; Thu, 28 Oct 2010 16:51:57 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SGpvDI017244; Thu, 28 Oct 2010 16:51:57 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281651.o9SGpvDI017244@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 16:51:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214460 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 16:51:57 -0000 Author: tuexen Date: Thu Oct 28 16:51:57 2010 New Revision: 214460 URL: http://svn.freebsd.org/changeset/base/214460 Log: MFC r210866: Fix a bug where endpoints bound to wildcard addresses where using addresses not announced to the peer due to address scoping. Modified: stable/8/sys/netinet/sctp_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Oct 28 16:49:11 2010 (r214459) +++ stable/8/sys/netinet/sctp_output.c Thu Oct 28 16:51:57 2010 (r214460) @@ -2740,6 +2740,15 @@ sctp_select_nth_preferred_addr_from_ifn_ } } if (stcb) { + if (sctp_is_address_in_scope(ifa, + stcb->asoc.ipv4_addr_legal, + stcb->asoc.ipv6_addr_legal, + stcb->asoc.loopback_scope, + stcb->asoc.ipv4_local_scope, + stcb->asoc.local_scope, + stcb->asoc.site_scope, 0) == 0) { + continue; + } if (((non_asoc_addr_ok == 0) && (sctp_is_addr_restricted(stcb, sifa))) || (non_asoc_addr_ok && @@ -2783,6 +2792,15 @@ sctp_count_num_preferred_boundall(struct continue; } if (stcb) { + if (sctp_is_address_in_scope(ifa, + stcb->asoc.ipv4_addr_legal, + stcb->asoc.ipv6_addr_legal, + stcb->asoc.loopback_scope, + stcb->asoc.ipv4_local_scope, + stcb->asoc.local_scope, + stcb->asoc.site_scope, 0) == 0) { + continue; + } if (((non_asoc_addr_ok == 0) && (sctp_is_addr_restricted(stcb, sifa))) || (non_asoc_addr_ok && @@ -2963,6 +2981,15 @@ bound_all_plan_b: if (sifa == NULL) continue; if (stcb) { + if (sctp_is_address_in_scope(sifa, + stcb->asoc.ipv4_addr_legal, + stcb->asoc.ipv6_addr_legal, + stcb->asoc.loopback_scope, + stcb->asoc.ipv4_local_scope, + stcb->asoc.local_scope, + stcb->asoc.site_scope, 0) == 0) { + continue; + } if (((non_asoc_addr_ok == 0) && (sctp_is_addr_restricted(stcb, sifa))) || (non_asoc_addr_ok && @@ -3005,6 +3032,15 @@ plan_d: if (sifa == NULL) continue; if (stcb) { + if (sctp_is_address_in_scope(sifa, + stcb->asoc.ipv4_addr_legal, + stcb->asoc.ipv6_addr_legal, + stcb->asoc.loopback_scope, + stcb->asoc.ipv4_local_scope, + stcb->asoc.local_scope, + stcb->asoc.site_scope, 0) == 0) { + continue; + } if (((non_asoc_addr_ok == 0) && (sctp_is_addr_restricted(stcb, sifa))) || (non_asoc_addr_ok && From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 16:53:55 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E737B106566B; Thu, 28 Oct 2010 16:53:54 +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 D516F8FC15; Thu, 28 Oct 2010 16:53: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 o9SGrswF017374; Thu, 28 Oct 2010 16:53:54 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SGrsVT017372; Thu, 28 Oct 2010 16:53:54 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281653.o9SGrsVT017372@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 16:53:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214461 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 16:53:55 -0000 Author: tuexen Date: Thu Oct 28 16:53:54 2010 New Revision: 214461 URL: http://svn.freebsd.org/changeset/base/214461 Log: MFC r211030: Fix a bug where MSG_TRUNC was not returned in all necessary cases for SOCK_DGRAM socket. MSG_TRUNC was only returned when some mbufs could not be copied to the application. If some data was left in the last mbuf, it was correctly discarded, but MSG_TRUNC was not set. Modified: stable/8/sys/kern/uipc_socket.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/uipc_socket.c ============================================================================== --- stable/8/sys/kern/uipc_socket.c Thu Oct 28 16:51:57 2010 (r214460) +++ stable/8/sys/kern/uipc_socket.c Thu Oct 28 16:53:54 2010 (r214461) @@ -2225,7 +2225,12 @@ soreceive_dgram(struct socket *so, struc m_freem(m); return (error); } - m = m_free(m); + if (len == m->m_len) + m = m_free(m); + else { + m->m_data += len; + m->m_len -= len; + } } if (m != NULL) flags |= MSG_TRUNC; From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 16:58:13 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 753D11065673; Thu, 28 Oct 2010 16:58:13 +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 61C8A8FC1A; Thu, 28 Oct 2010 16:58: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 o9SGwDPV017622; Thu, 28 Oct 2010 16:58:13 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SGwD1c017608; Thu, 28 Oct 2010 16:58:13 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281658.o9SGwD1c017608@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 16:58:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214462 - in stable/8/sys: netinet netinet6 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 16:58:13 -0000 Author: tuexen Date: Thu Oct 28 16:58:12 2010 New Revision: 214462 URL: http://svn.freebsd.org/changeset/base/214462 Log: MFC 211944: Fix the switching on/off of CMT using sysctl and socket option. Fix the switching on/off of PF and NR-SACKs using sysctl. Add minor improvement in handling malloc failures. Improve the address checks when sending. Modified: stable/8/sys/netinet/sctp.h stable/8/sys/netinet/sctp_cc_functions.c stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctp_pcb.h stable/8/sys/netinet/sctp_peeloff.c stable/8/sys/netinet/sctp_timer.c stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet/sctputil.c stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp.h ============================================================================== --- stable/8/sys/netinet/sctp.h Thu Oct 28 16:53:54 2010 (r214461) +++ stable/8/sys/netinet/sctp.h Thu Oct 28 16:58:12 2010 (r214462) @@ -155,10 +155,8 @@ struct sctp_paramhdr { /* CMT ON/OFF socket option */ #define SCTP_CMT_ON_OFF 0x00001200 #define SCTP_CMT_USE_DAC 0x00001201 -/* EY - NR_SACK on/off socket option */ -#define SCTP_NR_SACK_ON_OFF 0x00001300 /* JRS - Pluggable Congestion Control Socket option */ -#define SCTP_PLUGGABLE_CC 0x00001202 +#define SCTP_PLUGGABLE_CC 0x00001202 /* read only */ #define SCTP_GET_SNDBUF_USE 0x00001101 Modified: stable/8/sys/netinet/sctp_cc_functions.c ============================================================================== --- stable/8/sys/netinet/sctp_cc_functions.c Thu Oct 28 16:53:54 2010 (r214461) +++ stable/8/sys/netinet/sctp_cc_functions.c Thu Oct 28 16:58:12 2010 (r214462) @@ -71,7 +71,8 @@ sctp_cwnd_update_after_fr(struct sctp_tc * (net->fast_retran_loss_recovery == 0))) */ TAILQ_FOREACH(net, &asoc->nets, sctp_next) { - if ((asoc->fast_retran_loss_recovery == 0) || (SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 1)) { + if ((asoc->fast_retran_loss_recovery == 0) || + (asoc->sctp_cmt_on_off == 1)) { /* out of a RFC2582 Fast recovery window? */ if (net->net_ack > 0) { /* @@ -232,11 +233,11 @@ sctp_cwnd_update_after_sack(struct sctp_ * * Should we stop any running T3 timer here? */ - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && - SCTP_BASE_SYSCTL(sctp_cmt_pf) && + if ((asoc->sctp_cmt_on_off == 1) && + (asoc->sctp_cmt_pf > 0) && ((net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF)) { net->dest_state &= ~SCTP_ADDR_PF; - net->cwnd = net->mtu * SCTP_BASE_SYSCTL(sctp_cmt_pf); + net->cwnd = net->mtu * asoc->sctp_cmt_pf; SCTPDBG(SCTP_DEBUG_INDATA1, "Destination %p moved from PF to reachable with cwnd %d.\n", net, net->cwnd); /* @@ -260,7 +261,9 @@ sctp_cwnd_update_after_sack(struct sctp_ */ #endif - if (asoc->fast_retran_loss_recovery && will_exit == 0 && SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0) { + if (asoc->fast_retran_loss_recovery && + (will_exit == 0) && + (asoc->sctp_cmt_on_off == 0)) { /* * If we are in loss recovery we skip any cwnd * update @@ -271,7 +274,8 @@ sctp_cwnd_update_after_sack(struct sctp_ * CMT: CUC algorithm. Update cwnd if pseudo-cumack has * moved. */ - if (accum_moved || (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && net->new_pseudo_cumack)) { + if (accum_moved || + ((asoc->sctp_cmt_on_off == 1) && net->new_pseudo_cumack)) { /* If the cumulative ack moved we can proceed */ if (net->cwnd <= net->ssthresh) { /* We are in slow start */ @@ -697,7 +701,8 @@ sctp_hs_cwnd_update_after_fr(struct sctp * (net->fast_retran_loss_recovery == 0))) */ TAILQ_FOREACH(net, &asoc->nets, sctp_next) { - if ((asoc->fast_retran_loss_recovery == 0) || (SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 1)) { + if ((asoc->fast_retran_loss_recovery == 0) || + (asoc->sctp_cmt_on_off == 1)) { /* out of a RFC2582 Fast recovery window? */ if (net->net_ack > 0) { /* @@ -850,11 +855,11 @@ sctp_hs_cwnd_update_after_sack(struct sc * * Should we stop any running T3 timer here? */ - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && - SCTP_BASE_SYSCTL(sctp_cmt_pf) && + if ((asoc->sctp_cmt_on_off == 1) && + (asoc->sctp_cmt_pf > 0) && ((net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF)) { net->dest_state &= ~SCTP_ADDR_PF; - net->cwnd = net->mtu * SCTP_BASE_SYSCTL(sctp_cmt_pf); + net->cwnd = net->mtu * asoc->sctp_cmt_pf; SCTPDBG(SCTP_DEBUG_INDATA1, "Destination %p moved from PF to reachable with cwnd %d.\n", net, net->cwnd); /* @@ -878,7 +883,9 @@ sctp_hs_cwnd_update_after_sack(struct sc */ #endif - if (asoc->fast_retran_loss_recovery && will_exit == 0 && SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0) { + if (asoc->fast_retran_loss_recovery && + (will_exit == 0) && + (asoc->sctp_cmt_on_off == 0)) { /* * If we are in loss recovery we skip any cwnd * update @@ -889,7 +896,8 @@ sctp_hs_cwnd_update_after_sack(struct sc * CMT: CUC algorithm. Update cwnd if pseudo-cumack has * moved. */ - if (accum_moved || (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && net->new_pseudo_cumack)) { + if (accum_moved || + ((asoc->sctp_cmt_on_off == 1) && net->new_pseudo_cumack)) { /* If the cumulative ack moved we can proceed */ if (net->cwnd <= net->ssthresh) { /* We are in slow start */ @@ -1333,11 +1341,11 @@ sctp_htcp_cwnd_update_after_sack(struct * * Should we stop any running T3 timer here? */ - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && - SCTP_BASE_SYSCTL(sctp_cmt_pf) && + if ((asoc->sctp_cmt_on_off == 1) && + (asoc->sctp_cmt_pf > 0) && ((net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF)) { net->dest_state &= ~SCTP_ADDR_PF; - net->cwnd = net->mtu * SCTP_BASE_SYSCTL(sctp_cmt_pf); + net->cwnd = net->mtu * asoc->sctp_cmt_pf; SCTPDBG(SCTP_DEBUG_INDATA1, "Destination %p moved from PF to reachable with cwnd %d.\n", net, net->cwnd); /* @@ -1361,7 +1369,9 @@ sctp_htcp_cwnd_update_after_sack(struct */ #endif - if (asoc->fast_retran_loss_recovery && will_exit == 0 && SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0) { + if (asoc->fast_retran_loss_recovery && + will_exit == 0 && + (asoc->sctp_cmt_on_off == 0)) { /* * If we are in loss recovery we skip any cwnd * update @@ -1372,7 +1382,8 @@ sctp_htcp_cwnd_update_after_sack(struct * CMT: CUC algorithm. Update cwnd if pseudo-cumack has * moved. */ - if (accum_moved || (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && net->new_pseudo_cumack)) { + if (accum_moved || + ((asoc->sctp_cmt_on_off == 1) && net->new_pseudo_cumack)) { htcp_cong_avoid(stcb, net); measure_achieved_throughput(stcb, net); } else { @@ -1412,7 +1423,8 @@ sctp_htcp_cwnd_update_after_fr(struct sc * (net->fast_retran_loss_recovery == 0))) */ TAILQ_FOREACH(net, &asoc->nets, sctp_next) { - if ((asoc->fast_retran_loss_recovery == 0) || (SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 1)) { + if ((asoc->fast_retran_loss_recovery == 0) || + (asoc->sctp_cmt_on_off == 1)) { /* out of a RFC2582 Fast recovery window? */ if (net->net_ack > 0) { /* Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Thu Oct 28 16:53:54 2010 (r214461) +++ stable/8/sys/netinet/sctp_indata.c Thu Oct 28 16:58:12 2010 (r214462) @@ -2475,7 +2475,7 @@ sctp_sack_check(struct sctp_tcb *stcb, i (stcb->asoc.data_pkts_seen >= stcb->asoc.sack_freq) /* hit limit of pkts */ ) { - if ((SCTP_BASE_SYSCTL(sctp_cmt_on_off)) && + if ((stcb->asoc.sctp_cmt_on_off == 1) && (SCTP_BASE_SYSCTL(sctp_cmt_use_dac)) && (stcb->asoc.send_sack == 0) && (stcb->asoc.numduptsns == 0) && @@ -3265,7 +3265,8 @@ sctp_strike_gap_ack_chunks(struct sctp_t } /* CMT DAC algo: finding out if SACK is a mixed SACK */ - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && SCTP_BASE_SYSCTL(sctp_cmt_use_dac)) { + if ((asoc->sctp_cmt_on_off == 1) && + SCTP_BASE_SYSCTL(sctp_cmt_use_dac)) { TAILQ_FOREACH(net, &asoc->nets, sctp_next) { if (net->saw_newack) num_dests_sacked++; @@ -3381,7 +3382,8 @@ sctp_strike_gap_ack_chunks(struct sctp_t if (tp1->sent < SCTP_DATAGRAM_RESEND) { tp1->sent++; } - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && SCTP_BASE_SYSCTL(sctp_cmt_use_dac)) { + if ((asoc->sctp_cmt_on_off == 1) && + SCTP_BASE_SYSCTL(sctp_cmt_use_dac)) { /* * CMT DAC algorithm: If SACK flag is set to * 0, then lowest_newack test will not pass @@ -3405,7 +3407,8 @@ sctp_strike_gap_ack_chunks(struct sctp_t tp1->sent++; } } - } else if ((tp1->rec.data.doing_fast_retransmit) && (SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0)) { + } else if ((tp1->rec.data.doing_fast_retransmit) && + (asoc->sctp_cmt_on_off == 0)) { /* * For those that have done a FR we must take * special consideration if we strike. I.e the @@ -3445,7 +3448,8 @@ sctp_strike_gap_ack_chunks(struct sctp_t tp1->sent++; } strike_flag = 1; - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && SCTP_BASE_SYSCTL(sctp_cmt_use_dac)) { + if ((asoc->sctp_cmt_on_off == 1) && + SCTP_BASE_SYSCTL(sctp_cmt_use_dac)) { /* * CMT DAC algorithm: If * SACK flag is set to 0, @@ -3505,7 +3509,8 @@ sctp_strike_gap_ack_chunks(struct sctp_t if (tp1->sent < SCTP_DATAGRAM_RESEND) { tp1->sent++; } - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && SCTP_BASE_SYSCTL(sctp_cmt_use_dac)) { + if ((asoc->sctp_cmt_on_off == 1) && + SCTP_BASE_SYSCTL(sctp_cmt_use_dac)) { /* * CMT DAC algorithm: If SACK flag is set to * 0, then lowest_newack test will not pass @@ -3584,7 +3589,7 @@ sctp_strike_gap_ack_chunks(struct sctp_t SCTP_STAT_INCR(sctps_sendmultfastretrans); } sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt); - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off)) { + if (asoc->sctp_cmt_on_off == 1) { /* * CMT: Using RTX_SSTHRESH policy for CMT. * If CMT is being used, then pick dest with @@ -3593,7 +3598,7 @@ sctp_strike_gap_ack_chunks(struct sctp_t tp1->no_fr_allowed = 1; alt = tp1->whoTo; /* sa_ignore NO_NULL_CHK */ - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && SCTP_BASE_SYSCTL(sctp_cmt_pf)) { + if (asoc->sctp_cmt_pf > 0) { /* * JRS 5/18/07 - If CMT PF is on, * use the PF version of @@ -4800,7 +4805,7 @@ sctp_handle_sack(struct mbuf *m, int off /*******************************************/ /* cancel ALL T3-send timer if accum moved */ /*******************************************/ - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off)) { + if (asoc->sctp_cmt_on_off == 1) { TAILQ_FOREACH(net, &asoc->nets, sctp_next) { if (net->new_pseudo_cumack) sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, @@ -5100,7 +5105,9 @@ done_with_it: * to be done. Setting this_sack_lowest_newack to the cum_ack will * automatically ensure that. */ - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && SCTP_BASE_SYSCTL(sctp_cmt_use_dac) && (cmt_dac_flag == 0)) { + if ((asoc->sctp_cmt_on_off == 1) && + SCTP_BASE_SYSCTL(sctp_cmt_use_dac) && + (cmt_dac_flag == 0)) { this_sack_lowest_newack = cum_ack; } if ((num_seg > 0) || (num_nr_seg > 0)) { Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Oct 28 16:53:54 2010 (r214461) +++ stable/8/sys/netinet/sctp_input.c Thu Oct 28 16:58:12 2010 (r214462) @@ -618,16 +618,16 @@ sctp_handle_heartbeat_ack(struct sctp_he * timer is running, for the destination, stop the timer because a * PF-heartbeat was received. */ - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && - SCTP_BASE_SYSCTL(sctp_cmt_pf) && - (net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF) { + if ((stcb->asoc.sctp_cmt_on_off == 1) && + (stcb->asoc.sctp_cmt_pf > 0) && + ((net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF)) { if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_INPUT + SCTP_LOC_5); } net->dest_state &= ~SCTP_ADDR_PF; - net->cwnd = net->mtu * SCTP_BASE_SYSCTL(sctp_cmt_pf); + net->cwnd = net->mtu * stcb->asoc.sctp_cmt_pf; SCTPDBG(SCTP_DEBUG_INPUT1, "Destination %p moved from PF to reachable with cwnd %d.\n", net, net->cwnd); } @@ -2723,6 +2723,7 @@ sctp_handle_cookie_echo(struct mbuf *m, inp->sctp_mobility_features = (*inp_p)->sctp_mobility_features; 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->partial_delivery_point = (*inp_p)->partial_delivery_point; inp->sctp_context = (*inp_p)->sctp_context; inp->inp_starting_point_for_iterator = NULL; @@ -3067,7 +3068,7 @@ process_chunk_drop(struct sctp_tcb *stcb struct sctp_nets *net, uint8_t flg) { switch (desc->chunk_type) { - case SCTP_DATA: + case SCTP_DATA: /* find the tsn to resend (possibly */ { uint32_t tsn; @@ -4586,8 +4587,6 @@ process_control_chunks: return (NULL); break; case SCTP_SELECTIVE_ACK: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SACK\n"); - SCTP_STAT_INCR(sctps_recvsacks); { struct sctp_sack_chunk *sack; int abort_now = 0; @@ -4597,6 +4596,8 @@ process_control_chunks: int offset_seg, offset_dup; int nonce_sum_flag; + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SACK\n"); + SCTP_STAT_INCR(sctps_recvsacks); if (stcb == NULL) { SCTPDBG(SCTP_DEBUG_INDATA1, "No stcb when processing SACK chunk\n"); break; @@ -4673,8 +4674,6 @@ process_control_chunks: * nr_sack chunk */ case SCTP_NR_SELECTIVE_ACK: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_NR_SACK\n"); - SCTP_STAT_INCR(sctps_recvsacks); { struct sctp_nr_sack_chunk *nr_sack; int abort_now = 0; @@ -4684,13 +4683,10 @@ process_control_chunks: int offset_seg, offset_dup; int nonce_sum_flag; - /* - * EY nr_sacks have not been negotiated but - * the peer end sent an nr_sack, silently - * discard the chunk - */ - if (!(SCTP_BASE_SYSCTL(sctp_nr_sack_on_off) && - stcb->asoc.peer_supports_nr_sack)) { + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_NR_SACK\n"); + SCTP_STAT_INCR(sctps_recvsacks); + if ((stcb->asoc.sctp_nr_sack_on_off == 0) || + (stcb->asoc.peer_supports_nr_sack == 0)) { goto unknown_chunk; } if (stcb == NULL) { Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Oct 28 16:53:54 2010 (r214461) +++ stable/8/sys/netinet/sctp_output.c Thu Oct 28 16:58:12 2010 (r214462) @@ -3686,7 +3686,8 @@ sctp_lowlevel_chunk_output(struct sctp_i * Stop any running T3 * timers here? */ - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && SCTP_BASE_SYSCTL(sctp_cmt_pf)) { + if ((stcb->asoc.sctp_cmt_on_off == 1) && + (stcb->asoc.sctp_cmt_pf > 0)) { net->dest_state &= ~SCTP_ADDR_PF; SCTPDBG(SCTP_DEBUG_OUTPUT1, "Destination %p moved from PF to unreachable.\n", net); @@ -4323,11 +4324,7 @@ sctp_send_initiate(struct sctp_inpcb *in if (!SCTP_BASE_SYSCTL(sctp_auth_disable)) { pr_supported->chunk_types[num_ext++] = SCTP_AUTHENTICATION; } - /* - * EY if the initiator supports nr_sacks, need to report that to - * responder in INIT chunk - */ - if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off)) { + if (stcb->asoc.sctp_nr_sack_on_off == 1) { pr_supported->chunk_types[num_ext++] = SCTP_NR_SELECTIVE_ACK; } p_len = sizeof(*pr_supported) + num_ext; @@ -5447,10 +5444,6 @@ do_a_abort: pr_supported->chunk_types[num_ext++] = SCTP_STREAM_RESET; if (!SCTP_BASE_SYSCTL(sctp_auth_disable)) pr_supported->chunk_types[num_ext++] = SCTP_AUTHENTICATION; - /* - * EY if the sysctl variable is set, tell the assoc. initiator that - * we do nr_sack - */ if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off)) pr_supported->chunk_types[num_ext++] = SCTP_NR_SELECTIVE_ACK; p_len = sizeof(*pr_supported) + num_ext; @@ -7267,7 +7260,8 @@ sctp_fill_outqueue(struct sctp_tcb *stcb if (sp == NULL) { break; } - if ((sp->net != net) && (SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0)) { + if ((sp->net != net) && + (asoc->sctp_cmt_on_off == 0)) { /* none for this network */ if (locked) { break; @@ -7326,11 +7320,11 @@ sctp_fill_outqueue(struct sctp_tcb *stcb *quit_now = 1; if (total_moved == 0) { - if ((SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0) && + if ((stcb->asoc.sctp_cmt_on_off == 0) && (net == stcb->asoc.primary_destination)) { /* ran dry for primary network net */ SCTP_STAT_INCR(sctps_primary_randry); - } else if (SCTP_BASE_SYSCTL(sctp_cmt_on_off)) { + } else if (stcb->asoc.sctp_cmt_on_off == 1) { /* ran dry with CMT on */ SCTP_STAT_INCR(sctps_cmt_randry); } @@ -7363,7 +7357,8 @@ sctp_move_to_an_alt(struct sctp_tcb *stc * destination using the PF algorithm for finding alternate * destinations. */ - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && SCTP_BASE_SYSCTL(sctp_cmt_pf)) { + if ((asoc->sctp_cmt_on_off == 1) && + (asoc->sctp_cmt_pf > 0)) { a_net = sctp_find_alternate_net(stcb, net, 2); } else { a_net = sctp_find_alternate_net(stcb, net, 0); @@ -7499,7 +7494,8 @@ sctp_med_chunk_output(struct sctp_inpcb } continue; } - if ((SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0) && (net->ref_count < 2)) { + if ((asoc->sctp_cmt_on_off == 0) && + (net->ref_count < 2)) { /* nothing can be in queue for this guy */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) { sctp_log_cwnd(stcb, net, 2, @@ -7534,7 +7530,7 @@ sctp_med_chunk_output(struct sctp_inpcb *reason_code = 8; return (0); } - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off)) { + if (asoc->sctp_cmt_on_off == 1) { /* get the last start point */ start_at = asoc->last_net_cmt_send_started; if (start_at == NULL) { @@ -7560,7 +7556,7 @@ again_one_more_time: break; } tsns_sent = 0xa; - if ((SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0) && (net->ref_count < 2)) { + if ((asoc->sctp_cmt_on_off == 0) && (net->ref_count < 2)) { /* * Ref-count of 1 so we cannot have data or control * queued to this address. Skip it (non-CMT). @@ -8034,15 +8030,15 @@ again_one_more_time: } } /* JRI: if dest is in PF state, do not send data to it */ - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && - SCTP_BASE_SYSCTL(sctp_cmt_pf) && + if ((asoc->sctp_cmt_on_off == 1) && + (asoc->sctp_cmt_pf > 0) && (net->dest_state & SCTP_ADDR_PF)) { goto no_data_fill; } if (net->flight_size >= net->cwnd) { goto no_data_fill; } - if ((SCTP_BASE_SYSCTL(sctp_cmt_on_off)) && + if ((asoc->sctp_cmt_on_off == 1) && (net->flight_size > max_rwnd_per_dest)) { goto no_data_fill; } @@ -8096,7 +8092,7 @@ again_one_more_time: break; } nchk = TAILQ_NEXT(chk, sctp_next); - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off)) { + if (asoc->sctp_cmt_on_off == 1) { if (chk->whoTo != net) { /* * For CMT, steal the data @@ -8271,8 +8267,8 @@ no_data_fill: * restart it. */ sctp_timer_start(SCTP_TIMER_TYPE_SEND, inp, stcb, net); - } else if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && - SCTP_BASE_SYSCTL(sctp_cmt_pf) && + } else if ((asoc->sctp_cmt_on_off == 1) && + (asoc->sctp_cmt_pf > 0) && pf_hbflag && ((net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF) && (!SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer))) { @@ -9579,8 +9575,8 @@ sctp_chunk_output(struct sctp_inpcb *inp */ if (net->ref_count > 1) sctp_move_to_an_alt(stcb, asoc, net); - } else if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && - SCTP_BASE_SYSCTL(sctp_cmt_pf) && + } else if ((asoc->sctp_cmt_on_off == 1) && + (asoc->sctp_cmt_pf > 0) && ((net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF)) { /* * JRS 5/14/07 - If CMT PF is on and the current @@ -9926,8 +9922,8 @@ sctp_send_sack(struct sctp_tcb *stcb) uint8_t flags; uint8_t type; - if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off) && - stcb->asoc.peer_supports_nr_sack) { + if ((stcb->asoc.sctp_nr_sack_on_off == 1) && + (stcb->asoc.peer_supports_nr_sack == 1)) { type = SCTP_NR_SELECTIVE_ACK; } else { type = SCTP_SELECTIVE_ACK; @@ -10071,7 +10067,8 @@ sctp_send_sack(struct sctp_tcb *stcb) else flags = 0; - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && SCTP_BASE_SYSCTL(sctp_cmt_use_dac)) { + if ((asoc->sctp_cmt_on_off == 1) && + SCTP_BASE_SYSCTL(sctp_cmt_use_dac)) { /*- * CMT DAC algorithm: If 2 (i.e., 0x10) packets have been * received, then set high bit to 1, else 0. Reset @@ -10839,7 +10836,8 @@ sctp_send_hb(struct sctp_tcb *stcb, int * heartbeat is being sent is in PF state, do NOT do threshold * management. */ - if ((SCTP_BASE_SYSCTL(sctp_cmt_pf) == 0) || ((net->dest_state & SCTP_ADDR_PF) != SCTP_ADDR_PF)) { + if ((stcb->asoc.sctp_cmt_pf == 0) || + ((net->dest_state & SCTP_ADDR_PF) != SCTP_ADDR_PF)) { /* ok we have a destination that needs a beat */ /* lets do the theshold management Qiaobing style */ if (sctp_threshold_management(stcb->sctp_ep, stcb, net, @@ -12105,7 +12103,7 @@ sctp_sosend(struct socket *so, struct sctp_sndrcvinfo srcv; struct sockaddr *addr_to_use; -#ifdef INET6 +#if defined(INET) && defined(INET6) struct sockaddr_in sin; #endif @@ -12120,7 +12118,7 @@ sctp_sosend(struct socket *so, } } addr_to_use = addr; -#if defined(INET6) && !defined(__Userspace__) /* TODO port in6_sin6_2_sin */ +#if defined(INET) && defined(INET6) if ((addr) && (addr->sa_family == AF_INET6)) { struct sockaddr_in6 *sin6; @@ -12212,20 +12210,33 @@ sctp_lower_sosend(struct socket *so, SCTPDBG(SCTP_DEBUG_OUTPUT1, "Send called addr:%p send length %d\n", addr, sndlen); - /*- + /** * Pre-screen address, if one is given the sin-len * must be set correctly! */ if (addr) { - if ((addr->sa_family == AF_INET) && - (addr->sa_len != sizeof(struct sockaddr_in))) { - SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); - error = EINVAL; - goto out_unlocked; - } else if ((addr->sa_family == AF_INET6) && - (addr->sa_len != sizeof(struct sockaddr_in6))) { - SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); - error = EINVAL; + switch (addr->sa_family) { +#if defined(INET) + case AF_INET: + if (addr->sa_len != sizeof(struct sockaddr_in)) { + SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); + error = EINVAL; + goto out_unlocked; + } + break; +#endif +#if defined(INET6) + case AF_INET6: + if (addr->sa_len != sizeof(struct sockaddr_in6)) { + SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); + error = EINVAL; + goto out_unlocked; + } + break; +#endif + default: + SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EAFNOSUPPORT); + error = EAFNOSUPPORT; goto out_unlocked; } } @@ -12657,7 +12668,8 @@ sctp_lower_sosend(struct socket *so, error = EINVAL; goto out_unlocked; } - if ((net->flight_size > net->cwnd) && (SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0)) { + if ((net->flight_size > net->cwnd) && + (asoc->sctp_cmt_on_off == 0)) { /*- * CMT: Added check for CMT above. net above is the primary * dest. If CMT is ON, sender should always attempt to send @@ -13075,7 +13087,7 @@ skip_preblock: goto skip_out_eof; } if ((net->flight_size > net->cwnd) && - (SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0)) { + (asoc->sctp_cmt_on_off == 0)) { queue_only = 1; } else if (asoc->ifp_had_enobuf) { SCTP_STAT_INCR(sctps_ifnomemqueued); @@ -13349,7 +13361,7 @@ skip_out_eof: some_on_control = 1; } if ((net->flight_size > net->cwnd) && - (SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0)) { + (stcb->asoc.sctp_cmt_on_off == 0)) { queue_only = 1; } else if (asoc->ifp_had_enobuf) { SCTP_STAT_INCR(sctps_ifnomemqueued); Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Thu Oct 28 16:53:54 2010 (r214461) +++ stable/8/sys/netinet/sctp_pcb.c Thu Oct 28 16:58:12 2010 (r214462) @@ -2385,6 +2385,7 @@ sctp_inpcb_alloc(struct socket *so, uint inp->sctp_associd_counter = 1; 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); /* 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) { @@ -6241,10 +6242,7 @@ sctp_load_addresses_from_init(struct sct stcb->asoc.peer_supports_pktdrop = 1; break; case SCTP_NR_SELECTIVE_ACK: - if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off)) - stcb->asoc.peer_supports_nr_sack = 1; - else - stcb->asoc.peer_supports_nr_sack = 0; + stcb->asoc.peer_supports_nr_sack = 1; break; case SCTP_STREAM_RESET: stcb->asoc.peer_supports_strreset = 1; Modified: stable/8/sys/netinet/sctp_pcb.h ============================================================================== --- stable/8/sys/netinet/sctp_pcb.h Thu Oct 28 16:53:54 2010 (r214461) +++ stable/8/sys/netinet/sctp_pcb.h Thu Oct 28 16:58:12 2010 (r214462) @@ -389,6 +389,7 @@ struct sctp_inpcb { uint32_t sctp_frag_point; uint32_t partial_delivery_point; uint32_t sctp_context; + uint32_t sctp_cmt_on_off; struct sctp_nonpad_sndrcvinfo def_send; /*- * These three are here for the sosend_dgram Modified: stable/8/sys/netinet/sctp_peeloff.c ============================================================================== --- stable/8/sys/netinet/sctp_peeloff.c Thu Oct 28 16:53:54 2010 (r214461) +++ stable/8/sys/netinet/sctp_peeloff.c Thu Oct 28 16:58:12 2010 (r214462) @@ -112,6 +112,7 @@ sctp_do_peeloff(struct socket *head, str n_inp->sctp_features = inp->sctp_features; 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->partial_delivery_point = inp->partial_delivery_point; n_inp->sctp_context = inp->sctp_context; n_inp->inp_starting_point_for_iterator = NULL; @@ -183,6 +184,7 @@ sctp_get_peeloff(struct socket *head, sc (SCTP_PCB_COPY_FLAGS & inp->sctp_flags)); 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->partial_delivery_point = inp->partial_delivery_point; n_inp->sctp_context = inp->sctp_context; n_inp->inp_starting_point_for_iterator = NULL; Modified: stable/8/sys/netinet/sctp_timer.c ============================================================================== --- stable/8/sys/netinet/sctp_timer.c Thu Oct 28 16:53:54 2010 (r214461) +++ stable/8/sys/netinet/sctp_timer.c Thu Oct 28 16:58:12 2010 (r214462) @@ -215,7 +215,8 @@ sctp_threshold_management(struct sctp_in * not in PF state. */ /* Stop any running T3 timers here? */ - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && SCTP_BASE_SYSCTL(sctp_cmt_pf)) { + if ((stcb->asoc.sctp_cmt_on_off == 1) && + (stcb->asoc.sctp_cmt_pf > 0)) { net->dest_state &= ~SCTP_ADDR_PF; SCTPDBG(SCTP_DEBUG_TIMER4, "Destination %p moved from PF to unreachable.\n", net); @@ -419,7 +420,7 @@ sctp_find_alternate_net(struct sctp_tcb return (net); } min_errors_net->dest_state &= ~SCTP_ADDR_PF; - min_errors_net->cwnd = min_errors_net->mtu * SCTP_BASE_SYSCTL(sctp_cmt_pf); + min_errors_net->cwnd = min_errors_net->mtu * stcb->asoc.sctp_cmt_pf; if (SCTP_OS_TIMER_PENDING(&min_errors_net->rxt_timer.timer)) { sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, min_errors_net, @@ -843,7 +844,7 @@ start_again: /* * CMT: Do not allow FRs on retransmitted TSNs. */ - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 1) { + if (stcb->asoc.sctp_cmt_on_off == 1) { chk->no_fr_allowed = 1; } #ifdef THIS_SHOULD_NOT_BE_DONE @@ -1038,7 +1039,8 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, * addition, find an alternate destination with PF-based * find_alt_net(). */ - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && SCTP_BASE_SYSCTL(sctp_cmt_pf)) { + if ((stcb->asoc.sctp_cmt_on_off == 1) && + (stcb->asoc.sctp_cmt_pf > 0)) { if ((net->dest_state & SCTP_ADDR_PF) != SCTP_ADDR_PF) { net->dest_state |= SCTP_ADDR_PF; net->last_active = sctp_get_tick_count(); @@ -1046,7 +1048,7 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, net); } alt = sctp_find_alternate_net(stcb, net, 2); - } else if (SCTP_BASE_SYSCTL(sctp_cmt_on_off)) { + } else if (stcb->asoc.sctp_cmt_on_off == 1) { /* * CMT: Using RTX_SSTHRESH policy for CMT. If CMT is being * used, then pick dest with largest ssthresh for any @@ -1162,7 +1164,9 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, net->dest_state |= SCTP_ADDR_WAS_PRIMARY; } } - } else if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && SCTP_BASE_SYSCTL(sctp_cmt_pf) && (net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF) { + } else if ((stcb->asoc.sctp_cmt_on_off == 1) && + (stcb->asoc.sctp_cmt_pf > 0) && + ((net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF)) { /* * JRS 5/14/07 - If the destination hasn't failed completely * but is in PF state, a PF-heartbeat needs to be sent Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Thu Oct 28 16:53:54 2010 (r214461) +++ stable/8/sys/netinet/sctp_usrreq.c Thu Oct 28 16:58:12 2010 (r214462) @@ -300,7 +300,8 @@ sctp_notify(struct sctp_inpcb *inp, * PF state. */ /* Stop any running T3 timers here? */ - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && SCTP_BASE_SYSCTL(sctp_cmt_pf)) { + if ((stcb->asoc.sctp_cmt_on_off == 1) && + (stcb->asoc.sctp_cmt_pf > 0)) { net->dest_state &= ~SCTP_ADDR_PF; SCTPDBG(SCTP_DEBUG_TIMER4, "Destination %p moved from PF to unreachable.\n", net); @@ -1717,42 +1718,14 @@ flags_out: struct sctp_assoc_value *av; SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, *optsize); - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off)) { - SCTP_FIND_STCB(inp, stcb, av->assoc_id); - if (stcb) { - av->assoc_value = stcb->asoc.sctp_cmt_on_off; - SCTP_TCB_UNLOCK(stcb); - - } else { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTCONN); - error = ENOTCONN; - } - } else { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOPROTOOPT); - error = ENOPROTOOPT; - } - *optsize = sizeof(*av); - } - break; - /* EY - set socket option for nr_sacks */ - case SCTP_NR_SACK_ON_OFF: - { - struct sctp_assoc_value *av; - - SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, *optsize); - if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off)) { - SCTP_FIND_STCB(inp, stcb, av->assoc_id); - if (stcb) { - av->assoc_value = stcb->asoc.sctp_nr_sack_on_off; - SCTP_TCB_UNLOCK(stcb); - - } else { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTCONN); - error = ENOTCONN; - } + SCTP_FIND_STCB(inp, stcb, av->assoc_id); + if (stcb) { + av->assoc_value = stcb->asoc.sctp_cmt_on_off; + SCTP_TCB_UNLOCK(stcb); } else { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOPROTOOPT); - error = ENOPROTOOPT; + SCTP_INP_RLOCK(inp); + av->assoc_value = inp->sctp_cmt_on_off; + SCTP_INP_RUNLOCK(inp); } *optsize = sizeof(*av); } @@ -2827,44 +2800,28 @@ sctp_setopt(struct socket *so, int optna } break; case SCTP_CMT_ON_OFF: - { + if (SCTP_BASE_SYSCTL(sctp_cmt_on_off)) { struct sctp_assoc_value *av; SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, optsize); - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off)) { - SCTP_FIND_STCB(inp, stcb, av->assoc_id); - if (stcb) { - stcb->asoc.sctp_cmt_on_off = (uint8_t) av->assoc_value; - SCTP_TCB_UNLOCK(stcb); - } else { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTCONN); - error = ENOTCONN; - } - } else { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOPROTOOPT); - error = ENOPROTOOPT; - } - } - break; - /* EY nr_sack_on_off socket option */ - case SCTP_NR_SACK_ON_OFF: - { - struct sctp_assoc_value *av; - - SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, optsize); - if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off)) { - SCTP_FIND_STCB(inp, stcb, av->assoc_id); - if (stcb) { - stcb->asoc.sctp_nr_sack_on_off = (uint8_t) av->assoc_value; - SCTP_TCB_UNLOCK(stcb); - } else { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTCONN); - error = ENOTCONN; - } + SCTP_FIND_STCB(inp, stcb, av->assoc_id); + if (stcb) { + if (av->assoc_value != 0) + stcb->asoc.sctp_cmt_on_off = 1; + else + stcb->asoc.sctp_cmt_on_off = 0; + SCTP_TCB_UNLOCK(stcb); } else { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOPROTOOPT); - error = ENOPROTOOPT; + SCTP_INP_WLOCK(inp); + if (av->assoc_value != 0) + inp->sctp_cmt_on_off = 1; + else + inp->sctp_cmt_on_off = 0; + SCTP_INP_WUNLOCK(inp); } + } else { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOPROTOOPT); + error = ENOPROTOOPT; } break; /* JRS - Set socket option for pluggable congestion control */ Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Oct 28 16:53:54 2010 (r214461) +++ stable/8/sys/netinet/sctputil.c Thu Oct 28 16:58:12 2010 (r214462) @@ -893,10 +893,8 @@ sctp_init_asoc(struct sctp_inpcb *m, str asoc->max_burst = m->sctp_ep.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 = (uint8_t) SCTP_BASE_SYSCTL(sctp_cmt_on_off); - /* EY Init nr_sack variable */ + asoc->sctp_cmt_on_off = m->sctp_cmt_on_off; asoc->sctp_nr_sack_on_off = (uint8_t) SCTP_BASE_SYSCTL(sctp_nr_sack_on_off); - /* JRS 5/21/07 - Init CMT PF variables */ asoc->sctp_cmt_pf = (uint8_t) SCTP_BASE_SYSCTL(sctp_cmt_pf); asoc->sctp_frag_point = m->sctp_frag_point; #ifdef INET @@ -4210,7 +4208,7 @@ void sctp_print_address_pkt(struct ip *iph, struct sctphdr *sh) { switch (iph->ip_v) { - case IPVERSION: + case IPVERSION: { struct sockaddr_in lsa, fsa; Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Thu Oct 28 16:53:54 2010 (r214461) +++ stable/8/sys/netinet6/sctp6_usrreq.c Thu Oct 28 16:58:12 2010 (r214462) @@ -414,7 +414,8 @@ sctp6_notify(struct sctp_inpcb *inp, * PF state. */ /* Stop any running T3 timers here? */ - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && SCTP_BASE_SYSCTL(sctp_cmt_pf)) { + if ((stcb->asoc.sctp_cmt_on_off == 1) && + (stcb->asoc.sctp_cmt_pf > 0)) { net->dest_state &= ~SCTP_ADDR_PF; SCTPDBG(SCTP_DEBUG_TIMER4, "Destination %p moved from PF to unreachable.\n", net); @@ -1069,6 +1070,8 @@ sctp6_getaddr(struct socket *so, struct * Do the malloc first in case it blocks. */ SCTP_MALLOC_SONAME(sin6, struct sockaddr_in6 *, sizeof *sin6); + if (sin6 == NULL) + return ENOMEM; sin6->sin6_family = AF_INET6; sin6->sin6_len = sizeof(*sin6); @@ -1173,6 +1176,8 @@ sctp6_peeraddr(struct socket *so, struct return (ENOTCONN); } SCTP_MALLOC_SONAME(sin6, struct sockaddr_in6 *, sizeof *sin6); + if (sin6 == NULL) + return (ENOMEM); sin6->sin6_family = AF_INET6; sin6->sin6_len = sizeof(*sin6); From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 17:00:31 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E457F1065670; Thu, 28 Oct 2010 17:00:31 +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 D1DCD8FC26; Thu, 28 Oct 2010 17:00: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 o9SH0V7A017780; Thu, 28 Oct 2010 17:00:31 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SH0VGg017778; Thu, 28 Oct 2010 17:00:31 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281700.o9SH0VGg017778@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 17:00:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214463 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 17:00:32 -0000 Author: tuexen Date: Thu Oct 28 17:00:31 2010 New Revision: 214463 URL: http://svn.freebsd.org/changeset/base/214463 Log: MFC r211950: Bugfix: Do not send a packet drop report in response to a received INIT-ACK with incorrect CRC. Modified: stable/8/sys/netinet/sctp_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Oct 28 16:58:12 2010 (r214462) +++ stable/8/sys/netinet/sctp_output.c Thu Oct 28 17:00:31 2010 (r214463) @@ -11001,9 +11001,12 @@ sctp_send_packet_dropped(struct sctp_tcb switch (ch->chunk_type) { case SCTP_PACKET_DROPPED: case SCTP_ABORT_ASSOCIATION: - /*- - * we don't respond with an PKT-DROP to an ABORT - * or PKT-DROP + case SCTP_INITIATION_ACK: + /** + * We don't respond with an PKT-DROP to an ABORT + * or PKT-DROP. We also do not respond to an + * INIT-ACK, because we can't know if the initiation + * tag is correct or not. */ sctp_free_a_chunk(stcb, chk); return; From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 17:02:36 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADBB71065732; Thu, 28 Oct 2010 17:02:36 +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 9A1668FC1C; Thu, 28 Oct 2010 17:02: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 o9SH2ald017929; Thu, 28 Oct 2010 17:02:36 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SH2aIC017920; Thu, 28 Oct 2010 17:02:36 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281702.o9SH2aIC017920@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 17:02:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214464 - in stable/8/sys: netinet netinet6 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 17:02:36 -0000 Author: tuexen Date: Thu Oct 28 17:02:36 2010 New Revision: 214464 URL: http://svn.freebsd.org/changeset/base/214464 Log: MFC 211969: Fix the the SCTP_WITH_NO_CSUM option when used in combination with interface supporting CRC offload. While at it, make use of the feature that the loopback interface provides CRC offloading. Modified: stable/8/sys/netinet/sctp_crc32.c stable/8/sys/netinet/sctp_crc32.h stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_os_bsd.h stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_sysctl.c stable/8/sys/netinet/sctp_sysctl.h stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_crc32.c ============================================================================== --- stable/8/sys/netinet/sctp_crc32.c Thu Oct 28 17:00:31 2010 (r214463) +++ stable/8/sys/netinet/sctp_crc32.c Thu Oct 28 17:02:36 2010 (r214464) @@ -115,20 +115,15 @@ sctp_calculate_cksum(struct mbuf *m, uin return (base); } -#else - -uint32_t -sctp_calculate_cksum(struct mbuf *m, uint32_t offset) -{ - return (0); -} - #endif /* !defined(SCTP_WITH_NO_CSUM) */ void sctp_delayed_cksum(struct mbuf *m, uint32_t offset) { +#if defined(SCTP_WITH_NO_CSUM) + panic("sctp_delayed_cksum() called when using no SCTP CRC."); +#else struct ip *ip; uint32_t checksum; @@ -149,4 +144,5 @@ sctp_delayed_cksum(struct mbuf *m, uint3 return; } *(uint32_t *) (m->m_data + offset) = checksum; +#endif } Modified: stable/8/sys/netinet/sctp_crc32.h ============================================================================== --- stable/8/sys/netinet/sctp_crc32.h Thu Oct 28 17:00:31 2010 (r214463) +++ stable/8/sys/netinet/sctp_crc32.h Thu Oct 28 17:02:36 2010 (r214464) @@ -36,11 +36,12 @@ __FBSDID("$FreeBSD$"); #ifndef __crc32c_h__ #define __crc32c_h__ -#if defined(_KERNEL) || defined(__Userspace__) - +#if defined(_KERNEL) +#if !defined(SCTP_WITH_NO_CSUM) uint32_t sctp_calculate_cksum(struct mbuf *, uint32_t); + +#endif void sctp_delayed_cksum(struct mbuf *, uint32_t offset); #endif /* _KERNEL */ - #endif /* __crc32c_h__ */ Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Oct 28 17:00:31 2010 (r214463) +++ stable/8/sys/netinet/sctp_input.c Thu Oct 28 17:02:36 2010 (r214464) @@ -3068,7 +3068,7 @@ process_chunk_drop(struct sctp_tcb *stcb struct sctp_nets *net, uint8_t flg) { switch (desc->chunk_type) { - case SCTP_DATA: + case SCTP_DATA: /* find the tsn to resend (possibly */ { uint32_t tsn; @@ -5717,14 +5717,17 @@ sctp_input_with_port(struct mbuf *i_pak, struct ip *ip; struct sctphdr *sh; struct sctp_inpcb *inp = NULL; - - uint32_t check, calc_check; struct sctp_nets *net; struct sctp_tcb *stcb = NULL; struct sctp_chunkhdr *ch; int refcount_up = 0; int length, mlen, offset; +#if !defined(SCTP_WITH_NO_CSUM) + uint32_t check, calc_check; + +#endif + if (SCTP_GET_PKT_VRFID(i_pak, vrf_id)) { SCTP_RELEASE_PKT(i_pak); return; @@ -5799,18 +5802,14 @@ sctp_input_with_port(struct mbuf *i_pak, m->m_pkthdr.len, if_name(m->m_pkthdr.rcvif), m->m_pkthdr.csum_flags); +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_recvnocrc); +#else if (m->m_pkthdr.csum_flags & CSUM_SCTP_VALID) { SCTP_STAT_INCR(sctps_recvhwcrc); goto sctp_skip_csum_4; } check = sh->checksum; /* save incoming checksum */ - if ((check == 0) && (SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback)) && - ((ip->ip_src.s_addr == ip->ip_dst.s_addr) || - (SCTP_IS_IT_LOOPBACK(m))) - ) { - SCTP_STAT_INCR(sctps_recvnocrc); - goto sctp_skip_csum_4; - } sh->checksum = 0; /* prepare for calc */ calc_check = sctp_calculate_cksum(m, iphlen); sh->checksum = check; @@ -5840,6 +5839,7 @@ sctp_input_with_port(struct mbuf *i_pak, goto bad; } sctp_skip_csum_4: +#endif /* destination port of 0 is illegal, based on RFC2960. */ if (sh->dest_port == 0) { SCTP_STAT_INCR(sctps_hdrops); Modified: stable/8/sys/netinet/sctp_os_bsd.h ============================================================================== --- stable/8/sys/netinet/sctp_os_bsd.h Thu Oct 28 17:00:31 2010 (r214463) +++ stable/8/sys/netinet/sctp_os_bsd.h Thu Oct 28 17:02:36 2010 (r214464) @@ -433,20 +433,21 @@ typedef struct rtentry sctp_rtentry_t; */ #define SCTP_IP_OUTPUT(result, o_pak, ro, stcb, vrf_id) \ { \ - int o_flgs = 0; \ - if (stcb && stcb->sctp_ep && stcb->sctp_ep->sctp_socket) { \ - o_flgs = IP_RAWOUTPUT | (stcb->sctp_ep->sctp_socket->so_options & SO_DONTROUTE); \ - } else { \ - o_flgs = IP_RAWOUTPUT; \ - } \ + int o_flgs = IP_RAWOUTPUT; \ + struct sctp_tcb *local_stcb = stcb; \ + if (local_stcb && \ + local_stcb->sctp_ep && \ + local_stcb->sctp_ep->sctp_socket) \ + o_flgs |= local_stcb->sctp_ep->sctp_socket->so_options & SO_DONTROUTE; \ result = ip_output(o_pak, NULL, ro, o_flgs, 0, NULL); \ } #define SCTP_IP6_OUTPUT(result, o_pak, ro, ifp, stcb, vrf_id) \ { \ - if (stcb && stcb->sctp_ep) \ + struct sctp_tcb *local_stcb = stcb; \ + if (local_stcb && local_stcb->sctp_ep) \ result = ip6_output(o_pak, \ - ((struct in6pcb *)(stcb->sctp_ep))->in6p_outputopts, \ + ((struct in6pcb *)(local_stcb->sctp_ep))->in6p_outputopts, \ (ro), 0, 0, ifp, NULL); \ else \ result = ip6_output(o_pak, NULL, (ro), 0, 0, ifp, NULL); \ Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Oct 28 17:00:31 2010 (r214463) +++ stable/8/sys/netinet/sctp_output.c Thu Oct 28 17:02:36 2010 (r214464) @@ -3741,6 +3741,9 @@ sctp_lowlevel_chunk_output(struct sctp_i #endif SCTP_ATTACH_CHAIN(o_pak, m, packet_length); if (port) { +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && (stcb) && (stcb->asoc.loopback_scope))) { @@ -3749,17 +3752,16 @@ sctp_lowlevel_chunk_output(struct sctp_i } else { SCTP_STAT_INCR(sctps_sendnocrc); } +#endif SCTP_ENABLE_UDP_CSUM(o_pak); } else { - if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && - (stcb) && - (stcb->asoc.loopback_scope))) { - m->m_pkthdr.csum_flags = CSUM_SCTP; - m->m_pkthdr.csum_data = 0; - SCTP_STAT_INCR(sctps_sendhwcrc); - } else { - SCTP_STAT_INCR(sctps_sendnocrc); - } +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else + m->m_pkthdr.csum_flags = CSUM_SCTP; + m->m_pkthdr.csum_data = 0; + SCTP_STAT_INCR(sctps_sendhwcrc); +#endif } /* send it out. table id is taken from stcb */ #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) @@ -4051,6 +4053,9 @@ sctp_lowlevel_chunk_output(struct sctp_i #endif SCTP_ATTACH_CHAIN(o_pak, m, packet_length); if (port) { +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && (stcb) && (stcb->asoc.loopback_scope))) { @@ -4059,10 +4064,14 @@ sctp_lowlevel_chunk_output(struct sctp_i } else { SCTP_STAT_INCR(sctps_sendnocrc); } +#endif if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), packet_length - sizeof(struct ip6_hdr))) == 0) { udp->uh_sum = 0xffff; } } else { +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && (stcb) && (stcb->asoc.loopback_scope))) { @@ -4072,6 +4081,7 @@ sctp_lowlevel_chunk_output(struct sctp_i } else { SCTP_STAT_INCR(sctps_sendnocrc); } +#endif } /* send it out. table id is taken from stcb */ #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) @@ -10571,7 +10581,6 @@ sctp_send_shutdown_complete2(struct mbuf if (iph_out != NULL) { sctp_route_t ro; int ret; - struct sctp_tcb *stcb = NULL; mlen = SCTP_BUF_LEN(mout); bzero(&ro, sizeof ro); @@ -10582,17 +10591,25 @@ sctp_send_shutdown_complete2(struct mbuf sctp_packet_log(mout, mlen); #endif if (port) { +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else comp_cp->sh.checksum = sctp_calculate_cksum(mout, offset_out); SCTP_STAT_INCR(sctps_sendswcrc); +#endif SCTP_ENABLE_UDP_CSUM(mout); } else { +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else mout->m_pkthdr.csum_flags = CSUM_SCTP; mout->m_pkthdr.csum_data = 0; SCTP_STAT_INCR(sctps_sendhwcrc); +#endif } SCTP_ATTACH_CHAIN(o_pak, mout, mlen); /* out it goes */ - SCTP_IP_OUTPUT(ret, o_pak, &ro, stcb, vrf_id); + SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id); /* Free the route if we got one back */ if (ro.ro_rt) @@ -10602,7 +10619,6 @@ sctp_send_shutdown_complete2(struct mbuf if (ip6_out != NULL) { struct route_in6 ro; int ret; - struct sctp_tcb *stcb = NULL; struct ifnet *ifp = NULL; bzero(&ro, sizeof(ro)); @@ -10613,29 +10629,25 @@ sctp_send_shutdown_complete2(struct mbuf #endif SCTP_ATTACH_CHAIN(o_pak, mout, mlen); if (port) { - if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && - (stcb) && - (stcb->asoc.loopback_scope))) { - comp_cp->sh.checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); - SCTP_STAT_INCR(sctps_sendswcrc); - } else { - SCTP_STAT_INCR(sctps_sendnocrc); - } +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else + comp_cp->sh.checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); + SCTP_STAT_INCR(sctps_sendswcrc); +#endif if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), mlen - sizeof(struct ip6_hdr))) == 0) { udp->uh_sum = 0xffff; } } else { - if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && - (stcb) && - (stcb->asoc.loopback_scope))) { - mout->m_pkthdr.csum_flags = CSUM_SCTP; - mout->m_pkthdr.csum_data = 0; - SCTP_STAT_INCR(sctps_sendhwcrc); - } else { - SCTP_STAT_INCR(sctps_sendnocrc); - } +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else + mout->m_pkthdr.csum_flags = CSUM_SCTP; + mout->m_pkthdr.csum_data = 0; + SCTP_STAT_INCR(sctps_sendhwcrc); +#endif } - SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, stcb, vrf_id); + SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, NULL, vrf_id); /* Free the route if we got one back */ if (ro.ro_rt) @@ -11632,7 +11644,6 @@ sctp_send_abort(struct mbuf *m, int iphl } if (iph_out != NULL) { sctp_route_t ro; - struct sctp_tcb *stcb = NULL; int ret; /* zap the stack pointer to the route */ @@ -11652,15 +11663,23 @@ sctp_send_abort(struct mbuf *m, int iphl #endif SCTP_ATTACH_CHAIN(o_pak, mout, len); if (port) { +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else abm->sh.checksum = sctp_calculate_cksum(mout, iphlen_out); SCTP_STAT_INCR(sctps_sendswcrc); +#endif SCTP_ENABLE_UDP_CSUM(o_pak); } else { +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else mout->m_pkthdr.csum_flags = CSUM_SCTP; mout->m_pkthdr.csum_data = 0; SCTP_STAT_INCR(sctps_sendhwcrc); +#endif } - SCTP_IP_OUTPUT(ret, o_pak, &ro, stcb, vrf_id); + SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id); /* Free the route if we got one back */ if (ro.ro_rt) @@ -11670,7 +11689,6 @@ sctp_send_abort(struct mbuf *m, int iphl if (ip6_out != NULL) { struct route_in6 ro; int ret; - struct sctp_tcb *stcb = NULL; struct ifnet *ifp = NULL; /* zap the stack pointer to the route */ @@ -11687,29 +11705,25 @@ sctp_send_abort(struct mbuf *m, int iphl #endif SCTP_ATTACH_CHAIN(o_pak, mout, len); if (port) { - if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && - (stcb) && - (stcb->asoc.loopback_scope))) { - abm->sh.checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); - SCTP_STAT_INCR(sctps_sendswcrc); - } else { - SCTP_STAT_INCR(sctps_sendnocrc); - } +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else + abm->sh.checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); + SCTP_STAT_INCR(sctps_sendswcrc); +#endif if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), len - sizeof(struct ip6_hdr))) == 0) { udp->uh_sum = 0xffff; } } else { - if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && - (stcb) && - (stcb->asoc.loopback_scope))) { - mout->m_pkthdr.csum_flags = CSUM_SCTP; - mout->m_pkthdr.csum_data = 0; - SCTP_STAT_INCR(sctps_sendhwcrc); - } else { - SCTP_STAT_INCR(sctps_sendnocrc); - } +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else + mout->m_pkthdr.csum_flags = CSUM_SCTP; + mout->m_pkthdr.csum_data = 0; + SCTP_STAT_INCR(sctps_sendhwcrc); +#endif } - SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, stcb, vrf_id); + SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, NULL, vrf_id); /* Free the route if we got one back */ if (ro.ro_rt) @@ -11872,7 +11886,6 @@ sctp_send_operr_to(struct mbuf *m, int i } if (iph_out != NULL) { sctp_route_t ro; - struct sctp_tcb *stcb = NULL; int ret; /* zap the stack pointer to the route */ @@ -11890,15 +11903,23 @@ sctp_send_operr_to(struct mbuf *m, int i #endif SCTP_ATTACH_CHAIN(o_pak, mout, len); if (port) { +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else sh_out->checksum = sctp_calculate_cksum(mout, iphlen_out); SCTP_STAT_INCR(sctps_sendswcrc); +#endif SCTP_ENABLE_UDP_CSUM(o_pak); } else { +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else mout->m_pkthdr.csum_flags = CSUM_SCTP; mout->m_pkthdr.csum_data = 0; SCTP_STAT_INCR(sctps_sendhwcrc); +#endif } - SCTP_IP_OUTPUT(ret, o_pak, &ro, stcb, vrf_id); + SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id); /* Free the route if we got one back */ if (ro.ro_rt) @@ -11908,7 +11929,6 @@ sctp_send_operr_to(struct mbuf *m, int i if (ip6_out != NULL) { struct route_in6 ro; int ret; - struct sctp_tcb *stcb = NULL; struct ifnet *ifp = NULL; /* zap the stack pointer to the route */ @@ -11923,29 +11943,25 @@ sctp_send_operr_to(struct mbuf *m, int i #endif SCTP_ATTACH_CHAIN(o_pak, mout, len); if (port) { - if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && - (stcb) && - (stcb->asoc.loopback_scope))) { - sh_out->checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); - SCTP_STAT_INCR(sctps_sendswcrc); - } else { - SCTP_STAT_INCR(sctps_sendnocrc); - } +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else + sh_out->checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); + SCTP_STAT_INCR(sctps_sendswcrc); +#endif if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), len - sizeof(struct ip6_hdr))) == 0) { udp->uh_sum = 0xffff; } } else { - if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && - (stcb) && - (stcb->asoc.loopback_scope))) { - mout->m_pkthdr.csum_flags = CSUM_SCTP; - mout->m_pkthdr.csum_data = 0; - SCTP_STAT_INCR(sctps_sendhwcrc); - } else { - SCTP_STAT_INCR(sctps_sendnocrc); - } +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else + mout->m_pkthdr.csum_flags = CSUM_SCTP; + mout->m_pkthdr.csum_data = 0; + SCTP_STAT_INCR(sctps_sendhwcrc); +#endif } - SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, stcb, vrf_id); + SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, NULL, vrf_id); /* Free the route if we got one back */ if (ro.ro_rt) Modified: stable/8/sys/netinet/sctp_sysctl.c ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.c Thu Oct 28 17:00:31 2010 (r214463) +++ stable/8/sys/netinet/sctp_sysctl.c Thu Oct 28 17:02:36 2010 (r214464) @@ -54,7 +54,9 @@ sctp_init_sysctls() SCTP_BASE_SYSCTL(sctp_ecn_enable) = SCTPCTL_ECN_ENABLE_DEFAULT; SCTP_BASE_SYSCTL(sctp_ecn_nonce) = SCTPCTL_ECN_NONCE_DEFAULT; SCTP_BASE_SYSCTL(sctp_strict_sacks) = SCTPCTL_STRICT_SACKS_DEFAULT; +#if !defined(SCTP_WITH_NO_CSUM) SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) = SCTPCTL_LOOPBACK_NOCSUM_DEFAULT; +#endif 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; @@ -568,7 +570,9 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS) RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_enable), SCTPCTL_ECN_ENABLE_MIN, SCTPCTL_ECN_ENABLE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_nonce), SCTPCTL_ECN_NONCE_MIN, SCTPCTL_ECN_NONCE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_sacks), SCTPCTL_STRICT_SACKS_MIN, SCTPCTL_STRICT_SACKS_MAX); +#if !defined(SCTP_WITH_NO_CSUM) RANGECHK(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), SCTPCTL_LOOPBACK_NOCSUM_MIN, SCTPCTL_LOOPBACK_NOCSUM_MAX); +#endif 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); @@ -829,9 +833,11 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, st &SCTP_BASE_SYSCTL(sctp_strict_sacks), 0, sysctl_sctp_check, "IU", SCTPCTL_STRICT_SACKS_DESC); +#if !defined(SCTP_WITH_NO_CSUM) SYSCTL_PROC(_net_inet_sctp, OID_AUTO, loopback_nocsum, CTLTYPE_INT | CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), 0, sysctl_sctp_check, "IU", SCTPCTL_LOOPBACK_NOCSUM_DESC); +#endif SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_init, CTLTYPE_INT | CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_strict_init), 0, sysctl_sctp_check, "IU", Modified: stable/8/sys/netinet/sctp_sysctl.h ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.h Thu Oct 28 17:00:31 2010 (r214463) +++ stable/8/sys/netinet/sctp_sysctl.h Thu Oct 28 17:02:36 2010 (r214464) @@ -45,7 +45,9 @@ struct sctp_sysctl { uint32_t sctp_ecn_enable; uint32_t sctp_ecn_nonce; uint32_t sctp_strict_sacks; +#if !defined(SCTP_WITH_NO_CSUM) uint32_t sctp_no_csum_on_loopback; +#endif uint32_t sctp_strict_init; uint32_t sctp_peer_chunk_oh; uint32_t sctp_max_burst_default; Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Thu Oct 28 17:00:31 2010 (r214463) +++ stable/8/sys/netinet6/sctp6_usrreq.c Thu Oct 28 17:02:36 2010 (r214464) @@ -72,7 +72,6 @@ sctp6_input(struct mbuf **i_pak, int *of struct sctp_inpcb *in6p = NULL; struct sctp_nets *net; int refcount_up = 0; - uint32_t check, calc_check; uint32_t vrf_id = 0; struct inpcb *in6p_ip; struct sctp_chunkhdr *ch; @@ -80,6 +79,11 @@ sctp6_input(struct mbuf **i_pak, int *of uint8_t ecn_bits; struct sctp_tcb *stcb = NULL; int pkt_len = 0; + +#if !defined(SCTP_WITH_NO_CSUM) + uint32_t check, calc_check; + +#endif int off = *offp; uint16_t port = 0; @@ -133,6 +137,9 @@ sctp6_input(struct mbuf **i_pak, int *of m->m_pkthdr.len, if_name(m->m_pkthdr.rcvif), m->m_pkthdr.csum_flags); +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_recvnocrc); +#else if (m->m_pkthdr.csum_flags & CSUM_SCTP_VALID) { SCTP_STAT_INCR(sctps_recvhwcrc); goto sctp_skip_csum; @@ -171,6 +178,7 @@ sctp6_input(struct mbuf **i_pak, int *of sh->checksum = calc_check; sctp_skip_csum: +#endif net = NULL; /* * Locate pcb and tcb for datagram sctp_findassociation_addr() wants From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 17:04:33 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D1CC1065670; Thu, 28 Oct 2010 17:04:32 +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 6AEC68FC1B; Thu, 28 Oct 2010 17:04: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 o9SH4Wqk018060; Thu, 28 Oct 2010 17:04:32 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SH4WfQ018058; Thu, 28 Oct 2010 17:04:32 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281704.o9SH4WfQ018058@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 17:04:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214465 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 17:04:33 -0000 Author: tuexen Date: Thu Oct 28 17:04:32 2010 New Revision: 214465 URL: http://svn.freebsd.org/changeset/base/214465 Log: MFC 212099: Fix the the SCTP_WITH_NO_CSUM option when used in combination with interface supporting CRC offload. While at it, make use of the feature that the loopback interface provides CRC offloading. Modified: stable/8/sys/netinet/sctp_pcb.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Thu Oct 28 17:02:36 2010 (r214464) +++ stable/8/sys/netinet/sctp_pcb.c Thu Oct 28 17:04:32 2010 (r214465) @@ -5988,7 +5988,7 @@ sctp_load_addresses_from_init(struct sct } p4 = (struct sctp_ipv4addr_param *)phdr; sin.sin_addr.s_addr = p4->addr; - if (IN_MULTICAST(sin.sin_addr.s_addr)) { + if (IN_MULTICAST(ntohl(sin.sin_addr.s_addr))) { /* Skip multi-cast addresses */ goto next_param; } From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 17:17:46 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F9B11065673; Thu, 28 Oct 2010 17:17:46 +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 F06518FC15; Thu, 28 Oct 2010 17: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 o9SHHjmE018698; Thu, 28 Oct 2010 17:17:45 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SHHjnB018692; Thu, 28 Oct 2010 17:17:45 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201010281717.o9SHHjnB018692@svn.freebsd.org> From: Randall Stewart Date: Thu, 28 Oct 2010 17:17:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214466 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 17:17:46 -0000 Author: rrs Date: Thu Oct 28 17:17:45 2010 New Revision: 214466 URL: http://svn.freebsd.org/changeset/base/214466 Log: MFC of 212225 Fix some CLANG warnings. One clang warning is left due to the fact that its bogus.. nam->sa_family will not change from AF_INET6 to AF_INET (but clang thinks it does ;-D) Modified: stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctp_timer.c stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Oct 28 17:04:32 2010 (r214465) +++ stable/8/sys/netinet/sctp_input.c Thu Oct 28 17:17:45 2010 (r214466) @@ -535,7 +535,7 @@ sctp_handle_heartbeat_ack(struct sctp_he struct sockaddr_storage store; struct sockaddr_in *sin; struct sockaddr_in6 *sin6; - struct sctp_nets *r_net; + struct sctp_nets *r_net, *f_net; struct timeval tv; int req_prim = 0; @@ -581,16 +581,16 @@ sctp_handle_heartbeat_ack(struct sctp_he stcb->asoc.primary_destination = r_net; r_net->dest_state &= ~SCTP_ADDR_WAS_PRIMARY; r_net->dest_state &= ~SCTP_ADDR_REQ_PRIMARY; - r_net = TAILQ_FIRST(&stcb->asoc.nets); - if (r_net != stcb->asoc.primary_destination) { + f_net = TAILQ_FIRST(&stcb->asoc.nets); + if (f_net != r_net) { /* * first one on the list is NOT the primary * sctp_cmpaddr() is much more efficent if * the primary is the first on the list, * make it so. */ - TAILQ_REMOVE(&stcb->asoc.nets, stcb->asoc.primary_destination, sctp_next); - TAILQ_INSERT_HEAD(&stcb->asoc.nets, stcb->asoc.primary_destination, sctp_next); + TAILQ_REMOVE(&stcb->asoc.nets, r_net, sctp_next); + TAILQ_INSERT_HEAD(&stcb->asoc.nets, r_net, sctp_next); } req_prim = 1; } @@ -4685,14 +4685,14 @@ process_control_chunks: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_NR_SACK\n"); SCTP_STAT_INCR(sctps_recvsacks); - if ((stcb->asoc.sctp_nr_sack_on_off == 0) || - (stcb->asoc.peer_supports_nr_sack == 0)) { - goto unknown_chunk; - } if (stcb == NULL) { SCTPDBG(SCTP_DEBUG_INDATA1, "No stcb when processing NR-SACK chunk\n"); break; } + if ((stcb->asoc.sctp_nr_sack_on_off == 0) || + (stcb->asoc.peer_supports_nr_sack == 0)) { + goto unknown_chunk; + } if (chk_length < sizeof(struct sctp_nr_sack_chunk)) { SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size on NR-SACK chunk, too small\n"); break; Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Oct 28 17:04:32 2010 (r214465) +++ stable/8/sys/netinet/sctp_output.c Thu Oct 28 17:17:45 2010 (r214466) @@ -9840,9 +9840,12 @@ sctp_fill_in_rest: at = TAILQ_FIRST(&asoc->sent_queue); for (i = 0; i < cnt_of_skipped; i++) { tp1 = TAILQ_NEXT(at, sctp_next); + if (tp1 == NULL) { + break; + } at = tp1; } - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) { + if (at && SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) { sctp_misc_ints(SCTP_FWD_TSN_CHECK, 0xff, cnt_of_skipped, at->rec.data.TSN_seq, asoc->advanced_peer_ack_point); @@ -9852,7 +9855,8 @@ sctp_fill_in_rest: * last now points to last one I can report, update * peer ack point */ - advance_peer_ack_point = last->rec.data.TSN_seq; + if (last) + advance_peer_ack_point = last->rec.data.TSN_seq; space_needed = sizeof(struct sctp_forward_tsn_chunk) + cnt_of_skipped * sizeof(struct sctp_strseq); } @@ -9885,6 +9889,8 @@ sctp_fill_in_rest: at = TAILQ_FIRST(&asoc->sent_queue); for (i = 0; i < cnt_of_skipped; i++) { tp1 = TAILQ_NEXT(at, sctp_next); + if (tp1 == NULL) + break; if (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED) { /* We don't report these */ i--; @@ -10560,7 +10566,8 @@ sctp_send_shutdown_complete2(struct mbuf udp->uh_sport = htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)); udp->uh_dport = port; udp->uh_ulen = htons(sizeof(struct sctp_shutdown_complete_msg) + sizeof(struct udphdr)); - udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP)); + if (iph_out) + udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP)); offset_out += sizeof(struct udphdr); comp_cp = (struct sctp_shutdown_complete_msg *)((caddr_t)comp_cp + sizeof(struct udphdr)); } Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Thu Oct 28 17:04:32 2010 (r214465) +++ stable/8/sys/netinet/sctp_pcb.c Thu Oct 28 17:17:45 2010 (r214466) @@ -517,7 +517,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, vo sizeof(struct sctp_ifn), SCTP_M_IFN); if (sctp_ifnp == NULL) { #ifdef INVARIANTS - panic("No memory for IFN:%u", sctp_ifnp->ifn_index); + panic("No memory for IFN"); #endif return (NULL); } @@ -5902,7 +5902,7 @@ sctp_load_addresses_from_init(struct sct } #endif default: - sa = NULL; + return (-1); break; } } else { Modified: stable/8/sys/netinet/sctp_timer.c ============================================================================== --- stable/8/sys/netinet/sctp_timer.c Thu Oct 28 17:04:32 2010 (r214465) +++ stable/8/sys/netinet/sctp_timer.c Thu Oct 28 17:17:45 2010 (r214466) @@ -482,6 +482,9 @@ sctp_find_alternate_net(struct sctp_tcb if (mnet == NULL) { mnet = TAILQ_FIRST(&stcb->asoc.nets); + if (mnet == NULL) { + return (NULL); + } } do { alt = TAILQ_NEXT(mnet, sctp_next); @@ -491,6 +494,9 @@ sctp_find_alternate_net(struct sctp_tcb break; } alt = TAILQ_FIRST(&stcb->asoc.nets); + if (alt == NULL) { + return (NULL); + } } if (alt->ro.ro_rt == NULL) { if (alt->ro._s_addr) { @@ -517,6 +523,9 @@ sctp_find_alternate_net(struct sctp_tcb once = 0; mnet = net; do { + if (mnet == NULL) { + return (TAILQ_FIRST(&stcb->asoc.nets)); + } alt = TAILQ_NEXT(mnet, sctp_next); if (alt == NULL) { once++; Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Oct 28 17:04:32 2010 (r214465) +++ stable/8/sys/netinet/sctputil.c Thu Oct 28 17:17:45 2010 (r214466) @@ -340,7 +340,7 @@ sctp_log_lock(struct sctp_inpcb *inp, st sctp_clog.x.lock.create_lock = SCTP_LOCK_UNKNOWN; } sctp_clog.x.lock.info_lock = rw_wowned(&SCTP_BASE_INFO(ipi_ep_mtx)); - if (inp->sctp_socket) { + if (inp && (inp->sctp_socket)) { sctp_clog.x.lock.sock_lock = mtx_owned(&(inp->sctp_socket->so_rcv.sb_mtx)); sctp_clog.x.lock.sockrcvbuf_lock = mtx_owned(&(inp->sctp_socket->so_rcv.sb_mtx)); sctp_clog.x.lock.socksndbuf_lock = mtx_owned(&(inp->sctp_socket->so_snd.sb_mtx)); @@ -4208,7 +4208,7 @@ void sctp_print_address_pkt(struct ip *iph, struct sctphdr *sh) { switch (iph->ip_v) { - case IPVERSION: + case IPVERSION: { struct sockaddr_in lsa, fsa; @@ -5684,7 +5684,9 @@ get_more_data: if ((SCTP_BUF_NEXT(m) == NULL) && (control->end_added)) { out_flags |= MSG_EOR; - if ((control->do_not_ref_stcb == 0) && ((control->spec_flags & M_NOTIFICATION) == 0)) + if ((control->do_not_ref_stcb == 0) && + (control->stcb != NULL) && + ((control->spec_flags & M_NOTIFICATION) == 0)) control->stcb->asoc.strmin[control->sinfo_stream].delivery_started = 0; } if (control->spec_flags & M_NOTIFICATION) { From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 17:50:50 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 693561065694; Thu, 28 Oct 2010 17:50:50 +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 5650A8FC20; Thu, 28 Oct 2010 17:50: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 o9SHooN9020143; Thu, 28 Oct 2010 17:50:50 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SHoor1020139; Thu, 28 Oct 2010 17:50:50 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281750.o9SHoor1020139@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 17:50:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214467 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 17:50:50 -0000 Author: tuexen Date: Thu Oct 28 17:50:50 2010 New Revision: 214467 URL: http://svn.freebsd.org/changeset/base/214467 Log: MFC 209289: Fix a rece condition in the shutdown handling. The race condition resulted in a panic. Modified: stable/8/sys/netinet/sctp.h stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet/sctputil.c Modified: stable/8/sys/netinet/sctp.h ============================================================================== --- stable/8/sys/netinet/sctp.h Thu Oct 28 17:17:45 2010 (r214466) +++ stable/8/sys/netinet/sctp.h Thu Oct 28 17:50:50 2010 (r214467) @@ -440,6 +440,7 @@ struct sctp_error_unrecognized_chunk { #define SCTP_PCB_FLAGS_BLOCKING_IO 0x08000000 #define SCTP_PCB_FLAGS_SOCKET_GONE 0x10000000 #define SCTP_PCB_FLAGS_SOCKET_ALLGONE 0x20000000 +#define SCTP_PCB_FLAGS_SOCKET_CANT_READ 0x40000000 /* flags to copy to new PCB */ #define SCTP_PCB_COPY_FLAGS (SCTP_PCB_FLAGS_BOUNDALL|\ SCTP_PCB_FLAGS_WAKEINPUT|\ Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Thu Oct 28 17:17:45 2010 (r214466) +++ stable/8/sys/netinet/sctp_usrreq.c Thu Oct 28 17:50:50 2010 (r214467) @@ -948,11 +948,30 @@ sctp_flush(struct socket *so, int how) * they will not be able to read the data, the socket will block * that from happening. */ + struct sctp_inpcb *inp; + + inp = (struct sctp_inpcb *)so->so_pcb; + if (inp == NULL) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + return EINVAL; + } + SCTP_INP_RLOCK(inp); + /* For the 1 to many model this does nothing */ + if (inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) { + SCTP_INP_RUNLOCK(inp); + return (0); + } + SCTP_INP_RUNLOCK(inp); if ((how == PRU_FLUSH_RD) || (how == PRU_FLUSH_RDWR)) { /* * First make sure the sb will be happy, we don't use these * except maybe the count */ + SCTP_INP_WLOCK(inp); + SCTP_INP_READ_LOCK(inp); + inp->sctp_flags |= SCTP_PCB_FLAGS_SOCKET_CANT_READ; + SCTP_INP_READ_UNLOCK(inp); + SCTP_INP_WUNLOCK(inp); so->so_rcv.sb_cc = 0; so->so_rcv.sb_mbcnt = 0; so->so_rcv.sb_mb = NULL; Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Oct 28 17:17:45 2010 (r214466) +++ stable/8/sys/netinet/sctputil.c Thu Oct 28 17:50:50 2010 (r214467) @@ -3183,6 +3183,9 @@ sctp_notify_partial_delivery_indication( /* event not enabled */ return; } + if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_CANT_READ) { + return; + } m_notify = sctp_get_mbuf_for_msg(sizeof(struct sctp_pdapi_event), 0, M_DONTWAIT, 1, MT_DATA); if (m_notify == NULL) /* no space left */ @@ -4369,6 +4372,17 @@ sctp_add_to_readq(struct sctp_inpcb *inp } if (inp_read_lock_held == 0) SCTP_INP_READ_LOCK(inp); + if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_CANT_READ) { + sctp_free_remote_addr(control->whoFrom); + if (control->data) { + sctp_m_freem(control->data); + control->data = NULL; + } + SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_readq), control); + if (inp_read_lock_held == 0) + SCTP_INP_READ_UNLOCK(inp); + return; + } if (!(control->spec_flags & M_NOTIFICATION)) { atomic_add_int(&inp->total_recvs, 1); if (!control->do_not_ref_stcb) { @@ -4409,6 +4423,8 @@ sctp_add_to_readq(struct sctp_inpcb *inp control->tail_mbuf = prev; } else { /* Everything got collapsed out?? */ + sctp_free_remote_addr(control->whoFrom); + SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_readq), control); if (inp_read_lock_held == 0) SCTP_INP_READ_UNLOCK(inp); return; @@ -4481,6 +4497,10 @@ get_out: } return (-1); } + if (inp && (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_CANT_READ)) { + SCTP_INP_READ_UNLOCK(inp); + return 0; + } if (control->end_added) { /* huh this one is complete? */ goto get_out; From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 18:50:36 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 252DC106566B; Thu, 28 Oct 2010 18:50:36 +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 112198FC0A; Thu, 28 Oct 2010 18:50: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 o9SIoZ7t023116; Thu, 28 Oct 2010 18:50:35 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SIoZXI023112; Thu, 28 Oct 2010 18:50:35 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281850.o9SIoZXI023112@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 18:50:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214470 - in stable/8/sys: kern netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 18:50:36 -0000 Author: tuexen Date: Thu Oct 28 18:50:35 2010 New Revision: 214470 URL: http://svn.freebsd.org/changeset/base/214470 Log: MFC 212242: Implement correct handling of address parameter and sendinfo for SCTP send calls. Modified: stable/8/sys/kern/uipc_syscalls.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_uio.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/uipc_syscalls.c ============================================================================== --- stable/8/sys/kern/uipc_syscalls.c Thu Oct 28 18:15:07 2010 (r214469) +++ stable/8/sys/kern/uipc_syscalls.c Thu Oct 28 18:50:35 2010 (r214470) @@ -2385,7 +2385,6 @@ sctp_generic_sendmsg (td, uap) struct sctp_sndrcvinfo sinfo, *u_sinfo = NULL; struct socket *so; struct file *fp = NULL; - int use_rcvinfo = 1; int error = 0, len; struct sockaddr *to = NULL; #ifdef KTRACE @@ -2438,7 +2437,7 @@ sctp_generic_sendmsg (td, uap) CURVNET_SET(so->so_vnet); error = sctp_lower_sosend(so, to, &auio, (struct mbuf *)NULL, (struct mbuf *)NULL, - uap->flags, use_rcvinfo, u_sinfo, td); + uap->flags, u_sinfo, td); CURVNET_RESTORE(); if (error) { if (auio.uio_resid != len && (error == ERESTART || @@ -2489,7 +2488,6 @@ sctp_generic_sendmsg_iov(td, uap) struct sctp_sndrcvinfo sinfo, *u_sinfo = NULL; struct socket *so; struct file *fp = NULL; - int use_rcvinfo = 1; int error=0, len, i; struct sockaddr *to = NULL; #ifdef KTRACE @@ -2556,7 +2554,7 @@ sctp_generic_sendmsg_iov(td, uap) CURVNET_SET(so->so_vnet); error = sctp_lower_sosend(so, to, &auio, (struct mbuf *)NULL, (struct mbuf *)NULL, - uap->flags, use_rcvinfo, u_sinfo, td); + uap->flags, u_sinfo, td); CURVNET_RESTORE(); if (error) { if (auio.uio_resid != len && (error == ERESTART || Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Oct 28 18:15:07 2010 (r214469) +++ stable/8/sys/netinet/sctp_output.c Thu Oct 28 18:50:35 2010 (r214470) @@ -12158,7 +12158,7 @@ sctp_sosend(struct socket *so, error = sctp_lower_sosend(so, addr_to_use, uio, top, control, flags, - use_rcvinfo, &srcv + use_rcvinfo ? &srcv : NULL ,p ); return (error); @@ -12172,7 +12172,6 @@ sctp_lower_sosend(struct socket *so, struct mbuf *i_pak, struct mbuf *control, int flags, - int use_rcvinfo, struct sctp_sndrcvinfo *srcv , struct thread *p @@ -12200,8 +12199,10 @@ sctp_lower_sosend(struct socket *so, int got_all_of_the_send = 0; int hold_tcblock = 0; int non_blocking = 0; - int temp_flags = 0; uint32_t local_add_more, local_soresv = 0; + uint16_t port; + uint16_t sinfo_flags; + sctp_assoc_t sinfo_assoc_id; error = 0; net = NULL; @@ -12236,28 +12237,39 @@ sctp_lower_sosend(struct socket *so, SCTPDBG(SCTP_DEBUG_OUTPUT1, "Send called addr:%p send length %d\n", addr, sndlen); + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && + (inp->sctp_socket->so_qlimit)) { + /* The listener can NOT send */ + SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, ENOTCONN); + error = ENOTCONN; + goto out_unlocked; + } /** * Pre-screen address, if one is given the sin-len * must be set correctly! */ if (addr) { - switch (addr->sa_family) { + union sctp_sockstore *raddr = (union sctp_sockstore *)addr; + + switch (raddr->sa.sa_family) { #if defined(INET) case AF_INET: - if (addr->sa_len != sizeof(struct sockaddr_in)) { + if (raddr->sin.sin_len != sizeof(struct sockaddr_in)) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); error = EINVAL; goto out_unlocked; } + port = raddr->sin.sin_port; break; #endif #if defined(INET6) case AF_INET6: - if (addr->sa_len != sizeof(struct sockaddr_in6)) { + if (raddr->sin6.sin6_len != sizeof(struct sockaddr_in6)) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); error = EINVAL; goto out_unlocked; } + port = raddr->sin6.sin6_port; break; #endif default: @@ -12265,32 +12277,34 @@ sctp_lower_sosend(struct socket *so, error = EAFNOSUPPORT; goto out_unlocked; } - } - hold_tcblock = 0; + } else + port = 0; - if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && - (inp->sctp_socket->so_qlimit)) { - /* The listener can NOT send */ - SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, ENOTCONN); - error = ENOTCONN; - goto out_unlocked; - } - if ((use_rcvinfo) && srcv) { - if (INVALID_SINFO_FLAG(srcv->sinfo_flags) || - PR_SCTP_INVALID_POLICY(srcv->sinfo_flags)) { + if (srcv) { + sinfo_flags = srcv->sinfo_flags; + sinfo_assoc_id = srcv->sinfo_assoc_id; + if (INVALID_SINFO_FLAG(sinfo_flags) || + PR_SCTP_INVALID_POLICY(sinfo_flags)) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); error = EINVAL; goto out_unlocked; } if (srcv->sinfo_flags) SCTP_STAT_INCR(sctps_sends_with_flags); - - if (srcv->sinfo_flags & SCTP_SENDALL) { - /* its a sendall */ - error = sctp_sendall(inp, uio, top, srcv); - top = NULL; - goto out_unlocked; - } + } else { + sinfo_flags = inp->def_send.sinfo_flags; + sinfo_assoc_id = inp->def_send.sinfo_assoc_id; + } + if (sinfo_flags & SCTP_SENDALL) { + /* its a sendall */ + error = sctp_sendall(inp, uio, top, srcv); + top = NULL; + goto out_unlocked; + } + if ((sinfo_flags & SCTP_ADDR_OVER) && (addr == NULL)) { + SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); + error = EINVAL; + goto out_unlocked; } /* now we must find the assoc */ if ((inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) || @@ -12306,80 +12320,8 @@ sctp_lower_sosend(struct socket *so, SCTP_TCB_LOCK(stcb); hold_tcblock = 1; SCTP_INP_RUNLOCK(inp); - if (addr) { - /* Must locate the net structure if addr given */ - net = sctp_findnet(stcb, addr); - if (net) { - /* validate port was 0 or correct */ - struct sockaddr_in *sin; - - sin = (struct sockaddr_in *)addr; - if ((sin->sin_port != 0) && - (sin->sin_port != stcb->rport)) { - net = NULL; - } - } - temp_flags |= SCTP_ADDR_OVER; - } else - net = stcb->asoc.primary_destination; - if (addr && (net == NULL)) { - /* Could not find address, was it legal */ - if (addr->sa_family == AF_INET) { - struct sockaddr_in *sin; - - sin = (struct sockaddr_in *)addr; - if (sin->sin_addr.s_addr == 0) { - if ((sin->sin_port == 0) || - (sin->sin_port == stcb->rport)) { - net = stcb->asoc.primary_destination; - } - } - } else { - struct sockaddr_in6 *sin6; - - sin6 = (struct sockaddr_in6 *)addr; - if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { - if ((sin6->sin6_port == 0) || - (sin6->sin6_port == stcb->rport)) { - net = stcb->asoc.primary_destination; - } - } - } - } - if (net == NULL) { - SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); - error = EINVAL; - goto out_unlocked; - } - } else if (use_rcvinfo && srcv && srcv->sinfo_assoc_id) { - stcb = sctp_findassociation_ep_asocid(inp, srcv->sinfo_assoc_id, 0); - if (stcb) { - if (addr) - /* - * Must locate the net structure if addr - * given - */ - net = sctp_findnet(stcb, addr); - else - net = stcb->asoc.primary_destination; - if ((srcv->sinfo_flags & SCTP_ADDR_OVER) && - ((net == NULL) || (addr == NULL))) { - struct sockaddr_in *sin; - - if (addr == NULL) { - SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); - error = EINVAL; - goto out_unlocked; - } - sin = (struct sockaddr_in *)addr; - /* Validate port is 0 or correct */ - if ((sin->sin_port != 0) && - (sin->sin_port != stcb->rport)) { - net = NULL; - } - } - } - hold_tcblock = 0; + } else if (sinfo_assoc_id) { + stcb = sctp_findassociation_ep_asocid(inp, sinfo_assoc_id, 0); } else if (addr) { /*- * Since we did not use findep we must @@ -12452,10 +12394,8 @@ sctp_lower_sosend(struct socket *so, */ uint32_t vrf_id; - if ((use_rcvinfo) && (srcv) && - ((srcv->sinfo_flags & SCTP_ABORT) || - ((srcv->sinfo_flags & SCTP_EOF) && - (sndlen == 0)))) { + if ((sinfo_flags & SCTP_ABORT) || + ((sinfo_flags & SCTP_EOF) && (sndlen == 0))) { /*- * User asks to abort a non-existant assoc, * or EOF a non-existant assoc with no data @@ -12584,10 +12524,25 @@ sctp_lower_sosend(struct socket *so, * structure may now have an update and thus we may need to * change it BEFORE we append the message. */ - net = stcb->asoc.primary_destination; - asoc = &stcb->asoc; } } + if (srcv == NULL) + srcv = (struct sctp_sndrcvinfo *)&stcb->asoc.def_send; + if (srcv->sinfo_flags & SCTP_ADDR_OVER) { + if (addr) + net = sctp_findnet(stcb, addr); + else + net = NULL; + if ((net == NULL) || + ((port != 0) && (port != stcb->rport))) { + SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); + error = EINVAL; + goto out_unlocked; + } + } else { + net = stcb->asoc.primary_destination; + } + if ((SCTP_SO_IS_NBIO(so) || (flags & MSG_NBIO) )) { @@ -12658,10 +12613,6 @@ sctp_lower_sosend(struct socket *so, (SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_ECHOED)) { queue_only = 1; } - if ((use_rcvinfo == 0) || (srcv == NULL)) { - /* Grab the default stuff from the asoc */ - srcv = (struct sctp_sndrcvinfo *)&stcb->asoc.def_send; - } /* we are now done with all control */ if (control) { sctp_m_freem(control); @@ -12671,8 +12622,7 @@ sctp_lower_sosend(struct socket *so, (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) || (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_ACK_SENT) || (asoc->state & SCTP_STATE_SHUTDOWN_PENDING)) { - if ((use_rcvinfo) && - (srcv->sinfo_flags & SCTP_ABORT)) { + if (srcv->sinfo_flags & SCTP_ABORT) { ; } else { SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ECONNRESET); @@ -12684,16 +12634,6 @@ sctp_lower_sosend(struct socket *so, if (p) { p->td_ru.ru_msgsnd++; } - if (stcb) { - if (((srcv->sinfo_flags | temp_flags) & SCTP_ADDR_OVER) == 0) { - net = stcb->asoc.primary_destination; - } - } - if (net == NULL) { - SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); - error = EINVAL; - goto out_unlocked; - } if ((net->flight_size > net->cwnd) && (asoc->sctp_cmt_on_off == 0)) { /*- Modified: stable/8/sys/netinet/sctp_uio.h ============================================================================== --- stable/8/sys/netinet/sctp_uio.h Thu Oct 28 18:15:07 2010 (r214469) +++ stable/8/sys/netinet/sctp_uio.h Thu Oct 28 18:50:35 2010 (r214470) @@ -982,6 +982,23 @@ union sctp_sockstore { struct sockaddr sa; }; + +/***********************************/ +/* And something for us old timers */ +/***********************************/ + +#ifndef ntohll +#include +#define ntohll(x) be64toh(x) +#endif + +#ifndef htonll +#include +#define htonll(x) htobe64(x) +#endif +/***********************************/ + + struct xsctp_inpcb { uint32_t last; uint32_t flags; @@ -1079,7 +1096,6 @@ sctp_lower_sosend(struct socket *so, struct mbuf *i_pak, struct mbuf *control, int flags, - int use_rcvinfo, struct sctp_sndrcvinfo *srcv ,struct thread *p ); From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 18:52:49 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C89B106564A; Thu, 28 Oct 2010 18:52: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 38AFB8FC08; Thu, 28 Oct 2010 18:52: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 o9SIqnDL023268; Thu, 28 Oct 2010 18:52:49 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SIqnc2023266; Thu, 28 Oct 2010 18:52:49 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281852.o9SIqnc2023266@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 18:52:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214471 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 18:52:49 -0000 Author: tuexen Date: Thu Oct 28 18:52:48 2010 New Revision: 214471 URL: http://svn.freebsd.org/changeset/base/214471 Log: MFC 212380: * Remove code which has no effect. * Clean up the handling in sctp_lower_sosend(). Modified: stable/8/sys/netinet/sctp_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Oct 28 18:50:35 2010 (r214470) +++ stable/8/sys/netinet/sctp_output.c Thu Oct 28 18:52:48 2010 (r214471) @@ -12124,7 +12124,6 @@ sctp_sosend(struct socket *so, struct thread *p ) { - struct sctp_inpcb *inp; int error, use_rcvinfo = 0; struct sctp_sndrcvinfo srcv; struct sockaddr *addr_to_use; @@ -12134,7 +12133,6 @@ sctp_sosend(struct socket *so, #endif - inp = (struct sctp_inpcb *)so->so_pcb; if (control) { /* process cmsg snd/rcv info (maybe a assoc-id) */ if (sctp_find_cmsg(SCTP_SNDRCV, (void *)&srcv, control, @@ -12182,7 +12180,7 @@ sctp_lower_sosend(struct socket *so, struct mbuf *top = NULL; int queue_only = 0, queue_only_for_init = 0; int free_cnt_applied = 0; - int un_sent = 0; + int un_sent; int now_filled = 0; unsigned int inqueue_bytes = 0; struct sctp_block_entry be; @@ -12525,9 +12523,10 @@ sctp_lower_sosend(struct socket *so, * change it BEFORE we append the message. */ } - } + } else + asoc = &stcb->asoc; if (srcv == NULL) - srcv = (struct sctp_sndrcvinfo *)&stcb->asoc.def_send; + srcv = (struct sctp_sndrcvinfo *)&asoc->def_send; if (srcv->sinfo_flags & SCTP_ADDR_OVER) { if (addr) net = sctp_findnet(stcb, addr); @@ -12542,14 +12541,10 @@ sctp_lower_sosend(struct socket *so, } else { net = stcb->asoc.primary_destination; } - - if ((SCTP_SO_IS_NBIO(so) - || (flags & MSG_NBIO) - )) { - non_blocking = 1; - } - asoc = &stcb->asoc; atomic_add_int(&stcb->total_sends, 1); + /* Keep the stcb from being freed under our feet */ + atomic_add_int(&asoc->refcnt, 1); + free_cnt_applied = 1; if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NO_FRAGMENT)) { if (sndlen > asoc->smallest_mtu) { @@ -12558,6 +12553,11 @@ sctp_lower_sosend(struct socket *so, goto out_unlocked; } } + if ((SCTP_SO_IS_NBIO(so) + || (flags & MSG_NBIO) + )) { + non_blocking = 1; + } /* would we block? */ if (non_blocking) { if (hold_tcblock == 0) { @@ -12581,17 +12581,6 @@ sctp_lower_sosend(struct socket *so, atomic_add_int(&stcb->asoc.sb_send_resv, sndlen); } local_soresv = sndlen; - /* Keep the stcb from being freed under our feet */ - if (free_cnt_applied) { -#ifdef INVARIANTS - panic("refcnt already incremented"); -#else - printf("refcnt:1 already incremented?\n"); -#endif - } else { - atomic_add_int(&stcb->asoc.refcnt, 1); - free_cnt_applied = 1; - } if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ECONNRESET); error = ECONNRESET; @@ -12634,26 +12623,6 @@ sctp_lower_sosend(struct socket *so, if (p) { p->td_ru.ru_msgsnd++; } - if ((net->flight_size > net->cwnd) && - (asoc->sctp_cmt_on_off == 0)) { - /*- - * CMT: Added check for CMT above. net above is the primary - * dest. If CMT is ON, sender should always attempt to send - * with the output routine sctp_fill_outqueue() that loops - * through all destination addresses. Therefore, if CMT is - * ON, queue_only is NOT set to 1 here, so that - * sctp_chunk_output() can be called below. - */ - queue_only = 1; - } else if (asoc->ifp_had_enobuf) { - SCTP_STAT_INCR(sctps_ifnomemqueued); - if (net->flight_size > (net->mtu * 2)) - queue_only = 1; - asoc->ifp_had_enobuf = 0; - } else { - un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + - (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); - } /* Are we aborting? */ if (srcv->sinfo_flags & SCTP_ABORT) { struct mbuf *mm; @@ -12857,7 +12826,6 @@ sctp_lower_sosend(struct socket *so, } inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk)); } - inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk)); if (SCTP_SB_LIMIT_SND(so) > inqueue_bytes) { max_len = SCTP_SB_LIMIT_SND(so) - inqueue_bytes; } else { @@ -12886,9 +12854,7 @@ skip_preblock: if (top == NULL) { struct sctp_stream_queue_pending *sp; struct sctp_stream_out *strm; - uint32_t sndout, initial_out; - - initial_out = uio->uio_resid; + uint32_t sndout; SCTP_TCB_SEND_LOCK(stcb); if ((asoc->stream_locked) && @@ -13052,29 +13018,34 @@ skip_preblock: /* Non-blocking io in place out */ goto skip_out_eof; } + /* What about the INIT, send it maybe */ + if (queue_only_for_init) { + if (hold_tcblock == 0) { + SCTP_TCB_LOCK(stcb); + hold_tcblock = 1; + } + if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) { + /* a collision took us forward? */ + queue_only = 0; + } else { + sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED); + SCTP_SET_STATE(asoc, SCTP_STATE_COOKIE_WAIT); + queue_only = 1; + } + } if ((net->flight_size > net->cwnd) && (asoc->sctp_cmt_on_off == 0)) { + SCTP_STAT_INCR(sctps_send_cwnd_avoid); queue_only = 1; } else if (asoc->ifp_had_enobuf) { SCTP_STAT_INCR(sctps_ifnomemqueued); - if (net->flight_size > (net->mtu * 2)) { + if (net->flight_size > (2 * net->mtu)) { queue_only = 1; - } else { - queue_only = 0; } asoc->ifp_had_enobuf = 0; - un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + - (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); - } else { - un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + - (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); - if (net->flight_size > net->cwnd) { - queue_only = 1; - SCTP_STAT_INCR(sctps_send_cwnd_avoid); - } else { - queue_only = 0; - } } + un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + + (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); if ((sctp_is_feature_off(inp, SCTP_PCB_FLAGS_NODELAY)) && (stcb->asoc.total_flight > 0) && (stcb->asoc.stream_queue_cnt < SCTP_MAX_DATA_BUNDLING) && @@ -13098,7 +13069,6 @@ skip_preblock: SCTP_STAT_INCR(sctps_naglesent); nagle_applies = 0; } - /* What about the INIT, send it maybe */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_BLK_LOGGING_ENABLE) { sctp_misc_ints(SCTP_CWNDLOG_PRESEND, queue_only_for_init, queue_only, @@ -13107,22 +13077,8 @@ skip_preblock: stcb->asoc.total_flight, stcb->asoc.chunks_on_out_queue, stcb->asoc.total_flight_count); } - if (queue_only_for_init) { - if (hold_tcblock == 0) { - SCTP_TCB_LOCK(stcb); - hold_tcblock = 1; - } - if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) { - /* a collision took us forward? */ - queue_only_for_init = 0; - queue_only = 0; - } else { - sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED); - SCTP_SET_STATE(asoc, SCTP_STATE_COOKIE_WAIT); - queue_only_for_init = 0; - queue_only = 1; - } - } + if (queue_only_for_init) + queue_only_for_init = 0; if ((queue_only == 0) && (nagle_applies == 0)) { /*- * need to start chunk output @@ -13215,7 +13171,7 @@ skip_preblock: if (uio->uio_resid == 0) { got_all_of_the_send = 1; } - } else if (top) { + } else { /* We send in a 0, since we do NOT have any locks */ error = sctp_msg_append(stcb, net, top, srcv, 0); top = NULL; @@ -13326,29 +13282,33 @@ skip_out_eof: if (!TAILQ_EMPTY(&stcb->asoc.control_send_queue)) { some_on_control = 1; } + if (queue_only_for_init) { + if (hold_tcblock == 0) { + SCTP_TCB_LOCK(stcb); + hold_tcblock = 1; + } + if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) { + /* a collision took us forward? */ + queue_only = 0; + } else { + sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED); + SCTP_SET_STATE(&stcb->asoc, SCTP_STATE_COOKIE_WAIT); + queue_only = 1; + } + } if ((net->flight_size > net->cwnd) && (stcb->asoc.sctp_cmt_on_off == 0)) { + SCTP_STAT_INCR(sctps_send_cwnd_avoid); queue_only = 1; } else if (asoc->ifp_had_enobuf) { SCTP_STAT_INCR(sctps_ifnomemqueued); - if (net->flight_size > (net->mtu * 2)) { + if (net->flight_size > (2 * net->mtu)) { queue_only = 1; - } else { - queue_only = 0; } asoc->ifp_had_enobuf = 0; - un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + - (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); - } else { - un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + - (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); - if (net->flight_size > net->cwnd) { - queue_only = 1; - SCTP_STAT_INCR(sctps_send_cwnd_avoid); - } else { - queue_only = 0; - } } + un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + + (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); if ((sctp_is_feature_off(inp, SCTP_PCB_FLAGS_NODELAY)) && (stcb->asoc.total_flight > 0) && (stcb->asoc.stream_queue_cnt < SCTP_MAX_DATA_BUNDLING) && @@ -13371,22 +13331,15 @@ skip_out_eof: SCTP_STAT_INCR(sctps_naglesent); nagle_applies = 0; } - if (queue_only_for_init) { - if (hold_tcblock == 0) { - SCTP_TCB_LOCK(stcb); - hold_tcblock = 1; - } - if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) { - /* a collision took us forward? */ - queue_only_for_init = 0; - queue_only = 0; - } else { - sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED); - SCTP_SET_STATE(&stcb->asoc, SCTP_STATE_COOKIE_WAIT); - queue_only_for_init = 0; - queue_only = 1; - } + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_BLK_LOGGING_ENABLE) { + sctp_misc_ints(SCTP_CWNDLOG_PRESEND, queue_only_for_init, queue_only, + nagle_applies, un_sent); + sctp_misc_ints(SCTP_CWNDLOG_PRESEND, stcb->asoc.total_output_queue_size, + stcb->asoc.total_flight, + stcb->asoc.chunks_on_out_queue, stcb->asoc.total_flight_count); } + if (queue_only_for_init) + queue_only_for_init = 0; if ((queue_only == 0) && (nagle_applies == 0) && (stcb->asoc.peers_rwnd && un_sent)) { /* we can attempt to send too. */ if (hold_tcblock == 0) { From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 18:55:29 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF0FA1065679; Thu, 28 Oct 2010 18:55:29 +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 BC1E58FC13; Thu, 28 Oct 2010 18:55: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 o9SItTkR023451; Thu, 28 Oct 2010 18:55:29 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SItTu0023449; Thu, 28 Oct 2010 18:55:29 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281855.o9SItTu0023449@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 18:55:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214472 - stable/8/sys/netinet6 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 18:55:29 -0000 Author: tuexen Date: Thu Oct 28 18:55:29 2010 New Revision: 214472 URL: http://svn.freebsd.org/changeset/base/214472 Log: MFC r212699: Remove unused variables. Modified: stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Thu Oct 28 18:52:48 2010 (r214471) +++ stable/8/sys/netinet6/sctp6_usrreq.c Thu Oct 28 18:55:29 2010 (r214472) @@ -73,7 +73,11 @@ sctp6_input(struct mbuf **i_pak, int *of struct sctp_nets *net; int refcount_up = 0; uint32_t vrf_id = 0; + +#ifdef IPSEC struct inpcb *in6p_ip; + +#endif struct sctp_chunkhdr *ch; int length, offset, iphlen; uint8_t ecn_bits; @@ -224,11 +228,11 @@ sctp_skip_csum: } else if (stcb == NULL) { refcount_up = 1; } - in6p_ip = (struct inpcb *)in6p; #ifdef IPSEC /* * Check AH/ESP integrity. */ + in6p_ip = (struct inpcb *)in6p; if (in6p_ip && (ipsec6_in_reject(m, in6p_ip))) { /* XXX */ MODULE_GLOBAL(ipsec6stat).in_polvio++; @@ -813,7 +817,6 @@ sctp6_send(struct socket *so, int flags, struct mbuf *control, struct thread *p) { struct sctp_inpcb *inp; - struct inpcb *in_inp; struct in6pcb *inp6; #ifdef INET @@ -832,7 +835,6 @@ sctp6_send(struct socket *so, int flags, SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); return EINVAL; } - in_inp = (struct inpcb *)inp; inp6 = (struct in6pcb *)inp; /* * For the TCP model we may get a NULL addr, if we are a connected From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 18:57:17 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35DCE106564A; Thu, 28 Oct 2010 18:57:17 +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 08C198FC0C; Thu, 28 Oct 2010 18:57: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 o9SIvGmo023606; Thu, 28 Oct 2010 18:57:16 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SIvGhO023604; Thu, 28 Oct 2010 18:57:16 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281857.o9SIvGhO023604@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 18:57:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214473 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 18:57:17 -0000 Author: tuexen Date: Thu Oct 28 18:57:16 2010 New Revision: 214473 URL: http://svn.freebsd.org/changeset/base/214473 Log: MFC r212702: * Use !TAILQ_EMPTY() for checking if a tail queue is not empty. * Remove assignment without any effect. Modified: stable/8/sys/netinet/sctp_cc_functions.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_cc_functions.c ============================================================================== --- stable/8/sys/netinet/sctp_cc_functions.c Thu Oct 28 18:55:29 2010 (r214472) +++ stable/8/sys/netinet/sctp_cc_functions.c Thu Oct 28 18:57:16 2010 (r214473) @@ -171,7 +171,7 @@ sctp_cwnd_update_after_sack(struct sctp_ * So, first of all do we need to have a Early FR * timer running? */ - if (((TAILQ_FIRST(&asoc->sent_queue)) && + if ((!TAILQ_EMPTY(&asoc->sent_queue) && (net->ref_count > 1) && (net->flight_size < net->cwnd)) || (reneged_all)) { @@ -656,7 +656,6 @@ sctp_hs_cwnd_decrease(struct sctp_tcb *s int old_cwnd = net->cwnd; cur_val = net->cwnd >> 10; - indx = net->last_hs_used; if (cur_val < sctp_cwnd_adjust[0].cwnd) { /* normal mode */ net->ssthresh = net->cwnd / 2; @@ -793,7 +792,7 @@ sctp_hs_cwnd_update_after_sack(struct sc * So, first of all do we need to have a Early FR * timer running? */ - if (((TAILQ_FIRST(&asoc->sent_queue)) && + if ((!TAILQ_EMPTY(&asoc->sent_queue) && (net->ref_count > 1) && (net->flight_size < net->cwnd)) || (reneged_all)) { @@ -1279,7 +1278,7 @@ sctp_htcp_cwnd_update_after_sack(struct * So, first of all do we need to have a Early FR * timer running? */ - if (((TAILQ_FIRST(&asoc->sent_queue)) && + if ((!TAILQ_EMPTY(&asoc->sent_queue) && (net->ref_count > 1) && (net->flight_size < net->cwnd)) || (reneged_all)) { From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 18:59:10 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13F821065673; Thu, 28 Oct 2010 18:59:10 +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 014FB8FC26; Thu, 28 Oct 2010 18:59: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 o9SIx99e024079; Thu, 28 Oct 2010 18:59:09 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SIx9so024077; Thu, 28 Oct 2010 18:59:09 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281859.o9SIx9so024077@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 18:59:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214474 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 18:59:10 -0000 Author: tuexen Date: Thu Oct 28 18:59:09 2010 New Revision: 214474 URL: http://svn.freebsd.org/changeset/base/214474 Log: MFC r212704: Remove assignment without effect. Modified: stable/8/sys/netinet/sctp_sysctl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_sysctl.c ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.c Thu Oct 28 18:57:16 2010 (r214473) +++ stable/8/sys/netinet/sctp_sysctl.c Thu Oct 28 18:59:09 2010 (r214474) @@ -200,8 +200,6 @@ copy_out_local_addresses(struct sctp_inp ipv6_addr_legal = 0; } - error = 0; - /* neither Mac OS X nor FreeBSD support mulitple routing functions */ if ((vrf = sctp_find_vrf(inp->def_vrf_id)) == NULL) { SCTP_INP_RUNLOCK(inp); From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 19:00:45 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC783106566B; Thu, 28 Oct 2010 19:00:45 +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 A9B2D8FC1E; Thu, 28 Oct 2010 19:00: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 o9SJ0jPK024428; Thu, 28 Oct 2010 19:00:45 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SJ0jdM024426; Thu, 28 Oct 2010 19:00:45 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281900.o9SJ0jdM024426@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 19:00:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214475 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 19:00:45 -0000 Author: tuexen Date: Thu Oct 28 19:00:45 2010 New Revision: 214475 URL: http://svn.freebsd.org/changeset/base/214475 Log: MFC r212707: Remove unused variable/assignment. Modified: stable/8/sys/netinet/sctp_bsd_addr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_bsd_addr.c ============================================================================== --- stable/8/sys/netinet/sctp_bsd_addr.c Thu Oct 28 18:59:09 2010 (r214474) +++ stable/8/sys/netinet/sctp_bsd_addr.c Thu Oct 28 19:00:45 2010 (r214475) @@ -298,7 +298,6 @@ sctp_init_vrf_list(int vrfid) void sctp_addr_change(struct ifaddr *ifa, int cmd) { - struct sctp_ifa *ifap = NULL; uint32_t ifa_flags = 0; /* @@ -339,7 +338,7 @@ sctp_addr_change(struct ifaddr *ifa, int return; } if (cmd == RTM_ADD) { - ifap = sctp_add_addr_to_vrf(SCTP_DEFAULT_VRFID, (void *)ifa->ifa_ifp, + (void)sctp_add_addr_to_vrf(SCTP_DEFAULT_VRFID, (void *)ifa->ifa_ifp, ifa->ifa_ifp->if_index, ifa->ifa_ifp->if_type, ifa->ifa_ifp->if_xname, (void *)ifa, ifa->ifa_addr, ifa_flags, 1); From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 19:03:26 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8254106564A; Thu, 28 Oct 2010 19:03:26 +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 A564B8FC18; Thu, 28 Oct 2010 19:03: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 o9SJ3Qrk024945; Thu, 28 Oct 2010 19:03:26 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SJ3QoR024943; Thu, 28 Oct 2010 19:03:26 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281903.o9SJ3QoR024943@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 19:03:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214476 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 19:03:26 -0000 Author: tuexen Date: Thu Oct 28 19:03:26 2010 New Revision: 214476 URL: http://svn.freebsd.org/changeset/base/214476 Log: MFC r212711: Use TAILQ_EMPTY() for testing if a tail queue is empty. Set whoFrom to NULL after freeing whoFrom. Modified: stable/8/sys/netinet/sctp_indata.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Thu Oct 28 19:00:45 2010 (r214475) +++ stable/8/sys/netinet/sctp_indata.c Thu Oct 28 19:03:26 2010 (r214476) @@ -708,9 +708,10 @@ protocol_error: control->data = NULL; asoc->size_on_all_streams -= control->length; sctp_ucount_decr(asoc->cnt_on_all_streams); - if (control->whoFrom) + if (control->whoFrom) { sctp_free_remote_addr(control->whoFrom); - control->whoFrom = NULL; + control->whoFrom = NULL; + } sctp_free_a_readq(stcb, control); return; } else { @@ -4845,7 +4846,7 @@ sctp_handle_sack(struct mbuf *m, int off if (asoc->pr_sctp_cnt != 0) asoc->pr_sctp_cnt--; } - if ((TAILQ_FIRST(&asoc->sent_queue) == NULL) && + if (TAILQ_EMPTY(&asoc->sent_queue) && (asoc->total_flight > 0)) { #ifdef INVARIANTS panic("Warning flight size is postive and should be 0"); @@ -5818,7 +5819,7 @@ sctp_handle_forward_tsn(struct sctp_tcb */ sctp_slide_mapping_arrays(stcb); - if (TAILQ_FIRST(&asoc->reasmqueue)) { + if (!TAILQ_EMPTY(&asoc->reasmqueue)) { /* now lets kick out and check for more fragmented delivery */ /* sa_ignore NO_NULL_CHK */ sctp_deliver_reasm_check(stcb, &stcb->asoc); From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 19:05:22 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09164106564A; Thu, 28 Oct 2010 19:05:22 +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 E94018FC1C; Thu, 28 Oct 2010 19: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 o9SJ5Lk3025348; Thu, 28 Oct 2010 19:05:21 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SJ5LYh025339; Thu, 28 Oct 2010 19:05:21 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281905.o9SJ5LYh025339@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 19:05:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214477 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 19:05:22 -0000 Author: tuexen Date: Thu Oct 28 19:05:21 2010 New Revision: 214477 URL: http://svn.freebsd.org/changeset/base/214477 Log: MFC r212712: Delay the assignment of a path for DATA chunk until they hit the sent_queue. Honor a given path when the SCTP_ADDR_OVER flag is set. Modified: stable/8/sys/netinet/sctp_asconf.c stable/8/sys/netinet/sctp_asconf.h stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_output.h stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctp_timer.c stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_asconf.c ============================================================================== --- stable/8/sys/netinet/sctp_asconf.c Thu Oct 28 19:03:26 2010 (r214476) +++ stable/8/sys/netinet/sctp_asconf.c Thu Oct 28 19:05:21 2010 (r214477) @@ -581,8 +581,8 @@ sctp_process_asconf_set_primary(struct m } if (sctp_is_mobility_feature_on(stcb->sctp_ep, SCTP_MOBILITY_BASE)) { - sctp_move_chunks_from_deleted_prim(stcb, - stcb->asoc.primary_destination); + sctp_move_chunks_from_net(stcb, + stcb->asoc.deleted_primary); } sctp_delete_prim_timer(stcb->sctp_ep, stcb, stcb->asoc.deleted_primary); @@ -1041,47 +1041,6 @@ sctp_asconf_nets_cleanup(struct sctp_tcb } } -void -sctp_move_chunks_from_deleted_prim(struct sctp_tcb *stcb, struct sctp_nets *dst) -{ - struct sctp_association *asoc; - struct sctp_stream_out *outs; - struct sctp_tmit_chunk *chk; - struct sctp_stream_queue_pending *sp; - - if (dst->dest_state & SCTP_ADDR_UNCONFIRMED) { - return; - } - if (stcb->asoc.deleted_primary == NULL) { - return; - } - asoc = &stcb->asoc; - - /* - * now through all the streams checking for chunks sent to our bad - * network. - */ - TAILQ_FOREACH(outs, &asoc->out_wheel, next_spoke) { - /* now clean up any chunks here */ - TAILQ_FOREACH(sp, &outs->outqueue, next) { - if (sp->net == asoc->deleted_primary) { - sctp_free_remote_addr(sp->net); - sp->net = dst; - atomic_add_int(&dst->ref_count, 1); - } - } - } - /* Now check the pending queue */ - TAILQ_FOREACH(chk, &asoc->send_queue, sctp_next) { - if (chk->whoTo == asoc->deleted_primary) { - sctp_free_remote_addr(chk->whoTo); - chk->whoTo = dst; - atomic_add_int(&dst->ref_count, 1); - } - } - -} - void sctp_assoc_immediate_retrans(struct sctp_tcb *stcb, struct sctp_nets *dstnet) @@ -2080,13 +2039,11 @@ sctp_asconf_iterator_ep(struct sctp_inpc struct sctp_asconf_iterator *asc; struct sctp_ifa *ifa; struct sctp_laddr *l; - int type; int cnt_invalid = 0; asc = (struct sctp_asconf_iterator *)ptr; LIST_FOREACH(l, &asc->list_of_work, sctp_nxt_addr) { ifa = l->ifa; - type = l->action; if (ifa->address.sa.sa_family == AF_INET6) { /* invalid if we're not a v6 endpoint */ if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0) { Modified: stable/8/sys/netinet/sctp_asconf.h ============================================================================== --- stable/8/sys/netinet/sctp_asconf.h Thu Oct 28 19:03:26 2010 (r214476) +++ stable/8/sys/netinet/sctp_asconf.h Thu Oct 28 19:05:21 2010 (r214477) @@ -80,8 +80,6 @@ sctp_check_address_list(struct sctp_tcb struct sockaddr *, uint16_t, uint16_t, uint16_t, uint16_t); extern void - sctp_move_chunks_from_deleted_prim(struct sctp_tcb *, struct sctp_nets *); -extern void sctp_assoc_immediate_retrans(struct sctp_tcb *, struct sctp_nets *); extern void sctp_net_immediate_retrans(struct sctp_tcb *, struct sctp_nets *); Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Oct 28 19:03:26 2010 (r214476) +++ stable/8/sys/netinet/sctp_input.c Thu Oct 28 19:05:21 2010 (r214477) @@ -232,7 +232,10 @@ sctp_is_there_unsent_data(struct sctp_tc } atomic_subtract_int(&stcb->asoc.stream_queue_cnt, 1); TAILQ_REMOVE(&strq->outqueue, sp, next); - sctp_free_remote_addr(sp->net); + if (sp->net) { + sctp_free_remote_addr(sp->net); + sp->net = NULL; + } if (sp->data) { sctp_m_freem(sp->data); sp->data = NULL; @@ -263,7 +266,7 @@ sctp_process_init(struct sctp_init_chunk /* save off parameters */ asoc->peer_vtag = ntohl(init->initiate_tag); asoc->peers_rwnd = ntohl(init->a_rwnd); - if (TAILQ_FIRST(&asoc->nets)) { + 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; @@ -318,8 +321,10 @@ sctp_process_init(struct sctp_init_chunk sctp_m_freem(sp->data); sp->data = NULL; } - sctp_free_remote_addr(sp->net); - sp->net = NULL; + if (sp->net) { + sctp_free_remote_addr(sp->net); + sp->net = NULL; + } /* Free the chunk */ sctp_free_a_strmoq(stcb, sp); /* sa_ignore FREED_MEMORY */ @@ -650,8 +655,8 @@ sctp_handle_heartbeat_ack(struct sctp_he } if (sctp_is_mobility_feature_on(stcb->sctp_ep, SCTP_MOBILITY_BASE)) { - sctp_move_chunks_from_deleted_prim(stcb, - stcb->asoc.primary_destination); + sctp_move_chunks_from_net(stcb, + stcb->asoc.deleted_primary); } sctp_delete_prim_timer(stcb->sctp_ep, stcb, stcb->asoc.deleted_primary); Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Oct 28 19:03:26 2010 (r214476) +++ stable/8/sys/netinet/sctp_output.c Thu Oct 28 19:05:21 2010 (r214477) @@ -5911,10 +5911,10 @@ sctp_msg_append(struct sctp_tcb *stcb, sp->strseq = 0; if (sp->sinfo_flags & SCTP_ADDR_OVER) { sp->net = net; + atomic_add_int(&sp->net->ref_count, 1); } else { - sp->net = stcb->asoc.primary_destination; + sp->net = NULL; } - atomic_add_int(&sp->net->ref_count, 1); (void)SCTP_GETTIME_TIMEVAL(&sp->ts); sp->stream = srcv->sinfo_stream; sp->msg_is_complete = 1; @@ -6513,7 +6513,6 @@ sctp_toss_old_asconf(struct sctp_tcb *st static void sctp_clean_up_datalist(struct sctp_tcb *stcb, - struct sctp_association *asoc, struct sctp_tmit_chunk **data_list, int bundle_at, @@ -6524,7 +6523,9 @@ sctp_clean_up_datalist(struct sctp_tcb * for (i = 0; i < bundle_at; i++) { /* off of the send queue */ - if (i) { + TAILQ_REMOVE(&asoc->send_queue, data_list[i], sctp_next); + asoc->send_queue_cnt--; + if (i > 0) { /* * Any chunk NOT 0 you zap the time chunk 0 gets * zapped or set based on if a RTO measurment is @@ -6535,9 +6536,10 @@ sctp_clean_up_datalist(struct sctp_tcb * /* record time */ data_list[i]->sent_rcv_time = net->last_sent_time; data_list[i]->rec.data.fast_retran_tsn = data_list[i]->rec.data.TSN_seq; - TAILQ_REMOVE(&asoc->send_queue, - data_list[i], - sctp_next); + if (data_list[i]->whoTo == NULL) { + data_list[i]->whoTo = net; + atomic_add_int(&net->ref_count, 1); + } /* on to the sent queue */ tp1 = TAILQ_LAST(&asoc->sent_queue, sctpchunk_listhead); if ((tp1) && (compare_with_wrap(tp1->rec.data.TSN_seq, @@ -6565,7 +6567,6 @@ sctp_clean_up_datalist(struct sctp_tcb * all_done: /* This does not lower until the cum-ack passes it */ asoc->sent_queue_cnt++; - asoc->send_queue_cnt--; if ((asoc->peers_rwnd <= 0) && (asoc->total_flight == 0) && (bundle_at == 1)) { @@ -6703,7 +6704,7 @@ sctp_can_we_split_this(struct sctp_tcb * } static uint32_t -sctp_move_to_outqueue(struct sctp_tcb *stcb, struct sctp_nets *net, +sctp_move_to_outqueue(struct sctp_tcb *stcb, struct sctp_stream_out *strq, uint32_t goal_mtu, uint32_t frag_point, @@ -6772,7 +6773,10 @@ one_more_time: } atomic_subtract_int(&asoc->stream_queue_cnt, 1); TAILQ_REMOVE(&strq->outqueue, sp, next); - sctp_free_remote_addr(sp->net); + if (sp->net) { + sctp_free_remote_addr(sp->net); + sp->net = NULL; + } if (sp->data) { sctp_m_freem(sp->data); sp->data = NULL; @@ -7089,8 +7093,11 @@ dont_do_it: chk->rec.data.timetodrop = sp->ts; chk->flags = sp->act_flags; - chk->whoTo = net; - atomic_add_int(&chk->whoTo->ref_count, 1); + if (sp->net) { + chk->whoTo = sp->net; + atomic_add_int(&chk->whoTo->ref_count, 1); + } else + chk->whoTo = NULL; if (sp->holds_key_ref) { chk->auth_keyid = sp->auth_keyid; @@ -7175,7 +7182,10 @@ dont_do_it: send_lock_up = 1; } TAILQ_REMOVE(&strq->outqueue, sp, next); - sctp_free_remote_addr(sp->net); + if (sp->net) { + sctp_free_remote_addr(sp->net); + sp->net = NULL; + } if (sp->data) { sctp_m_freem(sp->data); sp->data = NULL; @@ -7248,31 +7258,29 @@ sctp_fill_outqueue(struct sctp_tcb *stcb goal_mtu &= 0xfffffffc; if (asoc->locked_on_sending) { /* We are stuck on one stream until the message completes. */ - strqn = strq = asoc->locked_on_sending; + strq = asoc->locked_on_sending; locked = 1; } else { - strqn = strq = sctp_select_a_stream(stcb, asoc); + strq = sctp_select_a_stream(stcb, asoc); locked = 0; } - + strqn = strq; while ((goal_mtu > 0) && strq) { sp = TAILQ_FIRST(&strq->outqueue); - /* - * If CMT is off, we must validate that the stream in - * question has the first item pointed towards are network - * destionation 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 case, by - * skipping this check, we will send one data packet towards - * the requested net. - */ if (sp == NULL) { break; } - if ((sp->net != net) && - (asoc->sctp_cmt_on_off == 0)) { - /* none for this network */ + /** + * Honor the users' choice if given. If not given, + * pull it only to the primary path in case of not using + * CMT. + */ + if (((sp->net != NULL) && + (sp->net != net)) || + ((sp->net == NULL) && + (asoc->sctp_cmt_on_off == 0) && + (asoc->primary_destination != net))) { + /* Do not pull to this network */ if (locked) { break; } else { @@ -7289,7 +7297,7 @@ sctp_fill_outqueue(struct sctp_tcb *stcb } giveup = 0; bail = 0; - moved_how_much = sctp_move_to_outqueue(stcb, net, strq, goal_mtu, frag_point, &locked, + moved_how_much = sctp_move_to_outqueue(stcb, strq, goal_mtu, frag_point, &locked, &giveup, eeor_mode, &bail); if (moved_how_much) asoc->last_out_stream = strq; @@ -7353,43 +7361,32 @@ sctp_fix_ecn_echo(struct sctp_associatio } } -static void -sctp_move_to_an_alt(struct sctp_tcb *stcb, - struct sctp_association *asoc, - struct sctp_nets *net) +void +sctp_move_chunks_from_net(struct sctp_tcb *stcb, struct sctp_nets *net) { + struct sctp_association *asoc; + struct sctp_stream_out *outs; struct sctp_tmit_chunk *chk; - struct sctp_nets *a_net; + struct sctp_stream_queue_pending *sp; - SCTP_TCB_LOCK_ASSERT(stcb); - /* - * JRS 5/14/07 - If CMT PF is turned on, find an alternate - * destination using the PF algorithm for finding alternate - * destinations. - */ - if ((asoc->sctp_cmt_on_off == 1) && - (asoc->sctp_cmt_pf > 0)) { - a_net = sctp_find_alternate_net(stcb, net, 2); - } else { - a_net = sctp_find_alternate_net(stcb, net, 0); + if (net == NULL) { + return; } - if ((a_net != net) && - ((a_net->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE)) { - /* - * We only proceed if a valid alternate is found that is not - * this one and is reachable. Here we must move all chunks - * queued in the send queue off of the destination address - * to our alternate. - */ - TAILQ_FOREACH(chk, &asoc->send_queue, sctp_next) { - if (chk->whoTo == net) { - /* Move the chunk to our alternate */ - sctp_free_remote_addr(chk->whoTo); - chk->whoTo = a_net; - atomic_add_int(&a_net->ref_count, 1); + asoc = &stcb->asoc; + TAILQ_FOREACH(outs, &asoc->out_wheel, next_spoke) { + TAILQ_FOREACH(sp, &outs->outqueue, next) { + if (sp->net == net) { + sctp_free_remote_addr(sp->net); + sp->net = NULL; } } } + TAILQ_FOREACH(chk, &asoc->send_queue, sctp_next) { + if (chk->whoTo == net) { + sctp_free_remote_addr(chk->whoTo); + chk->whoTo = NULL; + } + } } int @@ -7497,7 +7494,8 @@ sctp_med_chunk_output(struct sctp_inpcb * copy by reference (we hope). */ net->window_probe = 0; - if ((net->dest_state & SCTP_ADDR_NOT_REACHABLE) || (net->dest_state & SCTP_ADDR_UNCONFIRMED)) { + if ((net->dest_state & SCTP_ADDR_NOT_REACHABLE) || + (net->dest_state & SCTP_ADDR_UNCONFIRMED)) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) { sctp_log_cwnd(stcb, net, 1, SCTP_CWND_LOG_FILL_OUTQ_CALLED); @@ -7505,6 +7503,7 @@ sctp_med_chunk_output(struct sctp_inpcb continue; } if ((asoc->sctp_cmt_on_off == 0) && + (asoc->primary_destination != net) && (net->ref_count < 2)) { /* nothing can be in queue for this guy */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) { @@ -7534,9 +7533,9 @@ sctp_med_chunk_output(struct sctp_inpcb } /* now service each destination and send out what we can for it */ /* Nothing to send? */ - if ((TAILQ_FIRST(&asoc->control_send_queue) == NULL) && - (TAILQ_FIRST(&asoc->asconf_send_queue) == NULL) && - (TAILQ_FIRST(&asoc->send_queue) == NULL)) { + if (TAILQ_EMPTY(&asoc->control_send_queue) && + TAILQ_EMPTY(&asoc->asconf_send_queue) && + TAILQ_EMPTY(&asoc->send_queue)) { *reason_code = 8; return (0); } @@ -7566,15 +7565,17 @@ again_one_more_time: break; } tsns_sent = 0xa; - if ((asoc->sctp_cmt_on_off == 0) && (net->ref_count < 2)) { + if ((asoc->sctp_cmt_on_off == 0) && + (asoc->primary_destination != net) && + (net->ref_count < 2)) { /* * Ref-count of 1 so we cannot have data or control * queued to this address. Skip it (non-CMT). */ continue; } - if ((TAILQ_FIRST(&asoc->control_send_queue) == NULL) && - (TAILQ_FIRST(&asoc->asconf_send_queue) == NULL) && + if (TAILQ_EMPTY(&asoc->control_send_queue) && + TAILQ_EMPTY(&asoc->asconf_send_queue) && (net->flight_size >= net->cwnd)) { /* * Nothing on control or asconf and flight is full, @@ -7778,7 +7779,7 @@ again_one_more_time: * unreachable * during this send */ - sctp_move_to_an_alt(stcb, asoc, net); + sctp_move_chunks_from_net(stcb, net); } *reason_code = 7; continue; @@ -8001,7 +8002,7 @@ again_one_more_time: * unreachable * during this send */ - sctp_move_to_an_alt(stcb, asoc, net); + sctp_move_chunks_from_net(stcb, net); } *reason_code = 7; continue; @@ -8102,19 +8103,9 @@ again_one_more_time: break; } nchk = TAILQ_NEXT(chk, sctp_next); - if (asoc->sctp_cmt_on_off == 1) { - if (chk->whoTo != net) { - /* - * For CMT, steal the data - * to this network if its - * not set here. - */ - sctp_free_remote_addr(chk->whoTo); - chk->whoTo = net; - atomic_add_int(&chk->whoTo->ref_count, 1); - } - } else if (chk->whoTo != net) { - /* No, not sent to this net */ + if ((chk->whoTo != NULL) && + (chk->whoTo != net)) { + /* Don't send the chunk on this net */ continue; } if ((chk->send_size > omtu) && ((chk->flags & CHUNK_FLAGS_FRAGMENT_OK) == 0)) { @@ -8330,7 +8321,7 @@ no_data_fill: * Destination went unreachable * during this send */ - sctp_move_to_an_alt(stcb, asoc, net); + sctp_move_chunks_from_net(stcb, net); } *reason_code = 6; /*- @@ -9584,7 +9575,7 @@ sctp_chunk_output(struct sctp_inpcb *inp * out wheel to this alternate address. */ if (net->ref_count > 1) - sctp_move_to_an_alt(stcb, asoc, net); + sctp_move_chunks_from_net(stcb, net); } else if ((asoc->sctp_cmt_on_off == 1) && (asoc->sctp_cmt_pf > 0) && ((net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF)) { @@ -9594,7 +9585,7 @@ sctp_chunk_output(struct sctp_inpcb *inp * to an alternate desination. */ if (net->ref_count > 1) - sctp_move_to_an_alt(stcb, asoc, net); + sctp_move_chunks_from_net(stcb, net); } else { /*- * if ((asoc->sat_network) || (net->addr_is_local)) @@ -12103,10 +12094,10 @@ skip_copy: } else { if (sp->sinfo_flags & SCTP_ADDR_OVER) { sp->net = net; + atomic_add_int(&sp->net->ref_count, 1); } else { - sp->net = asoc->primary_destination; + sp->net = NULL; } - atomic_add_int(&sp->net->ref_count, 1); sctp_set_prsctp_policy(sp); } out_now: Modified: stable/8/sys/netinet/sctp_output.h ============================================================================== --- stable/8/sys/netinet/sctp_output.h Thu Oct 28 19:03:26 2010 (r214476) +++ stable/8/sys/netinet/sctp_output.h Thu Oct 28 19:05:21 2010 (r214477) @@ -129,6 +129,8 @@ void sctp_toss_old_asconf(struct sctp_tc void sctp_fix_ecn_echo(struct sctp_association *); +void sctp_move_chunks_from_net(struct sctp_tcb *stcb, struct sctp_nets *net); + int sctp_output(struct sctp_inpcb *, struct mbuf *, struct sockaddr *, struct mbuf *, struct thread *, int); Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Thu Oct 28 19:03:26 2010 (r214476) +++ stable/8/sys/netinet/sctp_pcb.c Thu Oct 28 19:05:21 2010 (r214477) @@ -4843,7 +4843,10 @@ sctp_free_assoc(struct sctp_inpcb *inp, sp->tail_mbuf = NULL; } } - sctp_free_remote_addr(sp->net); + if (sp->net) { + sctp_free_remote_addr(sp->net); + sp->net = NULL; + } sctp_free_spbufspace(stcb, asoc, sp); if (sp->holds_key_ref) sctp_auth_key_release(stcb, sp->auth_keyid); @@ -4914,7 +4917,10 @@ sctp_free_assoc(struct sctp_inpcb *inp, if (chk->holds_key_ref) sctp_auth_key_release(stcb, chk->auth_keyid); ccnt++; - sctp_free_remote_addr(chk->whoTo); + if (chk->whoTo) { + sctp_free_remote_addr(chk->whoTo); + chk->whoTo = NULL; + } SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), chk); SCTP_DECR_CHK_COUNT(); /* sa_ignore FREED_MEMORY */ Modified: stable/8/sys/netinet/sctp_timer.c ============================================================================== --- stable/8/sys/netinet/sctp_timer.c Thu Oct 28 19:03:26 2010 (r214476) +++ stable/8/sys/netinet/sctp_timer.c Thu Oct 28 19:05:21 2010 (r214477) @@ -969,46 +969,6 @@ start_again: return (0); } -static void -sctp_move_all_chunks_to_alt(struct sctp_tcb *stcb, - struct sctp_nets *net, - struct sctp_nets *alt) -{ - struct sctp_association *asoc; - struct sctp_stream_out *outs; - struct sctp_tmit_chunk *chk; - struct sctp_stream_queue_pending *sp; - - if (net == alt) - /* nothing to do */ - return; - - asoc = &stcb->asoc; - - /* - * now through all the streams checking for chunks sent to our bad - * network. - */ - TAILQ_FOREACH(outs, &asoc->out_wheel, next_spoke) { - /* now clean up any chunks here */ - TAILQ_FOREACH(sp, &outs->outqueue, next) { - if (sp->net == net) { - sctp_free_remote_addr(sp->net); - sp->net = alt; - atomic_add_int(&alt->ref_count, 1); - } - } - } - /* Now check the pending queue */ - TAILQ_FOREACH(chk, &asoc->send_queue, sctp_next) { - if (chk->whoTo == net) { - sctp_free_remote_addr(chk->whoTo); - chk->whoTo = alt; - atomic_add_int(&alt->ref_count, 1); - } - } - -} int sctp_t3rxt_timer(struct sctp_inpcb *inp, @@ -1141,7 +1101,7 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, } if (net->dest_state & SCTP_ADDR_NOT_REACHABLE) { /* Move all pending over too */ - sctp_move_all_chunks_to_alt(stcb, net, alt); + sctp_move_chunks_from_net(stcb, net); /* * Get the address that failed, to force a new src address @@ -1256,7 +1216,7 @@ sctp_t1init_timer(struct sctp_inpcb *inp alt = sctp_find_alternate_net(stcb, stcb->asoc.primary_destination, 0); if ((alt != NULL) && (alt != stcb->asoc.primary_destination)) { - sctp_move_all_chunks_to_alt(stcb, stcb->asoc.primary_destination, alt); + sctp_move_chunks_from_net(stcb, stcb->asoc.primary_destination); stcb->asoc.primary_destination = alt; } } @@ -1396,7 +1356,7 @@ sctp_strreset_timer(struct sctp_inpcb *i * If the address went un-reachable, we need to move to * alternates for ALL chk's in queue */ - sctp_move_all_chunks_to_alt(stcb, net, alt); + sctp_move_chunks_from_net(stcb, net); } /* mark the retran info */ if (strrst->sent != SCTP_DATAGRAM_RESEND) @@ -1487,8 +1447,7 @@ sctp_asconf_timer(struct sctp_inpcb *inp * If the address went un-reachable, we need to move * to the alternate for ALL chunks in queue */ - sctp_move_all_chunks_to_alt(stcb, net, alt); - net = alt; + sctp_move_chunks_from_net(stcb, net); } /* mark the retran info */ if (asconf->sent != SCTP_DATAGRAM_RESEND) Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Oct 28 19:03:26 2010 (r214476) +++ stable/8/sys/netinet/sctputil.c Thu Oct 28 19:05:21 2010 (r214477) @@ -2500,7 +2500,6 @@ sctp_mtu_size_reset(struct sctp_inpcb *i } eff_mtu = mtu - ovh; TAILQ_FOREACH(chk, &asoc->send_queue, sctp_next) { - if (chk->send_size > eff_mtu) { chk->flags |= CHUNK_FLAGS_FRAGMENT_OK; } @@ -3763,9 +3762,10 @@ sctp_report_all_outbound(struct sctp_tcb sp->data = NULL; } } - if (sp->net) + if (sp->net) { sctp_free_remote_addr(sp->net); - sp->net = NULL; + sp->net = NULL; + } /* Free the chunk */ sctp_free_a_strmoq(stcb, sp); /* sa_ignore FREED_MEMORY */ @@ -4818,7 +4818,10 @@ next_on_sent: chk->rec.data.payloadtype = sp->ppid; chk->rec.data.context = sp->context; chk->flags = sp->act_flags; - chk->whoTo = sp->net; + if (sp->net) + chk->whoTo = sp->net; + else + chk->whoTo = stcb->asoc.primary_destination; atomic_add_int(&chk->whoTo->ref_count, 1); chk->rec.data.TSN_seq = atomic_fetchadd_int(&stcb->asoc.sending_seq, 1); stcb->asoc.pr_sctp_cnt++; From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 19:07:05 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0A771065672; Thu, 28 Oct 2010 19:07:05 +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 BD87D8FC13; Thu, 28 Oct 2010 19: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 o9SJ75J2025658; Thu, 28 Oct 2010 19:07:05 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SJ75tw025656; Thu, 28 Oct 2010 19:07:05 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281907.o9SJ75tw025656@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 19:07:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214479 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 19:07:05 -0000 Author: tuexen Date: Thu Oct 28 19:07:05 2010 New Revision: 214479 URL: http://svn.freebsd.org/changeset/base/214479 Log: MFC r212713: Remove unused variable/assignment. Modified: stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Oct 28 19:06:17 2010 (r214478) +++ stable/8/sys/netinet/sctputil.c Thu Oct 28 19:07:05 2010 (r214479) @@ -5135,7 +5135,7 @@ sctp_sorecvmsg(struct socket *so, int my_len = 0; int cp_len = 0, error = 0; struct sctp_queued_to_read *control = NULL, *ctl = NULL, *nxt = NULL; - struct mbuf *m = NULL, *embuf = NULL; + struct mbuf *m = NULL; struct sctp_tcb *stcb = NULL; int wakeup_read_socket = 0; int freecnt_applied = 0; @@ -5731,7 +5731,6 @@ get_more_data: sctp_sblog(&so->so_rcv, control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBRESULT, 0); } - embuf = m; copied_so_far += cp_len; freed_so_far += cp_len; freed_so_far += MSIZE; @@ -5783,7 +5782,6 @@ get_more_data: atomic_subtract_int(&stcb->asoc.sb_cc, cp_len); } copied_so_far += cp_len; - embuf = m; freed_so_far += cp_len; freed_so_far += MSIZE; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SB_LOGGING_ENABLE) { From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 19:08:50 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE75C1065679; Thu, 28 Oct 2010 19:08:50 +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 CB1C18FC13; Thu, 28 Oct 2010 19:08: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 o9SJ8oSI025788; Thu, 28 Oct 2010 19:08:50 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SJ8ogg025783; Thu, 28 Oct 2010 19:08:50 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281908.o9SJ8ogg025783@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 19:08:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214480 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 19:08:51 -0000 Author: tuexen Date: Thu Oct 28 19:08:50 2010 New Revision: 214480 URL: http://svn.freebsd.org/changeset/base/214480 Log: MFC r212714: Remove old debug code. Modified: stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Oct 28 19:07:05 2010 (r214479) +++ stable/8/sys/netinet/sctp_output.c Thu Oct 28 19:08:50 2010 (r214480) @@ -3803,9 +3803,6 @@ sctp_lowlevel_chunk_output(struct sctp_i mtu -= sizeof(struct udphdr); } if (mtu && (stcb->asoc.smallest_mtu > mtu)) { -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF("sctp_mtu_size_reset called after ip_output mtu-change:%d\n", mtu); -#endif sctp_mtu_size_reset(inp, &stcb->asoc, mtu); net->mtu = mtu; } @@ -4134,10 +4131,6 @@ sctp_lowlevel_chunk_output(struct sctp_i mtu = SCTP_GATHER_MTU_FROM_ROUTE(net->ro._s_addr, &net->ro._l_addr.sa, ro->ro_rt); if (mtu && (stcb->asoc.smallest_mtu > mtu)) { -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF("sctp_mtu_size_reset called after ip6_output mtu-change:%d\n", - mtu); -#endif sctp_mtu_size_reset(inp, &stcb->asoc, mtu); net->mtu = mtu; if (net->port) { @@ -4147,10 +4140,6 @@ sctp_lowlevel_chunk_output(struct sctp_i } else if (ifp) { if (ND_IFINFO(ifp)->linkmtu && (stcb->asoc.smallest_mtu > ND_IFINFO(ifp)->linkmtu)) { -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF("sctp_mtu_size_reset called via ifp ND_IFINFO() linkmtu:%d\n", - ND_IFINFO(ifp)->linkmtu); -#endif sctp_mtu_size_reset(inp, &stcb->asoc, ND_IFINFO(ifp)->linkmtu); Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Thu Oct 28 19:07:05 2010 (r214479) +++ stable/8/sys/netinet/sctp_pcb.c Thu Oct 28 19:08:50 2010 (r214480) @@ -3916,9 +3916,6 @@ sctp_add_remote_addr(struct sctp_tcb *st } else { net->mtu = 0; } -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF("We have found an interface mtu of %d\n", net->mtu); -#endif if (net->mtu == 0) { /* Huh ?? */ net->mtu = SCTP_DEFAULT_MTU; @@ -3926,9 +3923,6 @@ sctp_add_remote_addr(struct sctp_tcb *st uint32_t rmtu; rmtu = SCTP_GATHER_MTU_FROM_ROUTE(net->ro._s_addr, &net->ro._l_addr.sa, net->ro.ro_rt); -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF("The route mtu is %d\n", rmtu); -#endif if (rmtu == 0) { /* * Start things off to match mtu of @@ -3946,9 +3940,6 @@ sctp_add_remote_addr(struct sctp_tcb *st } } if (from == SCTP_ALLOC_ASOC) { -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF("New assoc sets mtu to :%d\n", net->mtu); -#endif stcb->asoc.smallest_mtu = net->mtu; } } else { @@ -3966,10 +3957,6 @@ sctp_add_remote_addr(struct sctp_tcb *st net->mtu -= sizeof(struct udphdr); } if (stcb->asoc.smallest_mtu > net->mtu) { -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF("new address mtu:%d smaller than smallest:%d\n", - net->mtu, stcb->asoc.smallest_mtu); -#endif stcb->asoc.smallest_mtu = net->mtu; } /* JRS - Use the congestion control given in the CC module */ Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Thu Oct 28 19:07:05 2010 (r214479) +++ stable/8/sys/netinet/sctp_usrreq.c Thu Oct 28 19:08:50 2010 (r214480) @@ -111,10 +111,6 @@ sctp_pathmtu_adjustment(struct sctp_inpc /* Adjust that too */ stcb->asoc.smallest_mtu = nxtsz; /* now off to subtract IP_DF flag if needed */ -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF("sctp_pathmtu_adjust called inp:%p stcb:%p net:%p nxtsz:%d\n", - inp, stcb, net, nxtsz); -#endif overhead = IP_HDR_SIZE; if (sctp_auth_is_required_chunk(SCTP_DATA, stcb->asoc.peer_auth_chunks)) { overhead += sctp_get_auth_chunk_len(stcb->asoc.peer_hmac_id); @@ -215,10 +211,6 @@ sctp_notify_mbuf(struct sctp_inpcb *inp, } /* now what about the ep? */ if (stcb->asoc.smallest_mtu > nxtsz) { -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF("notify_mbuf (ICMP) calls sctp_pathmtu_adjust mtu:%d\n", - nxtsz); -#endif sctp_pathmtu_adjustment(inp, stcb, net, nxtsz); } if (tmr_stopped) @@ -3806,10 +3798,6 @@ sctp_setopt(struct socket *so, int optna if (paddrp->spp_pathmtu > SCTP_DEFAULT_MINSEGMENT) { net->mtu = paddrp->spp_pathmtu + ovh; if (net->mtu < stcb->asoc.smallest_mtu) { -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF("SCTP_PMTU_DISABLE calls sctp_pathmtu_adjustment:%d\n", - net->mtu); -#endif sctp_pathmtu_adjustment(inp, stcb, net, net->mtu); } } @@ -3854,10 +3842,6 @@ sctp_setopt(struct socket *so, int optna if (paddrp->spp_pathmtu > SCTP_DEFAULT_MINSEGMENT) { net->mtu = paddrp->spp_pathmtu + ovh; if (net->mtu < stcb->asoc.smallest_mtu) { -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF("SCTP_PMTU_DISABLE calls sctp_pathmtu_adjustment:%d\n", - net->mtu); -#endif sctp_pathmtu_adjustment(inp, stcb, net, net->mtu); } } Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Thu Oct 28 19:07:05 2010 (r214479) +++ stable/8/sys/netinet/sctputil.c Thu Oct 28 19:08:50 2010 (r214480) @@ -1004,10 +1004,6 @@ sctp_init_asoc(struct sctp_inpcb *m, str asoc->peers_rwnd = SCTP_SB_LIMIT_RCV(m->sctp_socket); asoc->smallest_mtu = m->sctp_frag_point; -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF("smallest_mtu init'd with asoc to :%d\n", - asoc->smallest_mtu); -#endif asoc->minrto = m->sctp_ep.sctp_minrto; asoc->maxrto = m->sctp_ep.sctp_maxrto; @@ -2488,10 +2484,6 @@ sctp_mtu_size_reset(struct sctp_inpcb *i struct sctp_tmit_chunk *chk; unsigned int eff_mtu, ovh; -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF("sctp_mtu_size_reset(%p, asoc:%p mtu:%d\n", - inp, asoc, mtu); -#endif asoc->smallest_mtu = mtu; if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { ovh = SCTP_MIN_OVERHEAD; From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 19:10:31 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C143C1065675; Thu, 28 Oct 2010 19:10:31 +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 ADA528FC2E; Thu, 28 Oct 2010 19:10: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 o9SJAV6s025993; Thu, 28 Oct 2010 19:10:31 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SJAVLD025988; Thu, 28 Oct 2010 19:10:31 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281910.o9SJAVLD025988@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 19:10:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214483 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 19:10:31 -0000 Author: tuexen Date: Thu Oct 28 19:10:31 2010 New Revision: 214483 URL: http://svn.freebsd.org/changeset/base/214483 Log: MFC r212799: * Implement initial version of send buffer splitting. * Make send/recv buffer splitting switchable via sysctl. * While there: Fix some comments. Modified: stable/8/sys/netinet/sctp_constants.h stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_sysctl.c stable/8/sys/netinet/sctp_sysctl.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_constants.h ============================================================================== --- stable/8/sys/netinet/sctp_constants.h Thu Oct 28 19:10:15 2010 (r214482) +++ stable/8/sys/netinet/sctp_constants.h Thu Oct 28 19:10:31 2010 (r214483) @@ -948,6 +948,9 @@ __FBSDID("$FreeBSD$"); */ #define SCTP_TIME_WAIT 60 +#define SCTP_SEND_BUFFER_SPLITTING 0x00000001 +#define SCTP_RECV_BUFFER_SPLITTING 0x00000002 + /* The system retains a cache of free chunks such to * cut down on calls the memory allocation system. There * is a per association limit of free items and a overall Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Oct 28 19:10:15 2010 (r214482) +++ stable/8/sys/netinet/sctp_output.c Thu Oct 28 19:10:31 2010 (r214483) @@ -7407,7 +7407,7 @@ sctp_med_chunk_output(struct sctp_inpcb /* temp arrays for unlinking */ struct sctp_tmit_chunk *data_list[SCTP_MAX_DATA_BUNDLING]; int no_fragmentflg, error; - unsigned int max_rwnd_per_dest; + unsigned int max_rwnd_per_dest, max_send_per_dest; int one_chunk, hbflag, skip_data_for_this_net; int asconf, cookie, no_out_cnt; int bundle_at, ctl_cnt, no_data_chunks, eeor_mode; @@ -7469,6 +7469,10 @@ sctp_med_chunk_output(struct sctp_inpcb } } max_rwnd_per_dest = ((asoc->peers_rwnd + asoc->total_flight) / asoc->numnets); + if (stcb->sctp_socket) + max_send_per_dest = SCTP_SB_LIMIT_SND(stcb->sctp_socket) / asoc->numnets; + else + max_send_per_dest = 0; if ((no_data_chunks == 0) && (!TAILQ_EMPTY(&asoc->out_wheel))) { TAILQ_FOREACH(net, &asoc->nets, sctp_next) { /* @@ -8039,9 +8043,22 @@ again_one_more_time: goto no_data_fill; } if ((asoc->sctp_cmt_on_off == 1) && + (SCTP_BASE_SYSCTL(sctp_buffer_splitting) & SCTP_RECV_BUFFER_SPLITTING) && (net->flight_size > max_rwnd_per_dest)) { goto no_data_fill; } + /* + * We need a specific accounting for the usage of the send + * buffer. We also need to check the number of messages per + * net. For now, this is better than nothing and it disabled + * by default... + */ + if ((asoc->sctp_cmt_on_off == 1) && + (SCTP_BASE_SYSCTL(sctp_buffer_splitting) & SCTP_SEND_BUFFER_SPLITTING) && + (max_send_per_dest > 0) && + (net->flight_size > max_send_per_dest)) { + goto no_data_fill; + } /*********************/ /* Data transmission */ /*********************/ Modified: stable/8/sys/netinet/sctp_sysctl.c ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.c Thu Oct 28 19:10:15 2010 (r214482) +++ stable/8/sys/netinet/sctp_sysctl.c Thu Oct 28 19:10:31 2010 (r214483) @@ -109,6 +109,7 @@ sctp_init_sysctls() SCTP_BASE_SYSCTL(sctp_mobility_base) = SCTPCTL_MOBILITY_BASE_DEFAULT; SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff) = SCTPCTL_MOBILITY_FASTHANDOFF_DEFAULT; SCTP_BASE_SYSCTL(sctp_vtag_time_wait) = SCTPCTL_TIME_WAIT_DEFAULT; + SCTP_BASE_SYSCTL(sctp_buffer_splitting) = SCTPCTL_BUFFER_SPLITTING_DEFAULT; #if defined(SCTP_LOCAL_TRACE_BUF) memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log)); #endif @@ -620,7 +621,7 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS) RANGECHK(SCTP_BASE_SYSCTL(sctp_default_cc_module), SCTPCTL_DEFAULT_CC_MODULE_MIN, SCTPCTL_DEFAULT_CC_MODULE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_default_frag_interleave), SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MIN, SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_vtag_time_wait), SCTPCTL_TIME_WAIT_MIN, SCTPCTL_TIME_WAIT_MAX); - + RANGECHK(SCTP_BASE_SYSCTL(sctp_buffer_splitting), SCTPCTL_BUFFER_SPLITTING_MIN, SCTPCTL_BUFFER_SPLITTING_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_base), SCTPCTL_MOBILITY_BASE_MIN, SCTPCTL_MOBILITY_BASE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff), SCTPCTL_MOBILITY_FASTHANDOFF_MIN, SCTPCTL_MOBILITY_FASTHANDOFF_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_udp_tunneling_for_client_enable), SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MIN, SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MAX); @@ -1067,6 +1068,10 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, vt &SCTP_BASE_SYSCTL(sctp_vtag_time_wait), 0, sysctl_sctp_check, "IU", SCTPCTL_TIME_WAIT_DESC); +SYSCTL_PROC(_net_inet_sctp, OID_AUTO, buffer_splitting, CTLTYPE_INT | CTLFLAG_RW, + &SCTP_BASE_SYSCTL(sctp_buffer_splitting), 0, sysctl_sctp_check, "IU", + SCTPCTL_BUFFER_SPLITTING_DESC); + #ifdef SCTP_DEBUG SYSCTL_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_INT | CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_debug_on), 0, sysctl_sctp_check, "IU", Modified: stable/8/sys/netinet/sctp_sysctl.h ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.h Thu Oct 28 19:10:15 2010 (r214482) +++ stable/8/sys/netinet/sctp_sysctl.h Thu Oct 28 19:10:31 2010 (r214483) @@ -107,6 +107,7 @@ struct sctp_sysctl { uint32_t sctp_udp_tunneling_port; uint32_t sctp_enable_sack_immediately; uint32_t sctp_vtag_time_wait; + uint32_t sctp_buffer_splitting; #if defined(SCTP_DEBUG) uint32_t sctp_debug_on; #endif @@ -478,19 +479,23 @@ struct sctp_sysctl { #define SCTPCTL_SACK_IMMEDIATELY_ENABLE_MAX 1 #define SCTPCTL_SACK_IMMEDIATELY_ENABLE_DEFAULT SCTPCTL_SACK_IMMEDIATELY_ENABLE_MIN -/* Enable sending of the SACK-IMMEDIATELY bit */ +/* Enable sending of the NAT-FRIENDLY message */ #define SCTPCTL_NAT_FRIENDLY_INITS_DESC "Enable sending of the nat-friendly SCTP option on INITs." #define SCTPCTL_NAT_FRIENDLY_INITS_MIN 0 #define SCTPCTL_NAT_FRIENDLY_INITS_MAX 1 #define SCTPCTL_NAT_FRIENDLY_INITS_DEFAULT SCTPCTL_NAT_FRIENDLY_INITS_MIN - -/* Vtag tiem wait bits */ -#define SCTPCTL_TIME_WAIT_DESC "Vtag time wait time 0 disables." +/* Vtag time wait in seconds */ +#define SCTPCTL_TIME_WAIT_DESC "Vtag time wait time in seconds, 0 disables it." #define SCTPCTL_TIME_WAIT_MIN 0 #define SCTPCTL_TIME_WAIT_MAX 0xffffffff #define SCTPCTL_TIME_WAIT_DEFAULT SCTP_TIME_WAIT +/* Enable Send/Receive buffer splitting */ +#define SCTPCTL_BUFFER_SPLITTING_DESC "Enable send/receive buffer splitting." +#define SCTPCTL_BUFFER_SPLITTING_MIN 0 +#define SCTPCTL_BUFFER_SPLITTING_MAX 0x3 +#define SCTPCTL_BUFFER_SPLITTING_DEFAULT SCTPCTL_BUFFER_SPLITTING_MIN #if defined(SCTP_DEBUG) /* debug: Configure debug output */ From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 19:12:05 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3B411065674; Thu, 28 Oct 2010 19:12:05 +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 A06498FC15; Thu, 28 Oct 2010 19:12: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 o9SJC5Id026129; Thu, 28 Oct 2010 19:12:05 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SJC5LF026125; Thu, 28 Oct 2010 19:12:05 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281912.o9SJC5LF026125@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 19:12:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214484 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 19:12:05 -0000 Author: tuexen Date: Thu Oct 28 19:12:05 2010 New Revision: 214484 URL: http://svn.freebsd.org/changeset/base/214484 Log: MFC r212800: Make the initial congestion window configurable via sysctl. Modified: stable/8/sys/netinet/sctp_cc_functions.c stable/8/sys/netinet/sctp_sysctl.c stable/8/sys/netinet/sctp_sysctl.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_cc_functions.c ============================================================================== --- stable/8/sys/netinet/sctp_cc_functions.c Thu Oct 28 19:10:31 2010 (r214483) +++ stable/8/sys/netinet/sctp_cc_functions.c Thu Oct 28 19:12:05 2010 (r214484) @@ -44,18 +44,27 @@ #include #include __FBSDID("$FreeBSD$"); + void sctp_set_initial_cc_param(struct sctp_tcb *stcb, struct sctp_nets *net) { + struct sctp_association *assoc; + uint32_t cwnd_in_mtu; + + assoc = &stcb->asoc; /* - * We take the max of the burst limit times a MTU or the - * INITIAL_CWND. We then limit this to 4 MTU's of sending. cwnd must - * be at least 2 MTU. + * We take the minimum of the burst limit and the initial congestion + * window. The initial congestion window is at least two times the + * MTU. */ - net->cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); - net->ssthresh = stcb->asoc.peers_rwnd; + cwnd_in_mtu = SCTP_BASE_SYSCTL(sctp_initial_cwnd); + if ((assoc->max_burst > 0) && (cwnd_in_mtu > assoc->max_burst)) + cwnd_in_mtu = assoc->max_burst; + net->cwnd = (net->mtu - sizeof(struct sctphdr)) * cwnd_in_mtu; + net->ssthresh = assoc->peers_rwnd; - if (SCTP_BASE_SYSCTL(sctp_logging_level) & (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & + (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) { sctp_log_cwnd(stcb, net, 0, SCTP_CWND_INITIALIZATION); } } Modified: stable/8/sys/netinet/sctp_sysctl.c ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.c Thu Oct 28 19:10:31 2010 (r214483) +++ stable/8/sys/netinet/sctp_sysctl.c Thu Oct 28 19:12:05 2010 (r214484) @@ -110,6 +110,7 @@ sctp_init_sysctls() SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff) = SCTPCTL_MOBILITY_FASTHANDOFF_DEFAULT; SCTP_BASE_SYSCTL(sctp_vtag_time_wait) = SCTPCTL_TIME_WAIT_DEFAULT; SCTP_BASE_SYSCTL(sctp_buffer_splitting) = SCTPCTL_BUFFER_SPLITTING_DEFAULT; + SCTP_BASE_SYSCTL(sctp_initial_cwnd) = SCTPCTL_INITIAL_CWND_DEFAULT; #if defined(SCTP_LOCAL_TRACE_BUF) memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log)); #endif @@ -622,6 +623,7 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS) RANGECHK(SCTP_BASE_SYSCTL(sctp_default_frag_interleave), SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MIN, SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_vtag_time_wait), SCTPCTL_TIME_WAIT_MIN, SCTPCTL_TIME_WAIT_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_buffer_splitting), SCTPCTL_BUFFER_SPLITTING_MIN, SCTPCTL_BUFFER_SPLITTING_MAX); + RANGECHK(SCTP_BASE_SYSCTL(sctp_initial_cwnd), SCTPCTL_INITIAL_CWND_MIN, SCTPCTL_INITIAL_CWND_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_base), SCTPCTL_MOBILITY_BASE_MIN, SCTPCTL_MOBILITY_BASE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff), SCTPCTL_MOBILITY_FASTHANDOFF_MIN, SCTPCTL_MOBILITY_FASTHANDOFF_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_udp_tunneling_for_client_enable), SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MIN, SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MAX); @@ -1072,6 +1074,10 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, bu &SCTP_BASE_SYSCTL(sctp_buffer_splitting), 0, sysctl_sctp_check, "IU", SCTPCTL_BUFFER_SPLITTING_DESC); +SYSCTL_PROC(_net_inet_sctp, OID_AUTO, initial_cwnd, CTLTYPE_INT | CTLFLAG_RW, + &SCTP_BASE_SYSCTL(sctp_initial_cwnd), 0, sysctl_sctp_check, "IU", + SCTPCTL_INITIAL_CWND_DESC); + #ifdef SCTP_DEBUG SYSCTL_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_INT | CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_debug_on), 0, sysctl_sctp_check, "IU", Modified: stable/8/sys/netinet/sctp_sysctl.h ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.h Thu Oct 28 19:10:31 2010 (r214483) +++ stable/8/sys/netinet/sctp_sysctl.h Thu Oct 28 19:12:05 2010 (r214484) @@ -108,6 +108,7 @@ struct sctp_sysctl { uint32_t sctp_enable_sack_immediately; uint32_t sctp_vtag_time_wait; uint32_t sctp_buffer_splitting; + uint32_t sctp_initial_cwnd; #if defined(SCTP_DEBUG) uint32_t sctp_debug_on; #endif @@ -497,6 +498,12 @@ struct sctp_sysctl { #define SCTPCTL_BUFFER_SPLITTING_MAX 0x3 #define SCTPCTL_BUFFER_SPLITTING_DEFAULT SCTPCTL_BUFFER_SPLITTING_MIN +/* Initial congestion window in MTU */ +#define SCTPCTL_INITIAL_CWND_DESC "Initial congestion window in MTU" +#define SCTPCTL_INITIAL_CWND_MIN 2 +#define SCTPCTL_INITIAL_CWND_MAX 0xffffffff +#define SCTPCTL_INITIAL_CWND_DEFAULT 3 + #if defined(SCTP_DEBUG) /* debug: Configure debug output */ #define SCTPCTL_DEBUG_DESC "Configure debug output" From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 19:13:47 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35DF51065670; Thu, 28 Oct 2010 19:13:47 +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 08C258FC12; Thu, 28 Oct 2010 19:13: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 o9SJDk9A026255; Thu, 28 Oct 2010 19:13:46 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SJDkHc026251; Thu, 28 Oct 2010 19:13:46 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281913.o9SJDkHc026251@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 19:13:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214485 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 19:13:47 -0000 Author: tuexen Date: Thu Oct 28 19:13:46 2010 New Revision: 214485 URL: http://svn.freebsd.org/changeset/base/214485 Log: MFC r212801: Fix a bug where the wrong PR-SCTP policy was considered. While there, use always the same code for the check of TTL expiration. Modified: stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_timer.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Thu Oct 28 19:12:05 2010 (r214484) +++ stable/8/sys/netinet/sctp_indata.c Thu Oct 28 19:13:46 2010 (r214485) @@ -3300,13 +3300,7 @@ sctp_strike_gap_ack_chunks(struct sctp_t if (stcb->asoc.peer_supports_prsctp) { if ((PR_SCTP_TTL_ENABLED(tp1->flags)) && tp1->sent < SCTP_DATAGRAM_ACKED) { /* Is it expired? */ - if ( - /* - * TODO sctp_constants.h needs alternative - * time macros when _KERNEL is undefined. - */ - (timevalcmp(&now, &tp1->rec.data.timetodrop, >)) - ) { + if (timevalcmp(&now, &tp1->rec.data.timetodrop, >)) { /* Yes so drop it */ if (tp1->data != NULL) { (void)sctp_release_pr_sctp_chunk(stcb, tp1, Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Oct 28 19:12:05 2010 (r214484) +++ stable/8/sys/netinet/sctp_output.c Thu Oct 28 19:13:46 2010 (r214485) @@ -5728,7 +5728,7 @@ sctp_prune_prsctp(struct sctp_tcb *stcb, while (chk) { nchk = TAILQ_NEXT(chk, sctp_next); /* Here we must move to the sent queue and mark */ - if (PR_SCTP_TTL_ENABLED(chk->flags)) { + if (PR_SCTP_BUF_ENABLED(chk->flags)) { if (chk->rec.data.timetodrop.tv_sec >= (long)srcv->sinfo_timetolive) { if (chk->data) { /* Modified: stable/8/sys/netinet/sctp_timer.c ============================================================================== --- stable/8/sys/netinet/sctp_timer.c Thu Oct 28 19:12:05 2010 (r214484) +++ stable/8/sys/netinet/sctp_timer.c Thu Oct 28 19:13:46 2010 (r214485) @@ -772,9 +772,7 @@ start_again: } if (stcb->asoc.peer_supports_prsctp && PR_SCTP_TTL_ENABLED(chk->flags)) { /* Is it expired? */ - if ((now.tv_sec > chk->rec.data.timetodrop.tv_sec) || - ((chk->rec.data.timetodrop.tv_sec == now.tv_sec) && - (now.tv_usec > chk->rec.data.timetodrop.tv_usec))) { + if (timevalcmp(&now, &chk->rec.data.timetodrop, >)) { /* Yes so drop it */ if (chk->data) { (void)sctp_release_pr_sctp_chunk(stcb, From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 19:15:30 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFB4F1065673; Thu, 28 Oct 2010 19:15:30 +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 8257D8FC0C; Thu, 28 Oct 2010 19:15: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 o9SJFU7B026395; Thu, 28 Oct 2010 19:15:30 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SJFUV2026392; Thu, 28 Oct 2010 19:15:30 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281915.o9SJFUV2026392@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 19:15:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214486 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 19:15:30 -0000 Author: tuexen Date: Thu Oct 28 19:15:30 2010 New Revision: 214486 URL: http://svn.freebsd.org/changeset/base/214486 Log: MFC r212850: Fix a locking issue which shows up when the code is used on Mac OS X. Modified: stable/8/sys/netinet/sctp_auth.c stable/8/sys/netinet/sctp_pcb.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_auth.c ============================================================================== --- stable/8/sys/netinet/sctp_auth.c Thu Oct 28 19:13:46 2010 (r214485) +++ stable/8/sys/netinet/sctp_auth.c Thu Oct 28 19:15:30 2010 (r214486) @@ -614,7 +614,7 @@ sctp_auth_key_release(struct sctp_tcb *s if ((skey->refcount <= 1) && (skey->deactivated)) { /* notify ULP that key is no longer used */ sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb, - key_id, 0, SCTP_SO_NOT_LOCKED); + key_id, 0, SCTP_SO_LOCKED); SCTPDBG(SCTP_DEBUG_AUTH2, "%s: stcb %p key %u no longer used, %d\n", __FUNCTION__, stcb, key_id, skey->refcount); Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Thu Oct 28 19:13:46 2010 (r214485) +++ stable/8/sys/netinet/sctp_pcb.c Thu Oct 28 19:15:30 2010 (r214486) @@ -4822,7 +4822,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, /* Still an open socket - report */ sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb, SCTP_NOTIFY_DATAGRAM_UNSENT, - (void *)sp, 0); + (void *)sp, SCTP_SO_LOCKED); } if (sp->data) { sctp_m_freem(sp->data); @@ -4894,7 +4894,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, if (so) { /* Still a socket? */ sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, - SCTP_NOTIFY_DATAGRAM_UNSENT, chk, 0); + SCTP_NOTIFY_DATAGRAM_UNSENT, chk, SCTP_SO_LOCKED); } if (chk->data) { sctp_m_freem(chk->data); @@ -4929,7 +4929,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, if (so) { /* Still a socket? */ sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, - SCTP_NOTIFY_DATAGRAM_SENT, chk, 0); + SCTP_NOTIFY_DATAGRAM_SENT, chk, SCTP_SO_LOCKED); } if (chk->data) { sctp_m_freem(chk->data); From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 19:17:18 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A260D106566B; Thu, 28 Oct 2010 19:17:18 +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 8FAB18FC22; Thu, 28 Oct 2010 19:17: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 o9SJHILQ026525; Thu, 28 Oct 2010 19:17:18 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SJHIGg026523; Thu, 28 Oct 2010 19:17:18 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281917.o9SJHIGg026523@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 19:17:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214487 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 19:17:18 -0000 Author: tuexen Date: Thu Oct 28 19:17:18 2010 New Revision: 214487 URL: http://svn.freebsd.org/changeset/base/214487 Log: MFC r212851: Allow the initial congestion window to be configure to one MTU. Improve the description. Modified: stable/8/sys/netinet/sctp_sysctl.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_sysctl.h ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.h Thu Oct 28 19:15:30 2010 (r214486) +++ stable/8/sys/netinet/sctp_sysctl.h Thu Oct 28 19:17:18 2010 (r214487) @@ -499,8 +499,8 @@ struct sctp_sysctl { #define SCTPCTL_BUFFER_SPLITTING_DEFAULT SCTPCTL_BUFFER_SPLITTING_MIN /* Initial congestion window in MTU */ -#define SCTPCTL_INITIAL_CWND_DESC "Initial congestion window in MTU" -#define SCTPCTL_INITIAL_CWND_MIN 2 +#define SCTPCTL_INITIAL_CWND_DESC "Initial congestion window in MTUs" +#define SCTPCTL_INITIAL_CWND_MIN 1 #define SCTPCTL_INITIAL_CWND_MAX 0xffffffff #define SCTPCTL_INITIAL_CWND_DEFAULT 3 From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 28 19:18:55 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28C2C106564A; Thu, 28 Oct 2010 19:18:55 +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 15EE28FC15; Thu, 28 Oct 2010 19:18: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 o9SJIsfc026651; Thu, 28 Oct 2010 19:18:54 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SJIs5D026649; Thu, 28 Oct 2010 19:18:54 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201010281918.o9SJIs5D026649@svn.freebsd.org> From: Michael Tuexen Date: Thu, 28 Oct 2010 19:18:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214488 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 19:18:55 -0000 Author: tuexen Date: Thu Oct 28 19:18:54 2010 New Revision: 214488 URL: http://svn.freebsd.org/changeset/base/214488 Log: MFC r212897: Fix a locking issue which resulted in aborted associations due to a corrupted nr-mapping array. Modified: stable/8/sys/netinet/sctp_indata.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Thu Oct 28 19:17:18 2010 (r214487) +++ stable/8/sys/netinet/sctp_indata.c Thu Oct 28 19:18:54 2010 (r214488) @@ -1776,6 +1776,10 @@ sctp_process_a_data_chunk(struct sctp_tc if (control == NULL) { goto failed_express_del; } + SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap); + if (compare_with_wrap(tsn, asoc->highest_tsn_inside_nr_map, MAX_TSN)) { + asoc->highest_tsn_inside_nr_map = tsn; + } sctp_add_to_readq(stcb->sctp_ep, stcb, control, &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); @@ -1791,10 +1795,6 @@ sctp_process_a_data_chunk(struct sctp_tc } control = NULL; - SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap); - if (compare_with_wrap(tsn, asoc->highest_tsn_inside_nr_map, MAX_TSN)) { - asoc->highest_tsn_inside_nr_map = tsn; - } goto finish_express_del; } failed_express_del: From owner-svn-src-stable-8@FreeBSD.ORG Sat Oct 30 01:19:15 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 768BD1065672; Sat, 30 Oct 2010 01:19:15 +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 649F48FC13; Sat, 30 Oct 2010 01:19: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 o9U1JF1K073019; Sat, 30 Oct 2010 01:19:15 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9U1JFZv073017; Sat, 30 Oct 2010 01:19:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010300119.o9U1JFZv073017@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 30 Oct 2010 01:19:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214543 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 01:19:15 -0000 Author: kib Date: Sat Oct 30 01:19:15 2010 New Revision: 214543 URL: http://svn.freebsd.org/changeset/base/214543 Log: MFC r213916: Provide vfs.ncsizefactor instead of hard-coding namecache ratio. Move debug.ncnegfactor to vfs.ncnegfactor. Provide some descriptions for the namecache related sysctls. Modified: stable/8/sys/kern/vfs_cache.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/vfs_cache.c ============================================================================== --- stable/8/sys/kern/vfs_cache.c Sat Oct 30 01:12:54 2010 (r214542) +++ stable/8/sys/kern/vfs_cache.c Sat Oct 30 01:19:15 2010 (r214543) @@ -126,20 +126,27 @@ struct namecache { static LIST_HEAD(nchashhead, namecache) *nchashtbl; /* Hash Table */ static TAILQ_HEAD(, namecache) ncneg; /* Hash Table */ static u_long nchash; /* size of hash table */ -SYSCTL_ULONG(_debug, OID_AUTO, nchash, CTLFLAG_RD, &nchash, 0, ""); +SYSCTL_ULONG(_debug, OID_AUTO, nchash, CTLFLAG_RD, &nchash, 0, + "Size of namecache hash table"); static u_long ncnegfactor = 16; /* ratio of negative entries */ +/* _debug sysctl left for backward compatibility */ SYSCTL_ULONG(_debug, OID_AUTO, ncnegfactor, CTLFLAG_RW, &ncnegfactor, 0, ""); -static u_long numneg; /* number of cache entries allocated */ -SYSCTL_ULONG(_debug, OID_AUTO, numneg, CTLFLAG_RD, &numneg, 0, ""); +SYSCTL_ULONG(_vfs, OID_AUTO, ncnegfactor, CTLFLAG_RW, &ncnegfactor, 0, + "Ratio of negative namecache entries"); +static u_long numneg; /* number of negative entries allocated */ +SYSCTL_ULONG(_debug, OID_AUTO, numneg, CTLFLAG_RD, &numneg, 0, + "Number of negative entries in namecache"); static u_long numcache; /* number of cache entries allocated */ -SYSCTL_ULONG(_debug, OID_AUTO, numcache, CTLFLAG_RD, &numcache, 0, ""); +SYSCTL_ULONG(_debug, OID_AUTO, numcache, CTLFLAG_RD, &numcache, 0, + "Number of namecache entries"); static u_long numcachehv; /* number of cache entries with vnodes held */ -SYSCTL_ULONG(_debug, OID_AUTO, numcachehv, CTLFLAG_RD, &numcachehv, 0, ""); -#if 0 -static u_long numcachepl; /* number of cache purge for leaf entries */ -SYSCTL_ULONG(_debug, OID_AUTO, numcachepl, CTLFLAG_RD, &numcachepl, 0, ""); -#endif -struct nchstats nchstats; /* cache effectiveness statistics */ +SYSCTL_ULONG(_debug, OID_AUTO, numcachehv, CTLFLAG_RD, &numcachehv, 0, + "Number of namecache entries with vnodes held"); +static u_int ncsizefactor = 2; +SYSCTL_UINT(_vfs, OID_AUTO, ncsizefactor, CTLFLAG_RW, &ncsizefactor, 0, + "Size factor for namecache"); + +struct nchstats nchstats; /* cache effectiveness statistics */ static struct rwlock cache_lock; RW_SYSINIT(vfscache, &cache_lock, "Name Cache"); @@ -174,7 +181,8 @@ static uma_zone_t cache_zone_large; } while (0) static int doingcache = 1; /* 1 => enable the cache */ -SYSCTL_INT(_debug, OID_AUTO, vfscache, CTLFLAG_RW, &doingcache, 0, ""); +SYSCTL_INT(_debug, OID_AUTO, vfscache, CTLFLAG_RW, &doingcache, 0, + "VFS namecache enabled"); /* Export size information to userland */ SYSCTL_INT(_debug_sizeof, OID_AUTO, namecache, CTLFLAG_RD, 0, @@ -620,7 +628,7 @@ cache_enter(dvp, vp, cnp) /* * Avoid blowout in namecache entries. */ - if (numcache >= desiredvnodes * 2) + if (numcache >= desiredvnodes * ncsizefactor) return; flag = 0; From owner-svn-src-stable-8@FreeBSD.ORG Sat Oct 30 01:24:26 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1175106564A; Sat, 30 Oct 2010 01:24: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 AF4E98FC12; Sat, 30 Oct 2010 01: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 o9U1OQCE073222; Sat, 30 Oct 2010 01:24:26 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9U1OQ87073220; Sat, 30 Oct 2010 01:24:26 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010300124.o9U1OQ87073220@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 30 Oct 2010 01:24:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214544 - stable/8/share/man/man7 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 01:24:26 -0000 Author: kib Date: Sat Oct 30 01:24:26 2010 New Revision: 214544 URL: http://svn.freebsd.org/changeset/base/214544 Log: MFC r213917: Document vfs.ncsizefactor and vfs.ncnegfactor. Modified: stable/8/share/man/man7/tuning.7 Directory Properties: stable/8/share/man/man7/ (props changed) Modified: stable/8/share/man/man7/tuning.7 ============================================================================== --- stable/8/share/man/man7/tuning.7 Sat Oct 30 01:19:15 2010 (r214543) +++ stable/8/share/man/man7/tuning.7 Sat Oct 30 01:24:26 2010 (r214544) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 23, 2009 +.Dd October 16, 2010 .Dt TUNING 7 .Os .Sh NAME @@ -511,6 +511,24 @@ Also, higher write queueing values may add latency to reads occurring at the same time. .Pp +The +.Va vfs.ncsizefactor +sysctl defines how large VFS namecache may grow. +The number of currently allocated entries in namecache is provided by +.Va debug.numcache +sysctl and the condition +debug.numcache < kern.maxvnodes * vfs.ncsizefactor +is adhered to. +.Pp +The +.Va vfs.ncnegfactor +sysctl defines how many negative entries VFS namecache is allowed to create. +The number of currently allocated negative entries is provided by +.Va debug.numneg +sysctl and the condition +vfs.ncnegfactor * debug.numneg < debug.numcache +is adhered to. +.Pp There are various other buffer-cache and VM page cache related sysctls. We do not recommend modifying these values. As of From owner-svn-src-stable-8@FreeBSD.ORG Sat Oct 30 04:53:50 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB3571065673; Sat, 30 Oct 2010 04:53:50 +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 AED508FC08; Sat, 30 Oct 2010 04:53: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 o9U4roJO080189; Sat, 30 Oct 2010 04:53:50 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9U4roZo080187; Sat, 30 Oct 2010 04:53:50 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201010300453.o9U4roZo080187@svn.freebsd.org> From: Alan Cox Date: Sat, 30 Oct 2010 04:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214546 - stable/8/sys/vm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 04:53:51 -0000 Author: alc Date: Sat Oct 30 04:53:50 2010 New Revision: 214546 URL: http://svn.freebsd.org/changeset/base/214546 Log: MFC r213408 If vm_map_find() is asked to allocate a superpage-aligned region of virtual addresses that is greater than a superpage in size but not a multiple of the superpage size, then vm_map_find() is not always expanding the kernel pmap to support the last few small pages being allocated. Previously, we grew the kernel page table in vm_map_findspace() when we found the first available virtual address. Now, instead, we defer the call to pmap_growkernel() until we are committed to a range of virtual addresses in vm_map_insert(). Modified: stable/8/sys/vm/vm_map.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/vm/vm_map.c ============================================================================== --- stable/8/sys/vm/vm_map.c Sat Oct 30 02:51:04 2010 (r214545) +++ stable/8/sys/vm/vm_map.c Sat Oct 30 04:53:50 2010 (r214546) @@ -1166,6 +1166,9 @@ vm_map_insert(vm_map_t map, vm_object_t } charged: + /* Expand the kernel pmap, if necessary. */ + if (map == kernel_map && end > kernel_vm_end) + pmap_growkernel(end); if (object != NULL) { /* * OBJ_ONEMAPPING must be cleared unless this mapping @@ -1302,7 +1305,7 @@ vm_map_findspace(vm_map_t map, vm_offset vm_offset_t *addr) /* OUT */ { vm_map_entry_t entry; - vm_offset_t end, st; + vm_offset_t st; /* * Request must fit within min/max VM address and must avoid @@ -1316,7 +1319,7 @@ vm_map_findspace(vm_map_t map, vm_offset /* Empty tree means wide open address space. */ if (map->root == NULL) { *addr = start; - goto found; + return (0); } /* @@ -1326,7 +1329,7 @@ vm_map_findspace(vm_map_t map, vm_offset map->root = vm_map_entry_splay(start, map->root); if (start + length <= map->root->start) { *addr = start; - goto found; + return (0); } /* @@ -1337,7 +1340,7 @@ vm_map_findspace(vm_map_t map, vm_offset st = (start > map->root->end) ? start : map->root->end; if (length <= map->root->end + map->root->adj_free - st) { *addr = st; - goto found; + return (0); } /* With max_free, can immediately tell if no solution. */ @@ -1355,22 +1358,13 @@ vm_map_findspace(vm_map_t map, vm_offset entry = entry->left; else if (entry->adj_free >= length) { *addr = entry->end; - goto found; + return (0); } else entry = entry->right; } /* Can't get here, so panic if we do. */ panic("vm_map_findspace: max_free corrupt"); - -found: - /* Expand the kernel pmap, if necessary. */ - if (map == kernel_map) { - end = round_page(*addr + length); - if (end > kernel_vm_end) - pmap_growkernel(end); - } - return (0); } int From owner-svn-src-stable-8@FreeBSD.ORG Sat Oct 30 10:28:33 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6AE36106566B; Sat, 30 Oct 2010 10:28:33 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 58C3E8FC1B; Sat, 30 Oct 2010 10:28:33 +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 o9UASXcA091328; Sat, 30 Oct 2010 10:28:33 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9UASXA2091326; Sat, 30 Oct 2010 10:28:33 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201010301028.o9UASXA2091326@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sat, 30 Oct 2010 10:28:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214547 - stable/8/lib/libc/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 10:28:33 -0000 Author: ume Date: Sat Oct 30 10:28:33 2010 New Revision: 214547 URL: http://svn.freebsd.org/changeset/base/214547 Log: MFC r213403: Clear errno for each method dispatch. Modified: stable/8/lib/libc/net/nsdispatch.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/locale/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/sys/ (props changed) Modified: stable/8/lib/libc/net/nsdispatch.c ============================================================================== --- stable/8/lib/libc/net/nsdispatch.c Sat Oct 30 04:53:50 2010 (r214546) +++ stable/8/lib/libc/net/nsdispatch.c Sat Oct 30 10:28:33 2010 (r214547) @@ -707,11 +707,13 @@ _nsdispatch(void *retval, const ns_dtab va_end(ap); } else { cache_flag = 0; + errno = 0; va_start(ap, defaults); result = method(retval, mdata, ap); va_end(ap); } #else /* NS_CACHING */ + errno = 0; va_start(ap, defaults); result = method(retval, mdata, ap); va_end(ap); From owner-svn-src-stable-8@FreeBSD.ORG Sat Oct 30 10:30:50 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 844FA106564A; Sat, 30 Oct 2010 10:30:50 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0595F8FC1A; Sat, 30 Oct 2010 10:30: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 o9UAUnMc091570; Sat, 30 Oct 2010 10:30:49 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9UAUnQO091566; Sat, 30 Oct 2010 10:30:49 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201010301030.o9UAUnQO091566@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sat, 30 Oct 2010 10:30:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214548 - stable/8/lib/libc/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 10:30:50 -0000 Author: ume Date: Sat Oct 30 10:30:49 2010 New Revision: 214548 URL: http://svn.freebsd.org/changeset/base/214548 Log: MFC r213453: When no protocol entry is found, getproto*_r(3) should return zero. Modified: stable/8/lib/libc/net/getproto.c stable/8/lib/libc/net/getprotoent.c stable/8/lib/libc/net/getprotoname.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/locale/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/sys/ (props changed) Modified: stable/8/lib/libc/net/getproto.c ============================================================================== --- stable/8/lib/libc/net/getproto.c Sat Oct 30 10:28:33 2010 (r214547) +++ stable/8/lib/libc/net/getproto.c Sat Oct 30 10:30:49 2010 (r214548) @@ -123,7 +123,7 @@ getprotobynumber_r(int proto, struct pro if (rv != NS_SUCCESS) { errno = ret_errno; - return ((ret_errno != 0) ? ret_errno : -1); + return (ret_errno); } return (0); } Modified: stable/8/lib/libc/net/getprotoent.c ============================================================================== --- stable/8/lib/libc/net/getprotoent.c Sat Oct 30 10:28:33 2010 (r214547) +++ stable/8/lib/libc/net/getprotoent.c Sat Oct 30 10:30:49 2010 (r214548) @@ -494,7 +494,7 @@ getprotoent_r(struct protoent *pptr, cha if (rv != NS_SUCCESS) { errno = ret_errno; - return ((ret_errno != 0) ? ret_errno : -1); + return (ret_errno); } return (0); } Modified: stable/8/lib/libc/net/getprotoname.c ============================================================================== --- stable/8/lib/libc/net/getprotoname.c Sat Oct 30 10:28:33 2010 (r214547) +++ stable/8/lib/libc/net/getprotoname.c Sat Oct 30 10:30:49 2010 (r214548) @@ -131,7 +131,7 @@ getprotobyname_r(const char *name, struc if (rv != NS_SUCCESS) { errno = ret_errno; - return ((ret_errno != 0) ? ret_errno : -1); + return (ret_errno); } return (0); } From owner-svn-src-stable-8@FreeBSD.ORG Sat Oct 30 11:54:55 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AE171065675; Sat, 30 Oct 2010 11:54:55 +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 690F78FC12; Sat, 30 Oct 2010 11:54: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 o9UBstps096076; Sat, 30 Oct 2010 11:54:55 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9UBstRo096074; Sat, 30 Oct 2010 11:54:55 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201010301154.o9UBstRo096074@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 30 Oct 2010 11:54:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214552 - stable/8/sys/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 11:54:55 -0000 Author: bz Date: Sat Oct 30 11:54:55 2010 New Revision: 214552 URL: http://svn.freebsd.org/changeset/base/214552 Log: MFC r213930: Close a race acquiring the IF_ADDR_LOCK() for each entry while iterating over all interfaces to make sure the address will neither change nor be freed while we are working on it. PR: kern/146250 Submitted by: Mikolaj Golub (to.my.trociny gmail.com) Modified: stable/8/sys/net/rtsock.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/net/rtsock.c ============================================================================== --- stable/8/sys/net/rtsock.c Sat Oct 30 11:30:49 2010 (r214551) +++ stable/8/sys/net/rtsock.c Sat Oct 30 11:54:55 2010 (r214552) @@ -1473,6 +1473,7 @@ sysctl_iflist(int af, struct walkarg *w) TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (w->w_arg && w->w_arg != ifp->if_index) continue; + IF_ADDR_LOCK(ifp); ifa = ifp->if_addr; info.rti_info[RTAX_IFP] = ifa->ifa_addr; len = rt_msg2(RTM_IFINFO, &info, NULL, w); @@ -1530,10 +1531,13 @@ sysctl_iflist(int af, struct walkarg *w) goto done; } } + IF_ADDR_UNLOCK(ifp); info.rti_info[RTAX_IFA] = info.rti_info[RTAX_NETMASK] = info.rti_info[RTAX_BRD] = NULL; } done: + if (ifp != NULL) + IF_ADDR_UNLOCK(ifp); IFNET_RUNLOCK(); return (error); } From owner-svn-src-stable-8@FreeBSD.ORG Sat Oct 30 12:05:20 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 639BD106566B; Sat, 30 Oct 2010 12:05:20 +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 51D918FC1A; Sat, 30 Oct 2010 12:05:20 +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 o9UC5Kcn096534; Sat, 30 Oct 2010 12:05:20 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9UC5KDV096532; Sat, 30 Oct 2010 12:05:20 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201010301205.o9UC5KDV096532@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 30 Oct 2010 12:05:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214553 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 12:05:20 -0000 Author: bz Date: Sat Oct 30 12:05:20 2010 New Revision: 214553 URL: http://svn.freebsd.org/changeset/base/214553 Log: MFC r213932: MfP4 CH182763 (original version): Make it harder to exploit certain in_control() related races between the intiial lookup at the beginning and the time we will remove the entry from the lists by re-checking that entry is still in the list before trying to remove it. Reported by: Nima Misaghian (nima_misa hotmail.com) on net@ 20100817 Tested by: Nima Misaghian (nima_misa hotmail.com) (original version) PR: kern/146250 Submitted by: Mikolaj Golub (to.my.trociny gmail.com) (different version) Modified: stable/8/sys/netinet/in.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/in.c ============================================================================== --- stable/8/sys/netinet/in.c Sat Oct 30 11:54:55 2010 (r214552) +++ stable/8/sys/netinet/in.c Sat Oct 30 12:05:20 2010 (r214553) @@ -599,6 +599,21 @@ in_control(struct socket *so, u_long cmd } IF_ADDR_LOCK(ifp); + /* Re-check that ia is still part of the list. */ + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + if (ifa == &ia->ia_ifa) + break; + } + if (ifa == NULL) { + /* + * If we lost the race with another thread, there is no need to + * try it again for the next loop as there is no other exit + * path between here and out. + */ + IF_ADDR_UNLOCK(ifp); + error = EADDRNOTAVAIL; + goto out; + } TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_UNLOCK(ifp); ifa_free(&ia->ia_ifa); /* if_addrhead */ From owner-svn-src-stable-8@FreeBSD.ORG Sat Oct 30 12:39:51 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFECB1065679; Sat, 30 Oct 2010 12:39:51 +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 B3B7B8FC13; Sat, 30 Oct 2010 12:39: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 o9UCdpAK097476; Sat, 30 Oct 2010 12:39:51 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9UCdpTw097473; Sat, 30 Oct 2010 12:39:51 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201010301239.o9UCdpTw097473@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 30 Oct 2010 12:39:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214554 - in stable/8/sys: conf netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 12:39:51 -0000 Author: bz Date: Sat Oct 30 12:39:51 2010 New Revision: 214554 URL: http://svn.freebsd.org/changeset/base/214554 Log: MFC r214303: Add initial inet DDB support for show in_ifaddr and show sin commands which proved to be useful while debugging address list problems. Added: stable/8/sys/netinet/in_debug.c - copied unchanged from r214303, head/sys/netinet/in_debug.c Modified: stable/8/sys/conf/files Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Sat Oct 30 12:05:20 2010 (r214553) +++ stable/8/sys/conf/files Sat Oct 30 12:39:51 2010 (r214554) @@ -2500,6 +2500,7 @@ netinet/if_atm.c optional atm netinet/if_ether.c optional inet ether netinet/igmp.c optional inet netinet/in.c optional inet +netinet/in_debug.c optional inet ddb netinet/ip_carp.c optional inet carp | inet6 carp netinet/in_gif.c optional gif inet netinet/ip_gre.c optional gre inet Copied: stable/8/sys/netinet/in_debug.c (from r214303, head/sys/netinet/in_debug.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/netinet/in_debug.c Sat Oct 30 12:39:51 2010 (r214554, copy of r214303, head/sys/netinet/in_debug.c) @@ -0,0 +1,120 @@ +/*- + * Copyright (c) 2010 Bjoern A. Zeeb + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_ddb.h" + +#include +#include +#include + +#ifdef DDB +#include +#endif + +#include +#include + +#include +#include + +#ifdef DDB +static void +in_show_sockaddr_in(struct sockaddr_in *sin) +{ + +#define SIN_DB_RPINTF(f, e) db_printf("\t %s = " f "\n", #e, sin->e); + db_printf("\tsockaddr_in = %p\n", sin); + SIN_DB_RPINTF("%u", sin_len); + SIN_DB_RPINTF("%u", sin_family); + SIN_DB_RPINTF("%u", sin_port); + SIN_DB_RPINTF("0x%08x", sin_addr.s_addr); + db_printf("\t %s = %02x%02x%02x%02x%02x%02x%02x%02x\n", + "sin_zero[8]", + sin->sin_zero[0], sin->sin_zero[1], + sin->sin_zero[2], sin->sin_zero[3], + sin->sin_zero[4], sin->sin_zero[5], + sin->sin_zero[6], sin->sin_zero[7]); +#undef SIN_DB_RPINTF +} + +DB_SHOW_COMMAND(sin, db_show_sin) +{ + struct sockaddr_in *sin; + + sin = (struct sockaddr_in *)addr; + if (sin == NULL) { + /* usage: No need to confess if you didn't sin. */ + db_printf("usage: show sin \n"); + return; + } + + in_show_sockaddr_in(sin); +} + +static void +in_show_in_ifaddr(struct in_ifaddr *ia) +{ + +#define IA_DB_RPINTF(f, e) db_printf("\t %s = " f "\n", #e, ia->e); +#define IA_DB_RPINTF_PTR(f, e) db_printf("\t %s = " f "\n", #e, &ia->e); +#define IA_DB_RPINTF_DPTR(f, e) db_printf("\t *%s = " f "\n", #e, *ia->e); + db_printf("\tin_ifaddr = %p\n", ia); + IA_DB_RPINTF_PTR("%p", ia_ifa); + IA_DB_RPINTF("0x%08lx", ia_net); + IA_DB_RPINTF("0x%08lx", ia_netmask); + IA_DB_RPINTF("0x%08lx", ia_subnet); + IA_DB_RPINTF("0x%08lx", ia_subnetmask); + IA_DB_RPINTF("0x%08x", ia_netbroadcast.s_addr); + IA_DB_RPINTF("%p", ia_hash.le_next); + IA_DB_RPINTF("%p", ia_hash.le_prev); + IA_DB_RPINTF_DPTR("%p", ia_hash.le_prev); + IA_DB_RPINTF("%p", ia_link.tqe_next); + IA_DB_RPINTF("%p", ia_link.tqe_prev); + IA_DB_RPINTF_DPTR("%p", ia_link.tqe_prev); + IA_DB_RPINTF_PTR("%p", ia_addr); + IA_DB_RPINTF_PTR("%p", ia_dstaddr); + IA_DB_RPINTF_PTR("%p", ia_sockmask); +#undef IA_DB_RPINTF_DPTR +#undef IA_DB_RPINTF_PTR +#undef IA_DB_RPINTF +} + +DB_SHOW_COMMAND(in_ifaddr, db_show_in_ifaddr) +{ + struct in_ifaddr *ia; + + ia = (struct in_ifaddr *)addr; + if (ia == NULL) { + db_printf("usage: show in_ifaddr \n"); + return; + } + + in_show_in_ifaddr(ia); +} +#endif