svn commit: r234863 - head/sys/mips/conf
Author: adrian Date: Tue May 1 06:21:02 2012 New Revision: 234863 URL: http://svn.freebsd.org/changeset/base/234863 Log: Convert AP96 to use the mdioproxy and ARGE_MDIO option. arge1 still works (it's the standalone PHY) but arge0 and the other switch ports don't work. They're enumerated though, demonstrating that the mdiobus abstraction is correctly working. Modified: head/sys/mips/conf/AP96 head/sys/mips/conf/AP96.hints Modified: head/sys/mips/conf/AP96 == --- head/sys/mips/conf/AP96 Tue May 1 06:18:30 2012(r234862) +++ head/sys/mips/conf/AP96 Tue May 1 06:21:02 2012(r234863) @@ -40,3 +40,7 @@ options ROOTDEVNAME=\"ufs:map/ro optionsAR71XX_ATH_EEPROM # Fetch EEPROM/PCI config from flash optionsATH_EEPROM_FIRMWARE # Use EEPROM from flash device firmware# Used by the above + +# Options required for miiproxy and mdiobus +optionsARGE_MDIO # Export an MDIO bus separate from arge +device miiproxy# MDIO bus <-> MII PHY rendezvous Modified: head/sys/mips/conf/AP96.hints == --- head/sys/mips/conf/AP96.hints Tue May 1 06:18:30 2012 (r234862) +++ head/sys/mips/conf/AP96.hints Tue May 1 06:21:02 2012 (r234863) @@ -1,15 +1,33 @@ # $FreeBSD$ +# arge0 MDIO bus - there's no arge1 MDIO bus for AR71xx +hint.argemdio.0.at="nexus0" +hint.argemdio.0.maddr=0x1900 +hint.argemdio.0.msize=0x1000 +hint.argemdio.0.order=0 + +# Create two mdioproxy instances - by default only one is created +# per mdiobus above. +hint.mdioproxy.0.at="mdio0" +hint.mdioproxy.1.at="mdio0" + # TODO: RGMII +# XXX this port currently doesn't work with the current configuration. hint.arge.0.phymask=0x0f hint.arge.0.media=1000 hint.arge.0.fduplex=1 +# For now, rendezouvs this on the arge0 mdiobus. +# Later, this will rendezvous via the AR8316 switch. +hint.arge.0.mdio=mdioproxy0 # TODO: RGMII # TODO: pll_1000 = 0x1f00 hint.arge.1.phymask=0x10 # hint.arge.1.media=1000 # hint.arge.1.fduplex=1 +# For now, rendezouvs this on the arge0 mdiobus. +# Later, this will rendezvous via the AR8316 switch. +hint.arge.1.mdio=mdioproxy1 # ath0 - slot 17 hint.pcib.0.bus.0.17.0.ath_fixup_addr=0x1fff1000 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234864 - stable/9/sys/netinet
Author: tuexen Date: Tue May 1 07:15:18 2012 New Revision: 234864 URL: http://svn.freebsd.org/changeset/base/234864 Log: MFC r234762: Whitespace changes. Modified: stable/9/sys/netinet/sctp_usrreq.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/sctp_usrreq.c == --- stable/9/sys/netinet/sctp_usrreq.c Tue May 1 06:21:02 2012 (r234863) +++ stable/9/sys/netinet/sctp_usrreq.c Tue May 1 07:15:18 2012 (r234864) @@ -79,7 +79,6 @@ sctp_init(void) * now I will just copy. */ SCTP_BASE_SYSCTL(sctp_recvspace) = SCTP_BASE_SYSCTL(sctp_sendspace); - SCTP_BASE_VAR(first_time) = 0; SCTP_BASE_VAR(sctp_pcb_initialized) = 0; sctp_pcb_init(); @@ -88,8 +87,6 @@ sctp_init(void) SCTP_BASE_VAR(packet_log_end) = 0; bzero(&SCTP_BASE_VAR(packet_log_buffer), SCTP_PACKET_LOG_SIZE); #endif - - } void ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234865 - stable/8/sys/netinet
Author: tuexen Date: Tue May 1 07:27:23 2012 New Revision: 234865 URL: http://svn.freebsd.org/changeset/base/234865 Log: MFC r234762: Whitespace changes. Modified: stable/8/sys/netinet/sctp_usrreq.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/sctp_usrreq.c == --- stable/8/sys/netinet/sctp_usrreq.c Tue May 1 07:15:18 2012 (r234864) +++ stable/8/sys/netinet/sctp_usrreq.c Tue May 1 07:27:23 2012 (r234865) @@ -79,7 +79,6 @@ sctp_init(void) * now I will just copy. */ SCTP_BASE_SYSCTL(sctp_recvspace) = SCTP_BASE_SYSCTL(sctp_sendspace); - SCTP_BASE_VAR(first_time) = 0; SCTP_BASE_VAR(sctp_pcb_initialized) = 0; sctp_pcb_init(); @@ -88,8 +87,6 @@ sctp_init(void) SCTP_BASE_VAR(packet_log_end) = 0; bzero(&SCTP_BASE_VAR(packet_log_buffer), SCTP_PACKET_LOG_SIZE); #endif - - } void ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234866 - head/sys/modules/mwl
Author: uqs Date: Tue May 1 07:38:40 2012 New Revision: 234866 URL: http://svn.freebsd.org/changeset/base/234866 Log: Fix make depend. Modified: head/sys/modules/mwl/Makefile Modified: head/sys/modules/mwl/Makefile == --- head/sys/modules/mwl/Makefile Tue May 1 07:27:23 2012 (r234865) +++ head/sys/modules/mwl/Makefile Tue May 1 07:38:40 2012 (r234866) @@ -33,7 +33,7 @@ KMOD= if_mwl SRCS= if_mwl.c if_mwl_pci.c mwlhal.c -SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_mwl.h +SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_mwl.h opt_wlan.h opt_mwl.h: echo '#define MWL_DEBUG 1'> $@ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234867 - head/sys/fs/unionfs
Author: daichi Date: Tue May 1 07:46:30 2012 New Revision: 234867 URL: http://svn.freebsd.org/changeset/base/234867 Log: - fixed a vnode lock hang-up issue. - fixed an incorrect lock status issue. - fixed an incorrect lock issue of unionfs root vnode removed. (pointed out by keith) - fixed an infinity loop issue. (pointed out by dumbbell) - changed to do LK_RELEASE expressly when unlocked. Submitted by: oz...@ongs.co.jp Modified: head/sys/fs/unionfs/union_subr.c head/sys/fs/unionfs/union_vfsops.c head/sys/fs/unionfs/union_vnops.c Modified: head/sys/fs/unionfs/union_subr.c == --- head/sys/fs/unionfs/union_subr.cTue May 1 07:38:40 2012 (r234866) +++ head/sys/fs/unionfs/union_subr.cTue May 1 07:46:30 2012 (r234867) @@ -2,8 +2,8 @@ * Copyright (c) 1994 Jan-Simon Pendry * Copyright (c) 1994 * The Regents of the University of California. All rights reserved. - * Copyright (c) 2005, 2006 Masanori Ozawa , ONGS Inc. - * Copyright (c) 2006 Daichi Goto + * Copyright (c) 2005, 2006, 2012 Masanori Ozawa , ONGS Inc. + * Copyright (c) 2006, 2012 Daichi Goto * * This code is derived from software contributed to Berkeley by * Jan-Simon Pendry. @@ -350,19 +350,22 @@ unionfs_noderem(struct vnode *vp, struct uvp = unp->un_uppervp; dvp = unp->un_dvp; unp->un_lowervp = unp->un_uppervp = NULLVP; - vp->v_vnlock = &(vp->v_lock); vp->v_data = NULL; - lockmgr(vp->v_vnlock, LK_EXCLUSIVE | LK_INTERLOCK, VI_MTX(vp)); + vp->v_object = NULL; + VI_UNLOCK(vp); + if (lvp != NULLVP) - VOP_UNLOCK(lvp, 0); + VOP_UNLOCK(lvp, LK_RELEASE); if (uvp != NULLVP) - VOP_UNLOCK(uvp, 0); - vp->v_object = NULL; + VOP_UNLOCK(uvp, LK_RELEASE); if (dvp != NULLVP && unp->un_hash.le_prev != NULL) unionfs_rem_cached_vnode(unp, dvp); + if (lockmgr(vp->v_vnlock, LK_EXCLUSIVE, VI_MTX(vp)) != 0) + panic("the lock for deletion is unacquirable."); + if (lvp != NULLVP) { vfslocked = VFS_LOCK_GIANT(lvp->v_mount); vrele(lvp); @@ -550,7 +553,7 @@ unionfs_relookup(struct vnode *dvp, stru cn->cn_flags |= (cnp->cn_flags & SAVESTART); vref(dvp); - VOP_UNLOCK(dvp, 0); + VOP_UNLOCK(dvp, LK_RELEASE); if ((error = relookup(dvp, vpp, cn))) { uma_zfree(namei_zone, cn->cn_pnbuf); @@ -957,7 +960,7 @@ unionfs_vn_create_on_upper(struct vnode *vpp = vp; unionfs_vn_create_on_upper_free_out1: - VOP_UNLOCK(udvp, 0); + VOP_UNLOCK(udvp, LK_RELEASE); unionfs_vn_create_on_upper_free_out2: if (cn.cn_flags & HASBUF) { Modified: head/sys/fs/unionfs/union_vfsops.c == --- head/sys/fs/unionfs/union_vfsops.c Tue May 1 07:38:40 2012 (r234866) +++ head/sys/fs/unionfs/union_vfsops.c Tue May 1 07:46:30 2012 (r234867) @@ -1,8 +1,8 @@ /*- * Copyright (c) 1994, 1995 The Regents of the University of California. * Copyright (c) 1994, 1995 Jan-Simon Pendry. - * Copyright (c) 2005, 2006 Masanori Ozawa , ONGS Inc. - * Copyright (c) 2006 Daichi Goto + * Copyright (c) 2005, 2006, 2012 Masanori Ozawa , ONGS Inc. + * Copyright (c) 2006, 2012 Daichi Goto * All rights reserved. * * This code is derived from software donated to Berkeley by @@ -165,7 +165,7 @@ unionfs_domount(struct mount *mp) uid = va.va_uid; gid = va.va_gid; } - VOP_UNLOCK(mp->mnt_vnodecovered, 0); + VOP_UNLOCK(mp->mnt_vnodecovered, LK_RELEASE); if (error) return (error); @@ -250,7 +250,7 @@ unionfs_domount(struct mount *mp) * Save reference */ if (below) { - VOP_UNLOCK(upperrootvp, 0); + VOP_UNLOCK(upperrootvp, LK_RELEASE); vn_lock(lowerrootvp, LK_EXCLUSIVE | LK_RETRY); ump->um_lowervp = upperrootvp; ump->um_uppervp = lowerrootvp; @@ -281,7 +281,7 @@ unionfs_domount(struct mount *mp) /* * Unlock the node */ - VOP_UNLOCK(ump->um_uppervp, 0); + VOP_UNLOCK(ump->um_uppervp, LK_RELEASE); /* * Get the unionfs root vnode. Modified: head/sys/fs/unionfs/union_vnops.c == --- head/sys/fs/unionfs/union_vnops.c Tue May 1 07:38:40 2012 (r234866) +++ head/sys/fs/unionfs/union_vnops.c Tue May 1 07:46:30 2012 (r234867) @@ -2,8 +2,8 @@ * Copyright (c) 1992, 1993, 1994, 1995 Jan-Simon Pendry. * Copyright (c) 1992, 1993, 1994, 1995 * The Regents of the University of California. - * Copyright (c) 2005, 2006 Masanori Ozawa , ONGS Inc. - * Copyright (c) 20
svn commit: r234868 - head/sys/geom/raid
Author: mav Date: Tue May 1 08:19:29 2012 New Revision: 234868 URL: http://svn.freebsd.org/changeset/base/234868 Log: Improve DDF metadata writing. Modified: head/sys/geom/raid/md_ddf.c Modified: head/sys/geom/raid/md_ddf.c == --- head/sys/geom/raid/md_ddf.c Tue May 1 07:46:30 2012(r234867) +++ head/sys/geom/raid/md_ddf.c Tue May 1 08:19:29 2012(r234868) @@ -89,9 +89,9 @@ struct g_raid_md_ddf_pervolume { struct g_raid_md_ddf_object { struct g_raid_md_object mdio_base; struct ddf_meta mdio_meta; + int mdio_starting; struct callout mdio_start_co; /* STARTING state timer. */ int mdio_started; - int mdio_incomplete; struct root_hold_token *mdio_rootmount; /* Root mount delay token. */ }; @@ -835,7 +835,8 @@ ddf_vol_meta_create(struct ddf_vol_meta } static void -ddf_vol_meta_update(struct ddf_vol_meta *dst, struct ddf_meta *src, uint8_t *GUID) +ddf_vol_meta_update(struct ddf_vol_meta *dst, struct ddf_meta *src, +uint8_t *GUID, int started) { struct ddf_header *hdr; struct ddf_vd_entry *vde; @@ -850,15 +851,15 @@ ddf_vol_meta_update(struct ddf_vol_meta size = GET16(src, hdr->Configuration_Record_Length) * src->sectorsize; if (dst->vdc == NULL || - ((int32_t)(GET32D(src, vdc->Sequence_Number) - - GET32(dst, vdc->Sequence_Number))) > 0) + (!started && ((int32_t)(GET32D(src, vdc->Sequence_Number) - + GET32(dst, vdc->Sequence_Number))) > 0)) vnew = 1; else vnew = 0; if (dst->bvdc[bvd] == NULL || - ((int32_t)(GET32D(src, vdc->Sequence_Number) - - GET32(dst, bvdc[bvd]->Sequence_Number))) > 0) + (!started && ((int32_t)(GET32D(src, vdc->Sequence_Number) - + GET32(dst, bvdc[bvd]->Sequence_Number))) > 0)) bvnew = 1; else bvnew = 0; @@ -1803,6 +1804,7 @@ g_raid_md_ddf_start(struct g_raid_volume struct g_raid_disk *disk; struct g_raid_md_object *md; struct g_raid_md_ddf_pervolume *pv; + struct g_raid_md_ddf_object *mdi; struct ddf_vol_meta *vmeta; struct ddf_vdc_record *vdc; uint64_t *val2; @@ -1810,6 +1812,7 @@ g_raid_md_ddf_start(struct g_raid_volume sc = vol->v_softc; md = sc->sc_md; + mdi = (struct g_raid_md_ddf_object *)md; pv = vol->v_md_data; vmeta = &pv->pv_meta; vdc = vmeta->vdc; @@ -1862,6 +1865,7 @@ g_raid_md_ddf_start(struct g_raid_volume } pv->pv_started = 1; + mdi->mdio_starting--; callout_stop(&pv->pv_start_co); G_RAID_DEBUG1(0, sc, "Volume started."); g_raid_md_write_ddf(md, vol, NULL, NULL); @@ -1948,13 +1952,13 @@ g_raid_md_ddf_new_disk(struct g_raid_dis callout_reset(&pv->pv_start_co, g_raid_start_timeout * hz, g_raid_ddf_go, vol); + mdi->mdio_starting++; } else pv = vol->v_md_data; /* If we haven't started yet - check metadata freshness. */ vmeta = &pv->pv_meta; - if (vmeta->hdr == NULL || !pv->pv_started) - ddf_vol_meta_update(vmeta, pdmeta, vdc->VD_GUID); + ddf_vol_meta_update(vmeta, pdmeta, vdc->VD_GUID, pv->pv_started); } if (spare == 1) { @@ -2649,26 +2653,29 @@ g_raid_md_write_ddf(struct g_raid_md_obj if (sc->sc_stopping == G_RAID_DESTROY_HARD) return (0); - /* Generate new per-volume metadata for affected volumes. */ - TAILQ_FOREACH(vol, &sc->sc_volumes, v_next) { - if (vol->v_stopping) - continue; - - /* Skip volumes not related to specified targets. */ - if (tvol != NULL && vol != tvol) - continue; - if (tsd != NULL && vol != tsd->sd_volume) - continue; - if (tdisk != NULL) { - for (i = 0; i < vol->v_disks_count; i++) { - if (vol->v_subdisks[i].sd_disk == tdisk) - break; - } - if (i >= vol->v_disks_count) + /* +* Clear disk flags to let only really needed ones to be reset. +* Do it only if there are no volumes in starting state now, +* as they can update disk statuses yet and we may kill innocent. +*/ + if (mdi->mdio_starting == 0) { + for (i = 0; i < GET16(gmeta, pdr->Populated_PDEs); i++) { + if (isff(gmeta->pdr->entry[i].PD_GUID, 24)) continue;
svn commit: r234869 - head/sys/geom/raid
Author: mav Date: Tue May 1 09:21:21 2012 New Revision: 234869 URL: http://svn.freebsd.org/changeset/base/234869 Log: Implement volume deletion if disk has more then one partition. Modified: head/sys/geom/raid/md_ddf.c Modified: head/sys/geom/raid/md_ddf.c == --- head/sys/geom/raid/md_ddf.c Tue May 1 08:19:29 2012(r234868) +++ head/sys/geom/raid/md_ddf.c Tue May 1 09:21:21 2012(r234869) @@ -172,6 +172,13 @@ static struct g_raid_md_class g_raid_md_ #define SET32D(m, f, v)SET32P((m), &(f), (v)) #define SET64D(m, f, v)SET64P((m), &(f), (v)) +#define GETCRNUM(m)(GET32((m), hdr->cr_length) / \ + GET16((m), hdr->Configuration_Record_Length)) + +#define GETVDCPTR(m, n)((struct ddf_vdc_record *)((uint8_t *)(m)->cr + \ + (n) * GET16((m), hdr->Configuration_Record_Length) *\ + (m)->sectorsize)) + static int isff(uint8_t *buf, int size) { @@ -254,7 +261,7 @@ g_raid_md_ddf_print(struct ddf_meta *met GET16(meta, cdr->Controller_Type.SubVendor_ID), GET16(meta, cdr->Controller_Type.SubDevice_ID)); printf("Product_ID '%.16s'\n", (char *)&meta->cdr->Product_ID[0]); - printf(" Physical Disk Data \n"); + printf(" Physical Disk Records \n"); printf("Populated_PDEs %u\n", GET16(meta, pdr->Populated_PDEs)); printf("Max_PDE_Supported%u\n", GET16(meta, pdr->Max_PDE_Supported)); for (j = 0; j < GET16(meta, pdr->Populated_PDEs); j++) { @@ -276,7 +283,7 @@ g_raid_md_ddf_print(struct ddf_meta *met printf("Block_Size %u\n", GET16(meta, pdr->entry[j].Block_Size)); } - printf(" Virtual Disk Data \n"); + printf(" Virtual Disk Records \n"); printf("Populated_VDEs %u\n", GET16(meta, vdr->Populated_VDEs)); printf("Max_VDE_Supported%u\n", GET16(meta, vdr->Max_VDE_Supported)); for (j = 0; j < GET16(meta, vdr->Populated_VDEs); j++) { @@ -299,11 +306,9 @@ g_raid_md_ddf_print(struct ddf_meta *met (char *)&meta->vdr->entry[j].VD_Name); } printf(" Configuration Records \n"); - num = GET32(meta, hdr->cr_length) / GET16(meta, hdr->Configuration_Record_Length); + num = GETCRNUM(meta); for (j = 0; j < num; j++) { - vdc = (struct ddf_vdc_record *)((uint8_t *)meta->cr + - j * GET16(meta, hdr->Configuration_Record_Length) * - meta->sectorsize); + vdc = GETVDCPTR(meta, j); val = GET32D(meta, vdc->Signature); switch (val) { case DDF_VDCR_SIGNATURE: @@ -463,11 +468,9 @@ ddf_meta_find_vdc(struct ddf_meta *meta, struct ddf_vdc_record *vdc; int i, num; - num = GET32(meta, hdr->cr_length) / GET16(meta, hdr->Configuration_Record_Length); + num = GETCRNUM(meta); for (i = 0; i < num; i++) { - vdc = (struct ddf_vdc_record *)((uint8_t *)meta->cr + - i * GET16(meta, hdr->Configuration_Record_Length) * - meta->sectorsize); + vdc = GETVDCPTR(meta, i); if (GUID != NULL) { if (GET32D(meta, vdc->Signature) == DDF_VDCR_SIGNATURE && memcmp(vdc->VD_GUID, GUID, 24) == 0) @@ -486,11 +489,9 @@ ddf_meta_count_vdc(struct ddf_meta *meta int i, num, cnt; cnt = 0; - num = GET32(meta, hdr->cr_length) / GET16(meta, hdr->Configuration_Record_Length); + num = GETCRNUM(meta); for (i = 0; i < num; i++) { - vdc = (struct ddf_vdc_record *)((uint8_t *)meta->cr + - i * GET16(meta, hdr->Configuration_Record_Length) * - meta->sectorsize); + vdc = GETVDCPTR(meta, i); if (GET32D(meta, vdc->Signature) != DDF_VDCR_SIGNATURE) continue; if (GUID == NULL || memcmp(vdc->VD_GUID, GUID, 24) == 0) @@ -937,12 +938,9 @@ ddf_meta_unused_range(struct ddf_meta *m beg[0] = 0; end[0] = GET64(meta, pdr->entry[pos].Configured_Size); n = 1; - num = GET32(meta, hdr->cr_length) / - GET16(meta, hdr->Configuration_Record_Length); + num = GETCRNUM(meta); for (i = 0; i < num; i++) { - vdc = (struct ddf_vdc_record *)((uint8_t *)meta->cr + - i * GET16(meta, hdr->Configuration_Record_Length) * - meta->sectorsize); + vdc = GETVDCPTR(meta, i); if (GET32D(meta, vdc->Signature) != DDF_VDCR_SIGNATURE) continue; for (pos = 0; pos < GET16D(meta, vdc->Primary_Element_Count); pos++) @@ -1261,11 +1259,10 @@ err: if (error != 0) goto err;
svn commit: r234870 - head/usr.sbin/pkg
Author: bapt Date: Tue May 1 10:16:12 2012 New Revision: 234870 URL: http://svn.freebsd.org/changeset/base/234870 Log: - close the open file after fetching - create a default /usr/local/etc/pkg.conf Approved by: des (mentor) Modified: head/usr.sbin/pkg/pkg.c Modified: head/usr.sbin/pkg/pkg.c == --- head/usr.sbin/pkg/pkg.c Tue May 1 09:21:21 2012(r234869) +++ head/usr.sbin/pkg/pkg.c Tue May 1 10:16:12 2012(r234870) @@ -282,7 +282,10 @@ static int bootstrap_pkg(void) { FILE *remote; + FILE *config; + char *site; char url[MAXPATHLEN]; + char conf[MAXPATHLEN]; char abi[BUFSIZ]; char tmppkg[MAXPATHLEN]; char buf[10240]; @@ -290,7 +293,6 @@ bootstrap_pkg(void) int fd, retry, ret; struct url_stat st; off_t done, r; - time_t begin_dl; time_t now; time_t last; @@ -298,6 +300,7 @@ bootstrap_pkg(void) last = 0; ret = -1; remote = NULL; + config = NULL; printf("Bootstrapping pkg please wait\n"); @@ -307,7 +310,7 @@ bootstrap_pkg(void) } if (getenv("PACKAGESITE") != NULL) - snprintf(url, MAXPATHLEN, "%s/pkg.txz", getenv("PACKAGESITE")); + snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz", getenv("PACKAGESITE")); else snprintf(url, MAXPATHLEN, "%s/%s/latest/Latest/pkg.txz", getenv("PACKAGEROOT") ? getenv("PACKAGEROOT") : _PKGS_URL, @@ -331,7 +334,6 @@ bootstrap_pkg(void) if (remote == NULL) goto fetchfail; - begin_dl = time(NULL); while (done < st.size) { if ((r = fread(buf, 1, sizeof(buf), remote)) < 1) break; @@ -353,12 +355,34 @@ bootstrap_pkg(void) if ((ret = extract_pkg_static(fd, pkgstatic, MAXPATHLEN)) == 0) ret = install_pkg_static(pkgstatic, tmppkg); + snprintf(conf, MAXPATHLEN, "%s/etc/pkg.conf", + getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE); + + if (access(conf, R_OK) == -1) { + site = strrchr(url, '/'); + if (site == NULL) + goto cleanup; + site[0] = '\0'; + site = strrchr(url, '/'); + if (site == NULL) + goto cleanup; + site[0] = '\0'; + + config = fopen(conf, "w+"); + if (config == NULL) + goto cleanup; + fprintf(config, "packagesite: %s", url); + fclose(config); + } + goto cleanup; fetchfail: warnx("Error fetching %s: %s", url, fetchLastErrString); cleanup: + if (remote != NULL) + fclose(remote); close(fd); unlink(tmppkg); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234871 - in stable/9/lib/libc: include stdio
Author: kib Date: Tue May 1 10:49:20 2012 New Revision: 234871 URL: http://svn.freebsd.org/changeset/base/234871 Log: MFC r234657: Take the spinlock around clearing of the fp->_flags in fclose(3), which indicates the avaliability of FILE, to prevent possible reordering of the writes as seen by other CPUs. Modified: stable/9/lib/libc/include/libc_private.h stable/9/lib/libc/stdio/fclose.c stable/9/lib/libc/stdio/findfp.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/include/libc_private.h == --- stable/9/lib/libc/include/libc_private.hTue May 1 10:16:12 2012 (r234870) +++ stable/9/lib/libc/include/libc_private.hTue May 1 10:49:20 2012 (r234871) @@ -81,6 +81,19 @@ void _rtld_error(const char *fmt, ...); #defineFLOCKFILE(fp) if (__isthreaded) _FLOCKFILE(fp) #defineFUNLOCKFILE(fp) if (__isthreaded) _funlockfile(fp) +struct _spinlock; +extern struct _spinlock __stdio_thread_lock; +#define STDIO_THREAD_LOCK()\ +do { \ + if (__isthreaded) \ + _SPINLOCK(&__stdio_thread_lock);\ +} while (0) +#define STDIO_THREAD_UNLOCK() \ +do { \ + if (__isthreaded) \ + _SPINUNLOCK(&__stdio_thread_lock); \ +} while (0) + /* * Indexes into the pthread jump table. * Modified: stable/9/lib/libc/stdio/fclose.c == --- stable/9/lib/libc/stdio/fclose.cTue May 1 10:16:12 2012 (r234870) +++ stable/9/lib/libc/stdio/fclose.cTue May 1 10:49:20 2012 (r234871) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include "un-namespace.h" +#include #include "libc_private.h" #include "local.h" @@ -65,7 +66,20 @@ fclose(FILE *fp) FREELB(fp); fp->_file = -1; fp->_r = fp->_w = 0;/* Mess up if reaccessed. */ + + /* +* Lock the spinlock used to protect __sglue list walk in +* __sfp(). The __sfp() uses fp->_flags == 0 test as an +* indication of the unused FILE. +* +* Taking the lock prevents possible compiler or processor +* reordering of the writes performed before the final _flags +* cleanup, making sure that we are done with the FILE before +* it is considered available. +*/ + STDIO_THREAD_LOCK(); fp->_flags = 0; /* Release this FILE for reuse. */ + STDIO_THREAD_UNLOCK(); FUNLOCKFILE(fp); return (r); } Modified: stable/9/lib/libc/stdio/findfp.c == --- stable/9/lib/libc/stdio/findfp.cTue May 1 10:16:12 2012 (r234870) +++ stable/9/lib/libc/stdio/findfp.cTue May 1 10:49:20 2012 (r234871) @@ -82,9 +82,7 @@ static struct glue *lastglue = &uglue; static struct glue * moreglue(int); -static spinlock_t thread_lock = _SPINLOCK_INITIALIZER; -#define THREAD_LOCK() if (__isthreaded) _SPINLOCK(&thread_lock) -#define THREAD_UNLOCK()if (__isthreaded) _SPINUNLOCK(&thread_lock) +spinlock_t __stdio_thread_lock = _SPINLOCK_INITIALIZER; #if NOT_YET #defineSET_GLUE_PTR(ptr, val) atomic_set_rel_ptr(&(ptr), (uintptr_t)(val)) @@ -127,22 +125,22 @@ __sfp() /* * The list must be locked because a FILE may be updated. */ - THREAD_LOCK(); + STDIO_THREAD_LOCK(); for (g = &__sglue; g != NULL; g = g->next) { for (fp = g->iobs, n = g->niobs; --n >= 0; fp++) if (fp->_flags == 0) goto found; } - THREAD_UNLOCK();/* don't hold lock while malloc()ing. */ + STDIO_THREAD_UNLOCK(); /* don't hold lock while malloc()ing. */ if ((g = moreglue(NDYNAMIC)) == NULL) return (NULL); - THREAD_LOCK(); /* reacquire the lock */ + STDIO_THREAD_LOCK();/* reacquire the lock */ SET_GLUE_PTR(lastglue->next, g); /* atomically append glue to list */ lastglue = g; /* not atomic; only accessed when locked */ fp = g->iobs; found: fp->_flags = 1; /* reserve this slot; caller sets real flags */ - THREAD_UNLOCK(); + STDIO_THREAD_UNLOCK(); fp->_p = NULL; /* no current pointer */ fp->_w = 0; /* nothing to read or write */ fp->_r = 0; @@ -183,10 +181,10 @@ f_prealloc(void) for (g = &__sglue; (n -= g->niobs) > 0 && g->next; g = g->next) /* void */; if ((n > 0) && ((g = moreglue(n)) != NULL)) { - THREAD_LOCK(
svn commit: r234872 - in stable/8/lib/libc: include stdio
Author: kib Date: Tue May 1 11:45:16 2012 New Revision: 234872 URL: http://svn.freebsd.org/changeset/base/234872 Log: MFC r234657: Take the spinlock around clearing of the fp->_flags in fclose(3), which indicates the avaliability of FILE, to prevent possible reordering of the writes as seen by other CPUs. Modified: stable/8/lib/libc/include/libc_private.h stable/8/lib/libc/stdio/fclose.c stable/8/lib/libc/stdio/findfp.c Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/include/libc_private.h == --- stable/8/lib/libc/include/libc_private.hTue May 1 10:49:20 2012 (r234871) +++ stable/8/lib/libc/include/libc_private.hTue May 1 11:45:16 2012 (r234872) @@ -72,6 +72,19 @@ void _rtld_error(const char *fmt, ...); #defineFLOCKFILE(fp) if (__isthreaded) _FLOCKFILE(fp) #defineFUNLOCKFILE(fp) if (__isthreaded) _funlockfile(fp) +struct _spinlock; +extern struct _spinlock __stdio_thread_lock; +#define STDIO_THREAD_LOCK()\ +do { \ + if (__isthreaded) \ + _SPINLOCK(&__stdio_thread_lock);\ +} while (0) +#define STDIO_THREAD_UNLOCK() \ +do { \ + if (__isthreaded) \ + _SPINUNLOCK(&__stdio_thread_lock); \ +} while (0) + /* * Indexes into the pthread jump table. * Modified: stable/8/lib/libc/stdio/fclose.c == --- stable/8/lib/libc/stdio/fclose.cTue May 1 10:49:20 2012 (r234871) +++ stable/8/lib/libc/stdio/fclose.cTue May 1 11:45:16 2012 (r234872) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include "un-namespace.h" +#include #include "libc_private.h" #include "local.h" @@ -65,7 +66,20 @@ fclose(FILE *fp) FREELB(fp); fp->_file = -1; fp->_r = fp->_w = 0;/* Mess up if reaccessed. */ + + /* +* Lock the spinlock used to protect __sglue list walk in +* __sfp(). The __sfp() uses fp->_flags == 0 test as an +* indication of the unused FILE. +* +* Taking the lock prevents possible compiler or processor +* reordering of the writes performed before the final _flags +* cleanup, making sure that we are done with the FILE before +* it is considered available. +*/ + STDIO_THREAD_LOCK(); fp->_flags = 0; /* Release this FILE for reuse. */ + STDIO_THREAD_UNLOCK(); FUNLOCKFILE(fp); return (r); } Modified: stable/8/lib/libc/stdio/findfp.c == --- stable/8/lib/libc/stdio/findfp.cTue May 1 10:49:20 2012 (r234871) +++ stable/8/lib/libc/stdio/findfp.cTue May 1 11:45:16 2012 (r234872) @@ -82,9 +82,7 @@ static struct glue *lastglue = &uglue; static struct glue * moreglue(int); -static spinlock_t thread_lock = _SPINLOCK_INITIALIZER; -#define THREAD_LOCK() if (__isthreaded) _SPINLOCK(&thread_lock) -#define THREAD_UNLOCK()if (__isthreaded) _SPINUNLOCK(&thread_lock) +spinlock_t __stdio_thread_lock = _SPINLOCK_INITIALIZER; #if NOT_YET #defineSET_GLUE_PTR(ptr, val) atomic_set_rel_ptr(&(ptr), (uintptr_t)(val)) @@ -127,22 +125,22 @@ __sfp() /* * The list must be locked because a FILE may be updated. */ - THREAD_LOCK(); + STDIO_THREAD_LOCK(); for (g = &__sglue; g != NULL; g = g->next) { for (fp = g->iobs, n = g->niobs; --n >= 0; fp++) if (fp->_flags == 0) goto found; } - THREAD_UNLOCK();/* don't hold lock while malloc()ing. */ + STDIO_THREAD_UNLOCK(); /* don't hold lock while malloc()ing. */ if ((g = moreglue(NDYNAMIC)) == NULL) return (NULL); - THREAD_LOCK(); /* reacquire the lock */ + STDIO_THREAD_LOCK();/* reacquire the lock */ SET_GLUE_PTR(lastglue->next, g); /* atomically append glue to list */ lastglue = g; /* not atomic; only accessed when locked */ fp = g->iobs; found: fp->_flags = 1; /* reserve this slot; caller sets real flags */ - THREAD_UNLOCK(); + STDIO_THREAD_UNLOCK(); fp->_p = NULL; /* no current pointer */ fp->_w = 0; /* nothing to read or write */ fp->_r = 0; @@ -183,10 +181,10 @@ f_prealloc() for (g = &__sglue; (n -= g->niobs) > 0 && g->next; g = g->next) /* void */; if ((n > 0) && ((g = moreglue(n)) != NULL)) { - THREAD_LOCK(); +
svn commit: r234873 - in head/sys/dev/ath: . ath_hal ath_hal/ar5210 ath_hal/ar5211 ath_hal/ar5212 ath_hal/ar5416
Author: adrian Date: Tue May 1 14:48:51 2012 New Revision: 234873 URL: http://svn.freebsd.org/changeset/base/234873 Log: Change the MIB cycle count API to return HAL_BOOL, rather than uint32_t, to return whether it was successful. Add placeholder (blank) methods for previous chips, for both it and the 11n extension channel busy call. Modified: head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ar5210/ar5210.h head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c head/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c head/sys/dev/ath/ath_hal/ar5211/ar5211.h head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c head/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c head/sys/dev/ath/ath_hal/ar5212/ar5212.h head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/ath_hal/ah.h == --- head/sys/dev/ath/ath_hal/ah.h Tue May 1 11:45:16 2012 (r234872) +++ head/sys/dev/ath/ath_hal/ah.h Tue May 1 14:48:51 2012 (r234873) @@ -1034,8 +1034,8 @@ struct ath_hal { struct ath_desc *); void __ahdecl(*ah_set11nBurstDuration)(struct ath_hal *, struct ath_desc *, u_int); - uint32_t __ahdecl(*ah_get_mib_cycle_counts_pct) (struct ath_hal *, - uint32_t *, uint32_t *, uint32_t *, uint32_t *); + HAL_BOOL __ahdecl(*ah_getMibCycleCounts) (struct ath_hal *, + HAL_SURVEY_SAMPLE *); uint32_t __ahdecl(*ah_get11nExtBusy)(struct ath_hal *); void __ahdecl(*ah_set11nMac2040)(struct ath_hal *, Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210.h == --- head/sys/dev/ath/ath_hal/ar5210/ar5210.hTue May 1 11:45:16 2012 (r234872) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210.hTue May 1 14:48:51 2012 (r234873) @@ -249,6 +249,9 @@ extern HAL_BOOL ar5210SetCapability(stru extern HAL_BOOL ar5210GetDiagState(struct ath_hal *ah, int request, const void *args, uint32_t argsize, void **result, uint32_t *resultsize); +extern uint32_t ar5210Get11nExtBusy(struct ath_hal *); +extern HAL_BOOL ar5210GetMibCycleCounts(struct ath_hal *, + HAL_SURVEY_SAMPLE *); extern u_int ar5210GetKeyCacheSize(struct ath_hal *); extern HAL_BOOL ar5210IsKeyCacheEntryValid(struct ath_hal *, uint16_t); Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c == --- head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Tue May 1 11:45:16 2012(r234872) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Tue May 1 14:48:51 2012(r234873) @@ -129,8 +129,10 @@ static const struct ath_hal_private ar52 .ah_getAckCTSRate = ar5210GetAckCTSRate, .ah_setCTSTimeout = ar5210SetCTSTimeout, .ah_getCTSTimeout = ar5210GetCTSTimeout, - .ah_setDecompMask = ar5210SetDecompMask, - .ah_setCoverageClass= ar5210SetCoverageClass, + .ah_setDecompMask = ar5210SetDecompMask, + .ah_setCoverageClass= ar5210SetCoverageClass, + .ah_get11nExtBusy = ar5210Get11nExtBusy, + .ah_getMibCycleCounts = ar5210GetMibCycleCounts, /* Key Cache Functions */ .ah_getKeyCacheSize = ar5210GetKeyCacheSize, Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c == --- head/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c Tue May 1 11:45:16 2012(r234872) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c Tue May 1 14:48:51 2012(r234873) @@ -646,3 +646,24 @@ ar5210GetDiagState(struct ath_hal *ah, i return ath_hal_getdiagstate(ah, request, args, argsize, result, resultsize); } + +/* + * Return what percentage of the extension channel is busy. + * This is always disabled for AR5210 series NICs. + */ +uint32_t +ar5210Get11nExtBusy(struct ath_hal *ah) +{ + + return (0); +} + +/* + * There's no channel survey support for the AR5210. + */ +HAL_BOOL +ar5210GetMibCycleCounts(struct ath_hal *ah, HAL_SURVEY_SAMPLE *hsample) +{ + + return (AH_FALSE); +} Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211.h == --- head/sys/dev/ath/ath_hal/ar5211/ar5211.hTue May 1 11:45:16 2012 (r234872) +++ head/sys/dev/ath/ath_ha
svn commit: r234874 - head/sys/net80211
Author: monthadar Date: Tue May 1 15:35:10 2012 New Revision: 234874 URL: http://svn.freebsd.org/changeset/base/234874 Log: Added Self-protected action category (including MPM). * Added new action category IEEE80211_ACTION_CAT_SELF_PROT which is used by 11s for Mesh Peering Management; * Updated Self protected enum Action codes to start from 1 instead of 0 according to the standard spec; * Removed old and wrong action categories IEEE80211_ACTION_CAT_MESHPEERING; * Modified ieee80211_mesh.c and ieee80211_action.c to use the new action category code; * Added earlier verification code in ieee80211_input; Approved by: adrian Modified: head/sys/net80211/ieee80211.h head/sys/net80211/ieee80211_action.c head/sys/net80211/ieee80211_input.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211.h == --- head/sys/net80211/ieee80211.h Tue May 1 14:48:51 2012 (r234873) +++ head/sys/net80211/ieee80211.h Tue May 1 15:35:10 2012 (r234874) @@ -333,6 +333,8 @@ struct ieee80211_action { #defineIEEE80211_ACTION_CAT_BA 3 /* BA */ #defineIEEE80211_ACTION_CAT_HT 7 /* HT */ #defineIEEE80211_ACTION_CAT_MESH 13 /* Mesh */ +#defineIEEE80211_ACTION_CAT_SELF_PROT 15 /* Self-protected */ +/* 16 - 125 reserved */ #defineIEEE80211_ACTION_CAT_VENDOR 127 /* Vendor Specific */ #defineIEEE80211_ACTION_HT_TXCHWIDTH 0 /* recommended xmit chan width*/ Modified: head/sys/net80211/ieee80211_action.c == --- head/sys/net80211/ieee80211_action.cTue May 1 14:48:51 2012 (r234873) +++ head/sys/net80211/ieee80211_action.cTue May 1 15:35:10 2012 (r234874) @@ -94,7 +94,7 @@ ieee80211_send_action_register(int cat, break; ht_send_action[act] = f; return 0; - case IEEE80211_ACTION_CAT_MESHPEERING: + case IEEE80211_ACTION_CAT_SELF_PROT: if (act >= N(meshpl_send_action)) break; meshpl_send_action[act] = f; @@ -144,7 +144,7 @@ ieee80211_send_action(struct ieee80211_n if (act < N(ht_send_action)) f = ht_send_action[act]; break; - case IEEE80211_ACTION_CAT_MESHPEERING: + case IEEE80211_ACTION_CAT_SELF_PROT: if (act < N(meshpl_send_action)) f = meshpl_send_action[act]; break; @@ -215,7 +215,7 @@ ieee80211_recv_action_register(int cat, break; ht_recv_action[act] = f; return 0; - case IEEE80211_ACTION_CAT_MESHPEERING: + case IEEE80211_ACTION_CAT_SELF_PROT: if (act >= N(meshpl_recv_action)) break; meshpl_recv_action[act] = f; @@ -269,7 +269,7 @@ ieee80211_recv_action(struct ieee80211_n if (ia->ia_action < N(ht_recv_action)) f = ht_recv_action[ia->ia_action]; break; - case IEEE80211_ACTION_CAT_MESHPEERING: + case IEEE80211_ACTION_CAT_SELF_PROT: if (ia->ia_action < N(meshpl_recv_action)) f = meshpl_recv_action[ia->ia_action]; break; Modified: head/sys/net80211/ieee80211_input.c == --- head/sys/net80211/ieee80211_input.c Tue May 1 14:48:51 2012 (r234873) +++ head/sys/net80211/ieee80211_input.c Tue May 1 15:35:10 2012 (r234874) @@ -792,6 +792,24 @@ ieee80211_parse_action(struct ieee80211_ return EINVAL; } break; + case IEEE80211_ACTION_CAT_SELF_PROT: + /* If TA or RA group address discard silently */ + if (IEEE80211_IS_MULTICAST(wh->i_addr1) || + IEEE80211_IS_MULTICAST(wh->i_addr2)) + return EINVAL; + /* +* XXX: Should we verify complete length now or it is +* to varying in sizes? +*/ + switch (ia->ia_action) { + case IEEE80211_ACTION_MESHPEERING_CONFIRM: + case IEEE80211_ACTION_MESHPEERING_CLOSE: + /* is not a peering candidate (yet) */ + if (ni == vap->iv_bss) + return EINVAL; + break; + } + break; #endif } return 0; Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Tue May 1 14:48
svn commit: r234875 - head/sys/net80211
Author: monthadar Date: Tue May 1 15:39:16 2012 New Revision: 234875 URL: http://svn.freebsd.org/changeset/base/234875 Log: Modified structure and code that handles Mesh peering management. * Old struct ieee80211_meshpeer_ie had wrong peer_proto field size; * Added IEEE80211_MPM_* size macros; * Created an enum for the Mesh Peering Protocol Identifier field according to the standard spec and removed old defines; * Abbreviated Handshake Protocol is not used by the standard anymore; * Modified mesh_verify_meshpeer to use IEEE80211_MPM_* macros for verification; * Modified mesh_parse_meshpeering_action to parse complete frame, also to parse it according to the standard spec; * Modified ieee80211_add_meshpeer to construct correct MPM frames according to the standard spec; Approved by: adrian Modified: head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Tue May 1 15:35:10 2012 (r234874) +++ head/sys/net80211/ieee80211_mesh.c Tue May 1 15:39:16 2012 (r234875) @@ -1573,8 +1573,7 @@ mesh_recv_ctl(struct ieee80211_node *ni, } /* - * Parse meshpeering action ie's for open+confirm frames; the - * important bits are returned in the supplied structure. + * Parse meshpeering action ie's for open+confirm frames */ static const struct ieee80211_meshpeer_ie * mesh_parse_meshpeering_action(struct ieee80211_node *ni, @@ -1600,15 +1599,27 @@ mesh_parse_meshpeering_action(struct iee meshpeer = frm; mpie = (const struct ieee80211_meshpeer_ie *) frm; memset(mp, 0, sizeof(*mp)); + mp->peer_proto = LE_READ_2(&mpie->peer_proto); mp->peer_llinkid = LE_READ_2(&mpie->peer_llinkid); - /* NB: peer link ID is optional on these frames */ - if (subtype == IEEE80211_ACTION_MESHPEERING_CLOSE && - mpie->peer_len == 8) { - mp->peer_linkid = 0; - mp->peer_rcode = LE_READ_2(&mpie->peer_linkid); - } else { - mp->peer_linkid = LE_READ_2(&mpie->peer_linkid); - mp->peer_rcode = LE_READ_2(&mpie->peer_rcode); + switch (subtype) { + case IEEE80211_ACTION_MESHPEERING_CONFIRM: + mp->peer_linkid = + LE_READ_2(&mpie->peer_linkid); + break; + case IEEE80211_ACTION_MESHPEERING_CLOSE: + /* NB: peer link ID is optional */ + if (mpie->peer_len == + (IEEE80211_MPM_BASE_SZ + 2)) { + mp->peer_linkid = 0; + mp->peer_rcode = + LE_READ_2(&mpie->peer_linkid); + } else { + mp->peer_linkid = + LE_READ_2(&mpie->peer_linkid); + mp->peer_rcode = + LE_READ_2(&mpie->peer_rcode); + } + break; } break; } @@ -2337,22 +2348,31 @@ mesh_verify_meshpeer(struct ieee80211vap const struct ieee80211_meshpeer_ie *meshpeer = (const struct ieee80211_meshpeer_ie *) ie; - if (meshpeer == NULL || meshpeer->peer_len < 6 || - meshpeer->peer_len > 10) + if (meshpeer == NULL || + meshpeer->peer_len < IEEE80211_MPM_BASE_SZ || + meshpeer->peer_len > IEEE80211_MPM_MAX_SZ) return 1; + if (meshpeer->peer_proto != IEEE80211_MPPID_MPM) { + IEEE80211_DPRINTF(vap, + IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH, + "Only MPM protocol is supported (proto: 0x%02X)", + meshpeer->peer_proto); + return 1; + } switch (subtype) { case IEEE80211_ACTION_MESHPEERING_OPEN: - if (meshpeer->peer_len != 6) + if (meshpeer->peer_len != IEEE80211_MPM_BASE_SZ) return 1; break; case IEEE80211_ACTION_MESHPEERING_CONFIRM: - if (meshpeer->peer_len != 8) + if (meshpeer->peer_len != IEEE80211_MPM_BASE_SZ + 2) return 1; break; case IEEE80211_ACTION_MESHPEERING_CLOSE: - if (meshpeer->peer_len < 8) + if (meshpeer->peer_le
svn commit: r234876 - head/sys/net80211
Author: monthadar Date: Tue May 1 15:42:41 2012 New Revision: 234876 URL: http://svn.freebsd.org/changeset/base/234876 Log: Fixed some MPM reason codes and max number of neighbors check * Added IEEE80211_MESH_MAX_NEIGHBORS and it is set to 15, same as before; * Modified mesh_parse_meshpeering_action to verify MPM frame and send correct reason code for when a frame is rejected according to standard spec; * Modified mesh_recv_action_meshpeering_* according to the standard spec; * Modified mesh_peer_timeout_cb to always send CLOSE frame when in CONFIRMRCV state according to the standard spec; Approved by: adrian Modified: head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Tue May 1 15:39:16 2012 (r234875) +++ head/sys/net80211/ieee80211_mesh.c Tue May 1 15:42:41 2012 (r234876) @@ -1573,7 +1573,7 @@ mesh_recv_ctl(struct ieee80211_node *ni, } /* - * Parse meshpeering action ie's for open+confirm frames + * Parse meshpeering action ie's for MPM frames */ static const struct ieee80211_meshpeer_ie * mesh_parse_meshpeering_action(struct ieee80211_node *ni, @@ -1583,7 +1583,9 @@ mesh_parse_meshpeering_action(struct iee { struct ieee80211vap *vap = ni->ni_vap; const struct ieee80211_meshpeer_ie *mpie; + uint16_t args[3]; const uint8_t *meshid, *meshconf, *meshpeer; + uint8_t sendclose = 0; /* 1 = MPM frame rejected, close will be sent */ meshid = meshconf = meshpeer = NULL; while (efrm - frm > 1) { @@ -1599,6 +1601,7 @@ mesh_parse_meshpeering_action(struct iee meshpeer = frm; mpie = (const struct ieee80211_meshpeer_ie *) frm; memset(mp, 0, sizeof(*mp)); + mp->peer_len = mpie->peer_len; mp->peer_proto = LE_READ_2(&mpie->peer_proto); mp->peer_llinkid = LE_READ_2(&mpie->peer_llinkid); switch (subtype) { @@ -1627,22 +1630,46 @@ mesh_parse_meshpeering_action(struct iee } /* -* Verify the contents of the frame. Action frames with -* close subtype don't have a Mesh Configuration IE. -* If if fails validation, close the peer link. +* Verify the contents of the frame. +* If it fails validation, close the peer link. */ - KASSERT(meshpeer != NULL && - subtype != IEEE80211_ACTION_MESHPEERING_CLOSE, - ("parsing close action")); - - if (mesh_verify_meshid(vap, meshid) || - mesh_verify_meshpeer(vap, subtype, meshpeer) || - mesh_verify_meshconf(vap, meshconf)) { - uint16_t args[3]; + if (mesh_verify_meshpeer(vap, subtype, (const uint8_t *)mp)) { + sendclose = 1; + IEEE80211_DISCARD(vap, + IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH, + wh, NULL, "%s", "MPM validation failed"); + } + /* If meshid is not the same reject any frames type. */ + if (sendclose == 0 && mesh_verify_meshid(vap, meshid)) { + sendclose = 1; IEEE80211_DISCARD(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH, wh, NULL, "%s", "not for our mesh"); + if (subtype == IEEE80211_ACTION_MESHPEERING_CLOSE) { + /* +* Standard not clear about this, if we dont ignore +* there will be an endless loop between nodes sending +* CLOSE frames between each other with wrong meshid. +* Discard and timers will bring FSM to IDLE state. +*/ + return NULL; + } + } + + /* +* Close frames are accepted if meshid is the same. +* Verify the other two types. +*/ + if (sendclose == 0 && subtype != IEEE80211_ACTION_MESHPEERING_CLOSE && + mesh_verify_meshconf(vap, meshconf)) { + sendclose = 1; + IEEE80211_DISCARD(vap, + IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH, + wh, NULL, "%s", "configuration missmatch"); + } + + if (sendclose) { vap->iv_stats.is_rx_mgtdiscard++; switch (ni->ni_mlstate) { case IEEE80211_NODE_MESH_IDLE: @@ -1655,7 +1682,15 @@ mesh_parse_meshpeering_action(struct iee case IEEE80211_NODE_MESH_CONFIRMRCV: args[0] = ni->ni_mlpid; args[1] = ni->ni_mllid; - args[2] = IEEE80211_REASON_PEER_LINK_CANCELED; + /* Reason codes for rejection */ + switch (s
svn commit: r234877 - head/sys/net80211
Author: monthadar Date: Tue May 1 15:47:30 2012 New Revision: 234877 URL: http://svn.freebsd.org/changeset/base/234877 Log: Implemented so that Mesh forwarding information lifetime is dynamic. * Introduced ieee80211_mesh_rt_update that updates a route with the maximum(lifetime left, new lifetime); * Modified ieee80211_mesh_route struct by adding a lock that will be used by both ieee80211_mesh_rt_update and precursor code (added in future commit); * Modified in ieee80211_hwmp.c HWMP code to use new ieee80211_mesh_rt_update; * Modified mesh_rt_flush_invalid to use new ieee80211_mesh_rt_update; * mesh_rt_flush also checks that lifetime == 0, this gives route discovery a change to complete; * Modified mesh_recv_mgmt case IEEE80211_FC0_SUBTYPE_BEACON: when ever we received a beacon from a neighbor we update route lifetime; Approved by: adrian Modified: head/sys/net80211/ieee80211_ddb.c head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_ddb.c == --- head/sys/net80211/ieee80211_ddb.c Tue May 1 15:42:41 2012 (r234876) +++ head/sys/net80211/ieee80211_ddb.c Tue May 1 15:47:30 2012 (r234877) @@ -870,8 +870,10 @@ _db_show_mesh(const struct ieee80211_mes TAILQ_FOREACH(rt, &ms->ms_routes, rt_next) { db_printf("entry %d:\tdest: %6D nexthop: %6D metric: %u", i, rt->rt_dest, ":", rt->rt_nexthop, ":", rt->rt_metric); + db_printf("\tlifetime: %u lastseq: %u priv: %p\n", - rt->rt_lifetime, rt->rt_lastmseq, rt->rt_priv); + ieee80211_mesh_rt_update(rt, 0), + rt->rt_lastmseq, rt->rt_priv); i++; } } Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 15:42:41 2012 (r234876) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 15:47:30 2012 (r234877) @@ -143,9 +143,6 @@ typedef uint32_t ieee80211_hwmp_seq; #defineHWMP_SEQ_GT(a, b) ((int32_t)((a)-(b)) > 0) #defineHWMP_SEQ_GEQ(a, b) ((int32_t)((a)-(b)) >= 0) -/* The longer one of the lifetime should be stored as new lifetime */ -#define MESH_ROUTE_LIFETIME_MAX(a, b) (a > b ? a : b) - /* * Private extension of ieee80211_mesh_route. */ @@ -938,7 +935,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, /* Data creation and update of forwarding information * according to Table 11C-8 for originator mesh STA. */ - if(HWMP_SEQ_GT(preq->preq_origseq, hrorig->hr_seq) || + if (HWMP_SEQ_GT(preq->preq_origseq, hrorig->hr_seq) || (HWMP_SEQ_EQ(preq->preq_origseq, hrorig->hr_seq) && preq->preq_metric < rtorig->rt_metric)) { hrorig->hr_seq = preq->preq_origseq; @@ -946,8 +943,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, rtorig->rt_metric = preq->preq_metric + ms->ms_pmetric->mpm_metric(ni); rtorig->rt_nhops = preq->preq_hopcount + 1; - rtorig->rt_lifetime = MESH_ROUTE_LIFETIME_MAX( - preq->preq_lifetime, rtorig->rt_lifetime); + ieee80211_mesh_rt_update(rtorig, preq->preq_lifetime); /* path to orig is valid now */ rtorig->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; }else if(hrtarg != NULL && @@ -1124,7 +1120,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, } } rt->rt_metric = preq->preq_metric; - rt->rt_lifetime = preq->preq_lifetime; + ieee80211_mesh_rt_update(rt, preq->preq_lifetime); hrorig = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route); hrorig->hr_seq = preq->preq_origseq; @@ -1221,7 +1217,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, } IEEE80211_ADDR_COPY(rt->rt_nexthop, wh->i_addr2); rt->rt_nhops = prep->prep_hopcount; - rt->rt_lifetime = prep->prep_lifetime; + ieee80211_mesh_rt_update(rt, prep->prep_lifetime); rt->rt_metric = prep->prep_metric; rt->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, @@ -1300,7 +1296,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, rt->rt_metric, prep->prep_metric); IEEE80211_ADDR_COPY(rt->rt_nexthop, wh->i_addr2); rt->rt_nhops = prep->prep_hopcount + 1; - rt->rt_lifetime = prep->prep_l
svn commit: r234878 - head/sys/net80211
Author: monthadar Date: Tue May 1 15:56:26 2012 New Revision: 234878 URL: http://svn.freebsd.org/changeset/base/234878 Log: Mesh forwarding with proxy support. * Modified HWMP PREP/PREQ to contain a proxy entry and also changed PREP frame processing according to amendment as following: o Fixed PREP to always update/create if acceptance criteria is meet; o PREQ processing to reply if request is for a proxy entry that is proxied by us; o Removed hwmp_discover call from PREQ, because sending a PREP will build the forward path, and by receving and accepting a PREQ we have already built the reverse path (non-proactive code); * Disabled code for pro-active in PREP for now (will make a separate patch for pro-active HWMP routing later) * Added proxy information for a Mesh route, mesh gate to use and proxy seqno; * Modified ieee80211_encap according to amendment; * Introduced Mesh control address extension enum and removed unused struct, also rename some structure element names. * Modified mesh_input and added mesh_recv_* that should verify and process mesh data frames according to 9.32 Mesh forwarding framework in amendment; * Modified mesh_decap accordingly to changes done in mesh control AE struct; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 15:47:30 2012 (r234877) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 15:56:26 2012 (r234878) @@ -143,6 +143,8 @@ typedef uint32_t ieee80211_hwmp_seq; #defineHWMP_SEQ_GT(a, b) ((int32_t)((a)-(b)) > 0) #defineHWMP_SEQ_GEQ(a, b) ((int32_t)((a)-(b)) >= 0) +#define HWMP_SEQ_MAX(a, b) (a > b ? a : b) + /* * Private extension of ieee80211_mesh_route. */ @@ -866,7 +868,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, const struct ieee80211_frame *wh, const struct ieee80211_meshpreq_ie *preq) { struct ieee80211_mesh_state *ms = vap->iv_mesh; - struct ieee80211_mesh_route *rt = NULL; + struct ieee80211_mesh_route *rt = NULL; /* pro-active code */ struct ieee80211_mesh_route *rtorig = NULL; struct ieee80211_mesh_route *rttarg = NULL; struct ieee80211_hwmp_route *hrorig = NULL; @@ -963,31 +965,44 @@ hwmp_recv_preq(struct ieee80211vap *vap, /* * Check if the PREQ is addressed to us. +* or a Proxy currently supplied by us. */ - if (IEEE80211_ADDR_EQ(vap->iv_myaddr, PREQ_TADDR(0))) { - IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "reply to %6D", preq->preq_origaddr, ":"); + if (IEEE80211_ADDR_EQ(vap->iv_myaddr, PREQ_TADDR(0)) || + (rttarg != NULL && + rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY && + rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_VALID)) { /* -* Build and send a PREP frame. +* When we are the target we shall update our own HWMP seq +* number with max of (current and preq->seq) + 1 */ + hs->hs_seq = HWMP_SEQ_MAX(hs->hs_seq, PREQ_TSEQ(0)) + 1; + prep.prep_flags = 0; + if (rttarg != NULL && /* if NULL it means we are the target */ + rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY) { + IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, + "reply for proxy %6D", rttarg->rt_dest, ":"); + prep.prep_flags |= IEEE80211_MESHPREP_FLAGS_AE; + IEEE80211_ADDR_COPY(prep.prep_target_ext_addr, + rttarg->rt_dest); + /* update proxy seqno to HWMP seqno */ + rttarg->rt_ext_seq = hs->hs_seq; + } + /* +* Build and send a PREP frame. +*/ prep.prep_hopcount = 0; prep.prep_ttl = ms->ms_ttl; IEEE80211_ADDR_COPY(prep.prep_targetaddr, vap->iv_myaddr); - prep.prep_targetseq = ++hs->hs_seq; + prep.prep_targetseq = hs->hs_seq; prep.prep_lifetime = preq->preq_lifetime; prep.prep_metric = IEEE80211_MESHLMETRIC_INITIALVAL; IEEE80211_ADDR_COPY(prep.prep_origaddr, preq->preq_origaddr); prep.prep_origseq = preq->preq_origseq; + + IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, + "reply to %6D", preq->preq_origaddr, ":"); hwmp_send_prep(ni, vap->iv_myaddr, wh->i_addr2, &prep); - /* -* Build the reverse path, if we don't have it al
svn commit: r234879 - head/sys/net80211
Author: monthadar Date: Tue May 1 15:58:10 2012 New Revision: 234879 URL: http://svn.freebsd.org/changeset/base/234879 Log: Added route lifetime update for destination and source mesh along a mesh path; * In mesh_recv_indiv_data_to_fwd update route entry for both meshDA and meshSA; * In mesh_recv_indiv_data_to_me update route entry for meshSA; * in ieee80211_mesh_rt_update put code so that a proxy entry that is gated by us (number of hops == 0) is never invalidated; * Fixed so that we always call ieee80211_mesh_rt_update with lifetime in ms; Approved by: adrian Modified: head/sys/net80211/ieee80211_mesh.c Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Tue May 1 15:56:26 2012 (r234878) +++ head/sys/net80211/ieee80211_mesh.c Tue May 1 15:58:10 2012 (r234879) @@ -241,6 +241,13 @@ ieee80211_mesh_rt_update(struct ieee8021 now = ticks; RT_ENTRY_LOCK(rt); + + /* dont clobber a proxy entry gated by us */ + if (rt->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY && rt->rt_nhops == 0) { + RT_ENTRY_UNLOCK(rt); + return rt->rt_lifetime; + } + timesince = ticks_to_msecs(now - rt->rt_updtime); rt->rt_updtime = now; if (timesince >= rt->rt_lifetime) { @@ -1115,16 +1122,31 @@ static int mesh_recv_indiv_data_to_fwrd(struct ieee80211vap *vap, struct mbuf *m, struct ieee80211_frame *wh, const struct ieee80211_meshcntl *mc) { + struct ieee80211_qosframe_addr4 *qwh; + struct ieee80211_mesh_state *ms = vap->iv_mesh; + struct ieee80211_mesh_route *rt_meshda, *rt_meshsa; + + qwh = (struct ieee80211_qosframe_addr4 *)wh; /* * TODO: * o verify addr2 is a legitimate transmitter -* o set lifetime of addr3 to initial value -* o set lifetime of addr4 to initial value * o lifetime of precursor of addr3 (addr2) is max(init, curr) * o lifetime of precursor of addr4 (nexthop) is max(init, curr) */ + /* set lifetime of addr3 (meshDA) to initial value */ + rt_meshda = ieee80211_mesh_rt_find(vap, qwh->i_addr3); + KASSERT(rt_meshda != NULL, ("no route")); + ieee80211_mesh_rt_update(rt_meshda, ticks_to_msecs( + ms->ms_ppath->mpp_inact)); + + /* set lifetime of addr4 (meshSA) to initial value */ + rt_meshsa = ieee80211_mesh_rt_find(vap, qwh->i_addr4); + KASSERT(rt_meshsa != NULL, ("no route")); + ieee80211_mesh_rt_update(rt_meshsa, ticks_to_msecs( + ms->ms_ppath->mpp_inact)); + mesh_forward(vap, m, mc); return (1); /* dont process locally */ } @@ -1144,6 +1166,7 @@ mesh_recv_indiv_data_to_me(struct ieee80 { struct ieee80211_qosframe_addr4 *qwh; const struct ieee80211_meshcntl_ae10 *mc10; + struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_mesh_route *rt; int ae; @@ -1153,10 +1176,15 @@ mesh_recv_indiv_data_to_me(struct ieee80 /* * TODO: * o verify addr2 is a legitimate transmitter -* o set lifetime of addr4 to initial value * o lifetime of precursor entry is max(init, curr) */ + /* set lifetime of addr4 (meshSA) to initial value */ + rt = ieee80211_mesh_rt_find(vap, qwh->i_addr4); + KASSERT(rt != NULL, ("no route")); + ieee80211_mesh_rt_update(rt, ticks_to_msecs(ms->ms_ppath->mpp_inact)); + rt = NULL; + ae = mc10->mc_flags & IEEE80211_MESH_AE_MASK; KASSERT(ae == IEEE80211_MESH_AE_00 || ae == IEEE80211_MESH_AE_10, ("bad AE %d", ae)); @@ -1673,7 +1701,8 @@ mesh_recv_mgmt(struct ieee80211_node *ni rt = ieee80211_mesh_rt_find(vap, wh->i_addr2); if(rt != NULL) { ieee80211_mesh_rt_update(rt, - ms->ms_ppath->mpp_inact); + ticks_to_msecs( + ms->ms_ppath->mpp_inact)); } break; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234880 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:00:31 2012 New Revision: 234880 URL: http://svn.freebsd.org/changeset/base/234880 Log: * MeshForwarding update mesh_recv_indiv_data_to_fwrd to silently discard unknown meshDA instead of panic, which is allowed per amendment spec; Approved by: adrian Modified: head/sys/net80211/ieee80211_mesh.c Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Tue May 1 15:58:10 2012 (r234879) +++ head/sys/net80211/ieee80211_mesh.c Tue May 1 16:00:31 2012 (r234880) @@ -1137,7 +1137,19 @@ mesh_recv_indiv_data_to_fwrd(struct ieee /* set lifetime of addr3 (meshDA) to initial value */ rt_meshda = ieee80211_mesh_rt_find(vap, qwh->i_addr3); - KASSERT(rt_meshda != NULL, ("no route")); + if (rt_meshda == NULL) { + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, qwh->i_addr2, + "no route to meshDA(%6D)", qwh->i_addr3, ":"); + /* +* [Optional] any of the following three actions: +* o silently discard [X] +* o trigger a path discovery [ ] +* o inform TA that meshDA is unknown. [ ] +*/ + /* XXX: stats */ + return (-1); + } + ieee80211_mesh_rt_update(rt_meshda, ticks_to_msecs( ms->ms_ppath->mpp_inact)); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234881 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:02:31 2012 New Revision: 234881 URL: http://svn.freebsd.org/changeset/base/234881 Log: PREP update * Added assertion in mesh_rt_update; * Fixed some prep propagation that where multicast, ALL PREPS ARE UNICAST; * Fixed PREP acceptance criteria; * Fixed some PREP debug messages; * HWMP intermediate reply (PREP) should only be sent if we have newer forwarding infomration (FI) about target; * Fixed PREP propagation condition and PREP w/ AE handling; * Ignore PREPs that have unknown originator. * Removed old code inside PREP that was for proactive path building to root mesh; Other errors include: * use seq number of target and not orig mesh STA; * Metric is what we have stored in our FI; * Error in amendment, Hop count is not 0 but equals FI hopcount for target; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:00:31 2012 (r234880) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:02:31 2012 (r234881) @@ -887,7 +887,8 @@ hwmp_recv_preq(struct ieee80211vap *vap, return; IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "received PREQ, source %6D", preq->preq_origaddr, ":"); + "received PREQ, orig %6D, targ(0) %6D", preq->preq_origaddr, ":", + PREQ_TADDR(0), ":"); /* * Acceptance criteria: if the PREQ is not for us or not broadcast @@ -1010,9 +1011,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, * root STA if requested. */ if (IEEE80211_ADDR_EQ(PREQ_TADDR(0), broadcastaddr) && - (PREQ_TFLAGS(0) & - ((IEEE80211_MESHPREQ_TFLAGS_TO|IEEE80211_MESHPREQ_TFLAGS_RF) == - (IEEE80211_MESHPREQ_TFLAGS_TO|IEEE80211_MESHPREQ_TFLAGS_RF { + (PREQ_TFLAGS(0) & IEEE80211_MESHPREQ_TFLAGS_TO)) { uint8_t rootmac[IEEE80211_ADDR_LEN]; IEEE80211_ADDR_COPY(rootmac, preq->preq_origaddr); @@ -1096,26 +1095,26 @@ hwmp_recv_preq(struct ieee80211vap *vap, * Check if we can send an intermediate Path Reply, * i.e., Target Only bit is not set. */ - if (!(PREQ_TFLAGS(0) & IEEE80211_MESHPREQ_TFLAGS_TO)) { + if (!(PREQ_TFLAGS(0) & IEEE80211_MESHPREQ_TFLAGS_TO) && + HWMP_SEQ_GEQ(hrtarg->hr_seq, PREQ_TSEQ(0))) { struct ieee80211_meshprep_ie prep; IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "intermediate reply for PREQ from %6D", preq->preq_origaddr, ":"); prep.prep_flags = 0; - prep.prep_hopcount = rt->rt_nhops + 1; + prep.prep_hopcount = rttarg->rt_nhops; prep.prep_ttl = ms->ms_ttl; IEEE80211_ADDR_COPY(&prep.prep_targetaddr, PREQ_TADDR(0)); - prep.prep_targetseq = hrorig->hr_seq; + prep.prep_targetseq = hrtarg->hr_seq; prep.prep_lifetime = preq->preq_lifetime; - prep.prep_metric = rt->rt_metric + - ms->ms_pmetric->mpm_metric(ni); + prep.prep_metric =rttarg->rt_metric; IEEE80211_ADDR_COPY(&prep.prep_origaddr, preq->preq_origaddr); prep.prep_origseq = hrorig->hr_seq; hwmp_send_prep(ni, vap->iv_myaddr, - broadcastaddr, &prep); + rtorig->rt_nexthop, &prep); } /* * We have no information about this path, @@ -1191,6 +1190,9 @@ static void hwmp_recv_prep(struct ieee80211vap *vap, struct ieee80211_node *ni, const struct ieee80211_frame *wh, const struct ieee80211_meshprep_ie *prep) { +#defineIS_PROXY(rt)(rt->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY) +#definePROXIED_BY_US(rt) \ +(IEEE80211_ADDR_EQ(vap->iv_myaddr, rt->rt_mesh_gate)) struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_hwmp_state *hs = vap->iv_hwmp; struct ieee80211_mesh_route *rt = NULL; @@ -1203,63 +1205,31 @@ hwmp_recv_prep(struct ieee80211vap *vap, uint32_t metric = 0; const uint8_t *addr; - /* -* Acceptance criteria: If the corresponding PREP was not generated -* by us or g
svn commit: r234882 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:03:27 2012 New Revision: 234882 URL: http://svn.freebsd.org/changeset/base/234882 Log: Change how we enforce PREQ minimum interval. * Moved hs_lastpreq to be hr_lastpreq cause this rate check should be per target mesh STA according to amendment (NB: not applicable for PERR); * Modified hwmp_send_preq to use two extra arguments for last sent PREQ and minimum PREQ interval; * hwmp_send_preq is called with last two arguments equal to NULL when sending Proactive PREQs cause the call back task enforces the rate check; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:02:31 2012 (r234881) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:03:27 2012 (r234882) @@ -89,7 +89,8 @@ static void hwmp_recv_preq(struct ieee80 static int hwmp_send_preq(struct ieee80211_node *, const uint8_t [IEEE80211_ADDR_LEN], const uint8_t [IEEE80211_ADDR_LEN], - struct ieee80211_meshpreq_ie *); + struct ieee80211_meshpreq_ie *, + struct timeval *, struct timeval *); static voidhwmp_recv_prep(struct ieee80211vap *, struct ieee80211_node *, const struct ieee80211_frame *, const struct ieee80211_meshprep_ie *); @@ -152,14 +153,14 @@ struct ieee80211_hwmp_route { ieee80211_hwmp_seq hr_seq; /* last HWMP seq seen from dst*/ ieee80211_hwmp_seq hr_preqid; /* last PREQ ID seen from dst */ ieee80211_hwmp_seq hr_origseq; /* seq. no. on our latest PREQ*/ + struct timeval hr_lastpreq;/* last time we sent a PREQ */ int hr_preqretries; }; struct ieee80211_hwmp_state { ieee80211_hwmp_seq hs_seq; /* next seq to be used */ ieee80211_hwmp_seq hs_preqid; /* next PREQ ID to be used */ - struct timeval hs_lastpreq;/* last time we sent a PREQ */ - struct timeval hs_lastperr;/* last time we sent a PERR */ int hs_rootmode;/* proactive HWMP */ + struct timeval hs_lastperr;/* last time we sent a PERR */ struct callout hs_roottimer; uint8_t hs_maxhops; /* max hop count */ }; @@ -824,7 +825,8 @@ hwmp_rootmode_cb(void *arg) IEEE80211_MESHPREQ_TFLAGS_RF; PREQ_TSEQ(0) = 0; vap->iv_stats.is_hwmp_rootreqs++; - hwmp_send_preq(vap->iv_bss, vap->iv_myaddr, broadcastaddr, &preq); + hwmp_send_preq(vap->iv_bss, vap->iv_myaddr, broadcastaddr, &preq, + NULL, NULL);/* NB: we enforce rate check ourself */ hwmp_rootmode_setup(vap); } #undef PREQ_TFLAGS @@ -1051,7 +1053,6 @@ hwmp_recv_preq(struct ieee80211vap *vap, hwmp_discover(vap, rootmac, NULL); return; } - rt = ieee80211_mesh_rt_find(vap, PREQ_TADDR(0)); /* * Forwarding and Intermediate reply for PREQs with 1 target. @@ -1063,8 +1064,8 @@ hwmp_recv_preq(struct ieee80211vap *vap, /* * We have a valid route to this node. */ - if (rt != NULL && - (rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID)) { + if (rttarg != NULL && + (rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_VALID)) { if (preq->preq_ttl > 1 && preq->preq_hopcount < hs->hs_maxhops) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, @@ -1072,7 +1073,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, preq->preq_origaddr, ":"); /* * Propagate the original PREQ. -* PREQ is unicast now to rt->rt_nexthop +* PREQ is unicast now to rttarg->rt_nexthop */ ppreq.preq_flags &= ~IEEE80211_MESHPREQ_FLAGS_AM; @@ -1089,7 +1090,9 @@ hwmp_recv_preq(struct ieee80211vap *vap, ppreq.preq_targets[0].target_flags &= ~IEEE80211_MESHPREQ_TFLAGS_RF; hwmp_send_preq(ni, vap->iv_myaddr, - rt->rt_nexthop, &ppreq); + rttarg->rt_nexthop, &ppreq, + &hrtarg->hr_lastpreq, + &ieee80211_hwmp_preqminint); } /* * Check if we can send an intermedi
svn commit: r234883 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:05:09 2012 New Revision: 234883 URL: http://svn.freebsd.org/changeset/base/234883 Log: * Added a mesh max PREQ retires sysctl that governous how many times we try to discover an address; * Added a mesh net travelse time across an MBSS, which is used to enforce discovery rate check; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:03:27 2012 (r234882) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:05:09 2012 (r234883) @@ -154,7 +154,8 @@ struct ieee80211_hwmp_route { ieee80211_hwmp_seq hr_preqid; /* last PREQ ID seen from dst */ ieee80211_hwmp_seq hr_origseq; /* seq. no. on our latest PREQ*/ struct timeval hr_lastpreq;/* last time we sent a PREQ */ - int hr_preqretries; + int hr_preqretries; /* number of discoveries */ + int hr_lastdiscovery; /* last discovery in ticks */ }; struct ieee80211_hwmp_state { ieee80211_hwmp_seq hs_seq; /* next seq to be used */ @@ -177,6 +178,15 @@ static int ieee80211_hwmp_pathtimeout = SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, pathlifetime, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_hwmp_pathtimeout, 0, ieee80211_sysctl_msecs_ticks, "I", "path entry lifetime (ms)"); +static int ieee80211_hwmp_maxpreq_retries = -1; +SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, maxpreq_retries, CTLTYPE_INT | CTLFLAG_RW, +&ieee80211_hwmp_maxpreq_retries, 0, ieee80211_sysctl_msecs_ticks, "I", +"maximum number of preq retries"); +static int ieee80211_hwmp_net_diameter_traversaltime = -1; +SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, net_diameter_traversal_time, +CTLTYPE_INT | CTLFLAG_RW, &ieee80211_hwmp_net_diameter_traversaltime, 0, +ieee80211_sysctl_msecs_ticks, "I", +"estimate travelse time across the MBSS (ms)"); static int ieee80211_hwmp_roottimeout = -1; SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, roottimeout, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_hwmp_roottimeout, 0, ieee80211_sysctl_msecs_ticks, "I", @@ -212,10 +222,17 @@ SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, in static void ieee80211_hwmp_init(void) { + /* Default values as per amendment */ ieee80211_hwmp_pathtimeout = msecs_to_ticks(5*1000); ieee80211_hwmp_roottimeout = msecs_to_ticks(5*1000); ieee80211_hwmp_rootint = msecs_to_ticks(2*1000); ieee80211_hwmp_rannint = msecs_to_ticks(1*1000); + ieee80211_hwmp_maxpreq_retries = 3; + /* +* (TU): A measurement of time equal to 1024 μs, +* 500 TU is 512 ms. +*/ + ieee80211_hwmp_net_diameter_traversaltime = msecs_to_ticks(512); /* * Register action frame handler. @@ -1288,6 +1305,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, rt->rt_metric, metric); hr->hr_seq = prep->prep_targetseq; + hr->hr_preqretries = 0; IEEE80211_ADDR_COPY(rt->rt_nexthop, ni->ni_macaddr); rt->rt_metric = metric; rt->rt_nhops = prep->prep_hopcount + 1; @@ -1648,13 +1666,31 @@ hwmp_discover(struct ieee80211vap *vap, hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route); if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0) { + if (hr->hr_lastdiscovery != 0 && + (ticks - hr->hr_lastdiscovery < + (ieee80211_hwmp_net_diameter_traversaltime * 2))) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, + dest, NULL, "%s", + "too frequent discovery requeust"); + /* XXX: stats? */ + goto done; + } + hr->hr_lastdiscovery = ticks; + if (hr->hr_preqretries >= + ieee80211_hwmp_maxpreq_retries) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, + dest, NULL, "%s", + "no valid path , max number of discovery"); + vap->iv_stats.is_mesh_fwd_nopath++; + goto done; + } + hr->hr_preqretries++; if (hr->hr_origseq == 0) hr->hr_origseq = ++hs->hs_seq; rt->rt_metric = IEEE80211_MESHLMETRIC_INITIALVAL; /* XXX: special discovery timeout, larger lifetime? */ ieee80211_mesh_rt_update(rt, ticks_to_msecs(ieee80211_hwmp_pathtimeout)); -
svn commit: r234884 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:06:20 2012 New Revision: 234884 URL: http://svn.freebsd.org/changeset/base/234884 Log: * Fixed PREQ flag field Adressing mode subfiled according to amendment specs; Approved by: adria Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:05:09 2012 (r234883) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:06:20 2012 (r234884) @@ -824,7 +824,7 @@ hwmp_rootmode_cb(void *arg) IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, vap->iv_bss, "%s", "send broadcast PREQ"); - preq.preq_flags = IEEE80211_MESHPREQ_FLAGS_AM; + preq.preq_flags = 0; if (ms->ms_flags & IEEE80211_MESHFLAGS_PORTAL) preq.preq_flags |= IEEE80211_MESHPREQ_FLAGS_PR; if (hs->hs_rootmode == IEEE80211_HWMP_ROOTMODE_PROACTIVE) @@ -1092,8 +1092,8 @@ hwmp_recv_preq(struct ieee80211vap *vap, * Propagate the original PREQ. * PREQ is unicast now to rttarg->rt_nexthop */ - ppreq.preq_flags &= - ~IEEE80211_MESHPREQ_FLAGS_AM; + ppreq.preq_flags |= + IEEE80211_MESHPREQ_FLAGS_AM; ppreq.preq_hopcount += 1; ppreq.preq_ttl -= 1; ppreq.preq_metric += @@ -1701,7 +1701,7 @@ hwmp_discover(struct ieee80211vap *vap, * Try to discover the path for this node. * Group addressed PREQ Case A */ - preq.preq_flags = IEEE80211_MESHPREQ_FLAGS_AM; + preq.preq_flags = 0; preq.preq_hopcount = 0; preq.preq_ttl = ms->ms_ttl; preq.preq_id = ++hs->hs_preqid; Modified: head/sys/net80211/ieee80211_mesh.h == --- head/sys/net80211/ieee80211_mesh.h Tue May 1 16:05:09 2012 (r234883) +++ head/sys/net80211/ieee80211_mesh.h Tue May 1 16:06:20 2012 (r234884) @@ -230,7 +230,7 @@ struct ieee80211_meshpreq_ie { uint8_t preq_len; uint8_t preq_flags; #defineIEEE80211_MESHPREQ_FLAGS_PR 0x01/* Portal Role */ -#defineIEEE80211_MESHPREQ_FLAGS_AM 0x02/* 0 = ucast / 1 = bcast */ +#defineIEEE80211_MESHPREQ_FLAGS_AM 0x02/* 0 = bcast / 1 = ucast */ #defineIEEE80211_MESHPREQ_FLAGS_PP 0x04/* Proactive PREP */ #defineIEEE80211_MESHPREQ_FLAGS_AE 0x40/* Address Extension */ uint8_t preq_hopcount; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234885 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:07:35 2012 New Revision: 234885 URL: http://svn.freebsd.org/changeset/base/234885 Log: * Fixed hwmp_discover code to populate a PREQ packet correctly; * Removed IEEE80211_MESHPREQ_TFLAGS_RF which is no longer part of the amendment spec; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:06:20 2012 (r234884) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:07:35 2012 (r234885) @@ -171,9 +171,6 @@ static SYSCTL_NODE(_net_wlan, OID_AUTO, static int ieee80211_hwmp_targetonly = 0; SYSCTL_INT(_net_wlan_hwmp, OID_AUTO, targetonly, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_hwmp_targetonly, 0, "Set TO bit on generated PREQs"); -static int ieee80211_hwmp_replyforward = 1; -SYSCTL_INT(_net_wlan_hwmp, OID_AUTO, replyforward, CTLTYPE_INT | CTLFLAG_RW, -&ieee80211_hwmp_replyforward, 0, "Set RF bit on generated PREQs"); static int ieee80211_hwmp_pathtimeout = -1; SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, pathlifetime, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_hwmp_pathtimeout, 0, ieee80211_sysctl_msecs_ticks, "I", @@ -838,8 +835,7 @@ hwmp_rootmode_cb(void *arg) preq.preq_metric = IEEE80211_MESHLMETRIC_INITIALVAL; preq.preq_tcount = 1; IEEE80211_ADDR_COPY(PREQ_TADDR(0), broadcastaddr); - PREQ_TFLAGS(0) = IEEE80211_MESHPREQ_TFLAGS_TO | - IEEE80211_MESHPREQ_TFLAGS_RF; + PREQ_TFLAGS(0) = IEEE80211_MESHPREQ_TFLAGS_TO; PREQ_TSEQ(0) = 0; vap->iv_stats.is_hwmp_rootreqs++; hwmp_send_preq(vap->iv_bss, vap->iv_myaddr, broadcastaddr, &preq, @@ -1104,8 +1100,6 @@ hwmp_recv_preq(struct ieee80211vap *vap, */ ppreq.preq_targets[0].target_flags |= IEEE80211_MESHPREQ_TFLAGS_TO; - ppreq.preq_targets[0].target_flags &= - ~IEEE80211_MESHPREQ_TFLAGS_RF; hwmp_send_preq(ni, vap->iv_myaddr, rttarg->rt_nexthop, &ppreq, &hrtarg->hr_lastpreq, @@ -1709,16 +1703,14 @@ hwmp_discover(struct ieee80211vap *vap, preq.preq_origseq = hr->hr_origseq; preq.preq_lifetime = ticks_to_msecs(ieee80211_hwmp_pathtimeout); - preq.preq_metric = rt->rt_metric; + preq.preq_metric = IEEE80211_MESHLMETRIC_INITIALVAL; preq.preq_tcount = 1; IEEE80211_ADDR_COPY(PREQ_TADDR(0), dest); PREQ_TFLAGS(0) = 0; if (ieee80211_hwmp_targetonly) PREQ_TFLAGS(0) |= IEEE80211_MESHPREQ_TFLAGS_TO; - if (ieee80211_hwmp_replyforward) - PREQ_TFLAGS(0) |= IEEE80211_MESHPREQ_TFLAGS_RF; PREQ_TFLAGS(0) |= IEEE80211_MESHPREQ_TFLAGS_USN; - PREQ_TSEQ(0) = hr->hr_seq; + PREQ_TSEQ(0) = 0; /* RESERVED when USN flag is set */ /* XXX check return value */ hwmp_send_preq(vap->iv_bss, vap->iv_myaddr, broadcastaddr, &preq, &hr->hr_lastpreq, Modified: head/sys/net80211/ieee80211_mesh.h == --- head/sys/net80211/ieee80211_mesh.h Tue May 1 16:06:20 2012 (r234884) +++ head/sys/net80211/ieee80211_mesh.h Tue May 1 16:07:35 2012 (r234885) @@ -246,7 +246,6 @@ struct ieee80211_meshpreq_ie { struct { uint8_t target_flags; #defineIEEE80211_MESHPREQ_TFLAGS_TO0x01/* Target Only */ -#defineIEEE80211_MESHPREQ_TFLAGS_RF0x02/* Reply and Forward */ #defineIEEE80211_MESHPREQ_TFLAGS_USN 0x04/* Unknown HWMP seq number */ uint8_t target_addr[IEEE80211_ADDR_LEN]; uint32_ttarget_seq; /* HWMP Sequence Number */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234886 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:08:46 2012 New Revision: 234886 URL: http://svn.freebsd.org/changeset/base/234886 Log: * Proactive PREQ (original transmission) must also set IEEE80211_MESHPREQ_TFLAGS_USN flag in target_flag field; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:07:35 2012 (r234885) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:08:46 2012 (r234886) @@ -835,7 +835,8 @@ hwmp_rootmode_cb(void *arg) preq.preq_metric = IEEE80211_MESHLMETRIC_INITIALVAL; preq.preq_tcount = 1; IEEE80211_ADDR_COPY(PREQ_TADDR(0), broadcastaddr); - PREQ_TFLAGS(0) = IEEE80211_MESHPREQ_TFLAGS_TO; + PREQ_TFLAGS(0) = IEEE80211_MESHPREQ_TFLAGS_TO | + IEEE80211_MESHPREQ_TFLAGS_USN; PREQ_TSEQ(0) = 0; vap->iv_stats.is_hwmp_rootreqs++; hwmp_send_preq(vap->iv_bss, vap->iv_myaddr, broadcastaddr, &preq, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234887 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:09:44 2012 New Revision: 234887 URL: http://svn.freebsd.org/changeset/base/234887 Log: * PREQ acceptance criteria updated to check for proxy condition as in amendment; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:08:46 2012 (r234886) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:09:44 2012 (r234887) @@ -907,13 +907,17 @@ hwmp_recv_preq(struct ieee80211vap *vap, PREQ_TADDR(0), ":"); /* -* Acceptance criteria: if the PREQ is not for us or not broadcast +* Acceptance criteria: (if the PREQ is not for us or not broadcast, +* or an external mac address not proxied by us), * AND forwarding is disabled, discard this PREQ. -* XXX: need to check PROXY */ - if ((!IEEE80211_ADDR_EQ(vap->iv_myaddr, PREQ_TADDR(0)) || - !IEEE80211_IS_MULTICAST(PREQ_TADDR(0))) && - !(ms->ms_flags & IEEE80211_MESHFLAGS_FWD)) { + rttarg = ieee80211_mesh_rt_find(vap, PREQ_TADDR(0)); + if (!(ms->ms_flags & IEEE80211_MESHFLAGS_FWD) && + (!IEEE80211_ADDR_EQ(vap->iv_myaddr, PREQ_TADDR(0)) || + !IEEE80211_IS_MULTICAST(PREQ_TADDR(0)) || + (rttarg != NULL && + rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY && + IEEE80211_ADDR_EQ(vap->iv_myaddr, rttarg->rt_mesh_gate { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_HWMP, preq->preq_origaddr, NULL, "%s", "not accepting PREQ"); return; @@ -922,7 +926,6 @@ hwmp_recv_preq(struct ieee80211vap *vap, * Acceptance criteria: if unicast addressed * AND no valid forwarding for Target of PREQ, discard this PREQ. */ - rttarg = ieee80211_mesh_rt_find(vap, PREQ_TADDR(0)); if(rttarg != NULL) hrtarg = IEEE80211_MESH_ROUTE_PRIV(rttarg, struct ieee80211_hwmp_route); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234888 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:10:32 2012 New Revision: 234888 URL: http://svn.freebsd.org/changeset/base/234888 Log: Updated PREQ propagation code; * When receiving a Proactive PREQ dont return after processing it but propagate; * When we propagate we should not enforce ratechecking; * Added checking for multiple pred ID detection; * Storing proxy orig address when PREQ is not for us; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:09:44 2012 (r234887) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:10:32 2012 (r234888) @@ -886,11 +886,13 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_mesh_route *rt = NULL; /* pro-active code */ struct ieee80211_mesh_route *rtorig = NULL; + struct ieee80211_mesh_route *rtorig_ext = NULL; struct ieee80211_mesh_route *rttarg = NULL; struct ieee80211_hwmp_route *hrorig = NULL; struct ieee80211_hwmp_route *hrtarg = NULL; struct ieee80211_hwmp_state *hs = vap->iv_hwmp; struct ieee80211_meshprep_ie prep; + ieee80211_hwmp_seq preqid; /* last seen preqid for orig */ if (ni == vap->iv_bss || ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) @@ -945,15 +947,22 @@ hwmp_recv_preq(struct ieee80211vap *vap, rtorig = ieee80211_mesh_rt_find(vap, preq->preq_origaddr); if (rtorig == NULL) { rtorig = ieee80211_mesh_rt_add(vap, preq->preq_origaddr); + if (rtorig == NULL) { + IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, + "unable to add orig path to %6D", + preq->preq_origaddr, ":"); + vap->iv_stats.is_mesh_rtaddfailed++; + return; + } IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "adding originator %6D", preq->preq_origaddr, ":"); } - if (rtorig == NULL) { - /* XXX stat */ - return; - } hrorig = IEEE80211_MESH_ROUTE_PRIV(rtorig, struct ieee80211_hwmp_route); + /* record last seen preqid */ + preqid = hrorig->hr_preqid; + hrorig->hr_preqid = HWMP_SEQ_MAX(hrorig->hr_preqid, preq->preq_id); + /* Data creation and update of forwarding information * according to Table 11C-8 for originator mesh STA. */ @@ -968,13 +977,16 @@ hwmp_recv_preq(struct ieee80211vap *vap, ieee80211_mesh_rt_update(rtorig, preq->preq_lifetime); /* path to orig is valid now */ rtorig->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; - }else if(hrtarg != NULL && - HWMP_SEQ_EQ(hrtarg->hr_seq, PREQ_TSEQ(0)) && - (rtorig->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0) { + }else if ((hrtarg != NULL && + HWMP_SEQ_EQ(hrtarg->hr_seq, PREQ_TSEQ(0)) && + ((rtorig->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0)) || + preqid >= preq->preq_id) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "discard PREQ from %6D, old seq no %u <= %u", + "discard PREQ from %6D, old seqno %u <= %u," + " or old preqid %u < %u", preq->preq_origaddr, ":", - preq->preq_origseq, hrorig->hr_seq); + preq->preq_origseq, hrorig->hr_seq, + preq->preq_id, preqid); return; } @@ -1025,6 +1037,26 @@ hwmp_recv_preq(struct ieee80211vap *vap, hwmp_send_prep(ni, vap->iv_myaddr, wh->i_addr2, &prep); return; } + /* we may update our proxy information for the orig external */ + else if (preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_AE) { + rtorig_ext = + ieee80211_mesh_rt_find(vap, preq->preq_orig_ext_addr); + if (rtorig_ext == NULL) { + rtorig_ext = ieee80211_mesh_rt_add(vap, + preq->preq_orig_ext_addr); + if (rtorig_ext == NULL) { + IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, + "unable to add orig ext proxy to %6D", + preq->preq_orig_ext_addr, ":"); + vap->iv_stats.is_mesh_rtaddfailed++; + return; + } + IEEE80211_ADDR_COPY(rtorig_ext->rt_mesh_gate, + preq->preq_origaddr); + } + rtorig_ext->rt_ext_seq = preq->preq_origseq; + ieee80211_mesh_rt_update(rtorig_ex
svn commit: r234889 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:11:47 2012 New Revision: 234889 URL: http://svn.freebsd.org/changeset/base/234889 Log: * Modified PERR acceptance criteria according to amendment; * Modified how PERR is handled and propagated according to amendment; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:10:32 2012 (r234888) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:11:47 2012 (r234889) @@ -1450,7 +1450,7 @@ hwmp_peerdown(struct ieee80211_node *ni) PERR_DFLAGS(0) |= IEEE80211_MESHPERR_DFLAGS_USN; PERR_DFLAGS(0) |= IEEE80211_MESHPERR_DFLAGS_RC; IEEE80211_ADDR_COPY(PERR_DADDR(0), rt->rt_dest); - PERR_DSEQ(0) = hr->hr_seq; + PERR_DSEQ(0) = ++hr->hr_seq; PERR_DRCODE(0) = IEEE80211_REASON_MESH_PERR_DEST_UNREACH; /* NB: flush everything passing through peer */ ieee80211_mesh_rt_flush_peer(vap, ni->ni_macaddr); @@ -1461,60 +1461,117 @@ hwmp_peerdown(struct ieee80211_node *ni) #undef PERR_DSEQ #undef PERR_DRCODE -#definePERR_DFLAGS(n) perr->perr_dests[n].dest_flags -#definePERR_DADDR(n) perr->perr_dests[n].dest_addr -#definePERR_DSEQ(n)perr->perr_dests[n].dest_seq -#definePERR_DRCODE(n) perr->perr_dests[n].dest_rcode +#definePERR_DFLAGS(n) perr->perr_dests[n].dest_flags +#definePERR_DADDR(n) perr->perr_dests[n].dest_addr +#definePERR_DSEQ(n)perr->perr_dests[n].dest_seq +#definePERR_DEXTADDR(n)perr->perr_dests[n].dest_ext_addr +#definePERR_DRCODE(n) perr->perr_dests[n].dest_rcode static void hwmp_recv_perr(struct ieee80211vap *vap, struct ieee80211_node *ni, const struct ieee80211_frame *wh, const struct ieee80211_meshperr_ie *perr) { struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_mesh_route *rt = NULL; + struct ieee80211_mesh_route *rt_ext = NULL; struct ieee80211_hwmp_route *hr; - struct ieee80211_meshperr_ie pperr; - int i, forward = 0; + struct ieee80211_meshperr_ie *pperr = NULL; + int i, j = 0, forward = 0; - /* -* Acceptance criteria: check if we received a PERR from a -* neighbor and forwarding is enabled. -*/ if (ni == vap->iv_bss || - ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED || - !(ms->ms_flags & IEEE80211_MESHFLAGS_FWD)) + ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) return; + + IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, + "received PERR from %6D", wh->i_addr2, ":"); + + /* +* if forwarding is true, prepare pperr +*/ + if (ms->ms_flags & IEEE80211_MESHFLAGS_FWD) { + forward = 1; + pperr = malloc(sizeof(*perr) + 31*sizeof(*perr->perr_dests), + M_80211_MESH_PERR, M_NOWAIT); /* XXX: magic number, 32 err dests */ + } + /* -* Find all routing entries that match and delete them. +* Acceptance criteria: check if we have forwarding information +* stored about destination, and that nexthop == TA of this PERR. +* NB: we also build a new PERR to propagate in case we should forward. */ for (i = 0; i < perr->perr_ndests; i++) { rt = ieee80211_mesh_rt_find(vap, PERR_DADDR(i)); - if (rt == NULL) + if (rt == NULL || rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) continue; + if (!IEEE80211_ADDR_EQ(rt->rt_nexthop, wh->i_addr2)) + continue; + + /* found and accepted a PERR ndest element, process it... */ + if (forward) + memcpy(&pperr->perr_dests[j], &perr->perr_dests[i], + sizeof(*perr->perr_dests)); hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route); - if (!(PERR_DFLAGS(0) & IEEE80211_MESHPERR_DFLAGS_USN) && - HWMP_SEQ_GEQ(PERR_DSEQ(i), hr->hr_seq)) { - ieee80211_mesh_rt_del(vap, rt->rt_dest); - ieee80211_mesh_rt_flush_peer(vap, rt->rt_dest); - rt = NULL; - forward = 1; + switch(PERR_DFLAGS(i)) { + case (IEEE80211_REASON_MESH_PERR_NO_FI): + if (PERR_DSEQ(i) == 0) { + hr->hr_seq++; + if (forward) { + pperr->perr_dests[j].dest_seq = + hr->hr_seq; + } + } else { + hr->hr_seq = PERR
svn commit: r234890 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:12:39 2012 New Revision: 234890 URL: http://svn.freebsd.org/changeset/base/234890 Log: PERR update to be called from mesh code. * Added mpp_senderror for Mesh Path Selection protocol; * Added hwmp_senderror that will send an HWMP PERR according to the supplied reason code; * Call mpp_senderror when deleting a route with correct reason code for whether the route is marked proxy or not; * Call mpp_senderror when trying to forward an individually addressed frame and there is no forwarding information; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:11:47 2012 (r234889) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:12:39 2012 (r234890) @@ -105,6 +105,9 @@ static int hwmp_send_perr(struct ieee802 const uint8_t [IEEE80211_ADDR_LEN], const uint8_t [IEEE80211_ADDR_LEN], struct ieee80211_meshperr_ie *); +static voidhwmp_senderror(struct ieee80211vap *, + const uint8_t [IEEE80211_ADDR_LEN], + struct ieee80211_mesh_route *, int); static voidhwmp_recv_rann(struct ieee80211vap *, struct ieee80211_node *, const struct ieee80211_frame *, const struct ieee80211_meshrann_ie *); @@ -206,6 +209,7 @@ static struct ieee80211_mesh_proto_path .mpp_ie = IEEE80211_MESHCONF_PATH_HWMP, .mpp_discover = hwmp_discover, .mpp_peerdown = hwmp_peerdown, + .mpp_senderror = hwmp_senderror, .mpp_vattach= hwmp_vattach, .mpp_vdetach= hwmp_vdetach, .mpp_newstate = hwmp_newstate, @@ -1569,7 +1573,7 @@ done: free(pperr, M_80211_MESH_PERR); } #undef PERR_DFLAGS -#undef PEER_DADDR +#undef PERR_DADDR #undef PERR_DSEQ #undef PERR_DEXTADDR #undef PERR_DRCODE @@ -1614,6 +1618,64 @@ hwmp_send_perr(struct ieee80211_node *ni return hwmp_send_action(ni, sa, da, (uint8_t *)perr, perr->perr_len+2); } +/* + * Called from the rest of the net80211 code (mesh code for example). + * NB: IEEE80211_REASON_MESH_PERR_DEST_UNREACH can be trigger by the fact that + * a mesh STA is unable to forward an MSDU/MMPDU to a next-hop mesh STA. + */ +#definePERR_DFLAGS(n) perr.perr_dests[n].dest_flags +#definePERR_DADDR(n) perr.perr_dests[n].dest_addr +#definePERR_DSEQ(n)perr.perr_dests[n].dest_seq +#definePERR_DEXTADDR(n)perr.perr_dests[n].dest_ext_addr +#definePERR_DRCODE(n) perr.perr_dests[n].dest_rcode +static void +hwmp_senderror(struct ieee80211vap *vap, +const uint8_t addr[IEEE80211_ADDR_LEN], +struct ieee80211_mesh_route *rt, int rcode) +{ + struct ieee80211_mesh_state *ms = vap->iv_mesh; + struct ieee80211_hwmp_route *hr = NULL; + struct ieee80211_meshperr_ie perr; + + if (rt != NULL) + hr = IEEE80211_MESH_ROUTE_PRIV(rt, + struct ieee80211_hwmp_route); + + perr.perr_ndests = 1; + perr.perr_ttl = ms->ms_ttl; + PERR_DFLAGS(0) = 0; + PERR_DRCODE(0) = rcode; + + switch (rcode) { + case IEEE80211_REASON_MESH_PERR_NO_FI: + IEEE80211_ADDR_COPY(PERR_DADDR(0), addr); + PERR_DSEQ(0) = 0; /* reserved */ + break; + case IEEE80211_REASON_MESH_PERR_NO_PROXY: + KASSERT(rt != NULL, ("no proxy info for sending PERR")); + KASSERT(rt->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY, + ("route is not marked proxy")); + PERR_DFLAGS(0) |= IEEE80211_MESHPERR_FLAGS_AE; + IEEE80211_ADDR_COPY(PERR_DADDR(0), vap->iv_myaddr); + PERR_DSEQ(0) = rt->rt_ext_seq; + IEEE80211_ADDR_COPY(PERR_DEXTADDR(0), addr); + break; + case IEEE80211_REASON_MESH_PERR_DEST_UNREACH: + KASSERT(rt != NULL, ("no route info for sending PERR")); + IEEE80211_ADDR_COPY(PERR_DADDR(0), addr); + PERR_DSEQ(0) = hr->hr_seq; + break; + default: + KASSERT(0, ("unknown reason code for HWMP PERR (%u)", rcode)); + } + hwmp_send_perr(vap->iv_bss, vap->iv_myaddr, broadcastaddr, &perr); +} +#undef PERR_DFLAGS +#undef PEER_DADDR +#undef PERR_DSEQ +#undef PERR_DEXTADDR +#undef PERR_DRCODE + static void hwmp_recv_rann(struct ieee80211vap *vap, struct ieee80211_node *ni, const struct ieee80211_frame *wh, const struct ieee80211_meshrann_ie *rann) Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.
svn commit: r234891 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:13:22 2012 New Revision: 234891 URL: http://svn.freebsd.org/changeset/base/234891 Log: RANN update * Introduced a new HWMP sysctl, Root Confirmation Interval; * Added hr_lastrootconf to hwmp_route, is for ratecheck for a specific ROOT; * We missed reading RANN.interval subfield from a RANN frame before; * Updated hwmp_recv_rann according to amendment, see comments; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:12:39 2012 (r234890) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:13:22 2012 (r234891) @@ -157,6 +157,7 @@ struct ieee80211_hwmp_route { ieee80211_hwmp_seq hr_preqid; /* last PREQ ID seen from dst */ ieee80211_hwmp_seq hr_origseq; /* seq. no. on our latest PREQ*/ struct timeval hr_lastpreq;/* last time we sent a PREQ */ + struct timeval hr_lastrootconf; /* last sent PREQ root conf */ int hr_preqretries; /* number of discoveries */ int hr_lastdiscovery; /* last discovery in ticks */ }; @@ -199,6 +200,11 @@ static int ieee80211_hwmp_rannint = -1; SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, rannint, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_hwmp_rannint, 0, ieee80211_sysctl_msecs_ticks, "I", "root announcement interval (ms)"); +static struct timeval ieee80211_hwmp_rootconfint = { 0, 0 }; +static int ieee80211_hwmp_rootconfint_internal = -1; +SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, rootconfint, CTLTYPE_INT | CTLFLAG_RD, +&ieee80211_hwmp_rootconfint_internal, 0, ieee80211_sysctl_msecs_ticks, "I", +"root confirmation interval (ms) (read-only)"); #defineIEEE80211_HWMP_DEFAULT_MAXHOPS 31 @@ -228,6 +234,7 @@ ieee80211_hwmp_init(void) ieee80211_hwmp_roottimeout = msecs_to_ticks(5*1000); ieee80211_hwmp_rootint = msecs_to_ticks(2*1000); ieee80211_hwmp_rannint = msecs_to_ticks(1*1000); + ieee80211_hwmp_rootconfint_internal = msecs_to_ticks(2*1000); ieee80211_hwmp_maxpreq_retries = 3; /* * (TU): A measurement of time equal to 1024 μs, @@ -236,6 +243,13 @@ ieee80211_hwmp_init(void) ieee80211_hwmp_net_diameter_traversaltime = msecs_to_ticks(512); /* +* NB: I dont know how to make SYSCTL_PROC that calls ms to ticks +* and return a struct timeval... +*/ + ieee80211_hwmp_rootconfint.tv_usec = + ieee80211_hwmp_rootconfint_internal * 1000; + + /* * Register action frame handler. */ ieee80211_recv_action_register(IEEE80211_ACTION_CAT_MESH, @@ -555,6 +569,7 @@ hwmp_recv_action_meshpath(struct ieee802 } memcpy(&rann, mrann, sizeof(rann)); rann.rann_seq = LE_READ_4(&mrann->rann_seq); + rann.rann_interval = LE_READ_4(&mrann->rann_interval); rann.rann_metric = LE_READ_4(&mrann->rann_metric); hwmp_recv_rann(vap, ni, wh, &rann); found++; @@ -873,6 +888,7 @@ hwmp_rootmode_rann_cb(void *arg) rann.rann_ttl = ms->ms_ttl; IEEE80211_ADDR_COPY(rann.rann_addr, vap->iv_myaddr); rann.rann_seq = ++hs->hs_seq; + rann.rann_interval = ieee80211_hwmp_rannint; rann.rann_metric = IEEE80211_MESHLMETRIC_INITIALVAL; vap->iv_stats.is_hwmp_rootrann++; @@ -1684,7 +1700,9 @@ hwmp_recv_rann(struct ieee80211vap *vap, struct ieee80211_hwmp_state *hs = vap->iv_hwmp; struct ieee80211_mesh_route *rt = NULL; struct ieee80211_hwmp_route *hr; + struct ieee80211_meshpreq_ie preq; struct ieee80211_meshrann_ie prann; + uint32_t metric = 0; if (ni == vap->iv_bss || ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED || @@ -1692,27 +1710,74 @@ hwmp_recv_rann(struct ieee80211vap *vap, return; rt = ieee80211_mesh_rt_find(vap, rann->rann_addr); - /* -* Discover the path to the root mesh STA. -* If we already know it, propagate the RANN element. -*/ + if (rt != NULL && rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) { + hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route); + + /* Acceptance criteria: if RANN.seq < stored seq, discard RANN */ + if (HWMP_SEQ_LT(rann->rann_seq, hr->hr_seq)) { + IEEE80211_DISCARD(vap, IEEE80211_MSG_HWMP, wh, NULL, + "RANN seq %u < %u", rann->rann_seq, hr->hr_seq); + return; + } + + /* Acceptance criteria: if RANN.seq == stored seq AND + * RANN.me
svn commit: r234892 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:14:18 2012 New Revision: 234892 URL: http://svn.freebsd.org/changeset/base/234892 Log: Net80211s update: Mesh Gate Announcement and removal of Portal Announcement. * Renamed IEEE80211_ELEMID_MESHPANN to IEEE80211_ELEMID_MESHGANN according to amendment; * Added IEEE80211_IOC_MESH_GATE that controls whether Mesh Gate Announcement is activated or not; * Renamed all flags from Portal to Gate in HWMP frames; * Removed IEEE80211_ACTION_MESHPANN enum cause its part of the Mesh Action category now as per amendment; * Renamed IEEE80211_MESHFLAGS_PORTAL to IEEE80211_MESHFLAGS_GATE in ieee80211_mesh_state flags; * Modified ieee80211_hwmp.c/ieee80211_mesh.c to use new GATE flags; Approved by: adrian Modified: head/sys/net80211/ieee80211.h head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_ioctl.h head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211.h == --- head/sys/net80211/ieee80211.h Tue May 1 16:13:22 2012 (r234891) +++ head/sys/net80211/ieee80211.h Tue May 1 16:14:18 2012 (r234892) @@ -734,7 +734,7 @@ enum { IEEE80211_ELEMID_MESHAWAKEW = 119, IEEE80211_ELEMID_MESHBEACONT= 120, /* 121-124 MMCAOP not implemented yet */ - IEEE80211_ELEMID_MESHPANN = 125, /* XXX: is GANN now, not used */ + IEEE80211_ELEMID_MESHGANN = 125, IEEE80211_ELEMID_MESHRANN = 126, /* 127 Extended Capabilities */ /* 128-129 reserved */ Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:13:22 2012 (r234891) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:14:18 2012 (r234892) @@ -840,9 +840,9 @@ hwmp_rootmode_cb(void *arg) IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, vap->iv_bss, "%s", "send broadcast PREQ"); - preq.preq_flags = 0; - if (ms->ms_flags & IEEE80211_MESHFLAGS_PORTAL) - preq.preq_flags |= IEEE80211_MESHPREQ_FLAGS_PR; + preq.preq_flags = IEEE80211_MESHPREQ_FLAGS_AM; + if (ms->ms_flags & IEEE80211_MESHFLAGS_GATE) + preq.preq_flags |= IEEE80211_MESHPREQ_FLAGS_GATE; if (hs->hs_rootmode == IEEE80211_HWMP_ROOTMODE_PROACTIVE) preq.preq_flags |= IEEE80211_MESHPREQ_FLAGS_PP; preq.preq_hopcount = 0; @@ -882,8 +882,8 @@ hwmp_rootmode_rann_cb(void *arg) "%s", "send broadcast RANN"); rann.rann_flags = 0; - if (ms->ms_flags & IEEE80211_MESHFLAGS_PORTAL) - rann.rann_flags |= IEEE80211_MESHRANN_FLAGS_PR; + if (ms->ms_flags & IEEE80211_MESHFLAGS_GATE) + rann.rann_flags |= IEEE80211_MESHFLAGS_GATE; rann.rann_hopcount = 0; rann.rann_ttl = ms->ms_ttl; IEEE80211_ADDR_COPY(rann.rann_addr, vap->iv_myaddr); Modified: head/sys/net80211/ieee80211_ioctl.h == --- head/sys/net80211/ieee80211_ioctl.h Tue May 1 16:13:22 2012 (r234891) +++ head/sys/net80211/ieee80211_ioctl.h Tue May 1 16:14:18 2012 (r234892) @@ -709,6 +709,7 @@ struct ieee80211req { #defineIEEE80211_IOC_MESH_PR_SIG 178 /* mesh sig protocol */ #defineIEEE80211_IOC_MESH_PR_CC179 /* mesh congestion protocol */ #defineIEEE80211_IOC_MESH_PR_AUTH 180 /* mesh auth protocol */ +#defineIEEE80211_IOC_MESH_GATE 181 /* mesh gate XXX: 173? */ #defineIEEE80211_IOC_HWMP_ROOTMODE 190 /* HWMP root mode */ #defineIEEE80211_IOC_HWMP_MAXHOPS 191 /* number of hops before drop */ Modified: head/sys/net80211/ieee80211_mesh.c == --- head/sys/net80211/ieee80211_mesh.c Tue May 1 16:13:22 2012 (r234891) +++ head/sys/net80211/ieee80211_mesh.c Tue May 1 16:14:18 2012 (r234892) @@ -1262,7 +1262,7 @@ mesh_recv_group_data(struct ieee80211vap * This happens by delivering the packet, and a bridge * will sent it on another port member. */ - if (ms->ms_flags & IEEE80211_MESHFLAGS_PORTAL && + if (ms->ms_flags & IEEE80211_MESHFLAGS_GATE && ms->ms_flags & IEEE80211_MESHFLAGS_FWD) IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, MC01(mc)->mc_addr4, "%s", @@ -2768,8 +2768,8 @@ ieee80211_add_meshconf(uint8_t *frm, str /* NB: set the number of neighbors before the rest */ *frm = (ms->ms_neighbors > IEEE80211_MESH_MAX_NEIGHBORS ? I
svn commit: r234893 - head/sbin/ifconfig
Author: monthadar Date: Tue May 1 16:15:34 2012 New Revision: 234893 URL: http://svn.freebsd.org/changeset/base/234893 Log: * Added new command to ifconfig to activate Mesh Gate Announcement called meshgate with corresponding explanation; Approved by: adrian Modified: head/sbin/ifconfig/ifconfig.8 head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifconfig.8 == --- head/sbin/ifconfig/ifconfig.8 Tue May 1 16:14:18 2012 (r234892) +++ head/sbin/ifconfig/ifconfig.8 Tue May 1 16:15:34 2012 (r234893) @@ -1979,6 +1979,12 @@ Enable or disable forwarding packets by By default .Cm meshforward is enabled. +.It Cm meshgate +This attribute specifies whether or not the mesh STA activates mesh gate +announcements. +By default +.Cm meshgate +is disabled. .It Cm meshmetric Ar protocol Set the specified .Ar protocol Modified: head/sbin/ifconfig/ifieee80211.c == --- head/sbin/ifconfig/ifieee80211.cTue May 1 16:14:18 2012 (r234892) +++ head/sbin/ifconfig/ifieee80211.cTue May 1 16:15:34 2012 (r234893) @@ -1883,6 +1883,12 @@ DECL_CMD_FUNC(set80211meshforward, val, } static +DECL_CMD_FUNC(set80211meshgate, val, d) +{ + set80211(s, IEEE80211_IOC_MESH_GATE, d, 0, NULL); +} + +static DECL_CMD_FUNC(set80211meshpeering, val, d) { set80211(s, IEEE80211_IOC_MESH_AP, d, 0, NULL); @@ -4832,6 +4838,12 @@ end: else LINE_CHECK("-meshforward"); } + if (get80211val(s, IEEE80211_IOC_MESH_GATE, &val) != -1) { + if (val) + LINE_CHECK("meshgate"); + else + LINE_CHECK("-meshgate"); + } if (get80211len(s, IEEE80211_IOC_MESH_PR_METRIC, data, 12, &len) != -1) { data[len] = '\0'; @@ -5271,6 +5283,8 @@ static struct cmd ieee80211_cmds[] = { DEF_CMD_ARG("meshttl", set80211meshttl), DEF_CMD("meshforward", 1, set80211meshforward), DEF_CMD("-meshforward", 0, set80211meshforward), + DEF_CMD("meshgate", 1, set80211meshgate), + DEF_CMD("-meshgate",0, set80211meshgate), DEF_CMD("meshpeering", 1, set80211meshpeering), DEF_CMD("-meshpeering", 0, set80211meshpeering), DEF_CMD_ARG("meshmetric", set80211meshmetric), ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234894 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:16:20 2012 New Revision: 234894 URL: http://svn.freebsd.org/changeset/base/234894 Log: PREQ discovery update. * Added a new discovery flag IEEE80211_MESHRT_FLAGS_DISCOVER; * Modified ieee80211_ioctl.h to include IEEE80211_MESHRT_FLAGS_DISCOVER; * Added hwmp_rediscover_cb, which will be called by a timeout to do rediscovery if we have not reach max number of preq discovery; * Modified hwmp_discover to setup a callout for path rediscovery; * Added to ieee80211req_mesh_route to have a back pointer to ieee80211vap for the discovery callout context; * Modified mesh_rt_add_locked arguemnt from ieee80211_mesh_state to ieee80211vap, this because we have to initialize the above back pointer; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_ioctl.h head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:15:34 2012 (r234893) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:16:20 2012 (r234894) @@ -1319,7 +1319,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, rt->rt_metric = metric; rt->rt_nhops = prep->prep_hopcount + 1; ieee80211_mesh_rt_update(rt, prep->prep_lifetime); - rt->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; /* mark valid */ + rt->rt_flags = IEEE80211_MESHRT_FLAGS_VALID; /* mark valid */ /* * If it's NOT for us, propagate the PREP @@ -1805,6 +1805,64 @@ hwmp_send_rann(struct ieee80211_node *ni #definePREQ_TFLAGS(n) preq.preq_targets[n].target_flags #definePREQ_TADDR(n) preq.preq_targets[n].target_addr #definePREQ_TSEQ(n)preq.preq_targets[n].target_seq +static void +hwmp_rediscover_cb(void *arg) +{ + struct ieee80211_mesh_route *rt = arg; + struct ieee80211vap *vap = rt->rt_vap; + struct ieee80211_hwmp_state *hs = vap->iv_hwmp; + struct ieee80211_mesh_state *ms = vap->iv_mesh; + struct ieee80211_hwmp_route *hr; + struct ieee80211_meshpreq_ie preq; /* Optimize: storing first preq? */ + + if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID)) + return ; /* nothing to do */ + + hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route); + if (hr->hr_preqretries >= + ieee80211_hwmp_maxpreq_retries) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, + rt->rt_dest, NULL, "%s", + "no valid path , max number of discovery, send GATE"); + /* TODO: send to known gates */ + vap->iv_stats.is_mesh_fwd_nopath++; + rt->rt_flags = 0; /* Mark invalid */ + return ; /* XXX: flush queue? */ + } + + hr->hr_preqretries++; + + + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_HWMP, rt->rt_dest, + "start path rediscovery , target seq %u", hr->hr_seq); + /* +* Try to discover the path for this node. +* Group addressed PREQ Case A +*/ + preq.preq_flags = 0; + preq.preq_hopcount = 0; + preq.preq_ttl = ms->ms_ttl; + preq.preq_id = ++hs->hs_preqid; + IEEE80211_ADDR_COPY(preq.preq_origaddr, vap->iv_myaddr); + preq.preq_origseq = hr->hr_origseq; + preq.preq_lifetime = ticks_to_msecs(ieee80211_hwmp_pathtimeout); + preq.preq_metric = IEEE80211_MESHLMETRIC_INITIALVAL; + preq.preq_tcount = 1; + IEEE80211_ADDR_COPY(PREQ_TADDR(0), rt->rt_dest); + PREQ_TFLAGS(0) = 0; + if (ieee80211_hwmp_targetonly) + PREQ_TFLAGS(0) |= IEEE80211_MESHPREQ_TFLAGS_TO; + PREQ_TFLAGS(0) |= IEEE80211_MESHPREQ_TFLAGS_USN; + PREQ_TSEQ(0) = 0; /* RESERVED when USN flag is set */ + /* XXX check return value */ + hwmp_send_preq(vap->iv_bss, vap->iv_myaddr, + broadcastaddr, &preq, &hr->hr_lastpreq, + &ieee80211_hwmp_preqminint); + callout_reset(&rt->rt_discovery, + ieee80211_hwmp_net_diameter_traversaltime * 2, + hwmp_rediscover_cb, rt); +} + static struct ieee80211_node * hwmp_discover(struct ieee80211vap *vap, const uint8_t dest[IEEE80211_ADDR_LEN], struct mbuf *m) @@ -1857,13 +1915,11 @@ hwmp_discover(struct ieee80211vap *vap, vap->iv_stats.is_mesh_fwd_nopath++; goto done; } + rt->rt_flags = IEEE80211_MESHRT_FLAGS_DISCOVER; hr->hr_preqretries++; if (hr->hr_origseq == 0) hr->hr_origseq = ++hs->hs_seq; rt->rt_metric = IEEE80211_MESHLMETRIC_INITIALVAL; - /* XXX: special discovery timeout, larger lifetime? */ -
svn commit: r234895 - head/sbin/ifconfig
Author: monthadar Date: Tue May 1 16:17:17 2012 New Revision: 234895 URL: http://svn.freebsd.org/changeset/base/234895 Log: * Modified ifconfig to show the IEEE80211_MESHRT_FLAGS_DISCOVER flag with a 'D'; Approved by: adrian Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c == --- head/sbin/ifconfig/ifieee80211.cTue May 1 16:16:20 2012 (r234894) +++ head/sbin/ifconfig/ifieee80211.cTue May 1 16:17:17 2012 (r234895) @@ -4020,6 +4020,8 @@ list_mesh(int s) ether_ntoa((const struct ether_addr *)rt->imr_nexthop), rt->imr_nhops, rt->imr_metric, rt->imr_lifetime, rt->imr_lastmseq, + (rt->imr_flags & IEEE80211_MESHRT_FLAGS_DISCOVER) ? + 'D' : (rt->imr_flags & IEEE80211_MESHRT_FLAGS_VALID) ? 'V' : '!', (rt->imr_flags & IEEE80211_MESHRT_FLAGS_PROXY) ? ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234896 - head/sys/net80211
Author: monthadar Date: Tue May 1 16:18:38 2012 New Revision: 234896 URL: http://svn.freebsd.org/changeset/base/234896 Log: Update HWMP Proactive code and mesh route flags. * Modified hwmp_recv_preq: o cleaned up code, removed rootmac variable because preq->origaddr is the root when we recevie a Proactive PREQ; o Modified so that a PREP in response of a Proactive PREQ is unicast, a PREP is ALWAYS unicast; * Modified hwmp_recv_prep: o Before we mark a route to be valid we should remove the discovery flag and then mark it valid in such a way we wont lose the isgate flag; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c == --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:17:17 2012 (r234895) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:18:38 2012 (r234896) @@ -904,7 +904,6 @@ hwmp_recv_preq(struct ieee80211vap *vap, const struct ieee80211_frame *wh, const struct ieee80211_meshpreq_ie *preq) { struct ieee80211_mesh_state *ms = vap->iv_mesh; - struct ieee80211_mesh_route *rt = NULL; /* pro-active code */ struct ieee80211_mesh_route *rtorig = NULL; struct ieee80211_mesh_route *rtorig_ext = NULL; struct ieee80211_mesh_route *rttarg = NULL; @@ -1083,33 +1082,20 @@ hwmp_recv_preq(struct ieee80211vap *vap, */ if (IEEE80211_ADDR_EQ(PREQ_TADDR(0), broadcastaddr) && (PREQ_TFLAGS(0) & IEEE80211_MESHPREQ_TFLAGS_TO)) { - uint8_t rootmac[IEEE80211_ADDR_LEN]; - - IEEE80211_ADDR_COPY(rootmac, preq->preq_origaddr); - rt = ieee80211_mesh_rt_find(vap, rootmac); - if (rt == NULL) { - rt = ieee80211_mesh_rt_add(vap, rootmac); - if (rt == NULL) { - IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "unable to add root mesh path to %6D", - rootmac, ":"); - vap->iv_stats.is_mesh_rtaddfailed++; - return; - } - } IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "root mesh station @ %6D", rootmac, ":"); + "root mesh station @ %6D", preq->preq_origaddr, ":"); /* * Reply with a PREP if we don't have a path to the root * or if the root sent us a proactive PREQ. */ - if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0 || + if ((rtorig->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0 || (preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_PP)) { prep.prep_flags = 0; prep.prep_hopcount = 0; prep.prep_ttl = ms->ms_ttl; - IEEE80211_ADDR_COPY(prep.prep_origaddr, rootmac); + IEEE80211_ADDR_COPY(prep.prep_origaddr, + preq->preq_origaddr); prep.prep_origseq = preq->preq_origseq; prep.prep_lifetime = preq->preq_lifetime; prep.prep_metric = IEEE80211_MESHLMETRIC_INITIALVAL; @@ -1117,7 +1103,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, vap->iv_myaddr); prep.prep_targetseq = ++hs->hs_seq; hwmp_send_prep(vap->iv_bss, vap->iv_myaddr, - broadcastaddr, &prep); + rtorig->rt_nexthop, &prep); } } @@ -1319,7 +1305,11 @@ hwmp_recv_prep(struct ieee80211vap *vap, rt->rt_metric = metric; rt->rt_nhops = prep->prep_hopcount + 1; ieee80211_mesh_rt_update(rt, prep->prep_lifetime); - rt->rt_flags = IEEE80211_MESHRT_FLAGS_VALID; /* mark valid */ + if (rt->rt_flags & IEEE80211_MESHRT_FLAGS_DISCOVER) { + /* discovery complete */ + rt->rt_flags &= ~IEEE80211_MESHRT_FLAGS_DISCOVER; + } + rt->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; /* mark valid */ /* * If it's NOT for us, propagate the PREP ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234897 - head/sys/boot/sparc64/loader
Author: marius Date: Tue May 1 16:38:33 2012 New Revision: 234897 URL: http://svn.freebsd.org/changeset/base/234897 Log: Add a command for showing the heap usage. PR: 165025 Submitted by: Gavin Mu MFC after:1 week Modified: head/sys/boot/sparc64/loader/main.c Modified: head/sys/boot/sparc64/loader/main.c == --- head/sys/boot/sparc64/loader/main.c Tue May 1 16:18:38 2012 (r234896) +++ head/sys/boot/sparc64/loader/main.c Tue May 1 16:38:33 2012 (r234897) @@ -800,6 +800,18 @@ main(int (*openfirm)(void *)) return (1); } +COMMAND_SET(heap, "heap", "show heap usage", command_heap); + +static int +command_heap(int argc, char *argv[]) +{ + + mallocstats(); + printf("heap base at %p, top at %p, upper limit at %p\n", heapva, + sbrk(0), heapva + HEAPSZ); + return(CMD_OK); +} + COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot); static int ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234898 - in head/sys/boot: ofw/libofw sparc64 sparc64/boot1 sparc64/loader sparc64/zfsboot sparc64/zfsloader zfs
Author: marius Date: Tue May 1 17:16:01 2012 New Revision: 234898 URL: http://svn.freebsd.org/changeset/base/234898 Log: Add initial support for booting from ZFS on sparc64. At least on Sun Fire V100, the firmware is known to be broken and not allowing to simultaneously open disk devices, causing attempts to boot from a mirror or RAIDZ to cause a crash. This will be worked around later. The firmwares of newer sun4u models don't seem to exhibit this problem though. Steps for ZFS booting: 1. create VTOC8 label # gpart create -s vtoc8 da0 2. add partitions, f.e.: # gpart add -t freebsd-zfs -s 60g da0 # gpart add -t freebsd-swap da0 resulting in something like: # gpart show =>0 143331930 da0 VTOC8 (68G) 0 1258210801 freebsd-zfs (60G) 125821080 175108502 freebsd-swap (8.4G) 3. create zpool # zpool create bunker da0a or for mirror/RAIDZ (after preparing additional disks as in steps 1. + 2.): # zpool create bunker mirror da0a da1a # zpool create bunker raidz da0a da1a da2a ... 4. set bootfs # zpool set bootfs=bunker bunker 5. install zfsboot # zpool export bunker # gpart bootcode -p /boot/zfsboot da0 6. write zfsloader to the ZFS Boot Block (so far, there's no dedicated tool for this, so dd(1) has to be used for this purpose) When using mirror/RAIDZ, step 4. and the dd(1) invocation should be repeated for the additional disks in order to be able to boot from another disk in case of failure. # sysctl kern.geom.debugflags=0x10 # dd if=/boot/zfsloader of=/dev/da0a bs=512 oseek=1024 conv=notrunc # zpool import bunker 7. install system on ZFS filesystem Don't forget to set 'zfs_load="YES"' and vfs.root.mountfrom="zfs:bunker" in loader.conf as well as 'zfs_enable="YES"'in rc.conf. 8. copy zpool.cache to the ZFS filesystem cp -p /boot/zfs/zpool.cache /bunker/boot/zfs/zpool.cache 9. set mountpoint # zfs set mountpoint=/ bunker 10. Now, given that aliases for all disks in the zpool exists (check with the `devalias` command on the boot monitor prompt) and disk0 corresponds to da0 (likewise for additional disks), the system can be booted from the ZFS with: {1} ok boot disk0 PR: 165025 Submitted by: Gavin Mu Added: head/sys/boot/sparc64/zfsboot/ head/sys/boot/sparc64/zfsboot/Makefile (contents, props changed) head/sys/boot/sparc64/zfsloader/ head/sys/boot/sparc64/zfsloader/Makefile (contents, props changed) Modified: head/sys/boot/ofw/libofw/devicename.c head/sys/boot/sparc64/Makefile head/sys/boot/sparc64/boot1/Makefile head/sys/boot/sparc64/boot1/boot1.c head/sys/boot/sparc64/loader/Makefile head/sys/boot/sparc64/loader/main.c head/sys/boot/zfs/zfs.c Modified: head/sys/boot/ofw/libofw/devicename.c == --- head/sys/boot/ofw/libofw/devicename.c Tue May 1 16:38:33 2012 (r234897) +++ head/sys/boot/ofw/libofw/devicename.c Tue May 1 17:16:01 2012 (r234898) @@ -28,6 +28,8 @@ __FBSDID("$FreeBSD$"); #include + +#include "bootstrap.h" #include "libofw.h" static int ofw_parsedev(struct ofw_devdesc **, const char *, const char **); @@ -76,6 +78,7 @@ ofw_parsedev(struct ofw_devdesc **dev, c phandle_t handle; const char *p; const char *s; +char *ep; char name[256]; char type[64]; intlen; @@ -87,9 +90,10 @@ ofw_parsedev(struct ofw_devdesc **dev, c len = s - devspec; bcopy(devspec, name, len); name[len] = '\0'; - if ((handle = OF_finddevice(name)) == -1) - break; - if (OF_getprop(handle, "device_type", type, sizeof(type)) == -1) + if ((handle = OF_finddevice(name)) == -1) { + bcopy(name, type, len); + type[len] = '\0'; + } else if (OF_getprop(handle, "device_type", type, sizeof(type)) == -1) continue; for (i = 0; (dv = devsw[i]) != NULL; i++) { if (strncmp(dv->dv_name, type, strlen(dv->dv_name)) == 0) @@ -109,6 +113,18 @@ found: strcpy(idev->d_path, name); idev->d_dev = dv; idev->d_type = dv->dv_type; +if (idev->d_type == DEVT_ZFS) { + idev->d_unit = 0; + p = name + strlen(dv->dv_name); + if (*p && (*p != ':')) { + idev->d_unit = strtol(p, &ep, 0); + if (ep == p) { + free(idev); + return (EUNIT); + } + } +} + if (dev == NULL) { free(idev); } else { Modified: head/sys/boot/sparc64/Makefile == --- head/sys/boot/sparc64/Makefile Tue May 1 16:38:33 2012 (r234897) +++ head/sys/boot/sparc64/Makefile Tue May 1 17:16:01 2012 (r234898) @@ -1,5 +1,5 @@ # $FreeBSD$ -SUB
svn commit: r234899 - head/sys/geom/raid
Author: mav Date: Tue May 1 18:00:31 2012 New Revision: 234899 URL: http://svn.freebsd.org/changeset/base/234899 Log: Improve spare disks support. Unluckily, for some reason Adaptec 1430SA RAID BIOS doesn't want to understand spare disks created by graid. But at least spares created by BIOS are working fine now. Modified: head/sys/geom/raid/md_ddf.c Modified: head/sys/geom/raid/md_ddf.c == --- head/sys/geom/raid/md_ddf.c Tue May 1 17:16:01 2012(r234898) +++ head/sys/geom/raid/md_ddf.c Tue May 1 18:00:31 2012(r234899) @@ -179,6 +179,10 @@ static struct g_raid_md_class g_raid_md_ (n) * GET16((m), hdr->Configuration_Record_Length) *\ (m)->sectorsize)) +#define GETSAPTR(m, n) ((struct ddf_sa_record *)((uint8_t *)(m)->cr + \ + (n) * GET16((m), hdr->Configuration_Record_Length) *\ + (m)->sectorsize)) + static int isff(uint8_t *buf, int size) { @@ -294,8 +298,8 @@ g_raid_md_ddf_print(struct ddf_meta *met printf("\n"); printf("VD_Number0x%04x\n", GET16(meta, vdr->entry[j].VD_Number)); - printf("VD_Type 0x%02x\n", - GET8(meta, vdr->entry[j].VD_Type)); + printf("VD_Type 0x%04x\n", + GET16(meta, vdr->entry[j].VD_Type)); printf("VD_State 0x%02x\n", GET8(meta, vdr->entry[j].VD_State)); printf("Init_State 0x%02x\n", @@ -396,6 +400,7 @@ g_raid_md_ddf_print(struct ddf_meta *met GET16D(meta, sa->entry[i].Secondary_Element)); } break; + case 0x: case 0x: break; default: @@ -476,7 +481,8 @@ ddf_meta_find_vdc(struct ddf_meta *meta, memcmp(vdc->VD_GUID, GUID, 24) == 0) return (vdc); } else - if (GET32D(meta, vdc->Signature) == 0x) + if (GET32D(meta, vdc->Signature) == 0x || + GET32D(meta, vdc->Signature) == 0) return (vdc); } return (NULL); @@ -527,6 +533,29 @@ ddf_meta_find_disk(struct ddf_vol_meta * return (-1); } +static struct ddf_sa_record * +ddf_meta_find_sa(struct ddf_meta *meta, int create) +{ + struct ddf_sa_record *sa; + int i, num; + + num = GETCRNUM(meta); + for (i = 0; i < num; i++) { + sa = GETSAPTR(meta, i); + if (GET32D(meta, sa->Signature) == DDF_SA_SIGNATURE) + return (sa); + } + if (create) { + for (i = 0; i < num; i++) { + sa = GETSAPTR(meta, i); + if (GET32D(meta, sa->Signature) == 0x || + GET32D(meta, sa->Signature) == 0) + return (sa); + } + } + return (NULL); +} + static void ddf_meta_create(struct g_raid_disk *disk, struct ddf_meta *sample) { @@ -643,9 +672,9 @@ ddf_meta_create(struct g_raid_disk *disk pos += GET32(meta, hdr->Diagnostic_Space_Length); SET32(meta, hdr->Vendor_Specific_Logs, GET32(meta, hdr->Vendor_Specific_Logs_Length) != 0 ? pos : 0x); - pos += GET32(meta, hdr->Vendor_Specific_Logs_Length); + pos += min(GET32(meta, hdr->Vendor_Specific_Logs_Length), 1); SET64(meta, hdr->Primary_Header_LBA, - anchorlba - pos - 16); + anchorlba - pos); SET64(meta, hdr->Secondary_Header_LBA, 0xULL); SET64(meta, hdr->WorkSpace_LBA, @@ -1318,29 +1347,6 @@ ddf_meta_erase(struct g_consumer *cp) return (error); } -#if 0 -static int -ddf_meta_write_spare(struct g_consumer *cp) -{ - struct ddf_header *meta; - int error; - - meta = malloc(sizeof(*meta), M_MD_DDF, M_WAITOK | M_ZERO); - memcpy(&meta->ddf_id[0], DDF_MAGIC, sizeof(DDF_MAGIC) - 1); - meta->dummy_0 = 0x0002; - meta->integrity = DDF_I_VALID; - meta->disk.flags = DDF_F_SPARE | DDF_F_ONLINE | DDF_F_VALID; - meta->disk.number = 0xff; - arc4rand(&meta->disk.id, sizeof(meta->disk.id), 0); - meta->disk_sectors = cp->provider->mediasize / cp->provider->sectorsize; - meta->disk_sectors -= 131072; - meta->rebuild_lba = UINT32_MAX; - error = ddf_meta_write(cp, &meta, 1); - free(meta, M_MD_DDF); - return (error); -} -#endif - static struct g_raid_volume * g_raid_md_ddf_get_volume(struct g_raid_softc *sc, uint8_t *GUID) { @@ -1574,6 +1580,7 @@ g_raid_md_ddf_start_disk(struct g_raid_d struct ddf_vol_meta *vmeta; struct ddf_m
svn commit: r234900 - head/sys/mips/atheros
Author: adrian Date: Tue May 1 20:32:38 2012 New Revision: 234900 URL: http://svn.freebsd.org/changeset/base/234900 Log: Add in the MII configuration parameters for the AR71xx. Obtained from:Linux/OpenWRT Modified: head/sys/mips/atheros/ar71xxreg.h Modified: head/sys/mips/atheros/ar71xxreg.h == --- head/sys/mips/atheros/ar71xxreg.h Tue May 1 18:00:31 2012 (r234899) +++ head/sys/mips/atheros/ar71xxreg.h Tue May 1 20:32:38 2012 (r234900) @@ -271,12 +271,23 @@ * AR71xx MII control region */ #defineAR71XX_MII0_CTRL0x1807 -#defineAR71XX_MII1_CTRL0x18070004 #defineMII_CTRL_SPEED_SHIFT4 #defineMII_CTRL_SPEED_MASK 3 -#defineMII_CTRL_SPEED_10 0 -#defineMII_CTRL_SPEED_100 1 -#defineMII_CTRL_SPEED_1000 2 +#defineMII_CTRL_SPEED_10 0 +#defineMII_CTRL_SPEED_100 1 +#defineMII_CTRL_SPEED_1000 2 +#defineMII_CTRL_IF_MASK3 +#defineMII_CTRL_IF_SHIFT 0 +#defineMII0_CTRL_IF_GMII 0 +#defineMII0_CTRL_IF_MII1 +#defineMII0_CTRL_IF_RGMII 2 +#defineMII0_CTRL_IF_RMII 3 + +#defineAR71XX_MII1_CTRL0x18070004 + +#defineMII1_CTRL_IF_RGMII 0 +#defineMII1_CTRL_IF_RMII 1 + /* * GigE adapters region ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234901 - head/sys/arm/at91
Author: marius Date: Tue May 1 20:42:03 2012 New Revision: 234901 URL: http://svn.freebsd.org/changeset/base/234901 Log: - Add missing locking in at91_usart_getc(). - Align the RX buffers on the cache line size, otherwise the requirement of partial cache line flushes on every are pretty much guaranteed. [1] - Make the code setting the RX timeout match its comment (apparently, start and stop bits were missed in the previous calculation). [1] - Cover the busdma operations in at91_usart_bus_{ipend,transmit}() with the hardware mutex, too, so these don't race against each other. - In at91_usart_bus_ipend(), reduce duplication in the code dealing with TX interrupts. - In at91_usart_bus_ipend(), turn the code dealing with RX interrupts into an else-if cascade in order reduce its complexity and to improve its run-time behavior. - In at91_usart_bus_ipend(), add missing BUS_DMASYNC_PREREAD calls on the RX buffer map before handing things over to the hardware again. [1] - In at91_usart_bus_getsig(), used a variable of sufficient width for storing the contents of USART_CSR. - Use KOBJMETHOD_END. - Remove an unused header. Submitted by: Ian Lepore [1] Reviewed by: Ian Lepore MFC after:1 week Modified: head/sys/arm/at91/uart_dev_at91usart.c Modified: head/sys/arm/at91/uart_dev_at91usart.c == --- head/sys/arm/at91/uart_dev_at91usart.c Tue May 1 20:32:38 2012 (r234900) +++ head/sys/arm/at91/uart_dev_at91usart.c Tue May 1 20:42:03 2012 (r234901) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -55,16 +54,17 @@ __FBSDID("$FreeBSD$"); */ struct at91_usart_rx { bus_addr_t pa; - uint8_t buffer[USART_BUFFER_SIZE]; + uint8_t *buffer; bus_dmamap_tmap; }; struct at91_usart_softc { struct uart_softc base; - bus_dma_tag_t dmatag; /* bus dma tag for mbufs */ + bus_dma_tag_t tx_tag; bus_dmamap_t tx_map; uint32_t flags; -#define HAS_TIMEOUT1 +#defineHAS_TIMEOUT 1 + bus_dma_tag_t rx_tag; struct at91_usart_rx ping_pong[2]; struct at91_usart_rx *ping; struct at91_usart_rx *pong; @@ -95,7 +95,7 @@ static void at91_usart_init(struct uart_ static void at91_usart_term(struct uart_bas *bas); static void at91_usart_putc(struct uart_bas *bas, int); static int at91_usart_rxready(struct uart_bas *bas); -static int at91_usart_getc(struct uart_bas *bas, struct mtx *mtx); +static int at91_usart_getc(struct uart_bas *bas, struct mtx *hwmtx); extern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs; @@ -106,7 +106,7 @@ at91_usart_param(struct uart_bas *bas, i uint32_t mr; /* -* Assume 3-write RS-232 configuration. +* Assume 3-wire RS-232 configuration. * XXX Not sure how uart will present the other modes to us, so * XXX they are unimplemented. maybe ioctl? */ @@ -209,6 +209,7 @@ static struct uart_ops at91_usart_ops = static int at91_usart_probe(struct uart_bas *bas) { + /* We know that this is always here */ return (0); } @@ -236,6 +237,7 @@ at91_usart_init(struct uart_bas *bas, in static void at91_usart_term(struct uart_bas *bas) { + /* XXX */ } @@ -247,7 +249,7 @@ static void at91_usart_putc(struct uart_bas *bas, int c) { -while (!(RD4(bas, USART_CSR) & USART_CSR_TXRDY)) + while (!(RD4(bas, USART_CSR) & USART_CSR_TXRDY)) continue; WR4(bas, USART_THR, c); } @@ -266,14 +268,18 @@ at91_usart_rxready(struct uart_bas *bas) * Block waiting for a character. */ static int -at91_usart_getc(struct uart_bas *bas, struct mtx *mtx) +at91_usart_getc(struct uart_bas *bas, struct mtx *hwmtx) { int c; - while (!(RD4(bas, USART_CSR) & USART_CSR_RXRDY)) - continue; - c = RD4(bas, USART_RHR); - c &= 0xff; + uart_lock(hwmtx); + while (!(RD4(bas, USART_CSR) & USART_CSR_RXRDY)) { + uart_unlock(hwmtx); + DELAY(4); + uart_lock(hwmtx); + } + c = RD4(bas, USART_RHR) & 0xff; + uart_unlock(hwmtx); return (c); } @@ -290,7 +296,7 @@ static int at91_usart_bus_transmit(struc static kobj_method_t at91_usart_methods[] = { KOBJMETHOD(uart_probe, at91_usart_bus_probe), - KOBJMETHOD(uart_attach, at91_usart_bus_attach), + KOBJMETHOD(uart_attach, at91_usart_bus_attach), KOBJMETHOD(uart_flush, at91_usart_bus_flush), KOBJMETHOD(uart_getsig, at91_usart_bus_getsig), KOBJMETHOD(uart_ioctl, at91_usart_bus_ioctl), @@ -299,8 +305,8 @@ static kobj_method_t at91_usart_methods[ KOBJMETHOD(uart_receive,at91_usar
Re: svn commit: r234898 - in head/sys/boot: ofw/libofw sparc64 sparc64/boot1 sparc64/loader sparc64/zfsboot sparc64/zfsloader zfs
On 1. May 2012, at 17:16 , Marius Strobl wrote: > Author: marius > Date: Tue May 1 17:16:01 2012 > New Revision: 234898 > URL: http://svn.freebsd.org/changeset/base/234898 > > Log: > Add initial support for booting from ZFS on sparc64. At least on Sun Fire > V100, the firmware is known to be broken and not allowing to simultaneously > open disk devices, causing attempts to boot from a mirror or RAIDZ to cause > a crash. This will be worked around later. The firmwares of newer sun4u > models > don't seem to exhibit this problem though. > > Steps for ZFS booting: > > 1. create VTOC8 label > # gpart create -s vtoc8 da0 > > 2. add partitions, f.e.: > # gpart add -t freebsd-zfs -s 60g da0 > # gpart add -t freebsd-swap da0 > resulting in something like: > # gpart show > =>0 143331930 da0 VTOC8 (68G) >0 1258210801 freebsd-zfs (60G) >125821080 175108502 freebsd-swap (8.4G) > > 3. create zpool > # zpool create bunker da0a > or for mirror/RAIDZ (after preparing additional disks as in steps 1. + 2.): > # zpool create bunker mirror da0a da1a > # zpool create bunker raidz da0a da1a da2a ... > > 4. set bootfs > # zpool set bootfs=bunker bunker > > 5. install zfsboot > # zpool export bunker > # gpart bootcode -p /boot/zfsboot da0 > > 6. write zfsloader to the ZFS Boot Block (so far, there's no dedicated tool > for this, so dd(1) has to be used for this purpose) > When using mirror/RAIDZ, step 4. and the dd(1) invocation should be repeated > for the additional disks in order to be able to boot from another disk in > case of failure. > # sysctl kern.geom.debugflags=0x10 > # dd if=/boot/zfsloader of=/dev/da0a bs=512 oseek=1024 conv=notrunc > # zpool import bunker > > 7. install system on ZFS filesystem > Don't forget to set 'zfs_load="YES"' and vfs.root.mountfrom="zfs:bunker" in > loader.conf as well as 'zfs_enable="YES"'in rc.conf. > > 8. copy zpool.cache to the ZFS filesystem > cp -p /boot/zfs/zpool.cache /bunker/boot/zfs/zpool.cache > > 9. set mountpoint > # zfs set mountpoint=/ bunker > > 10. Now, given that aliases for all disks in the zpool exists (check with > the `devalias` command on the boot monitor prompt) and disk0 corresponds > to da0 (likewise for additional disks), the system can be booted from the > ZFS with: > {1} ok boot disk0 These steps belong into documentation (man page, handbook, ...) bit not really into the commit message. Great news for spacr64 users however, I think. -- Bjoern A. Zeeb You have to have visions! It does not matter how good you are. It matters what good you do! ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r234893 - head/sbin/ifconfig
On 1. May 2012, at 16:15 , Monthadar Al Jaberi wrote: > Author: monthadar > Date: Tue May 1 16:15:34 2012 > New Revision: 234893 > URL: http://svn.freebsd.org/changeset/base/234893 > > Log: > * Added new command to ifconfig to activate Mesh Gate Announcement called > meshgate with corresponding explanation; > > Approved by: adrian > > Modified: > head/sbin/ifconfig/ifconfig.8 > head/sbin/ifconfig/ifieee80211.c > > Modified: head/sbin/ifconfig/ifconfig.8 > == > --- head/sbin/ifconfig/ifconfig.8 Tue May 1 16:14:18 2012 > (r234892) > +++ head/sbin/ifconfig/ifconfig.8 Tue May 1 16:15:34 2012 > (r234893) Please update .Dd as well. > @@ -1979,6 +1979,12 @@ Enable or disable forwarding packets by > By default > .Cm meshforward > is enabled. > +.It Cm meshgate > +This attribute specifies whether or not the mesh STA activates mesh gate > +announcements. > +By default > +.Cm meshgate > +is disabled. > .It Cm meshmetric Ar protocol > Set the specified > .Ar protocol -- Bjoern A. Zeeb You have to have visions! It does not matter how good you are. It matters what good you do! ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r234898 - in head/sys/boot: ofw/libofw sparc64 sparc64/boot1 sparc64/loader sparc64/zfsboot sparc64/zfsloader zfs
On Tue, May 01, 2012 at 09:04:17PM +, Bjoern A. Zeeb wrote: > > On 1. May 2012, at 17:16 , Marius Strobl wrote: > > > Author: marius > > Date: Tue May 1 17:16:01 2012 > > New Revision: 234898 > > URL: http://svn.freebsd.org/changeset/base/234898 > > > > Log: > > Add initial support for booting from ZFS on sparc64. At least on Sun Fire > > V100, the firmware is known to be broken and not allowing to simultaneously > > open disk devices, causing attempts to boot from a mirror or RAIDZ to cause > > a crash. This will be worked around later. The firmwares of newer sun4u > > models > > don't seem to exhibit this problem though. > > > > Steps for ZFS booting: > > > > 1. create VTOC8 label > > # gpart create -s vtoc8 da0 > > > > 2. add partitions, f.e.: > > # gpart add -t freebsd-zfs -s 60g da0 > > # gpart add -t freebsd-swap da0 > > resulting in something like: > > # gpart show > > =>0 143331930 da0 VTOC8 (68G) > >0 1258210801 freebsd-zfs (60G) > >125821080 175108502 freebsd-swap (8.4G) > > > > 3. create zpool > > # zpool create bunker da0a > > or for mirror/RAIDZ (after preparing additional disks as in steps 1. + 2.): > > # zpool create bunker mirror da0a da1a > > # zpool create bunker raidz da0a da1a da2a ... > > > > 4. set bootfs > > # zpool set bootfs=bunker bunker > > > > 5. install zfsboot > > # zpool export bunker > > # gpart bootcode -p /boot/zfsboot da0 > > > > 6. write zfsloader to the ZFS Boot Block (so far, there's no dedicated tool > > for this, so dd(1) has to be used for this purpose) > > When using mirror/RAIDZ, step 4. and the dd(1) invocation should be > > repeated > > for the additional disks in order to be able to boot from another disk in > > case of failure. > > # sysctl kern.geom.debugflags=0x10 > > # dd if=/boot/zfsloader of=/dev/da0a bs=512 oseek=1024 conv=notrunc > > # zpool import bunker > > > > 7. install system on ZFS filesystem > > Don't forget to set 'zfs_load="YES"' and vfs.root.mountfrom="zfs:bunker" in > > loader.conf as well as 'zfs_enable="YES"'in rc.conf. > > > > 8. copy zpool.cache to the ZFS filesystem > > cp -p /boot/zfs/zpool.cache /bunker/boot/zfs/zpool.cache > > > > 9. set mountpoint > > # zfs set mountpoint=/ bunker > > > > 10. Now, given that aliases for all disks in the zpool exists (check with > > the `devalias` command on the boot monitor prompt) and disk0 corresponds > > to da0 (likewise for additional disks), the system can be booted from the > > ZFS with: > > {1} ok boot disk0 > > > These steps belong into documentation (man page, handbook, ...) bit not really > into the commit message. > We've seen way larger commit messages across totally unrelated parts in the past and the commit message seemed like a good place for ensuring the instructions not getting lost for now ... In any case, I'm desperately waiting for property editing on svn:log to be enabled :) Marius ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234903 - stable/9/lib/libc/net
Author: delphij Date: Wed May 2 00:30:30 2012 New Revision: 234903 URL: http://svn.freebsd.org/changeset/base/234903 Log: MFC r233770: Eliminate two cases of unwanted strncpy(). The name is not required by the current code, and the results would get overwritten anyway by subsequent memset(). Reviewed by: ume Modified: stable/9/lib/libc/net/getaddrinfo.c stable/9/lib/libc/net/name6.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/net/getaddrinfo.c == --- stable/9/lib/libc/net/getaddrinfo.c Tue May 1 23:46:18 2012 (r234902) +++ stable/9/lib/libc/net/getaddrinfo.c Wed May 2 00:30:30 2012 (r234903) @@ -847,8 +847,6 @@ set_source(struct ai_order *aio, struct struct in6_ifreq ifr6; u_int32_t flags6; - /* XXX: interface name should not be hardcoded */ - strncpy(ifr6.ifr_name, "lo0", sizeof(ifr6.ifr_name)); memset(&ifr6, 0, sizeof(ifr6)); memcpy(&ifr6.ifr_addr, ai.ai_addr, ai.ai_addrlen); if (_ioctl(s, SIOCGIFAFLAG_IN6, &ifr6) == 0) { Modified: stable/9/lib/libc/net/name6.c == --- stable/9/lib/libc/net/name6.c Tue May 1 23:46:18 2012 (r234902) +++ stable/9/lib/libc/net/name6.c Wed May 2 00:30:30 2012 (r234903) @@ -884,8 +884,6 @@ set_source(struct hp_order *aio, struct struct in6_ifreq ifr6; u_int32_t flags6; - /* XXX: interface name should not be hardcoded */ - strncpy(ifr6.ifr_name, "lo0", sizeof(ifr6.ifr_name)); memset(&ifr6, 0, sizeof(ifr6)); memcpy(&ifr6.ifr_addr, &ss, ss.ss_len); if (_ioctl(s, SIOCGIFAFLAG_IN6, &ifr6) == 0) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234904 - stable/8/lib/libc/net
Author: delphij Date: Wed May 2 00:31:09 2012 New Revision: 234904 URL: http://svn.freebsd.org/changeset/base/234904 Log: MFC r233770: Eliminate two cases of unwanted strncpy(). The name is not required by the current code, and the results would get overwritten anyway by subsequent memset(). Reviewed by: ume Modified: stable/8/lib/libc/net/getaddrinfo.c stable/8/lib/libc/net/name6.c Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/net/getaddrinfo.c == --- stable/8/lib/libc/net/getaddrinfo.c Wed May 2 00:30:30 2012 (r234903) +++ stable/8/lib/libc/net/getaddrinfo.c Wed May 2 00:31:09 2012 (r234904) @@ -847,8 +847,6 @@ set_source(struct ai_order *aio, struct struct in6_ifreq ifr6; u_int32_t flags6; - /* XXX: interface name should not be hardcoded */ - strncpy(ifr6.ifr_name, "lo0", sizeof(ifr6.ifr_name)); memset(&ifr6, 0, sizeof(ifr6)); memcpy(&ifr6.ifr_addr, ai.ai_addr, ai.ai_addrlen); if (_ioctl(s, SIOCGIFAFLAG_IN6, &ifr6) == 0) { Modified: stable/8/lib/libc/net/name6.c == --- stable/8/lib/libc/net/name6.c Wed May 2 00:30:30 2012 (r234903) +++ stable/8/lib/libc/net/name6.c Wed May 2 00:31:09 2012 (r234904) @@ -884,8 +884,6 @@ set_source(struct hp_order *aio, struct struct in6_ifreq ifr6; u_int32_t flags6; - /* XXX: interface name should not be hardcoded */ - strncpy(ifr6.ifr_name, "lo0", sizeof(ifr6.ifr_name)); memset(&ifr6, 0, sizeof(ifr6)); memcpy(&ifr6.ifr_addr, &ss, ss.ss_len); if (_ioctl(s, SIOCGIFAFLAG_IN6, &ifr6) == 0) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234905 - head/sys/mips/atheros
Author: adrian Date: Wed May 2 01:14:15 2012 New Revision: 234905 URL: http://svn.freebsd.org/changeset/base/234905 Log: Introduce an enum which encapsulates the PHY interface types that can be configured. Modified: head/sys/mips/atheros/ar71xxreg.h Modified: head/sys/mips/atheros/ar71xxreg.h == --- head/sys/mips/atheros/ar71xxreg.h Wed May 2 00:31:09 2012 (r234904) +++ head/sys/mips/atheros/ar71xxreg.h Wed May 2 01:14:15 2012 (r234905) @@ -267,6 +267,13 @@ #defineAR91XX_REV_ID_REVISION_MASK 0x3 #defineAR91XX_REV_ID_REVISION_SHIFT2 +typedef enum { + AR71XX_MII_MODE_NONE = 0, + AR71XX_MII_MODE_GMII, + AR71XX_MII_MODE_MII, + AR71XX_MII_MODE_RGMII, + AR71XX_MII_MODE_RMII, +} ar71xx_mii_mode; /* * AR71xx MII control region */ @@ -288,7 +295,6 @@ #defineMII1_CTRL_IF_RGMII 0 #defineMII1_CTRL_IF_RMII 1 - /* * GigE adapters region */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234906 - head/sys/mips/atheros
Author: adrian Date: Wed May 2 01:21:57 2012 New Revision: 234906 URL: http://svn.freebsd.org/changeset/base/234906 Log: MII related infrastructure changes. * Add a new method to set the MII mode - GMII, RGMII, RMII, MII. + arge0 supports all four (two for non-Gige interfaces.) + arge1 only supports two (one for non-gige interfaces.) * Set the MII clock speed when changing the MAC PLL speed. + Needed for AR91xx and AR71xx; not needed for AR724x. Tested: * AR71xx only, I'll do AR913x testing tonight and fix whichever issues creep up. TODO: * Implement the missing AR7242 arge0 PLL configuration, but don't adjust the MII speed accordingly. * .. the AR7240/AR7241 don't require this, so make sure it's not set accidentally. Bugs (not fixed here): * Statically configured arge speeds are still broken - investigate why that is on the AP96 board. Autonegotiate is working fine, but there still seems to be an occasionally heavy packet loss issue. Obtained from: Linux/Atheros/OpenWRT Modified: head/sys/mips/atheros/ar71xx_chip.c head/sys/mips/atheros/ar71xx_chip.h head/sys/mips/atheros/ar71xx_cpudef.h head/sys/mips/atheros/ar724x_chip.c head/sys/mips/atheros/ar91xx_chip.c Modified: head/sys/mips/atheros/ar71xx_chip.c == --- head/sys/mips/atheros/ar71xx_chip.c Wed May 2 01:14:15 2012 (r234905) +++ head/sys/mips/atheros/ar71xx_chip.c Wed May 2 01:21:57 2012 (r234906) @@ -176,6 +176,50 @@ ar71xx_chip_set_mii_speed(uint32_t unit, ATH_WRITE_REG(reg, val); } +void +ar71xx_chip_set_mii_if(uint32_t unit, uint32_t mii_mode) +{ + uint32_t val, reg, mii_if; + + switch (unit) { + case 0: + reg = AR71XX_MII0_CTRL; + if (mii_mode == AR71XX_MII_MODE_GMII) + mii_if = MII0_CTRL_IF_GMII; + else if (mii_mode == AR71XX_MII_MODE_MII) + mii_if = MII0_CTRL_IF_MII; + else if (mii_mode == AR71XX_MII_MODE_RGMII) + mii_if = MII0_CTRL_IF_RGMII; + else if (mii_mode == AR71XX_MII_MODE_RMII) + mii_if = MII0_CTRL_IF_RMII; + else + printf("%s: invalid MII mode (%d) for unit %d\n", + __func__, mii_mode, unit); + return; + break; + case 1: + reg = AR71XX_MII1_CTRL; + if (mii_mode == AR71XX_MII_MODE_RGMII) + mii_if = MII1_CTRL_IF_RGMII; + if (mii_mode == AR71XX_MII_MODE_RMII) + mii_if = MII1_CTRL_IF_RMII; + else + printf("%s: invalid MII mode (%d) for unit %d\n", + __func__, mii_mode, unit); + return; + break; + default: + printf("%s: invalid MII unit set for arge unit: %d\n", + __func__, unit); + return; + } + + val = ATH_READ_REG(reg); + val &= ~(MII_CTRL_IF_MASK << MII_CTRL_IF_SHIFT); + val |= (mii_if & MII_CTRL_IF_MASK) << MII_CTRL_IF_SHIFT; + ATH_WRITE_REG(reg, val); +} + /* Speed is either 10, 100 or 1000 */ static void ar71xx_chip_set_pll_ge(int unit, int speed) @@ -197,6 +241,7 @@ ar71xx_chip_set_pll_ge(int unit, int spe __func__, unit, speed); return; } + switch (unit) { case 0: ar71xx_write_pll(AR71XX_PLL_SEC_CONFIG, @@ -213,6 +258,12 @@ ar71xx_chip_set_pll_ge(int unit, int spe __func__, unit); return; } + + /* +* AR71xx and AR913x require this; AR724x doesn't require +* an MII clock change at all. +*/ + ar71xx_chip_set_mii_speed(unit, speed); } static void @@ -278,6 +329,7 @@ struct ar71xx_cpu_def ar71xx_chip_def = &ar71xx_chip_device_stopped, &ar71xx_chip_set_pll_ge, &ar71xx_chip_set_mii_speed, + &ar71xx_chip_set_mii_if, &ar71xx_chip_ddr_flush_ge, &ar71xx_chip_get_eth_pll, &ar71xx_chip_ddr_flush_ip2, Modified: head/sys/mips/atheros/ar71xx_chip.h == --- head/sys/mips/atheros/ar71xx_chip.h Wed May 2 01:14:15 2012 (r234905) +++ head/sys/mips/atheros/ar71xx_chip.h Wed May 2 01:21:57 2012 (r234906) @@ -31,5 +31,6 @@ extern struct ar71xx_cpu_def ar71xx_chip_def; extern void ar71xx_chip_set_mii_speed(uint32_t unit, uint32_t speed); +extern void ar71xx_chip_set_mii_if(uint32_t unit, uint32_t mii_if); #endif Modified: head/sys/mips/atheros/ar71xx_cpudef.h == --- head/sys/mips/atheros/ar71xx_cpudef.h Wed May 2 01:14:15 2012
svn commit: r234907 - head/sys/mips/atheros
Author: adrian Date: Wed May 2 04:51:43 2012 New Revision: 234907 URL: http://svn.freebsd.org/changeset/base/234907 Log: Further ar71xx MII support improvements. * Flesh out the PLL configuration fetch function, which will return the PLL configuration based on the unit number and speed. * Remove the PLL speed config logic from the AR71xx/AR91xx chip PLL config function - pass in a 'pll' value instead. * Modify arge_set_pll() to: + fetch the PLL configuration + write the PLL configuration + update the MII speed configuration. This will allow if_arge to override the PLL configuration as required. Obtained from:Linux/Atheros/OpenWRT Modified: head/sys/mips/atheros/ar71xx_chip.c head/sys/mips/atheros/ar71xx_cpudef.h head/sys/mips/atheros/ar724x_chip.c head/sys/mips/atheros/ar91xx_chip.c head/sys/mips/atheros/if_arge.c Modified: head/sys/mips/atheros/ar71xx_chip.c == --- head/sys/mips/atheros/ar71xx_chip.c Wed May 2 01:21:57 2012 (r234906) +++ head/sys/mips/atheros/ar71xx_chip.c Wed May 2 04:51:43 2012 (r234907) @@ -222,25 +222,8 @@ ar71xx_chip_set_mii_if(uint32_t unit, ui /* Speed is either 10, 100 or 1000 */ static void -ar71xx_chip_set_pll_ge(int unit, int speed) +ar71xx_chip_set_pll_ge(int unit, int speed, uint32_t pll) { - uint32_t pll; - - switch (speed) { - case 10: - pll = PLL_ETH_INT_CLK_10; - break; - case 100: - pll = PLL_ETH_INT_CLK_100; - break; - case 1000: - pll = PLL_ETH_INT_CLK_1000; - break; - default: - printf("%s%d: invalid speed %d\n", - __func__, unit, speed); - return; - } switch (unit) { case 0: @@ -258,12 +241,6 @@ ar71xx_chip_set_pll_ge(int unit, int spe __func__, unit); return; } - - /* -* AR71xx and AR913x require this; AR724x doesn't require -* an MII clock change at all. -*/ - ar71xx_chip_set_mii_speed(unit, speed); } static void @@ -293,7 +270,24 @@ ar71xx_chip_ddr_flush_ip2(void) static uint32_t ar71xx_chip_get_eth_pll(unsigned int mac, int speed) { - return 0; + uint32_t pll; + + switch (speed) { + case 10: + pll = PLL_ETH_INT_CLK_10; + break; + case 100: + pll = PLL_ETH_INT_CLK_100; + break; + case 1000: + pll = PLL_ETH_INT_CLK_1000; + break; + default: + printf("%s%d: invalid speed %d\n", __func__, mac, speed); + pll = 0; + } + + return (pll); } static void Modified: head/sys/mips/atheros/ar71xx_cpudef.h == --- head/sys/mips/atheros/ar71xx_cpudef.h Wed May 2 01:21:57 2012 (r234906) +++ head/sys/mips/atheros/ar71xx_cpudef.h Wed May 2 04:51:43 2012 (r234907) @@ -35,7 +35,7 @@ struct ar71xx_cpu_def { void (* ar71xx_chip_device_stop) (uint32_t); void (* ar71xx_chip_device_start) (uint32_t); int (* ar71xx_chip_device_stopped) (uint32_t); - void (* ar71xx_chip_set_pll_ge) (int, int); + void (* ar71xx_chip_set_pll_ge) (int, int, uint32_t); void (* ar71xx_chip_set_mii_speed) (uint32_t, uint32_t); void (* ar71xx_chip_set_mii_if) (uint32_t, ar71xx_mii_mode); void (* ar71xx_chip_ddr_flush_ge) (int); @@ -81,9 +81,9 @@ static inline int ar71xx_device_stopped( return ar71xx_cpu_ops->ar71xx_chip_device_stopped(mask); } -static inline void ar71xx_device_set_pll_ge(int unit, int speed) +static inline void ar71xx_device_set_pll_ge(int unit, int speed, uint32_t pll) { - ar71xx_cpu_ops->ar71xx_chip_set_pll_ge(unit, speed); + ar71xx_cpu_ops->ar71xx_chip_set_pll_ge(unit, speed, pll); } static inline void ar71xx_device_set_mii_speed(int unit, int speed) @@ -101,6 +101,11 @@ static inline void ar71xx_device_flush_d ar71xx_cpu_ops->ar71xx_chip_ddr_flush_ge(unit); } +static inline uint32_t ar71xx_device_get_eth_pll(unsigned int unit, int speed) +{ + return (ar71xx_cpu_ops->ar71xx_chip_get_eth_pll(unit, speed)); +} + static inline void ar71xx_init_usb_peripheral(void) { ar71xx_cpu_ops->ar71xx_chip_init_usb_peripheral(); Modified: head/sys/mips/atheros/ar724x_chip.c == --- head/sys/mips/atheros/ar724x_chip.c Wed May 2 01:21:57 2012 (r234906) +++ head/sys/mips/atheros/ar724x_chip.c Wed May 2 04:51:43 2012 (r234907) @@ -139,7 +139,7 @@ ar724x_chip_set_mii_speed(uint32_t unit, * AR7242 arge1. */ static void -ar724x_chip_set_pll_ge(int unit, int speed) +ar724x_chip_set_pll_ge(int unit, int speed
svn commit: r234908 - head/sys/boot/arm/uboot
Author: kientzle Date: Wed May 2 05:49:58 2012 New Revision: 234908 URL: http://svn.freebsd.org/changeset/base/234908 Log: Remove some redundant register loads. Discussed on: arm@ Modified: head/sys/boot/arm/uboot/start.S Modified: head/sys/boot/arm/uboot/start.S == --- head/sys/boot/arm/uboot/start.S Wed May 2 04:51:43 2012 (r234907) +++ head/sys/boot/arm/uboot/start.S Wed May 2 05:49:58 2012 (r234908) @@ -49,27 +49,20 @@ _start: * syscall() */ ENTRY(syscall) - /* Save caller's lr */ + /* Save caller's lr and r8 */ ldr ip, =saved_regs str lr, [ip, #4] - /* Save loader's r8 */ - ldr ip, =saved_regs str r8, [ip, #8] - /* Restore U-Boot's r8 */ - ldr ip, =saved_regs ldr r8, [ip, #0] /* Call into U-Boot */ ldr lr, =return_from_syscall ldr ip, =syscall_ptr ldr pc, [ip] - return_from_syscall: - /* Restore loader's r8 */ + /* Restore loader's r8 and lr */ ldr ip, =saved_regs ldr r8, [ip, #8] - /* Restore caller's lr */ - ldr ip, =saved_regs ldr lr, [ip, #4] /* Return to caller */ mov pc, lr ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234909 - head/sys/mips/atheros
Author: adrian Date: Wed May 2 06:17:16 2012 New Revision: 234909 URL: http://svn.freebsd.org/changeset/base/234909 Log: Add a missing newline. Modified: head/sys/mips/atheros/ar71xxreg.h Modified: head/sys/mips/atheros/ar71xxreg.h == --- head/sys/mips/atheros/ar71xxreg.h Wed May 2 05:49:58 2012 (r234908) +++ head/sys/mips/atheros/ar71xxreg.h Wed May 2 06:17:16 2012 (r234909) @@ -274,6 +274,7 @@ typedef enum { AR71XX_MII_MODE_RGMII, AR71XX_MII_MODE_RMII, } ar71xx_mii_mode; + /* * AR71xx MII control region */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234910 - head/sys/mips/atheros
Author: adrian Date: Wed May 2 06:18:12 2012 New Revision: 234910 URL: http://svn.freebsd.org/changeset/base/234910 Log: Allow the MII mode to be overridden via 'hint.arge.X.miimode'. It takes a number at the moment, rather than a string. Some of the Linux board configurations specify the MII mode explicitly. Modified: head/sys/mips/atheros/if_arge.c head/sys/mips/atheros/if_argevar.h Modified: head/sys/mips/atheros/if_arge.c == --- head/sys/mips/atheros/if_arge.c Wed May 2 06:17:16 2012 (r234909) +++ head/sys/mips/atheros/if_arge.c Wed May 2 06:18:12 2012 (r234910) @@ -103,6 +103,14 @@ typedef enum { ARGE_DBG_RESET = 0x0020, } arge_debug_flags; +static const char * arge_miicfg_str[] = { + "NONE", + "GMII", + "MII", + "RGMII", + "RMII" +}; + #ifdef ARGE_DEBUG #defineARGEDEBUG(_sc, _m, ...) \ do {\ @@ -333,6 +341,7 @@ arge_attach(device_t dev) int is_base_mac_empty, i; uint32_thint; longeeprom_mac_addr = 0; + int miicfg = 0; sc = device_get_softc(dev); sc->arge_dev = dev; @@ -363,6 +372,17 @@ arge_attach(device_t dev) ("if_arge: Only MAC0 and MAC1 supported")); /* +* Get the MII configuration, if applicable. +*/ + if (resource_int_value(device_get_name(dev), device_get_unit(dev), + "miimode", &miicfg) == 0) { + /* XXX bounds check? */ + device_printf(dev, "%s: overriding MII mode to '%s'\n", + __func__, arge_miicfg_str[miicfg]); + sc->arge_miicfg = miicfg; + } + + /* * Get which PHY of 5 available we should use for this unit */ if (resource_int_value(device_get_name(dev), device_get_unit(dev), @@ -497,6 +517,10 @@ arge_attach(device_t dev) arge_reset_miibus(sc); #endif + /* Configure MII mode, just for convienence */ + if (sc->arge_miicfg != 0) + ar71xx_device_set_mii_if(sc->arge_mac_unit, sc->arge_miicfg); + /* * Set all Ethernet address registers to the same initial values * set all four addresses to 66-88-aa-cc-dd-ee Modified: head/sys/mips/atheros/if_argevar.h == --- head/sys/mips/atheros/if_argevar.h Wed May 2 06:17:16 2012 (r234909) +++ head/sys/mips/atheros/if_argevar.h Wed May 2 06:18:12 2012 (r234910) @@ -135,6 +135,7 @@ struct arge_softc { void*arge_intrhand; device_targe_miibus; device_targe_miiproxy; + ar71xx_mii_mode arge_miicfg; bus_dma_tag_t arge_parent_tag; bus_dma_tag_t arge_tag; struct mtx arge_mtx; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234911 - head/sys/mips/conf
Author: adrian Date: Wed May 2 06:19:26 2012 New Revision: 234911 URL: http://svn.freebsd.org/changeset/base/234911 Log: * Force the ethernet MII configuration to be RGMII * Populate the "pll_1000" field, which will soon be used to override the PLL configuration from the default value. Obtained from:Linux OpenWRT Modified: head/sys/mips/conf/AP96.hints Modified: head/sys/mips/conf/AP96.hints == --- head/sys/mips/conf/AP96.hints Wed May 2 06:18:12 2012 (r234910) +++ head/sys/mips/conf/AP96.hints Wed May 2 06:19:26 2012 (r234911) @@ -16,17 +16,17 @@ hint.mdioproxy.1.at="mdio0" hint.arge.0.phymask=0x0f hint.arge.0.media=1000 hint.arge.0.fduplex=1 +hint.arge.0.miimode=3 # RGMII # For now, rendezouvs this on the arge0 mdiobus. # Later, this will rendezvous via the AR8316 switch. hint.arge.0.mdio=mdioproxy0 # TODO: RGMII -# TODO: pll_1000 = 0x1f00 hint.arge.1.phymask=0x10 -# hint.arge.1.media=1000 -# hint.arge.1.fduplex=1 +hint.arge.1.pll_1000 = 0x1f00 # For now, rendezouvs this on the arge0 mdiobus. # Later, this will rendezvous via the AR8316 switch. +hint.arge.1.miimode=3 # RGMII hint.arge.1.mdio=mdioproxy1 # ath0 - slot 17 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r234912 - in stable/8/sys: cam cam/ata geom modules/cam
Author: mav Date: Wed May 2 06:52:00 2012 New Revision: 234912 URL: http://svn.freebsd.org/changeset/base/234912 Log: Merge ATA_CAM compatibility shims. While 8-STABLE doesn't have ATA_CAM enabled by default, this should make migration easier for users enabling it manually. r221071: Add shim to simplify migration to the CAM-based ATA. For each new adaX device in /dev/ create symbolic link with adY name, trying to mimic old ATA numbering. Imitation is not complete, but should be enough in most cases to mount file systems without touching /etc/fstab. r221384: Do not report legacy unit numbers (do not create legacy aliases) for disks on port multiplier ports above first two. They don't fit into ATA_STATIC_ID scheme and so can't be mapped properly. No need to pollute dev. Modified: stable/8/sys/cam/ata/ata_da.c stable/8/sys/cam/cam_xpt.c stable/8/sys/cam/cam_xpt.h stable/8/sys/geom/geom_dev.c stable/8/sys/modules/cam/Makefile Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/ata/ata_da.c == --- stable/8/sys/cam/ata/ata_da.c Wed May 2 06:19:26 2012 (r234911) +++ stable/8/sys/cam/ata/ata_da.c Wed May 2 06:52:00 2012 (r234912) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ada.h" +#include "opt_ata.h" #include @@ -295,6 +296,14 @@ static voidadagetparams(struct cam_per static timeout_t adasendorderedtag; static voidadashutdown(void *arg, int howto); +#ifndefADA_DEFAULT_LEGACY_ALIASES +#ifdef ATA_CAM +#defineADA_DEFAULT_LEGACY_ALIASES 1 +#else +#defineADA_DEFAULT_LEGACY_ALIASES 0 +#endif +#endif + #ifndef ADA_DEFAULT_TIMEOUT #define ADA_DEFAULT_TIMEOUT 30 /* Timeout in seconds */ #endif @@ -332,6 +341,7 @@ static void adashutdown(void *arg, int #defineata_disk_firmware_geom_adjust(disk) #endif +static int ada_legacy_aliases = ADA_DEFAULT_LEGACY_ALIASES; static int ada_retry_count = ADA_DEFAULT_RETRY; static int ada_default_timeout = ADA_DEFAULT_TIMEOUT; static int ada_send_ordered = ADA_DEFAULT_SEND_ORDERED; @@ -341,6 +351,9 @@ static int ada_write_cache = ADA_DEFAULT SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD, 0, "CAM Direct Access Disk driver"); +SYSCTL_INT(_kern_cam_ada, OID_AUTO, legacy_aliases, CTLFLAG_RW, + &ada_legacy_aliases, 0, "Create legacy-like device aliases"); +TUNABLE_INT("kern.cam.ada.legacy_aliases", &ada_legacy_aliases); SYSCTL_INT(_kern_cam_ada, OID_AUTO, retry_count, CTLFLAG_RW, &ada_retry_count, 0, "Normal I/O retry count"); TUNABLE_INT("kern.cam.ada.retry_count", &ada_retry_count); @@ -841,11 +854,11 @@ adaregister(struct cam_periph *periph, v struct ada_softc *softc; struct ccb_pathinq cpi; struct ccb_getdev *cgd; - char announce_buf[80]; + char announce_buf[80], buf1[32]; struct disk_params *dp; caddr_t match; u_int maxio; - int quirks; + int legacy_id, quirks; cgd = (struct ccb_getdev *)arg; if (periph == NULL) { @@ -986,6 +999,22 @@ adaregister(struct cam_periph *periph, v softc->disk->d_fwheads = softc->params.heads; ata_disk_firmware_geom_adjust(softc->disk); + if (ada_legacy_aliases) { +#ifdef ATA_STATIC_ID + legacy_id = xpt_path_legacy_ata_id(periph->path); +#else + legacy_id = softc->disk->d_unit; +#endif + if (legacy_id >= 0) { + snprintf(announce_buf, sizeof(announce_buf), + "kern.devalias.%s%d", + softc->disk->d_name, softc->disk->d_unit); + snprintf(buf1, sizeof(buf1), + "ad%d", legacy_id); + setenv(announce_buf, buf1); + } + } else + legacy_id = -1; disk_create(softc->disk, DISK_VERSION); mtx_lock(periph->sim->mtx); cam_periph_unhold(periph); @@ -999,6 +1028,9 @@ adaregister(struct cam_periph *periph, v dp->secsize, dp->heads, dp->secs_per_track, dp->cylinders); xpt_announce_periph(periph, announce_buf); + if (legacy_id >= 0) + printf("%s%d: Previously was known as ad%d\n", + periph->periph_name, periph->unit_number, legacy_id); /* * Create our sysctl variables, now that we know Modified: stable/8/sys/cam/cam_xpt.c == --- stable/8/sys/cam/cam_xpt.c Wed May 2 06:19:26 2012(r234911) +++ stable/8/sys/cam/cam_xpt.c Wed May 2 06:52:00 2012(r234912) @@ -3668,6 +3668,45 @@ xpt_path_periph(struct cam_path *path) return (path->periph); } +int +xpt_path_legacy_ata_id(struct cam_path *path)
svn commit: r234913 - in stable/8: share/examples/ses/srcs sys/cam/scsi
Author: mav Date: Wed May 2 06:58:44 2012 New Revision: 234913 URL: http://svn.freebsd.org/changeset/base/234913 Log: MFC r222336, r222339: Add names for few more SES element types according SES-2 specification. Modified: stable/8/share/examples/ses/srcs/eltsub.c stable/8/sys/cam/scsi/scsi_ses.h Directory Properties: stable/8/share/examples/ (props changed) stable/8/sys/ (props changed) Modified: stable/8/share/examples/ses/srcs/eltsub.c == --- stable/8/share/examples/ses/srcs/eltsub.c Wed May 2 06:52:00 2012 (r234912) +++ stable/8/share/examples/ses/srcs/eltsub.c Wed May 2 06:58:44 2012 (r234913) @@ -84,6 +84,9 @@ geteltnm(type) case SESTYP_KEYPAD: sprintf(rbuf, "Key pad entry device"); break; + case SESTYP_ENCLOSURE: + sprintf(rbuf, "Enclosure"); + break; case SESTYP_SCSIXVR: sprintf(rbuf, "SCSI port/transceiver"); break; @@ -108,6 +111,15 @@ geteltnm(type) case SESTYP_SUBENC: sprintf(rbuf, "Simple sub-enclosure"); break; + case SESTYP_ARRAY: + sprintf(rbuf, "Array device"); + break; + case SESTYP_SASEXPANDER: + sprintf(rbuf, "SAS Expender"); + break; + case SESTYP_SASCONNECTOR: + sprintf(rbuf, "SAS Connector"); + break; default: (void) sprintf(rbuf, "", type); break; Modified: stable/8/sys/cam/scsi/scsi_ses.h == --- stable/8/sys/cam/scsi/scsi_ses.hWed May 2 06:52:00 2012 (r234912) +++ stable/8/sys/cam/scsi/scsi_ses.hWed May 2 06:58:44 2012 (r234913) @@ -101,6 +101,7 @@ typedef struct { #defineSESTYP_UPS 0x0b #defineSESTYP_DISPLAY 0x0c #defineSESTYP_KEYPAD 0x0d +#defineSESTYP_ENCLOSURE0x0e #defineSESTYP_SCSIXVR 0x0f #defineSESTYP_LANGUAGE 0x10 #defineSESTYP_COMPORT 0x11 @@ -109,6 +110,9 @@ typedef struct { #defineSESTYP_SCSI_TGT 0x14 #defineSESTYP_SCSI_INI 0x15 #defineSESTYP_SUBENC 0x16 +#defineSESTYP_ARRAY0x17 +#defineSESTYP_SASEXPANDER 0x18 +#defineSESTYP_SASCONNECTOR 0x19 /* * Overall Enclosure Status ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"