drivers/net/ipvlan/ipvlan_core.c
Source file repositories/reference/linux-study-clean/drivers/net/ipvlan/ipvlan_core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ipvlan/ipvlan_core.c- Extension
.c- Size
- 18758 bytes
- Lines
- 805
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
net/flow.hnet/ip.hipvlan.h
Detected Declarations
function ipvlan_init_secretfunction ipvlan_count_rxfunction ipvlan_get_v6_hashfunction ipvlan_get_v6_hashfunction ipvlan_get_v4_hashfunction addr_equalfunction ipvlan_ht_addr_addfunction ipvlan_ht_addr_delfunction list_for_each_entryfunction ipvlan_addr_busyfunction ipvlan_mac_hashfunction ipvlan_process_multicastfunction list_for_each_entry_rcufunction ipvlan_skb_crossing_nsfunction ipvlan_rcv_framefunction ipvlan_process_v4_outboundfunction ipvlan_route_v6_outboundfunction ipvlan_process_v6_outboundfunction ipvlan_process_v6_outboundfunction ipvlan_process_outboundfunction ipvlan_multicast_enqueuefunction ipvlan_xmit_mode_l3function ipvlan_xmit_mode_l2function ipvlan_queue_xmitfunction ipvlan_external_framefunction ipvlan_handle_mode_l3function ipvlan_handle_mode_l2function ipvlan_handle_frameexport ipvlan_count_rx
Annotated Snippet
if (ipvlan_find_addr(ipvlan, iaddr, is_v6)) {
ret = true;
break;
}
}
rcu_read_unlock();
return ret;
}
void *ipvlan_get_L3_hdr(struct ipvl_port *port, struct sk_buff *skb, int *type)
{
void *lyr3h = NULL;
switch (skb->protocol) {
case htons(ETH_P_ARP): {
struct arphdr *arph;
if (unlikely(!pskb_may_pull(skb, arp_hdr_len(port->dev))))
return NULL;
arph = arp_hdr(skb);
*type = IPVL_ARP;
lyr3h = arph;
break;
}
case htons(ETH_P_IP): {
u32 pktlen;
struct iphdr *ip4h;
if (unlikely(!pskb_may_pull(skb, sizeof(*ip4h))))
return NULL;
ip4h = ip_hdr(skb);
pktlen = skb_ip_totlen(skb);
if (ip4h->ihl < 5 || ip4h->version != 4)
return NULL;
if (skb->len < pktlen || pktlen < (ip4h->ihl * 4))
return NULL;
*type = IPVL_IPV4;
lyr3h = ip4h;
break;
}
#if IS_ENABLED(CONFIG_IPV6)
case htons(ETH_P_IPV6): {
struct ipv6hdr *ip6h;
if (unlikely(!pskb_may_pull(skb, sizeof(*ip6h))))
return NULL;
ip6h = ipv6_hdr(skb);
if (ip6h->version != 6)
return NULL;
*type = IPVL_IPV6;
lyr3h = ip6h;
/* Only Neighbour Solicitation pkts need different treatment */
if (ipv6_addr_any(&ip6h->saddr) &&
ip6h->nexthdr == NEXTHDR_ICMP) {
struct icmp6hdr *icmph;
if (unlikely(!pskb_may_pull(skb, sizeof(*ip6h) + sizeof(*icmph))))
return NULL;
ip6h = ipv6_hdr(skb);
icmph = (struct icmp6hdr *)(ip6h + 1);
if (icmph->icmp6_type == NDISC_NEIGHBOUR_SOLICITATION) {
/* Need to access the ipv6 address in body */
if (unlikely(!pskb_may_pull(skb, sizeof(*ip6h) + sizeof(*icmph)
+ sizeof(struct in6_addr))))
return NULL;
ip6h = ipv6_hdr(skb);
icmph = (struct icmp6hdr *)(ip6h + 1);
}
*type = IPVL_ICMPV6;
lyr3h = icmph;
}
break;
}
#endif
default:
return NULL;
}
return lyr3h;
}
Annotation
- Immediate include surface: `net/flow.h`, `net/ip.h`, `ipvlan.h`.
- Detected declarations: `function ipvlan_init_secret`, `function ipvlan_count_rx`, `function ipvlan_get_v6_hash`, `function ipvlan_get_v6_hash`, `function ipvlan_get_v4_hash`, `function addr_equal`, `function ipvlan_ht_addr_add`, `function ipvlan_ht_addr_del`, `function list_for_each_entry`, `function ipvlan_addr_busy`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.