net/core/net_test.c
Source file repositories/reference/linux-study-clean/net/core/net_test.c
File Facts
- System
- Linux kernel
- Corpus path
net/core/net_test.c- Extension
.c- Size
- 10136 bytes
- Lines
- 388
- 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
kunit/test.hlinux/skbuff.hnet/ip_tunnels.h
Detected Declarations
struct gso_test_casestruct ip_tunnel_flags_testenum gso_test_nrfunction __init_skbfunction gso_test_case_to_descfunction gso_test_funcfunction ip_tunnel_flags_test_case_to_descfunction ip_tunnel_flags_test_run
Annotated Snippet
struct gso_test_case {
enum gso_test_nr id;
const char *name;
/* input */
unsigned int linear_len;
unsigned int nr_frags;
const unsigned int *frags;
unsigned int nr_frag_skbs;
const unsigned int *frag_skbs;
/* output as expected */
unsigned int nr_segs;
const unsigned int *segs;
};
static struct gso_test_case cases[] = {
{
.id = GSO_TEST_NO_GSO,
.name = "no_gso",
.linear_len = GSO_TEST_SIZE,
.nr_segs = 1,
.segs = (const unsigned int[]) { GSO_TEST_SIZE },
},
{
.id = GSO_TEST_LINEAR,
.name = "linear",
.linear_len = GSO_TEST_SIZE + GSO_TEST_SIZE + 1,
.nr_segs = 3,
.segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, 1 },
},
{
.id = GSO_TEST_FRAGS,
.name = "frags",
.linear_len = GSO_TEST_SIZE,
.nr_frags = 2,
.frags = (const unsigned int[]) { GSO_TEST_SIZE, 1 },
.nr_segs = 3,
.segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, 1 },
},
{
.id = GSO_TEST_FRAGS_PURE,
.name = "frags_pure",
.nr_frags = 3,
.frags = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, 2 },
.nr_segs = 3,
.segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, 2 },
},
{
.id = GSO_TEST_GSO_PARTIAL,
.name = "gso_partial",
.linear_len = GSO_TEST_SIZE,
.nr_frags = 2,
.frags = (const unsigned int[]) { GSO_TEST_SIZE, 3 },
.nr_segs = 2,
.segs = (const unsigned int[]) { 2 * GSO_TEST_SIZE, 3 },
},
{
/* commit 89319d3801d1: frag_list on mss boundaries */
.id = GSO_TEST_FRAG_LIST,
.name = "frag_list",
.linear_len = GSO_TEST_SIZE,
.nr_frag_skbs = 2,
.frag_skbs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE },
.nr_segs = 3,
.segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, GSO_TEST_SIZE },
},
{
.id = GSO_TEST_FRAG_LIST_PURE,
.name = "frag_list_pure",
.nr_frag_skbs = 2,
.frag_skbs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE },
.nr_segs = 2,
.segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE },
},
{
/* commit 43170c4e0ba7: GRO of frag_list trains */
.id = GSO_TEST_FRAG_LIST_NON_UNIFORM,
.name = "frag_list_non_uniform",
.linear_len = GSO_TEST_SIZE,
.nr_frag_skbs = 4,
.frag_skbs = (const unsigned int[]) { GSO_TEST_SIZE, 1, GSO_TEST_SIZE, 2 },
.nr_segs = 4,
.segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, GSO_TEST_SIZE, 3 },
},
{
/* commit 3953c46c3ac7 ("sk_buff: allow segmenting based on frag sizes") and
* commit 90017accff61 ("sctp: Add GSO support")
*
* "there will be a cover skb with protocol headers and
Annotation
- Immediate include surface: `kunit/test.h`, `linux/skbuff.h`, `net/ip_tunnels.h`.
- Detected declarations: `struct gso_test_case`, `struct ip_tunnel_flags_test`, `enum gso_test_nr`, `function __init_skb`, `function gso_test_case_to_desc`, `function gso_test_func`, `function ip_tunnel_flags_test_case_to_desc`, `function ip_tunnel_flags_test_run`.
- 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.