freebsd.git
7 years agoSort declaration of sem_clockwait_np
vangyzen [Tue, 28 Feb 2017 21:47:00 +0000 (21:47 +0000)]
Sort declaration of sem_clockwait_np

Also mention <time.h> in sem_timedwait(3), because POSIX does,
and because the user will need it for clockid_t, struct timespec,
and TIMER_ABSTIME.

Reported by: bde
MFC after: 9 days
X-MFC with: r314179
Sponsored by: Dell EMC

7 years agoFix arge0 mdio bus
imp [Tue, 28 Feb 2017 21:39:08 +0000 (21:39 +0000)]
Fix arge0 mdio bus

This makes arge0 phy's attach.

Submitted by: Michael Vale <m.vale@live.com.au>
Pull Request: https://github.com/freebsd/freebsd/pull/16

7 years agoUpdate PICOSTATION_M2HP
imp [Tue, 28 Feb 2017 21:39:00 +0000 (21:39 +0000)]
Update PICOSTATION_M2HP

Make the random number generator work so we can do WPA encryption on the AP's.

Submitted by: Michael Vale <m.vale@live.com.au>
Pull Request: https://github.com/freebsd/freebsd/pull/16

7 years agoMerge ^/head r314270 through r314419.
dim [Tue, 28 Feb 2017 21:30:26 +0000 (21:30 +0000)]
Merge ^/head r314270 through r314419.

7 years agoProvide a comment on why stdio.h needs to be included.
scottl [Tue, 28 Feb 2017 21:27:51 +0000 (21:27 +0000)]
Provide a comment on why stdio.h needs to be included.

7 years agoInclude stdio.h to fix libsbuf build.
jkim [Tue, 28 Feb 2017 21:18:45 +0000 (21:18 +0000)]
Include stdio.h to fix libsbuf build.

Reviewed by: scottl

7 years agoMerge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
dim [Tue, 28 Feb 2017 21:18:23 +0000 (21:18 +0000)]
Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r296509, and update build glue.

7 years agoThe kern.geom.part.auto_resize should be tunable.
oshogbo [Tue, 28 Feb 2017 20:51:20 +0000 (20:51 +0000)]
The kern.geom.part.auto_resize should be tunable.

7 years agodc(1): Introduce e command, equivalent to p, but writes to stderr
pfg [Tue, 28 Feb 2017 20:50:49 +0000 (20:50 +0000)]
dc(1): Introduce e command, equivalent to p, but writes to stderr

Obtained from: OpenBSD
MFC after: 2 weeks

7 years agoFix include/arpa/nameser_compat.h by adding T_DNAME definition.
imp [Tue, 28 Feb 2017 20:34:25 +0000 (20:34 +0000)]
Fix include/arpa/nameser_compat.h by adding T_DNAME definition.
Fixes Apache trafficserver

Submitted by: John J. Rushford <https://github.com/jrushford>
Pull Request: https://github.com/freebsd/freebsd/pull/104

7 years agoAdd support for Vodafone/Huawei K3771.
imp [Tue, 28 Feb 2017 20:25:45 +0000 (20:25 +0000)]
Add support for Vodafone/Huawei K3771.
See also http://www.draisberghof.de/usb_modeswitch/device_reference.txt

Submitted by: Dean Hamstead <https://github.com/djzort>
Pull Request: https://github.com/freebsd/freebsd/pull/76

7 years agoLinux epoll return EEXIST on case when op is EPOLL_CTL_ADD, and the supplied
dchagin [Tue, 28 Feb 2017 19:55:16 +0000 (19:55 +0000)]
Linux epoll return EEXIST on case when op is EPOLL_CTL_ADD, and the supplied
file descriptor fd is already registered with this epoll instance.

MFC after: 1 month

7 years agoLinux epoll return ENOENT error in case when op is EPOLL_CTL_MOD or
dchagin [Tue, 28 Feb 2017 19:54:22 +0000 (19:54 +0000)]
Linux epoll return ENOENT error in case when op is EPOLL_CTL_MOD or
EPOLL_CTL_DEL, and fd is not registered with this epoll instance.

MFC after: 1 month

7 years agoFreeBSD does not have analgue for epill EPOLLPRI event type.
dchagin [Tue, 28 Feb 2017 19:49:21 +0000 (19:49 +0000)]
FreeBSD does not have analgue for epill EPOLLPRI event type.
So, do not set EPOLLPRI event acidently.
Also, do not set EPOLLWRNORM and EPOLLRDNORM events as epoll
do not set this events.

MFC after: 1 month

7 years agoDon't remove ofwdump.8 on FreeBSD/mips.
jhb [Tue, 28 Feb 2017 19:32:45 +0000 (19:32 +0000)]
Don't remove ofwdump.8 on FreeBSD/mips.

FreeBSD/mips has installed ofwdump by default since r288232.

Sponsored by: DARPA / AFRL

7 years agocxgbe/iw_cxgbe: fix various double-close panics with iWARP sockets.
np [Tue, 28 Feb 2017 19:27:41 +0000 (19:27 +0000)]
cxgbe/iw_cxgbe: fix various double-close panics with iWARP sockets.

Sockets representing the TCP endpoints for iWARP connections are
allocated by the ibcore module.  Before this revision they were closed
either by the ibcore module or the iw_cxgbe hardware driver depending on
the state transitions during connection teardown.  This is error prone
and there were cases where both iw_cxgbe and ibcore closed the socket
leading to double-free panics.  The fix is to let ibcore close the
sockets it creates and never do it in the driver.

- Use sodisconnect instead of soclose (preceded by solinger = 0) in the
  driver to tear down an RDMA connection abruptly.  This does what's
  intended without releasing the socket's fd reference.

- Close the socket in ibcore when the iWARP iw_cm_id is destroyed.  This
  works for all kinds of sockets: clients that initiate connections,
  listeners, and sockets accepted off of listeners.

Reviewed by: Steve Wise @ Open Grid Computing, hselasky@
MFC after: 3 days
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D9796

7 years agoAdd prototype for sbuf_putbuf()
scottl [Tue, 28 Feb 2017 19:01:59 +0000 (19:01 +0000)]
Add prototype for sbuf_putbuf()

Sponsored by: Netflix

7 years agoLocal APIC: add support for extended LVT entries found in AMD processors
avg [Tue, 28 Feb 2017 18:48:12 +0000 (18:48 +0000)]
Local APIC: add support for extended LVT entries found in AMD processors

The extended LVT entries can be used to configure interrupt delivery
for various events that are internal to a processor and can use this
feature.

All current processors that support the feature have four of such entries.
The entries are all masked upon the processor reset, but it's possible
that firmware may use some of them.

BIOS and Kernel Developer's Guides for some processor models do not assign
any particular names to the extended LVTs, while other BKDGs provide names
and suggested usage for them.
However, there is no fixed mapping between the LVTs and the processor
events in any processor model that supports the feature.  Any entry can be
assigned to any event.  The assignment is done by programming an offset
of an entry into configuration bits corresponding to an event.

This change does not expose the flexibility that the feature offers.
The change adds just a single method to configure a hardcoded extended LVT
entry to deliver APIC_CMC_INT.  The method is designed to be used with
Machine Check Error Thresholding mechanism on supported processor models.

For references please see BKDGs for families 10h - 16h and specifically
descriptions of APIC30, APIC400, APIC[530:500] registers.
For a description of the Error Thresholding mechanism see, for example,
BKDG for family 10h, section 2.12.1.6.
http://developer.amd.com/resources/developer-guides-manuals/

Thanks to jhb and kib for their suggestions.

Reviewed by: kib
Discussed with: jhb
MFC after: 5 weeks
Relnotes: maybe
Differential Revision: https://reviews.freebsd.org/D9612

7 years agoImplement sbuf_prf(), which takes an sbuf and outputs it
scottl [Tue, 28 Feb 2017 18:25:06 +0000 (18:25 +0000)]
Implement sbuf_prf(), which takes an sbuf and outputs it
to stdout in the non-kernel case and to the console+log
in the kernel case.  For the kernel case it hooks the
putbuf() machinery underneath printf(9) so that the buffer
is written completely atomically and without a copy into
another temporary buffer.  This is useful for fixing
compound console/log messages that become broken and
interleaved when multiple threads are competing for the
console.

Reviewed by: ken, imp
Sponsored by: Netflix

7 years agoProperly indent a default: label and avoid crashing when running
bz [Tue, 28 Feb 2017 18:10:03 +0000 (18:10 +0000)]
Properly indent a default: label and avoid crashing when running
under -v but cannot connect due to trying to print an int as %s [1].

Reported by: andrew [1]
MFC after: 3 days

7 years agoAdd SOC_ALTERA_* kernel options per each SoC and use it to
br [Tue, 28 Feb 2017 16:20:33 +0000 (16:20 +0000)]
Add SOC_ALTERA_* kernel options per each SoC and use it to
conditionally compile the code.

Reviewed by: andrew
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9836

7 years agoallwinner: A31: Add ccung driver
manu [Tue, 28 Feb 2017 15:44:21 +0000 (15:44 +0000)]
allwinner: A31: Add ccung driver

This adds clocks support for the aw_ccung on the A31 SoC.
Newer DTS files require this.
All the clocks except two CSI are defined and exported on the clock domain.

7 years agoallwinner: nkmp: Add MUX capability
manu [Tue, 28 Feb 2017 15:11:33 +0000 (15:11 +0000)]
allwinner: nkmp: Add MUX capability

Some NKMP clocks have a mux options.
Add the capability to aw_clk_nkmp.

7 years agoAdd compatible string.
br [Tue, 28 Feb 2017 14:42:57 +0000 (14:42 +0000)]
Add compatible string.

This restores USB attaching on SOCKIT board after reusing
standard DTS files.

Sponsored by: DARPA, AFRL

7 years agoAdd support for Intel Arria 10 SoC Development Kit.
br [Tue, 28 Feb 2017 14:02:16 +0000 (14:02 +0000)]
Add support for Intel Arria 10 SoC Development Kit.
Use standard DTS files for SOCKIT and SOCDK.

Sponsored by: DARPA, AFRL

7 years agoMake ctl_queue_sense() not sleep.
mav [Tue, 28 Feb 2017 11:56:17 +0000 (11:56 +0000)]
Make ctl_queue_sense() not sleep.

It may be called in non-sleepable frontend context.

MFC after: 2 weeks

7 years agoallwinner: NKMP clock: add update bit
manu [Tue, 28 Feb 2017 11:38:11 +0000 (11:38 +0000)]
allwinner: NKMP clock: add update bit

The PLL_DDR clock have an update bit which need to be set after changing
the value, add the possibility to define one for NKMP clocks.

This allow us to add the missing clocks.
We now have the full list of clocks created under the clock domain.

7 years agoallwinner: NM clock: Add value for fixed factor.
manu [Tue, 28 Feb 2017 11:05:45 +0000 (11:05 +0000)]
allwinner: NM clock: Add value for fixed factor.

The register func for aw_clk_nm didn't copy the value needed for the fixed
factor, resulting in all fixed factor not working on NM clocks.

7 years agohyperv/hn: Simplify RNDIS packet data offset calculation.
sephe [Tue, 28 Feb 2017 09:50:34 +0000 (09:50 +0000)]
hyperv/hn: Simplify RNDIS packet data offset calculation.

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

7 years agoRemove some locking not needed for modern CAM.
mav [Tue, 28 Feb 2017 05:24:06 +0000 (05:24 +0000)]
Remove some locking not needed for modern CAM.

This driver is full of LORs.  This change allows to reduce deadlock chance
from 100% to level that allows some tests to be done.

MFC after: 2 weeks

7 years agoAdd safety check against too long CDB.
mav [Tue, 28 Feb 2017 05:17:50 +0000 (05:17 +0000)]
Add safety check against too long CDB.

SBP-2 specification defined maximum CDB length as 12 bytes.  Newer SBP-3
specification allows CDB of any size, but this driver is too old.  Proper
solution would be to look on maximal ORB size supported by the target.

MFC after: 1 week

7 years agoRemove SVR4 (System V Release 4) binary compatibility support.
glebius [Tue, 28 Feb 2017 05:14:42 +0000 (05:14 +0000)]
Remove SVR4 (System V Release 4) binary compatibility support.

UNIX System V Release 4 is operating system released in 1988. It ceased
to exist in early 2000-s.

7 years agoUse "build" instead of "all" when building ports modules
ngie [Tue, 28 Feb 2017 04:48:30 +0000 (04:48 +0000)]
Use "build" instead of "all" when building ports modules

"all" in ports currently means "stage the ports", which requires root today,
and brings to light other potential issues, like ENAMETOOLONG with staged
directories (bug 161481, etc).

This fixes buildkernel for me when run as a non-root user, assuming all
of the prerequisites have been installed beforehand and are up-to-date.

MFC after: 1 month
Discussed with: swills (IRC)
Sponsored by: Dell EMC Isilon

7 years agoMake kernel breakpoints work for book-e
jhibbits [Tue, 28 Feb 2017 04:31:28 +0000 (04:31 +0000)]
Make kernel breakpoints work for book-e

Add the necessary bits to enable kernel breakpoints for Book-E.  The entrypoint
for program exception is very trivial, so rather than expand it to be similar to
AIM, add it into the standard trap handler.

This wasn't blocked out as Book-E specific because it is only a minor redundancy
over AIM, which should have already called db_trap_glue() at this point.  If
it's going to panic with a fatal trap anywya, it doesn't matter if it goes
through this path again.

7 years agoUnbreak kernel breakpoints, broken for ~4 years now
jhibbits [Tue, 28 Feb 2017 04:13:20 +0000 (04:13 +0000)]
Unbreak kernel breakpoints, broken for ~4 years now

When committing DTrace in 2012/2013 era I inadvertently broke breakpoints, by
setting EXC_DTRACE to the same value as BKPT_INST.  Change EXC_DTRACE to a
different, yet logically identical, trap (tw <all>,31,31).

MFC after: 2 weeks

7 years agobnxt: propagate RSS hash type to the network stack.
shurd [Tue, 28 Feb 2017 02:27:51 +0000 (02:27 +0000)]
bnxt: propagate RSS hash type to the network stack.

RSS hash type will be used to identify the CPU on to which, a receive packet
will be queued.  This patch extracts the "RSS hash type" from the receive
completion and sends it to the stack.

Submitted by: Venkatkumar Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed by: shurd
Approved by: sbruno
MFC after: 1 week
Sponsored by: Broadcom Limited
Differential Revision: https://reviews.freebsd.org/D9685

7 years ago1. state checks in bxe_tx_mq_start_locked() and bxe_tx_mq_start() to sync threads...
davidcs [Mon, 27 Feb 2017 23:38:51 +0000 (23:38 +0000)]
1. state checks in bxe_tx_mq_start_locked() and bxe_tx_mq_start() to sync threads during interface down or detach.
2. add sysctl to set pause frame parameters
3. increase max segs for TSO packets to BXE_TSO_MAX_SEGMENTS (32)
4. add debug messages for PHY
5. HW LRO support restricted to FreeBSD versions 8.x and above.

Submitted by:Vaishali.Kulkarni@cavium.com
MFC after:5 days

7 years agoAllow setting access-width for UART registers.
br [Mon, 27 Feb 2017 20:08:42 +0000 (20:08 +0000)]
Allow setting access-width for UART registers.

This is required for FDT's standard "reg-io-width" property
(similar to "reg-shift" property) found in many DTS files.

This fixes operation on Altera Arria 10 SOC Development Kit,
where standard ns8250 uart allows 4-byte access only.

Reviewed by: kan, marcel
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9785

7 years agoRevert r314212 as it break Allwinner boards.
br [Mon, 27 Feb 2017 19:46:27 +0000 (19:46 +0000)]
Revert r314212 as it break Allwinner boards.

Reported by: manu

7 years agoAdd sysctl to control auto resize of the GEOM metadata.
oshogbo [Mon, 27 Feb 2017 17:54:01 +0000 (17:54 +0000)]
Add sysctl to control auto resize of the GEOM metadata.

Reviewed by: AllanJude
Differential Revision: https://reviews.freebsd.org/D9603

7 years agoAnnounce that sbp_targ(4) does not support initiator mode.
mav [Mon, 27 Feb 2017 17:50:38 +0000 (17:50 +0000)]
Announce that sbp_targ(4) does not support initiator mode.

MFC after: 1 week

7 years agofix lvt_mode: edge-triggered interrupt mode is set by clearing APIC_LVT_TM
avg [Mon, 27 Feb 2017 17:36:31 +0000 (17:36 +0000)]
fix lvt_mode: edge-triggered interrupt mode is set by clearing APIC_LVT_TM

The fixed is used only to fix up buggy MPTable information and the
trigger mode is probably ignored for the relevant interrupt types
anyway.  Still, it's better to be standards compliant and have the code
do what it says it does.

Discussed with: jhb
MFC after: 5 days

7 years agoallwinner: Correct some clocks name for H3 CCU.
manu [Mon, 27 Feb 2017 17:12:17 +0000 (17:12 +0000)]
allwinner: Correct some clocks name for H3 CCU.

7 years agoAdd ID for NEC uPD720202 xHCI controller.
bms [Mon, 27 Feb 2017 17:04:35 +0000 (17:04 +0000)]
Add ID for NEC uPD720202 xHCI controller.

MFC after: 1 month

7 years agoReturn EINVAL when an invalid file descriptor specified.
dchagin [Mon, 27 Feb 2017 16:55:09 +0000 (16:55 +0000)]
Return EINVAL when an invalid file descriptor specified.

MFC after: 1 month

7 years agoUnify eventfd ioctl method and use it for other similar interfaces.
dchagin [Mon, 27 Feb 2017 16:53:52 +0000 (16:53 +0000)]
Unify eventfd ioctl method and use it for other similar interfaces.

MFC after: 1 month

7 years agobhyve: document virtio-console in the manpage
novel [Mon, 27 Feb 2017 15:37:38 +0000 (15:37 +0000)]
bhyve: document virtio-console in the manpage

Reviewed by: bcr, wblock, jceel
Approved by: grehan
Differential Revision: https://reviews.freebsd.org/D9564

7 years agoUpdate devd.conf for ports change 421360
asomers [Mon, 27 Feb 2017 15:32:56 +0000 (15:32 +0000)]
Update devd.conf for ports change 421360

Ports change 421360 changed the name and UID of the postgres user

Reviewed by: trasz, imp, girgen
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9746

7 years agoxen/gntdev: prevent unsynchronized accesses to the map entry
royger [Mon, 27 Feb 2017 15:31:15 +0000 (15:31 +0000)]
xen/gntdev: prevent unsynchronized accesses to the map entry

vm_map_lookup_done should only be called when the gntdev has finished poking at
the entry.

Reported by: alc
Reviewed by: alc
MFC after: 1 week
Sponsored by: Citrix Systems R&D

7 years agoDocument that the size of AH ICV for HMAC-SHA2-NNN should be half of
ae [Mon, 27 Feb 2017 15:30:27 +0000 (15:30 +0000)]
Document that the size of AH ICV for HMAC-SHA2-NNN should be half of
NNN bits as described in RFC4868.

PR: 215978

7 years agoPolish handling of different reset flavours.
mav [Mon, 27 Feb 2017 14:59:00 +0000 (14:59 +0000)]
Polish handling of different reset flavours.

The biggest change is that ctl_remove_initiator() now generates I_T NEXUS
LOSS event, cleaning part of LUs state related to the initiator.

MFC after: 2 weeks

7 years agoImplement more bit operation functions in the LinuxKPI.
hselasky [Mon, 27 Feb 2017 14:38:17 +0000 (14:38 +0000)]
Implement more bit operation functions in the LinuxKPI.
Some minor whitespace nits while at it.

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

7 years agoDefine __sum16 type in the LinuxKPI.
hselasky [Mon, 27 Feb 2017 13:59:02 +0000 (13:59 +0000)]
Define __sum16 type in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoallwinner: Order clocks by offset rather than by type for H3 ccu.
manu [Mon, 27 Feb 2017 11:10:36 +0000 (11:10 +0000)]
allwinner: Order clocks by offset rather than by type for H3 ccu.

Also add a few more supported gates and add comments for which clocks
are missing.

7 years agoallwinner: Add support for lock and fractional mode on NM clock
manu [Mon, 27 Feb 2017 08:58:27 +0000 (08:58 +0000)]
allwinner: Add support for lock and fractional mode on NM clock

Some PLL have a fractional mode and a lock bit.
Add support for it on the NM clock and export the clocks in the clkdom.

7 years agoFix startup race initialising ACPI CM battery structures on MacBookPro.
hselasky [Mon, 27 Feb 2017 08:36:51 +0000 (08:36 +0000)]
Fix startup race initialising ACPI CM battery structures on MacBookPro.

During acpi_cmbat_attach() the acpi_cmbat_init_battery() notification
handler is registered. It has been observed this notification handler
can be called instantly, before the attach routine has returned. In
the notification handler there is a call to device_is_attached() which
returns false. Because the softc is set we know an attach is in
progress and the fix is simply to wait and try again in this case.

Reviewed by: avg @
MFC after: 1 week

7 years agoSend TERMINATE to firmware when aborting active ATIO.
mav [Mon, 27 Feb 2017 08:20:28 +0000 (08:20 +0000)]
Send TERMINATE to firmware when aborting active ATIO.

MFC after: 2 weeks

7 years agolibrss: simplify some NULL checks.
pfg [Mon, 27 Feb 2017 00:10:00 +0000 (00:10 +0000)]
librss: simplify some NULL checks.

MFC after: 1 week

7 years agodc(1): Merge minor changes from OpenBSD.
pfg [Sun, 26 Feb 2017 22:17:06 +0000 (22:17 +0000)]
dc(1): Merge minor changes from OpenBSD.

Prefer setvbuf() to setlinebuf() for portability.
Some style(9) and redundant tests for NULL.

These are only meant to ease up merging newer changes but we are skipping
changes done in order to accomodate OpenBSD's pledge support.

Obtained from: OpenBSD
MFC after: 2 weeks

7 years agoRemove unneeded variable initialization from r314319.
oshogbo [Sun, 26 Feb 2017 22:15:39 +0000 (22:15 +0000)]
Remove unneeded variable initialization from r314319.

Pointed out by: kib

7 years agoDon't try to open devices in the gettc() function which will always
oshogbo [Sun, 26 Feb 2017 22:07:26 +0000 (22:07 +0000)]
Don't try to open devices in the gettc() function  which will always
fail in the Capability mode. Instead silently fallback to the syscall
method, which is done for example in the gettimeofday(2) function.

Reviewed by: kib

7 years agoEnable pl011 UART FIFOs
jchandra [Sun, 26 Feb 2017 22:05:22 +0000 (22:05 +0000)]
Enable pl011 UART FIFOs

The pl011 UART has a 16 entry Tx FIFO and a 16 entry Rx FIFO that
have not been used so far. Update the driver to enable the FIFOs
and use them in transmit and receive.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D8819

7 years agoInclude pcib_private.h for prototypes.
imp [Sun, 26 Feb 2017 21:33:18 +0000 (21:33 +0000)]
Include pcib_private.h for prototypes.

Noticed by: rpokala@
Sponsored by: Netflix

7 years agodc(1): Catch up with OpenBSD tag.
pfg [Sun, 26 Feb 2017 21:24:35 +0000 (21:24 +0000)]
dc(1): Catch up with OpenBSD tag.

OpenBSD rev 1.12 corresponds to our SVN r275162. Update the tag to make
easier future updates. No functional change.

MFC after: 3 days

7 years agonet80211 drivers: fix rate setup for EAPOL frames, obtain Tx parameters
avos [Sun, 26 Feb 2017 20:49:35 +0000 (20:49 +0000)]
net80211 drivers: fix rate setup for EAPOL frames, obtain Tx parameters
directly from the node.

- Use ni_txparms directly instead of calculating them manually every time
- Move M_EAPOL flag check upper; otherwise it may be skipped due to
'ucastrate' / 'mcastrate' check
- Use 'mgtrate' for control frames too (see ifconfig(8), mgtrate parameter)
- Add few more M_EAPOL checks where it was missing (zyd(4), ural(4),
urtw(4))
- Few unrelated cleanups

Tested with:
 - Intel 6205 (iwn(4)), STA mode;
 - WUSB54GC (rum(4)), HOSTAP mode + RTL8188EU (rtwn(4)), STA mode.

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

7 years agoReturn EINVAL in case when an invalid size of signal mask specified.
dchagin [Sun, 26 Feb 2017 20:01:58 +0000 (20:01 +0000)]
Return EINVAL in case when an invalid size of signal mask specified.

MFC after: 1 month

7 years agoRegen for r314312 (Linux epoll_pwait).
dchagin [Sun, 26 Feb 2017 19:59:28 +0000 (19:59 +0000)]
Regen for r314312 (Linux epoll_pwait).

MFC after: 1 month

7 years agoChange Linux epoll_pwait syscall definition to match Linux actual one.
dchagin [Sun, 26 Feb 2017 19:57:18 +0000 (19:57 +0000)]
Change Linux epoll_pwait syscall definition to match Linux actual one.

MFC after: 1 month

7 years agoRestore signal mask in epoll_pwait.
dchagin [Sun, 26 Feb 2017 19:54:17 +0000 (19:54 +0000)]
Restore signal mask in epoll_pwait.

MFC after: 1 month

7 years agoRefine the fix from r312954. Specifically, add a new PDE-only flag,
alc [Sun, 26 Feb 2017 19:54:02 +0000 (19:54 +0000)]
Refine the fix from r312954.  Specifically, add a new PDE-only flag,
PG_PROMOTED, that indicates whether lingering 4KB page mappings might
need to be flushed on a PDE change that restricts or destroys a 2MB
page mapping.  This flag allows the pmap to avoid range invalidations
that are both unnecessary and costly.

Reviewed by: kib, markj
MFC after: 6 weeks
Differential Revision: https://reviews.freebsd.org/D9665

7 years agoReturn EINVAL when an invalid file descriptor is specified.
dchagin [Sun, 26 Feb 2017 19:51:44 +0000 (19:51 +0000)]
Return EINVAL when an invalid file descriptor is specified.

MFC after: 1 month

7 years agoFix LUN enabling on wildcard target, as done by CTL.
mav [Sun, 26 Feb 2017 19:25:33 +0000 (19:25 +0000)]
Fix LUN enabling on wildcard target, as done by CTL.

MFC after: 2 weeks

7 years agoAdd support for SIMs without autosense.
mav [Sun, 26 Feb 2017 19:23:03 +0000 (19:23 +0000)]
Add support for SIMs without autosense.

If we asked to send sense data by setting CAM_SEND_SENSE, but SIM didn't
confirm transmission by setting CAM_SENT_SENSE, assume it was not sent.
Queue the I/O back to CTL for later REQUEST SENSE with ctl_queue_sense().
This is needed for error reporting on SPI HBAs like ahc(4)/ahd(4).

MFC after: 2 weeks

7 years agoAvoid picking up MIT Kerberos from ports (if installed).
des [Sun, 26 Feb 2017 19:00:55 +0000 (19:00 +0000)]
Avoid picking up MIT Kerberos from ports (if installed).

7 years agoFix amusingly harmless mis-merge.
des [Sun, 26 Feb 2017 16:34:58 +0000 (16:34 +0000)]
Fix amusingly harmless mis-merge.

7 years agoAdd clkng driver for Allwinner SoC
manu [Sun, 26 Feb 2017 16:00:20 +0000 (16:00 +0000)]
Add clkng driver for Allwinner SoC

Since Linux 4.9-4.10 DTS doesn't have clocks under /clocks but only a ccu node.
Currently only H3 is supported with almost the same state as HEAD.
(video pll aren't supported for now but we don't support video).
This driver and clocks will also be used for other SoC (A64, A31, H5, H2 etc ...)

Reviewed by: jmcneill
Differential Revision: https://reviews.freebsd.org/D9517

7 years agoReturn better error code in case of too long CDB.
mav [Sun, 26 Feb 2017 14:29:09 +0000 (14:29 +0000)]
Return better error code in case of too long CDB.

Its more important for SPI HBAs, as they don't support CDBs above 12 bytes.
The new error code makes CAM to fall back to alternative commands.

MFC after: 2 weeks

7 years agoFix the acpi idle support on i386 which was broken by r312910.
nyan [Sun, 26 Feb 2017 13:25:56 +0000 (13:25 +0000)]
Fix the acpi idle support on i386 which was broken by r312910.

The ifdefs were '#if !defined(__i386__) || !defined(PC98)' previously,
so cpu_idle_acpi was enabled both i386 and amd64 except PC98.

I was obfuscated by '#if !defined(__i386__)' condition.

Submitted by: bde
Reported by: bde

7 years agoUse resid field of CTIO to detect under/overruns.
mav [Sun, 26 Feb 2017 12:54:27 +0000 (12:54 +0000)]
Use resid field of CTIO to detect under/overruns.

MFC after: 2 weeks

7 years agoFix residual length reporting in target mode.
mav [Sun, 26 Feb 2017 12:52:44 +0000 (12:52 +0000)]
Fix residual length reporting in target mode.

This allows to properly handle cases when target wants to receive or send
more data then initiator wants to send or receive.  Previously in such
cases isp(4) returned CAM_DATA_RUN_ERR, while now it returns resid > 0.

MFC after: 2 weeks

7 years agoImplement timerfd family syscalls.
dchagin [Sun, 26 Feb 2017 09:48:18 +0000 (09:48 +0000)]
Implement timerfd family syscalls.

MFC after: 1 month

7 years agoNostly style(9) changes, replace unused eventfd_truncate()
dchagin [Sun, 26 Feb 2017 09:42:34 +0000 (09:42 +0000)]
Nostly style(9) changes, replace unused eventfd_truncate()
by default invfo_truncate() method.

MFC after: 1 month

7 years agoReturn EOVERFLOW error in case then the size of tv_sec field of struct timespec
dchagin [Sun, 26 Feb 2017 09:40:42 +0000 (09:40 +0000)]
Return EOVERFLOW error in case then the size of tv_sec field of struct timespec
in COMPAT_LINUX32 Linuxulator's not equal to the size of native tv_sec.

MFC after: 1 month

7 years agoRegen after r314291 (timerfd definition).
dchagin [Sun, 26 Feb 2017 09:37:25 +0000 (09:37 +0000)]
Regen after r314291 (timerfd definition).

MFC after: 1 month

7 years agoChange Linuxulator timerfd syscalls definition to match actual Linux one.
dchagin [Sun, 26 Feb 2017 09:35:44 +0000 (09:35 +0000)]
Change Linuxulator timerfd syscalls definition to match actual Linux one.

MFC after: 1 month

7 years agoImplement use of multiple transfers per I/O.
mav [Sun, 26 Feb 2017 06:25:55 +0000 (06:25 +0000)]
Implement use of multiple transfers per I/O.

This change removes limitation of single S/G list entry and limitation on
maximal I/O size, using multiple data transfers per I/O if needed.  Also
it removes code duplication between send and receive paths, which are now
completely equal.

7 years agospelling fix
alfred [Sun, 26 Feb 2017 06:05:29 +0000 (06:05 +0000)]
spelling fix

Submitted by: adamw

7 years agoMore FreeBSD tips for fortune(6)
alfred [Sun, 26 Feb 2017 04:41:37 +0000 (04:41 +0000)]
More FreeBSD tips for fortune(6)

Submitted by: lme
PR: 192373

7 years agoiwn: stop all watchdogs on device shutdown.
avos [Sun, 26 Feb 2017 01:05:27 +0000 (01:05 +0000)]
iwn: stop all watchdogs on device shutdown.

Tested with Intel 6205, STA mode.

MFC after: 5 days

7 years agoDo some minimal work to better conform to the 802.3ad (LACP) standard.
jtl [Sun, 26 Feb 2017 00:19:02 +0000 (00:19 +0000)]
Do some minimal work to better conform to the 802.3ad (LACP) standard.
In particular, don't set the synchronized bit for the peer unless it truly
appears to be synchronized to us. Also, don't set our own synchronized bit
unless we have actually seen a remote system.

Prior to this change, we were seeing some strange behavior, such as:

1. We send an advertisement with the Activity, Aggregation, and Default
flags, followed by an advertisement with the Activity, Aggregation,
Synchronization, and Default flags. However, we hadn't seen an
advertisement from another peer and were still advertising the default
(NULL) peer. A closer examination of the in-kernel data structures (using
kgdb) showed that the system had added the default (NULL) peer as a valid
aggregator for the segment.
2. We were receiving an advertisement from a peer that included the
default (NULL) peer instead of including our system information. However,
we responded with an advertisement that included the Synchronization flag
for both our system and the peer. (Since the peer's advertisement did not
include our system information, we shouldn't add the synchronization bit
for the peer.)

This patch corrects those two items.

Reviewed by: smh
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D9485

7 years agoMove inclusion of opt_printf.h around so that we can compile all the
imp [Sat, 25 Feb 2017 22:11:10 +0000 (22:11 +0000)]
Move inclusion of opt_printf.h around so that we can compile all the
SCSI modules outside of a sub-build from the kernel.

Differential Revision: https://reviews.freebsd.org/D9653
Sponsored by: Netflix

7 years agoFix linux_fstatfs() to return proper value for f_frsize. Without it,
trasz [Sat, 25 Feb 2017 20:32:37 +0000 (20:32 +0000)]
Fix linux_fstatfs() to return proper value for f_frsize. Without it,
linux df(1) binary from Xenial shows garbage.

Reviewed by: dchagin
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9692

7 years agoMFV 314276
jpaetzel [Sat, 25 Feb 2017 20:01:17 +0000 (20:01 +0000)]
MFV 314276

7570 tunable to allow zvol SCSI unmap to return on commit of txn to ZIL

illumos/illumos-gate@1c9272b861cd640a8342f4407da026ed98615517
https://github.com/illumos/illumos-gate/commit/1c9272b861cd640a8342f4407da026ed98615517

https://www.illumos.org/issues/7570

  Based on the discovery that every unmap waits for the commit of the txn to the ZIL,
  introducing a very high latency to unmap commands, this behavior was made into a
  tunable zvol_unmap_sync_enabled and set to false. The net impact of this change is
  that by default SCSI unmap commands will result in space being freed within the zvol
  (today they are ignored and returned with good status). However, unlike the code
  today, instead of 18+ms per unmap, they take about 30us.

  With the testing done on NTFS against a Win2k12 target, the new behavior should work
  seamlessly. Files on the zvol that have already been set with the zfree application
  will continue to write 0's when deleted, and any new files created since zvol
  creation will send unmap commands when deleted. This behavior exists today, but with
  this change the unmap commands will be processed and result in reclaim of space.

Author: Stephen Blinick <stephen.blinick@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Approved by: Robert Mustacchi <rm@joyent.com>

7 years agoRemove unused macro from common/drv.c.
oshogbo [Sat, 25 Feb 2017 18:14:32 +0000 (18:14 +0000)]
Remove unused macro from common/drv.c.

When we was compering it to code from boot2 it also looks like
this code is buggy and boot2 was never updated to use this code.
USE_XREAD flag is unused in boot2, and common/drv.c was never
build with that flag.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D9780

7 years agol2arc: try to fix write size calculation broken by Compressed ARC commit
avg [Sat, 25 Feb 2017 17:03:48 +0000 (17:03 +0000)]
l2arc: try to fix write size calculation broken by Compressed ARC commit

While there, make a change to not evict a first buffer outside the
requested eviciton range.

To do:
- give more consistent names to the size variables
- upstream to OpenZFS

PR: 216178
Reported by: lev
Tested by: lev
MFC after: 2 weeks

7 years agozfs: call spa_deadman on a taskqueue thread
avg [Sat, 25 Feb 2017 16:45:53 +0000 (16:45 +0000)]
zfs: call spa_deadman on a taskqueue thread

callout(9) prohibits callout functions from sleeping.
illumos mutexes are emulated using sx(9).
spa_deadman() calls vdev_deadman() and the latter acquires vq_lock.

As a result we can get a more confusing panic instead of a specific
panic or no panic:
sleepq_add: td 0xfffff80019669960 to sleep on wchan 0xfffff8001cff4d88 with sleeping prohibited

This change adds another level of indirection where the deadman
callout schedules spa_deadman() to be executed on taskqueue_thread.

While there, use callout_schedule(0 instead of callout_reset()
in spa_sync().

Discussed with: mav
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9762

7 years agocall vm_lowmem hook in uma_reclaim_worker
avg [Sat, 25 Feb 2017 16:39:21 +0000 (16:39 +0000)]
call vm_lowmem hook in uma_reclaim_worker

A comment near kmem_reclaim() implies that we already did that.
Calling the hook is useful, because some handlers, e.g. ARC,
might be able to release significant amounts of KVA.

Now that we have more than one place where vm_lowmem hook is called,
use this change as an opportunity to introduce flags that describe
a reason for calling the hook.  No handler makes use of the flags yet.

Reviewed by: markj, kib
MFC after: 1 week
Sponsored by: Panzura
Differential Revision: https://reviews.freebsd.org/D9764

7 years agochromebook_platform: catch up with ig4iic -> ig4iic_pci in r310621
avg [Sat, 25 Feb 2017 15:55:46 +0000 (15:55 +0000)]
chromebook_platform: catch up with ig4iic -> ig4iic_pci in r310621

Reported by: Wolfgang Zenker <wolfgang@lyxys.ka.sub.org>
Tested by: Wolfgang Zenker <wolfgang@lyxys.ka.sub.org>
MFC after: 5 days

7 years agoMerge ^/head r314178 through r314269.
dim [Sat, 25 Feb 2017 15:04:19 +0000 (15:04 +0000)]
Merge ^/head r314178 through r314269.

7 years agoMerge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
dim [Sat, 25 Feb 2017 15:00:57 +0000 (15:00 +0000)]
Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r296202, and update build glue.