From patchwork Tue Apr 28 15:10:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Wang X-Patchwork-Id: 6290081 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 EE07F9F1C2 for ; Tue, 28 Apr 2015 15:10:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 11DA520254 for ; Tue, 28 Apr 2015 15:10:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 06D4820225 for ; Tue, 28 Apr 2015 15:10:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030223AbbD1PKe (ORCPT ); Tue, 28 Apr 2015 11:10:34 -0400 Received: from mail-wg0-f47.google.com ([74.125.82.47]:32801 "EHLO mail-wg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965808AbbD1PKc (ORCPT ); Tue, 28 Apr 2015 11:10:32 -0400 Received: by wgin8 with SMTP id n8so154907281wgi.0 for ; Tue, 28 Apr 2015 08:10: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:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VO6Kjglb7KwXCTAbF08OJ3Q8gHeg1rYmKKlLCZnDbLM=; b=Qfn6cg2r4CmCC83Rymhj8MTuKDv9+ssXf0xcENf9taAW6C6SjG3czcCJ882nk+n17n BkrPIqxuIN6lfaZdlBB4jtw0WY7KZrZAaBuc+tQpedScWSUE/JGzpBOJbv3yjUa+V+SV csq/85mmVG7s50qsnzWrtF3biXMyZ+BlImOGzyQq1Dqn1boFhPA9UgcMmbIUGGSZ/BHx Ip4UP6LSGO/IbU0okVHmp+upsh8HPrqAHTsjElFQL3cdfnpvvTWYl+1DgCNsmiVMzV94 0yaZRuIl/np9NtQ3Xi43TFyRoFcYxYXTQSKQtfa5NykQ/pFoASU5qwGQvLeqnNk5yYW5 CJIg== X-Gm-Message-State: ALoCoQlTy1znYlYdaQ5IQR2lHBABRYBrd3PP9KXWXRHF4I2DVooK8qzk3BzmET7qhDWW/DEP1WIQ X-Received: by 10.180.94.100 with SMTP id db4mr43470wib.26.1430233831103; Tue, 28 Apr 2015 08:10:31 -0700 (PDT) Received: from ubuntu.pb.local ([62.217.45.26]) by mx.google.com with ESMTPSA id be3sm16820459wib.21.2015.04.28.08.10.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Apr 2015 08:10:30 -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 , Devesh Sharma , Liran Liss , Dave Goodell Subject: [PATCH v7 02/23] IB/Verbs: Implement raw management helpers Date: Tue, 28 Apr 2015 17:10:02 +0200 Message-Id: <1430233823-7075-3-git-send-email-yun.wang@profitbricks.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1430233823-7075-1-git-send-email-yun.wang@profitbricks.com> References: <1430233823-7075-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=-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_protocol_ib rdma_protocol_iboe rdma_protocol_iwarp rdma_ib_or_iboe 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 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 080f204..acdba60 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -1752,6 +1752,28 @@ 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_protocol_ib(struct ib_device *device, u8 port_num) +{ + return device->query_protocol(device, port_num) == RDMA_PROTOCOL_IB; +} + +static inline int rdma_protocol_iboe(struct ib_device *device, u8 port_num) +{ + return device->query_protocol(device, port_num) == RDMA_PROTOCOL_IBOE; +} + +static inline int rdma_protocol_iwarp(struct ib_device *device, u8 port_num) +{ + return device->query_protocol(device, port_num) == RDMA_PROTOCOL_IWARP; +} + +static inline int rdma_ib_or_iboe(struct ib_device *device, u8 port_num) +{ + enum rdma_protocol_type pt = device->query_protocol(device, port_num); + + return (pt == RDMA_PROTOCOL_IB || pt == RDMA_PROTOCOL_IBOE); +} + int ib_query_gid(struct ib_device *device, u8 port_num, int index, union ib_gid *gid);