svn commit: r250041 - head/sys/dev/ath
Author: adrian Date: Mon Apr 29 07:28:29 2013 New Revision: 250041 URL: http://svnweb.freebsd.org/changeset/base/250041 Log: Debugging changes! * That lock isn't actually held during reset - just the whole TX/RX path is paused. So, remove the assertion. * Log the TX queue status - how many hardware frames are active in the MAC and whether the queue is active. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c == --- head/sys/dev/ath/if_ath.c Mon Apr 29 06:54:01 2013(r250040) +++ head/sys/dev/ath/if_ath.c Mon Apr 29 07:28:29 2013(r250041) @@ -4466,10 +4466,12 @@ ath_tx_stopdma(struct ath_softc *sc, str struct ath_hal *ah = sc->sc_ah; DPRINTF(sc, ATH_DEBUG_RESET, - "%s: tx queue [%u] %p, flags 0x%08x, link %p\n", + "%s: tx queue [%u] %p, active=%d, hwpending=%d, flags 0x%08x, link %p\n", __func__, txq->axq_qnum, (caddr_t)(uintptr_t) ath_hal_gettxbuf(ah, txq->axq_qnum), + (int) (!! ath_hal_txqenabled(ah, txq->axq_qnum)), + (int) ath_hal_numtxpending(ah, txq->axq_qnum), txq->axq_flags, txq->axq_link); (void) ath_hal_stoptxdma(ah, txq->axq_qnum); @@ -4511,8 +4513,6 @@ ath_tx_dump(struct ath_softc *sc, struct if (! (sc->sc_debug & ATH_DEBUG_RESET)) return; - ATH_TX_LOCK_ASSERT(sc); - device_printf(sc->sc_dev, "%s: Q%d: begin\n", __func__, txq->axq_qnum); TAILQ_FOREACH(bf, &txq->axq_q, bf_list) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r250037 - head/bin/hostname
On Sun, 28 Apr 2013, Eitan Adler wrote: Log: Mark usage() __dead2 This just adds a style bug. Modified: head/bin/hostname/hostname.c == --- head/bin/hostname/hostname.cSun Apr 28 22:12:40 2013 (r250036) +++ head/bin/hostname/hostname.cSun Apr 28 22:52:43 2013 (r250037) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include -static void usage(void); +static void usage(void) __dead2; Static functions should never be marked __dead2. The purpose of the markup is to inform the compiler that the function doesn't return. But for static functions, the compiler can see this for itself, at least with -funit-at-a-time in CFLAGS. (-funit-at-a-time is not required (doesn't exist) in C standards, but is now the default. Compilers even use it to look to closely at static functions and automatically inline them even when they are declared after they are used, as is common for usage(), provided they are only used once and -fno-inline-functions-called-once is not used. This mainly breaks debugging and profiling of non-inline functions. The breakage is largest for clang, collaterally with the bug that clang doesn't support either of these flags, so it seems to have no way to turn off this excessive inlining.) The style bug is missing in the example of using usage() in style(9). This style bug is missing in about 259 out of 284 declarations of static void usage(void) in /usr/src/*bin (.c files). Except: - bin/pkill/pkill.c has it in a worse form, with __dead2 hard-coded using __attribute(()) - usr.bin/rlogin/rlogin.c has it in a gratuitously different form, as 'static _Noreturn voidusage(void);'. This is bogus since _Noreturn is a wrapper for a new C++ feature, but rlogin is an old C application; for C, it is defined as __dead2, but it isn't clear that it does the same as a normal use of __dead2 since it is used in a syntactically different way. __dead2 only exist because this syntax, which was used for the old __dead (== volatile return type instead of __attribute((__noreturn__))) didn't work. Apparently the syntax of __attribute__() has become less strict, so the more natural (old) syntax works again, and the use of the old syntax here is just a style bug and not a syntax error. I counted these style bugs by grepping for "static.*usage" (318 lines) and then filtering out most that didn't match the normal usage of usage(). There are too many gratuitous differences like taking a 'char *' arg or returning an int. Another popular style bug is a gnu-style declaration with a space after the function name. One declaration is even missing the arg type, so it isn't a prototype. Not all instances of the __dead[2] style bug are new. In 4.4BSD-Lite2, there were 17 instances of __dead in /usr/src/*bin. Only 4 of these were on static functions. Only 2 of them were on usage(), and usage() wasn't declared static in these 2. These 2 were rlogin and mount_nfs. The bug in rlogin persists in a worse form, and the bug in mount_nfs was cloned to many other mount utilities. In FreeBSD-~5.2, there were 43 instances of __dead2 in /usr/src/*bin. 30 of these were on static functions. 22 of these were on usage(). Almost half of these 22 were in mount utilities. Further statistics for -current in /usr/src/*bin: - 60 instances of __dead2 - 57 of these on static functions - at least 26 of these on static.*usage.* - some false/misleading hits for the sloppy patterns: - 1 nonsense declaration in echo/echo.c. __dead2 is placed on the function definition of errexit(), where it ican have no effect except possibly to cause a warning when the function does return. The function actually ends with exit(), so the compiler can see that it doesn't return. There is no forward prototype for this function, but it is placed before it is used, so the compiler can see that it doesn't return even without -funit-at-a-time. - same nonsense declaration in sh/arith_yacc.c:yyerror(). It returns with error() instad of exit(), so its non-returningness is given by __dead2 on error(). - same nonsense declaration in killall/killall.c:usage(). usage() is unsorted at the beginning of the file, so it doesn't need the usual forward prototype, but it has the __dead2 declaration which is not even needed for the prototype. - i2c/i2c.c:usage(). Like killall, except the unsorting is not so close to the beginning of the file. - gbde/gbde.c:usage(). Like i2c. - hastd/primary.c. Like sh (3 functions). - hastctl/hastctl.c. Like i2c. These false hits were only harder to understand because the function definitions are formatted normally, so the function name isn't on the same line as __dead2 so grepping with simple patterns doesn't show what it is. The syntax for all the nonsense declarations is 'static __dead2 \n'. This would have been a sy
Re: svn commit: r250037 - head/bin/hostname
Hi Bruce, 2013/4/29 Bruce Evans : > - usr.bin/rlogin/rlogin.c has it in a gratuitously different form, as > 'static _Noreturn voidusage(void);'. This is bogus since > _Noreturn is a wrapper for a new C++ feature I hate to correct you here, but _Noreturn is not a wrapper for a new C++ feature, it's a keyword that's part of C11. See: http://en.wikipedia.org/wiki/C11_(C_standard_revision)#Changes_from_C99 All C11 keywords can be implemented on top of GCC-specific constructs, with the exception of _Generic. I would strongly prefer it if we used these keywords over our FreeBSD-specific solutions. If the only objection is the spelling of these keywords (underscores, uppercase, etc), be sure to: #include /* For alignas/alignof. */ #include /* For noreturn. */ #include /* For thread_local. */ -- Ed Schouten ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r250048 - head
Author: eadler Date: Mon Apr 29 15:58:04 2013 New Revision: 250048 URL: http://svnweb.freebsd.org/changeset/base/250048 Log: A transition period of more than two years is more than enough: Remove the compatibility code added in 2011-02-10. This change is not intended for MFC Reviewed by: imp Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Mon Apr 29 11:36:59 2013(r250047) +++ head/Makefile.inc1 Mon Apr 29 15:58:04 2013(r250048) @@ -41,13 +41,6 @@ # /usr/share/mk. These include: # obj depend all install clean cleandepend cleanobj -# You are supposed to define both of these when calling Makefile.inc1 -# directly. However, some old scripts don't. Cope for the moment, but -# issue a new warning for a transition period. -.if defined(TARGET) && !defined(TARGET_ARCH) -.warning "You must pass both TARGET and TARGET_ARCH to Makefile.inc1. Setting TARGET_ARCH=${TARGET}." -TARGET_ARCH=${TARGET} -.endif .if !defined(TARGET) || !defined(TARGET_ARCH) .error "Both TARGET and TARGET_ARCH must be defined." .endif ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r249800 - head/sys/dev/bwn
On Sunday, April 28, 2013 8:06:16 pm hiren panchasara wrote: > On Tue, Apr 23, 2013 at 9:46 AM, hiren panchasara wrote: > > On Tue, Apr 23, 2013 at 9:34 AM, Eitan Adler wrote: > >> On 23 April 2013 12:19, Adrian Chadd wrote: > >>> ... you know, even though it doesn't have an active maintainer, do you > >>> have test hardware, and why didn't you just bounce a patch to > >>> -wireless for review? > > > > My bad. I proposed this change initially. > >>> > >>> We don't bite you know! > >> > >> that you need to emphasize this does not comfort me. ;) > >> > >> reverted in 249812. > > > > Will look at john's suggestions and fix it correctly. > > John, > > Does this look okay? > > % svn diff > Index: if_bwn.c > === > --- if_bwn.c(revision 250036) > +++ if_bwn.c(working copy) > @@ -9240,9 +9240,9 @@ > BUS_DMASYNC_PREWRITE); > > /* > -* Setup RX buf descriptor > +* Restore RX buf descriptor > */ > - dr->setdesc(dr, desc, paddr, meta->mt_m->m_len - > + dr->setdesc(dr, desc, meta->mt_paddr, meta->mt_m->m_len - > sizeof(*hdr), 0, 0, 0); > return (error); > } I would leave the comment alone. In the common case you do allocate a new mbuf so you aren't restoring the descriptor but setting it up with a new address. The code change looks correct. -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r249800 - head/sys/dev/bwn
On 29 April 2013 08:23, John Baldwin wrote: >> - dr->setdesc(dr, desc, paddr, meta->mt_m->m_len - >> + dr->setdesc(dr, desc, meta->mt_paddr, meta->mt_m->m_len - >> sizeof(*hdr), 0, 0, 0); >> return (error); >> } > > I would leave the comment alone. In the common case you do allocate a new > mbuf so you aren't restoring the descriptor but setting it up with a new > address. The code change looks correct. Does anyone here have bwn hardware that works? Adrian ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r249800 - head/sys/dev/bwn
On Mon, Apr 29, 2013 at 9:19 AM, Adrian Chadd wrote: > On 29 April 2013 08:23, John Baldwin wrote: >>> - dr->setdesc(dr, desc, paddr, meta->mt_m->m_len - >>> + dr->setdesc(dr, desc, meta->mt_paddr, meta->mt_m->m_len - >>> sizeof(*hdr), 0, 0, 0); >>> return (error); >>> } >> >> I would leave the comment alone. In the common case you do allocate a new >> mbuf so you aren't restoring the descriptor but setting it up with a new >> address. The code change looks correct. Alright. Thanks John. > > Does anyone here have bwn hardware that works? I do not. Hiren > > > > Adrian ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r250037 - head/bin/hostname
On Mon, 29 Apr 2013, Ed Schouten wrote: 2013/4/29 Bruce Evans : - usr.bin/rlogin/rlogin.c has it in a gratuitously different form, as 'static _Noreturn voidusage(void);'. This is bogus since _Noreturn is a wrapper for a new C++ feature I hate to correct you here, but _Noreturn is not a wrapper for a new C++ feature, it's a keyword that's part of C11. See: Yes, I misread the ifdef in sys/cdefs.h. So it is a new C feature as well as a new C++ feature. All C11 keywords can be implemented on top of GCC-specific constructs, with the exception of _Generic. I would strongly prefer it if we used these keywords over our FreeBSD-specific solutions. That would mainly churn the source code, and still depend for portability on FreeBSD #defining them in sys/cdefs.h. Just with different spelling. If the only objection is the spelling of these keywords (underscores, uppercase, etc), be sure to: #include /* For alignas/alignof. */ #include /* For noreturn. */ #include /* For thread_local. */ Ideally, new code would just use the new features. Then it would need includes to get the nicer spelling and not depend on FreeBSD features. But it is easier to use the FreeBSD features. I once hoped that the portability hacks in sys/cdefs.h (that is, the whole file) would go away when C became standard. Instead, it grew many more. It is now 7 times larger and many more than 7 times more convoluted than in FreeBSD-1. In FreeBSD-1, it only defined the following macros: __BEGIN_DECLS, __CONCAT(), __END_DECLS, __P(), __STRING(), __dead, __pure, const, inline, signed, volatile where only the last 4 are for corrupting Standard C keywords. `noreturn' (case-insensitive) is now used 9 times in /usr/src/*bin (.c files): - 4 times for hard-coded __attribute__(()) - 3 times in rlogin.c for _Noreturn. I already pointed out some of the syntax problems with these. They are unportable since they give syntax errors with some versions of gcc, while either __dead or __dead2 would not have these syntax errors when correctly placed. I don't know if the C11 keyword can be placed almost anywhere like the attribute can be now. If not, then it would be impossible to replace all the __dead2's by it without changing the syntax, and then it would give syntax errors for the old compilers. - 2 times for NORETURN comments after usage() in fstat. These are just garbage. They are because lint is too stupid to understand __dead2 or _Noreturn, so it needs a comment to tell it that usage() doesn't return. But the comment for this is NOTREACHED, not NORETURN. NORETURN also misdescribes the situtation for human readers, since it is usage() that doesn't return and the code after it that is not reached. I dislike even correct lint comments. Telling the compiler than functions don't return has worked better than telling lint this for more than 20 years. Bruce ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r250049 - head/sys/dev/netmap
Author: luigi Date: Mon Apr 29 16:58:21 2013 New Revision: 250049 URL: http://svnweb.freebsd.org/changeset/base/250049 Log: explicitly mark some variables as const Modified: head/sys/dev/netmap/ixgbe_netmap.h Modified: head/sys/dev/netmap/ixgbe_netmap.h == --- head/sys/dev/netmap/ixgbe_netmap.h Mon Apr 29 15:58:04 2013 (r250048) +++ head/sys/dev/netmap/ixgbe_netmap.h Mon Apr 29 16:58:21 2013 (r250049) @@ -226,7 +226,8 @@ ixgbe_netmap_txsync(struct ifnet *ifp, u struct netmap_adapter *na = NA(adapter->ifp); struct netmap_kring *kring = &na->tx_rings[ring_nr]; struct netmap_ring *ring = kring->ring; - u_int j, k = ring->cur, l, n = 0, lim = kring->nkr_num_slots - 1; + u_int j, l, n = 0; + u_int const k = ring->cur, lim = kring->nkr_num_slots - 1; /* * ixgbe can generate an interrupt on every tx packet, but it @@ -393,11 +394,10 @@ ring_reset: if (ix_use_dd) { struct ixgbe_legacy_tx_desc *txd = (struct ixgbe_legacy_tx_desc *)txr->tx_base; - + u_int k1 = netmap_idx_k2n(kring, kring->nr_hwcur); l = txr->next_to_clean; - k = netmap_idx_k2n(kring, kring->nr_hwcur); delta = 0; - while (l != k && + while (l != k1 && txd[l].upper.fields.status & IXGBE_TXD_STAT_DD) { delta++; l = (l == lim) ? 0 : l + 1; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r249859 - head/lib/libc/sys
On Sat, Apr 27, 2013 at 04:36:56AM +1000, Bruce Evans wrote: > On Fri, 26 Apr 2013, Jilles Tjoelker wrote: > > On Thu, Apr 25, 2013 at 09:56:01PM +1000, Bruce Evans wrote: > >> On Wed, 24 Apr 2013, Jilles Tjoelker wrote: > >>> Log: > >>> getdtablesize(2): Describe what this function actually does. > >>> ... > >>> .Sh NAME > >>> .Nm getdtablesize > >>> -.Nd get descriptor table size > >>> +.Nd get file descriptor limit > >> Now its name doesn't match its description, and the reason for this is > >> not documented. > > This seems to be the case on most systems that have this function. > No reason not to document it. I can do it if you provide text. > >> This function is almost obsolete. In POSIX, it is spelled {OPEN_MAX} > >> or sysconf(__SC_OPEN_MAX). It is sometimes misspelled OPEN_MAX. > > There is a difference between sysconf(_SC_OPEN_MAX) and getdtablesize(): > > the latter also takes maxfilesperproc and rctl(8) rules into account. > Yes, only sysconf(_SC_OPEN_MAX) (and getrlimit(..., RLIMIT_NOFILE)) are > broken. > I'm not familiar with rctl. It seems to break this some more: in > kern_descrip.c, all the places that use the rlimit clamp it to > maxfileperproc, so the effective rlimit is always the clamped value > and this is what sysconf() and getrlimit() should return too. Now > for rctl, only 1 of these places (namely getdtablesize()) clamps it > further to the RACCT_NOFILE limit. Other places include do_dup(). > do_dup() checks the RACCT_NOFILE much later. I think this gives the > same limit, but at least the errno when the limit RACCT_NOFILE limit > is exceeded but the others aren't is wrong in all cases. (The early > errno for (new >= maxfd) is (flags & DUP_FCNTL ? EINVAL : EBADF). > The later errno for racct_set(... RACCT_NOFILE, new + 1) is always > EMFILE. EMFILE is not even a possible errno for dup2(). Hmm, if we return [EBADF] there, we should also change sysconf(_SC_OPEN_MAX) to return getdtablesize() instead of the soft rlimit. > >> I prepared to remove the broken definition of OPEN_MAX, but never committed > >> the final step. /usr/src has very few misuses of OPEN_MAX now, so removing > >> the definition wouldn't be too hard. Most uses are in compatibility > >> cruft. E.g., the following from > >> crypto/openssh/openbsd-compat/bsd-closefrom.c > >> which is confused about related things: > >> [snip] > > If that code is compiled at all, it is a bug. We have closefrom() and > > OpenSSH should use it. > It almost certainly uses it. However, a quick grep for getdtablesize() > shows many applications using it, and most of them use it to give the > top of a close() loop. These should be converted to use something > like closefrom(). getdtablesize() is used much more than sysconf() > or getrlimit() for this. This is done mostly in old BSD applications. > However, the worst uses that I noticed are in the relatively new ppp > application. There are about 40 calls to getdtablesize() in /usr/src. > 7 of these are in ppp. 1 of the 7 is for the close() loop. 4 of the > 7 are for fcntl(... F_SETFD ...) loops. The other 2 are for a home > made FD_SETSIZE and a home made FD_ZERO(). These essentially initialize > FD_SETSIZE to the variable getdtablesize(). A table of bits of that > size is allocated. A table of bits of that size is cleared. Since > getdtablesize() is variable, buffer overruns and underruns occur if > someone changes getdtablesize() while the process is running (it can > be changed by the maxfileperproc sysctl and now by rctl). But the > huge table is not always passed to select() (its size doesn't seem to > be recorded anywhere, so it can also be overrun or underrun by > FD_SET() on it, where the fd for FD_SET is acquired before or after > getdtablesize() changes). Much of this is in uncommonly used code that is hard to test :( A getdtablesize()/close() loop is not so bad because it is exactly equivalent to closefrom() (modulo bugs in the former) but the fcntl(F_SETFD, 1) loops are harder. There are also various copies of popen in the tree (often slightly modified) that create an array of getdtablesize() elements to track popened file descriptors. This is safe as long as getdtablesize() does not increase while the process is running, but also wasteful. > >> ... in 4.4BSD and FreeBSD, both sysconf(_SC_OPEN_MAX) are just wrappers for > >> the resource limit (sysconf() is a libc wrapper and getdtablesize() is > >> a syscall wrapper). Actually, in FreeBSD, getdtablesize() is not even the > >> rlmint -- it is the min() of the rlimit and the global sysctl integer > >> maxfilesperproc. Here the bug is in the rlimit. For the rlimit, > >> maxfilesperproc is only used when the rlimit is set and when it is used > >> in the kernel. But when the rlimit is returned to userland, via > >> getrlimit(), maxfilesperproc is not used, so the rlimit may be wrong if > >> maxfileperproc was lowered after setting the rlimit. > > I don't like the idea of rlimits changin
svn commit: r250050 - head/sys/dev/hptiop
Author: delphij Date: Mon Apr 29 17:00:26 2013 New Revision: 250050 URL: http://svnweb.freebsd.org/changeset/base/250050 Log: Add missing braces. Submitted by: Sascha Wildner Obtained from:DragonFly MFC after:1 week Modified: head/sys/dev/hptiop/hptiop.c Modified: head/sys/dev/hptiop/hptiop.c == --- head/sys/dev/hptiop/hptiop.cMon Apr 29 16:58:21 2013 (r250049) +++ head/sys/dev/hptiop/hptiop.cMon Apr 29 17:00:26 2013 (r250050) @@ -1704,10 +1704,11 @@ static int hptiop_internal_memalloc_mvfr hba->u.mvfrey.internal_mem_size, hptiop_mvfrey_map_ctlcfg, hba, 0)) { device_printf(hba->pcidev, "bus_dmamap_load failed!\n"); - if (hba->ctlcfg_dmat) + if (hba->ctlcfg_dmat) { bus_dmamem_free(hba->ctlcfg_dmat, hba->ctlcfg_ptr, hba->ctlcfg_dmamap); bus_dma_tag_destroy(hba->ctlcfg_dmat); + } return -1; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r249800 - head/sys/dev/bwn
On 29 April 2013 09:44, hiren panchasara wrote: >> Does anyone here have bwn hardware that works? > > I do not. Have an expresscard slot? Want some? adrian ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r249800 - head/sys/dev/bwn
On Mon, Apr 29, 2013 at 10:42 AM, Adrian Chadd wrote: > On 29 April 2013 09:44, hiren panchasara wrote: > >>> Does anyone here have bwn hardware that works? >> >> I do not. > > Have an expresscard slot? Want some? Yes and yes :-) cheers, Hiren > > > > adrian ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r250052 - head/sys/dev/netmap
Author: luigi Date: Mon Apr 29 18:00:53 2013 New Revision: 250052 URL: http://svnweb.freebsd.org/changeset/base/250052 Log: whitespace changes: remove $Id$ lines, and add blank lines around some #if / #elif /#endif Modified: head/sys/dev/netmap/if_em_netmap.h head/sys/dev/netmap/if_igb_netmap.h head/sys/dev/netmap/if_lem_netmap.h head/sys/dev/netmap/if_re_netmap.h head/sys/dev/netmap/ixgbe_netmap.h head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_kern.h head/sys/dev/netmap/netmap_mem2.c Modified: head/sys/dev/netmap/if_em_netmap.h == --- head/sys/dev/netmap/if_em_netmap.h Mon Apr 29 17:29:48 2013 (r250051) +++ head/sys/dev/netmap/if_em_netmap.h Mon Apr 29 18:00:53 2013 (r250052) @@ -25,7 +25,6 @@ /* * $FreeBSD$ - * $Id: if_em_netmap.h 10627 2012-02-23 19:37:15Z luigi $ * * netmap support for em. * Modified: head/sys/dev/netmap/if_igb_netmap.h == --- head/sys/dev/netmap/if_igb_netmap.h Mon Apr 29 17:29:48 2013 (r250051) +++ head/sys/dev/netmap/if_igb_netmap.h Mon Apr 29 18:00:53 2013 (r250052) @@ -25,7 +25,6 @@ /* * $FreeBSD$ - * $Id: if_igb_netmap.h 10627 2012-02-23 19:37:15Z luigi $ * * Netmap support for igb, partly contributed by Ahmed Kooli * For details on netmap support please see ixgbe_netmap.h Modified: head/sys/dev/netmap/if_lem_netmap.h == --- head/sys/dev/netmap/if_lem_netmap.h Mon Apr 29 17:29:48 2013 (r250051) +++ head/sys/dev/netmap/if_lem_netmap.h Mon Apr 29 18:00:53 2013 (r250052) @@ -26,7 +26,6 @@ /* * $FreeBSD$ - * $Id: if_lem_netmap.h 10627 2012-02-23 19:37:15Z luigi $ * * netmap support for "lem" * Modified: head/sys/dev/netmap/if_re_netmap.h == --- head/sys/dev/netmap/if_re_netmap.h Mon Apr 29 17:29:48 2013 (r250051) +++ head/sys/dev/netmap/if_re_netmap.h Mon Apr 29 18:00:53 2013 (r250052) @@ -25,7 +25,6 @@ /* * $FreeBSD$ - * $Id: if_re_netmap.h 10609 2012-02-22 19:44:58Z luigi $ * * netmap support for "re" * For details on netmap support please see ixgbe_netmap.h Modified: head/sys/dev/netmap/ixgbe_netmap.h == --- head/sys/dev/netmap/ixgbe_netmap.h Mon Apr 29 17:29:48 2013 (r250051) +++ head/sys/dev/netmap/ixgbe_netmap.h Mon Apr 29 18:00:53 2013 (r250052) @@ -25,7 +25,6 @@ /* * $FreeBSD$ - * $Id: ixgbe_netmap.h 10627 2012-02-23 19:37:15Z luigi $ * * netmap modifications for ixgbe * Modified: head/sys/dev/netmap/netmap.c == --- head/sys/dev/netmap/netmap.cMon Apr 29 17:29:48 2013 (r250051) +++ head/sys/dev/netmap/netmap.cMon Apr 29 18:00:53 2013 (r250052) @@ -99,6 +99,7 @@ MALLOC_DEFINE(M_NETMAP, "netmap", "Netwo #include #include +/* XXX the following variables must be deprecated and included in nm_mem */ u_int netmap_total_buffers; u_int netmap_buf_size; char *netmap_buffer_base; /* address of an invalid buffer */ @@ -148,6 +149,8 @@ SYSCTL_INT(_dev_netmap, OID_AUTO, copy, #define NM_BDG_HASH1024/* forwarding table entries */ #define NM_BDG_BATCH 1024/* entries in the forwarding buffer */ #defineNM_BRIDGES 4 /* number of bridges */ + + int netmap_bridge = NM_BDG_BATCH; /* bridge batch size */ SYSCTL_INT(_dev_netmap, OID_AUTO, bridge, CTLFLAG_RW, &netmap_bridge, 0 , ""); Modified: head/sys/dev/netmap/netmap_kern.h == --- head/sys/dev/netmap/netmap_kern.h Mon Apr 29 17:29:48 2013 (r250051) +++ head/sys/dev/netmap/netmap_kern.h Mon Apr 29 18:00:53 2013 (r250052) @@ -25,7 +25,6 @@ /* * $FreeBSD$ - * $Id: netmap_kern.h 11829 2012-09-26 04:06:34Z luigi $ * * The header contains the definitions of constants and function * prototypes used only in kernelspace. @@ -35,6 +34,7 @@ #define _NET_NETMAP_KERN_H_ #if defined(__FreeBSD__) + #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x)__builtin_expect(!!(x), 0) @@ -42,8 +42,10 @@ #defineNM_SELINFO_Tstruct selinfo #defineMBUF_LEN(m) ((m)->m_pkthdr.len) #defineNM_SEND_UP(ifp, m) ((ifp)->if_input)(ifp, m) + #elif defined (linux) -#defineNM_LOCK_T safe_spinlock_t // see bsd_glue.h + +#defineNM_LOCK_T safe_spinlock_t // see bsd_glue.h #defineNM_SELINFO_Twait_queue_head_t #defineMBUF_LEN(m) ((m)->len) #defineNM_SEND_UP(ifp, m) netif_rx(m) @@ -65,6 +67,7 @@ #endif #elif defined
svn commit: r250053 - head/sys/dev/acpi_support
Author: jhb Date: Mon Apr 29 18:54:31 2013 New Revision: 250053 URL: http://svnweb.freebsd.org/changeset/base/250053 Log: Only cleanup CMI-related state on detach if the system supports CMI. PR: kern/163268 MFC after:1 week Modified: head/sys/dev/acpi_support/acpi_hp.c Modified: head/sys/dev/acpi_support/acpi_hp.c == --- head/sys/dev/acpi_support/acpi_hp.c Mon Apr 29 18:00:53 2013 (r250052) +++ head/sys/dev/acpi_support/acpi_hp.c Mon Apr 29 18:54:31 2013 (r250053) @@ -574,28 +574,26 @@ acpi_hp_attach(device_t dev) static int acpi_hp_detach(device_t dev) { - int ret; + struct acpi_hp_softc *sc; ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); - struct acpi_hp_softc *sc = device_get_softc(dev); - if (sc->has_cmi && sc->hpcmi_open_pid != 0) { - ret = EBUSY; - } - else { - if (sc->has_notify) { - ACPI_WMI_REMOVE_EVENT_HANDLER(dev, - ACPI_HP_WMI_EVENT_GUID); - } + sc = device_get_softc(dev); + if (sc->has_cmi && sc->hpcmi_open_pid != 0) + return (EBUSY); + + if (sc->has_notify) + ACPI_WMI_REMOVE_EVENT_HANDLER(dev, ACPI_HP_WMI_EVENT_GUID); + + if (sc->has_cmi) { if (sc->hpcmi_bufptr != -1) { sbuf_delete(&sc->hpcmi_sbuf); sc->hpcmi_bufptr = -1; } sc->hpcmi_open_pid = 0; destroy_dev(sc->hpcmi_dev_t); - ret = 0; } - return (ret); + return (0); } static int ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r250054 - head/sys/dev/netmap
Author: luigi Date: Mon Apr 29 19:30:35 2013 New Revision: 250054 URL: http://svnweb.freebsd.org/changeset/base/250054 Log: whitespace - document alternative locking under linux Modified: head/sys/dev/netmap/netmap_mem2.c Modified: head/sys/dev/netmap/netmap_mem2.c == --- head/sys/dev/netmap/netmap_mem2.c Mon Apr 29 18:54:31 2013 (r250053) +++ head/sys/dev/netmap/netmap_mem2.c Mon Apr 29 19:30:35 2013 (r250054) @@ -97,6 +97,8 @@ #define NETMAP_BUF_MAX_NUM 20*4096*2 /* large machine */ #ifdef linux +// XXX a mtx would suffice here 20130415 lr +// #define NMA_LOCK_T safe_spinlock_t #define NMA_LOCK_T struct semaphore #define NMA_LOCK_INIT()sema_init(&nm_mem.nm_mtx, 1) #define NMA_LOCK_DESTROY() ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r250055 - head/sys/fs/nfsserver
Author: des Date: Mon Apr 29 20:09:44 2013 New Revision: 250055 URL: http://svnweb.freebsd.org/changeset/base/250055 Log: Fix a bug that allows NFS clients to issue READDIR on files. PR: kern/178016 Security: CVE-2013-3266 Security: FreeBSD-SA-13:05.nfsserver Modified: head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfsserver/nfs_nfsdport.c == --- head/sys/fs/nfsserver/nfs_nfsdport.cMon Apr 29 19:30:35 2013 (r250054) +++ head/sys/fs/nfsserver/nfs_nfsdport.cMon Apr 29 20:09:44 2013 (r250055) @@ -1574,6 +1574,8 @@ nfsrvd_readdir(struct nfsrv_descript *nd nd->nd_repstat = NFSERR_BAD_COOKIE; #endif } + if (!nd->nd_repstat && vp->v_type != VDIR) + nd->nd_repstat = NFSERR_NOTDIR; if (nd->nd_repstat == 0 && cnt == 0) { if (nd->nd_flag & ND_NFSV2) /* NFSv2 does not have NFSERR_TOOSMALL */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r250056 - head/sbin/fsck_ffs
Author: des Date: Mon Apr 29 20:13:09 2013 New Revision: 250056 URL: http://svnweb.freebsd.org/changeset/base/250056 Log: Add a -Z option which zeroes unused blocks. It can be combined with -E, in which case unused blocks are first zeroed and then erased. Reviewed by: mckusick MFC after:3 weeks Modified: head/sbin/fsck_ffs/fsck.h head/sbin/fsck_ffs/fsck_ffs.8 head/sbin/fsck_ffs/fsutil.c head/sbin/fsck_ffs/main.c head/sbin/fsck_ffs/pass5.c Modified: head/sbin/fsck_ffs/fsck.h == --- head/sbin/fsck_ffs/fsck.h Mon Apr 29 20:09:44 2013(r250055) +++ head/sbin/fsck_ffs/fsck.h Mon Apr 29 20:13:09 2013(r250056) @@ -74,6 +74,7 @@ #defineMINBUFS 10 /* minimum number of buffers required */ #defineMAXBUFS 40 /* maximum space to allocate to buffers */ #defineINOBUFSIZE 64*1024 /* size of buffer to read inodes in pass1 */ +#defineZEROBUFSIZE (dev_bsize * 128) /* size of zero buffer used by -Z */ union dinode { struct ufs1_dinode dp1; @@ -306,7 +307,8 @@ charyflag; /* assume a yes response * intbkgrdflag; /* use a snapshot to run on an active system */ intbflag; /* location of alternate super block */ intdebug; /* output debugging info */ -intEflag; /* zero out empty data blocks */ +intEflag; /* delete empty data blocks */ +intZflag; /* zero empty data blocks */ intinoopt; /* trim out unused inodes */ char ckclean;/* only do work if not cleanly unmounted */ intcvtlevel; /* convert to newer file system format */ @@ -402,6 +404,7 @@ int blread(int fd, char *buf, ufs2_dadd void bufinit(void); void blwrite(int fd, char *buf, ufs2_daddr_t blk, ssize_t size); void blerase(int fd, ufs2_daddr_t blk, long size); +void blzero(int fd, ufs2_daddr_t blk, long size); void cacheino(union dinode *dp, ino_t inumber); void catch(int); void catchquit(int); Modified: head/sbin/fsck_ffs/fsck_ffs.8 == --- head/sbin/fsck_ffs/fsck_ffs.8 Mon Apr 29 20:09:44 2013 (r250055) +++ head/sbin/fsck_ffs/fsck_ffs.8 Mon Apr 29 20:13:09 2013 (r250056) @@ -38,7 +38,7 @@ .Nd file system consistency check and interactive repair .Sh SYNOPSIS .Nm -.Op Fl BEFfnpry +.Op Fl BEFfnpryZ .Op Fl b Ar block .Op Fl c Ar level .Op Fl m Ar mode @@ -280,6 +280,15 @@ Assume a yes response to all questions a .Nm ; this should be used with great caution as this is a free license to continue after essentially unlimited trouble has been encountered. +.It Fl Z +Similar to +.Fl E , +but overwrites unused blocks with zeroes. +If both +.Fl E +and +.Fl Z +are specified, blocks are first zeroed and then erased. .El .Pp Inconsistencies checked are as follows: Modified: head/sbin/fsck_ffs/fsutil.c == --- head/sbin/fsck_ffs/fsutil.c Mon Apr 29 20:09:44 2013(r250055) +++ head/sbin/fsck_ffs/fsutil.c Mon Apr 29 20:13:09 2013(r250056) @@ -618,6 +618,35 @@ blerase(int fd, ufs2_daddr_t blk, long s return; } +void +blzero(int fd, ufs2_daddr_t blk, long size) +{ + static char *zero; + off_t offset, len; + + if (fd < 0) + return; + len = ZEROBUFSIZE; + if (zero == NULL) { + zero = calloc(len, 1); + if (zero == NULL) + errx(EEXIT, "cannot allocate buffer pool"); + } + offset = blk * dev_bsize; + if (lseek(fd, offset, 0) < 0) + rwerror("SEEK BLK", blk); + while (size > 0) { + if (size > len) + size = len; + else + len = size; + if (write(fd, zero, len) != len) + rwerror("WRITE BLK", blk); + blk += len / dev_bsize; + size -= len; + } +} + /* * Verify cylinder group's magic number and other parameters. If the * test fails, offer an option to rebuild the whole cylinder group. Modified: head/sbin/fsck_ffs/main.c == --- head/sbin/fsck_ffs/main.c Mon Apr 29 20:09:44 2013(r250055) +++ head/sbin/fsck_ffs/main.c Mon Apr 29 20:13:09 2013(r250056) @@ -82,7 +82,7 @@ main(int argc, char *argv[]) sync(); skipclean = 1; inoopt = 0; - while ((ch = getopt(argc, argv, "b:Bc:CdEfFm:npry")) != -1) { + while ((ch = getopt(argc, argv, "b:Bc:CdEfFm:npryZ")) != -1) { switch (ch) {
svn commit: r250057 - head/sbin/fsck_ffs
Author: des Date: Mon Apr 29 20:14:11 2013 New Revision: 250057 URL: http://svnweb.freebsd.org/changeset/base/250057 Log: Style nit. Modified: head/sbin/fsck_ffs/pass5.c Modified: head/sbin/fsck_ffs/pass5.c == --- head/sbin/fsck_ffs/pass5.c Mon Apr 29 20:13:09 2013(r250056) +++ head/sbin/fsck_ffs/pass5.c Mon Apr 29 20:14:11 2013(r250057) @@ -581,7 +581,8 @@ check_maps( } } -static void clear_blocks(ufs2_daddr_t start, ufs2_daddr_t end) +static void +clear_blocks(ufs2_daddr_t start, ufs2_daddr_t end) { if (debug) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r250075 - head/libexec/rtld-elf
Author: kib Date: Mon Apr 29 21:12:25 2013 New Revision: 250075 URL: http://svnweb.freebsd.org/changeset/base/250075 Log: Properly terminate the result string for intermediate results, to allow the final strcpy() to start at the intended place. Reported and tested by: pgj Pointy hat to:kib MFC after:3 days Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c == --- head/libexec/rtld-elf/rtld.cMon Apr 29 21:12:18 2013 (r250074) +++ head/libexec/rtld-elf/rtld.cMon Apr 29 21:12:25 2013 (r250075) @@ -784,7 +784,7 @@ origin_subst_one(char *real, const char /* * Now, execute the substitution loop. */ - for (p = real, resp = res;;) { + for (p = real, resp = res, *resp = '\0';;) { p1 = strstr(p, kw); if (p1 != NULL) { /* Copy the prefix before keyword. */ @@ -793,6 +793,7 @@ origin_subst_one(char *real, const char /* Keyword replacement. */ memcpy(resp, subst, subst_len); resp += subst_len; + *resp = '\0'; p = p1 + kw_len; } else break; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r250079 - in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/ntb sys/dev/ntb/if_ntb sys/dev/ntb/ntb_hw sys/modules sys/modules/ntb sys/modules/ntb/if_ntb sys/modules/ntb/ntb_hw
Author: carl Date: Mon Apr 29 22:48:53 2013 New Revision: 250079 URL: http://svnweb.freebsd.org/changeset/base/250079 Log: Add a new driver to support the Intel Non-Transparent Bridge(NTB). The NTB allows you to connect two systems with this device using a PCI-e link. The driver is made of two modules: - ntb_hw which is a basic hardware abstraction layer for the device. - if_ntb which implements the ntb network device and the communication protocol. The driver is limited at the moment to CPU memcpy instead of using DMA, and only Back-to-Back mode is supported. Also the network device isn't full featured yet. These changes will be coming soon. The DMA change will also bring in the ioat driver from the project branch it is on now. This is an initial port of the GPL/BSD Linux driver contributed by Jon Mason from Intel. Any bugs are my contributions. Sponsored by: Intel Reviewed by: jimharris, joel (man page only) Approved by: jimharris (mentor) Added: head/share/man/man4/ntb.4 (contents, props changed) head/sys/dev/ntb/ head/sys/dev/ntb/if_ntb/ head/sys/dev/ntb/if_ntb/if_ntb.c (contents, props changed) head/sys/dev/ntb/ntb_hw/ head/sys/dev/ntb/ntb_hw/ntb_hw.c (contents, props changed) head/sys/dev/ntb/ntb_hw/ntb_hw.h (contents, props changed) head/sys/dev/ntb/ntb_hw/ntb_regs.h (contents, props changed) head/sys/modules/ntb/ head/sys/modules/ntb/Makefile (contents, props changed) head/sys/modules/ntb/if_ntb/ head/sys/modules/ntb/if_ntb/Makefile (contents, props changed) head/sys/modules/ntb/ntb_hw/ head/sys/modules/ntb/ntb_hw/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/amd64/conf/NOTES head/sys/conf/files.amd64 head/sys/modules/Makefile Modified: head/share/man/man4/Makefile == --- head/share/man/man4/MakefileMon Apr 29 21:49:22 2013 (r250078) +++ head/share/man/man4/MakefileMon Apr 29 22:48:53 2013 (r250079) @@ -333,6 +333,7 @@ MAN=aac.4 \ ng_vlan.4 \ nmdm.4 \ nsp.4 \ + ${_ntb.4} \ null.4 \ ${_nvd.4} \ ${_nve.4} \ @@ -647,6 +648,7 @@ MLINKS+=netintro.4 net.4 \ netintro.4 networking.4 MLINKS+=${_nfe.4} ${_if_nfe.4} MLINKS+=nge.4 if_nge.4 +MLINKS+=${_ntb.4} ${_if_ntb.4} ${_ntb_hw.4} MLINKS+=${_nve.4} ${_if_nve.4} MLINKS+=${_nxge.4} ${_if_nxge.4} MLINKS+=patm.4 if_patm.4 @@ -784,6 +786,9 @@ MLINKS+=lindev.4 full.4 .if ${MACHINE_CPUARCH} == "amd64" _bhyve.4= bhyve.4 +_if_ntb.4= if_ntb.4 +_ntb.4=ntb.4 +_ntb_hw.4= ntb_hw.4 _qlxgb.4= qlxgb.4 _sfxge.4= sfxge.4 Added: head/share/man/man4/ntb.4 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/ntb.4 Mon Apr 29 22:48:53 2013(r250079) @@ -0,0 +1,114 @@ +.\" +.\" Copyright (c) 2013 Intel Corporation +.\" 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, +.\"without modification. +.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer +.\"substantially similar to the "NO WARRANTY" disclaimer below +.\"("Disclaimer") and any redistribution must be conditioned upon +.\"including a substantially similar Disclaimer requirement for further +.\"binary redistribution. +.\" +.\" NO WARRANTY +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR +.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +.\" HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. +.\" +.\" ntb driver man page. +.\" +.\" Author: Carl Delsey +.\" +.\" $FreeBSD$ +.\" +.Dd Apr 11, 2013 +.Dt NTB 4 +.Os +.Sh NAME +.Nm ntb , +.Nm ntb_hw , +.Nm if_ntb +.Nd Intel(R) Non-Transparent Bridge driver +.Sh SYNOPSIS +To compile this driver into your kernel, +place the following lines in your kernel configuration file: +.Bd -ragged -offset indent +.Cd "device ntb_hw" +.Cd "device if_ntb" +.Ed +.Pp +Or, to load the d
Re: svn commit: r249939 - head/sys/cam/scsi
On Fri, Apr 26, 2013 at 16:17:05 +, Steven Hartland wrote: > Author: smh > Date: Fri Apr 26 16:17:04 2013 > New Revision: 249939 > URL: http://svnweb.freebsd.org/changeset/base/249939 > > Log: > Added available delete methods discovery during device probe, including the > maximum sizes for said methods, which are used when processing BIO_DELETE > requests. This includes updating UNMAP support discovery to be based on > SBC-3 T10/1799-D Revision 31 specification. > > Added ATA TRIM support to cam scsi devices via ATA Pass-Through(16) > > sys/cam/scsi/scsi_da.c: > - Added ATA Data Set Management TRIM support via ATA > Pass-Through(16) > as a delete_method > This adds a lot of unnecessary verbosity for devices that don't support ATA passthrough. For example: (da7:iscsi4:0:0:0): ATA COMMAND PASS THROUGH(16). CDB: 85 08 0a 00 00 02 00 00 00 00 00 00 00 40 ec 00 (da7:iscsi4:0:0:0): CAM status: SCSI Status Error (da7:iscsi4:0:0:0): SCSI status: Check Condition (da7:iscsi4:0:0:0): Retrying command (per sense data) (2:2:0:0): ATA COMMAND PASS THROUGH(16). CDB: 85 08 0a 00 00 02 00 00 00 00 00 00 00 40 ec 00 (2:2:0:0): Tag: 0x00f6, Type: 1 (2:2:0:0): CTL Status: SCSI Error (2:2:0:0): SCSI Status: Check Condition (2:2:0:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid command operation code) (2:2:0:0): Command byte 0 is invalid (da8:iscsi4:0:0:1): ATA COMMAND PASS THROUGH(16). CDB: 85 08 0a 00 00 02 00 00 00 00 00 00 00 40 ec 00 (da8:iscsi4:0:0:1): CAM status: SCSI Status Error (da8:iscsi4:0:0:1): SCSI status: Check Condition (da8:iscsi4:0:0:1): Retrying command (per sense data) (da8:iscsi4:0:0:1): ATA COMMAND PASS THROUGH(16). CDB: 85 08 0a 00 00 02 00 00 00 00 00 00 00 40 ec 00 (da8:iscsi4:0:0:1): CAM status: SCSI Status Error (da8:iscsi4:0:0:1): SCSI status: Check Condition (da8:iscsi4:0:0:1): Error 5, Retries exhausted That is with CTL and and trasz's new iSCSI initiator, but you should see it with any CTL configuration. (And probably with any controller or device that doesn't support ATA passthrough.) So, please: - Check for the presence of VPD page 0x89 before sending an ATA passthrough command. The spec (sat3r03 in this case) says that it "shall" be implemented, so I think we can count on that. - If the target returns an illegal request sense key, don't retry again. The target will keep returning illegal request Ken -- Kenneth Merry k...@freebsd.org ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r250081 - head/sys/xen/xenstore
Author: gibbs Date: Mon Apr 29 23:08:13 2013 New Revision: 250081 URL: http://svnweb.freebsd.org/changeset/base/250081 Log: xenstore/xenstore.c: Prevent access to invalid memory region when listing an empty directory in the XenStore. Reported by: Bei Guan MFC after:1 week Modified: head/sys/xen/xenstore/xenstore.c Modified: head/sys/xen/xenstore/xenstore.c == --- head/sys/xen/xenstore/xenstore.cMon Apr 29 22:54:26 2013 (r250080) +++ head/sys/xen/xenstore/xenstore.cMon Apr 29 23:08:13 2013 (r250081) @@ -307,7 +307,8 @@ split(char *strings, u_int len, u_int *n const char **ret; /* Protect against unterminated buffers. */ - strings[len - 1] = '\0'; + if (len > 0) + strings[len - 1] = '\0'; /* Count the strings. */ *num = extract_strings(strings, /*dest*/NULL, len); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r249939 - head/sys/cam/scsi
- Original Message - From: "Kenneth D. Merry" To: "Steven Hartland" Cc: ; ; Sent: Monday, April 29, 2013 11:56 PM Subject: Re: svn commit: r249939 - head/sys/cam/scsi On Fri, Apr 26, 2013 at 16:17:05 +, Steven Hartland wrote: Author: smh Date: Fri Apr 26 16:17:04 2013 New Revision: 249939 URL: http://svnweb.freebsd.org/changeset/base/249939 Log: Added available delete methods discovery during device probe, including the maximum sizes for said methods, which are used when processing BIO_DELETE requests. This includes updating UNMAP support discovery to be based on SBC-3 T10/1799-D Revision 31 specification. Added ATA TRIM support to cam scsi devices via ATA Pass-Through(16) sys/cam/scsi/scsi_da.c: - Added ATA Data Set Management TRIM support via ATA Pass-Through(16) as a delete_method This adds a lot of unnecessary verbosity for devices that don't support ATA passthrough. For example: (da7:iscsi4:0:0:0): ATA COMMAND PASS THROUGH(16). CDB: 85 08 0a 00 00 02 00 00 00 00 00 00 00 40 ec 00 (da7:iscsi4:0:0:0): CAM status: SCSI Status Error (da7:iscsi4:0:0:0): SCSI status: Check Condition (da7:iscsi4:0:0:0): Retrying command (per sense data) (2:2:0:0): ATA COMMAND PASS THROUGH(16). CDB: 85 08 0a 00 00 02 00 00 00 00 00 00 00 40 ec 00 (2:2:0:0): Tag: 0x00f6, Type: 1 (2:2:0:0): CTL Status: SCSI Error (2:2:0:0): SCSI Status: Check Condition (2:2:0:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid command operation code) (2:2:0:0): Command byte 0 is invalid (da8:iscsi4:0:0:1): ATA COMMAND PASS THROUGH(16). CDB: 85 08 0a 00 00 02 00 00 00 00 00 00 00 40 ec 00 (da8:iscsi4:0:0:1): CAM status: SCSI Status Error (da8:iscsi4:0:0:1): SCSI status: Check Condition (da8:iscsi4:0:0:1): Retrying command (per sense data) (da8:iscsi4:0:0:1): ATA COMMAND PASS THROUGH(16). CDB: 85 08 0a 00 00 02 00 00 00 00 00 00 00 40 ec 00 (da8:iscsi4:0:0:1): CAM status: SCSI Status Error (da8:iscsi4:0:0:1): SCSI status: Check Condition (da8:iscsi4:0:0:1): Error 5, Retries exhausted That is with CTL and and trasz's new iSCSI initiator, but you should see it with any CTL configuration. (And probably with any controller or device that doesn't support ATA passthrough.) So, please: - Check for the presence of VPD page 0x89 before sending an ATA passthrough command. The spec (sat3r03 in this case) says that it "shall" be implemented, so I think we can count on that. - If the target returns an illegal request sense key, don't retry again. The target will keep returning illegal request Thanks for the report Ken I'll check this on a card I know doesn't support pass-through. Regards Steve ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r250082 - head/sys/contrib/dev/ath/ath_hal/ar9300
Author: adrian Date: Mon Apr 29 23:57:41 2013 New Revision: 250082 URL: http://svnweb.freebsd.org/changeset/base/250082 Log: Sync from git - ah_config is in 'ath_hal', not 'ath_hal_private' on FreeBSD. Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c == --- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.cMon Apr 29 23:08:13 2013(r250081) +++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.cMon Apr 29 23:57:41 2013(r250082) @@ -704,7 +704,7 @@ ar9300_ani_control(struct ath_hal *ah, H return AH_TRUE; } /* if we're turning off ANI, reset regs back to INI settings */ -if (AH_PRIVATE(ah)->ah_config.ath_hal_enable_ani) { +if (ah->ah_config.ath_hal_enable_ani) { HAL_ANI_CMD savefunc = ahp->ah_ani_function; /* temporarly allow all functions so we can reset */ ahp->ah_ani_function = HAL_ANI_ALL; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r250083 - head/usr.sbin/bhyve
Author: neel Date: Tue Apr 30 00:36:16 2013 New Revision: 250083 URL: http://svnweb.freebsd.org/changeset/base/250083 Log: Use a separate mutex for the receive path instead of overloading the softc mutex for this purpose. Reviewed by: grehan Modified: head/usr.sbin/bhyve/pci_virtio_net.c Modified: head/usr.sbin/bhyve/pci_virtio_net.c == --- head/usr.sbin/bhyve/pci_virtio_net.cMon Apr 29 23:57:41 2013 (r250082) +++ head/usr.sbin/bhyve/pci_virtio_net.cTue Apr 30 00:36:16 2013 (r250083) @@ -140,7 +140,6 @@ struct pci_vtnet_softc { int vsc_isr; int vsc_tapfd; int vsc_rx_ready; - int tx_in_progress; int resetting; uint32_tvsc_features; @@ -149,9 +148,14 @@ struct pci_vtnet_softc { uint64_tvsc_pfn[VTNET_MAXQ]; struct vring_hqueue vsc_hq[VTNET_MAXQ]; uint16_tvsc_msix_table_idx[VTNET_MAXQ]; + + pthread_mutex_t rx_mtx; + int rx_in_progress; + pthread_t tx_tid; pthread_mutex_t tx_mtx; pthread_cond_t tx_cond; + int tx_in_progress; }; #definevtnet_ctx(sc) ((sc)->vsc_pi->pi_vmctx) @@ -220,6 +224,38 @@ pci_vtnet_ring_reset(struct pci_vtnet_so hq->hq_cur_aidx = 0; } +/* + * If the transmit thread is active then stall until it is done. + */ +static void +pci_vtnet_txwait(struct pci_vtnet_softc *sc) +{ + + pthread_mutex_lock(&sc->tx_mtx); + while (sc->tx_in_progress) { + pthread_mutex_unlock(&sc->tx_mtx); + usleep(1); + pthread_mutex_lock(&sc->tx_mtx); + } + pthread_mutex_unlock(&sc->tx_mtx); +} + +/* + * If the receive thread is active then stall until it is done. + */ +static void +pci_vtnet_rxwait(struct pci_vtnet_softc *sc) +{ + + pthread_mutex_lock(&sc->rx_mtx); + while (sc->rx_in_progress) { + pthread_mutex_unlock(&sc->rx_mtx); + usleep(1); + pthread_mutex_lock(&sc->rx_mtx); + } + pthread_mutex_unlock(&sc->rx_mtx); +} + static void pci_vtnet_update_status(struct pci_vtnet_softc *sc, uint32_t value) { @@ -227,21 +263,19 @@ pci_vtnet_update_status(struct pci_vtnet if (value == 0) { DPRINTF(("vtnet: device reset requested !\n")); - /* Wait for TX thread to complete pending desc processing */ sc->resetting = 1; - pthread_mutex_lock(&sc->tx_mtx); - while (sc->tx_in_progress) { - pthread_mutex_unlock(&sc->tx_mtx); - usleep(1); - pthread_mutex_lock(&sc->tx_mtx); - } - - pthread_mutex_unlock(&sc->tx_mtx); - + /* +* Wait for the transmit and receive threads to finish their +* processing. +*/ + pci_vtnet_txwait(sc); + pci_vtnet_rxwait(sc); + + sc->vsc_rx_ready = 0; pci_vtnet_ring_reset(sc, VTNET_RXQ); pci_vtnet_ring_reset(sc, VTNET_TXQ); - sc->vsc_rx_ready = 0; + sc->resetting = 0; } @@ -303,9 +337,9 @@ pci_vtnet_tap_rx(struct pci_vtnet_softc /* * But, will be called when the rx ring hasn't yet -* been set up. +* been set up or the guest is resetting the device. */ - if (sc->vsc_rx_ready == 0) { + if (!sc->vsc_rx_ready || sc->resetting) { /* * Drop the packet and try later. */ @@ -393,9 +427,11 @@ pci_vtnet_tap_callback(int fd, enum ev_t { struct pci_vtnet_softc *sc = param; - pthread_mutex_lock(&sc->vsc_mtx); + pthread_mutex_lock(&sc->rx_mtx); + sc->rx_in_progress = 1; pci_vtnet_tap_rx(sc); - pthread_mutex_unlock(&sc->vsc_mtx); + sc->rx_in_progress = 0; + pthread_mutex_unlock(&sc->rx_mtx); } @@ -462,7 +498,6 @@ pci_vtnet_proctx(struct pci_vtnet_softc vu->vu_tlen = tlen; hq->hq_cur_aidx = aidx + 1; *hq->hq_used_idx = uidx + 1; - } static void @@ -706,21 +741,24 @@ pci_vtnet_init(struct vmctx *ctx, struct } pci_emul_alloc_bar(pi, 0, PCIBAR_IO, VTNET_REGSZ); - + + sc->resetting = 0; + + sc->rx_in_progress = 0; + pthread_mutex_init(&sc->rx_mtx, NULL); + /* * Initialize tx semaphore & spawn TX processing thread * As of now, only one thread for TX desc processing is * spawned. */ sc->tx_in_progress = 0; - sc->resetting = 0; pthread_mutex_init(&sc->tx_mtx, NULL); pthread_cond_init(&sc->tx_co
svn commit: r250086 - head/usr.sbin/bhyve
Author: neel Date: Tue Apr 30 01:14:54 2013 New Revision: 250086 URL: http://svnweb.freebsd.org/changeset/base/250086 Log: Reset some more softc state when the guest resets the virtio network device. Obtained from:NetApp Modified: head/usr.sbin/bhyve/pci_virtio_net.c Modified: head/usr.sbin/bhyve/pci_virtio_net.c == --- head/usr.sbin/bhyve/pci_virtio_net.cTue Apr 30 00:49:30 2013 (r250085) +++ head/usr.sbin/bhyve/pci_virtio_net.cTue Apr 30 01:14:54 2013 (r250086) @@ -259,6 +259,7 @@ pci_vtnet_rxwait(struct pci_vtnet_softc static void pci_vtnet_update_status(struct pci_vtnet_softc *sc, uint32_t value) { + int i; if (value == 0) { DPRINTF(("vtnet: device reset requested !\n")); @@ -276,6 +277,12 @@ pci_vtnet_update_status(struct pci_vtnet pci_vtnet_ring_reset(sc, VTNET_RXQ); pci_vtnet_ring_reset(sc, VTNET_TXQ); + for (i = 0; i < VTNET_MAXQ; i++) + sc->vsc_msix_table_idx[i] = VIRTIO_MSI_NO_VECTOR; + + sc->vsc_isr = 0; + sc->vsc_features = 0; + sc->resetting = 0; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r250087 - head
Author: peter Date: Tue Apr 30 01:15:10 2013 New Revision: 250087 URL: http://svnweb.freebsd.org/changeset/base/250087 Log: Oh wow.. disassociate/disown any connection with cvs. Modified: head/MAINTAINERS Modified: head/MAINTAINERS == --- head/MAINTAINERSTue Apr 30 01:14:54 2013(r250086) +++ head/MAINTAINERSTue Apr 30 01:15:10 2013(r250087) @@ -64,7 +64,6 @@ linprocfs des Pre-commit review requeste lprgad Pre-commit review requested, particularly for lpd/recvjob.c and lpd/printjob.c. newsyslog(8) gad Heads-up appreciated. I'm going thru the PR's for it. -cvspeter Heads-up appreciated, try not to break it. nvipeter Try not to break it. libz peter Try not to break it. groff ru Recommends pre-commit review. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r249939 - head/sys/cam/scsi
- Original Message - From: "Steven Hartland" On Fri, Apr 26, 2013 at 16:17:05 +, Steven Hartland wrote: Author: smh Date: Fri Apr 26 16:17:04 2013 New Revision: 249939 URL: http://svnweb.freebsd.org/changeset/base/249939 Log: Added available delete methods discovery during device probe, including the maximum sizes for said methods, which are used when processing BIO_DELETE requests. This includes updating UNMAP support discovery to be based on SBC-3 T10/1799-D Revision 31 specification. Added ATA TRIM support to cam scsi devices via ATA Pass-Through(16) sys/cam/scsi/scsi_da.c: - Added ATA Data Set Management TRIM support via ATA Pass-Through(16) as a delete_method This adds a lot of unnecessary verbosity for devices that don't support ATA passthrough. For example: (da7:iscsi4:0:0:0): ATA COMMAND PASS THROUGH(16). CDB: 85 08 0a 00 00 02 00 00 00 00 00 00 00 40 ec 00 (da7:iscsi4:0:0:0): CAM status: SCSI Status Error (da7:iscsi4:0:0:0): SCSI status: Check Condition (da7:iscsi4:0:0:0): Retrying command (per sense data) (2:2:0:0): ATA COMMAND PASS THROUGH(16). CDB: 85 08 0a 00 00 02 00 00 00 00 00 00 00 40 ec 00 (2:2:0:0): Tag: 0x00f6, Type: 1 (2:2:0:0): CTL Status: SCSI Error (2:2:0:0): SCSI Status: Check Condition (2:2:0:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid command operation code) (2:2:0:0): Command byte 0 is invalid (da8:iscsi4:0:0:1): ATA COMMAND PASS THROUGH(16). CDB: 85 08 0a 00 00 02 00 00 00 00 00 00 00 40 ec 00 (da8:iscsi4:0:0:1): CAM status: SCSI Status Error (da8:iscsi4:0:0:1): SCSI status: Check Condition (da8:iscsi4:0:0:1): Retrying command (per sense data) (da8:iscsi4:0:0:1): ATA COMMAND PASS THROUGH(16). CDB: 85 08 0a 00 00 02 00 00 00 00 00 00 00 40 ec 00 (da8:iscsi4:0:0:1): CAM status: SCSI Status Error (da8:iscsi4:0:0:1): SCSI status: Check Condition (da8:iscsi4:0:0:1): Error 5, Retries exhausted That is with CTL and and trasz's new iSCSI initiator, but you should see it with any CTL configuration. (And probably with any controller or device that doesn't support ATA passthrough.) So, please: - Check for the presence of VPD page 0x89 before sending an ATA passthrough command. The spec (sat3r03 in this case) says that it "shall" be implemented, so I think we can count on that. - If the target returns an illegal request sense key, don't retry again. The target will keep returning illegal request Thanks for the report Ken I'll check this on a card I know doesn't support pass-through. I checked with an areca controller, which I know doesn't support pass16, and all is quiet during boot / probe. I can provoke output at the app layer with camcontrol identify da0, which is to be expected, but nothing in /var/log/messages. daerror handler in scsi_da.c definitely has SF_QUIET_IR so Illegal Request should never be output. I can't provoke this using standard CAM devices even when they don't support ATA Pass-Through (16) so I think this is actually an issue with CTL: 1. Being verbose when it shouldn't (ctl_process_done - line 12571?) 2. Retrying Illegal Request commands when it shouldn't (I didn't experince this on r250032) The attached patch implements a check for ATA Information VPD before using ATA Pass-Through (16). It's had limited testing but I have confirmed it eliminates the use of pass16 under CTL and still enables ATA TRIM under on mpt for SATA disks, so looks promising. If you could test and let me know if it works for you Ken that would be appreciated. The test case I used for CTL was:- kldload ctl ctladm create -b ramdisk -s 10485760 ctladm port -o on As a side note while test "kldload ctl" caused kernel panic the once. If anyone's interested the trace was:- #0 doadump (textdump=0) at pcpu.h:231 #1 0x802f6d6e in db_dump (dummy=, dummy2=0, dummy3=0, dummy4=0x0) at /usr/home/smh/freebsd/base/head/sys/ddb/db_command.c:543 #2 0x802f683d in db_command (cmd_table=) at /usr/home/smh/freebsd/base/head/sys/ddb/db_command.c:449 #3 0x802f65b4 in db_command_loop () at /usr/home/smh/freebsd/base/head/sys/ddb/db_command.c:502 #4 0x802f8f50 in db_trap (type=, code=0) at /usr/home/smh/freebsd/base/head/sys/ddb/db_main.c:231 #5 0x805c0df3 in kdb_trap (type=9, code=0, tf=) at /usr/home/smh/freebsd/base/head/sys/kern/subr_kdb.c:654 #6 0x8075580a in trap_fatal (frame=0xff823b8dc790, eva=) at /usr/home/smh/freebsd/base/head/sys/amd64/amd64/trap.c:867 #7 0x807554b7 in trap (frame=) at /usr/home/smh/freebsd/base/head/sys/amd64/amd64/trap.c:224 #8 0x8073e1f2 in calltrap () at /usr/home/smh/freebsd/base/head/sys/amd64/amd64/exception.S:228 #9 0x8029c860 in cam_periph_alloc (periph_ctor=0x802af410 , periph_oninvalidate=0xfe0019cfa200, periph_dtor=, periph_start=0xfe0015980a90, name=out>, type=2159638184, path=0xfe0015ad79a0, ac_callback=, code=) at /usr/home/smh/freebsd/base/head/sys/cam/cam_periph.c:227 #1
Re: svn commit: r249774 - head/sys/boot/fdt/dts
On Apr 22, 2013, at 11:53 AM, Oleksandr Tymoshenko wrote: > Author: gonzo > Date: Mon Apr 22 18:53:36 2013 > New Revision: 249774 > URL: http://svnweb.freebsd.org/changeset/base/249774 > > Log: > Split BeagleBone DTS to generic AM335x part and Beagle-bone specific > > Added: > head/sys/boot/fdt/dts/am335x.dtsi (contents, props changed) > Modified: > head/sys/boot/fdt/dts/beaglebone.dts > > Added: head/sys/boot/fdt/dts/am335x.dtsi > == > + > +/ { > + compatible = "ti,am335x"; > > Modified: head/sys/boot/fdt/dts/beaglebone.dts > == > > +/include/ "am335x.dtsi" > + > / { > model = "beaglebone"; > - compatible = "beaglebone", "ti,am335x"; This used to have two "compatible" names; now it only has one. Is there a way to have both again? (Mostly I'm just curious; I'm still learning FDT conventions.) Tim ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r250088 - head/sys/dev/bktr
Author: pluknet Date: Tue Apr 30 05:08:17 2013 New Revision: 250088 URL: http://svnweb.freebsd.org/changeset/base/250088 Log: Pass a format string to kproc_create() [1] and thus fix the build with -DBKTR_NEW_MSP34XX_DRIVER and -Wformat-security. This also allows to eliminates a superfluous malloc/snprintf/free on intermediate buffer. PR: kern/175546 MFC after:1 week Modified: head/sys/dev/bktr/msp34xx.c Modified: head/sys/dev/bktr/msp34xx.c == --- head/sys/dev/bktr/msp34xx.c Tue Apr 30 01:15:10 2013(r250087) +++ head/sys/dev/bktr/msp34xx.c Tue Apr 30 05:08:17 2013(r250088) @@ -134,7 +134,6 @@ struct msp3400c { /* thread */ struct proc *kthread; - char*threaddesc; int active,restart,rmmod; @@ -1147,12 +1146,6 @@ int msp_attach(bktr_ptr_t bktr) msp->bass = 32768; msp->treble = 32768; msp->input = -1; - msp->threaddesc = malloc(15 * sizeof(char), M_DEVBUF, M_NOWAIT); - if (msp->threaddesc == NULL) { - free(msp, M_DEVBUF); -return ENOMEM; - } - snprintf(msp->threaddesc, 14, "%s_msp34xx_thread", bktr->bktr_xname); for (i = 0; i < DFP_COUNT; i++) msp->dfp_regs[i] = -1; @@ -1163,7 +1156,6 @@ int msp_attach(bktr_ptr_t bktr) if (-1 != rev1) rev2 = msp3400c_read(bktr, I2C_MSP3400C_DFP, 0x1f); if ((-1 == rev1) || (0 == rev1 && 0 == rev2)) { - free(msp->threaddesc, M_DEVBUF); free(msp, M_DEVBUF); bktr->msp3400c_info = NULL; printf("%s: msp3400: error while reading chip version\n", bktr_name(bktr)); @@ -1199,10 +1191,9 @@ int msp_attach(bktr_ptr_t bktr) /* startup control thread */ err = kproc_create(msp->simple ? msp3410d_thread : msp3400c_thread, bktr, &msp->kthread, (RFFDG | RFPROC), 0, -msp->threaddesc); +"%s_msp34xx_thread", bktr->bktr_xname); if (err) { printf("%s: Error returned by kproc_create: %d", bktr_name(bktr), err); - free(msp->threaddesc, M_DEVBUF); free(msp, M_DEVBUF); bktr->msp3400c_info = NULL; return ENXIO; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r250090 - in head/sys/dev/cxgbe: . common firmware
Author: np Date: Tue Apr 30 05:32:07 2013 New Revision: 250090 URL: http://svnweb.freebsd.org/changeset/base/250090 Log: cxgbe(4): Some updates to shared code. Obtained from:Chelsio MFC after:1 week Modified: head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/firmware/t4fw_interface.h head/sys/dev/cxgbe/osdep.h Modified: head/sys/dev/cxgbe/common/common.h == --- head/sys/dev/cxgbe/common/common.h Tue Apr 30 05:30:09 2013 (r250089) +++ head/sys/dev/cxgbe/common/common.h Tue Apr 30 05:32:07 2013 (r250090) @@ -424,7 +424,7 @@ int t4_read_flash(struct adapter *adapte int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size); int t4_load_boot(struct adapter *adap, u8 *boot_data, unsigned int boot_addr, unsigned int size); -unsigned int t4_flash_cfg_addr(struct adapter *adapter); +int t4_flash_cfg_addr(struct adapter *adapter); int t4_load_cfg(struct adapter *adapter, const u8 *cfg_data, unsigned int size); int t4_get_fw_version(struct adapter *adapter, u32 *vers); int t4_get_tp_version(struct adapter *adapter, u32 *vers); Modified: head/sys/dev/cxgbe/common/t4_hw.c == --- head/sys/dev/cxgbe/common/t4_hw.c Tue Apr 30 05:30:09 2013 (r250089) +++ head/sys/dev/cxgbe/common/t4_hw.c Tue Apr 30 05:32:07 2013 (r250090) @@ -176,9 +176,7 @@ static void t4_report_fw_error(struct ad u32 pcie_fw; pcie_fw = t4_read_reg(adap, A_PCIE_FW); - if (!(pcie_fw & F_PCIE_FW_ERR)) - CH_ERR(adap, "Firmware error report called with no error\n"); - else + if (pcie_fw & F_PCIE_FW_ERR) CH_ERR(adap, "Firmware reports adapter error: %s\n", reason[G_PCIE_FW_EVAL(pcie_fw)]); } @@ -512,6 +510,7 @@ struct t4_vpd_hdr { #define VPD_BASE_OLD 0 #define VPD_LEN1024 #define VPD_INFO_FLD_HDR_SIZE 3 +#define CHELSIO_VPD_UNIQUE_ID 0x82 /** * t4_seeprom_read - read a serial EEPROM location @@ -676,7 +675,7 @@ static int get_vpd_params(struct adapter * it at 0. */ ret = t4_seeprom_read(adapter, VPD_BASE, (u32 *)(vpd)); - addr = *vpd == 0x82 ? VPD_BASE : VPD_BASE_OLD; + addr = *vpd == CHELSIO_VPD_UNIQUE_ID ? VPD_BASE : VPD_BASE_OLD; for (i = 0; i < sizeof(vpd); i += 4) { ret = t4_seeprom_read(adapter, addr + i, (u32 *)(vpd + i)); @@ -714,8 +713,10 @@ static int get_vpd_params(struct adapter i = vpd[sn - VPD_INFO_FLD_HDR_SIZE + 2]; memcpy(p->sn, vpd + sn, min(i, SERNUM_LEN)); strstrip(p->sn); + i = vpd[pn - VPD_INFO_FLD_HDR_SIZE + 2]; memcpy(p->pn, vpd + pn, min(i, PN_LEN)); strstrip((char *)p->pn); + i = vpd[na - VPD_INFO_FLD_HDR_SIZE + 2]; memcpy(p->na, vpd + na, min(i, MACADDR_LEN)); strstrip((char *)p->na); @@ -1034,14 +1035,19 @@ static int t4_flash_erase_sectors(struct * @adapter: the adapter * * Return the address within the flash where the Firmware Configuration - * File is stored. + * File is stored, or an error if the device FLASH is too small to contain + * a Firmware Configuration File. */ -unsigned int t4_flash_cfg_addr(struct adapter *adapter) +int t4_flash_cfg_addr(struct adapter *adapter) { - if (adapter->params.sf_size == 0x10) - return FLASH_FPGA_CFG_START; - else - return FLASH_CFG_START; + /* +* If the device FLASH isn't large enough to hold a Firmware +* Configuration File, return an error. +*/ + if (adapter->params.sf_size < FLASH_CFG_START + FLASH_CFG_MAX_SIZE) + return -ENOSPC; + + return FLASH_CFG_START; } /** @@ -1054,12 +1060,16 @@ unsigned int t4_flash_cfg_addr(struct ad */ int t4_load_cfg(struct adapter *adap, const u8 *cfg_data, unsigned int size) { - int ret, i, n; + int ret, i, n, cfg_addr; unsigned int addr; unsigned int flash_cfg_start_sec; unsigned int sf_sec_size = adap->params.sf_size / adap->params.sf_nsec; - addr = t4_flash_cfg_addr(adap); + cfg_addr = t4_flash_cfg_addr(adap); + if (cfg_addr < 0) + return cfg_addr; + + addr = cfg_addr; flash_cfg_start_sec = addr / SF_SEC_SIZE; if (size > FLASH_CFG_MAX_SIZE) { @@ -1839,7 +1849,8 @@ void t4_ulprx_read_la(struct adapter *ad } #define ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ -FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_ANEG) +FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_40G | \ +FW_PORT_CAP_SPEED_100G | FW_PORT_CAP_ANEG) /** * t4_link_start - apply link configuration to MAC/PHY @@ -2406,8 +2417,13 @@ static void mem_i
svn commit: r250092 - head/sys/dev/cxgbe
Author: np Date: Tue Apr 30 05:51:52 2013 New Revision: 250092 URL: http://svnweb.freebsd.org/changeset/base/250092 Log: - Provide accurate ifmedia information so that 40G ports/transceivers are displayed properly in ifconfig, etc. - Use the same number of tx and rx queues for a 40G port as for a 10G port. MFC after:1 week Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hTue Apr 30 05:39:42 2013 (r250091) +++ head/sys/dev/cxgbe/adapter.hTue Apr 30 05:51:52 2013 (r250092) @@ -757,6 +757,13 @@ is_10G_port(const struct port_info *pi) return ((pi->link_cfg.supported & FW_PORT_CAP_SPEED_10G) != 0); } +static inline bool +is_40G_port(const struct port_info *pi) +{ + + return ((pi->link_cfg.supported & FW_PORT_CAP_SPEED_40G) != 0); +} + static inline int tx_resume_threshold(struct sge_eq *eq) { Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cTue Apr 30 05:39:42 2013 (r250091) +++ head/sys/dev/cxgbe/t4_main.cTue Apr 30 05:51:52 2013 (r250092) @@ -666,7 +666,7 @@ t4_attach(device_t dev) device_get_nameunit(dev), i); mtx_init(&pi->pi_lock, pi->lockname, 0, MTX_DEF); - if (is_10G_port(pi)) { + if (is_10G_port(pi) || is_40G_port(pi)) { n10g++; pi->tmr_idx = t4_tmr_idx_10g; pi->pktc_idx = t4_pktc_idx_10g; @@ -756,7 +756,7 @@ t4_attach(device_t dev) pi->first_rxq = rqidx; pi->first_txq = tqidx; - if (is_10G_port(pi)) { + if (is_10G_port(pi) || is_40G_port(pi)) { pi->nrxq = iaq.nrxq10g; pi->ntxq = iaq.ntxq10g; } else { @@ -771,7 +771,7 @@ t4_attach(device_t dev) if (is_offload(sc)) { pi->first_ofld_rxq = ofld_rqidx; pi->first_ofld_txq = ofld_tqidx; - if (is_10G_port(pi)) { + if (is_10G_port(pi) || is_40G_port(pi)) { pi->nofldrxq = iaq.nofldrxq10g; pi->nofldtxq = iaq.nofldtxq10g; } else { @@ -2595,16 +2595,47 @@ build_medialist(struct port_info *pi) case FW_PORT_MOD_TYPE_NA: case FW_PORT_MOD_TYPE_ER: default: + device_printf(pi->dev, + "unknown port_type (%d), mod_type (%d)\n", + pi->port_type, pi->mod_type); + ifmedia_add(media, m | IFM_UNKNOWN, data, NULL); + ifmedia_set(media, m | IFM_UNKNOWN); + break; + } + break; + + case FW_PORT_TYPE_QSFP: + switch (pi->mod_type) { + + case FW_PORT_MOD_TYPE_LR: + ifmedia_add(media, m | IFM_40G_LR4, data, NULL); + ifmedia_set(media, m | IFM_40G_LR4); + break; + + case FW_PORT_MOD_TYPE_SR: + ifmedia_add(media, m | IFM_40G_SR4, data, NULL); + ifmedia_set(media, m | IFM_40G_SR4); + break; + case FW_PORT_MOD_TYPE_TWINAX_PASSIVE: + case FW_PORT_MOD_TYPE_TWINAX_ACTIVE: + ifmedia_add(media, m | IFM_40G_CR4, data, NULL); + ifmedia_set(media, m | IFM_40G_CR4); + break; + + default: + device_printf(pi->dev, + "unknown port_type (%d), mod_type (%d)\n", + pi->port_type, pi->mod_type); ifmedia_add(media, m | IFM_UNKNOWN, data, NULL); ifmedia_set(media, m | IFM_UNKNOWN); break; } break; - case FW_PORT_TYPE_KX4: - case FW_PORT_TYPE_KX: - case FW_PORT_TYPE_KR: default: + device_printf(pi->dev, + "unknown port_type (%d), mod_type (%d)\n", pi->port_type, + pi->mod_type); ifmedia_add(media, m | IFM_UNKNOWN, data, NULL); ifmedia_set(media, m | IFM_UNKNOWN); break; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r250093 - head/sys/dev/cxgbe
Author: np Date: Tue Apr 30 06:30:21 2013 New Revision: 250093 URL: http://svnweb.freebsd.org/changeset/base/250093 Log: Attach to the T580 (2 x 40G) card. MFC after:1 week. Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cTue Apr 30 05:51:52 2013 (r250092) +++ head/sys/dev/cxgbe/t4_main.cTue Apr 30 06:30:21 2013 (r250093) @@ -444,6 +444,7 @@ struct { {0x5401, "Chelsio T520-CR"}, {0x5407, "Chelsio T520-SO"}, {0x5408, "Chelsio T520-CX"}, + {0x5410, "Chelsio T580-LP-CR"},/* 2 x 40G */ {0x5411, "Chelsio T520-LL-CR"}, #ifdef notyet {0x5402, "Chelsio T522-CR"}, @@ -458,7 +459,6 @@ struct { {0x540d, "Chelsio T580-CR"}, {0x540e, "Chelsio T540-LP-CR"}, {0x540f, "Chelsio Amsterdam"}, - {0x5410, "Chelsio T580-LP-CR"}, {0x5412, "Chelsio T560-CR"}, {0x5413, "Chelsio T580-CR"}, #endif ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"