From patchwork Wed May 10 23:23:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dasaratharaman Chandramouli X-Patchwork-Id: 9720747 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A722060364 for ; Wed, 10 May 2017 23:23:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6D262860E for ; Wed, 10 May 2017 23:23:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB68028635; Wed, 10 May 2017 23:23:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F29C2860E for ; Wed, 10 May 2017 23:23:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754587AbdEJXXU (ORCPT ); Wed, 10 May 2017 19:23:20 -0400 Received: from mga05.intel.com ([192.55.52.43]:47450 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753655AbdEJXXU (ORCPT ); Wed, 10 May 2017 19:23:20 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP; 10 May 2017 16:23:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,321,1491289200"; d="scan'208";a="1128792870" Received: from phwtpriv01.ph.intel.com ([10.228.208.76]) by orsmga001.jf.intel.com with ESMTP; 10 May 2017 16:23:19 -0700 From: Dasaratharaman Chandramouli To: Doug Ledford , linux-rdma Subject: [PATCH rdma-next 1/4] IB/CM: Convert OPA Path record to IB during CM request Date: Wed, 10 May 2017 19:23:15 -0400 Message-Id: <1494458598-6911-2-git-send-email-dasaratharaman.chandramouli@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1494458598-6911-1-git-send-email-dasaratharaman.chandramouli@intel.com> References: <1494458598-6911-1-git-send-email-dasaratharaman.chandramouli@intel.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP OPA path records need to be converted to IB path records during a connection request. If the slid/dlid fields in the OPA path records are extended, the resulting converted IB path records will have the corresponding GIDs populated as OPA GIDs Reviewed-by: Don Hiatt Reviewed-by: Ira Weiny Signed-off-by: Dasaratharaman Chandramouli --- drivers/infiniband/core/cm.c | 49 +++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 6b3b0be..9a7f4be 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c @@ -1173,8 +1173,24 @@ static void cm_format_req(struct cm_req_msg *req_msg, struct cm_id_private *cm_id_priv, struct ib_cm_req_param *param) { - struct sa_path_rec *pri_path = param->primary_path; - struct sa_path_rec *alt_path = param->alternate_path; + struct sa_path_rec *pri_path; + struct sa_path_rec *alt_path; + struct sa_path_rec conv_path; + + if (param->primary_path->rec_type == SA_PATH_REC_TYPE_OPA) { + sa_convert_path_opa_to_ib(&conv_path, param->primary_path); + pri_path = &conv_path; + } else { + pri_path = param->primary_path; + } + + if ((param->alternate_path) && + (param->alternate_path->rec_type == SA_PATH_REC_TYPE_OPA)) { + sa_convert_path_opa_to_ib(&conv_path, param->alternate_path); + alt_path = &conv_path; + } else { + alt_path = param->alternate_path; + } cm_format_mad_hdr(&req_msg->hdr, CM_REQ_ATTR_ID, cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_REQ)); @@ -2843,6 +2859,9 @@ static void cm_format_lap(struct cm_lap_msg *lap_msg, const void *private_data, u8 private_data_len) { + struct sa_path_rec conv_path; + struct sa_path_rec *path; + cm_format_mad_hdr(&lap_msg->hdr, CM_LAP_ATTR_ID, cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_LAP)); lap_msg->local_comm_id = cm_id_priv->id.local_id; @@ -2850,21 +2869,27 @@ static void cm_format_lap(struct cm_lap_msg *lap_msg, cm_lap_set_remote_qpn(lap_msg, cm_id_priv->remote_qpn); /* todo: need remote CM response timeout */ cm_lap_set_remote_resp_timeout(lap_msg, 0x1F); + if (alternate_path->rec_type == SA_PATH_REC_TYPE_OPA) { + sa_convert_path_opa_to_ib(&conv_path, alternate_path); + path = &conv_path; + } else { + path = alternate_path; + } lap_msg->alt_local_lid = - htons(ntohl(sa_path_get_slid(alternate_path))); + htons(ntohl(sa_path_get_slid(path))); lap_msg->alt_remote_lid = - htons(ntohl(sa_path_get_dlid(alternate_path))); - lap_msg->alt_local_gid = alternate_path->sgid; - lap_msg->alt_remote_gid = alternate_path->dgid; - cm_lap_set_flow_label(lap_msg, alternate_path->flow_label); - cm_lap_set_traffic_class(lap_msg, alternate_path->traffic_class); - lap_msg->alt_hop_limit = alternate_path->hop_limit; - cm_lap_set_packet_rate(lap_msg, alternate_path->rate); - cm_lap_set_sl(lap_msg, alternate_path->sl); + htons(ntohl(sa_path_get_dlid(path))); + lap_msg->alt_local_gid = path->sgid; + lap_msg->alt_remote_gid = path->dgid; + cm_lap_set_flow_label(lap_msg, path->flow_label); + cm_lap_set_traffic_class(lap_msg, path->traffic_class); + lap_msg->alt_hop_limit = path->hop_limit; + cm_lap_set_packet_rate(lap_msg, path->rate); + cm_lap_set_sl(lap_msg, path->sl); cm_lap_set_subnet_local(lap_msg, 1); /* local only... */ cm_lap_set_local_ack_timeout(lap_msg, cm_ack_timeout(cm_id_priv->av.port->cm_dev->ack_delay, - alternate_path->packet_life_time)); + path->packet_life_time)); if (private_data && private_data_len) memcpy(lap_msg->private_data, private_data, private_data_len);