From patchwork Mon Apr 13 12:22:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Wang X-Patchwork-Id: 6207601 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 1C0469F313 for ; Mon, 13 Apr 2015 12:22:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3F135202E6 for ; Mon, 13 Apr 2015 12:22:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 56CB3202B4 for ; Mon, 13 Apr 2015 12:22:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754082AbbDMMWl (ORCPT ); Mon, 13 Apr 2015 08:22:41 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:35487 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752109AbbDMMWk (ORCPT ); Mon, 13 Apr 2015 08:22:40 -0400 Received: by widdi4 with SMTP id di4so69924692wid.0 for ; Mon, 13 Apr 2015 05:22:39 -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=ohm3eC8BAQcrMPGtinNLEdeFSOhjRG7DJp/3kB9xW6A=; b=PKRxsfhCRaC1DsIFh5LGvcBC0O3dj4raSgaKtg/UfqyuQ1kFUGp9v8ablaO5Rw4/QT 1US0Ee+cY9As3AqlWBDBlkznTxvv5MDBmU3ShT6D//uYSEh0u3xmGOjjX9dWF/4Fny5Y a7Ax0hH63046X/RRtzOQPz6wn5ntKouHf7iWd+IhC0cbbS1zGOACv3Y+/RV3mXlcoN9e jm/YhMhyWSoZc8w8yvp8jNq6/bbrEh0eEmomziMIlvYlOAqL/EyLZob4Ljz/26twJVFC uL9O0Aq/HrsIMPpZZY6nJoT57P23kwSBNAgIBhZosENJ1n27hFO8reCYPt1dwjfbVar3 KkPg== X-Gm-Message-State: ALoCoQl0uCdilXVUUheJu587kZomOeilpc6FLE+Yy5BbrewtY9JvyeyEH2tsaZdAJFZ3q9VaFIKn X-Received: by 10.195.12.97 with SMTP id ep1mr28013021wjd.134.1428927759298; Mon, 13 Apr 2015 05:22:39 -0700 (PDT) Received: from [192.168.71.52] ([62.217.45.26]) by mx.google.com with ESMTPSA id n1sm11297131wix.0.2015.04.13.05.22.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Apr 2015 05:22:38 -0700 (PDT) Message-ID: <552BB50C.4080402@profitbricks.com> Date: Mon, 13 Apr 2015 14:22:36 +0200 From: Michael Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Roland Dreier , Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org CC: Tom Tucker , Steve Wise , Hoang-Nam Nguyen , Christoph Raisch , Mike Marciniszyn , Eli Cohen , Faisal Latif , Jack Morgenstein , Or Gerlitz , Haggai Eran , Ira Weiny , Tom Talpey , Jason Gunthorpe , Doug Ledford , Michael Wang Subject: [PATCH v3 02/28] IB/Verbs: Implement raw management helpers References: <552BB470.4090407@profitbricks.com> In-Reply-To: <552BB470.4090407@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_tech_ib rdma_tech_iboe rdma_tech_iwarp rdma_ib_or_iboe (transition, clean up later) To help us detect which technology the port supported. Cc: Steve Wise Cc: Tom Talpey 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..a12e876 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_tech_ib(struct ib_device *device, u8 port_num) +{ + return device->query_transport(device, port_num) + == RDMA_TRANSPORT_IB; +} + +static inline int rdma_tech_iboe(struct ib_device *device, u8 port_num) +{ + return device->query_transport(device, port_num) + == RDMA_TRANSPORT_IBOE; +} + +static inline int rdma_tech_iwarp(struct ib_device *device, u8 port_num) +{ + return device->query_transport(device, port_num) + == RDMA_TRANSPORT_IWARP; +} + +static inline int rdma_ib_or_iboe(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);