]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
15 years agoImplement VOP_VPTOCNP for devfs. Directory and character device vnodes are
Joe Marcus Clarke [Fri, 12 Dec 2008 01:00:38 +0000 (01:00 +0000)]
Implement VOP_VPTOCNP for devfs.  Directory and character device vnodes are
properly translated to their component names.

Reviewed by: arch
Approved by: kib

15 years agoAdd a simple VOP_VPTOCNP implementation for deadfs which returns EBADF.
Joe Marcus Clarke [Fri, 12 Dec 2008 00:59:36 +0000 (00:59 +0000)]
Add a simple VOP_VPTOCNP implementation for deadfs which returns EBADF.

Reviewed by: arch
Approved by: kib

15 years agoAdd a new error VOP, VOP_ENOENT. This function will simply return ENOENT.
Joe Marcus Clarke [Fri, 12 Dec 2008 00:58:52 +0000 (00:58 +0000)]
Add a new error VOP, VOP_ENOENT.  This function will simply return ENOENT.

Reviewed by: arch
Approved by: kib

15 years agoAdd a new VOP, VOP_VPTOCNP, which translates a vnode to its component name
Joe Marcus Clarke [Fri, 12 Dec 2008 00:57:38 +0000 (00:57 +0000)]
Add a new VOP, VOP_VPTOCNP, which translates a vnode to its component name
on a best-effort basis.  Teach vn_fullpath to use this new VOP if a
regular VFS cache lookup fails.  This VOP is designed to supplement the
VFS cache to provide a better chance that a vnode-to-name lookup will
succeed.

Currently, an implementation for devfs is being committed.  The default
implementation is to return ENOENT.

A big thanks to kib for the mentorship on this, and to pho for running it
through his stress test suite.

Reviewed by: arch
Approved by: kib

15 years agoRemove superfluous return statements from the end of void functions.
Andrew Thompson [Thu, 11 Dec 2008 23:17:48 +0000 (23:17 +0000)]
Remove superfluous return statements from the end of void functions.

15 years agoFormat and wrap function declarations.
Andrew Thompson [Thu, 11 Dec 2008 23:13:02 +0000 (23:13 +0000)]
Format and wrap function declarations.

15 years agoAdd entry for if_transmit and if_qflush
Kip Macy [Thu, 11 Dec 2008 22:51:11 +0000 (22:51 +0000)]
Add entry for if_transmit and if_qflush

15 years agoAdd kqueue()-support to pseudo-terminal master devices.
Ed Schouten [Thu, 11 Dec 2008 21:44:02 +0000 (21:44 +0000)]
Add kqueue()-support to pseudo-terminal master devices.

One thing I didn't expect many applications to use, was kqueue() on
pseudo-terminal master devices. There are applications that use kqueue()
on the TTY itself (rtorrent, etc). That doesn't mean we shouldn't
implement this. Libraries like libevent use kqueue() by default, which
means they wouldn't be able to use kqueue().

The old TTY layer implements a very broken version of kqueue() by
performing the actual polling on the TTY device.

Discussed with: peter

15 years agoAdd entries for some Option, Sierra and Stelera 3G cards.
Andrew Thompson [Thu, 11 Dec 2008 21:08:14 +0000 (21:08 +0000)]
Add entries for some Option, Sierra and Stelera 3G cards.

15 years agoDon't forget to add "npts" to rlimit_ident[] as well.
Ed Schouten [Thu, 11 Dec 2008 18:32:05 +0000 (18:32 +0000)]
Don't forget to add "npts" to rlimit_ident[] as well.

When I added RLIMIT_NPTS, I forgot to add it to rlimit_ident[]. Make
sure the rlimit_ident[] array is always RLIM_NLIMITS elements big. So if
we ever forget to add new rlimits to this list again. it will contain a
null pointer, instead of random data.

Spotted by: rwatson

15 years agoFix a leak introduced in r185902. We should free the devspec if
Paul Saab [Thu, 11 Dec 2008 16:48:35 +0000 (16:48 +0000)]
Fix a leak introduced in r185902.  We should free the devspec if
we've successfully found a zfs pool.

15 years agoPut a global variables, which were virtualized but formerly
Bjoern A. Zeeb [Thu, 11 Dec 2008 16:26:38 +0000 (16:26 +0000)]
Put a global variables, which were virtualized but formerly
missed under VIMAGE_GLOBAL.

Start putting the extern declarations of the  virtualized globals
under VIMAGE_GLOBAL as the globals themsevles are already.
This will help by the time when we are going to remove the globals
entirely.

While there garbage collect a few dead externs from ip6_var.h.

Sponsored by: The FreeBSD Foundation

15 years agoPut the VIMAGE options together in one place.
Bjoern A. Zeeb [Thu, 11 Dec 2008 16:13:17 +0000 (16:13 +0000)]
Put the VIMAGE options together in one place.

Sponsored by: The FreeBSD Foundation

15 years agoOrder #includes - also to reduce diffs with vimage branches in p4.
Bjoern A. Zeeb [Thu, 11 Dec 2008 16:09:31 +0000 (16:09 +0000)]
Order #includes - also to reduce diffs with vimage branches in p4.

Sponsored by: The FreeBSD Foundation

15 years agoUse the correct INIT_VNET_INET() as the virtualized variable here
Bjoern A. Zeeb [Thu, 11 Dec 2008 16:05:07 +0000 (16:05 +0000)]
Use the correct INIT_VNET_INET() as the virtualized variable here
are in vinet.h not in vinet6.h

Sponsored by: The FreeBSD Foundation

15 years agoAdd constants for fields in the local APIC error status register and a
John Baldwin [Thu, 11 Dec 2008 15:56:30 +0000 (15:56 +0000)]
Add constants for fields in the local APIC error status register and a
routine to read it.

15 years agoError in case anyone tried to compile with both options VIMAGE and
Bjoern A. Zeeb [Thu, 11 Dec 2008 15:44:53 +0000 (15:44 +0000)]
Error in case anyone tried to compile with both options VIMAGE and
the (temporary) option VIMAGE_GLOBALS.

Sponsored by: The FreeBSD Foundation:

15 years agoWhitespace changes only - tabs must have been converted to spaces
Bjoern A. Zeeb [Thu, 11 Dec 2008 15:42:59 +0000 (15:42 +0000)]
Whitespace changes only - tabs must have been converted to spaces
somehow, when moving the code from p4 to svn.

Sponsored by: The FreeBSD Foundation

15 years agoAdd missing "goto set_head" for SO_IPX_CHECKSUM; otherwise we fall through
Robert Watson [Thu, 11 Dec 2008 10:29:35 +0000 (10:29 +0000)]
Add missing "goto set_head" for SO_IPX_CHECKSUM; otherwise we fall through
to the SO_HEADERS_ON_OUTPUT case and set that instead.

MFC after: 1 week
Found with: Coverity Prevent(tm)
Coverity ID: 3988

15 years agoPush mips support into the tree.
Warner Losh [Thu, 11 Dec 2008 08:22:20 +0000 (08:22 +0000)]
Push mips support into the tree.

15 years agoPush mips support into the tree.
Warner Losh [Thu, 11 Dec 2008 08:20:34 +0000 (08:20 +0000)]
Push mips support into the tree.

15 years agoPush mips support for ld into the tree.
Warner Losh [Thu, 11 Dec 2008 08:18:45 +0000 (08:18 +0000)]
Push mips support for ld into the tree.

15 years agoPush mips support for as into the tree.
Warner Losh [Thu, 11 Dec 2008 08:15:14 +0000 (08:15 +0000)]
Push mips support for as into the tree.

15 years agoRemove redundant assignment.
Warner Losh [Thu, 11 Dec 2008 07:00:23 +0000 (07:00 +0000)]
Remove redundant assignment.

15 years agoApply the same defaults to https as to http.
Dag-Erling Smørgrav [Thu, 11 Dec 2008 06:54:36 +0000 (06:54 +0000)]
Apply the same defaults to https as to http.

Submitted by: Mike Tancsa <mike@sentex.net>
MFC after: 1 week

15 years agoUpdate to the interrupt handling code:
Warner Losh [Thu, 11 Dec 2008 06:27:18 +0000 (06:27 +0000)]
Update to the interrupt handling code:

o Try to be smarter about reading the ExCA CSC register.  Now, we only
  do it for 16-bit cards.  Add some experimental code to treat it like
  a power interrupt, but I'm not 100% sure that I like it.  It may be
  removed upon further testing.  It seemed to help in one test case, but
  the evidence may be inconclusive.  This may be beneficial for cleaning up
  exca_reset and exca_wait_ready.
o Check for CSTS events on the socket event register.  We ask for it when
  we're powering up a card, but I don't think we're otherwise using
  it.  Just ACK the interrupt for now.  In theory, we can use it
  instead of the busy wait we do in cbb_cardbus_reset.  More research
  is necessary to see if we can optimize things there when we're
  waiting for the DEVVENDOR register to become valid.
o Rework the comments a bit.  Minor tidying up.  Etc.

15 years agoadd missing break
Sam Leffler [Thu, 11 Dec 2008 04:03:50 +0000 (04:03 +0000)]
add missing break

Coverity ID: 4159

15 years agoadd missing break
Sam Leffler [Thu, 11 Dec 2008 04:03:13 +0000 (04:03 +0000)]
add missing break

Coverity ID: 4151

15 years agoConsolidate some variable initializations. No substantive change.
David Schultz [Thu, 11 Dec 2008 02:39:27 +0000 (02:39 +0000)]
Consolidate some variable initializations. No substantive change.

15 years agoMake WOL work on RTL8168B. This controller seems to require
Pyun YongHyeon [Thu, 11 Dec 2008 02:24:11 +0000 (02:24 +0000)]
Make WOL work on RTL8168B. This controller seems to require
explicit command to enable Rx MAC prior to entering D3.

Tested by: Cyrus Rahman <crahman <> gmail DOT com>

15 years agoAvoid a double free in devopen by not freeing the device structure
Paul Saab [Thu, 11 Dec 2008 02:23:49 +0000 (02:23 +0000)]
Avoid a double free in devopen by not freeing the device structure
in zfs_dev_open.  This stops a panic in the loader when trying to
read from a zfs device and no zfs devices exist.

15 years agoDon't access undocumented register 0x82 on controllers that
Pyun YongHyeon [Thu, 11 Dec 2008 01:41:38 +0000 (01:41 +0000)]
Don't access undocumented register 0x82 on controllers that
have no such register. While here clear undocumented PHY
register 0x0B for RTL8110S.

Obtained from: RealTek FreeBSD driver

15 years agoNewer RealTek controllers requires setting stop request bit to
Pyun YongHyeon [Thu, 11 Dec 2008 01:26:18 +0000 (01:26 +0000)]
Newer RealTek controllers requires setting stop request bit to
terminate active Tx/Rx operation.

15 years agoCorrectly check the number of prison states to not access anything
Bjoern A. Zeeb [Thu, 11 Dec 2008 01:04:25 +0000 (01:04 +0000)]
Correctly check the number of prison states to not access anything
outside the prison_states array.
When checking if there is a name configured for the prison, check the
first character to not be '\0' instead of checking if the char array
is present, which it always is. Note, that this is different for the
*jailname in the syscall.

Found with: Coverity Prevent(tm)
CID: 4156, 4155
MFC after: 4 weeks (just that I get the mail)

15 years agoAdd 32-bit compat support for AIO.
Bjoern A. Zeeb [Thu, 11 Dec 2008 00:58:05 +0000 (00:58 +0000)]
Add 32-bit compat support for AIO.

jhb probably forgot to commit this file with r185878 and will want to
review this. It unbreaks the build here.

Obtained from: p4 //depot/user/jhb/lock/compat/freebsd32/freebsd32_signal.h#2

15 years agoAlways put controller into known state before device intialization.
Pyun YongHyeon [Thu, 11 Dec 2008 00:46:07 +0000 (00:46 +0000)]
Always put controller into known state before device intialization.
While here remove re_reset calls invoked in system error case as
controller reset is always done in device initialization.

15 years agoPartly revert r185756. RTL8169SC doesn't like reduced delays in
Pyun YongHyeon [Thu, 11 Dec 2008 00:30:26 +0000 (00:30 +0000)]
Partly revert r185756. RTL8169SC doesn't like reduced delays in
GMII access while Tx/Rx is in progress.

Reported by: Jaakko Heinonen <jh <> saunalahti DOT fi>,
Anton Yuzhaninov <citrin <> citrin DOT ru>
Tested by: Jaakko Heinonen <jh <> saunalahti DOT fi>

15 years agoConditionally compile out V_ globals while instantiating the appropriate
Marko Zec [Wed, 10 Dec 2008 23:12:39 +0000 (23:12 +0000)]
Conditionally compile out V_ globals while instantiating the appropriate
container structures, depending on VIMAGE_GLOBALS compile time option.

Make VIMAGE_GLOBALS a new compile-time option, which by default will not
be defined, resulting in instatiations of global variables selected for
V_irtualization (enclosed in #ifdef VIMAGE_GLOBALS blocks) to be
effectively compiled out.  Instantiate new global container structures
to hold V_irtualized variables: vnet_net_0, vnet_inet_0, vnet_inet6_0,
vnet_ipsec_0, vnet_netgraph_0, and vnet_gif_0.

Update the VSYM() macro so that depending on VIMAGE_GLOBALS the V_
macros resolve either to the original globals, or to fields inside
container structures, i.e. effectively

#ifdef VIMAGE_GLOBALS
#define V_rt_tables rt_tables
#else
#define V_rt_tables vnet_net_0._rt_tables
#endif

Update SYSCTL_V_*() macros to operate either on globals or on fields
inside container structs.

Extend the internal kldsym() lookups with the ability to resolve
selected fields inside the virtualization container structs.  This
applies only to the fields which are explicitly registered for kldsym()
visibility via VNET_MOD_DECLARE() and vnet_mod_register(), currently
this is done only in sys/net/if.c.

Fix a few broken instances of MODULE_GLOBAL() macro use in SCTP code,
and modify the MODULE_GLOBAL() macro to resolve to V_ macros, which in
turn result in proper code being generated depending on VIMAGE_GLOBALS.

De-virtualize local static variables in sys/contrib/pf/net/pf_subr.c
which were prematurely V_irtualized by automated V_ prepending scripts
during earlier merging steps.  PF virtualization will be done
separately, most probably after next PF import.

Convert a few variable initializations at instantiation to
initialization in init functions, most notably in ipfw.  Also convert
TUNABLE_INT() initializers for V_ variables to TUNABLE_FETCH_INT() in
initializer functions.

Discussed at: devsummit Strassburg
Reviewed by: bz, julian
Approved by: julian (mentor)
Obtained from: //depot/projects/vimage-commit2/...
X-MFC after: never
Sponsored by: NLnet Foundation, The FreeBSD Foundation

15 years agoMake sure nmbclusters are initialized before maxsockets
Bjoern A. Zeeb [Wed, 10 Dec 2008 22:17:09 +0000 (22:17 +0000)]
Make sure nmbclusters are initialized before maxsockets
by running the tunable_mbinit() SYSINIT at SI_ORDER_MIDDLE
before the init_maxsockets() SYSINT at SI_ORDER_ANY.

Reviewed by: rwatson, zec
Sponsored by: The FreeBSD Foundation
MFC after: 4 weeks

15 years agoStyle changes only. Put the return type on an extra line[1] and
Bjoern A. Zeeb [Wed, 10 Dec 2008 22:10:37 +0000 (22:10 +0000)]
Style changes only. Put the return type on an extra line[1] and
add an empty line at the beginning as we do not have any local
variables.

Submitted by: rwatson [1]
Reviewed by: rwatson
MFC after: 4 weeks

15 years agoRemove added newlines from logged messages written to /dev/console.
Ed Schouten [Wed, 10 Dec 2008 21:48:05 +0000 (21:48 +0000)]
Remove added newlines from logged messages written to /dev/console.

The /dev/console device node logs all strings that are written to it.
When the string does not contain a trailing newline, it appends one. I
can imagine this was useful a long time ago, but with our current
rc-scripts, it generates a whole bunch of messages that look like:

| Configuring syscons:
|  blanktime
| .

By not appending the newlines, the output of `dmesg -a' is now (almost?)
exactly the same as what the user will see on the console device
(syscons, uart).

15 years agoRegen.
John Baldwin [Wed, 10 Dec 2008 20:57:16 +0000 (20:57 +0000)]
Regen.

15 years ago- Add 32-bit compat system calls for VFS_AIO. The system calls live in the
John Baldwin [Wed, 10 Dec 2008 20:56:19 +0000 (20:56 +0000)]
- Add 32-bit compat system calls for VFS_AIO.  The system calls live in the
  aio code and are registered via the recently added SYSCALL32_*() helpers.
- Since the aio code likes to invoke fuword and suword a lot down in the
  "bowels" of system calls, add a structure holding a set of operations for
  things like storing errors, copying in the aiocb structure, storing
  status, etc.  The 32-bit system calls use a separate operations vector to
  handle fuword32 vs fuword, etc.  Also, the oldsigevent handling is now
  done by having seperate operation vectors with different aiocb copyin
  routines.
- Split out kern_foo() functions for the various AIO system calls so the
  32-bit front ends can manage things like copying in and converting
  timespec structures, etc.
- For both the native and 32-bit aio_suspend() and lio_listio() calls,
  just use copyin() to read the array of aiocb pointers instead of using
  a for loop that iterated over fuword/fuword32.  The error handling in
  the old case was incomplete (lio_listio() just ignored any aiocb's that
  it got an EFAULT trying to read rather than reporting an error), and
  possibly slower.

MFC after: 1 month

15 years agoRather than using a char array with explicit assumptions about the layout
John Baldwin [Wed, 10 Dec 2008 19:45:58 +0000 (19:45 +0000)]
Rather than using a char array with explicit assumptions about the layout
of 'struct osigevent' in 'struct aiocb', use int and void pointer spare
members that are identical to 'struct osigevent'.

MFC after: 1 month

15 years agoRelock user map earlier, to have the lock held when break leaves the
Konstantin Belousov [Wed, 10 Dec 2008 16:11:09 +0000 (16:11 +0000)]
Relock user map earlier, to have the lock held when break leaves the
loop earlier due to sbuf error.

Pointy hat to: me
Submitted by: dchagin

15 years agoWe need to pass a structure with enough space for an NFSv2 filehandle to
Doug Rabson [Wed, 10 Dec 2008 14:49:54 +0000 (14:49 +0000)]
We need to pass a structure with enough space for an NFSv2 filehandle to
nfs_srvmtofh_xx otherwise bad things happen when an NFSv2 client tries to
make a request.

15 years agoRemove inconsistent white space from in_pcballoc().
Robert Watson [Wed, 10 Dec 2008 13:24:38 +0000 (13:24 +0000)]
Remove inconsistent white space from in_pcballoc().

MFC after: pretty soon

15 years agoMove syncache flag definitions below data structure, compress some vertical
Robert Watson [Wed, 10 Dec 2008 11:11:43 +0000 (11:11 +0000)]
Move syncache flag definitions below data structure, compress some vertical
whitespace.

MFC after: pretty soon

15 years agoMove flag definitions for t_flags and t_oobflags below the definition of
Robert Watson [Wed, 10 Dec 2008 11:03:16 +0000 (11:03 +0000)]
Move flag definitions for t_flags and t_oobflags below the definition of
struct tcpcb so that the structure definition is a bit more vertically
compact.  Can't yet fit it on one printed page, though.

MFC after: pretty soon

15 years agoDon't get confused if we encounter a device which is part of a raidz or raidz2
Doug Rabson [Wed, 10 Dec 2008 10:46:34 +0000 (10:46 +0000)]
Don't get confused if we encounter a device which is part of a raidz or raidz2
pool while probing for vdevs.

PR: 129539
Submitted by: Paul Wootton (paul at fletchermoorland dot co dot uk)

15 years agofix a reported panic when adding a route and one hit here when deleting a route
Kip Macy [Wed, 10 Dec 2008 09:21:52 +0000 (09:21 +0000)]
fix a reported panic when adding a route and one hit here when deleting a route

- pass RTF_RNH_LOCKED to rtalloc1_fib in 2 cases where the lock is held
- make sure the rnh lock is held across rt_setgate and rt_getifa_fib

15 years agounlock when done
Kip Macy [Wed, 10 Dec 2008 08:23:47 +0000 (08:23 +0000)]
unlock when done

15 years agodon't reference if_addr_mtx directly
Kip Macy [Wed, 10 Dec 2008 08:22:51 +0000 (08:22 +0000)]
don't reference if_addr_mtx directly

15 years agoMove the xprintf hook to where it belongs; it shouldn't be in the
David Schultz [Wed, 10 Dec 2008 02:32:06 +0000 (02:32 +0000)]
Move the xprintf hook to where it belongs; it shouldn't be in the
middle of vfprintf's variable declarations.

15 years agoUpdate comment on INP_TIMEWAIT to say what it's about, as we caution
Robert Watson [Tue, 9 Dec 2008 23:57:09 +0000 (23:57 +0000)]
Update comment on INP_TIMEWAIT to say what it's about, as we caution
regarding the misplacement of flags in inp_vflag in an earlier comment.

MFC after: pretty soon

15 years ago- Limit BCM5701 B5 to 32-bit mode as a workaround for a bug which
Marius Strobl [Tue, 9 Dec 2008 21:34:22 +0000 (21:34 +0000)]
- Limit BCM5701 B5 to 32-bit mode as a workaround for a bug which
  causes data corruption in combination with certain bridges.
  Information about this problem was kindly provided by davidch. [1]
- As BGE_FLAG_PCIX is meant to indicate that the controller is in
  PCI-X mode, revert to the pre __FreeBSD_version 602101 method of
  reading the bus mode register rather than checking the mere
  existence of a PCI-X capability, which is also there when the
  NIC f.e. is put into a 32-bit slot causing it not to be in PCI-X
  mode. Setting BGE_FLAG_PCIX inappropriately could cause the NIC
  to be tuned incorrectly.

PR: 128833 [1]
Reviewed by: jhb
MFC after: 3 days

15 years agoIt does not make much sense to include net/route.h twice.
Bjoern A. Zeeb [Tue, 9 Dec 2008 21:09:05 +0000 (21:09 +0000)]
It does not make much sense to include net/route.h twice.
Remove one #include.

15 years agoAdd rwlock.h (and lock.h for that) to keep no-INET kernels compiling
Bjoern A. Zeeb [Tue, 9 Dec 2008 20:05:58 +0000 (20:05 +0000)]
Add rwlock.h (and lock.h for that) to keep no-INET kernels compiling
after RADIX_NODE_HEAD_{,UN}LOCK() were added.  Must have been "learned"
by pollution before (most likely: route.h -> radix.h -> rwlock.h)

15 years agoFix a bug introduced in r185747: rather than dereferencing an uninitialized
Bjoern A. Zeeb [Tue, 9 Dec 2008 19:44:53 +0000 (19:44 +0000)]
Fix a bug introduced in r185747: rather than dereferencing an uninitialized
*rt to something undefined, use the fibnum that came in as function argument.

Found with: Coverity Prevent(tm)
CID: 4168

15 years agoEnhance one comment relating to recent TCP locking changes, and fix a
Robert Watson [Tue, 9 Dec 2008 15:49:02 +0000 (15:49 +0000)]
Enhance one comment relating to recent TCP locking changes, and fix a
typo in another.

MFC after: 6 weeks

15 years agoMove macros defining flags and shortcus to nested structure fields in
Robert Watson [Tue, 9 Dec 2008 10:21:38 +0000 (10:21 +0000)]
Move macros defining flags and shortcus to nested structure fields in
inpcbinfo below the structure definition in order to make inpcbinfo
fit on a single printed page; related style tweaks.

MFC after: pretty soon

15 years agoFix a cornercase during search
Poul-Henning Kamp [Tue, 9 Dec 2008 09:25:03 +0000 (09:25 +0000)]
Fix a cornercase during search

15 years agoo Use full month name in .Dd macro.
Maxim Konovalov [Tue, 9 Dec 2008 09:24:25 +0000 (09:24 +0000)]
o Use full month name in .Dd macro.

15 years agoFix a long standing VLAN tagged frame handling bug.
Pyun YongHyeon [Tue, 9 Dec 2008 04:30:47 +0000 (04:30 +0000)]
Fix a long standing VLAN tagged frame handling bug.
When VLAN tagged frame is received the hardware sets 'LONG' bit of
Rx status word. It is always set when the size of received frame
exceeded 1518 bytes, including CRC. This VLAN tagged frame clears
'OK' bit of Rx status word such that driver should not rely on 'OK'
bit of Rx status word to pass the VLAN tagged frame to upper stack.

To fix the bug, don't use SIS_CMDSTS_PKT_OK for Rx error check and
introduce SIS_RXSTAT_ERROR macro that checks Rx errors. If we are
configured to accept VLAN tagged frames and the received frame size
is less than or equal to maximum allowed length of VLAN tagged
frame, clear 'LONG' bit of Rx status word before checking Rx
errors.

Reported by: Vladimir Ermako < samflanker <> gmail DOT com >
Tested by: Vladimir Ermako < samflanker <> gmail DOT com >

15 years agoAdd the ability to control the sleep LED with led(4). Adding this fairly
Nathan Whitehorn [Tue, 9 Dec 2008 01:01:02 +0000 (01:01 +0000)]
Add the ability to control the sleep LED with led(4). Adding this fairly
useless feature gives us a reasonably complete PMU implementation.

15 years agoRemove now unused label.
Maxim Sobolev [Tue, 9 Dec 2008 00:25:57 +0000 (00:25 +0000)]
Remove now unused label.

Submitted by: Christoph Mallon
MFC after: 4 weeks
(along with r185779 and r185780)

15 years agoOptimiza assembly in the previous r185779, to save whooping 16 bytes.
Maxim Sobolev [Mon, 8 Dec 2008 23:45:41 +0000 (23:45 +0000)]
Optimiza assembly in the previous r185779, to save whooping 16 bytes.

Submitted by: Christoph Mallon
MFC after: 4 weeks
(including r185779)

15 years agoRespect RBX_MUTE flag from boot[012].
Maxim Sobolev [Mon, 8 Dec 2008 21:52:06 +0000 (21:52 +0000)]
Respect RBX_MUTE flag from boot[012].

MFC after: 4 weeks

15 years agoadd RW_SYSINIT_FLAGS macro and rw_sysinit_flags initialization function
Kip Macy [Mon, 8 Dec 2008 21:46:55 +0000 (21:46 +0000)]
add RW_SYSINIT_FLAGS macro and rw_sysinit_flags initialization function

15 years agoAdd strndup(3) prototype to string.h.
Konstantin Belousov [Mon, 8 Dec 2008 21:04:24 +0000 (21:04 +0000)]
Add strndup(3) prototype to string.h.

This change was erronously ommitted from the r185690, and attempt
to simply add the prototype to string.h has revealed that several
contributed programs defined local prototypes for strndup(), controlled
by autoconfed config.h. So, manually change #undef HAVE_STRNDUP to
#define HAVE_STRNDUP 1. Next import of the corresponding program would
regenerate config.h, overriding the changes in this commit.

No objections from: kan

15 years agoFix typo in the comment %is -> %si.
Maxim Sobolev [Mon, 8 Dec 2008 20:53:27 +0000 (20:53 +0000)]
Fix typo in the comment %is -> %si.

15 years agoMove from solely write-locking the global tcbinfo in tcp_input()
Robert Watson [Mon, 8 Dec 2008 20:27:00 +0000 (20:27 +0000)]
Move from solely write-locking the global tcbinfo in tcp_input()
to read-locking in the TCP input path, allowing greater TCP
input parallelism where multiple ithreads or ithread and netisr
are able to run in parallel.  Previously, most TCP input paths
held a write lock on the global tcbinfo lock, effectively
serializing TCP input.

Before looking up the connection, acquire a write lock if a
potentially state-changing flag is set on the TCP segment header
(FIN, RST, SYN), and otherwise a read lock.  We may later have
to upgrade to a write lock in certain cases (ACKs received by the
syncache or during TIMEWAIT) in order to support global state
transitions, but this is never required for steady-state packets.

Upgrading from a write lock to a read lock must be done as a
trylock operation to avoid deadlocks, and actually violates the
lock order as the tcbinfo lock preceeds the inpcb lock held at
the time of upgrade.  If the trylock fails, we bump the refcount
on the inpcb, drop both locks, and re-acquire in-order.  If
another thread has freed the connection while the locks are
dropped, we free the inpcb and repeat the lookup (this should
hardly ever or never happen in practice).

For now, maintain a number of new counters measuring how many
times various cases execute, and in particular whether various
optimistic assumptions about when read locks can be used, whether
upgrades are done using the fast path, and whether connections
close in practice in the above-described race, actually occur.

MFC after: 6 weeks
Discussed with: kmacy
Reviewed by: bz, gnn, kmacy
Tested by: kmacy

15 years ago- avoid recursively locking the radix node head lock
Kip Macy [Mon, 8 Dec 2008 20:21:57 +0000 (20:21 +0000)]
- avoid recursively locking the radix node head lock
- assert that it is held if RTF_RNH_LOCKED is not passed

15 years agoAdd a reference count to struct inpcb, which may be explicitly
Robert Watson [Mon, 8 Dec 2008 20:18:50 +0000 (20:18 +0000)]
Add a reference count to struct inpcb, which may be explicitly
incremented using in_pcbref(), and decremented using in_pcbfree()
or inpcbrele().  Protocols using only current in_pcballoc() and
in_pcbfree() calls will see the same semantics, but it is now
possible for TCP to call in_pcbref() and in_pcbrele() to prevent
an inpcb from being freed when both tcbinfo and per-inpcb locks
are released.  This makes it possible to safely transition from
holding only the inpcb lock to both tcbinfo and inpcb lock
without re-looking up a connection in the input path, timer
path, etc.

Notice that in_pcbrele() does not unlock the connection after
decrementing the refcount, if the connection remains, so that
the caller can continue to use it; in_pcbrele() returns a flag
indicating whether or not the inpcb pointer is still valid, and
in_pcbfee() is now a simple wrapper around in_pcbrele().

MFC after: 1 month
Discussed with: bz, kmacy
Reviewed by: bz, gnn, kmacy
Tested by: kmacy

15 years ago- Detect Bochs BIOS variants and use HZ_VM as well.
Jung-uk Kim [Mon, 8 Dec 2008 18:39:59 +0000 (18:39 +0000)]
- Detect Bochs BIOS variants and use HZ_VM as well.
- Free kernel environment variable after its use.
- Fix style(9) nits.

15 years agoObey the TMPDIR, TMP, TEMP, or TEMPDIR environment variables
Tim Kientzle [Mon, 8 Dec 2008 17:22:44 +0000 (17:22 +0000)]
Obey the TMPDIR, TMP, TEMP, or TEMPDIR environment variables
when choosing a scratch directory for the tests.  Fallback
to "/tmp", of course.

15 years agoWhite space only: Tabify; white space at EOL removed.
Jens Schweikhardt [Mon, 8 Dec 2008 17:12:40 +0000 (17:12 +0000)]
White space only: Tabify; white space at EOL removed.

15 years ago- Add missing word in comment.
Ulf Lilleengen [Mon, 8 Dec 2008 17:09:02 +0000 (17:09 +0000)]
- Add missing word in comment.

15 years agoMake two style changes to create new commit and document proper commit
Konstantin Belousov [Mon, 8 Dec 2008 13:15:31 +0000 (13:15 +0000)]
Make two style changes to create new commit and document proper commit
message for r185765.

Noted by: rdivacky
Requested by: des

Commit message for r185765 should be:
In procfs map handler, and in linprocfs maps handler, do not call
vn_fullpath() while having vm map locked. This is done in anticipation
of the vop_vptocnp commit, that would make vn_fullpath sometime
acquire vnode lock.

Also, in linprocfs, maps handler already acquires vnode lock.

No objections from: des
MFC after: 2 week

15 years agoChange the linprocfs <pid>/maps and procfs <pid>/map handlers to use
Konstantin Belousov [Mon, 8 Dec 2008 12:34:52 +0000 (12:34 +0000)]
Change the linprocfs <pid>/maps and procfs <pid>/map handlers to use
sbuf instead of doing uiomove. This allows for reads from non-zero
offsets to work.

Patch is forward-ported des@' one, and was adopted to current code
by dchagin@ and me.

Reviewed by: des (linprocfs part)
PR: kern/101453
MFC after: 1 week

15 years agoDo drop vm map lock earlier in the sysctl_kern_proc_vmmap(), to avoid
Konstantin Belousov [Mon, 8 Dec 2008 12:29:30 +0000 (12:29 +0000)]
Do drop vm map lock earlier in the sysctl_kern_proc_vmmap(), to avoid
locking a vnode while having vm map locked.

Reported and tested by: pho
MFC after: 1 week

15 years agoDocument processor errata that affect performance measurement.
Joseph Koshy [Mon, 8 Dec 2008 12:28:48 +0000 (12:28 +0000)]
Document processor errata that affect performance measurement.

15 years agoThe dqrele() function syncs the dq, then acquires the dqh lock, and then
Konstantin Belousov [Mon, 8 Dec 2008 11:04:17 +0000 (11:04 +0000)]
The dqrele() function syncs the dq, then acquires the dqh lock, and then
does final drop of the the dq reference to put it onto the free list.
There is a possibility that the dq would be found by another thread
after sync and before the dqh lock is acquired. If that other thread
drops the dq before we have taken the dqh lock, the dirty dq is put on
the free list.

Recheck the DQ_MOD after the dqh lock is relocked. Repeat dqsync() if
the dq is dirty. This ensures that up to date dq is written in the quota
file and fixes assertion in dqget().

Reported and tested by: Frode Nordahl <frode nordahl net>
MFC after: 3 days

15 years agomutex.h is needed here. It got it by namespace pollution.
Pyun YongHyeon [Mon, 8 Dec 2008 03:48:03 +0000 (03:48 +0000)]
mutex.h is needed here. It got it by namespace pollution.

Pointed out by: bde

15 years agoClean up the mac GPIO interface a little. Also remove bogus copyright
Nathan Whitehorn [Mon, 8 Dec 2008 03:00:45 +0000 (03:00 +0000)]
Clean up the mac GPIO interface a little. Also remove bogus copyright
and 3rd license clause.

Submitted by: Marco Trillo

15 years agoReduce spin wait time consumed in GMII register access routines.
Pyun YongHyeon [Mon, 8 Dec 2008 02:48:41 +0000 (02:48 +0000)]
Reduce spin wait time consumed in GMII register access routines.
Waiting for 1ms for each GMII register access looks overkill and it
may also decrease overall performance of driver because re(4)
invokes mii_tick for every hz.

Tested by: rpaulo

15 years agoAccidentally left ADB out of the PowerPC NOTES file during initial import.
Nathan Whitehorn [Mon, 8 Dec 2008 02:38:13 +0000 (02:38 +0000)]
Accidentally left ADB out of the PowerPC NOTES file during initial import.

15 years agoAdd facilities to pmu(4) to interrogate battery status on Apple PowerPC
Nathan Whitehorn [Mon, 8 Dec 2008 02:37:08 +0000 (02:37 +0000)]
Add facilities to pmu(4) to interrogate battery status on Apple PowerPC
laptops. This includes battery presence detection, charging status, current
and voltage readouts, and charge level indication. The sysctl interface
is somewhat ACPI-like.

15 years agoo Implemented miibus_statchg handler. It detects whether re(4)
Pyun YongHyeon [Mon, 8 Dec 2008 02:34:13 +0000 (02:34 +0000)]
o Implemented miibus_statchg handler. It detects whether re(4)
  established a valid link or not. In miibus_statchg handler add a
  check for established link is valid one for the controller(e.g.
  1000baseT is not a valid link for fastethernet controllers.)
o Added a flag RE_FLAG_FASTETHER to mark fastethernet controllers.
o Added additional check to know whether we've really encountered
  watchdog timeouts or missed Tx completion interrupts. This change
  may help to track down the cause of watchdog timeouts.
o In interrupt handler, removed a check for link state change
  interrupt. Not all controllers have the bit and re(4) did not
  rely on the event for a long time. In addition, re(4) didn't
  request the interrupt in RL_IMR register.

Tested by: rpaulo

15 years agoMake sure to return the result of meida change request.
Pyun YongHyeon [Mon, 8 Dec 2008 01:44:18 +0000 (01:44 +0000)]
Make sure to return the result of meida change request.
Previously it used to return success regardless of the result.

15 years agoAdd missing include to sys/lock.h before sys/rwlock.h
Warner Losh [Mon, 8 Dec 2008 00:28:21 +0000 (00:28 +0000)]
Add missing include to sys/lock.h before sys/rwlock.h

15 years ago- According to the corresponding Linux, NetBSD and OpenSolaris
Marius Strobl [Sun, 7 Dec 2008 23:02:37 +0000 (23:02 +0000)]
- According to the corresponding Linux, NetBSD and OpenSolaris
  drivers, there should be a 1us delay after every write when
  bit-banging the MII. Also insert barriers in order to ensure
  the intended ordering. These changes hopefully will solve the
  bus wedging occasionally experienced with DM9102A since r182461.
- Deobfuscate dc_mii_readreg() a bit.

15 years agoMinor tweaks to some of the comments. Also, add a XXX wondering if we
Warner Losh [Sun, 7 Dec 2008 22:49:47 +0000 (22:49 +0000)]
Minor tweaks to some of the comments.  Also, add a XXX wondering if we
need to frob the 16-bit EXCA registers during the new interrupt-driven
power-up sequence.

15 years agoRestore opt_inet.h include which was lost in the last commit.
Andrew Thompson [Sun, 7 Dec 2008 21:32:56 +0000 (21:32 +0000)]
Restore opt_inet.h include which was lost in the last commit.

15 years ago - convert radix node head lock from mutex to rwlock
Kip Macy [Sun, 7 Dec 2008 21:15:43 +0000 (21:15 +0000)]
 - convert radix node head lock from mutex to rwlock
 - make radix node head lock not recursive
 - fix LOR in rtexpunge
 - fix LOR in rtredirect

Reviewed by: sam

15 years agoPROBLEM: putting in a loader config file a line of the form
Luigi Rizzo [Sun, 7 Dec 2008 19:42:20 +0000 (19:42 +0000)]
PROBLEM: putting in a loader config file a line of the form

        loader_conf_files="foo bar baz"

should cause loading the files listed, and then resume with the
remaining config files (from previous values of the variable).
Unfortunately, sometimes the line was ignored -- actually even
modifying the line in /boot/default/loader.conf  sometimes doesn't work.

ANALYSIS: After much investigation, turned out to be a bug in the logic.
The existing code detected a new assignment by looking at the address
of the the variable containing the string. This only worked by pure
chance, i.e. if the new string is longer than the previous value
then the memory allocator may return a different address
to store the string hence triggering the detection.

SOLUTION: This commit contains a minimal change to fix the problem,
without altering too much the existing structure of the code.
However, as a step towards improving the quality and reliability of
this code, I have introduced a handful of one-line functions
(strget, strset, strfree, string= ) that could be used in dozens
of places in the existing code.

HOWEVER:
There is a much bigger problem here. Even though I am no Forth
expert (as most fellow src committers) I can tell that much of the
forth code (in support.4th at least) is in severe need of a
review/refactoring:

+ pieces of code are replicated multiple times instead of writing
  functions (see e.g.  set_module_*);

+ a lot of stale code (e.g. "structure" definitions for
  preloaded_files, kernel_module, pnp stuff) which is not used
  or at least belongs elsewhere.
  The code bload is extremely bad as the loader runs with very small
  memory constraints, and we already hit the limit once (see

    http://svn.freebsd.org/viewvc/base?view=revision&revision=185132
  Reducing the footprint of the forth files is critical.

+ two different styles of coding, one using pure stack functions
  (maybe beautiful but surely highly unreadable), one using
  high level mechanisms to give names to arguments and local
  variables (which leads to readable code).

Note that this code is used by default by all FreeBSD installations,
so the fragility and the code bloat are extremely damaging.
I will try to work fixing the three items above, but if others have
time, please have a look at these issues.

MFC after: 4 weeks

15 years agohonor IEEE80211_BPF_CRYPTO for raw xmit; fixes shared key auth in sta mode
Sam Leffler [Sun, 7 Dec 2008 19:29:11 +0000 (19:29 +0000)]
honor IEEE80211_BPF_CRYPTO for raw xmit; fixes shared key auth in sta mode

PR: kern/129022

15 years agoNew periodic calibration scheme needed for 11n parts that have
Sam Leffler [Sun, 7 Dec 2008 19:26:34 +0000 (19:26 +0000)]
New periodic calibration scheme needed for 11n parts that have
multiple algorithms and potentially collect multiple samples.
Instead of a single calibration interval we now have short and long
intervals; the long interval roughly corresponds to the previous
single interval.  The short interval is used to speedup collection
of samples and happens much quicker.  We make calls using the short
interval until we're told the calibration work is complete at which
point we fallback to the long interval.  In addition there is a
much longer reset interval used to flush all calibration state and
cause everthing to start anew.

With these changes you can also disable calibration entirely by
setting the long interval to zero.

15 years agobring in diagnostic tools that are useful now that we have hal source code
Sam Leffler [Sun, 7 Dec 2008 19:17:33 +0000 (19:17 +0000)]
bring in diagnostic tools that are useful now that we have hal source code

15 years agoUse "allowed_peer" throughout this manual page.
Tom Rhodes [Sun, 7 Dec 2008 18:45:30 +0000 (18:45 +0000)]
Use "allowed_peer" throughout this manual page.