From 7045c7fdd8b5de1ad92aa4db356ae7a2cead5d8b Mon Sep 17 00:00:00 2001 From: eeb Date: Fri, 18 Mar 2005 11:48:47 +0000 Subject: [PATCH] * "proper" fix for 5890: fixed the misplaced vibnal wire struct __attribute__((packed)) statements, bumped wire protocol version and rebuilt wire struct assertions. * Added new vibnal_wire.h into autoMakefile.am --- lnet/klnds/viblnd/autoMakefile.am | 2 +- lnet/klnds/viblnd/viblnd.c | 4 ++-- lnet/klnds/viblnd/viblnd_wire.h | 23 +++++++++++------------ 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/lnet/klnds/viblnd/autoMakefile.am b/lnet/klnds/viblnd/autoMakefile.am index eb65412..6d5de4c 100644 --- a/lnet/klnds/viblnd/autoMakefile.am +++ b/lnet/klnds/viblnd/autoMakefile.am @@ -12,4 +12,4 @@ endif endif MOSTLYCLEANFILES = *.o *.ko *.mod.c -DIST_SOURCES = $(kvibnal-objs:%.o=%.c) vibnal.h +DIST_SOURCES = $(kvibnal-objs:%.o=%.c) vibnal.h vibnal_wire.h diff --git a/lnet/klnds/viblnd/viblnd.c b/lnet/klnds/viblnd/viblnd.c index 73542fa..b89fc11 100644 --- a/lnet/klnds/viblnd/viblnd.c +++ b/lnet/klnds/viblnd/viblnd.c @@ -128,7 +128,7 @@ void vibnal_assert_wire_constants (void) CLASSERT ((int)sizeof(((kib_get_msg_t *)0)->ibgm_rd) == 8); /* Checks for struct kib_completion_msg_t */ - CLASSERT ((int)sizeof(kib_completion_msg_t) == 16); + CLASSERT ((int)sizeof(kib_completion_msg_t) == 12); CLASSERT ((int)offsetof(kib_completion_msg_t, ibcm_cookie) == 0); CLASSERT ((int)sizeof(((kib_completion_msg_t *)0)->ibcm_cookie) == 8); CLASSERT ((int)offsetof(kib_completion_msg_t, ibcm_status) == 8); @@ -169,7 +169,7 @@ void vibnal_assert_wire_constants (void) CLASSERT ((int)offsetof(kib_msg_t, ibm_u.get) == 56); CLASSERT ((int)sizeof(((kib_msg_t *)0)->ibm_u.get) == 88); CLASSERT ((int)offsetof(kib_msg_t, ibm_u.completion) == 56); - CLASSERT ((int)sizeof(((kib_msg_t *)0)->ibm_u.completion) == 16); + CLASSERT ((int)sizeof(((kib_msg_t *)0)->ibm_u.completion) == 12); } void diff --git a/lnet/klnds/viblnd/viblnd_wire.h b/lnet/klnds/viblnd/viblnd_wire.h index cd1ba5f..3cb8d1f 100644 --- a/lnet/klnds/viblnd/viblnd_wire.h +++ b/lnet/klnds/viblnd/viblnd_wire.h @@ -8,13 +8,13 @@ typedef struct kib_connparams __u32 ibcp_queue_depth; __u32 ibcp_max_msg_size; __u32 ibcp_max_frags; -} kib_connparams_t __attribute__((packed)); +} WIRE_ATTR kib_connparams_t; typedef struct { ptl_hdr_t ibim_hdr; /* portals header */ char ibim_payload[0]; /* piggy-backed payload */ -} kib_immediate_msg_t __attribute__((packed)); +} WIRE_ATTR kib_immediate_msg_t; /* YEUCH! the __u64 address is split into 2 __u32 fields to ensure proper * packing. Otherwise we can't fit enough frags into an IBNAL message (<= @@ -24,14 +24,14 @@ typedef struct __u32 rf_nob; /* # of bytes */ __u32 rf_addr_lo; /* lo 4 bytes of vaddr */ __u32 rf_addr_hi; /* hi 4 bytes of vaddr */ -} kib_rdma_frag_t __attribute__((packed)); +} WIRE_ATTR kib_rdma_frag_t; typedef struct { __u32 rd_key; /* local/remote key */ __u32 rd_nfrag; /* # fragments */ kib_rdma_frag_t rd_frags[0]; /* buffer frags */ -} kib_rdma_desc_t __attribute__((packed)); +} WIRE_ATTR kib_rdma_desc_t; /* CAVEAT EMPTOR! We don't actually put ibprm_rd on the wire; it's just there * to remember the source buffers while we wait for the PUT_ACK */ @@ -40,28 +40,27 @@ typedef struct { ptl_hdr_t ibprm_hdr; /* portals header */ __u64 ibprm_cookie; /* opaque completion cookie */ -} kib_putreq_msg_t __attribute__((packed)); +} WIRE_ATTR kib_putreq_msg_t; typedef struct { __u64 ibpam_src_cookie; /* reflected completion cookie */ __u64 ibpam_dst_cookie; /* opaque completion cookie */ kib_rdma_desc_t ibpam_rd; /* sender's sink buffer */ -} kib_putack_msg_t __attribute__((packed)); +} WIRE_ATTR kib_putack_msg_t; typedef struct { ptl_hdr_t ibgm_hdr; /* portals header */ __u64 ibgm_cookie; /* opaque completion cookie */ kib_rdma_desc_t ibgm_rd; /* rdma descriptor */ -} kib_get_msg_t __attribute__((packed)); +} WIRE_ATTR kib_get_msg_t; typedef struct { __u64 ibcm_cookie; /* opaque completion cookie */ __s32 ibcm_status; /* < 0 failure: >= 0 length */ - __u32 ibcm_pad; /* pad to 8 byte boundary */ -} kib_completion_msg_t __attribute__((packed)); +} WIRE_ATTR kib_completion_msg_t; typedef struct { @@ -86,11 +85,11 @@ typedef struct kib_putack_msg_t putack; kib_get_msg_t get; kib_completion_msg_t completion; - } ibm_u __attribute__((packed)); -} kib_msg_t __attribute__((packed)); + } WIRE_ATTR ibm_u; +} WIRE_ATTR kib_msg_t; #define IBNAL_MSG_MAGIC 0x0be91b91 /* unique magic */ -#define IBNAL_MSG_VERSION 5 /* current protocol version */ +#define IBNAL_MSG_VERSION 6 /* current protocol version */ #define IBNAL_MSG_CONNREQ 0xc0 /* connection request */ #define IBNAL_MSG_CONNACK 0xc1 /* connection acknowledge */ -- 1.8.3.1