Commit Graph

63660 Commits

Author SHA1 Message Date
Paolo Pisati
bafe5a3118 Bring in the reminaing bits to make interrupt filtering work:
o push much of the i386 and amd64 MD interrupt handling code
  (intr_machdep.c::intr_execute_handlers()) into MI code
  (kern_intr.c::ithread_loop())
o move filter handling to kern_intr.c::intr_filter_loop()
o factor out the code necessary to mask and ack an interrupt event
  (intr_machdep.c::intr_eoi_src() and intr_machdep.c::intr_disab_eoi_src()),
  and make them part of 'struct intr_event', passing them as arguments to
  kern_intr.c::intr_event_create().
o spawn a private ithread per handler (struct intr_handler::ih_thread)
  with filter and ithread functions.

Approved by: re (implicit?)
2007-05-06 17:02:50 +00:00
Ariff Abdullah
0e86bad6e3 PCMMKMINOR() bit twiddling, so we can have:
- 2048 unique sound cards (dsp0 -> dsp2047)
    (used to be 15)
  - 32 unique device types  (dspW, audio, mixer, sndstat, .. 32th)
    (used to be 15)
  -  256 unique cloneable devices (dsp%d.0 -> dsp%d.255)
    (unchanged)
2007-05-06 16:46:23 +00:00
Andre Oppermann
1a5537409f Remove unused requested_s_scale from struct tcpcb. 2007-05-06 16:04:36 +00:00
Andre Oppermann
3529149e9a Use existing TF_SACK_PERMIT flag in struct tcpcb t_flags field instead of
a decdicated sack_enable int for this bool.  Change all users accordingly.
2007-05-06 15:56:31 +00:00
Andre Oppermann
0ca3f933eb o Remove redundant tcp reassembly check in header prediction code
o Rearrange code to make intent in TCPS_SYN_SENT case more clear
 o Assorted style cleanup
 o Comment clarification for tcp_dropwithreset()
2007-05-06 15:41:06 +00:00
Andre Oppermann
c5ad39b910 Reorder the TCP header prediction test to check for the most volatile
values first to spend less time on a fallback to normal processing.
2007-05-06 15:23:51 +00:00
Andre Oppermann
679d9708b6 Remove the defunct remains of the TCPS_TIME_WAIT cases from tcp_do_segment
and change it to a void function.

We use a compressed structure for TCPS_TIME_WAIT to save memory.  Any late
late segments arriving for such a connection is handled directly in the TW
code.
2007-05-06 15:16:05 +00:00
Pawel Jakub Dawidek
f0256e71f1 When deleting key, flush write cache after each overwrite, so we don't
overwrite data N times in cache and only once on disk.
2007-05-06 14:56:03 +00:00
Dag-Erling Smørgrav
f679c6ff12 Unbreak the build. 2007-05-06 14:25:52 +00:00
Andre Oppermann
37ba9d112a Fix two comments. 2007-05-06 13:38:25 +00:00
Wojciech A. Koszek
9e2894466a Don't acquire Giant unconditionally.
Reviewed by:	rwatson
2007-05-06 12:00:38 +00:00
Kevin Lo
0738dfc386 Add support for Ralink Technology RT2501USB/RT2601USB devices.
Reviewed by: sam, sephe
Obtained from: OpenBSD
2007-05-06 10:07:21 +00:00
Pawel Jakub Dawidek
7baf73a6c2 Use provider's ident to handle situations when disks are moved around
and show up with different names: first try to open provider using
remembered name and compare its ident, if equal, this is our provider,
if not equal or there is no provider with such name, find provider with
remembered ident and don't care about the name.
2007-05-06 01:39:39 +00:00
Pawel Jakub Dawidek
fab3f4465e MFp4: We don't need to cover vnode_pager_setsize() with the z_map_lock. 2007-05-06 01:27:54 +00:00
Pawel Jakub Dawidek
1bfd71cfc5 File d_ident field with disk's serial number.
No answer from:	sos
2007-05-06 01:20:06 +00:00
Randall Stewart
6114cd961a Two bugs:
- Locks were not being unlocked when an invalid size chunk is
    sent in.
  - When a notification comes in, we cannot use it to look up
    the fragment interleave stream information since its not
    on a stream.
2007-05-06 00:01:17 +00:00
Matt Jacob
d0a68c2747 Make this driver MP safe and still be a multi-release driver.
Obtained from:	99% of the work done by Scott Long.
MFC after:	3 days
2007-05-05 20:18:24 +00:00
Matt Jacob
0a70657fcc Make this an MP safe driver but also still be multi-release.
Seems to work on RELENG_4 through -current and also on sparc64
now. There may still be some issues with the auto attach/detach
code to sort out.

MFC after:	3 days
2007-05-05 20:17:23 +00:00
Alan Cox
04a18977c8 Define every architecture as either VM_PHYSSEG_DENSE or
VM_PHYSSEG_SPARSE depending on whether the physical address space is
densely or sparsely populated with memory.  The effect of this
definition is to determine which of two implementations of
vm_page_array and PHYS_TO_VM_PAGE() is used.  The legacy
implementation is obtained by defining VM_PHYSSEG_DENSE, and a new
implementation that trades off time for space is obtained by defining
VM_PHYSSEG_SPARSE.  For now, all architectures except for ia64 and
sparc64 define VM_PHYSSEG_DENSE.  Defining VM_PHYSSEG_SPARSE on ia64
allows the entirety of my Itanium 2's memory to be used.  Previously,
only the first 1 GB could be used.  Defining VM_PHYSSEG_SPARSE on
sparc64 allows USIIIi-based systems to boot without crashing.

This change is a combination of Nathan Whitehorn's patch and my own
work in perforce.

Discussed with: kmacy, marius, Nathan Whitehorn
PR:		112194
2007-05-05 19:50:28 +00:00
Pawel Jakub Dawidek
4887800305 Allow to use ':' in d_ident, which is quite handy character. 2007-05-05 18:09:17 +00:00
Pawel Jakub Dawidek
a04c28bdd9 Handle GEOM::ident attribute by attaching 'sX' string at the end of ident
received from the underlying provider, where X is pp->index value.

OK'ed by:	phk
2007-05-05 17:52:22 +00:00
Pawel Jakub Dawidek
5e16a4866f Because there are many strange hardware out there, allow to use only
[a-zA-Z0-9-_@#%.] characters in d_ident field.
2007-05-05 17:47:20 +00:00
John-Mark Gurney
7f2f71862f fixup talk of kern.maxswzone... It's been 32MB for almost 5 years now...
and only supports just over 7GB of swap...

Sound a bit more professional..

Inspired by:	Marc G. Fournier
MFC After:	3 days
2007-05-05 17:36:42 +00:00
Pawel Jakub Dawidek
d0c11f9eb7 - Extend disk structure to allow to store disk's serial number, which can be
retrieved via GEOM::ident attribute.
- Bump disk(9) ABI version.

OK'ed by:	phk
2007-05-05 17:12:15 +00:00
Pawel Jakub Dawidek
0589353ac7 Implement three new ioctls that can be used with GEOM provider:
DIOCGFLUSH - Flush write cache (sends BIO_FLUSH).

	DIOCGDELETE - Delete data (mark as unused) (sends BIO_DELETE).

	DIOCGIDENT - Get provider's uniqe and fixed identifier (asks for
		GEOM::ident attribute).

First two are self-explanatory, but the last one might not be. Here are
properties of provider's ident:

- ident value is preserved between reboots,
- provider can be detached/attached and ident is preserved,
- provider's name can change - ident can't,
- ident value should not be based on on-disk metadata; in other words
  copying whole data from one disk to another should not yield the same
  ident for the other disk,
- there could be more than one provider with the same ident, but only if
  they point at exactly the same physical storage, this is the case for
  multipathing for example,
- GEOM classes that consumes single providers and provide single providers,
  like geli, gbde, should just attach class name to the ident of the
  underlying provider,
- ident is an ASCII string (is printable),
- ident is optional and applications can't relay on its presence.

The main purpose for this is that application and remember provider's ident
and once it tries to open provider by its name again, it may compare idents
to be sure this is the right provider. If it is not (idents don't match),
then it can open provider by its ident.

OK'ed by:	phk
2007-05-05 17:02:19 +00:00
Pawel Jakub Dawidek
2b17fb9514 Implement g_delete_data() similar to g_read_data() and g_write_data().
OK'ed by:	phk
2007-05-05 16:35:22 +00:00
Pawel Jakub Dawidek
d19dbf4a23 - Implement helper g_handleattr_str() function for string attributes
handling.
- Extend g_handleattr() to treat attribute as string when len=0.

OK'ed by:	phk
2007-05-05 16:33:44 +00:00
Sepherosa Ziehau
63afe606f8 - Nuke unnecessary header.
- Make wlan_amrr depend on wlan, so that it can find various symbols in
  wlan module if wlan is not compiled into kernel.

Approved by:	sam (mentor)
Tested by:	kevlo
2007-05-05 11:07:52 +00:00
Ariff Abdullah
3419bf5a7d Fix (or rather workaround) Intel 440MX Errata #36
- http://www.intel.com/design/chipsets/specupdt/245051.htm

AC97 Soft Audio and Soft Modem Master Abort Errata

Issue:
  Use of either soft audio or soft modem on an Intel® 82443MX PCISet
  based platform running a 100 MHz Processor System Bus and an AC97 codec
  may result in failures. The system continues to function normally while
  the AC97 hardware may not resume and may require a cold-boot to
  recover. As a result of the failure, the Master Abort Status bit will
  be set in the audio or modem function PCI header space.

Workaround:
  Force uncacheable DMA on both BDL and pcm buffers.

Tested by:	Emil Holmstr|m <emil@linux.se>
2007-05-05 09:18:05 +00:00
Ariff Abdullah
71e3af015d Miscellaneous changes and fix:
- Remove explicit call to pmap_change_attr(), since we now have proper
  and functional definition of BUS_DMA_NOCACHE.
- Enable PCI(e) bus snooping for non i386/amd64 as an alternative for
  uncacheable DMA.
- Codecs changes:
  * Analag Device -> Analog Devices, AD1988.
  * New codec: VIA VT1708 and VT1709, Realtek ALC262, ALC861-VD and
    ALC885.
  * Various fixups for Conexant Waikiki, fix recording (read: microphone)
    on various Analog Devices codecs due to vendor BIOS mess, various
    quirks for several ASUS laptops/boards.
- Fix connection list handling, closely following the specification to
  handle range of nids.
- Basic Jack sense polling infrastructure for possible hardwares with
  broken unsolicited response interrupt.

Ideas/Submitted/Tested by:	Andriy Gapon <avg@icyb.net.ua>,
                          	#freebsd-azalia, many.
2007-05-05 09:17:36 +00:00
SUZUKI Shinsuke
8f34a8b84a some minor modification to the previous commit to sys/netinet6/nd6.c and nd6_nbr.c.
- added some clarification comments
- removed an unnecesary code

Obtained from: KAME
MFC after: 1 week
2007-05-05 04:24:01 +00:00
Robert Watson
6087c3c29e Add global mutex tcp_debug_mtx, which will protect global TCP debugging
state tcp_debug, tcp_debx.  Acquire and drop as required in tcp_trace().

Move to ANSI C function header, correct prototype types so that short TCP
state is no longer promoted to int unnecessarily.

Add comments.

MFC after:	3 weeks
2007-05-04 23:43:18 +00:00
David Christensen
d2b9bc428c MFC after: 2 weeks
Updated copyright date to 2007.

Tested with BCM5706 A3.

Added ID for BCM5708 B2.

Removed unused driver version string.

Modified BCE_PRINTF macro to automatically fill-in the sc pointer.

Fixed a kernel panic when the driver was loaded as a module from the
command-line because the MII bus pointer was null (i.e. the MII bus
hadn't been enumerated yet).

Added fix proposed by Vladimir Ivanov <wawa@yandex-team.ru> to prevent
driver state corruption when releasing the lock during the ISR in
bce_rx_intr() to send packets up the stack.

Added new TX chain and register read sysctl interfaces for debugging.

Cleaned up formatting for various other debug routines.

Added a new statistic maintained by firmware which tracks the number
of received packets dropped because no receive buffers are available.
2007-05-04 23:14:19 +00:00
Poul-Henning Kamp
e1bb13cd30 Since if_gem is being touted as one of our more architecturally
correct network drivers with respect to busmaster DMA, go over it
with at duster to make other aspects of it a role model:

Eliminate the pci specific softc, it serves no rational purpose.

Use convenience resource allocation/deallocation functions to save
code and errorhandling.

Switch from bus_space_{read|write}_%u() to bus_{read|write}_%u()
functions and forget about tags and handles, the resource will know
about those, should they be needed.  This also eliminates a number
of inconsistently named local variables.
2007-05-04 19:15:28 +00:00
Robert Watson
1cd6eadfbb Tweak comment at end of tcp_input() when calling into tcp_do_segment(): the
pcbinfo lock will be released as well, not just the pcb lock.
2007-05-04 17:45:52 +00:00
Alexander Motin
6370fd6b05 Avoid extra rc4_init() when ng_mppc_updatekey() going to do it anyway.
Approved by:	glebius (mentor)
2007-05-04 16:20:47 +00:00
Alexander Motin
adecf751c3 Compact code a bit
Approved by:	glebius (mentor)
2007-05-04 16:12:54 +00:00
Alexander Motin
755bc28723 Make coherency counter 12bit as it should
Approved by:	glebius (mentor)
2007-05-04 16:05:58 +00:00
Alexander Motin
592009a347 Fix small mistake (sizeof(pad2) instead of sizeof(pad1))
Approved by:	glebius (mentor)
2007-05-04 15:44:22 +00:00
Alexander Motin
8239d414fa Remove unneded bzero().
SHA1Final() does not require clean buffer.

Approved by:	glebius (mentor)
2007-05-04 15:41:49 +00:00
Randall Stewart
1bb552e88d Fixes a missing unlock in the one-2-one hash table, if
it was full and a collision occured, then we would leave
a inp locked. Also fixes a missing inp unlock if IPSEC was
on and it failed during the attach. Bug found by Weongyo Jeong.
2007-05-04 15:19:10 +00:00
Konstantin Belousov
5c76452f8f Mark the filedescriptor table entries with VOP_OPEN being performed for them
as UF_OPENING. Disable closing of that entries. This should fix the crashes
caused by devfs_open() (and fifo_open()) dereferencing struct file * by
index, while the filedescriptor is closed by parallel thread.

Idea by:	tegge
Reviewed by:	tegge (previous version of patch)
Tested by:	Peter Holm
Approved by:	re (kensmith)
MFC after:	3 weeks
2007-05-04 14:23:29 +00:00
Robert Watson
c65aee44c6 Place a '#' at the front of the line holding a $FreeBSD$ ID tag. While
it actually compiles without this, it's still a good idea.
2007-05-04 13:34:33 +00:00
Robert Watson
c018682fbf $FreeBSD$ tags are not compilable C code; wrap in either __FBSDID() or
in comments for .c and .h files respectively.  Jack may want to clean up
style or other aspects once he's up and about again, but this gets the
kernel compiling.
2007-05-04 13:30:44 +00:00
Robert Watson
11631e9f45 Add missing e1000_82575.c entry to build in order to improve chances of
kernel compilation due to missing symbols in em driver.
2007-05-04 13:29:45 +00:00
Ariff Abdullah
53bc1d83c0 Fix use-after-free for DMA tag. Destroy DMA tag later.
Submitted by:	Yuriy Tsibizov
2007-05-04 12:38:46 +00:00
Bjoern A. Zeeb
7a92401aea Add support for filtering on Routing Header Type 0 and
Mobile IPv6 Routing Header Type 2 in addition to filter
on the non-differentiated presence of any Routing Header.

MFC after:	3 weeks
2007-05-04 11:15:41 +00:00
Jack F Vogel
65c7bc2147 Absolute pathname in the Makefile was broken, this
version should work correctly.
2007-05-04 07:21:01 +00:00
Jack F Vogel
d3b79b162d Last minute mistake crept in, old file name.
Approved by:pdeuskar
2007-05-04 05:58:46 +00:00
SUZUKI Shinsuke
8d290a593f fixed a memory leak in unresolved ND queue processing
Obtained from: KAME
MFC after: 1 week
2007-05-04 02:34:17 +00:00
Jack F Vogel
89290aa383 Merge in the new driver (6.5.0) of Intel. This has a new
shared code infrastructure that is family specific and
modular. There is also support for our latest gigabit
nic, the 82575 that is MSI/X and multiqueue capable.

The new shared code changes some interfaces to the core
code but testing at Intel has been going on for months,
it is fairly stable.

I have attempted to be careful in retaining any fixes that
CURRENT had and we did not, I apologize in advance if any
thing gets clobbered, I'm sure I'll hear about it :)

Approved by pdeuskar
2007-05-04 00:00:12 +00:00
Andrew Thompson
832eef31d1 Add a newline to the printf message. 2007-05-03 22:39:52 +00:00
Robert Watson
7abab91135 sblock() implements a sleep lock by interlocking SB_WANT and SB_LOCK flags
on each socket buffer with the socket buffer's mutex.  This sleep lock is
used to serialize I/O on sockets in order to prevent I/O interlacing.

This change replaces the custom sleep lock with an sx(9) lock, which
results in marginally better performance, better handling of contention
during simultaneous socket I/O across multiple threads, and a cleaner
separation between the different layers of locking in socket buffers.
Specifically, the socket buffer mutex is now solely responsible for
serializing simultaneous operation on the socket buffer data structure,
and not for I/O serialization.

While here, fix two historic bugs:

(1) a bug allowing I/O to be occasionally interlaced during long I/O
    operations (discovere by Isilon).

(2) a bug in which failed non-blocking acquisition of the socket buffer
    I/O serialization lock might be ignored (discovered by sam).

SCTP portion of this patch submitted by rrs.
2007-05-03 14:42:42 +00:00
Kevin Lo
3eeb00692a Remove sa1_cache_clean_addr. It isn't needed. 2007-05-03 09:51:12 +00:00
Andrew Thompson
ff6c5cf657 Fix flag descriptions. 2007-05-03 09:07:36 +00:00
Andrew Thompson
e3163ef60a - Add a disabled state for ports that can not be aggregated
- Refine check for lacp links, set to disabled if not suitable
2007-05-03 08:56:20 +00:00
John Baldwin
9310f22692 Update __FreeBSD_version check for MFC of pmap_mapbios(). 2007-05-02 18:43:51 +00:00
John Baldwin
e706f7f0c7 Revamp the MSI/MSI-X code a bit to achieve two main goals:
- Simplify the amount of work that has be done for each architecture by
  pushing more of the truly MI code down into the PCI bus driver.
- Don't bind MSI-X indicies to IRQs so that we can allow a driver to map
  multiple MSI-X messages into a single IRQ when handling a message
  shortage.

The changes include:
- Add a new pcib_if method: PCIB_MAP_MSI() which is called by the PCI bus
  to calculate the address and data values for a given MSI/MSI-X IRQ.
  The x86 nexus drivers map this into a call to a new 'msi_map()' function
  in msi.c that does the mapping.
- Retire the pcib_if method PCIB_REMAP_MSIX() and remove the 'index'
  parameter from PCIB_ALLOC_MSIX().  MD code no longer has any knowledge
  of the MSI-X index for a given MSI-X IRQ.
- The PCI bus driver now stores more MSI-X state in a child's ivars.
  Specifically, it now stores an array of IRQs (called "message vectors" in
  the code) that have associated address and data values, and a small
  virtual version of the MSI-X table that specifies the message vector
  that a given MSI-X table entry uses.  Sparse mappings are permitted in
  the virtual table.
- The PCI bus driver now configures the MSI and MSI-X address/data
  registers directly via custom bus_setup_intr() and bus_teardown_intr()
  methods.  pci_setup_intr() invokes PCIB_MAP_MSI() to determine the
  address and data values for a given message as needed.  The MD code
  no longer has to call back down into the PCI bus code to set these
  values from the nexus' bus_setup_intr() handler.
- The PCI bus code provides a callout (pci_remap_msi_irq()) that the MD
  code can call to force the PCI bus to re-invoke PCIB_MAP_MSI() to get
  new values of the address and data fields for a given IRQ.  The x86
  MSI code uses this when an MSI IRQ is moved to a different CPU, requiring
  a new value of the 'address' field.
- The x86 MSI psuedo-driver loses a lot of code, and in fact the separate
  MSI/MSI-X pseudo-PICs are collapsed down into a single MSI PIC driver
  since the only remaining diff between the two is a substring in a
  bootverbose printf.
- The PCI bus driver will now restore MSI-X state (including programming
  entries in the MSI-X table) on device resume.
- The interface for pci_remap_msix() has changed.  Instead of accepting
  indices for the allocated vectors, it accepts a mini-virtual table
  (with a new length parameter).  This table is an array of u_ints, where
  each value specifies which allocated message vector to use for the
  corresponding MSI-X message.  A vector of 0 forces a message to not
  have an associated IRQ.  The device may choose to only use some of the
  IRQs assigned, in which case the unused IRQs must be at the "end" and
  will be released back to the system.  This allows a driver to use the
  same remap table for different shortage values.  For example, if a driver
  wants 4 messages, it can use the same remap table (which only uses the
  first two messages) for the cases when it only gets 2 or 3 messages and
  in the latter case the PCI bus will release the 3rd IRQ back to the
  system.

MFC after:	1 month
2007-05-02 17:50:36 +00:00
John Baldwin
361cf3bd02 Use more specific local variable pointers to narrow some expressions.
MFC after:	1 week
2007-05-02 16:21:18 +00:00
Scott Long
ae780f57f6 MPSAFE atapi-cam 2007-05-02 15:30:24 +00:00
Randall Stewart
d06c82f169 - Somehow the disable fragment option got lost. We could
set/clear it but would not do it. Now we will.
-  Moved to latest socket api for extended sndrcv info struct.
-  Moved to support all new levels of fragment interleave (0-2).
-  Codenomicon security test updates - length checks and such.
-  Bug in stream reset (2 actually).
-  setpeerprimary could unlock a null pointer, fixed.
-  Added a flag in the pcb so netstat can see if we are listening easier.

Obtained from:	(some of the Listen changes from Weongyo Jeong)
2007-05-02 12:50:13 +00:00
Yaroslav Tykhiy
d562befcdd Fix a couple of typos in a comment. 2007-05-02 11:13:48 +00:00
Andrew Thompson
139722d4e4 Set the master flag on the right variable. 2007-05-02 08:58:28 +00:00
Andrew Thompson
c0194db365 Test for IFM_FDX rather than IFM_HDX as the half-duplex bit may not be set even
if the link is not full-duplex.
2007-05-02 07:52:55 +00:00
Scott Long
2472e51e46 Streamline locking in ciss_free() 2007-05-02 04:44:31 +00:00
Pawel Jakub Dawidek
57504dcfaf Share-lock a vnode where possible. 2007-05-02 01:03:10 +00:00
Pawel Jakub Dawidek
5bec66402b When parent directory has to be unlocked, lock it back with the same lock
type. Before this change, if directory was shared-locked, it was relocked
exclusively.
2007-05-02 00:41:44 +00:00
Pawel Jakub Dawidek
9167141244 Lock vnode using cn_lkflags in case the caller wants the vnode to be
shared-locked.
2007-05-02 00:39:52 +00:00
Pawel Jakub Dawidek
04748b1b2e The getnewvnode() function sets LK_NOSHARE by default, so if we want to
support shared vnodes locking, we need to remove that flag.
Also add LK_CANRECURSE flag as found in nfsclient.
2007-05-02 00:22:12 +00:00
Pawel Jakub Dawidek
0775674bbc ZFS should update timestamps upon the creat() of an existing file.
Obtained from:	OpenSolaris
Bug:		http://bugs.opensolaris.org/view_bug.do?bug_id=6465105
2007-05-02 00:18:22 +00:00
Pawel Jakub Dawidek
6de6bff649 - Lock vnode with flags passed in as argument in zfs_vget() and zfs_root().
Pointed out by:	ups
  Also reported by:	kris

- Add comments where I'm not sure if LK_RETRY should be used.
2007-05-02 00:09:34 +00:00
Jung-uk Kim
fe09b799f1 Reflect MFC of pci_find_extcap().
MFC after:	3 days
2007-05-01 19:18:12 +00:00
Andrey A. Chernov
2239cfb4ba Bump FreeBSD_version to not have it going backwards.
Asked by:       Ceri Davies <ceri@submonkey.net>
2007-05-01 19:03:42 +00:00
Marcel Moolenaar
bd3032d144 Define the miibus ivars as a structure, instead of as a vector of
pointers. A structure is more readable and less error-prone. It
also avoids problems when a function pointer doesn't have the
same width as a void pointer.
2007-05-01 18:21:24 +00:00
Alan Cox
37f3c8939a Eliminate the use of Giant from ia64-specific code in freebsd32_mmap(). 2007-05-01 17:10:01 +00:00
Robert Watson
84ca8aa609 Remove unused pcbinfo arguments to in_setsockaddr() and
in_setpeeraddr().
2007-05-01 16:31:02 +00:00
Marius Strobl
c2fa6c1890 Use the VIS-based Spitfire version of the page copying and zeroing
functions with CPUs they apply to only, otherwise default to the
plain C functions. This is modeled in a way so that f.e. a Cheetah
version of these functions can be inserted easily.
2007-05-01 16:19:28 +00:00
Andrey A. Chernov
ba174a5e38 Back out all POSIXified *env() changes.
Not because I admit they are technically wrong and not because of bug
reports (I receive nothing). But because I surprisingly meets so
strong opposition and resistance so lost any desire to continue that.

Anyone who interested in POSIX can dig out what changes and how
through cvs diffs.
2007-05-01 16:02:44 +00:00
Marius Strobl
8d497697b2 Make the rman(9) workaround actually work. The main problem was that
the UPA_IMR2 resource is also shared with/a subset of the Schizo PCI
bus B CSR bank. I'm not entirely sure how this previously managed to
escape testing...
2007-05-01 15:02:18 +00:00
Marius Strobl
5ffa507dce Fix bugs in the Sun -> AT keycode translation table which caused the
Props key to act as Again and the Paste and Copy keys to be inverted.
2007-05-01 14:14:52 +00:00
Pawel Jakub Dawidek
d1d7399da5 MFp4: Remove LK_RETRY flag when locking vnode in zfs_lookup, we don't want
dead vnodes here.

Suggested by:	kib
2007-05-01 13:58:56 +00:00
Pawel Jakub Dawidek
80ae748326 White space fixes. 2007-05-01 13:32:22 +00:00
Dag-Erling Smørgrav
1d776018d4 The process lock is held when procfs_ioctl() is called. Assert that this
is so, and PHOLD the process while sleeping since msleep() will release
the lock.
2007-05-01 12:59:20 +00:00
Pawel Jakub Dawidek
7555fddd83 Add a comment explaining why we call dmu_write() unconditionally, even if
uiomove() fails, especially that it is different from what OpenSolaris
does (I'm not entirely sure they are right).

Suggested by:	darrenr
2007-05-01 12:09:45 +00:00
Marius Strobl
e3b78ec974 Remove invalid BUS_DMA_ALLOCNOW when creating a tag which is used for
a "static" memory allocation only.
2007-05-01 11:50:11 +00:00
Christian Brueffer
8d2896ac91 Remove pre-5.0 compat cruft.
Approved by:	rwatson (mentor)
MFC after:	1 week
2007-05-01 11:17:29 +00:00
Alan Cox
fa75abb0d2 Remove unneeded include files. 2007-05-01 06:35:54 +00:00
Scott Long
975b731815 MPSAFE ciss driver 2007-05-01 05:13:15 +00:00
Pyun YongHyeon
787b3ade61 If we've got watchdog timeouts try to get more packets going after
resetting the hardware.
2007-05-01 03:40:57 +00:00
Pyun YongHyeon
7ef4ec5d34 Honor link up/down state in stge_start().
While I'm here move MAC control settings to stge_link_task, a task
queue which handles link state and duplex/flow controls.
2007-05-01 03:35:48 +00:00
Pyun YongHyeon
eb7a67da1a Use our own timer for watchdog instead of if_watchdog/if_timer
interface.
2007-05-01 03:15:04 +00:00
Alan Cox
4bd4f5a2e2 Synchronize vm map and object accesses.
Approved by: des@
2007-05-01 03:09:57 +00:00
Robert Watson
712fc218a0 Rename some fields of struct inpcbinfo to have the ipi_ prefix,
consistent with the naming of other structure field members, and
reducing improper grep matches.  Clean up and comment structure
fields in structure definition.
2007-04-30 23:12:05 +00:00
Marius Strobl
2f9f08b635 - Take advantage of mii_phy_add_media() for adding media and setting
sc->mii_anegticks according to whether the respective BGE chip
  supports Fast Ethernet only or also Gigabit Ethernet.
- At least the BGE chips I've tested with wedge when isolating them
  so document this as the reason for setting MIIF_NOISOLATE and
  remove the unused (and partially even #ifdef'ed out) isolation
  related code. Add code that panics if we encounter a non-zero MII
  instance as generally there's no way a PHY requiring MIIF_NOISOLATE
  can be handled gracefully in a multi-PHY configuration (it's ok for
  the internal PHY of single-PHY-only-NIC to not support isolation
  though).
- Additionally set MIIF_NOLOOP as loopback doesn't seem to work
  either and remove the #ifdef'ed out code for adding respective
  media. The MIIF_NOLOOP flag currently triggers nothing but
  hopefully will be respected by mii_phy_setmedia() later on.

Reviewed by:	jkim, yongari
MFC after:	1 month
2007-04-30 22:35:33 +00:00
Marius Strobl
08013fd336 - Add support/quirks for the on-board BGEs found in Sun Blade 1500
Blade 2500, Fire V210 and probably some other sparc64 machines.
  These chips are typically not fitted with an EEPROM which means
  that we have to obtain the MAC address via OFW and that some chip
  tests will just always fail.
  These changes are based on the respective code found in OpenBSD
  with some additional info obtained from OpenSolaris and some style
  suggestions by jkim@. They also have the desired side-effect of
  respecting the 'local-mac-address?' system configuration variable
  for the affected BGEs.
- In bge_attach() factor out calling bge_release_resources() before
  going to the fail label into the fail label as well as replace a
  magic 6 with ETHER_ADDR_LEN.

Reviewed by:	yongari (before style changes), jkim
2007-04-30 21:55:27 +00:00
Andrey A. Chernov
d27fc458a0 Bump __FreeBSD_version after making setenv(), putenv(), getenv() and
unsetenv() POSIXed
2007-04-30 21:14:53 +00:00
Maxim Konovalov
1e2f57057d o Kill EOLWS while I'm here. 2007-04-30 20:26:11 +00:00
Maxim Konovalov
38ec733c53 o Fix strtoul() error conditions check.
PR:		kern/108211
Submitted by:	Yong Tang
MFC after:	2 weeks
2007-04-30 20:22:11 +00:00
Takanori Watanabe
0f23397d3f Add MELCO PC-OP-RS Universal remote ID. 2007-04-30 16:15:19 +00:00
Hidetoshi Shimokawa
0cf4488ab4 MFp4: Improve asynchronous packet receive process.
- Wake up DMA engine after adding a new receive buffer.
- Skip buffers which have unknown state after error.
- More rigid error detection.

MFC after: 1 week
2007-04-30 14:06:30 +00:00
Hidetoshi Shimokawa
2c70b09005 MFp4:
- Update state in fw_xferq_dorain() after removed from the send queue.
- Remove unnecessary 'goto err;".

MFC after: 1 week
2007-04-30 13:51:13 +00:00
Hidetoshi Shimokawa
0892f4c5ec MFp4: Fix broken userland API for async packets.
- Introduce fw_xferlist_add/remove().
- Introduce fw_read/write_async().
- Remove unused FWACT_CH.

MFC after: 1 week
2007-04-30 13:41:40 +00:00
Hidetoshi Shimokawa
5cc9512ae2 MFp4: Fix typo in recv spd.
MFC after: 1 week
2007-04-30 12:55:03 +00:00
Hidetoshi Shimokawa
6b3ecf71ea MFp4: Add a sysctl knob to disable cycle master mode and add some comments.
MFC after: 1 week
2007-04-30 12:38:50 +00:00
Hidetoshi Shimokawa
78b1168bd8 MFp4: remove unused fw_asybusy().
MFC after: 1 week
2007-04-30 12:30:21 +00:00
Hidetoshi Shimokawa
89cad4614f MFp4: Simplify tlabel handling
- Remove struct tl_label and runtime malloc() for it.
- Include tl_lable list in struct fw_xfer.
- Don't free unallocated tlabel.

MFC after: 1 week
2007-04-30 12:26:29 +00:00
Hidetoshi Shimokawa
ad9cf50615 Initialize configuration ROM before a bus reset.
MFC: after 3 days
2007-04-30 10:50:53 +00:00
Thomas Quinot
057f398585 (atapi_action, case XPT_SCSI_IO): Enable DMA only for READ and WRITE commands
as some combinations of chipset, controller and target do not behave
 correctly when DMA is enabled for other commands.

PR:		kern/103602
MFC after:	2 weeks
2007-04-30 09:33:57 +00:00
Thomas Quinot
e651554bf6 (atapi_cb): Fix test for the presence of sense data. An incorrect condition
was being tested, which would result in a system hang in some configurations.

PR:		kern/112119
Reviewed by:	scottl
MFC after:	3 days
2007-04-30 09:26:43 +00:00
Pawel Jakub Dawidek
2f51d93626 - Define d_type for ".", ".." and ".zfs" directories.
- Add a TODO comment where d_type is still noe defined.
2007-04-29 23:28:07 +00:00
Pawel Jakub Dawidek
b9f28e4a35 Oops, correct important typo in last commit. 2007-04-29 23:12:00 +00:00
Pawel Jakub Dawidek
2c965e1956 Avoid freeing NULL pointer in case of an error. 2007-04-29 23:08:24 +00:00
Robert Watson
69c4d690b1 Don't expose #ifdef NOTYET parts to userspace via audit_ioctl.h, just
remove them, since the functionality they are associated with isn't there
yet.

MFC after:	3 days
2007-04-29 16:20:32 +00:00
Pawel Jakub Dawidek
f2c9356328 Fix two use-after-free cases. 2007-04-29 00:41:29 +00:00
John-Mark Gurney
ebf750a9fd Complete removal of restriction about overlaps to rman_manage_region:
remove comment and man page verbage...

Document return values for rman_init and rman_manage_region..

MFC after:	1 week
2007-04-28 07:37:49 +00:00
Scott Long
2524e4a8f6 Only schedule the xpt_finishconfig_task once. This fixes some potential
panics on boot.
2007-04-27 14:23:05 +00:00
Andrew Gallatin
9b03b0f3c0 -Fix an mbuf leak caused by a cut&paste bug where the small ring's mbufs
were never freed, but the big ring was freed twice.
-Don't supply rx hw csums for frames which are padded beyond the
 length specified in the ip header.  If the padding is non-zero,
 the hw csum will be incorrect for such frames.

Sponsored by: Myricom
2007-04-27 13:11:50 +00:00
Benjamin Close
6d8aebf6c5 Increase the verbosity of the warning given when this file is used as
part of the old tty system - helping the user to know how to transition to
the new tty api.

Approved by: mlaier (Mentor)

PR: kern/110667
2007-04-27 11:19:05 +00:00
Marcel Moolenaar
e8e1f54462 Put the scheme (APM, GPT, etc) in the XML. 2007-04-27 05:58:10 +00:00
John Baldwin
06e043fb20 Avoid a lot of code duplication by using kern_open() to open /dev/null
in fdcheckstd() instead of a stripped down version of kern_open()'s code.

MFC after:	1 week
Reviewed by:	cperciva
2007-04-26 18:01:19 +00:00
Pawel Jakub Dawidek
c28672efcc MFp4: Optimize mappedwrite() and mappedread() functions to write/read as much
non-mapped data as possible at once and not page-by-page. Which this change we
combain I/Os, but also saves many VM_OBJECT_UNLOCK()/VM_OBJECT_LOCK()
operations.

Simple 'fsx -l 33554432 -o 524288 -N 10000 /tank/fsx' test shows ~23%
performance increase.
2007-04-26 17:07:50 +00:00
Ollivier Robert
825f8b5050 Use the same timeout parameters for BIO_FLUSH as with the other commands.
This workaround the problem in Parallels/VMWare where the emulated drivers are
slower, especially with ATA_FLUSHCACHE.  The problem appears much more
frequently with ZFS which use it a lot more.

Approved:	sos, pjd
2007-04-26 12:59:20 +00:00
Pawel Jakub Dawidek
171c4b21e2 - Always try to write one whole page at a time.
- vm_page_undirty() is enough (instead of vm_page_set_validclean()), but it has
  to be called before we write the data in case someone makes page dirty after
  our write, but before our vm_page_undirty() call.
- Always dmu_write, not matter if uiomove() succeeded, because it could
  partially be ok and we would lose some changes.

All good ideas from:	ups
2007-04-26 12:58:17 +00:00
Pawel Jakub Dawidek
caa93cc3a0 MFV: Free znodes immediatelly, allowing the ARC to hold onto less memory.
Full description at:	http://bugs.opensolaris.org/view_bug.do?bug_id=6543706
2007-04-26 10:08:54 +00:00
Pawel Jakub Dawidek
5da1b1ed71 MFV: Functions name change. 2007-04-26 09:38:20 +00:00
Konstantin Belousov
e5ea32c290 Allow the dounmount() to proceed even for doomed coveredvp.
In dounmount(), before or while vn_lock(coveredvp) is called, coveredvp
vnode may be VI_DOOMED due to one of the following:
- other thread finished unmount and vput()ed it, and vnode was chosen
  for recycling, while vn_lock() slept;
- forced unmount of the coveredvp->v_mount fs.
In the first case, next check for changed v_mountedhere or mnt_gen counter
would be successfull. In the second case, the unmount shall be allowed.

Submitted by:	sobomax
MFC after:	2 weeks
2007-04-26 08:56:56 +00:00
Kip Macy
64c43db51c Default to using a single queue as this is currently the only way to achieve
line rate
2007-04-26 08:38:00 +00:00
Kip Macy
ea5143feaf Disable mbuf chain collapsing - it is currently causing an mbuf leak 2007-04-26 08:36:59 +00:00
Alan Cox
17afe8befe Remove some code from vmspace_fork() that became redundant after
revision 1.334 modified _vm_map_init() to initialize the new vm map's
flags to zero.
2007-04-26 05:48:17 +00:00
John Baldwin
a1054d5776 Various fixes to the NFS Directio support.
- Fix for a bug where a close would not wait for all (directio)
  dirty buffers to drain. The nfsnode was not marked NMODIFIED
  when there were directio dirtied buffers pending, causing this.
- No reason to vhold/vrele the vp when enqueueing DirectIO requests
  for the nfsiods. The vnode can't really go way since the close
  has to wait for these requests to drain.

MFC after:	1 week
Submitted by:	mohans
2007-04-25 20:34:55 +00:00
Ariff Abdullah
1d80d190af Disable C1 Enhanced mode on AMD K8 Family Revision F and above to keep
local APIC timer alive.

Reviewed by:	jhb
PR:		i386/104678
MFC after:	3 days
2007-04-25 19:58:42 +00:00
John Baldwin
147c0ad0a1 Use a tighter check to see if a resource allocation request is for a
specific request and thus should first try to be allocated from the
sys_resource pool.  This avoids using the sys_resource pool for wildcard
requests that have bounded ranges coming from cbb(4) and Host-PCI pcib(4)
drivers.

Tested by:	Andrea Bittau <a.bittau of cs.ucl.ac.uk fame>
Sleuthing by:	Andrea Bittau as well
2007-04-25 16:22:18 +00:00
Alexander Motin
5e323541db Add static build depends for ng_deflate, ng_nat and ng_sppp.
Approved by:	glebius (mentor)
2007-04-25 15:30:17 +00:00
John Baldwin
d68b1825b7 - HT 2.00b added a new flag to the MSI mapping HT capability to indicate
that the MSI mapping window is fixed at 0xfee00000 and the capability
  does not include two more dwords used to program the address.  Supporting
  this mostly results in quieting spurious warnings during boot about
  non-default MSI mapping windows.
- HT 2.00b also added a new HT capability type, so support that in pciconf.

MFC after:	3 days
Tested by:	jmg
2007-04-25 14:45:46 +00:00
Pyun YongHyeon
dd936d524b Work around GMAC hardware hang bug.
It seems that valid pause frames(Tx flow control) cause GMAC to hang
such that it resulted in watchdog timeout. As a work around don't
flush Rx MAC FIFO if we've received pause frames.

Tested by:	Harald Schmalzbauer (h DOT schmalzbauer AT omnisec DOT de)
2007-04-25 01:20:31 +00:00
Pyun YongHyeon
b2313f5861 Disable TSO support.
Under certain circumtances, if TSO is active, Yukon II generates
corrupted IP packets. All corrupted IP packets I noticed were the the
last segmented packet in a TSO request. The corrupted packet resulted
in retransmission of the damaged packet which in turn decreased network
performance dramatically.
Unfortunately it seems that there is no way to workaround this bug
as TSO is completely handled in hardware. Disable TSO until we find a
working workaround or a new silicon revision that doesn't have this
hardware bug.
2007-04-25 01:17:44 +00:00
Pyun YongHyeon
3326191f71 Fix TCP header size calculation logic which is used for setting
TSO MTU.
2007-04-25 01:13:38 +00:00
Markus Brueffer
9cf7411649 Utilize led_create_state in order to preserve the status of the ThinkLight
on driver attach.

PR:		kern/112044
Submitted by:	Henrik Brix Andersen <henrik@brixandersen.dk>
Approved by:	emax (mentor) (earlier version)
2007-04-24 23:09:37 +00:00
John Baldwin
a5b6b9a68e Fix the triple fault used as a last resort during a reboot to actually
fault.  The previous method zero'd out the page tables, invalidated the
TLB, and then entered a spin loop.  The idea was that the instruction after
the TLB invalidate would result in a page fault and the page fault and
subsequent double fault wouldn't be able to determine the physical page
for their fault handlers' first instruction.  This stopped working when
PGE (PG_G PTE/PDE bit) support was added as a TLB invalidate via %cr3
reload doesn't clear TLB entries with PG_G set.  Thus, the CPU was still
able to map the virtual address for the spin loop and happily performed
its infinite loop.

The triple fault now uses a much more deterministic sledge-hammer approach
to generate a triple fault.  First, the IDT descriptor is set to point to
an empty IDT, so any interrupts (including a double fault) will instantly
fault.  Second, we trigger a int 3 breakpoint to force an interrupt and
kick off a triple fault.

MFC after:	3 days
2007-04-24 21:17:45 +00:00
John Baldwin
4cc968cb95 MFi386: Attempt to reset the machine using the Reset Control register and
Fast A20 and Init register if the keyboard reset doesn't work before
resorting to a triple fault.
2007-04-24 20:06:36 +00:00
Pawel Jakub Dawidek
1e788bd7e5 ZIL (ZFS Intent Log) can be safely turned on and off at run time, because
it is only used when dataset is beeing mounted to decide if log should also
be opened.
2007-04-24 19:02:51 +00:00
Pawel Jakub Dawidek
8b384c52c0 MFp4: Now that ZFS can use FreeBSD's namecache, turn it off by default and
turn off DNLC, but don't remove DNLC yet just in case.
2007-04-24 16:59:20 +00:00
Pawel Jakub Dawidek
f13f738876 MFp4: Rearange the code so vobject is destroyed from reclaim() method like
in all other file system on FreeBSD (instead from inactive() method).

A nice side-effect of this change, except that it speedups file system
when mmaped file are often open/closed, is that it makes FreeBSD's
namecache work:)
2007-04-24 16:57:53 +00:00
Pawel Jakub Dawidek
0cdad5e228 MFp4: Once page is written successfully, we should clear the dirty bits.
This fixes slow operations on mmaped files, because without this fix,
pages were written to disk multiple times.

If one is looking for even greater speed up for such operation, he should
disable ZIL (by setting vfs.zfs.zil_disable to 1 in /boot/loader.conf).
Disabling ZIL makes fsx run ~9 times faster.
2007-04-24 16:53:01 +00:00
Pawel Jakub Dawidek
71ce4c9c10 MFp4: Reduce diff against vendor. 2007-04-24 16:49:01 +00:00
Pawel Jakub Dawidek
692fd5a7b9 MFp4: We have stronger 'lock already initialized' check now, so we can
reduce diff against the vendor by removing bzero of this mutex.
2007-04-24 16:45:42 +00:00
John Baldwin
b72d374cee Update comments for the 0xcf9 and 0x92 reset methods to explain what we are
actually doing and what the various bits mean.
2007-04-24 15:16:27 +00:00
Hidetoshi Shimokawa
e340a7ac14 Configuration ROM length should be unsigned.
MFC: 1 week
2007-04-24 12:15:05 +00:00
Sepherosa Ziehau
3629c47471 Nuke unnecessary setting of ural(4)'s security registers. ural(4) only
supports software encrypt/decrypt.

The nuked code itself is quite problematic, as pointed out by sam@ ---
wk->wk_keyix should be replaced by the loop count.

Tested with WEP/TKIP/CCMP/no-protection.

Approved by:	sam@ (mentor)
Noticed by:	Hans Petter Selasky <hselasky@c2i.net>
2007-04-24 11:18:55 +00:00
Konstantin Belousov
8e68f804a7 Disable nesting of BOP_BDFLUSH(). VOP_FSYNC() call in bdwrite() could
result in bdwrite() being reentered, thus causing infinite recursion.

Reported and tested by:	Peter Holm
Reviewed by:	tegge
MFC after:	2 weeks
2007-04-24 10:59:21 +00:00
Alexander Motin
206fa244b7 Avoid false assertion on transmit and delayed ack timeout with enabled invariants.
Replace callout_pending() by callout_active() to remove race window.

Reviewed by:	archie
Approved by:	glebius (mentor)
2007-04-24 10:50:25 +00:00
Hidetoshi Shimokawa
33018fbdff If compressed length is zero, return a zero-filled block.
MFC after: 1 week
2007-04-24 06:30:06 +00:00
John Baldwin
194617769b Tweak printf string. 2007-04-23 22:53:01 +00:00
Bruce A. Mah
9100d31299 Mostly-cosmetic fixes in low-memory warning messages:
o Fix linewrap issues.

o Fix two typos (s/Recomended/Recommended/ and s/tunning/tuning/)

o Remove a couple of extra instances of the word "of".

o Update names of kmem_size variables.

Approved by:	pjd
2007-04-23 21:52:14 +00:00
Andre Oppermann
9fa198bead o Fix INP lock leak in the minttl case
o Remove indirection in the decision of unlocking inp
o Further annotation of locking in tcp_input()
2007-04-23 19:41:47 +00:00
Dag-Erling Smørgrav
b77d604841 Fix old locking bugs which were revealed when pseudofs was made MPSAFE.
Submitted by:	tegge
2007-04-23 19:17:01 +00:00
Scott Long
06b7b89f0d Remove obsolete headers. Move kernel specific headers under #ifdefs 2007-04-23 18:01:44 +00:00
Alexander Motin
34d16c641d Global xmit stats calculation fix.
Approved by:	glebius (mentor)
2007-04-23 15:25:14 +00:00
Robert Watson
d9135e724e Audit pathnames looked up in swapon(2) and swapoff(2).
MFC after:	2 weeks
Obtained from:	TrustedBSD Project
2007-04-23 14:41:34 +00:00
Pawel Jakub Dawidek
cfda925270 Too much diff reduction. 'cmd' has to be u_long.
Reported by:	delphij
2007-04-23 13:47:49 +00:00
Robert Watson
305759909e Rename mac*devfsdirent*() to mac*devfs*() to synchronize with SEDarwin,
where similar data structures exist to support devfs and the MAC
Framework, but are named differently.

Obtained from:	TrustedBSD Project
Sponsored by:	SPARTA, Inc.
2007-04-23 13:36:54 +00:00
Robert Watson
78007886c9 Apply variable name normalization to MAC policies: adopt global conventions
for the naming of variables associated with specific data structures.

Obtained from:	TrustedBSD Project
2007-04-23 13:15:23 +00:00
Pawel Jakub Dawidek
8c804c7c98 Correct typo. 2007-04-23 12:53:00 +00:00
Poul-Henning Kamp
ea60845d09 Make it possible to specify an initial state for the LED.
Requested by:	Henrik Brix Andersen <henrik@brixandersen.dk>
PR:	112008
2007-04-23 12:42:15 +00:00
Poul-Henning Kamp
98b2967900 Add VLAN capability.
Submitted by:	Slawa Olhovchenkov <slw@zxy.spb.ru>
2007-04-23 12:19:02 +00:00
George V. Neville-Neil
6486cbd7bb Turn off route header processing for now due to issues pointed out
by Philippe Biondi and Arnaud Ebalard.  This is a temporary fix
until more discussion can be had on the exact risks involved in
allowing source routing in IPv6

Submitted by:	itojun
Reviewed by:	jinmei
MFC after:	1 day
2007-04-23 09:32:04 +00:00
Alan Cox
cf75c506db Add synchronization. Eliminate the acquisition and release of Giant.
Reviewed by: tegge
2007-04-23 06:12:24 +00:00
Sam Leffler
b298baf298 make dev.ath.N.ledpin have an immediate effect
PR:		kern/111810
Submitted by:	Henrik Brix Andersen <henrik@brixandersen.dk>
MFC after:	1 week
2007-04-23 05:57:06 +00:00
Pawel Jakub Dawidek
cc7cd831b2 MFp4: Reduce diff against vendor code:
- Move FreeBSD-specific code to zfs_freebsd_*() functions in zfs_vnops.c
  and keep original functions as similar to vendor's code as possible.
- Add various includes back, now that we have them.
2007-04-23 00:52:07 +00:00
Randall Stewart
ee7f985774 Fixes cut and paste bug using wrong pointer reference. 2007-04-23 00:51:49 +00:00
Pawel Jakub Dawidek
3698384259 Fix 'zpool status -v'. To get object number we should use ZFS_DIRENT_OBJ()
macro, as za_first_integer field also contains type. This should be fixed in
ZFS itself, but this bug is not visible on Solaris, because there, type is
not stored in za_first_integer. On the other hand it will be visible on
MacOS X.

Reported by:	Barry Pederson <bp@barryp.org>
2007-04-22 21:18:40 +00:00
Pawel Jakub Dawidek
77128a226d Fix st_rdev handling (implement it, actually).
Reported by:	gj
2007-04-22 21:16:15 +00:00
Robert Watson
26ae2b86b6 Normalize variable naming in the MAC Framework by adopting the normal
variable name conventions for arguments passed into the framework --
for example, name network interfaces 'ifp', sockets 'so', mounts 'mp',
mbufs 'm', processes 'p', etc, wherever possible.  Previously there
was significant variation in this regard.

Normalize copyright lists to ranges where sensible.
2007-04-22 19:55:56 +00:00
Robert Watson
eb542415c0 In the MAC Framework implementation, file systems have two per-mountpoint
labels: the mount label (label of the mountpoint) and the fs label (label
of the file system).  In practice, policies appear to only ever use one,
and the distinction is not helpful.

Combine mnt_mntlabel and mnt_fslabel into a single mnt_label, and
eliminate extra machinery required to maintain the additional label.
Update policies to reflect removal of extra entry points and label.

Obtained from:	TrustedBSD Project
Sponsored by:	SPARTA, Inc.
2007-04-22 16:18:10 +00:00
Poul-Henning Kamp
2efc0f7f47 Remove the old software bit-banging MII interface, we started using
the Rhines shiftregisters in four years ago (1.60).
2007-04-22 15:58:56 +00:00
Poul-Henning Kamp
28a811cd5b Remove further cobwebs: Two layers of pointless substructures. 2007-04-22 15:48:29 +00:00
Robert Watson
c14d15ae3e Remove MAC Framework access control check entry points made redundant with
the introduction of priv(9) and MAC Framework entry points for privilege
checking/granting.  These entry points exactly aligned with privileges and
provided no additional security context:

- mac_check_sysarch_ioperm()
- mac_check_kld_unload()
- mac_check_settime()
- mac_check_system_nfsd()

Add mpo_priv_check() implementations to Biba and LOMAC policies, which,
for each privilege, determine if they can be granted to processes
considered unprivileged by those two policies.  These mostly, but not
entirely, align with the set of privileges granted in jails.

Obtained from:	TrustedBSD Project
2007-04-22 15:31:22 +00:00
Poul-Henning Kamp
5d83ecf965 Initialize the physical next pointer in the tx descriptors when we
initialize instead of in the start routine.
2007-04-22 15:09:03 +00:00
Poul-Henning Kamp
27de12a9c2 Don't rename fields with #define.
Collapse two semantically identical structs.
Add missing vr_ prefix.
2007-04-22 14:57:05 +00:00
Robert Watson
269ad13024 Further MAC test policy cleanup and enhancement:
- Redistribute counter declarations to where they are used, rather than at
  the file header, so it's more clear where we do (and don't) have
  counters.

- Add many more counters, one per policy entry point, so that many
  individual access controls and object life cycle events are tracked.

- Perform counter increments for label destruction explicitly in entry
  point functions rather than in LABEL_DESTROY().

- Use LABEL_INIT() instead of SLOT_SET() directly in label init functions
  to be symmetric with destruction.

- Align counter names more carefully with entry point names.

- More constant and variable name normalization.

Obtained from:	TrustedBSD Project
2007-04-22 13:29:37 +00:00
Poul-Henning Kamp
c8ea76936e Run if_vr(4) through FlexeLint and clean some of the cobwebs found. 2007-04-22 12:55:36 +00:00
Randall Stewart
58967d8d46 Moves the PCB features and flags from sctp_pcb.h to
sctp.h so that netstat can access and display these
values.
2007-04-22 12:12:38 +00:00
Robert Watson
6827d0294e Perform overdue clean up mac_test policy:
- Add a more detailed comment describing the mac_test policy.

- Add COUNTER_DECL() and COUNTER_INC() macros to declare and manage
  various test counters, reducing the verbosity of the test policy
  quite a bit.

- Add LABEL_CHECK() macro to abbreviate normal validation of labels.
  Unlike the previous check macros, this checks for a NULL label and
  doesn't test NULL labels.  This means that optionally passed labels
  will now be handled automatically, although in the case of optional
  credentials, NULL-checks are still required.

- Add LABEL_DESTROY() macro to abbreviate the handling of label
  validation and tear-down.

- Add LABEL_NOTFREE() macro to abbreviate check for non-free labels.

- Normalize the names of counters, magic values.

- Remove unused policy "enabled" flag.

Obtained from:	TrustedBSD Project
2007-04-22 11:35:15 +00:00
Randall Stewart
9a6142d8cd - Somehow the disable fragment option got lost. We could
set/clear it but would not do it. Now we will.
-  Moved to latest socket api for extended sndrcv info struct.
-  Moved to support all new levels of fragment interleave.
2007-04-22 11:06:27 +00:00
Dag-Erling Smørgrav
7621783a55 Now that we're MPSAFE, tell namei() to acquire Giant if necessary. 2007-04-22 08:41:52 +00:00
Robert Watson
18717f69b1 Allow MAC policy modules to control access to audit configuration system
calls.  Add MAC Framework entry points and MAC policy entry points for
audit(), auditctl(), auditon(), setaudit(), aud setauid().

MAC Framework entry points are only added for audit system calls where
additional argument context may be useful for policy decision-making; other
audit system calls without arguments may be controlled via the priv(9)
entry points.

Update various policy modules to implement audit-related checks, and in
some cases, other missing system-related checks.

Obtained from:	TrustedBSD Project
Sponsored by:	SPARTA, Inc.
2007-04-21 22:08:48 +00:00
Robert Watson
fea9ea0005 Teach netinet6 to use PRIV_NETINET_REUSEPORT. 2007-04-21 18:14:04 +00:00
Robert Watson
dc4725135d Attempt to rationalize NFS privileges:
- Replace PRIV_NFSD with PRIV_NFS_DAEMON, add PRIV_NFS_LOCKD.

- Use PRIV_NFS_DAEMON in the NFS server.

- In the NFS client, move the privilege check from nfslockdans(), which
  occurs every time a write is performed on /dev/nfslock, and instead do it
  in nfslock_open() just once.  This allows us to avoid checking the saved
  uid for root, and just use the effective on open.  Use PRIV_NFS_LOCKD.
2007-04-21 18:11:19 +00:00
Stephan Uphoff
31b4f4a916 Modify TLB invalidation handling.
Reviewed by:	alc@, peter@
MFC after:	1 week
2007-04-21 14:17:30 +00:00
Pawel Jakub Dawidek
9de81c7273 MFp4:
@118370	Correct typo.

@118371	Integrate changes from vendor.

@118491	Show backtrace on unexpected code paths.

@118494	Integrate changes from vendor.

@118504	Fix sendfile(2). I had two ways of fixing it:
	1. Fixing sendfile(2) itself to use VOP_GETPAGES() instead of
	   hacking around with vn_rdwr(UIO_NOCOPY), which was suggested
	   by ups.
	2. Modify ZFS behaviour to handle this special case.

	Although 1 is more correct, I've choosen 2, because hack from 1
	have a side-effect of beeing faster - it reads ahead MAXBSIZE
	bytes instead of reading page by page. This is not easy to implement
	with VOP_GETPAGES(), at least not for me in this very moment.

	Reported by:	Andrey V. Elsukov <bu7cher@yandex.ru>

@118525	Reorganize the code to reduce diff.

@118526	This code path is expected. It is simply when file is opened with
	O_FSYNC flag.

	Reported by:	kris
	Reported by:	Michal Suszko <dry@dry.pl>
2007-04-21 12:02:57 +00:00
Stephane E. Potvin
0e5179e441 Add support for specifying a minimal size for vm.kmem_size in the loader via
vm.kmem_size_min. Useful when using ZFS to make sure that vm.kmem size will
be at least 256mb (for example) without forcing a particular value via vm.kmem_size.

Approved by: njl (mentor)
Reviewed by: alc
2007-04-21 01:14:48 +00:00
Pawel Jakub Dawidek
eed20b37f5 Don't reinvent vm_page_grab().
Reviewed by:	ups
2007-04-20 19:49:20 +00:00
Andre Oppermann
df47e4377b o Remove unncessary TOF_SIGLEN flag from struct tcpopt
o Correctly set to->to_signature in tcp_dooptions()
o Update comments
2007-04-20 15:28:01 +00:00
Andre Oppermann
7824d002c0 Add more KASSERT's. 2007-04-20 15:21:29 +00:00
Andre Oppermann
0d957bba48 o Remove unused and redundant TCP option definitions
o Replace usage of MAX_TCPOPTLEN with the correctly constructed and
  derived MAX_TCPOPTLEN
2007-04-20 15:08:09 +00:00
Andre Oppermann
4d6e713043 Remove bogus check for accept queue length and associated failure handling
from the incoming SYN handling section of tcp_input().

Enforcement of the accept queue limits is done by sonewconn() after the
3WHS is completed.  It is not necessary to have an earlier check before a
connection request enters the SYN cache awaiting the full handshake.  It
rather limits the effectiveness of the syncache by preventing legit and
illegit connections from entering it and having them shaken out before we
hit the real limit which may have vanished by then.

Change return value of syncache_add() to void.  No status communication
is required.
2007-04-20 14:34:54 +00:00
Andre Oppermann
e207f80039 Simplifly syncache_expand() and clarify its semantics. Zero is returned
when the ACK is invalid and doesn't belong to any registered connection,
either in syncache or through SYN cookies.  True but a NULL struct socket
is returned when the 3WHS completed but the socket could not be created
due to insufficient resources or limits reached.

For both cases an RST is sent back in tcp_input().

A logic error leading to a panic is fixed where syncache_expand() would
free the mbuf on socket allocation failure but tcp_input() later supplies
it to tcp_dropwithreset() to issue a RST to the peer.

Reported by:	kris (the panic)
2007-04-20 13:51:34 +00:00
Andre Oppermann
0a5df51410 Only update TCP timestamp on SYN duplication if it is present on
current SYN in syncache_add().  Otherwise disable timestamps.
2007-04-20 13:36:48 +00:00
Andre Oppermann
c73f70b728 o Plug memory leak in syncache_add() on MAC label allocation failure.
o Simplify code flow with 'done' goto label.
o Remove mbuf argument from syncache_respond().  It doesn't make use
  of it.
2007-04-20 13:30:08 +00:00
Alexander Motin
e07c5170e1 Added m_tag_copy_chain() call to copy original outgoing packet tags to all of
it's fragments.

Reviewed by:	archie
Approved by:	glebius (mentor)
2007-04-20 08:44:40 +00:00