From patchwork Sat Jan 9 15:00:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dennis Dalessandro X-Patchwork-Id: 7992571 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9D4489FC5C for ; Sat, 9 Jan 2016 15:00:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D5E4A20268 for ; Sat, 9 Jan 2016 15:00:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5834820279 for ; Sat, 9 Jan 2016 15:00:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754316AbcAIPAf (ORCPT ); Sat, 9 Jan 2016 10:00:35 -0500 Received: from mga04.intel.com ([192.55.52.120]:19296 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754239AbcAIPAe (ORCPT ); Sat, 9 Jan 2016 10:00:34 -0500 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP; 09 Jan 2016 07:00:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,544,1444719600"; d="scan'208";a="630713656" Received: from scymds01.sc.intel.com ([10.82.194.37]) by FMSMGA003.fm.intel.com with ESMTP; 09 Jan 2016 07:00:25 -0800 Received: from scvm10.sc.intel.com (scvm10.sc.intel.com [10.82.195.27]) by scymds01.sc.intel.com with ESMTP id u09F0PWu014467; Sat, 9 Jan 2016 07:00:25 -0800 Received: from scvm10.sc.intel.com (localhost [127.0.0.1]) by scvm10.sc.intel.com with ESMTP id u09F0PIY009984; Sat, 9 Jan 2016 07:00:25 -0800 Subject: [PATCH 5/8] IB/rdmavt: Add destroy qp verb To: dledford@redhat.com From: Dennis Dalessandro Cc: linux-rdma@vger.kernel.org, Ira Weiny Date: Sat, 09 Jan 2016 07:00:25 -0800 Message-ID: <20160109150024.8585.25069.stgit@scvm10.sc.intel.com> In-Reply-To: <20160109145731.8585.48926.stgit@scvm10.sc.intel.com> References: <20160109145731.8585.48926.stgit@scvm10.sc.intel.com> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds in support the qp destroy verb call. Reviewed-by: Ira Weiny Signed-off-by: Dennis Dalessandro --- drivers/infiniband/sw/rdmavt/qp.c | 29 +++++++++++++++++++++++------ 1 files changed, 23 insertions(+), 6 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c index b8c7c49..6aa7d6f 100644 --- a/drivers/infiniband/sw/rdmavt/qp.c +++ b/drivers/infiniband/sw/rdmavt/qp.c @@ -1171,13 +1171,30 @@ inval: */ int rvt_destroy_qp(struct ib_qp *ibqp) { - /* - * VT-DRIVER-API: qp_flush() - * Driver provies a mechanism to flush and wait for that flush to - * finish. - */ + struct rvt_qp *qp = ibqp_to_rvtqp(ibqp); + struct rvt_dev_info *rdi = ib_to_rvt(ibqp->device); - return -EOPNOTSUPP; + spin_lock_irq(&qp->r_lock); + spin_lock(&qp->s_lock); + rvt_reset_qp(rdi, qp, ibqp->qp_type); + spin_unlock(&qp->s_lock); + spin_unlock_irq(&qp->r_lock); + + /* qpn is now available for use again */ + rvt_free_qpn(&rdi->qp_dev->qpn_table, qp->ibqp.qp_num); + + spin_lock(&rdi->n_qps_lock); + rdi->n_qps_allocated--; + spin_unlock(&rdi->n_qps_lock); + + if (qp->ip) + kref_put(&qp->ip->ref, rvt_release_mmap_info); + else + vfree(qp->r_rq.wq); + vfree(qp->s_wq); + rdi->driver_f.qp_priv_free(rdi, qp); + kfree(qp); + return 0; } int rvt_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,