From patchwork Tue Jul 31 16:04:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Netes X-Patchwork-Id: 1260871 X-Patchwork-Delegate: alexne@voltaire.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 89F2B3FC71 for ; Tue, 31 Jul 2012 16:08:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755428Ab2GaQIt (ORCPT ); Tue, 31 Jul 2012 12:08:49 -0400 Received: from mail-qc0-f174.google.com ([209.85.216.174]:38041 "EHLO mail-qc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751133Ab2GaQIt (ORCPT ); Tue, 31 Jul 2012 12:08:49 -0400 Received: by qcro28 with SMTP id o28so3829544qcr.19 for ; Tue, 31 Jul 2012 09:08:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=AbZRSM1YZjoAcP8su97J9Y6eIUse2y/P8KeZRyiw2fo=; b=X0psL1j5iSuBVLq7Tibj8dKjP/VPwzdrPR4oXJaw/Y7N+5Iqf2B+K/TMY3njHUuBIW quktEUpbHiJuz/pxHQ9zFOkTwMwxpvt59ynjt+GZGk6+lQt3gBqYKVRKxieZGWncELg/ RH5xEyBwiy1bzPlzdHqBGkjmZ6uD5lVvDUj1AwYOnv76VhWMrWma+0vouJeDZ6T0Yxye 34B6qB/tRsN3c/UuB6ijuB1Z7aNPG1+f5iofZTrk7J9JOOLYNDJqcJztg5WpHWGB7Frb ZfdW6ChoWAEAfeOFpfUsPepgKyWRmbBm+AVcuakrAiVE119ZE3sUXNWAnJXfxvbhficg idpA== Received: by 10.58.189.73 with SMTP id gg9mr2988219vec.26.1343750928180; Tue, 31 Jul 2012 09:08:48 -0700 (PDT) Received: from localhost ([193.47.165.251]) by mx.google.com with ESMTPS id g10sm430765vdk.2.2012.07.31.09.08.46 (version=SSLv3 cipher=OTHER); Tue, 31 Jul 2012 09:08:47 -0700 (PDT) From: Alex Netes To: linux-rdma@vger.kernel.org Cc: Vladimir Koushnir Subject: [PATCH 08/27] Fixes in SL2VL table distribution algorithm Date: Tue, 31 Jul 2012 19:04:36 +0300 Message-Id: <1343750695-28063-8-git-send-email-alexne@mellanox.com> X-Mailer: git-send-email 1.7.11.2 In-Reply-To: <1343750695-28063-1-git-send-email-alexne@mellanox.com> References: <1343750695-28063-1-git-send-email-alexne@mellanox.com> X-Gm-Message-State: ALoCoQnntn7qNzAbCtvwhxxFgK13UmlPYre0/tFAk18NK5db0j8cloU6LigC2FsKB98Il8KLQUMQ Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Vladimir Koushnir SL2VL and VLARB table shouldn't be sent to DOWN ports Signed-off-by: Vladimir Koushnir --- opensm/osm_qos.c | 49 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/opensm/osm_qos.c b/opensm/osm_qos.c index 429660b..7342561 100644 --- a/opensm/osm_qos.c +++ b/opensm/osm_qos.c @@ -212,7 +212,8 @@ static int qos_extports_setup(osm_sm_t * sm, osm_node_t *node, struct osm_routing_engine *re = sm->p_subn->p_osm->routing_engine_used; int ret = 0; unsigned in, out; - uint8_t op_vl1; + uint8_t op_vl, common_op_vl = 0, max_num = 0; + uint8_t op_vl_arr[15]; /* * Do nothing unless the most recent routing attempt was successful. @@ -222,6 +223,8 @@ static int qos_extports_setup(osm_sm_t * sm, osm_node_t *node, for (out = 1; out < num_ports; out++) { p = osm_node_get_physp_ptr(node, out); + if (ib_port_info_get_port_state(&p->port_info) == IB_LINK_DOWN) + continue; force_update = p->need_update || sm->p_subn->need_update; p->vl_high_limit = qcfg->vl_high_limit; if (vlarb_update(sm, p, p->port_num, force_update, qcfg)) @@ -234,19 +237,43 @@ 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 && !re->update_sl2vl) { - p = osm_node_get_physp_ptr(node, 1); - op_vl1 = ib_port_info_get_op_vls(&p->port_info); + + /* we should find the op_vl that is used by majority of ports */ + memset(&op_vl_arr[0], 0, sizeof(op_vl_arr)); + p0 = osm_node_get_physp_ptr(node, 1); + + for (out = 1; out < num_ports; out++) { + p = osm_node_get_physp_ptr(node, out); + if (ib_port_info_get_port_state(&p->port_info) == + IB_LINK_DOWN) + continue; + op_vl = ib_port_info_get_op_vls(&p->port_info); + op_vl_arr[op_vl]++; + if (op_vl_arr[op_vl] > max_num){ + max_num = op_vl_arr[op_vl]; + common_op_vl = op_vl; + /* remember the port with most common op_vl */ + p0 = p; + } + + } force_update = p->need_update || sm->p_subn->need_update; - if (sl2vl_update_table(sm, p, 0, 0x30000, force_update, + if (sl2vl_update_table(sm, p0, 0, 0x30000, force_update, &qcfg->sl2vl)) ret = -1; - /* overwrite default ALL configuration if port's - op_vl is different */ - for (out = 2; out < num_ports; out++) { + /* + * Overwrite default ALL configuration if port's + * op_vl is different. + */ + for (out = 1; out < num_ports; out++) { p = osm_node_get_physp_ptr(node, out); - if (ib_port_info_get_op_vls(&p->port_info) != op_vl1 && - sl2vl_update_table(sm, p, 0, 0x20000 | out, force_update, - &qcfg->sl2vl)) + if (ib_port_info_get_port_state(&p->port_info) == + IB_LINK_DOWN) + continue; + if (ib_port_info_get_op_vls(&p->port_info) != + common_op_vl && + sl2vl_update_table(sm, p, 0, 0x20000 | out, + force_update, &qcfg->sl2vl)) ret = -1; } return ret; @@ -256,6 +283,8 @@ static int qos_extports_setup(osm_sm_t * sm, osm_node_t *node, out = ib_switch_info_is_enhanced_port0(&node->sw->switch_info) ? 0 : 1; for (; out < num_ports; out++) { p = osm_node_get_physp_ptr(node, out); + if (ib_port_info_get_port_state(&p->port_info) == IB_LINK_DOWN) + continue; force_update = p->need_update || sm->p_subn->need_update; /* go over all in ports */ for (in = 0; in < num_ports; in++) {