From patchwork Wed Sep 11 13:29:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 2872611 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 D022CBF43F for ; Wed, 11 Sep 2013 13:29:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A0A120300 for ; Wed, 11 Sep 2013 13:29:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 93B5B20299 for ; Wed, 11 Sep 2013 13:29:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753413Ab3IKN3o (ORCPT ); Wed, 11 Sep 2013 09:29:44 -0400 Received: from mail-bk0-f45.google.com ([209.85.214.45]:46307 "EHLO mail-bk0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753320Ab3IKN3n (ORCPT ); Wed, 11 Sep 2013 09:29:43 -0400 Received: by mail-bk0-f45.google.com with SMTP id mx11so3528796bkb.4 for ; Wed, 11 Sep 2013 06:29:42 -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=HYLJgX/Cl2rcCfxN3oJaL2GiM5mAespu/no5hXzHmwM=; b=fZsy3mBAhZB9/OupnCqrgeTxCy1wcUWMgnaufsGgl6ppLPJJMi0UNvMKzh1V7C3y3N FLp3SREzW32slpMIzzKgDjbymCiIdcTzrp2myKlqpNHAn4HsbrD/Y4WeuI7C4Jd/g/HP uRvYmCGbsfERPGJ+MmcWkFsph67pMPXq1MHxGVlfpJqSkbKUNCzxw0uJnCBKnlLen1cT Qz66MBS94ZCy7eIyzZyHDVvwnbltDBZuO6KBs6PtU5OfyRWhm4VsKcOvWBCxQTPjgjGx lY+i8DWm5U1X1IASeZ12ojc9mqj1cMqsVyb5wM/Pdlmb17Sb1k+Sm/ACRNzJ4ypWNCWJ kj/A== X-Gm-Message-State: ALoCoQkv31AD+I9M8YLtJfIFkwvfXUpMCsmBlmDMVxDc5IIaaH5qL5ke/XAJsD7sGSgU6P/0BBid X-Received: by 10.205.65.78 with SMTP id xl14mr1502201bkb.1.1378906181865; Wed, 11 Sep 2013 06:29:41 -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 rj5sm7521300bkb.9.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Sep 2013 06:29:41 -0700 (PDT) Message-ID: <52307043.40009@dev.mellanox.co.il> Date: Wed, 11 Sep 2013 09:29:39 -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: Line Holen Subject: [PATCH opensm] Use trap number defines rather than actual trap numbers 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.7 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 Trap number defines were added in ib_types.h as part of: commit ae9d7e7f4e2f62eabad4cf9d60cd5b68a8295147 Author: Line Holen Date: Thu May 30 18:16:43 2013 +0000 Add trap details to notice log message Signed-off-by: Line Holen Signed-off-by: Hal Rosenstock 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/opensm/osm_inform.c b/opensm/osm_inform.c index 716a124..c6c180a 100644 --- a/opensm/osm_inform.c +++ b/opensm/osm_inform.c @@ -405,7 +405,8 @@ static int is_access_permitted(osm_infr_t *p_infr_rec, pkey with MC group. In all other cases the issuer gid is the trap source. */ - if (trap_num >= 64 && trap_num <= 67 ) + if (trap_num >= SM_GID_IN_SERVICE_TRAP && + trap_num <= SM_MGID_DESTROYED_TRAP) /* The issuer of these traps is the SM so source_gid is the gid saved on the data details */ source_gid = p_ntc->data_details.ntc_64_67.gid; @@ -423,8 +424,8 @@ static int is_access_permitted(osm_infr_t *p_infr_rec, /* Check if there is a pkey match. o13-17.1.1 */ switch (trap_num) { - case 66: - case 67: + case SM_MGID_CREATED_TRAP: + case SM_MGID_DESTROYED_TRAP: p_mgrp = osm_get_mgrp_by_mgid(p_subn, &source_gid); if (!p_mgrp) { char gid_str[INET6_ADDRSTRLEN]; @@ -623,10 +624,10 @@ static void log_notice(osm_log_t * log, osm_log_level_t level, /* an official Event information log */ if (ib_notice_is_generic(ntc)) { - if ((ntc->g_or_v.generic.trap_num == CL_HTON16(64)) || - (ntc->g_or_v.generic.trap_num == CL_HTON16(65)) || - (ntc->g_or_v.generic.trap_num == CL_HTON16(66)) || - (ntc->g_or_v.generic.trap_num == CL_HTON16(67))) + if ((ntc->g_or_v.generic.trap_num == CL_HTON16(SM_GID_IN_SERVICE_TRAP)) || + (ntc->g_or_v.generic.trap_num == CL_HTON16(SM_GID_OUT_OF_SERVICE_TRAP)) || + (ntc->g_or_v.generic.trap_num == CL_HTON16(SM_MGID_CREATED_TRAP)) || + (ntc->g_or_v.generic.trap_num == CL_HTON16(SM_MGID_DESTROYED_TRAP))) gid = &ntc->data_details.ntc_64_67.gid; else gid = &ntc->issuer_gid; diff --git a/opensm/osm_trap_rcv.c b/opensm/osm_trap_rcv.c index 469b00f..ae08012 100644 --- a/opensm/osm_trap_rcv.c +++ b/opensm/osm_trap_rcv.c @@ -266,9 +266,9 @@ static void log_trap_info(osm_log_t *p_log, ib_mad_notice_attr_t *p_ntci, 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))) + if ((p_ntci->g_or_v.generic.trap_num == CL_HTON16(SM_LINK_INTEGRITY_THRESHOLD_TRAP)) || + (p_ntci->g_or_v.generic.trap_num == CL_HTON16(SM_BUFFER_OVERRUN_THRESHOLD_TRAP)) || + (p_ntci->g_or_v.generic.trap_num == CL_HTON16(SM_WATCHDOG_TIMER_EXPIRED_TRAP))) snprintf(str, sizeof(str), " Port %u", p_ntci->data_details.ntc_129_131.port_num); else @@ -284,8 +284,8 @@ static void log_trap_info(osm_log_t *p_log, ib_mad_notice_attr_t *p_ntci, 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)); - if ((p_ntci->g_or_v.generic.trap_num == CL_HTON16(257)) || - (p_ntci->g_or_v.generic.trap_num == CL_HTON16(258))) { + if ((p_ntci->g_or_v.generic.trap_num == CL_HTON16(SM_BAD_PKEY_TRAP)) || + (p_ntci->g_or_v.generic.trap_num == CL_HTON16(SM_BAD_QKEY_TRAP))) { OSM_LOG(p_log, OSM_LOG_ERROR, "Bad %s_Key:0x%x on SL:%d from " "LID1:%u QP1:0x%x to " @@ -459,9 +459,9 @@ static void trap_rcv_process_request(IN osm_sm_t * sm, if (is_gsi == FALSE) { if (ib_notice_is_generic(p_ntci) && - (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))) { + (p_ntci->g_or_v.generic.trap_num == CL_HTON16(SM_LINK_INTEGRITY_THRESHOLD_TRAP) || + p_ntci->g_or_v.generic.trap_num == CL_HTON16(SM_BUFFER_OVERRUN_THRESHOLD_TRAP) || + p_ntci->g_or_v.generic.trap_num == CL_HTON16(SM_WATCHDOG_TIMER_EXPIRED_TRAP))) { /* If this is a trap 129, 130, or 131 - then this is a * trap signaling a change on a physical port. * Mark the physp_change_trap flag as TRUE. @@ -525,7 +525,7 @@ static void trap_rcv_process_request(IN osm_sm_t * sm, /* Check for node description update. IB Spec v1.2.1 pg 823 */ if (!ib_notice_is_generic(p_ntci)) goto check_sweep; - if (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 144 && + if (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == SM_LOCAL_CHANGES_TRAP && p_ntci->data_details.ntc_144.local_changes & TRAP_144_MASK_OTHER_LOCAL_CHANGES && p_ntci->data_details.ntc_144.change_flgs & TRAP_144_MASK_NODE_DESCRIPTION_CHANGE) { OSM_LOG(sm->p_log, OSM_LOG_INFO, "Trap 144 Node description update\n"); @@ -542,7 +542,7 @@ static void trap_rcv_process_request(IN osm_sm_t * sm, "ERR 3812: No physical port found for " "trap 144: \"node description update\"\n"); goto check_sweep; - } else if (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 145) { + } else if (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == SM_SYS_IMG_GUID_CHANGED_TRAP) { if (p_physp) /* this assumes that trap 145 content is not broken? */ p_physp->p_node->node_info.sys_guid = @@ -564,8 +564,8 @@ check_sweep: TODO: In the future this can be changed to just getting PortInfo on this port instead of sweeping the entire subnet. */ if (ib_notice_is_generic(p_ntci) && - (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 128 || - cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 144 || + (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == SM_LINK_STATE_CHANGED_TRAP || + cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == SM_LOCAL_CHANGES_TRAP || run_heavy_sweep)) { OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Forcing heavy sweep. Received trap:%u\n",