]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoffs_vnops: Simplify extattr access
cem [Thu, 19 Jan 2017 16:46:05 +0000 (16:46 +0000)]
ffs_vnops: Simplify extattr access

As suggested in r167010, use the structure type and macros to access and
modify UFS2 extended attributes.  Add assertions that pointers are
aligned in places where we now access the data through a structure
pointer, instead of character-by-character.

PR: 216127
Reported by: dewayne at heuristicsystems.com.au
Reviewed by: kib@
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D9225

7 years agoRename tmpfs_mount member allnode_lock to include namespace prefix.
kib [Thu, 19 Jan 2017 16:01:36 +0000 (16:01 +0000)]
Rename tmpfs_mount member allnode_lock to include namespace prefix.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoProtect macro argument.
kib [Thu, 19 Jan 2017 15:06:18 +0000 (15:06 +0000)]
Protect macro argument.

Requested by: hselasky
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoHandle the set capabilities ioctl, letting the hardware checksum be
loos [Thu, 19 Jan 2017 14:58:55 +0000 (14:58 +0000)]
Handle the set capabilities ioctl, letting the hardware checksum be
disabled (Hi netmap!).

Only remove the CRC bytes from packets when the hardware tell us to do so.

Fixes the 'discard frame w/o leading ethernet header' issues.

Sponsored by: Rubicon Communications, LLC (Netgate)

7 years agoRework some tmpfs lock assertions.
kib [Thu, 19 Jan 2017 14:49:55 +0000 (14:49 +0000)]
Rework some tmpfs lock assertions.

Remove TMPFS_ASSERT_ELOCKED().  Its claims are already stated by other
asserts nearby and by VFS guarantees.
Change TMPFS_ASSERT_LOCKED() and one inlined place to use
ASSERT_VOP_(E)LOCKED() instead of hand-rolled imprecise asserts.

Tested by: pho (as part of the larger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoStyle fixes and comment updates.
kib [Thu, 19 Jan 2017 14:27:37 +0000 (14:27 +0000)]
Style fixes and comment updates.

Edit comments which explain no longer relevant details, and add
locking annotations to the struct tmpfs_node members.

Tested by: pho (as part of the larger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoThe port number and the to_port_en flag are valid only on SOP descriptor.
loos [Thu, 19 Jan 2017 14:05:49 +0000 (14:05 +0000)]
The port number and the to_port_en flag are valid only on SOP descriptor.

Sponsored by: Rubicon Communications, LLC (Netgate)

7 years agoRemove unused union member, fifos on tmpfs are implemented in common code.
kib [Thu, 19 Jan 2017 13:35:14 +0000 (13:35 +0000)]
Remove unused union member, fifos on tmpfs are implemented in common code.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoUse S_ISREG instead of manual & (also it's better to compare the
delphij [Thu, 19 Jan 2017 08:01:35 +0000 (08:01 +0000)]
Use S_ISREG instead of manual & (also it's better to compare the
result from & and the pattern instead of just assuming it's one bit
value).

Pointed out by Tianjie Mao <tjmao tjmao com>.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D4827

7 years agoFix an unchecked return value in zfsd
asomers [Wed, 18 Jan 2017 22:10:18 +0000 (22:10 +0000)]
Fix an unchecked return value in zfsd

It's pretty unlikely to actually hit this, but good to check it anyway

Reported by: Coverity
CID: 1362018
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp

7 years agoFix several Coverity CIDs in devd
asomers [Wed, 18 Jan 2017 20:24:37 +0000 (20:24 +0000)]
Fix several Coverity CIDs in devd

CID 13620551362054: File descriptor leaks during shutdown
CID 1362013: Potential null-termination fail with long network device names
CID 1362097: Uncaught exception during memory pressure
CID 13620171362016: Unchecked errors, possibly resulting in weird behavior
if two devd instances start at the same time.
CID 1362015: Unchecked error that will probably never fail

Reported by: Coverity
CID: 1362055 1362054 1362013 1362097 1362017 1362016 1362015
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp

7 years agorestore(8): Handle extended attribute names correctly
cem [Wed, 18 Jan 2017 18:16:57 +0000 (18:16 +0000)]
restore(8): Handle extended attribute names correctly

UFS2 extended attribute names are not NUL-terminated.  Handle
appropriately.

Correct the EXTATTR_BASE_LENGTH() macro, which handled ea_namelength ==
one (mod eight) extended attributes incorrectly.

PR: 216127
Reported by: dewayne at heuristicsystems.com.au
Reviewed by: kib@
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D9208

7 years agoUse SRCTOP instead of .CURDIR-relative path in .PATH directive
ngie [Wed, 18 Jan 2017 18:14:50 +0000 (18:14 +0000)]
Use SRCTOP instead of .CURDIR-relative path in .PATH directive

MFC after: 3 weeks
Sponsored by: Dell EMC Isilon

7 years agoufs/extattr.h: Fix documentation of ea_name termination
cem [Wed, 18 Jan 2017 17:55:49 +0000 (17:55 +0000)]
ufs/extattr.h: Fix documentation of ea_name termination

The ea_name string is not nul-terminated.  Correct the documentation.

Because the subsequent field is padded to 8 bytes, and the padding is
zeroed, the ea_name string will appear to be nul-terminated whenever the
length isn't exactly one (mod eight).

This was introduced in r167010 (2007).

Additionally, mark the length fields as unsigned.  This particularly
matters for the single byte ea_namelength field, which can represent
extended attribute names up to 255 bytes long.

No functional change.

PR: 216127
Reported by: dewayne at heuristicsystems.com.au
Reviewed by: kib@
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D9206

7 years agosx: reduce lock accesses similarly to r311172
mjg [Wed, 18 Jan 2017 17:55:08 +0000 (17:55 +0000)]
sx: reduce lock accesses similarly to r311172

Discussed with: jhb
Tested by: pho (previous version)

7 years agorwlock: reduce lock accesses similarly to r311172
mjg [Wed, 18 Jan 2017 17:53:57 +0000 (17:53 +0000)]
rwlock: reduce lock accesses similarly to r311172

Discussed with:     jhb
Tested by: pho (previous version)

7 years agoFormat and sort MSG_* flags, to prevent misedits in future. There is no
glebius [Wed, 18 Jan 2017 17:21:28 +0000 (17:21 +0000)]
Format and sort MSG_* flags, to prevent misedits in future.  There is no
functional change.

7 years agoFix regression from r311568: collision of MSG_NOSIGNAL with MSG_MORETOCOME
glebius [Wed, 18 Jan 2017 17:09:22 +0000 (17:09 +0000)]
Fix regression from r311568: collision of MSG_NOSIGNAL with MSG_MORETOCOME
lead to delayed send of data sent with sendto(MSG_NOSIGNAL).

Submitted by: rrs

7 years agoRemove empty ranges property so beri_simplebus can be attached again.
br [Wed, 18 Jan 2017 14:41:59 +0000 (14:41 +0000)]
Remove empty ranges property so beri_simplebus can be attached again.

Sponsored by: DARPA, AFRL

7 years agough, device_t not device_t *
sbruno [Wed, 18 Jan 2017 14:23:43 +0000 (14:23 +0000)]
ugh, device_t not device_t *

Reported by: hps

7 years agoChange device type to unbreak drm-next testing and builds.
sbruno [Wed, 18 Jan 2017 13:57:29 +0000 (13:57 +0000)]
Change device type to unbreak drm-next testing and builds.

Submitted by: Matt Macy <mmacy@nextbsd.org>

7 years agoImplement kernel support for hardware rate limited sockets.
hselasky [Wed, 18 Jan 2017 13:31:17 +0000 (13:31 +0000)]
Implement kernel support for hardware rate limited sockets.

- Add RATELIMIT kernel configuration keyword which must be set to
enable the new functionality.

- Add support for hardware driven, Receive Side Scaling, RSS aware, rate
limited sendqueues and expose the functionality through the already
established SO_MAX_PACING_RATE setsockopt(). The API support rates in
the range from 1 to 4Gbytes/s which are suitable for regular TCP and
UDP streams. The setsockopt(2) manual page has been updated.

- Add rate limit function callback API to "struct ifnet" which supports
the following operations: if_snd_tag_alloc(), if_snd_tag_modify(),
if_snd_tag_query() and if_snd_tag_free().

- Add support to ifconfig to view, set and clear the IFCAP_TXRTLMT
flag, which tells if a network driver supports rate limiting or not.

- This patch also adds support for rate limiting through VLAN and LAGG
intermediate network devices.

- How rate limiting works:

1) The userspace application calls setsockopt() after accepting or
making a new connection to set the rate which is then stored in the
socket structure in the kernel. Later on when packets are transmitted
a check is made in the transmit path for rate changes. A rate change
implies a non-blocking ifp->if_snd_tag_alloc() call will be made to the
destination network interface, which then sets up a custom sendqueue
with the given rate limitation parameter. A "struct m_snd_tag" pointer is
returned which serves as a "snd_tag" hint in the m_pkthdr for the
subsequently transmitted mbufs.

2) When the network driver sees the "m->m_pkthdr.snd_tag" different
from NULL, it will move the packets into a designated rate limited sendqueue
given by the snd_tag pointer. It is up to the individual drivers how the rate
limited traffic will be rate limited.

3) Route changes are detected by the NIC drivers in the ifp->if_transmit()
routine when the ifnet pointer in the incoming snd_tag mismatches the
one of the network interface. The network adapter frees the mbuf and
returns EAGAIN which causes the ip_output() to release and clear the send
tag. Upon next ip_output() a new "snd_tag" will be tried allocated.

4) When the PCB is detached the custom sendqueue will be released by a
non-blocking ifp->if_snd_tag_free() call to the currently bound network
interface.

Reviewed by: wblock (manpages), adrian, gallatin, scottl (network)
Differential Revision: https://reviews.freebsd.org/D3687
Sponsored by: Mellanox Technologies
MFC after: 3 months

7 years agoUse the kernel stack in the ARM FBT DTrace provider. This is used to find
andrew [Wed, 18 Jan 2017 13:27:24 +0000 (13:27 +0000)]
Use the kernel stack in the ARM FBT DTrace provider. This is used to find
the fifth argument to functions being traced, however there was an error
where the userspace stack was being used. This may be invalid leading to
a kernel panic if this address is unmapped.

Submitted by: Graeme Jenkinson <graeme.jenkinson@cl.cam.ac.uk>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9229

7 years agoloader: efi devpath api usage should be more aware of NULL pointers
tsoome [Wed, 18 Jan 2017 08:18:07 +0000 (08:18 +0000)]
loader: efi devpath api usage should be more aware of NULL pointers

As the efi_devpath_last_node() and efi_devpath_trim() can return NULL
pointers, the consumers of this API should check the the NULL pointers.

Same for efinet_dev_init() using calloc().

Reported by: Robert Mustacchi <rm@joyent.com>
Reviewed by: jhb, allanjude
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D9203

7 years agoUse the explicit expanded form of cmp.
jhibbits [Wed, 18 Jan 2017 03:42:21 +0000 (03:42 +0000)]
Use the explicit expanded form of cmp.

Clang apparently requires the explicit form of this instruction, and rejects
uses which ignore the optional cmpD register.  This was the only use of the
shorthand form of the instruction, so just fix it up to match the others.

PR: kern/215681
Submitted by: Mark Millard
Reported by: Mark Millard <markmi _AT_ dsl-only.net>
MFC after: 2 weeks

7 years agocxgbe/tom: Fix a case where do_pass_accept_req wasn't properly restoring
np [Wed, 18 Jan 2017 03:35:42 +0000 (03:35 +0000)]
cxgbe/tom: Fix a case where do_pass_accept_req wasn't properly restoring
the VNET.  This should have been in r311949.

MFC after: 2 days

7 years agoCatch up with changes to structure member names.
ed [Tue, 17 Jan 2017 22:05:52 +0000 (22:05 +0000)]
Catch up with changes to structure member names.

Pointer/length pairs are now always named ${name} and ${name}_len.

7 years agoRegenerate sources based on the system call tables.
ed [Tue, 17 Jan 2017 22:05:01 +0000 (22:05 +0000)]
Regenerate sources based on the system call tables.

7 years agoSync in the latest CloudABI generated source files.
ed [Tue, 17 Jan 2017 22:03:08 +0000 (22:03 +0000)]
Sync in the latest CloudABI generated source files.

Languages like C++17 and Go provide direct support for slice types:
pointer/length pairs. The CloudABI generator now has more complete for
this, meaning that for the C binding, pointer/length pairs now use an
automatic naming scheme of ${name} and ${name}_len.

Apart from this change and some reformatting, the ABI definitions are
identical. Binary compatibility is preserved entirely.

7 years agoDon't compute MPATH during install.
bdrewery [Tue, 17 Jan 2017 21:12:21 +0000 (21:12 +0000)]
Don't compute MPATH during install.

This saves time when building over NFS.  Nothing should be building during
this phase anyhow.

Sponsored by: Dell EMC Isilon

7 years agoRemove writing 'residual' field of struct ctl_scsiio.
mav [Tue, 17 Jan 2017 18:32:47 +0000 (18:32 +0000)]
Remove writing 'residual' field of struct ctl_scsiio.

This field has no practical use and never readed.  Initiators already
receive respective residual size from frontends.  Removed field had
different semantics, which looks useless, and was never passed through
by any frontend.

While there, fix kern_data_resid field support in case of HA, missed in
r312291.

MFC after: 13 days

7 years agoThe write-protect is not wired on uFW, disable it to allow writes to SD
loos [Tue, 17 Jan 2017 18:04:13 +0000 (18:04 +0000)]
The write-protect is not wired on uFW, disable it to allow writes to SD
card.

Sponsored by: Rubicon Communications, LLC (Netgate)

7 years agoSet the the wp_disabled flag when asked to.
loos [Tue, 17 Jan 2017 17:41:14 +0000 (17:41 +0000)]
Set the the wp_disabled flag when asked to.

While here, add the missing new line.

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

7 years agoAdd 4k quirk for Micron 5100 and Intel S3610 SSDs
sbruno [Tue, 17 Jan 2017 14:52:48 +0000 (14:52 +0000)]
Add 4k quirk for Micron 5100 and Intel S3610 SSDs

Submitted by: Jason Wolfe <j@nitrology.com>
MFH: 1 week
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D9209

7 years agoImprove error message on duplicate iSCSI port.
mav [Tue, 17 Jan 2017 14:13:14 +0000 (14:13 +0000)]
Improve error message on duplicate iSCSI port.

MFC after: 2 weeks

7 years agoInitialize IPFW static rules rmlock with RM_RECURSE flag.
ae [Tue, 17 Jan 2017 10:50:28 +0000 (10:50 +0000)]
Initialize IPFW static rules rmlock with RM_RECURSE flag.

This lock was replaced from rwlock in r272840. But unlike rwlock, rmlock
doesn't allow recursion on rm_rlock(), so at this time fix this with
RM_RECURSE flag. Later we need to change ipfw to avoid such recursions.

PR: 216171
Reported by: Eugene Grosbein
MFC after: 1 week

7 years agoAdd USB audio support for S/PDIF output with C-Media CM6206 devices.
hselasky [Tue, 17 Jan 2017 08:15:10 +0000 (08:15 +0000)]
Add USB audio support for S/PDIF output with C-Media CM6206 devices.

Submitted by: Julien Nadeau <vedge@hypertriton.com>
PR: 216131
MFC after: 1 week

7 years agoMFV r312333: zlib 1.2.11.
delphij [Tue, 17 Jan 2017 05:55:47 +0000 (05:55 +0000)]
MFV r312333: zlib 1.2.11.

MFC after: 1 month

7 years agoUse SRCTOP where possible and use :H to manipulate .CURDIR to get rid of
ngie [Tue, 17 Jan 2017 03:58:37 +0000 (03:58 +0000)]
Use SRCTOP where possible and use :H to manipulate .CURDIR to get rid of
unnecessarily long relative path .PATH values with make

MFC after: 1 days
Sponsored by: Dell EMC Isilon

7 years agoFix regression from r310655, which broke operation of bsnmpd if it is bound
glebius [Tue, 17 Jan 2017 03:52:57 +0000 (03:52 +0000)]
Fix regression from r310655, which broke operation of bsnmpd if it is bound
to a non-wildcard address.  As documented in ip(4), doing sendmsg(2) with
IP_SENDSRCADDR on a socket that is bound to non-wildcard address is
completely different to using this control message on a wildcard one.

A fix is to add a bool to mark whether we did setsockopt(IP_RECVDSTADDR)
on the socket, and use IP_SENDSRCADDR control message only if we did.

While here, garbage collect absolutely useless udp_recv() function that
establishes some structures on stack to never use them later.

7 years agoAdd smilint target to subdir targets so "make smilint" here will run
ngie [Tue, 17 Jan 2017 03:44:45 +0000 (03:44 +0000)]
Add smilint target to subdir targets so "make smilint" here will run
the smilint target in subdirs

While here, convert a path that's .CURDIR relative to SRCTOP

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoRemove ad hoc smilint targets made standard in bsd.snmpmod.mk in r312328
ngie [Tue, 17 Jan 2017 03:41:23 +0000 (03:41 +0000)]
Remove ad hoc smilint targets made standard in bsd.snmpmod.mk in r312328

MFC after: 1 week
X-MFC with: r312328
Sponsored by: Dell EMC Isilon

7 years agoAdd a make target (smilint) for running smilint tool against BMIBS
ngie [Tue, 17 Jan 2017 03:38:49 +0000 (03:38 +0000)]
Add a make target (smilint) for running smilint tool against BMIBS

Running smilint against MIB definitions is useful in finding
functional problems with MIB definitions/descriptions.

This is inspired by the smilint targets defined in
usr.sbin/bsnmpd/modules/{snmp_hostres,snmp_mibII}/Makefile

Document all of the variables that are involved in running the
smilint target, as well as all of the prerequisites to running
it.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9099

7 years agoAdd sys/dev/rtwn/rtl8821a/usb/r21au_dfs.c into sys/conf/files
avos [Tue, 17 Jan 2017 00:48:02 +0000 (00:48 +0000)]
Add sys/dev/rtwn/rtl8821a/usb/r21au_dfs.c into sys/conf/files

Reported by: adrian

7 years ago[zynq] Fix panic on USB PHY initialization failure
gonzo [Tue, 17 Jan 2017 00:39:09 +0000 (00:39 +0000)]
[zynq] Fix panic on USB PHY initialization failure

The Zedboard has a hardware bug where initialization of the USB PHY
occasionally fails on boot-up. Fix regression in -CURRENT when
kernel panics on such occasion. 11-RELEASE branch works fine

PR: 215862
Submitted by: Thomas Skibo <thoma555-bsd@yahoo.com>

7 years agortwn: export more stats to net80211
avos [Tue, 17 Jan 2017 00:35:23 +0000 (00:35 +0000)]
rtwn: export more stats to net80211

Setup more ieee80211_rx_stats fields for received frames:
 - pktflags:
  * IEEE80211_RX_F_FAIL_FCSCRC;
  * IEEE80211_RX_F_AMPDU;
  * IEEE80211_RX_F_AMPDU_MORE;
  * IEEE80211_RX_F_SHORTGI;
 - rate flags (CCK, OFDM, HT);
 - width;
 - phytype;
 - rate;
 - rx_tsf;
 - rssi;
 - nf;
 - ieee, freq (RTL8188EU only, when ht40 support is disabled).

Tested with:
 - RTL8188CE, RTL8188EU, RTL8821AU (STA / AP modes, i386)
 - (by kevlo) RTL8188EU and RTL8812AU (amd64)

Reviewed by: adrian (previous version), kevlo
Differential Revision: https://reviews.freebsd.org/D9021

7 years agoloader: move device path definitions to include/efidevp.h
tsoome [Mon, 16 Jan 2017 20:57:01 +0000 (20:57 +0000)]
loader: move device path definitions to include/efidevp.h

No functional change, only moving uuid and protocol bits to include/efidevp.h

Reviewed by: imp, jhb
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D9192

7 years agodisambiguate msleep KASSERT diagnostics
emaste [Mon, 16 Jan 2017 20:34:42 +0000 (20:34 +0000)]
disambiguate msleep KASSERT diagnostics

Previously "panic: msleep" could happen for a few different reasons.
Break the KASSERTs out into individual cases to identify the failing
condition. Found during the investigation that resulted in r308288.

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

7 years agoImprove some of the sysctl descriptions added in r299827.
markj [Mon, 16 Jan 2017 19:35:19 +0000 (19:35 +0000)]
Improve some of the sysctl descriptions added in r299827.

Submitted by: Marie Helene Kvello-Aune <marieheleneka@gmail.com>
(original version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D5336

7 years agoRemove Assert that seems to be hit in various configurations during
sbruno [Mon, 16 Jan 2017 19:01:41 +0000 (19:01 +0000)]
Remove Assert that seems to be hit in various configurations during
normal operations.

7 years agoAdd a new socket option SO_TS_CLOCK to pick from several different clock
sobomax [Mon, 16 Jan 2017 17:46:38 +0000 (17:46 +0000)]
Add a new socket option SO_TS_CLOCK to pick from several different clock
sources to return timestamps when SO_TIMESTAMP is enabled. Two additional
clock sources are:

o nanosecond resolution realtime clock (equivalent of CLOCK_REALTIME);
o nanosecond resolution monotonic clock (equivalent of CLOCK_MONOTONIC).

In addition to this, this option provides unified interface to get bintime
(equivalent of using SO_BINTIME), except it also supported with IPv6 where
SO_BINTIME has never been supported. The long term plan is to depreciate
SO_BINTIME and move everything to using SO_TS_CLOCK.

Idea for this enhancement has been briefly discussed on the Net session
during dev summit in Ottawa last June and the general input was positive.

This change is believed to benefit network benchmarks/profiling as well
as other scenarios where precise time of arrival measurement is necessary.

There are two regression test cases as part of this commit: one extends unix
domain test code (unix_cmsg) to test new SCM_XXX types and another one
implementis totally new test case which exchanges UDP packets between two
processes using both conventional methods (i.e. calling clock_gettime(2)
before recv(2) and after send(2)), as well as using setsockopt()+recv() in
receive path. The resulting delays are checked for sanity for all supported
clock types.

Reviewed by:    adrian, gnn
Differential Revision:  https://reviews.freebsd.org/D9171

7 years agoChange startup order for the no EARLY_AP_STARTUP case to initialize
sbruno [Mon, 16 Jan 2017 16:58:12 +0000 (16:58 +0000)]
Change startup order for the no EARLY_AP_STARTUP case to initialize
gtaskqueue bits at SI_SUB_INIT_IF instead of waiting until SI_SUB_SMP
which is far too late.

Add an assertion in taskqgroup_attach() to catch startup initialization
failures in the future.

Reported by: kib bde

7 years agoRemove arm's cpuconf.h, and references to it, after moving a few lines from
ian [Mon, 16 Jan 2017 16:44:13 +0000 (16:44 +0000)]
Remove arm's cpuconf.h, and references to it, after moving a few lines from
it into pmap-v4.h where they are used.  Other than those few lines of
support for different MMU types, nothing in cpuconf.h has been used in our
code for quite a while.

The file existed to set up a variety of symbols to describe the
architecture.  Over the past few years we have converted all of our source
to use the new architecture symbols standardized by ARM Inc, and predefined
by both clang and gcc.

PR: 216104

7 years agoMake CTL frontends report kern_data_resid for under-/overruns.
mav [Mon, 16 Jan 2017 16:19:55 +0000 (16:19 +0000)]
Make CTL frontends report kern_data_resid for under-/overruns.

It seems like kern_data_resid was never really implemented.  This change
finally does it.  Now frontends update this field while transferring data,
while CTL/backends getting it can more flexibly handle the result.
At this point behavior should not change significantly, still reporting
errors on write overrun, but that may be changed later, if we decide so.

CAM target frontend still does not properly handle overruns due to CAM API
limitations.  We may need to add some fields to struct ccb_accept_tio to
pass information about initiator requested transfer size(s).

MFC after: 2 weeks

7 years ago[gpioths] new driver for temperature/humidity sensor DHT11
mizhka [Mon, 16 Jan 2017 15:36:36 +0000 (15:36 +0000)]
[gpioths] new driver for temperature/humidity sensor DHT11

This patch adds driver for temperature/humidity sensor connected via GPIO.
To compile it into kernel add "device gpioths". To activate driver, use
hints (.at and .pins) for gpiobus. As result it will provide temperature &
humidity values via sysctl.

DHT11 is cheap & popular temperature/humidity sensor used via GPIO on ARM
or MIPS devices like Raspberry Pi or Onion Omega.

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

7 years ago[spibus] small code refactoring
mizhka [Mon, 16 Jan 2017 15:23:55 +0000 (15:23 +0000)]
[spibus] small code refactoring

Merge 3 sequential printf calls into one.

Reported by: rpokala
Reviewed by: rpokala, adrian
Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D8795

7 years agortld: do not rely on a populated GOT on amd64
emaste [Mon, 16 Jan 2017 14:49:29 +0000 (14:49 +0000)]
rtld: do not rely on a populated GOT on amd64

On rela architectures GNU BFD ld and gold store the relocation addend
in GOT entries (in addition to the relocation's r_addend field).
rtld previously relied on this to access its own _DYNAMIC symbol in
order to apply its own relocations.

However, recording addends in the GOT is not specified by the ABI,
and some versions of LLVM's LLD linker leave the GOT uninitialized on
rela architectures.

BFD ld does not populate the GOT on sparc64, and sparc64 rtld has a
machine-dependent rtld_dynamic_addr() function that returns the
_DYNAMIC address. Use the same approach on amd64, obtaining the %rip-
relative _DYNAMIC address following a suggestion from Rafael EspĂ­ndola.

Architectures other than amd64 should be addressed in future work.

PR: 214972
Reviewed by: kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D9180

7 years agoAdd kevent EVFILT_EMPTY for notification when a client has received all data
hiren [Mon, 16 Jan 2017 08:25:33 +0000 (08:25 +0000)]
Add kevent EVFILT_EMPTY for notification when a client has received all data
i.e. everything outstanding has been acked.

Reviewed by: bz, gnn (previous version)
MFC after: 3 days
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D9150

7 years agoRemove a bit of armv6 support that didn't get deleted when this file was
ian [Mon, 16 Jan 2017 03:11:30 +0000 (03:11 +0000)]
Remove a bit of armv6 support that didn't get deleted when this file was
split from trap.c into trap-v4.c and trap-v6.c.

7 years agoalc: Add Killer E2500 support
sephe [Mon, 16 Jan 2017 03:03:47 +0000 (03:03 +0000)]
alc: Add Killer E2500 support

Reviewed by: jhb, yongari
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D9058

7 years agoloader.efi: find_currdev() can leak memory
tsoome [Sun, 15 Jan 2017 20:03:13 +0000 (20:03 +0000)]
loader.efi: find_currdev() can leak memory

The find_currdev() is using variable "copy" to store the reference to trimmed
devpath pointer, if for some reason the efi_devpath_handle() fails, we will
leak this copy.

Also we can simplify the code there a bit.

Reviewed by: allanjude
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D9191

7 years ago[net80211] add some more "is this XXX" macros for CTRL and DATA.
adrian [Sun, 15 Jan 2017 19:49:47 +0000 (19:49 +0000)]
[net80211] add some more "is this XXX" macros for CTRL and DATA.

There's already a macro for MGT.

7 years agoFix a variety of cosmetic typos and misspellings
cem [Sun, 15 Jan 2017 18:00:45 +0000 (18:00 +0000)]
Fix a variety of cosmetic typos and misspellings

No functional change.

PR: 216096, 216097, 216098, 216101, 216102, 216106, 216109, 216110
Reported by: Bulat <bltsrc at mail.ru>
Sponsored by: Dell EMC Isilon

7 years ago"Buses" is the preferred plural of "bus"
cem [Sun, 15 Jan 2017 17:54:01 +0000 (17:54 +0000)]
"Buses" is the preferred plural of "bus"

Replace archaic "busses" with modern form "buses."

Intentionally excluded:
* Old/random drivers I didn't recognize
  * Old hardware in general
* Use of "busses" in code as identifiers

No functional change.

http://grammarist.com/spelling/buses-busses/

PR: 216099
Reported by: bltsrc at mail.ru
Sponsored by: Dell EMC Isilon

7 years agoAdd under-/overrun support to IOCTL and CAM SIM frontends.
mav [Sun, 15 Jan 2017 13:57:42 +0000 (13:57 +0000)]
Add under-/overrun support to IOCTL and CAM SIM frontends.

MFC after: 1 week

7 years agoWhen in kernel, map ctl_scsi_zero_io() to ctl_zero_io().
mav [Sun, 15 Jan 2017 13:51:44 +0000 (13:51 +0000)]
When in kernel, map ctl_scsi_zero_io() to ctl_zero_io().

MFC after: 1 week

7 years agoskel: Do not set -o emacs in .shrc.
jilles [Sun, 15 Jan 2017 13:40:14 +0000 (13:40 +0000)]
skel: Do not set -o emacs in .shrc.

sh has defaulted to 'set -o emacs' since FreeBSD 9.0. Therefore, do not set
this again in .shrc, since that only serves to prevent invocations like
'sh -o vi' and 'sh +o emacs' to have the intended effect.

PR: 215958
Submitted by: Andras Farkas
MFC after: 1 week

7 years agoMake `camcontrol cmd ... -i ...` return only valid bytes.
mav [Sun, 15 Jan 2017 12:24:23 +0000 (12:24 +0000)]
Make `camcontrol cmd ... -i ...` return only valid bytes.

Previously code ignored resid field and returned extra zeroes in case of
data underflow.  Now it returns only real bytes received from target.

MFC after: 2 weeks

7 years agoFix typo in r312216
ngie [Sun, 15 Jan 2017 10:29:53 +0000 (10:29 +0000)]
Fix typo in r312216

I meant to replace "exp" with "exponent", not "expected"

MFC after: 13 days
Pointyhat to: ngie
Submitted by: bde

7 years agoarswitch: Ensure the lock is always held when calling arswitch_modifyreg()
kp [Sun, 15 Jan 2017 10:21:25 +0000 (10:21 +0000)]
arswitch: Ensure the lock is always held when calling arswitch_modifyreg()

arswitch_setled() and a number of _global_setup functions did not acquire the
lock before calling arswitch_modifyreg(). With WITNESS enabled this would
instantly panic.

Discovered on a TPLink-3600:
("panic: mutex arswitch not owned at sys/dev/etherswitch/arswitch/arswitch_reg.c:236")

Reviewed by: adrian, kan
Differential Revision: https://reviews.freebsd.org/D9187

7 years agoRevert r312119 and reword the intent to fix -Wshadow issues
ngie [Sun, 15 Jan 2017 09:25:33 +0000 (09:25 +0000)]
Revert r312119 and reword the intent to fix -Wshadow issues
between exp(3) and `exp` var.

The approach taken previously was not ideal for multiple
functional and stylistic reasons.

Add to existing sed call in Makefile to replace `exp` with
`exponent` instead.

MFC after: 13 days
Requested by: bde

7 years agoMark testcases which use cap_enter as expected failures until the
ngie [Sun, 15 Jan 2017 09:13:41 +0000 (09:13 +0000)]
Mark testcases which use cap_enter as expected failures until the
PR is resolved so those of us that run the tests don't have the
bogus failures counted against our overall results

PR: 215690

7 years agoEnable IPv6 networking on Amazon EC2.
cperciva [Sun, 15 Jan 2017 09:06:45 +0000 (09:06 +0000)]
Enable IPv6 networking on Amazon EC2.

MFC after: 1 week

7 years agoTurn COMPILER_VERSION/COMPILER_TYPE make check into a compile-time check
ngie [Sun, 15 Jan 2017 09:05:26 +0000 (09:05 +0000)]
Turn COMPILER_VERSION/COMPILER_TYPE make check into a compile-time check
of the clang version

This works around breakage on ^/stable/10 when running installworld from
a ^/stable/10 host where the test wouldn't be compiled on the first
go-around and would be missing when make installworld is run.

MFC after: 1 week
PR: 208703
Reported by: emaste
Sponsored by: Dell EMC Isilon

7 years agoFix a minor typo (Seiral)
cem [Sun, 15 Jan 2017 08:05:00 +0000 (08:05 +0000)]
Fix a minor typo (Seiral)

PR: 216095
Reported by: <bltsrc at mail.ru>

7 years ago[ar71xx] add EARLY_PRINTF support for the rest of the non-AR933x SoCs.
adrian [Sun, 15 Jan 2017 06:35:00 +0000 (06:35 +0000)]
[ar71xx] add EARLY_PRINTF support for the rest of the non-AR933x SoCs.

Tested:

* AR934x SoC

7 years agoSuppress a warning about m_assertbuf being unused.
markj [Sun, 15 Jan 2017 03:53:20 +0000 (03:53 +0000)]
Suppress a warning about m_assertbuf being unused.

MFC after: 1 week

7 years agoAvoid unnecessary page lookups in vm_object_madvise().
markj [Sun, 15 Jan 2017 03:50:08 +0000 (03:50 +0000)]
Avoid unnecessary page lookups in vm_object_madvise().

vm_object_madvise() is frequently used to apply advice to a contiguous
set of pages in an object with no backing object. Optimize this case by
skipping non-resident subranges in constant time, and by iterating over
resident pages using the object memq, thus avoiding radix tree lookups on
each page index in the specified range.

While here, move MADV_WILLNEED handling to vm_page_advise(), and rename the
"advise" parameter to vm_object_madvise() to "advice."

Reviewed by: alc, kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D9098

7 years agoFix hangs in a uniprocessor configuration (qemu, virtualbox, real hw).
sbruno [Sun, 15 Jan 2017 00:50:10 +0000 (00:50 +0000)]
Fix hangs in a uniprocessor configuration (qemu, virtualbox, real hw).

sys/net/iflib.c:
  Add ctx to filter_info and don't skpi interrupt early on unless we're on an
  SMP system

sys/kern/subr_gtaskqueue.c:
  Skip smp check if we're running UP

Submitted by: Matt Macy <mmacy@nextbsd.org>
Reported by: emaste bde

7 years ago[etherswitch] Support Micrel KSZ8995MA switch chip
mizhka [Sat, 14 Jan 2017 23:24:50 +0000 (23:24 +0000)]
[etherswitch] Support Micrel KSZ8995MA switch chip

This is Micrel KSZ8995MA driver code. KSZ8995MA uses SPI bus to control.
This code is written & tested on @SRCHACK's ksz8995ma board and FON2100
with gpiospi.
etherswitchcfg support commands: addtag, ingress, striptag, dropuntagged.

Submitted by: Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by: mizhka, adrian
Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D8790

7 years ago[mips/onionomega] WiFi & gpio kernel configuration bits
mizhka [Sat, 14 Jan 2017 22:56:20 +0000 (22:56 +0000)]
[mips/onionomega] WiFi & gpio kernel configuration bits

This patch adds missing hints for ath0 (eepromaddr) and GPIO (mask & leds).
ath0 doesn't work without eeprom hints, so this commit should make wifi
works on Onion Omega.

GPIO mask is required if you want to use gpiobus and GPIO pins on your
board. Onion Omega has several leds connected to gpio pins (one on board,
one color on dock).
This commit adds mask for gpiobus and allow you to turn off/on leds via
/dev/leds/{board,blue,green,red} (on by default).

Tested on Onion Omega 1.

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

7 years agoStop the scheduler upon panic even in non-SMP kernels.
markj [Sat, 14 Jan 2017 22:16:03 +0000 (22:16 +0000)]
Stop the scheduler upon panic even in non-SMP kernels.

This is needed for kernel dumps to work, as the panicking thread will call
into code that makes use of kernel locks.

Reported and tested by: Eugene Grosbein
MFC after: 1 week

7 years agoRevert r311952.
markj [Sat, 14 Jan 2017 22:06:25 +0000 (22:06 +0000)]
Revert r311952.

It broke DDB type-ahead since it caused db_check_interrupt() to drop
unrecognized characters.

Reported by: bde

7 years agoAlike to r312190 decouple iSCSI connection limits from defaults.
mav [Sat, 14 Jan 2017 20:41:44 +0000 (20:41 +0000)]
Alike to r312190 decouple iSCSI connection limits from defaults.

Connection parameters should remain at defaults until negotiated.

While there, remove sythetic limits, applied if kernel provided none.
iscsid has no own limitations, no configuration and no any idea what
values are good.  Assume kernel knows what it requests.

7 years agoAdd include Makefiles for tests/sys/{fs,kern,kqueue,mac}/...
ngie [Sat, 14 Jan 2017 20:29:26 +0000 (20:29 +0000)]
Add include Makefiles for tests/sys/{fs,kern,kqueue,mac}/...

The primary goal for doing this is to leverage the work done in r312114
for enabling WARNS to address trivial code quality issues with new tests

MFC after: 6 days
Tested with: make tinderbox
Sponsored by: Dell EMC Isilon

7 years agoAdd include Makefiles for tests/sys/{fs,kern,kqueue,mac}/...
ngie [Sat, 14 Jan 2017 20:21:21 +0000 (20:21 +0000)]
Add include Makefiles for tests/sys/{fs,kern,kqueue,mac}/...

The primary goal for doing this is to leverage the work done in r312114
for enabling WARNS to address trivial code quality issues with new tests

MFC after: 6 days
Tested with: make tinderbox
Sponsored by: Dell EMC Isilon

7 years agoFix wrong way assignment in r312190.
mav [Sat, 14 Jan 2017 19:58:51 +0000 (19:58 +0000)]
Fix wrong way assignment in r312190.

7 years agoAdd comment explaining relative order of sched_unpin() and mtx_unlock().
jah [Sat, 14 Jan 2017 19:35:36 +0000 (19:35 +0000)]
Add comment explaining relative order of sched_unpin() and mtx_unlock().

Suggested by: alc
MFC after: 1 week

7 years agoDecouple iSCSI connection limits from defaults.
mav [Sat, 14 Jan 2017 18:04:12 +0000 (18:04 +0000)]
Decouple iSCSI connection limits from defaults.

If initiator does not negotiate some parameter, it expects one to get
default value, not some unknown remote hardware limit.  On the side side,
if some parameter is negotiated, its default value from RFC should not
be used for anything.

7 years agoRemove CFLAGS for sha2_test
ngie [Sat, 14 Jan 2017 12:55:32 +0000 (12:55 +0000)]
Remove CFLAGS for sha2_test

The previous code used to grab definitions from these openssl/openssh,
but this is no longer needed and is no longer correct. libnetbsd
provides all of the needed definitions

libnetbsd is added to CFLAGS automatically via netbsd-tests.test.mk --
hence all of CFLAGS can be cleared

7 years agoFix -Wformat issue
ngie [Sat, 14 Jan 2017 10:38:39 +0000 (10:38 +0000)]
Fix -Wformat issue

Use %zu for printing out results from nitems, as it's size_t based

MFC after: 1 week
X-MFC with: r312120
Reported by: gcc (mips:mipsel tinderbox)
Sponsored by: Dell EMC Isilon

7 years agoFix up r312105
ngie [Sat, 14 Jan 2017 10:20:38 +0000 (10:20 +0000)]
Fix up r312105

- Only #include tcpd.h when LIBWRAP is true to avoid header include errors
- Only define whichaf when LIBWRAP is true to avoid -Wunused warning and
  to avoid issues with structs being defined that should only be defined
  when tcpd.h is included.

MFC after: 2 weeks
X-MFC with: r312105
Pointyhat to: ngie
Reported by: gcc tinderbox
Sponsored by: Dell EMC Isilon

7 years agoRevert t_pow@r312154
ngie [Sat, 14 Jan 2017 10:10:49 +0000 (10:10 +0000)]
Revert t_pow@r312154

This hunk hasn't been accepted yet

7 years agoFix the build using hunks pending upstream contributions
ngie [Sat, 14 Jan 2017 10:08:22 +0000 (10:08 +0000)]
Fix the build using hunks pending upstream contributions

7 years agoDiff reduce with upstream post-accepted contributions
ngie [Sat, 14 Jan 2017 10:05:26 +0000 (10:05 +0000)]
Diff reduce with upstream post-accepted contributions

7 years agoFor i386 temporary mappings, unpin the thread before releasing
jah [Sat, 14 Jan 2017 09:56:01 +0000 (09:56 +0000)]
For i386 temporary mappings, unpin the thread before releasing
the cmap lock.  Releasing the lock first may result in the thread
being immediately rescheduled and bound to the same CPU, only to
unpin itself upon resuming execution.

Noted by: skra (in review for armv6 equivalent)
MFC after: 1 week

7 years agoOne more sys/types.h kevent clarification missed in r312151
ngie [Sat, 14 Jan 2017 09:47:06 +0000 (09:47 +0000)]
One more sys/types.h kevent clarification missed in r312151

7 years agoClarify why sys/types.h #include is needed on FreeBSD
ngie [Sat, 14 Jan 2017 09:45:46 +0000 (09:45 +0000)]
Clarify why sys/types.h #include is needed on FreeBSD

7 years agoUse cleanup routines to remove POSIX semaphores instead of just blindly
ngie [Sat, 14 Jan 2017 09:42:06 +0000 (09:42 +0000)]
Use cleanup routines to remove POSIX semaphores instead of just blindly
unlinking them at the beginning of the testcase

This is a lot more intelligent in cleaning up the semaphores if the testcase
fails before sem_unlink is called.

Contributed back as bin/51872 upstream.

7 years agoDiff reduce with upstream by taking diff hunks that were contributed back
ngie [Sat, 14 Jan 2017 09:38:40 +0000 (09:38 +0000)]
Diff reduce with upstream by taking diff hunks that were contributed back