freebsd.git
2 weeks agosnmp_pdu_free the right object at the right time in snmptool_walk master github/master
ngie [Sat, 31 Dec 2016 10:01:25 +0000 (10:01 +0000)]
snmp_pdu_free the right object at the right time in snmptool_walk

r310892 was on the right track, but unfortunately it was resolving
the problem incorrectly and accidentally leaking memory in the
process.

- Call snmp_pdu_free on req before calling snmp_pdu_create on it
  at the bottom of the outer while loop
- Call snmp_pdu_free on resp after calling snmpwalk_nextpdu_create
  in the inner loop

MFC after: 12 days
X-MFC with: r310729, r310892
Reported by: valgrind

2 weeks agoRemove extra NULL-check before free(3).
hrs [Sat, 31 Dec 2016 09:52:00 +0000 (09:52 +0000)]
Remove extra NULL-check before free(3).

2 weeks agoDon't call snmp_pdu_free(..) until finished with the pdu and when ready to
ngie [Sat, 31 Dec 2016 09:43:35 +0000 (09:43 +0000)]
Don't call snmp_pdu_free(..) until finished with the pdu and when ready to
allocate a new one via snmp_pdu_create(..)

This fixes bsnmpwalk, so it no longer crashes after r310729

X-MFC with: r310729
MFC after: 12 days

2 weeks ago[net80211] add placeholders for the VHT action frame handling.
adrian [Sat, 31 Dec 2016 07:50:14 +0000 (07:50 +0000)]
[net80211] add placeholders for the VHT action frame handling.

Upcoming vht support will register send/receive action handlers.

2 weeks agoReplace two fat signal handlers with function calls in
hrs [Sat, 31 Dec 2016 06:23:05 +0000 (06:23 +0000)]
Replace two fat signal handlers with function calls in
the main I/O multiplex loop.  select() now watches
a pipe which is written by the new skinny signal
handlers and the received signals are handled inside
the loop sequencially.

This eliminates a complex signal mask to guarantee
async-signal safety.

2 weeks agoDo not remove llvm-objdump. It is installed by default since r310840.
jkim [Sat, 31 Dec 2016 06:07:48 +0000 (06:07 +0000)]
Do not remove llvm-objdump.  It is installed by default since r310840.

2 weeks agoRetry to open an F_PIPE process when it dies unexpectedly.
hrs [Sat, 31 Dec 2016 03:07:48 +0000 (03:07 +0000)]
Retry to open an F_PIPE process when it dies unexpectedly.

Reported by: Eugene Grosbein
PR: 215335

2 weeks agoFix rcc_gpio_modify_bits(). Obviously (1 << 0) is not the same as 0.
loos [Sat, 31 Dec 2016 02:23:15 +0000 (02:23 +0000)]
Fix rcc_gpio_modify_bits().  Obviously (1 << 0) is not the same as 0.

Pointy hat to: loos
MFC after: 3 days

2 weeks agoFixes the sensor initialization, always reset the digital outputs to start.
loos [Sat, 31 Dec 2016 02:18:08 +0000 (02:18 +0000)]
Fixes the sensor initialization, always reset the digital outputs to start.

Obtained from: pfSense
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (Netgate)

2 weeks agoRemove extra entries from the option enum
bapt [Fri, 30 Dec 2016 23:46:11 +0000 (23:46 +0000)]
Remove extra entries from the option enum

MFC after: 3 days

2 weeks agoGuard against use-after-free after calling mibif_free(..)
ngie [Fri, 30 Dec 2016 23:44:39 +0000 (23:44 +0000)]
Guard against use-after-free after calling mibif_free(..)

Set variables to NULL after calling free.

Also, remove unnecessary if (x != NULL) checks before calling free(x)

MFC after: 1 week

2 weeks agoMake sdiff --left-column work as expected
bapt [Fri, 30 Dec 2016 23:41:33 +0000 (23:41 +0000)]
Make sdiff --left-column work as expected

MFC after: 3 days

2 weeks agoMFV r310869:
mm [Fri, 30 Dec 2016 23:05:06 +0000 (23:05 +0000)]
MFV r310869:

Sync libarchive with vendor.

Vendor bugfixes:
Use __LA_DEPRECATED macro with functions deprecated in 379867e (r310796)

MFC after: 2 weeks
X-MFC with: r310866

2 weeks agoMFV r310798:
mm [Fri, 30 Dec 2016 22:54:08 +0000 (22:54 +0000)]
MFV r310798:

Sync libarchive with vendor.

Vendor bugfixes (relevant to FreeBSD):
PR #843: Fix memory leak of struct archive_entry in cpio/cpio.c
PR #851: Spelling fixes
Fix two protoypes in manual page archive_read_disk.3

MFC after: 2 weeks

2 weeks agortwn: add (untested) radar detection support for RTL8821AU
avos [Fri, 30 Dec 2016 22:24:01 +0000 (22:24 +0000)]
rtwn: add (untested) radar detection support for RTL8821AU
(disabled by default).

To enable it, dev.rtwn.%d.radar_detection tunable need to be set
to a nonzero value.

Tested with RTL8821AU, AP mode (no radar events were seen - so,
I have no idea if it is really correct / working)

Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D8903

2 weeks agoMFV r310796, r310797:
mm [Fri, 30 Dec 2016 22:18:22 +0000 (22:18 +0000)]
MFV r310796, r310797:

Sync libarchive with vendor.

Vendor changes (relevant to FreeBSD):
PR #771: Add NFSv4 ACL support to pax and restricted pax

NFSv4 ACL information may now be stored to and restored from tar archives.
ACL must be non-trivial and supported by the underlying filesystem, e.g.
natively by ZFS or by UFS with the NFSv4 ACL enable flag set.

MFC after: 2 weeks
Relnotes: yes

2 weeks agoFix whitespace in a comment and fixing a spelling error in a comment
ngie [Fri, 30 Dec 2016 21:41:01 +0000 (21:41 +0000)]
Fix whitespace in a comment and fixing a spelling error in a comment

MFC after: 3 days

2 weeks agoUnbreak ip_carp with WITHOUT_INET6 enabled by conditionalizing all IPv6
ngie [Fri, 30 Dec 2016 21:33:01 +0000 (21:33 +0000)]
Unbreak ip_carp with WITHOUT_INET6 enabled by conditionalizing all IPv6
structs under the INET6 #ifdef. Similarly (even though it doesn't seem
to affect the build), conditionalize all IPv4 structs under the INET
#ifdef

This also unbreaks the LINT-NOINET6 tinderbox target on amd64; I have not
verified other MACHINE/TARGET pairs (e.g. armv6/arm).

MFC after: 2 weeks
X-MFC with: r310847
Pointyhat to: jpaetzel
Reported by: O. Hartmann <o.hartmann@walstatt.org>

2 weeks agoindent(1): Avoid out of bounds access of array ps.paren_indents
pstef [Fri, 30 Dec 2016 21:00:45 +0000 (21:00 +0000)]
indent(1): Avoid out of bounds access of array ps.paren_indents

ps.p_l_follow can't be allowed to grow beyond maximum index of paren_indents.

Approved by: pfg (mentor)

2 weeks agoAdd missing reg property to usbphy node.
jmcneill [Fri, 30 Dec 2016 20:16:09 +0000 (20:16 +0000)]
Add missing reg property to usbphy node.

MFC after: 1 week

2 weeks agoloader: nandfs calls strategy with one extra argument.
tsoome [Fri, 30 Dec 2016 20:00:41 +0000 (20:00 +0000)]
loader: nandfs calls strategy with one extra argument.

The strategy argument cleanup in r310850 did miss another call to strategy(),
and left it with extra argument.

Reviewed by: allanjude
Approved by: allanjude (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D9003

2 weeks agodosfs support in libstand is broken since r298230
tsoome [Fri, 30 Dec 2016 19:06:29 +0000 (19:06 +0000)]
dosfs support in libstand is broken since r298230

Apparently the libstand dosfs optimization is a bit too optimistic
and did introduce possible memory corruption.

This patch is backing out the bad part and since this results in
dosfs reading full blocks now, we can also remove extra offset argument
from dv_strategy callback.

The analysis of the issue and the backout patch is provided by Mikhail Kupchik.

PR: 214423
Submitted by: Mikhail Kupchik
Reported by: Mikhail Kupchik
Reviewed by: bapt, allanjude
Approved by: allanjude (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D8644

2 weeks agoFix two similar bugs in the populate vm_fault() code.
kib [Fri, 30 Dec 2016 18:55:33 +0000 (18:55 +0000)]
Fix two similar bugs in the populate vm_fault() code.

If pager' populate method succeeded, but other thread raced with us
and modified vm_map, we must unbusy all pages busied by the pager,
before we retry the whole fault handling.  If pager instantiated more
pages than fit into the current map entry, we must unbusy the pages
which are clipped.

Also do some refactoring, clarify comments and use more clear local
variable names.

Reported and tested by: kargl, subbsd@gmail.com (previous version)
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

2 weeks agoHarden CARP against network loops.
jpaetzel [Fri, 30 Dec 2016 18:46:21 +0000 (18:46 +0000)]
Harden CARP against network loops.

If there is a loop in the network a CARP that is in MASTER state will see it's
own broadcasts, which will then cause it to assume BACKUP state.  When it
assumes BACKUP it will stop sending advertisements.  In that state it will no
longer see advertisements and will assume MASTER...

We can't catch all the cases where we are seeing our own CARP broadcast, but
we can catch the obvious case.

Submitted by: torek
Obtained from: FreeNAS
MFC after: 2 weeks
Sponsored by: iXsystems

2 weeks agoMerge CK as of commit 255a47553aa5e8d0bb5f8eec63acac7f4c25a6d8, mostly
cognet [Fri, 30 Dec 2016 18:23:58 +0000 (18:23 +0000)]
Merge CK as of commit 255a47553aa5e8d0bb5f8eec63acac7f4c25a6d8, mostly
to make sure we don't use any FP instruction.

2 weeks agoboot2 will deadlock if extended keys are used on text input
tsoome [Fri, 30 Dec 2016 18:21:52 +0000 (18:21 +0000)]
boot2 will deadlock if extended keys are used on text input

The boot2 family of bootblocks (zfsboot/gptzfsboot) are using separate
implementation if keyboard reading code, which has deadlock case when
extended key (arrows etc) are pressed.

The problem is about avoiding the noise from some systems, generating
false key events with scan code 1 and ascii code 00, so the code
does attempt to filter such cases out. Unfortunately the extended keys
also set ascii 0, and therefore the pressed key event is ignored and
the keypress is never read, resulting in infinite loop.

This update is moving the check to keyhit() function and is allowing
the rest of the code to process the extended keys.

Reviewed by: bapt, allanjude
Approved by: allanjude (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D8608

2 weeks agoImport CK as of commit 255a47553aa5e8d0bb5f8eec63acac7f4c25a6d8, mainly
cognet [Fri, 30 Dec 2016 18:14:30 +0000 (18:14 +0000)]
Import CK as of commit 255a47553aa5e8d0bb5f8eec63acac7f4c25a6d8, mainly
to add the option to disable double-related functions, as we don't want
them in the kernel.

2 weeks agoReapply 310775, now it also builds correctly if lldb is disabled:
dim [Fri, 30 Dec 2016 18:00:31 +0000 (18:00 +0000)]
Reapply 310775, now it also builds correctly if lldb is disabled:

Move llvm-objdump from CLANG_EXTRAS to installed by default

We currently install three tools from binutils 2.17.50: as, ld, and
objdump. Work is underway to migrate to a permissively-licensed
tool-chain, with one goal being the retirement of binutils 2.17.50.

LLVM's llvm-objdump is intended to be compatible with GNU objdump
although it is currently missing some options and may have formatting
differences. Enable it by default for testing and further investigation.
It may later be changed to install as /usr/bin/objdump, it becomes a
fully viable replacement.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D8879

2 weeks agoAssert that the pages found on the object queue by vm_page_next() and
kib [Fri, 30 Dec 2016 17:37:06 +0000 (17:37 +0000)]
Assert that the pages found on the object queue by vm_page_next() and
vm_page_prev() have correct ownership.

In collaboration with: alc
Sponsored by: The FreeBSD Foundation (kib)
MFC after: 1 week

2 weeks agoRestore status quo: mips64 does not need subr_sfbuf.c
kan [Fri, 30 Dec 2016 17:12:41 +0000 (17:12 +0000)]
Restore status quo: mips64 does not need subr_sfbuf.c

Reported by: br

2 weeks agoAdd parenthesis.
br [Fri, 30 Dec 2016 16:26:54 +0000 (16:26 +0000)]
Add parenthesis.

Noticed by: hps
Sponsored by: DARPA, AFRL

2 weeks agoo Fix unlocking.
br [Fri, 30 Dec 2016 16:06:05 +0000 (16:06 +0000)]
o Fix unlocking.
o Fix types for ds_addr/ds_len.

Sponsored by: DARPA, AFRL

2 weeks agoFix inverted loop condition which broke multi-line responses to CONNECT.
des [Fri, 30 Dec 2016 14:54:54 +0000 (14:54 +0000)]
Fix inverted loop condition which broke multi-line responses to CONNECT.

PR: 194483
Submitted by: MiƂosz Kaniewski <milosz.kaniewski@gmail.com>
MFC after: 1 week

2 weeks ago[netmap] fix locking regressions
adrian [Fri, 30 Dec 2016 14:47:46 +0000 (14:47 +0000)]
[netmap] fix locking regressions

* Firmware oriented NICs may need to sleep in their configuration paths.
  Use RLOCK instead of WLOCK to allow this to again occur.

  This fixes netmap on cxgbe.

* Change the worker lock to a normal mutex rather than a spin lock.
  Drivers shouldn't be doing netmap work from the fast interrupt
  handlers, so it's not required to be a spinlock.

Submitted by: luigi, Vincenzo Maffione <v.maffione@gmail.com>
Reviewed by: jhb

2 weeks agoStyle.
kib [Fri, 30 Dec 2016 13:04:43 +0000 (13:04 +0000)]
Style.

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 weeks agosfxge(4): move queue size checks to after the NIC config has been populated
arybchik [Fri, 30 Dec 2016 12:23:02 +0000 (12:23 +0000)]
sfxge(4): move queue size checks to after the NIC config has been populated

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8974

2 weeks agosfxge(4): cleanup: add efsys_lock_state_t for type of state param in EFSYS_LOCK()
arybchik [Fri, 30 Dec 2016 12:19:40 +0000 (12:19 +0000)]
sfxge(4): cleanup: add efsys_lock_state_t for type of state param in EFSYS_LOCK()

This allows the common code to use the correct type for the lock state
local variable passed to EFSYS_LOCK() and EFSYS_UNLOCK().

On Windows, this allows warning supression pragmas to be removed.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

2 weeks agosfxge(4): support per-command MCDI timeout
arybchik [Fri, 30 Dec 2016 12:10:15 +0000 (12:10 +0000)]
sfxge(4): support per-command MCDI timeout

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

2 weeks agosfxge(4): remove obsolete Wake-On-LAN support
arybchik [Fri, 30 Dec 2016 12:06:55 +0000 (12:06 +0000)]
sfxge(4): remove obsolete Wake-On-LAN support

Wake-on-lan is not supported in production on any of our adapters, as
they don't have the required AUX power connector. (It's possible that
AUX power is supplied to some of our ALOM or mezz adapters, but if so
then we've never implemented or tested WoL support.)

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D8972

2 weeks agosfxge(4): fix efx_filter_supported_filters API
arybchik [Fri, 30 Dec 2016 12:02:16 +0000 (12:02 +0000)]
sfxge(4): fix efx_filter_supported_filters API

The previous API had various problems, including the length of the
caller provided buffer not being specified, no means being available
to discover how big the buffer needs to be, and a lack of clarity of
what the resulting list contains.

To fix it:
- add the buffer length as a parameter
- if the provided buffer is too short, fail with ENOSPC and return the
  required length
- ensure that the list contents are valid and add comments
  describing it

It is safe to change this API as, unsuprisingly, it has no users.

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8971

2 weeks agosfxge(4): add functions to efx_bootcfg supporting whole partition access
arybchik [Fri, 30 Dec 2016 12:00:17 +0000 (12:00 +0000)]
sfxge(4): add functions to efx_bootcfg supporting whole partition access

Expose expcfg partition layout discovery and validating buffer copy
routines.  Needed for whole-partition expcfg operations.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D8970

2 weeks agosfxge(4): make verified update result available from ef10_nvram_partn_unlock()
arybchik [Fri, 30 Dec 2016 11:58:23 +0000 (11:58 +0000)]
sfxge(4): make verified update result available from ef10_nvram_partn_unlock()

Manftest needs to know exactly what went wrong with the verified update
so that failing boards can be correctly diagnosed.

Submitted by:   Tom Millington <tmillington at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D8969

2 weeks agosfxge(4): add per-command timeout reporting to the common code
arybchik [Fri, 30 Dec 2016 11:56:12 +0000 (11:56 +0000)]
sfxge(4): add per-command timeout reporting to the common code

In newer firmware that supports multithreaded MCDI processing,
longer running commands may be run ina background thread. Add
support for drivers to query the appropriate timeout for each
MCDI request.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D8968

2 weeks agosfxge(4): support non-interrupting event queues creation
arybchik [Fri, 30 Dec 2016 11:54:27 +0000 (11:54 +0000)]
sfxge(4): support non-interrupting event queues creation

Poll-mode driver does not use interrupts and number of used event queues
should not be limitted by the number of interrupts allocated for the
NIC.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8967

2 weeks agosfxge(4): cleanup: remove now-unused function flags
arybchik [Fri, 30 Dec 2016 11:52:55 +0000 (11:52 +0000)]
sfxge(4): cleanup: remove now-unused function flags

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8966

2 weeks agosfxge(4): cleanup: check deferred packet list tunables once
arybchik [Fri, 30 Dec 2016 11:49:37 +0000 (11:49 +0000)]
sfxge(4): cleanup: check deferred packet list tunables once

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8973

2 weeks agoFix bit value for a debug flag definition.
gavin [Fri, 30 Dec 2016 11:02:16 +0000 (11:02 +0000)]
Fix bit value for a debug flag definition.

Pointy hat to: gavin

2 weeks agocxgbe(4): Updates to link configuration.
np [Fri, 30 Dec 2016 08:59:49 +0000 (08:59 +0000)]
cxgbe(4): Updates to link configuration.

- Update struct link_settings and associated shared code.

- Add tunables to control FEC and autonegotiation.  All ports inherit
  these values as their initial settings.
  hw.cxgbe.fec
  hw.cxgbe.autoneg

- Add per-port sysctls to control FEC and autonegotiation.  These can be
  modified at any time.
  dev.<port>.<n>.fec
  dev.<port>.<n>.autoneg

MFC after: 3 days
Sponsored by: Chelsio Communications

2 weeks agoAdd MSIX rewrite table quirk for use with VMs.
hselasky [Fri, 30 Dec 2016 08:37:30 +0000 (08:37 +0000)]
Add MSIX rewrite table quirk for use with VMs.

This patch solves IRQ generation problems using the mlx5en(4) driver
with xenserver v6.5.0 in SRIOV and PCI-passthrough modes.

Until further the hw.pci.msix_rewrite_table quirk must be set manually
in /boot/loader.conf .

Reviewed by: jhb @
Sponsored by:           Mellanox Technologies
MFC after: 2 weeks

2 weeks agoRemove cpu_spinwait after seq_consistent.
mjg [Fri, 30 Dec 2016 06:26:17 +0000 (06:26 +0000)]
Remove cpu_spinwait after seq_consistent.

It does not add any benefit as the read routine will do it as necessary.

2 weeks ago- Fix incorrect values in the computation of OFDM and MCS Tx power.
kevlo [Fri, 30 Dec 2016 03:08:46 +0000 (03:08 +0000)]
- Fix incorrect values in the computation of OFDM and MCS Tx power.
- Make power a uint8_t rather than a uint16_t.
- Replace the hardcoded RF chains.

Reviewed by: avos

2 weeks agoATFify the gnop tests
asomers [Fri, 30 Dec 2016 02:22:38 +0000 (02:22 +0000)]
ATFify the gnop tests

Also, add test cases for the -p, -P, and -s options to gnop create

Reviewed by: ngie
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D8892

2 weeks agoUpdate vendor/libarchive to git to 379867ecb330b3a952fb7bfa7bffb7bbd5547205
mm [Fri, 30 Dec 2016 01:27:27 +0000 (01:27 +0000)]
Update vendor/libarchive to git to 379867ecb330b3a952fb7bfa7bffb7bbd5547205

Vendor changes:
PR #771: Add NFSv4 ACL support to pax and restricted pax

2 weeks agoSupport mips[*]hf variants in config files
kan [Fri, 30 Dec 2016 00:34:52 +0000 (00:34 +0000)]
Support mips[*]hf variants in config files

Recognize new MACHINE_ARCH names now as we have added hardfloat support.
Switch JZ4780 to mipselhf and remove all uses of TARGET_ARCH in kernel
.mk files.

Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D8989

2 weeks agortwn: silence compiler warning (-Wmaybe-uninitialized).
avos [Thu, 29 Dec 2016 22:36:16 +0000 (22:36 +0000)]
rtwn: silence compiler warning (-Wmaybe-uninitialized).

Reported by: adrian

2 weeks agoRevert r310775 for now, until we can figure out why it does not seem to
dim [Thu, 29 Dec 2016 21:57:16 +0000 (21:57 +0000)]
Revert r310775 for now, until we can figure out why it does not seem to
work properly when cross-building.  Sorry for the breakage.

2 weeks ago[qemu] Fix VERSATILEPB kernel boot in QEMU broken by r300968
gonzo [Thu, 29 Dec 2016 21:55:23 +0000 (21:55 +0000)]
[qemu] Fix VERSATILEPB kernel boot in QEMU broken by r300968

QEMU does not implement hardware debug registers so when
dbg_monitor_is_enabled is called kernel receives "invalid instruction"
exception. QEMU implements only DIDR register and on read returns all
zeroes to indicate that it doesn't support other registers. Real
hardware has Version bits set.

MFC after: 1 week

2 weeks agoUse TARGET_ARCH instead of MACHINE_ARCH for MIPS kernel
kan [Thu, 29 Dec 2016 21:36:04 +0000 (21:36 +0000)]
Use TARGET_ARCH instead of MACHINE_ARCH for MIPS kernel

MACHINE_ARCH is overwritten by config file and will not
contain -hf suffix, so uname -p reported by kernel will
be wrong.

2 weeks agoUse compiler driver to build relocatable object
kan [Thu, 29 Dec 2016 21:30:52 +0000 (21:30 +0000)]
Use compiler driver to build relocatable object

This works better with external toolchains where LD
will not necessarily defailt to emulation we want.
Compiler driver knows better.

2 weeks agoReduce the runtime of the GELI tests
asomers [Thu, 29 Dec 2016 20:28:50 +0000 (20:28 +0000)]
Reduce the runtime of the GELI tests

There is no reduction in test coverage.  On my system runtime is reduced
from 38m32s to 6m24s.

tests/sys/geom/class/eli/conf.sh
tests/sys/geom/class/eli/init_a_test.sh
tests/sys/geom/class/eli/init_test.sh
tests/sys/geom/class/eli/integrity_copy_test.sh
tests/sys/geom/class/eli/integrity_data_test.sh
tests/sys/geom/class/eli/integrity_hmac_test.sh
tests/sys/geom/class/eli/onetime_a_test.sh
tests/sys/geom/class/eli/onetime_test.sh
Move the looping code into common functions in conf.sh, and remove
alias ciphers from the list.

tests/sys/geom/class/eli/init_a_test.sh
tests/sys/geom/class/eli/init_test.sh
tests/sys/geom/class/eli/integrity_copy_test.sh
tests/sys/geom/class/eli/integrity_data_test.sh
tests/sys/geom/class/eli/integrity_hmac_test.sh
tests/sys/geom/class/eli/onetime_a_test.sh
Move a few commands that don't need to be in the inner loop out.

tests/sys/geom/class/eli/init_test.sh
tests/sys/geom/class/eli/onetime_a_test.sh
Reduce the sector count

tests/sys/geom/class/eli/Makefile
tests/sys/geom/class/eli/init_alias_test.sh
Add a test for initializing a GELI device using one of the cipher
aliases, and check that the alias is correctly interpreted.

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

2 weeks agoConvert ipv4_flags and ipv4_offset fields into host byte order.
ae [Thu, 29 Dec 2016 20:27:54 +0000 (20:27 +0000)]
Convert ipv4_flags and ipv4_offset fields into host byte order.
Also save only high bits in the ipv4_flags, because it is defined
as uint8_t. So now it will show DF and MF flags as 0x40 and 0x20.

Reviewed by: markj@
MFC after: 1 week

2 weeks agoUse mips_dcache_wbinv_range instead of mips_dcache_wb_range on CPU_XBURST
kan [Thu, 29 Dec 2016 20:11:50 +0000 (20:11 +0000)]
Use mips_dcache_wbinv_range instead of mips_dcache_wb_range on CPU_XBURST

Ingenic CPUs treat plain cache writeback as local-only operation and do
nothing if that is a remote CPU that holds the dirty cache line. They
do broadcast invalidate and write-and-invalidate to other cores though,
so take advantage of that and use wbinv in place of wb as this still gives
us required busdma semantics. Otherwise we'd have to do IPI to remote CPU
ourselves.

2 weeks agoWhen we are sending IP fragments, update ip pointers in IP_PROBE() for
ae [Thu, 29 Dec 2016 19:57:46 +0000 (19:57 +0000)]
When we are sending IP fragments, update ip pointers in IP_PROBE() for
each fragment.

MFC after: 1 week

2 weeks agoFix build with enabled debug after r310778.
mav [Thu, 29 Dec 2016 18:08:04 +0000 (18:08 +0000)]
Fix build with enabled debug after r310778.

MFC after: 2 weeks

2 weeks ago[ar71xx] add EARLY_PRINTF support for the AR933x (Hornet) UART.
adrian [Thu, 29 Dec 2016 17:31:38 +0000 (17:31 +0000)]
[ar71xx] add EARLY_PRINTF support for the AR933x (Hornet) UART.

Tested:

* Carambola 2

2 weeks ago[ar71xx] put in an implicit read-after-write to flush things out.
adrian [Thu, 29 Dec 2016 17:31:07 +0000 (17:31 +0000)]
[ar71xx] put in an implicit read-after-write to flush things out.

Note: I may need to revisit this for mips74k.

2 weeks agocache: sprinkle __predict_false
mjg [Thu, 29 Dec 2016 16:35:49 +0000 (16:35 +0000)]
cache: sprinkle __predict_false

2 weeks agoImprove use of I/O's private area.
mav [Thu, 29 Dec 2016 15:09:34 +0000 (15:09 +0000)]
Improve use of I/O's private area.

 - Since I/Os are allocates from per-port pools, make allocations store
pointer to CTL softc there, and use it where needed instead of global.
 - Created bunch of helper macros to access LUN, port and CTL softc.

MFC after:  2 weeks

2 weeks agoAdd support for audio on I2S based DesignWare HDMI controllers.
jmcneill [Thu, 29 Dec 2016 14:08:24 +0000 (14:08 +0000)]
Add support for audio on I2S based DesignWare HDMI controllers.

Relnotes: yes

2 weeks agoThe JZ4780 I2S can feed either the internal audio codec or the HDMI
jmcneill [Thu, 29 Dec 2016 14:00:10 +0000 (14:00 +0000)]
The JZ4780 I2S can feed either the internal audio codec or the HDMI
transmitter, but not both at the same time. This patch:

 - Adds a dev.pcm.0.internal_codec sysctl node for selecting between
   internal and external codec
 - Changes playback sample rate from 96 kHz to 48 kHz for HDMI compatibility
 - Enables i2s clock on codec access

Reviewed by: br
Differential Revision: https://reviews.freebsd.org/D8960

2 weeks agoMove llvm-objdump from CLANG_EXTRAS to installed by default
dim [Thu, 29 Dec 2016 13:27:04 +0000 (13:27 +0000)]
Move llvm-objdump from CLANG_EXTRAS to installed by default

We currently install three tools from binutils 2.17.50: as, ld, and
objdump. Work is underway to migrate to a permissively-licensed
tool-chain, with one goal being the retirement of binutils 2.17.50.

LLVM's llvm-objdump is intended to be compatible with GNU objdump
although it is currently missing some options and may have formatting
differences. Enable it by default for testing and further investigation.
It may later be changed to install as /usr/bin/objdump, it becomes a
fully viable replacement.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D8879

2 weeks agocache: move shrink lock init to nchinit
mjg [Thu, 29 Dec 2016 12:01:54 +0000 (12:01 +0000)]
cache: move shrink lock init to nchinit

This gets rid of unnecesary sysinit usage.

While here also rename the lock to be consistent with the rest.

2 weeks agosfxge(4): cleanup: clarify/unify variable name used for put-list length
arybchik [Thu, 29 Dec 2016 09:15:27 +0000 (09:15 +0000)]
sfxge(4): cleanup: clarify/unify variable name used for put-list length

get_count is used for get-list.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

2 weeks agocache: depessimize hashing macros/inlines
mjg [Thu, 29 Dec 2016 08:41:25 +0000 (08:41 +0000)]
cache: depessimize hashing macros/inlines

All hash sizes are power-of-2, but the compiler does not know that for sure
and 'foo % size' forces doing a division.

Store the size - 1 and use 'foo & hash' instead which allows mere shift.

2 weeks agocache: drop the NULL check from VP2VNODELOCK
mjg [Thu, 29 Dec 2016 08:34:50 +0000 (08:34 +0000)]
cache: drop the NULL check from VP2VNODELOCK

Now that negative entries are annotated with a dedicated flag, NULL vnodes
are no longer passed.

2 weeks agosfxge(4): add support for firmware-verified NVRAM updates to the common code
arybchik [Thu, 29 Dec 2016 08:28:42 +0000 (08:28 +0000)]
sfxge(4): add support for firmware-verified NVRAM updates to the common code

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D8942

2 weeks agosfxge(4): sync up tlv_layout.h (from firmwaresrc 82cd8a5715e9)
arybchik [Thu, 29 Dec 2016 08:25:00 +0000 (08:25 +0000)]
sfxge(4): sync up tlv_layout.h (from firmwaresrc 82cd8a5715e9)

Submitted by:   Matthew Slattery <mslattery at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

2 weeks agoUse uint32_t instead of u_int32_t for or_last_change and services in "struct systemg"
ngie [Thu, 29 Dec 2016 08:16:43 +0000 (08:16 +0000)]
Use uint32_t instead of u_int32_t for or_last_change and services in "struct systemg"

This is being done to match "struct systemg" in snmpmod(3)

No functional change

MFC after: 3 days

2 weeks agosfxge(4): regenerate MCDI headers from firmwaresrc .yml
arybchik [Thu, 29 Dec 2016 08:10:51 +0000 (08:10 +0000)]
sfxge(4): regenerate MCDI headers from firmwaresrc .yml

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

2 weeks agosfxge(4): fix typo in pseudo header accessor function names
arybchik [Thu, 29 Dec 2016 07:20:53 +0000 (07:20 +0000)]
sfxge(4): fix typo in pseudo header accessor function names

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

2 weeks agosfxge(4): delete hunt_phy.c
arybchik [Thu, 29 Dec 2016 07:10:25 +0000 (07:10 +0000)]
sfxge(4): delete hunt_phy.c

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

2 weeks agosfxge(4): do not use enum type when values are bitmask
arybchik [Thu, 29 Dec 2016 07:06:49 +0000 (07:06 +0000)]
sfxge(4): do not use enum type when values are bitmask

ICC complains that enumerated type mixed with another type.

Found by DPDK upstream build sanity check.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8954

2 weeks agosfxge(4): do not use enum for filter flags
arybchik [Thu, 29 Dec 2016 07:05:47 +0000 (07:05 +0000)]
sfxge(4): do not use enum for filter flags

It is not 100% correct to assign non-enum values to enum type
variables.

Found by ICC build (DPDK PMD upstreaming).

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8953

2 weeks agosfxge(4): don't use Tx descriptor push with TSO option descriptors
arybchik [Thu, 29 Dec 2016 07:04:26 +0000 (07:04 +0000)]
sfxge(4): don't use Tx descriptor push with TSO option descriptors

It is not safe to push TSO option descriptors if pacer bypass is
enabled, so to make sure that doesn't happen never push TSO option
descriptors.

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8952

2 weeks agosfxge(4): split EFX_FILTER_MATCH_LOC_MAC_IG back into separate flags
arybchik [Thu, 29 Dec 2016 07:02:32 +0000 (07:02 +0000)]
sfxge(4): split EFX_FILTER_MATCH_LOC_MAC_IG back into separate flags

The flag EFX_FILTER_MATCH_LOC_MAC_IG to represent filtering on the
individual/group bit of the MAC address (with the two cases being
distingusished by the MAC address in the filter specification) was
introduced to mirror the Linux driver filtering code, but the
implementations are different enough anyway that it isn't of much value.

Having separate flags for unknown unicast and multicast simplifies
the code and allows the set of flags to match those used by MCDI.

It will also makes it easier to report whether these filters are
supported.

In the MCDI definitions, the unknown multicast and unicast flags have
the values 0x40000000 and 0x80000000 respectively, and so using the
same values for simplicity requires 32 bits in the filter specification
to store the flags. This means the structure is now a little bigger
than 64 bytes, but filters are not often used on critical paths so this
shouldn't have much impact - on Linux they are also bigger than they
used to be.

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D8951

2 weeks agosfxge(4): allow to have no NIC handle on Rx datapath in DPDK PMD
arybchik [Thu, 29 Dec 2016 07:00:26 +0000 (07:00 +0000)]
sfxge(4): allow to have no NIC handle on Rx datapath in DPDK PMD

It is required to minimize RxQ context in the driver or avoid chaising
for the NIC handle in adapter (global per-interface) structure.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8950

2 weeks agosfxge(4): add missing barrier in common code MCDI response handling
arybchik [Thu, 29 Dec 2016 06:58:51 +0000 (06:58 +0000)]
sfxge(4): add missing barrier in common code MCDI response handling

The semantics of the MCDI interfacve require reading the first
dword of the header before any other data in the buffer. Add
a barrier to the common code MCDI handler to enforce this.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D8949

2 weeks agosfxge(4): use correct port number in sensor decoding
arybchik [Thu, 29 Dec 2016 06:57:36 +0000 (06:57 +0000)]
sfxge(4): use correct port number in sensor decoding

The port mask used for per-port sensors in mcdi_sensor_map
assumes zero-based port numbering. The port mask used in
the code is based on the one-based MCDI port number.

Fix this to lookup the correct per-port sensors, and to
allow reporting of sensor events from higher port numbers.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8947

2 weeks agosfxge(4): cleanup: simplify disable scatter logic in ef10_rx_qcreate
arybchik [Thu, 29 Dec 2016 06:56:18 +0000 (06:56 +0000)]
sfxge(4): cleanup: simplify disable scatter logic in ef10_rx_qcreate

Reviewed by:    gnn
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8945

2 weeks agosfxge(4): provide a way to find out which MAC stats are supported
arybchik [Thu, 29 Dec 2016 06:54:40 +0000 (06:54 +0000)]
sfxge(4): provide a way to find out which MAC stats are supported

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8944

2 weeks agosfxge(4): make the common code determine the number of PFs
arybchik [Thu, 29 Dec 2016 06:52:42 +0000 (06:52 +0000)]
sfxge(4): make the common code determine the number of PFs

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8941

2 weeks agosfxge(4): make the common code retrieve the number of FATSOv2 contexts
arybchik [Thu, 29 Dec 2016 06:51:06 +0000 (06:51 +0000)]
sfxge(4): make the common code retrieve the number of FATSOv2 contexts

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8940

2 weeks agosfxge(4): fix efx_ev_qpoll for non-Siena builds
arybchik [Thu, 29 Dec 2016 06:49:32 +0000 (06:49 +0000)]
sfxge(4): fix efx_ev_qpoll for non-Siena builds

Both Siena and EF10 use the siena_ev_qpoll() implementation, but this
function is not defined in builds without EFSYS_OPT_SIENA.

Remove siena_ev_qpoll and inline it into efx_ev_qpoll to allow it
to be used in non-Siena builds.

Also remove outdated FIXME comment, as EF10 event batching/merging has
been implemented long ago without needing to modify this code.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D8939

2 weeks agosfxge(4): fix common code for non-Siena builds
arybchik [Thu, 29 Dec 2016 06:47:53 +0000 (06:47 +0000)]
sfxge(4): fix common code for non-Siena builds

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8938

2 weeks agosfxge(4): fix misuse of siena_build_filter in common code
arybchik [Thu, 29 Dec 2016 06:46:20 +0000 (06:46 +0000)]
sfxge(4): fix misuse of siena_build_filter in common code

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8937

2 weeks agoNote that the Chelsio T6 also supports 25Gbps.
jhb [Thu, 29 Dec 2016 01:11:57 +0000 (01:11 +0000)]
Note that the Chelsio T6 also supports 25Gbps.

To avoid overflowing 80 columns, condense the cxgbe description a bit.

Reviewed by: np

2 weeks agoPrevent improper memory accesses after calling snmp_pdu_free and snmp_value_free
ngie [Thu, 29 Dec 2016 00:20:03 +0000 (00:20 +0000)]
Prevent improper memory accesses after calling snmp_pdu_free and snmp_value_free

snmp_pdu_free: set pdu->nbindings to 0 to limit the damage that
could happen if a pdu was reused after calling the function, and
as both stack and heap allocation types are used in contrib/bsnmp
and usr.sbin/bsnmpd.

snmp_value_free: NULL out value->v.octetstring.octets after calling
free on it to prevent a double-free from occurring.

MFC after:      2 weeks

2 weeks agoInstall {asn1,bsnmpagent,bsnmpclient,bsnmplib}.3 as all of the APIs
ngie [Wed, 28 Dec 2016 23:55:18 +0000 (23:55 +0000)]
Install {asn1,bsnmpagent,bsnmpclient,bsnmplib}.3 as all of the APIs
they document

Also, alphabetically sort MAN

MFC after: 3 days

2 weeks agoFix a bug in r272840; given that the optlen parameter of setsockopt(2)
marius [Wed, 28 Dec 2016 23:34:28 +0000 (23:34 +0000)]
Fix a bug in r272840; given that the optlen parameter of setsockopt(2)
is a 32-bit socklen_t, do_get3() passes the kernel to access the wrong
32-bit half on big-endian LP64 machines when simply casting the 64-bit
size_t optlen to a socklen_t pointer.
While at it and given that the intention of do_get3() apparently is to
hide/wrap the fact that socket options are used for communication with
ipfw(4), change the optlen parameter of do_set3() to be of type size_t
and as such more appropriate than uintptr_t, too.

MFC after: 3 days

2 weeks agocdboot: add explict suffix to ambiguous or instruction
emaste [Wed, 28 Dec 2016 23:02:01 +0000 (23:02 +0000)]
cdboot: add explict suffix to ambiguous or instruction

Clang disallows ambiguous instructions (GNU as has a default based on
chosen .code setting). We only need 'orb' here because KARGS_FLAGS_PXE
fits in a byte; this is the same as done in bxeboot.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8959