From patchwork Mon Sep 24 23:55:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Hefty X-Patchwork-Id: 186631 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id F15B42C008D for ; Tue, 25 Sep 2012 09:57:03 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752160Ab2IXX45 (ORCPT ); Mon, 24 Sep 2012 19:56:57 -0400 Received: from mga09.intel.com ([134.134.136.24]:26227 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751651Ab2IXXzg convert rfc822-to-8bit (ORCPT ); Mon, 24 Sep 2012 19:55:36 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 24 Sep 2012 16:55:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,478,1344236400"; d="scan'208";a="197189765" Received: from orsmsx105.amr.corp.intel.com ([10.22.225.132]) by orsmga001.jf.intel.com with ESMTP; 24 Sep 2012 16:55:35 -0700 Received: from orsmsx152.amr.corp.intel.com (10.22.226.39) by ORSMSX105.amr.corp.intel.com (10.22.225.132) with Microsoft SMTP Server (TLS) id 14.1.355.2; Mon, 24 Sep 2012 16:55:35 -0700 Received: from orsmsx101.amr.corp.intel.com ([169.254.8.152]) by ORSMSX152.amr.corp.intel.com ([169.254.8.137]) with mapi id 14.01.0355.002; Mon, 24 Sep 2012 16:55:35 -0700 From: "Hefty, Sean" To: "linux-rdma (linux-rdma@vger.kernel.org)" , "netdev@vger.kernel.org" Subject: [PATCH 18/26 v3] rdma/ucm: Support querying when IB paths are not reversible Thread-Topic: [PATCH 18/26 v3] rdma/ucm: Support querying when IB paths are not reversible Thread-Index: Ac2ajq5lME1uZu9iTz67d0lIM8o3PQ== Date: Mon, 24 Sep 2012 23:55:34 +0000 Message-ID: <1828884A29C6694DAF28B7E6B8A8237346A8F131@ORSMSX101.amr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.22.254.140] MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The current query_route call can return up to two path records. The assumption being that one is the primary path, with optional support for an alternate path. In both cases, the paths are assumed to be reversible and are used to send CM MADs. With the ability to manually set IB path data, the rdma cm can eventually be capable of using up to 6 paths per connection: forward primary, reverse primary, forward alternate, reverse alternate, reversible primary path for CM MADs reversible alternate path for CM MADs. (It is unclear at this time if IB routing will complicate this.) In order to handle more flexible routing topologies, add a new command to report any number of paths. Signed-off-by: Sean Hefty --- resending with netdev copied drivers/infiniband/core/ucma.c | 35 +++++++++++++++++++++++++++++++++++ include/rdma/rdma_user_cm.h | 9 ++++++++- 2 files changed, 43 insertions(+), 1 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index b9ce266..9b60338 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c @@ -767,6 +767,38 @@ static ssize_t ucma_query_addr(struct ucma_context *ctx, return ret; } +static ssize_t ucma_query_path(struct ucma_context *ctx, + void __user *response, int out_len) +{ + struct rdma_ucm_query_path_resp *resp; + int i, ret = 0; + + if (out_len < sizeof(*resp)) + return -ENOSPC; + + resp = kzalloc(out_len, GFP_KERNEL); + if (!resp) + return -ENOMEM; + + resp->num_paths = ctx->cm_id->route.num_paths; + for (i = 0, out_len -= sizeof(*resp); + i < resp->num_paths && out_len > sizeof(struct ib_path_rec_data); + i++, out_len -= sizeof(struct ib_path_rec_data)) { + + resp->path_data[i].flags = IB_PATH_GMP | IB_PATH_PRIMARY | + IB_PATH_BIDIRECTIONAL; + ib_sa_pack_path(&ctx->cm_id->route.path_rec[i], + &resp->path_data[i].path_rec); + } + + if (copy_to_user(response, resp, + sizeof(*resp) + (i * sizeof(struct ib_path_rec_data)))) + ret = -EFAULT; + + kfree(resp); + return ret; +} + static ssize_t ucma_query(struct ucma_file *file, const char __user *inbuf, int in_len, int out_len) @@ -788,6 +820,9 @@ static ssize_t ucma_query(struct ucma_file *file, case RDMA_USER_CM_QUERY_ADDR: ret = ucma_query_addr(ctx, response, out_len); break; + case RDMA_USER_CM_QUERY_PATH: + ret = ucma_query_path(ctx, response, out_len); + break; default: ret = -ENOSYS; break; diff --git a/include/rdma/rdma_user_cm.h b/include/rdma/rdma_user_cm.h index 4037c48..effcb75 100644 --- a/include/rdma/rdma_user_cm.h +++ b/include/rdma/rdma_user_cm.h @@ -115,7 +115,8 @@ struct rdma_ucm_resolve_route { }; enum { - RDMA_USER_CM_QUERY_ADDR + RDMA_USER_CM_QUERY_ADDR, + RDMA_USER_CM_QUERY_PATH }; struct rdma_ucm_query { @@ -145,6 +146,12 @@ struct rdma_ucm_query_addr_resp { struct sockaddr_storage dst_addr; }; +struct rdma_ucm_query_path_resp { + __u32 num_paths; + __u32 reserved; + struct ib_path_rec_data path_data[0]; +}; + struct rdma_ucm_conn_param { __u32 qp_num; __u32 qkey;