Robert Watson [Mon, 26 Mar 2007 08:59:03 +0000 (08:59 +0000)]
Complete removal of uipc_socket2.c by moving the last few functions to
other C files:
- Move sbcreatecontrol() and sbtoxsockbuf() to uipc_sockbuf.c. While
sbcreatecontrol() is really an mbuf allocation routine, it does its work
with awareness of the layout of socket buffer memory.
- Move pru_*() protocol switch stubs to uipc_socket.c where the non-stub
versions of several of these functions live. Likewise, move socket state
transition calls (soisconnecting(), etc) to uipc_socket.c. Moveo
sodupsockaddr() and sotoxsocket().
Yaroslav Tykhiy [Mon, 26 Mar 2007 08:58:22 +0000 (08:58 +0000)]
We no longer embed ifnet in softc, and the pointer to ifnet
doesn't need to be first in softc now. (It was the whole
ifnet structure itself that needed to be first in the good
old days.) Fix the respective comment accordingly.
Add xrefs to ifnet(9) in some other comments while I'm here.
Yaroslav Tykhiy [Mon, 26 Mar 2007 04:50:06 +0000 (04:50 +0000)]
Introduce a new toy interface, edsc(4). It's a discard interface
imitating an Ethernet device, so vlan(4) and if_bridge(4) can be
attached to it for testing and benchmarking purposes. Its source
can be an introduction to the anatomy of a network interface driver
due to its simplicity as well as to a bunch of comments in it.
(The rest of needed changes were in my previous commit, which got
interrupted in the middle. Alas, CVS commits are not atomic.)
Yaroslav Tykhiy [Mon, 26 Mar 2007 04:39:18 +0000 (04:39 +0000)]
Introduce a new toy interface, edsc(4). It's a discard interface
imitating an Ethernet device, so vlan(4) and if_bridge(4) can be
attached to it for testing and benchmarking purposes. Its source
can be an introduction to the anatomy of a network interface driver
due to its simplicity as well as to a bunch of comments in it.
Andre Oppermann [Sun, 25 Mar 2007 23:27:26 +0000 (23:27 +0000)]
In tcp_sack_doack() remove too tight KASSERT() added in last revision. This
function may be called without any TCP SACK option blocks present. Protect
iteration over SACK option blocks by checking for SACK options present flag
first.
Robert Watson [Sun, 25 Mar 2007 21:49:50 +0000 (21:49 +0000)]
Replace a comment about RSVP/mrouting with a different but similar comment
explaining that some more locking is needed. The routing pieces are done,
but there is an interlocking issue between optionally compiled code and
mandatory code.
Robert Watson [Sun, 25 Mar 2007 21:44:24 +0000 (21:44 +0000)]
Replace GIANT_REQUIRED's present for socket locking with NET_LOCK_GIANT().
If/when someone does the necessary MPSAFEty locking for the NFSv4 client,
the socket code is generally MPSAFE now.
Alan Cox [Sun, 25 Mar 2007 19:33:40 +0000 (19:33 +0000)]
Two small changes to vm_map_pmap_enter():
1) Eliminate an unnecessary check for fictitious pages. Specifically,
only device-backed objects contain fictitious pages and the object is
not device-backed.
2) Change the types of "psize" and "tmpidx" to vm_pindex_t in order to
prevent possible wrap around with extremely large maps and objects,
respectively. Observed by: tegge (last summer)
Jason Evans [Sat, 24 Mar 2007 20:44:06 +0000 (20:44 +0000)]
Fix some subtle bugs for posix_memalign() having to do with integer
rounding and overflow. Carefully document what the various overflow
tests actually detect.
The bugs mostly canceled out, such that the worst possible failure
cases resulted in non-fatal over-allocations.
Yaroslav Tykhiy [Sat, 24 Mar 2007 20:26:54 +0000 (20:26 +0000)]
Back out rev. 1.129 because it breaks the practice of auto-loading
hardware drivers. Unlike pseudo-device drivers, which just attach
to the cloning framework and wait for "ifconfig create", h/w drivers
create interfaces for installed cards as soon as loaded. The issue
of devd(8) involuntarily reloading modules should be dealt with in a
different way.
Alan Cox [Sat, 24 Mar 2007 19:53:22 +0000 (19:53 +0000)]
In order to satisfy ACPI's need for an identity mapping, modify the
temporary mapping created by locore so that the lowest two to four
megabytes can become a permanent identity mapping. This implementation
avoids any use of a large page mapping.
Warner Losh [Fri, 23 Mar 2007 23:47:59 +0000 (23:47 +0000)]
Default to booting off the SD card. It is more useful, and a full
FreeBSD/arm installworld install is only 170MB. The smallest SD card
I could find at the store today was 512MB (and it was only $10 after
rebate), with a 2GB card for as low as $25.00...
Now that the IIC stuff has been sorted out, include that as well.
Include hints for the icee 16kb 16-bit i2c device. It should include
info about the temperature sensor as well, but that driver isn't quite
ready.
Warner Losh [Fri, 23 Mar 2007 23:08:28 +0000 (23:08 +0000)]
MFp4: Make the iicbus fully hinted. We no longer automatically add
some devices (and not others). To get instances onto the iicbus, one
now needs hints or an identify routine. We also do not probe the bus
for devices because many iic devices cannot be safely probed (and when
they can, the probe order turns out to be somewhat difficult to get
right).
# I'm not 100% sure that the iicsmb removal is right. Please contact me if
# this causes difficulty.
Jason Evans [Fri, 23 Mar 2007 22:58:15 +0000 (22:58 +0000)]
Fix posix_memalign() for large objects. Now that runs are extents rather
than binary buddies, the alignment guarantees are weaker, which requires
a more complex aligned allocation algorithm, similar to that used for
alignment greater than the chunk size.
Warner Losh [Fri, 23 Mar 2007 22:57:24 +0000 (22:57 +0000)]
MFp4: A bunch of patches from myself and Tisco to improve the
robustness of IIC transactions when parts aren't present. This also
removes a bunch of debug. This also moves this driver to 7-1
addressing rather than 6-0 addressing, which is more inline with all
the other iic drivers in the tree. I've tested this for about a
million years on the systems at work.
Jung-uk Kim [Fri, 23 Mar 2007 22:26:01 +0000 (22:26 +0000)]
Update to FICL 3.03 (the last release before FICL4 rewrite).
The relevant changes for FreeBSD (excerpt from the release note):
* Newly implemented CORE EXT words: CASE, OF, ENDOF, and ENDCASE. Also
added FALLTHROUGH, which works like ENDOF but jumps to the instruction
just after the next OF.
* Bugfix: John-Hopkins locals syntax now accepts | and -- in the comment
(between the first -- and the }.)
* Bugfix: Changed vmGetWord0() to make Purify happier. The resulting
code is no slower, no larger, and slightly more robust.
Andre Oppermann [Fri, 23 Mar 2007 20:16:50 +0000 (20:16 +0000)]
Split tcp_input() into its two functional parts:
o tcp_input() now handles TCP segment sanity checks and preparations
including the INPCB lookup and syncache.
o tcp_do_segment() handles all data and ACK processing and is IPv4/v6
agnostic.
Change all KASSERT() messages to ("%s: ", __func__).
The changes in this commit are primarily of mechanical nature and no
functional changes besides the function split are made.
John Baldwin [Fri, 23 Mar 2007 17:15:07 +0000 (17:15 +0000)]
- Fix exca_(io|mem)_map() to return proper errno values.
- Change exca_activate_resource() to call BUS_ACTIVATE_RESOURCE() before
calling exca_(io|mem)_map() since the latter use rman_get_bus(tag|handle)
and the recent changes to nexus(4) mean that you need to activate a
resource before reading the bus tag and handle. This was true before,
but now the nexus(4) drivers on x86 and ia64 are more forceful about it.
Jason Evans [Fri, 23 Mar 2007 05:05:48 +0000 (05:05 +0000)]
Use extents rather than binary buddies to track free pages within
chunks. This allows runs to be any multiple of the page size. The
primary advantage is that large objects are no longer constrained to be
2^n pages, which can dramatically decrease internal fragmentation for
large objects. This also allows the sizes for runs that back small
objects to be more finely tuned.
Free runs are searched for linearly using the chunk page map (with the
help of some heuristic optimizations). This changes the allocation
policy from "first best fit" to "first fit". A prototype red-black tree
implementation for tracking free runs that implemented "first best fit"
did not cause a measurable speed or memory usage difference for
realistic chunk sizes (though of course it is possible to construct
benchmarks that favor one allocation policy over another).
Refine the handling of fullness constraints for small runs to be more
tunable.
Restructure the per chunk page map to contain only two fields per entry,
rather than four. Also, increase each entry from 4 to 8 bytes, since it
allows for 32-bit integers, without increasing the number of chunk
header pages.
Relax the maximum chunk size constraint. This is of no practical
interest; it is merely fallout from the chunk page map restructuring.
Revamp statistics gathering and reporting to be faster, clearer and more
informative. Statistics gathering is fast enough now to have little
to no impact on application speed, but it still requires approximately
two extra pages of memory per arena (per process). This memory overhead
may be acceptable for most systems, but we still need to leave
statistics gathering disabled by default in RELENG branches.
Rename NO_MALLOC_EXTRAS to MALLOC_PRODUCTION in order to make its intent
clearer (i.e. it should be defined in RELENG branches).
Marcel Moolenaar [Thu, 22 Mar 2007 23:45:25 +0000 (23:45 +0000)]
Pass the RID from the bus frontends to the core probe function.
Currently all RIDs are 0, but for PCI devices this typically
isn't the case. This change is made with future PCI support in
mind.
Matt Jacob [Thu, 22 Mar 2007 23:38:32 +0000 (23:38 +0000)]
MFP4: a) Some constification from NetBSD (gcc 4.1.2)
b) Split default param fetching/setting into scsi and fibre functions
and retry the fibre fetch more than once.
John Baldwin [Thu, 22 Mar 2007 16:09:23 +0000 (16:09 +0000)]
- Simplify the #ifdef's for adaptive mutexes and rwlocks by conditionally
defining a macro earlier in the file.
- Add NO_ADAPTIVE_RWLOCKS option to disable adaptive spinning for rwlocks.
Gleb Smirnoff [Thu, 22 Mar 2007 13:21:24 +0000 (13:21 +0000)]
Move the dom_dispose and pru_detach calls in sofree() earlier. Only after
calling pru_detach we can be absolutely sure, that we don't have any
references to the socket in the stack.
This closes race between lockless sbdestroy() and data arriving on socket.
Gleb Smirnoff [Thu, 22 Mar 2007 10:51:03 +0000 (10:51 +0000)]
When working on an RTM_CHANGE do the route editing in the following
sequence. First, if rt_ifa is going to be changed, then call
ifa_rtrequest(RTM_DELETE). Second, if gateway is going to be changed,
then call rt_setgate(). Third, change rt_ifa.
With this change we are able to change a link level route to a
gateway one, that wasn't possible before:
Gleb Smirnoff [Thu, 22 Mar 2007 10:37:53 +0000 (10:37 +0000)]
Remove global list of all llinfo_arp entries and use a callout per
instance expiry of the ARP entries. Since we no longer abuse the IPv4
radix head lock, we can now enter arp_rtrequest() with a lock held on
an arbitrary rt_entry.
John Baldwin [Wed, 21 Mar 2007 22:22:13 +0000 (22:22 +0000)]
Rename the cv_*wait*() functions to _cv_*wait*() and change their second
argument from a mutex to a lock_object. Add cv_*wait*() wrapper macros
that accept either a mutex, rwlock, or sx lock as the second argument and
convert it to a lock_object and then call _cv_*wait*(). Basically, the
visible difference is that you can now use rwlocks and sx locks with
condition variables using the same API as with mutexes.
John Baldwin [Wed, 21 Mar 2007 22:18:10 +0000 (22:18 +0000)]
Make use of 'lock_object' being the same field name in the witness_check*()
macros.
- witness_check() replaces witness_check_mtx() and
witness_check_exclusive_sx() and checks for an exclusive acquire of
either a mutex, rwlock, or sx lock.
- witness_check_shared() replaces witness_check_shared_sx() and checks for
a shared acquire of either a rwlock or sx lock.
John Baldwin [Wed, 21 Mar 2007 19:32:08 +0000 (19:32 +0000)]
If vn_open() fails during kern_open(), don't fdrop() the new file object
until after the call to fdclose(). This closes an obscure race that
could result in the later call to fdclose() actually closing a different
file descriptor if another thread close()'s the file descriptor being
opened before fdrop() is called, so the fdrop() in kern_open() frees the
file object, then the second thread (or a third) creates a new file
descriptor which reuses both the same index and the same file pointer
thus tricking fdclose() in the first thread into thinking that the
original file was still open.
John Baldwin [Wed, 21 Mar 2007 18:40:31 +0000 (18:40 +0000)]
Fix an off-by-one error in iwi_init_fw_dma(). It didn't reuse the existing
DMA memory for a firmware load if it was the exact size needed, thus in the
common case the driver was constantly free'ing and reallocating the DMA
buffer and it would eventually begin to fail. With this fix, iwi0 reuses
the same buffer the entire time and no longer fails to load the firmware
after the machine has been up for a while.
Andre Oppermann [Wed, 21 Mar 2007 18:25:28 +0000 (18:25 +0000)]
Make TCP_DROP_SYNFIN a standard part of TCP. Disabled by default it
doesn't impede normal operation negatively and is only a few lines of
code. It's close relatives blackhole and log_in_vain aren't options
either.