]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoMFV r313676: libpcap 1.8.1
delphij [Mon, 13 Feb 2017 08:23:39 +0000 (08:23 +0000)]
MFV r313676: libpcap 1.8.1

MFC after: 1 month

7 years agoiwi: add 12-14 2GHz channels into channel list.
avos [Mon, 13 Feb 2017 02:15:56 +0000 (02:15 +0000)]
iwi: add 12-14 2GHz channels into channel list.

Return full channel list via iwi_getradiocaps() method
(ieee80211_init_channels() was replaced with iwi_getradiocaps()
to be consistent with other drivers).

PR: 216923
Submitted and tested by: ds@ukrhub.net (original patch)
MFC after: 5 days

7 years agoRemove MPSAFE and ARGUSED annotations, ANSI-fy syscall handlers.
kib [Mon, 13 Feb 2017 00:40:55 +0000 (00:40 +0000)]
Remove MPSAFE and ARGUSED annotations, ANSI-fy syscall handlers.

Discussed with: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoStyle: wrap long line.
kib [Mon, 13 Feb 2017 00:39:43 +0000 (00:39 +0000)]
Style: wrap long line.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

7 years agoOnly trigger em_local_timer on queue index 0. This was causing continuous
sbruno [Sun, 12 Feb 2017 23:06:41 +0000 (23:06 +0000)]
Only trigger em_local_timer on queue index 0.  This was causing continuous
em_local_timer() executions during normal operation and was very likely
to cause a lock up on igb(4) devices.

Submitted by: Matt Macy (mmacy@nextbsd.org)
Reported by: jtl
Reviewed by: gallatin
Sponsored by: Limelight Networks & Netflix

7 years agoConsistently handle negative or wrapping offsets in the mmap(2) syscalls.
kib [Sun, 12 Feb 2017 21:05:44 +0000 (21:05 +0000)]
Consistently handle negative or wrapping offsets in the mmap(2) syscalls.

For regular files and posix shared memory, POSIX requires that
[offset, offset + size) range is legitimate.  At the maping time,
check that offset is not negative.  Allowing negative offsets might
expose the data that filesystem put into vm_object for internal use,
esp. due to OFF_TO_IDX() signess treatment.  Fault handler verifies
that the mapped range is valid, assuming that mmap(2) checked that
arithmetic gives no undefined results.

For device mappings, leave the semantic of negative offsets to the
driver.  Correct object page index calculation to not erronously
propagate sign.

In either case, disallow overflow of offset + size.

Update mmap(2) man page to explain the requirement of the range
validity, and behaviour when the range becomes invalid after mapping.

Reported and tested by: royger (previous version)
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoSwitch copyout_map() to use vm_mmap_object() instead of vm_mmap().
kib [Sun, 12 Feb 2017 20:54:31 +0000 (20:54 +0000)]
Switch copyout_map() to use vm_mmap_object() instead of vm_mmap().

This is both a microoptimization and a move of the consumer to more
commonly used vm function.

Suggested and reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoremove l2_padding_needed statistic from zfs arc
avg [Sun, 12 Feb 2017 19:45:30 +0000 (19:45 +0000)]
remove l2_padding_needed statistic from zfs arc

It became obsolete when the Compressed ARC support was committed.

MFC after: 1 week

7 years agocheck remaining space in zfs implementations of vptocnp
avg [Sun, 12 Feb 2017 19:40:59 +0000 (19:40 +0000)]
check remaining space in zfs implementations of vptocnp

PR: 216939
Submitted by: Iouri V. Ivliev <fbsd@any.com.ru>
MFC after: 1 week

7 years agoFix r313284.
dchagin [Sun, 12 Feb 2017 15:22:50 +0000 (15:22 +0000)]
Fix r313284.

Members of the syscall argument structures are padded to a word size. So,
for COMPAT_LINUX32 we should convert user supplied system call arguments
which is 32-bit in that case to the array of register_t.

Reported by: Oleg V. Nauman
MFC after: 1 week

7 years agolockmgr: implement fast path
mjg [Sun, 12 Feb 2017 09:49:44 +0000 (09:49 +0000)]
lockmgr: implement fast path

The main lockmgr routine takes 8 arguments which makes it impossible to
tail-call it by the intermediate vop_stdlock/unlock routines.

The routine itself starts with an if-forest and reads from the lock itself
several times.

This slows things down both single- and multi-threaded. With the patch
single-threaded fstats go 4% up and multithreaded up to ~27%.

Note that there is still a lot of room for improvement.

Reviewed by: kib
Tested by: pho

7 years agoUse SRCTOP/OBJTOP relative paths where possible; use :H manipulation in lieu
ngie [Sun, 12 Feb 2017 08:36:47 +0000 (08:36 +0000)]
Use SRCTOP/OBJTOP relative paths where possible; use :H manipulation in lieu
of ../ elsewhere

This simplifies pathing in make/displayed output

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoVendor import of libpcap 1.8.1.
delphij [Sun, 12 Feb 2017 07:04:44 +0000 (07:04 +0000)]
Vendor import of libpcap 1.8.1.

7 years agoCommitted without approval from mentor.
eri [Sun, 12 Feb 2017 06:56:33 +0000 (06:56 +0000)]
Committed without approval from mentor.

Reported by: gnn

7 years agoEnable usb low and full speed devices connected to the imx6 root hubs.
ian [Sun, 12 Feb 2017 00:52:22 +0000 (00:52 +0000)]
Enable usb low and full speed devices connected to the imx6 root hubs.

This enables the PHY circuitry for UTMI+ level 2 and 3, and sets the
flag to tell the ehci code that the root hub has a transaction translator
in it.  For imx6 we can use the standard ehci_get_port_speed_portsc()
function to find out what speed device is connected to the port.

7 years agoRemove spaces at end of line
bapt [Sat, 11 Feb 2017 23:45:50 +0000 (23:45 +0000)]
Remove spaces at end of line

Reported by: make manlint
MFC after: 2 days

7 years agoRemove useless Li macro
bapt [Sat, 11 Feb 2017 23:45:10 +0000 (23:45 +0000)]
Remove useless Li macro

Reported by: make manlint
MFC after: 2 days

7 years agoUse correct date format
bapt [Sat, 11 Feb 2017 23:44:37 +0000 (23:44 +0000)]
Use correct date format

Reported by: make manlint
MFC after: 2 days

7 years agoEscape Sm to avoid confusion with Sm macro
bapt [Sat, 11 Feb 2017 23:43:12 +0000 (23:43 +0000)]
Escape Sm to avoid confusion with Sm macro

Reported by: make manlint
MFC after: 2 days

7 years agoProperly use .An macro before Authors name
bapt [Sat, 11 Feb 2017 23:42:33 +0000 (23:42 +0000)]
Properly use .An macro before Authors name

Reported by: make manlint
MFC after: 2 days

7 years agoAdd missing section in manpage reference
bapt [Sat, 11 Feb 2017 23:41:38 +0000 (23:41 +0000)]
Add missing section in manpage reference

Reported by: make manlint
MFC after: 2 days

7 years agoRemove spaces at EOL and sort correctly the SEE ALSO section
bapt [Sat, 11 Feb 2017 23:40:57 +0000 (23:40 +0000)]
Remove spaces at EOL and sort correctly the SEE ALSO section

Reported by: make manlint
MFC after: 2 days

7 years agoRemove empty space at EOL and escept Ed
bapt [Sat, 11 Feb 2017 23:39:56 +0000 (23:39 +0000)]
Remove empty space at EOL and escept Ed

Reported by: make manlint
MFC after: 2 days

7 years agoRemove useless .Pp after the .Sh macro and remove empty line
bapt [Sat, 11 Feb 2017 23:39:14 +0000 (23:39 +0000)]
Remove useless .Pp after the .Sh macro and remove empty line

Reported by: make manlint
MFC after: 2 days

7 years agoEscape No to avoid confusion with the No macro
bapt [Sat, 11 Feb 2017 23:38:28 +0000 (23:38 +0000)]
Escape No to avoid confusion with the No macro

Reported by: make manlint
MFC after: 2 days

7 years agoAdd missing section after .Xr reference
bapt [Sat, 11 Feb 2017 23:37:48 +0000 (23:37 +0000)]
Add missing section after .Xr reference

Reported by: make manlint
MFC after: 2 days

7 years agoAdd missing -width after -Bl -tag
bapt [Sat, 11 Feb 2017 23:36:52 +0000 (23:36 +0000)]
Add missing -width after -Bl -tag

Reported by: make manlint
MFC after: 2 days

7 years agoEscape Ss to avoid confusion by mdoc parser with the Ss macro
bapt [Sat, 11 Feb 2017 23:14:28 +0000 (23:14 +0000)]
Escape Ss to avoid confusion by mdoc parser with the Ss macro

Reported by: make manlint
MFC after: 2 days

7 years agoRemove empty Li
bapt [Sat, 11 Feb 2017 23:09:50 +0000 (23:09 +0000)]
Remove empty Li

Reported by: make manlint
MFC after: 2 days

7 years agoRemove space at and of line
bapt [Sat, 11 Feb 2017 23:06:53 +0000 (23:06 +0000)]
Remove space at and of line

Reported by: make manlint
MFC after: 2 days

7 years agoRevert r313565 -- :mmap__bad_arguments passes again after r313655
ngie [Sat, 11 Feb 2017 20:31:57 +0000 (20:31 +0000)]
Revert r313565 -- :mmap__bad_arguments passes again after r313655

PR: 216976
Sponsored by: Dell EMC Isilon

7 years agoUse SRCTOP to define .include with usr.bin/Makefile.inc
ngie [Sat, 11 Feb 2017 20:27:53 +0000 (20:27 +0000)]
Use SRCTOP to define .include with usr.bin/Makefile.inc

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoChange type of the prot parameter for kern_vm_mmap() from vm_prot_t to int.
kib [Sat, 11 Feb 2017 20:27:39 +0000 (20:27 +0000)]
Change type of the prot parameter for kern_vm_mmap() from vm_prot_t to int.

This makes the code to pass whole word of the mmap(2) syscall argument
prot to the syscall helper kern_vm_mmap(), which can validate all
bits.  The change provides temporal fix for sys/vm/mmap_test
mmap__bad_arguments, which was broken after r313352.

PR: 216976
Reported and tested by: ngie
Sponsored by: The FreeBSD Foundation

7 years agoUse SRCTOP to refer to awk source in contrib/awk and remove unnecessary AWKSRC prefix
ngie [Sat, 11 Feb 2017 20:27:06 +0000 (20:27 +0000)]
Use SRCTOP to refer to awk source in contrib/awk and remove unnecessary AWKSRC prefix
for maketab.c

The former simplifies pathing in make/displayed output, whereas the latter was just
unnecessarily superfluous since .PATH referenced the path to maketab.c earlier on in
the Makefile.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoUse SRCTOP instead of .CURDIR relative paths with ".."
ngie [Sat, 11 Feb 2017 20:19:04 +0000 (20:19 +0000)]
Use SRCTOP instead of .CURDIR relative paths with ".."

This simplifies pathing in make/displayed output

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoUse SRCTOP instead of .CURDIR relative paths with ".."
ngie [Sat, 11 Feb 2017 20:18:24 +0000 (20:18 +0000)]
Use SRCTOP instead of .CURDIR relative paths with ".."

This simplifies pathing in make/displayed output

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoManipulate OBJDIR with :H when referencing dso directory
ngie [Sat, 11 Feb 2017 20:14:50 +0000 (20:14 +0000)]
Manipulate OBJDIR with :H when referencing dso directory

This reduces path lengths, etc in memory with make by a minimal value

Sponsored by: Dell EMC Isilon

7 years agoUse SRCTOP/OBJTOP and simplify output using :H instead of "../" for directory
ngie [Sat, 11 Feb 2017 20:12:54 +0000 (20:12 +0000)]
Use SRCTOP/OBJTOP and simplify output using :H instead of "../" for directory
entries

This simplifies pathing in make/displayed output

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agopciconf(8): Replace an assert with errx
cem [Sat, 11 Feb 2017 18:04:43 +0000 (18:04 +0000)]
pciconf(8): Replace an assert with errx

The condition can be hit with simple user input, so it isn't an invariant.
Just error out.

PR: 217003
Reported by: Vladislav V. Prodan <admin at support.od.ua>
Sponsored by: Dell EMC Isilon

7 years agoDon't zero out srtt after excess retransmits
rstone [Sat, 11 Feb 2017 17:05:08 +0000 (17:05 +0000)]
Don't zero out srtt after excess retransmits

If the TCP stack has retransmitted more than 1/4 of the total
number of retransmits before a connection drop, it decides that
its current RTT estimate is hopelessly out of date and decides
to recalculate it from scratch starting with the next ACK.

Unfortunately, it implements this by zeroing out the current RTT
estimate.  Drop this hack entirely, as it makes it significantly more
difficult to debug connection issues.  Instead check for excessive
retransmits at the point where srtt is updated from an ACK being
received.  If we've exceeded 1/4 of the maximum retransmits,
discard the previous srtt estimate and replace it with the latest
rtt measurement.

Differential Revision: https://reviews.freebsd.org/D9519
Reviewed by: gnn
Sponsored by: Dell EMC Isilon

7 years agoloader: implement MEDIA_FILEPATH_DP support in efipart
tsoome [Sat, 11 Feb 2017 15:25:49 +0000 (15:25 +0000)]
loader: implement MEDIA_FILEPATH_DP support in efipart

The efipart rework did break the ARM systems as the new code is
using more exact filters to sort the devices and we need to
add support for MEDIA_FILEPATH_DP device paths.

PR: 216940
Reported by: karl@denninger.net
Reviewed by: allanjude, manu
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D9520

7 years ago[net80211] add a sysctl that forces a vap restart.
adrian [Sat, 11 Feb 2017 05:33:49 +0000 (05:33 +0000)]
[net80211] add a sysctl that forces a vap restart.

Well, vap restart really does "all restart" for now, which will be a good
way of debugging firmware restart issues.

7 years agoAdding myself to committers-ports.dot and calendar.freebsd
mmokhi [Sat, 11 Feb 2017 05:19:45 +0000 (05:19 +0000)]
Adding myself to committers-ports.dot and calendar.freebsd

Submitted by: mmokhi
Approved by: feld, mat (mentors)
Differential Revision: https://reviews.freebsd.org/D9528

7 years agoRemove sys/boot/pc98 accidentally restored in r313575
emaste [Sat, 11 Feb 2017 02:45:54 +0000 (02:45 +0000)]
Remove sys/boot/pc98 accidentally restored in r313575

Reported by: rpokala

7 years agomakefs: make the buffer functions look exactly like the kernel ones
emaste [Sat, 11 Feb 2017 02:33:48 +0000 (02:33 +0000)]
makefs: make the buffer functions look exactly like the kernel ones

From NetBSD christos Sat Jan 26 00:19:39 2013 +0000

make the buffer functions look exactly like the kernel ones and add other
cruft to make the kernel files compile.

ffs.c 1.54
ffs/buf.c 1.13
ffs/buf.h 1.3
ffs/ffs_alloc.c 1.21
ffs/ffs_balloc.c 1.15

Reviewed by: marcel, ngie
Obtained from: NetBSD
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8404

7 years agoStop including sys/types.h from arm's machine/atomic.h, fix the places
ian [Sat, 11 Feb 2017 01:07:46 +0000 (01:07 +0000)]
Stop including sys/types.h from arm's machine/atomic.h, fix the places
where atomic.h was being included without ensuring that types.h (via
param.h) was included first, as required by atomic(9).

7 years agoMFV r313569:313569:313569:
mm [Sat, 11 Feb 2017 01:00:58 +0000 (01:00 +0000)]
MFV r313569:313569:313569:
Sync libarchive with vendor

Vendor bugfixes:
cpio reader sanity fix (OSS-Fuzz 504)
WARC reader sanity fixes (OSS-Fuzz 511, 526, 532, 552)
mtree reader time parsing fix (OSS-Fuzz 538)
XAR reader memleak fix (OSS-Fuzz 551)

MFC after: 1 week

7 years agoChange the isp(4) driver to not adjust the tag type for REQUEST SENSE.
ken [Fri, 10 Feb 2017 22:02:45 +0000 (22:02 +0000)]
Change the isp(4) driver to not adjust the tag type for REQUEST SENSE.

The isp(4) driver was changing the tag type for REQUEST SENSE
commands to Head of Queue, when the CAM CCB flag
CAM_TAG_ACTION_VALID was NOT set.  CAM_TAG_ACTION_VALID is set
when the tag action in the XPT_SCSI_IO is not CAM_TAG_ACTION_NONE
and when the target has tagged queueing turned on.

In most cases when CAM_TAG_ACTION_VALID is not set, it is because
the target is not doing tagged queueing.  In those cases, trying to
send a Head of Queue tag may cause problems.  Instead, default to
sending a simple tag.

IBM tape drives claim to support tagged queueing in their standard
Inquiry data, but have the DQue bit set in the control mode page
(mode page 10).  CAM correctly detects that these drives do not
support tagged queueing, and clears the CAM_TAG_ACTION_VALID flag
on CCBs sent down to the drives.

This caused the isp(4) driver to go down the path of setting the
tag action to a default value, and for Request Sense commands only,
set the tag action to Head of Queue.

If an IBM tape drive does get a Head of Queue tag, it rejects it with
Invalid Message Error (0x49,0x00).  (The Qlogic firmware translates that
to a Transport Error, which the driver translates to an Unrecoverable
HBA Error, or CAM_UNREC_HBA_ERROR.) So, by default, it wasn't possible
to get a good response from a REQUEST SENSE to an FC-attached IBM
tape drive with the isp(4) driver.

IBM tape drives (tested on an LTO-5 with G9N1 firmware and a TS1150
with 4470 firmware) also have a bug in that sending a command with a
non-simple tag attribute breaks the tape drive's Command Reference
Number (CRN) accounting and causes it to ignore all subsequent
commands because it and the initiator disagree about the next
expected CRN.  The drives do reject the initial command with a head
of queue tag with an Invalid Message Error (0x49,0x00), but after that
they ignore any subsequent commands.  IBM confirmed that it is a bug,
and sent me test firmware that fixes the bug.  However tape drives in
the field will still exhibit the bug until they are upgraded.

Request Sense is not often sent to targets because most errors are
reported automatically through autosense in Fibre Channel and other
modern transports.  ("Modern" meaning post SCSI-2.)  So this is not
an error that would crop up frequently.  But Request Sense is useful on
tape devices to report status information, aside from error reporting.

This problem is less serious without FC-Tape features turned on,
specifically precise delivery of commands (which enables Command
Reference Numbers), enabled on the target and initiator.  Without
FC-Tape features turned on, the target would return an error and
things would continue on.

And it also does not cause problems for targets that do tagged
queueing, because in those cases the isp(4) driver just uses the
tag type that is specified in the CCB, assuming the
CAM_TAG_ACTION_VALID flag is set, and defaults to sending a Simple
tag action if it isn't an ordered or head of queue tag.

sys/dev/isp/isp.c:
In isp_start(), don't try to send Request Sense commands
with the Head of Queue tag attribute if the CCB doesn't
have a valid tag action.  The tag action likely isn't valid
because the target doesn't support tagged queueing.

Sponsored by: Spectra Logic
MFC after: 3 days

7 years agoRegenerate all the system call tables to drop "created from" lines.
jhb [Fri, 10 Feb 2017 19:45:02 +0000 (19:45 +0000)]
Regenerate all the system call tables to drop "created from" lines.

One of the ibcs2 files contains some actual changes (new headers) as
it hasn't been regenerated after older changes to makesyscalls.sh.

7 years agoExpect :mmap__bad_arguments to fail
ngie [Fri, 10 Feb 2017 19:31:09 +0000 (19:31 +0000)]
Expect :mmap__bad_arguments to fail

Some recent changes to vm related to mmap(2) have broken the prot checks that
would result with an EINVAL with this case

I suspect r313352 is the root-cause the issue

PR: 216976
Sponsored by: Dell EMC Isilon

7 years agoDrop the "created from" line from files generated by makesyscalls.sh.
jhb [Fri, 10 Feb 2017 19:25:52 +0000 (19:25 +0000)]
Drop the "created from" line from files generated by makesyscalls.sh.

This information is less useful when the generated files are included in
source control along with the source.  If needed it can be reconstructed
from the $FreeBSD$ tag in the generated file.  Removing this information
from the generated output permits committing the generated files along
with the change to the system call master list without having inconsistent
metadata in the generated files.

Reviewed by: emaste, kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D9497

7 years agokldxref: bump MAXSEGS to 3
emaste [Fri, 10 Feb 2017 19:17:10 +0000 (19:17 +0000)]
kldxref: bump MAXSEGS to 3

ld.bfd generates two PT_LOAD segments, but certain linkers or linker
configurations generate three PT_LOAD segments (one additional for
RELRO).

PR: 216975
Reported by: Shawn Webb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

7 years agokldxref: s/sections/segments/ in warning message
emaste [Fri, 10 Feb 2017 19:11:33 +0000 (19:11 +0000)]
kldxref: s/sections/segments/ in warning message

The message refers to program header segments, not sections.

PR: 216975

7 years agoMove tcp_fields_to_net() static inline into tcp_var.h, just below its
glebius [Fri, 10 Feb 2017 17:46:26 +0000 (17:46 +0000)]
Move tcp_fields_to_net() static inline into tcp_var.h, just below its
friend tcp_fields_to_host(). There is third party code that also uses
this inline.

Reviewed by: ae

7 years agoLast consumer of _WANT_RTENTRY gone.
glebius [Fri, 10 Feb 2017 17:37:04 +0000 (17:37 +0000)]
Last consumer of _WANT_RTENTRY gone.

7 years agoDon't check struct rtentry on FreeBSD, it is an internal kernel structure.
glebius [Fri, 10 Feb 2017 17:34:48 +0000 (17:34 +0000)]
Don't check struct rtentry on FreeBSD, it is an internal kernel structure.
On other systems it may be API structure for SIOCADDRT/SIOCDELRT.

Reviewed by: emaste, dim

7 years agoAllow Dtrace to be compiled into the kernel again after r313177.
bz [Fri, 10 Feb 2017 16:06:14 +0000 (16:06 +0000)]
Allow Dtrace to be compiled into the kernel again after r313177.

MFC after: 1 week

7 years agoChange mlx4 QP allocation scheme.
hselasky [Fri, 10 Feb 2017 15:28:18 +0000 (15:28 +0000)]
Change mlx4 QP allocation scheme.

When using Blue-Flame, BF, the QPN overrides the VLAN, CV, and SV
fields in the WQE. Thus, BF may only be used for QPNs with bits 6,7
unset.

The current ethernet driver code reserves a TX QP range with 256b
alignment.

This is wrong because if there are more than 64 TX QPs in use, QPNs >=
base + 65 will have bits 6/7 set.

This problem is not specific for the Ethernet driver, any entity that
tries to reserve more than 64 BF-enabled QPs should fail. Also, using
ranges is not necessary here and is wasteful.

The new mechanism introduced here will support reservation for "Eth
QPs eligible for BF" for all drivers: bare-metal, multi-PF, and VFs
(when hypervisors support WC in VMs). The flow we use is:

1. In mlx4_en, allocate Tx QPs one by one instead of a range allocation,
   and request "BF enabled QPs" if BF is supported for the function

2. In the ALLOC_RES FW command, change param1 to:
a. param1[23:0]  - number of QPs
b. param1[31-24] - flags controlling QPs reservation

Bit 31 refers to Eth blueflame supported QPs. Those QPs must have bits
6 and 7 unset in order to be used in Ethernet.

Bits 24-30 of the flags are currently reserved.

When a function tries to allocate a QP, it states the required
attributes for this QP. Those attributes are considered "best-effort".
If an attribute, such as Ethernet BF enabled QP, is a must-have
attribute, the function has to check that attribute is supported
before trying to do the allocation.

In a lower layer of the code, mlx4_qp_reserve_range masks out the bits
which are unsupported. If SRIOV is used, the PF validates those
attributes and masks out unsupported attributes as well. In order to
notify VFs which attributes are supported, the VF uses QUERY_FUNC_CAP
command. This command's mailbox is filled by the PF, which notifies
which QP allocation attributes it supports.

Obtained from: Linux (dual BSD/GPLv2 licensed)
Submitted by: Dexuan Cui @ microsoft . com
Differential Revision: https://reviews.freebsd.org/D8868
MFC after: 2 weeks
Sponsored by: Mellanox Technologies

7 years agoFlexible and asymmetric allocation of EQs and MSI-X vectors for PF/VFs.
hselasky [Fri, 10 Feb 2017 15:22:21 +0000 (15:22 +0000)]
Flexible and asymmetric allocation of EQs and MSI-X vectors for PF/VFs.

Previously, the mlx4 driver queried the firmware in order to get the
number of supported EQs. Under SRIOV, since this was done before the
driver notified the firmware how many VFs it actually needs, the
firmware had to take into account a worst case scenario and always
allocated four EQs per VF, where one was used for events while the
others were used for completions. Now, when the firmware supports the
asymmetric allocation scheme, denoted by exposing num_sys_eqs > 0 (-->
MLX4_DEV_CAP_FLAG2_SYS_EQS), we use the QUERY_FUNC command to query
the firmware before enabling SRIOV. Thus we can get more EQs and MSI-X
vectors per function. Moreover, when running in the new
firmware/driver mode, the limitation that the number of EQs should be
a power of two is lifted.

Obtained from: Linux (dual BSD/GPLv2 licensed)
Submitted by: Dexuan Cui @ microsoft . com
Differential Revision: https://reviews.freebsd.org/D8867
MFC after: 2 weeks
Sponsored by: Mellanox Technologies

7 years agoClean redundant MIN/MAX declarations in some HighPoint drivers.
pfg [Fri, 10 Feb 2017 15:18:41 +0000 (15:18 +0000)]
Clean redundant MIN/MAX declarations in some HighPoint drivers.

The hpt27xx(4), hptnr(4), and hptrr(4) drivers declare MIN() and MAX()
internally which match the macros from sys/param.h.

MIN() is not used, MAX is only used once and can be replaced with the
max() version in libkern.h which operates on u_ints.

MFC after: 2 weeks

7 years agoFix r313495.
kib [Fri, 10 Feb 2017 14:49:04 +0000 (14:49 +0000)]
Fix r313495.

The file type DTYPE_VNODE can be assigned as a fallback if VOP_OPEN()
did not initialized file type.  This is a typical code path used by
normal file systems.

Also, change error returned for inappropriate file type used for
O_EXLOCK to EOPNOTSUPP, as declared in the open(2) man page.

Reported by: cy, dhw, Iblis Lin <iblis@hs.ntnu.edu.tw>
Tested by: dhw
Sponsored by: The FreeBSD Foundation
MFC after: 13 days

7 years agoo Reset mouse selection when new lines reach selection lines.
ray [Fri, 10 Feb 2017 13:28:30 +0000 (13:28 +0000)]
o Reset mouse selection when new lines reach selection lines.
o Fix how selection handled on display.

Submitted by: hselasky
Reviewed by: hselasky, emaste(previous version)
Todo: track mouse select direction.

7 years agoindent(1): add regression test cases
pstef [Fri, 10 Feb 2017 09:31:39 +0000 (09:31 +0000)]
indent(1): add regression test cases

These examples show expected behavior of indent(1). They are meant to be used
together with a regression test mechanism, either Kyua, a Makefile or perhaps
something else. The mechanism should in essence do this:
  indent -P${test}.pro < ${test}.0 > ${test}.0.run
and compare ${test}.0.stdout to ${test}.0.run. If the files differ or the exit
status isn't 0, the test failed.

* ${test}.pro is an indent(1) profile: a list of options passed through a file.
  The program doesn't complain if the file doesn't exist.
* ${test}.0 is a C source file which acts as input for indent(1). It doesn't
  have to have any particular formatting, since it's the output that matters.
* ${test}.0.stdout contains expected output. It doesn't have to be formatted in
  Kernel Normal Form as the point of the tests is to check for regressions in
  the program and not to check that it always produces KNF.

Reviewed by: ngie
Approved by: pfg (mentor)
Differential Revision: https://reviews.freebsd.org/D9007

7 years ago[ath] sigh, how'd I miss this.
adrian [Fri, 10 Feb 2017 07:16:56 +0000 (07:16 +0000)]
[ath] sigh, how'd I miss this.

7 years agoUse proper value for socket option on IPv6
eri [Fri, 10 Feb 2017 06:20:27 +0000 (06:20 +0000)]
Use proper value for socket option on IPv6

Reported-by: ohartmann@walstatt.org
7 years agoFix build after r313524
eri [Fri, 10 Feb 2017 06:01:47 +0000 (06:01 +0000)]
Fix build after r313524

Reported-by: ohartmann@walstatt.org
7 years agoRevert r313527
eri [Fri, 10 Feb 2017 05:58:16 +0000 (05:58 +0000)]
Revert r313527

Heh svn is not git

7 years agoCorrect missed variable name.
eri [Fri, 10 Feb 2017 05:51:39 +0000 (05:51 +0000)]
Correct missed variable name.

Reported-by: ohartmann@walstatt.org
7 years agoThe patch provides the same socket option as Linux IP_ORIGDSTADDR.
eri [Fri, 10 Feb 2017 05:16:14 +0000 (05:16 +0000)]
The patch provides the same socket option as Linux IP_ORIGDSTADDR.
Unfortunately they will have different integer value due to Linux value being already assigned in FreeBSD.

The patch is similar to IP_RECVDSTADDR but also provides the destination port value to the application.

This allows/improves implementation of transparent proxies on UDP sockets due to having the whole information on forwarded packets.

Sponsored-by: rsync.net
Differential Revision: D9235
Reviewed-by: adrian
7 years agoWhen patching USDT probes, use non-unique names for aliases of weak symbols.
markj [Fri, 10 Feb 2017 02:01:32 +0000 (02:01 +0000)]
When patching USDT probes, use non-unique names for aliases of weak symbols.

Aliases are normally given names that include a key that's unique for each
input object file. This, for example, ensures that aliases for identically
named local symbols in different object files don't conflict. However, in
some cases the static linker will leave an undefined alias after merging
identical weak symbols, resulting in a link error. A non-unique name allows
the aliases to be merged as well.

PR: 216871
X-MFC With: r313262

7 years agoixl(4): Update to 1.7.12-k
erj [Fri, 10 Feb 2017 01:04:11 +0000 (01:04 +0000)]
ixl(4): Update to 1.7.12-k

Refresh upstream driver before impending conversion to iflib.

Major new features:

- Support for Fortville-based 25G adapters
- Support for I2C reads/writes

(To prevent getting or sending corrupt data, you should set
dev.ixl.0.debug.disable_fw_link_management=1 when using I2C
[this will disable link!], then set it to 0 when done. The driver implements
the SIOCGI2C ioctl, so ifconfig -v works for reading I2C data,
but there are read_i2c and write_i2c sysctls under the .debug sysctl tree
[the latter being useful for upper page support in QSFP+]).

- Addition of an iWARP client interface (so the future iWARP driver for
  X722 devices can communicate with the base driver).
  - Compiling this option in is enabled by default, with "options IXL_IW" in
    GENERIC.

Differential Revision: https://reviews.freebsd.org/D9227
Reviewed by: sbruno
MFC after: 2 weeks
Sponsored by: Intel Corporation

7 years agoIncrease a chance of devfs_close() calling d_close cdevsw method.
kib [Thu, 9 Feb 2017 23:36:50 +0000 (23:36 +0000)]
Increase a chance of devfs_close() calling d_close cdevsw method.

If a file opened over a vnode has an advisory lock set at close,
vn_closefile() acquires additional vnode use reference to prevent
freeing the vnode in vn_close().  Side effect is that for device
vnodes, devfs_close() sees that vnode reference count is greater than
one and refuses to call d_close().  Create internal version of
vn_close() which can avoid dropping the vnode reference if needed, and
use this to execute VOP_CLOSE() without acquiring a new reference.

Note that any parallel reference to the vnode would still prevent
d_close call, if the reference is not from an opened file, e.g. due to
stat(2).

Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoDo not establish advisory locks when doing open(O_EXLOCK) or open(O_SHLOCK)
kib [Thu, 9 Feb 2017 23:35:57 +0000 (23:35 +0000)]
Do not establish advisory locks when doing open(O_EXLOCK) or open(O_SHLOCK)
for files which do not have DTYPE_VNODE type.

Both flock(2) and fcntl(2) syscalls refuse to acquire advisory lock on
a file which type is not DTYPE_VNODE.  Do the same when lock is
requested from open(2).

Restructure the block in vn_open_vnode() which handles O_EXLOCK and
O_SHLOCK open flags to make it easier to quit its execution earlier
with an error.

Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoHandle protected symbols in rtld.
kib [Thu, 9 Feb 2017 23:33:06 +0000 (23:33 +0000)]
Handle protected symbols in rtld.

Protected symbol reference in GOT of the defining object must be
resolved to itself, same as -Bsymbolic globally.

Discussed with: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D9317

7 years agoDefine ELF_ST_VISIBILITY().
kib [Thu, 9 Feb 2017 23:32:03 +0000 (23:32 +0000)]
Define ELF_ST_VISIBILITY().

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years ago[net80211] don't bother doing fragmentation if the driver supports fragmentation...
adrian [Thu, 9 Feb 2017 23:29:57 +0000 (23:29 +0000)]
[net80211] don't bother doing fragmentation if the driver supports fragmentation offload.

Tested:

* ath10k, which does its own fragmentation in firmware.

7 years ago[ath_hal] implement NULL methods for ah_setQuiet for AR5210, AR5211.
adrian [Thu, 9 Feb 2017 23:20:55 +0000 (23:20 +0000)]
[ath_hal] implement NULL methods for ah_setQuiet for AR5210, AR5211.

Tested:

* "crap, I didn't bring my cardbus collection and T400 with me" compile
  tested.

7 years ago[ath] initial station side quiet IE support.
adrian [Thu, 9 Feb 2017 23:15:11 +0000 (23:15 +0000)]
[ath] initial station side quiet IE support.

This implements hardware assisted quiet IE support.  Quiet time is
an optional interval on DFS channels (but doesn't have to be DFS
only channels! sigh) where the station and AP can be quiet in order
to allow for channel utilisation measurements.  Typically that's
stuff like radar detection, spectral scan, other-BSS frame sniffing,
checking how busy the air is, etc.

The hardware implements it as one of the generic timers, which is
supplied a period, offset from the trigger period and duration
to stay quiet.  The AP can announce quiet time configurations which
change, and so this code also tracks that.

Implementation details:

* track the current quiet time IE
* compare the new one against the previous one - if only the TBTT
  counter changes, don't update things
* If tbttcount=1 then program it into the hardware - that is when
  it is easiest to program the correct starting offset (one TBTT +
  configured offset).
* .. later on check to see if it can be done on any tbttcount
* If the IE goes away then remove the quiet timer and clear the
  config
* Upon reset, state change, new beacon - clear quiet time IE
  and just let it resync from the next beacon.

History:

This was work done initially by sibridgetech.com in 2011/2012/2013
as part of some FreeBSD wifi DFS contracting work they had for a
third party.  They implemented the net80211 quiet time IE pieces
and had some test code for the station side which didn't entirely
use the timers correctly.

I figured out how to use the timers correctly without stopping/starting
the transmit DMA engine each time. When done correctly, the timer
just needs to be programmed once and left alone until the next
configuration change.

So, thanks to Himali Patel and Parthiv Shah for their work way
back then.  I finally figured it out and finished it!

TODO:

* Now, I'd rather net80211 did the quiet time IE tracking and parsing,
  pushing configurations into the driver is needed.  I'll look at
  doing that in a subsequent update.

* This doesn't handle multiple quiet time IEs, which will currently
  just mess things up.  I'll look into supporting that in the future
  (at least by only obeying "one" of them, and then ignoring
  subsequent IEs in a beacon/probe frame.)

* This also implements the STA side and not the AP side - the AP
  side will come later, and involves taking various other intervals
  into account (eg the beacon offset for multi-VAP modes, the
  SWBA time, etc, etc) as well as obtaining the configuration when
  a beacon is configured/generated rather than "hearing" an IE.

* .. investigate supporting quiet IE in mesh, tdma, ibss modes

* .. investigate supporting quiet IE for non-DFS channels
  (so this can be done for say, 2GHz channels.)

* Chances are i should commit NULL methods for the ar5210, ar5211 HALs..

Tested:

* AR9380, STA mode - announcing quiet, removing quiet, changing quite
  time config, whilst doing iperf testing;
* AR9380, AP mode.

7 years agoFix setting birthtime in ZFS
asomers [Thu, 9 Feb 2017 21:30:53 +0000 (21:30 +0000)]
Fix setting birthtime in ZFS

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
* In zfs_freebsd_setattr, if the caller wants to set the birthtime,
  set the bits that zfs_settattr expects

* In zfs_setattr, if XAT_CREATETIME is set, set xoa_createtime,
  expected by zfs_xvattr_set.  The two levels of indirection seem
  excessive, but it minimizes diffs vs OpenZFS.

* In zfs_setattr, check for overflow of va_birthtime (from delphij)

* Remove red herring in zfs_getattr

sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h
* Un-booby-trap some macros

New tests are under review at https://github.com/pjd/pjdfstest/pull/6

Reviewed by: avg
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9353

7 years agoCleanup on usr.sbin/arp/arp.c
garga [Thu, 9 Feb 2017 19:58:12 +0000 (19:58 +0000)]
Cleanup on usr.sbin/arp/arp.c

* 'blackhole' and 'reject' are mutually exclusive, replace printf() by errx()
  when both are selected.
* 'trail' option is no longer supported since first import of arp from 4.4BSD.
  XXX message was added 13 years ago in r128192. I believe it's time to remove
  it.
* Use warnx() to print some informative messages instead of printf()
* Replace strncmp() by strcmp() when validating parameters and exit when invalid
  parameter is found

Reviewed by: allanjude, vangyzen, cem
Approved by: allanjude
MFC after: 1 week
Sponsored by: Rubicon Communications (Netgate)
Differential Revision: https://reviews.freebsd.org/D9504

7 years agoAdd support for the Intel 82572EI back to em(4), it seems it was dropped
andrew [Thu, 9 Feb 2017 17:48:33 +0000 (17:48 +0000)]
Add support for the Intel 82572EI back to em(4), it seems it was dropped
when oving to iflib.

Reviewed by: sbruno
Sponsored by: ABT Systems Ltd
Differential Revision: https://reviews.freebsd.org/D9511

7 years agoufs: Use UFS_MAXNAMLEN constant
cem [Thu, 9 Feb 2017 17:47:01 +0000 (17:47 +0000)]
ufs: Use UFS_MAXNAMLEN constant

(like NFS, EXT2FS, SVR4, IBCS2) instead of redefining the MAXNAMLEN
constant.

No functional change.

Reviewed by: kib@, markj@
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D9500

7 years agoAdd I2C device hints for Onion Omega
allanjude [Thu, 9 Feb 2017 15:16:08 +0000 (15:16 +0000)]
Add I2C device hints for Onion Omega

This allows you to control up to 8 relay expansions from FreeBSD

https://github.com/freebsd/freebsd-wifi-build/wiki/Onion-Omega#controlling-the-relay-expansion

Reviewed by: adrian, mizhka
MFC after: 1 week
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D9503

7 years agorwlock: fix r313454
mjg [Thu, 9 Feb 2017 13:32:19 +0000 (13:32 +0000)]
rwlock: fix r313454

The runlock slow path would update wrong variable before restarting the
loop, in effect corrupting the state.

Reported by: pho

7 years agolocks: tidy up unlock fallback paths
mjg [Thu, 9 Feb 2017 08:19:30 +0000 (08:19 +0000)]
locks: tidy up unlock fallback paths

Update comments to note these functions are reachable if lockstat is
enabled.

Check if the lock has any bits set before attempting unlock, which saves
an unnecessary atomic operation.

7 years agoSet GDMA1 Frames Destination Port to Port 0 (CPU)
sgalabov [Thu, 9 Feb 2017 07:29:07 +0000 (07:29 +0000)]
Set GDMA1 Frames Destination Port to Port 0 (CPU)

Some U-Boot versions do not initialize MT7620's Frame Engine.
Then it is not possible to receive packets from the network.
Setting GDMA1 Frames Destination Port to Port 0 (CPU) in GDM Forwarding
Configuration register solves this issue.

Submitted by: Hiroki Mori (yamori813@yahoo.co.jp)
Reviewed by: adrian mizhka (previous version)
Differential Revision: https://reviews.freebsd.org/D9301

7 years ago[net80211] quiet IE handling improvements
adrian [Thu, 9 Feb 2017 04:07:30 +0000 (04:07 +0000)]
[net80211] quiet IE handling improvements

* on the station side, only call the quiet time IE method if we have a
  quiet IE - otherwise call the NULL method once, and then don't waste
  time calling NULL

* on the beacon generation side - force a beacon regeneration each time
  quiet time is enabled/disabled.  Without this, enabling/disabling quiet
  time IE would cause the beacon contents to be corrupted since none of
  the "move contents around" logic (like for CSA and TIM handling) is implemented.

This changes the size of ieee80211_node so it requires a kernel recompile,
but no userland recompile.

Tested:

* AR9380, AP mode, enabling/disabling quiet time IE
* AR9380, STA mode, with upcoming driver changes.

7 years agoDon't decrypt a core if a vmcore file already exists by default.
def [Wed, 8 Feb 2017 23:17:23 +0000 (23:17 +0000)]
Don't decrypt a core if a vmcore file already exists by default.
Allow to change this behaviour using the -f flag.

Approved by: pjd (mentor)

7 years agolld: Allow arbitrary code alignment in .eh_frame
emaste [Wed, 8 Feb 2017 20:31:54 +0000 (20:31 +0000)]
lld: Allow arbitrary code alignment in .eh_frame

According to the specification, CIE code alignment factor is an
arbitrary unsigned LEB128 encoded value.

PR: 216908
Reported by: Wolfgang Meyer
Obtained from: Upstream LLD r277105
MFC after: 1 week

7 years agoFix style(9)
garga [Wed, 8 Feb 2017 20:21:29 +0000 (20:21 +0000)]
Fix style(9)

Reviewed by: vangyzen, allanjude, cem
Approved by: allanjude
MFC after: 1 week
Sponsored by: Rubicon Communications (Netgate)
Differential Revision: https://reviews.freebsd.org/D9494

7 years agosx: implement slock/sunlock fast path
mjg [Wed, 8 Feb 2017 19:29:34 +0000 (19:29 +0000)]
sx: implement slock/sunlock fast path

See r313454.

7 years agorwlock: implemenet rlock/runlock fast path
mjg [Wed, 8 Feb 2017 19:28:46 +0000 (19:28 +0000)]
rwlock: implemenet rlock/runlock fast path

This improves singlethreaded throughput on my test machine from ~247 mln
ops/s to ~328 mln.

It is mostly about avoiding the setup cost of lockstat.

Reviewed by: jhb (previous version)

7 years agoImplement LOCKSTAT_OOL_PROFILE_ENABLED
mjg [Wed, 8 Feb 2017 19:25:58 +0000 (19:25 +0000)]
Implement LOCKSTAT_OOL_PROFILE_ENABLED

For use in uninlined locking primitives to decide whether lockstat
or profiling needs to be taken care of.

7 years agoloader: possible NULL pointer dereference in bcache.c
tsoome [Wed, 8 Feb 2017 18:32:53 +0000 (18:32 +0000)]
loader: possible NULL pointer dereference in bcache.c

Coverity detected the possible NULL pointer dereference case.
Also updated comment as was suggested in illumos review.

CID: 1371008
Reported by: Coverity
Reviewed by: allanjude
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D9496

7 years agoTrim trailing whitespace (mostly introduced in r313407).
jhb [Wed, 8 Feb 2017 17:45:23 +0000 (17:45 +0000)]
Trim trailing whitespace (mostly introduced in r313407).

Sponsored by: DARPA / AFRL

7 years agobsdinstall: Make sure chroot filesystems are umounted after use
garga [Wed, 8 Feb 2017 17:03:52 +0000 (17:03 +0000)]
bsdinstall: Make sure chroot filesystems are umounted after use

* DISTDIR_IS_UNIONFS is set every time BSDINSTALL_DISTDIR is mounted inside
  BSDINSTALL_CHROOT. Use this flag to decide if it needs to be umounted
* BSDINSTALL_CHROOT/dev is mounted when 'bsdinstall mount' is called, there is
  no need to mount it again when user goes to shell after installation

Reviewed by: allanjude
Obtained from: pfSense
MFC after: 1 week
Sponsored by: Rubicon Communications (Netgate)
Differential Revision: https://reviews.freebsd.org/D8573

7 years agoEnsure the idle thread's loop services interrupts in a timely way when
jtl [Wed, 8 Feb 2017 16:46:57 +0000 (16:46 +0000)]
Ensure the idle thread's loop services interrupts in a timely way when
using the ACPI C1/mwait sleep method.

Previously, the mwait instruction would return when an interrupt was
pending; however, the idle loop did not actually enable interrupts when
this occurred. This led to a situation where the idle loop could quickly
spin through the C1/mwait sleep method a number of times when an interrupt
was pending. (Eventually, the situation corrected itself when something
other than an interrupt triggered the idle loop to either enable interrupts
or schedule another thread.)

Reviewed by: kib, imp (earlier version)
Input from: jhb
MFC after: 1 week
Sponsored by: Netflix

7 years agoloader: possible NULL pointer dereference in efipart.c
tsoome [Wed, 8 Feb 2017 15:52:09 +0000 (15:52 +0000)]
loader: possible NULL pointer dereference in efipart.c

Fix bugs found by Coverity in efipart.c.

The Issue is that efi_devpath_last_node() can return NULL pointer, and
therefore we should check for it. In real life we really do not
expect to see it to happen, so we will just error out from the test.

CID: 1371004
Reported by: Coverity
Reviewed by: allanjude
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D9490

7 years agoMerge content from ^/projects/netbsd-tests-upstream-01-2017 into ^/head
ngie [Wed, 8 Feb 2017 09:46:15 +0000 (09:46 +0000)]
Merge content from ^/projects/netbsd-tests-upstream-01-2017 into ^/head

The primary end-goal of this drop is ease future merges with NetBSD and
collaborate further with the NetBSD project.

The goal was (largely, not completely as some items are still oustanding
in the NetBSD GNATS system) achieved by doing the following:
- Pushing as many changes required to port contrib/netbsd-tests
  back to NetBSD as possible, then pull the upstream applied changes
  back in to FreeBSD.
- Diff reduce with upstream where possible by:
-- Improving libnetbsd header, etc compat glue.
-- Using _SED variables to modify test scripts on the fly for items
   that could not be upstreamed to NetBSD.

As a bonus for this work, this change also introduces testcases for
uniq(1).

Many thanks to Christos for working with me to get many of the changes
back into the NetBSD project.

In collaboration with: Christos Zoulas <christos@netbsd.org>
MFC after: 1 month
Sponsored by: Dell EMC Isilon

7 years agoClean up trailing and leading whitespace for variables to make it
ngie [Wed, 8 Feb 2017 09:24:25 +0000 (09:24 +0000)]
Clean up trailing and leading whitespace for variables to make it
consistent with the rest of the file and style.Makefile(9) a bit
more

MFC after: 3 weeks
Sponsored by: Dell EMC Isilon