include/linux/if_macvlan.h
Source file repositories/reference/linux-study-clean/include/linux/if_macvlan.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/if_macvlan.h- Extension
.h- Size
- 2831 bytes
- Lines
- 113
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/if_link.hlinux/if_vlan.hlinux/list.hlinux/netdevice.hlinux/netlink.hnet/netlink.hlinux/u64_stats_sync.h
Detected Declarations
struct macvlan_portstruct macvlan_devstruct rtnl_newlink_paramsfunction macvlan_count_rxfunction macvlan_dev_real_devfunction macvlan_dev_real_devfunction macvlan_supports_dest_filterfunction macvlan_release_l2fw_offload
Annotated Snippet
struct macvlan_dev {
struct net_device *dev;
struct list_head list;
struct hlist_node hlist;
struct macvlan_port *port;
struct net_device *lowerdev;
netdevice_tracker dev_tracker;
void *accel_priv;
struct vlan_pcpu_stats __percpu *pcpu_stats;
DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ);
netdev_features_t set_features;
enum macvlan_mode mode;
u16 flags;
unsigned int macaddr_count;
u32 bc_queue_len_req;
#ifdef CONFIG_NET_POLL_CONTROLLER
struct netpoll *netpoll;
#endif
};
static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
unsigned int len, bool success,
bool multicast)
{
if (likely(success)) {
struct vlan_pcpu_stats *pcpu_stats;
pcpu_stats = get_cpu_ptr(vlan->pcpu_stats);
u64_stats_update_begin(&pcpu_stats->syncp);
u64_stats_inc(&pcpu_stats->rx_packets);
u64_stats_add(&pcpu_stats->rx_bytes, len);
if (multicast)
u64_stats_inc(&pcpu_stats->rx_multicast);
u64_stats_update_end(&pcpu_stats->syncp);
put_cpu_ptr(vlan->pcpu_stats);
} else {
this_cpu_inc(vlan->pcpu_stats->rx_errors);
}
}
extern void macvlan_common_setup(struct net_device *dev);
struct rtnl_newlink_params;
extern int macvlan_common_newlink(struct net_device *dev,
struct rtnl_newlink_params *params,
struct netlink_ext_ack *extack);
extern void macvlan_dellink(struct net_device *dev, struct list_head *head);
extern int macvlan_link_register(struct rtnl_link_ops *ops);
#if IS_ENABLED(CONFIG_MACVLAN)
static inline struct net_device *
macvlan_dev_real_dev(const struct net_device *dev)
{
struct macvlan_dev *macvlan = netdev_priv(dev);
return macvlan->lowerdev;
}
#else
static inline struct net_device *
macvlan_dev_real_dev(const struct net_device *dev)
{
BUG();
return NULL;
}
#endif
static inline void *macvlan_accel_priv(struct net_device *dev)
{
struct macvlan_dev *macvlan = netdev_priv(dev);
return macvlan->accel_priv;
}
static inline bool macvlan_supports_dest_filter(struct net_device *dev)
{
struct macvlan_dev *macvlan = netdev_priv(dev);
return macvlan->mode == MACVLAN_MODE_PRIVATE ||
macvlan->mode == MACVLAN_MODE_VEPA ||
macvlan->mode == MACVLAN_MODE_BRIDGE;
}
static inline int macvlan_release_l2fw_offload(struct net_device *dev)
{
struct macvlan_dev *macvlan = netdev_priv(dev);
Annotation
- Immediate include surface: `linux/if_link.h`, `linux/if_vlan.h`, `linux/list.h`, `linux/netdevice.h`, `linux/netlink.h`, `net/netlink.h`, `linux/u64_stats_sync.h`.
- Detected declarations: `struct macvlan_port`, `struct macvlan_dev`, `struct rtnl_newlink_params`, `function macvlan_count_rx`, `function macvlan_dev_real_dev`, `function macvlan_dev_real_dev`, `function macvlan_supports_dest_filter`, `function macvlan_release_l2fw_offload`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.