freebsd.git
8 years agoMerge ^/head r295601 through r295844.
dim [Sun, 21 Feb 2016 13:49:26 +0000 (13:49 +0000)]
Merge ^/head r295601 through r295844.

8 years agoFix "invalid type '(null)'" usage messages in zfs(8) and zpool(8).
dim [Sun, 21 Feb 2016 13:03:58 +0000 (13:03 +0000)]
Fix "invalid type '(null)'" usage messages in zfs(8) and zpool(8).

Currently, zfs(8) and zpool(8) print "invalid type '(null)'" or similar
messages, if you pass in invalid types, sources or column names for "zfs
get", "zfs list" and "zpool get".  This is because the commands use
getsubopt(3), and in case of failure, they print 'value', which is NULL
when sub options don't match.

They should print 'suboptarg' instead, which is the documented way to
get at the non-matching sub option value.

Reviewed by: smh
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D5365

8 years agoAdd a missing call to dev_cleanup from the arm64 loader.efi.
andrew [Sat, 20 Feb 2016 17:29:04 +0000 (17:29 +0000)]
Add a missing call to dev_cleanup from the arm64 loader.efi.

Sponsored by: ABT Systems Ltd

8 years agoSome BIOSes ACPI bytecode needs to take (sleepable) acpi mutex for
kib [Sat, 20 Feb 2016 13:37:04 +0000 (13:37 +0000)]
Some BIOSes ACPI bytecode needs to take (sleepable) acpi mutex for
acpi_GetInteger() execution.  Intel DMAR interrupt remapping code
needs to know UID of the HPET to properly route the FSB interrupts
from the HPET, even when interrupt remapping is disabled, and the code
is executed under some non-sleepable mutexes.

Cache HPET UIDs in the device softc at the attach time and provide
lock-less method to get UID, use the method from the dmar hpet
handling code instead of calling GetInteger().

Reported and tested by: Larry Rosenman <ler@lerctr.org>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoSwitch /dev/hpet to use make_dev_s(9). Device needs si_drv1
kib [Sat, 20 Feb 2016 13:21:59 +0000 (13:21 +0000)]
Switch /dev/hpet to use make_dev_s(9).  Device needs si_drv1
initializated, do it correctly even though hpet cannot be loaded as
module.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoin pf_print_state_parts, do not use skw->proto to print the protocol but our
kp [Sat, 20 Feb 2016 12:53:53 +0000 (12:53 +0000)]
in pf_print_state_parts, do not use skw->proto to print the protocol but our
local copy proto that we very carefully set beforehands. skw being NULL is
perfectly valid there.

Obtained from: OpenBSD (henning)

8 years agoRevert r295756:
zbb [Sat, 20 Feb 2016 12:28:20 +0000 (12:28 +0000)]
Revert r295756:
Extract common code from PowerPC's ofw_pci

Import portions of the PowerPC OF PCI implementation into
new file "ofw_pci.c", common for other platforms. The files ofw_pci.c and
ofw_pci.h from sys/powerpc/ofw no longer exist. All required declarations
are moved to sys/dev/ofw/ofw_pci.h.

This creates a new ofw_pci_write_ivar() function and modifies
ofw_pci_nranges(), ofw_pci_read_ivar(), ofw_pci_route_interrupt()
methods.
Most functions contain existing ppc implementations in the majority
unchanged. Now there is no need to have multiple identical copies
of methods for various architectures.

Submitted by:  Marcin Mazurek <mma@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Annapurna Labs
Reviewed by:   jhibbits, mmel
Differential Revision: https://reviews.freebsd.org/D4879

This needs to return to the drawing board as it breaks both
PowerPC and Sparc64 build.

Pointed out by: jhibbits

8 years agoifconfig(8): can't use 'name' or 'description' when creating interface with auto...
kp [Sat, 20 Feb 2016 11:36:35 +0000 (11:36 +0000)]
ifconfig(8): can't use 'name' or 'description' when creating interface with auto numbering

If one does 'ifconfig tap create name blah', it will return error because the
'name' command doesn't properly populate the request sent to ioctl(...). The
'description' command has the same bug, and is also fixed with this patch.

If one does 'ifconfig tap create mtu 9000 name blah', it DOES work, but 'tap0'
(or other sequence number) is echoed, instead of the expected 'blah'. (assuming
the name change actually succeeded)

Submitted by: Marie Helene Kvello-Aune <marieheleneka@gmail.com>
Differential Revision: https://reviews.freebsd.org/D5341

8 years agoRename busdma_machdep.c to busdma_machdep-v4.c, pmap.c to pmap-v4.c
skra [Sat, 20 Feb 2016 07:45:21 +0000 (07:45 +0000)]
Rename busdma_machdep.c to busdma_machdep-v4.c, pmap.c to pmap-v4.c
and trap.c to trap-v4.c to be plain and consistent with other armv4
specific files.

8 years agoFix the definition of RM_MAX_END.
jhibbits [Sat, 20 Feb 2016 01:34:13 +0000 (01:34 +0000)]
Fix the definition of RM_MAX_END.

Even though casting from signed to unsigned is well-defined in C, it's better to
first cast to the larger unsigned type, then negate.

8 years agoIntroduce a RMAN_IS_DEFAULT_RANGE() macro, and use it.
jhibbits [Sat, 20 Feb 2016 01:32:58 +0000 (01:32 +0000)]
Introduce a RMAN_IS_DEFAULT_RANGE() macro, and use it.

This simplifies checking for default resource range for bus_alloc_resource(),
and improves readability.

This is part of, and related to, the migration of rman_res_t from u_long to
uintmax_t.

Discussed with: jhb
Suggested by: marcel

8 years agoixl(4)/ixlv(4): Revert m_collapse() in ixl_xmit() to m_defrag().
erj [Fri, 19 Feb 2016 22:48:20 +0000 (22:48 +0000)]
ixl(4)/ixlv(4): Revert m_collapse() in ixl_xmit() to m_defrag().

The m_collapse() call would fail when transmitting medium-sized packets
when the interface mtu was set to 9000, so revert back to m_defrag(),
which does not fail.

Differential Revision: https://reviews.freebsd.org/D5207
Tested by: jeffrey.e.pieper@intel.com
Sponsored by: Intel Corporation

8 years agoRemove dead code. Code Cleanup. Improve clarity in debug messages
davidcs [Fri, 19 Feb 2016 22:46:52 +0000 (22:46 +0000)]
Remove dead code. Code Cleanup. Improve clarity in debug messages

MFC after:5 days

8 years agoixl(4): Fix errors in queue interrupt setup in MSIX mode.
erj [Fri, 19 Feb 2016 22:45:09 +0000 (22:45 +0000)]
ixl(4): Fix errors in queue interrupt setup in MSIX mode.

- I40E_PFINT_DYN_CTLN needs to be cleared, and not have a queue index
  written to it.
- The interrupt linked list for each queue is changed to only include
  the queue's Rx and Tx queues.

Differential Revision: https://reviews.freebsd.org/D5206
Reviewed by: sbruno
Tested by: jeffrey.e.pieper@intel.com
Sponsored by: Intel Corporation

8 years agoixl(4): Remove unsupported device IDs.
erj [Fri, 19 Feb 2016 22:33:50 +0000 (22:33 +0000)]
ixl(4): Remove unsupported device IDs.

There is no official support for 20G SKUs on FreeBSD, and the KX_A
device ID was never used.

Differential Revision: https://reviews.freebsd.org/D5204
Reviewed by: sbruno, jeffrey.e.pieper@intel.com
Sponsored by: Intel Corporation

8 years agoDIRDEPS_BUILD: Enable the post-build footer/stats display.
bdrewery [Fri, 19 Feb 2016 22:28:45 +0000 (22:28 +0000)]
DIRDEPS_BUILD: Enable the post-build footer/stats display.

There is no real downside to this and it is useful to have enabled.

Sponsored by: EMC / Isilon Storage Division

8 years agoixl(4): Fix two important RSS bugs.
erj [Fri, 19 Feb 2016 21:58:14 +0000 (21:58 +0000)]
ixl(4): Fix two important RSS bugs.

- Change tc_mapping field to assign 64 queues instead of 16 to the PF's VSI;
  add comments to describe how this is done.

- Set hash lut size to 512 when setting filter control; the lut size defaults
  to 128 if this isn't set.

Differential Revision: https://reviews.freebsd.org/D5203
Reviewed by: gallatin
Tested by: jeffrey.e.pieper@intel.com
Sponsored by: Intel Corporation

8 years agosh: Rework code to remove '\0' from shell input.
jilles [Fri, 19 Feb 2016 21:53:12 +0000 (21:53 +0000)]
sh: Rework code to remove '\0' from shell input.

This fixes bugs where '\0' was not removed correctly and speeds up the
parser.

8 years agoModified the use of bxe_grc_dump() function so that it can be invoked directly at...
davidcs [Fri, 19 Feb 2016 21:32:49 +0000 (21:32 +0000)]
Modified the use of bxe_grc_dump() function so that it can be invoked directly at any potential error path, where a fwdump is needed. The fwdump (a.k.a grcdump) is stored in a driver buffer. The sysctl grcdump_done indicates if a fwdump was taken and waiting to be retrieved.
The sysctl trigger_grcdump can be used to manually trigger a fwdump.

MFC after:5 days

8 years agoqlxgb: fix mismatch.
pfg [Fri, 19 Feb 2016 18:05:02 +0000 (18:05 +0000)]
qlxgb: fix mismatch.

Found by: PVS Static Analysis
Reviewed by: davidcs
MFC after: 1 month

8 years agosh: Add tests for comments in sh -c.
jilles [Fri, 19 Feb 2016 16:56:07 +0000 (16:56 +0000)]
sh: Add tests for comments in sh -c.

8 years agoFix syntax error introduced in previous commit where I removed one
se [Fri, 19 Feb 2016 16:53:21 +0000 (16:53 +0000)]
Fix syntax error introduced in previous commit where I removed one
character to few. I should have waited for the kernel compile to finish,
even though the change seemed so trivial.

8 years agoRemove redundant check for "(dinfo != NULL)", it has already been performed
se [Fri, 19 Feb 2016 16:43:03 +0000 (16:43 +0000)]
Remove redundant check for "(dinfo != NULL)", it has already been performed
as the first part of this complex loop conditional.

Found by:    PVS Static Analysis

8 years agoExt2: cleanup setting of ctime/mtime/birthtime.
pfg [Fri, 19 Feb 2016 15:53:08 +0000 (15:53 +0000)]
Ext2: cleanup setting of ctime/mtime/birthtime.

This adopts the same change as r291936 for UFS.
Directly clear IN_ACCESS or IN_UPDATE when user supplied the time, and
copy the value into the inode.

This keeps the behaviour cleaner and is consistent with UFS.

Reviewed by: bde
MFC after: 1 month (only 10)

8 years agofirewire: fix a mismatch introduced in r230558.
pfg [Fri, 19 Feb 2016 15:35:20 +0000 (15:35 +0000)]
firewire: fix a mismatch introduced in r230558.

Found by: PVS Static Analysis
Reviewed by: sbruno
MFC after: 1 month

8 years agoRemove objcopy in WITHOUT_TOOLCHAIN if it's from elftoolchain
emaste [Fri, 19 Feb 2016 15:11:54 +0000 (15:11 +0000)]
Remove objcopy in WITHOUT_TOOLCHAIN if it's from elftoolchain

8 years agoAdd initial support for the Allwinner A31i and A31s. This just adds the
andrew [Fri, 19 Feb 2016 14:15:31 +0000 (14:15 +0000)]
Add initial support for the Allwinner A31i and A31s. This just adds the
FDT platform code to detect when we are booting on one of these SoCs. The
driver changes will be added shortly.

Submitted by: Emmanuel Vadot <manu@bidouilliste.com>
Differential Revision: https://reviews.freebsd.org/D5338

8 years agoInclude ofw_bus_subr.h before ofw_pci.h for the definition of struct
andrew [Fri, 19 Feb 2016 14:05:28 +0000 (14:05 +0000)]
Include ofw_bus_subr.h before ofw_pci.h for the definition of struct
ofw_bus_iinfo.

Sponsored by: ABT Systems Ltd

8 years agoFix possible out-of-bounds access detected by Ulrich Spörleins "scan-build".
se [Fri, 19 Feb 2016 14:01:35 +0000 (14:01 +0000)]
Fix possible out-of-bounds access detected by Ulrich Spörleins "scan-build".
Some invalid PCI device selectors could cause read access to an initialized
variable next to the array (local loop index variable).

While here, the parser has been made more strict with regard to the syntax
of PCI device selectors as documented in the man-page. E.g. "pci:" used to
be interpreted as "pci0:0".

MFC after: 3 days

8 years agoUse the SCTP level pointer, not the interface level.
tuexen [Fri, 19 Feb 2016 11:25:18 +0000 (11:25 +0000)]
Use the SCTP level pointer, not the interface level.

MFC after: 3 days

8 years agoRemove not used static function pmap_kenter_attr().
skra [Fri, 19 Feb 2016 10:40:04 +0000 (10:40 +0000)]
Remove not used static function pmap_kenter_attr().

8 years agoRemove not used definitions and fix some style nits.
skra [Fri, 19 Feb 2016 10:32:17 +0000 (10:32 +0000)]
Remove not used definitions and fix some style nits.
No functional changes.

8 years agoRemove AP_KRW definition not needed after r295801.
skra [Fri, 19 Feb 2016 09:52:11 +0000 (09:52 +0000)]
Remove AP_KRW definition not needed after r295801.

8 years agoRename pte.h to pte-v4.h and start including directly either pte-v4.h
skra [Fri, 19 Feb 2016 09:23:32 +0000 (09:23 +0000)]
Rename pte.h to pte-v4.h and start including directly either pte-v4.h
or pte-v6.h in files which needs it.

There are quite internal definitions in pte-v4.h and pte-v6.h headers
specific for corresponding pmap implementation. These headers should be
included only in very few files and an intention is to not hide for
which implementation such files are.

Further, sys/arm/arm/elf_trampoline.c is an example of file which
uses armv4 like pmap implementation for both armv4 and armv6 platforms.
This is another reason why pte.h which includes specific header
according to __ARM_ARCH is not created.

8 years agoRemove O_SYNC from the options passed to dbmopen().
se [Fri, 19 Feb 2016 08:42:13 +0000 (08:42 +0000)]
Remove O_SYNC from the options passed to dbmopen().

The output file is created as a temporary file that is moved over the
existing file after completion. Thus there is no need to immediately
flush all created db records to the temporary file.

This speeds up creation of the termcap db by a factor of 40 on my
ZFS based /etc filesytem (from 25 seconds to 0.6 seconds).

I have compared multiple output files created with and without O_SYNC
and they came out identical each time.  Nonetheless it might be best
to MFC this change and the similar one for services_mkdb (r295465) at
the same time when the changes to hash.c in review D5186 are merged.

MFC:  1 week

8 years agoMove common definitions from both pmap-v4.h and pmap-v6.h into pmap.h.
skra [Fri, 19 Feb 2016 08:41:47 +0000 (08:41 +0000)]
Move common definitions from both pmap-v4.h and pmap-v6.h into pmap.h.
(1) MI interface needed for vm subsystem.
(2) MD interface created for ARM architecture to be used in files
    shared by armv4 and armv6 platforms.

8 years agoRename pmap.h to pmap-v4.h and remove pmap-v6.h include from it.
skra [Fri, 19 Feb 2016 08:35:29 +0000 (08:35 +0000)]
Rename pmap.h to pmap-v4.h and remove pmap-v6.h include from it.
Create new pmap.h which includes specific header according to
__ARM_ARCH.

Note that <machine/pmap.h> is included from <vm/pmap.h> so one common
<machine/pmap.h> must exist.

8 years agoRemove sys/types.h
kevlo [Fri, 19 Feb 2016 06:50:00 +0000 (06:50 +0000)]
Remove sys/types.h

8 years agoFix regression introduced on 272446r.
araujo [Fri, 19 Feb 2016 06:35:53 +0000 (06:35 +0000)]
Fix regression introduced on 272446r.

lagg(4) supports the protocol none, where it disables any traffic without
disabling the lagg(4) interface itself.

PR: 206921
Submitted by: Pushkar Kothavade <pushkarbk@gmail.com>
Reviewed by: rpokala
Approved by: bapt (mentor)
MFC after: 3 weeks
Sponsored by: gandi.net
Differential Revision: https://reviews.freebsd.org/D5076

8 years agonet80211: add few missing subtype names.
avos [Fri, 19 Feb 2016 05:59:38 +0000 (05:59 +0000)]
net80211: add few missing subtype names.

- Add definitions for Timing Advertisement and Control Wrapper frames.
- Refresh ieee80211_mgt_subtype_name and ieee80211_ctl_subtype_name
arrays.
- Count Timing Advertisement frames as discarded management frames in all
modes.

Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D5331

8 years agohyperv/hn: Free the txdesc buf_ring when the TX ring is destroyed
sephe [Fri, 19 Feb 2016 05:13:56 +0000 (05:13 +0000)]
hyperv/hn: Free the txdesc buf_ring when the TX ring is destroyed

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5318

8 years agohyperv/hn: Enable IP header checksum offloading for WIN8 (WinServ2012)
sephe [Fri, 19 Feb 2016 05:08:44 +0000 (05:08 +0000)]
hyperv/hn: Enable IP header checksum offloading for WIN8 (WinServ2012)

Tested on Windows Server 2012.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5317

8 years agohyperv/hn: Add option to bind TX taskqueues to the specified CPU
sephe [Fri, 19 Feb 2016 05:03:17 +0000 (05:03 +0000)]
hyperv/hn: Add option to bind TX taskqueues to the specified CPU

It will be used to help tracking host side transmission ring selection
issue; and it will be turned on by default, once we have concrete result.

Reviewed by: adrian, Jun Su <junsu microsoft com>
Approved by: adrian (mento)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5316

8 years agodocument some ACPI related sysctls.
adrian [Fri, 19 Feb 2016 05:02:17 +0000 (05:02 +0000)]
document some ACPI related sysctls.

Submitted by: Oliver Pinter <oliver.pinter@hardenedbsd.org>
Sponsored by: HardenedBSD
Differential Revision: https://reviews.freebsd.org/D5263

8 years agoReplace several bus_alloc_resource() calls using default arguments with bus_alloc_res...
jhibbits [Fri, 19 Feb 2016 03:37:56 +0000 (03:37 +0000)]
Replace several bus_alloc_resource() calls using default arguments with bus_alloc_resource_any()

Since these calls only use default arguments, bus_alloc_resource_any() is the
right call.

Differential Revision: https://reviews.freebsd.org/D5306

8 years agoRemove bogus cast.
kevlo [Fri, 19 Feb 2016 01:57:51 +0000 (01:57 +0000)]
Remove bogus cast.

8 years agoAdd missing parentheses.
kevlo [Fri, 19 Feb 2016 01:56:59 +0000 (01:56 +0000)]
Add missing parentheses.

Found by: PVS-Studio

8 years agoEnsure that we test the event condition when a disabled kevent is enabled.
markj [Fri, 19 Feb 2016 01:49:33 +0000 (01:49 +0000)]
Ensure that we test the event condition when a disabled kevent is enabled.

r274560 modified kqueue_register() to only test the event condition if the
corresponding knote is not disabled. However, this check takes place before
the EV_ENABLE flag is used to clear the KN_DISABLED flag on the knote, so
enabling a previously-disabled kevent would not result in a notification for
a triggered event. This change fixes the problem by testing for EV_ENABLED
before possibly checking the event condition.

This change also updates a kqueue regression test to exercise this case.

PR: 206368
Reviewed by: kib
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D5307

8 years agoReturn an error if both EV_ENABLE and EV_DISABLE are specified for a kevent.
markj [Fri, 19 Feb 2016 01:35:01 +0000 (01:35 +0000)]
Return an error if both EV_ENABLE and EV_DISABLE are specified for a kevent.

Currently, this combination results in EV_DISABLE being ignored.

Reviewed by: kib
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D5307

8 years ago- language tightening
jgh [Fri, 19 Feb 2016 01:08:03 +0000 (01:08 +0000)]
- language tightening
- cleanup SEE ALSO section (thanks brueffer@)

Approved by: wblock (mentor)
Differential Revision: https://reviews.freebsd.org/D5335

8 years agoFix section number of .Xr geom_uzip in r295782.
sobomax [Fri, 19 Feb 2016 01:06:45 +0000 (01:06 +0000)]
Fix section number of .Xr geom_uzip in r295782.

MFC after: 1 months
(together with r295782)

8 years agoClear up confision as to who the original historical authors of code
sobomax [Fri, 19 Feb 2016 01:00:48 +0000 (01:00 +0000)]
Clear up confision as to who the original historical authors of code
and manual page were.

For whatever reason it listed myself as a primary author, which is
just not true.

Also, majority of the manpage is copied verbatim from the geom_uzip(4),
contributed by ceri, with only minor adjustments from loos, so put ceri
back into the copyright secrion where he belongs and reflect that in the
AUTHORS section.

For what it's worth, I think this one should be deleted and LZMA
support just folded back into geom_uzip(4) / mkuzip(4) whete it really
belongs.

MFC after: 1 month

8 years agoFAST_DEPEND: Apply conditional -MF from r291945 to kernel as well.
bdrewery [Fri, 19 Feb 2016 00:41:41 +0000 (00:41 +0000)]
FAST_DEPEND: Apply conditional -MF from r291945 to kernel as well.

Sponsored by: EMC / Isilon Storage Division

8 years agoDIRDEPS_BUILD: Add dependencies somehow missed in r295681.
bdrewery [Fri, 19 Feb 2016 00:41:38 +0000 (00:41 +0000)]
DIRDEPS_BUILD: Add dependencies somehow missed in r295681.

Sponsored by: EMC / Isilon Storage Division

8 years agoAvoid reading .depend.* in simple cases where not needed.
bdrewery [Fri, 19 Feb 2016 00:41:24 +0000 (00:41 +0000)]
Avoid reading .depend.* in simple cases where not needed.

This will speed up some tree-walks with FAST_DEPEND which otherwise
would include length(SRCS) .depend files.

This also uses a trick suggested by sjg@ to still read them in when
specifying _V_READ_DEPEND=1 in the env/make args.

Sponsored by: EMC / Isilon Storage Division

8 years agocxgbe: catch up with the latest hardware-related definitions.
np [Fri, 19 Feb 2016 00:29:16 +0000 (00:29 +0000)]
cxgbe: catch up with the latest hardware-related definitions.

Obtained from: Chelsio Communications
Sponsored by: Chelsio Communications

8 years agoRemove a bogus bzero() call.
jkim [Thu, 18 Feb 2016 23:32:11 +0000 (23:32 +0000)]
Remove a bogus bzero() call.

Found by: PVS-Studio

8 years agoOptimize ROL and ROR emulations and fix comments.
jkim [Thu, 18 Feb 2016 23:03:37 +0000 (23:03 +0000)]
Optimize ROL and ROR emulations and fix comments.

8 years agoSilence VPS-Studio errors (V646). These is no functional change.
jkim [Thu, 18 Feb 2016 23:00:01 +0000 (23:00 +0000)]
Silence VPS-Studio errors (V646).  These is no functional change.

8 years ago- add dma(8) to examples in mailer.conf(5)
jgh [Thu, 18 Feb 2016 22:40:24 +0000 (22:40 +0000)]
- add dma(8) to examples in mailer.conf(5)

PR: 207026
Submitted by: lifanov@mail.lifanov.com
Approved by: wblock (mentor)
Differential Revision: https://reviews.freebsd.org/D5259

8 years agoAdd protection code.
tuexen [Thu, 18 Feb 2016 21:33:10 +0000 (21:33 +0000)]
Add protection code.

MFC after: 3 days
CID: 748858

8 years agoAdd some protection code.
tuexen [Thu, 18 Feb 2016 21:21:45 +0000 (21:21 +0000)]
Add some protection code.

CID: 1331893
MFC after: 3 days

8 years agoFix reporting of mapped addressed in getpeername() and getsockname() for
tuexen [Thu, 18 Feb 2016 21:05:04 +0000 (21:05 +0000)]
Fix reporting of mapped addressed in getpeername() and getsockname() for
IPv6 SCTP sockets.
This bugs were found because of an issue reported by PVS / D5245.

8 years agoUse __unused instead of casting to void to silence the unused parameter
se [Thu, 18 Feb 2016 20:20:36 +0000 (20:20 +0000)]
Use __unused instead of casting to void to silence the unused parameter
warning.

Fix the indentation of 2 lines to conform with the style of this file.

Submitted by: jhb

8 years agoFix compiler warnings in iostat
asomers [Thu, 18 Feb 2016 20:08:01 +0000 (20:08 +0000)]
Fix compiler warnings in iostat

Raise WARNS from 1 to 6 (the default)
Fix warnings:
* Use C99 designated initializers for structs, and initialize all fields
* Mark global variables as static
* Mark unused function arguments
* Be careful about signed/unsigned comparisons

Reviewed by: eadler
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D5328

8 years agoSilence VPS-Studio errors (V512). These buffer underflows are intentional.
jkim [Thu, 18 Feb 2016 19:37:39 +0000 (19:37 +0000)]
Silence VPS-Studio errors (V512).  These buffer underflows are intentional.

8 years agoFix obvious typo, that lead to incorrect sorting.
glebius [Thu, 18 Feb 2016 19:05:30 +0000 (19:05 +0000)]
Fix obvious typo, that lead to incorrect sorting.

Found by: PVS-Studio

8 years agoBump .Dd for r295764
bjk [Thu, 18 Feb 2016 18:50:03 +0000 (18:50 +0000)]
Bump .Dd for r295764

Also fix a spelling and grammar nit while here.

8 years agoRight now, the "virtual hole" API feature of lseek(2) is very vaguely
sobomax [Thu, 18 Feb 2016 18:41:40 +0000 (18:41 +0000)]
Right now, the "virtual hole" API feature of lseek(2) is very vaguely
documented and easy to miss.

At the same time, it's pretty important for anyone who is trying to use
SEEK_HOLE/SEEK_DATA in real app. Try to bridge that gap by making that
description more pronounced and also document how it affects failure codes.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D5162

8 years agoFix build for i386 and arm64 after r295755
zbb [Thu, 18 Feb 2016 15:44:45 +0000 (15:44 +0000)]
Fix build for i386 and arm64 after r295755

- Take bus_space_tag_t type into consideration when returning
  default, zero value.
- Include missing rman.h required by ofw_pci.h

8 years agoIncrease kernel and user VA space.
br [Thu, 18 Feb 2016 15:28:57 +0000 (15:28 +0000)]
Increase kernel and user VA space.
This allows us to boot with more than 128MB of physical memory.

Sponsored by: DARPA, AFRL
Sponsored by: HEIF5

8 years agoMake WARNS=6 safe.
se [Thu, 18 Feb 2016 15:23:25 +0000 (15:23 +0000)]
Make WARNS=6 safe.

Tested with Clang 3.7.1, GCC 4.2.1 and GCC 4.8.5 on amd64.

8 years agoRemove a stray else. It isn't needed (due to the return at the end of
imp [Thu, 18 Feb 2016 15:12:52 +0000 (15:12 +0000)]
Remove a stray else. It isn't needed (due to the return at the end of
the if statement it pairs with). While not an error today, a careless
edit in the future could cause problems (though given the nature of
this specific code, the problems quite likely would be some variation
of "most direct access SCSI storage devices won't attach," which is
unlikely to go unnoticed).

PVS-Studio: V705

8 years agoUse medany (Medium/Anywhere) GCC code model for RISC-V.
br [Thu, 18 Feb 2016 14:38:37 +0000 (14:38 +0000)]
Use medany (Medium/Anywhere) GCC code model for RISC-V.
This will allow us to use bigger relocations and all
the 64-bit VA space.

8 years agoRemove dd xfer stats emitted during buildworld
emaste [Thu, 18 Feb 2016 14:17:28 +0000 (14:17 +0000)]
Remove dd xfer stats emitted during buildworld

They result in gratuitous differences when comparing build log output.

8 years agoExtract common code from PowerPC's ofw_pci
zbb [Thu, 18 Feb 2016 13:07:21 +0000 (13:07 +0000)]
Extract common code from PowerPC's ofw_pci

Import portions of the PowerPC OF PCI implementation into
new file "ofw_pci.c", common for other platforms. The files ofw_pci.c and
ofw_pci.h from sys/powerpc/ofw no longer exist. All required declarations
are moved to sys/dev/ofw/ofw_pci.h.

This creates a new ofw_pci_write_ivar() function and modifies
ofw_pci_nranges(), ofw_pci_read_ivar(), ofw_pci_route_interrupt() methods.
Most functions contain existing ppc implementations in the majority
unchanged. Now there is no need to have multiple identical copies
of methods for various architectures.

Submitted by:  Marcin Mazurek <mma@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Annapurna Labs
Reviewed by:   jhibbits, mmel
Differential Revision: https://reviews.freebsd.org/D4879

8 years agoIntroduce bus_get_bus_tag() method
zbb [Thu, 18 Feb 2016 13:00:04 +0000 (13:00 +0000)]
Introduce bus_get_bus_tag() method

Provide bus_get_bus_tag() for sparc64, powerpc, arm, arm64 and mips
nexus and its children in order to return a platform specific default tag.

This is required to ensure generic correctness of the bus_space tag.
It is especially needed for arches where child bus tag does not match
the parent bus tag. This solves the problem with ppc architecture
where the PCI bus tag differs from parent bus tag which is big-endian.

This commit is a part of the following patch:
https://reviews.freebsd.org/D4879

Submitted by:  Marcin Mazurek <mma@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Annapurna Labs
Reviewed by:   jhibbits, mmel
Differential Revision: https://reviews.freebsd.org/D4879

8 years agoFix bug in ofwbus_release_resource() for non-ofwbus descendants
zbb [Thu, 18 Feb 2016 11:53:57 +0000 (11:53 +0000)]
Fix bug in ofwbus_release_resource() for non-ofwbus descendants

Resource list for devices that are not ofwbus descendants, but
got to ofwbus method via bus_generic_release_resource() call chain,
cannot be found using BUS_GET_RESOURCE_LIST() used by ofwbus.
In that case, changing device's resource list should be avoided
(will not contain resource list prepared by ofw or simplebus).

Pointy-hat to: zbb
Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5304

8 years agoFix ThunderX external PEM bus offset
wma [Thu, 18 Feb 2016 11:26:08 +0000 (11:26 +0000)]
Fix ThunderX external PEM bus offset

Obtained from:         Semihalf
Sponsored by:          Cavium
Approved by:           cognet (mentor)
Reviewed by:           zbb
Differential revision: https://reviews.freebsd.org/D5293

8 years agoRemove redundant ARM_L2_ADDR_BITS and L2_ADDR_BITS definitions and
skra [Thu, 18 Feb 2016 09:30:04 +0000 (09:30 +0000)]
Remove redundant ARM_L2_ADDR_BITS and L2_ADDR_BITS definitions and
replace them by primary ones where needed.

8 years agoRemove redundant L2_ADDR_MASK definition and replace it by primary one.
skra [Thu, 18 Feb 2016 09:28:16 +0000 (09:28 +0000)]
Remove redundant L2_ADDR_MASK definition and replace it by primary one.

8 years agoRemove unneeded definitions after r291406. Also remove redundant and
skra [Thu, 18 Feb 2016 09:26:58 +0000 (09:26 +0000)]
Remove unneeded definitions after r291406. Also remove redundant and
not used L1_ADDR_BITS definition.

8 years agoReorganize the handling all-zeroes terminal block in sparse mode
thomas [Thu, 18 Feb 2016 08:44:16 +0000 (08:44 +0000)]
Reorganize the handling all-zeroes terminal block in sparse mode

The intent of the previous code in that case was to force
an explicit write, but the implementation was incorrect, and
as a result the write was never performed. This new implementation
instead uses ftruncate(2) to extend the file with a trailing hole.

Also introduce regression tests for these cases.

PR: 189284
(original PR whose fix introduced this bug)

PR: 207092

Differential Revision: D5248
Reviewed by: sobomax,kib
MFC after: 2 weeks

8 years agohyperv/hn: Use buf_ring for txdesc list
sephe [Thu, 18 Feb 2016 07:44:14 +0000 (07:44 +0000)]
hyperv/hn: Use buf_ring for txdesc list

So one spinlock is avoided, which would be potentially dangerous for
virtual machine, if the spinlock holder was scheduled out by the host,
as noted by royger.

Old spinlock based txdesc list is still kept around, so we could have
a safe fallback.

No performance regression nor improvement is observed.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5290

8 years agohyperv/hn: Split TX ring data structure out of softc
sephe [Thu, 18 Feb 2016 07:37:59 +0000 (07:37 +0000)]
hyperv/hn: Split TX ring data structure out of softc

This paves the way for upcoming vRSS stuffs and eases more code cleanup.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5283

8 years agohyperv/hn: Use non-fast taskqueue for transmission
sephe [Thu, 18 Feb 2016 07:28:45 +0000 (07:28 +0000)]
hyperv/hn: Use non-fast taskqueue for transmission

Performance stays same; so no need to use fast taskqueue here.

Suggested by: royger
Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5282

8 years agohyperv/hn: Use taskqueue_enqueue()
sephe [Thu, 18 Feb 2016 07:23:05 +0000 (07:23 +0000)]
hyperv/hn: Use taskqueue_enqueue()

This also eases experiment on the non-fast taskqueue.

Reviewed by: adrian, Jun Su <junsu microsoft com>
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5276

8 years agohyperv/hn: Split RX ring data structure out of softc
sephe [Thu, 18 Feb 2016 07:16:31 +0000 (07:16 +0000)]
hyperv/hn: Split RX ring data structure out of softc

This paves the way for upcoming vRSS stuffs and eases more code cleanup.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5275

8 years agohyperv/hn: Change global tunable prefix to hw.hn
sephe [Thu, 18 Feb 2016 07:06:44 +0000 (07:06 +0000)]
hyperv/hn: Change global tunable prefix to hw.hn

And use SYSCTL+CTLFLAG_RDTUN for them.

Suggested by: adrian
Reviewed by: adrian, Hongjiang Zhang <honzhan microsoft com>
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5274

8 years agohyperv/hn: Always do transmission scheduling.
sephe [Thu, 18 Feb 2016 07:00:47 +0000 (07:00 +0000)]
hyperv/hn: Always do transmission scheduling.

This one gives the best performance so far.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5273

8 years agohyperv/hn: Add option to allow sharing TX taskq between hn instances
sephe [Thu, 18 Feb 2016 06:55:05 +0000 (06:55 +0000)]
hyperv/hn: Add option to allow sharing TX taskq between hn instances

It is off by default.  This eases further experimenting on this driver.

Reviewed by: adrian
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5272

8 years agohyperv/hn: Set the TCP ACK/data segment aggregation limit
sephe [Thu, 18 Feb 2016 04:59:37 +0000 (04:59 +0000)]
hyperv/hn: Set the TCP ACK/data segment aggregation limit

Set TCP ACK append limit to 1, i.e. aggregate 2 ACKs at most.  Aggregating
anything more than 2 hurts TCP sending performance in hyperv.  This
significantly improves the TCP sending performance when the number of
concurrent connetion is low (2~8).  And it greatly stabilizes the TCP
sending performance in other cases.

Set TCP data segments aggregation length limit to 37500.  Without this
limitation, hn(4) could aggregate ~45 TCP data segments for each
connection (even at 64 or more connections) before dispatching them to
socket code; large aggregation slows down ACK sending and eventually
hurts/destabilizes TCP reception performance.  This setting stabilizes
and improves TCP reception performance for >4 concurrent connections
significantly.

Make them sysctls so they could be adjusted.

Reviewed by: adrian, gallatin (previous version), hselasky (previous version)
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5185

8 years agotcp/lro: Allow drivers to set the TCP ACK/data segment aggregation limit
sephe [Thu, 18 Feb 2016 04:58:34 +0000 (04:58 +0000)]
tcp/lro: Allow drivers to set the TCP ACK/data segment aggregation limit

ACK aggregation limit is append count based, while the TCP data segment
aggregation limit is length based.  Unless the network driver sets these
two limits, it's an NO-OP.

Reviewed by: adrian, gallatin (previous version), hselasky (previous version)
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5185

8 years agoFix a bug introduced in r295736
yongari [Thu, 18 Feb 2016 03:05:08 +0000 (03:05 +0000)]
Fix a bug introduced in r295736
TX descriptor address should be updated for valid chain.

Pointed out by: jmallett

8 years agoUse the _SAFE loop variant, since the loop body may remove queue entries.
markj [Thu, 18 Feb 2016 01:58:26 +0000 (01:58 +0000)]
Use the _SAFE loop variant, since the loop body may remove queue entries.

PR: 207146
MFC after: 3 days

8 years agoRemove duplicated check.
yongari [Thu, 18 Feb 2016 01:30:49 +0000 (01:30 +0000)]
Remove duplicated check.

Found by: PVS-Studio

8 years agoFix variable assignment.
yongari [Thu, 18 Feb 2016 01:24:10 +0000 (01:24 +0000)]
Fix variable assignment.

Found by: PVS-Studio

8 years agoFix installation of makewhatis.local(1) since r283777.
bdrewery [Thu, 18 Feb 2016 00:26:21 +0000 (00:26 +0000)]
Fix installation of makewhatis.local(1) since r283777.

The wrapper script has moved to libexec/makewhatis.local since it is not
directlry related to the older makewhatis(1) utility that has been replaced
by the usr.bin/mandoc version.

Reported by: vangyzen

8 years agoRelease the ref acquired in nd6_dad_find() if DAD is already in progress.
markj [Thu, 18 Feb 2016 00:00:51 +0000 (00:00 +0000)]
Release the ref acquired in nd6_dad_find() if DAD is already in progress.

MFC after: 1 week

8 years agoUse pfxrtr_del() instead of freeing advertising routers directly.
markj [Wed, 17 Feb 2016 23:55:24 +0000 (23:55 +0000)]
Use pfxrtr_del() instead of freeing advertising routers directly.

MFC after: 1 week