]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/log
FreeBSD/stable/8.git
13 years agoMFC r219084:
delphij [Fri, 1 Apr 2011 18:23:44 +0000 (18:23 +0000)]
MFC r219084:

Accept == as an alias of = which is a popular GNU extension.

This is intentionally undocumented for now since it's not part
of any standard.

git-svn-id: svn://svn.freebsd.org/base/stable/8@220250 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r220014:
kib [Fri, 1 Apr 2011 14:04:36 +0000 (14:04 +0000)]
MFC r220014:
Report EBUSY instead of EROFS for attempt of deleting or renaming the
root directory of msdosfs mount.

git-svn-id: svn://svn.freebsd.org/base/stable/8@220246 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219989:
kib [Fri, 1 Apr 2011 13:23:53 +0000 (13:23 +0000)]
MFC r219989:
Implement compat32 MEMRANGE_GET and MEMRANGE_SET.

git-svn-id: svn://svn.freebsd.org/base/stable/8@220244 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219988:
kib [Fri, 1 Apr 2011 13:20:39 +0000 (13:20 +0000)]
MFC r219988:
Fully emulate MDIOCLIST for compat32.

git-svn-id: svn://svn.freebsd.org/base/stable/8@220243 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r220000:
kib [Fri, 1 Apr 2011 12:52:55 +0000 (12:52 +0000)]
MFC r220000:
Document O_CLOEXEC.

git-svn-id: svn://svn.freebsd.org/base/stable/8@220242 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219999:
kib [Fri, 1 Apr 2011 12:50:29 +0000 (12:50 +0000)]
MFC r219999:
Add O_CLOEXEC flag to open(2) and fhopen(2).

git-svn-id: svn://svn.freebsd.org/base/stable/8@220241 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219963:
pluknet [Thu, 31 Mar 2011 08:55:00 +0000 (08:55 +0000)]
MFC r219963:

 Add missing resource limits:
 - RLIMIT_NPTS
 - RLIMIT_SWAP

git-svn-id: svn://svn.freebsd.org/base/stable/8@220189 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC of 198254, 198255, 198350, 198267, 209190, 208831, 208830, 210243
edwin [Thu, 31 Mar 2011 06:29:15 +0000 (06:29 +0000)]
MFC of 198254, 198255, 198350, 198267, 209190, 208831, 208830, 210243

198254:
When tzsetup is run as non-root and the "CMOS clock question on
UTC" is answered as No, it would abort without properly ending the
dialog session.

198255:
Make the usage of the default zoneinfo file to install clearer.

198350:
- Add support for chrooted installs.
- Add examples to the man-page.

198267:
Instead of having to know which timezone was picked last time, you
now can run "tzsetup -r" which will reinstall the last choice. This
data is recorded in /var/db/zoneinfo.

209190:
Use literal format strings.  Found by clang.

208831:
Add comment that this value is unused.
It is obvious that it isn't used, but both clang and Coverity talk about it.

208830:
When there is a problem with writing, also bail out.

Found with the clang checker.

210243:
Fix support for chrooted installs.

git-svn-id: svn://svn.freebsd.org/base/stable/8@220183 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219351, r219354, r219369, r219370, r219371, r219372, r219373,
trociny [Tue, 29 Mar 2011 20:58:25 +0000 (20:58 +0000)]
MFC r219351, r219354, r219369, r219370, r219371, r219372, r219373,
  r219385, r219482, r219620, r219669, r219721, r219813, r219814,
  r219815, r219816, r219817, r219818, r219821, r219830, r219831,
  r219832, r219833, r219837, r219844, r219864, r219873, r219879,
  r219882, r219884, r219887, r219900:

r219351 (pjd):

Allow to checksum on-the-wire data using either CRC32 or SHA256.

r219354 (pjd):

Allow to compress on-the-wire data using two algorithms:
- HOLE - it simply turns all-zero blocks into few bytes header;
        it is extremely fast, so it is turned on by default;
        it is mostly intended to speed up initial synchronization
        where we expect many zeros;
- LZF - very fast algorithm by Marc Alexander Lehmann, which shows
        very decent compression ratio and has BSD license.

r219369 (pjd):

Provides three states for pjdlog_initialized, so we can also tell that
this is fist initialization ever.

r219370 (pjd), r219385 (pjd):

- Turn on printf extentions.
- Load support for %T for pritning time.
- Add support for %N for printing number in human readable form.
- Add support for %S for printing sockaddr structure (currently only AF_INET
  family is supported, as this is all we need in HAST).
- Disable gcc compile-time format checking as this will no longer work.

r219371 (pjd):

Use %S to print IP address and port number.

r219372 (pjd):

- Log size of data to synchronize in human readable form (using %N).
- Log synchronization time (using %T).
- Log synchronization speed in human readable form (using %N).

r219373 (pjd):

Print some of the numbers in human readable form (using %N).

r219482:

Make workers inherit debug level from the main process.

r219620 (pjd):

In command line options allow size to be specified using k/M/G/T
suffixes.

r219669 (pjd):

Remove #include needed for debugging.

r219721:

For secondary, set 2 * HAST_KEEPALIVE seconds timeout for incoming
connection so the worker will exit if it does not receive packets from
the primary during this interval.

Reported by:    Christian Vogt <Christian.Vogt@haw-hamburg.de>
Tested by:      Christian Vogt <Christian.Vogt@haw-hamburg.de>

r219813 (pjd):

If there is any traffic on one of out descriptors, we were not checking for
long running hooks. Fix it by not using select(2) timeout to decide if we want
to check hooks or not.

r219814 (pjd):

When creating connection on behalf of primary worker, set pjdlog prefix
to resource name and role, so that any logs related to that can be identified
properly.

r219815 (pjd):

Add snprlcat() and vsnprlcat() - the functions I'm always missing.
They work as a combination of snprintf(3) and strlcat(3) - the caller
can append a string build based on the given format.

r219816 (pjd):

Use snprlcat() instead of two strlcat(3)s.

r219817 (pjd):

Log when we start hooks checking and when we execute a hook.

r219818 (pjd), r219821 (pjd):

In hast.conf we define the other node's address in 'remote' variable.
This way we know how to connect to secondary node when we are primary.
The same variable is used by the secondary node - it only accepts
connections from the address stored in 'remote' variable.
In cluster configurations it is common that each node has its individual
IP address and there is one addtional shared IP address which is assigned
to primary node. It seems it is possible that if the shared IP address is
from the same network as the individual IP address it might be choosen by
the kernel as a source address for connection with the secondary node.
Such connection will be rejected by secondary, as it doesn't come from
primary node individual IP.

Add 'source' variable that allows to specify source IP address we want to
bind to before connecting to the secondary node.

r219821 (pjd):

Forgot to commit this as a part of r219818.

r219830 (pjd):

Detect situation where resource internal identifier differs.
This means that both nodes have separately managed resources that don't
have the same data.

r219831 (pjd):

Be pedantic and free nvout before exiting.

r219832 (pjd):

Increase debug level of "Checking hooks." message.

r219833 (pjd):

Remove stale comment. Yes, it is valid to set role back to init.

r219837 (pjd):

Before handling any events on descriptors check signals so we can update
our info about worker processes if any of them was terminated in the meantime.

This fixes the problem with 'hastctl status' running from a hook called on
split-brain:
1. Secondary calls a hooks and terminates.
2. Hook asks for resource status via 'hastctl status'.
3. The main hastd handles the status request by sending it to the secondary
   worker who is already dead, but because signals weren't checked yet he
   doesn't know that and we get EPIPE.

r219843 (pjd):

Fix typo.

r219844 (pjd):

Initialize localcnt on first write. This fixes assertion when we create
resource, set role to primary, do no writes, then sent it to secondary
and accept connection from primary.

r219864 (pjd):

White space cleanups.

r219873 (pjd), r219873 (pjd):

The proto API is a general purpose API, so don't use 'hast' in structures or
function names. It can now be used outside of HAST.

r219879:

For requests that are sent only to remote component use the
error from remote.

r219882:

After synchronization is complete we should make primary counters be
equal to secondary counters:

  primary_localcnt = secondary_remotecnt
  primary_remotecnt = secondary_localcnt

Previously it was done wrong and split-brain was observed after
primary had synchronized up-to-date data from secondary.

r219887 (pjd):

Add pjd copyright.

r219900 (pjd):

Don't create socketpair for connection forwarding between parent and secondary.
Secondary doesn't need to connect anywhere.

Approved by: pjd (mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/8@220151 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219368:
trociny [Tue, 29 Mar 2011 17:59:30 +0000 (17:59 +0000)]
MFC r219368:

r219368 (pjd):

To be able to use printf extensions we need to turn off gcc format checking.
Following the convention of NO_WERROR and NO_WCAST_ALIGN add NO_WFORMAT,
which, when defined in Makefile, turns off compile-time format checking
(by adding -Wno-format), but still allows to use high WARNS level.

Approved by: kib (co-mentor), pjd (mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/8@220141 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219343:
trociny [Tue, 29 Mar 2011 17:57:40 +0000 (17:57 +0000)]
MFC r219343:

r219343 (pjd):

Include stdio.h, so we can include printf.h in any order, as it needs FILE.

Approved by: kib (co-mentor), pjd (mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/8@220140 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r200035, r219344:
trociny [Tue, 29 Mar 2011 17:55:15 +0000 (17:55 +0000)]
MFC r200035, r219344:

Bring in missing headers and primitive type declarations into <libutil.h> to
make it work when included by itself.

r200035 (ed):

Make <libutil.h> work when included by itself.

There are several reasons why it didn't work:

- It was missing <sys/cdefs.h> for __BEGIN_DECLS.
- It uses various primitive types that were not declared.

r219344 (pjd):

expand_number() needs uint64_t, declare it here if not already declared.

Approved by: kib (co-mentor), pjd (mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/8@220139 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219342, r219346:
trociny [Tue, 29 Mar 2011 17:52:45 +0000 (17:52 +0000)]
MFC r219342, r219346:

r219342 (pjd):

Fix various issues in how %#T is handled:
- If precision is 0, don't print period followed by no digits.
- If precision is 0 stop printing units as soon as possible
  (eg. if we have three years and five days and precision is 0
   print only 3y5d).
- If precision is not 0, print all units (eg. 3y0d0h0m0s.00).

r219346 (pjd):

Because we call __printf_out() with a on-stack buffer, also call
__printf_flush() so we are sure it won't be referenced after we return.

Approved by: kib (co-mentor), pjd (mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/8@220138 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r220041:
ru [Tue, 29 Mar 2011 11:54:22 +0000 (11:54 +0000)]
MFC r220041:
  Fixed sockets display somewhat (-L, -T, -x, -Lx, with and without -A).
  (I didn't try to fix negative TCP timers with -x.)

Also, fixed a mismerge of -T option in r216964 -- it erroneously added
headers for TCP timers to -x.

git-svn-id: svn://svn.freebsd.org/base/stable/8@220125 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219803: index(3): Mention that index/rindex are deprecated and not
jilles [Mon, 28 Mar 2011 22:50:02 +0000 (22:50 +0000)]
MFC r219803: index(3): Mention that index/rindex are deprecated and not
specified by POSIX.1-2008.

git-svn-id: svn://svn.freebsd.org/base/stable/8@220115 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r220020:
dougb [Mon, 28 Mar 2011 19:39:53 +0000 (19:39 +0000)]
MFC r220020:

Add a daily period script to back up /var/db/pkg

MFC r220049:

Hook the 220.backup-pkgdb script I added to the build unconditionally
Hook up 610.ipf6denied based on MK_IPFILTER as 510.ipfdenied is now

git-svn-id: svn://svn.freebsd.org/base/stable/8@220112 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r220015:
dougb [Mon, 28 Mar 2011 19:32:16 +0000 (19:32 +0000)]
MFC r220015:

An EXAMPLE for <include>

git-svn-id: svn://svn.freebsd.org/base/stable/8@220111 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219587, r220017, r220048
dougb [Mon, 28 Mar 2011 19:22:55 +0000 (19:22 +0000)]
MFC r219587, r220017, r220048

Adjust svn:executable properties

git-svn-id: svn://svn.freebsd.org/base/stable/8@220107 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r217729, r217730, r217731, r217732, r217737, r217784, r217958,
trociny [Mon, 28 Mar 2011 17:41:10 +0000 (17:41 +0000)]
MFC r217729, r217730, r217731, r217732, r217737, r217784, r217958,
  r217961, r217962, r217964, r217965, r217966, r217967, r217969,
  r218040, r218041, r218042, r218043, r218044, r218045, r218048,
  r218049, r218119, r218132, r218138, r218139, r218147, r218148,
  r218158, r218185, r218191, r218192, r218193, r218194, r218201,
  r218214, r218215, r218217, r218218, r218370, r218373, r218374,
  r218375, r218376, r218464, r218465, r218474, r219082:

r217729 (pjd):

- On primary worker reload, update hr_exec field.
- Update comment.

r217730 (pjd):

Use int16 for error.

r217731 (pjd):

Use more consistent function name with the others (pjdlogv_prefix_set()
instead of pjdlog_prefix_setv()).

r217732 (pjd):

Add nv_assert() which allows to assert that the given name exists.

r217737 (pjd):

Add missing logs.

r217784 (pjd):

Don't open configuration file from worker process. Handle SIGHUP in the
master process only and pass changes to the worker processes over control
socket. This removes access to global namespace in preparation for capsicum
sandboxing.

r217958 (pjd):

Remove __dead2 from pjdlog_verify() prototype, it does return sometimes.

r217961 (pjd):

- Remove obvious NOTREACHED comment after abort() call.
- Remove redundant newline at the end of the file.

r217962 (pjd):

Add LOG_NDELAY flag to openlog(3) - we want descriptor to be immediately open
so there are no surprises once we start chrooting or using capsicum.

r217964 (pjd):

Use pjd copyright for 2011 work.

r217965 (pjd):

Add functions to initialize/finalize pjdlog. This allows to open/close log
file at will.

r217966 (pjd):

Extend pjdlog_verify() to support the following additional macros:
PJDLOG_RVERIFY() - always check expression and on false log the given message
        and exit.
PJDLOG_RASSERT() - check expression when NDEBUG is not defined and on false log
        given message and exit.
PJDLOG_ABORT() - log the given message and exit.

r217967 (pjd):

Close the control socket before exiting, so it will be unlinked.

r217969 (pjd):

Remember created control connection so on fork(2) we can close it in child.

r218040 (pjd):

Initialize all global variables on pjdlog_init().

r218041 (pjd):

Add function to close all unneeded descriptors after fork(2).

r218042 (pjd):

Add comments to places where we treat errors as ciritical, but it is possible
to handle them more gracefully.

r218043 (pjd):

Close all unneeded descriptors after fork(2).

r218044 (pjd):

Add function to assert that the only descriptors we have open are the ones
we expect to be open. Also assert that they point at expected type.

Because openlog(3) API is unable to tell us descriptor number it is using, we
have to close syslog socket, remember assert message in local buffer and if we
fail on assertion, reopen syslog socket and log the message.

r218045 (pjd):

Use newly added descriptors_assert() function to ensure only expected
descriptors are open.

r218046 (pjd), r218047 (pjd), r218119 (maxim):

Add 'hast' user and 'hast' group that will be used by hastd (and maybe hastctl)
to drop privileges.

r218048 (pjd):

Implement function that drops privileges by:
- chrooting to /var/empty (user hast home directory),
- setting groups to 'hast' (user hast primary group),
- setting real group id, effective group id and saved group id to 'hast',
- setting real user id, effective user id and saved user id to 'hast'.
At the end verify that those operations where successfull.

r218049 (pjd):

Drop privileges in worker processes.

Accepting connections and handshaking in secondary is still done before
dropping privileges. It should be implemented by only accepting connections in
privileged main process and passing connection descriptors to the worker, but
is not implemented yet.

r218132 (pjd):

Rename pjdlog_verify() to pjdlog_abort() as it better describes what the
the function does and mark it with __dead2.

r218138 (pjd):

- Use pjdlog for assertions and aborts as this will log assert/abort message
  to syslog if we run in background.
- Asserts in proto.c that method we want to call is implemented and remove
  dummy methods from protocols implementation that are only there to abort
  the program with nice message.

r218139 (pjd):

Implement two new functions for sending descriptor and receving descriptor
over UNIX domain sockets and socket pairs.
This is in preparation for capsicum.

r218147 (pjd), r218148 (pjd):

Fix build on ia64.

r218158 (pjd):

Do not set socket send and receive buffer. It will be auto-tuned.

Confirmed by:   rwatson

r218185 (pjd):

Be prepared that hp_client or hp_server might be NULL now.

r218191 (pjd):

Move protocol allocation and deallocation to separate functions.

r218192 (pjd), r218201 (bz):

Allow to specify connection timeout by the caller.

r218193 (pjd):

Add proto_connect_wait() to wait for connection to finish.
If timeout argument to proto_connect() is -1, then the caller needs to use
this new function to wait for connection.

This change is in preparation for capsicum, where sandboxed worker wants
to ask main process to connect in worker's behalf and pass descriptor
to the worker. Because we don't want the main process to wait for the
connection, it will start async connection and pass descriptor to the
worker who will be responsible for waiting for the connection to finish.

r218194 (pjd):

- Rename proto_descriptor_{send,recv}() functions to
  proto_connection_{send,recv} and change them to return proto_conn
  structure. We don't operate directly on descriptors, but on
  proto_conns.
- Add wrap method to wrap descriptor with proto_conn.
- Remove methods to send and receive descriptors and implement this
  functionality as additional argument to send and receive methods.

r218214 (pjd):

Let the caller log info about successful privilege drop.
We don't want to log this in hastctl.

r218215 (pjd):

Drop privileges after connecting to hastd, but before sending or receiving
anything.

r218217 (pjd):

Add missing locking after moving keepalive_send() to remote send thread
in r214692.

r218218 (pjd):

Setup another socketpair between parent and child, so that primary sandboxed
worker can ask the main privileged process to connect in worker's behalf
and then we can migrate descriptor using this socketpair to worker.
This is not really needed now, but will be needed once we start to use
capsicum for sandboxing.

r218370 (pjd):

Close more descriptors that can be open if the worker process for the given
resource is already running.

Submitted by:   Mikolaj Golub <to.my.trociny@gmail.com>

r218373 (pjd):

Open syslog when logging sysconf(3) failure.

Reported by:    Mikolaj Golub <to.my.trociny@gmail.com>

r218374 (pjd):

Treat fstat(2) failure (different than EBADF) as fatal error.

Reported by:    Mikolaj Golub <to.my.trociny@gmail.com>

r218375 (pjd):

Add (void) cast before snprintf(3)s for which we are not interested in return
values.

r218376 (pjd):

Now that we break the loop on fstat(2) failure we no longer need to satisfy
gcc's imperfections.

r218464 (pjd):

Unlink UNIX domain socket file only if:
1. The descriptor is the one we are listening on (not the one when we connect
   as a client and not the one which is created on accept(2)).
2. Descriptor was created by us (PID matches with the PID stored on bind(2)).

Reported by:    Mikolaj Golub <to.my.trociny@gmail.com>

r218465 (pjd):

Explicitly include <sys/types.h> as suggested by getpid(2) and don't rely on
<sys/un.h> including what's needed.

r218474 (pjd):

When we decide to unlink socket file, sun_path must be set. If it is set,
but there is problem unlinking the file, log a warning.

r219082 (pjd):

Recognize 'reload' command, as hastd can be reloaded with the SIGHUP signal.

Approved by: pjd (mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/8@220104 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219987:
kib [Mon, 28 Mar 2011 08:23:45 +0000 (08:23 +0000)]
MFC r219987:
Remove unneccessary panics.

git-svn-id: svn://svn.freebsd.org/base/stable/8@220093 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219986:
kib [Mon, 28 Mar 2011 08:22:13 +0000 (08:22 +0000)]
MFC r219986:
Fix file leakage in the freebsd32_ioctl routines.

git-svn-id: svn://svn.freebsd.org/base/stable/8@220092 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219982:
kevlo [Mon, 28 Mar 2011 01:24:20 +0000 (01:24 +0000)]
MFC r219982:
Fix panic while associating access point.
While here, add the SMC SMCWUSB-G

git-svn-id: svn://svn.freebsd.org/base/stable/8@220087 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r201449:
yongari [Mon, 28 Mar 2011 00:18:02 +0000 (00:18 +0000)]
MFC r201449:
  Fix CardBus spelling.

git-svn-id: svn://svn.freebsd.org/base/stable/8@220085 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219701:
yongari [Mon, 28 Mar 2011 00:13:41 +0000 (00:13 +0000)]
MFC r219701:
  Remove too expensive bus_dmamap_sync(9) call in dc_rx_resync().
  With this change, driver may not notice updated descriptor status
  change when bounce buffers are active. However, rxeof() in next run
  will handle the synchronization.

  Change dc_rxeof() a bit to return the number of processed frames in
  RX descriptor ring. Previously it returned the number of frames
  that were successfully passed to upper stack which in turn means it
  ignored frames that were discarded due to errors. The number of
  processed frames in RX descriptor ring is used to detect whether
  driver is out of sync with controller's current descriptor pointer.
  Returning number of processed frames reduces unnecessary (probably
  wrong) re-synchronization.

  Reviewed by: marius

git-svn-id: svn://svn.freebsd.org/base/stable/8@220083 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219407:
yongari [Sun, 27 Mar 2011 23:13:02 +0000 (23:13 +0000)]
MFC r219407:
  Rearrange dc_tx_underrun() a bit to correctly set TX FIFO threshold
  value. Controllers that always require "store and forward" mode(
  Davicom and PNIC 82C168) have no way to recover from TX underrun
  except completely reinitializing hardware. Previously only Davicom
  was reinitialized and the TX FIFO threshold was changed not to use
  "store and forward" mode after reinitialization since the default
  FIFO threshold value was 0. This effectively disabled Davicom
  controller's "store and forward" mode once it encountered TX
  underruns. In theory, this can cause watchodg timeouts.

  Intel 21143 controller requires TX MAC should be idle before
  changing TX FIFO threshold. So driver tried to disable TX MAC and
  checked whether it saw the idle state of TX MAC. Driver should
  perform full hardware reinitialization on failing to enter to idle
  state and it should not touch TX MAC again once it performed full
  reinitialization.

  While I'm here remove resetting TX FIFO threshold to 0 when
  interface is put into down state. If driver ever encountered TX
  underrun, it's likely to trigger TX underrun again whenever
  interface is brought to up again. Keeping old/learned TX FIFO
  threshold value shall reduce the chance of seeing TX underrns in
  next run.

git-svn-id: svn://svn.freebsd.org/base/stable/8@220078 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r218834-218835:
yongari [Sun, 27 Mar 2011 23:08:01 +0000 (23:08 +0000)]
MFC r218834-218835:
r218834:
  Consistently use a tab character instead of space after #define.
  No functional changes.

r218835:
  s/u_intXX_t/uintXX_t/g

git-svn-id: svn://svn.freebsd.org/base/stable/8@220076 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r218833,218964:
yongari [Sun, 27 Mar 2011 23:02:12 +0000 (23:02 +0000)]
MFC r218833,218964:
r218833:
  Count how many frames driver lost in interrupt handler. This
  register is cleared on read so make sure to clear it in driver
  initialization phase.

r218964:
  Remove unnecessary controller reinitialization which resulted in
  link flips during alias address insertion or dhclient operation.
  While I'm here remove dc_reset() in DC_ISR_BUS_ERR case. Device is
  fully reinitialized again in dc_init_locked().

git-svn-id: svn://svn.freebsd.org/base/stable/8@220074 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r218832:
yongari [Sun, 27 Mar 2011 22:48:58 +0000 (22:48 +0000)]
MFC r218832:
  Split common TX/RX descriptor DMA tag to TX and RX DMA tags
  respectively and fix all bus_dma(9) issues seen when bounce buffers
  are used.
   o Setup frame handling had no bus_dmamap_sync(9) which prevented
     driver from configuring RX filter. Add missing bus_dmamap_sync(9)
     in both dc_setfilt_21143()/dc_setfilt_xircom() and dc_txeof().
   o Use bus_addr_t for DMA segment instead of using u_int32_t.
   o Introduce dc_dma_alloc()/dc_dma_free() functions to allocate/free
     DMA'able memory.
   o Create two DMA descriptor list for each TX/RX lists. This change
     will minimize the size of bounce buffers that would be used in
     each TX/RX path.  Previously driver had to copy both TX/RX lists
     when bounce buffer is active.
   o 21143 data sheet says descriptor list requires 4 bytes alignment.
     Remove PAGE_SIZE alignment restriction and use
     sizeof(struct dc_dec).
   o Setup frame requires 4 bytes alignment.  Remove PAGE_SIZE
     alignment restriction and use sizeof(struct dc_dec).
   o Add missing DMA map unload for both setup frame and TX/RX
     descriptor list.
   o Overhaul RX handling logic such that make driver always allocate
     new RX buffer with dc_newbuf(). Previously driver allowed to
     copy received frame with m_devget(9) after passing the
     descriptor ownership to controller. This can lead to passing
     wrong frame to upper stack.
   o Introduce dc_discard_rxbuf() which will discard received frame
     and reuse loaded DMA map and RX mbuf.
   o Correct several wrong bus_dmamap_sync(9) usage in dc_rxeof and
     dc_txeof. The TX/RX descriptor lists are updated by both driver
     and HW so READ/WRITE semantics should be used.
   o If driver failed to allocate new RX buffer, update if_iqdrops
     counter instead of if_ierrors since driver received the frame
     without errors.
   o Make sure to unload loaded setup frame DMA map in dc_txeof and
     clear the mark of setup frame of the TX descriptor in dc_txeof().
   o Add check for possible TX descriptor overruns in dc_encap() and
     move check for free buffer to caller, dc_start_locked().
   o Swap the loaded DMA map and the last DMA map for multi-segmented
     frames. Since dc_txeof() assumes the last descriptor of the
     frame has the DMA map, driver should swap the first and the last
     DMA map in dc_encap(). Previously driver tried to unload
     not-yet-loaded DMA map such that the loaded DMA map was not
     unloaded at all for multi-segmented frames.
   o Rewrite DC_RXDESC/DC_TXDESC macro to simpler one.
   o Remove definition of ETHER_ALIGN, it's already defined in
     ethernet.h.
  With this changes, dc(4) works with bounce buffers and it shall
  also fix issues which might have shown in PAE environments.

  Tested by: marius

git-svn-id: svn://svn.freebsd.org/base/stable/8@220072 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r218830-218831:
yongari [Sun, 27 Mar 2011 22:36:16 +0000 (22:36 +0000)]
MFC r218830-218831:
r218830:
  Send frames only when there is a valid link and driver is running
  as well as controller has enough free TX descriptors.
  Remove check for number of queued frames before attempting to
  transmit. I guess it was added to allow draining queued frames
  even if there is no link. I'm under the impression this type of
  check should be done in upper layer. No other drivers in tree do
  that.

r218831:
  Rearrange interrupt handler a bit and remove forever loop.
  Previously dc(4) always checked whether there is pending interrupts
  and this consumed a lot of CPU cycles in interrupt handler. Limit
  the number of processing for TX/RX frames to 16. Also allow sending
  frames in the loop not to starve TX under high RX load.
  Reading DC_ISR register should be protected with driver lock,
  otherwise interrupt handler could be run(e.g. link state change)
  before the completion of dc_init_locked().

  While I'm here remove unneeded code.

git-svn-id: svn://svn.freebsd.org/base/stable/8@220070 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r218789,218820,218826-218828:
yongari [Sun, 27 Mar 2011 22:31:17 +0000 (22:31 +0000)]
MFC r218789,218820,218826-218828:
r218789:
  Remove use case of DC_TX_ONE. It was used to limit queue just 1 TX
  frame in DM910x controllers. In r67595(more than 10 years ago) it
  was replaced to use "Store and Forward" mode and made controller
  generate TX completion interrupt for every frame.

r218820:
  For controllers that have TX interrupt moderation capability,
  request TX completion interrupt for every 8-th frames. Previously
  dc(4) requested TX completion interrupt if number of queued TX
  descriptors is greater than 64. This caused a lot of TX completion
  interrupt under high TX load once driver queued more than 64 TX
  descriptors. It's quite normal to see more than 64 queued TX
  descriptors under high TX load.
  This change reduces the number of TX completion interrupts to be
  less than 17k under high TX load. Because this change does not
  generate TX completion interrupt for each frame, add reclaiming
  transmitted buffers in dc_tick not to generate false watchdog
  timeouts.
  While I'm here add check for queued descriptors in dc_txeof() since
  there is no more work to do when there is no pending descriptors.

r218826:
  Make sure to clear status word of TX descriptor in dc_list_tx_init().
  Do not update if_opackets if the transmission had failed.

r218827:
  There is no need to execute filter configuration when driver is not
  running. Remove wrong driver state change in dc_setfilt_xircom().
  While I'm here nuke unnecessary assignments.

r218828:
  Fix a long standing bug where driver handed over RX descriptor
  ownership to controller before completion of access to the
  descriptor. Driver is faking up status word so it should not give
  ownership to controller until it completes RX processing.

git-svn-id: svn://svn.freebsd.org/base/stable/8@220068 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r213841,218787-218788:
yongari [Sun, 27 Mar 2011 22:20:44 +0000 (22:20 +0000)]
MFC r213841,218787-218788:
r213841:
  It seems some multi-port dc(4) controllers shares SROM of the first
  port such that reading station address from second port always
  returned 0xFF:0xFF:0xFF:0xFF:0xFF:0xFF Unfortunately it seems there
  is no easy way to know whether SROM is shared or not. Workaround
  the issue by traversing dc(4) device list and see whether we're
  using second port and use station address of controller 0 as base
  station address of second port.

  PR: kern/79262

r218787:
  When driver have to use base softc due to lack of SROM on second
  port, copy SROM information from base softc as well and run SROM
  parser again.  This change is necessary for some dual port
  controllers to make dc(4) correctly detect PHY media based on first
  port configuration table.
  While I'm here add a check for validity of the base softc before
  duplicating SROM contents from base softc. If driver failed to
  attach to the first port it can access invalid area.

  PR: kern/79262
  Reviewed by: marius

r218788:
  Apply special PHY initialization code for 21143 controllers before
  any other media configuration. Otherwise some 21143 controller
  cannot establish a link. While I'm here remove the PHY
  initialization code in dc_setcfg(). Since dc_setcfg() is called
  whenever link state is changed, having the PHY initialization code
  in dc_setcfg() resulted in continuous link flips.
  After driver resets SIA, use default SIA transmit/receive
  configuration instead of disabling autosense/autonegotiation.
  Otherwise, controller fails to establish a link as well as losing
  auto-negotiation capability. For manual media configuration, always
  configure 21143 controller with specified media to ensure media
  change. This change makes ANA-6922 establish link with/without
  auto-negotiation.

  While I'm here be more strict on link UP/DOWN detection logic.

  Many thanks to marius who fixed several bugs in initial patch and
  even tested the patch on a couple of dc(4) controllers.

  PR: kern/79262
  Reviewed by: marius
  Tested by: marius

git-svn-id: svn://svn.freebsd.org/base/stable/8@220066 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r218786:
yongari [Sun, 27 Mar 2011 22:12:51 +0000 (22:12 +0000)]
MFC r218786:
  Always check memory allocation failure. If driver encounter memory
  allocation error, do not attach driver.

  Reviewed by: marius

git-svn-id: svn://svn.freebsd.org/base/stable/8@220064 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219573:
ae [Sun, 27 Mar 2011 20:35:32 +0000 (20:35 +0000)]
MFC r219573:
  Document GEOM_PART_EBR_COMPAT option.

MFC r219581:
  Fix grammar.

  Pointed out: Ben Kaduk

git-svn-id: svn://svn.freebsd.org/base/stable/8@220063 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219944
np [Sun, 27 Mar 2011 05:09:21 +0000 (05:09 +0000)]
MFC r219944

Do not over-allocate MSI interrupts for the case where each ingress
queue has its own interrupt.  If the exact number that we need is not a
power of 2 and we're using MSI, then switch to interrupt multiplexing.

While here, replace the magic numbers with something more readable.

git-svn-id: svn://svn.freebsd.org/base/stable/8@220050 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219804:
kib [Sun, 27 Mar 2011 00:42:28 +0000 (00:42 +0000)]
MFC r219804:
Retire opt_ffs_broken_fixme.h.

git-svn-id: svn://svn.freebsd.org/base/stable/8@220047 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219787:
yongari [Sat, 26 Mar 2011 21:29:39 +0000 (21:29 +0000)]
MFC r219787:
  Correct broadcast frame handling. Setting bit6 of MCR0 register
  enables broadcast filtering. Make sure to clear the bit to receive
  broadcast frames. While I'm here rename the bit definition to
  reflect reality.

  Reported by:  brad@OpenBSD

git-svn-id: svn://svn.freebsd.org/base/stable/8@220044 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: r219577
marius [Sat, 26 Mar 2011 13:07:07 +0000 (13:07 +0000)]
MFC: r219577

Allocate the DMA memory shared between the host and the controller as
coherent.

Approved by: gibbs

git-svn-id: svn://svn.freebsd.org/base/stable/8@220036 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r216060. This differs from the original commit in that it
mdf [Fri, 25 Mar 2011 22:11:39 +0000 (22:11 +0000)]
MFC r216060.  This differs from the original commit in that it
preserves the KBI size of struct sysctl_oid.  Also, on stable/8 the
compiler thinks that 'len' in sysctl_sysctl_name2oid() is used
uninitialized.

Do not hold the sysctl lock across a call to the handler.  This fixes a
general LOR issue where the sysctl lock had no good place in the
hierarchy.  One specific instance is #284 on
http://sources.zabbadoz.net/freebsd/lor.html .

git-svn-id: svn://svn.freebsd.org/base/stable/8@220011 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r218825. [The implementation change to kdb_sysctl_available()
mdf [Fri, 25 Mar 2011 18:16:36 +0000 (18:16 +0000)]
MFC r218825.  [The implementation change to kdb_sysctl_available()
cannot be MFC'd as it requires a non-MFCable change (adding drains to
sbuf)].

Modify kdb_trap() so that it re-calls the dbbe_trap function as long as
the debugger back-end has changed.  This means that switching from ddb
to gdb no longer requires a "step" which can be dangerous on an
already-crashed kernel.

Also add a capability to get from the gdb back-end back to ddb, by
typing ^C in the console window.

While here, simplify kdb_sysctl_available() by using
sbuf_new_for_sysctl(), and use strlcpy() instead of strncpy() since the
strlcpy semantic is desired.

git-svn-id: svn://svn.freebsd.org/base/stable/8@220002 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: r219782
marius [Fri, 25 Mar 2011 13:09:57 +0000 (13:09 +0000)]
MFC: r219782

On Serengeti-class machines the OFW root isn't the parent of the CPU
nodes.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219998 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: r219780
marius [Fri, 25 Mar 2011 13:08:19 +0000 (13:08 +0000)]
MFC: r219780

In case reading PCIR_MINGNT fails don't use it for calculating the
latency. This is more or less a theoretical problem though as it
typically indicates way bigger problems.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219997 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: r219340, r219531, r219533
marius [Fri, 25 Mar 2011 13:03:13 +0000 (13:03 +0000)]
MFC: r219340, r219531, r219533

- Add support for TLS relocations.
- Emitt an error when encountering an unsupported and in case of the
  kernel also for unaligned relocations.
- Fix R_SPARC_HIX22 and R_SPARC_LOX10 relocations. Apparently these are
  hardly ever used.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219996 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: r219548
marius [Fri, 25 Mar 2011 12:53:09 +0000 (12:53 +0000)]
MFC: r219548

Allocate the sound buffer DMA memory coherent. While NetBSD typically
also does this for sound drivers it's probably not necessary for all
combinations of controllers and drivers. However, given that our sound
drivers completely lack bus_dmamap_sync(9) calls this at least serves
as a workaround when enabling use of the IOMMU streaming buffers on
sparc64 and generally for arm and mips.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219995 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: r219547
marius [Fri, 25 Mar 2011 12:50:50 +0000 (12:50 +0000)]
MFC: r219547

- Allocate the DMA memory shared between the host and the controller as
  coherent.
- Constify the ti_devs table.
- Don't bother to set if_mtu to ETHERMTU, ether_ifattach() does that.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219994 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: r219545
marius [Fri, 25 Mar 2011 12:48:56 +0000 (12:48 +0000)]
MFC: r219545

Allocate the DMA memory shared between the host and the controller as
coherent.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219993 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: r219545
marius [Fri, 25 Mar 2011 12:48:06 +0000 (12:48 +0000)]
MFC: r219545

Allocate the DMA memory shared between the host and the controller as
coherent.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219992 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: r219544
marius [Fri, 25 Mar 2011 12:47:01 +0000 (12:47 +0000)]
MFC: r219544

Allocate the DMA memory shared between the host and the controller as
coherent.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219991 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: r219543
marius [Fri, 25 Mar 2011 12:46:08 +0000 (12:46 +0000)]
MFC: r219543

Allocate the DMA memory shared between the host and the controller as
coherent.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219990 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFH r219209: Unbreak .Aq for non-ASCII output like -Tps or -Tutf8.
uqs [Thu, 24 Mar 2011 17:09:24 +0000 (17:09 +0000)]
MFH r219209: Unbreak .Aq for non-ASCII output like -Tps or -Tutf8.

PR: gnu/154822
Submitted by: Dominic Fandrey <kamikaze@bsdforen.de>

git-svn-id: svn://svn.freebsd.org/base/stable/8@219965 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r218741:
pluknet [Thu, 24 Mar 2011 13:18:09 +0000 (13:18 +0000)]
MFC r218741:

Bump dummynet module version to meet dummynet schedulers' requirements,
and thus unbreak loading dummynet.ko via /boot/loader.conf.

Approved by: luigi

git-svn-id: svn://svn.freebsd.org/base/stable/8@219957 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219713:
kib [Thu, 24 Mar 2011 00:42:07 +0000 (00:42 +0000)]
MFC r219713:
Implement the usertime and systime keywords for ps, printing the
corresponding times reported by getrusage().

git-svn-id: svn://svn.freebsd.org/base/stable/8@219943 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: r219608
marius [Wed, 23 Mar 2011 22:35:18 +0000 (22:35 +0000)]
MFC: r219608

Remove the advertising clause from the UCB license according to the
July 22, 1999 addendum.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219941 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: r219339, r219532
marius [Wed, 23 Mar 2011 22:33:29 +0000 (22:33 +0000)]
MFC: r219339, r219532

- Remove clause 3 and 4 from TNF licenses. [1]
- Add the _RF_X committed in r212998 (merged to stable/8 in r213478) also
  to the tables in the sparc64 reloc.c in order reduce differences between
  the kernel and the userland source. This results in no functional change
  though.
- Consistently abbreviate the names of the relocations.
- End sentences with dots.
- Fix whitespace.

Obtained from: NetBSD [1]

git-svn-id: svn://svn.freebsd.org/base/stable/8@219940 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: r219060
marius [Wed, 23 Mar 2011 21:06:19 +0000 (21:06 +0000)]
MFC: r219060

- Allocate the DMA memory shared between the host and the controller as
  coherent.
- Update a comment to no longer reference Alpha.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219936 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: r219567
marius [Wed, 23 Mar 2011 21:04:56 +0000 (21:04 +0000)]
MFC: r219567

Sync licenses and the corresponding RCS IDs with NetBSD, mainly switching
the licenses of Matthew R. Green and the TNF to 2-clause.

Obtained from: NetBSD

git-svn-id: svn://svn.freebsd.org/base/stable/8@219935 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: r219338
marius [Wed, 23 Mar 2011 20:59:20 +0000 (20:59 +0000)]
MFC: r219338

Add missing bus_dmamap_sync() calls for the work DMA map.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219934 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: r219337
marius [Wed, 23 Mar 2011 20:58:12 +0000 (20:58 +0000)]
MFC: r219337

Add missing bus_dmamap_sync() calls for the work DMA map.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219933 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: r219336
marius [Wed, 23 Mar 2011 20:56:56 +0000 (20:56 +0000)]
MFC: r219336

- Allocate the DMA memory used for the work area as coherent as at least
  the ataahci(4) and atamarvell(4) drivers share it between the host and
  the controller.
- Spell some zeros as BUS_DMA_WAITOK when used as bus_dmamem_alloc() flags.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219932 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: r219335
marius [Wed, 23 Mar 2011 20:55:29 +0000 (20:55 +0000)]
MFC: r219335

- Allocate the DMA memory shared between the host and the controller as
  coherent.
- Add some missing bus_dmamap_sync() calls. This includes putting such
  calls before calling reply handlers instead of calling bus_dmamap_sync()
  for the request queue from individual reply handlers as these handlers
  generally read back updates by the controller.

Tested on amd64 and sparc64.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219931 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219883:
np [Wed, 23 Mar 2011 17:33:04 +0000 (17:33 +0000)]
MFC r219883:

Fix an error while constructing the table that maps context id -> egress
queue

git-svn-id: svn://svn.freebsd.org/base/stable/8@219924 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r211819:
osa [Wed, 23 Mar 2011 14:18:59 +0000 (14:18 +0000)]
MFC r211819:

Add one more new memory day for Russian Federation: the end of Second World
War.

MFC r212027:

Add dim to calendar.freebsd.

MFC r212218:

Add swills to calendar.freebsd.

MFC r212260:

Add andreast to calendar.freebsd.

MFC r212591:

Remove extra ; from parse.c.

MFC r213001:

Add sunpoet to calendar.freebsd.

MFC r213482:

Add pluknet to calendar.freebsd.

MFC r213990:

Add culot to calendar.freebsd.

MFC r214027:

Fix spaces by a tab after the date, introduced in r213990.

MFC r214973:

A traditional (once per three years) sort by month/day/year/login.
While here, fixed badly formatted lines.

MFC r214974:

Add/expand country/state.

MFC r215096:

Add zack to calendar.freebsd.

MFC r215836:

Pet make checkdpadd.

MFC r216282:

Add flo to calendar.freebsd.

MFC r216895:

Add jpaetzel to calendar.freebsd.

MFC r219478:

Add trociny to calendar.freebsd.

MFC r219638:

Add dchagin to calendar.freebsd.

MFC r219731:

Add sbz to calendar.freebsd.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219907 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219702:
ae [Wed, 23 Mar 2011 06:19:17 +0000 (06:19 +0000)]
MFC r219702:
  Set control flags in putc(). This should fix zfsboot hangs in drvread().

  PR: kern/153552
  Reviewed by: jhb

git-svn-id: svn://svn.freebsd.org/base/stable/8@219896 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219415 (adapted for stable/8):
ae [Tue, 22 Mar 2011 05:50:55 +0000 (05:50 +0000)]
MFC r219415 (adapted for stable/8):
  Add -p option to `gpart show` command to show provider's names of
  partitions instead of partition's indexes. This may be useful with
  GPT partitioning scheme or EBR without GEOM_PART_EBR_COMPAT option.

MFC r219416:
  It is better to sometimes have not aligned columns than
  often have wrapped lines.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219861 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC 219834:
gjb [Mon, 21 Mar 2011 15:22:48 +0000 (15:22 +0000)]
MFC 219834:
Bump date from previous commit.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219835 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC 219805:
gjb [Mon, 21 Mar 2011 13:28:01 +0000 (13:28 +0000)]
MFC 219805:
- Use 'list scan' in favor of 'scan', as 'scan' has a different purpose.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219824 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r218816:
delphij [Mon, 21 Mar 2011 06:18:26 +0000 (06:18 +0000)]
MFC r218816:

Add a helper script that detects which partition we are on and update the
other.

Obtained from: FreeNAS
Sponsored by: iXsystems, Inc.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219812 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219525: amd64/NOTES: use a greater number in KSTACK_PAGES example
avg [Sun, 20 Mar 2011 11:58:42 +0000 (11:58 +0000)]
MFC r219525: amd64/NOTES: use a greater number in KSTACK_PAGES example

git-svn-id: svn://svn.freebsd.org/base/stable/8@219795 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219712:
kib [Sun, 20 Mar 2011 00:43:42 +0000 (00:43 +0000)]
MFC r219712:
Remove the #if defined(FFS) || defined(IFS) braces around the calls to
ffs_snapgone(). ufs.ko module is not build with FFS define.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219789 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC 219723:
gjb [Sat, 19 Mar 2011 01:41:21 +0000 (01:41 +0000)]
MFC 219723:
- Formtting fix.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219768 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC 219574,219575:
gjb [Sat, 19 Mar 2011 00:34:12 +0000 (00:34 +0000)]
MFC 219574,219575:
- Add example of using 'scan' for wireless networks, similarly to
  OpenBSD's ifconfig(8)[1].
- remove unneeded newline

PR: 151952 [1]

git-svn-id: svn://svn.freebsd.org/base/stable/8@219765 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219271: POSIX.1-2008 moved some constants from the XSI option to the
jilles [Fri, 18 Mar 2011 22:35:48 +0000 (22:35 +0000)]
MFC r219271: POSIX.1-2008 moved some constants from the XSI option to the
Base.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219757 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC 219483: Remove all object files during 'make clean'.
jhb [Fri, 18 Mar 2011 17:23:23 +0000 (17:23 +0000)]
MFC 219483: Remove all object files during 'make clean'.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219751 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC 219460: Remove now-obsolete comment.
jhb [Fri, 18 Mar 2011 17:20:32 +0000 (17:20 +0000)]
MFC 219460: Remove now-obsolete comment.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219749 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC 219399:
jhb [Fri, 18 Mar 2011 17:18:09 +0000 (17:18 +0000)]
MFC 219399:
When constructing a new cpuset, apply the parent cpuset's mask to the new
set's mask rather than the root mask.  This was causing the root mask to
be modified incorrectly.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219747 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC 219384:
jhb [Fri, 18 Mar 2011 17:15:10 +0000 (17:15 +0000)]
MFC 219384:
The UFS dirhash code was attempting to update shared state in the dirhash
from multiple threads while holding a shared lock during a lookup operation.
This could result in incorrect ENOENT failures which could then be
permanently stored in the name cache.

Specifically, the dirhash code optimizes the case that a single thread is
walking a directory sequentially opening (or stat'ing) each file.  It uses
state in the dirhash structure to determine if a given lookup is using the
optimization.  If the optimization fails, it disables it and restarts the
lookup.  The problem arises when two threads both attempt the optimization
and fail.  The first thread will restart the loop, but the second thread
will incorrectly think that it did not try the optimization and will only
examine a subset of the directory entires in its hash chain.  As a result,
it may fail to find its directory entry and incorrectly fail with ENOENT.

To make this safe for use with shared locks, simplify the state stored in
the dirhash and move some of the state (the part that determines if the
current thread is trying the optimization) into a local variable.  One
result is that we will now try the optimization more often.  We still
update the value under the shared lock, but it is a single atomic store
similar to i_diroff that is stored in UFS directory i-nodes for the
non-dirhash lookup.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219744 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r210496:
jh [Fri, 18 Mar 2011 08:52:26 +0000 (08:52 +0000)]
MFC r210496:

- Remove some extra white space.
- Wrap g_md_dumpconf() prototype to 80 columns.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219729 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r210371:
jh [Fri, 18 Mar 2011 08:48:06 +0000 (08:48 +0000)]
MFC r210371:

Convert md(4) to use alloc_unr(9) and alloc_unr_specific(9) for unit
number allocation. The old approach had some problems such as it allowed
an overflow to occur in the unit number calculation.

PR: kern/122288

git-svn-id: svn://svn.freebsd.org/base/stable/8@219728 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219256: Fix some _POSIX minimum/maximum values in limits.h:
jilles [Thu, 17 Mar 2011 22:47:52 +0000 (22:47 +0000)]
MFC r219256: Fix some _POSIX minimum/maximum values in limits.h:
* Some values changed in POSIX.1-2001; provide the former value if a program
  requests compliance to an earlier version of POSIX. [1]
* Add missing _POSIX_CLOCKRES_MIN constant. This is a maximum value but
  otherwise works the same as the minimum values.

PR: standards/104743
Submitted by: bde [1] (not exact #ifdefs, but the values)

git-svn-id: svn://svn.freebsd.org/base/stable/8@219726 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC 219455:
gjb [Thu, 17 Mar 2011 22:35:29 +0000 (22:35 +0000)]
MFC 219455:
- Move the explanation of using arguments for the PRIMARIES above
  the list of PRIMARIES.

PR: 151812

git-svn-id: svn://svn.freebsd.org/base/stable/8@219724 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC of 219687, tzdata2011d:
edwin [Wed, 16 Mar 2011 03:34:12 +0000 (03:34 +0000)]
MFC of 219687, tzdata2011d:

- Pacific/Apia will have DST on 2 April instead of 3 April in 2011.
- Turkye will go to DST on 28 April instead of 27 April in 2011.
- Cuba will go to DST on 20 April in 2011.

Obtained from:  ftp://elsie.nci.nih.gov/pub/

git-svn-id: svn://svn.freebsd.org/base/stable/8@219688 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC: 212624, 212669, 213535
ken [Tue, 15 Mar 2011 21:34:10 +0000 (21:34 +0000)]
MFC: 212624, 212669, 213535

Merge the mps(4) man page.

  r212624 | ken | 2010-09-14 15:40:29 -0600 (Tue, 14 Sep 2010) | 7 lines

  MFp4 (//depot/projects/mps/...)

  Add a man page for the mps(4) driver, and reference it in the
  mpt(4) driver man page.

  Sponsored by:   Spectra Logic Corporation

  r212669 | ken | 2010-09-15 10:05:51 -0600 (Wed, 15 Sep 2010) | 6 lines

  MFp4 (//depot/projects/mps/...)

  Fix a typo.

  Submitted by:   pluknet at gmail dot com

  r213535 | ken | 2010-10-07 15:56:10 -0600 (Thu, 07 Oct 2010) | 36 lines

  Turn on serialization of task management commands going down to the
  controller, but make it optional.

  After a problem report from Andrew Boyer, it looks like the LSI
  chip may have issues (the watchdog timer fired) if too many aborts
  are sent down to the chip at the same time.  We know that task
  management commands are serialized, and although the manual doesn't
  say it, it may be a good idea to just send one at a time.

  But, since I'm not certain that this is necessary, add a tunable
  and sysctl variable (hw.mps.%d.allow_multiple_tm_cmds) to control
  the driver's behavior.

  mps.c: Add support for the sysctl and tunable, and add a
   comment about the possible return values to
   mps_map_command().

  mps_sas.c: Run all task management commands through two new
   routines, mpssas_issue_tm_request() and
   mpssas_complete_tm_request().

   This allows us to optionally serialize task
   management commands.  Also, change things so that
   the response to a task management command always
   comes back through the callback.  (Before it could
   come via the callback or the return value.)

  mpsvar.h: Add softc variables for the list of active task
   management commands, the number of active commands,
   and whether we should allow multiple active task
   management commands.  Add an active command flag.

  mps.4: Describe the new sysctl/loader tunable variable.

  Sponsored by:   Spectra Logic Corporation

Reminded by: Hubert Tournier <hubert at frbsd dot org>

git-svn-id: svn://svn.freebsd.org/base/stable/8@219678 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r218019: Do not trip a KASSERT if /dev/null cannot be opened for a
jilles [Tue, 15 Mar 2011 20:24:21 +0000 (20:24 +0000)]
MFC r218019: Do not trip a KASSERT if /dev/null cannot be opened for a
setuid program.

The fdcheckstd() function makes sure fds 0, 1 and 2 are open by opening
/dev/null. If this fails (e.g. missing devfs or wrong permissions),
fdcheckstd() will return failure and the process will exit as if it received
SIGABRT. The KASSERT is only to check that kern_open() returns the expected
fd, given that it succeeded.

Tripping the KASSERT is most likely if fd 0 is open but fd 1 or 2 are not.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219677 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r218497:
netchild [Tue, 15 Mar 2011 13:19:26 +0000 (13:19 +0000)]
MFC r218497:
  Linux' shm_open() fails because it wants to find some funky shmfs
  to construct the full pathname. It starts to search at the default
  mountpoint which is /dev/shm. If this fails it runs through fstab
  and searches for shmfs and tmpfs. Whatever it finds will be
  statfs()'ed to be checked for Linux' fs magic for shmfs (0x01021994).

  Ideally our tmpfs should deliver this fs magic to Linux processes, but
  as our tmpfs is considered to be an experimental feature we can not
  assume that there is always a tmpfs available.

  To make shared memory work in the Linuxulator, force the fs type of
  /dev/shm (which can be a symlink) to match what Linux expects. The user
  is responsible (info has to be added to the linux base ports and the docs)
  to setup a suitable link for /dev/shm.

  Noticed by:        Andre Albsmeier <Andre.Albsmeier@siemens.com>
  Submitted by:      Andre Albsmeier <Andre.Albsmeier@siemens.com>

git-svn-id: svn://svn.freebsd.org/base/stable/8@219666 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219396:
kib [Tue, 15 Mar 2011 10:17:18 +0000 (10:17 +0000)]
MFC r219396:
Do not assert buffer lock in VFS_STRATEGY() when kernel already paniced.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/8@219664 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC kern.msgbufsize: r217688-217689,r217709,r218666-218667,r218913.
pluknet [Tue, 15 Mar 2011 08:20:59 +0000 (08:20 +0000)]
MFC kern.msgbufsize: r217688-217689,r217709,r218666-218667,r218913.
Note, that arm/{s3c2xx0,econa} exist only in head, thus not merged.

r217688:
 Make MSGBUF_SIZE kernel option a loader tunable kern.msgbufsize.

r217689:
 Add kern.msgbufsize default setting to /boot/defaults/loader.conf.

r217709,218666-218667,218913 by marcel, cognet:
 Fix up for various arm subtargets: call init_param1() before we use
 msgbufsize, now that the size of the message buffer is a tunable.

Reviewed by: marcel
Approved by: avg (mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/8@219662 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219127:
ae [Tue, 15 Mar 2011 07:15:04 +0000 (07:15 +0000)]
MFC r219127:
  Add XMIT_FAILOVER transmit algorithm to ng_one2many node. Packets are
  delivered out the first active "many" hook.

  PR: kern/137775
  Submitted by: Maxim Ignatenko

git-svn-id: svn://svn.freebsd.org/base/stable/8@219660 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoPartially MFC r209867 and r215439, to provide rudimentary support for
dim [Mon, 14 Mar 2011 22:51:51 +0000 (22:51 +0000)]
Partially MFC r209867 and r215439, to provide rudimentary support for
linking i386 (32 bit) executables on amd64, using gcc's -m32 option.

r209867 introduces the needed multilib options to gcc's multilib.h, but
was originally intended just for powerpc64.

r215439 teaches the linker to search in /usr/lib32 for elf_i386_fbsd
output, and amends r209867 to apply to amd64 too.

NOTE: this MFC does NOT provide full support for compiling and linking
all existing 32 bit programs on amd64, since /usr/include/machine still
contains amd64-specific headers.  Though simple "Hello World" type
programs work, anything relying on machine-specific types might fail in
various interesting ways.  You have been warned. :)

MFC r209867:
Teach our toolchain how to generate 64-bit PowerPC binaries. This fixes
a variety of bugs in binutils related to handling of 64-bit PPC ELF,
provides a GCC configuration for 64-bit PowerPC on FreeBSD, and
associated build systems tweaks.

Obtained from: projects/ppc64

MFC r215439:
Let gcc and ld know where to find 32 bit libraries on amd64.

Reviewed by: arch@
Approved by: kib (mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/8@219648 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r209710:
jh [Mon, 14 Mar 2011 17:08:30 +0000 (17:08 +0000)]
MFC r209710:

Extend the kernel unit number allocator for allocating specific unit
numbers. This change adds a new function alloc_unr_specific() which
returns the requested unit number if it is free. If the number is
already allocated or out of the range, -1 is returned.

Update alloc_unr(9) manual page accordingly and add a MLINK for
alloc_unr_specific(9).

git-svn-id: svn://svn.freebsd.org/base/stable/8@219642 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219388:
kib [Mon, 14 Mar 2011 11:20:26 +0000 (11:20 +0000)]
MFC r219388:
Simplify uses of the web of pointers.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219637 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC cxgbe(4) and fixes.
np [Mon, 14 Mar 2011 09:50:14 +0000 (09:50 +0000)]
MFC cxgbe(4) and fixes.

r218792:
cxgbe(4) - NIC driver for Chelsio T4 (Terminator 4) based 10Gb/1Gb adapters.

r219285:
Fix incorrect assertion.

r219286:
Resume tx immediately in response to an SGE egress update from the hardware.

r219287:
Upgrade the firmware on the card automatically if a better version is
available.  Downgrade only for a major version mismatch.

r219288:
A txpkts work request should have a valid FID.

r219289:
Store the ifnet rather than the port_info in each txq and rxq struct.

r219290:
Tweaks for rx:
- everything related to LRO should be in #ifdef INET blocks
- reorder sge_iq's fields so that the most frequently used are all together
- pull all rx code into t4_intr_data directly
- let go of the ingress queue lock when passing up data
- refill the freelist only if it is short of at least 32 buffers

r219292:
Calculate how many descriptors can be reclaimed before calling
reclaim_tx_descs

r219293:
There is no need to hold an ingress queue's lock while processing its
descriptors

r219299:
Be sure to stay within the bounds of the mod_str array when displaying
the transceiver type.

r219392:
cxgbe shouldn't directly know of the UMA zones where network buffers
come from.

r219436:
Display holdoff timers and packet counts as a list of numbers.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219633 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219352:
kib [Sun, 13 Mar 2011 09:36:52 +0000 (09:36 +0000)]
MFC r219352:
The execution of the shebang script requires putting interpreter path,
possible option and script path in the place of argv[0] supplied to
execve(2).  It is possible and valid for the substitution to be shorter
then the argv[0].

Avoid signed underflow in this case.

PR:     kern/155321

git-svn-id: svn://svn.freebsd.org/base/stable/8@219594 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r216697:
osa [Sat, 12 Mar 2011 14:57:10 +0000 (14:57 +0000)]
MFC r216697:

Fix typo (Pashka -> Paskha).

MFC r217025:

Fix typo: March -> September.

MFC r218471:

Fix Paskha and Paskha-specific holidays.

MFC r218473:

Always convert Paskha day from Julian (old) to Gregorian (new)
style by adding 13 days.  Bug introduced in 1.13 revision.

MFC r218771:

Fix the beginning day of the Great Lent, it starts on Monday
for 7 weeks before Paskha.
Fix the Exaltation of the Holy Cross day.
Add more Twelve holidays (dvunadesyatye prazdniki).

MFC r218797:

Replace hard-coded value by Julian2Gregorian converter function.

MFC r219174:

Fix beginning day of the Carnival.

MFC r219175:

Expand the name of Palm Sunday holiday with more canonical Entry
of the Lord into Jerusalem.
Merge the Pentecost and Trinity Sunday holidays, they are synonyms.
Remove Body of Christ day, nonexistent holiday for Orthodox Church.
Fix typo in the name of Ioann The Baptist, introduced in previous
commit.

git-svn-id: svn://svn.freebsd.org/base/stable/8@219569 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r219353:
dougb [Fri, 11 Mar 2011 23:13:22 +0000 (23:13 +0000)]
MFC r219353:

mbone is no longer a physical category

Submitted by: pav

git-svn-id: svn://svn.freebsd.org/base/stable/8@219550 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoPull up mergeinfo from r209199,210482,212138,217826
dougb [Fri, 11 Mar 2011 23:12:20 +0000 (23:12 +0000)]
Pull up mergeinfo from r209199,210482,212138,217826

git-svn-id: svn://svn.freebsd.org/base/stable/8@219549 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFH r210933,219210: Typo fixes
uqs [Fri, 11 Mar 2011 22:07:28 +0000 (22:07 +0000)]
MFH r210933,219210: Typo fixes

git-svn-id: svn://svn.freebsd.org/base/stable/8@219539 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r218844:
ed [Fri, 11 Mar 2011 19:44:06 +0000 (19:44 +0000)]
MFC r218844:

  Improve 256 color support.

  - Add screen-256color,
  - Improve rxvt-256color to set pa and op properly.
  - Add rxvt-unicode-256color as an alias to rxvt-256color.

  PR:           conf/152713, conf/153164
  Submitted by: Alexander Verbod and Frédéric Perrin

git-svn-id: svn://svn.freebsd.org/base/stable/8@219529 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agouse even larger stack size for ZFS txg_sync_thread
avg [Fri, 11 Mar 2011 19:27:31 +0000 (19:27 +0000)]
use even larger stack size for ZFS txg_sync_thread

While the stack size was larger than the default stack size on i386, it
was smaller than the default stack size on amd64 and apparently that
wasn't enough.  So, bump the size to 4 pages.  Upcoming ZFSv28 code uses
8 pages for this stack size.

This is a direct commit to stable/8.

PR: kern/154681
Discussed with: pjd

git-svn-id: svn://svn.freebsd.org/base/stable/8@219526 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r216505: cyclic xcall: use smp_no_rendevous_barrier as setup
avg [Fri, 11 Mar 2011 18:46:11 +0000 (18:46 +0000)]
MFC r216505: cyclic xcall: use smp_no_rendevous_barrier as setup
function parameter

git-svn-id: svn://svn.freebsd.org/base/stable/8@219520 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r216375,r216408: fix atomic_set_xxx misuse in rge
avg [Fri, 11 Mar 2011 18:28:20 +0000 (18:28 +0000)]
MFC r216375,r216408: fix atomic_set_xxx misuse in rge

git-svn-id: svn://svn.freebsd.org/base/stable/8@219517 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

13 years agoMFC r216374: fix atomic_set_xxx misuse in drm
avg [Fri, 11 Mar 2011 18:15:30 +0000 (18:15 +0000)]
MFC r216374: fix atomic_set_xxx misuse in drm

git-svn-id: svn://svn.freebsd.org/base/stable/8@219515 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f