From patchwork Mon Nov 9 21:31:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vu Pham X-Patchwork-Id: 58838 X-Patchwork-Delegate: dave@thedillows.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nA9LVYM9026063 for ; Mon, 9 Nov 2009 21:31:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754753AbZKIVb1 (ORCPT ); Mon, 9 Nov 2009 16:31:27 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754706AbZKIVb1 (ORCPT ); Mon, 9 Nov 2009 16:31:27 -0500 Received: from p02c11o144.mxlogic.net ([208.65.144.77]:58352 "EHLO p02c11o144.mxlogic.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754479AbZKIVb0 (ORCPT ); Mon, 9 Nov 2009 16:31:26 -0500 Received: from unknown [63.251.237.3] (EHLO mtiexch01.mti.com) by p02c11o144.mxlogic.net(mxl_mta-6.4.0-2) with ESMTP id 23a88fa4.0.18284.00-011.43139.p02c11o144.mxlogic.net (envelope-from ); Mon, 09 Nov 2009 14:31:32 -0700 (MST) X-MXL-Hash: 4af88a346398b49d-36c18713fb4c9b6d57569c27a86d4f53dd3ad3f9 Received: from [10.2.1.145] ([10.2.1.145]) by mtiexch01.mti.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 9 Nov 2009 13:34:39 -0800 Message-ID: <4AF88A32.2000209@mellanox.com> Date: Mon, 09 Nov 2009 13:31:30 -0800 From: Vu Pham User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Linux RDMA list CC: Roland Dreier Subject: [linux-rdma][PATCH 1/6] SRP recreates qp/cq resources at reconnecting to target X-OriginalArrivalTime: 09 Nov 2009 21:34:39.0656 (UTC) FILETIME=[71381A80:01CA6184] X-Spam: [F=0.2000000000; CM=0.500; S=0.200(2009110601)] X-MAIL-FROM: X-SOURCE-IP: [63.251.237.3] X-AnalysisOut: [v=1.0 c=1 a=D-AvtnQzuugA:10 a=xupnbh4h0YLOHZnncC45HQ==:17 ] X-AnalysisOut: [a=CbDCq_QkAAAA:8 a=T3eU9bDWqbC12rcYs7kA:9 a=tFtSvjjVMpLNBH] X-AnalysisOut: [5XQiDHrqpgFpcA:4 a=E3yz0KKPV6YA:10 a=dux-jpoaOlfH7z5yvbwA:] X-AnalysisOut: [9 a=-qKFDYX5dohpxUikYmYA:7 a=G_-fdIaF2AwW2VEbDc0zhMXS6TAA:] X-AnalysisOut: [4] Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index dfa14de..e44939a 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -535,10 +535,10 @@ static void srp_reset_req(struct srp_target_port *target, struct srp_request *re static int srp_reconnect_target(struct srp_target_port *target) { - struct ib_qp_attr qp_attr; struct srp_request *req, *tmp; - struct ib_wc wc; int ret; + struct ib_cq *old_cq; + struct ib_qp *old_qp; spin_lock_irq(target->scsi_host->host_lock); if (target->state != SRP_TARGET_LIVE) { @@ -557,17 +557,17 @@ static int srp_reconnect_target(struct srp_target_port *target) if (ret) goto err; - qp_attr.qp_state = IB_QPS_RESET; - ret = ib_modify_qp(target->qp, &qp_attr, IB_QP_STATE); - if (ret) - goto err; - - ret = srp_init_qp(target, target->qp); - if (ret) + old_qp = target->qp; + old_cq = target->cq; + ret = srp_create_target_ib(target); + if (ret) { + target->qp = old_qp; + target->cq = old_cq; goto err; + } - while (ib_poll_cq(target->cq, 1, &wc) > 0) - ; /* nothing */ + ib_destroy_qp(old_qp); + ib_destroy_cq(old_cq); spin_lock_irq(target->scsi_host->host_lock); list_for_each_entry_safe(req, tmp, &target->req_queue, list)