Skip to contentSkip to conversation

opensm: Skip TID 0 on 32 bit wraparound for SM, SA, and PerfMgt queries

PATCH New Hal Rosenstock 1 participant 1 message Jun 28, 2012 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 opensm: Skip TID 0 on 32 bit wraparound for SM, SA, and PerfMgt queries

---
 opensm/osm_inform.c  |    9 +++++++--
 opensm/osm_perfmgr.c |    7 ++++++-
 opensm/osm_req.c     |   10 ++++++++++
 3 files changed, 23 insertions(+), 3 deletions(-)
opensm/osm_inform.c +7 -2
index 6a2cb7e..77115d5 100644
@@ -295,6 +295,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);
 
@@ -321,10 +322,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);
 
opensm/osm_perfmgr.c +6 -1
index 41ef08b..1b46679 100644
@@ -380,7 +380,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;
opensm/osm_req.c +10 -0
index ee2a64e..c0d36e4 100644
@@ -93,6 +93,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 @@ ib_api_status_t osm_req_set(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,
 		"Setting %s (0x%X), modifier 0x%X, TID 0x%" PRIx64 "\n",
@@ -252,6 +258,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;
Signature · 6 lines
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html