From 295b6767adc8199ad0898ac7cb8ea5e473fac1b7 Mon Sep 17 00:00:00 2001 From: leonidk Date: Mon, 24 Mar 2008 11:51:01 +0000 Subject: [PATCH] bugfix in uplink offset calculation git-svn-id: svn://openib.tc.cornell.edu/gen1@1021 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- branches/ConnectX/inc/mthca/mthca_vc.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/branches/ConnectX/inc/mthca/mthca_vc.h b/branches/ConnectX/inc/mthca/mthca_vc.h index 3fdf7fff..7042c6c3 100644 --- a/branches/ConnectX/inc/mthca/mthca_vc.h +++ b/branches/ConnectX/inc/mthca/mthca_vc.h @@ -78,12 +78,18 @@ typedef struct { 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 -- 2.41.0