Commit Graph

57478 Commits

Author SHA1 Message Date
Jim Rees
23350221ac Fix up some cut-n-paste damage and some out-of-date comments.
No code changes.

Submitted by:	cel@citi.umich.edu
2006-01-20 15:20:41 +00:00
Jim Rees
c99880b289 Use thread0 instead of user's thread for sobind.
This fixes reconnect after, for example, tcp idle disconnection.
Previously this would fail if a normal user tried to bind to a privileged
port.

Submitted by:	cel@citi.umich.edu
MFC after:	1 week
2006-01-20 15:17:46 +00:00
Jim Rees
4b81d0eb0f Don't log an error on tcp connection reset, even if we don't get ECONNRESET.
Submitted by:	cel@citi.umich.edu
2006-01-20 15:07:18 +00:00
Andre Oppermann
6c68d7b1ec Fix m_getjcl() the right way this time.
Submitted by:	glebius
Pointy hat to:	andre
2006-01-20 13:43:11 +00:00
Andre Oppermann
f33bf4a394 m_getjcl() should return the address of the mbuf, not the
cluster.

Found by:	glebius
2006-01-20 13:06:22 +00:00
Gleb Smirnoff
5eb5c9639a An attemp to make driver more readable and attaractive for further
hacking:
  - Remove all spaces at eol.
  - Improve style(9) in most frequently edited functions.
  - In em_encap() push variables for 82544 workaround in the block
    where they are only used.
  - In em_get_buf() remove unused variable.
2006-01-20 11:38:25 +00:00
Christian S.J. Peron
9c57c204be - Change the return type for init_tables from void to int so we can propagate
errors from rn_inithead back to the ipfw initialization function.
- Check return value of rn_inithead for failure, if table allocation has
  failed for any reason, free up any tables we have created and return ENOMEM
- In ipfw_init check the return value of init_tables and free up any mutexes or
  UMA zones which may have been created.
- Assert that the supplied table is not NULL before attempting to dereference.

This fixes panics which were a result of invalid memory accesses due to failed
table allocation. This is an issue mainly because the R_Zalloc function is a
malloc(M_NOWAIT) wrapper, thus making it possible for allocations to fail.

Found by:	Coverity Prevent (tm)
Coverity ID:	CID79
MFC after:	1 week
2006-01-20 05:35:27 +00:00
Ariff Abdullah
9ca45dd7dc Ruthless vchan speed workaround against the dreaded sb16 / sb16x. It appear
that nothing else using this weird 45k / 49k speed upper limit.
2006-01-20 03:46:02 +00:00
Christian S.J. Peron
e9186cb94b Destroy the dynamic rule zone in the event that we fail to insert the
initial default rule.

MFC after:	1 week
2006-01-20 03:21:25 +00:00
Olivier Houchard
0e187240e1 Build a minimal pagetables, with only section mappings, mapped write through,
to speed up the decompression.
2006-01-20 00:46:44 +00:00
Jim Rees
c1f097baba Use nfs4_disconnect for connections opened with nfs4_connect.
Submitted by:	cel@citi.umich.edu
MFC after:	1 week
2006-01-19 22:48:31 +00:00
Daniel Hartmeier
31f9d10a77 fix a bug in the fragment cache (used for 'scrub fragment crop/drop-ovl',
but not 'fragment reassemble'), which can cause some fragments to get
inserted into the cache twice, thereby violating an invariant, and panic-
ing the system subsequently.

Reviewed by:	mlaier
MFC after:	1 day
2006-01-19 11:46:45 +00:00
Jason Evans
d72cd77975 Add the RB_PROTOTYPE_STATIC and RB_GENERATE_STATIC macros.
Approved by:	markm (mentor)
2006-01-19 07:20:20 +00:00
Sam Leffler
239cc3b6ce Rev ioctl to get scan results:
o lock the list walk
o malloc a results buffer instead of copying out one result at a time
  using an on-stack buffer
o fix definition of ieee80211req_scan_result so size of variable-length
  information elements is large enough to hold all possible ie's
  (still only return wpa+wme, at some point may return all)
o make rssi+noise data signed; they should've been so all along
o add a bit more padding for future additions while we're here
o define a new ioctl for new api and add compat code for old ioctl
  under COMPAT_FREEBSD6 (temporarily enabled local to the file)

Reviewed by:	Scott Long
MFC after:	2 weeks
2006-01-18 22:17:50 +00:00
Pawel Jakub Dawidek
4f9bcb9f4f Fix bio leak in case of malloc(9) failure.
Found by:	Coverity Prevent(tm)
Coverity ID:	CID794
MFC after:	3 days
2006-01-18 21:44:57 +00:00
Pawel Jakub Dawidek
e9b936c73c Remove dead code.
Found by:	Coverity Prevent(tm)
Coverity ID:	CID105
MFC after:	3 days
2006-01-18 21:43:27 +00:00
Pawel Jakub Dawidek
a49c0bd40a Remove dead code.
Found by:	Coverity Prevent(tm)
Coverity ID:	CID104
MFC after:	3 days
2006-01-18 21:42:19 +00:00
Julian Elischer
11f4763dd4 Return the thread name in the kinfo_proc structure.
Also correct the comment describing what the value is.
2006-01-18 20:27:43 +00:00
Julian Elischer
e1189b25d4 Duh! put the thread name into the section that is zero'd on allocation
(by default there is no name)
2006-01-18 20:18:40 +00:00
Julian Elischer
2c9a55e142 Congratulations, we now have a place for a thread to store its name.
Will be needed when we start using real threads in the kernel instead
of whole pseudo-processes.
2006-01-18 20:12:14 +00:00
Sam Leffler
a1a5050276 bump the scan generation number before iterating so we're guaranteed
to have a value that's not been used before; this fixes the problem
where the first traversal of the scan list did nothing because the
entries were initialized with the current generation number (a
separate issue)

MFC after:	1 week
2006-01-18 19:56:17 +00:00
Andre Oppermann
0270746230 Do not derefence the ip header pointer in the IPv6 case.
This fixes a bug in the previous commit.

Found by:	Coverity Prevent(tm)
Coverity ID:	CID253
Sponsored by:	TCP/IP Optimization Fundraise 2005
MFC after:	3 days
2006-01-18 18:59:30 +00:00
Marcel Moolenaar
383bd4fd1e Remove ELF dynamic tag definitions that aren't used. Ideally,
those that are used should come from <machine/elf.h>.
2006-01-18 18:49:25 +00:00
Andre Oppermann
8f8d29f686 In in_delayed_cksum() we can't perform a m_pullup() as it may
change the mbuf pointer and we don't have any way of passing
it back to the callers.  Instead just fail silently without
updating the checksum but leaving the mbuf+chain intact.

A search in our GNATS database did not turn up any match for
the existing warning message when this case is encountered.

Found by:	Coverity Prevent(tm)
Coverity ID:	CID779
Sponsored by:	TCP/IP Optimization Fundraise 2005
MFC after:	3 days
2006-01-18 18:49:16 +00:00
Andre Oppermann
79eb490467 In syncache_expand() insert a proper syncache_free() to fix a case
that currently can't be triggered.  But better be safe than sorry
later on.  Additionally it properly silences Coverity Prevent for
future tests.

Found by:	Coverity Prevent(tm)
Coverity ID:	CID802
Sponsored by:	TCP/IP Optimization Fundraise 2005
MFC after:	3 days
2006-01-18 18:25:03 +00:00
John Baldwin
25e498b4b0 Always include the lock_classes[] array in the kernel. The
"is it a spinlock" test in mtx_destroy() needs it even in non-debug
kernels.

Reported by:	danfe
2006-01-18 18:02:50 +00:00
Ruslan Ermilov
4006cd2b3f Fix two accesses to uninitialized variables that a revision 1.27
has introduced.

Found with:	Coverity Prevent(tm)
2006-01-18 16:09:00 +00:00
Andre Oppermann
39550088cf Prevent dereferencing a NULL route pointer when trying to update the
route MTU.

This bug is very difficult to reach and not remotely exploitable.

Found by:	Coverity Prevent(tm)
Coverity ID:	CID162
Sponsored by:	TCP/IP Optimization Fundraise 2005
MFC after:	3 days
2006-01-18 15:05:05 +00:00
Gleb Smirnoff
4e7ba1ab94 Be ready to a case when not a constant number of segments is returned
by bus_dmamap_load_mbuf_sg() on jumbo buffer allocation.

Reviewed by:	scottl, gallatin
2006-01-18 14:31:21 +00:00
Andre Oppermann
5d691e6da8 Return mbuf pointer or NULL from ip_fastforward() as the mbuf pointer
may have changed by m_pullup() during fastforward processing.

While this is a bug it is actually never triggered in real world
situations and it is not remotely exploitable.

Found by:	Coverity Prevent(tm)
Coverity ID:	CID780
Sponsored by:	TCP/IP Optimization Fundraise 2005
2006-01-18 14:24:39 +00:00
Søren Schmidt
b258da4ee8 Correct two promise entries, these are only 2port SATA. 2006-01-18 13:34:28 +00:00
Søren Schmidt
8453acf105 Whitespace cleanup. 2006-01-18 13:10:17 +00:00
Pawel Jakub Dawidek
481b55b1e3 Style cleanups.
X-MFC-after:	Already MFCed to RELENG_6 by accident.
2006-01-18 11:03:20 +00:00
Søren Schmidt
ac1731fb20 Properly report SATA connection speed. 2006-01-18 10:02:23 +00:00
Gleb Smirnoff
8d6b240b0d Check ifp before dereferencing it in xl_detach(). xl_detach() can be called
from xl_attach(), when ifp is not defined yet.

Found with:	Coverity Prevent(tm)
2006-01-18 09:42:21 +00:00
Søren Schmidt
f5f55db308 Add support for using DMA on dump, greatly speeds up the dump process.
Add dump support in ataraid.
2006-01-18 09:14:55 +00:00
Colin Percival
9238d0aff6 Correct a buffer overflow when scanning for 802.11 wireless networks.
Security:	FreeBSD-SA-06:05.80211
2006-01-18 09:03:15 +00:00
Matt Jacob
fba92123ac Fix ioctl to not get swallowed by ioctl code (i.e., make sure the darned
code sticks within 8 bits)

MFC after:	1 week
2006-01-18 08:37:27 +00:00
David Xu
74bcd9d280 Eliminate a stale instruction introduced in revision 1.136. 2006-01-18 06:42:42 +00:00
Marcel Moolenaar
7ee3d29ed6 o Add missing relocations.
o  Minor white-space fixups.
2006-01-18 01:45:57 +00:00
Ariff Abdullah
4aee05133b Remove Giant / busdma_lock_mutex from busdma_tag_create(). 2006-01-18 01:01:37 +00:00
Oleg Bulyzhin
6fb34dd2ed - Count packets discarded by RX/TX MAC (cause of FIFO overflow, etc)
as input/output interface errors.
 - Keep values of rx/tx discards & tx collisions inside struct bge_softc.
   So we can keep statistic across ifconfig down/up runs (cause bringing
   bge up will reset chip).

Approved by:	glebius (mentor)
MFC after:	1 week
2006-01-17 23:01:58 +00:00
Marcel Moolenaar
853b7411b6 s/R_IA64_/R_IA_64_/g as per the ia64 psABI. 2006-01-17 21:03:22 +00:00
Juli Mallett
b241b0a239 Since p_cansee will end up dereferencing p_ucred, don't check for p_ucred
equal to NULL several times later.  p_ucred "should probably not" be NULL
if the process isn't PRS_NEW anyway.  This is strongly reinforced by the fact
that we don't see frequent crashes here.  Remove the checks after p_cansee and
add a KASSERT right before it.

Found by:	Coverity Prevent (tm)

Also trim one nearby trailing space.
2006-01-17 20:25:01 +00:00
Alfred Perlstein
92e73f5711 I ran into an nfs client panic a couple of times in a row over the
last few days.  I tracked it down to the fact that nfs_reclaim()
is setting vp->v_data to NULL _before_ calling vnode_destroy_object().
After silence from the mailing list I checked further and discovered
that ufs_reclaim() is unique among FreeBSD filesystems for calling
vnode_destroy_object() early, long before tossing v_data or much
of anything else, for that matter.  The rest, including NFS, appear
to be identical, as if they were just clones of one original routine.

The enclosed patch fixes all file systems in essentially the same
way, by moving the call to vnode_destroy_object() to early in the
routine (before the call to vfs_hash_remove(), if any).  I have
only tested NFS, but I've now run for over eighteen hours with the
patch where I wouldn't get past four or five without it.

Submitted by: Frank Mayhar
Requested by: Mohan Srinivasan
MFC After: 1 week
2006-01-17 17:29:03 +00:00
John Baldwin
2971d7ab9b Fix a memory leak I introduced with the hostb/vgapci stuff.
Reported by:	Coverity (via dfr's clue-bat)
2006-01-17 17:02:45 +00:00
John Baldwin
6ef970a972 Bah. Fix 'show lock' to actually be compiled in. I had just fixed this in
p4 but had an older subr_lock.c on the machine I committed to CVS from.
2006-01-17 16:58:32 +00:00
John Baldwin
83a81bcb14 Add a new file (kern/subr_lock.c) for holding code related to struct
lock_obj objects:
- Add new lock_init() and lock_destroy() functions to setup and teardown
  lock_object objects including KTR logging and registering with WITNESS.
- Move all the handling of LO_INITIALIZED out of witness and the various
  lock init functions into lock_init() and lock_destroy().
- Remove the constants for static indices into the lock_classes[] array
  and change the code outside of subr_lock.c to use LOCK_CLASS to compare
  against a known lock class.
- Move the 'show lock' ddb function and lock_classes[] array out of
  kern_mutex.c over to subr_lock.c.
2006-01-17 16:55:17 +00:00
Joseph Koshy
2b01a08446 Fix a memory leak.
Found by:	Coverity
2006-01-17 16:53:50 +00:00
John Baldwin
550d1c9392 Initialize thread0.td_contested in init_turnstiles() rather than
mutex_init() as it is used by the turnstile code and is not mutex-specific.
2006-01-17 16:47:42 +00:00
John Baldwin
2037434379 Update a stale comment. 2006-01-17 16:44:34 +00:00
John Baldwin
3eb9cab0c6 Garbage collect turnstile_empty() since it is unused. 2006-01-17 16:40:20 +00:00
Poul-Henning Kamp
25a14196dd Fix an 11 year old mistake: Let the hash functions take a void* instead
of unsigned char* argument.
2006-01-17 15:35:57 +00:00
Pawel Jakub Dawidek
a1c10dcb4c Move $FreeBSD$ from comment to __FBSDID(). 2006-01-17 11:48:16 +00:00
Pawel Jakub Dawidek
7d54b385a6 - Use better types.
- Log problems at level 0 when killing providers.

MFC after:	3 days
2006-01-17 07:32:43 +00:00
Pawel Jakub Dawidek
b5f30223fc Check return value.
Found by:	Coverity Prevent(tm)
MFC after:	3 days
2006-01-17 07:30:34 +00:00
Pawel Jakub Dawidek
7192f621d0 Remove dead code.
Found by:	Coverity Prevent(tm)
MFC after:	3 days
2006-01-17 07:27:46 +00:00
Pawel Jakub Dawidek
4ec0490779 Remove unused value.
Found by:	Coverity Prevent(tm)
MFC after:	3 days
2006-01-17 07:26:48 +00:00
Pawel Jakub Dawidek
58d85f544f Log situation when EIO is returned. 2006-01-17 07:23:36 +00:00
Pawel Jakub Dawidek
54df0743c7 Remove bio leak when EIO error is emulated.
Found by:	Coverity Prevent(tm)
MFC after:	3 days
2006-01-17 07:22:44 +00:00
Pyun YongHyeon
e0078c6436 The number of ticks per usec for YUKON_EC is 125. 2006-01-17 06:58:25 +00:00
Pyun YongHyeon
1a98c9b4a2 fix Rx checksum computation on little endian systems.
Reported & Tested by:	brad@OpenBSD
2006-01-17 06:02:22 +00:00
Pyun YongHyeon
c57c874824 fix interrupt moderation timer frequencies for Yukon
Obtained from:	OpenBSD
2006-01-17 05:57:44 +00:00
Pyun YongHyeon
878793bc2f remove trailing spaces 2006-01-17 05:41:20 +00:00
Tor Egge
dffaf91aa3 Set flag in needsbuffer while still holding bqlock to avoid lost wakeup. 2006-01-16 22:09:47 +00:00
Ariff Abdullah
d8f1a170d9 Fix broken capabilites. There are possible calculation errors within
ess_calcspeed8() and ess_calcspeed9() that need to be fixed as well
(TODO).

Reported by:	[1] Claude Buisson <cbuisson at nerim.net>
MFC after:	3 days

[1] http://lists.freebsd.org/pipermail/freebsd-multimedia/2006-January/003566.html
2006-01-16 20:01:33 +00:00
Ariff Abdullah
ed3b31fc67 ehci_pci.c:
ATI EHCI controllers exhibit simmilar stall issues and require
	this dropped interrupts workaround. Be verbose about it.
ehci.c:
ehcivar.h:
	Slight change in comments to note about issues surrounding both
	VIA and ATI EHCI controllers.

Approved by:	iedowse
2006-01-16 19:23:59 +00:00
Ariff Abdullah
d26f1706b9 Add PCI vendor id for ATI OHCI USB controllers.
Approved by:	iedowse
2006-01-16 19:07:05 +00:00
Christian S.J. Peron
ed9e2ed449 Although we check the return value of copyin(9) while determaining how
long the string is in userspace, afterwards we call malloc(M_WAITOK),
which could sleep for an unknown amount of time. Check the return
value of copyin(9) just to be sure that nothing has changed during that
time.

Found with:	Coverity Prevent (tm)
MFC after:	1 week
2006-01-16 17:03:21 +00:00
Ruslan Ermilov
b2c9ed2d83 Fix standalone module build.
Reported by:	Boris Samorodov <bsam@ipt.ru>
2006-01-16 17:03:06 +00:00
Ruslan Ermilov
150636cae7 I couldn't find any traces of what the tags1 file was supposed to do. 2006-01-16 16:25:17 +00:00
Ariff Abdullah
2fd8d3d84e Restore old compatibility of feeding directly into /dev/dsp at 8000 hz
while preserving the New World Order.

Discussed with:	[1] Michael W. Oliver <michael at gargantuan.com>
MFC after:	1 week

[1] http://lists.freebsd.org/pipermail/freebsd-multimedia/2006-January/003562.html
2006-01-16 11:07:15 +00:00
Kris Kennaway
0c6913cd9a Correct typos (s/OFERFLOW/OVERFLOW/).
Reviewed by:	jhb
2006-01-16 01:35:25 +00:00
Ian Dowse
afcb6f8261 Work around a problem seen on VIA EHCI controllers where occasionally
an interrupt appears to occur before the transfer has been marked
as completed. This caused umass transfers to get stuck, especially
when writing large files. The workaround sets up a timer that
rechecks for missed completed transfers if some operations are still
pending. Other suggested workarounds, such as performing a PCI read
immediately after acknowledging the interrupts, do not appear to
help.

Obtained from:	OpenBSD
2006-01-15 21:03:19 +00:00
Ian Dowse
df3e5efa87 Set sc_dying to 1 when detaching. In NetBSD and OpenBSD this was
done by the DVACT_DEACTIVATE case in *hci_activate(), but we don't
use that code in FreeBSD so it was never set.
2006-01-15 20:41:04 +00:00
Ian Dowse
c15e3d30c7 The ehci driver doesn't use the transfer `hcpriv' field, so don't
bother setting it to NULL in ehci_root_ctrl_done().
2006-01-15 20:32:52 +00:00
Christian S.J. Peron
323203d389 vfs_busy can only return something useful if MNTK_UNMOUNT has been set.
Since we are using vfs_busy() on a freshly allocated mount structure, use
(void) to show that we do not care about the return value.

Found with:	Coverity Prevent (tm)
MFC after:	2 weeks
2006-01-15 20:14:11 +00:00
Robert Watson
6994eebcab Cast VFS_STATFS() in vfs_domount() to (void) to indicate that ignoring the
return value is intentional: this is simply an attempt to pre-cache the
statfs state.

Found with:	Coverity Prevent (tm)
MFC after:	3 days
2006-01-15 20:01:05 +00:00
Robert Watson
d248c7d7f5 Modify the IP fragment reassembly code so that it uses a new UMA zone,
ipq_zone, to allocate fragment headers from, rather than using cast mbuf
storage.  This was one of the few remaining uses of mbuf storage for
local data structures that relied on dtom().  Implement the resource
limit on ipq's using UMA zone limits, but preserve current sysctl
semantics using a sysctl proc.

MFC after:	3 weeks
2006-01-15 18:58:21 +00:00
Robert Watson
dfa60d9354 Staticize ipqlock, since it is local to ip_input.c.
MFC after:	3 days
2006-01-15 17:05:48 +00:00
Robert Watson
f0ee42d0f1 Don't leak mbufs and mbuf clusters in several error-handling situations
in the if_an receive routine.

Found with:	Coverity Prevent (tm)
MFC after:	1 week
2006-01-15 12:09:03 +00:00
Robert Watson
63e0298298 If frame length is excessive, don't leak an mbuf and cluster when
abandoning processing.

Found with:	Coverity Prevent (tm)
MFC after:	1 week
2006-01-15 12:06:09 +00:00
Warner Losh
a7d46e8cf1 I don't believe these are used at all, and can be safely removed 2006-01-15 06:49:28 +00:00
Warner Losh
f91fdbc2cc Add support for the Compaq LTE docking station. It includes a plug
and play device with the ID of PNP8160.  Sotr them while I'm here.

Submitted by:	Sean Shapira    sds at jazzie dotty com
MFC After: 1 week
2006-01-15 04:10:47 +00:00
Robert Watson
ea6d62f195 Rename uid and gid arguments to vaccess() prototype to match vaccess()
implementation in vfs_subr.c.  No functional change.

MFC after:	3 days
2006-01-15 02:01:51 +00:00
Christian S.J. Peron
8213baf002 Initialize ki to p->p_aioinfo after we know it's going to be referencing
a valid kaioinfo structure. This avoids a potential NULL pointer dereference.

Found with:	Coverity Prevent(tm)
MFC after:	2 weeks
2006-01-15 01:55:45 +00:00
Bjoern A. Zeeb
2166476ae9 Remove unused code.
Found with:	Coverity Prevent(tm)
2006-01-15 01:39:01 +00:00
Christian S.J. Peron
e121674042 Fix potential overrun of static stack allocated array which stores
the rules. If an array is N elements large, we can only access
elements 0..(N-1).

MFC after:	1 week
Found with:	Coverity Prevent(tm)
2006-01-15 01:02:20 +00:00
Ariff Abdullah
f432c562bf Add another inverted EAPD quirk for Gateway 7326GZ.
Tested by:	Jeff Cross <jeff.cross at averageadmins.com>
MFC after:	3 days
2006-01-14 23:37:08 +00:00
Max Laier
4cd9957a80 Move m_adj after checking that m_dup succeeded.
Found with:	Coverity Prevent(tm)
MFC after:	3 days
2006-01-14 22:19:17 +00:00
Gleb Smirnoff
929d59e2fe Initialize variable.
Found with:	Coverity Prevent(tm)
2006-01-14 21:49:31 +00:00
Gleb Smirnoff
efa3bacc86 Make code simplier fixing memory leak.
Found with:	Coverity Prevent(tm)
2006-01-14 21:28:30 +00:00
Ruslan Ermilov
6a61c14ee1 AMD64 also supports disk slices. 2006-01-14 20:47:11 +00:00
Ruslan Ermilov
90ee1f3a04 Ignore spurious '\0' first character read on a serial console.
This allows me to "boot -a" over a serial console.  Tested on
several machines.
2006-01-14 20:45:02 +00:00
Scott Long
a4d3c74487 Check the return value of copyin.
Found by: Coverity Prevent (tm)
2006-01-14 17:59:28 +00:00
Brooks Davis
30e3426947 When SC_DISABLE_KDBKEY or SC_DISABLE_REBOOT are not defined allow the
same behavior to be controlled by the sysctls, hw.syscons.kbd_kbdkey
and hw.syscons.kbd_reboot respectively.

Apologies to the submitter for taking so long to commit this simple
change.

PR:		kern/72728
Submitted by:	Luca Morettoni <morettoni at libero dot it>
MFC After:	3 days
2006-01-14 17:57:17 +00:00
Scott Long
59caf6ec50 Don't base the number of jumbo segments on page size, instead base it on the
fact that jumbo desriptors are defined to have 3 segments.

Found by: Coverity Prevent(tm)
2006-01-14 17:42:22 +00:00
Scott Long
0af57729a6 Free the newtag if we exit with a failure from alloc_bounce_zone().
Found by: Coverity Prevent(tm)
2006-01-14 17:22:47 +00:00
George V. Neville-Neil
34f83c52e7 Check the correct TTL in both the IPv6 and IPv4 cases.
Submitted by:	glebius
Reviewed by:	gnn, bz
Found with:     Coverity Prevent(tm)
2006-01-14 16:39:31 +00:00
Scott Long
9cbec74dcb Don't allocate an asr_ccb in asr_attach, it hasn't been needed for years. 2006-01-14 16:01:01 +00:00
Scott Long
19e9e8235d Replace bogus code with real code. 2006-01-14 15:59:54 +00:00
Scott Long
8f6ee34112 Rename driver_t variables. Use device_printf() instead of homerolled printf.
Use the provided softc instead of rolling our own.
2006-01-14 15:51:42 +00:00
Bjoern A. Zeeb
cc2824b8ae The LinkSys EG1032 is supported by re(4) not nge(4) [1].
I couldn't find the ID for the EG1064 anywhere in our sources
so I removed the reference for now.

Pointed out by:	Robert Huff <roberthuffi at rcn dot com> [1]
Reviewed by:	simon
2006-01-14 15:35:21 +00:00
Matt Jacob
de8fa52e52 Incorporate the O_NONBLOCK open semantics of Linux and Solaris. This allows
an application to upon a tape (yea, even the non-control device) even if
it cannot establish a mount session. If the open cannot establish a mount
session and O_NONBLOCK was specified, the tape becomes 'open pending mount'.
All I/O operations that would require access to a tape thereafter until
a close attempt to initiate the mount session. If the mount session succeeds,
the tape driver transitions to full open state, else returns an appropriate
I/O error (ENXIO).

At the same time, add a change that remembers whether tape is being opened
read-only. If so, disallow 'write' operations like writing filemarks that
bypass the normal read-only filtering operations that happen in the write(2)
syscall.

Reviewed by:	ken, justin, grog
MFC after:	2 weeks
Suggested by:	The Bacula Team
2006-01-14 14:32:41 +00:00
Gleb Smirnoff
6b5ac2b675 Remove dead code.
Found with:	Coverity Prevent(tm)
2006-01-14 14:17:27 +00:00
Joel Dahl
903b2fb964 - Add comments about snd_au88x0.
-  Clarify that snd_audiocs is for sparc64 only.
-  Expand snd_ich and snd_t4dwave comments.

Reviewed by:	ariff
2006-01-14 13:22:12 +00:00
Gleb Smirnoff
ecedca7441 UMA can return NULL not only in case when our zone is full, but
also in case of generic memory shortage. In the latter case we may
not find an old entry.

Found with:	Coverity Prevent(tm)
2006-01-14 13:04:08 +00:00
Gleb Smirnoff
f3d231b46b Correct off-by-one errors.
Found with:	Coverity Prevent(tm)
2006-01-14 12:26:32 +00:00
Gleb Smirnoff
222c1141ea Fix two memory leakages.
Found with:	Coverity Prevent(tm)
2006-01-14 12:16:39 +00:00
Robert Watson
7e9803e865 In ncp_sysctl_connstat(), the SLIST_FOREACH() logic to check 'error'
resulted in deadcode, as 'error' could never be 0.  What this logic
was originally meant to handle is not clear -- it's been this way
(broken) since at least RELENG_4.

Found with:	Coverity Prevent(tm)
MFC after:	3 days
2006-01-14 11:40:32 +00:00
Robert Watson
e5bc0aa3c3 Remove dead code: 'opts' is not used in udp_append(), only in udp_input(),
so no need to assign it to NULL or conditionally free it.

Found with:	Coverity Prevent(tm)
MFC after:	3 days
2006-01-14 11:18:32 +00:00
Poul-Henning Kamp
99425c6e7a Make resources do the right thing by design instead of accident.
Found with:   Coverity Prevent(tm)
2006-01-14 09:46:27 +00:00
Poul-Henning Kamp
c9df826b0a Correct STAILQ usage in purge of resourcelist.
Found with:   Coverity Prevent(tm)
2006-01-14 09:41:35 +00:00
Andrew Thompson
7c2fb83a0b Add code that clears certain capabilities from the member interface, these are
restored when its removed from the bridge.

At the moment we only clear IFCAP_TXCSUM. Since a locally generated packet on
the bridge may be sent out any one or more interfaces it cant be assumed that
every card does hardware csums. Most bridges don't generate a lot of traffic
themselves so turning off offloading won't hurt, bridged packets are
unaffected.

Tested by:	Bruce Walker (bmw borderware.com)
MFC after:	5 days
2006-01-14 03:51:31 +00:00
Scott Long
0f92108d32 Add the following to the taskqueue api:
taskqueue_start_threads(struct taskqueue **, int count, int pri,
			const char *name, ...);

This allows the creation of 1 or more threads that will service a single
taskqueue.  Also rework the taskqueue_create() API to remove the API change
that was introduced a while back.  Creating a taskqueue doesn't rely on
the presence of a process structure, and the proc mechanics are much better
encapsulated in taskqueue_start_threads().  Also clean up the
taskqueue_terminate() and taskqueue_free() functions to safely drain
pending tasks and remove all associated threads.

The TASKQUEUE_DEFINE and TASKQUEUE_DEFINE_THREAD macros have been changed
to use the new API, but drivers compiled against the old definitions will
still work.  Thus, recompiling drivers is not a strict requirement.
2006-01-14 01:55:24 +00:00
Markus Brueffer
f93120994e - Add support for setting the fan control mode to manual or automatic
- Add support for adjusting the fan speed if the fan control mode is manual

Documentation for the relevant embedded controller register was obtained from
http://www.thinkwiki.org/wiki/Patch_for_controlling_fan_speed

Tested on:	R51  by Fabian Keil
		T41p by markus
Requested by:	many
Approved by:	philip
MFC after:	1 week
2006-01-14 00:39:10 +00:00
Robert Watson
fc4c825847 When storing the results of malloc() in a pointer to a pointer, check
the pointer to a pointer for NULL, not the pointer for NULL.

Noticed by:	Coverity Prevent analysis tool
MFC after:	3 days
2006-01-14 00:09:41 +00:00
Robert Watson
71c47d1480 In spx_attach() and spx_detach(), there is no need to check whether the
ipxpcb is NULL or not: in attach it will be, and on detach it won't be.
If for any reason these invariants don't hold true, panicking is a good
idea.

Noticed by:	Coverity Prevent analysis tool
MFC after:	3 days
2006-01-14 00:05:44 +00:00
Robert Watson
2ab392c630 In ipcomp6_input(), check 'md' not 'm' after a call to m_pulldown(): 'm'
may be a stale pointer at this point, and we're interested in whether or
not m_pulldown() failed.

Noticed by:	Coverity Prevent analysis tool
MFC after:	3 days
2006-01-13 23:53:23 +00:00
Jung-uk Kim
9857ff20da - Correct amr_enquiry3 structure[1].
- Remove redundant AMR_CONFIG_ENQ3_SOLICITED_NOTIFY from the previous
commit while I am here.

PR:		kern/29727 [1]
2006-01-13 23:50:21 +00:00
Robert Watson
bfcff7c78e Remove dead code associated with 'mcopy' in ipx_forward(): at no point
are the contents of the forwarded mbuf ever copied into mcopy, so there's
no need to have mcopy, conditionally look at mcopy, or conditionally free
it.

Noticed by:	Coverity Prevent analysis tool
MFC after:	3 days
2006-01-13 23:47:55 +00:00
Robert Watson
bc03ea7f49 When calling bioq_first() to see if a queue is empty in bioq_disksort(),
don't save the return value as we won't use it.

Noticed by:	Coverity Prevent analysis tool
MFC after:	3 days
2006-01-13 23:27:12 +00:00
Robert Watson
3208581a15 Check the right ifnet pointer to see if if_alloc() failed or not in
ef_clone(); we were testing the original ifnet, not the one allocated.

When aborting ef_clone() due to if_alloc() failing, free the allocated
efnet structure rather than leaking it.

Noticed by:	Coverity Prevent analysis tool
MFC after:	3 days
2006-01-13 23:24:09 +00:00
Robert Watson
ae7c484e82 When freeing the chain of if_ef devices on an aborted load, use
SLIST_FOREACH_SAFE() rather than SLIST_FOREACH(), as elements are
freed on each iteration of the loop.  This prevents use-after-free.

Noticed by:	Coverity Prevent analysis tool
MFC after:	3 days
2006-01-13 23:20:46 +00:00
Robert Watson
63074a901a In nfs_dolock(), GC now under-used ioflg, rendered obsolete when we moved
from using a fifo to talk to rpc.lockd to using a special device node.

Noticed by:	Coverity Prevent analysis tool
MFC after:	3 days
2006-01-13 23:16:29 +00:00
Ariff Abdullah
97efeca38d Workaround for sb16 behave poorly when running at 45000 hz while
vchan is enabled.

Reported by:	many sb16, AWE64 users.
MFC after:	1 week
2006-01-13 18:10:43 +00:00
Marcus Alves Grando
fa1d87f552 Allow to use Time DPA20B 1GB MP3 Player [1]
Allow to use Qware BeatZkey! Pro [2]

PR:             usb/81846 [1], usb/79164 [2]
Submitted by:   Ruben de Groot <rdg@bzerk.org> [1], Radek Kozlowski <radek@raadradd.com> [2]
Approved by:    njl
MFC:            1 week
2006-01-13 11:33:40 +00:00
Robert Watson
b8ae1cd619 Add sosend_dgram(), a greatly reduced and simplified version of sosend()
intended for use solely with atomic datagram socket types, and relies
on the previous break-out of sosend_copyin().  Changes to allow UDP to
optionally use this instead of sosend() will be committed as a
follow-up.
2006-01-13 10:22:01 +00:00
Oleg Bulyzhin
1f313773f3 1) move all link state detection code from bge_tick_locked() to bge_link_upd()
2) use more robust way of link state handling for BCM5700 rev.B2 chip
3) workaround bug of some BCM570x chips which cause spurious "link up" messages
4) fix bug: some BCM570x chips was unable to detect link state changes after
   ifconfig down/up sequence until any 'non-link related' interrupt generated.
   (this happened due to pending internal link state attention which blocked
   interrupt generation)

Approved by:	glebius (mentor)
MFC after:	1 week
2006-01-13 08:59:40 +00:00
Scott Long
77d9852a55 Fix the interrupt race for real. Don't register the interrupt until after
the the interface has been configured.  I'm not sure how this could ever
have worked before, but it should be fixed now.  Also break out the interrupt
degresitration function into it's own step.
2006-01-13 08:18:04 +00:00
Scott Long
87a444e62e Disable interrupts while we are setting up the handler. The interrupt really
shouldn't be set up or enabled until much later, but that will be investigated
at a later time.
2006-01-13 05:04:27 +00:00
Ariff Abdullah
8c437e077b Joyport blacklist. Either we're facing with broken hardware
or because this hardware need special (unknown) initialization
procedures.

Reported by:	[1] Rob Clark <vx2 at tds.net>
MFC after:	3 days

[1] http://lists.freebsd.org/pipermail/freebsd-multimedia/2006-January/003535.html
2006-01-13 04:54:34 +00:00
Robert Watson
d7dca9034c XXX a comment in uipc_usrreq.c that requires updating. 2006-01-13 00:00:32 +00:00
Gleb Smirnoff
73189791f2 When sending export datagram from interrupt thread, use NG_QUEUE
in flags. When sending export datagram from expiry thread, then
use default zero flags. This removes unpleasant contention of the
interrupt thread on mutexes (usually ng_ksocket's socket buffer
mutex).
2006-01-12 22:48:12 +00:00
Gleb Smirnoff
7383c92c9f Provide additional macros for sending netgraph items, which allow
to use non-default flags for netgraph functions. Implement current
macros via new ones.
2006-01-12 22:44:04 +00:00
Gleb Smirnoff
2955ee1802 - Print also node ID in ktr(9) messages. [1]
- Use fixed length for function name, making ktrdump(8) output
  easier to read.

Suggested by:	julian [1]
2006-01-12 22:41:32 +00:00
Bruno Ducrot
ab033fa0e3 * fix bst.status. We mark some bits, but forgot to reset all of them
before.  The symptom is that the battery inform us its charge and discharge
  at the same time...

* fix bst.rate to correctly output the (dis)charging rate.  We'll use
  the current average over one minute command and not the at_rate command.
  Note that this method is not correct if the capacity_mode is set, but
  since we don't set it ourself, it is not a problem.

  The at_rate do not give the actual rate but is used to compute the
  estimated time for (dis)charging a battery.  We should actually
  write an estimation of the actual rate using at_rate cmd and then
  perform a read to the various estimators.

Approved by:	njl
MFC after:	2 days
2006-01-12 21:56:37 +00:00
Gleb Smirnoff
04b3fa1623 Do not force queueing on peer hooks. This was important only for
5.0-CURRENT. And it looks like this didn't work before Julian's
revamp of netgraph queue code.

Reviewed by:	julian
2006-01-12 21:09:12 +00:00
Andrew Thompson
54c427e0e2 Include the bridge interface itself in the special arp handling.
PR:		90973
MFC after:	1 week
2006-01-12 21:05:30 +00:00
Gleb Smirnoff
22b286280c Remove old debugging leftover.
Reviewed by:	julian
2006-01-12 21:03:09 +00:00
Brooks Davis
3d11d44ca1 Belated __FreeBSD_version bump for improvements to the Linux ldconfig
support in etc/rc.d/abi.
2006-01-12 20:27:35 +00:00
Gleb Smirnoff
3d9dddcd0f Mark appropriate commands with NGM_READONLY and NGM_HASREPLY and
bump type cookie.
2006-01-12 19:16:08 +00:00
Alfred Perlstein
7d7e053c21 Novel idea, don't print a string if it is NULL!
This protects people from loading _really_ old modules, like say from
5.x to a 6.x or 7.x system, like for instance right after an upgrade.
2006-01-12 19:15:14 +00:00
Gleb Smirnoff
2df050ad10 In the splnet(9) times netgraph(4) was synchronous and if a message
had been replied, the reply was always delivered to the originator
synchronously.

With introduction of netgraph item callbacks and a wait channel with
mutex in ng_socket(4), we have fixed the problem with ngctl(8) returning
earlier than the command has been proceeded by target node. But still
ngctl(8) can return prior to the reply has arrived to its node.

To fix this:
 - Introduce a new flag for netgraph(4) messages - NGM_HASREPLY.
   This flag is or'ed with message like NGM_READONLY.
 - In netgraph userland library if we have sent a message with
   NGM_HASREPLY flag, then select(2) until reply comes.
 - Mark appropriate generic commands with NGM_HASREPLY flag,
   gathering them into one enum {}. Bump generic cookie.
2006-01-12 19:14:40 +00:00
Marius Strobl
e4846391da In moduledir_readhints() cast the value returned by sizeof() to ssize_t
when checking whether it's greater than a struct stat st_size in order
to also catch the case when st_size is -1. Previously this check didn't
trigger on sparc64 when st_size is -1 (as it's the case for a file on
a bzipfs, TFTP server etc.), causing the content of the linker hints
file to be copied to memory referenced by a null-pointer.

PR:		91231
MFC after:	1 week
2006-01-12 13:18:49 +00:00
Marius Strobl
a9f4f750ff - The inline asm in this file uses output operands before all input
operands are consumed so use the appropriate constraint modifier.
  Before this change GCC used one register for both an input and an
  unrelated output operand of in_addword(), causing the input to be
  overwritten before it was consumed and thus breaking in_addword().
  For in_cksum_hdr() and in_pseudo() this change is more or less
  cosmetic.
- Fix a misspelling in a nearby comment.

Reported & tested by:	yongari
MFC after:		1 week
2006-01-12 11:40:39 +00:00
Gleb Smirnoff
1be0418cbc Fix wording in last commit.
Submitted by:	julian
2006-01-12 10:15:51 +00:00
David E. O'Brien
f8ed1e340d Move linux support to the linux section. 2006-01-12 01:20:59 +00:00
Ariff Abdullah
1738f66243 Fix broken playback capabilities to prevent impending disaster.
The minimum / maximum speed was way too low / high!

minspeed =   2000 - is this for real ?
maxspeed = 767999 - is this for real ?????

Wrap everything into 8000 - 48000 boundary, just to be safe.

MFC after:	3 days
2006-01-11 23:22:57 +00:00
Jason Evans
06115e083a Add the RB_NFIND() macro, which is useful for red-black tree searches
for which there may not be an exact match.

Reviewed by:	glebius, julian
Approved by:	markm (mentor)
2006-01-11 15:48:36 +00:00
Gleb Smirnoff
3b33fbe7d4 Add ktr(9) hooks to easier tracing of the netgraph item flow through
netgraph.
2006-01-11 15:29:48 +00:00
Colin Percival
9ed97bee65 Correct insecure temporary file usage in texindex. [06:01]
Correct insecure temporary file usage in ee. [06:02]
Correct a race condition when setting file permissions, sanitize file
names by default, and fix a buffer overflow when handling files
larger than 4GB in cpio. [06:03]
Fix an error in the handling of IP fragments in ipfw which can cause
a kernel panic. [06:04]

Security:	FreeBSD-SA-06:01.texindex
Security:	FreeBSD-SA-06:02.ee
Security:	FreeBSD-SA-06:03.cpio
Security:	FreeBSD-SA-06:04.ipfw
2006-01-11 08:02:16 +00:00
Ariff Abdullah
40c012dd6d - Locking fixes. Release lock while chn_intr().
- Mark MPSAFE since most of the locking procedures already implemented.
- Turn on inverted external amplifier sense flag for selected boards.

Tested by:	bland
MFC after:	1 week
2006-01-11 08:02:15 +00:00
Brooks Davis
118b438d73 Get rid of the bogus IFP2FC() macro and use IFP2FWC(). IFP2FC()
attempted to cast a struct ifnet to a struct fw_com which resulted in
data corruption.

PR:		kern/91307
Submitted by:	Alex Semenyaka <alex at semenyaka do ru>
MFC After:	6 days
2006-01-11 05:37:21 +00:00
Ian Dowse
d3ef345454 When deregistering a bus, attempt to flush out all outstanding
operations before returning. Point the bus at a dummy cam_sim
structure so that any CCBs will complete immediately with a
CAM_DEV_NOT_THERE status, and ensure that any xpt_schedule() calls
on the bus's devices will immediately call the peripheral's
periph_start() routine. Also repeat the async messages because
devices that were part of the way through being probed may appear
after the original AC_LOST_DEVICE was sent, and would otherwise
never go away.

These changes make it possible to deregister a bus and free the SIM
at most stages during bus probing without the usual crashes in
camisr(). In particular, plugging in a umass device and then
unplugging it as soon as the first probe messages appeared would
almost always result in a crash. Now the device just goes away with
a few CAM errors and all references to the CAM bus, target and
device are dropped correctly.
2006-01-11 02:06:08 +00:00
Scott Long
1c3a3b0bd0 The interlock in taskqueue_terminate() is completely wrong for taskqueues
that use spinlocks.  Remove it for now.
2006-01-11 00:37:13 +00:00
Scott Long
2ff7d1b635 Significant performance improvements for the if_em driver:
- Only update the rx ring consumer pointer after running through the rx loop,
  not with each iteration through the loop.
- If possible, use a fast interupt handler instead of an ithread handler.  Use
  the interrupt handler to check and squelch the interrupt, then schedule a
  taskqueue to do the actual work.  This has three benefits:
  - Eliminates the 'interrupt aliasing' problem found in many chipsets by
    allowing the driver to mask the interrupt in the NIC instead of the
    OS masking the interrupt in the APIC.
  - Allows the driver to control the amount of work done in the interrupt
    handler.  This results in what I call 'adaptive polling', where you get
    the latency benefits of a quick response to interrupts with the
    interrupt mitigation and work partitioning of polling.  Polling is still
    an option in the driver, but I consider it orthogonal to this work.
  - Don't hold the driver lock in the RX handler.  The handler and all data
    associated is effectively serialized already.  This eliminates the cost of
    dropping and reaquiring the lock for every receieved packet.  The result
    is much lower contention for the driver lock, resulting in lower CPU usage
    and lower latency for interactive workloads.

The amount of work done in the taskqueue is controlled by the sysctl
dev.em.N.rx_processing_limit

and tunable
hw.em.rx_process_limit

Setting these to -1 effectively removes the limit.

The fast interrupt and taskqueue can be disabled by defining NO_EM_FASTINTR.
This work has been shown to increase fast-forwarding from ~570 kpps to
~750 kpps (note that the same NIC hardware seems unable to transmit more than
800 kpps, so this increase appears to be limited almost solely by the
hardware).  Gains have been shown in other workloads, ranging from better
performance to elimination of over-saturation livelocks.

Thanks to Andre Opperman for his time and resources from his network
performance project in performing much of the testing.  Thanks to Gleb
Smirnoff and Danny Braniss for their help in testing also.
2006-01-11 00:30:25 +00:00
Scott Long
2ffb18fec1 Don't use the ALLOCNOW flag for tags that will only be used for static
allocations.
2006-01-10 22:55:35 +00:00
Jim Rees
85bfb1d55c add nfsclient/, nfs4client/, and rpc/ directories to the
top Makefile's rule to build a cscope database.

Submitted by:	cel@citi.umich.edu
Approved by:	alfred
2006-01-10 20:58:27 +00:00
Poul-Henning Kamp
d3e64681d6 Move the old BSD4.3 tty compatibility from (!BURN_BRIDGES && COMPAT_43)
to COMPAT_43TTY.

Add COMPAT_43TTY to NOTES and */conf/GENERIC

Compile tty_compat.c only under the new option.

Spit out
	#warning "Old BSD tty API used, please upgrade."
if ioctl_compat.h gets #included from userland.
2006-01-10 09:19:10 +00:00
Ariff Abdullah
c02b454deb More thorough fixes to enable inverted external amplifier sense flag.
Instead of dragging the entire ICH4/82801DB into this mess, select
only few boards based on pci subdevice / subvendor.

Tested by:	Daisuke Orikasa <luxury-acura-3.5rl at nifty.com>
MFC after:	3 days
2006-01-10 06:52:59 +00:00
Scott Long
9df1a6dd61 Add functions and macros and refactor code to make it easier to manage
fast taskqueues.  The following have been added:

TASKQUEUE_FAST_DEFINE() - create a global task queue.
    an arbitrary execution context.
TASKQUEUE_FAST_DEFINE_THREAD() - create a global taskqueue that uses a
    dedicated kthread.
taskqueue_create_fast() - create a local/private taskqueue.

These are all complimentary of the standard taskqueue functions.  They are
primarily useful for fast interrupt handlers that can only use spinlock for
synchronization.

I personally think that the taskqueue API is starting to get too narrow and
hairy, but fixing it will require a major redesign on the API.  Such a
redesign would be good but would break compatibility with FreeBSD 6.x, so
it really isn't desirable at this time.

Submitted by: sam
2006-01-10 06:31:12 +00:00
Warner Losh
9b9c5e1cb1 Remove code describing pre 5.x system 2006-01-10 05:21:01 +00:00
Scott Long
174cda8010 Don't free the ap object if it was never created.
Submitted by: jkim
2006-01-10 01:55:17 +00:00
Takanori Watanabe
9f793d762d Hook ufoma module to build.
Pointed out by:thompsa
2006-01-10 00:54:18 +00:00
Tor Egge
82be0a5a24 Add marker vnodes to ensure that all vnodes associated with the mount point are
iterated over when using MNT_VNODE_FOREACH.

Reviewed by:	truckman
2006-01-09 20:42:19 +00:00
Tor Egge
6c62b2acd0 If the lock passed to getdirtybuf() is the softdep lock then the background
write completed wakeup could be missed.  Close the race by grabbing the lock
normally used for protection of bp->b_xflags.

Reviewed by:	truckman
2006-01-09 19:32:21 +00:00
Tor Egge
c8c7711d66 Broaden scope of softdep_worklist_busy rwlock protection of softdep processing
to avoid some dependencies being missed by softdep_flushworklist().

Reviewed by:	truckman
2006-01-09 19:16:56 +00:00
Tor Egge
012cbd3181 Obtain mount point lock before restarting sync loop if vget() failed.
Reviewed by:	truckman
2006-01-09 18:57:35 +00:00
Maxim Konovalov
036cd12a8d o Fix typo in the define: s/MRAK_INT_GEN/MARK_INT_GEN/. The typo
was harmless because the define is not used in coda_vfsops.c.

Submitted by:	Hugo Meiland
2006-01-09 18:07:06 +00:00
Takanori Watanabe
3db831b3d2 Add ufoma drivers in 'files', too. 2006-01-09 17:49:21 +00:00
Takanori Watanabe
a0fe548a14 Add FOMA (NTT DoCoMo 3G mobile phone system) driver.
This is based on MCPC USB mobile phone guide line (MCPC-GL005)
Some other 3G system or so will work with this driver.
Kyocera PHS terminal (a.k.a. Kyopon) is known to work, which
is now supported by umodem(4) driver.
2006-01-09 17:46:36 +00:00
Sam Leffler
7b0c77eca9 Update monitoring support:
o record tsf in tx+rx frames
o switch from raw rssi to dbm for signal data and record both
  signal and noise floor data (hacked for now to assume a fixed
  noise floor; is correct with new hal)
o add monpass sysctl to control which rx'd frames are passed
  up with errors; especially useful to see frames with CRC errors
o mark 'd packets w/ a CRC error with radiotap's BADFCS flag

Also add placeholder code for calibrating the noise floor when
using newer hals.

Reviewed by:	avatar
MFC after:	1 week
2006-01-09 17:13:20 +00:00
Sam Leffler
2204bcfd7c add flag to tag frames w/ a known bad FCS
Obtained from:	netbsd
MFC after:	1 week
2006-01-09 17:04:56 +00:00
Ariff Abdullah
be0fee94a7 Turn on inverted external amplifier sense flags for ICH4/82801DB.
PR:		kern/66422, kern/75687, kern/84471
MFC after:	2 days
2006-01-09 11:20:37 +00:00
SUZUKI Shinsuke
02ff33e2d0 added a note about the assumption for m->m_pkthdr.rcvif
Obtained from: KAME
MFC After: 1 day
2006-01-09 09:08:43 +00:00
Warner Losh
d5e61c97a6 By popular demand, move __HAVE_ACPI and __PCI_REROUTE_INTERRUPT into
param.h.  Per request, I've placed these just after the
_NO_NAMESPACE_POLLUTION ifndef.  I've not renamed anything yet, but
may since we don't need the __.

Submitted by: bde, jhb, scottl, many others.
2006-01-09 06:05:57 +00:00
Ariff Abdullah
7659fda352 Fix obvious capabilities (rate) violation. Should be 5500, not 4000.
MFC after:	1 day
2006-01-09 06:05:25 +00:00
Florent Thoumie
465ad22910 Enable NO_GETMAXLUN quirk.
PR:		usb/90670
Submitted by:	Wojciech A. Koszek <dunstan@freebsd.czest.pl>
Approved by:	iedowse
MFC after:	1 week
2006-01-09 01:33:53 +00:00
Ian Dowse
9a014e6f69 There should be no need to retry when the CCB status code is
CAM_LUN_INVALID or CAM_TID_INVALID. Retries were being triggered
here when a umass device was unplugged, and while the retries
themselves are probably harmless, they complicated finding the real
SIM removal problems.
2006-01-08 20:04:55 +00:00
Alexander Leidinger
b85f5cf149 Add support for Canon CanoScan D660U.
PR:		87395
Submitted by:	Eirik Mikkelsen <eirik@bsdbox.org>
2006-01-08 14:17:04 +00:00
Doug Barton
dfdae5534f Add a mechanism to include files added by ports which contain
the names of directories to include in the base ldconfig script.
This will eliminate the need for each port to install its own
boot script which does nothing but ldocnfig a given directory.

This code was developed by flz (ports committer), discussed on
freebsd-rc@, and modified slightly by me.

Submitted by:	flz
Reviewed by:	brooks
2006-01-08 10:15:31 +00:00
Ian Dowse
662f5fb6d9 Remove the UQ_NO_OPEN_CLEARSTALL quirk, as this is now the default
behaviour for all devices.
2006-01-08 03:34:29 +00:00
Ian Dowse
dd35c3642c Don't perform an endpoint stall clear every time a pipe is opened.
This should not be necessary, and it is known to confuse certain
devices.

Obtained from:	NetBSD
Requested by:	many
2006-01-08 03:27:43 +00:00
Florent Thoumie
d908e8fa84 Add Product ID for Acerscan 1240u and the corresponding entry in uscanner.c.
PR:		usb/91466
Submitted by:	Cameron Lerch <cam@zarya.org>
MFC after:	3 days
Approved by:	ssouhlal
2006-01-08 01:43:00 +00:00
Scott Long
861a23087b If destroying a spinlock, make sure that it is exited properly.
Submitted by: jhb
MFC After: 3 days
2006-01-08 00:18:34 +00:00
Warner Losh
1851bd711a While reviewing if_sn in an attempt to understand network drivers
better, I discovered sn doing too many pointer dereferences.  This
driver would do silly things like:
	sn_foo(struct ifnet *ifp)
	{
		struct sn_softc *sc = ifp->if_softc;

		sc->ifp->mumble
		/* Other stuff */
	}

while /* other stuff */ usually needed sc, the extra deref isn't
needed.  Eliminate a few dozen of them.
2006-01-07 19:29:25 +00:00
John Baldwin
3b783acd2a Revert an untested local change that crept in with the lo_class changes
and subsequently broke the build.  This change is supposed to fix the
case where doing a mtx_destroy() off a spin mutex while you hold it fails.
If it had been tested I would just leave it in, but it hasn't been tested
yet, so it will have to wait until later.
2006-01-07 14:03:15 +00:00
Ariff Abdullah
e1e05d5d12 Add codec id support for Analog Device AD1986 AC'97 codec.
Submitted by:	UMENO Takashi <umeno at rr.iij4u.or.jp>
PR:		kern/80234
MFC after:	2 days
2006-01-07 05:20:46 +00:00
David Xu
0a5cd498bb Add a new feature to thr_kill, if thread ID argument is -1, send
signals to all threads except current sender.
2006-01-07 03:15:21 +00:00
Tai-hwa Liang
75d6a87fa3 Trying to fix compilation bustage introduced in rev1.160 by converting
a missing lo_class to LO_CLASSINDEX().
2006-01-07 02:07:08 +00:00
Peter Grehan
162138c989 Set the siginfo si_addr field, and also the mysterious 3rd parameter
to old-style signals, to be the DAR register for DSI miss exceptions.
This gives the address of the access rather than the instruction
address. The behaviour is now the same as on i386.

Found by:  libsigsegv tests
2006-01-07 01:55:12 +00:00
Marcel Moolenaar
6d85ea7820 Fix FD_ISSET() on LP64 platforms. The FD_ISSET() function/macro is
defined to return an int, but on LP64 platforms the return value of
FD_ISSET() for file descriptors with a bit-index larger than 31 would
not fit an int (due to __fd_mask being defined as an unsigned long).
The fix is to explicitly test against 0.

PR: ia64/91421
Submitted by: Tanaka Akira (akr at m17n dot org)
MFC after: 1 week
2006-01-06 22:12:46 +00:00
John Baldwin
1d1767e89a - Update copyright years from the Specialix SDK.
- Update comment as this firmware is not used for the SX cards, they use
  the si3_t225 firmware instead.
2006-01-06 20:17:48 +00:00
John Baldwin
5a0793f174 Update the firmware image used for the SIJET cards to the latest available
in the SDK from Specialix/Perle.  The prior version was
JET.BIN Version 3.0.6 Beta I and the new version is JET__.BIN Version 4.0.1.

MFC after:	1 week
2006-01-06 19:58:08 +00:00
John Baldwin
8fa19acad6 - Fix cards with multiple modules. Prior to this, the ports on the various
modules would have overlapping names.
- Only create /dev/si_control for unit 0.

Tested by:	Joerg Lehners Joerg dot Lehners at informatik dot
		uni-oldenburg dot de (on 6.x)
MFC after:	1 week
2006-01-06 19:56:12 +00:00
John Baldwin
04dda605c5 - Make pcib_devclass private to sys/dev/pci/pci_pci.c and change all the
various pcib drivers to use their own private devclass_t variables for
  their modules.
- Use the DEFINE_CLASS_0() macro to declare drivers for the various pcib
  drivers while I'm here.
2006-01-06 19:22:19 +00:00
John Baldwin
3c6decc327 Trim another pointer from struct lock_object (and thus from struct mtx and
struct sx).  Instead of storing a direct pointer to a our lock_class
struct in lock_object, reserve 4 bits in the lo_flags field to serve as an
index into a global lock_classes array that contains pointers to the lock
classes.  Only debugging code such as WITNESS or INVARIANTS checks and KTR
logging need to access the lock_class member, so this shouldn't add any
overhead to production kernels.  It might add some slight overhead to
kernels using those debug options however.

As with the previous set of changes to lock_object, this is going to
completely obliterate the kernel ABI, so be sure to recompile all your
modules.
2006-01-06 18:07:32 +00:00
John Baldwin
ca49f12fdb Reduce the scope of one #ifdef to avoid duplicating a SYSCTL_INT() macro
and trim another unneeded #ifdef (it was just around a macro that is
already conditionally defined).
2006-01-06 18:03:45 +00:00
Lukas Ertl
d5817a5009 Get rid of the gv_bioq hack in most parts of the I/O path and
use the standard bioq structures.
2006-01-06 18:03:17 +00:00
John Baldwin
360c3c2d1a Fix various places that were testing td_critnest to see if interrupts
should remain disabled during a trap or not to check
td_md.md_spinlock_count instead.
2006-01-06 18:02:12 +00:00
John Baldwin
af56abaab5 Return error from fget_write() rather than hardcoding EBADF now that
fget_write() DTRT.

Requested by:	bde
2006-01-06 16:34:22 +00:00
John Baldwin
38f63f7e47 Return EBADF rather than EINVAL for FWRITE failure as per POSIX.
MFC after:	1 week
2006-01-06 16:30:30 +00:00
John Baldwin
8dc0e02023 Be a little more forgiving of lame BIOS writers. If a link device that
doesn't have any actual interrupts is listed in a _PRT entry, only print
a warning rather than panic'ing when we walk the _PRT's to build up count
of entries that reference a given link (the counts are used as weights so
that we can attempt to balance the load across IRQs used by link devices).
Instead, only panic if we attempt to use the _PRT entry to route an
interrupt for a device.

PR:		i386/89545
Tested by:	anders
2006-01-06 16:14:32 +00:00
Ariff Abdullah
1332ddcb64 Fix locking violation, causing frantic diagnostic messages during boot.
Reported by:	[1] julian
MFC after:	3 days

[1] http://lists.freebsd.org/pipermail/freebsd-multimedia/2006-January/003408.html
2006-01-06 10:36:55 +00:00
Ariff Abdullah
8b6d3fe1b6 Another major fixes and enhancements:
- MPSAFE
    - Fix / reorganize attach routine. Device specific initialization must
      be done after generic bus / DMA setup. At last, Virtual Channels
      (vchan) works as expected.

Note: Recent commit / fix against this driver proves that major enhancements
      on the generic sound layer does indeed help to expose flaw within
      device specific code. There are probably other drivers that need to
      be addressed as well.

Tested by:	barner
MFC after:	1 week
2006-01-06 05:04:18 +00:00
Warner Losh
5c65ae3a88 New option: NO_FFS_SNAPSHOT. I did this in p4 about the same time
that NetBSD implemented it independently of them (don't know which one
was actually first).  This saves about 24k for those times you don't
need snapshot support (like when running off a ram disk, or in an
embedded environment where size matters).
2006-01-06 04:44:09 +00:00
John Baldwin
e730167f16 Remove XXX comments complaining that write(2) on a read-only descriptor
returns EBADF.  That errno is correct and is mandated by POSIX.  It also
goes back to revision 1.1 of our CVS history (i.e. 4.4BSD).

The _fget() function should probably also be upated as it currently returns
EINVAL in that case rather than EBADF.  (It does return EBADF for reads
on a write-only descriptor without any XXX comments oddly enough.)

Discussed with:	scottl, grog, mjacob, bde
2006-01-05 22:20:31 +00:00
Søren Schmidt
e2bf77c5c2 Get rid of the advertising clause in the copyright. 2006-01-05 21:27:19 +00:00
Jean-Sébastien Pédron
566abf420d Don't hold a reference to the disk vnode for each inode. 2006-01-05 19:27:07 +00:00
Jean-Sébastien Pédron
dcde7cd573 Fix a bug in Synaptics Touchapd support where psm(4) will enter an infinite
loop if it receives an out of sync packet.

Reviewed by:	mux (mentor)
MFC after:	4 days
2006-01-05 19:24:01 +00:00
Maxim Konovalov
98a95f61fa o Typo in the debug message: s/skiped/skipped.
PR:		kern/91346
Submitted by:	Gavin Atkinson
2006-01-05 13:39:23 +00:00
Warner Losh
2b6fb51f02 Check for 10BaseT media correctly. Before we were confusing
ifm_status and ifm_active.  IFM_10_T gets set in the ifm_active field,
not in the ifm_status field, as far as I can tell.

Note: this was to enable a workaround that's rarely enabled.  I don't know
how to corrupt my eeprom to test it, and would rather not know...
2006-01-04 23:00:01 +00:00
Søren Schmidt
49824061be Return the proper rmi field in DVDIOCREADSTRUCTURE.
PR:	89650
2006-01-04 21:35:57 +00:00
Alexander Leidinger
e21a562e99 We don't support I386_CPU in 6.0 and later. This file can be cleaned
up some to assume that '#if defined(I486_CPU) || defined(I586_CPU) ||
defined(I686_CPU)' is true.

Suggested by:	jhb
Reviewed by:	jhb
2006-01-04 20:11:04 +00:00
Alexander Leidinger
924771865a Convert the PAGE_SIZE check into a CTASSERT.
Suggested by:	jhb
2006-01-04 19:19:42 +00:00
Alexander Leidinger
1442a4476a Prevent divide by zero, use default values in case one of the divisor's
is zero.

Tested by:	Randy Bush <randy@psg.com>
2006-01-04 18:26:54 +00:00
Bjoern A. Zeeb
ba0b6851b4 Minor whitespace cleanup. 2006-01-04 17:40:54 +00:00
Joel Dahl
c3a730df5f Fix minor sorting issue. 2006-01-04 17:19:28 +00:00
Joel Dahl
838036242a Remove references to snd_vortex1(4).
Approved by:	tanimura, ariff
2006-01-04 17:05:19 +00:00
Ariff Abdullah
1333b4a431 Fix broken capabilities, causing failure during channel reset.
Its min/max speed were off by -/+ 1000.

Reported by:	[1] Ion-Mihai Tetcu <itetcu@people.tecnik93.com>
            	[2] barner
MFC after:	1 day

[1] http://lists.freebsd.org/mailman/htdig/freebsd-multimedia/2005-December/003189.html
[2] http://lists.freebsd.org/mailman/htdig/freebsd-multimedia/2006-January/003422.html
2006-01-04 15:35:55 +00:00
Hartmut Brandt
154508976b Add a new leaf to the net.link.generic.ifdata.%d sysctl to retrieve
the name and unit number assigned by the driver. This is needed by
SNMP to find interfaces after they have been renamed.

MFC after:	4 weeks
2006-01-04 12:57:09 +00:00
Alexander Leidinger
d5231b4a7f - Make sure the cpu_exthigh variable is initialized (page coloring case). [1]
- Remove a conditional in the AMD cache detection, it's always false. [2]
- Don't try to detect a cache if only compiled for i386.

Analyzed by:	Antoine Brodin <antoine.brodin@laposte.net> [1]
Submitted by:	Antoine Brodin <antoine.brodin@laposte.net> [2]
2006-01-04 12:57:02 +00:00
Søren Schmidt
93b2c0cf02 Fix the promise modesetting for old chips.
Pointy hat to:	sos
2006-01-04 10:23:47 +00:00
Poul-Henning Kamp
d5f1e0d1ef Deorbit ttymalloc() in preference for ttyalloc() 2006-01-04 09:59:07 +00:00
Poul-Henning Kamp
8c92c2096d Use ttyalloc() instead of ttymalloc() 2006-01-04 09:46:20 +00:00
Poul-Henning Kamp
8a7f77816e Use ttyalloc() instead of ttymalloc() 2006-01-04 09:20:41 +00:00
Poul-Henning Kamp
8607f52b66 Use ttyalloc() instead of ttymalloc() 2006-01-04 09:09:46 +00:00
Poul-Henning Kamp
4c29738452 Use ttyalloc() instead of ttymalloc() 2006-01-04 08:34:23 +00:00
Poul-Henning Kamp
246b8d448a Use MTX_SYSINIT to set up the tty list mutex. 2006-01-04 08:22:39 +00:00
Søren Schmidt
8a07d88d9f Fix promise probe printing. 2006-01-04 08:20:25 +00:00
Diomidis Spinellis
c3d78136c9 Fix style bug.
Prompted by:	bde
2006-01-04 07:50:54 +00:00
Diomidis Spinellis
f8ccc6ceb9 Replace tv_usec normalization with the return of EINVAL.
This addresses two objections to the previous behavior,
and unbreaks the alpha tinderbox build.

TODO: update the utimes(2) man page.
2006-01-04 00:47:13 +00:00
Scott Long
8a436e7554 Shuffle some definitions so that this can be included from userland. 2006-01-03 23:03:39 +00:00
Scott Long
df67b5c133 Add some more data structures and definitions for communicating with the
ServeRAID firmware.
2006-01-03 23:03:15 +00:00
Diomidis Spinellis
51339e8593 Normalize the tv_usec part of the utimes(2) arguments to ensure
that a file's atime and mtime are only set to correct fractional
second values (0-999999000ns with the current interface).
Prior to this change users could create files with values outside
that range.  Moreover, on 32-bit machines tv_usec offsets larger than
4.3s would result in an unnormalized AND wrong timestamp value,
due to overflow.

MFC after:	1 week
2006-01-03 21:58:21 +00:00
John Baldwin
ab2c368640 Fix a couple of issues with the ibcs2 module event handler. First, return
success instead of EOPNOTSUPP when being loaded.  Secondly, if there are no
ibcs2 processes running when a MOD_UNLOAD request is made, break out to
return success instead of falling through into the default case which
returns EOPNOTSUPP.  With these fixes, I can now kldload and subsequently
kldunload the ibcs2 module.

PR:		kern/82026 (and several duplicates)
Reported by:	lots of folks
MFC after:	1 week
2006-01-03 20:39:38 +00:00
Jung-uk Kim
142f81c25d Correctly check the filter length. I committed the wrong version.
Pointy hat to me.
2006-01-03 20:34:41 +00:00
Jung-uk Kim
dccb7faff6 - Explicitly validate an empty filter to match bpf_filter() comment[1].
- Do not use BPF JIT compiler for an empty filter.

[1] Pointed out by:	darrenr
2006-01-03 20:26:03 +00:00
John Baldwin
8294689115 Release the pci_link acpi serial lock if a link device has no actual links.
MFC after:	3 days
2006-01-03 20:19:34 +00:00
Brian Somers
0d10741255 This signal handling code is worse than a no-op. If a
signal is received during the msleep, the msleep is retried
indefinitely as it just keeps returning ERESTART because of
the pending signal.

Instead, just don't PCATCH - the signal can wait.

Sponsored by:	Sophos/ActiveState
2006-01-03 17:01:43 +00:00
Robert Watson
8f0d99d790 When returning EIO from DEVFSIO_RADD ioctl, drop the exclusive rule
lock.  Otherwise the system comes to a rather sudden and grinding
halt.

MFC after:	1 week
2006-01-03 09:49:10 +00:00
Pyun YongHyeon
ff3ced1270 - Tx side bus_dmamap_load_mbuf_sg(9) support. This reduces bookkeeping
requiried to keep consistent softc state before/after callback function
  invocation and supposed to be sligntly faster than previous one as it
  wouldn't incur callback overhead. With this change callback function
  was gone.
- Decrease TI_MAXTXSEGS to 32 from 128. It seems that most mbuf chain
  length is less than 32 and it would be re-packed with m_defrag(9) if
  its chain length is larger than TI_MAXTXSEGS. This would protect ti(4)
  against possible kernel stack overflow when txsegs[] is put on stack.
  Alternatively, we can embed the txsegs[] into softc. However, that
  would waste memory and make Tx/Rx speration hard when we want to
  sperate Tx/Rx handlers to optimize locking.
- Fix dma map tracking used in Tx path. Previously it used the dma map
  of the last mbuf chain in ti_txeof() which was incorrect as ti(4)
  used dma map of the first mbuf chain when it loads a mbuf chain with
  bus_dmamap_load_mbuf(9). Correct the bug by introducing queues that
  keep track of active/inactive dma maps/mbuf chain.
- Use ti_txcnt to check whether driver need to set watchdog timer instead
  of blidnly clearing the timer in ti_txeof().
- Remove the 3rd arg. of ti_encap(). Since ti(4) now caches the last
  descriptor index(ti_tx_saved_prodidx) used in Tx there is no need to
  pass it as a fuction arg.
- Change data type of producer/consumer index to int from u_int16_t in
  order to remove implicit type conversions in Tx/Rx handlers.
- Check interface queue before getting a mbuf chain to reduce locking
  overhead.
- Check number of available Tx descriptores to be 16 or higher in
  ti_start(). This wouldn't protect Tx descriptor shortage but it would
  reduce number of bus_dmamap_unload(9) calls in ti_encap() when we are
  about to running out of Tx descriptors.
- Command NIC to send packets ony when the driver really has packets
  enqueued. Previously it always set TI_MB_SENDPROD_IDX which would
  command NIC to DMA Tx descriptors into NIC local memory regardless
  of Tx descriptor changes.

Reviewed by:	scottl
2006-01-03 06:14:07 +00:00
Warner Losh
bee89c7386 Use the child to allocate the resource rather than bridge, since we're
allocating a resource that's in the card itself.

Remove more now-redundant resource_list_add, and now-redunant code
that lives in the pci layer.

# This fixes the atheros card that I have which had its CIS in one of
# the BARs.  Don't know yet if this fixes the amd64 issues reported.
2006-01-03 03:36:17 +00:00
Warner Losh
c732cf3b2c Minor style(9) hacking, plus use a macro in place of (struct resource *)~0UL
(what the heck does that mean?).
2006-01-03 03:16:53 +00:00
Andrew Thompson
f0feaf4f19 Fix a brain-o in the last commit, the conditional was always false. 2006-01-02 23:02:43 +00:00
Andrew Thompson
94e45ae5e8 Reorganise bridge_rtupdate slightly to reduce duplication. 2006-01-02 22:44:54 +00:00
Andrew Thompson
ef9ac7c49a Reset the route expiry time on each update rather than always letting them get
GC'd and recreated.
2006-01-02 22:29:41 +00:00
Andrew Thompson
bc9f74c7cb It is better to use time_uptime here since it is monotonic.
Pointed out by:	glebius
2006-01-02 22:23:03 +00:00
Sam Leffler
59a440350c enable "aggressive mode" only when operating in ap or station mode; in
particular this fixes use of wme in adhoc demo mode, it wasn't possible
to set the txop limit because the aggressive mode logic would override

Reviewed by:	apatti
MFC after:	2 weeks
2006-01-02 17:16:27 +00:00