<span style="font-family: courier new,monospace;">Hi Hal.<br><br style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">This patch fixes an OSM crash when working with Cisco's TS stack.
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Cisco's TopSpin doesn't follow </span><span style="font-family: courier new,monospace;">the same rules when generating
<br>transaction id.<br>When looking up the transaction in the table, SM applies a mask<br>that is supposed to mask out the umad id and leave only the <br>transaction id itself. <br>When mask was applied to the transaction id that was created by
<br>TS stack, the result was 0, because it actually masked out the <br>transaction id itself.<br style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Yevgeny</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Signed-off-by: Yevgeny Kliteynik <
<a href="mailto:kliteyn@mellanox.co.il">kliteyn@mellanox.co.il</a>></span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Index: osm/libvendor/osm_vendor_ibumad.c</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">===================================================================
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--- osm/libvendor/osm_vendor_ibumad.c (revision 8614)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
+++ osm/libvendor/osm_vendor_ibumad.c (working copy)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">@@ -141,12 +141,25 @@ get_madw(osm_vendor_t *p_vend, ib_net64_
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> ib_net64_t mtid = (*tid & cl_ntoh64(0x00000000ffffffffllu));</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> osm_madw_t *res;</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
+ /*</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ * Some vendors (such as Cisco's TopSpin) may not follow</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ * the same rules when generating transaction id.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ * If the resuls of applying a mask (which is supposed to
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ * mask out the umad id and leave only the transaction id</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ * itself) on a transaction id is 0, it means that the</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ * creator of the transaction is not SM, hence we don't
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ * have this transaction in the table anyway.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
+ */</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ if (mtid == 0)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
+ return 0;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
cl_spinlock_acquire( &p_vend->match_tbl_lock );</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> for (m = p_vend->mtbl.tbl, e = m + p_vend->
mtbl.max; m < e; m++) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> if (m->tid == mtid) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> m->tid = 0;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> *tid = mtid;
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> res = m->v;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
+ m->v = NULL;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> cl_spinlock_release( &p_vend->match_tbl_lock );
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> return res;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
}</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">@@ -1148,7 +1161,7 @@ Resp:</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> osm_log(p_vend->p_log, OSM_LOG_DEBUG, "osm_vendor_send: "</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
"Completed sending %s p_madw = %p\n",</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">- resp_expected ? "response" : "request", p_madw);
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ resp_expected ? "request" : "response", p_madw);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> Exit:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> OSM_LOG_EXIT( p_vend->p_log );</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> return( ret );</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">