]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoMake named objects set-aware. Now it is possible to create named
ae [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 [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 [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 [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 [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 [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 [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
sgalabov [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
sgalabov [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
sgalabov [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
arybchik [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
arybchik [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
arybchik [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
arybchik [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
arybchik [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
kevlo [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
truckman [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

8 years agoCorrect use of incorrect grammar.
grog [Tue, 17 May 2016 04:40:00 +0000 (04:40 +0000)]
Correct use of incorrect grammar.

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