<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2654.45">
<TITLE>[PATCH] query-register mr</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>Fab</FONT>
</P>
<P><FONT SIZE=2>Our verification team found that rkey get different value between ib_reg_mem and ib_query_mem</FONT>
<BR><FONT SIZE=2>The problem was that according to the API rkey and lkey should be use the network order (they defined as net32),</FONT>
<BR><FONT SIZE=2>but only the rkey in ib_reg_mem was returned using the network order </FONT>
</P>
<P><FONT SIZE=2>This patch fix this and return the same endians between query_mem and reg_mem for rkey.</FONT>
<BR><FONT SIZE=2>I still think that if the API require that also the lkey should use network order</FONT>
<BR><FONT SIZE=2>we should change and return lkey also in network order.</FONT>
<BR><FONT SIZE=2>( I didn't do this , because I don't know if it breaks anything, but it very easy to do ...)</FONT>
</P>
<P><FONT SIZE=2>I also add the keys check to the alts test and enable the shared memory test.</FONT>
</P>
<P><FONT SIZE=2>Pls review and apply</FONT>
</P>
<P><FONT SIZE=2>10x</FONT>
<BR><FONT SIZE=2>Yossi </FONT>
</P>
<P><FONT SIZE=2>Singed-off-by:Yossi Leybovich (sleybo@mellanox.co.il)</FONT>
<BR><FONT SIZE=2>Index: hw/mt23108/kernel/hca_data.c</FONT>
<BR><FONT SIZE=2>===================================================================</FONT>
<BR><FONT SIZE=2>--- hw/mt23108/kernel/hca_data.c (revision 433)</FONT>
<BR><FONT SIZE=2>+++ hw/mt23108/kernel/hca_data.c (working copy)</FONT>
<BR><FONT SIZE=2>@@ -1449,7 +1449,7 @@</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> mr_query_p->access_ctrl = map_vapi_acl(mr_info_p->acl);</FONT>
<BR><FONT SIZE=2> mr_query_p->lkey = mr_info_p->lkey;</FONT>
<BR><FONT SIZE=2>- mr_query_p->rkey = mr_info_p->rkey;</FONT>
<BR><FONT SIZE=2>+ mr_query_p->rkey = cl_hton32(mr_info_p->rkey);</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> //////////////////////////////////////////////////////////////</FONT>
<BR><FONT SIZE=2>Index: tests/alts/registermemregion.c</FONT>
<BR><FONT SIZE=2>===================================================================</FONT>
<BR><FONT SIZE=2>--- tests/alts/registermemregion.c (revision 433)</FONT>
<BR><FONT SIZE=2>+++ tests/alts/registermemregion.c (working copy)</FONT>
<BR><FONT SIZE=2>@@ -147,6 +147,24 @@</FONT>
<BR><FONT SIZE=2> break;</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2>+ if(alts_mr_attr.lkey != lkey || alts_mr_attr.rkey != rkey)</FONT>
<BR><FONT SIZE=2>+ {</FONT>
<BR><FONT SIZE=2>+ </FONT>
<BR><FONT SIZE=2>+ ALTS_PRINT( ALTS_DBG_ERROR,</FONT>
<BR><FONT SIZE=2>+ ("ib_query_mr failed lkey rkey different from reg\n"));</FONT>
<BR><FONT SIZE=2>+ ALTS_PRINT( ALTS_DBG_ERROR,</FONT>
<BR><FONT SIZE=2>+ ("\t\t reg-lkey = %x query-lkey %x reg-rkey%x query-rkey%x\n" ,</FONT>
<BR><FONT SIZE=2>+ alts_mr_attr.lkey , lkey , alts_mr_attr.rkey , rkey));</FONT>
<BR><FONT SIZE=2>+ alts_close_ca(h_ca);</FONT>
<BR><FONT SIZE=2>+ ib_status = IB_INVALID_LKEY;</FONT>
<BR><FONT SIZE=2>+ break;</FONT>
<BR><FONT SIZE=2>+ </FONT>
<BR><FONT SIZE=2>+ }</FONT>
<BR><FONT SIZE=2>+</FONT>
<BR><FONT SIZE=2>+ ALTS_PRINT( ALTS_DBG_ERROR,</FONT>
<BR><FONT SIZE=2>+ ("ib_query_mr passed\n"</FONT>
<BR><FONT SIZE=2>+ "\t\t lkey = %x rkey%x query-rkey%x\n" ,</FONT>
<BR><FONT SIZE=2>+ lkey, rkey));</FONT>
<BR><FONT SIZE=2> /*</FONT>
<BR><FONT SIZE=2> * Re-register the memeory region</FONT>
<BR><FONT SIZE=2> */</FONT>
<BR><FONT SIZE=2>@@ -158,6 +176,8 @@</FONT>
<BR><FONT SIZE=2> {</FONT>
<BR><FONT SIZE=2> ALTS_PRINT( ALTS_DBG_ERROR,</FONT>
<BR><FONT SIZE=2> ("ib_rereg_mem failed status = %s\n", ib_get_err_str(ib_status)) );</FONT>
<BR><FONT SIZE=2>+ alts_close_ca(h_ca);</FONT>
<BR><FONT SIZE=2>+ break;</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> ALTS_PRINT( ALTS_DBG_ERROR,</FONT>
<BR><FONT SIZE=2>Index: tests/alts/user/alts_main.c</FONT>
<BR><FONT SIZE=2>===================================================================</FONT>
<BR><FONT SIZE=2>--- tests/alts/user/alts_main.c (revision 433)</FONT>
<BR><FONT SIZE=2>+++ tests/alts/user/alts_main.c (working copy)</FONT>
<BR><FONT SIZE=2>@@ -212,9 +212,7 @@</FONT>
<BR><FONT SIZE=2> ib_status = al_test_create_mem_window();</FONT>
<BR><FONT SIZE=2> break;</FONT>
<BR><FONT SIZE=2> case RegisterSharedMemRegion:</FONT>
<BR><FONT SIZE=2>- CL_PRINT( ALTS_DBG_VERBOSE, alts_dbg_lvl,</FONT>
<BR><FONT SIZE=2>- ("altsapp: RegisterSharedMemRegion not implemented.\n") );</FONT>
<BR><FONT SIZE=2>- ib_status = IB_SUCCESS;</FONT>
<BR><FONT SIZE=2>+ ib_status = al_test_register_shared_mem();</FONT>
<BR><FONT SIZE=2> break;</FONT>
<BR><FONT SIZE=2> case MultiSend:</FONT>
<BR><FONT SIZE=2> ib_status = al_test_multi_send_recv();</FONT>
</P>
<P><FONT FACE="Arial" SIZE=2 COLOR="#000000"></FONT>
</BODY>
</HTML>