From patchwork Tue Jul 31 16:04:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Netes X-Patchwork-Id: 1261011 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 2AF65DF26F for ; Tue, 31 Jul 2012 16:09:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755441Ab2GaQJa (ORCPT ); Tue, 31 Jul 2012 12:09:30 -0400 Received: from mail-vb0-f46.google.com ([209.85.212.46]:54893 "EHLO mail-vb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755168Ab2GaQJa (ORCPT ); Tue, 31 Jul 2012 12:09:30 -0400 Received: by mail-vb0-f46.google.com with SMTP id ff1so5920363vbb.19 for ; Tue, 31 Jul 2012 09:09:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=81GqmqywvYTmv9hx7pF9gsZrkhWGtoiUa22zGCzkBBQ=; b=MLVABao3y0W21mSJtaHEDf35m9AdsLP2omrZyu7P/VwmxwQTdlYOJfe9Du0d0wPN4Y kPywhklIQ6fSt0vKpg7HEmUKZ0Z6L1sC1jDCUfmnZYX/spLYUshIQqku959tkQK5fjgu LhGw6EpPBbwcE7G7QHJrIWSwAhTPE0V30eByN7plHeFUlLGx7eC5Z0tVtufDrMvItrGG Y1fTMjjWii0RhZ7UGQWvzIa8KtymL7A1AMuMvx8STGk/+7TW/sVkQgB1lvXKdDqJKfLS bPSlXrUnl6ey6Gehj0agPRmJG5LWPcW71O8XlUpKLQCCzBOOCkU9VeEeAE7OJcKN8H4S GFfg== Received: by 10.52.24.227 with SMTP id x3mr12722103vdf.68.1343750969490; Tue, 31 Jul 2012 09:09:29 -0700 (PDT) Received: from localhost ([193.47.165.251]) by mx.google.com with ESMTPS id ej4sm434021vdb.0.2012.07.31.09.09.27 (version=SSLv3 cipher=OTHER); Tue, 31 Jul 2012 09:09:28 -0700 (PDT) From: Alex Netes To: linux-rdma@vger.kernel.org Cc: Alex Netes Subject: [PATCH 22/27] Skip TID 0 on 32 bit wraparound for SMP, SA and PerfMgt queries Date: Tue, 31 Jul 2012 19:04:50 +0300 Message-Id: <1343750695-28063-22-git-send-email-alexne@mellanox.com> X-Mailer: git-send-email 1.7.11.2 In-Reply-To: <1343750695-28063-1-git-send-email-alexne@mellanox.com> References: <1343750695-28063-1-git-send-email-alexne@mellanox.com> X-Gm-Message-State: ALoCoQmyxpzvjciBxOi5yjEi89IUXb5OEHK6plHtFgoITeKcryCcjkZLfBjXeSzyyaJwBR9EI98I Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Signed-off-by: Alex Netes --- opensm/osm_inform.c | 9 +++++++-- opensm/osm_perfmgr.c | 7 ++++++- opensm/osm_req.c | 10 ++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/opensm/osm_inform.c b/opensm/osm_inform.c index a90396b..f5abbc6 100644 --- a/opensm/osm_inform.c +++ b/opensm/osm_inform.c @@ -297,6 +297,7 @@ static ib_api_status_t send_report(IN osm_infr_t * p_infr_rec, /* the informinfo static atomic32_t trap_fwd_trans_id = 0x02DAB000; ib_api_status_t status = IB_SUCCESS; osm_log_t *p_log = p_infr_rec->sa->p_log; + ib_net64_t tid; OSM_LOG_ENTER(p_log); @@ -323,10 +324,14 @@ static ib_api_status_t send_report(IN osm_infr_t * p_infr_rec, /* the informinfo p_report_madw->resp_expected = TRUE; /* advance trap trans id (cant simply ++ on some systems inside ntoh) */ + tid = cl_hton64((uint64_t) cl_atomic_inc(&trap_fwd_trans_id) & + (uint64_t) (0xFFFFFFFF)); + if (trap_fwd_trans_id == 0) + tid = cl_hton64((uint64_t) cl_atomic_inc(&trap_fwd_trans_id) & + (uint64_t) (0xFFFFFFFF)); p_mad = osm_madw_get_mad_ptr(p_report_madw); ib_mad_init_new(p_mad, IB_MCLASS_SUBN_ADM, 2, IB_MAD_METHOD_REPORT, - cl_hton64((uint64_t) cl_atomic_inc(&trap_fwd_trans_id)), - IB_MAD_ATTR_NOTICE, 0); + tid, IB_MAD_ATTR_NOTICE, 0); p_sa_mad = osm_madw_get_sa_mad_ptr(p_report_madw); diff --git a/opensm/osm_perfmgr.c b/opensm/osm_perfmgr.c index 9083ea9..788ed04 100644 --- a/opensm/osm_perfmgr.c +++ b/opensm/osm_perfmgr.c @@ -387,7 +387,12 @@ static ib_api_status_t perfmgr_send_pc_mad(osm_perfmgr_t * perfmgr, pm_mad->header.status = 0; pm_mad->header.class_spec = 0; pm_mad->header.trans_id = - cl_hton64((uint64_t) cl_atomic_inc(&perfmgr->trans_id)); + cl_hton64((uint64_t) cl_atomic_inc(&perfmgr->trans_id) & + (uint64_t) (0xFFFFFFFF)); + if (perfmgr->trans_id == 0) + pm_mad->header.trans_id = + cl_hton64((uint64_t) cl_atomic_inc(&perfmgr->trans_id) & + (uint64_t) (0xFFFFFFFF)); pm_mad->header.attr_id = IB_MAD_ATTR_PORT_CNTRS; pm_mad->header.resv = 0; pm_mad->header.attr_mod = 0; diff --git a/opensm/osm_req.c b/opensm/osm_req.c index 40bd1e4..31d22b1 100644 --- a/opensm/osm_req.c +++ b/opensm/osm_req.c @@ -95,6 +95,9 @@ ib_api_status_t osm_req_get(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path, tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id) & (uint64_t)(0xFFFFFFFF)); + if (tid == 0) + tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id) + & (uint64_t)(0xFFFFFFFF)); OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Getting %s (0x%X), modifier 0x%X, TID 0x%" PRIx64 "\n", @@ -164,6 +167,9 @@ osm_madw_t *osm_prepare_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_pat tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id) & (uint64_t)(0xFFFFFFFF)); + if (tid == 0) + tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id) + & (uint64_t)(0xFFFFFFFF)); OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Setting %s (0x%X), modifier 0x%X, TID 0x%" PRIx64 "\n", @@ -281,6 +287,10 @@ int osm_send_trap144(osm_sm_t * sm, ib_net16_t local) smp->method = IB_MAD_METHOD_TRAP; smp->trans_id = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id) & (uint64_t)(0xFFFFFFFF)); + if (smp->trans_id == 0) + smp->trans_id = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id) + & (uint64_t)(0xFFFFFFFF)); + smp->attr_id = IB_MAD_ATTR_NOTICE; ntc = (ib_mad_notice_attr_t *) smp->data;