]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agozfsctl_freebsd_root_lookup: gfs_vop_lookup may return a doomed vnode
Andriy Gapon [Wed, 18 May 2016 08:02:49 +0000 (08:02 +0000)]
zfsctl_freebsd_root_lookup: gfs_vop_lookup may return a doomed vnode

gfs code is (almsot) completely agnostic of FreeBSD VFS locking, so it
does not handle doomed but not yet dead vnodes and may return them.
Check for those vnodes here and retry a lookup.
Note that ZFS and gfs have additional protections that ensure that a
parent vnode of the current vnode is never doomed.

The fixed problem is an occasional failure to lookup a 'snapshot' or
'shares' directories under .zfs.

Note that for the above reason all uses of zfsctl_root_lookup() are
better be replaced with VOP_LOOKUP.

MFC after: 5 weeks

8 years agohyperv/vmbus: Use consistent device description as other devices
Sepherosa Ziehau [Wed, 18 May 2016 07:18:11 +0000 (07:18 +0000)]
hyperv/vmbus: Use consistent device description as other devices

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

8 years ago[siba] fix incorrect SPROM offsets.
Adrian Chadd [Wed, 18 May 2016 07:17:30 +0000 (07:17 +0000)]
[siba] fix incorrect SPROM offsets.

All my fault.

8 years agohyperv/vmbus: Minor function definition style fixup
Sepherosa Ziehau [Wed, 18 May 2016 07:09:44 +0000 (07:09 +0000)]
hyperv/vmbus: Minor function definition style fixup

Reviewed by: Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6417

8 years agohyperv/vmbus: Fix SYSINIT function prototype and usage.
Sepherosa Ziehau [Wed, 18 May 2016 07:01:32 +0000 (07:01 +0000)]
hyperv/vmbus: Fix SYSINIT function prototype and usage.

Reviewed by: Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6416

8 years ago[siba] use the correct SPROM offsets.
Adrian Chadd [Wed, 18 May 2016 07:01:22 +0000 (07:01 +0000)]
[siba] use the correct SPROM offsets.

I transcribed the linux ssb offsets and .. didn't pick up that our SIBA
SPROM code has an offset of 0x1000.

This fixes a bunch of odd parsing values that showed up when I tried
using a newer NIC.  The NIC still doesn't yet work but now the SPROM
values are right.

Oops!

8 years agohyperv/vmbus: Reindent and cleanup devmethods.
Sepherosa Ziehau [Wed, 18 May 2016 06:52:20 +0000 (06:52 +0000)]
hyperv/vmbus: Reindent and cleanup devmethods.

While I'm here, use DEVMETHOD_END.

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

8 years agohyperv/vmbus: Staticize vmbus_devclass
Sepherosa Ziehau [Wed, 18 May 2016 06:43:15 +0000 (06:43 +0000)]
hyperv/vmbus: Staticize vmbus_devclass

Reviewed by: Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6414

8 years agohyperv: Set vm_guest to VM_GUEST_VM, if hypervisor is not Hyper-V
Sepherosa Ziehau [Wed, 18 May 2016 06:36:28 +0000 (06:36 +0000)]
hyperv: Set vm_guest to VM_GUEST_VM, if hypervisor is not Hyper-V

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

8 years agohyperv/vmbus: Nuke unnecessary function indirection
Sepherosa Ziehau [Wed, 18 May 2016 06:29:03 +0000 (06:29 +0000)]
hyperv/vmbus: Nuke unnecessary function indirection

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

8 years agohyperv/vmbus: Remove useless modevent handler
Sepherosa Ziehau [Wed, 18 May 2016 06:19:22 +0000 (06:19 +0000)]
hyperv/vmbus: Remove useless modevent handler

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

8 years agoMake armv6 hard float abi by default. Kill armv6hf.
Warner Losh [Wed, 18 May 2016 06:01:18 +0000 (06:01 +0000)]
Make armv6 hard float abi by default. Kill armv6hf.
Allow CPUTYPE=soft to build the current soft-float abi libraries.
Add UPDATING entry to announce this.

Approved by: re@ (gjb)

8 years agoRevert r300003, and use proper grammar.
Glen Barber [Wed, 18 May 2016 06:00:32 +0000 (06:00 +0000)]
Revert r300003, and use proper grammar.

While here, bump .Dd, which should have been done with
previous commit.

8 years agoFix several instances where the boot loader ignored pager_output
Warner Losh [Wed, 18 May 2016 05:59:05 +0000 (05:59 +0000)]
Fix several instances where the boot loader ignored pager_output
return value when it could return 1 (indicating we should stop).
Fix a few instances of pager_open() / pager_close() not being called.
Actually use these routines for the environment variable printing code
I just committed.

8 years agoFix build breakage on arm64 by papering over the problem. We implement
Warner Losh [Wed, 18 May 2016 05:58:58 +0000 (05:58 +0000)]
Fix build breakage on arm64 by papering over the problem. We implement
a slightly non-standard %S that's more useful in the UEFI environment,
so ignore printf errors. There's no good cast to use. We'll need to
revisit this in the future.

8 years agoExplain why extra sutff always outputs even when it shouldn't for the
Warner Losh [Wed, 18 May 2016 05:58:57 +0000 (05:58 +0000)]
Explain why extra sutff always outputs even when it shouldn't for the
'?' command. Wasted a bunch of time tracking it down tonight.

8 years ago[bwn] add initial 5xx firmware API support
Adrian Chadd [Wed, 18 May 2016 05:56:25 +0000 (05:56 +0000)]
[bwn] add initial 5xx firmware API support

* Add the new TX/RX frame formats;
* Use the right TX/RX format based on the frame info;
* Disable the 5xx firmware check, since now it should
  somewhat work (but note, we don't yet use it unless
  you manually add ucode11/initvals11 from the 5.x driver
  to bwn-kmod-firmware;

* Misc: update some comments/debugging now I know what's
  actually going on.

Tested:

* BCM4321MC, STA mode, both 4xx and 666 firmware, DMA mode

TODO:

* The newer firmware ends up logging "warn: firmware state (0)";
  not sure yet what's going on there.  But, yes, it still works.
  I'm committing this via a BCM4321MC, 11a station, firmware
  rev 666.

Obtained from: Linux b43 (TX/RX descriptor format for 5xx)

8 years agoImport the 'iflib' API library for network drivers. From the author:
Scott Long [Wed, 18 May 2016 04:35:58 +0000 (04:35 +0000)]
Import the 'iflib' API library for network drivers.  From the author:

"iflib is a library to eliminate the need for frequently duplicated device
independent logic propagated (poorly) across many network drivers."

Participation is purely optional.  The IFLIB kernel config option is
provided for drivers that want to transition between legacy and iflib
modes of operation.  ixl and ixgbe driver conversions will be committed
shortly.  We hope to see participation from the Broadcom and maybe
Chelsio drivers in the near future.

Submitted by:   mmacy@nextbsd.org
Reviewed by:    gallatin
Differential Revision:  D5211

8 years agohyperv/vmbus: Function renaming vmbus_msg_swintr -> vmbus_msg_task
Sepherosa Ziehau [Wed, 18 May 2016 04:04:14 +0000 (04:04 +0000)]
hyperv/vmbus: Function renaming vmbus_msg_swintr -> vmbus_msg_task

It is not an SWI handler for a long time.

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

8 years agohyperv/vmbus: Utilize curcpu
Sepherosa Ziehau [Wed, 18 May 2016 03:58:04 +0000 (03:58 +0000)]
hyperv/vmbus: Utilize curcpu

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

8 years agoDo not acquire the thread lock in hardclock_cnt() unless needed.
Mark Johnston [Wed, 18 May 2016 03:55:54 +0000 (03:55 +0000)]
Do not acquire the thread lock in hardclock_cnt() unless needed.

This function only sets thread flags if a SIGPROF or SIGVTALRM timer
has fired, which is almost never the case.

MFC after: 2 weeks

8 years agoMicro-optimize sleepq_broadcast().
Mark Johnston [Wed, 18 May 2016 03:50:21 +0000 (03:50 +0000)]
Micro-optimize sleepq_broadcast().

- Avoid a conditional branch on the return value of sleepq_resume_thread()
  by ORing its return value into the boolean wakeup_swapper. This is
  consistent with other sleepqueue functions which just pass this return
  value to their caller.
- sleepq_resume_thread() unconditionally removes the thread from its queue,
  so there's no need to maintain a pointer to the next element in the queue.

MFC after: 2 weeks

8 years agohyperv/vmbus: Minor white space and style cleanup
Sepherosa Ziehau [Wed, 18 May 2016 03:50:18 +0000 (03:50 +0000)]
hyperv/vmbus: Minor white space and style cleanup

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

8 years agohyperv/vmbus: Avoid two unnecessary protocol checks on isr handling path
Sepherosa Ziehau [Wed, 18 May 2016 03:41:37 +0000 (03:41 +0000)]
hyperv/vmbus: Avoid two unnecessary protocol checks on isr handling path

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

8 years agoRemove the MUTEX_DEBUG kernel option.
Mark Johnston [Wed, 18 May 2016 03:34:02 +0000 (03:34 +0000)]
Remove the MUTEX_DEBUG kernel option.

It has no counterpart among the other lock primitives and has been a
no-op for years. Mutex consistency checks are generally done whenver
INVARIANTS is enabled.

8 years agohyperv/vmbus: Use atomic swap and flsl to process event flags
Sepherosa Ziehau [Wed, 18 May 2016 03:28:51 +0000 (03:28 +0000)]
hyperv/vmbus: Use atomic swap and flsl to process event flags

Greatly reduce the locked instructions and reduce number of inner loops.

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

8 years agoGuard the lockstat:::thread-spin probe with KDTRACE_HOOKS.
Mark Johnston [Wed, 18 May 2016 03:23:07 +0000 (03:23 +0000)]
Guard the lockstat:::thread-spin probe with KDTRACE_HOOKS.

X-MFC-With: r300103

8 years agolockstat:::thread-spin should only fire after spinning for the lock.
Mark Johnston [Wed, 18 May 2016 03:21:21 +0000 (03:21 +0000)]
lockstat:::thread-spin should only fire after spinning for the lock.

MFC after: 1 week

8 years agohyperv/vmbus: Reduce the # of event loops by recording event flag count
Sepherosa Ziehau [Wed, 18 May 2016 03:19:53 +0000 (03:19 +0000)]
hyperv/vmbus: Reduce the # of event loops by recording event flag count

Use vmbus softc to save vmbus per-cpu data.  More stuffs will be moved
into vmbus softc.

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

8 years agohyperv/vmbus: Use unsigned long for event bits.
Sepherosa Ziehau [Wed, 18 May 2016 02:59:46 +0000 (02:59 +0000)]
hyperv/vmbus: Use unsigned long for event bits.

And move base channel id calculation out of inner loop.  This prepares
for more event processing optimization.

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

8 years agontb_hw(4): Add sysctls for administrative/test link config, state
Conrad Meyer [Wed, 18 May 2016 02:10:05 +0000 (02:10 +0000)]
ntb_hw(4): Add sysctls for administrative/test link config, state

dev.ntb_hw.0.admin_up=0/1: Like ifconfig UP/DOWN.
dev.ntb_hw.0.active=0/1:   Like ifconfig 'status'

Reviewed by: ngie
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6429

8 years agomakefs(8): Clarify the comment concerning seeding.
Pedro F. Giffuni [Wed, 18 May 2016 00:22:52 +0000 (00:22 +0000)]
makefs(8): Clarify the comment concerning seeding.

Avoid giving the impression makefs currently supports reproduceable
builds.

8 years agoAdd a comment and KASSERT that a M_NOFREE mbuf has always EXT_EXTREF ext.
Gleb Smirnoff [Tue, 17 May 2016 23:15:16 +0000 (23:15 +0000)]
Add a comment and KASSERT that a M_NOFREE mbuf has always EXT_EXTREF ext.

Submitted by: kmacy

8 years agoTiny refactor of r294869/r296881: use defines to mask the VNET() macro.
Gleb Smirnoff [Tue, 17 May 2016 23:14:17 +0000 (23:14 +0000)]
Tiny refactor of r294869/r296881: use defines to mask the VNET() macro.

Suggested by: bz

8 years agoDon't forget to quote \ characters with \.
Warner Losh [Tue, 17 May 2016 22:52:42 +0000 (22:52 +0000)]
Don't forget to quote \ characters with \.

8 years agoValidate that user supplied control message length is not negative.
Gleb Smirnoff [Tue, 17 May 2016 22:28:53 +0000 (22:28 +0000)]
Validate that user supplied control message length is not negative.

Submitted by: C Turt <cturt hardenedbsd.org>
Security: SA-16:19
Security: CVE-2016-1887

8 years agoUse unsigned version of min() when handling arguments of SETFKEY ioctl.
Gleb Smirnoff [Tue, 17 May 2016 22:28:42 +0000 (22:28 +0000)]
Use unsigned version of min() when handling arguments of SETFKEY ioctl.

Submitted by: C Turt <cturt hardenedbsd.org>
Security: SA-16:18
Security: CVE-2016-1886

8 years agoDo enable io accounting for read-only mounts and mounts which are
Konstantin Belousov [Tue, 17 May 2016 21:35:35 +0000 (21:35 +0000)]
Do enable io accounting for read-only mounts and mounts which are
remounted to writeable after initial read-only.  Assign to
dev->si_mountpt earlier to account the accesses done at the mount
time.

Based on submission by: bde
MFC after: 1 week

8 years agoIf IO_SYNC was passed to ffs_truncate(), request synchronous inode
Konstantin Belousov [Tue, 17 May 2016 21:30:58 +0000 (21:30 +0000)]
If IO_SYNC was passed to ffs_truncate(), request synchronous inode
update from the final ffs_update().

Noted by: bde
MFC after: 1 week

8 years agoFor async UFS mounts, shrink the directory asynchronously, at least do
Konstantin Belousov [Tue, 17 May 2016 21:28:28 +0000 (21:28 +0000)]
For async UFS mounts, shrink the directory asynchronously, at least do
not pass IO_SYNC to ffs_truncate() unneccessary.

Submitted by: bde
MFC after: 1 week

8 years agoImplement UEFI set environment variable, as well as exporting the EFI
Warner Losh [Tue, 17 May 2016 21:25:20 +0000 (21:25 +0000)]
Implement UEFI set environment variable, as well as exporting the EFI
version. This is also scriptable, though additional scripting will be
needed.

Differential Review: https://reviews.freebsd.org/D4494
MFC After: 3 days

8 years agoImplement uuid-to-string and uuid-from-string. uuid-from-string takes
Warner Losh [Tue, 17 May 2016 21:25:18 +0000 (21:25 +0000)]
Implement uuid-to-string and uuid-from-string. uuid-from-string takes
a string, interprets it as a standard UUID, and returns a binary from
of the UUID. uuid-to-string does the reverse. The binary UUID is in
allocated memory, so you'll need to free it with 'free' after you are
done using it. It won't be automatically garbage collected. Likewise
with the string...

MFC After: 3 days

8 years ago[bwn] correctly calculate RSSI level.
Adrian Chadd [Tue, 17 May 2016 21:24:10 +0000 (21:24 +0000)]
[bwn] correctly calculate RSSI level.

Tested:

* BCM4311, PHY-G, STA mode
* BCM4312, PHY-LP, STA mode
* BCM4321, PHY-N, STA moe

8 years agoAdd support for %S to libstand as well so /boot/loader and friends can
Warner Losh [Tue, 17 May 2016 21:23:13 +0000 (21:23 +0000)]
Add support for %S to libstand as well so /boot/loader and friends can
use it.

8 years agomwl: drop unneeded NULL pointer check.
Andriy Voskoboinyk [Tue, 17 May 2016 20:53:56 +0000 (20:53 +0000)]
mwl: drop unneeded NULL pointer check.

mh_streams[] is a fixed-length array, not a pointer.

8 years ago[bwn] print out a very obvious notice that GPLv2 code is compiled in if it is.
Adrian Chadd [Tue, 17 May 2016 20:21:39 +0000 (20:21 +0000)]
[bwn] print out a very obvious notice that GPLv2 code is compiled in if it is.

8 years ago[bwn] always allocate maximum size txhdr entries; prepare for fw 598
Adrian Chadd [Tue, 17 May 2016 20:18:23 +0000 (20:18 +0000)]
[bwn] always allocate maximum size txhdr entries; prepare for fw 598

* always allocate maximum size txhdr entries
* set the right rx header offset/framesize based on firmware

This still isn't what's completely required for fw 598 support; there's
more to come.

Tested:

* Apple BCM94321MC 11abgn NIC, 11a STA mode, firmware version 4xx.

Obtained from: DragonflyBSD (txhdr entry sizing), fw 598 RX header size (linux b43)

8 years agoRework managing hotplug commands with command completions.
John Baldwin [Tue, 17 May 2016 19:48:28 +0000 (19:48 +0000)]
Rework managing hotplug commands with command completions.

Previously the command completion interrupt would post any pending
command immediately before pcib_pcie_hotplug_update() had been
run to inspect the current status.  Now, the command completion
interrupt merely clears the flag and stops the timer assuming that
the caller is always going to call pcib_pcie_hotplug_update() to
generate the next hotplug command if one is needed.

While here, fix a bug for systems with command completion where the
old (existing) value was written to the slot control register instead
of the new value.  This fixes the complaint about a missing hotplug
interrupt on my T400.

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

8 years agoDocument the formatting requirements of location and pnpinfo strings.
John Baldwin [Tue, 17 May 2016 19:34:07 +0000 (19:34 +0000)]
Document the formatting requirements of location and pnpinfo strings.

devd requires location and pnpinfo strings generated by bus drivers
to be formatted as a list of name=value keypairs.  Non-conforming
bus drivers cause devd to mis-parse device events for these buses.

Note that this documents the desired requirements.  devctl_safe_quote()
doesn't yet escape backslash characters, and devd doesn't handle escaped
characters in quoted values.

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

8 years agoFix NULL-dereference panic if VESA reports zero modes.
Alexander Motin [Tue, 17 May 2016 19:00:09 +0000 (19:00 +0000)]
Fix NULL-dereference panic if VESA reports zero modes.

MFC after: 1 week

8 years agoRemove the reiserfs(5) manpage and an example of loading the kernel module.
John Baldwin [Tue, 17 May 2016 18:42:38 +0000 (18:42 +0000)]
Remove the reiserfs(5) manpage and an example of loading the kernel module.

8 years agomakefs(1): use all the random(3) range.
Pedro F. Giffuni [Tue, 17 May 2016 18:20:33 +0000 (18:20 +0000)]
makefs(1): use all the random(3) range.

The generation number is uint32_t so we can fit the complete range
of random(3). We could have used arc4random() but the result would
be unpredictable and it would prohibit reproducible builds.

While here add a comment where seeding is done: this affects
reproducible builds and might have to be re-visited to use a
release dependent value.

MFC after: 2 weeks

8 years agoAdd driver for "generic-ohci" as defined by FDT.
Emmanuel Vadot [Tue, 17 May 2016 17:46:12 +0000 (17:46 +0000)]
Add driver for "generic-ohci" as defined by FDT.
If platform support EXT_RESOURCES, clocks and resets are handled out of
the box.
If not driver can be subclassed using the generic_usb interface.
generic_usb name was choosed because at one point I'll add generic-ehci
FDT driver.

Reviewed by: jmcneill, hselasky
Approved by: andrew (mentor)
Differential Revision: https://reviews.freebsd.org/D5481

8 years agoFinal nit in ReiserFS removal.
George V. Neville-Neil [Tue, 17 May 2016 17:09:45 +0000 (17:09 +0000)]
Final nit in ReiserFS removal.

8 years agoPer Ravi Pokala's suggestion, rewrite the g_reset_bio description to
Warner Losh [Tue, 17 May 2016 17:08:13 +0000 (17:08 +0000)]
Per Ravi Pokala's suggestion, rewrite the g_reset_bio description to
be clearer. It also describes it with more nuance. Add missing MLINKS
noticed by trasz@. Bump the date.

8 years agoFinish cleaning up after killing ReiserFS.
George V. Neville-Neil [Tue, 17 May 2016 16:59:53 +0000 (16:59 +0000)]
Finish cleaning up after killing ReiserFS.

Remove LINT/NOTES option and file linkages.

8 years agomakefs(8): use NULL instead of zero for pointers.
Pedro F. Giffuni [Tue, 17 May 2016 16:58:39 +0000 (16:58 +0000)]
makefs(8): use NULL instead of zero for pointers.

8 years agonet80211: unbreak 'show all vaps(/a)' ddb command
Andriy Voskoboinyk [Tue, 17 May 2016 16:38:18 +0000 (16:38 +0000)]
net80211: unbreak 'show all vaps(/a)' ddb command

Replace ifnet list lookup (which is broken since r287197, because
IFT_IEEE80211 type is not used anymore) with iteration on
ieee80211com list.

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

8 years agoKill off ReiserFS as it is no longer supported, for obvious reasons.
George V. Neville-Neil [Tue, 17 May 2016 15:36:40 +0000 (15:36 +0000)]
Kill off ReiserFS as it is no longer supported, for obvious reasons.

8 years agoRename icl_proxy.c to icl_soft_proxy.c, to make it clear it's a part
Edward Tomasz Napierala [Tue, 17 May 2016 15:21:17 +0000 (15:21 +0000)]
Rename icl_proxy.c to icl_soft_proxy.c, to make it clear it's a part
of software ICL backend.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoSpeed up vdev_geom_open_by_guids
Alan Somers [Tue, 17 May 2016 15:17:23 +0000 (15:17 +0000)]
Speed up vdev_geom_open_by_guids

Speedup is hard to measure because the only time vdev_geom_open_by_guids
gets called on many drives at the same time is during boot. But with
vdev_geom_open hacked to always call vdev_geom_open_by_guids, operations
like "zpool create" speed up by 65%.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c

* Read all of a vdev's labels in parallel instead of sequentially.
* In vdev_geom_read_config, don't read the entire label, including
  the uberblock.  That's a waste of RAM.  Just read the vdev config
  nvlist.  Reduces the IO and RAM involved with tasting from 1MB to
  448KB.

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

8 years agoMake RQCS_PORT_LOGGED_OUT for ZOMBIE ports retriable.
Alexander Motin [Tue, 17 May 2016 15:12:57 +0000 (15:12 +0000)]
Make RQCS_PORT_LOGGED_OUT for ZOMBIE ports retriable.

It is normal for ZOMBIE ports to be logged out.  This status is not really
an error until Gone Device Timeout expires, so make CAM retry after delay.

MFC after: 1 week

8 years agoIt sure would be nice to use printf with wide strings. Implement %S to
Warner Losh [Tue, 17 May 2016 14:10:45 +0000 (14:10 +0000)]
It sure would be nice to use printf with wide strings. Implement %S to
do that. The C_WIDEOUT flag indicates that the console supports
it. Mark the EFI console as supporting this.

MFC After: 3 days

8 years agoMinor space tweak to make things consistent.
Warner Losh [Tue, 17 May 2016 14:10:44 +0000 (14:10 +0000)]
Minor space tweak to make things consistent.

MFC After: 3 days

8 years agoCall RO_RTFREE() when we have detected the change of destination
Andrey V. Elsukov [Tue, 17 May 2016 14:06:55 +0000 (14:06 +0000)]
Call RO_RTFREE() when we have detected the change of destination
address, otherwise the old route will be used with new destination.

MFC after: 1 week

8 years agoCompletely remove broken now autologin port flag.
Alexander Motin [Tue, 17 May 2016 13:18:57 +0000 (13:18 +0000)]
Completely remove broken now autologin port flag.

Firmware automatically logs in only to local loop ports, and those ports
can be easily identified without extra flag by zero domain and area IDs.

MFC after: 1 week

8 years agoThe GIC (v2 at least) has a bit in the TYPER register to indicate whether the GIC
Bjoern A. Zeeb [Tue, 17 May 2016 13:12:26 +0000 (13:12 +0000)]
The GIC (v2 at least) has a bit in the TYPER register to indicate whether the GIC
supports the Security Extensions or not. This bit is not the same as the CPU one.
Currently we are not checking for either before trying to write to the special
registers.  This can lead to problems on hardware or simulators that do not
provide the security extensions.  Add the missing checks. Their interactions with
the CPU flag is not entirely clear to me but using a macro will make it easier
to quickly adjust the condition once the CPU bits are sorted as well.

Reviewed by: br
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D6397

8 years agoDon't repeat the the word 'the'
Eitan Adler [Tue, 17 May 2016 12:52:31 +0000 (12:52 +0000)]
Don't repeat the the word 'the'

(one manual change to fix grammar)

Confirmed With: db
Approved by: secteam (not really, but this is a comment typo fix)

8 years agoAdd an arm64 kernel config to help testing intrng. It is expected this
Andrew Turner [Tue, 17 May 2016 12:48:30 +0000 (12:48 +0000)]
Add an arm64 kernel config to help testing intrng. It is expected this
config will only last a few weeks until we switch to this interrupt
framework.

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

8 years agoClean up the GICv3 intrng code:
Andrew Turner [Tue, 17 May 2016 12:46:50 +0000 (12:46 +0000)]
Clean up the GICv3 intrng code:
 * In gic_v3_attach free the correct data on failure.
 * Implement gic_v3_teardown_intr.
 * Update the panic string when enabling/disabling an invalid interrupt.

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

8 years agoSilence down the "insmntque() failed" autofs error; it happens
Edward Tomasz Napierala [Tue, 17 May 2016 12:04:39 +0000 (12:04 +0000)]
Silence down the "insmntque() failed" autofs error; it happens
on shutdown and is perfectly normal.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoMake iscsi_ioctl_daemon_send() actually work by adding missing locking.
Edward Tomasz Napierala [Tue, 17 May 2016 11:59:38 +0000 (11:59 +0000)]
Make iscsi_ioctl_daemon_send() actually work by adding missing locking.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoMake `ipfw internal olist` output more user friendly.
Andrey V. Elsukov [Tue, 17 May 2016 11:22:08 +0000 (11:22 +0000)]
Make `ipfw internal olist` output more user friendly.
Print object type as string for known types.

Obtained from: Yandex LLC
Sponsored by: Yandex LLC

8 years agoAdd icl_conn_connect() ICL method, required for iSER.
Edward Tomasz Napierala [Tue, 17 May 2016 11:10:44 +0000 (11:10 +0000)]
Add icl_conn_connect() ICL method, required for iSER.

Obtained from: Mellanox Technologies (earlier version)
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoAdd implementation of robust mutexes, hopefully close enough to the
Konstantin Belousov [Tue, 17 May 2016 09:56:22 +0000 (09:56 +0000)]
Add implementation of robust mutexes, hopefully close enough to the
intention of the POSIX IEEE Std 1003.1TM-2008/Cor 1-2013.

A robust mutex is guaranteed to be cleared by the system upon either
thread or process owner termination while the mutex is held.  The next
mutex locker is then notified about inconsistent mutex state and can
execute (or abandon) corrective actions.

The patch mostly consists of small changes here and there, adding
neccessary checks for the inconsistent and abandoned conditions into
existing paths.  Additionally, the thread exit handler was extended to
iterate over the userspace-maintained list of owned robust mutexes,
unlocking and marking as terminated each of them.

The list of owned robust mutexes cannot be maintained atomically
synchronous with the mutex lock state (it is possible in kernel, but
is too expensive).  Instead, for the duration of lock or unlock
operation, the current mutex is remembered in a special slot that is
also checked by the kernel at thread termination.

Kernel must be aware about the per-thread location of the heads of
robust mutex lists and the current active mutex slot.  When a thread
touches a robust mutex for the first time, a new umtx op syscall is
issued which informs about location of lists heads.

The umtx sleep queues for PP and PI mutexes are split between
non-robust and robust.

Somewhat unrelated changes in the patch:
1. Style.
2. The fix for proper tdfind() call use in umtxq_sleep_pi() for shared
   pi mutexes.
3. Removal of the userspace struct pthread_mutex m_owner field.
4. The sysctl kern.ipc.umtx_vnode_persistent is added, which controls
   the lifetime of the shared mutex associated with a vnode' page.

Reviewed by: jilles (previous version, supposedly the objection was fixed)
Discussed with: brooks, Martin Simmons <martin@lispworks.com> (some aspects)
Tested by: pho
Sponsored by: The FreeBSD Foundation

8 years agoThis small change adopts the excellent suggestion for using named
Randall Stewart [Tue, 17 May 2016 09:53:22 +0000 (09:53 +0000)]
This small change adopts the excellent suggestion for using named
structures in the add of a new tcp-stack that came in late to me
via email after the last commit. It also makes it so that a new
stack may optionally get a callback during a retransmit
timeout. This allows the new stack to clear specific state (think
sack scoreboards or other such structures).

Sponsored by: Netflix Inc.
Differential Revision: http://reviews.freebsd.org/D6303

8 years agoAdd SUSv4 reference macro to our groff mdoc. mdocml already supports it.
Konstantin Belousov [Tue, 17 May 2016 09:24:54 +0000 (09:24 +0000)]
Add SUSv4 reference macro to our groff mdoc.  mdocml already supports it.

Sponsored by: The FreeBSD Foundation

8 years agoExtend the ICL interface to include the PDU pointer in the task_setup
Edward Tomasz Napierala [Tue, 17 May 2016 08:55:21 +0000 (08:55 +0000)]
Extend the ICL interface to include the PDU pointer in the task_setup
method.  This is required for upcoming iSER support.

Obtained from: Mellanox Technologies (earlier version)
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoFix comments.
Konstantin Belousov [Tue, 17 May 2016 08:24:27 +0000 (08:24 +0000)]
Fix comments.

Submitted by: bde
MFC after: 1 week

8 years agoFix typo in the message.
Konstantin Belousov [Tue, 17 May 2016 08:19:20 +0000 (08:19 +0000)]
Fix typo in the message.

Submitted by: bde
MFC after: 1 week

8 years agoMake ICL_KERNEL_PROXY compilable.
Edward Tomasz Napierala [Tue, 17 May 2016 07:56:45 +0000 (07:56 +0000)]
Make ICL_KERNEL_PROXY compilable.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agozfs_ioc_rename: fix a reversed condition
Andriy Gapon [Tue, 17 May 2016 07:56:05 +0000 (07:56 +0000)]
zfs_ioc_rename: fix a reversed condition

FreeBSD zfs_ioc_rename() has an option, not present upstream, that
allows to rename snapshots without unmounting them first.  I am not sure
what is a rationale for that option, but its actual behavior was the
opposite of the intended behavior.  That is, by default the snapshots
were not unmounted.
The option was introduced as part of a large update from upstream in
r248498.

One of the consequences was a havoc under .zfs/snapshot after the rename.
The snapshots got new names but were mounted on top of directories with
old names, so readdir would list the new names, but lookup would still
find the old mounts.

PR: 209093
Reported by: Frédéric VANNIÈRE <f.vanniere@planet-work.com>
MFC after: 5 days

8 years agoAdd initial support for negotiating iSER parameters to iscsid(8). Some
Edward Tomasz Napierala [Tue, 17 May 2016 07:54:53 +0000 (07:54 +0000)]
Add initial support for negotiating iSER parameters to iscsid(8).  Some
rework might be needed to support asymetrical limits, but this should be
ok for now.

Obtained from: Mellanox Technologies (earlier version)
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoMake named objects set-aware. Now it is possible to create named
Andrey V. Elsukov [Tue, 17 May 2016 07:47:23 +0000 (07:47 +0000)]
Make named objects set-aware. Now it is possible to create named
objects with the same name in different sets.

Add optional manage_sets() callback to objects rewriting framework.
It is intended to implement handler for moving and swapping named
object's sets. Add ipfw_obj_manage_sets() function that implements
generic sets handler. Use new callback to implement sets support for
lookup tables.
External actions objects are global and they don't support sets.
Modify eaction_findbyname() to reflect this.
ipfw(8) now may fail to move rules or sets, because some named objects
in target set may have conflicting names.
Note that ipfw_obj_ntlv type was changed, but since lookup tables
actually didn't support sets, this change is harmless.

Obtained from: Yandex LLC
Sponsored by: Yandex LLC

8 years ago[bwn] add in bwn n-phy linking.
Adrian Chadd [Tue, 17 May 2016 07:15:25 +0000 (07:15 +0000)]
[bwn] add in bwn n-phy linking.

* The default kernel and options won't build the GPL PHY bits;
* bwn(4) defaults to building as a module anyway!;
* If BWN_GPL_PHY is specified in the config file, and you uncomment
  the GPL PHY bits in the module Makefile, you'll get a working
  N-PHY.

This is specifically designed to be obtuse for now, as I don't want
to flip it on by default.  It's easy enough for people to flip on
and build, and it's a module so the default GENERIC kernel won't be
GPL tainted.

I'll have to add an actual HAL layer that allows the GPL PHY to be loaded
before if_bwn so it can be "magic", but that'll come later.

Tested:

* BCM4321 11abg NIC, STA mode

8 years ago[bwn] Add PHY-N call hooks.
Adrian Chadd [Tue, 17 May 2016 07:12:00 +0000 (07:12 +0000)]
[bwn] Add PHY-N call hooks.

8 years ago[bwn] add PHY-N glue.
Adrian Chadd [Tue, 17 May 2016 07:11:12 +0000 (07:11 +0000)]
[bwn] add PHY-N glue.

It defaults to stubbing out PHY-N bindings, but it can be flipped to
call into the b43 PHY-N port.

8 years ago[bwn] add the BWN_GPL_PHY option.
Adrian Chadd [Tue, 17 May 2016 07:10:30 +0000 (07:10 +0000)]
[bwn] add the BWN_GPL_PHY option.

This will eventually enable building the GPL PHY hooks needed for
running b43 based PHYs.  For now it'll just build PHY-N.

8 years ago[bwn] add initial bwn(4) N-PHY code, ported from Linux b43.
Adrian Chadd [Tue, 17 May 2016 07:09:24 +0000 (07:09 +0000)]
[bwn] add initial bwn(4) N-PHY code, ported from Linux b43.

This is a GPLv2 PHY-N implementation based on the Linux b43 driver,
ported over to work in bwn(4).

I've tested this on the BCM4321 11abgn device, in 11bg and 11a modes.
The b43 PHY code only supports 11abg, no 11n, and 20MHz only wide
channels.

Yes, this is a GPLv2 driver, so it won't be included in the
default builds.

Tested:

* BCM4321 11abgn device (Apple!), 11bg and 11a STA mode.

Obtained from: Linux b43

8 years ago[bhnd] Finish bhnd(4) PCI/PCIe-G1 hostb support.
Adrian Chadd [Tue, 17 May 2016 06:52:53 +0000 (06:52 +0000)]
[bhnd] Finish bhnd(4) PCI/PCIe-G1 hostb support.

Now that we've got access to SPROM and can access board identification,
this implements all known remaining hardware work-arounds for the bhnd(4)
PCI and PCIe-G1 cores operating endpoint mode.

Additionally, this adds an initial set of skeleton PCIe-G2 hostb and pcib
drivers, required by fullmac and newer softmac devices.

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

8 years agoAdd proper PCIe init for MT7628/MT7688 SoCs
Stanislav Galabov [Tue, 17 May 2016 06:45:25 +0000 (06:45 +0000)]
Add proper PCIe init for MT7628/MT7688 SoCs

PCIe PHY needs different initialization on MT7628/MT7688 SoCs than it does
on MT7620.
However, LEDE (and OpenWRT) dts files have the PCIe node for MT7628/MT7688
as compatible with mt7620-pci.
We already can handle this properly in our driver, so we just need to add
compat strings to fbsd-mt7628an.dtsi and the PCIe driver.

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

8 years agoImport LEDE dts files for Ralink/Mediatek
Stanislav Galabov [Tue, 17 May 2016 06:42:24 +0000 (06:42 +0000)]
Import LEDE dts files for Ralink/Mediatek

This is an import of the reworked LEDE dts files. Besides other things
they make it easier for us to reuse.

The only diffs left are for the following SoCs:
MT7620A (fbsd-mt7620a.dtsi)
MT7621 (fbsd-mt7621.dtsi)
MT7628 (fbsd-mt7628an.dtsi)
RT3883 (fbsd-rt3883.dtsi)

So we include the fbsd-*.dtsi files at the end of the original LEDE dtsi
files, using '#include "fbsd-xxxx.dtsi"'.
For example, for MT7621, the LEDE dtsi file is mt7621.dtsi. At the end of
it we add:
#include "fbsd-mt7621.dtsi"

Approved by: adrian (mentor)
Obtained from: LEDE project
Sponsored by: Smartcom - Bulgaria AD
Differential Revision: https://reviews.freebsd.org/D6394

8 years agoFix issues with mt762x etherswitch driver
Stanislav Galabov [Tue, 17 May 2016 06:30:46 +0000 (06:30 +0000)]
Fix issues with mt762x etherswitch driver

Fix issues that crept in with initial import.

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

8 years agosfxge(4): only raise an exception after MC assert or reboot in the common code
Andrew Rybchenko [Tue, 17 May 2016 06:28:03 +0000 (06:28 +0000)]
sfxge(4): only raise an exception after MC assert or reboot in the common code

Fix efx_mcdi_request_poll so it only raises an exception if EIO is
reported from a detected MC assert or reboot. This prevents
an unnecessary exception being raised if an MCDI response error code
is trandlated to EIO.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6392

8 years agosfxge(4): restore clearing of MCDI new epoch flag in common code
Andrew Rybchenko [Tue, 17 May 2016 06:27:19 +0000 (06:27 +0000)]
sfxge(4): restore clearing of MCDI new epoch flag in common code

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6390

8 years agosfxge(4): fix Medford timer quantum calculation in common code
Andrew Rybchenko [Tue, 17 May 2016 06:26:02 +0000 (06:26 +0000)]
sfxge(4): fix Medford timer quantum calculation in common code

The event/timer block used sysclk in Huntington, but has been
moved to the dpcpu clock domain for Medford. Fix the computed
timer quantum to use the right clock.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6389

8 years agosfxge(4): query and use current MTU if setting the MTU fails
Andrew Rybchenko [Tue, 17 May 2016 06:25:00 +0000 (06:25 +0000)]
sfxge(4): query and use current MTU if setting the MTU fails

This allows the driver to fall back to the largest usable MTU if a
user attempts to configure an unprivileged function with an MTU higher
than that of the attached port.

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

8 years agosfxge(4): store licensing state in efx_lic
Andrew Rybchenko [Tue, 17 May 2016 06:23:50 +0000 (06:23 +0000)]
sfxge(4): store licensing state in efx_lic

Check licensing support at NIC startup to avoid multiple checks later.
As state is stored, licensing initialisation is moved later in start
procedure.

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

8 years agoThe EEPROM is lying about antennas. Don't hardcode things based on the chip
Kevin Lo [Tue, 17 May 2016 06:04:33 +0000 (06:04 +0000)]
The EEPROM is lying about antennas.  Don't hardcode things based on the chip
version which is not what the vendor driver happens to do.

8 years agoswprintf() and apparently wcsftime() want the their output buffer size
Don Lewis [Tue, 17 May 2016 05:05:30 +0000 (05:05 +0000)]
swprintf() and apparently wcsftime() want the their output buffer size
specified in terms of the the number of wide characters and not
sizeof(buffer).

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