@@ -39,6 +39,7 @@
#include <linux/sched.h>
#include <asm/uaccess.h>
+#include <rdma/ib_addr.h>
#include "uverbs.h"
#include "core_priv.h"
@@ -515,7 +516,10 @@ ssize_t ib_uverbs_query_port(struct ib_uverbs_file *file,
resp.qkey_viol_cntr = attr.qkey_viol_cntr;
resp.pkey_tbl_len = attr.pkey_tbl_len;
resp.lid = attr.lid;
- resp.sm_lid = attr.sm_lid;
+ if (rdma_cap_opa_ah(ib_dev, cmd.port_num))
+ resp.sm_lid = OPA_TO_IB_UCAST_LID(attr.sm_lid);
+ else
+ resp.sm_lid = (u16)attr.sm_lid;
resp.lmc = attr.lmc;
resp.max_vl_num = attr.max_vl_num;
resp.sm_sl = attr.sm_sl;
@@ -514,7 +514,7 @@ static int srpt_refresh_port(struct srpt_port *sport)
if (ret)
goto err_query_port;
- sport->sm_lid = port_attr.sm_lid;
+ sport->sm_lid = (u16)port_attr.sm_lid;
sport->lid = port_attr.lid;
ret = ib_query_gid(sport->sdev->device, sport->port, 0, &sport->gid,
@@ -49,6 +49,9 @@
#include <net/ipv6.h>
#include <net/net_namespace.h>
+#define OPA_TO_IB_UCAST_LID(x) (((x) >= be16_to_cpu(IB_MULTICAST_LID_BASE)) \
+ ? 0 : x)
+
struct rdma_addr_client {
atomic_t refcount;
struct completion comp;
@@ -509,7 +509,7 @@ struct ib_port_attr {
u32 qkey_viol_cntr;
u16 pkey_tbl_len;
u16 lid;
- u16 sm_lid;
+ u32 sm_lid;
u8 lmc;
u8 max_vl_num;
u8 sm_sl;