From owner-svn-src-stable@FreeBSD.ORG Sun Sep 11 20:25:58 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB3EC1065674; Sun, 11 Sep 2011 20:25:58 +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 C6A868FC17; Sun, 11 Sep 2011 20:25:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8BKPwc2094556; Sun, 11 Sep 2011 20:25:58 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8BKPwNN094511; Sun, 11 Sep 2011 20:25:58 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201109112025.p8BKPwNN094511@svn.freebsd.org> From: Marius Strobl Date: Sun, 11 Sep 2011 20:25:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225490 - in stable/7/sys: dev/ae dev/age dev/alc dev/ale dev/bce dev/bfe dev/bge dev/dc dev/et dev/fxp dev/jme dev/lge dev/mii dev/nfe dev/nge dev/nve dev/sf dev/sge dev/sis dev/ste de... X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Sep 2011 20:25:59 -0000 Author: marius Date: Sun Sep 11 20:25:57 2011 New Revision: 225490 URL: http://svn.freebsd.org/changeset/base/225490 Log: MFC: r221407 (partial) - Let mii_phy_add_media() also announce the support of IFM_NONE. - Add a PHY-specific reset routine is for lxtphy(4) which disables MII interrupts. - Remove redundant checks in NIC drivers for mii->mii_instance not being zero before calling the reset routines because as soon as one PHY driver attaches mii->mii_instance is incremented and we hardly can end up in their media change callbacks etc if no PHY driver has attached as mii_attach() would have failed in that case and not attach a miibus(4) instance. - Convert the mebers of the MII data structure to unsigned where appropriate. This is partly inspired by NetBSD/OpenBSD. - Add MIIF_NOMANPAUSE and mii_phy_flowstatus() calls to drivers that weren't explicitly converted to support flow control before. It's unclear whether flow control actually works with these but typically it should and their net behavior should be more correct with these changes in place than without if the MAC driver sets MIIF_DOPAUSE. Obtained from: NetBSD (partially) Modified: stable/7/sys/dev/ae/if_ae.c stable/7/sys/dev/age/if_age.c stable/7/sys/dev/alc/if_alc.c stable/7/sys/dev/ale/if_ale.c stable/7/sys/dev/bce/if_bce.c stable/7/sys/dev/bfe/if_bfe.c stable/7/sys/dev/bge/if_bge.c stable/7/sys/dev/dc/dcphy.c stable/7/sys/dev/dc/pnphy.c stable/7/sys/dev/et/if_et.c stable/7/sys/dev/fxp/if_fxp.c stable/7/sys/dev/jme/if_jme.c stable/7/sys/dev/lge/if_lge.c stable/7/sys/dev/mii/acphy.c stable/7/sys/dev/mii/amphy.c stable/7/sys/dev/mii/atphy.c stable/7/sys/dev/mii/brgphy.c stable/7/sys/dev/mii/ciphy.c stable/7/sys/dev/mii/e1000phy.c stable/7/sys/dev/mii/exphy.c stable/7/sys/dev/mii/icsphy.c stable/7/sys/dev/mii/inphy.c stable/7/sys/dev/mii/jmphy.c stable/7/sys/dev/mii/lxtphy.c stable/7/sys/dev/mii/mii.c stable/7/sys/dev/mii/mii.h stable/7/sys/dev/mii/mii_physubr.c stable/7/sys/dev/mii/miivar.h stable/7/sys/dev/mii/mlphy.c stable/7/sys/dev/mii/nsphy.c stable/7/sys/dev/mii/nsphyter.c stable/7/sys/dev/mii/pnaphy.c stable/7/sys/dev/mii/qsphy.c stable/7/sys/dev/mii/rdcphy.c stable/7/sys/dev/mii/rlphy.c stable/7/sys/dev/mii/rlswitch.c stable/7/sys/dev/mii/ruephy.c stable/7/sys/dev/mii/tdkphy.c stable/7/sys/dev/mii/tlphy.c stable/7/sys/dev/mii/truephy.c stable/7/sys/dev/mii/xmphy.c stable/7/sys/dev/nfe/if_nfe.c stable/7/sys/dev/nge/if_nge.c stable/7/sys/dev/nve/if_nve.c stable/7/sys/dev/sf/if_sf.c stable/7/sys/dev/sge/if_sge.c stable/7/sys/dev/sis/if_sis.c stable/7/sys/dev/ste/if_ste.c stable/7/sys/dev/tx/if_tx.c stable/7/sys/dev/usb/if_aue.c stable/7/sys/dev/usb/if_axe.c stable/7/sys/dev/usb/if_rue.c stable/7/sys/dev/usb/if_udav.c stable/7/sys/dev/vr/if_vr.c stable/7/sys/dev/vte/if_vte.c stable/7/sys/pci/if_wb.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ae/if_ae.c ============================================================================== --- stable/7/sys/dev/ae/if_ae.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/ae/if_ae.c Sun Sep 11 20:25:57 2011 (r225490) @@ -904,10 +904,8 @@ ae_mediachange(struct ifnet *ifp) KASSERT(sc != NULL, ("[ae, %d]: sc is NULL", __LINE__)); AE_LOCK(sc); mii = device_get_softc(sc->miibus); - if (mii->mii_instance != 0) { - LIST_FOREACH(mii_sc, &mii->mii_phys, mii_list) - mii_phy_reset(mii_sc); - } + LIST_FOREACH(mii_sc, &mii->mii_phys, mii_list) + mii_phy_reset(mii_sc); error = mii_mediachg(mii); AE_UNLOCK(sc); Modified: stable/7/sys/dev/age/if_age.c ============================================================================== --- stable/7/sys/dev/age/if_age.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/age/if_age.c Sun Sep 11 20:25:57 2011 (r225490) @@ -301,10 +301,8 @@ age_mediachange(struct ifnet *ifp) sc = ifp->if_softc; AGE_LOCK(sc); mii = device_get_softc(sc->age_miibus); - if (mii->mii_instance != 0) { - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); error = mii_mediachg(mii); AGE_UNLOCK(sc); Modified: stable/7/sys/dev/alc/if_alc.c ============================================================================== --- stable/7/sys/dev/alc/if_alc.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/alc/if_alc.c Sun Sep 11 20:25:57 2011 (r225490) @@ -365,10 +365,8 @@ alc_mediachange(struct ifnet *ifp) sc = ifp->if_softc; ALC_LOCK(sc); mii = device_get_softc(sc->alc_miibus); - if (mii->mii_instance != 0) { - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); error = mii_mediachg(mii); ALC_UNLOCK(sc); Modified: stable/7/sys/dev/ale/if_ale.c ============================================================================== --- stable/7/sys/dev/ale/if_ale.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/ale/if_ale.c Sun Sep 11 20:25:57 2011 (r225490) @@ -286,10 +286,8 @@ ale_mediachange(struct ifnet *ifp) sc = ifp->if_softc; ALE_LOCK(sc); mii = device_get_softc(sc->ale_miibus); - if (mii->mii_instance != 0) { - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); error = mii_mediachg(mii); ALE_UNLOCK(sc); Modified: stable/7/sys/dev/bce/if_bce.c ============================================================================== --- stable/7/sys/dev/bce/if_bce.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/bce/if_bce.c Sun Sep 11 20:25:57 2011 (r225490) @@ -5813,6 +5813,7 @@ bce_ifmedia_upd_locked(struct ifnet *ifp { struct bce_softc *sc = ifp->if_softc; struct mii_data *mii; + struct mii_softc *miisc; int error; DBENTER(BCE_VERBOSE_PHY); @@ -5825,12 +5826,8 @@ bce_ifmedia_upd_locked(struct ifnet *ifp /* Make sure the MII bus has been enumerated. */ if (mii) { sc->bce_link_up = FALSE; - if (mii->mii_instance) { - struct mii_softc *miisc; - - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); error = mii_mediachg(mii); } Modified: stable/7/sys/dev/bfe/if_bfe.c ============================================================================== --- stable/7/sys/dev/bfe/if_bfe.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/bfe/if_bfe.c Sun Sep 11 20:25:57 2011 (r225490) @@ -1669,18 +1669,15 @@ bfe_ifmedia_upd(struct ifnet *ifp) { struct bfe_softc *sc; struct mii_data *mii; + struct mii_softc *miisc; int error; sc = ifp->if_softc; BFE_LOCK(sc); mii = device_get_softc(sc->bfe_miibus); - if (mii->mii_instance) { - struct mii_softc *miisc; - for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL; - miisc = LIST_NEXT(miisc, mii_list)) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); error = mii_mediachg(mii); BFE_UNLOCK(sc); Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/bge/if_bge.c Sun Sep 11 20:25:57 2011 (r225490) @@ -4950,9 +4950,8 @@ bge_ifmedia_upd_locked(struct ifnet *ifp sc->bge_link_evt++; mii = device_get_softc(sc->bge_miibus); - if (mii->mii_instance) - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); mii_mediachg(mii); /* Modified: stable/7/sys/dev/dc/dcphy.c ============================================================================== --- stable/7/sys/dev/dc/dcphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/dc/dcphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -157,7 +157,7 @@ dcphy_attach(device_t dev) /* * Apparently, we can neither isolate nor do loopback. */ - sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_NOMANPAUSE; /*dcphy_reset(sc);*/ dc_sc = mii->mii_ifp->if_softc; Modified: stable/7/sys/dev/dc/pnphy.c ============================================================================== --- stable/7/sys/dev/dc/pnphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/dc/pnphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -133,7 +133,7 @@ pnphy_attach(device_t dev) /* * Apparently, we can neither isolate nor do loopback. */ - sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_NOMANPAUSE; sc->mii_capabilities = BMSR_100TXFDX | BMSR_100TXHDX | BMSR_10TFDX | BMSR_10THDX; Modified: stable/7/sys/dev/et/if_et.c ============================================================================== --- stable/7/sys/dev/et/if_et.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/et/if_et.c Sun Sep 11 20:25:57 2011 (r225490) @@ -515,13 +515,10 @@ et_ifmedia_upd_locked(struct ifnet *ifp) { struct et_softc *sc = ifp->if_softc; struct mii_data *mii = device_get_softc(sc->sc_miibus); + struct mii_softc *miisc; - if (mii->mii_instance != 0) { - struct mii_softc *miisc; - - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); mii_mediachg(mii); return (0); Modified: stable/7/sys/dev/fxp/if_fxp.c ============================================================================== --- stable/7/sys/dev/fxp/if_fxp.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/fxp/if_fxp.c Sun Sep 11 20:25:57 2011 (r225490) @@ -2549,14 +2549,12 @@ fxp_ifmedia_upd(struct ifnet *ifp) { struct fxp_softc *sc = ifp->if_softc; struct mii_data *mii; + struct mii_softc *miisc; mii = device_get_softc(sc->miibus); FXP_LOCK(sc); - if (mii->mii_instance) { - struct mii_softc *miisc; - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); mii_mediachg(mii); FXP_UNLOCK(sc); return (0); Modified: stable/7/sys/dev/jme/if_jme.c ============================================================================== --- stable/7/sys/dev/jme/if_jme.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/jme/if_jme.c Sun Sep 11 20:25:57 2011 (r225490) @@ -318,10 +318,8 @@ jme_mediachange(struct ifnet *ifp) sc = ifp->if_softc; JME_LOCK(sc); mii = device_get_softc(sc->jme_miibus); - if (mii->mii_instance != 0) { - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); error = mii_mediachg(mii); JME_UNLOCK(sc); Modified: stable/7/sys/dev/lge/if_lge.c ============================================================================== --- stable/7/sys/dev/lge/if_lge.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/lge/if_lge.c Sun Sep 11 20:25:57 2011 (r225490) @@ -1404,18 +1404,15 @@ lge_ifmedia_upd_locked(ifp) { struct lge_softc *sc; struct mii_data *mii; + struct mii_softc *miisc; sc = ifp->if_softc; LGE_LOCK_ASSERT(sc); mii = device_get_softc(sc->lge_miibus); sc->lge_link = 0; - if (mii->mii_instance) { - struct mii_softc *miisc; - for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL; - miisc = LIST_NEXT(miisc, mii_list)) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); mii_mediachg(mii); } Modified: stable/7/sys/dev/mii/acphy.c ============================================================================== --- stable/7/sys/dev/mii/acphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/acphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -138,6 +138,8 @@ acphy_attach(device_t dev) sc->mii_service = acphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + acphy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; @@ -245,7 +247,8 @@ acphy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_10_T; if (diag & AC_DIAG_DUPLEX) - mii->mii_media_active |= IFM_FDX; + mii->mii_media_active |= + IFM_FDX | mii_phy_flowstatus(sc); else mii->mii_media_active |= IFM_HDX; } else Modified: stable/7/sys/dev/mii/amphy.c ============================================================================== --- stable/7/sys/dev/mii/amphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/amphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -115,6 +115,8 @@ amphy_attach(device_t dev) sc->mii_service = amphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) #if 0 @@ -231,6 +233,8 @@ amphy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_10_T|IFM_HDX; else if (par & DSCSR_10HDX) mii->mii_media_active |= IFM_10_T|IFM_HDX; + if ((mii->mii_media_active & IFM_FDX) != 0) + mii->mii_media_active |= mii_phy_flowstatus(sc); } else mii->mii_media_active = ife->ifm_media; } Modified: stable/7/sys/dev/mii/atphy.c ============================================================================== --- stable/7/sys/dev/mii/atphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/atphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -119,6 +119,8 @@ atphy_attach(device_t dev) sc->mii_service = atphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + asc->mii_oui = MII_OUI(ma->mii_id1, ma->mii_id2); asc->mii_model = MII_MODEL(ma->mii_id2); asc->mii_rev = MII_REV(ma->mii_id2); @@ -318,12 +320,9 @@ static void atphy_reset(struct mii_softc *sc) { struct ifmedia_entry *ife = sc->mii_pdata->mii_media.ifm_cur; - struct atphy_softc *asc; uint32_t reg; int i; - asc = (struct atphy_softc *)sc; - /* Take PHY out of power down mode. */ PHY_WRITE(sc, 29, 0x29); PHY_WRITE(sc, 30, 0); Modified: stable/7/sys/dev/mii/brgphy.c ============================================================================== --- stable/7/sys/dev/mii/brgphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/brgphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -222,9 +222,6 @@ brgphy_attach(device_t dev) /* Handle any special cases based on the PHY ID */ switch (bsc->mii_oui) { - case MII_OUI_BROADCOM: - case MII_OUI_BROADCOM2: - break; case MII_OUI_xxBROADCOM: switch (bsc->mii_model) { case MII_MODEL_xxBROADCOM_BCM5706: @@ -257,11 +254,6 @@ brgphy_attach(device_t dev) break; } break; - case MII_OUI_xxBROADCOM_ALT2: - /* No special handling yet. */ - break; - default: - device_printf(dev, "Unrecognized OUI for PHY!\n"); } ifp = sc->mii_pdata->mii_ifp; @@ -400,8 +392,6 @@ brgphy_service(struct mii_softc *sc, str sc->mii_media_status != mii->mii_media_status || cmd == MII_MEDIACHG) { switch (bsc->mii_oui) { - case MII_OUI_BROADCOM: - break; case MII_OUI_xxBROADCOM: switch (bsc->mii_model) { case MII_MODEL_xxBROADCOM_BCM5400: @@ -419,8 +409,6 @@ brgphy_service(struct mii_softc *sc, str break; } break; - case MII_OUI_xxBROADCOM_ALT1: - break; } } mii_phy_update(sc, cmd); @@ -932,8 +920,6 @@ brgphy_reset(struct mii_softc *sc) /* Handle any PHY specific procedures following the reset. */ switch (bsc->mii_oui) { - case MII_OUI_BROADCOM: - break; case MII_OUI_xxBROADCOM: switch (bsc->mii_model) { case MII_MODEL_xxBROADCOM_BCM5400: @@ -951,9 +937,6 @@ brgphy_reset(struct mii_softc *sc) break; } break; - case MII_OUI_xxBROADCOM_ALT1: - case MII_OUI_xxBROADCOM_ALT2: - break; } ifp = sc->mii_pdata->mii_ifp; Modified: stable/7/sys/dev/mii/ciphy.c ============================================================================== --- stable/7/sys/dev/mii/ciphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/ciphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -122,7 +122,7 @@ ciphy_attach(device_t dev) sc->mii_service = ciphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOMANPAUSE; ciphy_reset(sc); Modified: stable/7/sys/dev/mii/e1000phy.c ============================================================================== --- stable/7/sys/dev/mii/e1000phy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/e1000phy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -91,7 +91,7 @@ DRIVER_MODULE(e1000phy, miibus, e1000phy static int e1000phy_service(struct mii_softc *, struct mii_data *, int); static void e1000phy_status(struct mii_softc *); static void e1000phy_reset(struct mii_softc *); -static int e1000phy_mii_phy_auto(struct e1000phy_softc *, int); +static int e1000phy_mii_phy_auto(struct mii_softc *, int); static const struct mii_phydesc e1000phys[] = { MII_PHY_DESC(MARVELL, E1000), @@ -313,7 +313,6 @@ static int e1000phy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { struct ifmedia_entry *ife = mii->mii_media.ifm_cur; - struct e1000phy_softc *esc = (struct e1000phy_softc *)sc; uint16_t speed, gig; int reg; @@ -329,7 +328,7 @@ e1000phy_service(struct mii_softc *sc, s break; if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) { - e1000phy_mii_phy_auto(esc, ife->ifm_media); + e1000phy_mii_phy_auto(sc, ife->ifm_media); break; } @@ -418,7 +417,7 @@ done: sc->mii_ticks = 0; e1000phy_reset(sc); - e1000phy_mii_phy_auto(esc, ife->ifm_media); + e1000phy_mii_phy_auto(sc, ife->ifm_media); break; } @@ -494,12 +493,10 @@ e1000phy_status(struct mii_softc *sc) } static int -e1000phy_mii_phy_auto(struct e1000phy_softc *esc, int media) +e1000phy_mii_phy_auto(struct mii_softc *sc, int media) { - struct mii_softc *sc; uint16_t reg; - sc = &esc->mii_sc; if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { reg = PHY_READ(sc, E1000_AR); reg &= ~(E1000_AR_PAUSE | E1000_AR_ASM_DIR); Modified: stable/7/sys/dev/mii/exphy.c ============================================================================== --- stable/7/sys/dev/mii/exphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/exphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -147,7 +147,7 @@ exphy_attach(device_t dev) /* * The 3Com PHY can never be isolated. */ - sc->mii_flags |= MIIF_NOISOLATE; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOMANPAUSE; #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) Modified: stable/7/sys/dev/mii/icsphy.c ============================================================================== --- stable/7/sys/dev/mii/icsphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/icsphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -147,7 +147,7 @@ icsphy_attach(device_t dev) sc->mii_service = icsphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOMANPAUSE; ifmedia_add(&mii->mii_media, IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), @@ -240,7 +240,8 @@ icsphy_status(struct mii_softc *sc) else mii->mii_media_active |= IFM_10_T; if (qpr & QPR_FDX) - mii->mii_media_active |= IFM_FDX; + mii->mii_media_active |= + IFM_FDX | mii_phy_flowstatus(sc); else mii->mii_media_active |= IFM_HDX; } else Modified: stable/7/sys/dev/mii/inphy.c ============================================================================== --- stable/7/sys/dev/mii/inphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/inphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -114,7 +114,7 @@ inphy_attach(device_t dev) sc->mii_service = inphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOMANPAUSE; + sc->mii_flags |= MIIF_NOMANPAUSE | MIIF_NOMANPAUSE; ifmedia_add(&mii->mii_media, IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), Modified: stable/7/sys/dev/mii/jmphy.c ============================================================================== --- stable/7/sys/dev/mii/jmphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/jmphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -269,12 +269,9 @@ jmphy_status(struct mii_softc *sc) static void jmphy_reset(struct mii_softc *sc) { - struct jmphy_softc *jsc; uint16_t t2cr, val; int i; - jsc = (struct jmphy_softc *)sc; - /* Disable sleep mode. */ PHY_WRITE(sc, JMPHY_TMCTL, PHY_READ(sc, JMPHY_TMCTL) & ~JMPHY_TMCTL_SLEEP_ENB); Modified: stable/7/sys/dev/mii/lxtphy.c ============================================================================== --- stable/7/sys/dev/mii/lxtphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/lxtphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -106,6 +106,7 @@ DRIVER_MODULE(lxtphy, miibus, lxtphy_dri static int lxtphy_service(struct mii_softc *, struct mii_data *, int); static void lxtphy_status(struct mii_softc *); +static void lxtphy_reset(struct mii_softc *); static void lxtphy_set_tp(struct mii_softc *); static void lxtphy_set_fx(struct mii_softc *); @@ -140,7 +141,9 @@ lxtphy_attach(device_t dev) sc->mii_service = lxtphy_service; sc->mii_pdata = mii; - mii_phy_reset(sc); + sc->mii_flags |= MIIF_NOMANPAUSE; + + lxtphy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); @@ -248,6 +251,15 @@ lxtphy_status(struct mii_softc *sc) } static void +lxtphy_reset(struct mii_softc *sc) +{ + + mii_phy_reset(sc); + PHY_WRITE(sc, MII_LXTPHY_IER, + PHY_READ(sc, MII_LXTPHY_IER) & ~IER_INTEN); +} + +static void lxtphy_set_tp(struct mii_softc *sc) { int cfg; Modified: stable/7/sys/dev/mii/mii.c ============================================================================== --- stable/7/sys/dev/mii/mii.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/mii.c Sun Sep 11 20:25:57 2011 (r225490) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include @@ -87,9 +87,9 @@ static device_method_t miibus_methods[] /* MII interface */ DEVMETHOD(miibus_readreg, miibus_readreg), DEVMETHOD(miibus_writereg, miibus_writereg), - DEVMETHOD(miibus_statchg, miibus_statchg), - DEVMETHOD(miibus_linkchg, miibus_linkchg), - DEVMETHOD(miibus_mediainit, miibus_mediainit), + DEVMETHOD(miibus_statchg, miibus_statchg), + DEVMETHOD(miibus_linkchg, miibus_linkchg), + DEVMETHOD(miibus_mediainit, miibus_mediainit), { 0, 0 } }; @@ -270,7 +270,7 @@ miibus_linkchg(device_t dev) MIIBUS_LINKCHG(parent); mii = device_get_softc(dev); - + if (mii->mii_media_status & IFM_AVALID) { if (mii->mii_media_status & IFM_ACTIVE) link_state = LINK_STATE_UP; @@ -370,7 +370,7 @@ mii_attach(device_t dev, device_t *miibu * has been allocated. */ ma.mii_data = device_get_softc(*miibus); - } + } ma.mii_capmask = capmask; @@ -401,7 +401,7 @@ mii_attach(device_t dev, device_t *miibu * Check to see if there is a PHY at this address. Note, * many braindead PHYs report 0/0 in their ID registers, * so we test for media in the BMSR. - */ + */ bmsr = MIIBUS_READREG(dev, ma.mii_phyno, MII_BMSR); if (bmsr == 0 || bmsr == 0xffff || (bmsr & (BMSR_EXTSTAT | BMSR_MEDIAMASK)) == 0) { @@ -420,7 +420,7 @@ mii_attach(device_t dev, device_t *miibu * Extract the IDs. Braindead PHYs will be handled by * the `ukphy' driver, as we have no ID information to * match on. - */ + */ ma.mii_id1 = MIIBUS_READREG(dev, ma.mii_phyno, MII_PHYIDR1); ma.mii_id2 = MIIBUS_READREG(dev, ma.mii_phyno, MII_PHYIDR2); Modified: stable/7/sys/dev/mii/mii.h ============================================================================== --- stable/7/sys/dev/mii/mii.h Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/mii.h Sun Sep 11 20:25:57 2011 (r225490) @@ -89,15 +89,9 @@ * info available in register 15, but 802.3 section 22.2.4.3 also * states that that all 1000 Mb/s capable PHYs will set this bit to 1. */ -#if 0 -#define BMSR_MEDIAMASK (BMSR_100T4|BMSR_100TXFDX|BMSR_100TXHDX|BMSR_10TFDX| \ - BMSR_10THDX|BMSR_ANEG) -#else -/* NetBSD uses: */ #define BMSR_MEDIAMASK (BMSR_100T4|BMSR_100TXFDX|BMSR_100TXHDX| \ BMSR_10TFDX|BMSR_10THDX|BMSR_100T2FDX|BMSR_100T2HDX) -#endif /* * Convert BMSR media capabilities to ANAR bits for autonegotiation. Modified: stable/7/sys/dev/mii/mii_physubr.c ============================================================================== --- stable/7/sys/dev/mii/mii_physubr.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/mii_physubr.c Sun Sep 11 20:25:57 2011 (r225490) @@ -428,9 +428,11 @@ mii_phy_add_media(struct mii_softc *sc) #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) #define PRINT(s) printf("%s%s", sep, s); sep = ", " - if ((sc->mii_flags & MIIF_NOISOLATE) == 0) + if ((sc->mii_flags & MIIF_NOISOLATE) == 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst), MII_MEDIA_NONE); + PRINT("none"); + } /* * There are different interpretations for the bits in Modified: stable/7/sys/dev/mii/miivar.h ============================================================================== --- stable/7/sys/dev/mii/miivar.h Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/miivar.h Sun Sep 11 20:25:57 2011 (r225490) @@ -38,7 +38,7 @@ #include /* - * Media Independent Interface configuration defintions. + * Media Independent Interface data structure defintions */ struct mii_softc; @@ -65,13 +65,13 @@ struct mii_data { * request is made. */ LIST_HEAD(mii_listhead, mii_softc) mii_phys; - int mii_instance; + u_int mii_instance; /* * PHY driver fills this in with active media status. */ - int mii_media_status; - int mii_media_active; + u_int mii_media_status; + u_int mii_media_active; /* * Calls from MII layer into network interface driver. @@ -105,19 +105,19 @@ struct mii_softc { LIST_ENTRY(mii_softc) mii_list; /* entry on parent's PHY list */ - int mii_phy; /* our MII address */ - int mii_inst; /* instance for ifmedia */ + u_int mii_phy; /* our MII address */ + u_int mii_inst; /* instance for ifmedia */ mii_downcall_t mii_service; /* our downcall */ struct mii_data *mii_pdata; /* pointer to parent's mii_data */ - int mii_flags; /* misc. flags; see below */ - int mii_capabilities; /* capabilities from BMSR */ - int mii_extcapabilities; /* extended capabilities */ - int mii_ticks; /* MII_TICK counter */ - int mii_anegticks; /* ticks before retrying aneg */ - int mii_media_active; /* last active media */ - int mii_media_status; /* last active status */ + u_int mii_flags; /* misc. flags; see below */ + u_int mii_capabilities; /* capabilities from BMSR */ + u_int mii_extcapabilities; /* extended capabilities */ + u_int mii_ticks; /* MII_TICK counter */ + u_int mii_anegticks; /* ticks before retrying aneg */ + u_int mii_media_active; /* last active media */ + u_int mii_media_status; /* last active status */ }; typedef struct mii_softc mii_softc_t; @@ -161,10 +161,11 @@ typedef struct mii_softc mii_softc_t; */ struct mii_attach_args { struct mii_data *mii_data; /* pointer to parent data */ - int mii_phyno; /* MII address */ - int mii_id1; /* PHY ID register 1 */ - int mii_id2; /* PHY ID register 2 */ - int mii_capmask; /* capability mask from BMSR */ + u_int mii_phyno; /* MII address */ + u_int mii_offset; /* first PHY, second PHY, etc. */ + uint32_t mii_id1; /* PHY ID register 1 */ + uint32_t mii_id2; /* PHY ID register 2 */ + u_int mii_capmask; /* capability mask for BMSR */ }; typedef struct mii_attach_args mii_attach_args_t; @@ -172,8 +173,8 @@ typedef struct mii_attach_args mii_attac * Used to match a PHY. */ struct mii_phydesc { - u_int32_t mpd_oui; /* the PHY's OUI */ - u_int32_t mpd_model; /* the PHY's model */ + uint32_t mpd_oui; /* the PHY's OUI */ + uint32_t mpd_model; /* the PHY's model */ const char *mpd_name; /* the PHY's name */ }; #define MII_PHY_DESC(a, b) { MII_OUI_ ## a, MII_MODEL_ ## a ## _ ## b, \ @@ -184,9 +185,9 @@ struct mii_phydesc { * An array of these structures map MII media types to BMCR/ANAR settings. */ struct mii_media { - int mm_bmcr; /* BMCR settings for this media */ - int mm_anar; /* ANAR settings for this media */ - int mm_gtcr; /* 100base-T2 or 1000base-T CR */ + u_int mm_bmcr; /* BMCR settings for this media */ + u_int mm_anar; /* ANAR settings for this media */ + u_int mm_gtcr; /* 100base-T2 or 1000base-T CR */ }; #define MII_MEDIA_NONE 0 @@ -219,7 +220,7 @@ enum miibus_device_ivars { #define MIIBUS_ACCESSOR(var, ivar, type) \ __BUS_ACCESSOR(miibus, var, MIIBUS, ivar, type) -MIIBUS_ACCESSOR(flags, FLAGS, int) +MIIBUS_ACCESSOR(flags, FLAGS, u_int) extern devclass_t miibus_devclass; extern driver_t miibus_driver; Modified: stable/7/sys/dev/mii/mlphy.c ============================================================================== --- stable/7/sys/dev/mii/mlphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/mlphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -154,6 +154,8 @@ mlphy_attach(dev) sc->mii_service = mlphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), Modified: stable/7/sys/dev/mii/nsphy.c ============================================================================== --- stable/7/sys/dev/mii/nsphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/nsphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -139,6 +139,8 @@ nsphy_attach(device_t dev) sc->mii_service = nsphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + nic = device_get_name(device_get_parent(sc->mii_dev)); /* * Am79C971 wedge when isolating all of their external PHYs. @@ -296,6 +298,9 @@ nsphy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_10_T|IFM_HDX; else mii->mii_media_active |= IFM_NONE; + if ((mii->mii_media_active & IFM_FDX) != 0) + mii->mii_media_active |= + mii_phy_flowstatus(sc); return; } Modified: stable/7/sys/dev/mii/nsphyter.c ============================================================================== --- stable/7/sys/dev/mii/nsphyter.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/nsphyter.c Sun Sep 11 20:25:57 2011 (r225490) @@ -110,7 +110,7 @@ static int nsphyter_service(struct mii_s static void nsphyter_status(struct mii_softc *); static void nsphyter_reset(struct mii_softc *); -static const struct mii_phydesc nsphys[] = { +static const struct mii_phydesc nsphyters[] = { MII_PHY_DESC(NATSEMI, DP83815), MII_PHY_DESC(NATSEMI, DP83843), MII_PHY_DESC(NATSEMI, DP83847), @@ -121,7 +121,7 @@ static int nsphyter_probe(device_t dev) { - return (mii_phy_dev_probe(dev, nsphys, BUS_PROBE_DEFAULT)); + return (mii_phy_dev_probe(dev, nsphyters, BUS_PROBE_DEFAULT)); } static int Modified: stable/7/sys/dev/mii/pnaphy.c ============================================================================== --- stable/7/sys/dev/mii/pnaphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/pnaphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -115,7 +115,8 @@ pnaphy_attach(device_t dev) sc->mii_service = pnaphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_IS_HPNA; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_IS_HPNA | + MIIF_NOMANPAUSE; mii_phy_reset(sc); Modified: stable/7/sys/dev/mii/qsphy.c ============================================================================== --- stable/7/sys/dev/mii/qsphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/qsphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -139,6 +139,8 @@ qsphy_attach(device_t dev) sc->mii_service = qsphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + qsphy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; @@ -238,6 +240,8 @@ qsphy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_NONE; break; } + if ((mii->mii_media_active & IFM_FDX) != 0) + mii->mii_media_active |= mii_phy_flowstatus(sc); } static void Modified: stable/7/sys/dev/mii/rdcphy.c ============================================================================== --- stable/7/sys/dev/mii/rdcphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/rdcphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -115,6 +115,8 @@ rdcphy_attach(device_t dev) sc->mii_service = rdcphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + rsc->mii_model = MII_MODEL(ma->mii_id2); if (bootverbose) device_printf(dev, "OUI 0x%06x, model 0x%04x, rev. %d\n", Modified: stable/7/sys/dev/mii/rlphy.c ============================================================================== --- stable/7/sys/dev/mii/rlphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/rlphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -150,7 +150,7 @@ rlphy_attach(device_t dev) /* * The RealTek PHY can never be isolated. */ - sc->mii_flags |= MIIF_NOISOLATE; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOMANPAUSE; #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) @@ -259,6 +259,9 @@ rlphy_status(struct mii_softc *phy) mii->mii_media_active |= IFM_10_T|IFM_HDX; else mii->mii_media_active |= IFM_NONE; + if ((mii->mii_media_active & IFM_FDX) != 0) + mii->mii_media_active |= + mii_phy_flowstatus(phy); return; } /* @@ -279,10 +282,10 @@ rlphy_status(struct mii_softc *phy) * To determine the link speed, we have to do one * of two things: * - * - If this is a standalone RealTek RTL8201(L) PHY, - * we can determine the link speed by testing bit 0 - * in the magic, vendor-specific register at offset - * 0x19. + * - If this is a standalone RealTek RTL8201(L) or + * workalike PHY, we can determine the link speed by + * testing bit 0 in the magic, vendor-specific register + * at offset 0x19. * * - If this is a RealTek MAC with integrated PHY, we * can test the 'SPEED10' bit of the MAC's media status Modified: stable/7/sys/dev/mii/rlswitch.c ============================================================================== --- stable/7/sys/dev/mii/rlswitch.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/rlswitch.c Sun Sep 11 20:25:57 2011 (r225490) @@ -129,7 +129,7 @@ rlswitch_attach(device_t dev) /* * We handle all pseudo PHYs in a single instance. */ - sc->mii_flags |= MIIF_NOISOLATE; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOMANPAUSE; #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) @@ -390,7 +390,8 @@ rlswitch_status(struct mii_softc *phy) mii->mii_media_status = IFM_AVALID; mii->mii_media_active = IFM_ETHER; mii->mii_media_status |= IFM_ACTIVE; - mii->mii_media_active |= IFM_100_TX|IFM_FDX; + mii->mii_media_active |= + IFM_100_TX | IFM_FDX | mii_phy_flowstatus(phy); } #ifdef RL_DEBUG Modified: stable/7/sys/dev/mii/ruephy.c ============================================================================== --- stable/7/sys/dev/mii/ruephy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/ruephy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -120,7 +120,7 @@ ruephy_attach(device_t dev) /* * Apparently, we can neither isolate nor do loopback on this PHY. */ - sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_NOMANPAUSE; ruephy_reset(sc); @@ -244,7 +244,8 @@ ruephy_status(struct mii_softc *phy) mii->mii_media_active |= IFM_10_T; if (msr & RUEPHY_MSR_DUPLEX) - mii->mii_media_active |= IFM_FDX; + mii->mii_media_active |= + IFM_FDX | mii_phy_flowstatus(phy); else mii->mii_media_active |= IFM_HDX; } else Modified: stable/7/sys/dev/mii/tdkphy.c ============================================================================== --- stable/7/sys/dev/mii/tdkphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/tdkphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -125,7 +125,7 @@ tdkphy_attach(device_t dev) /* * Apparently, we can't do loopback on this PHY. */ - sc->mii_flags |= MIIF_NOLOOP; + sc->mii_flags |= MIIF_NOLOOP | MIIF_NOMANPAUSE; mii_phy_reset(sc); @@ -247,6 +247,8 @@ tdkphy_status(struct mii_softc *phy) mii->mii_media_active |= IFM_10_T; } } + if ((mii->mii_media_active & IFM_FDX) != 0) + mii->mii_media_active |= mii_phy_flowstatus(phy); } else mii->mii_media_active = ife->ifm_media; } Modified: stable/7/sys/dev/mii/tlphy.c ============================================================================== --- stable/7/sys/dev/mii/tlphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/tlphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -153,6 +153,8 @@ tlphy_attach(device_t dev) sc->sc_mii.mii_service = tlphy_service; sc->sc_mii.mii_pdata = mii; + sc->sc_mii.mii_flags |= MIIF_NOMANPAUSE; + /* * Note that if we're on a device that also supports 100baseTX, * we are not going to want to use the built-in 10baseT port, @@ -338,7 +340,8 @@ tlphy_status(struct tlphy_softc *sc) * just have to report what's in the BMCR. */ if (bmcr & BMCR_FDX) - mii->mii_media_active |= IFM_FDX; + mii->mii_media_active |= + IFM_FDX | mii_phy_flowstatus(&sc->sc_mii); else mii->mii_media_active |= IFM_HDX; mii->mii_media_active |= IFM_10_T; Modified: stable/7/sys/dev/mii/truephy.c ============================================================================== --- stable/7/sys/dev/mii/truephy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/truephy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -157,7 +157,7 @@ truephy_attach(device_t dev) sc->mii_service = truephy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_NOMANPAUSE; if (MII_MODEL(ma->mii_id2) == MII_MODEL_AGERE_ET1011) mii_phy_reset(sc); @@ -210,7 +210,7 @@ truephy_service(struct mii_softc *sc, st if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) { PHY_WRITE(sc, MII_BMCR, - bmcr | BMCR_AUTOEN | BMCR_STARTNEG); + bmcr | BMCR_AUTOEN | BMCR_STARTNEG); } } break; @@ -326,7 +326,7 @@ truephy_status(struct mii_softc *sc) } if (sr & TRUEPHY_SR_FDX) - mii->mii_media_active |= IFM_FDX; + mii->mii_media_active |= IFM_FDX | mii_phy_flowstatus(sc); else mii->mii_media_active |= IFM_HDX; } Modified: stable/7/sys/dev/mii/xmphy.c ============================================================================== --- stable/7/sys/dev/mii/xmphy.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/mii/xmphy.c Sun Sep 11 20:25:57 2011 (r225490) @@ -116,7 +116,7 @@ xmphy_attach(device_t dev) sc->mii_service = xmphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOMANPAUSE; sc->mii_anegticks = MII_ANEGTICKS; mii_phy_reset(sc); @@ -134,6 +134,7 @@ xmphy_attach(device_t dev) PRINT("auto"); printf("\n"); + #undef ADD #undef PRINT @@ -247,7 +248,6 @@ xmphy_status(struct mii_softc *sc) if (bmcr & XMPHY_BMCR_LOOP) mii->mii_media_active |= IFM_LOOP; - if (bmcr & XMPHY_BMCR_AUTOEN) { if ((bmsr & XMPHY_BMSR_ACOMP) == 0) { if (bmsr & XMPHY_BMSR_LINK) { Modified: stable/7/sys/dev/nfe/if_nfe.c ============================================================================== --- stable/7/sys/dev/nfe/if_nfe.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/nfe/if_nfe.c Sun Sep 11 20:25:57 2011 (r225490) @@ -3286,14 +3286,10 @@ nfe_set_linkspeed(struct nfe_softc *sc) break; } } - phyno = 0; - if (mii->mii_instance) { - miisc = LIST_FIRST(&mii->mii_phys); - phyno = miisc->mii_phy; - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } else - return; + miisc = LIST_FIRST(&mii->mii_phys); + phyno = miisc->mii_phy; + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); nfe_miibus_writereg(sc->nfe_dev, phyno, MII_100T2CR, 0); nfe_miibus_writereg(sc->nfe_dev, phyno, MII_ANAR, ANAR_TX_FD | ANAR_TX | ANAR_10_FD | ANAR_10 | ANAR_CSMA); Modified: stable/7/sys/dev/nge/if_nge.c ============================================================================== --- stable/7/sys/dev/nge/if_nge.c Sun Sep 11 20:17:44 2011 (r225489) +++ stable/7/sys/dev/nge/if_nge.c Sun Sep 11 20:25:57 2011 (r225490) @@ -2391,10 +2391,8 @@ nge_mediachange(struct ifnet *ifp) sc = ifp->if_softc; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Sun Sep 11 20:38:35 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B5D3106566C; Sun, 11 Sep 2011 20:38:35 +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 06B668FC16; Sun, 11 Sep 2011 20:38:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8BKcZin095035; Sun, 11 Sep 2011 20:38:35 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8BKcYVi094991; Sun, 11 Sep 2011 20:38:34 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201109112038.p8BKcYVi094991@svn.freebsd.org> From: Marius Strobl Date: Sun, 11 Sep 2011 20:38: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: r225492 - in stable/8/sys: dev/ae dev/age dev/alc dev/ale dev/bce dev/bfe dev/bge dev/dc dev/ed dev/et dev/fxp dev/jme dev/lge dev/mii dev/nfe dev/nge dev/nve dev/sf dev/sge dev/sis dev... X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Sep 2011 20:38:35 -0000 Author: marius Date: Sun Sep 11 20:38:33 2011 New Revision: 225492 URL: http://svn.freebsd.org/changeset/base/225492 Log: MFC: r221407 (partial) - Let mii_phy_add_media() also announce the support of IFM_NONE. - Add a PHY-specific reset routine is for lxtphy(4) which disables MII interrupts. - Remove redundant checks in NIC drivers for mii->mii_instance not being zero before calling the reset routines because as soon as one PHY driver attaches mii->mii_instance is incremented and we hardly can end up in their media change callbacks etc if no PHY driver has attached as mii_attach() would have failed in that case and not attach a miibus(4) instance. - Convert the mebers of the MII data structure to unsigned where appropriate. This is partly inspired by NetBSD/OpenBSD. - Add MIIF_NOMANPAUSE and mii_phy_flowstatus() calls to drivers that weren't explicitly converted to support flow control before. It's unclear whether flow control actually works with these but typically it should and their net behavior should be more correct with these changes in place than without if the MAC driver sets MIIF_DOPAUSE. Obtained from: NetBSD (partially) Modified: stable/8/sys/dev/ae/if_ae.c 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/bfe/if_bfe.c stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/dc/dcphy.c stable/8/sys/dev/dc/pnphy.c stable/8/sys/dev/ed/if_ed_pccard.c stable/8/sys/dev/et/if_et.c stable/8/sys/dev/fxp/if_fxp.c stable/8/sys/dev/jme/if_jme.c stable/8/sys/dev/lge/if_lge.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/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/icsphy.c stable/8/sys/dev/mii/inphy.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/mii.h stable/8/sys/dev/mii/mii_physubr.c stable/8/sys/dev/mii/miivar.h stable/8/sys/dev/mii/mlphy.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/rdcphy.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/xmphy.c stable/8/sys/dev/nfe/if_nfe.c stable/8/sys/dev/nge/if_nge.c stable/8/sys/dev/nve/if_nve.c stable/8/sys/dev/sf/if_sf.c stable/8/sys/dev/sge/if_sge.c stable/8/sys/dev/sis/if_sis.c stable/8/sys/dev/ste/if_ste.c stable/8/sys/dev/tx/if_tx.c stable/8/sys/dev/usb/net/if_aue.c stable/8/sys/dev/usb/net/if_axe.c stable/8/sys/dev/usb/net/if_rue.c stable/8/sys/dev/usb/net/if_udav.c stable/8/sys/dev/vr/if_vr.c stable/8/sys/dev/vte/if_vte.c stable/8/sys/dev/wb/if_wb.c stable/8/sys/mips/atheros/if_arge.c stable/8/sys/mips/cavium/octe/octe.c stable/8/sys/mips/idt/if_kr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ae/if_ae.c ============================================================================== --- stable/8/sys/dev/ae/if_ae.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/ae/if_ae.c Sun Sep 11 20:38:33 2011 (r225492) @@ -904,10 +904,8 @@ ae_mediachange(struct ifnet *ifp) KASSERT(sc != NULL, ("[ae, %d]: sc is NULL", __LINE__)); AE_LOCK(sc); mii = device_get_softc(sc->miibus); - if (mii->mii_instance != 0) { - LIST_FOREACH(mii_sc, &mii->mii_phys, mii_list) - mii_phy_reset(mii_sc); - } + LIST_FOREACH(mii_sc, &mii->mii_phys, mii_list) + mii_phy_reset(mii_sc); error = mii_mediachg(mii); AE_UNLOCK(sc); Modified: stable/8/sys/dev/age/if_age.c ============================================================================== --- stable/8/sys/dev/age/if_age.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/age/if_age.c Sun Sep 11 20:38:33 2011 (r225492) @@ -301,10 +301,8 @@ age_mediachange(struct ifnet *ifp) sc = ifp->if_softc; AGE_LOCK(sc); mii = device_get_softc(sc->age_miibus); - if (mii->mii_instance != 0) { - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); error = mii_mediachg(mii); AGE_UNLOCK(sc); Modified: stable/8/sys/dev/alc/if_alc.c ============================================================================== --- stable/8/sys/dev/alc/if_alc.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/alc/if_alc.c Sun Sep 11 20:38:33 2011 (r225492) @@ -365,10 +365,8 @@ alc_mediachange(struct ifnet *ifp) sc = ifp->if_softc; ALC_LOCK(sc); mii = device_get_softc(sc->alc_miibus); - if (mii->mii_instance != 0) { - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); error = mii_mediachg(mii); ALC_UNLOCK(sc); Modified: stable/8/sys/dev/ale/if_ale.c ============================================================================== --- stable/8/sys/dev/ale/if_ale.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/ale/if_ale.c Sun Sep 11 20:38:33 2011 (r225492) @@ -286,10 +286,8 @@ ale_mediachange(struct ifnet *ifp) sc = ifp->if_softc; ALE_LOCK(sc); mii = device_get_softc(sc->ale_miibus); - if (mii->mii_instance != 0) { - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); error = mii_mediachg(mii); ALE_UNLOCK(sc); Modified: stable/8/sys/dev/bce/if_bce.c ============================================================================== --- stable/8/sys/dev/bce/if_bce.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/bce/if_bce.c Sun Sep 11 20:38:33 2011 (r225492) @@ -5813,6 +5813,7 @@ bce_ifmedia_upd_locked(struct ifnet *ifp { struct bce_softc *sc = ifp->if_softc; struct mii_data *mii; + struct mii_softc *miisc; int error; DBENTER(BCE_VERBOSE_PHY); @@ -5825,12 +5826,8 @@ bce_ifmedia_upd_locked(struct ifnet *ifp /* Make sure the MII bus has been enumerated. */ if (mii) { sc->bce_link_up = FALSE; - if (mii->mii_instance) { - struct mii_softc *miisc; - - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); error = mii_mediachg(mii); } Modified: stable/8/sys/dev/bfe/if_bfe.c ============================================================================== --- stable/8/sys/dev/bfe/if_bfe.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/bfe/if_bfe.c Sun Sep 11 20:38:33 2011 (r225492) @@ -1736,18 +1736,15 @@ bfe_ifmedia_upd(struct ifnet *ifp) { struct bfe_softc *sc; struct mii_data *mii; + struct mii_softc *miisc; int error; sc = ifp->if_softc; BFE_LOCK(sc); mii = device_get_softc(sc->bfe_miibus); - if (mii->mii_instance) { - struct mii_softc *miisc; - for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL; - miisc = LIST_NEXT(miisc, mii_list)) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); error = mii_mediachg(mii); BFE_UNLOCK(sc); Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/bge/if_bge.c Sun Sep 11 20:38:33 2011 (r225492) @@ -4954,9 +4954,8 @@ bge_ifmedia_upd_locked(struct ifnet *ifp sc->bge_link_evt++; mii = device_get_softc(sc->bge_miibus); - if (mii->mii_instance) - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); mii_mediachg(mii); /* Modified: stable/8/sys/dev/dc/dcphy.c ============================================================================== --- stable/8/sys/dev/dc/dcphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/dc/dcphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -158,7 +158,7 @@ dcphy_attach(device_t dev) /* * Apparently, we can neither isolate nor do loopback. */ - sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_NOMANPAUSE; /*dcphy_reset(sc);*/ dc_sc = mii->mii_ifp->if_softc; Modified: stable/8/sys/dev/dc/pnphy.c ============================================================================== --- stable/8/sys/dev/dc/pnphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/dc/pnphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -133,7 +133,7 @@ pnphy_attach(device_t dev) /* * Apparently, we can neither isolate nor do loopback. */ - sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_NOMANPAUSE; sc->mii_capabilities = BMSR_100TXFDX | BMSR_100TXHDX | BMSR_10TFDX | BMSR_10THDX; Modified: stable/8/sys/dev/ed/if_ed_pccard.c ============================================================================== --- stable/8/sys/dev/ed/if_ed_pccard.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/ed/if_ed_pccard.c Sun Sep 11 20:38:33 2011 (r225492) @@ -401,17 +401,9 @@ ed_pccard_kick_phy(struct ed_softc *sc) struct mii_softc *miisc; struct mii_data *mii; - /* - * Many of the PHYs that wind up on PC Cards are weird in - * this way. Generally, we don't need to worry so much about - * the Isolation protocol since there's only one PHY in - * these designs, so this workaround is reasonable. - */ mii = device_get_softc(sc->miibus); - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) { - miisc->mii_flags |= MIIF_FORCEANEG; + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) mii_phy_reset(miisc); - } return (mii_mediachg(mii)); } @@ -582,13 +574,13 @@ ed_pccard_attach(device_t dev) ed_pccard_dl100xx_mii_reset(sc); (void)mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd, ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, - MII_OFFSET_ANY, 0); + MII_OFFSET_ANY, MIIF_FORCEANEG); } else if (sc->chip_type == ED_CHIP_TYPE_AX88190 || sc->chip_type == ED_CHIP_TYPE_AX88790 || sc->chip_type == ED_CHIP_TYPE_TC5299J) { error = mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd, ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, - MII_OFFSET_ANY, 0); + MII_OFFSET_ANY, MIIF_FORCEANEG); if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); goto bad; Modified: stable/8/sys/dev/et/if_et.c ============================================================================== --- stable/8/sys/dev/et/if_et.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/et/if_et.c Sun Sep 11 20:38:33 2011 (r225492) @@ -515,13 +515,10 @@ et_ifmedia_upd_locked(struct ifnet *ifp) { struct et_softc *sc = ifp->if_softc; struct mii_data *mii = device_get_softc(sc->sc_miibus); + struct mii_softc *miisc; - if (mii->mii_instance != 0) { - struct mii_softc *miisc; - - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); mii_mediachg(mii); return (0); Modified: stable/8/sys/dev/fxp/if_fxp.c ============================================================================== --- stable/8/sys/dev/fxp/if_fxp.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/fxp/if_fxp.c Sun Sep 11 20:38:33 2011 (r225492) @@ -2555,14 +2555,12 @@ fxp_ifmedia_upd(struct ifnet *ifp) { struct fxp_softc *sc = ifp->if_softc; struct mii_data *mii; + struct mii_softc *miisc; mii = device_get_softc(sc->miibus); FXP_LOCK(sc); - if (mii->mii_instance) { - struct mii_softc *miisc; - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); mii_mediachg(mii); FXP_UNLOCK(sc); return (0); Modified: stable/8/sys/dev/jme/if_jme.c ============================================================================== --- stable/8/sys/dev/jme/if_jme.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/jme/if_jme.c Sun Sep 11 20:38:33 2011 (r225492) @@ -318,10 +318,8 @@ jme_mediachange(struct ifnet *ifp) sc = ifp->if_softc; JME_LOCK(sc); mii = device_get_softc(sc->jme_miibus); - if (mii->mii_instance != 0) { - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); error = mii_mediachg(mii); JME_UNLOCK(sc); Modified: stable/8/sys/dev/lge/if_lge.c ============================================================================== --- stable/8/sys/dev/lge/if_lge.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/lge/if_lge.c Sun Sep 11 20:38:33 2011 (r225492) @@ -1401,18 +1401,15 @@ lge_ifmedia_upd_locked(ifp) { struct lge_softc *sc; struct mii_data *mii; + struct mii_softc *miisc; sc = ifp->if_softc; LGE_LOCK_ASSERT(sc); mii = device_get_softc(sc->lge_miibus); sc->lge_link = 0; - if (mii->mii_instance) { - struct mii_softc *miisc; - for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL; - miisc = LIST_NEXT(miisc, mii_list)) - mii_phy_reset(miisc); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); mii_mediachg(mii); } Modified: stable/8/sys/dev/mii/acphy.c ============================================================================== --- stable/8/sys/dev/mii/acphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/acphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -138,6 +138,8 @@ acphy_attach(device_t dev) sc->mii_service = acphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + acphy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; @@ -245,7 +247,8 @@ acphy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_10_T; if (diag & AC_DIAG_DUPLEX) - mii->mii_media_active |= IFM_FDX; + mii->mii_media_active |= + IFM_FDX | mii_phy_flowstatus(sc); else mii->mii_media_active |= IFM_HDX; } else Modified: stable/8/sys/dev/mii/amphy.c ============================================================================== --- stable/8/sys/dev/mii/amphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/amphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -115,6 +115,8 @@ amphy_attach(device_t dev) sc->mii_service = amphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) #if 0 @@ -231,6 +233,8 @@ amphy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_10_T|IFM_HDX; else if (par & DSCSR_10HDX) mii->mii_media_active |= IFM_10_T|IFM_HDX; + if ((mii->mii_media_active & IFM_FDX) != 0) + mii->mii_media_active |= mii_phy_flowstatus(sc); } else mii->mii_media_active = ife->ifm_media; } Modified: stable/8/sys/dev/mii/atphy.c ============================================================================== --- stable/8/sys/dev/mii/atphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/atphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -119,6 +119,8 @@ atphy_attach(device_t dev) sc->mii_service = atphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + asc->mii_oui = MII_OUI(ma->mii_id1, ma->mii_id2); asc->mii_model = MII_MODEL(ma->mii_id2); asc->mii_rev = MII_REV(ma->mii_id2); @@ -318,12 +320,9 @@ static void atphy_reset(struct mii_softc *sc) { struct ifmedia_entry *ife = sc->mii_pdata->mii_media.ifm_cur; - struct atphy_softc *asc; uint32_t reg; int i; - asc = (struct atphy_softc *)sc; - /* Take PHY out of power down mode. */ PHY_WRITE(sc, 29, 0x29); PHY_WRITE(sc, 30, 0); Modified: stable/8/sys/dev/mii/axphy.c ============================================================================== --- stable/8/sys/dev/mii/axphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/axphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -103,7 +103,7 @@ axphy_attach(device_t dev) sc->mii_service = axphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOMANPAUSE; mii_phy_reset(sc); @@ -187,7 +187,8 @@ axphy_status(struct mii_softc *sc) else mii->mii_media_active |= IFM_10_T; if (scr & SCR_FDX) - mii->mii_media_active |= IFM_FDX; + mii->mii_media_active |= + IFM_FDX | mii_phy_flowstatus(sc); else mii->mii_media_active |= IFM_HDX; #endif Modified: stable/8/sys/dev/mii/brgphy.c ============================================================================== --- stable/8/sys/dev/mii/brgphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/brgphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -222,9 +222,6 @@ brgphy_attach(device_t dev) /* Handle any special cases based on the PHY ID */ switch (bsc->mii_oui) { - case MII_OUI_BROADCOM: - case MII_OUI_BROADCOM2: - break; case MII_OUI_xxBROADCOM: switch (bsc->mii_model) { case MII_MODEL_xxBROADCOM_BCM5706: @@ -257,11 +254,6 @@ brgphy_attach(device_t dev) break; } break; - case MII_OUI_xxBROADCOM_ALT2: - /* No special handling yet. */ - break; - default: - device_printf(dev, "Unrecognized OUI for PHY!\n"); } ifp = sc->mii_pdata->mii_ifp; @@ -400,8 +392,6 @@ brgphy_service(struct mii_softc *sc, str sc->mii_media_status != mii->mii_media_status || cmd == MII_MEDIACHG) { switch (bsc->mii_oui) { - case MII_OUI_BROADCOM: - break; case MII_OUI_xxBROADCOM: switch (bsc->mii_model) { case MII_MODEL_xxBROADCOM_BCM5400: @@ -419,8 +409,6 @@ brgphy_service(struct mii_softc *sc, str break; } break; - case MII_OUI_xxBROADCOM_ALT1: - break; } } mii_phy_update(sc, cmd); @@ -932,8 +920,6 @@ brgphy_reset(struct mii_softc *sc) /* Handle any PHY specific procedures following the reset. */ switch (bsc->mii_oui) { - case MII_OUI_BROADCOM: - break; case MII_OUI_xxBROADCOM: switch (bsc->mii_model) { case MII_MODEL_xxBROADCOM_BCM5400: @@ -951,9 +937,6 @@ brgphy_reset(struct mii_softc *sc) break; } break; - case MII_OUI_xxBROADCOM_ALT1: - case MII_OUI_xxBROADCOM_ALT2: - break; } ifp = sc->mii_pdata->mii_ifp; Modified: stable/8/sys/dev/mii/ciphy.c ============================================================================== --- stable/8/sys/dev/mii/ciphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/ciphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -122,7 +122,7 @@ ciphy_attach(device_t dev) sc->mii_service = ciphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOMANPAUSE; ciphy_reset(sc); Modified: stable/8/sys/dev/mii/e1000phy.c ============================================================================== --- stable/8/sys/dev/mii/e1000phy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/e1000phy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -91,7 +91,7 @@ DRIVER_MODULE(e1000phy, miibus, e1000phy static int e1000phy_service(struct mii_softc *, struct mii_data *, int); static void e1000phy_status(struct mii_softc *); static void e1000phy_reset(struct mii_softc *); -static int e1000phy_mii_phy_auto(struct e1000phy_softc *, int); +static int e1000phy_mii_phy_auto(struct mii_softc *, int); static const struct mii_phydesc e1000phys[] = { MII_PHY_DESC(MARVELL, E1000), @@ -313,7 +313,6 @@ static int e1000phy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { struct ifmedia_entry *ife = mii->mii_media.ifm_cur; - struct e1000phy_softc *esc = (struct e1000phy_softc *)sc; uint16_t speed, gig; int reg; @@ -329,7 +328,7 @@ e1000phy_service(struct mii_softc *sc, s break; if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) { - e1000phy_mii_phy_auto(esc, ife->ifm_media); + e1000phy_mii_phy_auto(sc, ife->ifm_media); break; } @@ -418,7 +417,7 @@ done: sc->mii_ticks = 0; e1000phy_reset(sc); - e1000phy_mii_phy_auto(esc, ife->ifm_media); + e1000phy_mii_phy_auto(sc, ife->ifm_media); break; } @@ -494,12 +493,10 @@ e1000phy_status(struct mii_softc *sc) } static int -e1000phy_mii_phy_auto(struct e1000phy_softc *esc, int media) +e1000phy_mii_phy_auto(struct mii_softc *sc, int media) { - struct mii_softc *sc; uint16_t reg; - sc = &esc->mii_sc; if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { reg = PHY_READ(sc, E1000_AR); reg &= ~(E1000_AR_PAUSE | E1000_AR_ASM_DIR); Modified: stable/8/sys/dev/mii/exphy.c ============================================================================== --- stable/8/sys/dev/mii/exphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/exphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -147,7 +147,7 @@ exphy_attach(device_t dev) /* * The 3Com PHY can never be isolated. */ - sc->mii_flags |= MIIF_NOISOLATE; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOMANPAUSE; #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) Modified: stable/8/sys/dev/mii/icsphy.c ============================================================================== --- stable/8/sys/dev/mii/icsphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/icsphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -147,7 +147,7 @@ icsphy_attach(device_t dev) sc->mii_service = icsphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOMANPAUSE; ifmedia_add(&mii->mii_media, IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), @@ -240,7 +240,8 @@ icsphy_status(struct mii_softc *sc) else mii->mii_media_active |= IFM_10_T; if (qpr & QPR_FDX) - mii->mii_media_active |= IFM_FDX; + mii->mii_media_active |= + IFM_FDX | mii_phy_flowstatus(sc); else mii->mii_media_active |= IFM_HDX; } else Modified: stable/8/sys/dev/mii/inphy.c ============================================================================== --- stable/8/sys/dev/mii/inphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/inphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -114,7 +114,7 @@ inphy_attach(device_t dev) sc->mii_service = inphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOMANPAUSE; + sc->mii_flags |= MIIF_NOMANPAUSE | MIIF_NOMANPAUSE; ifmedia_add(&mii->mii_media, IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), Modified: stable/8/sys/dev/mii/jmphy.c ============================================================================== --- stable/8/sys/dev/mii/jmphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/jmphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -269,12 +269,9 @@ jmphy_status(struct mii_softc *sc) static void jmphy_reset(struct mii_softc *sc) { - struct jmphy_softc *jsc; uint16_t t2cr, val; int i; - jsc = (struct jmphy_softc *)sc; - /* Disable sleep mode. */ PHY_WRITE(sc, JMPHY_TMCTL, PHY_READ(sc, JMPHY_TMCTL) & ~JMPHY_TMCTL_SLEEP_ENB); Modified: stable/8/sys/dev/mii/lxtphy.c ============================================================================== --- stable/8/sys/dev/mii/lxtphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/lxtphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -106,6 +106,7 @@ DRIVER_MODULE(lxtphy, miibus, lxtphy_dri static int lxtphy_service(struct mii_softc *, struct mii_data *, int); static void lxtphy_status(struct mii_softc *); +static void lxtphy_reset(struct mii_softc *); static void lxtphy_set_tp(struct mii_softc *); static void lxtphy_set_fx(struct mii_softc *); @@ -140,7 +141,9 @@ lxtphy_attach(device_t dev) sc->mii_service = lxtphy_service; sc->mii_pdata = mii; - mii_phy_reset(sc); + sc->mii_flags |= MIIF_NOMANPAUSE; + + lxtphy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); @@ -248,6 +251,15 @@ lxtphy_status(struct mii_softc *sc) } static void +lxtphy_reset(struct mii_softc *sc) +{ + + mii_phy_reset(sc); + PHY_WRITE(sc, MII_LXTPHY_IER, + PHY_READ(sc, MII_LXTPHY_IER) & ~IER_INTEN); +} + +static void lxtphy_set_tp(struct mii_softc *sc) { int cfg; Modified: stable/8/sys/dev/mii/mii.c ============================================================================== --- stable/8/sys/dev/mii/mii.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/mii.c Sun Sep 11 20:38:33 2011 (r225492) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include @@ -87,9 +87,9 @@ static device_method_t miibus_methods[] /* MII interface */ DEVMETHOD(miibus_readreg, miibus_readreg), DEVMETHOD(miibus_writereg, miibus_writereg), - DEVMETHOD(miibus_statchg, miibus_statchg), - DEVMETHOD(miibus_linkchg, miibus_linkchg), - DEVMETHOD(miibus_mediainit, miibus_mediainit), + DEVMETHOD(miibus_statchg, miibus_statchg), + DEVMETHOD(miibus_linkchg, miibus_linkchg), + DEVMETHOD(miibus_mediainit, miibus_mediainit), { 0, 0 } }; @@ -272,7 +272,7 @@ miibus_linkchg(device_t dev) MIIBUS_LINKCHG(parent); mii = device_get_softc(dev); - + if (mii->mii_media_status & IFM_AVALID) { if (mii->mii_media_status & IFM_ACTIVE) link_state = LINK_STATE_UP; @@ -372,7 +372,7 @@ mii_attach(device_t dev, device_t *miibu * has been allocated. */ ma.mii_data = device_get_softc(*miibus); - } + } ma.mii_capmask = capmask; @@ -403,7 +403,7 @@ mii_attach(device_t dev, device_t *miibu * Check to see if there is a PHY at this address. Note, * many braindead PHYs report 0/0 in their ID registers, * so we test for media in the BMSR. - */ + */ bmsr = MIIBUS_READREG(dev, ma.mii_phyno, MII_BMSR); if (bmsr == 0 || bmsr == 0xffff || (bmsr & (BMSR_EXTSTAT | BMSR_MEDIAMASK)) == 0) { @@ -422,7 +422,7 @@ mii_attach(device_t dev, device_t *miibu * Extract the IDs. Braindead PHYs will be handled by * the `ukphy' driver, as we have no ID information to * match on. - */ + */ ma.mii_id1 = MIIBUS_READREG(dev, ma.mii_phyno, MII_PHYIDR1); ma.mii_id2 = MIIBUS_READREG(dev, ma.mii_phyno, MII_PHYIDR2); Modified: stable/8/sys/dev/mii/mii.h ============================================================================== --- stable/8/sys/dev/mii/mii.h Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/mii.h Sun Sep 11 20:38:33 2011 (r225492) @@ -89,15 +89,9 @@ * info available in register 15, but 802.3 section 22.2.4.3 also * states that that all 1000 Mb/s capable PHYs will set this bit to 1. */ -#if 0 -#define BMSR_MEDIAMASK (BMSR_100T4|BMSR_100TXFDX|BMSR_100TXHDX|BMSR_10TFDX| \ - BMSR_10THDX|BMSR_ANEG) -#else -/* NetBSD uses: */ #define BMSR_MEDIAMASK (BMSR_100T4|BMSR_100TXFDX|BMSR_100TXHDX| \ BMSR_10TFDX|BMSR_10THDX|BMSR_100T2FDX|BMSR_100T2HDX) -#endif /* * Convert BMSR media capabilities to ANAR bits for autonegotiation. Modified: stable/8/sys/dev/mii/mii_physubr.c ============================================================================== --- stable/8/sys/dev/mii/mii_physubr.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/mii_physubr.c Sun Sep 11 20:38:33 2011 (r225492) @@ -428,9 +428,11 @@ mii_phy_add_media(struct mii_softc *sc) #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) #define PRINT(s) printf("%s%s", sep, s); sep = ", " - if ((sc->mii_flags & MIIF_NOISOLATE) == 0) + if ((sc->mii_flags & MIIF_NOISOLATE) == 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst), MII_MEDIA_NONE); + PRINT("none"); + } /* * There are different interpretations for the bits in Modified: stable/8/sys/dev/mii/miivar.h ============================================================================== --- stable/8/sys/dev/mii/miivar.h Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/miivar.h Sun Sep 11 20:38:33 2011 (r225492) @@ -38,7 +38,7 @@ #include /* - * Media Independent Interface configuration defintions. + * Media Independent Interface data structure defintions */ struct mii_softc; @@ -65,13 +65,13 @@ struct mii_data { * request is made. */ LIST_HEAD(mii_listhead, mii_softc) mii_phys; - int mii_instance; + u_int mii_instance; /* * PHY driver fills this in with active media status. */ - int mii_media_status; - int mii_media_active; + u_int mii_media_status; + u_int mii_media_active; /* * Calls from MII layer into network interface driver. @@ -105,19 +105,19 @@ struct mii_softc { LIST_ENTRY(mii_softc) mii_list; /* entry on parent's PHY list */ - int mii_phy; /* our MII address */ - int mii_inst; /* instance for ifmedia */ + u_int mii_phy; /* our MII address */ + u_int mii_inst; /* instance for ifmedia */ mii_downcall_t mii_service; /* our downcall */ struct mii_data *mii_pdata; /* pointer to parent's mii_data */ - int mii_flags; /* misc. flags; see below */ - int mii_capabilities; /* capabilities from BMSR */ - int mii_extcapabilities; /* extended capabilities */ - int mii_ticks; /* MII_TICK counter */ - int mii_anegticks; /* ticks before retrying aneg */ - int mii_media_active; /* last active media */ - int mii_media_status; /* last active status */ + u_int mii_flags; /* misc. flags; see below */ + u_int mii_capabilities; /* capabilities from BMSR */ + u_int mii_extcapabilities; /* extended capabilities */ + u_int mii_ticks; /* MII_TICK counter */ + u_int mii_anegticks; /* ticks before retrying aneg */ + u_int mii_media_active; /* last active media */ + u_int mii_media_status; /* last active status */ }; typedef struct mii_softc mii_softc_t; @@ -161,10 +161,11 @@ typedef struct mii_softc mii_softc_t; */ struct mii_attach_args { struct mii_data *mii_data; /* pointer to parent data */ - int mii_phyno; /* MII address */ - int mii_id1; /* PHY ID register 1 */ - int mii_id2; /* PHY ID register 2 */ - int mii_capmask; /* capability mask from BMSR */ + u_int mii_phyno; /* MII address */ + u_int mii_offset; /* first PHY, second PHY, etc. */ + uint32_t mii_id1; /* PHY ID register 1 */ + uint32_t mii_id2; /* PHY ID register 2 */ + u_int mii_capmask; /* capability mask for BMSR */ }; typedef struct mii_attach_args mii_attach_args_t; @@ -172,8 +173,8 @@ typedef struct mii_attach_args mii_attac * Used to match a PHY. */ struct mii_phydesc { - u_int32_t mpd_oui; /* the PHY's OUI */ - u_int32_t mpd_model; /* the PHY's model */ + uint32_t mpd_oui; /* the PHY's OUI */ + uint32_t mpd_model; /* the PHY's model */ const char *mpd_name; /* the PHY's name */ }; #define MII_PHY_DESC(a, b) { MII_OUI_ ## a, MII_MODEL_ ## a ## _ ## b, \ @@ -184,9 +185,9 @@ struct mii_phydesc { * An array of these structures map MII media types to BMCR/ANAR settings. */ struct mii_media { - int mm_bmcr; /* BMCR settings for this media */ - int mm_anar; /* ANAR settings for this media */ - int mm_gtcr; /* 100base-T2 or 1000base-T CR */ + u_int mm_bmcr; /* BMCR settings for this media */ + u_int mm_anar; /* ANAR settings for this media */ + u_int mm_gtcr; /* 100base-T2 or 1000base-T CR */ }; #define MII_MEDIA_NONE 0 @@ -219,7 +220,7 @@ enum miibus_device_ivars { #define MIIBUS_ACCESSOR(var, ivar, type) \ __BUS_ACCESSOR(miibus, var, MIIBUS, ivar, type) -MIIBUS_ACCESSOR(flags, FLAGS, int) +MIIBUS_ACCESSOR(flags, FLAGS, u_int) extern devclass_t miibus_devclass; extern driver_t miibus_driver; Modified: stable/8/sys/dev/mii/mlphy.c ============================================================================== --- stable/8/sys/dev/mii/mlphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/mlphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -154,6 +154,8 @@ mlphy_attach(dev) sc->mii_service = mlphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), Modified: stable/8/sys/dev/mii/nsphy.c ============================================================================== --- stable/8/sys/dev/mii/nsphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/nsphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -139,6 +139,8 @@ nsphy_attach(device_t dev) sc->mii_service = nsphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + nic = device_get_name(device_get_parent(sc->mii_dev)); /* * Am79C971 wedge when isolating all of their external PHYs. @@ -296,6 +298,9 @@ nsphy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_10_T|IFM_HDX; else mii->mii_media_active |= IFM_NONE; + if ((mii->mii_media_active & IFM_FDX) != 0) + mii->mii_media_active |= + mii_phy_flowstatus(sc); return; } Modified: stable/8/sys/dev/mii/nsphyter.c ============================================================================== --- stable/8/sys/dev/mii/nsphyter.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/nsphyter.c Sun Sep 11 20:38:33 2011 (r225492) @@ -110,7 +110,7 @@ static int nsphyter_service(struct mii_s static void nsphyter_status(struct mii_softc *); static void nsphyter_reset(struct mii_softc *); -static const struct mii_phydesc nsphys[] = { +static const struct mii_phydesc nsphyters[] = { MII_PHY_DESC(NATSEMI, DP83815), MII_PHY_DESC(NATSEMI, DP83843), MII_PHY_DESC(NATSEMI, DP83847), @@ -121,7 +121,7 @@ static int nsphyter_probe(device_t dev) { - return (mii_phy_dev_probe(dev, nsphys, BUS_PROBE_DEFAULT)); + return (mii_phy_dev_probe(dev, nsphyters, BUS_PROBE_DEFAULT)); } static int Modified: stable/8/sys/dev/mii/pnaphy.c ============================================================================== --- stable/8/sys/dev/mii/pnaphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/pnaphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -115,7 +115,8 @@ pnaphy_attach(device_t dev) sc->mii_service = pnaphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_IS_HPNA; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_IS_HPNA | + MIIF_NOMANPAUSE; mii_phy_reset(sc); Modified: stable/8/sys/dev/mii/qsphy.c ============================================================================== --- stable/8/sys/dev/mii/qsphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/qsphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -139,6 +139,8 @@ qsphy_attach(device_t dev) sc->mii_service = qsphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + qsphy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; @@ -238,6 +240,8 @@ qsphy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_NONE; break; } + if ((mii->mii_media_active & IFM_FDX) != 0) + mii->mii_media_active |= mii_phy_flowstatus(sc); } static void Modified: stable/8/sys/dev/mii/rdcphy.c ============================================================================== --- stable/8/sys/dev/mii/rdcphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/rdcphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -115,6 +115,8 @@ rdcphy_attach(device_t dev) sc->mii_service = rdcphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + rsc->mii_model = MII_MODEL(ma->mii_id2); if (bootverbose) device_printf(dev, "OUI 0x%06x, model 0x%04x, rev. %d\n", Modified: stable/8/sys/dev/mii/rlphy.c ============================================================================== --- stable/8/sys/dev/mii/rlphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/rlphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -150,7 +150,7 @@ rlphy_attach(device_t dev) /* * The RealTek PHY can never be isolated. */ - sc->mii_flags |= MIIF_NOISOLATE; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOMANPAUSE; #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) @@ -259,6 +259,9 @@ rlphy_status(struct mii_softc *phy) mii->mii_media_active |= IFM_10_T|IFM_HDX; else mii->mii_media_active |= IFM_NONE; + if ((mii->mii_media_active & IFM_FDX) != 0) + mii->mii_media_active |= + mii_phy_flowstatus(phy); return; } /* @@ -279,10 +282,10 @@ rlphy_status(struct mii_softc *phy) * To determine the link speed, we have to do one * of two things: * - * - If this is a standalone RealTek RTL8201(L) PHY, - * we can determine the link speed by testing bit 0 - * in the magic, vendor-specific register at offset - * 0x19. + * - If this is a standalone RealTek RTL8201(L) or + * workalike PHY, we can determine the link speed by + * testing bit 0 in the magic, vendor-specific register + * at offset 0x19. * * - If this is a RealTek MAC with integrated PHY, we * can test the 'SPEED10' bit of the MAC's media status Modified: stable/8/sys/dev/mii/rlswitch.c ============================================================================== --- stable/8/sys/dev/mii/rlswitch.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/rlswitch.c Sun Sep 11 20:38:33 2011 (r225492) @@ -129,7 +129,7 @@ rlswitch_attach(device_t dev) /* * We handle all pseudo PHYs in a single instance. */ - sc->mii_flags |= MIIF_NOISOLATE; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOMANPAUSE; #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) @@ -390,7 +390,8 @@ rlswitch_status(struct mii_softc *phy) mii->mii_media_status = IFM_AVALID; mii->mii_media_active = IFM_ETHER; mii->mii_media_status |= IFM_ACTIVE; - mii->mii_media_active |= IFM_100_TX|IFM_FDX; + mii->mii_media_active |= + IFM_100_TX | IFM_FDX | mii_phy_flowstatus(phy); } #ifdef RL_DEBUG Modified: stable/8/sys/dev/mii/ruephy.c ============================================================================== --- stable/8/sys/dev/mii/ruephy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/ruephy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -120,7 +120,7 @@ ruephy_attach(device_t dev) /* * Apparently, we can neither isolate nor do loopback on this PHY. */ - sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_NOMANPAUSE; ruephy_reset(sc); @@ -244,7 +244,8 @@ ruephy_status(struct mii_softc *phy) mii->mii_media_active |= IFM_10_T; if (msr & RUEPHY_MSR_DUPLEX) - mii->mii_media_active |= IFM_FDX; + mii->mii_media_active |= + IFM_FDX | mii_phy_flowstatus(phy); else mii->mii_media_active |= IFM_HDX; } else Modified: stable/8/sys/dev/mii/smcphy.c ============================================================================== --- stable/8/sys/dev/mii/smcphy.c Sun Sep 11 20:37:01 2011 (r225491) +++ stable/8/sys/dev/mii/smcphy.c Sun Sep 11 20:38:33 2011 (r225492) @@ -53,7 +53,7 @@ static int smcphy_probe(device_t); static int smcphy_attach(device_t); static int smcphy_service(struct mii_softc *, struct mii_data *, int); -static int smcphy_reset(struct mii_softc *); +static void smcphy_reset(struct mii_softc *); static void smcphy_auto(struct mii_softc *, int); static device_method_t smcphy_methods[] = { @@ -107,11 +107,9 @@ smcphy_attach(device_t dev) sc->mii_service = smcphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_NOMANPAUSE; - if (smcphy_reset(sc) != 0) { - device_printf(dev, "reset failed\n"); - } + smcphy_reset(sc); /* Mask interrupts, we poll instead. */ PHY_WRITE(sc, 0x1e, 0xffc0); @@ -184,9 +182,7 @@ smcphy_service(struct mii_softc *sc, str } sc->mii_ticks = 0; - if (smcphy_reset(sc) != 0) { - device_printf(sc->mii_dev, "reset failed\n"); - } + smcphy_reset(sc); smcphy_auto(sc, ife->ifm_media); break; } @@ -199,7 +195,7 @@ smcphy_service(struct mii_softc *sc, str return (0); } -static int +static void smcphy_reset(struct mii_softc *sc) { u_int bmcr; @@ -214,12 +210,13 @@ smcphy_reset(struct mii_softc *sc) break; } - if (bmcr & BMCR_RESET) { - return (EIO); - } + if (bmcr & BMCR_RESET) + device_printf(sc->mii_dev, "reset failed\n"); PHY_WRITE(sc, MII_BMCR, 0x3000); - return (0); + + /* Mask interrupts, we poll instead. */ + PHY_WRITE(sc, 0x1e, 0xffc0); } static void Modified: stable/8/sys/dev/mii/tdkphy.c ============================================================================== --- stable/8/sys/dev/mii/tdkphy.c Sun Sep 11 20:37:01 2011 (r225491) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Sun Sep 11 21:38:33 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8972C106564A; Sun, 11 Sep 2011 21:38:33 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 77BBD8FC15; Sun, 11 Sep 2011 21:38:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8BLcXAL096999; Sun, 11 Sep 2011 21:38:33 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8BLcX2a096995; Sun, 11 Sep 2011 21:38:33 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201109112138.p8BLcX2a096995@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 11 Sep 2011 21:38: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: r225494 - in stable/8/tools/regression/bin/sh: builtins parser X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Sep 2011 21:38:33 -0000 Author: jilles Date: Sun Sep 11 21:38:33 2011 New Revision: 225494 URL: http://svn.freebsd.org/changeset/base/225494 Log: MFC r223007,r223011,r223546,r224104: sh: New testcases that already work in stable/8. Added: stable/8/tools/regression/bin/sh/builtins/case10.0 - copied unchanged from r223546, head/tools/regression/bin/sh/builtins/case10.0 stable/8/tools/regression/bin/sh/builtins/case6.0 - copied unchanged from r223007, head/tools/regression/bin/sh/builtins/case6.0 stable/8/tools/regression/bin/sh/builtins/case7.0 - copied unchanged from r223011, head/tools/regression/bin/sh/builtins/case7.0 stable/8/tools/regression/bin/sh/parser/alias6.0 - copied unchanged from r224104, head/tools/regression/bin/sh/parser/alias6.0 Modified: Directory Properties: stable/8/tools/regression/bin/sh/ (props changed) Copied: stable/8/tools/regression/bin/sh/builtins/case10.0 (from r223546, head/tools/regression/bin/sh/builtins/case10.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/case10.0 Sun Sep 11 21:38:33 2011 (r225494, copy of r223546, head/tools/regression/bin/sh/builtins/case10.0) @@ -0,0 +1,16 @@ +# $FreeBSD$ + +case ! in +[\!!]) ;; +*) echo Failed at $LINENO ;; +esac + +case ! in +['!'!]) ;; +*) echo Failed at $LINENO ;; +esac + +case ! in +["!"!]) ;; +*) echo Failed at $LINENO ;; +esac Copied: stable/8/tools/regression/bin/sh/builtins/case6.0 (from r223007, head/tools/regression/bin/sh/builtins/case6.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/case6.0 Sun Sep 11 21:38:33 2011 (r225494, copy of r223007, head/tools/regression/bin/sh/builtins/case6.0) @@ -0,0 +1,52 @@ +# $FreeBSD$ + +unset LC_ALL +LC_CTYPE=de_DE.ISO8859-1 +export LC_CTYPE + +c1=e +# o umlaut +c2=$(printf '\366') +# non-break space +c3=$(printf '\240') +c4=$(printf '\240') +# $c2$c3$c4 form one utf-8 character + +ok=0 +case $c1$c2$c3$c4 in +*) ok=1 ;; +esac +if [ $ok = 0 ]; then + echo wrong at $LINENO + exit 3 +fi + +case $c1$c2$c3$c4 in +$c1$c2$c3$c4) ;; +*) echo wrong at $LINENO ;; +esac + +case $c1$c2$c3$c4 in +"$c1$c2$c3$c4") ;; +*) echo wrong at $LINENO ;; +esac + +case $c1$c2$c3$c4 in +????) ;; +*) echo wrong at $LINENO ;; +esac + +case $c1$c2$c3$c4 in +[!$c2][!b][!c][!d]) ;; +*) echo wrong at $LINENO ;; +esac + +case $c1$c2$c3$c4 in +[$c1][$c2][$c3][$c4]) ;; +*) echo wrong at $LINENO ;; +esac + +case $c1$c2$c3$c4 in +["$c1"]["$c2"]["$c3"]["$c4"]) ;; +*) echo wrong at $LINENO ;; +esac Copied: stable/8/tools/regression/bin/sh/builtins/case7.0 (from r223011, head/tools/regression/bin/sh/builtins/case7.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/case7.0 Sun Sep 11 21:38:33 2011 (r225494, copy of r223011, head/tools/regression/bin/sh/builtins/case7.0) @@ -0,0 +1,24 @@ +# $FreeBSD$ + +# Character ranges in a locale other than the POSIX locale, not specified +# by POSIX. + +unset LC_ALL +LC_CTYPE=de_DE.ISO8859-1 +export LC_CTYPE +LC_COLLATE=de_DE.ISO8859-1 +export LC_COLLATE + +c1=e +# o umlaut +c2=$(printf '\366') + +case $c1$c2 in +[a-z][a-z]) ;; +*) echo wrong at $LINENO ;; +esac + +case $c1$c2 in +[a-f][n-p]) ;; +*) echo wrong at $LINENO ;; +esac Copied: stable/8/tools/regression/bin/sh/parser/alias6.0 (from r224104, head/tools/regression/bin/sh/parser/alias6.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/parser/alias6.0 Sun Sep 11 21:38:33 2011 (r225494, copy of r224104, head/tools/regression/bin/sh/parser/alias6.0) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +alias alias0='| cat >/dev/null' + +eval '{ echo bad; } alias0' +eval '(echo bad)alias0' From owner-svn-src-stable@FreeBSD.ORG Sun Sep 11 23:37:40 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87AC8106566B; Sun, 11 Sep 2011 23:37:40 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D4A58FC08; Sun, 11 Sep 2011 23:37:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8BNbeJ8000802; Sun, 11 Sep 2011 23:37:40 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8BNbepT000800; Sun, 11 Sep 2011 23:37:40 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201109112337.p8BNbepT000800@svn.freebsd.org> From: Andrew Thompson Date: Sun, 11 Sep 2011 23:37: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: r225495 - stable/8/sys/net X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Sep 2011 23:37:40 -0000 Author: thompsa Date: Sun Sep 11 23:37:40 2011 New Revision: 225495 URL: http://svn.freebsd.org/changeset/base/225495 Log: MFC r225380 On the first loop for generating a bridge MAC address use the local hostid, this gives a good chance of keeping the same address over reboots. This is intended to help IPV6 and similar which generate their addresses from the mac. PR: kern/160300 Submitted by: mdodd Modified: stable/8/sys/net/if_bridge.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/net/if_bridge.c ============================================================================== --- stable/8/sys/net/if_bridge.c Sun Sep 11 21:38:33 2011 (r225494) +++ stable/8/sys/net/if_bridge.c Sun Sep 11 23:37:40 2011 (r225495) @@ -85,6 +85,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include /* for net/if.h */ #include @@ -560,7 +561,8 @@ bridge_clone_create(struct if_clone *ifc { struct bridge_softc *sc, *sc2; struct ifnet *bifp, *ifp; - int retry; + int fb, retry; + unsigned long hostid; sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO); ifp = sc->sc_ifp = if_alloc(IFT_ETHER); @@ -593,17 +595,30 @@ bridge_clone_create(struct if_clone *ifc IFQ_SET_READY(&ifp->if_snd); /* - * Generate a random ethernet address with a locally administered - * address. + * Generate an ethernet address with a locally administered address. * * Since we are using random ethernet addresses for the bridge, it is * possible that we might have address collisions, so make sure that * this hardware address isn't already in use on another bridge. + * The first try uses the hostid and falls back to arc4rand(). */ + fb = 0; + getcredhostid(curthread->td_ucred, &hostid); for (retry = 1; retry != 0;) { - arc4rand(sc->sc_defaddr, ETHER_ADDR_LEN, 1); - sc->sc_defaddr[0] &= ~1; /* clear multicast bit */ - sc->sc_defaddr[0] |= 2; /* set the LAA bit */ + if (fb || hostid == 0) { + arc4rand(sc->sc_defaddr, ETHER_ADDR_LEN, 1); + sc->sc_defaddr[0] &= ~1;/* clear multicast bit */ + sc->sc_defaddr[0] |= 2; /* set the LAA bit */ + } else { + sc->sc_defaddr[0] = 0x2; + sc->sc_defaddr[1] = (hostid >> 24) & 0xff; + sc->sc_defaddr[2] = (hostid >> 16) & 0xff; + sc->sc_defaddr[3] = (hostid >> 8 ) & 0xff; + sc->sc_defaddr[4] = hostid & 0xff; + sc->sc_defaddr[5] = ifp->if_dunit & 0xff; + } + + fb = 1; retry = 0; mtx_lock(&bridge_list_mtx); LIST_FOREACH(sc2, &bridge_list, sc_list) { From owner-svn-src-stable@FreeBSD.ORG Mon Sep 12 06:41:14 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A2E5106566B; Mon, 12 Sep 2011 06:41:14 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E406F8FC08; Mon, 12 Sep 2011 06:41:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8C6fDMm014121; Mon, 12 Sep 2011 06:41:13 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8C6fDrn014118; Mon, 12 Sep 2011 06:41:13 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201109120641.p8C6fDrn014118@svn.freebsd.org> From: Xin LI Date: Mon, 12 Sep 2011 06:41: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: r225504 - stable/8/usr.sbin/syslogd X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2011 06:41:14 -0000 Author: delphij Date: Mon Sep 12 06:41:13 2011 New Revision: 225504 URL: http://svn.freebsd.org/changeset/base/225504 Log: MFC r224002: Add a new option, -N to disable the default and recommended syslogd(8) behavior, which binds to the well known UDP port. This option implies -s. Modified: stable/8/usr.sbin/syslogd/syslogd.8 stable/8/usr.sbin/syslogd/syslogd.c Directory Properties: stable/8/usr.sbin/syslogd/ (props changed) Modified: stable/8/usr.sbin/syslogd/syslogd.8 ============================================================================== --- stable/8/usr.sbin/syslogd/syslogd.8 Mon Sep 12 04:56:48 2011 (r225503) +++ stable/8/usr.sbin/syslogd/syslogd.8 Mon Sep 12 06:41:13 2011 (r225504) @@ -36,7 +36,7 @@ .Nd log systems messages .Sh SYNOPSIS .Nm -.Op Fl 468ACcdknosuv +.Op Fl 468ACcdkNnosuv .Op Fl a Ar allowed_peer .Op Fl b Ar bind_address .Op Fl f Ar config_file @@ -208,6 +208,13 @@ facility is reserved for messages read d Select the number of minutes between .Dq mark messages; the default is 20 minutes. +.It Fl N +Disable binding on UDP sockets. RFC 3164 recommends that outgoing +syslogd messages should originate from the privileged port, this +option +.Em disables +the recommended behavior. This option inherits +.Fl s . .It Fl n Disable dns query for every request. .It Fl o Modified: stable/8/usr.sbin/syslogd/syslogd.c ============================================================================== --- stable/8/usr.sbin/syslogd/syslogd.c Mon Sep 12 04:56:48 2011 (r225503) +++ stable/8/usr.sbin/syslogd/syslogd.c Mon Sep 12 06:41:13 2011 (r225504) @@ -278,6 +278,7 @@ static int fklog = -1; /* /dev/klog */ static int Initialized; /* set when we have initialized ourselves */ static int MarkInterval = 20 * 60; /* interval between marks in seconds */ static int MarkSeq; /* mark sequence number */ +static int NoBind; /* don't bind() as suggested by RFC 3164 */ static int SecureMode; /* when true, receive only unix domain socks */ #ifdef INET6 static int family = PF_UNSPEC; /* protocol family (IPv4, IPv6 or both) */ @@ -357,7 +358,7 @@ main(int argc, char *argv[]) dprintf("madvise() failed: %s\n", strerror(errno)); bindhostname = NULL; - while ((ch = getopt(argc, argv, "468Aa:b:cCdf:kl:m:nop:P:sS:Tuv")) + while ((ch = getopt(argc, argv, "468Aa:b:cCdf:kl:m:nNop:P:sS:Tuv")) != -1) switch (ch) { case '4': @@ -436,6 +437,10 @@ main(int argc, char *argv[]) case 'm': /* mark interval */ MarkInterval = atoi(optarg) * 60; break; + case 'N': + NoBind = 1; + SecureMode = 1; + break; case 'n': resolve = 0; break; @@ -2662,13 +2667,24 @@ socksetup(int af, const char *bindhostna close(*s); continue; } - if (bind(*s, r->ai_addr, r->ai_addrlen) < 0) { - close(*s); - logerror("bind"); - continue; - } + /* + * RFC 3164 recommends that client side message + * should come from the privileged syslogd port. + * + * If the system administrator choose not to obey + * this, we can skip the bind() step so that the + * system will choose a port for us. + */ + if (!NoBind) { + if (bind(*s, r->ai_addr, r->ai_addrlen) < 0) { + close(*s); + logerror("bind"); + continue; + } - double_rbuf(*s); + if (!SecureMode) + double_rbuf(*s); + } (*socks)++; s++; From owner-svn-src-stable@FreeBSD.ORG Mon Sep 12 11:18:55 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DAEC1065676; Mon, 12 Sep 2011 11:18: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 3BDDA8FC12; Mon, 12 Sep 2011 11:18:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8CBItvu023906; Mon, 12 Sep 2011 11:18:55 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8CBIteW023904; Mon, 12 Sep 2011 11:18:55 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201109121118.p8CBIteW023904@svn.freebsd.org> From: Attilio Rao Date: Mon, 12 Sep 2011 11:18: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: r225507 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2011 11:18:55 -0000 Author: attilio Date: Mon Sep 12 11:18:54 2011 New Revision: 225507 URL: http://svn.freebsd.org/changeset/base/225507 Log: MFC r225372: Disable the watchdog while a KDB backend is running and kick it again just before to return KDB context. Sponsored by: Sandvine Incorporated Modified: stable/8/sys/kern/subr_kdb.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/subr_kdb.c ============================================================================== --- stable/8/sys/kern/subr_kdb.c Mon Sep 12 10:07:21 2011 (r225506) +++ stable/8/sys/kern/subr_kdb.c Mon Sep 12 11:18:54 2011 (r225507) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include "opt_kdb.h" #include "opt_stack.h" +#include "opt_watchdog.h" #include #include @@ -40,6 +41,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef SW_WATCHDOG +#include +#endif #include #include @@ -513,6 +517,9 @@ int kdb_trap(int type, int code, struct trapframe *tf) { struct kdb_dbbe *be; +#ifdef SW_WATCHDOG + u_int wdoglvt; +#endif register_t intr; #ifdef SMP int did_stop_cpus; @@ -529,6 +536,10 @@ kdb_trap(int type, int code, struct trap intr = intr_disable(); +#ifdef SW_WATCHDOG + wdoglvt = wdog_kern_last_timeout(); + wdog_kern_pat(WD_TO_NEVER); +#endif #ifdef SMP if ((did_stop_cpus = kdb_stop_cpus) != 0) stop_cpus_hard(PCPU_GET(other_cpus)); @@ -560,6 +571,9 @@ kdb_trap(int type, int code, struct trap if (did_stop_cpus) restart_cpus(stopped_cpus); #endif +#ifdef SW_WATCHDOG + wdog_kern_pat(wdoglvt); +#endif intr_restore(intr); From owner-svn-src-stable@FreeBSD.ORG Tue Sep 13 08:49:53 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2459F106566B; Tue, 13 Sep 2011 08:49:53 +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 EE51B8FC0A; Tue, 13 Sep 2011 08:49:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8D8nqUj072957; Tue, 13 Sep 2011 08:49:52 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8D8nqoN072954; Tue, 13 Sep 2011 08:49:52 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201109130849.p8D8nqoN072954@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 13 Sep 2011 08:49:52 +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: r225526 - stable/8/sbin/mdmfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2011 08:49:53 -0000 Author: kib Date: Tue Sep 13 08:49:52 2011 New Revision: 225526 URL: http://svn.freebsd.org/changeset/base/225526 Log: MFC r225416: Add -t switch for mdmfs to enable TRIM on the configured filesystem. While there, fix minor style issues. Modified: stable/8/sbin/mdmfs/mdmfs.8 stable/8/sbin/mdmfs/mdmfs.c Directory Properties: stable/8/sbin/mdmfs/ (props changed) Modified: stable/8/sbin/mdmfs/mdmfs.8 ============================================================================== --- stable/8/sbin/mdmfs/mdmfs.8 Tue Sep 13 05:52:34 2011 (r225525) +++ stable/8/sbin/mdmfs/mdmfs.8 Tue Sep 13 08:49:52 2011 (r225526) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2007 +.Dd September 4, 2011 .Dt MDMFS 8 .Os .Sh NAME @@ -36,7 +36,7 @@ driver .Sh SYNOPSIS .Nm -.Op Fl DLlMNPSUX +.Op Fl DLlMNPStUX .Op Fl a Ar maxcontig .Op Fl b Ar block-size .Op Fl c Ar blocks-per-cylinder-group @@ -224,6 +224,13 @@ and the optional .Xr malloc 9 backed disks .Pq Dv MD_MALLOC . +.It Fl t +Turn on the TRIM enable flag for +.Xr newfs 8 . +The +.Xr md 4 +device supports the BIO_DELETE command, enabling the TRIM on created +filesystem allows return of freed memory to the system pool. .It Fl U Enable soft-updates on the file system. This is the default, and is accepted only Modified: stable/8/sbin/mdmfs/mdmfs.c ============================================================================== --- stable/8/sbin/mdmfs/mdmfs.c Tue Sep 13 05:52:34 2011 (r225525) +++ stable/8/sbin/mdmfs/mdmfs.c Tue Sep 13 08:49:52 2011 (r225526) @@ -127,7 +127,7 @@ main(int argc, char **argv) } while ((ch = getopt(argc, argv, - "a:b:Cc:Dd:E:e:F:f:hi:LlMm:NnO:o:Pp:Ss:t:Uv:w:X")) != -1) + "a:b:Cc:Dd:E:e:F:f:hi:LlMm:NnO:o:Pp:Ss:tUv:w:X")) != -1) switch (ch) { case 'a': argappend(&newfs_arg, "-a %s", optarg); @@ -212,6 +212,9 @@ main(int argc, char **argv) case 's': argappend(&mdconfig_arg, "-s %s", optarg); break; + case 't': + argappend(&newfs_arg, "-t"); + break; case 'U': softdep = true; break; @@ -282,7 +285,7 @@ argappend(char **dstp, const char *fmt, { char *old, *new; va_list ap; - + old = *dstp; assert(old != NULL); @@ -417,7 +420,7 @@ do_mdconfig_detach(void) rv = run(NULL, "%s -d -u %s%d", path_mdconfig, mdname, unit); if (rv && debug) /* This is allowed to fail. */ warnx("mdconfig (detach) exited with error code %d (ignored)", - rv); + rv); } /* @@ -656,7 +659,7 @@ usage(void) { fprintf(stderr, -"usage: %s [-DLlMNnPSUX] [-a maxcontig] [-b block-size]\n" +"usage: %s [-DLlMNnPStUX] [-a maxcontig] [-b block-size]\n" "\t[-c blocks-per-cylinder-group][-d max-extent-size] [-E path-mdconfig]\n" "\t[-e maxbpg] [-F file] [-f frag-size] [-i bytes] [-m percent-free]\n" "\t[-O optimization] [-o mount-options]\n" From owner-svn-src-stable@FreeBSD.ORG Wed Sep 14 10:27:23 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4D6E1065675; Wed, 14 Sep 2011 10:27:23 +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 942378FC0A; Wed, 14 Sep 2011 10:27:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8EARN28021575; Wed, 14 Sep 2011 10:27:23 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8EARNW0021572; Wed, 14 Sep 2011 10:27:23 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201109141027.p8EARNW0021572@svn.freebsd.org> From: Attilio Rao Date: Wed, 14 Sep 2011 10:27: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: r225551 - stable/8/sys/dev/aac X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2011 10:27:23 -0000 Author: attilio Date: Wed Sep 14 10:27:23 2011 New Revision: 225551 URL: http://svn.freebsd.org/changeset/base/225551 Log: MFC r222951: Fix races in handling flags at detach time for FIBs. 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) Modified: stable/8/sys/dev/aac/aac.c ============================================================================== --- stable/8/sys/dev/aac/aac.c Wed Sep 14 08:27:19 2011 (r225550) +++ stable/8/sys/dev/aac/aac.c Wed Sep 14 10:27:23 2011 (r225551) @@ -661,6 +661,16 @@ aac_detach(device_t dev) callout_drain(&sc->aac_daemontime); + mtx_lock(&sc->aac_io_lock); + while (sc->aifflags & AAC_AIFFLAGS_RUNNING) { + sc->aifflags |= AAC_AIFFLAGS_EXIT; + wakeup(sc->aifthread); + msleep(sc->aac_dev, &sc->aac_io_lock, PUSER, "aacdch", 0); + } + mtx_unlock(&sc->aac_io_lock); + KASSERT((sc->aifflags & AAC_AIFFLAGS_RUNNING) == 0, + ("%s: invalid detach state", __func__)); + /* Remove the child containers */ while ((co = TAILQ_FIRST(&sc->aac_container_tqh)) != NULL) { error = device_delete_child(dev, co->co_disk); @@ -679,15 +689,6 @@ aac_detach(device_t dev) free(sim, M_AACBUF); } - if (sc->aifflags & AAC_AIFFLAGS_RUNNING) { - sc->aifflags |= AAC_AIFFLAGS_EXIT; - wakeup(sc->aifthread); - tsleep(sc->aac_dev, PUSER | PCATCH, "aacdch", 30 * hz); - } - - if (sc->aifflags & AAC_AIFFLAGS_RUNNING) - panic("Cannot shutdown AIF thread"); - if ((error = aac_shutdown(dev))) return(error); @@ -1020,7 +1021,7 @@ aac_command_thread(struct aac_softc *sc) /* * First see if any FIBs need to be allocated. This needs * to be called without the driver lock because contigmalloc - * will grab Giant, and would result in an LOR. + * can sleep. */ if ((sc->aifflags & AAC_AIFFLAGS_ALLOCFIBS) != 0) { mtx_unlock(&sc->aac_io_lock); @@ -1372,7 +1373,9 @@ aac_alloc_command(struct aac_softc *sc, if ((cm = aac_dequeue_free(sc)) == NULL) { if (sc->total_fibs < sc->aac_max_fibs) { + mtx_lock(&sc->aac_io_lock); sc->aifflags |= AAC_AIFFLAGS_ALLOCFIBS; + mtx_unlock(&sc->aac_io_lock); wakeup(sc->aifthread); } return (EBUSY); Modified: stable/8/sys/dev/aac/aacvar.h ============================================================================== --- stable/8/sys/dev/aac/aacvar.h Wed Sep 14 08:27:19 2011 (r225550) +++ stable/8/sys/dev/aac/aacvar.h Wed Sep 14 10:27:23 2011 (r225551) @@ -386,13 +386,12 @@ struct aac_softc struct proc *aifthread; int aifflags; #define AAC_AIFFLAGS_RUNNING (1 << 0) -#define AAC_AIFFLAGS_AIF (1 << 1) +#define AAC_AIFFLAGS_UNUSED0 (1 << 1) #define AAC_AIFFLAGS_EXIT (1 << 2) #define AAC_AIFFLAGS_EXITED (1 << 3) -#define AAC_AIFFLAGS_PRINTF (1 << 4) +#define AAC_AIFFLAGS_UNUSED1 (1 << 4) #define AAC_AIFFLAGS_ALLOCFIBS (1 << 5) -#define AAC_AIFFLAGS_PENDING (AAC_AIFFLAGS_AIF | AAC_AIFFLAGS_PRINTF | \ - AAC_AIFFLAGS_ALLOCFIBS) +#define AAC_AIFFLAGS_PENDING AAC_AIFFLAGS_ALLOCFIBS u_int32_t flags; #define AAC_FLAGS_PERC2QC (1 << 0) #define AAC_FLAGS_ENABLE_CAM (1 << 1) /* No SCSI passthrough */ From owner-svn-src-stable@FreeBSD.ORG Thu Sep 15 04:32:14 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C31C106564A; Thu, 15 Sep 2011 04:32:14 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 615AB8FC12; Thu, 15 Sep 2011 04:32:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8F4WEwf056643; Thu, 15 Sep 2011 04:32:14 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8F4WENP056641; Thu, 15 Sep 2011 04:32:14 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201109150432.p8F4WENP056641@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 15 Sep 2011 04:32: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: r225565 - stable/8/sbin/geom/class/part X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2011 04:32:14 -0000 Author: ae Date: Thu Sep 15 04:32:14 2011 New Revision: 225565 URL: http://svn.freebsd.org/changeset/base/225565 Log: MFC r225445: Don't use the whole free space when resizing partition to a larger size on a disk with non zero stripesize (e.g. disks with 4k sector size)[1]. Also do not use automatic alignment when size is exactly specified, but an alignment is not. Use automatic alignment only for case when user omits both "-s" and "-a" options. Reported by: Mikael Fridh [1] Modified: stable/8/sbin/geom/class/part/geom_part.c Directory Properties: stable/8/sbin/geom/class/part/ (props changed) Modified: stable/8/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/8/sbin/geom/class/part/geom_part.c Thu Sep 15 04:16:03 2011 (r225564) +++ stable/8/sbin/geom/class/part/geom_part.c Thu Sep 15 04:32:14 2011 (r225565) @@ -310,7 +310,7 @@ gpart_autofill_resize(struct gctl_req *r off_t lba, new_lba, alignment, offset; const char *s; char *val; - int error, idx; + int error, idx, has_alignment; s = gctl_get_ascii(req, index_param); idx = strtol(s, &val, 10); @@ -337,8 +337,9 @@ gpart_autofill_resize(struct gctl_req *r errx(EXIT_FAILURE, "Provider for geom %s not found.", s); s = gctl_get_ascii(req, "alignment"); + has_alignment = (*s == '*') ? 0 : 1; alignment = 1; - if (*s != '*') { + if (has_alignment) { error = g_parse_lba(s, pp->lg_sectorsize, &alignment); if (error) errc(EXIT_FAILURE, error, "Invalid alignment param"); @@ -361,7 +362,7 @@ gpart_autofill_resize(struct gctl_req *r if (error) errc(EXIT_FAILURE, error, "Invalid size param"); /* no autofill necessary. */ - if (alignment == 1) + if (has_alignment == 0) goto done; } @@ -392,7 +393,8 @@ gpart_autofill_resize(struct gctl_req *r lba = (off_t)strtoimax(s, NULL, 0); size = lba - start + 1; - if (new_size > 0 && new_size <= size) { + pp = find_provider(gp, lba + 1); + if (new_size > 0 && (new_size <= size || pp == NULL)) { /* The start offset may be not aligned, so we align the end * offset and then calculate the size. */ @@ -400,8 +402,6 @@ gpart_autofill_resize(struct gctl_req *r alignment) - start - offset; goto done; } - - pp = find_provider(gp, lba + 1); if (pp == NULL) { new_size = ALIGNDOWN(last + offset + 1, alignment) - start - offset; From owner-svn-src-stable@FreeBSD.ORG Thu Sep 15 04:35:00 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3945C106564A; Thu, 15 Sep 2011 04:35:00 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 27FFA8FC08; Thu, 15 Sep 2011 04:35:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8F4Z0iY056777; Thu, 15 Sep 2011 04:35:00 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8F4Z0QY056775; Thu, 15 Sep 2011 04:35:00 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201109150435.p8F4Z0QY056775@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 15 Sep 2011 04:35: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: r225566 - stable/8/sbin/geom/class/part X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2011 04:35:00 -0000 Author: ae Date: Thu Sep 15 04:34:59 2011 New Revision: 225566 URL: http://svn.freebsd.org/changeset/base/225566 Log: MFC r223356 (by delphij): Mod the offset padding by alignment. Without this change we may pad too much when underlying GEOM object have a zero stripesize. Modified: stable/8/sbin/geom/class/part/geom_part.c Directory Properties: stable/8/sbin/geom/class/part/ (props changed) Modified: stable/8/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/8/sbin/geom/class/part/geom_part.c Thu Sep 15 04:32:14 2011 (r225565) +++ stable/8/sbin/geom/class/part/geom_part.c Thu Sep 15 04:34:59 2011 (r225566) @@ -366,7 +366,7 @@ gpart_autofill_resize(struct gctl_req *r goto done; } - offset = pp->lg_stripeoffset / pp->lg_sectorsize; + offset = (pp->lg_stripeoffset / pp->lg_sectorsize) % alignment; last = (off_t)strtoimax(find_geomcfg(gp, "last"), NULL, 0); LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { s = find_provcfg(pp, "index"); @@ -514,7 +514,7 @@ gpart_autofill(struct gctl_req *req) alignment = len; /* Adjust parameters to stripeoffset */ - offset = pp->lg_stripeoffset / pp->lg_sectorsize; + offset = (pp->lg_stripeoffset / pp->lg_sectorsize) % alignment; start = ALIGNUP(start + offset, alignment); if (size > alignment) size = ALIGNDOWN(size, alignment); From owner-svn-src-stable@FreeBSD.ORG Thu Sep 15 10:35:39 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2708E1065670; Thu, 15 Sep 2011 10:35: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 1597D8FC0A; Thu, 15 Sep 2011 10:35:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8FAZc1t069643; Thu, 15 Sep 2011 10:35:38 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8FAZccc069641; Thu, 15 Sep 2011 10:35:38 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201109151035.p8FAZccc069641@svn.freebsd.org> From: Andriy Gapon Date: Thu, 15 Sep 2011 10:35: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: r225577 - stable/8/cddl/contrib/opensolaris/lib/libdtrace/common X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2011 10:35:39 -0000 Author: avg Date: Thu Sep 15 10:35:38 2011 New Revision: 225577 URL: http://svn.freebsd.org/changeset/base/225577 Log: MFC r209030: In dtrace lexer, do not unput token if it is EOF. On behalf of: kan Modified: stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l Thu Sep 15 09:54:07 2011 (r225576) +++ stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l Thu Sep 15 10:35:38 2011 (r225577) @@ -810,7 +810,8 @@ id_or_type(const char *s) longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM); } - unput(c0); + if (c0 != EOF) + unput(c0); return (ttok); } From owner-svn-src-stable@FreeBSD.ORG Thu Sep 15 10:39:45 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07AEF106564A; Thu, 15 Sep 2011 10:39:45 +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 EAAB18FC0C; Thu, 15 Sep 2011 10:39:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8FAdicu069804; Thu, 15 Sep 2011 10:39:44 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8FAdivN069802; Thu, 15 Sep 2011 10:39:44 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201109151039.p8FAdivN069802@svn.freebsd.org> From: Andriy Gapon Date: Thu, 15 Sep 2011 10:39:44 +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: r225578 - stable/8/cddl/contrib/opensolaris/lib/libdtrace/common X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2011 10:39:45 -0000 Author: avg Date: Thu Sep 15 10:39:44 2011 New Revision: 225578 URL: http://svn.freebsd.org/changeset/base/225578 Log: MFC r209305,209358: Do not allow EOF token to be put back into input buffer. PR: kern/159064 On behalf of: kan, marcel Modified: stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l Thu Sep 15 10:35:38 2011 (r225577) +++ stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l Thu Sep 15 10:39:44 2011 (r225578) @@ -44,7 +44,7 @@ #undef input #undef unput #else -/* +/* * Define YY_INPUT for flex since input() can't be re-defined. */ #define YY_INPUT(buf,result,max_size) \ @@ -59,6 +59,19 @@ buf[n] = *yypcb->pcb_strptr++; \ result = n; \ } +/* + * Do not EOF let tokens to be put back. This does not work with flex. + * On the other hand, leaving current buffer in same state it was when + * last EOF was received guarantees that input() will keep returning EOF + * for all subsequent invocations, which is the effect desired. + */ +#undef unput +#define unput(c) \ + do { \ + int _c = c; \ + if (_c != EOF) \ + yyunput(_c, yytext_ptr); \ + } while(0) #endif static int id_or_type(const char *); @@ -810,8 +823,7 @@ id_or_type(const char *s) longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM); } - if (c0 != EOF) - unput(c0); + unput(c0); return (ttok); } From owner-svn-src-stable@FreeBSD.ORG Thu Sep 15 10:42:55 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAC5F106566C; Thu, 15 Sep 2011 10:42:55 +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 9954C8FC16; Thu, 15 Sep 2011 10:42:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8FAgtWs069950; Thu, 15 Sep 2011 10:42:55 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8FAgtTr069948; Thu, 15 Sep 2011 10:42:55 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201109151042.p8FAgtTr069948@svn.freebsd.org> From: Andriy Gapon Date: Thu, 15 Sep 2011 10:42:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225579 - stable/7/cddl/contrib/opensolaris/lib/libdtrace/common X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2011 10:42:55 -0000 Author: avg Date: Thu Sep 15 10:42:55 2011 New Revision: 225579 URL: http://svn.freebsd.org/changeset/base/225579 Log: MFC r209030,209305,209358: In dtrace lexer, do not unput token if it is EOF. PR: kern/159064 On behalf of: kan, marcel Modified: stable/7/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l Directory Properties: stable/7/cddl/contrib/opensolaris/ (props changed) Modified: stable/7/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l ============================================================================== --- stable/7/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l Thu Sep 15 10:39:44 2011 (r225578) +++ stable/7/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l Thu Sep 15 10:42:55 2011 (r225579) @@ -45,7 +45,7 @@ #undef input #undef unput #else -/* +/* * Define YY_INPUT for flex since input() can't be re-defined. */ #define YY_INPUT(buf,result,max_size) \ @@ -60,6 +60,19 @@ buf[n] = *yypcb->pcb_strptr++; \ result = n; \ } +/* + * Do not EOF let tokens to be put back. This does not work with flex. + * On the other hand, leaving current buffer in same state it was when + * last EOF was received guarantees that input() will keep returning EOF + * for all subsequent invocations, which is the effect desired. + */ +#undef unput +#define unput(c) \ + do { \ + int _c = c; \ + if (_c != EOF) \ + yyunput(_c, yytext_ptr); \ + } while(0) #endif static int id_or_type(const char *); From owner-svn-src-stable@FreeBSD.ORG Thu Sep 15 10:51:32 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E6D3106566C; Thu, 15 Sep 2011 10:51:32 +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 1DA058FC13; Thu, 15 Sep 2011 10:51:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8FApW5J070331; Thu, 15 Sep 2011 10:51:32 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8FApV79070329; Thu, 15 Sep 2011 10:51:32 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201109151051.p8FApV79070329@svn.freebsd.org> From: Andriy Gapon Date: Thu, 15 Sep 2011 10:51: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: r225580 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2011 10:51:32 -0000 Author: avg Date: Thu Sep 15 10:51:31 2011 New Revision: 225580 URL: http://svn.freebsd.org/changeset/base/225580 Log: MFC r213736: generic_stop_cpus: prevent parallel execution Addendum to the original commit message: This is mostly useful to protect kdb_trap() from concurrent entry as it doesn't have any protection like e.g. panic(9) has. Even if kdb_trap() had that protection there would still be a need for protection between concurrect panic() and kdb_trap() entries. That protection could be implemented externally, but doing it in generic_stop_cpus() seems to be OK as well (stopping CPUs on panic is in the works). Modified: stable/8/sys/kern/subr_smp.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/subr_smp.c ============================================================================== --- stable/8/sys/kern/subr_smp.c Thu Sep 15 10:42:55 2011 (r225579) +++ stable/8/sys/kern/subr_smp.c Thu Sep 15 10:51:31 2011 (r225580) @@ -198,22 +198,32 @@ forward_signal(struct thread *td) * 0: NA * 1: ok * - * XXX FIXME: this is not MP-safe, needs a lock to prevent multiple CPUs - * from executing at same time. */ static int generic_stop_cpus(cpumask_t map, u_int type) { + static volatile u_int stopping_cpu = NOCPU; int i; - KASSERT(type == IPI_STOP || type == IPI_STOP_HARD, + KASSERT( +#if defined(__amd64__) + type == IPI_STOP || type == IPI_STOP_HARD || type == IPI_SUSPEND, +#else + type == IPI_STOP || type == IPI_STOP_HARD, +#endif ("%s: invalid stop type", __func__)); if (!smp_started) - return 0; + return (0); CTR2(KTR_SMP, "stop_cpus(%x) with %u type", map, type); + if (stopping_cpu != PCPU_GET(cpuid)) + while (atomic_cmpset_int(&stopping_cpu, NOCPU, + PCPU_GET(cpuid)) == 0) + while (stopping_cpu != NOCPU) + cpu_spinwait(); /* spin */ + /* send the stop IPI to all CPUs in map */ ipi_selected(map, type); @@ -230,7 +240,8 @@ generic_stop_cpus(cpumask_t map, u_int t #endif } - return 1; + stopping_cpu = NOCPU; + return (1); } int @@ -248,50 +259,11 @@ stop_cpus_hard(cpumask_t map) } #if defined(__amd64__) -/* - * When called the executing CPU will send an IPI to all other CPUs - * requesting that they halt execution. - * - * Usually (but not necessarily) called with 'other_cpus' as its arg. - * - * - Signals all CPUs in map to suspend. - * - Waits for each to suspend. - * - * Returns: - * -1: error - * 0: NA - * 1: ok - * - * XXX FIXME: this is not MP-safe, needs a lock to prevent multiple CPUs - * from executing at same time. - */ int suspend_cpus(cpumask_t map) { - int i; - if (!smp_started) - return (0); - - CTR1(KTR_SMP, "suspend_cpus(%x)", map); - - /* send the suspend IPI to all CPUs in map */ - ipi_selected(map, IPI_SUSPEND); - - i = 0; - while ((stopped_cpus & map) != map) { - /* spin */ - cpu_spinwait(); - i++; -#ifdef DIAGNOSTIC - if (i == 100000) { - printf("timeout suspending cpus\n"); - break; - } -#endif - } - - return (1); + return (generic_stop_cpus(map, IPI_SUSPEND)); } #endif From owner-svn-src-stable@FreeBSD.ORG Thu Sep 15 11:17:07 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D63D01065670; Thu, 15 Sep 2011 11:17:07 +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 C5CE28FC17; Thu, 15 Sep 2011 11:17:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8FBH7vf071143; Thu, 15 Sep 2011 11:17:07 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8FBH749071141; Thu, 15 Sep 2011 11:17:07 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201109151117.p8FBH749071141@svn.freebsd.org> From: Andriy Gapon Date: Thu, 15 Sep 2011 11:17:07 +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: r225581 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2011 11:17:08 -0000 Author: avg Date: Thu Sep 15 11:17:07 2011 New Revision: 225581 URL: http://svn.freebsd.org/changeset/base/225581 Log: MFC r223530: generic_stop_cpus: pull timeout logic from under DIAGNOSTIC Modified: stable/8/sys/kern/subr_smp.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/subr_smp.c ============================================================================== --- stable/8/sys/kern/subr_smp.c Thu Sep 15 10:51:31 2011 (r225580) +++ stable/8/sys/kern/subr_smp.c Thu Sep 15 11:17:07 2011 (r225581) @@ -232,12 +232,10 @@ generic_stop_cpus(cpumask_t map, u_int t /* spin */ cpu_spinwait(); i++; -#ifdef DIAGNOSTIC - if (i == 100000) { + if (i == 100000000) { printf("timeout stopping cpus\n"); break; } -#endif } stopping_cpu = NOCPU; From owner-svn-src-stable@FreeBSD.ORG Thu Sep 15 12:27:27 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 271C71065675; Thu, 15 Sep 2011 12:27:27 +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 0D6448FC0A; Thu, 15 Sep 2011 12:27:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8FCRQUM073559; Thu, 15 Sep 2011 12:27:26 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8FCRQSF073542; Thu, 15 Sep 2011 12:27:26 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201109151227.p8FCRQSF073542@svn.freebsd.org> From: Attilio Rao Date: Thu, 15 Sep 2011 12:27: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: r225585 - in stable/8: share/man/man9 sys/i386/acpica sys/kern sys/net sys/security/audit sys/sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2011 12:27:27 -0000 Author: attilio Date: Thu Sep 15 12:27:26 2011 New Revision: 225585 URL: http://svn.freebsd.org/changeset/base/225585 Log: MFC r225177,225181: Introduce and use seldrain() function for dealing with fast selrecord/selinfo destruction. Sponsored by: Sandvine Incorporated Modified: stable/8/share/man/man9/Makefile stable/8/share/man/man9/selrecord.9 stable/8/sys/i386/acpica/acpi_machdep.c stable/8/sys/kern/kern_event.c stable/8/sys/kern/sys_generic.c stable/8/sys/kern/sys_pipe.c stable/8/sys/kern/tty.c stable/8/sys/kern/tty_pts.c stable/8/sys/kern/uipc_mqueue.c stable/8/sys/kern/uipc_socket.c stable/8/sys/kern/vfs_subr.c stable/8/sys/net/bpf.c stable/8/sys/net/if_tap.c stable/8/sys/net/if_tun.c stable/8/sys/security/audit/audit_pipe.c stable/8/sys/sys/selinfo.h 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) Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Thu Sep 15 12:20:52 2011 (r225584) +++ stable/8/share/man/man9/Makefile Thu Sep 15 12:27:26 2011 (r225585) @@ -1050,7 +1050,8 @@ MLINKS+=scheduler.9 curpriority_cmp.9 \ scheduler.9 setrunnable.9 \ scheduler.9 updatepri.9 MLINKS+=securelevel_gt.9 securelevel_ge.9 -MLINKS+=selrecord.9 selwakeup.9 +MLINKS+=selrecord.9 seldrain.9 \ + selrecord.9 selwakeup.9 MLINKS+=sema.9 sema_destroy.9 \ sema.9 sema_init.9 \ sema.9 sema_post.9 \ Modified: stable/8/share/man/man9/selrecord.9 ============================================================================== --- stable/8/share/man/man9/selrecord.9 Thu Sep 15 12:20:52 2011 (r225584) +++ stable/8/share/man/man9/selrecord.9 Thu Sep 15 12:27:26 2011 (r225585) @@ -26,10 +26,11 @@ .\" .\" $FreeBSD$ .\" -.Dd June 13, 2007 +.Dd August 25, 2011 .Dt SELRECORD 9 .Os .Sh NAME +.Nm seldrain , .Nm selrecord , .Nm selwakeup .Nd "record and wakeup select requests" @@ -37,14 +38,17 @@ .In sys/param.h .In sys/selinfo.h .Ft void +.Fn seldrain "struct selinfo *sip" +.Ft void .Fn selrecord "struct thread *td" "struct selinfo *sip" .Ft void .Fn selwakeup "struct selinfo *sip" .Sh DESCRIPTION +.Fn seldrain , .Fn selrecord and .Fn selwakeup -are the two central functions used by +are the three central functions used by .Xr select 2 , .Xr poll 2 and the objects that are being selected on. @@ -86,6 +90,15 @@ and .Xr poll 2 when they wake up. .Pp +.Fn seldrain +will flush the waiters queue on a specified object before its +destruction. +The object handling code must ensure that +.Fa *sip +cannot be used once +.Fn seldrain +has been called. +.Pp The contents of .Fa *sip must be zeroed, such as by softc initialization, before any call to @@ -98,6 +111,10 @@ acquires and releases .Va sellock and may acquire and release .Va sched_lock . +.Fn seldrain +could usually be just a wrapper for +.Fn selwakeup , +but consumers should not generally rely on this feature. .Sh SEE ALSO .Xr poll 2 , .Xr select 2 Modified: stable/8/sys/i386/acpica/acpi_machdep.c ============================================================================== --- stable/8/sys/i386/acpica/acpi_machdep.c Thu Sep 15 12:20:52 2011 (r225584) +++ stable/8/sys/i386/acpica/acpi_machdep.c Thu Sep 15 12:27:26 2011 (r225585) @@ -313,6 +313,7 @@ apmclose(struct cdev *dev, int flag, int /* Remove this clone's data from the list and free it. */ ACPI_LOCK(acpi); STAILQ_REMOVE(&acpi_sc->apm_cdevs, clone, apm_clone_data, entries); + seldrain(&clone->sel_read); knlist_destroy(&clone->sel_read.si_note); ACPI_UNLOCK(acpi); free(clone, M_APMDEV); Modified: stable/8/sys/kern/kern_event.c ============================================================================== --- stable/8/sys/kern/kern_event.c Thu Sep 15 12:20:52 2011 (r225584) +++ stable/8/sys/kern/kern_event.c Thu Sep 15 12:27:26 2011 (r225585) @@ -1686,6 +1686,7 @@ kqueue_close(struct file *fp, struct thr SLIST_REMOVE(&fdp->fd_kqlist, kq, kqueue, kq_list); FILEDESC_XUNLOCK(fdp); + seldrain(&kq->kq_sel); knlist_destroy(&kq->kq_sel.si_note); mtx_destroy(&kq->kq_lock); kq->kq_fdp = NULL; Modified: stable/8/sys/kern/sys_generic.c ============================================================================== --- stable/8/sys/kern/sys_generic.c Thu Sep 15 12:20:52 2011 (r225584) +++ stable/8/sys/kern/sys_generic.c Thu Sep 15 12:27:26 2011 (r225585) @@ -1442,6 +1442,23 @@ selfdfree(struct seltd *stp, struct self uma_zfree(selfd_zone, sfp); } +/* Drain the waiters tied to all the selfd belonging the specified selinfo. */ +void +seldrain(sip) + struct selinfo *sip; +{ + + /* + * This feature is already provided by doselwakeup(), thus it is + * enough to go for it. + * Eventually, the context, should take care to avoid races + * between thread calling select()/poll() and file descriptor + * detaching, but, again, the races are just the same as + * selwakeup(). + */ + doselwakeup(sip, -1); +} + /* * Record a select request. */ Modified: stable/8/sys/kern/sys_pipe.c ============================================================================== --- stable/8/sys/kern/sys_pipe.c Thu Sep 15 12:20:52 2011 (r225584) +++ stable/8/sys/kern/sys_pipe.c Thu Sep 15 12:27:26 2011 (r225585) @@ -1536,6 +1536,7 @@ pipeclose(cpipe) */ knlist_clear(&cpipe->pipe_sel.si_note, 1); cpipe->pipe_present = PIPE_FINALIZED; + seldrain(&cpipe->pipe_sel); knlist_destroy(&cpipe->pipe_sel.si_note); /* Modified: stable/8/sys/kern/tty.c ============================================================================== --- stable/8/sys/kern/tty.c Thu Sep 15 12:20:52 2011 (r225584) +++ stable/8/sys/kern/tty.c Thu Sep 15 12:27:26 2011 (r225585) @@ -986,6 +986,8 @@ tty_dealloc(void *arg) MPASS(ttyinq_getsize(&tp->t_inq) == 0); MPASS(ttyoutq_getsize(&tp->t_outq) == 0); + seldrain(&tp->t_inpoll); + seldrain(&tp->t_outpoll); knlist_destroy(&tp->t_inpoll.si_note); knlist_destroy(&tp->t_outpoll.si_note); Modified: stable/8/sys/kern/tty_pts.c ============================================================================== --- stable/8/sys/kern/tty_pts.c Thu Sep 15 12:20:52 2011 (r225584) +++ stable/8/sys/kern/tty_pts.c Thu Sep 15 12:27:26 2011 (r225585) @@ -698,6 +698,8 @@ ptsdrv_free(void *softc) chgptscnt(psc->pts_uidinfo, -1, 0); uifree(psc->pts_uidinfo); + seldrain(&psc->pts_inpoll); + seldrain(&psc->pts_outpoll); knlist_destroy(&psc->pts_inpoll.si_note); knlist_destroy(&psc->pts_outpoll.si_note); Modified: stable/8/sys/kern/uipc_mqueue.c ============================================================================== --- stable/8/sys/kern/uipc_mqueue.c Thu Sep 15 12:20:52 2011 (r225584) +++ stable/8/sys/kern/uipc_mqueue.c Thu Sep 15 12:27:26 2011 (r225585) @@ -1553,6 +1553,8 @@ mqueue_free(struct mqueue *mq) } mtx_destroy(&mq->mq_mutex); + seldrain(&mq->mq_rsel); + seldrain(&mq->mq_wsel); knlist_destroy(&mq->mq_rsel.si_note); knlist_destroy(&mq->mq_wsel.si_note); uma_zfree(mqueue_zone, mq); Modified: stable/8/sys/kern/uipc_socket.c ============================================================================== --- stable/8/sys/kern/uipc_socket.c Thu Sep 15 12:20:52 2011 (r225584) +++ stable/8/sys/kern/uipc_socket.c Thu Sep 15 12:27:26 2011 (r225585) @@ -652,6 +652,8 @@ sofree(struct socket *so) */ sbdestroy(&so->so_snd, so); sbdestroy(&so->so_rcv, so); + seldrain(&so->so_snd.sb_sel); + seldrain(&so->so_rcv.sb_sel); knlist_destroy(&so->so_rcv.sb_sel.si_note); knlist_destroy(&so->so_snd.sb_sel.si_note); sodealloc(so); Modified: stable/8/sys/kern/vfs_subr.c ============================================================================== --- stable/8/sys/kern/vfs_subr.c Thu Sep 15 12:20:52 2011 (r225584) +++ stable/8/sys/kern/vfs_subr.c Thu Sep 15 12:27:26 2011 (r225585) @@ -3311,6 +3311,7 @@ vbusy(struct vnode *vp) static void destroy_vpollinfo(struct vpollinfo *vi) { + seldrain(&vi->vpi_selinfo); knlist_destroy(&vi->vpi_selinfo.si_note); mtx_destroy(&vi->vpi_lock); uma_zfree(vnodepoll_zone, vi); Modified: stable/8/sys/net/bpf.c ============================================================================== --- stable/8/sys/net/bpf.c Thu Sep 15 12:20:52 2011 (r225584) +++ stable/8/sys/net/bpf.c Thu Sep 15 12:27:26 2011 (r225585) @@ -644,10 +644,10 @@ bpf_dtor(void *data) if (d->bd_bif) bpf_detachd(d); mtx_unlock(&bpf_mtx); - selwakeuppri(&d->bd_sel, PRINET); #ifdef MAC mac_bpfdesc_destroy(d); #endif /* MAC */ + seldrain(&d->bd_sel); knlist_destroy(&d->bd_sel.si_note); callout_drain(&d->bd_callout); bpf_freed(d); Modified: stable/8/sys/net/if_tap.c ============================================================================== --- stable/8/sys/net/if_tap.c Thu Sep 15 12:20:52 2011 (r225584) +++ stable/8/sys/net/if_tap.c Thu Sep 15 12:27:26 2011 (r225585) @@ -214,6 +214,7 @@ tap_destroy(struct tap_softc *tp) KASSERT(!(tp->tap_flags & TAP_OPEN), ("%s flags is out of sync", ifp->if_xname)); + seldrain(&tp->tap_rsel); knlist_destroy(&tp->tap_rsel.si_note); destroy_dev(tp->tap_dev); ether_ifdetach(ifp); Modified: stable/8/sys/net/if_tun.c ============================================================================== --- stable/8/sys/net/if_tun.c Thu Sep 15 12:20:52 2011 (r225584) +++ stable/8/sys/net/if_tun.c Thu Sep 15 12:27:26 2011 (r225585) @@ -259,6 +259,7 @@ tun_destroy(struct tun_softc *tp) if_detach(TUN2IFP(tp)); if_free(TUN2IFP(tp)); destroy_dev(dev); + seldrain(&tp->tun_rsel); knlist_destroy(&tp->tun_rsel.si_note); mtx_destroy(&tp->tun_mtx); cv_destroy(&tp->tun_cv); Modified: stable/8/sys/security/audit/audit_pipe.c ============================================================================== --- stable/8/sys/security/audit/audit_pipe.c Thu Sep 15 12:20:52 2011 (r225584) +++ stable/8/sys/security/audit/audit_pipe.c Thu Sep 15 12:27:26 2011 (r225585) @@ -646,6 +646,7 @@ audit_pipe_free(struct audit_pipe *ap) cv_destroy(&ap->ap_cv); AUDIT_PIPE_SX_LOCK_DESTROY(ap); AUDIT_PIPE_LOCK_DESTROY(ap); + seldrain(&ap->ap_selinfo); knlist_destroy(&ap->ap_selinfo.si_note); TAILQ_REMOVE(&audit_pipe_list, ap, ap_list); free(ap, M_AUDIT_PIPE); Modified: stable/8/sys/sys/selinfo.h ============================================================================== --- stable/8/sys/sys/selinfo.h Thu Sep 15 12:20:52 2011 (r225584) +++ stable/8/sys/sys/selinfo.h Thu Sep 15 12:27:26 2011 (r225585) @@ -51,6 +51,7 @@ struct selinfo { #define SEL_WAITING(si) (!TAILQ_EMPTY(&(si)->si_tdlist)) #ifdef _KERNEL +void seldrain(struct selinfo *sip); void selrecord(struct thread *selector, struct selinfo *sip); void selwakeup(struct selinfo *sip); void selwakeuppri(struct selinfo *sip, int pri); From owner-svn-src-stable@FreeBSD.ORG Thu Sep 15 17:20:20 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B42A01065675; Thu, 15 Sep 2011 17:20:20 +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 A1EE18FC17; Thu, 15 Sep 2011 17:20:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8FHKKZn082886; Thu, 15 Sep 2011 17:20:20 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8FHKK7D082883; Thu, 15 Sep 2011 17:20:20 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201109151720.p8FHKK7D082883@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 15 Sep 2011 17:20: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: r225594 - stable/8/sys/dev/vge X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2011 17:20:20 -0000 Author: yongari Date: Thu Sep 15 17:20:20 2011 New Revision: 225594 URL: http://svn.freebsd.org/changeset/base/225594 Log: MFC r225440: vge(4) hardwares poll media status and generates an interrupt whenever the link state is changed. Using software based polling for media status tracking is known to cause MII access failure under certain conditions once link is established so vge(4) used to rely on link status change interrupt. However DEVICE_POLLING completely disables generation of all kind of interrupts on vge(4) such that this resulted in not detecting link state change event. This means vge(4) does not correctly detect established/lost link with DEVICE_POLLING. Losing the interrupt made vge(4) not to send any packets to peer since vge(4) does not try to send any packets when there is no established link. Work around the issue by generating link state change interrupt with DEVICE_POLLING. PR: kern/160442 Modified: stable/8/sys/dev/vge/if_vge.c stable/8/sys/dev/vge/if_vgereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/vge/if_vge.c ============================================================================== --- stable/8/sys/dev/vge/if_vge.c Thu Sep 15 17:11:03 2011 (r225593) +++ stable/8/sys/dev/vge/if_vge.c Thu Sep 15 17:20:20 2011 (r225594) @@ -1752,6 +1752,10 @@ vge_intr(void *arg) #ifdef DEVICE_POLLING if (ifp->if_capenable & IFCAP_POLLING) { + status = CSR_READ_4(sc, VGE_ISR); + CSR_WRITE_4(sc, VGE_ISR, status); + if (status != 0xFFFFFFFF && (status & VGE_ISR_LINKSTS) != 0) + vge_link_statchg(sc); VGE_UNLOCK(sc); return; } @@ -2109,11 +2113,10 @@ vge_init_locked(struct vge_softc *sc) #ifdef DEVICE_POLLING /* - * Disable interrupts if we are polling. + * Disable interrupts except link state change if we are polling. */ if (ifp->if_capenable & IFCAP_POLLING) { - CSR_WRITE_4(sc, VGE_IMR, 0); - CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK); + CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS_POLLING); } else /* otherwise ... */ #endif { @@ -2121,9 +2124,9 @@ vge_init_locked(struct vge_softc *sc) * Enable interrupts. */ CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS); - CSR_WRITE_4(sc, VGE_ISR, 0xFFFFFFFF); - CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); } + CSR_WRITE_4(sc, VGE_ISR, 0xFFFFFFFF); + CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); sc->vge_flags &= ~VGE_FLAG_LINK; mii_mediachg(mii); @@ -2280,8 +2283,9 @@ vge_ioctl(struct ifnet *ifp, u_long comm return (error); VGE_LOCK(sc); /* Disable interrupts */ - CSR_WRITE_4(sc, VGE_IMR, 0); - CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK); + CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS_POLLING); + CSR_WRITE_4(sc, VGE_ISR, 0xFFFFFFFF); + CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); ifp->if_capenable |= IFCAP_POLLING; VGE_UNLOCK(sc); } else { Modified: stable/8/sys/dev/vge/if_vgereg.h ============================================================================== --- stable/8/sys/dev/vge/if_vgereg.h Thu Sep 15 17:11:03 2011 (r225593) +++ stable/8/sys/dev/vge/if_vgereg.h Thu Sep 15 17:20:20 2011 (r225594) @@ -302,6 +302,8 @@ VGE_ISR_LINKSTS|VGE_ISR_RXNODESC| \ VGE_ISR_RXDMA_STALL|VGE_ISR_TXDMA_STALL) +#define VGE_INTRS_POLLING (VGE_ISR_PHYINT|VGE_ISR_LINKSTS) + /* Interrupt mask register */ #define VGE_IMR_RXOK_HIPRIO 0x00000001 /* hi prio RX int */ From owner-svn-src-stable@FreeBSD.ORG Thu Sep 15 17:22:39 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 428EC106564A; Thu, 15 Sep 2011 17:22:39 +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 309CA8FC0A; Thu, 15 Sep 2011 17:22:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8FHMdia083001; Thu, 15 Sep 2011 17:22:39 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8FHMdLK082998; Thu, 15 Sep 2011 17:22:39 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201109151722.p8FHMdLK082998@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 15 Sep 2011 17:22:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225595 - stable/7/sys/dev/vge X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2011 17:22:39 -0000 Author: yongari Date: Thu Sep 15 17:22:38 2011 New Revision: 225595 URL: http://svn.freebsd.org/changeset/base/225595 Log: MFC r225440: vge(4) hardwares poll media status and generates an interrupt whenever the link state is changed. Using software based polling for media status tracking is known to cause MII access failure under certain conditions once link is established so vge(4) used to rely on link status change interrupt. However DEVICE_POLLING completely disables generation of all kind of interrupts on vge(4) such that this resulted in not detecting link state change event. This means vge(4) does not correctly detect established/lost link with DEVICE_POLLING. Losing the interrupt made vge(4) not to send any packets to peer since vge(4) does not try to send any packets when there is no established link. Work around the issue by generating link state change interrupt with DEVICE_POLLING. PR: kern/160442 Modified: stable/7/sys/dev/vge/if_vge.c stable/7/sys/dev/vge/if_vgereg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/vge/if_vge.c ============================================================================== --- stable/7/sys/dev/vge/if_vge.c Thu Sep 15 17:20:20 2011 (r225594) +++ stable/7/sys/dev/vge/if_vge.c Thu Sep 15 17:22:38 2011 (r225595) @@ -1753,6 +1753,10 @@ vge_intr(void *arg) #ifdef DEVICE_POLLING if (ifp->if_capenable & IFCAP_POLLING) { + status = CSR_READ_4(sc, VGE_ISR); + CSR_WRITE_4(sc, VGE_ISR, status); + if (status != 0xFFFFFFFF && (status & VGE_ISR_LINKSTS) != 0) + vge_link_statchg(sc); VGE_UNLOCK(sc); return; } @@ -2110,11 +2114,10 @@ vge_init_locked(struct vge_softc *sc) #ifdef DEVICE_POLLING /* - * Disable interrupts if we are polling. + * Disable interrupts except link state change if we are polling. */ if (ifp->if_capenable & IFCAP_POLLING) { - CSR_WRITE_4(sc, VGE_IMR, 0); - CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK); + CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS_POLLING); } else /* otherwise ... */ #endif { @@ -2122,9 +2125,9 @@ vge_init_locked(struct vge_softc *sc) * Enable interrupts. */ CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS); - CSR_WRITE_4(sc, VGE_ISR, 0xFFFFFFFF); - CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); } + CSR_WRITE_4(sc, VGE_ISR, 0xFFFFFFFF); + CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); sc->vge_flags &= ~VGE_FLAG_LINK; mii_mediachg(mii); @@ -2281,8 +2284,9 @@ vge_ioctl(struct ifnet *ifp, u_long comm return (error); VGE_LOCK(sc); /* Disable interrupts */ - CSR_WRITE_4(sc, VGE_IMR, 0); - CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK); + CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS_POLLING); + CSR_WRITE_4(sc, VGE_ISR, 0xFFFFFFFF); + CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); ifp->if_capenable |= IFCAP_POLLING; VGE_UNLOCK(sc); } else { Modified: stable/7/sys/dev/vge/if_vgereg.h ============================================================================== --- stable/7/sys/dev/vge/if_vgereg.h Thu Sep 15 17:20:20 2011 (r225594) +++ stable/7/sys/dev/vge/if_vgereg.h Thu Sep 15 17:22:38 2011 (r225595) @@ -302,6 +302,8 @@ VGE_ISR_LINKSTS|VGE_ISR_RXNODESC| \ VGE_ISR_RXDMA_STALL|VGE_ISR_TXDMA_STALL) +#define VGE_INTRS_POLLING (VGE_ISR_PHYINT|VGE_ISR_LINKSTS) + /* Interrupt mask register */ #define VGE_IMR_RXOK_HIPRIO 0x00000001 /* hi prio RX int */ From owner-svn-src-stable@FreeBSD.ORG Fri Sep 16 02:28:56 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 022341065670; Fri, 16 Sep 2011 02:28:56 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB93A8FC0C; Fri, 16 Sep 2011 02:28:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8G2StMb099844; Fri, 16 Sep 2011 02:28:55 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8G2Stnc099841; Fri, 16 Sep 2011 02:28:55 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109160228.p8G2Stnc099841@svn.freebsd.org> From: Adrian Chadd Date: Fri, 16 Sep 2011 02:28: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: r225600 - in stable/8: share/man/man7 share/man/man9 sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 02:28:56 -0000 Author: adrian Date: Fri Sep 16 02:28:55 2011 New Revision: 225600 URL: http://svn.freebsd.org/changeset/base/225600 Log: Merge r225570 from HEAD - Ensure that ta_pending doesn't overflow u_short by capping its value at USHRT_MAX. If it overflows before the taskqueue can run, the task will be re-added to the taskqueue and cause a loop in the task list. Submitted by: rstone@ Reviewed by: jhb@ MFC after: 1 day Modified: stable/8/share/man/man9/taskqueue.9 stable/8/sys/kern/subr_taskqueue.c 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/man7/ports.7 (props changed) stable/8/share/man/man8/ (props changed) 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) Modified: stable/8/share/man/man9/taskqueue.9 ============================================================================== --- stable/8/share/man/man9/taskqueue.9 Thu Sep 15 22:50:31 2011 (r225599) +++ stable/8/share/man/man9/taskqueue.9 Fri Sep 16 02:28:55 2011 (r225600) @@ -124,7 +124,7 @@ If the task's .Va ta_pending field is non-zero, then it is simply incremented to reflect the number of times the task -was enqueued. +was enqueued, up to a cap of USHRT_MAX. Otherwise, the task is added to the list before the first task which has a lower .Va ta_priority Modified: stable/8/sys/kern/subr_taskqueue.c ============================================================================== --- stable/8/sys/kern/subr_taskqueue.c Thu Sep 15 22:50:31 2011 (r225599) +++ stable/8/sys/kern/subr_taskqueue.c Fri Sep 16 02:28:55 2011 (r225600) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -165,7 +166,8 @@ taskqueue_enqueue(struct taskqueue *queu * Count multiple enqueues. */ if (task->ta_pending) { - task->ta_pending++; + if (task->ta_pending < USHRT_MAX) + task->ta_pending++; TQ_UNLOCK(queue); return 0; } From owner-svn-src-stable@FreeBSD.ORG Fri Sep 16 05:45:14 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 305B1106564A; Fri, 16 Sep 2011 05:45:14 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1EF5D8FC08; Fri, 16 Sep 2011 05:45:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8G5jEau006252; Fri, 16 Sep 2011 05:45:14 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8G5jEEG006249; Fri, 16 Sep 2011 05:45:14 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201109160545.p8G5jEEG006249@svn.freebsd.org> From: Xin LI Date: Fri, 16 Sep 2011 05:45: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: r225605 - in stable: 7/sbin/fsck_ffs 8/sbin/fsck_ffs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 05:45:14 -0000 Author: delphij Date: Fri Sep 16 05:45:13 2011 New Revision: 225605 URL: http://svn.freebsd.org/changeset/base/225605 Log: MFC r225338: Fix the check in dircheck() on namlen. The value of namlen is copied from on-disk d_namlen, which is a 8-bit unsigned integer which can never exceed MAXNAMLEN (255) so the test is always true. Moreover, UFS does not allow d_namelen being zero. Change namlen from u_int to u_int8_t, and replace the unneeded test with a useful test. PR: bin/160339 Submitted by: Eugene Grosbein Modified: stable/8/sbin/fsck_ffs/dir.c Directory Properties: stable/8/sbin/fsck_ffs/ (props changed) Changes in other areas also in this revision: Modified: stable/7/sbin/fsck_ffs/dir.c Directory Properties: stable/7/sbin/fsck_ffs/ (props changed) Modified: stable/8/sbin/fsck_ffs/dir.c ============================================================================== --- stable/8/sbin/fsck_ffs/dir.c Fri Sep 16 04:42:05 2011 (r225604) +++ stable/8/sbin/fsck_ffs/dir.c Fri Sep 16 05:45:13 2011 (r225605) @@ -210,7 +210,7 @@ dircheck(struct inodesc *idesc, struct d size_t size; char *cp; u_char type; - u_int namlen; + u_int8_t namlen; int spaceleft; spaceleft = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ); @@ -225,7 +225,7 @@ dircheck(struct inodesc *idesc, struct d type = dp->d_type; if (dp->d_reclen < size || idesc->id_filesize < size || - namlen > MAXNAMLEN || + namlen == 0 || type > 15) goto bad; for (cp = dp->d_name, size = 0; size < namlen; size++) From owner-svn-src-stable@FreeBSD.ORG Fri Sep 16 05:45:14 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51E9A106566C; Fri, 16 Sep 2011 05:45:14 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 407298FC0C; Fri, 16 Sep 2011 05:45:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8G5jE9N006259; Fri, 16 Sep 2011 05:45:14 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8G5jE2B006257; Fri, 16 Sep 2011 05:45:14 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201109160545.p8G5jE2B006257@svn.freebsd.org> From: Xin LI Date: Fri, 16 Sep 2011 05:45:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225605 - in stable: 7/sbin/fsck_ffs 8/sbin/fsck_ffs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 05:45:14 -0000 Author: delphij Date: Fri Sep 16 05:45:13 2011 New Revision: 225605 URL: http://svn.freebsd.org/changeset/base/225605 Log: MFC r225338: Fix the check in dircheck() on namlen. The value of namlen is copied from on-disk d_namlen, which is a 8-bit unsigned integer which can never exceed MAXNAMLEN (255) so the test is always true. Moreover, UFS does not allow d_namelen being zero. Change namlen from u_int to u_int8_t, and replace the unneeded test with a useful test. PR: bin/160339 Submitted by: Eugene Grosbein Modified: stable/7/sbin/fsck_ffs/dir.c Directory Properties: stable/7/sbin/fsck_ffs/ (props changed) Changes in other areas also in this revision: Modified: stable/8/sbin/fsck_ffs/dir.c Directory Properties: stable/8/sbin/fsck_ffs/ (props changed) Modified: stable/7/sbin/fsck_ffs/dir.c ============================================================================== --- stable/7/sbin/fsck_ffs/dir.c Fri Sep 16 04:42:05 2011 (r225604) +++ stable/7/sbin/fsck_ffs/dir.c Fri Sep 16 05:45:13 2011 (r225605) @@ -210,7 +210,7 @@ dircheck(struct inodesc *idesc, struct d size_t size; char *cp; u_char type; - u_int namlen; + u_int8_t namlen; int spaceleft; spaceleft = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ); @@ -225,7 +225,7 @@ dircheck(struct inodesc *idesc, struct d type = dp->d_type; if (dp->d_reclen < size || idesc->id_filesize < size || - namlen > MAXNAMLEN || + namlen == 0 || type > 15) goto bad; for (cp = dp->d_name, size = 0; size < namlen; size++) From owner-svn-src-stable@FreeBSD.ORG Fri Sep 16 05:57:02 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13FF91065674; Fri, 16 Sep 2011 05:57:02 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 029A88FC08; Fri, 16 Sep 2011 05:57:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8G5v1d7006650; Fri, 16 Sep 2011 05:57:01 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8G5v1Wt006648; Fri, 16 Sep 2011 05:57:01 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201109160557.p8G5v1Wt006648@svn.freebsd.org> From: Xin LI Date: Fri, 16 Sep 2011 05:57: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: r225606 - in stable: 7/sys/dev/ichwd 8/sys/dev/ichwd X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 05:57:02 -0000 Author: delphij Date: Fri Sep 16 05:57:01 2011 New Revision: 225606 URL: http://svn.freebsd.org/changeset/base/225606 Log: MFC r225340: Fix a bug in ichwd(4) which prevents it from being enabled if the new timeout is the same timeout. Submitted by: Dmitrij Tejblum PR: kern/139604 Modified: stable/8/sys/dev/ichwd/ichwd.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) Changes in other areas also in this revision: Modified: stable/7/sys/dev/ichwd/ichwd.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ichwd/ichwd.c ============================================================================== --- stable/8/sys/dev/ichwd/ichwd.c Fri Sep 16 05:45:13 2011 (r225605) +++ stable/8/sys/dev/ichwd/ichwd.c Fri Sep 16 05:57:01 2011 (r225606) @@ -402,11 +402,10 @@ ichwd_event(void *arg, unsigned int cmd, cmd &= WD_INTERVAL; timeout = ((uint64_t)1 << cmd) / ICHWD_TICK; if (cmd) { - if (timeout != sc->timeout) { - if (!sc->active) - ichwd_tmr_enable(sc); + if (!sc->active) + ichwd_tmr_enable(sc); + if (timeout != sc->timeout) ichwd_tmr_set(sc, timeout); - } ichwd_tmr_reload(sc); *error = 0; } else { From owner-svn-src-stable@FreeBSD.ORG Fri Sep 16 05:57:02 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 345CD1065670; Fri, 16 Sep 2011 05:57:02 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2325B8FC13; Fri, 16 Sep 2011 05:57:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8G5v2tg006656; Fri, 16 Sep 2011 05:57:02 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8G5v2uN006654; Fri, 16 Sep 2011 05:57:02 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201109160557.p8G5v2uN006654@svn.freebsd.org> From: Xin LI Date: Fri, 16 Sep 2011 05:57:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225606 - in stable: 7/sys/dev/ichwd 8/sys/dev/ichwd X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 05:57:02 -0000 Author: delphij Date: Fri Sep 16 05:57:01 2011 New Revision: 225606 URL: http://svn.freebsd.org/changeset/base/225606 Log: MFC r225340: Fix a bug in ichwd(4) which prevents it from being enabled if the new timeout is the same timeout. Submitted by: Dmitrij Tejblum PR: kern/139604 Modified: stable/7/sys/dev/ichwd/ichwd.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Changes in other areas also in this revision: Modified: stable/8/sys/dev/ichwd/ichwd.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ichwd/ichwd.c ============================================================================== --- stable/7/sys/dev/ichwd/ichwd.c Fri Sep 16 05:45:13 2011 (r225605) +++ stable/7/sys/dev/ichwd/ichwd.c Fri Sep 16 05:57:01 2011 (r225606) @@ -319,11 +319,10 @@ ichwd_event(void *arg, unsigned int cmd, cmd &= WD_INTERVAL; timeout = ((uint64_t)1 << cmd) / ICHWD_TICK; if (cmd) { - if (timeout != sc->timeout) { - if (!sc->active) - ichwd_tmr_enable(sc); + if (!sc->active) + ichwd_tmr_enable(sc); + if (timeout != sc->timeout) ichwd_tmr_set(sc, timeout); - } ichwd_tmr_reload(sc); *error = 0; } else { From owner-svn-src-stable@FreeBSD.ORG Fri Sep 16 17:39:40 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E3C1106564A; Fri, 16 Sep 2011 17:39:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 12D2B8FC0A; Fri, 16 Sep 2011 17:39:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8GHddu8031616; Fri, 16 Sep 2011 17:39:39 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8GHddYa031610; Fri, 16 Sep 2011 17:39:39 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201109161739.p8GHddYa031610@svn.freebsd.org> From: John Baldwin Date: Fri, 16 Sep 2011 17:39: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: r225619 - in stable/8: contrib/top usr.bin/top X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 17:39:40 -0000 Author: jhb Date: Fri Sep 16 17:39:39 2011 New Revision: 225619 URL: http://svn.freebsd.org/changeset/base/225619 Log: MFC 223936,224205: Allow per-CPU statistics to be toggled at runtime via the 'P' key. While here, make -P a toggle similar to other options such as -I. Modified: stable/8/contrib/top/commands.c stable/8/contrib/top/display.c stable/8/contrib/top/top.X stable/8/contrib/top/top.c stable/8/usr.bin/top/machine.c Directory Properties: stable/8/contrib/top/ (props changed) stable/8/contrib/top/install-sh (props changed) stable/8/usr.bin/top/ (props changed) Modified: stable/8/contrib/top/commands.c ============================================================================== --- stable/8/contrib/top/commands.c Fri Sep 16 14:04:14 2011 (r225618) +++ stable/8/contrib/top/commands.c Fri Sep 16 17:39:39 2011 (r225619) @@ -88,6 +88,7 @@ o - specify sort order (vcsw, ivcs stdout); #endif fputs("\ +P - toggle the displaying of per-CPU statistics\n\ r - renice a process\n\ s - change number of seconds to delay between updates\n\ S - toggle the displaying of system processes\n\ Modified: stable/8/contrib/top/display.c ============================================================================== --- stable/8/contrib/top/display.c Fri Sep 16 14:04:14 2011 (r225618) +++ stable/8/contrib/top/display.c Fri Sep 16 17:39:39 2011 (r225619) @@ -151,25 +151,50 @@ int display_resize() return(smart_terminal ? lines : Largest); } -int display_init(statics) +int display_updatecpus(statics) struct statics *statics; { + register int *lp; register int lines; - register char **pp; - register int *ip; register int i; - + /* call resize to do the dirty work */ lines = display_resize(); - num_cpus = statics->ncpus; + if (pcpu_stats) + num_cpus = statics->ncpus; + else + num_cpus = 1; cpustates_column = 5; /* CPU: */ if (num_cpus != 1) cpustates_column += 2; /* CPU 0: */ for (i = num_cpus; i > 9; i /= 10) cpustates_column++; + /* fill the "last" array with all -1s, to insure correct updating */ + lp = lcpustates; + i = num_cpustates * num_cpus; + while (--i >= 0) + { + *lp++ = -1; + } + + return(lines); +} + +int display_init(statics) + +struct statics *statics; + +{ + register int lines; + register char **pp; + register int *ip; + register int i; + + lines = display_updatecpus(statics); + /* only do the rest if we need to */ if (lines > -1) { @@ -184,7 +209,7 @@ struct statics *statics; num_swap = string_count(swap_names); lswap = (int *)malloc(num_swap * sizeof(int)); num_cpustates = string_count(cpustate_names); - lcpustates = (int *)malloc(num_cpustates * sizeof(int) * num_cpus); + lcpustates = (int *)malloc(num_cpustates * sizeof(int) * statics->ncpus); cpustate_columns = (int *)malloc(num_cpustates * sizeof(int)); memory_names = statics->memory_names; Modified: stable/8/contrib/top/top.X ============================================================================== --- stable/8/contrib/top/top.X Fri Sep 16 14:04:14 2011 (r225618) +++ stable/8/contrib/top/top.X Fri Sep 16 17:39:39 2011 (r225619) @@ -205,6 +205,7 @@ The options .BR \-H , .BR \-I , .BR \-j , +.BR \-P , .BR \-S , .BR \-t , .BR \-u , @@ -314,6 +315,9 @@ Toggle the display of .IR jail (8) ID. .TP +.B P +Toggle the display of per-CPU statistics. +.TP .B t Toggle the display of the .I top Modified: stable/8/contrib/top/top.c ============================================================================== --- stable/8/contrib/top/top.c Fri Sep 16 14:04:14 2011 (r225618) +++ stable/8/contrib/top/top.c Fri Sep 16 17:39:39 2011 (r225619) @@ -196,9 +196,9 @@ char *argv[]; fd_set readfds; #ifdef ORDER - static char command_chars[] = "\f qh?en#sdkriIutHmSCajzo"; + static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPo"; #else - static char command_chars[] = "\f qh?en#sdkriIutHmSCajz"; + static char command_chars[] = "\f qh?en#sdkriIutHmSCajzP"; #endif /* these defines enumerate the "strchr"s of the commands in command_chars */ #define CMD_redraw 0 @@ -225,8 +225,9 @@ char *argv[]; #define CMD_showargs 20 #define CMD_jidtog 21 #define CMD_kidletog 22 +#define CMD_pcputog 23 #ifdef ORDER -#define CMD_order 23 +#define CMD_order 24 #endif /* set the buffer for stdout */ @@ -411,7 +412,7 @@ char *argv[]; break; case 'P': - pcpu_stats = Yes; + pcpu_stats = !pcpu_stats; break; case 'z': @@ -1088,6 +1089,16 @@ restart: ps.kidle ? "D" : "Not d"); putchar('\r'); break; + case CMD_pcputog: + pcpu_stats = !pcpu_stats; + new_message(MT_standout | MT_delayed, + " Displaying %sCPU statistics.", + pcpu_stats ? "per-" : "global "); + toggle_pcpustats(); + max_topn = display_updatecpus(&statics); + reset_display(); + putchar('\r'); + break; default: new_message(MT_standout, " BAD CASE IN SWITCH!"); putchar('\r'); Modified: stable/8/usr.bin/top/machine.c ============================================================================== --- stable/8/usr.bin/top/machine.c Fri Sep 16 14:04:14 2011 (r225618) +++ stable/8/usr.bin/top/machine.c Fri Sep 16 17:39:39 2011 (r225619) @@ -239,19 +239,46 @@ static const char *format_nice(const str static void getsysctl(const char *name, void *ptr, size_t len); static int swapmode(int *retavail, int *retfree); +void +toggle_pcpustats(void) +{ + + if (ncpus == 1) + return; + + /* Adjust display based on ncpus */ + if (pcpu_stats) { + y_mem += ncpus - 1; /* 3 */ + y_swap += ncpus - 1; /* 4 */ + y_idlecursor += ncpus - 1; /* 5 */ + y_message += ncpus - 1; /* 5 */ + y_header += ncpus - 1; /* 6 */ + y_procs += ncpus - 1; /* 7 */ + Header_lines += ncpus - 1; /* 7 */ + } else { + y_mem = 3; + y_swap = 4; + y_idlecursor = 5; + y_message = 5; + y_header = 6; + y_procs = 7; + Header_lines = 7; + } +} + int machine_init(struct statics *statics, char do_unames) { - int pagesize; - size_t modelen; + int i, j, empty, pagesize; + size_t size; struct passwd *pw; - modelen = sizeof(smpmode); - if ((sysctlbyname("machdep.smp_active", &smpmode, &modelen, + size = sizeof(smpmode); + if ((sysctlbyname("machdep.smp_active", &smpmode, &size, NULL, 0) != 0 && - sysctlbyname("kern.smp.active", &smpmode, &modelen, + sysctlbyname("kern.smp.active", &smpmode, &size, NULL, 0) != 0) || - modelen != sizeof(smpmode)) + size != sizeof(smpmode)) smpmode = 0; if (do_unames) { @@ -299,51 +326,37 @@ machine_init(struct statics *statics, ch statics->order_names = ordernames; #endif - /* Adjust display based on ncpus */ - if (pcpu_stats) { - int i, j, empty; - size_t size; - - cpumask = 0; - ncpus = 0; - GETSYSCTL("kern.smp.maxcpus", maxcpu); - size = sizeof(long) * maxcpu * CPUSTATES; - times = malloc(size); - if (times == NULL) - err(1, "malloc %zd bytes", size); - if (sysctlbyname("kern.cp_times", times, &size, NULL, 0) == -1) - err(1, "sysctlbyname kern.cp_times"); - pcpu_cp_time = calloc(1, size); - maxid = (size / CPUSTATES / sizeof(long)) - 1; - for (i = 0; i <= maxid; i++) { - empty = 1; - for (j = 0; empty && j < CPUSTATES; j++) { - if (times[i * CPUSTATES + j] != 0) - empty = 0; - } - if (!empty) { - cpumask |= (1ul << i); - ncpus++; - } + /* Allocate state for per-CPU stats. */ + cpumask = 0; + ncpus = 0; + GETSYSCTL("kern.smp.maxcpus", maxcpu); + size = sizeof(long) * maxcpu * CPUSTATES; + times = malloc(size); + if (times == NULL) + err(1, "malloc %zd bytes", size); + if (sysctlbyname("kern.cp_times", times, &size, NULL, 0) == -1) + err(1, "sysctlbyname kern.cp_times"); + pcpu_cp_time = calloc(1, size); + maxid = (size / CPUSTATES / sizeof(long)) - 1; + for (i = 0; i <= maxid; i++) { + empty = 1; + for (j = 0; empty && j < CPUSTATES; j++) { + if (times[i * CPUSTATES + j] != 0) + empty = 0; } - - if (ncpus > 1) { - y_mem += ncpus - 1; /* 3 */ - y_swap += ncpus - 1; /* 4 */ - y_idlecursor += ncpus - 1; /* 5 */ - y_message += ncpus - 1; /* 5 */ - y_header += ncpus - 1; /* 6 */ - y_procs += ncpus - 1; /* 7 */ - Header_lines += ncpus - 1; /* 7 */ + if (!empty) { + cpumask |= (1ul << i); + ncpus++; } - size = sizeof(long) * ncpus * CPUSTATES; - pcpu_cp_old = calloc(1, size); - pcpu_cp_diff = calloc(1, size); - pcpu_cpu_states = calloc(1, size); - statics->ncpus = ncpus; - } else { - statics->ncpus = 1; } + size = sizeof(long) * ncpus * CPUSTATES; + pcpu_cp_old = calloc(1, size); + pcpu_cp_diff = calloc(1, size); + pcpu_cpu_states = calloc(1, size); + statics->ncpus = ncpus; + + if (pcpu_stats) + toggle_pcpustats(); /* all done! */ return (0); @@ -398,14 +411,11 @@ get_system_info(struct system_info *si) int i, j; size_t size; - /* get the cp_time array */ - if (pcpu_stats) { - size = (maxid + 1) * CPUSTATES * sizeof(long); - if (sysctlbyname("kern.cp_times", pcpu_cp_time, &size, NULL, 0) == -1) - err(1, "sysctlbyname kern.cp_times"); - } else { - GETSYSCTL("kern.cp_time", cp_time); - } + /* get the CPU stats */ + size = (maxid + 1) * CPUSTATES * sizeof(long); + if (sysctlbyname("kern.cp_times", pcpu_cp_time, &size, NULL, 0) == -1) + err(1, "sysctlbyname kern.cp_times"); + GETSYSCTL("kern.cp_time", cp_time); GETSYSCTL("vm.loadavg", sysload); GETSYSCTL("kern.lastpid", lastpid); @@ -413,21 +423,17 @@ get_system_info(struct system_info *si) for (i = 0; i < 3; i++) si->load_avg[i] = (double)sysload.ldavg[i] / sysload.fscale; - if (pcpu_stats) { - for (i = j = 0; i <= maxid; i++) { - if ((cpumask & (1ul << i)) == 0) - continue; - /* convert cp_time counts to percentages */ - percentages(CPUSTATES, &pcpu_cpu_states[j * CPUSTATES], - &pcpu_cp_time[j * CPUSTATES], - &pcpu_cp_old[j * CPUSTATES], - &pcpu_cp_diff[j * CPUSTATES]); - j++; - } - } else { - /* convert cp_time counts to percentages */ - percentages(CPUSTATES, cpu_states, cp_time, cp_old, cp_diff); + /* convert cp_time counts to percentages */ + for (i = j = 0; i <= maxid; i++) { + if ((cpumask & (1ul << i)) == 0) + continue; + percentages(CPUSTATES, &pcpu_cpu_states[j * CPUSTATES], + &pcpu_cp_time[j * CPUSTATES], + &pcpu_cp_old[j * CPUSTATES], + &pcpu_cp_diff[j * CPUSTATES]); + j++; } + percentages(CPUSTATES, cpu_states, cp_time, cp_old, cp_diff); /* sum memory & swap statistics */ { From owner-svn-src-stable@FreeBSD.ORG Fri Sep 16 17:41:57 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CFB11065675; Fri, 16 Sep 2011 17:41:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C6F28FC15; Fri, 16 Sep 2011 17:41:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8GHfutN031752; Fri, 16 Sep 2011 17:41:56 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8GHfuVE031750; Fri, 16 Sep 2011 17:41:56 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201109161741.p8GHfuVE031750@svn.freebsd.org> From: John Baldwin Date: Fri, 16 Sep 2011 17:41: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: r225620 - stable/8/usr.bin/top X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 17:41:57 -0000 Author: jhb Date: Fri Sep 16 17:41:56 2011 New Revision: 225620 URL: http://svn.freebsd.org/changeset/base/225620 Log: MFC 224062: Revert 130163 and let top use KERN_PROC_PROC when individual threads are not displayed. The KERN_PROC_PROC sysctl was fixed in 188764. Modified: stable/8/usr.bin/top/machine.c Directory Properties: stable/8/usr.bin/top/ (props changed) Modified: stable/8/usr.bin/top/machine.c ============================================================================== --- stable/8/usr.bin/top/machine.c Fri Sep 16 17:39:39 2011 (r225619) +++ stable/8/usr.bin/top/machine.c Fri Sep 16 17:41:56 2011 (r225620) @@ -622,7 +622,6 @@ get_process_info(struct system_info *si, int active_procs; struct kinfo_proc **prefp; struct kinfo_proc *pp; - struct kinfo_proc *prev_pp = NULL; /* these are copied out of sel for speed */ int show_idle; @@ -655,7 +654,8 @@ get_process_info(struct system_info *si, } previous_proc_count = nproc; - pbase = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc); + pbase = kvm_getprocs(kd, sel->thread ? KERN_PROC_ALL : KERN_PROC_PROC, + 0, &nproc); if (nproc > onproc) pref = realloc(pref, sizeof(*pref) * (onproc = nproc)); if (pref == NULL || pbase == NULL) { @@ -725,21 +725,8 @@ get_process_info(struct system_info *si, /* skip proc. that don't belong to the selected UID */ continue; - /* - * When not showing threads, take the first thread - * for output and add the fields that we can from - * the rest of the process's threads rather than - * using the system's mostly-broken KERN_PROC_PROC. - */ - if (sel->thread || prev_pp == NULL || - prev_pp->ki_pid != pp->ki_pid) { - *prefp++ = pp; - active_procs++; - prev_pp = pp; - } else { - prev_pp->ki_pctcpu += pp->ki_pctcpu; - prev_pp->ki_runtime += pp->ki_runtime; - } + *prefp++ = pp; + active_procs++; } /* if requested, sort the "interesting" processes */ From owner-svn-src-stable@FreeBSD.ORG Fri Sep 16 17:44:34 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 746751065672; Fri, 16 Sep 2011 17:44:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A2B98FC12; Fri, 16 Sep 2011 17:44:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8GHiYVJ031897; Fri, 16 Sep 2011 17:44:34 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8GHiYq3031895; Fri, 16 Sep 2011 17:44:34 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201109161744.p8GHiYq3031895@svn.freebsd.org> From: John Baldwin Date: Fri, 16 Sep 2011 17:44: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: r225621 - stable/8/sys/dev/mfi X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 17:44:34 -0000 Author: jhb Date: Fri Sep 16 17:44:33 2011 New Revision: 225621 URL: http://svn.freebsd.org/changeset/base/225621 Log: MFC 224039: Use MFI_STAT_* constants for cmd_status field values rather than magic numbers in a few places. Modified: stable/8/sys/dev/mfi/mfi.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/mfi/mfi.c ============================================================================== --- stable/8/sys/dev/mfi/mfi.c Fri Sep 16 17:41:56 2011 (r225620) +++ stable/8/sys/dev/mfi/mfi.c Fri Sep 16 17:44:33 2011 (r225621) @@ -1149,7 +1149,8 @@ mfi_aen_complete(struct mfi_command *cm) if (sc->mfi_aen_cm == NULL) return; - if (sc->mfi_aen_cm->cm_aen_abort || hdr->cmd_status == 0xff) { + if (sc->mfi_aen_cm->cm_aen_abort || + hdr->cmd_status == MFI_STAT_INVALID_STATUS) { sc->mfi_aen_cm->cm_aen_abort = 0; aborted = 1; } else { @@ -1405,7 +1406,7 @@ mfi_bio_complete(struct mfi_command *cm) hdr = &cm->cm_frame->header; sc = cm->cm_sc; - if ((hdr->cmd_status != 0) || (hdr->scsi_status != 0)) { + if ((hdr->cmd_status != MFI_STAT_OK) || (hdr->scsi_status != 0)) { bio->bio_flags |= BIO_ERROR; bio->bio_error = EIO; device_printf(sc->mfi_dev, "I/O error, status= %d " @@ -1549,7 +1550,7 @@ mfi_send_frame(struct mfi_softc *sc, str cm->cm_timestamp = time_uptime; mfi_enqueue_busy(cm); } else { - hdr->cmd_status = 0xff; + hdr->cmd_status = MFI_STAT_INVALID_STATUS; hdr->flags |= MFI_FRAME_DONT_POST_IN_REPLY_QUEUE; } @@ -1574,14 +1575,14 @@ mfi_send_frame(struct mfi_softc *sc, str return (0); /* This is a polled command, so busy-wait for it to complete. */ - while (hdr->cmd_status == 0xff) { + while (hdr->cmd_status == MFI_STAT_INVALID_STATUS) { DELAY(1000); tm -= 1; if (tm <= 0) break; } - if (hdr->cmd_status == 0xff) { + if (hdr->cmd_status == MFI_STAT_INVALID_STATUS) { device_printf(sc->mfi_dev, "Frame %p timed out " "command 0x%X\n", hdr, cm->cm_frame->dcmd.opcode); return (ETIMEDOUT); From owner-svn-src-stable@FreeBSD.ORG Fri Sep 16 17:47:13 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BFCB1065672; Fri, 16 Sep 2011 17:47:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01BB98FC13; Fri, 16 Sep 2011 17:47:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8GHlCtg032046; Fri, 16 Sep 2011 17:47:12 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8GHlCBl032043; Fri, 16 Sep 2011 17:47:12 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201109161747.p8GHlCBl032043@svn.freebsd.org> From: John Baldwin Date: Fri, 16 Sep 2011 17:47: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: r225622 - stable/8/sys/dev/mfi X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 17:47:13 -0000 Author: jhb Date: Fri Sep 16 17:47:12 2011 New Revision: 225622 URL: http://svn.freebsd.org/changeset/base/225622 Log: MFC 224041: Support controllers whose option ROM is disabled in the BIOS by kicking the firmware so that it boots. Modified: stable/8/sys/dev/mfi/mfi.c 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) Modified: stable/8/sys/dev/mfi/mfi.c ============================================================================== --- stable/8/sys/dev/mfi/mfi.c Fri Sep 16 17:44:33 2011 (r225621) +++ stable/8/sys/dev/mfi/mfi.c Fri Sep 16 17:47:12 2011 (r225622) @@ -260,8 +260,12 @@ mfi_transition_firmware(struct mfi_softc case MFI_FWSTATE_FLUSH_CACHE: max_wait = 20; break; + case MFI_FWSTATE_BOOT_MESSAGE_PENDING: + MFI_WRITE4(sc, MFI_IDB, MFI_FWINIT_HOTPLUG); + max_wait = 10; + break; default: - device_printf(sc->mfi_dev,"Unknown firmware state %d\n", + device_printf(sc->mfi_dev,"Unknown firmware state %#x\n", fw_state); return (ENXIO); } @@ -273,7 +277,7 @@ mfi_transition_firmware(struct mfi_softc break; } if (fw_state == cur_state) { - device_printf(sc->mfi_dev, "firmware stuck in state " + device_printf(sc->mfi_dev, "Firmware stuck in state " "%#x\n", fw_state); return (ENXIO); } Modified: stable/8/sys/dev/mfi/mfireg.h ============================================================================== --- stable/8/sys/dev/mfi/mfireg.h Fri Sep 16 17:44:33 2011 (r225621) +++ stable/8/sys/dev/mfi/mfireg.h Fri Sep 16 17:47:12 2011 (r225622) @@ -112,6 +112,7 @@ __FBSDID("$FreeBSD$"); #define MFI_FWSTATE_WAIT_HANDSHAKE 0x60000000 #define MFI_FWSTATE_FW_INIT_2 0x70000000 #define MFI_FWSTATE_DEVICE_SCAN 0x80000000 +#define MFI_FWSTATE_BOOT_MESSAGE_PENDING 0x90000000 #define MFI_FWSTATE_FLUSH_CACHE 0xa0000000 #define MFI_FWSTATE_READY 0xb0000000 #define MFI_FWSTATE_OPERATIONAL 0xc0000000 @@ -127,6 +128,7 @@ __FBSDID("$FreeBSD$"); #define MFI_FWINIT_READY 0x00000002 /* Move from operational to ready */ #define MFI_FWINIT_MFIMODE 0x00000004 /* unknown */ #define MFI_FWINIT_CLEAR_HANDSHAKE 0x00000008 /* Respond to WAIT_HANDSHAKE */ +#define MFI_FWINIT_HOTPLUG 0x00000010 /* MFI Commands */ typedef enum { From owner-svn-src-stable@FreeBSD.ORG Fri Sep 16 18:18:38 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDA48106564A; Fri, 16 Sep 2011 18:18:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ACCE78FC0C; Fri, 16 Sep 2011 18:18:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8GIIcDD033039; Fri, 16 Sep 2011 18:18:38 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8GIIcBf033037; Fri, 16 Sep 2011 18:18:38 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201109161818.p8GIIcBf033037@svn.freebsd.org> From: John Baldwin Date: Fri, 16 Sep 2011 18:18: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: r225623 - stable/8/sys/boot/forth X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 18:18:38 -0000 Author: jhb Date: Fri Sep 16 18:18:38 2011 New Revision: 225623 URL: http://svn.freebsd.org/changeset/base/225623 Log: MFC 224228: Note that the "kernel" variable in loader.conf is the name of a directory containing a kernel under /boot and that it's default value is "kernel" not "/boot/kernel/kernel". Modified: stable/8/sys/boot/forth/loader.conf.5 Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/boot/forth/loader.conf.5 ============================================================================== --- stable/8/sys/boot/forth/loader.conf.5 Fri Sep 16 17:47:12 2011 (r225622) +++ stable/8/sys/boot/forth/loader.conf.5 Fri Sep 16 18:18:38 2011 (r225623) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd January 16, 2008 +.Dd July 20, 2011 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -107,6 +107,9 @@ present file. Name of the kernel to be loaded. If no kernel name is set, no additional modules will be loaded. +The name must be a subdirectory of +.Pa /boot +that contains a kernel. .It Ar kernel_options Flags to be passed to the kernel. .It Ar password @@ -185,7 +188,7 @@ selects the video console, and selects a mute console (useful for systems with neither a video console nor a serial port). .It Va kernel -.Pq Dq Pa /boot/kernel/kernel +.Pq Dq kernel .It Va loader_conf_files .Pq Dq Pa /boot/loader.conf /boot/loader.conf.local .It Va splash_bmp_load From owner-svn-src-stable@FreeBSD.ORG Fri Sep 16 18:23:40 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23533106566B; Fri, 16 Sep 2011 18:23:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 120118FC14; Fri, 16 Sep 2011 18:23:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8GINdad033243; Fri, 16 Sep 2011 18:23:39 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8GINdK9033239; Fri, 16 Sep 2011 18:23:39 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201109161823.p8GINdK9033239@svn.freebsd.org> From: John Baldwin Date: Fri, 16 Sep 2011 18:23: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: r225624 - stable/8/sys/nfsclient X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 18:23:40 -0000 Author: jhb Date: Fri Sep 16 18:23:39 2011 New Revision: 225624 URL: http://svn.freebsd.org/changeset/base/225624 Log: MFC 224733: Allow the NFS client to use a max file size larger than 1TB for v3 mounts. It now allows files up to OFF_MAX subject to whatever limit the server advertises. Modified: stable/8/sys/nfsclient/nfs_bio.c stable/8/sys/nfsclient/nfs_vfsops.c stable/8/sys/nfsclient/nfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/nfsclient/nfs_bio.c ============================================================================== --- stable/8/sys/nfsclient/nfs_bio.c Fri Sep 16 18:18:38 2011 (r225623) +++ stable/8/sys/nfsclient/nfs_bio.c Fri Sep 16 18:23:39 2011 (r225624) @@ -438,6 +438,7 @@ nfs_bioread(struct vnode *vp, struct uio struct thread *td; struct nfsmount *nmp = VFSTONFS(vp->v_mount); daddr_t lbn, rabn; + off_t end; int bcount; int seqcount; int nra, error = 0, n = 0, on = 0; @@ -457,8 +458,9 @@ nfs_bioread(struct vnode *vp, struct uio } else mtx_unlock(&nmp->nm_mtx); + end = uio->uio_offset + uio->uio_resid; if (vp->v_type != VDIR && - (uio->uio_offset + uio->uio_resid) > nmp->nm_maxfilesize) + (end > nmp->nm_maxfilesize || end < uio->uio_offset)) return (EFBIG); if (nfs_directio_enable && (ioflag & IO_DIRECT) && (vp->v_type == VREG)) @@ -858,6 +860,7 @@ nfs_write(struct vop_write_args *ap) struct vattr vattr; struct nfsmount *nmp = VFSTONFS(vp->v_mount); daddr_t lbn; + off_t end; int bcount; int n, on, error = 0; @@ -925,7 +928,8 @@ flush_and_restart: if (uio->uio_offset < 0) return (EINVAL); - if ((uio->uio_offset + uio->uio_resid) > nmp->nm_maxfilesize) + end = uio->uio_offset + uio->uio_resid; + if (end > nmp->nm_maxfilesize || end < uio->uio_offset) return (EFBIG); if (uio->uio_resid == 0) return (0); Modified: stable/8/sys/nfsclient/nfs_vfsops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vfsops.c Fri Sep 16 18:18:38 2011 (r225623) +++ stable/8/sys/nfsclient/nfs_vfsops.c Fri Sep 16 18:23:39 2011 (r225624) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1226,13 +1227,11 @@ mountnfs(struct nfs_args *argp, struct m * * For V3, nfs_fsinfo will adjust this as necessary. Assume maximum * that we can handle until we find out otherwise. - * XXX Our "safe" limit on the client is what we can store in our - * buffer cache using signed(!) block numbers. */ if ((argp->flags & NFSMNT_NFSV3) == 0) nmp->nm_maxfilesize = 0xffffffffLL; else - nmp->nm_maxfilesize = (u_int64_t)0x80000000 * DEV_BSIZE - 1; + nmp->nm_maxfilesize = OFF_MAX; nmp->nm_timeo = NFS_TIMEO; nmp->nm_retry = NFS_RETRANS; Modified: stable/8/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vnops.c Fri Sep 16 18:18:38 2011 (r225623) +++ stable/8/sys/nfsclient/nfs_vnops.c Fri Sep 16 18:23:39 2011 (r225624) @@ -1277,6 +1277,7 @@ nfs_readrpc(struct vnode *vp, struct uio caddr_t bpos, dpos; struct mbuf *mreq, *mrep, *md, *mb; struct nfsmount *nmp; + off_t end; int error = 0, len, retlen, tsiz, eof, attrflag; int v3 = NFS_ISV3(vp); int rsize; @@ -1287,7 +1288,8 @@ nfs_readrpc(struct vnode *vp, struct uio nmp = VFSTONFS(vp->v_mount); tsiz = uiop->uio_resid; mtx_lock(&nmp->nm_mtx); - if (uiop->uio_offset + tsiz > nmp->nm_maxfilesize) { + end = uiop->uio_offset + tsiz; + if (end > nmp->nm_maxfilesize || end < uiop->uio_offset) { mtx_unlock(&nmp->nm_mtx); return (EFBIG); } @@ -1349,6 +1351,7 @@ nfs_writerpc(struct vnode *vp, struct ui caddr_t bpos, dpos; struct mbuf *mreq, *mrep, *md, *mb; struct nfsmount *nmp = VFSTONFS(vp->v_mount); + off_t end; int error = 0, len, tsiz, wccflag = NFSV3_WCCRATTR, rlen, commit; int v3 = NFS_ISV3(vp), committed = NFSV3WRITE_FILESYNC; int wsize; @@ -1357,7 +1360,8 @@ nfs_writerpc(struct vnode *vp, struct ui *must_commit = 0; tsiz = uiop->uio_resid; mtx_lock(&nmp->nm_mtx); - if (uiop->uio_offset + tsiz > nmp->nm_maxfilesize) { + end = uiop->uio_offset + tsiz; + if (end > nmp->nm_maxfilesize || end < uiop->uio_offset) { mtx_unlock(&nmp->nm_mtx); return (EFBIG); } From owner-svn-src-stable@FreeBSD.ORG Fri Sep 16 18:26:41 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D379106564A; Fri, 16 Sep 2011 18:26:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 130D28FC08; Fri, 16 Sep 2011 18:26:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8GIQeCJ033380; Fri, 16 Sep 2011 18:26:40 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8GIQeGS033378; Fri, 16 Sep 2011 18:26:40 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201109161826.p8GIQeGS033378@svn.freebsd.org> From: John Baldwin Date: Fri, 16 Sep 2011 18:26: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: r225625 - stable/8/sys/sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 18:26:41 -0000 Author: jhb Date: Fri Sep 16 18:26:40 2011 New Revision: 225625 URL: http://svn.freebsd.org/changeset/base/225625 Log: MFC 225079: Add two new macros DRIVER_MODULE_ORDERED() and EARLY_DRIVER_MODULE_ORDERED() that allow a module to use an order other than the default of SI_ORDER_MIDDLE when registering a driver. This can be useful for drivers in a kld that contain multiple new-bus drivers as part of one logical device driver. A typical case would be to use SI_ORDER_LAST for the "main" driver to ensure that any other "helper" drivers are registered and available before the "main" driver attempts to attach. Modified: stable/8/sys/sys/bus.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/sys/bus.h ============================================================================== --- stable/8/sys/sys/bus.h Fri Sep 16 18:23:39 2011 (r225624) +++ stable/8/sys/sys/bus.h Fri Sep 16 18:26:40 2011 (r225625) @@ -575,7 +575,8 @@ struct driver_module_data { int dmd_pass; }; -#define EARLY_DRIVER_MODULE(name, busname, driver, devclass, evh, arg, pass) \ +#define EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass, \ + evh, arg, order, pass) \ \ static struct driver_module_data name##_##busname##_driver_mod = { \ evh, arg, \ @@ -591,7 +592,16 @@ static moduledata_t name##_##busname##_m &name##_##busname##_driver_mod \ }; \ DECLARE_MODULE(name##_##busname, name##_##busname##_mod, \ - SI_SUB_DRIVERS, SI_ORDER_MIDDLE) + SI_SUB_DRIVERS, order) + +#define EARLY_DRIVER_MODULE(name, busname, driver, devclass, evh, arg, pass) \ + EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass, \ + evh, arg, SI_ORDER_MIDDLE, pass) + +#define DRIVER_MODULE_ORDERED(name, busname, driver, devclass, evh, arg,\ + order) \ + EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass, \ + evh, arg, order, BUS_PASS_DEFAULT) #define DRIVER_MODULE(name, busname, driver, devclass, evh, arg) \ EARLY_DRIVER_MODULE(name, busname, driver, devclass, evh, arg, \ From owner-svn-src-stable@FreeBSD.ORG Fri Sep 16 18:36:44 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A207106564A; Fri, 16 Sep 2011 18:36:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D3D698FC14; Fri, 16 Sep 2011 18:36:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8GIahZo033729; Fri, 16 Sep 2011 18:36:43 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8GIahoB033725; Fri, 16 Sep 2011 18:36:43 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201109161836.p8GIahoB033725@svn.freebsd.org> From: John Baldwin Date: Fri, 16 Sep 2011 18:36:43 +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: r225626 - in stable/8/sys: amd64/amd64 amd64/conf conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 18:36:44 -0000 Author: jhb Date: Fri Sep 16 18:36:43 2011 New Revision: 225626 URL: http://svn.freebsd.org/changeset/base/225626 Log: MFC 225194: Make NKPT a kernel option on amd64 so that it can be set to a non-default value from kernel config files. Modified: stable/8/sys/amd64/amd64/minidump_machdep.c stable/8/sys/amd64/conf/NOTES stable/8/sys/conf/options.amd64 Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/amd64/amd64/minidump_machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/minidump_machdep.c Fri Sep 16 18:26:40 2011 (r225625) +++ stable/8/sys/amd64/amd64/minidump_machdep.c Fri Sep 16 18:36:43 2011 (r225626) @@ -27,6 +27,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_pmap.h" #include "opt_watchdog.h" #include Modified: stable/8/sys/amd64/conf/NOTES ============================================================================== --- stable/8/sys/amd64/conf/NOTES Fri Sep 16 18:26:40 2011 (r225625) +++ stable/8/sys/amd64/conf/NOTES Fri Sep 16 18:36:43 2011 (r225626) @@ -493,6 +493,14 @@ options ENABLE_ALART # Control alarm o # options PMAP_SHPGPERPROC=201 +# +# Number of initial kernel page table pages used for early bootstrap. +# This number should include enough pages to map the kernel and any +# modules or other data loaded with the kernel by the loader. Each +# page table page maps 2MB. +# +options NKPT=31 + ##################################################################### # ABI Emulation Modified: stable/8/sys/conf/options.amd64 ============================================================================== --- stable/8/sys/conf/options.amd64 Fri Sep 16 18:26:40 2011 (r225625) +++ stable/8/sys/conf/options.amd64 Fri Sep 16 18:36:43 2011 (r225626) @@ -8,6 +8,7 @@ PERFMON PMAP_SHPGPERPROC opt_pmap.h MPTABLE_FORCE_HTT MP_WATCHDOG +NKPT opt_pmap.h # Options for emulators. These should only be used at config time, so # they are handled like options for static filesystems From owner-svn-src-stable@FreeBSD.ORG Fri Sep 16 18:41:20 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C8BD1065670; Fri, 16 Sep 2011 18:41:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D61048FC16; Fri, 16 Sep 2011 18:41:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8GIfJ1K033909; Fri, 16 Sep 2011 18:41:19 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8GIfJO9033906; Fri, 16 Sep 2011 18:41:19 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201109161841.p8GIfJO9033906@svn.freebsd.org> From: John Baldwin Date: Fri, 16 Sep 2011 18:41: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: r225627 - in stable/8/sys: amd64/conf i386/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 18:41:20 -0000 Author: jhb Date: Fri Sep 16 18:41:19 2011 New Revision: 225627 URL: http://svn.freebsd.org/changeset/base/225627 Log: MFC 225201: Enable the puc(4) driver on amd64 and i386 in GENERIC. This allows devices supported by puc(4) to work "out of the box" since puc.ko does not work "out of the box". Modified: stable/8/sys/amd64/conf/GENERIC stable/8/sys/i386/conf/GENERIC Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/amd64/conf/GENERIC ============================================================================== --- stable/8/sys/amd64/conf/GENERIC Fri Sep 16 18:36:43 2011 (r225626) +++ stable/8/sys/amd64/conf/GENERIC Fri Sep 16 18:41:19 2011 (r225627) @@ -189,10 +189,7 @@ device plip # TCP/IP over parallel device ppi # Parallel port interface device #device vpo # Requires scbus and da -# If you've got a "dumb" serial or parallel PCI card that is -# supported by the puc(4) glue driver, uncomment the following -# line to enable it (connects to sio, uart and/or ppc drivers): -#device puc +device puc # Multi I/O cards and multi-channel UARTs # PCI Ethernet NICs. device de # DEC/Intel DC21x4x (``Tulip'') Modified: stable/8/sys/i386/conf/GENERIC ============================================================================== --- stable/8/sys/i386/conf/GENERIC Fri Sep 16 18:36:43 2011 (r225626) +++ stable/8/sys/i386/conf/GENERIC Fri Sep 16 18:41:19 2011 (r225627) @@ -199,10 +199,7 @@ device plip # TCP/IP over parallel device ppi # Parallel port interface device #device vpo # Requires scbus and da -# If you've got a "dumb" serial or parallel PCI card that is -# supported by the puc(4) glue driver, uncomment the following -# line to enable it (connects to sio, uart and/or ppc drivers): -#device puc +device puc # Multi I/O cards and multi-channel UARTs # PCI Ethernet NICs. device de # DEC/Intel DC21x4x (``Tulip'') From owner-svn-src-stable@FreeBSD.ORG Fri Sep 16 19:29:12 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 493D1106566B; Fri, 16 Sep 2011 19:29:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 384648FC14; Fri, 16 Sep 2011 19:29:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8GJTCk8035554; Fri, 16 Sep 2011 19:29:12 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8GJTC2i035552; Fri, 16 Sep 2011 19:29:12 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201109161929.p8GJTC2i035552@svn.freebsd.org> From: John Baldwin Date: Fri, 16 Sep 2011 19:29: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: r225628 - stable/8/sbin/ipfw X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 19:29:12 -0000 Author: jhb Date: Fri Sep 16 19:29:11 2011 New Revision: 225628 URL: http://svn.freebsd.org/changeset/base/225628 Log: MFC 224942: Fix a regression where a rule containing a source port option after a destination IP would incorrectly display the source port as a destination port. Modified: stable/8/sbin/ipfw/ipfw2.c Directory Properties: stable/8/sbin/ipfw/ (props changed) Modified: stable/8/sbin/ipfw/ipfw2.c ============================================================================== --- stable/8/sbin/ipfw/ipfw2.c Fri Sep 16 18:41:19 2011 (r225627) +++ stable/8/sbin/ipfw/ipfw2.c Fri Sep 16 19:29:11 2011 (r225628) @@ -1263,6 +1263,8 @@ show_ipfw(struct ip_fw *rule, int pcwidt HAVE_PROTO | HAVE_SRCIP | HAVE_DSTIP | HAVE_IP, 0); case O_IP_SRCPORT: + if (flags & HAVE_DSTIP) + flags |= HAVE_IP; show_prerequisites(&flags, HAVE_PROTO | HAVE_SRCIP, 0); if ((cmd->len & F_OR) && !or_block) From owner-svn-src-stable@FreeBSD.ORG Fri Sep 16 19:52:49 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 881551065674; Fri, 16 Sep 2011 19:52:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DFC98FC1B; Fri, 16 Sep 2011 19:52:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8GJqnj4036326; Fri, 16 Sep 2011 19:52:49 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8GJqnAr036324; Fri, 16 Sep 2011 19:52:49 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201109161952.p8GJqnAr036324@svn.freebsd.org> From: John Baldwin Date: Fri, 16 Sep 2011 19: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: r225629 - stable/8/gnu/usr.bin/gdb/kgdb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 19:52:49 -0000 Author: jhb Date: Fri Sep 16 19:52:49 2011 New Revision: 225629 URL: http://svn.freebsd.org/changeset/base/225629 Log: MFC 225017: Walk the zombproc list as well as the allproc list when enumerating threads and processes in a kernel image. This allows examination of threads that have exited or are in the late stages of exiting. Modified: stable/8/gnu/usr.bin/gdb/kgdb/kthr.c Directory Properties: stable/8/gnu/usr.bin/gdb/kgdb/ (props changed) Modified: stable/8/gnu/usr.bin/gdb/kgdb/kthr.c ============================================================================== --- stable/8/gnu/usr.bin/gdb/kgdb/kthr.c Fri Sep 16 19:29:11 2011 (r225628) +++ stable/8/gnu/usr.bin/gdb/kgdb/kthr.c Fri Sep 16 19:52:49 2011 (r225629) @@ -72,12 +72,53 @@ kgdb_thr_first(void) return (first); } -struct kthr * -kgdb_thr_init(void) +static void +kgdb_thr_add_procs(uintptr_t paddr) { struct proc p; struct thread td; struct kthr *kt; + CORE_ADDR addr; + + while (paddr != 0) { + if (kvm_read(kvm, paddr, &p, sizeof(p)) != sizeof(p)) { + warnx("kvm_read: %s", kvm_geterr(kvm)); + break; + } + addr = (uintptr_t)TAILQ_FIRST(&p.p_threads); + while (addr != 0) { + if (kvm_read(kvm, addr, &td, sizeof(td)) != + sizeof(td)) { + warnx("kvm_read: %s", kvm_geterr(kvm)); + break; + } + kt = malloc(sizeof(*kt)); + kt->next = first; + kt->kaddr = addr; + if (td.td_tid == dumptid) + kt->pcb = dumppcb; + else if (td.td_state == TDS_RUNNING && ((1 << td.td_oncpu) & stopped_cpus) + && stoppcbs != 0) + kt->pcb = (uintptr_t)stoppcbs + + sizeof(struct pcb) * td.td_oncpu; + else + kt->pcb = (uintptr_t)td.td_pcb; + kt->kstack = td.td_kstack; + kt->tid = td.td_tid; + kt->pid = p.p_pid; + kt->paddr = paddr; + kt->cpu = td.td_oncpu; + first = kt; + addr = (uintptr_t)TAILQ_NEXT(&td, td_plist); + } + paddr = (uintptr_t)LIST_NEXT(&p, p_list); + } +} + +struct kthr * +kgdb_thr_init(void) +{ + struct kthr *kt; uintptr_t addr, paddr; while (first != NULL) { @@ -113,37 +154,11 @@ kgdb_thr_init(void) stoppcbs = kgdb_lookup("_stoppcbs"); - while (paddr != 0) { - if (kvm_read(kvm, paddr, &p, sizeof(p)) != sizeof(p)) { - warnx("kvm_read: %s", kvm_geterr(kvm)); - break; - } - addr = (uintptr_t)TAILQ_FIRST(&p.p_threads); - while (addr != 0) { - if (kvm_read(kvm, addr, &td, sizeof(td)) != - sizeof(td)) { - warnx("kvm_read: %s", kvm_geterr(kvm)); - break; - } - kt = malloc(sizeof(*kt)); - kt->next = first; - kt->kaddr = addr; - if (td.td_tid == dumptid) - kt->pcb = dumppcb; - else if (td.td_state == TDS_RUNNING && ((1 << td.td_oncpu) & stopped_cpus) - && stoppcbs != 0) - kt->pcb = (uintptr_t) stoppcbs + sizeof(struct pcb) * td.td_oncpu; - else - kt->pcb = (uintptr_t)td.td_pcb; - kt->kstack = td.td_kstack; - kt->tid = td.td_tid; - kt->pid = p.p_pid; - kt->paddr = paddr; - kt->cpu = td.td_oncpu; - first = kt; - addr = (uintptr_t)TAILQ_NEXT(&td, td_plist); - } - paddr = (uintptr_t)LIST_NEXT(&p, p_list); + kgdb_thr_add_procs(paddr); + addr = kgdb_lookup("zombproc"); + if (addr != 0) { + kvm_read(kvm, addr, &paddr, sizeof(paddr)); + kgdb_thr_add_procs(paddr); } curkthr = kgdb_thr_lookup_tid(dumptid); if (curkthr == NULL) From owner-svn-src-stable@FreeBSD.ORG Fri Sep 16 19:53:56 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 730681065677; Fri, 16 Sep 2011 19:53:56 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6221F8FC0A; Fri, 16 Sep 2011 19:53:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8GJrubB036408; Fri, 16 Sep 2011 19:53:56 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8GJrurq036406; Fri, 16 Sep 2011 19:53:56 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201109161953.p8GJrurq036406@svn.freebsd.org> From: John Baldwin Date: Fri, 16 Sep 2011 19:53: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: r225630 - stable/8/share/man/man4 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 19:53:56 -0000 Author: jhb Date: Fri Sep 16 19:53:56 2011 New Revision: 225630 URL: http://svn.freebsd.org/changeset/base/225630 Log: MFC 225200: - Replace references to sio(4) with uart(4) instead. - We no longer use the same data structure in as NetBSD in pucdata.c. - ppc(4) has had a puc(4) attachment for a while now. Modified: stable/8/share/man/man4/puc.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/puc.4 ============================================================================== --- stable/8/share/man/man4/puc.4 Fri Sep 16 19:52:49 2011 (r225629) +++ stable/8/share/man/man4/puc.4 Fri Sep 16 19:53:56 2011 (r225630) @@ -35,11 +35,11 @@ Communications driver .Sh SYNOPSIS .Cd "device pci" .Cd "device puc" -.Cd "device sio" +.Cd "device uart" .Cd "device ppc" .Sh DESCRIPTION This driver acts as a shim to connect PCI serial and parallel ports to the -.Xr sio 4 +.Xr uart 4 and .Xr ppc 4 driver. @@ -49,14 +49,9 @@ The list of supported devices is in Support for new cards should be added there. .Sh SEE ALSO .Xr ppc 4 , -.Xr sio 4 +.Xr uart 4 .Sh HISTORY This driver took the idea from the .Nx .Xr puc 4 -driver and still uses the same structure to describe cards, to ease exchanging -card info. -.Sh BUGS -Only serial ports are supported through the -.Xr sio 4 -driver at the moment. +driver.