From patchwork Wed Jan 7 20:00:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wan, Kaike" X-Patchwork-Id: 5588031 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 7A58FBF6C3 for ; Wed, 7 Jan 2015 20:00:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A2A1F20389 for ; Wed, 7 Jan 2015 20:00:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A9AE520383 for ; Wed, 7 Jan 2015 20:00:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754488AbbAGUA1 (ORCPT ); Wed, 7 Jan 2015 15:00:27 -0500 Received: from mga01.intel.com ([192.55.52.88]:38926 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754478AbbAGUA0 (ORCPT ); Wed, 7 Jan 2015 15:00:26 -0500 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 07 Jan 2015 12:00:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,691,1406617200"; d="scan'208";a="508941170" Received: from phlsvsds.ph.intel.com ([10.228.195.38]) by orsmga003.jf.intel.com with ESMTP; 07 Jan 2015 11:54:41 -0800 Received: from phlsvsds.ph.intel.com (localhost.localdomain [127.0.0.1]) by phlsvsds.ph.intel.com (8.13.8/8.13.8) with ESMTP id t07K0ORD019631; Wed, 7 Jan 2015 15:00:24 -0500 Received: (from kaikewan@localhost) by phlsvsds.ph.intel.com (8.13.8/8.13.8/Submit) id t07K0Owb019628; Wed, 7 Jan 2015 15:00:24 -0500 X-Authentication-Warning: phlsvsds.ph.intel.com: kaikewan set sender to kaike.wan@intel.com using -f From: kaike.wan@intel.com To: sean.hefty@intel.com Cc: linux-rdma@vger.kernel.org, Kaike Wan Subject: [PATCH 1/1] ibacm: open only prov endpoints with name/addr configured Date: Wed, 7 Jan 2015 15:00:21 -0500 Message-Id: <1420660821-19596-1-git-send-email-kaike.wan@intel.com> X-Mailer: git-send-email 1.7.1 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: Kaike Wan This patch modifies the ibacm core so that it will request the provider to open those endpoints that have been assigned with at least one name or address. This change will avoid unnecessary endpoint open and close for those without any name/address configured by the administrator. Signed-off-by: Kaike Wan --- src/acm.c | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/acm.c b/src/acm.c index 2d0d2e1..815a916 100644 --- a/src/acm.c +++ b/src/acm.c @@ -1517,6 +1517,17 @@ acm_ep_insert_addr(struct acmc_ep *ep, const char *name, uint8_t *addr, goto out; } + /* Open the provider endpoint only if at least a name or + address is found */ + if (!ep->prov_ep_context) { + ret = ep->port->prov->open_endpoint(&ep->endpoint, + ep->port->prov_port_context, + &ep->prov_ep_context); + if (ret) { + acm_log(0, "Error: failed to open prov ep\n"); + goto out; + } + } ep->addr_info[i].addr.type = addr_type; strncpy(ep->addr_info[i].string_buf, name, ACM_MAX_ADDRESS); memcpy(ep->addr_info[i].addr.info.addr, tmp, ACM_MAX_ADDRESS); @@ -1735,12 +1746,6 @@ static void acm_ep_up(struct acmc_port *port, uint16_t pkey) if (!ep) return; - if (port->prov->open_endpoint(&ep->endpoint, port->prov_port_context, - &ep->prov_ep_context)) { - acm_log(0, "Error -- failed to open prov endpoint\n"); - goto err; - } - ret = acm_assign_ep_names(ep); if (ret) { acm_log(0, "ERROR - unable to assign EP name for pkey 0x%x\n", pkey); @@ -1751,9 +1756,9 @@ static void acm_ep_up(struct acmc_port *port, uint16_t pkey) return; ep_close: - port->prov->close_endpoint(ep->prov_ep_context); + if (ep->prov_ep_context) + port->prov->close_endpoint(ep->prov_ep_context); -err: free(ep); }