svn commit: r223222 - head/usr.bin/users
Author: ed Date: Sat Jun 18 07:47:15 2011 New Revision: 223222 URL: http://svn.freebsd.org/changeset/base/223222 Log: Let the size of the namebuf depend on the size of the ut_user field. Modified: head/usr.bin/users/users.c Modified: head/usr.bin/users/users.c == --- head/usr.bin/users/users.c Sat Jun 18 05:13:48 2011(r223221) +++ head/usr.bin/users/users.c Sat Jun 18 07:47:15 2011(r223222) @@ -50,7 +50,7 @@ static const char rcsid[] = #include unistd.h #include utmpx.h -typedef char namebuf[MAXLOGNAME]; +typedef char namebuf[sizeof(((struct utmpx *)0)-ut_user) + 1]; int scmp(const void *, const void *); static void usage(void); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223223 - head/sys/net
Author: bz Date: Sat Jun 18 09:34:03 2011 New Revision: 223223 URL: http://svn.freebsd.org/changeset/base/223223 Log: gre(4) was using a field in the softc to detect possible recursion. On MP systems this is not a usable solution anymore and could easily lead to false positives triggering enough logging that even using the console was no longer usable (multiple parallel ping -f can do). Switch to the suggested solution of using mbuf tags to carry per packet state between gre_output() invocations. Contrary to the proposed solution modelled after gif(4) only allocate one mbuf tag per packet rather than per packet and per gre_output() pass through. As the sysctl to control the possible valid (gre in gre) nestings does no sanity checks, make sure to always allocate space in the mbuf tag for at least one, and at most 255 possible gre interfaces to detect loops in addition to the counter. Submitted by: Cristian KLEIN (cristi net.utcluj.ro) (original version) PR: kern/114714 Reviewed by: Cristian KLEIN (cristi net.utcluj.ro) Reviewed bu: Wooseog Choi (ben_choi hotmail.com) Sponsored by: Sandvine Incorporated MFC after:1 week Modified: head/sys/net/if_gre.c head/sys/net/if_gre.h Modified: head/sys/net/if_gre.c == --- head/sys/net/if_gre.c Sat Jun 18 07:47:15 2011(r223222) +++ head/sys/net/if_gre.c Sat Jun 18 09:34:03 2011(r223223) @@ -48,6 +48,7 @@ #include sys/param.h #include sys/jail.h #include sys/kernel.h +#include sys/libkern.h #include sys/malloc.h #include sys/module.h #include sys/mbuf.h @@ -91,6 +92,14 @@ #define GRENAMEgre +#defineMTAG_COOKIE_GRE 1307983903 +#defineMTAG_GRE_NESTING1 +struct mtag_gre_nesting { + uint16_tcount; + uint16_tmax; + struct ifnet*ifp[]; +}; + /* * gre_mtx protects all global variables in if_gre.c. * XXX: gre_softc data not protected yet. @@ -196,7 +205,6 @@ gre_clone_create(ifc, unit, params) sc-g_proto = IPPROTO_GRE; GRE2IFP(sc)-if_flags |= IFF_LINK0; sc-encap = NULL; - sc-called = 0; sc-gre_fibnum = curthread-td_proc-p_fibnum; sc-wccp_ver = WCCP_V1; sc-key = 0; @@ -240,23 +248,77 @@ gre_output(struct ifnet *ifp, struct mbu struct gre_softc *sc = ifp-if_softc; struct greip *gh; struct ip *ip; + struct m_tag *mtag; + struct mtag_gre_nesting *gt; + size_t len; u_short gre_ip_id = 0; uint8_t gre_ip_tos = 0; u_int16_t etype = 0; struct mobile_h mob_h; u_int32_t af; - int extra = 0; + int extra = 0, max; /* -* gre may cause infinite recursion calls when misconfigured. -* We'll prevent this by introducing upper limit. +* gre may cause infinite recursion calls when misconfigured. High +* nesting level may cause stack exhaustion. We'll prevent this by +* detecting loops and by introducing upper limit. */ - if (++(sc-called) max_gre_nesting) { - printf(%s: gre_output: recursively called too many - times(%d)\n, if_name(GRE2IFP(sc)), sc-called); - m_freem(m); - error = EIO;/* is there better errno? */ - goto end; + mtag = m_tag_locate(m, MTAG_COOKIE_GRE, MTAG_GRE_NESTING, NULL); + if (mtag != NULL) { + struct ifnet **ifp2; + + gt = (struct mtag_gre_nesting *)(mtag + 1); + gt-count++; + if (gt-count min(gt-max,max_gre_nesting)) { + printf(%s: hit maximum recursion limit %u on %s\n, + __func__, gt-count - 1, ifp-if_xname); + m_freem(m); + error = EIO;/* is there better errno? */ + goto end; + } + + ifp2 = gt-ifp; + for (max = gt-count - 1; max 0; max--) { + if (*ifp2 == ifp) + break; + ifp2++; + } + if (*ifp2 == ifp) { + printf(%s: detected loop with nexting %u on %s\n, + __func__, gt-count-1, ifp-if_xname); + m_freem(m); + error = EIO;/* is there better errno? */ + goto end; + } + *ifp2 = ifp; + + } else { + /* +* Given that people should NOT increase max_gre_nesting beyond +* their real needs, we allocate once per packet rather than +* allocating an mtag once per passing through gre. +* +* Note: the sysctl does not actually check for saneness, so we +
svn commit: r223224 - head/usr.sbin/jls
Author: bz Date: Sat Jun 18 09:46:39 2011 New Revision: 223224 URL: http://svn.freebsd.org/changeset/base/223224 Log: Add a missing ',' to separate arguments lost for r222465 only found in case a complete world is built without INET support. MFC after:10 days X-MFC with: 222465 Modified: head/usr.sbin/jls/jls.c Modified: head/usr.sbin/jls/jls.c == --- head/usr.sbin/jls/jls.c Sat Jun 18 09:34:03 2011(r223223) +++ head/usr.sbin/jls/jls.c Sat Jun 18 09:46:39 2011(r223224) @@ -404,7 +404,7 @@ print_jail(int pflags, int jflags) (!ip4_ok || params[1].jp_valuelen == 0) ? - : inet_ntoa(*(struct in_addr *)params[1].jp_value), #else - - + -, #endif (char *)params[2-!ip4_ok].jp_value, (char *)params[3-!ip4_ok].jp_value); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223225 - head/lib/libc/net
Author: tuexen Date: Sat Jun 18 10:36:05 2011 New Revision: 223225 URL: http://svn.freebsd.org/changeset/base/223225 Log: Document the latest changes to sctp_opt_info() in the code. This makes sctp_opt_info() compiliant with the latest version of the socket API ID. Modified: head/lib/libc/net/sctp_opt_info.3 Modified: head/lib/libc/net/sctp_opt_info.3 == --- head/lib/libc/net/sctp_opt_info.3 Sat Jun 18 09:46:39 2011 (r223224) +++ head/lib/libc/net/sctp_opt_info.3 Sat Jun 18 10:36:05 2011 (r223225) @@ -32,7 +32,7 @@ .\ From: @(#)send.2 8.2 (Berkeley) 2/21/94 .\ $FreeBSD$ .\ -.Dd December 15, 2006 +.Dd June 18, 2011 .Dt SCTP_OPT_INFO 3 .Os .Sh NAME @@ -76,14 +76,30 @@ socket options. .Pp .Dv SCTP_PRIMARY_ADDR .Pp -.Dv SCTP_SET_PEER_PRIMARY_ADDR +.Dv SCTP_PEER_ADDR_PARAMS .Pp -.Dv SCTP_STATUS +.Dv SCTP_DEFAULT_SEND_PARAM .Pp -.Dv SCTP_GET_PEER_ADDR_INFO +.Dv SCTP_MAX_SEG .Pp .Dv SCTP_AUTH_ACTIVE_KEY .Pp +.Dv SCTP_DELAYED_SACK +.Pp +.Dv SCTP_MAX_BURST +.Pp +.Dv SCTP_CONTEXT +.Pp +.Dv SCTP_EVENT +.Pp +.Dv SCTP_DEFAULT_SNDINFO +.Pp +.Dv SCTP_DEFAULT_PRINFO +.Pp +.Dv SCTP_STATUS +.Pp +.Dv SCTP_GET_PEER_ADDR_INFO +.Pp .Dv SCTP_PEER_AUTH_CHUNKS .Pp .Dv SCTP_LOCAL_AUTH_CHUNKS @@ -115,3 +131,14 @@ is not a socket. .Sh SEE ALSO .Xr getsockopt 2 , .Xr sctp 4 +.Sh BUGS +Because the structure used for +.Fa arg +of the +.Dv SCTP_MAX_BURST +socket option has changed in FreeBSD 9.0 and higher, +using +.Dv SCTP_MAX_BURST +as +.Fa opt +is only supported in FreeBSD 9.0 and higher. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223226 - head
Author: marius Date: Sat Jun 18 10:48:00 2011 New Revision: 223226 URL: http://svn.freebsd.org/changeset/base/223226 Log: Add an entry for r221407 forgotten in said revision. Modified: head/UPDATING Modified: head/UPDATING == --- head/UPDATING Sat Jun 18 10:36:05 2011(r223225) +++ head/UPDATING Sat Jun 18 10:48:00 2011(r223226) @@ -52,6 +52,18 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9. 20110513: Support for sun4v architecture is officially dropped +20110503: + Several KPI breaking changes have been committed to the mii(4) layer, + the PHY drivers and consequently some Ethernet drivers using mii(4). + This means that miibus.ko and the modules of the affected Ethernet + drivers need to be recompiled. + + Note to kernel developers: Given that the OUI bit reversion problem + was fixed as part of these changes all mii(4) commits related to OUIs, + i.e. to sys/dev/mii/miidevs, PHY driver probing and vendor specific + handling, no longer can be merged verbatim to stable/8 and previous + branches. + 20110430: Users of the Atheros AR71xx SoC code now need to add 'device ar71xx_pci' into their kernel configurations along with 'device pci'. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223227 - head/etc
Author: jilles Date: Sat Jun 18 11:05:30 2011 New Revision: 223227 URL: http://svn.freebsd.org/changeset/base/223227 Log: rc.subr: Eliminate about 100 forks from the boot sequence. With the current sh, placing eval in a command substitution always results in a fork(), even if it is the only command and only executes a single simple command. Therefore, avoid it where it can be avoided easily. Side effect: values starting with a hyphen and all whitespace are preserved. The values are defaults and names for rc.conf variables and messages to be given about obsolete ones. MFC after:2 weeks Modified: head/etc/rc.subr Modified: head/etc/rc.subr == --- head/etc/rc.subrSat Jun 18 10:48:00 2011(r223226) +++ head/etc/rc.subrSat Jun 18 11:05:30 2011(r223227) @@ -1062,7 +1062,7 @@ load_rc_config() # Set defaults if defined. for _var in $rcvar $rcvars; do - _defval=`eval echo \\\$${_var}_defval` + eval _defval=\$${_var}_defval if [ -n $_defval ]; then eval : \${$_var:=\$${_var}_defval} fi @@ -1070,9 +1070,9 @@ load_rc_config() # check obsolete rc.conf variables for _var in $rcvars_obsolete; do - _v=`eval echo \\$$_var` - _msg=`eval echo \\$${_var}_obsolete_msg` - _new=`eval echo \\$${_var}_newvar` + eval _v=\$$_var + eval _msg=\$${_var}_obsolete_msg + eval _new=\$${_var}_newvar case $_v in ) ;; @@ -1765,7 +1765,7 @@ check_kern_features() _echoonce() { local _var _msg _mode - _var=`eval echo \\$$1` + eval _var=\$$1 _msg=$2 _mode=$3 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223228 - in head/lib/libthr/arch/sparc64: . include sparc64
Author: marius Date: Sat Jun 18 11:07:09 2011 New Revision: 223228 URL: http://svn.freebsd.org/changeset/base/223228 Log: Merge from r161730: o Set TP using inline assembly to avoid dead code elimination. o Eliminate _tcb. Merge from r161840: Stylize: avoid using a global register variable. Merge from r157461: Simplify _get_curthread() and _tcb_ctor because libc and rtld now already allocate thread pointer space in tls block for initial thread. Merge from r177853: Replace function _umtx_op with _umtx_op_err, the later function directly returns errno, because errno can be mucked by user's signal handler and most of pthread api heavily depends on errno to be correct, this change should improve stability of the thread library. MFC after:1 week Added: head/lib/libthr/arch/sparc64/sparc64/_umtx_op_err.S (contents, props changed) Modified: head/lib/libthr/arch/sparc64/Makefile.inc head/lib/libthr/arch/sparc64/include/pthread_md.h head/lib/libthr/arch/sparc64/sparc64/pthread_md.c Modified: head/lib/libthr/arch/sparc64/Makefile.inc == --- head/lib/libthr/arch/sparc64/Makefile.inc Sat Jun 18 11:05:30 2011 (r223227) +++ head/lib/libthr/arch/sparc64/Makefile.inc Sat Jun 18 11:07:09 2011 (r223228) @@ -1,3 +1,3 @@ # $FreeBSD$ -SRCS+= pthread_md.c +SRCS+= _umtx_op_err.S pthread_md.c Modified: head/lib/libthr/arch/sparc64/include/pthread_md.h == --- head/lib/libthr/arch/sparc64/include/pthread_md.h Sat Jun 18 11:05:30 2011(r223227) +++ head/lib/libthr/arch/sparc64/include/pthread_md.h Sat Jun 18 11:07:09 2011(r223228) @@ -50,10 +50,6 @@ struct tcb { void*tcb_spare[1]; }; -register struct tcb *_tp __asm(%g7); - -#define _tcb (_tp) - /* * The tcb constructors. */ @@ -64,26 +60,25 @@ void_tcb_dtor(struct tcb *); static __inline void _tcb_set(struct tcb *tcb) { - _tp = tcb; + + __asm __volatile(mov %0, %%g7 : : r (tcb)); } -/* - * Get the current tcb. - */ static __inline struct tcb * _tcb_get(void) { - return (_tcb); -} + register struct tcb *tp __asm(%g7); -extern struct pthread *_thr_initial; + return (tp); +} static __inline struct pthread * _get_curthread(void) { - if (_thr_initial) - return (_tcb-tcb_thread); - return (NULL); + + return (_tcb_get()-tcb_thread); } +#define HAS__UMTX_OP_ERR 1 + #endif /* _PTHREAD_MD_H_ */ Added: head/lib/libthr/arch/sparc64/sparc64/_umtx_op_err.S == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libthr/arch/sparc64/sparc64/_umtx_op_err.S Sat Jun 18 11:07:09 2011(r223228) @@ -0,0 +1,38 @@ +/*- + * Copyright (c) 2011 Marius Strobl mar...@freebsd.org + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include machine/asm.h +__FBSDID($FreeBSD$); + +#include sys/syscall.h + +#include machine/utrap.h + +ENTRY(_umtx_op_err) + mov SYS__umtx_op, %g1 + retl +ta %xcc, ST_SYSCALL +END(_umtx_op_err) Modified: head/lib/libthr/arch/sparc64/sparc64/pthread_md.c == --- head/lib/libthr/arch/sparc64/sparc64/pthread_md.c Sat Jun 18 11:05:30 2011(r223227) +++ head/lib/libthr/arch/sparc64/sparc64/pthread_md.c Sat Jun 18 11:07:09 2011(r223228) @@ -24,10 +24,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE
Re: svn commit: r223211 - head/sys/x86/x86
On Fri, 17 Jun 2011, Jung-uk Kim wrote: Log: Teach the compiler how to shift TSC value efficiently. As noted in r220631, some times compiler inserts redundant instructions to preserve unused upper 32 bits even when it is casted to a 32-bit value. Unfortunately, it seems the problem becomes more serious when it is shifted, especially on amd64. Er, I tried to point out how to optimize this code before (but didn't reply to your reply), and it's not by using more asm. Modified: head/sys/x86/x86/tsc.c == --- head/sys/x86/x86/tsc.c Fri Jun 17 21:31:13 2011(r223210) +++ head/sys/x86/x86/tsc.c Fri Jun 17 21:41:06 2011(r223211) @@ -461,7 +461,7 @@ init_TSC_tc(void) tsc_timecounter.tc_quality = 1000; init: - for (shift = 0; shift 32 (tsc_freq shift) max_freq; shift++) + for (shift = 0; shift 31 (tsc_freq shift) max_freq; shift++) ; if (shift 0) { tsc_timecounter.tc_get_timecount = tsc_get_timecount_low; shift == 32 (or even shift == 31) is unreachable. A shift of 31 will shift 2GHz down to 1 Hz, or support physically impossible frequencies like 2**33 GHz. OTOH, shifts of up to 63 are supported by the slow gcc code. @@ -579,6 +579,9 @@ tsc_get_timecount(struct timecounter *tc static u_int tsc_get_timecount_low(struct timecounter *tc) { + uint32_t rv; - return (rdtsc() (int)(intptr_t)tc-tc_priv); + __asm __volatile(rdtsc; shrd %%cl, %%edx, %0 + : =a (rv) : c ((int)(intptr_t)tc-tc_priv) : edx); Lexical style bug (indentation of second line of the asm). + return (rv); } Just return the shift of the low 32 bits (and change tc_counter_mask to match) like I said. This loses only the accidental ability for the timecounter to work for more than a few seconds when interrupts are stopped by something like ddb, since any shift count that loses too many of the low 32 bits will not work for other reasons. For example, suppose that the TSC frequency is 8G-1Hz, which is unavailable except possible in research labs. This must be shifted by 1 to fit in 32 bits. If we use only the low 32 bits, then we end up with only 31 significant bits and tsc_get_timecount_low() wraps after ~2 seconds instead of after the best possible for this shift of ~4 seconds. If we shift by 7 more, as we do in the SMP case, then if we start with 32 bits then we end up with 24 bits, but the wrap still takes 2 seconds; if we start with 64 bits then we end up with 32 bits and the wrap takes 4*2**7 = 512 seconds. But wrap times longer than 1/HZ times a few are not needed. 2 seconds is already at least 100 or 1000 times longer than needed, depending on HZ. The case where the unscaled frequency is 4G-1Hz and !SMP gives a shift count of 0 and a wrap time of ~4 seconds. Whatever is done to make that case work (say, not allowing a fully tickless kernel with HZ = 0), works almost as well up to an unscaled frequency of 8GHz which is still far off. No one will notice these micro-optimizations, but I agree that the redundant instructions are ugly. I get the following on i386 for the original version with an old source tree: % #APP % rdtsc % #NO_APP % movl8(%ebp), %ecx % movl28(%ecx), %ecx % shrdl %edx, %eax % shrl%cl, %edx % testb $32, %cl % je .L3 % movl%edx, %eax % xorl%edx, %edx % .L3: The last 4 instructions are not redundant, but are needed to support shifts of up to 63 (maybe 64). I tried masking the shift count with 0x1f so that the shift count is known to be 32, this just gave an extra instruction for the masking. It's even worse with rdtsc() converted to u_int first like I want: % movl%ebx, (%esp) % movl%esi, 4(%esp) % #APP % rdtsc % #NO_APP % movl%eax, %ebx % movl8(%ebp), %eax % movl4(%esp), %esi % movl28(%eax), %ecx % movl%ebx, %eax % movl(%esp), %ebx % # some frame pointer epilogue reordered here % shrl%cl, %eax The second case may be what you already fixed on amd64 (only?) -- use rdtsc32() instead of (u_int)rdtsc(). I've always thought that the dynamic shift is overengineered, and now like it even less. The following is efficent and works well enough in all currently physically possible cases: % /* % * Don't really need a separate one for `low', but now it costs less % * (1 shift instruction at runtime and some space). Must change % * tc_counter_mask to match. % */ % u_int % tsc_get_timecount_low(struct timecounter *tc) % { % #ifdef SMP % /* %* Works up to 1024 GHz, assuming that nontemporalness scales with %* freq. I think 8 is too many. But now do extra for SMP indep. %* of freq. %*/ % return (((u_int)rdtsc()) 8); /* gens rdtsc; shrl $8,%eax */ % #else % /*
svn commit: r223229 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 11:17:13 2011 New Revision: 223229 URL: http://svn.freebsd.org/changeset/base/223229 Log: MFC r220633: Remove IWN_FLAG_HAS_5GHZ and IWN_PCI_BAR0, both unused. Modified: stable/8/sys/dev/iwn/if_iwn.c stable/8/sys/dev/iwn/if_iwnreg.h stable/8/sys/dev/iwn/if_iwnvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:07:09 2011 (r223228) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:17:13 2011 (r223229) @@ -1792,7 +1792,6 @@ iwn_read_eeprom_band(struct iwn_softc *s c-ic_freq = ieee80211_ieee2mhz(chan, IEEE80211_CHAN_A); c-ic_flags = IEEE80211_CHAN_A | nflags; - sc-sc_flags |= IWN_FLAG_HAS_5GHZ; } #if 0 /* HT */ /* XXX no constraints on using HT20 */ Modified: stable/8/sys/dev/iwn/if_iwnreg.h == --- stable/8/sys/dev/iwn/if_iwnreg.hSat Jun 18 11:07:09 2011 (r223228) +++ stable/8/sys/dev/iwn/if_iwnreg.hSat Jun 18 11:17:13 2011 (r223229) @@ -50,9 +50,6 @@ #define IWN_HIADDR(paddr) (0) #endif -/* Base Address Register. */ -#define IWN_PCI_BAR0 PCI_MAPREG_START - /* * Control and status registers. */ Modified: stable/8/sys/dev/iwn/if_iwnvar.h == --- stable/8/sys/dev/iwn/if_iwnvar.hSat Jun 18 11:07:09 2011 (r223228) +++ stable/8/sys/dev/iwn/if_iwnvar.hSat Jun 18 11:17:13 2011 (r223229) @@ -215,7 +215,6 @@ struct iwn_softc { struct resource *irq; u_int sc_flags; -#define IWN_FLAG_HAS_5GHZ (1 0) #define IWN_FLAG_HAS_OTPROM(1 1) #define IWN_FLAG_CALIB_DONE(1 2) #define IWN_FLAG_USE_ICT (1 3) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223230 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 11:19:12 2011 New Revision: 223230 URL: http://svn.freebsd.org/changeset/base/223230 Log: MFC r220634: Reuse net80211 code: - IWN_TXOP_TO_US is equal to IEEE80211_TXOP_TO_US - use IEEE80211_DUR_TU - ieee80211_add_rates/ieee80211_add_xrates are public, use em - copied ieee80211_add_ssid it is not public Modified: stable/8/sys/dev/iwn/if_iwn.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:17:13 2011 (r223229) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:19:12 2011 (r223230) @@ -198,6 +198,7 @@ static void iwn_tune_sensitivity(struct static int iwn_send_sensitivity(struct iwn_softc *); static int iwn_set_pslevel(struct iwn_softc *, int, int, int); static int iwn_config(struct iwn_softc *); +static uint8_t *ieee80211_add_ssid(uint8_t *, const uint8_t *, u_int); static int iwn_scan(struct iwn_softc *); static int iwn_auth(struct iwn_softc *, struct ieee80211vap *vap); static int iwn_run(struct iwn_softc *, struct ieee80211vap *vap); @@ -3636,7 +3637,6 @@ static int iwn_wme_update(struct ieee80211com *ic) { #define IWN_EXP2(x)((1 (x)) - 1)/* CWmin = 2^ECWmin - 1 */ -#defineIWN_TXOP_TO_US(v) (v5) struct iwn_softc *sc = ic-ic_ifp-if_softc; struct iwn_edca_params cmd; int i; @@ -3650,7 +3650,7 @@ iwn_wme_update(struct ieee80211com *ic) cmd.ac[i].cwmin = htole16(IWN_EXP2(wmep-wmep_logcwmin)); cmd.ac[i].cwmax = htole16(IWN_EXP2(wmep-wmep_logcwmax)); cmd.ac[i].txoplimit = - htole16(IWN_TXOP_TO_US(wmep-wmep_txopLimit)); + htole16(IEEE80211_TXOP_TO_US(wmep-wmep_txopLimit)); } IEEE80211_UNLOCK(ic); IWN_LOCK(sc); @@ -3658,7 +3658,6 @@ iwn_wme_update(struct ieee80211com *ic) IWN_UNLOCK(sc); IEEE80211_LOCK(ic); return 0; -#undef IWN_TXOP_TO_US #undef IWN_EXP2 } @@ -3720,7 +3719,7 @@ iwn_set_timing(struct iwn_softc *sc, str cmd.lintval = htole16(10); /* Compute remaining time until next beacon. */ - val = (uint64_t)ni-ni_intval * 1024; /* msecs - usecs */ + val = (uint64_t)ni-ni_intval * IEEE80211_DUR_TU; mod = le64toh(cmd.tstamp) % val; cmd.binitval = htole32((uint32_t)(val - mod)); @@ -4270,7 +4269,7 @@ iwn_tune_sensitivity(struct iwn_softc *s /* Compute number of false alarms since last call for OFDM. */ fa = le32toh(stats-ofdm.bad_plcp) - calib-bad_plcp_ofdm; fa += le32toh(stats-ofdm.fa) - calib-fa_ofdm; - fa *= 200 * 1024; /* 200TU */ + fa *= 200 * IEEE80211_DUR_TU; /* 200TU */ /* Save counters values for next call. */ calib-bad_plcp_ofdm = le32toh(stats-ofdm.bad_plcp); @@ -4327,7 +4326,7 @@ iwn_tune_sensitivity(struct iwn_softc *s /* Compute number of false alarms since last call for CCK. */ fa = le32toh(stats-cck.bad_plcp) - calib-bad_plcp_cck; fa += le32toh(stats-cck.fa) - calib-fa_cck; - fa *= 200 * 1024; /* 200TU */ + fa *= 200 * IEEE80211_DUR_TU; /* 200TU */ /* Save counters values for next call. */ calib-bad_plcp_cck = le32toh(stats-cck.bad_plcp); @@ -4586,6 +4585,18 @@ iwn_config(struct iwn_softc *sc) return 0; } +/* + * Add an ssid element to a frame. + */ +static uint8_t * +ieee80211_add_ssid(uint8_t *frm, const uint8_t *ssid, u_int len) +{ + *frm++ = IEEE80211_ELEMID_SSID; + *frm++ = len; + memcpy(frm, ssid, len); + return frm + len; +} + static int iwn_scan(struct iwn_softc *sc) { @@ -4599,7 +4610,7 @@ iwn_scan(struct iwn_softc *sc) struct ieee80211_frame *wh; struct ieee80211_rateset *rs; struct ieee80211_channel *c; - int buflen, error, nrates; + int buflen, error; uint16_t rxchain; uint8_t *buf, *frm, txant; @@ -4675,30 +4686,14 @@ iwn_scan(struct iwn_softc *sc) *(uint16_t *)wh-i_seq[0] = 0; /* filled by HW */ frm = (uint8_t *)(wh + 1); - - /* Add SSID IE. */ - *frm++ = IEEE80211_ELEMID_SSID; - *frm++ = ss-ss_ssid[0].len; - memcpy(frm, ss-ss_ssid[0].ssid, ss-ss_ssid[0].len); - frm += ss-ss_ssid[0].len; - - /* Add supported rates IE. */ - *frm++ = IEEE80211_ELEMID_RATES; - nrates = rs-rs_nrates; - if (nrates IEEE80211_RATE_SIZE) - nrates = IEEE80211_RATE_SIZE; - *frm++ = nrates; - memcpy(frm, rs-rs_rates, nrates); - frm += nrates; - - /* Add
svn commit: r223231 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 11:21:56 2011 New Revision: 223231 URL: http://svn.freebsd.org/changeset/base/223231 Log: MFC r220635: iwn_cleanup() is just a wrapper around iwn_detach(), call it directly instead. Modified: stable/8/sys/dev/iwn/if_iwn.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:19:12 2011 (r223230) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:21:56 2011 (r223231) @@ -81,7 +81,6 @@ static struct ieee80211vap *iwn_vap_crea int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], const uint8_t mac[IEEE80211_ADDR_LEN]); static voidiwn_vap_delete(struct ieee80211vap *); -static int iwn_cleanup(device_t); static int iwn_detach(device_t); static int iwn_nic_lock(struct iwn_softc *); static int iwn_eeprom_lock(struct iwn_softc *); @@ -684,7 +683,7 @@ iwn_attach(device_t dev) ieee80211_announce(ic); return 0; fail: - iwn_cleanup(dev); + iwn_detach(dev); return error; } @@ -845,7 +844,7 @@ iwn_vap_delete(struct ieee80211vap *vap) } static int -iwn_cleanup(device_t dev) +iwn_detach(device_t dev) { struct iwn_softc *sc = device_get_softc(dev); struct ifnet *ifp = sc-sc_ifp; @@ -895,13 +894,6 @@ iwn_cleanup(device_t dev) } static int -iwn_detach(device_t dev) -{ - iwn_cleanup(dev); - return 0; -} - -static int iwn_nic_lock(struct iwn_softc *sc) { int ntries; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223232 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 11:23:42 2011 New Revision: 223232 URL: http://svn.freebsd.org/changeset/base/223232 Log: MFC r220636: Instead of trying to figure out which rxon.flags to clear, restart from scratch. Remove htole16() calls, rxon.chan is an uint8_t, ieee80211_chan2ieee() does return an ic_ieee as an int, but I heavily doubt a htole16() will buy us anything here. Modified: stable/8/sys/dev/iwn/if_iwn.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:21:56 2011 (r223231) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:23:42 2011 (r223232) @@ -4757,7 +4757,7 @@ iwn_auth(struct iwn_softc *sc, struct ie /* Update adapter configuration. */ IEEE80211_ADDR_COPY(sc-rxon.bssid, ni-ni_bssid); - sc-rxon.chan = htole16(ieee80211_chan2ieee(ic, ni-ni_chan)); + sc-rxon.chan = ieee80211_chan2ieee(ic, ni-ni_chan); sc-rxon.flags = htole32(IWN_RXON_TSF | IWN_RXON_CTS_TO_SELF); if (IEEE80211_IS_CHAN_2GHZ(ni-ni_chan)) sc-rxon.flags |= htole32(IWN_RXON_AUTO | IWN_RXON_24GHZ); @@ -4843,15 +4843,11 @@ iwn_run(struct iwn_softc *sc, struct iee /* Update adapter configuration. */ IEEE80211_ADDR_COPY(sc-rxon.bssid, ni-ni_bssid); - sc-rxon.chan = htole16(ieee80211_chan2ieee(ic, ni-ni_chan)); sc-rxon.associd = htole16(IEEE80211_AID(ni-ni_associd)); - /* Short preamble and slot time are negotiated when associating. */ - sc-rxon.flags = ~htole32(IWN_RXON_SHPREAMBLE | IWN_RXON_SHSLOT); - sc-rxon.flags |= htole32(IWN_RXON_TSF | IWN_RXON_CTS_TO_SELF); + sc-rxon.chan = ieee80211_chan2ieee(ic, ni-ni_chan); + sc-rxon.flags = htole32(IWN_RXON_TSF | IWN_RXON_CTS_TO_SELF); if (IEEE80211_IS_CHAN_2GHZ(ni-ni_chan)) sc-rxon.flags |= htole32(IWN_RXON_AUTO | IWN_RXON_24GHZ); - else - sc-rxon.flags = ~htole32(IWN_RXON_AUTO | IWN_RXON_24GHZ); if (ic-ic_flags IEEE80211_F_SHSLOT) sc-rxon.flags |= htole32(IWN_RXON_SHSLOT); if (ic-ic_flags IEEE80211_F_SHPREAMBLE) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223233 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 11:25:33 2011 New Revision: 223233 URL: http://svn.freebsd.org/changeset/base/223233 Log: MFC r220659: Don't timeout when stopping DMA channels. Obtained from:OpenBSD Modified: stable/8/sys/dev/iwn/if_iwn.c stable/8/sys/dev/iwn/if_iwnreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:23:42 2011 (r223232) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:25:33 2011 (r223233) @@ -4003,7 +4003,7 @@ iwn4965_get_temperature(struct iwn_softc return 0; /* Sign-extend 23-bit R4 value to 32-bit. */ - r4 = (r4 8) 8; + r4 = ((r4 0xff) ^ 0x80) - 0x80; /* Compute temperature in Kelvin. */ temp = (259 * (r4 - r2)) / (r3 - r1); temp = (temp * 97) / 100 + 8; @@ -6283,7 +6283,6 @@ static void iwn_hw_stop(struct iwn_softc *sc) { const struct iwn_hal *hal = sc-sc_hal; - uint32_t tmp; int chnl, qid, ntries; IWN_WRITE(sc, IWN_RESET, IWN_RESET_NEVO); @@ -6305,8 +6304,7 @@ iwn_hw_stop(struct iwn_softc *sc) for (chnl = 0; chnl hal-ndmachnls; chnl++) { IWN_WRITE(sc, IWN_FH_TX_CONFIG(chnl), 0); for (ntries = 0; ntries 200; ntries++) { - tmp = IWN_READ(sc, IWN_FH_TX_STATUS); - if ((tmp IWN_FH_TX_STATUS_IDLE(chnl)) == + if (IWN_READ(sc, IWN_FH_TX_STATUS) IWN_FH_TX_STATUS_IDLE(chnl)) break; DELAY(10); Modified: stable/8/sys/dev/iwn/if_iwnreg.h == --- stable/8/sys/dev/iwn/if_iwnreg.hSat Jun 18 11:23:42 2011 (r223232) +++ stable/8/sys/dev/iwn/if_iwnreg.hSat Jun 18 11:25:33 2011 (r223233) @@ -283,8 +283,7 @@ #define IWN_FH_TX_CHICKEN_SCHED_RETRY (1 1) /* Possible flags for register IWN_FH_TX_STATUS. */ -#define IWN_FH_TX_STATUS_IDLE(chnl)\ - (1 ((chnl) + 24) | 1 ((chnl) + 16)) +#define IWN_FH_TX_STATUS_IDLE(chnl)(1 ((chnl) + 16)) /* Possible flags for register IWN_FH_RX_CONFIG. */ #define IWN_FH_RX_CONFIG_ENA (1 31) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223234 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 11:27:28 2011 New Revision: 223234 URL: http://svn.freebsd.org/changeset/base/223234 Log: MFC r220660: Only handle beacon misses while in RUN state and not scanning. Modified: stable/8/sys/dev/iwn/if_iwn.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:25:33 2011 (r223233) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:27:28 2011 (r223234) @@ -2463,23 +2463,22 @@ iwn_notif_intr(struct iwn_softc *sc) BUS_DMASYNC_POSTREAD); misses = le32toh(miss-consecutive); - /* XXX not sure why we're notified w/ zero */ - if (misses == 0) - break; DPRINTF(sc, IWN_DEBUG_STATE, %s: beacons missed %d/%d\n, __func__, misses, le32toh(miss-total)); - /* * If more than 5 consecutive beacons are missed, * reinitialize the sensitivity state machine. */ - if (vap-iv_state == IEEE80211_S_RUN misses 5) - (void) iwn_init_sensitivity(sc); - if (misses = vap-iv_bmissthreshold) { - IWN_UNLOCK(sc); - ieee80211_beacon_miss(ic); - IWN_LOCK(sc); + if (vap-iv_state == IEEE80211_S_RUN + (ic-ic_flags IEEE80211_F_SCAN) != 0) { + if (misses 5) + (void)iwn_init_sensitivity(sc); + if (misses = vap-iv_bmissthreshold) { + IWN_UNLOCK(sc); + ieee80211_beacon_miss(ic); + IWN_LOCK(sc); + } } break; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223235 - head/sys/sparc64/sparc64
Author: marius Date: Sat Jun 18 11:27:44 2011 New Revision: 223235 URL: http://svn.freebsd.org/changeset/base/223235 Log: - As with stray vector interrupts limit the reporting of stray level interrupts. Bringup on additional machine models repeatedly reveals firmware that enables interrupts behind our back, causing the console to be flooded otherwise. - As with the regular interrupt counters using uint16_t instead of u_long for counting the stray vector interrupts should be more than sufficient. - Cache the interrupt vector in intr_stray_vector(). Modified: head/sys/sparc64/sparc64/intr_machdep.c Modified: head/sys/sparc64/sparc64/intr_machdep.c == --- head/sys/sparc64/sparc64/intr_machdep.c Sat Jun 18 11:27:28 2011 (r223234) +++ head/sys/sparc64/sparc64/intr_machdep.c Sat Jun 18 11:27:44 2011 (r223235) @@ -83,10 +83,11 @@ CTASSERT((1 IV_SHIFT) == sizeof(struc ih_func_t *intr_handlers[PIL_MAX]; uint16_t pil_countp[PIL_MAX]; +static uint16_t pil_stray_count[PIL_MAX]; struct intr_vector intr_vectors[IV_MAX]; uint16_t intr_countp[IV_MAX]; -static u_long intr_stray_count[IV_MAX]; +static uint16_t intr_stray_count[IV_MAX]; static const char *const pil_names[] = { stray, @@ -199,22 +200,32 @@ intr_setup(int pri, ih_func_t *ihf, int static void intr_stray_level(struct trapframe *tf) { + uint64_t level; - printf(stray level interrupt %ld\n, tf-tf_level); + level = tf-tf_level; + if (pil_stray_count[level] MAX_STRAY_LOG) { + printf(stray level interrupt %ld\n, level); + pil_stray_count[level]++; + if (pil_stray_count[level] = MAX_STRAY_LOG) + printf(got %d stray level interrupt %ld's: not + logging anymore\n, MAX_STRAY_LOG, level); + } } static void intr_stray_vector(void *cookie) { struct intr_vector *iv; + u_int vec; iv = cookie; - if (intr_stray_count[iv-iv_vec] MAX_STRAY_LOG) { - printf(stray vector interrupt %d\n, iv-iv_vec); - intr_stray_count[iv-iv_vec]++; - if (intr_stray_count[iv-iv_vec] = MAX_STRAY_LOG) - printf(got %d stray interrupt %d's: not logging - anymore\n, MAX_STRAY_LOG, iv-iv_vec); + vec = iv-iv_vec; + if (intr_stray_count[vec] MAX_STRAY_LOG) { + printf(stray vector interrupt %d\n, vec); + intr_stray_count[vec]++; + if (intr_stray_count[vec] = MAX_STRAY_LOG) + printf(got %d stray vector interrupt %d's: not + logging anymore\n, MAX_STRAY_LOG, vec); } } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223236 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 11:29:44 2011 New Revision: 223236 URL: http://svn.freebsd.org/changeset/base/223236 Log: MFC r220661: Fixes for firmware handling: - there is a local variable for sc-fw_dma, use that instead - OpenBSD uses 5*hz to wait for firmware to be loaded - in case the firmware module contains invalid data, actually release it Modified: stable/8/sys/dev/iwn/if_iwn.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:27:44 2011 (r223235) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:29:44 2011 (r223236) @@ -5629,10 +5629,10 @@ iwn4965_load_firmware(struct iwn_softc * /* Copy initialization sections into pre-allocated DMA-safe memory. */ memcpy(dma-vaddr, fw-init.data, fw-init.datasz); - bus_dmamap_sync(sc-fw_dma.tag, dma-map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(dma-tag, dma-map, BUS_DMASYNC_PREWRITE); memcpy(dma-vaddr + IWN4965_FW_DATA_MAXSZ, fw-init.text, fw-init.textsz); - bus_dmamap_sync(sc-fw_dma.tag, dma-map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(dma-tag, dma-map, BUS_DMASYNC_PREWRITE); /* Tell adapter where to find initialization sections. */ error = iwn_nic_lock(sc); @@ -5670,10 +5670,10 @@ iwn4965_load_firmware(struct iwn_softc * /* Copy runtime sections into pre-allocated DMA-safe memory. */ memcpy(dma-vaddr, fw-main.data, fw-main.datasz); - bus_dmamap_sync(sc-fw_dma.tag, dma-map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(dma-tag, dma-map, BUS_DMASYNC_PREWRITE); memcpy(dma-vaddr + IWN4965_FW_DATA_MAXSZ, fw-main.text, fw-main.textsz); - bus_dmamap_sync(sc-fw_dma.tag, dma-map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(dma-tag, dma-map, BUS_DMASYNC_PREWRITE); /* Tell adapter where to find runtime sections. */ error = iwn_nic_lock(sc); @@ -5700,7 +5700,7 @@ iwn5000_load_firmware_section(struct iwn /* Copy firmware section into pre-allocated DMA-safe memory. */ memcpy(dma-vaddr, section, size); - bus_dmamap_sync(sc-fw_dma.tag, dma-map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(dma-tag, dma-map, BUS_DMASYNC_PREWRITE); error = iwn_nic_lock(sc); if (error != 0) @@ -5726,7 +5726,7 @@ iwn5000_load_firmware_section(struct iwn iwn_nic_unlock(sc); /* Wait at most five seconds for FH DMA transfer to complete. */ - return msleep(sc, sc-sc_mtx, PCATCH, iwninit, hz); + return msleep(sc, sc-sc_mtx, PCATCH, iwninit, 5 * hz); } static int @@ -5771,7 +5771,7 @@ iwn_read_firmware_leg(struct iwn_softc * size_t hdrlen = 24; uint32_t rev; - ptr = (const uint32_t *)sc-fw_fp-data; + ptr = (const uint32_t *)fw-data; rev = le32toh(*ptr++); /* Check firmware API version. */ @@ -5819,7 +5819,7 @@ iwn_read_firmware_leg(struct iwn_softc * /* * Extract text and data sections from a TLV firmware image. */ -int +static int iwn_read_firmware_tlv(struct iwn_softc *sc, struct iwn_fw_info *fw, uint16_t alt) { @@ -5931,6 +5931,8 @@ iwn_read_firmware(struct iwn_softc *sc) device_printf(sc-sc_dev, %s: firmware file too short: %zu bytes\n, __func__, fw-size); + firmware_put(sc-fw_fp, FIRMWARE_UNLOAD); + sc-fw_fp = NULL; return EINVAL; } @@ -5942,6 +5944,8 @@ iwn_read_firmware(struct iwn_softc *sc) if (error != 0) { device_printf(sc-sc_dev, %s: could not read firmware sections\n, __func__); + firmware_put(sc-fw_fp, FIRMWARE_UNLOAD); + sc-fw_fp = NULL; return error; } @@ -5954,6 +5958,8 @@ iwn_read_firmware(struct iwn_softc *sc) (fw-boot.textsz 3) != 0) { device_printf(sc-sc_dev, %s: firmware sections too large\n, __func__); + firmware_put(sc-fw_fp, FIRMWARE_UNLOAD); + sc-fw_fp = NULL; return EINVAL; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223237 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 11:31:19 2011 New Revision: 223237 URL: http://svn.freebsd.org/changeset/base/223237 Log: MFC r220662: Split out bluetooth coexistence setup. Modified: stable/8/sys/dev/iwn/if_iwn.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:29:44 2011 (r223236) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:31:19 2011 (r223237) @@ -196,6 +196,7 @@ static void iwn_tune_sensitivity(struct const struct iwn_rx_stats *); static int iwn_send_sensitivity(struct iwn_softc *); static int iwn_set_pslevel(struct iwn_softc *, int, int, int); +static int iwn_send_btcoex(struct iwn_softc *); static int iwn_config(struct iwn_softc *); static uint8_t *ieee80211_add_ssid(uint8_t *, const uint8_t *, u_int); static int iwn_scan(struct iwn_softc *); @@ -4464,12 +4465,25 @@ iwn_set_pslevel(struct iwn_softc *sc, in } static int +iwn_send_btcoex(struct iwn_softc *sc) +{ + struct iwn_bluetooth cmd; + + memset(cmd, 0, sizeof cmd); + cmd.flags = IWN_BT_COEX_CHAN_ANN | IWN_BT_COEX_BT_PRIO; + cmd.lead_time = IWN_BT_LEAD_TIME_DEF; + cmd.max_kill = IWN_BT_MAX_KILL_DEF; + DPRINTF(sc, IWN_DEBUG_RESET, %s: configuring bluetooth coexistence\n, + __func__); + return iwn_cmd(sc, IWN_CMD_BT_COEX, cmd, sizeof(cmd), 0); +} + +static int iwn_config(struct iwn_softc *sc) { const struct iwn_hal *hal = sc-sc_hal; struct ifnet *ifp = sc-sc_ifp; struct ieee80211com *ic = ifp-if_l2com; - struct iwn_bluetooth bluetooth; uint32_t txmask; int error; uint16_t rxchain; @@ -4490,13 +4504,7 @@ iwn_config(struct iwn_softc *sc) } /* Configure bluetooth coexistence. */ - memset(bluetooth, 0, sizeof bluetooth); - bluetooth.flags = IWN_BT_COEX_CHAN_ANN | IWN_BT_COEX_BT_PRIO; - bluetooth.lead_time = IWN_BT_LEAD_TIME_DEF; - bluetooth.max_kill = IWN_BT_MAX_KILL_DEF; - DPRINTF(sc, IWN_DEBUG_RESET, %s: config bluetooth coexistence\n, - __func__); - error = iwn_cmd(sc, IWN_CMD_BT_COEX, bluetooth, sizeof bluetooth, 0); + error = iwn_send_btcoex(sc); if (error != 0) { device_printf(sc-sc_dev, %s: could not configure bluetooth coexistence, error %d\n, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223238 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 11:33:55 2011 New Revision: 223238 URL: http://svn.freebsd.org/changeset/base/223238 Log: MFC r220667+220668: Split up watchdog and calibration callout. This allows us to use different timing on both and to remove some monitor mode specific hacks (which has no calibration). Modified: stable/8/sys/dev/iwn/if_iwn.c stable/8/sys/dev/iwn/if_iwnvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:31:19 2011 (r223237) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:33:55 2011 (r223238) @@ -123,10 +123,9 @@ static struct ieee80211_node *iwn_node_a const uint8_t mac[IEEE80211_ADDR_LEN]); static int iwn_media_change(struct ifnet *); static int iwn_newstate(struct ieee80211vap *, enum ieee80211_state, int); +static voidiwn_calib_timeout(void *); static voidiwn_rx_phy(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); -static voidiwn_timer_timeout(void *); -static voidiwn_calib_reset(struct iwn_softc *); static voidiwn_rx_done(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); #if 0 /* HT */ @@ -161,7 +160,7 @@ static int iwn_raw_xmit(struct ieee80211 const struct ieee80211_bpf_params *); static voidiwn_start(struct ifnet *); static voidiwn_start_locked(struct ifnet *); -static voidiwn_watchdog(struct iwn_softc *sc); +static voidiwn_watchdog(void *); static int iwn_ioctl(struct ifnet *, u_long, caddr_t); static int iwn_cmd(struct iwn_softc *, int, const void *, int, int); static int iwn4965_add_node(struct iwn_softc *, struct iwn_node_info *, @@ -475,7 +474,6 @@ iwn_attach(device_t dev) } IWN_LOCK_INIT(sc); - callout_init_mtx(sc-sc_timer_to, sc-sc_mtx, 0); TASK_INIT(sc-sc_reinit_task, 0, iwn_hw_reset, sc ); TASK_INIT(sc-sc_radioon_task, 0, iwn_radio_on, sc ); TASK_INIT(sc-sc_radiooff_task, 0, iwn_radio_off, sc ); @@ -668,6 +666,10 @@ iwn_attach(device_t dev) #endif iwn_radiotap_attach(sc); + + callout_init_mtx(sc-calib_to, sc-sc_mtx, 0); + callout_init_mtx(sc-watchdog_to, sc-sc_mtx, 0); + iwn_sysctlattach(sc); /* @@ -860,7 +862,8 @@ iwn_detach(device_t dev) ieee80211_draintask(ic, sc-sc_radiooff_task); iwn_stop(sc); - callout_drain(sc-sc_timer_to); + callout_drain(sc-watchdog_to); + callout_drain(sc-calib_to); ieee80211_ifdetach(ic); } @@ -1942,7 +1945,7 @@ iwn_newstate(struct ieee80211vap *vap, e IEEE80211_UNLOCK(ic); IWN_LOCK(sc); - callout_stop(sc-sc_timer_to); + callout_stop(sc-calib_to); switch (nstate) { case IEEE80211_S_ASSOC: @@ -1959,7 +1962,8 @@ iwn_newstate(struct ieee80211vap *vap, e */ sc-rxon.associd = 0; sc-rxon.filter = ~htole32(IWN_FILTER_BSS); - iwn_calib_reset(sc); + sc-calib.state = IWN_CALIB_STATE_INIT; + error = iwn_auth(sc, vap); break; @@ -1967,9 +1971,8 @@ iwn_newstate(struct ieee80211vap *vap, e /* * RUN - RUN transition; Just restart the timers. */ - if (vap-iv_state == IEEE80211_S_RUN - vap-iv_opmode != IEEE80211_M_MONITOR) { - iwn_calib_reset(sc); + if (vap-iv_state == IEEE80211_S_RUN) { + sc-calib_cnt = 0; break; } @@ -1981,6 +1984,10 @@ iwn_newstate(struct ieee80211vap *vap, e error = iwn_run(sc, vap); break; + case IEEE80211_S_INIT: + sc-calib.state = IWN_CALIB_STATE_INIT; + break; + default: break; } @@ -1989,6 +1996,27 @@ iwn_newstate(struct ieee80211vap *vap, e return ivp-iv_newstate(vap, nstate, arg); } +static void +iwn_calib_timeout(void *arg) +{ + struct iwn_softc *sc = arg; + + IWN_LOCK_ASSERT(sc); + + /* Force automatic TX power calibration every 60 secs. */ + if (++sc-calib_cnt = 120) { + uint32_t flags = 0; + + DPRINTF(sc, IWN_DEBUG_CALIBRATE, %s\n, + sending request for statistics); + (void)iwn_cmd(sc, IWN_CMD_GET_STATISTICS, flags, + sizeof flags, 1); + sc-calib_cnt = 0; + } +
svn commit: r223239 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 11:36:57 2011 New Revision: 223239 URL: http://svn.freebsd.org/changeset/base/223239 Log: MFC r220674: Revert some of local calibration changes in favour of the OpenBSD implementation. This includes the fix required for the 6050 series devices. Modified: stable/8/sys/dev/iwn/if_iwn.c stable/8/sys/dev/iwn/if_iwnvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:33:55 2011 (r223238) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:36:57 2011 (r223239) @@ -132,6 +132,8 @@ static void iwn_rx_done(struct iwn_softc static voidiwn_rx_compressed_ba(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); #endif +static voidiwn5000_rx_calib_results(struct iwn_softc *, + struct iwn_rx_desc *, struct iwn_rx_data *); static voidiwn_rx_statistics(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); static voidiwn4965_tx_done(struct iwn_softc *, struct iwn_rx_desc *, @@ -217,15 +219,10 @@ static void iwn5000_ampdu_tx_start(struc struct ieee80211_node *, uint8_t, uint16_t); static voidiwn5000_ampdu_tx_stop(struct iwn_softc *, uint8_t, uint16_t); #endif -static int iwn5000_send_calib_results(struct iwn_softc *); -static int iwn5000_save_calib_result(struct iwn_softc *, - struct iwn_phy_calib *, int, int); -static voidiwn5000_free_calib_results(struct iwn_softc *); -static int iwn5000_chrystal_calib(struct iwn_softc *); -static int iwn5000_send_calib_query(struct iwn_softc *, uint32_t); -static int iwn5000_rx_calib_result(struct iwn_softc *, - struct iwn_rx_desc *, struct iwn_rx_data *); +static int iwn5000_query_calibration(struct iwn_softc *); +static int iwn5000_send_calibration(struct iwn_softc *); static int iwn5000_send_wimax_coex(struct iwn_softc *); +static int iwn5000_crystal_calib(struct iwn_softc *); static int iwn4965_post_alive(struct iwn_softc *); static int iwn5000_post_alive(struct iwn_softc *); static int iwn4965_load_bootcode(struct iwn_softc *, const uint8_t *, @@ -709,9 +706,6 @@ iwn_hal_attach(struct iwn_softc *sc) sc-fwname = iwn5000fw; sc-txchainmask = IWN_ANT_B; sc-rxchainmask = IWN_ANT_AB; - sc-calib_init = IWN_CALIB_XTAL | IWN_CALIB_LO | - IWN_CALIB_TX_IQ | IWN_CALIB_TX_IQ_PERIODIC | - IWN_CALIB_BASE_BAND; break; case IWN_HW_REV_TYPE_5150: sc-sc_hal = iwn5000_hal; @@ -719,8 +713,6 @@ iwn_hal_attach(struct iwn_softc *sc) sc-fwname = iwn5150fw; sc-txchainmask = IWN_ANT_A; sc-rxchainmask = IWN_ANT_AB; - sc-calib_init = IWN_CALIB_DC | IWN_CALIB_LO | - IWN_CALIB_TX_IQ | IWN_CALIB_BASE_BAND; break; case IWN_HW_REV_TYPE_5300: case IWN_HW_REV_TYPE_5350: @@ -729,9 +721,6 @@ iwn_hal_attach(struct iwn_softc *sc) sc-fwname = iwn5000fw; sc-txchainmask = IWN_ANT_ABC; sc-rxchainmask = IWN_ANT_ABC; - sc-calib_init = IWN_CALIB_XTAL | IWN_CALIB_LO | - IWN_CALIB_TX_IQ | IWN_CALIB_TX_IQ_PERIODIC | - IWN_CALIB_BASE_BAND; break; case IWN_HW_REV_TYPE_1000: sc-sc_hal = iwn5000_hal; @@ -739,9 +728,6 @@ iwn_hal_attach(struct iwn_softc *sc) sc-fwname = iwn1000fw; sc-txchainmask = IWN_ANT_A; sc-rxchainmask = IWN_ANT_AB; - sc-calib_init = IWN_CALIB_XTAL | IWN_CALIB_LO | - IWN_CALIB_TX_IQ | IWN_CALIB_TX_IQ_PERIODIC | - IWN_CALIB_BASE_BAND; break; case IWN_HW_REV_TYPE_6000: sc-sc_hal = iwn5000_hal; @@ -757,11 +743,8 @@ iwn_hal_attach(struct iwn_softc *sc) default: sc-txchainmask = IWN_ANT_ABC; sc-rxchainmask = IWN_ANT_ABC; - sc-calib_runtime = IWN_CALIB_DC; break; } - sc-calib_init = IWN_CALIB_XTAL | IWN_CALIB_LO | - IWN_CALIB_TX_IQ | IWN_CALIB_BASE_BAND; break; case IWN_HW_REV_TYPE_6050: sc-sc_hal = iwn5000_hal; @@ -769,9 +752,6 @@ iwn_hal_attach(struct iwn_softc *sc) sc-fwname = iwn6050fw; sc-txchainmask =
svn commit: r223240 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 11:39:09 2011 New Revision: 223240 URL: http://svn.freebsd.org/changeset/base/223240 Log: MFC r220676-220677: The 6005 series devices need additional temperature offset calibration as well as the IWN_GP_DRIVER_CALIB_VER6 bit set. Modified: stable/8/sys/dev/iwn/if_iwn.c stable/8/sys/dev/iwn/if_iwnreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:36:57 2011 (r223239) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:39:09 2011 (r223240) @@ -223,6 +223,7 @@ static int iwn5000_query_calibration(str static int iwn5000_send_calibration(struct iwn_softc *); static int iwn5000_send_wimax_coex(struct iwn_softc *); static int iwn5000_crystal_calib(struct iwn_softc *); +static int iwn5000_temp_offset_calib(struct iwn_softc *); static int iwn4965_post_alive(struct iwn_softc *); static int iwn5000_post_alive(struct iwn_softc *); static int iwn4965_load_bootcode(struct iwn_softc *, const uint8_t *, @@ -4539,6 +4540,16 @@ iwn_config(struct iwn_softc *sc) int error; uint16_t rxchain; + if (sc-hw_type == IWN_HW_REV_TYPE_6005) { + /* Set radio temperature sensor offset. */ + error = iwn5000_temp_offset_calib(sc); + if (error != 0) { + device_printf(sc-sc_dev, + %s: could not set temperature offset\n, __func__); + return error; + } + } + /* Configure valid TX chains for 5000 Series. */ if (sc-hw_type != IWN_HW_REV_TYPE_4965) { txmask = htole32(sc-txchainmask); @@ -5326,6 +5337,24 @@ iwn5000_crystal_calib(struct iwn_softc * return iwn_cmd(sc, IWN_CMD_PHY_CALIB, cmd, sizeof cmd, 0); } +static int +iwn5000_temp_offset_calib(struct iwn_softc *sc) +{ + struct iwn5000_phy_calib_temp_offset cmd; + + memset(cmd, 0, sizeof cmd); + cmd.code = IWN5000_PHY_CALIB_TEMP_OFFSET; + cmd.ngroups = 1; + cmd.isvalid = 1; + if (sc-eeprom_temp != 0) + cmd.offset = htole16(sc-eeprom_temp); + else + cmd.offset = htole16(IWN_DEFAULT_TEMP_OFFSET); + DPRINTF(sc, IWN_DEBUG_CALIBRATE, setting radio sensor offset to %d\n, + le16toh(cmd.offset)); + return iwn_cmd(sc, IWN_CMD_PHY_CALIB, cmd, sizeof cmd, 0); +} + /* * This function is called after the runtime firmware notifies us of its * readiness (called in a process context.) @@ -6028,7 +6057,8 @@ iwn5000_nic_config(struct iwn_softc *sc) /* Use internal power amplifier only. */ IWN_WRITE(sc, IWN_GP_DRIVER, IWN_GP_DRIVER_RADIO_2X2_IPA); } - if (sc-hw_type == IWN_HW_REV_TYPE_6050 sc-calib_ver = 6) { + if ((sc-hw_type == IWN_HW_REV_TYPE_6050 || +sc-hw_type == IWN_HW_REV_TYPE_6005) sc-calib_ver = 6) { /* Indicate that ROM calibration version is =6. */ IWN_SETBITS(sc, IWN_GP_DRIVER, IWN_GP_DRIVER_CALIB_VER6); } Modified: stable/8/sys/dev/iwn/if_iwnreg.h == --- stable/8/sys/dev/iwn/if_iwnreg.hSat Jun 18 11:36:57 2011 (r223239) +++ stable/8/sys/dev/iwn/if_iwnreg.hSat Jun 18 11:39:09 2011 (r223240) @@ -885,6 +885,8 @@ struct iwn_phy_calib { #define IWN5000_PHY_CALIB_CRYSTAL 15 #define IWN5000_PHY_CALIB_BASE_BAND16 #define IWN5000_PHY_CALIB_TX_IQ_PERIODIC 17 +#define IWN5000_PHY_CALIB_TEMP_OFFSET 18 + #define IWN5000_PHY_CALIB_RESET_NOISE_GAIN 18 #define IWN5000_PHY_CALIB_NOISE_GAIN 19 @@ -903,6 +905,17 @@ struct iwn5000_phy_calib_crystal { uint8_t reserved[2]; } __packed; +struct iwn5000_phy_calib_temp_offset { + uint8_t code; + uint8_t group; + uint8_t ngroups; + uint8_t isvalid; + int16_t offset; +#define IWN_DEFAULT_TEMP_OFFSET2700 + + uint16_treserved; +} __packed; + struct iwn_phy_calib_gain { uint8_t code; uint8_t group; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223241 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 11:41:06 2011 New Revision: 223241 URL: http://svn.freebsd.org/changeset/base/223241 Log: MFC r220687: Obtain the channel number directly from the laster RXON command, also chan is an uint8_t. Modified: stable/8/sys/dev/iwn/if_iwn.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:39:09 2011 (r223240) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:41:06 2011 (r223241) @@ -1732,7 +1732,8 @@ iwn_read_eeprom_band(struct iwn_softc *s struct iwn_eeprom_chan *channels = sc-eeprom_channels[n]; const struct iwn_chan_band *band = iwn_bands[n]; struct ieee80211_channel *c; - int i, chan, nflags; + uint8_t chan; + int i, nflags; for (i = 0; i band-nchan; i++) { if (!(channels[i].flags IWN_EEPROM_CHAN_VALID)) { @@ -3806,8 +3807,6 @@ iwn4965_set_txpower(struct iwn_softc *sc ((y1) + fdivround(((int)(x) - (x1)) * ((y2) - (y1)), (x2) - (x1), n)) static const int tdiv[IWN_NATTEN_GROUPS] = { 9, 8, 8, 8, 6 }; - struct ifnet *ifp = sc-sc_ifp; - struct ieee80211com *ic = ifp-if_l2com; struct iwn_ucode_info *uc = sc-ucode_info; struct iwn4965_cmd_txpower cmd; struct iwn4965_eeprom_chan_samples *chans; @@ -3816,8 +3815,8 @@ iwn4965_set_txpower(struct iwn_softc *sc const uint8_t *rf_gain, *dsp_gain; uint8_t chan; - /* Retrieve channel number. */ - chan = ieee80211_chan2ieee(ic, ch); + /* Retrieve current channel from last RXON. */ + chan = sc-rxon.chan; DPRINTF(sc, IWN_DEBUG_RESET, setting TX power for channel %d\n, chan); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223242 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 11:43:06 2011 New Revision: 223242 URL: http://svn.freebsd.org/changeset/base/223242 Log: MFC r220688: Pass errors that might happen during state transitions up to net80211. Modified: stable/8/sys/dev/iwn/if_iwn.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:41:06 2011 (r223241) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:43:06 2011 (r223242) @@ -1920,7 +1920,7 @@ iwn_newstate(struct ieee80211vap *vap, e struct iwn_vap *ivp = IWN_VAP(vap); struct ieee80211com *ic = vap-iv_ic; struct iwn_softc *sc = ic-ic_ifp-if_softc; - int error; + int error = 0; DPRINTF(sc, IWN_DEBUG_STATE, %s: %s - %s\n, __func__, ieee80211_state_name[vap-iv_state], @@ -1947,7 +1947,10 @@ iwn_newstate(struct ieee80211vap *vap, e sc-rxon.filter = ~htole32(IWN_FILTER_BSS); sc-calib.state = IWN_CALIB_STATE_INIT; - error = iwn_auth(sc, vap); + if ((error = iwn_auth(sc, vap)) != 0) { + device_printf(sc-sc_dev, + %s: could not move to auth state\n, __func__); + } break; case IEEE80211_S_RUN: @@ -1964,7 +1967,10 @@ iwn_newstate(struct ieee80211vap *vap, e * which is done with a firmware cmd. We also defer * starting the timers until that work is done. */ - error = iwn_run(sc, vap); + if ((error = iwn_run(sc, vap)) != 0) { + device_printf(sc-sc_dev, + %s: could not move to run state\n, __func__); + } break; case IEEE80211_S_INIT: @@ -1976,6 +1982,8 @@ iwn_newstate(struct ieee80211vap *vap, e } IWN_UNLOCK(sc); IEEE80211_LOCK(ic); + if (error != 0) + return error; return ivp-iv_newstate(vap, nstate, arg); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223243 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 11:44:54 2011 New Revision: 223243 URL: http://svn.freebsd.org/changeset/base/223243 Log: MFC r220689: RSSI related syncs with the OpenBSD code: - read RSSI only for the active chains - cast RSSI/NF to int8_t before passing it up to radiotap - remove the htole64() for the timestamp Obtained from:OpenBSD Modified: stable/8/sys/dev/iwn/if_iwn.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:43:06 2011 (r223242) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:44:54 2011 (r223243) @@ -2128,18 +2128,18 @@ iwn_rx_done(struct iwn_softc *sc, struct m-m_data = head; m-m_pkthdr.len = m-m_len = len; - rssi = hal-get_rssi(sc, stat); - /* Grab a reference to the source node. */ wh = mtod(m, struct ieee80211_frame *); ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh); nf = (ni != NULL ni-ni_vap-iv_state == IEEE80211_S_RUN (ic-ic_flags IEEE80211_F_SCAN) == 0) ? sc-noise : -95; + rssi = hal-get_rssi(sc, stat); + if (ieee80211_radiotap_active(ic)) { struct iwn_rx_radiotap_header *tap = sc-sc_rxtap; - tap-wr_tsft = htole64(stat-tstamp); + tap-wr_tsft = stat-tstamp; tap-wr_flags = 0; if (stat-flags htole16(IWN_STAT_FLAG_SHPREAMBLE)) tap-wr_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; @@ -2161,8 +2161,8 @@ iwn_rx_done(struct iwn_softc *sc, struct /* Unknown rate: should not happen. */ default: tap-wr_rate = 0; } - tap-wr_dbm_antsignal = rssi; - tap-wr_dbm_antnoise = nf; + tap-wr_dbm_antsignal = (int8_t)rssi; + tap-wr_dbm_antnoise = (int8_t)nf; } IWN_UNLOCK(sc); @@ -3985,18 +3985,12 @@ iwn4965_get_rssi(struct iwn_softc *sc, s agc = (le16toh(phy-agc) 7) 0x7f; rssi = 0; -#if 0 - if (mask IWN_ANT_A) /* Ant A */ - rssi = max(rssi, phy-rssi[0]); - if (mask IWN_ATH_B) /* Ant B */ - rssi = max(rssi, phy-rssi[2]); - if (mask IWN_ANT_C) /* Ant C */ - rssi = max(rssi, phy-rssi[4]); -#else - rssi = max(rssi, phy-rssi[0]); - rssi = max(rssi, phy-rssi[2]); - rssi = max(rssi, phy-rssi[4]); -#endif + if (mask IWN_ANT_A) + rssi = MAX(rssi, phy-rssi[0]); + if (mask IWN_ANT_B) + rssi = MAX(rssi, phy-rssi[2]); + if (mask IWN_ANT_C) + rssi = MAX(rssi, phy-rssi[4]); DPRINTF(sc, IWN_DEBUG_RECV, %s: agc %d mask 0x%x rssi %d %d %d result %d\n, __func__, agc, mask, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223244 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 11:51:17 2011 New Revision: 223244 URL: http://svn.freebsd.org/changeset/base/223244 Log: MFC r220691-220694,220700-220702,220704,220710-220711: - Remove the flags argument of iwn_dma_contig_alloc(), it is always set as BUS_DMA_NOWAIT. While here also set BUS_DMA_COHERENT. - OpenBSD uses IWN_RBUF_SIZE not MJUMPAGESIZE for the RX path, also replace caddr_t with void * to be in sync. - In case a new mbuf can't be loaded, reuse the old one. - scratch_paddr has the same address pre-assigned, use that instead. - Rewrite DMA segment handling to be more inline with the OpenBSD code. Also change the m_len == 0 hack to have less code churn. - Make sure to destroy all DMA tags and maps. - Unify TX/RX ring allocation, finish the descriptior DMA stuff before starting with data. - Add missing bus_dmamap_sync calls as well as remove two duplicate ones. - Prevent double-free, also use the same error codes as OpenBSD. - Replace RX/TX ring allocation error messages with something more sane and remove those where the caller already prints one. Modified: stable/8/sys/dev/iwn/if_iwn.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:44:54 2011 (r223243) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:51:17 2011 (r223244) @@ -88,7 +88,7 @@ static intiwn_init_otprom(struct iwn_so static int iwn_read_prom_data(struct iwn_softc *, uint32_t, void *, int); static voidiwn_dma_map_addr(void *, bus_dma_segment_t *, int, int); static int iwn_dma_contig_alloc(struct iwn_softc *, struct iwn_dma_info *, - void **, bus_size_t, bus_size_t, int); + void **, bus_size_t, bus_size_t); static voidiwn_dma_contig_free(struct iwn_dma_info *); static int iwn_alloc_sched(struct iwn_softc *); static voidiwn_free_sched(struct iwn_softc *); @@ -1117,7 +1117,7 @@ iwn_dma_map_addr(void *arg, bus_dma_segm static int iwn_dma_contig_alloc(struct iwn_softc *sc, struct iwn_dma_info *dma, - void **kvap, bus_size_t size, bus_size_t alignment, int flags) +void **kvap, bus_size_t size, bus_size_t alignment) { int error; @@ -1126,27 +1126,21 @@ iwn_dma_contig_alloc(struct iwn_softc *s error = bus_dma_tag_create(bus_get_dma_tag(sc-sc_dev), alignment, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, size, - 1, size, flags, NULL, NULL, dma-tag); - if (error != 0) { - device_printf(sc-sc_dev, - %s: bus_dma_tag_create failed, error %d\n, - __func__, error); + 1, size, BUS_DMA_NOWAIT, NULL, NULL, dma-tag); + if (error != 0) goto fail; - } + error = bus_dmamem_alloc(dma-tag, (void **)dma-vaddr, - flags | BUS_DMA_ZERO, dma-map); - if (error != 0) { - device_printf(sc-sc_dev, - %s: bus_dmamem_alloc failed, error %d\n, __func__, error); + BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT, dma-map); + if (error != 0) goto fail; - } - error = bus_dmamap_load(dma-tag, dma-map, dma-vaddr, - size, iwn_dma_map_addr, dma-paddr, flags); - if (error != 0) { - device_printf(sc-sc_dev, - %s: bus_dmamap_load failed, error %d\n, __func__, error); + + error = bus_dmamap_load(dma-tag, dma-map, dma-vaddr, size, + iwn_dma_map_addr, dma-paddr, BUS_DMA_NOWAIT); + if (error != 0) goto fail; - } + + bus_dmamap_sync(dma-tag, dma-map, BUS_DMASYNC_PREWRITE); if (kvap != NULL) *kvap = dma-vaddr; @@ -1159,16 +1153,20 @@ fail: static void iwn_dma_contig_free(struct iwn_dma_info *dma) { - if (dma-tag != NULL) { - if (dma-map != NULL) { - if (dma-paddr == 0) { - bus_dmamap_sync(dma-tag, dma-map, - BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(dma-tag, dma-map); - } + if (dma-map != NULL) { + if (dma-vaddr != NULL) { + bus_dmamap_sync(dma-tag, dma-map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(dma-tag, dma-map); bus_dmamem_free(dma-tag, dma-vaddr, dma-map); + dma-vaddr = NULL; } + bus_dmamap_destroy(dma-tag,
svn commit: r223245 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 11:52:58 2011 New Revision: 223245 URL: http://svn.freebsd.org/changeset/base/223245 Log: MFC r220715: Instead of hardcoding TX rates and using that to fill the retry table use the neogotiated ni_rates instead. Modified: stable/8/sys/dev/iwn/if_iwn.c stable/8/sys/dev/iwn/if_iwnreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:51:17 2011 (r223244) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:52:58 2011 (r223245) @@ -121,6 +121,7 @@ static void iwn_read_eeprom_channels(str static voidiwn_read_eeprom_enhinfo(struct iwn_softc *); static struct ieee80211_node *iwn_node_alloc(struct ieee80211vap *, const uint8_t mac[IEEE80211_ADDR_LEN]); +static voidiwn_newassoc(struct ieee80211_node *, int); static int iwn_media_change(struct ifnet *); static int iwn_newstate(struct ieee80211vap *, enum ieee80211_state, int); static voidiwn_calib_timeout(void *); @@ -169,7 +170,8 @@ static int iwn4965_add_node(struct iwn_s int); static int iwn5000_add_node(struct iwn_softc *, struct iwn_node_info *, int); -static int iwn_set_link_quality(struct iwn_softc *, uint8_t, int); +static int iwn_set_link_quality(struct iwn_softc *, + struct ieee80211_node *); static int iwn_add_broadcast_node(struct iwn_softc *, int); static int iwn_wme_update(struct ieee80211com *); static voidiwn_update_mcast(struct ifnet *); @@ -648,6 +650,7 @@ iwn_attach(device_t dev) ic-ic_vap_delete = iwn_vap_delete; ic-ic_raw_xmit = iwn_raw_xmit; ic-ic_node_alloc = iwn_node_alloc; + ic-ic_newassoc = iwn_newassoc; ic-ic_wme.wme_update = iwn_wme_update; ic-ic_update_mcast = iwn_update_mcast; ic-ic_scan_start = iwn_scan_start; @@ -1908,6 +1911,18 @@ iwn_node_alloc(struct ieee80211vap *vap, return malloc(sizeof (struct iwn_node), M_80211_NODE,M_NOWAIT | M_ZERO); } +static void +iwn_newassoc(struct ieee80211_node *ni, int isnew) +{ + struct iwn_node *wn = (void *)ni; + int ridx, i; + + for (i = 0; i ni-ni_rates.rs_nrates; i++) { + ridx = iwn_plcp_signal(ni-ni_rates.rs_rates[i]); + wn-ridx[i] = ridx; + } +} + static int iwn_media_change(struct ifnet *ifp) { @@ -2891,7 +2906,7 @@ iwn_plcp_signal(int rate) { int i; for (i = 0; i IWN_RIDX_MAX + 1; i++) { - if (rate == iwn_rates[i].rate) + if ((rate IEEE80211_RATE_VAL) == iwn_rates[i].rate) return i; } @@ -3055,7 +3070,7 @@ iwn_tx_data(struct iwn_softc *sc, struct txant = IWN_LSB(sc-txchainmask); tx-rflags |= IWN_RFLAG_ANT(txant); } else { - tx-linkq = IWN_RIDX_OFDM54 - ridx; + tx-linkq = ni-ni_rates.rs_nrates - ridx - 1; flags |= IWN_TX_LINKQ; /* enable MRR */ } @@ -3599,98 +3614,39 @@ iwn5000_add_node(struct iwn_softc *sc, s return iwn_cmd(sc, IWN_CMD_ADD_NODE, node, sizeof (*node), async); } -#if 0 /* HT */ -static const uint8_t iwn_ridx_to_plcp[] = { - 10, 20, 55, 110, /* CCK */ - 0xd, 0xf, 0x5, 0x7, 0x9, 0xb, 0x1, 0x3, 0x3 /* OFDM R1-R4 */ -}; -static const uint8_t iwn_siso_mcs_to_plcp[] = { - 0, 0, 0, 0, /* CCK */ - 0, 0, 1, 2, 3, 4, 5, 6, 7 /* HT */ -}; -static const uint8_t iwn_mimo_mcs_to_plcp[] = { - 0, 0, 0, 0, /* CCK */ - 8, 8, 9, 10, 11, 12, 13, 14, 15 /* HT */ -}; -#endif -static const uint8_t iwn_prev_ridx[] = { - /* NB: allow fallback from CCK11 to OFDM9 and from OFDM6 to CCK5 */ - 0, 0, 1, 5, /* CCK */ - 2, 4, 3, 6, 7, 8, 9, 10, 10 /* OFDM */ -}; - -/* - * Configure hardware link parameters for the specified - * node operating on the specified channel. - */ static int -iwn_set_link_quality(struct iwn_softc *sc, uint8_t id, int async) +iwn_set_link_quality(struct iwn_softc *sc, struct ieee80211_node *ni) { - struct ifnet *ifp = sc-sc_ifp; - struct ieee80211com *ic = ifp-if_l2com; + struct iwn_node *wn = (void *)ni; + struct ieee80211_rateset *rs = ni-ni_rates; struct iwn_cmd_link_quality linkq; const struct iwn_rate *rinfo; - int i; - uint8_t txant, ridx; + uint8_t txant; + int i, txrate; /* Use the first valid TX antenna. */ txant = IWN_LSB(sc-txchainmask); memset(linkq, 0, sizeof linkq); -
svn commit: r223246 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 11:54:44 2011 New Revision: 223246 URL: http://svn.freebsd.org/changeset/base/223246 Log: MFC r220719: Remove if_ierrors which do not necessarily indicate a RX error, also do account send packets. While here use the IWN_TX_FAIL constant. Modified: stable/8/sys/dev/iwn/if_iwn.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:52:58 2011 (r223245) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:54:44 2011 (r223246) @@ -2069,7 +2069,6 @@ iwn_rx_done(struct iwn_softc *sc, struct if (!sc-last_rx_valid) { DPRINTF(sc, IWN_DEBUG_ANY, %s: missing RX_PHY\n, __func__); - ifp-if_ierrors++; return; } sc-last_rx_valid = 0; @@ -2083,7 +2082,6 @@ iwn_rx_done(struct iwn_softc *sc, struct device_printf(sc-sc_dev, %s: invalid rx statistic header, len %d\n, __func__, stat-cfg_phy_len); - ifp-if_ierrors++; return; } if (desc-type == IWN_MPDU_RX_DONE) { @@ -2427,11 +2425,12 @@ iwn_tx_done(struct iwn_softc *sc, struct /* * Update rate control statistics for the node. */ - if (status 0x80) { + if (status IWN_TX_FAIL) { ifp-if_oerrors++; ieee80211_ratectl_tx_complete(vap, ni, IEEE80211_RATECTL_TX_FAILURE, ackfailcnt, NULL); } else { + ifp-if_opackets++; ieee80211_ratectl_tx_complete(vap, ni, IEEE80211_RATECTL_TX_SUCCESS, ackfailcnt, NULL); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223247 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 11:56:40 2011 New Revision: 223247 URL: http://svn.freebsd.org/changeset/base/223247 Log: MFC r220720: Fix WME/QoS handling: - move the TX queue selection into iwn_tx_data/iwn_tx_data_raw - extract traffic identifier and use it - do not expect ACKs for frames marked as such Modified: stable/8/sys/dev/iwn/if_iwn.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:54:44 2011 (r223246) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:56:40 2011 (r223247) @@ -158,7 +158,10 @@ static voidiwn5000_reset_sched(struct i #endif static uint8_t iwn_plcp_signal(int); static int iwn_tx_data(struct iwn_softc *, struct mbuf *, - struct ieee80211_node *, struct iwn_tx_ring *); + struct ieee80211_node *); +static int iwn_tx_data_raw(struct iwn_softc *, struct mbuf *, + struct ieee80211_node *, + const struct ieee80211_bpf_params *params); static int iwn_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); static voidiwn_start(struct ifnet *); @@ -2913,8 +2916,7 @@ iwn_plcp_signal(int rate) { } static int -iwn_tx_data(struct iwn_softc *sc, struct mbuf *m, struct ieee80211_node *ni, -struct iwn_tx_ring *ring) +iwn_tx_data(struct iwn_softc *sc, struct mbuf *m, struct ieee80211_node *ni) { const struct iwn_hal *hal = sc-sc_hal; const struct ieee80211_txparam *tp; @@ -2922,6 +2924,7 @@ iwn_tx_data(struct iwn_softc *sc, struct struct ieee80211vap *vap = ni-ni_vap; struct ieee80211com *ic = ni-ni_ic; struct iwn_node *wn = (void *)ni; + struct iwn_tx_ring *ring; struct iwn_tx_desc *desc; struct iwn_tx_data *data; struct iwn_tx_cmd *cmd; @@ -2931,9 +2934,10 @@ iwn_tx_data(struct iwn_softc *sc, struct struct mbuf *m1; bus_dma_segment_t *seg, segs[IWN_MAX_SCATTER]; uint32_t flags; + uint16_t qos; u_int hdrlen; - int totlen, error, pad, nsegs = 0, i, rate; - uint8_t ridx, type, txant; + uint8_t tid, ridx, type, txant; + int ac, i, totlen, error, pad, nsegs = 0, rate; IWN_LOCK_ASSERT(sc); @@ -2941,6 +2945,17 @@ iwn_tx_data(struct iwn_softc *sc, struct hdrlen = ieee80211_anyhdrsize(wh); type = wh-i_fc[0] IEEE80211_FC0_TYPE_MASK; + /* Select EDCA Access Category and TX ring for this frame. */ + if (IEEE80211_QOS_HAS_SEQ(wh)) { + qos = ((const struct ieee80211_qosframe *)wh)-i_qos[0]; + tid = qos IEEE80211_QOS_TID; + } else { + qos = 0; + tid = 0; + } + ac = M_WME_GETAC(m); + + ring = sc-txq[ac]; desc = ring-desc[ring-cur]; data = ring-data[ring-cur]; @@ -2995,8 +3010,12 @@ iwn_tx_data(struct iwn_softc *sc, struct tx-scratch = 0;/* clear scratch area */ flags = 0; - if (!IEEE80211_IS_MULTICAST(wh-i_addr1)) - flags |= IWN_TX_NEED_ACK; + if (!IEEE80211_IS_MULTICAST(wh-i_addr1)) { + /* Unicast frame, check if an ACK is expected. */ + if (!qos || (qos IEEE80211_QOS_ACKPOLICY) != + IEEE80211_QOS_ACKPOLICY_NOACK) + flags |= IWN_TX_NEED_ACK; + } if ((wh-i_fc[0] (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) == (IEEE80211_FC0_TYPE_CTL | IEEE80211_FC0_SUBTYPE_BAR)) @@ -3056,7 +3075,7 @@ iwn_tx_data(struct iwn_softc *sc, struct pad = 0; tx-len = htole16(totlen); - tx-tid = 0; + tx-tid = tid; tx-rts_ntries = 60; tx-data_ntries = 15; tx-lifetime = htole32(IWN_LIFETIME_INFINITE); @@ -3161,8 +3180,7 @@ iwn_tx_data(struct iwn_softc *sc, struct static int iwn_tx_data_raw(struct iwn_softc *sc, struct mbuf *m, -struct ieee80211_node *ni, struct iwn_tx_ring *ring, -const struct ieee80211_bpf_params *params) +struct ieee80211_node *ni, const struct ieee80211_bpf_params *params) { const struct iwn_hal *hal = sc-sc_hal; const struct iwn_rate *rinfo; @@ -3172,13 +3190,14 @@ iwn_tx_data_raw(struct iwn_softc *sc, st struct iwn_tx_cmd *cmd; struct iwn_cmd_data *tx; struct ieee80211_frame *wh; + struct iwn_tx_ring *ring; struct iwn_tx_desc *desc; struct iwn_tx_data *data; struct mbuf *m1; bus_dma_segment_t *seg, segs[IWN_MAX_SCATTER]; uint32_t flags;
svn commit: r223248 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 12:00:49 2011 New Revision: 223248 URL: http://svn.freebsd.org/changeset/base/223248 Log: MFC r220721,220723-220726: - Rename some stuff in favour of the OpenBSD names: - prefer EDCA over WME - qid for a TXQ ID - reg for register values - Shuffle code around a bit. Mostly to group functional connected things, others to get the same order as the OpenBSD code. - Sync debug and error messages with OpenBSD. The device capability announcements are now hidden behind bootverbose. - Sync comments with OpenBSD. - Whitespace sync, some more style(9) conform then others. Modified: stable/8/sys/dev/iwn/if_iwn.c stable/8/sys/dev/iwn/if_iwnreg.h stable/8/sys/dev/iwn/if_iwnvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:56:40 2011 (r223247) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 12:00:49 2011 (r223248) @@ -72,16 +72,61 @@ __FBSDID($FreeBSD$); #include dev/iwn/if_iwnreg.h #include dev/iwn/if_iwnvar.h +struct iwn_ident { + uint16_tvendor; + uint16_tdevice; + const char *name; +}; + +static const struct iwn_ident iwn_ident_table [] = { + { 0x8086, 0x4229, Intel(R) PRO/Wireless 4965BGN }, + { 0x8086, 0x422D, Intel(R) PRO/Wireless 4965BGN }, + { 0x8086, 0x4230, Intel(R) PRO/Wireless 4965BGN }, + { 0x8086, 0x4233, Intel(R) PRO/Wireless 4965BGN }, + { 0x8086, 0x4232, Intel(R) PRO/Wireless 5100 }, + { 0x8086, 0x4237, Intel(R) PRO/Wireless 5100 }, + { 0x8086, 0x423C, Intel(R) PRO/Wireless 5150 }, + { 0x8086, 0x423D, Intel(R) PRO/Wireless 5150 }, + { 0x8086, 0x4235, Intel(R) PRO/Wireless 5300 }, + { 0x8086, 0x4236, Intel(R) PRO/Wireless 5300 }, + { 0x8086, 0x423A, Intel(R) PRO/Wireless 5350 }, + { 0x8086, 0x423B, Intel(R) PRO/Wireless 5350 }, + { 0x8086, 0x0083, Intel(R) PRO/Wireless 1000 }, + { 0x8086, 0x0084, Intel(R) PRO/Wireless 1000 }, + { 0x8086, 0x008D, Intel(R) PRO/Wireless 6000 }, + { 0x8086, 0x008E, Intel(R) PRO/Wireless 6000 }, + { 0x8086, 0x4238, Intel(R) PRO/Wireless 6000 }, + { 0x8086, 0x4239, Intel(R) PRO/Wireless 6000 }, + { 0x8086, 0x422B, Intel(R) PRO/Wireless 6000 }, + { 0x8086, 0x422C, Intel(R) PRO/Wireless 6000 }, + { 0x8086, 0x0087, Intel(R) PRO/Wireless 6250 }, + { 0x8086, 0x0089, Intel(R) PRO/Wireless 6250 }, + { 0x8086, 0x0082, Intel(R) PRO/Wireless 6205a }, + { 0x8086, 0x0085, Intel(R) PRO/Wireless 6205a }, +#ifdef notyet + { 0x8086, 0x008a, Intel(R) PRO/Wireless 6205b }, + { 0x8086, 0x008b, Intel(R) PRO/Wireless 6205b }, + { 0x8086, 0x008f, Intel(R) PRO/Wireless 6205b }, + { 0x8086, 0x0090, Intel(R) PRO/Wireless 6205b }, + { 0x8086, 0x0091, Intel(R) PRO/Wireless 6205b }, +#endif + { 0, 0, NULL } +}; + static int iwn_probe(device_t); static int iwn_attach(device_t); static const struct iwn_hal *iwn_hal_attach(struct iwn_softc *); static voidiwn_radiotap_attach(struct iwn_softc *); +static voidiwn_sysctlattach(struct iwn_softc *); static struct ieee80211vap *iwn_vap_create(struct ieee80211com *, const char name[IFNAMSIZ], int unit, int opmode, int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], const uint8_t mac[IEEE80211_ADDR_LEN]); static voidiwn_vap_delete(struct ieee80211vap *); static int iwn_detach(device_t); +static int iwn_shutdown(device_t); +static int iwn_suspend(device_t); +static int iwn_resume(device_t); static int iwn_nic_lock(struct iwn_softc *); static int iwn_eeprom_lock(struct iwn_softc *); static int iwn_init_otprom(struct iwn_softc *); @@ -116,8 +161,12 @@ static voidiwn_read_eeprom_band(struct #if 0 /* HT */ static voidiwn_read_eeprom_ht40(struct iwn_softc *, int); #endif -static voidiwn_read_eeprom_channels(struct iwn_softc *, int, - uint32_t); +static voidiwn_read_eeprom_channels(struct iwn_softc *, int, uint32_t); +static struct iwn_eeprom_chan *iwn_find_eeprom_channel(struct iwn_softc *, + struct ieee80211_channel *); +static int iwn_setregdomain(struct ieee80211com *, + struct ieee80211_regdomain *, int, + struct ieee80211_channel[]); static voidiwn_read_eeprom_enhinfo(struct iwn_softc *); static struct ieee80211_node *iwn_node_alloc(struct ieee80211vap *, const uint8_t mac[IEEE80211_ADDR_LEN]); @@ -176,7 +225,7 @@ static int
svn commit: r223249 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 12:03:30 2011 New Revision: 223249 URL: http://svn.freebsd.org/changeset/base/223249 Log: MFC r220727-220728: - Read RX/TX chainmasks directly of the EEPROM. Some chips are known to have the wrong/broken information stored, keep the hardcoded values for those. - Bring over the HAL/OPS changes, instead of two const structs it is now slightly more dynamic. Obtained from:OpenBSD Modified: stable/8/sys/dev/iwn/if_iwn.c stable/8/sys/dev/iwn/if_iwnvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 12:00:49 2011 (r223248) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 12:03:30 2011 (r223249) @@ -115,7 +115,8 @@ static const struct iwn_ident iwn_ident_ static int iwn_probe(device_t); static int iwn_attach(device_t); -static const struct iwn_hal *iwn_hal_attach(struct iwn_softc *); +static int iwn4965_attach(struct iwn_softc *, uint16_t); +static int iwn5000_attach(struct iwn_softc *, uint16_t); static voidiwn_radiotap_attach(struct iwn_softc *); static voidiwn_sysctlattach(struct iwn_softc *); static struct ieee80211vap *iwn_vap_create(struct ieee80211com *, @@ -410,62 +411,6 @@ MODULE_DEPEND(iwn, firmware, 1, 1, 1); MODULE_DEPEND(iwn, pci, 1, 1, 1); MODULE_DEPEND(iwn, wlan, 1, 1, 1); -static const struct iwn_hal iwn4965_hal = { - iwn4965_load_firmware, - iwn4965_read_eeprom, - iwn4965_post_alive, - iwn4965_nic_config, - iwn4965_update_sched, - iwn4965_get_temperature, - iwn4965_get_rssi, - iwn4965_set_txpower, - iwn4965_init_gains, - iwn4965_set_gains, - iwn4965_add_node, - iwn4965_tx_done, -#if 0 /* HT */ - iwn4965_ampdu_tx_start, - iwn4965_ampdu_tx_stop, -#endif - IWN4965_NTXQUEUES, - IWN4965_NDMACHNLS, - IWN4965_ID_BROADCAST, - IWN4965_RXONSZ, - IWN4965_SCHEDSZ, - IWN4965_FW_TEXT_MAXSZ, - IWN4965_FW_DATA_MAXSZ, - IWN4965_FWSZ, - IWN4965_SCHED_TXFACT -}; - -static const struct iwn_hal iwn5000_hal = { - iwn5000_load_firmware, - iwn5000_read_eeprom, - iwn5000_post_alive, - iwn5000_nic_config, - iwn5000_update_sched, - iwn5000_get_temperature, - iwn5000_get_rssi, - iwn5000_set_txpower, - iwn5000_init_gains, - iwn5000_set_gains, - iwn5000_add_node, - iwn5000_tx_done, -#if 0 /* HT */ - iwn5000_ampdu_tx_start, - iwn5000_ampdu_tx_stop, -#endif - IWN5000_NTXQUEUES, - IWN5000_NDMACHNLS, - IWN5000_ID_BROADCAST, - IWN5000_RXONSZ, - IWN5000_SCHEDSZ, - IWN5000_FW_TEXT_MAXSZ, - IWN5000_FW_DATA_MAXSZ, - IWN5000_FWSZ, - IWN5000_SCHED_TXFACT -}; - static int iwn_probe(device_t dev) { @@ -487,7 +432,6 @@ iwn_attach(device_t dev) struct iwn_softc *sc = (struct iwn_softc *)device_get_softc(dev); struct ieee80211com *ic; struct ifnet *ifp; - const struct iwn_hal *hal; uint32_t reg; int i, error, result; uint8_t macaddr[IEEE80211_ADDR_LEN]; @@ -545,10 +489,15 @@ iwn_attach(device_t dev) IWN_LOCK_INIT(sc); - /* Attach Hardware Abstraction Layer. */ - hal = iwn_hal_attach(sc); - if (hal == NULL) { - error = ENXIO; /* XXX: Wrong error code? */ + /* Read hardware revision and attach. */ + sc-hw_type = (IWN_READ(sc, IWN_HW_REV) 4) 0xf; + if (sc-hw_type == IWN_HW_REV_TYPE_4965) + error = iwn4965_attach(sc, pci_get_device(dev)); + else + error = iwn5000_attach(sc, pci_get_device(dev)); + if (error != 0) { + device_printf(dev, could not attach device, error %d\n, + error); goto fail; } @@ -588,7 +537,7 @@ iwn_attach(device_t dev) } /* Allocate TX rings (16 on 4965AGN, 20 on =5000). */ - for (i = 0; i hal-ntxqs; i++) { + for (i = 0; i sc-ntxqs; i++) { if ((error = iwn_alloc_tx_ring(sc, sc-txq[i], i)) != 0) { device_printf(dev, could not allocate TX ring %d, error %d\n, i, @@ -754,85 +703,121 @@ fail: return error; } -static const struct iwn_hal * -iwn_hal_attach(struct iwn_softc *sc) +static int +iwn4965_attach(struct iwn_softc *sc, uint16_t pid) { - sc-hw_type = (IWN_READ(sc, IWN_HW_REV) 4) 0xf; + struct iwn_ops *ops = sc-ops; + + ops-load_firmware = iwn4965_load_firmware; + ops-read_eeprom =
Re: svn commit: r222866 - head/sys/x86/x86
Long ago, On Wed, 8 Jun 2011, Jung-uk Kim wrote: On Wednesday 08 June 2011 04:55 pm, Bruce Evans wrote: On Wed, 8 Jun 2011, Jung-uk Kim wrote: Log: Introduce low-resolution TSC timecounter TSC-low. It replaces the normal TSC timecounter if TSC frequency is higher than ~4.29 MHz (or 2^32-1 Hz) or It should be a separate timecounter so that the user can choose it independently, at least in the SMP case where it is very low (at most ~4.29 GHz 8 ~= 17 MHz). As I noted in the log, it is still higher than the previous default ACPI-fast, which is ~3.68 MHz and I've never heard of any complaint about ACPI-fast being too low. ;-) That's because it is too low to measure itself being low :-). Nothing prevents us from making a separate timecounter, though. In fact, we can do the same for ACPI-fast/ACPI-safe. However, that'll only confuse users, IMHO. TSC/TSC-low sort of corresponds to ACPI-fast/ACPI-safe. Users can switch between the latter. What they can't do is run both concurrently, either to compare them or use the best one that works in the current context. That would be more developers and is not implemented mainly because it has more complexity (only a tiny amount of extra overhead I think, provided you don't try to keep the 2 times coherent -- just an extra windup for each active timecounter). static void tsc_levels_changed(void *arg, int unit); static struct timecounter tsc_timecounter = { @@ -392,11 +393,19 @@ test_smp_tsc(void) static void init_TSC_tc(void) This seems to only be called once at boot time. So the lowness may be much lower than necessary if the levels are reduced significantly later. It'll only happen when the CPU is started at the highest frequency and TSC is not invariant. In this case, its quality will be set to 800 and HPET or ACPI timecounter will be selected by default. I don't see much problem with the default choice here. Can the CPU be started at a low frequency and throttled up later? I agree that the non-invariant case is not very important. { + uint64_t max_freq; + int shift; if ((cpu_feature CPUID_TSC) == 0 || tsc_disabled) return; /* +* Limit timecounter frequency to fit in an int and prevent it from + * overflowing too fast. +*/ + max_freq = UINT_MAX; + + /* * We can not use the TSC if we support APM. Precise timekeeping * on an APM'ed machine is at best a fools pursuit, since * any and all of the time spent in various SMM code can't @@ -418,13 +427,27 @@ init_TSC_tc(void) * We can not use the TSC in SMP mode unless the TSCs on all CPUs are * synchronized. If the user is sure that the system has synchronized * TSCs, set kern.timecounter.smp_tsc tunable to a non-zero value. +* We also limit the frequency even lower to avoid temporal anomalies + * as much as possible. */ - if (smp_cpus 1) + if (smp_cpus 1) { tsc_timecounter.tc_quality = test_smp_tsc(); + max_freq = 8; + } This gives especially low lowness if the levels are reduced significantly. Maybe as low as 100 MHz 8 = ~390 KHz = lower than an i8254. I don't remember any SMP-capable x86 ever running at 100 MHz unless it is seriously under-clocked. Even if it existed, it won't be available today. :-P Doesn't throttling give underclocking? Maybe not as low as 100 MHz, but quite low. Only a possible problem for the non-invariant case anyway. OTOH, maybe the temporal anomalies scale with the TSC frequency, so you need to right shift by a few irrespective of the TSC frequency. A shift count of 8 seems too much, but if the initial TSC frequency is already 2**32 shifted by 8, then the final shift is 0. This is my main point. How can it be right to reduce the extra shift for SMP (if this shift is needed at all) just because the initial TSC frequency is low? All instructions are clocked, so non-temporalness within a core scales with the current frequency. Oops, this leads back to my previous point that the scaling should depend on the current frequency and not just on the initial frequency. Across cores, it isn't so clear what the non-temporalness scales with. The non-temporalness is FUD so its scaling could be anything :-). ... Perhaps the levels can also be increased significantly later. Then the timecounter frequency may exceed 4.29 GHz despite its scaling. Again, it can only happen when the CPU was started at low frequency and the TSC is not invariant. For that case, TSC won't be selected by default unless both HPET and ACPI timers are disabled/unavailable. But users can select it, and since user's can't control the scaling or even select between TSC/TSC-low, TSC-low must be scaled properly initially to have the best chance of working later. @@ -520,8 +545,15 @@ SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq 0, 0, sysctl_machdep_tsc_freq, QU, Time Stamp Counter frequency); static u_int
svn commit: r223250 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 12:07:06 2011 New Revision: 223250 URL: http://svn.freebsd.org/changeset/base/223250 Log: MFC r220729: Add some new features: - 6000 series devices need enhanced sensitivity calibration. - 6000 series devices need a different setting for the shadow reg. - set the IWN_FLAG_HAS_11N bit if the EEPROM says the device has 11n support. Obtained from:OpenBSD Modified: stable/8/sys/dev/iwn/if_iwn.c stable/8/sys/dev/iwn/if_iwnreg.h stable/8/sys/dev/iwn/if_iwnvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 12:03:30 2011 (r223249) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 12:07:06 2011 (r223250) @@ -1653,6 +1653,12 @@ iwn_read_eeprom(struct iwn_softc *sc, ui } } + iwn_read_prom_data(sc, IWN_EEPROM_SKU_CAP, val, 2); + DPRINTF(sc, IWN_DEBUG_RESET, SKU capabilities=0x%04x\n, le16toh(val)); + /* Check if HT support is bonded out. */ + if (val htole16(IWN_EEPROM_SKU_CAP_11N)) + sc-sc_flags |= IWN_FLAG_HAS_11N; + iwn_read_prom_data(sc, IWN_EEPROM_RFCFG, val, 2); sc-rfcfg = le16toh(val); DPRINTF(sc, IWN_DEBUG_RESET, radio config=0x%04x\n, sc-rfcfg); @@ -4595,9 +4601,11 @@ static int iwn_send_sensitivity(struct iwn_softc *sc) { struct iwn_calib_state *calib = sc-calib; - struct iwn_sensitivity_cmd cmd; + struct iwn_enhanced_sensitivity_cmd cmd; + int len; memset(cmd, 0, sizeof cmd); + len = sizeof (struct iwn_sensitivity_cmd); cmd.which = IWN_SENSITIVITY_WORKTBL; /* OFDM modulation. */ cmd.corr_ofdm_x1 = htole16(calib-ofdm_x1); @@ -4619,7 +4627,21 @@ iwn_send_sensitivity(struct iwn_softc *s calib-ofdm_x1, calib-ofdm_mrc_x1, calib-ofdm_x4, calib-ofdm_mrc_x4, calib-cck_x4, calib-cck_mrc_x4, calib-energy_cck); - return iwn_cmd(sc, IWN_CMD_SET_SENSITIVITY, cmd, sizeof cmd, 1); + + if (!(sc-sc_flags IWN_FLAG_ENH_SENS)) + goto send; + /* Enhanced sensitivity settings. */ + len = sizeof (struct iwn_enhanced_sensitivity_cmd); + cmd.ofdm_det_slope_mrc = htole16(668); + cmd.ofdm_det_icept_mrc = htole16(4); + cmd.ofdm_det_slope = htole16(486); + cmd.ofdm_det_icept = htole16(37); + cmd.cck_det_slope_mrc = htole16(853); + cmd.cck_det_icept_mrc = htole16(4); + cmd.cck_det_slope = htole16(476); + cmd.cck_det_icept = htole16(99); +send: + return iwn_cmd(sc, IWN_CMD_SET_SENSITIVITY, cmd, len, 1); } /* @@ -6175,6 +6197,8 @@ iwn5000_nic_config(struct iwn_softc *sc) /* Indicate that ROM calibration version is =6. */ IWN_SETBITS(sc, IWN_GP_DRIVER, IWN_GP_DRIVER_CALIB_VER6); } + if (sc-hw_type == IWN_HW_REV_TYPE_6005) + IWN_SETBITS(sc, IWN_GP_DRIVER, IWN_GP_DRIVER_6050_1X2); return 0; } @@ -6304,6 +6328,10 @@ iwn_hw_init(struct iwn_softc *sc) IWN_WRITE(sc, IWN_UCODE_GP1_CLR, IWN_UCODE_GP1_RFKILL); IWN_WRITE(sc, IWN_UCODE_GP1_CLR, IWN_UCODE_GP1_RFKILL); + /* Enable shadow registers. */ + if (sc-hw_type = IWN_HW_REV_TYPE_6000) + IWN_SETBITS(sc, IWN_SHADOW_REG_CTRL, 0x800f); + if ((error = ops-load_firmware(sc)) != 0) { device_printf(sc-sc_dev, %s: could not load firmware, error %d\n, __func__, Modified: stable/8/sys/dev/iwn/if_iwnreg.h == --- stable/8/sys/dev/iwn/if_iwnreg.hSat Jun 18 12:03:30 2011 (r223249) +++ stable/8/sys/dev/iwn/if_iwnreg.hSat Jun 18 12:07:06 2011 (r223250) @@ -70,6 +70,7 @@ #define IWN_UCODE_GP1_CLR 0x05c #define IWN_LED0x094 #define IWN_DRAM_INT_TBL 0x0a0 +#define IWN_SHADOW_REG_CTRL0x0a8 #define IWN_GIO_CHICKEN0x100 #define IWN_ANA_PLL0x20c #define IWN_HW_REV_WA 0x22c @@ -215,6 +216,7 @@ #define IWN_GP_DRIVER_RADIO_2X2_HYB(1 0) #define IWN_GP_DRIVER_RADIO_2X2_IPA(2 0) #define IWN_GP_DRIVER_CALIB_VER6 (1 2) +#define IWN_GP_DRIVER_6050_1X2 (1 3) /* Possible flags for register IWN_UCODE_GP1_CLR. */ #define IWN_UCODE_GP1_RFKILL (1 1) @@ -856,7 +858,7 @@ struct iwn_critical_temp { #define IWN_CTOMUK(c) (((c) * 100) + 27315) } __packed; -/* Structure for command IWN_CMD_SET_SENSITIVITY. */ +/* Structures for command IWN_CMD_SET_SENSITIVITY. */
svn commit: r223251 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 12:10:06 2011 New Revision: 223251 URL: http://svn.freebsd.org/changeset/base/223251 Log: MFC r220866-220867: - Pull some features out of the firmware: - If a ENH_SENS TLV section exit the firmware is capable of doing enhanced sensitivity calibration. - Newer devices/firmwares have more calibration commands therefore hardcoding the noise gain/reset commands no longer works. It is supposed to use the next index after the newest calibration type support. Read the command index of the TLV section if available. - Enable DC calibration for all 6000 series devices, except those with an internal PA. - Override the chainmask also for the 6050. Modified: stable/8/sys/dev/iwn/if_iwn.c stable/8/sys/dev/iwn/if_iwnreg.h stable/8/sys/dev/iwn/if_iwnvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 12:07:06 2011 (r223250) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 12:10:06 2011 (r223251) @@ -772,6 +772,8 @@ iwn5000_attach(struct iwn_softc *sc, uin sc-fw_data_maxsz = IWN5000_FW_DATA_MAXSZ; sc-fwsz = IWN5000_FWSZ; sc-sched_txfact_addr = IWN5000_SCHED_TXFACT; + sc-reset_noise_gain = IWN5000_PHY_CALIB_RESET_NOISE_GAIN; + sc-noise_gain = IWN5000_PHY_CALIB_NOISE_GAIN; switch (sc-hw_type) { case IWN_HW_REV_TYPE_5100: @@ -807,6 +809,9 @@ iwn5000_attach(struct iwn_softc *sc, uin case IWN_HW_REV_TYPE_6050: sc-limits = iwn6000_sensitivity_limits; sc-fwname = iwn6050fw; + /* Override chains masks, ROM is known to be broken. */ + sc-txchainmask = IWN_ANT_AB; + sc-rxchainmask = IWN_ANT_AB; break; case IWN_HW_REV_TYPE_6005: sc-limits = iwn6000_sensitivity_limits; @@ -2385,7 +2390,9 @@ iwn5000_rx_calib_results(struct iwn_soft switch (calib-code) { case IWN5000_PHY_CALIB_DC: - if (sc-hw_type == IWN_HW_REV_TYPE_5150) + if ((sc-sc_flags IWN_FLAG_INTERNAL_PA) == 0 + (sc-hw_type == IWN_HW_REV_TYPE_5150 || +sc-hw_type = IWN_HW_REV_TYPE_6000)) idx = 0; break; case IWN5000_PHY_CALIB_LO: @@ -4367,7 +4374,7 @@ iwn5000_init_gains(struct iwn_softc *sc) struct iwn_phy_calib cmd; memset(cmd, 0, sizeof cmd); - cmd.code = IWN5000_PHY_CALIB_RESET_NOISE_GAIN; + cmd.code = sc-reset_noise_gain; cmd.ngroups = 1; cmd.isvalid = 1; DPRINTF(sc, IWN_DEBUG_CALIBRATE, @@ -4419,7 +4426,7 @@ iwn5000_set_gains(struct iwn_softc *sc) div = (sc-hw_type == IWN_HW_REV_TYPE_6050) ? 20 : 30; memset(cmd, 0, sizeof cmd); - cmd.code = IWN5000_PHY_CALIB_NOISE_GAIN; + cmd.code = sc-noise_gain; cmd.ngroups = 1; cmd.isvalid = 1; /* Get first available RX antenna as referential. */ @@ -5900,7 +5907,7 @@ iwn_read_firmware_tlv(struct iwn_softc * const struct iwn_fw_tlv *tlv; const uint8_t *ptr, *end; uint64_t altmask; - uint32_t len; + uint32_t len, tmp; if (fw-size sizeof (*hdr)) { device_printf(sc-sc_dev, %s: firmware too short: %zu bytes\n, @@ -5965,6 +5972,17 @@ iwn_read_firmware_tlv(struct iwn_softc * fw-boot.text = ptr; fw-boot.textsz = len; break; + case IWN_FW_TLV_ENH_SENS: + if (!len) + sc-sc_flags |= IWN_FLAG_ENH_SENS; + break; + case IWN_FW_TLV_PHY_CALIB: + tmp = htole32(*ptr); + if (tmp 253) { + sc-reset_noise_gain = tmp; + sc-noise_gain = tmp + 1; + } + break; default: DPRINTF(sc, IWN_DEBUG_RESET, TLV type %d not handled\n, le16toh(tlv-type)); Modified: stable/8/sys/dev/iwn/if_iwnreg.h == --- stable/8/sys/dev/iwn/if_iwnreg.hSat Jun 18 12:07:06 2011 (r223250) +++ stable/8/sys/dev/iwn/if_iwnreg.hSat Jun 18 12:10:06 2011 (r223251) @@ -1322,6 +1322,8 @@ struct iwn_fw_tlv { #define IWN_FW_TLV_INIT_DATA 4 #define IWN_FW_TLV_BOOT_TEXT 5 #define IWN_FW_TLV_PBREQ_MAXLEN6 +#define
svn commit: r223252 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 12:11:48 2011 New Revision: 223252 URL: http://svn.freebsd.org/changeset/base/223252 Log: MFC r220891: Add basic support for advanced bluetooth coexistence required for 6005 gen2b (1030/6030) adapters. Modified: stable/8/sys/dev/iwn/if_iwn.c stable/8/sys/dev/iwn/if_iwnreg.h stable/8/sys/dev/iwn/if_iwnvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 12:10:06 2011 (r223251) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 12:11:48 2011 (r223252) @@ -253,6 +253,7 @@ static void iwn_tune_sensitivity(struct static int iwn_send_sensitivity(struct iwn_softc *); static int iwn_set_pslevel(struct iwn_softc *, int, int, int); static int iwn_send_btcoex(struct iwn_softc *); +static int iwn_send_advanced_btcoex(struct iwn_softc *); static int iwn_config(struct iwn_softc *); static uint8_t *ieee80211_add_ssid(uint8_t *, const uint8_t *, u_int); static int iwn_scan(struct iwn_softc *); @@ -816,6 +817,8 @@ iwn5000_attach(struct iwn_softc *sc, uin case IWN_HW_REV_TYPE_6005: sc-limits = iwn6000_sensitivity_limits; sc-fwname = iwn6005fw; + if (pid != 0x0082 pid != 0x0085) + sc-sc_flags |= IWN_FLAG_ADV_BTCOEX; break; default: device_printf(sc-sc_dev, adapter type %d not supported\n, @@ -4721,6 +4724,63 @@ iwn_send_btcoex(struct iwn_softc *sc) } static int +iwn_send_advanced_btcoex(struct iwn_softc *sc) +{ + static const uint32_t btcoex_3wire[12] = { + 0x, 0x, 0xaeaa, 0x, + 0xcc00ff28, 0x, 0xcc00, 0x, + 0xc0004000, 0x4000, 0xf0005000, 0xf0005000, + }; + struct iwn6000_btcoex_config btconfig; + struct iwn_btcoex_priotable btprio; + struct iwn_btcoex_prot btprot; + int error, i; + + memset(btconfig, 0, sizeof btconfig); + btconfig.flags = 145; + btconfig.max_kill = 5; + btconfig.bt3_t7_timer = 1; + btconfig.kill_ack = htole32(0x); + btconfig.kill_cts = htole32(0x); + btconfig.sample_time = 2; + btconfig.bt3_t2_timer = 0xc; + for (i = 0; i 12; i++) + btconfig.lookup_table[i] = htole32(btcoex_3wire[i]); + btconfig.valid = htole16(0xff); + btconfig.prio_boost = 0xf0; + DPRINTF(sc, IWN_DEBUG_RESET, + %s: configuring advanced bluetooth coexistence\n, __func__); + error = iwn_cmd(sc, IWN_CMD_BT_COEX, btconfig, sizeof(btconfig), 1); + if (error != 0) + return error; + + memset(btprio, 0, sizeof btprio); + btprio.calib_init1 = 0x6; + btprio.calib_init2 = 0x7; + btprio.calib_periodic_low1 = 0x2; + btprio.calib_periodic_low2 = 0x3; + btprio.calib_periodic_high1 = 0x4; + btprio.calib_periodic_high2 = 0x5; + btprio.dtim = 0x6; + btprio.scan52 = 0x8; + btprio.scan24 = 0xa; + error = iwn_cmd(sc, IWN_CMD_BT_COEX_PRIOTABLE, btprio, sizeof(btprio), + 1); + if (error != 0) + return error; + + /* Force BT state machine change. */ + memset(btprot, 0, sizeof btprio); + btprot.open = 1; + btprot.type = 1; + error = iwn_cmd(sc, IWN_CMD_BT_COEX_PROT, btprot, sizeof(btprot), 1); + if (error != 0) + return error; + btprot.open = 0; + return iwn_cmd(sc, IWN_CMD_BT_COEX_PROT, btprot, sizeof(btprot), 1); +} + +static int iwn_config(struct iwn_softc *sc) { struct iwn_ops *ops = sc-ops; @@ -4756,7 +4816,10 @@ iwn_config(struct iwn_softc *sc) } /* Configure bluetooth coexistence. */ - error = iwn_send_btcoex(sc); + if (sc-sc_flags IWN_FLAG_ADV_BTCOEX) + error = iwn_send_advanced_btcoex(sc); + else + error = iwn_send_btcoex(sc); if (error != 0) { device_printf(sc-sc_dev, %s: could not configure bluetooth coexistence, error %d\n, Modified: stable/8/sys/dev/iwn/if_iwnreg.h == --- stable/8/sys/dev/iwn/if_iwnreg.hSat Jun 18 12:10:06 2011 (r223251) +++ stable/8/sys/dev/iwn/if_iwnreg.hSat Jun 18 12:11:48 2011 (r223252) @@ -434,6 +434,8 @@ struct iwn_tx_cmd { #define IWN_CMD_SET_CRITICAL_TEMP 164 #define IWN_CMD_SET_SENSITIVITY168 #define IWN_CMD_PHY_CALIB 176 +#define IWN_CMD_BT_COEX_PRIOTABLE
svn commit: r223253 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 12:13:27 2011 New Revision: 223253 URL: http://svn.freebsd.org/changeset/base/223253 Log: MFC r220894: The 6000 series gen2 adapters have 2 firmware images, one with advanced btcoex support and one without. Modified: stable/8/sys/dev/iwn/if_iwn.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 12:11:48 2011 (r223252) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 12:13:27 2011 (r223253) @@ -816,9 +816,11 @@ iwn5000_attach(struct iwn_softc *sc, uin break; case IWN_HW_REV_TYPE_6005: sc-limits = iwn6000_sensitivity_limits; - sc-fwname = iwn6005fw; - if (pid != 0x0082 pid != 0x0085) + if (pid != 0x0082 pid != 0x0085) { + sc-fwname = iwn6000g2bfw; sc-sc_flags |= IWN_FLAG_ADV_BTCOEX; + } else + sc-fwname = iwn6000g2afw; break; default: device_printf(sc-sc_dev, adapter type %d not supported\n, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223254 - head/sys/amd64/ia32
Author: kib Date: Sat Jun 18 12:13:28 2011 New Revision: 223254 URL: http://svn.freebsd.org/changeset/base/223254 Log: Fix vfork. Add comments. Modified: head/sys/amd64/ia32/ia32_sigtramp.S Modified: head/sys/amd64/ia32/ia32_sigtramp.S == --- head/sys/amd64/ia32/ia32_sigtramp.S Sat Jun 18 12:13:27 2011 (r223253) +++ head/sys/amd64/ia32/ia32_sigtramp.S Sat Jun 18 12:13:28 2011 (r223254) @@ -79,8 +79,20 @@ ia32_osigcode: jmp 1b +/* + * The lcall $7,$0 emulator cannot use the call gate that does an + * inter-privilege transition. The reason is that the call gate + * does not disable interrupts, and, before the swapgs is + * executed, we would have a window where the ring 0 code is + * executed with the wrong gsbase. + * + * Instead, reflect the lcall $7,$0 back to ring 3 trampoline + * which sets up the frame for int $0x80. + */ ALIGN_TEXT lcall_tramp: + cmpl$SYS_vfork,%eax + je 2f pushl %ebp movl%esp,%ebp pushl 0x24(%ebp) /* arg 6 */ @@ -91,8 +103,19 @@ lcall_tramp: pushl 0x10(%ebp) /* arg 1 */ pushl 0xc(%ebp) /* gap */ int $0x80 - leave + leavel +1: lretl +2: + /* +* vfork handling is special and relies on the libc stub saving +* the return ip in %ecx. If vfork failed, then there is no +* child which can corrupt the frame created by call gate. +*/ + int $0x80 + jb 1b + addl$8,%esp + jmpl*%ecx #endif ALIGN_TEXT ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223257 - stable/8/sys/dev/iwn
Author: bschmidt Date: Sat Jun 18 12:32:48 2011 New Revision: 223257 URL: http://svn.freebsd.org/changeset/base/223257 Log: MFC r220895,221634: Now that all bits are in for 1030/6230 adapters enable those. While here pull the adapter names from the Linux driver and sort the list by ID. Modified: stable/8/sys/dev/iwn/if_iwn.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c == --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 12:30:33 2011 (r223256) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 12:32:48 2011 (r223257) @@ -78,38 +78,33 @@ struct iwn_ident { const char *name; }; -static const struct iwn_ident iwn_ident_table [] = { - { 0x8086, 0x4229, Intel(R) PRO/Wireless 4965BGN }, - { 0x8086, 0x422D, Intel(R) PRO/Wireless 4965BGN }, - { 0x8086, 0x4230, Intel(R) PRO/Wireless 4965BGN }, - { 0x8086, 0x4233, Intel(R) PRO/Wireless 4965BGN }, - { 0x8086, 0x4232, Intel(R) PRO/Wireless 5100 }, - { 0x8086, 0x4237, Intel(R) PRO/Wireless 5100 }, - { 0x8086, 0x423C, Intel(R) PRO/Wireless 5150 }, - { 0x8086, 0x423D, Intel(R) PRO/Wireless 5150 }, - { 0x8086, 0x4235, Intel(R) PRO/Wireless 5300 }, - { 0x8086, 0x4236, Intel(R) PRO/Wireless 5300 }, - { 0x8086, 0x423A, Intel(R) PRO/Wireless 5350 }, - { 0x8086, 0x423B, Intel(R) PRO/Wireless 5350 }, - { 0x8086, 0x0083, Intel(R) PRO/Wireless 1000 }, - { 0x8086, 0x0084, Intel(R) PRO/Wireless 1000 }, - { 0x8086, 0x008D, Intel(R) PRO/Wireless 6000 }, - { 0x8086, 0x008E, Intel(R) PRO/Wireless 6000 }, - { 0x8086, 0x4238, Intel(R) PRO/Wireless 6000 }, - { 0x8086, 0x4239, Intel(R) PRO/Wireless 6000 }, - { 0x8086, 0x422B, Intel(R) PRO/Wireless 6000 }, - { 0x8086, 0x422C, Intel(R) PRO/Wireless 6000 }, - { 0x8086, 0x0087, Intel(R) PRO/Wireless 6250 }, - { 0x8086, 0x0089, Intel(R) PRO/Wireless 6250 }, - { 0x8086, 0x0082, Intel(R) PRO/Wireless 6205a }, - { 0x8086, 0x0085, Intel(R) PRO/Wireless 6205a }, -#ifdef notyet - { 0x8086, 0x008a, Intel(R) PRO/Wireless 6205b }, - { 0x8086, 0x008b, Intel(R) PRO/Wireless 6205b }, - { 0x8086, 0x008f, Intel(R) PRO/Wireless 6205b }, - { 0x8086, 0x0090, Intel(R) PRO/Wireless 6205b }, - { 0x8086, 0x0091, Intel(R) PRO/Wireless 6205b }, -#endif +static const struct iwn_ident iwn_ident_table[] = { + { 0x8086, 0x0082, Intel(R) Centrino(R) Advanced-N 6205 }, + { 0x8086, 0x0083, Intel(R) Centrino(R) Wireless-N 1000 }, + { 0x8086, 0x0084, Intel(R) Centrino(R) Wireless-N 1000 }, + { 0x8086, 0x0085, Intel(R) Centrino(R) Advanced-N 6205 }, + { 0x8086, 0x0087, Intel(R) Centrino(R) Advanced-N + WiMAX 6250 }, + { 0x8086, 0x0089, Intel(R) Centrino(R) Advanced-N + WiMAX 6250 }, + { 0x8086, 0x008a, Intel(R) Centrino(R) Wireless-N 1030 }, + { 0x8086, 0x008b, Intel(R) Centrino(R) Wireless-N 1030 }, + { 0x8086, 0x0090, Intel(R) Centrino(R) Advanced-N 6230 }, + { 0x8086, 0x0091, Intel(R) Centrino(R) Advanced-N 6230 }, + { 0x8086, 0x4229, Intel(R) Wireless WiFi Link 4965 }, + { 0x8086, 0x422b, Intel(R) Centrino(R) Ultimate-N 6300 }, + { 0x8086, 0x422c, Intel(R) Centrino(R) Advanced-N 6200 }, + { 0x8086, 0x422d, Intel(R) Wireless WiFi Link 4965 }, + { 0x8086, 0x4230, Intel(R) Wireless WiFi Link 4965 }, + { 0x8086, 0x4232, Intel(R) WiFi Link 5100 }, + { 0x8086, 0x4233, Intel(R) Wireless WiFi Link 4965 }, + { 0x8086, 0x4235, Intel(R) Ultimate N WiFi Link 5300 }, + { 0x8086, 0x4236, Intel(R) Ultimate N WiFi Link 5300 }, + { 0x8086, 0x4237, Intel(R) WiFi Link 5100 }, + { 0x8086, 0x4238, Intel(R) Centrino(R) Ultimate-N 6300 }, + { 0x8086, 0x4239, Intel(R) Centrino(R) Advanced-N 6200 }, + { 0x8086, 0x423a, Intel(R) WiMAX/WiFi Link 5350}, + { 0x8086, 0x423b, Intel(R) WiMAX/WiFi Link 5350}, + { 0x8086, 0x423c, Intel(R) WiMAX/WiFi Link 5150}, + { 0x8086, 0x423d, Intel(R) WiMAX/WiFi Link 5150}, { 0, 0, NULL } }; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223258 - stable/8/share/man/man4
Author: bschmidt Date: Sat Jun 18 12:35:08 2011 New Revision: 223258 URL: http://svn.freebsd.org/changeset/base/223258 Log: MFC r220896: Add ref to the latest firmware additions. Modified: stable/8/share/man/man4/iwnfw.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/iwnfw.4 == --- stable/8/share/man/man4/iwnfw.4 Sat Jun 18 12:32:48 2011 (r223257) +++ stable/8/share/man/man4/iwnfw.4 Sat Jun 18 12:35:08 2011 (r223258) @@ -22,7 +22,7 @@ .\ .\ $FreeBSD$ .\ -.Dd July 20, 2010 +.Dd April 20, 2011 .Dt IWNFW 4 .Os .Sh NAME @@ -45,6 +45,8 @@ of the following: .Cd device iwn5000fw .Cd device iwn5150fw .Cd device iwn6000fw +.Cd device iwn6000g2afw +.Cd device iwn6000g2bfw .Cd device iwn6050fw .Ed .Pp @@ -57,6 +59,8 @@ iwn1000fw_load=YES iwn5000fw_load=YES iwn5150fw_load=YES iwn6000fw_load=YES +iwn6000g2afw_load=YES +iwn6000g2bfw_load=YES iwn6050fw_load=YES .Ed .Sh DESCRIPTION ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223259 - head/share/man/man9
Author: bz Date: Sat Jun 18 13:03:06 2011 New Revision: 223259 URL: http://svn.freebsd.org/changeset/base/223259 Log: Correct a typo in the function name. MFC after:1 week Modified: head/share/man/man9/device_get_sysctl.9 Modified: head/share/man/man9/device_get_sysctl.9 == --- head/share/man/man9/device_get_sysctl.9 Sat Jun 18 12:35:08 2011 (r223258) +++ head/share/man/man9/device_get_sysctl.9 Sat Jun 18 13:03:06 2011 (r223259) @@ -28,7 +28,7 @@ .\ .\ $FreeBSD$ .\ -.Dd May 23, 2006 +.Dd June 18, 2011 .Dt DEVICE_GET_SYSCTL 9 .Os .Sh NAME @@ -49,7 +49,7 @@ This node can be accessed with the .Fn device_get_sysctl_tree function. The context for the node can be obtained with the -.Fn device_get_sysctl_ctl +.Fn device_get_sysctl_ctx function. .Sh SEE ALSO .Xr device 9 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223260 - head/share/man/man9
Author: bz Date: Sat Jun 18 13:08:46 2011 New Revision: 223260 URL: http://svn.freebsd.org/changeset/base/223260 Log: Install symlinks for m_tag_* mbuf tag functions to the mbuf_tags.9 man page. MFC after:1 week Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile == --- head/share/man/man9/MakefileSat Jun 18 13:03:06 2011 (r223259) +++ head/share/man/man9/MakefileSat Jun 18 13:08:46 2011 (r223260) @@ -860,6 +860,22 @@ MLINKS+=\ mbuf.9 mtod.9 \ mbuf.9 M_TRAILINGSPACE.9 \ mbuf.9 M_WRITABLE.9 +MLINKS+=\ + mbuf_tags.9 m_tag_alloc.9 \ + mbuf_tags.9 m_tag_copy.9 \ + mbuf_tags.9 m_tag_copy_chain.9 \ + mbuf_tags.9 m_tag_delete.9 \ + mbuf_tags.9 m_tag_delete_chain.9 \ + mbuf_tags.9 m_tag_delete_nonpersistent.9 \ + mbuf_tags.9 m_tag_find.9 \ + mbuf_tags.9 m_tag_first.9 \ + mbuf_tags.9 m_tag_free.9 \ + mbuf_tags.9 m_tag_get.9 \ + mbuf_tags.9 m_tag_init.9 \ + mbuf_tags.9 m_tag_locate.9 \ + mbuf_tags.9 m_tag_next.9 \ + mbuf_tags.9 m_tag_prepend.9 \ + mbuf_tags.9 m_tag_unlink.9 MLINKS+=MD5.9 MD5Init.9 \ MD5.9 MD5Transform.9 MLINKS+=mdchain.9 md_append_record.9 \ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223261 - head/sys/netinet
Author: bz Date: Sat Jun 18 13:54:36 2011 New Revision: 223261 URL: http://svn.freebsd.org/changeset/base/223261 Log: Remove a these days incorrect comment left from before new-arp. MFC after:1 week Modified: head/sys/netinet/if_ether.c Modified: head/sys/netinet/if_ether.c == --- head/sys/netinet/if_ether.c Sat Jun 18 13:08:46 2011(r223260) +++ head/sys/netinet/if_ether.c Sat Jun 18 13:54:36 2011(r223261) @@ -759,7 +759,7 @@ match: } } else LLE_WUNLOCK(la); - } /* end of FIB loop */ + } reply: if (op != ARPOP_REQUEST) goto drop; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r223262 - in head: cddl/contrib/opensolaris/lib/libdtrace/common contrib/binutils/bfd contrib/binutils/gas contrib/binutils/gas/config contrib/binutils/ld contrib/binutils/opcodes cont
On Sat, 18 Jun 2011, Ben Laurie wrote: Author: benl Date: Sat Jun 18 13:56:33 2011 New Revision: 223262 URL: http://svn.freebsd.org/changeset/base/223262 Log: Fix clang warnings. Approved by: philip (mentor) Most of these seem to be bugs in clang, so source code can only be broken by avoiding the warnings there. In particular: - casting to void is a large style bug in gnu code. Warnings in vendor code shouldn't be fixed anyway. - it is an old gcc bug to warn about use of the extremely unsurprising precedence of AND operators over OR operators. This bug is not much of a problem since it is controlled by -Wparentheses. -Wparentheses is impiled by -Wall, which is enables at WARNS = 2. But it is a new clang bug to make this warning unconditional (it can be turned off or configured off, but this is not supported in FreeBSD or documented in clang.1). So it is now fatal at WARNS =1, since WARNS =1 turns warnings into errors. Bruce ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r223262 - in head: cddl/contrib/opensolaris/lib/libdtrace/common contrib/binutils/bfd contrib/binutils/gas contrib/binutils/gas/config contrib/binutils/ld contrib/binutils/opcodes cont
On Sat, Jun 18, 2011 at 9:56 AM, Ben Laurie b...@freebsd.org wrote: Author: benl Date: Sat Jun 18 13:56:33 2011 New Revision: 223262 URL: http://svn.freebsd.org/changeset/base/223262 Log:  Fix clang warnings.  Approved by:  philip (mentor) Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c == --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c     Sat Jun 18 13:54:36 2011     (r223261) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c     Sat Jun 18 13:56:33 2011     (r223262) @@ -45,6 +45,7 @@  #include assert.h  #include libgen.h  #include limits.h +#include stdint.h  #include dt_impl.h @@ -811,15 +812,14 @@ dt_basename(char *str)  ulong_t  dt_popc(ulong_t x)  { -#ifdef _ILP32 +#if defined(_ILP32)     x = x - ((x 1) 0xUL);     x = (x 0xUL) + ((x 2) 0xUL);     x = (x + (x 4)) 0x0F0F0F0FUL;     x = x + (x 8);     x = x + (x 16);     return (x 0x3F); -#endif -#ifdef _LP64 +#elif defined(_LP64)     x = x - ((x 1) 0xULL);     x = (x 0xULL) + ((x 2) 0xULL);     x = (x + (x 4)) 0x0F0F0F0F0F0F0F0FULL; @@ -827,6 +827,8 @@ dt_popc(ulong_t x)     x = x + (x 16);     x = x + (x 32);     return (x 0x7F); +#else +# warning need td_popc() implementation We seem to still be in dt_popc(), here. -Ben Kaduk  #endif  } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r223262 - in head: cddl/contrib/opensolaris/lib/libdtrace/common contrib/binutils/bfd contrib/binutils/gas contrib/binutils/gas/config contrib/binutils/ld contrib/binutils/opcodes cont
Modified: head/sys/sys/param.h == --- head/sys/sys/param.h Sat Jun 18 13:54:36 2011(r223261) +++ head/sys/sys/param.h Sat Jun 18 13:56:33 2011(r223262) @@ -319,4 +319,10 @@ __END_DECLS #define member2struct(s, m, x) \ ((struct s *)(void *)((char *)(x) - offsetof(struct s, m))) +/* + * Access a variable length array that has been declared as a fixed + * length array. + */ +#define __PAST_END(array, offset) (((typeof(*(array)) *)(array))[offset]) + #endif /* _SYS_PARAM_H_ */ The typeof there should be __typeof, most likely. pgpkW0Q6BZ4zQ.pgp Description: PGP signature
svn commit: r223264 - in head: etc/defaults etc/rc.d share/man/man5
Author: dougb Date: Sat Jun 18 19:41:05 2011 New Revision: 223264 URL: http://svn.freebsd.org/changeset/base/223264 Log: Add rc.d/kld to load kernel modules after local disks are up. This method is many times faster than doing it in /boot/loader.conf. Added: head/etc/rc.d/kld (contents, props changed) Modified: head/etc/defaults/rc.conf head/etc/rc.d/Makefile head/etc/rc.d/var head/share/man/man5/rc.conf.5 Modified: head/etc/defaults/rc.conf == --- head/etc/defaults/rc.conf Sat Jun 18 15:23:08 2011(r223263) +++ head/etc/defaults/rc.conf Sat Jun 18 19:41:05 2011(r223264) @@ -38,6 +38,7 @@ ddb_enable=NO # Set to YES to load dd ddb_config=/etc/ddb.conf # ddb(8) config file. devd_enable=YES # Run devd, to trigger programs on device tree changes. devd_flags= # Additional flags for devd(8). +#kld_list= # Kernel modules to load after local disks are mounted kldxref_enable=NO# Build linker.hints files with kldxref(8). kldxref_clobber=NO # Overwrite old linker.hints at boot. kldxref_module_path= # Override kern.module_path. A ';'-delimited list. Modified: head/etc/rc.d/Makefile == --- head/etc/rc.d/Makefile Sat Jun 18 15:23:08 2011(r223263) +++ head/etc/rc.d/Makefile Sat Jun 18 19:41:05 2011(r223264) @@ -18,7 +18,7 @@ FILES=DAEMON FILESYSTEMS LOGIN NETWORKI ip6addrctl ipfilter ipfs ipfw ipmon \ ipnat ipsec ipxrouted \ jail \ - kadmind kerberos keyserv kldxref kpasswdd \ + kadmind kerberos keyserv kld kldxref kpasswdd \ ldconfig local localpkg lockd lpd \ mixer motd mountcritlocal mountcritremote mountlate \ mdconfig mdconfig2 mountd moused mroute6d mrouted msgs \ Added: head/etc/rc.d/kld == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/etc/rc.d/kld Sat Jun 18 19:41:05 2011(r223264) @@ -0,0 +1,53 @@ +#!/bin/sh + +# Copyright (c) 2011 Douglas Barton +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +#notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +#notice, this list of conditions and the following disclaimer in the +#documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# +# PROVIDE: kld +# REQUIRE: FILESYSTEMS +# KEYWORD: nojail + +. /etc/rc.subr + +name=kld + +start_cmd=${name}_start +stop_cmd=':' + +kld_start() +{ + [ -n $kld_list ] || return + + local _kld + + echo 'Loading kernel modules:' + for _kld in $kld_list ; do + load_kld -e ${_kld}.ko $_kld + done +} + +load_rc_config $name +run_rc_command $1 Modified: head/etc/rc.d/var == --- head/etc/rc.d/var Sat Jun 18 15:23:08 2011(r223263) +++ head/etc/rc.d/var Sat Jun 18 19:41:05 2011(r223264) @@ -28,7 +28,7 @@ # # PROVIDE: var -# REQUIRE: FILESYSTEMS +# REQUIRE: FILESYSTEMS kld . /etc/rc.subr Modified: head/share/man/man5/rc.conf.5 == --- head/share/man/man5/rc.conf.5 Sat Jun 18 15:23:08 2011 (r223263) +++ head/share/man/man5/rc.conf.5 Sat Jun 18 19:41:05 2011 (r223264) @@ -24,7 +24,7 @@ .\ .\ $FreeBSD$ .\ -.Dd April 27, 2011 +.Dd June 18, 2011 .Dt RC.CONF 5 .Os .Sh NAME @@ -196,6 +196,14 @@ Configuration file for .Xr ddb 8 . Default .Pa /etc/ddb.conf . +.It Va kld_list +.Pq Vt str +A list of kernel modules to load right after the local +disks are mounted. +Loading modules at this point in the boot process is +much faster than doing it via +.Pa /boot/loader.conf +for those
Re: svn commit: r223129 - head/release
On 06/17/11 18:17, Peter Jeremy wrote: On 2011-Jun-15 23:38:15 +, Nathan Whitehornnwhiteh...@freebsd.org wrote: Log: Do not install the rescue tools onto the install CD. Since it is read only, they are very unlikely to be needed and take up a great deal of space. If I've correctly understood this change, I'm not sure this is a positive move. Based on a quick test, removing /rescue saves about 4MB (in reality, the saving should be less because /rescue removes the need for /stand). OTOH, it renders the install CD useless as a recovery fixit disk - whilst the CD is unlikely to need recovery itself, it was useful for recovering hard disks Since all of our install CDs for 9.0 (even the boot-only ones!) will be live CDs, the full versions of everything in /rescue are on the CD in their usual locations in /bin, /sbin, etc. and these can be used just as well for fixing a system as the /rescue tools. -Nathan ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r223262 - in head: cddl/contrib/opensolaris/lib/libdtrace/common contrib/binutils/bfd contrib/binutils/gas contrib/binutils/gas/config contrib/binutils/ld contrib/binutils/opcodes cont
On Sat, Jun 18, 2011 at 01:56:33PM +, Ben Laurie wrote: Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c == --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c Sat Jun 18 13:54:36 2011(r223261) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c Sat Jun 18 13:56:33 2011(r223262) @@ -45,6 +45,7 @@ #include assert.h #include libgen.h #include limits.h +#include stdint.h #include dt_impl.h @@ -811,15 +812,14 @@ dt_basename(char *str) ulong_t dt_popc(ulong_t x) { -#ifdef _ILP32 +#if defined(_ILP32) x = x - ((x 1) 0xUL); x = (x 0xUL) + ((x 2) 0xUL); x = (x + (x 4)) 0x0F0F0F0FUL; x = x + (x 8); x = x + (x 16); return (x 0x3F); -#endif -#ifdef _LP64 +#elif defined(_LP64) x = x - ((x 1) 0xULL); x = (x 0xULL) + ((x 2) 0xULL); x = (x + (x 4)) 0x0F0F0F0F0F0F0F0FULL; @@ -827,6 +827,8 @@ dt_popc(ulong_t x) x = x + (x 16); x = x + (x 32); return (x 0x7F); +#else +# warning need td_popc() implementation #endif } This commit uncovers breakage that had been present for a while. If I compile this on stable/8 i386 for head i386, _ILP32 is not defined and the warning is hit, breaking the build. Apparently, the code had been broken for a while but I do not use dtrace so I would not have noticed. The tinderboxes have now also noticed the problem so it is not something weird about my system. -- Jilles Tjoelker ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223267 - head/usr.sbin/mfiutil
Author: bz Date: Sat Jun 18 21:08:27 2011 New Revision: 223267 URL: http://svn.freebsd.org/changeset/base/223267 Log: Add 'show logstate' to usage(). MFC after:1 week Modified: head/usr.sbin/mfiutil/mfiutil.c Modified: head/usr.sbin/mfiutil/mfiutil.c == --- head/usr.sbin/mfiutil/mfiutil.c Sat Jun 18 19:58:09 2011 (r223266) +++ head/usr.sbin/mfiutil/mfiutil.c Sat Jun 18 21:08:27 2011 (r223267) @@ -58,6 +58,7 @@ usage(void) fprintf(stderr, show drives - list physical drives\n); fprintf(stderr, show events - display event log\n); fprintf(stderr, show firmware - list firmware images\n); + fprintf(stderr, show logstate - display event log sequence numbers\n); fprintf(stderr, show volumes - list logical volumes\n); fprintf(stderr, show patrol - display patrol read status\n); fprintf(stderr, show progress - display status of active operations\n); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223269 - head/lib/libprocstat
Author: jilles Date: Sat Jun 18 21:29:25 2011 New Revision: 223269 URL: http://svn.freebsd.org/changeset/base/223269 Log: libprocstat: Correct format for size_t (should be %zu, not %zd). Modified: head/lib/libprocstat/libprocstat.c Modified: head/lib/libprocstat/libprocstat.c == --- head/lib/libprocstat/libprocstat.c Sat Jun 18 21:10:03 2011 (r223268) +++ head/lib/libprocstat/libprocstat.c Sat Jun 18 21:29:25 2011 (r223269) @@ -191,7 +191,7 @@ procstat_getprocs(struct procstat *procs len = *count * sizeof(*p); p = malloc(len); if (p == NULL) { - warnx(malloc(%zd), len); + warnx(malloc(%zu), len); goto fail; } bcopy(p0, p, len); @@ -213,7 +213,7 @@ procstat_getprocs(struct procstat *procs } p = malloc(len); if (p == NULL) { - warnx(malloc(%zd), len); + warnx(malloc(%zu), len); goto fail; } error = sysctl(name, 4, p, len, NULL, 0); @@ -426,7 +426,7 @@ procstat_getfiles_kvm(struct procstat *p nfiles = filed.fd_lastfile + 1; ofiles = malloc(nfiles * sizeof(struct file *)); if (ofiles == NULL) { - warn(malloc(%zd), nfiles * sizeof(struct file *)); + warn(malloc(%zu), nfiles * sizeof(struct file *)); goto do_mmapped; } if (!kvm_read_all(kd, (unsigned long)filed.fd_ofiles, ofiles, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223270 - head/lib/libprocstat
Author: jilles Date: Sat Jun 18 21:46:11 2011 New Revision: 223270 URL: http://svn.freebsd.org/changeset/base/223270 Log: libprocstat: Remove spaces between function name and open parenthesis. Modified: head/lib/libprocstat/libprocstat.c Modified: head/lib/libprocstat/libprocstat.c == --- head/lib/libprocstat/libprocstat.c Sat Jun 18 21:29:25 2011 (r223269) +++ head/lib/libprocstat/libprocstat.c Sat Jun 18 21:46:11 2011 (r223270) @@ -271,11 +271,11 @@ procstat_freefiles(struct procstat *proc } free(head); if (procstat-vmentries != NULL) { - free (procstat-vmentries); + free(procstat-vmentries); procstat-vmentries = NULL; } if (procstat-files != NULL) { - free (procstat-files); + free(procstat-files); procstat-files = NULL; } } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223271 - head/usr.bin/fstat
Author: jilles Date: Sat Jun 18 21:53:36 2011 New Revision: 223271 URL: http://svn.freebsd.org/changeset/base/223271 Log: fuser: Fix skipping SIG on signal names (-s). The code did !strncasecmp(str, sig, 4) which is not useful. Also change sig to SIG matching the uppercase signal names as of r218285. This has little effect because fuser does not enable locale. Modified: head/usr.bin/fstat/fuser.c Modified: head/usr.bin/fstat/fuser.c == --- head/usr.bin/fstat/fuser.c Sat Jun 18 21:46:11 2011(r223270) +++ head/usr.bin/fstat/fuser.c Sat Jun 18 21:53:36 2011(r223271) @@ -358,9 +358,8 @@ str2sig(const char *str) { int i; -#defineSIGPREFIX sig - if (!strncasecmp(str, SIGPREFIX, sizeof(SIGPREFIX))) - str += sizeof(SIGPREFIX); + if (!strncasecmp(str, SIG, 3)) + str += 3; for (i = 1; i sys_nsig; i++) { if (!strcasecmp(sys_signame[i], str)) return (i); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223272 - in stable/8/sys: netinet netinet6
Author: bz Date: Sat Jun 18 22:09:22 2011 New Revision: 223272 URL: http://svn.freebsd.org/changeset/base/223272 Log: MFC r72: Add FEATURE() definitions for IPv4 and IPv6 so that we can use feature_present(3) to dynamically decide whether to use one or the other family. Modified: stable/8/sys/netinet/in_proto.c stable/8/sys/netinet6/in6_proto.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netinet/in_proto.c == --- stable/8/sys/netinet/in_proto.c Sat Jun 18 21:53:36 2011 (r223271) +++ stable/8/sys/netinet/in_proto.c Sat Jun 18 22:09:22 2011 (r223272) @@ -93,6 +93,8 @@ static struct pr_usrreqs nousrreqs; #include net/if_pfsync.h #endif +FEATURE(inet, Internet Protocol version 4); + extern struct domain inetdomain; /* Spacer for loadable protocols. */ Modified: stable/8/sys/netinet6/in6_proto.c == --- stable/8/sys/netinet6/in6_proto.c Sat Jun 18 21:53:36 2011 (r223271) +++ stable/8/sys/netinet6/in6_proto.c Sat Jun 18 22:09:22 2011 (r223272) @@ -128,6 +128,7 @@ __FBSDID($FreeBSD$); /* * TCP/IP protocol family: IP6, ICMP6, UDP, TCP. */ +FEATURE(inet6, Internet Protocol version 6); extern struct domain inet6domain; static struct pr_usrreqs nousrreqs; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223273 - in stable/7/sys: netinet netinet6
Author: bz Date: Sat Jun 18 22:09:44 2011 New Revision: 223273 URL: http://svn.freebsd.org/changeset/base/223273 Log: MFC r72: Add FEATURE() definitions for IPv4 and IPv6 so that we can use feature_present(3) to dynamically decide whether to use one or the other family. Modified: stable/7/sys/netinet/in_proto.c stable/7/sys/netinet6/in6_proto.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/netinet/in_proto.c == --- stable/7/sys/netinet/in_proto.c Sat Jun 18 22:09:22 2011 (r223272) +++ stable/7/sys/netinet/in_proto.c Sat Jun 18 22:09:44 2011 (r223273) @@ -91,6 +91,8 @@ static struct pr_usrreqs nousrreqs; #include netinet/ip_carp.h #endif +FEATURE(inet, Internet Protocol version 4); + extern struct domain inetdomain; /* Spacer for loadable protocols. */ Modified: stable/7/sys/netinet6/in6_proto.c == --- stable/7/sys/netinet6/in6_proto.c Sat Jun 18 22:09:22 2011 (r223272) +++ stable/7/sys/netinet6/in6_proto.c Sat Jun 18 22:09:44 2011 (r223273) @@ -127,6 +127,7 @@ __FBSDID($FreeBSD$); /* * TCP/IP protocol family: IP6, ICMP6, UDP, TCP. */ +FEATURE(inet6, Internet Protocol version 6); extern struct domain inet6domain; static struct pr_usrreqs nousrreqs; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223274 - stable/8/usr.sbin/mfiutil
Author: bz Date: Sat Jun 18 22:12:17 2011 New Revision: 223274 URL: http://svn.freebsd.org/changeset/base/223274 Log: MFC r219722 (by jhb): Preserve errno in an error case. Submitted by: gcooper MFC r222899: Contrary to when returning in all-good cases at the end of functions we did not free memory (1) or close the file descriptor (2) in error cases. Reported by:Mark Johnston (1) Reported by:attilio (2) Reviewed by:jhb Sponsored by: Sandvine Incorporated Modified: stable/8/usr.sbin/mfiutil/mfi_config.c stable/8/usr.sbin/mfiutil/mfi_drive.c stable/8/usr.sbin/mfiutil/mfi_evt.c stable/8/usr.sbin/mfiutil/mfi_flash.c stable/8/usr.sbin/mfiutil/mfi_patrol.c stable/8/usr.sbin/mfiutil/mfi_show.c stable/8/usr.sbin/mfiutil/mfi_volume.c Directory Properties: stable/8/usr.sbin/mfiutil/ (props changed) Modified: stable/8/usr.sbin/mfiutil/mfi_config.c == --- stable/8/usr.sbin/mfiutil/mfi_config.c Sat Jun 18 22:09:44 2011 (r223273) +++ stable/8/usr.sbin/mfiutil/mfi_config.c Sat Jun 18 22:12:17 2011 (r223274) @@ -85,6 +85,7 @@ mfi_config_read(int fd, struct mfi_confi { struct mfi_config_data *config; uint32_t config_size; + int error; /* * Keep fetching the config in a loop until we have a large enough @@ -97,8 +98,12 @@ fetch: if (config == NULL) return (-1); if (mfi_dcmd_command(fd, MFI_DCMD_CFG_READ, config, - config_size, NULL, 0, NULL) 0) + config_size, NULL, 0, NULL) 0) { + error = errno; + free(config); + errno = error; return (-1); + } if (config-size config_size) { config_size = config-size; @@ -162,12 +167,14 @@ clear_config(int ac, char **av) if (!mfi_reconfig_supported()) { warnx(The current mfi(4) driver does not support configuration changes.); + close(fd); return (EOPNOTSUPP); } if (mfi_ld_get_list(fd, list, NULL) 0) { error = errno; warn(Failed to get volume list); + close(fd); return (error); } @@ -175,6 +182,7 @@ clear_config(int ac, char **av) if (mfi_volume_busy(fd, list.ld_list[i].ld.v.target_id)) { warnx(Volume %s is busy and cannot be deleted, mfi_volume_name(fd, list.ld_list[i].ld.v.target_id)); + close(fd); return (EBUSY); } } @@ -185,12 +193,14 @@ clear_config(int ac, char **av) ch = getchar(); if (ch != 'y' ch != 'Y') { printf(\nAborting\n); + close(fd); return (0); } if (mfi_dcmd_command(fd, MFI_DCMD_CFG_CLEAR, NULL, 0, NULL, 0, NULL) 0) { error = errno; warn(Failed to clear configuration); + close(fd); return (error); } @@ -336,17 +346,21 @@ parse_array(int fd, int raid_type, char for (pinfo = info-drives; (cp = strsep(array_str, ,)) != NULL; pinfo++) { error = mfi_lookup_drive(fd, cp, device_id); - if (error) + if (error) { + free(info-drives); return (error); + } if (mfi_pd_get_info(fd, device_id, pinfo, NULL) 0) { error = errno; warn(Failed to fetch drive info for drive %s, cp); + free(info-drives); return (error); } if (pinfo-fw_state != MFI_PD_STATE_UNCONFIGURED_GOOD) { warnx(Drive %u is not available, device_id); + free(info-drives); return (EINVAL); } } @@ -551,7 +565,12 @@ create_volume(int ac, char **av) return (EINVAL); } - + bzero(state, sizeof(state)); + config = NULL; + arrays = NULL; + narrays = 0; + error = 0; + fd = mfi_open(mfi_unit); if (fd 0) { error = errno; @@ -562,7 +581,8 @@ create_volume(int ac, char **av) if (!mfi_reconfig_supported()) { warnx(The current mfi(4) driver does not support configuration changes.); - return (EOPNOTSUPP); + error = EOPNOTSUPP; + goto error; } /* Lookup the RAID type first. */ @@ -575,7 +595,8 @@ create_volume(int ac, char **av) if (raid_type == -1) { warnx(Unknown or unsupported volume type %s, av[1]); - return (EINVAL);
svn commit: r223275 - stable/7/usr.sbin/mfiutil
Author: bz Date: Sat Jun 18 22:12:53 2011 New Revision: 223275 URL: http://svn.freebsd.org/changeset/base/223275 Log: MFC r219722 (by jhb): Preserve errno in an error case. Submitted by: gcooper MFC r222899: Contrary to when returning in all-good cases at the end of functions we did not free memory (1) or close the file descriptor (2) in error cases. Reported by:Mark Johnston (1) Reported by:attilio (2) Reviewed by:jhb Sponsored by: Sandvine Incorporated Modified: stable/7/usr.sbin/mfiutil/mfi_config.c stable/7/usr.sbin/mfiutil/mfi_drive.c stable/7/usr.sbin/mfiutil/mfi_evt.c stable/7/usr.sbin/mfiutil/mfi_flash.c stable/7/usr.sbin/mfiutil/mfi_patrol.c stable/7/usr.sbin/mfiutil/mfi_show.c stable/7/usr.sbin/mfiutil/mfi_volume.c Directory Properties: stable/7/usr.sbin/mfiutil/ (props changed) Modified: stable/7/usr.sbin/mfiutil/mfi_config.c == --- stable/7/usr.sbin/mfiutil/mfi_config.c Sat Jun 18 22:12:17 2011 (r223274) +++ stable/7/usr.sbin/mfiutil/mfi_config.c Sat Jun 18 22:12:53 2011 (r223275) @@ -85,6 +85,7 @@ mfi_config_read(int fd, struct mfi_confi { struct mfi_config_data *config; uint32_t config_size; + int error; /* * Keep fetching the config in a loop until we have a large enough @@ -97,8 +98,12 @@ fetch: if (config == NULL) return (-1); if (mfi_dcmd_command(fd, MFI_DCMD_CFG_READ, config, - config_size, NULL, 0, NULL) 0) + config_size, NULL, 0, NULL) 0) { + error = errno; + free(config); + errno = error; return (-1); + } if (config-size config_size) { config_size = config-size; @@ -162,12 +167,14 @@ clear_config(int ac, char **av) if (!mfi_reconfig_supported()) { warnx(The current mfi(4) driver does not support configuration changes.); + close(fd); return (EOPNOTSUPP); } if (mfi_ld_get_list(fd, list, NULL) 0) { error = errno; warn(Failed to get volume list); + close(fd); return (error); } @@ -175,6 +182,7 @@ clear_config(int ac, char **av) if (mfi_volume_busy(fd, list.ld_list[i].ld.v.target_id)) { warnx(Volume %s is busy and cannot be deleted, mfi_volume_name(fd, list.ld_list[i].ld.v.target_id)); + close(fd); return (EBUSY); } } @@ -185,12 +193,14 @@ clear_config(int ac, char **av) ch = getchar(); if (ch != 'y' ch != 'Y') { printf(\nAborting\n); + close(fd); return (0); } if (mfi_dcmd_command(fd, MFI_DCMD_CFG_CLEAR, NULL, 0, NULL, 0, NULL) 0) { error = errno; warn(Failed to clear configuration); + close(fd); return (error); } @@ -336,17 +346,21 @@ parse_array(int fd, int raid_type, char for (pinfo = info-drives; (cp = strsep(array_str, ,)) != NULL; pinfo++) { error = mfi_lookup_drive(fd, cp, device_id); - if (error) + if (error) { + free(info-drives); return (error); + } if (mfi_pd_get_info(fd, device_id, pinfo, NULL) 0) { error = errno; warn(Failed to fetch drive info for drive %s, cp); + free(info-drives); return (error); } if (pinfo-fw_state != MFI_PD_STATE_UNCONFIGURED_GOOD) { warnx(Drive %u is not available, device_id); + free(info-drives); return (EINVAL); } } @@ -551,7 +565,12 @@ create_volume(int ac, char **av) return (EINVAL); } - + bzero(state, sizeof(state)); + config = NULL; + arrays = NULL; + narrays = 0; + error = 0; + fd = mfi_open(mfi_unit); if (fd 0) { error = errno; @@ -562,7 +581,8 @@ create_volume(int ac, char **av) if (!mfi_reconfig_supported()) { warnx(The current mfi(4) driver does not support configuration changes.); - return (EOPNOTSUPP); + error = EOPNOTSUPP; + goto error; } /* Lookup the RAID type first. */ @@ -575,7 +595,8 @@ create_volume(int ac, char **av) if (raid_type == -1) { warnx(Unknown or unsupported volume type %s, av[1]); - return (EINVAL); +
svn commit: r223276 - head/lib/libprocstat
Author: jilles Date: Sat Jun 18 22:16:55 2011 New Revision: 223276 URL: http://svn.freebsd.org/changeset/base/223276 Log: libprocstat: Fix typo in error messages. Modified: head/lib/libprocstat/libprocstat.c Modified: head/lib/libprocstat/libprocstat.c == --- head/lib/libprocstat/libprocstat.c Sat Jun 18 22:12:53 2011 (r223275) +++ head/lib/libprocstat/libprocstat.c Sat Jun 18 22:16:55 2011 (r223276) @@ -229,7 +229,7 @@ procstat_getprocs(struct procstat *procs *count = len / sizeof(*p); return (p); } else { - warnx(unknown access method); + warnx(unknown access method: %d, procstat-type); return (NULL); } fail: @@ -726,7 +726,7 @@ procstat_get_pipe_info(struct procstat * } else if (procstat-type == PROCSTAT_SYSCTL) { return (procstat_get_pipe_info_sysctl(fst, ps, errbuf)); } else { - warnx(unknow access method: %d, procstat-type); + warnx(unknown access method: %d, procstat-type); snprintf(errbuf, _POSIX2_LINE_MAX, error); return (1); } @@ -790,7 +790,7 @@ procstat_get_pts_info(struct procstat *p } else if (procstat-type == PROCSTAT_SYSCTL) { return (procstat_get_pts_info_sysctl(fst, pts, errbuf)); } else { - warnx(unknow access method: %d, procstat-type); + warnx(unknown access method: %d, procstat-type); snprintf(errbuf, _POSIX2_LINE_MAX, error); return (1); } @@ -852,7 +852,7 @@ procstat_get_vnode_info(struct procstat } else if (procstat-type == PROCSTAT_SYSCTL) { return (procstat_get_vnode_info_sysctl(fst, vn, errbuf)); } else { - warnx(unknow access method: %d, procstat-type); + warnx(unknown access method: %d, procstat-type); snprintf(errbuf, _POSIX2_LINE_MAX, error); return (1); } @@ -1059,7 +1059,7 @@ procstat_get_socket_info(struct procstat } else if (procstat-type == PROCSTAT_SYSCTL) { return (procstat_get_socket_info_sysctl(fst, sock, errbuf)); } else { - warnx(unknow access method: %d, procstat-type); + warnx(unknown access method: %d, procstat-type); snprintf(errbuf, _POSIX2_LINE_MAX, error); return (1); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223277 - head/sys/cam/ata
Author: kib Date: Sat Jun 18 22:26:58 2011 New Revision: 223277 URL: http://svn.freebsd.org/changeset/base/223277 Log: Fix a typo in adagetattr() from r223089. In particular, this restores the ability to use ahci(4) for kernel dumps. Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c == --- head/sys/cam/ata/ata_da.c Sat Jun 18 22:16:55 2011(r223276) +++ head/sys/cam/ata/ata_da.c Sat Jun 18 22:26:58 2011(r223277) @@ -818,7 +818,7 @@ adagetattr(struct bio *bp) int ret = -1; struct cam_periph *periph; - if (bp-bio_disk == NULL || bp-bio_disk-d_drv1) + if (bp-bio_disk == NULL || bp-bio_disk-d_drv1 == NULL) return ENXIO; periph = (struct cam_periph *)bp-bio_disk-d_drv1; if (periph-path == NULL) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223278 - head/sbin/ddb
Author: pjd Date: Sat Jun 18 22:32:55 2011 New Revision: 223278 URL: http://svn.freebsd.org/changeset/base/223278 Log: Correct subcommand name 'unset' - 'unscript'. Modified: head/sbin/ddb/ddb.8 Modified: head/sbin/ddb/ddb.8 == --- head/sbin/ddb/ddb.8 Sat Jun 18 22:26:58 2011(r223277) +++ head/sbin/ddb/ddb.8 Sat Jun 18 22:32:55 2011(r223278) @@ -126,7 +126,7 @@ it is advisable to enclose in quotes. .It Cm scripts List currently defined scripts. -.It Cm unset Ar scriptname +.It Cm unscript Ar scriptname Delete the script named .Ar scriptname . .El ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223279 - head/lib/libprocstat
Author: jilles Date: Sat Jun 18 23:01:26 2011 New Revision: 223279 URL: http://svn.freebsd.org/changeset/base/223279 Log: libprocstat: For MAP_PRIVATE, do not consider the file open for writing. If a file is mapped with with MAP_PRIVATE, no write permission is required and changes do not end up in the file. Therefore, tools like fuser and fstat should not show the file as open for writing. The protection as displayed by procstat -v still includes write in this case, and shows 'C' for copy-on-write. Modified: head/lib/libprocstat/libprocstat.c Modified: head/lib/libprocstat/libprocstat.c == --- head/lib/libprocstat/libprocstat.c Sat Jun 18 22:32:55 2011 (r223278) +++ head/lib/libprocstat/libprocstat.c Sat Jun 18 23:01:26 2011 (r223279) @@ -522,7 +522,8 @@ do_mmapped: fflags = 0; if (prot VM_PROT_READ) fflags = PS_FST_FFLAG_READ; - if (prot VM_PROT_WRITE) + if ((vmentry.eflags MAP_ENTRY_COW) == 0 + prot VM_PROT_WRITE) fflags |= PS_FST_FFLAG_WRITE; /* @@ -696,7 +697,8 @@ procstat_getfiles_sysctl(struct procstat fflags = 0; if (kve-kve_protection KVME_PROT_READ) fflags = PS_FST_FFLAG_READ; - if (kve-kve_protection KVME_PROT_WRITE) + if ((kve-kve_flags KVME_FLAG_COW) == 0 + kve-kve_protection KVME_PROT_WRITE) fflags |= PS_FST_FFLAG_WRITE; offset = kve-kve_offset; refcount = kve-kve_ref_count; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223280 - in head/sys: fs/nfs fs/nfsclient modules/dtrace modules/dtrace/dtnfscl modules/dtrace/dtraceall sys
Author: rmacklem Date: Sat Jun 18 23:02:53 2011 New Revision: 223280 URL: http://svn.freebsd.org/changeset/base/223280 Log: Add DTrace support to the new NFS client. This is essentially cloned from the old NFS client, plus additions for NFSv4. A review of this code is in progress, however it was felt by the reviewer that it could go in now, before code slush. Any changes required by the review can be committed as bug fixes later. Added: head/sys/fs/nfsclient/nfs_clkdtrace.c (contents, props changed) head/sys/fs/nfsclient/nfs_kdtrace.h (contents, props changed) head/sys/modules/dtrace/dtnfscl/ head/sys/modules/dtrace/dtnfscl/Makefile (contents, props changed) Modified: head/sys/fs/nfs/nfs_commonkrpc.c head/sys/fs/nfs/nfsport.h head/sys/fs/nfs/nfsproto.h head/sys/fs/nfsclient/nfs_clbio.c head/sys/fs/nfsclient/nfs_clnode.c head/sys/fs/nfsclient/nfs_clport.c head/sys/fs/nfsclient/nfs_clsubs.c head/sys/fs/nfsclient/nfs_clvnops.c head/sys/modules/dtrace/Makefile head/sys/modules/dtrace/dtraceall/dtraceall.c head/sys/sys/dtrace_bsd.h Modified: head/sys/fs/nfs/nfs_commonkrpc.c == --- head/sys/fs/nfs/nfs_commonkrpc.cSat Jun 18 23:01:26 2011 (r223279) +++ head/sys/fs/nfs/nfs_commonkrpc.cSat Jun 18 23:02:53 2011 (r223280) @@ -39,6 +39,7 @@ __FBSDID($FreeBSD$); */ #include opt_inet6.h +#include opt_kdtrace.h #include opt_kgssapi.h #include opt_nfs.h @@ -64,6 +65,28 @@ __FBSDID($FreeBSD$); #include fs/nfs/nfsport.h +#ifdef KDTRACE_HOOKS +#include sys/dtrace_bsd.h + +dtrace_nfsclient_nfs23_start_probe_func_t + dtrace_nfscl_nfs234_start_probe; + +dtrace_nfsclient_nfs23_done_probe_func_t + dtrace_nfscl_nfs234_done_probe; + +/* + * Registered probes by RPC type. + */ +uint32_t nfscl_nfs2_start_probes[NFS_NPROCS + 1]; +uint32_t nfscl_nfs2_done_probes[NFS_NPROCS + 1]; + +uint32_t nfscl_nfs3_start_probes[NFS_NPROCS + 1]; +uint32_t nfscl_nfs3_done_probes[NFS_NPROCS + 1]; + +uint32_t nfscl_nfs4_start_probes[NFS_NPROCS + 1]; +uint32_t nfscl_nfs4_done_probes[NFS_NPROCS + 1]; +#endif + NFSSTATESPINLOCK; NFSREQSPINLOCK; extern struct nfsstats newnfsstats; @@ -568,6 +591,29 @@ newnfs_request(struct nfsrv_descript *nd if ((nd-nd_flag ND_NFSV4) procnum == NFSV4PROC_COMPOUND) MALLOC(rep, struct nfsreq *, sizeof(struct nfsreq), M_NFSDREQ, M_WAITOK); +#ifdef KDTRACE_HOOKS + if (dtrace_nfscl_nfs234_start_probe != NULL) { + uint32_t probe_id; + int probe_procnum; + + if (nd-nd_flag ND_NFSV4) { + probe_id = + nfscl_nfs4_start_probes[nd-nd_procnum]; + probe_procnum = nd-nd_procnum; + } else if (nd-nd_flag ND_NFSV3) { + probe_id = nfscl_nfs3_start_probes[procnum]; + probe_procnum = procnum; + } else { + probe_id = + nfscl_nfs2_start_probes[nd-nd_procnum]; + probe_procnum = procnum; + } + if (probe_id != 0) + (dtrace_nfscl_nfs234_start_probe) + (probe_id, vp, nd-nd_mreq, cred, +probe_procnum); + } +#endif } trycnt = 0; tryagain: @@ -762,6 +808,27 @@ tryagain: } } +#ifdef KDTRACE_HOOKS + if (nmp != NULL dtrace_nfscl_nfs234_done_probe != NULL) { + uint32_t probe_id; + int probe_procnum; + + if (nd-nd_flag ND_NFSV4) { + probe_id = nfscl_nfs4_done_probes[nd-nd_procnum]; + probe_procnum = nd-nd_procnum; + } else if (nd-nd_flag ND_NFSV3) { + probe_id = nfscl_nfs3_done_probes[procnum]; + probe_procnum = procnum; + } else { + probe_id = nfscl_nfs2_done_probes[nd-nd_procnum]; + probe_procnum = procnum; + } + if (probe_id != 0) + (dtrace_nfscl_nfs234_done_probe)(probe_id, vp, + nd-nd_mreq, cred, probe_procnum, 0); + } +#endif + m_freem(nd-nd_mreq); AUTH_DESTROY(auth); if (rep != NULL) Modified: head/sys/fs/nfs/nfsport.h == --- head/sys/fs/nfs/nfsport.h Sat Jun 18 23:01:26 2011(r223279) +++ head/sys/fs/nfs/nfsport.h Sat Jun 18 23:02:53 2011(r223280) @@ -267,6 +267,7 @@ *
svn commit: r223281 - head/bin/sh
Author: jilles Date: Sat Jun 18 23:43:28 2011 New Revision: 223281 URL: http://svn.freebsd.org/changeset/base/223281 Log: sh: Add do-nothing -h option. POSIX requires a -h option to sh and set, to locate and remember utilities invoked by functions as they are defined. Given that this locate-and-remember process is optional elsewhere, it seems safe enough to make this option do nothing. POSIX does not specify a long name for this option. Follow ksh in calling it trackall. Modified: head/bin/sh/options.h head/bin/sh/sh.1 Modified: head/bin/sh/options.h == --- head/bin/sh/options.h Sat Jun 18 23:02:53 2011(r223280) +++ head/bin/sh/options.h Sat Jun 18 23:43:28 2011(r223281) @@ -62,8 +62,9 @@ struct shparam { #defineprivileged optlist[15].val #defineTflag optlist[16].val #definePflag optlist[17].val +#definehflag optlist[18].val -#define NOPTS 18 +#define NOPTS 19 struct optent { const char *name; @@ -91,6 +92,7 @@ struct optent optlist[NOPTS] = { { privileged, 'p',0 }, { trapsasync, 'T',0 }, { physical, 'P',0 }, + { trackall, 'h',0 }, }; #else extern struct optent optlist[NOPTS]; Modified: head/bin/sh/sh.1 == --- head/bin/sh/sh.1Sat Jun 18 23:02:53 2011(r223280) +++ head/bin/sh/sh.1Sat Jun 18 23:43:28 2011(r223281) @@ -32,7 +32,7 @@ .\from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\ $FreeBSD$ .\ -.Dd June 17, 2011 +.Dd June 18, 2011 .Dt SH 1 .Os .Sh NAME @@ -241,6 +241,10 @@ tested, all commands of the function are well. .It Fl f Li noglob Disable pathname expansion. +.It Fl h Li trackall +A do-nothing option for +.Tn POSIX +compliance. .It Fl I Li ignoreeof Ignore .Dv EOF Ap s ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223283 - head/tools/regression/bin/sh/execution
Author: jilles Date: Sun Jun 19 00:00:36 2011 New Revision: 223283 URL: http://svn.freebsd.org/changeset/base/223283 Log: sh: Add test for r223282. Added: head/tools/regression/bin/sh/execution/bg4.0 (contents, props changed) Added: head/tools/regression/bin/sh/execution/bg4.0 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/bg4.0Sun Jun 19 00:00:36 2011(r223283) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +x='' +: ${x:=1} +wait +exit ${x:-0} ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223284 - stable/8/sys/fs/nfsserver
Author: rmacklem Date: Sun Jun 19 01:44:50 2011 New Revision: 223284 URL: http://svn.freebsd.org/changeset/base/223284 Log: MFC: r222663 Modify the new NFS server so that the NFSv3 Pathconf RPC doesn't return an error when the underlying file system lacks support for any of the four _PC_xxx values used, by falling back to default values. Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c == --- stable/8/sys/fs/nfsserver/nfs_nfsdport.cSun Jun 19 00:00:36 2011 (r223283) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.cSun Jun 19 01:44:50 2011 (r223284) @@ -2589,6 +2589,36 @@ nfsvno_pathconf(struct vnode *vp, int fl int error; error = VOP_PATHCONF(vp, flag, retf); + if (error == EOPNOTSUPP || error == EINVAL) { + /* +* Some file systems return EINVAL for name arguments not +* supported and some return EOPNOTSUPP for this case. +* So the NFSv3 Pathconf RPC doesn't fail for these cases, +* just fake them. +*/ + switch (flag) { + case _PC_LINK_MAX: + *retf = LINK_MAX; + break; + case _PC_NAME_MAX: + *retf = NAME_MAX; + break; + case _PC_CHOWN_RESTRICTED: + *retf = 1; + break; + case _PC_NO_TRUNC: + *retf = 1; + break; + default: + /* +* Only happens if a _PC_xxx is added to the server, +* but this isn't updated. +*/ + *retf = 0; + printf(nfsrvd pathconf flag=%d not supp\n, flag); + }; + error = 0; + } return (error); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223285 - stable/8/sys/fs/nfsclient
Author: rmacklem Date: Sun Jun 19 02:03:12 2011 New Revision: 223285 URL: http://svn.freebsd.org/changeset/base/223285 Log: MFC: r222718 Fix the new NFSv4 client so that it doesn't crash when a mount is done for a VIMAGE kernel. Modified: stable/8/sys/fs/nfsclient/nfs_clport.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clport.c == --- stable/8/sys/fs/nfsclient/nfs_clport.c Sun Jun 19 01:44:50 2011 (r223284) +++ stable/8/sys/fs/nfsclient/nfs_clport.c Sun Jun 19 02:03:12 2011 (r223285) @@ -943,6 +943,7 @@ nfscl_getmyip(struct nfsmount *nmp, int sad.sin_family = AF_INET; sad.sin_len = sizeof (struct sockaddr_in); sad.sin_addr.s_addr = sin-sin_addr.s_addr; + CURVNET_SET(CRED_TO_VNET(nmp-nm_sockreq.nr_cred)); rt = rtalloc1((struct sockaddr *)sad, 0, 0UL); if (rt != NULL) { if (rt-rt_ifp != NULL @@ -956,6 +957,7 @@ nfscl_getmyip(struct nfsmount *nmp, int } RTFREE_LOCKED(rt); } + CURVNET_RESTORE(); #ifdef INET6 } else if (nmp-nm_nam-sa_family == AF_INET6) { struct sockaddr_in6 sad6, *sin6; @@ -966,6 +968,7 @@ nfscl_getmyip(struct nfsmount *nmp, int sad6.sin6_family = AF_INET6; sad6.sin6_len = sizeof (struct sockaddr_in6); sad6.sin6_addr = sin6-sin6_addr; + CURVNET_SET(CRED_TO_VNET(nmp-nm_sockreq.nr_cred)); rt = rtalloc1((struct sockaddr *)sad6, 0, 0UL); if (rt != NULL) { if (rt-rt_ifp != NULL @@ -980,6 +983,7 @@ nfscl_getmyip(struct nfsmount *nmp, int } RTFREE_LOCKED(rt); } + CURVNET_RESTORE(); #endif } return (retp); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r223286 - in stable/8/sys/fs: nfs nfsclient
Author: rmacklem Date: Sun Jun 19 02:24:36 2011 New Revision: 223286 URL: http://svn.freebsd.org/changeset/base/223286 Log: MFC: r222719 The new NFSv4 client was erroneously using p instead of p_leader for the id for POSIX byte range locking. I think this would only have affected processes created by rfork(2) with the RFTHREAD flag specified. This patch fixes that by passing the id down through the various functions from nfs_advlock(). Modified: stable/8/sys/fs/nfs/nfs_var.h stable/8/sys/fs/nfsclient/nfs_clport.c stable/8/sys/fs/nfsclient/nfs_clrpcops.c stable/8/sys/fs/nfsclient/nfs_clstate.c stable/8/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfs/nfs_var.h == --- stable/8/sys/fs/nfs/nfs_var.h Sun Jun 19 02:03:12 2011 (r223285) +++ stable/8/sys/fs/nfs/nfs_var.h Sun Jun 19 02:24:36 2011 (r223286) @@ -401,10 +401,10 @@ int nfsrpc_readdirplus(vnode_t, struct u int nfsrpc_commit(vnode_t, u_quad_t, int, struct ucred *, NFSPROC_T *, u_char *, struct nfsvattr *, int *, void *); int nfsrpc_advlock(vnode_t, off_t, int, struct flock *, int, -struct ucred *, NFSPROC_T *); +struct ucred *, NFSPROC_T *, void *, int); int nfsrpc_lockt(struct nfsrv_descript *, vnode_t, struct nfsclclient *, u_int64_t, u_int64_t, struct flock *, -struct ucred *, NFSPROC_T *); +struct ucred *, NFSPROC_T *, void *, int); int nfsrpc_lock(struct nfsrv_descript *, struct nfsmount *, vnode_t, u_int8_t *, int, struct nfscllockowner *, int, int, u_int64_t, u_int64_t, short, struct ucred *, NFSPROC_T *, int); @@ -439,16 +439,16 @@ struct nfsclclient *nfscl_findcl(struct void nfscl_clientrelease(struct nfsclclient *); void nfscl_freelock(struct nfscllock *, int); int nfscl_getbytelock(vnode_t, u_int64_t, u_int64_t, short, -struct ucred *, NFSPROC_T *, struct nfsclclient *, int, u_int8_t *, -u_int8_t *, struct nfscllockowner **, int *, int *); +struct ucred *, NFSPROC_T *, struct nfsclclient *, int, void *, int, +u_int8_t *, u_int8_t *, struct nfscllockowner **, int *, int *); int nfscl_relbytelock(vnode_t, u_int64_t, u_int64_t, struct ucred *, NFSPROC_T *, int, struct nfsclclient *, -struct nfscllockowner **, int *); +void *, int, struct nfscllockowner **, int *); int nfscl_checkwritelocked(vnode_t, struct flock *, -struct ucred *, NFSPROC_T *); +struct ucred *, NFSPROC_T *, void *, int); void nfscl_lockrelease(struct nfscllockowner *, int, int); void nfscl_fillclid(u_int64_t, char *, u_int8_t *, u_int16_t); -void nfscl_filllockowner(NFSPROC_T *, u_int8_t *); +void nfscl_filllockowner(void *, u_int8_t *, int); void nfscl_freeopen(struct nfsclopen *, int); void nfscl_umount(struct nfsmount *, NFSPROC_T *); void nfscl_renewthread(struct nfsclclient *, NFSPROC_T *); @@ -466,9 +466,10 @@ void nfscl_lockexcl(struct nfsv4lock *, void nfscl_lockunlock(struct nfsv4lock *); void nfscl_lockderef(struct nfsv4lock *); void nfscl_docb(struct nfsrv_descript *, NFSPROC_T *); -void nfscl_releasealllocks(struct nfsclclient *, vnode_t, NFSPROC_T *); +void nfscl_releasealllocks(struct nfsclclient *, vnode_t, NFSPROC_T *, void *, +int); int nfscl_lockt(vnode_t, struct nfsclclient *, u_int64_t, -u_int64_t, struct flock *, NFSPROC_T *); +u_int64_t, struct flock *, NFSPROC_T *, void *, int); int nfscl_mustflush(vnode_t); int nfscl_nodeleg(vnode_t, int); int nfscl_removedeleg(vnode_t, NFSPROC_T *, nfsv4stateid_t *); Modified: stable/8/sys/fs/nfsclient/nfs_clport.c == --- stable/8/sys/fs/nfsclient/nfs_clport.c Sun Jun 19 02:03:12 2011 (r223285) +++ stable/8/sys/fs/nfsclient/nfs_clport.c Sun Jun 19 02:24:36 2011 (r223286) @@ -500,7 +500,7 @@ nfscl_fillclid(u_int64_t clval, char *uu * Fill in a lock owner name. For now, pid + the process's creation time. */ void -nfscl_filllockowner(struct thread *td, u_int8_t *cp) +nfscl_filllockowner(void *id, u_int8_t *cp, int flags) { union { u_int32_t lval; @@ -508,37 +508,32 @@ nfscl_filllockowner(struct thread *td, u } tl; struct proc *p; -if (td == NULL) { - printf(NULL td\n); - bzero(cp, 12); - return; -} - p = td-td_proc; -if (p == NULL) { - printf(NULL pid\n); - bzero(cp, 12); - return; -} - tl.lval = p-p_pid; - *cp++ = tl.cval[0]; - *cp++ = tl.cval[1]; - *cp++ = tl.cval[2]; - *cp++ = tl.cval[3]; -if (p-p_stats == NULL) { - printf(pstats null\n); - bzero(cp, 8); - return; -} -
svn commit: r223287 - stable/8/sys/fs/nfsclient
Author: rmacklem Date: Sun Jun 19 02:39:02 2011 New Revision: 223287 URL: http://svn.freebsd.org/changeset/base/223287 Log: MFC: r222722 Add support for flock(2) locks to the new NFSv4 client. I think this should be ok, since the client now delays NFSv4 Close operations until VOP_INACTIVE()/VOP_RECLAIM(). As such, there should be no risk that the NFSv4 Open is closed while an associated byte range lock still exists. Modified: stable/8/sys/fs/nfsclient/nfs_clport.c stable/8/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clport.c == --- stable/8/sys/fs/nfsclient/nfs_clport.c Sun Jun 19 02:24:36 2011 (r223286) +++ stable/8/sys/fs/nfsclient/nfs_clport.c Sun Jun 19 02:39:02 2011 (r223287) @@ -530,8 +530,11 @@ nfscl_filllockowner(void *id, u_int8_t * *cp++ = tl.cval[1]; *cp++ = tl.cval[2]; *cp = tl.cval[3]; + } else if ((flags F_FLOCK) != 0) { + bcopy(id, cp, sizeof(id)); + bzero(cp[sizeof(id)], NFSV4CL_LOCKNAMELEN - sizeof(id)); } else { - printf(nfscl_filllockowner: not F_POSIX\n); + printf(nfscl_filllockowner: not F_POSIX or F_FLOCK\n); bzero(cp, NFSV4CL_LOCKNAMELEN); } } Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c == --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Sun Jun 19 02:24:36 2011 (r223286) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Sun Jun 19 02:39:02 2011 (r223287) @@ -2874,8 +2874,11 @@ nfs_advlock(struct vop_advlock_args *ap) int ret, error = EOPNOTSUPP; u_quad_t size; - if (NFS_ISV4(vp) (ap-a_flags F_POSIX)) { - cred = p-p_ucred; + if (NFS_ISV4(vp) (ap-a_flags (F_POSIX | F_FLOCK)) != 0) { + if ((ap-a_flags F_POSIX) != 0) + cred = p-p_ucred; + else + cred = td-td_ucred; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (vp-v_iflag VI_DOOMED) { VOP_UNLOCK(vp, 0); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r223262 - in head: cddl/contrib/opensolaris/lib/libdtrace/common contrib/binutils/bfd contrib/binutils/gas contrib/binutils/gas/config contrib/binutils/ld contrib/binutils/opcodes cont
In article 201106181356.p5iduxhw044...@svn.freebsd.org Ben Laurie b...@freebsd.org writes: Author: benl Date: Sat Jun 18 13:56:33 2011 New Revision: 223262 URL: http://svn.freebsd.org/changeset/base/223262 Log: Fix clang warnings. Modified: head/sys/sys/diskpc98.h == --- head/sys/sys/diskpc98.h Sat Jun 18 13:54:36 2011(r223261) +++ head/sys/sys/diskpc98.h Sat Jun 18 13:56:33 2011(r223262) @@ -36,8 +36,11 @@ #include sys/ioccom.h #define DOSBBSECTOR 0 /* DOS boot block relative sector number */ +#undef DOSPARTOFF #define DOSPARTOFF 0 +#undef DOSPARTSIZE #define DOSPARTSIZE 32 +#undef NDOSPART #define NDOSPART16 #define DOSMAGICOFFSET 510 #define DOSMAGIC0xAA55 @@ -52,6 +55,7 @@ #define DOSMID_386BSD (PC98_MID_386BSD | PC98_MID_BOOTABLE) #define DOSSID_386BSD (PC98_SID_386BSD | PC98_SID_ACTIVE) +#undef DOSPTYP_386BSD #define DOSPTYP_386BSD (DOSSID_386BSD 8 | DOSMID_386BSD) struct pc98_partition { I wonder why this is needed, and why only for diskpc98.h, not diskmbr.h. --- TAKAHASHI Yoshihiro n...@freebsd.org ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org