From patchwork Tue Apr 7 12:29:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Wang X-Patchwork-Id: 6169541 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 071659F2EC for ; Tue, 7 Apr 2015 12:29:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 199A3202C8 for ; Tue, 7 Apr 2015 12:29:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2A28A202A1 for ; Tue, 7 Apr 2015 12:29:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753303AbbDGM3e (ORCPT ); Tue, 7 Apr 2015 08:29:34 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:33997 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753244AbbDGM3c (ORCPT ); Tue, 7 Apr 2015 08:29:32 -0400 Received: by widjs5 with SMTP id js5so9605349wid.1 for ; Tue, 07 Apr 2015 05:29:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=rm6QA7F3mLF00+vIuQksP4ICaak5zVQjzoIs71FHLyE=; b=nDfO1j5aFQhumuKgyLtAuLo8tZMNWh2RwjhH6kJDPSlfrZY9cGRexJfvfOuWYo2Snu XSmxmNPR+A6hNGgB4WNZ+6NeN/EVZu8tCbllV8PuT4FIattCPMLD/J0ldMU9Qen+pAZs LE0j5WH6cd76WLfZer2gifKppdDb+6eE/cjpuA5X949I6CliwYQqCgqQSFuDiHFfJR0P E56ZglpXH7kFtC0g8O5nTmt3iXn3dkMBS3WmEXOS5QtEAvpJ9bbeXTRKax50XimI2FKz hRHAk9crF80sCqfx8f+fARzBkxKCm6EdA3BZrJgaLCVYRyKjJXW5PAxKjyjzqiE16xYA IXTQ== X-Gm-Message-State: ALoCoQn3hpXcjIR2JEss6zbHE7pZJafLonSKP1XeRlaWxh1CMQaxbLSpsIyvOUN2kAnAdmfLlQAD X-Received: by 10.180.211.2 with SMTP id my2mr4123481wic.78.1428409770588; Tue, 07 Apr 2015 05:29:30 -0700 (PDT) Received: from [192.168.71.52] ([62.217.45.26]) by mx.google.com with ESMTPSA id dr7sm10808733wib.22.2015.04.07.05.29.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Apr 2015 05:29:29 -0700 (PDT) Message-ID: <5523CDA7.8090902@profitbricks.com> Date: Tue, 07 Apr 2015 14:29:27 +0200 From: Michael Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Roland Dreier , Sean Hefty , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, netdev@vger.kernel.org CC: Hal Rosenstock , Tom Tucker , Steve Wise , Hoang-Nam Nguyen , Christoph Raisch , Mike Marciniszyn , Eli Cohen , Faisal Latif , Upinder Malhi , Trond Myklebust , "J. Bruce Fields" , "David S. Miller" , Ira Weiny , PJ Waskiewicz , Tatyana Nikolova , Or Gerlitz , Jack Morgenstein , Haggai Eran , Ilya Nelkenbaum , Yann Droneaud , Bart Van Assche , Shachar Raindel , Sagi Grimberg , Devesh Sharma , Matan Barak , Moni Shoua , Jiri Kosina , Selvin Xavier , Mitesh Ahuja , Li RongQing , Rasmus Villemoes , Alex Estrin , Doug Ledford , Eric Dumazet , Erez Shitrit , Tom Gundersen , Chuck Lever , Michael Wang Subject: [PATCH v2 02/17] IB/Verbs: Implement raw management helpers References: <5523CCD5.6030401@profitbricks.com> In-Reply-To: <5523CCD5.6030401@profitbricks.com> 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=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 Add raw helpers: rdma_transport_ib rdma_transport_iboe rdma_transport_iwarp rdma_ib_mgmt To help us checking transport type. Cc: Jason Gunthorpe Cc: Doug Ledford Cc: Ira Weiny Cc: Sean Hefty Signed-off-by: Michael Wang --- include/rdma/ib_verbs.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index d54f91e..780b3b7 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -1748,6 +1748,31 @@ int ib_query_port(struct ib_device *device, enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, u8 port_num); +static inline int rdma_transport_ib(struct ib_device *device, u8 port_num) +{ + return device->query_transport(device, port_num) + == RDMA_TRANSPORT_IB; +} + +static inline int rdma_transport_iboe(struct ib_device *device, u8 port_num) +{ + return device->query_transport(device, port_num) + == RDMA_TRANSPORT_IBOE; +} + +static inline int rdma_transport_iwarp(struct ib_device *device, u8 port_num) +{ + return device->query_transport(device, port_num) + == RDMA_TRANSPORT_IWARP; +} + +static inline int rdma_ib_mgmt(struct ib_device *device, u8 port_num) +{ + enum rdma_transport_type tp = device->query_transport(device, port_num); + + return (tp == RDMA_TRANSPORT_IB || tp == RDMA_TRANSPORT_IBOE); +} + int ib_query_gid(struct ib_device *device, u8 port_num, int index, union ib_gid *gid);