tools/testing/selftests/drivers/net/hw/iou-zcrx.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/drivers/net/hw/iou-zcrx.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/drivers/net/hw/iou-zcrx.c- Extension
.c- Size
- 11432 bytes
- Lines
- 513
- 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
assert.herrno.herror.hfcntl.hlimits.hstdbool.hstdint.hstdio.hstdlib.hstring.hunistd.harpa/inet.hlinux/mman.hlinux/errqueue.hlinux/if_packet.hlinux/ipv6.hlinux/socket.hlinux/sockios.hnet/ethernet.hnet/if.hnetinet/in.hnetinet/ip.hnetinet/ip6.hnetinet/tcp.hnetinet/udp.hsys/epoll.hsys/ioctl.hsys/mman.hsys/resource.hsys/socket.hsys/stat.hsys/time.h
Detected Declarations
struct t_io_uring_zcrx_ifq_regfunction gettimeofday_msfunction parse_addressfunction get_refill_ring_sizefunction setup_zcrxfunction add_acceptfunction add_recvzcfunction add_recvzc_oneshotfunction process_acceptfunction process_recvzcfunction server_loopfunction io_uring_for_each_cqefunction run_serverfunction run_clientfunction usagefunction parse_optsfunction main
Annotated Snippet
struct t_io_uring_zcrx_ifq_reg {
__u32 if_idx;
__u32 if_rxq;
__u32 rq_entries;
__u32 flags;
__u64 area_ptr; /* pointer to struct io_uring_zcrx_area_reg */
__u64 region_ptr; /* struct io_uring_region_desc * */
struct io_uring_zcrx_offsets offsets;
__u32 zcrx_id;
__u32 rx_buf_len;
__u64 __resv[3];
};
static long page_size;
#define AREA_SIZE (8192 * page_size)
#define SEND_SIZE (512 * 4096)
#define min(a, b) \
({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
_a < _b ? _a : _b; \
})
#define min_t(t, a, b) \
({ \
t _ta = (a); \
t _tb = (b); \
min(_ta, _tb); \
})
#define ALIGN_UP(v, align) (((v) + (align) - 1) & ~((align) - 1))
static int cfg_server;
static int cfg_client;
static int cfg_port = 8000;
static int cfg_payload_len;
static const char *cfg_ifname;
static int cfg_queue_id = -1;
static bool cfg_oneshot;
static int cfg_oneshot_recvs;
static int cfg_send_size = SEND_SIZE;
static struct sockaddr_in6 cfg_addr;
static unsigned int cfg_rx_buf_len;
static bool cfg_dry_run;
static char *payload;
static void *area_ptr;
static void *ring_ptr;
static size_t ring_size;
static struct io_uring_zcrx_rq rq_ring;
static unsigned long area_token;
static int connfd;
static bool stop;
static size_t received;
static unsigned long gettimeofday_ms(void)
{
struct timeval tv;
gettimeofday(&tv, NULL);
return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
}
static int parse_address(const char *str, int port, struct sockaddr_in6 *sin6)
{
int ret;
sin6->sin6_family = AF_INET6;
sin6->sin6_port = htons(port);
ret = inet_pton(sin6->sin6_family, str, &sin6->sin6_addr);
if (ret != 1) {
/* fallback to plain IPv4 */
ret = inet_pton(AF_INET, str, &sin6->sin6_addr.s6_addr32[3]);
if (ret != 1)
return -1;
/* add ::ffff prefix */
sin6->sin6_addr.s6_addr32[0] = 0;
sin6->sin6_addr.s6_addr32[1] = 0;
sin6->sin6_addr.s6_addr16[4] = 0;
sin6->sin6_addr.s6_addr16[5] = 0xffff;
}
return 0;
}
static inline size_t get_refill_ring_size(unsigned int rq_entries)
{
Annotation
- Immediate include surface: `assert.h`, `errno.h`, `error.h`, `fcntl.h`, `limits.h`, `stdbool.h`, `stdint.h`, `stdio.h`.
- Detected declarations: `struct t_io_uring_zcrx_ifq_reg`, `function gettimeofday_ms`, `function parse_address`, `function get_refill_ring_size`, `function setup_zcrx`, `function add_accept`, `function add_recvzc`, `function add_recvzc_oneshot`, `function process_accept`, `function process_recvzc`.
- 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.