Hi Reuven,

What is the problem with the alignment?  The board ID is a character string, so 
shouldn't need any special alignment.  Also, you are rounding the size down - 
is that the right thing to do?

What is the layout of the ca_attr buffer, and what are the alignment 
requirements for the different structures appended to the end?

Is MTHCA_BRD_ID_LEN going to cause the uplink info to be aligned?

Thanks,
-Fab

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Reuven Amitai
Sent: Wednesday, April 09, 2008 6:04 AM
To: [email protected]
Subject: [ofw] [PATCH] mthca patch [1/2]

Hi,

The following patch align the returned address.

Thanks, Reuven.

Index: inc/mthca/mthca_vc.h
===================================================================
--- inc/mthca/mthca_vc.h      (revision 1047)
+++ inc/mthca/mthca_vc.h      (working copy)
@@ -78,12 +78,18 @@

 inline char* mthca_get_board_id(ib_ca_attr_t *ca_attr)
 {
-    return (char*)(ca_attr)+(ca_attr->size - MTHCA_BRD_ID_LEN - 
sizeof(uplink_info_t));
+     int size = (ca_attr->size - MTHCA_BRD_ID_LEN - sizeof(uplink_info_t));
+     size &= ~(sizeof(void*) - 1);
+
+     return (char*)(ca_attr)+ size;
 }

 inline void* mthca_get_uplink_info(ib_ca_attr_t *ca_attr)
 {
-    return (char*)(ca_attr)+(ca_attr->size - sizeof(uplink_info_t));
+     int size = (ca_attr->size - sizeof(uplink_info_t));
+     size &= ~(sizeof(void*) - 1);
+
+     return (char*)(ca_attr)+ size;
 }

 #endif

_______________________________________________
ofw mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw

Reply via email to