]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
11 years agoPatch #9 Performance - improve the tx dma failure
jfv [Fri, 30 Nov 2012 23:54:57 +0000 (23:54 +0000)]
Patch #9 Performance - improve the tx dma failure
path, similar to a change done in igb long ago.

11 years agolibc: Allow setting close-on-exec in fopen/freopen/fdopen.
jilles [Fri, 30 Nov 2012 23:51:33 +0000 (23:51 +0000)]
libc: Allow setting close-on-exec in fopen/freopen/fdopen.

This commit adds a new mode option 'e' that must follow any 'b', '+' and/or
'x' options. C11 is clear about the 'x' needing to follow 'b' and/or '+' and
that is what we implement; therefore, require a strict position for 'e' as
well.

For freopen() with a non-NULL path argument and fopen(), the close-on-exec
flag is set iff the 'e' mode option is specified. For freopen() with a NULL
path argument and fdopen(), the close-on-exec flag is turned on if the 'e'
mode option is specified and remains unchanged otherwise.

Although the same behaviour for fopen() can be obtained by open(O_CLOEXEC)
and fdopen(), this needlessly complicates the calling code.

Apart from the ordering requirement, the new option matches glibc.

PR: kern/169320

11 years agoPatch #8 Performance changes - this one improves locality,
jfv [Fri, 30 Nov 2012 23:45:55 +0000 (23:45 +0000)]
Patch #8 Performance changes - this one improves locality,
moving some counters and data to the ring struct from
the adapter struct, also compressing some data in the
move.

11 years agoPatch #7 This is primarily about processing limit control.
jfv [Fri, 30 Nov 2012 23:28:01 +0000 (23:28 +0000)]
Patch #7 This is primarily about processing limit control.
- add a limit for both RX and TX, change the default to 256
- change the sysctl usage to be common, and now to be called
during init for each ring.
- the TX limit is not yet used, but the changes in the last
patch in this series uses the value.
- the motivation behind these changes is to improve data
locality in the final code.
- rxeof interface changes since it now gets limit from the
ring struct

11 years agoIFp4 @208452:
pjd [Fri, 30 Nov 2012 23:21:55 +0000 (23:21 +0000)]
IFp4 @208452:

Audit handling for missing events:
- AUE_READLINKAT
- AUE_FACCESSAT
- AUE_MKDIRAT
- AUE_MKFIFOAT
- AUE_MKNODAT
- AUE_SYMLINKAT

Sponsored by: FreeBSD Foundation (auditdistd)
MFC after: 2 weeks

11 years agoIFp4 @208451:
pjd [Fri, 30 Nov 2012 23:18:49 +0000 (23:18 +0000)]
IFp4 @208451:

Fix path handling for *at() syscalls.

Before the change directory descriptor was totally ignored,
so the relative path argument was appended to current working
directory path and not to the path provided by descriptor, thus
wrong paths were stored in audit logs.

Now that we use directory descriptor in vfs_lookup, move
AUDIT_ARG_UPATH1() and AUDIT_ARG_UPATH2() calls to the place where
we hold file descriptors table lock, so we are sure paths will
be resolved according to the same directory in audit record and
in actual operation.

Sponsored by: FreeBSD Foundation (auditdistd)
Reviewed by: rwatson
MFC after: 2 weeks

11 years agoPatch #6 Whitespace cleanup, and removal of some very old
jfv [Fri, 30 Nov 2012 23:13:56 +0000 (23:13 +0000)]
Patch #6 Whitespace cleanup, and removal of some very old
defines (at Gleb's request). Also, change the defines around
the old transmit code to IXGBE_LEGACY_TX, I do this to make
it possible to define this regardless of the OS level (it is
not defined by default). There are also a couple changed
comments for clarity.

11 years agoPatch #5 Cleanup unused IEEE1588 code fragments, the day may
jfv [Fri, 30 Nov 2012 23:06:27 +0000 (23:06 +0000)]
Patch #5 Cleanup unused IEEE1588 code fragments, the day may
come when this feature gets implemented, but its not here yet
and I see no reason to leave this laying around.

11 years agoIFp4 @208383:
pjd [Fri, 30 Nov 2012 23:03:51 +0000 (23:03 +0000)]
IFp4 @208383:

Currently when we discover that trail file is greater than configured
limit we send AUDIT_TRIGGER_ROTATE_KERNEL trigger to the auditd daemon
once. If for some reason auditd didn't rotate trail file it will never
be rotated.

Change it by sending the trigger when trail file size grows by the
configured limit. For example if the limit is 1MB, we will send trigger
on 1MB, 2MB, 3MB, etc.

This is also needed for the auditd change that will be committed soon
where auditd may ignore the trigger - it might be ignored if kernel
requests the trail file to be rotated too quickly (often than once a second)
which would result in overwriting previous trail file.

Sponsored by: FreeBSD Foundation (auditdistd)
MFC after: 2 weeks

11 years agoIFp4 @208382:
pjd [Fri, 30 Nov 2012 22:59:20 +0000 (22:59 +0000)]
IFp4 @208382:

Currently on each record write we call VFS_STATFS() to get available space
on the file system as well as VOP_GETATTR() to get trail file size.

We can assume that trail file is only updated by the audit worker, so instead
of asking for file size on every write, get file size on trail switch only
(it should be zero, but it's not expensive) and use global variable audit_size
protected by the audit worker lock to keep track of trail file's size.

This eliminates VOP_GETATTR() call for every write. VFS_STATFS() is satisfied
from in-memory data (mount->mnt_stat), so shouldn't be expensive.

Sponsored by: FreeBSD Foundation (auditdistd)
MFC after: 2 weeks

11 years agoPatch #4 - this does two things, it removes a number of statistics,
jfv [Fri, 30 Nov 2012 22:54:14 +0000 (22:54 +0000)]
Patch #4 - this does two things, it removes a number of statistics,
these are FCOE stats (fiber channel over ethernet), something that
FreeBSD does not yet have, they were mistaken for flow control by
the implementor I believe. Secondly, the real flow control stats
are oddly named with a 'link' tag on the front, it was requested
by my validation engineer to make these stats have the same name as
the igb driver for clarity and that seemed reasonable to me.

11 years agoIFp4 @208381:
pjd [Fri, 30 Nov 2012 22:52:35 +0000 (22:52 +0000)]
IFp4 @208381:

For VOP_GETATTR() we just need vnode to be shared-locked.

Sponsored by: FreeBSD Foundation (auditdistd)
MFC after: 2 weeks

11 years agoIFp4 @208450:
pjd [Fri, 30 Nov 2012 22:49:28 +0000 (22:49 +0000)]
IFp4 @208450:

Remove redundant call to AUDIT_ARG_UPATH1().
Path will be remembered by the following NDINIT(AUDITVNODE1) call.

Sponsored by: FreeBSD Foundation (auditdistd)
MFC after: 2 weeks

11 years agoPatch #3 - Add a new ioctl to access SFP+ module diagnostic
jfv [Fri, 30 Nov 2012 22:41:32 +0000 (22:41 +0000)]
Patch #3 - Add a new ioctl to access SFP+ module diagnostic
           data via the I2C routines in shared code.

11 years agoPatch #2 - remove OACTIVE and DEPLETED notions from the
jfv [Fri, 30 Nov 2012 22:33:21 +0000 (22:33 +0000)]
Patch #2 - remove OACTIVE and DEPLETED notions from the
multiqueue code, this functionality has proven to be more
trouble than it was worth. Thanks to Gleb for a second
critical look over my code and help in the patches!

11 years agoAllow OpenSSL to use arc4random(3) on FreeBSD. arc4random(3) was modified
pjd [Fri, 30 Nov 2012 22:23:23 +0000 (22:23 +0000)]
Allow OpenSSL to use arc4random(3) on FreeBSD. arc4random(3) was modified
some time ago to use sysctl instead of /dev/random to get random data,
so is now much better choice, especially for sandboxed processes that have
no direct access to /dev/random.

Approved by: benl
MFC after: 2 weeks

11 years agoFirst of a series of 11 patches leading to new ixgbe version 2.5.0
jfv [Fri, 30 Nov 2012 22:19:18 +0000 (22:19 +0000)]
First of a series of 11 patches leading to new ixgbe version 2.5.0
This removes the header split and supporting code from the driver.

11 years agoThe build-tools step during build32 also needs the -legacy magic.
sjg [Fri, 30 Nov 2012 20:50:34 +0000 (20:50 +0000)]
The build-tools step during build32 also needs the -legacy magic.

Approved by: marcel (mentor)

11 years agoUse volatile keywords properly.
jkim [Fri, 30 Nov 2012 20:15:01 +0000 (20:15 +0000)]
Use volatile keywords properly.

11 years agoUse common macros for working with rule/dynamic counters.
melifaro [Fri, 30 Nov 2012 19:36:55 +0000 (19:36 +0000)]
Use common macros for working with rule/dynamic counters.
This is done as preparation to introduce per-cpu ipfw counters.

MFC after: 3 weeks

11 years agoMake ipfw dynamic states operations SMP-ready.
melifaro [Fri, 30 Nov 2012 16:33:22 +0000 (16:33 +0000)]
Make ipfw dynamic states operations SMP-ready.

* Global IPFW_DYN_LOCK() is changed to per-bucket mutex.
* State expiration is done in ipfw_tick every second.
* No expiration is done on forwarding path.
* hash table resize is done automatically and does not flush all states.
* Dynamic UMA zone is now allocated per each VNET
* State limiting is now done via UMA(9) api.

Discussed with: ipfw
MFC after: 3 weeks
Sponsored by: Yandex LLC

11 years ago- Enable syscons/framebuffer by default
gonzo [Fri, 30 Nov 2012 04:56:39 +0000 (04:56 +0000)]
- Enable syscons/framebuffer by default
- Enable NFS client by default. Might be useful for building ports

11 years agoTeach userboot to boot from ISO image files.
neel [Fri, 30 Nov 2012 04:44:32 +0000 (04:44 +0000)]
Teach userboot to boot from ISO image files.

Reviewed by: ae@, dfr@
Obtained from: NetApp

11 years agoAdd vchiq node
gonzo [Fri, 30 Nov 2012 03:16:45 +0000 (03:16 +0000)]
Add vchiq node

11 years ago- Implement "fdt mres" sub-command that prints reserved memory regions
gonzo [Fri, 30 Nov 2012 03:15:50 +0000 (03:15 +0000)]
- Implement "fdt mres" sub-command that prints reserved memory regions
- Add "fdt addr" subcommand that lets you specify preloaded blob address
- Do not pre-initialize blob for "fdt addr"
- Do not try to load dtb every time fdt subcommand is issued,
    do it only once
- Change the way DTB is passed to kernel. With introduction of "fdt addr"
    actual blob address can be not virtual but physical or reside in
    area higher then 64Mb. ubldr should create copy of it in kernel area
    and pass pointer to this newly allocated buffer which is guaranteed to work
    in kernel after switching on MMU.
- Convert memreserv FDT info to "memreserv" property of root node
    FDT uses /memreserve/ data to notify OS about reserved memory areas.
    Technically it's not real property, it's just data blob, sequence
    of <start, size> pairs where both start and size are 64-bit integers.
    It doesn't fit nicely with OF API we use in kernel, so in order to unify
    thing ubldr converts this data to "memreserve" property using the same
    format for addresses and sizes as /memory node.

11 years agoInclude opt_wlan.h so the net80211 RX debug API compiles correctly.
adrian [Fri, 30 Nov 2012 03:14:11 +0000 (03:14 +0000)]
Include opt_wlan.h so the net80211 RX debug API compiles correctly.

11 years agoGet reserved memory regions and exclude them from available memory map
gonzo [Fri, 30 Nov 2012 03:11:03 +0000 (03:11 +0000)]
Get reserved memory regions and exclude them from available memory map

11 years agoAdd fdt_get_reserved_regions function. API is simmilar to fdt_get_mem_regions
gonzo [Fri, 30 Nov 2012 03:08:49 +0000 (03:08 +0000)]
Add fdt_get_reserved_regions function. API is simmilar to fdt_get_mem_regions
It returns memory regions restricted from being used by kernel. These
regions are dfined in "memreserve" property of root node in the same
format as "reg" property of /memory node

11 years ago- Get proper maximum clock frequency for SDHCI v3.0 and higher
gonzo [Fri, 30 Nov 2012 02:35:13 +0000 (02:35 +0000)]
- Get proper maximum clock frequency for SDHCI v3.0 and higher

11 years agoGet frequency from "clock-frequency" property of "/axi/sdhci" FDT node
gonzo [Fri, 30 Nov 2012 02:32:37 +0000 (02:32 +0000)]
Get frequency from "clock-frequency" property of "/axi/sdhci" FDT node

11 years agoFix RGB565 case
gonzo [Fri, 30 Nov 2012 02:31:08 +0000 (02:31 +0000)]
Fix RGB565 case

11 years agoAdd preliminary support for BCM57766 ASIC.
yongari [Fri, 30 Nov 2012 01:38:00 +0000 (01:38 +0000)]
Add preliminary support for BCM57766 ASIC.
While I'm here add BCM57762 device id which is found on Apple
Thunderbolt ethernet.

Tested by: Richard Kuhns < rjk <> wintek dot com >

11 years agoTidy up inline assembly. No functional change.
jkim [Fri, 30 Nov 2012 00:59:37 +0000 (00:59 +0000)]
Tidy up inline assembly.  No functional change.

11 years agocxgbe/tom: Handle the case where the chip falls out of DDP mode by
np [Thu, 29 Nov 2012 19:39:27 +0000 (19:39 +0000)]
cxgbe/tom: Handle the case where the chip falls out of DDP mode by
itself.  The hole in the receive sequence space corresponds to the
number of bytes placed directly up to that point.

MFC after: 1 week

11 years agocxgbe/tom: Add a flag to indicate that the L2 table entry for an
np [Thu, 29 Nov 2012 19:10:04 +0000 (19:10 +0000)]
cxgbe/tom: Add a flag to indicate that the L2 table entry for an
embryonic connection has been setup and never attempt to abort a tid
before this is done.  This fixes a bad race where a listening socket is
closed when the driver is in the middle of step (b) here.  The symptom
of this were "ARP miss" errors from the driver followed by tid leaks.

A hardware-offloaded passive open works this way:

a) A SYN "hits" the TCAM entry for a server tid and the chip delivers it
to the queue associated with the server tid (say, queue A).  It waits
for a response from the driver telling it what to do.

b) The driver decides it is ok to proceed.  It adds the new tid to the
list of embryonic connections associated with the server tid and then
hands off the SYN to the kernel's syncache to make sure that the kernel
okays it too.  If it does then the driver provides an L2 table entry,
queue id (say, queue B), etc. and instructs the chip to send the SYN/ACK
response.

c) The chip delivers a status to queue B depending on how the third step
of the 3-way handshake goes.  The driver removes the tid from its list
of embryonic connections and either expands the syncache entry or
destroys the tid.  In any case all subsequent messages for the new tid
will be delivered to queue B, not queue A.  Anything running in queue B
knows that the L2 entry has long been setup and the new flag is of no
interest from here on.  If the listener is closed it will deal with
so_comp as normal.

MFC after: 1 week

11 years agoMerge new libc++ into head.
theraven [Thu, 29 Nov 2012 13:35:44 +0000 (13:35 +0000)]
Merge new libc++ into head.

11 years agoGeneralize make.conf man page: use "cc" instead of "gcc"
eadler [Thu, 29 Nov 2012 12:51:10 +0000 (12:51 +0000)]
Generalize make.conf man page: use "cc" instead of "gcc"

PR: misc/173604
Submitted by: Dan McGregor <dan.mcgregor@usask.ca>
Approved by: bcr (mentor)
MFC after: 3 days

11 years ago- Use more appropriate loop (do { } while()) when generating ethernet address
pjd [Thu, 29 Nov 2012 08:06:23 +0000 (08:06 +0000)]
- Use more appropriate loop (do { } while()) when generating ethernet address
  for bridge interface.
- If we found a collision we can break the loop - only one collision is
  possible and one is exactly enough to need to renegerate.

Obtained from: WHEEL Systems
MFC after: 1 week

11 years agoUsing a long is the wrong type to represent the realmem and maxmbufmem
andre [Thu, 29 Nov 2012 07:30:42 +0000 (07:30 +0000)]
Using a long is the wrong type to represent the realmem and maxmbufmem
variable as they may overflow on i386/PAE and i386 with > 2GB RAM.

Use 64bit quad_t instead.  It has broader kernel infrastructure support
with TUNABLE_QUAD_FETCH() and qmin/qmax() than other available types.

Pointed out by: alc, bde

11 years agoFix hardcoded bpp value
gonzo [Thu, 29 Nov 2012 05:46:46 +0000 (05:46 +0000)]
Fix hardcoded bpp value

11 years agoMark non-returning function as such
eadler [Thu, 29 Nov 2012 05:16:50 +0000 (05:16 +0000)]
Mark non-returning function as such

PR: bin/172978
Approved by: cperciva
MFC after: 3 days

11 years agoFix LINT build for arm: NOTES defines LDFLAGS by way of a make option
marcel [Thu, 29 Nov 2012 03:48:39 +0000 (03:48 +0000)]
Fix LINT build for arm: NOTES defines LDFLAGS by way of a make option
but LDFLAGS is not (yet) passed on to the linker (via SYSTEM_LD et al).
Do so now. As such, any kernel configuration can now define linker
flags by setting LDFLAGS as normal and not have to revert to hacks
like setting DEBUG for flags that do not relate to debugging (see
sys/powerpc/conf/MPC85XX).

11 years agoAdd support for AT&T Sierra Wireless USB 3G adapter
eadler [Thu, 29 Nov 2012 00:32:03 +0000 (00:32 +0000)]
Add support for AT&T Sierra Wireless USB 3G adapter

PR: kern/173982
Submitted by: Eric Camachat <eric@camachat.org>
Approved by: cperciva (implicit)
MFC after: 1 week

11 years ago- Update organization.dot to reflect that attilio resigned from core
pgj [Wed, 28 Nov 2012 22:04:18 +0000 (22:04 +0000)]
- Update organization.dot to reflect that attilio resigned from core

Approved by: core (implicit)

11 years agoRegenerate usb.conf
hselasky [Wed, 28 Nov 2012 18:37:20 +0000 (18:37 +0000)]
Regenerate usb.conf

MFC after: 1 week

11 years agoDiscussed at-length on -arch.
dteske [Wed, 28 Nov 2012 18:35:46 +0000 (18:35 +0000)]
Discussed at-length on -arch.

Make the following interface changes to my beastie boot menu:
+ Move boot options to a submenu
+ Add a new "Boot Single" menu item
+ Make "Boot" item and new "Boot Single" item reverse when boot_single is set
+ Add new "Load Defaults" item (in new "Boot Options" submenu) for overridding
  loader.conf(5) provided values with system defaults.

Reviewed by: adrian (co-mentor)
Approved by: adrian (co-mentor)

11 years agoAdd support for the (relatively) new object type OBJT_MGTDEVICE to
alc [Wed, 28 Nov 2012 18:29:34 +0000 (18:29 +0000)]
Add support for the (relatively) new object type OBJT_MGTDEVICE to
vm_object_set_memattr().  Also, add a "safety belt" so that
vm_object_set_memattr() doesn't silently modify undefined object types.

Reviewed by: kib
MFC after: 10 days

11 years agoUpdate some definitions or make them match NetBSD's headers.
pfg [Wed, 28 Nov 2012 15:48:32 +0000 (15:48 +0000)]
Update some definitions or make them match NetBSD's headers.

Bring several definitions required for newer ext4 features.

Rename EXT2F_COMPAT_HTREE to EXT2F_COMPAT_DIRHASHINDEX since it
is not being used yet and the new name is more compatible with
NetBSD and Linux.

This change is purely cosmetic and has no effect on the real
code.

Obtained from: NetBSD
MFC after: 3 days

11 years agocyrus-sasl 2.1.26 was released. In this version, the type of callback
ume [Wed, 28 Nov 2012 11:47:47 +0000 (11:47 +0000)]
cyrus-sasl 2.1.26 was released.  In this version, the type of callback
functions was changed from "unsigned long" to "size_t".

Reviewed by: gshapiro
MFC after: 3 days

11 years agoCall if_free() with the correct vnet context if and only if ifp_vnet
adrian [Wed, 28 Nov 2012 07:12:08 +0000 (07:12 +0000)]
Call if_free() with the correct vnet context if and only if ifp_vnet
isn't NULL.

If the attach fails prematurely and there's no if_vnet context, calling
CURVNET_SET(ifp->if_vnet) is going to dereference a NULL pointer.

11 years agoUntil I figure out what to do here, remind myself that this needs some
adrian [Wed, 28 Nov 2012 06:55:34 +0000 (06:55 +0000)]
Until I figure out what to do here, remind myself that this needs some
rate control 'adjustment' when NOACK is set.

11 years agoDon't allow minthreads > maxthreads.
alfred [Wed, 28 Nov 2012 02:47:31 +0000 (02:47 +0000)]
Don't allow minthreads > maxthreads.

Suggested by: rmacklem

11 years agoFix typo.
alfred [Wed, 28 Nov 2012 02:23:59 +0000 (02:23 +0000)]
Fix typo.

Pointed out by: marck

11 years agoPull out the debugging code from the critical path and make sure it
adrian [Wed, 28 Nov 2012 01:55:22 +0000 (01:55 +0000)]
Pull out the debugging code from the critical path and make sure it
happens _after_ all of the time delta calculations.

11 years agoPartially bring r242520 to ext2fs.
pfg [Wed, 28 Nov 2012 00:36:40 +0000 (00:36 +0000)]
Partially bring r242520 to ext2fs.

When a file is first being written, the dynamic block reallocation
(implemented by ext2_reallocblks) relocates the file's blocks
so as to cluster them together into a contiguous set of blocks on
the disk.

When the cluster crosses the boundary into the first indirect block,
the first indirect block is initially allocated in a position
immediately following the last direct block.  Block reallocation
would usually destroy locality by moving the indirect block out of
the way to keep the data blocks contiguous.

The issue was diagnosed long ago by Bruce Evans on ffs and surfaced
on ext2fs when block reallocaton was ported. This is only a partial
solution based on the similarities with FFS. We still require more
review of the allocation details that vary in ext2fs.

Reported by: bde
MFC after: 1 week

11 years agoComplete r243631 by applying the remainder of kern_mbuf.c that got
andre [Tue, 27 Nov 2012 23:16:56 +0000 (23:16 +0000)]
Complete r243631 by applying the remainder of kern_mbuf.c that got
lost while merging into the commit tree.

MFC after: 1 month
X-MFC-with: r243631

11 years agoFix r243627 by testing against the head socket instead of the socket
andre [Tue, 27 Nov 2012 22:35:48 +0000 (22:35 +0000)]
Fix r243627 by testing against the head socket instead of the socket
just created.

MFC after: 1 week
X-MFC-with: r243627

11 years agoAutoconfigure nfsd threads based on ncpu.
alfred [Tue, 27 Nov 2012 22:34:46 +0000 (22:34 +0000)]
Autoconfigure nfsd threads based on ncpu.

Rick Macklem and I discussed the default number of nfsd threads and
concluded that it is too low to perform adiquitely on today's hardware.

We decided to auto tune the number of nfsds based on the number of cpus
in the system.

While I'm here I've also added:

1) ability to set the minthreads/maxthreads from userland.
2) ability to run nfsd in debug mode via the cli.

Reviewed by: rmacklem
MFC after: 2 weeks

11 years agoAllow setting of NULL titles with f_dialog_[back]title().
dteske [Tue, 27 Nov 2012 22:14:22 +0000 (22:14 +0000)]
Allow setting of NULL titles with f_dialog_[back]title().

Approved by: adrian (co-mentor) (implicit)

11 years agoChange self-initialization to occur when loaded versus the previous behavior
dteske [Tue, 27 Nov 2012 22:11:53 +0000 (22:11 +0000)]
Change self-initialization to occur when loaded versus the previous behavior
which was to self-initialize during the first function-call. This didn't work
so well because the first call was may or may-not be within a sub-shell
(which prevented proper setup of the pass-thru file descriptor, resulting in
dialogs that would not display).

Approved by: adrian (co-mentor) (implicit)

11 years agoComments.
dteske [Tue, 27 Nov 2012 22:05:01 +0000 (22:05 +0000)]
Comments.

Approved by: adrian (co-mentor) (implicit)

11 years agoBase the mbuf related limits on the available physical memory or
andre [Tue, 27 Nov 2012 21:19:58 +0000 (21:19 +0000)]
Base the mbuf related limits on the available physical memory or
kernel memory, whichever is lower.  The overall mbuf related memory
limit must be set so that mbufs (and clusters of various sizes)
can't exhaust physical RAM or KVM.

The limit is set to half of the physical RAM or KVM (whichever is
lower) as the baseline.  In any normal scenario we want to leave
at least half of the physmem/kvm for other kernel functions and
userspace to prevent it from swapping too easily.  Via a tunable
kern.maxmbufmem the limit can be upped to at most 3/4 of physmem/kvm.

At the same time divorce maxfiles from maxusers and set maxfiles to
physpages / 8 with a floor based on maxusers.  This way busy servers
can make use of the significantly increased mbuf limits with a much
larger number of open sockets.

Tidy up ordering in init_param2() and check up on some users of
those values calculated here.

Out of the overall mbuf memory limit 2K clusters and 4K (page size)
clusters to get 1/4 each because these are the most heavily used mbuf
sizes.  2K clusters are used for MTU 1500 ethernet inbound packets.
4K clusters are used whenever possible for sends on sockets and thus
outbound packets.  The larger cluster sizes of 9K and 16K are limited
to 1/6 of the overall mbuf memory limit.  When jumbo MTU's are used
these large clusters will end up only on the inbound path.  They are
not used on outbound, there it's still 4K.  Yes, that will stay that
way because otherwise we run into lots of complications in the
stack.  And it really isn't a problem, so don't make a scene.

Normal mbufs (256B) weren't limited at all previously.  This was
problematic as there are certain places in the kernel that on
allocation failure of clusters try to piece together their packet
from smaller mbufs.

The mbuf limit is the number of all other mbuf sizes together plus
some more to allow for standalone mbufs (ACK for example) and to
send off a copy of a cluster.  Unfortunately there isn't a way to
set an overall limit for all mbuf memory together as UMA doesn't
support such a limiting.

NB: Every cluster also has an mbuf associated with it.

Two examples on the revised mbuf sizing limits:

1GB KVM:
 512MB limit for mbufs
 419,430 mbufs
  65,536 2K mbuf clusters
  32,768 4K mbuf clusters
   9,709 9K mbuf clusters
   5,461 16K mbuf clusters

16GB RAM:
 8GB limit for mbufs
 33,554,432 mbufs
  1,048,576 2K mbuf clusters
    524,288 4K mbuf clusters
    155,344 9K mbuf clusters
     87,381 16K mbuf clusters

These defaults should be sufficient for even the most demanding
network loads.

MFC after: 1 month

11 years agoUpdate comment to prefer M_NOWAIT over M_DONTWAIT and
andre [Tue, 27 Nov 2012 20:16:01 +0000 (20:16 +0000)]
Update comment to prefer M_NOWAIT over M_DONTWAIT and
M_WAITOK over M_WAIT.

MFC after: 1 week

11 years agoFix a race on listen socket teardown where while draining the
andre [Tue, 27 Nov 2012 20:04:52 +0000 (20:04 +0000)]
Fix a race on listen socket teardown where while draining the
accept queues a new socket/connection may be added to the queue
due to a race on the ACCEPT_LOCK.

The submitted patch is slightly changed in comments, teardown
and locking order and extended with KASSERT's.

Submitted by: Vijay Singh <vijju.singh-at-gmail-dot-com>
Found by: His team.
MFC after: 1 week

11 years agoRemove unused and unnecessary CSUM_IP_FRAGS checksumming capability.
andre [Tue, 27 Nov 2012 19:31:49 +0000 (19:31 +0000)]
Remove unused and unnecessary CSUM_IP_FRAGS checksumming capability.
Checksumming the IP header of fragments is no different from doing
normal IP headers.

Discussed with: yongari
MFC after: 1 week

11 years agofix a panic resulting from a stray '&'
bschmidt [Tue, 27 Nov 2012 19:09:36 +0000 (19:09 +0000)]
fix a panic resulting from a stray '&'

MFC after: 1 week

11 years agoAdd DELACK to list of timers.
andre [Tue, 27 Nov 2012 19:07:28 +0000 (19:07 +0000)]
Add DELACK to list of timers.

MFC after: 1 week

11 years agoRespect NO_FSCHG and don't set 'schg' flag on passwd/yppasswd is defined.
pjd [Tue, 27 Nov 2012 16:23:12 +0000 (16:23 +0000)]
Respect NO_FSCHG and don't set 'schg' flag on passwd/yppasswd is defined.

MFC after: 2 weeks

11 years agoPass allocated unit number to make_dev, otherwise kernel panics later while
davidxu [Tue, 27 Nov 2012 12:23:57 +0000 (12:23 +0000)]
Pass allocated unit number to make_dev, otherwise kernel panics later while
cloning second tap.

Reviewed by: kevlo,ed

11 years ago* Fix another culprit of my "committed from the wrong directory" nonsense;
adrian [Tue, 27 Nov 2012 11:30:39 +0000 (11:30 +0000)]
* Fix another culprit of my "committed from the wrong directory" nonsense;
  now this works for non-debug and debug builds.

* Add a comment reminding me (or someone) to audit all of the relevant
  math to ensure there's no weird wrapping issues still lurking about.

But yes, this does seem to be mostly working.

Pointy-hat-to: adrian, yet again

11 years agoAdd kern.capmode_coredump sysctl/tunable to allow processes in capability mode
pjd [Tue, 27 Nov 2012 10:38:11 +0000 (10:38 +0000)]
Add kern.capmode_coredump sysctl/tunable to allow processes in capability mode
to dump core.

Reviewed by: rwatson
Obtained from: WHEEL Systems
MFC after: 2 weeks

11 years ago- Add NOCAPCHECK flag to namei that allows lookup to work even if the process
pjd [Tue, 27 Nov 2012 10:32:35 +0000 (10:32 +0000)]
- Add NOCAPCHECK flag to namei that allows lookup to work even if the process
  is in capability mode.
- Add VN_OPEN_NOCAPCHECK flag for vn_open_cred() to will ne converted into
  NOCAPCHECK namei flag.

This functionality will be used to enable core dumps for sandboxed processes.

Reviewed by: rwatson
Obtained from: WHEEL Systems
MFC after: 2 weeks

11 years agoRegenerate after r243610.
pjd [Tue, 27 Nov 2012 10:25:03 +0000 (10:25 +0000)]
Regenerate after r243610.

11 years agoAllow to use kill(2) in capability mode, but process can send a signal only
pjd [Tue, 27 Nov 2012 10:22:40 +0000 (10:22 +0000)]
Allow to use kill(2) in capability mode, but process can send a signal only
to himself. For example abort(3) at first tries to do kill(getpid(), SIGABRT)
which was failing in capability mode, so the code was failing back to exit(1).

Reviewed by: rwatson
Obtained from: WHEEL Systems
MFC after: 2 weeks

11 years agoAllow to modify kern.sugid_coredump and kern.corefile from loader.conf.
pjd [Tue, 27 Nov 2012 10:16:48 +0000 (10:16 +0000)]
Allow to modify kern.sugid_coredump and kern.corefile from loader.conf.

Obtained from: WHEEL Systems

11 years agoMore style fixes.
pjd [Tue, 27 Nov 2012 10:15:58 +0000 (10:15 +0000)]
More style fixes.

11 years agoStyle fixes (mostly whitespaces).
pjd [Tue, 27 Nov 2012 10:11:54 +0000 (10:11 +0000)]
Style fixes (mostly whitespaces).

11 years agoCorrect some debugging output.
adrian [Tue, 27 Nov 2012 08:40:48 +0000 (08:40 +0000)]
Correct some debugging output.

11 years agoMake sure that tcp_timer_activate() correctly sees TCP_OFFLOAD (or not).
np [Tue, 27 Nov 2012 06:42:44 +0000 (06:42 +0000)]
Make sure that tcp_timer_activate() correctly sees TCP_OFFLOAD (or not).

11 years agoDo not enable data cache until later in kernel init. Stale bits in
gonzo [Tue, 27 Nov 2012 06:39:32 +0000 (06:39 +0000)]
Do not enable data cache until later in kernel init. Stale bits in
cache might cause erroneus behavior on early stage.

Submitted by: Ian Lepore
Tested on: Atmel, Marvell, and Eyxnos

11 years ago Better safe than sorry: reinitialize eh after ng_ether(4) and
glebius [Tue, 27 Nov 2012 06:35:26 +0000 (06:35 +0000)]
  Better safe than sorry: reinitialize eh after ng_ether(4) and
if_bridge(4) processing, since mbuf may be modified there.

Submitted by: youngari

11 years agoTake first active vnode correctly.
davidxu [Tue, 27 Nov 2012 06:07:58 +0000 (06:07 +0000)]
Take first active vnode correctly.

Reviewed by: kib
MFC after: 3 days

11 years agoFix build
adrian [Tue, 27 Nov 2012 05:52:08 +0000 (05:52 +0000)]
Fix build

11 years agoAuto size the tcbhashsize structure based on max sockets.
alfred [Tue, 27 Nov 2012 03:04:24 +0000 (03:04 +0000)]
Auto size the tcbhashsize structure based on max sockets.

While here, also make the code that enforces power-of-two more
forgiving, instead of just resetting to 512, graciously round-down
to the next lower power of two.

11 years agoAdd in a totally hacked up copy of the AR5416 descriptor decoding stuff,
adrian [Tue, 27 Nov 2012 02:28:42 +0000 (02:28 +0000)]
Add in a totally hacked up copy of the AR5416 descriptor decoding stuff,
as well as TDMA related things.

I used this to debug TDMA related issues in -HEAD.

11 years agoImprove the TDMA debugging:
adrian [Tue, 27 Nov 2012 02:27:30 +0000 (02:27 +0000)]
Improve the TDMA debugging:

* add some further debugging prints, which are quite nice to have
* add in ALQ hooks (optional!) to allow for the TDMA information to be
  logged in-line with the TX and RX descriptor information.

11 years agoAdd in specific TDMA logging types.
adrian [Tue, 27 Nov 2012 02:24:05 +0000 (02:24 +0000)]
Add in specific TDMA logging types.

11 years agoFix the TDMA nexttbtt programming for 802.11n chips.
adrian [Tue, 27 Nov 2012 02:23:45 +0000 (02:23 +0000)]
Fix the TDMA nexttbtt programming for 802.11n chips.

The existing logic wrapped programming nexttbtt at 65535 TU.
This is not good enough for the 11n chips, whose nexttbtt register
(GENERIC_TIMER_0) has an initial value from 0..2^31-1 TSF.
So converting the TU to TSF had the counter wrap at (65535 << 10) TSF.

Once this wrap occured, the nexttbtt value was very very low, much
lower than the current TSF value.  At this point, the nexttbtt timer
would constantly fire, leading to the TX queue being constantly gated
open.. and when this occured, the sender was not correctly transmitting
in its slot but just able to continuously transmit.  The master would
then delay transmitting its beacon until after the air became free
(which I guess would be after the burst interval, before the next burst
interval would quickly follow) and that big delta in master beacon TX
would start causing big swings in the slot timing adjustment.

With this change, the nexttbtt value is allowed to go all the way up
to the maximum value permissable by the 32 bit representation.
I haven't yet tested it to that point; I really should.  The AR5212
HAL now filters out values above 65535 TU for the beacon configuration
(and the relevant legal values for SWBA, DBA and NEXTATIM) and the
AR5416 HAL just dutifully programs in what it should.

With this, TDMA is now useful on the 802.11n chips.

Tested:

* AR5416, AR9280 TDMA slave
* AR5413 TDMA slave

11 years agoAdd a note about the magic values here; don't change them.
adrian [Tue, 27 Nov 2012 02:19:35 +0000 (02:19 +0000)]
Add a note about the magic values here; don't change them.

11 years agoWhen programming the beacon timer configuration, be very explicit about
adrian [Tue, 27 Nov 2012 02:18:41 +0000 (02:18 +0000)]
When programming the beacon timer configuration, be very explicit about
what the maximum legal values are.

The current beacon timer configuration from TDMA wraps things at
HAL_BEACON_PERIOD-1 TU.  For the 11a chips this is fine, but for
the 11n chips it's not enough resolution.  Since the 11a chips have a
limit on what's "valid", just enforce this so when I do write larger
values in, they get suitably wrapped before programming.

Tested:

* AR5413, TDMA slave

Todo:

* Run it for a (lot) longer on a clear channel, ensure that no strange
  slippages occur.
* Re-validate this on STA configurations, just to be sure.

11 years agoAllow this file to build on FreeBSD.
jmallett [Tue, 27 Nov 2012 02:03:41 +0000 (02:03 +0000)]
Allow this file to build on FreeBSD.

11 years agoAdd NOTES and Makefile in order to generate LINT. NOTES contains pretty
marcel [Tue, 27 Nov 2012 01:17:50 +0000 (01:17 +0000)]
Add NOTES and Makefile in order to generate LINT. NOTES contains pretty
much all the union of all the kernel configuration files, including all
the CPU types, Marvell SOC types and at91 board types. Any device not
supported (read: does not compile) has been removed, which is a fairly
small set actually. As such, LINT gives us very good coverage without
having to build a zillion kernels.

11 years agoAllow building LINT by defining both SAMPLE_AT_RESET on the one hand
marcel [Tue, 27 Nov 2012 01:10:58 +0000 (01:10 +0000)]
Allow building LINT by defining both SAMPLE_AT_RESET on the one hand
and SAMPLE_AT_RESET_{LO|HI} on the other. It doesn't matter which
values they take, as long as they are defined.

11 years agoDon't include arm/xscale/i8134x/i81342reg.h when we're compiling LINT.
marcel [Tue, 27 Nov 2012 01:08:05 +0000 (01:08 +0000)]
Don't include arm/xscale/i8134x/i81342reg.h when we're compiling LINT.
The definitions in i81342reg.h clash with those in i80321reg.h.

11 years agoRemove print_kernel_section_addr(). All statements in that function
marcel [Tue, 27 Nov 2012 01:05:07 +0000 (01:05 +0000)]
Remove print_kernel_section_addr(). All statements in that function
expand to uncompilable code when the kernel configuration contains
"options DEBUG", such as it is for LINT. The toolchain is often a
better approach to figure this out, as it doesn't require one to
boot the kernel.

11 years agoDon't define intr_disable and intr_restore as macros. The macros
marcel [Tue, 27 Nov 2012 00:41:39 +0000 (00:41 +0000)]
Don't define intr_disable and intr_restore as macros. The macros
interfere with structure fields of the same name in drivers, like
the intr_disable function pointer in struct cphy_ops in cxgb(4).
Instead define intr_disable and intr_restore as inline functions.

With intr_disable() an inline function, the I32_bit and F32_bit
macros now need to be visible in MI code and given the rather
poor names, this is not at all good. Define ARM_CPSR_F32 and
ARM_CPSR_I32 and use that instead of F32_bit and I32_bit (resp)
for now.

11 years agoUnbreak building a kernel with EHCI: there's no ehci_atmelarm.c.
marcel [Mon, 26 Nov 2012 23:30:47 +0000 (23:30 +0000)]
Unbreak building a kernel with EHCI: there's no ehci_atmelarm.c.

11 years agoPull in r168610 from upstream libc++:
dim [Mon, 26 Nov 2012 21:32:31 +0000 (21:32 +0000)]
Pull in r168610 from upstream libc++:

  When using libc++ headers on FreeBSD, in combination with -std=c++98,
  -ansi or -std=c++03, the long long type is not supported.  So in this
  case, several functions and types, like lldiv_t, strtoll(), are not
  declared.

This should make it possible to use the libc++ headers in c++98 mode.

Note: libc++ is originally designed as a c++0x or higher library, so you
should still take care when using it with c++98 or c++03.

Noted by: Yamaya Takashi <yamayan@kbh.biglobe.ne.jp>
MFC after: 1 week

11 years agoFix problem with the Samsung 840 PRO series SSD detection.
mav [Mon, 26 Nov 2012 20:07:10 +0000 (20:07 +0000)]
Fix problem with the Samsung 840 PRO series SSD detection.
The device reports support for SATA Asynchronous Notification in its
IDENTIFY data, but returns error on attempt to enable that feature.
Make SATA XPT of CAM only report these errors, but not fail the device.

MFC after: 1 week

11 years ago drbr_enqueue() awlays consumes mbuf, no matter did it
glebius [Mon, 26 Nov 2012 20:03:57 +0000 (20:03 +0000)]
  drbr_enqueue() awlays consumes mbuf, no matter did it
fail or not. The mbuf pointer is no longer valid, so
can't be reused after.

  Fix igb_mq_start() where mbuf pointer was used after
drbr_enqueue().

  This eventually leads us to all invocations of
igb_mq_start_locked() called with third argument as NULL.
This allows us to simplify this function.

Submitted by: Karim Fodil-Lemelin <fodillemlinkarim gmail.com>
Reviewed by: jfv