UCT/TCP: added reachability mode conf var to tcp_iface
What?
Added UCX_TCP_REACHABILITY_MODE config (default: route) to optionally allow all addresses without route checking when set to all.
Solving bug: https://redmine.mellanox.com/issues/4659780
Summary by CodeRabbit
-
New Features
- Added a TCP "reachability mode" configuration with three options: route (default), all, and last.
- Selecting "all" treats all network addresses as reachable; the chosen mode is exposed in configuration and applied at runtime to influence reachability checks.
@shasson5 please look
Walkthrough
Adds a configurable TCP interface reachability mode enum and wires it through the public config, initialization, and the reachability check so the iface can treat addresses as routability-checked or universally reachable.
Changes
| Cohort / File(s) | Change Summary |
|---|---|
Header: public types & config src/uct/tcp/tcp.h |
Added typedef enum uct_tcp_reachability_mode_t { UCT_TCP_REACHABILITY_ROUTE, UCT_TCP_REACHABILITY_ALL, UCT_TCP_REACHABILITY_LAST }; added reachability_mode field to the iface config area and to uct_tcp_iface_config_t. |
Implementation & config table src/uct/tcp/tcp_iface.c |
Added const char *uct_tcp_reachability_modes[] string mapping and REACHABILITY_MODE config entry (default "route"); propagated reachability_mode from TL config into self->config; modified uct_tcp_iface_is_reachable_v2 to use uct_iface_scope_is_reachable when mode==ALL and to perform routability checks when mode==ROUTE. |
Sequence Diagram(s)
sequenceDiagram
participant Caller as reachability caller
participant IFACE as TCP_IFACE\n(config.reachability_mode)
participant SCOPE as ScopeChecker
participant ROUTE as RoutabilityChecker
Caller->>IFACE: uct_tcp_iface_is_reachable_v2(addr)
alt config == ALL
IFACE->>SCOPE: uct_iface_scope_is_reachable(addr)
SCOPE-->>IFACE: reachable / not reachable
IFACE-->>Caller: return result
else config == ROUTE
IFACE->>ROUTE: check address routability (if_nametoindex / name-index)
ROUTE-->>IFACE: routable / not routable
IFACE-->>Caller: return result
end
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
- Pay attention to:
- Correct enum ↔ string mapping and NUL termination of
uct_tcp_reachability_modes[]. - Config table entry syntax, default value, and how the enum is parsed.
- Proper propagation of
reachability_modeintoself->configduring init. - The conditional logic in
uct_tcp_iface_is_reachable_v2to ensure no regressions in routability checks.
- Correct enum ↔ string mapping and NUL termination of
Poem
🐰 I nibble configs, choose route or all,
A hop of enum, a tiny call,
From table into runtime I bound,
Scope or route — I check the ground,
TCP carrots scattered round.
Pre-merge checks and finishing touches
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The PR title accurately summarizes the main change: adding a reachability mode configuration variable to tcp_iface, which is directly reflected in the code additions across tcp.h and tcp_iface.c. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
Comment @coderabbitai help to get the list of available commands and usage tips.
BTW why is WIP label set?
BTW why is WIP label set? By mistake