aboutsummaryrefslogtreecommitdiffstats
path: root/include/rdma/ib_addr.h
diff options
context:
space:
mode:
authorNoa Osherovich <noaos@mellanox.com>2017-06-12 11:14:03 +0300
committerDoug Ledford <dledford@redhat.com>2017-07-24 10:40:23 -0400
commitbe1d325a335840a86c133a56c6a911c368bac0fd (patch)
tree99f54a1d65b2ae6726e8f76f47d281dab31e5bbf /include/rdma/ib_addr.h
parentIB/core: Fix the validations of a multicast LID in attach or detach operations (diff)
downloadlinux-dev-be1d325a335840a86c133a56c6a911c368bac0fd.tar.xz
linux-dev-be1d325a335840a86c133a56c6a911c368bac0fd.zip
IB/core: Set RoCEv2 MGID according to spec
RoCEv2 Annex states that for RoCEv2 over IPv4, the corresponding IPv4 address is encoded into the GID according to the following rule: GID= :ffff:<IPv4 address> Remove the 0xff0e prefix for RoCEv2 packets with IPv4 and leave it zeroed and change rdma_is_multicast_addr() to consider the new logic. Signed-off-by: Noa Osherovich <noaos@mellanox.com> Reviewed-by: Moni Shoua <monis@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'include/rdma/ib_addr.h')
-rw-r--r--include/rdma/ib_addr.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index b73a14edc85e..7aca12188ef3 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -304,7 +304,13 @@ static inline void rdma_get_ll_mac(struct in6_addr *addr, u8 *mac)
static inline int rdma_is_multicast_addr(struct in6_addr *addr)
{
- return addr->s6_addr[0] == 0xff;
+ u32 ipv4_addr;
+
+ if (addr->s6_addr[0] == 0xff)
+ return 1;
+
+ memcpy(&ipv4_addr, addr->s6_addr + 12, 4);
+ return (ipv6_addr_v4mapped(addr) && ipv4_is_multicast(ipv4_addr));
}
static inline void rdma_get_mcast_mac(struct in6_addr *addr, u8 *mac)