mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
877f075aac
- The biggest change is core API extensions and mlx5 low-level driver support for handling DIF/DIX-style protection information, and the addition of PI support to the iSER initiator. Target support will be arriving shortly through the SCSI target tree. - A nice simplification to the "umem" memory pinning library now that we have chained sg lists. Kudos to Yishai Hadas for realizing our code didn't have to be so crazy. - Another nice simplification to the sg wrappers used by qib, ipath and ehca to handle their mapping of memory to adapter. - The usual batch of fixes to bugs found by static checkers etc. from intrepid people like Dan Carpenter and Yann Droneaud. - A large batch of cxgb4, ocrdma, qib driver updates. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABCAAGBQJTPYBnAAoJEENa44ZhAt0hGI4P/29eotGwpkANUQE6FQvxCUL2 CXJtSg52lmYvGJrPK4IhihpbtQmHJz3iXEzlOOWidTw1dJgObR6vFaRymh7+vDLs CdzybMcXdasarqTuYeJbFzhkimpwtWWrMy/8Ik/Jj/5glGQ6cUSpdYZzVtFhYNqf hCGE8iLi+tuekJJj1htut5D6apXM7udcdc2yLJNOdsSj/VUXt1oqG1x9xAi9R8Tq 7o8eFSStdlja0EBQ6Hli2zauCSnQkaUtr8h6EAFbcCtvBK8HqsHSc2gfq2ViFUiN ztt167oWoQnVkR0qCPL5nVt+CRQHHROprVXvbpcTI3aW61gNIl6OrUUOXefzHXac TNi+fdMpiEB/JQ4Z04Jzd1dGCSjYeTqPj4rO4meFjBmxRDdTgZHu7FWwejT1nYJ5 d2abVdCOT+QWlIlM7m/pjdWJII5OYM+4/jtTayGepEaR4fTUzKtPZPBLNUBDBKE+ 4f92PC8LiuPkwJgb6XT96onPz1bDCOnPSEdwoKUFKPeGUcwgVOM/Wx5NU4Yf7rfg RxQwZ7mJXbjCYFlmGGo/0QDy6UEGkIFYlJSzooP+wlK1JvZ5h2M+9QKX2FtwzR+R I2kBxcTXWsM/h88R7MkNqbNIllmhssrJwmAE46OneZbfoBOB+JZjb4nLRTu0jEcS zn6f16GmJ37BKn2/qYY/ =Ww6H -----END PGP SIGNATURE----- Merge tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband Pull infiniband updates from Roland Dreier: "Main batch of InfiniBand/RDMA changes for 3.15: - The biggest change is core API extensions and mlx5 low-level driver support for handling DIF/DIX-style protection information, and the addition of PI support to the iSER initiator. Target support will be arriving shortly through the SCSI target tree. - A nice simplification to the "umem" memory pinning library now that we have chained sg lists. Kudos to Yishai Hadas for realizing our code didn't have to be so crazy. - Another nice simplification to the sg wrappers used by qib, ipath and ehca to handle their mapping of memory to adapter. - The usual batch of fixes to bugs found by static checkers etc. from intrepid people like Dan Carpenter and Yann Droneaud. - A large batch of cxgb4, ocrdma, qib driver updates" * tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: (102 commits) RDMA/ocrdma: Unregister inet notifier when unloading ocrdma RDMA/ocrdma: Fix warnings about pointer <-> integer casts RDMA/ocrdma: Code clean-up RDMA/ocrdma: Display FW version RDMA/ocrdma: Query controller information RDMA/ocrdma: Support non-embedded mailbox commands RDMA/ocrdma: Handle CQ overrun error RDMA/ocrdma: Display proper value for max_mw RDMA/ocrdma: Use non-zero tag in SRQ posting RDMA/ocrdma: Memory leak fix in ocrdma_dereg_mr() RDMA/ocrdma: Increment abi version count RDMA/ocrdma: Update version string be2net: Add abi version between be2net and ocrdma RDMA/ocrdma: ABI versioning between ocrdma and be2net RDMA/ocrdma: Allow DPP QP creation RDMA/ocrdma: Read ASIC_ID register to select asic_gen RDMA/ocrdma: SQ and RQ doorbell offset clean up RDMA/ocrdma: EQ full catastrophe avoidance RDMA/cxgb4: Disable DSGL use by default RDMA/cxgb4: rx_data() needs to hold the ep mutex ...
186 lines
5.0 KiB
C
186 lines
5.0 KiB
C
/*
|
|
* Copyright (C) 2005 - 2014 Emulex
|
|
* All rights reserved.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License version 2
|
|
* as published by the Free Software Foundation. The full GNU General
|
|
* Public License is included in this distribution in the file called COPYING.
|
|
*
|
|
* Contact Information:
|
|
* linux-drivers@emulex.com
|
|
*
|
|
* Emulex
|
|
* 3333 Susan Street
|
|
* Costa Mesa, CA 92626
|
|
*/
|
|
|
|
#include <linux/mutex.h>
|
|
#include <linux/list.h>
|
|
#include <linux/netdevice.h>
|
|
#include <linux/module.h>
|
|
|
|
#include "be.h"
|
|
#include "be_cmds.h"
|
|
|
|
static struct ocrdma_driver *ocrdma_drv;
|
|
static LIST_HEAD(be_adapter_list);
|
|
static DEFINE_MUTEX(be_adapter_list_lock);
|
|
|
|
static void _be_roce_dev_add(struct be_adapter *adapter)
|
|
{
|
|
struct be_dev_info dev_info;
|
|
int i, num_vec;
|
|
struct pci_dev *pdev = adapter->pdev;
|
|
|
|
if (!ocrdma_drv)
|
|
return;
|
|
|
|
if (ocrdma_drv->be_abi_version != BE_ROCE_ABI_VERSION) {
|
|
dev_warn(&pdev->dev, "Cannot initialize RoCE due to ocrdma ABI mismatch\n");
|
|
return;
|
|
}
|
|
|
|
if (pdev->device == OC_DEVICE_ID5) {
|
|
/* only msix is supported on these devices */
|
|
if (!msix_enabled(adapter))
|
|
return;
|
|
/* DPP region address and length */
|
|
dev_info.dpp_unmapped_addr = pci_resource_start(pdev, 2);
|
|
dev_info.dpp_unmapped_len = pci_resource_len(pdev, 2);
|
|
} else {
|
|
dev_info.dpp_unmapped_addr = 0;
|
|
dev_info.dpp_unmapped_len = 0;
|
|
}
|
|
dev_info.pdev = adapter->pdev;
|
|
dev_info.db = adapter->db;
|
|
dev_info.unmapped_db = adapter->roce_db.io_addr;
|
|
dev_info.db_page_size = adapter->roce_db.size;
|
|
dev_info.db_total_size = adapter->roce_db.total_size;
|
|
dev_info.netdev = adapter->netdev;
|
|
memcpy(dev_info.mac_addr, adapter->netdev->dev_addr, ETH_ALEN);
|
|
dev_info.dev_family = adapter->sli_family;
|
|
if (msix_enabled(adapter)) {
|
|
/* provide all the vectors, so that EQ creation response
|
|
* can decide which one to use.
|
|
*/
|
|
num_vec = adapter->num_msix_vec + adapter->num_msix_roce_vec;
|
|
dev_info.intr_mode = BE_INTERRUPT_MODE_MSIX;
|
|
dev_info.msix.num_vectors = min(num_vec, MAX_MSIX_VECTORS);
|
|
/* provide start index of the vector,
|
|
* so in case of linear usage,
|
|
* it can use the base as starting point.
|
|
*/
|
|
dev_info.msix.start_vector = adapter->num_evt_qs;
|
|
for (i = 0; i < dev_info.msix.num_vectors; i++) {
|
|
dev_info.msix.vector_list[i] =
|
|
adapter->msix_entries[i].vector;
|
|
}
|
|
} else {
|
|
dev_info.msix.num_vectors = 0;
|
|
dev_info.intr_mode = BE_INTERRUPT_MODE_INTX;
|
|
}
|
|
adapter->ocrdma_dev = ocrdma_drv->add(&dev_info);
|
|
}
|
|
|
|
void be_roce_dev_add(struct be_adapter *adapter)
|
|
{
|
|
if (be_roce_supported(adapter)) {
|
|
INIT_LIST_HEAD(&adapter->entry);
|
|
mutex_lock(&be_adapter_list_lock);
|
|
list_add_tail(&adapter->entry, &be_adapter_list);
|
|
|
|
/* invoke add() routine of roce driver only if
|
|
* valid driver registered with add method and add() is not yet
|
|
* invoked on a given adapter.
|
|
*/
|
|
_be_roce_dev_add(adapter);
|
|
mutex_unlock(&be_adapter_list_lock);
|
|
}
|
|
}
|
|
|
|
static void _be_roce_dev_remove(struct be_adapter *adapter)
|
|
{
|
|
if (ocrdma_drv && ocrdma_drv->remove && adapter->ocrdma_dev)
|
|
ocrdma_drv->remove(adapter->ocrdma_dev);
|
|
adapter->ocrdma_dev = NULL;
|
|
}
|
|
|
|
void be_roce_dev_remove(struct be_adapter *adapter)
|
|
{
|
|
if (be_roce_supported(adapter)) {
|
|
mutex_lock(&be_adapter_list_lock);
|
|
_be_roce_dev_remove(adapter);
|
|
list_del(&adapter->entry);
|
|
mutex_unlock(&be_adapter_list_lock);
|
|
}
|
|
}
|
|
|
|
static void _be_roce_dev_open(struct be_adapter *adapter)
|
|
{
|
|
if (ocrdma_drv && adapter->ocrdma_dev &&
|
|
ocrdma_drv->state_change_handler)
|
|
ocrdma_drv->state_change_handler(adapter->ocrdma_dev, 0);
|
|
}
|
|
|
|
void be_roce_dev_open(struct be_adapter *adapter)
|
|
{
|
|
if (be_roce_supported(adapter)) {
|
|
mutex_lock(&be_adapter_list_lock);
|
|
_be_roce_dev_open(adapter);
|
|
mutex_unlock(&be_adapter_list_lock);
|
|
}
|
|
}
|
|
|
|
static void _be_roce_dev_close(struct be_adapter *adapter)
|
|
{
|
|
if (ocrdma_drv && adapter->ocrdma_dev &&
|
|
ocrdma_drv->state_change_handler)
|
|
ocrdma_drv->state_change_handler(adapter->ocrdma_dev, 1);
|
|
}
|
|
|
|
void be_roce_dev_close(struct be_adapter *adapter)
|
|
{
|
|
if (be_roce_supported(adapter)) {
|
|
mutex_lock(&be_adapter_list_lock);
|
|
_be_roce_dev_close(adapter);
|
|
mutex_unlock(&be_adapter_list_lock);
|
|
}
|
|
}
|
|
|
|
int be_roce_register_driver(struct ocrdma_driver *drv)
|
|
{
|
|
struct be_adapter *dev;
|
|
|
|
mutex_lock(&be_adapter_list_lock);
|
|
if (ocrdma_drv) {
|
|
mutex_unlock(&be_adapter_list_lock);
|
|
return -EINVAL;
|
|
}
|
|
ocrdma_drv = drv;
|
|
list_for_each_entry(dev, &be_adapter_list, entry) {
|
|
struct net_device *netdev;
|
|
_be_roce_dev_add(dev);
|
|
netdev = dev->netdev;
|
|
if (netif_running(netdev) && netif_oper_up(netdev))
|
|
_be_roce_dev_open(dev);
|
|
}
|
|
mutex_unlock(&be_adapter_list_lock);
|
|
return 0;
|
|
}
|
|
EXPORT_SYMBOL(be_roce_register_driver);
|
|
|
|
void be_roce_unregister_driver(struct ocrdma_driver *drv)
|
|
{
|
|
struct be_adapter *dev;
|
|
|
|
mutex_lock(&be_adapter_list_lock);
|
|
list_for_each_entry(dev, &be_adapter_list, entry) {
|
|
if (dev->ocrdma_dev)
|
|
_be_roce_dev_remove(dev);
|
|
}
|
|
ocrdma_drv = NULL;
|
|
mutex_unlock(&be_adapter_list_lock);
|
|
}
|
|
EXPORT_SYMBOL(be_roce_unregister_driver);
|