Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757628AbbDXMb1 (ORCPT ); Fri, 24 Apr 2015 08:31:27 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:37351 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754027AbbDXMYU (ORCPT ); Fri, 24 Apr 2015 08:24:20 -0400 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2167 Lines: 66 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); } -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/