dragonfly.git
19 months ago/boot/defaults/loader.conf: Adjust a comment.
Sascha Wildner [Mon, 27 Aug 2012 17:57:49 +0000 (19:57 +0200)]
/boot/defaults/loader.conf: Adjust a comment.

19 months agoixgbe: add tso_pullup function
François Tigeot [Sat, 25 Aug 2012 15:25:26 +0000 (17:25 +0200)]
ixgbe: add tso_pullup function

* This routine rearranges mbuf chains to get more continuous bytes,
  potentially increasing tcp send performance

* Single TCP streams are now able to push slightly more than 4Gb/s
  under the right circumstances

Taken-from: Sepherosa Ziehau's work on the igb(4) driver

19 months agoixgbe: enable existing FreeBSD IPv4 TSO code
François Tigeot [Sat, 25 Aug 2012 14:35:41 +0000 (16:35 +0200)]
ixgbe: enable existing FreeBSD IPv4 TSO code

* This is not perfect but increases sending speeds up to about 3.5 Gb/s
  by TCP connection

* Total throughput has been measured up to 9.22 Gb/s in the sending
  direction

19 months agokernel: IFCAP_TSO is really IPv4-specific
François Tigeot [Mon, 20 Aug 2012 19:59:03 +0000 (21:59 +0200)]
kernel: IFCAP_TSO is really IPv4-specific

* Rename IFCAP_TSO to IFCAP_TSO4 to make things crystal clear, keeping
  the old name for compatibility

* Add IFCAP_TSO6 for the future

19 months agokernel - reduce kern.maxvnodes default on 32 bit systems
Matthew Dillon [Sun, 26 Aug 2012 17:09:19 +0000 (10:09 -0700)]
kernel - reduce kern.maxvnodes default on 32 bit systems

* Reduce maximum kern.maxvnodes on standard-configured 32 bit systems
  from ~100K vnodes to ~80K vnodes to reduce kmem usage.

19 months agogrowfs(8)/ffsinfo(8): Use __func__
Sascha Wildner [Sun, 26 Aug 2012 11:15:35 +0000 (13:15 +0200)]
growfs(8)/ffsinfo(8): Use __func__

19 months agogrowfs(8): Fix building with -DFS_DEBUG.
Sascha Wildner [Sun, 26 Aug 2012 11:14:13 +0000 (13:14 +0200)]
growfs(8): Fix building with -DFS_DEBUG.

19 months agomake_dev.9: Fix typo.
Sascha Wildner [Sun, 26 Aug 2012 10:35:14 +0000 (12:35 +0200)]
make_dev.9: Fix typo.

19 months agokernel/ffs: Compare v_rdev directly when updating mounts.
Sascha Wildner [Sun, 26 Aug 2012 09:55:37 +0000 (11:55 +0200)]
kernel/ffs: Compare v_rdev directly when updating mounts.

Nowadays the vnode's v_rdev is always associated, so it can be used
directly to compare the devices.

Pointed-out-by: alexh
19 months agokernel/linprocfs: Implement /proc/devices.
Sascha Wildner [Sat, 25 Aug 2012 20:48:12 +0000 (22:48 +0200)]
kernel/linprocfs: Implement /proc/devices.

As close to Linux' format as I could get, and enough to make LSI's
MegaCli utility (for RAID configuration) work with mfi(4).

19 months agokernel/devfs: Fill out cdev_t's si_major field (and adjust one use case).
Sascha Wildner [Sun, 26 Aug 2012 10:12:46 +0000 (12:12 +0200)]
kernel/devfs: Fill out cdev_t's si_major field (and adjust one use case).

19 months agokernel/devfs: Pass more arguments to the callback for devfs_scan_callback.
Sascha Wildner [Sun, 26 Aug 2012 10:31:13 +0000 (12:31 +0200)]
kernel/devfs: Pass more arguments to the callback for devfs_scan_callback.

is_alias signals whether it is an alias or a real device. If true, name
is the alias name. If false, it is the device name.

Reviewed-by: alexh
19 months agokernel/devfs: Rename devfs_nodetype members (conflicts with {,lin}procfs.h).
Sascha Wildner [Thu, 23 Aug 2012 22:40:22 +0000 (00:40 +0200)]
kernel/devfs: Rename devfs_nodetype members (conflicts with {,lin}procfs.h).

19 months agoixgbe: enable VLAN code
François Tigeot [Sat, 25 Aug 2012 12:38:08 +0000 (14:38 +0200)]
ixgbe: enable VLAN code

19 months agokernel/devfs: Assert that the callback isn't NULL in devfs_scan_callback().
Sascha Wildner [Sat, 25 Aug 2012 06:04:39 +0000 (08:04 +0200)]
kernel/devfs: Assert that the callback isn't NULL in devfs_scan_callback().

19 months agoAdd a device_get_name(9) manual page (from FreeBSD).
Sascha Wildner [Sat, 25 Aug 2012 05:12:50 +0000 (07:12 +0200)]
Add a device_get_name(9) manual page (from FreeBSD).

19 months agokernel - Do not allow destroyed namecache entries to be re-resolved
Matthew Dillon [Sat, 25 Aug 2012 00:09:58 +0000 (17:09 -0700)]
kernel - Do not allow destroyed namecache entries to be re-resolved

* Do not allow a destroyed namecache entry to be re-resolved, as it
  might resolve as a completely different file, or even resolve as
  a file when it was originally a directory and so forth.

* Fixes inconsistencies in the current-dir fields in proc->p_fd.

* Note that most VFS's can't re-resolve a disconnected directory
  anyway but HAMMER1 actually can, so this was causing a problem
  in tests with HAMMER1 (the same tests that originally crashed
  tmpfs were also crashing HAMMER1, but for a different reason).

19 months agotmpfs - Fix numerous races and adjust to use cache_unlink()
Matthew Dillon [Fri, 24 Aug 2012 23:30:20 +0000 (16:30 -0700)]
tmpfs - Fix numerous races and adjust to use cache_unlink()

* Fix numerous issues when chdir'd into a directory that is then
  rmdir'd.

* Rewrite the link count handling code for directories, also removing
  two now unecessary recursions.

* Do not allow new files to be created in a directory which has been
  rmdir'd.

* Use the new cache_unlink facility.

19 months agokernel - Adjust devfs, hammer, and puffs to use the new cache_unlink()
Matthew Dillon [Fri, 24 Aug 2012 23:29:49 +0000 (16:29 -0700)]
kernel - Adjust devfs, hammer, and puffs to use the new cache_unlink()

* Adjust devfs, hammer, and puffs to use the new cache_unlink() mechanic.

19 months agokernel - add cache_unlink(), fix a rename issue.
Matthew Dillon [Fri, 24 Aug 2012 23:26:31 +0000 (16:26 -0700)]
kernel - add cache_unlink(), fix a rename issue.

* Add a rollup function called cache_unlink() to handle namecache
  effects when unlinking a file.

* Change namecache semantics a bit.  When a namecache entry is unlinked
  we allow it to be left in the topology as long as the vnode survives,
  but marked NCF_DESTROYED so it does not conflict with any new entries
  that might be named the same, and does not get returned in lookup results.

* This will solve the issue when renaming a file over an empty directory
  (destroying the directory) when one or more processes are chdir'd into
  that directory.  This would cause the process nchdir stuff to get out
  of sync with the retained directory vnode because the same namecache
  entry would get reused.

19 months agomutex.9: Misc updates and minor improvements.
Nuno Antunes [Fri, 24 Aug 2012 14:45:35 +0000 (15:45 +0100)]
mutex.9: Misc updates and minor improvements.

* mtx_spinlock_ex() and mtx_spinlock_sh() do not exist anymore. mtx_spinlock()
  replaced both.

* Add MLINKS for mtx_lock(), mtx_spinlock_try() and mtx_spinunlock().

* Use .Fn for function name mtx_lock_ex_quick().

* Add some text describing mtx_lock(), mtx_spinlock_try() and mtx_spinunlock().

* Start a sentence with capital letter but avoid starting with a function name.

* Add a missing .Fa.

* Add a cross reference to sleep(9) in the SEE ALSO section.

* Bump date.

Reviewed-by: swildner
20 months agokernel - Add additional clock_gettime() modes
Matthew Dillon [Fri, 24 Aug 2012 07:44:54 +0000 (00:44 -0700)]
kernel - Add additional clock_gettime() modes

* Add the following:
CLOCK_UPTIME (same as MONOTONIC)
CLOCK_UPTIME_PRECISE (same as MONOTONIC)
CLOCK_UPTIME_FAST (faster, less precise)
CLOCK_REALTIME_PRECISE (same as REALTIME)
CLOCK_REALTIME_FAST (faster, less precise)
CLOCK_MONOTONIC_PRECISE (same as MONOTONIC)
CLOCK_MONOTONIC_FAST (faster, less precise)
CLOCK_SECOND (just returns 'time_second')

Taken-from: FreeBSD

20 months agosysperf - Add tests for clock_gettime(CLOCK_*_FAST...) modes
Matthew Dillon [Fri, 24 Aug 2012 07:43:58 +0000 (00:43 -0700)]
sysperf - Add tests for clock_gettime(CLOCK_*_FAST...) modes

* Add tests for some of the new clock_gettime() modes.

20 months agousched_bsd4 - use wakeup_mycpu as appropriate
Alex Hornung [Fri, 24 Aug 2012 06:57:43 +0000 (06:57 +0000)]
usched_bsd4 - use wakeup_mycpu as appropriate

 * In the need_user_resched_remote we need to use wakeup_mycpu to avoid
   sending out IPIs triggering a deep IPI recursion panic.

 * In the setrunqueue case use wakeup_mycpu as an optimization, since we
   know that we are on the same CPU as the helper thread we want to wake
   up.

In-discussion-with: Matt Dillon
Reported-by: ftigeot
20 months agousched_bsd4 - fix incorrect use of PINTERLOCKED tsleep
Alex Hornung [Fri, 24 Aug 2012 06:44:43 +0000 (06:44 +0000)]
usched_bsd4 - fix incorrect use of PINTERLOCKED tsleep

 * The first tsleep in sched_thread has not been interlocked, so it is
   not valid to call tsleep(..., PINTERLOCKED, ...).

20 months agofastbulk - Exit w/success on more conditions
Matthew Dillon [Fri, 24 Aug 2012 04:53:28 +0000 (21:53 -0700)]
fastbulk - Exit w/success on more conditions

* If the binary package build succeeds but the pkg_add fails it is likely
  due to an install conflict.  Exit w/success for this case (since our goal
  is to generate the binary package, we succeeded!).

* Do an early check to see if the binary package has already been built
  and exit immediately if it has.

20 months agokernel - Fix pmap_remove() issue.
Matthew Dillon [Fri, 24 Aug 2012 03:44:53 +0000 (20:44 -0700)]
kernel - Fix pmap_remove() issue.

* When the inner loop of pmap_remove() broke out due to pmap_remove_pte()
  blocking it 'jumped' the sindex to pdnxt, thus any remaining pages in
  that page table page would get skipped.

* pmap_remove_pte() and friends used to return non-zero if they 'blocked'.
  Unfortunately they could actually block whether they returned 0 or non-zero,
  causing the problem.  Remove the check entirely.

* Adjust misc functions which we no longer need the return value for.

* I don't know if this had anything to do with the wire_count panic.
  The failure mode should have been caught by numerous other assertions
  in the code but wasn't.  get_ptbase() relies on a test of pmap->pm_cached
  to determine if a page directory page mapping changes so it should not
  have been possible for it to continue the loop and access a stale ptep.

  If it were possible it might account for a wire_count panic later on but
  it doesn't seem like it should be possible.

20 months agokernel - Implement Errata 721 for 32-bit kernels too
Matthew Dillon [Fri, 24 Aug 2012 03:41:26 +0000 (20:41 -0700)]
kernel - Implement Errata 721 for 32-bit kernels too

* The AMD errata 721 definitely happens on cpus running in cpu bit mode
  but I got a weird kernel crash on 32-bit (which I don't have time to
  follow up) so I decided, what the heck, might as well do it on 32-bit
  boxes too.

20 months agokernel - Do not allow the time to be set to { 0, 0 }
Matthew Dillon [Fri, 24 Aug 2012 03:39:05 +0000 (20:39 -0700)]
kernel - Do not allow the time to be set to { 0, 0 }

* The settimeofday() system call now fails with EINVAL if passed
  a { 0, 0 } tv structure.

* No need to allow this case, and it may fix some weird pkgsrc bulkbuild
  issues.  For some reason something in the bulk build calls settimeofday()
  with { 0, 0 } when linux.ko/linprocfs are not loaded.

20 months agofastbulk - Rework and clean up the Makefile
Matthew Dillon [Fri, 24 Aug 2012 03:36:15 +0000 (20:36 -0700)]
fastbulk - Rework and clean up the Makefile

* Rewrite the Makefile.  'make' with no arguments for more information.

* Proactively check and remove a dead /var/db/pkg directory after
  each build.

20 months agolinprocfs - Fix process exit / procfs vnode access race & stepping races
Matthew Dillon [Fri, 24 Aug 2012 00:00:49 +0000 (17:00 -0700)]
linprocfs - Fix process exit / procfs vnode access race & stepping races

* Taken from procfs, fix exit / vnode access races

* Fix stepping races.

20 months agolinprocfs - Fix missing PRELE()s.
Matthew Dillon [Thu, 23 Aug 2012 23:49:08 +0000 (16:49 -0700)]
linprocfs - Fix missing PRELE()s.

* The DFly pfind() API changed a while ago and now PHOLD()s the process,
  add missing PRELE()s to linprocfs that were missed during that
  change-over.

Reported-by: marino, alexh
20 months agomake_dev.9: devfs_scan_callback() takes an arg to pass to the callback.
Sascha Wildner [Thu, 23 Aug 2012 22:12:00 +0000 (00:12 +0200)]
make_dev.9: devfs_scan_callback() takes an arg to pass to the callback.

20 months ago<sys/devfs.h>: Fix comment typos.
Sascha Wildner [Thu, 23 Aug 2012 21:24:22 +0000 (23:24 +0200)]
<sys/devfs.h>: Fix comment typos.

20 months agomsgport.9: Sort cross references alphabetically.
Nuno Antunes [Thu, 23 Aug 2012 07:37:23 +0000 (08:37 +0100)]
msgport.9: Sort cross references alphabetically.

We sort SEE ALSOs first by section, then alphabetically.

Pointed-out-by: swildner
20 months agomsgport.9: Add cross reference to sleep(9).
Nuno Antunes [Thu, 23 Aug 2012 07:21:57 +0000 (08:21 +0100)]
msgport.9: Add cross reference to sleep(9).

20 months agosleep.9: Catch up with spin_{,un}lock_wr() -> spin_{,un}lock() rename of 2 years...
Nuno Antunes [Wed, 22 Aug 2012 06:47:11 +0000 (07:47 +0100)]
sleep.9: Catch up with spin_{,un}lock_wr() -> spin_{,un}lock() rename of 2 years ago.

* Accordingly rename function names in the ssleep() implementation example.

* We have only exclusive spinlocks, remove the "(write)" reference which was
  implicitly suggesting that we have another kind.

* While here, uncapitalize first letter of function a name.

20 months agovm: Put vm_page_alloc_contig debug prints under vm_contig_verbose
Sepherosa Ziehau [Thu, 23 Aug 2012 05:49:23 +0000 (13:49 +0800)]
vm: Put vm_page_alloc_contig debug prints under vm_contig_verbose

Tunable vm.contig_verbose could be used to control vm_contig_verbose.
It is disabled by default.

Well, it is too verbose even for bootverbose ...

20 months agojme: Add TSO support
Sepherosa Ziehau [Thu, 23 Aug 2012 05:27:15 +0000 (13:27 +0800)]
jme: Add TSO support

20 months agoroute: Routing table is replicated to all CPUs, not # of CPUs on power of 2
Sepherosa Ziehau [Thu, 23 Aug 2012 03:04:19 +0000 (11:04 +0800)]
route: Routing table is replicated to all CPUs, not # of CPUs on power of 2

DragonFly-bug: http://bugs.dragonflybsd.org/issues/2355

20 months agokernel - Attempt to fix i386 wire_count panic (98)
Matthew Dillon [Wed, 22 Aug 2012 23:54:19 +0000 (16:54 -0700)]
kernel - Attempt to fix i386 wire_count panic (98)

* Previous patch missed a code path.

* Cleanup

20 months agokernel - Fix 32-bit build
Matthew Dillon [Wed, 22 Aug 2012 23:44:55 +0000 (16:44 -0700)]
kernel - Fix 32-bit build

* Fix kprintf format mismatches in usched_bsd4.c for 32-bit builds.

20 months agofastbulk - more work
Matthew Dillon [Wed, 22 Aug 2012 23:17:01 +0000 (16:17 -0700)]
fastbulk - more work

* Output start and end date stamps

* Do a manual checksum test and delete the distfile if it fails (and the
  distfile is over 4 hours old).

* Do a better job deleting conflicting versions of a package.

20 months agofastbulk - More fixes and improvements
Matthew Dillon [Wed, 22 Aug 2012 22:07:15 +0000 (15:07 -0700)]
fastbulk - More fixes and improvements

* Fix improper cleaning of the "${BUILDROOT}/usr/obj/work" directory

* Use lockf to lock the wildcard name for a package, serializing the
  builds of any related packages so they don't interfere with each
  other.

* Clean the work directory on success or failure instead of only on
  success, othrewise a large >10G tmpfs is needed.

20 months agofastbulk - Remove core files & empty dirs from /var/pkg/db
Matthew Dillon [Wed, 22 Aug 2012 19:40:47 +0000 (12:40 -0700)]
fastbulk - Remove core files & empty dirs from /var/pkg/db

* The presence of a core file prevents the pkg code from properly handling
  the directory, causing installs from packages to fail if any dependency
  has a broken /var/pkg/db directory.

* Clean out any core files and empty dirs before starting a build.

20 months agoAdd an MLINK for KTR_COND_LOG.
Sascha Wildner [Wed, 22 Aug 2012 14:30:13 +0000 (16:30 +0200)]
Add an MLINK for KTR_COND_LOG.

While here, sort the msgport.9 MLINKS alphabetically.

20 months agoktr.4 - add note about KTR_USCHED_BSD4
Alex Hornung [Wed, 22 Aug 2012 15:20:07 +0000 (15:20 +0000)]
ktr.4 - add note about KTR_USCHED_BSD4

20 months agousched_bsd4 - Topology-aware scheduling
Mihai Carabas [Wed, 22 Aug 2012 10:03:45 +0000 (10:03 +0000)]
usched_bsd4 - Topology-aware scheduling

 * Part of "Add SMT/HT awareness to DragonFly BSD scheduler" GSoC
   project.

 * Details at: http://leaf.dragonflybsd.org/mailarchive/kernel/2012-08/msg00009.html

Mentored-by: Alex Hornung (alexh@)
Sponsored-by: Google Summer of Code 2012
20 months agovkernel{,64} - CPU topology support
Mihai Carabas [Wed, 22 Aug 2012 10:03:12 +0000 (10:03 +0000)]
vkernel{,64} - CPU topology support

 * Part of "Add SMT/HT awareness to DragonFly BSD scheduler" GSoC
   project.

 * Details at: http://leaf.dragonflybsd.org/mailarchive/kernel/2012-08/msg00009.html

Mentored-by: Alex Hornung (alexh@)
Sponsored-by: Google Summer of Code 2012
20 months agoCPU topology support
Mihai Carabas [Wed, 22 Aug 2012 10:02:58 +0000 (10:02 +0000)]
CPU topology support

 * Part of "Add SMT/HT awareness to DragonFly BSD scheduler" GSoC
   project.

 * Details at: http://leaf.dragonflybsd.org/mailarchive/kernel/2012-08/msg00009.html

Mentored-by: Alex Hornung (alexh@)
Sponsored-by: Google Summer of Code 2012
20 months agoktr - add KTR_COND_LOG
Mihai Carabas [Wed, 22 Aug 2012 13:07:18 +0000 (13:07 +0000)]
ktr - add KTR_COND_LOG

 * KTR_COND_LOG provides conditional logging; the second parameter passed
   in is a condition which determines whether the entry is logged or
   not.

 * It provides a neater way to log conditionally than having to wrap a
   KTR in an if, which may then end up being empty if KTR is disbled.

20 months agomsgport.9: Fix some minor mdoc issues.
Sascha Wildner [Wed, 22 Aug 2012 13:18:31 +0000 (15:18 +0200)]
msgport.9: Fix some minor mdoc issues.

20 months agofastbulk - Adjustments to fix various issues (2)
Matthew Dillon [Wed, 22 Aug 2012 06:46:58 +0000 (23:46 -0700)]
fastbulk - Adjustments to fix various issues (2)

* Use tmpfs for /usr/obj, this speeds up builds by a lot.
  make w/ -DNOTMPFS will use the hard drive if your tmpfs
  isn't big enough.

* Cleanup {chroot}/tmp/logs/run/* when restarting

* When restarting handle the case where the correct package has
  already been installed.

* When restarting handle the case where the binary package already
  exists.

* Use pkg_add -f when adding existing packages.

20 months agofastbulk - Adjustments to fix various issues
Matthew Dillon [Wed, 22 Aug 2012 05:18:40 +0000 (22:18 -0700)]
fastbulk - Adjustments to fix various issues

* We weren't properly installing the binary packages we were creating,
  resulting in parallel build races.  Fixing this fixes most of the
  issues fastbulk was having.

* Change the way pkgsrc is mounted... copy it to /build/fastbulk and add
  code to ensure that it is clean.

* resident the bmake binary to speed things up a bit.

20 months agokernel - Attempt to fix i386 wire_count panic
Matthew Dillon [Wed, 22 Aug 2012 05:15:47 +0000 (22:15 -0700)]
kernel - Attempt to fix i386 wire_count panic

* Finally found what could be the issue.  get_pv_entry() calls zalloc()
  which can fall through to zget() which obtains a zalloc-related LWKT
  token.

  This can temporarily break the vm_token and allow another thread to get
  in and change the pmap pte entry out from under a pmap_enter(), causing
  the pmap_enter() to potentially remove an extra wire_count from the
  page table page.

* Fix by pre-allocating the pv entry, taking it out of the critical path,
  and adjusting a few other bits of code to test the *pte closer to
  the code which replaces it for the purposes of adjusting the wire_count.

20 months agojme: Let the software to check hardware supplied hash
Sepherosa Ziehau [Wed, 22 Aug 2012 01:23:09 +0000 (09:23 +0800)]
jme: Let the software to check hardware supplied hash

As far as I have tested, these chips could generate wrong hash under
certain situation.

20 months agoether: Add instrument to detect wrong hardware supplied hash
Sepherosa Ziehau [Wed, 22 Aug 2012 01:19:25 +0000 (09:19 +0800)]
ether: Add instrument to detect wrong hardware supplied hash

If wrong hardware supplied hash is detected, the packet will be
redispatched to the correct netisr

20 months agokernel/linprocfs: Fix accessing files in /proc (such as /proc/meminfo).
Sascha Wildner [Tue, 21 Aug 2012 18:57:19 +0000 (20:57 +0200)]
kernel/linprocfs: Fix accessing files in /proc (such as /proc/meminfo).

It is the same fix that was applied to procfs with 198c0ff2.

20 months agokernel/linprocfs: Fix a panic when accessing /proc/<pid>/maps.
Sascha Wildner [Tue, 21 Aug 2012 20:44:09 +0000 (22:44 +0200)]
kernel/linprocfs: Fix a panic when accessing /proc/<pid>/maps.

Analogous to procfs.

20 months agoixgbe: Rework ixgbe_xmit()
François Tigeot [Tue, 21 Aug 2012 19:42:33 +0000 (21:42 +0200)]
ixgbe: Rework ixgbe_xmit()

* Use bus_dmamap_load_mbuf_segment()

* Clean up error handling code, following the example of the igb(4)
  driver

20 months agokernel/procfs: Remove some unneeded parentheses.
Sascha Wildner [Tue, 21 Aug 2012 15:39:02 +0000 (17:39 +0200)]
kernel/procfs: Remove some unneeded parentheses.

20 months agokernel/linprocfs: Remove an unreached return.
Sascha Wildner [Tue, 21 Aug 2012 13:04:43 +0000 (15:04 +0200)]
kernel/linprocfs: Remove an unreached return.

20 months agotools: Remove old script for installing 3rd party source drivers.
Sascha Wildner [Tue, 21 Aug 2012 00:02:12 +0000 (02:02 +0200)]
tools: Remove old script for installing 3rd party source drivers.

20 months agomdoc: Add a msgport(9) manual page documenting LWKT message passing interface.
Nuno Antunes [Tue, 14 Aug 2012 17:48:10 +0000 (18:48 +0100)]
mdoc: Add a msgport(9) manual page documenting LWKT message passing interface.

20 months agoip: Put fast dispatch/slow dispatch and hashing done by IP under RSS_DEBUG
Sepherosa Ziehau [Tue, 21 Aug 2012 02:45:01 +0000 (10:45 +0800)]
ip: Put fast dispatch/slow dispatch and hashing done by IP under RSS_DEBUG

While im here, using atomic operation to increment debug counters

20 months agortld: Perform reloc before filtree dependency object init
John Marino [Mon, 20 Aug 2012 19:27:06 +0000 (21:27 +0200)]
rtld: Perform reloc before filtree dependency object init

Ensure that for the object which is a dependency of some filtree,
relocations are performed before the object's initializer is called.
While dlopen()ing an object, relocate the whole DAG rooted in the
object instead of only relocating the object itself and list of newly
loaded dependencies.

Reversed sequence currently can occur if the same object is a
dependency for both filtree and filter since filtrees are loaded typically
during the relocation processing when some filter dependencies might be
already loaded but not yet relocated.

Taken-from: FreeBSD SVN 237659 (27 June 2012)

20 months agortld: Delay DF_1_NODELETE process until object DAG loaded
John Marino [Mon, 20 Aug 2012 18:26:43 +0000 (20:26 +0200)]
rtld: Delay DF_1_NODELETE process until object DAG loaded

The current code can miss searching dependencies that haven't been loaded
yet.  Delay DF_1_NODELETE processing until object DAG is fully loaded.

Taken-from: FreeBSD SVN 239253 (14 Aug 2012)

20 months agokernel: Set kern.ipc.shm_use_phys to 1 by default
François Tigeot [Mon, 20 Aug 2012 06:17:29 +0000 (08:17 +0200)]
kernel: Set kern.ipc.shm_use_phys to 1 by default

* The only known user of SYSV shared memory is PostgreSQL

* It really needs physical allocation to perform well with high
  numbers of clients

* Physical allocation is now used by default

20 months agojme: Cache align RX/TX data structure
Sepherosa Ziehau [Sun, 19 Aug 2012 23:53:11 +0000 (07:53 +0800)]
jme: Cache align RX/TX data structure

20 months agojme: Only main serializer is needed for timeout callback
Sepherosa Ziehau [Sun, 19 Aug 2012 23:43:11 +0000 (07:43 +0800)]
jme: Only main serializer is needed for timeout callback

This reduces periodic contention against TX/RX path.

20 months agodhclient - Assume link is up when IFM_AVALID isn't set.
Antonio Huete Jimenez [Wed, 15 Aug 2012 01:19:51 +0000 (03:19 +0200)]
dhclient - Assume link is up when IFM_AVALID isn't set.

- This is what the late interface_link_status() did.
- Allows drivers who cannot tell what the link state is to get
  dhcp leases.

Taken-from: OpenBSD

20 months agodhclient - Have only one timeout at once.
Antonio Huete Jimenez [Wed, 15 Aug 2012 01:15:12 +0000 (03:15 +0200)]
dhclient - Have only one timeout at once.

- Terminate with extreme prejudice the multiple timeout queuing
  mechanism that was a holdover from when dhclient handled multiple
  interfaces at once.

- Also move calculation of current time to just before check to see
  if the timeout has expired.

Taken-from: OpenBSD

20 months agodhclient - Add some more paranoia and make code clearer.
Antonio Huete Jimenez [Tue, 14 Aug 2012 23:06:26 +0000 (01:06 +0200)]
dhclient - Add some more paranoia and make code clearer.

- Check that the required length field for the option
  is present before using it. Reject lease if no length
  field is present.

Taken-from: OpenBSD

20 months agodhclient - Delete trailing NUL's when parsing NVT ASCII options.
Antonio Huete Jimenez [Tue, 14 Aug 2012 22:54:02 +0000 (00:54 +0200)]
dhclient - Delete trailing NUL's when parsing NVT ASCII options.

- RFC 2132 says "Options containing NVT ASCII data SHOULD NOT include
  a trailing NULL; however, the receiver of such options MUST be
  prepared to delete trailing nulls if they exist."
- Should fix odd results when 'append'ing info to such options via
  dhclient.conf.

Taken-from: OpenBSD

20 months agodhclient - Nuke interface_link_status().
Antonio Huete Jimenez [Tue, 14 Aug 2012 22:44:47 +0000 (00:44 +0200)]
dhclient - Nuke interface_link_status().

- Make use of interface_status() (check IFF_UP|IFF_RUNNING
  and media status). The interface is forced up when dhclient
  starts so the flags should be correct.

Taken-from: OpenBSD

20 months agodhclient - Change return code test logic.
Antonio Huete Jimenez [Sat, 4 Aug 2012 19:08:44 +0000 (21:08 +0200)]
dhclient - Change return code test logic.

Taken from: OpenBSD

20 months agodhclient - Set state to S_REBOOTING when calling state_reboot().
Antonio Huete Jimenez [Sat, 4 Aug 2012 19:05:11 +0000 (21:05 +0200)]
dhclient - Set state to S_REBOOTING when calling state_reboot().

- Also set state inside state_reboot() to S_INIT when calling
  state_init(). Rather than the other way around.
  Makes for more consistant idiom and might reduce state confusion.

Taken-from: OpenBSD

20 months agodhclient - Cancel all timeouts in state_reboot().
Antonio Huete Jimenez [Sat, 4 Aug 2012 18:59:03 +0000 (20:59 +0200)]
dhclient - Cancel all timeouts in state_reboot().

- We can get there from any state if a link state change happens.
  Fixes a problem where we'd continue to send (corrupted) discover
  packets after binding.

Taken-from: OpenBSD

20 months agodhclient - Try harder to re-initialize parsing state.
Antonio Huete Jimenez [Sat, 4 Aug 2012 18:55:19 +0000 (20:55 +0200)]
dhclient - Try harder to re-initialize parsing state.

- Attempt that nothing accidentally carries over when
  a new file (i.e. leases after config) is parsed.
  May help with mysterious "Corrupt lease file" messages.

Taken-from: OpenBSD

20 months agodhclient - Tweak parsing.
Antonio Huete Jimenez [Sat, 4 Aug 2012 18:47:39 +0000 (20:47 +0200)]
dhclient - Tweak parsing.

- No need to declare, assign and then ignore the token
  value when only the token id is required.

Taken-from: OpenBSD

20 months agodhclient - Tweak leases file handling.
Antonio Huete Jimenez [Sat, 4 Aug 2012 18:36:23 +0000 (20:36 +0200)]
dhclient - Tweak leases file handling.

- Write out new leases file every time a lease is obtained. i.e. don't
  append 20 leases before cleaning it up.
- Write new leases file after calling dhclient-script to implement
  new info. Gets interface configured first, and makes it more likely
  the leases file reflects most current configuration.

Taken-from: OpenBSD

20 months agodhclient - Sequential options processing more friendly.
Antonio Huete Jimenez [Sat, 4 Aug 2012 18:23:47 +0000 (20:23 +0200)]
dhclient - Sequential options processing more friendly.

- Starting DHCP packet options with DHO_DHCP_MESSAGE_TYPE. Now
  DHCP-specific options always come after the option identifying
  the packet as DHCP rather than BOOTP. Makes at least Nortel NetIP
  DHCP server happier. Clean up some code and parameter passing.

Taken-from: OpenBSD

20 months agodhclient - Only warn on unknown options when appropiate.
Antonio Huete Jimenez [Fri, 3 Aug 2012 23:26:33 +0000 (01:26 +0200)]
dhclient - Only warn on unknown options when appropiate.

- By default we ignore unknown dhcp server options, so don't bother
  warning unless we ask dhclient to reject leases with unknown options.

Taken-from: OpenBSD

20 months agodhclient - Properly handle zero-length option hints.
Antonio Huete Jimenez [Fri, 3 Aug 2012 23:07:20 +0000 (01:07 +0200)]
dhclient - Properly handle zero-length option hints.

- There was a possible division by zero if a server
  sends us a broken option hints for the proper fix.

Taken-from: OpenBSD

20 months agodhclient - Remove wrong processing of option 33 (static routes).
Antonio Huete Jimenez [Fri, 3 Aug 2012 22:55:50 +0000 (00:55 +0200)]
dhclient - Remove wrong processing of option 33 (static routes).

- We are incorrectly processing option 33 (static route), treating
  is as a host route rather than a classful network route. Too much
  trouble to fix such an obsolete feature, so ignore option 33 info.

Taken-from: OpenBSD

20 months agodhclient-script(8) - Align man page with current reality.
Antonio Huete Jimenez [Fri, 3 Aug 2012 22:46:34 +0000 (00:46 +0200)]
dhclient-script(8) - Align man page with current reality.

Taken-from: OpenBSD

20 months agodhclient - Stray '$medium' missed in last commit.
Antonio Huete Jimenez [Fri, 3 Aug 2012 22:31:40 +0000 (00:31 +0200)]
dhclient - Stray '$medium' missed in last commit.

Taken-from: OpenBSD

20 months agodhclient - Drop medium/alias useless utilization.
Antonio Huete Jimenez [Fri, 3 Aug 2012 22:26:45 +0000 (00:26 +0200)]
dhclient - Drop medium/alias useless utilization.

- Dump some useless calls to dhclient-script. i.e. MEDIUM, PREINIT,
  ARPSEND, ARPCHECK. Drop support for 'media', 'medium' and 'alias'
  specifications in dhclient.conf.
- Old leases still parse but these options now have no effect.
- Be more polite and decline all offers we don't accept.
- Fix a IMSG length check.
- Many expressions of support at various bars.

Taken-from: OpenBSD

20 months agodhclient - Fix interval handling.
Antonio Huete Jimenez [Thu, 2 Aug 2012 19:26:34 +0000 (21:26 +0200)]
dhclient - Fix interval handling.

- Start at initial_interval instead of exponentially backed
  off initial_interval.
- Don't hallucinate that we can send ARP packets without waiting.
- Don't claim to be waiting for ARP packets when not doing so.
- Correctly detect expiry of selecting period.
- Speeds up negotiations.

Taken-from: OpenBSD

20 months agodhclient.conf(5) - New sentence, new line.
Antonio Huete Jimenez [Thu, 2 Aug 2012 19:17:32 +0000 (21:17 +0200)]
dhclient.conf(5) - New sentence, new line.

Taken-from: OpenBSD

20 months agodhclient.conf(5) - Few fixes. Reword a sentence.
Antonio Huete Jimenez [Thu, 2 Aug 2012 19:15:43 +0000 (21:15 +0200)]
dhclient.conf(5) - Few fixes. Reword a sentence.

Taken-from: OpenBSD

20 months agodhclient - Make sure an interface is registered before we start using it.
Antonio Huete Jimenez [Thu, 2 Aug 2012 18:15:28 +0000 (20:15 +0200)]
dhclient - Make sure an interface is registered before we start using it.

Taken-from: OpenBSD

20 months agodhclient - Add and ignore DHCP option 66/0x42 TFTP server name.
Antonio Huete Jimenez [Thu, 2 Aug 2012 18:13:02 +0000 (20:13 +0200)]
dhclient - Add and ignore DHCP option 66/0x42 TFTP server name.

Taken-from: OpenBSD

20 months agodhclient(8) - Remove NOTES section.
Antonio Huete Jimenez [Thu, 2 Aug 2012 17:55:19 +0000 (19:55 +0200)]
dhclient(8) - Remove NOTES section.

Taken from: OpenBSD

20 months agodhclient - Add 'egress' command-line option.
Antonio Huete Jimenez [Thu, 2 Aug 2012 17:39:08 +0000 (19:39 +0200)]
dhclient - Add 'egress' command-line option.

- It can be used to refetch a lease without remembering
which interface dhclient was actually active on.

Taken-from: OpenBSD

20 months agodhclient - Remove unused function.
Antonio Huete Jimenez [Thu, 2 Aug 2012 09:50:39 +0000 (11:50 +0200)]
dhclient - Remove unused function.

Taken-from: OpenBSD

20 months agodhclient - Use strdup() instead of malloc/strlcpy.
Antonio Huete Jimenez [Thu, 2 Aug 2012 09:46:36 +0000 (11:46 +0200)]
dhclient - Use strdup() instead of malloc/strlcpy.

Taken-from: OpenBSD

20 months agodhclient - Be more strict in check_option().
Antonio Huete Jimenez [Wed, 1 Aug 2012 19:43:24 +0000 (21:43 +0200)]
dhclient - Be more strict in check_option().

ISC dhclient had a buffer overflow: http://www.kb.cert.org/vuls/id/410676 and
while our dhclient is not vulnerable to that, it got us looking at how the
subnet mask option is handled.
This limits specific ip address options to length 4 in conformance with RFC 2132.

Taken-from: OpenBSD

20 months agodhclient - Silence dhclient by immediately exiting if the interface doesn't exist.
Antonio Huete Jimenez [Wed, 1 Aug 2012 19:25:29 +0000 (21:25 +0200)]
dhclient - Silence dhclient by immediately exiting if the interface doesn't exist.

Taken-from: OpenBSD

20 months agodhclient - Make room for trailing \0 on prepend/append for dhcp options.
Antonio Huete Jimenez [Wed, 1 Aug 2012 19:12:15 +0000 (21:12 +0200)]
dhclient - Make room for trailing \0 on prepend/append for dhcp options.

Taken-from: OpenBSD