From patchwork Fri Apr 24 12:23:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Wang X-Patchwork-Id: 6270091 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 AF728BF4A6 for ; Fri, 24 Apr 2015 12:33:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BC95520268 for ; Fri, 24 Apr 2015 12:33:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BCB5E2026F for ; Fri, 24 Apr 2015 12:33:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753517AbbDXMYB (ORCPT ); Fri, 24 Apr 2015 08:24:01 -0400 Received: from mail-wg0-f42.google.com ([74.125.82.42]:36156 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753414AbbDXMX6 (ORCPT ); Fri, 24 Apr 2015 08:23:58 -0400 Received: by wgen6 with SMTP id n6so48716447wge.3 for ; Fri, 24 Apr 2015 05:23:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ph5zlMzw+bE+9J599GYazR44D9eNDr1BxmErCBQvyAM=; b=URK40UUTg1R7JfNJASIGrRFYIa/fOvxchL+bCk7zO02i4hbvrjzPycyPQ++a41a7qz qcOVrWH/RVCUMB1T+owsSliJ28aljZspLpjBMc68bijlfDrQARJpUECQI8rm6Zy4iSuB 8akVbSTvqWsR3QUwtVqEWb/pVpUIio4Qvb+Ql9UIyrSMO/GfQ8IsE8inUposGiMYyhoW Ha1QZl03HBRz0sru97EL7eVuiNORkYxXc7jVNnmFEkd7/vZQua+L1fLAbigGxT/P/vfH ouxjhsxAWlXMAdl13xHw66CCniveQYnrDc06eU3MUBpcKiVikCu3S4+Qj2u7g/jwx1xD msIQ== X-Gm-Message-State: ALoCoQktNQEtQhv3BEuzkIJZqdzXNm9Mmc4uHZPYJatx6sDNmjNZZtr/yd5jvii+IBAmF1PO43ln X-Received: by 10.180.96.227 with SMTP id dv3mr3448303wib.53.1429878237691; Fri, 24 Apr 2015 05:23:57 -0700 (PDT) Received: from ubuntu.pb.local ([62.217.45.26]) by mx.google.com with ESMTPSA id m4sm16704020wjb.25.2015.04.24.05.23.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Apr 2015 05:23:56 -0700 (PDT) From: Michael Wang To: Roland Dreier , Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Michael Wang , Steve Wise , Tom Talpey , Jason Gunthorpe , Doug Ledford , Ira Weiny , Tom Tucker , Hoang-Nam Nguyen , Christoph Raisch , Mike Marciniszyn , Eli Cohen , Faisal Latif , Jack Morgenstein , Or Gerlitz , Haggai Eran Subject: [PATCH v6 02/26] IB/Verbs: Implement raw management helpers Date: Fri, 24 Apr 2015 14:23:26 +0200 Message-Id: <1429878230-11749-3-git-send-email-yun.wang@profitbricks.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1429878230-11749-1-git-send-email-yun.wang@profitbricks.com> References: <1429878230-11749-1-git-send-email-yun.wang@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=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY, URIBL_BLACK 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: Hal Rosenstock 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);