]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agosfxge(4): make strings array pointer itself immutable
Andrew Rybchenko [Wed, 28 Dec 2016 11:09:45 +0000 (11:09 +0000)]
sfxge(4): make strings array pointer itself immutable

Found by DPDK checkpatches.sh

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

7 years agosfxge(4): cleanup: add const qualifier to const array pointer
Andrew Rybchenko [Wed, 28 Dec 2016 11:07:34 +0000 (11:07 +0000)]
sfxge(4): cleanup: add const qualifier to const array pointer

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

7 years agosfxge(4): cleanup: avoid spaces before TAB
Andrew Rybchenko [Wed, 28 Dec 2016 11:04:36 +0000 (11:04 +0000)]
sfxge(4): cleanup: avoid spaces before TAB

Found by DPDK checkpatch.sh

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

7 years agosfxge(4): cleanup: avoid space just before TAB in efx_types.h
Andrew Rybchenko [Wed, 28 Dec 2016 11:03:06 +0000 (11:03 +0000)]
sfxge(4): cleanup: avoid space just before TAB in efx_types.h

Found by DPDK checkpatch.sh

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

7 years agosfxge(4): cleanup: use TAB to indent
Andrew Rybchenko [Wed, 28 Dec 2016 11:01:01 +0000 (11:01 +0000)]
sfxge(4): cleanup: use TAB to indent

Found by DPDK checkpatch.sh

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

7 years agosfxge(4): cleanup: add missing space between type and pointer symbol
Andrew Rybchenko [Wed, 28 Dec 2016 10:53:53 +0000 (10:53 +0000)]
sfxge(4): cleanup: add missing space between type and pointer symbol

Found by DPDK checkpatch.sh

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

7 years agosfxge(4): cleanup: open brace should be on a type name line
Andrew Rybchenko [Wed, 28 Dec 2016 10:52:04 +0000 (10:52 +0000)]
sfxge(4): cleanup: open brace should be on a type name line

Found by DPDK checkpatch.sh

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

7 years agosfxge(4): cleanup: remove trailing whitespaces
Andrew Rybchenko [Wed, 28 Dec 2016 10:49:41 +0000 (10:49 +0000)]
sfxge(4): cleanup: remove trailing whitespaces

Found by DPDK checkpatch.sh

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

7 years agosfxge(4): cleanup: pointer symbol should go together with struct member name
Andrew Rybchenko [Wed, 28 Dec 2016 10:48:15 +0000 (10:48 +0000)]
sfxge(4): cleanup: pointer symbol should go together with struct member name

Found by DPDK checkpatch.sh

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

7 years agosfxge(4): cleanup: avoid C99 // comments
Andrew Rybchenko [Wed, 28 Dec 2016 10:47:04 +0000 (10:47 +0000)]
sfxge(4): cleanup: avoid C99 // comments

Found by DPDK checkpatch.sh

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

7 years agosfxge(4): cleanup: remove unnecessary spaces
Andrew Rybchenko [Wed, 28 Dec 2016 10:45:14 +0000 (10:45 +0000)]
sfxge(4): cleanup: remove unnecessary spaces

Found by DPDK checkpatch.sh

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

7 years agosfxge(4): cleanup: use spaces around binary arithmetic operations
Andrew Rybchenko [Wed, 28 Dec 2016 10:44:03 +0000 (10:44 +0000)]
sfxge(4): cleanup: use spaces around binary arithmetic operations

Found by DPDK checkpatch.sh

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

7 years agosfxge(4): cleanup: fix wrong indent
Andrew Rybchenko [Wed, 28 Dec 2016 10:43:04 +0000 (10:43 +0000)]
sfxge(4): cleanup: fix wrong indent

Found by DPDK checkpatch.sh

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

7 years agosfxge(4): cleanup: remove trailing whitespace
Andrew Rybchenko [Wed, 28 Dec 2016 10:40:21 +0000 (10:40 +0000)]
sfxge(4): cleanup: remove trailing whitespace

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

7 years agosfxge(4): cleanup: fix typo in siena_mac_loopback_set() instrumentation
Andrew Rybchenko [Wed, 28 Dec 2016 10:39:11 +0000 (10:39 +0000)]
sfxge(4): cleanup: fix typo in siena_mac_loopback_set() instrumentation

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

7 years agorum.4, run.4, runfw.4, zyd.4: do not install when MK_USB == no.
Andriy Voskoboinyk [Wed, 28 Dec 2016 09:32:02 +0000 (09:32 +0000)]
rum.4, run.4, runfw.4, zyd.4: do not install when MK_USB == no.

While here, add missing if_rtwn_usb.4.gz symlink into
OptionalObsoleteFiles.inc

7 years agoFix the build by moving the initializers for len/nswapdev down below the
Enji Cooper [Wed, 28 Dec 2016 08:11:41 +0000 (08:11 +0000)]
Fix the build by moving the initializers for len/nswapdev down below the
declarations

MFC after: 3 days
Pointyhat to: ngie

7 years agoLimit number of stripes supported by HDA codec to maximum number
Michal Meloun [Wed, 28 Dec 2016 07:37:26 +0000 (07:37 +0000)]
Limit number of stripes supported by HDA codec to maximum number
announced by HDA controller.
Incorrectly implermented HDA codec may report support for more stripes
that HDA controller already have. Due to this, always limit number of
enabled stripes by global controller maximum.

Reviewed by: mav
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D8922

7 years agostyle(9): clean up whitespace
Enji Cooper [Wed, 28 Dec 2016 06:10:58 +0000 (06:10 +0000)]
style(9): clean up whitespace

MFC after: 3 days

7 years agostyle(9) fixes: clean up leading whitespace
Enji Cooper [Wed, 28 Dec 2016 05:43:14 +0000 (05:43 +0000)]
style(9) fixes: clean up leading whitespace

MFC after: 3 days

7 years agostyle(9) fixes: clean up leading whitespace
Enji Cooper [Wed, 28 Dec 2016 05:42:41 +0000 (05:42 +0000)]
style(9) fixes: clean up leading whitespace

MFC after: 3 days

7 years agostyle(9) fixes
Enji Cooper [Wed, 28 Dec 2016 05:41:53 +0000 (05:41 +0000)]
style(9) fixes

- Clean up trailing whitespace
- Fix variable type alignment in storage_OS_get_swap(..)

MFC after: 3 days

7 years agoOnly build/install usr.sbin/bsnmpd/modules/snmp_hast if MK_HAST != no
Enji Cooper [Wed, 28 Dec 2016 05:21:22 +0000 (05:21 +0000)]
Only build/install usr.sbin/bsnmpd/modules/snmp_hast if MK_HAST != no

MFC after: 1 week

7 years agoOnly build/install usr.sbin/bsnmpd/modules/snmp_wlan if MK_WIRELESS != no
Enji Cooper [Wed, 28 Dec 2016 05:16:41 +0000 (05:16 +0000)]
Only build/install usr.sbin/bsnmpd/modules/snmp_wlan if MK_WIRELESS != no

MFC after: 1 week

7 years agostyle(9): ip_get(..): clean up whitespace
Enji Cooper [Wed, 28 Dec 2016 05:05:08 +0000 (05:05 +0000)]
style(9): ip_get(..): clean up whitespace

MFC after: 3 days

7 years agostyle(9): snmp_send_packet(..): fix whitespace
Enji Cooper [Wed, 28 Dec 2016 04:56:15 +0000 (04:56 +0000)]
style(9): snmp_send_packet(..): fix whitespace

MFC after: 3 days

7 years agoloader: use strip -o instead of cp and strip in place
Ed Maste [Wed, 28 Dec 2016 04:55:43 +0000 (04:55 +0000)]
loader: use strip -o instead of cp and strip in place

It is simpler and cleaner to have strip produce the stripped output
directly than copying the input to the output first.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

7 years agostyle(9): fix whitespace in pdu_encode_secparams(..)
Enji Cooper [Wed, 28 Dec 2016 04:53:52 +0000 (04:53 +0000)]
style(9): fix whitespace in pdu_encode_secparams(..)

MFC after: 3 days

7 years agohyperv/hn: Factor out function to set rxfilter.
Sepherosa Ziehau [Wed, 28 Dec 2016 04:47:17 +0000 (04:47 +0000)]
hyperv/hn: Factor out function to set rxfilter.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8928

7 years agohyperv/hn: Function renaming; no functional changes.
Sepherosa Ziehau [Wed, 28 Dec 2016 04:35:52 +0000 (04:35 +0000)]
hyperv/hn: Function renaming; no functional changes.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8908

7 years agostyle(9): sort alignment in udp_recv(..)
Enji Cooper [Wed, 28 Dec 2016 04:31:07 +0000 (04:31 +0000)]
style(9): sort alignment in udp_recv(..)

MFC after: 3 weeks

7 years agoFix bsnmpd sending/receiving with multi-homed configurations or INADDR_ANY used
Enji Cooper [Wed, 28 Dec 2016 04:29:09 +0000 (04:29 +0000)]
Fix bsnmpd sending/receiving with multi-homed configurations or INADDR_ANY used
as the listening address in snmpd_input(..)

Stash the IPv4 address of the receiver via the recv(..) callback and use it in
the send(..) callback for the transport by specifying IP_SENDSRCADDR for the
control message type.

Add sendmsg logic to the UDP transport's send(..) callback and use the
respective send(..) callback for the transport instead of calling sendto in
snmpd_input(..).

MFC after:      3 weeks
Obtained from:  Isilon OneFS (^/onefs/branches/BR_8_0_0_DEV@r507595)
Submitted by:   Thor Steingrimsson <thor.steingrimsson@isilon.com>
Sponsored by:   Dell EMC Isilon

7 years agoInstall snmpmod.3 as all of the bsnmpd APIs it documents
Enji Cooper [Wed, 28 Dec 2016 03:56:25 +0000 (03:56 +0000)]
Install snmpmod.3 as all of the bsnmpd APIs it documents

MFC after: 3 days

7 years agoRestrict SLB handler to powerpc64 and AIM
Justin Hibbits [Wed, 28 Dec 2016 03:40:54 +0000 (03:40 +0000)]
Restrict SLB handler to powerpc64 and AIM

Only Book-S has SLBs.  Book-E does not, so restrict it to only Book-S (which we
call AIM).

7 years agohyperv/hn: Consolidate hn_{suspend,resume}
Sepherosa Ziehau [Wed, 28 Dec 2016 03:19:59 +0000 (03:19 +0000)]
hyperv/hn: Consolidate hn_{suspend,resume}

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8907

7 years agohyperv/vmbus: Nuke unnecessary critical sections.
Sepherosa Ziehau [Wed, 28 Dec 2016 03:07:58 +0000 (03:07 +0000)]
hyperv/vmbus: Nuke unnecessary critical sections.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8906

7 years agoImplement pmap_change_attr and related APIs on MIPS
Alexander Kabaev [Wed, 28 Dec 2016 02:55:26 +0000 (02:55 +0000)]
Implement pmap_change_attr and related APIs on MIPS

On platforms that have uncached-accelerate cache attribute, map it
to VM_MEMATTR_WRITE_COMBINING. Otherwise, leave write comining
undefined.

Reviewed by: adrian, jhb (glance)
Differential Revision: https://reviews.freebsd.org/D8894

7 years agoAllow more efficient use of private area.
Alexander Motin [Tue, 27 Dec 2016 23:56:46 +0000 (23:56 +0000)]
Allow more efficient use of private area.

There are 16 bytes of space, so we may store two pointers in one.

MFC after: 2 weeks

7 years agostyle(9): clean up trailing whitespace
Enji Cooper [Tue, 27 Dec 2016 23:32:54 +0000 (23:32 +0000)]
style(9): clean up trailing whitespace

MFC after: 3 weeks

7 years agoRemove an obsolete pragma from dtrace.h.
Mark Johnston [Tue, 27 Dec 2016 23:31:32 +0000 (23:31 +0000)]
Remove an obsolete pragma from dtrace.h.

It triggers a compiler warning and has been removed upstream.

MFC after: 1 week

7 years agoDo not update "saved" mode page on every MODE SELECT.
Alexander Motin [Tue, 27 Dec 2016 22:38:44 +0000 (22:38 +0000)]
Do not update "saved" mode page on every MODE SELECT.

We do not have non-volatile memory to really save those values, so we
neither report nor support this capability.  Also saved mode pages are
not replicated between HA peers now.

MFC after: 2 weeks

7 years ago[intelspi] Add SPI driver for Intel BayTrail SoC
Oleksandr Tymoshenko [Tue, 27 Dec 2016 22:37:24 +0000 (22:37 +0000)]
[intelspi] Add SPI driver for Intel BayTrail SoC

Add SPI mode (PIO-only) support for Intel Synchronous Serial Port that
can be found in several Intel's products starting from PXA family.
Most of implementations have slight differences in behavior and in
addresses for registers subset. This driver covers only BayTrail SoC
implementation for it's the only hardware I have to test it on.

Driver attaches to ACPI bus only and does not have PCI or FDT support
for now due to lack of hardware to test it on.

"intelspi" is the best name I've managed to come up with. Linux driver
name (spi-pxa2xx) does not make sense because current implementation
does not support actual PXA2xx SoCs. And as far as I know there is no
codename assigned to Intel SSP chip.

Reviewed by: br, manu
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D8896

7 years agoFix/synchronize field types in struct ctl_modepage_header.
Alexander Motin [Tue, 27 Dec 2016 22:31:06 +0000 (22:31 +0000)]
Fix/synchronize field types in struct ctl_modepage_header.

MFC after: 2 weeks

7 years agoMissed piece of r310640.
Alexander Motin [Tue, 27 Dec 2016 22:28:14 +0000 (22:28 +0000)]
Missed piece of r310640.

MFC after: 2 weeks

7 years agoConsistent handling of errors reported from the lower layer.
Michael Tuexen [Tue, 27 Dec 2016 22:14:41 +0000 (22:14 +0000)]
Consistent handling of errors reported from the lower layer.

MFC after: 3 days

7 years agoAdd support for revert to defaults (RTD) bit in MODE SELECT.
Alexander Motin [Tue, 27 Dec 2016 21:11:54 +0000 (21:11 +0000)]
Add support for revert to defaults (RTD) bit in MODE SELECT.

MFC after: 2 weeks

7 years agoRegen after r310638.
John Baldwin [Tue, 27 Dec 2016 20:22:17 +0000 (20:22 +0000)]
Regen after r310638.

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

7 years agoRename the 'flags' argument to getfsstat() to 'mode' and validate it.
John Baldwin [Tue, 27 Dec 2016 20:21:11 +0000 (20:21 +0000)]
Rename the 'flags' argument to getfsstat() to 'mode' and validate it.

This argument is not a bitmask of flags, but only accepts a single value.
Fail with EINVAL if an invalid value is passed to 'flag'.  Rename the
'flags' argument to getmntinfo(3) to 'mode' as well to match.

This is a followup to r308088.

Reviewed by: kib
MFC after: 1 month

7 years ago[rpi] Fix bcm2835_audio locking and samples starvation
Oleksandr Tymoshenko [Tue, 27 Dec 2016 19:08:08 +0000 (19:08 +0000)]
[rpi] Fix bcm2835_audio locking and samples starvation

Rework general approach to locking and working with audio worker thread:

- Use flags to signal requested worker action
- Fix submitted buffer calculations to avoid samples starvation
- Protect buffer pointers with locks to fix race condition between callback
  and audio worker thread
- Remove unnecessary vchi_service_use
- Do not use lock to serialize VCHI requests since only one thread issues them now
- Fix unloading signaling per hselasky@ suggestion
- Add output to detect inconsistent callback data caused by possible firmware bug
  https://github.com/raspberrypi/firmware/issues/696
- Add stats/debug sysctls to troubleshoot possible bugs

PR: 213687, 205979, 215194
MFC after: 1 week

7 years agoDecouple limits on number of LUNs per port and LUs per CTL.
Alexander Motin [Tue, 27 Dec 2016 18:23:16 +0000 (18:23 +0000)]
Decouple limits on number of LUNs per port and LUs per CTL.

Those two values are not directly related, so make them independent.
This does not change any limits immediately, but makes number of LUNs
per port controllable via tunable/sysctl kern.cam.ctl.lun_map_size.
After this change increasing CTL_MAX_LUNS should be pretty cheap,
and even making it tunable should be easy.

MFC after: 2 weeks

7 years agoelfcopy: fix PE object section name corruption and crash
Ed Maste [Tue, 27 Dec 2016 17:31:07 +0000 (17:31 +0000)]
elfcopy: fix PE object section name corruption and crash

Fixed a bug that the PE object section names are generated incorrectly
using the section name table found in the original input ELF object
instead of the intermediate ELF object.

Ticket: #541

Do not try to copy section content from a NULL d_buf when creating
uninitialized data COFF section for PE object.

Ticket: #540

Obtained from: ELF Tool Chain r3507, r3508
MFC after: 1 week

7 years agoAdd MAX_LUNS overflow safety checks.
Alexander Motin [Tue, 27 Dec 2016 17:13:31 +0000 (17:13 +0000)]
Add MAX_LUNS overflow safety checks.

While this MAX_LUNS limitation is too synthetic and should be removed,
it is better to enforce it while it is here.

MFC after: 2 weeks

7 years agolibkvm: support access to vmm guest memory, allow writes to fwmem and vmm
Andriy Gapon [Tue, 27 Dec 2016 10:17:56 +0000 (10:17 +0000)]
libkvm: support access to vmm guest memory, allow writes to fwmem and vmm

This change consists of two parts:
- allow libkvm to recognize /dev/vmm/* character devices as devices that
  provide access to the physical memory of a system (similarly to /dev/fwmem*)
- allow libkvm to recognize that /dev/vmm/* and /dev/fwmem* devices provide
  access to the physical memory of live remote systems and, thus, the memory
  is writable

As a result, it should be possible to run commands like
$ kgdb -w /path/to/kernel /dev/fwmem0.0
$ kgdb /path/to/kernel /dev/vmm/guest

Reviewed by: kib, jhb
MFC after: 2 weeks
Relnotes: yes
Sponsored by: Panzura
Differential Revision: https://reviews.freebsd.org/D8679

7 years agosfxge(4): do not limit driver RSS table to RSS channels max
Andrew Rybchenko [Tue, 27 Dec 2016 08:51:26 +0000 (08:51 +0000)]
sfxge(4): do not limit driver RSS table to RSS channels max

Specification of entire RSS table in the driver allows to spread traffic
more equally across CPUs/RSS channels if number of RSS channels is not
power of 2.

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

7 years ago[net80211] turn the default TX key configuration (for WEP) into a vap callback.
Adrian Chadd [Tue, 27 Dec 2016 06:10:28 +0000 (06:10 +0000)]
[net80211] turn the default TX key configuration (for WEP) into a vap callback.

The ath10k firmware supports hardware WEP offload, and in native wifi mode
(or 802.3 ethernet mode, for that matter) the WEP key isn't actually included
in the TX payload from net80211.  Instead, a separate firmware command is issued
that sets the default TX key to be the specified key.

However, net80211 doesn't at all inform the driver layer that this is
occuring - it just "expects" to be inserting WEP header information
when doing WEP TX, even with hardware encryption.

So, to better support the newer world order, turn the default TX key assignment
into a VAP method that can be overridden by the driver and ensure its wrapped
in a crypto begin/end set.  That way it should be correctly atomic from the
point of view of keychanges (as long as the driver does the right thing.)

It'd be nice if we passed through to the key_set call a flag that says
"also make this the default key" - that's captured here by calling the
deftxkey method after the key_set method.  Maybe I can do that later.

Note: this is a net80211 ABI change, and will require a kernel+modules
recompile.  Happy Holidays, etc.

Tested:

* ath10k driver port
* rtwn_usb, WEP station

7 years agoMFV r310622:
Martin Matuska [Tue, 27 Dec 2016 01:10:28 +0000 (01:10 +0000)]
MFV r310622:

Sync libarchive with vendor.

Vendor bugfixes (relevant to FreeBSD):
PR 846: Spelling fixes
PR 850: Fix issues with reading certain jar files
OSS-Fuzz 286: Bugfix in archive_strncat_l()

7 years agoUpdate vendor/libarchive to git to 42a3408ac7df1e69bea9ea12b72e14f59f7400c0
Martin Matuska [Tue, 27 Dec 2016 00:51:53 +0000 (00:51 +0000)]
Update vendor/libarchive to git to 42a3408ac7df1e69bea9ea12b72e14f59f7400c0

Vendor bugfixes:

PR 844: Coverity bug fixes in tests
PR 846: Spelling fixes
PR 850: Fix issues with reading certain jar files
PR 826: OpenSSL 1.1 support
PR 830, 831, 833: Spelling fixes
OSS-Fuzz 227, 230, 239: Fix possible memory leak in archive_read_free()
OSS-Fuzz 237: Fix heap buffer overflow when reading invalid ar archives
OSS-Fuzz 286: Bugfix in archive_strncat_l()

7 years ago[ig4] Add ACPI platform support for ig4 driver
Oleksandr Tymoshenko [Mon, 26 Dec 2016 22:13:43 +0000 (22:13 +0000)]
[ig4] Add ACPI platform support for ig4 driver

Add ACPI part for ig4 driver to make it work on Intel BayTrail SoC where
ig4 device is available only through ACPI

Reviewed by: avg
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D8742

7 years agoMake knote KN_INFLUX state counted. This is final fix for the issue
Konstantin Belousov [Mon, 26 Dec 2016 19:33:40 +0000 (19:33 +0000)]
Make knote KN_INFLUX state counted.  This is final fix for the issue
closed by r310302 for knote().

If KN_INFLUX | KN_SCAN flags are set for the note passed to knote() or
knote_fork(), i.e. the knote is scanned, we might erronously clear
INFLUX when finishing notification.  For normal knote() it was fixed
in r310302 simply by remembering the fact that we do not own
KN_INFLUX, since there we own knlist lock and scan thread cannot clear
KN_INFLUX until we drop the lock.  For knote_fork(), the situation is
more complicated, e must drop knlist lock AKA the process lock, since
we need to register new knotes.

Change KN_INFLUX into counter and allow shared ownership of the
in-flux state between scan and knote_fork() or knote().  Both in-flux
setters need to ensure that knote is not dropped in parallel.  Added
assert about kn_influx == 1 in knote_drop() verifies that in-flux state
is not shared when knote is destroyed.

Since KBI of the struct knote is changed by addition of the int
kn_influx field, reorder kn_hook and kn_hookid to fill pad on LP64
arches [1].  This keeps sizeof(struct knote) to same 128 bytes as it
was before addition of kn_influx, on amd64.

Reviewed by: markj
Suggested by: markj [1]
Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D8898

7 years agoRemove redundancy in vmtotal().
Konstantin Belousov [Mon, 26 Dec 2016 19:29:04 +0000 (19:29 +0000)]
Remove redundancy in vmtotal().

There are two instances of inlined unlocks + continue in vmtotal()
switch statements, which are ordinary expressed with break from the
switch case and code after the switch.  Also, the combination of
continue and break statement is redundand.

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

7 years agoChange knlist_destroy() to assert that knlist is empty instead of
Konstantin Belousov [Mon, 26 Dec 2016 19:28:10 +0000 (19:28 +0000)]
Change knlist_destroy() to assert that knlist is empty instead of
accepting the wrong state and printing warning.  Do not obliterate
kl_lock and kl_unlock pointers, they are often useful for post-mortem
analysis.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
X-Differential revision: https://reviews.freebsd.org/D8898

7 years agoDon't assign rtjp twice.
Xin LI [Mon, 26 Dec 2016 19:27:12 +0000 (19:27 +0000)]
Don't assign rtjp twice.

Reported by: clang static analyzer
MFC after: 2 weeks

7 years agoStyle.
Konstantin Belousov [Mon, 26 Dec 2016 19:26:40 +0000 (19:26 +0000)]
Style.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
X-Differential revision: https://reviews.freebsd.org/D8898

7 years ago[evdev] Fix build for older versions of clang
Oleksandr Tymoshenko [Mon, 26 Dec 2016 17:48:13 +0000 (17:48 +0000)]
[evdev] Fix build for older versions of clang

There was report of stable/11 build failure on older versions of
FreeBSD. The problem was a reference to static variable in inline
function. Although fairly recent versions of clang can cope with this
situation just fine there is no strict requirement to make functions
in question inline, they're not in any time-critical codepath. So to
keep HEAD and 11-STABLE buildable on older FreeBSDs some of the util
functions were converted from inline to normal.

Reported by: hselasky
MFC after: 3 days

7 years ago - pstat(8) does not accept any arguments other than getopt() args,
Xin LI [Mon, 26 Dec 2016 17:34:27 +0000 (17:34 +0000)]
 - pstat(8) does not accept any arguments other than getopt() args,
   so don't bother to adjust argc/argv after getopt() loop.
 - Make a string pointer constant.

MFC after: 2 weeks

7 years agoDon't use high precision clock for expiration as only second portion is
Xin LI [Mon, 26 Dec 2016 17:23:09 +0000 (17:23 +0000)]
Don't use high precision clock for expiration as only second portion is
used.

MFC after: 2 weeks

7 years agoAvoid use after free.
Xin LI [Mon, 26 Dec 2016 17:10:41 +0000 (17:10 +0000)]
Avoid use after free.

Reported by: Clang static code analyzer
MFC after: 2 weeks

7 years agoImplement drivers for NVIDIA tegra124 display controller, HDMI source
Michal Meloun [Mon, 26 Dec 2016 14:36:05 +0000 (14:36 +0000)]
Implement drivers for NVIDIA tegra124 display controller, HDMI source
and host1x module. Unfortunately, tegra124 SoC doesn't have 2D acceleration
engine and 3D requires not yet started nouveau driver.

These drivers forms a first non-x86 DRM2 enabled graphic stack.

Note, there are 2 outstanding issues:
 - The code uses gross hack in order to be comply with
   OBJT_MGTDEVICE pager. (See tegra_bo_init_pager() in tegra_bo.c)
 - Due to improper(probably) refcounting in drm_gem_mmap_single()
   (in drm_gem.c), the gem objects are never released.
I hope that I will be able to address both issues in finite time,
but I don't want to touch x86 world now.

MFC after: 1 month

7 years agoImport drm_patform.c, an implementation of non-PCI based attachment
Michal Meloun [Mon, 26 Dec 2016 14:28:23 +0000 (14:28 +0000)]
Import drm_patform.c, an implementation of non-PCI based attachment
for graphics drivers.
It will be used in upcoming driver for Nvidia Tegra boards.

MFC after: 1 month

7 years agoFix late monitor hotplug event.
Michal Meloun [Mon, 26 Dec 2016 11:20:40 +0000 (11:20 +0000)]
Fix late monitor hotplug event.
If system starts without attached monitor, DRM create framebuffer
for VT console. Later, when monitor is attached, the hotplug event must
issue full modeset procedure to setup CRTC.
In original code, this was done in drm_fb_helper_set_par(), but we don't
have this function implemented yet. Use unrolled version of
drm_fb_helper_set_par() to ensure same functionality.

MFC after: 1 month

7 years agostyle(9): fix trailing whitespace
Enji Cooper [Mon, 26 Dec 2016 11:16:55 +0000 (11:16 +0000)]
style(9): fix trailing whitespace

MFC after: 3 days

7 years agoUpdate engine time using update_snmpd_engine_time(..)
Enji Cooper [Mon, 26 Dec 2016 11:11:30 +0000 (11:11 +0000)]
Update engine time using update_snmpd_engine_time(..)

MFC after: 6 days
X-MFC with: r310498
Sponsored by: Dell EMC Isilon

7 years agoWhitespace changes.
Michael Tuexen [Mon, 26 Dec 2016 11:06:41 +0000 (11:06 +0000)]
Whitespace changes.

The toolchain for processing the sources has been updated. No functional
change.

MFC after: 3 days

7 years agoImplement more list header file functions.
Hans Petter Selasky [Mon, 26 Dec 2016 10:41:51 +0000 (10:41 +0000)]
Implement more list header file functions.
Add definition guard for the list_head structure.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoFix return type for `ret` (recv callback) and sort variables by alignment
Enji Cooper [Mon, 26 Dec 2016 10:24:48 +0000 (10:24 +0000)]
Fix return type for `ret` (recv callback) and sort variables by alignment

Again, for reasons I don't yet understand, this is not being flagged by the
compiler. Unlike the issue addressed in r310587, this problem existed prior
to r310586

MFC after: 2 weeks
X-MFC with: r310586, r310587

7 years agoFix definition for recv_dgram(..); it should be "ssize_t", not "int"
Enji Cooper [Mon, 26 Dec 2016 10:21:28 +0000 (10:21 +0000)]
Fix definition for recv_dgram(..); it should be "ssize_t", not "int"

I'm not sure why this wasn't flagged as an issue by the compiler, yet

MFC after: 3 weeks
X-MFC with: r310586

7 years agoRefactor transport sources a bit to facilitate changes coming down pipeline
Enji Cooper [Mon, 26 Dec 2016 10:17:22 +0000 (10:17 +0000)]
Refactor transport sources a bit to facilitate changes coming down pipeline

Add recv callback to transport layer to better facilitate code reuse and
readability and for symmetry with send callback. Move recv_dgram and
recv_stream to udp_recv and lsock_recv, respectively, and make the
beforementioned functions recv callbacks for the udp and lsock transports,
respectively.

Consolidate the check_priv* functions in their relevant trans*.c source to
limit scope/use.

Note: this code is roughly based content from the submitter, although this
was modified to be more of a direct move from snmpd/main.c to the trans_*.c
sources, and to reduce unnecessary static function declarations.

MFC after: 2 weeks
Submitted by: Thor Steingrimsson <thor.steingrimsson@isilon.com>
Sponsored by: Dell EMC Isilon

7 years agoFix LINT build.
Hans Petter Selasky [Mon, 26 Dec 2016 10:03:33 +0000 (10:03 +0000)]
Fix LINT build.

Found by: mmel @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoFix improperly used nexus.targ_lun.
Alexander Motin [Mon, 26 Dec 2016 08:47:35 +0000 (08:47 +0000)]
Fix improperly used nexus.targ_lun.

MFC after: 2 weeks

7 years agoFix style(9)
Enji Cooper [Mon, 26 Dec 2016 07:31:16 +0000 (07:31 +0000)]
Fix style(9)

- Sort #includes
- Delete trailing whitespace

No functional change

MFC after: 3 days

7 years ago[vchi] replace non-reproducible __DATE__/__TIME__ with hardcoded string
Oleksandr Tymoshenko [Mon, 26 Dec 2016 02:51:03 +0000 (02:51 +0000)]
[vchi] replace non-reproducible __DATE__/__TIME__ with hardcoded string

Although vchiq_build_date and vchiq_build_time are not used in current
vchi driver at the moment, make sure these value will not leak into
build later on if at some point they will be refered in some new
imported code

PR: 215494
Reported by: emaste
MFC after: 1 week

7 years agoImplement register and unregister chrdev in the LinuxKPI.
Hans Petter Selasky [Mon, 26 Dec 2016 01:18:07 +0000 (01:18 +0000)]
Implement register and unregister chrdev in the LinuxKPI.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoUse correct integer type when computing the maximum physical address
Hans Petter Selasky [Sun, 25 Dec 2016 21:41:40 +0000 (21:41 +0000)]
Use correct integer type when computing the maximum physical address
for kmem_alloc_contig().

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoUse the correct format specifier for physmem chunk sizes.
Justin Hibbits [Sun, 25 Dec 2016 20:19:32 +0000 (20:19 +0000)]
Use the correct format specifier for physmem chunk sizes.

Arguments are unsigned, so should be printed as unsigned.

7 years agoSome random code cleaning.
Alexander Motin [Sun, 25 Dec 2016 20:17:15 +0000 (20:17 +0000)]
Some random code cleaning.

 - Reduce indentation.
 - Remove extra braces.
 - Add few missing savety checks.

MFC after: 2 weeks

7 years agoSome optimizations for kqueue timers.
Konstantin Belousov [Sun, 25 Dec 2016 19:49:35 +0000 (19:49 +0000)]
Some optimizations for kqueue timers.

There is no need to do two allocations per kqueue timer. Gather all
data needed by the timer callout into the structure and allocate it at
once.

Use the structure to preserve the result of timer2sbintime(), to not
perform repeated 64bit calculations in callout.

Remove tautological casts.
Remove now unused p_nexttime [1].

Noted by: markj [1]
Reviewed by: markj (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
X-MFC note: do not remove p_nexttime
Differential revision: https://reviews.freebsd.org/D8901

7 years agoImprove LinuxKPI device support. Only delete own BSD devices and not
Hans Petter Selasky [Sun, 25 Dec 2016 19:49:09 +0000 (19:49 +0000)]
Improve LinuxKPI device support. Only delete own BSD devices and not
the ones obtained through devclass_get_device(). Some minor code
cleanups while at it.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoSome style.
Konstantin Belousov [Sun, 25 Dec 2016 19:38:07 +0000 (19:38 +0000)]
Some style.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
X-Differential revision: https://reviews.freebsd.org/D8901

7 years agoRemove a KASSERT which is not always true.
Michael Tuexen [Sun, 25 Dec 2016 17:37:18 +0000 (17:37 +0000)]
Remove a KASSERT which is not always true.

In case of the empty queue tp->snd_holes and tcp_sackhole_insert()
failing due to memory shortage, tp->snd_holes will be empty.
This problem was hit when stress tests where performed by pho.

PR: 215513
Reported by: pho
Tested by: pho
Sponsored by: Netflix, Inc.

7 years agoFix build of lib32 libraries for amd64 and powerpc64 with cross toolchain
Baptiste Daroussin [Sun, 25 Dec 2016 15:39:52 +0000 (15:39 +0000)]
Fix build of lib32 libraries for amd64 and powerpc64 with cross toolchain

7 years agoRemove CTL_MAX_LUNS from places where it is not required.
Alexander Motin [Sun, 25 Dec 2016 13:34:02 +0000 (13:34 +0000)]
Remove CTL_MAX_LUNS from places where it is not required.

MFC after: 2 weeks

7 years agoImprove third-party copy error reporting.
Alexander Motin [Sun, 25 Dec 2016 09:40:44 +0000 (09:40 +0000)]
Improve third-party copy error reporting.

For EXTENDED COPY:
 - improve parameters checking to report some errors before copy start;
 - forward sense data from copy target as descriptor in case of error;
 - report which CSCD reported error in sense key specific information.
For WRITE USING TOKEN:
 - pass through real sense data from copy target instead of reporting
our copy error, since for initiator its a "simple" write, not a copy.

MFC after: 2 weeks

7 years agoImprove IP address list representation in libxo output.
Jamie Gritton [Sat, 24 Dec 2016 23:51:27 +0000 (23:51 +0000)]
Improve IP address list representation in libxo output.

Extract decision-making about special-case printing of certain
jail parameters into a function.

Refactor emitting of IPv4 and IPv6 address lists into a function.

Resulting user-facing changes:

XO_VERSION is bumped to 2.

In verbose mode (-v), IPv4 and IPv6-Addresses are now properly emitted
as separate lists.
This only affects the output in encoding styles, i.e. xml and json.

{                                    {
  "__version": "1",                    "__version": "2",
  "jail-information": {                "jail-information": {
    "jail": [                            "jail": [
      {                                    {
        "jid": 166,                          "jid": 166,
        "hostname": "foo.com",               "hostname": "foo.com",
        "path": "/var/jail/foo",             "path": "/var/jail/foo",
        "name": "foo",                       "name": "foo",
        "state": "ACTIVE",                   "state": "ACTIVE",
        "cpusetid": 2,                       "cpusetid": 2,
        "ipv4_addrs": [                      "ipv4_addrs": [
          "10.1.1.1",                          "10.1.1.1",
          "10.1.1.2",                          "10.1.1.2",
          "10.1.1.3",              |           "10.1.1.3"
                                   >         ],
                                   >         "ipv6_addrs": [
          "fe80::1000:1",                      "fe80::1000:1",
          "fe80::1000:2"                       "fe80::1000:2"
        ]                                    ]
      }                                    }
    ]                                    ]
  }                                    }
}                                    }

In -n mode, ip4.addr and ip6.addr are formatted in the encoding styles'
native list types, e.g. instead of comma-separated lists, JSON arrays
are printed.

jls -n all --libxo json
 ...
 "ip4.addr": [
    "10.1.1.1",
    "10.1.1.2",
    "10.1.1.3"
  ],
  "ip4.saddrsel": true,
  "ip6.addr": [
    "fe80::1000:1",
    "fe80::1000:2"
  ],
  ...

jls -n all --libxo xml
  ...
  <ip4.addr>10.1.1.1</ip4.addr>
  <ip4.addr>10.1.1.2</ip4.addr>
  <ip4.addr>10.1.1.3</ip4.addr>
  <ip4.saddrsel>true</ip4.saddrsel>
  <ip6.addr>fe80::1000:1</ip6.addr>
  <ip6.addr>fe80::1000:2</ip6.addr>
  ...

PR: 215008
Submitted by: Christian Schwarz <me@cschwarz.com>
Differential Revision: https://reviews.freebsd.org/D8766

7 years agonet80211: fix 'pending CAC -> RUN transition lost' bug.
Andriy Voskoboinyk [Sat, 24 Dec 2016 23:43:14 +0000 (23:43 +0000)]
net80211: fix 'pending CAC -> RUN transition lost' bug.

Ensure that CAC -> RUN state transition will be requested
for every vap only once.

7 years ago- Fix -N flag (NoBind) for AF_LOCAL sockets.
Hiroki Sato [Sat, 24 Dec 2016 23:29:50 +0000 (23:29 +0000)]
- Fix -N flag (NoBind) for AF_LOCAL sockets.
- Do setsockopt(SO_RCVBUF) for AF_LOCAL sockets regardless of -s flag.

7 years agoFix gcc build.
Hiroki Sato [Sat, 24 Dec 2016 22:51:02 +0000 (22:51 +0000)]
Fix gcc build.

Spotted by: lidl

7 years agoImprove length handling when writing sense data.
Alexander Motin [Sat, 24 Dec 2016 17:42:34 +0000 (17:42 +0000)]
Improve length handling when writing sense data.

 - Allow maximal sense size limitation via Control Extension mode page.
 - When sense size limited, include descriptors atomically: whole or none.
 - Set new SDAT_OVFL bit if some descriptors don't fit the limit.
 - Report real written sense length instead of static maximal 252 bytes.

MFC after: 2 weeks

7 years agoUnbreak syslogd after r310494
Enji Cooper [Sat, 24 Dec 2016 12:50:17 +0000 (12:50 +0000)]
Unbreak syslogd after r310494

Don't close all file descriptors greater than STDERR_FILENO (2) in
waitdaemon(..) -- only close fd (file descriptor for /dev/null used in
subsequent calls to dup2) if it's greater than STDERR_FILENO.

Reported by: subbsd@gmail.com, danny@cs.huji.ac.il
Pointyhat to: hrs
X-MFC with: r310494

7 years agostyle(9): delete stray trailing whitespace after break statement
Enji Cooper [Sat, 24 Dec 2016 11:49:25 +0000 (11:49 +0000)]
style(9): delete stray trailing whitespace after break statement

MFC after: 3 days

7 years agoBe more strict about IpAddress type in snmp_value_parse(..)
Enji Cooper [Sat, 24 Dec 2016 11:41:16 +0000 (11:41 +0000)]
Be more strict about IpAddress type in snmp_value_parse(..)

- Use inet_pton with AF_INET instead of doing longhand with sscanf.
- Use gethostbyname2 with AF_INET to ensure that the hostname isn't
  accidentally parsed with another address family, e.g. AF_INET6.

NB: IpAddress per RFC-2578 is IPv4 only. Work is in progress to add
    the InetAddress type and friends documented in RFC-4001 and
    elsewhere (which supports IPv4, IPv6, and more).

MFC after: 2 weeks