Skip to content

Commit

Permalink
RDMA/core: Fix incorrect structure packing for booleans
Browse files Browse the repository at this point in the history
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: 1da177e ("Linux-2.6.12-rc2")
Signed-off-by: Jason Gunthorpe <[email protected]>
Signed-off-by: Doug Ledford <[email protected]>
Signed-off-by: Willy Tarreau <[email protected]>
  • Loading branch information
jgunthorpe authored and wtarreau committed Jun 7, 2017
1 parent 5beea85 commit e9a1e1c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/rdma/ib_sa.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ struct ib_sa_path_rec {
union ib_gid sgid;
__be16 dlid;
__be16 slid;
int raw_traffic;
u8 raw_traffic;
/* reserved */
__be32 flow_label;
u8 hop_limit;
u8 traffic_class;
int reversible;
u8 reversible;
u8 numb_path;
__be16 pkey;
__be16 qos_class;
Expand Down Expand Up @@ -193,7 +193,7 @@ struct ib_sa_mcmember_rec {
u8 hop_limit;
u8 scope;
u8 join_state;
int proxy_join;
u8 proxy_join;
};

/* Service Record Component Mask Sec 15.2.5.14 Ver 1.1 */
Expand Down

0 comments on commit e9a1e1c

Please sign in to comment.