From patchwork Thu Mar 25 15:56:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yevgeny Kliteynik X-Patchwork-Id: 88259 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 o2PFuWTQ018996 for ; Thu, 25 Mar 2010 15:56:32 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751258Ab0CYP4b (ORCPT ); Thu, 25 Mar 2010 11:56:31 -0400 Received: from mail.mellanox.co.il ([194.90.237.43]:57947 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750869Ab0CYP4a (ORCPT ); Thu, 25 Mar 2010 11:56:30 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from kliteyn@dev.mellanox.co.il) with SMTP; 25 Mar 2010 17:56:24 +0200 Received: from [10.4.1.29] ([10.4.1.29]) by mtlexch01.mtl.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 25 Mar 2010 17:56:24 +0200 Message-ID: <4BAB879E.30203@dev.mellanox.co.il> Date: Thu, 25 Mar 2010 17:56:14 +0200 From: Yevgeny Kliteynik User-Agent: Thunderbird 1.5.0.5 (X11/20060719) MIME-Version: 1.0 To: Sasha Khapyorsky CC: Linux RDMA , jaschut@sandia.gov Subject: [PATCH] opensm/osm_dump.c: dump SL2VL tables X-OriginalArrivalTime: 25 Mar 2010 15:56:24.0632 (UTC) FILETIME=[B89F3380:01CACC33] X-TM-AS-Product-Ver: SMEX-8.0.0.1181-6.000.1038-17278.000 X-TM-AS-Result: No--7.954400-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, 25 Mar 2010 15:56:33 +0000 (UTC) diff --git a/opensm/opensm/osm_dump.c b/opensm/opensm/osm_dump.c index 86e9c00..2c21591 100644 --- a/opensm/opensm/osm_dump.c +++ b/opensm/opensm/osm_dump.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2010 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -456,6 +456,60 @@ static void dump_topology_node(cl_map_item_t * item, FILE * file, void *cxt) } } +static void dump_sl2vl_tbl(cl_map_item_t * item, FILE * file, void *cxt) +{ + osm_port_t *p_port = (osm_port_t *) item; + osm_node_t *p_node = p_port->p_node; + uint32_t in_port, out_port, + num_ports = p_node->node_info.num_ports; + ib_net16_t base_lid = osm_port_get_base_lid(p_port); + osm_physp_t *p_physp; + ib_slvl_table_t *p_tbl; + int i, n; + char buf[1024]; + char * header_line = "#in out : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"; + char * separator_line = "#--------------------------------------------------------"; + + if (!num_ports) + return; + + fprintf(file, "%s 0x%016" PRIx64 ", base LID %d, " + "\"%s\"\n%s\n%s\n", + ib_get_node_type_str(p_node->node_info.node_type), + cl_ntoh64(p_port->guid), cl_ntoh16(base_lid), + p_node->print_desc, header_line, separator_line); + + if (p_node->node_info.node_type == IB_NODE_TYPE_SWITCH) { + for (out_port = 0; out_port <= num_ports; out_port++){ + p_physp = osm_node_get_physp_ptr(p_node, out_port); + + /* no need to print SL2VL table for port that is down */ + if (!p_physp->p_remote_physp) + continue; + + for (in_port = 0; in_port <= num_ports; in_port++) { + p_tbl = osm_physp_get_slvl_tbl(p_physp, in_port); + for (i = 0, n = 0; i < 16; i++) + n += sprintf(buf + n, " %-2d", + ib_slvl_table_get(p_tbl, i)); + fprintf(file, "%-3d %-3d :%s\n", + in_port, out_port, buf); + } + } + } else { + p_physp = p_port->p_physp; + CL_ASSERT(p_physp->p_remote_physp); + p_tbl = osm_physp_get_slvl_tbl(p_physp, 0); + for (i = 0, n = 0; i < 16; i++) + n += sprintf(buf + n, " %-2d", + ib_slvl_table_get(p_tbl, i)); + fprintf(file, "%-3d %-3d :%s\n", + 0, p_physp->port_num, buf); + } + + fprintf(file, "%s\n\n", separator_line); +} + static void print_node_report(cl_map_item_t * item, FILE * file, void *cxt) { osm_node_t *p_node = (osm_node_t *) item; @@ -630,6 +684,11 @@ void osm_dump_all(osm_opensm_t * osm) osm_dump_qmap_to_file(osm, "opensm.mcfdbs", &osm->subn.sw_guid_tbl, dump_mcast_routes, osm); + /* SL2VL tables */ + if (osm->subn.opt.qos) + osm_dump_qmap_to_file(osm, "opensm-sl2vl.dump", + &osm->subn.port_guid_tbl, + dump_sl2vl_tbl, osm); } osm_dump_qmap_to_file(osm, "opensm-subnet.lst", &osm->subn.node_guid_tbl, dump_topology_node,