Commit Graph

30522 Commits

Author SHA1 Message Date
Conrad Meyer
374b05e1ff ioat(4): On error detected in ithread, defer HW reset to taskqueue
The I/OAT HW reset process may sleep, so it is invalid to perform a
channel reset from the software interrupt thread.

Sponsored by:	EMC / Isilon Storage Division
2016-02-13 22:51:25 +00:00
Conrad Meyer
d2c55e5ad0 ioat(4): Also check for errors if the channel is suspended
Sponsored by:	EMC / Isilon Storage Division
2016-02-13 22:51:17 +00:00
Conrad Meyer
564af7a654 ioat(4): Decode/define more capabilities, operations
These are defined in the Intel Haswell EDS volume 2 (registers) (507849
v2.1).

Sponsored by:	EMC / Isilon Storage Division
2016-02-13 19:01:56 +00:00
Conrad Meyer
007a703036 ioat(4): Recheck status register on zero-descriptor wakeups
Errors that halt the channel don't necessarily result in a completion
update, apparently.

Sponsored by:	EMC / Isilon Storage Division
2016-02-13 02:55:45 +00:00
Navdeep Parhar
748d440809 Remove duplicate definition (CPL_TRACE_PKT_T5). 2016-02-12 20:14:03 +00:00
Konstantin Belousov
411c83ccd6 If full width writes to the performance monitoring counters are
supported, use full-width aliases MSRs for writes.  This fixes the
"[pmc,X] negative increment" assertion on the context switch when
clipped counter value is sign-extended.

Add definitions for the MSR IA32_PERF_CAPABILITIES needed to detect
the feature.

PR:	207068
Submitted by:	joss.upton@yahoo.com
MFC after:	2 weeks
2016-02-12 07:27:24 +00:00
Konstantin Belousov
0c8cc7b076 Remove tautological cast.
PR:	207068
Submitted by:	joss.upton@yahoo.com
MFC after:	2 weeks
2016-02-12 07:19:59 +00:00
Michal Meloun
3c7b90774d UART: Fix spurious interrupts generated by ns8250 and lpc drivers:
- don't enable transmitter empty interrupt before filling TX FIFO.
 - add missing uart_barrier() call in interrupt service routine
2016-02-12 05:14:58 +00:00
Jim Harris
7b036d7790 nvme: avoid duplicate SET_NUM_QUEUES commands
nvme(4) issues a SET_NUM_QUEUES command during device
initialization to ensure enough I/O queues exists for each
of the MSI-X vectors we have allocated.  The SET_NUM_QUEUES
command is then issued again during nvme_ctrlr_start(), to
ensure that is properly set after any controller reset.

At least one NVMe drive exists which fails this second
SET_NUM_QUEUES command during device initialization.  So
change nvme_ctrlr_start() to only issue its SET_NUM_QUEUES
command when it is coming out of a reset - avoiding the
duplicate SET_NUM_QUEUES during device initialization.

Reported by:	gallatin
MFC after:	3 days
Sponsored by:	Intel
2016-02-11 17:32:41 +00:00
Roger Pau Monné
8f28a42ee7 xen-netfront: remove useless NULL check in netif_free
xn_ifp is allocated in create_netdev with if_alloc(IFT_ETHER).
According to the current arrangement it can't be NULL.

Coverity ID:		1349805
Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Sponsored by:		Citrix Systems R&D
Differential revision:	https://reviews.freebsd.org/D5252
2016-02-11 11:57:12 +00:00
Roger Pau Monné
d4dae2b1fb xen-netfront: rearrange error paths in setup_txqs
Coverity spotted double free errors in error path. Fix that by
removing the extraneous calls.

Coverity ID:		1349798
Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Sponsored by:		Citrix Systems R&D
Differential revision:	https://reviews.freebsd.org/D5251
2016-02-11 11:53:32 +00:00
Roger Pau Monné
7803499440 xen-netfront: remove pointless assignment in xn_ioctl
The variable error is assigned to 0 before entering the switch.
Assigning error to 0 before break pointless rewrites the real error
value that should be returned.

Coverity ID:		1304974
Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Sponsored by:		Citrix Systems R&D
Differential revision:	https://reviews.freebsd.org/D5250
2016-02-11 11:50:31 +00:00
Conrad Meyer
6ea028df50 ntb_hw(4): Print correct PAT name for non-WC/WB types mapped at load
Sponsored by:	EMC / Isilon Storage Division
2016-02-10 20:49:22 +00:00
Conrad Meyer
b1d46e7cb0 ntb_hw(4): Allow any x86 PAT caching flags for MW defaults
Replace the hw.ntb.enable_writecombine tunable with
hw.ntb.default_mw_pat.  It can be set with several specific numerical
values to select a caching type.  Any bogus value is treated as
Uncacheable (UC).

The ntb_mw_set_wc() KPI has removed the restriction that the selected
mode must be one of UC, WC, or WB.

Sponsored by:	EMC / Isilon Storage Division
2016-02-10 20:28:28 +00:00
Edward Tomasz Napierala
099ad7abd0 Add a kern.icl.drivers sysctl, to retrieve the list of registered
ICL drivers.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-02-10 19:01:26 +00:00
Gleb Smirnoff
b4b12e52fb Garbage collect unused arguments of m_init(). 2016-02-10 18:54:18 +00:00
Edward Tomasz Napierala
c5805a3deb Remove stray semicolons from the iSCSI code.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-02-10 17:55:39 +00:00
Andrew Turner
4f42bf9497 Explicitly include <sys/systm.h>. Previously we were pulling it in due to
header pollution.
2016-02-10 16:49:20 +00:00
Andrew Rybchenko
1e76f8b895 sfxge: implement SIOCGI2C to read information from phy modules
The IOCTL is used by 'ifconfig -v' to show SFP+/QSFP+ information
including inventory information and dianostics (temperature, light
levels, voltage etc).

Reviewed by:    gnn,melifaro
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D5240
2016-02-10 12:14:56 +00:00
Hans Petter Selasky
4bc7e098c7 Correct PCI device description.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
2016-02-10 08:03:10 +00:00
Hans Petter Selasky
8461d581cf To support userspace audio daemons like Virtual OSS, /dev/sndstat is
made writeable by the root user. Userspace audio daemons can add or
update an entry in /dev/sndstat by doing a single system write call to
any /dev/sndstat file descriptor handle. When the audio daemon closes the
file handle or is killed the entry disappears.

While at it, cleanup the sound status code a bit:
- keep the device list sorted to avoid sorting the list every time a
  /dev/sndstat read request is made.
- factor out locking into a pair of locking macros.
- use the sound status lock to protect all per file handle states,
  when generating the output for /dev/sndstat and when removing or
  adding sound status devices. This way sndstat_acquire() and
  sndstat_release() become superfluous and can be removed.

Reviewed by:		mav @
Differential Revision:	https://reviews.freebsd.org/D5191
2016-02-09 17:09:14 +00:00
Konstantin Belousov
db57c70a5b Rename P_KTHREAD struct proc p_flag to P_KPROC.
I left as is an apparent bug in ntoskrnl_var.h:AT_PASSIVE_LEVEL()
definition.

Suggested by:	jhb
Sponsored by:	The FreeBSD Foundation
2016-02-09 16:30:16 +00:00
Adrian Chadd
91ef8da010 Teach ofw_bus_parse_xref_list_alloc to be able to return the length of the parsed list.
Currently, there is no easy way to know in advance how many entries a list parsed by
ofw_bus_parse_xref_list_alloc() in sys/dev/ofw/ofw_bus_subr.c has.

This patch:

* teaches the existing function about handling idx == -1 and returning how big
  the set is; then renames it as _internal;
* create a new function that asserts idx != -1, so the old API is maintained;
* add a new function that returns just the list length.

Submitted by:	Stanislav Galabov <sgalabov@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D5043
2016-02-09 03:35:40 +00:00
Konstantin Belousov
0fb2c5d60c Do not call vn_fullpath(9) (through the pmc_getfilename() wrapper)
when its result is immediately ignored, i.e. for kernel processes
forked from the user process.  Do not test for non-null before freeing
string.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2016-02-06 15:39:04 +00:00
Eric Joyner
c80429cedb Update em(4) to 7.6.1; update igb(4) to 2.5.3.
Major changes:

- Add i219/i219(2) hardware support. (Found on Skylake generation and newer
  chipsets.)
  - Further to the last Skylake support diff, this one also includes support for
    the Lewisburg chipset (i219(3)).

- Add a workaround to an igb hardware errata.
  All 1G server products need to have IPv6 extension header parsing turned off.
  This should be listed in the specification updates for current 1G server
  products, e.g. for i350 it's errata #37 in this document:
  http://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/ethernet-controller-i350-spec-update.pdf

- Avoton (i354) PHY errata workaround added

And a bunch of minor fixes, as well as #defines for things that the current
em(4)/igb(4) drivers don't implement.

Differential Revision: https://reviews.freebsd.org/D3162
Reviewed by: sbruno, marius, gnn
Approved by: gnn
MFC after: 2 weeks
Sponsored by: Intel Corporation
2016-02-05 17:14:37 +00:00
Sepherosa Ziehau
3fd8cd9ce4 hyperv: Use malloc for page allocation.
We will eventually convert them to use busdma.

Submitted by:	Jun Su <junsu microsoft com>
Reviewed by:	adrian, sephe, Dexuan Cui <decui microsoft com>
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5087
2016-02-05 07:29:11 +00:00
Sepherosa Ziehau
27cc90ebb1 hyperv: Use WAITOK in the places where we can wait
And convert rndis non-hot path spinlock to mutex.

Submitted by:	Jun Su <junsu microsoft com>
Reviewed by:	adrian, sephe
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5081
2016-02-05 07:20:31 +00:00
Sepherosa Ziehau
f11ef33f0d hyperv: Use standard taskqueue instead of hv_work_queue
HyperV code was ported from Linux.  There is an implementation of
work queue called hv_work_queue.  In FreeBSD, taskqueue could be
used for the same purpose.  Convert all the consumer of hv_work_queue
to use taskqueue, and remove work queue implementation.

Submitted by:	Jun Su <junsu microsoft com>
Reviewed by:	adrian, Hongjiang Zhang <honzhan microsoft com>
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D4963
2016-02-05 07:09:58 +00:00
Sepherosa Ziehau
a7f84cedee hyperv/hn: Add an option to always do transmission scheduling
It is off by default. This eases more experiment on hn(4).

Reviewed by:	adrian, Hongjiang Zhang <honzhan microsoft com>
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5175
2016-02-05 05:50:53 +00:00
Sepherosa Ziehau
62c328f0c4 hyperv/hn: Move LRO flush to the channel processing rollup
This significantly increases LRO aggregation ratio when there are
large amount of connections (improves reception performance a lot).

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5167
2016-02-05 05:44:31 +00:00
Sepherosa Ziehau
e35e485b04 hyperv/hn: Increase LRO entry count to 128 by default
hn(4) only has one RX ring currently, so default 8 LRO entries
are too small.

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5166
2016-02-05 05:38:01 +00:00
Sepherosa Ziehau
1e4bb37d22 hyperv/hn: Recover half of the chimney sending space
We lost half of the chimney sending space, because we mis-used
ffs() on a 64 bits mask, where ffsl() should be used.

While I'm here:
- Use system atomic operation instead.
- Stringent chimney sending index assertion.

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5159
2016-02-05 05:31:31 +00:00
Sepherosa Ziehau
b256e94549 hyperv/hn: Factor out hn_encap() from hn_start_locked()
It will be shared w/ upcoming ifnet.if_transmit implementaion.

No functional changes.

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5158
2016-02-05 05:25:11 +00:00
Sepherosa Ziehau
58d6fc930e hyperv/hn: Obey IFCAP_RXCSUM configure
Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5104
2016-02-05 05:17:48 +00:00
Sepherosa Ziehau
b8109bd09e hyperv/hn: Add sysctls to trust host side UDP and IP csum verification
Reviewed by:	adrian, Hongjiang Zhang <honzhan microsoft com>
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5103
2016-02-05 05:12:30 +00:00
Sepherosa Ziehau
51ae346f9d hyperv/hn: Enable UDP RXCSUM
Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5102
2016-02-05 05:06:14 +00:00
Sepherosa Ziehau
b0fde7e820 hyperv/hn: Enable IP header checksum offloading
So that:
- TCP/IP stack will not do unnecessary IP header checksum for TSO
  packets.
- Reduce guest load for non-TSO IP packets.

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5099
2016-02-05 05:01:02 +00:00
Sepherosa Ziehau
74506a55d6 hyperv/hn: Reorganize TX csum offloading
- For non-TSO offloading, we don't need to access mbuf to know
  which csum offloading is requested, we can just use the
  CSUM_{IP,TCP,UDP} in the csum_flags.
- For TSO offloading, we still can depend on CSUM_{TSO4,TSO6}
  in the csum_flags to tell whether the TSO packet is an IPv4
  TSO packet or an IPv6 TSO packet.

This streamlines csum offloading handling (remove the two goto)
and allows us the nuke the unnecessary get_transport_proto_type().

Reviewed by:	adrian, Hongjiang Zhang <honzhan microsoft com>
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5098
2016-02-05 04:10:04 +00:00
Sepherosa Ziehau
82db5a8905 hyperv/hn: Avoid duplicate csum features settings
- Record csum features in softc, so we don't need to duplicate the
  logic from attach path to ioctl path.
- Protect if_capenable and if_hwassist changes by main lock.
- Prefer turn on/off bits in if_hwassist explicitly instead of using
  XOR.

Reviewed by:	adrian, Hongjiang Zhang <honzhan microsoft com>
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5085
2016-02-05 04:03:50 +00:00
Sepherosa Ziehau
f70c7ffe5e hyperv/stor: Fix the NULL pointer dereference
Reported by:	Netapp
Submitted by:	Hongjiang Zhang <honzhan microsoft com>
Reviewed by:	adrian, sephe, Dexuan Cui <decui microsoft com>
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5097
2016-02-05 03:46:53 +00:00
Scott Long
ee5c196b0a Add sysctls for dumping out the device mapping tables. I'm finding this
useful for debugging device-target translation bugs.

MFC after:	3 days
Sponsored by:	Netflix
2016-02-04 23:38:55 +00:00
Adrian Chadd
3f84dfc1cd Provide a workaround for setting the correct endianness when doing CFI on
a mips big-endian board.

This is (hopefully! ish!) a temporary change until a slightly better way
can be found to express this without a config option.

Tested:

* BUFFALO WZR-HP-G300NH 1stGen (by submitter)

Submitted by:	Mori Hiroki <yamori813@yahoo.co.jp>
2016-02-04 22:39:27 +00:00
Ravi Pokala
dd4637c078 Add defines for WRITE_UNCORRECTABLE ATA command, and improve command logging
Add #defines for ATA_WRITE_UNCORRECTABLE48 and its features. Update the
decoding in ATACAM to recognize the new values. Also improve command
decoding for a few other commands (SMART, NOP, SET_FEATURES). Bring the
decoding in ata(4) up to parity with ATACAM.

Reviewed by:	mav, imp
MFC after:	1 month
Sponsored by:	Panasas, Inc.
Differential Revision:	https://reviews.freebsd.org/D5181
2016-02-04 19:53:54 +00:00
Michael Tuexen
2602455cc2 In FreeBSD 10 and higher the driver announces SCTP checksum offloading support
also for 82598, which doesn't support it.
The legacy code has a check for it, which was missed when the code for dealing with
CSUM_IP6_* was added. Add the same check for FreeBSD 10 and higher.

Differential Revision:	https://reviews.freebsd.org/D5192
2016-02-04 18:08:50 +00:00
Gleb Smirnoff
8ee1c08783 Fix inverse logic. If this is zone_pack, then we shouldn't free the
cluster ourselves.

Found by review. Since this code is !386 and !amd64 and is executed
on error path, pretty sure no one ever executed it.
2016-02-03 20:39:52 +00:00
Adrian Chadd
f4c1f0b9eb Fix MFS builds when both MD_ROOT_SIZE and MFS_IMAGE are specified
MD_ROOT_SIZE and embed_mfs.sh were basically retired as part of
https://reviews.freebsd.org/D2903 .
However, when building a kernel with 'options MD_ROOT_SIZE' specified, this
results in a non-working MFS, as within sys/dev/md/md.c we fall within the
wrong # ifdef.

This patch implements the following:

* Allow kernels to be built without the MD_ROOT_SIZE option, which results
  in a kernel built as per D2903.
* Allow kernels to be built with the MD_ROOT_SIZE option, which results
  in a kernel built similarly to the pre-D2903 way, with the following
  differences:
  * The MFS is now put in a separate section within the kernel (oldmfs,
    so it differs from the mfs section introduced by D2903).
  * embed_mfs.sh is changed, so it looks up the oldmfs section within the
    kernel, gets its size and offset, sees if the MFS will fit within the
    allocated oldmfs section and only if all is well does a dd of the MFS
    image into the kernel.

Submitted by:	Stanislav Galabov <sgalabov@gmail.com>
Reviewed by:	brooks, imp
Differential Revision:	https://reviews.freebsd.org/D5093
2016-02-02 07:02:51 +00:00
Marius Strobl
d233a81b5a As it turns out, one of the more or less recent changes to em(4)
causes watchdog timeouts when using TSO4 at link speeds below
Gigabit, at least with 82573E. So disable the assist automatically
when at lower speeds.

Submitted by:	jfv
Approved by:	erj
Obtained from:	D3162
MFC after:	3 days
2016-02-01 23:51:30 +00:00
Gleb Smirnoff
8ec07310fa These files were getting sys/malloc.h and vm/uma.h with header pollution
via sys/mbuf.h
2016-02-01 17:41:21 +00:00
Marcelo Araujo
bfa3cf970f Clean up unused-but-set-variable spotted by gcc-4.9.
Reviewed by:	mav, slm
Approved by:	rodrigc (mentor)
MFC after:	2 weeks
Sponsored by:	gandi.net
2016-02-01 02:31:59 +00:00
Steven Hartland
0e872751df Fix ixgbe flow control autoneg reporting
Fix ixgbe reporting of flow control autoneg when running under DBG 1

Reviewed by:	erj
MFC after:	2 days
Sponsored by:	Multiplay
Differential Revision:	https://reviews.freebsd.org/D5089
2016-01-31 15:18:03 +00:00
Steven Hartland
1ebf555beb Configure ixgbe phy & gbic power
Setup phy and gbic power as per Linux 4.3.13 driver.

This fixes link not detected on X540-AT2 after booting to Linux which turns
the phy power off on detach.

Reviewed by:	sbruno
MFC after:	2 days
Sponsored by:	Multiplay
Differential Revision:	https://reviews.freebsd.org/D5107
2016-01-31 15:14:23 +00:00
Warner Losh
038659e7dd Implement power command to list all power modes, find out the power
mode we're in and to set the power mode.
2016-01-30 22:48:06 +00:00
Enji Cooper
d52f763c21 Use the correct type for i when iterating over buf to avoid unlikely
negative array indexing in iicrdwr(..)

Differential Revision: https://reviews.freebsd.org/D5132
Obtained from: HardenedBSD
PR: 206754
Reported by: CTurt <cturt@hardenedbsd.org>
Submitted by: Madhi Moktari <mokhi64@gmail.com>
Sponsored by: EMC / Isilon Storage Division
2016-01-30 18:33:23 +00:00
Michal Meloun
477aff3eae EHCI: Correct address of EHCI_USBMODE_LPM register is 0xC8, not 0xA8. 2016-01-30 08:27:09 +00:00
Steven Hartland
4088e74393 Fix phy interrupts setup for ixl
Fix the inverted set of interrupts being used as the mask for ixl.

Without this ixl devices fail to detect link state changes.

Reviewed by:	erj, sbruno
MFC after:	2 days
Sponsored by:	Multiplay
2016-01-29 21:06:59 +00:00
Ruslan Bukin
28029b68c0 Welcome the RISC-V 64-bit kernel.
This is the final step required allowing to compile and to run RISC-V
kernel and userland from HEAD.

RISC-V is a completely open ISA that is freely available to academia
and industry.

Thanks to all the people involved! Special thanks to Andrew Turner,
David Chisnall, Ed Maste, Konstantin Belousov, John Baldwin and
Arun Thomas for their help.
Thanks to Robert Watson for organizing this project.

This project sponsored by UK Higher Education Innovation Fund (HEIF5) and
DARPA CTSRD project at the University of Cambridge Computer Laboratory.

FreeBSD/RISC-V project home: https://wiki.freebsd.org/riscv

Reviewed by:	andrew, emaste, kib
Relnotes:	Yes
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D4982
2016-01-29 15:12:31 +00:00
Bryan Drewery
d5e53f99be filemon: Track the process pointer rather than a pid.
The process is not held since the process_exit hook is called after the
exithold.  There is no need to hold the process since the hook will
always see it exiting via the process_exit event.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-01-29 00:44:32 +00:00
Bryan Drewery
6137c5d990 filemon_open: Don't record a process to trace here.
Only ioctl(FILEMON_SET_PID) should be setting the process-to-be-traced.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-01-29 00:44:28 +00:00
Jim Harris
aeae6079b4 nvd: add hw.nvd.delete_max tunable
The NVMe specification does not define a maximum or optimal delete
size, so technically max delete size is min(full size of namespace,
2^32 - 1 LBAs).  A single delete operation for a multi-TB NVMe
namespace though may take much longer to complete than the nvme(4)
I/O timeout period.  So choose a sensible default here that is still
suitably large to minimize the number of overall delete operations.

This also fixes possible uint32_t overflow on initial TRIM operation
for zpool create operations for NVMe namespaces with >4G LBAs.

MFC after:	3 days
Sponsored by:	Intel
2016-01-28 23:15:14 +00:00
Bryan Drewery
f889a61ae5 filemon: Use process_exec EVENTHANDLER to capture sys_execve.
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-01-28 21:45:25 +00:00
Zbigniew Bodek
db7cfc199e Fix VNIC enumeration after r294993 and r294990
ofw_bus_get_node() must be tested against negative values since
missing parent bus method will result in calling the default method
which simply returns (-1): sys/dev/ofw/ofw_bus_if.m
This was lost in the review process.

Obtained from: Semihalf
Sponsored by:  Cavium
2016-01-28 16:58:49 +00:00
Gleb Smirnoff
009d75e764 Use m_getjcl() instead of manually selecting zone.
Reviewed by:	arybchik
2016-01-28 16:51:56 +00:00
Zbigniew Bodek
3f51d8888a Support new MDIO hierarchy in ThunderX DTB
Some firmware revisions provide different DTB tree that include
odd MDIO placement in the tree.
This commit adds support for 2 new buses:
- MRML bridge (PCIB subordinate)
- MDIO nexus (MRML subordinate)
This allows for the correct MDIO attachment with both - new and old
firmware.

Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5070
2016-01-28 15:44:14 +00:00
Zbigniew Bodek
be624ad430 Fix finding appropriate BGX node in DTB and move it to a separate function
Search for BGX node in DTS in two ways:
1. Try to find it uder root node first
2. If not found under root, find the top level PCI bridge node
   and search all nodes below it until appropriate BGX node is found.
Move search code to another function to make the code more clear.
Remove unused variable by the way.

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5066
2016-01-28 15:30:58 +00:00
Michal Meloun
cdf4ec6873 EHCI: Make core reset and port speed reading more generic.
Use driver settable callbacks for handling of:
- core post reset
- reading actual port speed

Typically, OTG enabled EHCI cores wants setting of USBMODE register,
but this register is not defined in EHCI specification and different
cores can have it on different offset.

Also, for cores with TT extension, actual port speed must be determinable.
But again, EHCI specification not covers this so this patch provides
function for two most common variant of speed bits layout.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D5088
2016-01-28 14:11:59 +00:00
Bryan Drewery
e95c55e50d Follow-up r294967: Mark flags unused.
X-MFC-With:	r294967
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-01-28 01:19:19 +00:00
Bryan Drewery
2f6009620f filemon: Trace fork via process_fork event.
This avoids needing ugly hooks and needing both a vfork and fork
handler.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-01-28 01:17:55 +00:00
Bryan Drewery
79d699139b filemon: Use process_exit EVENTHANDLER to capture process exit.
This fixes some cases where a process could exit without being untracked
by filemon.

Reported by:	mjg
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-01-28 00:51:17 +00:00
Bryan Drewery
50c99f32a9 filemon_dtr: Lock the associated filemon handle before writing to it.
Reported by:	mjg
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-01-27 21:37:43 +00:00
Bryan Drewery
2b198fe92f filemon_comment has nothing to do with wrappers so move it out of filemon_wrapper.c.
It only prints the header from filemon_ioctl.  Keep the name though to stay
closer to other implementations.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-01-27 21:17:43 +00:00
Bryan Drewery
64c368a488 filemon_ioctl: Lock the associated filemon handle before writing to it.
Reported by:	mjg
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-01-27 21:14:09 +00:00
Bryan Drewery
e8c87a09dc filemon_ioctl: Handle error from devfs_get_cdevpriv(9).
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-01-27 21:12:18 +00:00
Bryan Drewery
fac4a7ac31 Drop any previous fd when setting a new one.
Reported by:	mjg
Sponsored by:	EMC / Isilon Storage Division
MFC after:	2 weeks
2016-01-27 19:11:11 +00:00
Andrew Turner
7900c60a92 Fix the value we print when the size is too large. While here fix the types
we cast to to be unsigned as the data is unsigned.

Reviewed by:	ian
2016-01-27 17:47:07 +00:00
Andrew Turner
b958a08eb7 When finding the physical address of a device allow intermediate addresses
to be 64-bit on 32-bit architectures. It is not uncommon for device trees
to use the upper 32-bits to store what effectively is an index into the
parent ranges property. In this case, when running with a 32-bit bus_addr_t
and bus_size_t, we would previously truncate the address, this may then
incorrectly match the wrong range, and return the wrong address.

Tested by:	bz (earlier version)
2016-01-27 17:33:31 +00:00
Gleb Smirnoff
f353ae1c62 More fixes to the build. 2016-01-27 05:15:53 +00:00
Gleb Smirnoff
adbb1b2d22 Fix build on i386. I can't yet understand why does it build on amd64. 2016-01-27 04:59:28 +00:00
Sepherosa Ziehau
0eff2e2ea1 hyperv/vmbus: Event handling code refactor.
- Use taskqueue instead of swi for event handling.
- Scan the interrupt flags in filter
- Disable ringbuffer interrupt mask in filter to ensure no unnecessary
  interrupts.

Submitted by:		Jun Su <junsu microsoft com>
Reviewed by:		adrian, sephe, Dexuan <decui microsoft com>
Approved by:		adrian (mentor)
MFC after:		2 weeks
Sponsored by:		Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D4920
2016-01-27 03:53:30 +00:00
Justin Hibbits
2dd1bdf183 Convert rman to use rman_res_t instead of u_long
Summary:
Migrate to using the semi-opaque type rman_res_t to specify rman resources.  For
now, this is still compatible with u_long.

This is step one in migrating rman to use uintmax_t for resources instead of
u_long.

Going forward, this could feasibly be used to specify architecture-specific
definitions of resource ranges, rather than baking a specific integer type into
the API.

This change has been broken out to facilitate MFC'ing drivers back to 10 without
breaking ABI.

Reviewed By: jhb
Sponsored by:	Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D5075
2016-01-27 02:23:54 +00:00
Gleb Smirnoff
57a78e3bae Augment struct tcpstat with tcps_states[], which is used for book-keeping
the amount of TCP connections by state.  Provides a cheap way to get
connection count without traversing the whole pcb list.

Sponsored by:	Netflix
2016-01-27 00:45:46 +00:00
David C Somayajulu
c9a48e1dde Upgrade FW to 5.4.56
Update driver version to 3.10.26
2016-01-26 22:32:58 +00:00
Andriy Voskoboinyk
798e1ce39b rtwn: do not start vap when initialization fails
- Start vap(s) (via ieee80211_start_all()) only when initialization
succeeds; stop the first vap otherwise (via ieee80211_stop());
- Do not try to stop a device multiple times
(move (sc->sc_flags & RTWN_RUNNING) check to urtwn_stop_locked()).

Tested by:	kevlo
Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5058
2016-01-26 16:50:59 +00:00
Andriy Voskoboinyk
5274f944ba rtwn: use ieee80211_restart_all() for device reset
Tested by:	kevlo
Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5057
2016-01-26 16:34:27 +00:00
Hans Petter Selasky
fe68f570d4 Update and add various macros to the LinuxKPI and resolve a macro
redefinition issue in the cxgb driver.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
Reviewed by:	np @
2016-01-26 15:26:35 +00:00
Steven Hartland
f2c4db545f ixgbe sysctl hardware defaults
Added hw.ix.flow_control which enables the default flow_control of all ix
interfaces to be set in loader.conf.

Added hw.ix.advertise_speed which enables the default advertised_speed of
all ix interfaces to be set in loader.conf.

Made enable_aim device independent based on hw.ix.enable_aim default.

Reviewed by:	erj
MFC after:	1 week
Sponsored by:	Multiplay
Differential Revision:	https://reviews.freebsd.org/D5060
2016-01-26 12:30:17 +00:00
Sepherosa Ziehau
719d2f1ad5 hyperv/hn: Improve sending performance
- Avoid main lock contention by trylock for if_start, if that fails,
  schedule TX taskqueue for if_start
- Don't do direct sending if the packet to be sent is large, e.g.
  TSO packet.

This change gives me stable 9.1Gbps TCP sending performance w/ TSO
over a 10Gbe directly connected network (the performance fluctuated
between 4Gbps and 9Gbps before this commit). It also improves non-
TSO TCP sending performance a lot.

Reviewed by:		adrian, royger
Approved by:		adrian (mentor)
Sponsored by:		Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5074
2016-01-26 09:42:13 +00:00
Marius Strobl
57169cea64 - Make the code consistent with itself style-wise and bring it closer
to style(9).
- Mark unused arguments as such.
- Make the ttystates table const.
2016-01-25 22:58:06 +00:00
Steven Hartland
94241c6011 Fix ixgbe compliation with DBG 1
Fixed ERROR_REPORTXX macros so that ixgbe compiles with #define DBG 1

MFC after:	1 week
Sponsored by:	Multiplay
Differential Revision:	https://reviews.freebsd.org/D5061
2016-01-25 16:18:53 +00:00
Zbigniew Bodek
073fae869b Do not destroy input buffer of the OF_getencprop() function on error
Currently when the OF_getprop() function returns with error,
the caller (OF_getencprop()) still changes the buffer endiannes.
This may destroy the default value passed in the input buffer if
used on a Little Endian platform.

Reviewed by:   mmel
Submitted by:  Zbigniew Bodek <zbb@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Cavium
2016-01-25 14:42:44 +00:00
Sepherosa Ziehau
51f6f18c88 hyperv/vmbus: Avoid extra copy of page information.
The page information array could contain up to 32 elements (i.e. 512B).
And on network side w/ TSO, 11+ (176B+) elements, i.e. ~44K TSO packet,
in the page information array is quite common.

This saves us some cpu cycles.

Reviewed by:		adrian, delphij
Approved by:		adrian (mentor)
Sponsored by:		Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D4992
2016-01-25 05:33:18 +00:00
Sepherosa Ziehau
dc1418432b hyperv/hn: Trust host TCP segment checksum verification by default.
According to all available information, VMSWITCH always does the
TCP segment checksum verification before sending the segment to
guest.

Reviewed by:		adrian, delphij, Hongjiang Zhang <honzhan microsoft com>
Approved by:		adrian (mentor)
Sponsored by:		Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D4991
2016-01-25 05:25:39 +00:00
Sepherosa Ziehau
7ea161b0ec hyperv/hn: Remove unnecessary zeroing out the netvsc_packet
All used fields are setup one by one, so there is no need to zero
out this large struct.

While I'm here, move the stack variable near its usage.

Reviewed by:		adrian, delphij, Jun Su <junsu microsoft com>
Approved by:		adrian (mentor)
Sponsored by:		Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D4978
2016-01-25 05:18:57 +00:00
Sepherosa Ziehau
4d9e79a3be hyperv/hn: Use m_copydata for chimney sending.
While I'm here, move stack variables near their usage.

Reviewed by:		adrian, delphij, Jun Su <junsu microsoft com>
Approved by:		adrian (mentor)
Sponsored by:		Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D4977
2016-01-25 05:12:00 +00:00
Sepherosa Ziehau
391ad73b70 hyperv/hn: Partly rework transmission path
- Avoid unnecessary malloc/free on transmission path.
- busdma(9)-fy transmission path.
- Properly handle IFF_DRV_OACTIVE.  This should fix the network
  stalls reported by many.
- Properly setup TSO parameters.
- Properly handle bpf(4) tapping.  This 5 times the performance
  during TCP sending test, when there is one bpf(4) attached.
- Allow size of chimney sending be tuned on a running system.
  Default value still needs more test to determine.

Reviewed by:		adrian, delphij
Approved by:		adrian (mentor)
Sponsored by:		Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D4972
2016-01-25 05:01:32 +00:00
Andrew Turner
a7ce3cb185 Fix the style of the reading of a nodes xref to make it readable. 2016-01-24 17:09:11 +00:00
Michal Meloun
0a17d8c230 Add reset framework, a second part of new 'extended resources' family of
support frameworks (i.e. regulators/phy/tsensors/fuses...).

It provides simple unified consumers interface for manipulations with
on-chip resets.

Reviewed by: ian, imp (paritaly)
2016-01-24 11:03:35 +00:00
Michal Meloun
12a05f9a86 Add clock framework, a first part of new 'extended resources' family of
support frameworks(i.e. reset/regulators/phy/tsensors/fuses...).

The clock framework significantly simplifies handling of complex clock
structures found in modern SoCs. It provides the unified consumers
interface, holds and manages actual clock topology, frequency and gating.

It's tested on three different ARM boards (Nvidia Tegra TK1, Inforce 6410 and
Odroid XU2) and on one MIPS board (Creator Ci20) by kan@.

The framework is still far from perfect and probably doesn't have stable
interface yet, but we want to start testing it on more real boards and
different architectures.

Reviewed by: ian, kan (earlier version)
2016-01-24 11:00:38 +00:00
Ruslan Bukin
7eae0d9fbd o Add gain-level control registers.
o Fix style.

Sponsored by:	Machdep, Inc.
2016-01-23 13:34:55 +00:00
Navdeep Parhar
097f289f25 Fix for iWARP servers that listen on INADDR_ANY.
The iWARP Connection Manager (CM) on FreeBSD creates a TCP socket to
represent an iWARP endpoint when the connection is over TCP. For
servers the current approach is to invoke create_listen callback for
each iWARP RNIC registered with the CM. This doesn't work too well for
INADDR_ANY because a listen on any TCP socket already notifies all
hardware TOEs/RNICs of the new listener. This patch fixes the server
side of things for FreeBSD. We've tried to keep all these modifications
in the iWARP/TCP specific parts of the OFED infrastructure as much as
possible.

Submitted by:	Krishnamraju Eraparaju @ Chelsio (with design inputs from Steve Wise)
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D4801
2016-01-22 23:33:34 +00:00
Konstantin Belousov
be62a642f2 Remove printf only useful for debugging.
Requested by:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2016-01-22 20:28:24 +00:00