Skip to content
Snippets Groups Projects
Commit 7045c7fd authored by Eric Barton's avatar Eric Barton
Browse files

* "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
parent a89b6105
No related branches found
No related tags found
No related merge requests found
...@@ -12,4 +12,4 @@ endif ...@@ -12,4 +12,4 @@ endif
endif endif
MOSTLYCLEANFILES = *.o *.ko *.mod.c MOSTLYCLEANFILES = *.o *.ko *.mod.c
DIST_SOURCES = $(kvibnal-objs:%.o=%.c) vibnal.h DIST_SOURCES = $(kvibnal-objs:%.o=%.c) vibnal.h vibnal_wire.h
...@@ -128,7 +128,7 @@ void vibnal_assert_wire_constants (void) ...@@ -128,7 +128,7 @@ void vibnal_assert_wire_constants (void)
CLASSERT ((int)sizeof(((kib_get_msg_t *)0)->ibgm_rd) == 8); CLASSERT ((int)sizeof(((kib_get_msg_t *)0)->ibgm_rd) == 8);
/* Checks for struct kib_completion_msg_t */ /* 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)offsetof(kib_completion_msg_t, ibcm_cookie) == 0);
CLASSERT ((int)sizeof(((kib_completion_msg_t *)0)->ibcm_cookie) == 8); CLASSERT ((int)sizeof(((kib_completion_msg_t *)0)->ibcm_cookie) == 8);
CLASSERT ((int)offsetof(kib_completion_msg_t, ibcm_status) == 8); CLASSERT ((int)offsetof(kib_completion_msg_t, ibcm_status) == 8);
...@@ -169,7 +169,7 @@ void vibnal_assert_wire_constants (void) ...@@ -169,7 +169,7 @@ void vibnal_assert_wire_constants (void)
CLASSERT ((int)offsetof(kib_msg_t, ibm_u.get) == 56); CLASSERT ((int)offsetof(kib_msg_t, ibm_u.get) == 56);
CLASSERT ((int)sizeof(((kib_msg_t *)0)->ibm_u.get) == 88); CLASSERT ((int)sizeof(((kib_msg_t *)0)->ibm_u.get) == 88);
CLASSERT ((int)offsetof(kib_msg_t, ibm_u.completion) == 56); 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 void
......
...@@ -8,13 +8,13 @@ typedef struct kib_connparams ...@@ -8,13 +8,13 @@ typedef struct kib_connparams
__u32 ibcp_queue_depth; __u32 ibcp_queue_depth;
__u32 ibcp_max_msg_size; __u32 ibcp_max_msg_size;
__u32 ibcp_max_frags; __u32 ibcp_max_frags;
} kib_connparams_t __attribute__((packed)); } WIRE_ATTR kib_connparams_t;
typedef struct typedef struct
{ {
ptl_hdr_t ibim_hdr; /* portals header */ ptl_hdr_t ibim_hdr; /* portals header */
char ibim_payload[0]; /* piggy-backed payload */ 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 /* 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 (<= * packing. Otherwise we can't fit enough frags into an IBNAL message (<=
...@@ -24,14 +24,14 @@ typedef struct ...@@ -24,14 +24,14 @@ typedef struct
__u32 rf_nob; /* # of bytes */ __u32 rf_nob; /* # of bytes */
__u32 rf_addr_lo; /* lo 4 bytes of vaddr */ __u32 rf_addr_lo; /* lo 4 bytes of vaddr */
__u32 rf_addr_hi; /* hi 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 typedef struct
{ {
__u32 rd_key; /* local/remote key */ __u32 rd_key; /* local/remote key */
__u32 rd_nfrag; /* # fragments */ __u32 rd_nfrag; /* # fragments */
kib_rdma_frag_t rd_frags[0]; /* buffer frags */ 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 /* 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 */ * to remember the source buffers while we wait for the PUT_ACK */
...@@ -40,28 +40,27 @@ typedef struct ...@@ -40,28 +40,27 @@ typedef struct
{ {
ptl_hdr_t ibprm_hdr; /* portals header */ ptl_hdr_t ibprm_hdr; /* portals header */
__u64 ibprm_cookie; /* opaque completion cookie */ __u64 ibprm_cookie; /* opaque completion cookie */
} kib_putreq_msg_t __attribute__((packed)); } WIRE_ATTR kib_putreq_msg_t;
typedef struct typedef struct
{ {
__u64 ibpam_src_cookie; /* reflected completion cookie */ __u64 ibpam_src_cookie; /* reflected completion cookie */
__u64 ibpam_dst_cookie; /* opaque completion cookie */ __u64 ibpam_dst_cookie; /* opaque completion cookie */
kib_rdma_desc_t ibpam_rd; /* sender's sink buffer */ kib_rdma_desc_t ibpam_rd; /* sender's sink buffer */
} kib_putack_msg_t __attribute__((packed)); } WIRE_ATTR kib_putack_msg_t;
typedef struct typedef struct
{ {
ptl_hdr_t ibgm_hdr; /* portals header */ ptl_hdr_t ibgm_hdr; /* portals header */
__u64 ibgm_cookie; /* opaque completion cookie */ __u64 ibgm_cookie; /* opaque completion cookie */
kib_rdma_desc_t ibgm_rd; /* rdma descriptor */ kib_rdma_desc_t ibgm_rd; /* rdma descriptor */
} kib_get_msg_t __attribute__((packed)); } WIRE_ATTR kib_get_msg_t;
typedef struct typedef struct
{ {
__u64 ibcm_cookie; /* opaque completion cookie */ __u64 ibcm_cookie; /* opaque completion cookie */
__s32 ibcm_status; /* < 0 failure: >= 0 length */ __s32 ibcm_status; /* < 0 failure: >= 0 length */
__u32 ibcm_pad; /* pad to 8 byte boundary */ } WIRE_ATTR kib_completion_msg_t;
} kib_completion_msg_t __attribute__((packed));
typedef struct typedef struct
{ {
...@@ -86,11 +85,11 @@ typedef struct ...@@ -86,11 +85,11 @@ typedef struct
kib_putack_msg_t putack; kib_putack_msg_t putack;
kib_get_msg_t get; kib_get_msg_t get;
kib_completion_msg_t completion; kib_completion_msg_t completion;
} ibm_u __attribute__((packed)); } WIRE_ATTR ibm_u;
} kib_msg_t __attribute__((packed)); } WIRE_ATTR kib_msg_t;
#define IBNAL_MSG_MAGIC 0x0be91b91 /* unique magic */ #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_CONNREQ 0xc0 /* connection request */
#define IBNAL_MSG_CONNACK 0xc1 /* connection acknowledge */ #define IBNAL_MSG_CONNACK 0xc1 /* connection acknowledge */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment