Skip to content

Commit 56d0a7d

Browse files
paravmellanoxjgunthorpe
authored andcommitted
IB/core: Depend on IPv6 stack to resolve link local address for RoCEv2
RoCEv1 does not use the IPv6 stack to resolve the link local DGID since it uses GID address. It forms the DMAC directly from the DGID. The code became confused and also tried to use this bypass for RoCEv2 packets, however RoCEv2 always uses a IP address in the GID and must always use ARP or neighbor discovery to get the DMAC address. Now that rdma_addr_find_l2_eth_by_grh() supports resolving link local address to find destination mac address, lets make use of it. This aligns it to how the rest of the IPv6 stack resolves link local destination IPv6 address. Signed-off-by: Parav Pandit <[email protected]> Reviewed-by: Eli Cohen <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 1060f86 commit 56d0a7d

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

drivers/infiniband/core/verbs.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,20 @@ static int ib_resolve_unicast_gid_dmac(struct ib_device *device,
506506
return ret;
507507
}
508508

509+
/* If destination is link local and source GID is RoCEv1,
510+
* IP stack is not used.
511+
*/
512+
if (rdma_link_local_addr((struct in6_addr *)grh->dgid.raw) &&
513+
sgid_attr.gid_type == IB_GID_TYPE_ROCE) {
514+
rdma_get_ll_mac((struct in6_addr *)grh->dgid.raw,
515+
ah_attr->roce.dmac);
516+
goto done;
517+
}
518+
509519
ret = rdma_addr_find_l2_eth_by_grh(&sgid, &grh->dgid,
510520
ah_attr->roce.dmac,
511521
sgid_attr.ndev, &hop_limit);
522+
done:
512523
dev_put(sgid_attr.ndev);
513524

514525
grh->hop_limit = hop_limit;
@@ -1280,11 +1291,6 @@ static int ib_resolve_eth_dmac(struct ib_device *device,
12801291

12811292
grh = rdma_ah_retrieve_grh(ah_attr);
12821293

1283-
if (rdma_link_local_addr((struct in6_addr *)grh->dgid.raw)) {
1284-
rdma_get_ll_mac((struct in6_addr *)grh->dgid.raw,
1285-
ah_attr->roce.dmac);
1286-
return 0;
1287-
}
12881294
if (rdma_is_multicast_addr((struct in6_addr *)ah_attr->grh.dgid.raw)) {
12891295
if (ipv6_addr_v4mapped((struct in6_addr *)ah_attr->grh.dgid.raw)) {
12901296
__be32 addr = 0;

0 commit comments

Comments
 (0)