[ofw] RE: IPoIB partitioning support potential bug?

Chas Williams (CONTRACTOR) chas at cmf.nrl.navy.mil
Mon Jun 9 09:11:45 PDT 2008


In message <6C2C79E72C305246B504CBA17B5500C9042D5399 at mtlexch01.mtl.com>,"Leonid Keller" writes:
>Please, review the attached patch. 

we had to make the following additional changes to get this patch to
work correctly.  since the port_guid.pkey is copied directly from
the g_pkeys array, the g_pkeys array needs to be in network order.
otherwise the test for the pkey in the pkey table table fails in
ulp/ipoib/kernel/ipoib_port.c at:

                for(index = 0; index < ca_attr->p_port_attr->num_pkeys; index++)
                {
                        if(p_port->p_adapter->guids.port_guid.pkey == ca_attr->p_port_attr->p_pkey_table[index])
                                break;
                }

p_pkey_table[] is in network order (its copied directly from the wire)
and guids.port_guid.pkey is in host order from __prepare_pKey_array().
for consistency, we just decided to make guids.port_guid.pkey network
order as well.

Index: core/bu(/kernel/bus_driver.c
===================================================================
--- core/bus/kernel/bus_driver.c        (revision 1255)
+++ core/bus/kernel/bus_driver.c        (working copy)
@@ -191,7 +191,7 @@
 * output:      pkey_array
 * return:      uint16_t number of pkey(s) found
 *************************************************************************************/
-static uint16_t __prepare_pKey_array(IN const UNICODE_STRING *str, OUT uint16_t *pkey_array)
+static uint16_t __prepare_pKey_array(IN const UNICODE_STRING *str, OUT ib_net16_t *pkey_array)
 {
        uint16_t i, num_pKeys, cur_pkey_length;
        NTSTATUS status;
@@ -300,6 +300,8 @@
                case '\0':
                        if(cur_pkey_length == PATTERN_LENGTH)
                        {
+                               pkey_array[num_pKeys] = cl_hton16(pkey_array[num_pKeys]);
+
                                cur_pkey_length = 0;
                                num_pKeys++;
                        }
@@ -436,7 +438,7 @@
        status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE,
                param_path.Buffer, table, NULL, NULL );
        if (NT_SUCCESS(status))
-                       g_pkeys.pkey_num = __prepare_pKey_array(&pkeyString, (uint16_t*)g_pkeys.pkey_array);
+                       g_pkeys.pkey_num = __prepare_pKey_array(&pkeyString, (ib_net16_t *)g_pkeys.pkey_array);
 #if DBG
        if( g_al_dbg_flags & AL_DBG_ERR )
                g_al_dbg_flags |= CL_DBG_ERROR;


with the above patch, this part of the your patch is no longer necessary
since the port_guid.pkey is already in network order at this point.

>Index: ulp/ipoib/kernel/ipoib_port.c
>===================================================================
>--- ulp/ipoib/kernel/ipoib_port.c	(revision 1222)
>+++ ulp/ipoib/kernel/ipoib_port.c	(working copy)
>@@ -4942,8 +4942,8 @@
> 	cl_memclr( &member_rec, sizeof(ib_member_rec_t) );
> 	member_rec.mgid = bcast_mgid_template;
> 
>-    member_rec.mgid.raw[4] = (uint8_t) p_port->p_adapter->guids.port_guid.pkey ;
>-	member_rec.mgid.raw[5] = (uint8_t) (p_port->p_adapter->guids.port_guid.pkey >> 8);
>+    member_rec.mgid.raw[4] = (uint8_t) (p_port->p_adapter->guids.port_guid.pkey >> 8) ;
>+	member_rec.mgid.raw[5] = (uint8_t) p_port->p_adapter->guids.port_guid.pkey;
> 	member_rec.pkey = p_port->p_adapter->guids.port_guid.pkey;
> 	cl_memclr( &query, sizeof(ib_query_req_t) );
> 	query.query_type = IB_QUERY_USER_DEFINED;
>@@ -5136,8 +5136,8 @@
> 	 * We specify the MGID since we don't want the SA to generate it for us.
> 	 */
> 	mcast_req.member_rec.mgid = bcast_mgid_template;
>-	mcast_req.member_rec.mgid.raw[4] = (uint8_t) p_port->p_adapter->guids.port_guid.pkey; 
>-	mcast_req.member_rec.mgid.raw[5] = (uint8_t) (p_port->p_adapter->guids.port_guid.pkey >> 8);
>+	mcast_req.member_rec.mgid.raw[4] = (uint8_t) (p_port->p_adapter->guids.port_guid.pkey >> 8); 
>+	mcast_req.member_rec.mgid.raw[5] = (uint8_t) p_port->p_adapter->guids.port_guid.pkey;
> 	ib_gid_set_default( &mcast_req.member_rec.port_gid,
> 		p_port->p_adapter->guids.port_guid.guid );
> 	/*



More information about the ofw mailing list