]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoWhen clearing rtmsg, pass &rtmsg to bzero() instead of the address of
truckman [Tue, 17 May 2016 04:03:45 +0000 (04:03 +0000)]
When clearing rtmsg, pass &rtmsg to bzero() instead of the address of
just the header

Reported by: Coverity
CID: 10075681194256
MFC after: 1 week

8 years agoMark the unused arguments of various SYSINIT functions __unused.
bz [Tue, 17 May 2016 00:32:36 +0000 (00:32 +0000)]
Mark the unused arguments of various SYSINIT functions __unused.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

8 years ago[mips] also add otus/urtwn USB modules.
adrian [Tue, 17 May 2016 00:31:37 +0000 (00:31 +0000)]
[mips] also add otus/urtwn USB modules.

I'm using both AR933x (because the boards fit in small boxes) as well
as AR934x for doing USB wifi testing on MIPS.

So far so good, for both of them.

8 years ago[mips] add urtwn and otus NIC modules.
adrian [Tue, 17 May 2016 00:30:34 +0000 (00:30 +0000)]
[mips] add urtwn and otus NIC modules.

I'm using this platform for testing USB wifi on MIPS.

8 years agoUse != 0 to be clear
sjg [Tue, 17 May 2016 00:27:18 +0000 (00:27 +0000)]
Use != 0 to be clear

8 years agoAttempt to fix r299660:
peter [Tue, 17 May 2016 00:24:53 +0000 (00:24 +0000)]
Attempt to fix r299660:
slba is used only for the GPT case.
elba is used if either GPT or LOADER_GELI_SUPPORT is enabled.

8 years ago[bhnd] Centralize fetching of board information
adrian [Tue, 17 May 2016 00:23:46 +0000 (00:23 +0000)]
[bhnd] Centralize fetching of board information

Centralizes fetching of board information (vendor, type, revision, etc),
and adds support for matching quirks against board identification info.

* Adds a BHND_BUS_READ_BOARD_INFO(), allowing bhnd bus/bus parent(s) to
  handle implementation-specific fetching of board info.
* Integrates board type constants from the latest Broadcom ISC-licensed
  bcmdevs.h included in dd-wrt's Broadcom driver source drops.
* Adds support for matching on chip/board quirks to bhnd_device_quirks()/
  bhnd_chip_quirks().
* Use the new board/chip quirk matching to match Apple devices that failed
  to set BFL2_PCIEWAR_OVR in SROM.

Submitted by: Landon Fuller <landonf@landonf.org>
Differential Revision: https://reviews.freebsd.org/D6361

8 years agoAllow -f - to read from stdin.
sjg [Tue, 17 May 2016 00:08:43 +0000 (00:08 +0000)]
Allow -f - to read from stdin.

8 years ago[mips/broadcom] Add initial support for Broadcom MIPS processor
adrian [Tue, 17 May 2016 00:00:01 +0000 (00:00 +0000)]
[mips/broadcom] Add initial support for Broadcom MIPS processor

Relies on BHND(4) driver.

There files contains machine-dependent code for Broadcom MIPS processor and
provide UART driver.

This is a work in progress; it and the current bhnd code is enough to boot
on the ASUS RT-N16 and RT-N53 platforms.

Submitted by: Michael Zhilin <mizhka@gmail.com>
Differential Revision: https://reviews.freebsd.org/D6251

8 years ago[mips] Improve MIPS trampoline code
adrian [Mon, 16 May 2016 23:56:31 +0000 (23:56 +0000)]
[mips] Improve MIPS trampoline code

This patch fix trampoline build. inckern.S increases stack and calls _startC
of elf_trampoline, so inckern.S should be called before elf_trampoline. gcc4.2 puts
text (code) into image according to order of source files in this call, so order has changed.

In addition make will install trampoline kernel. It allows to use kernel for firmware build.

Submitted by: Michael Zhilin <mizhka@gmail.com>
Differential Revision: https://reviews.freebsd.org/D6242

8 years ago[mips/broadcom] Add initial code for interrupts on the Broadcom MIPS processor
adrian [Mon, 16 May 2016 23:54:28 +0000 (23:54 +0000)]
[mips/broadcom] Add initial code for interrupts on the Broadcom MIPS processor

Broadcom MIPS processor doesn't reset TI flag if additional manipulation
is done.

Thanks to @sobomax!

8 years agoDon't walk off the end of the array when proto isn't explicitly
truckman [Mon, 16 May 2016 23:47:08 +0000 (23:47 +0000)]
Don't walk off the end of the array when proto isn't explicitly
listed above.  Instead update the catch-all "Others" bucket.

Reported by: Coverity
CID: 10075711007572
MFC after: 1 week

8 years ago[bhnd] Add logging macros to BHND.
adrian [Mon, 16 May 2016 23:40:32 +0000 (23:40 +0000)]
[bhnd] Add logging macros to BHND.

There are 5 logging levels:

* ERROR
* WARN
* INFO
* DEBUG
* TRACE

There are 2 logging context:

* with
* without device

DEBUG and TRACE records are printed only if bootverbose.
Logging records are printed with source code line information if acceptable
logging level is DEBUG or TRACE.

Submitted by: Michael Zhilin <mizhka@gmail.com>
Differential Revision: https://reviews.freebsd.org/D6247

8 years ago[bhnd] Add support for matching of MIPS & ARM cores
adrian [Mon, 16 May 2016 23:37:18 +0000 (23:37 +0000)]
[bhnd] Add support for matching of MIPS & ARM cores

Extend macros for MIPS & ARM cores. Now only BCM cores can be matched by matching mechanism.

Submitted by: Michael Zhilin <mizhka@gmail.com>
Differential Revision: https://reviews.freebsd.org/D6246

8 years agoSet ai2 to NULL in in find_host() before the loop and after calling
truckman [Mon, 16 May 2016 23:29:04 +0000 (23:29 +0000)]
Set ai2 to NULL in in find_host() before the loop and after calling
freeaddrinfo() on it to indicate that it doesn't point to a valid
addrinfo list.  This fixes this Coverity issues:
1006368 Uninitialized pointer read
1018506 Double free
1305590 Resource leak
that can be triggered in the hp->hostname[0] != '\0' case.

Don't treat a character as a boolean.

Fix these Coverity issues:
1009293 Unchecked return value from library
1194246 Wrong size argument
by tweaking the status file extend code.

Reported by: Coverity
CID: 10063681018506130559010092931194246
Reviewed by: rmacklem
Feedback from: hrs
MFC after: 1 week
Differential Revision: D6398

8 years agoActually use the loop interation limit so carefully computed on the
truckman [Mon, 16 May 2016 23:00:48 +0000 (23:00 +0000)]
Actually use the loop interation limit so carefully computed on the
previous line to prevent buffer overflow.  This turns out to not be
important because the upstream xdr code already capped the object
size at the proper value.  Using the correct limit here looks a lot
less scary and should please Coverity.

Reported by: Coverity
CID: 11993091199310
MFC after: 1 week

8 years ago[bwn] add opt_wlan.h / opt_bwn.h for build-time control
adrian [Mon, 16 May 2016 22:57:36 +0000 (22:57 +0000)]
[bwn] add opt_wlan.h / opt_bwn.h for build-time control

This is a separate commit as I have local changes to bwn for now and
this needs a manual merge/commit.

Sponsored by: Palm Springs

8 years ago[bwn] add opt_wlan.h and opt_bwn.h so we can enable bwn debugging as appropriate.
adrian [Mon, 16 May 2016 22:56:45 +0000 (22:56 +0000)]
[bwn] add opt_wlan.h and opt_bwn.h so we can enable bwn debugging as appropriate.

Tested:

* BCM4322, STA mode (11a)

Sponsored by: Palm Springs

8 years ago[bwn] switch to ieee80211_add_channel()
adrian [Mon, 16 May 2016 22:39:17 +0000 (22:39 +0000)]
[bwn] switch to ieee80211_add_channel()

This is an updated version of D6140.

Tested:

* BCM4321 11abgn, STA mode (11a)

Submitted by: avos
Differential Revision: https://reviews.freebsd.org/D6140

8 years agoUse polling spin loops for timeouts during early boot.
jhb [Mon, 16 May 2016 21:33:31 +0000 (21:33 +0000)]
Use polling spin loops for timeouts during early boot.

Some ACPI operations such as mutex acquires and event waits accept a
timeout.  The ACPI OSD layer implements these timeouts by using regular
sleep timeouts.  However, this doesn't work during early boot before
event timers are setup.  Instead, use polling combined with DELAY()
to spin.

This fixes booting on upcoming Intel systems with Kaby Lake processors.

Tested by: "Jeffrey E Pieper" <jeffrey.e.pieper@intel.com>
Reviewed by: jimharris
MFC after: 1 week

8 years ago[bwn] check DUALPHY; add BCM4322 to the don't-override list.
adrian [Mon, 16 May 2016 20:26:30 +0000 (20:26 +0000)]
[bwn] check DUALPHY; add BCM4322 to the don't-override list.

* DUALPHY in TGSHIGH tells us there's a phy that is dualband, rather than
  two separate PHYs/MACs (which we almost but don't quite yet support.)
  Use it.

* Add the BCM4322 PCI ID to the list of devices we don't override.
  This means the 2g/5g flags are preserved, and thus we get 5GHz
  operation (with N-PHY, of course.)

Tested:

* BCM4311, STA mode (11bg)
* BCM4312, STA mode (11bg)
* BCM4321, STA mode (11abg)

Sponsored by: Palm Springs

8 years ago[siba] fix up debugging.
adrian [Mon, 16 May 2016 20:22:52 +0000 (20:22 +0000)]
[siba] fix up debugging.

* unbreak non-debug builds - don't default to debugging SCAN; that was
  left-over from my testing.
* include opt_siba.h, now that it's generated as appropriate.
* stick the debug enum outside the debug block, just so it's there for
  any code that wants to set siba_debug for some reason (like say,
  my debugging muckup.)
* make DPRINTF() use __VA_ARGS__ for formatting too, so it correctly
  handles printing w/ no args.
* Make DPRINTF() use device_printf().

Sponsored by: Palm Springs

8 years ago[siba] add SIBA_DEBUG option.
adrian [Mon, 16 May 2016 20:18:54 +0000 (20:18 +0000)]
[siba] add SIBA_DEBUG option.

Sponsored by: Palm Springs

8 years agodev/ow: Tag an unreachable switch default.
pfg [Mon, 16 May 2016 20:04:38 +0000 (20:04 +0000)]
dev/ow: Tag an unreachable switch default.

Coverity reports an uninitialized "dir" in case the switch defaults
without hitting any case. Respect the original intent and quell the
false positive with the relatively new __unreachable() builtin.

CID: 1331566

8 years agolibefi: Tag an unreachable switch default.
pfg [Mon, 16 May 2016 20:00:09 +0000 (20:00 +0000)]
libefi: Tag an unreachable switch default.

Coverity reports an uninitialized "len" in case the switch defaults
without hitting any case. Respect the original intent and quell the
false positive with the relatively new __unreachable() builtin.

CID: 1347796

8 years agoFix off by one error that overflowed the rep_len array when doing
truckman [Mon, 16 May 2016 19:48:02 +0000 (19:48 +0000)]
Fix off by one error that overflowed the rep_len array when doing
the final NUL termination.

Reported by: Coverity
CID: 1007617
MFC after: 1 week

8 years agoAdd a small set of logical operators to DDB command language.
pfg [Mon, 16 May 2016 19:42:38 +0000 (19:42 +0000)]
Add a small set of logical operators to DDB command language.

This are based on Mach3.
Documentation is pending but has been promised.

Submitted by: Dan Partelly
Reviewed by: adrian, jhb (older version)

Differential Revision: https://reviews.freebsd.org/D4230
RelNotes: yes

8 years ago[siba] make the debug code somewhat useful again.
adrian [Mon, 16 May 2016 19:39:05 +0000 (19:39 +0000)]
[siba] make the debug code somewhat useful again.

It's still not configurable by a kernel option; that'll come next.

Sponsored by: Palm Springs

8 years agourtwn: add support for hardware multicast filter setup.
avos [Mon, 16 May 2016 19:10:59 +0000 (19:10 +0000)]
urtwn: add support for hardware multicast filter setup.

Tested with RTL8188EU and RTL8188CUS.

8 years agoAdd HWPMC_HOOKS to std.armv6 to make them available
bz [Mon, 16 May 2016 19:07:58 +0000 (19:07 +0000)]
Add HWPMC_HOOKS to std.armv6 to make them available
so the module could be loaded.

Discussed with: andrew
Reviewed by: andrew
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D6359

8 years agoOnly lock Giant when needed in the LinuxKPI.
hselasky [Mon, 16 May 2016 17:41:25 +0000 (17:41 +0000)]
Only lock Giant when needed in the LinuxKPI.

Suggested by: ngie @
MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agoReduce verbosity of "now sending synthesized status" message.
mav [Mon, 16 May 2016 17:18:26 +0000 (17:18 +0000)]
Reduce verbosity of "now sending synthesized status" message.

MFC after: 1 week

8 years agoNo need to check login status for ZOMBIE ports.
mav [Mon, 16 May 2016 16:44:34 +0000 (16:44 +0000)]
No need to check login status for ZOMBIE ports.

ZOMBIE ports are always logged out, and so initiator may try to relogin.

MFC after: 1 weeks

8 years agoFix an off by one error to avoid overflowing rp[].
truckman [Mon, 16 May 2016 16:16:46 +0000 (16:16 +0000)]
Fix an off by one error to avoid overflowing rp[].

Reported by: Coverity
CID: 1007579

8 years agoIncrease size of argv[] array to avoid running off the end.
truckman [Mon, 16 May 2016 16:01:46 +0000 (16:01 +0000)]
Increase size of argv[] array to avoid running off the end.

Reported by: Coverity
CID: 1193819
MFC after: 1 week

8 years agodo not destroy 'snapdir' when it becomes inactive
avg [Mon, 16 May 2016 15:48:56 +0000 (15:48 +0000)]
do not destroy 'snapdir' when it becomes  inactive

That was just wrong.  In fact, we can safely keep this static entry when
it's inactive.
Now the destructive action is moved to the reclaim method and the
function is renamed from zfsctl_snapdir_inactive(0 to
zfsctl_snapdir_reclaim().

Also, we can use gfs_vop_reclaim() instead of gfs_dir_inactive() +
kmem_free().

Lastly, we can just assert that the node does not any children when it
is reclaimed, even on the force unmount.  That's because zfs_umount()
does an extra vflush() pass which should destroy all snapshot-mountpoint
vnodes that are the snapdir's children.

MFC after: 5 weeks

8 years agoFix off by one error in index limit calculation
truckman [Mon, 16 May 2016 15:42:59 +0000 (15:42 +0000)]
Fix off by one error in index limit calculation

Reported by: Coverity
CID: 1193826

8 years agotry to recycle "snap" vnodes as soon as possible
avg [Mon, 16 May 2016 15:37:41 +0000 (15:37 +0000)]
try to recycle "snap" vnodes as soon as possible

Those vnodes should not linger.  "Stale" nodes may get out of
synchronization with actual snapshots.  For example if we destroy a
snapshot and create a new one with the same name.  Or when we rename a
snapshot.

While there fix the argument type for zfsctl_snapshot_reclaim().
Also, its original argument can be passed to gfs_vop_reclaim() directly.

Bug 209093 could be related although I have not specifically verified
that.  Referencing just in case.

PR: 209093
MFC after: 5 weeks

8 years agoSet retval in the empty password case to avoid a path through the
truckman [Mon, 16 May 2016 15:32:02 +0000 (15:32 +0000)]
Set retval in the empty password case to avoid a path through the
code that fails to set retval before falling through to the final
return().

Reported by: emaste
Reported by: Coverity
CID: 1018711
MFC after: 1 week

8 years agofix locking in zfsctl_root_lookup
avg [Mon, 16 May 2016 15:28:39 +0000 (15:28 +0000)]
fix locking in zfsctl_root_lookup

Dropping the root vnode's lock after VFS_ROOT() didn't really help the
fact that we acquired the lock while holding its child's, .zfs, lock
while performing the operaiton.
So, directly use zfs_zget() to get the root vnode.

While there simplify the code in zfsctl_freebsd_root_lookup.
We know that .zfs is always exclusively locked.
We know that there is already a reference on *vpp, so no need for an
extra one.
Account for the fact that .. lookup may ask for a different lock type,
not necessarily LK_EXCLUSIVE.  And handle a possible failure to acquire
the lock given the lock flags.

MFC after: 5 weeks

8 years agogfs_lookup_dot() does not have to acquire any locks
avg [Mon, 16 May 2016 15:13:16 +0000 (15:13 +0000)]
gfs_lookup_dot() does not have to acquire any locks

In fact, that was dangerous.  For example, zfsctl_snapshot_reclaim()
calls gfs_dir_lookup() on ".." path and that ends up calling
gfs_lookup_dot() which violated locking order by acquiring the parent's
directory vnode lock after the child's vnode lock.

Also, the previous behavior was inconsistent as gfs_dir_lookup()
returned a locked vnode for . and .. lookups, but not for any other.

Now gfs_lookup_dot() just references a resulting vnode and the locking
is done in its consumers, where necessary.
Note that we do not enable shared locking support for any gfs / zfsctl
vnodes.

This commit partially reverts r273641.

MFC after: 5 weeks

8 years agoavoid deadlock between zfsctl_snapdir_lookup and zfsctl_snapshot_reclaim
avg [Mon, 16 May 2016 15:03:52 +0000 (15:03 +0000)]
avoid deadlock between zfsctl_snapdir_lookup and zfsctl_snapshot_reclaim

The former acquired a snap vnode lock while holding sd_lock while the
latter does the opposite.

The solution is drop sd_lock before acquiring the vnode lock.  That
should be okay as we are still holding a lock on the 'snapshot'
directory in the exclusive mode.  That lock ensures that there are no
concurrent lookups in the directory and thus no concurrent mount attempts.

But now we have to account for the possibility that the snap vnode
might get reclaim after we drop sd_lock and before we can get
the node lock.  So, check for that case and retry.

MFC after: 5 weeks

8 years agoAdd intrng support to the GICv3 driver. It lacks ITS support so won't handle
andrew [Mon, 16 May 2016 14:07:43 +0000 (14:07 +0000)]
Add intrng support to the GICv3 driver. It lacks ITS support so won't handle
MSI or MSI-X interrupts, however this is enought to boot FreeBSD under the
ARM Foundation Model with a GICv3 interrupt controller.

Approved by: ABT Systems Ltd
Relnotes: yes
Sponsored by: The FreeBSD Foundation

8 years agolibthr(3): Fix xref to _umtx_op(2) now that we have it.
jilles [Mon, 16 May 2016 13:39:04 +0000 (13:39 +0000)]
libthr(3): Fix xref to _umtx_op(2) now that we have it.

8 years agoinstall: Revert utimensat usage (r299850).
jilles [Mon, 16 May 2016 12:56:28 +0000 (12:56 +0000)]
install: Revert utimensat usage (r299850).

This should fix the build on older stable/10, since install is a bootstrap
tool.

Pending a decision how to fix this properly, revert utimensat usage. Copies
with the -p option will again appear older than the original almost always,
but -p is not commonly used.

8 years agoCall ofw_bus_msimap to find the parent MSI controller, it may not use the
andrew [Mon, 16 May 2016 12:18:30 +0000 (12:18 +0000)]
Call ofw_bus_msimap to find the parent MSI controller, it may not use the
msi-parent property.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

8 years agofix a vnode reference leak caused by illumos compat traverse()
avg [Mon, 16 May 2016 12:15:19 +0000 (12:15 +0000)]
fix a vnode reference leak caused by illumos compat traverse()

This commit partially reverts r273641 which introduced the leak.
It did so to accomodate for some consumers of traverse() that expected
the starting vnode to stay as-is.  But that introduced the leak in the
case when a mounted filesystem was found and its root vnode was
returned.

r299914 removed the troublesome consumers and now there is no reason to
keep the starting vnode.  So, now the new rules are:
- if there is no mounted filesystem, then nothing is changed
- otherwise the starting vnode is always released
- the root vnode of the mounted filesystem is returned locked and
  referenced in the case of success

MFC after: 5 weeks
X-MFC after: r299914

8 years agoMove the call to intr_pic_init_secondary to the same place as in the
andrew [Mon, 16 May 2016 12:02:06 +0000 (12:02 +0000)]
Move the call to intr_pic_init_secondary to the same place as in the
non-intrng case.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

8 years agofix up r299902: mount_snapshot requires that the covered vnode is locked
avg [Mon, 16 May 2016 11:48:43 +0000 (11:48 +0000)]
fix up r299902: mount_snapshot requires that the covered vnode is locked

Previously that was not strictly enforced.

MFC after: 4 weeks
X-MFC with: r299902

8 years agortwn: fix double free in raw xmit path.
avos [Mon, 16 May 2016 10:51:35 +0000 (10:51 +0000)]
rtwn: fix double free in raw xmit path.

Reported by: mva

8 years agoAdd support for intrng to arm64. As the GICv3 drivers will need to be
andrew [Mon, 16 May 2016 10:48:51 +0000 (10:48 +0000)]
Add support for intrng to arm64. As the GICv3 drivers will need to be
updated, and until further testing can be done, this is disabled for now.

It is expected arm64 will switch to this interface, and the old interface
will be removed before 11.0 is released.

Obtained from: ABT Systems Ltd
Relnotes: yes
Sponsored by: The FreeBSD Foundation

8 years agoTeach the ThunderX PCI PEM driver about intrng. This will be used later
andrew [Mon, 16 May 2016 10:03:57 +0000 (10:03 +0000)]
Teach the ThunderX PCI PEM driver about intrng. This will be used later
when arm64 is supported by intrng.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

8 years agoImplement more Linux device related functions in the LinuxKPI. While
hselasky [Mon, 16 May 2016 09:56:48 +0000 (09:56 +0000)]
Implement more Linux device related functions in the LinuxKPI. While
at it use NULL for some pointer checks.

Bump the FreeBSD version to force recompilation of all kernel modules
due to a structure size change.

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

8 years agoAdd a pcib interface for use by interrupt controllers that need to
andrew [Mon, 16 May 2016 09:31:44 +0000 (09:31 +0000)]
Add a pcib interface for use by interrupt controllers that need to
translate the pci rid to a controller ID. The translation could be based
on the 'msi-map' OFW property, a similar ACPI option, or hard-coded for
hardware lacking the above options.

Reviewed by: wma
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

8 years agoDon't dereference parent pointer when it is NULL.
hselasky [Mon, 16 May 2016 09:25:56 +0000 (09:25 +0000)]
Don't dereference parent pointer when it is NULL.

MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agoProperly implement "cpu_has_clflush" macro.
hselasky [Mon, 16 May 2016 09:16:15 +0000 (09:16 +0000)]
Properly implement "cpu_has_clflush" macro.

Suggested by: kib, jhb
MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agoRe-commit r299467 having fixed the build:
andrew [Mon, 16 May 2016 09:15:50 +0000 (09:15 +0000)]
Re-commit r299467 having fixed the build:

Add a new get_id interface to pci and pcib. This will allow us to both
detect failures, and get different PCI IDs.

For the former the interface returns an int to signal an error. The ID is
returned at a uintptr_t * argument.

For the latter there is a type argument that allows selecting the ID type.
This only specifies a single type, however a MSI type will be added
to handle the need to find the ID the hardware passes to the ARM GICv3
interrupt controller.

A follow up commit will be made to remove pci_get_rid.

Reviewed by:    jhb, rstone (previous version)
Obtained from:  ABT Systems Ltd
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D6239

8 years agoIntroduce MSI and MSI-X support to intrng. This adds a new msi device
andrew [Mon, 16 May 2016 09:11:40 +0000 (09:11 +0000)]
Introduce MSI and MSI-X support to intrng. This adds a new msi device
interface with 5 methods to mirror the 5 MSI/MSI-X methods in the pcib
interface. The pcib driver will need to perform a device specific lookup
to find the MSI controller and pass this to intrng as the xref. Intrng
will finally find the controller and have it handle the requested operation.

Obtained from: ABT Systems Ltd
MFH: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D5985

8 years agohyperv/vmbus: Use atomic_testandclear
sephe [Mon, 16 May 2016 08:50:32 +0000 (08:50 +0000)]
hyperv/vmbus: Use atomic_testandclear

Prepare to use unsigned long for event channel bit array.

Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6382

8 years agoHoist the getpwnam() call outside the first if/else block in
truckman [Mon, 16 May 2016 08:34:17 +0000 (08:34 +0000)]
Hoist the getpwnam() call outside the first if/else block in
pam_sm_chauthtok().  Set user = getlogin() inside the true
branch so that it is initialized for the following PAM_LOG()
call.  This is how it is done in pam_sm_authenticate().

Reported by: Coverity
CID: 272498
MFC after: 1 week

8 years agosfxge(4): cleanup: quieten more common code MCDI handlers
arybchik [Mon, 16 May 2016 08:32:21 +0000 (08:32 +0000)]
sfxge(4): cleanup: quieten more common code MCDI handlers

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

8 years agosfxge(4): cleanup: remove misnamed function declaration
arybchik [Mon, 16 May 2016 08:28:27 +0000 (08:28 +0000)]
sfxge(4): cleanup: remove misnamed function declaration

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

8 years agosfxge(4): cleanup: make MCDI license queries quieter in common code
arybchik [Mon, 16 May 2016 08:27:20 +0000 (08:27 +0000)]
sfxge(4): cleanup: make MCDI license queries quieter in common code

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

8 years agoDon't call free_addrselectpolicy(&policyhead) before policyhead has been
truckman [Mon, 16 May 2016 08:13:30 +0000 (08:13 +0000)]
Don't call free_addrselectpolicy(&policyhead) before policyhead has been
initialized.

Reported by: Coverity
CID: 1018727

8 years agoAdd an assertion to catch a potential underflow in an array index
truckman [Mon, 16 May 2016 08:07:32 +0000 (08:07 +0000)]
Add an assertion to catch a potential underflow in an array index
calculation, though this should not happen in the current code.

Reported by: Coverity
CID: 1008486
MFC after: 3 weeks

8 years agosfxge(4): cleanup: simplify ef10_ev_qcreate
arybchik [Mon, 16 May 2016 08:04:40 +0000 (08:04 +0000)]
sfxge(4): cleanup: simplify ef10_ev_qcreate

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

8 years agosfxge(4): translate MC_CMD_ERR_EEXIST to host errno value
arybchik [Mon, 16 May 2016 07:47:20 +0000 (07:47 +0000)]
sfxge(4): translate MC_CMD_ERR_EEXIST to host errno value

This is needed because the new MCDI command nvram_private_append can
return MC_CMD_ERR_EEXIST

Submitted by:   Tom Millington <tmillington at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

8 years agofxge(4): cleanup: run genfwdef to propogate prior changes to TLV headers
arybchik [Mon, 16 May 2016 07:45:43 +0000 (07:45 +0000)]
fxge(4): cleanup: run genfwdef to propogate prior changes to TLV headers

Submitted by:   Andrew Lee <alee at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

8 years agosfxge(4): set TSOv2 feature flag on Medford
arybchik [Mon, 16 May 2016 07:33:56 +0000 (07:33 +0000)]
sfxge(4): set TSOv2 feature flag on Medford

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

8 years agovfs_read_dirent: increment ncookies after adding a cookie
avg [Mon, 16 May 2016 07:31:11 +0000 (07:31 +0000)]
vfs_read_dirent: increment ncookies after adding a cookie

It seems that at present vfs_read_dirent() is used only with filesystems
that do not support cookies, so the bug never manifested itself.

MFC after: 1 week

8 years agosfxge(4): improve TX/RX queue error messages
arybchik [Mon, 16 May 2016 07:29:50 +0000 (07:29 +0000)]
sfxge(4): improve TX/RX queue error messages

Report the full error descriptor in a form that can be passed to
firmwaresrc/dpcpu/scripts/evdecode

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

8 years agozfsctl_ops_snapshot: remove methods should never be called
avg [Mon, 16 May 2016 07:24:30 +0000 (07:24 +0000)]
zfsctl_ops_snapshot: remove methods should never be called

We pretend that snapshots mounted under .zfs are part of the original
filesystem and we try very hard to hide vnodes on top of which the snapshots
are mounted.  Given that I believe that the removed operations should
never be called.  They might have been called previously because
of issues fixed in r299906, r299908 and r299913.

MFC after: 5 weeks

8 years agodounmount: do not call mountcheckdirs() for mounts with MNT_IGNORE
avg [Mon, 16 May 2016 07:23:24 +0000 (07:23 +0000)]
dounmount: do not call mountcheckdirs() for mounts with MNT_IGNORE

This is a bit hackish, but the flag is currently set only for ZFS
snapshots mounted under .zfs.  mountcheckdirs() can change cdir/rdir
references to a covered vnode.  But for the said snapshots the covered
vnode is really ephemeral and it must never be accessed (except
for a few specific cases).

To do: consider removing mountcheckdirs() entirely

MFC after: 5 days

8 years agoatomic: Add testandclear on i386/amd64
sephe [Mon, 16 May 2016 07:19:33 +0000 (07:19 +0000)]
atomic: Add testandclear on i386/amd64

Reviewed by: kib
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6381

8 years agosfxge(4): fix license validation check for V3 licenses
arybchik [Mon, 16 May 2016 07:12:04 +0000 (07:12 +0000)]
sfxge(4): fix license validation check for V3 licenses

Length consistency checks were failing for ECC hashes.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

8 years agoIntroduce basic etherswitch support for Ralink SoCs
sgalabov [Mon, 16 May 2016 07:00:49 +0000 (07:00 +0000)]
Introduce basic etherswitch support for Ralink SoCs

This revision introduces basic support for the internal ESW switch found
Ralink/Mediatek SoCs such as RT3050, RT3352, RT5350, MT7628; and GSW
found in MT7620 and MT7621.

It only supports 802.1q VLANs and doesn't support external PHYs at the
moment (only the ones that are built into the switch itself).

Approved by: adrian (mentor)
Sponsored by: Smartcom - Bulgaria AD
Differential Revision: https://reviews.freebsd.org/D6348

8 years agosfxge(4): regenerate MCDI headers from firmwaresrc .yml
arybchik [Mon, 16 May 2016 06:59:12 +0000 (06:59 +0000)]
sfxge(4): regenerate MCDI headers from firmwaresrc .yml

Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

8 years agozfsctl_snapdir_lookup: always clear VV_ROOT flag of snapshot's root VV_ROOT
avg [Mon, 16 May 2016 06:49:09 +0000 (06:49 +0000)]
zfsctl_snapdir_lookup: always clear VV_ROOT flag of snapshot's root VV_ROOT

Previosuly we did that only if the snapshot was mounted earlier, its
root vnode got recycled and then we accessed it again.
We never cleared the flag for a freshly mounted snapshot.

That was very inconsistent and probably a source of some bugs.
Or maybe that painted over some bugs which might get revealed now.

We should consistently clear the flag because we try very hard to
pretend that snapshots auto-mounted under .zfs are part of their
original filesystem.  In other words, we try to hide the fact that they
are different filesystems / mountpoints.

MFC after: 5 weeks

8 years agosfxge(4): increase maximum size of license keys
arybchik [Mon, 16 May 2016 06:42:45 +0000 (06:42 +0000)]
sfxge(4): increase maximum size of license keys

Increase buffer sizes for license keys to 160 bytes to accomodate ECDSA
hashes.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

8 years agoadd zfs_vptocnp with special handling for snapshots under .zfs
avg [Mon, 16 May 2016 06:40:51 +0000 (06:40 +0000)]
add zfs_vptocnp with special handling for snapshots under .zfs

The logic is similar to that already present in zfs_dirlook() to handle
a dot-dot lookup on a root vnode of a snapshot mounted under
.zfs/snapshot/.
illumos does not have an equivalent of vop_vptocnp, so there only the
lookup had to be patched up.

MFC after: 4 weeks

8 years agosfxge(4): fix V1 licensing MCDI operations
arybchik [Mon, 16 May 2016 06:40:17 +0000 (06:40 +0000)]
sfxge(4): fix V1 licensing MCDI operations

Implementation of the MCDI commands for Siena boards was requesting
the wrong operation.

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

8 years agosfxge(4): improve PCIe link speed and width check
arybchik [Mon, 16 May 2016 06:38:51 +0000 (06:38 +0000)]
sfxge(4): improve PCIe link speed and width check

Perform a more accurate check of whether the PCIe bandwidth is
sufficient for the current/supported port modes.

Give a different warning if there is sufficient bandwidth to achieve
line rate, but the link is not fast enough for optimal latency.

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

8 years agosfxge(4): cleanup: make TLV scans quieter
arybchik [Mon, 16 May 2016 06:32:06 +0000 (06:32 +0000)]
sfxge(4): cleanup: make TLV scans quieter

Find end of segments in a more direct way that avoids an error report at
the terminator.

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

8 years agomount_snapshot: consolidate all error handling
avg [Mon, 16 May 2016 06:30:25 +0000 (06:30 +0000)]
mount_snapshot: consolidate all error handling

This makes sure that the original vnode is always unlocked and released
if any error happens.

MFC after: 4 weeks

8 years agosfxge(4): cleanup: make VPD lookups quieter
arybchik [Mon, 16 May 2016 06:26:18 +0000 (06:26 +0000)]
sfxge(4): cleanup: make VPD lookups quieter

A lookup on a VPD entry which is missing reports several failure
messages as it propagates through wrapper functions. Restructured
the wrappers to treat this gracefully as an expected case.

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

8 years agozfsctl: fix several problems with reference counts
avg [Mon, 16 May 2016 06:24:04 +0000 (06:24 +0000)]
zfsctl: fix several problems with reference counts

* Remove excessive references on a snapshot mountpoint vnode.
  zfsctl_snapdir_lookup() called VN_HOLD() on a vnode returned from
  zfsctl_snapshot_mknode() and the latter also had a call to VN_HOLD()
  on the same vnode.
  On top of that gfs_dir_create() already returns the vnode with the
  use count of 1 (set in getnewvnode).
  So there was 3 references on the vnode.

* mount_snapshot() should keep a reference to a covered vnode.
  That reference is owned by the mountpoint (mounted snapshot filesystem).

* Remove cryptic manipulations of a covered vnode in zfs_umount().
  FreeBSD dounmount() already does the right thing and releases the covered
  vnode.

PR: 207464
Reported by: dustinwenz@ebureau.com
Tested by: Howard Powell <hpowell@lighthouseinstruments.com>
MFC after: 3 weeks

8 years agosfxge(4): cleanup: make licensing function quieter
arybchik [Mon, 16 May 2016 06:19:17 +0000 (06:19 +0000)]
sfxge(4): cleanup: make licensing function quieter

Silent handling of failure to invoke functions that are not supported on
older licensing versions.

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

8 years agosfxge(4): restructure efx_lic to support V3 licensing
arybchik [Mon, 16 May 2016 06:17:56 +0000 (06:17 +0000)]
sfxge(4): restructure efx_lic to support V3 licensing

Create separate implementations of the efx_lic API for each revision of
the licensing system. All processing of the V1/V2 license partition is
moved to efx_lic, and an implementation of V3 licensing uses the existing
TLV functions with extensions for writing new TLV entries.

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

8 years agoNULL releasedfl after calling deallocate_file_lock() which frees it
truckman [Mon, 16 May 2016 05:17:43 +0000 (05:17 +0000)]
NULL releasedfl after calling deallocate_file_lock() which frees it
to avoid a use-after-free error in the debuglog() call at the top
of the loop.

Reported by: Coverity
CID: 1006080
MFC after: 1 week

8 years agoRevert r299576 and MFV r299895:
mm [Mon, 16 May 2016 05:01:44 +0000 (05:01 +0000)]
Revert r299576 and MFV r299895:

Revert r299576:
Fix broken cpio behavior.

MFV r299895:
Update to vendor git commit 860ec63.

MFC after: 3 weeks (together with libarchive 3.2.0)
Fix broken cpio behavior in pass-through mode with vendor code.
> Description of fields to fill in above:                     76 columns --|
> PR:                       If and which Problem Report is related.
> Submitted by:             If someone else sent in the change.
> Reported by:              If someone else reported the issue.
> Reviewed by:              If someone else reviewed your modification.
> Approved by:              If you needed approval for this commit.
> Obtained from:            If the change is from a third party.
> MFC after:                N [day[s]|week[s]|month[s]].  Request a reminder email.
> MFH:                      Ports tree branch name.  Request approval for merge.
> Relnotes:                 Set to 'yes' for mention in release notes.
> Security:                 Vulnerability reference (one per line) or description.
> Sponsored by:             If the change was sponsored by an organization.
> Differential Revision:    https://reviews.freebsd.org/D### (*full* phabric URL needed).
> Empty fields above will be automatically removed.

_M   libarchive
_M   libarchive/cpio
M    libarchive/cpio/bsdcpio.1
M    libarchive/cpio/cpio.c
_M   libarchive/libarchive
M    libarchive/libarchive/archive_read_support_format_cpio.c

8 years agopdu_delete(request) frees request, so move the call after
truckman [Mon, 16 May 2016 04:43:47 +0000 (04:43 +0000)]
pdu_delete(request) frees request, so move the call after
login_new_response(request) to avoid a use-after-free error

Reported by: Coverity
Reviewed by: 13312191331220

8 years agoDon't free fnamebuf before we calling cfgfile_add(). This changes a
truckman [Mon, 16 May 2016 04:39:16 +0000 (04:39 +0000)]
Don't free fnamebuf before we calling cfgfile_add().  This changes a
use-after-free error into a minor memory leak.

Reported by: Coverity
CID: 1006084

8 years agohyperv/vmbus: Fix event processing loop indentation.
sephe [Mon, 16 May 2016 04:03:52 +0000 (04:03 +0000)]
hyperv/vmbus: Fix event processing loop indentation.

No functional changes.

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

8 years ago[bwn] use contigmalloc to allocate descriptors.
adrian [Mon, 16 May 2016 04:03:43 +0000 (04:03 +0000)]
[bwn] use contigmalloc to allocate descriptors.

We can't assume malloc() returns physically contiguous memory.

Submitted by: Imre Vadasz <imre@vdsz.com>
Obtained from: DragonflyBSD

8 years agohyperv/vmbus: Simplify event processing
sephe [Mon, 16 May 2016 03:56:24 +0000 (03:56 +0000)]
hyperv/vmbus: Simplify event processing

For channel0, it will never be processed on event handling path,
so there is no need to install it.  After skipping in the channel0
installation, we could discard the channel0 check on event
handling hot code path.

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

8 years agohyperv/vmbus: Simplify event processing
sephe [Mon, 16 May 2016 03:48:00 +0000 (03:48 +0000)]
hyperv/vmbus: Simplify event processing

While I'm here, remove useless comment and unnecessary return.

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

8 years agohyperv/hn: Combine per-packet-information parsing.
sephe [Mon, 16 May 2016 03:26:16 +0000 (03:26 +0000)]
hyperv/hn: Combine per-packet-information parsing.

MFC after: 1 week
Sponsored by: Microsoft OSTC

8 years agoSimplify overengineered and buggy code that looked like as if it did
araujo [Mon, 16 May 2016 02:44:22 +0000 (02:44 +0000)]
Simplify overengineered and buggy code that looked like as if it did
some kind of UTF-8 validation, but actually didn't, but instead, for
malformed UTF-8 input, caused buffer overruns in some cases and caused
skipping of valid ASCII characters in other cases.

Obtained from: OpenBSD (cvs 1.32)

8 years agoWhen a group contains a non-existent user, make the warning
araujo [Mon, 16 May 2016 02:35:23 +0000 (02:35 +0000)]
When a group contains a non-existent user, make the warning
message more helpful by mentioning the group name.

Obtained from: OpenBSD (cvs 1.19)

8 years agoFollow-up r298818: hide size of 'bands' array behind a macro.
kevlo [Mon, 16 May 2016 02:27:28 +0000 (02:27 +0000)]
Follow-up r298818: hide size of 'bands' array behind a macro.