From patchwork Fri May 22 21:43:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arlin Davis X-Patchwork-Id: 6469011 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 381FFC0020 for ; Fri, 22 May 2015 21:43:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5F6FC2052C for ; Fri, 22 May 2015 21:43:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 791B920426 for ; Fri, 22 May 2015 21:43:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757254AbbEVVnQ (ORCPT ); Fri, 22 May 2015 17:43:16 -0400 Received: from mga03.intel.com ([134.134.136.65]:5277 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757548AbbEVVnQ convert rfc822-to-8bit (ORCPT ); Fri, 22 May 2015 17:43:16 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 22 May 2015 14:43:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,478,1427785200"; d="scan'208";a="730450738" Received: from orsmsx108.amr.corp.intel.com ([10.22.240.6]) by fmsmga002.fm.intel.com with ESMTP; 22 May 2015 14:43:06 -0700 Received: from orsmsx151.amr.corp.intel.com (10.22.226.38) by ORSMSX108.amr.corp.intel.com (10.22.240.6) with Microsoft SMTP Server (TLS) id 14.3.224.2; Fri, 22 May 2015 14:43:05 -0700 Received: from orsmsx101.amr.corp.intel.com ([169.254.8.102]) by ORSMSX151.amr.corp.intel.com ([169.254.7.160]) with mapi id 14.03.0224.002; Fri, 22 May 2015 14:43:06 -0700 From: "Davis, Arlin R" To: "linux-rdma@vger.kernel.org" Subject: [PATCH 2/5] dapl ucm: check for AH caching when destroying via UD extension Thread-Topic: [PATCH 2/5] dapl ucm: check for AH caching when destroying via UD extension Thread-Index: AdCUyUbLNJPINWwTTNOB3vAS5d0iuQ== Date: Fri, 22 May 2015 21:43:06 +0000 Message-ID: <54347E5A035A054EAE9D05927FB467F977D76B90@ORSMSX101.amr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.22.254.139] 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, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 From: Arlin Davis Signed-off-by: Arlin Davis --- dapl/openib_common/ib_extensions.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/dapl/openib_common/ib_extensions.c b/dapl/openib_common/ib_extensions.c index fc03d9c..25db541 100644 --- a/dapl/openib_common/ib_extensions.c +++ b/dapl/openib_common/ib_extensions.c @@ -202,7 +202,6 @@ dapl_extensions(IN DAT_HANDLE dat_handle, status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP); else { - cm->ah = NULL; /* consumer will free AH */ status = dapls_ud_cm_free(ep, cm); } break; @@ -210,6 +209,7 @@ dapl_extensions(IN DAT_HANDLE dat_handle, case DAT_IB_UD_AH_FREE_OP: { DAT_IB_ADDR_HANDLE *dat_ah; + uint16_t lid; int ret; dapl_dbg_log(DAPL_DBG_TYPE_RTN, @@ -222,8 +222,18 @@ dapl_extensions(IN DAT_HANDLE dat_handle, status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP); } else { + lid = ntohs(((union dcm_addr *)&dat_ah->ia_addr)->ib.lid); + + if (lid > DCM_AH_SPACE) { + status = DAT_ERROR(DAT_INVALID_PARAMETER, + DAT_INVALID_ARG2); + break; + } + errno = 0; - ret = ibv_destroy_ah(dat_ah->ah); + if (!((DAPL_EP *)ep)->qp_handle->ah[lid]) + ret = ibv_destroy_ah(dat_ah->ah); + status = dapl_convert_errno(errno, "destroy_ah"); } break;