tools/testing/selftests/net/rxtimestamp.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/rxtimestamp.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/rxtimestamp.c- Extension
.c- Size
- 10308 bytes
- Lines
- 449
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
errno.herror.hgetopt.hstdbool.hstdio.hstdlib.hstring.hunistd.hsys/time.hsys/socket.hsys/select.hsys/ioctl.harpa/inet.hnet/if.hasm/types.hlinux/net_tstamp.hlinux/errqueue.hkselftest.h
Detected Declarations
struct optionsstruct tstampsstruct socket_typestruct test_casestruct sof_flagfunction print_test_casefunction do_sendfunction do_recvfunction config_so_flagsfunction run_test_casefunction main
Annotated Snippet
struct options {
int so_timestamp;
int so_timestampns;
int so_timestamping;
};
struct tstamps {
bool tstamp;
bool tstampns;
bool swtstamp;
bool hwtstamp;
};
struct socket_type {
char *friendly_name;
int type;
int protocol;
bool enabled;
};
struct test_case {
struct options sockopt;
struct tstamps expected;
bool enabled;
bool warn_on_fail;
};
struct sof_flag {
int mask;
char *name;
};
static struct sof_flag sof_flags[] = {
#define SOF_FLAG(f) { f, #f }
SOF_FLAG(SOF_TIMESTAMPING_SOFTWARE),
SOF_FLAG(SOF_TIMESTAMPING_RX_SOFTWARE),
SOF_FLAG(SOF_TIMESTAMPING_RX_HARDWARE),
SOF_FLAG(SOF_TIMESTAMPING_OPT_RX_FILTER),
SOF_FLAG(SOF_TIMESTAMPING_RAW_HARDWARE),
};
static struct socket_type socket_types[] = {
{ "ip", SOCK_RAW, IPPROTO_EGP },
{ "udp", SOCK_DGRAM, IPPROTO_UDP },
{ "tcp", SOCK_STREAM, IPPROTO_TCP },
};
static struct test_case test_cases[] = {
{ {}, {} },
{
{ .so_timestamp = 1 },
{ .tstamp = true }
},
{
{ .so_timestampns = 1 },
{ .tstampns = true }
},
{
{ .so_timestamp = 1, .so_timestampns = 1 },
{ .tstampns = true }
},
{
{ .so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE },
{}
},
{
/* Loopback device does not support hw timestamps. */
{ .so_timestamping = SOF_TIMESTAMPING_RX_HARDWARE },
{}
},
{
{ .so_timestamping = SOF_TIMESTAMPING_SOFTWARE },
.warn_on_fail = true
},
{
{ .so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE
| SOF_TIMESTAMPING_RX_HARDWARE },
{}
},
{
{ .so_timestamping = SOF_TIMESTAMPING_RAW_HARDWARE
| SOF_TIMESTAMPING_OPT_RX_FILTER },
{}
},
{
{ .so_timestamping = SOF_TIMESTAMPING_SOFTWARE
| SOF_TIMESTAMPING_OPT_RX_FILTER },
{}
},
{
Annotation
- Immediate include surface: `errno.h`, `error.h`, `getopt.h`, `stdbool.h`, `stdio.h`, `stdlib.h`, `string.h`, `unistd.h`.
- Detected declarations: `struct options`, `struct tstamps`, `struct socket_type`, `struct test_case`, `struct sof_flag`, `function print_test_case`, `function do_send`, `function do_recv`, `function config_so_flags`, `function run_test_case`.
- Atlas domain: Support Tooling And Documentation / tools.
- 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.