aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2012-09-13 17:54:57 -0400
committerBjorn Helgaas <bhelgaas@google.com>2012-09-13 17:54:57 -0400
commit9a5d5bd8480068c5829e3d997ee21dab9b3ed05f (patch)
treef8bea83deb720d4fa3a9ada8d4845406c2d7c8f0 /drivers/infiniband/ulp
parent271fd03a3013b106ccc178d54219c1be0c9759b7 (diff)
parent55d512e245bc7699a8800e23df1a24195dd08217 (diff)
Merge commit 'v3.6-rc5' into pci/gavin-window-alignment
* commit 'v3.6-rc5': (1098 commits) Linux 3.6-rc5 HID: tpkbd: work even if the new Lenovo Keyboard driver is not configured Remove user-triggerable BUG from mpol_to_str xen/pciback: Fix proper FLR steps. uml: fix compile error in deliver_alarm() dj: memory scribble in logi_dj Fix order of arguments to compat_put_time[spec|val] xen: Use correct masking in xen_swiotlb_alloc_coherent. xen: fix logical error in tlb flushing xen/p2m: Fix one-off error in checking the P2M tree directory. powerpc: Don't use __put_user() in patch_instruction powerpc: Make sure IPI handlers see data written by IPI senders powerpc: Restore correct DSCR in context switch powerpc: Fix DSCR inheritance in copy_thread() powerpc: Keep thread.dscr and thread.dscr_inherit in sync powerpc: Update DSCR on all CPUs when writing sysfs dscr_default powerpc/powernv: Always go into nap mode when CPU is offline powerpc: Give hypervisor decrementer interrupts their own handler powerpc/vphn: Fix arch_update_cpu_topology() return value ARM: gemini: fix the gemini build ... Conflicts: drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c drivers/rapidio/devices/tsi721.c
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c3
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c2
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c87
-rw-r--r--drivers/infiniband/ulp/srpt/ib_srpt.c2
4 files changed, 68 insertions, 26 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 95ecf4eadf5f..24683fda8e21 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -1271,12 +1271,15 @@ struct ipoib_cm_tx *ipoib_cm_create_tx(struct net_device *dev, struct ipoib_path
1271void ipoib_cm_destroy_tx(struct ipoib_cm_tx *tx) 1271void ipoib_cm_destroy_tx(struct ipoib_cm_tx *tx)
1272{ 1272{
1273 struct ipoib_dev_priv *priv = netdev_priv(tx->dev); 1273 struct ipoib_dev_priv *priv = netdev_priv(tx->dev);
1274 unsigned long flags;
1274 if (test_and_clear_bit(IPOIB_FLAG_INITIALIZED, &tx->flags)) { 1275 if (test_and_clear_bit(IPOIB_FLAG_INITIALIZED, &tx->flags)) {
1276 spin_lock_irqsave(&priv->lock, flags);
1275 list_move(&tx->list, &priv->cm.reap_list); 1277 list_move(&tx->list, &priv->cm.reap_list);
1276 queue_work(ipoib_workqueue, &priv->cm.reap_task); 1278 queue_work(ipoib_workqueue, &priv->cm.reap_task);
1277 ipoib_dbg(priv, "Reap connection for gid %pI6\n", 1279 ipoib_dbg(priv, "Reap connection for gid %pI6\n",
1278 tx->neigh->daddr + 4); 1280 tx->neigh->daddr + 4);
1279 tx->neigh = NULL; 1281 tx->neigh = NULL;
1282 spin_unlock_irqrestore(&priv->lock, flags);
1280 } 1283 }
1281} 1284}
1282 1285
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 97920b77a5d0..3e2085a3ee47 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1052,7 +1052,7 @@ void ipoib_neigh_free(struct ipoib_neigh *neigh)
1052 for (n = rcu_dereference_protected(*np, 1052 for (n = rcu_dereference_protected(*np,
1053 lockdep_is_held(&ntbl->rwlock)); 1053 lockdep_is_held(&ntbl->rwlock));
1054 n != NULL; 1054 n != NULL;
1055 n = rcu_dereference_protected(neigh->hnext, 1055 n = rcu_dereference_protected(*np,
1056 lockdep_is_held(&ntbl->rwlock))) { 1056 lockdep_is_held(&ntbl->rwlock))) {
1057 if (n == neigh) { 1057 if (n == neigh) {
1058 /* found */ 1058 /* found */
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index bcbf22ee0aa7..1b5b0c730054 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -586,24 +586,62 @@ static void srp_unmap_data(struct scsi_cmnd *scmnd,
586 scmnd->sc_data_direction); 586 scmnd->sc_data_direction);
587} 587}
588 588
589static void srp_remove_req(struct srp_target_port *target, 589/**
590 struct srp_request *req, s32 req_lim_delta) 590 * srp_claim_req - Take ownership of the scmnd associated with a request.
591 * @target: SRP target port.
592 * @req: SRP request.
593 * @scmnd: If NULL, take ownership of @req->scmnd. If not NULL, only take
594 * ownership of @req->scmnd if it equals @scmnd.
595 *
596 * Return value:
597 * Either NULL or a pointer to the SCSI command the caller became owner of.
598 */
599static struct scsi_cmnd *srp_claim_req(struct srp_target_port *target,
600 struct srp_request *req,
601 struct scsi_cmnd *scmnd)
602{
603 unsigned long flags;
604
605 spin_lock_irqsave(&target->lock, flags);
606 if (!scmnd) {
607 scmnd = req->scmnd;
608 req->scmnd = NULL;
609 } else if (req->scmnd == scmnd) {
610 req->scmnd = NULL;
611 } else {
612 scmnd = NULL;
613 }
614 spin_unlock_irqrestore(&target->lock, flags);
615
616 return scmnd;
617}
618
619/**
620 * srp_free_req() - Unmap data and add request to the free request list.
621 */
622static void srp_free_req(struct srp_target_port *target,
623 struct srp_request *req, struct scsi_cmnd *scmnd,
624 s32 req_lim_delta)
591{ 625{
592 unsigned long flags; 626 unsigned long flags;
593 627
594 srp_unmap_data(req->scmnd, target, req); 628 srp_unmap_data(scmnd, target, req);
629
595 spin_lock_irqsave(&target->lock, flags); 630 spin_lock_irqsave(&target->lock, flags);
596 target->req_lim += req_lim_delta; 631 target->req_lim += req_lim_delta;
597 req->scmnd = NULL;
598 list_add_tail(&req->list, &target->free_reqs); 632 list_add_tail(&req->list, &target->free_reqs);
599 spin_unlock_irqrestore(&target->lock, flags); 633 spin_unlock_irqrestore(&target->lock, flags);
600} 634}
601 635
602static void srp_reset_req(struct srp_target_port *target, struct srp_request *req) 636static void srp_reset_req(struct srp_target_port *target, struct srp_request *req)
603{ 637{
604 req->scmnd->result = DID_RESET << 16; 638 struct scsi_cmnd *scmnd = srp_claim_req(target, req, NULL);
605 req->scmnd->scsi_done(req->scmnd); 639
606 srp_remove_req(target, req, 0); 640 if (scmnd) {
641 scmnd->result = DID_RESET << 16;
642 scmnd->scsi_done(scmnd);
643 srp_free_req(target, req, scmnd, 0);
644 }
607} 645}
608 646
609static int srp_reconnect_target(struct srp_target_port *target) 647static int srp_reconnect_target(struct srp_target_port *target)
@@ -1073,11 +1111,18 @@ static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp)
1073 complete(&target->tsk_mgmt_done); 1111 complete(&target->tsk_mgmt_done);
1074 } else { 1112 } else {
1075 req = &target->req_ring[rsp->tag]; 1113 req = &target->req_ring[rsp->tag];
1076 scmnd = req->scmnd; 1114 scmnd = srp_claim_req(target, req, NULL);
1077 if (!scmnd) 1115 if (!scmnd) {
1078 shost_printk(KERN_ERR, target->scsi_host, 1116 shost_printk(KERN_ERR, target->scsi_host,
1079 "Null scmnd for RSP w/tag %016llx\n", 1117 "Null scmnd for RSP w/tag %016llx\n",
1080 (unsigned long long) rsp->tag); 1118 (unsigned long long) rsp->tag);
1119
1120 spin_lock_irqsave(&target->lock, flags);
1121 target->req_lim += be32_to_cpu(rsp->req_lim_delta);
1122 spin_unlock_irqrestore(&target->lock, flags);
1123
1124 return;
1125 }
1081 scmnd->result = rsp->status; 1126 scmnd->result = rsp->status;
1082 1127
1083 if (rsp->flags & SRP_RSP_FLAG_SNSVALID) { 1128 if (rsp->flags & SRP_RSP_FLAG_SNSVALID) {
@@ -1092,7 +1137,9 @@ static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp)
1092 else if (rsp->flags & (SRP_RSP_FLAG_DIOVER | SRP_RSP_FLAG_DIUNDER)) 1137 else if (rsp->flags & (SRP_RSP_FLAG_DIOVER | SRP_RSP_FLAG_DIUNDER))
1093 scsi_set_resid(scmnd, be32_to_cpu(rsp->data_in_res_cnt)); 1138 scsi_set_resid(scmnd, be32_to_cpu(rsp->data_in_res_cnt));
1094 1139
1095 srp_remove_req(target, req, be32_to_cpu(rsp->req_lim_delta)); 1140 srp_free_req(target, req, scmnd,
1141 be32_to_cpu(rsp->req_lim_delta));
1142
1096 scmnd->host_scribble = NULL; 1143 scmnd->host_scribble = NULL;
1097 scmnd->scsi_done(scmnd); 1144 scmnd->scsi_done(scmnd);
1098 } 1145 }
@@ -1631,25 +1678,17 @@ static int srp_abort(struct scsi_cmnd *scmnd)
1631{ 1678{
1632 struct srp_target_port *target = host_to_target(scmnd->device->host); 1679 struct srp_target_port *target = host_to_target(scmnd->device->host);
1633 struct srp_request *req = (struct srp_request *) scmnd->host_scribble; 1680 struct srp_request *req = (struct srp_request *) scmnd->host_scribble;
1634 int ret = SUCCESS;
1635 1681
1636 shost_printk(KERN_ERR, target->scsi_host, "SRP abort called\n"); 1682 shost_printk(KERN_ERR, target->scsi_host, "SRP abort called\n");
1637 1683
1638 if (!req || target->qp_in_error) 1684 if (!req || target->qp_in_error || !srp_claim_req(target, req, scmnd))
1639 return FAILED; 1685 return FAILED;
1640 if (srp_send_tsk_mgmt(target, req->index, scmnd->device->lun, 1686 srp_send_tsk_mgmt(target, req->index, scmnd->device->lun,
1641 SRP_TSK_ABORT_TASK)) 1687 SRP_TSK_ABORT_TASK);
1642 return FAILED; 1688 srp_free_req(target, req, scmnd, 0);
1643 1689 scmnd->result = DID_ABORT << 16;
1644 if (req->scmnd) {
1645 if (!target->tsk_mgmt_status) {
1646 srp_remove_req(target, req, 0);
1647 scmnd->result = DID_ABORT << 16;
1648 } else
1649 ret = FAILED;
1650 }
1651 1690
1652 return ret; 1691 return SUCCESS;
1653} 1692}
1654 1693
1655static int srp_reset_device(struct scsi_cmnd *scmnd) 1694static int srp_reset_device(struct scsi_cmnd *scmnd)
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 7a0ce8d42887..9e1449f8c6a2 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -1469,7 +1469,7 @@ static void srpt_handle_send_comp(struct srpt_rdma_ch *ch,
1469 * 1469 *
1470 * XXX: what is now target_execute_cmd used to be asynchronous, and unmapping 1470 * XXX: what is now target_execute_cmd used to be asynchronous, and unmapping
1471 * the data that has been transferred via IB RDMA had to be postponed until the 1471 * the data that has been transferred via IB RDMA had to be postponed until the
1472 * check_stop_free() callback. None of this is nessecary anymore and needs to 1472 * check_stop_free() callback. None of this is necessary anymore and needs to
1473 * be cleaned up. 1473 * be cleaned up.
1474 */ 1474 */
1475static void srpt_handle_rdma_comp(struct srpt_rdma_ch *ch, 1475static void srpt_handle_rdma_comp(struct srpt_rdma_ch *ch,