RDMA/core: Fix incorrect structure packing for booleans
authorJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Fri, 23 Dec 2016 01:07:52 +0000 (18:07 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 5 Jun 2017 20:13:41 +0000 (21:13 +0100)
commit18c7fb96d479ebc604f5a2e515e64f53f410d0e3
treeafb884b9e98a9c74b295299e362e0e3ead73a3c8
parent89e3b544dbd620c5a5bc9d7f4a4496ce704b4378
RDMA/core: Fix incorrect structure packing for booleans

commit 55efcfcd7776165b294f8b5cd6e05ca00ec89b7c upstream.

The RDMA core uses ib_pack() to convert from unpacked CPU structs
to on-the-wire bitpacked structs.

This process requires that 1 bit fields are declared as u8 in the
unpacked struct, otherwise the packing process does not read the
value properly and the packed result is wired to 0. Several
places wrongly used int.

Crucially this means the kernel has never, set reversible
correctly in the path record request. It has always asked for
irreversible paths even if the ULP requests otherwise.

When the kernel is used with a SM that supports this feature, it
completely breaks communication management if reversible paths are
not properly requested.

The only reason this ever worked is because opensm ignores the
reversible bit.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
include/rdma/ib_sa.h