Commit Graph

30511 Commits

Author SHA1 Message Date
Sepherosa Ziehau
5788ded618 hyperv/hn: Add option to bind TX taskqueues to the specified CPU
It will be used to help tracking host side transmission ring selection
issue; and it will be turned on by default, once we have concrete result.

Reviewed by:	adrian, Jun Su <junsu microsoft com>
Approved by:	adrian (mento)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5316
2016-02-19 05:03:17 +00:00
Adrian Chadd
ad73b30173 document some ACPI related sysctls.
Submitted by:	Oliver Pinter <oliver.pinter@hardenedbsd.org>
Sponsored by:	HardenedBSD
Differential Revision:	https://reviews.freebsd.org/D5263
2016-02-19 05:02:17 +00:00
Justin Hibbits
43cd61606b Replace several bus_alloc_resource() calls using default arguments with bus_alloc_resource_any()
Since these calls only use default arguments, bus_alloc_resource_any() is the
right call.

Differential Revision: https://reviews.freebsd.org/D5306
2016-02-19 03:37:56 +00:00
Kevin Lo
277db30576 Remove bogus cast. 2016-02-19 01:57:51 +00:00
Kevin Lo
29899c0add Add missing parentheses.
Found by:	PVS-Studio
2016-02-19 01:56:59 +00:00
Navdeep Parhar
40bf7442fa cxgbe: catch up with the latest hardware-related definitions.
Obtained from:	Chelsio Communications
Sponsored by:	Chelsio Communications
2016-02-19 00:29:16 +00:00
Jung-uk Kim
bfe2514a08 Remove a bogus bzero() call.
Found by:	PVS-Studio
2016-02-18 23:32:11 +00:00
Zbigniew Bodek
910905c74f Fix build for i386 and arm64 after r295755
- Take bus_space_tag_t type into consideration when returning
  default, zero value.
- Include missing rman.h required by ofw_pci.h
2016-02-18 15:44:45 +00:00
Zbigniew Bodek
a259e55bb9 Extract common code from PowerPC's ofw_pci
Import portions of the PowerPC OF PCI implementation into
new file "ofw_pci.c", common for other platforms. The files ofw_pci.c and
ofw_pci.h from sys/powerpc/ofw no longer exist. All required declarations
are moved to sys/dev/ofw/ofw_pci.h.

This creates a new ofw_pci_write_ivar() function and modifies
ofw_pci_nranges(), ofw_pci_read_ivar(), ofw_pci_route_interrupt() methods.
Most functions contain existing ppc implementations in the majority
unchanged. Now there is no need to have multiple identical copies
of methods for various architectures.

Submitted by:  Marcin Mazurek <mma@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Annapurna Labs
Reviewed by:   jhibbits, mmel
Differential Revision: https://reviews.freebsd.org/D4879
2016-02-18 13:07:21 +00:00
Zbigniew Bodek
e2d4f32f4e Fix bug in ofwbus_release_resource() for non-ofwbus descendants
Resource list for devices that are not ofwbus descendants, but
got to ofwbus method via bus_generic_release_resource() call chain,
cannot be found using BUS_GET_RESOURCE_LIST() used by ofwbus.
In that case, changing device's resource list should be avoided
(will not contain resource list prepared by ofw or simplebus).

Pointy-hat to: zbb
Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5304
2016-02-18 11:53:57 +00:00
Sepherosa Ziehau
57fb9b3fd1 hyperv/hn: Use buf_ring for txdesc list
So one spinlock is avoided, which would be potentially dangerous for
virtual machine, if the spinlock holder was scheduled out by the host,
as noted by royger.

Old spinlock based txdesc list is still kept around, so we could have
a safe fallback.

No performance regression nor improvement is observed.

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5290
2016-02-18 07:44:14 +00:00
Sepherosa Ziehau
dbfb4eba54 hyperv/hn: Split TX ring data structure out of softc
This paves the way for upcoming vRSS stuffs and eases more code cleanup.

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5283
2016-02-18 07:37:59 +00:00
Sepherosa Ziehau
b8f2d59daf hyperv/hn: Use non-fast taskqueue for transmission
Performance stays same; so no need to use fast taskqueue here.

Suggested by:	royger
Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5282
2016-02-18 07:28:45 +00:00
Sepherosa Ziehau
4d8e8cb113 hyperv/hn: Use taskqueue_enqueue()
This also eases experiment on the non-fast taskqueue.

Reviewed by:	adrian, Jun Su <junsu microsoft com>
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5276
2016-02-18 07:23:05 +00:00
Sepherosa Ziehau
17ab6c4f17 hyperv/hn: Split RX ring data structure out of softc
This paves the way for upcoming vRSS stuffs and eases more code cleanup.

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5275
2016-02-18 07:16:31 +00:00
Sepherosa Ziehau
f9c55d1c83 hyperv/hn: Change global tunable prefix to hw.hn
And use SYSCTL+CTLFLAG_RDTUN for them.

Suggested by:	adrian
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/D5274
2016-02-18 07:06:44 +00:00
Sepherosa Ziehau
01610d88da hyperv/hn: Always do transmission scheduling.
This one gives the best performance so far.

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5273
2016-02-18 07:00:47 +00:00
Sepherosa Ziehau
58f5a606fa hyperv/hn: Add option to allow sharing TX taskq between hn instances
It is off by default.  This eases further experimenting on this driver.

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5272
2016-02-18 06:55:05 +00:00
Sepherosa Ziehau
aa7f74113e hyperv/hn: Set the TCP ACK/data segment aggregation limit
Set TCP ACK append limit to 1, i.e. aggregate 2 ACKs at most.  Aggregating
anything more than 2 hurts TCP sending performance in hyperv.  This
significantly improves the TCP sending performance when the number of
concurrent connetion is low (2~8).  And it greatly stabilizes the TCP
sending performance in other cases.

Set TCP data segments aggregation length limit to 37500.  Without this
limitation, hn(4) could aggregate ~45 TCP data segments for each
connection (even at 64 or more connections) before dispatching them to
socket code; large aggregation slows down ACK sending and eventually
hurts/destabilizes TCP reception performance.  This setting stabilizes
and improves TCP reception performance for >4 concurrent connections
significantly.

Make them sysctls so they could be adjusted.

Reviewed by:	adrian, gallatin (previous version), hselasky (previous version)
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5185
2016-02-18 04:59:37 +00:00
Pyun YongHyeon
4a1ff07b39 Fix a bug introduced in r295736
TX descriptor address should be updated for valid chain.

Pointed out by:	jmallett
2016-02-18 03:05:08 +00:00
Pyun YongHyeon
90cf5d3043 Remove duplicated check.
Found by:	PVS-Studio
2016-02-18 01:30:49 +00:00
Pyun YongHyeon
9dda5c8ffc Fix variable assignment.
Found by:	PVS-Studio
2016-02-18 01:24:10 +00:00
Gleb Smirnoff
7b0c04c29c Fix a potentially "forever" loop.
Found by:	PVS-Studio
2016-02-17 21:24:26 +00:00
Gleb Smirnoff
ec911df8da Ternary operator has lower priority than OR.
Found by:	PVS-Studio
2016-02-17 21:13:33 +00:00
Gleb Smirnoff
9389e53fd4 Add missing braces.
Found by:	PVS-Studio
Approved by:	so (implicit)
2016-02-17 21:09:19 +00:00
Warner Losh
c55f57071a Create an API to reset a struct bio (g_reset_bio). This is mandatory
for all struct bio you get back from g_{new,alloc}_bio. Temporary
bios that you create on the stack or elsewhere should use this before
first use of the bio, and between uses of the bio. At the moment, it
is nothing more than a wrapper around bzero, but that may change in
the future. The wrapper also removes one place where we encode the
size of struct bio in the KBI.
2016-02-17 17:16:02 +00:00
Justin Hibbits
89977ce227 Convert a few more long -> rman_res_t. 2016-02-16 17:55:10 +00:00
Andrew Turner
45fd186285 Allow callers of OF_decode_addr to get the size of the found mapping. This
will allow for code that uses the old fdt_get_range and fdt_regsize
functions to find a range, map it, access, then unmap to replace this, up
to and including the map, with a call to OF_decode_addr.

As this function should only be used in the early boot code the unmap is
mostly do document we no longer need the mapping as it's a no-op, at least
on arm.

Reviewed by:	jhibbits
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D5258
2016-02-16 15:18:12 +00:00
Eric van Gyzen
bb51c27943 ichsmb: add PCI device ID for Intel Sunrise Point-H SMBus controller
MFC after:	3 days
Sponsored by:	Dell Inc.
2016-02-16 02:23:39 +00:00
Bryan Drewery
a2109e0056 Filemon: Fix panic when fork1() is called from kproc_create().
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-02-16 02:14:25 +00:00
Andrew Turner
740be1dc58 Fix the spelling of OF_getencprop. It will fix the data correctly for the
endian of the CPU so there is no need to call fdt32_to_cpu.

Sponsored by:	ABT Systems Ltd
2016-02-15 17:14:10 +00:00
Andrew Turner
5f250b53e8 Add support for the Allwinner i2c device. This is similar to the existing
Marvell twsi part, however uses different register locations, as such split
the existing driver into Marvell and Allwinner attachments.

While here clean a few style issues.

Submitted by:	Emmanuel Vadot <manu@bidouilliste.com>
Differential Revision:	https://reviews.freebsd.org/D4846
2016-02-15 15:11:26 +00:00
Andrew Turner
632381ed9d Move the twsi driver source to be under iicbus. It is in a separate
directory as it is expected multiple attachments will be added for the SoC
families that use this hardware.

Sponsored by:	ABT Systems Ltd
2016-02-14 23:51:13 +00:00
Conrad Meyer
f98d21e561 NTB: workaround for high traffic hardware hang
This patch comes from Dave Jiang's Linux tree, davejiang/ntb.  It hasn't
been accepted into Linus' tree, so I do not have an authoritative SHA1
to point at.  Original commit log:

=====================================================================
A hardware errata causes the NTB to hang when heavy bi-directional
traffic in addition to the usage of BAR0/1 (where the registers reside,
including the doorbell registers to trigger interrupts).

This workaround is only available on Haswell and Broadwell platform.
The workaround is to enable split BAR in the BIOS to allow the 64bit
BAR4 to be split into two 32bit BAR4 and BAR5. The BAR4 shall be pointed
to LAPIC region of the remote host. We will bypass the db mechanism and
directly trigger the MSIX interrupts. The offsets and vectors are
exchanged during transport scratch pad negotiation. The scratch pads are
now overloaded in order to allow the exchange of the information. This
gets around using the doorbell and prevents the lockup with additional
pcode changes in BIOS.

Signed-off-by:	Dave Jiang <dave.jiang@intel.com>
=====================================================================

Notable changes in the FreeBSD version of this patch:
* The MSIX BAR is configurable, like hw.ntb.b2b_mw_idx (msix_mw_idx).
  The Linux version of the patch only uses BAR4.
* MSIX negotiation aborts if the link goes down.

Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2016-02-14 22:37:28 +00:00
Hans Petter Selasky
d5fb67a401 Restore maximum number of host keys to 64.
Discussed with:	adrian @ and avos @
2016-02-14 16:18:39 +00:00
Colin Percival
bcccdfa37b Don't dereference a pointer immediately after determining that it is
equal to NULL. [1]

While I'm here, s/xb/xbd/ (the name changed a long time ago but this
instance wasn't corrected).

Reported by:	PVS-Studio [1]
2016-02-14 13:42:16 +00:00
Hans Petter Selasky
8cb15594b3 Fix variable assignment inside if-clause in the smsc driver.
Found by D5245 / PVS.

MFC after:	1 week
2016-02-14 07:20:07 +00:00
Hans Petter Selasky
fe3e452399 Reduce the number of supported WLAN keys in the rum driver, else we
risk bit shifting overflows. Found by D5245 / PVS.

MFC after:	1 week
2016-02-14 07:16:36 +00:00
Sepherosa Ziehau
ffc6b639c2 hyperv/hn: Fix typo in comment
Noticed by:	avos
Reviewed by:	adrian, avos, Hongjiang Zhang <honzhan microsoft com>
Approved by:	adrian
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5199
2016-02-14 02:28:59 +00:00
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