You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: (26 commits) IB/qib: Defer HCA error events to tasklet mlx4_core: Bump the driver version to 1.0 RDMA/cxgb4: Use printk_ratelimited() instead of printk_ratelimit() IB/mlx4: Support PMA counters for IBoE IB/mlx4: Use flow counters on IBoE ports IB/pma: Add include file for IBA performance counters definitions mlx4_core: Add network flow counters mlx4_core: Fix location of counter index in QP context struct mlx4_core: Read extended capabilities into the flags field mlx4_core: Extend capability flags to 64 bits IB/mlx4: Generate GID change events in IBoE code IB/core: Add GID change event RDMA/cma: Don't allow IPoIB port space for IBoE RDMA: Allow for NULL .modify_device() and .modify_port() methods IB/qib: Update active link width IB/qib: Fix potential deadlock with link down interrupt IB/qib: Add sysfs interface to read free contexts IB/mthca: Remove unnecessary read of PCI_CAP_ID_EXP IB/qib: Remove double define IB/qib: Remove unnecessary read of PCI_CAP_ID_EXP ...
This commit is contained in:
+8
-3
@@ -3426,10 +3426,9 @@ S: Maintained
|
||||
F: drivers/net/ipg.*
|
||||
|
||||
IPATH DRIVER
|
||||
M: Ralph Campbell <infinipath@qlogic.com>
|
||||
M: Mike Marciniszyn <infinipath@qlogic.com>
|
||||
L: linux-rdma@vger.kernel.org
|
||||
T: git git://git.qlogic.com/ipath-linux-2.6
|
||||
S: Supported
|
||||
S: Maintained
|
||||
F: drivers/infiniband/hw/ipath/
|
||||
|
||||
IPMI SUBSYSTEM
|
||||
@@ -5152,6 +5151,12 @@ M: Robert Jarzmik <robert.jarzmik@free.fr>
|
||||
L: rtc-linux@googlegroups.com
|
||||
S: Maintained
|
||||
|
||||
QIB DRIVER
|
||||
M: Mike Marciniszyn <infinipath@qlogic.com>
|
||||
L: linux-rdma@vger.kernel.org
|
||||
S: Supported
|
||||
F: drivers/infiniband/hw/qib/
|
||||
|
||||
QLOGIC QLA1280 SCSI DRIVER
|
||||
M: Michael Reed <mdr@sgi.com>
|
||||
L: linux-scsi@vger.kernel.org
|
||||
|
||||
@@ -302,7 +302,8 @@ static void ib_cache_event(struct ib_event_handler *handler,
|
||||
event->event == IB_EVENT_LID_CHANGE ||
|
||||
event->event == IB_EVENT_PKEY_CHANGE ||
|
||||
event->event == IB_EVENT_SM_CHANGE ||
|
||||
event->event == IB_EVENT_CLIENT_REREGISTER) {
|
||||
event->event == IB_EVENT_CLIENT_REREGISTER ||
|
||||
event->event == IB_EVENT_GID_CHANGE) {
|
||||
work = kmalloc(sizeof *work, GFP_ATOMIC);
|
||||
if (work) {
|
||||
INIT_WORK(&work->work, ib_cache_task);
|
||||
|
||||
@@ -359,6 +359,10 @@ static int cma_acquire_dev(struct rdma_id_private *id_priv)
|
||||
enum rdma_link_layer dev_ll = dev_addr->dev_type == ARPHRD_INFINIBAND ?
|
||||
IB_LINK_LAYER_INFINIBAND : IB_LINK_LAYER_ETHERNET;
|
||||
|
||||
if (dev_ll != IB_LINK_LAYER_INFINIBAND &&
|
||||
id_priv->id.ps == RDMA_PS_IPOIB)
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&lock);
|
||||
iboe_addr_get_sgid(dev_addr, &iboe_gid);
|
||||
memcpy(&gid, dev_addr->src_dev_addr +
|
||||
@@ -406,11 +410,6 @@ static int cma_disable_callback(struct rdma_id_private *id_priv,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cma_has_cm_dev(struct rdma_id_private *id_priv)
|
||||
{
|
||||
return (id_priv->id.device && id_priv->cm_id.ib);
|
||||
}
|
||||
|
||||
struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler,
|
||||
void *context, enum rdma_port_space ps,
|
||||
enum ib_qp_type qp_type)
|
||||
@@ -920,11 +919,11 @@ void rdma_destroy_id(struct rdma_cm_id *id)
|
||||
if (id_priv->cma_dev) {
|
||||
switch (rdma_node_get_transport(id_priv->id.device->node_type)) {
|
||||
case RDMA_TRANSPORT_IB:
|
||||
if (id_priv->cm_id.ib && !IS_ERR(id_priv->cm_id.ib))
|
||||
if (id_priv->cm_id.ib)
|
||||
ib_destroy_cm_id(id_priv->cm_id.ib);
|
||||
break;
|
||||
case RDMA_TRANSPORT_IWARP:
|
||||
if (id_priv->cm_id.iw && !IS_ERR(id_priv->cm_id.iw))
|
||||
if (id_priv->cm_id.iw)
|
||||
iw_destroy_cm_id(id_priv->cm_id.iw);
|
||||
break;
|
||||
default:
|
||||
@@ -1085,12 +1084,12 @@ static struct rdma_id_private *cma_new_conn_id(struct rdma_cm_id *listen_id,
|
||||
|
||||
if (cma_get_net_info(ib_event->private_data, listen_id->ps,
|
||||
&ip_ver, &port, &src, &dst))
|
||||
goto err;
|
||||
return NULL;
|
||||
|
||||
id = rdma_create_id(listen_id->event_handler, listen_id->context,
|
||||
listen_id->ps, ib_event->param.req_rcvd.qp_type);
|
||||
if (IS_ERR(id))
|
||||
goto err;
|
||||
return NULL;
|
||||
|
||||
cma_save_net_info(&id->route.addr, &listen_id->route.addr,
|
||||
ip_ver, port, src, dst);
|
||||
@@ -1100,7 +1099,7 @@ static struct rdma_id_private *cma_new_conn_id(struct rdma_cm_id *listen_id,
|
||||
rt->path_rec = kmalloc(sizeof *rt->path_rec * rt->num_paths,
|
||||
GFP_KERNEL);
|
||||
if (!rt->path_rec)
|
||||
goto destroy_id;
|
||||
goto err;
|
||||
|
||||
rt->path_rec[0] = *ib_event->param.req_rcvd.primary_path;
|
||||
if (rt->num_paths == 2)
|
||||
@@ -1114,7 +1113,7 @@ static struct rdma_id_private *cma_new_conn_id(struct rdma_cm_id *listen_id,
|
||||
ret = rdma_translate_ip((struct sockaddr *) &rt->addr.src_addr,
|
||||
&rt->addr.dev_addr);
|
||||
if (ret)
|
||||
goto destroy_id;
|
||||
goto err;
|
||||
}
|
||||
rdma_addr_set_dgid(&rt->addr.dev_addr, &rt->path_rec[0].dgid);
|
||||
|
||||
@@ -1122,9 +1121,8 @@ static struct rdma_id_private *cma_new_conn_id(struct rdma_cm_id *listen_id,
|
||||
id_priv->state = RDMA_CM_CONNECT;
|
||||
return id_priv;
|
||||
|
||||
destroy_id:
|
||||
rdma_destroy_id(id);
|
||||
err:
|
||||
rdma_destroy_id(id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1468,13 +1466,15 @@ static int cma_ib_listen(struct rdma_id_private *id_priv)
|
||||
{
|
||||
struct ib_cm_compare_data compare_data;
|
||||
struct sockaddr *addr;
|
||||
struct ib_cm_id *id;
|
||||
__be64 svc_id;
|
||||
int ret;
|
||||
|
||||
id_priv->cm_id.ib = ib_create_cm_id(id_priv->id.device, cma_req_handler,
|
||||
id_priv);
|
||||
if (IS_ERR(id_priv->cm_id.ib))
|
||||
return PTR_ERR(id_priv->cm_id.ib);
|
||||
id = ib_create_cm_id(id_priv->id.device, cma_req_handler, id_priv);
|
||||
if (IS_ERR(id))
|
||||
return PTR_ERR(id);
|
||||
|
||||
id_priv->cm_id.ib = id;
|
||||
|
||||
addr = (struct sockaddr *) &id_priv->id.route.addr.src_addr;
|
||||
svc_id = cma_get_service_id(id_priv->id.ps, addr);
|
||||
@@ -1497,12 +1497,15 @@ static int cma_iw_listen(struct rdma_id_private *id_priv, int backlog)
|
||||
{
|
||||
int ret;
|
||||
struct sockaddr_in *sin;
|
||||
struct iw_cm_id *id;
|
||||
|
||||
id_priv->cm_id.iw = iw_create_cm_id(id_priv->id.device,
|
||||
iw_conn_req_handler,
|
||||
id_priv);
|
||||
if (IS_ERR(id_priv->cm_id.iw))
|
||||
return PTR_ERR(id_priv->cm_id.iw);
|
||||
id = iw_create_cm_id(id_priv->id.device,
|
||||
iw_conn_req_handler,
|
||||
id_priv);
|
||||
if (IS_ERR(id))
|
||||
return PTR_ERR(id);
|
||||
|
||||
id_priv->cm_id.iw = id;
|
||||
|
||||
sin = (struct sockaddr_in *) &id_priv->id.route.addr.src_addr;
|
||||
id_priv->cm_id.iw->local_addr = *sin;
|
||||
@@ -2484,6 +2487,7 @@ static int cma_resolve_ib_udp(struct rdma_id_private *id_priv,
|
||||
{
|
||||
struct ib_cm_sidr_req_param req;
|
||||
struct rdma_route *route;
|
||||
struct ib_cm_id *id;
|
||||
int ret;
|
||||
|
||||
req.private_data_len = sizeof(struct cma_hdr) +
|
||||
@@ -2501,12 +2505,13 @@ static int cma_resolve_ib_udp(struct rdma_id_private *id_priv,
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
id_priv->cm_id.ib = ib_create_cm_id(id_priv->id.device,
|
||||
cma_sidr_rep_handler, id_priv);
|
||||
if (IS_ERR(id_priv->cm_id.ib)) {
|
||||
ret = PTR_ERR(id_priv->cm_id.ib);
|
||||
id = ib_create_cm_id(id_priv->id.device, cma_sidr_rep_handler,
|
||||
id_priv);
|
||||
if (IS_ERR(id)) {
|
||||
ret = PTR_ERR(id);
|
||||
goto out;
|
||||
}
|
||||
id_priv->cm_id.ib = id;
|
||||
|
||||
req.path = route->path_rec;
|
||||
req.service_id = cma_get_service_id(id_priv->id.ps,
|
||||
@@ -2530,6 +2535,7 @@ static int cma_connect_ib(struct rdma_id_private *id_priv,
|
||||
struct ib_cm_req_param req;
|
||||
struct rdma_route *route;
|
||||
void *private_data;
|
||||
struct ib_cm_id *id;
|
||||
int offset, ret;
|
||||
|
||||
memset(&req, 0, sizeof req);
|
||||
@@ -2543,12 +2549,12 @@ static int cma_connect_ib(struct rdma_id_private *id_priv,
|
||||
memcpy(private_data + offset, conn_param->private_data,
|
||||
conn_param->private_data_len);
|
||||
|
||||
id_priv->cm_id.ib = ib_create_cm_id(id_priv->id.device, cma_ib_handler,
|
||||
id_priv);
|
||||
if (IS_ERR(id_priv->cm_id.ib)) {
|
||||
ret = PTR_ERR(id_priv->cm_id.ib);
|
||||
id = ib_create_cm_id(id_priv->id.device, cma_ib_handler, id_priv);
|
||||
if (IS_ERR(id)) {
|
||||
ret = PTR_ERR(id);
|
||||
goto out;
|
||||
}
|
||||
id_priv->cm_id.ib = id;
|
||||
|
||||
route = &id_priv->id.route;
|
||||
ret = cma_format_hdr(private_data, id_priv->id.ps, route);
|
||||
@@ -2577,8 +2583,8 @@ static int cma_connect_ib(struct rdma_id_private *id_priv,
|
||||
|
||||
ret = ib_send_cm_req(id_priv->cm_id.ib, &req);
|
||||
out:
|
||||
if (ret && !IS_ERR(id_priv->cm_id.ib)) {
|
||||
ib_destroy_cm_id(id_priv->cm_id.ib);
|
||||
if (ret && !IS_ERR(id)) {
|
||||
ib_destroy_cm_id(id);
|
||||
id_priv->cm_id.ib = NULL;
|
||||
}
|
||||
|
||||
@@ -2595,10 +2601,8 @@ static int cma_connect_iw(struct rdma_id_private *id_priv,
|
||||
struct iw_cm_conn_param iw_param;
|
||||
|
||||
cm_id = iw_create_cm_id(id_priv->id.device, cma_iw_handler, id_priv);
|
||||
if (IS_ERR(cm_id)) {
|
||||
ret = PTR_ERR(cm_id);
|
||||
goto out;
|
||||
}
|
||||
if (IS_ERR(cm_id))
|
||||
return PTR_ERR(cm_id);
|
||||
|
||||
id_priv->cm_id.iw = cm_id;
|
||||
|
||||
@@ -2622,7 +2626,7 @@ static int cma_connect_iw(struct rdma_id_private *id_priv,
|
||||
iw_param.qpn = conn_param->qp_num;
|
||||
ret = iw_cm_connect(cm_id, &iw_param);
|
||||
out:
|
||||
if (ret && !IS_ERR(cm_id)) {
|
||||
if (ret) {
|
||||
iw_destroy_cm_id(cm_id);
|
||||
id_priv->cm_id.iw = NULL;
|
||||
}
|
||||
@@ -2795,7 +2799,7 @@ int rdma_notify(struct rdma_cm_id *id, enum ib_event_type event)
|
||||
int ret;
|
||||
|
||||
id_priv = container_of(id, struct rdma_id_private, id);
|
||||
if (!cma_has_cm_dev(id_priv))
|
||||
if (!id_priv->cm_id.ib)
|
||||
return -EINVAL;
|
||||
|
||||
switch (id->device->node_type) {
|
||||
@@ -2817,7 +2821,7 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data,
|
||||
int ret;
|
||||
|
||||
id_priv = container_of(id, struct rdma_id_private, id);
|
||||
if (!cma_has_cm_dev(id_priv))
|
||||
if (!id_priv->cm_id.ib)
|
||||
return -EINVAL;
|
||||
|
||||
switch (rdma_node_get_transport(id->device->node_type)) {
|
||||
@@ -2848,7 +2852,7 @@ int rdma_disconnect(struct rdma_cm_id *id)
|
||||
int ret;
|
||||
|
||||
id_priv = container_of(id, struct rdma_id_private, id);
|
||||
if (!cma_has_cm_dev(id_priv))
|
||||
if (!id_priv->cm_id.ib)
|
||||
return -EINVAL;
|
||||
|
||||
switch (rdma_node_get_transport(id->device->node_type)) {
|
||||
|
||||
@@ -627,6 +627,9 @@ int ib_modify_device(struct ib_device *device,
|
||||
int device_modify_mask,
|
||||
struct ib_device_modify *device_modify)
|
||||
{
|
||||
if (!device->modify_device)
|
||||
return -ENOSYS;
|
||||
|
||||
return device->modify_device(device, device_modify_mask,
|
||||
device_modify);
|
||||
}
|
||||
@@ -647,6 +650,9 @@ int ib_modify_port(struct ib_device *device,
|
||||
u8 port_num, int port_modify_mask,
|
||||
struct ib_port_modify *port_modify)
|
||||
{
|
||||
if (!device->modify_port)
|
||||
return -ENOSYS;
|
||||
|
||||
if (port_num < start_port(device) || port_num > end_port(device))
|
||||
return -EINVAL;
|
||||
|
||||
|
||||
@@ -99,14 +99,6 @@ static int c2_query_port(struct ib_device *ibdev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int c2_modify_port(struct ib_device *ibdev,
|
||||
u8 port, int port_modify_mask,
|
||||
struct ib_port_modify *props)
|
||||
{
|
||||
pr_debug("%s:%u\n", __func__, __LINE__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int c2_query_pkey(struct ib_device *ibdev,
|
||||
u8 port, u16 index, u16 * pkey)
|
||||
{
|
||||
@@ -817,7 +809,6 @@ int c2_register_device(struct c2_dev *dev)
|
||||
dev->ibdev.dma_device = &dev->pcidev->dev;
|
||||
dev->ibdev.query_device = c2_query_device;
|
||||
dev->ibdev.query_port = c2_query_port;
|
||||
dev->ibdev.modify_port = c2_modify_port;
|
||||
dev->ibdev.query_pkey = c2_query_pkey;
|
||||
dev->ibdev.query_gid = c2_query_gid;
|
||||
dev->ibdev.alloc_ucontext = c2_alloc_ucontext;
|
||||
|
||||
@@ -61,13 +61,6 @@
|
||||
#include "iwch_user.h"
|
||||
#include "common.h"
|
||||
|
||||
static int iwch_modify_port(struct ib_device *ibdev,
|
||||
u8 port, int port_modify_mask,
|
||||
struct ib_port_modify *props)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static struct ib_ah *iwch_ah_create(struct ib_pd *pd,
|
||||
struct ib_ah_attr *ah_attr)
|
||||
{
|
||||
@@ -1392,7 +1385,6 @@ int iwch_register_device(struct iwch_dev *dev)
|
||||
dev->ibdev.dma_device = &(dev->rdev.rnic_info.pdev->dev);
|
||||
dev->ibdev.query_device = iwch_query_device;
|
||||
dev->ibdev.query_port = iwch_query_port;
|
||||
dev->ibdev.modify_port = iwch_modify_port;
|
||||
dev->ibdev.query_pkey = iwch_query_pkey;
|
||||
dev->ibdev.query_gid = iwch_query_gid;
|
||||
dev->ibdev.alloc_ucontext = iwch_alloc_ucontext;
|
||||
|
||||
@@ -58,13 +58,6 @@ static int fastreg_support = 1;
|
||||
module_param(fastreg_support, int, 0644);
|
||||
MODULE_PARM_DESC(fastreg_support, "Advertise fastreg support (default=1)");
|
||||
|
||||
static int c4iw_modify_port(struct ib_device *ibdev,
|
||||
u8 port, int port_modify_mask,
|
||||
struct ib_port_modify *props)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static struct ib_ah *c4iw_ah_create(struct ib_pd *pd,
|
||||
struct ib_ah_attr *ah_attr)
|
||||
{
|
||||
@@ -456,7 +449,6 @@ int c4iw_register_device(struct c4iw_dev *dev)
|
||||
dev->ibdev.dma_device = &(dev->rdev.lldi.pdev->dev);
|
||||
dev->ibdev.query_device = c4iw_query_device;
|
||||
dev->ibdev.query_port = c4iw_query_port;
|
||||
dev->ibdev.modify_port = c4iw_modify_port;
|
||||
dev->ibdev.query_pkey = c4iw_query_pkey;
|
||||
dev->ibdev.query_gid = c4iw_query_gid;
|
||||
dev->ibdev.alloc_ucontext = c4iw_alloc_ucontext;
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/genalloc.h>
|
||||
#include <linux/ratelimit.h>
|
||||
#include "iw_cxgb4.h"
|
||||
|
||||
#define RANDOM_SIZE 16
|
||||
@@ -311,8 +312,8 @@ u32 c4iw_pblpool_alloc(struct c4iw_rdev *rdev, int size)
|
||||
{
|
||||
unsigned long addr = gen_pool_alloc(rdev->pbl_pool, size);
|
||||
PDBG("%s addr 0x%x size %d\n", __func__, (u32)addr, size);
|
||||
if (!addr && printk_ratelimit())
|
||||
printk(KERN_WARNING MOD "%s: Out of PBL memory\n",
|
||||
if (!addr)
|
||||
printk_ratelimited(KERN_WARNING MOD "%s: Out of PBL memory\n",
|
||||
pci_name(rdev->lldi.pdev));
|
||||
return (u32)addr;
|
||||
}
|
||||
@@ -373,8 +374,8 @@ u32 c4iw_rqtpool_alloc(struct c4iw_rdev *rdev, int size)
|
||||
{
|
||||
unsigned long addr = gen_pool_alloc(rdev->rqt_pool, size << 6);
|
||||
PDBG("%s addr 0x%x size %d\n", __func__, (u32)addr, size << 6);
|
||||
if (!addr && printk_ratelimit())
|
||||
printk(KERN_WARNING MOD "%s: Out of RQT memory\n",
|
||||
if (!addr)
|
||||
printk_ratelimited(KERN_WARNING MOD "%s: Out of RQT memory\n",
|
||||
pci_name(rdev->lldi.pdev));
|
||||
return (u32)addr;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/cpu.h>
|
||||
#include <asm/pgtable.h>
|
||||
|
||||
#include "ipath_kernel.h"
|
||||
@@ -1684,17 +1685,19 @@ static int find_best_unit(struct file *fp,
|
||||
* information. There may be some issues with dual core numbering
|
||||
* as well. This needs more work prior to release.
|
||||
*/
|
||||
if (!cpumask_empty(¤t->cpus_allowed) &&
|
||||
!cpumask_full(¤t->cpus_allowed)) {
|
||||
if (!cpumask_empty(tsk_cpus_allowed(current)) &&
|
||||
!cpumask_full(tsk_cpus_allowed(current))) {
|
||||
int ncpus = num_online_cpus(), curcpu = -1, nset = 0;
|
||||
for (i = 0; i < ncpus; i++)
|
||||
if (cpumask_test_cpu(i, ¤t->cpus_allowed)) {
|
||||
get_online_cpus();
|
||||
for_each_online_cpu(i)
|
||||
if (cpumask_test_cpu(i, tsk_cpus_allowed(current))) {
|
||||
ipath_cdbg(PROC, "%s[%u] affinity set for "
|
||||
"cpu %d/%d\n", current->comm,
|
||||
current->pid, i, ncpus);
|
||||
curcpu = i;
|
||||
nset++;
|
||||
}
|
||||
put_online_cpus();
|
||||
if (curcpu != -1 && nset != ncpus) {
|
||||
if (npresent) {
|
||||
prefunit = curcpu / (ncpus / npresent);
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
*/
|
||||
|
||||
#include <rdma/ib_smi.h>
|
||||
#include <rdma/ib_pma.h>
|
||||
|
||||
#include "ipath_kernel.h"
|
||||
#include "ipath_verbs.h"
|
||||
@@ -789,151 +790,18 @@ static int recv_subn_set_pkeytable(struct ib_smp *smp,
|
||||
return recv_subn_get_pkeytable(smp, ibdev);
|
||||
}
|
||||
|
||||
#define IB_PMA_CLASS_PORT_INFO cpu_to_be16(0x0001)
|
||||
#define IB_PMA_PORT_SAMPLES_CONTROL cpu_to_be16(0x0010)
|
||||
#define IB_PMA_PORT_SAMPLES_RESULT cpu_to_be16(0x0011)
|
||||
#define IB_PMA_PORT_COUNTERS cpu_to_be16(0x0012)
|
||||
#define IB_PMA_PORT_COUNTERS_EXT cpu_to_be16(0x001D)
|
||||
#define IB_PMA_PORT_SAMPLES_RESULT_EXT cpu_to_be16(0x001E)
|
||||
|
||||
struct ib_perf {
|
||||
u8 base_version;
|
||||
u8 mgmt_class;
|
||||
u8 class_version;
|
||||
u8 method;
|
||||
__be16 status;
|
||||
__be16 unused;
|
||||
__be64 tid;
|
||||
__be16 attr_id;
|
||||
__be16 resv;
|
||||
__be32 attr_mod;
|
||||
u8 reserved[40];
|
||||
u8 data[192];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ib_pma_classportinfo {
|
||||
u8 base_version;
|
||||
u8 class_version;
|
||||
__be16 cap_mask;
|
||||
u8 reserved[3];
|
||||
u8 resp_time_value; /* only lower 5 bits */
|
||||
union ib_gid redirect_gid;
|
||||
__be32 redirect_tc_sl_fl; /* 8, 4, 20 bits respectively */
|
||||
__be16 redirect_lid;
|
||||
__be16 redirect_pkey;
|
||||
__be32 redirect_qp; /* only lower 24 bits */
|
||||
__be32 redirect_qkey;
|
||||
union ib_gid trap_gid;
|
||||
__be32 trap_tc_sl_fl; /* 8, 4, 20 bits respectively */
|
||||
__be16 trap_lid;
|
||||
__be16 trap_pkey;
|
||||
__be32 trap_hl_qp; /* 8, 24 bits respectively */
|
||||
__be32 trap_qkey;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ib_pma_portsamplescontrol {
|
||||
u8 opcode;
|
||||
u8 port_select;
|
||||
u8 tick;
|
||||
u8 counter_width; /* only lower 3 bits */
|
||||
__be32 counter_mask0_9; /* 2, 10 * 3, bits */
|
||||
__be16 counter_mask10_14; /* 1, 5 * 3, bits */
|
||||
u8 sample_mechanisms;
|
||||
u8 sample_status; /* only lower 2 bits */
|
||||
__be64 option_mask;
|
||||
__be64 vendor_mask;
|
||||
__be32 sample_start;
|
||||
__be32 sample_interval;
|
||||
__be16 tag;
|
||||
__be16 counter_select[15];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ib_pma_portsamplesresult {
|
||||
__be16 tag;
|
||||
__be16 sample_status; /* only lower 2 bits */
|
||||
__be32 counter[15];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ib_pma_portsamplesresult_ext {
|
||||
__be16 tag;
|
||||
__be16 sample_status; /* only lower 2 bits */
|
||||
__be32 extended_width; /* only upper 2 bits */
|
||||
__be64 counter[15];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ib_pma_portcounters {
|
||||
u8 reserved;
|
||||
u8 port_select;
|
||||
__be16 counter_select;
|
||||
__be16 symbol_error_counter;
|
||||
u8 link_error_recovery_counter;
|
||||
u8 link_downed_counter;
|
||||
__be16 port_rcv_errors;
|
||||
__be16 port_rcv_remphys_errors;
|
||||
__be16 port_rcv_switch_relay_errors;
|
||||
__be16 port_xmit_discards;
|
||||
u8 port_xmit_constraint_errors;
|
||||
u8 port_rcv_constraint_errors;
|
||||
u8 reserved1;
|
||||
u8 lli_ebor_errors; /* 4, 4, bits */
|
||||
__be16 reserved2;
|
||||
__be16 vl15_dropped;
|
||||
__be32 port_xmit_data;
|
||||
__be32 port_rcv_data;
|
||||
__be32 port_xmit_packets;
|
||||
__be32 port_rcv_packets;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define IB_PMA_SEL_SYMBOL_ERROR cpu_to_be16(0x0001)
|
||||
#define IB_PMA_SEL_LINK_ERROR_RECOVERY cpu_to_be16(0x0002)
|
||||
#define IB_PMA_SEL_LINK_DOWNED cpu_to_be16(0x0004)
|
||||
#define IB_PMA_SEL_PORT_RCV_ERRORS cpu_to_be16(0x0008)
|
||||
#define IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS cpu_to_be16(0x0010)
|
||||
#define IB_PMA_SEL_PORT_XMIT_DISCARDS cpu_to_be16(0x0040)
|
||||
#define IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS cpu_to_be16(0x0200)
|
||||
#define IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS cpu_to_be16(0x0400)
|
||||
#define IB_PMA_SEL_PORT_VL15_DROPPED cpu_to_be16(0x0800)
|
||||
#define IB_PMA_SEL_PORT_XMIT_DATA cpu_to_be16(0x1000)
|
||||
#define IB_PMA_SEL_PORT_RCV_DATA cpu_to_be16(0x2000)
|
||||
#define IB_PMA_SEL_PORT_XMIT_PACKETS cpu_to_be16(0x4000)
|
||||
#define IB_PMA_SEL_PORT_RCV_PACKETS cpu_to_be16(0x8000)
|
||||
|
||||
struct ib_pma_portcounters_ext {
|
||||
u8 reserved;
|
||||
u8 port_select;
|
||||
__be16 counter_select;
|
||||
__be32 reserved1;
|
||||
__be64 port_xmit_data;
|
||||
__be64 port_rcv_data;
|
||||
__be64 port_xmit_packets;
|
||||
__be64 port_rcv_packets;
|
||||
__be64 port_unicast_xmit_packets;
|
||||
__be64 port_unicast_rcv_packets;
|
||||
__be64 port_multicast_xmit_packets;
|
||||
__be64 port_multicast_rcv_packets;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define IB_PMA_SELX_PORT_XMIT_DATA cpu_to_be16(0x0001)
|
||||
#define IB_PMA_SELX_PORT_RCV_DATA cpu_to_be16(0x0002)
|
||||
#define IB_PMA_SELX_PORT_XMIT_PACKETS cpu_to_be16(0x0004)
|
||||
#define IB_PMA_SELX_PORT_RCV_PACKETS cpu_to_be16(0x0008)
|
||||
#define IB_PMA_SELX_PORT_UNI_XMIT_PACKETS cpu_to_be16(0x0010)
|
||||
#define IB_PMA_SELX_PORT_UNI_RCV_PACKETS cpu_to_be16(0x0020)
|
||||
#define IB_PMA_SELX_PORT_MULTI_XMIT_PACKETS cpu_to_be16(0x0040)
|
||||
#define IB_PMA_SELX_PORT_MULTI_RCV_PACKETS cpu_to_be16(0x0080)
|
||||
|
||||
static int recv_pma_get_classportinfo(struct ib_perf *pmp)
|
||||
static int recv_pma_get_classportinfo(struct ib_pma_mad *pmp)
|
||||
{
|
||||
struct ib_pma_classportinfo *p =
|
||||
(struct ib_pma_classportinfo *)pmp->data;
|
||||
struct ib_class_port_info *p =
|
||||
(struct ib_class_port_info *)pmp->data;
|
||||
|
||||
memset(pmp->data, 0, sizeof(pmp->data));
|
||||
|
||||
if (pmp->attr_mod != 0)
|
||||
pmp->status |= IB_SMP_INVALID_FIELD;
|
||||
if (pmp->mad_hdr.attr_mod != 0)
|
||||
pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD;
|
||||
|
||||
/* Indicate AllPortSelect is valid (only one port anyway) */
|
||||
p->cap_mask = cpu_to_be16(1 << 8);
|
||||
p->capability_mask = cpu_to_be16(1 << 8);
|
||||
p->base_version = 1;
|
||||
p->class_version = 1;
|
||||
/*
|
||||
@@ -957,7 +825,7 @@ static int recv_pma_get_classportinfo(struct ib_perf *pmp)
|
||||
COUNTER_MASK(1, 3) | \
|
||||
COUNTER_MASK(1, 4))
|
||||
|
||||
static int recv_pma_get_portsamplescontrol(struct ib_perf *pmp,
|
||||
static int recv_pma_get_portsamplescontrol(struct ib_pma_mad *pmp,
|
||||
struct ib_device *ibdev, u8 port)
|
||||
{
|
||||
struct ib_pma_portsamplescontrol *p =
|
||||
@@ -970,9 +838,9 @@ static int recv_pma_get_portsamplescontrol(struct ib_perf *pmp,
|
||||
memset(pmp->data, 0, sizeof(pmp->data));
|
||||
|
||||
p->port_select = port_select;
|
||||
if (pmp->attr_mod != 0 ||
|
||||
if (pmp->mad_hdr.attr_mod != 0 ||
|
||||
(port_select != port && port_select != 0xFF))
|
||||
pmp->status |= IB_SMP_INVALID_FIELD;
|
||||
pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD;
|
||||
/*
|
||||
* Ticks are 10x the link transfer period which for 2.5Gbs is 4
|
||||
* nsec. 0 == 4 nsec., 1 == 8 nsec., ..., 255 == 1020 nsec. Sample
|
||||
@@ -1006,7 +874,7 @@ static int recv_pma_get_portsamplescontrol(struct ib_perf *pmp,
|
||||
return reply((struct ib_smp *) pmp);
|
||||
}
|
||||
|
||||
static int recv_pma_set_portsamplescontrol(struct ib_perf *pmp,
|
||||
static int recv_pma_set_portsamplescontrol(struct ib_pma_mad *pmp,
|
||||
struct ib_device *ibdev, u8 port)
|
||||
{
|
||||
struct ib_pma_portsamplescontrol *p =
|
||||
@@ -1017,9 +885,9 @@ static int recv_pma_set_portsamplescontrol(struct ib_perf *pmp,
|
||||
u8 status;
|
||||
int ret;
|
||||
|
||||
if (pmp->attr_mod != 0 ||
|
||||
if (pmp->mad_hdr.attr_mod != 0 ||
|
||||
(p->port_select != port && p->port_select != 0xFF)) {
|
||||
pmp->status |= IB_SMP_INVALID_FIELD;
|
||||
pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD;
|
||||
ret = reply((struct ib_smp *) pmp);
|
||||
goto bail;
|
||||
}
|
||||
@@ -1093,7 +961,7 @@ static u64 get_counter(struct ipath_ibdev *dev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int recv_pma_get_portsamplesresult(struct ib_perf *pmp,
|
||||
static int recv_pma_get_portsamplesresult(struct ib_pma_mad *pmp,
|
||||
struct ib_device *ibdev)
|
||||
{
|
||||
struct ib_pma_portsamplesresult *p =
|
||||
@@ -1118,7 +986,7 @@ static int recv_pma_get_portsamplesresult(struct ib_perf *pmp,
|
||||
return reply((struct ib_smp *) pmp);
|
||||
}
|
||||
|
||||
static int recv_pma_get_portsamplesresult_ext(struct ib_perf *pmp,
|
||||
static int recv_pma_get_portsamplesresult_ext(struct ib_pma_mad *pmp,
|
||||
struct ib_device *ibdev)
|
||||
{
|
||||
struct ib_pma_portsamplesresult_ext *p =
|
||||
@@ -1145,7 +1013,7 @@ static int recv_pma_get_portsamplesresult_ext(struct ib_perf *pmp,
|
||||
return reply((struct ib_smp *) pmp);
|
||||
}
|
||||
|
||||
static int recv_pma_get_portcounters(struct ib_perf *pmp,
|
||||
static int recv_pma_get_portcounters(struct ib_pma_mad *pmp,
|
||||
struct ib_device *ibdev, u8 port)
|
||||
{
|
||||
struct ib_pma_portcounters *p = (struct ib_pma_portcounters *)
|
||||
@@ -1179,9 +1047,9 @@ static int recv_pma_get_portcounters(struct ib_perf *pmp,
|
||||
memset(pmp->data, 0, sizeof(pmp->data));
|
||||
|
||||
p->port_select = port_select;
|
||||
if (pmp->attr_mod != 0 ||
|
||||
if (pmp->mad_hdr.attr_mod != 0 ||
|
||||
(port_select != port && port_select != 0xFF))
|
||||
pmp->status |= IB_SMP_INVALID_FIELD;
|
||||
pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD;
|
||||
|
||||
if (cntrs.symbol_error_counter > 0xFFFFUL)
|
||||
p->symbol_error_counter = cpu_to_be16(0xFFFF);
|
||||
@@ -1216,7 +1084,7 @@ static int recv_pma_get_portcounters(struct ib_perf *pmp,
|
||||
cntrs.local_link_integrity_errors = 0xFUL;
|
||||
if (cntrs.excessive_buffer_overrun_errors > 0xFUL)
|
||||
cntrs.excessive_buffer_overrun_errors = 0xFUL;
|
||||
p->lli_ebor_errors = (cntrs.local_link_integrity_errors << 4) |
|
||||
p->link_overrun_errors = (cntrs.local_link_integrity_errors << 4) |
|
||||
cntrs.excessive_buffer_overrun_errors;
|
||||
if (cntrs.vl15_dropped > 0xFFFFUL)
|
||||
p->vl15_dropped = cpu_to_be16(0xFFFF);
|
||||
@@ -1244,7 +1112,7 @@ static int recv_pma_get_portcounters(struct ib_perf *pmp,
|
||||
return reply((struct ib_smp *) pmp);
|
||||
}
|
||||
|
||||
static int recv_pma_get_portcounters_ext(struct ib_perf *pmp,
|
||||
static int recv_pma_get_portcounters_ext(struct ib_pma_mad *pmp,
|
||||
struct ib_device *ibdev, u8 port)
|
||||
{
|
||||
struct ib_pma_portcounters_ext *p =
|
||||
@@ -1265,9 +1133,9 @@ static int recv_pma_get_portcounters_ext(struct ib_perf *pmp,
|
||||
memset(pmp->data, 0, sizeof(pmp->data));
|
||||
|
||||
p->port_select = port_select;
|
||||
if (pmp->attr_mod != 0 ||
|
||||
if (pmp->mad_hdr.attr_mod != 0 ||
|
||||
(port_select != port && port_select != 0xFF))
|
||||
pmp->status |= IB_SMP_INVALID_FIELD;
|
||||
pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD;
|
||||
|
||||
p->port_xmit_data = cpu_to_be64(swords);
|
||||
p->port_rcv_data = cpu_to_be64(rwords);
|
||||
@@ -1281,7 +1149,7 @@ static int recv_pma_get_portcounters_ext(struct ib_perf *pmp,
|
||||
return reply((struct ib_smp *) pmp);
|
||||
}
|
||||
|
||||
static int recv_pma_set_portcounters(struct ib_perf *pmp,
|
||||
static int recv_pma_set_portcounters(struct ib_pma_mad *pmp,
|
||||
struct ib_device *ibdev, u8 port)
|
||||
{
|
||||
struct ib_pma_portcounters *p = (struct ib_pma_portcounters *)
|
||||
@@ -1344,7 +1212,7 @@ static int recv_pma_set_portcounters(struct ib_perf *pmp,
|
||||
return recv_pma_get_portcounters(pmp, ibdev, port);
|
||||
}
|
||||
|
||||
static int recv_pma_set_portcounters_ext(struct ib_perf *pmp,
|
||||
static int recv_pma_set_portcounters_ext(struct ib_pma_mad *pmp,
|
||||
struct ib_device *ibdev, u8 port)
|
||||
{
|
||||
struct ib_pma_portcounters *p = (struct ib_pma_portcounters *)
|
||||
@@ -1518,19 +1386,19 @@ static int process_perf(struct ib_device *ibdev, u8 port_num,
|
||||
struct ib_mad *in_mad,
|
||||
struct ib_mad *out_mad)
|
||||
{
|
||||
struct ib_perf *pmp = (struct ib_perf *)out_mad;
|
||||
struct ib_pma_mad *pmp = (struct ib_pma_mad *)out_mad;
|
||||
int ret;
|
||||
|
||||
*out_mad = *in_mad;
|
||||
if (pmp->class_version != 1) {
|
||||
pmp->status |= IB_SMP_UNSUP_VERSION;
|
||||
if (pmp->mad_hdr.class_version != 1) {
|
||||
pmp->mad_hdr.status |= IB_SMP_UNSUP_VERSION;
|
||||
ret = reply((struct ib_smp *) pmp);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
switch (pmp->method) {
|
||||
switch (pmp->mad_hdr.method) {
|
||||
case IB_MGMT_METHOD_GET:
|
||||
switch (pmp->attr_id) {
|
||||
switch (pmp->mad_hdr.attr_id) {
|
||||
case IB_PMA_CLASS_PORT_INFO:
|
||||
ret = recv_pma_get_classportinfo(pmp);
|
||||
goto bail;
|
||||
@@ -1554,13 +1422,13 @@ static int process_perf(struct ib_device *ibdev, u8 port_num,
|
||||
port_num);
|
||||
goto bail;
|
||||
default:
|
||||
pmp->status |= IB_SMP_UNSUP_METH_ATTR;
|
||||
pmp->mad_hdr.status |= IB_SMP_UNSUP_METH_ATTR;
|
||||
ret = reply((struct ib_smp *) pmp);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
case IB_MGMT_METHOD_SET:
|
||||
switch (pmp->attr_id) {
|
||||
switch (pmp->mad_hdr.attr_id) {
|
||||
case IB_PMA_PORT_SAMPLES_CONTROL:
|
||||
ret = recv_pma_set_portsamplescontrol(pmp, ibdev,
|
||||
port_num);
|
||||
@@ -1574,7 +1442,7 @@ static int process_perf(struct ib_device *ibdev, u8 port_num,
|
||||
port_num);
|
||||
goto bail;
|
||||
default:
|
||||
pmp->status |= IB_SMP_UNSUP_METH_ATTR;
|
||||
pmp->mad_hdr.status |= IB_SMP_UNSUP_METH_ATTR;
|
||||
ret = reply((struct ib_smp *) pmp);
|
||||
goto bail;
|
||||
}
|
||||
@@ -1588,7 +1456,7 @@ static int process_perf(struct ib_device *ibdev, u8 port_num,
|
||||
ret = IB_MAD_RESULT_SUCCESS;
|
||||
goto bail;
|
||||
default:
|
||||
pmp->status |= IB_SMP_UNSUP_METHOD;
|
||||
pmp->mad_hdr.status |= IB_SMP_UNSUP_METHOD;
|
||||
ret = reply((struct ib_smp *) pmp);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include <linux/mlx4/cmd.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <rdma/ib_pma.h>
|
||||
|
||||
#include "mlx4_ib.h"
|
||||
|
||||
@@ -232,7 +233,7 @@ static void forward_trap(struct mlx4_ib_dev *dev, u8 port_num, struct ib_mad *ma
|
||||
}
|
||||
}
|
||||
|
||||
int mlx4_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
|
||||
static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
|
||||
struct ib_wc *in_wc, struct ib_grh *in_grh,
|
||||
struct ib_mad *in_mad, struct ib_mad *out_mad)
|
||||
{
|
||||
@@ -302,6 +303,71 @@ int mlx4_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
|
||||
return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY;
|
||||
}
|
||||
|
||||
static void edit_counter(struct mlx4_counter *cnt,
|
||||
struct ib_pma_portcounters *pma_cnt)
|
||||
{
|
||||
pma_cnt->port_xmit_data = cpu_to_be32((be64_to_cpu(cnt->tx_bytes)>>2));
|
||||
pma_cnt->port_rcv_data = cpu_to_be32((be64_to_cpu(cnt->rx_bytes)>>2));
|
||||
pma_cnt->port_xmit_packets = cpu_to_be32(be64_to_cpu(cnt->tx_frames));
|
||||
pma_cnt->port_rcv_packets = cpu_to_be32(be64_to_cpu(cnt->rx_frames));
|
||||
}
|
||||
|
||||
static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
|
||||
struct ib_wc *in_wc, struct ib_grh *in_grh,
|
||||
struct ib_mad *in_mad, struct ib_mad *out_mad)
|
||||
{
|
||||
struct mlx4_cmd_mailbox *mailbox;
|
||||
struct mlx4_ib_dev *dev = to_mdev(ibdev);
|
||||
int err;
|
||||
u32 inmod = dev->counters[port_num - 1] & 0xffff;
|
||||
u8 mode;
|
||||
|
||||
if (in_mad->mad_hdr.mgmt_class != IB_MGMT_CLASS_PERF_MGMT)
|
||||
return -EINVAL;
|
||||
|
||||
mailbox = mlx4_alloc_cmd_mailbox(dev->dev);
|
||||
if (IS_ERR(mailbox))
|
||||
return IB_MAD_RESULT_FAILURE;
|
||||
|
||||
err = mlx4_cmd_box(dev->dev, 0, mailbox->dma, inmod, 0,
|
||||
MLX4_CMD_QUERY_IF_STAT, MLX4_CMD_TIME_CLASS_C);
|
||||
if (err)
|
||||
err = IB_MAD_RESULT_FAILURE;
|
||||
else {
|
||||
memset(out_mad->data, 0, sizeof out_mad->data);
|
||||
mode = ((struct mlx4_counter *)mailbox->buf)->counter_mode;
|
||||
switch (mode & 0xf) {
|
||||
case 0:
|
||||
edit_counter(mailbox->buf,
|
||||
(void *)(out_mad->data + 40));
|
||||
err = IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY;
|
||||
break;
|
||||
default:
|
||||
err = IB_MAD_RESULT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
mlx4_free_cmd_mailbox(dev->dev, mailbox);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int mlx4_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
|
||||
struct ib_wc *in_wc, struct ib_grh *in_grh,
|
||||
struct ib_mad *in_mad, struct ib_mad *out_mad)
|
||||
{
|
||||
switch (rdma_port_get_link_layer(ibdev, port_num)) {
|
||||
case IB_LINK_LAYER_INFINIBAND:
|
||||
return ib_process_mad(ibdev, mad_flags, port_num, in_wc,
|
||||
in_grh, in_mad, out_mad);
|
||||
case IB_LINK_LAYER_ETHERNET:
|
||||
return iboe_process_mad(ibdev, mad_flags, port_num, in_wc,
|
||||
in_grh, in_mad, out_mad);
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
static void send_handler(struct ib_mad_agent *agent,
|
||||
struct ib_mad_send_wc *mad_send_wc)
|
||||
{
|
||||
|
||||
@@ -816,7 +816,7 @@ static void update_gids_task(struct work_struct *work)
|
||||
memcpy(gw->dev->iboe.gid_table[gw->port - 1], gw->gids, sizeof gw->gids);
|
||||
event.device = &gw->dev->ib_dev;
|
||||
event.element.port_num = gw->port;
|
||||
event.event = IB_EVENT_LID_CHANGE;
|
||||
event.event = IB_EVENT_GID_CHANGE;
|
||||
ib_dispatch_event(&event);
|
||||
}
|
||||
|
||||
@@ -1098,11 +1098,21 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
|
||||
if (init_node_data(ibdev))
|
||||
goto err_map;
|
||||
|
||||
for (i = 0; i < ibdev->num_ports; ++i) {
|
||||
if (mlx4_ib_port_link_layer(&ibdev->ib_dev, i + 1) ==
|
||||
IB_LINK_LAYER_ETHERNET) {
|
||||
err = mlx4_counter_alloc(ibdev->dev, &ibdev->counters[i]);
|
||||
if (err)
|
||||
ibdev->counters[i] = -1;
|
||||
} else
|
||||
ibdev->counters[i] = -1;
|
||||
}
|
||||
|
||||
spin_lock_init(&ibdev->sm_lock);
|
||||
mutex_init(&ibdev->cap_mask_mutex);
|
||||
|
||||
if (ib_register_device(&ibdev->ib_dev, NULL))
|
||||
goto err_map;
|
||||
goto err_counter;
|
||||
|
||||
if (mlx4_ib_mad_init(ibdev))
|
||||
goto err_reg;
|
||||
@@ -1132,6 +1142,10 @@ err_notif:
|
||||
err_reg:
|
||||
ib_unregister_device(&ibdev->ib_dev);
|
||||
|
||||
err_counter:
|
||||
for (; i; --i)
|
||||
mlx4_counter_free(ibdev->dev, ibdev->counters[i - 1]);
|
||||
|
||||
err_map:
|
||||
iounmap(ibdev->uar_map);
|
||||
|
||||
@@ -1160,7 +1174,8 @@ static void mlx4_ib_remove(struct mlx4_dev *dev, void *ibdev_ptr)
|
||||
ibdev->iboe.nb.notifier_call = NULL;
|
||||
}
|
||||
iounmap(ibdev->uar_map);
|
||||
|
||||
for (p = 0; p < ibdev->num_ports; ++p)
|
||||
mlx4_counter_free(ibdev->dev, ibdev->counters[p]);
|
||||
mlx4_foreach_port(p, dev, MLX4_PORT_TYPE_IB)
|
||||
mlx4_CLOSE_PORT(dev, p);
|
||||
|
||||
|
||||
@@ -193,6 +193,7 @@ struct mlx4_ib_dev {
|
||||
struct mutex cap_mask_mutex;
|
||||
bool ib_active;
|
||||
struct mlx4_ib_iboe iboe;
|
||||
int counters[MLX4_MAX_PORTS];
|
||||
};
|
||||
|
||||
static inline struct mlx4_ib_dev *to_mdev(struct ib_device *ibdev)
|
||||
|
||||
@@ -893,7 +893,6 @@ static int mlx4_set_path(struct mlx4_ib_dev *dev, const struct ib_ah_attr *ah,
|
||||
--path->static_rate;
|
||||
} else
|
||||
path->static_rate = 0;
|
||||
path->counter_index = 0xff;
|
||||
|
||||
if (ah->ah_flags & IB_AH_GRH) {
|
||||
if (ah->grh.sgid_index >= dev->dev->caps.gid_table_len[port]) {
|
||||
@@ -1034,6 +1033,15 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
|
||||
}
|
||||
}
|
||||
|
||||
if (cur_state == IB_QPS_INIT && new_state == IB_QPS_RTR) {
|
||||
if (dev->counters[qp->port - 1] != -1) {
|
||||
context->pri_path.counter_index =
|
||||
dev->counters[qp->port - 1];
|
||||
optpar |= MLX4_QP_OPTPAR_COUNTER_INDEX;
|
||||
} else
|
||||
context->pri_path.counter_index = 0xff;
|
||||
}
|
||||
|
||||
if (attr_mask & IB_QP_PKEY_INDEX) {
|
||||
context->pri_path.pkey_index = attr->pkey_index;
|
||||
optpar |= MLX4_QP_OPTPAR_PKEY_INDEX;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -252,79 +252,74 @@ struct mthca_mailbox *mthca_alloc_mailbox(struct mthca_dev *dev,
|
||||
gfp_t gfp_mask);
|
||||
void mthca_free_mailbox(struct mthca_dev *dev, struct mthca_mailbox *mailbox);
|
||||
|
||||
int mthca_SYS_EN(struct mthca_dev *dev, u8 *status);
|
||||
int mthca_SYS_DIS(struct mthca_dev *dev, u8 *status);
|
||||
int mthca_MAP_FA(struct mthca_dev *dev, struct mthca_icm *icm, u8 *status);
|
||||
int mthca_UNMAP_FA(struct mthca_dev *dev, u8 *status);
|
||||
int mthca_RUN_FW(struct mthca_dev *dev, u8 *status);
|
||||
int mthca_QUERY_FW(struct mthca_dev *dev, u8 *status);
|
||||
int mthca_ENABLE_LAM(struct mthca_dev *dev, u8 *status);
|
||||
int mthca_DISABLE_LAM(struct mthca_dev *dev, u8 *status);
|
||||
int mthca_QUERY_DDR(struct mthca_dev *dev, u8 *status);
|
||||
int mthca_SYS_EN(struct mthca_dev *dev);
|
||||
int mthca_SYS_DIS(struct mthca_dev *dev);
|
||||
int mthca_MAP_FA(struct mthca_dev *dev, struct mthca_icm *icm);
|
||||
int mthca_UNMAP_FA(struct mthca_dev *dev);
|
||||
int mthca_RUN_FW(struct mthca_dev *dev);
|
||||
int mthca_QUERY_FW(struct mthca_dev *dev);
|
||||
int mthca_ENABLE_LAM(struct mthca_dev *dev);
|
||||
int mthca_DISABLE_LAM(struct mthca_dev *dev);
|
||||
int mthca_QUERY_DDR(struct mthca_dev *dev);
|
||||
int mthca_QUERY_DEV_LIM(struct mthca_dev *dev,
|
||||
struct mthca_dev_lim *dev_lim, u8 *status);
|
||||
struct mthca_dev_lim *dev_lim);
|
||||
int mthca_QUERY_ADAPTER(struct mthca_dev *dev,
|
||||
struct mthca_adapter *adapter, u8 *status);
|
||||
struct mthca_adapter *adapter);
|
||||
int mthca_INIT_HCA(struct mthca_dev *dev,
|
||||
struct mthca_init_hca_param *param,
|
||||
u8 *status);
|
||||
struct mthca_init_hca_param *param);
|
||||
int mthca_INIT_IB(struct mthca_dev *dev,
|
||||
struct mthca_init_ib_param *param,
|
||||
int port, u8 *status);
|
||||
int mthca_CLOSE_IB(struct mthca_dev *dev, int port, u8 *status);
|
||||
int mthca_CLOSE_HCA(struct mthca_dev *dev, int panic, u8 *status);
|
||||
int port);
|
||||
int mthca_CLOSE_IB(struct mthca_dev *dev, int port);
|
||||
int mthca_CLOSE_HCA(struct mthca_dev *dev, int panic);
|
||||
int mthca_SET_IB(struct mthca_dev *dev, struct mthca_set_ib_param *param,
|
||||
int port, u8 *status);
|
||||
int mthca_MAP_ICM(struct mthca_dev *dev, struct mthca_icm *icm, u64 virt, u8 *status);
|
||||
int mthca_MAP_ICM_page(struct mthca_dev *dev, u64 dma_addr, u64 virt, u8 *status);
|
||||
int mthca_UNMAP_ICM(struct mthca_dev *dev, u64 virt, u32 page_count, u8 *status);
|
||||
int mthca_MAP_ICM_AUX(struct mthca_dev *dev, struct mthca_icm *icm, u8 *status);
|
||||
int mthca_UNMAP_ICM_AUX(struct mthca_dev *dev, u8 *status);
|
||||
int mthca_SET_ICM_SIZE(struct mthca_dev *dev, u64 icm_size, u64 *aux_pages,
|
||||
u8 *status);
|
||||
int port);
|
||||
int mthca_MAP_ICM(struct mthca_dev *dev, struct mthca_icm *icm, u64 virt);
|
||||
int mthca_MAP_ICM_page(struct mthca_dev *dev, u64 dma_addr, u64 virt);
|
||||
int mthca_UNMAP_ICM(struct mthca_dev *dev, u64 virt, u32 page_count);
|
||||
int mthca_MAP_ICM_AUX(struct mthca_dev *dev, struct mthca_icm *icm);
|
||||
int mthca_UNMAP_ICM_AUX(struct mthca_dev *dev);
|
||||
int mthca_SET_ICM_SIZE(struct mthca_dev *dev, u64 icm_size, u64 *aux_pages);
|
||||
int mthca_SW2HW_MPT(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
|
||||
int mpt_index, u8 *status);
|
||||
int mpt_index);
|
||||
int mthca_HW2SW_MPT(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
|
||||
int mpt_index, u8 *status);
|
||||
int mpt_index);
|
||||
int mthca_WRITE_MTT(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
|
||||
int num_mtt, u8 *status);
|
||||
int mthca_SYNC_TPT(struct mthca_dev *dev, u8 *status);
|
||||
int num_mtt);
|
||||
int mthca_SYNC_TPT(struct mthca_dev *dev);
|
||||
int mthca_MAP_EQ(struct mthca_dev *dev, u64 event_mask, int unmap,
|
||||
int eq_num, u8 *status);
|
||||
int eq_num);
|
||||
int mthca_SW2HW_EQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
|
||||
int eq_num, u8 *status);
|
||||
int eq_num);
|
||||
int mthca_HW2SW_EQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
|
||||
int eq_num, u8 *status);
|
||||
int eq_num);
|
||||
int mthca_SW2HW_CQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
|
||||
int cq_num, u8 *status);
|
||||
int cq_num);
|
||||
int mthca_HW2SW_CQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
|
||||
int cq_num, u8 *status);
|
||||
int mthca_RESIZE_CQ(struct mthca_dev *dev, int cq_num, u32 lkey, u8 log_size,
|
||||
u8 *status);
|
||||
int cq_num);
|
||||
int mthca_RESIZE_CQ(struct mthca_dev *dev, int cq_num, u32 lkey, u8 log_size);
|
||||
int mthca_SW2HW_SRQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
|
||||
int srq_num, u8 *status);
|
||||
int srq_num);
|
||||
int mthca_HW2SW_SRQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
|
||||
int srq_num, u8 *status);
|
||||
int srq_num);
|
||||
int mthca_QUERY_SRQ(struct mthca_dev *dev, u32 num,
|
||||
struct mthca_mailbox *mailbox, u8 *status);
|
||||
int mthca_ARM_SRQ(struct mthca_dev *dev, int srq_num, int limit, u8 *status);
|
||||
struct mthca_mailbox *mailbox);
|
||||
int mthca_ARM_SRQ(struct mthca_dev *dev, int srq_num, int limit);
|
||||
int mthca_MODIFY_QP(struct mthca_dev *dev, enum ib_qp_state cur,
|
||||
enum ib_qp_state next, u32 num, int is_ee,
|
||||
struct mthca_mailbox *mailbox, u32 optmask,
|
||||
u8 *status);
|
||||
struct mthca_mailbox *mailbox, u32 optmask);
|
||||
int mthca_QUERY_QP(struct mthca_dev *dev, u32 num, int is_ee,
|
||||
struct mthca_mailbox *mailbox, u8 *status);
|
||||
int mthca_CONF_SPECIAL_QP(struct mthca_dev *dev, int type, u32 qpn,
|
||||
u8 *status);
|
||||
struct mthca_mailbox *mailbox);
|
||||
int mthca_CONF_SPECIAL_QP(struct mthca_dev *dev, int type, u32 qpn);
|
||||
int mthca_MAD_IFC(struct mthca_dev *dev, int ignore_mkey, int ignore_bkey,
|
||||
int port, struct ib_wc *in_wc, struct ib_grh *in_grh,
|
||||
void *in_mad, void *response_mad, u8 *status);
|
||||
void *in_mad, void *response_mad);
|
||||
int mthca_READ_MGM(struct mthca_dev *dev, int index,
|
||||
struct mthca_mailbox *mailbox, u8 *status);
|
||||
struct mthca_mailbox *mailbox);
|
||||
int mthca_WRITE_MGM(struct mthca_dev *dev, int index,
|
||||
struct mthca_mailbox *mailbox, u8 *status);
|
||||
struct mthca_mailbox *mailbox);
|
||||
int mthca_MGID_HASH(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
|
||||
u16 *hash, u8 *status);
|
||||
int mthca_NOP(struct mthca_dev *dev, u8 *status);
|
||||
u16 *hash);
|
||||
int mthca_NOP(struct mthca_dev *dev);
|
||||
|
||||
#endif /* MTHCA_CMD_H */
|
||||
|
||||
@@ -779,7 +779,6 @@ int mthca_init_cq(struct mthca_dev *dev, int nent,
|
||||
struct mthca_mailbox *mailbox;
|
||||
struct mthca_cq_context *cq_context;
|
||||
int err = -ENOMEM;
|
||||
u8 status;
|
||||
|
||||
cq->ibcq.cqe = nent - 1;
|
||||
cq->is_kernel = !ctx;
|
||||
@@ -847,19 +846,12 @@ int mthca_init_cq(struct mthca_dev *dev, int nent,
|
||||
cq_context->state_db = cpu_to_be32(cq->arm_db_index);
|
||||
}
|
||||
|
||||
err = mthca_SW2HW_CQ(dev, mailbox, cq->cqn, &status);
|
||||
err = mthca_SW2HW_CQ(dev, mailbox, cq->cqn);
|
||||
if (err) {
|
||||
mthca_warn(dev, "SW2HW_CQ failed (%d)\n", err);
|
||||
goto err_out_free_mr;
|
||||
}
|
||||
|
||||
if (status) {
|
||||
mthca_warn(dev, "SW2HW_CQ returned status 0x%02x\n",
|
||||
status);
|
||||
err = -EINVAL;
|
||||
goto err_out_free_mr;
|
||||
}
|
||||
|
||||
spin_lock_irq(&dev->cq_table.lock);
|
||||
if (mthca_array_set(&dev->cq_table.cq,
|
||||
cq->cqn & (dev->limits.num_cqs - 1),
|
||||
@@ -915,7 +907,6 @@ void mthca_free_cq(struct mthca_dev *dev,
|
||||
{
|
||||
struct mthca_mailbox *mailbox;
|
||||
int err;
|
||||
u8 status;
|
||||
|
||||
mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
|
||||
if (IS_ERR(mailbox)) {
|
||||
@@ -923,11 +914,9 @@ void mthca_free_cq(struct mthca_dev *dev,
|
||||
return;
|
||||
}
|
||||
|
||||
err = mthca_HW2SW_CQ(dev, mailbox, cq->cqn, &status);
|
||||
err = mthca_HW2SW_CQ(dev, mailbox, cq->cqn);
|
||||
if (err)
|
||||
mthca_warn(dev, "HW2SW_CQ failed (%d)\n", err);
|
||||
else if (status)
|
||||
mthca_warn(dev, "HW2SW_CQ returned status 0x%02x\n", status);
|
||||
|
||||
if (0) {
|
||||
__be32 *ctx = mailbox->buf;
|
||||
|
||||
@@ -474,7 +474,6 @@ static int mthca_create_eq(struct mthca_dev *dev,
|
||||
struct mthca_eq_context *eq_context;
|
||||
int err = -ENOMEM;
|
||||
int i;
|
||||
u8 status;
|
||||
|
||||
eq->dev = dev;
|
||||
eq->nent = roundup_pow_of_two(max(nent, 2));
|
||||
@@ -543,15 +542,9 @@ static int mthca_create_eq(struct mthca_dev *dev,
|
||||
eq_context->intr = intr;
|
||||
eq_context->lkey = cpu_to_be32(eq->mr.ibmr.lkey);
|
||||
|
||||
err = mthca_SW2HW_EQ(dev, mailbox, eq->eqn, &status);
|
||||
err = mthca_SW2HW_EQ(dev, mailbox, eq->eqn);
|
||||
if (err) {
|
||||
mthca_warn(dev, "SW2HW_EQ failed (%d)\n", err);
|
||||
goto err_out_free_mr;
|
||||
}
|
||||
if (status) {
|
||||
mthca_warn(dev, "SW2HW_EQ returned status 0x%02x\n",
|
||||
status);
|
||||
err = -EINVAL;
|
||||
mthca_warn(dev, "SW2HW_EQ returned %d\n", err);
|
||||
goto err_out_free_mr;
|
||||
}
|
||||
|
||||
@@ -597,7 +590,6 @@ static void mthca_free_eq(struct mthca_dev *dev,
|
||||
{
|
||||
struct mthca_mailbox *mailbox;
|
||||
int err;
|
||||
u8 status;
|
||||
int npages = (eq->nent * MTHCA_EQ_ENTRY_SIZE + PAGE_SIZE - 1) /
|
||||
PAGE_SIZE;
|
||||
int i;
|
||||
@@ -606,11 +598,9 @@ static void mthca_free_eq(struct mthca_dev *dev,
|
||||
if (IS_ERR(mailbox))
|
||||
return;
|
||||
|
||||
err = mthca_HW2SW_EQ(dev, mailbox, eq->eqn, &status);
|
||||
err = mthca_HW2SW_EQ(dev, mailbox, eq->eqn);
|
||||
if (err)
|
||||
mthca_warn(dev, "HW2SW_EQ failed (%d)\n", err);
|
||||
if (status)
|
||||
mthca_warn(dev, "HW2SW_EQ returned status 0x%02x\n", status);
|
||||
mthca_warn(dev, "HW2SW_EQ returned %d\n", err);
|
||||
|
||||
dev->eq_table.arm_mask &= ~eq->eqn_mask;
|
||||
|
||||
@@ -738,7 +728,6 @@ static void mthca_unmap_eq_regs(struct mthca_dev *dev)
|
||||
int mthca_map_eq_icm(struct mthca_dev *dev, u64 icm_virt)
|
||||
{
|
||||
int ret;
|
||||
u8 status;
|
||||
|
||||
/*
|
||||
* We assume that mapping one page is enough for the whole EQ
|
||||
@@ -757,9 +746,7 @@ int mthca_map_eq_icm(struct mthca_dev *dev, u64 icm_virt)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ret = mthca_MAP_ICM_page(dev, dev->eq_table.icm_dma, icm_virt, &status);
|
||||
if (!ret && status)
|
||||
ret = -EINVAL;
|
||||
ret = mthca_MAP_ICM_page(dev, dev->eq_table.icm_dma, icm_virt);
|
||||
if (ret) {
|
||||
pci_unmap_page(dev->pdev, dev->eq_table.icm_dma, PAGE_SIZE,
|
||||
PCI_DMA_BIDIRECTIONAL);
|
||||
@@ -771,9 +758,7 @@ int mthca_map_eq_icm(struct mthca_dev *dev, u64 icm_virt)
|
||||
|
||||
void mthca_unmap_eq_icm(struct mthca_dev *dev)
|
||||
{
|
||||
u8 status;
|
||||
|
||||
mthca_UNMAP_ICM(dev, dev->eq_table.icm_virt, 1, &status);
|
||||
mthca_UNMAP_ICM(dev, dev->eq_table.icm_virt, 1);
|
||||
pci_unmap_page(dev->pdev, dev->eq_table.icm_dma, PAGE_SIZE,
|
||||
PCI_DMA_BIDIRECTIONAL);
|
||||
__free_page(dev->eq_table.icm_page);
|
||||
@@ -782,7 +767,6 @@ void mthca_unmap_eq_icm(struct mthca_dev *dev)
|
||||
int mthca_init_eq_table(struct mthca_dev *dev)
|
||||
{
|
||||
int err;
|
||||
u8 status;
|
||||
u8 intr;
|
||||
int i;
|
||||
|
||||
@@ -864,22 +848,16 @@ int mthca_init_eq_table(struct mthca_dev *dev)
|
||||
}
|
||||
|
||||
err = mthca_MAP_EQ(dev, async_mask(dev),
|
||||
0, dev->eq_table.eq[MTHCA_EQ_ASYNC].eqn, &status);
|
||||
0, dev->eq_table.eq[MTHCA_EQ_ASYNC].eqn);
|
||||
if (err)
|
||||
mthca_warn(dev, "MAP_EQ for async EQ %d failed (%d)\n",
|
||||
dev->eq_table.eq[MTHCA_EQ_ASYNC].eqn, err);
|
||||
if (status)
|
||||
mthca_warn(dev, "MAP_EQ for async EQ %d returned status 0x%02x\n",
|
||||
dev->eq_table.eq[MTHCA_EQ_ASYNC].eqn, status);
|
||||
|
||||
err = mthca_MAP_EQ(dev, MTHCA_CMD_EVENT_MASK,
|
||||
0, dev->eq_table.eq[MTHCA_EQ_CMD].eqn, &status);
|
||||
0, dev->eq_table.eq[MTHCA_EQ_CMD].eqn);
|
||||
if (err)
|
||||
mthca_warn(dev, "MAP_EQ for cmd EQ %d failed (%d)\n",
|
||||
dev->eq_table.eq[MTHCA_EQ_CMD].eqn, err);
|
||||
if (status)
|
||||
mthca_warn(dev, "MAP_EQ for cmd EQ %d returned status 0x%02x\n",
|
||||
dev->eq_table.eq[MTHCA_EQ_CMD].eqn, status);
|
||||
|
||||
for (i = 0; i < MTHCA_NUM_EQ; ++i)
|
||||
if (mthca_is_memfree(dev))
|
||||
@@ -909,15 +887,14 @@ err_out_free:
|
||||
|
||||
void mthca_cleanup_eq_table(struct mthca_dev *dev)
|
||||
{
|
||||
u8 status;
|
||||
int i;
|
||||
|
||||
mthca_free_irqs(dev);
|
||||
|
||||
mthca_MAP_EQ(dev, async_mask(dev),
|
||||
1, dev->eq_table.eq[MTHCA_EQ_ASYNC].eqn, &status);
|
||||
1, dev->eq_table.eq[MTHCA_EQ_ASYNC].eqn);
|
||||
mthca_MAP_EQ(dev, MTHCA_CMD_EVENT_MASK,
|
||||
1, dev->eq_table.eq[MTHCA_EQ_CMD].eqn, &status);
|
||||
1, dev->eq_table.eq[MTHCA_EQ_CMD].eqn);
|
||||
|
||||
for (i = 0; i < MTHCA_NUM_EQ; ++i)
|
||||
mthca_free_eq(dev, &dev->eq_table.eq[i]);
|
||||
|
||||
@@ -201,7 +201,6 @@ int mthca_process_mad(struct ib_device *ibdev,
|
||||
struct ib_mad *out_mad)
|
||||
{
|
||||
int err;
|
||||
u8 status;
|
||||
u16 slid = in_wc ? in_wc->slid : be16_to_cpu(IB_LID_PERMISSIVE);
|
||||
u16 prev_lid = 0;
|
||||
struct ib_port_attr pattr;
|
||||
@@ -252,17 +251,11 @@ int mthca_process_mad(struct ib_device *ibdev,
|
||||
err = mthca_MAD_IFC(to_mdev(ibdev),
|
||||
mad_flags & IB_MAD_IGNORE_MKEY,
|
||||
mad_flags & IB_MAD_IGNORE_BKEY,
|
||||
port_num, in_wc, in_grh, in_mad, out_mad,
|
||||
&status);
|
||||
if (err) {
|
||||
mthca_err(to_mdev(ibdev), "MAD_IFC failed\n");
|
||||
return IB_MAD_RESULT_FAILURE;
|
||||
}
|
||||
if (status == MTHCA_CMD_STAT_BAD_PKT)
|
||||
port_num, in_wc, in_grh, in_mad, out_mad);
|
||||
if (err == -EBADMSG)
|
||||
return IB_MAD_RESULT_SUCCESS;
|
||||
if (status) {
|
||||
mthca_err(to_mdev(ibdev), "MAD_IFC returned status %02x\n",
|
||||
status);
|
||||
else if (err) {
|
||||
mthca_err(to_mdev(ibdev), "MAD_IFC returned %d\n", err);
|
||||
return IB_MAD_RESULT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ static int mthca_tune_pci(struct mthca_dev *mdev)
|
||||
} else if (!(mdev->mthca_flags & MTHCA_FLAG_PCIE))
|
||||
mthca_info(mdev, "No PCI-X capability, not setting RBC.\n");
|
||||
|
||||
if (pci_find_capability(mdev->pdev, PCI_CAP_ID_EXP)) {
|
||||
if (pci_is_pcie(mdev->pdev)) {
|
||||
if (pcie_set_readrq(mdev->pdev, 4096)) {
|
||||
mthca_err(mdev, "Couldn't write PCI Express read request, "
|
||||
"aborting.\n");
|
||||
@@ -165,19 +165,14 @@ static int mthca_tune_pci(struct mthca_dev *mdev)
|
||||
static int mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim *dev_lim)
|
||||
{
|
||||
int err;
|
||||
u8 status;
|
||||
|
||||
mdev->limits.mtt_seg_size = (1 << log_mtts_per_seg) * 8;
|
||||
err = mthca_QUERY_DEV_LIM(mdev, dev_lim, &status);
|
||||
err = mthca_QUERY_DEV_LIM(mdev, dev_lim);
|
||||
if (err) {
|
||||
mthca_err(mdev, "QUERY_DEV_LIM command failed, aborting.\n");
|
||||
mthca_err(mdev, "QUERY_DEV_LIM command returned %d"
|
||||
", aborting.\n", err);
|
||||
return err;
|
||||
}
|
||||
if (status) {
|
||||
mthca_err(mdev, "QUERY_DEV_LIM returned status 0x%02x, "
|
||||
"aborting.\n", status);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (dev_lim->min_page_sz > PAGE_SIZE) {
|
||||
mthca_err(mdev, "HCA minimum page size of %d bigger than "
|
||||
"kernel PAGE_SIZE of %ld, aborting.\n",
|
||||
@@ -293,49 +288,32 @@ static int mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim *dev_lim)
|
||||
static int mthca_init_tavor(struct mthca_dev *mdev)
|
||||
{
|
||||
s64 size;
|
||||
u8 status;
|
||||
int err;
|
||||
struct mthca_dev_lim dev_lim;
|
||||
struct mthca_profile profile;
|
||||
struct mthca_init_hca_param init_hca;
|
||||
|
||||
err = mthca_SYS_EN(mdev, &status);
|
||||
err = mthca_SYS_EN(mdev);
|
||||
if (err) {
|
||||
mthca_err(mdev, "SYS_EN command failed, aborting.\n");
|
||||
mthca_err(mdev, "SYS_EN command returned %d, aborting.\n", err);
|
||||
return err;
|
||||
}
|
||||
if (status) {
|
||||
mthca_err(mdev, "SYS_EN returned status 0x%02x, "
|
||||
"aborting.\n", status);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = mthca_QUERY_FW(mdev, &status);
|
||||
err = mthca_QUERY_FW(mdev);
|
||||
if (err) {
|
||||
mthca_err(mdev, "QUERY_FW command failed, aborting.\n");
|
||||
mthca_err(mdev, "QUERY_FW command returned %d,"
|
||||
" aborting.\n", err);
|
||||
goto err_disable;
|
||||
}
|
||||
if (status) {
|
||||
mthca_err(mdev, "QUERY_FW returned status 0x%02x, "
|
||||
"aborting.\n", status);
|
||||
err = -EINVAL;
|
||||
goto err_disable;
|
||||
}
|
||||
err = mthca_QUERY_DDR(mdev, &status);
|
||||
err = mthca_QUERY_DDR(mdev);
|
||||
if (err) {
|
||||
mthca_err(mdev, "QUERY_DDR command failed, aborting.\n");
|
||||
goto err_disable;
|
||||
}
|
||||
if (status) {
|
||||
mthca_err(mdev, "QUERY_DDR returned status 0x%02x, "
|
||||
"aborting.\n", status);
|
||||
err = -EINVAL;
|
||||
mthca_err(mdev, "QUERY_DDR command returned %d, aborting.\n", err);
|
||||
goto err_disable;
|
||||
}
|
||||
|
||||
err = mthca_dev_lim(mdev, &dev_lim);
|
||||
if (err) {
|
||||
mthca_err(mdev, "QUERY_DEV_LIM command failed, aborting.\n");
|
||||
mthca_err(mdev, "QUERY_DEV_LIM command returned %d, aborting.\n", err);
|
||||
goto err_disable;
|
||||
}
|
||||
|
||||
@@ -351,29 +329,22 @@ static int mthca_init_tavor(struct mthca_dev *mdev)
|
||||
goto err_disable;
|
||||
}
|
||||
|
||||
err = mthca_INIT_HCA(mdev, &init_hca, &status);
|
||||
err = mthca_INIT_HCA(mdev, &init_hca);
|
||||
if (err) {
|
||||
mthca_err(mdev, "INIT_HCA command failed, aborting.\n");
|
||||
goto err_disable;
|
||||
}
|
||||
if (status) {
|
||||
mthca_err(mdev, "INIT_HCA returned status 0x%02x, "
|
||||
"aborting.\n", status);
|
||||
err = -EINVAL;
|
||||
mthca_err(mdev, "INIT_HCA command returned %d, aborting.\n", err);
|
||||
goto err_disable;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_disable:
|
||||
mthca_SYS_DIS(mdev, &status);
|
||||
mthca_SYS_DIS(mdev);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int mthca_load_fw(struct mthca_dev *mdev)
|
||||
{
|
||||
u8 status;
|
||||
int err;
|
||||
|
||||
/* FIXME: use HCA-attached memory for FW if present */
|
||||
@@ -386,31 +357,21 @@ static int mthca_load_fw(struct mthca_dev *mdev)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
err = mthca_MAP_FA(mdev, mdev->fw.arbel.fw_icm, &status);
|
||||
err = mthca_MAP_FA(mdev, mdev->fw.arbel.fw_icm);
|
||||
if (err) {
|
||||
mthca_err(mdev, "MAP_FA command failed, aborting.\n");
|
||||
mthca_err(mdev, "MAP_FA command returned %d, aborting.\n", err);
|
||||
goto err_free;
|
||||
}
|
||||
if (status) {
|
||||
mthca_err(mdev, "MAP_FA returned status 0x%02x, aborting.\n", status);
|
||||
err = -EINVAL;
|
||||
goto err_free;
|
||||
}
|
||||
err = mthca_RUN_FW(mdev, &status);
|
||||
err = mthca_RUN_FW(mdev);
|
||||
if (err) {
|
||||
mthca_err(mdev, "RUN_FW command failed, aborting.\n");
|
||||
goto err_unmap_fa;
|
||||
}
|
||||
if (status) {
|
||||
mthca_err(mdev, "RUN_FW returned status 0x%02x, aborting.\n", status);
|
||||
err = -EINVAL;
|
||||
mthca_err(mdev, "RUN_FW command returned %d, aborting.\n", err);
|
||||
goto err_unmap_fa;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_unmap_fa:
|
||||
mthca_UNMAP_FA(mdev, &status);
|
||||
mthca_UNMAP_FA(mdev);
|
||||
|
||||
err_free:
|
||||
mthca_free_icm(mdev, mdev->fw.arbel.fw_icm, 0);
|
||||
@@ -423,19 +384,13 @@ static int mthca_init_icm(struct mthca_dev *mdev,
|
||||
u64 icm_size)
|
||||
{
|
||||
u64 aux_pages;
|
||||
u8 status;
|
||||
int err;
|
||||
|
||||
err = mthca_SET_ICM_SIZE(mdev, icm_size, &aux_pages, &status);
|
||||
err = mthca_SET_ICM_SIZE(mdev, icm_size, &aux_pages);
|
||||
if (err) {
|
||||
mthca_err(mdev, "SET_ICM_SIZE command failed, aborting.\n");
|
||||
mthca_err(mdev, "SET_ICM_SIZE command returned %d, aborting.\n", err);
|
||||
return err;
|
||||
}
|
||||
if (status) {
|
||||
mthca_err(mdev, "SET_ICM_SIZE returned status 0x%02x, "
|
||||
"aborting.\n", status);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mthca_dbg(mdev, "%lld KB of HCA context requires %lld KB aux memory.\n",
|
||||
(unsigned long long) icm_size >> 10,
|
||||
@@ -448,14 +403,9 @@ static int mthca_init_icm(struct mthca_dev *mdev,
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
err = mthca_MAP_ICM_AUX(mdev, mdev->fw.arbel.aux_icm, &status);
|
||||
err = mthca_MAP_ICM_AUX(mdev, mdev->fw.arbel.aux_icm);
|
||||
if (err) {
|
||||
mthca_err(mdev, "MAP_ICM_AUX command failed, aborting.\n");
|
||||
goto err_free_aux;
|
||||
}
|
||||
if (status) {
|
||||
mthca_err(mdev, "MAP_ICM_AUX returned status 0x%02x, aborting.\n", status);
|
||||
err = -EINVAL;
|
||||
mthca_err(mdev, "MAP_ICM_AUX returned %d, aborting.\n", err);
|
||||
goto err_free_aux;
|
||||
}
|
||||
|
||||
@@ -596,7 +546,7 @@ err_unmap_eq:
|
||||
mthca_unmap_eq_icm(mdev);
|
||||
|
||||
err_unmap_aux:
|
||||
mthca_UNMAP_ICM_AUX(mdev, &status);
|
||||
mthca_UNMAP_ICM_AUX(mdev);
|
||||
|
||||
err_free_aux:
|
||||
mthca_free_icm(mdev, mdev->fw.arbel.aux_icm, 0);
|
||||
@@ -606,7 +556,6 @@ err_free_aux:
|
||||
|
||||
static void mthca_free_icms(struct mthca_dev *mdev)
|
||||
{
|
||||
u8 status;
|
||||
|
||||
mthca_free_icm_table(mdev, mdev->mcg_table.table);
|
||||
if (mdev->mthca_flags & MTHCA_FLAG_SRQ)
|
||||
@@ -619,7 +568,7 @@ static void mthca_free_icms(struct mthca_dev *mdev)
|
||||
mthca_free_icm_table(mdev, mdev->mr_table.mtt_table);
|
||||
mthca_unmap_eq_icm(mdev);
|
||||
|
||||
mthca_UNMAP_ICM_AUX(mdev, &status);
|
||||
mthca_UNMAP_ICM_AUX(mdev);
|
||||
mthca_free_icm(mdev, mdev->fw.arbel.aux_icm, 0);
|
||||
}
|
||||
|
||||
@@ -629,43 +578,32 @@ static int mthca_init_arbel(struct mthca_dev *mdev)
|
||||
struct mthca_profile profile;
|
||||
struct mthca_init_hca_param init_hca;
|
||||
s64 icm_size;
|
||||
u8 status;
|
||||
int err;
|
||||
|
||||
err = mthca_QUERY_FW(mdev, &status);
|
||||
err = mthca_QUERY_FW(mdev);
|
||||
if (err) {
|
||||
mthca_err(mdev, "QUERY_FW command failed, aborting.\n");
|
||||
mthca_err(mdev, "QUERY_FW command failed %d, aborting.\n", err);
|
||||
return err;
|
||||
}
|
||||
if (status) {
|
||||
mthca_err(mdev, "QUERY_FW returned status 0x%02x, "
|
||||
"aborting.\n", status);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = mthca_ENABLE_LAM(mdev, &status);
|
||||
if (err) {
|
||||
mthca_err(mdev, "ENABLE_LAM command failed, aborting.\n");
|
||||
return err;
|
||||
}
|
||||
if (status == MTHCA_CMD_STAT_LAM_NOT_PRE) {
|
||||
err = mthca_ENABLE_LAM(mdev);
|
||||
if (err == -EAGAIN) {
|
||||
mthca_dbg(mdev, "No HCA-attached memory (running in MemFree mode)\n");
|
||||
mdev->mthca_flags |= MTHCA_FLAG_NO_LAM;
|
||||
} else if (status) {
|
||||
mthca_err(mdev, "ENABLE_LAM returned status 0x%02x, "
|
||||
"aborting.\n", status);
|
||||
return -EINVAL;
|
||||
} else if (err) {
|
||||
mthca_err(mdev, "ENABLE_LAM returned %d, aborting.\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = mthca_load_fw(mdev);
|
||||
if (err) {
|
||||
mthca_err(mdev, "Failed to start FW, aborting.\n");
|
||||
mthca_err(mdev, "Loading FW returned %d, aborting.\n", err);
|
||||
goto err_disable;
|
||||
}
|
||||
|
||||
err = mthca_dev_lim(mdev, &dev_lim);
|
||||
if (err) {
|
||||
mthca_err(mdev, "QUERY_DEV_LIM command failed, aborting.\n");
|
||||
mthca_err(mdev, "QUERY_DEV_LIM returned %d, aborting.\n", err);
|
||||
goto err_stop_fw;
|
||||
}
|
||||
|
||||
@@ -685,15 +623,9 @@ static int mthca_init_arbel(struct mthca_dev *mdev)
|
||||
if (err)
|
||||
goto err_stop_fw;
|
||||
|
||||
err = mthca_INIT_HCA(mdev, &init_hca, &status);
|
||||
err = mthca_INIT_HCA(mdev, &init_hca);
|
||||
if (err) {
|
||||
mthca_err(mdev, "INIT_HCA command failed, aborting.\n");
|
||||
goto err_free_icm;
|
||||
}
|
||||
if (status) {
|
||||
mthca_err(mdev, "INIT_HCA returned status 0x%02x, "
|
||||
"aborting.\n", status);
|
||||
err = -EINVAL;
|
||||
mthca_err(mdev, "INIT_HCA command returned %d, aborting.\n", err);
|
||||
goto err_free_icm;
|
||||
}
|
||||
|
||||
@@ -703,37 +635,34 @@ err_free_icm:
|
||||
mthca_free_icms(mdev);
|
||||
|
||||
err_stop_fw:
|
||||
mthca_UNMAP_FA(mdev, &status);
|
||||
mthca_UNMAP_FA(mdev);
|
||||
mthca_free_icm(mdev, mdev->fw.arbel.fw_icm, 0);
|
||||
|
||||
err_disable:
|
||||
if (!(mdev->mthca_flags & MTHCA_FLAG_NO_LAM))
|
||||
mthca_DISABLE_LAM(mdev, &status);
|
||||
mthca_DISABLE_LAM(mdev);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static void mthca_close_hca(struct mthca_dev *mdev)
|
||||
{
|
||||
u8 status;
|
||||
|
||||
mthca_CLOSE_HCA(mdev, 0, &status);
|
||||
mthca_CLOSE_HCA(mdev, 0);
|
||||
|
||||
if (mthca_is_memfree(mdev)) {
|
||||
mthca_free_icms(mdev);
|
||||
|
||||
mthca_UNMAP_FA(mdev, &status);
|
||||
mthca_UNMAP_FA(mdev);
|
||||
mthca_free_icm(mdev, mdev->fw.arbel.fw_icm, 0);
|
||||
|
||||
if (!(mdev->mthca_flags & MTHCA_FLAG_NO_LAM))
|
||||
mthca_DISABLE_LAM(mdev, &status);
|
||||
mthca_DISABLE_LAM(mdev);
|
||||
} else
|
||||
mthca_SYS_DIS(mdev, &status);
|
||||
mthca_SYS_DIS(mdev);
|
||||
}
|
||||
|
||||
static int mthca_init_hca(struct mthca_dev *mdev)
|
||||
{
|
||||
u8 status;
|
||||
int err;
|
||||
struct mthca_adapter adapter;
|
||||
|
||||
@@ -745,15 +674,9 @@ static int mthca_init_hca(struct mthca_dev *mdev)
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = mthca_QUERY_ADAPTER(mdev, &adapter, &status);
|
||||
err = mthca_QUERY_ADAPTER(mdev, &adapter);
|
||||
if (err) {
|
||||
mthca_err(mdev, "QUERY_ADAPTER command failed, aborting.\n");
|
||||
goto err_close;
|
||||
}
|
||||
if (status) {
|
||||
mthca_err(mdev, "QUERY_ADAPTER returned status 0x%02x, "
|
||||
"aborting.\n", status);
|
||||
err = -EINVAL;
|
||||
mthca_err(mdev, "QUERY_ADAPTER command returned %d, aborting.\n", err);
|
||||
goto err_close;
|
||||
}
|
||||
|
||||
@@ -772,7 +695,6 @@ err_close:
|
||||
static int mthca_setup_hca(struct mthca_dev *dev)
|
||||
{
|
||||
int err;
|
||||
u8 status;
|
||||
|
||||
MTHCA_INIT_DOORBELL_LOCK(&dev->doorbell_lock);
|
||||
|
||||
@@ -833,8 +755,8 @@ static int mthca_setup_hca(struct mthca_dev *dev)
|
||||
goto err_eq_table_free;
|
||||
}
|
||||
|
||||
err = mthca_NOP(dev, &status);
|
||||
if (err || status) {
|
||||
err = mthca_NOP(dev);
|
||||
if (err) {
|
||||
if (dev->mthca_flags & MTHCA_FLAG_MSI_X) {
|
||||
mthca_warn(dev, "NOP command failed to generate interrupt "
|
||||
"(IRQ %d).\n",
|
||||
@@ -1166,7 +1088,6 @@ err_disable_pdev:
|
||||
static void __mthca_remove_one(struct pci_dev *pdev)
|
||||
{
|
||||
struct mthca_dev *mdev = pci_get_drvdata(pdev);
|
||||
u8 status;
|
||||
int p;
|
||||
|
||||
if (mdev) {
|
||||
@@ -1174,7 +1095,7 @@ static void __mthca_remove_one(struct pci_dev *pdev)
|
||||
mthca_unregister_device(mdev);
|
||||
|
||||
for (p = 1; p <= mdev->limits.num_ports; ++p)
|
||||
mthca_CLOSE_IB(mdev, p, &status);
|
||||
mthca_CLOSE_IB(mdev, p);
|
||||
|
||||
mthca_cleanup_mcg_table(mdev);
|
||||
mthca_cleanup_av_table(mdev);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user