net/sctp/transport.c
Source file repositories/reference/linux-study-clean/net/sctp/transport.c
File Facts
- System
- Linux kernel
- Corpus path
net/sctp/transport.c- Extension
.c- Size
- 26421 bytes
- Lines
- 853
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/slab.hlinux/types.hlinux/random.hnet/sctp/sctp.hnet/sctp/sm.h
Detected Declarations
function Copyrightfunction sctp_transport_freefunction sctp_transport_destroy_rcufunction sctp_transport_destroyfunction sctp_transport_reset_t3_rtxfunction sctp_transport_reset_hb_timerfunction sctp_transport_reset_reconf_timerfunction sctp_transport_reset_probe_timerfunction sctp_transport_reset_raise_timerfunction sctp_transport_set_ownerfunction sctp_transport_pmtufunction sctp_transport_pl_sendfunction sctp_transport_pl_recvfunction sctp_transport_pl_toobigfunction sctp_transport_update_pmtufunction sctp_transport_routefunction sctp_transport_holdfunction sctp_transport_putfunction sctp_transport_update_rtofunction sctp_transport_raise_cwndfunction sctp_transport_lower_cwndfunction datafunction sctp_transport_burst_resetfunction sctp_transport_timeoutfunction sctp_transport_resetfunction sctp_transport_immediate_rtxfunction sctp_transport_dst_releasefunction sctp_transport_dst_confirm
Annotated Snippet
if (t->pl.probe_size == SCTP_BASE_PLPMTU) { /* BASE_PLPMTU Confirmation Failed */
t->pl.state = SCTP_PL_ERROR; /* Base -> Error */
t->pl.pmtu = SCTP_BASE_PLPMTU;
t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
sctp_assoc_sync_pmtu(t->asoc);
}
} else if (t->pl.state == SCTP_PL_SEARCH) {
if (t->pl.pmtu == t->pl.probe_size) { /* Black Hole Detected */
t->pl.state = SCTP_PL_BASE; /* Search -> Base */
t->pl.probe_size = SCTP_BASE_PLPMTU;
t->pl.probe_high = 0;
t->pl.pmtu = SCTP_BASE_PLPMTU;
t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
sctp_assoc_sync_pmtu(t->asoc);
} else { /* Normal probe failure. */
t->pl.probe_high = t->pl.probe_size;
t->pl.probe_size = t->pl.pmtu;
}
} else if (t->pl.state == SCTP_PL_COMPLETE) {
if (t->pl.pmtu == t->pl.probe_size) { /* Black Hole Detected */
t->pl.state = SCTP_PL_BASE; /* Search Complete -> Base */
t->pl.probe_size = SCTP_BASE_PLPMTU;
t->pl.pmtu = SCTP_BASE_PLPMTU;
t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
sctp_assoc_sync_pmtu(t->asoc);
}
}
out:
pr_debug("%s: PLPMTUD: transport: %p, state: %d, pmtu: %d, size: %d, high: %d\n",
__func__, t, t->pl.state, t->pl.pmtu, t->pl.probe_size, t->pl.probe_high);
t->pl.probe_count++;
}
bool sctp_transport_pl_recv(struct sctp_transport *t)
{
pr_debug("%s: PLPMTUD: transport: %p, state: %d, pmtu: %d, size: %d, high: %d\n",
__func__, t, t->pl.state, t->pl.pmtu, t->pl.probe_size, t->pl.probe_high);
t->pl.pmtu = t->pl.probe_size;
t->pl.probe_count = 0;
if (t->pl.state == SCTP_PL_BASE) {
t->pl.state = SCTP_PL_SEARCH; /* Base -> Search */
t->pl.probe_size += SCTP_PL_BIG_STEP;
} else if (t->pl.state == SCTP_PL_ERROR) {
t->pl.state = SCTP_PL_SEARCH; /* Error -> Search */
t->pl.pmtu = t->pl.probe_size;
t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
sctp_assoc_sync_pmtu(t->asoc);
t->pl.probe_size += SCTP_PL_BIG_STEP;
} else if (t->pl.state == SCTP_PL_SEARCH) {
if (!t->pl.probe_high) {
if (t->pl.probe_size < SCTP_MAX_PLPMTU) {
t->pl.probe_size = min(t->pl.probe_size + SCTP_PL_BIG_STEP,
SCTP_MAX_PLPMTU);
return false;
}
t->pl.probe_high = SCTP_MAX_PLPMTU;
}
t->pl.probe_size += SCTP_PL_MIN_STEP;
if (t->pl.probe_size >= t->pl.probe_high) {
t->pl.probe_high = 0;
t->pl.state = SCTP_PL_COMPLETE; /* Search -> Search Complete */
t->pl.probe_size = t->pl.pmtu;
t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
sctp_assoc_sync_pmtu(t->asoc);
sctp_transport_reset_raise_timer(t);
}
} else if (t->pl.state == SCTP_PL_COMPLETE) {
/* Raise probe_size again after 30 * interval in Search Complete */
t->pl.state = SCTP_PL_SEARCH; /* Search Complete -> Search */
t->pl.probe_size = min(t->pl.probe_size + SCTP_PL_MIN_STEP, SCTP_MAX_PLPMTU);
}
return t->pl.state == SCTP_PL_COMPLETE;
}
static bool sctp_transport_pl_toobig(struct sctp_transport *t, u32 pmtu)
{
pr_debug("%s: PLPMTUD: transport: %p, state: %d, pmtu: %d, size: %d, ptb: %d\n",
__func__, t, t->pl.state, t->pl.pmtu, t->pl.probe_size, pmtu);
if (pmtu < SCTP_MIN_PLPMTU || pmtu >= t->pl.probe_size)
return false;
Annotation
- Immediate include surface: `linux/slab.h`, `linux/types.h`, `linux/random.h`, `net/sctp/sctp.h`, `net/sctp/sm.h`.
- Detected declarations: `function Copyright`, `function sctp_transport_free`, `function sctp_transport_destroy_rcu`, `function sctp_transport_destroy`, `function sctp_transport_reset_t3_rtx`, `function sctp_transport_reset_hb_timer`, `function sctp_transport_reset_reconf_timer`, `function sctp_transport_reset_probe_timer`, `function sctp_transport_reset_raise_timer`, `function sctp_transport_set_owner`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.