Commit Graph

55023 Commits

Author SHA1 Message Date
Alexander Leidinger
4442c32be7 Style fix.
Noticed by:	njl
2005-07-31 18:59:47 +00:00
Alexander Leidinger
87506547d2 Whats New:
1. Support wide range sampling rate, as low as 1hz up to int32 max
   (which is, insane) through new feeder_rate, multiple precisions
   choice (32/64 bit converter). This is indeed, quite insane, but it
   does give us more room and flexibility. Plenty sysctl options to
   adjust resampling characteristics.
2. Support 24/32 bit pcm format conversion through new, much improved,
   simplified and optimized feeder_fmt.

Changes:
1. buffer.c / dsp.c / sound.h
   * Support for 24/32 AFMT.
2. feeder_rate.c
   * New implementation of sampling rate conversion with 32/64 bit
     precision, 1 - int32max hz (which is, ridiculous, yet very
     addictive).  Much improved / smarter buffer management to not
     cause any missing samples at the end of conversion process
   * Tunable sysctls for various aspect:
       hw.snd.feeder_rate_ratemin - minimum allowable sampling rate
       (default to 4000)
       hw.snd.feeder_rate_ratemax - maximum allowable sampling rate
       (default to 1102500)
       hw.snd.feeder_rate_buffersize - conversion buffer size
       (default to 8192)
       hw.snd.feeder_rate_scaling - scaling / conversion method
       (please refer to the source for explaination). Default to
       previous implementation type.
3. feeder_fmt.c / sound.h
   * New implementation, support for 24/32bit conversion, optimized,
     and simplified. Few routines has been removed (8 to xlaw, 16 to
     8). It just doesn't make sense.
4. channel.c
   * Support for 24/32 AFMT
   * Fix wrong xruns increment, causing incorrect underruns statistic
     while using vchans.
5. vchan.c
   * Support for 24/32 AFMT
   * Proper speed / rate detection especially for fixed rate ac97.
     User can override it using kernel hint:
     hint.pcm.<unit>.vchanrate="xxxx".

Notes / Issues:
        * Virtual Channels (vchans)
          Enabling vchans can really, really help to solve overrun
          issues.  This is quite understandable, because it operates
          entirely within its own buffering system without relying on
          hardware interrupt / state. Even if you don't need vchan,
          just enable single channel can help much. Few soundcards
          (notably via8233x, sblive, possibly others) have their own
          hardware multi channel, and this is unfortunately beyond
          vchan reachability.
        * The arrival of 24/32 also come with a price. Applications
          that can do 24/32bit playback need to be recompiled (notably
          mplayer).  Use (recompiled) mplayer to experiment / test /
          debug this various format using -af format=fmt. Note that
          24bit seeking in mplayer is a little bit broken, sometimes
          can cause silence or loud static noise. Pausing / seeking
          few times can solve this problem.
          You don't have to rebuild world entirely for this. Simply
          copy /usr/src/sys/sys/soundcard.h to
          /usr/include/sys/soundcard.h would suffice. Few drivers also
          need recompilation, and this can be done via
          /usr/src/sys/modules/sound/.
          Support for 24bit hardware playback is beyond the scope of
          this changes. That would require spessific hardware driver
          changes.
        * Don't expect playing 9999999999hz is a wise decision. Be
          reasonable. The new feeder_rate implemention provide
          flexibility, not insanity. You can easily chew up your CPU
          with this kind of mind instability. Please use proper
          mosquito repellent device for this obvious cracked brain
          attempt. As for testing purposes, you can use (again)
          mplayer to generate / play with different sampling rate. Use
          something like "mplayer -af resample=192000:0:0 <files>".

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
Tested by:	multimedia@
2005-07-31 16:16:22 +00:00
Alexander Leidinger
c79d1375fa OSS defines AFMT_x32_xE as:
1) 32bit data, packed within 32bit (4bytes) boundary.
        2) 24bit data, packed within 32bit (4bytes) boundary where the data
           is stored in the 24 most significant bits and least significant 8
           bits are not used and should be set to 0.

While this might hold true in few cases, lots of applications (notably
mplayer, sweep) really deal / produce 24bit as what they should meant
to be: 24bit data / 3bytes per sample.
To handle this "true" 24bit pcm format add AFMT_x24_xE, so the in-kernel
conversion space did not confuse itself with 32bit variant.

You need to rebuild mplayer after installing this change (this header and
the upcomming kernel changes), if you want to use this new feature.

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
Tested by:	multimedia@
2005-07-31 16:08:03 +00:00
David Xu
3d16f519b6 If a thread was removed from system run queue, kse_assign shouldn't
add it again.
2005-07-31 15:11:21 +00:00
Alexander Leidinger
fe435202da * Slightly new method to detect mixer capabilities and resolution.
This mostly to help CT4730, but apparently it does help other
  cards too (especially via8233x). This probably need further test
  and confirmation from other people with ac97 cards other than via
  / es137x.
* Aggresive dac power wake up call, again, to help CT4730 (and
  probably others).

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
Tested by:	multimedia@
2005-07-31 14:28:31 +00:00
Alexander Leidinger
c249345405 - Fixup the locking.
- Don't mark MPSAFE (yet).
- DSP_CMD_DMAEXIT_8 doesn't work on old cards, use sb_reset_dsp() instead.

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
2005-07-31 13:53:53 +00:00
Alexander Leidinger
7a7689dea4 - Fixup the locking.
- Don't mark MPSAFE (yet).

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
2005-07-31 13:51:04 +00:00
Alexander Leidinger
205d75821e Add another ID.
Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
2005-07-31 13:49:47 +00:00
Alexander Leidinger
01bec79c11 * Add locking / MPSAFE
* Add kernel hint option to disable DXS channels entirely. Report
  from several skype users / Pav Lucistnik indicate that disabling
  DXS may fix lots of pop / crackling noise. To disable DXS add
  hint.pcm.<unit>.via_dxs_disabled="1" to /boot/device.hints.
  Further investigation of the issues regarding DXS showed, that
  the problem is in another (more generic) place, but until the
  right fix is tested/reviewed this may help a little bit.

Added sysctl's to aid testing/debugging:
hint.pcm.<unit>.via_dxs_disabled=X - Disable / Enable DXS channels entirely
hint.pcm.<unit>.via_dxs_channels=X - Limit DXS channels up to X
hint.pcm.<unit>.via_sgd_channels=X - Limit SGD channels up to X
hint.pcm.<unit>.via_dxs_src=X      - Enable / Disable DXS sample rate
                                     converter.

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
Tested by:	multimedia@
2005-07-31 13:43:42 +00:00
Alexander Leidinger
cc730bdd4a Fix a LOR introduced with the last commit (some hours ago), I had the
wrong version of the patch.

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
Pointy hat to:	netchild
2005-07-31 13:24:47 +00:00
Alexander Leidinger
69e10e5a1b Fix a LOR introduced in the last commit (some hours ago), I had the wrong
version of the patch...

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
Pointy hat to:	netchild
2005-07-31 13:22:48 +00:00
Alexander Leidinger
ae93e580dd * Register programming error during device initialization
especially for CT4730 / EV1938 chip, causing misconfigured mixer
  (David Xu), crippled after power cycle (Kevin Oberman). Fixed.
* Incorporate locking/spdif patches from Jon Noack / matk. Not all
  es137x can really do spdif, clean it up a bit to only let few capable
  chip. This adds a "hw.snd.pcm<unit>.spdif_enabled" sysctl until
  a more generic way of handling this from userland (by an ordinary
  user) is designed/implemented.
* Convert all bus_space_(read|write) to use es_rd/es_wr, simmilar
  with other drivers.
* Add tunable hw.snd.pcm<unit>.latency_timer sysctl to toggle pci
  latency timer value on the fly. Much noise / pop / crackling
  issues can be solved by increasing its value. Other people have
  pointed out to use pciconf instead, but this is just an added
  value specific for CT4730/EV1938.
* Remove es137x specific debug sysctl/code.

Several PRs can now be closed.

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
Submitted by:	Jon Noack <noackjr@alumni.rice.edu> (implicit)
Submitted by:	matk (implicit)
PR:		59349, 68594, 73498
Tested by:	multimedia@
2005-07-31 13:19:38 +00:00
Alexander Leidinger
f769fa83d5 This driver is already MPSAFE, remove busdma_lock_mutex and Giant from
bus_dma_tag_create.

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
2005-07-31 12:38:22 +00:00
Alexander Leidinger
2b379e8d35 * Add locking / MPSAFE.
Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
Tested by:	netchild
2005-07-31 11:04:36 +00:00
Alexander Leidinger
1adf8286e7 * als4000 can't do 48k properly (perhaps it really can't at all!).
Set maxspeed to 44.1k instead.
* Add locking / MPSAFE
* Fix recording

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
2005-07-31 11:01:13 +00:00
Alexander Leidinger
7233abab86 * Fix panic during driver unload on second attempt after failure on
first (device busy).
* Fix module unloading for sound.ko itself.

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
Tested by:	multimedia@
2005-07-31 10:55:24 +00:00
Alexander Leidinger
32069af652 The resource_xxx routines in subr_hints.c are called before and after the
kenv environment in kern_environment.c switches to dynamic kenv. The prior
call sets the static variable hintp to the static hints in subr_hints.c
(hintmode==0).

However, changes to the environment are not detected by the resource_xxx
lookups after the change to dynamic kernel environment, so the lookup
routines only report the old stuff of hintmode==0, even after the change to
the dynamic kenv. This causes kenv users to see a different environment than
the kernel routines.

This is a problem in the mixer.c code that looks up initial mixer volume
settings from the hints: If the hints are dynamic and not from the
device.hints file, mixer.c doesn't see them, but kenv does.

The patch from the PR (modified to comply to the style of the function)
solves this.

PR:		83686
Submitted by:	Harry Coin <harrycoin@qconline.com>
2005-07-31 10:46:55 +00:00
Alexander Leidinger
3904769ba8 Add bounds checking to the setenv part of the kernel environment.
This has no security implications since only root is allowed to use
kenv(1) (and corrupt the kernel memory after adding too much variables
previous to this commit).

This is based upon the PR [1] mentioned below, but extended to check both
bounds (in case of an overflow of the counting variable) and to comply
to the style of the function. An overflow of the counting variable
shouldn't happen after adding the check for the upper bound, but better
safe than sorry (in case some other function in the kernel overwrites
random memory).

An interested soul may want to add a printf to notify root in case the
bounds are hit.

Also allocate KENV_SIZE+1 entries (the array is NULL-terminated), since
the comment for KENV_SIZE says it's the maximum number of environment
strings. [2]

PR:		83687 [1]
Submitted by:	Harry Coin <harrycoin@qconline.com> [1]
Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my> [2]
2005-07-31 10:28:35 +00:00
Colin Percival
a26ee70316 Print cpu_vendor and the MSR value if we don't support this processor
even though we're not asking people to contact us.

Requested by:	njl
2005-07-31 06:42:27 +00:00
Sam Leffler
19ad2dd79a close a race between reclaiming a node when a station is inactive
and sending the null data frame used to probe inactive stations

MFC after:	5 days
2005-07-31 06:12:32 +00:00
Warner Losh
55234c1cf4 The isa attachment calls ep_free after it has already been called once
in the resource error in ep_alloc case.  This results in a panic.
Zero resources to make it safe to call twice pending resolution of
layering questions.

MFC After: 3 days
2005-07-31 03:33:22 +00:00
Warner Losh
48c912e4ce Add newer commands 2005-07-31 03:30:46 +00:00
Colin Percival
1c16098210 Remove the instruction to "contact the maintainer" for unrecognized
CPUs.  Intel refuses to give me the information I need, and getting
more emails about this doesn't help.
2005-07-31 01:57:05 +00:00
Hajimu UMEMOTO
e1d274a25d fix build without option INET6.
Reported by:	Philip M. Gollucci <pgollucci__at__p6m7g8.com>
2005-07-30 20:10:31 +00:00
Christian S.J. Peron
648fd2bd0b Add missing parenthesis around error handling code upon attaching
mlx devices. This fixes an issue where mlx device drives fail to be
detected at system boot.

This is a RELENG_6 candidate.

Submitted by:	oliver
PR:		kern/84163
2005-07-30 15:53:40 +00:00
Peter Grehan
ebc2aa7496 Temporary band-aid to fix hang when a process exec's Altivec instructions.
trap_subr.S:  declare a stub for the a-unavailable trap
              that does an absolute jump to the vector-assist trap.
              This is due to the fact that the vec-unavail trap
              doesn't start at a 256-byte boundary, so the trick of
              masking the bottom 8 bits of the link register to identify
              the interrupt doesn't work, so let the vec-assist
              case handle Altivec-disabled for the time being.

              Note that this will be fixed in the future with a much
              smaller vector code-stub (< 16 bytes) that will allow
              use of strange vector offsets that are also present in
              4xx processors, and also allow smaller differences in
              vector codepaths on the G5.

trap.c:       Treat altivec-unavailable/assist process traps as SIGILL.
              Not quite correct, since altivec-assist should really be a panic,
              but it is fine for the moment due to the above measure.

machdep.c     Install the stub code for the altivec-unavailable trap, and
              the standard trap code at the altivec-assist.

Reported by:	Andreas Tobler <toa at pop agri ch>
MFC after:	3 days
2005-07-30 11:14:31 +00:00
Joseph Koshy
fadcc6e201 Fail the module loading process if the currently executing kernel
was not compiled with 'options HWPMC_HOOKS' or if the compiled-in
version numbers of the kernel and module are out of sync.

Reported by:	cracauer
MFC after:	3 days
2005-07-30 09:02:42 +00:00
Paul Saab
1126349ae7 Ignore mutex asserts when we're dumping as well. This allows me
to panic a system from DDB when INVARIANTS is compiled into the
kernel on a scsi system.
2005-07-30 05:54:30 +00:00
Sam Leffler
ab8ab90c5b add m_align, a function to align any type of mbuf (i.e. it
is a superset of M_ALIGN and MH_ALIGN)

Reviewed by:	several
2005-07-30 01:32:16 +00:00
Kris Kennaway
e29c976a58 devfs is not yet fully MPSAFE - for example, multiple concurrent devfs(8)
processes can cause a panic when operating on rulesets.

Approved by:	phk
2005-07-29 23:00:56 +00:00
Maxime Henrion
86c8aacb07 Add a new PCI id for fxp(4) cards found on ICH7-based systems.
This commit is a RELENG_6 candidate.

Submitted by:	Martin Nilsson <martin@gneto.com>
2005-07-29 22:40:06 +00:00
John Baldwin
ec1f24a934 Add missing dependencies on the SYSVIPC modules. 2005-07-29 19:41:04 +00:00
John Baldwin
813a5e14ec Move MODULE_DEPEND() statements for SYSVIPC dependencies to linux_ipc.c
so that they aren't duplicated 3 times and are also in the same file as
the code that depends on the SYSVIPC modules.
2005-07-29 19:40:39 +00:00
John Baldwin
bca7902961 Fix a bug in pmap_protect() in the PAE case where it would try to look up
the vm_page_t associated with a pte using only the lower 32-bits of the pte
instead of the full 64-bits.

Submitted by:	Greg Taleck greg at isilon dot com
Reviewed by:	jeffr, alc
MFC after:	3 days
2005-07-29 19:03:44 +00:00
John Baldwin
8c216f9e55 Add a tunable 'hw.apic.enable_extint' that can be set from the loader to
not mask the ExtINT pin on the first I/O APIC as at least one PIII chipset
seems to need this even though all of the pins in the 8259A's are masked.
The default is still to mask the ExtINT pin.

Reported by:	Mike Tancsa mike at sentex.net
MFC after:	3 days
2005-07-29 18:58:33 +00:00
Søren Schmidt
785a5193b7 Remove stale struct ata_channel declaration.
Reported by:	rodrigc
2005-07-29 18:14:06 +00:00
Maksim Yevmenkin
89a4a8b5f3 Fix typo and check correct (rsp) pointer against the NULL value.
Submitted by:	Oliver < urnenfel at tiscali dot es >
MFC after:	1 day
2005-07-29 14:44:17 +00:00
R. Imura
080e3a63b3 Change API of mb_copy_t in libmchain so that netsmb can handle
multibyte character share name correctly.

Reviewed by:	bp
2005-07-29 13:22:37 +00:00
Brian Somers
1b3b403e9b Fix a comparison that broke ``set console=vidconsole'' and even the
loader.conf line ``console="vidconsole"''.

Sponsored by:	ActiveState/Sophos
MFC after:	1 week
2005-07-29 12:47:42 +00:00
Brian Somers
07998bfffc Mention that console= can set multiple consoles.
Relate boot_ options to their kernel command line flags and make it clear
how kenv(1) is used.

Sponsored by:	ActiveState/Sophos
MFC after:	1 week
2005-07-29 12:41:37 +00:00
Paul Saab
6c9f6695fd Print the actual disk device we failed to complete i/o on. 2005-07-29 01:53:45 +00:00
Paul Saab
8c61487b21 Don't allow ioctl commands to be interrupted by the user. 2005-07-29 01:47:36 +00:00
Brian Somers
fa6e2680c0 Make ichsmb unloadable.
It seems that the unload problems were due to a dodgy sc->smb usage and a
missing mtx_destroy().

Sponsored by:	ActiveState/Sophos
MFC after:	3 weeks
2005-07-29 00:20:50 +00:00
R. Imura
0a78d39a55 Don't compile ral and ural in the PAE kernel, because
they have dependency on wlan and usb.

Reported by:	make universe
2005-07-28 22:25:07 +00:00
Nate Lawson
e4515dd568 Add descriptions for the sysctls.
MFC after:	1 day
2005-07-28 19:34:51 +00:00
Nate Lawson
50d0e47aa7 Zero the _BST, _BIF, and battinfo allocations. This is needed since we
later sum capacities for all batteries, even those that weren't actually
present.  We only need to do this for _BST but do it for all of them.

Reported by:	Eric Anderson
MFC after:	1 day
2005-07-28 18:19:50 +00:00
Hajimu UMEMOTO
e770771a78 simplied the fix to FreeBSD-SA-04:06.ipv6. The previous one worried
too much even though we actually validate the parameters.  This code
also is more compatible with other *BSDs, which do copyin within
setsockopt().

Submitted by:	Keiichi SHIMA <keiichi__at__iijlab.net>
Reviewed by:	security-officer (nectar)
Obtained from:	KAME
2005-07-28 18:07:07 +00:00
Maksim Yevmenkin
d6279c101e Address minor locking issues. Use taskqueue_swi instead of taskqueue_swi_giant.
MFC after:	1 month
2005-07-28 17:43:20 +00:00
Tom Rhodes
096dd4065f If a "hole" opens up in the ruleset (i.e.: remove 5), do not return
unknown error.  Instead, just return error.

Submitted by:	avatar
Tested by:	trhodes
2005-07-28 13:55:12 +00:00
George V. Neville-Neil
0d52d7b01a Fix for PR 83885.
Make sure that there actually is a next packet before setting
nextrecord to that field.

PR: 83885
Submitted by: hirose@comm.yamaha.co.jp
Obtained from:	Patch suggested in the PR
MFC after: 1 week
2005-07-28 10:10:01 +00:00
Pawel Jakub Dawidek
73864adbd4 Fix the way how "InUse" column in 'vmstat -m' output works:
- increase number of allocations count only on successfull malloc(9),
  so it doesn't confuse people;
- because we need to check if 'size > 0', hide 'mtsp->mts_memalloced += size;'
  under the check as well, as for size=0 it is of course a no-op;
- avoid critical_enter()/critical_exit() in case of failure in
  malloc_type_allocated() as there will be nothing to do.

OK'ed by:	rwatson
MFC after:	2 days
2005-07-27 23:17:31 +00:00
Pawel Jakub Dawidek
ea35a2ec3a MFp4: Export more informations about encrypted providers.
MFC after:	1 week
2005-07-27 22:31:57 +00:00
Pawel Jakub Dawidek
7625429883 Reduce default debug level to 0.
MFC after:	1 week
2005-07-27 21:48:47 +00:00
Pawel Jakub Dawidek
5ca1fcfe06 Connect GEOM_ELI class to the build.
MFC after:	1 week
2005-07-27 21:47:55 +00:00
Pawel Jakub Dawidek
c58794debd Add GEOM_ELI class which provides GEOM providers encryption.
For features list and usage see manual page: geli(8).

Sponsored by:	Wheel Sp. z o.o.
		http://www.wheel.pl
MFC after:	1 week
2005-07-27 21:43:37 +00:00
Warner Losh
95e4208ebf msdosfs_conv.c references cmos_wall_clock and adjkerntz. Since these
are 0 for arm, define them as such to make msdosfs_conv.c compile
again on arm.
2005-07-27 21:19:28 +00:00
Maksim Yevmenkin
8a03cf5c82 Reorganize an_detach() a bit. Make sure ether_ifdetach() and if_free()
are called outside of AN_LOCK()/AN_UNLOCK. This fixes the following
WITNESS warning (produced when an(4) PCMCIA card is detached).

taskqueue_drain with the following non-sleepable locks held:
exclusive sleep mutex an0 (network driver) r = 0 (0xc59af168) locked @ /usr/src/sys/dev/an/if_an.c:2836

MFC after:	3 days
Silence from:	current@
2005-07-27 21:03:35 +00:00
John Baldwin
d9610574a2 Add extra constraints to tell the compiler that the memory be modified
in the arm __swp() and sparc64 casa() and casax() functions is actually
being used as an input and output and not just the value of the register
that points to the memory location.  This was the underlying source of
the mbuf refcount problems on sparc64 a while back.  For arm this should be
a nop because __swp() has a constraint to clobber all memory which can
probably be removed now.

Reviewed by:	alc, cognet
MFC after:	1 week
2005-07-27 20:01:45 +00:00
John Baldwin
e11fe02dfb Use a + constraint modifier for a register arg in __bswap16_var().
Reviewed by:	cognet
2005-07-27 19:59:21 +00:00
Jung-uk Kim
fd95fd457f Simplify SMBIOS loader variables and drop `hint.smbios.0.enabled'.
They are not real hints.

Reported by:	des
Pointed out by:	peter
Approved by:	anholt (mentor)
2005-07-27 19:11:10 +00:00
John Baldwin
b88076fede Correct the order of some if tests so that we don't complain about being
unable to route an IRQ when we do route an IRQ ok but bootverbose is off.

Reported by:	Ben Kaduk minimarmot at gmail dot com
2005-07-27 15:21:32 +00:00
Paul Saab
250614c5ab FIx for a bug in the change that made nfs_timer() MPSAFE. We need to
grab Giant before calling pru_send() (if running with mpsafenet = 0).

Found by:	Jeremie Le Hen.
Fixed by:	Maxime Henrion
2005-07-27 15:06:26 +00:00
Paul Saab
4fb48d10b0 In nfs_nget() if two threads race on the same filehandle, the loser should
cause the nfsnode to get freed. This fixes a potential vnode (and nfsnode)
leak in that path.

Submitted by:	Mohan Srinivasan
Reviewed by:	phk
2005-07-27 15:05:31 +00:00
John Baldwin
d0e98e85f8 - Use callout_*() rather than timeout() to periodically poll the media.
- Add locking to protect the softc and mark this driver as MP safe.  There
  are still some edge cases with multiport cards that need more locking
  work.

MFC after:	1 week
Tested on:	alpha
2005-07-27 13:51:01 +00:00
John Baldwin
8bc92074e8 Fix a typo in the name of the dmamap for a bus_dmamap_sync().
MFC after:	3 days
2005-07-27 13:48:45 +00:00
Pawel Jakub Dawidek
4ed854e8d4 Use root_mount KPI for RAID3 to delay root file system mount.
Actually, one cannot setup root file system on RAID3 device, but when
other file system exist in /etc/fstab which are placed on RAID3 device,
boot process will be interrupted when these devices are missing.

MFC after:	3 days
X-MFC-note:	MFC only to RELENG_6, as RELENG_5 doesn't have root_mount KPI.
2005-07-27 09:03:51 +00:00
Colin Percival
1fcc990954 Correct a buffer overflow which can occur when decompressing a
carefully crafted deflated data stream. [1]

Correct problems in the AES-XCBC-MAC IPsec authentication algorithm. [2]

Submitted by:	suz [2]
Security:	FreeBSD-SA-05:18.zlib [1], FreeBSD-SA-05:19.ipsec [2]
2005-07-27 08:41:17 +00:00
Warner Losh
6fa45429f9 The 575A doesn't have funcregs in memio. So don't claim that it does.
This gets my 575A card probing.

Card provided by: James Flemer
MFC After: 3 days
2005-07-27 06:38:55 +00:00
Sam Leffler
767cee4f5b when bridging internally bypass the bss node as traffic to it
must follow the normal input path

Submitted by:	Michal Mertl
MFC after:	5 days
2005-07-27 04:41:25 +00:00
Sam Leffler
936f15d221 bandaid ni_fails handling so ap's with association failures are
reconsidered after a bit; a proper fix involves more changes to
the scanning infrastructure

Reviewed by:	avatar, David Young
MFC after:	5 days
2005-07-27 02:53:09 +00:00
Christian S.J. Peron
422a63da6e Rather than hold a mutex over calls to SYSCTL_OUT allocate a
temporary buffer then pass the array to user-space once we have
dropped the lock.

While we are here, drop an assertion which could result in a
kernel panic under certain race conditions.

Pointed out by:	rwatson
2005-07-26 17:21:56 +00:00
Hajimu UMEMOTO
d6bb0cb7eb nuke duplicate inclusion of scope6_var.h. 2005-07-26 11:46:15 +00:00
Hajimu UMEMOTO
c85ed85b1c include scope6_var.h for in6_clearscope(). 2005-07-26 00:19:58 +00:00
Maxime Henrion
67685686ad Remove an erroneous m_freem() call. If m_defrag() returns a non-NULL
pointer, it has already freed the original mbuf chain, so we shouldn't
do it again.

This is an MFC candidate.
2005-07-25 22:21:11 +00:00
Poul-Henning Kamp
8827c821de By design I left a tiny race in updating the I/O statistics based on
the assumption that performance was more important that beancounter
quality statistics.

As it transpires the microoptimization is not measurable in the
real world and the inconsistent statistics confuse users, so revert
the decision.

MT6 candidate:	possibly
MT5 candidate:	possibly
2005-07-25 21:12:54 +00:00
Nate Lawson
f4e31e2e89 Correct minor output bug. When the battery being queried is charging or
the overall discharge rate is 0, mark the battery remaining time as
"unknown", not 0.

Reported by:	Eric Kjeldergaard
MFC after:	4 days
2005-07-25 17:44:10 +00:00
Hajimu UMEMOTO
336a1a7b37 oops, make it compilable. i need sleep. X-( 2005-07-25 17:28:39 +00:00
John-Mark Gurney
2fd290094e remove a pointless comment with a more helpful one...
Submitted by:	Tobias Roth
MFC after:	5 days
2005-07-25 17:18:25 +00:00
Hajimu UMEMOTO
a7734b4bfd restore locks which disappeared wrongly by my previous commit. 2005-07-25 17:05:37 +00:00
Hajimu UMEMOTO
29da8af658 include netinet6/scope6_var.h. 2005-07-25 12:36:43 +00:00
Hajimu UMEMOTO
a1f7e5f8ee scope cleanup. with this change
- most of the kernel code will not care about the actual encoding of
  scope zone IDs and won't touch "s6_addr16[1]" directly.
- similarly, most of the kernel code will not care about link-local
  scoped addresses as a special case.
- scope boundary check will be stricter.  For example, the current
  *BSD code allows a packet with src=::1 and dst=(some global IPv6
  address) to be sent outside of the node, if the application do:
    s = socket(AF_INET6);
    bind(s, "::1");
    sendto(s, some_global_IPv6_addr);
  This is clearly wrong, since ::1 is only meaningful within a single
  node, but the current implementation of the *BSD kernel cannot
  reject this attempt.

Submitted by:	JINMEI Tatuya <jinmei__at__isl.rdc.toshiba.co.jp>
Obtained from:	KAME
2005-07-25 12:31:43 +00:00
Pawel Jakub Dawidek
869de95743 Connect GZERO to the build.
MFC after:	3 days
2005-07-25 10:49:05 +00:00
Xin LI
05a6b7ad62 Cast to uintptr_t when the compiler complains. This unbreaks ULE
scheduler breakage accompanied by the recent atomic_ptr() change.
2005-07-25 10:21:49 +00:00
Pawel Jakub Dawidek
565bc10111 Add a very simple and small GEOM class - ZERO.
It creates very huge provider (41PB) /dev/gzero.
On BIO_READ request it zero-fills bio_data and on BIO_WRITE it does nothing.
You can also set kern.geom.zero.clear sysctl to 0 to do nothing even for
BIO_READ.

I'm using it for performance testing where it is very helpful.

MFC after:	3 days
2005-07-25 10:03:16 +00:00
Andrew Thompson
39bb2fca46 We check that all the member interfaces have the same MTU on attach to the
bridge but the interface can still be changed afterwards.

This falls under the 'dont do that' category but log an warning when INVARIANTS
is defined.

Approved by:	mlaier (mentor)
MFC after:	3 days
2005-07-25 02:22:37 +00:00
Robert Watson
cbbb4a0089 Rename UMA_MAX_NAME to UTH_MAX_NAME, since it's a maximum in the
monitoring API, which might or might not be the same as the internal
maximum (currently none).

Export flag information on UMA zones -- in particular, whether or
not this is a secondary zone, and so the keg free count should be
considered in that light.

MFC after:	1 day
2005-07-25 00:47:32 +00:00
Marius Strobl
8cfaff7d0b Remove NOP spl*() calls and add locking (making gem(4) MPSAFE).
Based on:	hme(4)
Reviewed by:	yongari
Tested on:	powerpc(grehan), sparc64
2005-07-24 18:45:15 +00:00
Marius Strobl
c3d5598aa8 - Wrap the handler and associated code for collecting completed RX
descriptors that are still marked owned in #ifdef GEM_RINT_TIMEOUT
  instead of #if 0 for convenience.
- Remove stale code and comment about relying on the preset XIF config.
- In case of a watchdog timeout call the init function instead of just
  the start function so the chip is properly reset.

Merge from hme(4):
- Convert to use bus_dmamap_load_mbuf_sg() for loading RX buffers.
- Protect from a duplicate mbuf free panic in case the DMA engine hangs.

Reviewed by:	yongari
Tested on:	powerpc(grehan), sparc64
MFC after:	1 week
2005-07-24 18:12:31 +00:00
Maxime Henrion
5a29706504 Add back ed(4) in amd64 GENERIC. It now works nicely and since those
chips are commonly found, it makes sense to have it in GENERIC.  This
is a candidate for a RELENG_6 MFC.

Approved by;	peter
Requested by:	pav
Tested by:	pav
2005-07-24 17:55:57 +00:00
Christian S.J. Peron
69f7644bc9 Introduce new sysctl variable: net.bpf.stats. This sysctl variable can
be used to pass statistics regarding dropped, matched and received
packet counts from the kernel to user-space. While we are here
introduce a new counter for filtered or matched packets. We currently
keep track of packets received or dropped by the bpf device, but not
how many packets actually matched the bpf filter.

-Introduce net.bpf.stats sysctl OID
-Move sysctl variables after the function prototypes so we can
 reference bpf_stats_sysctl(9) without build errors.
-Introduce bpf descriptor counter which is used mainly for sizing
 of the xbpf_d array.
-Introduce a xbpf_d structure which will act as an external
 representation of the bpf_d structure.
-Add a the following members to the bpfd structure:

	bd_fcount	- Number of packets which matched bpf filter
	bd_pid		- PID which opened the bpf device
	bd_pcomm	- Process name which opened the device.

It should be noted that it's possible that the process which opened
the device could be long gone at the time of stats collection. An
example might be a process that opens the bpf device forks then exits
leaving the child process with the bpf fd.

Reviewed by:	mdodd
2005-07-24 17:21:17 +00:00
Sam Leffler
c59005e9c8 o fix setup of sc_diversity; the hal does not give us reliable
status after attach, only after a reset
o when setting diversity via the sysctl don't update sc_diversity
  until we know the hal requested worked
o while here eliminate sc_hasdiversity and sc_hastpc; just query
  the hal each time since these are the only places we need to know

MFC after:	3 days
2005-07-24 05:11:39 +00:00
Nate Lawson
76f6fe4f31 Rewrite the acpi_battery interface to allow for other battery types
(i.e., smart battery) and fix various bugs found during the cleanup.

API changes:
* kernel access:
Access to individual batteries is now via devclass_find("battery").
Introduce new methods ACPI_BATT_GET_STATUS (for _BST-formatted data) and
ACPI_BATT_GET_INFO (for _BIF-formatted data).  The helper function
acpi_battery_get_battinfo() now takes a device_t instead of a unit #
argument.  If dev is NULL, this signifies all batteries.

* ioctl access:
The ACPIIO_BATT_GET_TYPE and ACPIIO_BATT_GET_BATTDESC ioctls have been
removed.  Since there is now no need for a mapping between "virtual" unit
and physical unit, usermode programs can just specify the unit directly and
skip the old translation steps.  In fact, acpiconf(8) was actually already
doing this and virtual unit was the same as physical unit in all cases
since there was previously only one battery type (acpi_cmbat).  Additionally,
we now map the ACPIIO_BATT_GET_BIF and ACPIIO_BATT_GET_BST ioctls for all
batteries, if they provide the associated methods.

* apm compatibility device/ioctls:  no change
* sysctl:  no change

Since most third-party applications use the apm(4) compat interface, there
should be very few affected applications (if any).

Reviewed by:	bruno
MFC after:	5 days
2005-07-23 19:36:00 +00:00
David E. O'Brien
d3a46d1253 Fix missing '=' in structure initialization. 2005-07-23 19:28:51 +00:00
R. Imura
8fa523fb95 Temporary restore a part of rev 1.6.
We must not increase a capability of buffer size here,
because codes which call these functions expect that dst and src
are the same size.
This will cause problem when someone convert a character whose
length is different between charsets on smbfs which was changed
to use xlat16 converter.
2005-07-23 16:52:57 +00:00
Ken Smith
6c497be4ac Oops, bump __FreeBSD_version to mark shared library version bump.
Reminded by:	nork
2005-07-23 16:42:54 +00:00
Sam Leffler
4866e6c248 o move ath_sysctlattach down so variables it depends on are setup
o use any fixed tx antenna for beacons transmitted in adhoc mode

Submitted by:	David Young
MFC after:	3 days
2005-07-23 05:34:29 +00:00
Giorgos Keramidas
a09ad79379 Misc spelling and/or English fixes in comments.
Reviewed by:	glebius, andre
2005-07-23 00:59:13 +00:00
Sam Leffler
44b666cd0e the AREF flag is only meaningful in ap mode; adhoc neighbors now
are timed out of the sta/neighbor table
2005-07-23 00:16:46 +00:00
Sam Leffler
f66d97f6bc o move inactivity-related debug msgs under IEEE80211_MSG_INACT
o probe inactive neighbors in adhoc mode (they don't have an
  association id so previously were being timed out)

MFC after:	3 days
2005-07-22 23:25:46 +00:00
Peter Grehan
2fcb4181ad Make code match comment: make the smallest unit of page allocation
from OpenFirmware be 16 pages to avoid fragmentation in the list
of mappings returned when the kernel requests it in pmap_bootstrap.

This allows a static buffer to be used when obtaining the existing
mappings - very useful on the G5 when random physical pages can't
be grabbed because they can't be BAT-mapped.

MFC after:	3 days
2005-07-22 23:22:29 +00:00
Nate Lawson
a3ab9d1e3e Standardize __FBSDID identifiers.
MFC after:	2 days
2005-07-22 23:10:02 +00:00
Sam Leffler
af8418dcb1 split xmit of probe request frame out into a separate routine that
takes explicit parameters; this will be needed when scanning is
decoupled from the state machine to do bg scanning

MFC after:	3 days
2005-07-22 21:11:26 +00:00
Sam Leffler
add59d0875 split 802.11 frame xmit setup code into ieee80211_send_setup
MFC after:	3 days
2005-07-22 20:48:11 +00:00
Sam Leffler
e996233220 simplify ic_newassoc callback
MFC after:	3 days
2005-07-22 17:57:16 +00:00
Sam Leffler
641b4d0b2d simplify ieee80211_ibss_merge api
MFC after:	3 days
2005-07-22 17:54:40 +00:00
Sam Leffler
0677adcdb0 add stats we know we'll need soon and some spare fields for future expansion
MFC after:	3 days
2005-07-22 17:50:13 +00:00
Sam Leffler
edfa57d0f0 simplify tim callback api
MFC after:	3 days
2005-07-22 17:45:48 +00:00
Sam Leffler
a92c6eb0f1 don't include 802.3 header in min frame length calculation as it may
not be present for a frag; fixes problem with small (fragmented) frames
being dropped

Obtained from:	Atheros
MFC after:	3 days
2005-07-22 17:42:08 +00:00
Sam Leffler
e4918ecdb9 simplify ieee80211_node_authorize and ieee80211_node_unauthorize api's
MFC after:	3 days
2005-07-22 17:36:12 +00:00
Sam Leffler
f62121ce8e simplifiy ieee80211_send_nulldata api
MFC after:	3 days
2005-07-22 17:31:18 +00:00
Sam Leffler
7d77cd5381 simplify rate set api's by removing ic parameter (implicit in node reference)
MFC after:	3 days
2005-07-22 17:29:03 +00:00
Sam Leffler
bdad3a1066 reject association requests with a wpa/rsn ie when wpa/rsn is not
configured on the ap; previously we either ignored the ie or (possibly)
failed an assertion

Obtained from:	Atheros
MFC after:	3 days
2005-07-22 17:21:36 +00:00
Sam Leffler
aa8c14c444 missed one in last commit; add device name to discard msgs 2005-07-22 17:16:37 +00:00
Sam Leffler
497c84ae3a include device name in discard msgs 2005-07-22 17:13:44 +00:00
Sam Leffler
bd6f09d92f add diag msgs for frames discarded because the direction field is wrong 2005-07-22 17:12:05 +00:00
Sam Leffler
1bd482ef57 split data frame delivery out to a new function ieee80211_deliver_data 2005-07-22 17:08:38 +00:00
Sam Leffler
70231e3d0a o add IEEE80211_IOC_FRAGTHRESHOLD for getting+setting the
tx fragmentation threshold
o fix bounds checking on IEEE80211_IOC_RTSTHRESHOLD

MFC after:	3 days
2005-07-22 17:00:48 +00:00
Sam Leffler
33acb1cec1 o add IEEE80211_FRAG_DEFAULT
o move default settings for RTS and frag thresholds to ieee80211_var.h
2005-07-22 16:55:27 +00:00
Sam Leffler
2c39b32c94 diff reduction against p4: define IEEE80211_FIXED_RATE_NONE and use
it instead of -1
2005-07-22 16:50:18 +00:00
Sam Leffler
af8d224ec0 add flags missed in last merge 2005-07-22 16:37:56 +00:00
Sam Leffler
f6df31916c Diff reduction against p4:
o add ic_flags_ext for eventual extention of ic_flags
o define/reserve flag+capabilities bits for superg,
  bg scan, and roaming support
o refactor debug msg macros

MFC after:	3 days
2005-07-22 16:36:12 +00:00
Ruslan Ermilov
c5bf476aa9 Fallout from the previous revision: lnc isn't quite ready for amd64 yet. 2005-07-22 16:02:40 +00:00
Ruslan Ermilov
68f88450a7 Fix build (including both asm.h and asmacros.h is evil). 2005-07-22 15:01:07 +00:00
Ruslan Ermilov
a2f4d905bb Don't drop frames if interface is in promiscuous mode.
PR:		kern/83833
Submitted by:	Eygene A. Ryabinkin
MFC after:	3 days
2005-07-22 11:27:07 +00:00
Sam Leffler
a3d1edc2b2 send a response when an auth request is denied due to an acl;
might be better to silently ignore the frame but this way we
give stations a chance of figuring out what's wrong
2005-07-22 05:17:52 +00:00
Sam Leffler
79198e858b remove excess whitespace 2005-07-22 05:15:53 +00:00
Sam Leffler
b138c15024 use IF_HANDOFF when bridging frames internally so if_start gets
called; fixes communication between associated sta's

MFC after:	3 days
2005-07-22 04:55:40 +00:00
David E. O'Brien
b8b77732ff Fix $FreeBSD$. 2005-07-22 04:03:25 +00:00
Paul Saab
865b5cc7fd Remove the NFS client rslock. The rslock was used to serialize
writers that want to extend the file. It was also used to serialize
readers that might want to read the last block of the file (with a
writer extending the file).  Now that we support vnode locking for
NFS, the rslock is unnecessary. Writers grab the exclusive vnode
lock before writing and readers grab the shared (or in some cases
the exclusive) lock.

Submitted by:	Mohan Srinivasan
2005-07-21 22:46:56 +00:00
Peter Wemm
9e76f9ad3f Like on i386, bypass lock prefix for atomic ops on !SMP kernels. 2005-07-21 22:35:02 +00:00
Gleb Smirnoff
5bc15201f4 Fix cut-n-paste error, introduced in rev. 1.103. 2005-07-21 22:15:37 +00:00
Robert Watson
638ccea02a Allocate one of the spare ifnet integer fields to hold if_drv_flags,
which in the future will hold IFF_OACTIVE and IFF_RUNNING, and have
its access synchronized by the device driver rather than the
protocol stack.  This will avoid potential races in the management
of flags in if_flags.

Discussed with:	various (scottl, jhb, ...)
MFC after:	1 week
2005-07-21 22:01:06 +00:00
Peter Wemm
4bf21bfef9 MFi386: add vpd driver (vital product data.. model & serial numbers etc) 2005-07-21 21:57:31 +00:00
Peter Wemm
6ec2971397 Add the ed driver for lint building. The PCI instances are still useful.
In theory, there are no isa slots on any amd64/em64t systems, but it
doesn't hurt to keep these tiny fragments compiling.
2005-07-21 21:55:11 +00:00
Peter Wemm
84d7e08229 Actually create the double fault stack page for AP cpus so that we have a
chance of getting a working double fault instead of converting it to an
instant triple fault reset.
2005-07-21 21:46:09 +00:00
Gleb Smirnoff
e58d779daa Catch up with netgraph.h rev. 1.57 and fix build. 2005-07-21 20:34:40 +00:00
Robert Watson
00a254a8aa Remove duplicate initialization of mpo_create_stub pointer.
PR:		83779
Submitted by:	Wojciech A. Koszek <dunstan at freebsd dot czest dot pl>
MFC after:	3 days
2005-07-21 17:17:51 +00:00
John Baldwin
9cc8edda00 - Use the PCIR_BAR() macro rather than hardcoding rids.
- Use pci_enable_busmaster() rather than fiddling with the PCI command
  register directly.
2005-07-21 16:43:07 +00:00
John Baldwin
88519d6427 Don't set if_start to tulip_ifstart all over the place. It is already
set in tulip_attach() and its value is never changed, so all the extra sets
are redundant.  I'm guessing that at some point in time de(4) had an
alternate start routine, but that hasn't been true in recent history.
2005-07-21 16:42:21 +00:00
John Baldwin
fe0c8544ff Remove conditional code that has largely rotted that is also not on by
default:
- TULIP_NEED_FASTTIMEOUT - tulip_fasttimeout() wasn't called anywhere
- BIG_PACKET - only worked on i386 anyway
- TULIP_USE_SOFTINTR - doesn't compile and was never updated to handle
  new netisr registration
- non-FreeBSD code
2005-07-21 16:40:08 +00:00
Hajimu UMEMOTO
885adbfa81 always copy ip6_pktopt. remove needcopy and needfree
argument/structure member accordingly.

Submitted by:	Keiichi SHIMA <keiichi__at__iijlab.net>
Obtained from:	KAME
2005-07-21 16:39:23 +00:00
John Baldwin
9862c11e9d Use get_cyclecount() rather than hardcoding rdtsc and rpcc in asm for i386
and alpha, respectively.
2005-07-21 16:34:14 +00:00
John Baldwin
e5e871963c Fix a typo and some whitespace nits. 2005-07-21 16:33:05 +00:00
Hajimu UMEMOTO
e07db7aa57 simplified udp6_output() and rip6_output(): do not override
in6p_outputopts at the entrance of the functions.  this trick was
necessary when we passed an in6 pcb to in6_embedscope(), within which
the in6p_outputopts member was used, but we do not use this kind of
interface any more.

Submitted by:	Keiichi SHIMA <keiichi__at__iijlab.net>
Obtained from:	KAME
2005-07-21 16:32:50 +00:00
Maksim Yevmenkin
6502441272 Fix kernel panic with vkbd(4). Initialize mutex properly (set name), or else
WITNESS gets upset.

MFC after:	3 days
2005-07-21 16:19:08 +00:00
Hajimu UMEMOTO
d5e3406d06 be consistent on naming advanced API functions; use ip6_XXXpktopt(s).
Submitted by:	Keiichi SHIMA <keiichi__at__iijlab.net>
Obtained from:	KAME
2005-07-21 15:06:32 +00:00
Hajimu UMEMOTO
8507acb169 NULL is not zero.
Submitted by:	Keiichi SHIMA <keiichi__at__iijlab.net>
Obtained from:	KAME
2005-07-21 14:57:53 +00:00
Gleb Smirnoff
59087d62e7 Bump NG_ABI_VERSION. A number of ABI breakeges had been done since
RELENG_5 fork.
2005-07-21 12:32:52 +00:00
Gleb Smirnoff
25f8b7d9c3 Enhance struct ng_hook - add hk_type field. This field will describe
data link type of the hook. It will be used to ease autoconfiguration
of netgraph and also to print warning messages, when incompatoble nodes
are connected together.
2005-07-21 12:31:42 +00:00
Gleb Smirnoff
f912c0f77c Problem description:
At the end of ng_snd_item(), node queue is processed. In certain
netgraph setups deep recursive calls can occur.
  For example this happens, when two nodes are connected and can send
items to each other in both directions. If, for some reason, both nodes
have a lot of items in their queues, then the processing thread will
recurse between these two nodes, delivering items left and right, going
deeper in the stack. Other setups can suffer from deep recursion, too.
The following factors can influence risk of deep netgraph call:
 - periodical write-access events on node
 - combination of slow link and fast one in one graph
 - net.inet.ip.fastforwarding

Changes made:

 - In ng_acquire_{read,write}() do not dequeue another item. Instead,
   call ng_setisr() for this node.
 - At the end of ng_snd_item(), do not process queue. Call ng_setisr(),
   if there are any dequeueable items on node queue.
 - In ng_setisr() narrow worklist mutex holding.
 - In ng_setisr() assert queue mutex.

Theoretically, the first two changes should negatively affect performance.
To check this, some profiling was made:

1) In general real tasks, no noticable performance difference was found.

2) The following test was made: two multithreaded nodes and one
single-threaded were connected into a ring. A large queues of packets
were sent around this ring. Time to pass the ring N times was measured.
This is a very vacuous test: no items/mbufs are allocated, no upcalls or
downcalls outside of netgraph. It doesn't represent a real load, it is
a stress test for ng_acquire_{read,write}() and item queueing functions.
Surprisingly, the performance impact was positive! New code is 13% faster
on UP and 17% faster on SMP, in this particular test.

The problem was originally found, described, analyzed and original patch
was written by Roselyn Lee from Vernier Networks. Thanks!

Submitted by:		Roselyn Lee <rosel verniernetworks com>
2005-07-21 12:08:37 +00:00