From patchwork Wed Jul 28 16:26:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Eli Dorfman (Voltaire)" X-Patchwork-Id: 114842 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6SG7QIT027717 for ; Wed, 28 Jul 2010 16:07:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752785Ab0G1QHZ (ORCPT ); Wed, 28 Jul 2010 12:07:25 -0400 Received: from fwil.voltaire.com ([193.47.165.2]:30365 "EHLO exil.voltaire.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752075Ab0G1QHY (ORCPT ); Wed, 28 Jul 2010 12:07:24 -0400 Received: from [172.25.1.69] ([172.25.1.69]) by exil.voltaire.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 28 Jul 2010 19:07:22 +0300 Message-ID: <4C505A39.4020201@gmail.com> Date: Wed, 28 Jul 2010 19:26:33 +0300 From: "Eli Dorfman (Voltaire)" User-Agent: Thunderbird 2.0.0.17 (X11/20080914) MIME-Version: 1.0 To: Sasha Khapyorsky CC: linux-rdma Subject: [PATCH] opensm: Fix sl2vl configuration X-OriginalArrivalTime: 28 Jul 2010 16:07:22.0226 (UTC) FILETIME=[F636D520:01CB2E6E] 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]); Wed, 28 Jul 2010 16:07:26 +0000 (UTC) diff --git a/opensm/opensm/osm_qos.c b/opensm/opensm/osm_qos.c index a571370..de0ae23 100644 --- a/opensm/opensm/osm_qos.c +++ b/opensm/opensm/osm_qos.c @@ -182,7 +182,7 @@ static ib_api_status_t sl2vl_update_table(osm_sm_t * sm, osm_physp_t * p, tbl.raw_vl_by_sl[i] = (vl1 << 4) | vl2; } - if (!force_update && (p_tbl = osm_physp_get_slvl_tbl(p, in_port)) && + if (!force_update && in_port && (p_tbl = osm_physp_get_slvl_tbl(p, in_port)) && !memcmp(p_tbl, &tbl, sizeof(tbl))) return IB_SUCCESS; @@ -209,6 +209,7 @@ static int qos_extports_setup(osm_sm_t * sm, osm_node_t *node, unsigned num_ports = osm_node_get_num_physp(node); int ret = 0; unsigned i, j; + uint8_t op_vl1; for (i = 1; i < num_ports; i++) { p = osm_node_get_physp_ptr(node, i); @@ -225,17 +226,31 @@ static int qos_extports_setup(osm_sm_t * sm, osm_node_t *node, if (ib_switch_info_get_opt_sl2vlmapping(&node->sw->switch_info) && sm->p_subn->opt.use_optimized_slvl) { p = osm_node_get_physp_ptr(node, 1); + op_vl1 = ib_port_info_get_op_vls(&p->port_info); force_update = p->need_update || sm->p_subn->need_update; - return sl2vl_update_table(sm, p, 1, 0x30000, force_update, - &qcfg->sl2vl); + if (sl2vl_update_table(sm, p, 0, 0x30000, force_update, + &qcfg->sl2vl)) + ret = -1; + /* overwrite default ALL configuration if port's + op_vl is different */ + for (i = 2; i < num_ports; i++) { + p = osm_node_get_physp_ptr(node, i); + if (ib_port_info_get_op_vls(&p->port_info) != op_vl1 && + sl2vl_update_table(sm, p, 0, 0x20000 | i, force_update, + &qcfg->sl2vl)) + ret = -1; + } + return ret; } - for (i = 0; i < num_ports; i++) { + /* non optimized sl2vl configuration */ + i = ib_switch_info_is_enhanced_port0(&node->sw->switch_info) ? 0 : 1; + for (; i < num_ports; i++) { p = osm_node_get_physp_ptr(node, i); force_update = p->need_update || sm->p_subn->need_update; j = ib_switch_info_is_enhanced_port0(&node->sw->switch_info) ? 0 : 1; for (; j < num_ports; j++) - if (sl2vl_update_table(sm, p, i, i << 8 | j, + if (sl2vl_update_table(sm, p, j, j << 8 | i, force_update, &qcfg->sl2vl)) ret = -1; }