From patchwork Fri Nov 1 12:10:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 3124661 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E940DBEEB2 for ; Fri, 1 Nov 2013 12:10:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A2DA2035C for ; Fri, 1 Nov 2013 12:10:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 27F032034C for ; Fri, 1 Nov 2013 12:10:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751278Ab3KAMKa (ORCPT ); Fri, 1 Nov 2013 08:10:30 -0400 Received: from mail-ea0-f177.google.com ([209.85.215.177]:54996 "EHLO mail-ea0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751165Ab3KAMK3 (ORCPT ); Fri, 1 Nov 2013 08:10:29 -0400 Received: by mail-ea0-f177.google.com with SMTP id f15so2005110eak.22 for ; Fri, 01 Nov 2013 05:10:28 -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 :cc:subject:content-type:content-transfer-encoding; bh=aB2J1QwlxqhBrgjyj7Tr6iu56GDU4jTlgwwiE3qF5lo=; b=C/T2ZEcSFDw3AkJOWSZOGp8cRDTrnyKzpwe3BXnlrJiDQdj7b5BQur0Sx79qfY9SlH bW6cWIeWdHYkjWz61YbM74uIi88oj7ZozJsXHX0v7QiaY4eo2dM7ew9qaCLrRGz8QyFD cvucmUcG/NSN+e3yzoNQBpfx7ZQfwJa3h70WQn/cyU8nKIyDIUkZjTD7i0ozqEGejd4a 5K6NGKVQ9EjHv/LLDC20OXcRkB+/7D3ZvEKPwpoDPzq2VqXSTqz2GaEzHcxuY77M+H8G /g00EJQs1LA8zQ2EMqyCdtIJsBfLEaNLzqhYUU2R87ZwJisRkQETLdRVjNA5tDN539TZ V8tQ== X-Gm-Message-State: ALoCoQn41iGqiw6XpFqreAD1STJB+HhSXNAIHxFkiBvKRY1EMwuZ61abchKGkn5wwCfBVZf+hSd7 X-Received: by 10.14.48.14 with SMTP id u14mr57541eeb.74.1383307827873; Fri, 01 Nov 2013 05:10:27 -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 x47sm6945864eea.16.2013.11.01.05.10.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 01 Nov 2013 05:10:27 -0700 (PDT) Message-ID: <52739A2F.9050508@dev.mellanox.co.il> Date: Fri, 01 Nov 2013 08:10:23 -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)" CC: Dan Ben-Yosef , Jim Mott Subject: [PATCH opensm] Fix handling of get P_KeyTable on timeout 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.4 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 From: Dan Ben Yosef if the get of pkey tbl times out, remove the node from the subnet and indicate subnet initialization error so subnet is reswept Signed-off-by: Dan Ben Yosef 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/include/opensm/osm_pkey.h b/include/opensm/osm_pkey.h index 54888e6..2ba80b3 100644 --- a/include/opensm/osm_pkey.h +++ b/include/opensm/osm_pkey.h @@ -90,6 +90,7 @@ typedef struct osm_pkeybl { uint16_t last_pkey_idx; uint16_t used_blocks; uint16_t max_blocks; + uint16_t rcv_blocks_cnt; } osm_pkey_tbl_t; /* * FIELDS @@ -119,6 +120,11 @@ typedef struct osm_pkeybl { * switch_info updated on receiving the node_info or switch_info * GetResp * +* rcv_blocks_cnt +* Counter for the received GetPKeyTable mads. +* For every GetPKeyTable mad we send, increase the counter, +* and for every GetRespPKeyTable we decrease the counter. +* * NOTES * 'blocks' vector should be used to store pkey values obtained from * the port and SM pkey manager should not change it directly, for this diff --git a/opensm/osm_drop_mgr.c b/opensm/osm_drop_mgr.c index 4276fe9..85a6f58 100644 --- a/opensm/osm_drop_mgr.c +++ b/opensm/osm_drop_mgr.c @@ -500,6 +500,9 @@ void osm_drop_mgr_process(osm_sm_t * sm) cl_qmap_t *p_node_guid_tbl, *p_port_guid_tbl; osm_port_t *p_port, *p_next_port; osm_node_t *p_node, *p_next_node; + int max_ports, port_num; + osm_physp_t *p_physp; + ib_net64_t port_guid; CL_ASSERT(sm); @@ -530,6 +533,28 @@ void osm_drop_mgr_process(osm_sm_t * sm) */ if (p_node->discovery_count == 0) drop_mgr_process_node(sm, p_node); + else { + /* + * Drop port if there was timeout for GetPKeyTable + */ + if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH) + port_num = 0; + else + port_num = 1; + max_ports = osm_node_get_num_physp(p_node); + for (; port_num < max_ports; port_num++) { + p_physp = osm_node_get_physp_ptr(p_node, port_num); + if (!p_physp || p_physp->pkeys.rcv_blocks_cnt == 0) + continue; + sm->p_subn->subnet_initialization_error = TRUE; + if (!port_num || osm_node_get_type(p_node) != IB_NODE_TYPE_SWITCH) { + port_guid = osm_physp_get_port_guid(p_physp); + p_port = osm_get_port_by_guid(sm->p_subn, port_guid); + p_port->discovery_count = 0; + } else + p_node->physp_discovered[port_num] = 0; + } + } } /* diff --git a/opensm/osm_pkey.c b/opensm/osm_pkey.c index 9e4bdd4..7a8ac0a 100644 --- a/opensm/osm_pkey.c +++ b/opensm/osm_pkey.c @@ -98,6 +98,7 @@ ib_api_status_t osm_pkey_tbl_init(IN osm_pkey_tbl_t * p_pkey_tbl) p_pkey_tbl->last_pkey_idx = 0; p_pkey_tbl->used_blocks = 0; p_pkey_tbl->max_blocks = 0; + p_pkey_tbl->rcv_blocks_cnt = 0; return IB_SUCCESS; } diff --git a/opensm/osm_port.c b/opensm/osm_port.c index 6e73e66..4c42fe9 100644 --- a/opensm/osm_port.c +++ b/opensm/osm_port.c @@ -639,6 +639,8 @@ void osm_physp_set_pkey_tbl(IN osm_log_t * p_log, IN const osm_subn_t * p_subn, return; } + /* decrement block received counter */ + p_physp->pkeys.rcv_blocks_cnt--; osm_pkey_tbl_set(&p_physp->pkeys, block_num, p_pkey_tbl, p_subn->opt.allow_both_pkeys); } diff --git a/opensm/osm_port_info_rcv.c b/opensm/osm_port_info_rcv.c index 1a7377a..30cd096 100644 --- a/opensm/osm_port_info_rcv.c +++ b/opensm/osm_port_info_rcv.c @@ -431,6 +431,7 @@ static void get_pkey_table(IN osm_log_t * p_log, IN osm_sm_t * sm, 1) / IB_NUM_PKEY_ELEMENTS_IN_BLOCK; } + p_physp->pkeys.rcv_blocks_cnt = max_blocks; for (block_num = 0; block_num < max_blocks; block_num++) { if (osm_node_get_type(p_node) != IB_NODE_TYPE_SWITCH || osm_physp_get_port_num(p_physp) == 0) {