NTB: Use DMA Engine to Transmit and Receive

Allocate and use a DMA engine channel to transmit and receive data over
NTB.  If none is allocated, fall back to using the CPU to transfer data.

Cc: Dan Williams <djbw@fb.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jon Mason <jon.mason@intel.com>
NTB: 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.

Signed-off-by: Jon Mason <jon.mason@intel.com>
NTB: NTB-RP support

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.

Signed-off-by: Jon Mason <jon.mason@intel.com>
NTB: 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.

Signed-off-by: Jon Mason <jon.mason@intel.com>
NTB: Remove unused variable

Remove unused pci_dev variable from ntb_transport_free()

Signed-off-by: Jon Mason <jon.mason@intel.com>
NTB: Comment Fix

Add "data" ntb_register_db_callback parameter description comment and
correct poor spelling.

Signed-off-by: Jon Mason <jon.mason@intel.com>
NTB: Update Version

Update NTB version to 1.0

Signed-off-by: Jon Mason <jon.mason@intel.com>
MAINTAINERS: Add Website and Git Tree for NTB

Add website and git tree for the NTB entry in MAINTAINERS

Signed-off-by: Jon Mason <jon.mason@intel.com>
ntb: clean up unnecessary MSI/MSI-X capability find

PCI core will initialize device MSI/MSI-X capability in
pci_msi_init_pci_dev(). So device driver should use
pci_dev->msi_cap/msix_cap to determine whether the device
support MSI/MSI-X instead of using
pci_find_capability(pci_dev, PCI_CAP_ID_MSI/MSIX).
Access to PCIe device config space again will consume more time.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Jon Mason <jon.mason@intel.com>
NTB: zero PCI driver data

Zero pci_device_id driver_data variable.  Unused, but 'EXTRA_CFLAGS=-W'
complained of uninitialized variables.

Signed-off-by: Jon Mason <jon.mason@intel.com>
NTB: declare unused variables

Tag pci_device_id in ntb_pci_probe as unused function parameters.  This
corrects issues found by 'EXTRA_CFLAGS=-W'.

Signed-off-by: Jon Mason <jon.mason@intel.com>
ntb_netdev: declare unused variables and fix missing initializer

Tag qp in ntb_netdev_tx_handler and net_device in ntb_get_settings as
unused function parameters.  Also, correct missing initializer errors
for 'struct device_driver' in ntb_netdev_client.  This corrects issues
found by 'EXTRA_CFLAGS=-W'.

Signed-off-by: Jon Mason <jon.mason@intel.com>
NTB: Disable interrupts and poll under high load

Disable interrupts and poll under high load

Signed-off-by: Jon Mason <jon.mason@intel.com>
NTB: Remove lists

Remove lists in favor of statically sized arrays

Signed-off-by: Jon Mason <jon.mason@intel.com>
NTB: ntb_test module

Signed-off-by: Jon Mason <jon.mason@intel.com>
NTB: AER support

Add AER support for the NTB driver

NOTE: BWD Link down does not disable the link!

Signed-off-by: Jon Mason <jon.mason@intel.com>
NTB: Xeon AER support

In Xeon NTB, AER appears as a vendor specific extended capability of PCI
Config space, and not the standard PCI AER capability.  Unfortunately,
this means it cannot use the Linux AER infrastructure and must do its
own detection and recovery.

When an AER event occurs, a link interrupt is encountered.  The driver
must now check on all link interrupts for AER events and Link changes.
For all correctable and non-fatal events, log the error and continue
running as normal.  If a fatal event is encountered, retrain the link
and attempt to recover.

Signed-off-by: Jon Mason <jon.mason@intel.com>
NTB: add multiqueue support to ntb_netdev

Signed-off-by: Jon Mason <jon.mason@intel.com>
NTB: Add ability to disable MSI/MSI-X interrupts

Per request from validation, add ability to disable MSI-X and MSI.  This
allows them to more easily verify all interrupt types are working.

Signed-off-by: Jon Mason <jon.mason@intel.com>
NTB: client event cleanup

Provide a better event interface between the client and transport

Signed-off-by: Jon Mason <jon.mason@intel.com>