<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">There’s a bug in ib_member_set_state, as it ends up OR-ing the existing state with the supplied state.  Basically, it is masking the wrong bits before OR-ing
 in the state.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">You could change ib_member_set_join_state to call ib_member_set_state.  However, if the use of ib_member_set_state always has the caller passing the join_state
 field of an member record structure, then it should just be eliminated and ib_member_set_join_state used instead.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">-Fab<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> ofw-bounces@lists.openfabrics.org [mailto:ofw-bounces@lists.openfabrics.org]
<b>On Behalf Of </b>Tzachi Dar<br>
<b>Sent:</b> Tuesday, September 27, 2011 12:19 PM<br>
<b>To:</b> ofw@lists.openfabrics.org; Hal Rosenstock<br>
<b>Subject:</b> [ofw] wrong usage of ib_member_set_state<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black">on windows we have the following 3 functions:<o:p></o:p></span></p>
<p><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black"> <o:p></o:p></span></p>
<p><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black">AL_INLINE void AL_API<br>
ib_member_set_state(<br>
 IN OUT   uint8_t* const    p_scope_state,<br>
 IN  const uint8_t      state )<br>
{<br>
 CL_ASSERT( state <= 0x0F );<br>
 /* State is LS 4-bits. */<br>
 *p_scope_state &= 0x0F;<br>
 *p_scope_state |= (state & 0x0F);<br>
}<o:p></o:p></span></p>
<p><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black"> <o:p></o:p></span></p>
<p><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black"> <o:p></o:p></span></p>
<p><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black">AL_INLINE void AL_API<br>
ib_member_set_join_state(<br>
 IN OUT   ib_member_rec_t    *p_mc_rec,<br>
 IN  const uint8_t      state )<br>
{<br>
 p_mc_rec->scope_state &= 0xF0;<br>
 p_mc_rec->scope_state |= (state & 0x0F);<br>
}<o:p></o:p></span></p>
<p><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black"> <o:p></o:p></span></p>
<p><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black"><br>
AL_INLINE uint8_t AL_API<br>
ib_member_set_scope_state(<br>
 IN  const uint8_t      scope,<br>
 IN  const uint8_t      state )<br>
{<br>
 /* Scope is MS 4-bits, state is LS 4-bits */<br>
 return ((scope << 4) | (state & 0xF));<br>
}<o:p></o:p></span></p>
<p><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black"> <o:p></o:p></span></p>
<p><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black"> <o:p></o:p></span></p>
<p><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black">Ipoib is using ib_member_set_state().<o:p></o:p></span></p>
<p><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black"> <o:p></o:p></span></p>
<p><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black">As far as I can tell this will cause the scope to be zero (on table 3, the value of 0 is reserved). Is this what we relay wanted to have?<o:p></o:p></span></p>
<p><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black"> <o:p></o:p></span></p>
<p><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black">Thanks<o:p></o:p></span></p>
<p><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black">Tzachi<o:p></o:p></span></p>
</div>
</div>
</div>
</body>
</html>