diff options
author | Noa Osherovich <noaos@mellanox.com> | 2017-06-12 11:14:03 +0300 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-07-24 17:40:23 +0300 |
commit | be1d325a335840a86c133a56c6a911c368bac0fd (patch) | |
tree | 99f54a1d65b2ae6726e8f76f47d281dab31e5bbf /include/rdma/ib_addr.h | |
parent | 5236333592244557a19694a51337df6ac018f0a7 (diff) | |
download | linux-be1d325a335840a86c133a56c6a911c368bac0fd.tar.xz |
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.h | 8 |
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) |