From ee8ecbe5196d002863e66ce2a0236d1b88a5999d Mon Sep 17 00:00:00 2001 From: Amir Vadai Date: Sun, 13 Dec 2009 09:52:16 +0200 Subject: [PATCH] sdp: small spec compliancy fixes in code Signed-off-by: Amir Vadai --- drivers/infiniband/ulp/sdp/sdp.h | 20 +++++++++++--------- drivers/infiniband/ulp/sdp/sdp_cma.c | 7 +++---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/infiniband/ulp/sdp/sdp.h b/drivers/infiniband/ulp/sdp/sdp.h index 09bea8711352..8af80dea46f4 100644 --- a/drivers/infiniband/ulp/sdp/sdp.h +++ b/drivers/infiniband/ulp/sdp/sdp.h @@ -8,6 +8,7 @@ #include #include #include +#include #include "sdp_dbg.h" /* Interval between sucessive polls in the Tx routine when polling is used @@ -140,7 +141,7 @@ struct sdp_bsdh { __u32 len; __u32 mseq; __u32 mseq_ack; -}; +} __attribute__((__packed__)); union cma_ip_addr { struct in6_addr ip6; @@ -148,7 +149,7 @@ union cma_ip_addr { __u32 pad[3]; __u32 addr; } ip4; -}; +} __attribute__((__packed__)); /* TODO: too much? Can I avoid having the src/dst and port here? */ struct sdp_hh { @@ -163,7 +164,8 @@ struct sdp_hh { __u16 rsvd2; union cma_ip_addr src_addr; union cma_ip_addr dst_addr; -}; + u8 rsvd3[IB_CM_REQ_PRIVATE_DATA_SIZE - sizeof(struct sdp_bsdh) - 48]; +} __attribute__((__packed__)); struct sdp_hah { struct sdp_bsdh bsdh; @@ -172,27 +174,27 @@ struct sdp_hah { u8 rsvd1; u8 ext_max_adverts; __u32 actrcvsz; - u8 rsvd2[172]; /* was 156 on SDP 1.0 */ -}; + u8 rsvd2[IB_CM_REP_PRIVATE_DATA_SIZE - sizeof(struct sdp_bsdh) - 8]; +} __attribute__((__packed__)); struct sdp_rrch { __u32 len; -}; +} __attribute__((__packed__)); struct sdp_srcah { __u32 len; __u32 rkey; __u64 vaddr; -}; +} __attribute__((__packed__)); struct sdp_buf { struct sk_buff *skb; u64 mapping[SDP_MAX_SEND_SKB_FRAGS + 1]; -}; +} __attribute__((__packed__)); struct sdp_chrecvbuf { u32 size; -}; +} __attribute__((__packed__)); /* Context used for synchronous zero copy bcopy (BZCOPY) */ struct bzcopy_state { diff --git a/drivers/infiniband/ulp/sdp/sdp_cma.c b/drivers/infiniband/ulp/sdp/sdp_cma.c index 5ad549638179..cf69d9bb91d9 100644 --- a/drivers/infiniband/ulp/sdp/sdp_cma.c +++ b/drivers/infiniband/ulp/sdp/sdp_cma.c @@ -344,9 +344,9 @@ int sdp_cma_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) rx_ring_posted(sdp_sk(sk))); memset(&hh, 0, sizeof hh); hh.bsdh.mid = SDP_MID_HELLO; - hh.bsdh.len = htonl(sizeof(struct sdp_bsdh) + - sizeof(struct sdp_hh)); + hh.bsdh.len = htonl(sizeof(struct sdp_hh)); hh.max_adverts = 1; + hh.ipv_cap = 0x40; hh.majv_minv = SDP_MAJV_MINV; sdp_init_buffers(sdp_sk(sk), rcvbuf_initial_size); hh.bsdh.bufs = htons(rx_ring_posted(sdp_sk(sk))); @@ -382,8 +382,7 @@ int sdp_cma_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) memset(&hah, 0, sizeof hah); hah.bsdh.mid = SDP_MID_HELLO_ACK; hah.bsdh.bufs = htons(rx_ring_posted(sdp_sk(child))); - hah.bsdh.len = htonl(sizeof(struct sdp_bsdh) + - sizeof(struct sdp_hah)); + hah.bsdh.len = htonl(sizeof(struct sdp_hah)); hah.majv_minv = SDP_MAJV_MINV; hah.ext_max_adverts = 1; /* Doesn't seem to be mandated by spec, but just in case */ -- 2.50.1