drivers/net/vsockmon.c
Source file repositories/reference/linux-study-clean/drivers/net/vsockmon.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/vsockmon.c- Extension
.c- Size
- 2811 bytes
- Lines
- 123
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ethtool.hlinux/module.hlinux/kernel.hlinux/if_arp.hnet/rtnetlink.hnet/sock.hnet/af_vsock.huapi/linux/vsockmon.hlinux/virtio_vsock.h
Detected Declarations
struct vsockmonfunction vsockmon_openfunction vsockmon_closefunction vsockmon_xmitfunction vsockmon_get_stats64function vsockmon_is_valid_mtufunction vsockmon_change_mtufunction always_onfunction vsockmon_setupfunction vsockmon_registerfunction vsockmon_unregistermodule init vsockmon_register
Annotated Snippet
static const struct net_device_ops vsockmon_ops = {
.ndo_open = vsockmon_open,
.ndo_stop = vsockmon_close,
.ndo_start_xmit = vsockmon_xmit,
.ndo_get_stats64 = vsockmon_get_stats64,
.ndo_change_mtu = vsockmon_change_mtu,
};
static u32 always_on(struct net_device *dev)
{
return 1;
}
static const struct ethtool_ops vsockmon_ethtool_ops = {
.get_link = always_on,
};
static void vsockmon_setup(struct net_device *dev)
{
dev->type = ARPHRD_VSOCKMON;
dev->priv_flags |= IFF_NO_QUEUE;
dev->lltx = true;
dev->netdev_ops = &vsockmon_ops;
dev->ethtool_ops = &vsockmon_ethtool_ops;
dev->needs_free_netdev = true;
dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA;
dev->flags = IFF_NOARP;
dev->mtu = DEFAULT_MTU;
dev->pcpu_stat_type = NETDEV_PCPU_STAT_LSTATS;
}
static struct rtnl_link_ops vsockmon_link_ops __read_mostly = {
.kind = "vsockmon",
.priv_size = sizeof(struct vsockmon),
.setup = vsockmon_setup,
};
static __init int vsockmon_register(void)
{
return rtnl_link_register(&vsockmon_link_ops);
}
static __exit void vsockmon_unregister(void)
{
rtnl_link_unregister(&vsockmon_link_ops);
}
module_init(vsockmon_register);
module_exit(vsockmon_unregister);
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Gerard Garcia <ggarcia@deic.uab.cat>");
MODULE_DESCRIPTION("Vsock monitoring device. Based on nlmon device.");
MODULE_ALIAS_RTNL_LINK("vsockmon");
Annotation
- Immediate include surface: `linux/ethtool.h`, `linux/module.h`, `linux/kernel.h`, `linux/if_arp.h`, `net/rtnetlink.h`, `net/sock.h`, `net/af_vsock.h`, `uapi/linux/vsockmon.h`.
- Detected declarations: `struct vsockmon`, `function vsockmon_open`, `function vsockmon_close`, `function vsockmon_xmit`, `function vsockmon_get_stats64`, `function vsockmon_is_valid_mtu`, `function vsockmon_change_mtu`, `function always_on`, `function vsockmon_setup`, `function vsockmon_register`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.