Return-Path: Received: from mail-wg0-f46.google.com ([74.125.82.46]:35130 "EHLO mail-wg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752822AbbDGM3c (ORCPT ); Tue, 7 Apr 2015 08:29:32 -0400 Received: by wgyo15 with SMTP id o15so43388633wgy.2 for ; Tue, 07 Apr 2015 05:29:31 -0700 (PDT) Message-ID: <5523CDA7.8090902@profitbricks.com> Date: Tue, 07 Apr 2015 14:29:27 +0200 From: Michael Wang 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> Content-Type: text/plain; charset=utf-8 Sender: linux-nfs-owner@vger.kernel.org List-ID: 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); -- 2.1.0