Commit Graph

29765 Commits

Author SHA1 Message Date
Conrad Meyer
e638b59556 NTB: Drop some dead softc members
Sponsored by:	EMC / Isilon Storage Division
2015-10-20 01:45:48 +00:00
Conrad Meyer
7452e26d14 NTB: Replace last reg_ofs with self_reg
Diff reduce with Linux driver.  No functional change.

Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-20 01:45:38 +00:00
Conrad Meyer
f1a516bcf9 NTB: Add ntb_db_vector_mask() missed in r289546
This is the last one.

Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-19 18:06:35 +00:00
Conrad Meyer
83f50830db NTB: Add ntb_db_valid_mask() missed in r289546
Another trivial one.

Pointy-hat:	cem
Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-19 17:53:20 +00:00
Conrad Meyer
2ea07c645a NTB: Add ntb_mw_clear_trans() missed in r289546
It is just a trivial wrapper around ntb_mw_set_trans().

Authored by:	Allen Hubbe
Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-19 17:41:22 +00:00
Roger Pau Monné
4955cbf300 xen-netfront: use "netfront" in lock description
Missed from r289585.

Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D3937
Sponsored by:		Citrix Systems R&D
2015-10-19 15:34:24 +00:00
Roger Pau Monné
1a2928b740 xen-netfront: fix netfront create_dev error path
The failure path for allocating rx grant refs should not try to free tx
grant refs because tx grant refs were allocated after that. Also fix the
error path for xen_net_read_mac.

Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D3891
Sponsored by:		Citrix Systems R&D
2015-10-19 14:47:37 +00:00
Roger Pau Monné
b31a0d731b xen-netfront: no need to set if_output
This is redundant because ether_ifattach will set that field.

Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D3918
Sponsored by:		Citrix Systems R&D
2015-10-19 14:37:17 +00:00
Roger Pau Monné
08c9c2e0a1 xen-netfront: remove a bunch of FreeBSD version check
We're way beyond FreeBSD 7 at this point.

Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D3892
Sponsored by:		Citrix Systems R&D
2015-10-19 14:34:45 +00:00
Roger Pau Monné
177e3f1366 xen-netfront: remove XN_LOCK_{INIT,DESTROY}
Multiqueue feature will make the number of queues dynamic, so XN_LOCK_INIT
won't be that useful. Remove the macro and call mtx_init directly.

XN_LOCK_DESTROY is just dead code.

Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D3890
Sponsored by:		Citrix Systems R&D
2015-10-19 14:26:40 +00:00
Roger Pau Monné
9a7f9feaf5 xen-netfront: clean up netfront stats structure
Rename it with netfront_ prefix and purge a bunch of unused fields.

Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D3889
Sponsored by:		Citrix Systems R&D
2015-10-19 14:22:57 +00:00
Roger Pau Monné
d0f3a8b902 xen-netfront: purge page flipping support
Currently neither Linux nor FreeBSD netback supports page flipping. NetBSD
still supports that. It is not sure how many people actually use page
flipping, but page flipping is supposed to be slower than copying nowadays.
It will also shatter frontend / backend address space.

Overall this feature is more of a burden than a benefit.

Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D3888
Sponsored by:		Citrix Systems R&D
2015-10-19 14:20:06 +00:00
Roger Pau Monné
17374b6c3b xen-netfront: delete all trailing white spaces
Submitted by:		Wei Liu <wei.liu2@citrix.com>
Reviewed by:		royger
Differential Revision:	https://reviews.freebsd.org/D3886
Sponsored by:		Citrix Systems R&D
2015-10-19 14:12:15 +00:00
Hans Petter Selasky
f556cede8a Merge LinuxKPI changes from DragonflyBSD:
- Define the kref structure identical to the one found in Linux.
- Update clients referring inside the kref structure.
- Implement kref_sub() for FreeBSD.

Reviewed by:	np @
Sponsored by:	Mellanox Technologies
2015-10-19 12:26:38 +00:00
Hans Petter Selasky
4be283b9be Add quirk for USB 3.0 PCI device.
Submitted by:	philipp.maechler@mamo.li
PR:		203650
MFC after:	1 week
2015-10-19 07:21:57 +00:00
Adrian Chadd
02b3773ac4 otus(4) - use the local node alloc function so there's space for statistics.
* Use the correct malloc type for node allocation - M_80211_NODE - so
  the default node free method in net80211 will work correctly.
* Fix otus_node_alloc() to suit FreeBSD's net80211.
* .. and actually call otus_node_alloc() so there's space for the
  per-node tx statistics.  Otherwise, well, it will be scribbling over
  random memory.

Tested:

* AR9170, STA mode
2015-10-19 01:21:29 +00:00
Adrian Chadd
fd7b55de48 otus(4) - add initial monitor mode; use lowest rate for EAPOL
The monitor mode stuff is from the openbsd driver, but it doesn't
100% work.  It doesn't seem to get all frames for all BSSes.
However, it's enough to at start debugging things.  That 0xffffffff
write is /I think/ the RX filter, but I am still not 100% sure about
it all.

Then, whilst here, use the lowest rate for EAPOL frames.  This is just
generally a good thing to do.
2015-10-19 01:14:26 +00:00
Zbigniew Bodek
441d67800c Introduce driver for Cavium's ThunderX MDIO
This commit adds support for MDIO present in the ThunderX SoC.
From the FDT point of view it is compatible with "octeon-3860-mdio"
however only C22 mode is used.
The code also implements lmac_if interface functions.

Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
2015-10-18 22:10:08 +00:00
Zbigniew Bodek
2306b72a5d Introduce initial support for Cavium's ThunderX networking interface
- The driver consists of three main componens: PF, VF, BGX
- Requires appropriate entries in DTS and MDIO driver
- Supports only FDT configuration
- Multiple Tx queues and single Rx queue supported
- No RSS, HW checksum and TSO support
- No more than 8 queues per-IF (only one Queue Set per IF)
- HW statistics enabled
- Works in all available MAC modes (1,10,20,40G)
- Style converted to BSD according to style(9)
- The code brings lmac_if interface used by the BGX driver to
  update its logical MACs state.

Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
2015-10-18 22:02:58 +00:00
Zbigniew Bodek
3c0086b813 Raw import of ThunderX VNIC networking driver components
This import brings following components of the Linux driver:
- Thunder BGX (programmable MAC)
- Physical Function driver
- Virtual Function driver
- Headers

Revision:            1.0
Obtained from:       Cavium
License information: Cavium provided these files under BSD license
2015-10-18 21:39:15 +00:00
Conrad Meyer
95a3f7fb33 if_ntb: MFV e26a5843: Move MW/DB management to if_ntb
This is the last e26a5843 patch.  The general thrust of the rewrite was
to move more responsibility for Memory Window and Doorbell interrupt
management from the ntb_hw driver to if_ntb.

A number of APIs have been added, removed, or replaced.  The old
DB callback mechanism has been excised.  Instead, callers (if_ntb) are
responsible for configuring MWs and handling their interrupts more
directly.

This adds a tunable, hw.ntb.max_mw_size, allowing users to limit the
size of memory windows used by if_ntb (identical to the Linux modparam
of the same name).

Despite attempts to keep mechanical name changes to separate commits,
some have snuck in here.  At least the driver should be much more
similar to the latest Linux one now -- making porting fixes easier.

Authored by:	Allen Hubbe
Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-18 20:20:57 +00:00
Conrad Meyer
763fa8ae30 if_ntb: Rename things to match Linux driver
No functional change.  Part of the huge rewrite (e26a5843).

Obtained from:	Linux (e26a5843) (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-18 20:20:48 +00:00
Conrad Meyer
b67ddac220 if_ntb: Replace handmade bitset macros with sys/bitset.h
No functional change.

Sponsored by:	EMC / Isilon Storage Division
2015-10-18 20:20:38 +00:00
Conrad Meyer
aa71f18e47 NTB: Flesh out the rest of the xeon_setup_b2b_mw changes
Move all Xeon secondary register setup to the setup_b2b_mw routine.  We
use subroutines to make it a bit less wordy than the Linux version.

Adds a new tunable, 'hw.ntb.b2b_mw_share'.  By default, it is off
(zero).  If both sides enable it (any non-zero value), the NTB driver
attempts to use only half of a memory window for remote register MMIO
access.

This is still part of the large Linux rewrite (e26a5843).

Authored by:	Allen Hubbe
Obtained from:	Linux (e26a5843) (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-18 20:20:29 +00:00
Conrad Meyer
fe1a66fccf NTB: "Split ntb_hw_intel and ntb_transport drivers"
This Linux commit was more or less a rewrite.  Unfortunately, the commit
log does not give a lot of context for the rewrite.  I have tried to
faithfully follow the changes made upstream, including matching function
names where possible, while churning the FreeBSD driver as little as
possible.

This is the bulk of the rewrite.  There are two groups of changes to
follow in separate commits: fleshing out the rest of the changes to
xeon_setup_b2b_mw(), and some changes to if_ntb.

Yes, this is a big patch (3 files changed, 416 insertions(+), 237
deletions(-)), but the Linux patch was 13 files changed, 2,589
additions(+) and 2,195 deletions(-).

Original Linux commit log:
Change ntb_hw_intel to use the new NTB hardware abstraction layer.

Split ntb_transport into its own driver.  Change it to use the new NTB
hardware abstraction layer.

Authored by:	Allen Hubbe
Obtained from:	Linux (e26a5843) (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-18 20:20:20 +00:00
Conrad Meyer
9e1ae3c3f5 NTB: Simplify ntb_map_pci_bars
Skip using a function pointer for shared error logging.

Sponsored by:	EMC / Isilon Storage Division
2015-10-18 20:20:11 +00:00
Conrad Meyer
0214956128 NTB: Simplify interrupt handling by merging SoC/Xeon
Some interrupt-related function names changed to match Linux.

No functional change.  Still part of the huge e26a5843 rewrite in Linux.

Obtained from:	Linux (e26a5843) (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-18 20:20:02 +00:00
Conrad Meyer
60c996fc4a NTB: Rename some variables/functions to match Linux
No functional change.

Still part of the huge e26a5843 rewrite.  I'm trying to make it less of
a complete rewrite in the FreeBSD version of the driver.  Still, it
helps if our names match Linux.

Obtained from:	Linux (e26a5843) (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-18 20:19:53 +00:00
Conrad Meyer
c1f81cacd9 NTB: Rename some constants to match Linux
No functional change.

Obtained from:	Linux (part of e26a5843) (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-18 20:19:44 +00:00
John-Mark Gurney
bee4a63bb7 drop a bunch of white space at end of lines and end of files...
-x -wb apparently doesn't hide end of file white space changes..

This is to reduce the amount of diff for my PCIe HP changes..
2015-10-18 08:13:51 +00:00
Jean-Sébastien Pédron
c223ad05c4 drm/i915: Reduce diff with Linux 3.8
There is no functional change. The goal is to ease the future update to
Linux 3.8's i915 driver.

MFC after:	2 months
2015-10-17 14:48:39 +00:00
Scott Long
acb570cf14 Revert an extra hunk that crept into the last commit.
Submitted by:	emax
Obtained from:	Netflix, Inc.
MFC after:	3 days
2015-10-16 20:18:12 +00:00
Scott Long
d0be3479d5 Remove _FreeBSD_version check for something that was only an issue with
9-CURRENT.

Obtained from:  Netlfix, Inc
MFC after:      3 days
2015-10-16 17:56:43 +00:00
Navdeep Parhar
07d684f712 cxgbe(4): support for the kernel RSS option.
You need PCBGROUP and RSS in the kernel config to use this.

Relnotes:	Yes
Sponsored by:	Chelsio Communications
2015-10-16 01:19:55 +00:00
Conrad Meyer
3952d9c9de NTB: MFV ab760a0c: Add split BAR support for Haswell
On the Haswell platform, a split BAR option to allow creation of 2 32bit
BARs (4 and 5) from the 64bit BAR 4. Adding support for this new option.

Authored by:	Dave Jiang
Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-15 23:46:07 +00:00
Conrad Meyer
b8a291bdea NTB: Add variable number MW, DB CB support code
This is a follow-up to r289208: "Xeon Errata Workaround."

Add logic to support a variable number of memory windows and doorbell
callbacks.  This was added to the Linux driver in the "Xeon Errata
Workaround" commit, but I skipped it because it didn't look neccessary
at the time.  It is needed for future Haswell split-BAR support, so
bring it in now.

A new tunable was added for if_ntb, 'hw.ntb.max_num_clients'.  By
default, it is set to zero -- infer the number of clients from the
number of memory windows available from the hardware.  Any other
positive value can specify a different number of clients, limited by the
number of doorbell callbacks available (4 under MSI-X, or 15 (Xeon) or
34 (SoC) under legacy INTx).

Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-15 23:45:43 +00:00
Adrian Chadd
93efdc635d Add support for the BCM57765 card reader.
This patch adds support for the BCM57765[2] card reader function included in
Broadcom's BCM57766 ethernet/sd3.0 controller. This controller is commonly
found in laptops and Apple hardware (MBP, iMac, etc).

The BCM57765 chipset is almost fully compatible with the SD3.0 spec, but
does not support deriving a frequency below 781KHz from its default base
clock via the standard SD3.0-configured 10-bit clock divisor.

If such a divisor is set, card identification (which requires a 400KHz
clock frequency) will time out[1].

As a work-around, I've made use of an undocumented device-specific clock
control register to switch the controller to a 63MHz clock source when
targeting clock speeds below 781KHz; the clock source is likewise switched
back to the 200MHz clock when targeting speeds greater than 781KHz.

Additionally, this patch fixes a small sdhci_pci bug; the
sdhci_pci_softc->quirks flag was not copied to the sdhci_slot, resulting in
`quirk` behavior not being applied by sdhci.c.

[1] A number of Linux/FreeBSD users have noted that bringing up the chipsets'
associated ethernet interface will allow SD cards to enumerate (slowly).
This is a controller implementation side-effect triggered by the ethernet
driver's reading of the hardware statistics registers.

[2] This may also fix card detection when using the BCM57785 chipset, but I
don't have access to the BCM57785 chipset and can't verify.

I actually snagged some BCM57785 hardware recently (2012 Retina MacBook Pro)
and can confirm that this also fixes card enumeration with the BCM57785
chipset; with the patch, I can boot off of the internal sdcard reader.

PR:		kern/203385
Submitted by:	Landon Fuller <landon@landonf.org>
2015-10-15 04:22:56 +00:00
Conrad Meyer
d69c7b8653 NTB: MFV 1db97f25: Pull out platform detection logic
Pull out read of PPD and platform detection logic to new functions,
ntb_detect_xeon(), ntb_detect_soc().  No functional change -- mostly
this is just shuffling the code to more closely match the Linux driver.
Linux commit log:

To simplify some of the platform detection code. Move the platform
detection to a function to be called earlier.

Authored by:	Dave Jiang
Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-14 23:48:16 +00:00
Conrad Meyer
3818c7253b NTB: Abstract doorbell register access
The doorbell registers (and associated mask) are 16-bit on Xeon but
64-bit on SoC.  Abstract IO access to doorbell registers with
'db_ioread' and 'db_iowrite' (names and idea borrowed from the dual
BSD/GPL Linux driver).

Sponsored by:	EMC / Isilon Storage Division
2015-10-14 23:48:03 +00:00
Conrad Meyer
d957796cb5 if_ntb: MFV 3cc5ba19: Add alignment check to meet hardware requirement
Original Linux commit log:

The NTB translate register must have the value to be BAR size aligned.
This alignment check make sure that the DMA memory allocated has the
proper alignment. Another requirement for NTB to function properly with
memory window BAR size greater or equal to 4M is to use the CMA feature
in 3.16 kernel with the appropriate CONFIG_CMA_ALIGNMENT and
CONFIG_CMA_SIZE_MBYTES set.

Authored by:	Dave Jiang
Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-14 23:47:52 +00:00
Conrad Meyer
fe9621016e NTB: MFV a1413cfb: correct the spread of queues over mw's
The detection of an uneven number of queues on the given memory windows
was not correct.  The mw_num is zero based and the mod should be
division to spread them evenly over the mw's.

Authored by:	Jon Mason
Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-14 23:47:35 +00:00
Conrad Meyer
937a702523 NTB: Remap MSI-X messages over available slots
Remap MSI-X messages over available slots rather than falling back to
legacy INTx when fewer MSI-X slots are available than were requested.

N.B. the Linux driver does *not* do this.

To aid in testing, a tunable 'hw.ntb.force_remap_mode' has been added.
It defaults to off (0).  When the tunable is enabled and sufficient
slots were available, the driver restricts the number of slots by one
and remaps the MSI-X messages over the remaining slots.

In case this is actually not okay (as I don't yet have access to this
hardware to test), a tunable 'hw.ntb.prefer_intx_to_remap' has been
added.  It defaults to off (0).  When the tunable is enabled and fewer
slots are available than requested, fall back to legacy INTx mode rather
than attempting to remap MSI-X messages.

Suggested by:	jhb
Reviewed by:	jhb (earlier version)
Sponsored by:	EMC / Isilon Storage Division
2015-10-14 23:47:23 +00:00
Conrad Meyer
d0e3335d08 NTB: Reserve link event doorbell callback on Xeon
Consumers that registered on this bit would never see a callback and it
is likely a mistake.

This does not affect if_ntb, which limits itself to a single doorbell
callback.
2015-10-14 23:47:08 +00:00
Conrad Meyer
c25a9f91c6 NTB: MFV 53a788a7: Split ntb_setup_interrupts() into SOC, Xeon, and legacy routines
The names don't line up 100% with Linux.  Our routines are named
ntb_setup_interrupts, ntb_setup_xeon_msix, ntb_setup_soc_msix, and
ntb_setup_legacy_interrupt.  Linux SNB = FreeBSD Xeon; Linux BWD =
FreeBSD SOC.  Original Linux commit log:

This is an cleanup effort to make ntb_setup_msix() more readable - use
ntb_setup_bwd_msix() to init MSI-Xs on BWD hardware and
ntb_setup_snb_msix() - on SNB hardware.

Function ntb_setup_snb_msix() also initializes MSI-Xs the way it should
has been done - looping pci_enable_msix() until success or failure.

Authored by:	Alexander Gordeev
Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-14 23:46:15 +00:00
Conrad Meyer
e77461d7ca if_ntb: Cleanup style 2015-10-14 23:45:35 +00:00
Conrad Meyer
531c7b9969 NTB: MFV 403c63cb: client event cleanup
Provide a better event interface between the client and transport.

Authored by:	Jon Mason
Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-14 23:44:42 +00:00
Navdeep Parhar
66eb134d76 iw_cxgbe: use correct RFC number. 2015-10-14 23:29:19 +00:00
Bjoern A. Zeeb
71f7442233 Now that we can detect the Cortex-A8 properly, fix the event list
according to the Cortex-A8 TRM r3p2 section 3.2.49.
The A8 list differs from the "ARM-v7 common" list, given the A8
was an earlier model.

There is still more work to be done for other Cortex-Ax version as
andrew points out, but I am just trying to fix A8 for now for teaching.

MFC after:		2 weeks
Sponsored by:		DARPA/AFRL
Obtained from:		Cambridge/L41
Reviewed by:		andrew
Differential Revision:	https://reviews.freebsd.org/D3876
2015-10-14 17:20:19 +00:00
Conrad Meyer
737bc5014c NTB: MFV e8aeb60c: Disable interrupts and poll under high load
Authored by:	Jon Mason
Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-14 02:14:45 +00:00
Conrad Meyer
f3f87fe051 NTB: MFV 78958433: Enable Snoop on Primary Side
Enable Snoop from Primary to Secondary side on BAR23 and BAR45 on all
TLPs.  Previously, Snoop was only enabled from Secondary to Primary
side.  This can have a performance improvement on some workloads.

Also, make the code more obvious about how the link is being enabled.

Authored by:	Jon Mason
Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-14 02:14:15 +00:00
Conrad Meyer
2a84460ce8 NTB: MFV 58b88920: Document HW errata
Add a comment describing the necessary ordering of modifications to the
NTB Limit and Base registers.

Authored by:	Jon Mason
Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-13 23:43:06 +00:00
Conrad Meyer
4d07d562c3 NTB: MFV fca4d518: Fix ntb_transport link down race
A WARN_ON is being hit in ntb_qp_link_work due to the NTB transport link
being down while the ntb qp link is still active.  This is caused by the
transport link being brought down prior to the qp link worker thread
being terminated.  To correct this, shutdown the qp's prior to bringing
the transport link down.  Also, only call the qp worker thread if it is
in interrupt context, otherwise call the function directly.

Authored by:	Jon Mason
Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-13 23:42:13 +00:00
Conrad Meyer
2cd48421c9 NTB: MFV 9fec60c4: Fix NTB-RP Link Up
The Xeon NTB-RP setup, the transparent side does not get a link up/down
interrupt.  Since the presence of a NTB device on the transparent side
means that we have a NTB link up, we can work around the lack of an
interrupt by simply calling the link up function to notify the upper
layers.

Authored by:	Jon Mason
Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-13 23:41:40 +00:00
Conrad Meyer
6d960015e2 NTB: MFV c529aa30: Xeon Doorbell errata workaround
Modifications to the 14th bit of the B2BDOORBELL register will not be
mirrored to the remote system due to a hardware issue.  To get around
the issue, shrink the number of available doorbell bits by 1.  The max
number of doorbells was being used as a way to referencing the Link
Doorbell bit.  Since this would no longer work, the driver must now
explicitly reference that bit.

This does not affect the xeon_errata_workaround case, as it is not using
the b2bdoorbell register.

Authored by:	Jon Mason
Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-13 23:41:06 +00:00
Conrad Meyer
2c6fb1de80 NTB: MFV f9a2cf89: Comment Fix
Add "data" ntb_register_db_callback parameter description comment and
correct poor speling.

Authored by:	Jon Mason
Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-13 20:55:21 +00:00
Conrad Meyer
2501258bd9 NTB: MFV b1ef0043: Remove References of non-B2B BWD HW
NTB-RP is not a supported configuration on BWD hardware.  Remove the
code attempting to set it up.

Authored by:	Jon Mason
Obtained from:	Linux (dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
2015-10-13 20:54:38 +00:00
Conrad Meyer
e26b6f00f9 if_ntb: Fix build on i386
Sponsored by:	EMC / Isilon Storage Division
2015-10-13 19:46:54 +00:00
Conrad Meyer
f3e30f9721 ioat: Use correct macro, fix build on i386
Sponsored by:	EMC / Isilon Storage Division
2015-10-13 19:46:12 +00:00
Conrad Meyer
04494661d5 NTB: (partial) MFV ed6c24ed: NTB-RP support
This commit does not actually add NTB-RP support.  Mostly it serves to
shuffle code around to match the Linux driver.  Original Linux commit
log follows:

Add support for Non-Transparent Bridge connected to a PCI-E Root Port on
the remote system (also known as NTB-RP mode).  This allows for a NTB
enabled system to be connected to a non-NTB enabled system/slot.

Modifications to the registers and BARs/MWs on the Secondary side by the
remote system are reflected into registers on the Primary side for the
local system.  Similarly, modifications of registers and BARs/MWs on
Primary side by the local system are reflected into registers on the
Secondary side for the Remote System.  This allows communication between
the 2 sides via these registers and BARs/MWs.

Note: there is not a fix for the Xeon Errata (that was already worked
around in NTB-B2B mode) for NTB-RP mode.  Due to this limitation, NTB-RP
will not work on the Secondary side with the Xeon Errata workaround
enabled.  To get around this, disable the workaround via the
xeon_errata_workaround=0 modparm.  However, this can cause the hang
described in the errata.

Authored by:	Jon Mason
Obtained from:	Linux
Sponsored by:	EMC / Isilon Storage Division
2015-10-13 19:45:29 +00:00
Conrad Meyer
1d9352af47 NTB: MFV 49793889: Rename Variables for NTB-RP
Many variable names in the NTB driver refer to the primary or secondary
side.  However, these variables will be used to access the reverse case
when in NTB-RP mode.  Make these names more generic in anticipation of
NTB-RP support.

Authored by:	Jon Mason
Obtained from:	Linux
Sponsored by:	EMC / Isilon Storage Division
2015-10-13 19:44:25 +00:00
Sean Bruno
b0c041f887 Add support for sysctl knobs to live tune the per interrupt rx/tx packet
processing limits in ixgbe(4)

Differential Revision:	https://reviews.freebsd.org/D3719
Submitted by:	jason wolfe (j-nitrology.com)
MFC after:	2 weeks
2015-10-13 17:34:18 +00:00
Conrad Meyer
150be74358 NTB: Enable 32-bit support
Sponsored by:	EMC / Isilon Storage Division
2015-10-13 17:22:23 +00:00
Conrad Meyer
08f35652eb NTB: Update pci ids
Add JSF, HSX, BDX ids; add two additional Xeon errata flags while we're
here.

Obtained from:	Linux
Sponsored by:	EMC / Isilon Storage Division
2015-10-13 17:21:38 +00:00
Conrad Meyer
5fa87f166d NTB: MFV 113bf1c9: BWD Link Recovery
The BWD NTB device will drop the link if an error is encountered on the
point-to-point PCI bridge.  The link will stay down until all errors are
cleared and the link is re-established.  On link down, check to see if
the error is detected, if so do the necessary housekeeping to try and
recover from the error and reestablish the link.

There is a potential race between the 2 NTB devices recovering at the
same time.  If the times are synchronized, the link will not recover and
the driver will be stuck in this loop forever.  Add a random interval to
the recovery time to prevent this race.

Authored by:	Jon Mason
Obtained from:	Linux
Sponsored by:	EMC / Isilon Storage Division
2015-10-13 17:20:47 +00:00
Sean Bruno
2b70dea602 ixl(4): Remove compile warning for unused function.
sys/dev/ixl/if_ixl.c:4377:1: warning: unused function 'ixl_debug_info' [-Wunused-function]
ixl_debug_info(SYSCTL_HANDLER_ARGS)

Differential Revision:	https://reviews.freebsd.org/D3718
Submitted by:	bz
2015-10-13 17:20:05 +00:00
Alexander Motin
e596ff7a1f Export bunch of state variables as sysctls. 2015-10-13 11:02:56 +00:00
Conrad Meyer
fd95aefd77 NTB: Style(9) cleanups 2015-10-13 03:12:55 +00:00
Conrad Meyer
59cf83b813 NTB: MFV 948d3a65: Xeon Errata Workaround
There is a Xeon hardware errata related to writes to SDOORBELL or B2BDOORBELL
in conjunction with inbound access to NTB MMIO Space, which may hang the
system.  To workaround this issue, use one of the memory windows to access the
interrupt and scratch pad registers on the remote system.  This bypasses the
issue, but removes one of the memory windows from use by the transport.  This
reduction of MWs necessitates adding some logic to determine the number of
available MWs.

Since some NTB usage methodologies may have unidirectional traffic, the ability
to disable the workaround via modparm has been added.

See BF113 in
http://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/xeon-c5500-c3500-spec-update.pdf
See BT119 in
http://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/xeon-e5-family-spec-update.pdf

Authored by:	Jon Mason
Obtained from:	Linux
Sponsored by:	EMC / Isilon Storage Division
2015-10-13 03:12:11 +00:00
Conrad Meyer
902362c988 NTB: Add hw.ntb sysctl node 2015-10-13 03:11:21 +00:00
Conrad Meyer
f74e1ad354 NTB: MFV b6750cfe: Correct USD/DSD Identification
Due to ambiguous documentation, the USD/DSD identification is backward
when compared to the setting in BIOS.  Correct the bits to match the
BIOS setting.

Authored by:	Jon Mason
Obtained from:	Linux
Sponsored by:	EMC / Isilon Storage Division
2015-10-13 03:10:36 +00:00
Conrad Meyer
7a97964b79 NTB: MFV 87034511: Correct Number of Scratch Pad Registers
The NTB Xeon hardware has 16 scratch pad registers and 16 back-to-back
scratch pad registers.  Correct the #define to represent this and update
the variable names to reflect their usage.

Authored by:	Jon Mason
Obtained from:	Linux
Sponsored by:	EMC / Isilon Storage Division
2015-10-13 03:10:04 +00:00
Navdeep Parhar
ca7c0f2e2d iw_cxgbe: MPA v2 is always available.
Submitted by:	Krishnamraju Eraparaju at chelsio dot com
Reviewed by:	Steve Wise at opengridcomputing dot com
2015-10-13 01:04:38 +00:00
David C Somayajulu
56c55e6513 Add support for reading device temperature
MFC after:5 days
2015-10-12 20:21:17 +00:00
Kevin Lo
dc82802918 Accept any correct frames from any source when MONITOR mode is used.
Submitted by:	Andriy Voskoboinyk <s3erios at gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3812
2015-10-12 08:17:21 +00:00
Adrian Chadd
4f4a7a03ce net80211 drivers: eliminate any references to sc_rxtap_len/sc_txtap_len (never used here)
Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3776
2015-10-12 05:21:51 +00:00
Adrian Chadd
c0658ced70 urtwn(4): split *reg and *var parts (no functional change).
Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3775
2015-10-12 05:14:49 +00:00
Adrian Chadd
d957a93abe net80211: move ieee80211_free_node() call on error from ic_raw_xmit() to ieee80211_raw_output().
This doesn't free the mbuf upon error; the driver ic_raw_xmit method is still
doing that.

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3774
2015-10-12 04:55:20 +00:00
Adrian Chadd
d3a4ade3b8 net80211: free node reference in the ieee80211_parent_xmitpkt() when error happened.
Move error handling into ieee80211_parent_xmitpkt() instead of spreading it
between functions.

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3772
2015-10-12 04:30:38 +00:00
Adrian Chadd
940aa8080c wpi(4): add support for TX fragmentation.
Tested:

* Tested with Intel 3945BG, HOSTAP and STA modes

Differential Revision:	https://reviews.freebsd.org/D3770
2015-10-12 04:05:12 +00:00
Adrian Chadd
d07be335a0 net80211: separate mbuf cleanup from ieee80211_fragment()
* Create ieee80211_free_mbuf() which frees a list of mbufs.
* Use it in the fragment transmit path and ath / uath transmit paths.
* Call it in xmit_pkt() if the transmission fails; otherwise fragments
  may be leaked.

This should be a big no-op.

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3769
2015-10-12 03:27:08 +00:00
Conrad Meyer
ae92db9ed6 NTB: MFV c336acd3: memcpy lockup workaround
The system will appear to lockup for long periods of time due to the NTB
driver spending too much time in memcpy.  Avoid this by reducing the
number of packets that can be serviced on a given interrupt.

Authored by:	Jon Mason
Obtained from:	Linux
Sponsored by:	EMC / Isilon Storage Division
2015-10-11 21:01:14 +00:00
Conrad Meyer
7ee9e4bc6e NTB: MFV c9d534c8: Correctly handle receive buffers of the minimal size
The ring logic of the NTB receive buffer/transmit memory window requires
there to be at least 2 payload sized allotments.  For the minimal size
case, split the buffer into two and set the transport_mtu to the
appropriate size.

Authored by:	Jon Mason
Obtained from:	Linux
Sponsored by:	EMC / Isilon Storage Division
2015-10-11 21:00:19 +00:00
Conrad Meyer
a30525bf65 NTB: MFV 90f9e934: reset tx_index on link toggle
If the NTB link toggles, the driver could stop receiving due to the
tx_index not being set to 0 on the transmitting size on a link-up event.
This is due to the driver expecting the incoming data to start at the
beginning of the receive buffer and not at a random place.

Authored by:	Jon Mason
Obtained from:	Linux
Sponsored by:	EMC / Isilon Storage Division
2015-10-11 20:59:40 +00:00
Conrad Meyer
0125f2c1af NTB: MFV b77b2637: Link toggle memory leak
Each link-up will allocate a new NTB receive buffer when the NTB
properties are negotiated with the remote system.  These allocations did
not check for existing buffers and thus did not free them.  Now, the
driver will check for an existing buffer and free it if not of the
correct size, before trying to alloc a new one.

Authored by:	Jon Mason
Obtained from:	Linux
Sponsored by:	EMC / Isilon Storage Division
2015-10-11 20:59:02 +00:00
Conrad Meyer
92bbfa507c NTB: MFV 113fc505: Handle 64bit BAR sizes
64bit BAR sizes are permissible with an NTB device.  To support them
various modifications and clean-ups were required, most significantly
using 2 32bit scratch pad registers for each BAR.

Also, modify the driver to allow more than 2 Memory Windows.

Authored by:	Jon Mason
Obtained from:	Linux
Sponsored by:	EMC / Isilon Storage Division
2015-10-11 20:58:00 +00:00
Conrad Meyer
262d9f674f NTB: MFV cc0f868d: fix pointer math issues
->remote_rx_info and ->rx_info are struct ntb_rx_info pointers.  If we
add sizeof(struct ntb_rx_info) then it goes too far.

Authored by:	Dan Carpenter
Obtained from:	Linux
Sponsored by:	EMC / Isilon Storage Division
2015-10-11 20:57:09 +00:00
Adrian Chadd
f7cd3e189c wpi(4): do not count failures twice for ic_raw_xmit().
Tested:

* Tested with Intel 3945BG, STA mode

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3768
2015-10-11 02:00:08 +00:00
Adrian Chadd
823e17dbe1 wpi(4): move error handling upper (wpi_tx_data()/wpi_cmd2() -> wpi_raw_xmit()/wpi_transmit()).
Tested:

* Tested with Intel 3945BG, STA mode

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3767
2015-10-11 01:58:50 +00:00
Adrian Chadd
431ebc90bf wpi(4): fix possible race between TX/RX threads.
Tested:

* Tested with Intel 3945BG, STA mode

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3766
2015-10-11 01:56:46 +00:00
Adrian Chadd
19053a5448 wpi(4): do not allocate space for unused rings.
Tested:

* Tested with Intel 3945BG, STA mode

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3765
2015-10-11 01:53:51 +00:00
Adrian Chadd
57c61f5d05 wpi(4): do not override iv_recv_mgmt() in non-adhoc modes.
Tested:

* Tested with Intel 3945BG, IBSS and STA modes

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3764
2015-10-11 01:50:54 +00:00
Adrian Chadd
525a3d47d8 wpi(4): use more correct types.
This change fixes some amount of -Wsign-conversion and -Wconversion warnings
and sets correct sizes for some variables (as a result, some loop counters
were touched too).

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3763
2015-10-11 01:31:18 +00:00
Ian Lepore
73440c336d Replace a local sx lock that allowed only one client at a time to access
an eeprom device with iicbus_request/release_bus(), which achieves the
same effect and also keeps other i2c slave drivers from clashing on the bus.
2015-10-10 19:51:00 +00:00
Jean-Sébastien Pédron
c165a9c7e6 drm/i915: Remove "Attempting to unbind pinned buffer" message
This error message is removed in later versions of Linux and currently,
it spams users.

PR:		200712
MFC after:	1 week
2015-10-10 07:43:02 +00:00
Ian Lepore
b16c6d237b Translate iic hardware layer status values to errno return values. 2015-10-10 02:29:02 +00:00
Ian Lepore
d0b70953fb Add a short name, IIC_INTRWAIT, for the common case (IIC_INTR | IIC_WAIT). 2015-10-10 02:06:07 +00:00
Navdeep Parhar
0d18010dec iw_cxgbe: fix for page fault in cm_close_handler().
This is roughly the iw_cxgbe equivalent of
be13b2dff8
-----------------
RDMA/cxgb4: Connect_request_upcall fixes

When processing an MPA Start Request, if the listening endpoint is
DEAD, then abort the connection.

If the IWCM returns an error, then we must abort the connection and
release resources.  Also abort_connection() should not post a CLOSE
event, so clean that up too.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
-----------------

Submitted by:	Krishnamraju Eraparaju at chelsio dot com.
2015-10-10 01:41:07 +00:00
Adrian Chadd
dc809fc15f Flip on fast frames support for AR5416 and AR9300 series NICs.
This was off because the net80211 aggregation code was using the same
state pointers for both fast frames and ampdu tx support which led to some
pretty unfortunate panic-y behaviour.

Now that net80211 doesn't panic, let's flip this back on.

It doesn't (yet) do the horrific sounding thing of A-MPDU aggregates
of fast frames; that'll come next.  It's a pre-requisite to supporting
AMSDU + AMPDU anyway, which actually speeds things up quite considerably
(think packing lots of little ACK frames into a single AMSDU.)

Tested:

* QCA955x SoC, AP mode
* AR5416, STA mode
* AR9170, STA mode (with local fast frame patches)
2015-10-10 00:13:45 +00:00
Ian Lepore
4006520bea Fix more cases of iicbus-layer functions that must return IIC_Exxxx values. 2015-10-10 00:12:03 +00:00
Ian Lepore
48e5b4261a Return only IIC_Exxxx status values from iicbus-layer functions. Most of
these functions are thin wrappers around calling the hardware-layer driver,
but some of them do sanity checks and return an error.  Since the hardware
layer can only return IIC_Exxxxx status values, the iicbus helper functions
must also adhere to that, so that drivers at higher layers can assume that
any non-zero status value is an IIC_Exxxx value that provides details about
what happened at the hardware layer (sometimes those details are important
for certain slave drivers).
2015-10-09 23:58:19 +00:00