From owner-svn-src-user@FreeBSD.ORG Sun Feb 8 17:49:33 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AEDCB1065673; Sun, 8 Feb 2009 17:49:33 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 98C008FC0C; Sun, 8 Feb 2009 17:49:33 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n18HnX79029755; Sun, 8 Feb 2009 17:49:33 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n18HnWZb029734; Sun, 8 Feb 2009 17:49:32 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200902081749.n18HnWZb029734@svn.freebsd.org> From: Andrew Thompson Date: Sun, 8 Feb 2009 17:49:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188317 - in user/thompsa/usb: . contrib/wpa_supplicant etc/rc.d lib/libc/net lib/libc/stdlib lib/libc/string lib/libc_r/uthread lib/msun/src sbin sbin/ifconfig sbin/ipfw sbin/mount_nfs... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Feb 2009 17:49:34 -0000 Author: thompsa Date: Sun Feb 8 17:49:32 2009 New Revision: 188317 URL: http://svn.freebsd.org/changeset/base/188317 Log: MFH r188181-188316 Added: user/thompsa/usb/sys/netinet/libalias/alias_sctp.c - copied unchanged from r188316, head/sys/netinet/libalias/alias_sctp.c user/thompsa/usb/sys/netinet/libalias/alias_sctp.h - copied unchanged from r188316, head/sys/netinet/libalias/alias_sctp.h Modified: user/thompsa/usb/ (props changed) user/thompsa/usb/UPDATING user/thompsa/usb/contrib/wpa_supplicant/ (props changed) user/thompsa/usb/etc/rc.d/named user/thompsa/usb/lib/libc/net/getaddrinfo.c user/thompsa/usb/lib/libc/net/gethostbydns.c user/thompsa/usb/lib/libc/stdlib/atol.3 user/thompsa/usb/lib/libc/string/memchr.c user/thompsa/usb/lib/libc_r/uthread/uthread_init.c user/thompsa/usb/lib/msun/src/math.h user/thompsa/usb/sbin/ (props changed) user/thompsa/usb/sbin/ifconfig/ifieee80211.c user/thompsa/usb/sbin/ifconfig/regdomain.c user/thompsa/usb/sbin/ifconfig/regdomain.h user/thompsa/usb/sbin/ipfw/ipfw.8 user/thompsa/usb/sbin/ipfw/nat.c user/thompsa/usb/sbin/mount_nfs/mount_nfs.c user/thompsa/usb/share/man/man4/rum.4 user/thompsa/usb/share/man/man4/smb.4 user/thompsa/usb/sys/ (props changed) user/thompsa/usb/sys/amd64/conf/NOTES user/thompsa/usb/sys/amd64/include/legacyvar.h user/thompsa/usb/sys/amd64/pci/pci_bus.c user/thompsa/usb/sys/arm/arm/cpufunc_asm_sheeva.S (props changed) user/thompsa/usb/sys/conf/NOTES user/thompsa/usb/sys/conf/files user/thompsa/usb/sys/conf/options user/thompsa/usb/sys/conf/options.amd64 user/thompsa/usb/sys/conf/options.i386 user/thompsa/usb/sys/conf/options.ia64 user/thompsa/usb/sys/conf/options.mips user/thompsa/usb/sys/conf/options.pc98 user/thompsa/usb/sys/contrib/pf/ (props changed) user/thompsa/usb/sys/dev/agp/agp.c user/thompsa/usb/sys/dev/ath/ath_hal/ah_regdomain.c user/thompsa/usb/sys/dev/ath/ath_hal/ar5212/ar5212.h user/thompsa/usb/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c user/thompsa/usb/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c user/thompsa/usb/sys/dev/ath/if_ath.c user/thompsa/usb/sys/dev/ath/if_athioctl.h user/thompsa/usb/sys/dev/cardbus/cardbus_device.c user/thompsa/usb/sys/dev/cfi/cfi_core.c user/thompsa/usb/sys/dev/exca/exca.c user/thompsa/usb/sys/dev/pccard/pccard.c user/thompsa/usb/sys/dev/pccard/pccard_cis.c user/thompsa/usb/sys/dev/pccard/pccardvarp.h user/thompsa/usb/sys/dev/si/si.c user/thompsa/usb/sys/dev/sound/macio/aoa.c user/thompsa/usb/sys/dev/sound/macio/aoa.h user/thompsa/usb/sys/dev/sound/macio/davbus.c user/thompsa/usb/sys/dev/sound/macio/i2s.c user/thompsa/usb/sys/dev/sound/macio/snapper.c user/thompsa/usb/sys/dev/sound/macio/tumbler.c user/thompsa/usb/sys/dev/usb/ehci_ixp4xx.c (props changed) user/thompsa/usb/sys/dev/usb/if_rum.c user/thompsa/usb/sys/dev/usb/if_urtw.c user/thompsa/usb/sys/dev/usb/usbdevs user/thompsa/usb/sys/dev/usb2/controller/ehci2.c user/thompsa/usb/sys/dev/usb2/controller/ohci2.c user/thompsa/usb/sys/dev/usb2/controller/uhci2.c user/thompsa/usb/sys/dev/usb2/include/usb2_devid.h user/thompsa/usb/sys/dev/usb2/include/usb2_devtable.h user/thompsa/usb/sys/dev/xen/netfront/netfront.c user/thompsa/usb/sys/fs/fifofs/fifo_vnops.c user/thompsa/usb/sys/fs/udf/ecma167-udf.h user/thompsa/usb/sys/fs/udf/udf.h user/thompsa/usb/sys/fs/udf/udf_vfsops.c user/thompsa/usb/sys/fs/udf/udf_vnops.c user/thompsa/usb/sys/geom/part/g_part_bsd.c user/thompsa/usb/sys/geom/part/g_part_mbr.c user/thompsa/usb/sys/i386/conf/NOTES user/thompsa/usb/sys/i386/i386/vm_machdep.c user/thompsa/usb/sys/ia64/conf/NOTES user/thompsa/usb/sys/kern/kern_linker.c user/thompsa/usb/sys/kern/kern_lock.c user/thompsa/usb/sys/kern/kern_sysctl.c user/thompsa/usb/sys/kern/vfs_bio.c user/thompsa/usb/sys/kern/vfs_init.c user/thompsa/usb/sys/kern/vfs_subr.c user/thompsa/usb/sys/mips/mips/busdma_machdep.c user/thompsa/usb/sys/mips/mips/elf64_machdep.c (props changed) user/thompsa/usb/sys/modules/libalias/libalias/Makefile user/thompsa/usb/sys/modules/usb2/controller_atmegadci/ (props changed) user/thompsa/usb/sys/net80211/ieee80211_ddb.c user/thompsa/usb/sys/netinet/ip_fw_nat.c user/thompsa/usb/sys/netinet/ip_ipsec.c user/thompsa/usb/sys/netinet/ip_output.c user/thompsa/usb/sys/netinet/libalias/alias.c user/thompsa/usb/sys/netinet/libalias/alias_db.c user/thompsa/usb/sys/netinet/libalias/alias_local.h user/thompsa/usb/sys/netinet/sctp_crc32.c user/thompsa/usb/sys/netinet/sctp_crc32.h user/thompsa/usb/sys/netinet/tcp_subr.c user/thompsa/usb/sys/netinet6/ip6_forward.c user/thompsa/usb/sys/netinet6/ip6_ipsec.c user/thompsa/usb/sys/netinet6/ip6_output.c user/thompsa/usb/sys/netipsec/ipsec.c user/thompsa/usb/sys/netipsec/ipsec.h user/thompsa/usb/sys/netipsec/ipsec6.h user/thompsa/usb/sys/nfsserver/nfs_syscalls.c user/thompsa/usb/sys/pc98/conf/NOTES user/thompsa/usb/sys/security/audit/audit_bsm.c user/thompsa/usb/sys/security/audit/audit_bsm_klib.c user/thompsa/usb/sys/security/audit/audit_pipe.c user/thompsa/usb/sys/security/audit/audit_private.h user/thompsa/usb/sys/sys/mount.h user/thompsa/usb/sys/sys/sysctl.h user/thompsa/usb/sys/ufs/ffs/ffs_alloc.c user/thompsa/usb/tools/tools/ath/athstats/athstats.c user/thompsa/usb/tools/tools/ath/athstats/main.c user/thompsa/usb/tools/tools/net80211/wlanstats/main.c user/thompsa/usb/tools/tools/net80211/wlanstats/wlanstats.c user/thompsa/usb/usr.sbin/config/main.c user/thompsa/usb/usr.sbin/makefs/ffs/ffs_bswap.c (props changed) user/thompsa/usb/usr.sbin/makefs/ffs/ffs_subr.c (props changed) user/thompsa/usb/usr.sbin/makefs/ffs/ufs_bswap.h (props changed) user/thompsa/usb/usr.sbin/makefs/getid.c (props changed) Modified: user/thompsa/usb/UPDATING ============================================================================== --- user/thompsa/usb/UPDATING Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/UPDATING Sun Feb 8 17:49:32 2009 (r188317) @@ -22,6 +22,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20090203: + The ichsmb(4) driver has been changed to require SMBus slave + addresses be left-justified (xxxxxxx0b) rather than right-justified. + All of the other SMBus controller drivers require left-justified + slave addresses, so this change makes all the drivers provide the + same interface. + 20090201: INET6 statistics (struct ip6stat) was updated. netstat(1) needs to be recompiled. Modified: user/thompsa/usb/etc/rc.d/named ============================================================================== --- user/thompsa/usb/etc/rc.d/named Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/etc/rc.d/named Sun Feb 8 17:49:32 2009 (r188317) @@ -61,10 +61,23 @@ chroot_autoupdate() # Mount a devfs in the chroot directory if needed # - umount ${named_chrootdir}/dev 2>/dev/null - devfs_domount ${named_chrootdir}/dev devfsrules_hide_all - devfs -m ${named_chrootdir}/dev rule apply path null unhide - devfs -m ${named_chrootdir}/dev rule apply path random unhide + if [ `${SYSCTL_N} security.jail.jailed` -eq 0 ]; then + umount ${named_chrootdir}/dev 2>/dev/null + devfs_domount ${named_chrootdir}/dev devfsrules_hide_all + devfs -m ${named_chrootdir}/dev rule apply path null unhide + devfs -m ${named_chrootdir}/dev rule apply path random unhide + else + if [ -c ${named_chrootdir}/dev/null -a \ + -c ${named_chrootdir}/dev/random ]; then + info "named chroot: using pre-mounted devfs." + else + err 1 "named chroot: devfs cannot be mounted from" \ + "within a jail. Thus a chrooted named cannot" \ + "be run from within a jail." \ + "To run named without chrooting it, set" \ + "named_chrootdir=\"\" in /etc/rc.conf." + fi + fi # Copy and/or update key files to the chroot /etc # @@ -113,7 +126,12 @@ named_stop() named_poststop() { if [ -n "${named_chrootdir}" -a -c ${named_chrootdir}/dev/null ]; then - umount ${named_chrootdir}/dev 2>/dev/null || true + if [ `${SYSCTL_N} security.jail.jailed` -eq 0 ]; then + umount ${named_chrootdir}/dev 2>/dev/null || true + else + warn "named chroot:" \ + "cannot unmount devfs from inside jail!" + fi fi } Modified: user/thompsa/usb/lib/libc/net/getaddrinfo.c ============================================================================== --- user/thompsa/usb/lib/libc/net/getaddrinfo.c Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/lib/libc/net/getaddrinfo.c Sun Feb 8 17:49:32 2009 (r188317) @@ -1863,7 +1863,8 @@ getanswer(const querybuf *answer, int an } } else if (type != qtype) { #ifdef DEBUG - if (type != T_KEY && type != T_SIG) + if (type != T_KEY && type != T_SIG && + type != ns_t_dname) syslog(LOG_NOTICE|LOG_AUTH, "gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"", qname, p_class(C_IN), p_type(qtype), Modified: user/thompsa/usb/lib/libc/net/gethostbydns.c ============================================================================== --- user/thompsa/usb/lib/libc/net/gethostbydns.c Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/lib/libc/net/gethostbydns.c Sun Feb 8 17:49:32 2009 (r188317) @@ -294,7 +294,7 @@ gethostanswer(const querybuf *answer, in continue; } if (type != qtype) { - if (type != T_SIG) + if (type != T_SIG && type != ns_t_dname) syslog(LOG_NOTICE|LOG_AUTH, "gethostby*.gethostanswer: asked for \"%s %s %s\", got type \"%s\"", qname, p_class(C_IN), p_type(qtype), Modified: user/thompsa/usb/lib/libc/stdlib/atol.3 ============================================================================== --- user/thompsa/usb/lib/libc/stdlib/atol.3 Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/lib/libc/stdlib/atol.3 Sun Feb 8 17:49:32 2009 (r188317) @@ -32,7 +32,7 @@ .\" @(#)atol.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd November 28, 2001 +.Dd February 1, 2009 .Dt ATOL 3 .Os .Sh NAME @@ -78,13 +78,42 @@ representation. It is equivalent to: .Pp .Dl "strtoll(nptr, (char **)NULL, 10);" +.Sh COMPATIBILITY +The +.Fx +implementations of the +.Fn atol +and +.Fn atoll +functions are thin wrappers around +.Fn strtol +and +.Fn stroll +respectively, so these functions will affect the value of +.Va errno +in the same way that the +.Fn strtol +and +.Fn stroll +functions are able to. +This behavior of +.Fn atol +and +.Fn atoll +is not required by +.St -isoC +or +.St -isoC-c99 , +but it is allowed by all of +.St -isoC , St -isoC-99 +and +.St -p1003.1-2001 . .Sh ERRORS The functions .Fn atol and .Fn atoll -need not -affect the value of +may affect the value of .Va errno on an error. .Sh SEE ALSO Modified: user/thompsa/usb/lib/libc/string/memchr.c ============================================================================== --- user/thompsa/usb/lib/libc/string/memchr.c Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/lib/libc/string/memchr.c Sun Feb 8 17:49:32 2009 (r188317) @@ -45,7 +45,7 @@ memchr(const void *s, int c, size_t n) const unsigned char *p = s; do { - if (*p++ == c) + if (*p++ == (unsigned char)c) return ((void *)(p - 1)); } while (--n != 0); } Modified: user/thompsa/usb/lib/libc_r/uthread/uthread_init.c ============================================================================== --- user/thompsa/usb/lib/libc_r/uthread/uthread_init.c Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/lib/libc_r/uthread/uthread_init.c Sun Feb 8 17:49:32 2009 (r188317) @@ -95,6 +95,7 @@ static void *references[] = { &_getsockopt, &_ioctl, &_kevent, + &_kqueue, &_listen, &_nanosleep, &_open, Modified: user/thompsa/usb/lib/msun/src/math.h ============================================================================== --- user/thompsa/usb/lib/msun/src/math.h Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/lib/msun/src/math.h Sun Feb 8 17:49:32 2009 (r188317) @@ -70,12 +70,12 @@ extern const union __nan_un { /* XXX We need a . */ #if defined(__ia64__) || defined(__sparc64__) -#define FP_FAST_FMA +#define FP_FAST_FMA 1 #endif #ifdef __ia64__ -#define FP_FAST_FMAL +#define FP_FAST_FMAL 1 #endif -#define FP_FAST_FMAF +#define FP_FAST_FMAF 1 /* Symbolic constants to classify floating point numbers. */ #define FP_INFINITE 0x01 Modified: user/thompsa/usb/sbin/ifconfig/ifieee80211.c ============================================================================== --- user/thompsa/usb/sbin/ifconfig/ifieee80211.c Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/sbin/ifconfig/ifieee80211.c Sun Feb 8 17:49:32 2009 (r188317) @@ -99,10 +99,6 @@ #define IEEE80211_FIXED_RATE_NONE 0xff #endif -#define REQ_ECM 0x01000000 /* enable if ECM set */ -#define REQ_OUTDOOR 0x02000000 /* enable for outdoor operation */ -#define REQ_FLAGS 0xff000000 /* private flags, don't pass to os */ - /* XXX need these publicly defined or similar */ #ifndef IEEE80211_NODE_AUTH #define IEEE80211_NODE_AUTH 0x0001 /* authorized for data */ @@ -1802,6 +1798,57 @@ chanfind(const struct ieee80211_channel return 0; } +/* + * Check channel compatibility. + */ +static int +checkchan(const struct ieee80211req_chaninfo *avail, int freq, int flags) +{ + flags &= ~REQ_FLAGS; + /* + * Check if exact channel is in the calibration table; + * everything below is to deal with channels that we + * want to include but that are not explicitly listed. + */ + if (flags & IEEE80211_CHAN_HT40) { + /* NB: we use an HT40 channel center that matches HT20 */ + flags = (flags &~ IEEE80211_CHAN_HT40) | IEEE80211_CHAN_HT20; + } + if (chanlookup(avail->ic_chans, avail->ic_nchans, freq, flags) != NULL) + return 1; + if (flags & IEEE80211_CHAN_GSM) { + /* + * XXX GSM frequency mapping is handled in the kernel + * so we cannot find them in the calibration table; + * just accept the channel and the kernel will reject + * the channel list if it's wrong. + */ + return 1; + } + /* + * If this is a 1/2 or 1/4 width channel allow it if a full + * width channel is present for this frequency, and the device + * supports fractional channels on this band. This is a hack + * that avoids bloating the calibration table; it may be better + * by per-band attributes though (we are effectively calculating + * this attribute by scanning the channel list ourself). + */ + if ((flags & (IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER)) == 0) + return 0; + if (chanlookup(avail->ic_chans, avail->ic_nchans, freq, + flags &~ (IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER)) == NULL) + return 0; + if (flags & IEEE80211_CHAN_HALF) { + return chanfind(avail->ic_chans, avail->ic_nchans, + IEEE80211_CHAN_HALF | + (flags & (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ))); + } else { + return chanfind(avail->ic_chans, avail->ic_nchans, + IEEE80211_CHAN_QUARTER | + (flags & (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ))); + } +} + static void regdomain_addchans(struct ieee80211req_chaninfo *ci, const netband_head *bands, @@ -1812,15 +1859,12 @@ regdomain_addchans(struct ieee80211req_c const struct netband *nb; const struct freqband *b; struct ieee80211_channel *c, *prev; - int freq, channelSep, hasHalfChans, hasQuarterChans; + int freq, hi_adj, lo_adj, channelSep; + uint32_t flags; + hi_adj = (chanFlags & IEEE80211_CHAN_HT40U) ? -20 : 0; + lo_adj = (chanFlags & IEEE80211_CHAN_HT40D) ? 20 : 0; channelSep = (chanFlags & IEEE80211_CHAN_2GHZ) ? 0 : 40; - hasHalfChans = chanfind(avail->ic_chans, avail->ic_nchans, - IEEE80211_CHAN_HALF | - (chanFlags & (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ))); - hasQuarterChans = chanfind(avail->ic_chans, avail->ic_nchans, - IEEE80211_CHAN_QUARTER | - (chanFlags & (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ))); LIST_FOREACH(nb, bands, next) { b = nb->band; if (verbose) { @@ -1831,63 +1875,80 @@ regdomain_addchans(struct ieee80211req_c putchar('\n'); } prev = NULL; - for (freq = b->freqStart; freq <= b->freqEnd; freq += b->chanSep) { - uint32_t flags = nb->flags | b->flags; - - /* check if device can operate on this frequency */ + for (freq = b->freqStart + lo_adj; + freq <= b->freqEnd + hi_adj; freq += b->chanSep) { + /* + * Construct flags for the new channel. We take + * the attributes from the band descriptions except + * for HT40 which is enabled generically (i.e. +/- + * extension channel) in the band description and + * then constrained according by channel separation. + */ + flags = nb->flags | b->flags; + if (flags & IEEE80211_CHAN_HT) { + /* + * HT channels are generated specially; we're + * called to add HT20, HT40+, and HT40- chan's + * so we need to expand only band specs for + * the HT channel type being added. + */ + if ((chanFlags & IEEE80211_CHAN_HT20) && + (flags & IEEE80211_CHAN_HT20) == 0) { + if (verbose) + printf("%u: skip, not an " + "HT20 channel\n", freq); + continue; + } + if ((chanFlags & IEEE80211_CHAN_HT40) && + (flags & IEEE80211_CHAN_HT40) == 0) { + if (verbose) + printf("%u: skip, not an " + "HT40 channel\n", freq); + continue; + } + /* + * DFS and HT40 don't mix. This should be + * expressed in the regdomain database but + * just in case enforce it here. + */ + if ((chanFlags & IEEE80211_CHAN_HT40) && + (flags & IEEE80211_CHAN_DFS)) { + if (verbose) + printf("%u: skip, HT40+DFS " + "not permitted\n", freq); + continue; + } + /* NB: HT attribute comes from caller */ + flags &= ~IEEE80211_CHAN_HT; + flags |= chanFlags & IEEE80211_CHAN_HT; + } /* - * XXX GSM frequency mapping is handled in the kernel - * so we cannot find them in the calibration table; - * just construct the list and the kernel will reject - * if it's wrong. + * Check if device can operate on this frequency. */ - if (chanlookup(avail->ic_chans, avail->ic_nchans, freq, chanFlags) == NULL && - (flags & IEEE80211_CHAN_GSM) == 0) { + if (!checkchan(avail, freq, flags)) { if (verbose) { printf("%u: skip, ", freq); - printb("flags", chanFlags, + printb("flags", flags, IEEE80211_CHAN_BITS); printf(" not available\n"); } continue; } - if ((flags & IEEE80211_CHAN_HALF) && !hasHalfChans) { + if ((flags & REQ_ECM) && !reg->ecm) { if (verbose) - printf("%u: skip, device does not " - "support half-rate channel\n", - freq); + printf("%u: skip, ECM channel\n", freq); continue; } - if ((flags & IEEE80211_CHAN_QUARTER) && - !hasQuarterChans) { + if ((flags & REQ_INDOOR) && reg->location == 'O') { if (verbose) - printf("%u: skip, device does not " - "support quarter-rate channel\n", + printf("%u: skip, indoor channel\n", freq); continue; } - if ((flags & IEEE80211_CHAN_HT20) && - (chanFlags & IEEE80211_CHAN_HT20) == 0) { - if (verbose) - printf("%u: skip, device does not " - "support HT20 operation\n", freq); - continue; - } - if ((flags & IEEE80211_CHAN_HT40) && - (chanFlags & IEEE80211_CHAN_HT40) == 0) { - if (verbose) - printf("%u: skip, device does not " - "support HT40 operation\n", freq); - continue; - } - if ((flags & REQ_ECM) && !reg->ecm) { - if (verbose) - printf("%u: skip, ECM channel\n", freq); - continue; - } if ((flags & REQ_OUTDOOR) && reg->location == 'I') { if (verbose) - printf("%u: skip, outdoor channel\n", freq); + printf("%u: skip, outdoor channel\n", + freq); continue; } if ((flags & IEEE80211_CHAN_HT40) && @@ -1907,8 +1968,7 @@ regdomain_addchans(struct ieee80211req_c c = &ci->ic_chans[ci->ic_nchans++]; memset(c, 0, sizeof(*c)); c->ic_freq = freq; - c->ic_flags = chanFlags | - (flags &~ (REQ_FLAGS | IEEE80211_CHAN_HT40)); + c->ic_flags = flags; if (c->ic_flags & IEEE80211_CHAN_DFS) c->ic_maxregpower = nb->maxPowerDFS; else @@ -1973,27 +2033,31 @@ regdomain_makechannels( if (!LIST_EMPTY(&rd->bands_11a)) regdomain_addchans(ci, &rd->bands_11a, reg, IEEE80211_CHAN_A, &dc->dc_chaninfo); - if (!LIST_EMPTY(&rd->bands_11na)) { + if (!LIST_EMPTY(&rd->bands_11na) && dc->dc_htcaps != 0) { regdomain_addchans(ci, &rd->bands_11na, reg, IEEE80211_CHAN_A | IEEE80211_CHAN_HT20, &dc->dc_chaninfo); - regdomain_addchans(ci, &rd->bands_11na, reg, - IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U, - &dc->dc_chaninfo); - regdomain_addchans(ci, &rd->bands_11na, reg, - IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D, - &dc->dc_chaninfo); + if (dc->dc_htcaps & IEEE80211_HTCAP_CHWIDTH40) { + regdomain_addchans(ci, &rd->bands_11na, reg, + IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U, + &dc->dc_chaninfo); + regdomain_addchans(ci, &rd->bands_11na, reg, + IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D, + &dc->dc_chaninfo); + } } - if (!LIST_EMPTY(&rd->bands_11ng)) { + if (!LIST_EMPTY(&rd->bands_11ng) && dc->dc_htcaps != 0) { regdomain_addchans(ci, &rd->bands_11ng, reg, IEEE80211_CHAN_G | IEEE80211_CHAN_HT20, &dc->dc_chaninfo); - regdomain_addchans(ci, &rd->bands_11ng, reg, - IEEE80211_CHAN_G | IEEE80211_CHAN_HT40U, - &dc->dc_chaninfo); - regdomain_addchans(ci, &rd->bands_11ng, reg, - IEEE80211_CHAN_G | IEEE80211_CHAN_HT40D, - &dc->dc_chaninfo); + if (dc->dc_htcaps & IEEE80211_HTCAP_CHWIDTH40) { + regdomain_addchans(ci, &rd->bands_11ng, reg, + IEEE80211_CHAN_G | IEEE80211_CHAN_HT40U, + &dc->dc_chaninfo); + regdomain_addchans(ci, &rd->bands_11ng, reg, + IEEE80211_CHAN_G | IEEE80211_CHAN_HT40D, + &dc->dc_chaninfo); + } } qsort(ci->ic_chans, ci->ic_nchans, sizeof(ci->ic_chans[0]), regdomain_sort); Modified: user/thompsa/usb/sbin/ifconfig/regdomain.c ============================================================================== --- user/thompsa/usb/sbin/ifconfig/regdomain.c Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/sbin/ifconfig/regdomain.c Sun Feb 8 17:49:32 2009 (r188317) @@ -208,6 +208,9 @@ decode_flag(struct mystate *mt, const ch FLAG(IEEE80211_CHAN_108A), FLAG(IEEE80211_CHAN_108G), #undef FLAG + { "ECM", 3, REQ_ECM }, + { "INDOOR", 6, REQ_INDOOR }, + { "OUTDOOR", 7, REQ_OUTDOOR }, }; int i; Modified: user/thompsa/usb/sbin/ifconfig/regdomain.h ============================================================================== --- user/thompsa/usb/sbin/ifconfig/regdomain.h Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/sbin/ifconfig/regdomain.h Sun Feb 8 17:49:32 2009 (r188317) @@ -45,6 +45,13 @@ struct freqband { LIST_ENTRY(freqband) next; }; +/* private flags, don't pass to os */ +#define REQ_ECM 0x1 /* enable if ECM set */ +#define REQ_INDOOR 0x2 /* enable only for indoor operation */ +#define REQ_OUTDOOR 0x4 /* enable only for outdoor operation */ + +#define REQ_FLAGS (REQ_ECM|REQ_INDOOR|REQ_OUTDOOR) + struct netband { const struct freqband *band; /* channel list description */ uint8_t maxPower; /* regulatory cap on tx power (dBm) */ Modified: user/thompsa/usb/sbin/ipfw/ipfw.8 ============================================================================== --- user/thompsa/usb/sbin/ipfw/ipfw.8 Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/sbin/ipfw/ipfw.8 Sun Feb 8 17:49:32 2009 (r188317) @@ -2183,17 +2183,173 @@ Redirect and LSNAT support follow closel See Section .Sx EXAMPLES for some examples on how to do redirect and lsnat. +.Sh SCTP NAT SUPPORT +Sctp nat can be configured in a simillar manner to TCP through the +ipfw command line tool +.Xr ipfw 8 +, the main difference is that +.Nm sctp nat +does not do port +translation. Since the local and global side ports will be the same, +there is no need to specify both. Ports are redirected as follows: +.Bd -ragged -offset indent +.Bk -words +.Cm nat +.Ar nat_number +.Cm config if +.Ar nic +.Cm redirect_port sctp +.Ar ip_address [,addr_list] {[port | port-port] [,ports]} +.Ek +.Ed +.Pp +. +Most +.B sctp nat +configuration can be done in real-time through the +.B sysctl(8) +interface. All may be changed dynamically, though the hash_table size will only +change for new +.Nm nat +instances. See +.Sx SYSCTL VARIABLES +for more info. .Sh SYSCTL VARIABLES A set of .Xr sysctl 8 variables controls the behaviour of the firewall and associated modules -.Pq Nm dummynet , bridge . +.Pq Nm dummynet , bridge , sctp nat . These are shown below together with their default value (but always check with the .Xr sysctl 8 command what value is actually in use) and meaning: .Bl -tag -width indent +.It Va net.inet.ip.alias.sctp.accept_global_ootb_addip: No 0 +Defines how the +.Nm nat +responds to receipt of global OOTB ASCONF-AddIP: +.Bl -tag -width indent +.It Cm 0 +No response (unless a partially matching association exists - +ports and vtags match but global address does not) +.It Cm 1 +.Nm nat +will accept and process all OOTB global AddIP messages. +.El +.Pp +Option 1 should never be selected as this forms a security risk. An attacker can +establish multiple fake associations by sending AddIP messages. +.It Va net.inet.ip.alias.sctp.chunk_proc_limit: No 5 +Defines the maximum number of chunks in an SCTP packet that will be parsed for a +packet that matches an existing association. This value is enforced to be greater or equal +than +.Cm net.inet.ip.alias.sctp.initialising_chunk_proc_limit . +A high value is +a DoS risk yet setting too low a value may result in important control chunks in +the packet not being located and parsed. +.It Va net.inet.ip.alias.sctp.error_on_ootb: No 1 +Defines when the +.Nm nat +responds to any Out-of-the-Blue (OOTB) packets with ErrorM +packets. An OOTB packet is a packet that arrives with no existing association +registered in the +.Nm nat +and is not an INIT or ASCONF-AddIP packet: +.Bl -tag -width indent +.It Cm 0 +ErrorM is never sent in response to OOTB packets. +.It Cm 1 +ErrorM is only sent to OOTB packets received on the local side. +.It Cm 2 +ErrorM is sent to the local side and on the global side ONLY if there is a +partial match (ports and vtags match but the source global IP does not). This +value is only useful if the +.Nm nat +is tracking global IP addresses. +.It Cm 3 +ErrorM is sent in response to all OOTB packets on both the local and global side +(DoS risk). +.El +.Pp +At the moment the default is 0, since the ErrorM packet is not yet +supported by most SCTP stacks. When it is supported, and if not tracking +global addresses, we recommend setting this value to 1 to allow +multi-homed local hosts to function with the +.Nm nat . +To track global addresses, we recommend setting this value to 2 to +allow global hosts to be informed when they need to (re)send an +ASCONF-AddIP. Value 3 should never be chosen (except for debugging) as +the +.Nm nat +will respond to all OOTB global packets (a DoS risk). +.It Va net.inet.ip.alias.sctp.hashtable_size: No 2003 +Size of hash tables used for +.Nm nat +lookups (100 < prime_number > 1000001) +This value sets the +.Nm hash table +size for any future created +.Nm nat +instance and therefore must be set prior to creating a +.Nm nat +instance. +The table sizes my be changed to suit specific needs. If there will be few +concurrent associations, and memory is scarce, you may make these smaller. If +there will be many thousands (or millions) of concurrent associations, you +should make these larger. A prime number is best for the table size. The sysctl +update function will adjust your input value to the next highest prime number. +.It Va net.inet.ip.alias.sctp.holddown_time: No 0 +Hold association in table for this many seconds after receiving a +SHUTDOWN-COMPLETE. This allows endpoints to correct shutdown gracefully if a +shutdown_complete is lost and retransmissions are required. +.It Va net.inet.ip.alias.sctp.init_timer: No 15 +Timeout value while waiting for (INIT-ACK|AddIP-ACK). +This value cannot be 0. +.It Va net.inet.ip.alias.sctp.initialising_chunk_proc_limit: No 2 +Defines the maximum number of chunks in an SCTP packet that will be parsed when +no existing association exists that matches that packet. Ideally this packet +will only be an INIT or ASCONF-AddIP packet. A higher value may become a DoS +risk as malformed packets can consume processing resources. +.It Va net.inet.ip.alias.sctp.param_proc_limit: No 25 +Defines the maximum number of parameters within a chunk that will be parsed in a +packet. As for other similar sysctl variables, larger values pose a DoS risk. +.It Va net.inet.ip.alias.sctp.log_level: No 0 +Level of detail in the system log messages (0 \- minimal, 1 \- event, +2 \- info, 3 \- detail, 4 \- debug, 5 \- max debug). May be a good +option in high loss environments. +.It Va net.inet.ip.alias.sctp.shutdown_time: No 15 +Timeout value while waiting for SHUTDOWN-COMPLETE. +This value cannot be 0. +.It Va net.inet.ip.alias.sctp.track_global_addresses: No 0 +Enables/disables global IP address tracking within the +.Nm nat +and places an +upper limit on the number of addresses tracked for each association: +.Bl -tag -width indent +.It Cm 0 +Global tracking is disabled +.It Cm >1 +Enables tracking, the maximum number of addresses tracked for each +association is limited to this value +.El +.Pp +This variable is fully dynamic, the new value will be adopted for all newly +arriving associations, existing association are treated as they were previously. +Global tracking will decrease the number of collisions within the +.Nm nat +at a cost +of increased processing load, memory usage, complexity, and possible +.Nm nat +state +problems in complex networks with multiple +.Nm nats . +We recommend not tracking +global IP addresses, this will still result in a fully functional +.Nm nat . +.It Va net.inet.ip.alias.sctp.up_timer: No 300 +Timeout value to keep an association up with no traffic. +This value cannot be 0. .It Va net.inet.ip.dummynet.expire : No 1 Lazily delete dynamic pipes/queue once they have no pending traffic. You can disable this by setting the variable to 0, in which case @@ -2718,6 +2874,15 @@ as part of a Summer of Code 2005 project Work on .Nm dummynet traffic shaper supported by Akamba Corp. +.Pp +Sctp +.Nm nat +support has been developed by +.An The Centre for Advanced Internet Architectures (CAIA) Aq http://www.caia.swin.edu.au . +The primary developers and maintainers are David Hayes and Jason But. +For further information visit: +.Aq http://www.caia.swin.edu.au/urp/SONATA +. .Sh BUGS The syntax has grown over the years and sometimes it might be confusing. Unfortunately, backward compatibility prevents cleaning up mistakes Modified: user/thompsa/usb/sbin/ipfw/nat.c ============================================================================== --- user/thompsa/usb/sbin/ipfw/nat.c Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/sbin/ipfw/nat.c Sun Feb 8 17:49:32 2009 (r188317) @@ -257,7 +257,9 @@ StrToProto (const char* str) if (!strcmp (str, "udp")) return IPPROTO_UDP; - errx (EX_DATAERR, "unknown protocol %s. Expected tcp or udp", str); + if (!strcmp (str, "sctp")) + return IPPROTO_SCTP; + errx (EX_DATAERR, "unknown protocol %s. Expected sctp, tcp or udp", str); } static int @@ -433,13 +435,27 @@ setup_redir_port(char *spool_buf, int le strncpy(tmp_spool_buf, *av, strlen(*av)+1); lsnat = 1; } else { - if (StrToAddrAndPortRange (*av, &r->laddr, protoName, - &portRange) != 0) - errx(EX_DATAERR, "redirect_port:" - "invalid local port range"); + /* + * The sctp nat does not allow the port numbers to be mapped to + * new port numbers. Therefore, no ports are to be specified + * in the target port field. + */ + if (r->proto == IPPROTO_SCTP) { + if (strchr (*av, ':')) + errx(EX_DATAERR, "redirect_port:" + "port numbers do not change in sctp, so do not " + "specify them as part of the target"); + else + StrToAddr(*av, &r->laddr); + } else { + if (StrToAddrAndPortRange (*av, &r->laddr, protoName, + &portRange) != 0) + errx(EX_DATAERR, "redirect_port:" + "invalid local port range"); - r->lport = GETLOPORT(portRange); - numLocalPorts = GETNUMPORTS(portRange); + r->lport = GETLOPORT(portRange); + numLocalPorts = GETNUMPORTS(portRange); + } } INC_ARGCV(); @@ -463,6 +479,10 @@ setup_redir_port(char *spool_buf, int le } r->pport = GETLOPORT(portRange); + if (r->proto == IPPROTO_SCTP) { /* so the logic below still works */ + numLocalPorts = GETNUMPORTS(portRange); + r->lport = r->pport; + } r->pport_cnt = GETNUMPORTS(portRange); INC_ARGCV(); @@ -518,14 +538,31 @@ setup_redir_port(char *spool_buf, int le goto nospace; len -= SOF_SPOOL; space += SOF_SPOOL; - if (StrToAddrAndPortRange(sep, &tmp->addr, protoName, - &portRange) != 0) - errx(EX_DATAERR, "redirect_port:" - "invalid local port range"); - if (GETNUMPORTS(portRange) != 1) - errx(EX_DATAERR, "redirect_port: local port" - "must be single in this context"); - tmp->port = GETLOPORT(portRange); + /* + * The sctp nat does not allow the port numbers to be mapped to new port numbers + * Therefore, no ports are to be specified in the target port field + */ + if (r->proto == IPPROTO_SCTP) { + if (strchr (sep, ':')) { + errx(EX_DATAERR, "redirect_port:" + "port numbers do not change in " + "sctp, so do not specify them as " + "part of the target"); + } else { + StrToAddr(sep, &tmp->addr); + tmp->port = r->pport; + } + } else { + if (StrToAddrAndPortRange(sep, &tmp->addr, + protoName, &portRange) != 0) + errx(EX_DATAERR, "redirect_port:" + "invalid local port range"); + if (GETNUMPORTS(portRange) != 1) + errx(EX_DATAERR, "redirect_port: " + "local port must be single in " + "this context"); + tmp->port = GETLOPORT(portRange); + } r->spool_cnt++; /* Point to the next possible cfg_spool. */ spool_buf = &spool_buf[SOF_SPOOL]; Modified: user/thompsa/usb/sbin/mount_nfs/mount_nfs.c ============================================================================== --- user/thompsa/usb/sbin/mount_nfs/mount_nfs.c Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/sbin/mount_nfs/mount_nfs.c Sun Feb 8 17:49:32 2009 (r188317) @@ -469,6 +469,12 @@ copyopt(struct iovec **newiov, int *newi build_iovec(newiov, newiovlen, name, value, len); } +/* + * XXX: This function is provided for backwards + * compatibility with older kernels which did not support + * passing NFS mount options to nmount() as individual + * parameters. It should be eventually be removed. + */ int fallback_mount(struct iovec *iov, int iovlen, int mntflags) { @@ -587,24 +593,28 @@ fallback_mount(struct iovec *iov, int io if (ret != 1 || args.acregmin < 0) { errx(1, "illegal acregmin: %s", opt); } + args.flags |= NFSMNT_ACREGMIN; } if (findopt(iov, iovlen, "acregmax", &opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.acregmax); if (ret != 1 || args.acregmax < 0) { errx(1, "illegal acregmax: %s", opt); } + args.flags |= NFSMNT_ACREGMAX; } if (findopt(iov, iovlen, "acdirmin", &opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.acdirmin); if (ret != 1 || args.acdirmin < 0) { errx(1, "illegal acdirmin: %s", opt); } + args.flags |= NFSMNT_ACDIRMIN; } if (findopt(iov, iovlen, "acdirmax", &opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.acdirmax); if (ret != 1 || args.acdirmax < 0) { errx(1, "illegal acdirmax: %s", opt); } + args.flags |= NFSMNT_ACDIRMAX; } if (findopt(iov, iovlen, "deadthresh", &opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.deadthresh); Modified: user/thompsa/usb/share/man/man4/rum.4 ============================================================================== --- user/thompsa/usb/share/man/man4/rum.4 Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/share/man/man4/rum.4 Sun Feb 8 17:49:32 2009 (r188317) @@ -91,6 +91,7 @@ including: .It "Belkin F5D7050 ver 3" Ta USB .It "Belkin F5D9050 ver 3" Ta USB .It "Buffalo WLI-U2-SG54HP" Ta USB +.It "Buffalo WLI-U2-SG54HG" Ta USB .It "Buffalo WLI-U2-G54HP" Ta USB .It "CNet CWD-854 ver F" Ta USB .It "Conceptronic C54RU ver 2" Ta USB Modified: user/thompsa/usb/share/man/man4/smb.4 ============================================================================== --- user/thompsa/usb/share/man/man4/smb.4 Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/share/man/man4/smb.4 Sun Feb 8 17:49:32 2009 (r188317) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 25, 1998 +.Dd February 6, 2009 .Dt SMB 4 .Os .Sh NAME @@ -72,6 +72,9 @@ The .Fa slave field is always used, and provides the address of the SMBus slave device to talk to. +The slave address is specified in the seven most significant bits +.Pq i.e. Dq "left-justified" . +The least significant bit of the slave address must be zero. .Pp .Bl -column ".Dv SMB_QUICK_WRITE" -compact .It Em Ioctl Ta Em Description Modified: user/thompsa/usb/sys/amd64/conf/NOTES ============================================================================== --- user/thompsa/usb/sys/amd64/conf/NOTES Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/sys/amd64/conf/NOTES Sun Feb 8 17:49:32 2009 (r188317) @@ -150,6 +150,11 @@ device pci # AGP GART support device agp +# +# AGP debugging. +# +options AGP_DEBUG + ##################################################################### # HARDWARE DEVICE CONFIGURATION @@ -267,7 +272,6 @@ options DRM_DEBUG # Include debug print # nfe: nVidia nForce MCP on-board Ethernet Networking (BSD open source) # nve: nVidia nForce MCP on-board Ethernet Networking # ral: Ralink Technology IEEE 802.11 wireless adapter -# ural: Ralink Technology RT2500USB IEEE 802.11 wireless adapter # wpi: Intel 3945ABG Wireless LAN controller device ed @@ -277,10 +281,9 @@ options ED_SIC device iwi device iwn device ipw -device nfe # nVidia nForce MCP on-board Ethernet Networking -device nve # nVidia nForce MCP on-board Ethernet Networking +device nfe +device nve device ral -device ural device wpi device ath # Atheros pci/cardbus NIC's @@ -356,9 +359,11 @@ options SAFE_RNDTEST # enable rndtest s # Miscellaneous hardware: # # ipmi: Intelligent Platform Management Interface +# pbio: Parallel (8255 PPI) basic I/O (mode 0) port (e.g. Advantech PCL-724) # smbios: DMI/SMBIOS entry point # vpd: Vital Product Data kernel interface # asmc: Apple System Management Controller +# si: Specialix International SI/XIO or SX intelligent serial card # Notes on the Specialix SI/XIO driver: # The host card is memory, not IO mapped. @@ -367,13 +372,14 @@ options SAFE_RNDTEST # enable rndtest s # The cards can use an IRQ of 11, 12 or 15. device ipmi -# Parallel (8255 PPI) basic I/O (mode 0) port (e.g. Advantech PCL-724) device pbio hint.pbio.0.at="isa" hint.pbio.0.port="0x360" device smbios device vpd device asmc +#device si + # # Laptop/Notebook options: # Modified: user/thompsa/usb/sys/amd64/include/legacyvar.h ============================================================================== --- user/thompsa/usb/sys/amd64/include/legacyvar.h Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/sys/amd64/include/legacyvar.h Sun Feb 8 17:49:32 2009 (r188317) @@ -43,12 +43,12 @@ LEGACY_ACCESSOR(pcibus, PCIBUS, uint3 #undef LEGACY_ACCESSOR int legacy_pcib_maxslots(device_t dev); -uint32_t legacy_pcib_read_config(device_t dev, int bus, int slot, int func, - int reg, int bytes); +uint32_t legacy_pcib_read_config(device_t dev, u_int bus, u_int slot, + u_int func, u_int reg, int bytes); int legacy_pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result); -void legacy_pcib_write_config(device_t dev, int bus, int slot, int func, - int reg, u_int32_t data, int bytes); +void legacy_pcib_write_config(device_t dev, u_int bus, u_int slot, + u_int func, u_int reg, uint32_t data, int bytes); int legacy_pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t value); struct resource *legacy_pcib_alloc_resource(device_t dev, device_t child, Modified: user/thompsa/usb/sys/amd64/pci/pci_bus.c ============================================================================== --- user/thompsa/usb/sys/amd64/pci/pci_bus.c Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/sys/amd64/pci/pci_bus.c Sun Feb 8 17:49:32 2009 (r188317) @@ -55,9 +55,9 @@ legacy_pcib_maxslots(device_t dev) /* read configuration space register */ -u_int32_t -legacy_pcib_read_config(device_t dev, int bus, int slot, int func, - int reg, int bytes) +uint32_t +legacy_pcib_read_config(device_t dev, u_int bus, u_int slot, u_int func, + u_int reg, int bytes) { return(pci_cfgregread(bus, slot, func, reg, bytes)); } @@ -65,8 +65,8 @@ legacy_pcib_read_config(device_t dev, in /* write configuration space register */ void -legacy_pcib_write_config(device_t dev, int bus, int slot, int func, - int reg, u_int32_t data, int bytes) +legacy_pcib_write_config(device_t dev, u_int bus, u_int slot, u_int func, + u_int reg, uint32_t data, int bytes) { pci_cfgregwrite(bus, slot, func, reg, data, bytes); } Modified: user/thompsa/usb/sys/conf/NOTES ============================================================================== --- user/thompsa/usb/sys/conf/NOTES Sun Feb 8 16:58:05 2009 (r188316) +++ user/thompsa/usb/sys/conf/NOTES Sun Feb 8 17:49:32 2009 (r188317) @@ -714,40 +714,81 @@ device mn # Munich32x/Falc54 Nx64kbit/s # # Network interfaces: # The `loop' device is MANDATORY when networking is enabled. +device loop + # The `ether' device provides generic code to handle # Ethernets; it is MANDATORY when an Ethernet device driver is # configured or token-ring is enabled. +device ether + # The `vlan' device implements the VLAN tagging of Ethernet frames # according to IEEE 802.1Q. It requires `device miibus'. +device vlan + # The `wlan' device provides generic code to support 802.11 # drivers, including host AP mode; it is MANDATORY for the wi, # and ath drivers and will eventually be required by all 802.11 drivers. +device wlan +options IEEE80211_DEBUG #enable debugging msgs +options IEEE80211_AMPDU_AGE #age frames in AMPDU reorder q's + # The `wlan_wep', `wlan_tkip', and `wlan_ccmp' devices provide # support for WEP, TKIP, and AES-CCMP crypto protocols optionally # used with 802.11 devices that depend on the `wlan' module. +device wlan_wep +device wlan_ccmp +device wlan_tkip + # The `wlan_xauth' device provides support for external (i.e. user-mode) # authenticators for use with 802.11 drivers that use the `wlan' # module and support 802.1x and/or WPA security protocols. +device wlan_xauth + # The `wlan_acl' device provides a MAC-based access control mechanism # for use with 802.11 drivers operating in ap mode and using the # `wlan' module. +# The 'wlan_amrr' device provides AMRR transmit rate control algorithm +device wlan_acl +device wlan_amrr + +# Generic TokenRing +device token + # The `fddi' device provides generic code to support FDDI. +device fddi + # The `arcnet' device provides generic code to support Arcnet. +device arcnet + # The `sppp' device serves a similar role for certain types *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Sun Feb 8 21:47:08 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7A3A106567A; Sun, 8 Feb 2009 21:47:08 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A20348FC1D; Sun, 8 Feb 2009 21:47:08 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n18Ll8cb035230; Sun, 8 Feb 2009 21:47:08 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n18Ll8kV035229; Sun, 8 Feb 2009 21:47:08 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200902082147.n18Ll8kV035229@svn.freebsd.org> From: Andrew Thompson Date: Sun, 8 Feb 2009 21:47:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188338 - user/thompsa/usb/sys/dev/usb2/wlan X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Feb 2009 21:47:23 -0000 Author: thompsa Date: Sun Feb 8 21:47:08 2009 New Revision: 188338 URL: http://svn.freebsd.org/changeset/base/188338 Log: Add hardware command debugging. Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c ============================================================================== --- user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c Sun Feb 8 21:20:13 2009 (r188337) +++ user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c Sun Feb 8 21:47:08 2009 (r188338) @@ -60,11 +60,12 @@ enum { ZYD_DEBUG_STATE = 0x00000040, /* 802.11 state transitions */ ZYD_DEBUG_STAT = 0x00000080, /* statistic */ ZYD_DEBUG_FW = 0x00000100, /* firmware */ + ZYD_DEBUG_CMD = 0x00000200, /* fw commands */ ZYD_DEBUG_ANY = 0xffffffff }; #define DPRINTF(sc, m, fmt, ...) do { \ if (sc->sc_debug & (m)) \ - printf(fmt, __VA_ARGS__); \ + printf("%s: " fmt, __func__, ## __VA_ARGS__); \ } while (0) #else #define DPRINTF(sc, m, fmt, ...) do { \ @@ -746,26 +747,31 @@ zyd_intr_read_callback(struct usb2_xfer datalen -= 2; /* XXX: padding? */ STAILQ_FOREACH(rqp, &sc->sc_rqh, rq) { - int i; + int i, cnt; - if (sizeof(struct zyd_pair) * rqp->olen != datalen) + if (rqp->olen != datalen) continue; - for (i = 0; i < rqp->olen; i++) { + cnt = rqp->olen / sizeof(struct zyd_pair); + for (i = 0; i < cnt; i++) { if (*(((const uint16_t *)rqp->idata) + i) != (((struct zyd_pair *)cmd->data) + i)->reg) break; } - if (i != rqp->olen) + if (i != cnt) continue; /* copy answer into caller-supplied buffer */ - bcopy(cmd->data, rqp->odata, - sizeof(struct zyd_pair) * rqp->olen); + bcopy(cmd->data, rqp->odata, rqp->olen); + DPRINTF(sc, ZYD_DEBUG_CMD, + "command %p complete, data = %*D \n", + rqp, rqp->olen, rqp->odata, ":"); wakeup(rqp); /* wakeup caller */ - return; + break; + } + if (rqp == NULL) { + device_printf(sc->sc_dev, + "unexpected IORD notification %*D\n", + datalen, cmd->data, ":"); } - device_printf(sc->sc_dev, - "unexpected IORD notification %*D\n", - datalen, cmd->data, ":"); break; } default: @@ -784,7 +790,7 @@ zyd_intr_read_callback(struct usb2_xfer break; default: /* Error */ - DPRINTF(sc, ZYD_DEBUG_ANY, "error = %s\n", + DPRINTF(sc, ZYD_DEBUG_CMD, "error = %s\n", usb2_errstr(xfer->error)); if (xfer->error != USB_ERR_CANCELLED) { @@ -817,8 +823,8 @@ zyd_intr_write_callback(struct usb2_xfer switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - DPRINTF(sc, ZYD_DEBUG_ANY, "length=%d\n", xfer->actlen); rqp = xfer->priv_fifo; + DPRINTF(sc, ZYD_DEBUG_CMD, "command %p transferred\n", rqp); if ((rqp->flags & ZYD_CMD_FLAG_READ) == 0) wakeup(rqp); /* wakeup caller */ @@ -884,12 +890,14 @@ zyd_cmd(struct zyd_softc *sc, uint16_t c cmd.code = htole16(code); bcopy(idata, cmd.data, ilen); + DPRINTF(sc, ZYD_DEBUG_CMD, "sending cmd %p = %*D\n", + &rq, ilen, idata, ":"); rq.cmd = &cmd; rq.idata = idata; rq.odata = odata; rq.ilen = sizeof(uint16_t) + ilen; - rq.olen = olen / sizeof(struct zyd_pair); + rq.olen = olen; rq.flags = flags; STAILQ_INSERT_TAIL(&sc->sc_rqh, &rq, rq); usb2_transfer_start(sc->sc_xfer[ZYD_INTR_DT_RD]); @@ -900,6 +908,8 @@ zyd_cmd(struct zyd_softc *sc, uint16_t c if (error) device_printf(sc->sc_dev, "command timeout\n"); STAILQ_REMOVE(&sc->sc_rqh, &rq, zyd_rq, rq); + DPRINTF(sc, ZYD_DEBUG_CMD, "finsihed cmd %p, error = %d \n", + &rq, error); return (error); } From owner-svn-src-user@FreeBSD.ORG Sun Feb 8 21:48:35 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB7C5106566C; Sun, 8 Feb 2009 21:48:35 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA5E18FC18; Sun, 8 Feb 2009 21:48:35 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n18LmZNk035291; Sun, 8 Feb 2009 21:48:35 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n18LmZPw035290; Sun, 8 Feb 2009 21:48:35 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200902082148.n18LmZPw035290@svn.freebsd.org> From: Andrew Thompson Date: Sun, 8 Feb 2009 21:48:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188339 - user/thompsa/usb/sys/dev/usb2/wlan X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Feb 2009 21:48:36 -0000 Author: thompsa Date: Sun Feb 8 21:48:35 2009 New Revision: 188339 URL: http://svn.freebsd.org/changeset/base/188339 Log: Endpoint 0x83 is always a interrupt type, only 0x04 changes with FS/HS operation. Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c ============================================================================== --- user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c Sun Feb 8 21:47:08 2009 (r188338) +++ user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c Sun Feb 8 21:48:35 2009 (r188339) @@ -281,13 +281,12 @@ static const struct usb2_config zyd_conf }, [ZYD_INTR_DT_RD] = { - .type = UE_BULK_INTR, + .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .mh.bufsize = sizeof(struct zyd_cmd), .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, .mh.callback = zyd_intr_read_callback, - .ep_index = 1, }, [ZYD_INTR_CS_WR] = { From owner-svn-src-user@FreeBSD.ORG Sun Feb 8 21:50:47 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 808B11065696; Sun, 8 Feb 2009 21:50:47 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E63E8FC19; Sun, 8 Feb 2009 21:50:47 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n18Lol8p035402; Sun, 8 Feb 2009 21:50:47 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n18LolZA035401; Sun, 8 Feb 2009 21:50:47 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200902082150.n18LolZA035401@svn.freebsd.org> From: Andrew Thompson Date: Sun, 8 Feb 2009 21:50:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188340 - user/thompsa/usb/sys/dev/usb2/controller X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Feb 2009 21:50:49 -0000 Author: thompsa Date: Sun Feb 8 21:50:47 2009 New Revision: 188340 URL: http://svn.freebsd.org/changeset/base/188340 Log: MFH r188336 The NRL value in the queue head must be zero for interrupt transfers. This was diagnosed using a USB analyser obtained through a FreeBSD Foundation grant. Modified: user/thompsa/usb/sys/dev/usb2/controller/ehci2.c Modified: user/thompsa/usb/sys/dev/usb2/controller/ehci2.c ============================================================================== --- user/thompsa/usb/sys/dev/usb2/controller/ehci2.c Sun Feb 8 21:48:35 2009 (r188339) +++ user/thompsa/usb/sys/dev/usb2/controller/ehci2.c Sun Feb 8 21:50:47 2009 (r188340) @@ -1895,7 +1895,9 @@ ehci_setup_standard_chain(struct usb2_xf if (usb2_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) { qh_endp |= (EHCI_QH_SET_EPS(EHCI_QH_SPEED_HIGH) | - EHCI_QH_DTC | EHCI_QH_SET_NRL(8)); + EHCI_QH_DTC); + if (methods != &ehci_device_intr_methods) + qh_endp |= EHCI_QH_SET_NRL(8); } else { if (usb2_get_speed(xfer->xroot->udev) == USB_SPEED_FULL) { From owner-svn-src-user@FreeBSD.ORG Mon Feb 9 00:58:16 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD5FE106564A; Mon, 9 Feb 2009 00:58:16 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CBC378FC18; Mon, 9 Feb 2009 00:58:16 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n190wG9N039856; Mon, 9 Feb 2009 00:58:16 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n190wG6U039849; Mon, 9 Feb 2009 00:58:16 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200902090058.n190wG6U039849@svn.freebsd.org> From: Andrew Thompson Date: Mon, 9 Feb 2009 00:58:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188355 - user/thompsa/usb/sys/dev/usb2/wlan X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Feb 2009 00:58:17 -0000 Author: thompsa Date: Mon Feb 9 00:58:16 2009 New Revision: 188355 URL: http://svn.freebsd.org/changeset/base/188355 Log: Use usb2_clear_endpoint_stall() to clear the stalls. Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_rum2.c user/thompsa/usb/sys/dev/usb2/wlan/if_rumvar.h user/thompsa/usb/sys/dev/usb2/wlan/if_ural2.c user/thompsa/usb/sys/dev/usb2/wlan/if_uralvar.h user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c user/thompsa/usb/sys/dev/usb2/wlan/if_zydreg.h Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_rum2.c ============================================================================== --- user/thompsa/usb/sys/dev/usb2/wlan/if_rum2.c Sun Feb 8 23:51:44 2009 (r188354) +++ user/thompsa/usb/sys/dev/usb2/wlan/if_rum2.c Mon Feb 9 00:58:16 2009 (r188355) @@ -114,9 +114,7 @@ static device_attach_t rum_attach; static device_detach_t rum_detach; static usb2_callback_t rum_bulk_read_callback; -static usb2_callback_t rum_bulk_read_clear_stall_callback; static usb2_callback_t rum_bulk_write_callback; -static usb2_callback_t rum_bulk_write_clear_stall_callback; static usb2_task_fn_t rum_task; static usb2_task_fn_t rum_scantask; @@ -351,7 +349,7 @@ static const struct rfprog { }; static const struct usb2_config rum_config[RUM_N_TRANSFER] = { - [RUM_BULK_DT_WR] = { + [RUM_BULK_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, @@ -360,8 +358,7 @@ static const struct usb2_config rum_conf .mh.callback = rum_bulk_write_callback, .mh.timeout = 5000, /* ms */ }, - - [RUM_BULK_DT_RD] = { + [RUM_BULK_RD] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, @@ -369,26 +366,6 @@ static const struct usb2_config rum_conf .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, .mh.callback = rum_bulk_read_callback, }, - - [RUM_BULK_CS_WR] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.callback = rum_bulk_write_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ - }, - - [RUM_BULK_CS_RD] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.callback = rum_bulk_read_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ - }, }; static int @@ -809,10 +786,6 @@ rum_bulk_write_callback(struct usb2_xfer /* FALLTHROUGH */ case USB_ST_SETUP: - if (sc->sc_flags & RUM_FLAG_WRITE_STALL) { - usb2_transfer_start(sc->sc_xfer[RUM_BULK_CS_WR]); - break; - } #if 0 if (sc->sc_flags & RUM_FLAG_WAIT_COMMAND) { /* @@ -870,8 +843,7 @@ rum_bulk_write_callback(struct usb2_xfer if (xfer->error == USB_ERR_STALLED) { /* try to clear stall first */ - sc->sc_flags |= RUM_FLAG_WRITE_STALL; - usb2_transfer_start(sc->sc_xfer[RUM_BULK_CS_WR]); + usb2_clear_endpoint_stall(xfer); return; } if (xfer->error == USB_ERR_TIMEOUT) @@ -888,19 +860,6 @@ rum_bulk_write_callback(struct usb2_xfer } static void -rum_bulk_write_clear_stall_callback(struct usb2_xfer *xfer) -{ - struct rum_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_xfer[RUM_BULK_DT_WR]; - - if (usb2_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - sc->sc_flags &= ~RUM_FLAG_WRITE_STALL; - usb2_transfer_start(xfer_other); - } -} - -static void rum_bulk_read_callback(struct usb2_xfer *xfer) { struct rum_softc *sc = xfer->priv_sc; @@ -972,12 +931,8 @@ rum_bulk_read_callback(struct usb2_xfer /* FALLTHROUGH */ case USB_ST_SETUP: tr_setup: - if (sc->sc_flags & RUM_FLAG_READ_STALL) { - usb2_transfer_start(sc->sc_xfer[RUM_BULK_CS_RD]); - } else { - xfer->frlengths[0] = xfer->max_data_length; - usb2_start_hardware(xfer); - } + xfer->frlengths[0] = xfer->max_data_length; + usb2_start_hardware(xfer); /* * At the end of a USB callback it is always safe to unlock @@ -1002,27 +957,14 @@ tr_setup: default: /* Error */ if (xfer->error != USB_ERR_CANCELLED) { /* try to clear stall first */ - sc->sc_flags |= RUM_FLAG_READ_STALL; - usb2_transfer_start(sc->sc_xfer[RUM_BULK_CS_RD]); + usb2_clear_endpoint_stall(xfer); + return; } return; } } -static void -rum_bulk_read_clear_stall_callback(struct usb2_xfer *xfer) -{ - struct rum_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_xfer[RUM_BULK_DT_RD]; - - if (usb2_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - sc->sc_flags &= ~RUM_FLAG_READ_STALL; - usb2_transfer_start(xfer_other); - } -} - static uint8_t rum_plcp_signal(int rate) { @@ -1139,7 +1081,7 @@ rum_sendprot(struct rum_softc *sc, rum_setup_tx_desc(sc, &data->desc, flags, 0, mprot->m_pkthdr.len, protrate); STAILQ_INSERT_TAIL(&sc->tx_q, data, next); - usb2_transfer_start(sc->sc_xfer[RUM_BULK_DT_WR]); + usb2_transfer_start(sc->sc_xfer[RUM_BULK_WR]); return 0; } @@ -1199,7 +1141,7 @@ rum_tx_mgt(struct rum_softc *sc, struct m0->m_pkthdr.len + (int)RT2573_TX_DESC_SIZE, tp->mgmtrate); STAILQ_INSERT_TAIL(&sc->tx_q, data, next); - usb2_transfer_start(sc->sc_xfer[RUM_BULK_DT_WR]); + usb2_transfer_start(sc->sc_xfer[RUM_BULK_WR]); return 0; } @@ -1251,7 +1193,7 @@ rum_tx_raw(struct rum_softc *sc, struct m0->m_pkthdr.len, rate); STAILQ_INSERT_TAIL(&sc->tx_q, data, next); - usb2_transfer_start(sc->sc_xfer[RUM_BULK_DT_WR]); + usb2_transfer_start(sc->sc_xfer[RUM_BULK_WR]); return 0; } @@ -1333,7 +1275,7 @@ rum_tx_data(struct rum_softc *sc, struct m0->m_pkthdr.len + (int)RT2573_TX_DESC_SIZE, rate); STAILQ_INSERT_TAIL(&sc->tx_q, data, next); - usb2_transfer_start(sc->sc_xfer[RUM_BULK_DT_WR]); + usb2_transfer_start(sc->sc_xfer[RUM_BULK_WR]); return 0; } @@ -2064,7 +2006,7 @@ rum_init_locked(struct rum_softc *sc) ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; ifp->if_drv_flags |= IFF_DRV_RUNNING; - usb2_transfer_start(sc->sc_xfer[RUM_BULK_DT_RD]); + usb2_transfer_start(sc->sc_xfer[RUM_BULK_RD]); return; fail: rum_stop(sc); @@ -2100,10 +2042,8 @@ rum_stop(void *priv) /* * stop all the transfers, if not already stopped: */ - usb2_transfer_stop(sc->sc_xfer[RUM_BULK_DT_WR]); - usb2_transfer_stop(sc->sc_xfer[RUM_BULK_DT_RD]); - usb2_transfer_stop(sc->sc_xfer[RUM_BULK_CS_WR]); - usb2_transfer_stop(sc->sc_xfer[RUM_BULK_CS_RD]); + usb2_transfer_stop(sc->sc_xfer[RUM_BULK_WR]); + usb2_transfer_stop(sc->sc_xfer[RUM_BULK_RD]); rum_free_tx_list(sc); Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_rumvar.h ============================================================================== --- user/thompsa/usb/sys/dev/usb2/wlan/if_rumvar.h Sun Feb 8 23:51:44 2009 (r188354) +++ user/thompsa/usb/sys/dev/usb2/wlan/if_rumvar.h Mon Feb 9 00:58:16 2009 (r188355) @@ -83,11 +83,9 @@ struct rum_vap { #define RUM_VAP(vap) ((struct rum_vap *)(vap)) enum { - RUM_BULK_DT_WR, - RUM_BULK_DT_RD, - RUM_BULK_CS_WR, - RUM_BULK_CS_RD, - RUM_N_TRANSFER = 4, + RUM_BULK_WR, + RUM_BULK_RD, + RUM_N_TRANSFER = 2, }; struct rum_softc { @@ -122,9 +120,7 @@ struct rum_softc { struct mtx sc_mtx; int sc_flags; -#define RUM_FLAG_READ_STALL 0x0001 -#define RUM_FLAG_WRITE_STALL 0x0002 -#define RUM_FLAG_DETACH 0x0004 +#define RUM_FLAG_DETACH 0x0001 uint32_t sta[6]; uint32_t rf_regs[4]; Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_ural2.c ============================================================================== --- user/thompsa/usb/sys/dev/usb2/wlan/if_ural2.c Sun Feb 8 23:51:44 2009 (r188354) +++ user/thompsa/usb/sys/dev/usb2/wlan/if_ural2.c Mon Feb 9 00:58:16 2009 (r188355) @@ -93,9 +93,7 @@ static const struct usb2_device_id ural_ }; static usb2_callback_t ural_bulk_read_callback; -static usb2_callback_t ural_bulk_read_clear_stall_callback; static usb2_callback_t ural_bulk_write_callback; -static usb2_callback_t ural_bulk_write_clear_stall_callback; static usb2_task_fn_t ural_task; static usb2_task_fn_t ural_scantask; @@ -327,7 +325,7 @@ static const struct { }; static const struct usb2_config ural_config[URAL_N_TRANSFER] = { - [URAL_BULK_DT_WR] = { + [URAL_BULK_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, @@ -336,8 +334,7 @@ static const struct usb2_config ural_con .mh.callback = ural_bulk_write_callback, .mh.timeout = 5000, /* ms */ }, - - [URAL_BULK_DT_RD] = { + [URAL_BULK_RD] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, @@ -345,26 +342,6 @@ static const struct usb2_config ural_con .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, .mh.callback = ural_bulk_read_callback, }, - - [URAL_BULK_CS_WR] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.callback = ural_bulk_write_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ - }, - - [URAL_BULK_CS_RD] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.callback = ural_bulk_read_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ - }, }; static device_probe_t ural_match; @@ -841,10 +818,6 @@ ural_bulk_write_callback(struct usb2_xfe /* FALLTHROUGH */ case USB_ST_SETUP: - if (sc->sc_flags & URAL_FLAG_WRITE_STALL) { - usb2_transfer_start(sc->sc_xfer[URAL_BULK_CS_WR]); - break; - } #if 0 if (sc->sc_flags & URAL_FLAG_WAIT_COMMAND) { /* @@ -902,8 +875,7 @@ ural_bulk_write_callback(struct usb2_xfe if (xfer->error == USB_ERR_STALLED) { /* try to clear stall first */ - sc->sc_flags |= URAL_FLAG_WRITE_STALL; - usb2_transfer_start(sc->sc_xfer[URAL_BULK_CS_WR]); + usb2_clear_endpoint_stall(xfer); return; } if (xfer->error == USB_ERR_TIMEOUT) @@ -920,19 +892,6 @@ ural_bulk_write_callback(struct usb2_xfe } static void -ural_bulk_write_clear_stall_callback(struct usb2_xfer *xfer) -{ - struct ural_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_xfer[URAL_BULK_DT_WR]; - - if (usb2_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - sc->sc_flags &= ~URAL_FLAG_WRITE_STALL; - usb2_transfer_start(xfer_other); - } -} - -static void ural_bulk_read_callback(struct usb2_xfer *xfer) { struct ural_softc *sc = xfer->priv_sc; @@ -1007,12 +966,8 @@ ural_bulk_read_callback(struct usb2_xfer /* FALLTHROUGH */ case USB_ST_SETUP: tr_setup: - if (sc->sc_flags & URAL_FLAG_READ_STALL) { - usb2_transfer_start(sc->sc_xfer[URAL_BULK_CS_RD]); - } else { - xfer->frlengths[0] = xfer->max_data_length; - usb2_start_hardware(xfer); - } + xfer->frlengths[0] = xfer->max_data_length; + usb2_start_hardware(xfer); /* * At the end of a USB callback it is always safe to unlock @@ -1037,27 +992,14 @@ tr_setup: default: /* Error */ if (xfer->error != USB_ERR_CANCELLED) { /* try to clear stall first */ - sc->sc_flags |= URAL_FLAG_READ_STALL; - usb2_transfer_start(sc->sc_xfer[URAL_BULK_CS_RD]); + usb2_clear_endpoint_stall(xfer); + return; } return; } } -static void -ural_bulk_read_clear_stall_callback(struct usb2_xfer *xfer) -{ - struct ural_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_xfer[URAL_BULK_DT_RD]; - - if (usb2_clear_stall_callback(xfer, xfer_other)) { - DPRINTF("stall cleared\n"); - sc->sc_flags &= ~URAL_FLAG_READ_STALL; - usb2_transfer_start(xfer_other); - } -} - static uint8_t ural_plcp_signal(int rate) { @@ -1160,7 +1102,7 @@ ural_tx_bcn(struct ural_softc *sc, struc m0->m_pkthdr.len, tp->mgmtrate); STAILQ_INSERT_TAIL(&sc->tx_q, data, next); - usb2_transfer_start(sc->sc_xfer[URAL_BULK_DT_WR]); + usb2_transfer_start(sc->sc_xfer[URAL_BULK_WR]); return (0); } @@ -1221,7 +1163,7 @@ ural_tx_mgt(struct ural_softc *sc, struc m0->m_pkthdr.len, tp->mgmtrate); STAILQ_INSERT_TAIL(&sc->tx_q, data, next); - usb2_transfer_start(sc->sc_xfer[URAL_BULK_DT_WR]); + usb2_transfer_start(sc->sc_xfer[URAL_BULK_WR]); return 0; } @@ -1272,7 +1214,7 @@ ural_sendprot(struct ural_softc *sc, ural_setup_tx_desc(sc, &data->desc, flags, mprot->m_pkthdr.len, protrate); STAILQ_INSERT_TAIL(&sc->tx_q, data, next); - usb2_transfer_start(sc->sc_xfer[URAL_BULK_DT_WR]); + usb2_transfer_start(sc->sc_xfer[URAL_BULK_WR]); return 0; } @@ -1325,7 +1267,7 @@ ural_tx_raw(struct ural_softc *sc, struc m0->m_pkthdr.len, rate); STAILQ_INSERT_TAIL(&sc->tx_q, data, next); - usb2_transfer_start(sc->sc_xfer[URAL_BULK_DT_WR]); + usb2_transfer_start(sc->sc_xfer[URAL_BULK_WR]); return 0; } @@ -1405,7 +1347,7 @@ ural_tx_data(struct ural_softc *sc, stru m0->m_pkthdr.len, rate); STAILQ_INSERT_TAIL(&sc->tx_q, data, next); - usb2_transfer_start(sc->sc_xfer[URAL_BULK_DT_WR]); + usb2_transfer_start(sc->sc_xfer[URAL_BULK_WR]); return 0; } @@ -2204,7 +2146,7 @@ ural_init_locked(struct ural_softc *sc) ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; ifp->if_drv_flags |= IFF_DRV_RUNNING; - usb2_transfer_start(sc->sc_xfer[URAL_BULK_DT_RD]); + usb2_transfer_start(sc->sc_xfer[URAL_BULK_RD]); return; fail: ural_stop(sc); @@ -2239,10 +2181,8 @@ ural_stop(void *priv) /* * stop all the transfers, if not already stopped: */ - usb2_transfer_stop(sc->sc_xfer[URAL_BULK_DT_WR]); - usb2_transfer_stop(sc->sc_xfer[URAL_BULK_DT_RD]); - usb2_transfer_stop(sc->sc_xfer[URAL_BULK_CS_WR]); - usb2_transfer_stop(sc->sc_xfer[URAL_BULK_CS_RD]); + usb2_transfer_stop(sc->sc_xfer[URAL_BULK_WR]); + usb2_transfer_stop(sc->sc_xfer[URAL_BULK_RD]); ural_free_tx_list(sc); Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_uralvar.h ============================================================================== --- user/thompsa/usb/sys/dev/usb2/wlan/if_uralvar.h Sun Feb 8 23:51:44 2009 (r188354) +++ user/thompsa/usb/sys/dev/usb2/wlan/if_uralvar.h Mon Feb 9 00:58:16 2009 (r188355) @@ -88,11 +88,9 @@ struct ural_vap { #define URAL_VAP(vap) ((struct ural_vap *)(vap)) enum { - URAL_BULK_DT_WR, - URAL_BULK_DT_RD, - URAL_BULK_CS_WR, - URAL_BULK_CS_RD, - URAL_N_TRANSFER = 4, + URAL_BULK_WR, + URAL_BULK_RD, + URAL_N_TRANSFER = 2, }; struct ural_softc { @@ -124,9 +122,7 @@ struct ural_softc { struct mtx sc_mtx; int sc_flags; -#define URAL_FLAG_READ_STALL 0x0001 -#define URAL_FLAG_WRITE_STALL 0x0002 -#define URAL_FLAG_DETACH 0x0004 +#define URAL_FLAG_DETACH 0x0001 uint16_t sta[11]; uint32_t rf_regs[4]; Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c ============================================================================== --- user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c Sun Feb 8 23:51:44 2009 (r188354) +++ user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c Mon Feb 9 00:58:16 2009 (r188355) @@ -77,13 +77,9 @@ static device_probe_t zyd_match; static device_attach_t zyd_attach; static device_detach_t zyd_detach; -static usb2_callback_t zyd_intr_read_clear_stall_callback; static usb2_callback_t zyd_intr_read_callback; -static usb2_callback_t zyd_intr_write_clear_stall_callback; static usb2_callback_t zyd_intr_write_callback; -static usb2_callback_t zyd_bulk_read_clear_stall_callback; static usb2_callback_t zyd_bulk_read_callback; -static usb2_callback_t zyd_bulk_write_clear_stall_callback; static usb2_callback_t zyd_bulk_write_callback; static usb2_task_fn_t zyd_task; @@ -226,7 +222,7 @@ static const struct usb2_device_id zyd_d }; static const struct usb2_config zyd_config[ZYD_N_TRANSFER] = { - [ZYD_BULK_DT_WR] = { + [ZYD_BULK_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, @@ -236,8 +232,7 @@ static const struct usb2_config zyd_conf .ep_index = 0, .mh.timeout = 10000, /* 10 seconds */ }, - - [ZYD_BULK_DT_RD] = { + [ZYD_BULK_RD] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, @@ -246,30 +241,7 @@ static const struct usb2_config zyd_conf .mh.callback = zyd_bulk_read_callback, .ep_index = 0, }, - - [ZYD_BULK_CS_WR] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.flags = {}, - .mh.callback = zyd_bulk_write_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ - }, - - [ZYD_BULK_CS_RD] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.flags = {}, - .mh.callback = zyd_bulk_read_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ - }, - - [ZYD_INTR_DT_WR] = { + [ZYD_INTR_WR] = { .type = UE_BULK_INTR, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, @@ -279,8 +251,7 @@ static const struct usb2_config zyd_conf .mh.timeout = 1000, /* 1 second */ .ep_index = 1, }, - - [ZYD_INTR_DT_RD] = { + [ZYD_INTR_RD] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, @@ -288,28 +259,6 @@ static const struct usb2_config zyd_conf .mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, .mh.callback = zyd_intr_read_callback, }, - - [ZYD_INTR_CS_WR] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.flags = {}, - .mh.callback = zyd_intr_write_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ - }, - - [ZYD_INTR_CS_RD] = { - .type = UE_CONTROL, - .endpoint = 0x00, /* Control pipe */ - .direction = UE_DIR_ANY, - .mh.bufsize = sizeof(struct usb2_device_request), - .mh.flags = {}, - .mh.callback = zyd_intr_read_clear_stall_callback, - .mh.timeout = 1000, /* 1 second */ - .mh.interval = 50, /* 50ms */ - }, }; #define zyd_read16_m(sc, val, data) do { \ error = zyd_read16(sc, val, data); \ @@ -780,10 +729,6 @@ zyd_intr_read_callback(struct usb2_xfer /* FALLTHROUGH */ case USB_ST_SETUP: - if (sc->sc_flags & ZYD_FLAG_INTR_READ_STALL) { - usb2_transfer_start(sc->sc_xfer[ZYD_INTR_CS_RD]); - break; - } xfer->frlengths[0] = xfer->max_data_length; usb2_start_hardware(xfer); break; @@ -794,27 +739,14 @@ zyd_intr_read_callback(struct usb2_xfer if (xfer->error != USB_ERR_CANCELLED) { /* try to clear stall first */ - sc->sc_flags |= ZYD_FLAG_INTR_READ_STALL; - usb2_transfer_start(sc->sc_xfer[ZYD_INTR_CS_RD]); + usb2_clear_endpoint_stall(xfer); + return; } break; } } static void -zyd_intr_read_clear_stall_callback(struct usb2_xfer *xfer) -{ - struct zyd_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_xfer[ZYD_INTR_DT_RD]; - - if (usb2_clear_stall_callback(xfer, xfer_other)) { - DPRINTF(sc, ZYD_DEBUG_ANY, "%s\n", "stall cleared"); - sc->sc_flags &= ~ZYD_FLAG_INTR_READ_STALL; - usb2_transfer_start(xfer_other); - } -} - -static void zyd_intr_write_callback(struct usb2_xfer *xfer) { struct zyd_softc *sc = xfer->priv_sc; @@ -829,11 +761,6 @@ zyd_intr_write_callback(struct usb2_xfer /* FALLTHROUGH */ case USB_ST_SETUP: - - if (sc->sc_flags & ZYD_FLAG_INTR_WRITE_STALL) { - usb2_transfer_start(sc->sc_xfer[ZYD_INTR_CS_WR]); - break; - } STAILQ_FOREACH(rqp, &sc->sc_rqh, rq) { if (rqp->flags & ZYD_CMD_FLAG_SENT) continue; @@ -854,26 +781,13 @@ zyd_intr_write_callback(struct usb2_xfer if (xfer->error != USB_ERR_CANCELLED) { /* try to clear stall first */ - sc->sc_flags |= ZYD_FLAG_INTR_WRITE_STALL; - usb2_transfer_start(sc->sc_xfer[ZYD_INTR_CS_WR]); + usb2_clear_endpoint_stall(xfer); + return; } break; } } -static void -zyd_intr_write_clear_stall_callback(struct usb2_xfer *xfer) -{ - struct zyd_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_xfer[ZYD_INTR_DT_WR]; - - if (usb2_clear_stall_callback(xfer, xfer_other)) { - DPRINTF(sc, ZYD_DEBUG_ANY, "%s\n", "stall cleared"); - sc->sc_flags &= ~ZYD_FLAG_INTR_WRITE_STALL; - usb2_transfer_start(xfer_other); - } -} - static int zyd_cmd(struct zyd_softc *sc, uint16_t code, const void *idata, int ilen, void *odata, int olen, u_int flags) @@ -899,8 +813,8 @@ zyd_cmd(struct zyd_softc *sc, uint16_t c rq.olen = olen; rq.flags = flags; STAILQ_INSERT_TAIL(&sc->sc_rqh, &rq, rq); - usb2_transfer_start(sc->sc_xfer[ZYD_INTR_DT_RD]); - usb2_transfer_start(sc->sc_xfer[ZYD_INTR_DT_WR]); + usb2_transfer_start(sc->sc_xfer[ZYD_INTR_RD]); + usb2_transfer_start(sc->sc_xfer[ZYD_INTR_WR]); /* wait at most one second for command reply */ error = mtx_sleep(&rq, &sc->sc_mtx, 0 , "zydcmd", hz); @@ -2352,12 +2266,8 @@ zyd_bulk_read_callback(struct usb2_xfer } /* FALLTHROUGH */ case USB_ST_SETUP: - if (sc->sc_flags & ZYD_FLAG_BULK_READ_STALL) { - usb2_transfer_start(sc->sc_xfer[ZYD_BULK_CS_RD]); - } else { - xfer->frlengths[0] = xfer->max_data_length; - usb2_start_hardware(xfer); - } + xfer->frlengths[0] = xfer->max_data_length; + usb2_start_hardware(xfer); /* * At the end of a USB callback it is always safe to unlock @@ -2388,26 +2298,13 @@ zyd_bulk_read_callback(struct usb2_xfer if (xfer->error != USB_ERR_CANCELLED) { /* try to clear stall first */ - sc->sc_flags |= ZYD_FLAG_BULK_READ_STALL; - usb2_transfer_start(sc->sc_xfer[ZYD_BULK_CS_RD]); + usb2_clear_endpoint_stall(xfer); + return; } break; } } -static void -zyd_bulk_read_clear_stall_callback(struct usb2_xfer *xfer) -{ - struct zyd_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_xfer[ZYD_BULK_DT_RD]; - - if (usb2_clear_stall_callback(xfer, xfer_other)) { - DPRINTF(sc, ZYD_DEBUG_ANY, "%s\n", "stall cleared"); - sc->sc_flags &= ~ZYD_FLAG_BULK_READ_STALL; - usb2_transfer_start(xfer_other); - } -} - static uint8_t zyd_plcp_signal(int rate) { @@ -2540,7 +2437,7 @@ zyd_tx_mgt(struct zyd_softc *sc, struct rate); STAILQ_INSERT_TAIL(&sc->tx_q, data, next); - usb2_transfer_start(sc->sc_xfer[ZYD_BULK_DT_WR]); + usb2_transfer_start(sc->sc_xfer[ZYD_BULK_WR]); return (0); } @@ -2570,11 +2467,6 @@ zyd_bulk_write_callback(struct usb2_xfer /* FALLTHROUGH */ case USB_ST_SETUP: - if (sc->sc_flags & ZYD_FLAG_BULK_WRITE_STALL) { - usb2_transfer_start(sc->sc_xfer[ZYD_BULK_CS_WR]); - DPRINTF(sc, ZYD_DEBUG_ANY, "%s\n", "write stalled"); - break; - } #if 0 if (sc->sc_flags & ZYD_FLAG_WAIT_COMMAND) { /* @@ -2623,8 +2515,7 @@ zyd_bulk_write_callback(struct usb2_xfer if (xfer->error == USB_ERR_STALLED) { /* try to clear stall first */ - sc->sc_flags |= ZYD_FLAG_BULK_WRITE_STALL; - usb2_transfer_start(sc->sc_xfer[ZYD_BULK_CS_WR]); + usb2_clear_endpoint_stall(xfer); return; } if (xfer->error == USB_ERR_TIMEOUT) @@ -2639,19 +2530,6 @@ zyd_bulk_write_callback(struct usb2_xfer } } -static void -zyd_bulk_write_clear_stall_callback(struct usb2_xfer *xfer) -{ - struct zyd_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_xfer[ZYD_BULK_DT_WR]; - - if (usb2_clear_stall_callback(xfer, xfer_other)) { - DPRINTF(sc, ZYD_DEBUG_ANY, "%s\n", "stall cleared"); - sc->sc_flags &= ~ZYD_FLAG_BULK_WRITE_STALL; - usb2_transfer_start(xfer_other); - } -} - static int zyd_tx_data(struct zyd_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) { @@ -2747,7 +2625,7 @@ zyd_tx_data(struct zyd_softc *sc, struct rate); STAILQ_INSERT_TAIL(&sc->tx_q, data, next); - usb2_transfer_start(sc->sc_xfer[ZYD_BULK_DT_WR]); + usb2_transfer_start(sc->sc_xfer[ZYD_BULK_WR]); return (0); } @@ -2972,8 +2850,8 @@ zyd_init_locked(struct zyd_softc *sc) ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; ifp->if_drv_flags |= IFF_DRV_RUNNING; - usb2_transfer_start(sc->sc_xfer[ZYD_BULK_DT_RD]); - usb2_transfer_start(sc->sc_xfer[ZYD_INTR_DT_RD]); + usb2_transfer_start(sc->sc_xfer[ZYD_BULK_RD]); + usb2_transfer_start(sc->sc_xfer[ZYD_INTR_RD]); return; @@ -3009,10 +2887,8 @@ zyd_stop(struct zyd_softc *sc) /* * stop all the transfers, if not already stopped: */ - usb2_transfer_stop(sc->sc_xfer[ZYD_BULK_DT_WR]); - usb2_transfer_stop(sc->sc_xfer[ZYD_BULK_DT_RD]); - usb2_transfer_stop(sc->sc_xfer[ZYD_BULK_CS_WR]); - usb2_transfer_stop(sc->sc_xfer[ZYD_BULK_CS_RD]); + usb2_transfer_stop(sc->sc_xfer[ZYD_BULK_WR]); + usb2_transfer_stop(sc->sc_xfer[ZYD_BULK_RD]); zyd_free_tx_list(sc); Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_zydreg.h ============================================================================== --- user/thompsa/usb/sys/dev/usb2/wlan/if_zydreg.h Sun Feb 8 23:51:44 2009 (r188354) +++ user/thompsa/usb/sys/dev/usb2/wlan/if_zydreg.h Mon Feb 9 00:58:16 2009 (r188355) @@ -1247,15 +1247,11 @@ struct zyd_vap { #define ZYD_VAP(vap) ((struct zyd_vap *)(vap)) enum { - ZYD_BULK_DT_WR, - ZYD_BULK_DT_RD, - ZYD_BULK_CS_WR, - ZYD_BULK_CS_RD, - ZYD_INTR_DT_WR, - ZYD_INTR_DT_RD, - ZYD_INTR_CS_WR, - ZYD_INTR_CS_RD, - ZYD_N_TRANSFER = 8, + ZYD_BULK_WR, + ZYD_BULK_RD, + ZYD_INTR_WR, + ZYD_INTR_RD, + ZYD_N_TRANSFER = 4, }; struct zyd_softc { @@ -1273,10 +1269,6 @@ struct zyd_softc { #define ZYD_FLAG_DETACHING (1 << 1) #define ZYD_FLAG_INITONCE (1 << 2) #define ZYD_FLAG_INITDONE (1 << 3) -#define ZYD_FLAG_INTR_READ_STALL (1 << 4) -#define ZYD_FLAG_INTR_WRITE_STALL (1 << 5) -#define ZYD_FLAG_BULK_READ_STALL (1 << 6) -#define ZYD_FLAG_BULK_WRITE_STALL (1 << 7) int sc_if_flags; uint32_t sc_debug; From owner-svn-src-user@FreeBSD.ORG Mon Feb 9 17:38:17 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BE4F1065686; Mon, 9 Feb 2009 17:38:17 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F6F18FC20; Mon, 9 Feb 2009 17:38:17 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n19HcGo5066723; Mon, 9 Feb 2009 17:38:16 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n19HcGmH066720; Mon, 9 Feb 2009 17:38:16 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200902091738.n19HcGmH066720@svn.freebsd.org> From: Andrew Thompson Date: Mon, 9 Feb 2009 17:38:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188399 - user/thompsa/usb/sys/dev/usb2/wlan X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Feb 2009 17:38:18 -0000 Author: thompsa Date: Mon Feb 9 17:38:16 2009 New Revision: 188399 URL: http://svn.freebsd.org/changeset/base/188399 Log: Be sure to drain the transfers so the tx resources are returned before they get freed. Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_rum2.c user/thompsa/usb/sys/dev/usb2/wlan/if_ural2.c user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_rum2.c ============================================================================== --- user/thompsa/usb/sys/dev/usb2/wlan/if_rum2.c Mon Feb 9 17:37:17 2009 (r188398) +++ user/thompsa/usb/sys/dev/usb2/wlan/if_rum2.c Mon Feb 9 17:38:16 2009 (r188399) @@ -654,6 +654,8 @@ rum_free_tx_list(struct rum_softc *sc) if (sc->tx_data == NULL) return; + KASSERT(sc->tx_nfree == RUM_TX_LIST_COUNT, ("lost a txd")); + for (i = 0; i < RUM_TX_LIST_COUNT; i++) { data = &sc->tx_data[i]; @@ -2042,8 +2044,10 @@ rum_stop(void *priv) /* * stop all the transfers, if not already stopped: */ - usb2_transfer_stop(sc->sc_xfer[RUM_BULK_WR]); - usb2_transfer_stop(sc->sc_xfer[RUM_BULK_RD]); + RUM_UNLOCK(sc); + usb2_transfer_drain(sc->sc_xfer[RUM_BULK_WR]); + usb2_transfer_drain(sc->sc_xfer[RUM_BULK_RD]); + RUM_LOCK(sc); rum_free_tx_list(sc); Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_ural2.c ============================================================================== --- user/thompsa/usb/sys/dev/usb2/wlan/if_ural2.c Mon Feb 9 17:37:17 2009 (r188398) +++ user/thompsa/usb/sys/dev/usb2/wlan/if_ural2.c Mon Feb 9 17:38:16 2009 (r188399) @@ -639,6 +639,8 @@ ural_free_tx_list(struct ural_softc *sc) if (sc->tx_data == NULL) return; + KASSERT(sc->tx_nfree == RAL_TX_LIST_COUNT, ("lost a txd")); + for (i = 0; i < RAL_TX_LIST_COUNT; i++) { data = &sc->tx_data[i]; @@ -2181,8 +2183,10 @@ ural_stop(void *priv) /* * stop all the transfers, if not already stopped: */ - usb2_transfer_stop(sc->sc_xfer[URAL_BULK_WR]); - usb2_transfer_stop(sc->sc_xfer[URAL_BULK_RD]); + RAL_UNLOCK(sc); + usb2_transfer_drain(sc->sc_xfer[URAL_BULK_WR]); + usb2_transfer_drain(sc->sc_xfer[URAL_BULK_RD]); + RAL_LOCK(sc); ural_free_tx_list(sc); Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c ============================================================================== --- user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c Mon Feb 9 17:37:17 2009 (r188398) +++ user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c Mon Feb 9 17:38:16 2009 (r188399) @@ -542,6 +542,8 @@ zyd_free_tx_list(struct zyd_softc *sc) if (sc->tx_data == NULL) return; + KASSERT(sc->tx_nfree == ZYD_TX_LIST_CNT, ("lost a txd")); + for (i = 0; i < ZYD_TX_LIST_CNT; i++) { data = &sc->tx_data[i]; @@ -2523,9 +2525,10 @@ zyd_bulk_write_callback(struct usb2_xfer ifp->if_oerrors++; data = xfer->priv_fifo; - xfer->priv_fifo = NULL; - if (data != NULL && ifp->if_drv_flags & IFF_DRV_RUNNING) + if (data != NULL) { zyd_tx_free(data, xfer->error); + xfer->priv_fifo = NULL; + } break; } } @@ -2887,8 +2890,10 @@ zyd_stop(struct zyd_softc *sc) /* * stop all the transfers, if not already stopped: */ - usb2_transfer_stop(sc->sc_xfer[ZYD_BULK_WR]); - usb2_transfer_stop(sc->sc_xfer[ZYD_BULK_RD]); + ZYD_UNLOCK(sc); + usb2_transfer_drain(sc->sc_xfer[ZYD_BULK_WR]); + usb2_transfer_drain(sc->sc_xfer[ZYD_BULK_RD]); + ZYD_LOCK(sc); zyd_free_tx_list(sc); From owner-svn-src-user@FreeBSD.ORG Mon Feb 9 22:52:29 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5BD81065698 for ; Mon, 9 Feb 2009 22:52:29 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id D19F18FC17 for ; Mon, 9 Feb 2009 22:52:29 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id C49AD1A3C3A; Mon, 9 Feb 2009 14:34:39 -0800 (PST) Date: Mon, 9 Feb 2009 14:34:39 -0800 From: Alfred Perlstein To: "M. Warner Losh" Message-ID: <20090209223439.GP68801@elvis.mu.org> References: <20090202044416.GC43513@michelle.cdnetworks.co.kr> <20090201.215218.1013608033.imp@bsdimp.com> <20090202051421.GE43513@michelle.cdnetworks.co.kr> <20090201.222119.-1303462184.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090201.222119.-1303462184.imp@bsdimp.com> User-Agent: Mutt/1.4.2.3i Cc: pyunyh@gmail.com, src-committers@freebsd.org, thompsa@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r187978 - user/thompsa/usb/sys/dev/usb2/ethernet X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Feb 2009 22:52:30 -0000 * M. Warner Losh [090201 21:24] wrote: > In message: <20090202051421.GE43513@michelle.cdnetworks.co.kr> > Pyun YongHyeon writes: > : On Sun, Feb 01, 2009 at 09:52:18PM -0700, M. Warner Losh wrote: > : > In message: <20090202044416.GC43513@michelle.cdnetworks.co.kr> > : > Pyun YongHyeon writes: > : > : On Sun, Feb 01, 2009 at 08:36:18PM -0700, M. Warner Losh wrote: > : > : > In message: <20090201213749.GJ32503@citylink.fud.org.nz> > : > : > Andrew Thompson writes: > : > : > : On Sun, Feb 01, 2009 at 02:28:08PM -0700, M. Warner Losh wrote: > : > : > : > In message: <200902010650.n116obU1045871@svn.freebsd.org> > : > : > : > Andrew Thompson writes: > : > : > : > : + locked = mtx_owned(&sc->sc_mtx); > : > : > : > : + if (!locked) > : > : > : > : + AUE_LOCK(sc); > : > : > : > > : > : > : > You do know this is racy, right? > : > : > : > : > : > : Yea... It only get called unlocked during mii probe+attach so its fine. > : > : > : I havnt actaully checked if its ok to hold a mutex during > : > : > : mii_phy_probe() which would make this go away. > : > : > > : > : > You hold GIANT when probe+attach, which means I think you can't > : > : > : > : AFAIK this is not true on USB2 and I think this is reason why > : > : it have to lock/unlock dance in probe/attach. > : > > : > It is a newbus requirement that all probe/attach routines have to be > : > called with GIANT held. > : > > : > : If this can be done on USB2 it would greatly simplify MII attach > : part as well as locks used in MII access routines in all USB2 > : ethernet drivers. I vaguely remember I asked for this to HPS, but > : he seem to forget about it. > > I'll take a look into the matter in more detail. It is an absolute > requirement of newbus at the moment that any call to > device_probe_and_attach(), including bus_generic_attach(). Can some asserts be added? Maybe under an additonal ifdef considering usb2 for a short time? -- - Alfred Perlstein From owner-svn-src-user@FreeBSD.ORG Mon Feb 9 23:03:47 2009 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 076BE106564A; Mon, 9 Feb 2009 23:03:47 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 98C068FC0C; Mon, 9 Feb 2009 23:03:46 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n19N1CaF031196; Mon, 9 Feb 2009 16:01:12 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Mon, 09 Feb 2009 16:01:17 -0700 (MST) Message-Id: <20090209.160117.-1183815561.imp@bsdimp.com> To: alfred@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20090209223439.GP68801@elvis.mu.org> References: <20090202051421.GE43513@michelle.cdnetworks.co.kr> <20090201.222119.-1303462184.imp@bsdimp.com> <20090209223439.GP68801@elvis.mu.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: pyunyh@gmail.com, src-committers@FreeBSD.org, thompsa@FreeBSD.org, svn-src-user@FreeBSD.org Subject: Re: svn commit: r187978 - user/thompsa/usb/sys/dev/usb2/ethernet X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Feb 2009 23:03:47 -0000 In message: <20090209223439.GP68801@elvis.mu.org> Alfred Perlstein writes: : * M. Warner Losh [090201 21:24] wrote: : > In message: <20090202051421.GE43513@michelle.cdnetworks.co.kr> : > Pyun YongHyeon writes: : > : On Sun, Feb 01, 2009 at 09:52:18PM -0700, M. Warner Losh wrote: : > : > In message: <20090202044416.GC43513@michelle.cdnetworks.co.kr> : > : > Pyun YongHyeon writes: : > : > : On Sun, Feb 01, 2009 at 08:36:18PM -0700, M. Warner Losh wrote: : > : > : > In message: <20090201213749.GJ32503@citylink.fud.org.nz> : > : > : > Andrew Thompson writes: : > : > : > : On Sun, Feb 01, 2009 at 02:28:08PM -0700, M. Warner Losh wrote: : > : > : > : > In message: <200902010650.n116obU1045871@svn.freebsd.org> : > : > : > : > Andrew Thompson writes: : > : > : > : > : + locked = mtx_owned(&sc->sc_mtx); : > : > : > : > : + if (!locked) : > : > : > : > : + AUE_LOCK(sc); : > : > : > : > : > : > : > : > You do know this is racy, right? : > : > : > : : > : > : > : Yea... It only get called unlocked during mii probe+attach so its fine. : > : > : > : I havnt actaully checked if its ok to hold a mutex during : > : > : > : mii_phy_probe() which would make this go away. : > : > : > : > : > : > You hold GIANT when probe+attach, which means I think you can't : > : > : : > : > : AFAIK this is not true on USB2 and I think this is reason why : > : > : it have to lock/unlock dance in probe/attach. : > : > : > : > It is a newbus requirement that all probe/attach routines have to be : > : > called with GIANT held. : > : > : > : : > : If this can be done on USB2 it would greatly simplify MII attach : > : part as well as locks used in MII access routines in all USB2 : > : ethernet drivers. I vaguely remember I asked for this to HPS, but : > : he seem to forget about it. : > : > I'll take a look into the matter in more detail. It is an absolute : > requirement of newbus at the moment that any call to : > device_probe_and_attach(), including bus_generic_attach(). : : Can some asserts be added? : : Maybe under an additonal ifdef considering usb2 for a short time? Are these not sufficient: int device_probe_child(device_t dev, device_t child) { devclass_t dc; driverlink_t best = NULL; driverlink_t dl; int result, pri = 0; int hasclass = (child->devclass != NULL); GIANT_REQUIRED; ... From owner-svn-src-user@FreeBSD.ORG Tue Feb 10 06:01:41 2009 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68ADA106564A; Tue, 10 Feb 2009 06:01:41 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 52EC18FC1A; Tue, 10 Feb 2009 06:01:41 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id 0E9251A3C3A; Mon, 9 Feb 2009 22:01:41 -0800 (PST) Date: Mon, 9 Feb 2009 22:01:40 -0800 From: Alfred Perlstein To: "M. Warner Losh" Message-ID: <20090210060140.GY68801@elvis.mu.org> References: <20090202051421.GE43513@michelle.cdnetworks.co.kr> <20090201.222119.-1303462184.imp@bsdimp.com> <20090209223439.GP68801@elvis.mu.org> <20090209.160117.-1183815561.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090209.160117.-1183815561.imp@bsdimp.com> User-Agent: Mutt/1.4.2.3i Cc: pyunyh@gmail.com, src-committers@FreeBSD.org, thompsa@FreeBSD.org, svn-src-user@FreeBSD.org Subject: Re: svn commit: r187978 - user/thompsa/usb/sys/dev/usb2/ethernet X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Feb 2009 06:01:41 -0000 * M. Warner Losh [090209 15:03] wrote: > In message: <20090209223439.GP68801@elvis.mu.org> > Alfred Perlstein writes: > : * M. Warner Losh [090201 21:24] wrote: > : > In message: <20090202051421.GE43513@michelle.cdnetworks.co.kr> > : > Pyun YongHyeon writes: > : > : On Sun, Feb 01, 2009 at 09:52:18PM -0700, M. Warner Losh wrote: > : > : > In message: <20090202044416.GC43513@michelle.cdnetworks.co.kr> > : > : > Pyun YongHyeon writes: > : > : > : On Sun, Feb 01, 2009 at 08:36:18PM -0700, M. Warner Losh wrote: > : > : > : > In message: <20090201213749.GJ32503@citylink.fud.org.nz> > : > : > : > Andrew Thompson writes: > : > : > : > : On Sun, Feb 01, 2009 at 02:28:08PM -0700, M. Warner Losh wrote: > : > : > : > : > In message: <200902010650.n116obU1045871@svn.freebsd.org> > : > : > : > : > Andrew Thompson writes: > : > : > : > : > : + locked = mtx_owned(&sc->sc_mtx); > : > : > : > : > : + if (!locked) > : > : > : > : > : + AUE_LOCK(sc); > : > : > : > : > > : > : > : > : > You do know this is racy, right? > : > : > : > : > : > : > : > : Yea... It only get called unlocked during mii probe+attach so its fine. > : > : > : > : I havnt actaully checked if its ok to hold a mutex during > : > : > : > : mii_phy_probe() which would make this go away. > : > : > : > > : > : > : > You hold GIANT when probe+attach, which means I think you can't > : > : > : > : > : > : AFAIK this is not true on USB2 and I think this is reason why > : > : > : it have to lock/unlock dance in probe/attach. > : > : > > : > : > It is a newbus requirement that all probe/attach routines have to be > : > : > called with GIANT held. > : > : > > : > : > : > : If this can be done on USB2 it would greatly simplify MII attach > : > : part as well as locks used in MII access routines in all USB2 > : > : ethernet drivers. I vaguely remember I asked for this to HPS, but > : > : he seem to forget about it. > : > > : > I'll take a look into the matter in more detail. It is an absolute > : > requirement of newbus at the moment that any call to > : > device_probe_and_attach(), including bus_generic_attach(). > : > : Can some asserts be added? > : > : Maybe under an additonal ifdef considering usb2 for a short time? > > Are these not sufficient: > > int > device_probe_child(device_t dev, device_t child) > { > devclass_t dc; > driverlink_t best = NULL; > driverlink_t dl; > int result, pri = 0; > int hasclass = (child->devclass != NULL); > > GIANT_REQUIRED; > ... It sounded like usb2 was calling it without Giant... -- - Alfred Perlstein From owner-svn-src-user@FreeBSD.ORG Wed Feb 11 00:08:49 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 371FE106566B; Wed, 11 Feb 2009 00:08:49 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0AEAA8FC1E; Wed, 11 Feb 2009 00:08:49 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1B08mti008657; Wed, 11 Feb 2009 00:08:48 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1B08mMj008656; Wed, 11 Feb 2009 00:08:48 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200902110008.n1B08mMj008656@svn.freebsd.org> From: Kip Macy Date: Wed, 11 Feb 2009 00:08:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188473 - user/kmacy/releng_7_fast_net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Feb 2009 00:08:49 -0000 Author: kmacy Date: Wed Feb 11 00:08:48 2009 New Revision: 188473 URL: http://svn.freebsd.org/changeset/base/188473 Log: create RELENG_7 branch for backporting networking changes Added: user/kmacy/releng_7_fast_net/ - copied from r188472, stable/7/ From owner-svn-src-user@FreeBSD.ORG Wed Feb 11 15:55:01 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75AD41065673; Wed, 11 Feb 2009 15:55:01 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FF9B8FC0C; Wed, 11 Feb 2009 15:55:01 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1BFt1eL029808; Wed, 11 Feb 2009 15:55:01 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1BFt1Ad029807; Wed, 11 Feb 2009 15:55:01 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200902111555.n1BFt1Ad029807@svn.freebsd.org> From: Doug Rabson Date: Wed, 11 Feb 2009 15:55:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188486 - user/dfr/xenhvm/6/sys/dev/xen/netfront X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Feb 2009 15:55:02 -0000 Author: dfr Date: Wed Feb 11 15:55:01 2009 New Revision: 188486 URL: http://svn.freebsd.org/changeset/base/188486 Log: Enable checksum offload. Modified: user/dfr/xenhvm/6/sys/dev/xen/netfront/netfront.c Modified: user/dfr/xenhvm/6/sys/dev/xen/netfront/netfront.c ============================================================================== --- user/dfr/xenhvm/6/sys/dev/xen/netfront/netfront.c Wed Feb 11 15:22:01 2009 (r188485) +++ user/dfr/xenhvm/6/sys/dev/xen/netfront/netfront.c Wed Feb 11 15:55:01 2009 (r188486) @@ -76,6 +76,8 @@ __FBSDID("$FreeBSD$"); #include "xenbus_if.h" +#define XN_CSUM_FEATURES (CSUM_TCP | CSUM_UDP) + #define GRANT_INVALID_REF 0 #define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGE_SIZE) @@ -493,11 +495,6 @@ talk_to_backend(device_t dev, struct net message = "writing feature-rx-notify"; goto abort_transaction; } - err = xenbus_printf(xbt, node, "feature-no-csum-offload", "%d", 1); - if (err) { - message = "writing feature-no-csum-offload"; - goto abort_transaction; - } err = xenbus_printf(xbt, node, "feature-sg", "%d", 1); if (err) { message = "writing feature-sg"; @@ -1366,10 +1363,10 @@ xn_start_locked(struct ifnet *ifp) mfn, GNTMAP_readonly); tx->gref = sc->grant_tx_ref[id] = ref; tx->size = new_m->m_pkthdr.len; -#if 0 - tx->flags = (skb->ip_summed == CHECKSUM_HW) ? NETTXF_csum_blank : 0; -#endif - tx->flags = 0; + if (new_m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) + tx->flags = NETTXF_csum_blank | NETTXF_data_validated; + else + tx->flags = 0; new_m->m_next = NULL; new_m->m_nextpkt = NULL; @@ -1734,11 +1731,9 @@ create_netdev(device_t dev) ifp->if_mtu = ETHERMTU; ifp->if_snd.ifq_maxlen = NET_TX_RING_SIZE - 1; -#ifdef notyet ifp->if_hwassist = XN_CSUM_FEATURES; ifp->if_capabilities = IFCAP_HWCSUM; ifp->if_capenable = ifp->if_capabilities; -#endif ether_ifattach(ifp, np->mac); callout_init(&np->xn_stat_ch, CALLOUT_MPSAFE); From owner-svn-src-user@FreeBSD.ORG Thu Feb 12 13:49:52 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6ABF6106566C; Thu, 12 Feb 2009 13:49:52 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 564B28FC0C; Thu, 12 Feb 2009 13:49:52 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1CDnqND057254; Thu, 12 Feb 2009 13:49:52 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1CDnqrJ057249; Thu, 12 Feb 2009 13:49:52 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <200902121349.n1CDnqrJ057249@svn.freebsd.org> From: Lawrence Stewart Date: Thu, 12 Feb 2009 13:49:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188513 - in user/lstewart/alq_varlen_8.x: sys/kern sys/sys tools/test tools/test/alq X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Feb 2009 13:49:52 -0000 Author: lstewart Date: Thu Feb 12 13:49:51 2009 New Revision: 188513 URL: http://svn.freebsd.org/changeset/base/188513 Log: Checkpoint commit of an alq test harness I'm working on. Added: user/lstewart/alq_varlen_8.x/tools/test/alq/ user/lstewart/alq_varlen_8.x/tools/test/alq/Makefile (contents, props changed) user/lstewart/alq_varlen_8.x/tools/test/alq/alqtest.c (contents, props changed) Modified: user/lstewart/alq_varlen_8.x/sys/kern/kern_alq.c user/lstewart/alq_varlen_8.x/sys/sys/alq.h user/lstewart/alq_varlen_8.x/tools/test/README Modified: user/lstewart/alq_varlen_8.x/sys/kern/kern_alq.c ============================================================================== --- user/lstewart/alq_varlen_8.x/sys/kern/kern_alq.c Thu Feb 12 13:04:13 2009 (r188512) +++ user/lstewart/alq_varlen_8.x/sys/kern/kern_alq.c Thu Feb 12 13:49:51 2009 (r188513) @@ -64,6 +64,7 @@ struct alq { //struct ale *aq_first; /* First ent */ //struct ale *aq_entfree; /* First free ent */ //struct ale *aq_entvalid; /* First ent valid for writing */ + void (*doio_debugcallback)(void); LIST_ENTRY(alq) aq_act; /* List of active queues */ LIST_ENTRY(alq) aq_link; /* List of all queues */ }; @@ -267,7 +268,7 @@ alq_doio(struct alq *alq) int iov; int vfslocked; - KASSERT(alq->aq_freebytes != alq->aq_buflen, + KASSERT((alq->aq_freebytes != alq->aq_buflen), ("%s: queue emtpy!", __func__) ); @@ -300,6 +301,10 @@ alq_doio(struct alq *alq) } alq->aq_flags |= AQ_FLUSHING; + + if (alq->doio_debugcallback != NULL) + alq->doio_debugcallback(); + ALQ_UNLOCK(alq); auio.uio_iov = &aiov[0]; @@ -343,6 +348,9 @@ alq_doio(struct alq *alq) if (alq->aq_freebytes == alq->aq_buflen) alq->aq_writehead = alq->aq_writetail = 0; + if (alq->doio_debugcallback != NULL) + alq->doio_debugcallback(); + if (alq->aq_flags & AQ_WANTED) { alq->aq_flags &= ~AQ_WANTED; return (1); @@ -377,8 +385,8 @@ alq_open(struct alq **alqp, const char * int error; int vfslocked; - KASSERT(size > 0, ("%s: size <= 0", __func__)); - KASSERT(count >= 0, ("%s: count < 0", __func__)); + KASSERT((size > 0), ("%s: size <= 0", __func__)); + KASSERT((count >= 0), ("%s: count < 0", __func__)); *alqp = NULL; td = curthread; @@ -419,6 +427,8 @@ alq_open(struct alq **alqp, const char * alq->aq_writehead = alq->aq_writetail = 0; + alq->doio_debugcallback = NULL; + if ((error = ald_add(alq)) != 0) return (error); *alqp = alq; @@ -434,7 +444,7 @@ int alq_write(struct alq *alq, void *data, int flags) { /* should only be called in fixed length message (legacy) mode */ - KASSERT(alq->aq_entmax > 0 && alq->aq_entlen > 0, + KASSERT((alq->aq_entmax > 0 && alq->aq_entlen > 0), ("%s: fixed length write on variable length queue", __func__) ); return (alq_writen(alq, data, alq->aq_entlen, flags)); @@ -446,7 +456,7 @@ alq_writen(struct alq *alq, void *data, int activate = 0; int copy = len; - KASSERT(len > 0 && len <= alq->aq_buflen, + KASSERT((len > 0 && len <= alq->aq_buflen), ("%s: len <= 0 || len > alq->aq_buflen", __func__) ); @@ -509,7 +519,8 @@ alq_writen(struct alq *alq, void *data, alq->aq_freebytes -= len; - if ((alq->aq_flags & AQ_ACTIVE) == 0) { + if (((alq->aq_flags & AQ_ACTIVE) == 0) && + ((flags & ALQ_NOACTIVATE) == 0)) { alq->aq_flags |= AQ_ACTIVE; activate = 1; } @@ -529,7 +540,7 @@ struct ale * alq_get(struct alq *alq, int flags) { /* should only be called in fixed length message (legacy) mode */ - KASSERT(alq->aq_entmax > 0 && alq->aq_entlen > 0, + KASSERT((alq->aq_entmax > 0 && alq->aq_entlen > 0), ("%s: fixed length get on variable length queue", __func__) ); return (alq_getn(alq, alq->aq_entlen, flags)); @@ -541,7 +552,7 @@ alq_getn(struct alq *alq, int len, int f struct ale *ale; int contigbytes; - KASSERT(len > 0 && len <= alq->aq_buflen, + KASSERT((len > 0 && len <= alq->aq_buflen), ("%s: len <= 0 || len > alq->aq_buflen", __func__) ); @@ -625,11 +636,12 @@ alq_getn(struct alq *alq, int len, int f } void -alq_post(struct alq *alq, struct ale *ale) +alq_post(struct alq *alq, struct ale *ale, int flags) { int activate; - if ((alq->aq_flags & AQ_ACTIVE) == 0) { + if (((alq->aq_flags & AQ_ACTIVE) == 0) && + ((flags & ALQ_NOACTIVATE) == 0)) { alq->aq_flags |= AQ_ACTIVE; activate = 1; } else Modified: user/lstewart/alq_varlen_8.x/sys/sys/alq.h ============================================================================== --- user/lstewart/alq_varlen_8.x/sys/sys/alq.h Thu Feb 12 13:04:13 2009 (r188512) +++ user/lstewart/alq_varlen_8.x/sys/sys/alq.h Thu Feb 12 13:49:51 2009 (r188513) @@ -52,6 +52,7 @@ struct ale { /* flags options */ #define ALQ_NOWAIT 0x0001 #define ALQ_WAITOK 0x0002 +#define ALQ_NOACTIVATE 0x0004 /* Suggested mode for file creation. */ #define ALQ_DEFAULT_CMODE 0600 @@ -124,6 +125,6 @@ struct ale *alq_getn(struct alq *alq, in * alq The queue to post the entry to. * ale An asynch logging entry returned by alq_get. */ -void alq_post(struct alq *alq, struct ale *ale); +void alq_post(struct alq *alq, struct ale *ale, int flags); #endif /* _SYS_ALQ_H_ */ Modified: user/lstewart/alq_varlen_8.x/tools/test/README ============================================================================== --- user/lstewart/alq_varlen_8.x/tools/test/README Thu Feb 12 13:04:13 2009 (r188512) +++ user/lstewart/alq_varlen_8.x/tools/test/README Thu Feb 12 13:49:51 2009 (r188513) @@ -11,3 +11,4 @@ devrandom Programs to test /dev/*random. dtrace DTrace test suite malloc A program to test and benchmark malloc(). posixshm A program to test POSIX shared memory. +alq A kernel module to put ALQ(9) through it's paces. Added: user/lstewart/alq_varlen_8.x/tools/test/alq/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/lstewart/alq_varlen_8.x/tools/test/alq/Makefile Thu Feb 12 13:49:51 2009 (r188513) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +.include + +KMOD=alqtest +SRCS=alqtest.c alqtest.h +CLEANFILES=alqtest.h + +SYSDIR=/devel/freebsd_mirror/user/lstewart/alq_varlen_8.x/sys + +alqtest.h: + @awk -F "\n" '{ if(index($$0, "struct alq {") > 0) p=1; if(p == 1) { print $$0; if($$0 == "};") exit; } }' ${.CURDIR}/../../../sys/kern/kern_alq.c >> ${.TARGET} + +.include + Added: user/lstewart/alq_varlen_8.x/tools/test/alq/alqtest.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/lstewart/alq_varlen_8.x/tools/test/alq/alqtest.c Thu Feb 12 13:49:51 2009 (r188513) @@ -0,0 +1,425 @@ +/*- + * Copyright (c) 2008 Lawrence Stewart + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "alqtest.h" + +MALLOC_DECLARE(M_ALQTEST); +MALLOC_DEFINE(M_ALQTEST, "alqtest", "dynamic memory used by alqtest"); + +#define ENABLE 0x01 +#define DISABLE 0x02 + +#define NUM_TEST_RUNS 1 + +static volatile uint8_t run_test_thread; + +static char logfile[PATH_MAX] = "/var/log/alqtest.log\0"; + +static struct thread *alq_test_thr = NULL; + +static struct mtx alqtestmtx; + +typedef int (*testfunc)(struct sbuf *, struct sbuf *); + +typedef const enum { + BLACK = 30, + RED, + GREEN, + YELLOW, + BLUE, + MAGENTA, + CYAN, + WHITE +} fgcolor_t; + +static int +sbuf_printf_color(struct sbuf *s, fgcolor_t c, const char *fmt, ...) +{ + va_list ap; + int ret; + + sbuf_printf(s, "\033[%dm", c); + va_start(ap, fmt); + ret = sbuf_vprintf(s, fmt, ap); + va_end(ap); + sbuf_printf(s, "\033[0m"); + + return (ret); +} + +static char +alqtest_randchar(void) +{ + uint32_t c; + + /* generate a random character in the ascii range [32, 126] */ + while ( (c = arc4random() % 126) < 32); + + return (char)c; +} + +static void +alqtest_doio_callback(void) +{ + printf("doing io baby!\n"); +} + +static int +alqtest_writen(struct sbuf *s, struct sbuf *debug) +{ + struct alq *testalq; + const int buflen = 100; + int i = 0, ret = 0, errors = 0; + char buf[buflen+1]; + + sbuf_printf(s, "- variable length message writing\n"); + + /* test variable length message writing */ + ret = alq_open( &testalq, + logfile, + curthread->td_ucred, + 0600, + buflen, + 0 + ); + + testalq->doio_debugcallback = &alqtest_doio_callback; + + for (i = 0; i < sizeof(buf); i++) + buf[i] = alqtest_randchar(); + + sbuf_printf(s, "-- msglen==1,buflen=%d\n", buflen); + alq_writen(testalq, buf, 1, ALQ_WAITOK | ALQ_NOACTIVATE); + + if ((buflen-1 != testalq->aq_freebytes) && + (1 != testalq->aq_writehead) && + (0 != testalq->aq_writetail)) { + errors++; + sbuf_printf( debug, + "alq->%-15s\texpected=%d\tactual=%d\n", + "aq_freebytes", + buflen-1, + testalq->aq_freebytes + ); + sbuf_printf( debug, + "alq->%-15s\texpected=%d\tactual=%d\n", + "aq_writehead", + 1, + testalq->aq_writehead + ); + sbuf_printf( debug, + "alq->%-15s\texpected=%d\tactual=%d\n", + "aq_writetail", + 0, + testalq->aq_writetail + ); + } + + sbuf_printf(s, "-- msglen==%d,buflen=%d\n", buflen, buflen); + alq_writen(testalq, buf, buflen, ALQ_WAITOK); + + if ((0 != testalq->aq_freebytes) && + (0 != testalq->aq_writehead) && + (0 != testalq->aq_writetail)) { + errors++; + sbuf_printf( debug, + "alq->%-15s\texpected=%d\tactual=%d\n", + "aq_freebytes", + 0, + testalq->aq_freebytes + ); + sbuf_printf( debug, + "alq->%-15s\texpected=%d\tactual=%d\n", + "aq_writehead", + 0, + testalq->aq_writehead + ); + sbuf_printf( debug, + "alq->%-15s\texpected=%d\tactual=%d\n", + "aq_writetail", + 0, + testalq->aq_writetail + ); + } + + alq_close(testalq); + + return errors; +} + +static int +alqtest_open(struct sbuf *s, struct sbuf *debug) +{ + struct alq *testalq; + const int buflen = 100; + int ret = 0, errors = 0; + + sbuf_printf(s, "- variable length message queue creation\n"); + + /* test variable length message queue creation */ + ret = alq_open( &testalq, + logfile, + curthread->td_ucred, + 0600, + buflen, + 0 + ); + + if (0 != testalq->aq_entmax) { + errors++; + sbuf_printf( debug, + "alq->%-15s\texpected=%d\tactual=%d\n", + "aq_entmax", + 0, + testalq->aq_entmax + ); + } + + if (0 != testalq->aq_entlen) { + errors++; + sbuf_printf( debug, + "alq->%-15s\texpected=%d\tactual=%d\n", + "aq_entlen", + 0, + testalq->aq_entlen + ); + } + + if (buflen != testalq->aq_freebytes) { + errors++; + sbuf_printf( debug, + "alq->%-15s\texpected=%d\tactual=%d\n", + "aq_freebytes", + buflen, + testalq->aq_freebytes + ); + } + + if (buflen != testalq->aq_buflen) { + errors++; + sbuf_printf( debug, + "alq->%-15s\texpected=%d\tactual=%d\n", + "aq_buflen", + buflen, + testalq->aq_buflen + ); + } + + if (0 != testalq->aq_writehead) { + errors++; + sbuf_printf( debug, + "alq->%-15s\texpected=%d\tactual=%d\n", + "aq_writehead", + 0, + testalq->aq_writehead + ); + } + + if (0 != testalq->aq_writetail) { + errors++; + sbuf_printf( debug, + "alq->%-15s\texpected=%d\tactual=%d\n", + "aq_writetail", + 0, + testalq->aq_writetail + ); + } + + if (0 != testalq->aq_flags) { + errors++; + sbuf_printf( debug, + "alq->%-15s\texpected=%d\tactual=%d\n", + "aq_flags", + 0, + testalq->aq_flags + ); + } + + alq_close(testalq); + + return errors; +} + +static void +run_test(struct sbuf *s, const char *test_banner, testfunc test) +{ + struct sbuf *debug = NULL; + + if ((debug = sbuf_new(NULL, NULL, 1024, SBUF_AUTOEXTEND)) != NULL) { + sbuf_printf(s, "########################################\n"); + sbuf_printf_color(s, GREEN, "%s\n", test_banner); + if (test(s, debug)) { + sbuf_finish(debug); + sbuf_printf_color(s, RED, "!!ERROR(S) FOUND!!\n"); + sbuf_printf(s, "%s", sbuf_data(debug)); + sbuf_printf_color(s, RED, "!!ERROR(S) FOUND!!\n"); + } + sbuf_printf(s, "########################################\n\n"); + sbuf_delete(debug); + } +} + +static void +alqtest_thread(void *arg) +{ + struct sbuf *s = NULL; + long runs = 0; + + /* loop until thread is signalled to exit */ + while (run_test_thread && runs < NUM_TEST_RUNS) { + if ((s = sbuf_new(NULL, NULL, 1024, SBUF_AUTOEXTEND)) != NULL) { + sbuf_printf(s, "TEST RUN: %ld\n", ++runs); + + run_test(s, "alq_open", &alqtest_open); + run_test(s, "alq_writen", &alqtest_writen); + + sbuf_finish(s); + printf("%s", sbuf_data(s)); + sbuf_delete(s); + } + } + + kthread_exit(); +} + +static int +manage_test_ops(uint8_t action) +{ + int error = 0; + //struct sbuf *s = NULL; + + /* init an autosizing sbuf that initially holds 200 chars */ + //if ((s = sbuf_new(NULL, NULL, 200, SBUF_AUTOEXTEND)) == NULL) + // return -1; + + if (action == ENABLE) { + + run_test_thread = 1; + + kthread_add( &alqtest_thread, + NULL, + NULL, + &alq_test_thr, + RFNOWAIT, + 0, + "alq_test_thr" + ); + } + else if (action == DISABLE && alq_test_thr != NULL) { + /* tell the test thread that it should exit now */ + run_test_thread = 0; + alq_test_thr = NULL; + } + + return error; +} + +static int +deinit(void) +{ + manage_test_ops(DISABLE); + mtx_destroy(&alqtestmtx); + return 0; +} + +static int +init(void) +{ + mtx_init(&alqtestmtx, "alqtestmtx", NULL, MTX_DEF); + manage_test_ops(ENABLE); + return 0; +} + +/* + * This is the function that is called to load and unload the module. + * When the module is loaded, this function is called once with + * "what" == MOD_LOAD + * When the module is unloaded, this function is called twice with + * "what" = MOD_QUIESCE first, followed by "what" = MOD_UNLOAD second + * When the system is shut down e.g. CTRL-ALT-DEL or using the shutdown command, + * this function is called once with "what" = MOD_SHUTDOWN + * When the system is shut down, the handler isn't called until the very end + * of the shutdown sequence i.e. after the disks have been synced. + */ +static int alqtest_load_handler(module_t mod, int what, void *arg) +{ + switch(what) { + case MOD_LOAD: + return init(); + break; + + case MOD_QUIESCE: + case MOD_SHUTDOWN: + return deinit(); + break; + + case MOD_UNLOAD: + return 0; + break; + + default: + return EINVAL; + break; + } +} + +/* basic module data */ +static moduledata_t alqtest_mod = +{ + "alqtest", + alqtest_load_handler, /* execution entry point for the module */ + NULL +}; + +/* + * Param 1: name of the kernel module + * Param 2: moduledata_t struct containing info about the kernel module + * and the execution entry point for the module + * Param 3: From sysinit_sub_id enumeration in /usr/include/sys/kernel.h + * Defines the module initialisation order + * Param 4: From sysinit_elem_order enumeration in /usr/include/sys/kernel.h + * Defines the initialisation order of this kld relative to others + * within the same subsystem as defined by param 3 + */ +DECLARE_MODULE(alqtest, alqtest_mod, SI_SUB_SMP, SI_ORDER_ANY); +MODULE_DEPEND(alqtest, alq, 1, 1, 1); + + From owner-svn-src-user@FreeBSD.ORG Fri Feb 13 12:07:45 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4BEB1065703; Fri, 13 Feb 2009 12:07:45 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 80E268FC1D; Fri, 13 Feb 2009 12:07:45 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1DC7j63088196; Fri, 13 Feb 2009 12:07:45 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1DC7jPx088195; Fri, 13 Feb 2009 12:07:45 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200902131207.n1DC7jPx088195@svn.freebsd.org> From: Doug Rabson Date: Fri, 13 Feb 2009 12:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188573 - user/dfr/xenhvm/7 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Feb 2009 12:07:56 -0000 Author: dfr Date: Fri Feb 13 12:07:45 2009 New Revision: 188573 URL: http://svn.freebsd.org/changeset/base/188573 Log: Make a place for porting the Xen HVM support to 7.x. Added: user/dfr/xenhvm/7/ - copied from r188572, projects/releng_7_xen/