net/ipv6/ip6_offload.c
Source file repositories/reference/linux-study-clean/net/ipv6/ip6_offload.c
File Facts
- System
- Linux kernel
- Corpus path
net/ipv6/ip6_offload.c- Extension
.c- Size
- 11117 bytes
- Lines
- 463
- 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/kernel.hlinux/socket.hlinux/netdevice.hlinux/skbuff.hlinux/printk.hnet/protocol.hnet/ipv6.hnet/inet_common.hnet/tcp.hnet/udp.hnet/gro.hnet/gso.hip6_offload.htcpv6_offload.c
Detected Declarations
function ipv6_gro_pull_exthdrsfunction ipv6_gso_pull_exthdrsfunction ipv6_gso_pull_exthdrsfunction list_for_each_entryfunction memcmpfunction ipv6_gro_completefunction sit_gro_completefunction ip6ip6_gro_completefunction ip4ip6_gro_completefunction ipv6_offload_initmodule init ipv6_offload_init
Annotated Snippet
if (udpfrag) {
int err = ip6_find_1stfragopt(skb, &prevhdr);
if (err < 0) {
kfree_skb_list(segs);
return ERR_PTR(err);
}
fptr = (struct frag_hdr *)((u8 *)ipv6h + err);
fptr->frag_off = htons(offset);
if (skb->next)
fptr->frag_off |= htons(IP6_MF);
offset += (ntohs(ipv6h->payload_len) -
sizeof(struct frag_hdr));
}
if (encap)
skb_reset_inner_headers(skb);
}
out:
return segs;
}
/* Return the total length of all the extension hdrs, following the same
* logic in ipv6_gso_pull_exthdrs() when parsing ext-hdrs.
*/
static int ipv6_exthdrs_len(struct ipv6hdr *iph,
const struct net_offload **opps)
{
struct ipv6_opt_hdr *opth = (void *)iph;
int len = 0, proto, optlen = sizeof(*iph);
proto = iph->nexthdr;
for (;;) {
*opps = rcu_dereference(inet6_offloads[proto]);
if (unlikely(!(*opps)))
break;
if (!((*opps)->flags & INET6_PROTO_GSO_EXTHDR))
break;
opth = (void *)opth + optlen;
optlen = ipv6_optlen(opth);
len += optlen;
proto = opth->nexthdr;
}
return len;
}
INDIRECT_CALLABLE_SCOPE struct sk_buff *ipv6_gro_receive(struct list_head *head,
struct sk_buff *skb)
{
const struct net_offload *ops;
struct sk_buff *pp = NULL;
struct sk_buff *p;
struct ipv6hdr *iph;
unsigned int nlen;
unsigned int hlen;
unsigned int off;
u16 flush = 1;
int proto;
off = skb_gro_offset(skb);
hlen = off + sizeof(*iph);
iph = skb_gro_header(skb, hlen, off);
if (unlikely(!iph))
goto out;
NAPI_GRO_CB(skb)->network_offsets[NAPI_GRO_CB(skb)->encap_mark] = off;
flush += ntohs(iph->payload_len) != skb->len - hlen;
proto = iph->nexthdr;
ops = rcu_dereference(inet6_offloads[proto]);
if (!ops || !ops->callbacks.gro_receive) {
proto = ipv6_gro_pull_exthdrs(skb, hlen, proto);
ops = rcu_dereference(inet6_offloads[proto]);
if (!ops || !ops->callbacks.gro_receive)
goto out;
iph = skb_gro_network_header(skb);
} else {
skb_gro_pull(skb, sizeof(*iph));
}
skb_set_transport_header(skb, skb_gro_offset(skb));
NAPI_GRO_CB(skb)->proto = proto;
flush--;
nlen = skb_gro_offset(skb) - off;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/socket.h`, `linux/netdevice.h`, `linux/skbuff.h`, `linux/printk.h`, `net/protocol.h`, `net/ipv6.h`, `net/inet_common.h`.
- Detected declarations: `function ipv6_gro_pull_exthdrs`, `function ipv6_gso_pull_exthdrs`, `function ipv6_gso_pull_exthdrs`, `function list_for_each_entry`, `function memcmp`, `function ipv6_gro_complete`, `function sit_gro_complete`, `function ip6ip6_gro_complete`, `function ip4ip6_gro_complete`, `function ipv6_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.