From patchwork Fri Apr 24 12:23:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Wang X-Patchwork-Id: 6269991 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 0CB9D9F398 for ; Fri, 24 Apr 2015 12:31:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 358E9202D1 for ; Fri, 24 Apr 2015 12:31:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 24EE020268 for ; Fri, 24 Apr 2015 12:31:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757634AbbDXMb1 (ORCPT ); Fri, 24 Apr 2015 08:31:27 -0400 Received: from mail-wg0-f53.google.com ([74.125.82.53]:36615 "EHLO mail-wg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754020AbbDXMYU (ORCPT ); Fri, 24 Apr 2015 08:24:20 -0400 Received: by wgen6 with SMTP id n6so48727330wge.3 for ; Fri, 24 Apr 2015 05:24:19 -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=NPk7vQ++w3Wm4/4lZ7B+hlAs4LlWVSLfdX6TnQb/p6w=; b=fTued59Y2JFGoqj7zCwDeGsYMPQcNqmpyDQJdnZKTTIib913Ob1Xec3zjVsk3JK/c0 fz4349gpYb4PhB7eRCqO/mACKjpVXw5Xy/FtCc+Lp3RIQ6cSpYDyoT2lZgHot4TRTob0 oz1ro8Ev0bpZ+VdGia8nMm7ROhVsTUQ5c/CQ8SFxG7TL+YL+ZLpdgeu6ahG+Kq9knbAD nsZTQHPTz328kvjbs22nnCHGx1H4Z9QjOhYKx/HpLGZN0IzhpAR4Ravf4xrP9AMeVLxG UfzPR/DIOe0Pk9GsRLU3jtPva9WjIedPi+qRr/Ct1vB4N76jQQUMbvqtnN5i5VGrDHe5 JAjw== X-Gm-Message-State: ALoCoQlI0i5JsmScOGtnvbs5FYpu8WS4Tpoc4mHBeVV7TfohUyFSuEcRf4pIc+xWT/ly/X8ycpdv X-Received: by 10.194.79.9 with SMTP id f9mr15605120wjx.20.1429878259269; Fri, 24 Apr 2015 05:24:19 -0700 (PDT) Received: from ubuntu.pb.local ([62.217.45.26]) by mx.google.com with ESMTPSA id m4sm16704020wjb.25.2015.04.24.05.24.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Apr 2015 05:24:18 -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 13/26] IB/Verbs: Reserve legacy transport type in 'dev_addr' Date: Fri, 24 Apr 2015 14:23:37 +0200 Message-Id: <1429878230-11749-14-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=unavailable 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 --- 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 a89c246..e47284e 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); }