From patchwork Tue Jul 31 16:04:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Netes X-Patchwork-Id: 1261001 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 9D66EDF26F for ; Tue, 31 Jul 2012 16:09:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755459Ab2GaQJ1 (ORCPT ); Tue, 31 Jul 2012 12:09:27 -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 S1755441Ab2GaQJ0 (ORCPT ); Tue, 31 Jul 2012 12:09:26 -0400 Received: by mail-vb0-f46.google.com with SMTP id ff1so5920363vbb.19 for ; Tue, 31 Jul 2012 09:09:26 -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=Kc4YAD3ehay7W8udWZ6YXf+jQgy/VDB/IUbPEBaRMeM=; b=FXBwpT70Y3pZmA/ZTWxXpp31AoBHJhFkPyEQb4NkqXVYQhXizTS9ntzItYUYyzt5Un 2DDH9Yy+jTxgNJwuTxLwSlotWKsG+zEBqLCzHKyS6M02WiQ8sU19O3daLW9Fip3x9MXp 0QuYki0coxzPgNZ6gTTKSOvamSu7OTtcG1xCpjfjGcsp327xyEeROsUhYuGYeTMTr4Sy xVuzQWEQSB1rahx7/kegXbezgg3HYlf0GZdXf4SahpfLzgg1FV6wtc62fT1Z/YksSkGT T/ydJrK6RP3ofE6hi6kccCEzv7YQz7lvEFHCVBxwaFiTLb1ocEMPYwWuRzY09LDNSXa1 ZT0w== Received: by 10.58.2.232 with SMTP id 8mr2996658vex.45.1343750966136; Tue, 31 Jul 2012 09:09:26 -0700 (PDT) Received: from localhost ([193.47.165.251]) by mx.google.com with ESMTPS id c17sm426151vdj.11.2012.07.31.09.09.25 (version=SSLv3 cipher=OTHER); Tue, 31 Jul 2012 09:09:25 -0700 (PDT) From: Alex Netes To: linux-rdma@vger.kernel.org Cc: Alex Netes Subject: [PATCH 21/27] Fix transaction id casting Date: Tue, 31 Jul 2012 19:04:49 +0300 Message-Id: <1343750695-28063-21-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: ALoCoQm+ev48cap2C39BaYSNnzC88EqQOrnWXsfTcc3+VldA4yziaqjDXFaDZwyr12Icr9qvAi0c Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org cl_atomic() returns signed int32, so without the casting sm_trans_id > 0x7fffffff were messed up. Signed-off-by: Alex Netes --- opensm/osm_req.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/opensm/osm_req.c b/opensm/osm_req.c index 8780134..40bd1e4 100644 --- a/opensm/osm_req.c +++ b/opensm/osm_req.c @@ -93,7 +93,8 @@ ib_api_status_t osm_req_get(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path, goto Exit; } - tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id)); + 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", @@ -161,7 +162,8 @@ osm_madw_t *osm_prepare_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_pat goto Exit; } - tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id)); + 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", @@ -277,7 +279,8 @@ int osm_send_trap144(osm_sm_t * sm, ib_net16_t local) smp->mgmt_class = IB_MCLASS_SUBN_LID; smp->class_ver = 1; smp->method = IB_MAD_METHOD_TRAP; - smp->trans_id = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id)); + 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;