aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/verbs.c
diff options
context:
space:
mode:
authorMatan Barak <matanb@mellanox.com>2016-01-04 10:49:54 +0200
committerDoug Ledford <dledford@redhat.com>2016-01-19 15:26:56 -0500
commitc3efe7500add077f79d37b18e9c66df6621409b6 (patch)
treec58ce0d2c62daabae7a900fd48ea1a45614a1dd0 /drivers/infiniband/core/verbs.c
parentIB/core: Rename rdma_addr_find_dmac_by_grh (diff)
downloadlinux-dev-c3efe7500add077f79d37b18e9c66df6621409b6.tar.xz
linux-dev-c3efe7500add077f79d37b18e9c66df6621409b6.zip
IB/core: Use hop-limit from IP stack for RoCE
Previously, IPV6_DEFAULT_HOPLIMIT was used as the hop limit value for RoCE. Fixing that by taking ip4_dst_hoplimit and ip6_dst_hoplimit as hop limit values. Signed-off-by: Matan Barak <matanb@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/core/verbs.c')
-rw-r--r--drivers/infiniband/core/verbs.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 97cbc96892a7..5af6d024e053 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -434,6 +434,7 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 port_num,
int ret;
enum rdma_network_type net_type = RDMA_NETWORK_IB;
enum ib_gid_type gid_type = IB_GID_TYPE_IB;
+ int hoplimit = 0xff;
union ib_gid dgid;
union ib_gid sgid;
@@ -471,7 +472,7 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 port_num,
ah_attr->dmac,
wc->wc_flags & IB_WC_WITH_VLAN ?
NULL : &vlan_id,
- &if_index);
+ &if_index, &hoplimit);
if (ret) {
dev_put(idev);
return ret;
@@ -520,7 +521,7 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 port_num,
ah_attr->grh.sgid_index = (u8) gid_index;
flow_class = be32_to_cpu(grh->version_tclass_flow);
ah_attr->grh.flow_label = flow_class & 0xFFFFF;
- ah_attr->grh.hop_limit = 0xFF;
+ ah_attr->grh.hop_limit = hoplimit;
ah_attr->grh.traffic_class = (flow_class >> 20) & 0xFF;
}
return 0;
@@ -1138,6 +1139,7 @@ int ib_resolve_eth_dmac(struct ib_qp *qp,
union ib_gid sgid;
struct ib_gid_attr sgid_attr;
int ifindex;
+ int hop_limit;
ret = ib_query_gid(qp->device,
qp_attr->ah_attr.port_num,
@@ -1149,21 +1151,17 @@ int ib_resolve_eth_dmac(struct ib_qp *qp,
ret = -ENXIO;
goto out;
}
- if (sgid_attr.gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP)
- /* TODO: get the hoplimit from the inet/inet6
- * device
- */
- qp_attr->ah_attr.grh.hop_limit =
- IPV6_DEFAULT_HOPLIMIT;
ifindex = sgid_attr.ndev->ifindex;
ret = rdma_addr_find_l2_eth_by_grh(&sgid,
&qp_attr->ah_attr.grh.dgid,
qp_attr->ah_attr.dmac,
- NULL, &ifindex);
+ NULL, &ifindex, &hop_limit);
dev_put(sgid_attr.ndev);
+
+ qp_attr->ah_attr.grh.hop_limit = hop_limit;
}
}
out: