Commit Graph

73562 Commits

Author SHA1 Message Date
Robert Noland
5880b860f8 Hold the lock while we save/restore register for suspend/resume.
MFC after:	3 days
2009-06-23 17:38:28 +00:00
Bjoern A. Zeeb
5736e6fb9d After cleaning up rt_tables from vnet.h and cleaning up opt_route.h
a lot of files no longer need route.h either. Garbage collect them.
While here remove now unneeded vnet.h #includes as well.
2009-06-23 17:03:45 +00:00
Rui Paulo
07bed1516d Fix build with ACPI_DEBUG.
MFC after:	2 weeks
2009-06-23 15:08:03 +00:00
Bjoern A. Zeeb
0c88be0499 In r194702 I meant to remove vnet.h which is no longer needed, not route.h. 2009-06-23 14:54:42 +00:00
Jamie Gritton
399645e1b9 Remove unnecessary/redundant includes.
Approved by:	bz (mentor)
2009-06-23 14:39:21 +00:00
Coleman Kane
7c1a5c7c93 Code cleanup by moving some repetitive code into an ndis_get_bssid_list
helper function. Also, add ieee80211_announce() call for bootverbose case.

Submitted by:	Paul B. Mahol <onemda@gmail.com>
2009-06-23 14:37:07 +00:00
Bjoern A. Zeeb
14a20db534 in6_rtqdrain() has been unused. Cleanup.
As this was the only consumer of net/route.h left remove that as well.
2009-06-23 13:22:19 +00:00
Rui Paulo
df849145b5 * Driver for ACPI WMI (Windows Management Instrumentation)
* Driver for ACPI HP extra functionations, which required
  ACPI WMI driver.

Submitted by:	Michael <freebsdusb at bindone.de>
Approved by:	re
MFC after:	2 weeks
2009-06-23 13:17:25 +00:00
Bjoern A. Zeeb
a877d0cffa Remove duplicate #include <net/route.h> from the middle of the file. 2009-06-23 13:16:16 +00:00
Alexander Motin
c1b8a9edab Mark ng_ether node hooks as HI_STACK. It is usually the last point when
netgraph may unroll the call stack, and I have found that in some cases 2K
guarantied there for i386 may be not enough for NIC driver and BPF.
2009-06-23 12:30:21 +00:00
Peter Holm
401679debe vn_open_cred() needs a non NULL ucred pointer
Reviewed by:	kib
2009-06-23 11:29:54 +00:00
Roman Divacky
03cd51df00 Fix what seems to be an obvious typo preventing the body of the
if statement to ever be executed.

Approved by:	ed (mentor)
2009-06-23 09:02:24 +00:00
Jeff Roberson
c8eb786c8d - Add a new cpuset macro, CPU_FILL(), for setting the set to all 1s. 2009-06-23 06:57:46 +00:00
Marko Zec
991633af2e Connect ng_pipe to the default build.
Approved by:	julian (mentor)
2009-06-23 06:11:04 +00:00
Andrew Thompson
8f9e0ef947 Fix a typeo in the frame len function to unbreak the build, make it shorter
while I am here.
2009-06-23 06:00:31 +00:00
Nathan Whitehorn
1016f143f0 Add cpufreq support on the PowerPC G5, along with a skeleton SMU driver
in order to slew CPU voltage during frequency changes. The OpenBSD SMU
driver was an extremely helpful reference for this.
2009-06-23 04:28:32 +00:00
Nathan Whitehorn
7f0ad28f28 Fix copy/paste typo in last revision. PMC0 control should be shifted 8
bits, not 6, on the PPC 970.
2009-06-23 04:02:36 +00:00
Andrew Thompson
ed6d949afd - Make struct usb_xfer opaque so that drivers can not access the internals
- Reduce the number of headers needed for a usb driver, the common case is just   usb.h and usbdi.h
2009-06-23 02:19:59 +00:00
Ken Smith
8112ca35f7 Describe the new algorithm for handling __FreeBSD_version, specifically
the 'R' value now being allowed to take on more values than 0 or 1 and
permitting more than 100 version bumps in pre-release branches.
2009-06-23 01:03:09 +00:00
Sam Leffler
3616874919 kill left over cruft 2009-06-22 23:22:38 +00:00
Andre Oppermann
ef760e6ad2 Add soreceive_stream(), an optimized version of soreceive() for
stream (TCP) sockets.

It is functionally identical to generic soreceive() but has a
number stream specific optimizations:
o does only one sockbuf unlock/lock per receive independent of
  the length of data to be moved into the uio compared to
  soreceive() which unlocks/locks per *mbuf*.
o uses m_mbuftouio() instead of its own copy(out) variant.
o much more compact code flow as a large number of special
  cases is removed.
o much improved reability.

It offers significantly reduced CPU usage and lock contention
when receiving fast TCP streams.  Additional gains are obtained
when the receiving application is using SO_RCVLOWAT to batch up
some data before a read (and wakeup) is done.

This function was written by "reverse engineering" and is not
just a stripped down variant of soreceive().

It is not yet enabled by default on TCP sockets.  Instead it is
commented out in the protocol initialization in tcp_usrreq.c
until more widespread testing has been done.

Testers, especially with 10GigE gear, are welcome.

MFP4:	r164817 //depot/user/andre/soreceive_stream/
2009-06-22 23:08:05 +00:00
Sam Leffler
412501cdfd enable optional GPS+RS485 uarts 2009-06-22 22:54:44 +00:00
Sam Leffler
982cb04f16 o add a bus space tag that forces a 2usec delay between r/w ops; this is
used for the optional GPS+RS485 uarts on the Gateworks Cambria boards
  which otherwise are unreliable
o setup the hack bus space tag for the GPS+RS485 uarts
o program the gpio interrupts for the uarts to be edge-rising
o force timing on the expansion bus for the uarts to be "slow"

Thanks to Chris Lang of Gateworks for these tips.
2009-06-22 22:54:13 +00:00
Sam Leffler
cb206d66bf fix typo 2009-06-22 22:47:06 +00:00
Sam Leffler
a34dbf45de o remove hack to write UUE+RTOIE in the uart's IER; force them with hints
o honor hints for the rclk
2009-06-22 22:46:37 +00:00
Andre Oppermann
bc05b2f6fa Add m_mbuftouio() helper function to copy(out) an arbitrary
long mbuf chain into an arbitrary large uio in a single step.
It is a functional mirror image of m_uiotombuf().

This function is supposed to be used instead of hand rolled code
with the same purpose and to concentrate it into one place for
potential further optimization or hardware assistance.
2009-06-22 22:20:38 +00:00
Xin LI
0622974ab2 done method is supposed to return int. 2009-06-22 22:09:18 +00:00
Andre Oppermann
4ad1c464fe In sbappendstream_locked() demote all incoming packet mbufs (and
chains) to pure data mbufs using m_demote().  This removes the
packet header and all m_tag information as they are not meaningful
anymore on a stream socket where mbufs are linked through m->m_next.
Strictly speaking a packet header can be only ever valid on the first
mbuf in an m_next chain.

sbcompress() was doing this already when the mbuf chain layout lent
itself to it (e.g. header splitting or merge-append), just not
consistently.

This frees resources at socket buffer append time instead of at
sbdrop_internal() time after data has been read from the socket.

For MAC the per packet information has done its duty and during
socket buffer appending the policy of the socket itself takes over.
With the append the packet boundaries disappear naturally and with
it any context that was based on it.  None of the residual information
from mbuf headers in the socket buffer on stream sockets was looked at.
2009-06-22 21:46:40 +00:00
Navdeep Parhar
16daf36814 Fix cxgb's ifmedia ioctl handling. Also fixed a comment.
Reviewed by:	kmacy
Approved by:	gnn (mentor)
2009-06-22 21:42:57 +00:00
Marko Zec
fa057b15bd V_irtualize flowtable state.
This change should make options VIMAGE kernel builds usable again,
to some extent at least.

Note that the size of struct vnet_inet has changed, though in
accordance with one-bump-per-day policy we didn't update the
__FreeBSD_version number, given that it has already been touched
by r194640 a few hours ago.
Reviewed by:	bz
Approved by:	julian (mentor)
2009-06-22 21:19:24 +00:00
Andrew Thompson
599ce1c3ba Fix length check for ugen control transfer.
Submitted by:	Sylvestre Gallon, HPS
2009-06-22 21:09:52 +00:00
Sam Leffler
c1919f47a1 hook arm_post_filter to ACK GPIO interrupts; this fixes the interrupt
storm observed on the GPS+RS485 uarts on Gateworks Cambria boards

Reviewed by:	cognet
2009-06-22 20:57:51 +00:00
Sam Leffler
dbae7bff65 always define Cambria GPS+RS485 mappings as they are no longer conditional 2009-06-22 20:42:28 +00:00
Sam Leffler
55ca456dcd map the optional GPS and RS485 uart's on the Gateworks Cambria board
(may want to make these conditional)
2009-06-22 20:41:02 +00:00
Sam Leffler
a8c053089c add ixp425_set_gpio to program the gpio interrupt type 2009-06-22 20:38:55 +00:00
Sam Leffler
ad0be1f829 rewrite arm_get_next_irq to always make forward progress (should be optimized) 2009-06-22 20:36:22 +00:00
Sam Leffler
73c424b8cb kill stray whitespace 2009-06-22 20:34:50 +00:00
Sam Leffler
9b3a6692c8 move logic to ACK a GPIO to a separate function 2009-06-22 20:33:59 +00:00
Sam Leffler
a47a6c96f2 swap order in ddb show gpio printf 2009-06-22 20:31:06 +00:00
Sam Leffler
e311b18967 make type use consistent 2009-06-22 20:30:02 +00:00
John Baldwin
e47a833f38 Regen. 2009-06-22 20:24:03 +00:00
John Baldwin
773fa740c9 Include definitions for the audit identifiers for compat system calls in
sysproto.h.  This makes it possible to use SYSCALL_MODULE() for compat
system calls that live in kernel modules.
2009-06-22 20:14:10 +00:00
John Baldwin
0b0fe06a5e Fix a typo in a comment. 2009-06-22 20:12:40 +00:00
John Baldwin
d456f534c9 Enable MSI in the MSI capability registers any time that the first message
in an MSI group is enabled, not just if the address/data pair are not
initialized.

Reported by:	rnoland
MFC after:	1 week
2009-06-22 20:08:06 +00:00
Andre Oppermann
0cb6db1d21 Update m_demote:
- remove HT_HEADER test (MT_HEADER == MT_DATA for some time now)
- be more pedantic about m_nextpkt in other than first mbuf
- update m_flags to be retained
2009-06-22 19:35:39 +00:00
Alan Cox
ce1b857f33 Validate the page in one place, dev_pager_getpages(), rather than doing it
in two places, dev_pager_getfake() and dev_pager_updatefake().

Compare a pointer to "NULL" rather than "0".
2009-06-22 19:09:48 +00:00
Bjoern A. Zeeb
3952a5abc9 Updates after r194640:
- shrink size guards for vnet_net.
  vnet_rtable does not need size guards as it is self-contained.
- remove a bunch of defines from vnet.h no longer valid.
2009-06-22 17:56:07 +00:00
Bjoern A. Zeeb
b58ea5f310 Move virtualization of routing related variables into their own
Vimage module, which had been there already but now is stateful.

All variables are now file local; so this further limits the global
spreading of routing related things throughout the kernel.

Add a missing function local variable in case of MPATHing.

Reviewed by:	zec
2009-06-22 17:48:16 +00:00
Jung-uk Kim
435f8ce5b8 Add a missing return in NULL mutex case.
Submitted by:	Pawel Worach (pawel dot worach at gmail dot com)
2009-06-22 17:46:55 +00:00
Xin LI
6ac937c89c Split tolower/toupper code from usual xlat16 kiconv table, and make it
possible to do tolower/toupper independently without code conversion.

Submitted by:	imura (but bugs are mine)
Obtained from:	http://people.freebsd.org/~imura/kiconv/
		(1_kiconv_wctype_kern.diff, 1_kiconv_wctype_user.diff)
2009-06-22 17:09:46 +00:00
Rafal Jaworowski
400b1bbfe8 Bump PowerPC loader(8) version to reflect extensions it has recently grown. 2009-06-22 15:57:12 +00:00
Rafal Jaworowski
f2396192d9 Keep file list sorted. 2009-06-22 15:53:41 +00:00
Rafal Jaworowski
f07ef6e4e3 DS1553 RTC module driver. On the MPC8555CDS system it hangs off of the LBC bus.
Obtained from:	Semihalf
2009-06-22 15:48:47 +00:00
Rafal Jaworowski
757cb6dbdf Integrated I2C controller driver (found in MPC85xx and other SOC parts).
Obtained from:	Freescale, Semihalf
2009-06-22 15:34:32 +00:00
Bjoern A. Zeeb
f987f19301 Collect all VIMAGE_GLOBALS variables in one place.
No longer export rt_tables as all lookups go through
rt_tables_get_rnh().

We cannot make rt_tables (and rtstat, rttrash[1]) static as
netstat -r (-rs[1]) would stop working on a stripped
VIMAGE_GLOBALS kernel.

Reviewed by:		zec
Presumably broken by:	phk 13.5y ago in r12820 [1]
2009-06-22 15:07:12 +00:00
Scott Long
571e8e20da Change cam_periph_ioctl() to take 'cmd' and a u_long instead of an
int.  All of its callers pass in cmd as a u_long, so this has
always been a dangerous type demotion.  It was spooted by clang/llvm
trying to do a type promotion and sign extension within
cam_periph_ioctl.

Submitted by:	rdivacky
2009-06-22 14:43:48 +00:00
Robert Watson
8896f83a58 Add a new function, ifa_ifwithaddr_check(), which rather than returning
a pointer to an ifaddr matching the passed socket address, returns a
boolean indicating whether one was present.  In the (near) future,
ifa_ifwithaddr() will return a referenced ifaddr rather than a raw
ifaddr pointer, and the new wrapper will allow callers that care only
about the boolean condition to avoid having to free that reference.

MFC after:	3 weeks
2009-06-22 10:59:34 +00:00
Bjoern A. Zeeb
bed56bb51b After the update to fxp(4) in r194573 we should no longer need
this DELAY(100) hack introduced in r56938.

Thanks to:	yongari
MFC after:	6 weeks
X-MFC note:	not before the fxp(4) changes
2009-06-22 10:27:20 +00:00
Robert Watson
cc18b1dbf0 Add a global rwlock, at_ifaddr_rw, to protect the global netatalk
address lists, at_ifaddr_list.  Acquire the lock, and use ifaddr
refcounts where necessary, to close most known address-related
races in netatalk.

Annotate one potential race in at_control() where we acquire an
ifaddr reference, drop the global lock, and scrub the address from
the ifnet before re-acquiring the global lock, which could allow
for a writer-writer race.

MFC after:	3 weeks
2009-06-22 10:23:54 +00:00
Konstantin Belousov
8af8ad6811 Move definitions of AT_* constants from the middle of the open(2) flags
enumeration.

Noted by:	bde
2009-06-22 10:11:35 +00:00
Konstantin Belousov
a18a95db4a O_NOFOLLOW shall be in flags, not in cmode.
Noted by:	bde
2009-06-22 10:08:48 +00:00
Bjoern A. Zeeb
173de0f9cc Remove a hack from r186086 so that IPsec via loopback routes continued
working. It was targeted for stable/7 compatibility and actually never
did anything in HEAD.

Reminded by:	rwatson
X-MFC after:	never
2009-06-22 09:24:46 +00:00
Alan Cox
0f6766f3da Eliminate dead code. These definitions should have been deleted with the
introduction of i686_mem.c in r45405.

Merge adjacent #ifdef _KERNEL/#endif blocks.
2009-06-22 04:21:02 +00:00
Robert Watson
5bf423734c Add ipx_ifaddr locking to ipx_control(), which should close most
remaining potential races in ifconfig's management of IPX addresses.

This is largely accomplished by dropping a global write lock for the
IPX address list over the body of in_control(), although there are
some places we bump the refcount on an ifaddr of interest while
calling out to the routing code or link layer code, which might
require revisiting.

Annotate one as a potential race if two simultaneous delete ioctls
are issued for the same IPX addresses at once.

MFC after:	3 weeks
2009-06-21 21:42:29 +00:00
Olivier Houchard
4943d6b39d Disable write-back until I figure out what's wrong with it on the i81342.
There's no need to disable the MMU once we're done inflating the kernel.
2009-06-21 21:38:12 +00:00
Robert Watson
a0afe699ba Introduce basic locking of global IPX address list 'ipx_ifaddr' using
a new rwlock, ipx_ifaddr_rw, wrapped with macros.  This locking is
necessary but not sufficient, in isolation, to satisfy the stability
requirements of a fully parallel IPX input path during interface
reconfiguration.

MFC after:	3 weeks
2009-06-21 21:04:12 +00:00
Alan Cox
ef327c3ee7 Implement a mechanism within vm_phys_alloc_contig() to defer all necessary
calls to vdrop() until after the free page queues lock is released.  This
eliminates repeatedly releasing and reacquiring the free page queues lock
each time the last cached page is reclaimed from a vnode-backed object.
2009-06-21 20:29:14 +00:00
Robert Watson
046d6c762f In ipx_control(), lock if_addr_mtx when adding/removing addresses from
interface address lists, and don't add an address until it's fully
initialized.

MFC after:	3 weeks
2009-06-21 20:08:07 +00:00
Robert Watson
1099f828b3 Clean up common ifaddr management:
- Unify reference count and lock initialization in a single function,
  ifa_init().
- Move tear-down from a macro (IFAFREE) to a function ifa_free().
- Move reference count bump from a macro (IFAREF) to a function ifa_ref().
- Instead of using a u_int protected by a mutex to refcount(9) for
  reference count management.

The ifa_mtx is now used for exactly one ioctl, and possibly should be
removed.

MFC after:	3 weeks
2009-06-21 19:30:33 +00:00
Konstantin Belousov
c808c9632d Add explicit struct ucred * argument for VOP_VPTOCNP, to be used by
vn_open_cred in default implementation. Valid struct ucred is needed for
audit and MAC, and curthread credentials may be wrong.

This further requires modifying the interface of vn_fullpath(9), but it
is out of scope of this change.

Reviewed by:	rwatson
2009-06-21 19:21:01 +00:00
Sam Leffler
04ddfac339 add %b formats for various registers 2009-06-21 19:17:22 +00:00
Robert Watson
d79ff9980a Minor style cleanups.
MFC after:	3 days
2009-06-21 16:56:49 +00:00
Robert Watson
172aef7c6b Remove unuxed ipx_zerohost.
MFC after:	3 days
2009-06-21 16:11:40 +00:00
Robert Watson
e498ea5b74 Update copyright on netipx. 2009-06-21 16:11:26 +00:00
Konstantin Belousov
e0c161b89c Add another flags argument to vn_open_cred. Use it to specify that some
vn_open_cred invocations shall not audit namei path.

In particular, specify VN_OPEN_NOAUDIT for dotdot lookup performed by
default implementation of vop_vptocnp, and for the open done for core
file. vn_fullpath is called from the audit code, and vn_open there need
to disable audit to avoid infinite recursion. Core file is created on
return to user mode, that, in particular, happens during syscall return.
The creation of the core file is audited by direct calls, and we do not
want to overwrite audit information for syscall.

Reported, reviewed and tested by: rwatson
2009-06-21 13:41:32 +00:00
Remko Lodder
b24516038c use PROTO_DEFAULT.
Requested by:	hps
2009-06-21 13:13:13 +00:00
Remko Lodder
2088cbe832 Add support for the Myson Heden 8813.
Note that I also added the usbdev to the list, because the 8813 version
is not yet known there. I might have twisted the sorting there but because
8813 comes before 8818, I added it before that (with _8813 to differentiate)
the item.

PR:		135628
Submitted by:	Yoshikazu GOTO <goto at on-link dot jp>
Approved by:	imp (mentor, implicit)
2009-06-21 11:21:16 +00:00
Roman Divacky
e40bae9a45 Switch cmd argument to u_long. This matches what if_ethersubr.c does and
allows the code to compile cleanly on amd64 with clang.

Reviewed by:	rwatson
Approved by:	ed (mentor)
2009-06-21 10:29:31 +00:00
Robert Watson
941c2e1cd1 Remove historical support for capturing IPX packets in the output path
using raw IPX sockets.  While functional, this support is disabled
using a flag that can't be changed from userspace, and google reveals
no documentation or use of that flag anywhere.  This eliminates a
potential lock order reversal and code reentrance issue in which the
output path reentered the input path in IPX.

An alternative to removal would be to use the netisr, as a comment I
added in 2005 suggests.  While this change is fairly straight-forward,
the lack of any consumers or the easy possibility of consumers (kernel
modification and recompile required) suggests that this is simply an
unused feature.

Update README to remove this TODO, and a TODO regarding IPX/IP
encapsulation which was also removed a few years ago.

MFC after:	1 week
2009-06-21 10:10:44 +00:00
Roman Divacky
20a0556c59 In non-debugging mode make this define (void)0 instead of nothing. This
helps to catch bugs like the below with clang.

	if (cond);		<--- note the trailing ;
	   something();

Approved by:	ed (mentor)
Discussed on:	current@
2009-06-21 09:01:12 +00:00
Roman Divacky
2b7d10c225 In non-debugging mode make this define (void)0 instead of nothing. This
helps to catch bugs like the below with clang.

	if (cond);		<--- note the trailing ;
	   something();

Approved by:	ed (mentor)
Discussed on:	current@
2009-06-21 08:49:06 +00:00
Roman Divacky
23057f089b In non-debugging mode make this define (void)0 instead of nothing. This
helps to catch bugs like the below with clang.

	if (cond);		<--- note the trailing ;
	   something();

Approved by:	ed (mentor)
Discussed on:	current@
2009-06-21 08:36:30 +00:00
Roman Divacky
f7490cfe01 In non-debugging mode make this define (void)0 instead of nothing. This
helps to catch bugs like the below with clang.

	if (cond);		<--- note the trailing ;
	   something();

Approved by:	ed (mentor)
Discussed on:	current@
2009-06-21 07:54:47 +00:00
Pyun YongHyeon
b96ad4b205 For ICH based fxp(4) controllers treat them as 82559 compatibles.
To detect which controller is ICH based one, add a new member
variable ich to struct fxp_ident and move the struct to
if_fxpvar.h. Since I've faked controller revision, don't allow
microcode loading for ICH based controllers.
With this change all ICH based controllers will have WOL and Rx
checksum offload capability.

PR:		kern/135451
Tested by:	Alexey Shuvaev ( shuvaev <> physik dot uni-wuerzburg dot de ),
		pluknet ( pluknet <> gmail dot com ),
		Gary Jennejohn ( gary.jennejohn <> freenet dot de )
2009-06-21 07:34:12 +00:00
Pyun YongHyeon
6b24912cd9 Overhaul fxp(4) multicast filter programming. fxp(4) hardwares do
not allow multicast filter programming when controller is busy to
send/receive frames. So it used to mark need_mcsetup bit and defer
multicast filter programming until controller becomes idle state.
To detect when the controller is idle fxp(4) relied on Tx
completion interrupt with NOP command and fxp_start_body and
fxp_intr_body had to see whether pending multicast filter
programming was requested. This resulted in very complex logic and
sometimes it did not work as expected.
Since the controller should be in idle state before any multicast
filter modifications I changed it to reinitialize the controller
whenever multicast filter programming is required. This is the same
way what OpenBSD and NetBSD does. Also I added IFF_DRV_RUNNING
check in ioctl handler so controller would be reinitialized only if
it is absolutely needed.
With this change I guess we can remove fxp(4) DELAY hack in ifioctl
for IPv6 case.
2009-06-21 07:17:49 +00:00
Pyun YongHyeon
c109e385f6 Always check fxp(4) is running, see if it can accept frames from
upper stack in fxp_start_body().
fxp(4) drops driver lock in Rx path so check the fxp(4) is still
running after reacquiring driver lock in Rx path. Also don't
invoke fxp_intr_body if fxp(4) is not running. With this change
there is no need to set suspend bit in device attach phase.
2009-06-21 06:46:32 +00:00
Pyun YongHyeon
43d8b117e4 Don't blindly enable Rx lock-up workaround. Newer chips do not need
the Rx lock-up workaround.

Obtained from:	NetBSD
2009-06-21 06:27:35 +00:00
Pyun YongHyeon
a996f02399 Due to possible PCI bus lock-up issues fxp(4) didn't perform full
hardware reset in attach phase. Selective reset does not clear
configured parameters so I think full hardware reset is required.
To prevent PCI bus lock-up, do selective reset first which will get
off the controller from PCI bus and request software reset after
selective reset. Software reset will unmask interrupts so disable
it after the reset.
2009-06-21 06:18:19 +00:00
Pyun YongHyeon
a2057a72e9 Introduce Rx mbuf dma tag and use it in Rx path. Previously it used
common mbuf dma tag for both Tx and Rx path but Rx buffer should
have single DMA segment and maximum buffer size of the segment
should be less than MCLBYTES.
fxp(4) also have to check Tx completion status which was updated by
DMA so we need BUS_DMASYNC_PREREAD and BUS_DMASYNC_POSTWRITE
synchronization in Tx path. Fix all misuse of bus_dmamap_sync(9) in
fxp(4). I guess this change shall fix occasional driver breakage in
PAE environments.

While I'm here add error messages of dma tag/buffer creation and
correct messages.
2009-06-21 06:06:43 +00:00
Kip Macy
e321e16bfb fix !x86 cxgb compile 2009-06-21 01:17:38 +00:00
Alan Cox
6f0489c670 Strive for greater consistency among the places that implement real,
fictious, and contiguous page allocation.  Eliminate unnecessary
reinitialization of a page's fields.
2009-06-21 00:21:33 +00:00
Robert Watson
c0a8cee371 Implement socket delivery MAC checks for IPX/SPX.
Obtained from:	TrustedBSD Project
MFC after:	3 days
2009-06-20 23:38:21 +00:00
Brooks Davis
7f92e57820 Change crsetgroups_locked() (called by crsetgroups()) to sort the
supplemental groups using insertion sort.  Use this property in
groupmember() to let us use a binary search instead of the previous
linear search.
2009-06-20 20:29:21 +00:00
Kip Macy
8b6dccee61 fix typo in conditional 2009-06-20 19:09:41 +00:00
Kip Macy
75417d6de3 - fix dma map handling for !x86 case
- fix allocation failure handing in refill_fl
2009-06-20 18:57:14 +00:00
Brooks Davis
87ecedf4f8 Use NGROUPS instead of NGROUPS_MAX as the limits on setgroups and
getgroups for ibcs emulation.  It seems vanishingly likely any
programs will actually be affected since they probably assume a much
lower value and use a static array size.
2009-06-20 18:52:02 +00:00
Robert Watson
395262b517 Remove definition of dtom(), which converted a data pointer into a
pointer to the containing mbuf.  This eliminates a strong assumption
about the layout of network buffer memory, giving us greater
flexibility to revise mbuf semantics in the future.
2009-06-20 18:27:19 +00:00
Robert Watson
c28aedefd8 Rework SPX segment reassembly, which was originally based on our TCP
reassembly but failed to be modernized over time:

- Use queue(9).
- Specifically allocate queue entries of type M_SPXREASSQ to point at
  member mbufs, rather than casting mbuf data to 'spx_q'.
- Maintain the mbuf pointer as part of the queue entry so that we can
  later free the mbuf without using dtom().
2009-06-20 18:24:25 +00:00
Robert Watson
11dd0af11d Invoke the MAC Framework's mac_socket_create_mbuf() entry point when
generating IPX output for SPX sockets.

Obtained from:	TrustedBSD Project
2009-06-20 17:44:04 +00:00
Robert Watson
3b9fec2ed0 Invoke the MAC Framework's mac_socket_create_mbuf() entry point when
generating IPX output for raw and datagram IPX sockets.

Obtained from:	TrustedBSD Project
2009-06-20 17:42:53 +00:00
Robert Watson
4211da4eb6 Don't lock sockets around calls to mac_socket_create_mbuf() -- policies
are now expected to acquire the socket lock if they require them.

Obtained from:	TrustedBSD Project
2009-06-20 17:28:38 +00:00
Rick Macklem
73c8b6d377 Delete the declaration of an unused variable so that it will build.
Approved by:	rwatson (mentor)
2009-06-20 17:16:29 +00:00
Rick Macklem
65cc6600c5 Replace RPCAUTH_UNIXGIDS with NFS_MAXGRPS so that nfscbd.c will build.
Approved by:	kib (mentor)
2009-06-20 17:11:07 +00:00
Robert Noland
e23637d17b The G45 docs indicate that all G4X chips use the new framecount register.
Intel agrees with my reading of the docs, make it so for all G4X chips.

The new register also has a 32 bit width as opposed to 24 bits.  Fix
things up so that the counters roll over properly.

MFC after:	3 days
2009-06-20 16:45:14 +00:00
Robert Noland
e8ca7a9956 realloc() behaves identically to malloc when passed a NULL object pointer
If an error does occur we would have left max_context with an incorrect
value.

MFC after:	3 days
2009-06-20 16:40:48 +00:00
Ed Schouten
148747c2b7 Add placeholder to prevent reuse of privilege 254.
Requested by:	rwatson
2009-06-20 16:39:25 +00:00
Robert Noland
4949d88192 Don't panic if drm_rmmap is called with a NULL map pointer.
MFC after:	3 days
2009-06-20 16:37:24 +00:00
Ed Schouten
fbbbf5d135 Chase the removal of PRIV_TTY_PRISON in the mac(9) modules.
Reported by:	kib
Pointy hat to:	me
2009-06-20 15:54:35 +00:00
Ed Schouten
f8f6146082 Improve nested jail awareness of devfs by handling credentials.
Now that we start to use credentials on character devices more often
(because of MPSAFE TTY), move the prison-checks that are in place in the
TTY code into devfs.

Instead of strictly comparing the prisons, use the more common
prison_check() function to compare credentials. This means that
pseudo-terminals are only visible in devfs by processes within the same
jail and parent jails.

Even though regular users in parent jails can now interact with
pseudo-terminals from child jails, this seems to be the right approach.
These processes are also capable of interacting with the jailed
processes anyway, through signals for example.

Reviewed by:	kib, rwatson (older version)
2009-06-20 14:50:32 +00:00
Marcel Moolenaar
a1b6466f8f Drop the high FP state of an exiting thread in cpu_thread_exit() and
not in cpu_exit(). The latter is called after td_md.md_highfp_mtx
has been destroyed, which results in a race condition when another
thread wants to use the high FP registers on the CPU that still has
the high FP registers in question.
2009-06-20 05:36:53 +00:00
Rick Macklem
2c1e6cce5b Change the size of the nfsc_groups[] array in the experimental nfs
client to RPCAUTH_UNIXGIDS + 1 (17), since that is what can go on
the wire for AUTH_SYS authentication.

Reviewed by:	brooks
Approved by:	kib (mentor)
2009-06-20 00:54:57 +00:00
Navdeep Parhar
045de71424 Make puc(4) aware of this 2 port serial card based on NetMos 9835:
puc0@pci0:4:1:0:       class=0x070002 card=0x00021000 chip=0x98359710 rev=0x01 hdr=0x00

Reviewed by:	marcel@
Approved by:	gnn (mentor)
2009-06-20 00:04:48 +00:00
Kip Macy
3f345a5d09 Greatly simplify cxgb by removing almost all of the custom mbuf management logic
- remove mbuf iovec - useful, but adds too much complexity when isolated to
   the driver

- remove driver private caching - insufficient benefit over UMA to justify
  the added complexity and maintenance overhead

- remove separate logic for managing multiple transmit queues, with the
  new drbr routines the control flow can be made to much more closely resemble
  legacy drivers

- remove dedicated service threads, with per-cpu callouts one can get the same
  benefit much more simply by registering a callout 1 tick in the future if there
  are still buffered packets

- remove embedded mbuf usage - Jeffr's changes will (I hope) soon be integrated
  greatly reducing the overhead of using kernel APIs for reference counting
  clusters

- add hysteresis to descriptor coalescing logic

- add coalesce threshold sysctls to allow users to decide at run-time
  between optimizing for forwarding / UDP or optimizing for TCP

- add once per second watchdog to effectively close the very rare races
  occurring from coalescing

- incorporate Navdeep's changes to the initialization path required to
  convert port and adapter locks back to ordinary mutexes (silencing BPF
  LOR complaints)

- enable prefetches in get_packet and tx cleaning

Reviewed by:	navdeep@
MFC after:	2 weeks
2009-06-19 23:34:32 +00:00
Kip Macy
d49cd9a18e add helper function for flushing software queues 2009-06-19 23:11:20 +00:00
Kip Macy
5b204a113c define helper routines for deferred mbuf initialization 2009-06-19 21:14:39 +00:00
Bjoern A. Zeeb
57700c9e4d Move setting of ports from NAT-T below key_getsah() and actually
below key_setsaval().
Without that, the lookup for the SA had failed as we were looking for
a SA with the new, updated port numbers instead of the old ones and
were comparing the ports in key_cmpsaidx().
This makes updating the remote -> local SA on the initiator work again.

Problem introduced with:	p4 changeset 152114
2009-06-19 21:01:55 +00:00
Christian S.J. Peron
0e37f3e196 Implement the -z (zero counters) option for the various bpf counters.
Add necessary changes to the kernel for this (basically introduce a
bpf_zero_counters() function).  As well, update the man page.

MFC after:	1 month
Discussed with:	rwatson
2009-06-19 20:31:44 +00:00
Brooks Davis
838d985825 Rework the credential code to support larger values of NGROUPS and
NGROUPS_MAX, eliminate ABI dependencies on them, and raise the to 1024
and 1023 respectively.  (Previously they were equal, but under a close
reading of POSIX, NGROUPS_MAX was defined to be too large by 1 since it
is the number of supplemental groups, not total number of groups.)

The bulk of the change consists of converting the struct ucred member
cr_groups from a static array to a pointer.  Do the equivalent in
kinfo_proc.

Introduce new interfaces crcopysafe() and crsetgroups() for duplicating
a process credential before modifying it and for setting group lists
respectively.  Both interfaces take care for the details of allocating
groups array. crsetgroups() takes care of truncating the group list
to the current maximum (NGROUPS) if necessary.  In the future,
crsetgroups() may be responsible for insuring invariants such as sorting
the supplemental groups to allow groupmember() to be implemented as a
binary search.

Because we can not change struct xucred without breaking application
ABIs, we leave it alone and introduce a new XU_NGROUPS value which is
always 16 and is to be used or NGRPS as appropriate for things such as
NFS which need to use no more than 16 groups.  When feasible, truncate
the group list rather than generating an error.

Minor changes:
  - Reduce the number of hand rolled versions of groupmember().
  - Do not assign to both cr_gid and cr_groups[0].
  - Modify ipfw to cache ucreds instead of part of their contents since
    they are immutable once referenced by more than one entity.

Submitted by:	Isilon Systems (initial implementation)
X-MFC after:	never
PR:		bin/113398 kern/133867
2009-06-19 17:10:35 +00:00
Rui Paulo
9d0a7bee3b ieee80211_dwds_mcast(): check the correct mbuf ptr after encap. 2009-06-18 21:15:41 +00:00
John Baldwin
afd9f91c63 Fix a deadlock in the getpeername() method for UNIX domain sockets.
Instead of locking the local unp followed by the remote unp, use the same
locking model as accept() and read lock the global link lock followed by
the remote unp while fetching the remote sockaddr.

Reported by:	Mel Flynn  mel.flynn of mailing.thruhere.net
Reviewed by:	rwatson
MFC after:	1 week
2009-06-18 20:56:22 +00:00
Andrew Thompson
f06a3a36ac Track the kernel mapping of a physical page by a new entry in vm_page
structure. When the page is shared, the kernel mapping becomes a special
type of managed page to force the cache off the page mappings. This is
needed to avoid stale entries on all ARM VIVT caches, and VIPT caches
with cache color issue.

Submitted by:	Mark Tinguely
Reviewed by:	alc
Tested by:	Grzegorz Bernacki, thompsa
2009-06-18 20:42:37 +00:00
Alan Cox
c45c00344f Utilize the new function kmem_alloc_contig() to implement the UMA back-end
allocator for the jumbo frames zones.  This change has two benefits: (1) a
custom back-end deallocator is no longer required.  UMA's standard
deallocator suffices. (2) It eliminates a potentially confusing artifact
of using contigmalloc(): The malloc(9) statistics contain bogus information
about the usage of jumbo frames.  Specifically, the malloc(9) statistics
report all jumbo frames in use whereas the UMA zone statistics report the
"truth" about the number in use vs. the number free.
2009-06-18 17:59:04 +00:00
Ivan Voras
63f4d880e0 Fix tabs, slightly improve comments.
Approved by:	gnn (mentor) (original)
Noticed by:	stas
2009-06-18 11:12:11 +00:00
Coleman Kane
d9cacbcf4f Replace use of ic->ic_flags with vap->iv_flags to operate on per-vap flags
for ndis 802.11 work.

Submitted by:	Paul B. Mahol <onemda@gmail.com>
2009-06-18 11:12:10 +00:00
Alan Cox
aea6e893ed Add support for UMA_SLAB_KERNEL to page_free(). (While I'm here remove an
unnecessary newline character from the end of two panic messages.)
2009-06-18 07:27:11 +00:00
Alan Cox
57a7e73261 Fix some of the style errors in *getpages(). 2009-06-18 05:56:24 +00:00
Rick Macklem
76b30a0cd4 Add the SVC_RELEASE(xprt), as required by r194407.
Approved by:	kib (mentor)
2009-06-17 22:55:59 +00:00
Rick Macklem
6b97c9f09a Since svc_[dg|vc|tli|tp]_create() did not hold a reference count on the
SVCXPTR structure returned by them, it was possible for the structure
to be free'd before svc_reg() had been completed using the structure.
This patch acquires a reference count on the newly created structure
that is returned by svc_[dg|vc|tli|tp]_create(). It also
adds the appropriate SVC_RELEASE() calls to the callers, except the
experimental nfs subsystem. The latter will be committed separately.

Submitted by:	dfr
Tested by:	pho
Approved by:	kib (mentor)
2009-06-17 22:50:26 +00:00
Alan Cox
f0553fdbc4 Eliminate unnecessary forward declarations. 2009-06-17 20:12:23 +00:00
John Baldwin
4b7b144f63 Regen. 2009-06-17 19:53:47 +00:00
John Baldwin
7228812fd2 Regen for added flags field. 2009-06-17 19:53:20 +00:00
John Baldwin
21def99b51 - Add the ability to mix multiple flags seperated by pipe ('|') characters
in the type field of system call tables.  Specifically, one can now use
  the 'NO*' types as flags in addition to the 'COMPAT*' types.  For example,
  to tag 'COMPAT*' system calls as living in a KLD via NOSTD.  The COMPAT*
  type is required to be listed first in this case.
- Add new functions 'type()' and 'flag()' to the embedded awk script in
  makesyscalls.sh that return true if a requested flag is found in the
  type field ($3).  The flag() function checks all of the flags in the
  field, but type() only checks the first flag.  type() is meant to be
  used in the top-level "switch" statement and flag() should be used
  otherwise.
- Retire the CPT_NOA type, it is now replaced with "COMPAT|NOARGS" using
  the flags approach.
- Tweak the comment descriptions of COMPAT[46] system calls so that they
  say "freebsd[46] foo" rather than "old foo".
- Document the COMPAT6 type.
- Sync comments in compat32 syscall table with the master table.
2009-06-17 19:50:38 +00:00
Sean Nicholas Barkas
fe1bd0a483 Keep dirhash tailq locked throughout the entirety of ufsdirhash_destroy() to fix
a potential race pointed out by pjd. Also use TAILQ_FOREACH_SAFE to iterate over
dirhashes in ufsdirhash_lowmem(), so that we can continue iterating even after a
dirhash is destroyed.

Suggested by:	pjd
Tested by:      pho
Approved by:	dwmalone (mentor)
2009-06-17 18:55:29 +00:00
John Baldwin
0ec0b41cf6 Remove the now-unused NOIMPL flag. It serves no useful purpose given the
existing UNIMPL and NOSTD types.
2009-06-17 18:46:14 +00:00
John Baldwin
f425839118 - NOSTD results in lkmressys being used instead of lkmssys.
- Mark nfsclnt as UNIMPL.  It should have been NOSTD instead of NOIMPL back
  when it lived in nfsclient.ko, but it was removed from that a long time
  ago.
2009-06-17 18:44:15 +00:00
Sam Leffler
7172b41850 enable npe-a now that it works 2009-06-17 17:58:18 +00:00
Sam Leffler
1f5c3c70bd Add workaround to get IXP435 NPE-A working: reseting NPE-A after NPE-C
causes both to become inoperative; this apparently was done by the original
IAL code as a workaround for IMEM parity errors which we've not seen so
just disable the reset.

Note this problem does not occur on IXP425 boards. The linux driver does
fuse-resets on each NPE but in the order NPE-A < NPE-B < NPE-C (when probing
for which NPE's are present/operational); we may want to switch to a similar
scheme but for now disable the resets until we see an issue.
2009-06-17 17:57:52 +00:00
Alan Cox
d78200e4e8 Refactor contigmalloc() into two functions: a simple front-end that deals
with the malloc tag and calls a new back-end, kmem_alloc_contig(), that
allocates the pages and maps them.

The motivations for this change are two-fold: (1) A cache mode parameter
will be added to kmem_alloc_contig().  In other words, kmem_alloc_contig()
will be extended to support the allocation of memory with caller-specified
caching. (2) The UMA allocation function that is used by the two jumbo
frames zones can use kmem_alloc_contig() in place of contigmalloc() and
thereby avoid having free jumbo frames held by the zone counted as live
malloc()ed memory.
2009-06-17 17:19:48 +00:00
Nathan Whitehorn
30a2bd2f78 Teach cpu_est_clockrate() about the G5's slightly different PMC. This
allows the boot messages to include the CPU speed and makes possible
the forthcoming cpufreq support for the PPC 970.
2009-06-17 16:34:40 +00:00
Bjoern A. Zeeb
ebd8672cc3 Add explicit includes for jail.h to the files that need them and
remove the "hidden" one from vimage.h.
2009-06-17 15:01:01 +00:00
Rick Macklem
81e3c4fc8e Fix handling of ".." in nfs_lookup() for the forced dismount case
by cribbing the change made to the regular nfs client in r194358.

Approved by:	kib (mentor)
2009-06-17 14:10:18 +00:00
Konstantin Belousov
b3c5643a25 For dotdot lookup in nfs_lookup, inline the vn_vget_ino() to prevent
operating on the unmounted mount point and freed mount data in case of
forced unmount performed while dvp is unlocked to nget the target vnode.

Add missed calls to m_freem(mrep) there on error exits [1].

Submitted by:	rmacklem [1]
Tested by:	pho
MFC after:	2 weeks
2009-06-17 12:47:27 +00:00
Bjoern A. Zeeb
7654a365db Add the explicit include of vimage.h to another five .c files still
missing it.

Remove the "hidden" kernel only include of vimage.h from ip_var.h added
with the very first Vimage commit r181803 to avoid further kernel poisoning.
2009-06-17 12:44:11 +00:00
Konstantin Belousov
f02c9d2858 Decrement state->ls_threads when vnode appeared to be doomed.
Reported and tested by:	pho
2009-06-17 12:43:04 +00:00
Randall Stewart
d50c1d79d0 Changes to the NR-Sack code so that:
1) All bit disappears
2) The two sets of gaps (nr and non-nr) are
   disjointed, you don't have gaps struck in
   both places.

This adjusts us to coorespond to the new draft. Still
to-do, cleanup the code so that there are only one set
of sack routines (original NR-Sack done by E cloned all
sack code).
2009-06-17 12:34:56 +00:00
Bjoern A. Zeeb
2aabdeb1f6 Add a .cvsignore file and along with that put an svn:ignore proprty
on the directory like we have for all other target architectures.

Discussed with:	imp (kind of)
2009-06-17 10:48:32 +00:00
Bjoern A. Zeeb
ed34ec5ed8 Make compile again using proper protoypes for
pcib_read/write_config DEVMETHOD.
2009-06-17 10:26:37 +00:00
Bjoern A. Zeeb
23678e67c0 Make compile again using the correct prototype for the
device shutdown method.
2009-06-17 10:23:25 +00:00
Alan Cox
2d59a004af Pass the size of the mapping to contigmapping() as a "vm_size_t" rather
than a "vm_pindex_t".  A "vm_size_t" is more convenient for it to use.
2009-06-17 07:11:38 +00:00
Alan Cox
ead1d027bd Make the maintenance of a page's valid bits by contigmalloc() more like
kmem_alloc() and kmem_malloc().  Specifically, defer the setting of the
page's valid bits until contigmapping() when the mapping is known to be
successful.
2009-06-17 04:57:32 +00:00
Weongyo Jeong
615f88eca6 adds opt_inet6.h to fix a error during compiling wlan as a module.
Reviewed by:	sam
2009-06-17 04:23:37 +00:00
Weongyo Jeong
c39515adc4 reorders the sequence when the device is detached. After detaching the
interface is completed then it'll process other parts to avoid a race
condition.

Pointed by:	jhb
2009-06-17 04:15:19 +00:00
Sam Leffler
5d11bdc651 correct data/instruction memory sizes for non-ixp425 parts (these
are only used to bounds-check writes when loading firmware)
2009-06-17 03:09:13 +00:00
Sam Leffler
8f1fb99bf2 remove IAL vestige for defining the max data/instruction memory size;
instead of defining them according to ixp46x add new defines so we can
do this at run time
2009-06-17 02:55:53 +00:00
Sam Leffler
936f42e880 o correct default miibase for NPE-B and NPE-C; these values are
normally taken from the hints file so this should have no effect
o set the port address "just in case"
o add NPE-A support to the tx done qmgr callback
2009-06-17 02:53:05 +00:00
Sam Leffler
43596ff09d add ixp4xx_write_feature_bits 2009-06-17 02:51:16 +00:00
Attilio Rao
651175c9db Introduce support for adaptive spinning in lockmgr.
Actually, as it did receive few tuning, the support is disabled by
default, but it can opt-in with the option ADAPTIVE_LOCKMGRS.
Due to the nature of lockmgrs, adaptive spinning needs to be
selectively enabled for any interested lockmgr.
The support is bi-directional, or, in other ways, it will work in both
cases if the lock is held in read or write way.  In particular, the
read path is passible of further tunning using the sysctls
debug.lockmgr.retries and debug.lockmgr.loops .  Ideally, such sysctls
should be axed or compiled out before release.

Addictionally note that adaptive spinning doesn't cope well with
LK_SLEEPFAIL.  The reason is that many (and probabilly all) consumers
of LK_SLEEPFAIL are mainly interested in knowing if the interlock was
dropped or not in order to reacquire it and re-test initial conditions.
This directly interacts with adaptive spinning because lockmgr needs
to drop the interlock while spinning in order to avoid a deadlock
(further details in the comments inside the patch).

Final note: finding someone willing to help on tuning this with
relevant workloads would be either very important and appreciated.

Tested by:	jeff, pho
Requested by:	many
2009-06-17 01:55:42 +00:00
Jung-uk Kim
dc6acdcf72 Fix a typo from the previous commit. 2009-06-16 23:02:46 +00:00
Jung-uk Kim
a1d893025b Sync acpi(4) kld module Makefile with conf/options. 2009-06-16 23:00:26 +00:00
John Baldwin
6b0c5521b5 Trim extra sets of ()'s.
Requested by:	bde
2009-06-16 19:00:48 +00:00
John Baldwin
6dfb8b316c Fix edge cases with ticks wrapping from INT_MAX to INT_MIN in the handling
of the per-tcpcb t_badtrxtwin.

Submitted by:	bde
2009-06-16 19:00:12 +00:00
John Baldwin
9f78a87a06 - Change members of tcpcb that cache values of ticks from int to u_int:
t_rcvtime, t_starttime, t_rtttime, t_bw_rtttime, ts_recent_age,
  t_badrxtwin.
- Change t_recent in struct timewait from u_long to u_int32_t to match
  the type of the field it shadows from tcpcb: ts_recent.
- Change t_starttime in struct timewait from u_long to u_int to match
  the t_starttime field in tcpcb.

Requested by:	bde (1, 3)
2009-06-16 18:58:50 +00:00
Konstantin Belousov
01ed174831 Do not use casts (int *)0 and (struct thread *)0 for the arguments of
vn_rdwr, use NULL.

Reviewed by:	jhb
MFC after:	1 week
2009-06-16 15:13:45 +00:00
John Baldwin
38a9df71f9 Move (read|write)_cyrix_reg() inlines from specialreg.h to cpufunc.h.
specialreg.h now consists solely of register-related macros.
2009-06-16 15:13:18 +00:00
Ed Schouten
706b8a103a Small fixes to Unicode handling:
- Add more mappings for Greek characters and the Euro sign.
- Print UTF-8 characters in the log file as hexadecimal.
2009-06-16 14:55:13 +00:00
Rick Macklem
47b7dc9933 Remove the "int *" typecast for the aresid argument to vn_rdwr()
and change the type of the argument from size_t to int. This
should avoid issues on 64bit architectures.

Suggested by:	kib
Approved by:	kib (mentor)
2009-06-16 13:52:21 +00:00
Andrew Thompson
3c8d24f43b Fix usb2_find_descriptor function name. 2009-06-15 22:38:05 +00:00
Paul Saab
c2b6d60d26 I have several machines where the following warning is printed:
warning: no time-of-day clock registered, system time will not be set accurately

Provide hints to atrtc on amd64 since it's not being described in
ACPI on some systems.

Reviewed by:	jhb
2009-06-15 21:55:29 +00:00
Ed Schouten
eaaaf1906b Perform some more cleanups to in-kernel session handling.
The code that was in place in exit1() was mainly based on code from the
old TTY layer. The main reason behind this, was because at one moment I
ran a system that had two TTY layers in place at the same time. It is
now sufficient to do the following:

- Remove references from the session structure to the TTY vnode and the
  session leader.

- If we have a controlling TTY and the session used by the TTY is equal
  to our session, send the SIGHUP.

- If we have a vnode to the controlling TTY which has not been revoked,
  revoke it.

While there, change sys/kern/tty.c to use s_ttyp in the comparison
instead of s_ttyvp. It should not make any difference, because s_ttyvp
can only become null when the session leader already left, but it's
nicer to compare against the proper value.
2009-06-15 20:45:51 +00:00
John Baldwin
6653a58307 Regen. 2009-06-15 20:40:23 +00:00
John Baldwin
c4f16b69e1 Add a new 'void closefrom(int lowfd)' system call. When called, it closes
any open file descriptors >= 'lowfd'.  It is largely identical to the same
function on other operating systems such as Solaris, DFly, NetBSD, and
OpenBSD.  One difference from other *BSD is that this closefrom() does not
fail with any errors.  In practice, while the manpages for NetBSD and
OpenBSD claim that they return EINTR, they ignore internal errors from
close() and never return EINTR.  DFly does return EINTR, but for the common
use case (closing fd's prior to execve()), the caller really wants all
fd's closed and returning EINTR just forces callers to call closefrom() in
a loop until it stops failing.

Note that this implementation of closefrom(2) does not make any effort to
resolve userland races with open(2) in other threads.  As such, it is not
multithread safe.

Submitted by:	rwatson (initial version)
Reviewed by:	rwatson
MFC after:	2 weeks
2009-06-15 20:38:55 +00:00
Sam Leffler
d659538f72 r193336 moved ifq_detach to if_free which broke if_alloc followed
by if_free (w/o doing if_attach); move ifq_attach to if_alloc and
rename ifq_attach/detach to ifq_init/ifq_delete to better identify
their purpose

Reviewed by:	jhb, kmacy
2009-06-15 19:50:03 +00:00
Ed Schouten
9c373a81a3 Make tcsetsid(3) work on revoked TTYs.
Right now the only way to make tcsetsid(3)/TIOCSCTTY work, is by
ensuring the session leader is dead. This means that an application that
catches SIGHUPs and performs a sleep prevents us from assigning a new
session leader.

Change the code to make it work on revoked TTYs as well. This allows us
to change init(8) to make the shutdown script run in a more clean
environment.
2009-06-15 19:17:52 +00:00
Jamie Gritton
9ed47d01eb Get vnets from creds instead of threads where they're available, and from
passed threads instead of curthread.

Reviewed by:	zec, julian
Approved by:	bz (mentor)
2009-06-15 19:01:53 +00:00
Jamie Gritton
679e13901c Manage vnets via the jail system. If a jail is given the boolean
parameter "vnet" when it is created, a new vnet instance will be created
along with the jail.  Networks interfaces can be moved between prisons
with an ioctl similar to the one that moves them between vimages.
For now vnets will co-exist under both jails and vimages, but soon
struct vimage will be going away.

Reviewed by:	zec, julian
Approved by:	bz (mentor)
2009-06-15 18:59:29 +00:00
Marius Strobl
119051cbf9 Add cas(4), a driver for Sun Cassini/Cassini+ and National Semiconductor
DP83065 Saturn Gigabit Ethernet controllers. These are the successors
of the Sun GEM controllers and still have a similar but extended transmit
logic. As such this driver is based on gem(4).
Thanks to marcel@ for providing a Sun Quad GigaSwift Ethernet UTP (QGE)
card which was vital for getting this driver to work on architectures
not using Open Firmware.

Approved by:	re (kib)
MFC after:	2 weeks
2009-06-15 18:22:41 +00:00
Oleg Bulyzhin
1917ef996d Since dn_pipe.numbytes is int64_t now - remove unnecessary overflow detection
code in ready_event_wfq().
2009-06-15 17:14:47 +00:00
Rick Macklem
ae883d554a Replace the global references to "hostid" in svc_rpcsec_gss.c to local
variables set via the getcredhostid() function. I also changed the type
of ci_hostid to "unsigned long" so that it matches what is returned by
getcredhostid(). Although "struct svc_rpc_gss_clientid" goes on the wire
during RPCSEC_GSS, it is just a variable # of opaque bytes to the client,
so it doesn't matter how much storage ci_hostid uses.

Approved by:	kib (mentor)
2009-06-15 14:44:55 +00:00
Alexander Motin
bb74c2db4d Forbid multi-vector MSI interrupt vectors migration to another CPU once
allocated. MSI have strict vectors allocation requirements, which are not
satisfied now during reallocation. This is not the best possible solution,
but better then just broken, as it was.

No objections: current@, arch@, jhb@
2009-06-15 13:47:49 +00:00
Ariff Abdullah
164e1f20ec - Add a way to change filter oversampling factor through
FEEDER_RATE_PRESET "OVERSAMPLING_FACTOR:X .. .." where
  X = log2(oversampling factor).

- Lower down default filter oversampling factor from 128
  (log2 = 7) to 32 (log2 = 5), saving worth of 80 Kb.
  The use of better polynomial interpolator will raise
  its conversion quality/accuracy to match (or slightly
  better) with previous settings.

- Bump driver version.
2009-06-15 04:31:34 +00:00
Ariff Abdullah
eedb75f16b Remap type of polynomial interpolators for better polyphase
coefficients quality:
- Linear interpolator for oversampling factor larger and equal
  than 4096 (log2 = 12).
- Quadratic interpolator for oversampling factor larger and equal
  than 256 (log2 = 8).

Default oversampling factor (128 ~ log2 = 7) will use OPT32X, which
provides better accuracy.
2009-06-15 04:05:38 +00:00
Andrew Thompson
759736470c Fix _USB2_* refernces in the header protection defines. 2009-06-15 01:09:19 +00:00
Andrew Thompson
0b220aa2e8 Fix compile with changes to the usb_config struct. 2009-06-15 01:05:46 +00:00
Andrew Thompson
a593f6b8de s/usb2_/usb_|usbd_/ on all function names for the USB stack. 2009-06-15 01:02:43 +00:00
Andrew Thompson
8437751d86 Remove usb2_cv_* and just use the kernel condvar implementation, it was needed
earlier since condition variables didnt work with Giant but this was fixed 10
months ago.
2009-06-15 00:33:18 +00:00
Dag-Erling Smørgrav
b29310a2de Ed forgot this in r190751. 2009-06-14 23:44:06 +00:00
Dag-Erling Smørgrav
9f2354cabc Ed forgot this in r190751. 2009-06-14 23:27:09 +00:00
Simon L. B. Nielsen
b696d9ac2e Bump __FreeBSD_version for OpenSSL 0.9.8k import. 2009-06-14 19:53:52 +00:00
Alan Cox
387aabc513 Long, long ago in r27464 special case code for mapping device-backed
memory with 4MB pages was added to pmap_object_init_pt().  This code
assumes that the pages of a OBJT_DEVICE object are always physically
contiguous.  Unfortunately, this is not always the case.  For example,
jhb@ informs me that the recently introduced /dev/ksyms driver creates
a OBJT_DEVICE object that violates this assumption.  Thus, this
revision modifies pmap_object_init_pt() to abort the mapping if the
OBJT_DEVICE object's pages are not physically contiguous.  This
revision also changes some inconsistent if not buggy behavior.  For
example, the i386 version aborts if the first 4MB virtual page that
would be mapped is already valid.  However, it incorrectly replaces
any subsequent 4MB virtual page mappings that it encounters,
potentially leaking a page table page.  The amd64 version has a bug of
my own creation.  It potentially busies the wrong page and always an
insufficent number of pages if it blocks allocating a page table page.

To my knowledge, there have been no reports of these bugs, hence,
their persistance.  I suspect that the existing restrictions that
pmap_object_init_pt() placed on the OBJT_DEVICE objects that it would
choose to map, for example, that the first page must be aligned on a 2
or 4MB physical boundary and that the size of the mapping must be a
multiple of the large page size, were enough to avoid triggering the
bug for drivers like ksyms.  However, one side effect of testing the
OBJT_DEVICE object's pages for physical contiguity is that a dubious
difference between pmap_object_init_pt() and the standard path for
mapping devices pages, i.e., vm_fault(), has been eliminated.
Previously, pmap_object_init_pt() would only instantiate the first
PG_FICTITOUS page being mapped because it never examined the rest.
Now, however, pmap_object_init_pt() uses the new function
vm_object_populate() to instantiate them all (in order to support
testing their physical contiguity).  These pages need to be
instantiated for the mechanism that I have prototyped for
automatically maintaining the consistency of the PAT settings across
multiple mappings, particularly, amd64's direct mapping, to work.
(Translation: This change is also being made to support jhb@'s work on
the Nvidia feature requests.)

Discussed with:	jhb@
2009-06-14 19:51:43 +00:00
Ed Schouten
c2919fd8ff Enable PRINTF_BUFR_SIZE on i386 and amd64 by default.
In the past there have been some reports of PRINTF_BUFR_SIZE not
functioning correctly. Instead of having garbled console messages, we
should just see whether the issues are still there and analyze them.

Approved by:	re
2009-06-14 18:01:35 +00:00
Dmitry Chagin
0046fd5dd9 Unlock process lock when return error from getrobustlist call.
Tested by:	Alexander Best <alexbestms at math uni-muenster de>
Approved by:	kib (mentor)
MFC after:	3 days
2009-06-14 17:53:55 +00:00
Rick Macklem
f0557704cf When the KOBJMETHOD() macro was updated, it resulted in the
compiler doing argument type checking. Since the prototypes in
kgss_if.h used the generic gss_ctx_id_t for the context argument,
but the functions in sys/kgssapi/krb5/krb5_mech.c used the
KerberosV specific context argument, the file would no longer build.
This patch fixes it so it will build by replacing the argument with
a gss_ctx_id_t one and setting a local "struct krb5_context *" variable
to it for use by the function.

Reviewed by:	dfr
Approved by:	kib (mentor)
2009-06-14 17:33:46 +00:00
Bjoern A. Zeeb
ed655c8c07 Add an optional callback function that will be invoked when a per-CPU
queue was drained.  It will never fire for a directly dispatched packet.

You will most likely never want to use this for any ordinary netisr usage
and you will never blame netisr in case you try to use it and it does
not work as expected.

Reviewed by:	rwatson
2009-06-14 17:15:18 +00:00
Ed Schouten
912e4916d0 Include <camlib.h> for cam_path_string().
Submitted by:	Pawel Worach
2009-06-14 12:46:34 +00:00
Ed Schouten
324f7abb7f Add more entries to the Unicode-to-CP437 table.
Characters between 0x07 and 0x0d are now also mapped, which means we can
display almost 256 different characters. Also remap certain types of
dashes and quotes, which means we can finally read our manual pages
without red question marks in them.

Submitted by:	Christoph Mallon
2009-06-14 12:04:34 +00:00
Alexander Motin
ff0ef2c596 Fix type of lowaddr variable. 2009-06-14 07:34:21 +00:00
Warner Losh
bf4969e4ac Fix typo... bad imp. 2009-06-14 03:32:52 +00:00
Warner Losh
b0734f67fa After Marcel's change to DEFAULTS, we were bringing in a bogus copy of
uart_8250.  Remove it here since the UART on the ADM5120 isn't the
typical 16550: its completely different.
2009-06-14 02:58:56 +00:00
Warner Losh
dcd550fe2a Formatting nit. 2009-06-14 02:55:07 +00:00
Marius Strobl
9f91930a85 Missed style fixes. 2009-06-14 00:15:26 +00:00