From patchwork Mon Apr 20 08:38:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Wang X-Patchwork-Id: 6240661 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 6CA10BF4A6 for ; Mon, 20 Apr 2015 08:38:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 870D32035D for ; Mon, 20 Apr 2015 08:38:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 859982035B for ; Mon, 20 Apr 2015 08:38:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754589AbbDTIiF (ORCPT ); Mon, 20 Apr 2015 04:38:05 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:37260 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754523AbbDTIiE (ORCPT ); Mon, 20 Apr 2015 04:38:04 -0400 Received: by widdi4 with SMTP id di4so82440926wid.0 for ; Mon, 20 Apr 2015 01:38:02 -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=8FbyE1ftf+tZ/sQx8NadXCoG/syuNzJi/hZaxZeM/wE=; b=A5vOtn6qxbsQ1Xihr+Ht13Nk8Tapsd5G0gvS1M5nLKruJ/E1Z6ZY3e0Id3zamHd8uP 4NQuHgx6AOGmqYqMsvWXwi7ZHc7vNIwMd4nYtnDwMDwmTZNIndAXSVgAczC3FdOBAxgV XEFrxzDG0swLP551qeQnyyN4oyvKryJPh0gxnr6G50edKgiCOaw9IfskbsQACUH5C5pi k+d0hbhPpmLWxuZg9FrO63LoYJIe6fHjL1ka/CAURAYqMZx6Q3bByUn273zlJrnCQppY MNJvBXrROfTcbPh9iN3kNX+5CusFklmqdlFd+AEDV7PZnzCpBrPOAYaagQWl+GvGC0gn eECA== X-Gm-Message-State: ALoCoQl1FU9GfRUuvNvs06xFkGzHSTCTGJA3McZdvuG1VwL3jJIwNFyJtxUGq6/QIvdCN6ClB3HK X-Received: by 10.194.157.39 with SMTP id wj7mr28995284wjb.57.1429519082344; Mon, 20 Apr 2015 01:38:02 -0700 (PDT) Received: from [192.168.71.52] ([62.217.45.26]) by mx.google.com with ESMTPSA id k2sm14234618wix.4.2015.04.20.01.38.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Apr 2015 01:38:01 -0700 (PDT) Message-ID: <5534BAE8.9010805@profitbricks.com> Date: Mon, 20 Apr 2015 10:38:00 +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 , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, hal@dev.mellanox.co.il CC: Michael Wang , 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 Subject: [PATCH v5 13/27] IB/Verbs: Reserve legacy transport type in 'dev_addr' References: <5534B8C9.506@profitbricks.com> In-Reply-To: <5534B8C9.506@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 Reserve the legacy transport type for the 'transport' member of 'struct rdma_dev_addr' until we make sure this is no longer needed. 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 Reviewed-by: Ira Weiny --- drivers/infiniband/core/cma.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index ebac646..6195bf6 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -244,14 +244,35 @@ static inline void cma_set_ip_ver(struct cma_hdr *hdr, u8 ip_ver) hdr->ip_version = (ip_ver << 4) | (hdr->ip_version & 0xF); } +static inline void cma_set_legacy_transport(struct rdma_cm_id *id) +{ + switch (id->device->node_type) { + case RDMA_NODE_IB_CA: + case RDMA_NODE_IB_SWITCH: + case RDMA_NODE_IB_ROUTER: + id->route.addr.dev_addr.transport = RDMA_TRANSPORT_IB; + break; + case RDMA_NODE_RNIC: + id->route.addr.dev_addr.transport = RDMA_TRANSPORT_IWARP; + break; + case RDMA_NODE_USNIC: + id->route.addr.dev_addr.transport = RDMA_TRANSPORT_USNIC; + break; + case RDMA_NODE_USNIC_UDP: + id->route.addr.dev_addr.transport = RDMA_TRANSPORT_USNIC_UDP; + break; + default: + BUG(); + } +} + static void cma_attach_to_dev(struct rdma_id_private *id_priv, struct cma_device *cma_dev) { atomic_inc(&cma_dev->refcount); id_priv->cma_dev = cma_dev; id_priv->id.device = cma_dev->device; - id_priv->id.route.addr.dev_addr.transport = - rdma_node_get_transport(cma_dev->device->node_type); + cma_set_legacy_transport(&id_priv->id); list_add_tail(&id_priv->list, &cma_dev->id_list); }