From patchwork Tue Aug 14 21:35:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yevgeny Kliteynik X-Patchwork-Id: 1323711 X-Patchwork-Delegate: alexne@voltaire.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id E6448DF266 for ; Tue, 14 Aug 2012 21:40:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753848Ab2HNVki (ORCPT ); Tue, 14 Aug 2012 17:40:38 -0400 Received: from eu1sys200aog118.obsmtp.com ([207.126.144.145]:33522 "HELO eu1sys200aog118.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1753554Ab2HNVkh (ORCPT ); Tue, 14 Aug 2012 17:40:37 -0400 Received: from MTLCAS02.mtl.com ([193.47.165.155]) (using TLSv1) by eu1sys200aob118.postini.com ([207.126.147.11]) with SMTP ID DSNKUCrF0yPwREseE59T80z9UuBr7w5bL8hz@postini.com; Tue, 14 Aug 2012 21:40:36 UTC Received: from [10.7.17.62] (10.0.13.1) by MTLCAS02.mtl.com (10.0.8.72) with Microsoft SMTP Server id 14.2.247.3; Wed, 15 Aug 2012 00:34:59 +0300 Message-ID: <502AC484.60303@mellanox.co.il> Date: Wed, 15 Aug 2012 00:35:00 +0300 From: Yevgeny Kliteynik Reply-To: User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Linux RDMA , , "Yevgeny Kliteynik" Subject: [PATCH 3/8] opensm/osm_node_info_rcv.c: using if_PF for all the fatal conditions X-Originating-IP: [10.0.13.1] Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org This is just the first file - similar optimization will be done on other MADs receivers. Note that this patch doesn't mess with all the non-fatal cases. The goal was not to help SM to perform better with all the validations that it does, but to make sure that the fatal cases will never be predicted wrong, so any fatal check (existing or a newely added one) won't affect the SM performance. Signed-off-by: Yevgeny Kliteynik --- opensm/osm_node_info_rcv.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/opensm/osm_node_info_rcv.c b/opensm/osm_node_info_rcv.c index 36d8046..2f2aa6d 100644 --- a/opensm/osm_node_info_rcv.c +++ b/opensm/osm_node_info_rcv.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. * @@ -153,7 +153,7 @@ static void ni_rcv_set_links(IN osm_sm_t * sm, osm_node_t * p_node, p_neighbor_node = osm_get_node_by_guid(sm->p_subn, p_ni_context->node_guid); - if (!p_neighbor_node) { + if_PF (!p_neighbor_node) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D10: " "Unexpected removal of neighbor node 0x%" PRIx64 "\n", cl_ntoh64(p_ni_context->node_guid)); @@ -430,7 +430,7 @@ static void ni_rcv_process_existing_ca_or_router(IN osm_sm_t * sm, osm_node_init_physp(p_node, port_num, p_madw); p_port = osm_port_new(p_ni, p_node); - if (p_port == NULL) { + if_PF (p_port == NULL) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D04: " "Unable to create new port object\n"); goto Exit; @@ -443,7 +443,7 @@ static void ni_rcv_process_existing_ca_or_router(IN osm_sm_t * sm, (osm_port_t *) cl_qmap_insert(&sm->p_subn->port_guid_tbl, p_ni->port_guid, &p_port->map_item); - if (p_port_check != p_port) { + if_PF (p_port_check != p_port) { /* We should never be here! Somehow, this port GUID already exists in the table. @@ -458,7 +458,7 @@ static void ni_rcv_process_existing_ca_or_router(IN osm_sm_t * sm, p_alias_guid = osm_alias_guid_new(p_ni->port_guid, p_port); - if (!p_alias_guid) { + if_PF (!p_alias_guid) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D11: " "alias guid memory allocation failed" " for port GUID 0x%" PRIx64 "\n", @@ -495,7 +495,7 @@ alias_done: } else { osm_physp_t *p_physp = osm_node_get_physp_ptr(p_node, port_num); - if (p_physp == NULL) { + if_PF (p_physp == NULL) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D1C: " "No physical port found for node GUID 0x%" PRIx64 " port %u. Might be duplicate port GUID\n", @@ -639,7 +639,7 @@ static void ni_rcv_process_new(IN osm_sm_t * sm, IN const osm_madw_t * p_madw) ib_get_node_type_str(p_ni->node_type), cl_ntoh64(p_ni->node_guid), cl_ntoh64(p_smp->trans_id)); - if (port_num > p_ni->num_ports) { + if_PF (port_num > p_ni->num_ports) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D0A: " "New %s node GUID 0x%" PRIx64 "is non-compliant and " "is being ignored since the " @@ -651,7 +651,7 @@ static void ni_rcv_process_new(IN osm_sm_t * sm, IN const osm_madw_t * p_madw) } p_node = osm_node_new(p_madw); - if (p_node == NULL) { + if_PF (p_node == NULL) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D07: " "Unable to create new node object\n"); goto Exit; @@ -662,7 +662,7 @@ static void ni_rcv_process_new(IN osm_sm_t * sm, IN const osm_madw_t * p_madw) ports in the port table. */ p_port = osm_port_new(p_ni, p_node); - if (p_port == NULL) { + if_PF (p_port == NULL) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D14: " "Unable to create new port object\n"); osm_node_delete(&p_node); @@ -675,7 +675,7 @@ static void ni_rcv_process_new(IN osm_sm_t * sm, IN const osm_madw_t * p_madw) p_port_check = (osm_port_t *) cl_qmap_insert(&sm->p_subn->port_guid_tbl, p_ni->port_guid, &p_port->map_item); - if (p_port_check != p_port) { + if_PF (p_port_check != p_port) { /* We should never be here! Somehow, this port GUID already exists in the table. @@ -698,7 +698,7 @@ static void ni_rcv_process_new(IN osm_sm_t * sm, IN const osm_madw_t * p_madw) p_alias_guid = osm_alias_guid_new(p_ni->port_guid, p_port); - if (!p_alias_guid) { + if_PF (!p_alias_guid) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D18: " "alias guid memory allocation failed" " for port GUID 0x%" PRIx64 "\n", @@ -733,7 +733,7 @@ alias_done2: /* If there were RouterInfo or other router attribute, this would be elsewhere */ if (p_ni->node_type == IB_NODE_TYPE_ROUTER) { - if ((p_rtr = osm_router_new(p_port)) == NULL) + if_PF ((p_rtr = osm_router_new(p_port)) == NULL) OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D1A: " "Unable to create new router object\n"); else { @@ -742,7 +742,7 @@ alias_done2: (osm_router_t *) cl_qmap_insert(p_rtr_guid_tbl, p_ni->port_guid, &p_rtr->map_item); - if (p_rtr_check != p_rtr) + if_PF (p_rtr_check != p_rtr) OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D1B: " "Unable to add port GUID:0x%016" PRIx64 " to router table\n", @@ -753,7 +753,7 @@ alias_done2: p_node_check = (osm_node_t *) cl_qmap_insert(&sm->p_subn->node_guid_tbl, p_ni->node_guid, &p_node->map_item); - if (p_node_check != p_node) { + if_PF (p_node_check != p_node) { /* This node must have been inserted by another thread. This is unexpected, but is not an error. @@ -817,7 +817,7 @@ static void ni_rcv_process_existing(IN osm_sm_t * sm, IN osm_node_t * p_node, cl_ntoh64(p_ni->node_guid), cl_ntoh64(p_smp->trans_id), p_node->discovery_count); - if (port_num > p_ni->num_ports) { + if_PF (port_num > p_ni->num_ports) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D0C: " "Existing %s node GUID 0x%" PRIx64 "is non-compliant " "and is being ignored since the " @@ -876,14 +876,14 @@ void osm_ni_rcv_process(IN void *context, IN void *data) CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_NODE_INFO); - if (p_ni->node_guid == 0) { + if_PF (p_ni->node_guid == 0) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D16: " "Got Zero Node GUID! Found on the directed route:\n"); osm_dump_smp_dr_path_v2(sm->p_log, p_smp, FILE_ID, OSM_LOG_ERROR); goto Exit; } - if (p_ni->port_guid == 0) { + if_PF (p_ni->port_guid == 0) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D17: " "Got Zero Port GUID! Found on the directed route:\n"); osm_dump_smp_dr_path_v2(sm->p_log, p_smp, FILE_ID, OSM_LOG_ERROR);