Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

include/rdma/opa_addr.h: Fix an endianness issue

IB_MULTICAST_LID_BASE is defined as follows:

#define IB_MULTICAST_LID_BASE cpu_to_be16(0xC000)

Hence use be16_to_cpu() to convert it to CPU endianness. Compile-tested
only.

Fixes: af808ece5ce9 ("IB/SA: Check dlid before SA agent queries for ClassPortInfo")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Venkata Sandeep Dhanalakota <venkata.s.dhanalakota@intel.com>
Cc: Mike Marciniszyn <mike.marciniszyn@intel.com>
Cc: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>

authored by

Bart Van Assche and committed by
Jason Gunthorpe
4eefd62c 1c77483e

+1 -1
+1 -1
include/rdma/opa_addr.h
··· 120 120 if (attr->type == RDMA_AH_ATTR_TYPE_IB) { 121 121 if (!rdma_ah_get_dlid(attr) || 122 122 rdma_ah_get_dlid(attr) >= 123 - be32_to_cpu(IB_MULTICAST_LID_BASE)) 123 + be16_to_cpu(IB_MULTICAST_LID_BASE)) 124 124 return false; 125 125 } else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) { 126 126 if (!rdma_ah_get_dlid(attr) ||