From patchwork Thu Dec 5 14:10:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Line Holen X-Patchwork-Id: 3288591 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D3C299F373 for ; Thu, 5 Dec 2013 14:10:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC16020503 for ; Thu, 5 Dec 2013 14:10:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 60D3220240 for ; Thu, 5 Dec 2013 14:10:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752551Ab3LEOKZ (ORCPT ); Thu, 5 Dec 2013 09:10:25 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:47793 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751901Ab3LEOKY convert rfc822-to-8bit (ORCPT ); Thu, 5 Dec 2013 09:10:24 -0500 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id rB5EALjX020886 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 5 Dec 2013 14:10:22 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rB5EAJXw009822 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 5 Dec 2013 14:10:20 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rB5EAJ7E011200; Thu, 5 Dec 2013 14:10:19 GMT MIME-Version: 1.0 Message-ID: Date: Thu, 5 Dec 2013 06:10:19 -0800 (PST) From: Line Holen To: Hal Cc: Linux-Rdma Subject: [PATCH v2] osm_sm_state_mgr.c: Fix handling of polling retry number X-Mailer: Zimbra on Oracle Beehive Content-Disposition: inline X-Source-IP: ucsinet21.oracle.com [156.151.31.93] Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 The retry counter is now only updated if a packet is actually sent. (But as before the initial request is also counted.) Prior to this change the actual maximum number of packets sent were polling retry number minus one. Signed-off-by: Line Holen --- -- 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/opensm/osm_sm_state_mgr.c b/opensm/osm_sm_state_mgr.c index 596ad8f..920923b 100644 --- a/opensm/osm_sm_state_mgr.c +++ b/opensm/osm_sm_state_mgr.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -74,13 +74,14 @@ void osm_report_sm_state(osm_sm_t * sm) OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE, buf); } -static void sm_state_mgr_send_master_sm_info_req(osm_sm_t * sm) +static boolean_t sm_state_mgr_send_master_sm_info_req(osm_sm_t * sm) { osm_madw_context_t context; const osm_port_t *p_port; ib_api_status_t status; osm_dr_path_t dr_path; ib_net64_t guid; + boolean_t sent_req = FALSE; OSM_LOG_ENTER(sm->p_log); @@ -128,9 +129,13 @@ static void sm_state_mgr_send_master_sm_info_req(osm_sm_t * sm) OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3204: " "Failure requesting SMInfo (%s)\n", ib_get_err_str(status)); + else + sent_req = TRUE; Exit: OSM_LOG_EXIT(sm->p_log); + + return (sent_req); } static void sm_state_mgr_start_polling(osm_sm_t * sm) @@ -197,16 +202,14 @@ void osm_sm_state_mgr_polling_callback(IN void *context) } /* - * Incr the retry number. - * If it reached the max_retry_number in the subnet opt - call + * If retry number reached the max_retry_number in the subnet opt - call * osm_sm_state_mgr_process with signal OSM_SM_SIGNAL_POLLING_TIMEOUT */ - sm->retry_number++; OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "SM State %d (%s), Retry number:%d\n", sm->p_subn->sm_state, osm_get_sm_mgr_state_str(sm->p_subn->sm_state), sm->retry_number); - if (sm->retry_number >= sm->p_subn->opt.polling_retry_number) { + if (sm->retry_number > sm->p_subn->opt.polling_retry_number) { OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Reached polling_retry_number value in retry_number. " "Go to DISCOVERY state\n"); @@ -215,7 +218,10 @@ void osm_sm_state_mgr_polling_callback(IN void *context) } /* Send a SubnGet(SMInfo) request to the remote sm (depends on our state) */ - sm_state_mgr_send_master_sm_info_req(sm); + if (sm_state_mgr_send_master_sm_info_req(sm)) { + /* Request sent, increment the retry number */ + sm->retry_number++; + } /* restart the timer */ cl_status = cl_timer_start(&sm->polling_timer, timeout);