Commit graph

111258 commits

Author SHA1 Message Date
Pedro F. Giffuni b16de7bff1 usb/uhso: Don't bail out on first USB error.
CID:		1305680
Submitted by:	hselasky
MFC after:	3 days
2016-06-02 15:30:58 +00:00
Ruslan Bukin 03e4a374c4 Fix typos. 2016-06-02 15:14:40 +00:00
Roger Pau Monné bf7b50db15 xen-netfront: use callout_reset_curcpu instead of callout_reset
This should help distribute the load of the callbacks.

Suggested by:	hps
Sponsored by:	Citrix Systems R&D
2016-06-02 14:25:10 +00:00
Kashyap D Desai 8cd174a463 Added support for Avago/Broadcom Cutlass(12 Gbps- 16 port count) controllers.
Submitted by:   Sumit Saxena <Sumit.Saxena@broadcom.com>
Reviewed by:    Kashyap Desai <Kashyap.Desai@broadcom.com>
MFC after:  3 days
Sponsored by:   AVAGO/BROADCOM Limited
2016-06-02 12:26:55 +00:00
Andriy Voskoboinyk 6fc44742fd urtw: fix unused variable assignments.
Append CWmax and retry limitation to tp->maxretry instead of rewriting it
(will restore pre-r198194 behavior).

Noticed by:	pfg, hps

Reported by:	Coverity
CID:		1304937, 1304920
2016-06-02 12:01:58 +00:00
Roger Pau Monné c2d12e5e0d xen-netfront: perform an interface reset when changing options
The PV backend will only pick the new options when the interface is detached
and reattached again, so perform a full reset when changing options. This is
very fast, and should not be noticeable by the user.

Reviewed by:		Wei Liu <wei.liu2@citrix.com>
Sponsored by:		Citrix Systems R&D
Differential revision:	https://reviews.freebsd.org/D6658
2016-06-02 11:21:00 +00:00
Roger Pau Monné d039b0700b xen-netfront: release grant references used for the shared rings
Just calling gnttab_end_foreign_access_ref doesn't free the references,
instead call gnttab_end_foreign_access with a NULL page argument in order to
have the grant references freed. The code that maps the ring
(xenbus_map_ring) already uses gnttab_grant_foreign_access which takes care
of allocating a grant reference.

Reviewed by:		Wei Liu <wei.liu2@citrix.com>
Sponsored by:		Citrix Systems R&D
Differential revision:	https://reviews.freebsd.org/D6608
2016-06-02 11:19:16 +00:00
Roger Pau Monné c21b47d8c9 xen-netfront: fix two hotplug related issues
This patch fixes two issues seen on hot-unplug. The first one is a panic
caused by calling ether_ifdetach after freeing the internal netfront queue
structures. ether_ifdetach will call xn_qflush, and this needs to be done
before freeing the queues. This prevents the following panic:

Fatal trap 9: general protection fault while in kernel mode
cpuid = 2; apic id = 04
instruction pointer	= 0x20:0xffffffff80b1687f
stack pointer	        = 0x28:0xfffffe009239e770
frame pointer	        = 0x28:0xfffffe009239e780
code segment		= base 0x0, limit 0xfffff, type 0x1b
			= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags	= interrupt enabled, resume, IOPL = 0
current process		= 0 (thread taskq)
[ thread pid 0 tid 100015 ]
Stopped at      strlen+0x1f:    movq    (%rcx),%rax
db> bt
Tracing pid 0 tid 100015 td 0xfffff800038a6000
strlen() at strlen+0x1f/frame 0xfffffe009239e780
kvprintf() at kvprintf+0xfa0/frame 0xfffffe009239e890
vsnprintf() at vsnprintf+0x31/frame 0xfffffe009239e8b0
kassert_panic() at kassert_panic+0x5a/frame 0xfffffe009239e920
__mtx_lock_flags() at __mtx_lock_flags+0x164/frame 0xfffffe009239e970
xn_qflush() at xn_qflush+0x59/frame 0xfffffe009239e9b0
if_detach() at if_detach+0x17e/frame 0xfffffe009239ea10
netif_free() at netif_free+0x97/frame 0xfffffe009239ea30
netfront_detach() at netfront_detach+0x11/frame 0xfffffe009239ea40
[...]

Another panic can be triggered by hot-plugging a NIC:

Fatal trap 18: integer divide fault while in kernel mode
cpuid = 0; apic id = 00
instruction pointer	= 0x20:0xffffffff80902203
stack pointer	        = 0x28:0xfffffe00508d3660
frame pointer	        = 0x28:0xfffffe00508d36a0
code segment		= base 0x0, limit 0xfffff, type 0x1b
			= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags	= interrupt enabled, resume, IOPL = 0
current process		= 2960 (ifconfig)
[ thread pid 2960 tid 100088 ]
Stopped at      xn_txq_mq_start+0x33:   divl    %esi,%eax
db> bt
Tracing pid 2960 tid 100088 td 0xfffff8000850aa00
xn_txq_mq_start() at xn_txq_mq_start+0x33/frame 0xfffffe00508d36a0
ether_output() at ether_output+0x570/frame 0xfffffe00508d3720
arprequest() at arprequest+0x433/frame 0xfffffe00508d3820
arp_ifinit() at arp_ifinit+0x49/frame 0xfffffe00508d3850
xn_ioctl() at xn_ioctl+0x1a2/frame 0xfffffe00508d3890
in_control() at in_control+0x882/frame 0xfffffe00508d3910
ifioctl() at ifioctl+0xda1/frame 0xfffffe00508d39a0
kern_ioctl() at kern_ioctl+0x246/frame 0xfffffe00508d3a00
sys_ioctl() at sys_ioctl+0x171/frame 0xfffffe00508d3ae0
amd64_syscall() at amd64_syscall+0x2db/frame 0xfffffe00508d3bf0
Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe00508d3bf0
--- syscall (54, FreeBSD ELF64, sys_ioctl), rip = 0x8011e185a, rsp =
0x7fffffffe478, rbp = 0x7fffffffe4c0 ---

This is caused by marking the driver as active before it's fully
initialized, and thus calling xn_txq_mq_start with num_queues set to 0.

Reviewed by:		Wei Liu <wei.liu2@citrix.com>
Sponsored by:		Citrix Systems R&D
Differential revision:	https://reviews.freebsd.org/D6646
2016-06-02 11:18:02 +00:00
Roger Pau Monné da695b059d xen-netfront: switch to using an interrupt handler
In order to use custom taskqueues we would have to mask the interrupt, which
is basically what is already done for an interrupt handler, or else we risk
loosing interrupts. This switches netfront to the same interrupt handling
that was done before multiqueue support was added.

Reviewed by:	Wei Liu <wei.liu2@citrix.com>
Sponsored by:	Citrix Systems R&D
2016-06-02 11:16:35 +00:00
Roger Pau Monné 2568ee6747 xen-netfront: always keep the Rx ring full of requests
This is based on Linux commit 1f3c2eba1e2d866ef99bb9b10ade4096e3d7607c from
David Vrabel:

A full Rx ring only requires 1 MiB of memory.  This is not enough memory
that it is useful to dynamically scale the number of Rx requests in the ring
based on traffic rates, because:

a) Even the full 1 MiB is a tiny fraction of a typically modern Linux
   VM (for example, the AWS micro instance still has 1 GiB of memory).

b) Netfront would have used up to 1 MiB already even with moderate
   data rates (there was no adjustment of target based on memory
   pressure).

c) Small VMs are going to typically have one VCPU and hence only one
   queue.

Keeping the ring full of Rx requests handles bursty traffic better than
trying to converge on an optimal number of requests to keep filled.

Reviewed by:	Wei Liu <wei.liu2@citrix.com>
Sponsored by:	Citrix Systems R&D
2016-06-02 11:14:26 +00:00
Roger Pau Monné d9a66b6ded xen-netfront: fix receiving TSO packets
Currently FreeBSD is not properly fetching the TSO information from the Xen
PV ring, and thus the received packets didn't have all the necessary
information, like the segment size or even the TSO flag set.

Sponsored by: Citrix Systems R&D
2016-06-02 11:12:11 +00:00
Roger Pau Monné 7b1d3a09e3 xen: rewrite Xen error translation
Using the public Xen error code header.

Submitted by:	Akshay Jaggi <akshay1994.leo@gmail.com>
Reviewed by:	royger
2016-06-02 07:45:01 +00:00
Roger Pau Monné 71da5f7a01 xen: add missing #define in include guard.
Submitted by:	Akshay Jaggi <akshay1994.leo@gmail.com>
Reviewed by:	royger
2016-06-02 07:43:02 +00:00
Adrian Chadd 0e92cf939f [iwm] valid_{tx,rx}_ant from radio_cfg is only needed for 8000 family.
* The "if (!data->valid_tx_ant || !data->valid_rx_ant) {" check was getting
  triggered with a 3165 chipset.

Submitted by:	Imre Vadasz <imre@vdsz.com>
Obtained from:	DragonflyBSD 3655dfb6fc311fc83e5ce8370dd91b4cd4a37991
2016-06-02 06:22:59 +00:00
Adrian Chadd 88b6e4f33a [iwm] Fix several nitpicks in iwm(4).
Move some declarations to if_iwmreg.h.
    Remove iwm_fw_alive(); just call iwm_post_alive() directly.
    Simplify iwm_mvm_add_sta().
    Return timeout error from iwm_apm_init().
    Print a message when init (i.e. boot) firmware fails to load.
    Remove some commented-out code which wouldn't compile anyway.
    Move iwm_mvm_tx_fifo to if_iwmreg.h to match better where Linux puts it.

    Taken-From: OpenBSD (if_iwm.c r1.80 and if_iwmreg.h r1.11)

Submitted by:	 Imre Vadasz <imre@vdsz.com>
Obtained from:	DragonflyBSD 29fcb331e5620ae145a6ab9cdda830e22fff626a
2016-06-02 05:43:16 +00:00
Adrian Chadd 3028d11c3e [iwm] Add bit-polling in Rx-DMA init code path.
Taken-From: OpenBSD (if_iwm.c r1.80)

Submitted by:	Imre Vadasz <imre@vdsz.com>
Obtained from:	DragonflyBSD ed35558754288911048cb607e57c688273ebd8d4
2016-06-02 05:00:52 +00:00
Adrian Chadd ebb6ea5662 [iwm] Clean up iwm(4) scanning logic a bit.
Submitted by:	Imre Vadasz <imre@vdsz.com>
Obtained from:	DragonflyBSD 8f3ffab9136e33263d424275ec28f57ad2096437
2016-06-02 04:54:56 +00:00
Adrian Chadd 7a8b94e1d2 [iwm] Use IWM_MAX_CMD_PAYLOAD_SIZE to improve command length checks.
Taken-From: OpenBSD (parts of if_iwm.c r1.57 and if_iwmreg.h r1.10)

Obtained from:	DragonflyBSD b70c1eaad06257c5c7f4d8110d21642ebec14f42
2016-06-02 04:53:28 +00:00
Adrian Chadd 00d6aaedf9 [iwm] add if_iwm_led.c into the build. 2016-06-02 04:42:45 +00:00
Adrian Chadd ee55925e29 [iwm] add LED blinking for iwm hardware that supports it.
Submitted by:	Imre Vadasz <imre@vdsz.com>
Obtained from:	DragonflyBSD, Linux iwlwifi/mvm
2016-06-02 04:42:28 +00:00
Adrian Chadd b28e96d670 [ath] correctly shift the QCA9565 LNA config into the mci config variable.
Tested:

* QCA9565, STA + BT mode
2016-06-02 04:25:54 +00:00
George V. Neville-Neil 90849c3e0d Fix kernel build. Improper definition location of a variable. 2016-06-02 01:59:41 +00:00
Adrian Chadd bcf5fc498a [ath] commit initial bluetooth coexistence support for the MCI NICs.
This is the initial framework to call into the MCI HAL routines and drive
the basic state engine.

The MCI bluetooth coex model uses a command channel between wlan and
bluetooth, rather than a 2-wire or 3-wire signaling protocol to control things.
This means the wlan and bluetooth chip exchange a lot more information and
signaling, even at the per-packet level.  The NICs in question can share
the input LNA and output PA on the die, so they absolutely can't stomp
on each other in a silly fashion.  It also allows for the bluetooth side
to signal when profiles come and go, so the driver can take appropriate
control.  There's also the possibility of dynamic bluetooth/wlan duty cycle
control which I haven't yet really played with.

It configures things up with a static "wlan wins everything" coexistence,
configures up the available 2GHz channel map for bluetooth, sets a static
duty cycle for bluetooth/wifi traffic priority and drives the basics needed to
keep the MCI HAL code happy.

It doesn't do any actual coexistence except to default to "wlan wins everything",
which at least demonstrates that things do indeed work.  Bluetooth inquiry frames
still trump wifi (including beacons), so that demonstrates things really do
indeed seem to work.

Tested:

* AR9462 (WB222), STA mode + bt
* QCA9565 (WB335), STA mode + bt

TODO:

* .. the rest of coexistence.  yes, bluetooth, not people.  That stuff's hard.
* It doesn't do the initial BT side calibration, which requires a WLAN chip
  reset.  I'll fix up the reset path a bit more first before I enable that.
* The 1-ant and 2-ant configuration bits aren't being set correctly in
  if_ath_btcoex.c - I'll dig into that and fix it in a subsequent commit.
* It's not enabled by default for WB222/WB225 even though I believe it now
  can be - I'll chase that up in a subsequent commit.

Obtained from:	Qualcomm Atheros, Linux ath9k
2016-06-02 00:51:36 +00:00
Mark Johnston bc9d08e1cf Fix memguard(9) in kernels with INVARIANTS enabled.
With r284861, UMA zones use the trash ctor and dtor by default. This is
incompatible with memguard, which frees the backing page when the item
is freed. Modify the UMA debug functions to be no-ops if the item was
allocated from memguard. This also fixes constructors such as
mb_ctor_pack(), which invokes the trash ctor in addition to performing
some initialization.

Reviewed by:	glebius
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D6562
2016-06-01 22:31:35 +00:00
Alan Somers b1a6b8dcd2 Improve the English in a comment
sys/cddl/contrib/opensolaris/uts/common/sys/acl.h:
	Improve the english in a comment.  No functional changes

Submitted by:	gibbs
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
2016-06-01 22:21:42 +00:00
Gleb Smirnoff a7c5163b5f When we are in panic, always go the asynchronous path in g_mirror_destroy(),
otherwise the system will hang.

This is a temporarily least intrusive crutch to get certain panicing systems
dumping. The proper fix should question is g_mirror_destroy() should be called
on a panicing system at all.

Discussed with:	mav
2016-06-01 22:11:54 +00:00
Konstantin Belousov e5f0191f20 If the fast path unbusy in vm_page_replace() fails, slow path needs to
acquire the page lock, which recurses.  Avoid the recursion by reusing
the code from vm_page_remove() in a new helper
vm_page_xunbusy_maybelocked().

Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
2016-06-01 20:39:00 +00:00
Don Lewis d673654796 Replace constant expressions that contain multiplications by
fractional floating point values with integer divides.  This will
eliminate any chance that the compiler will generate code to evaluate
the expression using floating point at runtime.

Suggested by:	bde
Submitted by:	Rasool Al-Saadi <ralsaadi@swin.edu.au>
MFC after:	8 days (with r300779 and r300949)
2016-06-01 20:04:24 +00:00
Navdeep Parhar e6b775f48f iw_cxgbe: Fix panic that occurs when c4iw_ev_handler tries to acquire
comp_handler_lock but c4iw_destroy_cq has already freed the CQ memory
(which is where the lock resides).

Submitted by:	Krishnamraju Eraparaju @ Chelsio
Sponsored by:	Chelsio Communications
2016-06-01 18:46:54 +00:00
Mateusz Guzik fc4f686d59 Microoptimize locking primitives by avoiding unnecessary atomic ops.
Inline version of primitives do an atomic op and if it fails they fallback to
actual primitives, which immediately retry the atomic op.

The obvious optimisation is to check if the lock is free and only then proceed
to do an atomic op.

Reviewed by:	jhb, vangyzen
2016-06-01 18:32:20 +00:00
Adrian Chadd 83e80fe84a [ath_hal] add azimuth timestamp payload marking for AR9380 and later chips. 2016-06-01 15:56:07 +00:00
Andriy Voskoboinyk fb9af2ebe6 urtwn: unbreak CTS-to-self protection mode.
Do not set HWRTSEN bit when CTS-to-self is used; CTS2SELF bit triggers
CTS frame transmission by itself (and it does not work when HWRTSEN bit
is set).

Tested with:
 * RTL8188CUS, HOSTAP mode (11g)
 * RTL8188EU, STA mode (11g)
2016-06-01 15:47:19 +00:00
Bryan Drewery 24862f2287 Enable filemon on all architectures.
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-06-01 15:19:49 +00:00
Andriy Voskoboinyk 55eb77a20a urtwn: fix non-ERP BSS detection in HOSTAP mode.
Receive all beacons in HOSTAP mode; they will give more information about
present non-ERP / legacy BSSs (used to choose protection mode).

Tested with RTL8188CUS (HOSTAP, urtwn) + RTL8821AU (HOSTAP, 11b mode).
2016-06-01 14:57:53 +00:00
Andrew Rybchenko 6bf4498cbc sfxge(4): cleanup: remove unused variables in common code
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-06-01 14:16:16 +00:00
Ruslan Bukin 99ea4d4733 Add support for loadable kernel modules.
Submitted by:	Yukishige Shibata <y-shibat@mtd.biglobe.ne.jp>
2016-06-01 14:12:31 +00:00
Andrew Rybchenko e6023d7095 sfxge(4): cleanup: add missing space after if keyword
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-06-01 14:11:40 +00:00
Ruslan Bukin 8dbd4f302f Build riscv modules as PIC.
Submitted by:	Yukishige Shibata <y-shibat@mtd.biglobe.ne.jp>
2016-06-01 14:05:32 +00:00
Ruslan Bukin b217eb9314 Add a riscv define.
Submitted by:	Yukishige Shibata <y-shibat@mtd.biglobe.ne.jp>
2016-06-01 14:03:13 +00:00
Andrew Rybchenko 5c4c3d9285 sfxge(4): set moderation in efx_ev_qcreate
This simplifies setting an initial interrupt moderation value, and
avoids most calls to evx_ev_qmoderate from contexts where MCDI is
not allowed (MCDI is need for an EVQ timer workaround in a later patch).

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6673
2016-06-01 14:03:07 +00:00
Ruslan Bukin 87ef40645d Don't build some modules on RISC-V.
Submitted by:	Yukishige Shibata <y-shibat@mtd.biglobe.ne.jp>
2016-06-01 13:43:43 +00:00
Ruslan Bukin 22d5f3540a * Enable KDTRACE options as we support DTrace now.
* Add bpf device to kernel config.
2016-06-01 12:19:00 +00:00
Edward Tomasz Napierala ac3453eba0 Reduce the priority of cxgbei(4) driver, so it doesn't get chosen
by default.  This is a workaround for a too simplistic ICL module
choosing mechanism.  To use it, specify offload in ctl.conf
or iscsi.conf.

This fixes a problem where "kldload cxgbei" wedges the iSCSI stack,
if you don't have a Chelsio card installed, or the endpoints of the
iSCSI session are not reachable through addresses configured
on that interface.

Reviewed by:	np@
MFC after:	1 month
2016-06-01 12:04:04 +00:00
Bjoern A. Zeeb 3f58662dd9 The pr_destroy field does not allow us to run the teardown code in a
specific order.  VNET_SYSUNINITs however are doing exactly that.
Thus remove the VIMAGE conditional field from the domain(9) protosw
structure and replace it with VNET_SYSUNINITs.
This also allows us to change some order and to make the teardown functions
file local static.
Also convert divert(4) as it uses the same mechanism ip(4) and ip6(4) use
internally.

Slightly reshuffle the SI_SUB_* fields in kernel.h and add a new ones, e.g.,
for pfil consumers (firewalls), partially for this commit and for others
to come.

Reviewed by:		gnn, tuexen (sctp), jhb (kernel.h)
Obtained from:		projects/vnet
MFC after:		2 weeks
X-MFC:			do not remove pr_destroy
Sponsored by:		The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D6652
2016-06-01 10:14:04 +00:00
Sepherosa Ziehau b7bb4816a0 hyperv: Rename some cleaned up/almost cleaned up files
MFC after:	1 week
Sponsored by:	Microsoft OSTC
2016-06-01 09:20:52 +00:00
Zbigniew Bodek 32fb8300d4 Return real error value instead of hard-coded ENXIO (fix after r300149)
It is possible to return real error value in case of gic_v3_attach()
failure instead of hard-coded ENXIO.

Obtained from:	Semihalf
Sponsored by:	Cavium
2016-06-01 08:20:10 +00:00
Ed Schouten 5218e61a60 Define the id_t type as required by POSIX.
It seems that all versions of POSIX that I could find require that
<sys/resource.h> defines id_t. Define it together with rlim_t. While
there, move these typedefs closer to the top of the header file, right
after the includes, which we do in most other header files.
2016-06-01 07:45:03 +00:00
Sepherosa Ziehau 5d8fdc7fe4 hyperv/channel: Only cpu0 is supported as channel target cpu on WIN7
MFC after:	1 week
Sponsored by:	Microsoft OSTC
2016-06-01 07:11:54 +00:00
Sepherosa Ziehau 417afb00cb hyperv/vmbus: Redefine event flags.
- Nuke unnecessary union.
- Avoid convoluted macro indirection.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6671
2016-06-01 06:51:44 +00:00
Andrew Rybchenko 84bcd65e0f sfxge(4): cope with code duplication on SW events composition
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D6666
2016-06-01 06:51:19 +00:00