|
22 | 22 | #include <ucs/sys/sock.h> |
23 | 23 | #include <ucs/sys/sys.h> |
24 | 24 | #include <sys/poll.h> |
| 25 | +#include <netinet/in.h> |
25 | 26 | #include <libgen.h> |
26 | 27 | #include <pthread.h> |
27 | 28 | #include <sched.h> |
@@ -851,7 +852,7 @@ const char *uct_ib_gid_str(const union ibv_gid *gid, char *str, size_t max_size) |
851 | 852 |
|
852 | 853 | static int uct_ib_gid_is_ipv6_ll(const union ibv_gid *gid) |
853 | 854 | { |
854 | | - return ((gid->raw[0] == 0xfe) && ((gid->raw[1] & 0xc0) == 0x80)); |
| 855 | + return IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)gid); |
855 | 856 | } |
856 | 857 |
|
857 | 858 | static int uct_ib_device_is_addr_ipv4_mcast(const struct in6_addr *raw, |
@@ -1081,14 +1082,14 @@ uct_ib_device_select_gid(uct_ib_device_t *dev, uint8_t port_num, |
1081 | 1082 | static const size_t max_str_len = 200; |
1082 | 1083 | struct { |
1083 | 1084 | uct_ib_roce_version_info_t info; |
1084 | | - int skip_ll; /* link-local not allowed when true */ |
| 1085 | + int allow_ll; /* link-local allowed when true */ |
1085 | 1086 | } roce_prio[] = { |
1086 | | - {{UCT_IB_DEVICE_ROCE_V2, AF_INET}}, |
| 1087 | + {{UCT_IB_DEVICE_ROCE_V2, AF_INET}, 1}, |
| 1088 | + {{UCT_IB_DEVICE_ROCE_V2, AF_INET6}, 0}, |
1087 | 1089 | {{UCT_IB_DEVICE_ROCE_V2, AF_INET6}, 1}, |
1088 | | - {{UCT_IB_DEVICE_ROCE_V2, AF_INET6}}, |
1089 | | - {{UCT_IB_DEVICE_ROCE_V1, AF_INET}}, |
1090 | | - {{UCT_IB_DEVICE_ROCE_V1, AF_INET6}, 1}, |
1091 | | - {{UCT_IB_DEVICE_ROCE_V1, AF_INET6}} |
| 1090 | + {{UCT_IB_DEVICE_ROCE_V1, AF_INET}, 1}, |
| 1091 | + {{UCT_IB_DEVICE_ROCE_V1, AF_INET6}, 0}, |
| 1092 | + {{UCT_IB_DEVICE_ROCE_V1, AF_INET6}, 1} |
1092 | 1093 | }; |
1093 | 1094 | int gid_tbl_len = uct_ib_device_port_attr(dev, port_num)->gid_tbl_len; |
1094 | 1095 | ucs_status_t status = UCS_OK; |
@@ -1120,7 +1121,7 @@ uct_ib_device_select_gid(uct_ib_device_t *dev, uint8_t port_num, |
1120 | 1121 |
|
1121 | 1122 | if ((roce_prio[prio_idx].info.ver == gid_info_tmp.roce_info.ver) && |
1122 | 1123 | (roce_prio[prio_idx].info.addr_family == gid_info_tmp.roce_info.addr_family) && |
1123 | | - (!roce_prio[prio_idx].skip_ll || !uct_ib_gid_is_ipv6_ll(&gid_info_tmp.gid)) && |
| 1124 | + (roce_prio[prio_idx].allow_ll || !uct_ib_gid_is_ipv6_ll(&gid_info_tmp.gid)) && |
1124 | 1125 | uct_ib_device_test_roce_gid_index(dev, port_num, &gid_info_tmp.gid, i) && |
1125 | 1126 | uct_ib_device_match_roce_subnet(&gid_info_tmp, &subnets, |
1126 | 1127 | subnet_strs->mode)) { |
|
0 commit comments