From owner-svn-src-user@FreeBSD.ORG Fri Sep 9 09:39:27 2011 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 4BEAC106566B; Fri, 9 Sep 2011 09:39:27 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 389C28FC16; Fri, 9 Sep 2011 09:39:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p899dRc0030816; Fri, 9 Sep 2011 09:39:27 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p899dQrP030779; Fri, 9 Sep 2011 09:39:26 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201109090939.p899dQrP030779@svn.freebsd.org> From: Attilio Rao Date: Fri, 9 Sep 2011 09:39:26 +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: r225459 - in user/attilio/vmcontention: contrib/top crypto/openssl/ssl etc sbin/geom/class/part share/mk sys/conf sys/dev/ath sys/dev/ath/ath_hal sys/dev/ath/ath_hal/ar5210 sys/dev/ath/... 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, 09 Sep 2011 09:39:27 -0000 Author: attilio Date: Fri Sep 9 09:39:26 2011 New Revision: 225459 URL: http://svn.freebsd.org/changeset/base/225459 Log: MFC Modified: user/attilio/vmcontention/crypto/openssl/ssl/s3_lib.c user/attilio/vmcontention/crypto/openssl/ssl/s3_srvr.c user/attilio/vmcontention/etc/pf.os user/attilio/vmcontention/sbin/geom/class/part/geom_part.c user/attilio/vmcontention/sys/conf/NOTES user/attilio/vmcontention/sys/conf/options user/attilio/vmcontention/sys/dev/ath/ath_hal/ah.c user/attilio/vmcontention/sys/dev/ath/ath_hal/ah.h user/attilio/vmcontention/sys/dev/ath/ath_hal/ah_internal.h user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5210/ar5210.h user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5210/ar5210_beacon.c user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5211/ar5211.h user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5211/ar5211_beacon.c user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5212/ar5212.h user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416.h user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416reg.h user/attilio/vmcontention/sys/dev/ath/if_ath.c user/attilio/vmcontention/sys/dev/ath/if_athvar.h user/attilio/vmcontention/sys/dev/mfi/mfi.c user/attilio/vmcontention/sys/dev/vge/if_vge.c user/attilio/vmcontention/sys/dev/vge/if_vgereg.h user/attilio/vmcontention/sys/kern/kern_rctl.c user/attilio/vmcontention/sys/kern/kern_shutdown.c user/attilio/vmcontention/sys/kern/vfs_bio.c user/attilio/vmcontention/sys/sys/buf.h user/attilio/vmcontention/usr.sbin/bsdinstall/scripts/netconfig user/attilio/vmcontention/usr.sbin/bsdinstall/scripts/netconfig_ipv4 user/attilio/vmcontention/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/contrib/bind9/ (props changed) user/attilio/vmcontention/contrib/binutils/ (props changed) user/attilio/vmcontention/contrib/bzip2/ (props changed) user/attilio/vmcontention/contrib/compiler-rt/ (props changed) user/attilio/vmcontention/contrib/dialog/ (props changed) user/attilio/vmcontention/contrib/ee/ (props changed) user/attilio/vmcontention/contrib/expat/ (props changed) user/attilio/vmcontention/contrib/file/ (props changed) user/attilio/vmcontention/contrib/gcc/ (props changed) user/attilio/vmcontention/contrib/gdb/ (props changed) user/attilio/vmcontention/contrib/gdtoa/ (props changed) user/attilio/vmcontention/contrib/gnu-sort/ (props changed) user/attilio/vmcontention/contrib/groff/ (props changed) user/attilio/vmcontention/contrib/less/ (props changed) user/attilio/vmcontention/contrib/libpcap/ (props changed) user/attilio/vmcontention/contrib/libstdc++/ (props changed) user/attilio/vmcontention/contrib/llvm/ (props changed) user/attilio/vmcontention/contrib/llvm/tools/clang/ (props changed) user/attilio/vmcontention/contrib/ncurses/ (props changed) user/attilio/vmcontention/contrib/netcat/ (props changed) user/attilio/vmcontention/contrib/ntp/ (props changed) user/attilio/vmcontention/contrib/one-true-awk/ (props changed) user/attilio/vmcontention/contrib/openbsm/ (props changed) user/attilio/vmcontention/contrib/openpam/ (props changed) user/attilio/vmcontention/contrib/pf/ (props changed) user/attilio/vmcontention/contrib/sendmail/ (props changed) user/attilio/vmcontention/contrib/tcpdump/ (props changed) user/attilio/vmcontention/contrib/tcsh/ (props changed) user/attilio/vmcontention/contrib/tnftp/ (props changed) user/attilio/vmcontention/contrib/top/ (props changed) user/attilio/vmcontention/contrib/top/install-sh (props changed) user/attilio/vmcontention/contrib/tzcode/stdtime/ (props changed) user/attilio/vmcontention/contrib/tzcode/zic/ (props changed) user/attilio/vmcontention/contrib/tzdata/ (props changed) user/attilio/vmcontention/contrib/wpa/ (props changed) user/attilio/vmcontention/contrib/xz/ (props changed) user/attilio/vmcontention/crypto/openssh/ (props changed) user/attilio/vmcontention/crypto/openssl/ (props changed) user/attilio/vmcontention/gnu/lib/ (props changed) user/attilio/vmcontention/gnu/usr.bin/binutils/ (props changed) user/attilio/vmcontention/gnu/usr.bin/cc/cc_tools/ (props changed) user/attilio/vmcontention/gnu/usr.bin/gdb/ (props changed) user/attilio/vmcontention/lib/libc/ (props changed) user/attilio/vmcontention/lib/libc/stdtime/ (props changed) user/attilio/vmcontention/lib/libutil/ (props changed) user/attilio/vmcontention/lib/libz/ (props changed) user/attilio/vmcontention/sbin/ (props changed) user/attilio/vmcontention/sbin/ipfw/ (props changed) user/attilio/vmcontention/share/mk/bsd.arch.inc.mk (props changed) user/attilio/vmcontention/share/zoneinfo/ (props changed) user/attilio/vmcontention/sys/ (props changed) user/attilio/vmcontention/sys/amd64/include/xen/ (props changed) user/attilio/vmcontention/sys/boot/ (props changed) user/attilio/vmcontention/sys/boot/i386/efi/ (props changed) user/attilio/vmcontention/sys/boot/ia64/efi/ (props changed) user/attilio/vmcontention/sys/boot/ia64/ski/ (props changed) user/attilio/vmcontention/sys/boot/powerpc/boot1.chrp/ (props changed) user/attilio/vmcontention/sys/boot/powerpc/ofw/ (props changed) user/attilio/vmcontention/sys/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/sys/conf/ (props changed) user/attilio/vmcontention/sys/contrib/dev/acpica/ (props changed) user/attilio/vmcontention/sys/contrib/octeon-sdk/ (props changed) user/attilio/vmcontention/sys/contrib/pf/ (props changed) user/attilio/vmcontention/sys/contrib/x86emu/ (props changed) user/attilio/vmcontention/usr.bin/calendar/ (props changed) user/attilio/vmcontention/usr.bin/csup/ (props changed) user/attilio/vmcontention/usr.bin/procstat/ (props changed) user/attilio/vmcontention/usr.sbin/ndiscvt/ (props changed) user/attilio/vmcontention/usr.sbin/rtadvctl/ (props changed) user/attilio/vmcontention/usr.sbin/rtadvd/ (props changed) user/attilio/vmcontention/usr.sbin/zic/ (props changed) Modified: user/attilio/vmcontention/crypto/openssl/ssl/s3_lib.c ============================================================================== --- user/attilio/vmcontention/crypto/openssl/ssl/s3_lib.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/crypto/openssl/ssl/s3_lib.c Fri Sep 9 09:39:26 2011 (r225459) @@ -1722,11 +1722,17 @@ void ssl3_clear(SSL *s) } #ifndef OPENSSL_NO_DH if (s->s3->tmp.dh != NULL) + { DH_free(s->s3->tmp.dh); + s->s3->tmp.dh = NULL; + } #endif #ifndef OPENSSL_NO_ECDH if (s->s3->tmp.ecdh != NULL) + { EC_KEY_free(s->s3->tmp.ecdh); + s->s3->tmp.ecdh = NULL; + } #endif rp = s->s3->rbuf.buf; Modified: user/attilio/vmcontention/crypto/openssl/ssl/s3_srvr.c ============================================================================== --- user/attilio/vmcontention/crypto/openssl/ssl/s3_srvr.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/crypto/openssl/ssl/s3_srvr.c Fri Sep 9 09:39:26 2011 (r225459) @@ -710,9 +710,7 @@ int ssl3_check_client_hello(SSL *s) if (s->s3->tmp.message_type == SSL3_MT_CLIENT_HELLO) { /* Throw away what we have done so far in the current handshake, - * which will now be aborted. (A full SSL_clear would be too much.) - * I hope that tmp.dh is the only thing that may need to be cleared - * when a handshake is not completed ... */ + * which will now be aborted. (A full SSL_clear would be too much.) */ #ifndef OPENSSL_NO_DH if (s->s3->tmp.dh != NULL) { @@ -720,6 +718,13 @@ int ssl3_check_client_hello(SSL *s) s->s3->tmp.dh = NULL; } #endif +#ifndef OPENSSL_NO_ECDH + if (s->s3->tmp.ecdh != NULL) + { + EC_KEY_free(s->s3->tmp.ecdh); + s->s3->tmp.ecdh = NULL; + } +#endif return 2; } return 1; @@ -1329,7 +1334,6 @@ int ssl3_send_server_key_exchange(SSL *s if (s->s3->tmp.dh != NULL) { - DH_free(dh); SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } @@ -1390,7 +1394,6 @@ int ssl3_send_server_key_exchange(SSL *s if (s->s3->tmp.ecdh != NULL) { - EC_KEY_free(s->s3->tmp.ecdh); SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } @@ -1401,12 +1404,11 @@ int ssl3_send_server_key_exchange(SSL *s SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,ERR_R_ECDH_LIB); goto err; } - if (!EC_KEY_up_ref(ecdhp)) + if ((ecdh = EC_KEY_dup(ecdhp)) == NULL) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,ERR_R_ECDH_LIB); goto err; } - ecdh = ecdhp; s->s3->tmp.ecdh=ecdh; if ((EC_KEY_get0_public_key(ecdh) == NULL) || @@ -2262,6 +2264,12 @@ int ssl3_get_client_key_exchange(SSL *s) /* Get encoded point length */ i = *p; p += 1; + if (n != 1 + i) + { + SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, + ERR_R_EC_LIB); + goto err; + } if (EC_POINT_oct2point(group, clnt_ecpoint, p, i, bn_ctx) == 0) { Modified: user/attilio/vmcontention/etc/pf.os ============================================================================== --- user/attilio/vmcontention/etc/pf.os Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/etc/pf.os Fri Sep 9 09:39:26 2011 (r225459) @@ -1,5 +1,5 @@ # $FreeBSD$ -# $OpenBSD: pf.os,v 1.21 2006/07/28 21:51:12 david Exp $ +# $OpenBSD: pf.os,v 1.25 2010/10/18 15:55:27 deraadt Exp $ # passive OS fingerprinting # ------------------------- # @@ -299,13 +299,16 @@ S22:64:1:52:M*,N,N,S,N,W0: Linux:2.2:ts: # ----------------- OpenBSD ----------------- 16384:64:0:60:M*,N,W0,N,N,T: OpenBSD:2.6::NetBSD 1.3 (or OpenBSD 2.6) -16384:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.0::OpenBSD 3.0-4.0 -16384:64:0:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.0:no-df:OpenBSD 3.0-4.0 (scrub no-df) +16384:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.8::OpenBSD 3.0-4.8 +16384:64:0:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.8:no-df:OpenBSD 3.0-4.8 (scrub no-df) 57344:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.3-4.0::OpenBSD 3.3-4.0 57344:64:0:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.3-4.0:no-df:OpenBSD 3.3-4.0 (scrub no-df) 65535:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.0:opera:OpenBSD 3.0-4.0 (Opera) +16384:64:1:64:M*,N,N,S,N,W3,N,N,T: OpenBSD:4.9::OpenBSD 4.9 +16384:64:0:64:M*,N,N,S,N,W3,N,N,T: OpenBSD:4.9:no-df:OpenBSD 4.9 (scrub no-df) + # ----------------- Solaris ----------------- S17:64:1:64:N,W3,N,N,T0,N,N,S,M*: Solaris:8:RFC1323:Solaris 8 RFC1323 @@ -362,7 +365,7 @@ S34:64:1:52:M*,N,W0,N,N,S: Solaris:10:b # ----------------- Windows ----------------- # Windows TCP/IP stack is a mess. For most recent XP, 2000 and -# even 98, the pathlevel, not the actual OS version, is more +# even 98, the patchlevel, not the actual OS version, is more # relevant to the signature. They share the same code, so it would # seem. Luckily for us, almost all Windows 9x boxes have an # awkward MSS of 536, which I use to tell one from another Modified: user/attilio/vmcontention/sbin/geom/class/part/geom_part.c ============================================================================== --- user/attilio/vmcontention/sbin/geom/class/part/geom_part.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sbin/geom/class/part/geom_part.c Fri Sep 9 09:39:26 2011 (r225459) @@ -308,7 +308,7 @@ gpart_autofill_resize(struct gctl_req *r off_t last, size, start, new_size; off_t lba, new_lba, alignment, offset; const char *s; - int error, idx; + int error, idx, has_alignment; idx = (int)gctl_get_intmax(req, GPART_PARAM_INDEX); if (idx < 1) @@ -334,8 +334,9 @@ gpart_autofill_resize(struct gctl_req *r errx(EXIT_FAILURE, "Provider for geom %s not found.", s); s = gctl_get_ascii(req, "alignment"); + has_alignment = (*s == '*') ? 0 : 1; alignment = 1; - if (*s != '*') { + if (has_alignment) { error = g_parse_lba(s, pp->lg_sectorsize, &alignment); if (error) errc(EXIT_FAILURE, error, "Invalid alignment param"); @@ -358,7 +359,7 @@ gpart_autofill_resize(struct gctl_req *r if (error) errc(EXIT_FAILURE, error, "Invalid size param"); /* no autofill necessary. */ - if (alignment == 1) + if (has_alignment == 0) goto done; } @@ -380,7 +381,8 @@ gpart_autofill_resize(struct gctl_req *r lba = (off_t)strtoimax(s, NULL, 0); size = lba - start + 1; - if (new_size > 0 && new_size <= size) { + pp = find_provider(gp, lba + 1); + if (new_size > 0 && (new_size <= size || pp == NULL)) { /* The start offset may be not aligned, so we align the end * offset and then calculate the size. */ @@ -388,8 +390,6 @@ gpart_autofill_resize(struct gctl_req *r alignment) - start - offset; goto done; } - - pp = find_provider(gp, lba + 1); if (pp == NULL) { new_size = ALIGNDOWN(last + offset + 1, alignment) - start - offset; Modified: user/attilio/vmcontention/sys/conf/NOTES ============================================================================== --- user/attilio/vmcontention/sys/conf/NOTES Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/conf/NOTES Fri Sep 9 09:39:26 2011 (r225459) @@ -2929,7 +2929,6 @@ options SCSI_NCR_MYADDR=7 options SC_DEBUG_LEVEL=5 # Syscons debug level options SC_RENDER_DEBUG # syscons rendering debugging -options SHOW_BUSYBUFS # List buffers that prevent root unmount options VFS_BIO_DEBUG # VFS buffer I/O debugging options KSTACK_MAX_PAGES=32 # Maximum pages to give the kernel stack Modified: user/attilio/vmcontention/sys/conf/options ============================================================================== --- user/attilio/vmcontention/sys/conf/options Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/conf/options Fri Sep 9 09:39:26 2011 (r225459) @@ -156,7 +156,6 @@ QUOTA SCHED_4BSD opt_sched.h SCHED_STATS opt_sched.h SCHED_ULE opt_sched.h -SHOW_BUSYBUFS SLEEPQUEUE_PROFILING SLHCI_DEBUG opt_slhci.h SPX_HACK Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ah.c ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ah.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ah.c Fri Sep 9 09:39:26 2011 (r225459) @@ -657,6 +657,8 @@ ath_hal_getcapability(struct ath_hal *ah } case HAL_CAP_RXDESC_SELFLINK: /* hardware supports self-linked final RX descriptors correctly */ return pCap->halHasRxSelfLinkedTail ? HAL_OK : HAL_ENOTSUPP; + case HAL_CAP_LONG_RXDESC_TSF: /* 32 bit TSF in RX descriptor? */ + return pCap->halHasLongRxDescTsf ? HAL_OK : HAL_ENOTSUPP; default: return HAL_EINVAL; } @@ -1222,3 +1224,37 @@ ath_ee_interpolate(uint16_t target, uint } return rv; } + +/* + * Adjust the TSF. + */ +void +ath_hal_adjusttsf(struct ath_hal *ah, int32_t tsfdelta) +{ + /* XXX handle wrap/overflow */ + OS_REG_WRITE(ah, AR_TSF_L32, OS_REG_READ(ah, AR_TSF_L32) + tsfdelta); +} + +/* + * Enable or disable CCA. + */ +void +ath_hal_setcca(struct ath_hal *ah, int ena) +{ + /* + * NB: fill me in; this is not provided by default because disabling + * CCA in most locales violates regulatory. + */ +} + +/* + * Get CCA setting. + */ +int +ath_hal_getcca(struct ath_hal *ah) +{ + u_int32_t diag; + if (ath_hal_getcapability(ah, HAL_CAP_DIAG, 0, &diag) != HAL_OK) + return 1; + return ((diag & 0x500000) == 0); +} Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ah.h ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ah.h Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ah.h Fri Sep 9 09:39:26 2011 (r225459) @@ -148,6 +148,7 @@ typedef enum { HAL_CAP_BSSIDMATCH = 238, /* hardware has disable bssid match */ HAL_CAP_STREAMS = 239, /* how many 802.11n spatial streams are available */ HAL_CAP_RXDESC_SELFLINK = 242, /* support a self-linked tail RX descriptor */ + HAL_CAP_LONG_RXDESC_TSF = 243, /* hardware supports 32bit TSF in RX descriptor */ } HAL_CAPABILITY_TYPE; /* @@ -996,6 +997,7 @@ struct ath_hal { void __ahdecl(*ah_setStationBeaconTimers)(struct ath_hal*, const HAL_BEACON_STATE *); void __ahdecl(*ah_resetStationBeaconTimers)(struct ath_hal*); + uint64_t __ahdecl(*ah_getNextTBTT)(struct ath_hal *); /* 802.11n Functions */ HAL_BOOL __ahdecl(*ah_chainTxDesc)(struct ath_hal *, @@ -1138,4 +1140,20 @@ extern uint32_t __ahdecl ath_computedur_ extern uint16_t __ahdecl ath_hal_computetxtime(struct ath_hal *, const HAL_RATE_TABLE *rates, uint32_t frameLen, uint16_t rateix, HAL_BOOL shortPreamble); + +/* + * Adjust the TSF. + */ +extern void __ahdecl ath_hal_adjusttsf(struct ath_hal *ah, int32_t tsfdelta); + +/* + * Enable or disable CCA. + */ +void __ahdecl ath_hal_setcca(struct ath_hal *ah, int ena); + +/* + * Get CCA setting. + */ +int __ahdecl ath_hal_getcca(struct ath_hal *ah); + #endif /* _ATH_AH_H_ */ Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ah_internal.h Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ah_internal.h Fri Sep 9 09:39:26 2011 (r225459) @@ -208,7 +208,8 @@ typedef struct { halBssidMatchSupport : 1, hal4kbSplitTransSupport : 1, halHasRxSelfLinkedTail : 1, - halSupportsFastClock5GHz : 1; /* Hardware supports 5ghz fast clock; check eeprom/channel before using */ + halSupportsFastClock5GHz : 1, /* Hardware supports 5ghz fast clock; check eeprom/channel before using */ + halHasLongRxDescTsf : 1; uint32_t halWirelessModes; uint16_t halTotalQueues; uint16_t halKeyCacheSize; Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5210/ar5210.h ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5210/ar5210.h Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5210/ar5210.h Fri Sep 9 09:39:26 2011 (r225459) @@ -268,6 +268,7 @@ extern void ar5210BeaconInit(struct ath_ extern void ar5210SetStaBeaconTimers(struct ath_hal *, const HAL_BEACON_STATE *); extern void ar5210ResetStaBeaconTimers(struct ath_hal *); +extern uint64_t ar5210GetNextTBTT(struct ath_hal *); extern HAL_BOOL ar5210IsInterruptPending(struct ath_hal *); extern HAL_BOOL ar5210GetPendingInterrupts(struct ath_hal *, HAL_INT *); Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Fri Sep 9 09:39:26 2011 (r225459) @@ -148,6 +148,7 @@ static const struct ath_hal_private ar52 .ah_beaconInit = ar5210BeaconInit, .ah_setStationBeaconTimers = ar5210SetStaBeaconTimers, .ah_resetStationBeaconTimers = ar5210ResetStaBeaconTimers, + .ah_getNextTBTT = ar5210GetNextTBTT, /* Interrupt Functions */ .ah_isInterruptPending = ar5210IsInterruptPending, Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5210/ar5210_beacon.c ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5210/ar5210_beacon.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5210/ar5210_beacon.c Fri Sep 9 09:39:26 2011 (r225459) @@ -27,6 +27,17 @@ #include "ar5210/ar5210desc.h" /* + * Return the hardware NextTBTT in TSF + */ +uint64_t +ar5210GetNextTBTT(struct ath_hal *ah) +{ +#define TU_TO_TSF(_tu) (((uint64_t)(_tu)) << 10) + return TU_TO_TSF(OS_REG_READ(ah, AR_TIMER0)); +#undef TU_TO_TSF +} + +/* * Initialize all of the hardware registers used to send beacons. */ void Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5211/ar5211.h ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5211/ar5211.h Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5211/ar5211.h Fri Sep 9 09:39:26 2011 (r225459) @@ -296,6 +296,7 @@ extern void ar5211BeaconInit(struct ath_ extern void ar5211SetStaBeaconTimers(struct ath_hal *, const HAL_BEACON_STATE *); extern void ar5211ResetStaBeaconTimers(struct ath_hal *); +extern uint64_t ar5211GetNextTBTT(struct ath_hal *); extern HAL_BOOL ar5211IsInterruptPending(struct ath_hal *); extern HAL_BOOL ar5211GetPendingInterrupts(struct ath_hal *, HAL_INT *); Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c Fri Sep 9 09:39:26 2011 (r225459) @@ -148,6 +148,7 @@ static const struct ath_hal_private ar52 .ah_beaconInit = ar5211BeaconInit, .ah_setStationBeaconTimers = ar5211SetStaBeaconTimers, .ah_resetStationBeaconTimers = ar5211ResetStaBeaconTimers, + .ah_getNextTBTT = ar5211GetNextTBTT, /* Interrupt Functions */ .ah_isInterruptPending = ar5211IsInterruptPending, Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5211/ar5211_beacon.c ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5211/ar5211_beacon.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5211/ar5211_beacon.c Fri Sep 9 09:39:26 2011 (r225459) @@ -30,6 +30,17 @@ */ /* + * Return the hardware NextTBTT in TSF + */ +uint64_t +ar5211GetNextTBTT(struct ath_hal *ah) +{ +#define TU_TO_TSF(_tu) (((uint64_t)(_tu)) << 10) + return TU_TO_TSF(OS_REG_READ(ah, AR_TIMER0)); +#undef TU_TO_TSF +} + +/* * Initialize all of the hardware registers used to send beacons. */ void Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5212/ar5212.h ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5212/ar5212.h Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5212/ar5212.h Fri Sep 9 09:39:26 2011 (r225459) @@ -430,6 +430,7 @@ extern void ar5212BeaconInit(struct ath_ extern void ar5212ResetStaBeaconTimers(struct ath_hal *ah); extern void ar5212SetStaBeaconTimers(struct ath_hal *ah, const HAL_BEACON_STATE *); +extern uint64_t ar5212GetNextTBTT(struct ath_hal *); extern HAL_BOOL ar5212IsInterruptPending(struct ath_hal *ah); extern HAL_BOOL ar5212GetPendingInterrupts(struct ath_hal *ah, HAL_INT *); Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Fri Sep 9 09:39:26 2011 (r225459) @@ -151,6 +151,7 @@ static const struct ath_hal_private ar52 .ah_beaconInit = ar5212BeaconInit, .ah_setStationBeaconTimers = ar5212SetStaBeaconTimers, .ah_resetStationBeaconTimers = ar5212ResetStaBeaconTimers, + .ah_getNextTBTT = ar5212GetNextTBTT, /* Interrupt Functions */ .ah_isInterruptPending = ar5212IsInterruptPending, Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c Fri Sep 9 09:39:26 2011 (r225459) @@ -26,6 +26,17 @@ #include "ar5212/ar5212desc.h" /* + * Return the hardware NextTBTT in TSF + */ +uint64_t +ar5212GetNextTBTT(struct ath_hal *ah) +{ +#define TU_TO_TSF(_tu) (((uint64_t)(_tu)) << 10) + return TU_TO_TSF(OS_REG_READ(ah, AR_TIMER0)); +#undef TU_TO_TSF +} + +/* * Initialize all of the hardware registers used to * send beacons. Note that for station operation the * driver calls ar5212SetStaBeaconTimers instead. Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416.h Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416.h Fri Sep 9 09:39:26 2011 (r225459) @@ -169,6 +169,7 @@ extern void ar5416BeaconInit(struct ath_ extern void ar5416ResetStaBeaconTimers(struct ath_hal *ah); extern void ar5416SetStaBeaconTimers(struct ath_hal *ah, const HAL_BEACON_STATE *); +extern uint64_t ar5416GetNextTBTT(struct ath_hal *); extern HAL_BOOL ar5416EepromRead(struct ath_hal *, u_int off, uint16_t *data); extern HAL_BOOL ar5416EepromWrite(struct ath_hal *, u_int off, uint16_t data); @@ -186,6 +187,8 @@ extern void ar5416GpioSetIntr(struct ath extern u_int ar5416GetWirelessModes(struct ath_hal *ah); extern void ar5416SetLedState(struct ath_hal *ah, HAL_LED_STATE state); +extern uint64_t ar5416GetTsf64(struct ath_hal *ah); +extern void ar5416SetTsf64(struct ath_hal *ah, uint64_t tsf64); extern void ar5416ResetTsf(struct ath_hal *ah); extern HAL_BOOL ar5416SetAntennaSwitch(struct ath_hal *, HAL_ANT_SETTING); extern HAL_BOOL ar5416SetDecompMask(struct ath_hal *, uint16_t, int); Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Fri Sep 9 09:39:26 2011 (r225459) @@ -136,6 +136,7 @@ ar5416InitState(struct ath_hal_5416 *ahp ah->ah_gpioGet = ar5416GpioGet; ah->ah_gpioSet = ar5416GpioSet; ah->ah_gpioSetIntr = ar5416GpioSetIntr; + ah->ah_getTsf64 = ar5416GetTsf64; ah->ah_resetTsf = ar5416ResetTsf; ah->ah_getRfGain = ar5416GetRfgain; ah->ah_setAntennaSwitch = ar5416SetAntennaSwitch; @@ -160,6 +161,7 @@ ar5416InitState(struct ath_hal_5416 *ahp ah->ah_beaconInit = ar5416BeaconInit; ah->ah_setStationBeaconTimers = ar5416SetStaBeaconTimers; ah->ah_resetStationBeaconTimers = ar5416ResetStaBeaconTimers; + ah->ah_getNextTBTT = ar5416GetNextTBTT; /* 802.11n Functions */ ah->ah_chainTxDesc = ar5416ChainTxDesc; @@ -888,6 +890,8 @@ ar5416FillCapabilityInfo(struct ath_hal pCap->halGTTSupport = AH_TRUE; pCap->halCSTSupport = AH_TRUE; pCap->halEnhancedDfsSupport = AH_FALSE; + /* Hardware supports 32 bit TSF values in the RX descriptor */ + pCap->halHasLongRxDescTsf = AH_TRUE; if (ath_hal_eepromGetFlag(ah, AR_EEP_RFKILL) && ath_hal_eepromGet(ah, AR_EEP_RFSILENT, &ahpriv->ah_rfsilent) == HAL_OK) { Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c Fri Sep 9 09:39:26 2011 (r225459) @@ -29,6 +29,15 @@ #define ONE_EIGHTH_TU_TO_USEC(_tu8) ((_tu8) << 7) /* + * Return the hardware NextTBTT in TSF + */ +uint64_t +ar5416GetNextTBTT(struct ath_hal *ah) +{ + return OS_REG_READ(ah, AR_NEXT_TBTT); +} + +/* * Initialize all of the hardware registers used to * send beacons. Note that for station operation the * driver calls ar5416SetStaBeaconTimers instead. Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Fri Sep 9 09:39:26 2011 (r225459) @@ -93,6 +93,41 @@ ar5416SetLedState(struct ath_hal *ah, HA } /* + * Get the current hardware tsf for stamlme + */ +uint64_t +ar5416GetTsf64(struct ath_hal *ah) +{ + uint32_t low1, low2, u32; + + /* sync multi-word read */ + low1 = OS_REG_READ(ah, AR_TSF_L32); + u32 = OS_REG_READ(ah, AR_TSF_U32); + low2 = OS_REG_READ(ah, AR_TSF_L32); + if (low2 < low1) { /* roll over */ + /* + * If we are not preempted this will work. If we are + * then we re-reading AR_TSF_U32 does no good as the + * low bits will be meaningless. Likewise reading + * L32, U32, U32, then comparing the last two reads + * to check for rollover doesn't help if preempted--so + * we take this approach as it costs one less PCI read + * which can be noticeable when doing things like + * timestamping packets in monitor mode. + */ + u32++; + } + return (((uint64_t) u32) << 32) | ((uint64_t) low2); +} + +void +ar5416SetTsf64(struct ath_hal *ah, uint64_t tsf64) +{ + OS_REG_WRITE(ah, AR_TSF_L32, tsf64 & 0xffffffff); + OS_REG_WRITE(ah, AR_TSF_U32, (tsf64 >> 32) & 0xffffffff); +} + +/* * Reset the current hardware tsf for stamlme. */ void Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Fri Sep 9 09:39:26 2011 (r225459) @@ -147,7 +147,7 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO /* For chips on which the RTC reset is done, save TSF before it gets cleared */ if (AR_SREV_HOWL(ah) || (AR_SREV_MERLIN(ah) && ath_hal_eepromGetFlag(ah, AR_EEP_OL_PWRCTRL))) - tsf = ar5212GetTsf64(ah); + tsf = ar5416GetTsf64(ah); /* Mark PHY as inactive; marked active in ar5416InitBB() */ ar5416MarkPhyInactive(ah); @@ -159,7 +159,7 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO /* Restore TSF */ if (tsf) - ar5212SetTsf64(ah, tsf); + ar5416SetTsf64(ah, tsf); OS_MARK(ah, AH_MARK_RESET_LINE, __LINE__); if (AR_SREV_MERLIN_10_OR_LATER(ah)) @@ -192,9 +192,9 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO * value after the initvals have been applied, with an offset * based on measured time difference */ - if (AR_SREV_HOWL(ah) && (ar5212GetTsf64(ah) < tsf)) { + if (AR_SREV_HOWL(ah) && (ar5416GetTsf64(ah) < tsf)) { tsf += 1500; - ar5212SetTsf64(ah, tsf); + ar5416SetTsf64(ah, tsf); } HALDEBUG(ah, HAL_DEBUG_RESET, ">>>2 %s: AR_PHY_DAG_CTRLCCK=0x%x\n", @@ -364,8 +364,7 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO OS_REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_FIRST, 2000); OS_REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_LAST, 300); OS_REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_FIRST, 750); -#endif - +#endif ar5416InitBB(ah, chan); /* Setup compression registers */ @@ -503,7 +502,7 @@ ar5416ChannelChange(struct ath_hal *ah, chan->ic_state &= ~IEEE80211_CHANSTATE_CWINT; ichan->channel_time = 0; - ichan->tsf_last = ar5212GetTsf64(ah); + ichan->tsf_last = ar5416GetTsf64(ah); ar5212TxEnable(ah, AH_TRUE); return AH_TRUE; } Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416reg.h ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Fri Sep 9 09:39:26 2011 (r225459) @@ -40,6 +40,7 @@ #define AR_INTR_ASYNC_MASK 0x4030 /* asynchronous interrupt mask */ #define AR_INTR_SYNC_MASK 0x4034 /* synchronous interrupt mask */ #define AR_INTR_ASYNC_CAUSE 0x4038 /* check pending interrupts */ +#define AR_INTR_ASYNC_CAUSE_CLR 0x4038 /* clear pending interrupts */ #define AR_INTR_ASYNC_ENABLE 0x403c /* enable interrupts */ #define AR5416_PCIE_SERDES 0x4040 #define AR5416_PCIE_SERDES2 0x4044 Modified: user/attilio/vmcontention/sys/dev/ath/if_ath.c ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/if_ath.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/if_ath.c Fri Sep 9 09:39:26 2011 (r225459) @@ -214,24 +214,6 @@ static void ath_tdma_update(struct ieee8 static void ath_tdma_beacon_send(struct ath_softc *sc, struct ieee80211vap *vap); -static __inline void -ath_hal_setcca(struct ath_hal *ah, int ena) -{ - /* - * NB: fill me in; this is not provided by default because disabling - * CCA in most locales violates regulatory. - */ -} - -static __inline int -ath_hal_getcca(struct ath_hal *ah) -{ - u_int32_t diag; - if (ath_hal_getcapability(ah, HAL_CAP_DIAG, 0, &diag) != HAL_OK) - return 1; - return ((diag & 0x500000) == 0); -} - #define TDMA_EP_MULTIPLIER (1<<10) /* pow2 to optimize out * and / */ #define TDMA_LPF_LEN 6 #define TDMA_DUMMY_MARKER 0x127 @@ -613,6 +595,7 @@ ath_attach(u_int16_t devid, struct ath_s sc->sc_hasbmatch = ath_hal_hasbssidmatch(ah); sc->sc_hastsfadd = ath_hal_hastsfadjust(ah); sc->sc_rxslink = ath_hal_self_linked_final_rxdesc(ah); + sc->sc_rxtsf32 = ath_hal_has_long_rxdesc_tsf(ah); if (ath_hal_hasfastframes(ah)) ic->ic_caps |= IEEE80211_C_FF; wmodes = ath_hal_getwirelessmodes(ah); @@ -3294,14 +3277,49 @@ ath_rxbuf_init(struct ath_softc *sc, str * a full 64-bit TSF using the specified TSF. */ static __inline u_int64_t -ath_extend_tsf(u_int32_t rstamp, u_int64_t tsf) +ath_extend_tsf15(u_int32_t rstamp, u_int64_t tsf) { if ((tsf & 0x7fff) < rstamp) tsf -= 0x8000; + return ((tsf &~ 0x7fff) | rstamp); } /* + * Extend 32-bit time stamp from rx descriptor to + * a full 64-bit TSF using the specified TSF. + */ +static __inline u_int64_t +ath_extend_tsf32(u_int32_t rstamp, u_int64_t tsf) +{ + u_int32_t tsf_low = tsf & 0xffffffff; + u_int64_t tsf64 = (tsf & ~0xffffffffULL) | rstamp; + + if (rstamp > tsf_low && (rstamp - tsf_low > 0x10000000)) + tsf64 -= 0x100000000ULL; + + if (rstamp < tsf_low && (tsf_low - rstamp > 0x10000000)) + tsf64 += 0x100000000ULL; + + return tsf64; +} + +/* + * Extend the TSF from the RX descriptor to a full 64 bit TSF. + * Earlier hardware versions only wrote the low 15 bits of the + * TSF into the RX descriptor; later versions (AR5416 and up) + * include the 32 bit TSF value. + */ +static __inline u_int64_t +ath_extend_tsf(struct ath_softc *sc, u_int32_t rstamp, u_int64_t tsf) +{ + if (sc->sc_rxtsf32) + return ath_extend_tsf32(rstamp, tsf); + else + return ath_extend_tsf15(rstamp, tsf); +} + +/* * Intercept management frames to collect beacon rssi data * and to do ibss merges. */ @@ -3334,7 +3352,7 @@ ath_recv_mgmt(struct ieee80211_node *ni, if (vap->iv_opmode == IEEE80211_M_IBSS && vap->iv_state == IEEE80211_S_RUN) { uint32_t rstamp = sc->sc_lastrs->rs_tstamp; - uint64_t tsf = ath_extend_tsf(rstamp, + uint64_t tsf = ath_extend_tsf(sc, rstamp, ath_hal_gettsf64(sc->sc_ah)); /* * Handle ibss merge as needed; check the tsf on the @@ -3406,7 +3424,7 @@ ath_rx_tap(struct ifnet *ifp, struct mbu sc->sc_rx_th.wr_flags |= IEEE80211_RADIOTAP_F_SHORTGI; } #endif - sc->sc_rx_th.wr_tsf = htole64(ath_extend_tsf(rs->rs_tstamp, tsf)); + sc->sc_rx_th.wr_tsf = htole64(ath_extend_tsf(sc, rs->rs_tstamp, tsf)); if (rs->rs_status & HAL_RXERR_CRC) sc->sc_rx_th.wr_flags |= IEEE80211_RADIOTAP_F_BADFCS; /* XXX propagate other error flags from descriptor */ @@ -5460,20 +5478,6 @@ ath_announce(struct ath_softc *sc) } #ifdef IEEE80211_SUPPORT_TDMA -static __inline uint32_t -ath_hal_getnexttbtt(struct ath_hal *ah) -{ -#define AR_TIMER0 0x8028 - return OS_REG_READ(ah, AR_TIMER0); -} - -static __inline void -ath_hal_adjusttsf(struct ath_hal *ah, int32_t tsfdelta) -{ - /* XXX handle wrap/overflow */ - OS_REG_WRITE(ah, AR_TSF_L32, OS_REG_READ(ah, AR_TSF_L32) + tsfdelta); -} - static void ath_tdma_settimers(struct ath_softc *sc, u_int32_t nexttbtt, u_int32_t bintval) { @@ -5629,8 +5633,8 @@ ath_tdma_update(struct ieee80211_node *n struct ath_softc *sc = ic->ic_ifp->if_softc; struct ath_hal *ah = sc->sc_ah; const HAL_RATE_TABLE *rt = sc->sc_currates; - u_int64_t tsf, rstamp, nextslot; - u_int32_t txtime, nextslottu, timer0; + u_int64_t tsf, rstamp, nextslot, nexttbtt; + u_int32_t txtime, nextslottu; int32_t tudelta, tsfdelta; const struct ath_rx_status *rs; int rix; @@ -5661,7 +5665,7 @@ ath_tdma_update(struct ieee80211_node *n /* extend rx timestamp to 64 bits */ rs = sc->sc_lastrs; tsf = ath_hal_gettsf64(ah); - rstamp = ath_extend_tsf(rs->rs_tstamp, tsf); + rstamp = ath_extend_tsf(sc, rs->rs_tstamp, tsf); /* * The rx timestamp is set by the hardware on completing * reception (at the point where the rx descriptor is DMA'd @@ -5677,15 +5681,15 @@ ath_tdma_update(struct ieee80211_node *n nextslottu = TSF_TO_TU(nextslot>>32, nextslot) & HAL_BEACON_PERIOD; /* - * TIMER0 is the h/w's idea of NextTBTT (in TU's). Convert - * to usecs and calculate the difference between what the + * Retrieve the hardware NextTBTT in usecs + * and calculate the difference between what the * other station thinks and what we have programmed. This * lets us figure how to adjust our timers to match. The * adjustments are done by pulling the TSF forward and possibly * rewriting the beacon timers. */ - timer0 = ath_hal_getnexttbtt(ah); - tsfdelta = (int32_t)((nextslot % TU_TO_TSF(HAL_BEACON_PERIOD+1)) - TU_TO_TSF(timer0)); + nexttbtt = ath_hal_getnexttbtt(ah); + tsfdelta = (int32_t)((nextslot % TU_TO_TSF(HAL_BEACON_PERIOD + 1)) - nexttbtt); DPRINTF(sc, ATH_DEBUG_TDMA_TIMER, "tsfdelta %d avg +%d/-%d\n", tsfdelta, @@ -5705,7 +5709,7 @@ ath_tdma_update(struct ieee80211_node *n TDMA_SAMPLE(sc->sc_avgtsfdeltap, 0); TDMA_SAMPLE(sc->sc_avgtsfdeltam, 0); } - tudelta = nextslottu - timer0; + tudelta = nextslottu - TSF_TO_TU(nexttbtt >> 32, nexttbtt); /* * Copy sender's timetstamp into tdma ie so they can @@ -5724,10 +5728,9 @@ ath_tdma_update(struct ieee80211_node *n &ni->ni_tstamp.data, 8); #if 0 DPRINTF(sc, ATH_DEBUG_TDMA_TIMER, - "tsf %llu nextslot %llu (%d, %d) nextslottu %u timer0 %u (%d)\n", + "tsf %llu nextslot %llu (%d, %d) nextslottu %u nexttbtt %llu (%d)\n", (unsigned long long) tsf, (unsigned long long) nextslot, - (int)(nextslot - tsf), tsfdelta, - nextslottu, timer0, tudelta); + (int)(nextslot - tsf), tsfdelta, nextslottu, nexttbtt, tudelta); #endif /* * Adjust the beacon timers only when pulling them forward Modified: user/attilio/vmcontention/sys/dev/ath/if_athvar.h ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/if_athvar.h Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/ath/if_athvar.h Fri Sep 9 09:39:26 2011 (r225459) @@ -255,7 +255,8 @@ struct ath_softc { sc_setcca : 1,/* set/clr CCA with TDMA */ sc_resetcal : 1,/* reset cal state next trip */ sc_rxslink : 1,/* do self-linked final descriptor */ - sc_kickpcu : 1;/* kick PCU RX on next RX proc */ + sc_kickpcu : 1,/* kick PCU RX on next RX proc */ + sc_rxtsf32 : 1;/* RX dec TSF is 32 bits */ uint32_t sc_eerd; /* regdomain from EEPROM */ uint32_t sc_eecc; /* country code from EEPROM */ /* rate tables */ @@ -482,6 +483,8 @@ void ath_intr(void *); ((*(_ah)->ah_setBeaconTimers)((_ah), (_bt))) #define ath_hal_beacontimers(_ah, _bs) \ ((*(_ah)->ah_setStationBeaconTimers)((_ah), (_bs))) +#define ath_hal_getnexttbtt(_ah) \ + ((*(_ah)->ah_getNextTBTT)((_ah))) #define ath_hal_setassocid(_ah, _bss, _associd) \ ((*(_ah)->ah_writeAssocid)((_ah), (_bss), (_associd))) #define ath_hal_phydisable(_ah) \ @@ -657,6 +660,8 @@ void ath_intr(void *); (ath_hal_getcapability(_ah, HAL_CAP_RXDESC_SELFLINK, 0, NULL) == HAL_OK) #define ath_hal_gtxto_supported(_ah) \ (ath_hal_getcapability(_ah, HAL_CAP_GTXTO, 0, NULL) == HAL_OK) +#define ath_hal_has_long_rxdesc_tsf(_ah) \ + (ath_hal_getcapability(_ah, HAL_CAP_LONG_RXDESC_TSF, 0, NULL) == HAL_OK) #define ath_hal_setuprxdesc(_ah, _ds, _size, _intreq) \ ((*(_ah)->ah_setupRxDesc)((_ah), (_ds), (_size), (_intreq))) Modified: user/attilio/vmcontention/sys/dev/mfi/mfi.c ============================================================================== --- user/attilio/vmcontention/sys/dev/mfi/mfi.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/mfi/mfi.c Fri Sep 9 09:39:26 2011 (r225459) @@ -2132,8 +2132,7 @@ mfi_ioctl(struct cdev *dev, u_long cmd, if (ioc->mfi_sense_len) { /* get user-space sense ptr then copy out sense */ - bcopy(&((struct mfi_ioc_packet*)arg) - ->mfi_frame.raw[ioc->mfi_sense_off], + bcopy(&ioc->mfi_frame.raw[ioc->mfi_sense_off], &sense_ptr.sense_ptr_data[0], sizeof(sense_ptr.sense_ptr_data)); #ifdef __amd64__ Modified: user/attilio/vmcontention/sys/dev/vge/if_vge.c ============================================================================== --- user/attilio/vmcontention/sys/dev/vge/if_vge.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/vge/if_vge.c Fri Sep 9 09:39:26 2011 (r225459) @@ -1752,6 +1752,10 @@ vge_intr(void *arg) #ifdef DEVICE_POLLING if (ifp->if_capenable & IFCAP_POLLING) { + status = CSR_READ_4(sc, VGE_ISR); + CSR_WRITE_4(sc, VGE_ISR, status); + if (status != 0xFFFFFFFF && (status & VGE_ISR_LINKSTS) != 0) + vge_link_statchg(sc); VGE_UNLOCK(sc); return; } @@ -2109,11 +2113,10 @@ vge_init_locked(struct vge_softc *sc) #ifdef DEVICE_POLLING /* - * Disable interrupts if we are polling. + * Disable interrupts except link state change if we are polling. */ if (ifp->if_capenable & IFCAP_POLLING) { - CSR_WRITE_4(sc, VGE_IMR, 0); - CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK); + CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS_POLLING); } else /* otherwise ... */ #endif { @@ -2121,9 +2124,9 @@ vge_init_locked(struct vge_softc *sc) * Enable interrupts. */ CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS); - CSR_WRITE_4(sc, VGE_ISR, 0xFFFFFFFF); - CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); } + CSR_WRITE_4(sc, VGE_ISR, 0xFFFFFFFF); + CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); sc->vge_flags &= ~VGE_FLAG_LINK; mii_mediachg(mii); @@ -2280,8 +2283,9 @@ vge_ioctl(struct ifnet *ifp, u_long comm return (error); VGE_LOCK(sc); /* Disable interrupts */ - CSR_WRITE_4(sc, VGE_IMR, 0); - CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK); + CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS_POLLING); + CSR_WRITE_4(sc, VGE_ISR, 0xFFFFFFFF); + CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); ifp->if_capenable |= IFCAP_POLLING; VGE_UNLOCK(sc); } else { Modified: user/attilio/vmcontention/sys/dev/vge/if_vgereg.h ============================================================================== --- user/attilio/vmcontention/sys/dev/vge/if_vgereg.h Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/dev/vge/if_vgereg.h Fri Sep 9 09:39:26 2011 (r225459) @@ -302,6 +302,8 @@ VGE_ISR_LINKSTS|VGE_ISR_RXNODESC| \ VGE_ISR_RXDMA_STALL|VGE_ISR_TXDMA_STALL) +#define VGE_INTRS_POLLING (VGE_ISR_PHYINT|VGE_ISR_LINKSTS) + /* Interrupt mask register */ #define VGE_IMR_RXOK_HIPRIO 0x00000001 /* hi prio RX int */ Modified: user/attilio/vmcontention/sys/kern/kern_rctl.c ============================================================================== --- user/attilio/vmcontention/sys/kern/kern_rctl.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/kern/kern_rctl.c Fri Sep 9 09:39:26 2011 (r225459) @@ -363,6 +363,17 @@ rctl_enforce(struct proc *p, int resourc rule->rr_action)); /* + * We're supposed to send a signal, but the process + * is not fully initialized yet, probably because we + * got called from fork1(). For now just deny the + * allocation instead. + */ + if (p->p_state != PRS_NORMAL) { + should_deny = 1; + continue; + } + + /* * We're using the fact that RCTL_ACTION_SIG* values * are equal to their counterparts from sys/signal.h. */ Modified: user/attilio/vmcontention/sys/kern/kern_shutdown.c ============================================================================== --- user/attilio/vmcontention/sys/kern/kern_shutdown.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/kern/kern_shutdown.c Fri Sep 9 09:39:26 2011 (r225459) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" #include "opt_kdb.h" #include "opt_panic.h" -#include "opt_show_busybufs.h" #include "opt_sched.h" #include "opt_watchdog.h" @@ -66,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef SW_WATCHDOG #include #endif @@ -123,6 +123,14 @@ TUNABLE_INT("kern.sync_on_panic", &sync_ SYSCTL_NODE(_kern, OID_AUTO, shutdown, CTLFLAG_RW, 0, "Shutdown environment"); +#ifndef DIAGNOSTIC +static int show_busybufs; +#else +static int show_busybufs = 1; +#endif +SYSCTL_INT(_kern_shutdown, OID_AUTO, show_busybufs, CTLFLAG_RW, + &show_busybufs, 0, ""); + /* * Variable panicstr contains argument to first call to panic; used as flag * to indicate that the kernel has already called panic. @@ -389,13 +397,17 @@ kern_reboot(int howto) } #endif nbusy++; -#if defined(SHOW_BUSYBUFS) || defined(DIAGNOSTIC) - printf( - "%d: bufobj:%p, flags:%0x, blkno:%ld, lblkno:%ld\n", - nbusy, bp->b_bufobj, - bp->b_flags, (long)bp->b_blkno, - (long)bp->b_lblkno); -#endif + if (show_busybufs > 0) { + printf( + "%d: buf:%p, vnode:%p, flags:%0x, blkno:%jd, lblkno:%jd, buflock:", + nbusy, bp, bp->b_vp, bp->b_flags, + (intmax_t)bp->b_blkno, + (intmax_t)bp->b_lblkno); + BUF_LOCKPRINTINFO(bp); + if (show_busybufs > 1) + vn_printf(bp->b_vp, + "vnode content: "); + } } } if (nbusy) { Modified: user/attilio/vmcontention/sys/kern/vfs_bio.c ============================================================================== --- user/attilio/vmcontention/sys/kern/vfs_bio.c Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/kern/vfs_bio.c Fri Sep 9 09:39:26 2011 (r225459) @@ -4020,7 +4020,7 @@ DB_SHOW_COMMAND(buffer, db_show_buffer) db_printf("\n"); } db_printf(" "); - lockmgr_printinfo(&bp->b_lock); + BUF_LOCKPRINTINFO(bp); } DB_SHOW_COMMAND(lockedbufs, lockedbufs) Modified: user/attilio/vmcontention/sys/sys/buf.h ============================================================================== --- user/attilio/vmcontention/sys/sys/buf.h Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/sys/sys/buf.h Fri Sep 9 09:39:26 2011 (r225459) @@ -311,6 +311,12 @@ extern const char *buf_wmesg; /* Defaul lockdestroy(&(bp)->b_lock) /* + * Print informations on a buffer lock. + */ +#define BUF_LOCKPRINTINFO(bp) \ + lockmgr_printinfo(&(bp)->b_lock) + +/* * Buffer lock assertions. */ #if defined(INVARIANTS) && defined(INVARIANT_SUPPORT) Modified: user/attilio/vmcontention/usr.sbin/bsdinstall/scripts/netconfig ============================================================================== --- user/attilio/vmcontention/usr.sbin/bsdinstall/scripts/netconfig Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/usr.sbin/bsdinstall/scripts/netconfig Fri Sep 9 09:39:26 2011 (r225459) @@ -165,7 +165,7 @@ fi exec 3>&1 RESOLV=$(echo "${RESOLV}" | xargs dialog --backtitle 'FreeBSD Installer' \ --title 'Network Configuration' \ - --mixedform 'Resovler Configuration' 0 0 0 \ + --mixedform 'Resolver Configuration' 0 0 0 \ 2>&1 1>&3) if [ $? -eq $DIALOG_CANCEL ]; then exec $0; fi exec 3>&- Modified: user/attilio/vmcontention/usr.sbin/bsdinstall/scripts/netconfig_ipv4 ============================================================================== --- user/attilio/vmcontention/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Fri Sep 9 07:44:14 2011 (r225458) +++ user/attilio/vmcontention/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Fri Sep 9 09:39:26 2011 (r225459) @@ -79,7 +79,9 @@ echo $INTERFACE $IF_CONFIG | if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then . $BSDINSTALL_TMPETC/._rc.conf.net ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE` - route delete -inet default - route add -inet default $defaultrouter *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***