Jeff Roberson [Fri, 19 Sep 2003 08:37:44 +0000 (08:37 +0000)]
- Fix the silly flag situation in UMA. Remove redundant ZFLAG/ZONE flags
by accepting the user supplied flags directly. Previously this was not
done so that flags for the same field would not be defined in two
different files. Add comments in each header instructing future
developers on how now to shoot their feet.
- Fix a test for !OFFPAGE which should have been a test for HASH. This would
have caused a panic if we had ever destructed a malloc zone. This also
opens up the possibility that other zones could use the vsetobj() method
rather than a hash.
Change TRAPF_USERMODE and CLOCKF_USERMODE to not test for CPL == 3,
but for CPL != 0. For some reason yet unknown it is possible for the
CPL to be 2. This would previously be counted as kernel mode, which
resulted in nasty panics. By changing the test it is now treated as
user mode, which is more correct. We still need to figure out how it
is possible that the privilege level can be 2 (or 1 for that matter),
because it's not used by us. We only use 3 (user mode) and 0 (kernel
mode).
Jeff Roberson [Fri, 19 Sep 2003 06:26:45 +0000 (06:26 +0000)]
- Initialize a pool of bucket zones so that we waste less space on zones that
don't cache as many items.
- Introduce the bucket_alloc(), bucket_free() functions to wrap bucket
allocation. These functions select the appropriate bucket zone to
allocate from or free to.
- Rename ub_ptr to ub_cnt to reflect a change in its use. ub_cnt now reflects
the count of free items in the bucket. This gets rid of many unnatural
subtractions by 1 throughout the code.
- Add ub_entries which reflects the number of entries possibly held in a
bucket.
Jeff Roberson [Fri, 19 Sep 2003 04:39:08 +0000 (04:39 +0000)]
- Only use UMA to cache malloc requests up to PAGE_SIZE. Values larger than
this are requested very infrequently and waste memory when we cache
spares.
Bill Paul [Thu, 18 Sep 2003 18:32:15 +0000 (18:32 +0000)]
In re_diag(), there's no need for us to call re_start() ourselves:
IF_HANDOFF() does it for us behind the scenes. Remove the extra call
to re_start() otherwise we try to transmit twice.
In re_encap(), fix the code that guards against consuming too many
descriptors in the TX ring so that it actually works. With the
new 8169S chip, I was able to hit a corner case that drained the
free descriptor count all the way to 0. This is not supposed to
be possible.
John Baldwin [Thu, 18 Sep 2003 17:00:03 +0000 (17:00 +0000)]
Fix a busted constant related to PCI configuration acess method #1. The
reserved bits in the port that must be zero are 24:30, not 20:30. Bits
16:23 are used to set the bus number. This meant that when we tested for
config mechanism #1, if the previous PCI configuration transaction sent
used a bus number greater than 15, one of the bits in 20:23 would be
non-zero and we would fail to use config mechanism #1 and thus fail to see
that PCI existed on the machine at all.
Obtained from: Shanley's PCI System Architecture book
Tested by: des
Proxied through: njl
Referring to FreeBSD versions later than 2.0R as "fairly recent" is pretty
archaic at this point in time. Pretend nobody runs FreeBSD 1.x anymore
in order to not confuse people needlessly.
Laplink support probably doesn't even work at this point in time anyway...
Bruce Evans [Thu, 18 Sep 2003 07:01:30 +0000 (07:01 +0000)]
Don't forget to reenable interrupts after a breakpoint and trace traps from
user mode. This goes with rev.1.468 of machdep.c which changed the gates
for these traps to interrupt gates. Having the interrupts disabled for
these traps from user mode is just an unwanted side effect.
This fixes at least 1 case of "panic: absolutely cannot call
smp_ipi_shootdown with interrupts already disabled". Too much code was
run with interrupts disabled, and it sometimes hit a sanity check.
Implement the O modifier. The O modifier sorts the words in a
variable. The implementation is based upon the patch sent to
arch@, but modified to be compatible with NetBSD. The modifier
that does a reverse sort has been dropped for now, but the
ability to add one later has been preserved.
Sam Leffler [Wed, 17 Sep 2003 22:06:47 +0000 (22:06 +0000)]
Bandaid locking change: mark static rule mutex recursive so re-entry when
sending an ICMP packet doesn't cause a panic. A better solution is needed;
possibly defering the transmit to a dedicated thread.
Sam Leffler [Wed, 17 Sep 2003 19:27:43 +0000 (19:27 +0000)]
o add support for setting 128-bit WEP keys
o use IEEE80211_KEYBUF_SIZE instead of magic numbers
o distinguish between 40-, 104-, and 128-bit WEP keys when printing status
Bruce Evans [Wed, 17 Sep 2003 16:44:02 +0000 (16:44 +0000)]
Fixed bitrot in the probe in revs.1.127, 1.165 and 1.169. The
COM_NOFIFO() and COM_ESP cases are supposed to be a subsets of the
plain 16550A case, but 16650-related changes made the former fall into
the latter and then both fall into general code for printing the tx
fifo size. This mainly caused hard to parse boot messages like:
"sio0: type 16550A fifo disabled lookalike with 1 bytes FIFO".
COM_NOFIFO() on an ESP port gave a larger mess whose extent is not
clear.
Bruce Evans [Wed, 17 Sep 2003 14:05:16 +0000 (14:05 +0000)]
Cleaned up initialization of hardware flow control for 16650As. Use
defined values instead of hard-coded values. Don't repeat the register
access part of the code 4 times times or triple-space statements. This
fixes half of the style bugs in rev.1.172.
Hardware flow control of 16650As is still officially unsupported. I
was mistaken about it being broken. It is broken in 16650s but is
fixed in 16650As except for the maximum trigger level (which is no
longer used). Testing of the 16650's broken hardware flow control
watermarks by programming them on 16950s showed that their effects are
not too bad if the fifo size and trigger level are reasonably large
(16 is much better than 8).
Add pci_resume() to reestablish interrupt routing after
suspend/resume.
Especially after hibernation, interrupt routing went back to initial
status on some machines.
Fix a `cast to pointer from integer of different size' warning.
usage() has been made a (non-void) function so that it can be
used in a pointer expression (see macro `next'). Widen the
implied integer return type of usage() so that we can cast to
a pointer without warnings.
In uart_intr() loop until all interrupts have been handled. Previously
an UART interface could get stuck when a new interrupt condition
arose while servicing a previous interrupt. Since an interrupt was
already pending, no new interrupt would be triggered.
Avoid infinite recursion by flushing the Rx FIFO and marking an
overrun condition when we could not move the data from the Rx
FIFO to the receive buffer in toto. Failure to flush the Rx FIFO
would leave the Rx ready condition pending.
Note that the SAB 82532 already did this due to the nature of the
chip.
Only build the ebus driver on sparc64. It includes a header directly
from the sparc64 subtree, which breaks building non-sparc64 platforms
in the event the sparc64 subtree does not exist.
The problem is specific to the module, because non-module builds are
affected by the presence or absence of "device ebus" in the kernel
configuration.
Add locking to the hardware drivers. I intended to figure out more
precisely where locking would be needed before adding it, but it
seems uart(4) draws slightly too much attention to have it without
locking for too long.
The lock added is a spinlock that protects access to the underlying
hardware. As a first and obvious stab at this, each method of the
hardware interface grabs the lock. Roughly speaking this serializes
the methods. Exceptions are the probe, attach and detach methods.
Sam Leffler [Wed, 17 Sep 2003 00:56:50 +0000 (00:56 +0000)]
Add locking.
o change timeout to MPSAFE callout
o restructure rule deletion to deal with locking requirements
o replace static buffer used for ipfw control operations with malloc'd storage
Sam Leffler [Wed, 17 Sep 2003 00:54:04 +0000 (00:54 +0000)]
Minor fixups + add locking.
o change time to MPSAFE callout
o make debug printfs conditional on DUMMYNET_DEBUG and runtime controllable
by net.inet.ip.dummynet.debug
o make boot-time printf dependent on bootverbose
Sam Leffler [Wed, 17 Sep 2003 00:50:33 +0000 (00:50 +0000)]
Minor overhaul and add locking.
o replace magic constants with #defines (e.g. ETHER_ADDR_LEN)
o move mib variables to net.link.ether.bridge with backwards compatible
entries for well-known items maintained under BURN_BRIDGES
o revamp debugging support so it is conditioanlly compiled with BRIDGE_DEBUG
(on currently) and runtime controlled by net.link.ether.bridge.debug
o change timeout to MPSAFE callout
o optimize lookup for common case of two interfaces
o optimize forwarding path to take IFNET lock only when needed
o make boot-time printf dependent on bootverbose
o sundry style changes (ANSI decls, extraneous spaces, etc.)
Add acpi to the build on ia64. The support for ACPI 2.0x has gotten
to a point where we don't map the wrong (ie 32-bit) addresses. We
don't always dump the right values yet, but that's not critical.
Scott Long [Tue, 16 Sep 2003 16:07:15 +0000 (16:07 +0000)]
Correctly wrap the producer queue index when dequeuing commands. This wasn't
a problem for command responses since we rarely ever filled the queue.
However, adapter-initiated commands have a much smaller queue and could
tickle this bug. It's possible that this might fix the recently reported
problems with the aac-2120s, though I haven't been able to reproduce the
problem locally.
Bruce Evans [Tue, 16 Sep 2003 14:21:17 +0000 (14:21 +0000)]
Added definitions of most of the interesting 16950 register numbers
and some of their bits (i.e., fifo trigger levels, frequency multipliers
and divisors, and bits to select the registers for these). This
attempts to completely describe the 16950's complicated register selects
for 16950-specific registers only.
Bruce Evans [Tue, 16 Sep 2003 13:52:01 +0000 (13:52 +0000)]
Fixed a minor error in the description of the EFR and a major error in
the description of the data latch registers (they were described as
readonly).
Added some better and worse aliases for standard registers, mostly taken
from the 16950 data sheet. Define deprecated aliases in terms of the
preferred one.
Don't define com_efr in terms of com_fifo. It is unrelated (in a
different bank).
Bruce Evans [Tue, 16 Sep 2003 11:54:29 +0000 (11:54 +0000)]
Sorted register numbers together with the correspoding register bits.
Merged comments to match (put them at the right of the #defines instead
of duplicating them).
Sorted the resulting sections on UART type and register bank. Added a
comment for each bank.
Bruce Evans [Tue, 16 Sep 2003 11:24:23 +0000 (11:24 +0000)]
Don't repeat selected defines from ns16550.h or sioreg.h. Just
include ns16550.h. The missing installation of ns16550.h was fixed
long ago and the misplaced defines in sioreg.h were fixed recently.
Bruce Evans [Tue, 16 Sep 2003 08:08:08 +0000 (08:08 +0000)]
Moved the definitions of the bits in the ns*50 registers from sioreg.h
to ns16550.h. The organization of these files was sort of backwards.
The bits in the registers have no driver or bus dependencies but they
but the offsets of the registers in bus space are very bus-dependent.
However, it does no harm to keep the definitions of the register offsets
in ns16550.h provided they are thought of as internal ns*50 offsets.
Martin Blapp [Tue, 16 Sep 2003 05:01:27 +0000 (05:01 +0000)]
Don't read the MAC address from a copy of the EEPROM in the softc
that has been recorded earlier and overwrite it again later by
reading it directly from the EEPROM again.
Read the MAC address from the PAR0/PAR1 registers instead, which
are autoloaded on reboot.
Tested on AN985, AN983B. According to the datasheets, it should
also work for the AL981 (I don't have such a chip on a card at home)
PR: 52988
Submitted by: Andrew Gordon <arg-bsd@arg.me.uk>
MFC after: 2 weeks
Daniel Eischen [Tue, 16 Sep 2003 00:00:53 +0000 (00:00 +0000)]
Remove a comment that questioned why the size of the FPU
state for amd64 was twice as large as necessary. Peter
recently fixed this, so the comment no longer applies.
Also, since the size of struct mcontext changed, adjust
the threads library version of get&set context to match.
FYI, any change layout/size change to any arch's struct
mcontext will likely need some minor changes in libpthread.
Bill Fenner [Mon, 15 Sep 2003 23:38:06 +0000 (23:38 +0000)]
From OpenBSD:
always widen the imputed netmask if it is narrower than the specified octets.
fixes a strange behaviour where inet_net_pton would always return 4 (bits)
for multicast addresses no matter how many octets were specified.
negotiated with Paul Vixie, original author of this function.
PR: standards/53151
Submitted by: Max Laier <max@love2party.net>
Optained from: OpenBSD
Sam Leffler [Mon, 15 Sep 2003 22:34:46 +0000 (22:34 +0000)]
Maintain a history of data associated with received frames and use this to
calculate smoothed signal quality data for each node.
o add a 16-deep history buffer to each driver-private node storage that
holds rssi and antenna info for received frames
o override the default per-node "get rssi" method to return an average
rssi value based on samples collected over the last second
o enable beacon reception so even idle systems maintain a running history
of signal quality
This data may also be useful for improving the rate control algorithm.
Based on work by Tom Marshall <tommy@home.tig-grr.com> for MADWIFI.
Sam Leffler [Mon, 15 Sep 2003 22:28:07 +0000 (22:28 +0000)]
Generalize the per-node RSSI data so drivers can do more interesting
things than record a single value.
o add a per-node method for returning the "current RSSI" for a node
o create a default method that returns ni_rssi which is the rssi for
the last received frame
o use the per-node "get rssi" method to return data for the RID's
submitted by wicontrol, et. al.
Loosely based on work by Tom Marshall <tommy@home.tig-grr.com> for MADWIFI.
Bump the EC timeout from 50 to 100 ms. I believe the underlying issue is
global lock contention as symptoms only appear under heavy load (i.e. the
nightly periodic run).
Ruslan Ermilov [Mon, 15 Sep 2003 21:18:30 +0000 (21:18 +0000)]
Catch up with libpthread/support/Makefile.inc,v 1.6 and revert
Makefile.inc1 revisions 1.365 and 1.367: libc_pic.a is no longer
necessary to build libpthread.so (ie: libkse.so).
Sam Leffler [Mon, 15 Sep 2003 19:41:54 +0000 (19:41 +0000)]
o do not filter received frames based on type or length; pass 'em all up
to the 802.11 layer if they are at least IEEE80211_MIN_LEN
o mask off interrupt status bits that we don't care about so we don't do
the wrong thing; this fixes a problem where the beacon miss interrupt status
bit is delivered together with other status bits when operating in monitor
mode (we would post a beacon miss swi and then do the wrong thing)
Sam Leffler [Mon, 15 Sep 2003 19:38:29 +0000 (19:38 +0000)]
Change input handling to not expect drivers to filter short frames.
In particular, let drivers send up control frames so we can dispatch
them to bpf in monitor mode.
This is the first (small) step to adding more functionality such as
power save mode.
Sam Leffler [Mon, 15 Sep 2003 19:36:34 +0000 (19:36 +0000)]
add definitions for various control frames and a minimum-sized frame that
we use to define IEEE80211_MIN_LEN; the minimal length for frames drivers
may pass up into the 802.11 layer
Martin Blapp [Mon, 15 Sep 2003 18:27:38 +0000 (18:27 +0000)]
Release a previous lease if there is any, instead of
just killing dhclient. Needed my some broken dhcpd
implementations to be able to get a lease again.