Commit Graph

72261 Commits

Author SHA1 Message Date
Robert Watson
84f6005ccf Acquire interfce address list lock while walking the interface address
list during tun device initialization.

MFC after:	2 weeks
2009-04-20 23:25:38 +00:00
Robert Watson
77ee4c0e00 Acquire address list lock before walking an interface's address list to
identify possible jail addresses on it for IPv4 and IPv6.

MFC after:	2 weeks
2009-04-20 23:23:31 +00:00
Robert Watson
93c83dd8bf Assert the interface address list lock in IFP_TO_IA6(), as it will
iterate the interface address list.  Marginally expand IF_ADDR_LOCK()
coverage in mld6.c to make sure it's held when IFP_TO_IA6() is called.

MFC after:	2 weeks
2009-04-20 22:56:34 +00:00
Robert Watson
c4dd3fe108 Prefer structure fields (ifa_link) to macro aliases for them
(ifa_list).

MFC after:	2 weeks
2009-04-20 22:45:21 +00:00
Robert Watson
82324826a9 Prefer ifa_link (structure field) to ifa_list (macro alias for it).
MFC after:	2 weeks
2009-04-20 22:41:19 +00:00
Robert Watson
4ed6f8c1f1 Prefer actual field names (if_addrhead, ifa_link) to macros aliasing
those field names in FreeBSD code.

MFC after:	2 weeks
2009-04-20 22:40:44 +00:00
Robert Watson
1e6a41398c Acquire interface address list lock around access to if_addrhead,
closing several writer-writer races, and some read-write races.

MFC after:	2 weeks
2009-04-20 21:37:46 +00:00
Robert Watson
f68ffa034b Use TAILQ_FOREACH() and TAILQ_FOREACH_SAFE() rather than manually
accessing queue(9) structure fields for if_addrhead.

Prefer FreeBSD field name if_addrhead to compatibility macro
if_addrlist.

MFC after:	2 weeks
2009-04-20 21:05:37 +00:00
Robert Watson
989c0cb52a Prefer if_addrhead (FreeBSD) to if_addrlist (BSD compat) naming for the
interface address list in if_stf.c.

Acquire interface address list locks around address list access.

MFC after:	2 months
2009-04-20 20:09:55 +00:00
Kip Macy
0f5d117e8c simplify code by removing bit_fns and replacing with the use of a temporary mask 2009-04-20 16:16:43 +00:00
Robert Watson
ac6ba96269 Close some but not all writer-writer races when maintaining IPv6
interface address lists by locking the interface address list lock.

MFC after:	2 weeks
2009-04-20 16:05:16 +00:00
Stanislav Sedov
50aababbfb - Give a warning and start the oscillator if it was not previously
runned.
- Rename ds1672 -> rtc to follow the other drivers.
- Refactor/simplify the code a bit.

MFC after:	2 weeks
2009-04-20 15:47:06 +00:00
Warner Losh
98f751cd4b Sometimes we can call ed_detach() before the mtx has been initialized.
Avoid it if it hasn't been initialized.
2009-04-20 15:19:54 +00:00
Ed Schouten
2034e6a11f Make mse(4) use si_drv1, instead of using unit numbers.
Discussed with:	imp
2009-04-20 15:15:24 +00:00
Konstantin Belousov
6fae832ad7 Fix typo.
Noted by:	jhb
MFC after:	2 weeks
2009-04-20 15:10:03 +00:00
Antoine Brodin
9d9ab10e8b vlan(4) no longer depends on miibus(4).
Reviewed by:	jhb@
MFC after:	1 month
2009-04-20 15:01:45 +00:00
Robert Watson
1e1d603e2f Lock interface address lists before iterating over them in nd6.
MFC after:	2 weeks
2009-04-20 14:41:23 +00:00
Konstantin Belousov
f4ffd67c18 In ufs_checkpath(), recheck that '..' still points to the inode with
the same inode number after VFS_VGET() and relock of the vp. If '..'
changed, redo the lookup. To reduce code duplication, move the code to
read '..' dirent into the static helper function ufs_dir_dd_ino().

Supply the source inode number as an argument to ufs_checkpath() instead
of the source inode itself. The inode is unlocked, thus it might be
reclaimed, causing accesses to the freed memory.

Use vn_vget_ino() to get the '..' vnode by its inode number, instead of
directly code VFS_VGET() and relock, to properly busy the mount point
while vp lock is dropped.

Noted and reviewed by:	tegge
Tested by:	pho
MFC after:	1 month
2009-04-20 14:36:01 +00:00
Robert Watson
0aade26e6d In ip_input(), cache the received mbuf's network interface in a local
variable.  Acquire the interface address list lock when iterating over
the interface address list searching for a matching received broadcast
address.

MFC after:	2 weeks
2009-04-20 14:35:42 +00:00
Konstantin Belousov
007abb3d0f On the exit of the child process which parent either set SA_NOCLDWAIT
or ignored SIGCHLD, unconditionally wake up the parent instead of doing
this only when the child is a last child.

This brings us in line with other U**xes that support SA_NOCLDWAIT. If
the parent called waitpid(childpid), then exit of the child should wake
up the parent immediately instead of forcing it to wait for all children
to exit.

Reported by:	Alan Ferrency <alan pair com>
Submitted by:	Jilles Tjoelker <jilles stack nl>
PR:	108390
MFC after:	2 weeks
2009-04-20 14:34:55 +00:00
Robert Watson
33c4f96d88 In icmp_reflect(), acquire the inteface address list lock when
searching for a source address to use.

MFC after:	2 weeks
Reviewed by:	bz
2009-04-20 13:45:39 +00:00
Stanislav Sedov
219c5a5a96 - Unlock softc mutex on failure.
MFC after:	1 week
2009-04-20 13:15:25 +00:00
Robert Watson
9725389e1e Don't conditionally define CACHE_LINE_SHIFT, as we anticipate sizing
a fair number of static data structures, making this an unlikely
option to try to change without also changing source code. [1]

Change default cache line size on ia64, sparc64, and sun4v to 128
bytes, as this was what rtld-elf was already using on those
platforms. [2]

Suggested by:	bde [1], jhb [2]
MFC after:	2 weeks
2009-04-20 12:59:23 +00:00
Stanislav Sedov
852761c216 - Properly unlock mutex on failure in channel_trigger. Before this
the function just returned with the mutex held.

MFC after:	1 week
2009-04-20 12:43:07 +00:00
Rafal Jaworowski
5b155bf03a Provide locking for PowerPC interrupt sources config.
Reviewed by:	attilio
2009-04-20 12:40:28 +00:00
Ed Schouten
2cbf101b17 Get rid of the device index number stored in the sa(4) unit number.
The device index number stored in the unit number of sa(4) devices is
only used to print debug messages. Get rid of this index number and use
devtoname() to just print the entire device name.
2009-04-20 10:40:42 +00:00
Pyun YongHyeon
f2e491c9c5 For RTL8139C+ controllers, have controller handle padding short
checksum offload frames. Software workaround used for broken
controllers(RTL8169, RTL8168, RTL8168B) seem to cause watchdog
timeouts on RTL8139C+.
Introduce a new flag RL_FLAG_AUTOPAD to mark automatic padding
feature of controller and set it for RTL8139C+ and controllers that
use new descriptor format. This fixes watchdog timeouts seen on
RTL8139C+.

Reported by:	Dimitri Rodis < DimitriR <> integritasystems dot com >
Tested by:	Dimitri Rodis < DimitriR <> integritasystems dot com >
2009-04-20 07:13:04 +00:00
Alan Cox
1c951556bc MFamd64/i386
Introduce pmap_try_insert_pv_entry(), a function that conditionally
  creates a pv entry if the number of entries is below the high water mark
  for pv entries.

  Introduce pmap_enter_quick_locked() and use it to reimplement
  pmap_enter_object().  The old implementation was broken.  For example,
  it could block while holding a mutex lock.

  Change pmap_enter_quick_locked() to fail rather than wait if it is
  unable to allocate a page table page.  This prevents a race between
  pmap_enter_object() and the page daemon.  Specifically, an inactive
  page that is a successor to the page that was given to
  pmap_enter_quick_locked() might become a cache page while
  pmap_enter_quick_locked() waits and later pmap_enter_object() maps
  the cache page violating the invariant that cache pages are never
  mapped.  Similarly, change
  pmap_enter_quick_locked() to call pmap_try_insert_pv_entry() rather
  than pmap_insert_entry().  Generally speaking,
  pmap_enter_quick_locked() is used to create speculative mappings.  So,
  it should not try hard to allocate memory if free memory is scarce.

Tested by:	gonzo
2009-04-20 03:44:54 +00:00
Warner Losh
472dfd2aeb Cleanup resource allocation code a bit. Store the rids on the
resources rather than on the softc.  When we allocate resources for PC
Card, if we only get 16 ports, try again to get the others.
2009-04-20 01:19:59 +00:00
Robert Watson
2a5058a3ed Temporarily relax the constraints on argument size checking for A_GETCOND;
login(1) isn't quite ready for them yet on 64-bit systems as it continues
to use the conventions of the old version of the API.

Reported by:	stas, Jakub Lach <jakub_lach at mailplus.pl>
2009-04-19 23:28:08 +00:00
Robert Watson
072b8f8ea7 Lock the interface address list when searching for a matching interface
by address, or when implementing 'me' rules on IPv6.  Prefer the field
name if_addrhead to the macro if_addrlist.

MFC after:	2 weeks
2009-04-19 22:34:35 +00:00
Robert Watson
b132600ab2 In divert_packet(), lock the interface address list before iterating over
it in search of an address.

MFC after:	2 weeks
2009-04-19 22:29:16 +00:00
Robert Watson
9317b04e46 Lock interface address lists in in_pcbladdr() when searching for a
source address for a connection and there's no route or now interface
for the route.

MFC after:	2 weeks
2009-04-19 22:25:09 +00:00
Robert Watson
8021456a24 Protect against some writer-writer races in in_control() by acquiring
the interface address list lock around interface address list
modifications.  More to do here.

MFC after:	2 weeks
2009-04-19 22:16:19 +00:00
Robert Watson
3fd5c685f7 Lock the interface address list while building replies to
NGM_CISCO_COOKIE messages in ng_iface.

MFC after:	2 weeks
2009-04-19 22:05:39 +00:00
Robert Watson
315a0b84cc Lock interface address list when building a reply to NGM_EIFACE_GET_IFADDRS
messages in ng_eiface.

MFC after:	2 weeks
2009-04-19 22:04:29 +00:00
Robert Watson
f25cc1d0d9 Lock interface address list lock around ifaddr inserts and deletes
in at_control().  This locking is not yet complete but should prevent
some classes of race conditions.

MFC after:	2 weeks
2009-04-19 22:01:38 +00:00
Nathan Whitehorn
37dd6c71ca Build sound modules on PowerPC. 2009-04-19 21:37:45 +00:00
Robert Watson
e5a9a8ead8 Lock the interface address list while iterating a network interface's
address list when searching for a link-layer address to use during uuid
generation.

MFC after:	2 weeks
2009-04-19 21:36:18 +00:00
Robert Watson
22037b2d2c Add description and cautionary note regarding CACHE_LINE_SIZE.
MFC after:	2 weeks
Suggested by:	alc
2009-04-19 21:26:36 +00:00
Konstantin Belousov
6bed074cd2 In both pageout oom handler and vm_daemon, acquire the reference to
the vmspace of the examined process instead of directly accessing its
vmspace, that may change. Also, as an optimization, check for P_INEXEC
flag before examining the process.

Reported and tested by:	pho (previous version)
Reviewed by:	alc
MFC after:	3 week
2009-04-19 20:53:47 +00:00
Robert Watson
a93fa8f2bb For each architecture, define CACHE_LINE_SHIFT and a derived
CACHE_LINE_SIZE constant.  These constants are intended to
over-estimate the cache line size, and be used at compile-time
when a run-time tuning alternative isn't appropriate or
available.

Defaults for all architectures are 64 bytes, except powerpc
where it is 128 bytes (used on G5 systems).

MFC after:	2 weeks
Discussed on:   arch@
2009-04-19 20:19:13 +00:00
Robert Noland
8f6d3bf7a2 Don't try to setup interrupts for drivers that don't support them.
This causes sis and probably a couple of other driver to panic and fail.

Tested by:	cpghost <cpghost@cordula.ws>
PR:		133554
MFC after:	3 days
2009-04-19 16:54:33 +00:00
Robert Watson
c0020399a6 Merge OpenBSM 1.1 from OpenBSM vendor branch to head.
OpenBSM history for imported revision below for reference.

MFC after:      2 weeks
Sponsored by:   Apple, Inc.
Obtained from:  TrustedBSD Project

OpenBSM 1.1

- Change auditon(2) parameters and data structures to be 32/64-bit architecture
  independent.  Add more information to man page about auditon(2) parameters.
- Add wrapper functions for auditon(2) to use legacy commands when the new
  commands are not supported.
- Add default for 'expire-after' in audit_control to expire trail files when
  the audit directory is more than 10 megabytes ('10M').
- Interface to convert between local and BSM fcntl(2) command values has been
  added:  au_bsm_to_fcntl_cmd(3) and au_fcntl_cmd_to_bsm(3), along with
  definitions of constants in audit_fcntl.h.
- A bug, introduced in OpenBSM 1.1 alpha 4, in which AUT_RETURN32 tokens
  generated by audit_submit(3) were improperly encoded has been fixed.
- Fix example in audit_submit(3) man page.  Also, make it clear that we want
  the audit ID as the argument.
- A new audit event class 'aa', for post-login authentication and
  authorization events, has been added.
2009-04-19 16:17:13 +00:00
Robert Watson
a751bb7470 Vendor import of OpenBSM 1.1, which incorporates the following changes
since the last imported OpenBSM release:

OpenBSM 1.1

- Change auditon(2) parameters and data structures to be 32/64-bit architecture
  independent.  Add more information to man page about auditon(2) parameters.
- Add wrapper functions for auditon(2) to use legacy commands when the new
  commands are not supported.
- Add default for 'expire-after' in audit_control to expire trail files when
  the audit directory is more than 10 megabytes ('10M').
- Interface to convert between local and BSM fcntl(2) command values has been
  added:  au_bsm_to_fcntl_cmd(3) and au_fcntl_cmd_to_bsm(3), along with
  definitions of constants in audit_fcntl.h.
- A bug, introduced in OpenBSM 1.1 alpha 4, in which AUT_RETURN32 tokens
  generated by audit_submit(3) were improperly encoded has been fixed.
- Fix example in audit_submit(3) man page.  Also, make it clear that we want
  the audit ID as the argument.
- A new audit event class 'aa', for post-login authentication and
  authorization events, has been added.

Obtained from:	TrustedBSD Project
Sponsored by:	Apple, Inc.
2009-04-19 15:18:16 +00:00
Robert Watson
4df4e33572 Merge OpenBSM 1.1 changes to the FreeBSD 8.x kernel:
- Add and use mapping of fcntl(2) commands to new BSM constant space.
- Adopt (int) rather than (long) arguments to a number of auditon(2)
  commands, as has happened in Solaris, and add compatibility code to
  handle the old comments.

Note that BSM_PF_IEEE80211 is partially but not fully removed, as the
userspace OpenBSM 1.1alpha5 code still depends on it.  Once userspace
is updated, I'll GCC the kernel constant.

MFC after:		2 weeks
Sponsored by:		Apple, Inc.
Obtained from:		TrustedBSD Project
Portions submitted by:	sson
2009-04-19 14:53:17 +00:00
Dmitry Chagin
b1121623d2 Remove support for FUTEX_REQUEUE operation.
Glibc does not use this operation since 2.3.3 version (Jun 2004),
as it is racy and replaced by FUTEX_CMP_REQUEUE operation.
Glibc versions prior to 2.3.3 fall back to FUTEX_WAKE when
FUTEX_REQUEUE returned EINVAL.

Any application directly using FUTEX_REQUEUE without return
value checking are definitely broken.

Limit quantity of messages per process about unsupported
operation.

Approved by:	kib (mentor)
MFC after:	1 month
2009-04-19 13:48:42 +00:00
Robert Watson
bb1c7df80f struct malloc_type has had a 'magic' field statically initialized to
M_MAGIC by MALLOC_DEFINE() for a long time; add assertions that
malloc_type's passed to malloc(), free(), etc have that magic set.

MFC after:	2 weeks
2009-04-19 12:41:37 +00:00
Robert Watson
eb7bba19c5 Garbage collect now-unused struct malloc_type fields, bump __FreeBSD_version
as kernel modules will need to be rebuilt.  These fields existed to support
binary compatibility with kernel modules from before the introduction of
libmemstat(3) in FreeBSD 6.x, so they are no longer required.
2009-04-19 11:20:57 +00:00
Edward Tomasz Napierala
e0ee758989 When allocating 'struct acl' instances, use malloc(9) instead of uma(9).
This struct will get much bigger soon, and we don't want to waste too much
memory on UMA caches.

Reviewed by:	rwatson
2009-04-19 09:56:30 +00:00
Bruce M Simpson
b5fbc0b98f Now that IFF_NEEDSGIANT has been removed from the network
stack, catch up with this in IGMPv3 and remove dead code.
This has the side-effect of not being back-portable to RELENG_7
w/o further changes.
2009-04-19 08:14:21 +00:00
Alan Cox
f4b0c119c0 Calling pmap_clear_modify() after calling pmap_remove_write() is pointless.
The latter function already clears the modified status from each of the
page's mappings.
2009-04-19 07:18:08 +00:00
Nathan Whitehorn
55fba05bf5 Fix a typo in the SRR1 comparison for program exceptions. While here,
replace magic numbers with constants to keep this from happening again.

Without this fix, some programs would occasionally get SIGTRAP instead
of SIGILL on an illegal instruction. This affected Altivec detection
in pixman, and possibly other software.

Reported by:	Andreas Tobler
MFC after:	1 week
2009-04-19 06:30:00 +00:00
Konstantin Belousov
f2cc3668fc When verifying '..' after VFS_VGET() in ufs_lookup(), do not return
error if '..' is still there but changed between lookup and check.
Start relookup instead. Rename is supposed to change '..' reference
atomically, so transient failures introduced by r191137 are wrong.

While rearranging the code to allow lookup restart in ufs_lookup(),
remove the comment that only distracts the reader.

Noted and reviewed by:	tegge
Also reported by:	pho
MFC after:	1 month
2009-04-19 05:34:07 +00:00
Kip Macy
65111ec7aa - Allocate a small flowtable in ip_input.c (changeable by tuneable)
- Use for accelerating ip_output
2009-04-19 04:44:05 +00:00
Kip Macy
7a134b0e42 update TODO list 2009-04-19 04:39:42 +00:00
Kip Macy
94681960d9 - put larger flowtable members at the end
- fix bug where tail pointer of the free list would not get advanced
- clear entry's next pointer when it is added to the freelist to avoid freeing
  an entry that it still points to
2009-04-19 04:24:56 +00:00
Alan Cox
f9855e177d Allow valid pages to be mapped for read access when they have a non-zero
busy count.  Only mappings that allow write access should be prevented by
a non-zero busy count.

(The prohibition on mapping pages for read access when they have a non-
zero busy count originated in revision 1.202 of i386/i386/pmap.c when
this code was a part of the pmap.)

Reviewed by:	tegge
2009-04-19 00:34:34 +00:00
Kip Macy
34b07340ff - Import infrastructure for caching flows as a means of accelerating L3 and L2 lookups
as well as providing stateful load balancing when used with RADIX_MPATH.
- Currently compiled in to i386 and amd64 but disabled by default, it can be enabled at
  runtime with 'sysctl net.inet.flowtable.enable=1'.

- Embedded users can remove it entirely from the kernel by adding 'nooption FLOWTABLE' to
  their kernel config files.

- A minimal hookup will be added to ip_output in a subsequent commit. I would like to see
  more review before bringing in changes that require more churn.

Supported by: Bitgravity Inc.
2009-04-19 00:16:04 +00:00
Robert Watson
04ac2960c4 Remove IFF_NEEDSGIANT interface flag: we no longer provide ifnet-layer
infrastructure to support non-MPSAFE network device drivers.
2009-04-18 20:39:17 +00:00
Edward Tomasz Napierala
b998d381f2 Use acl_alloc() and acl_free() instead of using uma(9) directly.
This will make switching to malloc(9) easier; also, it would be
neccessary to add these routines if/when we implement variable-size
ACLs.
2009-04-18 16:47:33 +00:00
Ulf Lilleengen
697ab8be86 - Remove assertion of topology lock remaining from 7.x gvinum. It is not needed,
as the renaming only changes internal gvinum names and will not alter the geom
  topology.
- The topology lock was not held when calling g_wither_geom after renaming.
2009-04-18 16:36:27 +00:00
Ed Schouten
dae0d1b1d5 Remove unused SESUNIT() macro from ses(4). 2009-04-18 07:39:11 +00:00
Ed Schouten
e78a5a3f2f Convert mlx(4) and mly(4) to si_drv1 instead of dev2unit(). 2009-04-18 07:36:38 +00:00
Warner Losh
77944b3551 Make sure that the data in the ROM with a valid signature isn't all
0's.  At least one PC Card ASIC does this...
2009-04-18 04:45:02 +00:00
Warner Losh
f2731d8565 Add GVP NIC 2000P and New Media Livewire. Also New Media LanSurfer
doesn't have a function type of network, so add a quirk for that...
2009-04-18 04:37:53 +00:00
Warner Losh
74677fb82b Establish the interrupt handler AFTER we successfully attach. We need
to do this in case we have a shared interrupt that fires during the
attach process....
2009-04-18 03:10:28 +00:00
Warner Losh
77a6714a6d Remove debug write accidentally left in. 2009-04-18 03:02:44 +00:00
Bernd Walter
69948a10db minor cleanup 2009-04-17 22:45:57 +00:00
Ed Schouten
182e0e9ddc Switch ubtbcmfw(4) to use si_drv1 instead of storing the unit number.
The unit number is still used to store the type of the device node.

Approved by:	emax
2009-04-17 22:13:41 +00:00
John Baldwin
a28b3fc741 - Add a few more register defintions for the PCI express capability
registers.
- Cleanup PCI-X capability printf to not leave a dangling "supports" for
  some PCI-X bridges.
- Display additional PCI express details including the negotiated and max
  link width and the actual and maximum supported max payload.

MFC after:	1 month
2009-04-17 19:07:44 +00:00
Kip Macy
e94ba2ce53 clarify state of llentry that is passed back 2009-04-17 18:48:50 +00:00
Alexander Kabaev
8aeb69d0f2 Undo private changes that should never have been committed. 2009-04-17 18:34:11 +00:00
Alexander Kabaev
348496ad39 More fallout from negative dotdot caching. Negative entries should
be removed from and reinserted to proper ncneg list.

Reported by:  pho
Submitted by: kib
2009-04-17 18:11:11 +00:00
John Baldwin
c8728236ec The vlan code has not required the miibus code since 6.0 when
if_link_state_change() was added and the vlan link-state hook was moved
out of miibus and into net/if.c.

MFC after:	1 month
2009-04-17 17:40:47 +00:00
Andrew Thompson
0c512ce8ee Drain the driver tasks on the same taskqueue in which they were enqueued. 2009-04-17 16:07:13 +00:00
John Baldwin
842f11bef6 Restore bus DMA bounce pages to an offset of 0 when they are released by
a tag that has BUS_DMA_KEEP_PG_OFFSET set.  Otherwise the page could be
reused with a non-zero offset by a tag that doesn't have
BUS_DMA_KEEP_PG_OFFSET leading to data corruption.

Sleuthing by:	avg
Reviewed by:	scottl
2009-04-17 13:22:18 +00:00
Robert Watson
7eb04522ef Remove kue_fw.h, missed in previous IFF_NEEDSGIANT USB driver garbage
collection.
2009-04-17 09:48:20 +00:00
Robert Watson
855628aba6 Remove legacy versions of USB network interface drivers relying on
IFF_NEEDSGIANT, as that is no longer supported.
2009-04-17 09:42:26 +00:00
Maksim Yevmenkin
018cd707c0 Prevent atkbd(4) interrupt handler from calling keyboard callback function
when polled mode is enabled. This should help with duplicated/missing
characters problem at mountroot, geli, etc. prompts on multi CPU systems
while kbdmux(4) is enabled.

Tested by:	Tobias Grosser <grosser -at- fim -dot- uni-passau -dot- de>
Tested by:	Fabian Keil <freebsd-listen -at- fabiankeil -dot- de>
MFC after:	3 days
2009-04-17 00:30:56 +00:00
Andrew Thompson
a0c4317cc2 Only call ieee80211_start_all() if its a 80211 device.
Submitted by:	Paul B. Mahol
2009-04-16 23:42:00 +00:00
Kip Macy
db90f94b85 call base if_qflush routine to flush if_snd 2009-04-16 23:08:02 +00:00
Kip Macy
7cc5b47fb3 export if_qflush for use by driver if_qflush routines
only set ifp->if_{transmit, qflush} if not already set
KASSERT that neither or both are set
2009-04-16 23:05:10 +00:00
Kip Macy
ab25fa3558 s/void/void */ 2009-04-16 23:02:56 +00:00
Kip Macy
adfc35ff8b add comment to llentry_update
Requested by: sam
2009-04-16 22:55:59 +00:00
Kip Macy
114f15c686 restore spare pointers for MFCing 2009-04-16 22:47:43 +00:00
Kip Macy
c8da95ace9 add utility routine for updating an struct llentry * 2009-04-16 22:04:07 +00:00
Kip Macy
279aa3d419 Change if_output to take a struct route as its fourth argument in order
to allow passing a cached struct llentry * down to L2

Reviewed by:	rwatson
2009-04-16 20:30:28 +00:00
Robert Watson
fe69399069 Merge new kernel files from OpenBSM 1.1: audit_fcntl.h and
audit_bsm_fcntl.c contain utility routines to map local fcntl
commands into BSM constants.  Adaptation to the FreeBSD kernel
environment will follow in a future commit.

Sponsored by:	Apple, Inc.
Obtained from:	TrustedBSD Project
MFC after:	2 weeks
2009-04-16 20:17:32 +00:00
Rick Macklem
201e7488b6 Added a field to the SVCXPRT structure that the nfsv4 server can
use to identify if the socket is the same one that a cached request
	came in on. It is set by nfsrvd_addsock() to a unique value generated
	by incrementing an unsigned 64bit static variable for each assignment
	and then the value of xp_sockref is tested to see if it is equal to
	the value that was saved with the cached reply.

Submitted by:	rmacklem
Reviewed by:	dfr
Approved by:	kib (mentor)
2009-04-16 16:26:35 +00:00
Robert Watson
2f106d5e08 Remove D_NEEDGIANT from audit pipes. I'm actually not sure why this was
here, but isn't needed.

MFC after:	2 weeks
Sponsored by:	Apple, Inc.
2009-04-16 11:57:16 +00:00
Rafal Jaworowski
5817716faf mge(4): fix two bugs, which were leading to crash/hang under very heavy
network load.

1. Leave the RX interrupt routine if there is no mbuf available.

2. Properly initialize and track tx_desc_used_count counter so as not to
leak mbuf while traversing used descriptors.

Obtained from:	Semihalf
2009-04-16 11:38:06 +00:00
Rafal Jaworowski
a669cbb228 Minor style fixes and better comments. 2009-04-16 11:21:52 +00:00
Rafal Jaworowski
bc26e2e38f Adjust Marvell Discovery (MV78xxx) support to recognize newest chip revisions,
handle Z0 revision (early silicon) explicitly due to its quirks.

Obtained from:	Marvell, Semihalf
2009-04-16 11:20:18 +00:00
Robert Watson
6cf6d55734 Garbage collect unbuildable and unusable non-MPSAFE network device
drivers that depended on the historic IFF_NEEDSGIANT compatibility
mechanism:

  ar(4)
  ray(4)
  sr(4)

Discussed on:	arch@
2009-04-16 11:09:13 +00:00
Konstantin Belousov
71421dc116 Verify that '..' still exists with the same inode number after
VFS_VGET() has returned in ufs_lookup(). If the '..' lookup started
immediately before the parent directory was removed, we might return
either cleared or unrelated inode otherwise.

Ufs_lookup() is split into new function ufs_lookup_() that either does
lookup, or verifies that directory entry exists and references supplied
inode number.

Reviewed by:	tegge
Tested by:	pho,
	Andreas Tobler <andreast-list fgznet ch> (previous version)
MFC after:	1 month
2009-04-16 09:57:08 +00:00
Konstantin Belousov
28a1b4eb37 In flushbufqueues(), do not allocate sentinel buffer on the stack,
struct buf is large. Use sleeping malloc(9) call, and zero the allocated
buf as a debugging feature.
2009-04-16 09:37:48 +00:00
Konstantin Belousov
949af70942 Export the number of times bufdaemon got help from the normal threads. 2009-04-16 09:33:52 +00:00
Marcel Moolenaar
cce94b6583 Precision '*' expects an int and strlen() returns a size_t.
Compensate.
2009-04-16 05:52:47 +00:00
Marcel Moolenaar
6ad9a99f21 Add a compat option to the EBR scheme that controls the
naming of the partitions (GEOM_PART_EBR_COMPAT).  When
compatibility is enabled, changes to the partitioning are
disallowed.

Remove the device name aliasing added previously to provide
backward compatibility, but which in practice doesn't give
us anything.

Enable compatibility on amd64 and i386.
2009-04-15 22:38:22 +00:00
Kip Macy
8b12a7c2a6 - convert pspare pointers in inpcb to an llentry and rtentry cache
- add flags to indicate their validity
2009-04-15 22:22:00 +00:00
Kip Macy
773b573a96 - add second flags field to to inpcb
- update comments in vflag
2009-04-15 22:09:42 +00:00
Kip Macy
82c33e73f2 provide additional convenience macros for inpcb locking (upgrade, downgrade, exclusive) 2009-04-15 21:39:56 +00:00
Kip Macy
8f22a721c2 revert RTM_VERSION change - it doesn't do what I thought it does and changing breaks
ifconfig needlessly
2009-04-15 21:36:34 +00:00
Kip Macy
582b6122ab make LLTABLE visible to netinet 2009-04-15 20:49:59 +00:00
Ed Schouten
6672361085 Remove dead code from devtoname().
In the good old days it was possible to have dev_t's that referred to
nonexistent devices. In these cases devtoname() automatically generated
names. This is no longer possible, so remove this dead code.

Discussed with:	kib
2009-04-15 20:43:12 +00:00
Kip Macy
de4ab55e43 add an llentry to struct route{_in6} to allow it to be passed around with
the rtentry
2009-04-15 20:34:19 +00:00
Ed Schouten
bce79dbb29 Remove unneeded variable and casting from newdev().
Remove the `udev' variable, which has a different type than the original
function argument and si_drv0. The `udev' name is also misleading,
because it is not the number returned by dev2udev(). Rename this
argument to `unit'. It is the same number as returned by dev2unit().
2009-04-15 20:15:36 +00:00
Ed Schouten
d7cbfc1b18 Don't use si_drv0 directly.
We should still access si_drv0 using dev2unit(). Also change the
KASSERT() to really print the udev instead of the unit number. I suspect
it's still useful to print the unit number, especially for devices that
use clone lists, so keep the unit number in the panic string.
2009-04-15 20:08:26 +00:00
Ed Schouten
db99d0404c Migrate the olpt(4) driver to si_drv1 instead of using dev2unit().
Approved by:	nyan
2009-04-15 19:58:41 +00:00
John Baldwin
3f11530b79 Update comment above _fget() for earlier change to FWRITE failures return
EBADF rather than EINVAL.

Submitted by:	Jaakko Heinonen  jh saunalahti fi
MFC after:	1 month
2009-04-15 19:10:37 +00:00
Marko Zec
4d79e3d5e8 In the !VIMAGE_GLOBALS case, make sure not to call vnet_net_iattach()
both via the vnet_mod_register() framework and then directly, but only
once.

Reviewed by:	bz
Approved by:	julian (mentor)
2009-04-15 18:15:29 +00:00
Jung-uk Kim
cebe9dc98a A simple rewrite of biossmap.c:
- Do not iterate int 15h, function e820h twice.  Instead, we use STAILQ to
store each return buffer and copy all at once.
- Export optional extended attributes defined in ACPI 3.0 as separate
metadata.  Currently, there are only two bits defined in the specification.
For example, if the descriptor has extended attributes and it is not
enabled, it has to be ignored by OS.  We may implement it in the kernel
later if it is necessary and proven correct in reality.
- Check return buffer size strictly as suggested in ACPI 3.0.

Reviewed by:	jhb
2009-04-15 17:31:22 +00:00
Alexander Kabaev
9cf6772211 Redo previous change using simpler patch that happens to be also
more correct.

Submitted by: tor
2009-04-14 23:56:48 +00:00
Alexander Kabaev
eed8a9edba Fix yet another negative dotodot entry fallout.
Reported by: pho
2009-04-14 23:46:57 +00:00
Kip Macy
427ac07f05 Extend route command:
- add show as alias for get
	- add weights to allow mpath to do more than equal cost
	- add sticky / nostick to disable / re-enable per-connection load balancing

This adds a field to rt_metrics_lite so network bits of world will need to be re-built.

Reviewed by:	jeli & qingli
2009-04-14 23:05:36 +00:00
Marius Strobl
ecbd3f3a29 Fix whitespace. 2009-04-14 20:51:58 +00:00
Marius Strobl
f880062633 - Remove the second license as I'm also fine with the first one.
- Remove redundant softc members for RIDs.
- Change some softc members to be unsigned where more appropriate.
- Add some missing const.
- Remove support for mmap(2)'ing VGA I/O as it was broken [1] and
  not required by X.Org anyway.
- Fix some confusion between bus, physical and virtual addresses
  which mostly consisted in using members of struct video_adapter
  inappropriately but wasn't fatal except for the regular framebuffer
  mmap(2)'ing.
- Remove redundant bzero(9)'ing of the softc.
- Don't map the framebuffer twice in case the firmware has already
  mapped it as besides wasting resources this isn't possible with
  all MMUs. This is a bit tricky as a) just because the firmware
  provides a property with a virtual address doesn't mean it's
  actually mapped (but typically is when the framebuffer is the
  console) and b) the firmware doesn't necessarily map the it with
  the same byteorder as we do. This make machfb(4) work on machines
  with cheetah-class MMUs (including X.Org).

Reported by:	Michael Plass [1]
MFC after:	3 days
2009-04-14 20:23:47 +00:00
Randall Stewart
e261340ef7 Add missing address lock when we look at the ifa list 2009-04-14 19:20:27 +00:00
Marius Strobl
6c9f0f2124 Fix whitespace. 2009-04-14 19:11:02 +00:00
Marius Strobl
24b847f1f0 Fix masking of TTE bits; the TD_*_MASK macros need shifting via the
corresponding TD_*_SHIFT.

MFC after:	3 days
2009-04-14 19:02:34 +00:00
John Baldwin
bfee0576cb - Consolidate duplicated code for reading and sizing BARs and writing base
addresses to BARs into new pci_read_bar() and pci_write_bar() routines.
  pci_add_map(), pci_alloc_map(), and pci_delete_resource() now use these
  routines to work with BARs.
- Just pass the device_t for the new PCI device to various routines instead
  of passing the device, bus, slot, and function.

Reviewed by:	imp
2009-04-14 18:32:37 +00:00
Jack F Vogel
b3096a0430 Thanks to Michael Tuexen and Randall Scott for providing a
few important bug fixes found while they were doing SCTP
development, and that I somehow lost during the scramble.

Thanks guys!!
2009-04-14 17:14:35 +00:00
John Baldwin
087ebb8a5c Use a disk address instead of an int to hold the starting offset of an
open partition.  This fixes access to partitions whose starting offset
is >= 2 TB.

Submitted by:	"James R. Van Artsdalen"  james jrv.org
MFC after:	3 days
2009-04-14 14:19:18 +00:00
Ed Schouten
0de5b9b0f0 Use si_drv1 instead of dev2unit() in twe(4) and twa(4)
Reviewed by:	scottl
2009-04-14 14:02:43 +00:00
Ed Schouten
9078597210 Use si_drv1 instead of dev2unit() in powermac_nvram.
Reviewed by:	nwhitehorn
2009-04-14 13:18:39 +00:00
Ed Schouten
b7d9e67c45 Use si_drv1 instead of dev2unit() inside agp(4).
Reviewed by:	rnoland
2009-04-14 13:11:34 +00:00
Ed Schouten
9555aafab2 Let tdfx(4) use si_drv1 instead of using dev2unit(). 2009-04-14 11:57:26 +00:00
Ed Schouten
9ef0e425f3 Use si_drv1 to store joy(4)'s softc.
There are still some calls to dev2unit() left, but I guess we should
take care of those another time.
2009-04-14 11:23:09 +00:00
Randall Stewart
544e35bd97 Move the flight size reduction to right after
we recognize its a retransmit, ahead of the PR-SCTP
work. Without this fix, we end up NOT reducing flight
size and causing an miscalculation when PR-SCTP is active
and data is skipped.

Obtained from:	Michael Tuexen.
2009-04-14 07:50:29 +00:00
Nathan Whitehorn
e3bcab29e6 Changing the overflow trap to use bla to branch to dbtrap in r190946 was
bogus. Revert to a branch that does not set LR. It's been a long week...
2009-04-14 04:15:56 +00:00
Kip Macy
f2502470b5 - define em_transmit and em_qflush
- make buF_ring usage conditional but enabled by default

Reviewed by:	jfv
2009-04-14 03:36:59 +00:00
Kip Macy
aee3056f64 call default if_qflush on ifq if default method isn't used by the driver 2009-04-14 03:17:44 +00:00
Warner Losh
f133918640 Another NE-2000 clone. The GVC NIC-2000P Ethernet adapter. Based on
the MN5017 chipset.  There's no vendor/product pair on this card, so
it needs to be matched by the CIS strings.
2009-04-14 03:13:05 +00:00
Kip Macy
3efea33724 Adapt buf_ring abstraction interface to allow consumers to interoperate with ALTQ 2009-04-14 00:27:59 +00:00
Kip Macy
5e6a926611 - use a shared lock for reads
- remove stale comment

Reviewed by:	jeffr
2009-04-13 23:09:44 +00:00
Sam Leffler
19ea87c42b o eliminate a << in calculating the tx time for turbo mode by pre-multiplying
data in the phy tables
o correct the ctrl rate indices in the 5212 turbog phy table
2009-04-13 21:01:08 +00:00
Sam Leffler
e40b6ab1cf don't use caddr_t to match ieee80211_dump_pkt type; supplying the correct
one costs nothing
2009-04-13 20:58:47 +00:00
Sam Leffler
040972a18b o fix dynamic slave-side tdma slot length updating: we need to re-setup the
burst length in the tx q's
o remove re-config of the beaconq on update; it's not needed
2009-04-13 20:57:34 +00:00
Sam Leffler
5e86169a67 add a debug msg for when a fixed transmit rate is not applied because
it's not found in the sta's negotiated rate set
2009-04-13 20:54:08 +00:00
Sam Leffler
5434ed5af3 setup turboA/G fixed rate parameters too; this is needed, in particular,
for turboG operation
2009-04-13 20:53:12 +00:00
Sam Leffler
baa55e71d4 correct debug printf 2009-04-13 20:50:51 +00:00
Sam Leffler
4477b68344 check correct address for a bssid mtch 2009-04-13 20:50:07 +00:00
Sam Leffler
c5262b82e6 fix txparms setup for 108G sta's: ieee80211_iserp_rateset does not
identify a station operating in turbo-boost mode because it has a
pure ofdm rate set; add an explicit check for the channel type
instead of depending on IEEE80211_NODE_ERP being set
2009-04-13 20:45:29 +00:00
Konstantin Belousov
e0769d2dff Remove trailing spaces 2009-04-13 19:54:33 +00:00
Marius Strobl
b7f089e9f1 Fix whitespace. 2009-04-13 19:43:37 +00:00
Konstantin Belousov
3feb57a0a8 The bus_dmamap_load_uio(9) shall use pmap of the thread recorded in the
uio_td to extract pages from, instead of unconditionally use kernel
pmap.

Submitted by:	Jason Harmening <jason.harmening gmail com> (amd64 version)
PR:	amd64/133592
Reviewed by:	scottl (original patch), jhb
MFC after:	2 weeks
2009-04-13 19:20:32 +00:00
David Xu
945488297b Make UMTX_OP_WAIT_UINT actually wait for an unsigned integer on 64-bits
machine.

MFC after: 1 week
2009-04-13 05:21:17 +00:00
Sam Leffler
89047529ac remove reference to sc_tdmabintcnt; it was removed in r190848 2009-04-13 03:20:21 +00:00
Pyun YongHyeon
0685c824ca Don't blindly set IP packet length from interface MTU in TSO case.
Remote host can advertise smaller MSS than that of sender so upper
stack might have adjusted the MSS which in turn generates IP
packets that are less size than that of interface MTU.

Reported by:	Bjoern Koenig ( bkoenig <> alpha-tierchen dot de )
Tested by:	Bjoern Koenig ( bkoenig <> alpha-tierchen dot de )
MFC after:	3 days
2009-04-13 00:32:34 +00:00
Robert Watson
de231a063a Put TCPSTAT_ADD() and TCPSTAT_INC() behind _KERNEL.
MFC after:	3 days
2009-04-12 21:28:35 +00:00
Rick Macklem
45452edc37 Change nfsserver so that it uses the nfssvc() system call provided
in sys/nfs/nfs_nfssvc.c by registering with it using the
	nfsd_call_nfsserver function pointer. Also, add the build glue for
	nfs_nfssvc.c optionally based on "nfsserver" and also as a loadable
	module.

Submitted by:	rmacklem
Reviewed by:	kib
Approved by:	kib (mentor)
2009-04-12 19:04:27 +00:00
Robert Watson
6bf65bcf3a Update stats in struct carpstats using two new macros: CARPSTATS_ADD()
and CARPSTATS_INC(), rather than directly manipulating the fields of
the structure.  This will make it easier to change the implementation
of these statistics, such as using per-CPU versions of the data
structure.

MFC after:	3 days
2009-04-12 14:19:37 +00:00
Robert Watson
07cf7ab29c Update stats in struct pimstat using two new macros: PIMSTAT_ADD()
and PIMSTAT_INC(), rather than directly manipulating the fields of
the structure.  This will make it easier to change the
implementation of these statistics, such as using per-CPU versions
of the data structure.

MFC after:	3 days
2009-04-12 14:06:26 +00:00
Robert Watson
fb83a36856 Update stats in struct mrtstat using two new macros: MRTSTAT_ADD()
and MRTSTAT_INC(), rather than directly manipulating the fields of
the structure.  This will make it easier to change the
implementation of these statistics, such as using per-CPU versions
of the data structure.

MFC after:	3 days
2009-04-12 14:00:36 +00:00
Robert Watson
bd88cce2ed Update stats in struct igmpstat using two new macros:
IGMPSTAT_ADD() and IGMPSTAT_INC(), rather than directly
manipulating the fields of the structure.  This will make it
easier to change the implementation of these statistics,
such as using per-CPU versions of the data structures.

MFC after:	3 days
2009-04-12 13:41:13 +00:00
Robert Watson
e27b0c8775 Update stats in struct icmpstat and icmp6stat using four new
macros: ICMPSTAT_ADD(), ICMPSTAT_INC(), ICMP6STAT_ADD(), and
ICMP6STAT_INC(), rather than directly manipulating the fields
of these structures across the kernel.  This will make it
easier to change the implementation of these statistics,
such as using per-CPU versions of the data structures.

In on case, icmp6stat members are manipulated indirectly, by
icmp6_errcount(), and this will require further work to fix
for per-CPU stats.

MFC after:	3 days
2009-04-12 13:22:33 +00:00
Robert Watson
f68f9f77fe Commit file omitted in r190962:
Update stats in struct udpstat using two new macros, UDPSTAT_ADD()
and UDPSTAT_INC(), rather than directly manipulating the fields
across the kernel.  This will make it easier to change the
implementation of these statistics, such as using per-CPU versions
of the data structures.

MFC after:    3 days
2009-04-12 11:53:12 +00:00
Robert Watson
026decb8f3 Update stats in struct udpstat using two new macros, UDPSTAT_ADD()
and UDPSTAT_INC(), rather than directly manipulating the fields
across the kernel.  This will make it easier to change the
implementation of these statistics, such as using per-CPU versions
of the data structures.

MFC after:	3 days
2009-04-12 11:42:40 +00:00
Kip Macy
f0b9868d3a sendfile doesn't modify the vnode - acquire vnode lock shared
Reviewed by:	ups, jeffr
2009-04-12 05:19:35 +00:00
Nathan Whitehorn
8cf9d6cd7e Rework the way we get the cacheline size. Instead of having a table of
CPUs known to use 128 byte cache lines and defaulting to 32, use the dcbz
instruction to measure it. Also make dcbz behave the way you would
expect on PPC 970.
2009-04-12 03:03:55 +00:00
Robert Watson
86425c62a0 Update stats in struct ipstat using four new macros, IPSTAT_ADD(),
IPSTAT_INC(), IPSTAT_SUB(), and IPSTAT_DEC(), rather than directly
manipulating the fields across the kernel.  This will make it easier
to change the implementation of these statistics, such as using
per-CPU versions of the data structures.

MFC after:	3 days
2009-04-11 23:35:20 +00:00
Alan Cox
b9519926e6 Remove execute permission from the memory allocated by sbrk().
Pre-announced on: -arch (3/31/09)
Discussed with: rwatson
Tested by: marius (sparc64)
2009-04-11 22:34:08 +00:00
Robert Watson
78b5071407 Update stats in struct tcpstat using two new macros, TCPSTAT_ADD() and
TCPSTAT_INC(), rather than directly manipulating the fields across the
kernel.  This will make it easier to change the implementation of
these statistics, such as using per-CPU versions of the data structures.

MFC after:	3 days
2009-04-11 22:07:19 +00:00
Robert Watson
89f28b1b86 Remove conditionally compiled time counter statistics; tools like
DTrace, kernel profiling, etc, can provide this information without
the overhead.

MFC after:	3 days
Suggested by:	bde
2009-04-11 22:01:40 +00:00
Nathan Whitehorn
1e89943aa3 Fix recognition of kernel-mode traps that pass through the KDB trap handler
but do not actually invoke KDB. This includes recoverable machine checks
encountered in kernel mode.

This patch causes machines with Grackle host-PCI bridges to be able to
correctly enumerate them again.

MFC after:	3 days
2009-04-11 20:43:41 +00:00
Alexander Kabaev
9d75482f99 Fix v_cache_dd handling for negative entries. v_cache_dd pointer was
not populated in parent directory if negative entry was being
created, yet entry itself was added to the nc_neg list. It was
possible for parent vnode to get discarded later, leaving negative
entry pointing to now unused memory block.

Reported by:	dho
Revewed by:	kib
2009-04-11 20:23:08 +00:00
Konstantin Belousov
fd409594c6 When zapping v_cache_dd for !MAKEENTRY case in cache_lookup(), we shall
lock cache as writer.

Reviewed by:	kan
2009-04-11 16:12:20 +00:00
Paolo Pisati
50d25dda1b What's the point of adjusting a checksum if we are going to toss the
packet? Anticipate the check/return code.
2009-04-11 15:26:31 +00:00
Paolo Pisati
ea80b0ac03 Plug two bugs introduced with modules conversion:
-UdpAliasIn(): correctly check return code after modules ran.
-alias_nbt: in case of malformed packets (or some other unrecoverable
 error), toss the packet.
2009-04-11 15:19:09 +00:00
Paolo Pisati
1cd68a24c7 Remove stale comments. 2009-04-11 15:05:19 +00:00
Yoshihiro Takahashi
e532d3fafa MFi386: revision 190919
Simplify in/out functions.

  Remove a hack to generate more efficient code for port numbers below
  0x100, which has been obsolete for at least ten years, because GCC has
  an asm constraint to specify that.
2009-04-11 14:25:47 +00:00
Ed Schouten
e1048f7678 Simplify in/out functions (for i386 and AMD64).
Remove a hack to generate more efficient code for port numbers below
0x100, which has been obsolete for at least ten years, because GCC has
an asm constraint to specify that.

Submitted by:	Christoph Mallon <christoph mallon gmx de>
2009-04-11 14:01:01 +00:00
Robert Watson
3ca43b79a7 Bump __FreeBSD_version to 800077 for the removal of VOP_LEASE -- this
changes the size of the vop_vector array and therefore requires file
system modules to be rebuilt.
2009-04-11 10:10:45 +00:00
Alan Cox
ab5378cf11 Previously, when vm_page_free_toq() was performed on a page belonging to
a reservation, unless all of the reservation's pages were free, the
reservation was moved to the head of the partially-populated reservations
queue, where it would be the next reservation to be broken in case the
free page queues were emptied.  Now, instead, I am moving it to the tail.
Very likely this reservation is in the process of being freed in its
entirety, so placing it at the tail of the queue makes it more likely that
the underlying physical memory will be returned to the free page queues as
one contiguous chunk.  If a reservation must be broken, it will, instead,
be the longest unchanged reservation, which is arguably the reservation
that is least likely to ever achieve promotion or be freed in its entirety.

MFC after:	6 weeks
2009-04-11 09:09:00 +00:00
Marko Zec
bfe1aba468 Introduce vnet module registration / initialization framework with
dependency tracking and ordering enforcement.

With this change, per-vnet initialization functions introduced with
r190787 are no longer directly called from traditional initialization
functions (which cc in most cases inlined to pre-r190787 code), but are
instead registered via the vnet framework first, and are invoked only
after all prerequisite modules have been initialized.  In the long run,
this framework should allow us to both initialize and dismantle
multiple vnet instances in a correct order.

The problem this change aims to solve is how to replay the
initialization sequence of various network stack components, which
have been traditionally triggered via different mechanisms (SYSINIT,
protosw).  Note that this initialization sequence was and still can be
subtly different depending on whether certain pieces of code have been
statically compiled into the kernel, loaded as modules by boot
loader, or kldloaded at run time.

The approach is simple - we record the initialization sequence
established by the traditional mechanisms whenever vnet_mod_register()
is called for a particular vnet module.  The vnet_mod_register_multi()
variant allows a single initializer function to be registered multiple
times but with different arguments - currently this is only used in
kern/uipc_domain.c by net_add_domain() with different struct domain *
as arguments, which allows for protosw-registered initialization
routines to be invoked in a correct order by the new vnet
initialization framework.

For the purpose of identifying vnet modules, each vnet module has to
have a unique ID, which is statically assigned in sys/vimage.h.
Dynamic assignment of vnet module IDs is not supported yet.

A vnet module may specify a single prerequisite module at registration
time by filling in the vmi_dependson field of its vnet_modinfo struct
with the ID of the module it depends on.  Unless specified otherwise,
all vnet modules depend on VNET_MOD_NET (container for ifnet list head,
rt_tables etc.), which thus has to and will always be initialized
first.  The framework will panic if it detects any unresolved
dependencies before completing system initialization.  Detection of
unresolved dependencies for vnet modules registered after boot
(kldloaded modules) is not provided.

Note that the fact that each module can specify only a single
prerequisite may become problematic in the long run.  In particular,
INET6 depends on INET being already instantiated, due to TCP / UDP
structures residing in INET container.  IPSEC also depends on INET,
which will in turn additionally complicate making INET6-only kernel
configs a reality.

The entire registration framework can be compiled out by turning on the
VIMAGE_GLOBALS kernel config option.

Reviewed by:	bz
Approved by:	julian (mentor)
2009-04-11 05:58:58 +00:00
Warner Losh
e89da24b3d Two refinements to the 3c1 support:
1) Flag it and only access that command on the 3c1
2) The TX PLL appears to power down when not in use, so we have to power
   it back up when we've been idle.  Do this at the start of ifstart.
   Otherwise we fall off the net.
2009-04-11 04:30:38 +00:00
Warner Losh
52fcedff50 o Report ethernet status for at least 10BaseT media. Since I don't
have other media to test against, I've left that media reporting
  unchanged.
o Enable the TX_PLL when we enable TX.  This is harmless on most
  cards, but required to get the 3c1 CF card working.  Power savings
  could be had by managing this better, but for now it gets my card
  working.
2009-04-11 02:47:03 +00:00
Kai Wang
a08bed8c7b Added DT_GNU_HASH entry for GNU-style hash table. 2009-04-10 21:24:18 +00:00
Max Laier
8623f9fd7a Follow up for r190895 It's not only the "all" group that is affected, but
all groups on the given interface.

PR:		kern/130977, kern/131310
MFC after:	3 days (%vnet)
2009-04-10 19:16:14 +00:00
Warner Losh
f20765ea29 Don't specify a hint, since it isn't needed. 2009-04-10 18:46:46 +00:00
Warner Losh
56d67d7d37 Fix comment
Submitted by:	danfe@
2009-04-10 17:34:30 +00:00
Warner Losh
0203f7164f Improvements for TC5299J MII support. 2009-04-10 16:12:00 +00:00
Warner Losh
84db505873 The D-Link DE-650 isn't tagged as a network card, so allow it to
attach anyway.
Add a comment about a 'common' mfg/prod pair that's used in a very
large array of different cards.
2009-04-10 15:33:47 +00:00
Warner Losh
613dabd54f Fix some comments. 2009-04-10 15:30:19 +00:00
Warner Losh
f5456b5d2c No need to check for chip type here. 2009-04-10 15:18:03 +00:00
Max Laier
876d5c038f Remove interfaces from IFG_ALL on detach. This cures a couple of pf panics
when using the "self" keyword in tables or as ()-style host address and
fixes "ifconfig -g all" output.

PR:		kern/130977, kern/131310
Submitted by:	Mikolaj Golub
MFC after:	3 days
2009-04-10 14:41:51 +00:00
Robert Watson
885868cd8f Remove VOP_LEASE and supporting functions. This hasn't been used since
the removal of NQNFS, but was left in in case it was required for NFSv4.
Since our new NFSv4 client and server can't use it for their
requirements, GC the old mechanism, as well as other unused lease-
related code and interfaces.

Due to its impact on kernel programming and binary interfaces, this
change should not be MFC'd.

Proposed by:    jeff
Reviewed by:    jeff
Discussed with: rmacklem, zach loafman @ isilon
2009-04-10 10:52:19 +00:00
Konstantin Belousov
3f54086eba Cache_lookup() for DOTDOT drops dvp vnode lock, allowing dvp to be reclaimed.
Check the condition and return ENOENT then.

In nfs_lookup(), respect ENOENT return from cache_lookup() when it is caused
by dvp reclaim.

Reported and tested by:	pho
2009-04-10 10:22:44 +00:00
Konstantin Belousov
6d7e809123 When vm_map_wire(9) is allowed to skip holes in the wired region, skip
the mappings without any of read and execution rights, in particular,
the PROT_NONE entries. This makes mlockall(2) work for the process
address space that has such mappings.

Since protection mode of the entry may change between setting
MAP_ENTRY_IN_TRANSITION and final pass over the region that records
the wire status of the entries, allocate new map entry flag
MAP_ENTRY_WIRE_SKIPPED to mark the skipped PROT_NONE entries.

Reported and tested by:	Hans Ottevanger <fbsdhackers beasties demon nl>
Reviewed by:	alc
MFC after:	3 weeks
2009-04-10 10:16:03 +00:00
Ulf Lilleengen
1de45ea74d - Move out allocation part of different gvinum objects into its own routine and
make use of it in the gvinum userland code.
2009-04-10 08:50:14 +00:00
Kip Macy
80cb9f211a Import "flowid" support for serializing flows across transmit queues
Reviewed by:	rwatson and jeli
2009-04-10 06:16:14 +00:00
Jack F Vogel
529f22baa8 Fix build problem with data format. 2009-04-10 05:26:14 +00:00
Andrew Thompson
853a10a581 Revert r190676,190677
The geom and CAM changes for root_hold are the wrong solution for USB design
quirks.

Requested by:	scottl
2009-04-10 04:08:34 +00:00
Jack F Vogel
770e416bb1 Add missing file, sorry bout that :) 2009-04-10 02:45:00 +00:00
Jack F Vogel
b698ab40c8 Add ixgbe to the GENERIC amd64 kernel in place of the
older ixgb driver. I will add to other architectures
after this one proves trouble free.

MFC after:	2 weeks
2009-04-10 00:40:48 +00:00
Jack F Vogel
800422dc86 Add additional file to ixgbe files list, and uncomment NOTES entry
MFC after: 2 weeks
2009-04-10 00:34:55 +00:00
Jack F Vogel
b8ee200357 Add support file for 82599 in Makefile
MFC after:	2 weeks
2009-04-10 00:31:54 +00:00
Jack F Vogel
0ac6dfec68 Update the ixgbe driver to 1.7.4, this includes support
for the new 82599 adapter family, adds header split, and
many small fixes. The driver should now be added to the
GENERIC kernel.

MFC after: 2 weeks
2009-04-10 00:22:48 +00:00
Jack F Vogel
d035aa2db2 This delta syncs the em and igb drivers with Intel,
adds header split and SCTP support into the igb driver.
Various small improvements and fixes.

MFC after: 2 weeks
2009-04-10 00:05:46 +00:00
Maksim Yevmenkin
b7f32062d1 Whitespace nitpicking
MFC after:	1 week
2009-04-09 19:11:08 +00:00
Maksim Yevmenkin
a449b18a5b Introduce KB_POLLED flag to struct keyboard's kb_flags field.
Reviewed by:	freebsd-current@, freebsd-hackers@
MFC after:	1 week
2009-04-09 18:31:33 +00:00
Maksim Yevmenkin
af60af2dc0 Remove obsolete/bogus layering.
Reviewed by:	freebsd-current@, freebsd-hackers@
MFC after:	1 week
2009-04-09 18:22:51 +00:00
Sam Leffler
dd015656a7 check the method pointer before invoking ah_eepromDetach as it can
be null if attach work fails before hooking up the eeprom support

Obtained from:	madwifi
2009-04-09 16:53:59 +00:00
Luigi Rizzo
ae190bc089 Bump version after changes in the userland/kernel ABI for dummynet
(plain ipfw rules unchanged)
2009-04-09 13:02:55 +00:00
Luigi Rizzo
4bb7ae9deb Add emulation of delay profiles, which lets you model various
types of MAC overheads such as preambles, link level retransmissions
and more.

Note- this commit changes the userland/kernel ABI for pipes
(but not for ordinary firewall rules) so you need to rebuild
kernel and /sbin/ipfw to use dummynet features.

Please check the manpage for details on the new feature.

The MFC would be trivial but it breaks the ABI, so it will
be postponed until after 7.2 is released.

Interested users are welcome to apply the patch manually
to their RELENG_7 tree.

Work supported by the European Commission, Projects Onelab and
Onelab2 (contract 224263).
2009-04-09 12:46:00 +00:00
Xin LI
cd3ef66680 Use DEVICE_SHUTDOWN(9) mechanism for shutdown handler.
Suggested by:	jhb
2009-04-09 07:45:23 +00:00
Marcel Moolenaar
39bc3bff94 Don't use pmap_kextact() when comparing bus handles for Book-E.
We typically wire translation to devices with TLB1 entries and
pmap_kextract() does not know about those and returns 0.  This
causes false positives (read: all serial ports suddenly become
the console).
2009-04-08 22:19:39 +00:00
Maksim Yevmenkin
ed382753a7 Undo SVN rev 183283
Do not use Giant for kbdmux(4) locking. This is wrong and apparently
causing more problems than it solves. This will re-open the issue
where interrupt handlers may race with kbdmux(4) in polling mode.
Typical symptoms include (but not limited to) duplicated and/or
missing characters when low level console functions (such as gets)
are used while interrupts are enabled (for example geli password
prompt, mountroot prompt etc.)

MFC after:	3 days
2009-04-08 20:52:30 +00:00
Ed Schouten
2c97d32a81 Also remove the unused __word_swap_int*() macros.
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
2009-04-08 19:10:20 +00:00
Ed Schouten
17cfde3df4 Implement __bswap16() without using inline assembly.
Most compilers nowadays (including GCC) are smart enough to know what's
going on and generate more efficient code anyway.

Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
2009-04-08 19:06:47 +00:00
Sam Leffler
9fb0fccb89 o add a capability for drivers that require 802.3 encapsulation of
frames passed down through the transmit path
o mark ndis requiring 802.3 encap'd frames

Reviewed by:	"Paul B. Mahol" <onemda@gmail.com>, thompsa
2009-04-08 16:19:50 +00:00
Marcel Moolenaar
94fe30d0ca Don't use hexadecimal in the EBR partition names, because 'a'..'f'
are more commonly known as BSD partition names.

Discussed with: ivoras@
2009-04-08 16:18:16 +00:00
Sam Leffler
293d484820 remove unused struct member 2009-04-08 16:12:28 +00:00
Ed Schouten
e3b0b98073 Fix tty_wait_background() to comply with standards.
It turns out my handling of SIGTTOU and SIGTTIN didn't entirely comply
to the standards. It is true that in the SIGTTOU case we should not
return EIO when the signal is ignored/blocked, but in the SIGTTIN case
we must.

See also:	POSIX issue 7 section 11.1.4
2009-04-08 15:56:50 +00:00
Rafal Jaworowski
95c5550c37 Minor description fix. 2009-04-08 13:01:18 +00:00
Rafal Jaworowski
991d55bfab Properly handle KDB entry in fatal abort. This lets KDB_UNATTENDED work on ARM.
Submitted by:	Grzegorz Bernacki gjb ! semihalf dot com
2009-04-08 12:54:32 +00:00
Randall Stewart
abe15ad66c Fix a FR bug. When doing PR-SCTP with number rtx
set to a low number. The check for skipping was in the
incorrect place. Which meant we would FR chunks we
should not.
MFC after:	1 Month
2009-04-08 12:52:05 +00:00
Randall Stewart
e29d4aa6bd Add more padding and a new variable. This will
help us be able to keep ABI compatibility between
8 and 9.
MFC after:	Never
2009-04-08 12:49:36 +00:00
Paolo Pisati
43197d291a -don't pass down, to module's fingerprint function, unused data like
a pointer to the ip header.
-style
-spacing
2009-04-08 11:56:49 +00:00
Yoshihiro Takahashi
30a8aaf0df MFi386: revision 190617
Fill the fsbase and gsbase fields of the mcontext structure on i386.
2009-04-08 11:35:47 +00:00
Dag-Erling Smørgrav
4970b8ae0a Remove spurious locking in pfs_write().
Reported by:	Andrew Brampton <me@bramp.net>
MFC after:	1 week
2009-04-08 09:02:42 +00:00
Marcel Moolenaar
d7ae5af5c4 Fix hangs caused by hardware that signals receive errors
(framing, parity, etc), but does not indicate characters
being received. Since no chracters have been received,
ignore the line errors.

PR:		131006
MFC after:	3 days
2009-04-08 00:14:06 +00:00
Robert Noland
e12ce94f36 check offsets for R300_ZB_ZPASS_ADDR
Submitted by:	Maciej Cencora <m.cencora@gmail.com>
MFC after:	3 days
2009-04-07 22:26:53 +00:00
Robert Noland
3c834e3435 Add regs required for occlusion queries support
Submitted by:	Maciej Cencora <m.cencora@gmail.com>
MFC after:	3 days
2009-04-07 22:20:58 +00:00
Robert Watson
5d5c174869 Nul-terminate strings in the VFS name cache, which negligibly change
the size and cost of name cache entries, but make adding debugging
and tracing easier.

Add SDT DTrace probes for various namecache events:

  vfs:namecache:enter:done - new entry in the name cache, passed parent
    directory vnode pointer, name added to the cache, and child vnode
    pointer.

  vfs:namecache:enter_negative:done - new negative entry in the name cache,
    passed parent vnode pointer, name added to the cache.

  vfs:namecache:fullpath:enter - call to vn_fullpath1() is made, passed
    the vnode to resolve to a name.

  vfs:namecache:fullpath:hit - vn_fullpath1() successfully resolved a
    search for the parent of an object using the namecache, passed the
    discovered parent directory vnode pointer, name, and child vnode
    pointer.

  vfs:namecache:fullpath:miss - vn_fullpath1() failed to resolve a search
    for the parent of an object using the namecache, passed the child
    vnode pointer.

  vfs:namecache:fullpath:return - vn_fullpath1() has completed, passed the
    error number, and if that is zero, the vnode to resolve, and the
    returned path.

  vfs:namecache:lookup:hit - postive name cache entry hit, passed the
    parent directory vnode pointer, name, and child vnode pointer.

  vfs:namecache:lookup:hit_negative - negative name cache entry hit,
    passed the parent directory vnode pointer and name.

  vfs:namecache:lookup:miss - name cache miss, passed the parent directory
    pointer and the full remaining component name (not terminated after the
    cache miss component).

  vfs:namecache:purge:done - name cache purge for a vnode, passed the vnode
    pointer to purge.

  vfs:namecache:purge_negative:done - name cache purge of negative entries
    for children of a vnode, passed the vnode pointer to purge.

  vfs:namecache:purgevfs - name cache purge for a mountpoint, passed the
    mount pointer.  Separate probes will also be invoked for each cache
    entry zapped.

  vfs:namecache:zap:done - name cache entry zapped, passed the parent
    directory vnode pointer, name, and child vnode pointer.

  vfs:namecache:zap_negative:done - negative name cache entry zapped,
    passed the parent directory vnode pointer and name.

For any probes involving an extant name cache entry (enter, hit, zapp),
we use the nul-terminated string for the name component.  For misses,
the remainder of the path, including later components, is provided as
an argument instead since there is no handy nul-terminated version of
the string around.  This is arguably a bug.

MFC after:      1 month
Sponsored by:   Google, Inc.
Reviewed by:	jhb, kan, kib (earlier version)
2009-04-07 20:58:56 +00:00
Ed Schouten
82b70c3e01 Improve clarity: if (a && (b ? b : c)) -> if (a && (b || c))
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
2009-04-07 19:44:06 +00:00
Ed Schouten
156cfba72c Add parentheses to under-parenthesized macro.
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
2009-04-07 19:35:20 +00:00
Ed Schouten
db26a6714a Don't explicitly force ecx to be used for MSR_FSBASE/MSR_GSBASE.
Because the "c" input constaint is used, the compiler will already place
the MSR_FSBASE/MSR_GSBASE constants in ecx. Using __asm("ecx") makes
LLVM crash. Even though this is also an LLVM bug, we'd better remove the
unnecessary GCCism as well.

Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
2009-04-07 19:31:36 +00:00
Rick Macklem
2a536430e9 Adding sys/nfs/nfssvc.h and sys/nfs/nfs_nfssvc.c in preparation for
sharing of the nfssvc() system call between nfsserver and the nfsv4
	server. Building of nfs_nfssvc.c will be committed later, at the time
	the .c files in sys/nfsserver are updated. To do so now would result in
	nfssvc() multiply defined.

Submitted by:	rmacklem
Reviewed by:	dfr
Approved by:	kib (mentor)
2009-04-07 19:06:51 +00:00
Jung-uk Kim
ac5c83d9f3 Rewrite SMBIOS for loader:
- First three fields of system UUID may be little-endian as described in
SMBIOS Specification v2.6.  For now, we keep the network byte order for
backward compatibility (and consistency with popular dmidecode tool)
if SMBIOS table revision is less than 2.6.  However, little-endian format
can be forced by defining BOOT_LITTLE_ENDIAN_UUID from make.conf(5) if it
is necessary.
- Replace overly ambitious optimizations with more readable code.
- Update comments to SMBIOS Specification v2.6 and clean up style(9) bugs.
2009-04-07 17:58:15 +00:00
Jung-uk Kim
d4e77db18b Increase sprintf(3) buffer size, which I forgot from the previous commit. 2009-04-07 17:24:25 +00:00
Warner Losh
05ea372876 More chip types, and fix a comment. 2009-04-07 17:06:06 +00:00
Xin LI
8eadd1b28e When multiple cards are present, register a shutdown handler for each card
instead of just register one for the first adapter.  Without doing this
there would be some data loss upon shutdown because data could be ignored
when flushing to disk.

MFC after:	3 days
2009-04-07 16:40:31 +00:00
Xin LI
6447075520 Update driver to vendor's version 1.16 plus some local changes:
- override_kernel_driver() has been removed since this is an
   in-tree version of driver.
 - __DATE__ and __TIME__ removed from version string to make
   binary update builders happy.
 - Utilize pause(9) for __FreeBSDversion >= 700033 (redo 167086).
 - Utilize kproc_suspend_check() for __FreeBSDversion >= 800002.
   (redo 172836).
 - Don't read past end of pVDevice (redo 143787).
 - Make sure that controller and channel are initialized (redo 169823).
 - Don't include cam/cam_xpt_periph.h (redo 158177).

MFC After:	3 days
2009-04-07 16:38:25 +00:00
Warner Losh
0ca89d1986 Fix a comment to match the code. 2009-04-07 16:15:59 +00:00
Dag-Erling Smørgrav
59fc1b068f Fix an inverted KASSERT. Add similar assertions in other similar places.
Reported by:	Andrew Brampton <me@bramp.net>
MFC after:	1 week
2009-04-07 16:13:10 +00:00
Warner Losh
7687c7e37c Remove DL10019 workaround, since the code it calls isn't quite ready. 2009-04-07 15:44:50 +00:00
Warner Losh
fb0030f35a Move tick to end of file for better code references. 2009-04-07 15:43:34 +00:00
Warner Losh
800c135a2d The DL100xx cards have 24k of packet memory, not 16k. Use it for them
and update comments about original patches doing this and it not
working.  It works for both the DL10019 and DL10022 based cards that I
have.  It really helps the DL10019 cards, since they were using 8k
instead of the normal 16k that regular NE-2000 cards help.

# Note to self: need to provide a common routine to setup memory
# parameters.
2009-04-07 15:40:38 +00:00
Warner Losh
8d2c1f1602 Apply generic media stuff to pccard case too, when we aren't using miibus
for this.
2009-04-07 15:36:02 +00:00
Warner Losh
03a9bf492b Minor fixes to comments about media autoselect. 2009-04-07 15:34:26 +00:00
Bjoern A. Zeeb
970caf60dd With the right comparison we get a proper wscale value and thus
more adequate TCP performance with IPv6.

Changes for IPv4, r166403 and r172795, both ignored the
IPv6 counterpart and left it in the state of art of year 2000.

The same logic in syncache already shares code between v4 and v6 so
things do not need to be adapted there.

Reported by:	Steinar Haug (sthaug nethelp.no)
Tested by:	Steinar Haug (sthaug nethelp.no)
MFC after:	3 days
2009-04-07 14:42:40 +00:00
Warner Losh
990b9c1594 Another GlobalVillage card. 2009-04-07 05:57:56 +00:00
Warner Losh
1cac1dbfab Provide a generic ifmedia set of routines as a fallback. The
DP8390-based cards have no generic way of reporting status of the link
or setting the media type.  Some specific versions of these cards do,
however, allow for this, and we already support some of them.  Make
the 'ed' experience more uniform by providing "autoselect" as the
meida and status "active" always.  This won't affect the chips that
provide more specific details.
2009-04-07 05:41:38 +00:00
Sean Bruno
4470fe9dbe Minor updates as a precursor to fixing sbp_targ
firewire.c -- expand a comment and repair a typo
sbp.h -- define Logical Unit Reset so it can be used in sbp_targ

Reviewed by:	scottl@freebsd.org
2009-04-07 02:33:46 +00:00
Weongyo Jeong
9284d50989 Add an entry for the uath(4) module. 2009-04-07 01:37:50 +00:00
Marko Zec
1ed81b739e First pass at separating per-vnet initializer functions
from existing functions for initializing global state.

        At this stage, the new per-vnet initializer functions are
	directly called from the existing global initialization code,
	which should in most cases result in compiler inlining those
	new functions, hence yielding a near-zero functional change.

        Modify the existing initializer functions which are invoked via
        protosw, like ip_init() et. al., to allow them to be invoked
	multiple times, i.e. per each vnet.  Global state, if any,
	is initialized only if such functions are called within the
	context of vnet0, which will be determined via the
	IS_DEFAULT_VNET(curvnet) check (currently always true).

        While here, V_irtualize a few remaining global UMA zones
        used by net/netinet/netipsec networking code.  While it is
        not yet clear to me or anybody else whether this is the right
        thing to do, at this stage this makes the code more readable,
        and makes it easier to track uncollected UMA-zone-backed
        objects on vnet removal.  In the long run, it's quite possible
        that some form of shared use of UMA zone pools among multiple
        vnets should be considered.

	Bump __FreeBSD_version due to changes in layout of structs
	vnet_ipfw, vnet_inet and vnet_net.

Approved by:	julian (mentor)
2009-04-06 22:29:41 +00:00
John Baldwin
3429118095 When a stale file handle is encountered, purge all cached information about
an NFS node including the access and attribute caches.  Previously the NFS
client only purged any name cache entries associated with the file.

PR:		kern/123755
Submitted by:	Jaakko Heinonen  jh of saunalahti fi
Reported by:	Timo Sirainen  tss of iki fi
Reviewed by:	rwatson, rmacklem
MFC after:	1 month
2009-04-06 21:11:08 +00:00
John Baldwin
6e57ff1890 Add opt_kdtrace.h to fix standalone module build. 2009-04-06 20:17:28 +00:00