net/sctp/offload.c
Source file repositories/reference/linux-study-clean/net/sctp/offload.c
File Facts
- System
- Linux kernel
- Corpus path
net/sctp/offload.c- Extension
.c- Size
- 2637 bytes
- Lines
- 121
- 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/kernel.hlinux/kprobes.hlinux/socket.hlinux/sctp.hlinux/proc_fs.hlinux/vmalloc.hlinux/module.hlinux/kfifo.hlinux/time.hnet/net_namespace.hlinux/skbuff.hnet/sctp/sctp.hnet/sctp/checksum.hnet/protocol.hnet/gso.h
Detected Declarations
function Copyrightfunction sctp_offload_init
Annotated Snippet
if (skb->len != skb->data_len) {
/* Means we have chunks in here too */
pinfo->gso_segs++;
}
skb_walk_frags(skb, frag_iter)
pinfo->gso_segs++;
segs = NULL;
goto out;
}
segs = skb_segment(skb, (features | NETIF_F_HW_CSUM) & ~NETIF_F_SG);
if (IS_ERR(segs))
goto out;
/* All that is left is update SCTP CRC if necessary */
if (!(features & NETIF_F_SCTP_CRC)) {
for (skb = segs; skb; skb = skb->next) {
if (skb->ip_summed == CHECKSUM_PARTIAL) {
sh = sctp_hdr(skb);
sh->checksum = sctp_gso_make_checksum(skb);
}
}
}
out:
return segs;
}
static const struct net_offload sctp_offload = {
.callbacks = {
.gso_segment = sctp_gso_segment,
},
};
static const struct net_offload sctp6_offload = {
.callbacks = {
.gso_segment = sctp_gso_segment,
},
};
int __init sctp_offload_init(void)
{
int ret;
ret = inet_add_offload(&sctp_offload, IPPROTO_SCTP);
if (ret)
goto out;
ret = inet6_add_offload(&sctp6_offload, IPPROTO_SCTP);
if (ret)
goto ipv4;
return ret;
ipv4:
inet_del_offload(&sctp_offload, IPPROTO_SCTP);
out:
return ret;
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/kprobes.h`, `linux/socket.h`, `linux/sctp.h`, `linux/proc_fs.h`, `linux/vmalloc.h`, `linux/module.h`, `linux/kfifo.h`.
- Detected declarations: `function Copyright`, `function sctp_offload_init`.
- 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.