From patchwork Sat Oct 31 12:25:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 56766 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9VBOoJa006642 for ; Sat, 31 Oct 2009 11:24:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757501AbZJaLYn (ORCPT ); Sat, 31 Oct 2009 07:24:43 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757503AbZJaLYn (ORCPT ); Sat, 31 Oct 2009 07:24:43 -0400 Received: from qmta12.westchester.pa.mail.comcast.net ([76.96.59.227]:56346 "EHLO QMTA12.westchester.pa.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757501AbZJaLYm (ORCPT ); Sat, 31 Oct 2009 07:24:42 -0400 Received: from OMTA07.westchester.pa.mail.comcast.net ([76.96.62.59]) by QMTA12.westchester.pa.mail.comcast.net with comcast id zPJX1c0011GhbT85CPQnCc; Sat, 31 Oct 2009 11:24:47 +0000 Received: from hal.comcast.net ([75.69.247.31]) by OMTA07.westchester.pa.mail.comcast.net with comcast id zPQm1c0060hNrtn3TPQm6Q; Sat, 31 Oct 2009 11:24:47 +0000 Received: from hal.comcast.net (localhost.localdomain [127.0.0.1]) by hal.comcast.net (8.14.3/8.14.3) with ESMTP id n9VCPIMf024294; Sat, 31 Oct 2009 07:25:23 -0500 Received: (from hnrose@localhost) by hal.comcast.net (8.14.3/8.14.3/Submit) id n9VCP2dv024263; Sat, 31 Oct 2009 07:25:02 -0500 Date: Sat, 31 Oct 2009 07:25:01 -0500 From: Hal Rosenstock To: sashak@voltaire.com Cc: linux-rdma@vger.kernel.org Subject: [PATCH] opensm/osm_trap_rcv.c: Minor reorganization of trap_rcv_process_request Message-ID: <20091031122501.GA24260@comcast.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org diff --git a/opensm/opensm/osm_trap_rcv.c b/opensm/opensm/osm_trap_rcv.c index d2e4202..c6fe9e9 100644 --- a/opensm/opensm/osm_trap_rcv.c +++ b/opensm/opensm/osm_trap_rcv.c @@ -275,11 +275,51 @@ static int disable_port(osm_sm_t *sm, osm_physp_t *p) return ret; } +static void log_trap_info(osm_log_t *p_log, ib_mad_notice_attr_t *p_ntci, + ib_net16_t source_lid, ib_net64_t trans_id) +{ + if (ib_notice_is_generic(p_ntci)) { + if ((p_ntci->g_or_v.generic.trap_num == CL_HTON16(129)) || + (p_ntci->g_or_v.generic.trap_num == CL_HTON16(130)) || + (p_ntci->g_or_v.generic.trap_num == CL_HTON16(131))) + OSM_LOG(p_log, OSM_LOG_ERROR, + "Received Generic Notice type:%u " + "num:%u (%s) Producer:%u (%s) " + "from LID:%u Port %d TID:0x%016" PRIx64 "\n", + ib_notice_get_type(p_ntci), + cl_ntoh16(p_ntci->g_or_v.generic.trap_num), + ib_get_trap_str(p_ntci->g_or_v.generic.trap_num), + cl_ntoh32(ib_notice_get_prod_type(p_ntci)), + ib_get_producer_type_str(ib_notice_get_prod_type(p_ntci)), + cl_hton16(source_lid), + p_ntci->data_details.ntc_129_131.port_num, + cl_ntoh64(trans_id)); + else + OSM_LOG(p_log, OSM_LOG_ERROR, + "Received Generic Notice type:%u " + "num:%u (%s) Producer:%u (%s) " + "from LID:%u TID:0x%016" PRIx64 "\n", + ib_notice_get_type(p_ntci), + cl_ntoh16(p_ntci->g_or_v.generic.trap_num), + ib_get_trap_str(p_ntci->g_or_v.generic.trap_num), + cl_ntoh32(ib_notice_get_prod_type(p_ntci)), + ib_get_producer_type_str(ib_notice_get_prod_type(p_ntci)), + cl_hton16(source_lid), + cl_ntoh64(trans_id)); + } else + OSM_LOG(p_log, OSM_LOG_ERROR, + "Received Vendor Notice type:%u vend:0x%06X " + "dev:%u from LID:%u TID:0x%016" PRIx64 "\n", + ib_notice_get_type(p_ntci), + cl_ntoh32(ib_notice_get_vend_id(p_ntci)), + cl_ntoh16(p_ntci->g_or_v.vend.dev_id), + cl_ntoh16(source_lid), cl_ntoh64(trans_id)); +} + /********************************************************************** **********************************************************************/ static void -trap_rcv_process_request(IN osm_sm_t * sm, - IN const osm_madw_t * const p_madw) +trap_rcv_process_request(IN osm_sm_t * sm, IN const osm_madw_t * const p_madw) { uint8_t payload[sizeof(ib_mad_notice_attr_t)]; ib_smp_t *p_smp; @@ -362,59 +402,13 @@ trap_rcv_process_request(IN osm_sm_t * sm, source_lid = tmp_madw.mad_addr.addr_type.smi.source_lid; /* Print some info about the incoming Trap */ - if (ib_notice_is_generic(p_ntci)) { - if ((p_ntci->g_or_v.generic.trap_num == CL_HTON16(129)) - || (p_ntci->g_or_v.generic.trap_num == - CL_HTON16(130)) - || (p_ntci->g_or_v.generic.trap_num == - CL_HTON16(131))) - OSM_LOG(sm->p_log, OSM_LOG_ERROR, - "Received Generic Notice type:%u " - "num:%u (%s) Producer:%u (%s) " - "from LID:%u Port %d TID:0x%016" - PRIx64 "\n", ib_notice_get_type(p_ntci), - cl_ntoh16(p_ntci->g_or_v.generic. - trap_num), - ib_get_trap_str(p_ntci->g_or_v.generic. - trap_num), - cl_ntoh32(ib_notice_get_prod_type - (p_ntci)), - ib_get_producer_type_str - (ib_notice_get_prod_type(p_ntci)), - cl_hton16(source_lid), - p_ntci->data_details.ntc_129_131. - port_num, cl_ntoh64(p_smp->trans_id)); - else - OSM_LOG(sm->p_log, OSM_LOG_ERROR, - "Received Generic Notice type:%u " - "num:%u (%s) Producer:%u (%s) " - "from LID:%u TID:0x%016" PRIx64 - "\n", ib_notice_get_type(p_ntci), - cl_ntoh16(p_ntci->g_or_v.generic. - trap_num), - ib_get_trap_str(p_ntci->g_or_v.generic. - trap_num), - cl_ntoh32(ib_notice_get_prod_type - (p_ntci)), - ib_get_producer_type_str - (ib_notice_get_prod_type(p_ntci)), - cl_hton16(source_lid), - cl_ntoh64(p_smp->trans_id)); - } else - OSM_LOG(sm->p_log, OSM_LOG_ERROR, - "Received Vendor Notice type:%u vend:0x%06X " - "dev:%u from LID:%u TID:0x%016" PRIx64 "\n", - ib_notice_get_type(p_ntci), - cl_ntoh32(ib_notice_get_vend_id(p_ntci)), - cl_ntoh16(p_ntci->g_or_v.vend.dev_id), - cl_ntoh16(source_lid), - cl_ntoh64(p_smp->trans_id)); + log_trap_info(sm->p_log, p_ntci, source_lid, p_smp->trans_id); } osm_dump_notice(sm->p_log, p_ntci, OSM_LOG_VERBOSE); - p_physp = osm_get_physp_by_mad_addr(sm->p_log, - sm->p_subn, &tmp_madw.mad_addr); + p_physp = osm_get_physp_by_mad_addr(sm->p_log, sm->p_subn, + &tmp_madw.mad_addr); if (p_physp) p_smp->m_key = p_physp->port_info.m_key; else @@ -528,8 +522,8 @@ trap_rcv_process_request(IN osm_sm_t * sm, } /* restart the aging anyway */ - /* If physp_change_trap is TRUE - then use a callback to unset the - healthy bit. If not - no need to use a callback. */ + /* If physp_change_trap is TRUE - then use a callback to unset + the healthy bit. If not - no need to use a callback. */ if (physp_change_trap == TRUE) cl_event_wheel_reg(&sm->trap_aging_tracker, trap_key, cl_get_time_stamp() + event_wheel_timeout, osm_trap_rcv_aging_tracker_callback, /* no callback */ sm /* no context */ );