include/net/selftests.h
Source file repositories/reference/linux-study-clean/include/net/selftests.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/selftests.h- Extension
.h- Size
- 1508 bytes
- Lines
- 77
- 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/ethtool.hlinux/netdevice.h
Detected Declarations
struct net_packet_attrsstruct net_test_privstruct netsfhdrfunction net_selftestfunction net_selftest_get_strings
Annotated Snippet
struct net_packet_attrs {
const unsigned char *src;
const unsigned char *dst;
u32 ip_src;
u32 ip_dst;
bool tcp;
u16 sport;
u16 dport;
int timeout;
int size;
int max_size;
u8 id;
u16 queue_mapping;
bool bad_csum;
};
struct net_test_priv {
struct net_packet_attrs *packet;
struct packet_type pt;
struct completion comp;
int double_vlan;
int vlan_id;
int ok;
};
struct netsfhdr {
__be32 version;
__be64 magic;
u8 id;
} __packed;
#define NET_TEST_PKT_SIZE (sizeof(struct ethhdr) + sizeof(struct iphdr) + \
sizeof(struct netsfhdr))
#define NET_TEST_PKT_MAGIC 0xdeadcafecafedeadULL
#define NET_LB_TIMEOUT msecs_to_jiffies(200)
#if IS_ENABLED(CONFIG_NET_SELFTESTS)
struct sk_buff *net_test_get_skb(struct net_device *ndev, u8 id,
struct net_packet_attrs *attr);
void net_selftest(struct net_device *ndev, struct ethtool_test *etest,
u64 *buf);
int net_selftest_get_count(void);
void net_selftest_get_strings(u8 *data);
#else
static inline struct sk_buff *net_test_get_skb(struct net_device *ndev, u8 id,
struct net_packet_attrs *attr)
{
return NULL;
}
static inline void net_selftest(struct net_device *ndev, struct ethtool_test *etest,
u64 *buf)
{
}
static inline int net_selftest_get_count(void)
{
return 0;
}
static inline void net_selftest_get_strings(u8 *data)
{
}
#endif
#endif /* _NET_SELFTESTS */
Annotation
- Immediate include surface: `linux/ethtool.h`, `linux/netdevice.h`.
- Detected declarations: `struct net_packet_attrs`, `struct net_test_priv`, `struct netsfhdr`, `function net_selftest`, `function net_selftest_get_strings`.
- 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.