Commit 55efcfcd authored by Jason Gunthorpe's avatar Jason Gunthorpe Committed by Doug Ledford

RDMA/core: Fix incorrect structure packing for booleans

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.

Cc: stable@vger.kernel.org
Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Signed-off-by: default avatarJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent df158561
...@@ -153,12 +153,12 @@ struct ib_sa_path_rec { ...@@ -153,12 +153,12 @@ struct ib_sa_path_rec {
union ib_gid sgid; union ib_gid sgid;
__be16 dlid; __be16 dlid;
__be16 slid; __be16 slid;
int raw_traffic; u8 raw_traffic;
/* reserved */ /* reserved */
__be32 flow_label; __be32 flow_label;
u8 hop_limit; u8 hop_limit;
u8 traffic_class; u8 traffic_class;
int reversible; u8 reversible;
u8 numb_path; u8 numb_path;
__be16 pkey; __be16 pkey;
__be16 qos_class; __be16 qos_class;
...@@ -220,7 +220,7 @@ struct ib_sa_mcmember_rec { ...@@ -220,7 +220,7 @@ struct ib_sa_mcmember_rec {
u8 hop_limit; u8 hop_limit;
u8 scope; u8 scope;
u8 join_state; u8 join_state;
int proxy_join; u8 proxy_join;
}; };
/* Service Record Component Mask Sec 15.2.5.14 Ver 1.1 */ /* Service Record Component Mask Sec 15.2.5.14 Ver 1.1 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment