From patchwork Thu Apr 8 13:29:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yevgeny Kliteynik X-Patchwork-Id: 91269 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o38DT3N7009273 for ; Thu, 8 Apr 2010 13:29:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758608Ab0DHN3I (ORCPT ); Thu, 8 Apr 2010 09:29:08 -0400 Received: from mail.mellanox.co.il ([194.90.237.43]:51447 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750771Ab0DHN3H (ORCPT ); Thu, 8 Apr 2010 09:29:07 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from kliteyn@dev.mellanox.co.il) with SMTP; 8 Apr 2010 16:29:03 +0300 Received: from [10.4.1.29] ([10.4.1.29]) by mtlexch01.mtl.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 8 Apr 2010 16:29:02 +0300 Message-ID: <4BBDDA1E.7030102@dev.mellanox.co.il> Date: Thu, 08 Apr 2010 16:29:02 +0300 From: Yevgeny Kliteynik User-Agent: Thunderbird 1.5.0.5 (X11/20060719) MIME-Version: 1.0 To: Sasha Khapyorsky CC: Linux RDMA , Jim Schut Subject: [PATCH 1/4] opensm: added function that dumps PathRecords X-OriginalArrivalTime: 08 Apr 2010 13:29:02.0894 (UTC) FILETIME=[74518CE0:01CAD71F] X-TM-AS-Product-Ver: SMEX-8.0.0.1181-6.000.1038-17306.007 X-TM-AS-Result: No--9.317700-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 08 Apr 2010 13:29:10 +0000 (UTC) diff --git a/opensm/include/opensm/osm_sa.h b/opensm/include/opensm/osm_sa.h index d516310..40622ff 100644 --- a/opensm/include/opensm/osm_sa.h +++ b/opensm/include/opensm/osm_sa.h @@ -462,6 +462,27 @@ int osm_sa_db_file_load(struct osm_opensm *p_osm); * *********/ +/****f* OpenSM: SA/osm_sa_path_records_file_dump +* NAME +* osm_sa_path_records_file_dump +* +* DESCRIPTION +* Dumps the SA Path Records to the dump file. +* +* SYNOPSIS +*/ +int osm_sa_path_records_file_dump(struct osm_opensm *p_osm); +/* +* PARAMETERS +* p_osm +* [in] Pointer to an osm_opensm_t object. +* +* RETURN VALUES +* 0 on success +* !0 if some error occurred. +* +*********/ + /****f* OpenSM: MC Member Record Receiver/osm_mcmr_rcv_find_or_create_new_mgrp * NAME * osm_mcmr_rcv_find_or_create_new_mgrp diff --git a/opensm/opensm/osm_sa.c b/opensm/opensm/osm_sa.c index 8aab548..83da258 100644 --- a/opensm/opensm/osm_sa.c +++ b/opensm/opensm/osm_sa.c @@ -718,6 +718,87 @@ int osm_sa_db_file_dump(osm_opensm_t * p_osm) return res; } +typedef struct _path_parms { + ib_net16_t pkey; + uint8_t mtu; + uint8_t rate; + uint8_t sl; + uint8_t pkt_life; + boolean_t reversible; +} path_parms_t; + +extern ib_api_status_t osm_get_path_params(IN osm_sa_t * sa, + IN const osm_port_t * p_src_port, + IN const osm_port_t * p_dest_port, + IN const uint16_t dlid_ho, + OUT path_parms_t * p_parms); + +static void sa_dump_path_records(osm_opensm_t * p_osm, FILE * file) +{ + osm_port_t *p_src_port; + osm_port_t *p_dest_port; + osm_node_t *p_node; + uint16_t dlid_ho; + uint32_t vector_size; + osm_physp_t *p_physp; + path_parms_t path_parms; + ib_api_status_t status; + + vector_size = cl_ptr_vector_get_size(&p_osm->subn.port_lid_tbl); + for (p_src_port = (osm_port_t *) cl_qmap_head(&p_osm->subn.port_guid_tbl); + p_src_port != (osm_port_t *) cl_qmap_end(&p_osm->subn.port_guid_tbl); + p_src_port = (osm_port_t *) cl_qmap_next(&p_src_port->map_item)) { + + p_node = p_src_port->p_node; + if (p_node->node_info.node_type == IB_NODE_TYPE_SWITCH) + return; + + p_physp = p_src_port->p_physp; + CL_ASSERT(p_physp->p_remote_physp); + + fprintf(file, "%s 0x%016" PRIx64 ", base LID %d, " + "\"%s\", port %d\n# LID : SL : MTU : RATE\n", + ib_get_node_type_str(p_node->node_info.node_type), + cl_ntoh64(p_src_port->guid), + cl_ntoh16(osm_port_get_base_lid(p_src_port)), + p_node->print_desc, p_physp->port_num); + + memset(&path_parms, 0, sizeof(path_parms_t)); + + for (dlid_ho = 1; dlid_ho < vector_size; dlid_ho++) { + + p_dest_port = (osm_port_t *) cl_ptr_vector_get( + &p_osm->subn.port_lid_tbl, dlid_ho); + + if (!p_dest_port || !p_dest_port->p_node || + p_dest_port->p_node->node_info.node_type == + IB_NODE_TYPE_SWITCH) + continue; + + status = osm_get_path_params(&p_osm->sa, + p_src_port, p_dest_port, dlid_ho, + (void*)&path_parms); + + if (!status) + fprintf(file, "0x%04X : %-2d : %-3d : %-4d\n", + dlid_ho, path_parms.sl, + path_parms.mtu, path_parms.rate); + else + fprintf(file, "0x%04X : UNREACHABLE\n", + dlid_ho); + } + fprintf(file, "\n"); + } +} + + +int osm_sa_path_records_file_dump(osm_opensm_t * p_osm) +{ + return opensm_dump_to_file(p_osm, p_osm->subn.opt.path_rec_file ? + p_osm->subn.opt.path_rec_file : "opensm-path-records.dump", + sa_dump_path_records); +} + /* * SA DB Loader */ diff --git a/opensm/opensm/osm_sa_path_record.c b/opensm/opensm/osm_sa_path_record.c index c4c3f86..b168428 100644 --- a/opensm/opensm/osm_sa_path_record.c +++ b/opensm/opensm/osm_sa_path_record.c @@ -743,6 +743,18 @@ Exit: return status; } +ib_api_status_t osm_get_path_params(IN osm_sa_t * sa, + IN const osm_port_t * p_src_port, + IN const osm_port_t * p_dest_port, + IN const uint16_t dlid_ho, + OUT osm_path_parms_t * p_parms) +{ + ib_path_rec_t pr; + memset(&pr, 0, sizeof(ib_path_rec_t)); + return pr_rcv_get_path_parms(sa, &pr, + p_src_port, p_dest_port, dlid_ho, 0, p_parms); +} + static void pr_rcv_build_pr(IN osm_sa_t * sa, IN const osm_port_t * p_src_port, IN const osm_port_t * p_dest_port, IN const ib_gid_t * p_dgid,