Skip to content

Commit 753a1c5

Browse files
committed
UCT/TCP: added reachability mode conf var to tcp_iface
1 parent a76c086 commit 753a1c5

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

src/uct/tcp/tcp.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,16 @@ typedef enum uct_tcp_ep_am_id {
229229
} uct_tcp_ep_am_id_t;
230230

231231

232+
/**
233+
* TCP Reachability mode.
234+
*/
235+
typedef enum {
236+
UCT_TCP_REACHABILITY_MODE_ROUTE = 0,
237+
UCT_TCP_REACHABILITY_MODE_ALL = 1,
238+
UCT_TCP_REACHABILITY_MODE_LAST
239+
} uct_tcp_iface_reachability_mode_t;
240+
241+
232242
/**
233243
* TCP PUT request header
234244
*/
@@ -422,6 +432,7 @@ typedef struct uct_tcp_iface {
422432
ucs_time_t intvl; /* The time between individual keepalive
423433
* probes (TCP_KEEPINTVL socket option). */
424434
} keepalive;
435+
unsigned reachability_mode; /* Mode used for performing reachability check */
425436
} config;
426437

427438
struct {
@@ -459,6 +470,7 @@ typedef struct uct_tcp_iface_config {
459470
ucs_time_t intvl;
460471
} keepalive;
461472
ucs_ternary_auto_value_t ep_bind_src_addr;
473+
unsigned reachability_mode;
462474
} uct_tcp_iface_config_t;
463475

464476

src/uct/tcp/tcp_iface.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222

2323
#define UCT_TCP_IFACE_NETDEV_DIR "/sys/class/net"
2424

25+
const char *uct_tcp_reachability_modes[] = {
26+
[UCT_TCP_REACHABILITY_MODE_ROUTE] = "route",
27+
[UCT_TCP_REACHABILITY_MODE_ALL] = "all",
28+
[UCT_TCP_REACHABILITY_MODE_LAST] = NULL
29+
};
30+
2531
extern ucs_class_t UCS_CLASS_DECL_NAME(uct_tcp_iface_t);
2632

2733
static ucs_config_field_t uct_tcp_iface_config_table[] = {
@@ -118,6 +124,12 @@ static ucs_config_field_t uct_tcp_iface_config_table[] = {
118124
ucs_offsetof(uct_tcp_iface_config_t, ep_bind_src_addr),
119125
UCS_CONFIG_TYPE_TERNARY},
120126

127+
{"REACHABILITY_MODE", "route",
128+
"The mode used for performing the reachability check\n"
129+
" - route - all routable addresses are assumed as reachable\n"
130+
" - all - all addresses are assumed as reachable, without any check",
131+
ucs_offsetof(uct_tcp_iface_config_t, reachability_mode), UCS_CONFIG_TYPE_ENUM(uct_tcp_reachability_modes)},
132+
121133
{NULL}
122134
};
123135

@@ -241,12 +253,15 @@ uct_tcp_iface_is_reachable_v2(const uct_iface_h tl_iface,
241253
}
242254
}
243255

244-
if ((params->field_mask & UCT_IFACE_IS_REACHABLE_FIELD_SCOPE) &&
245-
(params->scope == UCT_IFACE_REACHABILITY_SCOPE_DEVICE)) {
256+
if (((params->field_mask & UCT_IFACE_IS_REACHABLE_FIELD_SCOPE) &&
257+
(params->scope == UCT_IFACE_REACHABILITY_SCOPE_DEVICE)) ||
258+
(iface->config.reachability_mode == UCT_TCP_REACHABILITY_MODE_ALL)) {
246259
return uct_iface_scope_is_reachable(tl_iface, params);
247260
}
248261

249262
/* Check if the remote address is routable */
263+
ucs_assert(iface->config.reachability_mode ==
264+
UCT_TCP_REACHABILITY_MODE_ROUTE);
250265
status = ucs_ifname_to_index(iface->if_name, &ndev_index);
251266
if (status != UCS_OK) {
252267
uct_iface_fill_info_str_buf(
@@ -763,6 +778,7 @@ static UCS_CLASS_INIT_FUNC(uct_tcp_iface_t, uct_md_h md, uct_worker_h worker,
763778
self->config.keepalive.cnt = config->keepalive.cnt;
764779
self->config.keepalive.intvl = config->keepalive.intvl;
765780
self->config.ep_bind_src_addr = config->ep_bind_src_addr;
781+
self->config.reachability_mode = config->reachability_mode;
766782
self->port_range.first = config->port_range.first;
767783
self->port_range.last = config->port_range.last;
768784

0 commit comments

Comments
 (0)