[ofw] RE: [PATCH] mthca patch [1/2]

Fab Tillier ftillier at windows.microsoft.com
Wed Apr 9 09:44:03 PDT 2008


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: ofw-bounces at lists.openfabrics.org [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Reuven Amitai
Sent: Wednesday, April 09, 2008 6:04 AM
To: ofw at lists.openfabrics.org
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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080409/c3a0d67b/attachment.html>


More information about the ofw mailing list