From patchwork Fri Apr 25 02:37:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 4057441 X-Patchwork-Delegate: hal@mellanox.com 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5527A9F1F4 for ; Fri, 25 Apr 2014 02:37:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5A61420380 for ; Fri, 25 Apr 2014 02:37:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DC0A72035C for ; Fri, 25 Apr 2014 02:37:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750836AbaDYChr (ORCPT ); Thu, 24 Apr 2014 22:37:47 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:53340 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750820AbaDYChq (ORCPT ); Thu, 24 Apr 2014 22:37:46 -0400 Received: by mail-wi0-f179.google.com with SMTP id z2so2007273wiv.0 for ; Thu, 24 Apr 2014 19:37:45 -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 :subject:content-type:content-transfer-encoding; bh=KWQS2+6Gq5Y6yB6p4PU5LtuN2xY5dywswvyh1uxUwlQ=; b=LzJHglDlMV7Ehxjc1aLCJH9yge0jJcrrsS32oE6UoeDlYAznyO7/5QrgpLp/uGuuya eyy0694KNsDeJ6VhP+BZRviAo9DPAH6poEM22AEAaUXnvGO9FhzQimdB1Joc3yxgLpdE ZY8XwPR/w4MUYKcr3k1UiyanL9XkTsuC29MCBiL818SD8jGTh+RFa38BzQSSsgkMmtn6 t8z+qXEFzsA7dsr7cGejL1qEH5DY4e4D5JOnsjgSdQgOQfOmF9AknIeaDO9PUDCu5rBX ZmcX0HFJWlglbYdFekSy72ms38wlgmfp1dABEZ/6FIIGHi7NbB2j5lTmabNiKZA9jDB3 asmg== X-Gm-Message-State: ALoCoQkjlBohFitegIyzKTOB90xM1NFa4y9g59VeNT79I8H/cZ++9Jh0HTfc2Tpi9smEzBwdMgQs X-Received: by 10.180.93.226 with SMTP id cx2mr1620161wib.16.1398393465481; Thu, 24 Apr 2014 19:37:45 -0700 (PDT) Received: from [192.168.1.102] (c-98-229-118-119.hsd1.ma.comcast.net. [98.229.118.119]) by mx.google.com with ESMTPSA id v6sm8882913wjv.21.2014.04.24.19.37.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Apr 2014 19:37:44 -0700 (PDT) Message-ID: <5359CA76.6040508@dev.mellanox.co.il> Date: Thu, 24 Apr 2014 22:37:42 -0400 From: Hal Rosenstock User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: "linux-rdma (linux-rdma@vger.kernel.org)" Subject: [PATCH opensm] libvendor/osm_vendor_ibumad.c: Support GRH (for GS classes) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY 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 If GRH is in incoming GS class management packet, convert umad GRH information to OpenSM GRH information. On outgoing side, convert OpenSM GRH information into umad GRH information. Note that only base port 0 (GID index 0) is supported. This is mainly for SA although other GS classes could use it (but don't). Note also that SA reports with GRH is not handled by this patch. Signed-off-by: Hal Rosenstock --- -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" 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/libvendor/osm_vendor_ibumad.c b/libvendor/osm_vendor_ibumad.c index f9d3036..e9651f6 100644 --- a/libvendor/osm_vendor_ibumad.c +++ b/libvendor/osm_vendor_ibumad.c @@ -261,9 +261,20 @@ ib_mad_addr_conv(ib_user_mad_t * umad, osm_mad_addr_t * osm_mad_addr, osm_mad_addr->addr_type.gsi.remote_qkey = ib_mad_addr->qkey; osm_mad_addr->addr_type.gsi.pkey_ix = umad_get_pkey(umad); osm_mad_addr->addr_type.gsi.service_level = ib_mad_addr->sl; - osm_mad_addr->addr_type.gsi.global_route = 0; /* FIXME: handle GRH */ - memset(&osm_mad_addr->addr_type.gsi.grh_info, 0, - sizeof osm_mad_addr->addr_type.gsi.grh_info); + if (ib_mad_addr->grh_present) { + osm_mad_addr->addr_type.gsi.global_route = 1; + osm_mad_addr->addr_type.gsi.grh_info.hop_limit = ib_mad_addr->hop_limit; + osm_mad_addr->addr_type.gsi.grh_info.ver_class_flow = + ib_grh_set_ver_class_flow(6, /* GRH version */ + ib_mad_addr->traffic_class, + ib_mad_addr->flow_label); + memcpy(&osm_mad_addr->addr_type.gsi.grh_info.dest_gid, + &ib_mad_addr->gid, 16); + } else { + osm_mad_addr->addr_type.gsi.global_route = 0; + memset(&osm_mad_addr->addr_type.gsi.grh_info, 0, + sizeof osm_mad_addr->addr_type.gsi.grh_info); + } } static void *swap_mad_bufs(osm_madw_t * p_madw, void *umad) @@ -290,6 +301,7 @@ static void *umad_receiver(void *p_ptr) osm_mad_addr_t osm_addr; osm_madw_t *p_madw, *p_req_madw; ib_mad_t *p_mad, *p_req_mad; + ib_mad_addr_t *p_mad_addr; void *umad = 0; int mad_agent, length; @@ -342,6 +354,14 @@ static void *umad_receiver(void *p_ptr) } p_mad = (ib_mad_t *) umad_get_mad(umad); + p_mad_addr = umad_get_mad_addr(umad); + /* Only support GID index 0 currently */ + if (p_mad_addr->grh_present && p_mad_addr->gid_index) { + OSM_LOG(p_ur->p_log, OSM_LOG_ERROR, "ERR 5409: " + "GRH received on GID index %d for mgmt class 0x%x\n", + p_mad_addr->gid_index, p_mad->mgmt_class); + continue; + } ib_mad_addr_conv(umad, &osm_addr, p_mad->mgmt_class == IB_MCLASS_SUBN_LID || @@ -1070,6 +1090,7 @@ osm_vendor_send(IN osm_bind_handle_t h_bind, osm_mad_addr_t *const p_mad_addr = osm_madw_get_mad_addr_ptr(p_madw); ib_mad_t *const p_mad = osm_madw_get_mad_ptr(p_madw); ib_sa_mad_t *const p_sa = (ib_sa_mad_t *) p_mad; + ib_mad_addr_t mad_addr; int ret = -1; int __attribute__((__unused__)) is_rmpp = 0; uint32_t sent_mad_size; @@ -1098,7 +1119,17 @@ osm_vendor_send(IN osm_bind_handle_t h_bind, p_mad_addr->addr_type.gsi.remote_qp, p_mad_addr->addr_type.gsi.service_level, IB_QP1_WELL_KNOWN_Q_KEY); - umad_set_grh(p_vw->umad, NULL); /* FIXME: GRH support */ + if (p_mad_addr->addr_type.gsi.global_route) { + mad_addr.grh_present = 1; + mad_addr.gid_index = 0; + mad_addr.hop_limit = p_mad_addr->addr_type.gsi.grh_info.hop_limit; + ib_grh_get_ver_class_flow(p_mad_addr->addr_type.gsi.grh_info.ver_class_flow, + NULL, &mad_addr.traffic_class, + &mad_addr.flow_label); + memcpy(&mad_addr.gid, &p_mad_addr->addr_type.gsi.grh_info.dest_gid, 16); + umad_set_grh(p_vw->umad, &mad_addr); + } else + umad_set_grh(p_vw->umad, NULL); umad_set_pkey(p_vw->umad, p_mad_addr->addr_type.gsi.pkey_ix); if (ib_class_is_rmpp(p_mad->mgmt_class)) { /* RMPP GS classes FIXME: no GRH */ if (!ib_rmpp_is_flag_set((ib_rmpp_mad_t *) p_sa,