diff mbox

[rdma-core,5/6] rsocket: Fix byte swapping when constructing path records

Message ID 1489615927-12117-6-git-send-email-jgunthorpe@obsidianresearch.com (mailing list archive)
State Accepted
Headers show

Commit Message

Jason Gunthorpe March 15, 2017, 10:12 p.m. UTC
These swaps were missed or in the wrong place

Found by sparse.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
 librdmacm/rsocket.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/librdmacm/rsocket.c b/librdmacm/rsocket.c
index a0bc604845c118..4fbe7aaa938610 100644
--- a/librdmacm/rsocket.c
+++ b/librdmacm/rsocket.c
@@ -3551,11 +3551,11 @@  static void rs_convert_sa_path(struct ibv_sa_path_rec *sa_path,
 	path_data->path.dlid = sa_path->dlid;
 	path_data->path.slid = sa_path->slid;
 	fl_hop = be32toh(sa_path->flow_label) << 8;
-	path_data->path.flowlabel_hoplimit = htobe32(fl_hop) | sa_path->hop_limit;
+	path_data->path.flowlabel_hoplimit = htobe32(fl_hop | sa_path->hop_limit);
 	path_data->path.tclass = sa_path->traffic_class;
 	path_data->path.reversible_numpath = sa_path->reversible << 7 | 1;
 	path_data->path.pkey = sa_path->pkey;
-	path_data->path.qosclass_sl = sa_path->sl;
+	path_data->path.qosclass_sl = htobe16(sa_path->sl);
 	path_data->path.mtu = sa_path->mtu | 2 << 6;	/* exactly */
 	path_data->path.rate = sa_path->rate | 2 << 6;
 	path_data->path.packetlifetime = sa_path->packet_life_time | 2 << 6;