Commit Graph

180 Commits

Author SHA1 Message Date
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
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
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
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
Jung-uk Kim
fd90e2ed54 CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten
years for head.  However, it is continuously misused as the mpsafe argument
for callout_init(9).  Deprecate the flag and clean up callout_init() calls
to make them more consistent.

Differential Revision:	https://reviews.freebsd.org/D2613
Reviewed by:	jhb
MFC after:	2 weeks
2015-05-22 17:05:21 +00:00
Carl Delsey
2a6e50d2ce Remove contractions.
Approved by:	jimharris
Sponsored by:	Intel
2013-09-05 23:14:27 +00:00
Carl Delsey
538779c1a0 Only tear down interface and transport if they've been successfully setup.
Approved by:	jimharris
Sponsored by:	Intel
2013-09-05 23:12:58 +00:00
Carl Delsey
218b961f0e Workaround an issue with hardware by accessing remote device through mem
window.

Approved by:	jimharris
Sponsored by:	Intel
2013-09-05 23:11:11 +00:00
Carl Delsey
b0f569217d Simplify register access macros by removing one level of indirection.
Approved by:	jimharris
Sponsored by:	Intel
2013-09-05 23:08:22 +00:00
Carl Delsey
ff53f82bfd Cleaning up spacing and making hex value case consistent.
Approved by:	jimharris
Sponsored by:	Intel
2013-09-05 23:06:25 +00:00
Carl Delsey
bfb4daf19d Implement workaround for IvyTown 4K BAR size issue.
Approved by:	jimharris
Sponsored by:	Intel
2013-09-05 23:04:36 +00:00
Carl Delsey
93d43573eb Simplifying bus alloc resource call since we only need the default values.
Approved by:	jimharris
Sponsored by:	Intel
2013-09-05 23:02:43 +00:00
Carl Delsey
e70d7a7c79 Add support for per device features and workarounds.
Approved by:	jimharris
Sponsored by:	Intel
2013-09-05 23:00:59 +00:00
Carl Delsey
87a7a3f08d Restructure the PCI bar initialization code in anticipation of upcoming
bug fixes.

Approved by:	jimharris
Sponsored by:	Intel
2013-09-05 22:59:18 +00:00
Carl Delsey
64d957247f Fix name change from ntb_transport to if_ntb. A few places were
overlooked.

Approved by:	jimharris
Sponsored by:	Intel
2013-09-05 22:56:52 +00:00
Carl Delsey
12c5baf9f5 Throw a bit to enable the link to come up on Xeon.
Approved by:	jimharris
Sponsored by:	Intel
2013-09-05 22:52:40 +00:00
Carl Delsey
d43c0fbae1 Add some logging to ntb link up.
Approved by:	jimharris
Sponsored by:	Intel
2013-09-05 22:46:48 +00:00
Carl Delsey
e47937d1b7 Add a new driver to support the Intel Non-Transparent Bridge(NTB).
The NTB allows you to connect two systems with this device using a PCI-e
link. The driver is made of two modules:
 - ntb_hw which is a basic hardware abstraction layer for the device.
 - if_ntb which implements the ntb network device and the communication
   protocol.

The driver is limited at the moment to CPU memcpy instead of using DMA, and
only Back-to-Back mode is supported. Also the network device isn't full
featured yet. These changes will be coming soon. The DMA change will also
bring in the ioat driver from the project branch it is on now.

This is an initial port of the GPL/BSD Linux driver contributed by Jon Mason
from Intel. Any bugs are my contributions.

Sponsored by: Intel
Reviewed by: jimharris, joel (man page only)
Approved by: jimharris (mentor)
2013-04-29 22:48:53 +00:00