Skip to content

Commit 8e9815a

Browse files
committed
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: RDMA/nes: Fix incorrect unlock in nes_process_mac_intr() RDMA/nes: Async event for closed QP causes crash RDMA/nes: Have ethtool read hardware registers for rx/tx stats RDMA/cxgb4: Only insert sq qid in lookup table RDMA/cxgb4: Support IB_WR_READ_WITH_INV opcode RDMA/cxgb4: Set fence flag for inv-local-stag work requests RDMA/cxgb4: Update some HW limits RDMA/cxgb4: Don't limit fastreg page list depth RDMA/cxgb4: Return proper errors in fastreg mr/pbl allocation RDMA/cxgb4: Fix overflow bug in CQ arm RDMA/cxgb4: Optimize CQ overflow detection RDMA/cxgb4: CQ size must be IQ size - 2 RDMA/cxgb4: Register RDMA provider based on LLD state_change events RDMA/cxgb4: Detach from the LLD after unregistering RDMA device IB/ipath: Remove support for QLogic PCIe QLE devices IB/qib: Add new qib driver for QLogic PCIe InfiniBand adapters IB/mad: Make needlessly global mad_sendq_size/mad_recvq_size static IB/core: Allow device-specific per-port sysfs files mlx4_core: Clean up mlx4_alloc_icm() a bit mlx4_core: Fix possible chunk sg list overflow in mlx4_alloc_icm()
2 parents 702c0b0 + acdc30b commit 8e9815a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+51083
-5144
lines changed

drivers/infiniband/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ config INFINIBAND_ADDR_TRANS
4343

4444
source "drivers/infiniband/hw/mthca/Kconfig"
4545
source "drivers/infiniband/hw/ipath/Kconfig"
46+
source "drivers/infiniband/hw/qib/Kconfig"
4647
source "drivers/infiniband/hw/ehca/Kconfig"
4748
source "drivers/infiniband/hw/amso1100/Kconfig"
4849
source "drivers/infiniband/hw/cxgb3/Kconfig"

drivers/infiniband/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
obj-$(CONFIG_INFINIBAND) += core/
22
obj-$(CONFIG_INFINIBAND_MTHCA) += hw/mthca/
33
obj-$(CONFIG_INFINIBAND_IPATH) += hw/ipath/
4+
obj-$(CONFIG_INFINIBAND_QIB) += hw/qib/
45
obj-$(CONFIG_INFINIBAND_EHCA) += hw/ehca/
56
obj-$(CONFIG_INFINIBAND_AMSO1100) += hw/amso1100/
67
obj-$(CONFIG_INFINIBAND_CXGB3) += hw/cxgb3/

drivers/infiniband/core/core_priv.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838

3939
#include <rdma/ib_verbs.h>
4040

41-
int ib_device_register_sysfs(struct ib_device *device);
41+
int ib_device_register_sysfs(struct ib_device *device,
42+
int (*port_callback)(struct ib_device *,
43+
u8, struct kobject *));
4244
void ib_device_unregister_sysfs(struct ib_device *device);
4345

4446
int ib_sysfs_setup(void);

drivers/infiniband/core/device.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,9 @@ static int read_port_table_lengths(struct ib_device *device)
267267
* callback for each device that is added. @device must be allocated
268268
* with ib_alloc_device().
269269
*/
270-
int ib_register_device(struct ib_device *device)
270+
int ib_register_device(struct ib_device *device,
271+
int (*port_callback)(struct ib_device *,
272+
u8, struct kobject *))
271273
{
272274
int ret;
273275

@@ -296,7 +298,7 @@ int ib_register_device(struct ib_device *device)
296298
goto out;
297299
}
298300

299-
ret = ib_device_register_sysfs(device);
301+
ret = ib_device_register_sysfs(device, port_callback);
300302
if (ret) {
301303
printk(KERN_WARNING "Couldn't register device %s with driver model\n",
302304
device->name);

drivers/infiniband/core/mad.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ MODULE_DESCRIPTION("kernel IB MAD API");
4747
MODULE_AUTHOR("Hal Rosenstock");
4848
MODULE_AUTHOR("Sean Hefty");
4949

50-
int mad_sendq_size = IB_MAD_QP_SEND_SIZE;
51-
int mad_recvq_size = IB_MAD_QP_RECV_SIZE;
50+
static int mad_sendq_size = IB_MAD_QP_SEND_SIZE;
51+
static int mad_recvq_size = IB_MAD_QP_RECV_SIZE;
5252

5353
module_param_named(send_queue_size, mad_sendq_size, int, 0444);
5454
MODULE_PARM_DESC(send_queue_size, "Size of send queue in number of work requests");

drivers/infiniband/core/sysfs.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,9 @@ alloc_group_attrs(ssize_t (*show)(struct ib_port *,
475475
return NULL;
476476
}
477477

478-
static int add_port(struct ib_device *device, int port_num)
478+
static int add_port(struct ib_device *device, int port_num,
479+
int (*port_callback)(struct ib_device *,
480+
u8, struct kobject *))
479481
{
480482
struct ib_port *p;
481483
struct ib_port_attr attr;
@@ -522,11 +524,20 @@ static int add_port(struct ib_device *device, int port_num)
522524
if (ret)
523525
goto err_free_pkey;
524526

527+
if (port_callback) {
528+
ret = port_callback(device, port_num, &p->kobj);
529+
if (ret)
530+
goto err_remove_pkey;
531+
}
532+
525533
list_add_tail(&p->kobj.entry, &device->port_list);
526534

527535
kobject_uevent(&p->kobj, KOBJ_ADD);
528536
return 0;
529537

538+
err_remove_pkey:
539+
sysfs_remove_group(&p->kobj, &p->pkey_group);
540+
530541
err_free_pkey:
531542
for (i = 0; i < attr.pkey_tbl_len; ++i)
532543
kfree(p->pkey_group.attrs[i]);
@@ -754,7 +765,9 @@ static struct attribute_group iw_stats_group = {
754765
.attrs = iw_proto_stats_attrs,
755766
};
756767

757-
int ib_device_register_sysfs(struct ib_device *device)
768+
int ib_device_register_sysfs(struct ib_device *device,
769+
int (*port_callback)(struct ib_device *,
770+
u8, struct kobject *))
758771
{
759772
struct device *class_dev = &device->dev;
760773
int ret;
@@ -785,12 +798,12 @@ int ib_device_register_sysfs(struct ib_device *device)
785798
}
786799

787800
if (device->node_type == RDMA_NODE_IB_SWITCH) {
788-
ret = add_port(device, 0);
801+
ret = add_port(device, 0, port_callback);
789802
if (ret)
790803
goto err_put;
791804
} else {
792805
for (i = 1; i <= device->phys_port_cnt; ++i) {
793-
ret = add_port(device, i);
806+
ret = add_port(device, i, port_callback);
794807
if (ret)
795808
goto err_put;
796809
}

drivers/infiniband/hw/amso1100/c2_provider.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ int c2_register_device(struct c2_dev *dev)
865865
dev->ibdev.iwcm->create_listen = c2_service_create;
866866
dev->ibdev.iwcm->destroy_listen = c2_service_destroy;
867867

868-
ret = ib_register_device(&dev->ibdev);
868+
ret = ib_register_device(&dev->ibdev, NULL);
869869
if (ret)
870870
goto out_free_iwcm;
871871

drivers/infiniband/hw/cxgb3/iwch_provider.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1428,7 +1428,7 @@ int iwch_register_device(struct iwch_dev *dev)
14281428
dev->ibdev.iwcm->rem_ref = iwch_qp_rem_ref;
14291429
dev->ibdev.iwcm->get_qp = iwch_get_qp;
14301430

1431-
ret = ib_register_device(&dev->ibdev);
1431+
ret = ib_register_device(&dev->ibdev, NULL);
14321432
if (ret)
14331433
goto bail1;
14341434

drivers/infiniband/hw/cxgb4/cq.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ static void create_read_req_cqe(struct t4_wq *wq, struct t4_cqe *hw_cqe,
373373
V_CQE_SWCQE(SW_CQE(hw_cqe)) |
374374
V_CQE_OPCODE(FW_RI_READ_REQ) |
375375
V_CQE_TYPE(1));
376+
read_cqe->bits_type_ts = hw_cqe->bits_type_ts;
376377
}
377378

378379
/*
@@ -780,6 +781,9 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
780781
/* account for the status page. */
781782
entries++;
782783

784+
/* IQ needs one extra entry to differentiate full vs empty. */
785+
entries++;
786+
783787
/*
784788
* entries must be multiple of 16 for HW.
785789
*/
@@ -801,7 +805,7 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
801805

802806
chp->rhp = rhp;
803807
chp->cq.size--; /* status page */
804-
chp->ibcq.cqe = chp->cq.size;
808+
chp->ibcq.cqe = chp->cq.size - 1;
805809
spin_lock_init(&chp->lock);
806810
atomic_set(&chp->refcnt, 1);
807811
init_waitqueue_head(&chp->wait);

drivers/infiniband/hw/cxgb4/device.c

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,8 @@ static void c4iw_remove(struct c4iw_dev *dev)
306306
PDBG("%s c4iw_dev %p\n", __func__, dev);
307307
cancel_delayed_work_sync(&dev->db_drop_task);
308308
list_del(&dev->entry);
309-
c4iw_unregister_device(dev);
309+
if (dev->registered)
310+
c4iw_unregister_device(dev);
310311
c4iw_rdev_close(&dev->rdev);
311312
idr_destroy(&dev->cqidr);
312313
idr_destroy(&dev->qpidr);
@@ -343,12 +344,6 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop)
343344
list_add_tail(&devp->entry, &dev_list);
344345
mutex_unlock(&dev_mutex);
345346

346-
if (c4iw_register_device(devp)) {
347-
printk(KERN_ERR MOD "Unable to register device\n");
348-
mutex_lock(&dev_mutex);
349-
c4iw_remove(devp);
350-
mutex_unlock(&dev_mutex);
351-
}
352347
if (c4iw_debugfs_root) {
353348
devp->debugfs_root = debugfs_create_dir(
354349
pci_name(devp->rdev.lldi.pdev),
@@ -379,9 +374,6 @@ static void *c4iw_uld_add(const struct cxgb4_lld_info *infop)
379374

380375
for (i = 0; i < dev->rdev.lldi.nrxq; i++)
381376
PDBG("rxqid[%u] %u\n", i, dev->rdev.lldi.rxq_ids[i]);
382-
383-
printk(KERN_INFO MOD "Initialized device %s\n",
384-
pci_name(dev->rdev.lldi.pdev));
385377
out:
386378
return dev;
387379
}
@@ -471,7 +463,41 @@ static int c4iw_uld_rx_handler(void *handle, const __be64 *rsp,
471463

472464
static int c4iw_uld_state_change(void *handle, enum cxgb4_state new_state)
473465
{
466+
struct c4iw_dev *dev = handle;
467+
474468
PDBG("%s new_state %u\n", __func__, new_state);
469+
switch (new_state) {
470+
case CXGB4_STATE_UP:
471+
printk(KERN_INFO MOD "%s: Up\n", pci_name(dev->rdev.lldi.pdev));
472+
if (!dev->registered) {
473+
int ret;
474+
ret = c4iw_register_device(dev);
475+
if (ret)
476+
printk(KERN_ERR MOD
477+
"%s: RDMA registration failed: %d\n",
478+
pci_name(dev->rdev.lldi.pdev), ret);
479+
}
480+
break;
481+
case CXGB4_STATE_DOWN:
482+
printk(KERN_INFO MOD "%s: Down\n",
483+
pci_name(dev->rdev.lldi.pdev));
484+
if (dev->registered)
485+
c4iw_unregister_device(dev);
486+
break;
487+
case CXGB4_STATE_START_RECOVERY:
488+
printk(KERN_INFO MOD "%s: Fatal Error\n",
489+
pci_name(dev->rdev.lldi.pdev));
490+
if (dev->registered)
491+
c4iw_unregister_device(dev);
492+
break;
493+
case CXGB4_STATE_DETACH:
494+
printk(KERN_INFO MOD "%s: Detach\n",
495+
pci_name(dev->rdev.lldi.pdev));
496+
mutex_lock(&dev_mutex);
497+
c4iw_remove(dev);
498+
mutex_unlock(&dev_mutex);
499+
break;
500+
}
475501
return 0;
476502
}
477503

@@ -504,14 +530,12 @@ static void __exit c4iw_exit_module(void)
504530
{
505531
struct c4iw_dev *dev, *tmp;
506532

507-
cxgb4_unregister_uld(CXGB4_ULD_RDMA);
508-
509533
mutex_lock(&dev_mutex);
510534
list_for_each_entry_safe(dev, tmp, &dev_list, entry) {
511535
c4iw_remove(dev);
512536
}
513537
mutex_unlock(&dev_mutex);
514-
538+
cxgb4_unregister_uld(CXGB4_ULD_RDMA);
515539
c4iw_cm_term();
516540
debugfs_remove_recursive(c4iw_debugfs_root);
517541
}

drivers/infiniband/hw/cxgb4/iw_cxgb4.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ struct c4iw_dev {
152152
struct list_head entry;
153153
struct delayed_work db_drop_task;
154154
struct dentry *debugfs_root;
155+
u8 registered;
155156
};
156157

157158
static inline struct c4iw_dev *to_c4iw_dev(struct ib_device *ibdev)

drivers/infiniband/hw/cxgb4/mem.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -712,8 +712,10 @@ struct ib_mr *c4iw_alloc_fast_reg_mr(struct ib_pd *pd, int pbl_depth)
712712
php = to_c4iw_pd(pd);
713713
rhp = php->rhp;
714714
mhp = kzalloc(sizeof(*mhp), GFP_KERNEL);
715-
if (!mhp)
715+
if (!mhp) {
716+
ret = -ENOMEM;
716717
goto err;
718+
}
717719

718720
mhp->rhp = rhp;
719721
ret = alloc_pbl(mhp, pbl_depth);
@@ -730,8 +732,10 @@ struct ib_mr *c4iw_alloc_fast_reg_mr(struct ib_pd *pd, int pbl_depth)
730732
mhp->attr.state = 1;
731733
mmid = (stag) >> 8;
732734
mhp->ibmr.rkey = mhp->ibmr.lkey = stag;
733-
if (insert_handle(rhp, &rhp->mmidr, mhp, mmid))
735+
if (insert_handle(rhp, &rhp->mmidr, mhp, mmid)) {
736+
ret = -ENOMEM;
734737
goto err3;
738+
}
735739

736740
PDBG("%s mmid 0x%x mhp %p stag 0x%x\n", __func__, mmid, mhp, stag);
737741
return &(mhp->ibmr);
@@ -755,9 +759,6 @@ struct ib_fast_reg_page_list *c4iw_alloc_fastreg_pbl(struct ib_device *device,
755759
dma_addr_t dma_addr;
756760
int size = sizeof *c4pl + page_list_len * sizeof(u64);
757761

758-
if (page_list_len > T4_MAX_FR_DEPTH)
759-
return ERR_PTR(-EINVAL);
760-
761762
c4pl = dma_alloc_coherent(&dev->rdev.lldi.pdev->dev, size,
762763
&dma_addr, GFP_KERNEL);
763764
if (!c4pl)

drivers/infiniband/hw/cxgb4/provider.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ int c4iw_register_device(struct c4iw_dev *dev)
486486
dev->ibdev.iwcm->rem_ref = c4iw_qp_rem_ref;
487487
dev->ibdev.iwcm->get_qp = c4iw_get_qp;
488488

489-
ret = ib_register_device(&dev->ibdev);
489+
ret = ib_register_device(&dev->ibdev, NULL);
490490
if (ret)
491491
goto bail1;
492492

@@ -496,6 +496,7 @@ int c4iw_register_device(struct c4iw_dev *dev)
496496
if (ret)
497497
goto bail2;
498498
}
499+
dev->registered = 1;
499500
return 0;
500501
bail2:
501502
ib_unregister_device(&dev->ibdev);
@@ -514,5 +515,6 @@ void c4iw_unregister_device(struct c4iw_dev *dev)
514515
c4iw_class_attributes[i]);
515516
ib_unregister_device(&dev->ibdev);
516517
kfree(dev->ibdev.iwcm);
518+
dev->registered = 0;
517519
return;
518520
}

0 commit comments

Comments
 (0)