tools/testing/selftests/net/packetdrill/tcp_zerocopy_maxfrags.pkt
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/packetdrill/tcp_zerocopy_maxfrags.pkt
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/packetdrill/tcp_zerocopy_maxfrags.pkt- Extension
.pkt- Size
- 4612 bytes
- Lines
- 121
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
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.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
// tcp_MAX_SKB_FRAGS test
//
// Verify that sending an iovec of tcp_MAX_SKB_FRAGS + 1 elements will
// 1) fit in a single packet without zerocopy
// 2) spill over into a second packet with zerocopy,
// because each iovec element becomes a frag
// 3) the PSH bit is set on an skb when it runs out of fragments
--send_omit_free // do not reuse send buffers with zerocopy
`./defaults.sh`
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0 setsockopt(3, SOL_SOCKET, SO_ZEROCOPY, [1], 4) = 0
// Each pinned zerocopy page is fully accounted to skb->truesize.
// This test generates a worst case packet with each frag storing
// one byte, but increasing truesize with a page (64KB on PPC).
+0 setsockopt(3, SOL_SOCKET, SO_SNDBUF, [2000000], 4) = 0
+0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0
+0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
+0 < . 1:1(0) ack 1 win 257
+0 accept(3, ..., ...) = 4
// send an iov of 18 elements: just becomes a linear skb
+0 sendmsg(4, {msg_name(...)=...,
msg_iov(18)=[{..., 1}, {..., 1}, {..., 1}, {..., 1},
{..., 1}, {..., 1}, {..., 1}, {..., 1},
{..., 1}, {..., 1}, {..., 1}, {..., 1},
{..., 1}, {..., 1}, {..., 1}, {..., 1},
{..., 1}, {..., 1}],
msg_flags=0}, 0) = 18
+0 > P. 1:19(18) ack 1
+0 < . 1:1(0) ack 19 win 257
// send a zerocopy iov of 18 elements:
+1 sendmsg(4, {msg_name(...)=...,
msg_iov(18)=[{..., 1}, {..., 1}, {..., 1}, {..., 1},
{..., 1}, {..., 1}, {..., 1}, {..., 1},
{..., 1}, {..., 1}, {..., 1}, {..., 1},
{..., 1}, {..., 1}, {..., 1}, {..., 1},
{..., 1}, {..., 1}],
msg_flags=0}, MSG_ZEROCOPY) = 18
// verify that it is split in one skb of 17 frags + 1 of 1 frag
// verify that both have the PSH bit set
+0 > P. 19:36(17) ack 1
+0 < . 1:1(0) ack 36 win 257
+0 > P. 36:37(1) ack 1
+0 < . 1:1(0) ack 37 win 257
+1 recvmsg(4, {msg_name(...)=...,
msg_iov(1)=[{...,0}],
msg_flags=MSG_ERRQUEUE,
msg_control=[
{cmsg_level=CMSG_LEVEL_IP,
cmsg_type=CMSG_TYPE_RECVERR,
cmsg_data={ee_errno=0,
ee_origin=SO_EE_ORIGIN_ZEROCOPY,
ee_type=0,
ee_code=SO_EE_CODE_ZEROCOPY_COPIED,
Annotation
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
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.