tools/testing/selftests/net/udpgso_bench_tx.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/udpgso_bench_tx.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/udpgso_bench_tx.c- Extension
.c- Size
- 16777 bytes
- Lines
- 735
- 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
arpa/inet.herrno.herror.hlinux/errqueue.hlinux/net_tstamp.hnetinet/if_ether.hnetinet/in.hnetinet/ip.hnetinet/ip6.hnetinet/udp.hpoll.hsched.hsignal.hstdbool.hstdio.hstdlib.hstring.hsys/socket.hsys/time.hsys/poll.hsys/types.hunistd.hkselftest.h
Detected Declarations
function sigint_handlerfunction gettimeofday_msfunction set_cpufunction setup_sockaddrfunction flush_cmsgfunction flush_errqueue_recvfunction flush_errqueuefunction flush_errqueue_retryfunction send_tcpfunction send_udpfunction send_ts_cmsgfunction send_udp_sendmmsgfunction send_udp_segment_cmsgfunction send_udp_segmentfunction usagefunction parse_optsfunction set_pmtu_discoverfunction set_tx_timestampingfunction print_audit_reportfunction print_reportfunction main
Annotated Snippet
if (cmsg->cmsg_type == SO_TIMESTAMPING) {
i = (cfg_tx_ts == SOF_TIMESTAMPING_TX_HARDWARE) ? 2 : 0;
tss = (struct scm_timestamping *)CMSG_DATA(cmsg);
if (tss->ts[i].tv_sec == 0)
stat_tx_ts_errors++;
} else {
error(1, 0, "unknown SOL_SOCKET cmsg type=%u\n",
cmsg->cmsg_type);
}
break;
case SOL_IP:
case SOL_IPV6:
switch (cmsg->cmsg_type) {
case IP_RECVERR:
case IPV6_RECVERR:
{
err = (struct sock_extended_err *)CMSG_DATA(cmsg);
switch (err->ee_origin) {
case SO_EE_ORIGIN_TIMESTAMPING:
/* Got a TX timestamp from error queue */
stat_tx_ts++;
break;
case SO_EE_ORIGIN_ICMP:
case SO_EE_ORIGIN_ICMP6:
if (cfg_verbose)
fprintf(stderr,
"received ICMP error: type=%u, code=%u\n",
err->ee_type, err->ee_code);
break;
case SO_EE_ORIGIN_ZEROCOPY:
{
lo = err->ee_info;
hi = err->ee_data;
/* range of IDs acknowledged */
stat_zcopies += hi - lo + 1;
break;
}
case SO_EE_ORIGIN_LOCAL:
if (cfg_verbose)
fprintf(stderr,
"received packet with local origin: %u\n",
err->ee_origin);
break;
default:
error(0, 1, "received packet with origin: %u",
err->ee_origin);
}
break;
}
default:
error(0, 1, "unknown IP msg type=%u\n",
cmsg->cmsg_type);
break;
}
break;
default:
error(0, 1, "unknown cmsg level=%u\n",
cmsg->cmsg_level);
}
}
static void flush_errqueue_recv(int fd)
{
char control[CMSG_SPACE(sizeof(struct scm_timestamping)) +
CMSG_SPACE(sizeof(struct sock_extended_err)) +
CMSG_SPACE(sizeof(struct sockaddr_in6))] = {0};
struct msghdr msg = {0};
struct cmsghdr *cmsg;
int ret;
while (1) {
msg.msg_control = control;
msg.msg_controllen = sizeof(control);
ret = recvmsg(fd, &msg, MSG_ERRQUEUE);
if (ret == -1 && errno == EAGAIN)
break;
if (ret == -1)
error(1, errno, "errqueue");
if (msg.msg_flags != MSG_ERRQUEUE)
error(1, 0, "errqueue: flags 0x%x\n", msg.msg_flags);
if (cfg_audit) {
for (cmsg = CMSG_FIRSTHDR(&msg);
cmsg;
cmsg = CMSG_NXTHDR(&msg, cmsg))
flush_cmsg(cmsg);
}
msg.msg_flags = 0;
}
}
Annotation
- Immediate include surface: `arpa/inet.h`, `errno.h`, `error.h`, `linux/errqueue.h`, `linux/net_tstamp.h`, `netinet/if_ether.h`, `netinet/in.h`, `netinet/ip.h`.
- Detected declarations: `function sigint_handler`, `function gettimeofday_ms`, `function set_cpu`, `function setup_sockaddr`, `function flush_cmsg`, `function flush_errqueue_recv`, `function flush_errqueue`, `function flush_errqueue_retry`, `function send_tcp`, `function send_udp`.
- 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.