net/sctp/sm_sideeffect.c
Source file repositories/reference/linux-study-clean/net/sctp/sm_sideeffect.c
File Facts
- System
- Linux kernel
- Corpus path
net/sctp/sm_sideeffect.c- Extension
.c- Size
- 52309 bytes
- Lines
- 1831
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/skbuff.hlinux/types.hlinux/socket.hlinux/ip.hlinux/gfp.hnet/sock.hnet/sctp/sctp.hnet/sctp/sm.hnet/sctp/stream_sched.h
Detected Declarations
function sctp_do_ecn_ce_workfunction sctp_do_ecn_cwr_workfunction sctp_gen_sackfunction packetfunction sctp_generate_t3_rtx_eventfunction sctp_generate_timeout_eventfunction sctp_generate_t1_cookie_eventfunction sctp_generate_t1_init_eventfunction sctp_generate_t2_shutdown_eventfunction sctp_generate_t4_rto_eventfunction sctp_generate_t5_shutdown_guard_eventfunction sctp_generate_autoclose_eventfunction sctp_generate_heartbeat_eventfunction sctp_generate_proto_unreach_eventfunction sctp_generate_reconf_eventfunction sctp_generate_probe_eventfunction sctp_generate_sack_eventfunction sctp_do_8_2_transport_strikefunction abovefunction sctp_cmd_init_failedfunction sctp_cmd_assoc_failedfunction sctp_cmd_process_initfunction sctp_cmd_hb_timers_startfunction sctp_cmd_hb_timers_stopfunction list_for_each_entryfunction sctp_cmd_t3_rtx_timers_stopfunction list_for_each_entryfunction sctp_cmd_transport_onfunction sctp_cmd_process_sackfunction sctp_cmd_setup_t2function sctp_cmd_new_statefunction sctp_cmd_delete_tcbfunction addressfunction sctp_cmd_process_operrfunction sctp_cmd_del_non_primaryfunction list_for_each_safefunction sctp_cmd_set_sk_errfunction sctp_cmd_assoc_changefunction sctp_cmd_peer_no_authfunction sctp_cmd_adaptation_indfunction sctp_cmd_t1_timer_updatefunction sctp_cmd_send_msgfunction sctp_do_smfunction sctp_side_effectsfunction sctp_cmd_interpreterfunction list_for_each_entryfunction list_for_each_entry
Annotated Snippet
if (trans) {
/* We will need a SACK for the next packet. */
if (asoc->peer.sack_cnt >= trans->sackfreq - 1)
asoc->peer.sack_needed = 1;
asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] =
trans->sackdelay;
} else {
/* We will need a SACK for the next packet. */
if (asoc->peer.sack_cnt >= asoc->sackfreq - 1)
asoc->peer.sack_needed = 1;
asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] =
asoc->sackdelay;
}
/* Restart the SACK timer. */
sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART,
SCTP_TO(SCTP_EVENT_TIMEOUT_SACK));
} else {
__u32 old_a_rwnd = asoc->a_rwnd;
asoc->a_rwnd = asoc->rwnd;
sack = sctp_make_sack(asoc);
if (!sack) {
asoc->a_rwnd = old_a_rwnd;
goto nomem;
}
asoc->peer.sack_needed = 0;
asoc->peer.sack_cnt = 0;
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(sack));
/* Stop the SACK timer. */
sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
SCTP_TO(SCTP_EVENT_TIMEOUT_SACK));
}
return error;
nomem:
error = -ENOMEM;
return error;
}
/* When the T3-RTX timer expires, it calls this function to create the
* relevant state machine event.
*/
void sctp_generate_t3_rtx_event(struct timer_list *t)
{
struct sctp_transport *transport =
timer_container_of(transport, t, T3_rtx_timer);
struct sctp_association *asoc = transport->asoc;
struct sock *sk = asoc->base.sk;
struct net *net = sock_net(sk);
int error;
/* Check whether a task is in the sock. */
bh_lock_sock(sk);
if (sock_owned_by_user(sk)) {
pr_debug("%s: sock is busy\n", __func__);
/* Try again later. */
if (!mod_timer(&transport->T3_rtx_timer, jiffies + (HZ/20)))
sctp_transport_hold(transport);
goto out_unlock;
}
/* Run through the state machine. */
error = sctp_do_sm(net, SCTP_EVENT_T_TIMEOUT,
SCTP_ST_TIMEOUT(SCTP_EVENT_TIMEOUT_T3_RTX),
asoc->state,
asoc->ep, asoc,
transport, GFP_ATOMIC);
if (error)
sk->sk_err = -error;
out_unlock:
bh_unlock_sock(sk);
sctp_transport_put(transport);
}
/* This is a sa interface for producing timeout events. It works
* for timeouts which use the association as their parameter.
*/
static void sctp_generate_timeout_event(struct sctp_association *asoc,
enum sctp_event_timeout timeout_type)
{
Annotation
- Immediate include surface: `linux/skbuff.h`, `linux/types.h`, `linux/socket.h`, `linux/ip.h`, `linux/gfp.h`, `net/sock.h`, `net/sctp/sctp.h`, `net/sctp/sm.h`.
- Detected declarations: `function sctp_do_ecn_ce_work`, `function sctp_do_ecn_cwr_work`, `function sctp_gen_sack`, `function packet`, `function sctp_generate_t3_rtx_event`, `function sctp_generate_timeout_event`, `function sctp_generate_t1_cookie_event`, `function sctp_generate_t1_init_event`, `function sctp_generate_t2_shutdown_event`, `function sctp_generate_t4_rto_event`.
- 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.