From patchwork Sun May 18 09:38:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Or Gerlitz X-Patchwork-Id: 4197731 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EC816BEEAB for ; Sun, 18 May 2014 09:39:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2405D202DD for ; Sun, 18 May 2014 09:39:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1C628202FE for ; Sun, 18 May 2014 09:39:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751088AbaERJjD (ORCPT ); Sun, 18 May 2014 05:39:03 -0400 Received: from mailp.voltaire.com ([193.47.165.129]:49775 "EHLO mellanox.co.il" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751104AbaERJjA (ORCPT ); Sun, 18 May 2014 05:39:00 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from ogerlitz@mellanox.com) with SMTP; 18 May 2014 12:38:52 +0300 Received: from r-vnc04.mtr.labs.mlnx (r-vnc04.mtr.labs.mlnx [10.208.0.116]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id s4I9cogZ021477; Sun, 18 May 2014 12:38:51 +0300 From: Or Gerlitz To: roland@kernel.org, yishaih@mellanox.com Cc: linux-rdma@vger.kernel.org, dledford@redhat.com, matanb@mellanox.com, Or Gerlitz Subject: [PATCH libibverbs V4 5/5] Optimize ibv_create_ah link query Date: Sun, 18 May 2014 12:38:49 +0300 Message-Id: <1400405929-14313-6-git-send-email-ogerlitz@r-vnc04.mtr.labs.mlnx> X-Mailer: git-send-email 1.7.8.2 In-Reply-To: <1400405929-14313-1-git-send-email-ogerlitz@r-vnc04.mtr.labs.mlnx> References: <1400405929-14313-1-git-send-email-ogerlitz@r-vnc04.mtr.labs.mlnx> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.5 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 From: Matan Barak Since creating AH depends on resolving the MAC address for Ethernet link layer, ibv_query_port is used. This verb gives some information that is irrelevant for creating AH, but in some vendors it forces us to call kernel uverb. Therefore, we prefer using the extended verb and query only the relevant fields and by thus give the vendor more chance to optimizations. Signed-off-by: Matan Barak Signed-off-by: Or Gerlitz --- src/verbs.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/verbs.c b/src/verbs.c index 6db79e8..e022cd8 100644 --- a/src/verbs.c +++ b/src/verbs.c @@ -552,7 +552,7 @@ struct ibv_ah *__ibv_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr) int err; struct ibv_ah *ah = NULL; #ifndef NRESOLVE_NEIGH - struct ibv_port_attr port_attr; + struct ibv_port_attr_ex port_attr; int dst_family; int src_family; int oif; @@ -572,7 +572,9 @@ struct ibv_ah *__ibv_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr) goto return_ah; } - err = ibv_query_port(pd->context, attr->port_num, &port_attr); + port_attr.comp_mask = IBV_QUERY_PORT_EX_LINK_LAYER | + IBV_QUERY_PORT_EX_CAP_FLAGS; + err = ibv_query_port_ex(pd->context, attr->port_num, &port_attr); if (err) { fprintf(stderr, PFX "ibv_create_ah failed to query port.\n");