Bodong Wang
d40ad86570
IB/core: Fix ib_wc structure size to remain in 64 bytes boundary
commit cd2a6e7d384b043d5d029e39663061cebc949385 upstream.
The change of slid from u16 to u32 results in sizeof(struct ib_wc)
cross 64B boundary, which causes more cache misses. This patch
rearranges the fields and remain the size to 64B.
Pahole output before this change:
struct ib_wc {
union {
u64 wr_id; /* 8 */
struct ib_cqe * wr_cqe; /* 8 */
}; /* 0 8 */
enum ib_wc_status status; /* 8 4 */
enum ib_wc_opcode opcode; /* 12 4 */
u32 vendor_err; /* 16 4 */
u32 byte_len; /* 20 4 */
struct ib_qp * qp; /* 24 8 */
union {
__be32 imm_data; /* 4 */
u32 invalidate_rkey; /* 4 */
} ex; /* 32 4 */
u32 src_qp; /* 36 4 */
int wc_flags; /* 40 4 */
u16 pkey_index; /* 44 2 */
/* XXX 2 bytes hole, try to pack */
u32 slid; /* 48 4 */
u8 sl; /* 52 1 */
u8 dlid_path_bits; /* 53 1 */
u8 port_num; /* 54 1 */
u8 smac[6]; /* 55 6 */
/* XXX 1 byte hole, try to pack */
u16 vlan_id; /* 62 2 */
/* --- cacheline 1 boundary (64 bytes) --- */
u8 network_hdr_type; /* 64 1 */
/* size: 72, cachelines: 2, members: 17 */
/* sum members: 62, holes: 2, sum holes: 3 */
/* padding: 7 */
/* last cacheline: 8 bytes */
};
Pahole output after this change:
struct ib_wc {
union {
u64 wr_id; /* 8 */
struct ib_cqe * wr_cqe; /* 8 */
}; /* 0 8 */
enum ib_wc_status status; /* 8 4 */
enum ib_wc_opcode opcode; /* 12 4 */
u32 vendor_err; /* 16 4 */
u32 byte_len; /* 20 4 */
struct ib_qp * qp; /* 24 8 */
union {
__be32 imm_data; /* 4 */
u32 invalidate_rkey; /* 4 */
} ex; /* 32 4 */
u32 src_qp; /* 36 4 */
u32 slid; /* 40 4 */
int wc_flags; /* 44 4 */
u16 pkey_index; /* 48 2 */
u8 sl; /* 50 1 */
u8 dlid_path_bits; /* 51 1 */
u8 port_num; /* 52 1 */
u8 smac[6]; /* 53 6 */
/* XXX 1 byte hole, try to pack */
u16 vlan_id; /* 60 2 */
u8 network_hdr_type; /* 62 1 */
/* size: 64, cachelines: 1, members: 17 */
/* sum members: 62, holes: 1, sum holes: 1 */
/* padding: 1 */
};
Fixes: 7db20ecd1d ("IB/core: Change wc.slid from 16 to 32 bits")
Signed-off-by: Bodong Wang <bodong@mellanox.com>
Reviewed-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:42:14 +01:00
..
2017-12-20 10:10:36 +01:00
2017-01-12 23:00:00 -05:00
2017-05-01 14:37:28 -04:00
2017-06-27 16:56:33 -04:00
2017-05-23 12:27:21 -04:00
2017-08-08 14:47:18 -04:00
2017-12-20 10:10:35 +01:00
2015-12-23 15:58:30 -05:00
2017-06-01 17:20:14 -04:00
2015-09-03 15:50:32 -04:00
2017-09-08 18:26:49 -07:00
2017-04-25 15:40:28 -04:00
2018-02-22 15:42:14 +01:00
2017-03-28 16:43:25 -04:00
2016-12-14 11:38:28 -05:00
2015-05-05 09:18:01 -04:00
2016-05-13 13:37:18 -04:00
2017-08-22 14:22:37 -04:00
2017-04-20 15:19:35 -04:00
2016-12-14 11:01:58 -05:00
2017-08-22 14:22:37 -04:00
2017-05-01 14:37:28 -04:00
2017-05-01 14:37:28 -04:00
2017-11-02 11:10:55 +01:00
2017-08-22 14:22:37 -04:00
2016-03-10 20:37:24 -05:00
2017-08-28 19:12:31 -04:00
2017-08-28 19:12:31 -04:00
2017-09-05 15:15:30 -04:00
2017-08-31 08:35:14 -04:00
2017-08-31 08:35:14 -04:00
2017-08-31 08:35:11 -04:00