From patchwork Sun Nov 1 16:36:59 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 56879 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 nA1GYVc0002318 for ; Sun, 1 Nov 2009 16:34:54 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752945AbZKAQes (ORCPT ); Sun, 1 Nov 2009 11:34:48 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752947AbZKAQes (ORCPT ); Sun, 1 Nov 2009 11:34:48 -0500 Received: from ey-out-2122.google.com ([74.125.78.24]:8914 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752945AbZKAQes (ORCPT ); Sun, 1 Nov 2009 11:34:48 -0500 Received: by ey-out-2122.google.com with SMTP id d26so264795eyd.19 for ; Sun, 01 Nov 2009 08:34:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:received:date:from:to :cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=baGJ2g/Ms/dbyf/on26TahnijimAxNixthARxUWIgzM=; b=d93xil8EXED/JlfslCicNBw3fkGDswLqfWxXjK1q5YiQuIGy6smQfysVXrkqyH8I4r +19lgIJBKJeF8fdS6M5SlZzZ2tF8Sa30+55jTsekwOFhjLQcqK/FDcq2MNit/BZ/DAbr oId4xd3jD75UUOT/i3nRRV3GvbGhmeBt0eLJg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=ftydQz3/FrhTP8dQwGzZkoEcZSj8DyKU2j8GtrYzjxuig8q9MTbCcDw3wRbCwcGnbt bkHfKUclf8Lq915g91IdYGpVv+irSjPeEW5e8rHIKsnBEaKaZS5D2QT6WbYPkdz4ASQ5 pZBmBM3CLFzz40idA9wXs8kHAKw/NsNoLM8uE= Received: by 10.216.91.6 with SMTP id g6mr3093863wef.212.1257093292042; Sun, 01 Nov 2009 08:34:52 -0800 (PST) Received: from me.localdomain (85.64.35.106.dynamic.barak-online.net [85.64.35.106]) by mx.google.com with ESMTPS id 24sm4796031eyx.29.2009.11.01.08.34.51 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 01 Nov 2009 08:34:51 -0800 (PST) Received: by me.localdomain (Postfix, from userid 1000) id BC89E11F87; Sun, 1 Nov 2009 18:36:59 +0200 (IST) Date: Sun, 1 Nov 2009 18:36:59 +0200 From: Sasha Khapyorsky To: Hal Rosenstock Cc: linux-rdma@vger.kernel.org Subject: [PATCH] opensm/osm_trap_rcv.c: Improvements in log_trap_info() Message-ID: <20091101163659.GI29434@me> References: <20091031122501.GA24260@comcast.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20091031122501.GA24260@comcast.net> User-Agent: Mutt/1.5.20 (2009-06-14) 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 c6fe9e9..a414f55 100644 --- a/opensm/opensm/osm_trap_rcv.c +++ b/opensm/opensm/osm_trap_rcv.c @@ -278,34 +278,30 @@ static int disable_port(osm_sm_t *sm, osm_physp_t *p) 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 (!osm_log_is_active(p_log, OSM_LOG_ERROR)) + return; + if (ib_notice_is_generic(p_ntci)) { + char str[32]; + 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)); + snprintf(str, sizeof(str), " Port %u", + p_ntci->data_details.ntc_129_131.port_num); 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)); + str[0] = '\0'; + + OSM_LOG(p_log, OSM_LOG_ERROR, + "Received Generic Notice type:%u " + "num:%u (%s) Producer:%u (%s) " + "from LID:%u%s 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), str, cl_ntoh64(trans_id)); } else OSM_LOG(p_log, OSM_LOG_ERROR, "Received Vendor Notice type:%u vend:0x%06X "